# HG changeset patch # User laurent # Date 1333199388 -7200 # Node ID 6ec28dc375cf7ec104ff86a9d42da307f36f7981 # Parent 6880c88e499e2173ef26839bdcb86b80d9c230e8 Fixing menu toolbar icons on Windows diff -r 6880c88e499e -r 6ec28dc375cf Beremiz.py --- a/Beremiz.py Wed Mar 28 00:05:35 2012 +0200 +++ b/Beremiz.py Sat Mar 31 15:09:48 2012 +0200 @@ -423,11 +423,11 @@ self.Bind(wx.EVT_MENU, self.OnPropertiesMenu, id=wx.ID_PROPERTIES) self.Bind(wx.EVT_MENU, self.OnQuitMenu, id=wx.ID_EXIT) - self.AddToMenuToolBar([(wx.ID_NEW, wx.ART_NEW, _(u'New'), None), - (wx.ID_OPEN, wx.ART_FILE_OPEN, _(u'Open'), None), - (wx.ID_SAVE, wx.ART_FILE_SAVE, _(u'Save'), None), - (wx.ID_SAVEAS, wx.ART_FILE_SAVE_AS, _(u'Save As...'), None), - (wx.ID_PRINT, wx.ART_PRINT, _(u'Print'), None)]) + self.AddToMenuToolBar([(wx.ID_NEW, "new.png", _(u'New'), None), + (wx.ID_OPEN, "open.png", _(u'Open'), None), + (wx.ID_SAVE, "save.png", _(u'Save'), None), + (wx.ID_SAVEAS, "saveas.png", _(u'Save As...'), None), + (wx.ID_PRINT, "print.png", _(u'Print'), None)]) def _init_coll_HelpMenu_Items(self, parent): parent.Append(help='', id=wx.ID_HELP, @@ -1367,6 +1367,7 @@ main_menu.Append(help=help, id=new_id, kind=wx.ITEM_NORMAL, text=_("Append ")+help) self.Bind(wx.EVT_MENU, self._GetAddPluginFunction(name, plugin), id=new_id) self.PopupMenuXY(main_menu) + main_menu.Destroy() return AddPluginMenu def GetButtonCallBackFunction(self, plugin, method): diff -r 6880c88e499e -r 6ec28dc375cf LPCBeremiz.py --- a/LPCBeremiz.py Wed Mar 28 00:05:35 2012 +0200 +++ b/LPCBeremiz.py Sat Mar 31 15:09:48 2012 +0200 @@ -768,6 +768,80 @@ """ + def Generate_lpc_retain_array_sim(self): + """ + Support for retain array in Simulation + """ + return """/* Support for retain array */ +#define USER_RETAIN_ARRAY_SIZE 2000 +#define NUM_OF_COLS 3 +unsigned char readOK = 0; +unsigned int foundIndex = USER_RETAIN_ARRAY_SIZE; +unsigned int retainArray[USER_RETAIN_ARRAY_SIZE][NUM_OF_COLS]; + +unsigned int __GetRetainData(unsigned char READ, unsigned int INDEX, unsigned int COLUMN) +{ + if(READ == 1) + { + if((0<=INDEX) && (INDEX return index that is out of array bounds */ + return 0; +} + +/* Since Beremiz debugger doesn't like pointer-by-reference stuff or global varibles, separate function is a must */ +unsigned char __GetReadStatus(unsigned char dummy) +{ + return readOK; +} + +unsigned int __GetFoundIndex(unsigned char dummy) +{ + return foundIndex; +} +""" + def _Simulate(self): """ Method called by user to Simulate PLC @@ -834,7 +908,9 @@ # init/cleanup/retrieve/publish, run and align code (self.Generate_plc_common_main,"plc_common_main.c","Common runtime"), # declare located variables for simulate in a black box - (self.Generate_plc_declare_locations,"plc_declare_locations.c","Declare Locations")]: + (self.Generate_plc_declare_locations,"plc_declare_locations.c","Declare Locations"), + # declare located variables for simulate in a black box + (self.Generate_lpc_retain_array_sim,"lpc_retain_array_sim.c","Retain Array for Simulation")]: try: # Do generate code = generator() @@ -1004,8 +1080,8 @@ self.Bind(wx.EVT_MENU, self.OnPropertiesMenu, id=wx.ID_PROPERTIES) self.Bind(wx.EVT_MENU, self.OnQuitMenu, id=wx.ID_EXIT) - self.AddToMenuToolBar([(wx.ID_SAVE, wx.ART_FILE_SAVE, _(u'Save'), None), - (wx.ID_PRINT, wx.ART_PRINT, _(u'Print'), None)]) + self.AddToMenuToolBar([(wx.ID_SAVE, "save.png", _(u'Save'), None), + (wx.ID_PRINT, "print.png", _(u'Print'), None)]) def _init_ctrls(self, prnt): IDEFrame._init_ctrls(self, prnt) @@ -1064,6 +1140,7 @@ dialog.Destroy() def RefreshFileMenu(self): + MenuToolBar = self.Panes["MenuToolBar"] if self.PluginRoot is not None: selected = self.TabsOpened.GetSelection() if selected >= 0: diff -r 6880c88e499e -r 6ec28dc375cf plugins/c_ext/CFileEditor.py --- a/plugins/c_ext/CFileEditor.py Wed Mar 28 00:05:35 2012 +0200 +++ b/plugins/c_ext/CFileEditor.py Sat Mar 31 15:09:48 2012 +0200 @@ -657,7 +657,9 @@ self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(datatype), id=new_id) type_menu.AppendMenu(wx.NewId(), "User Data Types", datatype_menu) rect = self.VariablesGrid.BlockToDeviceRect((row, col), (row, col)) + self.VariablesGrid.PopupMenuXY(type_menu, rect.x + rect.width, rect.y + self.VariablesGrid.GetColLabelSize()) + type_menu.Destroy() event.Veto() else: event.Skip()