17 #include <boost/shared_ptr.hpp>
26 #include "TGComboBox.h"
28 #include "TGTextEntry.h"
29 #include "TEveWindow.h"
48 static TString
path = Form(
"%s/src/Fireworks/Core/icons/",gSystem->Getenv(
"CMSSW_BASE"));
49 if ( gSystem->AccessPathName(path.Data()) ){
50 assert(gSystem->Getenv(
"CMSSW_RELEASE_BASE"));
51 path = Form(
"%s/src/Fireworks/Core/icons/",gSystem->Getenv(
"CMSSW_RELEASE_BASE"));
154 if(iBackgroundIsBlack) {
155 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-white-right-blackbg.png");
158 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-black-right-whitebg.png");
165 if(iBackgroundIsBlack) {
166 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-white-right-disabled-blackbg.png");
169 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-black-right-disabled-whitebg.png");
176 if(iBackgroundIsBlack) {
177 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-white-down-blackbg.png");
180 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-black-down-whitebg.png");
187 if(iBackgroundIsBlack) {
188 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-white-down-disabled-blackbg.png");
191 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-black-down-disabled-whitebg.png");
213 m_showColumnUI(
false),
216 m_useColumnsFromConfig(
false)
220 TGCompositeFrame *frame =
m_eveWindow->GetGUICompositeFrame();
225 m_vert =
new TGVerticalFrame(frame);
226 frame->AddFrame(
m_vert,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
227 TGHorizontalFrame *header =
new TGHorizontalFrame(
m_vert);
228 m_vert->AddFrame(header,
new TGLayoutHints(kLHintsTop | kLHintsExpandX));
234 m_columnUIButton->Connect(
"Clicked()",
"FWTableView",
this,
"toggleShowHide()");
235 header->AddFrame(
m_columnUIButton,
new TGLayoutHints(kLHintsCenterY | kLHintsLeft,6,10));
237 TGCompositeFrame *labfr =
new TGHorizontalFrame(header, 60, 25, kFixedSize);
238 TGLabel *
label =
new TGLabel(labfr,
"Collection");
239 labfr->AddFrame(label,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1,3,0,0));
240 header->AddFrame(labfr,
new TGLayoutHints(kLHintsLeft));
244 header->AddFrame(
m_collection,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY));
245 m_collection->Connect(
"Selected(Int_t)",
"FWTableView",
this,
"selectCollection(Int_t)");
249 TGLabel *column_control_label =
new TGLabel(
m_column_control,
"Column editor");
253 m_column_control->AddFrame(column_control_label,
new TGLayoutHints(kLHintsExpandX));
254 TGHorizontalFrame *column_control_fields =
new TGHorizontalFrame(
m_column_control);
255 m_column_control->AddFrame(column_control_fields,
new TGLayoutHints(kLHintsExpandX));
263 TGLabel *name_label =
new TGLabel(column_control_fields,
"Title");
264 TGLabel *expr_label =
new TGLabel(column_control_fields,
"Expression");
265 TGLabel *prec_label =
new TGLabel(column_control_fields,
"Precision");
266 column_control_fields->AddFrame(name_label,
new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
268 column_control_fields->AddFrame(expr_label,
new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
270 column_control_fields->AddFrame(prec_label,
new TGLayoutHints( kLHintsBottom, 1, 1, 2, 2));
272 TGTextButton *add_button =
new TGTextButton(column_control_fields,
"Add");
273 TGTextButton *del_button =
new TGTextButton(column_control_fields,
"Delete");
274 TGTextButton *mod_button =
new TGTextButton(column_control_fields,
"Modify");
275 add_button->Connect(
"Clicked()",
"FWTableView",
this,
"addColumn()");
276 del_button->Connect(
"Clicked()",
"FWTableView",
this,
"deleteColumn()");
277 mod_button->Connect(
"Clicked()",
"FWTableView",
this,
"modifyColumn()");
278 column_control_fields->AddFrame(add_button,
new TGLayoutHints);
279 column_control_fields->AddFrame(del_button,
new TGLayoutHints);
280 column_control_fields->AddFrame(mod_button,
new TGLayoutHints);
284 m_tableWidget->Connect(
"rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)",
"FWTableView",
285 this,
"modelSelected(Int_t,Int_t,Int_t,Int_t,Int_t)");
286 m_tableWidget->Connect(
"columnClicked(Int_t,Int_t,Int_t)",
"FWTableView",
287 this,
"columnSelected(Int_t,Int_t,Int_t)");
289 frame->MapSubwindows();
298 TGCompositeFrame *frame =
m_eveWindow->GetGUICompositeFrame();
299 frame->RemoveFrame(
m_vert);
352 collectionName =
"NULL";
401 for (std::vector<const FWEventItem *>::const_iterator
412 if (sortColumn != 0 && descendingSort != 0) {
414 bool descending = descendingSort->
version();
420 std::cerr <<
"This configuration file contains tables, but no column information. "
421 "(It is probably old.) Using defaults." << std::endl;
463 size_t ss = textRenderer->
data().size();
464 if (widths[
c] < ss) widths[
c] = ss;
477 TString headerFormat;
478 headerFormat.Form(
"%%%ds",ndheader +3);
479 data.Form(headerFormat,
" ");
480 printf(
"%s", data.Data());
486 format.Form(
"%%%ds", (
int)widths[
c]);
490 printf(
"%s", data.Data());
492 printf(
"%s | ", data.Data());
500 headerFormat.Form(
"[%%%dd] ",ndheader );
507 printf(
"%s", data.Data());
509 format.Form(
"%%%ds", (
int)widths[
c]);
511 data.Form(format, textRenderer->
data().c_str());
513 printf(
"%s", data.Data());
515 printf(
"%s | ", data.Data());
525 const TGPicture* picture = 0;
526 const TGPicture* down = 0;
527 const TGPicture* disabled = 0;
529 if (m_showColumnUI) {
559 if (
m_iColl == index && 0 == item)
567 if (selected != -1 && selected < m_collection->GetNumberOfEntries())
571 lb->SetHeight(
TMath::Min(lb->GetNumberOfEntries()*lb->GetItemVsize() + 2*lb->GetBorderWidth(), 200u));
637 if(iKeyMod & kKeyControlMask) {
644 if(iButton == kButton3) {
651 if (iButton == 1 || iButton == 3)
675 if (name ==
"" || expr ==
"" ||
681 fwLog(
fwlog::kInfo) <<
"adding column "<< name <<
": " << expr <<
", precision " << prec << std::endl;
719 if (name ==
"" || expr ==
"" ||
725 fwLog(
fwlog::kInfo) <<
"modify column "<< name <<
": " << expr <<
", precision " << prec << std::endl;
static const std::string kDescendingSort
virtual FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const
void addToImpl(FWConfiguration &) const
Color_t background() const
void setType(const edm::TypeWithDict &)
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)
virtual int unsortedRowNumber(int iSortedRowNumber) const
virtual int numberOfRows() const
Number of rows in the table.
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)
TableSpecs::iterator tableFormats(const edm::TypeWithDict &key)
const Items & items() const
std::string const collectionName[nCollections]
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
const std::string & data()
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)
char data[epos_bytes_allocation]
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
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
virtual void addTo(FWConfiguration &) const