From 85559d6da2fda8b43037871cc5f7af27806814c8 Mon Sep 17 00:00:00 2001 From: hcraigmiller <68821492+hcraigmiller@users.noreply.github.com> Date: Wed, 4 May 2022 12:53:31 -0700 Subject: [PATCH] Update File menu and submenu Improves File menu and submenus in preparation for the addition of future features. --- core/resources/l10n/messages.properties | 28 +- .../pix/icons/Painting-Transparent-PNG_16.png | Bin 0 -> 876 bytes .../pix/icons/document-print-Specs.png | Bin 0 -> 943 bytes core/resources/pix/icons/model_encode3d.png | Bin 0 -> 740 bytes core/resources/pix/icons/model_export.png | Bin 497 -> 482 bytes .../sf/openrocket/gui/main/BasicFrame.java | 330 +++++++++--------- .../util/ExportFileTranslator_RASAero.java | 10 + .../src/net/sf/openrocket/gui/util/Icons.java | 11 +- 8 files changed, 197 insertions(+), 182 deletions(-) create mode 100644 core/resources/pix/icons/Painting-Transparent-PNG_16.png create mode 100644 core/resources/pix/icons/document-print-Specs.png create mode 100644 core/resources/pix/icons/model_encode3d.png create mode 100644 swing/src/net/sf/openrocket/gui/util/ExportFileTranslator_RASAero.java diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index c0278d698..d2cb4f148 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -1286,28 +1286,30 @@ main.menu.file = File main.menu.file.desc = File-handling related tasks main.menu.file.new = New main.menu.file.new.desc = Create a new rocket design -main.menu.file.open = Open... +main.menu.file.open = Open. . . main.menu.file.open.desc = Open a rocket design -main.menu.file.openRecent = Open Recent... +main.menu.file.openRecent = Open recent main.menu.file.openRecent.desc = Open a recent rocket design -main.menu.file.openExample = Open Example... +main.menu.file.openExample = Open example main.menu.file.openExample.desc = Open an example rocket design main.menu.file.save = Save main.menu.file.save.desc = Save the current rocket design -main.menu.file.saveAs = Save as... +main.menu.file.saveAs = Save as. . . main.menu.file.saveAs.desc = Save the current rocket design to a new file -main.menu.file.import = Import... -main.menu.file.import.desc = Import model from RockSim rkt file -main.menu.file.export_as = Export as... -main.menu.file.export_as.desc = Export model to selected file format -main.menu.file.print = Print / Export PDF... -main.menu.file.print.desc = Print or save as PDF the parts list and fin templates -main.menu.file.close = Close +// main.menu.file.import = Import. . . +// main.menu.file.import.desc = Import design from RockSim rkt file +main.menu.file.export_as = Export as +main.menu.file.export_as.desc = Export design as selected file format +main.menu.file.encode_3d = Encode 3D +main.menu.file.encode_3d.desc = Encode design to selected 3D file format +main.menu.file.print = Print specs. . . +main.menu.file.print.desc = Print design specifications, including the parts list and fin templates, print or save as PDF +main.menu.file.close = Close design main.menu.file.close.desc = Close the current rocket design main.menu.file.quit = Quit main.menu.file.quit.desc = Quit the program -main.menu.file.exportDecal = Export Decal -main.menu.file.exportDecal.desc = Export a decal from the current rocket design to a file for editing. +main.menu.file.exportDecal = Save decal image. . . +main.menu.file.exportDecal.desc = Save a decal from the current rocket design to a file for editing. main.menu.edit = Edit main.menu.edit.desc = Rocket editing diff --git a/core/resources/pix/icons/Painting-Transparent-PNG_16.png b/core/resources/pix/icons/Painting-Transparent-PNG_16.png new file mode 100644 index 0000000000000000000000000000000000000000..884436f7a8ca7c1fbbd0cb8af46e80c649b5fc78 GIT binary patch literal 876 zcmV-y1C#uTP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0|7}yK~y+Tjgx;! z6JZ#~pSzpeZFAdA*D`-jYnesqnxdt~B8iG513@T4|EQoM>=*qPSdjkFFS0*^2u#GH z$Tll1LQ0Ctz?E4krZ{zF{%YRNwsW`Lz1^)#kP7<1z4v^d_j$g&-1{8-51uXg)y(!{ zi!2v_%kMvUZO=M7o|kEH+sqUa2s3&0`k1`+Z&F(`OXM(0-4@Qm&iysCwF9umU603-Uk2Mv2Om_mZ+AP zH$a%8YO$c{mExXsEyc0HW(5F+0~S3xUgtidL3oGIQ0kKOZ!l@Wj}esKPCcM^e=nAF ze@1+nLaA~R;w~HHcIIAiTLdO#@vdB6!_62DPIxg>vX#8gho-9V#r66|v3W|tF ziDi<3QlqI8xeIM}Xwc^R7wOplH-HGuL z2q6}heqf&oTv*3x^>C{2F!0tSsJ9uONyW_Pr4FWhlQY)Bl+AewDFwI}JnhEuz%-hh zf*8R7cG?8mcnY4T6hf~y34%O=iyvpT%t-b&LN(-6n!*l@#Ob)LUq_<`Xh(Q>qs4lH z(3o6doe?4{QbDED!=Nq^lo$fFS^>w*ht3MVo@NwA6bRy%C$J6@GmDXEAT2l7xAYq^ zdt(C2!Yk!x;6of_vtIylKfo4x0S@S>LOh5QiHX-81HhrnQlG^9988zAy3!_*?TLQ& zja%o3Wxf%J40xd;&;+Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D14KzgK~y+TWm8>j zQ)L)_zVoyG(4Mv{ZE07tmJK#cC}mN)t+LHbg#^hkkRWK{t(S76aBZUA>kWx`GjDbw zCOU#dSQ;)ie^C=4TgDixZYwc6r>8yt=ky%E)@BL%Bwya2@BN;<-}Aj6!GCb&%157{ zJ9p|lbsf+1s39PvT}HV1`S0f!7k_-~)~z|WUE2oNwYw06aC~H>5bB1{U}@=>y@p}1 z)ZHaux^@?yM;zDvci&ZH$oGDR`S+hRvO&`hA#%H|UHp&0=kr+|$8#xx0<$i|Y}9GO zMNdz_u2d>cXTOVQ2!@A;!BNB-n=*y(~b;AN@Yw&clb6H)}VVWwEiQbW!nKO&i)6=Wf_3AfLQ@qBO%f~;w zbm{$1&cFHgz|mqcwj~+F@kP-xO!%n=x+Fn#SnT+ckQzF9WnwZiG4)!0@ZiwN$7`!` zrc^q1VRWnnAJ0J3R3P;nWPcd4=D-nmpfwddQh9vWNMbeE51Hz+Tw6!9uMaOCEuG=^ z@6Shh`j|%3gkrh)L5*Yi4}wE0Pw?L3>)0@C%q3pMf<_Q&h3Fw2hm%pTegV0Ge1MT8 zjcjg;@LCpR$B(a<0=Q9Ov3gH|dgl(dDtEEA#zI^MHdcbz(L;!a{ZLf{O~vv!QIy>W z4>sWMp`*tI@ovtBneot%ZD>?NC$I;v=X9JtvW+lfA=)zW)9)&%z7WL*I6_=KmD(Gv zR-fSdSDzuahr_;>jo!__&?FXk+S$JKIn?YWJat<5vQEinF5aX|juVHd>ydVf6*j59KbpwgQLkPtp_`_%6asJNa@jQ#GSHHNquyFeWRh4GB_H5I2 z^YZ17%d%Wo6s6f>S`z8CANfNuoi~i8C5l_7gK*~)@jS;8(z7)?d+l2Q_y@9wXq$eV R0=xhK002ovPDHLkV1j+!!m$7V literal 0 HcmV?d00001 diff --git a/core/resources/pix/icons/model_encode3d.png b/core/resources/pix/icons/model_encode3d.png new file mode 100644 index 0000000000000000000000000000000000000000..f4aee1785efd02f42f84607552777c52fdfa4ba0 GIT binary patch literal 740 zcmVPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0(nV9K~y+Tt&&S< z6Hyd~&%JYJCdo9(G)<#LO=}diaUR-{x4YAdEmYfJ6RCY73G@|ek;nd?kCv_uLn^xK@n|DSvA%s&JF3UX=%bn}z! z!z`-g)rcRP!LIg*JUp?eEUXpZE7vIu?PU zu~|qYS3oq)vcO=F(~Wnix$#Z9r(?2m7W%(MO$O(zK5Cjwu*I!l)DT#qbOL7!_r&4P z@y6qizuP({9Ig!1h&=3RkWF6XuOW`RD2gOmF)T!{$LTgfN-<@3 zh4SLe<&H#_L33(vm+l;De!QYSt1Uuabwz)QsRWI<@B!T0)fsk$&!Gn&v!T3T3`rl5&P$K0h z)`Bw+ULbNmF&Vn`G0~AporkNf1JKhxAbH(m&J0K%(I?%RkaqwL1!x%rO>-P8H~!(2 zOf~%%(skJF7onIh&KlGJtW#gtp8c#Fl>pIe!DNm5OK3QSBS2`) z1AYrRD)q+_p7rZG904QCw&Am|!v>==g~(^dI&lOXZK_;4p+cSy%rGchGr^@^Qb)s2 z5YE=r-o=Uvd4J1@GU$d=SjTwD!{53!pPf+d#vh;!W(?c&WZVb|H zI!gJs`VP6GVJdwG)O8PH^p*C|TY5~pXfM5{Df*4u1oF#6^qxwy+`rQkT6Y?56FgGc ztT!5=lk}9GWB`EqRL-wzCGIRF3v07*qoM6N<$f}irg A(EtDd delta 421 zcmV;W0b2gz1MvfpR)2;`L_t(IPnD8QC`3^d$Il(}W(+aIL|I6aoswZCG$9)#Q{*cf zDOt$Jg6!BRJF&23Wu@3iR<;%z7WPUuA|Zu0Gd;ii=3$hNdH?$LfA`*V&b#;At0YUc zt5$2$FKwn@Vo9GorF?RUAKeY9L;s;Qn=&Ml?ocyMxGlRtY=7Pgk+el{92ZrhP09*hAEhK`yLK@;T96WZHVy>Cnull if none selected. */ @@ -417,6 +379,7 @@ public class BasicFrame extends JFrame { return (RocketComponent) path.getLastPathComponent(); } + /** * Return the currently selected rocket component, or null if none selected. */ @@ -435,7 +398,6 @@ public class BasicFrame extends JFrame { return result; } - /** * Creates the menu for the window. */ @@ -528,60 +490,53 @@ public class BasicFrame extends JFrame { }); menu.add(item); - menu.addSeparator(); + //// BEGIN CREATE and implement File > "Export as" menu and submenu - //// Import Rocksim - JMenuItem importMenu; - - item = new JMenuItem(trans.get("main.menu.file.import")); - item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.file.import.desc")); - item.setIcon(Icons.FILE_IMPORT); - item.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - log.info(Markers.USER_MARKER, "Import... selected"); - importAction(); - } - }); - menu.add(item); - -// BEGIN Create, add options to, and implement File > "Export as..." menu and submenu - - // INITIALIZE "Export as..." submenu with options list + // // INITIALIZE "Export as" submenu with options list JMenu exportSubMenu = new JMenu(); JMenuItem exportMenu = new JMenuItem(), - RASAero= new JMenuItem("RASAero - Future"), - Rocksim = new JMenuItem("Rocksim"); + RASAero= new JMenuItem("RASAero (Unavailable)"), + Rocksim = new JMenuItem("Rocksim"), + Print3D = new JMenuItem("Exterior airframe"); - // CREATE File > "Export as..." menu line with icon + // // CREATE File > "Export as" menu line with icon, and "Export as" submenu exportSubMenu = new JMenu(trans.get("main.menu.file.export_as")); exportSubMenu.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.file.export_as.desc")); exportSubMenu.setIcon(Icons.FILE_EXPORT_AS); - // CREATE "Export as..." submenu - // ADD Export option items with icons to submenu - /* exportSubMenu.add(RASAero); - RASAero.setIcon(Icons.RASAERO_ICON); */ - exportSubMenu.add(Rocksim); - Rocksim.setIcon(Icons.ROCKSIM_ICON); +/* // // PENDING Future development + // // ADD RASAero to "Export as" exportSubMenu options + exportSubMenu.add(RASAero); + RASAero.setForeground(Color.lightGray); - // ADD Listeners + // // PENDING Future development + // // CREATE RASAero listener RASAero.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { exportRASAeroAction();}}); +*/ + // // ADD Rocksim to "Export as" exportSubMenu options + exportSubMenu.add(Rocksim); + + // // CREATE Rocksim listener Rocksim.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { exportRocksimAction();}}); - // ADD Export options submenu to export menu + // // ADD Export options in exportSubMenu to "Export as" menu menu.add(exportSubMenu); -// END Create and implement File > "Export as..." menu and submenu + // // END CREATE and implement File > "Export as" menu and submenu - //// Export decal... + //// BEGIN CREATE na implement File > "Save decal image. . . menu and submenu + + menu.addSeparator(); + + //// Save decal image... item = new JMenuItem(trans.get("main.menu.file.exportDecal")); + item.setIcon(Icons.SAVE_DECAL); item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.file.exportDecal.desc")); item.addActionListener(new ActionListener() { @Override @@ -591,21 +546,24 @@ public class BasicFrame extends JFrame { }); item.setEnabled(document.getDecalList().size() > 0); final JMenuItem exportMenuItem = item; +/** document.getRocket().addChangeListener(new StateChangeListener() { - @Override - public void stateChanged(EventObject e) { - exportMenuItem.setEnabled(document.getDecalList().size() > 0); - } - + @Override + public void stateChanged(EventObject e) { + exportMenuItem.setEnabled(document.getDecalList().size() > 0); + } }); + */ menu.add(item); + //// END CREATE na implement File > "Save decal image. . . menu and submenu + + //// BEGIN PRINT Design specifications, including parts list and templates - //// Print... item = new JMenuItem(trans.get("main.menu.file.print"), KeyEvent.VK_P); item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, SHORTCUT_KEY)); - //// Print parts list and fin template + //// Print specifications, including parts list and fin template item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.file.print.desc")); item.setIcon(Icons.FILE_PRINT); item.addActionListener(new ActionListener() { @@ -617,10 +575,58 @@ public class BasicFrame extends JFrame { }); menu.add(item); + //// END PRINT Design specifications, including parts list and templates + +/* //// THE IMPORT ROCKSIM .RKT FEATURE IS FULLY WITHIN THE SCOPE OF THE "OPEN" FEATURE + //// THIS FEATURE IS BEING DEACTIVATED PENDING REMOVAL menu.addSeparator(); - //// Close + //// BEGIN IMPORT Rocksim RKT design file + JMenuItem importMenu; + item = new JMenuItem(trans.get("main.menu.file.import")); + item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.file.import.desc")); + item.setIcon(Icons.FILE_IMPORT); + item.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + log.info(Markers.USER_MARKER, "Import... selected"); + importAction(); + } + }); + menu.add(item); + //// END IMPORT Rocksim RKT design file +*/ + +/* //// PENDING Future development + //// BEGIN CREATE and implement File > "Encode 3D" menu and submenu + + // // INITIALIZE "Encode 3D" submenu with options list + JMenu encode3dSubmenu = new JMenu(); + JMenuItem encodeMenu = new JMenuItem(), + External_Airframe = new JMenuItem("External airframe (unavailable)"), + Single_Component = new JMenuItem("Component (unavailable)"); + + // // CREATE File > "Encode 3D" menu line with icon + JMenuItem encode3dSubMenu = new JMenu(trans.get("main.menu.file.encode_3d")); + encode3dSubMenu.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.file.encode_3d.desc")); + encode3dSubMenu.setForeground(Color.lightGray); + encode3dSubMenu.setIcon(Icons.ENCODE_3D); + + // // CREATE "Encode 3D" submenu + // // ADD Encode 3D option items to submenu + encode3dSubMenu.add(External_Airframe); + External_Airframe.setForeground(Color.lightGray); + encode3dSubMenu.add(Single_Component); + Single_Component.setForeground(Color.lightGray); + + // // ADD Listeners + + //// END CREATE and implement File > "Encode 3D" menu and submenu +*/ + menu.addSeparator(); + + //// Close item = new JMenuItem(trans.get("main.menu.file.close"), KeyEvent.VK_C); item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, SHORTCUT_KEY)); //// Close the current rocket design @@ -633,11 +639,12 @@ public class BasicFrame extends JFrame { closeAction(); } }); + menu.add(item); menu.addSeparator(); - //// Quit + //// Quit item = new JMenuItem(trans.get("main.menu.file.quit"), KeyEvent.VK_Q); item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, SHORTCUT_KEY)); //// Quit the program @@ -652,21 +659,20 @@ public class BasicFrame extends JFrame { }); menu.add(item); - - - //// Edit + //// Edit menu = new JMenu(trans.get("main.menu.edit")); menu.setMnemonic(KeyEvent.VK_E); - //// Rocket editing + + //// Rocket editing menu.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.edit.desc")); menubar.add(menu); - Action action = UndoRedoAction.newUndoAction(document); item = new JMenuItem(action); item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, SHORTCUT_KEY)); item.setMnemonic(KeyEvent.VK_U); - //// Undo the previous operation + + //// Undo the previous operation item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.edit.undo.desc")); menu.add(item); @@ -675,7 +681,8 @@ public class BasicFrame extends JFrame { item = new JMenuItem(action); item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Y, SHORTCUT_KEY)); item.setMnemonic(KeyEvent.VK_R); - //// Redo the previously undone operation + + //// Redo the previously undone operation item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.edit.redo.desc")); menu.add(item); @@ -697,7 +704,6 @@ public class BasicFrame extends JFrame { menu.addSeparator(); - item = new JMenuItem(trans.get("main.menu.edit.resize")); item.setIcon(Icons.EDIT_SCALE); item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.edit.resize.desc")); @@ -713,11 +719,11 @@ public class BasicFrame extends JFrame { menu.add(item); - - //// Preferences + //// Preferences item = new JMenuItem(trans.get("main.menu.edit.preferences")); item.setIcon(Icons.PREFERENCES); - //// Setup the application preferences + + //// Setup the application preferences item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.edit.preferences.desc")); item.addActionListener(new ActionListener() { @Override @@ -728,7 +734,7 @@ public class BasicFrame extends JFrame { }); menu.add(item); - //// Edit Component Preset File + //// Edit Component Preset File if (System.getProperty("openrocket.preseteditor.menu") != null) { item = new JMenuItem(trans.get("main.menu.edit.editpreset")); item.addActionListener(new ActionListener() { @@ -745,17 +751,18 @@ public class BasicFrame extends JFrame { } - //// Analyze + //// Analyze menu = new JMenu(trans.get("main.menu.analyze")); menu.setMnemonic(KeyEvent.VK_A); - //// Analyzing the rocket + + //// Analyzing the rocket menu.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.analyze.desc")); menubar.add(menu); - - //// Component analysis + //// Component analysis item = new JMenuItem(trans.get("main.menu.analyze.componentAnalysis"), KeyEvent.VK_C); - //// Analyze the rocket components separately + + //// Analyze the rocket components separately item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.analyze.componentAnalysis.desc")); item.addActionListener(new ActionListener() { @Override @@ -766,7 +773,7 @@ public class BasicFrame extends JFrame { }); menu.add(item); - //// Optimize + //// Optimize item = new JMenuItem(trans.get("main.menu.analyze.optimization"), KeyEvent.VK_O); item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.analyze.optimization.desc")); item.addActionListener(new ActionListener() { @@ -782,7 +789,7 @@ public class BasicFrame extends JFrame { }); menu.add(item); - //// Custom expressions + //// Custom expressions item = new JMenuItem(trans.get("main.menu.analyze.customExpressions"), KeyEvent.VK_E); item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.analyze.customExpressions.desc")); item.addActionListener(new ActionListener() { @@ -806,24 +813,19 @@ public class BasicFrame extends JFrame { }); menu.add(item); - //// Debug - // (shown if openrocket.debug.menu is defined) + //// Debug + // // (shown if openrocket.debug.menu is defined) if (System.getProperty("openrocket.debug.menu") != null) { menubar.add(makeDebugMenu()); } - - - //// Help - + //// Help menu = new JMenu(trans.get("main.menu.help")); menu.setMnemonic(KeyEvent.VK_H); menu.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.help.desc")); menubar.add(menu); - - // Guided tours - + //// Guided tours item = new JMenuItem(trans.get("main.menu.help.tours"), KeyEvent.VK_L); item.setIcon(Icons.HELP_TOURS); item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.help.tours.desc")); @@ -838,7 +840,7 @@ public class BasicFrame extends JFrame { menu.addSeparator(); - //// Bug report + //// Bug report item = new JMenuItem(trans.get("main.menu.help.bugReport"), KeyEvent.VK_B); item.setIcon(Icons.HELP_BUG_REPORT); item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.help.bugReport.desc")); @@ -851,9 +853,9 @@ public class BasicFrame extends JFrame { }); menu.add(item); - //// Debug log + //// Debug log item = new JMenuItem(trans.get("main.menu.help.debugLog"), KeyEvent.VK_D); - item.setIcon(Icons.HELP_DEBUG_LOG); + item.setIcon(Icons.HELP_DEBUG_LOG); item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, SHORTCUT_KEY)); item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.help.debugLog.desc")); item.addActionListener(new ActionListener() { @@ -867,8 +869,7 @@ public class BasicFrame extends JFrame { menu.addSeparator(); - - //// License + //// License item = new JMenuItem(trans.get("main.menu.help.license"), KeyEvent.VK_L); item.setIcon(Icons.HELP_LICENSE); item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.help.license.desc")); @@ -881,8 +882,7 @@ public class BasicFrame extends JFrame { }); menu.add(item); - - //// About + //// About item = new JMenuItem(trans.get("main.menu.help.about"), KeyEvent.VK_A); item.setIcon(Icons.HELP_ABOUT); item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.help.about.desc")); @@ -895,7 +895,6 @@ public class BasicFrame extends JFrame { }); menu.add(item); - this.setJMenuBar(menubar); } @@ -907,12 +906,13 @@ public class BasicFrame extends JFrame { * This menu is intentionally left untranslated. */ - //// Debug menu + //// Debug menu menu = new JMenu("Debug"); - //// OpenRocket debugging tasks + + //// OpenRocket debugging tasks menu.getAccessibleContext().setAccessibleDescription("OpenRocket debugging tasks"); - //// What is this menu? + //// What is this menu? item = new JMenuItem("What is this menu?"); item.addActionListener(new ActionListener() { @Override @@ -932,7 +932,7 @@ public class BasicFrame extends JFrame { menu.addSeparator(); - //// Create test rocket + //// Create test rocket item = new JMenuItem("Create test rocket"); item.addActionListener(new ActionListener() { @Override @@ -965,7 +965,6 @@ public class BasicFrame extends JFrame { menu.add(item); - item = new JMenuItem("Create 'Iso-Haisu'"); item.addActionListener(new ActionListener() { @Override @@ -980,7 +979,6 @@ public class BasicFrame extends JFrame { }); menu.add(item); - item = new JMenuItem("Create 'Big Blue'"); item.addActionListener(new ActionListener() { @Override @@ -997,14 +995,13 @@ public class BasicFrame extends JFrame { menu.addSeparator(); - item = new JMenuItem("Memory statistics"); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { log.info(Markers.USER_MARKER, "Memory statistics selected"); - // Get discarded but remaining objects (this also runs System.gc multiple times) + // // Get discarded but remaining objects (this also runs System.gc multiple times) List objects = MemoryManagement.getRemainingCollectableObjects(); StringBuilder sb = new StringBuilder(); sb.append("Objects that should have been garbage-collected but have not been:\n"); @@ -1016,7 +1013,7 @@ public class BasicFrame extends JFrame { sb.append("Age ").append(System.currentTimeMillis() - data.getRegistrationTime()) .append(" ms: ").append(o).append('\n'); count++; - // Explicitly null the strong reference to avoid possibility of invisible references + // // Explicitly null the strong reference to avoid possibility of invisible references o = null; } sb.append("Total: " + count); @@ -1039,7 +1036,7 @@ public class BasicFrame extends JFrame { }); menu.add(item); - //// Exhaust memory + //// Exhaust memory item = new JMenuItem("Exhaust memory"); item.addActionListener(new ActionListener() { @Override @@ -1069,10 +1066,9 @@ public class BasicFrame extends JFrame { }); menu.add(item); - menu.addSeparator(); - //// Exception here + //// Exception here item = new JMenuItem("Exception here"); item.addActionListener(new ActionListener() { @Override @@ -1127,7 +1123,6 @@ public class BasicFrame extends JFrame { menu.addSeparator(); - item = new JMenuItem("Test popup"); item.addActionListener(new ActionListener() { @Override @@ -1144,9 +1139,6 @@ public class BasicFrame extends JFrame { }); menu.add(item); - - - return menu; } @@ -1239,6 +1231,7 @@ public class BasicFrame extends JFrame { } + /** * Open a file based on a URL. * @param url the file to open. @@ -1273,8 +1266,7 @@ public class BasicFrame extends JFrame { displayName = displayName.substring(displayName.lastIndexOf('/') + 1); } - - // Open the file + //// Open the file log.info("Opening file from url=" + url + " filename=" + displayName); OpenFileWorker worker = new OpenFileWorker(url); @@ -1307,16 +1299,15 @@ public class BasicFrame extends JFrame { * @return */ private static boolean open(OpenFileWorker worker, String displayName, Window parent, boolean openRocketConfigDialog) { - // Open the file in a Swing worker thread + //// Open the file in a Swing worker thread log.info("Starting OpenFileWorker"); if (!SwingWorkerDialog.runWorker(parent, "Opening file", "Reading " + displayName + "...", worker)) { - // User cancelled the operation + // // User cancelled the operation log.info("User cancelled the OpenFileWorker"); return false; } - - // Handle the document + //// Handle the document OpenRocketDocument doc = null; try { @@ -1358,22 +1349,22 @@ public class BasicFrame extends JFrame { } - // Show warnings + //// Show warnings WarningSet warnings = worker.getRocketLoader().getWarnings(); if (!warnings.isEmpty()) { log.info("Warnings while reading file: " + warnings); WarningDialog.showWarnings(parent, new Object[] { - //// The following problems were encountered while opening + // // The following problems were encountered while opening trans.get("BasicFrame.WarningDialog.txt1") + " " + displayName + ".", - //// Some design features may not have been loaded correctly. + // // Some design features may not have been loaded correctly. trans.get("BasicFrame.WarningDialog.txt2") }, - //// Warnings while opening file + // // Warnings while opening file trans.get("BasicFrame.WarningDialog.title"), warnings); } - // Open the frame + //// Open the frame log.debug("Opening new frame with the document"); BasicFrame frame = new BasicFrame(doc); frame.setVisible(true); @@ -1388,6 +1379,7 @@ public class BasicFrame extends JFrame { return true; } + /** * "Save" action. If the design is new, then this is identical to "Save As", with a default file filter for .ork. * If the rocket being edited previously was opened from a .ork file, then it will be saved immediately to the same @@ -1407,23 +1399,28 @@ public class BasicFrame extends JFrame { } - // BEGIN RASAERO Export Action *** UNDER CONSTRUCTION -- CURRENTLY FOR TESTING ONLY *** + //// BEGIN RASAERO Export Action *** UNDER CONSTRUCTION -- CURRENTLY FOR TESTING ONLY *** /** * MODEL "Export as" RASAero file format * * @return true if the file was saved, false otherwise */ + + /* public boolean exportRASAeroAction() { - return false; + Object exportRASAeroAction = ExportFileTranslator_RASAero.exportRASAeroAction; + return false; } - // END RASAERO Export Action + */ + //// END RASAERO Export Action public void actionPerformed(ActionEvent e) { log.info(Markers.USER_MARKER, "Import... selected"); importAction(); } - // BEGIN ROCKSIM Export Action + + //// BEGIN ROCKSIM Export Action /** * MODEL "Export as" RASAero file format * @@ -1457,6 +1454,7 @@ public class BasicFrame extends JFrame { } // END ROCKSIM Export Action + /** * Perform the writing of the design to the given file in Rocksim format. * @@ -1496,6 +1494,7 @@ public class BasicFrame extends JFrame { return saveRocksimFile(file, options); } + /** * Perform the actual saving of the Rocksim file * @param file file to be stored @@ -1519,6 +1518,7 @@ public class BasicFrame extends JFrame { } } + /** * "Save As" action. * @@ -1554,6 +1554,7 @@ public class BasicFrame extends JFrame { return result; } + /** * Perform the writing of the design to the given file in OpenRocket format. * @@ -1673,6 +1674,7 @@ public class BasicFrame extends JFrame { new PrintDialog(this, document, rotation).setVisible(true); } + /** * Open a new design window with a basic rocket+stage. */ @@ -1686,6 +1688,7 @@ public class BasicFrame extends JFrame { frame.setVisible(true); } + /** * Quit the application. Confirms saving unsaved designs. The action of File->Quit. */ @@ -1725,7 +1728,6 @@ public class BasicFrame extends JFrame { } - /** * Find a currently open BasicFrame containing the specified rocket. This method * can be used to map a Rocket to a BasicFrame from GUI methods. diff --git a/swing/src/net/sf/openrocket/gui/util/ExportFileTranslator_RASAero.java b/swing/src/net/sf/openrocket/gui/util/ExportFileTranslator_RASAero.java new file mode 100644 index 000000000..18d8c6f93 --- /dev/null +++ b/swing/src/net/sf/openrocket/gui/util/ExportFileTranslator_RASAero.java @@ -0,0 +1,10 @@ +package net.sf.openrocket.gui.util; + +public interface ExportFileTranslator_RASAero { + /* + Utility that translates OpenRocket models to RASAero .CDX1 file format. + + @author H. Craig Miller + */ +// Object exportRASAeroAction = ; +} diff --git a/swing/src/net/sf/openrocket/gui/util/Icons.java b/swing/src/net/sf/openrocket/gui/util/Icons.java index 00b7dd63e..b3814e98e 100644 --- a/swing/src/net/sf/openrocket/gui/util/Icons.java +++ b/swing/src/net/sf/openrocket/gui/util/Icons.java @@ -49,12 +49,13 @@ public class Icons { public static final Icon FILE_OPEN_EXAMPLE = loadImageIcon("pix/icons/document-open-example.png", "Open example document"); public static final Icon FILE_SAVE = loadImageIcon("pix/icons/document-save.png", "Save document"); public static final Icon FILE_SAVE_AS = loadImageIcon("pix/icons/document-save-as.png", "Save document as"); - public static final Icon FILE_IMPORT = loadImageIcon("pix/icons/model_import.png", "Import"); - public static final Icon FILE_EXPORT_AS = loadImageIcon("pix/icons/model_export.png", "Export model as..."); - public static final Icon FILE_PRINT = loadImageIcon("pix/icons/document-print.png", "Print document"); + public static final Icon SAVE_DECAL = loadImageIcon("pix/icons/Painting-Transparent-PNG_16.png", "Save decal image"); + public static final Icon FILE_PRINT = loadImageIcon("pix/icons/document-print-specs.png", "Print specifications"); +// public static final Icon FILE_IMPORT = loadImageIcon("pix/icons/model_import.png", "Import"); + public static final Icon FILE_EXPORT_AS = loadImageIcon("pix/icons/model_export.png", "Export model as"); + public static final Icon ENCODE_3D = loadImageIcon("pix/icons/model_encode3d.png", "Encode 3D"); public static final Icon FILE_CLOSE = loadImageIcon("pix/icons/document-close.png", "Close document"); public static final Icon FILE_QUIT = loadImageIcon("pix/icons/application-exit.png", "Quit OpenRocket"); - public static final Icon EDIT_UNDO = loadImageIcon("pix/icons/edit-undo.png", trans.get("Icons.Undo")); public static final Icon EDIT_REDO = loadImageIcon("pix/icons/edit-redo.png", trans.get("Icons.Redo")); public static final Icon EDIT_CUT = loadImageIcon("pix/icons/edit-cut.png", "Cut"); @@ -104,7 +105,7 @@ public class Icons { * * @param file the file to load. * @param name the description of the icon. - * @return the ImageIcon, or null if could not be loaded (after the user closes the dialog) + * @return the ImageIcon, or null if the ImageIcon could not be loaded (after the user closes the dialog) */ public static ImageIcon loadImageIcon(String file, String name) { if (System.getProperty("openrocket.unittest") != null) {