1 /* emacs: -*- Mode: C; c-style: "bsd"; c-basic-offset: 4; c-recognize-knr-p: nil; -*- */
5 #include <qmainwindow.h>
8 #include <qfontdatabase.h>
12 enum EditorState {inactiveEditor,emptyEditor,filledEditor};
14 QString textConvertToASCII(const QString &);
18 class TextEditor : public QMainWindow {
25 void setShowWithMain (bool);
27 void setFontHint(const QString&);
28 QString getFontHint();
29 QString getFontHintDefault();
30 void setFilename (const QString&);
31 QString getFilename ();
32 void setFilenameHint (const QString&);
33 QString getFilenameHint ();
34 bool findText(const QString &, const bool &); // find Text
37 void setupFileActions();
38 void setupEditActions();
39 void setupFormatActions();
40 void setupSettingsActions();
41 void closeEvent( QCloseEvent* );
48 void editorChanged(); // received when text() changed
49 void setText(QString); // set Text (by MapEditor)
50 void setInactive(); // Nothing can be entered
54 void textHasChanged();
55 void fontFamilyHasChanged();
56 void fontSizeHasChanged();
62 void textConvertPar();
64 void textExportAsASCII();
67 void toggleFonthint();
73 void textFamily( const QString &f );
74 void textSize( const QString &p );
76 void textAlign(QAction*);
78 void fontChanged( const QFont &f );
79 void colorChanged( const QColor &c );
80 void alignmentChanged( int a );
81 void verticalAlignmentChanged(int a);
83 void disableActions();
88 QPoint lastPos; // save last position of window
92 QBrush emptyPaper; // setting the background color
93 QBrush filledPaper; // depending on the state
94 QBrush inactivePaper; // depending on the state
96 bool showwithmain; // same visibility as mainwindow?
104 QAction *actionFileLoad,
113 *actionEditDeleteAll,
114 *actionEditConvertPar,
115 *actionEditJoinLines,
116 *actionFormatUseFixedFont,
117 *actionSettingsVarFont,
118 *actionSettingsFixedFont,
119 *actionSettingsFonthintDefault,
121 *actionTextUnderline,
128 *actionAlignSubScript,
129 *actionAlignSuperScript;
132 /* Wraps currentVerticalAlignmentChanged(VerticalAlignment)
133 * to currentVerticalAlignmentChanged(int)
134 * this way the signal can be used without use of the internal
135 * VerticalAlignment enum of QTextEdit
136 * If VerticalAlignment has been a global like the normal alignment there
137 * have been no problems!
140 class MyTextEdit : public QTextEdit
144 MyTextEdit(QWidget *parent, const char *name) : QTextEdit(parent, name) {
146 SIGNAL(currentVerticalAlignmentChanged(VerticalAlignment)),
148 SLOT(verticalAlignmentChanged(VerticalAlignment)));
150 int verticalAlignment() const { return m_verticalAlignment; }
152 void currentVerticalAlignmentChanged(int a);
154 void verticalAlignmentChanged(VerticalAlignment a) {
155 m_verticalAlignment = a;
156 emit currentVerticalAlignmentChanged((int)a);
159 int m_verticalAlignment;