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" 104 m_summaryManager(nullptr),
105 m_detailViewManager(nullptr),
106 m_viewManagerManager(iVMMgr),
107 m_contextMenuHandler(nullptr),
109 m_dataAdder(nullptr),
111 m_modelPopup(nullptr),
112 m_viewPopup(nullptr),
113 m_commonPopup(nullptr),
114 m_invMassDialog(nullptr),
115 m_helpPopup(nullptr),
116 m_shortcutPopup(nullptr),
117 m_helpGLPopup(nullptr),
132 TEveCompositeFrame::SetupFrameMarkup(foo, 20, 4,
false);
204 TQObject::Connect(gEve->GetWindowManager(),
205 "WindowSelected(TEveWindow*)",
208 "checkSubviewAreaIconState(TEveWindow*)");
209 TQObject::Connect(gEve->GetWindowManager(),
210 "WindowDocked(TEveWindow*)",
213 "checkSubviewAreaIconState(TEveWindow*)");
214 TQObject::Connect(gEve->GetWindowManager(),
215 "WindowUndocked(TEveWindow*)",
218 "checkSubviewAreaIconState(TEveWindow*)");
243 gEve->GetWindowManager()->Disconnect(
"WindowSelected(TEveWindow*)",
this,
"checkSubviewAreaIconState(TEveWindow*)");
244 gEve->GetWindowManager()->Disconnect(
"WindowDocked(TEveWindow*)",
this,
"checkSubviewAreaIconState(TEveWindow*)");
245 gEve->GetWindowManager()->Disconnect(
"WindowUndocked(TEveWindow*)",
this,
"checkSubviewAreaIconState(TEveWindow*)");
248 gEve->GetSelection()->Disconnect();
249 gEve->GetHighlight()->Disconnect();
250 gEve->GetSelection()->RemoveElements();
251 gEve->GetHighlight()->RemoveElements();
255 TEveCompositeFrameInMainFrame* mainFrame =
256 dynamic_cast<TEveCompositeFrameInMainFrame*
>((*wIt).first->GetEveFrame());
259 mainFrame->UnmapWindow();
261 (*wIt).second->destroy();
287 throw std::runtime_error(
std::string(
"Unable to create view named ") + iName +
" because it is unknown");
299 TEveCompositeFrame* ef = slot->GetEveFrame();
300 FWViewBase* viewBase = itFind->second(slot, iName);
306 TEveWindow* eveWindow = ef->GetEveWindow();
307 eveWindow->SetElementName(iName.c_str());
309 std::pair<ViewMap_i, bool> insertPair =
m_viewMap.insert(std::make_pair(eveWindow, viewBase));
310 return insertPair.first;
321 snprintf(
title, 127,
"cmsShow: %s", subtitle);
328 TEveViewerList* viewers = gEve->GetViewers();
329 for (TEveElement::List_i
i = viewers->BeginChildren();
i != viewers->EndChildren(); ++
i) {
330 TEveViewer*
ev =
dynamic_cast<TEveViewer*
>(*i);
332 ev->GetGLViewer()->DeleteOverlayAnnotations();
337 if (it->second == reg) {
373 #if defined(THIS_WILL_NEVER_BE_DEFINED) 374 m_selectionItemsComboBox->AddEntry(iItem->
name().c_str(), iItem->
id());
375 if (iItem->
id() == 0) {
376 m_selectionItemsComboBox->Select(0);
396 TEveWindow* swapCandidate =
nullptr;
398 if (gEve->GetWindowManager()->GetCurrentWindow()) {
399 swapCandidate = gEve->GetWindowManager()->GetCurrentWindow();
402 TEveCompositeFrame* pef;
403 TGFrameElementPack* pel;
407 if (
pp->GetList()->GetSize() > 2) {
408 pel = (TGFrameElementPack*)
pp->GetList()->At(1);
411 pef =
dynamic_cast<TEveCompositeFrame*
>(pel->fFrame);
412 if (pef && pef->GetEveWindow())
413 swapCandidate = pef->GetEveWindow();
416 if (swapCandidate ==
nullptr) {
419 TIter frame_iterator(sp->GetList());
420 while ((pel = (TGFrameElementPack*)frame_iterator())) {
421 pef =
dynamic_cast<TEveCompositeFrame*
>(pel->fFrame);
422 if (pef && pef->GetEveWindow() && pel->fState) {
423 swapCandidate = pef->GetEveWindow();
429 return swapCandidate;
444 if (checkInfoBtn && selected)
467 std::vector<FWGUISubviewArea*> sd;
473 for (std::vector<FWGUISubviewArea*>::iterator
i = sd.begin();
i != sd.end(); ++
i) {
474 if ((*i)->isSelected())
479 gSystem->ProcessEvents();
483 TEveWindow*
w =
dynamic_cast<TEveWindow*
>(
m_viewPrimPack->FirstChild());
485 w->DestroyWindowAndSlot();
490 gSystem->ProcessEvents();
497 if (wIt->first != ew)
509 swap->SwapWindow(curr);
515 TGVerticalFrame* listFrame =
new TGVerticalFrame(
p,
p->GetWidth(),
p->GetHeight());
517 TGHorizontalFrame* addFrame =
new TGHorizontalFrame(listFrame,
p->GetWidth(), 10, kRaisedFrame);
518 TGLabel* addLabel =
new TGLabel(addFrame,
"Summary View");
519 addFrame->AddFrame(addLabel,
new TGLayoutHints(kLHintsCenterX, 0, 0, 2, 2));
520 listFrame->AddFrame(addFrame,
new TGLayoutHints(kLHintsExpandX | kLHintsTop));
529 const unsigned int backgroundColor = 0x2f2f2f;
531 addDataButton->ChangeOptions(kRaisedFrame);
532 addDataButton->SetBackgroundColor(backgroundColor);
533 addDataButton->SetTextColor(0xFFFFFF);
534 addDataButton->SetToolTipText(
"Show additional collections");
535 addDataButton->Connect(
"Clicked()",
"FWGUIManager",
this,
"addData()");
536 m_summaryManager->
widget()->AddFrame(addDataButton,
new TGLayoutHints(kLHintsExpandX | kLHintsLeft | kLHintsTop));
553 m_ediFrame->CenterOnParent(kTRUE, TGTransientFrame::kTopRight);
575 if (
parse(
"theta()", grammar.use_parser<1>() >> end_p, space_p).full)
579 if (
parse(
"phi()", grammar.use_parser<1>() >> end_p, space_p).full)
580 phi = tmpPtr->value(
o);
586 it->first->UndockWindow();
588 std::cout <<
" FWModelFilter failed to base " <<
e.what() << std::endl;
604 m_modelPopup->CenterOnParent(kTRUE, TGTransientFrame::kRight);
649 m_helpPopup->CenterOnParent(kTRUE, TGTransientFrame::kBottomRight);
659 m_shortcutPopup->CenterOnParent(kTRUE, TGTransientFrame::kBottomRight);
669 m_helpGLPopup->CenterOnParent(kTRUE, TGTransientFrame::kBottomRight);
699 const static char* kFileTypes[] = {
"Fireworks Configuration files",
"*.fwc",
"All Files",
"*",
nullptr,
nullptr};
701 static TString
dir(
".");
704 fi.fFileTypes = kFileTypes;
705 fi.fIniDir = StrDup(
dir);
708 if (fi.fFilename ==
nullptr)
762 TGFrameElementPack* frameEL = (TGFrameElementPack*)
m_viewPrimPack->GetPack()->GetList()->At(1);
763 TEveCompositeFrame* ef =
dynamic_cast<TEveCompositeFrame*
>(frameEL->fFrame);
772 static TString
dir(
".");
773 const char* kImageExportTypes[] = {
"PNG",
781 "Encapsulated PostScript",
787 fi.fFileTypes = kImageExportTypes;
788 fi.fIniDir = StrDup(
dir);
791 if (fi.fFilename !=
nullptr) {
800 name.insert(
name.rfind(
'.'),
"-%u_%u_%u_%s");
803 }
catch (std::runtime_error&
e) {
816 typedef std::list<FWTEveViewer*> viewer_list_t;
817 typedef viewer_list_t::iterator viewer_list_i;
819 typedef std::map<TString, viewer_list_t> name_map_t;
820 typedef name_map_t::iterator name_map_i;
827 TString
name(
ev->GetElementName());
828 name.ReplaceAll(
" ",
"");
829 viewer_list_t&
l = vls[
name];
830 viewer_list_i li =
l.begin();
831 while (li !=
l.end() && (*li)->GetGLViewer()->ViewportDiagonal() <
ev->GetGLViewer()->ViewportDiagonal())
837 std::vector<std::future<int>> futures;
840 for (name_map_i
i = vls.begin();
i != vls.end(); ++
i) {
841 bool multi_p = (
i->second.size() > 1);
843 for (viewer_list_i
j =
i->second.begin();
j !=
i->second.end(); ++
j, ++view_count) {
844 TString view_name(
i->first);
847 view_name += view_count;
850 file.Form(
format.c_str(),
event->id().run(),
event->id().event(),
event->luminosityBlock(), view_name.Data());
852 if (GLEW_EXT_framebuffer_object) {
854 futures.push_back((*j)->CaptureAndSaveImage(
file, height));
858 (*j)->GetGLViewer()->SavePicture(
file);
860 (*j)->GetGLViewer()->SavePictureHeight(
file, height);
865 for (
auto&
f : futures) {
883 gVirtualX->TranslateCoordinates(iMain->GetId(),
884 gClient->GetDefaultRoot()->GetId(),
902 s << iMain->GetWidth();
907 s << iMain->GetHeight();
917 originalSlot =
nullptr;
918 undockedMainFrame =
nullptr;
919 weight = frameElement->fWeight;
920 undocked = !frameElement->fState;
922 TEveCompositeFrame* eveFrame =
dynamic_cast<TEveCompositeFrame*
>(frameElement->fFrame);
925 if (frameElement->fState)
926 eveWindow = eveFrame->GetEveWindow();
928 originalSlot = eveFrame->GetEveWindow();
961 Int_t cfgVersion = 3;
964 float leftWeight, rightWeight;
969 std::stringstream
ss;
976 TGFrameElementPack* frameEL;
977 frameEL = (TGFrameElementPack*)
m_viewPrimPack->GetPack()->GetList()->At(
979 leftWeight = frameEL->fWeight;
980 frameEL = (TGFrameElementPack*)
m_viewPrimPack->GetPack()->GetList()->At(3);
981 rightWeight = frameEL->fWeight;
986 std::stringstream sL;
989 std::stringstream sR;
997 std::vector<areaInfo> wpacked;
998 if (leftWeight > 0) {
1000 TGFrameElementPack* frameEL = (TGFrameElementPack*)
pp->GetList()->At(1);
1001 if (frameEL->fWeight > 0)
1002 wpacked.push_back(
areaInfo(frameEL));
1005 TGFrameElementPack* seFE;
1006 TIter frame_iterator(sp->GetList());
1007 while ((seFE = (TGFrameElementPack*)frame_iterator())) {
1015 TEveWindow* ew = wIt->first;
1016 TEveCompositeFrameInMainFrame* mainFrame =
dynamic_cast<TEveCompositeFrameInMainFrame*
>(ew->GetEveFrame());
1018 for (std::vector<areaInfo>::iterator pIt = wpacked.begin(); pIt != wpacked.end(); ++pIt) {
1019 if ((*pIt).originalSlot && mainFrame->GetOriginalSlot() == (*pIt).originalSlot) {
1020 (*pIt).eveWindow = wIt->first;
1021 (*pIt).undockedMainFrame = (TGMainFrame*)mainFrame;
1033 for (std::vector<areaInfo>::iterator it = wpacked.begin(); it != wpacked.end(); ++it) {
1034 TEveWindow* ew = (*it).eveWindow;
1038 wb->
addTo(tempWiew);
1084 iFrame->MoveResize(
x,
y,
width, height);
1085 iFrame->SetWMPosition(
x,
y);
1089 gEve->DisableRedraw();
1100 float_t leftWeight = 1;
1101 float_t rightWeight = 1;
1108 float summaryWeight = atof(mw->
valueForKey(
"summaryWeight")->
value().c_str());
1112 TEveWindowSlot* primSlot = (leftWeight > 0) ?
m_viewPrimPack->NewSlotWithWeight(leftWeight) :
nullptr;
1119 assert(
nullptr != views);
1124 if (viewArea->
version() > 1) {
1129 float weight = atof((areaIt->second).valueForKey(
"weight")->value().c_str());
1130 TEveWindowSlot* slot =
1134 lastViewIt->second->setFrom(it->second);
1136 bool undocked = atof((areaIt->second).valueForKey(
"undocked")->value().c_str());
1138 TEveWindow* lastWindow = lastViewIt->first;
1139 lastWindow->UndockWindow();
1140 TEveCompositeFrameInMainFrame*
emf =
dynamic_cast<TEveCompositeFrameInMainFrame*
>(lastWindow->GetEveFrame());
1142 const TGMainFrame* mf =
dynamic_cast<const TGMainFrame*
>(
emf->GetParent());
1145 TGMainFrame* mfp = (TGMainFrame*)mf;
1146 const FWConfiguration* mwc = (areaIt->second).valueForKey(
"UndockedWindowPos");
1160 lastViewIt->second->setFrom(it->second);
1164 if (
nullptr != undocked) {
1165 fwLog(
fwlog::kWarning) <<
"Restrore of undocked windows with old window management not supported." << std::endl;
1171 if (
nullptr != controllers) {
1173 if (
nullptr != keyVals) {
1202 gEve->EnableRedraw();
1219 Float_t
sec =
val * 0.001;
1262 gEve->FullRedraw3D();
1284 const Int_t
x = 100,
y = 100;
1286 TGMainFrame* mf1 =
new TGMainFrame(
nullptr, 0, 0);
1292 TGMainFrame* mf2 =
new TGMainFrame(
nullptr, 0, 0);
1294 while (!mf2->IsMapped())
1295 gClient->HandleInput();
1301 WindowAttributes_t attr;
1302 gVirtualX->TranslateCoordinates(mf1->GetId(), gClient->GetDefaultRoot()->GetId(), 0, 0, xm, ym, childdum);
1303 gVirtualX->GetWindowAttributes(mf1->GetId(), attr);
1308 "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::string sSavePartialConfig
TEveWindow * getEveWindow()
TGMainFrame * undockedMainFrame
void promptForPartialSaveConfigurationFile()
FWSelectionManager * selectionManager() const
FWNumberEntryField * m_lumiEntry
void setFrom(const FWConfiguration &) override
ViewMap_t::iterator ViewMap_i
virtual FWViewContextMenuHandlerBase * contextMenuHandler() const
const std::string sShowCommonInsp
vector< string > parse(string line, const string &delimiter)
virtual ULong64_t GetULong64Number()
virtual void SetUIntNumber(UInt_t n)
void openEveBrowserForDebugging() const
sigc::signal< void()> writeToPresentConfigurationFile_
NameToViewBuilder m_nameToViewBuilder
sigc::signal< void()> colorsHaveChangedFinished_
const std::string sSavePartialConfigAs
void loadEvent(const edm::EventBase &event)
CmsShowCommon * commonPrefs() const
void subviewIsBeingDestroyed(FWGUISubviewArea *)
FWSummaryManager * m_summaryManager
void subviewInfoSelected(FWGUISubviewArea *)
boost::spirit::classic::parser_error< reco::parser::SyntaxErrors > BaseException
void setFilterButtonIcon(int)
sigc::signal< void(FWEventItem *)> newItem_
sigc::signal< void(Int_t)> valueChanged_
const FWEventItemsManager * eventItemsManager() const
sigc::signal< void(const std::string &)> loadFromConfigurationFile_
void createViews(TEveWindowSlot *slot)
sigc::signal< void(const std::string &)> loadPartialFromConfigurationFile_
FWInvMassDialog * m_invMassDialog
void setViewPopup(TEveWindow *)
RunNumber_t const invalidRunNumber
static void addAreaInfoTo(areaInfo &pInfo, FWConfiguration &oTo)
const std::string sBackgroundColor
static const std::string kViewController("view")
std::shared_ptr< ExpressionBase > ExpressionPtr
std::function< void()> TaskFunctor
static void addWindowInfoTo(const TGFrame *iMain, FWConfiguration &oTo)
void newViewSlot(const std::string &iName)
void populate3DViewsFromConfig()
sigc::signal< void(edm::RunNumber_t, edm::LuminosityBlockNumber_t, edm::EventNumber_t)> changedEventId_
static FWGUIManager * m_guiManager
FWCustomIconsButton * m_filterEnableBtn
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.
FWJobMetadataManager * metadataManager() const
static const std::string kCommonController("common")
const std::string sSaveConfigAs
void swap(Association< C > &lhs, Association< C > &rhs)
sigc::signal< void(Int_t, Int_t)> openSelectedModelContextMenu_
void setInfoButton(bool downp)
void enableActions(bool enable=true)
void showSelectedModelContext(Int_t iX, Int_t iY, FWViewContextMenuHandlerBase *) const
NOTE: iX and iY are in global coordinates.
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)
bool getHidePFBuilders() const
CSGContinuousAction * playEventsBackwardsAction() const
CSGContinuousAction * loopAction() const
void checkSubviewAreaIconState(TEveWindow *)
void connectSubviewAreaSignals(FWGUISubviewArea *)
void createShortcutPopup()
const std::string sSaveConfig
const std::string & value(unsigned int iIndex=0) const
static const std::string kCollectionController("collection")
CmsShowViewPopup * m_viewPopup
EventNumber_t const invalidEventNumber
const TGPicture * m_filterIcons[9]
const edm::EventBase * getCurrentEvent() const
TEveWindow * getSwapCandidate()
static const std::string kMainWindow("main window")
virtual void SetULong64Number(ULong64_t n)
static TGFrame * makeGUIsubview(TEveCompositeFrame *cp, TGCompositeFrame *parent, Int_t height)
FWNavigatorBase * m_navigator
static const std::string kUndocked("undocked views")
sigc::signal< void(Float_t)> changedDelayBetweenEvents_
void setDelayBetweenEvents(Float_t)
CSGAction * createNewViewerAction(const std::string &iActionName, bool seaprator)
void exportImagesOfAllViews()
TEveWindow * originalSlot
void subviewDestroy(FWGUISubviewArea *)
FWNumberEntryField * m_eventEntry
CmsShowMainFrame * m_cmsShowMainFrame
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()
void addTo(FWConfiguration &) const override
const std::string sExportImage
CmsShowModelPopup * m_modelPopup
static const std::string kViewArea("view area")
CmsShowCommonPopup * m_commonPopup
virtual const edm::EventBase * getCurrentEvent() const =0
std::function< FWViewBase *(TEveWindowSlot *, const std::string &)> ViewBuildFunctor
static const std::string & checkNameWithViewVersion(const std::string &name, unsigned int viewVersion)
std::vector< std::pair< std::string, FWConfiguration > > KeyValues
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()
FWModelChangeManager * modelChangeManager() const
CSGAction * getAction(const std::string &name)
TString getName(TString structure, int layer, TString geometry)
sigc::signal< void(const std::string &)> writeToConfigurationFile_
void enableActions(bool enable=true) override
const std::string sShowObjInsp
CSGAction * getAction(const std::string name)
void updateEventFilterEnable(bool)
static FWGUIManager * getGUIManager()
float getSummaryViewWeight() const
CSGContinuousAction * loopAction()
fireworks::Context * m_context
const std::string & name() const
bool promptForConfigurationFile(std::string &result, enum EFileDialogMode mode)
CSGContinuousAction * playEventsBackwardsAction()
void finishUpColorChange()
sigc::signal< void(const std::string &)> writePartialToConfigurationFile_
unsigned int version() const
void exportAllViews(const std::string &format, int height)
void setFilterButtonText(const char *txt)
const std::string sShowInvMassDialog
std::unique_ptr< CmsShowTaskExecutor > m_tasks
KeyValues::const_iterator KeyValuesIt
void setSummaryViewWeight(float)
const std::string sShowEventDisplayInsp
const FWConfiguration * valueForKey(const std::string &iKey) const
CSGContinuousAction * playEventsAction()
void enablePrevious(bool enable=true)
void subviewSwapped(FWGUISubviewArea *)
FWGUIManager(fireworks::Context *ctx, const FWViewManagerManager *iVMMgr, FWNavigatorBase *navigator)
void showEventFilterGUI()
static const std::string & idToName(int)
CSGContinuousAction * playEventsAction() const
void promptForPartialLoadConfigurationFile()
void subviewInfoUnselected(FWGUISubviewArea *)
void promptForSaveConfigurationFile()
const std::string sLoadConfig
sigc::signal< void()> activated
void showSelectedModelContextMenu(Int_t iGlobalX, Int_t iGlobalY, FWViewContextMenuHandlerBase *iHandler)
void bindCSGActionKeys(const TGMainFrame *f) const
const std::string sExportAllImages
const std::set< FWModelId > & selected() const
void setView(CmsShowCommonPopup *x)
sigc::signal< void()> filterButtonClicked_
sigc::signal< void(const TGWindow *)> showEventFilterGUI_
TGTextButton * m_filterShowGUIBtn
areaInfo(TGFrameElementPack *frameElement)
void titleChanged(const char *title)
const KeyValues * keyValues() const
const std::string sHelpGL
void promptForLoadConfigurationFile()
void addTo(FWConfiguration &) const override
FWModelContextMenuHandler * m_contextMenuHandler
void setPlayDelayGUI(Float_t val, Bool_t sliderChanged)
const std::string sLoadPartialConfig
Geom::Theta< T > theta() const
static const std::string kControllers("controllers")
const std::string & typeName() const
FWColorManager * colorManager() const
TGCompositeFrame * widget() const
void show(FWDataCategories)
unsigned int version() const
CmsShowHelpPopup * m_helpPopup
CmsShowHelpPopup * m_shortcutPopup