25 #include "TGComboBox.h" 27 #include "TGTextEntry.h" 28 #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"));
150 if (iBackgroundIsBlack) {
151 static const TGPicture *
s = gClient->GetPicture(
coreIcondir() +
"arrow-white-right-blackbg.png");
154 static const TGPicture *
s = gClient->GetPicture(
coreIcondir() +
"arrow-black-right-whitebg.png");
159 if (iBackgroundIsBlack) {
160 static const TGPicture *
s = gClient->GetPicture(
coreIcondir() +
"arrow-white-right-disabled-blackbg.png");
163 static const TGPicture *
s = gClient->GetPicture(
coreIcondir() +
"arrow-black-right-disabled-whitebg.png");
167 static const TGPicture *
arrow_down(
bool iBackgroundIsBlack) {
168 if (iBackgroundIsBlack) {
169 static const TGPicture *
s = gClient->GetPicture(
coreIcondir() +
"arrow-white-down-blackbg.png");
172 static const TGPicture *
s = gClient->GetPicture(
coreIcondir() +
"arrow-black-down-whitebg.png");
177 if (iBackgroundIsBlack) {
178 static const TGPicture *
s = gClient->GetPicture(
coreIcondir() +
"arrow-white-down-disabled-blackbg.png");
181 static const TGPicture *
s = gClient->GetPicture(
coreIcondir() +
"arrow-black-down-disabled-whitebg.png");
203 m_showColumnUI(
false),
206 m_useColumnsFromConfig(
false)
215 m_vert =
new TGVerticalFrame(frame);
216 frame->AddFrame(
m_vert,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
217 TGHorizontalFrame *
header =
new TGHorizontalFrame(
m_vert);
218 m_vert->AddFrame(header,
new TGLayoutHints(kLHintsTop | kLHintsExpandX));
222 m_columnUIButton->Connect(
"Clicked()",
"FWTableView",
this,
"toggleShowHide()");
223 header->AddFrame(
m_columnUIButton,
new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 6, 10));
225 TGCompositeFrame *labfr =
new TGHorizontalFrame(header, 60, 25, kFixedSize);
226 TGLabel *
label =
new TGLabel(labfr,
"Collection");
227 labfr->AddFrame(label,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 3, 0, 0));
228 header->AddFrame(labfr,
new TGLayoutHints(kLHintsLeft));
232 header->AddFrame(
m_collection,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY));
233 m_collection->Connect(
"Selected(Int_t)",
"FWTableView",
this,
"selectCollection(Int_t)");
237 TGLabel *column_control_label =
new TGLabel(
m_column_control,
"Column editor");
241 m_column_control->AddFrame(column_control_label,
new TGLayoutHints(kLHintsExpandX));
242 TGHorizontalFrame *column_control_fields =
new TGHorizontalFrame(
m_column_control);
243 m_column_control->AddFrame(column_control_fields,
new TGLayoutHints(kLHintsExpandX));
251 TGLabel *name_label =
new TGLabel(column_control_fields,
"Title");
252 TGLabel *expr_label =
new TGLabel(column_control_fields,
"Expression");
253 TGLabel *prec_label =
new TGLabel(column_control_fields,
"Precision");
254 column_control_fields->AddFrame(name_label,
new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
256 column_control_fields->AddFrame(expr_label,
new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
258 column_control_fields->AddFrame(prec_label,
new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
260 TGTextButton *add_button =
new TGTextButton(column_control_fields,
"Add");
261 TGTextButton *del_button =
new TGTextButton(column_control_fields,
"Delete");
262 TGTextButton *mod_button =
new TGTextButton(column_control_fields,
"Modify");
263 add_button->Connect(
"Clicked()",
"FWTableView",
this,
"addColumn()");
264 del_button->Connect(
"Clicked()",
"FWTableView",
this,
"deleteColumn()");
265 mod_button->Connect(
"Clicked()",
"FWTableView",
this,
"modifyColumn()");
266 column_control_fields->AddFrame(add_button,
new TGLayoutHints);
267 column_control_fields->AddFrame(del_button,
new TGLayoutHints);
268 column_control_fields->AddFrame(mod_button,
new TGLayoutHints);
274 "rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)",
"FWTableView",
this,
"modelSelected(Int_t,Int_t,Int_t,Int_t,Int_t)");
275 m_tableWidget->Connect(
"columnClicked(Int_t,Int_t,Int_t)",
"FWTableView",
this,
"columnSelected(Int_t,Int_t,Int_t)");
277 frame->MapSubwindows();
286 frame->RemoveFrame(
m_vert);
333 collectionName =
"NULL";
363 assert(main !=
nullptr);
380 for (std::vector<const FWEventItem *>::const_iterator it =
m_manager->
items().begin(),
391 if (sortColumn !=
nullptr && descendingSort !=
nullptr) {
392 unsigned int sort = sortColumn->
version();
393 bool descending = descendingSort->
version();
399 std::cerr <<
"This configuration file contains tables, but no column information. " 400 "(It is probably old.) Using defaults." 439 size_t ss = textRenderer->
data().size();
453 TString headerFormat;
454 headerFormat.Form(
"%%%ds", ndheader + 3);
455 data.Form(headerFormat,
" ");
456 printf(
"%s", data.Data());
461 format.Form(
"%%%ds", (
int)widths[
c]);
465 printf(
"%s", data.Data());
467 printf(
"%s | ", data.Data());
475 headerFormat.Form(
"[%%%dd] ", ndheader);
480 printf(
"%s", data.Data());
482 format.Form(
"%%%ds", (
int)widths[
c]);
484 data.Form(format, textRenderer->
data().c_str());
486 printf(
"%s", data.Data());
488 printf(
"%s | ", data.Data());
496 const TGPicture *picture =
nullptr;
497 const TGPicture *
down =
nullptr;
498 const TGPicture *
disabled =
nullptr;
500 if (m_showColumnUI) {
528 if (
m_iColl == index &&
nullptr == item) {
535 if (selected != -1 && selected < m_collection->GetNumberOfEntries())
539 lb->SetHeight(
TMath::Min(lb->GetNumberOfEntries() * lb->GetItemVsize() + 2 * lb->GetBorderWidth(), 200u));
572 assert(
nullptr != item);
598 if (iKeyMod & kKeyControlMask) {
605 if (iButton == kButton3) {
611 if (iButton == 1 || iButton == 3)
630 char *endptr =
nullptr;
632 if (name.empty() || expr.empty() ||
m_column_prec_field->GetText() ==
nullptr || *endptr != 0) {
637 fwLog(
fwlog::kInfo) <<
"adding column " << name <<
": " << expr <<
", precision " << prec << std::endl;
669 char *endptr =
nullptr;
671 if (name.empty() || expr.empty() ||
m_column_prec_field->GetText() ==
nullptr || *endptr != 0) {
676 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.
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
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
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
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