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" 106 m_viewManagerManager(iVMMgr),
108 m_navigator(navigator),
132 TEveCompositeFrame::SetupFrameMarkup(foo, 20, 4,
false);
203 TQObject::Connect(gEve->GetWindowManager(),
204 "WindowSelected(TEveWindow*)",
207 "checkSubviewAreaIconState(TEveWindow*)");
208 TQObject::Connect(gEve->GetWindowManager(),
209 "WindowDocked(TEveWindow*)",
212 "checkSubviewAreaIconState(TEveWindow*)");
213 TQObject::Connect(gEve->GetWindowManager(),
214 "WindowUndocked(TEveWindow*)",
217 "checkSubviewAreaIconState(TEveWindow*)");
242 gEve->GetWindowManager()->Disconnect(
"WindowSelected(TEveWindow*)",
this,
"checkSubviewAreaIconState(TEveWindow*)");
243 gEve->GetWindowManager()->Disconnect(
"WindowDocked(TEveWindow*)",
this,
"checkSubviewAreaIconState(TEveWindow*)");
244 gEve->GetWindowManager()->Disconnect(
"WindowUndocked(TEveWindow*)",
this,
"checkSubviewAreaIconState(TEveWindow*)");
247 gEve->GetSelection()->Disconnect();
248 gEve->GetHighlight()->Disconnect();
249 gEve->GetSelection()->RemoveElements();
250 gEve->GetHighlight()->RemoveElements();
254 TEveCompositeFrameInMainFrame* mainFrame =
255 dynamic_cast<TEveCompositeFrameInMainFrame*
>((*wIt).first->GetEveFrame());
258 mainFrame->UnmapWindow();
260 (*wIt).second->destroy();
286 throw std::runtime_error(
std::string(
"Unable to create view named ") + iName +
" because it is unknown");
298 TEveCompositeFrame* ef = slot->GetEveFrame();
299 FWViewBase* viewBase = itFind->second(slot, iName);
305 TEveWindow* eveWindow = ef->GetEveWindow();
306 eveWindow->SetElementName(iName.c_str());
308 std::pair<ViewMap_i, bool> insertPair =
m_viewMap.insert(std::make_pair(eveWindow, viewBase));
309 return insertPair.first;
320 snprintf(title, 127,
"cmsShow: %s", subtitle);
327 TEveViewerList* viewers = gEve->GetViewers();
328 for (TEveElement::List_i
i = viewers->BeginChildren();
i != viewers->EndChildren(); ++
i) {
329 TEveViewer*
ev =
dynamic_cast<TEveViewer*
>(*i);
331 ev->GetGLViewer()->DeleteOverlayAnnotations();
336 if (it->second == reg) {
372 #if defined(THIS_WILL_NEVER_BE_DEFINED) 373 m_selectionItemsComboBox->AddEntry(iItem->
name().c_str(), iItem->
id());
374 if (iItem->
id() == 0) {
375 m_selectionItemsComboBox->Select(0);
395 TEveWindow* swapCandidate =
nullptr;
397 if (gEve->GetWindowManager()->GetCurrentWindow()) {
398 swapCandidate = gEve->GetWindowManager()->GetCurrentWindow();
401 TEveCompositeFrame* pef;
402 TGFrameElementPack* pel;
406 if (pp->GetList()->GetSize() > 2) {
407 pel = (TGFrameElementPack*)pp->GetList()->At(1);
410 pef =
dynamic_cast<TEveCompositeFrame*
>(pel->fFrame);
411 if (pef && pef->GetEveWindow())
412 swapCandidate = pef->GetEveWindow();
415 if (swapCandidate ==
nullptr) {
418 TIter frame_iterator(sp->GetList());
419 while ((pel = (TGFrameElementPack*)frame_iterator())) {
420 pef =
dynamic_cast<TEveCompositeFrame*
>(pel->fFrame);
421 if (pef && pef->GetEveWindow() && pel->fState) {
422 swapCandidate = pef->GetEveWindow();
428 return swapCandidate;
443 if (checkInfoBtn && selected)
466 std::vector<FWGUISubviewArea*>
sd;
472 for (std::vector<FWGUISubviewArea*>::iterator
i = sd.begin();
i != sd.end(); ++
i) {
473 if ((*i)->isSelected())
478 gSystem->ProcessEvents();
482 TEveWindow*
w =
dynamic_cast<TEveWindow*
>(
m_viewPrimPack->FirstChild());
484 w->DestroyWindowAndSlot();
489 gSystem->ProcessEvents();
496 if (wIt->first != ew)
508 swap->SwapWindow(curr);
514 TGVerticalFrame* listFrame =
new TGVerticalFrame(p, p->GetWidth(), p->GetHeight());
516 TGHorizontalFrame* addFrame =
new TGHorizontalFrame(listFrame, p->GetWidth(), 10, kRaisedFrame);
517 TGLabel* addLabel =
new TGLabel(addFrame,
"Summary View");
518 addFrame->AddFrame(addLabel,
new TGLayoutHints(kLHintsCenterX, 0, 0, 2, 2));
519 listFrame->AddFrame(addFrame,
new TGLayoutHints(kLHintsExpandX | kLHintsTop));
528 const unsigned int backgroundColor = 0x2f2f2f;
530 addDataButton->ChangeOptions(kRaisedFrame);
531 addDataButton->SetBackgroundColor(backgroundColor);
532 addDataButton->SetTextColor(0xFFFFFF);
533 addDataButton->SetToolTipText(
"Show additional collections");
534 addDataButton->Connect(
"Clicked()",
"FWGUIManager",
this,
"addData()");
535 m_summaryManager->
widget()->AddFrame(addDataButton,
new TGLayoutHints(kLHintsExpandX | kLHintsLeft | kLHintsTop));
552 m_ediFrame->CenterOnParent(kTRUE, TGTransientFrame::kTopRight);
574 if (
parse(
"theta()", grammar.use_parser<1>() >> end_p, space_p).full)
575 theta = tmpPtr->value(o);
578 if (
parse(
"phi()", grammar.use_parser<1>() >> end_p, space_p).full)
579 phi = tmpPtr->value(o);
585 it->first->UndockWindow();
587 std::cout <<
" FWModelFilter failed to base " << e.what() << std::endl;
603 m_modelPopup->CenterOnParent(kTRUE, TGTransientFrame::kRight);
648 m_helpPopup->CenterOnParent(kTRUE, TGTransientFrame::kBottomRight);
658 m_shortcutPopup->CenterOnParent(kTRUE, TGTransientFrame::kBottomRight);
668 m_helpGLPopup->CenterOnParent(kTRUE, TGTransientFrame::kBottomRight);
698 const static char* kFileTypes[] = {
"Fireworks Configuration files",
"*.fwc",
"All Files",
"*",
nullptr,
nullptr};
700 static TString
dir(
".");
703 fi.fFileTypes = kFileTypes;
704 fi.fIniDir = StrDup(dir);
707 if (fi.fFilename ==
nullptr)
712 if (!ext.empty() && name.find(ext) == name.npos)
761 TGFrameElementPack* frameEL = (TGFrameElementPack*)
m_viewPrimPack->GetPack()->GetList()->At(1);
762 TEveCompositeFrame* ef =
dynamic_cast<TEveCompositeFrame*
>(frameEL->fFrame);
771 static TString
dir(
".");
772 const char* kImageExportTypes[] = {
"PNG",
780 "Encapsulated PostScript",
786 fi.fFileTypes = kImageExportTypes;
787 fi.fIniDir = StrDup(dir);
790 if (fi.fFilename !=
nullptr) {
796 if (name.find(ext) == name.npos)
799 name.insert(name.rfind(
'.'),
"-%u_%u_%u_%s");
802 }
catch (std::runtime_error&
e) {
815 typedef std::list<FWTEveViewer*> viewer_list_t;
816 typedef viewer_list_t::iterator viewer_list_i;
818 typedef std::map<TString, viewer_list_t> name_map_t;
819 typedef name_map_t::iterator name_map_i;
826 TString
name(ev->GetElementName());
827 name.ReplaceAll(
" ",
"");
828 viewer_list_t&
l = vls[
name];
829 viewer_list_i li = l.begin();
830 while (li != l.end() && (*li)->GetGLViewer()->ViewportDiagonal() < ev->GetGLViewer()->ViewportDiagonal())
836 std::vector<std::future<int>> futures;
839 for (name_map_i
i = vls.begin();
i != vls.end(); ++
i) {
840 bool multi_p = (
i->second.size() > 1);
842 for (viewer_list_i
j =
i->second.begin();
j !=
i->second.end(); ++
j, ++view_count) {
843 TString view_name(
i->first);
846 view_name += view_count;
849 file.Form(format.c_str(),
event->id().run(),
event->id().event(),
event->luminosityBlock(), view_name.Data());
851 if (GLEW_EXT_framebuffer_object) {
853 futures.push_back((*j)->CaptureAndSaveImage(file, height));
857 (*j)->GetGLViewer()->SavePicture(file);
859 (*j)->GetGLViewer()->SavePictureHeight(file, height);
864 for (
auto&
f : futures) {
882 gVirtualX->TranslateCoordinates(iMain->GetId(),
883 gClient->GetDefaultRoot()->GetId(),
901 s << iMain->GetWidth();
906 s << iMain->GetHeight();
916 originalSlot =
nullptr;
917 undockedMainFrame =
nullptr;
918 weight = frameElement->fWeight;
919 undocked = !frameElement->fState;
921 TEveCompositeFrame* eveFrame =
dynamic_cast<TEveCompositeFrame*
>(frameElement->fFrame);
924 if (frameElement->fState)
925 eveWindow = eveFrame->GetEveWindow();
927 originalSlot = eveFrame->GetEveWindow();
960 Int_t cfgVersion = 3;
963 float leftWeight, rightWeight;
968 std::stringstream
ss;
975 TGFrameElementPack* frameEL;
976 frameEL = (TGFrameElementPack*)
m_viewPrimPack->GetPack()->GetList()->At(
978 leftWeight = frameEL->fWeight;
979 frameEL = (TGFrameElementPack*)
m_viewPrimPack->GetPack()->GetList()->At(3);
980 rightWeight = frameEL->fWeight;
985 std::stringstream sL;
988 std::stringstream sR;
996 std::vector<areaInfo> wpacked;
997 if (leftWeight > 0) {
999 TGFrameElementPack* frameEL = (TGFrameElementPack*)pp->GetList()->At(1);
1000 if (frameEL->fWeight > 0)
1001 wpacked.push_back(
areaInfo(frameEL));
1004 TGFrameElementPack* seFE;
1005 TIter frame_iterator(sp->GetList());
1006 while ((seFE = (TGFrameElementPack*)frame_iterator())) {
1014 TEveWindow* ew = wIt->first;
1015 TEveCompositeFrameInMainFrame* mainFrame =
dynamic_cast<TEveCompositeFrameInMainFrame*
>(ew->GetEveFrame());
1017 for (std::vector<areaInfo>::iterator pIt = wpacked.begin(); pIt != wpacked.end(); ++pIt) {
1018 if ((*pIt).originalSlot && mainFrame->GetOriginalSlot() == (*pIt).originalSlot) {
1019 (*pIt).eveWindow = wIt->first;
1020 (*pIt).undockedMainFrame = (TGMainFrame*)mainFrame;
1032 for (std::vector<areaInfo>::iterator it = wpacked.begin(); it != wpacked.end(); ++it) {
1033 TEveWindow* ew = (*it).eveWindow;
1037 wb->
addTo(tempWiew);
1083 iFrame->MoveResize(x, y, width, height);
1084 iFrame->SetWMPosition(x, y);
1088 gEve->DisableRedraw();
1094 assert(mw !=
nullptr);
1099 float_t leftWeight = 1;
1100 float_t rightWeight = 1;
1107 float summaryWeight = atof(mw->
valueForKey(
"summaryWeight")->
value().c_str());
1111 TEveWindowSlot* primSlot = (leftWeight > 0) ?
m_viewPrimPack->NewSlotWithWeight(leftWeight) :
nullptr;
1118 assert(
nullptr != views);
1123 if (viewArea->
version() > 1) {
1128 float weight = atof((areaIt->second).valueForKey(
"weight")->value().c_str());
1129 TEveWindowSlot* slot =
1133 lastViewIt->second->setFrom(it->second);
1135 bool undocked = atof((areaIt->second).valueForKey(
"undocked")->value().c_str());
1137 TEveWindow* lastWindow = lastViewIt->first;
1138 lastWindow->UndockWindow();
1139 TEveCompositeFrameInMainFrame*
emf =
dynamic_cast<TEveCompositeFrameInMainFrame*
>(lastWindow->GetEveFrame());
1141 const TGMainFrame* mf =
dynamic_cast<const TGMainFrame*
>(emf->GetParent());
1144 TGMainFrame* mfp = (TGMainFrame*)mf;
1145 const FWConfiguration* mwc = (areaIt->second).valueForKey(
"UndockedWindowPos");
1159 lastViewIt->second->setFrom(it->second);
1163 if (
nullptr != undocked) {
1164 fwLog(
fwlog::kWarning) <<
"Restrore of undocked windows with old window management not supported." << std::endl;
1170 if (
nullptr != controllers) {
1172 if (
nullptr != keyVals) {
1201 gEve->EnableRedraw();
1218 Float_t
sec = val * 0.001;
1261 gEve->FullRedraw3D();
1283 const Int_t
x = 100,
y = 100;
1285 TGMainFrame* mf1 =
new TGMainFrame(
nullptr, 0, 0);
1291 TGMainFrame* mf2 =
new TGMainFrame(
nullptr, 0, 0);
1293 while (!mf2->IsMapped())
1294 gClient->HandleInput();
1300 WindowAttributes_t attr;
1301 gVirtualX->TranslateCoordinates(mf1->GetId(), gClient->GetDefaultRoot()->GetId(), 0, 0, xm, ym, childdum);
1302 gVirtualX->GetWindowAttributes(mf1->GetId(), attr);
1307 "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()
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
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
static const std::string kViewController("view")
std::shared_ptr< ExpressionBase > ExpressionPtr
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")
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
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")
emf
the use of emf in the JEC is not yet implemented
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, FWEventItem * > newItem_
static FWGUISubviewArea * getToolBarFromWindow(TEveWindow *)
void newItem(const FWEventItem *)
void updateStatusBar(const char *status)
virtual UInt_t GetUIntNumber()
void filterButtonClicked()
sigc::signal< void, Int_t > valueChanged_
bool getHidePFBuilders() const
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
static const std::string & checkNameWithViewVersion(const std::string &name, unsigned int viewVersion)
FWModelChangeManager * modelChangeManager() const
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()
boost::function2< FWViewBase *, TEveWindowSlot *, const std::string & > ViewBuildFunctor
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_
static const std::string kControllers("controllers")
void show(FWDataCategories)
CmsShowHelpPopup * m_helpPopup
void openEveBrowserForDebugging() const
CmsShowHelpPopup * m_shortcutPopup