CMS 3D CMS Logo

Public Member Functions | Private Attributes | Static Private Attributes

FWGUIEventFilter Class Reference

#include <FWGUIEventFilter.h>

List of all members.

Public Member Functions

void addSelector (FWEventSelector *sel)
void apply ()
void changeFilterMode ()
void checkApplyButton ()
 ClassDef (FWGUIEventFilter, 0)
virtual void CloseWindow ()
void deleteEntry (FWGUIEventSelector *)
void disableFilters ()
 FWGUIEventFilter (CmsShowNavigator *)
int getFilterMode ()
std::list< FWGUIEventSelector * > & guiSelectors ()
Bool_t HandleKey (Event_t *event)
bool isOpen ()
void newEventEntry ()
void newTriggerEntry ()
void reset ()
void setupDisableFilteringButton (bool)
void show (std::list< FWEventSelector * > *sels, int filterMode, int state)
void updateFilterStateLabel (int)
virtual ~FWGUIEventFilter ()

Private Attributes

FWCustomIconsButtonm_addBtn
TGTextButton * m_applyBtn
TGTextButton * m_disableFilteringBtn
TGCompositeFrame * m_eventSelectionFrame
TGCompositeFrame * m_eventSelectionFrameParent
bool m_filtersRemoved
std::list< FWGUIEventSelector * > m_guiSelectors
bool m_isOpen
CmsShowNavigatorm_navigator
int m_origFilterMode
TGRadioButton * m_rad1
TGRadioButton * m_rad2
TGLabel * m_stateLabel
TGCompositeFrame * m_triggerSelectionFrame
TGCompositeFrame * m_triggerSelectionFrameParent

Static Private Attributes

static const int s_entryHeight = 21

Detailed Description

Definition at line 26 of file FWGUIEventFilter.h.


Constructor & Destructor Documentation

FWGUIEventFilter::FWGUIEventFilter ( CmsShowNavigator n)

Definition at line 17 of file FWGUIEventFilter.cc.

References FWCheckBoxIcon::coreIcondir(), f, m_addBtn, m_applyBtn, m_disableFilteringBtn, m_eventSelectionFrameParent, m_rad1, m_rad2, m_stateLabel, m_triggerSelectionFrameParent, fireworks_root_gui::makeLabel(), and s_entryHeight.

                                                     :
   TGMainFrame(gClient->GetRoot(), 560, 300),


   m_origFilterMode(CmsShowNavigator::kOr),
   m_isOpen(false),
   m_filtersRemoved(false),

   m_eventSelectionFrameParent(0),
   m_eventSelectionFrame(0),
   m_triggerSelectionFrameParent(0),
   m_triggerSelectionFrame(0),

   m_rad1(0),
   m_rad2(0),
   m_stateLabel(0),
   m_disableFilteringBtn(0),
   m_addBtn(0),

   m_navigator(n)
{
   SetWindowName("Event Filters");

   TGVerticalFrame* v1 = new TGVerticalFrame(this);
   AddFrame(v1, new TGLayoutHints(kLHintsExpandX |kLHintsExpandY));


   //----------------------- Event selection
  
   {
      m_eventSelectionFrameParent =  new TGVerticalFrame(v1, GetWidth(), s_entryHeight, 0);
      v1->AddFrame(m_eventSelectionFrameParent, new TGLayoutHints(kLHintsExpandX|kLHintsTop, 2, 2, 0,0));

      // headers
      TGHorizontalFrame* selH = new TGHorizontalFrame(m_eventSelectionFrameParent);
      m_eventSelectionFrameParent->AddFrame(selH, new TGLayoutHints(kLHintsExpandX));

      {
         TGCompositeFrame *cfr = new TGHorizontalFrame(selH);
         selH->AddFrame(cfr, new TGLayoutHints(kLHintsExpandX));
         cfr->AddFrame(new TGLabel(cfr, "Event Filter Expression:"), new TGLayoutHints(kLHintsLeft|kLHintsBottom, 2, 2, 6, 4));
      }
      {
         TGCompositeFrame *cfr = new TGHorizontalFrame(selH, 122, 22, kFixedSize);
         selH->AddFrame(cfr);
         cfr->AddFrame(new TGLabel(cfr, "Comment:"), new TGLayoutHints(kLHintsLeft|kLHintsBottom, 2, 2, 2, 0));
      }
      {
         TGCompositeFrame *cfr = new TGHorizontalFrame(selH, 105, 22, kFixedSize);
         selH->AddFrame(cfr);
         cfr->AddFrame(new TGLabel(cfr, "Pass:"), new TGLayoutHints(kLHintsLeft|kLHintsBottom, 2, 2, 2, 0));
      }


      TGHorizontalFrame* addBtnFrame = new TGHorizontalFrame(v1);
      v1->AddFrame(addBtnFrame, new TGLayoutHints(kLHintsExpandX));
      addBtnFrame->AddFrame(new TGHorizontal3DLine(addBtnFrame),  new TGLayoutHints(kLHintsExpandX | kLHintsCenterY,4 ,8, 2, 2));
    
      m_addBtn = new FWCustomIconsButton(addBtnFrame, fClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "plus-sign.png"),
                                         fClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "plus-sign-over.png"),
                                         fClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "plus-sign-disabled.png"));

      addBtnFrame->AddFrame(m_addBtn, new TGLayoutHints(kLHintsRight/*|kLHintsExpandX|kLHintsExpandY*/, 0, 6, 4, 1));
      TQObject::Connect(m_addBtn, "Clicked()", "FWGUIEventFilter",  this, "newEventEntry()");
   }

   //----------------------- TriggerResults selection

   {
      m_triggerSelectionFrameParent =  new TGVerticalFrame(v1, GetWidth(), s_entryHeight, 0);
      v1->AddFrame(m_triggerSelectionFrameParent, new TGLayoutHints(kLHintsExpandX|kLHintsTop, 2, 2, 0,0));

      // headers
      TGHorizontalFrame* selH = new TGHorizontalFrame(m_triggerSelectionFrameParent);
      m_triggerSelectionFrameParent->AddFrame(selH, new TGLayoutHints(kLHintsExpandX));

      {
         TGCompositeFrame *cfr = new TGHorizontalFrame(selH);
         selH->AddFrame(cfr, new TGLayoutHints(kLHintsExpandX));
         cfr->AddFrame(new TGLabel(cfr, "TriggerResults Filter Expression:"), new TGLayoutHints(kLHintsLeft|kLHintsBottom, 2, 2, 6, 04));
      }
      {
         TGCompositeFrame *cfr = new TGHorizontalFrame(selH, 122, 22, kFixedSize);
         selH->AddFrame(cfr);
         cfr->AddFrame(new TGLabel(cfr, "Comment:"), new TGLayoutHints(kLHintsLeft|kLHintsBottom, 2, 2, 0, 0));
      }
      {
         TGCompositeFrame *cfr = new TGHorizontalFrame(selH, 105, 22, kFixedSize);
         selH->AddFrame(cfr);
         cfr->AddFrame(new TGLabel(cfr, "Pass:"), new TGLayoutHints(kLHintsLeft|kLHintsBottom, 2, 2, 0, 0));
      }

      //-------------------- adding new selection

      TGHorizontalFrame* addBtnFrame = new TGHorizontalFrame(v1);
      v1->AddFrame(addBtnFrame, new TGLayoutHints(kLHintsExpandX));

      addBtnFrame->AddFrame(new TGHorizontal3DLine(addBtnFrame),  new TGLayoutHints(kLHintsExpandX | kLHintsCenterY,4 ,8, 2, 2));
      m_addBtn = new FWCustomIconsButton(addBtnFrame, fClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "plus-sign.png"),
                                         fClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "plus-sign-over.png"),
                                         fClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "plus-sign-disabled.png"));

      addBtnFrame->AddFrame(m_addBtn, new TGLayoutHints(kLHintsRight/*|kLHintsExpandX|kLHintsExpandY*/, 0, 6, 4, 1));
      TQObject::Connect(m_addBtn, "Clicked()", "FWGUIEventFilter",  this, "newTriggerEntry()");

   }

   //-------------------- logical operations

   TGHorizontalFrame* headerFrame = new TGHorizontalFrame(v1/*, 360, 61, kHorizontalFrame | kFixedSize*/);

   {
      TGHorizontalFrame* xx = new TGHorizontalFrame(v1);
      fireworks_root_gui::makeLabel(xx, "Combine Expression Width:", 152, 2,2,2,2);
      m_rad1 =  new TGRadioButton(xx, "OR", 81);
      xx->AddFrame(m_rad1, new TGLayoutHints(kLHintsNormal, 2,10, 0, 0));
      m_rad1->SetState(kButtonDown);
      m_rad2 =  new TGRadioButton(xx, "AND", 82);
      xx->AddFrame(m_rad2);
      m_rad1->Connect("Clicked()", "FWGUIEventFilter", this, "changeFilterMode()");
      m_rad2->Connect("Clicked()", "FWGUIEventFilter", this, "changeFilterMode()");

      v1->AddFrame(xx, new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 2));
   }
   v1->AddFrame(headerFrame, new TGLayoutHints(kLHintsNormal, 1, 1, 1, 1));


   //-------------------- status
   {
      TGHorizontalFrame* hf = new TGHorizontalFrame(v1);
      v1->AddFrame(hf, new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 20));
      fireworks_root_gui::makeLabel(hf, "Status:", 37, 2,2,2,2);
      {     
         TGGC *fTextGC;
         const TGFont *font = gClient->GetFont("-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
         if (!font)
            font = gClient->GetResourcePool()->GetDefaultFont();
         GCValues_t   gval;
         gval.fMask = kGCBackground | kGCFont | kGCForeground;
         gval.fFont = font->GetFontHandle();
         fTextGC = gClient->GetGC(&gval, kTRUE);

         TGHorizontalFrame *labFrame = new TGHorizontalFrame(hf, 380, 22, kHorizontalFrame | kFixedWidth);
         hf->AddFrame(labFrame, new TGLayoutHints(kLHintsNormal));

         m_stateLabel = new TGLabel(labFrame, "x", fTextGC->GetGC());
         labFrame->AddFrame(m_stateLabel, new TGLayoutHints( kLHintsLeft,2,2,2,2));
                                     
      }
   }
   //-------------------- external actions

   TGHorizontalFrame* btnFrame = new TGHorizontalFrame(v1, 280, 30);
   v1->AddFrame(btnFrame, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX | kLHintsBottom , 0, 0, 2, 4));

   TGTextButton* cancel = new TGTextButton(btnFrame," Close ");
   btnFrame->AddFrame(cancel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 20, 20, 2, 4));
   cancel->Connect("Clicked()","FWGUIEventFilter", this, "CloseWindow()");

   {
      TGHorizontalFrame* f = new TGHorizontalFrame(btnFrame);
      btnFrame->AddFrame(f, new TGLayoutHints(kLHintsRight, 4, 18, 2, 4));
      m_disableFilteringBtn = new TGTextButton(f, " Disable Filtering ");
      f->AddFrame(m_disableFilteringBtn, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 4, 10, 2, 4));
      m_disableFilteringBtn->Connect("Clicked()","FWGUIEventFilter", this, "disableFilters()");

      m_applyBtn = new TGTextButton(f,"Apply Filters");
      f->AddFrame(m_applyBtn, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 4, 8, 2, 4));
      m_applyBtn->Connect("Clicked()","FWGUIEventFilter", this, "apply()");
      m_applyBtn->SetToolTipText("Enable filtering and apply changes.");
   }


}
FWGUIEventFilter::~FWGUIEventFilter ( ) [virtual]

Definition at line 192 of file FWGUIEventFilter.cc.

{
}

Member Function Documentation

void FWGUIEventFilter::addSelector ( FWEventSelector sel)

Definition at line 197 of file FWGUIEventFilter.cc.

References CmsShowNavigator::getProcessList(), m_eventSelectionFrame, m_guiSelectors, m_navigator, FWEventSelector::m_triggerProcess, m_triggerSelectionFrame, and dbtoconf::parent.

Referenced by newEventEntry(), newTriggerEntry(), and show().

{
   TGCompositeFrame* parent = sel->m_triggerProcess.empty() ? m_eventSelectionFrame : m_triggerSelectionFrame;
   FWGUIEventSelector* es = new FWGUIEventSelector(parent, sel, m_navigator->getProcessList() );
   parent->AddFrame(es, new TGLayoutHints(kLHintsExpandX));
   TQObject::Connect(es, "removeSelector(FWGUIEventSelector*)", "FWGUIEventFilter",  this, "deleteEntry(FWGUIEventSelector*)");
   TQObject::Connect(es, "selectorChanged()", "FWGUIEventFilter",  this, "checkApplyButton()");

   m_guiSelectors.push_back(es);
 
}
void FWGUIEventFilter::apply ( )

Definition at line 325 of file FWGUIEventFilter.cc.

References CmsShowNavigator::applyFiltersFromGUI(), getFilterMode(), m_applyBtn, m_filtersRemoved, m_navigator, and m_origFilterMode.

{
   m_navigator->applyFiltersFromGUI();

   m_origFilterMode = getFilterMode();
   m_filtersRemoved = false;
   m_applyBtn->SetForegroundColor(0x000000);
   fClient->NeedRedraw( this);

}
void FWGUIEventFilter::changeFilterMode ( )

Definition at line 210 of file FWGUIEventFilter.cc.

References checkApplyButton(), m_rad1, and m_rad2.

{
   TGButton *btn = (TGButton *) gTQSender;

   if (btn->WidgetId() == 81)
      m_rad2->SetState(kButtonUp);
   else
      m_rad1->SetState(kButtonUp);
   checkApplyButton();
}
void FWGUIEventFilter::checkApplyButton ( )

Definition at line 380 of file FWGUIEventFilter.cc.

References getFilterMode(), i, m_applyBtn, m_filtersRemoved, m_guiSelectors, and m_origFilterMode.

Referenced by changeFilterMode().

{
   bool changed = m_filtersRemoved;

   if (!changed)
   {
      changed = (getFilterMode() != m_origFilterMode);

      if (!changed)
      {
         std::list<FWGUIEventSelector*>::iterator i = m_guiSelectors.begin();
         while (i != m_guiSelectors.end())
         {
            if ((*i)->origSelector() == 0)
               break;

            if ( (*i)->guiSelector()->m_enabled    != (*i)->origSelector()->m_enabled  ||
                 (*i)->guiSelector()->m_expression != (*i)->origSelector()->m_expression )
               break;

            ++i;
         }
         changed = (i != m_guiSelectors.end());
      }
   }

   m_applyBtn->SetForegroundColor(changed ? 0x40FF80 : 0x000000);
   gClient->NeedRedraw( m_applyBtn);
}
FWGUIEventFilter::ClassDef ( FWGUIEventFilter  ,
 
)
void FWGUIEventFilter::CloseWindow ( ) [virtual]
void FWGUIEventFilter::deleteEntry ( FWGUIEventSelector sel)

Definition at line 284 of file FWGUIEventFilter.cc.

References m_eventSelectionFrame, m_filtersRemoved, m_guiSelectors, FWEventSelector::m_triggerProcess, m_triggerSelectionFrame, FWGUIEventSelector::origSelector(), and L1TEmulatorMonitor_cff::p.

{
   m_filtersRemoved = true;

   m_guiSelectors.remove(sel);

   TGCompositeFrame* p = 0;
   if (sel->origSelector()->m_triggerProcess.empty())
      p = m_eventSelectionFrame;
   else
      p = m_triggerSelectionFrame;

   p->RemoveFrame(sel);
   Resize(GetWidth(), GetDefaultHeight());
   Layout();
   gClient->NeedRedraw(this);
}
void FWGUIEventFilter::disableFilters ( )
int FWGUIEventFilter::getFilterMode ( )
std::list<FWGUIEventSelector*>& FWGUIEventFilter::guiSelectors ( ) [inline]
bool FWGUIEventFilter::HandleKey ( Event_t *  event)

Definition at line 456 of file FWGUIEventFilter.cc.

References CmsShowMainFrame::bindCSGActionKeys(), FWGUIManager::getGUIManager(), FWGUIManager::getMainFrame(), if(), and m.

{ 
   // AMT workaround for problems  to override root's action  for 'Ctrl+s'
  
   if (GetBindList()->IsEmpty())
      FWGUIManager::getGUIManager()->getMainFrame()->bindCSGActionKeys(this);

   TIter next(fBindList);
   TGMapKey *m;
   TGFrame  *w = 0;

   while ((m = (TGMapKey *) next())) {
      if (m->fKeyCode == event->fCode) {
         w = (TGFrame *) m->fWindow;
         if (w->HandleKey(event)) return kTRUE;
      }
   }
   return kFALSE;
}
bool FWGUIEventFilter::isOpen ( ) [inline]

Definition at line 42 of file FWGUIEventFilter.h.

References m_isOpen.

Referenced by CmsShowNavigator::canEditFiltersExternally().

{ return m_isOpen; }
void FWGUIEventFilter::newEventEntry ( )

Definition at line 316 of file FWGUIEventFilter.cc.

References addSelector().

{
   addSelector(new FWEventSelector());
   MapSubwindows();
   Resize(GetWidth(), GetDefaultHeight());
   Layout();
}
void FWGUIEventFilter::newTriggerEntry ( )

Definition at line 303 of file FWGUIEventFilter.cc.

References addSelector(), FWEventSelector::m_triggerProcess, and asciidump::s.

{ 
   FWEventSelector* s = new FWEventSelector;
   s->m_triggerProcess = "HLT";
   addSelector(s);
   MapSubwindows();

   Resize(GetWidth(), GetDefaultHeight());

   Layout();
}
void FWGUIEventFilter::reset ( void  )

Definition at line 261 of file FWGUIEventFilter.cc.

References i, m_eventSelectionFrame, m_eventSelectionFrameParent, m_guiSelectors, m_triggerSelectionFrame, and m_triggerSelectionFrameParent.

Referenced by CmsShowNavigator::setFrom().

{
   // called on load of configuration
   if (m_eventSelectionFrameParent) {
      m_eventSelectionFrameParent->RemoveFrame(m_eventSelectionFrame);
      m_eventSelectionFrame = 0;
   }
   if (m_triggerSelectionFrameParent) {
      m_triggerSelectionFrameParent->RemoveFrame(m_triggerSelectionFrame);
      m_triggerSelectionFrame = 0;
   }

   for (std::list<FWGUIEventSelector*>::iterator i = m_guiSelectors.begin(); i != m_guiSelectors.end(); ++i)
      delete *i;
   
   m_guiSelectors.clear();
}
void FWGUIEventFilter::setupDisableFilteringButton ( bool  x)
void FWGUIEventFilter::show ( std::list< FWEventSelector * > *  sels,
int  filterMode,
int  state 
)

Definition at line 222 of file FWGUIEventFilter.cc.

References addSelector(), i, CmsShowNavigator::kOr, m_applyBtn, m_eventSelectionFrame, m_eventSelectionFrameParent, m_filtersRemoved, m_isOpen, m_origFilterMode, m_rad1, m_rad2, m_triggerSelectionFrame, m_triggerSelectionFrameParent, and updateFilterStateLabel().

Referenced by CmsShowNavigator::setFrom(), and CmsShowNavigator::showEventFilterGUI().

{
   m_applyBtn->SetForegroundColor(0x000000);
   m_filtersRemoved = false;

   m_isOpen = true;

   m_origFilterMode = filterMode;

   if (filterMode == CmsShowNavigator::kOr)
   {
      m_rad1->SetState(kButtonDown, false);
      m_rad2->SetState(kButtonUp, false);
   }
   else
   {
      m_rad2->SetState(kButtonDown, false);
      m_rad1->SetState(kButtonUp, false);
   }

   assert(m_eventSelectionFrame == 0);
   
   m_eventSelectionFrame = new TGVerticalFrame(m_eventSelectionFrameParent);
   m_eventSelectionFrameParent->AddFrame(m_eventSelectionFrame,  new TGLayoutHints(kLHintsExpandX));

   m_triggerSelectionFrame = new TGVerticalFrame(m_triggerSelectionFrameParent);
   m_triggerSelectionFrameParent->AddFrame(m_triggerSelectionFrame,  new TGLayoutHints(kLHintsExpandX));

   for(std::list<FWEventSelector*>::iterator i = sels->begin(); i != sels->end(); ++i)
      addSelector(*i);

   updateFilterStateLabel(filterState);

   MapSubwindows();
   Layout();
   MapRaised();
}
void FWGUIEventFilter::updateFilterStateLabel ( int  state)

Definition at line 411 of file FWGUIEventFilter.cc.

References CmsShowNavigator::getNSelectedEvents(), CmsShowNavigator::getNTotalEvents(), CmsShowNavigator::kOff, CmsShowNavigator::kOn, m_navigator, and m_stateLabel.

Referenced by CmsShowNavigator::CmsShowNavigator(), and show().

{
   if (state == CmsShowNavigator::kOn)
      m_stateLabel->SetText(Form("%d events selected from %d   ", m_navigator->getNSelectedEvents(), m_navigator->getNTotalEvents()));
   else if (state == CmsShowNavigator::kOff)
      m_stateLabel->SetText("Filtering Disabled  ");
   else
      m_stateLabel->SetText("Filtering Withdrawn  ");

   Layout();
}

Member Data Documentation

Definition at line 77 of file FWGUIEventFilter.h.

Referenced by FWGUIEventFilter().

TGTextButton* FWGUIEventFilter::m_applyBtn [private]

Definition at line 75 of file FWGUIEventFilter.h.

Referenced by apply(), checkApplyButton(), FWGUIEventFilter(), and show().

TGTextButton* FWGUIEventFilter::m_disableFilteringBtn [private]

Definition at line 76 of file FWGUIEventFilter.h.

Referenced by FWGUIEventFilter(), and setupDisableFilteringButton().

TGCompositeFrame* FWGUIEventFilter::m_eventSelectionFrame [private]

Definition at line 67 of file FWGUIEventFilter.h.

Referenced by addSelector(), CloseWindow(), deleteEntry(), reset(), and show().

TGCompositeFrame* FWGUIEventFilter::m_eventSelectionFrameParent [private]

Definition at line 66 of file FWGUIEventFilter.h.

Referenced by CloseWindow(), FWGUIEventFilter(), reset(), and show().

Definition at line 62 of file FWGUIEventFilter.h.

Referenced by apply(), checkApplyButton(), deleteEntry(), and show().

Definition at line 61 of file FWGUIEventFilter.h.

Referenced by CloseWindow(), isOpen(), and show().

Definition at line 60 of file FWGUIEventFilter.h.

Referenced by apply(), checkApplyButton(), and show().

TGRadioButton* FWGUIEventFilter::m_rad1 [private]

Definition at line 72 of file FWGUIEventFilter.h.

Referenced by changeFilterMode(), FWGUIEventFilter(), getFilterMode(), and show().

TGRadioButton* FWGUIEventFilter::m_rad2 [private]

Definition at line 73 of file FWGUIEventFilter.h.

Referenced by changeFilterMode(), FWGUIEventFilter(), and show().

TGLabel* FWGUIEventFilter::m_stateLabel [private]

Definition at line 74 of file FWGUIEventFilter.h.

Referenced by FWGUIEventFilter(), and updateFilterStateLabel().

TGCompositeFrame* FWGUIEventFilter::m_triggerSelectionFrame [private]

Definition at line 70 of file FWGUIEventFilter.h.

Referenced by addSelector(), CloseWindow(), deleteEntry(), reset(), and show().

Definition at line 69 of file FWGUIEventFilter.h.

Referenced by CloseWindow(), FWGUIEventFilter(), reset(), and show().

const int FWGUIEventFilter::s_entryHeight = 21 [static, private]

Definition at line 58 of file FWGUIEventFilter.h.

Referenced by FWGUIEventFilter().