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