From: John L. <jr...@us...> - 2007-06-14 01:23:25
|
Update of /cvsroot/wxlua/wxLua/samples In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv14159/wxLua/samples Modified Files: bindings.wx.lua calculator.wx.lua debug.wx.lua editor.wx.lua fldemo.wx.lua mdi.wx.lua minimal.wx.lua printing.wx.lua scribble.wx.lua validator.wx.lua wxluasudoku.wx.lua Log Message: Changed the Delete() function from the %delete tag for classes to just delete() to avoid any future name clashes since delete() is never allowed to be a function name in C++. Moved the wxStyledTextCtrl class and it's 1268 defines into the wxstc table. Moved wxLuaObject, wxLuaDebugger (and friends) into the wxlua table and added more functions for inspecting userdata and the bindings. Fix mismatches between the bindings base classes and what they really are. Index: debug.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/debug.wx.lua,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** debug.wx.lua 12 Jun 2007 00:08:42 -0000 1.12 --- debug.wx.lua 14 Jun 2007 01:23:20 -0000 1.13 *************** *** 110,114 **** end ! dc:Delete() -- ALWAYS Delete() any wxDCs created when done end --- 110,114 ---- end ! dc:delete() -- ALWAYS delete() any wxDCs created when done end *************** *** 411,416 **** running = nil bitmapDC:SelectObject(wx.wxNullBitmap) ! bitmapDC:Delete() -- ALWAYS Delete() any wxDCs created when done ! bitmap:Delete() local x, y, w, h --- 411,416 ---- running = nil bitmapDC:SelectObject(wx.wxNullBitmap) ! bitmapDC:delete() -- ALWAYS delete() any wxDCs created when done ! bitmap:delete() local x, y, w, h Index: mdi.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/mdi.wx.lua,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** mdi.wx.lua 31 May 2007 17:18:56 -0000 1.12 --- mdi.wx.lua 14 Jun 2007 01:23:20 -0000 1.13 *************** *** 28,32 **** dc:DrawEllipse(30, 30, 260, 260); dc:DrawText("A test string for window Id "..tostring(win:GetId()), 50, 150); ! dc:Delete() -- ALWAYS Delete() any wxDCs created when done end child:Connect(wx.wxEVT_PAINT, OnPaint) --- 28,32 ---- dc:DrawEllipse(30, 30, 260, 260); dc:DrawText("A test string for window Id "..tostring(win:GetId()), 50, 150); ! dc:delete() -- ALWAYS delete() any wxDCs created when done end child:Connect(wx.wxEVT_PAINT, OnPaint) Index: bindings.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/bindings.wx.lua,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** bindings.wx.lua 13 Jun 2007 04:15:29 -0000 1.6 --- bindings.wx.lua 14 Jun 2007 01:23:20 -0000 1.7 *************** *** 116,121 **** frame = nil listCtrl = nil ! ID_LISTCTRL = 1000 -- id of the listctrl ID_VIEW_BASECLASS_FUNCTIONS = 1001 img_normal = 0 -- a "file" image in the listctrl img_folder = 1 -- a "folder" image in the listctrl --- 116,124 ---- frame = nil listCtrl = nil ! ! ID_LISTCTRL = 1000 -- id of the listctrl ID_VIEW_BASECLASS_FUNCTIONS = 1001 + ID_STACK_DIALOG = 1002 + img_normal = 0 -- a "file" image in the listctrl img_folder = 1 -- a "folder" image in the listctrl *************** *** 137,150 **** bindingList = {} -- Table of {"name space", "wxLuaBinding_XXX function"} -- ---------------------------------------------------------------------------- ! -- Find the bindings installed into wxLua -- ---------------------------------------------------------------------------- ! for k, v in pairs(wx) do ! if string.find(k, "wxLuaBinding_", 1, 1) then ! table.insert(bindingList, {"wx", k}) end end -- ---------------------------------------------------------------------------- --- 140,229 ---- bindingList = {} -- Table of {"name space", "wxLuaBinding_XXX function"} + wxclassInfo = {} -- Table of all wxWidget wxClassInfo + -- ---------------------------------------------------------------------------- ! -- Load all the wxWidgets wxClassInfo -- ---------------------------------------------------------------------------- + function CreatewxClassInfoTable() ! -- create a table of tables of cols of the classname and baseclass names ! -- if there is a baseclass2 then the returned table will have > 1 tables ! local function GetBases(ci) ! local c = ci ! local t = {{}} ! ! while c do ! table.insert(t[1], c:GetClassName()) ! ! if c:GetBaseClass2() then ! --print(c:GetClassName(), "Has Base2", c:GetBaseClass2()) ! ! local t2 = GetBases(c:GetBaseClass2()) ! for i = 1, #t2 do ! -- insert back in the original info ! for j = 1, #t do ! table.insert(t2[i], j, t[1][j]) ! end ! t2[i][1] = t2[i][1].." "..tostring(i) ! table.insert(t, t2[i]) ! end ! end ! ! c = c:GetBaseClass1() ! end ! ! return t end + + local t = { + {"..", ["icon"] = img_folder}, + ["col_labels"] = {"wxClassInfo::GetClassName()"}, + ["object_type"] = "All Classes" + } + + local ci = wx.wxClassInfo.GetFirst() + local max_cols = 0 + + while ci do + local tc = GetBases(ci) + for i = 1, #tc do + if max_cols < #tc[i] then max_cols = #tc[i] end + table.insert(t, tc[i]) + end + + ci = ci:GetNext() + end + + for i = 1, #t do + for j = #t[i], max_cols do + table.insert(t[i], "") + end + end + + for i = 2, max_cols do + table.insert(t.col_labels, "Base Class "..tostring(i-1)) + end + + table.sort(t, function(t1, t2) return t1[1] < t2[1] end) + + return t end + wxclassInfo = CreatewxClassInfoTable() + + -- ---------------------------------------------------------------------------- + -- Find the bindings installed into wxLua + -- ---------------------------------------------------------------------------- + wxlua_tables = { "wxlua", "wx", "wxstc" } + + for i = 1, #wxlua_tables do + if _G[wxlua_tables[i]] then + for k, v in pairs(_G[wxlua_tables[i]]) do + if string.find(k, "wxLuaBinding_", 1, 1) then + table.insert(bindingList, {wxlua_tables[i], k}) + end + end + end + end -- ---------------------------------------------------------------------------- *************** *** 290,307 **** -- subtract values from high to low value ! t = HasBit(t, wx.WXLUAMETHOD_OVERLOAD_BASE, nil, nil) -- nobody should care about this ! t = HasBit(t, wx.WXLUAMETHOD_DELETE, s, "Delete") ! t = HasBit(t, wx.WXLUAMETHOD_OVERLOAD, s, "Overload") ! t = HasBit(t, wx.WXLUAMETHOD_STATIC, s, "Static") ! t = HasBit(t, wx.WXLUAMETHOD_SETPROP, s, "SetProp") ! t = HasBit(t, wx.WXLUAMETHOD_GETPROP, s, "GetProp") ! t = HasBit(t, wx.WXLUAMETHOD_CFUNCTION, s, "CFunc") ! t = HasBit(t, wx.WXLUAMETHOD_METHOD, s, "Method") ! t = HasBit(t, wx.WXLUAMETHOD_CONSTRUCTOR, s, "Constructor") assert(t == 0, "The wxLuaMethod_Type is not handled correctly, remainder "..tostring(t).." of "..tostring(t_)) -- remove this, nobody should care and it'll probably be confusing ! t = HasBit(t_, wx.WXLUAMETHOD_OVERLOAD_BASE, nil, nil) return string.format("0x%04X (%s)", t, table.concat(s, ", ")) --- 369,386 ---- -- subtract values from high to low value ! t = HasBit(t, wxlua.WXLUAMETHOD_OVERLOAD_BASE, nil, nil) -- nobody should care about this ! t = HasBit(t, wxlua.WXLUAMETHOD_DELETE, s, "Delete") ! t = HasBit(t, wxlua.WXLUAMETHOD_OVERLOAD, s, "Overload") ! t = HasBit(t, wxlua.WXLUAMETHOD_STATIC, s, "Static") ! t = HasBit(t, wxlua.WXLUAMETHOD_SETPROP, s, "SetProp") ! t = HasBit(t, wxlua.WXLUAMETHOD_GETPROP, s, "GetProp") ! t = HasBit(t, wxlua.WXLUAMETHOD_CFUNCTION, s, "CFunc") ! t = HasBit(t, wxlua.WXLUAMETHOD_METHOD, s, "Method") ! t = HasBit(t, wxlua.WXLUAMETHOD_CONSTRUCTOR, s, "Constructor") assert(t == 0, "The wxLuaMethod_Type is not handled correctly, remainder "..tostring(t).." of "..tostring(t_)) -- remove this, nobody should care and it'll probably be confusing ! t = HasBit(t_, wxlua.WXLUAMETHOD_OVERLOAD_BASE, nil, nil) return string.format("0x%04X (%s)", t, table.concat(s, ", ")) *************** *** 311,320 **** -- Convert the argtags table into a readable string -- ---------------------------------------------------------------------------- - function CreateArgTagsString(args_table) local arg_names = {} for j = 1, #args_table do ! table.insert(arg_names, wx.wxlua_typename(args_table[j])) end --- 390,398 ---- -- Convert the argtags table into a readable string -- ---------------------------------------------------------------------------- function CreateArgTagsString(args_table) local arg_names = {} for j = 1, #args_table do ! table.insert(arg_names, wxlua.wxlua_typename(args_table[j])) end *************** *** 323,327 **** -- ---------------------------------------------------------------------------- ! -- Create tables from the different binding structs type -- ---------------------------------------------------------------------------- function CreatewxLuaBindClass(tbl) --- 401,405 ---- -- ---------------------------------------------------------------------------- ! -- Create a list table from a wxLuaBindClass struct table -- ---------------------------------------------------------------------------- function CreatewxLuaBindClass(tbl) *************** *** 360,363 **** --- 438,445 ---- return t end + + -- ---------------------------------------------------------------------------- + -- Create a list table from a wxLuaBindMethod struct table + -- ---------------------------------------------------------------------------- function CreatewxLuaBindMethod(tbl, classname) local keys = { "name", "type", "funcs", "funcs_n", "basemethod" } *************** *** 404,407 **** --- 486,493 ---- return t end + + -- ---------------------------------------------------------------------------- + -- Create a list table from a wxLuaBindDefine struct table + -- ---------------------------------------------------------------------------- function CreatewxLuaBindDefine(tbl) local keys = { "name", "value" } *************** *** 420,427 **** --- 506,521 ---- return t end + + -- ---------------------------------------------------------------------------- + -- Create a list table from a wxLuaBindString struct table + -- ---------------------------------------------------------------------------- function CreatewxLuaBindString(tbl) local keys = { "name", "value" } return CreatewxLuaBindTable(tbl, keys, "wxLuaBindString") end + + -- ---------------------------------------------------------------------------- + -- Create a list table from a wxLuaBindEvent struct table + -- ---------------------------------------------------------------------------- function CreatewxLuaBindEvent(tbl) local keys = { "name", "eventType", "class_tag" } *************** *** 430,438 **** -- Add the class tag name for the event for i = 2, #t do ! t[i][3] = wx.wxlua_typename(t[i][3]).." ("..t[i][3]..")" end return t end function CreatewxLuaBindObject(tbl) local keys = { "name", "object", "class_tag" } --- 524,537 ---- -- Add the class tag name for the event for i = 2, #t do ! t[i][3] = wxlua.wxlua_typename(t[i][3]).." ("..t[i][3]..")" ! -- if t[i-1][2] == t[i][2] then t[i].color = wx.wxRED end -- see if there's dups, there's a couple, but they're right end return t end + + -- ---------------------------------------------------------------------------- + -- Create a list table from a wxLuaBindObject struct table + -- ---------------------------------------------------------------------------- function CreatewxLuaBindObject(tbl) local keys = { "name", "object", "class_tag" } *************** *** 441,449 **** -- Add the class tag name for the user data for i = 2, #t do ! t[i][3] = wx.wxlua_typename(t[i][3]).." ("..t[i][3]..")" end return t end function CreatewxLuaBindCFunc(tbl) local keys = { "func", "type", "minargs", "maxargs", "argtags" } --- 540,552 ---- -- Add the class tag name for the user data for i = 2, #t do ! t[i][3] = wxlua.wxlua_typename(t[i][3]).." ("..t[i][3]..")" end return t end + + -- ---------------------------------------------------------------------------- + -- Create a list table from a wxLuaBindCFunc struct table + -- ---------------------------------------------------------------------------- function CreatewxLuaBindCFunc(tbl) local keys = { "func", "type", "minargs", "maxargs", "argtags" } *************** *** 466,469 **** --- 569,575 ---- end + -- ---------------------------------------------------------------------------- + -- Generically Create a list table from a wxLuaBindXXX struct table + -- ---------------------------------------------------------------------------- function CreatewxLuaBindTable(tbl, cols, object_type) local t = { *************** *** 473,477 **** } ! local keys = {} for i = 1, #tbl do --- 579,583 ---- } ! --local keys = {} -- used to find dups for i = 1, #tbl do *************** *** 504,507 **** --- 610,616 ---- end + -- ---------------------------------------------------------------------------- + -- Sort items in the listctrl based on the column (0 based) and also the data table + -- ---------------------------------------------------------------------------- function SortListItems(col) local data = listData[list_level] *************** *** 511,515 **** end ! local sorted = data.col_sorted[col+1] local function SortListItems(item1, item2, col) --- 620,624 ---- end ! local sorted = data.col_sorted[col+1] or false local function SortListItems(item1, item2, col) *************** *** 558,561 **** --- 667,671 ---- listCtrl:SortItems(SortListItems, col+1) + data.col_sorted[col+1] = (not sorted) -- now make the table of data match what's in the listctrl so when you *************** *** 574,589 **** end ! for c = 1, listCtrl:GetColumnCount() do ! listCtrl:SetColumnImage(c-1, -1) end - if not sorted then - data.col_sorted[col+1] = true - listCtrl:SetColumnImage(col, img_sort_dn) - else - data.col_sorted[col+1] = false - listCtrl:SetColumnImage(col, img_sort_up) - end end --- 684,698 ---- end ! -- put the arrow in the col header that we've sorted this col and clear others for c = 1, listCtrl:GetColumnCount() do ! if c ~= col+1 then ! listCtrl:SetColumnImage(c-1, -1) ! elseif not sorted then ! listCtrl:SetColumnImage(col, img_sort_dn) ! else ! listCtrl:SetColumnImage(col, img_sort_up) ! end end end *************** *** 633,828 **** elseif (list_level == 1) then if itemText == "wxLua Types" then ! local t = { ! {"..", ["icon"] = img_folder}, ! ["col_labels"] = {"wxLua Type", "none -1", "nil 0", "bool 1", "lightuserdata 2", "number 3", "string 4", "table 5", "function 6", "userdata 7", "thread 8"}, ! ["object_type"] = "wxLua Types" ! } ! ! local wxltype_names = { ! "WXLUAARG_None", ! "WXLUAARG_Nil", ! "WXLUAARG_Boolean", ! "WXLUAARG_LightUserData", ! "WXLUAARG_Number", ! "WXLUAARG_String", ! "WXLUAARG_LuaTable", ! "WXLUAARG_LuaFunction", ! "WXLUAARG_UserData", ! "WXLUAARG_LuaThread", ! "WXLUAARG_Integer" ! } ! ! for i = 1, #wxltype_names do ! local wxltype = wx[wxltype_names[i]] ! local row = { wxltype_names[i].." "..tostring(wxltype) } ! for j = 2, #t.col_labels do ! local ltype = j - 3 ! local ok = wx.wxlua_iswxluatype(ltype, wxltype) ! if ok == 1 then ok = "X" end ! if ok == 0 then ok = "" end ! if ok == -1 then ok = "?" end -- shouldn't happen! ! table.insert(row, ok) ! end ! table.insert(t, row) ! end list_level = list_level + 1 listData[list_level] = t GotoBindingLevel(listCtrl, list_level) ! elseif itemText == "All Classes" then ! local t = { ! {"..", ["icon"] = img_folder}, ! ["col_labels"] = {"wxLua Class Name - wxClassInfo Name (wxClassInfo Base Name)"}, ! ["object_type"] = "All Classes" ! } ! ! local max_cols = 1 ! ! local function GetClassInfoStr(ci) ! local s = "" ! if type(ci) == "userdata" then ! s = s.." - "..ci:GetClassName() ! local b1 = ci:GetBaseClassName1() ! local b2 = ci:GetBaseClassName2() ! ! if (string.len(b1) > 0) then ! s = s.." ("..b1..")" ! end ! if (string.len(b2) > 0) then ! s = s.."("..b2..")" ! end ! end ! return s ! end ! ! for b = 1, #bindingList do ! local binding = _G ! for i = 1, #bindingList[b] do ! binding = binding[bindingList[b][i]] ! end ! ! local t1 = binding.GetClassArray ! ! for i = 1, #t1 do ! local a = string.format("%s%03d. ", string.char(string.byte('a')+b-1), i) ! ! local c = t1[i] ! local c_table = {a..c.name, ["color"] = wx.wxBLUE} -- GetClassInfoStr(c.classInfo) ! ! -- traverse through the base classes ! local bc = c.baseclass ! while bc do ! table.insert(c_table, bc.name) -- ..GetClassInfoStr(bc.classInfo) ! bc = bc.baseclass ! end ! ! if max_cols < #c_table then max_cols = #c_table end ! table.insert(t, c_table) ! ! -- now do wxWidgets base class info ! if c.classInfo then ! local ci = c.classInfo ! local c_table2 = {a..ci:GetClassName()} ! if ci:GetBaseClass2() then print(ci:GetClassName(), "Has two bases!") end ! ci = ci:GetBaseClass1() -- FIXME handle two base classes, maybe? ! while ci do ! -- we don't bind wxWindowBase since we'd never need it ! if ci:GetClassName() == "wxWindowBase" then ! c_table2[#c_table2] = c_table2[#c_table2].."("..ci:GetClassName()..")" ! else ! table.insert(c_table2, ci:GetClassName()) ! if c_table[#c_table2] ~= c_table2[#c_table2] then ! c_table2.color = wx.wxRED ! end ! end ! ! if ci:GetBaseClass2() then print(ci:GetClassName(), "Has two bases!") end ! ci = ci:GetBaseClass1() -- FIXME handle two base classes, maybe? ! end ! ! if max_cols < #c_table2 then max_cols = #c_table2 end ! table.insert(t, c_table2) ! end ! end ! end ! ! -- Set the col labels after counting them ! for i = 2, max_cols do ! t.col_labels[i] = "Base class "..tostring(i-1) ! end ! ! -- Put strings where there is no base class ! for i = 1, #t do ! for j = 1, max_cols do ! if t[i][j] == nil then t[i][j] = "" end ! end ! end list_level = list_level + 1 listData[list_level] = t GotoBindingLevel(listCtrl, list_level) ! elseif itemText == "Overloaded Baseclass Functions" then ! local t = { ! {"..", ["icon"] = img_folder}, ! ["col_labels"] = {"Class Name", "Function Name", "Args"}, ! ["object_type"] = "Overloaded Baseclass Functions" ! } ! ! local max_cols = 2 ! ! for b = 1, #bindingList do ! local binding = _G ! for i = 1, #bindingList[b] do ! binding = binding[bindingList[b][i]] ! end ! ! local t1 = binding.GetClassArray ! ! for i = 1, #t1 do ! local methods = t1[i].methods ! ! -- some classes don't have methods, wxBestHelpController for example ! for j = 1, t1[i].methods_n do ! local m = methods[j] ! local m_table = {m.class_name, m.name} ! ! local funcs = m.funcs ! local s = "" ! for f = 1, m.funcs_n do ! s = s.."("..CreateArgTagsString(funcs[f].argtags)..") " ! end ! table.insert(m_table, s) ! ! while m.basemethod do ! m = m.basemethod ! table.insert(m_table, m.class_name) ! ! local funcs = m.funcs ! local s = "" ! for f = 1, m.funcs_n do ! s = s.."("..CreateArgTagsString(funcs[f].argtags)..") " ! end ! table.insert(m_table, s) ! end ! if #m_table > 3 then ! if max_cols < #m_table then max_cols = #m_table end ! table.insert(t, m_table) ! end ! end ! end ! end ! -- Set the col labels after counting them ! for i = 4, max_cols, 2 do ! t.col_labels[i] = "Base Class" ! t.col_labels[i+1] = "Args" ! end ! -- Put strings where there is no base class ! for i = 1, #t do ! for j = 1, max_cols do ! if t[i][j] == nil then t[i][j] = "" end ! end ! end list_level = list_level + 1 --- 742,765 ---- elseif (list_level == 1) then if itemText == "wxLua Types" then ! local t = CreatewxLuaTypeTable() list_level = list_level + 1 listData[list_level] = t GotoBindingLevel(listCtrl, list_level) ! elseif itemText == "All wxLua Classes" then ! local t = CreateAllClassesTable() list_level = list_level + 1 listData[list_level] = t GotoBindingLevel(listCtrl, list_level) ! elseif itemText == "All wxWidgets wxClassInfo" then ! local t = wxclassInfo ! list_level = list_level + 1 ! listData[list_level] = t ! GotoBindingLevel(listCtrl, list_level) ! elseif itemText == "Overloaded Baseclass Functions" then ! local t = CreateOverloadedBasecassFunctionsTable() list_level = list_level + 1 *************** *** 934,937 **** --- 871,1138 ---- -- ---------------------------------------------------------------------------- + -- Show the wxLua types vs. the lua_type() + -- ---------------------------------------------------------------------------- + function CreatewxLuaTypeTable() + local t = { + {"..", ["icon"] = img_folder}, + ["col_labels"] = {"wxLua Type"}, + ["object_type"] = "wxLua Types" + } + + local lua_types = { + "LUA_TNONE", + "LUA_TNIL", + "LUA_TBOOLEAN", + "LUA_TLIGHTUSERDATA", + "LUA_TNUMBER", + "LUA_TSTRING", + "LUA_TTABLE", + "LUA_TFUNCTION", + "LUA_TUSERDATA", + "LUA_TTHREAD" + } + + for i = 1, #lua_types do + table.insert(t.col_labels, lua_types[i].." "..tostring(wxlua[lua_types[i]])) + end + + local wxltype_names = { + "WXLUAARG_None", + "WXLUAARG_Nil", + "WXLUAARG_Boolean", + "WXLUAARG_LightUserData", + "WXLUAARG_Number", + "WXLUAARG_String", + "WXLUAARG_LuaTable", + "WXLUAARG_LuaFunction", + "WXLUAARG_UserData", + "WXLUAARG_LuaThread", + "WXLUAARG_Integer" + } + + for i = 1, #wxltype_names do + local wxltype = wxlua[wxltype_names[i]] + local row = { wxltype_names[i].." "..tostring(wxltype) } + for j = 2, #t.col_labels do + local ltype = wxlua[lua_types[j-1]] + local ok = wxlua.wxlua_iswxluatype(ltype, wxltype) + if ok == 1 then ok = "X" end + if ok == 0 then ok = "" end + if ok == -1 then ok = "?" end -- shouldn't happen! + table.insert(row, ok) + end + table.insert(t, row) + end + + return t + end + + -- ---------------------------------------------------------------------------- + -- Show all classes that wxLua has wrapped + -- ---------------------------------------------------------------------------- + function CreateAllClassesTable() + local t = { + {"..", ["icon"] = img_folder}, + ["col_labels"] = {"wxLua Class Name (1st line) / wxClassInfo Name (2nd line)"}, + ["object_type"] = "All wxLua Classes" + } + + local max_cols = 1 + + local function GetClassInfoStr(ci) + local s = "" + if type(ci) == "userdata" then + s = s.." - "..ci:GetClassName() + local b1 = ci:GetBaseClassName1() + local b2 = ci:GetBaseClassName2() + + if (string.len(b1) > 0) then + s = s.." ("..b1..")" + end + if (string.len(b2) > 0) then + s = s.."("..b2..")" + end + end + return s + end + + local unwrappedBaseClasses = { + ["wxDCBase"] = 1, + ["wxFileDialogBase"] = 1, + ["wxPrinterBase"] = 1, + ["wxPrintPreviewBase"] = 1, + ["wxTextCtrlBase"] = 1, + ["wxWindowBase"] = 1, + + ["wxLuaDebuggerBase"] = 1, + } + + local wxwidgetsNoClassInfo = { + ["wxBookCtrlBaseEvent"] = "wxNotifyEvent", + ["wxControlWithItems"] = "wxControl", + ["wxMirrorDC"] = "wxDC", + ["wxSplashScreenWindow"] = "wxWindow", + ["wxToolBarBase"] = "wxControl", + } + + for b = 1, #bindingList do + local binding = _G + for i = 1, #bindingList[b] do + binding = binding[bindingList[b][i]] + end + + local t1 = binding.GetClassArray + + for i = 1, #t1 do + -- this string is to force the wxLua classname and the wxClassInfo names + -- to be together and the first char is to keep bindings together + local a = string.format("%s%03d. ", string.char(string.byte('a')+b-1), i) + + local c = t1[i] + local c_table = {["color"] = wx.wxBLUE} + + -- check for mistakes in the bindings + if (not c.classInfo) and wx.wxClassInfo.FindClass(c.name) then + print(c.name.." is missing it's wxClassInfo.") + end + + -- traverse through the wxLua defined base classes + local bc = c + while bc do + -- check for mistakes in the bindings + if (not bc.classInfo) and wx.wxClassInfo.FindClass(bc.name) then + print(bc.name.." is missing it's wxClassInfo.") + end + + table.insert(c_table, bc.name) + bc = bc.baseclass + end + + if max_cols < #c_table then max_cols = #c_table end + table.insert(t, c_table) + + -- now do wxWidgets base class info + if c.classInfo then + local ci = c.classInfo + local c_table2 = {} + + while ci do + local item + + -- we don't bind some classes since we wouldn't need them + if unwrappedBaseClasses[ci:GetClassName()] then + c_table2[#c_table2] = c_table2[#c_table2].."("..ci:GetClassName()..")" + elseif c_table[#c_table2+1] and (wxwidgetsNoClassInfo[c_table[#c_table2+1]] == ci:GetClassName()) then + table.insert(c_table2, c_table[#c_table2+1].." - No wxClassInfo") + table.insert(c_table2, ci:GetClassName()) + else + table.insert(c_table2, ci:GetClassName()) + if (c_table[#c_table2] ~= c_table2[#c_table2]) then + c_table2.color = wx.wxRED + end + end + + if ci:GetBaseClass2() then print(ci:GetClassName(), "Has two bases!") end + ci = ci:GetBaseClass1() -- FIXME handle two base classes, maybe? + end + + t[#t][1] = a..t[#t][1] + c_table2[1] = a..c_table2[1] + if max_cols < #c_table2 then max_cols = #c_table2 end + table.insert(t, c_table2) + else + t[#t][1] = a..t[#t][1] + end + + end + end + + -- Set the col labels after counting them + for i = 2, max_cols do + t.col_labels[i] = "Base class "..tostring(i-1) + end + + -- Put strings where there is no base class + for i = 1, #t do + for j = 1, max_cols do + if t[i][j] == nil then t[i][j] = "" end + end + end + + return t + end + + + -- ---------------------------------------------------------------------------- + -- Show all functions that overload a baseclass function (for debugging bindings...) + -- ---------------------------------------------------------------------------- + function CreateOverloadedBasecassFunctionsTable() + local t = { + {"..", ["icon"] = img_folder}, + ["col_labels"] = {"Class Name", "Function Name", "Args"}, + ["object_type"] = "Overloaded Baseclass Functions" + } + + local max_cols = 2 + + for b = 1, #bindingList do + local binding = _G + for i = 1, #bindingList[b] do + binding = binding[bindingList[b][i]] + end + + local t1 = binding.GetClassArray + + for i = 1, #t1 do + local methods = t1[i].methods + + -- some classes don't have methods, wxBestHelpController for example + for j = 1, t1[i].methods_n do + local m = methods[j] + local m_table = {m.class_name, m.name} + + local funcs = m.funcs + local s = "" + for f = 1, m.funcs_n do + s = s.."("..CreateArgTagsString(funcs[f].argtags)..") " + end + table.insert(m_table, s) + + while m.basemethod do + m = m.basemethod + table.insert(m_table, m.class_name) + + local funcs = m.funcs + local s = "" + for f = 1, m.funcs_n do + s = s.."("..CreateArgTagsString(funcs[f].argtags)..") " + end + table.insert(m_table, s) + end + if #m_table > 3 then + if max_cols < #m_table then max_cols = #m_table end + table.insert(t, m_table) + end + end + end + end + + -- Set the col labels after counting them + for i = 4, max_cols, 2 do + t.col_labels[i] = "Base Class" + t.col_labels[i+1] = "Args" + end + + -- Put strings where there is no base class + for i = 1, #t do + for j = 1, max_cols do + if t[i][j] == nil then t[i][j] = "" end + end + end + + return t + end + + -- ---------------------------------------------------------------------------- -- The main program, call this to start the program -- ---------------------------------------------------------------------------- *************** *** 946,950 **** local viewMenu = wx.wxMenu() ! viewMenu:AppendCheckItem(ID_VIEW_BASECLASS_FUNCTIONS, "View baseclass functions", "View all baseclass functions for class methods") local helpMenu = wx.wxMenu() --- 1147,1153 ---- local viewMenu = wx.wxMenu() ! viewMenu:Append(ID_STACK_DIALOG, "Show lua stack dialog...", "View the current lua stack, stack top shows globals.") ! viewMenu:AppendSeparator() ! viewMenu:AppendCheckItem(ID_VIEW_BASECLASS_FUNCTIONS, "View baseclass functions", "View all baseclass functions for class methods.") local helpMenu = wx.wxMenu() *************** *** 961,964 **** --- 1164,1170 ---- function (event) frame:Close(true) end ) + frame:Connect(ID_STACK_DIALOG, wx.wxEVT_COMMAND_MENU_SELECTED, + function (event) wxlua.LuaStackDialog() end ) + -- connect the selection event of the about menu item frame:Connect(wx.wxID_ABOUT, wx.wxEVT_COMMAND_MENU_SELECTED, *************** *** 1010,1014 **** listData[1] = { {"wxLua Types", "Compare Lua's type to wxLua's type", ["icon"] = img_folder }, ! {"All Classes", "Classes and their base classes (red may not indicate error)", ["icon"] = img_folder }, {"Overloaded Baseclass Functions", "See all functions that also have a baseclass function", ["icon"] = img_folder }, --- 1216,1221 ---- listData[1] = { {"wxLua Types", "Compare Lua's type to wxLua's type", ["icon"] = img_folder }, ! {"All wxLua Classes", "Classes and their base classes (red may not indicate error)", ["icon"] = img_folder }, ! {"All wxWidgets wxClassInfo", "All wxObjects having wxClassInfo and their base classes", ["icon"] = img_folder }, {"Overloaded Baseclass Functions", "See all functions that also have a baseclass function", ["icon"] = img_folder }, Index: fldemo.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/fldemo.wx.lua,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** fldemo.wx.lua 31 May 2007 17:18:55 -0000 1.8 --- fldemo.wx.lua 14 Jun 2007 01:23:20 -0000 1.9 *************** *** 125,129 **** function ( event ) event:Skip() ! layout:Delete() layout = nil end) --- 125,129 ---- function ( event ) event:Skip() ! layout:delete() layout = nil end) Index: minimal.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/minimal.wx.lua,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** minimal.wx.lua 31 May 2007 17:18:56 -0000 1.8 --- minimal.wx.lua 14 Jun 2007 01:23:20 -0000 1.9 *************** *** 24,28 **** -- however on Windows 9x/Me this may be too late (DC's are precious resource) -- so delete it here ! dc:Delete() -- ALWAYS Delete() any wxDCs created when done end --- 24,28 ---- -- however on Windows 9x/Me this may be too late (DC's are precious resource) -- so delete it here ! dc:delete() -- ALWAYS delete() any wxDCs created when done end Index: wxluasudoku.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/wxluasudoku.wx.lua,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** wxluasudoku.wx.lua 12 Jun 2007 00:08:42 -0000 1.70 --- wxluasudoku.wx.lua 14 Jun 2007 01:23:20 -0000 1.71 *************** *** 2232,2236 **** sudokuGUI.valueFont_cache, sudokuGUI.possibleFont_cache) ! dc:Delete() -- ALWAYS Delete() any wxDCs created when done return size end --- 2232,2236 ---- sudokuGUI.valueFont_cache, sudokuGUI.possibleFont_cache) ! dc:delete() -- ALWAYS delete() any wxDCs created when done return size end *************** *** 2336,2340 **** sudokuGUI.PaintCell(dc, cell, width, height, sudokuGUI.valueFont, sudokuGUI.possibleFont) end ! dc:Delete() -- ALWAYS Delete() any wxDCs created when done end --- 2336,2340 ---- sudokuGUI.PaintCell(dc, cell, width, height, sudokuGUI.valueFont, sudokuGUI.possibleFont) end ! dc:delete() -- ALWAYS delete() any wxDCs created when done end *************** *** 2355,2359 **** dc:SetBrush(brush) dc:DrawRectangle(0, 0, width, height) ! brush:Delete() local sudokuTable = sudokuGUI.GetCurrentTable() --- 2355,2359 ---- dc:SetBrush(brush) dc:DrawRectangle(0, 0, width, height) ! brush:delete() local sudokuTable = sudokuGUI.GetCurrentTable() *************** *** 2429,2433 **** end ! pen:Delete() end --- 2429,2433 ---- end ! pen:delete() end *************** *** 2473,2477 **** local pen = wx.wxPen(sudokuGUI.Colours[sudokuGUI.INVALID_VALUE_COLOUR], 1, wx.wxSOLID) dc:SetPen(pen) ! pen:Delete() dc:DrawLine(0, 0, width, height) end --- 2473,2477 ---- local pen = wx.wxPen(sudokuGUI.Colours[sudokuGUI.INVALID_VALUE_COLOUR], 1, wx.wxSOLID) dc:SetPen(pen) ! pen:delete() dc:DrawLine(0, 0, width, height) end *************** *** 2628,2633 **** end ! valueFont.wxfont:Delete() ! possibleFont.wxfont:Delete() sudokuGUI.focused_cell_id = old_focused_cell_id -- restore focus --- 2628,2633 ---- end ! valueFont.wxfont:delete() ! possibleFont.wxfont:delete() sudokuGUI.focused_cell_id = old_focused_cell_id -- restore focus *************** *** 2638,2642 **** local pen = wx.wxPen(wx.wxBLACK, iff(borders[i], 4, 2), wx.wxSOLID) dc:SetPen(pen) ! pen:Delete() dc:DrawLine(ColOrigin(1), RowOrigin(i), ColOrigin(10), RowOrigin(i)) dc:DrawLine(ColOrigin(i), RowOrigin(1), ColOrigin(i), RowOrigin(10)) --- 2638,2642 ---- local pen = wx.wxPen(wx.wxBLACK, iff(borders[i], 4, 2), wx.wxSOLID) dc:SetPen(pen) ! pen:delete() dc:DrawLine(ColOrigin(1), RowOrigin(i), ColOrigin(10), RowOrigin(i)) dc:DrawLine(ColOrigin(i), RowOrigin(1), ColOrigin(i), RowOrigin(10)) *************** *** 3851,3855 **** local brush = wx.wxBrush(c, wx.wxSOLID) dc:SetBrush(brush) ! brush:Delete() dc:DrawRectangle(0, 0, width, height) --- 3851,3855 ---- local brush = wx.wxBrush(c, wx.wxSOLID) dc:SetBrush(brush) ! brush:delete() dc:DrawRectangle(0, 0, width, height) *************** *** 3876,3880 **** dc:DrawText(value, pos[n].x, pos[n].y) local pen = wx.wxPen(listBoxValues[idx].colour, 1, wx.wxSOLID) ! dc:SetPen(pen); pen:Delete() if hidden ~= true then dc:DrawRectangle(pos[n].x, pos[n].y, font_width, font_height) --- 3876,3880 ---- dc:DrawText(value, pos[n].x, pos[n].y) local pen = wx.wxPen(listBoxValues[idx].colour, 1, wx.wxSOLID) ! dc:SetPen(pen); pen:delete() if hidden ~= true then dc:DrawRectangle(pos[n].x, pos[n].y, font_width, font_height) *************** *** 3893,3897 **** -- draw invalid marker local pen = wx.wxPen(listBoxValues[sudokuGUI.INVALID_VALUE_COLOUR].colour, 1, wx.wxSOLID) ! dc:SetPen(pen); pen:Delete() dc:DrawLine(0, 0, width, height) --- 3893,3897 ---- -- draw invalid marker local pen = wx.wxPen(listBoxValues[sudokuGUI.INVALID_VALUE_COLOUR].colour, 1, wx.wxSOLID) ! dc:SetPen(pen); pen:delete() dc:DrawLine(0, 0, width, height) *************** *** 3911,3915 **** reset_fonts = false ! dc:Delete() end) --- 3911,3915 ---- reset_fonts = false ! dc:delete() end) *************** *** 3928,3936 **** f = wx.wxGetFontFromUser(panel, f) if f:Ok() then ! listBoxValues[sel].font:Delete() listBoxValues[sel].font = f reset_fonts = true else ! f:Delete() end sampleWin:Refresh(false) --- 3928,3936 ---- f = wx.wxGetFontFromUser(panel, f) if f:Ok() then ! listBoxValues[sel].font:delete() listBoxValues[sel].font = f reset_fonts = true else ! f:delete() end sampleWin:Refresh(false) *************** *** 3942,3950 **** c = wx.wxGetColourFromUser(panel, c) if c:Ok() then ! listBoxValues[sel].colour:Delete() listBoxValues[sel].colour = c colourButton:SetForegroundColour(c) else ! c:Delete() end sampleWin:Refresh(false) --- 3942,3950 ---- c = wx.wxGetColourFromUser(panel, c) if c:Ok() then ! listBoxValues[sel].colour:delete() listBoxValues[sel].colour = c colourButton:SetForegroundColour(c) else ! c:delete() end sampleWin:Refresh(false) *************** *** 3962,3982 **** if ret == wx.wxYES then for n = 1, sudokuGUI.COLOUR_MAX do ! listBoxValues[n].colour:Delete() listBoxValues[n].colour = wx.wxColour(sudokuGUI.Colours_[n]) end ! listBoxValues[sudokuGUI.VALUE_COLOUR].font:Delete() ! listBoxValues[sudokuGUI.POSS_VALUE_COLOUR].font:Delete() listBoxValues[sudokuGUI.VALUE_COLOUR].font = wx.wxFont(sudokuGUI.valueFont_wxfont_) listBoxValues[sudokuGUI.POSS_VALUE_COLOUR].font = wx.wxFont(sudokuGUI.possibleFont_wxfont_) elseif ret == wx.wxNO then ! listBoxValues[sel].colour:Delete() listBoxValues[sel].colour = wx.wxColour(sudokuGUI.Colours_[sel]) if (sel == sudokuGUI.VALUE_COLOUR) then ! listBoxValues[sel].font:Delete() listBoxValues[sel].font = wx.wxFont(sudokuGUI.valueFont_wxfont_) elseif (sel == sudokuGUI.POSS_VALUE_COLOUR) then ! listBoxValues[sel].font:Delete() listBoxValues[sel].font = wx.wxFont(sudokuGUI.possibleFont_wxfont_) end --- 3962,3982 ---- if ret == wx.wxYES then for n = 1, sudokuGUI.COLOUR_MAX do ! listBoxValues[n].colour:delete() listBoxValues[n].colour = wx.wxColour(sudokuGUI.Colours_[n]) end ! listBoxValues[sudokuGUI.VALUE_COLOUR].font:delete() ! listBoxValues[sudokuGUI.POSS_VALUE_COLOUR].font:delete() listBoxValues[sudokuGUI.VALUE_COLOUR].font = wx.wxFont(sudokuGUI.valueFont_wxfont_) listBoxValues[sudokuGUI.POSS_VALUE_COLOUR].font = wx.wxFont(sudokuGUI.possibleFont_wxfont_) elseif ret == wx.wxNO then ! listBoxValues[sel].colour:delete() listBoxValues[sel].colour = wx.wxColour(sudokuGUI.Colours_[sel]) if (sel == sudokuGUI.VALUE_COLOUR) then ! listBoxValues[sel].font:delete() listBoxValues[sel].font = wx.wxFont(sudokuGUI.valueFont_wxfont_) elseif (sel == sudokuGUI.POSS_VALUE_COLOUR) then ! listBoxValues[sel].font:delete() listBoxValues[sel].font = wx.wxFont(sudokuGUI.possibleFont_wxfont_) end *************** *** 3990,4001 **** function sudokuGUI.PreferencesDialogPageUI.Apply() for n = 1, sudokuGUI.COLOUR_MAX do ! sudokuGUI.Colours[n]:Delete() sudokuGUI.Colours[n] = wx.wxColour(listBoxValues[n].colour) end -- copy the fonts since when applied their size will change ! sudokuGUI.valueFont.wxfont:Delete() sudokuGUI.valueFont.wxfont = wx.wxFont(listBoxValues[sudokuGUI.VALUE_COLOUR].font) ! sudokuGUI.possibleFont.wxfont:Delete() sudokuGUI.possibleFont.wxfont = wx.wxFont(listBoxValues[sudokuGUI.POSS_VALUE_COLOUR].font) sudokuGUI.valueFont_cache = {} -- clear cache so GetCellBestSize recreates it --- 3990,4001 ---- function sudokuGUI.PreferencesDialogPageUI.Apply() for n = 1, sudokuGUI.COLOUR_MAX do ! sudokuGUI.Colours[n]:delete() sudokuGUI.Colours[n] = wx.wxColour(listBoxValues[n].colour) end -- copy the fonts since when applied their size will change ! sudokuGUI.valueFont.wxfont:delete() sudokuGUI.valueFont.wxfont = wx.wxFont(listBoxValues[sudokuGUI.VALUE_COLOUR].font) ! sudokuGUI.possibleFont.wxfont:delete() sudokuGUI.possibleFont.wxfont = wx.wxFont(listBoxValues[sudokuGUI.POSS_VALUE_COLOUR].font) sudokuGUI.valueFont_cache = {} -- clear cache so GetCellBestSize recreates it *************** *** 4017,4022 **** function sudokuGUI.PreferencesDialogPageUI.Destroy() for n = 1, sudokuGUI.COLOUR_MAX do ! listBoxValues[n].colour:Delete() ! if listBoxValues[n].font then listBoxValues[n].font:Delete() end end end --- 4017,4022 ---- function sudokuGUI.PreferencesDialogPageUI.Destroy() for n = 1, sudokuGUI.COLOUR_MAX do ! listBoxValues[n].colour:delete() ! if listBoxValues[n].font then listBoxValues[n].font:delete() end end end *************** *** 4828,4832 **** local m = wx.wxMenuItem(menu, id, text, help) m:SetBitmap(bmp) ! bmp:Delete() return m end --- 4828,4832 ---- local m = wx.wxMenuItem(menu, id, text, help) m:SetBitmap(bmp) ! bmp:delete() return m end Index: validator.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/validator.wx.lua,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** validator.wx.lua 12 Jun 2007 00:08:42 -0000 1.2 --- validator.wx.lua 14 Jun 2007 01:23:20 -0000 1.3 *************** *** 48,58 **** text_alpha_val = "DeleteSpace OnlyAlphabetCharsAllowed" ! checkObj = wx.wxLuaObject(check_val) ! comboObj = wx.wxLuaObject(combo_val) ! textObj = wx.wxLuaObject(text_val) ! scrollObj = wx.wxLuaObject(scroll_val) ! checklObj = wx.wxLuaObject(checkl_val) ! checklObj = wx.wxLuaObject(checkl_val) ! textAlphaObj = wx.wxLuaObject(text_alpha_val) function CreateDialog() --- 48,58 ---- text_alpha_val = "DeleteSpace OnlyAlphabetCharsAllowed" ! checkObj = wxlua.wxLuaObject(check_val) ! comboObj = wxlua.wxLuaObject(combo_val) ! textObj = wxlua.wxLuaObject(text_val) ! scrollObj = wxlua.wxLuaObject(scroll_val) ! checklObj = wxlua.wxLuaObject(checkl_val) ! checklObj = wxlua.wxLuaObject(checkl_val) ! textAlphaObj = wxlua.wxLuaObject(text_alpha_val) function CreateDialog() Index: editor.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/editor.wx.lua,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** editor.wx.lua 6 Jun 2007 23:43:17 -0000 1.53 --- editor.wx.lua 14 Jun 2007 01:23:20 -0000 1.54 *************** *** 226,237 **** end) ! errorLog = wx.wxStyledTextCtrl(splitter, wx.wxID_ANY) errorLog:Show(false) errorLog:SetFont(font) ! errorLog:StyleSetFont(wx.wxSTC_STYLE_DEFAULT, font) errorLog:StyleClearAll() errorLog:SetMarginWidth(1, 16) -- marker margin ! errorLog:SetMarginType(1, wx.wxSTC_MARGIN_SYMBOL); ! errorLog:MarkerDefine(CURRENT_LINE_MARKER, wx.wxSTC_MARK_ARROWS, wx.wxBLACK, wx.wxWHITE) errorLog:SetReadOnly(true) --- 226,237 ---- end) ! errorLog = wxstc.wxStyledTextCtrl(splitter, wx.wxID_ANY) errorLog:Show(false) errorLog:SetFont(font) ! errorLog:StyleSetFont(wxstc.wxSTC_STYLE_DEFAULT, font) errorLog:StyleClearAll() errorLog:SetMarginWidth(1, 16) -- marker margin ! errorLog:SetMarginType(1, wxstc.wxSTC_MARGIN_SYMBOL); ! errorLog:MarkerDefine(CURRENT_LINE_MARKER, wxstc.wxSTC_MARK_ARROWS, wx.wxBLACK, wx.wxWHITE) errorLog:SetReadOnly(true) *************** *** 404,410 **** -- Create an editor and add it to the notebook function CreateEditor(name) ! local editor = wx.wxStyledTextCtrl(notebook, editorID, ! wx.wxDefaultPosition, wx.wxDefaultSize, ! wx.wxSUNKEN_BORDER) editorID = editorID + 1 -- increment so they're always unique --- 404,410 ---- -- Create an editor and add it to the notebook function CreateEditor(name) ! local editor = wxstc.wxStyledTextCtrl(notebook, editorID, ! wx.wxDefaultPosition, wx.wxDefaultSize, ! wx.wxSUNKEN_BORDER) editorID = editorID + 1 -- increment so they're always unique *************** *** 414,418 **** editor:SetFont(font) ! editor:StyleSetFont(wx.wxSTC_STYLE_DEFAULT, font) for i = 0, 32 do editor:StyleSetFont(i, font) --- 414,418 ---- editor:SetFont(font) ! editor:StyleSetFont(wxstc.wxSTC_STYLE_DEFAULT, font) for i = 0, 32 do editor:StyleSetFont(i, font) *************** *** 478,501 **** editor:SetIndentationGuides(true) ! editor:SetVisiblePolicy(wx.wxSTC_VISIBLE_SLOP, 3) ! --editor:SetXCaretPolicy(wx.wxSTC_CARET_SLOP, 10) ! --editor:SetYCaretPolicy(wx.wxSTC_CARET_SLOP, 3) editor:SetMarginWidth(0, editor:TextWidth(32, "99999_")) -- line # margin editor:SetMarginWidth(1, 16) -- marker margin ! editor:SetMarginType(1, wx.wxSTC_MARGIN_SYMBOL) editor:SetMarginSensitive(1, true) ! editor:MarkerDefine(BREAKPOINT_MARKER, wx.wxSTC_MARK_ROUNDRECT, wx.wxWHITE, wx.wxRED) ! editor:MarkerDefine(CURRENT_LINE_MARKER, wx.wxSTC_MARK_ARROW, wx.wxBLACK, wx.wxGREEN) editor:SetMarginWidth(2, 16) -- fold margin ! editor:SetMarginType(2, wx.wxSTC_MARGIN_SYMBOL) ! editor:SetMarginMask(2, wx.wxSTC_MASK_FOLDERS) editor:SetMarginSensitive(2, true) ! editor:SetFoldFlags(wx.wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED + ! wx.wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED) editor:SetProperty("fold", "1") --- 478,501 ---- editor:SetIndentationGuides(true) ! editor:SetVisiblePolicy(wxstc.wxSTC_VISIBLE_SLOP, 3) ! --editor:SetXCaretPolicy(wxstc.wxSTC_CARET_SLOP, 10) ! --editor:SetYCaretPolicy(wxstc.wxSTC_CARET_SLOP, 3) editor:SetMarginWidth(0, editor:TextWidth(32, "99999_")) -- line # margin editor:SetMarginWidth(1, 16) -- marker margin ! editor:SetMarginType(1, wxstc.wxSTC_MARGIN_SYMBOL) editor:SetMarginSensitive(1, true) ! editor:MarkerDefine(BREAKPOINT_MARKER, wxstc.wxSTC_MARK_ROUNDRECT, wx.wxWHITE, wx.wxRED) ! editor:MarkerDefine(CURRENT_LINE_MARKER, wxstc.wxSTC_MARK_ARROW, wx.wxBLACK, wx.wxGREEN) editor:SetMarginWidth(2, 16) -- fold margin ! editor:SetMarginType(2, wxstc.wxSTC_MARGIN_SYMBOL) ! editor:SetMarginMask(2, wxstc.wxSTC_MASK_FOLDERS) editor:SetMarginSensitive(2, true) ! editor:SetFoldFlags(wxstc.wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED + ! wxstc.wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED) editor:SetProperty("fold", "1") *************** *** 504,517 **** local grey = wx.wxColour(128, 128, 128) ! editor:MarkerDefine(wx.wxSTC_MARKNUM_FOLDEROPEN, wx.wxSTC_MARK_BOXMINUS, wx.wxWHITE, grey) ! editor:MarkerDefine(wx.wxSTC_MARKNUM_FOLDER, wx.wxSTC_MARK_BOXPLUS, wx.wxWHITE, grey) ! editor:MarkerDefine(wx.wxSTC_MARKNUM_FOLDERSUB, wx.wxSTC_MARK_VLINE, wx.wxWHITE, grey) ! editor:MarkerDefine(wx.wxSTC_MARKNUM_FOLDERTAIL, wx.wxSTC_MARK_LCORNER, wx.wxWHITE, grey) ! editor:MarkerDefine(wx.wxSTC_MARKNUM_FOLDEREND, wx.wxSTC_MARK_BOXPLUSCONNECTED, wx.wxWHITE, grey) ! editor:MarkerDefine(wx.wxSTC_MARKNUM_FOLDEROPENMID, wx.wxSTC_MARK_BOXMINUSCONNECTED, wx.wxWHITE, grey) ! editor:MarkerDefine(wx.wxSTC_MARKNUM_FOLDERMIDTAIL, wx.wxSTC_MARK_TCORNER, wx.wxWHITE, grey) ! grey:Delete() ! editor:Connect(wx.wxEVT_STC_MARGINCLICK, function (event) local line = editor:LineFromPosition(event:GetPosition()) --- 504,517 ---- local grey = wx.wxColour(128, 128, 128) ! editor:MarkerDefine(wxstc.wxSTC_MARKNUM_FOLDEROPEN, wxstc.wxSTC_MARK_BOXMINUS, wx.wxWHITE, grey) ! editor:MarkerDefine(wxstc.wxSTC_MARKNUM_FOLDER, wxstc.wxSTC_MARK_BOXPLUS, wx.wxWHITE, grey) ! editor:MarkerDefine(wxstc.wxSTC_MARKNUM_FOLDERSUB, wxstc.wxSTC_MARK_VLINE, wx.wxWHITE, grey) ! editor:MarkerDefine(wxstc.wxSTC_MARKNUM_FOLDERTAIL, wxstc.wxSTC_MARK_LCORNER, wx.wxWHITE, grey) ! editor:MarkerDefine(wxstc.wxSTC_MARKNUM_FOLDEREND, wxstc.wxSTC_MARK_BOXPLUSCONNECTED, wx.wxWHITE, grey) ! editor:MarkerDefine(wxstc.wxSTC_MARKNUM_FOLDEROPENMID, wxstc.wxSTC_MARK_BOXMINUSCONNECTED, wx.wxWHITE, grey) ! editor:MarkerDefine(wxstc.wxSTC_MARKNUM_FOLDERMIDTAIL, wxstc.wxSTC_MARK_TCORNER, wx.wxWHITE, grey) ! grey:delete() ! editor:Connect(wxstc.wxEVT_STC_MARGINCLICK, function (event) local line = editor:LineFromPosition(event:GetPosition()) *************** *** 524,528 **** else local level = editor:GetFoldLevel(line) ! if HasBit(level, wx.wxSTC_FOLDLEVELHEADERFLAG) then editor:ToggleFold(line) end --- 524,528 ---- else local level = editor:GetFoldLevel(line) ! if HasBit(level, wxstc.wxSTC_FOLDLEVELHEADERFLAG) then editor:ToggleFold(line) end *************** *** 531,535 **** end) ! editor:Connect(wx.wxEVT_STC_CHARADDED, function (event) -- auto-indent --- 531,535 ---- end) ! editor:Connect(wxstc.wxEVT_STC_CHARADDED, function (event) -- auto-indent *************** *** 561,565 **** end) ! editor:Connect(wx.wxEVT_STC_USERLISTSELECTION, function (event) local pos = editor:GetCurrentPos() --- 561,565 ---- end) ! editor:Connect(wxstc.wxEVT_STC_USERLISTSELECTION, function (event) local pos = editor:GetCurrentPos() *************** *** 569,583 **** end) ! editor:Connect(wx.wxEVT_STC_SAVEPOINTREACHED, function (event) SetDocumentModified(editor:GetId(), false) end) ! editor:Connect(wx.wxEVT_STC_SAVEPOINTLEFT, function (event) SetDocumentModified(editor:GetId(), true) end) ! editor:Connect(wx.wxEVT_STC_UPDATEUI, function (event) UpdateStatusText(editor) --- 569,583 ---- end) ! editor:Connect(wxstc.wxEVT_STC_SAVEPOINTREACHED, function (event) SetDocumentModified(editor:GetId(), false) end) ! editor:Connect(wxstc.wxEVT_STC_SAVEPOINTLEFT, function (event) SetDocumentModified(editor:GetId(), true) end) ! editor:Connect(wxstc.wxEVT_STC_UPDATEUI, function (event) UpdateStatusText(editor) *************** *** 615,619 **** function SetupKeywords(editor, useLuaParser) if useLuaParser then ! editor:SetLexer(wx.wxSTC_LEX_LUA) -- Note: these keywords are shamelessly ripped from scite 1.68 --- 615,619 ---- function SetupKeywords(editor, useLuaParser) if useLuaParser then ! editor:SetLexer(wxstc.wxSTC_LEX_LUA) -- Note: these keywords are shamelessly ripped from scite 1.68 *************** *** 664,668 **** editor:SetKeyWords(5, wxkeywords) else ! editor:SetLexer(wx.wxSTC_LEX_NULL) editor:SetKeyWords(0, "") end --- 664,668 ---- editor:SetKeyWords(5, wxkeywords) else ! editor:SetLexer(wxstc.wxSTC_LEX_NULL) editor:SetKeyWords(0, "") end *************** *** 1238,1242 **** local foldLvl = math.mod(foldRaw, 4096) local foldHdr = math.mod(math.floor(foldRaw / 8192), 2) == 1 ! if not baseFound and (foldLvl == wx.wxSTC_FOLDLEVELBASE) then baseFound = true visible = editor:GetLineVisible(ln) --- 1238,1242 ---- local foldLvl = math.mod(foldRaw, 4096) local foldHdr = math.mod(math.floor(foldRaw / 8192), 2) == 1 ! if not baseFound and (foldLvl == wxstc.wxSTC_FOLDLEVELBASE) then baseFound = true visible = editor:GetLineVisible(ln) *************** *** 1266,1270 **** if not editor:GetFoldExpanded(ln) then editor:ToggleFold(ln) end end ! elseif hide and (foldLvl == wx.wxSTC_FOLDLEVELBASE) then if not foldHdr then editor:HideLines(ln, ln) --- 1266,127... [truncated message content] |