File indexing completed on 2024-04-06 12:11:36
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include <iostream>
0015 #include <vector>
0016 #include <functional>
0017 #include "TGButton.h"
0018 #include "TGResourcePool.h"
0019 #include "TVirtualX.h"
0020 #include "Fireworks/Core/src/FWColorSelect.h"
0021 #include "Fireworks/Core/src/FWBoxIconButton.h"
0022 #include "Fireworks/Core/src/FWCheckBoxIcon.h"
0023 #include "Fireworks/Core/src/FWColorBoxIcon.h"
0024
0025
0026 #include "Fireworks/Core/src/FWCollectionSummaryWidget.h"
0027 #include "Fireworks/Core/interface/FWEventItem.h"
0028 #include "Fireworks/Core/interface/FWCustomIconsButton.h"
0029
0030 #include "Fireworks/Core/src/FWCollectionSummaryTableManager.h"
0031 #include "Fireworks/TableWidget/interface/FWTableWidget.h"
0032
0033 #include "Fireworks/Core/interface/FWSelectionManager.h"
0034 #include "Fireworks/Core/interface/FWModelChangeManager.h"
0035 #include "Fireworks/Core/interface/FWColorManager.h"
0036
0037
0038
0039
0040 struct FWCollectionSummaryWidgetConnectionHolder {
0041 std::vector<sigc::connection> m_connections;
0042
0043 ~FWCollectionSummaryWidgetConnectionHolder() {
0044 for_each(
0045 m_connections.begin(), m_connections.end(), std::bind(&sigc::connection::disconnect, std::placeholders::_1));
0046 }
0047 void push_back(const sigc::connection& iC) { m_connections.push_back(iC); }
0048 void reserve(size_t iSize) { m_connections.reserve(iSize); }
0049 };
0050
0051
0052
0053
0054 namespace {
0055 class BorderlessTextButton : public TGTextButton {
0056 public:
0057 BorderlessTextButton(const TGWindow* p = nullptr,
0058 const char* s = nullptr,
0059 Int_t id = -1,
0060 GContext_t norm = GetDefaultGC()(),
0061 FontStruct_t font = GetDefaultFontStruct())
0062 : TGTextButton(p, s, id, norm, font, 0) {
0063
0064 fMTop = -3;
0065 fMBottom = -3;
0066 }
0067
0068 void DoRedraw() override;
0069 };
0070
0071 void BorderlessTextButton::DoRedraw() {
0072 gVirtualX->ClearArea(fId, fBorderWidth, fBorderWidth, fWidth - (fBorderWidth << 1), fHeight - (fBorderWidth << 1));
0073
0074
0075 int x, y;
0076 if (fTMode & kTextLeft) {
0077 x = fMLeft + 4;
0078 } else if (fTMode & kTextRight) {
0079 x = fWidth - fTWidth - fMRight - 4;
0080 } else {
0081 x = (fWidth - fTWidth + fMLeft - fMRight) >> 1;
0082 }
0083
0084 if (fTMode & kTextTop) {
0085 y = fMTop + 3;
0086 } else if (fTMode & kTextBottom) {
0087 y = fHeight - fTHeight - fMBottom - 3;
0088 } else {
0089 y = (fHeight - fTHeight + fMTop - fMBottom) >> 1;
0090 }
0091
0092 Int_t hotpos = fLabel->GetHotPos();
0093
0094 fTLayout->DrawText(fId, fNormGC, x, y, 0, -1);
0095 if (hotpos)
0096 fTLayout->UnderlineChar(fId, fNormGC, x, y, hotpos - 1);
0097 }
0098 }
0099
0100 static const TGPicture* filtered(bool iBackgroundIsBlack) {
0101 if (iBackgroundIsBlack) {
0102 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "filtered-blackbg.png");
0103 return s;
0104 }
0105 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "filtered-whitebg.png");
0106 return s;
0107 }
0108
0109 static const TGPicture* filtered_over(bool iBackgroundIsBlack) {
0110 if (iBackgroundIsBlack) {
0111 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "filtered-whitebg-over.png");
0112 return s;
0113 }
0114 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "filtered-whitebg-over.png");
0115 return s;
0116 }
0117
0118 static const TGPicture* alert_over(bool iBackgroundIsBlack) {
0119 if (iBackgroundIsBlack) {
0120 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "icon-alert-blackbg-over.png");
0121 return s;
0122 }
0123 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "icon-alert-whitebg-over.png");
0124 return s;
0125 }
0126
0127 static const TGPicture* alert(bool iBackgroundIsBlack) {
0128 if (iBackgroundIsBlack) {
0129 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "icon-alert-blackbg.png");
0130 return s;
0131 }
0132 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "icon-alert-whitebg.png");
0133 return s;
0134 }
0135
0136 static const TGPicture* unfiltered(bool iBackgroundIsBlack) {
0137 if (iBackgroundIsBlack) {
0138 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "unfiltered-blackbg.png");
0139 return s;
0140 }
0141 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "unfiltered-whitebg.png");
0142 return s;
0143 }
0144 static const TGPicture* unfiltered_over(bool iBackgroundIsBlack) {
0145 if (iBackgroundIsBlack) {
0146 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "unfiltered-blackbg-over.png");
0147 return s;
0148 }
0149 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "unfiltered-whitebg-over.png");
0150 return s;
0151 }
0152
0153 static const TGPicture* info(bool iBackgroundIsBlack) {
0154 if (iBackgroundIsBlack) {
0155 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "info2-blackbg.png");
0156 return s;
0157 }
0158 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "info2-whitebg.png");
0159 return s;
0160 }
0161
0162 static const TGPicture* info_over(bool iBackgroundIsBlack) {
0163 if (iBackgroundIsBlack) {
0164 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "info2-blackbg-over.png");
0165 return s;
0166 }
0167 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "info2-whitebg-over.png");
0168 return s;
0169 }
0170
0171 static const TGPicture* info_disabled(bool iBackgroundIsBlack) {
0172 if (iBackgroundIsBlack) {
0173 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "info2-blackbg-disabled.png");
0174 return s;
0175 }
0176 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "info2-whitebg-disabled.png");
0177 return s;
0178 }
0179
0180 static const TGPicture* arrow_right(bool iBackgroundIsBlack) {
0181 if (iBackgroundIsBlack) {
0182 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "arrow-white-right-blackbg.png");
0183 return s;
0184 }
0185 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "arrow-black-right-whitebg.png");
0186 return s;
0187 }
0188
0189 static const TGPicture* arrow_right_disabled(bool iBackgroundIsBlack) {
0190 if (iBackgroundIsBlack) {
0191 static const TGPicture* s =
0192 gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "arrow-white-right-disabled-blackbg.png");
0193 return s;
0194 }
0195 static const TGPicture* s =
0196 gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "arrow-black-right-disabled-whitebg.png");
0197 return s;
0198 }
0199
0200 static const TGPicture* arrow_down(bool iBackgroundIsBlack) {
0201 if (iBackgroundIsBlack) {
0202 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "arrow-white-down-blackbg.png");
0203 return s;
0204 }
0205 static const TGPicture* s = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "arrow-black-down-whitebg.png");
0206 return s;
0207 }
0208
0209 static const TGPicture* arrow_down_disabled(bool iBackgroundIsBlack) {
0210 if (iBackgroundIsBlack) {
0211 static const TGPicture* s =
0212 gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "arrow-white-down-disabled-blackbg.png");
0213 return s;
0214 }
0215 static const TGPicture* s =
0216 gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "arrow-black-down-disabled-whitebg.png");
0217 return s;
0218 }
0219
0220 static const unsigned long kWidgetColor = 0x2f2f2f;
0221 static const unsigned long kWidgetColorLight = 0xdfdfdf;
0222
0223
0224
0225 FWCollectionSummaryWidget::FWCollectionSummaryWidget(TGFrame* iParent, FWEventItem& iItem, TGLayoutHints* iHints)
0226 : TGCompositeFrame(iParent),
0227 m_collection(&iItem),
0228 m_hints(iHints),
0229 m_parent(iParent),
0230 m_collectionShown(false),
0231 m_tableContext(nullptr),
0232 m_indexForColor(-1),
0233 m_colorPopup(nullptr),
0234 m_tableManager(nullptr),
0235 m_tableWidget(nullptr),
0236 m_backgroundIsWhite(false),
0237 m_connectionHolder(new FWCollectionSummaryWidgetConnectionHolder) {
0238 SetBackgroundColor(kWidgetColor);
0239 const unsigned int backgroundColor = kBlack;
0240
0241 TGCompositeFrame* hFrame = new TGHorizontalFrame(this, 10, 10, 0, backgroundColor);
0242 m_holder = hFrame;
0243 this->AddFrame(hFrame, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
0244
0245 m_showHideButton = new FWCustomIconsButton(this,
0246 arrow_right(!m_backgroundIsWhite),
0247 arrow_right_disabled(!m_backgroundIsWhite),
0248 arrow_right_disabled(!m_backgroundIsWhite));
0249 m_showHideButton->Connect("Clicked()", "FWCollectionSummaryWidget", this, "toggleShowHide()");
0250 m_showHideButton->SetToolTipText("show/hide individual collection items");
0251 m_collectionShown = false;
0252 hFrame->AddFrame(m_showHideButton, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 6, 10));
0253
0254
0255
0256 m_isVisibleCheckBox = new FWCheckBoxIcon(12);
0257 m_isVisibleButton = new FWBoxIconButton(this, m_isVisibleCheckBox, -1, GetWhiteGC()());
0258 m_isVisibleButton->SetBackgroundColor(backgroundColor);
0259 m_isVisibleButton->SetToolTipText("make all items in collection visible/invisible");
0260 hFrame->AddFrame(m_isVisibleButton, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 0, 1));
0261 m_isVisibleButton->Connect("Clicked()", "FWCollectionSummaryWidget", this, "toggleItemVisible()");
0262
0263 m_colorSelectBox = new FWColorBoxIcon(12);
0264 m_colorSelectWidget = new FWBoxIconButton(this, m_colorSelectBox, -1, GetWhiteGC()());
0265 hFrame->AddFrame(m_colorSelectWidget, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 1));
0266
0267 m_colorSelectWidget->Connect("Clicked()", "FWCollectionSummaryWidget", this, "colorClicked()");
0268 m_colorSelectWidget->SetBackgroundColor(backgroundColor);
0269 m_colorSelectWidget->SetToolTipText("set default color of items in collection");
0270 GCValues_t t = *(GetWhiteGC().GetAttributes());
0271 m_graphicsContext = gClient->GetResourcePool()->GetGCPool()->GetGC(&t, kTRUE);
0272 m_colorSelectBox->setColor(m_graphicsContext->GetGC());
0273
0274 m_label = new BorderlessTextButton(this, m_collection->name().c_str());
0275 m_label->SetBackgroundColor(backgroundColor);
0276 m_label->SetTextJustify(kTextLeft | kTextCenterY);
0277 m_label->SetTextColor(static_cast<Pixel_t>(gVirtualX->GetPixel(kWhite)));
0278 hFrame->AddFrame(m_label, new TGLayoutHints(kLHintsCenterY | kLHintsLeft | kLHintsExpandX, 5, 5));
0279 m_label->Connect("Clicked()", "FWCollectionSummaryWidget", this, "labelClicked()");
0280 m_label->SetToolTipText("select collection and show controller");
0281
0282 m_stateButton = new FWCustomIconsButton(this,
0283 unfiltered(!m_backgroundIsWhite),
0284 unfiltered_over(!m_backgroundIsWhite),
0285 unfiltered_over(!m_backgroundIsWhite));
0286 hFrame->AddFrame(m_stateButton, new TGLayoutHints(kLHintsCenterY | kLHintsLeft));
0287 itemChanged();
0288 displayChanged();
0289 m_stateButton->Connect("Clicked()", "FWCollectionSummaryWidget", this, "stateClicked()");
0290 m_stateButton->SetToolTipText("select collection and show filter");
0291
0292 m_infoButton = new FWCustomIconsButton(
0293 this, info(!m_backgroundIsWhite), info_over(!m_backgroundIsWhite), info_disabled(!m_backgroundIsWhite));
0294 hFrame->AddFrame(m_infoButton, new TGLayoutHints(kLHintsCenterY | kLHintsRight, 2, 2));
0295 m_infoButton->Connect("Clicked()", "FWCollectionSummaryWidget", this, "infoClicked()");
0296 m_infoButton->SetToolTipText("select collection and show data info");
0297
0298 m_connectionHolder->reserve(3);
0299 m_connectionHolder->push_back(m_collection->defaultDisplayPropertiesChanged_.connect(
0300 std::bind(&FWCollectionSummaryWidget::displayChanged, this)));
0301 m_connectionHolder->push_back(
0302 m_collection->itemChanged_.connect(std::bind(&FWCollectionSummaryWidget::itemChanged, this)));
0303 m_connectionHolder->push_back(
0304 m_collection->filterChanged_.connect(std::bind(&FWCollectionSummaryWidget::itemChanged, this)));
0305
0306 MapSubwindows();
0307 Layout();
0308 MapWindow();
0309 }
0310
0311
0312
0313
0314
0315
0316 FWCollectionSummaryWidget::~FWCollectionSummaryWidget() {
0317 delete m_colorPopup;
0318
0319
0320
0321
0322
0323
0324
0325
0326 gClient->GetResourcePool()->GetGCPool()->FreeGC(m_graphicsContext->GetGC());
0327 delete m_connectionHolder;
0328 }
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342
0343
0344
0345 static void setLabelBackgroundColor(TGTextButton* iLabel, bool iIsSelected, bool iBackgroundIsWhite) {
0346 if (iIsSelected) {
0347 if (iBackgroundIsWhite) {
0348 iLabel->SetBackgroundColor(0x7777FF);
0349 } else {
0350 iLabel->SetBackgroundColor(0x0000FF);
0351 }
0352 } else {
0353 if (iBackgroundIsWhite) {
0354 iLabel->SetBackgroundColor(0xFFFFFF);
0355 } else {
0356 iLabel->SetBackgroundColor(0x000000);
0357 }
0358 }
0359 }
0360
0361 void FWCollectionSummaryWidget::displayChanged() {
0362 m_graphicsContext->SetForeground(gVirtualX->GetPixel(m_collection->defaultDisplayProperties().color()));
0363 fClient->NeedRedraw(m_colorSelectWidget);
0364 m_isVisibleCheckBox->setChecked(m_collection->defaultDisplayProperties().isVisible());
0365 fClient->NeedRedraw(m_isVisibleButton);
0366 setLabelBackgroundColor(m_label, m_collection->itemIsSelected(), m_backgroundIsWhite);
0367 fClient->NeedRedraw(m_label);
0368 }
0369
0370 void FWCollectionSummaryWidget::itemChanged() {
0371 const TGPicture* picture = nullptr;
0372 const TGPicture* down = nullptr;
0373 const TGPicture* disabled = nullptr;
0374 if (m_collection->hasError()) {
0375 picture = alert(!m_backgroundIsWhite);
0376 down = alert_over(!m_backgroundIsWhite);
0377 disabled = alert_over(!m_backgroundIsWhite);
0378 m_stateButton->SetToolTipText(m_collection->errorMessage().c_str());
0379 } else {
0380 if (!m_collection->filterExpression().empty()) {
0381 picture = filtered(!m_backgroundIsWhite);
0382 down = filtered_over(!m_backgroundIsWhite);
0383 disabled = filtered_over(!m_backgroundIsWhite);
0384 } else {
0385 picture = unfiltered(!m_backgroundIsWhite);
0386 down = unfiltered_over(!m_backgroundIsWhite);
0387 disabled = unfiltered_over(!m_backgroundIsWhite);
0388 }
0389 m_stateButton->SetToolTipText("select collection and show filter");
0390 }
0391 m_stateButton->swapIcons(picture, down, disabled);
0392 }
0393
0394 void FWCollectionSummaryWidget::colorChangeRequested(Color_t color) {
0395 if (-1 == m_indexForColor) {
0396 FWDisplayProperties changeProperties = m_collection->defaultDisplayProperties();
0397 changeProperties.setColor(color);
0398 m_collection->setDefaultDisplayProperties(changeProperties);
0399 return;
0400 }
0401
0402 FWDisplayProperties changeProperties = m_collection->modelInfo(m_indexForColor).displayProperties();
0403 changeProperties.setColor(color);
0404 m_collection->setDisplayProperties(m_indexForColor, changeProperties);
0405 }
0406
0407 void FWCollectionSummaryWidget::toggleItemVisible() {
0408 m_isVisibleCheckBox->setChecked(!m_isVisibleCheckBox->isChecked());
0409 FWDisplayProperties changeProperties = m_collection->defaultDisplayProperties();
0410 changeProperties.setIsVisible(m_isVisibleCheckBox->isChecked());
0411 m_collection->setDefaultDisplayProperties(changeProperties);
0412 fClient->NeedRedraw(m_isVisibleButton);
0413 }
0414
0415 static TGGC* selectContext() {
0416 static TGGC* s_context = nullptr;
0417 if (nullptr == s_context) {
0418 GCValues_t hT = *(gClient->GetResourcePool()->GetSelectedGC()->GetAttributes());
0419 s_context = gClient->GetResourcePool()->GetGCPool()->GetGC(&hT, kTRUE);
0420 s_context->SetForeground(s_context->GetBackground());
0421
0422 }
0423 return s_context;
0424 }
0425
0426 void FWCollectionSummaryWidget::toggleShowHide() {
0427 const TGPicture* picture = nullptr;
0428 const TGPicture* down = nullptr;
0429 const TGPicture* disabled = nullptr;
0430
0431 if (m_collectionShown) {
0432 picture = arrow_right(!m_backgroundIsWhite);
0433 down = arrow_right_disabled(!m_backgroundIsWhite);
0434 disabled = arrow_right_disabled(!m_backgroundIsWhite);
0435 m_collectionShown = false;
0436 HideFrame(m_tableWidget);
0437 m_hints->SetLayoutHints(kLHintsExpandX);
0438 } else {
0439 picture = arrow_down(!m_backgroundIsWhite);
0440 down = arrow_down_disabled(!m_backgroundIsWhite);
0441 disabled = arrow_down_disabled(!m_backgroundIsWhite);
0442 m_collectionShown = true;
0443
0444 if (nullptr == m_tableManager) {
0445 GCValues_t t = *(GetWhiteGC().GetAttributes());
0446 t.fFont = gClient->GetResourcePool()->GetIconFont()->GetFontHandle();
0447 m_tableContext = gClient->GetResourcePool()->GetGCPool()->GetGC(&t, kTRUE);
0448
0449 TGGC* hilightContext = selectContext();
0450 m_tableManager = new FWCollectionSummaryTableManager(m_collection, m_tableContext, hilightContext, this);
0451 m_tableWidget = new FWTableWidget(m_tableManager, this);
0452 m_tableWidget->SetHeaderBackgroundColor(fClient->GetResourcePool()->GetFrameGC()->GetBackground());
0453 colorTable();
0454 AddFrame(m_tableWidget, new TGLayoutHints(kLHintsBottom | kLHintsExpandX | kLHintsExpandY));
0455 m_tableWidget->Connect("rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)",
0456 "FWCollectionSummaryWidget",
0457 this,
0458 "modelSelected(Int_t,Int_t,Int_t,Int_t,Int_t)");
0459
0460 MapSubwindows();
0461 Layout();
0462 }
0463 ShowFrame(m_tableWidget);
0464 m_hints->SetLayoutHints(kLHintsExpandX | kLHintsExpandY);
0465
0466
0467
0468 m_tableWidget->Resize(m_tableWidget->GetWidth(), m_tableWidget->GetHeight());
0469 }
0470
0471 if (nullptr != m_parent) {
0472 m_parent->Layout();
0473 }
0474 m_showHideButton->swapIcons(picture, down, disabled);
0475 }
0476
0477 void FWCollectionSummaryWidget::createColorPopup() {
0478 if (nullptr == m_colorPopup) {
0479 std::vector<Color_t> colors;
0480 m_collection->colorManager()->fillLimitedColors(colors);
0481
0482 m_colorPopup = new FWColorPopup(gClient->GetDefaultRoot(), m_collection->defaultDisplayProperties().color());
0483 m_colorPopup->InitContent(m_collection->name().c_str(), colors);
0484 m_colorPopup->Connect("ColorSelected(Color_t)", "FWCollectionSummaryWidget", this, "colorChangeRequested(Color_t)");
0485 }
0486 }
0487
0488 void FWCollectionSummaryWidget::colorClicked() {
0489 FWColorManager* cm = m_collection->colorManager();
0490 m_indexForColor = -1;
0491
0492 createColorPopup();
0493 Window_t wdummy;
0494 Int_t ax, ay;
0495 gVirtualX->TranslateCoordinates(m_colorSelectWidget->GetId(),
0496 gClient->GetDefaultRoot()->GetId(),
0497 0,
0498 m_colorSelectWidget->GetHeight(),
0499 ax,
0500 ay,
0501 wdummy);
0502 m_colorPopup->SetName(m_collection->name().c_str());
0503 std::vector<Color_t> colors;
0504 cm->fillLimitedColors(colors);
0505 m_colorPopup->ResetColors(colors, cm->backgroundColorIndex() == FWColorManager::kBlackIndex);
0506 m_colorPopup->SetSelection(m_collection->defaultDisplayProperties().color());
0507 m_colorPopup->PlacePopup(ax, ay, m_colorPopup->GetDefaultWidth(), m_colorPopup->GetDefaultHeight());
0508 }
0509
0510 void FWCollectionSummaryWidget::itemColorClicked(int iIndex, Int_t iRootX, Int_t iRootY) {
0511 FWColorManager* cm = m_collection->colorManager();
0512 m_indexForColor = iIndex;
0513
0514 createColorPopup();
0515 std::vector<Color_t> colors;
0516 cm->fillLimitedColors(colors);
0517 m_colorPopup->ResetColors(colors, cm->backgroundColorIndex() == FWColorManager::kBlackIndex);
0518 m_colorPopup->SetName(m_collection->modelName(iIndex).c_str());
0519 m_colorPopup->SetSelection(m_collection->modelInfo(iIndex).displayProperties().color());
0520 m_colorPopup->PlacePopup(iRootX, iRootY, m_colorPopup->GetDefaultWidth(), m_colorPopup->GetDefaultHeight());
0521 }
0522
0523 void FWCollectionSummaryWidget::modelSelected(Int_t iRow, Int_t iButton, Int_t iKeyMod, Int_t iGlobalX, Int_t iGlobalY) {
0524 if (iKeyMod & kKeyControlMask) {
0525 m_collection->toggleSelect(iRow);
0526 } else {
0527 FWChangeSentry sentry(*(m_collection->changeManager()));
0528 m_collection->selectionManager()->clearSelection();
0529 m_collection->select(iRow);
0530 }
0531 if (iButton == kButton3) {
0532 requestForModelContextMenu(iGlobalX, iGlobalY);
0533 }
0534 }
0535
0536 void FWCollectionSummaryWidget::requestForInfo(FWEventItem* iItem) {
0537 Emit("requestForInfo(FWEventItem*)", reinterpret_cast<long>(iItem));
0538 }
0539
0540 void FWCollectionSummaryWidget::requestForFilter(FWEventItem* iItem) {
0541 Emit("requestForFilter(FWEventItem*)", reinterpret_cast<long>(iItem));
0542 }
0543
0544 void FWCollectionSummaryWidget::requestForErrorInfo(FWEventItem* iItem) {
0545 Emit("requestForErrorInfo(FWEventItem*)", reinterpret_cast<long>(iItem));
0546 }
0547
0548 void FWCollectionSummaryWidget::requestForController(FWEventItem* iItem) {
0549 Emit("requestForController(FWEventItem*)", reinterpret_cast<long>(iItem));
0550 }
0551
0552 void FWCollectionSummaryWidget::requestForModelContextMenu(Int_t iGlobalX, Int_t iGlobalY) {
0553 Long_t args[2];
0554 args[0] = static_cast<Long_t>(iGlobalX);
0555 args[1] = static_cast<Long_t>(iGlobalY);
0556 Emit("requestForModelContextMenu(Int_t,Int_t)", args);
0557 }
0558
0559 void FWCollectionSummaryWidget::infoClicked() {
0560 if (!m_collection->itemIsSelected()) {
0561
0562 m_collection->selectionManager()->clearSelection();
0563 m_collection->selectItem();
0564 }
0565 requestForInfo(m_collection);
0566 }
0567
0568 void FWCollectionSummaryWidget::stateClicked() {
0569 if (!m_collection->itemIsSelected()) {
0570
0571 m_collection->selectionManager()->clearSelection();
0572 m_collection->selectItem();
0573 }
0574 requestForFilter(m_collection);
0575 }
0576
0577 void FWCollectionSummaryWidget::labelClicked() {
0578 if (!m_collection->itemIsSelected()) {
0579
0580 m_collection->selectionManager()->clearSelection();
0581 m_collection->selectItem();
0582 }
0583 requestForController(m_collection);
0584 }
0585
0586 void FWCollectionSummaryWidget::setBackgroundToWhite(bool iToWhite) {
0587 if (iToWhite == m_backgroundIsWhite) {
0588 return;
0589 }
0590 Pixel_t bc = 0x000000;
0591 Pixel_t fg = 0xffffff;
0592 if (iToWhite) {
0593 bc = 0xffffff;
0594 fg = 0x000000;
0595 m_backgroundIsWhite = true;
0596 SetBackgroundColor(kWidgetColorLight);
0597 m_isVisibleButton->setNormCG(GetBlackGC()());
0598 m_colorSelectWidget->setNormCG(GetBlackGC()());
0599 selectContext()->SetForeground(0xafafFF);
0600 } else {
0601 m_backgroundIsWhite = false;
0602 SetBackgroundColor(kWidgetColor);
0603 m_isVisibleButton->setNormCG(GetWhiteGC()());
0604 m_colorSelectWidget->setNormCG(GetWhiteGC()());
0605 selectContext()->SetForeground(gClient->GetResourcePool()->GetSelectedGC()->GetBackground());
0606 }
0607
0608 itemChanged();
0609 m_graphicsContext->SetForeground(gVirtualX->GetPixel(m_collection->defaultDisplayProperties().color()));
0610 {
0611 const TGPicture* picture = info(!m_backgroundIsWhite);
0612 const TGPicture* over = info_over(!m_backgroundIsWhite);
0613 const TGPicture* disabled = info_disabled(!m_backgroundIsWhite);
0614 m_infoButton->swapIcons(picture, over, disabled);
0615 }
0616 if (m_collectionShown) {
0617 const TGPicture* picture = arrow_down(!m_backgroundIsWhite);
0618 const TGPicture* down = arrow_down_disabled(!m_backgroundIsWhite);
0619 const TGPicture* disabled = arrow_down_disabled(!m_backgroundIsWhite);
0620 m_showHideButton->swapIcons(picture, down, disabled);
0621 } else {
0622 const TGPicture* picture = arrow_right(!m_backgroundIsWhite);
0623 const TGPicture* down = arrow_right_disabled(!m_backgroundIsWhite);
0624 const TGPicture* disabled = arrow_right_disabled(!m_backgroundIsWhite);
0625 m_showHideButton->swapIcons(picture, down, disabled);
0626 }
0627 colorTable();
0628 m_holder->SetBackgroundColor(bc);
0629 setLabelBackgroundColor(m_label, m_collection->itemIsSelected(), m_backgroundIsWhite);
0630 m_label->SetTextColor(fg);
0631 m_isVisibleButton->SetBackgroundColor(bc);
0632 m_colorSelectWidget->SetBackgroundColor(bc);
0633 fClient->NeedRedraw(m_isVisibleButton);
0634 fClient->NeedRedraw(m_colorSelectWidget);
0635 fClient->NeedRedraw(m_holder);
0636 fClient->NeedRedraw(this);
0637 }
0638
0639 void FWCollectionSummaryWidget::colorTable() {
0640 if (nullptr == m_tableWidget) {
0641 return;
0642 }
0643 if (m_backgroundIsWhite) {
0644 m_tableWidget->SetBackgroundColor(kWidgetColorLight);
0645 m_tableWidget->SetLineSeparatorColor(0x000000);
0646 m_tableContext->SetForeground(0x000000);
0647 } else {
0648 m_tableWidget->SetBackgroundColor(kWidgetColor);
0649 m_tableWidget->SetLineSeparatorColor(0xffffff);
0650 m_tableContext->SetForeground(0xffffff);
0651 }
0652 }
0653
0654
0655
0656
0657
0658
0659
0660
0661 ClassImp(FWCollectionSummaryWidget);