From d8e04a8127f85194d7ab4deb862014079d2c09e9 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Tue, 27 Sep 2022 16:08:06 -0600 Subject: [PATCH 01/37] Add dual deploy example --- swing/resources-src/datafiles/components-dbcook | 2 +- .../resources/datafiles/examples/Dual Deploy.ork | Bin 0 -> 3547 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 swing/resources/datafiles/examples/Dual Deploy.ork diff --git a/swing/resources-src/datafiles/components-dbcook b/swing/resources-src/datafiles/components-dbcook index 525b7898f..49a453dd1 160000 --- a/swing/resources-src/datafiles/components-dbcook +++ b/swing/resources-src/datafiles/components-dbcook @@ -1 +1 @@ -Subproject commit 525b7898f9e92f40be9688a5a89a3d1de3bc12cd +Subproject commit 49a453dd1cb62f68dfbbbd56e69d7fbcdf4bd4a1 diff --git a/swing/resources/datafiles/examples/Dual Deploy.ork b/swing/resources/datafiles/examples/Dual Deploy.ork new file mode 100644 index 0000000000000000000000000000000000000000..0d2821e93bfcdfa977696603cc9ac1dac6ee76c5 GIT binary patch literal 3547 zcmV<14J7hVO9KQH00;;O040DsRR9100000000000015yA0CI0*Yh`pUZ*ptxTy2w^ zI1>Iozk>2rUGA#ZSQ3(u?mXVwWZ&tdA#w-e>%X}m4;WPxlnpS4tWMw>K`3TT~G+->xM z{=Rgl?5FFsPKw1>R$iziP+4Gwk*Bj|tn%FYBid|q7Hjx3*s9nH^d?U4tm;W@>*nUy zRTOJ0Dy%5CQqwDi@?!l3NdEd4NB%RnLX{WLo9TABvY?e#vC>wiqS%7=spPI$K_^>Y zv|Q>8%2ZM+d}pmw=ujgltdG#SE1mgpPoo>(K6B5 z;>T25KZiOBL!HfMwYbtM@8PFO7%jJ%DtoNDilCQ0M`(qFH|2zTQ>wghDqTgUBnW-R z!+^^moXk$CDe$C+gu+wqIA}_lho&BN)Refs%UnUFkov@$v=D)#y(yB|pVE+%sZ>Z$ z38BbyeTQ)roK_Q(A`rf0Q$~FXZDM5Vg#u4CXBr2Zx{`Yn80}DPW9peVyc+~4~qgd6`|r&M@ffK6%Y~Nx~5FS z0K=Ts2J(wF%!&1OJ)d>OH6O@@A)&1so zX8v0hyh%S=>>t=lm(d4pC5>5UTGf_eltlSzk)+vL#q-(jva7RJh0cJPb|mC&01hv4~acimM28u5QifTkAGmWY2drSn-M z>+0q!1z;#2bv~;u1{5|bgD!&>!RVr$UL)%osIbUX5N-2?+7_t=PevFJb1gm4&R6L+ z4q(iy@`}d~#G__)mvqerd!|+1bV%QFtgBiozJiq?ScEFhb;ovBaMSC$_BgdLB-nX48eDFdGykvNY~|J$B-CUA3HVl*2=zdcd>jFfOkQTT#jY?XBhAm z=>besTsN^C)Shh2D2Ouc_pKV?p;-zJL<_FObr3+jEj_g9;0<93UE2ET&d@{aqX;TB zOqZ{;3Wf^zFnYby8G}%%870Q|@eL$_>wsgrg5yScNefM14#D zhi?zUh>U~wV&Faiyaxa_EPW4n!D2R!FIW$b^4n~b;Eq@VMC-M@E%wsj&eS)w!oP+x z%M=c-@XxbOQ^e^>%QS0P&UKG2*#oQVe&EhocFctIS1{~ji_Tkc_Rd;t)=?0|`jq+F zpQ|0qBYeG4u+<8h$z`6sBO5bm$Qm~`qg?%zYl$E1W}qM3zpm!nEL6U3VG{1b-O1uz zw8@KfVsQ$7g4bdwAlp)BuKRW2fV%*Dl4@<@Fw^RbVZ|Cdhqq`I58L(z!-%>gfv}h?z5!w=A|Kqf zEU^BTL0bZgSnKr{7M@{lMakc*TaAs8LFeGiJj#|0FJ22N|?@9 z%9W4lqVKtHdO2-Q@8iwKanCVvuh1bs!Jj#B#vMc(Uz|9jc)Hx1xxV>%i8llNi*xg7otsU%)aSZ31hpKMM{#W^bIBvPGtP_uat*t^ za&WKFgNc$vXNO(cbmtF7!FoT^pPwK`b76euk$ji&efhIT6OlvC^j{F>tytnQ_r-8> zyv+;UJ!x9xQL>E95yw#BXdSt)VqF~xbR?q&Sz5G$gMHz^*qbx4^;q0-9xan{EOvws zQv`-S^5?T|!7$6~*&)e$-3*y7mRf3W*vtJP2@<>}q{u+GYnItr5q9gL5~ z%r8dorTCooIbXw+wA;kHG@zQn$M}m?2WaXdV z{@eQYho7czrifYVG>F1T2bOnd`P-r}uMh<3$Lc+Um5!FHVkFJ^)S&vO57~BOoy6gU z+!Nr;(mc<1;nw`WTa}r>W?ML5qu_z7prjgn^g?-6|CFr|2%*+7D3EMZK4{zC_B-;x zbTkePWi<@;SS`}qi4Oy$vmI(%N@rBj$+HhW7Xgy>}z*QEoQw;#3MG>5VjZc33v48ulKQg=RUD;%0PpgGKC9tI4w zrq9YxnT}GVn~G!3&lm5SK7Be0!u;|o!bPR0B&z)C?|E{}UDdJn33`d8785%yL4 z7UlHl=(i;YAngJ1&yCa8o*FYs5ohiF#HHKwfvPUXD@C>-u3*xk^aZsqsJ(`qyBADe zg2@X~Vee4~ar2#q0UZ+&sXnq|F7jx-jZ2vADriZ}=T3@kemhChVkgzj8P4wW4~;hN zPL6#=X|{OxFZ#>=0$NndZ|XQ(?C(UcRhFe6*D85a%S`mGF0W0}B#2tg-V4i!{^FE0 z029*OsW&ymYMc10EZry9GaC!sej^MV=DyB=b?MAkfa}Qylp8S0uEhXK=O3daP#<(= zMwr;dG5JDmSy!{zW-v?5*FCDn^kn_UH1F~`F1Fj*qj=w}!|eB+tpPz<;1Js(bvM=G z1N}5vRwYx6Tv#1tZBmysHcOobx`_OW>=yZE1#`$Zo048hW1@<6TIy*N;MVc&B+AwP zYbd+u-&*H|-js=(Cfv8XtS8bT$iTlhUVNYmWv$ik``);n5Xva@n3x#x2OXz=Ns5k? zHgnxls(fF=uC|;kw-bgO+ufC{mA^9INy1W2EYpl4t=>~Go~cclGqI}snlg~N%w`l% ztYw*pzlw_HhSDa4O{^M2O$nE_#B8$rK9Py#H)WXFRJxNkdQ_Gef-3Xr_w=hn_g z0z$AnZ9yFX(fH1SM>EGz+ERs;Z#O#2(+J%BlDZ5xo%6rz0XvsB2S~^@xa2$EKJJ5Rm|4Xwwj~UE&_l5VbMxu@E9Q1y^r~ zg@i3l9Rn;R9UD7xgoUUrC7nDGOE_2LuAGo^`@#}0Eb-}B!gU;5Al@ShOtCFoIY1Ja zQkyW^p$SUp0Zo9tk+yk)3tJe!W{@VhDH)&%N5JjyC{1w8o{A>e_0YsAua%rc6UeS2 zrk(FxTnkNLXq+J2d?xTjrod+~1;OAUpT`c|J&zr@Eu3d12lha6;Mld@{!Ruv%p~{^ z?POeO0|9rr0UdG!f@w>7+yH~e$Ed-~{~>BH%tJ=0fjQ) literal 0 HcmV?d00001 From 424b03879bce3a4abc02e3b9a25d039f2b9a238e Mon Sep 17 00:00:00 2001 From: SiboVG Date: Thu, 29 Sep 2022 01:08:39 +0200 Subject: [PATCH 02/37] Update dbcook's database --- swing/resources-src/datafiles/components-dbcook | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swing/resources-src/datafiles/components-dbcook b/swing/resources-src/datafiles/components-dbcook index 525b7898f..49a453dd1 160000 --- a/swing/resources-src/datafiles/components-dbcook +++ b/swing/resources-src/datafiles/components-dbcook @@ -1 +1 @@ -Subproject commit 525b7898f9e92f40be9688a5a89a3d1de3bc12cd +Subproject commit 49a453dd1cb62f68dfbbbd56e69d7fbcdf4bd4a1 From 4d9fb7c2535a7b54ca816b9241764c339297c345 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Thu, 29 Sep 2022 13:14:03 +0200 Subject: [PATCH 03/37] Rename "Mac OS" to "macOS" --- swing/src/net/sf/openrocket/communication/AssetHandler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/swing/src/net/sf/openrocket/communication/AssetHandler.java b/swing/src/net/sf/openrocket/communication/AssetHandler.java index e21b5e997..942dec758 100644 --- a/swing/src/net/sf/openrocket/communication/AssetHandler.java +++ b/swing/src/net/sf/openrocket/communication/AssetHandler.java @@ -32,7 +32,7 @@ public class AssetHandler { mapExtensionToPlatform.put(".sh", new UpdatePlatform[] {UpdatePlatform.LINUX, UpdatePlatform.UNIX}); mapExtensionToPlatform.put(".jar", new UpdatePlatform[] {UpdatePlatform.JAR}); - mapPlatformToName.put(UpdatePlatform.MAC_OS, "Mac OS"); + mapPlatformToName.put(UpdatePlatform.MAC_OS, "macOS"); mapPlatformToName.put(UpdatePlatform.WINDOWS, "Windows"); mapPlatformToName.put(UpdatePlatform.LINUX, "Linux"); mapPlatformToName.put(UpdatePlatform.UNIX, "Linux"); @@ -42,7 +42,7 @@ public class AssetHandler { /** * Maps a list of asset URLs to their respective operating platform name. * E.g. "https://github.com/openrocket/openrocket/releases/download/release-15.03/OpenRocket-15.03.dmg" is mapped a - * map element with "Mac OS" as key and the url as value. + * map element with "macOS" as key and the url as value. * @param urls list of asset URLs * @return map with as key the operating platform name and as value the corresponding asset URL */ @@ -70,7 +70,7 @@ public class AssetHandler { } /** - * Get the name of a platform (e.g. for Platform.MAC_OS, return "Mac OS") + * Get the name of a platform (e.g. for Platform.MAC_OS, return "macOS") * @param platform platform to get the name from * @return name of the platform */ From 68dd2af95d5b83399d17d93dc78b0d459bf3920d Mon Sep 17 00:00:00 2001 From: SiboVG Date: Fri, 30 Sep 2022 03:36:40 +0200 Subject: [PATCH 04/37] Update software updater Updated layout + changed "Cancel" button to "Remind me later" & added a "Skip this version" button --- core/resources/l10n/messages.properties | 10 +-- .../sf/openrocket/startup/Preferences.java | 9 +++ .../gui/dialogs/UpdateInfoDialog.java | 79 ++++++++++++------- .../preferences/GeneralPreferencesPanel.java | 7 ++ .../sf/openrocket/startup/SwingStartup.java | 4 +- 5 files changed, 75 insertions(+), 34 deletions(-) diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index 4b1c2b4b8..f320aa563 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -306,7 +306,7 @@ pref.dlg.Allthrustcurvefiles = All thrust curve files (*.eng; *.rse; *.zip; dire pref.dlg.RASPfiles = RASP motor files (*.eng) pref.dlg.RockSimfiles = RockSim engine files (*.rse) pref.dlg.ZIParchives = ZIP archives (*.zip) -pref.dlg.checkbox.Checkupdates = Check for software updates at startup +pref.dlg.checkbox.Checkupdates = Always check for software updates at startup pref.dlg.checkbox.Checkupdates.ttip = Check for software updates every time you start up OpenRocket pref.dlg.checkbox.CheckBetaupdates = Also check for beta releases pref.dlg.checkbox.CheckBetaupdates.ttip = If checked, beta release updates are also notified. If unchecked, only official releases are considered. @@ -363,11 +363,11 @@ update.dlg.latestVersion = You are running the latest version of OpenRocket, ver update.dlg.newerVersion.title = Newer version detected update.dlg.newerVersion = You are either running a test/unofficial release of OpenRocket, or you have a time machine and are running an official release from the future.\n\nYour version: %s\nLatest official release: %s update.dlg.updateAvailable.title = Update available -update.dlg.updateAvailable.txtPane.title = OpenRocket version %s available! -update.dlg.updateAvailable.txtPane.yourVersion = Your current version: %s -update.dlg.updateAvailable.txtPane.changelog = Changelog +update.dlg.updateAvailable.lbl.title = A new version of OpenRocket is available! +update.dlg.updateAvailable.lbl.yourVersion = OpenRocket %s is available! \u2015 you have %s. Would you like to download it now? +update.dlg.updateAvailable.lbl.releaseNotes = Release notes: update.dlg.updateAvailable.txtPane.readMore = Read more on GitHub -update.dlg.updateAvailable.but.install = Install update +update.dlg.updateAvailable.but.install = Install Update update.dlg.updateAvailable.combo.noDownloads = No downloads available update.fetcher.badResponse = Bad response code from server: %d update.fetcher.badConnection = Could not connect to the GitHub server. Please check your internet connection. diff --git a/core/src/net/sf/openrocket/startup/Preferences.java b/core/src/net/sf/openrocket/startup/Preferences.java index 90da3c320..0b27c19f1 100644 --- a/core/src/net/sf/openrocket/startup/Preferences.java +++ b/core/src/net/sf/openrocket/startup/Preferences.java @@ -58,6 +58,7 @@ public abstract class Preferences implements ChangeSource { private static final String CHECK_UPDATES = "CheckUpdates"; + private static final String IGNORE_VERSIONS = "IgnoreVersions"; private static final String CHECK_BETA_UPDATES = "CheckBetaUpdates"; public static final String MOTOR_DIAMETER_FILTER = "MotorDiameterMatch"; @@ -150,6 +151,14 @@ public abstract class Preferences implements ChangeSource { this.putBoolean(CHECK_UPDATES, check); } + public final List getIgnoreVersions() { + return List.of(this.getString(IGNORE_VERSIONS, "").split("\n")); + } + + public final void setIgnoreVersions(List versions) { + this.putString(IGNORE_VERSIONS, String.join("\n", versions)); + } + public final boolean getCheckBetaUpdates() { return this.getBoolean(CHECK_BETA_UPDATES, BuildProperties.getDefaultCheckBetaUpdates()); } diff --git a/swing/src/net/sf/openrocket/gui/dialogs/UpdateInfoDialog.java b/swing/src/net/sf/openrocket/gui/dialogs/UpdateInfoDialog.java index e5587a812..3a8cc9bcf 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/UpdateInfoDialog.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/UpdateInfoDialog.java @@ -7,6 +7,7 @@ import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.net.URI; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -28,6 +29,8 @@ import net.sf.openrocket.communication.AssetHandler; import net.sf.openrocket.communication.AssetHandler.UpdatePlatform; import net.sf.openrocket.communication.ReleaseInfo; import net.sf.openrocket.communication.UpdateInfo; +import net.sf.openrocket.gui.components.StyledLabel; +import net.sf.openrocket.gui.configdialog.CommonStrings; import net.sf.openrocket.gui.util.GUIUtil; import net.sf.openrocket.gui.util.Icons; import net.sf.openrocket.gui.util.SwingPreferences; @@ -55,8 +58,19 @@ public class UpdateInfoDialog extends JDialog { JPanel panel = new JPanel(new MigLayout("insets n n 8px n, fill")); - panel.add(new JLabel(Icons.loadImageIcon("pix/icon/icon-about.png", "OpenRocket")), - "split, span, top"); + panel.add(new JLabel(Icons.getScaledIcon(Icons.loadImageIcon("pix/icon/icon-about.png", "OpenRocket"), 0.6)), + "spany, top, gapright 20px, cell 0 0"); + + // OpenRocket version available! + panel.add(new StyledLabel(trans.get("update.dlg.updateAvailable.lbl.title"), 8, StyledLabel.Style.BOLD), "spanx, wrap"); + + // Your version + ReleaseInfo release = info.getLatestRelease(); + panel.add(new StyledLabel(String.format(trans.get("update.dlg.updateAvailable.lbl.yourVersion"), + release.getReleaseName(), BuildProperties.getVersion()), -1, StyledLabel.Style.PLAIN), "skip 1, spanx, wrap para"); + + // Release notes + panel.add(new StyledLabel(trans.get("update.dlg.updateAvailable.lbl.releaseNotes"), 1, StyledLabel.Style.BOLD), "spanx, wrap"); // Release information box final JTextPane textPane = new JTextPane(); @@ -65,18 +79,10 @@ public class UpdateInfoDialog extends JDialog { textPane.setMargin(new Insets(10, 10, 40, 10)); textPane.putClientProperty(JTextPane.HONOR_DISPLAY_PROPERTIES, true); - ReleaseInfo release = info.getLatestRelease(); StringBuilder sb = new StringBuilder(); - - // OpenRocket version available! sb.append(""); - sb.append(String.format("

%s

", String.format(trans.get("update.dlg.updateAvailable.txtPane.title"), release.getReleaseName()))); - // Your version - sb.append(String.format("%s

", String.format(trans.get("update.dlg.updateAvailable.txtPane.yourVersion"), BuildProperties.getVersion()))); - - // Changelog - sb.append(String.format("

%s

", trans.get("update.dlg.updateAvailable.txtPane.changelog"))); + // Release notes String releaseNotes = release.getReleaseNotes(); releaseNotes = releaseNotes.replaceAll("^\"|\"$", ""); // Remove leading and trailing quotations sb.append(MarkdownUtil.toHtml(releaseNotes)).append("

"); @@ -103,7 +109,7 @@ public class UpdateInfoDialog extends JDialog { textPane.setText(sb.toString()); textPane.setCaretPosition(0); // Scroll to the top - panel.add(new JScrollPane(textPane), "left, grow, span, push, gapleft 40px, gapbottom 6px, wrap"); + panel.add(new JScrollPane(textPane), "skip 1, left, spanx, grow, push, gapbottom 6px, wrap"); //// Check for software updates at startup JCheckBox checkAtStartup = new JCheckBox(trans.get("pref.dlg.checkbox.Checkupdates")); @@ -116,9 +122,36 @@ public class UpdateInfoDialog extends JDialog { preferences.setCheckUpdates(checkAtStartup.isSelected()); } }); - panel.add(checkAtStartup); + panel.add(checkAtStartup, "skip 1, spanx, wrap"); - // Install operating system combo box + // Lower row buttons + //// Remind me later button + JButton btnLater = new SelectColorButton("Remind Me Later"); + btnLater.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + UpdateInfoDialog.this.dispose(); + } + }); + panel.add(btnLater, "skip 1, split 2"); + + //// Skip this version button + JButton btnSkip = new SelectColorButton("Skip This Version"); + btnSkip.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + List ignoreVersions = new ArrayList<>(preferences.getIgnoreVersions()); + String ignore = release.getReleaseName(); + if (!ignoreVersions.contains(ignore)) { + ignoreVersions.add(ignore); + preferences.setIgnoreVersions(ignoreVersions); + } + UpdateInfoDialog.this.dispose(); + } + }); + panel.add(btnSkip); + + //// Install operating system combo box List assetURLs = release.getAssetURLs(); Map mappedAssets = AssetHandler.mapURLToPlatform(assetURLs); JComboBox comboBox; @@ -141,7 +174,7 @@ public class UpdateInfoDialog extends JDialog { } panel.add(comboBox, "pushx, right"); - // Install update button + //// Install update button JButton btnInstall = new SelectColorButton(trans.get("update.dlg.updateAvailable.but.install")); btnInstall.addActionListener(new ActionListener() { @Override @@ -159,25 +192,15 @@ public class UpdateInfoDialog extends JDialog { if (mappedAssets == null || mappedAssets.size() == 0) { btnInstall.setEnabled(false); } - panel.add(btnInstall, "gapright 20"); - - // Cancel button - JButton btnCancel = new SelectColorButton(trans.get("button.cancel")); - btnCancel.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - UpdateInfoDialog.this.dispose(); - } - }); - panel.add(btnCancel); + panel.add(btnInstall, "wrap"); - panel.setPreferredSize(new Dimension(900, 600)); + panel.setPreferredSize(new Dimension(850, 700)); this.add(panel); this.pack(); this.setLocationRelativeTo(null); - GUIUtil.setDisposableDialogOptions(this, btnCancel); + GUIUtil.setDisposableDialogOptions(this, btnLater); } /** diff --git a/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java b/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java index e2efb2251..d4613d0e0 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java @@ -326,6 +326,13 @@ public class GeneralPreferencesPanel extends PreferencesPanel { // Nothing went wrong (yay!) ReleaseStatus status = info.getReleaseStatus(); ReleaseInfo release = info.getLatestRelease(); + + // Do nothing if the release is part of the ignore versions + if (preferences.getIgnoreVersions().contains(release.getReleaseName())) { + return; + } + + // Display software updater dialog, based on the current build version status switch (status) { case LATEST: JOptionPane.showMessageDialog(this, diff --git a/swing/src/net/sf/openrocket/startup/SwingStartup.java b/swing/src/net/sf/openrocket/startup/SwingStartup.java index 462549e11..4758c26e8 100644 --- a/swing/src/net/sf/openrocket/startup/SwingStartup.java +++ b/swing/src/net/sf/openrocket/startup/SwingStartup.java @@ -268,10 +268,12 @@ public class SwingStartup { if (!updateRetriever.isRunning()) { timer.stop(); + final SwingPreferences preferences = (SwingPreferences) Application.getPreferences(); UpdateInfo info = updateRetriever.getUpdateInfo(); // Only display something when an update is found - if (info != null && info.getException() == null && info.getReleaseStatus() == ReleaseStatus.OLDER) { + if (info != null && info.getException() == null && info.getReleaseStatus() == ReleaseStatus.OLDER && + !preferences.getIgnoreVersions().contains(info.getLatestRelease().getReleaseName())) { UpdateInfoDialog infoDialog = new UpdateInfoDialog(info); infoDialog.setVisible(true); } From b7d809b568375b1ebdcc3be44975f97d11d5bef0 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Fri, 30 Sep 2022 05:07:42 +0200 Subject: [PATCH 05/37] Check for updates upon macOS app reopen --- .../net/sf/openrocket/startup/OSXSetup.java | 5 ++++ .../sf/openrocket/startup/SwingStartup.java | 26 +++++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/swing/src/net/sf/openrocket/startup/OSXSetup.java b/swing/src/net/sf/openrocket/startup/OSXSetup.java index e16ac9716..4023875d2 100644 --- a/swing/src/net/sf/openrocket/startup/OSXSetup.java +++ b/swing/src/net/sf/openrocket/startup/OSXSetup.java @@ -7,6 +7,7 @@ import java.awt.desktop.PreferencesHandler; import java.awt.desktop.QuitHandler; import java.awt.desktop.AppReopenedListener; +import net.sf.openrocket.communication.UpdateInfoRetriever; import net.sf.openrocket.gui.util.DummyFrameMenuOSX; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,6 +57,10 @@ final class OSXSetup { if (BasicFrame.isFramesEmpty()) { log.info("App re-opened"); BasicFrame.reopen(); + + // Also check for software updates + final UpdateInfoRetriever updateRetriever = SwingStartup.startUpdateChecker(); + SwingStartup.checkUpdateStatus(updateRetriever); } }; diff --git a/swing/src/net/sf/openrocket/startup/SwingStartup.java b/swing/src/net/sf/openrocket/startup/SwingStartup.java index 4758c26e8..954abcc44 100644 --- a/swing/src/net/sf/openrocket/startup/SwingStartup.java +++ b/swing/src/net/sf/openrocket/startup/SwingStartup.java @@ -193,15 +193,7 @@ public class SwingStartup { guiModule.startLoader(); // Start update info fetching - final UpdateInfoRetriever updateRetriever; - if (Application.getPreferences().getCheckUpdates()) { - log.info("Starting update check"); - updateRetriever = new UpdateInfoRetriever(); - updateRetriever.startFetchUpdateInfo(); - } else { - log.info("Update check disabled"); - updateRetriever = null; - } + final UpdateInfoRetriever updateRetriever = startUpdateChecker(); // Set the best available look-and-feel log.info("Setting best LAF"); @@ -248,9 +240,21 @@ public class SwingStartup { } } + + public static UpdateInfoRetriever startUpdateChecker() { + final UpdateInfoRetriever updateRetriever; + if (Application.getPreferences().getCheckUpdates()) { + log.info("Starting update check"); + updateRetriever = new UpdateInfoRetriever(); + updateRetriever.startFetchUpdateInfo(); + } else { + log.info("Update check disabled"); + updateRetriever = null; + } + return updateRetriever; + } - - private void checkUpdateStatus(final UpdateInfoRetriever updateRetriever) { + public static void checkUpdateStatus(final UpdateInfoRetriever updateRetriever) { if (updateRetriever == null) return; From 4e28d80d97357c286c078050008a83453a6294e9 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Fri, 30 Sep 2022 17:07:24 +0200 Subject: [PATCH 06/37] Ignore IntelliJ shelf files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 98ce20189..3b0822153 100644 --- a/.gitignore +++ b/.gitignore @@ -49,6 +49,7 @@ # User-specific stuff: .idea/workspace.xml .idea/tasks.xml +.idea/shelf .idea/dictionaries .idea/vcs.xml .idea/jsLibraryMappings.xml From 685dffe960ad80d2a3cff20790532652953554a9 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Fri, 30 Sep 2022 17:09:21 +0200 Subject: [PATCH 07/37] [#1704] Add change listener for stage selector in component analysis --- .../sf/openrocket/gui/dialogs/ComponentAnalysisDialog.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/swing/src/net/sf/openrocket/gui/dialogs/ComponentAnalysisDialog.java b/swing/src/net/sf/openrocket/gui/dialogs/ComponentAnalysisDialog.java index da24d6c90..bbcf8f8d3 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/ComponentAnalysisDialog.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/ComponentAnalysisDialog.java @@ -171,8 +171,10 @@ public class ComponentAnalysisDialog extends JDialog implements StateChangeListe // Stage and motor selection: //// Active stages: + StageSelector stageSelector = new StageSelector(rkt); + rkt.addChangeListener(stageSelector); panel.add(new JLabel(trans.get("componentanalysisdlg.lbl.activestages")), "spanx, split, gapafter rel"); - panel.add(new StageSelector( rkt), "gapafter paragraph"); + panel.add(stageSelector, "gapafter paragraph"); //// Motor configuration: JLabel label = new JLabel(trans.get("componentanalysisdlg.lbl.motorconf")); From 1b50d8152c599653abe073e25b723f8382708309 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Fri, 30 Sep 2022 19:02:09 +0200 Subject: [PATCH 08/37] Increase component add button text size --- swing/src/net/sf/openrocket/gui/main/ComponentAddButtons.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swing/src/net/sf/openrocket/gui/main/ComponentAddButtons.java b/swing/src/net/sf/openrocket/gui/main/ComponentAddButtons.java index 0ff03e261..86efa3799 100644 --- a/swing/src/net/sf/openrocket/gui/main/ComponentAddButtons.java +++ b/swing/src/net/sf/openrocket/gui/main/ComponentAddButtons.java @@ -331,7 +331,7 @@ public class ComponentAddButtons extends JPanel implements Scrollable { // Add labels String[] l = text.split("\n"); for (int i = 0; i < l.length; i++) { - add(new StyledLabel(l[i], SwingConstants.CENTER, -3.0f), "growx"); + add(new StyledLabel(l[i], SwingConstants.CENTER, -2.0f), "growx"); } add(new JLabel(), "push, sizegroup spacing"); From 0b3c4ec7b15663a289b9c3dcad9e85341779b1d9 Mon Sep 17 00:00:00 2001 From: Ray Clark Date: Sun, 2 Oct 2022 19:40:01 +1100 Subject: [PATCH 09/37] Added blank WarningSet to fix error --- .../openrocket/simulation/listeners/example/DampingMoment.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/simulation/listeners/example/DampingMoment.java b/core/src/net/sf/openrocket/simulation/listeners/example/DampingMoment.java index 0665766e6..326a1843f 100644 --- a/core/src/net/sf/openrocket/simulation/listeners/example/DampingMoment.java +++ b/core/src/net/sf/openrocket/simulation/listeners/example/DampingMoment.java @@ -6,6 +6,7 @@ import java.util.Map; import net.sf.openrocket.aerodynamics.AerodynamicCalculator; import net.sf.openrocket.aerodynamics.AerodynamicForces; import net.sf.openrocket.aerodynamics.FlightConditions; +import net.sf.openrocket.aerodynamics.WarningSet; import net.sf.openrocket.motor.MotorConfiguration; import net.sf.openrocket.rocketcomponent.FlightConfiguration; import net.sf.openrocket.rocketcomponent.RocketComponent; @@ -85,7 +86,7 @@ public class DampingMoment extends AbstractSimulationListener { AerodynamicCalculator aerocalc = status.getSimulationConditions().getAerodynamicCalculator(); // Must go through each component ... - Map forces = aerocalc.getForceAnalysis(status.getConfiguration(), flightConditions, null); + Map forces = aerocalc.getForceAnalysis(status.getConfiguration(), flightConditions, new WarningSet()); for (Map.Entry entry : forces.entrySet()) { RocketComponent comp = entry.getKey(); From 07c2ce874351a89084df07d694e0461875367380 Mon Sep 17 00:00:00 2001 From: Ray Clark Date: Mon, 3 Oct 2022 00:30:00 +1100 Subject: [PATCH 10/37] Fixed flight event labels getting cut off --- swing/src/net/sf/openrocket/gui/plot/SimulationPlot.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/swing/src/net/sf/openrocket/gui/plot/SimulationPlot.java b/swing/src/net/sf/openrocket/gui/plot/SimulationPlot.java index 9bcb0253f..5d866dabc 100644 --- a/swing/src/net/sf/openrocket/gui/plot/SimulationPlot.java +++ b/swing/src/net/sf/openrocket/gui/plot/SimulationPlot.java @@ -427,7 +427,7 @@ public class SimulationPlot { // Plot the markers if (config.getDomainAxisType() == FlightDataType.TYPE_TIME) { - + double markerWidth = 0.7; // Domain time is plotted as vertical markers for (int i = 0; i < eventTimes.size(); i++) { double t = eventTimes.get(i); @@ -441,6 +441,10 @@ public class SimulationPlot { m.setAlpha(0.7f); m.setLabelFont(new Font("Dialog", Font.PLAIN, 13)); plot.addDomainMarker(m); + + if (t > plot.getDomainAxis().getUpperBound() - markerWidth) { + plot.setDomainAxis(new PresetNumberAxis(plot.getDomainAxis().getLowerBound(), t + markerWidth)); + } } } else { From caff69e01f6cffa51aa0424ed9f0d5ad54d4ffbc Mon Sep 17 00:00:00 2001 From: Ray Clark Date: Mon, 3 Oct 2022 00:43:54 +1100 Subject: [PATCH 11/37] Scaled marker width with plot size --- swing/src/net/sf/openrocket/gui/plot/SimulationPlot.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/swing/src/net/sf/openrocket/gui/plot/SimulationPlot.java b/swing/src/net/sf/openrocket/gui/plot/SimulationPlot.java index 5d866dabc..9900305b4 100644 --- a/swing/src/net/sf/openrocket/gui/plot/SimulationPlot.java +++ b/swing/src/net/sf/openrocket/gui/plot/SimulationPlot.java @@ -427,7 +427,8 @@ public class SimulationPlot { // Plot the markers if (config.getDomainAxisType() == FlightDataType.TYPE_TIME) { - double markerWidth = 0.7; + double markerWidth = 0.01 * plot.getDomainAxis().getUpperBound(); + // Domain time is plotted as vertical markers for (int i = 0; i < eventTimes.size(); i++) { double t = eventTimes.get(i); From c86569bd1b0e6ae6f949e4b5b2768d866321f844 Mon Sep 17 00:00:00 2001 From: Ray Clark Date: Mon, 3 Oct 2022 11:06:33 +1100 Subject: [PATCH 12/37] Forward simulation warning set --- .../openrocket/simulation/listeners/example/DampingMoment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/simulation/listeners/example/DampingMoment.java b/core/src/net/sf/openrocket/simulation/listeners/example/DampingMoment.java index 326a1843f..6d5839e07 100644 --- a/core/src/net/sf/openrocket/simulation/listeners/example/DampingMoment.java +++ b/core/src/net/sf/openrocket/simulation/listeners/example/DampingMoment.java @@ -86,7 +86,7 @@ public class DampingMoment extends AbstractSimulationListener { AerodynamicCalculator aerocalc = status.getSimulationConditions().getAerodynamicCalculator(); // Must go through each component ... - Map forces = aerocalc.getForceAnalysis(status.getConfiguration(), flightConditions, new WarningSet()); + Map forces = aerocalc.getForceAnalysis(status.getConfiguration(), flightConditions, status.getWarnings()); for (Map.Entry entry : forces.entrySet()) { RocketComponent comp = entry.getKey(); From ad46bb9b6e4a362d6017d0136856d7709acf780f Mon Sep 17 00:00:00 2001 From: Ray Clark Date: Mon, 3 Oct 2022 11:20:47 +1100 Subject: [PATCH 13/37] Fixed NPE when scaling if no components are selected --- .../src/net/sf/openrocket/gui/main/DocumentSelectionModel.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/swing/src/net/sf/openrocket/gui/main/DocumentSelectionModel.java b/swing/src/net/sf/openrocket/gui/main/DocumentSelectionModel.java index 5d9277df7..dff4a0097 100644 --- a/swing/src/net/sf/openrocket/gui/main/DocumentSelectionModel.java +++ b/swing/src/net/sf/openrocket/gui/main/DocumentSelectionModel.java @@ -2,6 +2,7 @@ package net.sf.openrocket.gui.main; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -90,7 +91,7 @@ public class DocumentSelectionModel { * @return the currently selected rocket components, or null. */ public List getSelectedComponents() { - if (componentSelection.size() == 0) return null; + if (componentSelection.size() == 0) return Collections.EMPTY_LIST; return componentSelection; } From cb9be5715ec22be1cf88bc90c7fc54ddb6879189 Mon Sep 17 00:00:00 2001 From: Ray Clark Date: Mon, 3 Oct 2022 11:56:47 +1100 Subject: [PATCH 14/37] Fixed photo studio save indents --- .../net/sf/openrocket/file/openrocket/OpenRocketSaver.java | 7 +++++++ .../file/openrocket/savers/PhotoStudioSaver.java | 4 ---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/net/sf/openrocket/file/openrocket/OpenRocketSaver.java b/core/src/net/sf/openrocket/file/openrocket/OpenRocketSaver.java index 6e32873e4..3cc791d79 100644 --- a/core/src/net/sf/openrocket/file/openrocket/OpenRocketSaver.java +++ b/core/src/net/sf/openrocket/file/openrocket/OpenRocketSaver.java @@ -428,8 +428,15 @@ public class OpenRocketSaver extends RocketSaver { private void savePhotoSettings(Map p) throws IOException { log.debug("Saving Photo Settings"); + + writeln(""); + indent++; + for (String s : PhotoStudioSaver.getElements(p)) writeln(s); + + indent--; + writeln(""); } diff --git a/core/src/net/sf/openrocket/file/openrocket/savers/PhotoStudioSaver.java b/core/src/net/sf/openrocket/file/openrocket/savers/PhotoStudioSaver.java index 2d91e5f40..8e9280705 100644 --- a/core/src/net/sf/openrocket/file/openrocket/savers/PhotoStudioSaver.java +++ b/core/src/net/sf/openrocket/file/openrocket/savers/PhotoStudioSaver.java @@ -21,8 +21,6 @@ public class PhotoStudioSaver { if (photoSettings == null || photoSettings.size() == 0) return elements; - elements.add(""); - elements.add("" + photoSettings.get("roll") + ""); elements.add("" + photoSettings.get("yaw") + ""); elements.add("" + photoSettings.get("pitch") + ""); @@ -55,8 +53,6 @@ public class PhotoStudioSaver { elements.add("" + photoSettings.get("sky") + ""); - elements.add(""); - return elements; } From 0f3fffb21d7318fffd0c8436df668539e82c999f Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Mon, 3 Oct 2022 11:39:00 -0600 Subject: [PATCH 15/37] Allow out of order stage separation --- .../rocketcomponent/FlightConfiguration.java | 30 ++++++++++++++++++- .../BasicEventSimulationEngine.java | 21 ++++++++----- 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java index 10c302735..78ce41f66 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java @@ -146,6 +146,34 @@ public class FlightConfiguration implements FlightConfigurableParameterfalse) or active (true) diff --git a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java index fd864e789..5212790b8 100644 --- a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java +++ b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java @@ -305,6 +305,9 @@ public class BasicEventSimulationEngine implements SimulationEngine { if (event.getSource() != null && event.getSource().getParent() != null && !currentStatus.getConfiguration().isComponentActive(event.getSource())) { log.trace("Ignoring event from unattached component"); + log.debug(" source " + event.getSource()); + log.debug(" parent " + event.getSource().getParent()); + log.debug(" active " + currentStatus.getConfiguration().isComponentActive(event.getSource())); continue; } @@ -381,7 +384,6 @@ public class BasicEventSimulationEngine implements SimulationEngine { } // and queue up the burnout for this motor, as well. -// double duration = motorState.getMotor().getBurnTimeEstimate(); double duration = motorState.getBurnTime(); double burnout = currentStatus.getSimulationTime() + duration; addEvent(new FlightEvent(FlightEvent.Type.BURNOUT, burnout, @@ -436,19 +438,24 @@ public class BasicEventSimulationEngine implements SimulationEngine { case STAGE_SEPARATION: { RocketComponent boosterStage = event.getSource(); final int stageNumber = boosterStage.getStageNumber(); + log.debug("separating at stage " + stageNumber); if (currentStatus.getConfiguration().isStageActive(stageNumber-1)) { // Record the event. currentStatus.getFlightData().addEvent(event); - // Mark the status as having dropped the booster - currentStatus.getConfiguration().clearStage( stageNumber); - - // Prepare the simulation branch + // Create a new simulation branch for the booster SimulationStatus boosterStatus = new SimulationStatus(currentStatus); + + // Prepare the new simulation branch boosterStatus.setFlightData(new FlightDataBranch(boosterStage.getName(), FlightDataType.TYPE_TIME)); - // Mark the booster status as only having the booster. - boosterStatus.getConfiguration().setOnlyStage(stageNumber); + + // Mark the current status as having dropped the current stage and all stages below it + currentStatus.getConfiguration().clearStagesBelow( stageNumber); + + // Mark the booster status as having no active stages above + boosterStatus.getConfiguration().clearStagesAbove(stageNumber); + toSimulate.push(boosterStatus); log.info(String.format("==>> @ %g; from Branch: %s ---- Branching: %s ---- \n", currentStatus.getSimulationTime(), From 756ae90f9d2b7609a398f383827b9973cbe22eff Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Mon, 3 Oct 2022 12:39:15 -0600 Subject: [PATCH 16/37] Add a warning to the WarningSet when stage separation order is unreasonable --- core/resources/l10n/messages.properties | 1 + core/src/net/sf/openrocket/aerodynamics/Warning.java | 2 ++ .../simulation/BasicEventSimulationEngine.java | 12 ++++++++++++ 3 files changed, 15 insertions(+) diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index 4b1c2b4b8..46a969ff4 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -1827,6 +1827,7 @@ Warning.ZERO_LENGTH_BODY = Zero length bodies may not result in accurate simulat Warning.ZERO_RADIUS_BODY = Zero length bodies may not result in accurate simulations. Warning.TUBE_SEPARATION = Space between tube fins may not result in accurate simulations. Warning.TUBE_OVERLAP = Overlapping tube fins may not result in accurate simulations. +Warning.SEPARATION_ORDER = Stages separated in an unreasonable order ! Scale dialog ScaleDialog.lbl.scaleRocket = Entire rocket diff --git a/core/src/net/sf/openrocket/aerodynamics/Warning.java b/core/src/net/sf/openrocket/aerodynamics/Warning.java index b48a35a5e..803073948 100644 --- a/core/src/net/sf/openrocket/aerodynamics/Warning.java +++ b/core/src/net/sf/openrocket/aerodynamics/Warning.java @@ -396,4 +396,6 @@ public abstract class Warning { public static final Warning TUBE_SEPARATION = new Other(trans.get("Warning.TUBE_SEPARATION")); public static final Warning TUBE_OVERLAP = new Other(trans.get("Warning.TUBE_OVERLAP")); + + public static final Warning SEPARATION_ORDER = new Other(trans.get("Warning.SEPARATION_ORDER")); } diff --git a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java index 5212790b8..ecb4ae5cb 100644 --- a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java +++ b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java @@ -444,6 +444,18 @@ public class BasicEventSimulationEngine implements SimulationEngine { // Record the event. currentStatus.getFlightData().addEvent(event); + // If I've got something other than one active stage below the separation point, + // flag a warning + int numActiveBelow = 0; + for (int i = stageNumber; i < currentStatus.getConfiguration().getStageCount(); i++) { + if (currentStatus.getConfiguration().isStageActive(i)) { + numActiveBelow++; + } + } + if (numActiveBelow != 1) { + currentStatus.getWarnings().add(Warning.SEPARATION_ORDER); + } + // Create a new simulation branch for the booster SimulationStatus boosterStatus = new SimulationStatus(currentStatus); From 9edc8eaea0d6671ecc60cd41edbd2afa7760a3fd Mon Sep 17 00:00:00 2001 From: SiboVG Date: Tue, 4 Oct 2022 08:52:48 +0200 Subject: [PATCH 17/37] Don't explicitly save smokeAlpha in photostudio .ork --- .../openrocket/savers/PhotoStudioSaver.java | 1 - .../file/photo/PhotoStudioGetter.java | 5 ---- .../file/photo/PhotoStudioSetter.java | 1 - .../gui/figure3d/photo/PhotoSettings.java | 24 +++++++------------ .../figure3d/photo/exhaust/FlameRenderer.java | 2 -- 5 files changed, 9 insertions(+), 24 deletions(-) diff --git a/core/src/net/sf/openrocket/file/openrocket/savers/PhotoStudioSaver.java b/core/src/net/sf/openrocket/file/openrocket/savers/PhotoStudioSaver.java index 8e9280705..16a79c459 100644 --- a/core/src/net/sf/openrocket/file/openrocket/savers/PhotoStudioSaver.java +++ b/core/src/net/sf/openrocket/file/openrocket/savers/PhotoStudioSaver.java @@ -43,7 +43,6 @@ public class PhotoStudioSaver { emitColor("flameColor", elements, photoSettings.get("flameColor")); elements.add("" + photoSettings.get("smoke") + ""); emitColor("smokeColor", elements, photoSettings.get("smokeColor")); - elements.add("" + photoSettings.get("smokeOpacity") + ""); elements.add("" + photoSettings.get("sparks") + ""); elements.add("" + photoSettings.get("exhaustScale") + ""); elements.add("" + photoSettings.get("flameAspectRatio") + ""); diff --git a/swing/src/net/sf/openrocket/file/photo/PhotoStudioGetter.java b/swing/src/net/sf/openrocket/file/photo/PhotoStudioGetter.java index 31bea899d..41f37e796 100644 --- a/swing/src/net/sf/openrocket/file/photo/PhotoStudioGetter.java +++ b/swing/src/net/sf/openrocket/file/photo/PhotoStudioGetter.java @@ -135,11 +135,6 @@ public class PhotoStudioGetter { p.setSmokeColor(smokeColor); return; } - if ("smokeOpacity".equals(element)) { - double smokeOpacity = Double.parseDouble(content); - p.setSmokeOpacity(smokeOpacity); - return; - } if ("sparks".equals(element)) { boolean sparks = Boolean.parseBoolean(content); p.setSparks(sparks); diff --git a/swing/src/net/sf/openrocket/file/photo/PhotoStudioSetter.java b/swing/src/net/sf/openrocket/file/photo/PhotoStudioSetter.java index 3fd4bd48f..b5dfec0ca 100644 --- a/swing/src/net/sf/openrocket/file/photo/PhotoStudioSetter.java +++ b/swing/src/net/sf/openrocket/file/photo/PhotoStudioSetter.java @@ -41,7 +41,6 @@ public class PhotoStudioSetter { photoSettings.put("flameColor", getColor(p.getFlameColor())); photoSettings.put("smoke", String.valueOf(p.isSmoke())); photoSettings.put("smokeColor", getColor(p.getSmokeColor())); - photoSettings.put("smokeOpacity", String.valueOf(p.getSmokeOpacity())); photoSettings.put("sparks", String.valueOf(p.isSparks())); photoSettings.put("exhaustScale", String.valueOf(p.getExhaustScale())); photoSettings.put("flameAspectRatio", String.valueOf(p.getFlameAspectRatio())); diff --git a/swing/src/net/sf/openrocket/gui/figure3d/photo/PhotoSettings.java b/swing/src/net/sf/openrocket/gui/figure3d/photo/PhotoSettings.java index 23599f7f3..ab2ab795b 100644 --- a/swing/src/net/sf/openrocket/gui/figure3d/photo/PhotoSettings.java +++ b/swing/src/net/sf/openrocket/gui/figure3d/photo/PhotoSettings.java @@ -31,7 +31,6 @@ public class PhotoSettings extends AbstractChangeSource implements FlameSettings private Color flameColor = new Color(255, 100, 50); private boolean smoke = false; private Color smokeColor = new Color(230, 230, 230, 102); - private double smokeOpacity = 0.4; private boolean sparks = false; private double exhaustScale = 1.0; private double flameAspectRatio = 1.0; @@ -204,19 +203,23 @@ public class PhotoSettings extends AbstractChangeSource implements FlameSettings } public void setSmokeColor(Color smokeColor) { - smokeColor.setAlpha(this.smokeColor.getAlpha()); this.smokeColor = smokeColor; fireChangeEvent(); } - - public double getSmokeAlpha() { - return smokeColor.getAlpha() / 255f; - } + public void setSmokeAlpha(double alpha) { smokeColor.setAlpha((int) (alpha * 255)); fireChangeEvent(); } + + public double getSmokeOpacity() { + return smokeColor.getAlpha() / 255f; + } + + public void setSmokeOpacity(double smokeOpacity) { + setSmokeAlpha(smokeOpacity); + } public boolean isSparks() { return sparks; @@ -271,13 +274,4 @@ public class PhotoSettings extends AbstractChangeSource implements FlameSettings this.sparkWeight = sparkWeight; fireChangeEvent(); } - - public double getSmokeOpacity() { - return smokeOpacity; - } - - public void setSmokeOpacity(double smokeOpacity) { - this.smokeOpacity = smokeOpacity; - setSmokeAlpha(smokeOpacity); - } } \ No newline at end of file diff --git a/swing/src/net/sf/openrocket/gui/figure3d/photo/exhaust/FlameRenderer.java b/swing/src/net/sf/openrocket/gui/figure3d/photo/exhaust/FlameRenderer.java index 8980ea0e6..524324ff2 100644 --- a/swing/src/net/sf/openrocket/gui/figure3d/photo/exhaust/FlameRenderer.java +++ b/swing/src/net/sf/openrocket/gui/figure3d/photo/exhaust/FlameRenderer.java @@ -152,8 +152,6 @@ public final class FlameRenderer { public Color getSmokeColor(); - public double getSmokeAlpha(); - public double getFlameAspectRatio(); public boolean isSparks(); From 67bb0ebee7e2e708fd73fd263ff588ad6fdb7c12 Mon Sep 17 00:00:00 2001 From: Ray Clark Date: Tue, 4 Oct 2022 20:14:43 +1100 Subject: [PATCH 18/37] Changed EMPTY_LIST to emptyList() --- .../src/net/sf/openrocket/gui/main/DocumentSelectionModel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swing/src/net/sf/openrocket/gui/main/DocumentSelectionModel.java b/swing/src/net/sf/openrocket/gui/main/DocumentSelectionModel.java index dff4a0097..54848a521 100644 --- a/swing/src/net/sf/openrocket/gui/main/DocumentSelectionModel.java +++ b/swing/src/net/sf/openrocket/gui/main/DocumentSelectionModel.java @@ -91,7 +91,7 @@ public class DocumentSelectionModel { * @return the currently selected rocket components, or null. */ public List getSelectedComponents() { - if (componentSelection.size() == 0) return Collections.EMPTY_LIST; + if (componentSelection.size() == 0) return Collections.emptyList(); return componentSelection; } From e05e77dedeeb4df4cb692fb9f05317d4fb6be86a Mon Sep 17 00:00:00 2001 From: UncleRus Date: Sun, 9 Oct 2022 12:20:25 +0500 Subject: [PATCH 19/37] l10n: sync russian translation --- core/resources/l10n/messages_ru.properties | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/resources/l10n/messages_ru.properties b/core/resources/l10n/messages_ru.properties index 2903f7242..622206d70 100644 --- a/core/resources/l10n/messages_ru.properties +++ b/core/resources/l10n/messages_ru.properties @@ -64,6 +64,8 @@ RocketPanel.lbl.Stability = \u0421\u0442\u0430\u0431\u0438\u043B\u044C\u043D\u04 RocketPanel.checkbox.ShowCGCP = \u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0426\u0422/\u0426\u0414 RocketPanel.checkbox.ShowCGCP.ttip = \u041E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435 \u044D\u0442\u043E\u0433\u043E \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430 \u0441\u043A\u0440\u043E\u0435\u0442 \u043E\u0442\u043C\u0435\u0442\u043A\u0438 \u0426\u0422/\u0426\u0414. RocketPanel.lbl.Stages = \u0421\u0442\u0443\u043F\u0435\u043D\u0438: +RocketPanel.btn.Stages.Toggle.ttip = \u041D\u0430\u0436\u0430\u0442\u0438\u0435 \u044D\u0442\u043E\u0439 \u043A\u043D\u043E\u043F\u043A\u0438 \u0430\u043A\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442/\u0434\u0435\u0430\u043A\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044E\u0449\u0443\u044E \u0441\u0442\u0443\u043F\u0435\u043D\u044C \u0440\u0430\u043A\u0435\u0442\u044B. +RocketPanel.btn.Stages.NoChildren.ttip = \u0412 \u044D\u0442\u043E\u0439 \u0441\u0442\u0443\u043F\u0435\u043D\u0438 \u043D\u0435\u0442 \u0434\u043E\u0447\u0435\u0440\u043D\u0438\u0445 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u043E\u0432, \u043F\u043E\u044D\u0442\u043E\u043C\u0443 \u043E\u043D\u0430 \u043F\u043E\u043C\u0435\u0447\u0435\u043D\u0430 \u043A\u0430\u043A \u043D\u0435\u0430\u043A\u0442\u0438\u0432\u043D\u0430\u044F.
\u0414\u043E\u0431\u0430\u0432\u044C\u0442\u0435 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u044B \u0432 \u0441\u0442\u0443\u043F\u0435\u043D\u044C, \u0447\u0442\u043E\u0431\u044B \u0430\u043A\u0442\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0435\u0451. RocketPanel.ttip.Rotation = \u0421\u043C\u0435\u043D\u0430 \u0432\u0440\u0430\u0449\u0435\u043D\u0438\u044F \u043A\u0440\u0435\u043D\u0430 \u0440\u0430\u043A\u0435\u0442\u044B (\u0442\u043E\u043B\u044C\u043A\u043E \u0432 \u043E\u043A\u043D\u0435 \u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0430) ! BasicFrame @@ -305,7 +307,7 @@ pref.dlg.Allthrustcurvefiles = \u0424\u0430\u0439\u043B\u044B \u043F\u0440\u043E pref.dlg.RASPfiles = \u0424\u0430\u0439\u043B\u044B \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043B\u0435\u0439 RASP (*.eng) pref.dlg.RockSimfiles = \u0424\u0430\u0439\u043B\u044B \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043B\u0435\u0439 RockSim (*.rse) pref.dlg.ZIParchives = ZIP-\u0430\u0440\u0445\u0438\u0432\u044B (*.zip) -pref.dlg.checkbox.Checkupdates = \u041F\u0440\u043E\u0432\u0435\u0440\u044F\u0442\u044C \u043D\u0430\u043B\u0438\u0447\u0438\u0435 \u043D\u043E\u0432\u043E\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043F\u0440\u0438 \u0437\u0430\u043F\u0443\u0441\u043A\u0435 +pref.dlg.checkbox.Checkupdates = \u0412\u0441\u0435\u0433\u0434\u0430 \u043F\u0440\u043E\u0432\u0435\u0440\u044F\u0442\u044C \u043D\u0430\u043B\u0438\u0447\u0438\u0435 \u043D\u043E\u0432\u043E\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043F\u0440\u0438 \u0437\u0430\u043F\u0443\u0441\u043A\u0435 pref.dlg.checkbox.Checkupdates.ttip = \u041F\u0440\u043E\u0432\u0435\u0440\u044F\u0442\u044C \u043D\u0430\u043B\u0438\u0447\u0438\u0435 \u043D\u043E\u0432\u043E\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043F\u0440\u0438 \u043A\u0430\u0436\u0434\u043E\u043C \u0437\u0430\u043F\u0443\u0441\u043A\u0435 OpenRocket pref.dlg.checkbox.CheckBetaupdates = \u041F\u0440\u043E\u0432\u0435\u0440\u044F\u0442\u044C \u0431\u0435\u0442\u0430-\u0432\u0435\u0440\u0441\u0438\u0438 pref.dlg.checkbox.CheckBetaupdates.ttip = \u0415\u0441\u043B\u0438 \u0444\u043B\u0430\u0436\u043E\u043A \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D, \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u044F \u0431\u0435\u0442\u0430-\u0432\u0435\u0440\u0441\u0438\u0438 \u0442\u0430\u043A\u0436\u0435 \u043F\u0440\u043E\u0432\u0435\u0440\u044F\u044E\u0442\u0441\u044F. \u0415\u0441\u043B\u0438 \u0444\u043B\u0430\u0436\u043E\u043A \u043D\u0435 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D, \u0443\u0447\u0438\u0442\u044B\u0432\u0430\u044E\u0442\u0441\u044F \u0442\u043E\u043B\u044C\u043A\u043E \u043E\u0444\u0438\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u0435 \u0432\u044B\u043F\u0443\u0441\u043A\u0438. @@ -362,9 +364,9 @@ update.dlg.latestVersion = \u0412\u044B \u0440\u0430\u0431\u043E\u0442\u0430\u04 update.dlg.newerVersion.title = \u041E\u0431\u043D\u0430\u0440\u0443\u0436\u0435\u043D\u0430 \u0431\u043E\u043B\u0435\u0435 \u043D\u043E\u0432\u0430\u044F \u0432\u0435\u0440\u0441\u0438\u044F update.dlg.newerVersion = \u0412\u044B \u043B\u0438\u0431\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442\u0435 \u0442\u0435\u0441\u0442\u043E\u0432\u0443\u044E/\u043D\u0435\u043E\u0444\u0438\u0446\u0438\u0430\u043B\u044C\u043D\u0443\u044E \u0432\u0435\u0440\u0441\u0438\u044E OpenRocket, \u043B\u0438\u0431\u043E \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044C \u043C\u0430\u0448\u0438\u043D\u0430 \u0432\u0440\u0435\u043C\u0435\u043D\u0438 \u0438 \u0432\u044B \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442\u0435 \u043E\u0444\u0438\u0446\u0438\u0430\u043B\u044C\u043D\u0443\u044E \u0432\u0435\u0440\u0441\u0438\u044E \u0438\u0437 \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043E.\n\n\u0412\u0430\u0448\u0430 \u0432\u0435\u0440\u0441\u0438\u044F: %s\n\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0439 \u043E\u0444\u0438\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u0439 \u0432\u044B\u043F\u0443\u0441\u043A: %s update.dlg.updateAvailable.title = \u0414\u043E\u0441\u0442\u0443\u043F\u043D\u044B \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u044F -update.dlg.updateAvailable.txtPane.title = \u0414\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0432\u0435\u0440\u044F\u0438 OpenRocket %s! -update.dlg.updateAvailable.txtPane.yourVersion = \u0412\u0430\u0448\u0430 \u0442\u0435\u043A\u0443\u0449\u0430\u044F \u0432\u0435\u0440\u0441\u0438\u044F: %s -update.dlg.updateAvailable.txtPane.changelog = \u0421\u043F\u0438\u0441\u043E\u043A \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439 +update.dlg.updateAvailable.lbl.title = \u0414\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u043D\u043E\u0432\u0430\u044F \u0432\u0435\u0440\u0441\u0438\u044F OpenRocket! +update.dlg.updateAvailable.lbl.yourVersion = \u0414\u043E\u0441\u0442\u0443\u043F\u043D\u0430 OpenRocket %s! \u0423 \u0432\u0430\u0441 %s. \u0425\u043E\u0442\u0438\u0442\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0435\u0451 \u0441\u0435\u0439\u0447\u0430\u0441? +update.dlg.updateAvailable.lbl.releaseNotes = \u041F\u0440\u0438\u043C\u0435\u0447\u0430\u043D\u0438\u044F \u043A \u0432\u044B\u043F\u0443\u0441\u043A\u0443: update.dlg.updateAvailable.txtPane.readMore = \u0423\u0437\u043D\u0430\u0439\u0442\u0435 \u0431\u043E\u043B\u044C\u0448\u0435 \u043D\u0430 GitHub update.dlg.updateAvailable.but.install = \u0423\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 update.dlg.updateAvailable.combo.noDownloads = \u041D\u0435\u0442 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0445 \u0437\u0430\u0433\u0440\u0443\u0437\u043E\u043A From 1579ec0f7304b8172c128466ab16e03865e953ed Mon Sep 17 00:00:00 2001 From: SiboVG Date: Sun, 9 Oct 2022 17:00:29 +0200 Subject: [PATCH 20/37] Use auto length/radius for component bounds --- core/src/net/sf/openrocket/rocketcomponent/MassObject.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/net/sf/openrocket/rocketcomponent/MassObject.java b/core/src/net/sf/openrocket/rocketcomponent/MassObject.java index 1522fde04..13ab4b8c7 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/MassObject.java +++ b/core/src/net/sf/openrocket/rocketcomponent/MassObject.java @@ -248,8 +248,8 @@ public abstract class MassObject extends InternalComponent { @Override public final Collection getComponentBounds() { Collection c = new ArrayList(); - addBound(c, 0, radius); - addBound(c, length, radius); + addBound(c, 0, getRadius()); + addBound(c, getLength(), getRadius()); return c; } From 84ade88cf21d2e87e45435e22a785106be23e6d6 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Sun, 9 Oct 2022 17:11:39 +0200 Subject: [PATCH 21/37] [#1723] Import MassObject length with NoAuto --- .../sf/openrocket/file/openrocket/importt/DocumentConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/file/openrocket/importt/DocumentConfig.java b/core/src/net/sf/openrocket/file/openrocket/importt/DocumentConfig.java index e9bd33b29..60a20db09 100644 --- a/core/src/net/sf/openrocket/file/openrocket/importt/DocumentConfig.java +++ b/core/src/net/sf/openrocket/file/openrocket/importt/DocumentConfig.java @@ -374,7 +374,7 @@ class DocumentConfig { // MassObject setters.put("MassObject:packedlength", new DoubleSetter( - Reflection.findMethod(MassObject.class, "setLength", double.class))); + Reflection.findMethod(MassObject.class, "setLengthNoAuto", double.class))); setters.put("MassObject:packedradius", new DoubleSetter( Reflection.findMethod(MassObject.class, "setRadius", double.class), "auto", " ", From 4290ff298be6ffabd335ceff0baa2bc679b36f08 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Sun, 9 Oct 2022 20:07:31 +0200 Subject: [PATCH 22/37] Rename parachute naming leftover --- .../openrocket/rocketcomponent/MassObject.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/src/net/sf/openrocket/rocketcomponent/MassObject.java b/core/src/net/sf/openrocket/rocketcomponent/MassObject.java index 1522fde04..042c790d5 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/MassObject.java +++ b/core/src/net/sf/openrocket/rocketcomponent/MassObject.java @@ -53,10 +53,10 @@ public abstract class MassObject extends InternalComponent { @Override public double getLength() { if (this.autoRadius) { - // Calculate the parachute volume using the non auto radius and the non auto length, and transform that back + // Calculate the volume using the non auto radius and the non auto length, and transform that back // to the auto radius situation to get the auto radius length (the volume in both situations is the same). - double parachuteVolume = Math.pow(this.radius, 2) * this.length; // Math.PI left out, not needed - return parachuteVolume / Math.pow(getRadius(), 2); + double volume = Math.pow(this.radius, 2) * this.length; // Math.PI left out, not needed + return volume / Math.pow(getRadius(), 2); } return length; } @@ -93,10 +93,10 @@ public abstract class MassObject extends InternalComponent { length = Math.max(length, 0); if (this.autoRadius) { - // Calculate the parachute volume using the auto radius and the new "auto" length, and transform that back + // Calculate the volume using the auto radius and the new "auto" length, and transform that back // to the non auto radius situation to set this.length (the volume in both situations is the same). - double parachuteVolume = Math.pow(getRadius(), 2) * length; // Math.PI left out, not needed - double newLength = parachuteVolume / Math.pow(this.radius, 2); + double volume = Math.pow(getRadius(), 2) * length; // Math.PI left out, not needed + double newLength = volume / Math.pow(this.radius, 2); if (MathUtil.equals(this.length, newLength)) return; this.length = newLength; @@ -168,8 +168,8 @@ public abstract class MassObject extends InternalComponent { autoRadius = auto; // Set the length - double parachuteVolume = (Math.PI * Math.pow(getRadius(), 2) * length); - length = parachuteVolume / (Math.PI * Math.pow(getRadius(), 2)); + double volume = (Math.PI * Math.pow(getRadius(), 2) * length); + length = volume / (Math.PI * Math.pow(getRadius(), 2)); fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE); } From 46c7deacb1cb34d7ca0aedf3c6727d3439acb5fe Mon Sep 17 00:00:00 2001 From: SiboVG Date: Sun, 9 Oct 2022 20:16:49 +0200 Subject: [PATCH 23/37] Add unit tests for mass object auto radius --- .../rocketcomponent/MassObjectTest.java | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 core/test/net/sf/openrocket/rocketcomponent/MassObjectTest.java diff --git a/core/test/net/sf/openrocket/rocketcomponent/MassObjectTest.java b/core/test/net/sf/openrocket/rocketcomponent/MassObjectTest.java new file mode 100644 index 000000000..a7e18ea75 --- /dev/null +++ b/core/test/net/sf/openrocket/rocketcomponent/MassObjectTest.java @@ -0,0 +1,86 @@ +package net.sf.openrocket.rocketcomponent; + +import net.sf.openrocket.util.BaseTestCase.BaseTestCase; +import net.sf.openrocket.util.MathUtil; +import org.junit.Test; +import org.junit.Assert; + +public class MassObjectTest extends BaseTestCase { + @Test + public void testAutoRadius() { + MassObject sc = new ShockCord(); + MassObject mc = new MassComponent(); + MassObject pc = new Parachute(); + MassObject st = new Streamer(); + MassObject[] massObjects = {sc, mc, pc, st}; + + for (MassObject mo : massObjects) { + // Test no auto + mo.setRadiusAutomatic(false); + mo.setRadius(0.1); + mo.setLength(0.1); + Assert.assertEquals(String.format(" No auto %s incorrect radius", mo.getClass().getName()), + 0.1, mo.getRadius(), MathUtil.EPSILON); + Assert.assertEquals(String.format(" No auto %s incorrect no auto radius", mo.getClass().getName()), + 0.1, mo.getRadiusNoAuto(),MathUtil.EPSILON); + Assert.assertEquals(String.format(" No auto %s incorrect length", mo.getClass().getName()), + 0.1, mo.getLength(), MathUtil.EPSILON); + Assert.assertEquals(String.format(" No auto %s incorrect no auto length", mo.getClass().getName()), + 0.1, mo.getLengthNoAuto(), MathUtil.EPSILON); + + mo.setLengthNoAuto(0.1); + Assert.assertEquals(String.format(" No auto 2 %s incorrect length", mo.getClass().getName()), + 0.1, mo.getLength(), MathUtil.EPSILON); + Assert.assertEquals(String.format(" No auto 2 %s incorrect no auto length", mo.getClass().getName()), + 0.1, mo.getLengthNoAuto(), MathUtil.EPSILON); + + // Test auto + BodyTube parent = new BodyTube(); + parent.setOuterRadius(0.05); + parent.setInnerRadius(0.05); + parent.addChild(mo); + mo.setRadiusAutomatic(true); + Assert.assertEquals(String.format(" Auto 1 %s incorrect radius", mo.getClass().getName()), + 0.05, mo.getRadius(), MathUtil.EPSILON); + Assert.assertEquals(String.format(" Auto 1 %s incorrect no auto radius", mo.getClass().getName()), + 0.1, mo.getRadiusNoAuto(), MathUtil.EPSILON); + Assert.assertEquals(String.format(" Auto 1 %s incorrect length", mo.getClass().getName()), + 0.4, mo.getLength(), MathUtil.EPSILON); + Assert.assertEquals(String.format(" Auto 1 %s incorrect no auto length", mo.getClass().getName()), + 0.1, mo.getLengthNoAuto(), MathUtil.EPSILON); + + parent.setOuterRadius(0.1); + parent.setInnerRadius(0.1); + Assert.assertEquals(String.format(" Auto 2 %s incorrect radius", mo.getClass().getName()), + 0.1, mo.getRadius(), MathUtil.EPSILON); + Assert.assertEquals(String.format(" Auto 2 %s incorrect no auto radius", mo.getClass().getName()), + 0.1, mo.getRadiusNoAuto(), MathUtil.EPSILON); + Assert.assertEquals(String.format(" Auto 2 %s incorrect length", mo.getClass().getName()), + 0.1, mo.getLength(), MathUtil.EPSILON); + Assert.assertEquals(String.format(" Auto 2 %s incorrect no auto length", mo.getClass().getName()), + 0.1, mo.getLengthNoAuto(), MathUtil.EPSILON); + + parent.setOuterRadius(0.075); + parent.setInnerRadius(0.075); + mo.setLength(0.075); + Assert.assertEquals(String.format(" Auto 3 %s incorrect radius", mo.getClass().getName()), + 0.075, mo.getRadius(), MathUtil.EPSILON); + Assert.assertEquals(String.format(" Auto 3 %s incorrect no auto radius", mo.getClass().getName()), + 0.1, mo.getRadiusNoAuto(), MathUtil.EPSILON); + Assert.assertEquals(String.format(" Auto 3 %s incorrect length", mo.getClass().getName()), + 0.075, mo.getLength(), MathUtil.EPSILON); + Assert.assertEquals(String.format(" Auto 3 %s incorrect no auto length", mo.getClass().getName()), + 0.0422, mo.getLengthNoAuto(), 0.001); + + mo.setLengthNoAuto(0.05); + Assert.assertEquals(String.format(" Auto 4 %s incorrect radius", mo.getClass().getName()), + 0.075, mo.getRadius(), MathUtil.EPSILON); + Assert.assertEquals(String.format(" Auto 4 %s incorrect no auto radius", mo.getClass().getName()), + 0.1, mo.getRadiusNoAuto(), MathUtil.EPSILON); + Assert.assertEquals(String.format(" Auto 4 %s incorrect length", mo.getClass().getName()), + 0.0889, mo.getLength(), 0.001); + Assert.assertEquals(String.format(" Auto 4 %s incorrect no auto length", mo.getClass().getName()), + 0.05, mo.getLengthNoAuto(), MathUtil.EPSILON); + } + } +} From 360b1e77e2c13ed5bab7b295d551721ad426b630 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Mon, 10 Oct 2022 17:22:34 +0200 Subject: [PATCH 24/37] [#1731] Catch out-of-range sim table click earlier on --- .../openrocket/gui/main/SimulationPanel.java | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java b/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java index 423f23d25..9f702dd22 100644 --- a/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java +++ b/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java @@ -183,22 +183,19 @@ public class SimulationPanel extends JPanel { @Override public void mouseClicked(MouseEvent e) { int selectedRow = simulationTable.getSelectedRow(); + int row = simulationTable.rowAtPoint(e.getPoint()); + int column = simulationTable.columnAtPoint(e.getPoint()); + + // Clear the table selection when clicked outside the table rows. + if (row == -1 || column == -1 || selectedRow == -1) { + simulationTable.clearSelection(); + return; + } if (e.getButton() == MouseEvent.BUTTON1) { - // Clear the table selection when clicked outside the table rows. - if (e.getClickCount() == 1) { - int row = simulationTable.rowAtPoint(e.getPoint()); - int column = simulationTable.columnAtPoint(e.getPoint()); - - if (row == -1 || column == -1) { - simulationTable.clearSelection(); - } - } // Edit the simulation or plot/export - else if (e.getClickCount() == 2) { + if (e.getClickCount() == 2) { int selected = simulationTable.convertRowIndexToModel(selectedRow); - - int column = simulationTable.columnAtPoint(e.getPoint()); if (column == 0) { SimulationWarningDialog.showWarningDialog(SimulationPanel.this, document.getSimulations().get(selected)); } else { From 314464abe8de8d618ae564f14d3a9e5d958bc37a Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Mon, 10 Oct 2022 15:35:18 -0600 Subject: [PATCH 25/37] Copy WarningSet from old SimulationStatus to new when switching to BasicTumblerStepper All prior warnings were getting lost when the simulation switched to the tumble stepper. This fixes that. --- .../net/sf/openrocket/simulation/BasicTumbleStepper.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/net/sf/openrocket/simulation/BasicTumbleStepper.java b/core/src/net/sf/openrocket/simulation/BasicTumbleStepper.java index e8af5b890..65c37d4d7 100644 --- a/core/src/net/sf/openrocket/simulation/BasicTumbleStepper.java +++ b/core/src/net/sf/openrocket/simulation/BasicTumbleStepper.java @@ -13,8 +13,11 @@ public class BasicTumbleStepper extends AbstractSimulationStepper { private static final double RECOVERY_TIME_STEP = 0.5; @Override - public SimulationStatus initialize(SimulationStatus status) { - return new BasicTumbleStatus(status); + public SimulationStatus initialize(SimulationStatus original) { + BasicTumbleStatus status = new BasicTumbleStatus(original); + status.setWarnings(original.getWarnings()); + + return status; } @Override From a1eea8ce3972f4ad98b76ea01454df40dcf00454 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Wed, 12 Oct 2022 17:27:17 +0200 Subject: [PATCH 26/37] I find this easier to read, sue me :) --- .../gui/dialogs/motor/thrustcurve/MotorRowFilter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/MotorRowFilter.java b/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/MotorRowFilter.java index 127a242de..98d2a4308 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/MotorRowFilter.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/MotorRowFilter.java @@ -219,8 +219,9 @@ public class MotorRowFilter extends RowFilter implements Ch main: for (String s : searchTerms) { for (ThrustCurveMotorColumns col : ThrustCurveMotorColumns.values()) { String str = col.getValue(m).toString().toLowerCase(Locale.getDefault()); - if (str.indexOf(s) >= 0) + if (str.contains(s)) { continue main; + } } return false; } From 52b582db69e0a5df10a097ff288aaa308a024d08 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Wed, 12 Oct 2022 17:29:38 +0200 Subject: [PATCH 27/37] Add motor designation to motor selection table --- core/resources/l10n/messages.properties | 1 + .../motor/thrustcurve/ThrustCurveMotorColumns.java | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index f320aa563..318668bf8 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -1696,6 +1696,7 @@ FlightEvent.Type.EXCEPTION = Exception ! ThrustCurveMotorColumns TCurveMotorCol.MANUFACTURER = Manufacturer TCurveMotorCol.COMMON_NAME = Name +TCurveMotorCol.DESIGNATION = Designation TCurveMotorCol.CASEINFO = Case TCurveMotorCol.DIAMETER = Diameter TCurveMotorCol.LENGTH = Length diff --git a/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorColumns.java b/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorColumns.java index c502bc817..ad5319cb3 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorColumns.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorColumns.java @@ -42,6 +42,18 @@ enum ThrustCurveMotorColumns { return new DesignationComparator(); } }, + //// Designation + DESIGNATION("TCurveMotorCol.DESIGNATION") { + @Override + public String getValue(ThrustCurveMotorSet m) { + return m.getDesignation(); + } + + @Override + public Comparator getComparator() { + return new DesignationComparator(); + } + }, //// TotalImpulse TOTAL_IMPULSE("TCurveMotorCol.TOTAL_IMPULSE") { @Override From 7557b67dbbad2a04a569339d4177b0fd3dbde54c Mon Sep 17 00:00:00 2001 From: SiboVG Date: Wed, 12 Oct 2022 19:16:18 +0200 Subject: [PATCH 28/37] [#1715] Add button in preferences for clearing cached preferences --- core/resources/l10n/messages.properties | 4 ++++ .../preferences/GeneralPreferencesPanel.java | 16 +++++++++++++++- .../sf/openrocket/gui/util/SwingPreferences.java | 15 +++++++++++++-- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index f320aa563..58eb86f12 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -276,6 +276,10 @@ pref.dlg.tab.Simulation = Simulation pref.dlg.tab.Launch = Launch pref.dlg.tab.Miscellaneousoptions = Miscellaneous options pref.dlg.lbl.RockSimWarning = Show warning when saving in RockSim format +pref.dlg.but.clearCachedPreferences = Clear cached preferences +pref.dlg.but.clearCachedPreferences.ttip = Clear cached preferences (UI settings, recent files, etc.) +pref.dlg.clearCachedPreferences.title = Clear cached preferences? +pref.dlg.clearCachedPreferences.message = Are you sure you want to clear cached preferences? pref.dlg.tab.Graphics = Graphics pref.dlg.lbl.DecalEditor = Graphics Editor diff --git a/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java b/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java index d4613d0e0..440c21a03 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java @@ -246,7 +246,21 @@ public class GeneralPreferencesPanel extends PreferencesPanel { } }); this.add(rocksimWarningDialogBox,"spanx, wrap"); - + + //// Clear cached preferences + final JButton clearCachedPreferences = new SelectColorButton(trans.get("pref.dlg.but.clearCachedPreferences")); + clearCachedPreferences.setToolTipText(trans.get("pref.dlg.but.clearCachedPreferences.ttip")); + clearCachedPreferences.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + int resultYesNo = JOptionPane.showConfirmDialog(parent, trans.get("pref.dlg.clearCachedPreferences.message"), + trans.get("pref.dlg.clearCachedPreferences.title"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); + if (resultYesNo == JOptionPane.YES_OPTION) { + preferences.clearPreferences(); + } + } + }); + this.add(clearCachedPreferences, "spanx, pushy, bottom, wrap"); } diff --git a/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java b/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java index 6d95e208a..6d987038a 100644 --- a/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java +++ b/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java @@ -71,7 +71,7 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences { */ private static final String NODENAME = (DEBUG ? "OpenRocket-debug" : "OpenRocket"); - private final Preferences PREFNODE; + private Preferences PREFNODE; public SwingPreferences() { @@ -93,7 +93,18 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences { ////////////////////// - + public void clearPreferences() { + try { + Preferences root = Preferences.userRoot(); + if (root.nodeExists(NODENAME)) { + root.node(NODENAME).removeNode(); + } + PREFNODE = root.node(NODENAME); + log.info("Cleared preferences"); + } catch (BackingStoreException e) { + throw new BugException("Unable to clear preference node", e); + } + } /** * Store the current OpenRocket version into the preferences to allow for preferences migration. From 158aa58517b1e4382bac0f74309f582f3b482dbd Mon Sep 17 00:00:00 2001 From: SiboVG Date: Thu, 13 Oct 2022 15:27:47 +0200 Subject: [PATCH 29/37] Create method to reset units to default --- .../src/net/sf/openrocket/unit/UnitGroup.java | 74 ++++++++++--------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/core/src/net/sf/openrocket/unit/UnitGroup.java b/core/src/net/sf/openrocket/unit/UnitGroup.java index 99d6c1a58..796fc6d22 100644 --- a/core/src/net/sf/openrocket/unit/UnitGroup.java +++ b/core/src/net/sf/openrocket/unit/UnitGroup.java @@ -92,7 +92,6 @@ public class UnitGroup { static { UNITS_NONE = new UnitGroup(); UNITS_NONE.addUnit(Unit.NOUNIT); - UNITS_NONE.setDefaultUnit(0); UNITS_ENERGY = new UnitGroup(); UNITS_ENERGY.addUnit(new GeneralUnit(1, "J")); @@ -100,7 +99,6 @@ public class UnitGroup { UNITS_ENERGY.addUnit(new GeneralUnit(1.055, "BTU")); UNITS_ENERGY.addUnit(new GeneralUnit(4.184, "cal")); UNITS_ENERGY.addUnit(new GeneralUnit(1.3558179483314, "ft" + DOT + "lbf")); - UNITS_ENERGY.setDefaultUnit(0); UNITS_POWER = new UnitGroup(); UNITS_POWER.addUnit(new GeneralUnit(1e-3, "mW")); @@ -108,21 +106,17 @@ public class UnitGroup { UNITS_POWER.addUnit(new GeneralUnit(1e3, "kW")); UNITS_POWER.addUnit(new GeneralUnit(1e-7, "ergs")); UNITS_POWER.addUnit(new GeneralUnit(745.699872, "hp")); - UNITS_POWER.setDefaultUnit(1); UNITS_MOMENTUM = new UnitGroup(); UNITS_MOMENTUM.addUnit(new GeneralUnit(1, "kg" + DOT + "m/s")); - UNITS_MOMENTUM.setDefaultUnit(0); UNITS_VOLTAGE = new UnitGroup(); UNITS_VOLTAGE.addUnit(new GeneralUnit(1e-3, "mV")); UNITS_VOLTAGE.addUnit(new GeneralUnit(1, "V")); - UNITS_VOLTAGE.setDefaultUnit(1); UNITS_CURRENT = new UnitGroup(); UNITS_CURRENT.addUnit(new GeneralUnit(1e-3, "mA")); UNITS_CURRENT.addUnit(new GeneralUnit(1, "A")); - UNITS_CURRENT.setDefaultUnit(1); UNITS_LENGTH = new UnitGroup(); UNITS_LENGTH.addUnit(new GeneralUnit(0.001, "mm")); @@ -131,14 +125,12 @@ public class UnitGroup { UNITS_LENGTH.addUnit(new InchUnit(0.0254, "in")); UNITS_LENGTH.addUnit(new FractionalUnit(0.0254, "in/64", "in", 64, 1d / 16d, 0.5d / 64d)); UNITS_LENGTH.addUnit(new GeneralUnit(0.3048, "ft")); - UNITS_LENGTH.setDefaultUnit(1); UNITS_MOTOR_DIMENSIONS = new UnitGroup(); UNITS_MOTOR_DIMENSIONS.addUnit(new GeneralUnit(0.001, "mm")); UNITS_MOTOR_DIMENSIONS.addUnit(new GeneralUnit(0.01, "cm")); UNITS_MOTOR_DIMENSIONS.addUnit(new GeneralUnit(1, "m")); UNITS_MOTOR_DIMENSIONS.addUnit(new GeneralUnit(0.0254, "in")); - UNITS_MOTOR_DIMENSIONS.setDefaultUnit(0); UNITS_DISTANCE = new UnitGroup(); UNITS_DISTANCE.addUnit(new GeneralUnit(1, "m")); @@ -147,7 +139,6 @@ public class UnitGroup { UNITS_DISTANCE.addUnit(new GeneralUnit(0.9144, "yd")); UNITS_DISTANCE.addUnit(new GeneralUnit(1609.344, "mi")); UNITS_DISTANCE.addUnit(new GeneralUnit(1852, "nmi")); - UNITS_DISTANCE.setDefaultUnit(0); UNITS_ALL_LENGTHS = new UnitGroup(); UNITS_ALL_LENGTHS.addUnit(new GeneralUnit(0.001, "mm")); @@ -160,7 +151,6 @@ public class UnitGroup { UNITS_ALL_LENGTHS.addUnit(new GeneralUnit(0.9144, "yd")); UNITS_ALL_LENGTHS.addUnit(new GeneralUnit(1609.344, "mi")); UNITS_ALL_LENGTHS.addUnit(new GeneralUnit(1852, "nmi")); - UNITS_ALL_LENGTHS.setDefaultUnit(2); UNITS_AREA = new UnitGroup(); UNITS_AREA.addUnit(new GeneralUnit(pow2(0.001), "mm" + SQUARED)); @@ -168,7 +158,6 @@ public class UnitGroup { UNITS_AREA.addUnit(new GeneralUnit(1, "m" + SQUARED)); UNITS_AREA.addUnit(new GeneralUnit(pow2(0.0254), "in" + SQUARED)); UNITS_AREA.addUnit(new GeneralUnit(pow2(0.3048), "ft" + SQUARED)); - UNITS_AREA.setDefaultUnit(1); UNITS_STABILITY = new UnitGroup(); @@ -178,11 +167,9 @@ public class UnitGroup { UNITS_STABILITY.addUnit(new GeneralUnit(0.0254, "in")); UNITS_STABILITY.addUnit(new CaliberUnit((Rocket) null)); UNITS_STABILITY.addUnit(new PercentageOfLengthUnit((Rocket) null)); - UNITS_STABILITY.setDefaultUnit(4); UNITS_STABILITY_CALIBERS = new UnitGroup(); UNITS_STABILITY_CALIBERS.addUnit(new GeneralUnit(1, "cal")); - UNITS_STABILITY_CALIBERS.setDefaultUnit(0); UNITS_VELOCITY = new UnitGroup(); UNITS_VELOCITY.addUnit(new GeneralUnit(1, "m/s")); @@ -190,7 +177,6 @@ public class UnitGroup { UNITS_VELOCITY.addUnit(new GeneralUnit(0.3048, "ft/s")); UNITS_VELOCITY.addUnit(new GeneralUnit(0.44704, "mph")); UNITS_VELOCITY.addUnit(new GeneralUnit(0.51444445, "kt")); - UNITS_VELOCITY.setDefaultUnit(0); UNITS_WINDSPEED = new UnitGroup(); UNITS_WINDSPEED.addUnit(new GeneralUnit(1, "m/s")); @@ -198,20 +184,17 @@ public class UnitGroup { UNITS_WINDSPEED.addUnit(new GeneralUnit(0.3048, "ft/s")); UNITS_WINDSPEED.addUnit(new GeneralUnit(0.44704, "mph")); UNITS_WINDSPEED.addUnit(new GeneralUnit(0.51444445, "kt")); - UNITS_WINDSPEED.setDefaultUnit(0); UNITS_ACCELERATION = new UnitGroup(); UNITS_ACCELERATION.addUnit(new GeneralUnit(1, "m/s" + SQUARED)); UNITS_ACCELERATION.addUnit(new GeneralUnit(0.3048, "ft/s" + SQUARED)); UNITS_ACCELERATION.addUnit(new GeneralUnit(9.80665, "G")); - UNITS_ACCELERATION.setDefaultUnit(0); UNITS_MASS = new UnitGroup(); UNITS_MASS.addUnit(new GeneralUnit(0.001, "g")); UNITS_MASS.addUnit(new GeneralUnit(1, "kg")); UNITS_MASS.addUnit(new GeneralUnit(0.0283495231, "oz")); UNITS_MASS.addUnit(new GeneralUnit(0.45359237, "lb")); - UNITS_MASS.setDefaultUnit(0); UNITS_INERTIA = new UnitGroup(); UNITS_INERTIA.addUnit(new GeneralUnit(0.0001, "kg" + DOT + "cm" + SQUARED)); @@ -220,13 +203,11 @@ public class UnitGroup { UNITS_INERTIA.addUnit(new GeneralUnit(0.000292639653, "lb" + DOT + "in" + SQUARED)); UNITS_INERTIA.addUnit(new GeneralUnit(0.0421401101, "lb" + DOT + "ft" + SQUARED)); UNITS_INERTIA.addUnit(new GeneralUnit(1.35581795, "lbf" + DOT + "ft" + DOT + "s" + SQUARED)); - UNITS_INERTIA.setDefaultUnit(1); UNITS_ANGLE = new UnitGroup(); UNITS_ANGLE.addUnit(new DegreeUnit()); UNITS_ANGLE.addUnit(new FixedPrecisionUnit("rad", 0.01)); UNITS_ANGLE.addUnit(new GeneralUnit(1.0 / 3437.74677078, "arcmin")); - UNITS_ANGLE.setDefaultUnit(0); UNITS_DENSITY_BULK = new UnitGroup(); UNITS_DENSITY_BULK.addUnit(new GeneralUnit(1000, "g/cm" + CUBED)); @@ -234,7 +215,6 @@ public class UnitGroup { UNITS_DENSITY_BULK.addUnit(new GeneralUnit(1, "kg/m" + CUBED)); UNITS_DENSITY_BULK.addUnit(new GeneralUnit(1729.99404, "oz/in" + CUBED)); UNITS_DENSITY_BULK.addUnit(new GeneralUnit(16.0184634, "lb/ft" + CUBED)); - UNITS_DENSITY_BULK.setDefaultUnit(0); UNITS_DENSITY_SURFACE = new UnitGroup(); UNITS_DENSITY_SURFACE.addUnit(new GeneralUnit(10, "g/cm" + SQUARED)); @@ -243,51 +223,42 @@ public class UnitGroup { UNITS_DENSITY_SURFACE.addUnit(new GeneralUnit(43.9418487, "oz/in" + SQUARED)); UNITS_DENSITY_SURFACE.addUnit(new GeneralUnit(0.305151727, "oz/ft" + SQUARED)); UNITS_DENSITY_SURFACE.addUnit(new GeneralUnit(4.88242764, "lb/ft" + SQUARED)); - UNITS_DENSITY_SURFACE.setDefaultUnit(1); UNITS_DENSITY_LINE = new UnitGroup(); UNITS_DENSITY_LINE.addUnit(new GeneralUnit(0.001, "g/m")); UNITS_DENSITY_LINE.addUnit(new GeneralUnit(1, "kg/m")); UNITS_DENSITY_LINE.addUnit(new GeneralUnit(0.0930102465, "oz/ft")); - UNITS_DENSITY_LINE.setDefaultUnit(0); UNITS_FORCE = new UnitGroup(); UNITS_FORCE.addUnit(new GeneralUnit(1, "N")); UNITS_FORCE.addUnit(new GeneralUnit(4.44822162, "lbf")); UNITS_FORCE.addUnit(new GeneralUnit(9.80665, "kgf")); - UNITS_FORCE.setDefaultUnit(0); UNITS_IMPULSE = new UnitGroup(); UNITS_IMPULSE.addUnit(new GeneralUnit(1, "Ns")); UNITS_IMPULSE.addUnit(new GeneralUnit(4.44822162, "lbf" + DOT + "s")); - UNITS_IMPULSE.setDefaultUnit(0); UNITS_TIME_STEP = new UnitGroup(); UNITS_TIME_STEP.addUnit(new FixedPrecisionUnit("ms", 1, 0.001)); UNITS_TIME_STEP.addUnit(new FixedPrecisionUnit("s", 0.01)); - UNITS_TIME_STEP.setDefaultUnit(1); UNITS_SHORT_TIME = new UnitGroup(); UNITS_SHORT_TIME.addUnit(new GeneralUnit(1, "s")); - UNITS_SHORT_TIME.setDefaultUnit(0); UNITS_FLIGHT_TIME = new UnitGroup(); UNITS_FLIGHT_TIME.addUnit(new GeneralUnit(1, "s")); UNITS_FLIGHT_TIME.addUnit(new GeneralUnit(60, "min")); - UNITS_FLIGHT_TIME.setDefaultUnit(0); UNITS_ROLL = new UnitGroup(); UNITS_ROLL.addUnit(new GeneralUnit(1, "rad/s")); UNITS_ROLL.addUnit(new GeneralUnit(Math.PI / 180, DEGREE + "/s")); UNITS_ROLL.addUnit(new GeneralUnit(2 * Math.PI, "r/s")); UNITS_ROLL.addUnit(new GeneralUnit(2 * Math.PI / 60, "rpm")); - UNITS_ROLL.setDefaultUnit(1); UNITS_TEMPERATURE = new UnitGroup(); UNITS_TEMPERATURE.addUnit(new FixedPrecisionUnit("K", 1)); UNITS_TEMPERATURE.addUnit(new TemperatureUnit(1, 273.15, DEGREE + "C")); UNITS_TEMPERATURE.addUnit(new TemperatureUnit(5.0 / 9.0, 459.67, DEGREE + "F")); - UNITS_TEMPERATURE.setDefaultUnit(1); UNITS_PRESSURE = new UnitGroup(); UNITS_PRESSURE.addUnit(new FixedPrecisionUnit("mbar", 1, 1.0e2)); @@ -297,25 +268,21 @@ public class UnitGroup { UNITS_PRESSURE.addUnit(new GeneralUnit(3386.389, "inHg")); UNITS_PRESSURE.addUnit(new GeneralUnit(6894.75729, "psi")); UNITS_PRESSURE.addUnit(new GeneralUnit(1, "Pa")); - UNITS_PRESSURE.setDefaultUnit(0); UNITS_RELATIVE = new UnitGroup(); UNITS_RELATIVE.addUnit(new FixedPrecisionUnit("" + ZWSP, 0.01, 1.0)); UNITS_RELATIVE.addUnit(new GeneralUnit(0.01, "%")); UNITS_RELATIVE.addUnit(new FixedPrecisionUnit("" + PERMILLE, 1, 0.001)); - UNITS_RELATIVE.setDefaultUnit(1); UNITS_ROUGHNESS = new UnitGroup(); UNITS_ROUGHNESS.addUnit(new GeneralUnit(0.000001, MICRO + "m")); UNITS_ROUGHNESS.addUnit(new GeneralUnit(0.0000254, "mil")); UNITS_ROUGHNESS.addUnit(new GeneralUnit(1, "m")); - UNITS_ROUGHNESS.setDefaultUnit(0); UNITS_COEFFICIENT = new UnitGroup(); UNITS_COEFFICIENT.addUnit(new FixedPrecisionUnit("" + ZWSP, 0.01)); // zero-width space - UNITS_COEFFICIENT.setDefaultUnit(0); // This is not used by OpenRocket, and not extensively tested: @@ -323,8 +290,8 @@ public class UnitGroup { UNITS_FREQUENCY.addUnit(new FrequencyUnit(.001, "mHz")); UNITS_FREQUENCY.addUnit(new FrequencyUnit(1, "Hz")); UNITS_FREQUENCY.addUnit(new FrequencyUnit(1000, "kHz")); - UNITS_FREQUENCY.setDefaultUnit(1); - + + resetDefaultUnits(); HashMap map = new HashMap(); map.put("NONE", UNITS_NONE); @@ -437,6 +404,43 @@ public class UnitGroup { UNITS_RELATIVE.setDefaultUnit("%"); UNITS_ROUGHNESS.setDefaultUnit("mil"); } + + public static void resetDefaultUnits() { + UNITS_NONE.setDefaultUnit(0); + UNITS_ENERGY.setDefaultUnit(0); + UNITS_POWER.setDefaultUnit(1); + UNITS_MOMENTUM.setDefaultUnit(0); + UNITS_VOLTAGE.setDefaultUnit(1); + UNITS_CURRENT.setDefaultUnit(1); + UNITS_LENGTH.setDefaultUnit(1); + UNITS_MOTOR_DIMENSIONS.setDefaultUnit(0); + UNITS_DISTANCE.setDefaultUnit(0); + UNITS_ALL_LENGTHS.setDefaultUnit(2); + UNITS_AREA.setDefaultUnit(1); + UNITS_STABILITY.setDefaultUnit(4); + UNITS_STABILITY_CALIBERS.setDefaultUnit(0); + UNITS_VELOCITY.setDefaultUnit(0); + UNITS_WINDSPEED.setDefaultUnit(0); + UNITS_ACCELERATION.setDefaultUnit(0); + UNITS_MASS.setDefaultUnit(0); + UNITS_INERTIA.setDefaultUnit(1); + UNITS_ANGLE.setDefaultUnit(0); + UNITS_DENSITY_BULK.setDefaultUnit(0); + UNITS_DENSITY_SURFACE.setDefaultUnit(1); + UNITS_DENSITY_LINE.setDefaultUnit(0); + UNITS_FORCE.setDefaultUnit(0); + UNITS_IMPULSE.setDefaultUnit(0); + UNITS_TIME_STEP.setDefaultUnit(1); + UNITS_SHORT_TIME.setDefaultUnit(0); + UNITS_FLIGHT_TIME.setDefaultUnit(0); + UNITS_ROLL.setDefaultUnit(1); + UNITS_TEMPERATURE.setDefaultUnit(1); + UNITS_PRESSURE.setDefaultUnit(0); + UNITS_RELATIVE.setDefaultUnit(1); + UNITS_ROUGHNESS.setDefaultUnit(0); + UNITS_COEFFICIENT.setDefaultUnit(0); + UNITS_FREQUENCY.setDefaultUnit(1); + } /** From 15c7f3ebc232da43e525d2bb4eb2fdddcfc9ff45 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Thu, 13 Oct 2022 15:28:06 +0200 Subject: [PATCH 30/37] Include unit reset in reset preferences action --- swing/src/net/sf/openrocket/gui/util/SwingPreferences.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java b/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java index 6d987038a..a8166b555 100644 --- a/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java +++ b/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java @@ -100,6 +100,8 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences { root.node(NODENAME).removeNode(); } PREFNODE = root.node(NODENAME); + UnitGroup.resetDefaultUnits(); + storeDefaultUnits(); log.info("Cleared preferences"); } catch (BackingStoreException e) { throw new BugException("Unable to clear preference node", e); From 8babcb59de43d739aacc45b2f2c9036bffda36c0 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Thu, 13 Oct 2022 15:32:56 +0200 Subject: [PATCH 31/37] Rename clear preferences button --- core/resources/l10n/messages.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index 58eb86f12..b35694804 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -276,10 +276,10 @@ pref.dlg.tab.Simulation = Simulation pref.dlg.tab.Launch = Launch pref.dlg.tab.Miscellaneousoptions = Miscellaneous options pref.dlg.lbl.RockSimWarning = Show warning when saving in RockSim format -pref.dlg.but.clearCachedPreferences = Clear cached preferences -pref.dlg.but.clearCachedPreferences.ttip = Clear cached preferences (UI settings, recent files, etc.) -pref.dlg.clearCachedPreferences.title = Clear cached preferences? -pref.dlg.clearCachedPreferences.message = Are you sure you want to clear cached preferences? +pref.dlg.but.clearCachedPreferences = Reset all preferences +pref.dlg.but.clearCachedPreferences.ttip = Reset all the preferences, including cached preferences (UI settings, recent files, etc.) +pref.dlg.clearCachedPreferences.title = Reset preferences? +pref.dlg.clearCachedPreferences.message = Are you sure you want to reset all your preferences? pref.dlg.tab.Graphics = Graphics pref.dlg.lbl.DecalEditor = Graphics Editor From c1145bf008170330f7cfb73db01a50c1bd26bb4b Mon Sep 17 00:00:00 2001 From: SiboVG Date: Thu, 13 Oct 2022 21:56:58 +0200 Subject: [PATCH 32/37] Rename clear preferences button --- core/resources/l10n/messages.properties | 7 ++-- core/resources/l10n/messages_cs.properties | 2 +- core/resources/l10n/messages_de.properties | 2 +- core/resources/l10n/messages_es.properties | 2 +- core/resources/l10n/messages_fr.properties | 2 +- core/resources/l10n/messages_it.properties | 2 +- core/resources/l10n/messages_ja.properties | 2 +- core/resources/l10n/messages_nl.properties | 2 +- core/resources/l10n/messages_pl.properties | 2 +- core/resources/l10n/messages_pt.properties | 2 +- core/resources/l10n/messages_ru.properties | 2 +- core/resources/l10n/messages_uk_UA.properties | 2 +- core/resources/l10n/messages_zh_CN.properties | 2 +- .../sf/openrocket/startup/Preferences.java | 2 ++ .../motor/thrustcurve/MotorRowFilter.java | 9 +++++ .../thrustcurve/ThrustCurveMotorColumns.java | 21 ++++------- .../ThrustCurveMotorSelectionPanel.java | 35 +++++++++++++++++++ .../openrocket/gui/util/SwingPreferences.java | 18 +++++++++- 18 files changed, 87 insertions(+), 29 deletions(-) diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index 318668bf8..e736fe5de 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -1303,6 +1303,10 @@ StorageOptChooser.lbl.Saveopt = Save options TCMotorSelPan.lbl.Selrocketmotor = Select rocket motor: TCMotorSelPan.checkbox.hideSimilar = Hide very similar thrust curves TCMotorSelPan.checkbox.hideUsed = Hide motors already used in the mount +TCMotorSelPan.lbl.motorNameColumn = Motor name column: +TCMotorSelPan.lbl.motorNameColumn.ttip = Select which motor property to display in the motor name column. +TCMotorSelPan.btn.commonName = Use common name +TCMotorSelPan.btn.designation = Use manufacturer's designation TCMotorSelPan.lbl.nrOfMotors = Number of motors: TCMotorSelPan.lbl.ttip.nrOfMotors = Number of motors currently visible in the motor selection table TCMotorSelPan.checkbox.limitlength = Limit motor length to mount length @@ -1695,8 +1699,7 @@ FlightEvent.Type.EXCEPTION = Exception ! ThrustCurveMotorColumns TCurveMotorCol.MANUFACTURER = Manufacturer -TCurveMotorCol.COMMON_NAME = Name -TCurveMotorCol.DESIGNATION = Designation +TCurveMotorCol.NAME = Name TCurveMotorCol.CASEINFO = Case TCurveMotorCol.DIAMETER = Diameter TCurveMotorCol.LENGTH = Length diff --git a/core/resources/l10n/messages_cs.properties b/core/resources/l10n/messages_cs.properties index cbde32398..3e9b5ea5f 100644 --- a/core/resources/l10n/messages_cs.properties +++ b/core/resources/l10n/messages_cs.properties @@ -1213,7 +1213,7 @@ FlightEvent.Type.ALTITUDE = Zmena v ! ThrustCurveMotorColumns TCurveMotorCol.MANUFACTURER = Výrobce -TCurveMotorCol.COMMON_NAME = Jméno +TCurveMotorCol.NAME = Jméno ! TCurveMotorCol.DESIGNATION = Pojmenování TCurveMotorCol.TYPE = Druh TCurveMotorCol.DIAMETER = Prumer diff --git a/core/resources/l10n/messages_de.properties b/core/resources/l10n/messages_de.properties index ba51cc96e..e2cda7b33 100644 --- a/core/resources/l10n/messages_de.properties +++ b/core/resources/l10n/messages_de.properties @@ -1273,7 +1273,7 @@ FlightEvent.Type.ALTITUDE = H ! ThrustCurveMotorColumns TCurveMotorCol.MANUFACTURER = Hersteller -TCurveMotorCol.COMMON_NAME = Name +TCurveMotorCol.NAME = Name ! TCurveMotorCol.DESIGNATION = Bezeichnung TCurveMotorCol.TYPE = Typ TCurveMotorCol.DIAMETER = Durchmesser diff --git a/core/resources/l10n/messages_es.properties b/core/resources/l10n/messages_es.properties index 80f565efa..7bfe090c5 100644 --- a/core/resources/l10n/messages_es.properties +++ b/core/resources/l10n/messages_es.properties @@ -1157,7 +1157,7 @@ TCurveMotor.ttip.maxThrust = Empuje m\u00e1ximo: TCurveMotor.ttip.totalImpulse = Impulso total: ! ThrustCurveMotorColumns -TCurveMotorCol.COMMON_NAME = Nombre +TCurveMotorCol.NAME = Nombre ! TCurveMotorCol.DESIGNATION = Designaci\u00f3n TCurveMotorCol.DIAMETER = Di\u00e1metro TCurveMotorCol.LENGTH = Longitud diff --git a/core/resources/l10n/messages_fr.properties b/core/resources/l10n/messages_fr.properties index 57709d450..210605775 100644 --- a/core/resources/l10n/messages_fr.properties +++ b/core/resources/l10n/messages_fr.properties @@ -1151,7 +1151,7 @@ TCurveMotor.ttip.maxThrust = Pouss\u00E9e Maximum: TCurveMotor.ttip.totalImpulse = Impulsion Totale: ! ThrustCurveMotorColumns -TCurveMotorCol.COMMON_NAME = Nom +TCurveMotorCol.NAME = Nom ! TCurveMotorCol.DESIGNATION = D\u00E9signation TCurveMotorCol.DIAMETER = Diam\u00E8tre TCurveMotorCol.LENGTH = Longueur diff --git a/core/resources/l10n/messages_it.properties b/core/resources/l10n/messages_it.properties index 30e240111..784de45de 100644 --- a/core/resources/l10n/messages_it.properties +++ b/core/resources/l10n/messages_it.properties @@ -1276,7 +1276,7 @@ FlightEvent.Type.ALTITUDE = Cambio altitudine ! ThrustCurveMotorColumns TCurveMotorCol.MANUFACTURER = Produttore -TCurveMotorCol.COMMON_NAME = Nome +TCurveMotorCol.NAME = Nome ! TCurveMotorCol.DESIGNATION = Classe TCurveMotorCol.TYPE = Tipo TCurveMotorCol.DIAMETER = Diametro diff --git a/core/resources/l10n/messages_ja.properties b/core/resources/l10n/messages_ja.properties index d2b35d286..7286f837c 100644 --- a/core/resources/l10n/messages_ja.properties +++ b/core/resources/l10n/messages_ja.properties @@ -1325,7 +1325,7 @@ FlightEvent.Type.ALTITUDE = \u59FF\u52E2\u5909\u66F4 ! ThrustCurveMotorColumns TCurveMotorCol.MANUFACTURER = \u30E1\u30FC\u30AB\u30FC ! TCurveMotorCol.DESIGNATION = \u8A18\u53F7 -TCurveMotorCol.COMMON_NAME = \u8A18\u53F7 +TCurveMotorCol.NAME = \u8A18\u53F7 TCurveMotorCol.TYPE = \u30BF\u30A4\u30D7 TCurveMotorCol.DIAMETER = \u76F4\u5F84 TCurveMotorCol.LENGTH = \u9577\u3055 diff --git a/core/resources/l10n/messages_nl.properties b/core/resources/l10n/messages_nl.properties index 7c73fb9b1..d1d153caf 100644 --- a/core/resources/l10n/messages_nl.properties +++ b/core/resources/l10n/messages_nl.properties @@ -1573,7 +1573,7 @@ FlightEvent.Type.EXCEPTION = Uitzondering ! ThrustCurveMotorColumns TCurveMotorCol.MANUFACTURER = Fabrikant -TCurveMotorCol.COMMON_NAME = Naam +TCurveMotorCol.NAME = Naam ! TCurveMotorCol.DESIGNATION = Benaming TCurveMotorCol.CASEINFO = Behuizing TCurveMotorCol.DIAMETER = Diameter diff --git a/core/resources/l10n/messages_pl.properties b/core/resources/l10n/messages_pl.properties index e8311050b..f3cbe0a19 100644 --- a/core/resources/l10n/messages_pl.properties +++ b/core/resources/l10n/messages_pl.properties @@ -1217,7 +1217,7 @@ update.dlg.latestVersion = Korzystasz z najnowszej wersji OpenRocket: %s. ! ThrustCurveMotorColumns TCurveMotorCol.MANUFACTURER = Producent - TCurveMotorCol.COMMON_NAME = Nazwa + TCurveMotorCol.NAME = Nazwa ! TCurveMotorCol.DESIGNATION = Oznaczenie TCurveMotorCol.TYPE = Typ TCurveMotorCol.DIAMETER = \u015Arednica diff --git a/core/resources/l10n/messages_pt.properties b/core/resources/l10n/messages_pt.properties index 85b28b7e2..67a3df719 100644 --- a/core/resources/l10n/messages_pt.properties +++ b/core/resources/l10n/messages_pt.properties @@ -1117,7 +1117,7 @@ TCurveMotor.ttip.maxThrust = M\u00e1ximo de impulso: TCurveMotor.ttip.totalImpulse = Impulso total: # ThrustCurveMotorColumns -TCurveMotorCol.COMMON_NAME = Nome +TCurveMotorCol.NAME = Nome ! TCurveMotorCol.DESIGNATION = Designa\u00e7\u00e3o TCurveMotorCol.DIAMETER = Di\u00e2metro TCurveMotorCol.LENGTH = Comprimento diff --git a/core/resources/l10n/messages_ru.properties b/core/resources/l10n/messages_ru.properties index 622206d70..d00e78672 100644 --- a/core/resources/l10n/messages_ru.properties +++ b/core/resources/l10n/messages_ru.properties @@ -1696,7 +1696,7 @@ FlightEvent.Type.EXCEPTION = \u041E\u0448\u0438\u0431\u043A\u0430 ! ThrustCurveMotorColumns TCurveMotorCol.MANUFACTURER = \u041F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0438\u0442\u0435\u043B\u044C -TCurveMotorCol.COMMON_NAME = \u041E\u0431\u043E\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 +TCurveMotorCol.NAME = \u041E\u0431\u043E\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 TCurveMotorCol.CASEINFO = \u041A\u043E\u0440\u043F\u0443\u0441 TCurveMotorCol.TYPE = \u0422\u0438\u043F TCurveMotorCol.DIAMETER = \u0414\u0438\u0430\u043C\u0435\u0442\u0440 diff --git a/core/resources/l10n/messages_uk_UA.properties b/core/resources/l10n/messages_uk_UA.properties index 09c8a5319..e0745534d 100644 --- a/core/resources/l10n/messages_uk_UA.properties +++ b/core/resources/l10n/messages_uk_UA.properties @@ -1421,7 +1421,7 @@ FlightEvent.Type.EXCEPTION = Exception ! ThrustCurveMotorColumns TCurveMotorCol.MANUFACTURER = Manufacturer -TCurveMotorCol.COMMON_NAME = Name +TCurveMotorCol.NAME = Name ! TCurveMotorCol.DESIGNATION = Designation TCurveMotorCol.TYPE = Type TCurveMotorCol.DIAMETER = Diameter diff --git a/core/resources/l10n/messages_zh_CN.properties b/core/resources/l10n/messages_zh_CN.properties index 9049a78c9..e9a1f5735 100644 --- a/core/resources/l10n/messages_zh_CN.properties +++ b/core/resources/l10n/messages_zh_CN.properties @@ -1221,7 +1221,7 @@ TCurveMotor.ttip.maxThrust = \u6700\u5927\u63A8\u529B: TCurveMotor.ttip.totalImpulse = \u603B\u51B2\u529B: ! ThrustCurveMotorColumns -TCurveMotorCol.COMMON_NAME = \u540D\u79F0 +TCurveMotorCol.NAME = \u540D\u79F0 ! TCurveMotorCol.DESIGNATION = \u540D\u79F0 TCurveMotorCol.DIAMETER = \u76F4\u5F84 TCurveMotorCol.LENGTH = \u957F\u5EA6 diff --git a/core/src/net/sf/openrocket/startup/Preferences.java b/core/src/net/sf/openrocket/startup/Preferences.java index 0b27c19f1..be58fb2a5 100644 --- a/core/src/net/sf/openrocket/startup/Preferences.java +++ b/core/src/net/sf/openrocket/startup/Preferences.java @@ -65,6 +65,8 @@ public abstract class Preferences implements ChangeSource { public static final String MOTOR_HIDE_SIMILAR = "MotorHideSimilar"; public static final String MOTOR_HIDE_UNAVAILABLE = "MotorHideUnavailable"; + public static final String MOTOR_NAME_COLUMN = "MotorNameColumn"; + public static final String MATCH_FORE_DIAMETER = "MatchForeDiameter"; public static final String MATCH_AFT_DIAMETER = "MatchAftDiameter"; diff --git a/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/MotorRowFilter.java b/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/MotorRowFilter.java index 98d2a4308..e0cdfdda9 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/MotorRowFilter.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/MotorRowFilter.java @@ -223,6 +223,15 @@ public class MotorRowFilter extends RowFilter implements Ch continue main; } } + + // Make sure that you can search on both the common name, and designation + // Yes, there is some duplication here because the common name or designation is already checked in the previous loop + // but it's not worth checking that... + String common = m.getCommonName().toLowerCase(Locale.getDefault()); + String designation = m.getDesignation().toLowerCase(Locale.getDefault()); + if (common.contains(s) || designation.contains(s)) { + continue main; + } return false; } return true; diff --git a/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorColumns.java b/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorColumns.java index ad5319cb3..72fb93ca2 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorColumns.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorColumns.java @@ -4,6 +4,7 @@ import java.text.Collator; import java.util.Comparator; import net.sf.openrocket.database.motor.ThrustCurveMotorSet; +import net.sf.openrocket.gui.util.SwingPreferences; import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.motor.DesignationComparator; import net.sf.openrocket.motor.ThrustCurveMotor; @@ -31,10 +32,14 @@ enum ThrustCurveMotorColumns { } }, //// Common name - COMMON_NAME("TCurveMotorCol.COMMON_NAME") { + NAME("TCurveMotorCol.NAME") { @Override public String getValue(ThrustCurveMotorSet m) { - return m.getCommonName(); + if (((SwingPreferences) Application.getPreferences()).getMotorNameColumn()) { + return m.getDesignation(); + } else { + return m.getCommonName(); + } } @Override @@ -42,18 +47,6 @@ enum ThrustCurveMotorColumns { return new DesignationComparator(); } }, - //// Designation - DESIGNATION("TCurveMotorCol.DESIGNATION") { - @Override - public String getValue(ThrustCurveMotorSet m) { - return m.getDesignation(); - } - - @Override - public Comparator getComparator() { - return new DesignationComparator(); - } - }, //// TotalImpulse TOTAL_IMPULSE("TCurveMotorCol.TOTAL_IMPULSE") { @Override diff --git a/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorSelectionPanel.java b/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorSelectionPanel.java index 9bf036f25..e827d52c7 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorSelectionPanel.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorSelectionPanel.java @@ -18,6 +18,7 @@ import java.util.List; import java.util.Set; import java.util.prefs.Preferences; +import javax.swing.ButtonGroup; import javax.swing.DefaultComboBoxModel; import javax.swing.JCheckBox; import javax.swing.JComboBox; @@ -25,6 +26,7 @@ import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; +import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JSeparator; import javax.swing.JTabbedPane; @@ -228,6 +230,39 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec } + //// Motor name column + { + JLabel motorNameColumn = new JLabel(trans.get("TCMotorSelPan.lbl.motorNameColumn")); + motorNameColumn.setToolTipText(trans.get("TCMotorSelPan.lbl.motorNameColumn.ttip")); + JRadioButton commonName = new JRadioButton(trans.get("TCMotorSelPan.btn.commonName")); + JRadioButton designation = new JRadioButton(trans.get("TCMotorSelPan.btn.designation")); + ButtonGroup bg = new ButtonGroup(); + bg.add(commonName); + bg.add(designation); + commonName.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + ((SwingPreferences) Application.getPreferences()).setMotorNameColumn(false); + model.fireTableDataChanged(); + } + }); + designation.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + ((SwingPreferences) Application.getPreferences()).setMotorNameColumn(true); + model.fireTableDataChanged(); + } + }); + + boolean initValue = ((SwingPreferences) Application.getPreferences()).getMotorNameColumn(); + commonName.setSelected(!initValue); + designation.setSelected(initValue); + + panel.add(motorNameColumn, "gapleft para"); + panel.add(commonName); + panel.add(designation, "spanx, growx, wrap"); + } + //// Motor selection table { table = new JTable(model); diff --git a/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java b/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java index 6d95e208a..19bef0b5c 100644 --- a/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java +++ b/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java @@ -331,7 +331,23 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences { // TODO: MEDIUM: Motor fill color (settable?) return new Color(0, 0, 0, 100); } - + + + /** + * Check whether to display the common name (false), or designation (true) in the motor selection table "Name" column + * @return true to display designation, false to display common name + */ + public boolean getMotorNameColumn() { + return getBoolean(net.sf.openrocket.startup.Preferences.MOTOR_NAME_COLUMN, true); + } + + /** + * Set whether to display the common name, or designation in the motor selection table "Name" column + * @param value if true, display designation, if false, display common name + */ + public void setMotorNameColumn(boolean value) { + putBoolean(net.sf.openrocket.startup.Preferences.MOTOR_NAME_COLUMN, value); + } public static int getMaxThreadCount() { From 9d8f5a6b388c0a4ff30976ce359f8fb89b879eef Mon Sep 17 00:00:00 2001 From: SiboVG Date: Thu, 13 Oct 2022 22:01:48 +0200 Subject: [PATCH 33/37] Restore table selection after motor column name change --- .../motor/thrustcurve/ThrustCurveMotorSelectionPanel.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorSelectionPanel.java b/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorSelectionPanel.java index e827d52c7..c50317f9d 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorSelectionPanel.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorSelectionPanel.java @@ -243,14 +243,22 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec @Override public void actionPerformed(ActionEvent e) { ((SwingPreferences) Application.getPreferences()).setMotorNameColumn(false); + int selectedRow = table.getSelectedRow(); model.fireTableDataChanged(); + if (selectedRow >= 0) { + table.setRowSelectionInterval(selectedRow, selectedRow); + } } }); designation.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((SwingPreferences) Application.getPreferences()).setMotorNameColumn(true); + int selectedRow = table.getSelectedRow(); model.fireTableDataChanged(); + if (selectedRow >= 0) { + table.setRowSelectionInterval(selectedRow, selectedRow); + } } }); From d06396ac2e5ba405fa4f89a8096384f23d4922ae Mon Sep 17 00:00:00 2001 From: SiboVG Date: Thu, 13 Oct 2022 22:12:16 +0200 Subject: [PATCH 34/37] Use common name if preferences not SwingPreferences --- .../gui/dialogs/motor/thrustcurve/ThrustCurveMotorColumns.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorColumns.java b/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorColumns.java index 72fb93ca2..3a2960a48 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorColumns.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorColumns.java @@ -35,6 +35,9 @@ enum ThrustCurveMotorColumns { NAME("TCurveMotorCol.NAME") { @Override public String getValue(ThrustCurveMotorSet m) { + if (!(Application.getPreferences() instanceof SwingPreferences)) { + return m.getCommonName(); + } if (((SwingPreferences) Application.getPreferences()).getMotorNameColumn()) { return m.getDesignation(); } else { From 07de50b5099fa14e214d423df29f2b3b6af25a85 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Fri, 14 Oct 2022 15:43:00 +0200 Subject: [PATCH 35/37] [#1167] Remove modality for thrust curve import error dialog --- swing/src/net/sf/openrocket/database/MotorDatabaseLoader.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/swing/src/net/sf/openrocket/database/MotorDatabaseLoader.java b/swing/src/net/sf/openrocket/database/MotorDatabaseLoader.java index 3b8ad6c9a..b073aee89 100644 --- a/swing/src/net/sf/openrocket/database/MotorDatabaseLoader.java +++ b/swing/src/net/sf/openrocket/database/MotorDatabaseLoader.java @@ -153,7 +153,8 @@ public class MotorDatabaseLoader extends AsynchronousDatabaseLoader { "
" + trans.get("MotorDbLoaderDlg.message2") + "

"; JOptionPane pane = new JOptionPane(message, JOptionPane.WARNING_MESSAGE); JDialog dialog = pane.createDialog(null, trans.get("MotorDbLoaderDlg.title")); - dialog.setModalityType(Dialog.ModalityType.DOCUMENT_MODAL); + dialog.setModalityType(Dialog.ModalityType.MODELESS); + dialog.setAlwaysOnTop(true); dialog.setVisible(true); } f.getV().close(); From 74567708a8da139d5c4be44924d176ddbd1c9e88 Mon Sep 17 00:00:00 2001 From: luz paz Date: Sat, 15 Oct 2022 14:32:21 -0400 Subject: [PATCH 36/37] Fix various typos Found via `codespell -q 3 -S ./swing,./**/l10n,*.eps -L bu,cant,cna,fo,gool,iif,reencode,wallthickness` --- core/build.xml | 2 +- core/doc/techdoc/chapter-conclusion.tex | 4 ++-- .../datafiles/tours/creating_design/creating_design.tour | 2 +- .../src/net/sf/openrocket/appearance/AppearanceBuilder.java | 2 +- core/src/net/sf/openrocket/database/Databases.java | 2 +- core/src/net/sf/openrocket/file/GeneralRocketLoader.java | 2 +- .../openrocket/file/openrocket/savers/AxialStageSaver.java | 2 +- .../openrocket/models/atmosphere/AtmosphericConditions.java | 6 +++--- core/src/net/sf/openrocket/preset/xml/BaseComponentDTO.java | 2 +- .../openrocket/rocketcomponent/FlightConfigurationId.java | 2 +- .../net/sf/openrocket/rocketcomponent/FreeformFinSet.java | 2 +- .../openrocket/simulation/BasicEventSimulationEngine.java | 2 +- core/src/net/sf/openrocket/simulation/FlightDataType.java | 2 +- core/src/net/sf/openrocket/util/TestRockets.java | 2 +- .../sf/openrocket/aerodynamics/BarrowmanCalculatorTest.java | 2 +- .../net/sf/openrocket/file/rocksim/importt/TubeFins1.rkt | 2 +- .../net/sf/openrocket/file/rocksim/importt/TubeFins2.rkt | 2 +- .../test/net/sf/openrocket/masscalc/MassCalculatorTest.java | 2 +- core/web/html/actions/updates.php | 2 +- core/web/htp/contact.htp | 2 +- core/web/htp/news.htp | 6 +++--- 21 files changed, 26 insertions(+), 26 deletions(-) diff --git a/core/build.xml b/core/build.xml index c10acd2d6..6ff2e33d6 100644 --- a/core/build.xml +++ b/core/build.xml @@ -60,7 +60,7 @@ - + diff --git a/core/doc/techdoc/chapter-conclusion.tex b/core/doc/techdoc/chapter-conclusion.tex index a2e6a06f6..9098dd28f 100644 --- a/core/doc/techdoc/chapter-conclusion.tex +++ b/core/doc/techdoc/chapter-conclusion.tex @@ -10,7 +10,7 @@ pyrotechnics. At its best, it works as an inspiration for youngsters to study engineering and sciences. This thesis work provides one of the computer-age tools for everybody -intrested in model rocket design. Providing everybody free access to +interested in model rocket design. Providing everybody free access to a full-fledged rocket simulator allows many more hobbyists to experiment with different kinds of rocket designs and become more involved in the sport. The most enthusiastic rocketeers may dive @@ -44,7 +44,7 @@ insight into the effects of roll during flight. The external listener classes that can be attached to the simulator allow huge potential for custom extensions. For example testing the active roll reduction controller that will be included in the -successor project of Haisunäätä would have been exceedingly difficult +successor project of Haisun��t� would have been exceedingly difficult without such support. By interfacing the actual controller with a simulated flight environment it was possible to discover various bugs in the controller software that would otherwise have gone undetected. diff --git a/core/resources/datafiles/tours/creating_design/creating_design.tour b/core/resources/datafiles/tours/creating_design/creating_design.tour index 30529cb46..3e2df9248 100644 --- a/core/resources/datafiles/tours/creating_design/creating_design.tour +++ b/core/resources/datafiles/tours/creating_design/creating_design.tour @@ -113,7 +113,7 @@ mass. The packed length, diameter and position affect the packed size and location of the parachute. -

The Deploys at propery can be used to affect when the +

The Deploys at property can be used to affect when the parachute deploys. The First ejection charge of this stage option will deploy the parachute when the ejection charge is fired, as is typical in small model rockets. diff --git a/core/src/net/sf/openrocket/appearance/AppearanceBuilder.java b/core/src/net/sf/openrocket/appearance/AppearanceBuilder.java index 5dfb7ab3b..f5d07bead 100644 --- a/core/src/net/sf/openrocket/appearance/AppearanceBuilder.java +++ b/core/src/net/sf/openrocket/appearance/AppearanceBuilder.java @@ -523,7 +523,7 @@ public class AppearanceBuilder extends AbstractChangeSource { } /** - * only applies change if there is no more changes comming + * only applies change if there is no more changes coming */ @Override protected void fireChangeEvent() { diff --git a/core/src/net/sf/openrocket/database/Databases.java b/core/src/net/sf/openrocket/database/Databases.java index 6903f6cc9..a2e9fb744 100644 --- a/core/src/net/sf/openrocket/database/Databases.java +++ b/core/src/net/sf/openrocket/database/Databases.java @@ -155,7 +155,7 @@ public class Databases { * @param type The type of material * @param baseName the name of material * @param density density - * @return a new onejct withe the material data + * @return a new object with the material data */ private static Material newMaterial(Type type, String baseName, double density) { String name = trans.get("material", baseName); diff --git a/core/src/net/sf/openrocket/file/GeneralRocketLoader.java b/core/src/net/sf/openrocket/file/GeneralRocketLoader.java index 43b6c5f72..ccea6f823 100644 --- a/core/src/net/sf/openrocket/file/GeneralRocketLoader.java +++ b/core/src/net/sf/openrocket/file/GeneralRocketLoader.java @@ -104,7 +104,7 @@ public class GeneralRocketLoader { } /** - * This method determines the type file contained in the stream then calls the appropriate loading mecahnism. + * This method determines the type file contained in the stream then calls the appropriate loading mechanism. * * If the stream is a gzip file, the argument is wrapped in a GzipInputStream and the rocket loaded. * diff --git a/core/src/net/sf/openrocket/file/openrocket/savers/AxialStageSaver.java b/core/src/net/sf/openrocket/file/openrocket/savers/AxialStageSaver.java index a81cc9ac8..1879114aa 100644 --- a/core/src/net/sf/openrocket/file/openrocket/savers/AxialStageSaver.java +++ b/core/src/net/sf/openrocket/file/openrocket/savers/AxialStageSaver.java @@ -20,7 +20,7 @@ public class AxialStageSaver extends ComponentAssemblySaver { if (c.isAfter()) { // yes, this test is redundant. I'm merely paranoid, and attempting to future-proof it if (c.getClass().equals(AxialStage.class)) { - // kept as simply 'stage' for backward compatability + // kept as simply 'stage' for backward compatibility list.add(""); instance.addParams(c, list); list.add(""); diff --git a/core/src/net/sf/openrocket/models/atmosphere/AtmosphericConditions.java b/core/src/net/sf/openrocket/models/atmosphere/AtmosphericConditions.java index a988ac8ed..9817a5a08 100644 --- a/core/src/net/sf/openrocket/models/atmosphere/AtmosphericConditions.java +++ b/core/src/net/sf/openrocket/models/atmosphere/AtmosphericConditions.java @@ -16,7 +16,7 @@ public class AtmosphericConditions implements Cloneable, Monitorable { /** The standard air pressure (1.01325 bar). */ public static final double STANDARD_PRESSURE = 101325.0; - /** The standard air temperature (20 degrees Celcius). */ + /** The standard air temperature (20 degrees Celsius). */ public static final double STANDARD_TEMPERATURE = 293.15; @@ -83,7 +83,7 @@ public class AtmosphericConditions implements Cloneable, Monitorable { * Return the current speed of sound for dry air. *

* The speed of sound is calculated using the expansion around the temperature 0 C - * c = 331.3 + 0.606*T where T is in Celcius. The result is accurate + * c = 331.3 + 0.606*T where T is in Celsius. The result is accurate * to about 0.5 m/s for temperatures between -30 and 30 C, and within 2 m/s * for temperatures between -55 and 30 C. * @@ -98,7 +98,7 @@ public class AtmosphericConditions implements Cloneable, Monitorable { * Return the current kinematic viscosity of the air. *

* The effect of temperature on the viscosity of a gas can be computed using - * Sutherland's formula. In the region of -40 ... 40 degrees Celcius the effect + * Sutherland's formula. In the region of -40 ... 40 degrees Celsius the effect * is highly linear, and thus a linear approximation is used in its stead. * This is divided by the result of {@link #getDensity()} to achieve the * kinematic viscosity. diff --git a/core/src/net/sf/openrocket/preset/xml/BaseComponentDTO.java b/core/src/net/sf/openrocket/preset/xml/BaseComponentDTO.java index 7fec283d5..4b5e57fdc 100644 --- a/core/src/net/sf/openrocket/preset/xml/BaseComponentDTO.java +++ b/core/src/net/sf/openrocket/preset/xml/BaseComponentDTO.java @@ -222,7 +222,7 @@ public abstract class BaseComponentDTO { } else if ("LINE".equals(type)) { return Material.Type.LINE; } - throw new IllegalArgumentException("Inavlid material type " + type + " specified for Component"); + throw new IllegalArgumentException("Invalid material type " + type + " specified for Component"); } } diff --git a/core/src/net/sf/openrocket/rocketcomponent/FlightConfigurationId.java b/core/src/net/sf/openrocket/rocketcomponent/FlightConfigurationId.java index cdf63e201..eda70d54b 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FlightConfigurationId.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FlightConfigurationId.java @@ -28,7 +28,7 @@ public final class FlightConfigurationId implements Comparable

* NOTE: the fin-point axes differ from rocket axes: - * +x within the fin points foreward; +x for the rocket points aft + * +x within the fin points forward; +x for the rocket points aft *

* Moving of the first point in the X-axis is allowed, but this actually moves * all of the other points the corresponding distance back, relative to the first. diff --git a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java index ecb4ae5cb..177181168 100644 --- a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java +++ b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java @@ -213,7 +213,7 @@ public class BasicEventSimulationEngine implements SimulationEngine { // } // Check for Tumbling - // Conditions for transision are: + // Conditions for transition are: // apogee reached (if sustainer stage) // and is not already tumbling // and not stable (cg > cp) diff --git a/core/src/net/sf/openrocket/simulation/FlightDataType.java b/core/src/net/sf/openrocket/simulation/FlightDataType.java index ed561400f..bea253490 100644 --- a/core/src/net/sf/openrocket/simulation/FlightDataType.java +++ b/core/src/net/sf/openrocket/simulation/FlightDataType.java @@ -251,7 +251,7 @@ public class FlightDataType implements Comparable { * This returns an existing data type if the symbol matches that of an existing type. * * If the symbol matches but the unit and description information differ, then the old stored datatype - * is erased and the updated version based on the given parametes is returned. + * is erased and the updated version based on the given parameters is returned. * The only exception is if the description or unitgroup are undefined (null or empty string). In this case * we just get these parameters from the existing type when making the new one. * diff --git a/core/src/net/sf/openrocket/util/TestRockets.java b/core/src/net/sf/openrocket/util/TestRockets.java index 13e7c5e45..52fa2c96a 100644 --- a/core/src/net/sf/openrocket/util/TestRockets.java +++ b/core/src/net/sf/openrocket/util/TestRockets.java @@ -1594,7 +1594,7 @@ public class TestRockets { stage2.setName("Stage2"); rocket.addChild(stage2); - // make 2st stage body tube + // make 2nd stage body tube BodyTube bodyTube2 = new BodyTube(12, 1, 0.05); stage2.addChild(bodyTube2); diff --git a/core/test/net/sf/openrocket/aerodynamics/BarrowmanCalculatorTest.java b/core/test/net/sf/openrocket/aerodynamics/BarrowmanCalculatorTest.java index a26de0d72..90d8044c0 100644 --- a/core/test/net/sf/openrocket/aerodynamics/BarrowmanCalculatorTest.java +++ b/core/test/net/sf/openrocket/aerodynamics/BarrowmanCalculatorTest.java @@ -289,7 +289,7 @@ public class BarrowmanCalculatorTest { AerodynamicCalculator calc = new BarrowmanCalculator(); FlightConfiguration configuration = rocket.getSelectedConfiguration(); - assertTrue("Estes Alpha III should be continous: ", calc.isContinuous(configuration, rocket)); + assertTrue("Estes Alpha III should be continuous: ", calc.isContinuous(configuration, rocket)); } @Test diff --git a/core/test/net/sf/openrocket/file/rocksim/importt/TubeFins1.rkt b/core/test/net/sf/openrocket/file/rocksim/importt/TubeFins1.rkt index e91d25d50..abe522d7d 100644 --- a/core/test/net/sf/openrocket/file/rocksim/importt/TubeFins1.rkt +++ b/core/test/net/sf/openrocket/file/rocksim/importt/TubeFins1.rkt @@ -27,7 +27,7 @@ 0 1 0 - This is a neat design that shows off the ability of RockSim to compute the stability of Assymetrical fin arrangements. + This is a neat design that shows off the ability of RockSim to compute the stability of Asymmetrical fin arrangements. Tim Van Milligan. Visit my web site at: www.ApogeeRockets.com 4 29 diff --git a/core/test/net/sf/openrocket/file/rocksim/importt/TubeFins2.rkt b/core/test/net/sf/openrocket/file/rocksim/importt/TubeFins2.rkt index ea1c6673c..79324b797 100644 --- a/core/test/net/sf/openrocket/file/rocksim/importt/TubeFins2.rkt +++ b/core/test/net/sf/openrocket/file/rocksim/importt/TubeFins2.rkt @@ -27,7 +27,7 @@ 0 1 0 - This is a neat design that shows off the ability of RockSim to compute the stability of Assymetrical fin arrangements. + This is a neat design that shows off the ability of RockSim to compute the stability of Asymmetrical fin arrangements. Tim Van Milligan. Visit my web site at: www.ApogeeRockets.com 4 29 diff --git a/core/test/net/sf/openrocket/masscalc/MassCalculatorTest.java b/core/test/net/sf/openrocket/masscalc/MassCalculatorTest.java index 07ee2fdbb..9ee1587ce 100644 --- a/core/test/net/sf/openrocket/masscalc/MassCalculatorTest.java +++ b/core/test/net/sf/openrocket/masscalc/MassCalculatorTest.java @@ -1030,7 +1030,7 @@ public class MassCalculatorTest extends BaseTestCase { mmt.setOverrideMass(0.213); // cm= 0.21300000g @[1.28900000,0.07700000,0.00000000] - // Fin mass is not overriden + // Fin mass is not overridden // cm= 0.15995232g @[1.23793939,0.07700000,0.00000000] RigidBody boosterData = MassCalculator.calculateStructure(config); diff --git a/core/web/html/actions/updates.php b/core/web/html/actions/updates.php index 0960f6c4e..bb9187cfc 100644 --- a/core/web/html/actions/updates.php +++ b/core/web/html/actions/updates.php @@ -74,7 +74,7 @@ header("Content-type: text/plain"); * Currently all old versions are handled manually. * Update checking was introduced in OpenRocket 0.9.4 * - * We ignore "pre" versions, they are handled exacly like + * We ignore "pre" versions, they are handled exactly like * their non-pre counterparts. */ $version = $_GET["version"]; diff --git a/core/web/htp/contact.htp b/core/web/htp/contact.htp index cea23f889..0b81541bb 100644 --- a/core/web/htp/contact.htp +++ b/core/web/htp/contact.htp @@ -10,7 +10,7 @@

Mailing lists

OpenRocket currently has two mailing lists for - intrested users:

+ interested users:

diff --git a/core/web/htp/news.htp b/core/web/htp/news.htp index 4a612519d..2205e2524 100644 --- a/core/web/htp/news.htp +++ b/core/web/htp/news.htp @@ -45,14 +45,14 @@

15.11.2013: Version 13.11.1 is released! This release contains bug fixes including fixing Tube Coupler configuration, various exceptions in - the flight configuration tab, updated 3d libraris (which didn't really make + the flight configuration tab, updated 3d libraries (which didn't really make it into previous versions).

8.11.2013: Version 13.11 is released! This release simplifies flight configurations by replacing the dialog with the configuration tab. Motor filtering in the motor chooser dialog has been enhanced. - Chineese translations have been added and Russian translations updated. + Chinese translations have been added and Russian translations updated. Updated the 3D libraries, and squashed some bugs introduced by Java 1.7.0_45-b18.

6.10.2013: Version 13.09.1 is @@ -104,7 +104,7 @@

  • Support for fractional inches (1/64) for unit length
  • Added preference for windspeed units separately
  • Added "most recently used files" in File Menu
  • -
  • Improved printed accurracy in fin marking guide
  • +
  • Improved printed accuracy in fin marking guide
  • Calibration rulers added to printed templates
  • Translations in Czech and Polish, numerous updates
  • From 5f1440e3f617d6e71eb638caf6be22f2295085dc Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Sun, 16 Oct 2022 17:04:59 -0600 Subject: [PATCH 37/37] Use absolute value of jerk in calculating time step in BasicLandingStepper() Don't let time step in BasicLandingStepper() get smaller than MIN_TIME_STEP (.001 seconds) --- .../sf/openrocket/simulation/AbstractSimulationStepper.java | 2 ++ .../src/net/sf/openrocket/simulation/BasicLandingStepper.java | 4 +++- .../net/sf/openrocket/simulation/RK4SimulationStepper.java | 3 --- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/net/sf/openrocket/simulation/AbstractSimulationStepper.java b/core/src/net/sf/openrocket/simulation/AbstractSimulationStepper.java index e247da7f4..637d5c6e3 100644 --- a/core/src/net/sf/openrocket/simulation/AbstractSimulationStepper.java +++ b/core/src/net/sf/openrocket/simulation/AbstractSimulationStepper.java @@ -13,6 +13,8 @@ import net.sf.openrocket.util.Quaternion; public abstract class AbstractSimulationStepper implements SimulationStepper { + protected static final double MIN_TIME_STEP = 0.001; + /** * Compute the atmospheric conditions, allowing listeners to override. * diff --git a/core/src/net/sf/openrocket/simulation/BasicLandingStepper.java b/core/src/net/sf/openrocket/simulation/BasicLandingStepper.java index 78e1e00bb..ca809dcbb 100644 --- a/core/src/net/sf/openrocket/simulation/BasicLandingStepper.java +++ b/core/src/net/sf/openrocket/simulation/BasicLandingStepper.java @@ -73,10 +73,12 @@ public class BasicLandingStepper extends AbstractSimulationStepper { double timeStep = RECOVERY_TIME_STEP; // adjust based on change in acceleration (ie jerk) - final double jerk = linearAcceleration.sub(status.getRocketAcceleration()).multiply(1.0/status.getPreviousTimeStep()).length(); + final double jerk = Math.abs(linearAcceleration.sub(status.getRocketAcceleration()).multiply(1.0/status.getPreviousTimeStep()).length()); if (jerk > MathUtil.EPSILON) { timeStep = Math.min(timeStep, 1.0/jerk); } + // but don't let it get *too* small + timeStep = Math.max(timeStep, MIN_TIME_STEP); // Perform Euler integration Coordinate newPosition = status.getRocketPosition().add(status.getRocketVelocity().multiply(timeStep)). diff --git a/core/src/net/sf/openrocket/simulation/RK4SimulationStepper.java b/core/src/net/sf/openrocket/simulation/RK4SimulationStepper.java index 7786876c9..80275a52b 100644 --- a/core/src/net/sf/openrocket/simulation/RK4SimulationStepper.java +++ b/core/src/net/sf/openrocket/simulation/RK4SimulationStepper.java @@ -58,9 +58,6 @@ public class RK4SimulationStepper extends AbstractSimulationStepper { private static final double MAX_ROLL_RATE_CHANGE = 2 * Math.PI / 180; private static final double MAX_PITCH_CHANGE = 4 * Math.PI / 180; - private static final double MIN_TIME_STEP = 0.001; - - private Random random;