CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/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.119 2011/02/23 14:07:03 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 FWGeometryBrowser;
00069 class CSGAction;
00070 class CSGContinuousAction;
00071 
00072 class FWGUIEventDataAdder;
00073 
00074 class CmsShowTaskExecutor;
00075 
00076 class FWNavigatorBase;
00077 
00078 class FWModelContextMenuHandler;
00079 class FWViewContextMenuHandlerBase;
00080 class TGWindow;
00081 
00082 namespace edm {
00083    class EventBase;
00084 }
00085 
00086 class CmsShowEDI;
00087 class CmsShowModelPopup;
00088 class CmsShowViewPopup;
00089 class FWViewManagerManager;
00090 class CmsShowCommonPopup;
00091 class CmsShowHelpPopup;
00092 
00093 namespace fireworks {
00094    class Context;
00095 }
00096 
00097 class FWGUIManager : public FWConfigurable
00098 {
00099    // typedefs
00100 public:
00101    typedef boost::function2<FWViewBase*,TEveWindowSlot*, const std::string& > ViewBuildFunctor;
00102    typedef std::map<std::string, ViewBuildFunctor > NameToViewBuilder;
00103 private:
00104    typedef std::map<TEveWindow*, FWViewBase*> ViewMap_t;
00105    typedef ViewMap_t::iterator                ViewMap_i;
00106    
00107    
00108 public:
00109    FWGUIManager(fireworks::Context* ctx,
00110                 const FWViewManagerManager* iVMMgr,
00111                 FWNavigatorBase* navigator);
00112 
00113    virtual ~FWGUIManager();
00114    void     evePreTerminate();
00115    
00116    //configuration management interface
00117    void addTo(FWConfiguration&) const;
00118    void setFrom(const FWConfiguration&);
00119    void setWindowInfoFrom(const FWConfiguration& iFrom, TGMainFrame* iFrame);
00120 
00121    TGVerticalFrame* createList(TGCompositeFrame *p);
00122    void createViews(TEveWindowSlot *slot);
00123    void exportImageOfMainView();
00124    void exportImagesOfAllViews();
00125    void exportAllViews(const std::string& format);
00126 
00127    void createEDIFrame();
00129    void showEDIFrame(int iInfoToShow=-1);
00130    
00131    void showCommonPopup();
00132    
00133    void createModelPopup();
00134    void showModelPopup();
00135    void showViewPopup();
00136    void popupViewClosed();
00137    
00138    void showSelectedModelContextMenu(Int_t iGlobalX, Int_t iGlobalY, FWViewContextMenuHandlerBase* iHandler);
00139 
00140    void showInvMassDialog();
00141    void showGeometryBrowser();
00142 
00143    // help
00144    void createHelpPopup ();
00145    void createShortcutPopup ();
00146    void createHelpGLPopup ();
00147    
00148    // ---------- const member functions ---------------------
00149    //      bool waitingForUserAction() const;
00150    CSGContinuousAction* playEventsAction();
00151    CSGContinuousAction* playEventsBackwardsAction();
00152    CSGContinuousAction* loopAction();
00153    
00154    // ---------- static member functions --------------------
00155    static FWGUIManager* getGUIManager();
00156    static  TGFrame* makeGUIsubview(TEveCompositeFrame* cp, TGCompositeFrame* parent, Int_t height);
00157    
00158    // ---------- member functions ---------------------------
00159    //have to use the portable syntax else the reflex code will not build
00160    void registerViewBuilder(const std::string& iName,
00161                             ViewBuildFunctor& iBuilder);
00162    
00163    
00164    ViewMap_i createView(const std::string& iName, TEveWindowSlot* slot = 0);
00165    void newViewSlot(const std::string& iName);
00166    
00167    void connectSubviewAreaSignals(FWGUISubviewArea*);
00168    void enableActions(bool enable = true);
00169    void disablePrevious();
00170    void disableNext();
00171    void setPlayMode(bool);
00172    void updateStatus(const char* status);
00173    void clearStatus();
00174    void eventChangedCallback();
00175    
00176    CSGAction* getAction(const std::string name);
00177    
00178    void addData();
00179    void titleChanged(const char *title);
00180    
00181    void processGUIEvents();
00182    void openEveBrowserForDebugging() const;
00183    void setDelayBetweenEvents(Float_t);
00184    
00185    void showEventFilterGUI();
00186    void filterButtonClicked();
00187    void setFilterButtonText(const char* txt);
00188    void setFilterButtonIcon(int);
00189    void updateEventFilterEnable(bool);
00190    
00191    void runIdChanged();
00192    void lumiIdChanged();
00193    void eventIdChanged();
00194    void checkSubviewAreaIconState(TEveWindow*);
00195    void subviewIsBeingDestroyed(FWGUISubviewArea*);
00196    void subviewDestroy(FWGUISubviewArea*); // timeout funct
00197    void subviewDestroyAll();
00198    void subviewInfoSelected(FWGUISubviewArea*);
00199    void subviewInfoUnselected(FWGUISubviewArea*);
00200    void subviewSwapped(FWGUISubviewArea*);
00201    
00202    CmsShowMainFrame* getMainFrame() const { return m_cmsShowMainFrame; }
00203    const edm::EventBase* getCurrentEvent() const;
00204 
00205    void resetWMOffsets();
00206 
00207    // signals
00208    sigc::signal<void> filterButtonClicked_;
00209    sigc::signal<void, const TGWindow*> showEventFilterGUI_;
00210    sigc::signal<void, const std::string&> writeToConfigurationFile_;
00211    sigc::signal<void, const std::string&> loadFromConfigurationFile_;
00212    sigc::signal<void, edm::RunNumber_t, edm::LuminosityBlockNumber_t, edm::EventNumber_t> changedEventId_;
00213    sigc::signal<void> goingToQuit_;
00214    sigc::signal<void> writeToPresentConfigurationFile_;
00215    
00216    sigc::signal<void> changedRunEntry_;
00217    sigc::signal<void> changedEventEntry_;
00218    sigc::signal<void, Float_t> changedDelayBetweenEvents_;
00219    
00220 private:
00221    FWGUIManager(const FWGUIManager&);    // stop default
00222    const FWGUIManager& operator=(const FWGUIManager&);    // stop default
00223       
00224    TEveWindow* getSwapCandidate();
00225    
00226    void newItem(const FWEventItem*);
00227 
00228    bool promptForConfigurationFile(std::string &result, enum EFileDialogMode mode);
00229    void promptForSaveConfigurationFile();
00230    void promptForLoadConfigurationFile();
00231    
00232    void delaySliderChanged(Int_t);
00233    
00234    void finishUpColorChange();
00235    
00236    void setViewPopup(TEveWindow*);
00237 
00238    void measureWMOffsets();
00239    
00240    // ---------- static member data --------------------------------   
00241    
00242    static FWGUIManager*  m_guiManager;
00243    
00244    // ---------- member data --------------------------------   
00245    fireworks::Context*   m_context;
00246 
00247    FWSummaryManager*     m_summaryManager;
00248    
00249    //views are owned by their individual view managers
00250    FWDetailViewManager*        m_detailViewManager;
00251    const FWViewManagerManager* m_viewManagerManager;
00252    FWModelContextMenuHandler*  m_contextMenuHandler;
00253    FWNavigatorBase            *m_navigator;
00254    CmsShowMainFrame*           m_cmsShowMainFrame;
00255    
00256    TGPopupMenu* m_fileMenu;
00257    FWGUIEventDataAdder* m_dataAdder;
00258    
00259    // event data inspector
00260    CmsShowEDI*             m_ediFrame;
00261    CmsShowModelPopup*      m_modelPopup;
00262    CmsShowViewPopup*       m_viewPopup;
00263    CmsShowCommonPopup*     m_commonPopup;
00264    FWInvMassDialog*        m_invMassDialog;
00265    
00266    FWGeometryBrowser*      m_geoBrowser;
00267 
00268    // help
00269    CmsShowHelpPopup *m_helpPopup;
00270    CmsShowHelpPopup  *m_shortcutPopup;
00271    CmsShowHelpPopup  *m_helpGLPopup;
00272    
00273    // subview memebers
00274    mutable ViewMap_t m_viewMap;
00275    NameToViewBuilder m_nameToViewBuilder;
00276    
00277    TEveWindowPack    *m_viewPrimPack;
00278    TEveWindowPack    *m_viewSecPack;
00279 
00280    sigc::connection   m_modelChangeConn;
00281 
00282    std::auto_ptr<CmsShowTaskExecutor> m_tasks;
00283 
00284    int m_WMOffsetX, m_WMOffsetY, m_WMDecorH;
00285 };
00286 
00287 
00288 #endif