1.手写菜单代码,保存成文件 code.txt
view_menu->Append(ID_CreateText, _("Create Text Control"));
view_menu->Append(ID_CreateHTML, _("Create HTML Control")); view_menu->Append(ID_CreateTree, _("Create Tree")); view_menu->Append(ID_CreateGrid, _("Create Grid")); view_menu->Append(ID_CreateNotebook, _("Create Notebook")); view_menu->Append(ID_CreateSizeReport, _("Create Size Reporter")); view_menu->AppendSeparator(); view_menu->Append(ID_GridContent, _("Use a Grid for the Content Pane"));2. fbp文件格式, 里面的 property 值是需要修改的;
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property> <property name="checked">0</property> <property name="enabled">1</property> <property name="help"></property> <property name="id">ID_CreateText</property> <property name="kind">wxITEM_NORMAL</property> <property name="label">Create Text Control</property> <property name="name">menuItem1</property> <property name="permission">none</property> <property name="shortcut">Alt+X</property> <property name="unchecked_bitmap"></property> <event name="OnMenuSelection">OnExitClick</event> <event name="OnUpdateUI"></event> </object>3. 用perl脚本进行改写,perl脚本名字 c2fbp.pl;
执行 perl c2fbp.pl code.txt
运行完后,在fbp.txt文件里面就是得到的fbp格式,把它们拷贝到fbp文件对应的地方就可以 了;
----------------------------------------
#!/usr/bin/perl
use english$num = 1;open(fbp,'>fbp.txt');while($line=<>){ if($line =~ /\((.*),.*\"(.*)\"/) { $num++; print fbp qq{ <object class="wxMenuItem" expanded="0"> <property name="bitmap"></property> <property name="checked">0</property> <property name="enabled">1</property> <property name="help"></property> <property name="id">$1</property> <property name="kind">wxITEM_NORMAL</property> <property name="label">$2</property> <property name="name">m_menuItem$num</property> <property name="permission">none</property> <property name="shortcut">Alt+X</property> <property name="unchecked_bitmap"></property> <event name="OnMenuSelection">OnExitClick</event> <event name="OnUpdateUI"></event> </object>}; }}