Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-14 11:45:01

0001 // -*- C++ -*-
0002 #ifndef Fireworks_Core_FWGUIManager_h
0003 #define Fireworks_Core_FWGUIManager_h
0004 //
0005 // Package:     Core
0006 // Class  :     FWGUIManager
0007 //
0008 /**\class FWGUIManager FWGUIManager.h Fireworks/Core/interface/FWGUIManager.h
0009 
0010    Description: Manages the GUI
0011 
0012    Usage:
0013     <usage>
0014 
0015  */
0016 //
0017 // Original Author:  Chris Jones
0018 //         Created:  Mon Feb 11 10:52:24 EST 2008
0019 //
0020 
0021 // system include files
0022 #include <functional>
0023 #include <map>
0024 #include <memory>
0025 
0026 #include <sigc++/sigc++.h>
0027 #include "Rtypes.h"
0028 #include "GuiTypes.h"
0029 #include "TGFileDialog.h"
0030 
0031 // user include files
0032 #include "Fireworks/Core/interface/FWConfigurable.h"
0033 #include "DataFormats/Provenance/interface/EventID.h"
0034 
0035 // forward declarations
0036 class TGPictureButton;
0037 class TGComboBox;
0038 class TGTextButton;
0039 class TGTextEntry;
0040 class TGFrame;
0041 class TGSplitFrame;
0042 class TGVerticalFrame;
0043 class TGMainFrame;
0044 class TGPack;
0045 class TGCompositeFrame;
0046 class TGCheckButton;
0047 class TGPopupMenu;
0048 
0049 class TGListTreeItem;
0050 class TGListTree;
0051 class TEveElementList;
0052 class TEveElement;
0053 class TEveWindowPack;
0054 class TEveWindowSlot;
0055 class TEveCompositeFrame;
0056 class TEveWindow;
0057 
0058 class CmsShowMainFrame;
0059 class FWEventItem;
0060 class FWViewBase;
0061 class FWGUISubviewArea;
0062 
0063 class FWSelectionManager;
0064 class FWSummaryManager;
0065 class FWDetailViewManager;
0066 class FWInvMassDialog;
0067 class CSGAction;
0068 class CSGContinuousAction;
0069 
0070 class FWGUIEventDataAdder;
0071 
0072 class CmsShowTaskExecutor;
0073 
0074 class FWNavigatorBase;
0075 
0076 class FWModelContextMenuHandler;
0077 class FWViewContextMenuHandlerBase;
0078 class TGWindow;
0079 
0080 namespace edm {
0081   class EventBase;
0082 }
0083 
0084 class CmsShowEDI;
0085 class CmsShowModelPopup;
0086 class CmsShowViewPopup;
0087 class FWViewManagerManager;
0088 class CmsShowCommonPopup;
0089 class CmsShowHelpPopup;
0090 
0091 namespace fireworks {
0092   class Context;
0093 }
0094 
0095 class FWGUIManager : public FWConfigurable {
0096   // typedefs
0097 public:
0098   typedef std::function<FWViewBase*(TEveWindowSlot*, const std::string&)> ViewBuildFunctor;
0099   typedef std::map<std::string, ViewBuildFunctor> NameToViewBuilder;
0100 
0101 private:
0102   typedef std::map<TEveWindow*, FWViewBase*> ViewMap_t;
0103   typedef ViewMap_t::iterator ViewMap_i;
0104 
0105 public:
0106   FWGUIManager(fireworks::Context* ctx, const FWViewManagerManager* iVMMgr, FWNavigatorBase* navigator);
0107 
0108   ~FWGUIManager() override;
0109   void evePreTerminate();
0110 
0111   //configuration management interface
0112   void addTo(FWConfiguration&) const override;
0113   void setFrom(const FWConfiguration&) override;
0114   void setWindowInfoFrom(const FWConfiguration& iFrom, TGMainFrame* iFrame);
0115   void initEmpty();
0116 
0117   TGVerticalFrame* createList(TGCompositeFrame* p);
0118   void createViews(TEveWindowSlot* slot);
0119   void exportImageOfMainView();
0120   void exportImagesOfAllViews();
0121   void exportAllViews(const std::string& format, int height);
0122 
0123   void createEDIFrame();
0124   ///Allowed values are -1 or ones from FWDataCategories enum
0125   void showEDIFrame(int iInfoToShow = -1);
0126 
0127   void open3DRegion();
0128   void showCommonPopup();
0129 
0130   void createModelPopup();
0131   void showModelPopup();
0132   void showViewPopup();
0133   void popupViewClosed();
0134 
0135   void showSelectedModelContextMenu(Int_t iGlobalX, Int_t iGlobalY, FWViewContextMenuHandlerBase* iHandler);
0136 
0137   void showInvMassDialog();
0138   //   void showGeometryBrowser();
0139 
0140   // help
0141   void createHelpPopup();
0142   void createShortcutPopup();
0143   void createHelpGLPopup();
0144 
0145   // ---------- const member functions ---------------------
0146   //      bool waitingForUserAction() const;
0147   CSGContinuousAction* playEventsAction();
0148   CSGContinuousAction* playEventsBackwardsAction();
0149   CSGContinuousAction* loopAction();
0150 
0151   // ---------- static member functions --------------------
0152   static FWGUIManager* getGUIManager();
0153   fireworks::Context* getContext() { return m_context; }
0154   static TGFrame* makeGUIsubview(TEveCompositeFrame* cp, TGCompositeFrame* parent, Int_t height);
0155 
0156   // ---------- member functions ---------------------------
0157   //have to use the portable syntax else the reflex code will not build
0158   void registerViewBuilder(const std::string& iName, ViewBuildFunctor& iBuilder);
0159 
0160   ViewMap_i createView(const std::string& iName, TEveWindowSlot* slot = nullptr);
0161   void newViewSlot(const std::string& iName);
0162 
0163   void connectSubviewAreaSignals(FWGUISubviewArea*);
0164   void enableActions(bool enable = true);
0165   void disablePrevious();
0166   void disableNext();
0167   void setPlayMode(bool);
0168   void updateStatus(const char* status);
0169   void clearStatus();
0170   void eventChangedCallback();
0171 
0172   CSGAction* getAction(const std::string name);
0173 
0174   void addData();
0175   void titleChanged(const char* title);
0176 
0177   void openEveBrowserForDebugging() const;
0178   void setDelayBetweenEvents(Float_t);
0179 
0180   void showEventFilterGUI();
0181   void filterButtonClicked();
0182   void setFilterButtonText(const char* txt);
0183   void setFilterButtonIcon(int);
0184   void updateEventFilterEnable(bool);
0185 
0186   void runIdChanged();
0187   void lumiIdChanged();
0188   void eventIdChanged();
0189   void checkSubviewAreaIconState(TEveWindow*);
0190   void subviewIsBeingDestroyed(FWGUISubviewArea*);
0191   void subviewDestroy(FWGUISubviewArea*);  // timeout funct
0192   void subviewDestroyAll();
0193   void subviewInfoSelected(FWGUISubviewArea*);
0194   void subviewInfoUnselected(FWGUISubviewArea*);
0195   void subviewSwapped(FWGUISubviewArea*);
0196 
0197   CmsShowMainFrame* getMainFrame() const { return m_cmsShowMainFrame; }
0198   const edm::EventBase* getCurrentEvent() const;
0199 
0200   void resetWMOffsets();
0201 
0202   // signals
0203   sigc::signal<void()> filterButtonClicked_;
0204   sigc::signal<void(const TGWindow*)> showEventFilterGUI_;
0205   sigc::signal<void(const std::string&)> writeToConfigurationFile_;
0206   sigc::signal<void(const std::string&)> writePartialToConfigurationFile_;
0207   sigc::signal<void(const std::string&)> loadFromConfigurationFile_;
0208   sigc::signal<void(const std::string&)> loadPartialFromConfigurationFile_;
0209   sigc::signal<void(edm::RunNumber_t, edm::LuminosityBlockNumber_t, edm::EventNumber_t)> changedEventId_;
0210   sigc::signal<void()> goingToQuit_;
0211   sigc::signal<void()> writeToPresentConfigurationFile_;
0212 
0213   sigc::signal<void()> changedRunEntry_;
0214   sigc::signal<void()> changedEventEntry_;
0215   sigc::signal<void(Float_t)> changedDelayBetweenEvents_;
0216 
0217   FWGUIManager(const FWGUIManager&) = delete;                   // stop default
0218   const FWGUIManager& operator=(const FWGUIManager&) = delete;  // stop default
0219 
0220 private:
0221   TEveWindow* getSwapCandidate();
0222 
0223   void newItem(const FWEventItem*);
0224 
0225   bool promptForConfigurationFile(std::string& result, enum EFileDialogMode mode);
0226   void promptForSaveConfigurationFile();
0227   void promptForPartialSaveConfigurationFile();
0228   void promptForLoadConfigurationFile();
0229   void promptForPartialLoadConfigurationFile();
0230   void savePartialToConfigurationFile();
0231 
0232   void delaySliderChanged(Int_t);
0233 
0234   void finishUpColorChange();
0235 
0236   void setViewPopup(TEveWindow*);
0237 
0238   void measureWMOffsets();
0239 
0240   // ---------- static member data --------------------------------
0241 
0242   static FWGUIManager* m_guiManager;
0243 
0244   // ---------- member data --------------------------------
0245   fireworks::Context* m_context;
0246 
0247   FWSummaryManager* m_summaryManager;
0248 
0249   //views are owned by their individual view managers
0250   FWDetailViewManager* m_detailViewManager;
0251   const FWViewManagerManager* m_viewManagerManager;
0252   FWModelContextMenuHandler* m_contextMenuHandler;
0253   FWNavigatorBase* m_navigator;
0254   CmsShowMainFrame* m_cmsShowMainFrame;
0255 
0256   TGPopupMenu* m_fileMenu;
0257   FWGUIEventDataAdder* m_dataAdder;
0258 
0259   // event data inspector
0260   CmsShowEDI* m_ediFrame;
0261   CmsShowModelPopup* m_modelPopup;
0262   CmsShowViewPopup* m_viewPopup;
0263   CmsShowCommonPopup* m_commonPopup;
0264   FWInvMassDialog* m_invMassDialog;
0265 
0266   // help
0267   CmsShowHelpPopup* m_helpPopup;
0268   CmsShowHelpPopup* m_shortcutPopup;
0269   CmsShowHelpPopup* m_helpGLPopup;
0270 
0271   // subview memebers
0272   mutable ViewMap_t m_viewMap;
0273   NameToViewBuilder m_nameToViewBuilder;
0274 
0275   TEveWindowPack* m_viewPrimPack;
0276   TEveWindowPack* m_viewSecPack;
0277 
0278   sigc::connection m_modelChangeConn;
0279 
0280   std::unique_ptr<CmsShowTaskExecutor> m_tasks;
0281   std::vector<FWViewBase*> m_regionViews;
0282   int m_WMOffsetX, m_WMOffsetY, m_WMDecorH;
0283 };
0284 
0285 #endif