CMS 3D CMS Logo

FWGUIManager.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 #ifndef Fireworks_Core_FWGUIManager_h
3 #define Fireworks_Core_FWGUIManager_h
4 //
5 // Package: Core
6 // Class : FWGUIManager
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Mon Feb 11 10:52:24 EST 2008
19 //
20 
21 // system include files
22 #include <map>
23 #include <boost/function.hpp>
24 #include <sigc++/sigc++.h>
25 #include "Rtypes.h"
26 #include "GuiTypes.h"
27 #include "TGFileDialog.h"
28 #include <memory>
29 
30 // user include files
33 
34 // forward declarations
35 class TGPictureButton;
36 class TGComboBox;
37 class TGTextButton;
38 class TGTextEntry;
39 class TGFrame;
40 class TGSplitFrame;
41 class TGVerticalFrame;
42 class TGMainFrame;
43 class TGPack;
44 class TGCompositeFrame;
45 class TGCheckButton;
46 class TGPopupMenu;
47 
48 class TGListTreeItem;
49 class TGListTree;
50 class TEveElementList;
51 class TEveElement;
52 class TEveWindowPack;
53 class TEveWindowSlot;
54 class TEveCompositeFrame;
55 class TEveWindow;
56 
57 class CmsShowMainFrame;
58 class FWEventItem;
59 class FWViewBase;
60 class FWGUISubviewArea;
61 
62 class FWSelectionManager;
63 class FWSummaryManager;
65 class FWInvMassDialog;
66 class CSGAction;
68 
70 
72 
73 class FWNavigatorBase;
74 
77 class TGWindow;
78 
79 namespace edm {
80  class EventBase;
81 }
82 
83 class CmsShowEDI;
84 class CmsShowModelPopup;
85 class CmsShowViewPopup;
87 class CmsShowCommonPopup;
88 class CmsShowHelpPopup;
89 
90 namespace fireworks {
91  class Context;
92 }
93 
94 class FWGUIManager : public FWConfigurable {
95  // typedefs
96 public:
97  typedef boost::function2<FWViewBase*, TEveWindowSlot*, const std::string&> ViewBuildFunctor;
98  typedef std::map<std::string, ViewBuildFunctor> NameToViewBuilder;
99 
100 private:
101  typedef std::map<TEveWindow*, FWViewBase*> ViewMap_t;
102  typedef ViewMap_t::iterator ViewMap_i;
103 
104 public:
106 
107  ~FWGUIManager() override;
108  void evePreTerminate();
109 
110  //configuration management interface
111  void addTo(FWConfiguration&) const override;
112  void setFrom(const FWConfiguration&) override;
113  void setWindowInfoFrom(const FWConfiguration& iFrom, TGMainFrame* iFrame);
114  void initEmpty();
115 
116  TGVerticalFrame* createList(TGCompositeFrame* p);
117  void createViews(TEveWindowSlot* slot);
118  void exportImageOfMainView();
119  void exportImagesOfAllViews();
120  void exportAllViews(const std::string& format, int height);
121 
122  void createEDIFrame();
124  void showEDIFrame(int iInfoToShow = -1);
125 
126  void open3DRegion();
127  void showCommonPopup();
128 
129  void createModelPopup();
130  void showModelPopup();
131  void showViewPopup();
132  void popupViewClosed();
133 
134  void showSelectedModelContextMenu(Int_t iGlobalX, Int_t iGlobalY, FWViewContextMenuHandlerBase* iHandler);
135 
136  void showInvMassDialog();
137  // void showGeometryBrowser();
138 
139  // help
140  void createHelpPopup();
141  void createShortcutPopup();
142  void createHelpGLPopup();
143 
144  // ---------- const member functions ---------------------
145  // bool waitingForUserAction() const;
146  CSGContinuousAction* playEventsAction();
147  CSGContinuousAction* playEventsBackwardsAction();
148  CSGContinuousAction* loopAction();
149 
150  // ---------- static member functions --------------------
151  static FWGUIManager* getGUIManager();
152  fireworks::Context* getContext() { return m_context; }
153  static TGFrame* makeGUIsubview(TEveCompositeFrame* cp, TGCompositeFrame* parent, Int_t height);
154 
155  // ---------- member functions ---------------------------
156  //have to use the portable syntax else the reflex code will not build
157  void registerViewBuilder(const std::string& iName, ViewBuildFunctor& iBuilder);
158 
159  ViewMap_i createView(const std::string& iName, TEveWindowSlot* slot = nullptr);
160  void newViewSlot(const std::string& iName);
161 
162  void connectSubviewAreaSignals(FWGUISubviewArea*);
163  void enableActions(bool enable = true);
164  void disablePrevious();
165  void disableNext();
166  void setPlayMode(bool);
167  void updateStatus(const char* status);
168  void clearStatus();
169  void eventChangedCallback();
170 
171  CSGAction* getAction(const std::string name);
172 
173  void addData();
174  void titleChanged(const char* title);
175 
176  void openEveBrowserForDebugging() const;
177  void setDelayBetweenEvents(Float_t);
178 
179  void showEventFilterGUI();
180  void filterButtonClicked();
181  void setFilterButtonText(const char* txt);
182  void setFilterButtonIcon(int);
183  void updateEventFilterEnable(bool);
184 
185  void runIdChanged();
186  void lumiIdChanged();
187  void eventIdChanged();
188  void checkSubviewAreaIconState(TEveWindow*);
189  void subviewIsBeingDestroyed(FWGUISubviewArea*);
190  void subviewDestroy(FWGUISubviewArea*); // timeout funct
191  void subviewDestroyAll();
192  void subviewInfoSelected(FWGUISubviewArea*);
193  void subviewInfoUnselected(FWGUISubviewArea*);
194  void subviewSwapped(FWGUISubviewArea*);
195 
196  CmsShowMainFrame* getMainFrame() const { return m_cmsShowMainFrame; }
197  const edm::EventBase* getCurrentEvent() const;
198 
199  void resetWMOffsets();
200 
201  // signals
202  sigc::signal<void> filterButtonClicked_;
203  sigc::signal<void, const TGWindow*> showEventFilterGUI_;
204  sigc::signal<void, const std::string&> writeToConfigurationFile_;
205  sigc::signal<void, const std::string&> writePartialToConfigurationFile_;
206  sigc::signal<void, const std::string&> loadFromConfigurationFile_;
207  sigc::signal<void, const std::string&> loadPartialFromConfigurationFile_;
208  sigc::signal<void, edm::RunNumber_t, edm::LuminosityBlockNumber_t, edm::EventNumber_t> changedEventId_;
209  sigc::signal<void> goingToQuit_;
211 
212  sigc::signal<void> changedRunEntry_;
213  sigc::signal<void> changedEventEntry_;
214  sigc::signal<void, Float_t> changedDelayBetweenEvents_;
215 
216 private:
217  FWGUIManager(const FWGUIManager&) = delete; // stop default
218  const FWGUIManager& operator=(const FWGUIManager&) = delete; // stop default
219 
220  TEveWindow* getSwapCandidate();
221 
222  void newItem(const FWEventItem*);
223 
224  bool promptForConfigurationFile(std::string& result, enum EFileDialogMode mode);
225  void promptForSaveConfigurationFile();
226  void promptForPartialSaveConfigurationFile();
227  void promptForLoadConfigurationFile();
228  void promptForPartialLoadConfigurationFile();
229  void savePartialToConfigurationFile();
230 
231  void delaySliderChanged(Int_t);
232 
233  void finishUpColorChange();
234 
235  void setViewPopup(TEveWindow*);
236 
237  void measureWMOffsets();
238 
239  // ---------- static member data --------------------------------
240 
242 
243  // ---------- member data --------------------------------
245 
247 
248  //views are owned by their individual view managers
254 
255  TGPopupMenu* m_fileMenu;
257 
258  // event data inspector
264 
265  // help
269 
270  // subview memebers
271  mutable ViewMap_t m_viewMap;
272  NameToViewBuilder m_nameToViewBuilder;
273 
274  TEveWindowPack* m_viewPrimPack;
275  TEveWindowPack* m_viewSecPack;
276 
277  sigc::connection m_modelChangeConn;
278 
279  std::unique_ptr<CmsShowTaskExecutor> m_tasks;
280  std::vector<FWViewBase*> m_regionViews;
281  int m_WMOffsetX, m_WMOffsetY, m_WMDecorH;
282 };
283 
284 #endif
sigc::signal< void > writeToPresentConfigurationFile_
Definition: FWGUIManager.h:210
fireworks::Context * getContext()
Definition: FWGUIManager.h:152
ViewMap_t::iterator ViewMap_i
Definition: FWGUIManager.h:102
sigc::signal< void > filterButtonClicked_
Definition: FWGUIManager.h:202
ViewMap_t m_viewMap
Definition: FWGUIManager.h:271
sigc::signal< void, const std::string & > writePartialToConfigurationFile_
Definition: FWGUIManager.h:205
NameToViewBuilder m_nameToViewBuilder
Definition: FWGUIManager.h:272
CmsShowEDI * m_ediFrame
Definition: FWGUIManager.h:259
FWSummaryManager * m_summaryManager
Definition: FWGUIManager.h:246
sigc::signal< void, const std::string & > loadPartialFromConfigurationFile_
Definition: FWGUIManager.h:207
FWInvMassDialog * m_invMassDialog
Definition: FWGUIManager.h:263
sigc::connection m_modelChangeConn
Definition: FWGUIManager.h:277
static FWGUIManager * m_guiManager
Definition: FWGUIManager.h:241
TGPopupMenu * m_fileMenu
Definition: FWGUIManager.h:255
FWDetailViewManager * m_detailViewManager
Definition: FWGUIManager.h:249
TEveWindowPack * m_viewPrimPack
Definition: FWGUIManager.h:274
TEveWindowPack * m_viewSecPack
Definition: FWGUIManager.h:275
CmsShowViewPopup * m_viewPopup
Definition: FWGUIManager.h:261
sigc::signal< void, Float_t > changedDelayBetweenEvents_
Definition: FWGUIManager.h:214
FWNavigatorBase * m_navigator
Definition: FWGUIManager.h:252
sigc::signal< void, const TGWindow * > showEventFilterGUI_
Definition: FWGUIManager.h:203
std::map< std::string, ViewBuildFunctor > NameToViewBuilder
Definition: FWGUIManager.h:98
CmsShowMainFrame * m_cmsShowMainFrame
Definition: FWGUIManager.h:253
FWGUIEventDataAdder * m_dataAdder
Definition: FWGUIManager.h:256
CmsShowMainFrame * getMainFrame() const
Definition: FWGUIManager.h:196
CmsShowModelPopup * m_modelPopup
Definition: FWGUIManager.h:260
sigc::signal< void > changedRunEntry_
Definition: FWGUIManager.h:212
CmsShowCommonPopup * m_commonPopup
Definition: FWGUIManager.h:262
CmsShowHelpPopup * m_helpGLPopup
Definition: FWGUIManager.h:268
std::vector< FWViewBase * > m_regionViews
Definition: FWGUIManager.h:280
const FWViewManagerManager * m_viewManagerManager
Definition: FWGUIManager.h:250
boost::function2< FWViewBase *, TEveWindowSlot *, const std::string & > ViewBuildFunctor
Definition: FWGUIManager.h:97
sigc::signal< void > changedEventEntry_
Definition: FWGUIManager.h:213
fireworks::Context * m_context
Definition: FWGUIManager.h:244
std::unique_ptr< CmsShowTaskExecutor > m_tasks
Definition: FWGUIManager.h:279
sigc::signal< void, const std::string & > writeToConfigurationFile_
Definition: FWGUIManager.h:204
HLT enums.
std::map< TEveWindow *, FWViewBase * > ViewMap_t
Definition: FWGUIManager.h:101
sigc::signal< void, const std::string & > loadFromConfigurationFile_
Definition: FWGUIManager.h:206
FWModelContextMenuHandler * m_contextMenuHandler
Definition: FWGUIManager.h:251
sigc::signal< void, edm::RunNumber_t, edm::LuminosityBlockNumber_t, edm::EventNumber_t > changedEventId_
Definition: FWGUIManager.h:208
sigc::signal< void > goingToQuit_
Definition: FWGUIManager.h:209
CmsShowHelpPopup * m_helpPopup
Definition: FWGUIManager.h:266
CmsShowHelpPopup * m_shortcutPopup
Definition: FWGUIManager.h:267