mirror of
https://github.com/lalbornoz/roar.git
synced 2024-12-23 04:46:37 +00:00
MiRCARTFrame:MiRCARTFrame.TID_SELECT, [CM]ID_*: adds selectable item type.
MiRCARTFrame:MiRCARTFrame.{_initMenus,__init__}(): automatically set menu item initial state.
This commit is contained in:
parent
1c5f869c40
commit
f6911293c3
@ -36,30 +36,31 @@ class MiRCARTFrame(wx.Frame):
|
||||
TID_COMMAND = (0x001)
|
||||
TID_NOTHING = (0x002)
|
||||
TID_MENU = (0x003)
|
||||
TID_TOOLBAR = (0x004)
|
||||
TID_ACCELS = (0x005)
|
||||
TID_SELECT = (0x004)
|
||||
TID_TOOLBAR = (0x005)
|
||||
TID_ACCELS = (0x006)
|
||||
# }}}
|
||||
# {{{ Commands
|
||||
# Id Type Id Labels Icon bitmap Accelerator
|
||||
# Id Type Id Labels Icon bitmap Accelerator [Initial state]
|
||||
CID_NEW = (0x100, TID_COMMAND, "New", "&New", [wx.ART_NEW], None)
|
||||
CID_OPEN = (0x101, TID_COMMAND, "Open", "&Open", [wx.ART_FILE_OPEN], None)
|
||||
CID_SAVE = (0x102, TID_COMMAND, "Save", "&Save", [wx.ART_FILE_SAVE], None)
|
||||
CID_SAVEAS = (0x103, TID_COMMAND, "Save As...", "Save &As...", [wx.ART_FILE_SAVE_AS], None)
|
||||
CID_EXPORT_AS_PNG = (0x104, TID_COMMAND, "Export as PNG...", "Export as PN&G...", (), None)
|
||||
CID_EXPORT_PASTEBIN = (0x105, TID_COMMAND, "Export to Pastebin...", "Export to Pasteb&in...", (), None)
|
||||
CID_EXPORT_AS_PNG = (0x104, TID_COMMAND, "Export as PNG...", "Export as PN&G...", (), None, False)
|
||||
CID_EXPORT_PASTEBIN = (0x105, TID_COMMAND, "Export to Pastebin...", "Export to Pasteb&in...", (), None, False)
|
||||
CID_EXIT = (0x106, TID_COMMAND, "Exit", "E&xit", (), None)
|
||||
CID_UNDO = (0x107, TID_COMMAND, "Undo", "&Undo", [wx.ART_UNDO], (wx.ACCEL_CTRL, ord("Z")))
|
||||
CID_REDO = (0x108, TID_COMMAND, "Redo", "&Redo", [wx.ART_REDO], (wx.ACCEL_CTRL, ord("Y")))
|
||||
CID_CUT = (0x109, TID_COMMAND, "Cut", "Cu&t", [wx.ART_CUT], None)
|
||||
CID_COPY = (0x10a, TID_COMMAND, "Copy", "&Copy", [wx.ART_COPY], None)
|
||||
CID_PASTE = (0x10b, TID_COMMAND, "Paste", "&Paste", [wx.ART_PASTE], None)
|
||||
CID_DELETE = (0x10c, TID_COMMAND, "Delete", "De&lete", [wx.ART_DELETE], None)
|
||||
CID_UNDO = (0x107, TID_COMMAND, "Undo", "&Undo", [wx.ART_UNDO], (wx.ACCEL_CTRL, ord("Z")), False)
|
||||
CID_REDO = (0x108, TID_COMMAND, "Redo", "&Redo", [wx.ART_REDO], (wx.ACCEL_CTRL, ord("Y")), False)
|
||||
CID_CUT = (0x109, TID_COMMAND, "Cut", "Cu&t", [wx.ART_CUT], None, False)
|
||||
CID_COPY = (0x10a, TID_COMMAND, "Copy", "&Copy", [wx.ART_COPY], None, False)
|
||||
CID_PASTE = (0x10b, TID_COMMAND, "Paste", "&Paste", [wx.ART_PASTE], None, False)
|
||||
CID_DELETE = (0x10c, TID_COMMAND, "Delete", "De&lete", [wx.ART_DELETE], None, False)
|
||||
CID_INCRBRUSH = (0x10d, TID_COMMAND, "Increase brush size", "&Increase brush size", [wx.ART_PLUS], None)
|
||||
CID_DECRBRUSH = (0x10e, TID_COMMAND, "Decrease brush size", "&Decrease brush size", [wx.ART_MINUS], None)
|
||||
CID_SOLIDBRUSH = (0x10f, TID_COMMAND, "Solid brush", "&Solid brush", [None], None)
|
||||
CID_RECT = (0x110, TID_COMMAND, "Rectangle", "&Rectangle", [None], None)
|
||||
CID_CIRCLE = (0x111, TID_COMMAND, "Circle", "&Circle", [None], None)
|
||||
CID_LINE = (0x112, TID_COMMAND, "Line", "&Line", [None], None)
|
||||
CID_SOLID_BRUSH = (0x10f, TID_SELECT, "Solid brush", "&Solid brush", [None], None, True)
|
||||
CID_RECT = (0x110, TID_SELECT, "Rectangle", "&Rectangle", [None], None, True)
|
||||
CID_CIRCLE = (0x111, TID_SELECT, "Circle", "&Circle", [None], None, False)
|
||||
CID_LINE = (0x112, TID_SELECT, "Line", "&Line", [None], None, False)
|
||||
CID_COLOUR00 = (0x113, TID_COMMAND, "Colour #00", "Colour #00", MiRCARTColours[0], None)
|
||||
CID_COLOUR01 = (0x114, TID_COMMAND, "Colour #01", "Colour #01", MiRCARTColours[1], None)
|
||||
CID_COLOUR02 = (0x115, TID_COMMAND, "Colour #02", "Colour #02", MiRCARTColours[2], None)
|
||||
@ -89,7 +90,7 @@ class MiRCARTFrame(wx.Frame):
|
||||
MID_EDIT = (0x301, TID_MENU, "Edit", "&Edit", ( \
|
||||
CID_UNDO, CID_REDO, NID_MENU_SEP, \
|
||||
CID_CUT, CID_COPY, CID_PASTE, CID_DELETE, NID_MENU_SEP, \
|
||||
CID_INCRBRUSH, CID_DECRBRUSH, CID_SOLIDBRUSH))
|
||||
CID_INCRBRUSH, CID_DECRBRUSH, CID_SOLID_BRUSH))
|
||||
MID_TOOLS = (0x302, TID_MENU, "Tools", "&Tools", ( \
|
||||
CID_RECT, CID_CIRCLE, CID_LINE))
|
||||
# }}}
|
||||
@ -98,7 +99,7 @@ class MiRCARTFrame(wx.Frame):
|
||||
CID_NEW, CID_OPEN, CID_SAVE, CID_SAVEAS, NID_TOOLBAR_SEP, \
|
||||
CID_UNDO, CID_REDO, NID_TOOLBAR_SEP, \
|
||||
CID_CUT, CID_COPY, CID_PASTE, CID_DELETE, NID_TOOLBAR_SEP, \
|
||||
CID_INCRBRUSH, CID_DECRBRUSH, CID_SOLIDBRUSH, NID_TOOLBAR_SEP, \
|
||||
CID_INCRBRUSH, CID_DECRBRUSH, CID_SOLID_BRUSH, NID_TOOLBAR_SEP, \
|
||||
CID_RECT, CID_CIRCLE, CID_LINE, NID_TOOLBAR_SEP, \
|
||||
CID_COLOUR00, CID_COLOUR01, CID_COLOUR02, CID_COLOUR03, CID_COLOUR04, \
|
||||
CID_COLOUR05, CID_COLOUR06, CID_COLOUR07, CID_COLOUR08, CID_COLOUR09, \
|
||||
@ -136,10 +137,18 @@ class MiRCARTFrame(wx.Frame):
|
||||
for menuItem in menuDescr[4]:
|
||||
if menuItem == self.NID_MENU_SEP:
|
||||
menuWindow.AppendSeparator()
|
||||
elif menuItem[1] == self.TID_SELECT:
|
||||
menuItemWindow = menuWindow.AppendRadioItem(menuItem[0], menuItem[3], menuItem[2])
|
||||
self.menuItemsById[menuItem[0]] = menuItemWindow
|
||||
self.Bind(wx.EVT_MENU, handler, menuItemWindow)
|
||||
if len(menuItem) == 7:
|
||||
menuItemWindow.Check(menuItem[6])
|
||||
else:
|
||||
menuItemWindow = menuWindow.Append(menuItem[0], menuItem[3], menuItem[2])
|
||||
self.menuItemsById[menuItem[0]] = menuItemWindow
|
||||
self.Bind(wx.EVT_MENU, handler, menuItemWindow)
|
||||
if len(menuItem) == 7:
|
||||
menuItemWindow.Enable(menuItem[6])
|
||||
menuBar.Append(menuWindow, menuDescr[3])
|
||||
# }}}
|
||||
# {{{ _initToolBars(self, toolBar, toolBarsDescr, handler): XXX
|
||||
@ -284,7 +293,7 @@ class MiRCARTFrame(wx.Frame):
|
||||
pass
|
||||
elif cid == self.CID_DECRBRUSH[0]:
|
||||
pass
|
||||
elif cid == self.CID_SOLIDBRUSH[0]:
|
||||
elif cid == self.CID_SOLID_BRUSH[0]:
|
||||
pass
|
||||
elif cid == self.CID_RECT[0]:
|
||||
pass
|
||||
@ -319,12 +328,6 @@ class MiRCARTFrame(wx.Frame):
|
||||
self._initMenus(self.menuBar, \
|
||||
[self.MID_FILE, self.MID_EDIT, self.MID_TOOLS], self.onFrameCommand)
|
||||
self.SetMenuBar(self.menuBar)
|
||||
self.menuItemsById[self.CID_COPY[0]].Enable(False)
|
||||
self.menuItemsById[self.CID_CUT[0]].Enable(False)
|
||||
self.menuItemsById[self.CID_DELETE[0]].Enable(False)
|
||||
self.menuItemsById[self.CID_PASTE[0]].Enable(False)
|
||||
self.menuItemsById[self.CID_EXPORT_PASTEBIN[0]].Enable(False)
|
||||
self.menuItemsById[self.CID_EXPORT_AS_PNG[0]].Enable(False)
|
||||
|
||||
self.toolBar = wx.ToolBar(self.panelSkin, -1, \
|
||||
style=wx.HORIZONTAL|wx.TB_FLAT|wx.TB_NODIVIDER)
|
||||
|
Loading…
Reference in New Issue
Block a user