00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef TGO4FITPANEL_H
00015 #define TGO4FITPANEL_H
00016
00017 #include "QGo4Widget.h"
00018 #include "ui_TGo4FitPanel.h"
00019 #include "TArrow.h"
00020
00021
00022 class QVBoxLayout;
00023 class QHBoxLayout;
00024 class QGridLayout;
00025 class QSpacerItem;
00026 class QWidgetStack;
00027 class QWidget;
00028 class QSplitter;
00029 class QPushButton;
00030 class QSpinBox;
00031 class QLabel;
00032 class QTableWidget;
00033 class QCheckBox;
00034 class QComboBox;
00035 class QTabWidget;
00036 class QGo4LineEdit;
00037 class QSlider;
00038 class QFrame;
00039 class QLineEdit;
00040 class TGo4ViewPanel;
00041 class TPad;
00042 class QDragEnterEvent;
00043 class QDragMoveEvent;
00044 class QDropEvent;
00045 class QMenuBar;
00046 class QFitItem;
00047 class QFitNamedWidget;
00048 class QFitModelWidget;
00049 class TObject;
00050 class TObjArray;
00051 class TGo4Slot;
00052 class TGo4FitSlot;
00053 class TGo4FitComponent;
00054 class TGo4FitModel;
00055 class TGo4FitData;
00056 class TGo4Fitter;
00057
00058 class TGo4Fitter;
00059 class TGo4FitGuiArrow;
00060 class TGo4FitPeakFinder;
00061
00062 class TGo4FitPanel;
00063
00064 class TGo4FitGuiArrow : public TArrow {
00065
00066 public:
00067
00068 enum { at_none, at_pos, at_width, at_range };
00069
00070 TGo4FitGuiArrow();
00071 TGo4FitGuiArrow(Float_t arrowsize, Option_t* option);
00072 TGo4FitGuiArrow(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Float_t arrowsize, Option_t* option);
00073 virtual ~TGo4FitGuiArrow();
00074
00075 void SetForPosition(TGo4FitModel* model, TGo4FitGuiArrow* forwidth, Double_t iLineAmpl);
00076 void SetForWidth(TGo4FitModel* model, TGo4FitGuiArrow* forposition);
00077 void SetForRange(TGo4FitComponent* Comp, Int_t num, Double_t rangey, Double_t shiftx);
00078 void SetItem(QFitItem* item, TGo4FitPanel* panel);
00079
00080 QFitItem* GetItem() { return fxItem; }
00081
00082 Bool_t Locate();
00083
00084 Int_t GetType() { return fxType; }
00085 TGo4FitModel* GetModel() { return fxModel; }
00086 TGo4FitComponent* GetComp() { return fxComp; }
00087
00088 Bool_t IsAssignTo(TObject* obj);
00089
00090 void ClearOther() { fxOther = 0; }
00091 virtual void Delete(Option_t* option="");
00092
00093 virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
00094
00095 private:
00096 Int_t fxType;
00097 TGo4FitModel* fxModel;
00098 TGo4FitGuiArrow* fxOther;
00099 Double_t fdLineAmpl;
00100 TGo4FitComponent* fxComp;
00101 Int_t fiRangeNum;
00102 Double_t fdRangeY;
00103 Double_t fdShiftX;
00104 QFitItem* fxItem;
00105 TGo4FitPanel* fxPanel;
00106 };
00107
00108
00109
00110
00111 class TGo4FitPanel : public QGo4Widget, public Ui::TGo4FitPanel
00112 {
00113 Q_OBJECT
00114
00115 public:
00116 TGo4FitPanel( QWidget* parent = 0, const char* name = 0 );
00117 virtual ~TGo4FitPanel();
00118
00119 virtual bool IsAcceptDrag(const char* itemname, TClass * cl, int kind );
00120 virtual void DropOnPanel( QDropEvent* event, const char * itemname, TClass * cl, int kind );
00121 virtual void linkedObjectUpdated( const char * linkname, TObject * obj );
00122 virtual void linkedObjectRemoved( const char * linkname );
00123 virtual void linkedRemoved(TGo4Slot* slot, TObject* obj);
00124 virtual void CreateFitSlotLink(TGo4FitSlot* slot, const char * itemname);
00125 virtual void WorkWithFitter(const char* itemname, TGo4ViewPanel* panel, TPad* pad);
00126 virtual void WorkWithFitterInSlot(TGo4Slot* slot);
00127 virtual bool WorkingWithPanel();
00128 virtual bool WorkingWithOnlyPad();
00129 virtual TGo4ViewPanel* ActivePanel();
00130 virtual TPad* ActivePad();
00131 virtual TGo4Fitter* GetFitter();
00132 virtual TGo4Fitter* CloneFitter();
00133 virtual void RemoveFitterLink();
00134 virtual void SetFitter(TGo4Fitter*);
00135 virtual void Fitter_New();
00136 virtual void Fitter_NewForActivePad(bool overwrite);
00137 virtual void Fitter_Delete();
00138 virtual void Fitter_UseWorkspace();
00139 virtual void Fitter_UpdateReferences();
00140 virtual void Fitter_SaveToBrowser();
00141 virtual void Fitter_PrintParameters();
00142 virtual void Fitter_RollbackParameters();
00143 virtual void Button_WorkWithPanel();
00144 virtual void Button_SimpleFit(int nmodel);
00145 virtual void Button_SimpleClear();
00146 virtual void Button_PeakFinder();
00147 virtual void Button_PerformFit();
00148 virtual void Button_FitterDraw(TGo4FitData* selecteddata);
00149 virtual void Cmd_CreateFitter();
00150 virtual void Cmd_CreateAppropriateFitter();
00151 virtual void Cmd_DeleteFitter();
00152 virtual void Cmd_ClearFitter();
00153 virtual void Cmd_SaveFitter(bool ask);
00154 virtual void Cmd_ItemPrint(QFitItem* item);
00155 virtual void Cmd_AddNewData(QFitItem * item, int id);
00156 virtual void Cmd_DrawData(QFitItem * item);
00157 virtual void Cmd_DeleteData(QFitItem * item);
00158 virtual void Cmd_DeleteAssosiatedModels(QFitItem * item);
00159 virtual void Cmd_DeleteAllData(QFitItem * item);
00160 virtual void Cmd_AddNewModel(QFitItem * item, int id);
00161 virtual void Cmd_DeleteModel(QFitItem * item);
00162 virtual void Cmd_RemoveModel(TGo4FitModel* model);
00163 virtual void Cmd_DeleteModels(QFitItem * item);
00164 virtual void Cmd_CloneModel(QFitItem * item);
00165 virtual void Cmd_ClearAssigment(QFitItem* item);
00166 virtual void Cmd_ClearAssigments(QFitItem* item);
00167 virtual void Cmd_AssignModelToAllData(QFitItem* item);
00168 virtual void Cmd_AssignModelToData(QFitItem* item, int id);
00169 virtual void Cmd_RemoveRangeCondition(QFitItem* item);
00170 virtual void Cmd_RemoveRangeConditions(QFitItem* item);
00171 virtual void Cmd_AddRangeCondition(QFitItem* item, int id);
00172 virtual void Cmd_DeleteAction(QFitItem* item);
00173 virtual void Cmd_DeleteActions(QFitItem* item);
00174 virtual void Cmd_MoveAction(QFitItem* item, int dir);
00175 virtual void Cmd_ExecuteAction(QFitItem* item);
00176 virtual void Cmd_ExecuteActions(QFitItem* item, bool expert);
00177 virtual void Cmd_DeleteOutputActions(QFitItem* item);
00178 virtual void Cmd_AddNewAction(QFitItem* item, int id);
00179 virtual void Cmd_DeleteDependency(QFitItem* item);
00180 virtual void Cmd_DeleteDependencies(QFitItem* item);
00181 virtual void Cmd_AddDependency(QFitItem* item);
00182 virtual void Cmd_MemorizePars(QFitItem* item);
00183 virtual void Cmd_RememberPars(QFitItem* item);
00184 virtual void Cmd_DeletePars(QFitItem* item);
00185 virtual void Cmd_AddNewPar(QFitItem* item);
00186 virtual void Cmd_MemorizePar(QFitItem* item);
00187 virtual void Cmd_RememberPar(QFitItem* item);
00188 virtual void Cmd_DeletePar(QFitItem* item);
00189 virtual void Cmd_DeleteMinuitResult(QFitItem* item);
00190 virtual void Cmd_UpdateAllSlots(QFitItem* item);
00191 virtual void UpdateActivePage();
00192 virtual void UpdateSimplePage();
00193 virtual void UpdateWizardPage();
00194 virtual void UpdateExtendedPage();
00195 virtual void RemovePrimitives();
00196 virtual TGo4Fitter* CreateFitterFor(TGo4ViewPanel* panel, TPad* pad, const char* name);
00197 virtual void CreateDataFor(TGo4ViewPanel* panel, TPad* pad, TGo4Fitter* fitter);
00198 virtual bool FillPopupForItem(QFitItem* item, QMenu* menu, QSignalMapper* map);
00199 virtual bool FillPopupForSlot(TGo4FitSlot* slot, QMenu* menu, QSignalMapper* map);
00200 virtual void ExecutePopupForSlot(QFitItem* item, TGo4FitSlot* slot, int id);
00201 virtual QFitItem* GetFitterItem();
00202 virtual QFitItem* FindItem(TObject* obj, int ObjectType, QFitItem* parent);
00203 virtual bool ShowItem(QFitItem* item, bool force);
00204 virtual bool ShowItemAsText(QFitItem* item, bool force);
00205 virtual bool ShowItemAsGraph(QFitItem* item, bool force);
00206 virtual void RemoveItemWidget();
00207 virtual void UpdateItem(QFitItem* item, bool trace);
00208 virtual void SetItemText(QFitItem* item, bool trace);
00209 virtual void UpdateItemsOfType(int typ, QFitItem* parent);
00210 virtual void FitItemDeleted(QFitItem* item);
00211 virtual void FillModelTypesList(QMenu* menu, QSignalMapper* map, int id, bool extend);
00212 virtual void FillDataTypesList(QMenu* menu, QSignalMapper* map, int id);
00213 virtual void FillParsList(QFitItem* item);
00214 virtual void FillSlotsList(QFitItem* parent, const TObjArray* lst, TObject* owner);
00215 virtual void FillDependencyList(QFitItem* parent);
00216 virtual void PaintFitter(TGo4Fitter* fitter, QFitItem* item, bool update);
00217 virtual bool PaintModel(TGo4FitModel* model, TPad* pad, QFitItem* item);
00218 virtual bool PaintModelsFor(TGo4Fitter* fitter, TGo4FitData* data, QFitItem* item, bool update);
00219 virtual bool PaintRange(TGo4FitComponent* comp, int nrange, TPad* pad, QFitItem* item);
00220 virtual TGo4FitPeakFinder* GetPeakFinder(bool autocreate);
00221 virtual TGo4FitData* Wiz_SelectedData();
00222 virtual TGo4FitModel* Wiz_SelectedModel();
00223 virtual TGo4FitModel* Wiz_CreateNewModel(int id);
00224 virtual TGo4FitData* Wiz_CreateNewData(int id);
00225 virtual void Wiz_RebuildDataList();
00226 virtual bool Wiz_RemoveData();
00227 virtual void Wiz_UseSelectedRange();
00228 virtual void Wiz_TakeCurrentRange();
00229 virtual void Wiz_GetModelInfo(TGo4FitModel* model, QString* info);
00230 virtual QString Wiz_GetSlotSourceInfo(TGo4FitSlot* slot);
00231 virtual void ArrowChanged(TGo4FitGuiArrow* arr);
00232 virtual void DeleteModelWithPrimit(TGo4FitGuiArrow* arr);
00233 virtual int GetPadIndexForSlot(TGo4FitSlot* slot);
00234 virtual TPad* FindPadForSlot(TGo4FitSlot* slot);
00235 virtual TPad* FindPadWhereData(TGo4FitData* data);
00236 virtual TPad* FindPadWhereModel(TGo4FitModel* model);
00237 virtual TPad* FindPadWhereComp(TGo4FitComponent* comp);
00238 virtual TGo4FitData* CreateData(int id, const char* name);
00239 virtual TGo4FitModel* CreateModel(int id, const char* namebase, TGo4Fitter* fitter, TGo4FitData* data);
00240 virtual void LocateModel(TGo4FitModel* model, TGo4FitData* data, bool usepad);
00241 virtual int DefineModelWidgetType(TObject* obj);
00242 virtual bool UpdateObjectReferenceInSlot(TGo4FitSlot* slot, bool createlink);
00243 virtual bool UpdateObjectReferenceInSlots();
00244 virtual void ClearObjectReferenceInSlots();
00245 virtual void RemoveDrawObjects();
00246 virtual void CloseDrawPanel();
00247 virtual void UpdateStatusBar(const char* info);
00248 virtual void UpdateItemMenu();
00249 virtual void UpdatePFAmplLbl();
00250 virtual void UpdatePFRelNoiseLbl();
00251 virtual void UpdateWizDataList();
00252 virtual void UpdateWizDataBtns();
00253 virtual void UpdateWizModelsList(bool changestack);
00254 virtual void UpdateWizModelsBtns();
00255 virtual void UpdateWizStackWidget();
00256 virtual void UpdateWizPaint(int mode);
00257 virtual void FillParsTable( QTableWidget* table, TGo4Fitter * fitter, TGo4FitModel * model, bool LinesView, TObjArray
00258 * TableList );
00259 virtual void FillNamedWidget(QFitNamedWidget* w);
00260 virtual void ChangeObjectName(QFitNamedWidget* w, const char* newname);
00261 virtual void ChangeObjectTitle(QFitNamedWidget* w, const char* newtitle);
00262 virtual void ChangeModelPar(QFitModelWidget* w, int npar, int value);
00263
00264
00265 public slots:
00266 virtual void panelSlot(TGo4ViewPanel*, TPad*, int);
00267 virtual void FitList_customContextMenuRequested(const QPoint &);
00268 virtual void FitList_currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*);
00269 virtual void AboutToShowViewMenu();
00270 virtual void ChangeViewType(int id);
00271 virtual void ShowPanelPage(int id);
00272 virtual void AboutToShowSettMenu();
00273 virtual void ChangeSettings( int id );
00274 virtual void AboutToShowFitterMenu();
00275 virtual void FitterMenuItemSelected( int id );
00276 virtual void AboutToShowItemMenu();
00277 virtual void ItemMenuItemSelected( int id );
00278 virtual void PF_MinWidthEdt_textChanged( const QString & str );
00279 virtual void PF_MaxWidthEdt_textChanged( const QString & str );
00280 virtual void PF_WidthEdit_textChanged( const QString & str );
00281 virtual void PF_AmplSlider_valueChanged( int zn );
00282 virtual void PF_AmplSlider_sliderReleased();
00283 virtual void PF_RelNoiseSlider_valueChanged( int zn );
00284 virtual void PF_RelNoiseSlider_sliderReleased();
00285 virtual void PF_MinNoiseEdit_textChanged( const QString & str );
00286 virtual void PF_SumUpSpin_valueChanged( int num );
00287 virtual void Wiz_DataListSelect(QListWidgetItem*);
00288 virtual void Wiz_ModelListSelect(QListWidgetItem*);
00289 virtual void Wiz_AddDataBtn_clicked();
00290 virtual void Wiz_DelDataBtn_clicked();
00291 virtual void Wiz_AddModelBtn_clicked();
00292 virtual void Wiz_DelModelBtn_clicked();
00293 virtual void Wiz_CloneModelBtn_clicked();
00294 virtual void Wiz_ShowAllMod_toggled( bool zn );
00295 virtual void Wiz_FitFuncCmb_activated( int typ );
00296 virtual void Wiz_FitNameEdt_textChanged( const QString & name );
00297 virtual void Wiz_ParTable_valueChanged( int nrow, int ncol );
00298 virtual void Wiz_DataList_doubleClicked(QListWidgetItem*);
00299 virtual void Wiz_ModelList_doubleClicked(QListWidgetItem*);
00300 virtual void Wiz_ModelList_itemChanged(QListWidgetItem*);
00301 virtual void Wiz_RebuildDataBtn_clicked();
00302 virtual void Wiz_DataBufChk_toggled( bool zn );
00303 virtual void Wiz_UseAmplEstimChk_toggled( bool chk );
00304 virtual void Wiz_MigradIterSpin_valueChanged( int num );
00305 virtual void Wiz_DataSlotsTable_contextMenuRequested(const QPoint & pnt );
00306 virtual void Wiz_DataUseRangeBtn_clicked();
00307 virtual void Wiz_DataClearRangesBtn_clicked();
00308 virtual void Wiz_DrawDataBtn_clicked();
00309 virtual void Wiz_ModelBufChk_toggled( bool zn );
00310 virtual void Wiz_PFSetupBtn_clicked();
00311 virtual void Wiz_PFUsePolynChk_toggled( bool zn );
00312 virtual void Wiz_PFPolynSpin_valueChanged( int zn );
00313 virtual void Wiz_MinSetupBtn_clicked();
00314 virtual void MainAttachBtn_clicked();
00315 virtual void MainFitBtn_clicked();
00316 virtual void MainDrawBtn_clicked();
00317 virtual void MainFindBtn_clicked();
00318 virtual void MainParsBtn_clicked();
00319 virtual void FillParsWidget();
00320 virtual void LineParsChk_toggled( bool );
00321 virtual void ParsTable_valueChanged( int nrow, int ncol );
00322 virtual void ParsTableChanged( QTableWidget * table, int nrow, int ncol,
00323 bool LinesView, TObjArray * TableList,
00324 bool updatepaint );
00325 virtual void Smp_PolynomBtn_clicked();
00326 virtual void Smp_GaussianBtn_clicked();
00327 virtual void Smp_LorenzBtn_clicked();
00328 virtual void Smp_ExponentBtn_clicked();
00329 virtual void Smp_ClearBtn_clicked();
00330 virtual void FindersTab_currentChanged( int);
00331 virtual void Wiz_BackgroundChk_toggled( bool chk );
00332 virtual void PF_MinWidthEdt_returnPressed();
00333 virtual void PF_MaxWidthEdt_returnPressed();
00334 virtual void PF_WidthEdit_returnPressed();
00335 virtual void PF_MinNoiseEdit_returnPressed();
00336
00337 public:
00338 QFitItem* CurrFitItem;
00339
00340 protected:
00341
00342 QMenuBar* MenuBar;
00343 QMenu* FitterMenu;
00344 QSignalMapper* FitterMap;
00345 QMenu* ViewMenu;
00346 QSignalMapper* ViewMap;
00347 QMenu* SettMenu;
00348 QSignalMapper* SettMap;
00349 QMenu* ItemMenu;
00350 QSignalMapper* ItemMap;
00351
00352
00353 bool fbFillingWidget;
00354 int fiPaintMode;
00355 TObjArray* fxWizPars;
00356 TObjArray* fxWizSlots;
00357 TObjArray* fxParsTableList;
00358 TGo4ViewPanel* fxActivePanel;
00359 TPad* fxActivePad;
00360 TGo4ViewPanel* fxDrawNewPanel;
00361 bool fbDrawPanelCreation;
00362 QFitItem* fxCurrentItem;
00363 QWidget* fxCurrentItemWidget;
00364 bool fbNeedConfirmation;
00365 bool fbShowPrimitives;
00366 bool fbFreezeMode;
00367 int fiPanelMode;
00368 bool fbParsWidgetShown;
00369 bool fbDrawModels;
00370 bool fbDrawComponents;
00371 bool fbDrawBackground;
00372 bool fbUseSamePanelForDraw;
00373 bool fbDrawInfoOnPad;
00374 int fiIntegralMode;
00375 bool fbRecalculateGaussWidth;
00376 int fiBuffersUsage;
00377 bool fbSaveWithReferences;
00378 bool fbUseCurrentRange;
00379 QString fxWizDataName;
00380 QString fxWizModelName;
00381 bool fbWizShowAllModels;
00382 int fiWizPageIndex;
00383 bool fbUseAmplEstim;
00384 int fiNumMigradIter;
00385
00386 virtual void focusInEvent( QFocusEvent * event );
00387 virtual void changeEvent ( QEvent *event );
00388
00389
00390
00391
00392 };
00393
00394 #endif // TGO4FITPANEL_H
00395
00396
00397
00398
00399