#include "TStructViewerGUI.h"
#include <TRandom.h>
#include "TStructViewer.h"
#include "TStructNodeEditor.h"
#include "TStructNodeProperty.h"
#include "TStructNode.h"
#include <TCanvas.h>
#include <RQ_OBJECT.h>
#include <TGLLogicalShape.h>
#include <TGLPhysicalShape.h>
#include <TGLWidget.h>
#include <TGButtonGroup.h>
#include <TGSplitter.h>
#include <TList.h>
#include <TClass.h>
#include <TDataMember.h>
#include <TExMap.h>
#include <TPolyLine3D.h>
#include <TObjArray.h>
#include <TColor.h>
#include <TGTab.h>
#include <TGeoManager.h>
#include <TGeoMatrix.h>
#include <TMath.h>
#include <TROOT.h>
#include <TApplication.h>
ClassImp(TStructViewerGUI);
TGeoMedium* TStructViewerGUI::fgMedium = NULL;
UInt_t TStructViewerGUI::fgCounter = 0;
TStructViewerGUI::TStructViewerGUI(TStructViewer* parent, TStructNode* nodePtr, TList* colors, const TGWindow *p,UInt_t w,UInt_t h)
: TGMainFrame(p, w, h, kHorizontalFrame)
{
fParent = parent;
fNodePtr = nodePtr;
fMaxSlices = 10;
fMouseX = 0;
fMouseY = 0;
fSelectedObject = NULL;
fMaxRatio = 0;
fColors = colors;
if (!fgMedium) {
fgMedium = new TGeoMedium("MED",1,new TGeoMaterial("Mat", 26.98,13,2.7));
}
SetCleanup(kDeepCleanup);
TGVerticalFrame* leftFrame = new TGVerticalFrame(this, 200, 200, kFixedWidth);
this->AddFrame(leftFrame, new TGLayoutHints(kFixedWidth, 1, 1, 1, 1));
TGTab* tabs = new TGTab(leftFrame);
TGLayoutHints* expandX = new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 5,5,5,5);
TGCompositeFrame* infoFrame = tabs->AddTab("Info");
TGGroupFrame* fInfoMenu = new TGGroupFrame(infoFrame, "Info");
fNodeNameLabel = new TGLabel(fInfoMenu, "Name:");
fInfoMenu->AddFrame(fNodeNameLabel, expandX);
fNodeTypelabel = new TGLabel(fInfoMenu, "Type:");
fInfoMenu->AddFrame(fNodeTypelabel, expandX);
fMembersCountLabel = new TGLabel(fInfoMenu, "Members:");
fInfoMenu->AddFrame(fMembersCountLabel, expandX);
fAllMembersCountLabel = new TGLabel(fInfoMenu, "All members:");
fInfoMenu->AddFrame(fAllMembersCountLabel, expandX);
fLevelLabel = new TGLabel(fInfoMenu, "Level:");
fInfoMenu->AddFrame(fLevelLabel, expandX);
fSizeLabel = new TGLabel(fInfoMenu, "Size:");
fInfoMenu->AddFrame(fSizeLabel, expandX);
fTotalSizeLabel = new TGLabel(fInfoMenu, "Total size:");
fInfoMenu->AddFrame(fTotalSizeLabel, expandX);
infoFrame->AddFrame(fInfoMenu, expandX);
TGCompositeFrame* options = tabs->AddTab("Options");
fShowLinksCheckButton = new TGCheckButton(options, "Show links");
fShowLinksCheckButton->Connect("Toggled(Bool_t)", "TStructViewerGUI", this, "ShowLinksToggled(Bool_t)");
options->AddFrame(fShowLinksCheckButton);
fShowLinksCheckButton->SetOn();
TGVButtonGroup* scaleByGroup = new TGVButtonGroup(options, "Scale by");
fScaleBySizeButton = new TGRadioButton(scaleByGroup, "Size");
fScaleBySizeButton->Connect("Clicked()", "TStructViewerGUI", this, "ScaleByChangedSlot()");
fScaleBySizeButton->SetOn();
fScaleByMembersButton = new TGRadioButton(scaleByGroup, "Members count");
fScaleByMembersButton->Connect("Clicked()", "TStructViewerGUI", this, "ScaleByChangedSlot()");
options->AddFrame(scaleByGroup, expandX);
TGHorizontalFrame* defaultColorFrame = new TGHorizontalFrame(options);
options->AddFrame(defaultColorFrame, expandX);
TGLabel* defColorlabel = new TGLabel(defaultColorFrame, "Default color");
defaultColorFrame->AddFrame(defColorlabel, expandX);
TGColorSelect* defColorSelect = new TGColorSelect(defaultColorFrame, GetDefaultColor()->GetPixel());
defColorSelect->Connect("ColorSelected(Pixel_t)", "TStructViewerGUI", this, "ColorSelectedSlot(Pixel_t)");
defaultColorFrame->AddFrame(defColorSelect);
TGHorizontalFrame* boxHeightFrame = new TGHorizontalFrame(options);
options->AddFrame(boxHeightFrame, expandX);
TGLabel* boxHeightLabel = new TGLabel(boxHeightFrame, "Box height:");
boxHeightFrame->AddFrame(boxHeightLabel, expandX);
fBoxHeightEntry = new TGNumberEntry(boxHeightFrame, 0.1);
fBoxHeightEntry->SetLimits(TGNumberEntry::kNELLimitMin, 0.01);
fBoxHeightEntry->Connect("ValueSet(Long_t)", "TStructViewerGUI", this, "BoxHeightValueSetSlot(Long_t)");
boxHeightFrame->AddFrame(fBoxHeightEntry);
TGHorizontalFrame* levelDistanceFrame = new TGHorizontalFrame(options);
options->AddFrame(levelDistanceFrame, expandX);
TGLabel* lvlDistLabel = new TGLabel(levelDistanceFrame, "Distance between levels");
levelDistanceFrame->AddFrame(lvlDistLabel, expandX);
fLevelDistanceEntry = new TGNumberEntry(levelDistanceFrame, 1.1);
fLevelDistanceEntry->SetLimits(TGNumberEntry::kNELLimitMin, 0.01);
fLevelDistanceEntry->Connect("ValueSet(Long_t)", "TStructViewerGUI", this, "LevelDistValueSetSlot(Long_t)");
levelDistanceFrame->AddFrame(fLevelDistanceEntry);
fAutoRefesh = new TGCheckButton(options, "Auto refresh");
fAutoRefesh->SetOn();
fAutoRefesh->Connect("Toggled(Bool_t)", "TStructViewerGUI", this, "AutoRefreshButtonSlot(Bool_t)");
options->AddFrame(fAutoRefesh, expandX);
TGLabel* pointerLabel = new TGLabel(options, "Pointer:");
options->AddFrame(pointerLabel, expandX);
fPointerTextEntry = new TGTextEntry(options, "0x0000000");
options->AddFrame(fPointerTextEntry, expandX);
TGLabel* fPointerTypeLabel = new TGLabel(options, "Pointer Type:");
options->AddFrame(fPointerTypeLabel, expandX);
fPointerTypeTextEntry = new TGTextEntry(options, "TObject");
options->AddFrame(fPointerTypeTextEntry, expandX);
TGTextButton* setPointerButton = new TGTextButton(options, "Set pointer");
setPointerButton->Connect("Clicked()", "TStructViewerGUI", this, "SetPointerButtonSlot()");
options->AddFrame(setPointerButton, expandX);
TGCompositeFrame* editTab = tabs->AddTab("Editor");
fEditor = new TStructNodeEditor(fColors, editTab);
fEditor->Connect("Update(Bool_t)", "TStructViewerGUI", this, "Update(Bool_t)");
editTab->AddFrame(fEditor, expandX);
leftFrame->AddFrame(tabs, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 1,1,1,1));
TGVSplitter* splitter = new TGVSplitter(this);
splitter->SetFrame(leftFrame, true);
this->AddFrame(splitter, new TGLayoutHints(kLHintsLeft | kLHintsExpandY));
fUndoButton = new TGTextButton(leftFrame, "Undo");
fUndoButton->Connect("Clicked()", "TStructViewerGUI", this, "UndoButtonSlot()");
fUndoButton->SetEnabled(false);
leftFrame->AddFrame(fUndoButton, expandX);
fRedoButton = new TGTextButton(leftFrame, "Redo");
fRedoButton->Connect("Clicked()", "TStructViewerGUI", this, "RedoButtonSlot()");
fRedoButton->SetEnabled(false);
leftFrame->AddFrame(fRedoButton, expandX);
TGTextButton* resetCameraButton = new TGTextButton(leftFrame, "Reset camera");
leftFrame->AddFrame(resetCameraButton, expandX);
resetCameraButton->Connect("Clicked()", "TStructViewerGUI", this, "ResetButtonSlot()");
TGTextButton* updateButton = new TGTextButton(leftFrame, "Update");
updateButton->Connect("Clicked()", "TStructViewerGUI", this, "UpdateButtonSlot()");
leftFrame->AddFrame(updateButton, expandX);
TGTextButton* quitButton = new TGTextButton(leftFrame, "Quit");
leftFrame->AddFrame(quitButton, expandX);
quitButton->Connect("Clicked()", "TApplication", gApplication, "Terminate()");
fTopVolume = gGeoManager->MakeBox("TOPVolume", fgMedium,100, 100, 100);
gGeoManager->SetTopVolume(fTopVolume);
gGeoManager->SetNsegments(40);
fCanvas = new TCanvas("", "", 0, 0);
fGLViewer = new TGLEmbeddedViewer(this, fCanvas);
AddFrame(fGLViewer->GetFrame(), new TGLayoutHints(kLHintsExpandX| kLHintsExpandY, 10,10,10,10));
fGLViewer->PadPaint(fCanvas);
fGLViewer->Connect("MouseOver(TGLPhysicalShape*)", "TStructViewerGUI", this, "MouseOverSlot(TGLPhysicalShape*)");
fGLViewer->GetGLWidget()->Connect("ProcessedEvent(Event_t*)", "TStructViewerGUI", this, "GLWidgetProcessedEventSlot(Event_t*))");
fGLViewer->Connect("DoubleClicked()", "TStructViewerGUI", this, "DoubleClickedSlot()");
fGLViewer->SetCurrentCamera(TGLViewer::kCameraPerspXOY);
Update();
fGLViewer->SetResetCamerasOnUpdate(false);
SetWindowName("Struct Viewer");
MapSubwindows();
this->SetWMSizeHints(w, h, 2000, 2000, 0, 0);
Resize(GetDefaultSize());
MapWindow();
fToolTip = new TGToolTip(0, 0, "ToolTip", 500);
}
TStructViewerGUI::~TStructViewerGUI()
{
delete fCanvas;
}
void TStructViewerGUI::AutoRefreshButtonSlot(Bool_t on)
{
if (on) {
Update();
}
}
void TStructViewerGUI::BoxHeightValueSetSlot(Long_t )
{
if(fAutoRefesh->IsOn()) {
Update();
}
}
void TStructViewerGUI::CalculatePosistion(TStructNode* parent)
{
if (fScaleBySizeButton->GetState() == kButtonDown) {
TStructNode::SetScaleBy(kSize);
} else if (fScaleByMembersButton->GetState() == kButtonDown) {
TStructNode::SetScaleBy(kMembers);
}
Float_t ratio = (Float_t)((parent->GetLevel()+1.0) / parent->GetLevel());
parent->SetWidth(1);
parent->SetHeight(1);
parent->SetX(-parent->GetWidth()/2);
parent->SetY(-parent->GetHeight()/2);
fMaxRatio = parent->GetVolumeRatio();
parent->GetMembers()->Sort(kSortDescending);
Divide(parent->GetMembers(), (parent->GetX()) *ratio, (parent->GetX() + parent->GetWidth())* ratio, (parent->GetY())* ratio, (parent->GetY() + parent->GetHeight())*ratio);
Scale(parent);
}
void TStructViewerGUI::CheckMaxObjects(TStructNode* parent)
{
UInt_t object = 0;
TList queue;
queue.Add(parent);
TStructNode* node;
while ((node = (TStructNode*) queue.First() )) {
object++;
if (object > fNodePtr->GetMaxObjects() || node->GetLevel() - fNodePtr->GetLevel() >= fNodePtr->GetMaxLevel()) {
break;
}
node->SetVisible(true);
queue.AddAll(node->GetMembers());
queue.RemoveFirst();
fVisibleObjects.Add(node);
}
TIter it(&fVisibleObjects);
TStructNode* member;
while ((node = (TStructNode*) it() )) {
if(node->GetLevel() - fNodePtr->GetLevel() == fNodePtr->GetMaxLevel()-1 && node->GetMembersCount() > 0) {
node->SetCollapsed(true);
continue;
}
TIter memIt(node->GetMembers());
while ((member = (TStructNode*) memIt() )) {
if(member->IsVisible() == false) {
node->SetCollapsed(true);
break;
}
}
}
}
void TStructViewerGUI::CloseWindow()
{
DeleteWindow();
}
void TStructViewerGUI::ColorSelectedSlot(Pixel_t pixel)
{
TStructNodeProperty* prop = GetDefaultColor();
if(prop) {
prop->SetColor(pixel);
Update();
}
}
void TStructViewerGUI::Divide(TList* list, Float_t x1, Float_t x2, Float_t y1, Float_t y2)
{
if (list->GetSize() > 1) {
ULong_t sum1 = 0, sum = 0;
TStructNode* node;
TList list1, list2;
TIter it(list);
while((node = (TStructNode*) it() )) {
sum += node->GetVolume();
}
it.Reset();
while((node = (TStructNode*) it() )) {
if(sum1 >= sum/2.0) {
list2.Add(node);
} else {
sum1 += node->GetVolume();
list1.Add(node);
}
}
Float_t ratio = (float)sum1/sum;
Float_t width = x2 - x1;
Float_t height = y2 - y1;
if (width < height) {
Float_t split = y1 + ratio * height;
Divide(&list1, x1, x2, y1, split);
Divide(&list2, x1, x2, split, y2);
} else {
Float_t split = x1 + ratio * width;
Divide(&list1, x1, split, y1, y2);
Divide(&list2, split, x2, y1, y2);
}
} else if (list->GetSize() == 1) {
TStructNode* node = (TStructNode*)(list->First());
node->SetWidth(x2 - x1);
node->SetHeight(y2 - y1);
node->SetX(x1);
node->SetY(y1);
if (node->GetVolumeRatio() > fMaxRatio) {
fMaxRatio = node->GetVolumeRatio();
}
Float_t ratio = (Float_t)((node->GetLevel()+1.0)/node->GetLevel());
node->GetMembers()->Sort(kSortDescending);
Divide(node->GetMembers(), x1*ratio, x2*ratio, y1*ratio, y2*ratio);
}
}
void TStructViewerGUI::DoubleClickedSlot()
{
if (fSelectedObject) {
if(fSelectedObject == fNodePtr) {
return;
}
fUndoList.Add(fNodePtr);
fNodePtr = fSelectedObject;
fUndoButton->SetEnabled(true);
Update(kTRUE);
}
}
void TStructViewerGUI::Draw(Option_t* )
{
fVolumes.Clear();
CheckMaxObjects(fNodePtr);
CalculatePosistion(fNodePtr);
DrawVolumes(fNodePtr);
if(fShowLinksCheckButton->GetState() == kButtonDown) {
DrawLink(fNodePtr);
}
UnCheckMaxObjects();
}
void TStructViewerGUI::DrawLink(TStructNode* parent)
{
if(parent->GetLevel() - fNodePtr->GetLevel() >= fNodePtr->GetMaxLevel()) {
return;
}
if(parent->IsCollapsed()) {
return;
}
TIter it(parent->GetMembers());
TStructNode* node;
while((node = (TStructNode*) it())) {
TPolyLine3D *l = new TPolyLine3D(2);
l->SetPoint(0 ,node->GetCenter(), node->GetMiddle(), -(node->GetLevel() * fLevelDistanceEntry->GetNumber()));
l->SetPoint(1 ,parent->GetCenter(), parent->GetMiddle(), -(parent->GetLevel() * fLevelDistanceEntry->GetNumber()));
l->SetLineColor(GetColor(node));
l->SetLineWidth(1);
l->Draw();
if(!node->IsCollapsed()) {
DrawLink(node);
}
}
}
void TStructViewerGUI::DrawNode(TStructNode* node)
{
TGeoVolume* vol;
if(node->GetNodeType() == kCollection) {
vol = gGeoManager->MakeBox(Form("%s_%d", node->GetName(), fgCounter++), fgMedium, 0.45*node->GetWidth(), 0.45*node->GetHeight(), fBoxHeightEntry->GetNumber());
Float_t slices = (Float_t)(node->GetMembersCount());
if (slices > fMaxSlices) {
slices = (Float_t)fMaxSlices;
}
for (Float_t i = -(slices-1)/2; i < slices/2; i++) {
TGeoVolume* sub = gGeoManager->MakeBox(Form("%s_%d", node->GetName(), fgCounter++), fgMedium,0.45*node->GetWidth() * 0.7 / slices, 0.45*node->GetHeight(), fBoxHeightEntry->GetNumber());
sub->SetLineColor(GetColor(node));
fVolumes.Add((Long_t)sub, (Long_t)node);
TGeoTranslation* subtrans = new TGeoTranslation("subtranslation", i * node->GetWidth() / slices, 0, 0);
vol->AddNodeOverlap(sub, 1, subtrans);
}
} else {
vol = gGeoManager->MakeBox(Form("%s_%d", node->GetName(), fgCounter++), fgMedium, 0.45*node->GetWidth(), 0.45*node->GetHeight(), fBoxHeightEntry->GetNumber());
}
vol->SetLineColor(GetColor(node));
vol->SetLineWidth(1);
TGeoTranslation* trans = new TGeoTranslation("translation", node->GetCenter(), node->GetMiddle(), -(node->GetLevel() * fLevelDistanceEntry->GetNumber()));
fVolumes.Add((Long_t)vol, (Long_t)node);
fTopVolume->AddNode(vol,1, trans);
}
void TStructViewerGUI::DrawVolumes(TStructNode* parent)
{
if(parent->GetLevel() - fNodePtr->GetLevel() >= fNodePtr->GetMaxLevel()) {
return;
}
DrawNode(parent);
if(parent->IsCollapsed()) {
return;
}
TIter nextVis(parent->GetMembers());
TStructNode* node;
while((node = (TStructNode*)nextVis())) {
DrawVolumes(node);
}
}
TStructNodeProperty* TStructViewerGUI::FindNodeProperty(TStructNode* node)
{
TIter it(fColors);
TStructNodeProperty* prop;
while ((prop = (TStructNodeProperty*) it() )) {
TString propName(prop->GetName());
if (propName.EndsWith("+")) {
if (TClass* cl = TClass::GetClass(node->GetTypeName())) {
propName.Remove(propName.Length()-1, 1);
if (cl->InheritsFrom(propName.Data())) {
return prop;
}
}
} else {
if (propName == TString(node->GetTypeName())) {
return prop;
}
}
}
return (TStructNodeProperty*)fColors->Last();
}
TCanvas* TStructViewerGUI::GetCanvas()
{
return fCanvas;
}
Int_t TStructViewerGUI::GetColor(TStructNode* node)
{
TStructNodeProperty* prop = FindNodeProperty(node);
if (prop) {
return prop->GetColor().GetNumber();
}
return 2;
}
TStructNodeProperty* TStructViewerGUI::GetDefaultColor()
{
return ((TStructNodeProperty*)(fColors->Last()));
}
Bool_t TStructViewerGUI::GetLinksVisibility() const
{
if (fShowLinksCheckButton->GetState() == kButtonDown) {
return true;
} else {
return false;
}
}
TStructNode* TStructViewerGUI::GetNodePtr() const
{
return fNodePtr;
}
void TStructViewerGUI::GLWidgetProcessedEventSlot(Event_t* event)
{
switch (event->fType) {
case kMotionNotify:
fMouseX = event->fXRoot + 15;
fMouseY = event->fYRoot + 15;
break;
case kButtonPress:
fToolTip->Hide();
if (fSelectedObject) {
UpdateLabels(fSelectedObject);
fEditor->SetModel(fSelectedObject);
}
break;
default:
break;
}
}
void TStructViewerGUI::LevelDistValueSetSlot(Long_t )
{
if(fAutoRefesh->IsOn()) {
Update(kTRUE);
}
}
void TStructViewerGUI::MouseOverSlot(TGLPhysicalShape* shape)
{
fToolTip->Hide();
fSelectedObject = NULL;
if (shape && shape->GetLogical()) {
fSelectedObject = (TStructNode*)(shape->GetLogical()->ID());
if (fSelectedObject) {
if (fSelectedObject->IsA()->InheritsFrom("TPolyLine3D")) {
fSelectedObject = NULL;
return;
}
Long_t shapeID = (Long_t)(shape->GetLogical()->ID());
Long_t volValue = (Long_t)fVolumes.GetValue(shapeID);
fSelectedObject = (TStructNode*)volValue;
fToolTip->SetText(TString(fSelectedObject->GetName()) + "\n" + fSelectedObject->GetTypeName());
fToolTip->SetPosition(fMouseX, fMouseY);
fToolTip->Reset();
UpdateLabels(fSelectedObject);
}
}
}
void TStructViewerGUI::RedoButtonSlot()
{
fUndoList.Add(fNodePtr);
fUndoButton->SetEnabled(true);
fNodePtr = (TStructNode*) fRedoList.Last();
fRedoList.RemoveLast();
if (!fRedoList.First()) {
fRedoButton->SetEnabled(false);
}
Update(kTRUE);
UpdateLabels(fNodePtr);
}
void TStructViewerGUI::ResetButtonSlot()
{
fGLViewer->UpdateScene();
fGLViewer->ResetCurrentCamera();
}
void TStructViewerGUI::Scale(TStructNode* parent)
{
Float_t newRatio = (Float_t)(TMath::Sqrt(parent->GetRelativeVolumeRatio()/fMaxRatio));
parent->SetX(parent->GetX() + parent->GetWidth()/2);
parent->SetY(parent->GetY() + parent->GetHeight()/2);
Float_t min = (Float_t)TMath::Min(parent->GetWidth(), parent->GetHeight());
parent->SetWidth(parent->GetWidth() * newRatio);
parent->SetHeight(parent->GetHeight() * newRatio);
Float_t sqrt = (Float_t)(TMath::Sqrt(parent->GetWidth() * parent->GetHeight()));
if (min > sqrt) {
parent->SetWidth(sqrt);
parent->SetHeight(sqrt);
} else {
if (parent->GetHeight() > parent->GetWidth()) {
parent->SetWidth(min);
parent->SetHeight(sqrt * sqrt / min);
} else {
parent->SetWidth(sqrt * sqrt / min);
parent->SetHeight(min);
}
}
parent->SetX(parent->GetX() - parent->GetWidth()/2);
parent->SetY(parent->GetY() - parent->GetHeight()/2);
TStructNode* node;
TIter it(parent->GetMembers());
while ((node = (TStructNode*) it() )) {
Scale(node);
}
}
void TStructViewerGUI::SetNodePtr(TStructNode* val)
{
fNodePtr = val;
Update(kTRUE);
}
void TStructViewerGUI::SetLinksVisibility(Bool_t visible)
{
if (visible) {
fShowLinksCheckButton->SetState(kButtonDown);
} else {
fShowLinksCheckButton->SetState(kButtonUp);
}
}
void TStructViewerGUI::SetPointerButtonSlot()
{
void* obj = (void*)gROOT->ProcessLine(fPointerTextEntry->GetText());
fParent->SetPointer(obj, fPointerTypeTextEntry->GetText());
}
void TStructViewerGUI::ShowLinksToggled(Bool_t )
{
if (fAutoRefesh->IsOn()) {
Update();
}
}
void TStructViewerGUI::UnCheckMaxObjects()
{
TStructNode* node;
TIter it(&fVisibleObjects);
while ((node = (TStructNode*) it() )) {
node->SetCollapsed(false);
node->SetVisible(false);
}
fVisibleObjects.Clear();
}
void TStructViewerGUI::Update(Bool_t resetCamera)
{
if (!fNodePtr) {
return;
}
fCanvas->GetListOfPrimitives()->Clear();
fTopVolume->ClearNodes();
Draw();
fCanvas->GetListOfPrimitives()->Add(fTopVolume);
fGLViewer->UpdateScene();
if(resetCamera) {
fGLViewer->ResetCurrentCamera();
}
}
void TStructViewerGUI::UpdateButtonSlot()
{
Update();
}
void TStructViewerGUI::UpdateLabels(TStructNode* node)
{
fNodeNameLabel->SetText(node->GetName());
fNodeTypelabel->SetText(node->GetTypeName());
TString name = "Members: ";
name += node->GetMembersCount();
fMembersCountLabel->SetText(name);
name = "All members: ";
name += node->GetAllMembersCount();
fAllMembersCountLabel->SetText(name);
name = "Level: ";
name += node->GetLevel();
fLevelLabel->SetText(name);
name = "Size: ";
name += node->GetSize();
fSizeLabel->SetText(name);
name = "Total size: ";
name += node->GetTotalSize();
fTotalSizeLabel->SetText(name);
}
void TStructViewerGUI::UndoButtonSlot()
{
fRedoList.Add(fNodePtr);
fRedoButton->SetEnabled(true);
fNodePtr = (TStructNode*) fUndoList.Last();
fUndoList.RemoveLast();
if (!fUndoList.First()) {
fUndoButton->SetEnabled(false);
}
Update(kTRUE);
UpdateLabels(fNodePtr);
}
void TStructViewerGUI::ScaleByChangedSlot()
{
if (fAutoRefesh->IsOn()) {
Update();
}
}