From: John L. <jr...@us...> - 2007-06-30 18:18:49
|
Update of /cvsroot/wxlua/wxLua/samples In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv27412/wxLua/samples Modified Files: scribble.wx.lua settings.wx.lua Removed Files: fldemo.wx.lua Log Message: Remove fl lib, it's not going to be used fix toolbar in scribble Index: scribble.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/scribble.wx.lua,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** scribble.wx.lua 14 Jun 2007 01:23:20 -0000 1.20 --- scribble.wx.lua 30 Jun 2007 18:18:45 -0000 1.21 *************** *** 61,89 **** -- Drawing functions -- --------------------------------------------------------------------------- - function CreateToolBarColourBitmap(size) - local w, h = size:GetWidth(), size:GetHeight() - local bmp = wx.wxBitmap(w, h) - local memDC = wx.wxMemoryDC() - memDC:SelectObject(bmp) -- select our bitmap to draw into - - local colour = currentPen:GetColour() - local brush = wx.wxBrush(colour, wx.wxSOLID) - memDC:SetBrush(brush) - memDC:DrawRectangle(0, 0, w, h) - memDC:SetBrush(wx.wxRED_BRUSH) - memDC:DrawRectangle(0, 0, w/3, h) - memDC:SetBrush(wx.wxGREEN_BRUSH) - memDC:DrawRectangle(w/3, 0, w/3, h) - memDC:SetBrush(wx.wxBLUE_BRUSH) - memDC:DrawRectangle(2*math.floor(w/3), 0, w/3, h) - - memDC:SelectObject(wx.wxNullBitmap) -- always release bitmap - memDC:delete() - brush:delete() - colour:delete() - - return bmp - end - function DrawPoints(drawDC) if lastDrawn == 0 then --- 61,64 ---- *************** *** 367,371 **** penWidthSpinCtrl = wx.wxSpinCtrl(toolBar, ID_PENWIDTH_SPINCTRL, "3", ! wx.wxDefaultPosition, wx.wxDefaultSize, wx.wxSP_ARROW_KEYS, 1, 100, 3) local w, h = penWidthSpinCtrl:GetSizeWH() penWidthSpinCtrl:SetSize(3*h, -1) --- 342,347 ---- penWidthSpinCtrl = wx.wxSpinCtrl(toolBar, ID_PENWIDTH_SPINCTRL, "3", ! wx.wxDefaultPosition, wx.wxDefaultSize, ! wx.wxSP_ARROW_KEYS, 1, 100, 3) local w, h = penWidthSpinCtrl:GetSizeWH() penWidthSpinCtrl:SetSize(3*h, -1) *************** *** 374,380 **** toolBar:AddSeparator() ! local bmp = CreateToolBarColourBitmap(toolBmpSize) ! toolBar:AddTool(ID_PENCOLOUR, "Color", bmp, "Choose pen color") ! bmp:delete() -- Create a custom control to choose some common colours. --- 350,366 ---- toolBar:AddSeparator() ! colourPicker = wx.wxColourPickerCtrl(toolBar, ID_PENCOLOUR, wx.wxBLACK, ! wx.wxDefaultPosition, toolBmpSize:op_sub(wx.wxSize(2,2)), ! wx.wxCLRP_DEFAULT_STYLE) ! colourPicker:SetToolTip("Choose pen color") ! colourPicker:Connect(wx.wxEVT_COMMAND_COLOURPICKER_CHANGED, ! function(event) ! local c = event:GetColour() ! currentPen:SetColour(c) ! c:delete() ! end) ! ! toolBar:AddControl(colourPicker) ! toolBar:AddSeparator() -- Create a custom control to choose some common colours. *************** *** 383,389 **** wx.wxDefaultPosition, wx.wxSize(4*colourWin_height, colourWin_height), wx.wxBORDER_NONE) local colourWinColours = { "black", "grey", "brown", "red", "orange", "green", "blue", "violet", ! "white", "light grey", "tan", "pink", "yellow", "turquoise", "sky blue", "maroon" } local colourWinBmp = wx.wxBitmap(4*colourWin_height, colourWin_height) --- 369,378 ---- wx.wxDefaultPosition, wx.wxSize(4*colourWin_height, colourWin_height), wx.wxBORDER_NONE) + -- Need help in GTK to ensure that it's positioned correctly + colourWin:SetMinSize(wx.wxSize(4*colourWin_height, colourWin_height)) + local colourWinColours = { "black", "grey", "brown", "red", "orange", "green", "blue", "violet", ! "white", "light grey", "tan", "pink", "yellow", "turquoise", "sky blue", "maroon" } local colourWinBmp = wx.wxBitmap(4*colourWin_height, colourWin_height) *************** *** 424,430 **** --- 413,432 ---- local c = wx.wxColour(colourWinColours[i]) currentPen:SetColour(c) + colourPicker:SetColour(c) c:delete() end end) + colourWin:Connect(wx.wxEVT_MOTION, + 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 + local s = "Set pen color : "..colourWinColours[i] + if colourWin:GetToolTip() ~= s then + colourWin:SetToolTip(s) + end + end + end) toolBar:AddControl(colourWin) *************** *** 545,548 **** --- 547,551 ---- if c:Ok() then -- returns invalid colour if canceled currentPen:SetColour(c) + colourPicker:SetColour(c) end c:delete() Index: settings.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/settings.wx.lua,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** settings.wx.lua 19 Jun 2007 13:58:16 -0000 1.2 --- settings.wx.lua 30 Jun 2007 18:18:46 -0000 1.3 *************** *** 69,73 **** AddListItem({"wx.wxFileName.IsCaseSensitive()", wx.wxFileName.IsCaseSensitive()}) AddListItem({"wx.wxFileName.GetVolumeSeparator()", wx.wxFileName.GetVolumeSeparator()}) - AddListItem({"wx.wxFileName.GetVolumeSeparator()", wx.wxFileName.GetVolumeSeparator()}) --- 69,72 ---- *************** *** 152,156 **** AddListItem({"wx.wxStandardPaths:GetPluginsDir()", stdpaths:GetPluginsDir()}) AddListItem({"wx.wxStandardPaths:GetResourcesDir()", stdpaths:GetResourcesDir()}) ! --AddListItem({"wx.wxStandardPaths:GetLocalizedResourcesDir()", stdpaths:GetLocalizedResourcesDir()}) AddListItem({"wx.wxStandardPaths:GetDocumentsDir()", stdpaths:GetDocumentsDir()}) AddListItem({"wx.wxStandardPaths:GetTempDir()", stdpaths:GetTempDir()}) --- 151,155 ---- AddListItem({"wx.wxStandardPaths:GetPluginsDir()", stdpaths:GetPluginsDir()}) AddListItem({"wx.wxStandardPaths:GetResourcesDir()", stdpaths:GetResourcesDir()}) ! AddListItem({"wx.wxStandardPaths:GetLocalizedResourcesDir(\"\")", stdpaths:GetLocalizedResourcesDir("")}) AddListItem({"wx.wxStandardPaths:GetDocumentsDir()", stdpaths:GetDocumentsDir()}) AddListItem({"wx.wxStandardPaths:GetTempDir()", stdpaths:GetTempDir()}) --- fldemo.wx.lua DELETED --- |