17 #include <boost/shared_ptr.hpp>
24 #include "TGComboBox.h"
26 #include "TGTextEntry.h"
27 #include "TEveWindow.h"
46 static TString
path = Form(
"%s/src/Fireworks/Core/icons/",gSystem->Getenv(
"CMSSW_BASE"));
47 if ( gSystem->AccessPathName(path.Data()) ){
48 assert(gSystem->Getenv(
"CMSSW_RELEASE_BASE"));
49 path = Form(
"%s/src/Fireworks/Core/icons/",gSystem->Getenv(
"CMSSW_RELEASE_BASE"));
152 if(iBackgroundIsBlack) {
153 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-white-right-blackbg.png");
156 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-black-right-whitebg.png");
163 if(iBackgroundIsBlack) {
164 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-white-right-disabled-blackbg.png");
167 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-black-right-disabled-whitebg.png");
174 if(iBackgroundIsBlack) {
175 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-white-down-blackbg.png");
178 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-black-down-whitebg.png");
185 if(iBackgroundIsBlack) {
186 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-white-down-disabled-blackbg.png");
189 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-black-down-disabled-whitebg.png");
211 m_showColumnUI(
false),
214 m_useColumnsFromConfig(
false)
218 TGCompositeFrame *frame =
m_eveWindow->GetGUICompositeFrame();
223 m_vert =
new TGVerticalFrame(frame);
224 frame->AddFrame(
m_vert,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
225 TGHorizontalFrame *header =
new TGHorizontalFrame(
m_vert);
226 m_vert->AddFrame(header,
new TGLayoutHints(kLHintsTop | kLHintsExpandX));
232 m_columnUIButton->Connect(
"Clicked()",
"FWTableView",
this,
"toggleShowHide()");
233 header->AddFrame(
m_columnUIButton,
new TGLayoutHints(kLHintsCenterY | kLHintsLeft,6,10));
235 TGCompositeFrame *labfr =
new TGHorizontalFrame(header, 60, 25, kFixedSize);
236 TGLabel *
label =
new TGLabel(labfr,
"Collection");
237 labfr->AddFrame(label,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1,3,0,0));
238 header->AddFrame(labfr,
new TGLayoutHints(kLHintsLeft));
242 header->AddFrame(
m_collection,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY));
243 m_collection->Connect(
"Selected(Int_t)",
"FWTableView",
this,
"selectCollection(Int_t)");
247 TGLabel *column_control_label =
new TGLabel(
m_column_control,
"Column editor");
251 m_column_control->AddFrame(column_control_label,
new TGLayoutHints(kLHintsExpandX));
252 TGHorizontalFrame *column_control_fields =
new TGHorizontalFrame(
m_column_control);
253 m_column_control->AddFrame(column_control_fields,
new TGLayoutHints(kLHintsExpandX));
261 TGLabel *name_label =
new TGLabel(column_control_fields,
"Title");
262 TGLabel *expr_label =
new TGLabel(column_control_fields,
"Expression");
263 TGLabel *prec_label =
new TGLabel(column_control_fields,
"Precision");
264 column_control_fields->AddFrame(name_label,
new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
266 column_control_fields->AddFrame(expr_label,
new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
268 column_control_fields->AddFrame(prec_label,
new TGLayoutHints( kLHintsBottom, 1, 1, 2, 2));
270 TGTextButton *add_button =
new TGTextButton(column_control_fields,
"Add");
271 TGTextButton *del_button =
new TGTextButton(column_control_fields,
"Delete");
272 TGTextButton *mod_button =
new TGTextButton(column_control_fields,
"Modify");
273 add_button->Connect(
"Clicked()",
"FWTableView",
this,
"addColumn()");
274 del_button->Connect(
"Clicked()",
"FWTableView",
this,
"deleteColumn()");
275 mod_button->Connect(
"Clicked()",
"FWTableView",
this,
"modifyColumn()");
276 column_control_fields->AddFrame(add_button,
new TGLayoutHints);
277 column_control_fields->AddFrame(del_button,
new TGLayoutHints);
278 column_control_fields->AddFrame(mod_button,
new TGLayoutHints);
282 m_tableWidget->Connect(
"rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)",
"FWTableView",
283 this,
"modelSelected(Int_t,Int_t,Int_t,Int_t,Int_t)");
284 m_tableWidget->Connect(
"columnClicked(Int_t,Int_t,Int_t)",
"FWTableView",
285 this,
"columnSelected(Int_t,Int_t,Int_t)");
287 frame->MapSubwindows();
296 TGCompositeFrame *frame =
m_eveWindow->GetGUICompositeFrame();
297 frame->RemoveFrame(
m_vert);
346 std::string collectionName;
350 collectionName =
"NULL";
397 const std::string &collectionName = collection->
value();
399 for (std::vector<const FWEventItem *>::const_iterator
403 if (*it && (*it)->name() == collectionName) {
410 if (sortColumn != 0 && descendingSort != 0) {
412 bool descending = descendingSort->
version();
418 std::cerr <<
"This configuration file contains tables, but no column information. "
419 "(It is probably old.) Using defaults." << std::endl;
454 const TGPicture* picture = 0;
455 const TGPicture* down = 0;
456 const TGPicture* disabled = 0;
458 if (m_showColumnUI) {
488 if (
m_iColl == index && 0 == item)
496 if (selected != -1 && selected < m_collection->GetNumberOfEntries())
500 lb->SetHeight(
TMath::Min(lb->GetNumberOfEntries()*lb->GetItemVsize() + 2*lb->GetBorderWidth(), 200u));
566 if(iKeyMod & kKeyControlMask) {
573 if(iButton == kButton3) {
580 if (iButton == 1 || iButton == 3)
604 if (name ==
"" || expr ==
"" ||
610 fwLog(
fwlog::kInfo) <<
"adding column "<< name <<
": " << expr <<
", precision " << prec << std::endl;
648 if (name ==
"" || expr ==
"" ||
654 fwLog(
fwlog::kInfo) <<
"modify column "<< name <<
": " << expr <<
", precision " << prec << std::endl;
static const std::string kDescendingSort
void addToImpl(FWConfiguration &) const
Color_t background() const
FWTableViewManager * m_manager
void dataChanged()
Called if mouse button pressed in Row Header, defaults is to do nothing.
TGTextEntry * m_column_prec_field
static const TGPicture * arrow_down(bool iBackgroundIsBlack)
void columnSelected(Int_t iCol, Int_t iButton, Int_t iKeyMod)
const std::string & name() const
TableSpecs m_tableFormats
void setFrom(const FWConfiguration &)
FWExpressionValidator * m_validator
virtual void setFrom(const FWConfiguration &)
void selectCollection(Int_t)
std::vector< FWTableViewManager::TableEntry > * m_tableFormats
unsigned int version() const
FWTableViewTableManager * m_tableManager
FWColorManager & colorManager() const
virtual int numberOfColumns() const
Number of columns in the table.
TGTextEntry * m_column_name_field
int main(int argc, char **argv)
TGCompositeFrame * m_column_control
U second(std::pair< T, U > const &p)
static const TGPicture * arrow_right(bool iBackgroundIsBlack)
const Items & items() const
static const std::string kSortColumn
static const std::string kCollection
const FWEventItem * item() const
std::pair< std::string, MonitorElement * > entry
static const TString & coreIcondir()
void setValidator(FWValidatorBase *)
FWTableWidget * m_tableWidget
static const std::string kColumns
void setBackgroundColor(Color_t)
FWTableView(TEveWindowSlot *, FWTableViewManager *)
void resetColors(const class FWColorManager &)
static const TGPicture * arrow_right_disabled(bool iBackgroundIsBlack)
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
void modelSelected(Int_t iRow, Int_t iButton, Int_t iKeyMod, Int_t, Int_t)
static const std::string kTableView
const std::string & value(unsigned int iIndex=0) const
FWSelectionManager * selectionManager() const
void toggleSelect(int iIndex) const
virtual void setFrom(const FWConfiguration &)
TGCompositeFrame * m_vert
TEveWindowFrame * m_eveWindow
virtual void saveImageTo(const std::string &iName) const
static const TGPicture * arrow_down_disabled(bool iBackgroundIsBlack)
Color_t foreground() const
bool m_useColumnsFromConfig
const TClass * modelType() const
virtual void addTo(FWConfiguration &) const
FWGUIValidatingTextEntry * m_column_expr_field
void select(int iIndex) const
const FWConfiguration * valueForKey(const std::string &iKey) const
FWCustomIconsButton * m_columnUIButton
TGComboBox * m_collection
TableSpecs::iterator tableFormats(const Reflex::Type &key)
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
void setType(const ROOT::Reflex::Type &)
virtual void addTo(FWConfiguration &) const