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"
109 m_detailViewManager(0),
110 m_viewManagerManager(iVMMgr),
111 m_contextMenuHandler(0),
112 m_navigator(navigator),
123 m_WMOffsetX(0), m_WMOffsetY(0), m_WMDecorH(0)
136 TEveCompositeFrame::SetupFrameMarkup(foo, 20, 4,
false);
200 TQObject::Connect(gEve->GetWindowManager(),
"WindowSelected(TEveWindow*)",
"FWGUIManager",
this,
"checkSubviewAreaIconState(TEveWindow*)");
201 TQObject::Connect(gEve->GetWindowManager(),
"WindowDocked(TEveWindow*)" ,
"FWGUIManager",
this,
"checkSubviewAreaIconState(TEveWindow*)");
202 TQObject::Connect(gEve->GetWindowManager(),
"WindowUndocked(TEveWindow*)",
"FWGUIManager",
this,
"checkSubviewAreaIconState(TEveWindow*)");
232 gEve->GetWindowManager()->Disconnect(
"WindowSelected(TEveWindow*)",
this,
"checkSubviewAreaIconState(TEveWindow*)");
233 gEve->GetWindowManager()->Disconnect(
"WindowDocked(TEveWindow*)",
this,
"checkSubviewAreaIconState(TEveWindow*)");
234 gEve->GetWindowManager()->Disconnect(
"WindowUndocked(TEveWindow*)",
this,
"checkSubviewAreaIconState(TEveWindow*)");
237 gEve->GetSelection()->Disconnect();
238 gEve->GetHighlight()->Disconnect();
239 gEve->GetSelection()->RemoveElements();
240 gEve->GetHighlight()->RemoveElements();
245 TEveCompositeFrameInMainFrame* mainFrame =
dynamic_cast<TEveCompositeFrameInMainFrame*
>((*wIt).first->GetEveFrame());
247 if (mainFrame) mainFrame->UnmapWindow();
249 (*wIt).second->destroy();
285 throw std::runtime_error(
std::string(
"Unable to create view named ")+iName+
" because it is unknown");
301 TEveCompositeFrame *ef = slot->GetEveFrame();
302 FWViewBase* viewBase = itFind->second(slot, iName);
307 TEveWindow *eveWindow = ef->GetEveWindow();
308 eveWindow->SetElementName(iName.c_str());
310 std::pair<ViewMap_i,bool> insertPair =
m_viewMap.insert(std::make_pair(eveWindow, viewBase));
311 return insertPair.first;
329 snprintf(title,127,
"cmsShow: %s", subtitle);
337 TEveViewerList* viewers = gEve->GetViewers();
338 for (TEveElement::List_i
i=viewers->BeginChildren();
i!= viewers->EndChildren(); ++
i)
340 TEveViewer*
ev =
dynamic_cast<TEveViewer*
>(*i);
342 ev->GetGLViewer()->DeleteOverlayAnnotations();
349 if (it->second == reg) {
418 #if defined(THIS_WILL_NEVER_BE_DEFINED)
419 m_selectionItemsComboBox->AddEntry(iItem->
name().c_str(),iItem->
id());
421 m_selectionItemsComboBox->Select(0);
445 TEveWindow* swapCandidate =0;
447 if ( gEve->GetWindowManager()->GetCurrentWindow())
449 swapCandidate = gEve->GetWindowManager()->GetCurrentWindow();
454 TEveCompositeFrame* pef;
455 TGFrameElementPack *pel;
459 if ( pp->GetList()->GetSize() > 2)
461 pel = (TGFrameElementPack*) pp->GetList()->At(1);
464 pef =
dynamic_cast<TEveCompositeFrame*
>(pel->fFrame);
465 if ( pef && pef->GetEveWindow())
466 swapCandidate = pef->GetEveWindow();
469 if (swapCandidate == 0)
473 TIter frame_iterator(sp->GetList());
474 while ((pel = (TGFrameElementPack*)frame_iterator()))
476 pef =
dynamic_cast<TEveCompositeFrame*
>(pel->fFrame);
477 if ( pef && pef->GetEveWindow() && pel->fState)
479 swapCandidate = pef->GetEveWindow() ;
485 return swapCandidate;
503 if (checkInfoBtn && selected)
532 std::vector<FWGUISubviewArea*>
sd;
539 for (std::vector<FWGUISubviewArea*>::iterator
i= sd.begin();
i !=sd.end(); ++
i)
541 if ((*i)->isSelected())
546 gSystem->ProcessEvents();
553 TEveWindow*
w =
dynamic_cast<TEveWindow*
>(
m_viewPrimPack->FirstChild());
554 if (w) w->DestroyWindowAndSlot();
559 gSystem->ProcessEvents();
570 if (wIt->first != ew)
587 if (curr) swap->SwapWindow(curr);
595 TGVerticalFrame *listFrame =
new TGVerticalFrame(p, p->GetWidth(), p->GetHeight());
597 TGHorizontalFrame* addFrame =
new TGHorizontalFrame(listFrame, p->GetWidth(), 10, kRaisedFrame);
598 TGLabel* addLabel =
new TGLabel(addFrame,
"Summary View");
599 addFrame->AddFrame(addLabel,
new TGLayoutHints(kLHintsCenterX, 0,0,2,2));
600 listFrame->AddFrame(addFrame,
new TGLayoutHints(kLHintsExpandX | kLHintsTop));
609 const unsigned int backgroundColor=0x2f2f2f;
611 addDataButton->ChangeOptions(kRaisedFrame);
612 addDataButton->SetBackgroundColor(backgroundColor);
613 addDataButton->SetTextColor(0xFFFFFF);
614 addDataButton->SetToolTipText(
"Show additional collections");
615 addDataButton->Connect(
"Clicked()",
"FWGUIManager",
this,
"addData()");
616 m_summaryManager->
widget()->AddFrame(addDataButton,
new TGLayoutHints(kLHintsExpandX|kLHintsLeft|kLHintsTop));
638 m_ediFrame->CenterOnParent(kTRUE,TGTransientFrame::kTopRight);
662 using namespace boost::spirit::classic;
666 if (
parse(
"theta()", grammar.use_parser<1>() >> end_p, space_p).full)
667 theta = tmpPtr->value(o);
670 if (
parse(
"phi()", grammar.use_parser<1>() >> end_p, space_p).full)
671 phi = tmpPtr->value(o);
676 v->setClip(theta,
phi);
677 it->first->UndockWindow();
681 std::cout <<
" FWModelFilter failed to base "<< e.what() << std::endl;
700 m_modelPopup->CenterOnParent(kTRUE,TGTransientFrame::kRight);
764 m_helpPopup->CenterOnParent(kTRUE,TGTransientFrame::kBottomRight);
792 m_helpGLPopup->CenterOnParent(kTRUE,TGTransientFrame::kBottomRight);
834 const static char* kFileTypes[] = {
"Fireworks Configuration files",
"*.fwc",
838 static TString
dir(
".");
841 fi.fFileTypes = kFileTypes;
842 fi.fIniDir = StrDup(dir);
845 if (fi.fFilename == 0)
849 std::string ext = kFileTypes[fi.fFileTypeIdx + 1] + 1;
850 if (ext.size() != 0 && name.find(ext) == name.npos)
919 TGFrameElementPack* frameEL = (TGFrameElementPack*)
m_viewPrimPack->GetPack()->GetList()->At(1);
920 TEveCompositeFrame* ef =
dynamic_cast<TEveCompositeFrame*
>(frameEL->fFrame);
933 static TString
dir(
".");
934 const char * kImageExportTypes[] = {
"PNG",
"*.png",
938 "Encapsulated PostScript",
"*.eps",
942 fi.fFileTypes = kImageExportTypes;
943 fi.fIniDir = StrDup(dir);
947 if (fi.fFilename != 0) {
952 std::string ext = kImageExportTypes[fi.fFileTypeIdx + 1] + 1;
953 if (name.find(ext) == name.npos)
956 name.insert(name.rfind(
'.'),
"-%u_%u_%u_%s");
960 catch (std::runtime_error &
e) {
std::cout << e.what() << std::endl; }
973 typedef std::list<FWTEveViewer*> viewer_list_t;
974 typedef viewer_list_t::iterator viewer_list_i;
976 typedef std::map<TString, viewer_list_t> name_map_t;
977 typedef name_map_t::iterator name_map_i;
986 TString
name(ev->GetElementName());
987 name.ReplaceAll(
" ",
"");
988 viewer_list_t &
l = vls[
name];
989 viewer_list_i li = l.begin();
990 while (li != l.end() && (*li)->GetGLViewer()->ViewportDiagonal() < ev->GetGLViewer()->ViewportDiagonal())
996 std::vector<std::future<int>> futures;
999 for (name_map_i
i = vls.begin();
i != vls.end(); ++
i)
1001 bool multi_p = (
i->second.size() > 1);
1003 for (viewer_list_i
j =
i->second.begin();
j !=
i->second.end(); ++
j, ++view_count)
1005 TString view_name(
i->first);
1009 view_name += view_count;
1012 file.Form(format.c_str(),
event->id().run(),
event->id().event(),
1013 event->luminosityBlock(), view_name.Data());
1015 if (GLEW_EXT_framebuffer_object)
1018 futures.push_back((*j)->CaptureAndSaveImage(file, height));
1024 (*j)->GetGLViewer()->SavePicture(file);
1026 (*j)->GetGLViewer()->SavePictureHeight(file, height);
1031 for (
auto &
f : futures)
1054 gVirtualX->TranslateCoordinates(iMain->GetId(),
1055 gClient->GetDefaultRoot()->GetId(),
1060 std::stringstream
s;
1065 std::stringstream
s;
1070 std::stringstream
s;
1071 s<<iMain->GetWidth();
1075 std::stringstream
s;
1076 s<<iMain->GetHeight();
1089 undockedMainFrame = 0;
1090 weight = frameElement->fWeight;
1091 undocked = !frameElement->fState;
1093 TEveCompositeFrame *eveFrame =
dynamic_cast<TEveCompositeFrame*
>(frameElement->fFrame);
1096 if (frameElement->fState)
1097 eveWindow = eveFrame->GetEveWindow();
1099 originalSlot = eveFrame->GetEveWindow();
1117 std::stringstream
s;
1122 std::stringstream
s;
1142 float leftWeight, rightWeight;
1147 std::stringstream
ss;
1155 TGFrameElementPack *frameEL;
1156 frameEL = (TGFrameElementPack*)
m_viewPrimPack->GetPack()->GetList()->At(1);
1157 leftWeight = frameEL->fWeight;
1158 frameEL = (TGFrameElementPack*)
m_viewPrimPack->GetPack()->GetList()->At(3);
1159 rightWeight = frameEL->fWeight;
1166 std::stringstream sL;
1169 std::stringstream sR;
1177 std::vector<areaInfo> wpacked;
1181 TGFrameElementPack *frameEL = (TGFrameElementPack*) pp->GetList()->At(1);
1182 if (frameEL->fWeight > 0)
1183 wpacked.push_back(
areaInfo(frameEL));
1186 TGFrameElementPack *seFE;
1187 TIter frame_iterator(sp->GetList());
1188 while ((seFE = (TGFrameElementPack*)frame_iterator() ))
1198 TEveWindow* ew = wIt->first;
1199 TEveCompositeFrameInMainFrame* mainFrame =
dynamic_cast<TEveCompositeFrameInMainFrame*
>(ew->GetEveFrame());
1202 for(std::vector<areaInfo>::iterator pIt = wpacked.begin(); pIt != wpacked.end(); ++pIt)
1204 if ((*pIt).originalSlot && mainFrame->GetOriginalSlot() == (*pIt).originalSlot)
1206 (*pIt).eveWindow = wIt->first;
1207 (*pIt).undockedMainFrame = (TGMainFrame*)mainFrame;
1219 for(std::vector<areaInfo>::iterator it = wpacked.begin(); it != wpacked.end(); ++it)
1221 TEveWindow* ew = (*it).eveWindow;
1225 wb->
addTo(tempWiew);
1266 TGMainFrame* iFrame)
1273 iFrame->MoveResize(x,y,width,height);
1274 iFrame->SetWMPosition(x, y);
1293 float_t leftWeight =1;
1294 float_t rightWeight=1;
1301 float summaryWeight = atof(mw->
valueForKey(
"summaryWeight")->
value().c_str());
1305 TEveWindowSlot* primSlot = (leftWeight > 0) ?
m_viewPrimPack->NewSlotWithWeight(leftWeight) : 0;
1323 float weight = atof((areaIt->second).valueForKey(
"weight")->value().c_str());
1324 TEveWindowSlot* slot = (
m_viewMap.size() || (primSlot == 0) ) ?
m_viewSecPack->NewSlotWithWeight(weight) : primSlot;
1327 lastViewIt->second->setFrom(it->second);
1329 bool undocked = atof((areaIt->second).valueForKey(
"undocked")->value().c_str());
1332 TEveWindow* lastWindow = lastViewIt->first;
1333 lastWindow->UndockWindow();
1334 TEveCompositeFrameInMainFrame* emf =
dynamic_cast<TEveCompositeFrameInMainFrame*
>(lastWindow->GetEveFrame());
1336 const TGMainFrame* mf =
dynamic_cast<const TGMainFrame*
>(emf->GetParent());
1339 TGMainFrame* mfp = (TGMainFrame*)mf;
1340 const FWConfiguration* mwc = (areaIt->second).valueForKey(
"UndockedWindowPos");
1355 lastViewIt->second->setFrom(it->second);
1360 fwLog(
fwlog::kWarning) <<
"Restrore of undocked windows with old window management not supported." << std::endl;
1366 if (0 != controllers)
1410 gEve->GetBrowser()->MapWindow();
1419 Float_t sec = val*0.001;
1471 gEve->FullRedraw3D();
1511 const Int_t
x = 100,
y = 100;
1513 TGMainFrame *mf1 =
new TGMainFrame(0, 0, 0);
1519 TGMainFrame *mf2 =
new TGMainFrame(0, 0, 0);
1521 while (!mf2->IsMapped()) gClient->HandleInput();
1527 WindowAttributes_t attr;
1528 gVirtualX->TranslateCoordinates(mf1->GetId(), gClient->GetDefaultRoot()->GetId(),
1529 0, 0, xm, ym, childdum);
1530 gVirtualX->GetWindowAttributes(mf1->GetId(), attr);
1534 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 swap(ora::Record &rh, ora::Record &lh)
void promptForPartialSaveConfigurationFile()
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_
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 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)
Evaluator * parse(const T &text)
void createViews(TEveWindowSlot *slot)
FWInvMassDialog * m_invMassDialog
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()
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")
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
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
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
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
std::vector< FWViewBase * > m_regionViews
LuminosityBlockNumber_t const invalidLuminosityBlockNumber
const std::string sShowMainViewCtl
void setFrom(const FWConfiguration &)
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
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()
void exportAllViews(const std::string &format, int height)
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 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
volatile std::atomic< bool > shutdown_flag false
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
virtual void addTo(FWConfiguration &) const
CmsShowHelpPopup * m_shortcutPopup