Merge branch 'openrocket:unstable' into add-open-airframe-warning

This commit is contained in:
Joe Pfeiffer 2022-12-28 18:14:30 -07:00 committed by GitHub
commit a271b48db1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 2 deletions

View File

@ -2152,7 +2152,9 @@ ExportDecalDialog.source.exception = Could not find decal source file ''{0}''.<b
ComponentPresetChooserDialog.title = Choose component preset
ComponentPresetChooserDialog.filter.label = Filter by text:
ComponentPresetChooserDialog.checkbox.filterAftDiameter = Match aft diameter
ComponentPresetChooserDialog.checkbox.filterAftDiameter.ttip = Search for components with the same aft diameter as the next component
ComponentPresetChooserDialog.checkbox.filterForeDiameter = Match fore diameter
ComponentPresetChooserDialog.checkbox.filterForeDiameter.ttip = Search for components with the same fore diameter as the previous component
ComponentPresetChooserDialog.menu.sortAsc = Sort Ascending
ComponentPresetChooserDialog.menu.sortDesc = Sort Descending
ComponentPresetChooserDialog.menu.units = Units

View File

@ -270,9 +270,12 @@ public class NoseCone extends Transition implements InsideColorComponent {
@Override
protected void loadFromPreset(ComponentPreset preset) {
// We first need to unflip, because the preset loading always applies settings for a normal nose cone (e.g. aft diameter)
boolean flipped = isFlipped;
setFlipped(false);
//Many parameters are handled by the super class Transition.loadFromPreset
super.loadFromPreset(preset);
setFlipped(flipped);
}
/**

View File

@ -35,6 +35,7 @@ import net.sf.openrocket.gui.util.SwingPreferences;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.preset.TypedKey;
import net.sf.openrocket.rocketcomponent.NoseCone;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.rocketcomponent.SymmetricComponent;
import net.sf.openrocket.startup.Application;
@ -257,6 +258,7 @@ public class ComponentPresetChooserDialog extends JDialog {
* Add filter by fore diameter
*/
foreDiameterFilterCheckBox = new JCheckBox(trans.get("ComponentPresetChooserDialog.checkbox.filterForeDiameter"));
foreDiameterFilterCheckBox.setToolTipText(trans.get("ComponentPresetChooserDialog.checkbox.filterForeDiameter.ttip"));
final SymmetricComponent prevSym = curSym.getPreviousSymmetricComponent();
if (prevSym != null && foreDiameterColumnIndex >= 0) {
foreDiameterFilterCheckBox.setSelected(preferences.isMatchForeDiameter());
@ -274,8 +276,16 @@ public class ComponentPresetChooserDialog extends JDialog {
/*
* Add filter by aft diameter
*/
final SymmetricComponent nextSym;
if (curSym instanceof NoseCone && ((NoseCone) curSym).isFlipped()) {
aftDiameterFilterCheckBox = new JCheckBox(trans.get("ComponentPresetChooserDialog.checkbox.filterForeDiameter"));
aftDiameterFilterCheckBox.setToolTipText(trans.get("ComponentPresetChooserDialog.checkbox.filterForeDiameter.ttip"));
nextSym = curSym.getPreviousSymmetricComponent();
} else {
aftDiameterFilterCheckBox = new JCheckBox(trans.get("ComponentPresetChooserDialog.checkbox.filterAftDiameter"));
final SymmetricComponent nextSym = curSym.getNextSymmetricComponent();
aftDiameterFilterCheckBox.setToolTipText(trans.get("ComponentPresetChooserDialog.checkbox.filterAftDiameter.ttip"));
nextSym = curSym.getNextSymmetricComponent();
}
if (nextSym != null && aftDiameterColumnIndex >= 0) {
aftDiameterFilterCheckBox.setSelected(preferences.isMatchAftDiameter());
aftDiameterFilter = new ComponentPresetRowFilter(nextSym.getForeRadius() * 2.0, aftDiameterColumnIndex);