Public Member Functions | Public Attributes | List of all members
evdb::ParameterSetEditFrame Class Reference

A frame for editing a single paramter set. More...

#include <ParameterSetEditDialog.h>

Public Member Functions

 ParameterSetEditFrame (TGCompositeFrame *mother, unsigned int psetid)
 
 ~ParameterSetEditFrame ()
 
std::string AsFHICL () const
 
void HandleMouseWheel (Event_t *event)
 
void Modified ()
 
void Finalize ()
 

Public Attributes

TGCompositeFrame * fTopFrame
 
TGCanvas * fCanvas
 
TGLayoutHints * fCanvasH
 
TGCompositeFrame * fContainer
 
TGTableLayout * fLayout
 
std::vector< TGHorizontalFrame * > fLHS
 
std::vector< TGHorizontalFrame * > fRHS
 
std::vector< TGTableLayoutHints * > fLHSHints
 
std::vector< TGTableLayoutHints * > fRHSHints
 
std::vector< ParameterSetEditRow * > fRow
 
unsigned int fParameterSetID
 
bool fIsModified
 

Detailed Description

A frame for editing a single paramter set.

===================================================================

Definition at line 167 of file ParameterSetEditDialog.h.

Constructor & Destructor Documentation

ParameterSetEditFrame::ParameterSetEditFrame ( TGCompositeFrame *  mother,
unsigned int  psetid 
)

Definition at line 653 of file ParameterSetEditDialog.cxx.

654  :
655  fParameterSetID(psetid),
656  fIsModified(false)
657 {
658  unsigned int i, j;
659 
660  fCanvas = new TGCanvas(mother, kWidth-6, kHeight-50);
661  fCanvasH = new TGLayoutHints(kLHintsExpandX|kLHintsExpandY);
662  mother->AddFrame(fCanvas, fCanvasH);
663 
664  fContainer = new TGCompositeFrame(fCanvas->GetViewPort());
665  fCanvas->SetContainer(fContainer);
666 
667  //
668  // Locate the parameter set connected to this frame
669  //
670  const ServiceTable& st = ServiceTable::Instance();
671  const fhicl::ParameterSet& pset = st.GetParameterSet(psetid);
672  std::vector<std::string> key = pset.get_names();
673  unsigned int nkey = key.size();
674 
675  //
676  // Count the number of "non system" parameters - each of these will
677  // need an row in the dialog window.
678  //
679  unsigned int nparam = 0;
680  for (i=0; i<nkey; ++i) {
681  if (!((key[i]=="service_type") ||
682  (key[i]=="module_type") ||
683  (key[i]=="module_label"))) {
684  ++nparam;
685  }
686  }
687 
688  //
689  // Build the layout
690  //
691  fLayout = new TGTableLayout(fContainer, nparam, 2);
692  fContainer->SetLayoutManager(fLayout);
693 
694  for (i=0, j=0; i<nkey; ++i) {
695  if (!((key[i]=="service_type") ||
696  (key[i]=="module_type") ||
697  (key[i]=="module_label"))) {
698 
699  TGHorizontalFrame* lhs = new TGHorizontalFrame(fContainer);
700  TGHorizontalFrame* rhs = new TGHorizontalFrame(fContainer);
701 
702  TGTableLayoutHints* lhsh = new TGTableLayoutHints(0,1,j,j+1);
703  TGTableLayoutHints* rhsh = new TGTableLayoutHints(1,2,j,j+1);
704 
705  fContainer->AddFrame(lhs, lhsh);
706  fContainer->AddFrame(rhs, rhsh);
707 
708  fLHS. push_back(lhs);
709  fRHS. push_back(rhs);
710  fLHSHints.push_back(lhsh);
711  fRHSHints.push_back(rhsh);
712 
713  fRow.push_back(new ParameterSetEditRow(this, lhs, rhs, pset, key[i]));
714  ++j;
715  }
716  }
717 
718  fCanvas->Connect("ProcessedEvent(Event_t*)", "evdb::ParameterSetEditFrame",
719  this,
720  "HandleMouseWheel(Event_t*)");
721 
722  fCanvas->Resize();
723 }
static const unsigned int kHeight
static ServiceTable & Instance()
std::vector< ParameterSetEditRow * > fRow
Collection of Services used in the event display.
Definition: ServiceTable.h:36
std::vector< TGTableLayoutHints * > fRHSHints
std::vector< TGHorizontalFrame * > fLHS
def key(type, name=None)
Definition: graph.py:13
std::vector< TGTableLayoutHints * > fLHSHints
std::vector< TGHorizontalFrame * > fRHS
A single row for editing a single parameter in a set.
std::vector< std::string > get_names() const
fhicl::ParameterSet const & GetParameterSet(unsigned int i) const
static const unsigned int kWidth
ParameterSetEditFrame::~ParameterSetEditFrame ( )

Definition at line 727 of file ParameterSetEditDialog.cxx.

728 {
729  unsigned int i;
730  for (i=0; i<fRow.size(); ++i) delete fRow[i];
731  for (i=0; i<fRHSHints.size(); ++i) delete fRHSHints[i];
732  for (i=0; i<fLHSHints.size(); ++i) delete fLHSHints[i];
733  for (i=0; i<fRHS.size(); ++i) delete fRHS[i];
734  for (i=0; i<fLHS.size(); ++i) delete fLHS[i];
735  delete fLayout;
736  //
737  // Parent takes care of delete for fContainer, I think. Anyhow,
738  // trying to delete it causes a seg fault.
739  //
740  // delete fContainer;
741  delete fCanvasH;
742  delete fCanvas;
743 }
std::vector< ParameterSetEditRow * > fRow
std::vector< TGTableLayoutHints * > fRHSHints
std::vector< TGHorizontalFrame * > fLHS
std::vector< TGTableLayoutHints * > fLHSHints
std::vector< TGHorizontalFrame * > fRHS

Member Function Documentation

std::string ParameterSetEditFrame::AsFHICL ( ) const

Definition at line 788 of file ParameterSetEditDialog.cxx.

789 {
790  unsigned int i;
791  std::ostringstream s;
792  for (i=0; i<fRow.size(); ++i) {
793  s << fRow[i]->AsFHICL() << "\n";
794  }
795  return s.str();
796 }
std::vector< ParameterSetEditRow * > fRow
static QCString * s
Definition: config.cpp:1042
void ParameterSetEditFrame::Finalize ( )

Definition at line 780 of file ParameterSetEditDialog.cxx.

781 {
782  unsigned int i;
783  for (i=0; i<fRow.size(); ++i) fRow[i]->Finalize();
784 }
std::vector< ParameterSetEditRow * > fRow
void ParameterSetEditFrame::HandleMouseWheel ( Event_t *  event)

Definition at line 746 of file ParameterSetEditDialog.cxx.

747 {
748  // Handle mouse wheel to scroll.
749  if (event->fType != kButtonPress && event->fType != kButtonRelease)
750  return;
751 
752  Int_t page = 0;
753  if (event->fCode == kButton4 || event->fCode == kButton5) {
754  if (!fCanvas) return;
755  if (fCanvas->GetContainer()->GetHeight())
756  page = Int_t(Float_t(fCanvas->GetViewPort()->GetHeight() *
757  fCanvas->GetViewPort()->GetHeight()) /
758  fCanvas->GetContainer()->GetHeight());
759  }
760 
761  if (event->fCode == kButton4) {
762  //scroll up
763  Int_t newpos = fCanvas->GetVsbPosition() - page;
764  if (newpos < 0) newpos = 0;
765  fCanvas->SetVsbPosition(newpos);
766  }
767  if (event->fCode == kButton5) {
768  // scroll down
769  Int_t newpos = fCanvas->GetVsbPosition() + page;
770  fCanvas->SetVsbPosition(newpos);
771  }
772 
773  return;
774 }
Event finding and building.
void ParameterSetEditFrame::Modified ( )

Definition at line 777 of file ParameterSetEditDialog.cxx.

Member Data Documentation

TGCanvas* evdb::ParameterSetEditFrame::fCanvas

Definition at line 183 of file ParameterSetEditDialog.h.

TGLayoutHints* evdb::ParameterSetEditFrame::fCanvasH

Definition at line 184 of file ParameterSetEditDialog.h.

TGCompositeFrame* evdb::ParameterSetEditFrame::fContainer

Definition at line 185 of file ParameterSetEditDialog.h.

bool evdb::ParameterSetEditFrame::fIsModified

Definition at line 194 of file ParameterSetEditDialog.h.

TGTableLayout* evdb::ParameterSetEditFrame::fLayout

Definition at line 186 of file ParameterSetEditDialog.h.

std::vector<TGHorizontalFrame*> evdb::ParameterSetEditFrame::fLHS

Definition at line 187 of file ParameterSetEditDialog.h.

std::vector<TGTableLayoutHints*> evdb::ParameterSetEditFrame::fLHSHints

Definition at line 189 of file ParameterSetEditDialog.h.

unsigned int evdb::ParameterSetEditFrame::fParameterSetID

Definition at line 193 of file ParameterSetEditDialog.h.

std::vector<TGHorizontalFrame*> evdb::ParameterSetEditFrame::fRHS

Definition at line 188 of file ParameterSetEditDialog.h.

std::vector<TGTableLayoutHints*> evdb::ParameterSetEditFrame::fRHSHints

Definition at line 190 of file ParameterSetEditDialog.h.

std::vector<ParameterSetEditRow*> evdb::ParameterSetEditFrame::fRow

Definition at line 191 of file ParameterSetEditDialog.h.

TGCompositeFrame* evdb::ParameterSetEditFrame::fTopFrame

Definition at line 182 of file ParameterSetEditDialog.h.


The documentation for this class was generated from the following files: