CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/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.121 2011/09/08 03:09:28 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 openEveBrowserForDebugging() const;
00181    void setDelayBetweenEvents(Float_t);
00182    
00183    void showEventFilterGUI();
00184    void filterButtonClicked();
00185    void setFilterButtonText(const char* txt);
00186    void setFilterButtonIcon(int);
00187    void updateEventFilterEnable(bool);
00188    
00189    void runIdChanged();
00190    void lumiIdChanged();
00191    void eventIdChanged();
00192    void checkSubviewAreaIconState(TEveWindow*);
00193    void subviewIsBeingDestroyed(FWGUISubviewArea*);
00194    void subviewDestroy(FWGUISubviewArea*); // timeout funct
00195    void subviewDestroyAll();
00196    void subviewInfoSelected(FWGUISubviewArea*);
00197    void subviewInfoUnselected(FWGUISubviewArea*);
00198    void subviewSwapped(FWGUISubviewArea*);
00199    
00200    CmsShowMainFrame* getMainFrame() const { return m_cmsShowMainFrame; }
00201    const edm::EventBase* getCurrentEvent() const;
00202 
00203    void resetWMOffsets();
00204 
00205    // signals
00206    sigc::signal<void> filterButtonClicked_;
00207    sigc::signal<void, const TGWindow*> showEventFilterGUI_;
00208    sigc::signal<void, const std::string&> writeToConfigurationFile_;
00209    sigc::signal<void, const std::string&> loadFromConfigurationFile_;
00210    sigc::signal<void, edm::RunNumber_t, edm::LuminosityBlockNumber_t, edm::EventNumber_t> changedEventId_;
00211    sigc::signal<void> goingToQuit_;
00212    sigc::signal<void> writeToPresentConfigurationFile_;
00213    
00214    sigc::signal<void> changedRunEntry_;
00215    sigc::signal<void> changedEventEntry_;
00216    sigc::signal<void, Float_t> changedDelayBetweenEvents_;
00217    
00218 private:
00219    FWGUIManager(const FWGUIManager&);    // stop default
00220    const FWGUIManager& operator=(const FWGUIManager&);    // stop default
00221       
00222    TEveWindow* getSwapCandidate();
00223    
00224    void newItem(const FWEventItem*);
00225 
00226    bool promptForConfigurationFile(std::string &result, enum EFileDialogMode mode);
00227    void promptForSaveConfigurationFile();
00228    void promptForLoadConfigurationFile();
00229    
00230    void delaySliderChanged(Int_t);
00231    
00232    void finishUpColorChange();
00233    
00234    void setViewPopup(TEveWindow*);
00235 
00236    void measureWMOffsets();
00237    
00238    // ---------- static member data --------------------------------   
00239    
00240    static FWGUIManager*  m_guiManager;
00241    
00242    // ---------- member data --------------------------------   
00243    fireworks::Context*   m_context;
00244 
00245    FWSummaryManager*     m_summaryManager;
00246    
00247    //views are owned by their individual view managers
00248    FWDetailViewManager*        m_detailViewManager;
00249    const FWViewManagerManager* m_viewManagerManager;
00250    FWModelContextMenuHandler*  m_contextMenuHandler;
00251    FWNavigatorBase            *m_navigator;
00252    CmsShowMainFrame*           m_cmsShowMainFrame;
00253    
00254    TGPopupMenu* m_fileMenu;
00255    FWGUIEventDataAdder* m_dataAdder;
00256    
00257    // event data inspector
00258    CmsShowEDI*             m_ediFrame;
00259    CmsShowModelPopup*      m_modelPopup;
00260    CmsShowViewPopup*       m_viewPopup;
00261    CmsShowCommonPopup*     m_commonPopup;
00262    FWInvMassDialog*        m_invMassDialog;
00263 
00264    // help
00265    CmsShowHelpPopup *m_helpPopup;
00266    CmsShowHelpPopup  *m_shortcutPopup;
00267    CmsShowHelpPopup  *m_helpGLPopup;
00268    
00269    // subview memebers
00270    mutable ViewMap_t m_viewMap;
00271    NameToViewBuilder m_nameToViewBuilder;
00272    
00273    TEveWindowPack    *m_viewPrimPack;
00274    TEveWindowPack    *m_viewSecPack;
00275 
00276    sigc::connection   m_modelChangeConn;
00277 
00278    std::auto_ptr<CmsShowTaskExecutor> m_tasks;
00279 
00280    int m_WMOffsetX, m_WMOffsetY, m_WMDecorH;
00281 };
00282 
00283 
00284 #endif