From ad0a15debedf40d004ed402400bba0141e2cedb5 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Mon, 25 May 2015 22:37:04 +0200 Subject: [PATCH] Menu item icons :o) --- lib/Slic3r/GUI/MainFrame.pm | 44 +++++++++++++++++++++------------- lib/Slic3r/GUI/Plater.pm | 29 ++++++++++++---------- var/application_view_tile.png | Bin 0 -> 465 bytes var/lorry_add.png | Bin 0 -> 689 bytes var/lorry_go.png | Bin 0 -> 699 bytes var/plugin_add.png | Bin 0 -> 691 bytes var/plugin_go.png | Bin 0 -> 694 bytes var/shape_flip_horizontal.png | Bin 0 -> 403 bytes var/shape_handles.png | Bin 0 -> 538 bytes var/textfield.png | Bin 0 -> 153 bytes 10 files changed, 43 insertions(+), 30 deletions(-) create mode 100755 var/application_view_tile.png create mode 100755 var/lorry_add.png create mode 100755 var/lorry_go.png create mode 100755 var/plugin_add.png create mode 100755 var/plugin_go.png create mode 100755 var/shape_flip_horizontal.png create mode 100755 var/shape_handles.png create mode 100755 var/textfield.png diff --git a/lib/Slic3r/GUI/MainFrame.pm b/lib/Slic3r/GUI/MainFrame.pm index 09e894a09..f2b8b0772 100644 --- a/lib/Slic3r/GUI/MainFrame.pm +++ b/lib/Slic3r/GUI/MainFrame.pm @@ -157,16 +157,16 @@ sub _init_menubar { { $self->_append_menu_item($fileMenu, "&Load Config…\tCtrl+L", 'Load exported configuration file', sub { $self->load_config_file; - }); + }, undef, 'plugin_add.png'); $self->_append_menu_item($fileMenu, "&Export Config…\tCtrl+E", 'Export current configuration to file', sub { $self->export_config; - }); + }, undef, 'plugin_go.png'); $self->_append_menu_item($fileMenu, "&Load Config Bundle…", 'Load presets from a bundle', sub { $self->load_configbundle; - }); + }, undef, 'lorry_add.png'); $self->_append_menu_item($fileMenu, "&Export Config Bundle…", 'Export all presets to file', sub { $self->export_configbundle; - }); + }, undef, 'lorry_go.png'); $fileMenu->AppendSeparator(); my $repeat; $self->_append_menu_item($fileMenu, "Q&uick Slice…\tCtrl+U", 'Slice file', sub { @@ -174,27 +174,27 @@ sub _init_menubar { $self->quick_slice; $repeat->Enable(defined $Slic3r::GUI::MainFrame::last_input_file); }); - }); + }, undef, 'cog_go.png'); $self->_append_menu_item($fileMenu, "Quick Slice and Save &As…\tCtrl+Alt+U", 'Slice file and save as', sub { wxTheApp->CallAfter(sub { $self->quick_slice(save_as => 1); $repeat->Enable(defined $Slic3r::GUI::MainFrame::last_input_file); }); - }); + }, undef, 'cog_go.png'); $repeat = $self->_append_menu_item($fileMenu, "&Repeat Last Quick Slice\tCtrl+Shift+U", 'Repeat last quick slice', sub { wxTheApp->CallAfter(sub { $self->quick_slice(reslice => 1); }); - }); + }, undef, 'cog_go.png'); $repeat->Enable(0); $fileMenu->AppendSeparator(); $self->_append_menu_item($fileMenu, "Slice to SV&G…\tCtrl+G", 'Slice file to SVG', sub { $self->quick_slice(save_as => 1, export_svg => 1); - }); + }, undef, 'shape_handles.png'); $fileMenu->AppendSeparator(); $self->_append_menu_item($fileMenu, "Repair STL file…", 'Automatically repair an STL file', sub { $self->repair_stl; - }); + }, undef, 'wrench.png'); $fileMenu->AppendSeparator(); $self->_append_menu_item($fileMenu, "Preferences…", 'Application preferences', sub { Slic3r::GUI::Preferences->new($self)->ShowModal; @@ -212,13 +212,13 @@ sub _init_menubar { $self->{plater_menu} = Wx::Menu->new; $self->_append_menu_item($self->{plater_menu}, "Export G-code...", 'Export current plate as G-code', sub { $plater->export_gcode; - }); + }, undef, 'cog_go.png'); $self->_append_menu_item($self->{plater_menu}, "Export plate as STL...", 'Export current plate as STL', sub { $plater->export_stl; - }); + }, undef, 'brick_go.png'); $self->_append_menu_item($self->{plater_menu}, "Export plate as AMF...", 'Export current plate as AMF', sub { $plater->export_amf; - }); + }, undef, 'brick_go.png'); $self->{object_menu} = $self->{plater}->object_menu; $self->on_plater_selection_changed(0); @@ -230,16 +230,16 @@ sub _init_menubar { my $tab_count = $self->{no_plater} ? 3 : 4; $self->_append_menu_item($windowMenu, "Select &Plater Tab\tCtrl+1", 'Show the plater', sub { $self->select_tab(0); - }) unless $self->{no_plater}; + }, undef, 'application_view_tile.png') unless $self->{no_plater}; $self->_append_menu_item($windowMenu, "Select P&rint Settings Tab\tCtrl+2", 'Show the print settings', sub { $self->select_tab($tab_count-3); - }); + }, undef, 'cog.png'); $self->_append_menu_item($windowMenu, "Select &Filament Settings Tab\tCtrl+3", 'Show the filament settings', sub { $self->select_tab($tab_count-2); - }); + }, undef, 'spool.png'); $self->_append_menu_item($windowMenu, "Select Print&er Settings Tab\tCtrl+4", 'Show the printer settings', sub { $self->select_tab($tab_count-1); - }); + }, undef, 'printer_empty.png'); } # Help menu @@ -712,12 +712,22 @@ sub select_tab { } sub _append_menu_item { - my ($self, $menu, $string, $description, $cb, $id) = @_; + my ($self, $menu, $string, $description, $cb, $id, $icon) = @_; $id //= &Wx::NewId(); my $item = $menu->Append($id, $string, $description); + $self->_set_menu_item_icon($item, $icon); + EVT_MENU($self, $id, $cb); return $item; } +sub _set_menu_item_icon { + my ($self, $menuItem, $icon) = @_; + + if ($icon && $Wx::VERSION >= 0.9927) { + $menuItem->SetBitmap(Wx::Bitmap->new("$Slic3r::var/$icon", wxBITMAP_TYPE_PNG)); + } +} + 1; diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 86f2d532e..c44dca8f5 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -1598,26 +1598,27 @@ sub object_menu { my $menu = Wx::Menu->new; $frame->_append_menu_item($menu, "Delete\tCtrl+Del", 'Remove the selected object', sub { $self->remove; - }); + }, undef, 'brick_delete.png'); $frame->_append_menu_item($menu, "Increase copies\tCtrl++", 'Place one more copy of the selected object', sub { $self->increase; - }); + }, undef, 'add.png'); $frame->_append_menu_item($menu, "Decrease copies\tCtrl+-", 'Remove one copy of the selected object', sub { $self->decrease; - }); + }, undef, 'delete.png'); $frame->_append_menu_item($menu, "Set number of copies…", 'Change the number of copies of the selected object', sub { $self->set_number_of_copies; - }); + }, undef, 'textfield.png'); $menu->AppendSeparator(); $frame->_append_menu_item($menu, "Rotate 45° clockwise", 'Rotate the selected object by 45° clockwise', sub { $self->rotate(-45); - }); + }, undef, 'arrow_rotate_clockwise.png'); $frame->_append_menu_item($menu, "Rotate 45° counter-clockwise", 'Rotate the selected object by 45° counter-clockwise', sub { $self->rotate(+45); - }); + }, undef, 'arrow_rotate_anticlockwise.png'); my $rotateMenu = Wx::Menu->new; - $menu->AppendSubMenu($rotateMenu, "Rotate", 'Rotate the selected object by an arbitrary angle'); + my $rotateMenuItem = $menu->AppendSubMenu($rotateMenu, "Rotate", 'Rotate the selected object by an arbitrary angle'); + $frame->_set_menu_item_icon($rotateMenuItem, 'textfield.png'); $frame->_append_menu_item($rotateMenu, "Around X axis…", 'Rotate the selected object by an arbitrary angle around X axis', sub { $self->rotate(undef, X); }); @@ -1629,7 +1630,8 @@ sub object_menu { }); my $flipMenu = Wx::Menu->new; - $menu->AppendSubMenu($flipMenu, "Flip", 'Mirror the selected object'); + my $flipMenuItem = $menu->AppendSubMenu($flipMenu, "Flip", 'Mirror the selected object'); + $frame->_set_menu_item_icon($flipMenuItem, 'shape_flip_horizontal.png'); $frame->_append_menu_item($flipMenu, "Along X axis…", 'Mirror the selected object along the X axis', sub { $self->flip(X); }); @@ -1641,7 +1643,8 @@ sub object_menu { }); my $scaleMenu = Wx::Menu->new; - $menu->AppendSubMenu($scaleMenu, "Scale", 'Scale the selected object along a single axis'); + my $scaleMenuItem = $menu->AppendSubMenu($scaleMenu, "Scale", 'Scale the selected object along a single axis'); + $frame->_set_menu_item_icon($scaleMenuItem, 'arrow_out.png'); $frame->_append_menu_item($scaleMenu, "Uniformly…", 'Scale the selected object along the XYZ axes', sub { $self->changescale(undef); }); @@ -1657,18 +1660,18 @@ sub object_menu { $frame->_append_menu_item($menu, "Split", 'Split the selected object into individual parts', sub { $self->split_object; - }); + }, undef, 'shape_ungroup.png'); $frame->_append_menu_item($menu, "Cut…", 'Open the 3D cutting tool', sub { $self->object_cut_dialog; - }); + }, undef, 'package.png'); $menu->AppendSeparator(); $frame->_append_menu_item($menu, "Settings…", 'Open the object editor dialog', sub { $self->object_settings_dialog; - }); + }, undef, 'cog.png'); $menu->AppendSeparator(); $frame->_append_menu_item($menu, "Export object as STL…", 'Export this single object as STL file', sub { $self->export_object_stl; - }); + }, undef, 'brick_go.png'); return $menu; } diff --git a/var/application_view_tile.png b/var/application_view_tile.png new file mode 100755 index 0000000000000000000000000000000000000000..3bc0bd32fceb21d70368f7842a00a53d6369ba48 GIT binary patch literal 465 zcmV;?0WSWDP)zJNu3H-P zO&@UpeyZQXi7jKe-Hk?r-sue;aDce_XqkvXP+W#F_*ot`jB?BS93Uw71|U^ZjLH`yP%FO7U<6!nLCG} z$SDlWp9uvCp3Qf^#rZhr`|b(6_bjBcSYSnl@17o0 z)pF+)RYBDvVi7U3XstoS#P(n4-TRk-s+O?SZ#U-- z)uGNa_H`=zYUj&~Kt|x~lMf81CQ;)Mqo`42MrV0VSw3O~Bc64YMQmPO#FhK~#Q+g& zXE?Du&d;pTaAb>yqyOehmQ`|mY#Y(V0i&PCsjeu(8q2JJvj#Qku+h#oIx!g|#bS-c ziX%BTMcU{e0b{07G2|4MWE_{!c_(24iWf`S(m^_V9x;_3r|*R!TCfs0LU3^RChxt& zIfwTSAENUNhk1oQi}g9Zn{Y$;-|Kn4Z@$Iqxp_zk5y&5xNH2$q6FF-#i1j9?bWg>zm73!<7nwNua&|TB_w2 XJTQQHJy`Yt00000NkvXXu0mjf949vz literal 0 HcmV?d00001 diff --git a/var/lorry_go.png b/var/lorry_go.png new file mode 100755 index 0000000000000000000000000000000000000000..1c296a6aa06dfe126d5797d9bcf450c949ac95b9 GIT binary patch literal 699 zcmV;s0!00ZP)E4dEz%xDk41~1Rl9;{Q|l4}F|eS8iylz4ix#b- z2uqU?YoWCXGkb`pw@3`F?Edff&CJ*0s+)=e2ZqC$#o^2uCJG@im&#&}mD7Lg^oXjK znklM+sz<~l;%3o%hlp!C(A2s2Hvv^GE!?(`5R{-sFu_a-Dg^bI3PFVz_ipa_qXQ9- znUJ1L5>znpnEDKg!^E**@p7)^wQ%M9lc1ugsEU`9U6=M>&k=DHRUiE4uG-l_WV+R*P#2>v#(a#4 zCl<$wf+|`&chd82bXFk8xfm74{Jf$};*v@J>bEvRw#S*^Ci*GOUrklQ$TRAAyBfB<)5DYUT1S3pi>G1@+YmTA8P*aS+=gAQg3k!Mn;W52KPl+|XB{bNz8ymlY4I5ZeT<8K)pAK?919}}r@hQ7XM!^$13DXAltFdl^vsIIQw z4zvI%;0AE2_6%DOtv`X7BBp3CK1~jjzo?j(AG>+<`r%inG(>-Uro&e&EOriOj#wO( z1vSx@iaqoUchf%5_Sp#y$>z`({qHxfYs#9cE341#9B3bPMnkeWyaD)cfr`dxN-aA# hWm@s2ISkIse*qhAp}qdd4(I>?002ovPDHLkV1g_sL3#iH literal 0 HcmV?d00001 diff --git a/var/plugin_add.png b/var/plugin_add.png new file mode 100755 index 0000000000000000000000000000000000000000..ae43690ecefe7952ef9b0a410614d014299bd3c0 GIT binary patch literal 691 zcmV;k0!;mhP)!C{kgV#7nZ!}+IFwq-SXfjo|dBU;$2A*R+N`fo=|&GUYL?n@~UJ} zRwmI}jPAB8^01Y3C+^Ijd+pCXe>~g?4Jqg4)T#41=X}pOfxGiRR{6W&>CB0&nI=@t zRrSu<^!c5C0)&<(_cUQ7TI*VgHN*l@P5-TfC4f_@-VY11P%L?g;zAJ-8T%U`aCgp( zo^&%s)zGr{_QtkAOc?cV zQv@Ya7h%t}T`nSsD7Oy`1i{aDaBT3P$D8A1r!%M-=8CwXt~6AISyR6jGsiIoM;>tZ z&|vV(9f&CEifGyEVzQcIGxNN8`GVQmBE|UvZp9xX9KCnIMU)jaD^N2^UMg#1ikMNI zccRNH*tm5QYno!*e}0qU>_gJsE$2etD<@XAvnsrb$ z6AdYytGA&+iFC(ifFqRvB@qNA^X?fNqMb~-l0^}rXPZ}>v4 Z=Nr{rY9&UI$M^sM002ovPDHLkV1hoZLv;WE literal 0 HcmV?d00001 diff --git a/var/plugin_go.png b/var/plugin_go.png new file mode 100755 index 0000000000000000000000000000000000000000..41da9913dcda3c2b8e391cfa3764f8941032f773 GIT binary patch literal 694 zcmV;n0!jUeP)ql>{UE+b7(o&tm+%R_>i_{EvXkXu6tFE{kkH?3W zH&InlH_VOf+$1x_8N>y1CyvT6bGFu|5Rv5(&OJQks!B~oEsfQUyqX?CT}wD#!m7-@ zWj-k|9dANJ5m9a*zZ=B>momLk&%P^BZZ3zK5-bo@5EFt4!G%JYr>UWhiozQ*={<WZjR`S~qo32uUlu(7^{whepvQOt91@ETgS?T^68zT+;U)UB#R%?KWdE#Xl5 z*lz^G$O5mjeV51m#(7m>mtf82>auQHqEPjWt`41v95+C#hevf#LT947}<8 zk_d-O9|S?oNU!Ta)X09F!lmdp1}~FX5)~z3YeSk$^I@L6>!)w*?x#fP%y#>$1q9*A z*i%Fm5kW+Yw@!>#0UW$~Kr2v&KRk@1xQhE@eIFB}Gu!Q>zjN>})qEk!tCg)Tm^SCS cePVI`3(`iFP)+Q9Q4|H>Gx;$-G!ZQV78ZfoO&~77*3Nn$jc&kZKoCTmAc8K!LP4<=!NN2tOlc{Z zN$xqL$HGYbLH113OaYT)W33X5N`C}SuCsO{M4d)0!W1Bd zPzF|)%AK8~r}nqN@l_U#p4Mv-asy1$8wsx&u~-Jolx`n9hA#o5C(U{(u9g9#gDRe2 z!e}g*5zR(5HY)i99A1uEM(-{!M3@w(Q`3nM*_asR0^}go-P*tZD6~=(l~M=~!wKks x1gKbXqcC{MAPSU2?m_Ytz$O4h|MV~XCU1VTm(Vb6n04%0-0d~Z?N5N>2x}bMx$D(zp$faLbcIm6))=iDcNsK{XO_NUIz9_#=Hl90fplE_S$iRDekpz|Us6%gcl z10>7>u(;bXN$%}9L;!i)H44lO83AA=upo5q1c5U!FDx|env1*bl?cq~cLH;UH^p~Rgca1Ok;(*H5ZUXcXOPFe6C@8ghq04j{~AV5iYe^SBjqm*l4!TaGj6|yQS zl0>W3O7lFgJbe6&SDlNa#1ExQ;_~7(-;>XH?~^Rc>h}P$EUWbUeQtj&SzNDKTyL1C zYZj|t%+odV)rMrXCP_Cezg;mNk8#e`cJr5LHk)4>jfPdL)hmSs`qPQy_Y4;U;qFB literal 0 HcmV?d00001 diff --git a/var/textfield.png b/var/textfield.png new file mode 100755 index 0000000000000000000000000000000000000000..d37e7304e24c78f335466b07a898480a26248edd GIT binary patch literal 153 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-&9_H=O!(Kw&{<9vg>(FMnYC;$IY w3^*un^MTdn;7P{?4C|HS{~YI+WOIxGs_iP%+I;TWWS}+%Pgg&ebxsLQ0G+Tf(*OVf literal 0 HcmV?d00001