25 #include "TGComboBox.h" 27 #include "TGTextEntry.h" 28 #include "TEveWindow.h" 47 static TString
path = Form(
"%s/src/Fireworks/Core/icons/",gSystem->Getenv(
"CMSSW_BASE"));
48 if ( gSystem->AccessPathName(path.Data()) ){
49 assert(gSystem->Getenv(
"CMSSW_RELEASE_BASE"));
50 path = Form(
"%s/src/Fireworks/Core/icons/",gSystem->Getenv(
"CMSSW_RELEASE_BASE"));
153 if(iBackgroundIsBlack) {
154 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-white-right-blackbg.png");
157 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-black-right-whitebg.png");
164 if(iBackgroundIsBlack) {
165 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-white-right-disabled-blackbg.png");
168 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-black-right-disabled-whitebg.png");
175 if(iBackgroundIsBlack) {
176 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-white-down-blackbg.png");
179 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-black-down-whitebg.png");
186 if(iBackgroundIsBlack) {
187 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-white-down-disabled-blackbg.png");
190 static const TGPicture*
s = gClient->GetPicture(
coreIcondir()+
"arrow-black-down-disabled-whitebg.png");
212 m_showColumnUI(
false),
215 m_useColumnsFromConfig(
false)
224 m_vert =
new TGVerticalFrame(frame);
225 frame->AddFrame(
m_vert,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
226 TGHorizontalFrame *
header =
new TGHorizontalFrame(
m_vert);
227 m_vert->AddFrame(header,
new TGLayoutHints(kLHintsTop | kLHintsExpandX));
233 m_columnUIButton->Connect(
"Clicked()",
"FWTableView",
this,
"toggleShowHide()");
234 header->AddFrame(
m_columnUIButton,
new TGLayoutHints(kLHintsCenterY | kLHintsLeft,6,10));
236 TGCompositeFrame *labfr =
new TGHorizontalFrame(header, 60, 25, kFixedSize);
237 TGLabel *
label =
new TGLabel(labfr,
"Collection");
238 labfr->AddFrame(label,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1,3,0,0));
239 header->AddFrame(labfr,
new TGLayoutHints(kLHintsLeft));
243 header->AddFrame(
m_collection,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY));
244 m_collection->Connect(
"Selected(Int_t)",
"FWTableView",
this,
"selectCollection(Int_t)");
248 TGLabel *column_control_label =
new TGLabel(
m_column_control,
"Column editor");
252 m_column_control->AddFrame(column_control_label,
new TGLayoutHints(kLHintsExpandX));
253 TGHorizontalFrame *column_control_fields =
new TGHorizontalFrame(
m_column_control);
254 m_column_control->AddFrame(column_control_fields,
new TGLayoutHints(kLHintsExpandX));
262 TGLabel *name_label =
new TGLabel(column_control_fields,
"Title");
263 TGLabel *expr_label =
new TGLabel(column_control_fields,
"Expression");
264 TGLabel *prec_label =
new TGLabel(column_control_fields,
"Precision");
265 column_control_fields->AddFrame(name_label,
new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
267 column_control_fields->AddFrame(expr_label,
new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
269 column_control_fields->AddFrame(prec_label,
new TGLayoutHints( kLHintsBottom, 1, 1, 2, 2));
271 TGTextButton *add_button =
new TGTextButton(column_control_fields,
"Add");
272 TGTextButton *del_button =
new TGTextButton(column_control_fields,
"Delete");
273 TGTextButton *mod_button =
new TGTextButton(column_control_fields,
"Modify");
274 add_button->Connect(
"Clicked()",
"FWTableView",
this,
"addColumn()");
275 del_button->Connect(
"Clicked()",
"FWTableView",
this,
"deleteColumn()");
276 mod_button->Connect(
"Clicked()",
"FWTableView",
this,
"modifyColumn()");
277 column_control_fields->AddFrame(add_button,
new TGLayoutHints);
278 column_control_fields->AddFrame(del_button,
new TGLayoutHints);
279 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();
299 frame->RemoveFrame(
m_vert);
352 collectionName =
"NULL";
384 assert(main !=
nullptr);
401 for (std::vector<const FWEventItem *>::const_iterator
412 if (sortColumn !=
nullptr && descendingSort !=
nullptr) {
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 =
nullptr;
526 const TGPicture*
down =
nullptr;
527 const TGPicture*
disabled =
nullptr;
529 if (m_showColumnUI) {
559 if (
m_iColl == index &&
nullptr == item)
567 if (selected != -1 && selected < m_collection->GetNumberOfEntries())
571 lb->SetHeight(
TMath::Min(lb->GetNumberOfEntries()*lb->GetItemVsize() + 2*lb->GetBorderWidth(), 200u));
611 assert(
nullptr!=item);
637 if(iKeyMod & kKeyControlMask) {
644 if(iButton == kButton3) {
651 if (iButton == 1 || iButton == 3)
673 char *endptr =
nullptr;
675 if (name ==
"" || expr ==
"" ||
681 fwLog(
fwlog::kInfo) <<
"adding column "<< name <<
": " << expr <<
", precision " << prec << std::endl;
717 char *endptr =
nullptr;
719 if (name ==
"" || expr ==
"" ||
725 fwLog(
fwlog::kInfo) <<
"modify column "<< name <<
": " << expr <<
", precision " << prec << std::endl;
static const std::string kDescendingSort
def splitter(iterator, n)
void addTo(FWConfiguration &) const override
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)
void columnSelected(Int_t iCol, Int_t iButton, Int_t iKeyMod)
void setFrom(const FWConfiguration &) override
const std::string & name() const
int numberOfColumns() const override
Number of columns in the table.
TableSpecs m_tableFormats
FWExpressionValidator * m_validator
int unsortedRowNumber(int iSortedRowNumber) const override
void selectCollection(Int_t)
std::vector< FWTableViewManager::TableEntry > * m_tableFormats
unsigned int version() const
FWTableViewTableManager * m_tableManager
FWColorManager & colorManager() const
void addTo(FWConfiguration &) const override
TGTextEntry * m_column_name_field
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
static const TString & coreIcondir()
void setValidator(FWValidatorBase *)
FWTableWidget * m_tableWidget
void setFrom(const FWConfiguration &) override
static const std::string kColumns
format
Some error handling for the usage.
void setBackgroundColor(Color_t)
void setFrom(const FWConfiguration &) override
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
TGCompositeFrame * m_vert
TEveWindowFrame * m_eveWindow
static const TGPicture * arrow_down_disabled(bool iBackgroundIsBlack)
int numberOfRows() const override
Number of rows in the table.
char data[epos_bytes_allocation]
Color_t foreground() const
bool m_useColumnsFromConfig
const TClass * modelType() const
FWGUIValidatingTextEntry * m_column_expr_field
FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const override
void select(int iIndex) const
const FWConfiguration * valueForKey(const std::string &iKey) const
void saveImageTo(const std::string &iName) const override
FWCustomIconsButton * m_columnUIButton
TGComboBox * m_collection
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_