12 #include <boost/bind.hpp> 23 #include "TGLIncludes.h" 24 #include "TGLViewer.h" 25 #include "TEveBrowser.h" 26 #include "TEveManager.h" 28 #include "TEveWindow.h" 29 #include "TEveViewer.h" 30 #include "TEveWindowManager.h" 31 #include "TEveSelection.h" 32 #include "TVirtualX.h" 111 m_viewManagerManager(iVMMgr),
113 m_navigator(navigator),
124 m_WMOffsetX(0), m_WMOffsetY(0), m_WMDecorH(0)
137 TEveCompositeFrame::SetupFrameMarkup(foo, 20, 4,
false);
201 TQObject::Connect(gEve->GetWindowManager(),
"WindowSelected(TEveWindow*)",
"FWGUIManager",
this,
"checkSubviewAreaIconState(TEveWindow*)");
202 TQObject::Connect(gEve->GetWindowManager(),
"WindowDocked(TEveWindow*)" ,
"FWGUIManager",
this,
"checkSubviewAreaIconState(TEveWindow*)");
203 TQObject::Connect(gEve->GetWindowManager(),
"WindowUndocked(TEveWindow*)",
"FWGUIManager",
this,
"checkSubviewAreaIconState(TEveWindow*)");
233 gEve->GetWindowManager()->Disconnect(
"WindowSelected(TEveWindow*)",
this,
"checkSubviewAreaIconState(TEveWindow*)");
234 gEve->GetWindowManager()->Disconnect(
"WindowDocked(TEveWindow*)",
this,
"checkSubviewAreaIconState(TEveWindow*)");
235 gEve->GetWindowManager()->Disconnect(
"WindowUndocked(TEveWindow*)",
this,
"checkSubviewAreaIconState(TEveWindow*)");
238 gEve->GetSelection()->Disconnect();
239 gEve->GetHighlight()->Disconnect();
240 gEve->GetSelection()->RemoveElements();
241 gEve->GetHighlight()->RemoveElements();
246 TEveCompositeFrameInMainFrame* mainFrame =
dynamic_cast<TEveCompositeFrameInMainFrame*
>((*wIt).first->GetEveFrame());
248 if (mainFrame) mainFrame->UnmapWindow();
250 (*wIt).second->destroy();
286 throw std::runtime_error(
std::string(
"Unable to create view named ")+iName+
" because it is unknown");
302 TEveCompositeFrame *ef = slot->GetEveFrame();
303 FWViewBase* viewBase = itFind->second(slot, iName);
308 TEveWindow *eveWindow = ef->GetEveWindow();
309 eveWindow->SetElementName(iName.c_str());
311 std::pair<ViewMap_i,bool> insertPair =
m_viewMap.insert(std::make_pair(eveWindow, viewBase));
312 return insertPair.first;
330 snprintf(title,127,
"cmsShow: %s", subtitle);
338 TEveViewerList* viewers = gEve->GetViewers();
339 for (TEveElement::List_i
i=viewers->BeginChildren();
i!= viewers->EndChildren(); ++
i)
341 TEveViewer*
ev =
dynamic_cast<TEveViewer*
>(*i);
343 ev->GetGLViewer()->DeleteOverlayAnnotations();
350 if (it->second == reg) {
419 #if defined(THIS_WILL_NEVER_BE_DEFINED) 420 m_selectionItemsComboBox->AddEntry(iItem->
name().c_str(),iItem->
id());
422 m_selectionItemsComboBox->Select(0);
446 TEveWindow* swapCandidate =
nullptr;
448 if ( gEve->GetWindowManager()->GetCurrentWindow())
450 swapCandidate = gEve->GetWindowManager()->GetCurrentWindow();
455 TEveCompositeFrame* pef;
456 TGFrameElementPack *pel;
460 if ( pp->GetList()->GetSize() > 2)
462 pel = (TGFrameElementPack*) pp->GetList()->At(1);
465 pef =
dynamic_cast<TEveCompositeFrame*
>(pel->fFrame);
466 if ( pef && pef->GetEveWindow())
467 swapCandidate = pef->GetEveWindow();
470 if (swapCandidate ==
nullptr)
474 TIter frame_iterator(sp->GetList());
475 while ((pel = (TGFrameElementPack*)frame_iterator()))
477 pef =
dynamic_cast<TEveCompositeFrame*
>(pel->fFrame);
478 if ( pef && pef->GetEveWindow() && pel->fState)
480 swapCandidate = pef->GetEveWindow() ;
486 return swapCandidate;
504 if (checkInfoBtn && selected)
533 std::vector<FWGUISubviewArea*>
sd;
540 for (std::vector<FWGUISubviewArea*>::iterator
i= sd.begin();
i !=sd.end(); ++
i)
542 if ((*i)->isSelected())
547 gSystem->ProcessEvents();
554 TEveWindow*
w =
dynamic_cast<TEveWindow*
>(
m_viewPrimPack->FirstChild());
555 if (w) w->DestroyWindowAndSlot();
560 gSystem->ProcessEvents();
571 if (wIt->first != ew)
588 if (curr) swap->SwapWindow(curr);
596 TGVerticalFrame *listFrame =
new TGVerticalFrame(p, p->GetWidth(), p->GetHeight());
598 TGHorizontalFrame* addFrame =
new TGHorizontalFrame(listFrame, p->GetWidth(), 10, kRaisedFrame);
599 TGLabel* addLabel =
new TGLabel(addFrame,
"Summary View");
600 addFrame->AddFrame(addLabel,
new TGLayoutHints(kLHintsCenterX, 0,0,2,2));
601 listFrame->AddFrame(addFrame,
new TGLayoutHints(kLHintsExpandX | kLHintsTop));
610 const unsigned int backgroundColor=0x2f2f2f;
612 addDataButton->ChangeOptions(kRaisedFrame);
613 addDataButton->SetBackgroundColor(backgroundColor);
614 addDataButton->SetTextColor(0xFFFFFF);
615 addDataButton->SetToolTipText(
"Show additional collections");
616 addDataButton->Connect(
"Clicked()",
"FWGUIManager",
this,
"addData()");
617 m_summaryManager->
widget()->AddFrame(addDataButton,
new TGLayoutHints(kLHintsExpandX|kLHintsLeft|kLHintsTop));
639 m_ediFrame->CenterOnParent(kTRUE,TGTransientFrame::kTopRight);
667 if (
parse(
"theta()", grammar.use_parser<1>() >> end_p, space_p).full)
668 theta = tmpPtr->value(o);
671 if (
parse(
"phi()", grammar.use_parser<1>() >> end_p, space_p).full)
672 phi = tmpPtr->value(o);
678 it->first->UndockWindow();
682 std::cout <<
" FWModelFilter failed to base "<< e.what() << std::endl;
702 m_modelPopup->CenterOnParent(kTRUE,TGTransientFrame::kRight);
766 m_helpPopup->CenterOnParent(kTRUE,TGTransientFrame::kBottomRight);
794 m_helpGLPopup->CenterOnParent(kTRUE,TGTransientFrame::kBottomRight);
836 const static char* kFileTypes[] = {
"Fireworks Configuration files",
"*.fwc",
840 static TString
dir(
".");
843 fi.fFileTypes = kFileTypes;
844 fi.fIniDir = StrDup(dir);
847 if (fi.fFilename ==
nullptr)
852 if (!ext.empty() && name.find(ext) == name.npos)
921 TGFrameElementPack* frameEL = (TGFrameElementPack*)
m_viewPrimPack->GetPack()->GetList()->At(1);
922 TEveCompositeFrame* ef =
dynamic_cast<TEveCompositeFrame*
>(frameEL->fFrame);
935 static TString
dir(
".");
936 const char * kImageExportTypes[] = {
"PNG",
"*.png",
940 "Encapsulated PostScript",
"*.eps",
944 fi.fFileTypes = kImageExportTypes;
945 fi.fIniDir = StrDup(dir);
949 if (fi.fFilename !=
nullptr) {
955 if (name.find(ext) == name.npos)
958 name.insert(name.rfind(
'.'),
"-%u_%u_%u_%s");
962 catch (std::runtime_error &
e) {
std::cout << e.what() << std::endl; }
975 typedef std::list<FWTEveViewer*> viewer_list_t;
976 typedef viewer_list_t::iterator viewer_list_i;
978 typedef std::map<TString, viewer_list_t> name_map_t;
979 typedef name_map_t::iterator name_map_i;
988 TString
name(ev->GetElementName());
989 name.ReplaceAll(
" ",
"");
990 viewer_list_t &
l = vls[
name];
991 viewer_list_i li = l.begin();
992 while (li != l.end() && (*li)->GetGLViewer()->ViewportDiagonal() < ev->GetGLViewer()->ViewportDiagonal())
998 std::vector<std::future<int>> futures;
1001 for (name_map_i
i = vls.begin();
i != vls.end(); ++
i)
1003 bool multi_p = (
i->second.size() > 1);
1005 for (viewer_list_i j =
i->second.begin(); j !=
i->second.end(); ++j, ++view_count)
1007 TString view_name(
i->first);
1011 view_name += view_count;
1014 file.Form(format.c_str(),
event->id().run(),
event->id().event(),
1015 event->luminosityBlock(), view_name.Data());
1017 if (GLEW_EXT_framebuffer_object)
1020 futures.push_back((*j)->CaptureAndSaveImage(file, height));
1026 (*j)->GetGLViewer()->SavePicture(file);
1028 (*j)->GetGLViewer()->SavePictureHeight(file, height);
1033 for (
auto &
f : futures)
1056 gVirtualX->TranslateCoordinates(iMain->GetId(),
1057 gClient->GetDefaultRoot()->GetId(),
1062 std::stringstream
s;
1067 std::stringstream
s;
1072 std::stringstream
s;
1073 s<<iMain->GetWidth();
1077 std::stringstream
s;
1078 s<<iMain->GetHeight();
1089 eveWindow =
nullptr;
1090 originalSlot =
nullptr;
1091 undockedMainFrame =
nullptr;
1092 weight = frameElement->fWeight;
1093 undocked = !frameElement->fState;
1095 TEveCompositeFrame *eveFrame =
dynamic_cast<TEveCompositeFrame*
>(frameElement->fFrame);
1098 if (frameElement->fState)
1099 eveWindow = eveFrame->GetEveWindow();
1101 originalSlot = eveFrame->GetEveWindow();
1119 std::stringstream
s;
1124 std::stringstream
s;
1144 float leftWeight, rightWeight;
1149 std::stringstream ss;
1157 TGFrameElementPack *frameEL;
1158 frameEL = (TGFrameElementPack*)
m_viewPrimPack->GetPack()->GetList()->At(1);
1159 leftWeight = frameEL->fWeight;
1160 frameEL = (TGFrameElementPack*)
m_viewPrimPack->GetPack()->GetList()->At(3);
1161 rightWeight = frameEL->fWeight;
1168 std::stringstream sL;
1171 std::stringstream sR;
1179 std::vector<areaInfo> wpacked;
1183 TGFrameElementPack *frameEL = (TGFrameElementPack*) pp->GetList()->At(1);
1184 if (frameEL->fWeight > 0)
1185 wpacked.push_back(
areaInfo(frameEL));
1188 TGFrameElementPack *seFE;
1189 TIter frame_iterator(sp->GetList());
1190 while ((seFE = (TGFrameElementPack*)frame_iterator() ))
1200 TEveWindow* ew = wIt->first;
1201 TEveCompositeFrameInMainFrame* mainFrame =
dynamic_cast<TEveCompositeFrameInMainFrame*
>(ew->GetEveFrame());
1204 for(std::vector<areaInfo>::iterator pIt = wpacked.begin(); pIt != wpacked.end(); ++pIt)
1206 if ((*pIt).originalSlot && mainFrame->GetOriginalSlot() == (*pIt).originalSlot)
1208 (*pIt).eveWindow = wIt->first;
1209 (*pIt).undockedMainFrame = (TGMainFrame*)mainFrame;
1221 for(std::vector<areaInfo>::iterator it = wpacked.begin(); it != wpacked.end(); ++it)
1223 TEveWindow* ew = (*it).eveWindow;
1227 wb->
addTo(tempWiew);
1268 TGMainFrame* iFrame)
1275 iFrame->MoveResize(x,y,width,height);
1276 iFrame->SetWMPosition(x, y);
1281 gEve->DisableRedraw();
1286 assert(mw !=
nullptr);
1291 float_t leftWeight =1;
1292 float_t rightWeight=1;
1299 float summaryWeight = atof(mw->
valueForKey(
"summaryWeight")->
value().c_str());
1303 TEveWindowSlot* primSlot = (leftWeight > 0) ?
m_viewPrimPack->NewSlotWithWeight(leftWeight) :
nullptr;
1321 float weight = atof((areaIt->second).valueForKey(
"weight")->value().c_str());
1322 TEveWindowSlot* slot = ( !
m_viewMap.empty() || (primSlot ==
nullptr) ) ?
m_viewSecPack->NewSlotWithWeight(weight) : primSlot;
1325 lastViewIt->second->setFrom(it->second);
1327 bool undocked = atof((areaIt->second).valueForKey(
"undocked")->value().c_str());
1330 TEveWindow* lastWindow = lastViewIt->first;
1331 lastWindow->UndockWindow();
1332 TEveCompositeFrameInMainFrame*
emf =
dynamic_cast<TEveCompositeFrameInMainFrame*
>(lastWindow->GetEveFrame());
1334 const TGMainFrame* mf =
dynamic_cast<const TGMainFrame*
>(emf->GetParent());
1337 TGMainFrame* mfp = (TGMainFrame*)mf;
1338 const FWConfiguration* mwc = (areaIt->second).valueForKey(
"UndockedWindowPos");
1353 lastViewIt->second->setFrom(it->second);
1357 if(
nullptr!=undocked) {
1358 fwLog(
fwlog::kWarning) <<
"Restrore of undocked windows with old window management not supported." << std::endl;
1364 if (
nullptr != controllers)
1367 if (
nullptr != keyVals)
1401 gEve->EnableRedraw();
1416 gEve->GetBrowser()->MapWindow();
1425 Float_t sec = val*0.001;
1477 gEve->FullRedraw3D();
1517 const Int_t
x = 100,
y = 100;
1519 TGMainFrame *mf1 =
new TGMainFrame(
nullptr, 0, 0);
1525 TGMainFrame *mf2 =
new TGMainFrame(
nullptr, 0, 0);
1527 while (!mf2->IsMapped()) gClient->HandleInput();
1533 WindowAttributes_t attr;
1534 gVirtualX->TranslateCoordinates(mf1->GetId(), gClient->GetDefaultRoot()->GetId(),
1535 0, 0, xm, ym, childdum);
1536 gVirtualX->GetWindowAttributes(mf1->GetId(), attr);
1540 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
const std::string sSavePartialConfig
TEveWindow * getEveWindow()
TGMainFrame * undockedMainFrame
void promptForPartialSaveConfigurationFile()
std::vector< std::pair< std::string, FWConfiguration > > KeyValues
FWNumberEntryField * m_lumiEntry
sigc::signal< void > writeToPresentConfigurationFile_
TGCompositeFrame * widget() const
void setFrom(const FWConfiguration &) override
void addTo(FWConfiguration &) const override
void bindCSGActionKeys(const TGMainFrame *f) const
ViewMap_t::iterator ViewMap_i
const std::string sShowCommonInsp
sigc::signal< void > filterButtonClicked_
virtual ULong64_t GetULong64Number()
virtual void SetUIntNumber(UInt_t n)
sigc::signal< void, FWGUISubviewArea * > unselected_
const KeyValues * keyValues() const
sigc::signal< void, const std::string & > writePartialToConfigurationFile_
NameToViewBuilder m_nameToViewBuilder
const std::string sSavePartialConfigAs
void addTo(FWConfiguration &) const override
void loadEvent(const edm::EventBase &event)
const FWEventItemsManager * eventItemsManager() const
CSGContinuousAction * playEventsBackwardsAction() const
void subviewIsBeingDestroyed(FWGUISubviewArea *)
FWSummaryManager * m_summaryManager
void subviewInfoSelected(FWGUISubviewArea *)
boost::spirit::classic::parser_error< reco::parser::SyntaxErrors > BaseException
sigc::signal< void, const std::string & > loadPartialFromConfigurationFile_
void setFilterButtonIcon(int)
void createViews(TEveWindowSlot *slot)
FWInvMassDialog * m_invMassDialog
void setClip(float eta, float phi)
void setViewPopup(TEveWindow *)
RunNumber_t const invalidRunNumber
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)
Geom::Theta< T > theta() const
const std::string & typeName() const
void newViewSlot(const std::string &iName)
void populate3DViewsFromConfig()
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")
boost::shared_ptr< ExpressionBase > ExpressionPtr
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
void swap(Association< C > &lhs, Association< C > &rhs)
unsigned int version() const
void setInfoButton(bool downp)
void enableActions(bool enable=true)
TEveWindowPack * m_viewSecPack
void setWindowInfoFrom(const FWConfiguration &iFrom, TGMainFrame *iFrame)
ViewMap_i createView(const std::string &iName, TEveWindowSlot *slot=nullptr)
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
EventNumber_t const invalidEventNumber
const TGPicture * m_filterIcons[9]
sigc::signal< void, Float_t > changedDelayBetweenEvents_
TEveWindow * getSwapCandidate()
static const std::string kMainWindow("main window")
virtual void SetULong64Number(ULong64_t n)
sigc::signal< void > colorsHaveChangedFinished_
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()
bool getHidePFBuilders() const
const std::string sShowAddCollection
FWGUIEventDataAdder * m_dataAdder
void exportImageOfMainView()
virtual FWViewContextMenuHandlerBase * contextMenuHandler() const
const std::string sExportImage
base
Make Sure CMSSW is Setup ##.
FWSelectionManager * selectionManager() const
CmsShowModelPopup * m_modelPopup
static const std::string kViewArea("view area")
CmsShowCommonPopup * m_commonPopup
static const std::string & checkNameWithViewVersion(const std::string &name, unsigned int viewVersion)
FWModelChangeManager * modelChangeManager() const
CmsShowHelpPopup * m_helpGLPopup
std::vector< FWViewBase * > m_regionViews
LuminosityBlockNumber_t const invalidLuminosityBlockNumber
const std::string sShowMainViewCtl
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
void eventChangedCallback()
FWNumberEntryField * m_runEntry
void savePartialToConfigurationFile()
const std::string & value(unsigned int iIndex=0) const
CSGAction * getAction(const std::string &name)
const edm::EventBase * getCurrentEvent() const
TString getName(TString structure, int layer, TString geometry)
void showSelectedModelContext(Int_t iX, Int_t iY, FWViewContextMenuHandlerBase *) const
NOTE: iX and iY are in global coordinates.
void enableActions(bool enable=true) override
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()
void exportAllViews(const std::string &format, int height)
sigc::signal< void, FWGUISubviewArea * > swap_
void setFilterButtonText(const char *txt)
const std::string sShowInvMassDialog
std::unique_ptr< CmsShowTaskExecutor > m_tasks
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 *)
virtual const edm::EventBase * getCurrentEvent() const =0
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 promptForPartialLoadConfigurationFile()
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
void setView(CmsShowCommonPopup *x)
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)
const std::string sLoadPartialConfig
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
CmsShowHelpPopup * m_shortcutPopup