FLImaging 6.11.25.2
GUIManager.h
1#pragma once
2
3#include "DefinitionsGUI.h"
4
5#include <deque>
6#include <stack>
7#include <queue>
8#include <map>
9#include <set>
10
11namespace FLImaging
12{
13 namespace GUI
14 {
15 class CGUIPropertyMenuBase;
16 class CGUIPaneBase;
17 class CGUIPaneMenu;
18 class CGUIPaneLog;
19 class CGUIPaneCode;
20 class CGUIPaneExampleSNAP;
21 class CGUIPaneViewGraph;
23 class CGUIMenuItemFixedViewPlacementSet;
25 class CGUIMenuItemBase;
27 class CGUIMainFrame;
28
29 typedef struct sMenuItemPredefinedExpandSetting
30 {
31 sMenuItemPredefinedExpandSetting() :
32 m_strMenuItemFullPath(L""),
33 m_bExpand(false),
34 m_bRecursive(false),
35 m_bAllowToLoad(true) {}
36
37 sMenuItemPredefinedExpandSetting(
38 const Base::CFLString<wchar_t>& strMenuItemFullPath,
39 bool bExpand, bool bRecursive, bool bAllowToLoad) :
40 m_strMenuItemFullPath(strMenuItemFullPath),
41 m_bExpand(bExpand),
42 m_bRecursive(bRecursive),
43 m_bAllowToLoad(bAllowToLoad) {}
44
45 sMenuItemPredefinedExpandSetting(sMenuItemPredefinedExpandSetting& rhs) :
46 m_strMenuItemFullPath(rhs.m_strMenuItemFullPath),
47 m_bExpand(rhs.m_bExpand),
48 m_bRecursive(rhs.m_bRecursive),
49 m_bAllowToLoad(rhs.m_bAllowToLoad) {}
50
51 ~sMenuItemPredefinedExpandSetting() {}
52 Base::CFLString<wchar_t> m_strMenuItemFullPath;
53 bool m_bExpand;
54 bool m_bRecursive;
55 bool m_bAllowToLoad;
56 }
57 SMenuItemPredefinedExpandSetting;
58
59 class FL_EXPORT CGUIManager : public Base::CFLBase
60 {
61 CGUIManager();
62 CGUIManager(const CGUIManager& rh);
63
64 public:
65 virtual ~CGUIManager();
66
67 static bool PreInitialize();
68 static bool Initialize();
69 static bool IsInitialized();
70 static bool PreTerminate();
71 static bool IsPreTerminated();
72 static bool Terminate();
73
74 static bool PeekAndPump();
75
90 static const CResult SetConfigurationPath(const Base::CFLString<wchar_t>& strPath);
91
102 static Base::CFLString<wchar_t> GetConfigurationPath();
103
118 static const CResult SetExamplesSNAPPath(const Base::CFLString<wchar_t>& strPath);
119
130 static Base::CFLString<wchar_t> GetExamplesSNAPPath();
131
140 static uint32_t GetValidResourceId();
141
154 static const CResult AddChargedResourceId(uint32_t u32ResourceID);
155
168 static const CResult ReleaseChargedResourceId(uint32_t i32ResourceID);
169
178 static int64_t GetMenuItemCount();
179
201 static const CResult RegisterMenu(const CGUIPropertyMenuBase& pmb, const Base::CFLString<wchar_t>& strName, const Base::CFLString<wchar_t>& strPath, bool bAllowMultiInstance = true, bool bSetGlobalModel = false);
202
226 static const CResult RegisterMenu(const CGUIPropertyMenuBase& pmb, const Base::CFLString<wchar_t>& strName, const Base::CFLString<wchar_t>& strInsertPositionFullPath, EInsertPosition eInsertAt, bool bAllowMultiInstance, bool bSetGlobalModel);
227
243 static const CResult UnregisterMenu(const Base::CFLString<wchar_t>& flsFullPath);
244
258 static bool AddMenuItem(CGUIMenuItemBase* pItem);
259
277 static bool AddMenuItem(CGUIMenuItemBase* pMI, bool bAllowMultiInstance, bool bSetGlobalModel = false);
278
298 static bool InsertMenuItem(CGUIMenuItemBase* pItem, CGUIMenuItemBase* pItemPosition, EInsertPosition eInsertAt = EInsertPosition_After);
299
323 static bool InsertMenuItem(CGUIMenuItemBase* pItem, CGUIMenuItemBase* pItemPosition, EInsertPosition eInsertAt, bool bAllowMultiInstance, bool bSetGlobalModel = false);
324
336 static bool DeleteMenuItem(CGUIMenuItemBase* pItem);
337
349 static bool DeleteMenuItem(const Base::CFLString<wchar_t>& flsFullPath);
350
364 static CGUIMenuItemBase* GetMenuItem(int64_t i64Index);
365
383 static CGUIMenuItemBase* GetMenuItem(const Base::CFLString<wchar_t>& flsName, const Base::CFLString<wchar_t>& flsPath);
384
400 static CGUIMenuItemBase* GetMenuItem(const Base::CFLString<wchar_t>& flsFullPath);
401
417 static const CResult GetMenuItemChildren(CGUIMenuItemBase* pItem, std::vector<CGUIMenuItemBase*>& vctChildItems);
418
434 static const CResult GetMenuItemChildren(const Base::CFLString<wchar_t>& flsPath, std::vector<CGUIMenuItemBase*>& vctChildItems);
435
448 static CGUIMenuItemFixedViewPlacementSet* GetMenuItemFixedViewPlacementSet(Base::CFLString<wchar_t> flstrName);
449
462 static CGUIMenuItemFixedViewPlacementSet* GetMenuItemFixedViewPlacementSet(int64_t i64FvpSetIndex);
463
474 static void PushBackFixedViewPlacementSet(CGUIMenuItemFixedViewPlacementSet* pFvpSet);
475
486 static void EraseFixedViewPlacementSet(CGUIMenuItemFixedViewPlacementSet* pFvpSet);
487
508 static bool RegisterTreeItem(const wchar_t* pWcsName, const wchar_t* pWcsPath, void* pData, ETreeItemIcon eIcon = ETreeItemIcon_DocEmpty);
509
520 static bool UnregisterTreeItem(const wchar_t* pWcsFullPath);
521
532 static bool UnregisterTreeItem(void* pData);
533
546 static bool RenameTreeItem(void* pData, const wchar_t* pWcsNewName);
547
558 static bool IsThereTreeItem(void* pData);
559
572 static bool SortTreeItem(ESortOrder eSortOrder = ESortOrder_Ascending);
573
590 static bool SortTreeItem(CGUIMenuItemBase* pItem, ESortOrder eSortOrder = ESortOrder_Ascending);
591
604 static bool CancelSortTreeItem(CGUIMenuItemBase* pItem = nullptr);
605
638 static void PreInitializePaneVisibility(bool bShowPaneMenu = true, bool bShowPaneLog = false, bool bShowPaneCode = false, bool bShowPaneExampleSNAP = true, bool bShowPaneColorTable = false, bool bShowPaneViewGraph = false, bool bShowPaneSheet = false);
639
670 static void GetPreInitializedPaneVisibility(bool& bShowPaneMenu, bool& bShowPaneLog, bool& bShowPaneCode, bool& bShowPaneExampleSNAP, bool& bShowPaneColorTable, bool& bShowPaneViewGraph, bool& bShowPaneSheet);
671
684 static void ModifyPaneCreationOnInitialize(EPaneType ePaneTypeRemove, EPaneType ePaneTypeAdd = EPaneType_MainPane);
685
698 static void SetPaneCreationOnInitialize(EPaneType ePaneType, bool bCreate);
699
710 static EPaneType GetPaneCreationSetting();
711
718 static void BeginWaitCursor();
719
726 static void EndWaitCursor();
727
742 static const CResult AddFontSetting(Base::CFLString<wchar_t> strPaneClassName);
743
756 static const CResult LoadFontSetting();
757
774 static const CResult WriteFontSetting(Base::CFLString<wchar_t> strPaneClassName, CFont* pFont);
775
789 static const CResult LoadFixedViewPlacementSetting(const wchar_t* pWcsFileNameWithPath = nullptr);
790
808 static const CResult ImportFixedViewPlacementSet(const wchar_t* pWcsFileNameWithPath = nullptr, bool bOverwrite = true, bool bApply = false);
809
822 static const CResult WriteFixedViewPlacementSetting(const wchar_t* pWcsFileNameWithPath = nullptr);
823
834 static const CResult LoadThemeSetting();
835
848 static const CResult WriteThemeSetting(int nValue);
849
870 static const CResult AddPredefinedMenuItemExpandSetting(const Base::CFLString<wchar_t>& strMenuItemFullPath, bool bExpand, bool bRecursive, bool bAllowToLoad);
871
892 static const CResult GetPredefinedMenuItemExpandSetting(const Base::CFLString<wchar_t>& strMenuItemFullPath, bool& bExpand, bool& bRecursive, bool& bAllowToLoad);
893
906 static const CResult LoadMenuItemExpandSetting();
907
924 static const CResult LoadMenuItemExpandSetting(const Base::CFLString<wchar_t>& strMenuItemFullPath, bool& bExpand);
925
942 static const CResult WriteMenuItemExpandSetting(const Base::CFLString<wchar_t>& strMenuItemFullPath, bool bExpand);
943
956 static const CResult LoadExampleSNAPExpandSetting();
957
974 static const CResult LoadExampleSNAPExpandSetting(const Base::CFLString<wchar_t>& strExampleSNAPFullPath, bool& bExpand);
975
992 static const CResult WriteExampleSNAPExpandSetting(const Base::CFLString<wchar_t>& strExampleSNAPFullPath, bool bExpand);
993
1006 static const CResult LoadWorkingPane();
1007
1025 static const CResult WriteWorkingPane(const CGUIMenuItemBase* pMenuItem, bool bExist);
1026
1038 static const CResult WriteWorkingPanes();
1039
1052 static const CResult WriteLastFocusedWorkingPane();
1053
1066 static const CResult LoadFavoriteMenuItemSetting();
1067
1086 static const CResult WriteFavoriteMenuItemSetting(CGUIMenuItemBase* pMenuItem, bool bDelete, bool bDeleteProfile = false);
1087
1100 static const CResult WriteFavoriteMenuItemSetting();
1101
1114 static const CResult LoadFavoriteExampleSNAPSetting();
1115
1134 static const CResult WriteFavoriteExampleSNAPSetting(CGUIMenuItemBase* pExampleSNAP, bool bDelete, bool bDeleteProfile = false);
1135
1148 static const CResult WriteFavoriteExampleSNAPSetting();
1149
1158 static bool IsLoadingFavoriteMenu();
1159
1168 static bool IsLoadingMenuItemExpand();
1169
1178 static bool IsLoadingExampleSNAPExpand();
1179
1188 static bool IsLoadingFixedViewPlacement();
1189
1200 static bool EnableMenuItemSNAPObject(bool bEnable);
1201
1210 static bool IsMenuItemSNAPObjectEnabled();
1211
1222 static const CResult ReloadOpenedPanePropertiesAll();
1223
1234 static CGUIMainFrame* GetMainFrame();
1235
1251 static const CResult OpenURL(const Base::CFLString<wchar_t>& strURL);
1252
1268 static const CResult GetMenuItemPropertyOfVisiblePane(std::set<CGUIMenuItemProperty*>& setPMenuItemProperty);
1269
1296 static const CResult SetRegistrySubKeyName(const Base::CFLString<wchar_t>& strSubKeyName);
1297
1313 static const CResult SetAppTitle(const Base::CFLString<wchar_t>& strAppTitle);
1314
1326 static Base::CFLString<wchar_t> GetAppTitle();
1327
1343 static void SetMenuItemRootPath(const Base::CFLString<wchar_t>& strRoot);
1344
1356 static Base::CFLString<wchar_t> GetMenuItemRootName();
1357
1371 static void SetMenuItemRootIcon(ETreeItemIcon eRootIcon = ETreeItemIcon_FLImaging);
1372
1386 static ETreeItemIcon GetMenuItemRootIcon();
1387
1397 static void EnableWriteWorkingPanesOnTerminate(bool bEnable);
1398
1408 static bool IsWriteWorkingPanesOnTerminateEnabled();
1409
1425 static const CResult EnsureDirectoryExists(const Base::CFLString<wchar_t>& strDirPath);
1426
1440 static void SetMainFrameBackgroundImagePadding(int32_t i32PaddingX, int32_t i32PaddingY);
1441
1455 static void GetMainFrameBackgroundImagePadding(int32_t& i32PaddingX, int32_t& i32PaddingY);
1456
1470 static void SetMainFrameBackgroundImageIntervalSpacing(int32_t i32IntervalSpacingX, int32_t i32IntervalSpacingY);
1471
1485 static void GetMainFrameBackgroundImageIntervalSpacing(int32_t& i32IntervalSpacingX, int32_t& i32IntervalSpacingY);
1486
1498 static void SetMainFrameBackgroundColor(COLORREF clr);
1499
1511 static COLORREF GetMainFrameBackgroundColor();
1512
1524 static void SetMainFrameBackgroundImage(const wchar_t* pWcsImagePath);
1525
1539 static void SetMainFrameBackgroundImageLayout(EBackgroundImageLayout eMode = EBackgroundImageLayout_Tile);
1540
1554 static EBackgroundImageLayout GetMainFrameBackgroundImageLayout();
1555
1567 static void SetMainFrameAppIcon(const wchar_t* pWcsIconPath);
1568
1580 static void SetMainFrameMenuBarLogoImage(const wchar_t* pWcsMenuBarLogoImagePath);
1581
1593 static void ShowMainFrameMenuBarLogo(bool bShow);
1594
1606 static bool IsMainFrameMenuBarLogoVisible();
1607
1608 static void RunOnMainThread(const std::function<void(void*)>& lmdFunction, void* pVResult, const void* pVCaller);
1609 static void RunOnMainThreadPostMessage(const std::function<void(void*)>& lmdFunction, void* pVResult, const void* pVCaller);
1610 static DWORD GetMainThreadID();
1611
1612 static bool EnterDllResource();
1613 static bool LeaveDllResource();
1614
1615 static const Base::CFLString<wchar_t> GetModuleFileName();
1616
1617 static bool IsSwitchingViewTab();
1618 static void SetSwitchingViewTab(bool bSet);
1619
1620 static HINSTANCE GetDllResource();
1621
1622 static CGUIViewImageBase* GetCallerView(const CFLBase* pCaller);
1623
1624 static const CResult InitializeAfxInstanceHandle();
1625
1626 DeclareGetClassType();
1627
1628 protected:
1629 virtual void OnReceiveBroadcast(const Base::CBroadcastMessage* pMessage) override;
1630 static bool PumpMessage();
1631 static bool OnIdle(LONG lCount);
1632 static const CResult InternalSetMenuItemName(CGUIMenuItemBase* pItem, const Base::CFLString<wchar_t>& strName);
1633 static const CResult InternalSetMenuItemPath(CGUIMenuItemBase* pItem, const Base::CFLString<wchar_t>& strPath);
1634 static const CResult InternalInitializeTreeContainerMenuItem();
1635 static const CResult InternalInitializeTreeContainerMenuItemExampleSNAP();
1636
1637 private:
1638 static CGUIManager* GetObject();
1639
1640 Base::CFLString<wchar_t> m_strConfigurationPath;
1641 Base::CFLString<wchar_t> m_strExamplesSNAPPath;
1642 Base::CFLString<wchar_t> m_strAppTitle;
1643 Base::CFLString<wchar_t> m_strRoot;
1644 ETreeItemIcon m_eRootIcon;
1645
1646 bool m_bInitialized;
1647 bool m_bPreTerminate;
1648
1649 bool m_bPreInitPaneMenuVisibility;
1650 bool m_bPreInitPaneLogVisibility;
1651 bool m_bPreInitPaneCodeVisibility;
1652 bool m_bPreInitPaneExampleSNAPVisibility;
1653 bool m_bPreInitPaneColorTableVisibility;
1654 bool m_bPreInitPaneViewGraphVisibility;
1655 bool m_bPreInitPaneSheetVisibility;
1656 bool m_bEnableMenuItemSNAPObject;
1657
1658 bool m_bLoadFixedViewPlacementSetting;
1659 bool m_bLoadThemeSetting;
1660 bool m_bLoadWorkingPane;
1661 bool m_bLoadFavoriteMenuItemSetting;
1662 bool m_bLoadMenuItemExpandSetting;
1663 bool m_bLoadFavoriteExampleSNAPSetting;
1664 bool m_bLoadExampleSNAPExpandSetting;
1665 bool m_bLoadFontSetting;
1666
1667 bool m_bEnableWriteWorkingPanes;
1668
1669 bool m_bNowLoadingFavoriteMenu;
1670 bool m_bNowLoadingFavoriteExampleSNAP;
1671 bool m_bNowLoadingMenuItemExpand;
1672 bool m_bNowLoadingExampleSNAPExpand;
1673 bool m_bNowLoadingFixedViewPlacement;
1674 bool m_bNowSwitchingViewTab;
1675
1676 std::stack<HINSTANCE>& m_stackResources;
1677 std::deque<CGUIMenuItemBase*>& m_deqMenuItems;
1678 std::unordered_map<uint32_t, CGUIMenuItemBase*>& m_mapFullPathHashAndMenuItems;
1679 std::map<uint32_t, bool>& m_mapResourceIdChargedStatus;
1680 std::vector<CGUIMenuItemFixedViewPlacementSet*>& m_vctMenuItemFvpSet;
1681 std::set<Base::CFLString<wchar_t>>& m_setPaneName;
1682 std::vector<SMenuItemPredefinedExpandSetting*>& m_vctMenuItemPredefinedExpandSetting;
1683
1684 EPaneType m_ePaneCreationOnInitialize;
1685 CRuntimeClass* m_pRtiOrg;
1686 DWORD m_dwMainThreadID;
1687
1688
1689 /* MainFrame */
1690 Base::TPoint<int32_t> m_tpMainFrameBgPadding;
1691 bool m_bMainFrameBgPaddingDirty;
1692 Base::TPoint<int32_t> m_tpMainFrameBgIntervalSpacing;
1693 bool m_bMainFrameBgIntervalSpacingDirty;
1694
1695 COLORREF m_clrMainFrameBg;
1696 bool m_bMainFrameBgColorDirty;
1697
1698 EBackgroundImageLayout m_eMainFrameBgImageLayout;
1699 bool m_bMainFrameBgImageLayoutDirty;
1700
1701 Base::CFLString<wchar_t> m_strMainFrameBgImagePath;
1702 bool m_bMainFrameBgImageDirty;
1703
1704 Base::CFLString<wchar_t> m_strMainFrameAppIconPath;
1705 bool m_bMainFrameAppIconDirty;
1706
1707 Base::CFLString<wchar_t> m_strMainFrameMenuBarLogoImagePath;
1708 bool m_bMainFrameMenuBarLogoImageDirty;
1709 bool m_bShowMainFrameMenuBarLogo;
1710 bool m_bMainFrameMenuBarLogoVisibilityDirty;
1711
1712 friend class CGUIMenuItemBase;
1713 };
1714 }
1715}
A class on a set of fixed view positions.
Definition GUIFixedViewPlacementSet.h:30
The menu item class associated with the property pane.
Definition GUIMenuItemProperty.h:48
A class of view base.
Definition GUIViewImageBase.h:43
Definition D2DObject.h:12
EBackgroundImageLayout
Enumeration for specifying how the background image is arranged.
Definition DefinitionsGUI.h:11673
EPaneType
Pane type.
Definition DefinitionsGUI.h:9428