1 /*
2   FXiTe - The Free eXtensIble Text Editor
3   Copyright (c) 2009-2012 Jeffrey Pohlmeyer <yetanothergeek@gmail.com>
4 
5   This program is free software; you can redistribute it and/or modify it
6   under the terms of the GNU General Public License version 3 as
7   published by the Free Software Foundation.
8 
9   This software is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   GNU General Public License for more details.
13 
14   You should have received a copy of the GNU General Public License
15   along with this program; if not, write to the Free Software
16   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18 
19 #include <fx.h>
20 
21 #include "appwin.h"
22 #include "appwin_pub.h"
23 
24 #define TW TopWindow
25 
26 static TopWindow* tw = NULL;
27 
28 
OpenFile(const char * caption,const char * rowcol,bool readonly,bool hooked)29 bool TopWinPub::OpenFile(const char*caption, const char*rowcol, bool readonly, bool hooked)
30 {
31   return tw->OpenFile(caption, rowcol, readonly, hooked);
32 }
33 
34 
35 
CloseFile(bool close_last,bool hooked)36 bool TopWinPub::CloseFile(bool close_last, bool hooked)
37 {
38   return tw->CloseFile(close_last, hooked);
39 }
40 
41 
42 
ControlDoc()43 SciDoc* TopWinPub::ControlDoc()
44 {
45   return tw->ControlDoc();
46 }
47 
48 
49 
FocusedDoc()50 SciDoc* TopWinPub::FocusedDoc()
51 {
52   return tw->FocusedDoc();
53 }
54 
55 
56 
ActiveWidget(FXID aw)57 void TopWinPub::ActiveWidget(FXID aw)
58 {
59   tw->ActiveWidget(aw);
60 }
61 
62 
63 
ShowOutputPane(bool showit)64 void TopWinPub::ShowOutputPane(bool showit)
65 {
66   tw->ShowOutputPane(showit);
67 }
68 
69 
70 
KillCmdID()71 FXSelector TopWinPub::KillCmdID()
72 {
73   return TW::ID_KILL_COMMAND;
74 }
75 
76 
77 
LastID()78 FXSelector TopWinPub::LastID()
79 {
80   return TW::ID_LAST;
81 }
82 
83 
84 
SetKillCommandAccelKey(FXHotKey acckey)85 void TopWinPub::SetKillCommandAccelKey(FXHotKey acckey)
86 {
87   tw->SetKillCommandAccelKey(acckey);
88 }
89 
90 
91 
UserMenus()92 UserMenu** TopWinPub::UserMenus()
93 {
94   return tw->UserMenus();
95 }
96 
97 
98 
SaveClipboard()99 void TopWinPub::SaveClipboard()
100 {
101   tw->SaveClipboard();
102 }
103 
104 
105 
Connector()106 const FXString& TopWinPub::Connector()
107 {
108   return TW::Connector();
109 }
110 
111 
ConfigDir()112 const FXString& TopWinPub::ConfigDir()
113 {
114   return TW::ConfigDir();
115 }
116 
117 
ParseCommands(FXString & commands)118 void TopWinPub::ParseCommands(FXString &commands)
119 {
120   tw->ParseCommands(commands);
121 }
122 
123 
124 
instantiate(FXApp * a)125 FXMainWindow* TopWinPub::instantiate(FXApp*a)
126 {
127   tw=new TopWindow(a);
128   return tw;
129 }
130 
131 
132 
create()133 void TopWinPub::create()
134 {
135   tw->create();
136 }
137 
138 
139 
close(FXbool notify)140 FXbool TopWinPub::close(FXbool notify)
141 {
142   return tw->close(notify);
143 }
144 
145 
146 
147 
148 // Prints the names of the compiled-in lexers to stdout,
149 // along with the number of word lists per lexer
150 // ( Only used during development, to help with the
151 //   syntax-highlighting interface. )
152 
153 class WordList;
154 class Accessor;
155 
156 #include <SciLexer.h>
157 #include <ILexer.h>
158 #include <LexerModule.h>
159 #include <Catalogue.h>
160 
DumpLexers()161 void TopWinPub::DumpLexers() {
162   for (int i=0; i<=SCLEX_AUTOMATIC; i++) {
163     const LexerModule*lex=Catalogue::Find(i);
164     if (lex) {
165       fprintf(stdout, "%d %s %d\n", i, lex->languageName, lex->GetNumWordLists());
166     }
167   }
168 }
169 
170 
171 
FindText(const char * searchfor,FXuint searchmode,bool forward)172 void TopWinPub::FindText(const char*searchfor, FXuint searchmode, bool forward)
173 {
174   tw->FindText(searchfor,searchmode,forward);
175 }
176 
177 
178 
FindAndReplace(const char * searchfor,const char * replacewith,FXuint searchmode,bool forward)179 void TopWinPub::FindAndReplace(const char*searchfor, const char*replacewith, FXuint searchmode, bool forward)
180 {
181   tw->FindAndReplace(searchfor,replacewith,searchmode,forward);
182 }
183 
184 
185 
ReplaceAllInSelection(const char * searchstring,const char * replacewith,FXuint searchmode)186 void TopWinPub::ReplaceAllInSelection(const char*searchstring, const char*replacewith,  FXuint searchmode)
187 {
188   tw->ReplaceAllInSelection(searchstring,replacewith,searchmode);
189 }
190 
191 
192 
ReplaceAllInDocument(const char * searchstring,const char * replacewith,FXuint searchmode)193 void TopWinPub::ReplaceAllInDocument(const char*searchstring, const char*replacewith,  FXuint searchmode)
194 {
195   tw->ReplaceAllInDocument(searchstring,replacewith,searchmode);
196 }
197 
198 
199 
Paste()200 void TopWinPub::Paste()
201 {
202   tw->Paste();
203 }
204 
205 
206 
AdjustIndent(SciDoc * sci,char ch)207 void TopWinPub::AdjustIndent(SciDoc*sci,char ch)
208 {
209   tw->AdjustIndent(sci,ch);
210 }
211 
212 
Tabs()213 DocTabs* TopWinPub::Tabs()
214 {
215   return tw->Tabs();
216 }
217 
218 
219 
FileDlgs()220 FileDialogs* TopWinPub::FileDlgs()
221 {
222   return tw->FileDlgs();
223 }
224 
225 
226 
update()227 void TopWinPub::update()
228 {
229   tw->update();
230 }
231 
232 
233 
IsMacroCancelled()234 bool TopWinPub::IsMacroCancelled()
235 {
236   return tw->IsMacroCancelled();
237 }
238 
239 
240 
Closing()241 bool TopWinPub::Closing()
242 {
243   return tw->Closing();
244 }
245 
246 
247 
Destroying()248 bool TopWinPub::Destroying()
249 {
250   return tw->Destroying();
251 }
252 
253 
254 
CloseWait()255 void TopWinPub::CloseWait()
256 {
257   tw->getApp()->addChore(tw,TW::ID_CLOSEWAIT,NULL);
258 }
259 
260 
SetReadOnly(SciDoc * sci,bool rdonly)261 bool TopWinPub::SetReadOnly(SciDoc*sci, bool rdonly)
262 {
263   return tw->SetReadOnly(sci,rdonly);
264 }
265 
266 
267 
SetWordWrap(SciDoc * sci,bool wrapped)268 void TopWinPub::SetWordWrap(SciDoc*sci, bool wrapped)
269 {
270   tw->SetWordWrap(sci,wrapped);
271 }
272 
273 
274 
instance()275 FXMainWindow* TopWinPub::instance()
276 {
277   return TW::instance();
278 }
279 
280 
281 
TagFiles()282 FXMenuCaption* TopWinPub::TagFiles()
283 {
284   return tw->TagFiles();
285 }
286 
287 
288 
AddOutput(const FXString & line)289 void TopWinPub::AddOutput(const FXString&line)
290 {
291   tw->AddOutput(line);
292 }
293 
294 
IsFileOpen(const FXString & filename,bool activate)295 int TopWinPub::IsFileOpen(const FXString &filename, bool activate)
296 {
297   return tw->IsFileOpen(filename,activate);
298 }
299 
300 
301 
NamedFiles()302 FXString* TopWinPub::NamedFiles()
303 {
304   return tw->NamedFiles();
305 }
306 
307