6 #include <QFontDatabase>
11 enum EditorState {inactiveEditor,emptyEditor,filledEditor};
15 class TextEditor : public QMainWindow {
22 void setShowWithMain (bool);
24 void setFontHint(const QString&);
25 QString getFontHint();
26 QString getFontHintDefault();
27 void setFilename (const QString&);
28 QString getFilename ();
29 void setFilenameHint (const QString&);
30 QString getFilenameHint ();
31 bool findText(const QString &, const QTextDocument::FindFlags &); // find Text
34 void setupFileActions();
35 void setupEditActions();
36 void setupFormatActions();
37 void setupSettingsActions();
38 void closeEvent( QCloseEvent* );
45 void editorChanged(); // received when text() changed
46 void setText(QString); // set Text (by MapEditor)
47 void setInactive(); // Nothing can be entered
51 void textHasChanged();
52 void fontFamilyHasChanged();
53 void fontSizeHasChanged();
59 void textConvertPar();
61 void textExportAsASCII();
64 void toggleFonthint();
70 void textFamily( const QString &f );
71 void textSize( const QString &p );
73 void textAlign(QAction*);
75 void fontChanged( const QFont &f );
76 void colorChanged( const QColor &c );
77 void alignmentChanged( int a );
78 void verticalAlignmentChanged(int a);
80 void disableActions();
81 void setState (EditorState);
86 QPoint lastPos; // save last position of window
90 QBrush emptyPaper; // setting the background color
91 QBrush filledPaper; // depending on the state
92 QBrush inactivePaper; // depending on the state
94 bool showwithmain; // same visibility as mainwindow?
102 QAction *actionFileLoad,
111 *actionEditDeleteAll,
112 *actionEditConvertPar,
113 *actionEditJoinLines,
114 *actionFormatUseFixedFont,
115 *actionSettingsVarFont,
116 *actionSettingsFixedFont,
117 *actionSettingsFonthintDefault,
119 *actionTextUnderline,
126 *actionAlignSubScript,
127 *actionAlignSuperScript;
130 /* FIXME Wraps currentVerticalAlignmentChanged(VerticalAlignment)
131 * to currentVerticalAlignmentChanged(int)
132 * this way the signal can be used without use of the internal
133 * VerticalAlignment enum of QTextEdit
134 * If VerticalAlignment has been a global like the normal alignment there
135 * have been no problems!
138 class MyTextEdit : public QTextEdit
142 MyTextEdit(QWidget *parent, const char *name) : QTextEdit(parent, name)
146 this, SIGNAL(currentVerticalAlignmentChanged(VerticalAlignment)),
147 this, SLOT(verticalAlignmentChanged(VerticalAlignment)));
150 // int verticalAlignment() const { return m_verticalAlignment; }
152 // void currentVerticalAlignmentChanged(int a);
155 void verticalAlignmentChanged(VerticalAlignment a)
157 m_verticalAlignment = a;
158 emit currentVerticalAlignmentChanged((int)a);
162 // int m_verticalAlignment;