00001 /***************************************************************************** 00002 * \file dbedit.h <mi32/dbedit.h> 00003 * \brief DBEDIT class definitions. 00004 * 00005 * \if NODOC 00006 * $Id: dbedit.h_v 1.38 2005/03/31 16:57:10 fileserver!dwilliss Exp $ 00007 * 00008 * $Log: dbedit.h_v $ 00009 * Revision 1.38 2005/03/31 16:57:10 fileserver!dwilliss 00010 * Rename one of our types to MIUNICODE because it conflicted with a Microsoft #define 00011 * 00012 * Revision 1.37 2005/02/28 20:41:38 dwilliss 00013 * *** empty log message *** 00014 * 00015 * Revision 1.36 2004/05/13 15:39:07 dwilliss 00016 * Table creation wizard done 00017 * 00018 * Revision 1.35 2004/05/10 20:57:31 dwilliss 00019 * Added a fieldinfo to TableCreate so you can create with initial fields 00020 * 00021 * Revision 1.34 2004/04/12 16:42:49 dwilliss 00022 * Changed style editing to use MGUI and RVC interface classes 00023 * 00024 * Revision 1.33 2004/03/08 15:38:24 mju 00025 * No old mgui hdr. 00026 * 00027 * Revision 1.32 2003/10/13 20:45:06 scowan 00028 * Replaced callback queue pointer with a simple array. 00029 * Removed unused members. 00030 * 00031 * Revision 1.31 2003/09/15 13:49:56 fileserver!dwilliss 00032 * Doxygen 00033 * 00034 * Revision 1.30 2003/05/28 15:13:58 dwilliss 00035 * *** empty log message *** 00036 * 00037 * Revision 1.29 2002/09/17 14:15:30 dwilliss 00038 * Added new SetStyleObject method that takes OBJITEM 00039 * 00040 * Revision 1.28 2002/05/07 20:46:10 dwilliss 00041 * Off by one error in GetTableData(). 00042 * 00043 * Revision 1.27 2002/05/07 14:46:42 dwilliss 00044 * Changed the TableData array to be a SIMPLE_ARRAY 00045 * 00046 * Revision 1.26 2002/01/25 18:05:32 dwilliss 00047 * Fixed for new MGD 00048 * 00049 * Revision 1.25 2001/12/13 16:59:25 mju 00050 * MGUI unification. 00051 * 00052 * Revision 1.24 2001/12/12 20:15:20 dwilliss 00053 * Added method to get database inode 00054 * 00055 * Revision 1.23 2001/10/25 15:03:38 dwilliss 00056 * MFC version working now 00057 * 00058 * Revision 1.22 2001/09/07 15:02:08 mju 00059 * Add IsCreated() method. 00060 * 00061 * Revision 1.21 2001/07/30 17:12:36 mju 00062 * Change SetStyleObject to use const for dftstyle. 00063 * 00064 * Revision 1.20 2001/07/25 17:46:16 mju 00065 * Make DBVIEW_... flags an enum. 00066 * 00067 * Revision 1.19 2001/07/12 19:14:13 dwilliss 00068 * Added methods for table definition dialog and new table dialog 00069 * 00070 * Revision 1.17 2001/06/04 20:27:01 dwilliss 00071 * Moved style sample drawing code to TDATA 00072 * 00073 * Revision 1.16 2001/06/04 19:13:35 dwilliss 00074 * Constructor/Destructor now usable. 00075 * 00076 * Revision 1.15 2000/10/13 14:33:25 dwilliss 00077 * When declaring friends, must specify friend class NAME, not just friend NAME 00078 * 00079 * Revision 1.14 2000/08/08 19:47:00 scowan 00080 * Fixed stuff to be elemtype instead of int. 00081 * 00082 * Revision 1.11 1999/10/29 19:46:46 dwilliss 00083 * Added methods to get label colors as COLOR rather than Pixel 00084 * 00085 * Revision 1.10 1999/10/29 17:48:30 dwilliss 00086 * Added sanity check to GetTableData() 00087 * 00088 * Revision 1.9 1999/10/20 20:35:38 dwilliss 00089 * Some methods take const filenames now 00090 * 00091 * Revision 1.4 1999/07/02 21:09:31 dwilliss 00092 * Cleanup for WIN32_NATIVE 00093 * 00094 * Revision 1.1 1999/04/07 22:43:25 dwilliss 00095 * Initial revision 00096 * 00097 * \endif 00098 ****************************************************************************/ 00099 00100 #ifndef INC_MI32_DBEDIT_H 00101 #define INC_MI32_DBEDIT_H 00102 00103 #ifndef INC_MI32_MXDBEDIT_H 00104 #include <mi32/mxdbedit.h> 00105 #endif 00106 00107 #ifndef INC_MI32_MCB_H 00108 #include <mi32/mcb.h> 00109 #endif 00110 00111 #ifndef INC_MI32_MSTATUS_H 00112 #include <mi32/mstatus.h> 00113 #endif 00114 00115 #ifndef INC_MI32_LONGLIST_H 00116 #include <mi32/longlist.h> 00117 #endif 00118 00119 #ifndef INC_MI32_RVCDBASE_H 00120 #include <mi32/rvcdbase.h> 00121 #endif 00122 00123 #ifndef INC_MI32_SIMPLEAR_H 00124 #include <mi32/simplear.h> 00125 #endif 00126 00127 #ifndef INC_MI32_ELEMSTYL_H 00128 #include <mi32/elemstyl.h> 00129 #endif 00130 00131 #ifndef INC_RVC_STYLE_H 00132 #include <rvc/style.h> 00133 #endif 00134 00135 00136 #ifdef WIN32_MFC 00137 #ifndef INC_MGUI_LAYOUT_H 00138 #include <mgui/layout.h> 00139 #endif 00140 #endif 00141 00142 #if defined __cplusplus 00143 //! The various classes and structs that are internal to the 00144 //! implementation, but not this class. 00145 00146 //! Forward declarations 00147 00148 class DBEDIT; 00149 class DBEDIT_TDATA; //!< Table data 00150 class DBEDIT_SDATA; //!< Tabular view's implementation 00151 class DBEDIT_TINSTANCE; //!< Table instance 00152 class DBEDIT_FDATA; //!< Field data 00153 class DBEDIT_SRV; //!< Base class for all SingleRecordView derived classes 00154 class DBEDIT_SINGLERECORDVIEW; //!< Actual SingleRecordView 00155 class DBEDIT_STYLEDIALOG; //!< Style Data 00156 class CDBEDITFUNCS; //!< Instance factory 00157 00158 namespace MGD { 00159 class DEVICE; 00160 class CONTEXT; 00161 } 00162 00163 struct DBEDITFUNCS; 00164 struct RECSTYLESAMPLE; 00165 struct DBEDIT_FIELDOPT; //!< Field options 00166 00167 00168 //!***************************************************************************** 00169 //! DBEDIT 00170 //!***************************************************************************** 00171 00172 00173 class DBEDIT { 00174 public: 00175 00176 // CONSTRUCTION 00177 00178 //! Constructor. 00179 //! Note: Since a constructor can't return an error, it only initialized 00180 //! the class to blank settings. You should call the Create method to 00181 //! actually set the thing up. 00182 DBEDIT(); 00183 00184 ~DBEDIT(); 00185 00186 //======================================================================== 00187 //! Enums 00188 00189 enum MODE { 00190 MODE_SingleRecord = 0, 00191 MODE_Form, 00192 MODE_TabularView, 00193 MODE_GenView, 00194 #ifdef WIN32_MFC 00195 MODE_ModalSingleRecord, 00196 #endif 00197 MODE_NumModes 00198 }; 00199 00200 //! This should go in DBEDIT. 00201 enum LABELCOLOR { 00202 LABELCOLOR_Normal = 0, 00203 LABELCOLOR_Computed, 00204 LABELCOLOR_PK, 00205 LABELCOLOR_FK 00206 }; 00207 00208 //======================================================================== 00209 // METHODS 00210 00211 //! Add a callback. 00212 int CallbackAdd ( 00213 void (*func)(MxdDatabaseEditorCallbackStruct *, void *), 00214 void *data, 00215 UINT32 reason 00216 ); 00217 00218 //! Remove a callback. 00219 void CallbackRemove ( 00220 void (*func)(MxdDatabaseEditorCallbackStruct *, void *), 00221 void *data, 00222 UINT32 reason 00223 ); 00224 00225 //! Call callbacks. 00226 //! 00227 //! This should be private. Only used by friend classes. 00228 void CallCallbacks ( 00229 MxdDatabaseEditorCallbackStruct *cbs, 00230 UINT32 reason 00231 ); 00232 00233 //! Close everything, but don't destroy anything. 00234 int Close(); 00235 00236 //! Create. 00237 //! 00238 //! You should call this after constructing the DBEDIT and 00239 //! check for an error. This is because a constructor can't 00240 //! return an error. 00241 int Create ( 00242 MDLGPARENT parent, 00243 const MIUNICODE *fname, 00244 INT32 pinode, //!< Inode of database object's parent (vector, raster, whatever) 00245 ELEMTYPE elemtype, //!< Element type of the database to open (ELEMTYPE_Record if pinode is of an OTYPE_DBASE) 00246 UINT32 flags = 0 00247 ); 00248 00249 00250 //! Suspend database callbacks. 00251 //! 00252 //! Unless ReallyIgnore is set, callbacks which 00253 //! happen while suspended will be queued and processed when resumed. 00254 //! Suspend/Resumes are refcounted. 00255 void DBCallbackSuspend ( 00256 bool ReallyIgnore, 00257 bool Totally = false //!< If true, throw out everything - Use with caution 00258 ); 00259 00260 //! Resume database callback handling. 00261 //! 00262 //! If any callbacks happened while 00263 //! suspended (and we're not still suspended) they will be processed. 00264 void DBCallbackResume ( 00265 bool ReallyIgnore, 00266 bool Totally = false //!< If true, throw out everything - Use with caution 00267 ); 00268 00269 //! Find records. 00270 //! 00271 //! Shouldn't this be private? Should only be called by friend classes. 00272 int FindRecords ( 00273 int active 00274 ); 00275 00276 //! Force all unwritten records to be written. 00277 int Flush(); 00278 00279 //! Close a form. 00280 int FormClose ( 00281 INT32 inode //!< Inode of form to close 00282 ); 00283 00284 //! Deleta a form. 00285 int FormDrop ( 00286 MDLGPARENT parent, //!< Parent widget for "Are you sure" dialog 00287 INT32 inode //!< Inode of form do delete 00288 ); 00289 00290 //! Create a new, blank form. 00291 int FormNew ( 00292 MDLGPARENT parent, //!< Parent widget for dialogs 00293 INT32 * pinode, //!< Returned inode of the form created 00294 UINT32 flags 00295 ); 00296 00297 //! Open a form. 00298 int FormOpen ( 00299 INT32 inode, //!< Inode of form to open 00300 UINT32 flags //!< flags XXX 00301 ); 00302 00303 //! Create a generic single record view form for a given table. 00304 //! 00305 //! This form doesn't do anything automatically. 00306 //! This is the X version of this function. 00307 #ifdef X_NATIVE 00308 int GenViewCreate ( 00309 DBEDIT_TINSTANCE **pinstance, //!< instance returned 00310 INT32 TableNum, //!< Table number to create view for 00311 MDLGPARENT parent, //!< Parent widget to create view in 00312 MDLGPARENT *pwidget, //!< XmForm returned 00313 Arg *uarg, //!< Arguments to use when creating form 00314 int numuargs, 00315 UINT32 flags 00316 ); 00317 #endif 00318 #ifdef WIN32_MFC 00319 //! Create a generic single record view form for a given table. 00320 //! 00321 //! This form doesn't do anything automatically. 00322 //! This is the MFC version of this function. 00323 int GenViewCreate ( 00324 DBEDIT_TINSTANCE **pinstance, //!< instance returned 00325 INT32 TableNum, //!< Table number to create view for 00326 MGUI::LAYOUT_PANE_BASE& ParentPane, 00327 UINT32 flags 00328 ); 00329 #endif 00330 00331 //! Get the active element number. 00332 //! 00333 //! Returns MxdDATABASE_NoElement if none active. 00334 int GetActiveElement ( 00335 ) const { 00336 return (m_Element); 00337 } 00338 00339 //! Get the RVC object handle for this database. 00340 int GetDatabaseHandle ( 00341 ) const { 00342 return (m_id); 00343 } 00344 00345 //! Get the RVC file handle for this database. 00346 int GetFileHandle ( 00347 ) const { 00348 return (m_fid); 00349 } 00350 00351 //! Used by database relationships dialog to make sure there's only one instance of itself. 00352 void *GetDBRelateHandle() const { 00353 return (m_DBRelateHandle); 00354 } 00355 00356 //! Get the ELEMTYPE_ for this database. 00357 ELEMTYPE GetElemType ( 00358 ) const { 00359 return (m_ElemType); 00360 } 00361 00362 //! Get the inode of the database 00363 RVCINODENUM GetInode ( 00364 ) const { 00365 return (m_info.objectinode); 00366 } 00367 00368 #ifdef WIN32_NATIVE 00369 00370 //! Get the color to use for a label from the DBFIELDINFO.flags XXX. 00371 //! 00372 //! These should return a COLORREF, but I don't know where 00373 //! that's defined. I don't think I really want this to include 00374 //! it anyway. 00375 UINT32 GetLabelColorFromFlags ( 00376 UINT32 flags //!< From DBFIELDINFO.flags 00377 ); 00378 00379 //! Get the color to use for a label given a DBEDIT::LABELCOLOR. 00380 UINT32 GetLabelColor ( 00381 LABELCOLOR color 00382 ); 00383 #else 00384 //! Get the color to use for a label from the DBFIELDINFO.flags. 00385 Pixel GetLabelColorFromFlags ( 00386 UINT32 flags //!< From DBFIELDINFO.flags 00387 ); 00388 00389 //! Get the color to use for a label given a DBEDIT::LABELCOLOR. 00390 Pixel GetLabelColor ( 00391 LABELCOLOR color 00392 ); 00393 #endif 00394 //! Get the color to use for a label from the DBFIELDINFO.flags. 00395 void GetLabelColorFromFlags ( 00396 UINT32 flags, 00397 COLOR& color 00398 ); 00399 00400 //! Get the color to use for a label given a DBEDIT::LABELCOLOR. 00401 void GetLabelColor ( 00402 LABELCOLOR colornum, 00403 COLOR& color 00404 ); 00405 00406 //! Get the number of tables open. 00407 int GetNumOpen(); 00408 00409 //! Get the number of tables in the database. 00410 int GetNumTables ( 00411 ) const { 00412 return (m_info.NumTables); 00413 } 00414 00415 //! Get the OTYPE of the database object. 00416 int GetObjType ( 00417 ) const { 00418 return (m_info.objtype); 00419 } 00420 00421 //! Get the widget used as a parent for any dialogs we create. 00422 MDLGPARENT GetParent ( 00423 ) const { 00424 return m_toplevel; 00425 } 00426 00427 //! Get the DBEDIT_TDATA for a given table. 00428 //! 00429 //! Should this be private? 00430 inline DBEDIT_TDATA *GetTableData ( 00431 int table //!< Get internal table data 00432 ) const { 00433 if (table == -2) table = -1; // Cope with internal node table 00434 ++table; //!< To account for table -1 00435 if (table < 0 || table >= m_TableData.GetNumItems()) return(NULL); 00436 return(m_TableData[table]); 00437 } 00438 00439 //! Returns the instance handle for a given table and open mode. 00440 //! 00441 //! Will create one unless passed the flag DBVIEW_NoCreateIfNotExist. 00442 DBEDIT_TINSTANCE *GetTableInstanceHandle ( 00443 INT32 TableNum, //!< Table number to look for 00444 UINT32 flags //!< DBVIEW_TabularView or 0 00445 ); 00446 00447 //! Determine if Create() has been done yet. 00448 bool IsCreated ( 00449 ) const { 00450 return (m_id > 0); 00451 } 00452 00453 //! Returns true if this database is not under a vector or anything. 00454 int IsMainLevel ( 00455 ) const { 00456 return (m_is_main_level); 00457 } 00458 00459 //! Returns true if the database is being used for pin-mapping. 00460 //! 00461 //! i.e., we've called SetRecord or SetElement with an ELEMTYPE 00462 //! of ELEMTYPE_Record. 00463 int IsPinMapping ( 00464 ) const { 00465 return (m_pin_mapping); 00466 } 00467 00468 //! Returns 1 if the requested table is open in some way. 00469 int IsTableOpen ( 00470 int TableNum //!< Table to check for 00471 ); 00472 00473 //----------------------------------------------- 00474 //! Open a table in single record view as a modal dialog. 00475 //! 00476 //! @return Record number or error (May be EUserCancel). 00477 int ModalSingleRecordView ( 00478 INT32 TableNum, //!< Table number to open 00479 INT32 Record, //!< Record to edit (or RECORD_New) 00480 void *initvals, //!< Buffer to initialize as (only for record==RECORD_New) 00481 MDLGPARENT parent, //!< Parent widget to use for dialog 00482 UINT32 flags //!< MxdDATABASE_AutoSave if you don't want a "Do you wish to save changes" question on OK 00483 ); 00484 00485 //! Add an element to the multi-Select list. 00486 int MultiSelectAddElement ( 00487 INT32 element //!< Element number or MxdDATABASE_NoElement 00488 ); 00489 00490 //! Add an element to the multi-Select list. 00491 //! 00492 //! Don't use this version. It's only here for backwards compatibility. 00493 //! It's used by the wrapper function MxdDatabaseEditorSetElement(). 00494 int MultiSelectAddElementOld ( 00495 INT32 element, //!< Element number or MxdDATABASE_NoElement 00496 ELEMTYPE elemtype //!< Why did we pass this for every element? 00497 ); 00498 00499 //! Remove an element from the multi-Select list. 00500 int MultiSelectRemoveElement ( 00501 INT32 element //!< Element to remove from the selected element set 00502 ); 00503 00504 //! Start adding elements to the element list. 00505 //! 00506 //! SetElements() is the prefered method, but isn't well suited 00507 //! to CAD. Call MultiSelectStart, MultiSelectAddElement as many 00508 //! times as you need, then MultiSelectEnd. If you want to clear 00509 //! the list first, pass MxdDATABASE_Clear. 00510 int MultiSelectStart ( 00511 UINT32 flags, //!< MxdDATABASE_Clear 00512 ELEMTYPE ElemType, //!< ELEMTYPE_Xxxx 00513 int BaseTable = 0 //!< Only needed if for ELEMTYPE_Record 00514 ); 00515 00516 //! Finish a multiple element selection. 00517 int MultiSelectEnd ( 00518 UINT32 flags //!< Could pass MxdDATABASE_DontUpdateDialogs 00519 ); 00520 00521 00522 //! Open the style object associated with a database. 00523 //! 00524 //! This is for use by DBEDIT_TDATA only (?). 00525 bool GetStyleObject ( 00526 RVC::STYLE& StyleObj 00527 ); 00528 00529 //! Notify the database editor that attachments to active element may have changed. 00530 //! 00531 //! (Should be unnecessary now that we have 00532 //! database callbacks to deal with all this, but you can totally 00533 //! suspend the callbacks). 00534 int RefreshActiveElementAttachments ( 00535 UINT32 flags //!< Can be MxdDATABASE_DontUpdateDialogs 00536 ); 00537 00538 //! Notify the database editor that attachments may have changed. 00539 //! 00540 //! (Should be unnecessary now that we have 00541 //! database callbacks to deal with all this, but you can totally 00542 //! suspend the callbacks). 00543 int RefreshAttachments ( 00544 UINT32 flags //!< Can be MxdDATABASE_DontUpdateDialogs 00545 ); 00546 00547 //! Set the "active" element. 00548 int SetActiveElement ( 00549 INT32 element, //!< Element number of MxdDATABASE_NoElement 00550 ELEMTYPE elemtype, //!< ELEMTYPE_Xxxx 00551 UINT32 flags, //!< Can be MxdDATABASE_DontUpdateDialogs 00552 INT32 BaseTable = 0 //!< Table to use if this is ELEMTYPE_RECORD 00553 ); 00554 00555 //! Set the base table number for PinMapping. 00556 void SetBaseTable ( 00557 int table //!< Table number to use 00558 ); 00559 00560 //! Used by database relationships dialog to make sure there's only one instance of itself. 00561 void SetDBRelateHandle ( 00562 void *handle 00563 ) { 00564 m_DBRelateHandle = handle; 00565 } 00566 00567 //! Set the list of selected elements using a bit array. 00568 int SetElements ( 00569 ELEMTYPE ElemType, //!< ELEMTYPE_Xxxx 00570 INT32 BaseTable, //!< Base table number 00571 UINT8 *Bits, //!< Bit array with selected elements set 00572 INT32 NumElements, //!< Number of bits in array 00573 INT32 ActiveElement, //!< Active element number 00574 UINT32 flags //!< could pass MxdDATABASE_DontUpdateDialogs, but why? 00575 ); 00576 00577 //! Set widget to use as parent for all dialogs. 00578 void SetParent ( 00579 MDLGPARENT parent //!< Widget to use as a parent 00580 ) { 00581 m_toplevel = parent; 00582 } 00583 00584 //! Set the current record. 00585 //! 00586 //! This just Calls SetActiveElement. 00587 int SetRecord ( 00588 int table, //!< Base table number 00589 INT32 record //!< Current record number 00590 ); 00591 00592 //! Set the style number to edit in the style editor dialog. 00593 //! 00594 //! Also remembers internally which record this was for. 00595 //! Returns without doing anything if style editor isn't open. 00596 int SetStyleNumber ( 00597 int StyleNum, //!< Style number to edit 00598 int RecNum //!< Record number in Style Assignment Table 00599 ); 00600 00601 //! Set the style object to use for style samples. 00602 int SetStyleObject ( 00603 const MIUNICODE *fname, //!< Filename of style object 00604 INT32 inode, //!< inode of style object 00605 int table, //!< Style Assignment Table number 00606 const void *dftstyle //!< Default style appropriate to the database type 00607 ); 00608 00609 //! Set the style object to use for style samples. 00610 int SetStyleObject ( 00611 const RVC::OBJITEM& StyleObjItem, //!< Style object to use 00612 const RVC::OBJECTNAME& StyleTableName, //!< Name of style table 00613 const void *dftstyle //!< Default style appropriate to the database type 00614 ); 00615 00616 //! Open the style editor dialog. 00617 int StyleDialogOpen ( 00618 MDLGPARENT parent //!< Parent widget for the dialog 00619 ); 00620 00621 //! Close the style dialog. 00622 //! 00623 //! Actually does nothing. 00624 int StyleDialogClose ( 00625 ); 00626 00627 //! Popup a table creation dialog. 00628 //! This pops up the "New Table" dialog to let the user design a new table. 00629 //! 00630 //! If the optional tableinfo is supplied, it will be used for defaults and 00631 //! the the new table's info will be returned in it. 00632 int TableCreate ( 00633 MDLGPARENT parent, //!< Parent widget for dialogs 00634 RVCTABLEINFO* info, //!< Defaults for new table (optional) 00635 DBFIELDINFO* finfo 00636 #ifndef TABLEDEF_C 00637 = 0 //!< Initial field info (optional) 00638 #endif 00639 ); 00640 00641 #ifdef TABLEDEF_C 00642 // After tonight's build, remove this and force finfo to have a default 00643 // value above. Until then, we get link errors if we don't have a 2-parm 00644 // version of the function around. (10-May-04) 00645 int TableCreate ( 00646 MDLGPARENT parent, //!< Parent widget for dialogs 00647 RVCTABLEINFO* info //!< Defaults for new table (optional) 00648 ); 00649 00650 #endif 00651 00652 //! Popup a table creation wizard. 00653 //! This uses a wizard to walk the user through the first few steps of 00654 //! creating a table. 00655 int TableCreate ( 00656 MDLGPARENT parent //!< Parent widget for dialogs 00657 ); 00658 00659 //! Drop (delete) a table. 00660 int TableDrop ( 00661 MDLGPARENT parent, //!< Parent for "Are you sure" dialog 00662 int TableNum //!< Table number to drop 00663 ); 00664 00665 //! popup a dialog to allow the user to edit the table's definition. 00666 int TableEditDefinition ( 00667 MDLGPARENT parent, //!< Parent for "Are you sure" dialog 00668 int TableNum //!< Table number to drop 00669 ); 00670 00671 //! Open a table window in DBVIEW_TabularView mode or (default) Single Record View. 00672 int TableOpen ( 00673 INT32 TableNum, //!< Table number to open 00674 UINT32 flags //!< DBVIEW_flags (in xdefns.h) 00675 ); 00676 00677 //! Close all instances of a given table. 00678 int TableClose ( 00679 INT32 TableNum //!< Table number to close (all instances) 00680 ); 00681 00682 //! Destroy table instance (just the dialog, not the underlying table). 00683 int TableDestroy ( 00684 int TableNum //!< Table number to destroy 00685 ); 00686 00687 //! Force all open table windows to update. 00688 int UpdateDialogs (); 00689 00690 //! Similar to DBCallbackResume, but if resuming (it's refcounted so may these can be nested), this will check to see if we think we need to update everything and do so. 00691 //! 00692 //! In a perfect world, this should never 00693 //! be the case. CallbackResume will handle it all for us. 00694 int UpdateResume ( 00695 UINT32 flags //!< could pass MxdDATABASE_DontUpdateDialogs, but why? 00696 ); 00697 00698 //! Just calls DBCallbackSuspend(). 00699 void UpdateSuspend(); 00700 00701 private: 00702 #ifndef GENERATING_DOXYGEN_OUTPUT 00703 00704 // MEMBERS 00705 00706 MDLGPARENT m_main_widget; 00707 MDLGPARENT m_toplevel; 00708 RVCDBASEINFO m_info; 00709 INT32 m_flags; //!< flags passed to CreateDatabaseWindow() 00710 bool m_is_open; 00711 bool m_is_main_level; 00712 bool m_pos_known; 00713 bool m_need_resize; 00714 bool m_show_style_tables; 00715 bool m_pin_mapping; 00716 bool m_multi_select; 00717 bool m_use_tabular_view; 00718 bool m_ReallyIgnoreCallback_DamnIt; 00719 bool m_NeedUpdate; 00720 bool m_LabelColorsKnown; 00721 int m_fid, m_id; //!< ID of open database 00722 int m_type; //!< line/node/poly/cad/main 00723 INT32 m_Element; //!< "active" Vector/CAD element number 00724 LONGLIST m_ElemList; 00725 LONGLIST m_ActiveElemList; 00726 ELEMTYPE m_ElemType; 00727 INT32 m_BaseTable; //!< For Pin-Mapping, record # is in Element 00728 #ifdef WIN32_NATIVE 00729 int m_x, m_y; 00730 int m_h, m_w; 00731 int m_maxfwidth, m_total_height; 00732 int m_maxwidth; 00733 #else 00734 Position m_x, m_y; 00735 Dimension m_h, m_w; 00736 Dimension m_maxfwidth, m_total_height; 00737 Dimension m_maxwidth; 00738 #endif 00739 DBEDIT_TDATA **m_formtdata; 00740 DBEDIT_TDATA *m_OrphanInstances; //!< Instances with out a table 00741 int m_numtdatas, m_numforms; 00742 int m_CreatingTable; //!< Table being created by workproc 00743 McbLIST m_CBList; 00744 struct STYLE { 00745 RVC::OBJITEM m_StyleObjItem; //!< Style object filename 00746 int m_table; //!< Table number of StyleAssignmentTable 00747 bool m_bDefaultKnown; 00748 DBEDIT_STYLEDIALOG *m_dlg; //!< style editor dialog 00749 MULTISTYLE m_dft; 00750 00751 STYLE ( 00752 ) : 00753 m_table(0), 00754 m_bDefaultKnown(false), 00755 m_dlg(0) 00756 { 00757 } 00758 } m_Style; 00759 DBEDITFUNCS **m_EditFuncs; 00760 void *m_DBRelateHandle; //!< Private data for MxdDatabaseEditorRelate() 00761 int m_IgnoreCallback; 00762 #ifdef WIN32_NATIVE 00763 //! XXX These should actually be COLORREFs 00764 UINT32 m_LabelColors[10]; 00765 #else 00766 Pixel m_LabelColors[10]; 00767 #endif 00768 MGD::DEVICE *m_gdisp; //!< For showing style samples 00769 MGD::CONTEXT *m_ggc; 00770 void *m_ClassPrivData[MODE_NumModes]; 00771 00772 SIMPLE_ARRAY<DBCALLBACKSTRUCT> m_DBCallbackQueue; 00773 int m_DrainingQueue; 00774 UINT32 m_DBCallbackMask; 00775 int m_ReallyIgnoreCallbacks; //!< # of times CallbackSuspend called with 1 for last parm 00776 SIMPLE_ARRAY<DBEDIT_TDATA*> m_TableData; 00777 00778 //--------------------------------------------------------------------- 00779 // PRIVATE METHODS 00780 00781 //! Find the table instance for a given form. 00782 //! 00783 //! Returns NULL if none open. 00784 DBEDIT_TINSTANCE *FindFormInstance ( 00785 INT32 inode //!< Inode of OTYPE_FORM object under this database 00786 ); 00787 00788 //! Iterate through all instances of a table, calling an instance member function. 00789 //! 00790 //! Should this be private? 00791 int ForEachTableInstance ( 00792 int (DBEDIT_TINSTANCE::*Func)(void*), 00793 void *hookdata 00794 ); 00795 00796 //! Iterate through all instances of a table, calling an instance member function. 00797 //! 00798 //! Should this be private? 00799 int ForEachTableInstance ( 00800 int (DBEDIT_TINSTANCE::*Func)(UINT32), 00801 UINT32 hookdata 00802 ); 00803 00804 //! Drain the queue. 00805 //! 00806 //! Make sure we don't try to drain the queue if we 00807 //! got called by a callback while draining the queue. 00808 void DrainQueue(); 00809 00810 //! Read new records and update open tables. 00811 int UpdateDialogsInternal(); 00812 00813 //! Enqueue the database callback. 00814 int EnqueueDBCallback ( 00815 DBCALLBACKSTRUCT *cbs 00816 ); 00817 00818 //! Dequeue the database callback. 00819 void DequeueDBCallback (); 00820 00821 //! It dispatches a Database Callback. 00822 //! 00823 //! When the database editor receives a database callback, it can do one of 00824 //! two things: 00825 //! (1) If callbacks are not suspended (via DBEDIT::DBCallbackSuspend()), at the 00826 //! time one is received, it is just dispatched immediately. 00827 //! (2) If callbacks are suspended it will enqueue the callback, consolidating callbacks 00828 //! if possible (i.e., if there's already a callback in the queue which would cause it to 00829 //! update open table windows, it doesn't bother to enqueue another one). When 00830 //! callbacks are resumed, it will dispatch all the callbacks in the queue. 00831 void Dispatch ( 00832 DBCALLBACKSTRUCT *cbs 00833 ); 00834 00835 //! Allocate the DBEDIT_TDATA for a table. 00836 //! 00837 //! Called on initialization and when a new table is added. 00838 int CreateDBEDIT_TDATA ( 00839 int TableNum 00840 ); 00841 00842 //! Callback for database change. 00843 static void CB_DBChange ( 00844 DBCALLBACKSTRUCT *cbs, 00845 void *hookdata 00846 ); 00847 00848 //--------------------------------------------------------------------- 00849 //! Classes which are used to implement various views of the database 00850 //! have to be friends of this class. 00851 friend class DBEDIT_TDATA; 00852 friend class DBEDIT_TINSTANCE; 00853 friend class DBEDIT_STYLEDIALOG; 00854 friend class DBEDIT_SRV; 00855 friend class DBEDIT_SINGLERECORDVIEW; 00856 friend class DBEDIT_SDATA; 00857 #endif // GENERATING_DOXYGEN_OUTPUT 00858 }; 00859 00860 //!********************************************************************************* 00861 //! DBEDIT_SUSPENDCALLBACKS 00862 //!********************************************************************************* 00863 00864 00865 //! A class to help insure that we never forget to resume callbacks. 00866 //! 00867 //! Just create an instance of one of these and callbacks will be 00868 //! automatically resumed when it goes out of scope. 00869 class DBEDIT_SUSPENDCALLBACKS { 00870 public: 00871 00872 // CONSTRUCTION / DESTRUCTION 00873 00874 //! Constructor. 00875 DBEDIT_SUSPENDCALLBACKS ( 00876 DBEDIT *ddata, 00877 bool reallyInore = false 00878 ) { 00879 m_ddata = ddata; 00880 m_ReallyInore = reallyInore; 00881 m_ddata->DBCallbackSuspend(m_ReallyInore); 00882 } 00883 00884 //! Destructor. 00885 ~DBEDIT_SUSPENDCALLBACKS() { 00886 m_ddata->DBCallbackResume(m_ReallyInore); 00887 } 00888 00889 private: 00890 #ifndef GENERATING_DOXYGEN_OUTPUT 00891 00892 // MEMBERS 00893 00894 DBEDIT *m_ddata; 00895 bool m_ReallyInore; 00896 #endif // GENERATING_DOXYGEN_OUTPUT 00897 }; 00898 00899 #endif 00900 00901 typedef DBEDIT * DBEDITHANDLE; 00902 00903 #endif 00904
1.3.8-20040913