updates for 0.9.2

This commit is contained in:
Sampo Niskanen 2009-07-13 16:48:41 +00:00
parent fc97f776fa
commit 2afc34303f
12 changed files with 87 additions and 66 deletions

View File

@ -1,3 +1,11 @@
2009-07-13 Sampo Niskanen
* Release 0.9.2
2009-07-12 Sampo Niskanen
* [BUG] Better DescriptionArea based on JEditorPane
2009-07-09 Sampo Niskanen 2009-07-09 Sampo Niskanen
* [BUG] Fixed imperial unit conversions * [BUG] Fixed imperial unit conversions

View File

@ -1,9 +1,10 @@
OpenRocket 0.9.2 (future): OpenRocket 0.9.2 (2009-07-13):
--------------------------- -------------------------------
- a new and enhanced "Edit motor configurations" dialog Fixed imperial unit conversions. Significant UI enhancements to the
- a search field in the motor selection dialog motor configuration edit dialog, motor selection dialog and file
open/save.
OpenRocket 0.9.1 (2009-06-09): OpenRocket 0.9.1 (2009-06-09):

View File

@ -1,6 +1,6 @@
# The OpenRocket build version # The OpenRocket build version
build.version=0.9.2pre build.version=0.9.2
# The source of the package. When building a package for a specific # The source of the package. When building a package for a specific
# distribution (Debian, Fedora etc.), this should be changed appropriately! # distribution (Debian, Fedora etc.), this should be changed appropriately!

Binary file not shown.

BIN
dists/OpenRocket-0.9.2.jar Normal file

Binary file not shown.

View File

@ -1,58 +1,60 @@
package net.sf.openrocket.gui.components; package net.sf.openrocket.gui.components;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font;
import java.awt.Rectangle; import java.awt.Rectangle;
import javax.swing.JPanel; import javax.swing.JEditorPane;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants; import javax.swing.ScrollPaneConstants;
import javax.swing.SwingUtilities;
import net.miginfocom.swing.MigLayout;
public class DescriptionArea extends JScrollPane { public class DescriptionArea extends JScrollPane {
private ResizeLabel text; private final JEditorPane editorPane;
private MigLayout layout;
private JPanel panel;
public DescriptionArea(int rows) { public DescriptionArea(int rows) {
this(rows, -2); this(rows, -1);
} }
public DescriptionArea(int rows, float size) { public DescriptionArea(int rows, float size) {
super(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, super(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
layout = new MigLayout("ins 0 2px, fill"); editorPane = new JEditorPane("text/html", "");
panel = new JPanel(layout); Font font = editorPane.getFont();
editorPane.setFont(font.deriveFont(font.getSize2D() + size));
editorPane.setEditable(false);
text = new ResizeLabel(" ",size); // Calculate correct height
text.validate(); editorPane.setText("abc");
Dimension dim = text.getPreferredSize(); Dimension oneline = editorPane.getPreferredSize();
dim.height = (dim.height+2)*rows + 2; editorPane.setText("abc<br>def");
Dimension twolines = editorPane.getPreferredSize();
editorPane.setText("");
int lineheight = twolines.height - oneline.height;
int extraheight = oneline.height - lineheight;
Dimension dim = editorPane.getPreferredSize();
dim.height = lineheight * rows + extraheight + 2;
this.setPreferredSize(dim); this.setPreferredSize(dim);
panel.add(text, "growx"); this.setViewportView(editorPane);
this.setViewportView(panel);
this.revalidate();
} }
public void setText(String txt) { public void setText(String txt) {
if (!txt.startsWith("<html>")) editorPane.setText(txt);
txt = "<html>" + txt; editorPane.revalidate();
text.setText(txt); SwingUtilities.invokeLater(new Runnable() {
}
@Override
public void run() {
editorPane.scrollRectToVisible(new Rectangle(0,0,1,1));
}
@Override });
public void validate() { editorPane.scrollRectToVisible(new Rectangle(0,0,1,1));
Rectangle dim = this.getViewportBorderBounds();
layout.setComponentConstraints(text, "width "+ dim.width + ", growx");
super.validate();
text.validate();
} }
} }

View File

@ -35,7 +35,7 @@ public class NoseConeConfig extends RocketComponentConfig {
private JSlider shapeSlider; private JSlider shapeSlider;
// Prepended to the description from NoseCone.DESCRIPTIONS // Prepended to the description from NoseCone.DESCRIPTIONS
private static final String PREDESC = "<html><p style=\"font-size: x-small\">"; private static final String PREDESC = "<html>";
public NoseConeConfig(RocketComponent c) { public NoseConeConfig(RocketComponent c) {
super(c); super(c);

View File

@ -147,12 +147,12 @@ public class RingComponentConfig extends RocketComponentConfig {
JPanel sub = materialPanel(new JPanel(new MigLayout()), Material.Type.BULK); JPanel sub = materialPanel(new JPanel(new MigLayout()), Material.Type.BULK);
if (component instanceof EngineBlock) { if (component instanceof EngineBlock) {
DescriptionArea desc = new DescriptionArea(6,-1); final DescriptionArea desc = new DescriptionArea(6);
desc.setText("<html>An <b>engine block</b> stops the motor from moving forwards " + desc.setText("<html>An <b>engine block</b> stops the motor from moving forwards " +
"in the motor mount tube.<br><br>In order to add a motor, create a " + "in the motor mount tube.<br><br>In order to add a motor, create a " +
"<b>body tube</b> or <b>inner tube</b> and mark it as a motor mount in " + "<b>body tube</b> or <b>inner tube</b> and mark it as a motor mount in " +
"the <em>Motor</em> tab."); "the <em>Motor</em> tab.");
sub.add(desc, "growx"); sub.add(desc, "width 1px, growx, wrap");
} }
panel.add(sub,"cell 4 0, gapleft paragraph, aligny 0%, spany"); panel.add(sub,"cell 4 0, gapleft paragraph, aligny 0%, spany");

View File

@ -34,7 +34,7 @@ public class TransitionConfig extends RocketComponentConfig {
// Prepended to the description from Transition.DESCRIPTIONS // Prepended to the description from Transition.DESCRIPTIONS
private static final String PREDESC = "<html><p style=\"font-size: x-small\">"; private static final String PREDESC = "<html>";
public TransitionConfig(RocketComponent c) { public TransitionConfig(RocketComponent c) {
@ -184,8 +184,6 @@ public class TransitionConfig extends RocketComponentConfig {
private void updateEnabled() { private void updateEnabled() {
boolean e = ((Transition)component).getType().usesParameter(); boolean e = ((Transition)component).getType().usesParameter();
shapeLabel.setEnabled(e); shapeLabel.setEnabled(e);

View File

@ -17,6 +17,7 @@ import java.awt.event.WindowEvent;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@ -919,8 +920,26 @@ public class BasicFrame extends JFrame {
} }
public static void main(final String[] args) {
public static void main(String[] args) { // Run the actual startup method in the EDT since it can use dialogs etc.
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
runMain(args);
}
});
} catch (InterruptedException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
private static void runMain(String[] args) {
/* /*
* Set the look-and-feel. On Linux, Motif/Metal is sometimes incorrectly used * Set the look-and-feel. On Linux, Motif/Metal is sometimes incorrectly used
@ -928,12 +947,6 @@ public class BasicFrame extends JFrame {
* other alternatives. * other alternatives.
*/ */
try { try {
UIManager.LookAndFeelInfo[] info = UIManager.getInstalledLookAndFeels();
// System.out.println("Available look-and-feels:");
// for (int i=0; i<info.length; i++) {
// System.out.println(" "+info[i]);
// }
// Set system L&F // Set system L&F
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
@ -944,18 +957,21 @@ public class BasicFrame extends JFrame {
laf.getName().matches(".*[mM][eE][tT][aA][lL].*")) { laf.getName().matches(".*[mM][eE][tT][aA][lL].*")) {
// Search for better LAF // Search for better LAF
for (UIManager.LookAndFeelInfo l: info) { UIManager.LookAndFeelInfo[] info = UIManager.getInstalledLookAndFeels();
if (l.getName().matches(".*[gG][tT][kK].*")) { String lafNames[] = {
UIManager.setLookAndFeel(l.getClassName()); ".*[gG][tT][kK].*",
break; ".*[wW][iI][nN].*",
} ".*[mM][aA][cC].*",
if (l.getName().contains(".*[wW][iI][nN].*")) { ".*[aA][qQ][uU][aA].*",
UIManager.setLookAndFeel(l.getClassName()); ".*[nN][iI][mM][bB].*"
break; };
}
if (l.getName().contains(".*[mM][aA][cC].*")) { lf: for (String lafName: lafNames) {
UIManager.setLookAndFeel(l.getClassName()); for (UIManager.LookAndFeelInfo l: info) {
break; if (l.getName().matches(lafName)) {
UIManager.setLookAndFeel(l.getClassName());
break lf;
}
} }
} }
} }

View File

@ -649,7 +649,7 @@ public class SimulationEditDialog extends JDialog {
panel.add(sub, "growx, growy"); panel.add(sub, "growx, growy");
DescriptionArea desc = new DescriptionArea(5, -1); DescriptionArea desc = new DescriptionArea(5);
desc.setText("<html><p>" + desc.setText("<html><p>" +
"<i>Simulation listeners</i> is an advanced feature that allows "+ "<i>Simulation listeners</i> is an advanced feature that allows "+
"user-written code to listen to and interact with the simulation. " + "user-written code to listen to and interact with the simulation. " +

View File

@ -1,7 +1,3 @@
/*
* TODO: CRITICAL: Licensing
*/
package net.sf.openrocket.util; package net.sf.openrocket.util;
import java.awt.Component; import java.awt.Component;