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"
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);
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)
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)
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) {
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();
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",