00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef TGO4VIEWPANEL_H
00015 #define TGO4VIEWPANEL_H
00016
00017 #include "QGo4Widget.h"
00018 #include "ui_TGo4ViewPanel.h"
00019
00020
00021 class THStack;
00022 class TObject;
00023 class TCanvas;
00024 class TPad;
00025 class TH1;
00026 class TH2;
00027 class TAxis;
00028 class TGraph;
00029 class TCutG;
00030 class TMultiGraph;
00031 class TGo4ASImage;
00032 class TGo4Picture;
00033 class QRootWindow;
00034 class QRootCanvas;
00035 class TGo4Slot;
00036 class TGo4Picture;
00037 class TObjArray;
00038 class TVirtualPadEditor;
00039 class QMenuBar;
00040 class QStatusBar;
00041 class QAction;
00042
00043
00044 class TGo4ViewPanel : public QGo4Widget, public Ui::TGo4ViewPanel
00045 {
00046 Q_OBJECT
00047
00048 public:
00049
00050 enum Go4ViewPanelMenuesId {
00051 CrosshairId = 302,
00052 FreezeTitleId = 309,
00053 SetTitleTextId = 310,
00054 SuperimposeId = 1011,
00055 StatisticsId = 1006,
00056 SetTitleId = 1007,
00057 SetLegendId = 1008,
00058 DrawTimeId = 1012,
00059 DrawDateId = 1013,
00060 DrawItemnameId = 1014,
00061 AxisTimeDisplayId= 1015,
00062 SetTimeFormatId = 1016,
00063 BringToFrontId = 4998,
00064 MasterSelectId = 4999,
00065 FirstSelectId = 5000 };
00066
00067 enum Go4MouseMode_t {
00068 kMouseROOT ,
00069 kMousePickCursor,
00070 kMousePickLimits,
00071 kMousePickPolygon,
00072 kMousePickLatex,
00073 kMouseDraw
00074 };
00075
00076 enum {kind_None = -1,
00077 kind_Link = 1,
00078 knd_Reference = 2,
00079 kind_Additional = 100,
00080 kind_FitModels = 101,
00081 kind_Specials = 200,
00082 kind_Condition = 201,
00083 kind_Marker = 202,
00084 kind_Window = 203,
00085 kind_Poly = 204,
00086 kind_Latex = 205,
00087 kind_Arrow = 206,
00088 kind_FitInfo = 221,
00089 kind_FitArrows = 222,
00090 kind_Other = 300,
00091 kind_Fitter = 301,
00092 kind_Permanet = 1000,
00093 kind_PadOptions = 1001,
00094 kind_ThisPad = 1002,
00095 kind_PadSlot = 1003 };
00096
00097 TGo4ViewPanel(QWidget *parent = 0, const char* name=0);
00098
00099 virtual ~TGo4ViewPanel();
00100
00101 virtual const char* GetPanelName();
00102 virtual void SetPanelName(const char* newname);
00103 virtual TGo4Slot* GetPanelSlot();
00104 virtual TGo4Slot* AddNewSlot(const char* name, TGo4Slot* parent);
00105 virtual void BlockPanelRedraw(bool on);
00106 virtual void ResetWidget();
00107 virtual void linkedObjectUpdated(const char* linkname, TObject* obj);
00108 virtual void linkedUpdated(TGo4Slot* slot, TObject* obj);
00109 virtual void linkedRemoved(TGo4Slot* slot, TObject* obj);
00110 virtual bool IsAcceptDrag( const char * itemname, TClass * cl, int kind );
00111 virtual void DropOnPad(TPad* pad, const char * itemname, TClass * cl, int kind );
00112 virtual void CompleteInitialization();
00113 virtual void SetMouseMode( int mode );
00114 virtual int GetMouseMode();
00115 virtual QString GetSelectedMarkerName( TPad * pad );
00116 virtual int GetSelectedMarkerIndex( TPad * pad );
00117 virtual TGo4Slot * GetSelectedSlot( TPad * pad, int * selkind, TObject * * selobj );
00118 virtual bool IsConditionSelected( TPad * pad );
00119 virtual TPad* FindPadWithItem(const char* itemname);
00120 virtual void UndrawItemOnPanel(const char* itemname);
00121 virtual const char* GetDrawItemName(int itemcnt = 0);
00122 virtual void SetSelectedMarker( TPad * pad, const QString & selname, int selindex );
00123 virtual void SetSelectedMarkerByMouseClick(TPad* pad, const char* name);
00124 virtual void StartConditionEditing(TPad* pad);
00125 virtual void SwitchMarkerButton( int kind, bool on );
00126 virtual void MakePictureForPad(TGo4Picture* pic, TPad* pad, bool useitemname);
00127 virtual void UpdatePadStatus( TPad * pad, bool removeitems );
00128 virtual void ProcessPadStatusUpdate( TPad * pad, TGo4Slot* parent, bool removeitems );
00129 virtual TGo4Slot* AddDrawObject( TPad * pad, int kind, const char * itemname, TObject * obj, bool owner, const char * drawopt );
00130 virtual TGo4Slot* GetDrawObjectSlot( TPad * pad, const char * name );
00131 virtual TObject* GetDrawObject( TPad * pad, const char * name );
00132 virtual void DeleteDrawObject( TPad * pad, const char * name );
00133 virtual void DeleteDrawObject( TPad * pad, TObject * obj );
00134 virtual void CollectSpecialObjects( TPad * pad, TObjArray * objs, int selectkind );
00135 virtual bool DeleteDrawObjects( TPad * pad, int kindtodelete );
00136 virtual void SetPadSuperImpose( TPad * pad, bool on );
00137 virtual bool ScanDrawOptions(TPad* pad, TGo4Slot* padslot, TGo4Picture* pic, bool onlyscan);
00138 virtual void ScanObjectsDrawOptions(bool onlyscan, TGo4Slot* padslot, TObjArray* objs, TObjArray* objslots);
00139 virtual void CollectMainDrawObjects( TGo4Slot * slot, TObjArray* objs, TObjArray* objslots, int modifier);
00140 virtual TObject * ProduceSuperimposeObject(TGo4Slot* padslot, TGo4Picture* padopt, TGo4Slot * sislot, TGo4Slot * legslot,
00141 TObjArray * objs, TObjArray * objslots, bool showitems );
00142 virtual void Divide( int numX, int numY );
00143 virtual void SetSlotPad(TGo4Slot* padslot, TPad * pad);
00144 virtual TGo4Slot* GetPadSlot( TPad * pad );
00145 virtual TPad * GetSlotPad( TGo4Slot * slot );
00146 virtual bool IsPadHasSubPads( TGo4Slot * padslot );
00147 virtual bool IsPadHasSubPads( TPad * pad );
00148 virtual void MarkPadModified( TPad * pad );
00149 virtual bool IsPanelPad( TPad * pad );
00150 virtual int GetNumberOfPads( TPad * toppad );
00151 virtual TPad * GetSubPad( TPad * toppad, int num, bool onlytoplevel );
00152 virtual void ProducePadsList( TObjArray * arr, TPad * toppad );
00153 virtual const char* GetDrawObjectLinkName( TPad * pad, TObject* obj );
00154 virtual TGo4Slot * GetPadMainObjectSlot( TPad * pad );
00155 virtual TGo4Slot * GetSuperimposeSlot(TGo4Slot* slot);
00156 virtual TObject * GetPadMainObject( TPad * pad );
00157 virtual TCanvas * GetCanvas();
00158 virtual QRootCanvas * GetQCanvas();
00159 virtual TPad * GetActivePad();
00160 virtual void AllocatePadOptions(TPad* pad);
00161 virtual TGo4Picture * GetPadOptions( TPad * pad );
00162 virtual TGo4Picture * GetPadOptions( TGo4Slot * padslot );
00163 virtual TH1* GetPadHistogram( TPad * pad );
00164 virtual bool IsRedrawBlocked();
00165 virtual void UpdatePanelCaption();
00166 virtual void SetDrawKind( TGo4Slot * slot, int kind );
00167 virtual void SetSpecialDrawOption( TGo4Slot * slot, const char * drawopt );
00168 virtual int GetDrawKind( TGo4Slot * slot );
00169 virtual void SetSelectedObjectIndex( TGo4Slot * slot, int indx );
00170 virtual int GetSelectedObjectIndex(TGo4Slot* slot);
00171 virtual TObject* GetSelectedObject( TPad * pad, const char** drawopt );
00172 virtual bool ShiftSelectedObjectToEnd(TPad * pad);
00173 virtual const char * GetSpecialDrawOption( TGo4Slot * slot );
00174 virtual void CheckForSpecialObjects( TPad * pad, TGo4Slot * padslot );
00175 virtual void CheckObjectsAssigments( TPad * pad, TGo4Slot * padslot );
00176 virtual void ProcessPictureRedraw( const char* picitemname, TPad * pad, TGo4Picture * pic );
00177 virtual void ProcessCanvasAdopt( TPad * tgtpad, TPad * srcpad, const char* srcitemname);
00178 virtual bool ProcessPadRedraw( TPad * pad, bool force);
00179 virtual void RedrawHistogram( TPad * pad, TGo4Picture * padopt, TH1 * his, bool scancontent );
00180 virtual void RedrawStack( TPad * pad, TGo4Picture * padopt, THStack * hs, bool dosuperimpose, bool scancontent );
00181 virtual void RedrawGraph( TPad * pad, TGo4Picture * padopt, TGraph * gr, bool scancontent, bool first_draw );
00182 virtual void RedrawMultiGraph( TPad * pad, TGo4Picture * padopt, TMultiGraph * mg, bool dosuperimpose, bool scancontent );
00183 virtual void RedrawImage( TPad * pad, TGo4Picture * padopt, TGo4ASImage * im, TH2 * asihisto, bool scancontent );
00184 virtual void RedrawLegend( TPad * pad, TGo4Picture * padopt, TGo4Slot * legslot );
00185 virtual void RedrawSpecialObjects( TPad * pad, TGo4Slot* padslot);
00186 virtual bool IsApplyToAllFlag();
00187 virtual bool IsFreezeTitle();
00188 virtual void ChangeDrawOptionForPad(TGo4Slot* padslot, int kind, int value, const char* drawopt );
00189 virtual void ChangeDrawOption( int kind, int value, const char* drawopt );
00190 virtual void ResetPadFillColors( TPad * pad, int col );
00191 virtual void ClearPad( TPad * pad, bool removeitems, bool removesubpads );
00192 virtual void ClearPadItems( TGo4Slot * padslot, TGo4Slot* remain );
00193 virtual void ProcessPadClear( TPad * pad, bool removeitems, bool removesubpads );
00194 virtual void ProcessMarkersClear(TPad *pad, bool withsubpads);
00195 virtual void SetPadDefaults( TPad * pad );
00196 virtual void DisplayPadStatus( TPad * pad );
00197 virtual void MoveScale( int expandfactor, int xaction, int yaction, int zaction );
00198 virtual void MoveSingleScale( int expandfactor, int action, int naxis, TGo4Picture* opt, TObject* padhist);
00199 virtual void TakeFullRangeFromHisto( TH1 * h1, TGo4Picture * padopt, bool isfirsthisto);
00200 virtual void TakeFullRangeFromGraph( TGraph * gr, TGo4Picture * padopt, bool isfirst);
00201 virtual void SetSelectedRangeToHisto( TPad* pad, TH1 * h1, THStack* hs, TGo4Picture * padopt, bool ishisto );
00202 virtual bool GetVisibleRange(TPad* pad, int naxis, double & min, double & max);
00203 virtual void PadRangeAxisChanged( TPad * pad );
00204 virtual void PadRangeAxisChanged( TPad * pad, double rxmin, double rxmax, double rymin, double rymax );
00205 virtual bool TakeSelectedAxisRange(int naxis, TGo4Picture* padopt, double selmin, double selmax, bool force);
00206 virtual bool TakeSelectedAxisRange(int naxis, TGo4Picture* padopt, TAxis* ax);
00207 virtual void GetSelectedRange(int & ndim, bool & autoscale,
00208 double & xmin, double & xmax,
00209 double & ymin, double & ymax,
00210 double & zmin, double & zmax);
00211 virtual void SetSelectedRange(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax );
00212 virtual void SetAutoScale(bool on, TPad* selpad);
00213 virtual void ResizeGedEditor();
00214 virtual void ActivateInGedEditor(TObject* obj);
00215 virtual void CleanupGedEditor();
00216 virtual void ShootRepaintTimer();
00217 virtual bool IsRepaintTimerActive();
00218 virtual void ShootRepaintTimer(TPad * pad);
00219 virtual void PadDeleted( TPad * pad );
00220 virtual void SetFreezedTitle(const QString& title);
00221
00222 public slots:
00223
00224 virtual void SetCursorMode( bool on );
00225 virtual void SetRegionMode( bool on );
00226 virtual void SetPolygonMode( bool on );
00227 virtual void SetLateXMode( bool on );
00228 virtual void SetDrawingMode( bool on );
00229 virtual void SetFreezeMouseMode( bool on );
00230 virtual void RefreshButtons();
00231 virtual void SelectedMarkerCmb_activated( int indx );
00232 virtual void DelSelectedMarker_clicked();
00233 virtual void SetMarkerPanel();
00234 virtual void LogMarkerValues();
00235 virtual void ClearAllMarkers();
00236 virtual void GetConditionBtn_clicked();
00237 virtual void InfoConditionBtn_clicked();
00238 virtual void EditConditionBtn_clicked();
00239 virtual void SetConditionBtn_clicked();
00240 virtual void SaveMarkers();
00241 virtual void LoadMarkers();
00242 virtual void SetActivePad( TPad * pad );
00243 virtual void PadClickedSlot( TPad * pad );
00244 virtual void PadDoubleClickedSlot( TPad * pad );
00245 virtual void CanvasDropEventSlot( QDropEvent * event, TPad * pad );
00246 virtual void CanvasStatusEventSlot( const char * message );
00247 virtual void ProcessPadDoubleClick();
00248 virtual void MenuCommandExecutedSlot( TObject * obj, const char * cmdname );
00249 virtual void CanvasUpdatedSlot();
00250 virtual void SaveCanvas();
00251 virtual void ProducePicture();
00252 virtual void ProduceGraphFromMarkers();
00253 virtual void PrintCanvas();
00254 virtual void StartRootEditor();
00255 virtual void StartConditionEditor();
00256 virtual void RectangularRatio();
00257 virtual void DefaultPadMargin();
00258 virtual void ClearActivePad();
00259 virtual void ClearCanvas();
00260 virtual void AboutToShowOptionsMenu();
00261 virtual void ShowEventStatus();
00262 virtual void ProcessPadModifiedSignal();
00263 virtual void RedrawPanel( TPad * pad, bool force );
00264 virtual void checkRepaintSlot();
00265 virtual void OptionsMenuItemActivated(int);
00266 virtual void SelectMenuItemActivated(int);
00267 virtual void ApplyToAllToggled(bool);
00268 virtual void AutoScaleToggled(bool);
00269 virtual void SuperImposeToggled(bool);
00270 virtual void panelSlot(TGo4ViewPanel * panel, TPad * pad, int signalid);
00271
00272 protected:
00273
00274 QString fPanelName;
00275 QByteArray fbaPanelName;
00276 bool fbEditorFrameVisible;
00277 TVirtualPadEditor* fxPeditor;
00278 QRootWindow* fxRooteditor;
00279 bool fbFreezeTitle;
00280 QString fFreezedTitle;
00281 bool fbMarkEditorVisible;
00282 bool fbTypingMode;
00283 QMenuBar* fMenuBar;
00284 TPad* fxActivePad;
00285 int fiSkipRedrawCounter;
00286 bool fbCanvasCrosshair;
00287 bool fbCanvasEventstatus;
00288 QStatusBar *CanvasStatus;
00289 bool fbApplyToAllFlag;
00290 TPad* fxRepaintTimerPad;
00291 TPad* fxDoubleClickTimerPad;
00292 int fiMouseMode;
00293 int fiPickCounter;
00294 bool fbPickAgain;
00295 bool fbCloneFlag;
00296 bool fbModifiedSignalFlag;
00297 bool fbLeaveFocusAfterCondEnd;
00298 TH1* fDummyHisto;
00299 QMenu* fSelectMenu;
00300 QSignalMapper* fSelectMap;
00301 QCheckBox* fAutoScaleCheck;
00302 QSignalMapper* fOptionsMap;
00303 QMenu* fOptionsMenu;
00304
00305 virtual void CheckActionAtTheEnd( TPad * pad );
00306 virtual bool CompleteMarkerEdit( TPad * pad );
00307 virtual void resizeEvent( QResizeEvent * e );
00308 virtual int GetNumMarkers( TPad * pad, int kind );
00309 virtual void AddMarkerObj( TPad * pad, int kind, TObject * obj );
00310 virtual void SetActiveObj( TPad * pad, int kind, TGo4Slot * activeslot );
00311 virtual TObject * GetActiveObj( TPad * pad, int kind );
00312 virtual QString GetActiveObjName( TPad * pad, int kind );
00313 };
00314
00315 #endif