Index: src/sdk/scripting/bindings/sc_consts.cpp
===================================================================
--- src/sdk/scripting/bindings/sc_consts.cpp (revision 3557)
+++ src/sdk/scripting/bindings/sc_consts.cpp (arbetskopia)
@@ -7,7 +7,11 @@
#include <filefilters.h>
#include "sc_base_types.h"
+#include "sc_listdir.h"
+// This is for wxScintilla constants used when scripting cbEditor
+#include "wx/wxscintilla.h"
+
// helper macros to bind constants
#define BIND_INT_CONSTANT(a) SqPlus::BindConstant<SQInteger>(a, #a);
#define BIND_INT_CONSTANT_NAMED(a,n) SqPlus::BindConstant<SQInteger>(a, n);
@@ -223,6 +227,20 @@
BIND_WXSTR_CONSTANT_NAMED(FileFilters::RESOURCE_DOT_EXT, "DOT_EXT_RESOURCE");
BIND_WXSTR_CONSTANT_NAMED(FileFilters::RESOURCEBIN_DOT_EXT, "DOT_EXT_RESOURCEBIN");
BIND_WXSTR_CONSTANT_NAMED(FileFilters::XML_DOT_EXT, "DOT_EXT_XML");
- BIND_WXSTR_CONSTANT_NAMED(FileFilters::SCRIPT_DOT_EXT, "DOT_EXT_SCRIPT");
+
+ // For wxScintilla
+ BIND_INT_CONSTANT_NAMED(wxSCI_FIND_WHOLEWORD, "wxSCI_FIND_WHOLEWORD");
+ BIND_INT_CONSTANT_NAMED(wxSCI_FIND_MATCHCASE, "wxSCI_FIND_MATCHCASE");
+ BIND_INT_CONSTANT_NAMED(wxSCI_FIND_WORDSTART, "wxSCI_FIND_WORDSTART");
+ BIND_INT_CONSTANT_NAMED(wxSCI_FIND_REGEXP, "wxSCI_FIND_REGEXP");
+ BIND_INT_CONSTANT_NAMED(wxSCI_FIND_POSIX, "wxSCI_FIND_POSIX");
+
+ // For ListDirectory
+ BIND_INT_CONSTANT_NAMED(LISTDIR_FILES, "LISTDIR_FILES");
+ BIND_INT_CONSTANT_NAMED(LISTDIR_DIRS, "LISTDIR_DIRS");
+ BIND_INT_CONSTANT_NAMED(LISTDIR_ABS_PATH, "LISTDIR_ABS_PATH");
+ BIND_INT_CONSTANT_NAMED(LISTDIR_DETAILS, "LISTDIR_DETAILS");
+ BIND_INT_CONSTANT_NAMED(LISTDIR_RECURSIVE, "LISTDIR_RECURSIVE");
+ BIND_INT_CONSTANT_NAMED(LISTDIR_DEFAULT, "LISTDIR_DEFAULT");
}
};
Index: src/sdk/scripting/bindings/scriptbindings.cpp
===================================================================
--- src/sdk/scripting/bindings/scriptbindings.cpp (revision 3557)
+++ src/sdk/scripting/bindings/scriptbindings.cpp (arbetskopia)
@@ -90,6 +90,20 @@
}
return sa.ThrowError("Invalid arguments to \"ConfigManager::Write\"");
}
+ SQInteger ConfigManager_LocateDataFile(HSQUIRRELVM v)
+ {
+ StackHandler sa(v);
+ int paramCount = sa.GetParamCount();
+ if (paramCount == 1 || paramCount == 2 )
+ {
+ wxString filename = *SqPlus::GetInstance<wxString>(v, 2);
+ int search_dirs = sdScriptsUser | sdCurrent | sdScriptsGlobal;
+ if( paramCount == 2 ) search_dirs = *SqPlus::GetInstance<int>(v, 3);
+ wxString path = ConfigManager::LocateDataFile(filename, search_dirs);
+ return SqPlus::ReturnCopy(v, path);
+ }
+ return sa.ThrowError("Invalid arguments to \"ConfigManager::LocateDataFile\"");
+ }
SQInteger EditorManager_GetBuiltinEditor(HSQUIRRELVM v)
{
StackHandler sa(v);
@@ -327,7 +341,8 @@
SqPlus::SQClassDef<ConfigManager>("ConfigManager").
staticFuncVarArgs(&ConfigManager_Read, "Read", "*").
- staticFuncVarArgs(&ConfigManager_Write, "Write", "*");
+ staticFuncVarArgs(&ConfigManager_Write, "Write", "*").
+ staticFuncVarArgs(&ConfigManager_LocateDataFile, "LocatDataFile", "*");
SqPlus::SQClassDef<ProjectFile>("ProjectFile").
func(&ProjectFile::AddBuildTarget, "AddBuildTarget").
@@ -557,6 +572,7 @@
func(&cbEditor::AutoComplete, "AutoComplete").
func(&cbEditor::AddBreakpoint, "AddBreakpoint").
func(&cbEditor::RemoveBreakpoint, "RemoveBreakpoint").
+
// these are not present in cbEditor; included to help scripts edit text
staticFuncVarArgs(&cbEditor_SetText, "SetText", "*").
staticFuncVarArgs(&cbEditor_GetText, "GetText", "*");
Index: src/sdk/scripting/bindings/sc_listdir.h
===================================================================
--- src/sdk/scripting/bindings/sc_listdir.h (revision 0)
+++ src/sdk/scripting/bindings/sc_listdir.h (revision 0)
@@ -0,0 +1,91 @@
+#ifndef SC_LISTDIR_H
+#define SC_LISTDIR_H
+
+enum
+{
+ LISTDIR_FILES = 0x0001, // include files
+ LISTDIR_DIRS = 0x0002, // include directories
+ LISTDIR_ABS_PATH = 0x0004, // list with absolute paths
+ LISTDIR_DETAILS = 0x0008, // list size and filedates
+ LISTDIR_RECURSIVE = 0x0010, // Go into subdirectories
+
+ LISTDIR_DEFAULT = LISTDIR_FILES | LISTDIR_DIRS | LISTDIR_DETAILS
+};
+
+// This class is used for the ListDirectory function
+// Lists both files and/or dirs, optionally recursively
+class wxDirTraverserFlex : public wxDirTraverser {
+public:
+ wxDirTraverserFlex(wxArrayString& files, int flags, const wxString &base_path)
+ : m_files(files), m_flags(flags) {
+ m
download for full patch...