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

TGo4SetScaleValues.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 TGo4SetScaleValues::init()
00017 {
00018    connect(TGo4WorkSpace::Instance(), SIGNAL(panelSignal(TGo4ViewPanel*, TPad*, int)),
00019           this, SLOT(panelSlot(TGo4ViewPanel*, TPad*, int)));
00020 
00021    fbDoingRefresh = false;
00022 
00023    refreshView(true);
00024 }
00025 
00026 void TGo4SetScaleValues::closeEvent( QCloseEvent* ce )
00027 {
00028     ce->accept();
00029     delete this;
00030 }
00031 
00032 void TGo4SetScaleValues::refreshView(bool force)
00033 {
00034    if (fbDoingRefresh) return;
00035 
00036    fbDoingRefresh = true;
00037 
00038    if (force) {
00039       XminV->clearModified();
00040       XmaxV->clearModified();
00041       YminV->clearModified();
00042       YmaxV->clearModified();
00043       ZminV->clearModified();
00044       ZmaxV->clearModified();
00045    }
00046 
00047    TGo4ViewPanel* panel = TGo4WorkSpace::Instance()->GetActivePanel();
00048 
00049    setEnabled(panel!=0);
00050 
00051    if (panel!=0) {
00052 
00053       setCaption(QString("Scale values: ") + panel->name());
00054 
00055       int ndim = 0;
00056       double Xmin=0, Xmax=0, Ymin=0, Ymax=0, Zmin=0, Zmax=0;
00057       bool autoscale;
00058 
00059       panel->GetSelectedRange(ndim, autoscale, Xmin, Xmax, Ymin, Ymax, Zmin, Zmax);
00060 
00061       AutoScaleButton->setChecked(autoscale);
00062 
00063       if (!XminV->isModified())
00064          XminV->setText(QString::number(Xmin));
00065       if (!XmaxV->isModified())
00066          XmaxV->setText(QString::number(Xmax));
00067       if (!YminV->isModified())
00068          YminV->setText(QString::number(Ymin));
00069       if (!YmaxV->isModified())
00070          YmaxV->setText(QString::number(Ymax));
00071       if (!ZminV->isModified())
00072          ZminV->setText(QString::number(Zmin));
00073       if (!ZmaxV->isModified())
00074          ZmaxV->setText(QString::number(Zmax));
00075 
00076       // enables/disables text edit for y
00077       switch(ndim) {
00078          case 1:
00079             YminV->setDisabled(autoscale);
00080             YmaxV->setDisabled(autoscale);
00081             ZminV->setDisabled(true);
00082             ZmaxV->setDisabled(true);
00083             break;
00084          case 2:
00085             YminV->setDisabled(false);
00086             YmaxV->setDisabled(false);
00087             ZminV->setDisabled(autoscale);
00088             ZmaxV->setDisabled(autoscale);
00089             break;
00090          default:
00091             YminV->setDisabled(false);
00092             YmaxV->setDisabled(false);
00093             ZminV->setDisabled(false);
00094             ZmaxV->setDisabled(false);
00095             break;
00096       }
00097 
00098    } else {
00099       setCaption(QString("Scale values: none"));
00100 
00101       XminV->setText("");
00102       XmaxV->setText("");
00103       YminV->setText("");
00104       YmaxV->setText("");
00105       ZminV->setText("");
00106       ZmaxV->setText("");
00107    }
00108 
00109    fbDoingRefresh = false;
00110 }
00111 
00112 
00113 void TGo4SetScaleValues::panelSlot(TGo4ViewPanel* panel, TPad* pad, int signalid)
00114 {
00115    switch (signalid) {
00116       case QGo4Widget::panel_Activated:
00117       case QGo4Widget::panel_Deleted:
00118          refreshView(true);
00119          break;
00120       case QGo4Widget::panel_ActiveUpdated:
00121          refreshView(false);
00122          break;
00123    }
00124 }
00125 
00126 void TGo4SetScaleValues::ApplyValues()
00127 {
00128    if (fbDoingRefresh) return;
00129 
00130    TGo4ViewPanel* panel = TGo4WorkSpace::Instance()->GetActivePanel();
00131    if (panel==0) return;
00132 
00133    double Xmin = XminV->text().toDouble();
00134    double Xmax = XmaxV->text().toDouble();
00135    double Ymin = YminV->text().toDouble();
00136    double Ymax = YmaxV->text().toDouble();
00137    double Zmin = ZminV->text().toDouble();
00138    double Zmax = ZmaxV->text().toDouble();
00139 
00140    fbDoingRefresh = true;
00141    panel->SetSelectedRange(Xmin, Xmax, Ymin, Ymax, Zmin, Zmax);
00142    fbDoingRefresh = false;
00143 
00144    refreshView(true);
00145 }
00146 
00147 void TGo4SetScaleValues::AutoscaleChanged(bool on)
00148 {
00149    if (fbDoingRefresh) return;
00150    TGo4ViewPanel* panel = TGo4WorkSpace::Instance()->GetActivePanel();
00151    if (panel==0) return;
00152 
00153    fbDoingRefresh = true;
00154    panel->SetAutoScale(on, 0);
00155    fbDoingRefresh = false;
00156 
00157    refreshView(true);
00158 }
00159 
00160 //----------------------------END OF GO4 SOURCE FILE ---------------------

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