00001
00087 #ifndef INC_GRE_VIEWLEGACY_H
00088 #define INC_GRE_VIEWLEGACY_H
00089
00090 #ifndef INC_GRE_VIEW_H
00091 #include <gre/view.h>
00092 #endif
00093
00094 #ifndef X_H
00095 #include <X11/X.h>
00096 #define X_H
00097 #endif
00098
00099 #ifndef INC_MI32_GRTREE_H
00100 #include <mi32/grtree.h>
00101 #endif
00102
00103 #ifndef INC_MI32_STRTODEG_H
00104 #include <mi32/strtodeg.h>
00105 #endif
00106
00107 #if !defined(INC_MGUI_STATUSBAR_H) && defined(USE_MGUI)
00108 #include <mgui/statusbar.h>
00109 #endif
00110
00111
00112 #ifndef GENERATING_DOXYGEN_OUTPUT
00113 namespace MGD {
00114 class DEVICE_X;
00115 class DEVICE_X32;
00116 class DEVICE_MEM32;
00117 }
00118 #endif
00119
00120
00121 namespace GRE {
00122
00124 class TOOL {
00125 public:
00126
00128 TOOL (
00129 GRE::VIEW_LEGACY *view,
00130 #ifdef WIN32_NATIVE
00131 const char *toolname
00132 #else
00133 const char *toolname,
00134 const char *iconname,
00135 const char *icongroup=NULL,
00136 const char *helpcode=NULL
00137 #endif
00138 );
00139
00141 TOOL (
00142 GRE::VIEW_LEGACY *view,
00143 ICID icidmenu,
00144 ICID icidicon,
00145 #ifdef WIN32_NATIVE
00146 const char *toolname
00147 #else
00148 const char *toolname,
00149 const char *iconname,
00150 const char *icongroup=NULL,
00151 const char *helpcode=NULL
00152 #endif
00153 );
00154
00155 virtual ~TOOL ();
00156
00158 void Activate (
00159 );
00160
00162 void Deactivate (
00163 );
00164
00165 #ifdef X_NATIVE
00167 const char* GetHelpCode (
00168 ) const { return (m_HelpCode); }
00169
00171 const char* GetIconGroup (
00172 ) const { return (m_IconGroup); }
00173
00175 const char* GetIconName (
00176 ) const { return (m_IconName); }
00177 #endif
00178
00180 const char* GetName (
00181 ) const { return (m_ToolName); }
00182
00184 GRE::VIEW_LEGACY* GetView (
00185 ) const { return (m_view); }
00186
00187 #ifdef X_NATIVE
00189 Widget GetMenuWidget (
00190 ) const { return (m_MenuWidget); }
00191
00193 Widget GetToolbarWidget (
00194 ) const { return (m_ToolbarWidget); }
00195 #endif
00196
00198 bool IsDisabled (
00199 ) const { return (m_IsDisabled); }
00200
00203 virtual bool IsScript (
00204 ) const;
00205
00206 #ifdef X_NATIVE
00208 void SetupButtonItem (
00209 BUTTONITEM& item
00210 );
00211
00213 void SetupMenuItem (
00214 MENUITEM& item
00215 );
00216
00218 void SetSensitive (
00219 bool sensitive = true
00220 );
00221 #endif
00222
00225 bool Suspend (
00226 );
00227
00229 void Resume (
00230 );
00231
00232 protected:
00233
00234 enum TOOLSTATE {
00235 STATE_NotInitialized = 0,
00236 STATE_Inactive,
00237 STATE_Active,
00238 STATE_NoLayers,
00239 STATE_Suspended
00240 };
00241
00242 GRE::VIEW_LEGACY* m_view;
00243
00245 TOOLSTATE GetState (
00246 ) const { return (m_state); }
00247
00248 void SetName (
00249 const MISTRING& name
00250 ) { m_ToolNameStr = name; }
00251
00252 private:
00253 #ifndef GENERATING_DOXYGEN_OUTPUT
00254
00255 char *m_ToolName;
00256 #ifdef X_NATIVE
00257 char *m_IconName;
00258 char *m_IconGroup;
00259 char *m_HelpCode;
00260 #endif
00261 TOOLSTATE m_state;
00262 bool m_IsDisabled;
00263 ICID m_icidmenu;
00264 ICID m_icidicon;
00265 #ifdef X_NATIVE
00266 Widget m_MenuWidget;
00267 Widget m_ToolbarWidget;
00268 #endif
00269 MISTRING m_ToolNameStr;
00270
00271 #endif // GENERATING_DOXYGEN_OUTPUT
00272
00273
00274
00275 virtual bool DoActivate () = 0;
00276 virtual void DoDeactivate () = 0;
00277 virtual bool DoInitialize ();
00278 virtual void DoSuspend ();
00279 virtual void DoResume ();
00280 };
00281
00282 }
00283
00284 #ifndef GENERATING_DOXYGEN_OUTPUT
00286 class _MDISPTOOL : public GRE::TOOL {
00287 public:
00288
00289 void *privptr;
00290 GRE::VIEW_LEGACY *view;
00291
00292 _MDISPTOOL (
00293 GRE::VIEW_LEGACY *view,
00294 const char *toolname,
00295 const char *iconname,
00296 const char *icongroup,
00297 const char *helpcode,
00298 int (*Init)(_MDISPTOOL*),
00299 int (*Stop)(_MDISPTOOL*),
00300 int (*Activate)(_MDISPTOOL*),
00301 int (*Deactivate)(_MDISPTOOL*),
00302 int (*Suspend)(_MDISPTOOL*),
00303 int (*Resume)(_MDISPTOOL*)
00304 );
00305
00306 _MDISPTOOL (
00307 GRE::VIEW_LEGACY *view,
00308 const char *toolname,
00309 const char *iconname,
00310 const char *icongroup,
00311 const char *helpcode,
00312 ICID icidmenu,
00313 ICID icidicon,
00314 int (*Init)(_MDISPTOOL*),
00315 int (*Stop)(_MDISPTOOL*),
00316 int (*Activate)(_MDISPTOOL*),
00317 int (*Deactivate)(_MDISPTOOL*),
00318 int (*Suspend)(_MDISPTOOL*),
00319 int (*Resume)(_MDISPTOOL*)
00320 );
00321
00322 virtual ~_MDISPTOOL ();
00323
00324 private:
00325
00326 virtual bool DoActivate ();
00327 virtual void DoDeactivate ();
00328 virtual bool DoInitialize ();
00329 virtual void DoSuspend ();
00330 virtual void DoResume ();
00331
00332 int (*OldInit)(_MDISPTOOL*);
00333 int (*OldStop)(_MDISPTOOL*);
00334 int (*OldActivate)(_MDISPTOOL*);
00335 int (*OldDeactivate)(_MDISPTOOL*);
00336 int (*OldSuspend)(_MDISPTOOL*);
00337 int (*OldResume)(_MDISPTOOL*);
00338 };
00339 typedef _MDISPTOOL *MDISPTOOL;
00340 #endif // GENERATING_DOXYGEN_OUTPUT
00341
00342 namespace GRE {
00343
00344
00345
00346 enum VIEW_LEGACY_COORDSOURCE {
00347 VIEW_LEGACY_COORDSOURCE_None,
00348 VIEW_LEGACY_COORDSOURCE_Mouse,
00349 VIEW_LEGACY_COORDSOURCE_ViewCenter,
00350 VIEW_LEGACY_COORDSOURCE_Entered,
00351 VIEW_LEGACY_COORDSOURCE_GPS,
00352 VIEW_LEGACY_COORDSOURCE_COUNT
00353 };
00354
00355
00356
00357 class VIEW_LEGACY_SAVESETTINGS : public SERIALIZABLE {
00358 public:
00359
00360 VIEW_LEGACY_SAVESETTINGS ();
00361 virtual ~VIEW_LEGACY_SAVESETTINGS ();
00362
00363 const SPATREF::COORDREFSYS& GetStatusPos1_CRS (
00364 ) const { return (m_StatusPos1.m_CoordRefSys); }
00365
00366 DMSTYPE GetStatusPos1_LatLonFormat (
00367 ) const { return (m_StatusPos1.m_LatLonFormat); }
00368
00369 const SPATREF::COORDREFSYS& GetStatusPos2_CRS (
00370 ) const { return (m_StatusPos2.m_CoordRefSys); }
00371
00372 DMSTYPE GetStatusPos2_LatLonFormat (
00373 ) const { return (m_StatusPos2.m_LatLonFormat); }
00374
00375 bool GetShowStatusPos1 (
00376 ) const { return (m_StatusPos1.m_Show); }
00377
00378 bool GetShowStatusPos2 (
00379 ) const { return (m_StatusPos2.m_Show); }
00380
00381 void IniRead (INIHANDLE handle, const char *inigroup);
00382 void IniWrite (INIHANDLE handle, const char *inigroup);
00383
00384 void SetShowStatusPos1 (
00385 bool show
00386 ) { m_StatusPos1.m_Show = show; }
00387
00388 void SetShowStatusPos2 (
00389 bool show
00390 ) { m_StatusPos2.m_Show = show; }
00391
00392 private:
00393 #ifndef GENERATING_DOXYGEN_OUTPUT
00394
00395 struct STATUSPOS {
00396 bool m_Show;
00397 UINT8 m_UnitCode;
00398 SPATREF::COORDREFSYS m_CoordRefSys;
00399 DMSTYPE m_LatLonFormat;
00400 static const SERIALIZERITEM* SerialGetItemDef ();
00401 STATUSPOS ();
00402 };
00403
00404 STATUSPOS m_StatusPos1;
00405 STATUSPOS m_StatusPos2;
00406
00407 static const SERIALIZERITEM* SerialGetItemDef ();
00408
00410 virtual ERRVALUE SerialRead (SERIALIZER& serializer);
00411 virtual ERRVALUE SerialWrite (SERIALIZER& serializer, const char *tagname = 0) const;
00412
00413
00414 friend class VIEW;
00415 friend struct STATUSPOS;
00416 #endif // GENERATING_DOXYGEN_OUTPUT
00417 };
00418
00419
00420 #ifndef GENERATING_DOXYGEN_OUTPUT
00421
00422 class VIEW_LEGACY_STATUSINFO {
00423 public:
00424 class POS {
00425 public:
00426 POS ();
00427 ~POS ();
00428 void GetCoordString (MISTRING& string, const DPOINT2D& pt, const SPATREF::COORDREFSYS& PointCRS, bool UseLatLonIfNoProjSet = true) const;
00429 DEGTOSTRFLAGS GetLatLonFormat () const { return (m_LatLonFormat); }
00430 const SPATREF::COORDREFSYS& GetCoordRefSys () const { return (m_CoordRefSys); }
00431 void SetLatLonFormat (DEGTOSTRFLAGS LatLonFormat);
00432 void SetLatLonFormat (DMSTYPE LatLonFormat);
00433 void SetCoordRefSys (const SPATREF::COORDREFSYS& CoordRefSys) { m_CoordRefSys = CoordRefSys; }
00434 private:
00435 SPATREF::COORDREFSYS m_CoordRefSys;
00436 DEGTOSTRFLAGS m_LatLonFormat;
00437 };
00438
00439 VIEW_LEGACY_STATUSINFO ();
00440 void ClearPos (VIEW_LEGACY_COORDSOURCE CoordSource = VIEW_LEGACY_COORDSOURCE_None);
00441 #ifdef X_NATIVE
00442 void Create (Widget pwidget, GRE::VIEW *view, Arg *arglist, int argcount, const GRE::VIEW_LEGACY_SAVESETTINGS& settings);
00443 #endif
00444 void DisplayPos (VIEW_LEGACY_COORDSOURCE CoordSource, GRE::GROUP *CoordGroup, const DPOINT2D& pt);
00445 void DisplayPos (VIEW_LEGACY_COORDSOURCE CoordSource, const DPOINT2D& pt, const SPATREF::COORDREFSYS& PointCRS, bool UseLatLonIfNoProjSet = true);
00446 #ifdef X_NATIVE
00447 double GetEditScale () const { return (m_EditScale); }
00448 double GetEditZoom () const { return (m_EditZoom); }
00449 #endif
00450 DEGTOSTRFLAGS GetLatLonFormat (int idx) const
00451 { return (GetPos(idx).GetLatLonFormat()); }
00452 const POS& GetPos (int idx) const
00453 { return ((idx != 1) ? m_Pos1 : m_Pos2); }
00454 POS& GetPos (int idx)
00455 { return ((idx != 1) ? m_Pos1 : m_Pos2); }
00456
00457
00458 #ifdef X_NATIVE
00459 Widget GetWidget () const { return (m_container); }
00460 #endif
00461 bool HasPosVisible () const;
00462 bool IsPosVisible (int idx) const;
00463 void SetCoordSource (VIEW_LEGACY_COORDSOURCE CoordSource);
00464 void SetPosVisible (int idx, bool visible);
00465 void UpdateZoomScaleDisplay (GRE::VIEW_LEGACY *view);
00466
00467 private:
00468 #ifdef X_NATIVE
00469 Widget m_container;
00470 Widget m_zoomP;
00471 Widget m_mapscaleP;
00472 Widget m_PanToPointPB;
00473 Widget m_CoordSourceIcon;
00474 Widget m_Coord1XeT;
00475 Widget m_Coord2XeT;
00476 MGUI::CTRL_TOOLTIP *m_pCoord1ToolTip;
00477 MGUI::CTRL_TOOLTIP *m_pCoord2ToolTip;
00478 double m_EditZoom;
00479 double m_EditScale;
00480 #endif
00481 VIEW_LEGACY_COORDSOURCE m_CoordSource;
00482 POS m_Pos1;
00483 POS m_Pos2;
00484 };
00485 #endif // GENERATING_DOXYGEN_OUTPUT
00486
00487
00488
00489 #define LEGENDVIEW_SHOW_NotSet 0
00490 #define LEGENDVIEW_SHOW_None 1
00491 #define LEGENDVIEW_SHOW_Left 2
00492 #define LEGENDVIEW_SHOW_Right 3
00493
00494 #define GRE_MaxPrevViews 10
00495
00496
00497
00498 class VIEW_LEGACY : public VIEW {
00499 public:
00500
00502 enum CREATEFLAGS {
00503 CREATEFLAG_None = 0x00000000,
00504
00505 CREATEFLAG_3D = GRE::VIEW::CREATEFLAG_3D,
00506 CREATEFLAG_NoCallCreateCB = GRE::VIEW::CREATEFLAG_NoCallCreateCB,
00507 CREATEFLAG_NoRenderSeparate = GRE::VIEW::CREATEFLAG_NoRenderSeparate,
00508
00509 CREATEFLAG_AllowGeoLock = 0x00000800,
00510 CREATEFLAG_DestroyOnClose = 0x00001000,
00511 CREATEFLAG_DialogModal = 0x00002000,
00512 CREATEFLAG_Locator = 0x00004000,
00513 CREATEFLAG_NoCancelButton = 0x00008000,
00514 CREATEFLAG_NoCloseOption = 0x00010000,
00515 CREATEFLAG_NoDftAddIcons = 0x00020000,
00516 CREATEFLAG_NoDftDrawIcons = 0x00040000,
00517 CREATEFLAG_NoDftMarkIcons = 0x00080000,
00518 CREATEFLAG_NoDftViewIcons = 0x00100000,
00519 CREATEFLAG_NoIconBar = 0x00200000,
00520 CREATEFLAG_NoLegendView = 0x00400000,
00521 CREATEFLAG_NoRedrawButton = 0x00800000,
00522 CREATEFLAG_NoScalePosLine = 0x01000000,
00523 CREATEFLAG_NoScrollbars = 0x02000000,
00524 CREATEFLAG_NoSelectTool = 0x04000000,
00525 CREATEFLAG_NoSkipButton = 0x08000000,
00526 CREATEFLAG_NoStatusLine = 0x10000000,
00527 CREATEFLAG_NoStdTools = 0x20000000,
00528 CREATEFLAG_NoToolBoxTool = 0x40000000,
00529 CREATEFLAG_Temporary = 0x80000000,
00530 };
00531 enum ICONVIEW {
00532 ICONVIEW_Full = 0x00000001,
00533 ICONVIEW_Previous = 0x00000002,
00534 ICONVIEW_PreviousZoom = 0x00000004,
00535 ICONVIEW_ZoomIn = 0x00000008,
00536 ICONVIEW_ZoomOut = 0x00000010,
00537 ICONVIEW_ZoomToGroup = 0x00000020,
00538 ICONVIEW_ZoomToLayer = 0x00000040,
00539 ICONVIEW_ZoomToMaxDetail = 0x00000080,
00540 ICONVIEW_ZoomToLocation = 0x00000100,
00541 ICONVIEW_Zoom1X = 0x00000200,
00542 ICONVIEW_Zoom2X = 0x00000400,
00543 ICONVIEW_Zoom3X = 0x00000800,
00544 ICONVIEW_Locator = 0x00001000,
00545 ICONVIEW_Snapshot = 0x00002000,
00546 ICONVIEW_GeoLock = 0x00004000,
00547 ICONVIEW_GoogleEarth = 0x00008000,
00548 ICONVIEW_Stereo = 0x00010000,
00549 ICONVIEW_Default = ICONVIEW_Full | ICONVIEW_Previous | ICONVIEW_PreviousZoom | ICONVIEW_ZoomIn | ICONVIEW_ZoomOut | ICONVIEW_ZoomToLayer | ICONVIEW_ZoomToGroup | ICONVIEW_ZoomToLocation | ICONVIEW_ZoomToMaxDetail | ICONVIEW_Zoom1X | ICONVIEW_Locator | ICONVIEW_Snapshot | ICONVIEW_GeoLock | ICONVIEW_GoogleEarth | ICONVIEW_Stereo
00550 };
00551
00553 static VIEW_LEGACY* FindNextLegacyOfGroup (
00554 const GRE::GROUP *group,
00555 VIEW *view = 0
00556 );
00557
00559 static VIEW_LEGACY* FindNextLegacyOfLayer (
00560 const GRE::LAYER *layer,
00561 VIEW *view = 0
00562 );
00563
00564
00565 static void SML_ClassInstall (
00566 SML::CONTEXT *context
00567 );
00568
00569 #if defined(X_NATIVE) && !defined(GENERATING_DOXYGEN_OUTPUT)
00570
00571 static VIEW* SML_CreateX (
00572 int numargs,
00573 SML::ARG *args,
00574 SML::CONTEXT *context,
00575 CREATEFLAGS createflags = CREATEFLAG_None
00576 );
00577 #endif
00578
00579 #ifndef GENERATING_DOXYGEN_OUTPUT
00580
00581 static SML::FLAG* SML_GetCreateFlags (
00582 );
00583 #endif
00584
00586 VIEW_LEGACY ();
00587
00589 virtual ~VIEW_LEGACY ();
00590
00591 #ifdef X_NATIVE
00593 void AddDrawIcons (
00594 );
00595
00597 Widget AddIconRowItems (
00598 const BUTTONITEM *items,
00599 const char *icongroup = 0,
00600 void *cbdata = 0,
00601 void *userdata = 0
00602 );
00603
00605 void AddMacroScriptIcons (
00606 );
00607
00609 void AddMacroScriptMenuItems (
00610 );
00611
00613 ERRVALUE AddMenuItemsOptions (
00614 const MENUITEM *newitems
00615 );
00616
00618 void AddToolIcons (
00619 bool addscripts = true
00620 );
00621
00623 void AddViewIcons (
00624 ICONVIEW icons = ICONVIEW_Default
00625 );
00626 #endif
00627
00629 void ClearPreviousViewList (
00630 ) { m_PrevViewIndex = 0; return; }
00631
00632 #ifdef X_NATIVE
00635 Widget CreateMenuBar (
00636 Widget form,
00637 MENUBARITEM *menubar
00638 );
00639
00642 Widget CreateMenuBar (
00643 Widget form
00644 );
00645
00647 ERRVALUE CreateX (
00648 VIEWABLE *viewable,
00649 Widget pwidget,
00650 Arg *arglist,
00651 int argcount,
00652 int iwidth,
00653 int iheight,
00654 const char *sizefield = 0,
00655 CREATEFLAGS createflags = CREATEFLAG_None,
00656 const VIEW_LEGACY_SAVESETTINGS *pSettings = 0
00657 );
00658 #endif
00659
00661 void DataTipSetDelay (
00662 INT32 delay
00663 );
00664
00666 void DataTipSetPixelDelta (
00667 int PixelDelta
00668 );
00669
00671 void EditCustomization (
00672 );
00673
00675 TOOL* GetActiveTool (
00676 ) const { return (m_ActiveTool); }
00677
00678 #ifdef X_NATIVE
00680 Widget GetDrawingArea (
00681 ) const { return (m_da); }
00682
00684 Widget GetDrawingAreaForm (
00685 ) const { return (m_lvswform); }
00686
00688 MGD::DEVICE_X32* GetDrawingDeviceViewInView (
00689 ) const { return (m_pDeviceViewInView); }
00690
00693 Pixmap GetDrawingPixmap (
00694 ) const { return (m_pixmap); }
00695
00697 Widget GetForm (
00698 ) const { return (m_form); }
00699
00702 const BUTTONITEM* GetIconItemAdd (
00703 BUTTONITEMARRAY& items
00704 ) const;
00705
00708 const BUTTONITEM* GetIconItemDraw (
00709 BUTTONITEMARRAY& items
00710 ) const;
00711
00715 const BUTTONITEM* GetIconItemTool (
00716 BUTTONITEMARRAY& items
00717 ) const;
00718
00721 const BUTTONITEM* GetIconItemView (
00722 BUTTONITEMARRAY& items,
00723 ICONVIEW icons = ICONVIEW_Default
00724 ) const;
00725
00728 Widget GetIconView (
00729 ICONVIEW icon
00730 ) const;
00731
00734 const MENUITEM* GetMenuItemGPS (
00735 );
00736
00739 const MENUITEM* GetMenuItemHotKeys (
00740 );
00741
00744 const MENUITEM* GetMenuItemLegendView (
00745 );
00746
00749 const MENUITEM* GetMenuItemOptions (
00750 MENUITEMARRAY& items
00751 );
00752
00755 const MENUITEM* GetMenuItemTool (
00756 MENUITEMARRAY& items
00757 ) const;
00758
00761 const MENUITEM* GetMenuItemView (
00762 MENUITEMARRAY& items
00763 );
00764
00767 Widget GetMenuWidget (
00768 const char* menupath
00769 ) const;
00770 #endif
00771
00774 VIEW_LEGACY* GetNextLegacy (
00775 ) const;
00776
00777 VIEW_LEGACY* GetNextLegacyOfAll (
00778 ) const;
00779
00780 #ifdef X_NATIVE
00782 Widget GetToolBar (
00783 ) const { return (m_ToolBarRC); }
00784 #endif
00785
00786 #ifdef X_NATIVE
00787
00789 void LegendEnableRedraw (
00790 bool enable
00791 );
00792
00793 UINT8 LegendGetShowMode (
00794 ) const { return (m_LegendShowMode); }
00795
00796 void LegendHideAllLegends (
00797 );
00798
00799 void LegendRedraw (
00800 bool updatesizes = false
00801 );
00802
00803 void LegendSetShowLayerTypeIcon (
00804 bool ShowLayerType
00805 ) { m_LegendShowLayerType = ShowLayerType; }
00806
00807 void LegendSetShowMode (
00808 UINT8 ShowMode
00809 );
00810
00811 void LegendSetVisiblityIndicator (
00812 UINT8 VisInd
00813 ) {
00814 if (VisInd != m_LegendVisInd) {
00815 m_LegendVisInd = VisInd;
00816 LegendRedraw();
00817 }
00818 return;
00819 }
00820
00821 void LegendShowAllLegends (
00822 );
00823 #endif
00824
00826 void ScalePosClearCoord (
00827 VIEW_LEGACY_COORDSOURCE CoordSource = VIEW_LEGACY_COORDSOURCE_None
00828 ) { m_StatusInfo.ClearPos(CoordSource); }
00829
00830 void ScalePosDisplayCoord (
00831 VIEW_LEGACY_COORDSOURCE CoordSource,
00832 const DPOINT2D& point,
00833 const SPATREF::COORDREFSYS& PointCRS
00834 ) { m_StatusInfo.DisplayPos(CoordSource,point,PointCRS); }
00835
00836 void ScalePosGetCoordString (
00837 int idx,
00838 const DPOINT2D& point,
00839 MISTRING& string
00840 ) const;
00841
00843 DEGTOSTRFLAGS ScalePosGetLatLonFormat (
00844 int idx
00845 ) const { return (m_StatusInfo.GetLatLonFormat(idx)); }
00846
00849 const SPATREF::COORDREFSYS& ScalePosGetCoordRefSys (
00850 int idx
00851 ) const;
00852
00853 #ifdef X_NATIVE
00855 bool ScalePosIsPosVisible (
00856 int idx
00857 ) const { return (m_StatusInfo.IsPosVisible(idx)); }
00858 #endif
00859
00860 void ScalePosSetCoordSource (
00861 VIEW_LEGACY_COORDSOURCE CoordSource
00862 ) { m_StatusInfo.SetCoordSource(CoordSource); }
00863
00864 void ScalePosSetLatLonFormat (
00865 int idx,
00866 DEGTOSTRFLAGS LatLonFormat
00867 ) { GetStatusInfoPos(idx).SetLatLonFormat(LatLonFormat); };
00868
00870 void ScalePosSetPosVisible (
00871 int idx,
00872 bool visible
00873 ) { m_StatusInfo.SetPosVisible(idx,visible); }
00874
00876 void ScalePosSetCoordRefSys (
00877 int idx,
00878 const SPATREF::COORDREFSYS& CoordRefSys
00879 ) { GetStatusInfoPos(idx).SetCoordRefSys(CoordRefSys); }
00880
00881 #ifdef X_NATIVE
00883 void ScalePosSetVisible (
00884 bool visible
00885 );
00886 #endif
00887
00888 #ifdef X_NATIVE
00889 void SetDrawingArea (
00890 Widget da
00891 ) { m_da = da; }
00892 #endif
00893
00894 void SetEditCustomFunc (
00895 void (*EditCustomFunc)(VIEW_LEGACY*)
00896 ) { m_EditCustomFunc = EditCustomFunc; }
00897
00900 void SetInputFocusTo (
00901 );
00902
00904 void SetMessageVisible (
00905 bool visible
00906 );
00907
00908 void SetPreviousView (
00909 );
00910
00911 void SetPreviousZoom (
00912 );
00913
00916 void ToolAttach (
00917 TOOL *tool
00918 );
00919
00921 TOOL* ToolFindByName (
00922 const char* toolname
00923 ) const;
00924
00927 TOOL* ToolGetActive (
00928 ) const { return (m_ActiveTool); }
00929
00931 bool ToolIsActive (
00932 TOOL* tool
00933 ) const { return (m_ActiveTool == tool && tool != NULL); }
00934
00936 bool ToolIsActive (
00937 const char *toolname
00938 ) const { if (m_ActiveTool) return (!strcmp(m_ActiveTool->GetName(),toolname)); else return (false); }
00939
00942 void ToolResume (
00943 ) { if (m_ActiveTool) m_ActiveTool->Resume(); }
00944
00946 void ToolSet (
00947 TOOL* tool
00948 ) { if (!tool) tool = (*m_ToolList.Begin()); if (tool) tool->Activate(); }
00949
00951 int ToolSet (
00952 const char* toolname
00953 );
00954
00956 void ToolSetDefault (
00957 );
00958
00967 int ToolSuspend (
00968 ) { if (m_ActiveTool) return (m_ActiveTool->Suspend()); else return (0); }
00969
00970 protected:
00971 #ifndef GENERATING_DOXYGEN_OUTPUT
00972
00973 static const SML::CLASSMEMBER* SML_GetClassMembers();
00974 #endif
00975
00976 private:
00977
00978 #ifndef GENERATING_DOXYGEN_OUTPUT
00979 friend class GRE::VIEW_LEGACY_STATUSINFO;
00980 friend class GRE::TOOL;
00981
00982 #ifdef X_NATIVE
00983 class MACROSCRIPTCONTEXT;
00984
00985 GRAPHICTREE *m_Legendgtree;
00986 Widget m_LegendSash;
00987 Widget m_LegendLayerPopupMenu;
00988 Widget *m_LegendLayerPopupMenuWidgets;
00989 Widget m_LegendGroupPopupMenu;
00990 Widget *m_LegendGroupPopupMenuWidgets;
00991 GRE::LAYER *m_LegendCursorLayer;
00992 GRE::GROUP *m_LegendCursorGroup;
00993 UINT8 m_LegendShowMode;
00994 UINT8 m_LegendVisInd;
00995 bool m_LegendShowLayerType;
00996 bool m_LegendDftLegendHidden;
00997 Display* m_xdisplay;
00998 Widget m_form;
00999 Widget m_menubar;
01000 Widget m_lvswform;
01001 Widget m_sw;
01002 Widget m_hsb;
01003 Widget m_vsb;
01004 Widget m_da;
01005 Widget m_ToolBarRC;
01006 mutable Widget m_RedrawPB;
01007 mutable Widget m_RedrawOnAnyChangeTB;
01008 mutable Widget m_SkipPB;
01009 mutable Widget m_CancelPB;
01010 mutable Widget m_AddGroupMB;
01011 mutable Widget m_AddLayerMB;
01012 Widget m_MenuMacrosButton;
01013 Widget m_MenuMacrosPane;
01014 Widget m_IconRowView;
01015 Widget m_IconRowTool;
01016 Widget m_IconRowMacroScript;
01017 Widget m_InfoForm;
01018 Widget m_MsgProgForm;
01019 MENUITEMARRAY *m_pMenuItemOptionsExtra;
01020 MILIST<MACROSCRIPTCONTEXT*> m_MacroScriptContexts;
01021 Pixmap m_pixmap;
01022 MGD::DEVICE_X *m_sdisp;
01023 MGD::DEVICE_X32 *m_mdisp;
01024 MGD::DEVICE_X32 *m_pDeviceViewInView;
01025 XtIntervalId m_ResizeTimer;
01026 #endif
01027
01028 MILIST<TOOL*> m_ToolList;
01029 TOOL *m_ActiveTool;
01030 UINT8 m_PrevViewIndex;
01031 struct PREVPOS {
01032 DPOINT2D center;
01033 DPOINT2D zoom;
01034 } m_PrevViewPos[GRE_MaxPrevViews];
01035 DPOINT2D m_LastZoom;
01036 void (*m_EditCustomFunc)(VIEW_LEGACY*);
01037 GRE::VIEW_LEGACY_STATUSINFO m_StatusInfo;
01038 #ifdef USE_MGUI
01039 MGUI::CTRL_STATUSBAR m_StatusBar;
01040 #endif
01041 MGUI::CTRL_TOOLTIP *m_pDataTip;
01042
01043 static void DftEditCustomFunc (
01044 VIEW_LEGACY *view
01045 );
01046
01047 #ifdef X_NATIVE
01048 static void GRECB_ViewObject (
01049 const GRE::MSG *msg,
01050 VIEW_LEGACY *view
01051 );
01052 #endif
01053
01054
01055 #ifdef X_NATIVE
01056 void AddDftAddIcons ();
01057 void AddToolScript (const GRE::TOOLSCRIPT& script, Widget ToolMenuPane);
01058 void AddToolScripts ();
01059 void AutoResizeDialog (MDLGPARENT);
01060 ERRVALUE CreateDeviceMemPixmap ();
01061 void CreateMacroScriptContexts ();
01062 void DeleteMacroScriptContexts ();
01063 void EditMacroScripts ();
01064 void EditToolScripts ();
01065 MENUBARITEM* GetMenuBarItems () const;
01066 #endif
01067
01068 const GRE::VIEW_LEGACY_STATUSINFO::POS& GetStatusInfoPos (int idx) const
01069 { return (m_StatusInfo.GetPos(idx)); }
01070
01071 GRE::VIEW_LEGACY_STATUSINFO::POS& GetStatusInfoPos (int idx)
01072 { return (m_StatusInfo.GetPos(idx)); }
01073
01074 #ifdef X_NATIVE
01075 void LegendAddGroupItem (
01076 GRE::GROUP *group,
01077 int pos = 0
01078 );
01079
01080 void LegendAddLayerItem (
01081 GRE::LAYER *layer,
01082 int pos = 0
01083 );
01084
01085 void LegendAddLayerItems (
01086 GRE::GROUP *group
01087 );
01088
01089 void LegendCreate (
01090 );
01091
01092 void LegendSetGroupLegendsVisible (
01093 GRE::GROUP *group,
01094 bool visible
01095 );
01096
01097 void LegendSetupGroupLegend (
01098 GRE::GROUP *group
01099 );
01100
01101 void LegendUpdateGroupLegend (
01102 GRE::GROUP *group,
01103 bool redraw = false
01104 );
01105 #endif
01106
01107 #ifdef X_NATIVE
01108 int GetToolCount (
01109 ) const { return (m_ToolList.GetNumItems()); }
01110 #endif
01111
01112 #ifdef X_NATIVE
01113 void UpdateMacroScriptUI ();
01114 void UpdateSize ();
01115 void UpdateToolScriptUI ();
01116 #endif
01117
01118 #ifdef X_NATIVE
01119
01120 static int LegendPopup_GroupStatus (VIEW_LEGACY*, void*, UINT16);
01121 static int LegendPopup_LayerStatus (VIEW_LEGACY*, void*, UINT16);
01122 static int StatusTestCancel (MISTATUSMANAGER*, void*);
01123 static void CB_ActionView (Widget, void*, void*);
01124 static void CB_LegendPopupMenuGroup (Widget, void*, void*);
01125 static void CB_LegendPopupMenuLayer (Widget, void*, void*);
01126 static void CB_MenuOptions (Widget, void*, void*);
01127 static void CB_ViewResize (Widget, void*, void*);
01128 static void EH_DrawArea (Widget, VIEW_LEGACY*, XEvent*, Boolean*);
01129 static void EH_ScrollH (Widget, VIEW_LEGACY*, XEvent*, Boolean*);
01130 static void EH_ScrollV (Widget, VIEW_LEGACY*, XEvent*, Boolean*);
01131 static void LegendMH_Group (GRAPHICTREEITEM_MSG *msg);
01132 static void LegendMH_GroupLegend (GRAPHICTREEITEM_MSG *msg);
01133 static void LegendMH_Layer (GRAPHICTREEITEM_MSG *msg);
01134 static void LegendPopup_GroupAction (VIEW_LEGACY*, void*, UINT16);
01135 static void LegendPopup_LayerAction (VIEW_LEGACY*, void*, UINT16);
01136 static void PCB_ChangeMapScale (Widget, void *vview);
01137 static void PCB_ChangeZoom (Widget, void *vview);
01138 static void TCB_RestoreBackground (Widget, DRECT2D*, void*);
01139 static void TP_ViewResize (void*, XtIntervalId*);
01140 #endif
01141
01142
01143 virtual void v_DataTipSetDelay (INT32 delay);
01144 virtual void v_DataTipSetPixelDelta (int PixelDelta);
01145 virtual ERRVALUE v_Draw ();
01146 virtual ERRVALUE v_DrawThisOnly (GRE::DRAWFLAGS drawflags);
01147 #ifdef USE_MGUI
01148 virtual MDLGPARENT v_GetDlgParent () const;
01149 #endif
01150 virtual MGD::DEVICE* v_GetDrawingDeviceMemory (bool UseStereo) const;
01151 virtual MGD::DEVICE* v_GetDrawingDeviceScreen () const;
01152 virtual int v_GetViewNum () const;
01153 virtual void v_RestoreFromMemory (const LRECT2D *rect, bool UseScreenBuffer);
01154 #ifdef X_NATIVE
01155 virtual ERRVALUE v_TestCancel ();
01156 #endif
01157 virtual void v_UpdateMessage (const MISTRING& string);
01158 #ifdef X_NATIVE
01159 virtual void v_UpdateScriptUI ();
01160 #endif
01161 virtual void v_UpdateUI ();
01162
01163 #endif // GENERATING_DOXYGEN_OUTPUT
01164 };
01165 #ifndef GENERATING_DOXYGEN_OUTPUT
01166 DEFINE_ENUM_OP_BITWISE(VIEW_LEGACY::CREATEFLAGS)
01167 DEFINE_ENUM_OP_BITWISE(VIEW_LEGACY::ICONVIEW)
01168 #endif
01169
01170
01171
01172
01174 void ToolAddRecenter (
01175 GRE::VIEW_LEGACY *view,
01176 GRE::TOOL **rtool = 0
01177 );
01178
01180 void ToolAddZoomBox (
01181 GRE::VIEW_LEGACY *view,
01182 GRE::TOOL **rtool = 0
01183 );
01184
01185
01186
01187 }
01188
01190 void GRE_ToolAddViewInView (
01191 GRE::VIEW_LEGACY *view,
01192 GRE::TOOL **rtool = 0
01193 );
01194
01195 #endif // INC_GRE_VIEWLEGACY_H
01196