Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:20

0001 // -*- C++ -*-
0002 //
0003 // Package:     Core
0004 // Class  :     FWViewEnergyScaleEditor
0005 //
0006 // Implementation:
0007 //     [Notes on implementation]
0008 //
0009 // Original Author:  Alja Mrak-Tadel
0010 //         Created:  Fri Sep 24 18:52:19 CEST 2010
0011 //
0012 
0013 // system include files
0014 
0015 // user include files
0016 #include "TGButton.h"
0017 #include "TGLabel.h"
0018 #include "Fireworks/Core/interface/FWViewEnergyScaleEditor.h"
0019 #include "Fireworks/Core/interface/FWEveView.h"
0020 #include "Fireworks/Core/interface/FWViewEnergyScale.h"
0021 #include "Fireworks/Core/interface/FWParameterSetterBase.h"
0022 
0023 //
0024 // constants, enums and typedefs
0025 //
0026 
0027 //
0028 // static data member definitions
0029 //
0030 
0031 //
0032 // constructors and destructor
0033 //
0034 FWViewEnergyScaleEditor::FWViewEnergyScaleEditor(FWViewEnergyScale* s, TGCompositeFrame* w, bool addAutoScaleControll)
0035     : TGVerticalFrame(w), m_scale(s), m_enabled(true) {
0036   addParam(&m_scale->m_plotEt);
0037   addParam(&m_scale->m_scaleMode);
0038   addParam(&m_scale->m_fixedValToHeight, "FixedScaleMode");
0039   if (addAutoScaleControll)
0040     addParam(&m_scale->m_maxTowerHeight, "AutomaticScaleMode");
0041 }
0042 
0043 FWViewEnergyScaleEditor::~FWViewEnergyScaleEditor() {}
0044 
0045 //
0046 // member functions
0047 //
0048 void FWViewEnergyScaleEditor::setEnabled(bool x) {
0049   m_enabled = x;
0050   typedef std::vector<std::shared_ptr<FWParameterSetterBase> > sList;
0051   for (sList::iterator i = m_setters.begin(); i != m_setters.end(); ++i) {
0052     (*i)->setEnabled(m_enabled);
0053   }
0054 }
0055 
0056 void FWViewEnergyScaleEditor::addParam(FWParameterBase* param, const char* title) {
0057   int leftPad = 0;
0058   if (title) {
0059     leftPad = 10;
0060     AddFrame(new TGLabel(this, title), new TGLayoutHints(kLHintsLeft, leftPad, 0, 0, 0));
0061     leftPad *= 2;
0062   }
0063 
0064   std::shared_ptr<FWParameterSetterBase> ptr(FWParameterSetterBase::makeSetterFor(param));
0065   ptr->attach((FWParameterBase*)param, this);
0066   TGFrame* pframe = ptr->build(this);
0067   AddFrame(pframe, new TGLayoutHints(kLHintsLeft, leftPad, 0, 0, 0));
0068   m_setters.push_back(ptr);
0069 }