#include #include #include #include #include #include #include #include #include #include using namespace std; namespace view { EventBrowserMenu::EventBrowserMenu(TGCompositeFrame* main) { // menu layouts fMenuBarLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 0, 0, 1, 1); fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0); fMenuBarHelpLayout = new TGLayoutHints(kLHintsTop | kLHintsRight); // for the Menu fMenuFile = new TGPopupMenu(gClient->GetRoot()); fMenuFile->AddEntry("Open file ...", eFileOpen); fMenuFile->AddEntry("Connect to DAQ server ...", eConnectToDAQ); fMenuFile->AddSeparator(); fMenuFile->AddEntry("Save event as PS", eFileSavePS); fMenuFile->AddEntry("Save event as ROOT", eFileSaveROOT); fMenuFile->AddSeparator(); fMenuFile->AddEntry("Load style file", eLoadStyle); fMenuFile->AddSeparator(); fMenuFile->AddEntry("Quit", eFileQuit); fMenuFile->DisableEntry(eFileSavePS); fMenuMCOptions = new TGPopupMenu(gClient->GetRoot()); fMenuMCOptions->AddEntry("Show MC tracks", eShowMCTracks); fMenuMCOptions->AddEntry("Show MC hits", eShowMCHits); fMenuMCOptions->AddSeparator(); fMenuMCOptions->AddEntry("only MC tracks with hits", eShowOnlyMCTracksWithHits); fMenuMCOptions->AddEntry("only MC", eShowOnlyMC); fMenuMCOptions->UnCheckEntry(eShowMCTracks); fMenuMCOptions->UnCheckEntry(eShowMCHits); fMenuMCOptions->UnCheckEntry(eShowOnlyMC); fMenuMCOptions->CheckEntry(eShowOnlyMCTracksWithHits); if (!((EventBrowser*)main)->HasMCData()) { fMenuMCOptions->DisableEntry(eShowMCTracks); fMenuMCOptions->DisableEntry(eShowMCHits); fMenuMCOptions->DisableEntry(eShowOnlyMC); fMenuMCOptions->DisableEntry(eShowOnlyMCTracksWithHits); } // for some help fMenuHelp = new TGPopupMenu(gClient->GetRoot()); fMenuHelp->AddEntry("Documentation ...", eDocumentation); fMenuHelp->AddSeparator(); fMenuHelp->AddEntry("About", eAbout); fMenuFile->Associate (main); fMenuMCOptions->Associate (main); fMenuHelp->Associate (main); fMenuBar = new TGMenuBar(main);//, 1, 1, kHorizontalFrame); fMenuBar->AddPopup("File", fMenuFile, fMenuBarItemLayout); fMenuBar->AddPopup("MC", fMenuMCOptions, fMenuBarItemLayout); fMenuBar->AddPopup("Help", fMenuHelp, fMenuBarHelpLayout); fMenuBar->DrawBorder(); main->AddFrame (fMenuBar, fMenuBarLayout); } EventBrowserMenu::~EventBrowserMenu() { delete fMenuBar; } bool EventBrowserMenu::ToggleMCOption(EButtonSignals signal) { if(fMenuMCOptions->IsEntryChecked(signal)) { fMenuMCOptions->UnCheckEntry(signal); return false; } fMenuMCOptions->CheckEntry(signal); return true; } void EventBrowserMenu::EnableMC() { fMenuMCOptions->EnableEntry(eShowMCTracks); fMenuMCOptions->EnableEntry(eShowMCHits); fMenuMCOptions->EnableEntry(eShowOnlyMC); fMenuMCOptions->EnableEntry(eShowOnlyMCTracksWithHits); OptionsManager::GetInstance().SetShowMCTracks(fMenuMCOptions->IsEntryChecked(eShowMCTracks)); OptionsManager::GetInstance().SetShowMCHits(fMenuMCOptions->IsEntryChecked(eShowMCHits)); OptionsManager::GetInstance().SetShowOnlyMC(fMenuMCOptions->IsEntryChecked(eShowOnlyMC)); OptionsManager::GetInstance().SetShowOnlyMCTracksWithHits(fMenuMCOptions->IsEntryChecked(eShowOnlyMCTracksWithHits)); } }