12 enum EditorState { inactiveEditor, emptyEditor, filledEditor };
14 class TextEditor : public QMainWindow {
20 void init(const QString &ename);
22 void setEditorName(const QString &);
23 void setEditorTitle(const QString &t = "");
24 QString getEditorTitle();
25 void setFont(const QFont &);
26 void setFontHint(const QString &);
27 QString getFontHint();
28 QString getFontHintDefault();
29 void setFilename(const QString &);
30 QString getFilename();
31 void setFilenameHint(const QString &);
32 QString getFilenameHint();
36 bool findText(const QString &, const QTextDocument::FindFlags &);
37 bool findText(const QString &, const QTextDocument::FindFlags &, int i);
38 void setTextCursor(const QTextCursor &cursor);
39 QTextCursor getTextCursor();
43 void setupFileActions();
44 void setupEditActions();
45 void setupFormatActions();
46 void setupSettingsActions();
47 void closeEvent(QCloseEvent *);
48 bool eventFilter(QObject *obj, QEvent *ev);
51 void editorChanged(); // received when text() changed
52 void setRichText(const QString &t);
53 void setPlainText(const QString &t);
54 void setTextAuto(const QString &); // set Text and autodetect mode
55 void setVymText(const VymText &vt);
56 void setInactive(); // Nothing can be entered
64 void textHasChanged(const VymText &vt);
66 void fontFamilyHasChanged();
67 void fontSizeHasChanged();
73 void textExportAsASCII();
76 void toggleFonthint();
77 void setRichTextMode(bool b);
78 void toggleRichText();
84 void textFamily(const QString &f);
85 void textSize(const QString &p);
87 void textAlign(QAction *);
89 void fontChanged(const QFont &f);
90 void colorChanged(const QColor &c);
91 void formatChanged(const QTextCharFormat &f);
92 void alignmentChanged(int a);
93 void verticalAlignmentChanged(QTextCharFormat::VerticalAlignment);
95 void setState(EditorState);
97 void selectColorRichTextDefaultBackground();
98 void selectColorRichTextDefaultForeground();
101 void setColorRichTextDefaultForeground(const QColor &);
102 void setColorRichTextDefaultBackground(const QColor &);
103 void setColorMapBackground(const QColor&);
104 void setUseColorMapBackground(bool);
107 QString shortcutScope; // used for settings and shortcut scopes
109 QPoint lastPos; // save last position of window
110 QString editorName; // Name of editor, e.g. note editor, heading editor, ...
111 QString editorTitle; // window title: Editor name + selected branch
113 QString filenameHint;
116 bool blockChangedSignal;
117 bool blockTextUpdate; // Set *while* textHasChanged is still being emitted
119 QColor colorRichTextDefaultBackground;
120 QColor colorRichTextDefaultForeground;
121 QColor colorMapBackground;
122 bool useColorMapBackground;
126 QComboBox *comboFont, *comboSize;
128 QToolBar *editToolBar;
129 QToolBar *fontToolBar;
130 QToolBar *fontHintsToolBar;
131 QToolBar *formatToolBar;
133 QAction *actionFileLoad, *actionFileSave, *actionFileSaveAs,
134 *actionFilePrint, *actionFileDeleteAll, *actionEditUndo,
135 *actionEditRedo, *actionEditCopy, *actionEditCut, *actionEditPaste,
136 *actionFormatUseFixedFont, *actionFormatRichText,
137 *actionSettingsVarFont, *actionSettingsFixedFont,
138 *actionSettingsFonthintDefault, *actionEmptyEditorColor,
139 *actionFilledEditorColor, *actionInactiveEditorColor, *actionFontColor;
141 QAction *actionTextBold, *actionTextUnderline, *actionTextItalic,
142 *actionTextColor, *actionAlignSubScript, *actionAlignSuperScript,
143 *actionAlignLeft, *actionAlignCenter, *actionAlignRight,