16 #include <boost/bind.hpp>
25 #include "TGLViewer.h"
26 #include "TEveBrowser.h"
27 #include "TEveManager.h"
29 #include "TEveWindow.h"
30 #include "TEveViewer.h"
31 #include "TEveWindowManager.h"
32 #include "TEveSelection.h"
33 #include "TVirtualX.h"
99 m_detailViewManager(0),
100 m_viewManagerManager(iVMMgr),
101 m_contextMenuHandler(0),
102 m_navigator(navigator),
113 m_WMOffsetX(0), m_WMOffsetY(0), m_WMDecorH(0)
126 TEveCompositeFrame::SetupFrameMarkup(foo, 20, 4,
false);
131 UInt_t
width = gClient->GetDisplayWidth();
132 UInt_t height =
static_cast<UInt_t
>(gClient->GetDisplayHeight()*.8);
136 while(width > 2000) {
139 width =
static_cast<UInt_t
>(width*.8);
194 TQObject::Connect(gEve->GetWindowManager(),
"WindowSelected(TEveWindow*)",
"FWGUIManager",
this,
"checkSubviewAreaIconState(TEveWindow*)");
195 TQObject::Connect(gEve->GetWindowManager(),
"WindowDocked(TEveWindow*)" ,
"FWGUIManager",
this,
"checkSubviewAreaIconState(TEveWindow*)");
196 TQObject::Connect(gEve->GetWindowManager(),
"WindowUndocked(TEveWindow*)",
"FWGUIManager",
this,
"checkSubviewAreaIconState(TEveWindow*)");
226 gEve->GetWindowManager()->Disconnect(
"WindowSelected(TEveWindow*)",
this,
"checkSubviewAreaIconState(TEveWindow*)");
227 gEve->GetWindowManager()->Disconnect(
"WindowDocked(TEveWindow*)",
this,
"checkSubviewAreaIconState(TEveWindow*)");
228 gEve->GetWindowManager()->Disconnect(
"WindowUndocked(TEveWindow*)",
this,
"checkSubviewAreaIconState(TEveWindow*)");
231 gEve->GetSelection()->Disconnect();
232 gEve->GetHighlight()->Disconnect();
233 gEve->GetSelection()->RemoveElements();
234 gEve->GetHighlight()->RemoveElements();
239 TEveCompositeFrameInMainFrame* mainFrame =
dynamic_cast<TEveCompositeFrameInMainFrame*
>((*wIt).first->GetEveFrame());
241 if (mainFrame) mainFrame->UnmapWindow();
243 (*wIt).second->destroy();
279 throw std::runtime_error(
std::string(
"Unable to create view named ")+iName+
" because it is unknown");
295 TEveCompositeFrame *ef = slot->GetEveFrame();
296 FWViewBase* viewBase = itFind->second(slot, iName);
301 TEveWindow *eveWindow = ef->GetEveWindow();
302 eveWindow->SetElementName(iName.c_str());
304 std::pair<ViewMap_i,bool> insertPair =
m_viewMap.insert(std::make_pair(eveWindow, viewBase));
305 return insertPair.first;
323 snprintf(title,127,
"cmsShow: %s", subtitle);
331 TEveViewerList* viewers = gEve->GetViewers();
332 for (TEveElement::List_i
i=viewers->BeginChildren();
i!= viewers->EndChildren(); ++
i)
334 TEveViewer*
ev =
dynamic_cast<TEveViewer*
>(*i);
336 ev->GetGLViewer()->DeleteOverlayAnnotations();
400 #if defined(THIS_WILL_NEVER_BE_DEFINED)
401 m_selectionItemsComboBox->AddEntry(iItem->
name().c_str(),iItem->
id());
403 m_selectionItemsComboBox->Select(0);
427 TEveWindow* swapCandidate =0;
429 if ( gEve->GetWindowManager()->GetCurrentWindow())
431 swapCandidate = gEve->GetWindowManager()->GetCurrentWindow();
436 TEveCompositeFrame* pef;
437 TGFrameElementPack *pel;
441 if ( pp->GetList()->GetSize() > 2)
443 pel = (TGFrameElementPack*) pp->GetList()->At(1);
446 pef =
dynamic_cast<TEveCompositeFrame*
>(pel->fFrame);
447 if ( pef && pef->GetEveWindow())
448 swapCandidate = pef->GetEveWindow();
451 if (swapCandidate == 0)
455 TIter frame_iterator(sp->GetList());
456 while ((pel = (TGFrameElementPack*)frame_iterator()))
458 pef =
dynamic_cast<TEveCompositeFrame*
>(pel->fFrame);
459 if ( pef && pef->GetEveWindow() && pel->fState)
461 swapCandidate = pef->GetEveWindow() ;
467 return swapCandidate;
485 if (checkInfoBtn && selected)
514 std::vector<FWGUISubviewArea*>
sd;
521 for (std::vector<FWGUISubviewArea*>::iterator
i= sd.begin();
i !=sd.end(); ++
i)
523 if ((*i)->isSelected())
528 gSystem->ProcessEvents();
535 TEveWindow*
w =
dynamic_cast<TEveWindow*
>(
m_viewPrimPack->FirstChild());
536 if (w) w->DestroyWindowAndSlot();
541 gSystem->ProcessEvents();
552 if (wIt->first != ew)
569 if (curr) swap->SwapWindow(curr);
577 TGVerticalFrame *listFrame =
new TGVerticalFrame(p, p->GetWidth(), p->GetHeight());
579 TGHorizontalFrame* addFrame =
new TGHorizontalFrame(listFrame, p->GetWidth(), 10, kRaisedFrame);
580 TGLabel* addLabel =
new TGLabel(addFrame,
"Summary View");
581 addFrame->AddFrame(addLabel,
new TGLayoutHints(kLHintsCenterX, 0,0,2,2));
582 listFrame->AddFrame(addFrame,
new TGLayoutHints(kLHintsExpandX | kLHintsTop));
591 const unsigned int backgroundColor=0x2f2f2f;
593 addDataButton->ChangeOptions(kRaisedFrame);
594 addDataButton->SetBackgroundColor(backgroundColor);
595 addDataButton->SetTextColor(0xFFFFFF);
596 addDataButton->SetToolTipText(
"Show additional collections");
597 addDataButton->Connect(
"Clicked()",
"FWGUIManager",
this,
"addData()");
598 m_summaryManager->
widget()->AddFrame(addDataButton,
new TGLayoutHints(kLHintsExpandX|kLHintsLeft|kLHintsTop));
620 m_ediFrame->CenterOnParent(kTRUE,TGTransientFrame::kTopRight);
651 m_modelPopup->CenterOnParent(kTRUE,TGTransientFrame::kRight);
715 m_helpPopup->CenterOnParent(kTRUE,TGTransientFrame::kBottomRight);
743 m_helpGLPopup->CenterOnParent(kTRUE,TGTransientFrame::kBottomRight);
785 const static char* kFileTypes[] = {
"Fireworks Configuration files",
"*.fwc",
789 static TString
dir(
".");
792 fi.fFileTypes = kFileTypes;
793 fi.fIniDir = StrDup(dir);
796 if (fi.fFilename == 0)
800 std::string ext = kFileTypes[fi.fFileTypeIdx + 1] + 1;
801 if (ext.size() != 0 && name.find(ext) == name.npos)
839 TGFrameElementPack* frameEL = (TGFrameElementPack*)
m_viewPrimPack->GetPack()->GetList()->At(1);
840 TEveCompositeFrame* ef =
dynamic_cast<TEveCompositeFrame*
>(frameEL->fFrame);
853 static TString
dir(
".");
854 const char * kImageExportTypes[] = {
"PNG",
"*.png",
858 "Encapsulated PostScript",
"*.eps",
862 fi.fFileTypes = kImageExportTypes;
863 fi.fIniDir = StrDup(dir);
867 if (fi.fFilename != 0) {
872 std::string ext = kImageExportTypes[fi.fFileTypeIdx + 1] + 1;
873 if (name.find(ext) == name.npos)
876 name.insert(name.rfind(
'.'),
"-%u_%u_%u_%s");
880 catch (std::runtime_error &
e) {
std::cout << e.what() << std::endl; }
893 typedef std::list<TEveViewer*> viewer_list_t;
894 typedef viewer_list_t::iterator viewer_list_i;
896 typedef std::map<TString, viewer_list_t> name_map_t;
897 typedef name_map_t::iterator name_map_i;
903 TEveViewer *
ev =
dynamic_cast<TEveViewer*
>(
i->first);
906 TString
name(ev->GetElementName());
907 name.ReplaceAll(
" ",
"");
908 viewer_list_t &
l = vls[
name];
909 viewer_list_i li = l.begin();
910 while (li != l.end() && (*li)->GetGLViewer()->ViewportDiagonal() < ev->GetGLViewer()->ViewportDiagonal())
917 for (name_map_i
i = vls.begin();
i != vls.end(); ++
i)
919 bool multi_p = (
i->second.size() > 1);
921 for (viewer_list_i
j =
i->second.begin();
j !=
i->second.end(); ++
j, ++view_count)
923 TString view_name(
i->first);
927 view_name += view_count;
930 file.Form(format.c_str(),
event->id().run(),
event->id().event(),
931 event->luminosityBlock(), view_name.Data());
932 (*j)->GetGLViewer()->SavePicture(file);
954 gVirtualX->TranslateCoordinates(iMain->GetId(),
955 gClient->GetDefaultRoot()->GetId(),
971 s<<iMain->GetWidth();
976 s<<iMain->GetHeight();
990 weight = frameElement->fWeight;
993 TEveCompositeFrame *eveFrame =
dynamic_cast<TEveCompositeFrame*
>(frameElement->fFrame);
996 if (frameElement->fState)
1017 std::stringstream
s;
1022 std::stringstream
s;
1042 float leftWeight, rightWeight;
1047 std::stringstream
ss;
1055 TGFrameElementPack *frameEL;
1056 frameEL = (TGFrameElementPack*)
m_viewPrimPack->GetPack()->GetList()->At(1);
1057 leftWeight = frameEL->fWeight;
1058 frameEL = (TGFrameElementPack*)
m_viewPrimPack->GetPack()->GetList()->At(3);
1059 rightWeight = frameEL->fWeight;
1066 std::stringstream sL;
1069 std::stringstream sR;
1077 std::vector<areaInfo> wpacked;
1081 TGFrameElementPack *frameEL = (TGFrameElementPack*) pp->GetList()->At(1);
1082 if (frameEL->fWeight > 0)
1083 wpacked.push_back(
areaInfo(frameEL));
1086 TGFrameElementPack *seFE;
1087 TIter frame_iterator(sp->GetList());
1088 while ((seFE = (TGFrameElementPack*)frame_iterator() ))
1098 TEveWindow* ew = wIt->first;
1099 TEveCompositeFrameInMainFrame* mainFrame =
dynamic_cast<TEveCompositeFrameInMainFrame*
>(ew->GetEveFrame());
1102 for(std::vector<areaInfo>::iterator pIt = wpacked.begin(); pIt != wpacked.end(); ++pIt)
1104 if ((*pIt).originalSlot && mainFrame->GetOriginalSlot() == (*pIt).originalSlot)
1106 (*pIt).eveWindow = wIt->first;
1107 (*pIt).undockedMainFrame = (TGMainFrame*)mainFrame;
1119 for(std::vector<areaInfo>::iterator it = wpacked.begin(); it != wpacked.end(); ++it)
1121 TEveWindow* ew = (*it).eveWindow;
1125 wb->
addTo(tempWiew);
1166 TGMainFrame* iFrame)
1173 iFrame->MoveResize(x,y,width,height);
1174 iFrame->SetWMPosition(x, y);
1193 float_t leftWeight =1;
1194 float_t rightWeight=1;
1201 float summaryWeight = atof(mw->
valueForKey(
"summaryWeight")->
value().c_str());
1205 TEveWindowSlot* primSlot = (leftWeight > 0) ?
m_viewPrimPack->NewSlotWithWeight(leftWeight) : 0;
1223 float weight = atof((areaIt->second).valueForKey(
"weight")->value().c_str());
1224 TEveWindowSlot* slot = (
m_viewMap.size() || (primSlot == 0) ) ?
m_viewSecPack->NewSlotWithWeight(weight) : primSlot;
1227 lastViewIt->second->setFrom(it->second);
1229 bool undocked = atof((areaIt->second).valueForKey(
"undocked")->value().c_str());
1232 TEveWindow* lastWindow = lastViewIt->first;
1233 lastWindow->UndockWindow();
1234 TEveCompositeFrameInMainFrame* emf =
dynamic_cast<TEveCompositeFrameInMainFrame*
>(lastWindow->GetEveFrame());
1236 const TGMainFrame* mf =
dynamic_cast<const TGMainFrame*
>(emf->GetParent());
1239 TGMainFrame* mfp = (TGMainFrame*)mf;
1240 const FWConfiguration* mwc = (areaIt->second).valueForKey(
"UndockedWindowPos");
1255 lastViewIt->second->setFrom(it->second);
1260 fwLog(
fwlog::kWarning) <<
"Restrore of undocked windows with old window management not supported." << std::endl;
1266 if (0 != controllers)
1312 gEve->GetBrowser()->MapWindow();
1321 Float_t sec = val*0.001;
1358 gEve->FullRedraw3D();
1398 const Int_t
x = 100,
y = 100;
1400 TGMainFrame *mf1 =
new TGMainFrame(0, 0, 0);
1406 TGMainFrame *mf2 =
new TGMainFrame(0, 0, 0);
1408 while (!mf2->IsMapped()) gClient->HandleInput();
1414 WindowAttributes_t
attr;
1415 gVirtualX->TranslateCoordinates(mf1->GetId(), gClient->GetDefaultRoot()->GetId(),
1416 0, 0, xm, ym, childdum);
1417 gVirtualX->GetWindowAttributes(mf1->GetId(),
attr);
1421 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
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)
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