EditorView.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef GUI_EDITORVIEW_H
00025 #define GUI_EDITORVIEW_H
00026
00027 #include "MDIView.h"
00028 #include "Window.h"
00029
00030 QT_BEGIN_NAMESPACE
00031 class QPlainTextEdit;
00032 class QPrinter;
00033 QT_END_NAMESPACE
00034
00035 namespace Gui {
00036
00037 class EditorViewP;
00038
00044 class GuiExport EditorView : public MDIView, public WindowParameter
00045 {
00046 Q_OBJECT
00047
00048 public:
00049 EditorView(QPlainTextEdit* editor, QWidget* parent);
00050 ~EditorView();
00051
00052 QPlainTextEdit* getEditor() const;
00053
00054 virtual void drawMarker(int line, int x, int y, QPainter*);
00055 void OnChange(Base::Subject<const char*> &rCaller,const char* rcReason);
00056
00057 const char *getName(void) const {return "EditorView";}
00058 void onUpdate(void){};
00059
00060 bool onMsg(const char* pMsg,const char** ppReturn);
00061 bool onHasMsg(const char* pMsg) const;
00062
00063 bool canClose(void);
00064
00067 bool open (const QString &f);
00068 bool saveAs ();
00069 void cut ();
00070 void copy ();
00071 void paste ();
00072 void undo ();
00073 void redo ();
00074 void print ();
00075 void printPdf();
00076 void printPreview();
00078
00079 QStringList undoActions() const;
00080 QStringList redoActions() const;
00081 QString fileName() const;
00082
00083 protected:
00084 void focusInEvent(QFocusEvent* e);
00085
00086 private Q_SLOTS:
00087 void checkTimestamp();
00088 void contentsChange(int position, int charsRemoved, int charsAdded);
00089 void undoAvailable(bool);
00090 void redoAvailable(bool);
00091 void print(QPrinter*);
00092
00093 private:
00094 void setCurrentFileName(const QString &fileName);
00095 bool saveFile();
00096
00097 private:
00098 EditorViewP* d;
00099 };
00100
00101 class PythonDebugger;
00102 class GuiExport PythonEditorView : public EditorView
00103 {
00104 Q_OBJECT
00105
00106 public:
00107 PythonEditorView(QPlainTextEdit* editor, QWidget* parent);
00108 ~PythonEditorView();
00109
00110
00111 void drawMarker(int line, int x, int y, QPainter*);
00112 bool onMsg(const char* pMsg,const char** ppReturn);
00113 bool onHasMsg(const char* pMsg) const;
00114
00115
00116 public Q_SLOTS:
00117 void executeScript();
00118 void startDebug();
00119 void toggleBreakpoint();
00120 void showDebugMarker(int line);
00121 void hideDebugMarker();
00122
00123
00124 private:
00125 int m_debugLine;
00126 QRect debugRect;
00127 QPixmap breakpoint;
00128 QPixmap debugMarker;
00129 PythonDebugger* _dbg;
00130 };
00131
00132 }
00133
00134 #endif // GUI_EDITORVIEW_H