17 #include <boost/bind.hpp>
26 #include "TGLViewer.h"
27 #include "TEveBrowser.h"
28 #include "TEveManager.h"
30 #include "TEveWindow.h"
31 #include "TEveViewer.h"
32 #include "TEveWindowManager.h"
33 #include "TEveSelection.h"
34 #include "TVirtualX.h"
100 m_detailViewManager(0),
101 m_viewManagerManager(iVMMgr),
102 m_contextMenuHandler(0),
103 m_navigator(navigator),
114 m_WMOffsetX(0), m_WMOffsetY(0), m_WMDecorH(0)
127 TEveCompositeFrame::SetupFrameMarkup(foo, 20, 4,
false);
133 UInt_t height =
static_cast<UInt_t>(gClient->GetDisplayHeight()*.8);
137 while(width > 2000) {
140 width =
static_cast<UInt_t>(width*.8);
195 TQObject::Connect(gEve->GetWindowManager(),
"WindowSelected(TEveWindow*)",
"FWGUIManager",
this,
"checkSubviewAreaIconState(TEveWindow*)");
196 TQObject::Connect(gEve->GetWindowManager(),
"WindowDocked(TEveWindow*)" ,
"FWGUIManager",
this,
"checkSubviewAreaIconState(TEveWindow*)");
197 TQObject::Connect(gEve->GetWindowManager(),
"WindowUndocked(TEveWindow*)",
"FWGUIManager",
this,
"checkSubviewAreaIconState(TEveWindow*)");
227 gEve->GetWindowManager()->Disconnect(
"WindowSelected(TEveWindow*)",
this,
"checkSubviewAreaIconState(TEveWindow*)");
228 gEve->GetWindowManager()->Disconnect(
"WindowDocked(TEveWindow*)",
this,
"checkSubviewAreaIconState(TEveWindow*)");
229 gEve->GetWindowManager()->Disconnect(
"WindowUndocked(TEveWindow*)",
this,
"checkSubviewAreaIconState(TEveWindow*)");
232 gEve->GetSelection()->Disconnect();
233 gEve->GetHighlight()->Disconnect();
234 gEve->GetSelection()->RemoveElements();
235 gEve->GetHighlight()->RemoveElements();
240 TEveCompositeFrameInMainFrame* mainFrame =
dynamic_cast<TEveCompositeFrameInMainFrame*
>((*wIt).first->GetEveFrame());
242 if (mainFrame) mainFrame->UnmapWindow();
244 (*wIt).second->destroy();
280 throw std::runtime_error(
std::string(
"Unable to create view named ")+iName+
" because it is unknown");
296 TEveCompositeFrame *ef = slot->GetEveFrame();
297 FWViewBase* viewBase = itFind->second(slot, iName);
302 TEveWindow *eveWindow = ef->GetEveWindow();
303 eveWindow->SetElementName(iName.c_str());
305 std::pair<ViewMap_i,bool> insertPair =
m_viewMap.insert(std::make_pair(eveWindow, viewBase));
306 return insertPair.first;
324 snprintf(title,127,
"cmsShow: %s", subtitle);
332 TEveViewerList* viewers = gEve->GetViewers();
333 for (TEveElement::List_i
i=viewers->BeginChildren();
i!= viewers->EndChildren(); ++
i)
335 TEveViewer* ev =
dynamic_cast<TEveViewer*
>(*i);
337 ev->GetGLViewer()->DeleteOverlayAnnotations();
401 #if defined(THIS_WILL_NEVER_BE_DEFINED)
402 m_selectionItemsComboBox->AddEntry(iItem->
name().c_str(),iItem->
id());
404 m_selectionItemsComboBox->Select(0);
428 TEveWindow* swapCandidate =0;
430 if ( gEve->GetWindowManager()->GetCurrentWindow())
432 swapCandidate = gEve->GetWindowManager()->GetCurrentWindow();
437 TEveCompositeFrame* pef;
438 TGFrameElementPack *pel;
442 if ( pp->GetList()->GetSize() > 2)
444 pel = (TGFrameElementPack*) pp->GetList()->At(1);
447 pef =
dynamic_cast<TEveCompositeFrame*
>(pel->fFrame);
448 if ( pef && pef->GetEveWindow())
449 swapCandidate = pef->GetEveWindow();
452 if (swapCandidate == 0)
456 TIter frame_iterator(sp->GetList());
457 while ((pel = (TGFrameElementPack*)frame_iterator()))
459 pef =
dynamic_cast<TEveCompositeFrame*
>(pel->fFrame);
460 if ( pef && pef->GetEveWindow() && pel->fState)
462 swapCandidate = pef->GetEveWindow() ;
468 return swapCandidate;
486 if (checkInfoBtn && selected)
515 std::vector<FWGUISubviewArea*>
sd;
522 for (std::vector<FWGUISubviewArea*>::iterator
i= sd.begin();
i !=sd.end(); ++
i)
524 if ((*i)->isSelected())
529 gSystem->ProcessEvents();
536 TEveWindow*
w =
dynamic_cast<TEveWindow*
>(
m_viewPrimPack->FirstChild());
537 if (w) w->DestroyWindowAndSlot();
542 gSystem->ProcessEvents();
553 if (wIt->first != ew)
570 if (curr) swap->SwapWindow(curr);
578 TGVerticalFrame *listFrame =
new TGVerticalFrame(p, p->GetWidth(), p->GetHeight());
580 TGHorizontalFrame* addFrame =
new TGHorizontalFrame(listFrame, p->GetWidth(), 10, kRaisedFrame);
581 TGLabel* addLabel =
new TGLabel(addFrame,
"Summary View");
582 addFrame->AddFrame(addLabel,
new TGLayoutHints(kLHintsCenterX, 0,0,2,2));
583 listFrame->AddFrame(addFrame,
new TGLayoutHints(kLHintsExpandX | kLHintsTop));
592 const unsigned int backgroundColor=0x2f2f2f;
594 addDataButton->ChangeOptions(kRaisedFrame);
595 addDataButton->SetBackgroundColor(backgroundColor);
596 addDataButton->SetTextColor(0xFFFFFF);
597 addDataButton->SetToolTipText(
"Show additional collections");
598 addDataButton->Connect(
"Clicked()",
"FWGUIManager",
this,
"addData()");
599 m_summaryManager->
widget()->AddFrame(addDataButton,
new TGLayoutHints(kLHintsExpandX|kLHintsLeft|kLHintsTop));
621 m_ediFrame->CenterOnParent(kTRUE,TGTransientFrame::kTopRight);
716 m_helpPopup->CenterOnParent(kTRUE,TGTransientFrame::kBottomRight);
744 m_helpGLPopup->CenterOnParent(kTRUE,TGTransientFrame::kBottomRight);
786 const static char* kFileTypes[] = {
"Fireworks Configuration files",
"*.fwc",
790 static TString
dir(
".");
793 fi.fFileTypes = kFileTypes;
794 fi.fIniDir = StrDup(dir);
797 if (fi.fFilename == 0)
801 std::string ext = kFileTypes[fi.fFileTypeIdx + 1] + 1;
802 if (ext.size() != 0 && name.find(ext) == name.npos)
840 TGFrameElementPack* frameEL = (TGFrameElementPack*)
m_viewPrimPack->GetPack()->GetList()->At(1);
841 TEveCompositeFrame* ef =
dynamic_cast<TEveCompositeFrame*
>(frameEL->fFrame);
854 static TString
dir(
".");
855 const char * kImageExportTypes[] = {
"PNG",
"*.png",
859 "Encapsulated PostScript",
"*.eps",
863 fi.fFileTypes = kImageExportTypes;
864 fi.fIniDir = StrDup(dir);
868 if (fi.fFilename != 0) {
873 std::string ext = kImageExportTypes[fi.fFileTypeIdx + 1] + 1;
874 if (name.find(ext) == name.npos)
877 name.insert(name.rfind(
'.'),
"-%u_%u_%u_%s");
881 catch (std::runtime_error &
e) {
std::cout << e.what() << std::endl; }
894 typedef std::list<TEveViewer*> viewer_list_t;
895 typedef viewer_list_t::iterator viewer_list_i;
897 typedef std::map<TString, viewer_list_t> name_map_t;
898 typedef name_map_t::iterator name_map_i;
904 TEveViewer *ev =
dynamic_cast<TEveViewer*
>(
i->first);
907 TString
name(ev->GetElementName());
908 name.ReplaceAll(
" ",
"");
909 viewer_list_t &
l = vls[
name];
910 viewer_list_i li = l.begin();
911 while (li != l.end() && (*li)->GetGLViewer()->ViewportDiagonal() < ev->GetGLViewer()->ViewportDiagonal())
918 for (name_map_i
i = vls.begin();
i != vls.end(); ++
i)
920 bool multi_p = (
i->second.size() > 1);
922 for (viewer_list_i
j =
i->second.begin();
j !=
i->second.end(); ++
j, ++view_count)
924 TString view_name(
i->first);
928 view_name += view_count;
931 file.Form(format.c_str(),
event->id().run(),
event->id().event(),
932 event->luminosityBlock(), view_name.Data());
933 (*j)->GetGLViewer()->SavePicture(file);
955 gVirtualX->TranslateCoordinates(iMain->GetId(),
956 gClient->GetDefaultRoot()->GetId(),
972 s<<iMain->GetWidth();
977 s<<iMain->GetHeight();
991 weight = frameElement->fWeight;
994 TEveCompositeFrame *eveFrame =
dynamic_cast<TEveCompositeFrame*
>(frameElement->fFrame);
997 if (frameElement->fState)
1018 std::stringstream
s;
1023 std::stringstream
s;
1043 float leftWeight, rightWeight;
1048 std::stringstream ss;
1056 TGFrameElementPack *frameEL;
1057 frameEL = (TGFrameElementPack*)
m_viewPrimPack->GetPack()->GetList()->At(1);
1058 leftWeight = frameEL->fWeight;
1059 frameEL = (TGFrameElementPack*)
m_viewPrimPack->GetPack()->GetList()->At(3);
1060 rightWeight = frameEL->fWeight;
1067 std::stringstream sL;
1070 std::stringstream sR;
1078 std::vector<areaInfo> wpacked;
1082 TGFrameElementPack *frameEL = (TGFrameElementPack*) pp->GetList()->At(1);
1083 if (frameEL->fWeight > 0)
1084 wpacked.push_back(
areaInfo(frameEL));
1087 TGFrameElementPack *seFE;
1088 TIter frame_iterator(sp->GetList());
1089 while ((seFE = (TGFrameElementPack*)frame_iterator() ))
1099 TEveWindow* ew = wIt->first;
1100 TEveCompositeFrameInMainFrame* mainFrame =
dynamic_cast<TEveCompositeFrameInMainFrame*
>(ew->GetEveFrame());
1103 for(std::vector<areaInfo>::iterator pIt = wpacked.begin(); pIt != wpacked.end(); ++pIt)
1105 if ((*pIt).originalSlot && mainFrame->GetOriginalSlot() == (*pIt).originalSlot)
1107 (*pIt).eveWindow = wIt->first;
1108 (*pIt).undockedMainFrame = (TGMainFrame*)mainFrame;
1120 for(std::vector<areaInfo>::iterator it = wpacked.begin(); it != wpacked.end(); ++it)
1122 TEveWindow* ew = (*it).eveWindow;
1126 wb->
addTo(tempWiew);
1167 TGMainFrame* iFrame)
1174 iFrame->MoveResize(x,y,width,height);
1175 iFrame->SetWMPosition(x, y);
1194 float_t leftWeight =1;
1195 float_t rightWeight=1;
1202 float summaryWeight = atof(mw->
valueForKey(
"summaryWeight")->
value().c_str());
1206 TEveWindowSlot* primSlot = (leftWeight > 0) ?
m_viewPrimPack->NewSlotWithWeight(leftWeight) : 0;
1224 float weight = atof((areaIt->second).valueForKey(
"weight")->value().c_str());
1225 TEveWindowSlot* slot = (
m_viewMap.size() || (primSlot == 0) ) ?
m_viewSecPack->NewSlotWithWeight(weight) : primSlot;
1228 lastViewIt->second->setFrom(it->second);
1230 bool undocked = atof((areaIt->second).valueForKey(
"undocked")->value().c_str());
1233 TEveWindow* lastWindow = lastViewIt->first;
1234 lastWindow->UndockWindow();
1235 TEveCompositeFrameInMainFrame* emf =
dynamic_cast<TEveCompositeFrameInMainFrame*
>(lastWindow->GetEveFrame());
1237 const TGMainFrame* mf =
dynamic_cast<const TGMainFrame*
>(emf->GetParent());
1240 TGMainFrame* mfp = (TGMainFrame*)mf;
1241 const FWConfiguration* mwc = (areaIt->second).valueForKey(
"UndockedWindowPos");
1256 lastViewIt->second->setFrom(it->second);
1261 fwLog(
fwlog::kWarning) <<
"Restrore of undocked windows with old window management not supported." << std::endl;
1267 if (0 != controllers)
1313 gEve->GetBrowser()->MapWindow();
1322 Float_t sec = val*0.001;
1359 gEve->FullRedraw3D();
1399 const Int_t
x = 100,
y = 100;
1401 TGMainFrame *mf1 =
new TGMainFrame(0, 0, 0);
1407 TGMainFrame *mf2 =
new TGMainFrame(0, 0, 0);
1409 while (!mf2->IsMapped()) gClient->HandleInput();
1415 WindowAttributes_t
attr;
1416 gVirtualX->TranslateCoordinates(mf1->GetId(), gClient->GetDefaultRoot()->GetId(),
1417 0, 0, xm, ym, childdum);
1418 gVirtualX->GetWindowAttributes(mf1->GetId(),
attr);
1422 fwLog(
fwlog::kDebug) << Form(
"FWGUIManager::measureWMOffsets: required (%d,%d), measured(%d, %d) => dx=%d, dy=%d; decor_h=%d.\n",
const std::string sKeyboardShort
TGVerticalFrame * createList(TGCompositeFrame *p)
const std::set< FWModelId > & selected() const
TEveWindow * getEveWindow()
TGMainFrame * undockedMainFrame
void swap(ora::Record &rh, ora::Record &lh)
std::vector< std::pair< std::string, FWConfiguration > > KeyValues
FWNumberEntryField * m_lumiEntry
sigc::signal< void > writeToPresentConfigurationFile_
TGCompositeFrame * widget() const
void bindCSGActionKeys(const TGMainFrame *f) const
ViewMap_t::iterator ViewMap_i
const std::string sShowCommonInsp
sigc::signal< void > filterButtonClicked_
sigc::signal< void, FWGUISubviewArea * > unselected_
const KeyValues * keyValues() const
NameToViewBuilder m_nameToViewBuilder
void loadEvent(const edm::EventBase &event)
const FWEventItemsManager * eventItemsManager() const
CSGContinuousAction * playEventsBackwardsAction() const
void subviewIsBeingDestroyed(FWGUISubviewArea *)
FWSummaryManager * m_summaryManager
void subviewInfoSelected(FWGUISubviewArea *)
void setFilterButtonIcon(int)
void createViews(TEveWindowSlot *slot)
FWInvMassDialog * m_invMassDialog
void setViewPopup(TEveWindow *)
const std::string & name() const
static void addAreaInfoTo(areaInfo &pInfo, FWConfiguration &oTo)
const std::string sBackgroundColor
static const std::string kViewController("view")
FWColorManager * colorManager() const
sigc::signal< void > activated
static void addWindowInfoTo(const TGFrame *iMain, FWConfiguration &oTo)
const std::string & typeName() const
void newViewSlot(const std::string &iName)
void populate3DViewsFromConfig()
void addTo(FWConfiguration &) const
unsigned int version() const
static FWGUIManager * m_guiManager
FWCustomIconsButton * m_filterEnableBtn
CSGContinuousAction * loopAction() const
void enableNext(bool enable=true)
static const std::string kViews("views")
void delaySliderChanged(Int_t)
static const std::string kObjectController("object")
void updateStatus(const char *status)
FWDetailViewManager * m_detailViewManager
FWIntValueListener * m_delaySliderListener
TEveWindowPack * m_viewPrimPack
void showEDIFrame(int iInfoToShow=-1)
Allowed values are -1 or ones from FWDataCategories enum.
static const std::string kCommonController("common")
const std::string sSaveConfigAs
boost::function2< FWViewBase *, TEveWindowSlot *, const std::string & > ViewBuildFunctor
unsigned int version() const
void setInfoButton(bool downp)
void enableActions(bool enable=true)
std::auto_ptr< CmsShowTaskExecutor > m_tasks
TEveWindowPack * m_viewSecPack
void setWindowInfoFrom(const FWConfiguration &iFrom, TGMainFrame *iFrame)
void registerViewBuilder(const std::string &iName, ViewBuildFunctor &iBuilder)
void checkSubviewAreaIconState(TEveWindow *)
void connectSubviewAreaSignals(FWGUISubviewArea *)
void createShortcutPopup()
const std::string sSaveConfig
static const std::string kCollectionController("collection")
CmsShowViewPopup * m_viewPopup
const TGPicture * m_filterIcons[9]
sigc::signal< void, Float_t > changedDelayBetweenEvents_
TEveWindow * getSwapCandidate()
static const std::string kMainWindow("main window")
sigc::signal< void > colorsHaveChangedFinished_
void exportAllViews(const std::string &format)
static TGFrame * makeGUIsubview(TEveCompositeFrame *cp, TGCompositeFrame *parent, Int_t height)
FWNavigatorBase * m_navigator
static const std::string kUndocked("undocked views")
sigc::signal< void, const TGWindow * > showEventFilterGUI_
void setDelayBetweenEvents(Float_t)
CSGAction * createNewViewerAction(const std::string &iActionName, bool seaprator)
void exportImagesOfAllViews()
TEveWindow * originalSlot
void subviewDestroy(FWGUISubviewArea *)
FWNumberEntryField * m_eventEntry
sigc::signal< void, FWGUISubviewArea * > goingToBeDestroyed_
CmsShowMainFrame * m_cmsShowMainFrame
sigc::signal< void, Int_t > valueChanged_
sigc::signal< void, FWEventItem * > newItem_
static FWGUISubviewArea * getToolBarFromWindow(TEveWindow *)
void newItem(const FWEventItem *)
void updateStatusBar(const char *status)
virtual UInt_t GetUIntNumber()
void filterButtonClicked()
const std::string sShowAddCollection
FWGUIEventDataAdder * m_dataAdder
void exportImageOfMainView()
virtual FWViewContextMenuHandlerBase * contextMenuHandler() const
const std::string sExportImage
FWSelectionManager * selectionManager() const
CmsShowModelPopup * m_modelPopup
static const std::string kViewArea("view area")
CmsShowCommonPopup * m_commonPopup
virtual const edm::EventBase * getCurrentEvent() const =0
static const std::string & checkNameWithViewVersion(const std::string &name, unsigned int viewVersion)
FWModelChangeManager * modelChangeManager() const
CmsShowHelpPopup * m_helpGLPopup
const std::string sShowMainViewCtl
void setFrom(const FWConfiguration &)
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
void eventChangedCallback()
FWNumberEntryField * m_runEntry
const std::string & value(unsigned int iIndex=0) const
CSGAction * getAction(const std::string &name)
const edm::EventBase * getCurrentEvent() const
virtual void enableActions(bool enable=true)
ViewMap_i createView(const std::string &iName, TEveWindowSlot *slot=0)
void showSelectedModelContext(Int_t iX, Int_t iY, FWViewContextMenuHandlerBase *) const
NOTE: iX and iY are in global coordinates.
const std::string sShowObjInsp
CSGAction * getAction(const std::string name)
void updateEventFilterEnable(bool)
static FWGUIManager * getGUIManager()
CSGContinuousAction * loopAction()
fireworks::Context * m_context
FWJobMetadataManager * metadataManager() const
bool promptForConfigurationFile(std::string &result, enum EFileDialogMode mode)
CSGContinuousAction * playEventsBackwardsAction()
void finishUpColorChange()
sigc::signal< void, FWGUISubviewArea * > swap_
void setFilterButtonText(const char *txt)
const std::string sShowInvMassDialog
CmsShowCommon * commonPrefs() const
sigc::signal< void, const std::string & > writeToConfigurationFile_
KeyValues::const_iterator KeyValuesIt
void setSummaryViewWeight(float)
const std::string sShowEventDisplayInsp
CSGContinuousAction * playEventsAction()
void enablePrevious(bool enable=true)
void subviewSwapped(FWGUISubviewArea *)
float getSummaryViewWeight() const
boost::function0< void > TaskFunctor
FWGUIManager(fireworks::Context *ctx, const FWViewManagerManager *iVMMgr, FWNavigatorBase *navigator)
void showEventFilterGUI()
static const std::string & idToName(int)
void subviewInfoUnselected(FWGUISubviewArea *)
void promptForSaveConfigurationFile()
const std::string sLoadConfig
void showSelectedModelContextMenu(Int_t iGlobalX, Int_t iGlobalY, FWViewContextMenuHandlerBase *iHandler)
const FWConfiguration * valueForKey(const std::string &iKey) const
const std::string sExportAllImages
sigc::signal< void, const std::string & > loadFromConfigurationFile_
sigc::signal< void, FWGUISubviewArea * > selected_
TGTextButton * m_filterShowGUIBtn
areaInfo(TGFrameElementPack *frameElement)
void titleChanged(const char *title)
const std::string sHelpGL
void promptForLoadConfigurationFile()
FWModelContextMenuHandler * m_contextMenuHandler
void setPlayDelayGUI(Float_t val, Bool_t sliderChanged)
CSGContinuousAction * playEventsAction() const
sigc::signal< void, edm::RunNumber_t, edm::LuminosityBlockNumber_t, edm::EventNumber_t > changedEventId_
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
static const std::string kControllers("controllers")
void show(FWDataCategories)
CmsShowHelpPopup * m_helpPopup
void openEveBrowserForDebugging() const
virtual void addTo(FWConfiguration &) const
CmsShowHelpPopup * m_shortcutPopup