insilmaril@0
|
1 |
#ifndef TEXTEDITOR_H
|
insilmaril@0
|
2 |
#define TEXTEDITOR_H
|
insilmaril@0
|
3 |
|
insilmaril@366
|
4 |
#include <QtGui>
|
insilmaril@0
|
5 |
|
insilmaril@0
|
6 |
enum EditorState {inactiveEditor,emptyEditor,filledEditor};
|
insilmaril@0
|
7 |
|
jhilmer@142
|
8 |
class MyTextEdit;
|
jhilmer@142
|
9 |
|
insilmaril@0
|
10 |
class TextEditor : public QMainWindow {
|
insilmaril@0
|
11 |
Q_OBJECT
|
insilmaril@0
|
12 |
public:
|
insilmaril@0
|
13 |
TextEditor();
|
insilmaril@0
|
14 |
~TextEditor();
|
insilmaril@0
|
15 |
|
insilmaril@0
|
16 |
bool isEmpty();
|
insilmaril@0
|
17 |
void setShowWithMain (bool);
|
insilmaril@0
|
18 |
bool showWithMain ();
|
insilmaril@0
|
19 |
void setFontHint(const QString&);
|
insilmaril@0
|
20 |
QString getFontHint();
|
insilmaril@0
|
21 |
QString getFontHintDefault();
|
insilmaril@0
|
22 |
void setFilename (const QString&);
|
insilmaril@0
|
23 |
QString getFilename ();
|
insilmaril@106
|
24 |
void setFilenameHint (const QString&);
|
insilmaril@106
|
25 |
QString getFilenameHint ();
|
insilmaril@366
|
26 |
bool findText(const QString &, const QTextDocument::FindFlags &); // find Text
|
insilmaril@0
|
27 |
|
insilmaril@0
|
28 |
protected:
|
insilmaril@0
|
29 |
void setupFileActions();
|
insilmaril@0
|
30 |
void setupEditActions();
|
insilmaril@0
|
31 |
void setupFormatActions();
|
insilmaril@0
|
32 |
void setupSettingsActions();
|
insilmaril@0
|
33 |
void closeEvent( QCloseEvent* );
|
insilmaril@0
|
34 |
|
insilmaril@0
|
35 |
|
insilmaril@0
|
36 |
public:
|
insilmaril@0
|
37 |
QString getText();
|
insilmaril@0
|
38 |
|
insilmaril@0
|
39 |
public slots:
|
insilmaril@0
|
40 |
void editorChanged(); // received when text() changed
|
insilmaril@0
|
41 |
void setText(QString); // set Text (by MapEditor)
|
insilmaril@0
|
42 |
void setInactive(); // Nothing can be entered
|
insilmaril@0
|
43 |
void editCopyAll();
|
insilmaril@0
|
44 |
|
insilmaril@0
|
45 |
signals:
|
insilmaril@0
|
46 |
void textHasChanged();
|
insilmaril@390
|
47 |
void textEditorClosed();
|
insilmaril@0
|
48 |
void fontFamilyHasChanged();
|
insilmaril@0
|
49 |
void fontSizeHasChanged();
|
insilmaril@0
|
50 |
|
insilmaril@0
|
51 |
private slots:
|
insilmaril@0
|
52 |
void textLoad();
|
insilmaril@0
|
53 |
void textSaveAs();
|
insilmaril@0
|
54 |
void textSave();
|
insilmaril@0
|
55 |
void textExportAsASCII();
|
insilmaril@0
|
56 |
void textPrint();
|
insilmaril@0
|
57 |
void textEditUndo();
|
insilmaril@0
|
58 |
void toggleFonthint();
|
insilmaril@0
|
59 |
void setFixedFont();
|
insilmaril@0
|
60 |
void setVarFont();
|
insilmaril@0
|
61 |
void textBold();
|
insilmaril@0
|
62 |
void textUnderline();
|
insilmaril@0
|
63 |
void textItalic();
|
insilmaril@0
|
64 |
void textFamily( const QString &f );
|
insilmaril@0
|
65 |
void textSize( const QString &p );
|
insilmaril@0
|
66 |
void textColor();
|
insilmaril@0
|
67 |
void textAlign(QAction*);
|
jhilmer@142
|
68 |
void textVAlign();
|
insilmaril@0
|
69 |
void fontChanged( const QFont &f );
|
insilmaril@0
|
70 |
void colorChanged( const QColor &c );
|
insilmaril@388
|
71 |
void formatChanged (const QTextCharFormat &f);
|
insilmaril@0
|
72 |
void alignmentChanged( int a );
|
insilmaril@388
|
73 |
void verticalAlignmentChanged(QTextCharFormat::VerticalAlignment);
|
insilmaril@0
|
74 |
void enableActions();
|
insilmaril@0
|
75 |
void disableActions();
|
insilmaril@366
|
76 |
void setState (EditorState);
|
insilmaril@0
|
77 |
|
insilmaril@0
|
78 |
private:
|
insilmaril@0
|
79 |
QPrinter *printer;
|
insilmaril@388
|
80 |
QTextEdit *e;
|
insilmaril@0
|
81 |
QPoint lastPos; // save last position of window
|
insilmaril@0
|
82 |
QString filename;
|
insilmaril@106
|
83 |
QString filenameHint;
|
insilmaril@0
|
84 |
|
insilmaril@0
|
85 |
QBrush emptyPaper; // setting the background color
|
insilmaril@0
|
86 |
QBrush filledPaper; // depending on the state
|
insilmaril@0
|
87 |
QBrush inactivePaper; // depending on the state
|
insilmaril@0
|
88 |
EditorState state;
|
insilmaril@0
|
89 |
bool showwithmain; // same visibility as mainwindow?
|
insilmaril@0
|
90 |
|
insilmaril@0
|
91 |
QFont varFont;
|
insilmaril@0
|
92 |
QFont fixedFont;
|
insilmaril@388
|
93 |
QComboBox *comboFont, *comboSize;
|
insilmaril@0
|
94 |
|
insilmaril@0
|
95 |
QAction *actionFileLoad,
|
insilmaril@0
|
96 |
*actionFileSave,
|
insilmaril@0
|
97 |
*actionFileSaveAs,
|
insilmaril@0
|
98 |
*actionFilePrint,
|
insilmaril@0
|
99 |
*actionEditUndo,
|
insilmaril@0
|
100 |
*actionEditRedo,
|
insilmaril@0
|
101 |
*actionEditCopy,
|
insilmaril@0
|
102 |
*actionEditCut,
|
insilmaril@0
|
103 |
*actionEditPaste,
|
insilmaril@0
|
104 |
*actionEditDeleteAll,
|
insilmaril@0
|
105 |
*actionFormatUseFixedFont,
|
insilmaril@0
|
106 |
*actionSettingsVarFont,
|
insilmaril@0
|
107 |
*actionSettingsFixedFont,
|
insilmaril@0
|
108 |
*actionSettingsFonthintDefault,
|
insilmaril@0
|
109 |
*actionTextBold,
|
insilmaril@0
|
110 |
*actionTextUnderline,
|
insilmaril@0
|
111 |
*actionTextItalic,
|
insilmaril@0
|
112 |
*actionTextColor,
|
insilmaril@388
|
113 |
*actionAlignSubScript,
|
insilmaril@388
|
114 |
*actionAlignSuperScript,
|
insilmaril@0
|
115 |
*actionAlignLeft,
|
insilmaril@0
|
116 |
*actionAlignCenter,
|
insilmaril@0
|
117 |
*actionAlignRight,
|
insilmaril@388
|
118 |
*actionAlignJustify;
|
insilmaril@0
|
119 |
};
|
insilmaril@0
|
120 |
|
insilmaril@0
|
121 |
#endif
|