You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(191) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(238) |
Dec
(68) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(104) |
Feb
(518) |
Mar
(302) |
Apr
(211) |
May
(311) |
Jun
(55) |
Jul
(6) |
Aug
(35) |
Sep
(76) |
Oct
(50) |
Nov
(37) |
Dec
(340) |
2007 |
Jan
(23) |
Feb
(107) |
Mar
(98) |
Apr
(60) |
May
(136) |
Jun
(371) |
Jul
(175) |
Aug
(74) |
Sep
(3) |
Oct
(2) |
Nov
(53) |
Dec
(129) |
2008 |
Jan
(337) |
Feb
(23) |
Mar
(18) |
Apr
(4) |
May
(3) |
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
(33) |
Nov
|
Dec
(26) |
2009 |
Jan
(4) |
Feb
(1) |
Mar
(15) |
Apr
|
May
(35) |
Jun
(11) |
Jul
|
Aug
|
Sep
(19) |
Oct
(26) |
Nov
(11) |
Dec
(11) |
2010 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(8) |
Sep
|
Oct
|
Nov
(8) |
Dec
(7) |
2011 |
Jan
|
Feb
|
Mar
(4) |
Apr
(8) |
May
(5) |
Jun
(8) |
Jul
(1) |
Aug
|
Sep
|
Oct
(5) |
Nov
(13) |
Dec
|
From: John L. <jr...@us...> - 2007-06-11 03:58:19
|
Update of /cvsroot/wxlua/wxLua/samples In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv19140/wxLua/samples Modified Files: bindings.wx.lua printing.wx.lua scribble.wx.lua unittest.wx.lua Added Files: validator.wx.lua Log Message: Remove wxArrayString_FromLuaTable and wxArrayInt_FromLuaTable binding tag since we convert from wxArrayInt/String automatically Fix listctrl sorting Fix validator code using wxLuaObject Rename wxLuaState::LuaCall to LuaPCall since that what it calls Lots more cleanup and shuffling of code to more appropriate places --- NEW FILE: validator.wx.lua --- ----------------------------------------------------------------------------- -- Name: validator.wx.lua -- Purpose: wxLua validator test program -- Author: John Labenski -- Modified by: -- Created: 6/10/2007 -- RCS-ID: -- Copyright: (c) 2001 John Labenski -- Licence: wxWidgets licence ----------------------------------------------------------------------------- -- NOTES about validators! -- The controls apparently must be in a wxDialog and they must also -- be direct children of the dialog. You CANNOT put any controls that -- you want to use wxGenericValidators with on a panel that's a child of -- the dialog. -- You cannot seem to set a wxGenericValidator to a control and then -- check the value of the wxLuaObject that the validator uses at any -- time either since the validator only updates it's value when the -- function TransferDataFromWindow() is called. You cannot set a -- wxGenericValidator to a wxCheckBox and then call TransferDataFromWindow() -- on the validator to force it to update as this apparently does nothing. -- Finally, it appears that you need to have an wxID_OK button for the -- TransferDataTo/FromWindow() functions to be automatically called by the -- dialog. frame = nil ID_TEST_VALIDATORS = 1000 ID_CHECKBOX = 1001 ID_COMBOBOX = 1002 ID_TEXTCTRL = 1003 ID_SCROLLBAR = 1004 ID_CHECKLBOX = 1005 ID_TEXTCTRL_TVAL_NUM = 1006 -- Set up the initial values for the validators, we use the wxLuaObjects -- as proxies for the wxGenericValidators to pass the *int *bool, *string, etc, -- pointers from the validators to and from to lua. check_val = true combo_val = "Select Item" text_val = "Enter text" scroll_val = 10 checkl_val = { 0, 2 } text_alpha_val = "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() dialog = wx.wxDialog(frame, wx.wxID_ANY, "Test Validators") checkBox = wx.wxCheckBox(dialog, ID_CHECKBOX, "Check me!", wx.wxDefaultPosition, wx.wxDefaultSize, 0, wx.wxGenericValidatorBool(checkObj)) comboBox = wx.wxComboBox(dialog, ID_COMBOBOX, "THIS WILL BE OVERWRITTEN", wx.wxDefaultPosition, wx.wxDefaultSize, {"Item0", "Item1", "Item2"}, 0, wx.wxGenericValidatorString(comboObj)) textCtrl = wx.wxTextCtrl(dialog, ID_TEXTCTRL, "THIS WILL BE OVERWRITTEN", wx.wxDefaultPosition, wx.wxDefaultSize, 0, wx.wxGenericValidatorString(textObj)) scrollBar = wx.wxScrollBar(dialog, ID_SCROLLBAR, wx.wxDefaultPosition, wx.wxDefaultSize, wx.wxSB_HORIZONTAL, wx.wxGenericValidatorInt(scrollObj)) scrollBar:SetScrollbar(0, 10, 100, 5) checklBox = wx.wxCheckListBox(dialog, ID_CHECKLBOX, wx.wxDefaultPosition, wx.wxDefaultSize, {"Check 0", "Check 1", "Check 2", "Check 3"}, 0, wx.wxGenericValidatorArrayInt(checklObj)) textAlphaCtrl = wx.wxTextCtrl(dialog, ID_TEXTCTRL, "THIS WILL BE OVERWRITTEN", wx.wxDefaultPosition, wx.wxDefaultSize, 0, wx.wxTextValidator(wx.wxFILTER_ALPHA, textAlphaObj)) okButton = wx.wxButton(dialog, wx.wxID_OK, "Ok") -- NEED this for validators to work okButton:SetDefault() flexSizer = wx.wxFlexGridSizer(12, 1, 0, 0) flexSizer:AddGrowableCol(0) flexSizer:Add(checkBox, 1, wx.wxEXPAND+wx.wxALL, 5) flexSizer:Add(comboBox, 1, wx.wxEXPAND+wx.wxALL, 5) flexSizer:Add(textCtrl, 1, wx.wxEXPAND+wx.wxALL, 5) flexSizer:Add(scrollBar, 1, wx.wxEXPAND+wx.wxALL, 5) flexSizer:Add(checklBox, 1, wx.wxEXPAND+wx.wxALL, 5) flexSizer:Add(textAlphaCtrl, 1, wx.wxEXPAND+wx.wxALL, 5) flexSizer:Add(okButton, 1, wx.wxEXPAND+wx.wxALL, 5) dialog:SetSizer(flexSizer) flexSizer:SetSizeHints(dialog) dialog:ShowModal() end function main() frame = wx.wxFrame( wx.NULL, -- no parent for toplevel windows wx.wxID_ANY, -- don't need a wxWindow ID "wxLua Validator Demo", -- caption on the frame wx.wxDefaultPosition, -- let system place the frame wx.wxSize(450, 450), -- set the size of the frame wx.wxDEFAULT_FRAME_STYLE ) -- use default frame styles -- create a simple status bar frame:CreateStatusBar(1) frame:SetStatusText("Welcome to wxLua.") -- ----------------------------------------------------------------------- local fileMenu = wx.wxMenu() fileMenu:Append(ID_TEST_VALIDATORS, "&Test Validators...", "Show dialog to test validators") fileMenu:AppendSeparator() fileMenu:Append(wx.wxID_EXIT, "E&xit", "Quit the program") local helpMenu = wx.wxMenu() helpMenu:Append(wx.wxID_ABOUT, "&About", "About the wxLua Minimal Application") local menuBar = wx.wxMenuBar() menuBar:Append(fileMenu, "&File") menuBar:Append(helpMenu, "&Help") frame:SetMenuBar(menuBar) -- connect the selection event of the exit menu item to an frame:Connect(ID_TEST_VALIDATORS, wx.wxEVT_COMMAND_MENU_SELECTED, function (event) -- update original values we'll use for the validators check_val = checkObj:GetObject() combo_val = comboObj:GetObject() text_val = textObj:GetObject() scroll_val = scrollObj:GetObject() checkl_val = checklObj:GetObject() text_alpha_val = textAlphaObj:GetObject() CreateDialog() local s = "" s = s.."wxCheckBox : '"..tostring(checkObj:GetObject()).."', Initial value : '"..tostring(check_val).."'\n\n" s = s.."wxComboBox : '"..tostring(comboObj:GetObject()).."', Initial value : '"..tostring(combo_val).."'\n\n" s = s.."wxTextCtrl : '"..tostring(textObj:GetObject()).."', Initial value : '"..tostring(text_val).."'\n\n" s = s.."wxScrollBar : '"..tostring(scrollObj:GetObject()).."', Initial value : '"..tostring(scroll_val).."'\n\n" s = s.."wxCheckListBox : '"..table.concat(checklObj:GetObject(), ", ").."', Initial value : '"..table.concat(checkl_val, ", ").."'\n\n" s = s.."wxTextCtrl alpha chars only: '"..tostring(textAlphaObj:GetObject()).."', Initial value : '"..tostring(text_alpha_val).."'\n\n" frameText:SetValue(s) end ) -- event handler that closes the window frame:Connect(wx.wxID_EXIT, wx.wxEVT_COMMAND_MENU_SELECTED, function (event) frame:Close(true) end ) -- connect the selection event of the about menu item frame:Connect(wx.wxID_ABOUT, wx.wxEVT_COMMAND_MENU_SELECTED, function (event) wx.wxMessageBox('This is the "About" dialog of the Validator wxLua sample.\n'.. wx.wxLUA_VERSION_STRING.." built with "..wx.wxVERSION_STRING, "About wxLua", wx.wxOK + wx.wxICON_INFORMATION, frame) end ) -- ----------------------------------------------------------------------- frameText = wx.wxTextCtrl(frame, wx.wxID_ANY, "Output of the validator test dialog will be shown here.", wx.wxDefaultPosition, wx.wxDefaultSize, wx.wxTE_MULTILINE) -- show the frame window frame:Show(true) end main() Index: scribble.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/scribble.wx.lua,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** scribble.wx.lua 31 May 2007 17:18:56 -0000 1.18 --- scribble.wx.lua 11 Jun 2007 03:58:11 -0000 1.19 *************** *** 392,396 **** memDC:SelectObject(colourWinBmp) memDC:SetPen(wx.wxBLACK_PEN) ! local w, h = colourWin:GetClientSize() local w2 = math.floor(w/8) local h2 = math.floor(h/2) --- 392,396 ---- memDC:SelectObject(colourWinBmp) memDC:SetPen(wx.wxBLACK_PEN) ! local w, h = colourWin:GetClientSizeWH() local w2 = math.floor(w/8) local h2 = math.floor(h/2) *************** *** 419,423 **** function(event) local x, y = event:GetPositionXY() ! local w, h = colourWin:GetClientSize() local i = math.floor(8*x/w)+1 + 8*math.floor(2*y/h) if colourWinColours[i] then --- 419,423 ---- function(event) local x, y = event:GetPositionXY() ! local w, h = colourWin:GetClientSizeWH() local i = math.floor(8*x/w)+1 + 8*math.floor(2*y/h) if colourWinColours[i] then *************** *** 508,512 **** wx.wxSAVE + wx.wxOVERWRITE_PROMPT) if fileDialog:ShowModal() == wx.wxID_OK then ! local w, h = panel:GetClientSize() local bmp = wx.wxBitmap(w, h) lastDrawn = 0 -- force redrawing all points --- 508,512 ---- wx.wxSAVE + wx.wxOVERWRITE_PROMPT) if fileDialog:ShowModal() == wx.wxID_OK then ! local w, h = panel:GetClientSizeWH() local bmp = wx.wxBitmap(w, h) lastDrawn = 0 -- force redrawing all points Index: bindings.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/bindings.wx.lua,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** bindings.wx.lua 8 Jun 2007 22:50:18 -0000 1.2 --- bindings.wx.lua 11 Jun 2007 03:58:11 -0000 1.3 *************** *** 10,17 **** ----------------------------------------------------------------------------- ! -- ---------------------------------------------------------------------------- -- Brute force dump of the binding info using print statements for debugging -- ---------------------------------------------------------------------------- function ColumnDumpTable(t, keys) --- 10,18 ---- ----------------------------------------------------------------------------- ! -- ---------------------------------------------------------------------------- -- ---------------------------------------------------------------------------- -- Brute force dump of the binding info using print statements for debugging -- ---------------------------------------------------------------------------- + -- ---------------------------------------------------------------------------- function ColumnDumpTable(t, keys) *************** *** 118,121 **** --- 119,124 ---- img_normal = 0 -- a "file" image in the listctrl img_folder = 1 -- a "folder" image in the listctrl + img_sort_dn = 2 -- a down arrow + img_sort_up = 3 -- an up arrow listColWidths = {} -- stored by "object_type" name *************** *** 123,133 **** list_level = 1 -- where are we in the listData listData = {} -- store the table currently displayed by the listCtrl ! -- { {"col1", "col2", ... ["icon"] = img_normal, ["color"] = wx.wxBLUE }, ! -- {"col1", "col2", ... The icon and color are optional }, ! -- { ... }, ! -- ["col_labels"] = { "col label 1", "col label 2", ...}, ! -- ["col_icons"] = { nil, nil, img_folder,... }, -- the 3rd col has folder icon ! -- ["object_type"] = "wxLuaBindClass", -- or something else readable ! -- ["list_item"] = last selected list item or nil if not set -- ---------------------------------------------------------------------------- --- 126,136 ---- list_level = 1 -- where are we in the listData listData = {} -- store the table currently displayed by the listCtrl ! -- {{"col val 1", "val2", ... ["icon"] = img_normal, ["color"] = wx.wxBLUE }, ! -- {"col val 1", "val2", ... The icon and color are optional }, ! -- { ... these are numbered items for the rows }, ! -- ["col_labels"] = { "col label 1", "col label 2", ...}, ! -- ["col_icons"] = { nil, nil, img_folder,... }, -- the 3rd col has folder icon ! -- ["object_type"] = "wxLuaBindClass", -- or something else readable ! -- ["list_item"] = last selected list item or nil if not set -- ---------------------------------------------------------------------------- *************** *** 150,153 **** --- 153,157 ---- -- ---------------------------------------------------------------------------- function GotoBindingLevel(listCtrl, level) + wx.wxBeginBusyCursor(); local data = listData[level] *************** *** 171,178 **** listCtrl:InsertColumn(col-1, data.col_labels[col], wx.wxLIST_FORMAT_LEFT, -1) - if data.col_icons and data.col_icons[col] then - listCtrl:SetColumnImage(col-1, data.col_icons[col]) - end - if auto_col_widths then local w = listCtrl:GetTextExtent(data.col_labels[col]) --- 175,178 ---- *************** *** 195,198 **** --- 195,200 ---- info:SetId(lc_item+1) info:SetText(tostring(d[1])) + info:SetData(i) -- key into the listData table for sorting + if (d.icon) then info:SetImage(d.icon) *************** *** 215,218 **** --- 217,225 ---- listCtrl:SetItem(lc_item, col-1, tostring(d[col])) + if data.col_icons and data.col_icons[col] and + (d[col] ~= "") and (type(d[col]) ~= "function") then + listCtrl:SetItemColumnImage(lc_item, col-1, data.col_icons[col]) + end + if auto_col_widths then local w = listCtrl:GetTextExtent(tostring(d[col])) *************** *** 249,252 **** --- 256,261 ---- end frame:SetStatusText(table.concat(s, "->")) + + wx.wxEndBusyCursor(); end *************** *** 258,303 **** local t = t_ ! if (t - wx.WXLUAMETHOD_OVERLOAD_BASE) >= 0 then ! --table.insert(s, "OverloadBase") -- nobody should care about this ! t = t - wx.WXLUAMETHOD_OVERLOAD_BASE ! end ! if (t - wx.WXLUAMETHOD_OVERLOAD) >= 0 then ! table.insert(s, "Overload") ! t = t - wx.WXLUAMETHOD_OVERLOAD ! end ! if (t - wx.WXLUAMETHOD_STATIC) >= 0 then ! table.insert(s, "Static") ! t = t - wx.WXLUAMETHOD_STATIC ! end ! if (t - wx.WXLUAMETHOD_SETPROP) >= 0 then ! table.insert(s, "SetProp") ! t = t - wx.WXLUAMETHOD_SETPROP ! end ! if (t - wx.WXLUAMETHOD_GETPROP) >= 0 then ! table.insert(s, "GetProp") ! t = t - wx.WXLUAMETHOD_GETPROP ! end ! if (t - wx.WXLUAMETHOD_CFUNCTION) >= 0 then ! table.insert(s, "CFunc") ! t = t - wx.WXLUAMETHOD_CFUNCTION ! end ! if (t - wx.WXLUAMETHOD_METHOD) >= 0 then ! table.insert(s, "Method") ! t = t - wx.WXLUAMETHOD_METHOD ! end ! if (t - wx.WXLUAMETHOD_CONSTRUCTOR) >= 0 then ! table.insert(s, "Constructor") ! t = t - wx.WXLUAMETHOD_CONSTRUCTOR end ! assert(t == 0, "The wxLuaMethod_Type is not handled correctly "..tostring(t)) ! -- nobody should care about this and it's confusing ! t = t_ ! if (t - wx.WXLUAMETHOD_OVERLOAD_BASE) >= 0 then ! t = t - wx.WXLUAMETHOD_OVERLOAD_BASE ! end ! return string.format("0x%X (", t)..table.concat(s, ", ")..")" end --- 267,294 ---- local t = t_ ! local function HasBit(val, bit, tbl, name) ! if (val - bit) >= 0 then ! val = val - bit ! if tbl then table.insert(tbl, name) end ! end ! return val end ! -- 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_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, ", ")) end *************** *** 309,322 **** local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindClass") - -- Convert the classinfo userdata into something more readable for i = 2, #t do if (type(t[i][2]) == "table") then t[i].icon = img_folder end local classInfo = t[i][4] if type(classInfo) == "userdata" then ! local s = classInfo:GetClassName() ! local b1 = classInfo:GetBaseClassName1() local b2 = classInfo:GetBaseClassName2() --- 300,313 ---- local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindClass") for i = 2, #t do + -- This class has methods and can be expanded if (type(t[i][2]) == "table") then t[i].icon = img_folder end + -- Convert the wxClassInfo userdata into something more readable local classInfo = t[i][4] if type(classInfo) == "userdata" then ! local s = classInfo:GetClassName() local b1 = classInfo:GetBaseClassName1() local b2 = classInfo:GetBaseClassName2() *************** *** 329,333 **** end ! t[i][4] = s end end --- 320,324 ---- end ! t[i][4] = s -- replace with the string end end *************** *** 354,359 **** t[i][2] = ConvertwxLuaMethod_Type(t[i][2]) if (type(t[i][3]) == "table") then - local cfunc_t = CreatewxLuaBindCFunc(t[i][3]) t[i].color = wx.wxBLUE t[i][6] = "" --- 345,350 ---- t[i][2] = ConvertwxLuaMethod_Type(t[i][2]) + -- Add in the CFuncs if (type(t[i][3]) == "table") then t[i].color = wx.wxBLUE t[i][6] = "" *************** *** 361,367 **** t[i][8] = "" t[i][9] = "" -- keys for CFunc = { "func", "type", "minargs", "maxargs", "argtag_names", "argtags" } for j = 2, #cfunc_t do ! table.insert(t, i+j-1, {"", cfunc_t[j][2], cfunc_t[j][1], "", "", cfunc_t[j][3], cfunc_t[j][4], cfunc_t[j][5], cfunc_t[j][6]}) end --- 352,360 ---- t[i][8] = "" t[i][9] = "" + -- keys for CFunc = { "func", "type", "minargs", "maxargs", "argtag_names", "argtags" } + local cfunc_t = CreatewxLuaBindCFunc(t[i][3]) for j = 2, #cfunc_t do ! table.insert(t, i+j-1, {t[i][1].." "..j-1, cfunc_t[j][2], cfunc_t[j][1], "", "", cfunc_t[j][3], cfunc_t[j][4], cfunc_t[j][5], cfunc_t[j][6]}) end *************** *** 381,388 **** for i = 2, #t do -- these are often enums or flags, it's easier to see them as hex - local n = tonumber(t[i][2]) if n > 0 then ! t[i][2] = t[i][2]..string.format(" (0x%X)", n) end end --- 374,383 ---- for i = 2, #t do + local n = t[i][2] + t[i][3] = n -- store real number for sorting w/o hex + -- these are often enums or flags, it's easier to see them as hex if n > 0 then ! t[i][2] = n..string.format(" (0x%X)", n) end end *************** *** 398,404 **** local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindEvent") ! -- Add the tag name the event uses for i = 2, #t do ! t[i][3] = t[i][3].." ("..wx.wxlua_typename(t[i][3])..")" end --- 393,399 ---- local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindEvent") ! -- 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 *************** *** 409,415 **** local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindObject") ! -- Add the tag name to the user data for i = 2, #t do ! t[i][3] = t[i][3].." ("..wx.wxlua_typename(t[i][3])..")" end --- 404,410 ---- local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindObject") ! -- 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 *************** *** 423,427 **** t.col_labels[6] ="argtags" ! -- we don't want to show the table, just show the values and convert them to strings for i = 2, #t do local args = t[i][5] --- 418,422 ---- t.col_labels[6] ="argtags" ! -- we don't want to show the table, just show the values for i = 2, #t do local args = t[i][5] *************** *** 450,454 **** local item = {} for k = 1, #keys do ! -- we need to force there to be something in each col, use a 0 local val = tbl[i][keys[k]] if val ~= nil then --- 445,449 ---- local item = {} for k = 1, #keys do ! -- we need to force there to be something in each col, use "" local val = tbl[i][keys[k]] if val ~= nil then *************** *** 464,471 **** --- 459,713 ---- end + -- ---------------------------------------------------------------------------- + -- Handle the wxEVT_COMMAND_LIST_COL_CLICK event when the mouse is clicked + -- ---------------------------------------------------------------------------- + function OnListColClicked(event) + local col = event:GetColumn() + + if not listData[list_level].col_sorted then + listData[list_level].col_sorted = {} + end + + local sorted = listData[list_level].col_sorted[col+1] + + local function SortListItems(item1, item2, col) + local data1 = listData[list_level][item1] + local data2 = listData[list_level][item2] + + if data1[1] == ".." then return -1 end + if data2[1] == ".." then return 1 end + + local i1 = data1[col] + local i2 = data2[col] + + if (listData[list_level].object_type == "wxLuaBindDefine") and (col == 2) then + -- sort on the real numbers, not the strings w/ hex + i1 = data1[3] + i2 = data2[3] + elseif ((listData[list_level].object_type == "wxLuaBindClass") and ((col == 3) or (col == 5) or (col == 9))) or + ((listData[list_level].object_type == "wxLuaBindMethod") and ((col == 4) or (col == 6) or (col == 7))) or + ((listData[list_level].object_type == "wxLuaBindCFunc") and ((col == 3) or (col == 4))) then + -- sort on the real numbers, but treat "" as lower + if (i1 == "") and (i2 == "") then + i1, i2 = 0, 0 + elseif (i1 == "") then + i1, i2 = 0, 1 + elseif (i2 == "") then + i1, i2 = 1, 0 + else + i1 = tonumber(i1) + i2 = tonumber(i2) + end + else + i1 = tostring(data1[col]) + i2 = tostring(data2[col]) + end + + if sorted then + if i1 < i2 then return 1 end + if i1 > i2 then return -1 end + else + if i1 < i2 then return -1 end + if i1 > i2 then return 1 end + end + + return 0 + end + + listCtrl:SortItems(SortListItems, col+1) + + for c = 1, listCtrl:GetColumnCount() do + listCtrl:SetColumnImage(c-1, -1) + end + + if not sorted then + listData[list_level].col_sorted[col+1] = true + listCtrl:SetColumnImage(col, img_sort_dn) + else + listData[list_level].col_sorted[col+1] = false + listCtrl:SetColumnImage(col, img_sort_up) + end + end + + -- ---------------------------------------------------------------------------- + -- Handle the wxEVT_COMMAND_LIST_ITEM_ACTIVATED event when the mouse is clicked + -- ---------------------------------------------------------------------------- + function OnListItemActivated(event) + local index = event:GetIndex() -- note: 0 based, lua tables start at 1 + local data_index = event:GetData() + local itemText = listCtrl:GetItemText(index) + + -- ----------------------------------------------------------------------- + -- Find what column we're in + -- local col = event:GetColumn() -- both of these don't work in MSW & GTK + -- local pt = event:GetPoint() + + local mousePos = wx.wxGetMousePosition() -- mouse pos on screen + local clientPos = listCtrl:ScreenToClient(mousePos) + local scrollPos = listCtrl:GetScrollPos(wx.wxHORIZONTAL) -- horiz scroll pos + + -- The wxGenericListCtrl (used in GTK at least) actually scrolls by 15 + genlistClassInfo = wx.wxClassInfo.FindClass("wxGenericListCtrl") + if genlistClassInfo and listCtrl:GetClassInfo():IsKindOf(genlistClassInfo) then + scrollPos = scrollPos * 15 + end + + local x = clientPos:GetX() + scrollPos + local w = 0 + local col = 0 + + --print(col, x, mousePos:GetX(), clientPos:GetX(), scrollPos) + + for c = 1, listCtrl:GetColumnCount() do + w = w + listCtrl:GetColumnWidth(c-1) + if x < w then + col = c-1 + break + end + end + + listData[list_level].list_item = index + SaveListColWidths(list_level) -- remember user's col widths + + if (itemText == "..") then + list_level = list_level - 1 + GotoBindingLevel(listCtrl, list_level) + 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_Enum" + } + + 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) + else + local binding = _G + for i = 1, #listData[1][data_index] do + binding = binding[listData[1][data_index][i]] + end + + listData[2] = { + {"..", ["icon"] = img_folder}, + {"GetBindingName", tostring(binding.GetBindingName)}, + {"GetLuaNamespace", tostring(binding.GetLuaNamespace)}, + + {"GetClassArray", "GetClassCount : "..tostring(binding.GetClassCount), ["icon"] = img_folder}, + {"GetFunctionArray", "GetFunctionCount : "..tostring(binding.GetFunctionCount), ["icon"] = img_folder}, + {"GetDefineArray", "GetDefineCount : "..tostring(binding.GetDefineCount), ["icon"] = img_folder}, + {"GetStringArray", "GetStringCount : "..tostring(binding.GetStringCount), ["icon"] = img_folder}, + {"GetEventArray", "GetEventCount : "..tostring(binding.GetEventCount), ["icon"] = img_folder}, + {"GetObjectArray", "GetObjectCount : "..tostring(binding.GetObjectCount), ["icon"] = img_folder}, + + ["col_labels"] = {"Function Name", "Value"}, + ["binding"] = binding, + ["object_type"] = "wxLuaBinding" + } + + list_level = list_level + 1 + GotoBindingLevel(listCtrl, list_level) + end + elseif (list_level == 2) then + local binding = listData[2].binding + + local t = nil + + if (itemText == "GetClassArray") then + t = CreatewxLuaBindClass(binding.GetClassArray) + elseif (itemText == "GetFunctionArray") then + t = CreatewxLuaBindMethod(binding.GetFunctionArray) + elseif (itemText == "GetDefineArray") then + t = CreatewxLuaBindDefine(binding.GetDefineArray) + elseif (itemText == "GetStringArray") then + t = CreatewxLuaBindString(binding.GetStringArray) + elseif (itemText == "GetEventArray") then + t = CreatewxLuaBindEvent(binding.GetEventArray) + elseif (itemText == "GetObjectArray") then + t = CreatewxLuaBindObject(binding.GetObjectArray) + end + + if t ~= nil then + list_level = list_level + 1 + listData[list_level] = t + GotoBindingLevel(listCtrl, list_level) + end + elseif (data_index > 1) and listData[list_level].object_type == "wxLuaBindClass" then + local t = nil + + if ((col == 0) or (col == 1)) and (type(listData[list_level][data_index][2]) == "table") then + t = CreatewxLuaBindMethod(listData[list_level][data_index][2]) + elseif (col == 6) and (type(listData[list_level][data_index][col+1]) == "userdata") then + t = CreatewxLuaBindClass({listData[list_level][data_index][col+1]}) + elseif (col == 7) and (type(listData[list_level][data_index][col+1]) == "table") then + t = CreatewxLuaBindDefine(listData[list_level][data_index][col+1]) + end + + if t ~= nil then + t.class_name = listCtrl:GetItemText(index) + + list_level = list_level + 1 + listData[list_level] = t + GotoBindingLevel(listCtrl, list_level) + end + elseif (data_index > 1) and listData[list_level].object_type == "wxLuaBindMethod" then + local t = nil + + if ((col == 0) or (col == 2)) and (type(listData[list_level][data_index][3]) == "table") then + t = CreatewxLuaBindCFunc(listData[list_level][data_index][3]) + t.class_name = listData[list_level].class_name + elseif (col == 4) and (type(listData[list_level][data_index][col+1]) == "userdata") then + t = CreatewxLuaBindMethod({listData[list_level][data_index][col+1]}) + t.class_name = listData[list_level][data_index][col+1].class_name + end + + if t ~= nil then + list_level = list_level + 1 + listData[list_level] = t + GotoBindingLevel(listCtrl, list_level) + end + end + + event:Skip(); + + end + + -- ---------------------------------------------------------------------------- + -- The main program, call this to start the program + -- ---------------------------------------------------------------------------- function main() frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, "wxLua Binding Browser") + -- ----------------------------------------------------------------------- -- Create the menu bar local fileMenu = wx.wxMenu() *************** *** 490,494 **** "You can view the C++ bindings by navigating the wxListCtrl.\n".. wx.wxLUA_VERSION_STRING.." built with "..wx.wxVERSION_STRING, ! "About wxLua Bindings", wx.wxOK + wx.wxICON_INFORMATION, frame) --- 732,736 ---- "You can view the C++ bindings by navigating the wxListCtrl.\n".. wx.wxLUA_VERSION_STRING.." built with "..wx.wxVERSION_STRING, ! "About wxLua Binding Browser", wx.wxOK + wx.wxICON_INFORMATION, frame) *************** *** 496,514 **** frame:Connect(wx.wxID_HELP, wx.wxEVT_COMMAND_MENU_SELECTED, function (event) ! wx.wxMessageBox("Select the C++ bindings to view and then you can see the items that\n".. ! "have been wrapped. You can expand items that have a folder icon \n".. ! " in the column header by double clicking on the item's column. \n".. ! "Use the '..' to go up a level.\n\n".. "This data is from the structs declared in \n".. "wxLua/modules/wxlua/include/wxlbind.h.", ! "Help on wxLua Bindings", wx.wxOK + wx.wxICON_INFORMATION, frame) end ) ! frame:CreateStatusBar(1) frame:SetStatusText("Welcome to wxLua.") -- Create the windows panel = wx.wxPanel(frame, wx.wxID_ANY) --- 738,759 ---- frame:Connect(wx.wxID_HELP, wx.wxEVT_COMMAND_MENU_SELECTED, function (event) ! wx.wxMessageBox("Select the C++ bindings to view and then the items that\n".. ! "have been wrapped. You can expand items that have a folder\n".. ! "icon by double clicking on the item's column. \n".. ! "Use the '..' to go up a level.\n".. ! "Left-click column headers to sort.\n\n".. "This data is from the structs declared in \n".. "wxLua/modules/wxlua/include/wxlbind.h.", ! "Help on wxLua Binding Browser", wx.wxOK + wx.wxICON_INFORMATION, frame) end ) ! -- ----------------------------------------------------------------------- ! -- Create the status bar frame:CreateStatusBar(1) frame:SetStatusText("Welcome to wxLua.") + -- ----------------------------------------------------------------------- -- Create the windows panel = wx.wxPanel(frame, wx.wxID_ANY) *************** *** 520,526 **** --- 765,778 ---- imageList:Add(wx.wxArtProvider.GetBitmap(wx.wxART_NORMAL_FILE, wx.wxART_MENU, wx.wxSize(16,16))) imageList:Add(wx.wxArtProvider.GetBitmap(wx.wxART_FOLDER, wx.wxART_MENU, wx.wxSize(16,16))) + imageList:Add(wx.wxArtProvider.GetBitmap(wx.wxART_GO_DOWN, wx.wxART_MENU, wx.wxSize(16,16))) + imageList:Add(wx.wxArtProvider.GetBitmap(wx.wxART_GO_UP, wx.wxART_MENU, wx.wxSize(16,16))) listCtrl:SetImageList(imageList, wx.wxIMAGE_LIST_SMALL); + listCtrl:Connect(wx.wxEVT_COMMAND_LIST_ITEM_ACTIVATED, OnListItemActivated) + listCtrl:Connect(wx.wxEVT_COMMAND_LIST_COL_CLICK, OnListColClicked) + + list_level = 1 listData[1] = { + {"wxLua Types", "Compare Lua's type to wxLua's type", ["icon"] = img_folder }, {"wx", "wxLuaBinding_wx", ["icon"] = img_folder }, {"wx", "wxLuaBinding_wxstc", ["icon"] = img_folder }, *************** *** 532,662 **** GotoBindingLevel(listCtrl, 1) ! listCtrl:Connect(wx.wxEVT_COMMAND_LIST_ITEM_ACTIVATED, ! function(event) ! local index = event:GetIndex() ! local itemText = listCtrl:GetItemText(index) ! ! -- Find what column we're in ! --local col = event:GetColumn() -- both of these don't work in MSW ! --local pt = event:GetPoint() ! ! local mousePos = wx.wxGetMousePosition() ! local framePos = frame:GetPosition() ! local winPos = listCtrl:GetPosition() ! local scrollPos = listCtrl:GetScrollPos(wx.wxHORIZONTAL) ! local x = mousePos:GetX() + scrollPos - framePos:GetX() - winPos:GetX() ! local w = 0 ! ! --print(x, mousePos:GetX(), scrollPos, framePos:GetX(), winPos:GetX()) ! ! for c = 1, listCtrl:GetColumnCount() do ! w = w + listCtrl:GetColumnWidth(c-1) ! if x < w then ! col = c-1 ! break ! end ! end ! ! SaveListColWidths(list_level) ! ! if (itemText == "..") then ! list_level = list_level - 1 ! GotoBindingLevel(listCtrl, list_level) ! elseif (list_level == 1) then ! local binding = _G ! for i = 1, #listData[1][index+1] do ! binding = binding[listData[1][index+1][i]] ! end ! ! listData[2] = { ! {"..", ["icon"] = img_folder}, ! {"GetBindingName", tostring(binding.GetBindingName)}, ! {"GetLuaNamespace", tostring(binding.GetLuaNamespace)}, ! ! {"GetClassArray", "GetClassCount : "..tostring(binding.GetClassCount), ["icon"] = img_folder}, ! {"GetFunctionArray", "GetFunctionCount : "..tostring(binding.GetFunctionCount), ["icon"] = img_folder}, ! {"GetDefineArray", "GetDefineCount : "..tostring(binding.GetDefineCount), ["icon"] = img_folder}, ! {"GetStringArray", "GetStringCount : "..tostring(binding.GetStringCount), ["icon"] = img_folder}, ! {"GetEventArray", "GetEventCount : "..tostring(binding.GetEventCount), ["icon"] = img_folder}, ! {"GetObjectArray", "GetObjectCount : "..tostring(binding.GetObjectCount), ["icon"] = img_folder}, ! ! ["col_labels"] = {"Function Name", "Value"}, ! ["binding"] = binding, ! ["object_type"] = "wxLuaBinding" ! } ! ! listData[list_level].list_item = index ! list_level = list_level + 1 ! GotoBindingLevel(listCtrl, list_level) ! elseif (list_level == 2) then ! local binding = listData[2].binding ! ! local t = nil ! ! if (itemText == "GetClassArray") then ! t = CreatewxLuaBindClass(binding.GetClassArray) ! elseif (itemText == "GetFunctionArray") then ! t = CreatewxLuaBindMethod(binding.GetFunctionArray) ! elseif (itemText == "GetDefineArray") then ! t = CreatewxLuaBindDefine(binding.GetDefineArray) ! elseif (itemText == "GetStringArray") then ! t = CreatewxLuaBindString(binding.GetStringArray) ! elseif (itemText == "GetEventArray") then ! t = CreatewxLuaBindEvent(binding.GetEventArray) ! elseif (itemText == "GetObjectArray") then ! t = CreatewxLuaBindObject(binding.GetObjectArray) ! end ! ! if t ~= nil then ! listData[list_level].list_item = index ! list_level = list_level + 1 ! listData[list_level] = t ! GotoBindingLevel(listCtrl, list_level) ! end ! elseif (index > 0) and listData[list_level].object_type == "wxLuaBindClass" then ! local t = nil ! ! if ((col == 0) or (col == 1)) and (type(listData[list_level][index+1][2]) == "table") then ! t = CreatewxLuaBindMethod(listData[list_level][index+1][2]) ! elseif (col == 6) and (type(listData[list_level][index+1][col+1]) == "userdata") then ! t = CreatewxLuaBindClass({listData[list_level][index+1][col+1]}) ! elseif (col == 7) and (type(listData[list_level][index+1][col+1]) == "table") then ! t = CreatewxLuaBindDefine(listData[list_level][index+1][col+1]) ! end ! ! if t ~= nil then ! t.class_name = listCtrl:GetItemText(index) ! ! listData[list_level].list_item = index ! list_level = list_level + 1 ! listData[list_level] = t ! GotoBindingLevel(listCtrl, list_level) ! end ! elseif (index > 0) and listData[list_level].object_type == "wxLuaBindMethod" then ! local t = nil ! ! if ((col == 0) or (col == 2)) and (type(listData[list_level][index+1][3]) == "table") then ! t = CreatewxLuaBindCFunc(listData[list_level][index+1][3]) ! t.class_name = listData[list_level].class_name ! elseif (col == 4) and (type(listData[list_level][index+1][col+1]) == "userdata") then ! t = CreatewxLuaBindMethod({listData[list_level][index+1][col+1]}) ! t.class_name = listData[list_level][index+1][col+1].class_name ! end ! ! if t ~= nil then ! listData[list_level].list_item = index ! list_level = list_level + 1 ! listData[list_level] = t ! GotoBindingLevel(listCtrl, list_level) ! end ! end ! ! event:Skip(); ! end) ! ! rootSizer = wx.wxBoxSizer(wx.wxVERTICAL); rootSizer:Add(listCtrl, 1, wx.wxEXPAND + wx.wxALL, 0); ! rootSizer:SetMinSize(450, 400); panel:SetSizer(rootSizer); rootSizer:SetSizeHints(frame); --- 784,792 ---- GotoBindingLevel(listCtrl, 1) ! -- ----------------------------------------------------------------------- ! -- Create the sizer to layout the windows rootSizer = wx.wxBoxSizer(wx.wxVERTICAL); rootSizer:Add(listCtrl, 1, wx.wxEXPAND + wx.wxALL, 0); ! rootSizer:SetMinSize(600, 420); panel:SetSizer(rootSizer); rootSizer:SetSizeHints(frame); Index: unittest.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/unittest.wx.lua,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** unittest.wx.lua 5 Jun 2007 21:07:26 -0000 1.8 --- unittest.wx.lua 11 Jun 2007 03:58:11 -0000 1.9 *************** *** 75,78 **** --- 75,97 ---- PrintOk(a:FindOrCreatePen(wx.wxRED, 1, wx.wxSOLID):Ok(), "Test %define_pointer wxThePenList:FindOrCreatePen(wx.wxRED, 1, wx.wxSOLID) is Ok()") + a = wx.wxString("Hello") + PrintOk(a:GetData() == "Hello", "Test automatic overload of wxString(\"lua string\")") + b = wx.wxString(a) + PrintOk(b:GetData() == "Hello", "Test automatic overload of wxString(wxString)") + b = wx.wxFileName("Hello") + PrintOk(b:GetFullPath() == "Hello", "Test automatic overload of wxFileName(\"lua string\")") + b = wx.wxFileName(a) + PrintOk(b:GetFullPath() == "Hello", "Test automatic overload of wxFileName(wxString)") + + a = wx.wxArrayString({"a", "b", "c"}) + PrintOk((a:Item(0) == "a") and (a:GetCount() == 3), "Test automatic overload of wxArrayString(lua table)") + b = wx.wxArrayString(a) + PrintOk((b:Item(1) == "b") and (b:GetCount() == 3), "Test automatic overload of wxArrayString(wxArrayString)") + + a = wx.wxArrayInt({1, 2, 3}) + PrintOk((a:Item(0) == 1) and (a:GetCount() == 3), "Test automatic overload of wxArrayInt(lua table)") + b = wx.wxArrayInt(a) + PrintOk((b:Item(1) == 2) and (b:GetCount() == 3), "Test automatic overload of wxArrayInt(wxArrayInt)") + -- --------------------------------------------------------------------------- print("\nTest some binding class functions.\n") Index: printing.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/printing.wx.lua,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** printing.wx.lua 31 May 2007 17:18:56 -0000 1.13 --- printing.wx.lua 11 Jun 2007 03:58:11 -0000 1.14 *************** *** 164,168 **** ConnectPrintEvents(previewPrintout) ! local printDialogData = wx.wxPrintDialogDataFromPrintData(printData):GetPrintData() local preview = wx.wxPrintPreview(printerPrintout, previewPrintout, printDialogData) local result = preview:Ok() --- 164,168 ---- ConnectPrintEvents(previewPrintout) ! local printDialogData = wx.wxPrintDialogData(printData):GetPrintData() local preview = wx.wxPrintPreview(printerPrintout, previewPrintout, printDialogData) local result = preview:Ok() *************** *** 190,193 **** --- 190,194 ---- function PrintSetup() + -- NOTE : this function crashes in wxWidgets GTK wxWidgets 2.8.2 local printDialogData = wx.wxPrintDialogData(printData) local printerDialog = wx.wxPrintDialog(frame, printDialogData) *************** *** 219,223 **** dc:SetPen(wx.wxTRANSPARENT_PEN) dc:SetBrush(wx.wxWHITE_BRUSH) ! local w, h = frame:GetClientSize() dc:DrawRectangle(0, 0, w, h) -- draw our figure --- 220,224 ---- dc:SetPen(wx.wxTRANSPARENT_PEN) dc:SetBrush(wx.wxWHITE_BRUSH) ! local w, h = frame:GetClientSizeWH() dc:DrawRectangle(0, 0, w, h) -- draw our figure |
From: John L. <jr...@us...> - 2007-06-11 03:58:19
|
Update of /cvsroot/wxlua/wxLua/modules/wxluasocket/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv19140/wxLua/modules/wxluasocket/include Modified Files: wxldserv.h Log Message: Remove wxArrayString_FromLuaTable and wxArrayInt_FromLuaTable binding tag since we convert from wxArrayInt/String automatically Fix listctrl sorting Fix validator code using wxLuaObject Rename wxLuaState::LuaCall to LuaPCall since that what it calls Lots more cleanup and shuffling of code to more appropriate places Index: wxldserv.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/include/wxldserv.h,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** wxldserv.h 24 May 2007 00:59:47 -0000 1.35 --- wxldserv.h 11 Jun 2007 03:58:10 -0000 1.36 *************** *** 49,55 **** wxLUASOCKET_DEBUGGEE_EVENT_TABLE_ENUM, wxLUASOCKET_DEBUGGEE_EVENT_EVALUATE_EXPR, - wxLUASOCKET_DEBUGGEE_EVENT_BREAKPOINT_ADDED, - wxLUASOCKET_DEBUGGEE_EVENT_BREAKPOINT_REMOVED, }; --- 49,54 ---- wxLUASOCKET_DEBUGGEE_EVENT_TABLE_ENUM, wxLUASOCKET_DEBUGGEE_EVENT_EVALUATE_EXPR, + wxLUASOCKET_DEBUGGEE_EVENT__COUNT }; *************** *** 438,445 **** DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_EVALUATE_EXPR, 2518) ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_STARTDEBUGGER, 2519) ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_STOPDEBUGGER, 2520) ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_BREAKPOINT_ADDED, 2521) ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_BREAKPOINT_REMOVED, 2522) END_DECLARE_EVENT_TYPES() --- 437,442 ---- DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_EVALUATE_EXPR, 2518) ! //DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_STARTDEBUGGER, 2519) ! //DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_STOPDEBUGGER, 2520) END_DECLARE_EVENT_TYPES() *************** *** 448,451 **** --- 445,449 ---- #define EVT_WXLUA_DEBUGGER_DEBUGGEE_CONNECTED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_DEBUGGEE_CONNECTED, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), + #define EVT_WXLUA_DEBUGGER_DEBUGGEE_DISCONNECTED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_DEBUGGEE_DISCONNECTED, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), #define EVT_WXLUA_DEBUGGER_BREAK(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_BREAK, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), #define EVT_WXLUA_DEBUGGER_PRINT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_PRINT, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), *************** *** 456,463 **** #define EVT_WXLUA_DEBUGGER_TABLE_ENUM(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_TABLE_ENUM, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), #define EVT_WXLUA_DEBUGGER_EVALUATE_EXPR(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_EVALUATE_EXPR, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_STARTDEBUGGER(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_STARTDEBUGGER, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_STOPDEBUGGER(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_STOPDEBUGGER, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_BREAKPOINT_ADDED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_BREAKPOINT_ADDED, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_BREAKPOINT_REMOVED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_BREAKPOINT_REMOVED, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), #endif // WX_LUA_DEBUG_SERVER_H --- 454,459 ---- #define EVT_WXLUA_DEBUGGER_TABLE_ENUM(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_TABLE_ENUM, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), #define EVT_WXLUA_DEBUGGER_EVALUATE_EXPR(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_EVALUATE_EXPR, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! //#define EVT_WXLUA_DEBUGGER_STARTDEBUGGER(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_STARTDEBUGGER, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! //#define EVT_WXLUA_DEBUGGER_STOPDEBUGGER(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_STOPDEBUGGER, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), #endif // WX_LUA_DEBUG_SERVER_H |
From: John L. <jr...@us...> - 2007-06-11 03:58:15
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv19140/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxlstate.h Log Message: Remove wxArrayString_FromLuaTable and wxArrayInt_FromLuaTable binding tag since we convert from wxArrayInt/String automatically Fix listctrl sorting Fix validator code using wxLuaObject Rename wxLuaState::LuaCall to LuaPCall since that what it calls Lots more cleanup and shuffling of code to more appropriate places Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** wxlbind.h 8 Jun 2007 22:50:13 -0000 1.46 --- wxlbind.h 11 Jun 2007 03:58:10 -0000 1.47 *************** *** 52,56 **** WXLUAMETHOD_OVERLOAD_BASE = 0x4000, // Class method has been checked to see if it is ! // overloaded from the base class. // Check WXLUAMETHOD::basemethod and if !NULL // this method is an overload from the base class --- 52,57 ---- WXLUAMETHOD_OVERLOAD_BASE = 0x4000, // Class method has been checked to see if it is ! // overloaded from the base class by the function ! // wxLuaBinding::GetClassMethod(wxLuaBindClass...) // Check WXLUAMETHOD::basemethod and if !NULL // this method is an overload from the base class *************** *** 80,83 **** --- 81,85 ---- int funcs_n; // number of functions (overloaded > 1) for this method wxLuaBindMethod *basemethod; // overloaded methods from base class, else NULL + // see comments for WXLUAMETHOD_OVERLOAD_BASE }; *************** *** 167,171 **** ~wxLuaFunction() {} ! int CallMethod(lua_State *L); // call WXLUAMETHOD->func(L) void *GetObject() const { return m_pObject; } --- 169,173 ---- ~wxLuaFunction() {} ! int CallMethod(lua_State *L); // call wxLuaBindMethod->func[0](L) void *GetObject() const { return m_pObject; } *************** *** 200,215 **** { public: ! // Wrap the item at the lua state's stack index. ! wxLuaObject(const wxLuaState& wxlState, int iParam = 1); virtual ~wxLuaObject(); ! // Get the value of the reference object (or a proxy if the object has ! // been aliased for a wxValidator class. bool GetObject(); // Remove any existing reference and allocate another ! void SetObject(int iParam = 1); // The following methods are used by the wxValidator interface bool *GetBoolPtr(); int *GetIntPtr(); --- 202,222 ---- { public: ! // Wrap the item at the lua state's stack index and create a reference to it. ! wxLuaObject(const wxLuaState& wxlState, int stack_idx = 1); virtual ~wxLuaObject(); ! // Get the value of the reference object and push it onto the stack. ! // (or a proxy if the object has been aliased for a wxValidator class.) ! // returns true if the object is valid and has a reference, returns false ! // on failure and nothing is pushed on the stack. bool GetObject(); // Remove any existing reference and allocate another ! void SetObject(int stack_idx = 1); // The following methods are used by the wxValidator interface + // Call GetObject() so that it's on the stack then try to get the value of + // the object as the specified type and set the member variable equal to it + // and return a pointer to member variable. bool *GetBoolPtr(); int *GetIntPtr(); *************** *** 227,231 **** private: ! wxLuaState* m_wxlState; int m_iReference; bool m_bool; --- 234,238 ---- private: ! wxLuaState* m_wxlState; // a pointer due to include recursion. int m_iReference; bool m_bool; *************** *** 326,329 **** --- 333,338 ---- virtual void UnRegisterBinding(lua_State* L); + // ----------------------------------------------------------------------- + // Get/Set the binding name, a unique name of the binding. // By default it is the "hook_cpp_namespace" used in the binding *************** *** 354,357 **** --- 363,367 ---- wxLuaBindMethod* GetFunctionArray() { return m_functionArray; } + // Is this tag defined as something in this binding? bool IsTag(int tag) { return (tag >= m_startTag) && (tag <= m_lastTag); } *************** *** 361,365 **** bool SetBaseClass(wxLuaBindClass *pClass); ! // These function only look through the binding data of this wxLuaBinding // Find the wxLuaBindEvent with the wxEventType, returns NULL if not found. --- 371,376 ---- bool SetBaseClass(wxLuaBindClass *pClass); ! // ----------------------------------------------------------------------- ! // These functions only look through the binding data of this wxLuaBinding // Find the wxLuaBindEvent with the wxEventType, returns NULL if not found. *************** *** 375,378 **** --- 386,405 ---- const wxLuaBindClass* GetLuaClass(const wxLuaBindCFunc* wxlMethod_cfunc) const; + // ----------------------------------------------------------------------- + + // Lookup a lua method or get property called cpIndex in the wxLuaBindClass array pClass + // Ensure that the lookup is of the required type. If the lua method + // can not be found on the current class recurse through base classes + // Return a pointer to the wxLuaBindMethod that corresponds to the method name, + // else return NULL; + static wxLuaBindMethod* GetClassMethod(const wxLuaBindClass *wxlClass, const char *methodName, bool search_baseclasses = true); + // Lookup a lua property function named cpIndex in the wxLuaBindClass pClass + // Ensure that the lookup is of the required type. If the lua property + // can not be found on the current class recurse through base classes + // Return a pointer to the wxLuaBindMethod that corresponds to the property name, + // else return NULL; + // Find 'Set' properties if isLuaSetProp else return 'WXLUAMETHOD_GETPROP' property + static wxLuaBindMethod* GetClassProperty(const wxLuaBindClass *wxlClass, const char *propName, bool isLuaSetProp); + // Get all the bindings that were initialized using the generated binding // function wxLuaBinding_[binding name]_init(). Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** wxlstate.h 8 Jun 2007 22:50:16 -0000 1.74 --- wxlstate.h 11 Jun 2007 03:58:10 -0000 1.75 *************** *** 87,90 **** --- 87,111 ---- }; + // ---------------------------------------------------------------------------- + // Push a special string into lua, defines to make sure it's always done the same + // ---------------------------------------------------------------------------- + + // Push the "wxLuaReferences" string onto the stack. This is the name of an + // index in the LUA_REGISTRYINDEX table that is a table indexed on the "tags" and each item + // is a metatable for classes or a reference to an object we want to keep a handle to. + #define wxlua_pushstring_wxLuaReferences(L) lua_pushlstring(L, "wxLuaReferences", 15) + // Push the "wxLuaClasses" string onto the stack. This is the name of an + // index in the LUA_REGISTRYINDEX table that is + // t[wxLuaBindClass.name] = wxLuaBindClass, where the wxLuaBindClass is a lightuserdata. + #define wxlua_pushstring_wxLuaClasses(L) lua_pushlstring(L, "wxLuaClasses", 12) + // Push the "wxLuaDerivedFunctions" string onto the stack. This is the name of an + // index in the LUA_REGISTRYINDEX table that is a table + // t[lightuserdata object] = {["derived func/value name"] = wxLuaObject(lua function/value), ...} + #define wxlua_pushstring_wxLuaDerivedFunctions(L) lua_pushlstring(L, "wxLuaDerivedFunctions", 21) + // Push the "wxLuaStateRefData" string onto the stack. This is the name of an + // index of the LUA_REGISTRYINDEX table that is a lightuserdata of the + // wxLuaStateRefData for this lua_State. + #define wxlua_pushstring_wxLuaStateRefData(L) lua_pushlstring(L, "wxLuaStateRefData", 17) + //---------------------------------------------------------------------------- // C functions for lua used by the wxLuaState *************** *** 116,120 **** WXDLLIMPEXP_WXLUA bool LUACALL wxlua_tpushusertag(lua_State* L, const void* u, int tag); // Get the numeric tag of the object at the stack index using the metatable's "tag" key. ! // returns TLUA_NOTAG if the metatable of the object doesn't have a "tag" // key or it isn't a number. The tag is presumedly the index into the wxLuaReferences // registry table and denotes what type of object this is. --- 137,141 ---- WXDLLIMPEXP_WXLUA bool LUACALL wxlua_tpushusertag(lua_State* L, const void* u, int tag); // Get the numeric tag of the object at the stack index using the metatable's "tag" key. ! // returns TLUA_NOTAG if the metatable of the object doesn't have a "tag" // key or it isn't a number. The tag is presumedly the index into the wxLuaReferences // registry table and denotes what type of object this is. *************** *** 123,128 **** // in lua to NULL so that lua won't gc it. WXDLLIMPEXP_WXLUA void* LUACALL wxlua_ttouserdata(lua_State* L, int stack_idx, bool null_ptr = false); ! // Allocate a new table (metatable) with a "tag" key equal to the number from tinsert ! // and store it in the wxLuaReferences registry table. // Returns the index into the ref table, the "tag" from tinsert. WXDLLIMPEXP_WXLUA int LUACALL wxlua_tnewtag(lua_State* L); --- 144,149 ---- // in lua to NULL so that lua won't gc it. WXDLLIMPEXP_WXLUA void* LUACALL wxlua_ttouserdata(lua_State* L, int stack_idx, bool null_ptr = false); ! // Allocate a new table (metatable) with a "tag" key equal to the number from tinsert ! // and store it in the wxLuaReferences registry table. // Returns the index into the ref table, the "tag" from tinsert. WXDLLIMPEXP_WXLUA int LUACALL wxlua_tnewtag(lua_State* L); *************** *** 131,135 **** // registry table and return its index into the ref table. WXDLLIMPEXP_WXLUA int LUACALL wxlua_tnewweaktag(lua_State* L, bool weak_keys, bool weak_values); ! // Set the metatable of the object at top of stack to the table stored in the // wxLuaReferences registry table using tget(tag). WXDLLIMPEXP_WXLUA bool LUACALL wxlua_tsettag(lua_State* L, int tag); --- 152,156 ---- // registry table and return its index into the ref table. WXDLLIMPEXP_WXLUA int LUACALL wxlua_tnewweaktag(lua_State* L, bool weak_keys, bool weak_values); ! // Set the metatable of the object at top of stack to the table stored in the // wxLuaReferences registry table using tget(tag). WXDLLIMPEXP_WXLUA bool LUACALL wxlua_tsettag(lua_State* L, int tag); *************** *** 139,153 **** lua_CFunction func, void* pClass = NULL); ! // Push the "wxLuaReferences" string onto the stack. This is the name of a ! // table in the LUA_REGISTRYINDEX that is indexed on the "tags" and each item ! // is a metatable for classes or a reference to an object we want to keep a handle to. ! #define wxlua_pushstring_wxLuaReferences(L) lua_pushlstring(L, "wxLuaReferences", 15) ! ! // Push the "wxLuaClasses" string onto the stack. This is the name of a ! // table in the LUA_REGISTRYINDEX that is t[wxLuaBindClass.name] = wxLuaBindClass ! // where the wxLuaBindClass is a lightuserdata. ! #define wxlua_pushstring_wxLuaClasses(L) lua_pushlstring(L, "wxLuaClasses", 12) ! // Verify if the luatype = lua_type(L, stack_idx) is valid for the // wxluaarg_tag which is one of the predefined WXLUAARG_XXX or s_wxluaarg_XXX types. --- 160,176 ---- lua_CFunction func, void* pClass = NULL); ! // ---------------------------------------------------------------------------- ! // Functions to get info about the tags wxlua uses to determine type ! // ---------------------------------------------------------------------------- + // Get the wxLuaBindClass* for this class_tag or NULL if the tag is invalid + WXDLLIMPEXP_WXLUA const wxLuaBindClass* LUACALL wxlua_tgetclass(lua_State* L, int class_tag); + // Get the wxLuaBindClass* for this class_name or NULL if the name is invalid + WXDLLIMPEXP_WXLUA const wxLuaBindClass* LUACALL wxlua_tgetclass(lua_State* L, const char* class_name); + // Is a class with the class_tag equal to or derived from a class with the base_class_tag. + // 0 means same class, +1 means base is parent, +2 base is grandparent, ... + // returns -1 if the class_tag is not derived from the base class + WXDLLIMPEXP_WXLUA int LUACALL wxlua_isderivedclass(lua_State* L, int class_tag, int base_class_tag); + WXDLLIMPEXP_WXLUA int LUACALL wxlua_isderivedclass(const wxLuaBindClass* wxlClass, const wxLuaBindClass* wxlBaseClass); // Verify if the luatype = lua_type(L, stack_idx) is valid for the // wxluaarg_tag which is one of the predefined WXLUAARG_XXX or s_wxluaarg_XXX types. *************** *** 155,158 **** --- 178,183 ---- // Note that this function does not do a direct mapping between wxlua_getwxluatype() // and wxlua_getluatype() since it allows a small amount of coersion between types. + // It also doesn't account for the automatic conversion of certain lua types + // to wxluatypes, see wxLuaState::IswxLuaType which is more complete. WXDLLIMPEXP_WXLUA int LUACALL wxlua_iswxluatype(int luatype, int wxluaarg_tag); // Get a human readable name for the predefined WXLUAARG_XXX or s_wxluaarg_XXX tags. *************** *** 190,211 **** // wxlua_isstring/numbertype definitions of what is a string or number. - // Convert the table at stack index to a "new" array of wxStrings. - // Returns a pointer to the array of wxStrings (you need to delete them) - // and returns the number of strings in the array in count. - WXDLLIMPEXP_WXLUA wxString* LUACALL wxlua_getwxStringarray(lua_State* L, int stack_idx, int& count); - // Adds the table of number indexed strings at stack index to the wxArrayString - // Return the number of strings added to the array in count. - WXDLLIMPEXP_WXLUA int LUACALL wxlua_getwxArrayString(lua_State* L, int stack_idx, wxArrayString& strArray); // Convert the table at stack index to a "new" array of const char* strings. // Return a pointer to the array of strings (you need to delete them) // returns the number of character strings in the array in count. WXDLLIMPEXP_WXLUA const char** LUACALL wxlua_getchararray(lua_State* L, int stack_idx, int& count); - // Convert the table at stack index to a "new" array of int* numbers. - // Return a pointer to the array of ints (you need to delete them) - // returns the number of ints in the array in count. - WXDLLIMPEXP_WXLUA int* LUACALL wxlua_getintarray(lua_State* L, int stack_idx, int& count); - // Adds the table at stack index to the wxArrayInt - // Return the number of ints added to the array in count. - WXDLLIMPEXP_WXLUA int LUACALL wxlua_getwxArrayInt(lua_State* L, int stack_idx, wxArrayInt& intArray); // Creates a lua table and pushes the strings into it, returns the number of items added --- 215,222 ---- *************** *** 413,420 **** // Replacement for lua_pcall that sends a wxEVT_LUA_ERROR on error ! // narg is the number of args to the function to call ! // if clear then the function is void and no return values, ! // else nresults is LUA_MULTRET to leave all of them on the stack ! int LuaCall(int narg, int clear); int LuaDoString(const wxString &script, const wxString& name = wxEmptyString) { return RunString(script, name); } int LuaDoFile(const wxString &filename) { return RunFile(filename); } --- 424,431 ---- // Replacement for lua_pcall that sends a wxEVT_LUA_ERROR on error ! // narg is the number of args to the function to call. ! // nresults is the number of values returned which lua will adjust to match ! // use LUA_MULTRET for nresults to leave all of them on the stack ! int LuaPCall(int narg, int nresults); int LuaDoString(const wxString &script, const wxString& name = wxEmptyString) { return RunString(script, name); } int LuaDoFile(const wxString &filename) { return RunFile(filename); } *************** *** 499,506 **** // Get the first wxLuaBindClass that has this particular wxLuaBindCFunc in it's methods const wxLuaBindClass* GetLuaClass(const wxLuaBindCFunc* method_cfunc) const; ! // returns true if iClassTag is derived or equal to iBaseClassTag by using // wxLuaBindClass::class_tag and wxLuaBindClass::baseclass_tag. ! // returns NULL on failure. ! bool IsDerivedClass(int iClassTag, int iBaseClassTag) const; // Get wxLuaBindEvent for given wxEventType (wxEvent::GetEventType()) by finding // the matching wxLuaBindEvent::eventType. --- 510,518 ---- // Get the first wxLuaBindClass that has this particular wxLuaBindCFunc in it's methods const wxLuaBindClass* GetLuaClass(const wxLuaBindCFunc* method_cfunc) const; ! // returns >= 0 if iClassTag is derived from or equal to iBaseClassTag by using // wxLuaBindClass::class_tag and wxLuaBindClass::baseclass_tag. ! // 0 means same class, +1 means base is parent, +2 base is grandparent, ... ! // returns -1 if the class is not derived from the base class. ! int IsDerivedClass(int iClassTag, int iBaseClassTag) const; // Get wxLuaBindEvent for given wxEventType (wxEvent::GetEventType()) by finding // the matching wxLuaBindEvent::eventType. *************** *** 581,585 **** bool tpushusertag(const void *u, int tag); // Get the numeric tag of the object at the stack index using the metatable's "tag" key. ! // returns TLUA_NOTAG if the metatable of the object doesn't have a "tag" // key or it isn't a number. The tag is presumedly the index into the wxLuaReferences // registry table and denotes what type of object this is. --- 593,597 ---- bool tpushusertag(const void *u, int tag); // Get the numeric tag of the object at the stack index using the metatable's "tag" key. ! // returns TLUA_NOTAG if the metatable of the object doesn't have a "tag" // key or it isn't a number. The tag is presumedly the index into the wxLuaReferences // registry table and denotes what type of object this is. *************** *** 604,607 **** --- 616,625 ---- // wxLua get data type + // Verify if the luatype = lua_type(L, stack_idx) is valid for the + // wxluaarg_tag which is one of the predefined WXLUAARG_XXX or s_wxluaarg_XXX types. + // Returns 1 if it matches, 0 if it doesn't, -1 if the wxluaarg_tag is not known. + // Note that this function does not do a direct mapping between wxlua_getwxluatype() + // and wxlua_getluatype() since it allows a small amount of coersion between types. + int IswxLuaType(int luatype, int wxluaarg_tag) const; // Check if the item at the lua stack index is user data type tag bool IsUserDataType(int stack_idx, int tag) const; *************** *** 645,657 **** // Validate that the object at the stack index specified is a table object ! // Convert the table to an array of wxStrings. This assumes that each ! // numeric entry in the table is a string object or can be converted to a string ! // Return a pointer to the array of wxStrings and set the size in count. ! // the return value wiil need to be deleted. wxString* GetStringArray(int stack_idx, int &count); ! // convert a parameter which is presumably a table into a wxArrayString. // returns the number of values in the array. int GetwxArrayString(int stack_idx, wxArrayString &strArray); ! // convert a parameter which is presumably a table into a character pointer array. // returns the number of character strings in the array in count. // You must delete the return value if not NULL. --- 663,676 ---- // Validate that the object at the stack index specified is a table object ! // or a wxArrayString and convert it to an array of wxStrings. ! // If it's a table, this assumes that each numeric entry in the table is a ! // string object or can be converted to a string. ! // Returns a pointer to a new array of wxStrings and set the size in count. ! // the return value will need to be deleted. wxString* GetStringArray(int stack_idx, int &count); ! // Convert a parameter which is either an wxArrayString or a table into a wxArrayString. // returns the number of values in the array. int GetwxArrayString(int stack_idx, wxArrayString &strArray); ! // Convert a parameter which is presumably a table into a character pointer array. // returns the number of character strings in the array in count. // You must delete the return value if not NULL. *************** *** 659,665 **** // Validate that the object at the stack index specified is a table object ! // Convert the table to an array of ints. This assumes that each ! // numeric entry in the table is a numeric object or can be converted to a number ! // Return a pointer to the array of ints and set the size in count // You must delete the return value if not NULL. int* GetIntArray(int stack_idx, int &count); --- 678,685 ---- // Validate that the object at the stack index specified is a table object ! // or a wxArrayInt and convert it to an array of ints. ! // If it's a table, this assumes that each numeric entry in the table is a ! // numeric object or can be converted to a number ! // Returns a pointer to a new array of ints and set the size in count // You must delete the return value if not NULL. int* GetIntArray(int stack_idx, int &count); *************** *** 680,700 **** wxString GetLuaTagName(int tag) const; ! // Lookup a lua method or get property called cpIndex in the wxLuaBindClass array pClass ! // Ensure that the lookup is of the required type. If the lua method ! // can not be found on the current class recurse through base classes ! // Return a pointer to the wxLuaBindMethod that corresponds to the method name, ! // else return NULL; ! wxLuaBindMethod* GetLuaMethod(const wxLuaBindClass *wxlClass, const char *methodName, bool search_baseclasses = true); ! // Lookup a lua property function named cpIndex in the wxLuaBindClass pClass ! // Ensure that the lookup is of the required type. If the lua property ! // can not be found on the current class recurse through base classes ! // Return a pointer to the wxLuaBindMethod that corresponds to the property name, ! // else return NULL; ! // Find 'Set' properties if isLuaSetProp else return 'WXLUAMETHOD_GETPROP' property ! wxLuaBindMethod* GetLuaProperty(const wxLuaBindClass *wxlClass, const char *propName, bool isLuaSetProp); // Is there a derived method given an object and and a method name. ! // If push_method then push the method onto the stack ! bool HasDerivedMethod(void *pObject, const char *method, bool push_method) const; // Find a derived method given an object and and a method name. // If the method can be found, return the wxLuaState it belongs to. --- 700,718 ---- wxString GetLuaTagName(int tag) const; ! // ----------------------------------------------------------------------- + // Add this derived method, a lua function or value the user has set to a + // wxLua userdata object that we will push onto the stack when they access + // the index of the object with the "method_name". The pObject is the + // userdata and the new wxLuaObject wraps the lua function or value + // which will be deleted by this. + bool SetDerivedMethod(void *pObject, const char *method_name, wxLuaObject* wxlObj); // Is there a derived method given an object and and a method name. ! // If push_method then push the method onto the stack. ! // A derived method is when a function or value is set to a wxLua userdata. ! bool HasDerivedMethod(void *pObject, const char *method_name, bool push_method) const; ! // When an object is being garbage collected and we call RemoveTrackedObject ! // object on it, we should also remove any derived functions or values it may have ! bool RemoveDerivedMethod(void *pObject) const; // Find a derived method given an object and and a method name. // If the method can be found, return the wxLuaState it belongs to. |
From: John L. <jr...@us...> - 2007-06-11 03:58:15
|
Update of /cvsroot/wxlua/wxLua/modules/wxluasocket/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv19140/wxLua/modules/wxluasocket/src Modified Files: wxldserv.cpp wxlsock.cpp Log Message: Remove wxArrayString_FromLuaTable and wxArrayInt_FromLuaTable binding tag since we convert from wxArrayInt/String automatically Fix listctrl sorting Fix validator code using wxLuaObject Rename wxLuaState::LuaCall to LuaPCall since that what it calls Lots more cleanup and shuffling of code to more appropriate places Index: wxldserv.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxldserv.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** wxldserv.cpp 6 Jun 2007 23:43:17 -0000 1.43 --- wxldserv.cpp 11 Jun 2007 03:58:10 -0000 1.44 *************** *** 40,47 **** DEFINE_EVENT_TYPE(wxEVT_WXLUA_DEBUGGER_TABLE_ENUM) DEFINE_EVENT_TYPE(wxEVT_WXLUA_DEBUGGER_EVALUATE_EXPR) ! DEFINE_EVENT_TYPE(wxEVT_WXLUA_DEBUGGER_STARTDEBUGGER) ! DEFINE_EVENT_TYPE(wxEVT_WXLUA_DEBUGGER_STOPDEBUGGER) ! DEFINE_EVENT_TYPE(wxEVT_WXLUA_DEBUGGER_BREAKPOINT_ADDED) ! DEFINE_EVENT_TYPE(wxEVT_WXLUA_DEBUGGER_BREAKPOINT_REMOVED) IMPLEMENT_DYNAMIC_CLASS(wxLuaDebuggerEvent, wxEvent) --- 40,45 ---- DEFINE_EVENT_TYPE(wxEVT_WXLUA_DEBUGGER_TABLE_ENUM) DEFINE_EVENT_TYPE(wxEVT_WXLUA_DEBUGGER_EVALUATE_EXPR) ! //DEFINE_EVENT_TYPE(wxEVT_WXLUA_DEBUGGER_STARTDEBUGGER) ! //DEFINE_EVENT_TYPE(wxEVT_WXLUA_DEBUGGER_STOPDEBUGGER) IMPLEMENT_DYNAMIC_CLASS(wxLuaDebuggerEvent, wxEvent) *************** *** 501,540 **** break; } - case wxLUASOCKET_DEBUGGEE_EVENT_BREAKPOINT_ADDED: - { - wxString fileName; - wxInt32 line = 0; - wxInt32 enabled = 0; - - if (CheckSocketRead( - GetSocketBase()->ReadString(fileName) && - GetSocketBase()->ReadInt32(line) && - GetSocketBase()->ReadInt32(enabled), - wxT("Debugger wxLUASOCKET_DEBUGGEE_EVENT_BREAKPOINT_ADDED"))) - { - wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_BREAKPOINT_ADDED, this, line, fileName, enabled ? true : false); - SendEvent(debugEvent); - } - else return -1; - - break; - } - case wxLUASOCKET_DEBUGGEE_EVENT_BREAKPOINT_REMOVED: - { - wxString fileName; - wxInt32 line = 0; - - if (CheckSocketRead( - GetSocketBase()->ReadString(fileName) && - GetSocketBase()->ReadInt32(line), - wxT("Debugger wxLUASOCKET_DEBUGGEE_EVENT_BREAKPOINT_REMOVED"))) - { - wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_BREAKPOINT_REMOVED, this, line, fileName); - SendEvent(debugEvent); - } - else return -1; - - break; - } default : return -1; // don't know this event? } --- 499,502 ---- *************** *** 779,783 **** if (acceptedSocket != NULL) ! { if (!acceptedSocket->Shutdown(SD_BOTH)) { --- 741,745 ---- if (acceptedSocket != NULL) ! { if (!acceptedSocket->Shutdown(SD_BOTH)) { Index: wxlsock.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxlsock.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** wxlsock.cpp 31 May 2007 17:18:55 -0000 1.28 --- wxlsock.cpp 11 Jun 2007 03:58:10 -0000 1.29 *************** *** 43,48 **** "wxLUASOCKET_DEBUGGEE_EVENT_TABLE_ENUM", "wxLUASOCKET_DEBUGGEE_EVENT_EVALUATE_EXPR", - "wxLUASOCKET_DEBUGGEE_EVENT_BREAKPOINT_ADDED", - "wxLUASOCKET_DEBUGGEE_EVENT_BREAKPOINT_REMOVED" }; --- 43,46 ---- *************** *** 72,76 **** if (val <= 0) return wxString::Format(wxT("INVALID SOCKET CMD/EVENT (%d), SOCKET ERROR?"), val); ! if ((val >= wxLUASOCKET_DEBUGGEE_EVENT_BREAK) && (val <= wxLUASOCKET_DEBUGGEE_EVENT_BREAKPOINT_REMOVED)) return lua2wx(s_wxlsocket_event[val]); --- 70,74 ---- if (val <= 0) return wxString::Format(wxT("INVALID SOCKET CMD/EVENT (%d), SOCKET ERROR?"), val); ! if ((val >= wxLUASOCKET_DEBUGGEE_EVENT_BREAK) && (val <= wxLUASOCKET_DEBUGGEE_EVENT__COUNT)) return lua2wx(s_wxlsocket_event[val]); |
From: John L. <jr...@us...> - 2007-06-08 22:50:48
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv18758/wxLua/modules/wxbind/src Modified Files: wx_bind.cpp Log Message: Add some functions to compare the wxlua tags type to lua_type() within lua also get the tag number for any object in lua Cleanup the bindings.wx.lua to make it more useful Index: wx_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wx_bind.cpp,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** wx_bind.cpp 8 Jun 2007 01:36:29 -0000 1.98 --- wx_bind.cpp 8 Jun 2007 22:50:09 -0000 1.99 *************** *** 570,573 **** --- 570,581 ---- { "WXK_TAB", WXK_TAB }, { "WXK_UP", WXK_UP }, + { "WXLUAMETHOD_CFUNCTION", WXLUAMETHOD_CFUNCTION }, + { "WXLUAMETHOD_CONSTRUCTOR", WXLUAMETHOD_CONSTRUCTOR }, + { "WXLUAMETHOD_GETPROP", WXLUAMETHOD_GETPROP }, + { "WXLUAMETHOD_METHOD", WXLUAMETHOD_METHOD }, + { "WXLUAMETHOD_OVERLOAD", WXLUAMETHOD_OVERLOAD }, + { "WXLUAMETHOD_OVERLOAD_BASE", WXLUAMETHOD_OVERLOAD_BASE }, + { "WXLUAMETHOD_SETPROP", WXLUAMETHOD_SETPROP }, + { "WXLUAMETHOD_STATIC", WXLUAMETHOD_STATIC }, #if wxLUA_USE_wxGLCanvas && wxUSE_GLCANVAS *************** *** 6199,6202 **** --- 6207,6270 ---- static wxLuaBindCFunc s_wxluafunc_wxLua_function_wxYield[1] = {{ wxLua_function_wxYield, WXLUAMETHOD_CFUNCTION, 0, 0, s_wxluaargArray_None }}; + static wxLuaArgTag s_wxluatagArray_wxLua_function_wxlua_iswxluatype[] = { &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; + // %function int wxlua_iswxluatype(int luatype, int wxluaarg_tag) + static int LUACALL wxLua_function_wxlua_iswxluatype(lua_State *L) + { + int returns; + // int wxluaarg_tag + int wxluaarg_tag = (int)wxlua_getnumbertype(L, 2); + // int luatype + int luatype = (int)wxlua_getnumbertype(L, 1); + // call wxlua_iswxluatype + returns = wxlua_iswxluatype(luatype, wxluaarg_tag); + // push the result number + lua_pushnumber(L, returns); + + return 1; + } + static wxLuaBindCFunc s_wxluafunc_wxLua_function_wxlua_iswxluatype[1] = {{ wxLua_function_wxlua_iswxluatype, WXLUAMETHOD_CFUNCTION, 2, 2, s_wxluatagArray_wxLua_function_wxlua_iswxluatype }}; + + static wxLuaArgTag s_wxluatagArray_wxLua_function_wxlua_type[] = { &s_wxluaarg_LightUserData, NULL }; + // %override wxLua_function_wxlua_type + // %function int wxlua_wxluatype(int wxluaarg_tag) + static int LUACALL wxLua_function_wxlua_type(lua_State *L) + { + wxLuaState wxlState(L); + wxString returns; + // int wxluaarg_tag + int wxluaarg_tag = wxlua_ttag(L, 1); + if (wxluaarg_tag == TLUA_NOTAG) + { + int ltype = lua_type(L, 1); + wxluaarg_tag = wxlua_getwxluatype(ltype); + } + + // push the result number + lua_pushnumber(L, wxluaarg_tag); + + return 1; + } + + static wxLuaBindCFunc s_wxluafunc_wxLua_function_wxlua_type[1] = {{ wxLua_function_wxlua_type, WXLUAMETHOD_CFUNCTION, 1, 1, s_wxluatagArray_wxLua_function_wxlua_type }}; + + static wxLuaArgTag s_wxluatagArray_wxLua_function_wxlua_typename[] = { &s_wxluaarg_Number, NULL }; + // %override wxLua_function_wxlua_typename + // %function wxString wxlua_getwxluatypename(int wxluaarg_tag) + static int LUACALL wxLua_function_wxlua_typename(lua_State *L) + { + wxLuaState wxlState(L); + wxString returns; + // int wxluaarg_tag + int wxluaarg_tag = (int)wxlua_getnumbertype(L, 1); + // call wxlua_getwxluatypename + returns = wxlState.GetLuaTagName(wxluaarg_tag); //wxlua_getwxluatypename(wxluaarg_tag); + // push the result string + wxlState.lua_PushString(returns); + + return 1; + } + + static wxLuaBindCFunc s_wxluafunc_wxLua_function_wxlua_typename[1] = {{ wxLua_function_wxlua_typename, WXLUAMETHOD_CFUNCTION, 1, 1, s_wxluatagArray_wxLua_function_wxlua_typename }}; + // --------------------------------------------------------------------------- // wxLuaGetFunctionList_wx() is called to register global functions *************** *** 6484,6487 **** --- 6552,6558 ---- { "wxWakeUpIdle", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_wxWakeUpIdle, 1, NULL }, { "wxYield", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_wxYield, 1, NULL }, + { "wxlua_iswxluatype", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_wxlua_iswxluatype, 1, NULL }, + { "wxlua_type", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_wxlua_type, 1, NULL }, + { "wxlua_typename", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_wxlua_typename, 1, NULL }, { 0, 0, 0, 0 }, |
From: John L. <jr...@us...> - 2007-06-08 22:50:44
|
Update of /cvsroot/wxlua/wxLua/bindings/wxwidgets In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv18758/wxLua/bindings/wxwidgets Modified Files: override.hpp wx_datatypes.lua wxlua.i Log Message: Add some functions to compare the wxlua tags type to lua_type() within lua also get the tag number for any object in lua Cleanup the bindings.wx.lua to make it more useful Index: wx_datatypes.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wx_datatypes.lua,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** wx_datatypes.lua 8 Jun 2007 01:36:22 -0000 1.63 --- wx_datatypes.lua 8 Jun 2007 22:50:08 -0000 1.64 *************** *** 2087,2090 **** --- 2087,2095 ---- Name = "wxLuaHtmlWindow", }, + wxLuaMethod_Type = { + DefType = "enum", + IsNumber = true, + Name = "wxLuaMethod_Type", + }, wxLuaObject = { BaseClass = "wxObject", Index: wxlua.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxlua.i,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** wxlua.i 31 May 2007 17:18:47 -0000 1.21 --- wxlua.i 8 Jun 2007 22:50:09 -0000 1.22 *************** *** 13,16 **** --- 13,126 ---- %function int CompileLuaScript(const wxString& luaScript, const wxString& fileName) + + %enum wxLuaMethod_Type // The type of a Lua method + WXLUAMETHOD_CONSTRUCTOR // constructor + WXLUAMETHOD_METHOD // class member function + WXLUAMETHOD_CFUNCTION // global C function (not part of a class) + WXLUAMETHOD_GETPROP // Get %property funcName, read + WXLUAMETHOD_SETPROP // Set %property funcName, write + + WXLUAMETHOD_STATIC // Class member function is static + WXLUAMETHOD_OVERLOAD // This is an overload function that will call others + // and the min/maxargs for it are not valid, + // but are the min and max of all functions + + WXLUAMETHOD_OVERLOAD_BASE // Class method has been checked to see if it is + // overloaded from the base class. + // Check WXLUAMETHOD::basemethod and if !NULL + // this method is an overload from the base class + %endenum + + %function int wxlua_iswxluatype(int luatype, int wxluaarg_tag) + + // %override wxString wxlua_typename(int wxluaarg_tag) + // C++ Func: wxString wxlua_getwxluatypename(int wxluaarg_tag) + // Returns the tag name for both the predefined (negative) as well as the + // binding class tags. (C function only does predefined tags) + %function wxString wxlua_typename(int wxluaarg_tag) + + + // %override int wxlua_type(void* object) + // Get the wxlua type (tag) of the object, this is the arg tags number + %function int wxlua_type(void* object) + + //----------------------------------------------------------------------------- + // wxLuaBinding - This is NOT wrapped, but implemented in wxlbind.cpp + + // These items follow the structure below and ALL items are called as if they + // were table members. + // Example : wxLuaBinding_wx.GetClassCount + // Example : print(wxLuaBinding_wx.GetClassArray[1].methods[1].name) + // Note: Use only '.' and NO () to make it a function call, also check to see + // if the item exists first! + + /* + + %class wxLuaBinding_XXX - where XXX is the name of the binding + // No constructor as this is read only + + wxString GetBindingName + wxString GetLuaNamespace + + int GetClassCount + int GetDefineCount + int GetStringCount + int GetEventCount + int GetObjectCount + int GetFunctionCount + + {wxLuaBindClass*} GetClassArray + {wxLuaBindMethod*} GetFunctionArray + {name, value} GetDefineArray + {name, value} GetStringArray + {name, eventType, class_tag} GetEventArray + {name, object, class_tag} GetObjectArray + + %endclass + + %class wxLuaBindClass + // No constructor as this is read only + + wxString name + {wxLuaBindMethod*} methods + int methods_n + wxClassInfo* classInfo + int class_tag + wxString baseclassName + wxLuaBindClass* baseclass + {name, value} enums + int enums_n + + %endclass + + %class wxLuaBindMethod + // No constructor as this is read only + + wxString name + int type + {wxLuaBindCFunc*} funcs + int funcs_n + wxLuaBindMethod* basemethod + + wxString class_name // added, not in struct + + %endclass + + %class wxLuaBindCFunc + // No constructor as this is read only + + cfunction func + int type + int minargs + int maxargs + {int} argtags + + wxString class_name // added, not in struct + + %endclass + + */ + + //----------------------------------------------------------------------------- // wxLuaState *************** *** 19,22 **** --- 129,153 ---- %class %delete wxLuaState, wxObject + /* + wxLuaState(bool create = false) + wxLuaState(wxEvtHandler *handler, wxWindowID id = wxID_ANY) + + bool Ok() const + void Destroy() + bool CloseLuaState(bool force) + bool IsClosing() const + wxEventType GetInEventType() const + void SetEventHandler(wxEvtHandler *evtHandler) + wxEvtHandler *GetEventHandler() const + void SetId(wxWindowID id) + wxWindowID GetId() const + void SendEvent( wxLuaEvent &event ) const + + int RunFile(const wxString &fileName) + int RunString(const wxString &script, const wxString& name = "") + bool IsRunning() const + + wxString GetLuaTagName(int tag) const + */ %endclass Index: override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/override.hpp,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** override.hpp 8 Jun 2007 03:40:50 -0000 1.71 --- override.hpp 8 Jun 2007 22:50:08 -0000 1.72 *************** *** 4349,4352 **** --- 4349,4390 ---- %end + %override wxLua_function_wxlua_typename + // %function wxString wxlua_getwxluatypename(int wxluaarg_tag) + static int LUACALL wxLua_function_wxlua_typename(lua_State *L) + { + wxLuaState wxlState(L); + wxString returns; + // int wxluaarg_tag + int wxluaarg_tag = (int)wxlua_getnumbertype(L, 1); + // call wxlua_getwxluatypename + returns = wxlState.GetLuaTagName(wxluaarg_tag); //wxlua_getwxluatypename(wxluaarg_tag); + // push the result string + wxlState.lua_PushString(returns); + + return 1; + } + %end + + %override wxLua_function_wxlua_type + // %function int wxlua_wxluatype(int wxluaarg_tag) + static int LUACALL wxLua_function_wxlua_type(lua_State *L) + { + wxLuaState wxlState(L); + wxString returns; + // int wxluaarg_tag + int wxluaarg_tag = wxlua_ttag(L, 1); + if (wxluaarg_tag == TLUA_NOTAG) + { + int ltype = lua_type(L, 1); + wxluaarg_tag = wxlua_getwxluatype(ltype); + } + + // push the result number + lua_pushnumber(L, wxluaarg_tag); + + return 1; + } + %end + %override wxLua_wxLuaObject_constructor // wxLuaObject(void *object) |
From: John L. <jr...@us...> - 2007-06-08 22:50:40
|
Update of /cvsroot/wxlua/wxLua/bindings/wxstc In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv18758/wxLua/bindings/wxstc Modified Files: wxstc_datatypes.lua Log Message: Add some functions to compare the wxlua tags type to lua_type() within lua also get the tag number for any object in lua Cleanup the bindings.wx.lua to make it more useful Index: wxstc_datatypes.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxstc/wxstc_datatypes.lua,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** wxstc_datatypes.lua 8 Jun 2007 01:36:22 -0000 1.53 --- wxstc_datatypes.lua 8 Jun 2007 22:50:06 -0000 1.54 *************** *** 2087,2090 **** --- 2087,2095 ---- Name = "wxLuaHtmlWindow", }, + wxLuaMethod_Type = { + DefType = "enum", + IsNumber = true, + Name = "wxLuaMethod_Type", + }, wxLuaObject = { BaseClass = "wxObject", |
From: John L. <jr...@us...> - 2007-06-08 22:50:25
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv18758/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlstate.cpp Log Message: Add some functions to compare the wxlua tags type to lua_type() within lua also get the tag number for any object in lua Cleanup the bindings.wx.lua to make it more useful Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** wxlstate.cpp 8 Jun 2007 03:40:51 -0000 1.104 --- wxlstate.cpp 8 Jun 2007 22:50:17 -0000 1.105 *************** *** 40,46 **** #include "wx/tokenzr.h" - extern int wxLuaEventListCompareFn(const void *p1, const void *p2); // wxlbind.cpp - extern int wxLuaClassListCompareByTag(const void *p1, const void *p2); // wxlbind.cpp - wxLuaState wxNullLuaState(false); --- 40,43 ---- *************** *** 329,334 **** } ! void LUACALL wxlua_tpushusertag(lua_State *L, const void *u, int tag) { const void **ptr = (const void **)lua_newuserdata(L, sizeof(void *)); if (ptr != NULL) --- 326,332 ---- } ! bool LUACALL wxlua_tpushusertag(lua_State *L, const void *u, int tag) { + // Wrap the void* pointer in a newuserdata const void **ptr = (const void **)lua_newuserdata(L, sizeof(void *)); if (ptr != NULL) *************** *** 338,347 **** --- 336,350 ---- if (wxlua_tget(L, tag)) { + // pop the table and set it as the metatable for the newuserdata if (lua_setmetatable(L, -2) == 0) wxlua_terror(L, "wxLua: Unable to set metatable"); + else + return true; } } else wxlua_terror(L, "wxLua: Out of memory"); + + return false; } *************** *** 362,366 **** } ! void * LUACALL wxlua_ttouserdata(lua_State *L, int stack_idx, bool null_ptr /* = false*/) { void *pdata = NULL; --- 365,369 ---- } ! void* LUACALL wxlua_ttouserdata(lua_State *L, int stack_idx, bool null_ptr /* = false*/) { void *pdata = NULL; *************** *** 369,373 **** if (ptr != NULL) { ! pdata = *ptr; if (null_ptr) *ptr = NULL; --- 372,376 ---- if (ptr != NULL) { ! pdata = *ptr; // get the pointer the userdata holds if (null_ptr) *ptr = NULL; *************** *** 429,449 **** } ! void LUACALL wxlua_tsettag(lua_State *L, int tag) { ! if (wxlua_tget(L, tag)) { ! if (!lua_setmetatable(L, -2)) wxlua_terror(L, "wxLua: Unable to set metatable"); } } ! bool LUACALL wxlua_tsettagmethod(lua_State *L, int tag, const char *method, lua_CFunction func, void *pClass /* = NULL*/) { ! if (wxlua_tget(L, tag)) ! { if (pClass != NULL) { ! lua_pushstring(L, method); // push method name lua_pushlightuserdata(L, pClass); // push the userdata lua_pushcclosure(L, func, 1); // push func with pClass as upvalue --- 432,456 ---- } ! bool LUACALL wxlua_tsettag(lua_State *L, int tag) { ! if (wxlua_tget(L, tag)) // get the table from the wxLuaReferences registry table { ! if (!lua_setmetatable(L, -2)) // set it as the metatable of the object at the top of the stack wxlua_terror(L, "wxLua: Unable to set metatable"); + else + return true; } + + return false; } ! bool LUACALL wxlua_tsettagmethod(lua_State *L, int tag, const char *method_name, lua_CFunction func, void *pClass /* = NULL*/) { ! if (wxlua_tget(L, tag)) // get the metatable for the object from the ! { // wxLuaReferences registy table if (pClass != NULL) { ! lua_pushstring(L, method_name); // push method name lua_pushlightuserdata(L, pClass); // push the userdata lua_pushcclosure(L, func, 1); // push func with pClass as upvalue *************** *** 451,458 **** else { ! lua_pushstring(L, method); lua_pushcclosure(L, func, 0); } ! lua_rawset(L, -3); // t["method"] = func lua_pop(L, 1); // pop the table from tget we got from the wxLuaReferences registry table return true; --- 458,466 ---- else { ! lua_pushstring(L, method_name); lua_pushcclosure(L, func, 0); } ! ! lua_rawset(L, -3); // t["method_name"] = func lua_pop(L, 1); // pop the table from tget we got from the wxLuaReferences registry table return true; *************** *** 534,537 **** --- 542,585 ---- } + int wxlua_getwxluatype(int luatype) + { + switch (luatype) + { + case LUA_TNONE : return WXLUAARG_None; + case LUA_TNIL : return WXLUAARG_Nil; + case LUA_TBOOLEAN : return WXLUAARG_Boolean; + case LUA_TLIGHTUSERDATA : return WXLUAARG_LightUserData; + case LUA_TNUMBER : return WXLUAARG_Number; + case LUA_TSTRING : return WXLUAARG_String; + case LUA_TTABLE : return WXLUAARG_LuaTable; + case LUA_TFUNCTION : return WXLUAARG_LuaFunction; + case LUA_TUSERDATA : return WXLUAARG_UserData; + case LUA_TTHREAD : return WXLUAARG_LuaThread; + //case LUA_T??? : return WXLUAARG_Enum; + } + + return -1; + } + + int wxlua_getluatype(int wxluaarg_tag) + { + switch (wxluaarg_tag) + { + case WXLUAARG_None : return LUA_TNONE; + case WXLUAARG_Nil : return LUA_TNIL; + case WXLUAARG_Boolean : return LUA_TBOOLEAN; + case WXLUAARG_LightUserData : return LUA_TLIGHTUSERDATA; + case WXLUAARG_Number : return LUA_TNUMBER; + case WXLUAARG_String : return LUA_TSTRING; + case WXLUAARG_LuaTable : return LUA_TTABLE; + case WXLUAARG_LuaFunction : return LUA_TFUNCTION; + case WXLUAARG_UserData : return LUA_TUSERDATA; + case WXLUAARG_LuaThread : return LUA_TTHREAD; + case WXLUAARG_Enum : return LUA_TNUMBER; + } + + return -1; + } + const char* LUACALL wxlua_getstringtype(lua_State *L, int stack_idx) { *************** *** 1726,1738 **** { wxLuaBinding* binding = node->GetData(); ! ! wxLuaBindClass* pClass = (wxLuaBindClass *)binding->GetClassArray(); size_t i, class_count = binding->GetClassCount(); ! for (i = 0; i < class_count; i++) { ! wxLuaBindClass* pLuaClass = pClass + i; ! // pLuaClass->baseclass = NULL; FIXME ! if (pLuaClass->baseclassName) { wxLuaBindingList::compatibility_iterator basenode; --- 1774,1785 ---- { wxLuaBinding* binding = node->GetData(); ! wxLuaBindClass* wxlClass = binding->GetClassArray(); size_t i, class_count = binding->GetClassCount(); ! ! for (i = 0; i < class_count; ++i, ++wxlClass) { ! // wxlClass->baseclass = NULL; FIXME ! if (wxlClass->baseclassName) // does it have a name { wxLuaBindingList::compatibility_iterator basenode; *************** *** 1742,1746 **** // found base class in binding? ! if (basebinding->SetBaseClass(pLuaClass)) break; } --- 1789,1793 ---- // found base class in binding? ! if (basebinding->SetBaseClass(wxlClass)) break; } *************** *** 1776,1780 **** } ! const wxLuaBindClass* wxLuaState::GetLuaClass(int iClassTag) const { wxCHECK_MSG(GetRefData() != NULL, NULL, wxT("Invalid wxLuaState")); --- 1823,1827 ---- } ! const wxLuaBindClass* wxLuaState::GetLuaClass(int class_tag) const { wxCHECK_MSG(GetRefData() != NULL, NULL, wxT("Invalid wxLuaState")); *************** *** 1782,1788 **** lua_State* L = M_WXLSTATEDATA->m_lua_State; ! if (wxlua_tget(L, iClassTag) && lua_istable(L, -1)) { ! lua_pushstring(L, "wxLuaBindClass"); // t[iClassTag] = { __gc = wxLuaBindClass (or nil if not a class tag) lua_rawget(L, -2); const wxLuaBindClass* wxlClass = (wxLuaBindClass *)lua_touserdata(L, -1); // actually lightuserdata --- 1829,1835 ---- lua_State* L = M_WXLSTATEDATA->m_lua_State; ! if (wxlua_tget(L, class_tag) && lua_istable(L, -1)) { ! lua_pushstring(L, "wxLuaBindClass"); // t[class_tag] = { __gc = wxLuaBindClass (or nil if not a class tag) lua_rawget(L, -2); const wxLuaBindClass* wxlClass = (wxLuaBindClass *)lua_touserdata(L, -1); // actually lightuserdata *************** *** 1793,1821 **** } else - return NULL; - - - /* - wxLuaBindClass classItem; - classItem.class_tag = &iClassTag; - - wxLuaBindingList::compatibility_iterator node; - for (node = M_WXLSTATEDATA->m_wxlStateData->m_bindingList.GetFirst(); node; node = node->GetNext() ) { ! wxLuaBinding* binding = node->GetData(); ! ! // this relies on LUA allocating tags in ascending order of definition ! // if LUA stops doing this, then the search may break. ! const wxLuaBindClass *pLuaClass = (wxLuaBindClass *) bsearch(&classItem, ! binding->GetLuaClassList(), ! binding->GetLuaClassCount(), ! sizeof(wxLuaBindClass), ! wxLuaClassListCompareByTag); ! if (pLuaClass) ! return pLuaClass; } return NULL; - */ } --- 1840,1857 ---- } else { ! // we shouldn't ever need this code ! wxLuaBindingList::compatibility_iterator node; ! for (node = M_WXLSTATEDATA->m_wxlStateData->m_bindingList.GetFirst(); node; node = node->GetNext() ) ! { ! wxLuaBinding* binding = node->GetData(); ! const wxLuaBindClass *wxlClass = binding->GetLuaClass(class_tag); ! ! if (wxlClass) ! return wxlClass; ! } } return NULL; } *************** *** 2130,2137 **** } ! void wxLuaState::tpushusertag(const void *u, int tag) { ! wxCHECK_RET(Ok(), wxT("Invalid wxLuaState")); ! wxlua_tpushusertag(M_WXLSTATEDATA->m_lua_State, u, tag); } --- 2166,2173 ---- } ! bool wxLuaState::tpushusertag(const void *u, int tag) { ! wxCHECK_MSG(Ok(), false, wxT("Invalid wxLuaState")); ! return wxlua_tpushusertag(M_WXLSTATEDATA->m_lua_State, u, tag); } *************** *** 2160,2167 **** } ! void wxLuaState::tsettag(int tag) { ! wxCHECK_RET(Ok(), wxT("Invalid wxLuaState")); ! wxlua_tsettag(M_WXLSTATEDATA->m_lua_State, tag); } --- 2196,2203 ---- } ! bool wxLuaState::tsettag(int tag) { ! wxCHECK_MSG(Ok(), false, wxT("Invalid wxLuaState")); ! return wxlua_tsettag(M_WXLSTATEDATA->m_lua_State, tag); } Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** wxlbind.cpp 8 Jun 2007 03:40:51 -0000 1.67 --- wxlbind.cpp 8 Jun 2007 22:50:17 -0000 1.68 *************** *** 999,1002 **** --- 999,1019 ---- } + + const wxLuaBindClass* wxLuaBinding::GetLuaClass(int class_tag) const + { + wxLuaBindClass classItem; + classItem.class_tag = &class_tag; + + // this relies on LUA allocating tags in ascending order of definition + // if LUA stops doing this, then the search may break. + const wxLuaBindClass *wxlClass = (wxLuaBindClass *)bsearch(&classItem, + m_classArray, + m_classCount, + sizeof(wxLuaBindClass), + wxLuaClassListCompareByTag); + + return wxlClass; // maybe NULL if class_tag not found + } + const wxLuaBindClass* wxLuaBinding::GetLuaClass(const wxLuaBindMethod* wxlMethod) const { *************** *** 1057,1061 **** void **ptr = (void **)lua_touserdata(L, 1); wxLuaBindCFunc* wxlCFunc= (wxLuaBindCFunc*)*ptr; ! //wxLuaBinding *wxlBinding = (wxLuaBinding *)lua_touserdata(L, lua_upvalueindex(1)); int idx_type = lua_type(L, 2); --- 1074,1078 ---- void **ptr = (void **)lua_touserdata(L, 1); wxLuaBindCFunc* wxlCFunc= (wxLuaBindCFunc*)*ptr; ! wxLuaBinding *wxlBinding = (wxLuaBinding *)lua_touserdata(L, lua_upvalueindex(1)); int idx_type = lua_type(L, 2); *************** *** 1099,1118 **** return 1; } ! else if (strcmp(idx_str, "argtags_name") == 0) { ! size_t idx, count = wxlCFunc->maxargs; ! lua_createtable(L, count, 0); ! ! // check for terminating null argtag ! for (idx = 0; (idx < count) && wxlCFunc->argtags[idx]; ++idx) ! { ! lua_pushstring(L, wx2lua(wxlState.GetLuaTagName(*wxlCFunc->argtags[idx]))); ! lua_rawseti(L, -2, idx + 1); ! } ! return 1; } - - } --- 1116,1124 ---- return 1; } ! else if (strcmp(idx_str, "class_name") == 0) { ! lua_pushstring(L, wxlBinding->GetLuaClass(wxlCFunc)->name); return 1; } } *************** *** 1194,1197 **** --- 1200,1208 ---- return 0; } + else if (strcmp(idx_str, "class_name") == 0) + { + lua_pushstring(L, wxlBinding->GetLuaClass(wxlMethod)->name); + return 1; + } } *************** *** 1249,1252 **** --- 1260,1267 ---- } + lua_pushstring(L, "wxLuaBindClass"); // so we know where this came from + lua_pushvalue(L, 1); + lua_rawset(L, -3); + return 1; } *************** *** 1323,1326 **** --- 1338,1345 ---- } + lua_pushstring(L, "wxLuaBindClass"); // so we know where this came from + lua_pushvalue(L, 1); + lua_rawset(L, -3); + return 1; } *************** *** 1376,1379 **** --- 1395,1403 ---- return 1; } + else if (strcmp(idx_str, "GetStringCount") == 0) + { + lua_pushnumber(L, wxlBinding->GetStringCount()); + return 1; + } else if (strcmp(idx_str, "GetEventCount") == 0) { |
From: John L. <jr...@us...> - 2007-06-08 22:50:25
|
Update of /cvsroot/wxlua/wxLua/samples In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv18758/wxLua/samples Modified Files: bindings.wx.lua Log Message: Add some functions to compare the wxlua tags type to lua_type() within lua also get the tag number for any object in lua Cleanup the bindings.wx.lua to make it more useful Index: bindings.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/bindings.wx.lua,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** bindings.wx.lua 8 Jun 2007 01:36:32 -0000 1.1 --- bindings.wx.lua 8 Jun 2007 22:50:18 -0000 1.2 *************** *** 5,9 **** -- Modified by: -- Created: 5/7/2007 ! -- RCS-ID: -- Copyright: (c) John Labenski -- Licence: wxWidgets licence --- 5,9 ---- -- Modified by: -- Created: 5/7/2007 ! -- RCS-ID: -- Copyright: (c) John Labenski -- Licence: wxWidgets licence *************** *** 18,32 **** local lens = {} ! for i = 1, #keys do lens[i] = string.len(keys[i]) end ! ! for i = 1, #t do local u = t[i] for k = 1, #keys do local len = string.len(tostring(u[keys[k]])) ! if (len > lens[k]) then ! lens[k] = len end end --- 18,32 ---- local lens = {} ! for i = 1, #keys do lens[i] = string.len(keys[i]) end ! ! for i = 1, #t do local u = t[i] for k = 1, #keys do local len = string.len(tostring(u[keys[k]])) ! if (len > lens[k]) then ! lens[k] = len end end *************** *** 41,45 **** print(s) ! for i = 1, #t do local u = t[i] local s = "" --- 41,45 ---- print(s) ! for i = 1, #t do local u = t[i] local s = "" *************** *** 55,67 **** function DumpBindingInfo(binding) ! print("Binding Name : "..tostring(binding.GetBindingName)) ! print("Lua Namespace : "..tostring(binding.GetLuaNamespace)) ! ! print("Class Count : "..tostring(binding.GetClassCount)) ! print("Define Count : "..tostring(binding.GetDefineCount)) ! print("Event Count : "..tostring(binding.GetEventCount)) ! print("Object Count : "..tostring(binding.GetObjectCount)) ! print("Function Count : "..tostring(binding.GetFunctionCount)) if true then --- 55,67 ---- function DumpBindingInfo(binding) ! print("GetBindingName : "..tostring(binding.GetBindingName)) ! print("GetLuaNamespace : "..tostring(binding.GetLuaNamespace)) + print("GetClassCount : "..tostring(binding.GetClassCount)) + print("GetDefineCount : "..tostring(binding.GetDefineCount)) + print("GetStringCount : "..tostring(binding.GetStringCount)) + print("GetEventCount : "..tostring(binding.GetEventCount)) + print("GetObjectCount : "..tostring(binding.GetObjectCount)) + print("GetFunctionCount : "..tostring(binding.GetFunctionCount)) if true then *************** *** 100,104 **** ColumnDumpTable(binding.GetObjectArray, keys) end ! end --- 100,104 ---- ColumnDumpTable(binding.GetObjectArray, keys) end ! end *************** *** 108,184 **** -- ---------------------------------------------------------------------------- -- A wxLua program to view the bindings in a wxListCtrl -- ---------------------------------------------------------------------------- ! ID_LISTCTRL = 1000 ! listData = {} -- store the table currently displayed by the listCtrl ! list_level = 1 ! img_normal = 0 ! img_folder = 1 ! listColWidths = {} -- stored by "object_type" name function SaveListColWidths(level) ! if not listColWidths[listData[level].object_type] then ! listColWidths[listData[level].object_type] = {} end ! for col = 1, listCtrl:GetColumnCount() do ! listColWidths[listData[level].object_type][col] = listCtrl:GetColumnWidth(col-1) end end function GotoBindingLevel(listCtrl, level) listCtrl:DeleteAllItems() ! ! local lc_item = 0 ! for col = 1, listCtrl:GetColumnCount() do listCtrl:DeleteColumn(0) end ! ! for col = 1, #listData[level].cols do ! listCtrl:InsertColumn(col-1, listData[level].cols[col], wx.wxLIST_FORMAT_LEFT, -1) ! ! if listData[level].folder and listData[level].folder[col] then ! listCtrl:SetColumnImage(col-1, img_folder) end - end ! if listColWidths[listData[level].object_type] then ! for col = 1, #listColWidths[listData[level].object_type] do ! listCtrl:SetColumnWidth(col-1, listColWidths[listData[level].object_type][col]) end end ! ! for i = 1, #listData[level] do ! local d = listData[level][i] ! local info = wx.wxListItem() info:SetId(lc_item+1) info:SetText(tostring(d[1])) lc_item = listCtrl:InsertItem(info) ! info:SetId(lc_item) ! if (d[1] ~= "..") then ! for col = 2, #listData[level].cols do listCtrl:SetItem(lc_item, col-1, tostring(d[col])) end end end end function CreatewxLuaBindClass(tbl) local keys = { "name", "methods", "methods_n", "classInfo", "class_tag", "baseclassName", "baseclass", "enums", "enums_n" } local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindClass") ! -- these are expandable ! t.folder = {} ! t.folder[2] = true ! t.folder[7] = true ! t.folder[8] = true return t end --- 108,341 ---- -- ---------------------------------------------------------------------------- + -- ---------------------------------------------------------------------------- -- A wxLua program to view the bindings in a wxListCtrl -- ---------------------------------------------------------------------------- + -- ---------------------------------------------------------------------------- ! frame = nil ! listCtrl = nil ! ID_LISTCTRL = 1000 -- id of the listctrl ! img_normal = 0 -- a "file" image in the listctrl ! img_folder = 1 -- a "folder" image in the listctrl ! listColWidths = {} -- stored by "object_type" name + list_level = 1 -- where are we in the listData + listData = {} -- store the table currently displayed by the listCtrl + -- { {"col1", "col2", ... ["icon"] = img_normal, ["color"] = wx.wxBLUE }, + -- {"col1", "col2", ... The icon and color are optional }, + -- { ... }, + -- ["col_labels"] = { "col label 1", "col label 2", ...}, + -- ["col_icons"] = { nil, nil, img_folder,... }, -- the 3rd col has folder icon + -- ["object_type"] = "wxLuaBindClass", -- or something else readable + -- ["list_item"] = last selected list item or nil if not set + + -- ---------------------------------------------------------------------------- + -- Save the current listctrl settings into the listColWidths table + -- ---------------------------------------------------------------------------- function SaveListColWidths(level) ! local object_type = listData[level].object_type ! ! if not listColWidths[object_type] then ! listColWidths[object_type] = {} end ! for col = 1, listCtrl:GetColumnCount() do ! listColWidths[object_type][col] = listCtrl:GetColumnWidth(col-1) end end + -- ---------------------------------------------------------------------------- + -- Go to a binding level which already must exist in the listData table + -- ---------------------------------------------------------------------------- function GotoBindingLevel(listCtrl, level) + local data = listData[level] + + -- Do we calculate what widths to use for the cols or use previous values? + local auto_col_widths = false + if listColWidths[data.object_type] == nil then + auto_col_widths = true + listColWidths[data.object_type] = {} + end + + -- Wipe items and all cols and recreate them with appropriate names listCtrl:DeleteAllItems() ! for col = 1, listCtrl:GetColumnCount() do listCtrl:DeleteColumn(0) end ! ! -- Add the cols ! for col = 1, #data.col_labels do ! listCtrl:InsertColumn(col-1, data.col_labels[col], wx.wxLIST_FORMAT_LEFT, -1) ! ! if data.col_icons and data.col_icons[col] then ! listCtrl:SetColumnImage(col-1, data.col_icons[col]) end ! if auto_col_widths then ! local w = listCtrl:GetTextExtent(data.col_labels[col]) ! if data.col_icons and data.col_icons[col] then ! w = w + 20 ! end ! if w > (listColWidths[data.object_type][col] or 0) - 20 then ! listColWidths[data.object_type][col] = w + 20 ! end end end ! ! -- Add the items ! local lc_item = 0 ! ! for i = 1, #data do ! local d = data[i] ! local info = wx.wxListItem() info:SetId(lc_item+1) info:SetText(tostring(d[1])) + if (d.icon) then + info:SetImage(d.icon) + end + if (d.color) then + info:SetTextColour(d.color) + end lc_item = listCtrl:InsertItem(info) ! ! if auto_col_widths then ! local w = listCtrl:GetTextExtent(tostring(d[1])) ! if w > (listColWidths[data.object_type][1] or 0) - 25 then ! listColWidths[data.object_type][1] = w + 25 ! end ! end ! if (d[1] ~= "..") then ! for col = 2, #listData[level].col_labels do listCtrl:SetItem(lc_item, col-1, tostring(d[col])) + + if auto_col_widths then + local w = listCtrl:GetTextExtent(tostring(d[col])) + if w > (listColWidths[data.object_type][col] or 0) - 20 then + listColWidths[data.object_type][col] = w + 20 + end + end + end + else + if data.class_name then + listCtrl:SetItem(lc_item, 1, tostring(data.class_name)) end end end + + -- Set the column widths + if listColWidths[data.object_type] then + for col = 1, #listColWidths[data.object_type] do + listCtrl:SetColumnWidth(col-1, listColWidths[data.object_type][col]) + end + end + + -- Try to reselect the item if we're going up a level + if data.list_item and (data.list_item < listCtrl:GetItemCount()) then + listCtrl:SetItemState(data.list_item, wx.wxLIST_STATE_FOCUSED, wx.wxLIST_STATE_FOCUSED); + listCtrl:SetItemState(data.list_item, wx.wxLIST_STATE_SELECTED, wx.wxLIST_STATE_SELECTED); + listCtrl:EnsureVisible(data.list_item) + end + + -- Finally set the status text of where we are + local s = {} + for i = 1, level do + table.insert(s, listData[i].object_type) + end + frame:SetStatusText(table.concat(s, "->")) end + -- ---------------------------------------------------------------------------- + -- Convert the wxLuaMethod_Type enum into a readable string + -- ---------------------------------------------------------------------------- + function ConvertwxLuaMethod_Type(t_) + local s = {} + local t = t_ + if (t - wx.WXLUAMETHOD_OVERLOAD_BASE) >= 0 then + --table.insert(s, "OverloadBase") -- nobody should care about this + t = t - wx.WXLUAMETHOD_OVERLOAD_BASE + end + if (t - wx.WXLUAMETHOD_OVERLOAD) >= 0 then + table.insert(s, "Overload") + t = t - wx.WXLUAMETHOD_OVERLOAD + end + if (t - wx.WXLUAMETHOD_STATIC) >= 0 then + table.insert(s, "Static") + t = t - wx.WXLUAMETHOD_STATIC + end + if (t - wx.WXLUAMETHOD_SETPROP) >= 0 then + table.insert(s, "SetProp") + t = t - wx.WXLUAMETHOD_SETPROP + end + if (t - wx.WXLUAMETHOD_GETPROP) >= 0 then + table.insert(s, "GetProp") + t = t - wx.WXLUAMETHOD_GETPROP + end + if (t - wx.WXLUAMETHOD_CFUNCTION) >= 0 then + table.insert(s, "CFunc") + t = t - wx.WXLUAMETHOD_CFUNCTION + end + if (t - wx.WXLUAMETHOD_METHOD) >= 0 then + table.insert(s, "Method") + t = t - wx.WXLUAMETHOD_METHOD + end + if (t - wx.WXLUAMETHOD_CONSTRUCTOR) >= 0 then + table.insert(s, "Constructor") + t = t - wx.WXLUAMETHOD_CONSTRUCTOR + end + + assert(t == 0, "The wxLuaMethod_Type is not handled correctly "..tostring(t)) + + -- nobody should care about this and it's confusing + t = t_ + if (t - wx.WXLUAMETHOD_OVERLOAD_BASE) >= 0 then + t = t - wx.WXLUAMETHOD_OVERLOAD_BASE + end + + return string.format("0x%X (", t)..table.concat(s, ", ")..")" + end + + -- ---------------------------------------------------------------------------- + -- Create tables from the different binding structs type + -- ---------------------------------------------------------------------------- function CreatewxLuaBindClass(tbl) local keys = { "name", "methods", "methods_n", "classInfo", "class_tag", "baseclassName", "baseclass", "enums", "enums_n" } local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindClass") ! -- Convert the classinfo userdata into something more readable ! for i = 2, #t do ! if (type(t[i][2]) == "table") then ! t[i].icon = img_folder ! end ! ! local classInfo = t[i][4] ! if type(classInfo) == "userdata" then ! local s = classInfo:GetClassName() ! ! local b1 = classInfo:GetBaseClassName1() ! local b2 = classInfo:GetBaseClassName2() ! ! if (string.len(b1) > 0) then ! s = s.." ("..b1..")" ! end ! if (string.len(b2) > 0) then ! s = s.."("..b2..")" ! end ! ! t[i][4] = s ! end ! end ! ! -- these columns are expandable ! t.col_icons = {} ! t.col_icons[2] = img_folder ! t.col_icons[7] = img_folder ! t.col_icons[8] = img_folder return t end *************** *** 187,199 **** local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindMethod") ! -- these are expandable ! t.folder = {} ! t.folder[3] = true ! t.folder[5] = true return t end function CreatewxLuaBindDefine(tbl) local keys = { "name", "value" } ! return CreatewxLuaBindTable(tbl, keys, "wxLuaBindDefine") end function CreatewxLuaBindString(tbl) --- 344,392 ---- local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindMethod") ! -- we add in the cfuncs here so we don't have to click so much ! t.col_labels = { "name", "type", "funcs", "funcs_n", "basemethod", "minargs", "maxargs", "argtag_names", "argtags" } ! ! local i = 1 -- starts at 2 ! ! while (i < #t) do ! i = i + 1 ! ! t[i][2] = ConvertwxLuaMethod_Type(t[i][2]) ! ! if (type(t[i][3]) == "table") then ! local cfunc_t = CreatewxLuaBindCFunc(t[i][3]) ! t[i].color = wx.wxBLUE ! t[i][6] = "" ! t[i][7] = "" ! t[i][8] = "" ! t[i][9] = "" ! -- keys for CFunc = { "func", "type", "minargs", "maxargs", "argtag_names", "argtags" } ! for j = 2, #cfunc_t do ! table.insert(t, i+j-1, {"", cfunc_t[j][2], cfunc_t[j][1], "", "", cfunc_t[j][3], cfunc_t[j][4], cfunc_t[j][5], cfunc_t[j][6]}) ! end ! ! i = i + #cfunc_t - 1 -- skip over the newly added items ! end ! end ! ! -- these columns are expandable ! t.col_icons = {} ! t.col_icons[3] = img_folder ! t.col_icons[5] = img_folder return t end function CreatewxLuaBindDefine(tbl) local keys = { "name", "value" } ! local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindDefine") ! ! for i = 2, #t do ! -- these are often enums or flags, it's easier to see them as hex ! local n = tonumber(t[i][2]) ! if n > 0 then ! t[i][2] = t[i][2]..string.format(" (0x%X)", n) ! end ! end ! ! return t end function CreatewxLuaBindString(tbl) *************** *** 203,221 **** function CreatewxLuaBindEvent(tbl) local keys = { "name", "eventType", "class_tag" } ! return CreatewxLuaBindTable(tbl, keys, "wxLuaBindEvent") end function CreatewxLuaBindObject(tbl) local keys = { "name", "object", "class_tag" } ! return CreatewxLuaBindTable(tbl, keys, "wxLuaBindObject") end function CreatewxLuaBindCFunc(tbl) ! local keys = { "func", "type", "minargs", "maxargs", "argtags", "argtags_name" } local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindCFunc") ! for i = 2, #t do ! t[i][5] = table.concat(t[i][5], ", ") ! t[i][6] = table.concat(t[i][6], ", ") end ! return t end --- 396,440 ---- function CreatewxLuaBindEvent(tbl) local keys = { "name", "eventType", "class_tag" } ! local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindEvent") ! ! -- Add the tag name the event uses ! for i = 2, #t do ! t[i][3] = t[i][3].." ("..wx.wxlua_typename(t[i][3])..")" ! end ! ! return t end function CreatewxLuaBindObject(tbl) local keys = { "name", "object", "class_tag" } ! local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindObject") ! ! -- Add the tag name to the user data ! for i = 2, #t do ! t[i][3] = t[i][3].." ("..wx.wxlua_typename(t[i][3])..")" ! end ! ! return t end function CreatewxLuaBindCFunc(tbl) ! local keys = { "func", "type", "minargs", "maxargs", "argtags" } local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindCFunc") ! ! t.col_labels[5] ="argtags_names" -- swap these two ! t.col_labels[6] ="argtags" ! ! -- we don't want to show the table, just show the values and convert them to strings for i = 2, #t do ! local args = t[i][5] ! local arg_names = {} ! ! for j = 1, #args do ! table.insert(arg_names, wx.wxlua_typename(args[j])) ! end ! ! t[i][2] = ConvertwxLuaMethod_Type(t[i][2]) ! t[i][5] = table.concat(arg_names, ", ") -- swap these two ! t[i][6] = table.concat(args, ", ") end ! return t end *************** *** 223,228 **** function CreatewxLuaBindTable(tbl, keys, object_type) local t = { ! {".."}, ! ["cols"] = keys, ["object_type"] = object_type } --- 442,447 ---- function CreatewxLuaBindTable(tbl, keys, object_type) local t = { ! {"..", ["icon"] = img_folder}, ! ["col_labels"] = keys, ["object_type"] = object_type } *************** *** 236,240 **** table.insert(item, val) else ! table.insert(item, 0) end end --- 455,459 ---- table.insert(item, val) else ! table.insert(item, "") end end *************** *** 246,275 **** function main() ! frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, "wxLua Binding Browser") panel = wx.wxPanel(frame, wx.wxID_ANY) ! ! ! ! listCtrl = wx.wxListView(panel, ID_LISTCTRL, wx.wxDefaultPosition, wx.wxDefaultSize, wx.wxLC_REPORT + wx.wxLC_SINGLE_SEL + wx.wxLC_HRULES + wx.wxLC_VRULES) ! imageList = wx.wxImageList(16, 16, true) ! imageList:Add(wx.wxArtProvider.GetBitmap(wx.wxART_NORMAL_FILE, wx.wxART_MENU)) ! imageList:Add(wx.wxArtProvider.GetBitmap(wx.wxART_FILE_OPEN, wx.wxART_MENU)) listCtrl:SetImageList(imageList, wx.wxIMAGE_LIST_SMALL); ! listData[1] = { ! {"wx", "wxLuaBinding_wx"}, ! {"wx", "wxLuaBinding_wxstc"}, ! {"wx", "wxLuaBinding_wxluasocket"}, ! ["cols"] = { "Lua Namespace", "Binding userdata" }, ! ["object_type"] = "Root" } GotoBindingLevel(listCtrl, 1) ! ! listCtrl:Connect(wx.wxEVT_COMMAND_LIST_ITEM_ACTIVATED, function(event) local index = event:GetIndex() --- 465,536 ---- function main() ! frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, "wxLua Binding Browser") + + -- Create the menu bar + local fileMenu = wx.wxMenu() + fileMenu:Append(wx.wxID_EXIT, "E&xit", "Quit the program") + + local helpMenu = wx.wxMenu() + helpMenu:Append(wx.wxID_ABOUT, "&About", "About the wxLua Binding Application") + helpMenu:Append(wx.wxID_HELP, "&Help", "How to use the wxLua Binding Application") + + local menuBar = wx.wxMenuBar() + menuBar:Append(fileMenu, "&File") + menuBar:Append(helpMenu, "&Help") + frame:SetMenuBar(menuBar) + + frame:Connect(wx.wxID_EXIT, wx.wxEVT_COMMAND_MENU_SELECTED, + function (event) frame:Close(true) end ) + + -- connect the selection event of the about menu item + frame:Connect(wx.wxID_ABOUT, wx.wxEVT_COMMAND_MENU_SELECTED, + function (event) + wx.wxMessageBox('This is the "About" dialog of the Bindings wxLua sample.\n'.. + "You can view the C++ bindings by navigating the wxListCtrl.\n".. + wx.wxLUA_VERSION_STRING.." built with "..wx.wxVERSION_STRING, + "About wxLua Bindings", + wx.wxOK + wx.wxICON_INFORMATION, + frame) + end ) + frame:Connect(wx.wxID_HELP, wx.wxEVT_COMMAND_MENU_SELECTED, + function (event) + wx.wxMessageBox("Select the C++ bindings to view and then you can see the items that\n".. + "have been wrapped. You can expand items that have a folder icon \n".. + " in the column header by double clicking on the item's column. \n".. + "Use the '..' to go up a level.\n\n".. + "This data is from the structs declared in \n".. + "wxLua/modules/wxlua/include/wxlbind.h.", + "Help on wxLua Bindings", + wx.wxOK + wx.wxICON_INFORMATION, + frame) + end ) + + + frame:CreateStatusBar(1) + frame:SetStatusText("Welcome to wxLua.") + + -- Create the windows panel = wx.wxPanel(frame, wx.wxID_ANY) ! listCtrl = wx.wxListView(panel, ID_LISTCTRL, wx.wxDefaultPosition, wx.wxDefaultSize, wx.wxLC_REPORT + wx.wxLC_SINGLE_SEL + wx.wxLC_HRULES + wx.wxLC_VRULES) ! imageList = wx.wxImageList(16, 16, true) ! imageList:Add(wx.wxArtProvider.GetBitmap(wx.wxART_NORMAL_FILE, wx.wxART_MENU, wx.wxSize(16,16))) ! imageList:Add(wx.wxArtProvider.GetBitmap(wx.wxART_FOLDER, wx.wxART_MENU, wx.wxSize(16,16))) listCtrl:SetImageList(imageList, wx.wxIMAGE_LIST_SMALL); ! listData[1] = { ! {"wx", "wxLuaBinding_wx", ["icon"] = img_folder }, ! {"wx", "wxLuaBinding_wxstc", ["icon"] = img_folder }, ! {"wx", "wxLuaBinding_wxluasocket", ["icon"] = img_folder }, ! ["col_labels"] = { "Lua Namespace", "Binding userdata" }, ! ["object_type"] = " " } GotoBindingLevel(listCtrl, 1) ! ! listCtrl:Connect(wx.wxEVT_COMMAND_LIST_ITEM_ACTIVATED, function(event) local index = event:GetIndex() *************** *** 279,283 **** --local col = event:GetColumn() -- both of these don't work in MSW --local pt = event:GetPoint() ! local mousePos = wx.wxGetMousePosition() local framePos = frame:GetPosition() --- 540,544 ---- --local col = event:GetColumn() -- both of these don't work in MSW --local pt = event:GetPoint() ! local mousePos = wx.wxGetMousePosition() local framePos = frame:GetPosition() *************** *** 288,292 **** --print(x, mousePos:GetX(), scrollPos, framePos:GetX(), winPos:GetX()) ! for c = 1, listCtrl:GetColumnCount() do w = w + listCtrl:GetColumnWidth(c-1) --- 549,553 ---- --print(x, mousePos:GetX(), scrollPos, framePos:GetX(), winPos:GetX()) ! for c = 1, listCtrl:GetColumnCount() do w = w + listCtrl:GetColumnWidth(c-1) *************** *** 296,304 **** end end ! SaveListColWidths(list_level) ! if (itemText == "..") then - list_level = list_level - 1 GotoBindingLevel(listCtrl, list_level) --- 557,564 ---- end end ! SaveListColWidths(list_level) ! if (itemText == "..") then list_level = list_level - 1 GotoBindingLevel(listCtrl, list_level) *************** *** 308,335 **** binding = binding[listData[1][index+1][i]] end ! listData[2] = { ! {".."}, {"GetBindingName", tostring(binding.GetBindingName)}, {"GetLuaNamespace", tostring(binding.GetLuaNamespace)}, ! {"GetClassCount", tostring(binding.GetClassCount)}, ! {"GetDefineCount", tostring(binding.GetDefineCount)}, ! {"GetEventCount", tostring(binding.GetEventCount)}, ! {"GetObjectCount", tostring(binding.GetObjectCount)}, ! {"GetFunctionCount", tostring(binding.GetFunctionCount)}, ! ! {"GetClassArray", "Click to view classes"}, ! {"GetFunctionArray", "Click to view functions"}, ! {"GetDefineArray", "Click to view defines"}, ! {"GetStringArray", "Click to view strings"}, ! {"GetEventArray", "Click to view events"}, ! {"GetObjectArray", "Click to view objects"}, ! ! ["cols"] = {"Function Name", "Value"}, ! ["folder"] = { false, true }, ["binding"] = binding, ["object_type"] = "wxLuaBinding" } ! list_level = list_level + 1 GotoBindingLevel(listCtrl, list_level) --- 568,590 ---- binding = binding[listData[1][index+1][i]] end ! listData[2] = { ! {"..", ["icon"] = img_folder}, {"GetBindingName", tostring(binding.GetBindingName)}, {"GetLuaNamespace", tostring(binding.GetLuaNamespace)}, ! ! {"GetClassArray", "GetClassCount : "..tostring(binding.GetClassCount), ["icon"] = img_folder}, ! {"GetFunctionArray", "GetFunctionCount : "..tostring(binding.GetFunctionCount), ["icon"] = img_folder}, ! {"GetDefineArray", "GetDefineCount : "..tostring(binding.GetDefineCount), ["icon"] = img_folder}, ! {"GetStringArray", "GetStringCount : "..tostring(binding.GetStringCount), ["icon"] = img_folder}, ! {"GetEventArray", "GetEventCount : "..tostring(binding.GetEventCount), ["icon"] = img_folder}, ! {"GetObjectArray", "GetObjectCount : "..tostring(binding.GetObjectCount), ["icon"] = img_folder}, ! ! ["col_labels"] = {"Function Name", "Value"}, ["binding"] = binding, ["object_type"] = "wxLuaBinding" } ! ! listData[list_level].list_item = index list_level = list_level + 1 GotoBindingLevel(listCtrl, list_level) *************** *** 338,342 **** local t = nil ! if (itemText == "GetClassArray") then t = CreatewxLuaBindClass(binding.GetClassArray) --- 593,597 ---- local t = nil ! if (itemText == "GetClassArray") then t = CreatewxLuaBindClass(binding.GetClassArray) *************** *** 354,357 **** --- 609,613 ---- if t ~= nil then + listData[list_level].list_item = index list_level = list_level + 1 listData[list_level] = t *************** *** 360,364 **** elseif (index > 0) and listData[list_level].object_type == "wxLuaBindClass" then local t = nil ! if ((col == 0) or (col == 1)) and (type(listData[list_level][index+1][2]) == "table") then t = CreatewxLuaBindMethod(listData[list_level][index+1][2]) --- 616,620 ---- elseif (index > 0) and listData[list_level].object_type == "wxLuaBindClass" then local t = nil ! if ((col == 0) or (col == 1)) and (type(listData[list_level][index+1][2]) == "table") then t = CreatewxLuaBindMethod(listData[list_level][index+1][2]) *************** *** 370,373 **** --- 626,632 ---- if t ~= nil then + t.class_name = listCtrl:GetItemText(index) + + listData[list_level].list_item = index list_level = list_level + 1 listData[list_level] = t *************** *** 376,387 **** elseif (index > 0) and listData[list_level].object_type == "wxLuaBindMethod" then local t = nil ! ! if (col == 2) and (type(listData[list_level][index+1][col+1]) == "table") then ! t = CreatewxLuaBindCFunc(listData[list_level][index+1][col+1]) elseif (col == 4) and (type(listData[list_level][index+1][col+1]) == "userdata") then t = CreatewxLuaBindMethod({listData[list_level][index+1][col+1]}) end if t ~= nil then list_level = list_level + 1 listData[list_level] = t --- 635,649 ---- elseif (index > 0) and listData[list_level].object_type == "wxLuaBindMethod" then local t = nil ! ! if ((col == 0) or (col == 2)) and (type(listData[list_level][index+1][3]) == "table") then ! t = CreatewxLuaBindCFunc(listData[list_level][index+1][3]) ! t.class_name = listData[list_level].class_name elseif (col == 4) and (type(listData[list_level][index+1][col+1]) == "userdata") then t = CreatewxLuaBindMethod({listData[list_level][index+1][col+1]}) + t.class_name = listData[list_level][index+1][col+1].class_name end if t ~= nil then + listData[list_level].list_item = index list_level = list_level + 1 listData[list_level] = t *************** *** 389,393 **** end end ! event:Skip(); end) --- 651,655 ---- end end ! event:Skip(); end) *************** *** 395,399 **** rootSizer = wx.wxBoxSizer(wx.wxVERTICAL); ! rootSizer:Add(listCtrl, 1, wx.wxEXPAND + wx.wxALL, 5); rootSizer:SetMinSize(450, 400); panel:SetSizer(rootSizer); --- 657,661 ---- rootSizer = wx.wxBoxSizer(wx.wxVERTICAL); ! rootSizer:Add(listCtrl, 1, wx.wxEXPAND + wx.wxALL, 0); rootSizer:SetMinSize(450, 400); panel:SetSizer(rootSizer); |
From: John L. <jr...@us...> - 2007-06-08 22:50:24
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv18758/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxlstate.h Log Message: Add some functions to compare the wxlua tags type to lua_type() within lua also get the tag number for any object in lua Cleanup the bindings.wx.lua to make it more useful Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** wxlbind.h 8 Jun 2007 03:40:51 -0000 1.45 --- wxlbind.h 8 Jun 2007 22:50:13 -0000 1.46 *************** *** 361,364 **** --- 361,366 ---- bool SetBaseClass(wxLuaBindClass *pClass); + // These function only look through the binding data of this wxLuaBinding + // Find the wxLuaBindEvent with the wxEventType, returns NULL if not found. const wxLuaBindEvent* GetEvent(wxEventType eventType) const; *************** *** 366,373 **** --- 368,378 ---- // in the wxLuaBindEvent* struct list of this binding. wxString GetEventTypeName(wxEventType eventType) const; + // Get the wxLuaBindClass that has this tag, or NULL if none + const wxLuaBindClass* GetLuaClass(int class_tag) const; // Get the first wxLuaBindClass that has this wxLuaBindMethod const wxLuaBindClass* GetLuaClass(const wxLuaBindMethod* wxlMethod) const; // Get the first wxLuaBindClass that has this wxLuaBindCFunc const wxLuaBindClass* GetLuaClass(const wxLuaBindCFunc* wxlMethod_cfunc) const; + // Get all the bindings that were initialized using the generated binding // function wxLuaBinding_[binding name]_init(). Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** wxlstate.h 8 Jun 2007 03:40:51 -0000 1.73 --- wxlstate.h 8 Jun 2007 22:50:16 -0000 1.74 *************** *** 43,47 **** // ---------------------------------------------------------------------------- ! // Convert a 8-bit Lua String into wxString inline WXDLLIMPEXP_WXLUA wxString lua2wx(const char* luastr) { --- 43,47 ---- // ---------------------------------------------------------------------------- ! // Convert a 8-bit ANSI C Lua String into a wxString inline WXDLLIMPEXP_WXLUA wxString lua2wx(const char* luastr) { *************** *** 62,66 **** } ! // Convert a wxString to 8-bit Lua String inline const WXDLLIMPEXP_WXLUA wxCharBuffer wx2lua(const wxString& wxstr) { --- 62,66 ---- } ! // Convert a wxString to 8-bit ANSI C Lua String inline const WXDLLIMPEXP_WXLUA wxCharBuffer wx2lua(const wxString& wxstr) { *************** *** 73,77 **** } ! // Convert a wxString to 8-bit Lua Buffer and store it class WXDLLIMPEXP_WXLUA wxLuaCharBuffer { --- 73,77 ---- } ! // Convert a wxString to 8-bit ANSI C Lua Buffer and store it class WXDLLIMPEXP_WXLUA wxLuaCharBuffer { *************** *** 82,85 **** --- 82,87 ---- const char *GetData() const { return (const char*)m_buffer; } + operator const char *() const { return m_buffer; } + wxCharBuffer m_buffer; // member since non virtual destructor in wxCharBuffer }; *************** *** 109,123 **** // Push the errorMsg on the stack and call lua_error WXDLLIMPEXP_WXLUA void LUACALL wxlua_terror(lua_State* L, const char* errorMsg); ! // Push the object u onto the top of the stack as a userdata of type tag ! // and set the metatable to the object at tget(tag) ! WXDLLIMPEXP_WXLUA void LUACALL wxlua_tpushusertag(lua_State* L, const void* u, int tag); ! // Get the tag of the object at the stack index using the metatable's "tag" key. ! // returns TLUA_NOTAG if no tag WXDLLIMPEXP_WXLUA int LUACALL wxlua_ttag(lua_State* L, int stack_idx); // Get the userdata at the stack index, if null_ptr then set the userdata pointer // in lua to NULL so that lua won't gc it. WXDLLIMPEXP_WXLUA void* LUACALL wxlua_ttouserdata(lua_State* L, int stack_idx, bool null_ptr = false); ! // Allocate a new table (metatable) tinsert it into the wxLuaReferences registry table ! // and return its index into the ref table. WXDLLIMPEXP_WXLUA int LUACALL wxlua_tnewtag(lua_State* L); // Create a new table and its metatable with weak keys and/or values by setting the --- 111,129 ---- // Push the errorMsg on the stack and call lua_error WXDLLIMPEXP_WXLUA void LUACALL wxlua_terror(lua_State* L, const char* errorMsg); ! // Push the object u onto the top of the stack wrapped in a newuserdata ! // with it's metatable set to the table from tget(tag). Returns true if the ! // tag is known and the metatable was set. ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_tpushusertag(lua_State* L, const void* u, int tag); ! // Get the numeric tag of the object at the stack index using the metatable's "tag" key. ! // returns TLUA_NOTAG if the metatable of the object doesn't have a "tag" ! // key or it isn't a number. The tag is presumedly the index into the wxLuaReferences ! // registry table and denotes what type of object this is. WXDLLIMPEXP_WXLUA int LUACALL wxlua_ttag(lua_State* L, int stack_idx); // Get the userdata at the stack index, if null_ptr then set the userdata pointer // in lua to NULL so that lua won't gc it. WXDLLIMPEXP_WXLUA void* LUACALL wxlua_ttouserdata(lua_State* L, int stack_idx, bool null_ptr = false); ! // Allocate a new table (metatable) with a "tag" key equal to the number from tinsert ! // and store it in the wxLuaReferences registry table. ! // Returns the index into the ref table, the "tag" from tinsert. WXDLLIMPEXP_WXLUA int LUACALL wxlua_tnewtag(lua_State* L); // Create a new table and its metatable with weak keys and/or values by setting the *************** *** 125,130 **** // registry table and return its index into the ref table. WXDLLIMPEXP_WXLUA int LUACALL wxlua_tnewweaktag(lua_State* L, bool weak_keys, bool weak_values); ! // Set the metatable of the object at top of stack to tget(tag) ! WXDLLIMPEXP_WXLUA void LUACALL wxlua_tsettag(lua_State* L, int tag); // Set a metamethod for the metatable referenced by tag with the supplied name and function. // if pClass is non-null set the upvalue of the function to the supplied class --- 131,137 ---- // registry table and return its index into the ref table. WXDLLIMPEXP_WXLUA int LUACALL wxlua_tnewweaktag(lua_State* L, bool weak_keys, bool weak_values); ! // Set the metatable of the object at top of stack to the table stored in the ! // wxLuaReferences registry table using tget(tag). ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_tsettag(lua_State* L, int tag); // Set a metamethod for the metatable referenced by tag with the supplied name and function. // if pClass is non-null set the upvalue of the function to the supplied class *************** *** 146,153 **** --- 153,168 ---- // wxluaarg_tag which is one of the predefined WXLUAARG_XXX or s_wxluaarg_XXX types. // Returns 1 if it matches, 0 if it doesn't, -1 if the wxluaarg_tag is not known. + // Note that this function does not do a direct mapping between wxlua_getwxluatype() + // and wxlua_getluatype() since it allows a small amount of coersion between types. WXDLLIMPEXP_WXLUA int LUACALL wxlua_iswxluatype(int luatype, int wxluaarg_tag); // Get a human readable name for the predefined WXLUAARG_XXX or s_wxluaarg_XXX tags. // returns empty string if the tag was not one of the predefined types. WXDLLIMPEXP_WXLUA wxString wxlua_getwxluatypename(int wxluaarg_tag); + // Get the wxluaarg_tag for the lua_type(). + // returns -1 if the tag was not one of the predefined types. + WXDLLIMPEXP_WXLUA int wxlua_getwxluatype(int luatype); + // Get the lua_type() for the predefined WXLUAARG_XXX or s_wxluaarg_XXX tags. + // returns -1 (LUA_TNONE) if the tag was not one of the predefined types. + WXDLLIMPEXP_WXLUA int wxlua_getluatype(int wxluatype); // Helper functions to get numbers, booleans and strings safer. *************** *** 561,568 **** void terror(const char *errorMsg) const; wxLUA_UNUSED_NOTUNICODE(void terror(const wxString& errorMsg) const { terror(wx2lua(errorMsg)); }) ! // Push the object u onto the top of the stack as a userdata of type tag ! // and set the metatable to the object at tget(tag) ! void tpushusertag(const void *u, int tag); ! // Get the tag of the object at the stack index, returns TLUA_NOTAG if no tag int ttag(int stack_idx) const; // Get the userdata at the stack index, if null_ptr then set the userdata pointer --- 576,587 ---- void terror(const char *errorMsg) const; wxLUA_UNUSED_NOTUNICODE(void terror(const wxString& errorMsg) const { terror(wx2lua(errorMsg)); }) ! // Push the object u onto the top of the stack wrapped in a newuserdata ! // with it's metatable set to the table from tget(tag). Returns true if the ! // tag is known and the metatable was set. ! bool tpushusertag(const void *u, int tag); ! // Get the numeric tag of the object at the stack index using the metatable's "tag" key. ! // returns TLUA_NOTAG if the metatable of the object doesn't have a "tag" ! // key or it isn't a number. The tag is presumedly the index into the wxLuaReferences ! // registry table and denotes what type of object this is. int ttag(int stack_idx) const; // Get the userdata at the stack index, if null_ptr then set the userdata pointer *************** *** 577,581 **** int tnewweaktag(bool weak_keys, bool weak_values); // Set the metatable of the object at top of stack to tget(tag) ! void tsettag(int tag); // Set a metamethod for the metatable referenced by tag with the supplied name and function. // if pClass is non-null set the upvalue of the function to the supplied class --- 596,600 ---- int tnewweaktag(bool weak_keys, bool weak_values); // Set the metatable of the object at top of stack to tget(tag) ! bool tsettag(int tag); // Set a metamethod for the metatable referenced by tag with the supplied name and function. // if pClass is non-null set the upvalue of the function to the supplied class |
From: John L. <jr...@us...> - 2007-06-08 03:40:56
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv30668/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlstate.cpp Log Message: Move all lua includes to wxldefs.h Fix node != NULL warning Make wxImageHistogram::iterator::SetFirst error out since you cannot set first value of a wxHashMap Fix unicode error in wxlbind.cpp Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** wxlstate.cpp 6 Jun 2007 23:43:16 -0000 1.103 --- wxlstate.cpp 8 Jun 2007 03:40:51 -0000 1.104 *************** *** 40,48 **** #include "wx/tokenzr.h" - extern "C" - { - #include "lua/src/lstate.h" - } - extern int wxLuaEventListCompareFn(const void *p1, const void *p2); // wxlbind.cpp extern int wxLuaClassListCompareByTag(const void *p1, const void *p2); // wxlbind.cpp --- 40,43 ---- *************** *** 534,538 **** case WXLUAARG_LuaThread : return wxT("thread"); case WXLUAARG_Enum : return wxT("enum"); ! } return wxEmptyString; --- 529,533 ---- case WXLUAARG_LuaThread : return wxT("thread"); case WXLUAARG_Enum : return wxT("enum"); ! } return wxEmptyString; *************** *** 833,837 **** wxWindowList::compatibility_iterator node = list->GetFirst(); ! while (node != NULL) { wxWindow *win = (wxWindow *)node->GetData(); --- 828,832 ---- wxWindowList::compatibility_iterator node = list->GetFirst(); ! while (node) { wxWindow *win = (wxWindow *)node->GetData(); *************** *** 2439,2443 **** } ! baseClass = baseClass->baseclass; } } --- 2434,2438 ---- } ! baseClass = baseClass->baseclass; } } *************** *** 3259,3263 **** wxArrayString wxLuaState::CreateMethodArgTagsMsg(struct wxLuaBindMethod* wxlMethod) { ! wxArrayString overloadMethodArray; wxCHECK_MSG(wxlMethod, overloadMethodArray, wxT("Invalid method table")); --- 3254,3258 ---- wxArrayString wxLuaState::CreateMethodArgTagsMsg(struct wxLuaBindMethod* wxlMethod) { ! wxArrayString overloadMethodArray; wxCHECK_MSG(wxlMethod, overloadMethodArray, wxT("Invalid method table")); *************** *** 3303,3308 **** fnOverload += GetLuaTagName(tag); ! ! if ((arg == 0) && !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_STATIC) && !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_CONSTRUCTOR) && --- 3298,3303 ---- fnOverload += GetLuaTagName(tag); ! ! if ((arg == 0) && !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_STATIC) && !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_CONSTRUCTOR) && *************** *** 3389,3393 **** if (!func->argtags[arg_wxlua]) { ! funcArray.RemoveAt(i); i--; continue; --- 3384,3388 ---- if (!func->argtags[arg_wxlua]) { ! funcArray.RemoveAt(i); i--; continue; *************** *** 3399,3403 **** //wxPrintf(wxT("ARG '%s' type %d argCount %d arg %d arg_lua %d arg_wxlua %d ltype %d wxtype %d func_count %d/%d\n"), lua2wx(wxlMethod->name).c_str(), func->type, argCount, arg, arg_lua, arg_wxlua, ltype, tag, i, funcArray.GetCount()); ! // Does the lua type match the wxlua arg tag type int is_ok = wxlua_iswxluatype(ltype, tag); --- 3394,3398 ---- //wxPrintf(wxT("ARG '%s' type %d argCount %d arg %d arg_lua %d arg_wxlua %d ltype %d wxtype %d func_count %d/%d\n"), lua2wx(wxlMethod->name).c_str(), func->type, argCount, arg, arg_lua, arg_wxlua, ltype, tag, i, funcArray.GetCount()); ! // Does the lua type match the wxlua arg tag type int is_ok = wxlua_iswxluatype(ltype, tag); *************** *** 3405,3409 **** if (is_ok == -1) { ! is_ok = (IsUserDataType(arg_lua, tag) || (tag == M_WXLSTATEDATA->m_wxlStateData->m_wxluatag_NULL)) ? 1 : 0; } --- 3400,3404 ---- if (is_ok == -1) { ! is_ok = (IsUserDataType(arg_lua, tag) || (tag == M_WXLSTATEDATA->m_wxlStateData->m_wxluatag_NULL)) ? 1 : 0; } *************** *** 3412,3416 **** if (is_ok == 0) { ! funcArray.RemoveAt(i); i--; continue; --- 3407,3411 ---- if (is_ok == 0) { ! funcArray.RemoveAt(i); i--; continue; *************** *** 3419,3423 **** } ! // If there was a function that matched run it, if > 1 ??? // Note that the top function is the one that is highest in the // derived functions from any baseclasses and should be the best choice. --- 3414,3418 ---- } ! // If there was a function that matched run it, if > 1 ??? // Note that the top function is the one that is highest in the // derived functions from any baseclasses and should be the best choice. *************** *** 3447,3451 **** { fnCall += lua_TypeName(ltype); ! } else { --- 3442,3446 ---- { fnCall += lua_TypeName(ltype); ! } else { *************** *** 3469,3473 **** } ! if (bestFunc == NULL) errmsg += wxString::Format(wxT("wxLua overloaded function %s has invalid argument\n%s"), fnCall.c_str(), fnOverloadList.c_str()); else --- 3464,3468 ---- } ! if (bestFunc == NULL) errmsg += wxString::Format(wxT("wxLua overloaded function %s has invalid argument\n%s"), fnCall.c_str(), fnOverloadList.c_str()); else *************** *** 3488,3492 **** } } ! method = method->basemethod; } --- 3483,3487 ---- } } ! method = method->basemethod; } Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** wxlbind.cpp 8 Jun 2007 01:36:31 -0000 1.66 --- wxlbind.cpp 8 Jun 2007 03:40:51 -0000 1.67 *************** *** 1004,1012 **** wxLuaBindMethod* wxlMethod_i = NULL; ! for (size_t i_class = 0; i_class < m_classCount; ++i_class, ++wxlClass_i) { wxlMethod_i = wxlClass_i->methods; int i_method, methods_n = wxlClass_i->methods_n; ! for (i_method = 0; i_method < methods_n; ++i_method, ++wxlMethod_i) { --- 1004,1012 ---- wxLuaBindMethod* wxlMethod_i = NULL; ! for (size_t i_class = 0; i_class < m_classCount; ++i_class, ++wxlClass_i) { wxlMethod_i = wxlClass_i->methods; int i_method, methods_n = wxlClass_i->methods_n; ! for (i_method = 0; i_method < methods_n; ++i_method, ++wxlMethod_i) { *************** *** 1025,1033 **** wxLuaBindCFunc* wxlCFunc_i = NULL; ! for (size_t i_class = 0; i_class < m_classCount; ++i_class, ++wxlClass_i) { wxlMethod_i = wxlClass_i->methods; int i_method, methods_n = wxlClass_i->methods_n; ! for (i_method = 0; i_method < methods_n; ++i_method, ++wxlMethod_i) { --- 1025,1033 ---- wxLuaBindCFunc* wxlCFunc_i = NULL; ! for (size_t i_class = 0; i_class < m_classCount; ++i_class, ++wxlClass_i) { wxlMethod_i = wxlClass_i->methods; int i_method, methods_n = wxlClass_i->methods_n; ! for (i_method = 0; i_method < methods_n; ++i_method, ++wxlMethod_i) { *************** *** 1057,1061 **** void **ptr = (void **)lua_touserdata(L, 1); wxLuaBindCFunc* wxlCFunc= (wxLuaBindCFunc*)*ptr; ! wxLuaBinding *wxlBinding = (wxLuaBinding *)lua_touserdata(L, lua_upvalueindex(1)); int idx_type = lua_type(L, 2); --- 1057,1061 ---- void **ptr = (void **)lua_touserdata(L, 1); wxLuaBindCFunc* wxlCFunc= (wxLuaBindCFunc*)*ptr; ! //wxLuaBinding *wxlBinding = (wxLuaBinding *)lua_touserdata(L, lua_upvalueindex(1)); int idx_type = lua_type(L, 2); *************** *** 1093,1100 **** for (idx = 0; (idx < count) && wxlCFunc->argtags[idx]; ++idx) { ! lua_pushnumber(L, *wxlCFunc->argtags[idx]); lua_rawseti(L, -2, idx + 1); } ! return 1; } --- 1093,1100 ---- for (idx = 0; (idx < count) && wxlCFunc->argtags[idx]; ++idx) { ! lua_pushnumber(L, *wxlCFunc->argtags[idx]); lua_rawseti(L, -2, idx + 1); } ! return 1; } *************** *** 1107,1114 **** for (idx = 0; (idx < count) && wxlCFunc->argtags[idx]; ++idx) { ! lua_pushstring(L, wxlState.GetLuaTagName(*wxlCFunc->argtags[idx])); lua_rawseti(L, -2, idx + 1); } ! return 1; } --- 1107,1114 ---- for (idx = 0; (idx < count) && wxlCFunc->argtags[idx]; ++idx) { ! lua_pushstring(L, wx2lua(wxlState.GetLuaTagName(*wxlCFunc->argtags[idx]))); lua_rawseti(L, -2, idx + 1); } ! return 1; } *************** *** 1161,1167 **** lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindCFunc_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); --- 1161,1167 ---- lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindCFunc_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); *************** *** 1184,1190 **** lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindMethod_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); --- 1184,1190 ---- lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindMethod_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); *************** *** 1230,1234 **** size_t idx, count = wxlClass->methods_n; lua_createtable(L, count, 0); ! for (idx = 0; idx < count; ++idx, ++wxlMethod) { --- 1230,1234 ---- size_t idx, count = wxlClass->methods_n; lua_createtable(L, count, 0); ! for (idx = 0; idx < count; ++idx, ++wxlMethod) { *************** *** 1241,1249 **** lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindMethod_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); ! lua_rawseti(L, -2, idx + 1); } --- 1241,1249 ---- lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindMethod_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); ! lua_rawseti(L, -2, idx + 1); } *************** *** 1251,1255 **** return 1; } ! return 0; } --- 1251,1255 ---- return 1; } ! return 0; } *************** *** 1291,1297 **** lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindClass_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); --- 1291,1297 ---- lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindClass_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); *************** *** 1319,1326 **** lua_pushnumber(L, wxlDefine->value); lua_rawset(L, -3); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } --- 1319,1326 ---- lua_pushnumber(L, wxlDefine->value); lua_rawset(L, -3); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } *************** *** 1343,1347 **** int LUACALL wxluabind_wxLuaBinding_index(lua_State* L) ! { wxLuaState wxlState(L); wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); --- 1343,1347 ---- int LUACALL wxluabind_wxLuaBinding_index(lua_State* L) ! { wxLuaState wxlState(L); wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); *************** *** 1349,1353 **** void **ptr = (void **)lua_touserdata(L, 1); wxLuaBinding* wxlBinding = (wxLuaBinding*)*ptr; ! int idx_type = lua_type(L, 2); --- 1349,1353 ---- void **ptr = (void **)lua_touserdata(L, 1); wxLuaBinding* wxlBinding = (wxLuaBinding*)*ptr; ! int idx_type = lua_type(L, 2); *************** *** 1404,1415 **** lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindClass_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } --- 1404,1415 ---- lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindClass_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } *************** *** 1427,1438 **** lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindMethod_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } --- 1427,1438 ---- lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindMethod_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } *************** *** 1453,1460 **** lua_pushnumber(L, wxlDefine->value); lua_rawset(L, -3); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } --- 1453,1460 ---- lua_pushnumber(L, wxlDefine->value); lua_rawset(L, -3); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } *************** *** 1475,1482 **** lua_pushstring(L, wx2lua(wxlString->value)); lua_rawset(L, -3); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } --- 1475,1482 ---- lua_pushstring(L, wx2lua(wxlString->value)); lua_rawset(L, -3); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } *************** *** 1500,1507 **** lua_pushnumber(L, *wxlEvent->class_tag); lua_rawset(L, -3); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } --- 1500,1507 ---- lua_pushnumber(L, *wxlEvent->class_tag); lua_rawset(L, -3); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } *************** *** 1526,1530 **** wxlState.tpushusertag(*wxlObject->pObjPtr, *wxlObject->class_tag); lua_rawset(L, -3); ! lua_pushstring(L, "class_tag"); lua_pushnumber(L, *wxlObject->class_tag); --- 1526,1530 ---- wxlState.tpushusertag(*wxlObject->pObjPtr, *wxlObject->class_tag); lua_rawset(L, -3); ! lua_pushstring(L, "class_tag"); lua_pushnumber(L, *wxlObject->class_tag); *************** *** 1533,1541 **** lua_rawseti(L, -2, idx + 1); } ! return 1; ! } } ! return 0; } --- 1533,1541 ---- lua_rawseti(L, -2, idx + 1); } ! return 1; ! } } ! return 0; } |
From: John L. <jr...@us...> - 2007-06-08 03:40:55
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv30668/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxldefs.h wxlstate.h Log Message: Move all lua includes to wxldefs.h Fix node != NULL warning Make wxImageHistogram::iterator::SetFirst error out since you cannot set first value of a wxHashMap Fix unicode error in wxlbind.cpp Index: wxldefs.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxldefs.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** wxldefs.h 8 Jun 2007 01:36:31 -0000 1.20 --- wxldefs.h 8 Jun 2007 03:40:51 -0000 1.21 *************** *** 13,24 **** #define __WX_WXLDEFS_H__ ! #include "wx/defs.h" extern "C" { ! typedef struct lua_State lua_State; ! typedef struct lua_Debug lua_Debug; } //----------------------------------------------------------------------------- // The version of wxLua - for convenience we use the current version of --- 13,34 ---- #define __WX_WXLDEFS_H__ ! //----------------------------------------------------------------------------- ! // Include the lua headers ! //----------------------------------------------------------------------------- extern "C" { ! #include "lua.h" ! #include "lualib.h" ! #include "lauxlib.h" ! ! // To not include "lua.h" use these ! //typedef struct lua_State lua_State; ! //typedef struct lua_Debug lua_Debug; ! //typedef int (*lua_CFunction)(lua_State *); } + #include "wx/defs.h" + //----------------------------------------------------------------------------- // The version of wxLua - for convenience we use the current version of Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** wxlbind.h 8 Jun 2007 01:36:31 -0000 1.44 --- wxlbind.h 8 Jun 2007 03:40:51 -0000 1.45 *************** *** 12,21 **** #include "wxlua/include/wxldefs.h" - extern "C" - { - #include "lualib.h" - #include "lauxlib.h" - } - #ifdef GetObject #undef GetObject // MSVC defines this --- 12,15 ---- *************** *** 57,63 **** // but are the min and max of all functions ! WXLUAMETHOD_OVERLOAD_BASE = 0x4000, // Class method has been checked to see if it is // overloaded from the base class. ! // Check WXLUAMETHOD::basemethod and if !NULL // this method is an overload from the base class }; --- 51,57 ---- // but are the min and max of all functions ! WXLUAMETHOD_OVERLOAD_BASE = 0x4000, // Class method has been checked to see if it is // overloaded from the base class. ! // Check WXLUAMETHOD::basemethod and if !NULL // this method is an overload from the base class }; Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** wxlstate.h 6 Jun 2007 23:43:16 -0000 1.72 --- wxlstate.h 8 Jun 2007 03:40:51 -0000 1.73 *************** *** 27,42 **** #define _WXLSTATE_H_ - extern "C" - { - #include "lua.h" - #include "lualib.h" - #include "lauxlib.h" - - // To not include "lua.h" use these - //typedef struct lua_State lua_State; - //typedef struct lua_Debug lua_Debug; - //typedef int (*lua_CFunction)(lua_State *); - } - #include "wxlua/include/wxldefs.h" #include "wxlua/include/wxlbind.h" --- 27,30 ---- *************** *** 155,159 **** ! // Verify if the luatype = lua_type(L, stack_idx) is valid for the // wxluaarg_tag which is one of the predefined WXLUAARG_XXX or s_wxluaarg_XXX types. // Returns 1 if it matches, 0 if it doesn't, -1 if the wxluaarg_tag is not known. --- 143,147 ---- ! // Verify if the luatype = lua_type(L, stack_idx) is valid for the // wxluaarg_tag which is one of the predefined WXLUAARG_XXX or s_wxluaarg_XXX types. // Returns 1 if it matches, 0 if it doesn't, -1 if the wxluaarg_tag is not known. |
From: John L. <jr...@us...> - 2007-06-08 03:40:55
|
Update of /cvsroot/wxlua/wxLua/bindings/wxwidgets In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv30668/wxLua/bindings/wxwidgets Modified Files: image.i override.hpp Log Message: Move all lua includes to wxldefs.h Fix node != NULL warning Make wxImageHistogram::iterator::SetFirst error out since you cannot set first value of a wxHashMap Fix unicode error in wxlbind.cpp Index: override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/override.hpp,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** override.hpp 8 Jun 2007 01:36:22 -0000 1.70 --- override.hpp 8 Jun 2007 03:40:50 -0000 1.71 *************** *** 3235,3238 **** --- 3235,3241 ---- static int LUACALL wxLua_wxImageHistogram_iterator_Set_first(lua_State *L) { + wxlua_terror(L, "You cannot set the first element of a wxHashTable, do not use wxImageHistogram::iterator::SetFirst()."); + return 0; + /* wxLuaState wxlState(L); // get the number value *************** *** 3243,3246 **** --- 3246,3250 ---- // return the number of parameters return 0; + */ } %end Index: image.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/image.i,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** image.i 1 Jun 2007 18:19:46 -0000 1.26 --- image.i 8 Jun 2007 03:40:50 -0000 1.27 *************** *** 206,210 **** %class %noclassinfo %encapsulate wxImageHistogramEntry wxImageHistogramEntry() ! %rename Index %member unsigned long index // GetIndex() and SetIndex(idx) %rename Value %member unsigned long value // GetValue() and SetValue(val) %endclass --- 206,210 ---- %class %noclassinfo %encapsulate wxImageHistogramEntry wxImageHistogramEntry() ! %rename Index %member unsigned long index // GetIndex() only, SetIndex(idx) is not allowed %rename Value %member unsigned long value // GetValue() and SetValue(val) %endclass |
From: John L. <jr...@us...> - 2007-06-08 03:40:55
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv30668/wxLua/modules/wxbind/src Modified Files: image.cpp Log Message: Move all lua includes to wxldefs.h Fix node != NULL warning Make wxImageHistogram::iterator::SetFirst error out since you cannot set first value of a wxHashMap Fix unicode error in wxlbind.cpp Index: image.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/image.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** image.cpp 8 Jun 2007 01:36:27 -0000 1.40 --- image.cpp 8 Jun 2007 03:40:51 -0000 1.41 *************** *** 2288,2292 **** static int LUACALL wxLua_wxImageHistogramEntry_GetIndex(lua_State *L); static wxLuaBindCFunc s_wxluafunc_wxLua_wxImageHistogramEntry_GetIndex[1] = {{ wxLua_wxImageHistogramEntry_GetIndex, WXLUAMETHOD_METHOD, 1, 1, s_wxluatagArray_wxLua_wxImageHistogramEntry_GetIndex }}; ! // %rename Index %member unsigned long index // GetIndex() and SetIndex(idx) static int LUACALL wxLua_wxImageHistogramEntry_GetIndex(lua_State *L) { --- 2288,2292 ---- static int LUACALL wxLua_wxImageHistogramEntry_GetIndex(lua_State *L); static wxLuaBindCFunc s_wxluafunc_wxLua_wxImageHistogramEntry_GetIndex[1] = {{ wxLua_wxImageHistogramEntry_GetIndex, WXLUAMETHOD_METHOD, 1, 1, s_wxluatagArray_wxLua_wxImageHistogramEntry_GetIndex }}; ! // %rename Index %member unsigned long index // GetIndex() only, SetIndex(idx) is not allowed static int LUACALL wxLua_wxImageHistogramEntry_GetIndex(lua_State *L) { *************** *** 2318,2322 **** static int LUACALL wxLua_wxImageHistogramEntry_SetIndex(lua_State *L); static wxLuaBindCFunc s_wxluafunc_wxLua_wxImageHistogramEntry_SetIndex[1] = {{ wxLua_wxImageHistogramEntry_SetIndex, WXLUAMETHOD_METHOD, 2, 2, s_wxluatagArray_wxLua_wxImageHistogramEntry_SetIndex }}; ! // %rename Index %member unsigned long index // GetIndex() and SetIndex(idx) static int LUACALL wxLua_wxImageHistogramEntry_SetIndex(lua_State *L) { --- 2318,2322 ---- static int LUACALL wxLua_wxImageHistogramEntry_SetIndex(lua_State *L); static wxLuaBindCFunc s_wxluafunc_wxLua_wxImageHistogramEntry_SetIndex[1] = {{ wxLua_wxImageHistogramEntry_SetIndex, WXLUAMETHOD_METHOD, 2, 2, s_wxluatagArray_wxLua_wxImageHistogramEntry_SetIndex }}; ! // %rename Index %member unsigned long index // GetIndex() only, SetIndex(idx) is not allowed static int LUACALL wxLua_wxImageHistogramEntry_SetIndex(lua_State *L) { *************** *** 2435,2438 **** --- 2435,2441 ---- static int LUACALL wxLua_wxImageHistogram_iterator_Set_first(lua_State *L) { + wxlua_terror(L, "You cannot set the first element of a wxHashTable, do not use wxImageHistogram::iterator::SetFirst()."); + return 0; + /* wxLuaState wxlState(L); // get the number value *************** *** 2443,2446 **** --- 2446,2450 ---- // return the number of parameters return 0; + */ } |
From: John L. <jr...@us...> - 2007-06-08 01:36:58
|
Update of /cvsroot/wxlua/wxLua/bindings/wxstc In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15480/wxLua/bindings/wxstc Modified Files: wxstc_datatypes.lua Log Message: Add a simple method to get the binding info, seems small and works well Addd sample lua program bindings.wx.lua to show them in a listctrl Fix incircles to work with new bindings Put the "name" of the struct binding items first always Index: wxstc_datatypes.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxstc/wxstc_datatypes.lua,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** wxstc_datatypes.lua 6 Jun 2007 23:42:54 -0000 1.52 --- wxstc_datatypes.lua 8 Jun 2007 01:36:22 -0000 1.53 *************** *** 3073,3076 **** --- 3073,3082 ---- Name = "wxStdDialogButtonSizer", }, + wxStockCursor = { + Condition = "wxLUA_USE_wxCursor", + DefType = "enum", + IsNumber = true, + Name = "wxStockCursor", + }, wxStockGDI = { Condition = "(wxCHECK_VERSION(2,8,0)) && (wxLUA_USE_wxColourPenBrush)", |
From: John L. <jr...@us...> - 2007-06-08 01:36:58
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15480/wxLua/modules/wxbind/include Modified Files: wxbind.h Log Message: Add a simple method to get the binding info, seems small and works well Addd sample lua program bindings.wx.lua to show them in a listctrl Fix incircles to work with new bindings Put the "name" of the struct binding items first always Index: wxbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxbind.h,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** wxbind.h 7 Jun 2007 03:21:59 -0000 1.68 --- wxbind.h 8 Jun 2007 01:36:22 -0000 1.69 *************** *** 43,49 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 9 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 9 // --------------------------------------------------------------------------- --- 43,49 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 10 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 10 // --------------------------------------------------------------------------- |
From: John L. <jr...@us...> - 2007-06-08 01:36:58
|
Update of /cvsroot/wxlua/wxLua/bindings In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15480/wxLua/bindings Modified Files: genwxbind.lua Log Message: Add a simple method to get the binding info, seems small and works well Addd sample lua program bindings.wx.lua to show them in a listctrl Fix incircles to work with new bindings Put the "name" of the struct binding items first always Index: genwxbind.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/genwxbind.lua,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -d -r1.115 -r1.116 *** genwxbind.lua 7 Jun 2007 03:21:59 -0000 1.115 --- genwxbind.lua 8 Jun 2007 01:36:21 -0000 1.116 *************** *** 18,24 **** -- --------------------------------------------------------------------------- ! WXLUA_BINDING_VERSION = 9 -- Used to verify that the bindings are updated ! -- This must match modules/wxlua/include/wxldefs.h ! -- otherwise a compile time error will be generated. bindingKeywordTable = {} -- Binding keywords used by the generator %XXX --- 18,24 ---- -- --------------------------------------------------------------------------- ! WXLUA_BINDING_VERSION = 10 -- Used to verify that the bindings are updated ! -- This must match modules/wxlua/include/wxldefs.h ! -- otherwise a compile time error will be generated. bindingKeywordTable = {} -- Binding keywords used by the generator %XXX *************** *** 2666,2670 **** LuaName = member.Name, FuncType = "WXLUAMETHOD_GETPROP", ! Map = " { WXLUAMETHOD_GETPROP, \""..member.Name.."\", s_wxluafunc_wxLua_"..MakeVar(parseObject.Name).."_Get"..member.Name..", 1 },\n", Condition = propertycondition } --- 2666,2670 ---- LuaName = member.Name, FuncType = "WXLUAMETHOD_GETPROP", ! Map = " { \""..member.Name.."\", WXLUAMETHOD_GETPROP, s_wxluafunc_wxLua_"..MakeVar(parseObject.Name).."_Get"..member.Name..", 1 },\n", Condition = propertycondition } *************** *** 2679,2683 **** LuaName = member.Name, FuncType = "WXLUAMETHOD_SETPROP", ! Map = " { WXLUAMETHOD_SETPROP, \""..member.Name.."\", s_wxluafunc_wxLua_"..MakeVar(parseObject.Name).."_Set"..member.Name..", 1 },\n", Condition = propertycondition } --- 2679,2683 ---- LuaName = member.Name, FuncType = "WXLUAMETHOD_SETPROP", ! Map = " { \""..member.Name.."\", WXLUAMETHOD_SETPROP, s_wxluafunc_wxLua_"..MakeVar(parseObject.Name).."_Set"..member.Name..", 1 },\n", Condition = propertycondition } *************** *** 2779,2783 **** FuncMap = "{ "..funcName..", WXLUAMETHOD_METHOD, 1, 1, "..overload_argListName.." }", FuncMapName = funcMapName, ! Map = " { WXLUAMETHOD_METHOD, \""..memberGetFunc.."\", "..funcMapName..", 1, NULL },\n", Condition = membercondition } --- 2779,2783 ---- FuncMap = "{ "..funcName..", WXLUAMETHOD_METHOD, 1, 1, "..overload_argListName.." }", FuncMapName = funcMapName, ! Map = " { \""..memberGetFunc.."\", WXLUAMETHOD_METHOD, "..funcMapName..", 1, NULL },\n", Condition = membercondition } *************** *** 2788,2792 **** LuaName = member.Name, FuncType = "WXLUAMETHOD_GETPROP", ! Map = " { WXLUAMETHOD_GETPROP, \""..member.Name.."\", "..funcMapName..", 1, NULL },\n", Condition = membercondition } --- 2788,2792 ---- LuaName = member.Name, FuncType = "WXLUAMETHOD_GETPROP", ! Map = " { \""..member.Name.."\", WXLUAMETHOD_GETPROP, "..funcMapName..", 1, NULL },\n", Condition = membercondition } *************** *** 2868,2872 **** FuncMap = "{ "..funcName..", WXLUAMETHOD_METHOD, 2, 2, "..overload_argListName.." }", -- FIXME make sure this is right FuncMapName = funcMapName, ! Map = " { WXLUAMETHOD_METHOD, \""..memberSetFunc.."\", "..funcMapName..", 1, NULL },\n", Condition = membercondition } --- 2868,2872 ---- FuncMap = "{ "..funcName..", WXLUAMETHOD_METHOD, 2, 2, "..overload_argListName.." }", -- FIXME make sure this is right FuncMapName = funcMapName, ! Map = " { \""..memberSetFunc.."\", WXLUAMETHOD_METHOD, "..funcMapName..", 1, NULL },\n", Condition = membercondition } *************** *** 2877,2881 **** LuaName = member.Name, FuncType = "WXLUAMETHOD_SETPROP", ! Map = " { WXLUAMETHOD_SETPROP, \""..member.Name.."\", "..funcMapName..", 1, NULL },\n", Condition = fullcondition } --- 2877,2881 ---- LuaName = member.Name, FuncType = "WXLUAMETHOD_SETPROP", ! Map = " { \""..member.Name.."\", WXLUAMETHOD_SETPROP, "..funcMapName..", 1, NULL },\n", Condition = fullcondition } *************** *** 2961,2964 **** --- 2961,2965 ---- -- --------------------------------------------------------------- elseif member.DefType == "define_string" then + local luaname = member.AltName or member.Name -- for %rename local value = member.Value or member.Name *************** *** 3011,3015 **** { LuaName = luaname, ! Map = " { &"..member.Name..", \""..luaname.."\", &s_wxluatag_"..MakeClassVar(parseObject.Name).." },\n", Condition = fullcondition } --- 3012,3016 ---- { LuaName = luaname, ! Map = " { \""..luaname.."\", &"..member.Name..", &s_wxluatag_"..MakeClassVar(parseObject.Name).." },\n", Condition = fullcondition } *************** *** 3577,3581 **** local funcMapName = "s_wxluafunc_"..funcName local funcMap = "{ "..funcName..", "..funcType..", "..tostring(requiredParamCount)..", "..tostring(paramCount)..", "..overload_argListName.." }" ! local methodMap = " { "..funcType..", \""..funcLuaCall.."\", "..funcMapName..", 1, NULL },\n" -- build method condition --- 3578,3582 ---- local funcMapName = "s_wxluafunc_"..funcName local funcMap = "{ "..funcName..", "..funcType..", "..tostring(requiredParamCount)..", "..tostring(paramCount)..", "..overload_argListName.." }" ! local methodMap = " { \""..funcLuaCall.."\", "..funcType..", "..funcMapName..", 1, NULL },\n" -- build method condition *************** *** 3735,3739 **** ParamCount = 1, RequiredParamCount = 1, ! Map = " { WXLUAMETHOD_METHOD, \"Delete\", "..funcMapName..", 1, NULL },\n", Condition = condition } --- 3736,3740 ---- ParamCount = 1, RequiredParamCount = 1, ! Map = " { \"Delete\", WXLUAMETHOD_METHOD, "..funcMapName..", 1, NULL },\n", Condition = condition } *************** *** 4444,4448 **** table.insert(funcMap, "static int "..funcMapName.."_count = sizeof("..funcMapName..")/sizeof(wxLuaBindCFunc);\n") ! local methodMap = " { "..funcType..", \""..methodBindings[1].LuaName.."\", "..funcMapName..", "..funcMapName.."_count, 0 }" local codeList = {} --- 4445,4449 ---- table.insert(funcMap, "static int "..funcMapName.."_count = sizeof("..funcMapName..")/sizeof(wxLuaBindCFunc);\n") ! local methodMap = " { \""..methodBindings[1].LuaName.."\", "..funcType..", "..funcMapName..", "..funcMapName.."_count, 0 }" local codeList = {} |
From: John L. <jr...@us...> - 2007-06-08 01:36:58
|
Update of /cvsroot/wxlua/wxLua/apps/wxluacan/scripts In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15480/wxLua/apps/wxluacan/scripts Modified Files: incircles.lua Log Message: Add a simple method to get the binding info, seems small and works well Addd sample lua program bindings.wx.lua to show them in a listctrl Fix incircles to work with new bindings Put the "name" of the struct binding items first always Index: incircles.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluacan/scripts/incircles.lua,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** incircles.lua 4 May 2007 19:04:41 -0000 1.9 --- incircles.lua 8 Jun 2007 01:36:21 -0000 1.10 *************** *** 1,22 **** ----------------------------------------------------------------------------- -- Name: incircles.lua ! -- Purpose: Sample wxLua program for wxLua's wxluacan sample app -- Author: Klaas Holwerda -- Modified by: ! -- Created: ! -- RCS-ID: -- Copyright: (c) 2005 Klaas Holwerda. All rights reserved. -- Licence: wxWidgets licence ----------------------------------------------------------------------------- ! bluebrush = wx.wxBrushFromColourName("Blue", wx.wxSOLID) ! redbrush = wx.wxBrushFromColourName("Red", wx.wxSOLID) ! purplebrush = wx.wxBrushFromColourName("Purple", wx.wxSOLID) ! greenbrush = wx.wxBrushFromColourName("Green", wx.wxSOLID) ! bluepen = wx.wxPenFromColourName("Blue", 5, wx.wxSOLID) ! redpen = wx.wxPenFromColourName("Red", 2, wx.wxSOLID) ! purplepen = wx.wxPenFromColourName("Purple", 10, wx.wxSOLID) ! greenpen = wx.wxPenFromColourName("Green", 2, wx.wxSOLID) ! purplepen1p = wx.wxPenFromColourName("Purple", 1, wx.wxSOLID) function MonoDraw( dc, x, y ) --- 1,22 ---- ----------------------------------------------------------------------------- -- Name: incircles.lua ! -- Purpose: Sample wxLua program for wxLua's wxluacan sample app -- Author: Klaas Holwerda -- Modified by: ! -- Created: ! -- RCS-ID: -- Copyright: (c) 2005 Klaas Holwerda. All rights reserved. -- Licence: wxWidgets licence ----------------------------------------------------------------------------- ! bluebrush = wx.wxBrush("Blue", wx.wxSOLID) ! redbrush = wx.wxBrush("Red", wx.wxSOLID) ! purplebrush = wx.wxBrush("Purple", wx.wxSOLID) ! greenbrush = wx.wxBrush("Green", wx.wxSOLID) ! bluepen = wx.wxPen("Blue", 5, wx.wxSOLID) ! redpen = wx.wxPen("Red", 2, wx.wxSOLID) ! purplepen = wx.wxPen("Purple", 10, wx.wxSOLID) ! greenpen = wx.wxPen("Green", 2, wx.wxSOLID) ! purplepen1p = wx.wxPen("Purple", 1, wx.wxSOLID) function MonoDraw( dc, x, y ) *************** *** 48,54 **** dc:SetPen( redpen ) for i = -20, 20 do ! local y2 if i ~= 0 then ! y2 = 150*math.sin(i/2)/(i/2) else y2 = 150; --sin(x)/x goes to one at zero --- 48,54 ---- dc:SetPen( redpen ) for i = -20, 20 do ! local y2 if i ~= 0 then ! y2 = 150*math.sin(i/2)/(i/2) else y2 = 150; --sin(x)/x goes to one at zero *************** *** 72,76 **** end ! function AddSome() for list = 1, 10 do --- 72,76 ---- end ! function AddSome() for list = 1, 10 do *************** *** 83,87 **** if wx.wxMessageBox( "Now we will add some objects to the canvas", "wxLuaCan Message", ! wx.wxYES_NO + wx.wxCENTRE) == wx.wxYES then -- fill the canvas --- 83,87 ---- if wx.wxMessageBox( "Now we will add some objects to the canvas", "wxLuaCan Message", ! wx.wxYES_NO + wx.wxCENTRE) == wx.wxYES then -- fill the canvas *************** *** 89,93 **** canobjrect = wxluacan.wxlCanObjRect( 40, 160, 100, 40) canobjrect:SetBrush( bluebrush ) ! canobjrect:SetPen( purplepen ) canvas:AddObject( canobjrect ) canobjrect:SetPending( true ) --- 89,93 ---- canobjrect = wxluacan.wxlCanObjRect( 40, 160, 100, 40) canobjrect:SetBrush( bluebrush ) ! canobjrect:SetPen( purplepen ) canvas:AddObject( canobjrect ) canobjrect:SetPending( true ) *************** *** 114,118 **** end ]] ! -- add the object using the above string as input script canobjAddScript = wxluacan.wxlCanObjAddScript( 150, 250, TheObjectAddScript ) --- 114,118 ---- end ]] ! -- add the object using the above string as input script canobjAddScript = wxluacan.wxlCanObjAddScript( 150, 250, TheObjectAddScript ) *************** *** 130,136 **** canobj:AddObject( canobj1 ) for i = -30, 30 do ! local y2 if i ~= 0 then ! y2 = -150*math.sin(i/3)/(i/3) else y2 = -150; --sin(x)/x goes to one at zero --- 130,136 ---- canobj:AddObject( canobj1 ) for i = -30, 30 do ! local y2 if i ~= 0 then ! y2 = -150*math.sin(i/3)/(i/3) else y2 = -150; --sin(x)/x goes to one at zero *************** *** 142,146 **** end ]] ! -- add the object using the above string as input script canobjAddScript = wxluacan.wxlCanObjAddScript( 150, 250, TheObjectAddScript_2 ) --- 142,146 ---- end ]] ! -- add the object using the above string as input script canobjAddScript = wxluacan.wxlCanObjAddScript( 150, 250, TheObjectAddScript_2 ) |
From: John L. <jr...@us...> - 2007-06-08 01:36:58
|
Update of /cvsroot/wxlua/wxLua/bindings/wxwidgets In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15480/wxLua/bindings/wxwidgets Modified Files: gdi.i override.hpp wx_datatypes.lua Log Message: Add a simple method to get the binding info, seems small and works well Addd sample lua program bindings.wx.lua to show them in a listctrl Fix incircles to work with new bindings Put the "name" of the struct binding items first always Index: wx_datatypes.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wx_datatypes.lua,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** wx_datatypes.lua 6 Jun 2007 23:42:56 -0000 1.62 --- wx_datatypes.lua 8 Jun 2007 01:36:22 -0000 1.63 *************** *** 3073,3076 **** --- 3073,3082 ---- Name = "wxStdDialogButtonSizer", }, + wxStockCursor = { + Condition = "wxLUA_USE_wxCursor", + DefType = "enum", + IsNumber = true, + Name = "wxStockCursor", + }, wxStockGDI = { Condition = "(wxCHECK_VERSION(2,8,0)) && (wxLUA_USE_wxColourPenBrush)", Index: gdi.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/gdi.i,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** gdi.i 1 Jun 2007 18:19:46 -0000 1.48 --- gdi.i 8 Jun 2007 01:36:22 -0000 1.49 *************** *** 996,1000 **** %include "wx/cursor.h" ! %enum // wxStockCursor anonymous because we use wxStockCursor as wxCursor constructor wxCURSOR_NONE wxCURSOR_ARROW --- 996,1000 ---- %include "wx/cursor.h" ! %enum wxStockCursor wxCURSOR_NONE wxCURSOR_ARROW Index: override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/override.hpp,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** override.hpp 6 Jun 2007 23:42:54 -0000 1.69 --- override.hpp 8 Jun 2007 01:36:22 -0000 1.70 *************** *** 905,911 **** const wxLuaBindClass *pClass = wxlState.GetLuaClass(className); ! if (pClass && pClass->pClassInfo) { ! if (pObject->IsKindOf(pClass->pClassInfo)) { wxlState.tsettag(*pClass->class_tag); --- 905,911 ---- const wxLuaBindClass *pClass = wxlState.GetLuaClass(className); ! if (pClass && pClass->classInfo) { ! if (pObject->IsKindOf(pClass->classInfo)) { wxlState.tsettag(*pClass->class_tag); |
From: John L. <jr...@us...> - 2007-06-08 01:36:58
|
Update of /cvsroot/wxlua/wxLua/apps/wxluacan/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15480/wxLua/apps/wxluacan/src Modified Files: wxluacan.cpp wxluacan.h wxluacan_bind.cpp Log Message: Add a simple method to get the binding info, seems small and works well Addd sample lua program bindings.wx.lua to show them in a listctrl Fix incircles to work with new bindings Put the "name" of the struct binding items first always Index: wxluacan.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluacan/src/wxluacan.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** wxluacan.cpp 7 Jun 2007 03:21:58 -0000 1.29 --- wxluacan.cpp 8 Jun 2007 01:36:21 -0000 1.30 *************** *** 183,198 **** // Map Lua Class Methods to C Binding Functions wxLuaBindMethod wxlCanObj_methods[] = { ! { WXLUAMETHOD_METHOD, "AddObject", s_wxluafunc_wxLua_wxlCanObj_AddObject, 1, NULL }, ! { WXLUAMETHOD_METHOD, "GetX", s_wxluafunc_wxLua_wxlCanObj_GetX, 1, NULL }, ! { WXLUAMETHOD_METHOD, "GetY", s_wxluafunc_wxLua_wxlCanObj_GetY, 1, NULL }, #if wxLUA_USE_wxColourPenBrush ! { WXLUAMETHOD_METHOD, "SetBrush", s_wxluafunc_wxLua_wxlCanObj_SetBrush, 1, NULL }, ! { WXLUAMETHOD_METHOD, "SetPen", s_wxluafunc_wxLua_wxlCanObj_SetPen, 1, NULL }, #endif // wxLUA_USE_wxColourPenBrush ! { WXLUAMETHOD_METHOD, "SetPending", s_wxluafunc_wxLua_wxlCanObj_SetPending, 1, NULL }, ! { WXLUAMETHOD_METHOD, "SetPos", s_wxluafunc_wxLua_wxlCanObj_SetPos, 1, NULL }, ! { WXLUAMETHOD_CONSTRUCTOR, "wxlCanObj", s_wxluafunc_wxLua_wxlCanObj_constructor, 1, NULL }, { 0, 0, 0, 0 }, }; --- 183,198 ---- // Map Lua Class Methods to C Binding Functions wxLuaBindMethod wxlCanObj_methods[] = { ! { "AddObject", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxlCanObj_AddObject, 1, NULL }, ! { "GetX", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxlCanObj_GetX, 1, NULL }, ! { "GetY", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxlCanObj_GetY, 1, NULL }, #if wxLUA_USE_wxColourPenBrush ! { "SetBrush", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxlCanObj_SetBrush, 1, NULL }, ! { "SetPen", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxlCanObj_SetPen, 1, NULL }, #endif // wxLUA_USE_wxColourPenBrush ! { "SetPending", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxlCanObj_SetPending, 1, NULL }, ! { "SetPos", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxlCanObj_SetPos, 1, NULL }, ! { "wxlCanObj", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxlCanObj_constructor, 1, NULL }, { 0, 0, 0, 0 }, }; *************** *** 237,241 **** // Map Lua Class Methods to C Binding Functions wxLuaBindMethod wxlCanObjRect_methods[] = { ! { WXLUAMETHOD_CONSTRUCTOR, "wxlCanObjRect", s_wxluafunc_wxLua_wxlCanObjRect_constructor, 1, NULL }, { 0, 0, 0, 0 }, }; --- 237,241 ---- // Map Lua Class Methods to C Binding Functions wxLuaBindMethod wxlCanObjRect_methods[] = { ! { "wxlCanObjRect", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxlCanObjRect_constructor, 1, NULL }, { 0, 0, 0, 0 }, }; *************** *** 278,282 **** // Map Lua Class Methods to C Binding Functions wxLuaBindMethod wxlCanObjCircle_methods[] = { ! { WXLUAMETHOD_CONSTRUCTOR, "wxlCanObjCircle", s_wxluafunc_wxLua_wxlCanObjCircle_constructor, 1, NULL }, { 0, 0, 0, 0 }, }; --- 278,282 ---- // Map Lua Class Methods to C Binding Functions wxLuaBindMethod wxlCanObjCircle_methods[] = { ! { "wxlCanObjCircle", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxlCanObjCircle_constructor, 1, NULL }, { 0, 0, 0, 0 }, }; *************** *** 319,323 **** // Map Lua Class Methods to C Binding Functions wxLuaBindMethod wxlCanObjScript_methods[] = { ! { WXLUAMETHOD_CONSTRUCTOR, "wxlCanObjScript", s_wxluafunc_wxLua_wxlCanObjScript_constructor, 1, NULL }, { 0, 0, 0, 0 }, }; --- 319,323 ---- // Map Lua Class Methods to C Binding Functions wxLuaBindMethod wxlCanObjScript_methods[] = { ! { "wxlCanObjScript", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxlCanObjScript_constructor, 1, NULL }, { 0, 0, 0, 0 }, }; *************** *** 377,382 **** // Map Lua Class Methods to C Binding Functions wxLuaBindMethod wxlCanObjAddScript_methods[] = { ! { WXLUAMETHOD_METHOD, "SetScript", s_wxluafunc_wxLua_wxlCanObjAddScript_SetScript, 1, NULL }, ! { WXLUAMETHOD_CONSTRUCTOR, "wxlCanObjAddScript", s_wxluafunc_wxLua_wxlCanObjAddScript_constructor, 1, NULL }, { 0, 0, 0, 0 }, }; --- 377,382 ---- // Map Lua Class Methods to C Binding Functions wxLuaBindMethod wxlCanObjAddScript_methods[] = { ! { "SetScript", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxlCanObjAddScript_SetScript, 1, NULL }, ! { "wxlCanObjAddScript", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxlCanObjAddScript_constructor, 1, NULL }, { 0, 0, 0, 0 }, }; *************** *** 480,489 **** // Map Lua Class Methods to C Binding Functions wxLuaBindMethod wxlCan_methods[] = { ! { WXLUAMETHOD_METHOD, "AddObject", s_wxluafunc_wxLua_wxlCan_AddObject, 1, NULL }, ! { WXLUAMETHOD_METHOD, "GetCmdh", s_wxluafunc_wxLua_wxlCan_GetCmdh, 1, NULL }, ! { WXLUAMETHOD_METHOD, "GetYaxis", s_wxluafunc_wxLua_wxlCan_GetYaxis, 1, NULL }, #if wxLUA_USE_wxPointSizeRect ! { WXLUAMETHOD_CONSTRUCTOR, "wxlCan", s_wxluafunc_wxLua_wxlCan_constructor, 1, NULL }, #endif // wxLUA_USE_wxPointSizeRect --- 480,489 ---- // Map Lua Class Methods to C Binding Functions wxLuaBindMethod wxlCan_methods[] = { ! { "AddObject", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxlCan_AddObject, 1, NULL }, ! { "GetCmdh", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxlCan_GetCmdh, 1, NULL }, ! { "GetYaxis", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxlCan_GetYaxis, 1, NULL }, #if wxLUA_USE_wxPointSizeRect ! { "wxlCan", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxlCan_constructor, 1, NULL }, #endif // wxLUA_USE_wxPointSizeRect *************** *** 549,554 **** // Map Lua Class Methods to C Binding Functions wxLuaBindMethod wxlLuaCanCmd_methods[] = { ! { WXLUAMETHOD_METHOD, "MoveObject", s_wxluafunc_wxLua_wxlLuaCanCmd_MoveObject, 1, NULL }, ! { WXLUAMETHOD_CONSTRUCTOR, "wxlLuaCanCmd", s_wxluafunc_wxLua_wxlLuaCanCmd_constructor, 1, NULL }, { 0, 0, 0, 0 }, }; --- 549,554 ---- // Map Lua Class Methods to C Binding Functions wxLuaBindMethod wxlLuaCanCmd_methods[] = { ! { "MoveObject", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxlLuaCanCmd_MoveObject, 1, NULL }, ! { "wxlLuaCanCmd", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxlLuaCanCmd_constructor, 1, NULL }, { 0, 0, 0, 0 }, }; Index: wxluacan_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluacan/src/wxluacan_bind.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** wxluacan_bind.cpp 7 Jun 2007 03:21:58 -0000 1.21 --- wxluacan_bind.cpp 8 Jun 2007 01:36:21 -0000 1.22 *************** *** 121,126 **** static wxLuaBindMethod functionList[] = { ! { WXLUAMETHOD_CFUNCTION, "GetCan", s_wxluafunc_wxLua_function_GetCan, 1, NULL }, ! { WXLUAMETHOD_CFUNCTION, "GetCmdhMain", s_wxluafunc_wxLua_function_GetCmdhMain, 1, NULL }, { 0, 0, 0, 0 }, --- 121,126 ---- static wxLuaBindMethod functionList[] = { ! { "GetCan", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetCan, 1, NULL }, ! { "GetCmdhMain", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetCmdhMain, 1, NULL }, { 0, 0, 0, 0 }, Index: wxluacan.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluacan/src/wxluacan.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** wxluacan.h 7 Jun 2007 03:21:58 -0000 1.26 --- wxluacan.h 8 Jun 2007 01:36:21 -0000 1.27 *************** *** 18,24 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 9 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 9 // --------------------------------------------------------------------------- --- 18,24 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 10 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 10 // --------------------------------------------------------------------------- |
From: John L. <jr...@us...> - 2007-06-08 01:36:49
|
Update of /cvsroot/wxlua/wxLua/samples In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15480/wxLua/samples Added Files: bindings.wx.lua Log Message: Add a simple method to get the binding info, seems small and works well Addd sample lua program bindings.wx.lua to show them in a listctrl Fix incircles to work with new bindings Put the "name" of the struct binding items first always --- NEW FILE: bindings.wx.lua --- ----------------------------------------------------------------------------- -- Name: bindings.wx.lua -- Purpose: Show wxLua bindings in a wxListCtrl or dump them using print -- Author: john Labenski -- Modified by: -- Created: 5/7/2007 -- RCS-ID: -- Copyright: (c) John Labenski -- Licence: wxWidgets licence ----------------------------------------------------------------------------- -- ---------------------------------------------------------------------------- -- Brute force dump of the binding info using print statements for debugging -- ---------------------------------------------------------------------------- function ColumnDumpTable(t, keys) local lens = {} for i = 1, #keys do lens[i] = string.len(keys[i]) end for i = 1, #t do local u = t[i] for k = 1, #keys do local len = string.len(tostring(u[keys[k]])) if (len > lens[k]) then lens[k] = len end end end local s = "" for k = 1, #keys do local val = tostring(keys[k]) local buf = string.rep(" ", lens[k] - string.len(val) + 1) s = s..val..buf end print(s) for i = 1, #t do local u = t[i] local s = "" for k = 1, #keys do local val = tostring(u[keys[k]]) local buf = string.rep(" ", lens[k] - string.len(val) + 1) s = s..val..buf end print(s) end end function DumpBindingInfo(binding) print("Binding Name : "..tostring(binding.GetBindingName)) print("Lua Namespace : "..tostring(binding.GetLuaNamespace)) print("Class Count : "..tostring(binding.GetClassCount)) print("Define Count : "..tostring(binding.GetDefineCount)) print("Event Count : "..tostring(binding.GetEventCount)) print("Object Count : "..tostring(binding.GetObjectCount)) print("Function Count : "..tostring(binding.GetFunctionCount)) if true then print("\nDUMPING binding.GetClassArray ==================================\n") local keys = { "name", "methods", "methods_n", "classInfo", "class_tag", "baseclassName", "baseclass", "enums", "enums_n" } ColumnDumpTable(binding.GetClassArray, keys) end if true then print("\nDUMPING binding.GetFunctionArray ==================================\n") local keys = { "name", "type", "funcs", "funcs_n", "basemethod" } ColumnDumpTable(binding.GetFunctionArray, keys) end if true then print("\nDUMPING binding.GetDefineArray ==================================\n") local keys = { "name", "value" } ColumnDumpTable(binding.GetDefineArray, keys) end if true then print("\nDUMPING binding.GetStringArray ==================================\n") local keys = { "name", "value" } ColumnDumpTable(binding.GetStringArray, keys) end if true then print("\nDUMPING binding.GetEventArray ==================================\n") local keys = { "name", "eventType", "class_tag" } ColumnDumpTable(binding.GetEventArray, keys) end if true then print("\nDUMPING binding.GetObjectArray ==================================\n") local keys = { "name", "object", "class_tag" } ColumnDumpTable(binding.GetObjectArray, keys) end end -- Call DumpBindingInfo(...) on the binding you want to show --DumpBindingInfo(wx.wxLuaBinding_wx) -- ---------------------------------------------------------------------------- -- A wxLua program to view the bindings in a wxListCtrl -- ---------------------------------------------------------------------------- ID_LISTCTRL = 1000 listData = {} -- store the table currently displayed by the listCtrl list_level = 1 img_normal = 0 img_folder = 1 listColWidths = {} -- stored by "object_type" name function SaveListColWidths(level) if not listColWidths[listData[level].object_type] then listColWidths[listData[level].object_type] = {} end for col = 1, listCtrl:GetColumnCount() do listColWidths[listData[level].object_type][col] = listCtrl:GetColumnWidth(col-1) end end function GotoBindingLevel(listCtrl, level) listCtrl:DeleteAllItems() local lc_item = 0 for col = 1, listCtrl:GetColumnCount() do listCtrl:DeleteColumn(0) end for col = 1, #listData[level].cols do listCtrl:InsertColumn(col-1, listData[level].cols[col], wx.wxLIST_FORMAT_LEFT, -1) if listData[level].folder and listData[level].folder[col] then listCtrl:SetColumnImage(col-1, img_folder) end end if listColWidths[listData[level].object_type] then for col = 1, #listColWidths[listData[level].object_type] do listCtrl:SetColumnWidth(col-1, listColWidths[listData[level].object_type][col]) end end for i = 1, #listData[level] do local d = listData[level][i] local info = wx.wxListItem() info:SetId(lc_item+1) info:SetText(tostring(d[1])) lc_item = listCtrl:InsertItem(info) info:SetId(lc_item) if (d[1] ~= "..") then for col = 2, #listData[level].cols do listCtrl:SetItem(lc_item, col-1, tostring(d[col])) end end end end function CreatewxLuaBindClass(tbl) local keys = { "name", "methods", "methods_n", "classInfo", "class_tag", "baseclassName", "baseclass", "enums", "enums_n" } local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindClass") -- these are expandable t.folder = {} t.folder[2] = true t.folder[7] = true t.folder[8] = true return t end function CreatewxLuaBindMethod(tbl) local keys = { "name", "type", "funcs", "funcs_n", "basemethod" } local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindMethod") -- these are expandable t.folder = {} t.folder[3] = true t.folder[5] = true return t end function CreatewxLuaBindDefine(tbl) local keys = { "name", "value" } return CreatewxLuaBindTable(tbl, keys, "wxLuaBindDefine") end function CreatewxLuaBindString(tbl) local keys = { "name", "value" } return CreatewxLuaBindTable(tbl, keys, "wxLuaBindString") end function CreatewxLuaBindEvent(tbl) local keys = { "name", "eventType", "class_tag" } return CreatewxLuaBindTable(tbl, keys, "wxLuaBindEvent") end function CreatewxLuaBindObject(tbl) local keys = { "name", "object", "class_tag" } return CreatewxLuaBindTable(tbl, keys, "wxLuaBindObject") end function CreatewxLuaBindCFunc(tbl) local keys = { "func", "type", "minargs", "maxargs", "argtags", "argtags_name" } local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindCFunc") for i = 2, #t do t[i][5] = table.concat(t[i][5], ", ") t[i][6] = table.concat(t[i][6], ", ") end return t end function CreatewxLuaBindTable(tbl, keys, object_type) local t = { {".."}, ["cols"] = keys, ["object_type"] = object_type } for i = 1, #tbl do local item = {} for k = 1, #keys do -- we need to force there to be something in each col, use a 0 local val = tbl[i][keys[k]] if val ~= nil then table.insert(item, val) else table.insert(item, 0) end end table.insert(t, item) end return t end function main() frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, "wxLua Binding Browser") panel = wx.wxPanel(frame, wx.wxID_ANY) listCtrl = wx.wxListView(panel, ID_LISTCTRL, wx.wxDefaultPosition, wx.wxDefaultSize, wx.wxLC_REPORT + wx.wxLC_SINGLE_SEL + wx.wxLC_HRULES + wx.wxLC_VRULES) imageList = wx.wxImageList(16, 16, true) imageList:Add(wx.wxArtProvider.GetBitmap(wx.wxART_NORMAL_FILE, wx.wxART_MENU)) imageList:Add(wx.wxArtProvider.GetBitmap(wx.wxART_FILE_OPEN, wx.wxART_MENU)) listCtrl:SetImageList(imageList, wx.wxIMAGE_LIST_SMALL); listData[1] = { {"wx", "wxLuaBinding_wx"}, {"wx", "wxLuaBinding_wxstc"}, {"wx", "wxLuaBinding_wxluasocket"}, ["cols"] = { "Lua Namespace", "Binding userdata" }, ["object_type"] = "Root" } GotoBindingLevel(listCtrl, 1) listCtrl:Connect(wx.wxEVT_COMMAND_LIST_ITEM_ACTIVATED, function(event) local index = event:GetIndex() local itemText = listCtrl:GetItemText(index) -- Find what column we're in --local col = event:GetColumn() -- both of these don't work in MSW --local pt = event:GetPoint() local mousePos = wx.wxGetMousePosition() local framePos = frame:GetPosition() local winPos = listCtrl:GetPosition() local scrollPos = listCtrl:GetScrollPos(wx.wxHORIZONTAL) local x = mousePos:GetX() + scrollPos - framePos:GetX() - winPos:GetX() local w = 0 --print(x, mousePos:GetX(), scrollPos, framePos:GetX(), winPos:GetX()) for c = 1, listCtrl:GetColumnCount() do w = w + listCtrl:GetColumnWidth(c-1) if x < w then col = c-1 break end end SaveListColWidths(list_level) if (itemText == "..") then list_level = list_level - 1 GotoBindingLevel(listCtrl, list_level) elseif (list_level == 1) then local binding = _G for i = 1, #listData[1][index+1] do binding = binding[listData[1][index+1][i]] end listData[2] = { {".."}, {"GetBindingName", tostring(binding.GetBindingName)}, {"GetLuaNamespace", tostring(binding.GetLuaNamespace)}, {"GetClassCount", tostring(binding.GetClassCount)}, {"GetDefineCount", tostring(binding.GetDefineCount)}, {"GetEventCount", tostring(binding.GetEventCount)}, {"GetObjectCount", tostring(binding.GetObjectCount)}, {"GetFunctionCount", tostring(binding.GetFunctionCount)}, {"GetClassArray", "Click to view classes"}, {"GetFunctionArray", "Click to view functions"}, {"GetDefineArray", "Click to view defines"}, {"GetStringArray", "Click to view strings"}, {"GetEventArray", "Click to view events"}, {"GetObjectArray", "Click to view objects"}, ["cols"] = {"Function Name", "Value"}, ["folder"] = { false, true }, ["binding"] = binding, ["object_type"] = "wxLuaBinding" } list_level = list_level + 1 GotoBindingLevel(listCtrl, list_level) elseif (list_level == 2) then local binding = listData[2].binding local t = nil if (itemText == "GetClassArray") then t = CreatewxLuaBindClass(binding.GetClassArray) elseif (itemText == "GetFunctionArray") then t = CreatewxLuaBindMethod(binding.GetFunctionArray) elseif (itemText == "GetDefineArray") then t = CreatewxLuaBindDefine(binding.GetDefineArray) elseif (itemText == "GetStringArray") then t = CreatewxLuaBindString(binding.GetStringArray) elseif (itemText == "GetEventArray") then t = CreatewxLuaBindEvent(binding.GetEventArray) elseif (itemText == "GetObjectArray") then t = CreatewxLuaBindObject(binding.GetObjectArray) end if t ~= nil then list_level = list_level + 1 listData[list_level] = t GotoBindingLevel(listCtrl, list_level) end elseif (index > 0) and listData[list_level].object_type == "wxLuaBindClass" then local t = nil if ((col == 0) or (col == 1)) and (type(listData[list_level][index+1][2]) == "table") then t = CreatewxLuaBindMethod(listData[list_level][index+1][2]) elseif (col == 6) and (type(listData[list_level][index+1][col+1]) == "userdata") then t = CreatewxLuaBindClass({listData[list_level][index+1][col+1]}) elseif (col == 7) and (type(listData[list_level][index+1][col+1]) == "table") then t = CreatewxLuaBindDefine(listData[list_level][index+1][col+1]) end if t ~= nil then list_level = list_level + 1 listData[list_level] = t GotoBindingLevel(listCtrl, list_level) end elseif (index > 0) and listData[list_level].object_type == "wxLuaBindMethod" then local t = nil if (col == 2) and (type(listData[list_level][index+1][col+1]) == "table") then t = CreatewxLuaBindCFunc(listData[list_level][index+1][col+1]) elseif (col == 4) and (type(listData[list_level][index+1][col+1]) == "userdata") then t = CreatewxLuaBindMethod({listData[list_level][index+1][col+1]}) end if t ~= nil then list_level = list_level + 1 listData[list_level] = t GotoBindingLevel(listCtrl, list_level) end end event:Skip(); end) rootSizer = wx.wxBoxSizer(wx.wxVERTICAL); rootSizer:Add(listCtrl, 1, wx.wxEXPAND + wx.wxALL, 5); rootSizer:SetMinSize(450, 400); panel:SetSizer(rootSizer); rootSizer:SetSizeHints(frame); frame:Show(true) end main() |
From: John L. <jr...@us...> - 2007-06-08 01:36:49
|
Update of /cvsroot/wxlua/wxLua/modules/wxluasocket/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15480/wxLua/modules/wxluasocket/src Modified Files: wxluasocket.cpp wxluasocket_bind.cpp Log Message: Add a simple method to get the binding info, seems small and works well Addd sample lua program bindings.wx.lua to show them in a listctrl Fix incircles to work with new bindings Put the "name" of the struct binding items first always Index: wxluasocket_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxluasocket_bind.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** wxluasocket_bind.cpp 7 Jun 2007 03:22:10 -0000 1.18 --- wxluasocket_bind.cpp 8 Jun 2007 01:36:32 -0000 1.19 *************** *** 28,41 **** static wxLuaBindEvent eventList[] = { ! { &wxEVT_WXLUA_DEBUGGER_BREAK, "wxEVT_WXLUA_DEBUGGER_BREAK", &s_wxluatag_wxLuaDebuggerEvent }, ! { &wxEVT_WXLUA_DEBUGGER_DEBUGGEE_CONNECTED, "wxEVT_WXLUA_DEBUGGER_DEBUGGEE_CONNECTED", &s_wxluatag_wxLuaDebuggerEvent }, ! { &wxEVT_WXLUA_DEBUGGER_DEBUGGEE_DISCONNECTED, "wxEVT_WXLUA_DEBUGGER_DEBUGGEE_DISCONNECTED", &s_wxluatag_wxLuaDebuggerEvent }, ! { &wxEVT_WXLUA_DEBUGGER_ERROR, "wxEVT_WXLUA_DEBUGGER_ERROR", &s_wxluatag_wxLuaDebuggerEvent }, ! { &wxEVT_WXLUA_DEBUGGER_EVALUATE_EXPR, "wxEVT_WXLUA_DEBUGGER_EVALUATE_EXPR", &s_wxluatag_wxLuaDebuggerEvent }, ! { &wxEVT_WXLUA_DEBUGGER_EXIT, "wxEVT_WXLUA_DEBUGGER_EXIT", &s_wxluatag_wxLuaDebuggerEvent }, ! { &wxEVT_WXLUA_DEBUGGER_PRINT, "wxEVT_WXLUA_DEBUGGER_PRINT", &s_wxluatag_wxLuaDebuggerEvent }, ! { &wxEVT_WXLUA_DEBUGGER_STACK_ENTRY_ENUM, "wxEVT_WXLUA_DEBUGGER_STACK_ENTRY_ENUM", &s_wxluatag_wxLuaDebuggerEvent }, ! { &wxEVT_WXLUA_DEBUGGER_STACK_ENUM, "wxEVT_WXLUA_DEBUGGER_STACK_ENUM", &s_wxluatag_wxLuaDebuggerEvent }, ! { &wxEVT_WXLUA_DEBUGGER_TABLE_ENUM, "wxEVT_WXLUA_DEBUGGER_TABLE_ENUM", &s_wxluatag_wxLuaDebuggerEvent }, { 0, 0, 0 }, --- 28,41 ---- static wxLuaBindEvent eventList[] = { ! { "wxEVT_WXLUA_DEBUGGER_BREAK", &wxEVT_WXLUA_DEBUGGER_BREAK, &s_wxluatag_wxLuaDebuggerEvent }, ! { "wxEVT_WXLUA_DEBUGGER_DEBUGGEE_CONNECTED", &wxEVT_WXLUA_DEBUGGER_DEBUGGEE_CONNECTED, &s_wxluatag_wxLuaDebuggerEvent }, ! { "wxEVT_WXLUA_DEBUGGER_DEBUGGEE_DISCONNECTED", &wxEVT_WXLUA_DEBUGGER_DEBUGGEE_DISCONNECTED, &s_wxluatag_wxLuaDebuggerEvent }, ! { "wxEVT_WXLUA_DEBUGGER_ERROR", &wxEVT_WXLUA_DEBUGGER_ERROR, &s_wxluatag_wxLuaDebuggerEvent }, ! { "wxEVT_WXLUA_DEBUGGER_EVALUATE_EXPR", &wxEVT_WXLUA_DEBUGGER_EVALUATE_EXPR, &s_wxluatag_wxLuaDebuggerEvent }, ! { "wxEVT_WXLUA_DEBUGGER_EXIT", &wxEVT_WXLUA_DEBUGGER_EXIT, &s_wxluatag_wxLuaDebuggerEvent }, ! { "wxEVT_WXLUA_DEBUGGER_PRINT", &wxEVT_WXLUA_DEBUGGER_PRINT, &s_wxluatag_wxLuaDebuggerEvent }, ! { "wxEVT_WXLUA_DEBUGGER_STACK_ENTRY_ENUM", &wxEVT_WXLUA_DEBUGGER_STACK_ENTRY_ENUM, &s_wxluatag_wxLuaDebuggerEvent }, ! { "wxEVT_WXLUA_DEBUGGER_STACK_ENUM", &wxEVT_WXLUA_DEBUGGER_STACK_ENUM, &s_wxluatag_wxLuaDebuggerEvent }, ! { "wxEVT_WXLUA_DEBUGGER_TABLE_ENUM", &wxEVT_WXLUA_DEBUGGER_TABLE_ENUM, &s_wxluatag_wxLuaDebuggerEvent }, { 0, 0, 0 }, Index: wxluasocket.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxluasocket.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** wxluasocket.cpp 7 Jun 2007 03:22:10 -0000 1.24 --- wxluasocket.cpp 8 Jun 2007 01:36:32 -0000 1.25 *************** *** 423,447 **** // Map Lua Class Methods to C Binding Functions wxLuaBindMethod wxLuaDebuggerServer_methods[] = { ! { WXLUAMETHOD_METHOD, "AddBreakPoint", s_wxluafunc_wxLua_wxLuaDebuggerServer_AddBreakPoint, 1, NULL }, ! { WXLUAMETHOD_METHOD, "Break", s_wxluafunc_wxLua_wxLuaDebuggerServer_Break, 1, NULL }, ! { WXLUAMETHOD_METHOD, "ClearAllBreakPoints", s_wxluafunc_wxLua_wxLuaDebuggerServer_ClearAllBreakPoints, 1, NULL }, ! { WXLUAMETHOD_METHOD, "Continue", s_wxluafunc_wxLua_wxLuaDebuggerServer_Continue, 1, NULL }, ! { WXLUAMETHOD_METHOD, "Delete", s_wxluafunc_wxLua_wxLuaDebuggerServer_Delete, 1, NULL }, ! { WXLUAMETHOD_METHOD, "DisplayStackDialog", s_wxluafunc_wxLua_wxLuaDebuggerServer_DisplayStackDialog, 1, NULL }, ! { WXLUAMETHOD_METHOD, "EvaluateExpr", s_wxluafunc_wxLua_wxLuaDebuggerServer_EvaluateExpr, 1, NULL }, ! { WXLUAMETHOD_METHOD, "GetDebuggeeProcessId", s_wxluafunc_wxLua_wxLuaDebuggerServer_GetDebuggeeProcessId, 1, NULL }, ! { WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC, "GetNetworkName", s_wxluafunc_wxLua_wxLuaDebuggerServer_GetNetworkName, 1, NULL }, ! { WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC, "GetProgramName", s_wxluafunc_wxLua_wxLuaDebuggerServer_GetProgramName, 1, NULL }, ! { WXLUAMETHOD_METHOD, "KillDebuggee", s_wxluafunc_wxLua_wxLuaDebuggerServer_KillDebuggee, 1, NULL }, ! { WXLUAMETHOD_METHOD, "RemoveBreakPoint", s_wxluafunc_wxLua_wxLuaDebuggerServer_RemoveBreakPoint, 1, NULL }, ! { WXLUAMETHOD_METHOD, "Reset", s_wxluafunc_wxLua_wxLuaDebuggerServer_Reset, 1, NULL }, ! { WXLUAMETHOD_METHOD, "Run", s_wxluafunc_wxLua_wxLuaDebuggerServer_Run, 1, NULL }, ! { WXLUAMETHOD_METHOD, "StartClient", s_wxluafunc_wxLua_wxLuaDebuggerServer_StartClient, 1, NULL }, ! { WXLUAMETHOD_METHOD, "StartServer", s_wxluafunc_wxLua_wxLuaDebuggerServer_StartServer, 1, NULL }, ! { WXLUAMETHOD_METHOD, "Step", s_wxluafunc_wxLua_wxLuaDebuggerServer_Step, 1, NULL }, ! { WXLUAMETHOD_METHOD, "StepOut", s_wxluafunc_wxLua_wxLuaDebuggerServer_StepOut, 1, NULL }, ! { WXLUAMETHOD_METHOD, "StepOver", s_wxluafunc_wxLua_wxLuaDebuggerServer_StepOver, 1, NULL }, ! { WXLUAMETHOD_METHOD, "StopServer", s_wxluafunc_wxLua_wxLuaDebuggerServer_StopServer, 1, NULL }, ! { WXLUAMETHOD_CONSTRUCTOR, "wxLuaDebuggerServer", s_wxluafunc_wxLua_wxLuaDebuggerServer_constructor, 1, NULL }, { 0, 0, 0, 0 }, }; --- 423,447 ---- // Map Lua Class Methods to C Binding Functions wxLuaBindMethod wxLuaDebuggerServer_methods[] = { ! { "AddBreakPoint", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerServer_AddBreakPoint, 1, NULL }, ! { "Break", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerServer_Break, 1, NULL }, ! { "ClearAllBreakPoints", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerServer_ClearAllBreakPoints, 1, NULL }, ! { "Continue", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerServer_Continue, 1, NULL }, ! { "Delete", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerServer_Delete, 1, NULL }, ! { "DisplayStackDialog", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerServer_DisplayStackDialog, 1, NULL }, ! { "EvaluateExpr", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerServer_EvaluateExpr, 1, NULL }, ! { "GetDebuggeeProcessId", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerServer_GetDebuggeeProcessId, 1, NULL }, ! { "GetNetworkName", WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC, s_wxluafunc_wxLua_wxLuaDebuggerServer_GetNetworkName, 1, NULL }, ! { "GetProgramName", WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC, s_wxluafunc_wxLua_wxLuaDebuggerServer_GetProgramName, 1, NULL }, ! { "KillDebuggee", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerServer_KillDebuggee, 1, NULL }, ! { "RemoveBreakPoint", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerServer_RemoveBreakPoint, 1, NULL }, ! { "Reset", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerServer_Reset, 1, NULL }, ! { "Run", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerServer_Run, 1, NULL }, ! { "StartClient", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerServer_StartClient, 1, NULL }, ! { "StartServer", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerServer_StartServer, 1, NULL }, ! { "Step", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerServer_Step, 1, NULL }, ! { "StepOut", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerServer_StepOut, 1, NULL }, ! { "StepOver", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerServer_StepOver, 1, NULL }, ! { "StopServer", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerServer_StopServer, 1, NULL }, ! { "wxLuaDebuggerServer", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxLuaDebuggerServer_constructor, 1, NULL }, { 0, 0, 0, 0 }, }; *************** *** 549,557 **** // Map Lua Class Methods to C Binding Functions wxLuaBindMethod wxLuaDebuggerEvent_methods[] = { ! { WXLUAMETHOD_METHOD, "Delete", s_wxluafunc_wxLua_wxLuaDebuggerEvent_Delete, 1, NULL }, ! { WXLUAMETHOD_METHOD, "GetFileName", s_wxluafunc_wxLua_wxLuaDebuggerEvent_GetFileName, 1, NULL }, ! { WXLUAMETHOD_METHOD, "GetLineNumber", s_wxluafunc_wxLua_wxLuaDebuggerEvent_GetLineNumber, 1, NULL }, ! { WXLUAMETHOD_METHOD, "GetMessage", s_wxluafunc_wxLua_wxLuaDebuggerEvent_GetMessage, 1, NULL }, ! { WXLUAMETHOD_METHOD, "GetReference", s_wxluafunc_wxLua_wxLuaDebuggerEvent_GetReference, 1, NULL }, { 0, 0, 0, 0 }, }; --- 549,557 ---- // Map Lua Class Methods to C Binding Functions wxLuaBindMethod wxLuaDebuggerEvent_methods[] = { ! { "Delete", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerEvent_Delete, 1, NULL }, ! { "GetFileName", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerEvent_GetFileName, 1, NULL }, ! { "GetLineNumber", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerEvent_GetLineNumber, 1, NULL }, ! { "GetMessage", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerEvent_GetMessage, 1, NULL }, ! { "GetReference", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaDebuggerEvent_GetReference, 1, NULL }, { 0, 0, 0, 0 }, }; |
From: John L. <jr...@us...> - 2007-06-08 01:36:49
|
Update of /cvsroot/wxlua/wxLua/modules/wxbindstc/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15480/wxLua/modules/wxbindstc/src Modified Files: stc.cpp wxstc_bind.cpp Log Message: Add a simple method to get the binding info, seems small and works well Addd sample lua program bindings.wx.lua to show them in a listctrl Fix incircles to work with new bindings Put the "name" of the struct binding items first always Index: wxstc_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbindstc/src/wxstc_bind.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** wxstc_bind.cpp 7 Jun 2007 03:22:09 -0000 1.23 --- wxstc_bind.cpp 8 Jun 2007 01:36:31 -0000 1.24 *************** *** 28,62 **** static wxLuaBindEvent eventList[] = { ! { &wxEVT_STC_AUTOCOMP_SELECTION, "wxEVT_STC_AUTOCOMP_SELECTION", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_CALLTIP_CLICK, "wxEVT_STC_CALLTIP_CLICK", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_CHANGE, "wxEVT_STC_CHANGE", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_CHARADDED, "wxEVT_STC_CHARADDED", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_DOUBLECLICK, "wxEVT_STC_DOUBLECLICK", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_DO_DROP, "wxEVT_STC_DO_DROP", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_DRAG_OVER, "wxEVT_STC_DRAG_OVER", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_DWELLEND, "wxEVT_STC_DWELLEND", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_DWELLSTART, "wxEVT_STC_DWELLSTART", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_HOTSPOT_CLICK, "wxEVT_STC_HOTSPOT_CLICK", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_HOTSPOT_DCLICK, "wxEVT_STC_HOTSPOT_DCLICK", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_KEY, "wxEVT_STC_KEY", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_MACRORECORD, "wxEVT_STC_MACRORECORD", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_MARGINCLICK, "wxEVT_STC_MARGINCLICK", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_MODIFIED, "wxEVT_STC_MODIFIED", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_NEEDSHOWN, "wxEVT_STC_NEEDSHOWN", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_PAINTED, "wxEVT_STC_PAINTED", &s_wxluatag_wxStyledTextEvent }, #if !wxCHECK_VERSION(2,5,0) ! { &wxEVT_STC_POSCHANGED, "wxEVT_STC_POSCHANGED", &s_wxluatag_wxStyledTextEvent }, #endif // !wxCHECK_VERSION(2,5,0) ! { &wxEVT_STC_ROMODIFYATTEMPT, "wxEVT_STC_ROMODIFYATTEMPT", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_SAVEPOINTLEFT, "wxEVT_STC_SAVEPOINTLEFT", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_SAVEPOINTREACHED, "wxEVT_STC_SAVEPOINTREACHED", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_START_DRAG, "wxEVT_STC_START_DRAG", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_STYLENEEDED, "wxEVT_STC_STYLENEEDED", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_UPDATEUI, "wxEVT_STC_UPDATEUI", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_URIDROPPED, "wxEVT_STC_URIDROPPED", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_USERLISTSELECTION, "wxEVT_STC_USERLISTSELECTION", &s_wxluatag_wxStyledTextEvent }, ! { &wxEVT_STC_ZOOM, "wxEVT_STC_ZOOM", &s_wxluatag_wxStyledTextEvent }, { 0, 0, 0 }, --- 28,62 ---- static wxLuaBindEvent eventList[] = { ! { "wxEVT_STC_AUTOCOMP_SELECTION", &wxEVT_STC_AUTOCOMP_SELECTION, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_CALLTIP_CLICK", &wxEVT_STC_CALLTIP_CLICK, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_CHANGE", &wxEVT_STC_CHANGE, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_CHARADDED", &wxEVT_STC_CHARADDED, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_DOUBLECLICK", &wxEVT_STC_DOUBLECLICK, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_DO_DROP", &wxEVT_STC_DO_DROP, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_DRAG_OVER", &wxEVT_STC_DRAG_OVER, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_DWELLEND", &wxEVT_STC_DWELLEND, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_DWELLSTART", &wxEVT_STC_DWELLSTART, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_HOTSPOT_CLICK", &wxEVT_STC_HOTSPOT_CLICK, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_HOTSPOT_DCLICK", &wxEVT_STC_HOTSPOT_DCLICK, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_KEY", &wxEVT_STC_KEY, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_MACRORECORD", &wxEVT_STC_MACRORECORD, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_MARGINCLICK", &wxEVT_STC_MARGINCLICK, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_MODIFIED", &wxEVT_STC_MODIFIED, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_NEEDSHOWN", &wxEVT_STC_NEEDSHOWN, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_PAINTED", &wxEVT_STC_PAINTED, &s_wxluatag_wxStyledTextEvent }, #if !wxCHECK_VERSION(2,5,0) ! { "wxEVT_STC_POSCHANGED", &wxEVT_STC_POSCHANGED, &s_wxluatag_wxStyledTextEvent }, #endif // !wxCHECK_VERSION(2,5,0) ! { "wxEVT_STC_ROMODIFYATTEMPT", &wxEVT_STC_ROMODIFYATTEMPT, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_SAVEPOINTLEFT", &wxEVT_STC_SAVEPOINTLEFT, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_SAVEPOINTREACHED", &wxEVT_STC_SAVEPOINTREACHED, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_START_DRAG", &wxEVT_STC_START_DRAG, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_STYLENEEDED", &wxEVT_STC_STYLENEEDED, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_UPDATEUI", &wxEVT_STC_UPDATEUI, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_URIDROPPED", &wxEVT_STC_URIDROPPED, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_USERLISTSELECTION", &wxEVT_STC_USERLISTSELECTION, &s_wxluatag_wxStyledTextEvent }, ! { "wxEVT_STC_ZOOM", &wxEVT_STC_ZOOM, &s_wxluatag_wxStyledTextEvent }, { 0, 0, 0 }, Index: stc.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbindstc/src/stc.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** stc.cpp 7 Jun 2007 03:22:09 -0000 1.36 --- stc.cpp 8 Jun 2007 01:36:30 -0000 1.37 *************** *** 7993,8548 **** // Map Lua Class Methods to C Binding Functions wxLuaBindMethod wxStyledTextCtrl_methods[] = { ! { WXLUAMETHOD_METHOD, "AddRefDocument", s_wxluafunc_wxLua_wxStyledTextCtrl_AddRefDocument, 1, NULL }, ! { WXLUAMETHOD_METHOD, "AddText", s_wxluafunc_wxLua_wxStyledTextCtrl_AddText, 1, NULL }, ! { WXLUAMETHOD_METHOD, "AddTextRaw", s_wxluafunc_wxLua_wxStyledTextCtrl_AddTextRaw, 1, NULL }, ! { WXLUAMETHOD_METHOD, "Allocate", s_wxluafunc_wxLua_wxStyledTextCtrl_Allocate, 1, NULL }, ! { WXLUAMETHOD_METHOD, "AppendText", s_wxluafunc_wxLua_wxStyledTextCtrl_AppendText, 1, NULL }, ! { WXLUAMETHOD_METHOD, "AutoCompActive", s_wxluafunc_wxLua_wxStyledTextCtrl_AutoCompActive, 1, NULL }, ! { WXLUAMETHOD_METHOD, "AutoCompCancel", s_wxluafunc_wxLua_wxStyledTextCtrl_AutoCompCancel, 1, NULL }, ! { WXLUAMETHOD_METHOD, "AutoCompComplete", s_wxluafunc_wxLua_wxStyledTextCtrl_AutoCompComplete, 1, NULL }, [...1200 lines suppressed...] ! { "SetFoldLevelNow", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxStyledTextEvent_SetFoldLevelNow, 1, NULL }, ! { "SetFoldLevelPrev", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxStyledTextEvent_SetFoldLevelPrev, 1, NULL }, ! { "SetKey", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxStyledTextEvent_SetKey, 1, NULL }, ! { "SetLParam", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxStyledTextEvent_SetLParam, 1, NULL }, ! { "SetLength", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxStyledTextEvent_SetLength, 1, NULL }, ! { "SetLine", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxStyledTextEvent_SetLine, 1, NULL }, ! { "SetLinesAdded", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxStyledTextEvent_SetLinesAdded, 1, NULL }, ! { "SetListType", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxStyledTextEvent_SetListType, 1, NULL }, ! { "SetMargin", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxStyledTextEvent_SetMargin, 1, NULL }, ! { "SetMessage", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxStyledTextEvent_SetMessage, 1, NULL }, ! { "SetModificationType", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxStyledTextEvent_SetModificationType, 1, NULL }, ! { "SetModifiers", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxStyledTextEvent_SetModifiers, 1, NULL }, ! { "SetPosition", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxStyledTextEvent_SetPosition, 1, NULL }, ! { "SetText", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxStyledTextEvent_SetText, 1, NULL }, ! { "SetWParam", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxStyledTextEvent_SetWParam, 1, NULL }, ! { "SetX", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxStyledTextEvent_SetX, 1, NULL }, ! { "SetY", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxStyledTextEvent_SetY, 1, NULL }, ! { "wxStyledTextEvent", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxStyledTextEvent_constructor, 1, NULL }, { 0, 0, 0, 0 }, }; |
From: John L. <jr...@us...> - 2007-06-08 01:36:49
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15480/wxLua/modules/wxluadebug/src Modified Files: wxlstack.cpp Log Message: Add a simple method to get the binding info, seems small and works well Addd sample lua program bindings.wx.lua to show them in a listctrl Fix incircles to work with new bindings Put the "name" of the struct binding items first always Index: wxlstack.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxlstack.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wxlstack.cpp 31 May 2007 21:38:49 -0000 1.3 --- wxlstack.cpp 8 Jun 2007 01:36:32 -0000 1.4 *************** *** 587,591 **** void wxLuaStackDialog::OnItemActivated(wxListEvent &event) { ! ExpandItem(event.GetIndex()); //.GetIndex()); } --- 587,591 ---- void wxLuaStackDialog::OnItemActivated(wxListEvent &event) { ! ExpandItem(event.GetIndex()); } |
From: John L. <jr...@us...> - 2007-06-08 01:36:49
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15480/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxldefs.h Log Message: Add a simple method to get the binding info, seems small and works well Addd sample lua program bindings.wx.lua to show them in a listctrl Fix incircles to work with new bindings Put the "name" of the struct binding items first always Index: wxldefs.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxldefs.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** wxldefs.h 6 Jun 2007 23:43:16 -0000 1.19 --- wxldefs.h 8 Jun 2007 01:36:31 -0000 1.20 *************** *** 57,61 **** //----------------------------------------------------------------------------- ! #define WXLUA_BINDING_VERSION 9 // ---------------------------------------------------------------------------- --- 57,61 ---- //----------------------------------------------------------------------------- ! #define WXLUA_BINDING_VERSION 10 // ---------------------------------------------------------------------------- Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** wxlbind.h 6 Jun 2007 23:43:16 -0000 1.43 --- wxlbind.h 8 Jun 2007 01:36:31 -0000 1.44 *************** *** 73,83 **** int maxargs; // total number of args allowed wxLuaArgTag* argtags; // array of lua tags representing each argument, zero terminated }; struct WXDLLIMPEXP_WXLUA wxLuaBindMethod // defines a LUA method or property { - int type; // wxLuaMethod_Type flags for this method - // note each func has own type, this is ored values of them const char *name; // name of the method or property wxLuaBindCFunc *funcs; // array of functions for this method int funcs_n; // number of functions (overloaded > 1) for this method --- 73,86 ---- int maxargs; // total number of args allowed wxLuaArgTag* argtags; // array of lua tags representing each argument, zero terminated + // NOTE: there may less argtags than maxargs if this is an + // overloaded function since the argtags == s_wxluaargArray_None + // but the maxargs is the maxargs of all the overloaded functions }; struct WXDLLIMPEXP_WXLUA wxLuaBindMethod // defines a LUA method or property { const char *name; // name of the method or property + int type; // wxLuaMethod_Type flags for this method + // note each func has own type, this is ored values of them wxLuaBindCFunc *funcs; // array of functions for this method int funcs_n; // number of functions (overloaded > 1) for this method *************** *** 127,132 **** struct WXDLLIMPEXP_WXLUA wxLuaBindEvent // defines a wxWidgets Event for wxLua { - const int *eventType; // wxWidgets event type, e.g. &wxEVT_COMMAND_MENU_SELECTED const char *name; // name of the event, e.g. "wxEVT_COMMAND_MENU_SELECTED" int *class_tag; // lua class tag, e.g. &s_wxluatag_wxCommandEvent }; --- 130,135 ---- struct WXDLLIMPEXP_WXLUA wxLuaBindEvent // defines a wxWidgets Event for wxLua { const char *name; // name of the event, e.g. "wxEVT_COMMAND_MENU_SELECTED" + const int *eventType; // wxWidgets event type, e.g. &wxEVT_COMMAND_MENU_SELECTED int *class_tag; // lua class tag, e.g. &s_wxluatag_wxCommandEvent }; *************** *** 145,149 **** wxLuaBindMethod *methods; // pointer to methods for this class int methods_n; // number of methods ! wxClassInfo *pClassInfo; // pointer to the wxClassInfo associated with this class int *class_tag; // lua tag for user data allocated by ourselves const char *baseclassName; // name of base class --- 148,152 ---- wxLuaBindMethod *methods; // pointer to methods for this class int methods_n; // number of methods ! wxClassInfo *classInfo; // pointer to the wxClassInfo associated with this class int *class_tag; // lua tag for user data allocated by ourselves const char *baseclassName; // name of base class |