Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4GUI/TGo4WindowEdit.ui.h

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE 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 /****************************************************************************
00017 ** ui.h extension file, included from the uic-generated form implementation.
00018 **
00019 ** If you wish to add, delete or rename slots use Qt Designer which will
00020 ** update this file, preserving your code. Create an init() slot in place of
00021 ** a constructor, and a destroy() slot in place of a destructor.
00022 *****************************************************************************/
00023 #include <iostream.h>
00024 
00025 void TGo4WindowEdit::ClearCounters()
00026 {
00027    fxTGo4WindowEditSlots->ClearCounters();
00028 }
00029 
00030 void TGo4WindowEdit::destroy()
00031 {
00032    TGo4LockGuard glob;
00033     fxTGo4GUIRegistry->UnRegisterClass(fxTGo4WindowEditSlots,fxTGo4WindowEditStatus);
00034     delete  fxTGo4WindowEditSlots;
00035 }
00036 
00037 void TGo4WindowEdit::init()
00038 {
00039    TGo4LockGuard glob;
00040     setAcceptDrops( TRUE );
00041     fxTGo4GUIRegistry = TGo4GUIRegistry::Instance();
00042    char SlotName[256];
00043    char Caption[256];
00044    snprintf(SlotName,255,"%s%s",name(),"_Slots" );
00045    snprintf(Caption,255,"%s%s", name(),"- Condition Editor" );
00046       setCaption( trUtf8( Caption ) );
00047     fxTGo4WindowEditSlots = (TGo4WindowEditSlots *) fxTGo4GUIRegistry->GetSlotClass(SlotName);
00048     if(fxTGo4WindowEditSlots  !=0)
00049         {
00050             fxTGo4WindowEditSlots->SetGUI(this);
00051         }
00052     else
00053         {
00054             fxTGo4WindowEditSlots = new TGo4WindowEditSlots (SlotName, "Slots Class for Qt GUI", this);
00055 
00056         }
00057     fxTGo4WindowEditStatus= dynamic_cast <TGo4WindowEditStatus *> (fxTGo4WindowEditSlots->GetStatus());
00058     fbTypingMode=true;
00059     fbAutoUpdateMode=true;
00060     fbNeedsUpdate=false;
00061     fbNewCutGState=true;
00062     fbCancelCutGState=false;
00063     fbConfirmCutGState=false;
00064     SetCentralMode(false);
00065     CondHistoLink->setShown(false); // disable change of histogram link
00066     PleaseUpdateLabel->setShown(false);
00067 }
00068 
00069 void TGo4WindowEdit::UpdatePressed()
00070 {
00071     // TGo4LockGuard glob;
00072 
00073     // make sure to update status before sending the command!
00074     if(IsCentralMode())
00075         fxTGo4WindowEditSlots->SendUpdateCommand(CondNameCombo->currentText().stripWhiteSpace());
00076     else
00077         fxTGo4WindowEditSlots->SendUpdateCommand();
00078     fbNeedsUpdate=false;
00079     PleaseUpdateLabel->setShown(fbNeedsUpdate);
00080     StatusMessage("Applied conditions to analysis.");
00081 }
00082 
00083 
00084 void TGo4WindowEdit::SelectedCond( int t )
00085 {
00086 fbTypingMode=false;
00087 if(t<0)
00088     {
00089         // this case is for the multiedit of array:
00090         fxTGo4WindowEditStatus->SetMultiEdit(kTRUE);
00091         fxTGo4WindowEditStatus->SetCurrentIndex(0);
00092         CondVisibility->setText("visible");
00093         tabWidget2->page(0)->setEnabled(false);
00094         IntegralVal->setEnabled(false);
00095         XMeanVal->setEnabled(false);
00096         XRMSVal->setEnabled(false);
00097         YMeanVal->setEnabled(false);
00098         YRMSVal->setEnabled(false);
00099         MaxXVal->setEnabled(false);
00100         MaxYVal->setEnabled(false);
00101         MaxCVal->setEnabled(false);
00102     }
00103 else
00104     {
00105         fxTGo4WindowEditStatus->SetMultiEdit(kFALSE);
00106         fxTGo4WindowEditStatus->SetCurrentIndex(t);
00107         CondVisibility->setEnabled(true);
00108         CondVisibility->setText("visible");
00109         tabWidget2->page(0)->setEnabled(true);
00110         IntegralVal->setEnabled(true);
00111         XMeanVal->setEnabled(true);
00112         XRMSVal->setEnabled(true);
00113         YMeanVal->setEnabled(true);
00114         YRMSVal->setEnabled(true);
00115         MaxXVal->setEnabled(true);
00116         MaxYVal->setEnabled(true);
00117         MaxCVal->setEnabled(true);
00118 
00119     }
00120 RefreshSelectedCondition();
00121 fxTGo4WindowEditSlots->HighlightCondition(t);
00122 fbTypingMode=true;
00123 }
00124 
00125 void TGo4WindowEdit::ArrayAll()
00126 {
00127 ArrayElements->setValue(-1); // "all" displayed
00128 
00129 }
00130 
00131 void TGo4WindowEdit::closeEvent( QCloseEvent *ce )
00132 {
00133     // TGo4LockGuard glob;
00134     ce->accept();
00135     fxTGo4WindowEditSlots->SetGUI(0);
00136     delete this;
00137 }
00138 
00139 void TGo4WindowEdit::RefreshPressed()
00140 {
00141     if(IsCentralMode())
00142         fxTGo4WindowEditSlots->SendRefreshCommand(CondNameCombo->currentText().stripWhiteSpace());
00143     else
00144         fxTGo4WindowEditSlots->SendRefreshCommand();
00145     fbNeedsUpdate=false;
00146     PleaseUpdateLabel->setShown(fbNeedsUpdate);
00147     StatusMessage("Refreshed condition from analysis.");
00148 }
00149 
00150 void TGo4WindowEdit::ChangeDisplayPad()
00151 {
00152     // we put our own condition into workpad
00153     // clean up previous pad:
00154     fxTGo4WindowEditSlots->SetMouseMode(kMouseROOT);
00155     fxTGo4WindowEditSlots->SetWorkingPad();
00156     RefreshDisplay();
00157 }
00158 
00159 void TGo4WindowEdit::enterEvent( QEvent * )
00160 {
00161     if(fbTypingMode) return; // ignore enter event when typing!
00162     if(fbAutoUpdateMode) UpdateFromPad();
00163     fbTypingMode=true;
00164         // enable updating from widget change events
00165 }
00166 
00167 void TGo4WindowEdit::leaveEvent( QEvent * )
00168 {
00169     fbTypingMode=false;
00170         // disable updating from widget change signals.
00171         // avoid circular updating if widget content is
00172         // changed from outside
00173 }
00174 
00175 void TGo4WindowEdit::SetAutoUpdate( bool on )
00176 {
00177     fbAutoUpdateMode=on;
00178 }
00179 
00180 void TGo4WindowEdit::UpdateFromPad()
00181 {
00182 fbTypingMode=false;
00183 fxTGo4WindowEditSlots->EnterEvent();
00184 RefreshSelectedCondition();
00185 if(!fbNeedsUpdate)
00186     fbNeedsUpdate = fxTGo4WindowEditSlots->NeedsUpdate();
00187 PleaseUpdateLabel->setShown(fbNeedsUpdate);
00188 fbTypingMode=true;
00189 }
00190 
00191 void TGo4WindowEdit::RefreshDisplay()
00192 {
00193     NewCutG(false);
00194     RefreshEditor();
00195     RefreshMarkers();
00196 }
00197 
00198 void TGo4WindowEdit::SetResultMode( int i )
00199 {
00200 fxTGo4WindowEditSlots->SetResultMode(i);
00201 fbNeedsUpdate=true;
00202 PleaseUpdateLabel->setShown(fbNeedsUpdate);
00203 }
00204 
00205 void TGo4WindowEdit::SetInvertMode( int i )
00206 {
00207 fxTGo4WindowEditSlots->SetInvertMode(i);
00208 fbNeedsUpdate=true;
00209 PleaseUpdateLabel->setShown(fbNeedsUpdate);
00210 }
00211 
00212 void TGo4WindowEdit::UpdateLimits()
00213 {
00214 //if(!fbTypingMode) return; // we accept return press when mouse is outside editor
00215 Double_t x1 =Win1_low->text().toDouble();
00216 Double_t x2 =Win1_up->text().toDouble();
00217 Double_t y1 =Win2_low->text().toDouble();
00218 Double_t y2 =Win2_up->text().toDouble();
00219 fxTGo4WindowEditSlots->SetLimits(x1,x2,y1,y2);
00220 DrawConditions();
00221 fbNeedsUpdate=true;
00222 PleaseUpdateLabel->setShown(fbNeedsUpdate);
00223 }
00224 
00225 void TGo4WindowEdit::RefreshEditor()
00226 {
00227 // get here all values from condition under work and put in widgets:
00228 //TGo4LockGuard Global;
00229 fbTypingMode=false;
00230 //------ overall condition (array) name: ------------
00231 TGo4Condition* con=fxTGo4WindowEditStatus->GetCondition();
00232 if(con)
00233     CondNameCombo->changeItem(con->GetName(),CondNameCombo->currentItem());
00234 else
00235     CondNameCombo->changeItem("Enter_condition_name",CondNameCombo->currentItem());
00236 //----- update mode: -----------
00237 AutoUpdateSwitch->setChecked(fbAutoUpdateMode);
00238 PleaseUpdateLabel->setShown(fbNeedsUpdate);
00239 //----- array or not: -----------
00240 if(fxTGo4WindowEditStatus->IsArray())
00241     {
00242         Int_t maxi=fxTGo4WindowEditStatus->GetNumberOfConditions();
00243         if(maxi>__MAXMARKERS__) maxi=__MAXMARKERS__;
00244         ArrayElements->setEnabled(true);
00245         ArrayAllButton->setEnabled(true);
00246         ArrayElements->setMaxValue(maxi-1);
00247         if(fxTGo4WindowEditStatus->IsMultiEdit())
00248             {
00249                 ArrayElements->setValue(-1); // "all" displayed
00250                 tabWidget2->page(0)->setEnabled(false);
00251             }
00252         else
00253             {
00254                 int ix=fxTGo4WindowEditStatus->GetCurrentIndex();
00255                 ArrayElements->setValue(ix);
00256                 tabWidget2->page(0)->setEnabled(true);
00257             }
00258     }
00259 else
00260     {
00261         ArrayElements->setEnabled(false);
00262         ArrayAllButton->setEnabled(false);
00263         ArrayElements->setValue(0);
00264     }
00265 RefreshSelectedCondition();
00266 fbTypingMode=true;
00267 }
00268 
00269 void TGo4WindowEdit::RefreshMarkers()
00270 {
00271     fxTGo4WindowEditSlots->DrawMarkers();
00272 }
00273 
00274 void TGo4WindowEdit::DrawConditions()
00275 {
00276     fxTGo4WindowEditSlots->DrawConditions();
00277 }
00278 
00279 void TGo4WindowEdit::SetVisible( bool on )
00280 {
00281 if(!fbTypingMode) return;
00282     fxTGo4WindowEditSlots->SetVisible(on);
00283     DrawConditions();
00284     fbNeedsUpdate=true;
00285     PleaseUpdateLabel->setShown(fbNeedsUpdate);
00286 }
00287 
00288 void TGo4WindowEdit::RefreshSelectedCondition()
00289 {
00290 //------ active condition name: ------------
00291 CondName->setText(fxTGo4WindowEditStatus->ConditionName());
00292 //------ histo name: ------------
00293 HistoName->setText(fxTGo4WindowEditSlots->GetHistogramName());
00294 //----- flags: -----------
00295 if(fxTGo4WindowEditStatus->IsEnabled())
00296     {
00297         ResultCombo->setCurrentItem(0);
00298     }
00299 else
00300     {
00301         if(fxTGo4WindowEditStatus->ResultValue())
00302           ResultCombo->setCurrentItem(1);
00303         else
00304          ResultCombo->setCurrentItem(2);
00305     }
00306 if(fxTGo4WindowEditStatus->TrueValue())
00307     InvertCombo->setCurrentItem(0);
00308 else
00309     InvertCombo->setCurrentItem(1);
00310 //----- visibility ----:
00311 //if(!fxTGo4WindowEditStatus->IsMultiEdit())
00312     CondVisibility->setChecked(fxTGo4WindowEditSlots->IsVisible());
00313 //else
00314 //    CondVisibility->setChecked(!fxTGo4WindowEditSlots->IsHideMode());
00315 
00316 //------ label on/off:
00317 CondLabel->setChecked(fxTGo4WindowEditSlots->IsLabelDraw());
00318 //----- histogram link ----:
00319         CondHistoLink->setChecked(fxTGo4WindowEditSlots->IsHistogramLink());
00320         char buf[256];
00321         if(fxTGo4WindowEditSlots->IsHistogramLink())
00322             snprintf(buf,256,"bound to:%s",fxTGo4WindowEditSlots->GetLinkedHistogramName());
00323         else
00324             snprintf(buf,256,"no bound histogram");
00325         CondHistoLinkName->setText(buf);
00326 //----- counters:
00327 LCDCounts->display(fxTGo4WindowEditStatus->Counts());
00328 LCDTrueCounts->display(fxTGo4WindowEditStatus->TrueCounts());
00329 RefreshTabs(); // only refresh display of top tab
00330 polish();
00331 update();
00332 show();
00333 //adjustSize();
00334 //raise();
00335 }
00336 
00337 void TGo4WindowEdit::RefreshTabs()
00338 {
00339 fbTypingMode=false;
00340 Int_t index=tabWidget2->currentPageIndex();
00341 // calculate the values for the current front page
00342 switch(index)
00343 {
00344     case 0:
00345         RefreshLimits();
00346         break;
00347     case 1:
00348         RefreshStats();
00349         break;
00350 //    case 2:
00351 //        RefreshCursor();
00352 //        break;
00353     default:
00354         cout <<"wrong index "<<index << endl;
00355         break;
00356 };// switch
00357 fbTypingMode=true;
00358 }
00359 
00360 void TGo4WindowEdit::RefreshLimits()
00361 {
00362 CondLimits->setChecked(fxTGo4WindowEditSlots->IsLimitsDraw());
00363 QString  xminstring;
00364 QString  xmaxstring;
00365 QString  yminstring;
00366 QString  ymaxstring;
00367 xminstring.setNum(fxTGo4WindowEditStatus->Xmin());
00368 xmaxstring.setNum(fxTGo4WindowEditStatus->Xmax());
00369 Win1_low->setText(xminstring);
00370 Win1_up->setText(xmaxstring);
00371 if(!fxTGo4WindowEditStatus->Is2D())
00372     {
00373         Win2_low->setDisabled(true);
00374         Win2_up->setDisabled(true);
00375         //CursorYbinVal->setDisabled(true);
00376     }
00377 else
00378     {
00379         Win2_low->setDisabled(false);
00380         Win2_up->setDisabled(false);
00381         yminstring.setNum(fxTGo4WindowEditStatus->Ymin());
00382         ymaxstring.setNum(fxTGo4WindowEditStatus->Ymax());
00383         Win2_low->setText(yminstring);
00384         Win2_up->setText(ymaxstring);
00385         //CursorYbinVal->setDisabled(false);
00386     } // if(!fxTGo4WindowEditStatus->Is2D())
00387 if(fxTGo4WindowEditStatus->IsPolygon())
00388     {
00389         NewCutBox->setShown(true);
00390         LimitPickBox->setShown(false);
00391         Win1_low->setReadOnly(true);
00392         Win1_up->setReadOnly(true);
00393         Win2_low->setReadOnly(true);
00394         Win2_up->setReadOnly(true);
00395         TPad* wpad=fxTGo4WindowEditSlots->WorkingPad();
00396         if(wpad && wpad!=(TPad*)(wpad->GetCanvas()))
00397             {
00398                  // case of polycon in subpad: disable new cut
00399                  NewCutGButton->setEnabled(false);
00400                  NewCutGCancelB->setEnabled(false);
00401                  NewCutGOKB->setEnabled(false);
00402             }
00403         else
00404             {
00405                 NewCutGButton->setEnabled(fbNewCutGState);
00406                 NewCutGCancelB->setEnabled(fbCancelCutGState);
00407                 NewCutGOKB->setEnabled(fbConfirmCutGState);
00408             }
00409     }
00410 else
00411     {
00412         NewCutBox->setShown(false);
00413         LimitPickBox->setShown(true);
00414         bool pickmode=false;
00415         if(fxTGo4WindowEditSlots->GetMouseMode()==kMousePickLimits) pickmode=true;
00416         SetLimitsB->setOn(pickmode);
00417         FreezeArrayPick->setChecked(fxTGo4WindowEditSlots->IsPickArray());
00418         FreezeArrayPick->setEnabled(fxTGo4WindowEditStatus->IsArray());
00419 
00420         Win1_low->setReadOnly(false);
00421         Win1_up->setReadOnly(false);
00422         Win2_low->setReadOnly(false);
00423         Win2_up->setReadOnly(false);
00424 //        NewCutGButton->setEnabled(false);
00425 //        NewCutGCancelB->setEnabled(false);
00426 //        NewCutGOKB->setEnabled(false);
00427 
00428     }//if(fxTGo4WindowEditStatus->IsPolygon())
00429 if(TGo4Log::IsAutoEnabled())
00430     fxTGo4WindowEditStatus->Print("C");
00431 }
00432 
00433 void TGo4WindowEdit::RefreshStats()
00434 {
00435 //---------- draw checkboxes for labels:
00436 IntBox->setChecked(fxTGo4WindowEditSlots->IsIntDraw());
00437 MaxCBox->setChecked(fxTGo4WindowEditSlots->IsCMaxDraw());
00438 MaxXBox->setChecked(fxTGo4WindowEditSlots->IsXMaxDraw());
00439 MaxYBox->setChecked(fxTGo4WindowEditSlots->IsYMaxDraw());
00440 XMeanBox->setChecked(fxTGo4WindowEditSlots->IsXMeanDraw());
00441 YMeanBox->setChecked(fxTGo4WindowEditSlots->IsYMeanDraw());
00442 XRMSBox->setChecked(fxTGo4WindowEditSlots->IsXRMSDraw());
00443 YRMSBox->setChecked(fxTGo4WindowEditSlots->IsYRMSDraw());
00444 //---------- statistics in current range:
00445 QString  intstring;
00446 QString  xmeanstring;
00447 QString  ymeanstring;
00448 QString  xrmsstring;
00449 QString  yrmsstring;
00450 QString  xstatmaxstring;
00451 QString  ystatmaxstring;
00452 QString  cstatmaxstring;
00453 intstring.setNum(fxTGo4WindowEditSlots->GetIntegral());
00454 xmeanstring.setNum(fxTGo4WindowEditSlots->GetMean(1));
00455 xrmsstring.setNum(fxTGo4WindowEditSlots->GetRMS(1));
00456 ymeanstring.setNum(fxTGo4WindowEditSlots->GetMean(2));
00457 yrmsstring.setNum(fxTGo4WindowEditSlots->GetRMS(2));
00458 xstatmaxstring.setNum(fxTGo4WindowEditSlots->GetXMax());
00459 ystatmaxstring.setNum(fxTGo4WindowEditSlots->GetYMax());
00460 cstatmaxstring.setNum(fxTGo4WindowEditSlots->GetCMax());
00461 IntegralVal->setText(intstring);
00462 XMeanVal->setText(xmeanstring);
00463 XRMSVal->setText(xrmsstring);
00464 YMeanVal->setText(ymeanstring);
00465 YRMSVal->setText(yrmsstring);
00466 MaxXVal->setText(xstatmaxstring);
00467 MaxYVal->setText(ystatmaxstring);
00468 MaxCVal->setText(cstatmaxstring);
00469 if(TGo4Log::IsAutoEnabled())
00470     fxTGo4WindowEditStatus->Print("S");
00471 }
00472 
00473 
00474 void TGo4WindowEdit::SetIntDraw( bool on )
00475 {
00476 if(!fbTypingMode) return;
00477 fxTGo4WindowEditSlots->SetIntDraw(on);
00478 }
00479 
00480 void TGo4WindowEdit::SetXMeanDraw( bool on )
00481 {
00482 if(!fbTypingMode) return;
00483 fxTGo4WindowEditSlots->SetXMeanDraw(on);
00484 }
00485 
00486 void TGo4WindowEdit::SetXRMSDraw( bool on )
00487 {
00488 if(!fbTypingMode) return;
00489 fxTGo4WindowEditSlots->SetXRMSDraw(on);
00490 }
00491 
00492 void TGo4WindowEdit::SetYRMSDraw( bool on )
00493 {
00494 if(!fbTypingMode) return;
00495 fxTGo4WindowEditSlots->SetYRMSDraw(on);
00496 }
00497 
00498 void TGo4WindowEdit::SetYMeanDraw( bool on )
00499 {
00500 if(!fbTypingMode) return;
00501 fxTGo4WindowEditSlots->SetYMeanDraw(on);
00502 }
00503 
00504 void TGo4WindowEdit::SetXMaxDraw( bool on )
00505 {
00506 if(!fbTypingMode) return;
00507 fxTGo4WindowEditSlots->SetXMaxDraw(on);
00508 }
00509 
00510 void TGo4WindowEdit::SetYMaxDraw( bool on )
00511 {
00512 if(!fbTypingMode) return;
00513 fxTGo4WindowEditSlots->SetYMaxDraw(on);
00514 }
00515 
00516 void TGo4WindowEdit::SetCMaxDraw( bool on )
00517 {
00518 if(!fbTypingMode) return;
00519 fxTGo4WindowEditSlots->SetCMaxDraw(on);
00520 }
00521 
00522 
00523 
00524 void TGo4WindowEdit::TabChanged()
00525 {
00526 RefreshTabs();
00527 }
00528 
00529 void TGo4WindowEdit::NewCutG( bool mode )
00530 {
00531     if(!fbTypingMode) return;
00532     if(mode)
00533         {
00534             NewCutGButton->setText("Set");
00535             NewCutGButton->setEnabled(false);
00536             fbNewCutGState=false;
00537             NewCutGCancelB->setEnabled(true);
00538             fbCancelCutGState=true;
00539             NewCutGOKB->setEnabled(true);
00540             fbConfirmCutGState=true;
00541         }
00542    else
00543        {
00544             NewCutGButton->setText("New");
00545             NewCutGButton->setEnabled(true);
00546             fbNewCutGState=true;
00547             NewCutGCancelB->setEnabled(false);
00548             fbCancelCutGState=false;
00549             NewCutGOKB->setEnabled(false);
00550             fbConfirmCutGState=false;
00551        }
00552     fxTGo4WindowEditSlots->SetNewTCutG(mode);
00553 }
00554 
00555 
00556 
00557 void TGo4WindowEdit::CancelCutGEdit()
00558 {
00559     fbTypingMode=false;
00560     fxTGo4WindowEditSlots->SetNewTCutG(kFALSE,kTRUE);
00561     NewCutGButton->setText("New");
00562     NewCutGButton->setEnabled(true);
00563     fbNewCutGState=true;
00564     NewCutGButton->setOn(false);
00565     NewCutGCancelB->setEnabled(false);
00566     fbCancelCutGState=false;
00567     NewCutGOKB->setEnabled(false);
00568     fbConfirmCutGState=false;
00569     fbTypingMode=true;
00570 }
00571 
00572 void TGo4WindowEdit::OKCutGEdit()
00573 {
00574     fbTypingMode=false;
00575     fxTGo4WindowEditSlots->SetNewTCutG(kFALSE,kFALSE);
00576     NewCutGButton->setText("New");
00577     NewCutGButton->setEnabled(true);
00578     fbNewCutGState=true;
00579     NewCutGButton->setOn(false);
00580     NewCutGCancelB->setEnabled(false);
00581     fbCancelCutGState=false;
00582     NewCutGOKB->setEnabled(false);
00583     fbConfirmCutGState=false;
00584     fbNeedsUpdate=true;
00585     PleaseUpdateLabel->setShown(fbNeedsUpdate);
00586     fbTypingMode=true;
00587 }
00588 
00589 void TGo4WindowEdit::SetHistogramLink( bool on )
00590 {
00591     if(!fbTypingMode) return;
00592     fxTGo4WindowEditSlots->SetHistogramLink(on);
00593     char buf[256];
00594     if(on)
00595         snprintf(buf,256,"bound to:%s",fxTGo4WindowEditSlots->GetLinkedHistogramName());
00596     else
00597         snprintf(buf,256,"no bound histogram");
00598     CondHistoLinkName->setText(buf);
00599     fbNeedsUpdate=true;
00600     PleaseUpdateLabel->setShown(fbNeedsUpdate);
00601 }
00602 
00603 void TGo4WindowEdit::WriteToLogfile()
00604 {
00605     fxTGo4WindowEditStatus->Print("CSM");
00606 }
00607 
00608 void TGo4WindowEdit::SetCentralMode( bool on)
00609 {
00610 fxTGo4WindowEditStatus->SetCentralMode(on);
00611 CondNameCombo->setEditable(on); // allow editing name in central mode
00612 CondNameCombo->setEnabled(on);
00613 GetPictureConB->setEnabled(on);
00614 CreateCon->setShown(on); // creation of new cons only in central mode
00615 }
00616 
00617 bool TGo4WindowEdit::IsCentralMode()
00618 {
00619 return fxTGo4WindowEditStatus->IsCentralMode();
00620 }
00621 
00622 void TGo4WindowEdit::LoadCondition()
00623 {
00624 TGo4DiskFileBrowserSlots *filebrowserslots = dynamic_cast <TGo4DiskFileBrowserSlots *> (fxTGo4GUIRegistry->GetSlotClass("TGo4DiskFileBrowserSlots"));
00625 TObject* ob=0;
00626 const Text_t* filename;
00627 const Text_t* obname=CondNameCombo->currentText().stripWhiteSpace();
00628 if(filebrowserslots)
00629     filename=filebrowserslots->LoadObject(&ob, obname);
00630 else
00631     filename=0;
00632 fxTGo4WindowEditSlots->AddObject(dynamic_cast<TNamed*>(ob));
00633 char buf[256];
00634 if(filename)
00635     snprintf(buf,256,"Loaded %s from %s",obname, filename);
00636 else
00637     snprintf(buf,256,"Failed to load %s",obname);
00638 StatusMessage(buf);
00639 }
00640 
00641 void TGo4WindowEdit::SaveCondition()
00642 {
00643 TGo4DiskFileBrowserSlots *filebrowserslots = dynamic_cast <TGo4DiskFileBrowserSlots *> (fxTGo4GUIRegistry->GetSlotClass("TGo4DiskFileBrowserSlots"));
00644 if(filebrowserslots)
00645     {
00646         const Text_t* obname=CondNameCombo->currentText().stripWhiteSpace();
00647         const Text_t* filename=filebrowserslots->SaveObject(fxTGo4WindowEditStatus->GetCondition(), obname);
00648         char buf[256];
00649         if(filename)
00650             snprintf(buf,256,"Saved %s to %s",obname, filename);
00651         else
00652             snprintf(buf,256,"Failed to save %s",obname);
00653         StatusMessage(buf);
00654     }
00655 }
00656 
00657 void TGo4WindowEdit::PadActivated( int i )
00658 {
00659 fbTypingMode=false;
00660 // clean up previous pad:
00661 fxTGo4WindowEditSlots->SetMouseMode(kMouseROOT);
00662 //fxTGo4WindowEditSlots->SetHideMode(false);
00663 fxTGo4WindowEditSlots->SetCurrentPad(i);
00664 DisplayB->setEnabled(false); // comboboxmode without display button
00665 RefreshDisplay();
00666 fbTypingMode=true;
00667 }
00668 
00669 void TGo4WindowEdit::SetWorkViewPanel( TGo4PreviewPanel * pan )
00670 {
00671 fbTypingMode=false;
00672 fxTGo4WindowEditSlots->AssignWorkViewPanel(pan); // this will setup workpad array
00673 CondNameCombo->clear();
00674 int maxpads=fxTGo4WindowEditSlots->GetNumPads();
00675 for(int i=0; i<maxpads; ++i)
00676     {
00677     TGo4Condition* conny=fxTGo4WindowEditSlots->GetWorkPadCondition(i);
00678     if(conny)
00679         {
00680             CondNameCombo->insertItem(conny->GetName(),i);
00681             CondNameCombo->setEditable(false);
00682         }
00683     else
00684         {
00685             CondNameCombo->insertItem("New condition name",i); // for new condition mode
00686         }
00687     }
00688 PadActivated(0);
00689 fbTypingMode=true;
00690 }
00691 
00692 void TGo4WindowEdit::GetViewpanelConditions()
00693 {
00694     SetWorkViewPanel(0);
00695 }
00696 
00697 void TGo4WindowEdit::dropEvent( QDropEvent *e )
00698 {
00699     QListView *dragsource=dynamic_cast <QListView *> (e->source());
00700    if(dragsource==0) return;
00701     TGo4QConItem *dragitem= dynamic_cast <TGo4QConItem *>(dragsource->currentItem());
00702     if(dragitem==0) return; // only accept condition items here
00703     bool remotedrop=false;
00704     if(strcmp(dragsource->name(),"ListViewRemote")==0)
00705       remotedrop=true;
00706     else if(strcmp(dragsource->name(),"FileListView")==0)
00707       remotedrop=false;
00708    QString name;
00709     QCString plain = "plain";
00710     bool decoded = QTextDrag::decode(e, name, plain);
00711     // otherwise we'll accept any kind of text (like text/uri-list)
00712     if (! decoded) decoded = QTextDrag::decode(e, name);
00713     fxTGo4WindowEditSlots->ClearConditions(kTRUE); // but keep label boxes
00714     fxTGo4WindowEditSlots->SetMouseMode(kMouseROOT);
00715     fxTGo4WindowEditSlots->SetWorkingPad(); // reset workpad array, use current pad only
00716     ResetConditionNames();// cleanup names array, enable "display on current pad" button       
00717     if(remotedrop)
00718         {
00719             //cout <<"drop from remote" << endl;
00720             CondNameCombo->changeItem(name,0);
00721             RefreshPressed();
00722         }
00723     else
00724         {
00725             //cout <<" drop from file" << endl;
00726             TNamed* dragnamed=dynamic_cast<TNamed*>(dragitem->GetWorkObject());
00727             fxTGo4WindowEditSlots->AddObject(dragnamed);
00728         }
00729      dragsource->clearSelection();                              // cleanup selection in case of fast drags
00730      dragsource->setSelected(dragitem,true); // due to changed startdrag in listviews JA
00731      e->acceptAction();
00732 }
00733 
00734 void TGo4WindowEdit::dragEnterEvent( QDragEnterEvent *Event)
00735 {
00736     if ( QTextDrag::canDecode( Event )){
00737         if(IsCentralMode()) Event->accept();
00738     }
00739 }
00740 
00741 void TGo4WindowEdit::StatusMessage( const QString & mess )
00742 {
00743 QString text="Condition Editor ";
00744 text.append(name());
00745 text.append(" :");
00746 text.append(mess);
00747 TGo4MainWindow *MW= dynamic_cast<TGo4MainWindow *>(fxTGo4GUIRegistry->GetMainWindow());
00748 if(MW) MW->StatusMessage(text);
00749 }
00750 
00751 void TGo4WindowEdit::CreateNewCondition()
00752 {
00753 TGo4LockGuard glob;
00754 TGo4CreateNewCondition* connydialog=new TGo4CreateNewCondition();
00755 connydialog->SetConditionName(CondNameCombo->currentText().stripWhiteSpace().append("_new"));
00756 if ( connydialog->exec() == QDialog::Accepted )
00757     {
00758         const QString & name=connydialog->GetConditionName().stripWhiteSpace();
00759         const QString & conclass=connydialog->GetConditionClass().stripWhiteSpace();
00760         int dimension=connydialog->GetDimension();
00761         int arsize=connydialog->GetArraySize();
00762         bool isarray=connydialog->IsArray();
00763         if(!isarray) arsize=1;
00764         ResetConditionNames();
00765         CondNameCombo->changeItem(name,0);
00766         fxTGo4WindowEditSlots->CreateNewCondition(name,conclass,arsize,dimension);
00767     }
00768 delete connydialog;
00769 }
00770 
00771 
00772 
00773 QString TGo4WindowEdit::NewConditionName()
00774 {
00775 bool ok;
00776 QString text = QInputDialog::getText(
00777             "Create new condition", "Enter condition name:",
00778                 QLineEdit::Normal,
00779                 CondNameCombo->currentText(),
00780                 &ok,
00781                 this );
00782 if ( ok)
00783     return text;
00784 else
00785     return "";
00786 
00787 }
00788 
00789 
00790 
00791 void TGo4WindowEdit::SetLimitsPick( bool on )
00792 {
00793 if(!fbTypingMode) return;
00794 if(on)
00795     {
00796         fxTGo4WindowEditSlots->SetMouseMode(kMousePickLimits);
00797         fxTGo4WindowEditSlots->SetPickCounter(2);
00798     }
00799 else
00800     {
00801         fxTGo4WindowEditSlots->SetMouseMode(kMouseROOT);
00802         fxTGo4WindowEditSlots->SetPickCounter(0);
00803     }
00804 }
00805 
00806 void TGo4WindowEdit::SetArrayPick( bool on )
00807 {
00808 if(!fbTypingMode) return;
00809 fxTGo4WindowEditSlots->SetPickArray(on);
00810 }
00811 
00812 
00813 void TGo4WindowEdit::SetLabel( bool on )
00814 {
00815 if(!fbTypingMode) return;
00816 fxTGo4WindowEditSlots->SetLabelDraw(on);
00817 DrawConditions();
00818 fbNeedsUpdate=true;
00819 PleaseUpdateLabel->setShown(fbNeedsUpdate);
00820 }
00821 
00822 
00823 void TGo4WindowEdit::SetDrawLimits( bool on )
00824 {
00825 if(!fbTypingMode) return;
00826 fxTGo4WindowEditSlots->SetLimitsDraw(on);
00827 DrawConditions();
00828 fbNeedsUpdate=true;
00829 PleaseUpdateLabel->setShown(fbNeedsUpdate);
00830 }
00831 
00832 
00833 void TGo4WindowEdit::ResetConditionNames()
00834 {
00835 CondNameCombo->clear();
00836 CondNameCombo->setEditable(true);
00837 CondNameCombo->insertItem("default name",0);
00838 DisplayB->setEnabled(true); // enable display button for single mode
00839 }
00840 
00841 
00842 void TGo4WindowEdit::ConditionNameChanged( const QString & )
00843 {
00844     DisplayB->setEnabled(true); 
00845         // for general editor in single condition mode
00846         // this is called only if CondNameCombo is editable
00847 }
00848 
00849 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:56:03 2005 for Go4-v2.10-5 by doxygen1.2.15