25 #include "TGComboBox.h" 27 #include "TGTextEntry.h" 28 #include "TEveWindow.h" 29 #include "TVirtualX.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"));
151 if (iBackgroundIsBlack) {
152 static const TGPicture *
s = gClient->GetPicture(
coreIcondir() +
"arrow-white-right-blackbg.png");
155 static const TGPicture *
s = gClient->GetPicture(
coreIcondir() +
"arrow-black-right-whitebg.png");
160 if (iBackgroundIsBlack) {
161 static const TGPicture *
s = gClient->GetPicture(
coreIcondir() +
"arrow-white-right-disabled-blackbg.png");
164 static const TGPicture *
s = gClient->GetPicture(
coreIcondir() +
"arrow-black-right-disabled-whitebg.png");
168 static const TGPicture *
arrow_down(
bool iBackgroundIsBlack) {
169 if (iBackgroundIsBlack) {
170 static const TGPicture *
s = gClient->GetPicture(
coreIcondir() +
"arrow-white-down-blackbg.png");
173 static const TGPicture *
s = gClient->GetPicture(
coreIcondir() +
"arrow-black-down-whitebg.png");
178 if (iBackgroundIsBlack) {
179 static const TGPicture *
s = gClient->GetPicture(
coreIcondir() +
"arrow-white-down-disabled-blackbg.png");
182 static const TGPicture *
s = gClient->GetPicture(
coreIcondir() +
"arrow-black-down-disabled-whitebg.png");
203 m_tableWidget(nullptr),
204 m_showColumnUI(
false),
207 m_useColumnsFromConfig(
false)
217 frame->AddFrame(
m_vert,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
218 TGHorizontalFrame *
header =
new TGHorizontalFrame(
m_vert);
219 m_vert->AddFrame(
header,
new TGLayoutHints(kLHintsTop | kLHintsExpandX));
223 m_columnUIButton->Connect(
"Clicked()",
"FWTableView",
this,
"toggleShowHide()");
226 TGCompositeFrame *labfr =
new TGHorizontalFrame(
header, 60, 25, kFixedSize);
227 TGLabel *
label =
new TGLabel(labfr,
"Collection");
228 labfr->AddFrame(
label,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 3, 0, 0));
229 header->AddFrame(labfr,
new TGLayoutHints(kLHintsLeft));
233 header->AddFrame(
m_collection,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY));
234 m_collection->Connect(
"Selected(Int_t)",
"FWTableView",
this,
"selectCollection(Int_t)");
238 TGLabel *column_control_label =
new TGLabel(
m_column_control,
"Column editor");
242 m_column_control->AddFrame(column_control_label,
new TGLayoutHints(kLHintsExpandX));
243 TGHorizontalFrame *column_control_fields =
new TGHorizontalFrame(
m_column_control);
244 m_column_control->AddFrame(column_control_fields,
new TGLayoutHints(kLHintsExpandX));
252 TGLabel *name_label =
new TGLabel(column_control_fields,
"Title");
253 TGLabel *expr_label =
new TGLabel(column_control_fields,
"Expression");
254 TGLabel *prec_label =
new TGLabel(column_control_fields,
"Precision");
255 column_control_fields->AddFrame(name_label,
new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
257 column_control_fields->AddFrame(expr_label,
new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
259 column_control_fields->AddFrame(prec_label,
new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
261 TGTextButton *add_button =
new TGTextButton(column_control_fields,
"Add");
262 TGTextButton *del_button =
new TGTextButton(column_control_fields,
"Delete");
263 TGTextButton *mod_button =
new TGTextButton(column_control_fields,
"Modify");
264 add_button->Connect(
"Clicked()",
"FWTableView",
this,
"addColumn()");
265 del_button->Connect(
"Clicked()",
"FWTableView",
this,
"deleteColumn()");
266 mod_button->Connect(
"Clicked()",
"FWTableView",
this,
"modifyColumn()");
267 column_control_fields->AddFrame(add_button,
new TGLayoutHints);
268 column_control_fields->AddFrame(del_button,
new TGLayoutHints);
269 column_control_fields->AddFrame(mod_button,
new TGLayoutHints);
275 "rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)",
"FWTableView",
this,
"modelSelected(Int_t,Int_t,Int_t,Int_t,Int_t)");
276 m_tableWidget->Connect(
"columnClicked(Int_t,Int_t,Int_t)",
"FWTableView",
this,
"columnSelected(Int_t,Int_t,Int_t)");
278 frame->MapSubwindows();
381 for (std::vector<const FWEventItem *>::const_iterator
it =
m_manager->
items().begin(),
392 if (sortColumn !=
nullptr && descendingSort !=
nullptr) {
394 bool descending = descendingSort->
version();
400 std::cerr <<
"This configuration file contains tables, but no column information. " 401 "(It is probably old.) Using defaults." 440 size_t ss = textRenderer->
data().size();
454 TString headerFormat;
455 headerFormat.Form(
"%%%ds", ndheader + 3);
456 data.Form(headerFormat,
" ");
457 printf(
"%s",
data.Data());
462 format.Form(
"%%%ds", (
int)widths[
c]);
466 printf(
"%s",
data.Data());
468 printf(
"%s | ",
data.Data());
476 headerFormat.Form(
"[%%%dd] ", ndheader);
481 printf(
"%s",
data.Data());
483 format.Form(
"%%%ds", (
int)widths[
c]);
487 printf(
"%s",
data.Data());
489 printf(
"%s | ",
data.Data());
497 const TGPicture *picture =
nullptr;
498 const TGPicture *
down =
nullptr;
499 const TGPicture *
disabled =
nullptr;
536 if (selected != -1 && selected < m_collection->GetNumberOfEntries())
540 lb->SetHeight(
TMath::Min(lb->GetNumberOfEntries() * lb->GetItemVsize() + 2 * lb->GetBorderWidth(), 200u));
599 if (iKeyMod & kKeyControlMask) {
606 if (iButton == kButton3) {
612 if (iButton == 1 || iButton == 3)
631 char *endptr =
nullptr;
670 char *endptr =
nullptr;
static const std::string kDescendingSort
void saveImageTo(const std::string &iName) const override
def splitter(iterator, n)
FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const override
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 addTo(FWConfiguration &) const override
void columnSelected(Int_t iCol, Int_t iButton, Int_t iKeyMod)
void setFrom(const FWConfiguration &) override
FWColorManager & colorManager() const
TableSpecs m_tableFormats
FWExpressionValidator * m_validator
void selectCollection(Int_t)
void addToImpl(FWConfiguration &) const
std::vector< FWTableViewManager::TableEntry > * m_tableFormats
FWTableViewTableManager * m_tableManager
Color_t background() const
int unsortedRowNumber(int iSortedRowNumber) const override
sigc::signal< void(Int_t, Int_t)> openSelectedModelContextMenu_
void select(int iIndex) const
TGTextEntry * m_column_name_field
TGCompositeFrame * m_column_control
U second(std::pair< T, U > const &p)
static const TGPicture * arrow_right(bool iBackgroundIsBlack)
FWSelectionManager * selectionManager() const
const TClass * modelType() const
TableSpecs::iterator tableFormats(const edm::TypeWithDict &key)
int numberOfRows() const override
Number of rows in the table.
Color_t foreground() const
static const std::string kSortColumn
static const std::string kCollection
static const TString & coreIcondir()
void setValidator(FWValidatorBase *)
FWTableWidget * m_tableWidget
void setFrom(const FWConfiguration &) override
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 & data()
const Items & items() const
const std::string & name() const
TGCompositeFrame * m_vert
TEveWindowFrame * m_eveWindow
static const TGPicture * arrow_down_disabled(bool iBackgroundIsBlack)
const FWEventItem * item() const
const FWConfiguration * valueForKey(const std::string &iKey) const
char data[epos_bytes_allocation]
bool m_useColumnsFromConfig
FWGUIValidatingTextEntry * m_column_expr_field
int numberOfColumns() const override
Number of columns in the table.
FWCustomIconsButton * m_columnUIButton
TGComboBox * m_collection
void addTo(FWConfiguration &) const override
void toggleSelect(int iIndex) const
unsigned int version() const