CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/Fireworks/Core/interface/FWGUIManager.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef Fireworks_Core_FWGUIManager_h
00003 #define Fireworks_Core_FWGUIManager_h
00004 //
00005 // Package:     Core
00006 // Class  :     FWGUIManager
00007 //
00016 //
00017 // Original Author:  Chris Jones
00018 //         Created:  Mon Feb 11 10:52:24 EST 2008
00019 // $Id: FWGUIManager.h,v 1.120 2011/07/08 04:39:58 amraktad Exp $
00020 //
00021 
00022 // system include files
00023 #include <map>
00024 #include <boost/function.hpp>
00025 #include <boost/shared_ptr.hpp>
00026 #include <sigc++/sigc++.h>
00027 #include "Rtypes.h"
00028 #include "GuiTypes.h"
00029 #include "TGFileDialog.h"
00030 #include <memory>
00031 
00032 // user include files
00033 #include "Fireworks/Core/interface/FWConfigurable.h"
00034 #include "DataFormats/Provenance/interface/EventID.h"
00035 
00036 // forward declarations
00037 class TGPictureButton;
00038 class TGComboBox;
00039 class TGTextButton;
00040 class TGTextEntry;
00041 class TGFrame;
00042 class TGSplitFrame;
00043 class TGVerticalFrame;
00044 class TGMainFrame;
00045 class TGPack;
00046 class TGCompositeFrame;
00047 class TGCheckButton;
00048 class TGPopupMenu;
00049 
00050 class TGListTreeItem;
00051 class TGListTree;
00052 class TEveElementList;
00053 class TEveElement;
00054 class TEveWindowPack;
00055 class TEveWindowSlot;
00056 class TEveCompositeFrame;
00057 class TEveWindow;
00058 
00059 class CmsShowMainFrame;
00060 class FWEventItem;
00061 class FWViewBase;
00062 class FWGUISubviewArea;
00063 
00064 class FWSelectionManager;
00065 class FWSummaryManager;
00066 class FWDetailViewManager;
00067 class FWInvMassDialog;
00068 class CSGAction;
00069 class CSGContinuousAction;
00070 
00071 class FWGUIEventDataAdder;
00072 
00073 class CmsShowTaskExecutor;
00074 
00075 class FWNavigatorBase;
00076 
00077 class FWModelContextMenuHandler;
00078 class FWViewContextMenuHandlerBase;
00079 class TGWindow;
00080 
00081 namespace edm {
00082    class EventBase;
00083 }
00084 
00085 class CmsShowEDI;
00086 class CmsShowModelPopup;
00087 class CmsShowViewPopup;
00088 class FWViewManagerManager;
00089 class CmsShowCommonPopup;
00090 class CmsShowHelpPopup;
00091 
00092 namespace fireworks {
00093    class Context;
00094 }
00095 
00096 class FWGUIManager : public FWConfigurable
00097 {
00098    // typedefs
00099 public:
00100    typedef boost::function2<FWViewBase*,TEveWindowSlot*, const std::string& > ViewBuildFunctor;
00101    typedef std::map<std::string, ViewBuildFunctor > NameToViewBuilder;
00102 private:
00103    typedef std::map<TEveWindow*, FWViewBase*> ViewMap_t;
00104    typedef ViewMap_t::iterator                ViewMap_i;
00105    
00106    
00107 public:
00108    FWGUIManager(fireworks::Context* ctx,
00109                 const FWViewManagerManager* iVMMgr,
00110                 FWNavigatorBase* navigator);
00111 
00112    virtual ~FWGUIManager();
00113    void     evePreTerminate();
00114    
00115    //configuration management interface
00116    void addTo(FWConfiguration&) const;
00117    void setFrom(const FWConfiguration&);
00118    void setWindowInfoFrom(const FWConfiguration& iFrom, TGMainFrame* iFrame);
00119 
00120    TGVerticalFrame* createList(TGCompositeFrame *p);
00121    void createViews(TEveWindowSlot *slot);
00122    void exportImageOfMainView();
00123    void exportImagesOfAllViews();
00124    void exportAllViews(const std::string& format);
00125 
00126    void createEDIFrame();
00128    void showEDIFrame(int iInfoToShow=-1);
00129    
00130    void showCommonPopup();
00131    
00132    void createModelPopup();
00133    void showModelPopup();
00134    void showViewPopup();
00135    void popupViewClosed();
00136    
00137    void showSelectedModelContextMenu(Int_t iGlobalX, Int_t iGlobalY, FWViewContextMenuHandlerBase* iHandler);
00138 
00139    void showInvMassDialog();
00140    //   void showGeometryBrowser();
00141 
00142    // help
00143    void createHelpPopup ();
00144    void createShortcutPopup ();
00145    void createHelpGLPopup ();
00146    
00147    // ---------- const member functions ---------------------
00148    //      bool waitingForUserAction() const;
00149    CSGContinuousAction* playEventsAction();
00150    CSGContinuousAction* playEventsBackwardsAction();
00151    CSGContinuousAction* loopAction();
00152    
00153    // ---------- static member functions --------------------
00154    static FWGUIManager* getGUIManager();
00155    static  TGFrame* makeGUIsubview(TEveCompositeFrame* cp, TGCompositeFrame* parent, Int_t height);
00156    
00157    // ---------- member functions ---------------------------
00158    //have to use the portable syntax else the reflex code will not build
00159    void registerViewBuilder(const std::string& iName,
00160                             ViewBuildFunctor& iBuilder);
00161    
00162    
00163    ViewMap_i createView(const std::string& iName, TEveWindowSlot* slot = 0);
00164    void newViewSlot(const std::string& iName);
00165    
00166    void connectSubviewAreaSignals(FWGUISubviewArea*);
00167    void enableActions(bool enable = true);
00168    void disablePrevious();
00169    void disableNext();
00170    void setPlayMode(bool);
00171    void updateStatus(const char* status);
00172    void clearStatus();
00173    void eventChangedCallback();
00174    
00175    CSGAction* getAction(const std::string name);
00176    
00177    void addData();
00178    void titleChanged(const char *title);
00179    
00180    void processGUIEvents();
00181    void openEveBrowserForDebugging() const;
00182    void setDelayBetweenEvents(Float_t);
00183    
00184    void showEventFilterGUI();
00185    void filterButtonClicked();
00186    void setFilterButtonText(const char* txt);
00187    void setFilterButtonIcon(int);
00188    void updateEventFilterEnable(bool);
00189    
00190    void runIdChanged();
00191    void lumiIdChanged();
00192    void eventIdChanged();
00193    void checkSubviewAreaIconState(TEveWindow*);
00194    void subviewIsBeingDestroyed(FWGUISubviewArea*);
00195    void subviewDestroy(FWGUISubviewArea*); // timeout funct
00196    void subviewDestroyAll();
00197    void subviewInfoSelected(FWGUISubviewArea*);
00198    void subviewInfoUnselected(FWGUISubviewArea*);
00199    void subviewSwapped(FWGUISubviewArea*);
00200    
00201    CmsShowMainFrame* getMainFrame() const { return m_cmsShowMainFrame; }
00202    const edm::EventBase* getCurrentEvent() const;
00203 
00204    void resetWMOffsets();
00205 
00206    // signals
00207    sigc::signal<void> filterButtonClicked_;
00208    sigc::signal<void, const TGWindow*> showEventFilterGUI_;
00209    sigc::signal<void, const std::string&> writeToConfigurationFile_;
00210    sigc::signal<void, const std::string&> loadFromConfigurationFile_;
00211    sigc::signal<void, edm::RunNumber_t, edm::LuminosityBlockNumber_t, edm::EventNumber_t> changedEventId_;
00212    sigc::signal<void> goingToQuit_;
00213    sigc::signal<void> writeToPresentConfigurationFile_;
00214    
00215    sigc::signal<void> changedRunEntry_;
00216    sigc::signal<void> changedEventEntry_;
00217    sigc::signal<void, Float_t> changedDelayBetweenEvents_;
00218    
00219 private:
00220    FWGUIManager(const FWGUIManager&);    // stop default
00221    const FWGUIManager& operator=(const FWGUIManager&);    // stop default
00222       
00223    TEveWindow* getSwapCandidate();
00224    
00225    void newItem(const FWEventItem*);
00226 
00227    bool promptForConfigurationFile(std::string &result, enum EFileDialogMode mode);
00228    void promptForSaveConfigurationFile();
00229    void promptForLoadConfigurationFile();
00230    
00231    void delaySliderChanged(Int_t);
00232    
00233    void finishUpColorChange();
00234    
00235    void setViewPopup(TEveWindow*);
00236 
00237    void measureWMOffsets();
00238    
00239    // ---------- static member data --------------------------------   
00240    
00241    static FWGUIManager*  m_guiManager;
00242    
00243    // ---------- member data --------------------------------   
00244    fireworks::Context*   m_context;
00245 
00246    FWSummaryManager*     m_summaryManager;
00247    
00248    //views are owned by their individual view managers
00249    FWDetailViewManager*        m_detailViewManager;
00250    const FWViewManagerManager* m_viewManagerManager;
00251    FWModelContextMenuHandler*  m_contextMenuHandler;
00252    FWNavigatorBase            *m_navigator;
00253    CmsShowMainFrame*           m_cmsShowMainFrame;
00254    
00255    TGPopupMenu* m_fileMenu;
00256    FWGUIEventDataAdder* m_dataAdder;
00257    
00258    // event data inspector
00259    CmsShowEDI*             m_ediFrame;
00260    CmsShowModelPopup*      m_modelPopup;
00261    CmsShowViewPopup*       m_viewPopup;
00262    CmsShowCommonPopup*     m_commonPopup;
00263    FWInvMassDialog*        m_invMassDialog;
00264 
00265    // help
00266    CmsShowHelpPopup *m_helpPopup;
00267    CmsShowHelpPopup  *m_shortcutPopup;
00268    CmsShowHelpPopup  *m_helpGLPopup;
00269    
00270    // subview memebers
00271    mutable ViewMap_t m_viewMap;
00272    NameToViewBuilder m_nameToViewBuilder;
00273    
00274    TEveWindowPack    *m_viewPrimPack;
00275    TEveWindowPack    *m_viewSecPack;
00276 
00277    sigc::connection   m_modelChangeConn;
00278 
00279    std::auto_ptr<CmsShowTaskExecutor> m_tasks;
00280 
00281    int m_WMOffsetX, m_WMOffsetY, m_WMDecorH;
00282 };
00283 
00284 
00285 #endif