summaryrefslogtreecommitdiffstats
path: root/kturtle/src/kturtle.h
blob: f42cbe81a9164dabbd1edc8ee54fdb853045de93 (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
183
/*
    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 <tqgroupbox.h>

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

#include <tdeparts/mainwindow.h>
#include <tdetexteditor/editinterface.h>
#include <tdetexteditor/view.h>

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


class TDERecentFilesAction;


class MainWindow : public KParts::MainWindow
{   
	TQ_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(TQString& value);
		void slotMessageDialog(TQString text);
		
		void slotEditor();
		void slotSetHighlightstyle(TQString 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(TQString);
		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(TQString 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(TDEConfig *config);
		
		void updateFullScreen();
		virtual bool event(TQEvent* e);
		
		Canvas              *canvasView;
		TQWidget             *baseWidget;
		TQGridLayout         *baseLayout;
		TQDockWindow         *editorDock;
		Executer            *exe;
		ErrorMessage        *errMsg;
		ColorPicker         *picker;
		RestartOrBack       *restartOrBackDialog;
		
		TDEAction             *run;
		TDEAction             *stop;
		TDEAction             *openExAction;
		TDEAction             *openFileAction;
		TDEAction             *newAction;
		TDEAction             *ContextHelp;
		TDEToggleAction       *pause;
		TDEToggleAction       *m_fullscreen;
		TDEToggleAction       *colorpicker;
		TDESelectAction       *speed;
		TDERecentFilesAction  *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;
		
		TQString              helpKeyword;
		Translate           *translate;
		KURL                 CurrentFile;
		
		// configuration related
		TQWidget             *general;
		TQWidget             *language;
		TQGroupBox           *WidthHeightBox;
		TQLabel              *WidthLabel;
		TQLabel              *HeightLabel;
		KIntNumInput        *kcfg_CanvasWidth;
		KIntNumInput        *kcfg_CanvasHeight;
		KComboBox           *kcfg_LanguageComboBox;
		TQLabel              *LanguageLabel;
};


#endif // _KTURTLE_H_