16 #include <boost/shared_ptr.hpp>
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)
219 TGCompositeFrame *frame =
m_eveWindow->GetGUICompositeFrame();
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);
283 m_tableWidget->Connect(
"rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)",
"FWTableView",
284 this,
"modelSelected(Int_t,Int_t,Int_t,Int_t,Int_t)");
285 m_tableWidget->Connect(
"columnClicked(Int_t,Int_t,Int_t)",
"FWTableView",
286 this,
"columnSelected(Int_t,Int_t,Int_t)");
288 frame->MapSubwindows();
297 TGCompositeFrame *frame =
m_eveWindow->GetGUICompositeFrame();
298 frame->RemoveFrame(
m_vert);
351 collectionName =
"NULL";
400 for (std::vector<const FWEventItem *>::const_iterator
411 if (sortColumn != 0 && descendingSort != 0) {
413 bool descending = descendingSort->
version();
419 std::cerr <<
"This configuration file contains tables, but no column information. "
420 "(It is probably old.) Using defaults." << std::endl;
462 size_t ss = textRenderer->
data().size();
463 if (widths[
c] < ss) widths[
c] =
ss;
476 TString headerFormat;
477 headerFormat.Form(
"%%%ds",ndheader +3);
478 data.Form(headerFormat,
" ");
479 printf(
"%s", data.Data());
485 format.Form(
"%%%ds", (
int)widths[
c]);
489 printf(
"%s", data.Data());
491 printf(
"%s | ", data.Data());
499 headerFormat.Form(
"[%%%dd] ",ndheader );
506 printf(
"%s", data.Data());
508 format.Form(
"%%%ds", (
int)widths[
c]);
510 data.Form(format, textRenderer->
data().c_str());
512 printf(
"%s", data.Data());
514 printf(
"%s | ", data.Data());
524 const TGPicture* picture = 0;
525 const TGPicture*
down = 0;
526 const TGPicture* disabled = 0;
528 if (m_showColumnUI) {
558 if (
m_iColl == index && 0 == item)
566 if (selected != -1 && selected < m_collection->GetNumberOfEntries())
570 lb->SetHeight(
TMath::Min(lb->GetNumberOfEntries()*lb->GetItemVsize() + 2*lb->GetBorderWidth(), 200u));
636 if(iKeyMod & kKeyControlMask) {
643 if(iButton == kButton3) {
650 if (iButton == 1 || iButton == 3)
674 if (name ==
"" || expr ==
"" ||
680 fwLog(
fwlog::kInfo) <<
"adding column "<< name <<
": " << expr <<
", precision " << prec << std::endl;
718 if (name ==
"" || expr ==
"" ||
724 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
string format
Some error handling for the usage.
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
tuple path
else: Piece not in the list, fine.
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
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
volatile std::atomic< bool > shutdown_flag false
TGComboBox * m_collection
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
virtual void addTo(FWConfiguration &) const