Code::Blocks  SVN r11506
scriptbindings.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
3  * http://www.gnu.org/licenses/lgpl-3.0.html
4  *
5  * $Revision: 10677 $
6  * $Id: scriptbindings.cpp 10677 2016-01-22 05:38:20Z fuscated $
7  * $HeadURL: https://svn.code.sf.net/p/codeblocks/code/trunk/src/sdk/scripting/bindings/scriptbindings.cpp $
8  */
9 
10 #include <sdk_precomp.h>
11 #ifndef CB_PRECOMP
12  #include <settings.h>
13  #include <manager.h>
14  #include <logmanager.h>
15  #include <configmanager.h>
16  #include <editormanager.h>
17  #include <projectmanager.h>
18  #include <macrosmanager.h>
19  #include <compilerfactory.h>
20  #include <cbproject.h>
21  #include <cbeditor.h>
22  #include <globals.h>
23 #endif
24 #include "cbstyledtextctrl.h"
25 
26 #include "scriptbindings.h"
27 #include <cbexception.h>
28 #include "sc_base_types.h"
29 
30 namespace ScriptBindings
31 {
32  extern void Register_Constants();
33  extern void Register_Globals();
34  extern void Register_wxTypes();
35  extern void Register_Dialog();
36  extern void Register_ProgressDialog();
37  extern void Register_UtilDialogs();
38  extern void Register_IO();
39  extern void Register_ScriptPlugin();
40 
41  SQInteger ConfigManager_Read(HSQUIRRELVM v)
42  {
43  StackHandler sa(v);
44  int paramCount = sa.GetParamCount();
45  if (paramCount == 3)
46  {
47  wxString key = *SqPlus::GetInstance<wxString,false>(v, 2);
48  if (sa.GetType(3) == OT_INTEGER)
49  return sa.Return((SQInteger)Manager::Get()->GetConfigManager(_T("scripts"))->ReadInt(key, sa.GetInt(3)));
50  else if (sa.GetType(3) == OT_BOOL)
51  return sa.Return(Manager::Get()->GetConfigManager(_T("scripts"))->ReadBool(key, sa.GetBool(3)));
52  else if (sa.GetType(3) == OT_FLOAT)
53  return sa.Return((float)Manager::Get()->GetConfigManager(_T("scripts"))->ReadDouble(key, sa.GetFloat(3)));
54  else
55  {
56  wxString val = *SqPlus::GetInstance<wxString,false>(v, 3);
57  wxString ret = Manager::Get()->GetConfigManager(_T("scripts"))->Read(key, val);
58  return SqPlus::ReturnCopy(v, ret);
59  }
60  }
61  return sa.ThrowError("Invalid arguments to \"ConfigManager::Read\"");
62  }
63  SQInteger ConfigManager_Write(HSQUIRRELVM v)
64  {
65  StackHandler sa(v);
66  int paramCount = sa.GetParamCount();
67  if (paramCount == 3)
68  {
69  wxString key = *SqPlus::GetInstance<wxString,false>(v, 2);
70  if (sa.GetType(3) == OT_INTEGER)
71  {
72  Manager::Get()->GetConfigManager(_T("scripts"))->Write(key, (int)sa.GetInt(3));
73  return SQ_OK;
74  }
75  else if (sa.GetType(3) == OT_BOOL)
76  {
77  Manager::Get()->GetConfigManager(_T("scripts"))->Write(key, (bool)sa.GetBool(3));
78  return SQ_OK;
79  }
80  else if (sa.GetType(3) == OT_FLOAT)
81  {
82  Manager::Get()->GetConfigManager(_T("scripts"))->Write(key, sa.GetFloat(3));
83  return SQ_OK;
84  }
85  else
86  {
87  Manager::Get()->GetConfigManager(_T("scripts"))->Write(key, *SqPlus::GetInstance<wxString,false>(v, 3));
88  return SQ_OK;
89  }
90  }
91  else if (paramCount == 4)
92  {
93  wxString key = *SqPlus::GetInstance<wxString,false>(v, 2);
94  wxString val = *SqPlus::GetInstance<wxString,false>(v, 3);
95  if (sa.GetType(4) == OT_BOOL)
96  {
97  Manager::Get()->GetConfigManager(_T("scripts"))->Write(key, val, sa.GetBool(4));
98  return SQ_OK;
99  }
100  }
101  return sa.ThrowError("Invalid arguments to \"ConfigManager::Write\"");
102  }
103  SQInteger EditorManager_GetBuiltinEditor(HSQUIRRELVM v)
104  {
105  StackHandler sa(v);
106  int paramCount = sa.GetParamCount();
107  if (paramCount == 2)
108  {
109  cbEditor* ed = nullptr;
110  if (sa.GetType(2) == OT_INTEGER)
111  ed = Manager::Get()->GetEditorManager()->GetBuiltinEditor(sa.GetInt(2));
112  else
113  ed = Manager::Get()->GetEditorManager()->GetBuiltinEditor(*SqPlus::GetInstance<wxString,false>(v, 2));
114  SqPlus::Push(v, ed);
115  return 1;
116  }
117  return sa.ThrowError("Invalid arguments to \"EditorManager::GetBuiltinEditor\"");
118  }
119  SQInteger EditorManager_Open(HSQUIRRELVM v)
120  {
121  StackHandler sa(v);
122  int paramCount = sa.GetParamCount();
123  if (paramCount == 2)
124  {
125  cbEditor* ed = Manager::Get()->GetEditorManager()->Open(*SqPlus::GetInstance<wxString,false>(v, 2));
126  SqPlus::Push(v, ed);
127  return 1;
128  }
129  return sa.ThrowError("Invalid arguments to \"EditorManager::Open\"");
130  }
131  SQInteger EditorManager_Close(HSQUIRRELVM v)
132  {
133  StackHandler sa(v);
134  int paramCount = sa.GetParamCount();
135  if (paramCount == 2)
136  {
137  if (sa.GetType(2) == OT_INTEGER)
138  return sa.Return(Manager::Get()->GetEditorManager()->Close(sa.GetInt(2)));
139  else
140  return sa.Return(Manager::Get()->GetEditorManager()->Close(*SqPlus::GetInstance<wxString,false>(v, 2)));
141  }
142  return sa.ThrowError("Invalid arguments to \"EditorManager::Close\"");
143  }
144  SQInteger EditorManager_Save(HSQUIRRELVM v)
145  {
146  StackHandler sa(v);
147  int paramCount = sa.GetParamCount();
148  if (paramCount == 2)
149  {
150  if (sa.GetType(2) == OT_INTEGER)
151  return sa.Return(Manager::Get()->GetEditorManager()->Save(sa.GetInt(2)));
152  else
153  return sa.Return(Manager::Get()->GetEditorManager()->Save(*SqPlus::GetInstance<wxString,false>(v, 2)));
154  }
155  return sa.ThrowError("Invalid arguments to \"EditorManager::Save\"");
156  }
157  SQInteger cbProject_RemoveFile(HSQUIRRELVM v)
158  {
159  StackHandler sa(v);
160  int paramCount = sa.GetParamCount();
161  if (paramCount == 2)
162  {
163  cbProject* prj = SqPlus::GetInstance<cbProject,false>(v, 1);
164  if (sa.GetType(2) == OT_INTEGER)
165  return sa.ThrowError("Invalid arguments to \"cbProject::RemoveFile\"");
166  else
167  return sa.Return(prj->RemoveFile(SqPlus::GetInstance<ProjectFile,false>(v, 2)));
168  }
169  return sa.ThrowError("Invalid arguments to \"cbProject::RemoveFile\"");
170  }
171  SQInteger cbProject_AddFile(HSQUIRRELVM v)
172  {
173  StackHandler sa(v);
174  int paramCount = sa.GetParamCount();
175  if (paramCount >= 3)
176  {
177  cbProject* prj = SqPlus::GetInstance<cbProject,false>(v, 1);
178  wxString str = *SqPlus::GetInstance<wxString,false>(v, 3);
179  bool b1 = paramCount >= 4 ? sa.GetBool(4) : true;
180  bool b2 = paramCount >= 5 ? sa.GetBool(5) : true;
181  int i = paramCount == 6 ? sa.GetInt(6) : 50;
182  ProjectFile* pf = nullptr;
183  if (sa.GetType(2) == OT_INTEGER)
184  pf = prj->AddFile(sa.GetInt(2), str, b1, b2, i);
185  else
186  pf = prj->AddFile(*SqPlus::GetInstance<wxString,false>(v, 2), str, b1, b2, i);
187  SqPlus::Push(v, pf);
188  return 1;
189  }
190  return sa.ThrowError("Invalid arguments to \"cbProject::AddFile\"");
191  }
192  SQInteger cbProject_GetBuildTarget(HSQUIRRELVM v)
193  {
194  StackHandler sa(v);
195  int paramCount = sa.GetParamCount();
196  if (paramCount == 2)
197  {
198  cbProject* prj = SqPlus::GetInstance<cbProject,false>(v, 1);
199  ProjectBuildTarget* bt = nullptr;
200  if (sa.GetType(2) == OT_INTEGER)
201  bt = prj->GetBuildTarget(sa.GetInt(2));
202  else
203  bt = prj->GetBuildTarget(*SqPlus::GetInstance<wxString,false>(v, 2));
204  SqPlus::Push(v, bt);
205  return 1;
206  }
207  return sa.ThrowError("Invalid arguments to \"cbProject::GetBuildTarget\"");
208  }
209  SQInteger cbProject_RenameBuildTarget(HSQUIRRELVM v)
210  {
211  StackHandler sa(v);
212  int paramCount = sa.GetParamCount();
213  if (paramCount == 3)
214  {
215  cbProject* prj = SqPlus::GetInstance<cbProject,false>(v, 1);
216  if (sa.GetType(2) == OT_INTEGER)
217  return sa.Return(prj->RenameBuildTarget(sa.GetInt(2), *SqPlus::GetInstance<wxString,false>(v, 3)));
218  else
219  return sa.Return(prj->RenameBuildTarget(*SqPlus::GetInstance<wxString,false>(v, 2), *SqPlus::GetInstance<wxString,false>(v, 3)));
220  }
221  return sa.ThrowError("Invalid arguments to \"cbProject::RenameBuildTarget\"");
222  }
223  SQInteger cbProject_DuplicateBuildTarget(HSQUIRRELVM v)
224  {
225  StackHandler sa(v);
226  int paramCount = sa.GetParamCount();
227  if (paramCount == 3)
228  {
229  cbProject* prj = SqPlus::GetInstance<cbProject,false>(v, 1);
230  ProjectBuildTarget* bt = nullptr;
231  if (sa.GetType(2) == OT_INTEGER)
232  bt = prj->DuplicateBuildTarget(sa.GetInt(2), *SqPlus::GetInstance<wxString,false>(v, 3));
233  else
234  bt = prj->DuplicateBuildTarget(*SqPlus::GetInstance<wxString,false>(v, 2), *SqPlus::GetInstance<wxString,false>(v, 3));
235  SqPlus::Push(v, bt);
236  return 1;
237  }
238  return sa.ThrowError("Invalid arguments to \"cbProject::DuplicateBuildTarget\"");
239  }
240  SQInteger cbProject_RemoveBuildTarget(HSQUIRRELVM v)
241  {
242  StackHandler sa(v);
243  int paramCount = sa.GetParamCount();
244  if (paramCount == 2)
245  {
246  cbProject* prj = SqPlus::GetInstance<cbProject,false>(v, 1);
247  if (sa.GetType(2) == OT_INTEGER)
248  return sa.Return(prj->RemoveBuildTarget(sa.GetInt(2)));
249  else
250  return sa.Return(prj->RemoveBuildTarget(*SqPlus::GetInstance<wxString,false>(v, 2)));
251  }
252  return sa.ThrowError("Invalid arguments to \"cbProject::RemoveBuildTarget\"");
253  }
254  SQInteger cbProject_ExportTargetAsProject(HSQUIRRELVM v)
255  {
256  StackHandler sa(v);
257  int paramCount = sa.GetParamCount();
258  if (paramCount == 2)
259  {
260  cbProject* prj = SqPlus::GetInstance<cbProject,false>(v, 1);
261  if (sa.GetType(2) == OT_INTEGER)
262  return sa.Return(prj->ExportTargetAsProject(sa.GetInt(2)));
263  else
264  return sa.Return(prj->ExportTargetAsProject(*SqPlus::GetInstance<wxString,false>(v, 2)));
265  }
266  return sa.ThrowError("Invalid arguments to \"cbProject::ExportTargetAsProject\"");
267  }
268  SQInteger ProjectManager_AddFileToProject(HSQUIRRELVM v)
269  {
270  StackHandler sa(v);
271  int paramCount = sa.GetParamCount();
272  if (paramCount == 4)
273  {
274  if (sa.GetType(4) == OT_INTEGER)
275  {
276  wxString fname = *SqPlus::GetInstance<wxString,false>(v, 2);
277  cbProject* prj = SqPlus::GetInstance<cbProject,false>(v, 3);
278  int idx = sa.GetInt(4);
279  return sa.Return((SQInteger)Manager::Get()->GetProjectManager()->AddFileToProject(fname, prj, idx));
280  }
281  }
282  return sa.ThrowError("Invalid arguments to \"ProjectManager::AddFileToProject\"");
283  }
284 
285  SQInteger ProjectManager_GetProjectCount(HSQUIRRELVM v)
286  {
287  StackHandler sa(v);
288  int count = sa.GetParamCount();
289  if (count != 1)
290  return sa.ThrowError("Invalid arguments to \"ProjectManager::GetProjectCount\"");
291  else
292  {
293  ProjectManager *manager = SqPlus::GetInstance<ProjectManager, false>(v, 1);
294  int project_count = manager->GetProjects()->GetCount();
295  return sa.Return((SQInteger)project_count);
296  }
297  }
298 
299  SQInteger ProjectManager_GetProject(HSQUIRRELVM v)
300  {
301  StackHandler sa(v);
302  int count = sa.GetParamCount();
303  if (count != 2)
304  return sa.ThrowError("Invalid arguments to \"ProjectManager::GetProject\"");
305  else
306  {
307  ProjectManager *manager = SqPlus::GetInstance<ProjectManager, false>(v, 1);
308  int index = sa.GetInt(2);
309  int project_count = manager->GetProjects()->GetCount();
310  if(index >= project_count)
311  return sa.ThrowError("Index out of bounds in \"ProjectManager::GetProject\"");
312  else
313  {
314  cbProject *project = (*manager->GetProjects())[index];
315  SqPlus::Push(v, project);
316  return 1;
317  }
318  }
319  }
320  SQInteger ProjectManager_RebuildTree(HSQUIRRELVM v)
321  {
322  StackHandler sa(v);
323  int paramCount = sa.GetParamCount();
324  if (paramCount == 1)
325  {
326  ProjectManager *manager = SqPlus::GetInstance<ProjectManager, false>(v, 1);
327  if (manager)
328  {
329  manager->GetUI().RebuildTree();
330  return sa.Return();
331  }
332  return sa.ThrowError("'this' is NULL!?! (type of ProjectManager*)");
333  }
334  return sa.ThrowError("Invalid arguments to \"ProjectManager::RebuildTree\"");
335  }
336 
337  SQInteger cbEditor_SetText(HSQUIRRELVM v)
338  {
339  StackHandler sa(v);
340  int paramCount = sa.GetParamCount();
341  if (paramCount == 2)
342  {
343  cbEditor* self = SqPlus::GetInstance<cbEditor,false>(v, 1);
344  if (self)
345  {
346  self->GetControl()->SetText(*SqPlus::GetInstance<wxString,false>(v, 2));
347  return sa.Return();
348  }
349  return sa.ThrowError("'this' is NULL!?! (type of cbEditor*)");
350  }
351  return sa.ThrowError("Invalid arguments to \"cbEditor::SetText\"");
352  }
353  SQInteger cbEditor_GetText(HSQUIRRELVM v)
354  {
355  StackHandler sa(v);
356  int paramCount = sa.GetParamCount();
357  if (paramCount == 1)
358  {
359  cbEditor* self = SqPlus::GetInstance<cbEditor,false>(v, 1);
360  if (self)
361  {
362  wxString str = self->GetControl()->GetText();
363  return SqPlus::ReturnCopy(v, str);
364  }
365  return sa.ThrowError("'this' is NULL!?! (type of cbEditor*)");
366  }
367  return sa.ThrowError("Invalid arguments to \"cbEditor::GetText\"");
368  }
369  SQInteger CompilerFactory_GetCompilerIndex(HSQUIRRELVM v)
370  {
371  StackHandler sa(v);
372  int paramCount = sa.GetParamCount();
373  if (paramCount == 2)
374  return sa.Return((SQInteger)CompilerFactory::GetCompilerIndex(*SqPlus::GetInstance<wxString,false>(v, 2)));
375  return sa.ThrowError("Invalid arguments to \"CompilerFactory::GetCompilerIndex\"");
376  }
377 
379  {
381  return (compiler ? compiler->GetID() : wxString(wxEmptyString));
382  }
383 
385  {
386  if (!SquirrelVM::GetVMPtr())
387  cbThrow(_T("Scripting engine not initialized!?"));
388 
392  Register_IO(); // IO is enabled, but just for harmless functions
393  Register_Dialog();
396 
397  SqPlus::SQClassDef<ConfigManager>("ConfigManager").
398  staticFuncVarArgs(&ConfigManager_Read, "Read", "*").
399  staticFuncVarArgs(&ConfigManager_Write, "Write", "*");
400 
401  SqPlus::SQClassDef<ProjectFile>("ProjectFile").
402  func(&ProjectFile::AddBuildTarget, "AddBuildTarget").
403  func(&ProjectFile::RenameBuildTarget, "RenameBuildTarget").
404  func(&ProjectFile::RemoveBuildTarget, "RemoveBuildTarget").
405  func(&ProjectFile::GetBuildTargets, "GetBuildTargets").
406  func(&ProjectFile::GetBaseName, "GetBaseName").
407  func(&ProjectFile::GetObjName, "GetObjName").
408  func(&ProjectFile::SetObjName, "SetObjName").
409  func(&ProjectFile::GetParentProject, "GetParentProject").
410  func(&ProjectFile::SetUseCustomBuildCommand, "SetUseCustomBuildCommand").
411  func(&ProjectFile::SetCustomBuildCommand, "SetCustomBuildCommand").
412  func(&ProjectFile::GetUseCustomBuildCommand, "GetUseCustomBuildCommand").
413  func(&ProjectFile::GetCustomBuildCommand, "GetCustomBuildCommand").
414  var(&ProjectFile::file, "file").
415  var(&ProjectFile::relativeFilename, "relativeFilename").
416  var(&ProjectFile::relativeToCommonTopLevelPath, "relativeToCommonTopLevelPath").
417  var(&ProjectFile::compile, "compile").
418  var(&ProjectFile::link, "link").
419  var(&ProjectFile::weight, "weight").
420  var(&ProjectFile::compilerVar, "compilerVar").
421  var(&ProjectFile::buildTargets, "buildTargets");
422 
423  SqPlus::SQClassDef<CompileOptionsBase>("CompileOptionsBase").
424  func(&CompileOptionsBase::AddPlatform, "AddPlatform").
425  func(&CompileOptionsBase::RemovePlatform, "RemovePlatform").
426  func(&CompileOptionsBase::SetPlatforms, "SetPlatforms").
427  func(&CompileOptionsBase::GetPlatforms, "GetPlatforms").
428  func(&CompileOptionsBase::SupportsCurrentPlatform, "SupportsCurrentPlatform").
429  func(&CompileOptionsBase::SetLinkerOptions, "SetLinkerOptions").
430  func(&CompileOptionsBase::SetLinkLibs, "SetLinkLibs").
431  func(&CompileOptionsBase::SetCompilerOptions, "SetCompilerOptions").
432  func(&CompileOptionsBase::SetResourceCompilerOptions, "SetResourceCompilerOptions").
433  func(&CompileOptionsBase::SetIncludeDirs, "SetIncludeDirs").
434  func(&CompileOptionsBase::SetResourceIncludeDirs, "SetResourceIncludeDirs").
435  func(&CompileOptionsBase::SetLibDirs, "SetLibDirs").
436  func(&CompileOptionsBase::SetCommandsBeforeBuild, "SetCommandsBeforeBuild").
437  func(&CompileOptionsBase::SetCommandsAfterBuild, "SetCommandsAfterBuild").
438  func(&CompileOptionsBase::GetLinkerOptions, "GetLinkerOptions").
439  func(&CompileOptionsBase::GetLinkLibs, "GetLinkLibs").
440  func(&CompileOptionsBase::GetCompilerOptions, "GetCompilerOptions").
441  func(&CompileOptionsBase::GetResourceCompilerOptions, "GetResourceCompilerOptions").
442  func(&CompileOptionsBase::GetIncludeDirs, "GetIncludeDirs").
443  func(&CompileOptionsBase::GetResourceIncludeDirs, "GetResourceIncludeDirs").
444  func(&CompileOptionsBase::GetLibDirs, "GetLibDirs").
445  func(&CompileOptionsBase::GetCommandsBeforeBuild, "GetCommandsBeforeBuild").
446  func(&CompileOptionsBase::GetCommandsAfterBuild, "GetCommandsAfterBuild").
447  func(&CompileOptionsBase::GetModified, "GetModified").
448  func(&CompileOptionsBase::SetModified, "SetModified").
449  func(&CompileOptionsBase::AddLinkerOption, "AddLinkerOption").
450  func(&CompileOptionsBase::AddLinkLib, "AddLinkLib").
451  func(&CompileOptionsBase::AddCompilerOption, "AddCompilerOption").
452  func(&CompileOptionsBase::AddResourceCompilerOption, "AddResourceCompilerOption").
453  func(&CompileOptionsBase::AddIncludeDir, "AddIncludeDir").
454  func(&CompileOptionsBase::AddResourceIncludeDir, "AddResourceIncludeDir").
455  func(&CompileOptionsBase::AddLibDir, "AddLibDir").
456  func(&CompileOptionsBase::AddCommandsBeforeBuild, "AddCommandsBeforeBuild").
457  func(&CompileOptionsBase::AddCommandsAfterBuild, "AddCommandsAfterBuild").
458  func(&CompileOptionsBase::ReplaceLinkerOption, "ReplaceLinkerOption").
459  func(&CompileOptionsBase::ReplaceLinkLib, "ReplaceLinkLib").
460  func(&CompileOptionsBase::ReplaceCompilerOption, "ReplaceCompilerOption").
461  func(&CompileOptionsBase::ReplaceResourceCompilerOption, "ReplaceResourceCompilerOption").
462  func(&CompileOptionsBase::ReplaceIncludeDir, "ReplaceIncludeDir").
463  func(&CompileOptionsBase::ReplaceResourceIncludeDir, "ReplaceResourceIncludeDir").
464  func(&CompileOptionsBase::ReplaceLibDir, "ReplaceLibDir").
465  func(&CompileOptionsBase::RemoveLinkerOption, "RemoveLinkerOption").
466  func(&CompileOptionsBase::RemoveLinkLib, "RemoveLinkLib").
467  func(&CompileOptionsBase::RemoveCompilerOption, "RemoveCompilerOption").
468  func(&CompileOptionsBase::RemoveIncludeDir, "RemoveIncludeDir").
469  func(&CompileOptionsBase::RemoveResourceCompilerOption, "RemoveResourceCompilerOption").
470  func(&CompileOptionsBase::RemoveResourceIncludeDir, "RemoveResourceIncludeDir").
471  func(&CompileOptionsBase::RemoveLibDir, "RemoveLibDir").
472  func(&CompileOptionsBase::RemoveCommandsBeforeBuild, "RemoveCommandsBeforeBuild").
473  func(&CompileOptionsBase::RemoveCommandsAfterBuild, "RemoveCommandsAfterBuild").
474  func(&CompileOptionsBase::GetAlwaysRunPostBuildSteps, "GetAlwaysRunPostBuildSteps").
475  func(&CompileOptionsBase::SetAlwaysRunPostBuildSteps, "SetAlwaysRunPostBuildSteps").
476  func(&CompileOptionsBase::SetBuildScripts, "SetBuildScripts").
477  func(&CompileOptionsBase::GetBuildScripts, "GetBuildScripts").
478  func(&CompileOptionsBase::AddBuildScript, "AddBuildScript").
479  func(&CompileOptionsBase::RemoveBuildScript, "RemoveBuildScript").
480  func(&CompileOptionsBase::SetVar, "SetVar").
481  func(&CompileOptionsBase::GetVar, "GetVar").
482  func(&CompileOptionsBase::UnsetVar, "UnsetVar").
483  func(&CompileOptionsBase::UnsetAllVars, "UnsetAllVars");
484 
485  SqPlus::SQClassDef<CompileTargetBase>("CompileTargetBase", "CompileOptionsBase").
486  func(&CompileTargetBase::SetTargetFilenameGenerationPolicy, "SetTargetFilenameGenerationPolicy").
487 // func(&CompileTargetBase::GetTargetFilenameGenerationPolicy, "GetTargetFilenameGenerationPolicy"). // not exposed because its args are non-const references
488  func(&CompileTargetBase::GetFilename, "GetFilename").
489  func(&CompileTargetBase::GetTitle, "GetTitle").
490  func(&CompileTargetBase::SetTitle, "SetTitle").
491  func(&CompileTargetBase::SetOutputFilename, "SetOutputFilename").
492  func(&CompileTargetBase::SetWorkingDir, "SetWorkingDir").
493  func(&CompileTargetBase::SetObjectOutput, "SetObjectOutput").
494  func(&CompileTargetBase::SetDepsOutput, "SetDepsOutput").
495  func(&CompileTargetBase::GetOptionRelation, "GetOptionRelation").
496  func(&CompileTargetBase::SetOptionRelation, "SetOptionRelation").
497  func(&CompileTargetBase::GetWorkingDir, "GetWorkingDir").
498  func(&CompileTargetBase::GetObjectOutput, "GetObjectOutput").
499  func(&CompileTargetBase::GetDepsOutput, "GetDepsOutput").
500  func(&CompileTargetBase::GetOutputFilename, "GetOutputFilename").
501  func(&CompileTargetBase::SuggestOutputFilename, "SuggestOutputFilename").
502  func(&CompileTargetBase::GetExecutableFilename, "GetExecutableFilename").
503  func(&CompileTargetBase::GetDynamicLibFilename, "GetDynamicLibFilename").
504  func(&CompileTargetBase::GetDynamicLibDefFilename, "GetDynamicLibDefFilename").
505  func(&CompileTargetBase::GetStaticLibFilename, "GetStaticLibFilename").
506  func(&CompileTargetBase::GetBasePath, "GetBasePath").
507  func(&CompileTargetBase::SetTargetType, "SetTargetType").
508  func(&CompileTargetBase::GetTargetType, "GetTargetType").
509  func(&CompileTargetBase::GetExecutionParameters, "GetExecutionParameters").
510  func(&CompileTargetBase::SetExecutionParameters, "SetExecutionParameters").
511  func(&CompileTargetBase::GetHostApplication, "GetHostApplication").
512  func(&CompileTargetBase::SetHostApplication, "SetHostApplication").
513  func(&CompileTargetBase::SetCompilerID, "SetCompilerID").
514  func(&CompileTargetBase::GetCompilerID, "GetCompilerID").
515  func(&CompileTargetBase::GetMakeCommandFor, "GetMakeCommandFor").
516  func(&CompileTargetBase::SetMakeCommandFor, "SetMakeCommandFor").
517  func(&CompileTargetBase::MakeCommandsModified, "MakeCommandsModified");
518 
519  SqPlus::SQClassDef<ProjectBuildTarget>("ProjectBuildTarget", "CompileTargetBase").
520  func(&ProjectBuildTarget::GetParentProject, "GetParentProject").
521  func(&ProjectBuildTarget::GetFullTitle, "GetFullTitle").
522  func(&ProjectBuildTarget::GetExternalDeps, "GetExternalDeps").
523  func(&ProjectBuildTarget::SetExternalDeps, "SetExternalDeps").
524  func(&ProjectBuildTarget::SetAdditionalOutputFiles, "SetAdditionalOutputFiles").
525  func(&ProjectBuildTarget::GetAdditionalOutputFiles, "GetAdditionalOutputFiles").
526  func(&ProjectBuildTarget::GetIncludeInTargetAll, "GetIncludeInTargetAll").
527  func(&ProjectBuildTarget::SetIncludeInTargetAll, "SetIncludeInTargetAll").
528  func(&ProjectBuildTarget::GetCreateDefFile, "GetCreateDefFile").
529  func(&ProjectBuildTarget::SetCreateDefFile, "SetCreateDefFile").
530  func(&ProjectBuildTarget::GetCreateStaticLib, "GetCreateStaticLib").
531  func(&ProjectBuildTarget::SetCreateStaticLib, "SetCreateStaticLib").
532  func(&ProjectBuildTarget::GetUseConsoleRunner, "GetUseConsoleRunner").
533  func(&ProjectBuildTarget::SetUseConsoleRunner, "SetUseConsoleRunner").
534  func(&ProjectBuildTarget::GetFilesCount, "GetFilesCount").
535  func(&ProjectBuildTarget::GetFile, "GetFile");
536 
537  SqPlus::SQClassDef<cbProject>("cbProject", "CompileTargetBase").
538  func(&cbProject::GetModified, "GetModified").
539  func(&cbProject::SetModified, "SetModified").
540  func(&cbProject::GetMakefile, "GetMakefile").
541  func(&cbProject::SetMakefile, "SetMakefile").
542  func(&cbProject::IsMakefileCustom, "IsMakefileCustom").
543  func(&cbProject::SetMakefileCustom, "SetMakefileCustom").
544  func(&cbProject::CloseAllFiles, "CloseAllFiles").
545  func(&cbProject::SaveAllFiles, "SaveAllFiles").
546  func(&cbProject::Save, "Save").
547 // func(&cbProject::SaveAs, "SaveAs"). // *UNSAFE*
548  func(&cbProject::SaveLayout, "SaveLayout").
549  func(&cbProject::LoadLayout, "LoadLayout").
550 // func(&cbProject::ShowOptions, "ShowOptions").
551  func(&cbProject::GetCommonTopLevelPath, "GetCommonTopLevelPath").
552  func(&cbProject::GetFilesCount, "GetFilesCount").
553  func(&cbProject::GetFile, "GetFile").
554  func(&cbProject::GetFileByFilename, "GetFileByFilename").
555  staticFuncVarArgs(&cbProject_RemoveFile, "RemoveFile", "*").
556  staticFuncVarArgs(&cbProject_AddFile, "AddFile", "*").
557  func(&cbProject::GetBuildTargetsCount, "GetBuildTargetsCount").
558  staticFuncVarArgs(&cbProject_GetBuildTarget, "GetBuildTarget", "*").
559  func(&cbProject::AddBuildTarget, "AddBuildTarget").
560  staticFuncVarArgs(&cbProject_RenameBuildTarget, "RenameBuildTarget", "*").
561  staticFuncVarArgs(&cbProject_DuplicateBuildTarget, "DuplicateBuildTarget", "*").
562  staticFuncVarArgs(&cbProject_RemoveBuildTarget, "RemoveBuildTarget", "*").
563  staticFuncVarArgs(&cbProject_ExportTargetAsProject, "ExportTargetAsProject", "*").
564  func(&cbProject::BuildTargetValid, "BuildTargetValid").
565  func(&cbProject::GetFirstValidBuildTargetName, "GetFirstValidBuildTargetName").
566  func(&cbProject::SetDefaultExecuteTarget, "SetDefaultExecuteTarget").
567  func(&cbProject::GetDefaultExecuteTarget, "GetDefaultExecuteTarget").
568  func(&cbProject::SetActiveBuildTarget, "SetActiveBuildTarget").
569  func(&cbProject::GetActiveBuildTarget, "GetActiveBuildTarget").
570  func(&cbProject::SelectTarget, "SelectTarget").
571  func(&cbProject::GetCurrentlyCompilingTarget, "GetCurrentlyCompilingTarget").
572  func(&cbProject::SetCurrentlyCompilingTarget, "SetCurrentlyCompilingTarget").
573  func(&cbProject::GetModeForPCH, "GetModeForPCH").
574  func(&cbProject::SetModeForPCH, "SetModeForPCH").
575  func(&cbProject::SetExtendedObjectNamesGeneration, "SetExtendedObjectNamesGeneration").
576  func(&cbProject::GetExtendedObjectNamesGeneration, "GetExtendedObjectNamesGeneration").
577  func(&cbProject::SetNotes, "SetNotes").
578  func(&cbProject::GetNotes, "GetNotes").
579  func(&cbProject::SetShowNotesOnLoad, "SetShowNotesOnLoad").
580  func(&cbProject::GetShowNotesOnLoad, "GetShowNotesOnLoad").
581  func(&cbProject::SetCheckForExternallyModifiedFiles, "SetCheckForExternallyModifiedFiles").
582  func(&cbProject::GetCheckForExternallyModifiedFiles, "GetCheckForExternallyModifiedFiles").
583  func(&cbProject::ShowNotes, "ShowNotes").
584  func(&cbProject::AddToExtensions, "AddToExtensions").
585  func(&cbProject::DefineVirtualBuildTarget, "DefineVirtualBuildTarget").
586  func(&cbProject::HasVirtualBuildTarget, "HasVirtualBuildTarget").
587  func(&cbProject::RemoveVirtualBuildTarget, "RemoveVirtualBuildTarget").
588  func(&cbProject::GetVirtualBuildTargets, "GetVirtualBuildTargets").
589  func(&cbProject::GetVirtualBuildTargetGroup, "GetVirtualBuildTargetGroup").
590  func(&cbProject::GetExpandedVirtualBuildTargetGroup, "GetExpandedVirtualBuildTargetGroup").
591  func(&cbProject::CanAddToVirtualBuildTarget, "CanAddToVirtualBuildTarget").
592  func(&cbProject::SetTitle, "SetTitle");
593 
594 
595  SqPlus::SQClassDef<ProjectManager>("ProjectManager").
596  func(&ProjectManager::GetDefaultPath, "GetDefaultPath").
597  func(&ProjectManager::SetDefaultPath, "SetDefaultPath").
598  func(&ProjectManager::GetActiveProject, "GetActiveProject").
599  staticFuncVarArgs(&ProjectManager_GetProjectCount, "GetProjectCount", "*").
600  staticFuncVarArgs(&ProjectManager_GetProject, "GetProject", "*").
601  func(&ProjectManager::SetProject, "SetProject").
602  func(&ProjectManager::LoadWorkspace, "LoadWorkspace").
603  func(&ProjectManager::SaveWorkspace, "SaveWorkspace").
604  func(&ProjectManager::SaveWorkspaceAs, "SaveWorkspaceAs").
605  func(&ProjectManager::CloseWorkspace, "CloseWorkspace").
606  func(&ProjectManager::IsOpen, "IsOpen").
607  func(&ProjectManager::LoadProject, "LoadProject").
608  func(&ProjectManager::SaveProject, "SaveProject").
609  func(&ProjectManager::SaveProjectAs, "SaveProjectAs").
610  func(&ProjectManager::SaveActiveProject, "SaveActiveProject").
611  func(&ProjectManager::SaveActiveProjectAs, "SaveActiveProjectAs").
612  func(&ProjectManager::SaveAllProjects, "SaveAllProjects").
613  func(&ProjectManager::CloseProject, "CloseProject").
614  func(&ProjectManager::CloseActiveProject, "CloseActiveProject").
615  func(&ProjectManager::CloseAllProjects, "CloseAllProjects").
616  func(&ProjectManager::NewProject, "NewProject").
617  staticFuncVarArgs(&ProjectManager_AddFileToProject, "AddFileToProject", "*").
618 // func(&ProjectManager::AskForBuildTargetIndex, "AskForBuildTargetIndex").
619  func(&ProjectManager::AddProjectDependency, "AddProjectDependency").
620  func(&ProjectManager::RemoveProjectDependency, "RemoveProjectDependency").
621  func(&ProjectManager::ClearProjectDependencies, "ClearProjectDependencies").
622  func(&ProjectManager::RemoveProjectFromAllDependencies, "RemoveProjectFromAllDependencies").
623  func(&ProjectManager::GetDependenciesForProject, "GetDependenciesForProject").
624 // func(&ProjectManager::ConfigureProjectDependencies, "ConfigureProjectDependencies");
625  staticFuncVarArgs(&ProjectManager_RebuildTree, "RebuildTree", "*");
626 
627  SqPlus::SQClassDef<EditorBase>("EditorBase").
628  func(&EditorBase::GetFilename, "GetFilename").
629  func(&EditorBase::SetFilename, "SetFilename").
630  func(&EditorBase::GetShortName, "GetShortName").
631  func(&EditorBase::GetModified, "GetModified").
632  func(&EditorBase::SetModified, "SetModified").
633  func(&EditorBase::GetTitle, "GetTitle").
634  func(&EditorBase::SetTitle, "SetTitle").
635  func(&EditorBase::Activate, "Activate").
636  func(&EditorBase::Close, "Close").
637  func(&EditorBase::Save, "Save").
638  func(&EditorBase::IsBuiltinEditor, "IsBuiltinEditor").
639  func(&EditorBase::ThereAreOthers, "ThereAreOthers").
640  func(&EditorBase::GotoLine, "GotoLine").
641  func(&EditorBase::Undo, "Undo").
642  func(&EditorBase::Redo, "Redo").
643  func(&EditorBase::Cut, "Cut").
644  func(&EditorBase::Copy, "Copy").
645  func(&EditorBase::Paste, "Paste").
646  func(&EditorBase::CanUndo, "CanUndo").
647  func(&EditorBase::CanRedo, "CanRedo").
648  func(&EditorBase::CanPaste, "CanPaste").
649  func(&EditorBase::IsReadOnly, "IsReadOnly").
650  func(&EditorBase::HasSelection, "HasSelection");
651 
652  SqPlus::SQClassDef<cbEditor>("cbEditor", "EditorBase").
653  func(&cbEditor::SetEditorTitle, "SetEditorTitle").
654  func(&cbEditor::GetProjectFile, "GetProjectFile").
655  func(&cbEditor::Save, "Save").
656  func(&cbEditor::SaveAs, "SaveAs").
657  func(&cbEditor::FoldAll, "FoldAll").
658  func(&cbEditor::UnfoldAll, "UnfoldAll").
659  func(&cbEditor::ToggleAllFolds, "ToggleAllFolds").
660  func(&cbEditor::FoldBlockFromLine, "FoldBlockFromLine").
661  func(&cbEditor::UnfoldBlockFromLine, "UnfoldBlockFromLine").
662  func(&cbEditor::ToggleFoldBlockFromLine, "ToggleFoldBlockFromLine").
663  func(&cbEditor::GetLineIndentInSpaces, "GetLineIndentInSpaces").
664  func(&cbEditor::GetLineIndentString, "GetLineIndentString").
665  func(&cbEditor::Touch, "Touch").
666  func(&cbEditor::Reload, "Reload").
667  func(&cbEditor::Print, "Print").
668  func(&cbEditor::AutoComplete, "AutoComplete").
669  func(&cbEditor::AddBreakpoint, "AddBreakpoint").
670  func(&cbEditor::RemoveBreakpoint, "RemoveBreakpoint").
671  func(&cbEditor::ToggleBookmark, "ToggleBookmark").
672  func(&cbEditor::HasBookmark, "HasBookmark").
673  func(&cbEditor::GotoNextBookmark, "GotoNextBookmark").
674  func(&cbEditor::GotoPreviousBookmark, "GotoPreviousBookmark").
675  func(&cbEditor::ClearAllBookmarks, "ClearAllBookmarks").
676  func(&cbEditor::ToggleBreakpoint, "ToggleBreakpoint").
677  func(&cbEditor::HasBreakpoint, "HasBreakpoint").
678  func(&cbEditor::GotoNextBreakpoint, "GotoNextBreakpoint").
679  func(&cbEditor::GotoPreviousBreakpoint, "GotoPreviousBreakpoint").
680 
681 
682  // these are not present in cbEditor; included to help scripts edit text
683  staticFuncVarArgs(&cbEditor_SetText, "SetText", "*").
684  staticFuncVarArgs(&cbEditor_GetText, "GetText", "*");
685 
686  SqPlus::SQClassDef<EditorManager>("EditorManager").
687  func(&EditorManager::New, "New").
688  staticFuncVarArgs(&EditorManager_Open, "Open").
689  func(&EditorManager::IsBuiltinOpen, "IsBuiltinOpen").
690  staticFuncVarArgs(&EditorManager_GetBuiltinEditor, "GetBuiltinEditor", "*").
691  func(&EditorManager::GetBuiltinActiveEditor, "GetBuiltinActiveEditor").
692  func(&EditorManager::GetActiveEditor, "GetActiveEditor").
693  func(&EditorManager::ActivateNext, "ActivateNext").
694  func(&EditorManager::ActivatePrevious, "ActivatePrevious").
695  func(&EditorManager::SwapActiveHeaderSource, "SwapActiveHeaderSource").
696  func(&EditorManager::CloseActive, "CloseActive").
697  staticFuncVarArgs(&EditorManager_Close, "Close", "*").
698  func(&EditorManager::CloseAll, "CloseAll").
699  staticFuncVarArgs(&EditorManager_Save, "Save", "*").
700  func(&EditorManager::SaveActive, "SaveActive").
701  func(&EditorManager::SaveAs, "SaveAs").
702  func(&EditorManager::SaveActiveAs, "SaveActiveAs").
703  func(&EditorManager::SaveAll, "SaveAll");
704  // func(&EditorManager::ShowFindDialog, "ShowFindDialog");
705 
706  SqPlus::SQClassDef<UserVariableManager>("UserVariableManager").
707  func(&UserVariableManager::Exists, "Exists");
708 
709  SqPlus::SQClassDef<ScriptingManager>("ScriptingManager").
710  func(&ScriptingManager::RegisterScriptMenu, "RegisterScriptMenu");
711 
712  typedef bool(*CF_INHERITSFROM)(const wxString&, const wxString&); // CompilerInheritsFrom
713 
714  SqPlus::SQClassDef<CompilerFactory>("CompilerFactory").
715  staticFunc(&CompilerFactory::IsValidCompilerID, "IsValidCompilerID").
716  staticFuncVarArgs(&CompilerFactory_GetCompilerIndex, "GetCompilerIndex", "*").
717  staticFunc(&CompilerFactory::GetDefaultCompilerID, "GetDefaultCompilerID").
718  staticFunc(&CompilerFactory::GetCompilerVersionString, "GetCompilerVersionString").
719  staticFunc<CF_INHERITSFROM>(&CompilerFactory::CompilerInheritsFrom, "CompilerInheritsFrom").
720  staticFunc(CompilerFactory_GetCompilerIDByName, "GetCompilerIDByName");
721 
722  SqPlus::SQClassDef<PluginInfo>("PluginInfo").
723  emptyCtor().
724  var(&PluginInfo::name, "name").
725  var(&PluginInfo::title, "title").
726  var(&PluginInfo::version, "version").
727  var(&PluginInfo::description, "description").
728  var(&PluginInfo::author, "author").
729  var(&PluginInfo::authorEmail, "authorEmail").
730  var(&PluginInfo::authorWebsite, "authorWebsite").
731  var(&PluginInfo::thanksTo, "thanksTo").
732  var(&PluginInfo::license, "license");
733 
734  SqPlus::SQClassDef<FileTreeData>("FileTreeData").
735  func(&FileTreeData::GetKind, "GetKind").
736  func(&FileTreeData::GetProject, "GetProject").
737  func(&FileTreeData::GetFileIndex, "GetFileIndex").
738  func(&FileTreeData::GetProjectFile, "GetProjectFile").
739  func(&FileTreeData::GetFolder, "GetFolder").
740  func(&FileTreeData::SetKind, "SetKind").
741  func(&FileTreeData::SetProject, "SetProject").
742  func(&FileTreeData::SetFileIndex, "SetFileIndex").
743  func(&FileTreeData::SetProjectFile, "SetProjectFile").
744  func(&FileTreeData::SetFolder, "SetFolder");
745 
746  // called last because it needs a few previously registered types
748  }
749 } // namespace ScriptBindings
virtual void GotoPreviousBookmark()
Go to previous bookmark.
Definition: cbeditor.cpp:2436
ProjectFile * GetFileByFilename(const wxString &filename, bool isRelative=true, bool isUnixFilename=false)
Access a file of the project.
Definition: cbproject.cpp:1049
void ActivatePrevious()
SQInteger EditorManager_GetBuiltinEditor(HSQUIRRELVM v)
bool CloseAll(bool dontsave=false)
Closes all opened editors.
wxString authorEmail
Definition: pluginmanager.h:45
SQInteger ConfigManager_Read(HSQUIRRELVM v)
void SetDefaultPath(const wxString &path)
Set the default path for new projects.
ProjectBuildTarget * DuplicateBuildTarget(int index, const wxString &newName=wxEmptyString)
Duplicate a build target.
Definition: cbproject.cpp:1216
cbEditor * IsBuiltinOpen(const wxString &filename)
Definition: editormanager.h:92
virtual void SetOptionRelation(OptionsRelationType type, OptionsRelation rel)
Set the target&#39;s options relation for type to rel.
virtual const wxString & GetShortName() const
Returns the editor&#39;s short name.
Definition: editorbase.h:58
bool RegisterScriptMenu(const wxString &menuPath, const wxString &scriptOrFunc, bool isFunction)
Script-bound function to register a script with a menu item.
SQInteger ConfigManager_Write(HSQUIRRELVM v)
wxString relativeToCommonTopLevelPath
The relative filename to the common top-level path.
Definition: projectfile.h:135
bool Exists(const wxString &variable) const
wxString license
Definition: pluginmanager.h:48
static const wxString b1
wxString name
Definition: pluginmanager.h:40
SQInteger cbProject_RemoveFile(HSQUIRRELVM v)
void SetMakefileCustom(bool custom)
Mark if the project should use a custom Makefile for compilation.
Definition: cbproject.cpp:194
SQInteger cbProject_RenameBuildTarget(HSQUIRRELVM v)
virtual void SetMakeCommandFor(MakeCommand cmd, const wxString &make)
Set the "make" command used for cmd.
virtual bool UnsetVar(const wxString &key)
virtual bool CanPaste() const
Is there something to paste?
Definition: editorbase.h:211
const wxString & GetFolder() const
Definition: cbproject.h:62
unsigned short int weight
The weight.
Definition: projectfile.h:145
static bool IsValidCompilerID(const wxString &id)
bool GetUseCustomBuildCommand(const wxString &compilerId)
Read &#39;Use custom command to build this file&#39; for a compilerId.
virtual void SetTitle(const wxString &title)
Set the target&#39;s title.
void SetModeForPCH(PCHMode mode)
Set the mode to handle precompiled headers.
Definition: cbproject.h:306
virtual bool GetCreateDefFile() const
Valid only for targets generating dynamic libraries (DLLs or SOs).
cbEditor * New(const wxString &newFileName=wxEmptyString)
bool SaveActiveProject()
Save the active project to disk.
wxString relativeFilename
The relative (to the project) filename of this file.
Definition: projectfile.h:131
virtual bool HasSelection() const
Is there a selection?
Definition: editorbase.h:205
virtual bool GetUseConsoleRunner() const
Valid only for targets generating a console executable.
virtual void SetResourceCompilerOptions(const wxArrayString &resourceCompilerOpts)
virtual const wxString & GetAdditionalOutputFiles() const
virtual void SetObjectOutput(const wxString &dirname)
Set the target&#39;s objects output dir.
cbProject * IsOpen(const wxString &filename)
Check if a project is open based on the project&#39;s filename.
void SetDefaultExecuteTarget(const wxString &name)
Set the build target index which will be pre-selected when the "Select target" dialog appears when ru...
Definition: cbproject.cpp:1378
ConfigManager * GetConfigManager(const wxString &name_space) const
Definition: manager.cpp:474
SQInteger ProjectManager_RebuildTree(HSQUIRRELVM v)
virtual const wxString & GetTitle()
The editor&#39;s title.
Definition: editorbase.cpp:144
int ReadInt(const wxString &name, int defaultVal=0)
virtual bool SupportsCurrentPlatform() const
virtual wxString GetDepsOutput() const
Read the target&#39;s dependencies output dir.
virtual void RebuildTree()=0
Rebuild the project manager&#39;s tree.
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
Definition: manager.cpp:182
bool DefineVirtualBuildTarget(const wxString &alias, const wxArrayString &targets)
Define a new virtual build target.
Definition: cbproject.cpp:1449
virtual void AddCommandsAfterBuild(const wxString &command)
void Register_ProgressDialog()
Definition: sc_progress.cpp:52
SQInteger ProjectManager_AddFileToProject(HSQUIRRELVM v)
virtual const wxString & GetExecutionParameters() const
Read the target&#39;s execution parameters.
virtual void SetCreateDefFile(bool createIt)
Set if the target creates a DEF imports file.
bool SaveWorkspaceAs(const wxString &filename)
Save the open workspace under a different filename.
void RemoveProjectFromAllDependencies(cbProject *base)
Removes the project base from being a dependency of any other project.
virtual const wxString & GetHostApplication() const
Read the target&#39;s host application.
SQInteger ProjectManager_GetProject(HSQUIRRELVM v)
void SetShowNotesOnLoad(bool show)
Set show project notes on load automatically.
Definition: cbproject.cpp:1605
SQInteger EditorManager_Save(HSQUIRRELVM v)
bool Reload(bool detectEncoding=true)
Reloads the file from disk.
Definition: cbeditor.cpp:1673
const wxString & GetObjName()
wxFileName file
The full filename of this file.
Definition: projectfile.h:126
virtual void SetLibDirs(const wxArrayString &libDirs)
wxString GetCustomBuildCommand(const wxString &compilerId)
Read customBuild command for a compilerId.
virtual bool IsReadOnly() const
Is the editor read-only?
Definition: editorbase.h:217
virtual void Redo()
Redo changes.
Definition: editorbase.h:166
virtual void ReplaceLinkLib(const wxString &option, const wxString &new_option)
virtual const wxString & GetExternalDeps() const
bool compile
Compile flag.
Definition: projectfile.h:138
bool ReadBool(const wxString &name, bool defaultVal=false)
void UnfoldAll()
Unfold all editor folds (shows blocks of code).
Definition: cbeditor.cpp:2142
void SetModified(bool modified=true) override
Mark the project as modified or not.
Definition: cbproject.cpp:179
void SetCurrentlyCompilingTarget(ProjectBuildTarget *bt)
Set the currently compiling target.
Definition: cbproject.cpp:1444
virtual void RemoveCompilerOption(const wxString &option)
PCHMode GetModeForPCH() const
Definition: cbproject.h:301
void Print(bool selectionOnly, PrintColourMode pcm, bool line_numbers)
Print the file.
Definition: cbeditor.cpp:3010
virtual void Paste()
Paste selected text/object from clipboard.
Definition: editorbase.h:187
bool GetCheckForExternallyModifiedFiles() const
Get check for externally modified files.
Definition: cbproject.cpp:1628
wxString GetDefaultPath()
Retrieve the default path for new projects.
SQInteger cbEditor_SetText(HSQUIRRELVM v)
virtual void RemoveIncludeDir(const wxString &option)
virtual void AddBuildScript(const wxString &script)
SQInteger EditorManager_Close(HSQUIRRELVM v)
virtual const wxArrayString & GetCompilerOptions() const
virtual void Activate()
Activate this editor.
Definition: editorbase.cpp:175
virtual void RemovePlatform(int platform)
void SetText(const wxString &text)
Replace the contents of the document with the argument text.
static int GetCompilerIndex(const wxString &id)
bool CanAddToVirtualBuildTarget(const wxString &alias, const wxString &target)
Checks if a build target (virtual or real) can be added to a virtual build target, without causing a circular-reference.
Definition: cbproject.cpp:1519
#define _T(string)
virtual void AddIncludeDir(const wxString &option)
static const wxString & GetDefaultCompilerID()
virtual bool CanRedo() const
Is there something to redo?
Definition: editorbase.h:199
wxString title
Definition: pluginmanager.h:41
bool Close(const wxString &filename, bool dontsave=false)
void SetProject(cbProject *project)
Definition: cbproject.h:65
cbProjectManagerUI & GetUI()
virtual void AddPlatform(int platform)
virtual bool HasBookmark(int line) const
Does line has bookmark?
Definition: cbeditor.cpp:2426
virtual void SetIncludeInTargetAll(bool buildIt)
Deprecated, do not use at all! Set if this target should be built when the virtual target "All" is se...
void Register_Dialog()
Definition: sc_dialog.cpp:142
virtual int GetPlatforms() const
virtual void SetTargetFilenameGenerationPolicy(TargetFilenameGenerationPolicy prefix, TargetFilenameGenerationPolicy extension)
A target&#39;s filename can either be auto-generated based on the running platform, or completely specifi...
virtual void RemoveLibDir(const wxString &option)
virtual void SetExecutionParameters(const wxString &params)
Set the target&#39;s execution parameters to params.
SQInteger CompilerFactory_GetCompilerIndex(HSQUIRRELVM v)
ProjectFile * GetProjectFile() const
Definition: cbproject.h:61
virtual void SetLinkLibs(const wxArrayString &linkLibs)
virtual void SetUseConsoleRunner(bool useIt)
Set if ConsoleRunner should be used.
virtual void AddToExtensions(const wxString &stringDesc)
Convenience function (mainly for scripts) to add nodes/attributes under the <Extensions> node...
Definition: cbproject.cpp:1666
virtual const wxArrayString & GetBuildScripts() const
virtual bool MakeCommandsModified() const
True if any of the "make" commands is modified.
Represents a file in a Code::Blocks project.
Definition: projectfile.h:39
virtual void SetPlatforms(int platforms)
ProjectBuildTarget * GetCurrentlyCompilingTarget()
Get a pointer to the currently compiling target.
Definition: cbproject.h:478
virtual void ReplaceLinkerOption(const wxString &option, const wxString &new_option)
virtual wxString GetOutputFilename()
Read the target&#39;s output filename.
bool RemoveFile(ProjectFile *pf)
Remove a file from the project.
Definition: cbproject.cpp:860
virtual bool GetCreateStaticLib()
Valid only for targets generating dynamic libraries (DLLs or SOs).
virtual cbProject * GetParentProject()
virtual void SetCompilerID(const wxString &id)
! Set the flag if the host app should be run in terminal
virtual wxString SuggestOutputFilename()
Suggest a filename based on the target&#39;s type.
virtual wxString GetStaticLibFilename()
Read the target&#39;s static library filename (produced if target type is ttStaticLib) ...
virtual wxString GetFullTitle() const
virtual bool ThereAreOthers() const
Are there other editors besides this?
Definition: editorbase.cpp:214
virtual void RemoveLinkLib(const wxString &option)
void SetFolder(const wxString &folder)
Definition: cbproject.h:70
virtual void Copy()
Copy selected text/object to clipboard.
Definition: editorbase.h:184
EditorManager * GetEditorManager() const
Definition: manager.cpp:434
SQInteger cbProject_RemoveBuildTarget(HSQUIRRELVM v)
virtual TargetType GetTargetType() const
Read the target&#39;s type.
int GetFileIndex() const
Definition: cbproject.h:60
bool CloseAllFiles(bool dontsave=false)
Close all project files.
Definition: cbproject.cpp:1094
ProjectFile * GetFile(int index)
Access a file of the target.
virtual void SetModified(bool=true)
Set the modification status.
Definition: editorbase.h:73
virtual void SetCompilerOptions(const wxArrayString &compilerOpts)
const wxString & GetMakefile()
Definition: cbproject.cpp:988
const wxString & GetID() const
Get this compiler&#39;s unique ID.
Definition: compiler.h:351
bool CloseActiveProject(bool dontsave=false)
Close the active project.
virtual void AddResourceIncludeDir(const wxString &option)
virtual OptionsRelation GetOptionRelation(OptionsRelationType type) const
Read the target&#39;s options relation for type.
void Write(const wxString &name, const wxString &value, bool ignoreEmpty=false)
virtual bool Close()
Close this editor.
Definition: editorbase.cpp:203
virtual void SetHostApplication(const wxString &app)
Set the target&#39;s host application to app.
virtual const wxString & GetFilename() const
Get the editor&#39;s filename (if applicable).
Definition: editorbase.h:45
virtual void ReplaceResourceCompilerOption(const wxString &option, const wxString &new_option)
virtual const wxArrayString & GetResourceIncludeDirs() const
Represents a Code::Blocks project.
Definition: cbproject.h:96
const wxString & GetActiveBuildTarget() const
Definition: cbproject.cpp:1373
virtual const wxArrayString & GetLinkerOptions() const
bool SaveAs() override
Save editor contents under a different filename.
Definition: cbeditor.cpp:1846
cbProject * NewProject(const wxString &filename=wxEmptyString)
Create a new empty project.
virtual void AddLinkLib(const wxString &option)
virtual const wxString & GetFilename() const
int GetLineIndentInSpaces(int line=-1) const
Returns the specified line&#39;s (0-based) indentation (whitespace) in spaces.
Definition: cbeditor.cpp:2751
void RenameBuildTarget(const wxString &oldTargetName, const wxString &newTargetName)
Rename a build target this file belongs in.
bool SaveActiveProjectAs()
Save the active project to disk, asking for a filename.
EditorBase * GetActiveEditor()
virtual void AddCommandsBeforeBuild(const wxString &command)
virtual const wxArrayString & GetLinkLibs() const
cbStyledTextCtrl * GetControl() const
Returns a pointer to the underlying cbStyledTextCtrl object (which itself is the wxWindows implementa...
Definition: cbeditor.cpp:842
virtual bool HasBreakpoint(int line) const
Does line has debugger breakpoint? If line is -1, use current line.
Definition: cbeditor.cpp:2357
virtual void AddCompilerOption(const wxString &option)
cbProject * LoadProject(const wxString &filename, bool activateIt=true)
Load a project from disk.
virtual void SetOutputFilename(const wxString &filename)
Set the target&#39;s output filename.
virtual wxString GetMakeCommandFor(MakeCommand cmd) const
Get the "make" command used for cmd.
virtual const wxString & GetTitle() const
Read the target&#39;s title.
bool CloseActive(bool dontsave=false)
static wxString GetCompilerVersionString(const wxString &Id)
get the version number as string for the compiler with the specified index
virtual void AddLibDir(const wxString &option)
void RemoveBuildTarget(const wxString &targetName)
Remove this file from the specified build target.
void Register_Constants()
Definition: sc_consts.cpp:29
virtual const wxArrayString & GetResourceCompilerOptions() const
bool AddBreakpoint(int line=-1, bool notifyDebugger=true)
Add debugger breakpoint at specified line.
Definition: cbeditor.cpp:2276
virtual void SetModified(bool modified)
cbEditor * GetBuiltinActiveEditor()
Definition: editormanager.h:95
bool CloseProject(cbProject *project, bool dontsave=false, bool refresh=true)
Close a project.
void SetCheckForExternallyModifiedFiles(bool check)
Set check for externally modified files.
Definition: cbproject.cpp:1619
bool BuildTargetValid(const wxString &name, bool virtuals_too=true) const
Is there a build target (virtual or real) by name?
Definition: cbproject.cpp:1335
void ShowNotes(bool nonEmptyOnly, bool editable=false)
Show project notes now.
Definition: cbproject.cpp:1633
virtual void ToggleBookmark(int line=-1)
Toggle bookmark at specified line.
Definition: cbeditor.cpp:2374
void Register_IO()
Definition: sc_io.cpp:233
virtual void ClearAllBookmarks()
Clear all bookmarks.
Definition: cbeditor.cpp:2441
virtual void SetFilename(const wxString &filename)
Sets the editor&#39;s filename.
Definition: editorbase.h:50
cbProject * GetActiveProject()
Retrieve the active project.
wxString Read(const wxString &key, const wxString &defaultVal=wxEmptyString)
void RemoveProjectDependency(cbProject *base, cbProject *doesNotDependOn)
Removes a project dependency.
virtual void SetIncludeDirs(const wxArrayString &includeDirs)
virtual wxString GetBasePath() const
Read the target&#39;s base path, e.g. if GetFilename() returns "/usr/local/bin/xxx", base path will retur...
virtual void SetCommandsBeforeBuild(const wxArrayString &commands)
virtual const wxArrayString & GetCommandsAfterBuild() const
virtual wxString GetWorkingDir()
Read the target&#39;s working dir for execution (valid only for executable targets)
virtual void SetExternalDeps(const wxString &deps)
Set a list of all the external files this targets depends on.
virtual void SetWorkingDir(const wxString &dirname)
Set the target&#39;s working dir on execution (valid only for executable targets)
virtual void AddResourceCompilerOption(const wxString &option)
bool AddProjectDependency(cbProject *base, cbProject *dependsOn)
Adds a project as a dependency of another project.
bool Save(const wxString &filename)
virtual bool IsBuiltinEditor() const
Is this a built-in editor?
Definition: editorbase.cpp:209
const wxArrayString & GetVirtualBuildTargetGroup(const wxString &alias) const
Access a virtual build target&#39;s group of build targets.
Definition: cbproject.cpp:1496
wxString wxEmptyString
bool SaveAs(int index)
virtual void SetAlwaysRunPostBuildSteps(bool always)
SQInteger cbProject_DuplicateBuildTarget(HSQUIRRELVM v)
virtual wxString GetDynamicLibFilename()
Read the target&#39;s dynamic library filename (produced if target type is ttDynamicLib) ...
virtual void Undo()
Undo changes.
Definition: editorbase.h:163
wxString version
Definition: pluginmanager.h:42
bool SaveAllFiles()
Save all project files.
Definition: cbproject.cpp:1117
const wxString & GetNotes() const
Get notes on the project.
Definition: cbproject.cpp:1600
ProjectFile * AddFile(const wxString &targetName, const wxString &filename, bool compile=true, bool link=true, unsigned short int weight=50)
Add a file to the project.
Definition: cbproject.cpp:621
virtual void SetCreateStaticLib(bool createIt)
Set if an import library should be created.
int GetFilesCount()
Definition: cbproject.h:142
void SetCustomBuildCommand(const wxString &compilerId, const wxString &newBuildCommand)
Modify customBuild command for a compilerId.
cbEditor * Open(const wxString &filename, int pos=0, ProjectFile *data=nullptr)
bool SaveProjectAs(cbProject *project)
Save a project to disk, asking for a filename.
bool SaveProject(cbProject *project)
Save a project to disk.
virtual void RemoveLinkerOption(const wxString &option)
cbEditor * GetBuiltinEditor(EditorBase *eb)
bool IsMakefileCustom()
Definition: cbproject.h:159
int GetBuildTargetsCount()
Definition: cbproject.h:200
void SetMakefile(const wxString &makefile)
Set the Makefile filename used when exporting a Makefile for the project, or when using a custom Make...
Definition: cbproject.h:148
#define cbThrow(message)
Definition: cbexception.h:42
static bool CompilerInheritsFrom(const wxString &id, const wxString &from_id)
virtual const wxArrayString & GetIncludeDirs() const
ProjectFile * GetFile(int index)
Access a file of the project.
Definition: cbproject.cpp:1031
virtual wxString GetExecutableFilename() const
Read the target&#39;s executable filename (produced if target type is ttExecutable)
virtual bool GetModified() const
Is it modified?
Definition: editorbase.h:67
wxString thanksTo
Definition: pluginmanager.h:47
wxString compilerVar
The compiler variable used for this file (e.g CPP, CC, etc).
Definition: projectfile.h:187
SQInteger cbProject_GetBuildTarget(HSQUIRRELVM v)
wxArrayString GetVirtualBuildTargets() const
Get a list of all defined virtual build targets.
Definition: cbproject.cpp:1487
void UnfoldBlockFromLine(int line=-1)
Unfolds the block containing line.
Definition: cbeditor.cpp:2209
virtual void SetDepsOutput(const wxString &dirname)
Set the target&#39;s dependencies output dir.
wxArrayString GetExpandedVirtualBuildTargetGroup(const wxString &alias) const
Access a virtual build target&#39;s expanded group of build targets.
Definition: cbproject.cpp:1507
ProjectBuildTarget * GetBuildTarget(int index)
Access a build target.
Definition: cbproject.cpp:1392
Abstract base class for compilers.
Definition: compiler.h:274
virtual void ReplaceIncludeDir(const wxString &option, const wxString &new_option)
const wxString & GetDefaultExecuteTarget() const
Definition: cbproject.cpp:1387
bool GetExtendedObjectNamesGeneration() const
Gets object names generation mode (extended/normal).
Definition: cbproject.cpp:1586
void Touch()
Sets the last modification time for the file to &#39;now&#39;.
Definition: cbeditor.cpp:1699
virtual void SetLinkerOptions(const wxArrayString &linkerOpts)
virtual void ReplaceLibDir(const wxString &option, const wxString &new_option)
void SetProject(cbProject *project, bool refresh=true)
Set the active project.
A file editor.
Definition: cbeditor.h:43
virtual void RemoveBuildScript(const wxString &script)
virtual bool GetAlwaysRunPostBuildSteps() const
virtual const wxArrayString & GetLibDirs() const
void FoldAll()
Fold all editor folds (hides blocks of code).
Definition: cbeditor.cpp:2137
wxString GetBaseName() const
virtual void SetTitle(const wxString &newTitle)
Set the editor&#39;s title.
Definition: editorbase.cpp:149
cbProject * GetProject() const
Definition: cbproject.h:59
The entry point singleton for working with projects.
void FoldBlockFromLine(int line=-1)
Folds the block containing line.
Definition: cbeditor.cpp:2202
virtual const wxString & GetCompilerID() const
Read the target&#39;s compiler.
bool CloseAllProjects(bool dontsave=false)
Close all projects.
virtual bool SetVar(const wxString &key, const wxString &value, bool onlyIfExists=false)
bool GetShowNotesOnLoad() const
Get show project notes on load automatically.
Definition: cbproject.cpp:1614
bool LoadLayout()
Load the project&#39;s layout.
Definition: cbproject.cpp:513
wxString GetLineIndentString(int line=-1) const
Returns the specified line&#39;s (0-based) indentation (whitespace) string.
Definition: cbeditor.cpp:2778
virtual void RemoveResourceIncludeDir(const wxString &option)
FileTreeDataKind GetKind() const
Definition: cbproject.h:58
wxString authorWebsite
Definition: pluginmanager.h:46
bool CloseWorkspace()
Close the workspace.
SQInteger cbProject_ExportTargetAsProject(HSQUIRRELVM v)
wxString GetCommonTopLevelPath() const
Definition: cbproject.cpp:423
bool GetModified() const override
Definition: cbproject.cpp:162
SQInteger ProjectManager_GetProjectCount(HSQUIRRELVM v)
virtual void SetResourceIncludeDirs(const wxArrayString &resIncludeDirs)
virtual void ReplaceCompilerOption(const wxString &option, const wxString &new_option)
cbProject * GetParentProject()
Definition: projectfile.h:93
bool Save() override
Save editor contents.
Definition: cbeditor.cpp:1789
bool HasVirtualBuildTarget(const wxString &alias) const
Does a virtual build target exist?
Definition: cbproject.cpp:1470
virtual void ToggleBreakpoint(int line=-1, bool notifyDebugger=true)
Toggle debugger breakpoint at specified line.
Definition: cbeditor.cpp:2322
void SetKind(FileTreeDataKind kind)
Definition: cbproject.h:64
virtual void GotoNextBreakpoint()
Go to next debugger breakpoint.
Definition: cbeditor.cpp:2364
void SetTitle(const wxString &title) override
Changes project title.
Definition: cbproject.cpp:1650
virtual void GotoLine(int, bool=true)
Move the caret at the specified line.
Definition: editorbase.h:160
Represents a Code::Blocks project build target.
void SetExtendedObjectNamesGeneration(bool ext)
Sets object names generation to extended/normal mode.
Definition: cbproject.cpp:1565
virtual void GotoPreviousBreakpoint()
Go to previous debugger breakpoint.
Definition: cbeditor.cpp:2369
void Register_ScriptPlugin()
Definition: sc_plugin.cpp:339
virtual void RemoveCommandsAfterBuild(const wxString &command)
void SetProjectFile(ProjectFile *file)
Definition: cbproject.h:68
void AutoComplete()
This method is obsolete, use the abbreviations plugin instead.
Definition: cbeditor.cpp:1983
ProjectFile * GetProjectFile() const
Read the ProjectFile pointer associated with this editor.
Definition: cbeditor.h:123
void SetUseCustomBuildCommand(const wxString &compilerId, bool useCustomBuildCommand)
Modify &#39;Use custom command to build this file&#39; for a compilerId.
bool RemoveVirtualBuildTarget(const wxString &alias)
Remove a virtual build target.
Definition: cbproject.cpp:1475
virtual void SetTargetType(TargetType pt)
Set the target&#39;s type to pt.
ProjectsArray * GetProjects()
Retrieve an array of all the opened projects.
virtual const wxString & GetVar(const wxString &key) const
void ToggleFoldBlockFromLine(int line=-1)
Toggles folding of the block containing line.
Definition: cbeditor.cpp:2216
bool SaveAllProjects()
Saves all projects to disk.
void SetNotes(const wxString &notes)
Set notes on the project.
Definition: cbproject.cpp:1591
void SetEditorTitle(const wxString &title)
Sets the editor title.
Definition: cbeditor.cpp:877
static Compiler * GetCompilerByName(const wxString &title)
bool LoadWorkspace(const wxString &filename=DEFAULT_WORKSPACE)
Load a workspace.
ProjectBuildTarget * AddBuildTarget(const wxString &targetName)
Add a new build target.
Definition: cbproject.cpp:1150
virtual void AddLinkerOption(const wxString &option)
virtual void Cut()
Cut selected text/object to clipboard.
Definition: editorbase.h:181
wxString CompilerFactory_GetCompilerIDByName(const wxString &name)
const wxArrayString & GetBuildTargets() const
SQInteger cbProject_AddFile(HSQUIRRELVM v)
void AddBuildTarget(const wxString &targetName)
Make this file belong to an additional build target.
Definition: projectfile.cpp:78
SQInteger EditorManager_Open(HSQUIRRELVM v)
SQInteger cbEditor_GetText(HSQUIRRELVM v)
virtual void RemoveCommandsBeforeBuild(const wxString &command)
virtual wxString GetObjectOutput() const
Read the target&#39;s objects output dir.
virtual bool CanUndo() const
Is there something to undo?
Definition: editorbase.h:193
bool Save()
Save the project.
Definition: cbproject.cpp:482
virtual void ReplaceResourceIncludeDir(const wxString &option, const wxString &new_option)
int SelectTarget(int initial=-1, bool evenIfOne=false)
Displays a target selection dialog.
Definition: cbproject.cpp:1130
virtual bool GetModified() const
bool RemoveBuildTarget(int index)
Remove a build target.
Definition: cbproject.cpp:1284
virtual bool Save()
Save contents.
Definition: editorbase.h:113
void SetFileIndex(int index)
Definition: cbproject.h:67
virtual wxString GetDynamicLibDefFilename()
Read the target&#39;s dynamic library definition file filename (produced if target type is ttDynamicLib) ...
virtual void SetBuildScripts(const wxArrayString &scripts)
virtual void UnsetAllVars()
virtual void SetCommandsAfterBuild(const wxArrayString &commands)
virtual bool GetIncludeInTargetAll() const
Deprecated, do not use at all!
virtual void SetAdditionalOutputFiles(const wxString &files)
Set a list of all additional output files this targets creates, besides its main output.
bool SaveWorkspace()
Save the open workspace.
void Register_Globals()
Definition: sc_globals.cpp:200
virtual void RemoveResourceCompilerOption(const wxString &option)
void ToggleAllFolds()
Toggle all editor folds (inverts the show/hide state of blocks of code).
Definition: cbeditor.cpp:2147
double ReadDouble(const wxString &name, double defaultVal=0.0f)
bool SetActiveBuildTarget(const wxString &name)
Set the active build target.
Definition: cbproject.cpp:1355
const ProjectsArray * GetDependenciesForProject(cbProject *base)
Get the array of projects base depends on.
void Register_wxTypes()
Definition: sc_wxtypes.cpp:278
bool SaveLayout()
Save the project&#39;s layout.
Definition: cbproject.cpp:499
bool RemoveBreakpoint(int line=-1, bool notifyDebugger=true)
Remove debugger breakpoint at specified line.
Definition: cbeditor.cpp:2299
bool RenameBuildTarget(int index, const wxString &targetName)
Rename a build target.
Definition: cbproject.cpp:1178
void SetObjName(const wxString &name)
Set the generated object filename.
wxArrayString buildTargets
An array of strings, containing the names of all the build targets this file belongs to...
Definition: projectfile.h:190
wxString GetFirstValidBuildTargetName(bool virtuals_too=true) const
Definition: cbproject.cpp:1345
bool ExportTargetAsProject(int index)
Export a target as a new project.
Definition: cbproject.cpp:1246
wxString description
Definition: pluginmanager.h:43
virtual void GotoNextBookmark()
Go to next bookmark.
Definition: cbeditor.cpp:2431
bool SwapActiveHeaderSource()
void ClearProjectDependencies(cbProject *base)
Removes all dependencies from project base.
wxString author
Definition: pluginmanager.h:44
virtual const wxArrayString & GetCommandsBeforeBuild() const