Patch #2921 2010-02-03 06:20

cryogen

Adds code insertion to wxSmiths Image editor
Download
2921-Adds_code_inse.patch (44.7 KB)
Category
Plugin::FeatureAdd
Status
Accepted
Close date
2012-10-23 06:56
Assigned to
mortenmacfly
Index: src/i18n/extract_win.bat
===================================================================
--- src/i18n/extract_win.bat    (revision 6130)
+++ src/i18n/extract_win.bat    (working copy)
@@ -64,7 +64,7 @@
 goto TheEnd
 
 :Error
-echo Error: At least one requited tools was not found.
+echo Error: At least one required tool was not found.
 echo Make sure you have the following tools in the PATH:
 echo - grep, xargs, xgettext, msginit
 echo They are all part of the GnuWin32 tools (package gettext).
Index: src/plugins/contrib/wxSmith/wxsmith/wxsBitmapIconEditorDlg.wxs
===================================================================
--- src/plugins/contrib/wxSmith/wxsmith/wxsBitmapIconEditorDlg.wxs    (revision 6130)
+++ src/plugins/contrib/wxSmith/wxsmith/wxsBitmapIconEditorDlg.wxs    (working copy)
@@ -1,187 +1,217 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <wxsmith>
-    <object class="wxScrollingDialog" name="wxsBitmapIconEditorDlg">
-        <title>Image editor</title>
-        <style>wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</style>
-        <object class="wxBoxSizer" variable="BoxSizer1" member="yes">
-            <orient>wxVERTICAL</orient>
-            <object class="sizeritem">
-                <object class="wxBoxSizer" variable="BoxSizer5" member="yes">
-                    <object class="sizeritem">
-                        <object class="wxStaticBoxSizer" variable="StaticBoxSizer1" member="yes">
-                            <label>Image options</label>
-                            <object class="sizeritem">
-                                <object class="wxFlexGridSizer" variable="FlexGridSizer1" member="yes">
-                                    <cols>1</cols>
-                                    <growablecols>1</growablecols>
-                                    <object class="sizeritem">
-                                        <object class="wxRadioButton" name="ID_RADIOBUTTON1" variable="NoImage" member="yes">
-                                            <label>No image</label>
-                                            <handler function="OnUpdatePreview" entry="EVT_RADIOBUTTON" />
-                                        </object>
-                                        <flag>wxTOP|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                                        <border>5</border>
-                                        <option>1</option>
-                                    </object>
-                                    <object class="spacer">
-                                        <flag>wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</flag>
-                                        <border>5</border>
-                                        <option>1</option>
-                                        <size>1,1</size>
-                                    </object>
-                                    <object class="sizeritem">
-                                        <object class="wxRadioButton" name="ID_RADIOBUTTON2" variable="ImageFile" member="yes">
-                                            <label>Image From File:</label>
-                                            <handler function="OnUpdatePreview" entry="EVT_RADIOBUTTON" />
-                                        </object>
-                                        <flag>wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
-                                        <border>5</border>
-                                        <option>1</option>
-                                    </object>
-                                    <object class="sizeritem">
-                                        <object class="wxBoxSizer" variable="BoxSizer2" member="yes">
-                                            <object class="spacer">
-                                                <flag>wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</flag>
-                                                <border>5</border>
-                                                <size>20,1</size>
-                                            </object>
-                                            <object class="sizeritem">
-                                                <object class="wxTextCtrl" name="ID_TEXTCTRL1" variable="FileName" member="yes">
-                                                    <handler function="OnFileNameText" entry="EVT_TEXT" />
-                                                </object>
-                                                <flag>wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</flag>
-                                                <border>5</border>
-                                                <option>1</option>
-                                            </object>
-                                            <object class="sizeritem">
-                                                <object class="wxButton" name="ID_BUTTON3" variable="Button3" member
download for full patch...
cryogen 2010-02-03 06:27

This patch adds the ability to insert code to create an image for a toolbar button or menu item. Previously you could only use an image path or wxArtProvidor. In my case, I wanted to use images embedded using wxInclude, via the wxMEMORY_BITMAP() macro. You can now insert code such as "wxMEMORY_BITMAP(save_left)" into the new field to have wxSmith create an entry such as:

ToolBarItem2 = ToolBar1->AddTool(ID_TB_SAVEUNSELECTED, _("Save Unselected"), wxMEMORY_BITMAP(save_left), wxNullBitmap, wxITEM_NORMAL, .....

Any code that returns a valid wxBitmap will work.

The Extra Code option doesn't work for these situations as it inserts the extra code after the call to Append() or Realize(), which is too late.

The patch also includes a couple of spelling corrections.

cryogen 2010-02-03 06:33

The patch was made against SVN version 6130, 2/2/10.