summaryrefslogtreecommitdiffstats
path: root/kturtle/src/kturtle.h
blob: 8ffd55dff6dd716c9decc1eb856ce34e4a796674 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/*
    Copyright (C) 2003-04 Cies Breijs <cies # kde ! nl>

    This program is free software; you can redistribute it and/or
    modify it under the terms of version 2 of the GNU General Public
    License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */


#ifndef _KTURTLE_H_
#define _KTURTLE_H_

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif


#include <qgroupbox.h>

#include <kcombobox.h>
#include <klineedit.h>
#include <knuminput.h>

#include <kparts/mainwindow.h>
#include <ktexteditor/editinterface.h>
#include <ktexteditor/view.h>

#include "canvas.h"
#include "dialogs.h"
#include "executer.h"
#include "parser.h"


class KRecentFilesAction;


class MainWindow : public KParts::MainWindow
{   
	Q_OBJECT

	public:
		MainWindow(KTextEditor::Document* = 0L);
		virtual ~MainWindow();


	signals:
		void changeSpeed(int speed);
		void unpauseExecution();


	protected slots:
		void slotNewFile();
		void slotOpenFile(const KURL& url = NULL);
		void slotOpenExample();
		void slotSaveFile();
		void slotSaveAs();
		void slotSaveCanvas();
		void slotPrint();
		
		void slotExecute();
		void slotPauseExecution();
		void slotAbortExecution();
		void slotChangeSpeed();
		void slotInputDialog(QString& value);
		void slotMessageDialog(QString text);
		
		void slotEditor();
		void slotSetHighlightstyle(QString langCode);  
		void slotUndo();
		void slotRedo();
		void slotCut();
		void slotCopy();
		void slotPaste();
		void slotSelectAll();
		void slotClearSelection();
		void slotFind();
		void slotFindNext();
		void slotFindPrevious();
		void slotReplace();
		void slotToggleInsert();
		void slotInsertText(QString);
		void slotToggleLineNumbers();
		void slotIndent();
		void slotUnIndent();
		void slotCleanIndent();
		void slotComment();
		void slotUnComment();
		void slotSetCursorPos(uint row, uint column);
		void slotSetSelection(uint StartLine, uint StartCol, uint EndLine, uint EndCol);
	
		void slotSettings();
		void slotUpdateSettings();
		void slotSettingsHelp();
		
		void slotContextHelp();
		void slotContextHelpUpdate();
		
		void slotStatusBar(QString text, int place);
		void slotCursorStatusBar();
		
		void slotToggleFullscreen();
		void slotFinishedFullScreenExecution();
		void slotRestartFullScreen();
		void slotBackToFullScreen();
		
		void slotColorPicker();
		void slotUpdateCanvas();


	protected:
		void setupActions();
		void setupEditor();
		void setupCanvas();
		void setupStatusBar();
		
		void loadFile(const KURL& url);
		void writeFile(const KURL& url);
		bool queryClose();
		
		void finishExecution();
		void readConfig(KConfig *config);
		
		void updateFullScreen();
		virtual bool event(QEvent* e);
		
		Canvas              *canvasView;
		QWidget             *baseWidget;
		QGridLayout         *baseLayout;
		QDockWindow         *editorDock;
		Executer            *exe;
		ErrorMessage        *errMsg;
		ColorPicker         *picker;
		RestartOrBack       *restartOrBackDialog;
		
		KAction             *run;
		KAction             *stop;
		KAction             *openExAction;
		KAction             *openFileAction;
		KAction             *newAction;
		KAction             *ContextHelp;
		KToggleAction       *pause;
		KToggleAction       *m_fullscreen;
		KToggleAction       *colorpicker;
		KSelectAction       *speed;
		KRecentFilesAction  *m_recentFiles;

		KTextEditor::View           *view() const { return editor; }
		KTextEditor::EditInterface  *editorInterface;    
		KTextEditor::Document       *doc;
		KTextEditor::View           *editor;
		
		bool                 executing;
		bool                 b_fullscreen;
		bool                 b_editorShown;
		
		QString              helpKeyword;
		Translate           *translate;
		KURL                 CurrentFile;
		
		// configuration related
		QWidget             *general;
		QWidget             *language;
		QGroupBox           *WidthHeightBox;
		QLabel              *WidthLabel;
		QLabel              *HeightLabel;
		KIntNumInput        *kcfg_CanvasWidth;
		KIntNumInput        *kcfg_CanvasHeight;
		KComboBox           *kcfg_LanguageComboBox;
		QLabel              *LanguageLabel;
};


#endif // _KTURTLE_H_