Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4TreeViewer.ui.h

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 void TGo4TreeViewer::init()
00017 {
00018    fxTreeName = "";
00019    TreeDrawBtn->setEnabled(FALSE);
00020    setAcceptDrops(FALSE);
00021    QToolTip::add(this, "Tree is not selected. Drag and drop leaf item from browser to X, Y or Z field");
00022 }
00023 
00024 void TGo4TreeViewer::ResetWidget()
00025 {
00026    QGo4Widget::ResetWidget();
00027    XFieldEdt->clear();
00028    YFieldEdt->clear();
00029    ZFieldEdt->clear();
00030    HistNameEdt->clear();
00031    CutEdt->clear();
00032    TreeDrawBtn->setEnabled(FALSE);
00033    fxTreeName = "";
00034    QToolTip::add(this, "Tree is not selected. Drag and drop leaf item from browser to X, Y or Z field");
00035 }
00036 
00037 void TGo4TreeViewer::WorkWithLeaf(const char* itemname)
00038 {
00039    ResetWidget();
00040    XFieldEdt->setText(itemname);
00041    ProcessDropEvent(XFieldEdt, true);
00042 }
00043 
00044 void TGo4TreeViewer::XFieldEdt_dropped()
00045 {
00046    ProcessDropEvent(XFieldEdt, true);
00047 }
00048 
00049 void TGo4TreeViewer::YFieldEdt_dropped()
00050 {
00051    ProcessDropEvent(YFieldEdt, true);
00052 }
00053 
00054 void TGo4TreeViewer::ZFieldEdt_dropped()
00055 {
00056    ProcessDropEvent(ZFieldEdt, true);
00057 }
00058 
00059 void TGo4TreeViewer::cutEdit_dropped()
00060 {
00061    ProcessDropEvent(CutEdt, false);
00062 }
00063 
00064 void TGo4TreeViewer::ProcessDropEvent(QGo4LineEdit* edt, bool caninit)
00065 {
00066    QString value = edt->text();
00067 
00068    TGo4BrowserProxy* br = Browser();
00069    if (br==0) return;
00070 
00071    if (fxTreeName.length()==0) {
00072       if (!caninit) {
00073           StatusMessage("First drop something on X, Y or Z field");
00074           edt->setText("");
00075           return;
00076       }
00077 
00078       TString treename;
00079       if (!br->DefineTreeName(value.latin1(), treename)) {
00080           StatusMessage(QString("Invalid tree ") + value);
00081           edt->setText("");
00082           return;
00083       }
00084       fxTreeName = treename.Data();
00085       QToolTip::add(this, QString("Selected tree: ") + fxTreeName);
00086 
00087       TreeDrawBtn->setEnabled(TRUE);
00088       AddLink(treename.Data(), "Tree");
00089    }
00090 
00091    TString leafname;
00092    if (!br->DefineLeafName(value.latin1(), fxTreeName.latin1(), leafname)) {
00093       edt->setText("");
00094       StatusMessage(QString("Invalid leaf name ") + value);
00095       return;
00096    }
00097 
00098    edt->setText(leafname.Data());
00099 }
00100 
00101 void TGo4TreeViewer::TreeDrawBtn_clicked()
00102 {
00103    if (fxTreeName.isEmpty()) {
00104       StatusMessage("No tree specified");
00105       return;
00106    }
00107 
00108    if(XFieldEdt->text().isEmpty()) {
00109       StatusMessage("Treedraw without x coordinate expression");
00110       return;
00111    }
00112 
00113    TGo4BrowserProxy* br = Browser();
00114    if (br==0) return;
00115 
00116    QApplication::setOverrideCursor(Qt::WaitCursor);
00117 
00118    TString createdh;
00119 
00120    br->PerformTreeDraw(fxTreeName.latin1(),
00121                        XFieldEdt->text().latin1(),
00122                        YFieldEdt->text().latin1(),
00123                        ZFieldEdt->text().latin1(),
00124                        CutEdt->text().latin1(),
00125                        HistNameEdt->text().latin1(),
00126                        createdh);
00127 
00128     if (createdh.Length()>0) {
00129        HistNameEdt->setText(createdh.Data());
00130        DrawItem(createdh.Data());
00131     } else {
00132         if (WhereItemDrawn(HistNameEdt->text().latin1())==0)
00133            DrawItem(HistNameEdt->text().latin1());
00134         else
00135            br->RequestBrowserObject(HistNameEdt->text().latin1());
00136     }
00137 
00138    QApplication::restoreOverrideCursor();
00139 }
00140 
00141 void TGo4TreeViewer::TreeClearBtn_clicked()
00142 {
00143    ResetWidget();
00144 }
00145 
00146 void TGo4TreeViewer::NewHistBtn_clicked()
00147 {
00148    if (fxTreeName.length()>0)
00149      AskToCreateObject(TH1::Class(), BrowserItemRemote(fxTreeName.latin1()) ? 1 : 0);
00150 }
00151 
00152 void TGo4TreeViewer::requestedObjectCreated(const char* itemname, TClass* cl)
00153 {
00154    if ((cl!=0) && cl->InheritsFrom(TH1::Class()))
00155       HistNameEdt->setText(itemname);
00156 }
00157 
00158 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:22 2008 for Go4-v3.04-1 by  doxygen 1.4.2