Changeset 61 in tmcsimulator-scriptbuilder for trunk


Ignore:
Timestamp:
08/19/2017 04:42:55 AM (9 years ago)
Author:
bmcguffin
Message:

Made a few cosmetic changes to the code. Added a statement in the update method of IncidentEditorFrame? which tries to set the maximum scale of the zoom slider at an appropriate level.

Location:
trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/scriptbuilder/gui/IncidentEditorFrame.form

    r55 r61  
    424424      <Dimension value="[800, 700]"/> 
    425425    </Property> 
    426     <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> 
    427       <Dimension value="[945, 1545]"/> 
    428     </Property> 
    429     <Property name="size" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> 
    430       <Dimension value="[800, 700]"/> 
    431     </Property> 
    432426  </Properties> 
    433427  <SyntheticProperties> 
  • trunk/src/scriptbuilder/gui/IncidentEditorFrame.java

    r55 r61  
    99import java.awt.Adjustable; 
    1010import java.awt.Color; 
    11 import java.awt.Cursor; 
    1211import java.awt.event.AdjustmentEvent; 
    1312import java.awt.event.AdjustmentListener; 
    1413import java.awt.event.KeyEvent; 
    1514import java.awt.event.KeyListener; 
    16 import java.io.File; 
    1715import java.io.IOException; 
    1816import java.util.ArrayList; 
     
    2523import javax.swing.DefaultListModel; 
    2624import javax.swing.JButton; 
    27 import javax.swing.JFileChooser; 
    28 import javax.swing.JOptionPane; 
    29 import javax.swing.UIManager; 
    30 import javax.swing.UnsupportedLookAndFeelException; 
    3125import scriptbuilder.structures.ScriptEvent; 
    3226import scriptbuilder.structures.ScriptEvent.ScriptEventType; 
     
    3428import scriptbuilder.structures.ScriptIncident.IncidentFocusedEvent; 
    3529import scriptbuilder.structures.ScriptIncident.SliceChangedEvent; 
    36 import scriptbuilder.structures.SimulationScript; 
    3730import scriptbuilder.structures.TimeSlice; 
    3831import scriptbuilder.structures.events.I_ScriptEvent; 
     
    355348            //gotoIncident.setSelectedItem(i); 
    356349        } 
     350        zoomSlider.setMinimum(((timelineTickPanel.getVisibleRect().width - 20) 
     351                * ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION) 
     352                / Math.max(theIncident.length, 1)); 
     353        zoomSlider.setMaximum(zoomSlider.getMinimum() + 20); 
    357354    } 
    358355 
  • trunk/src/scriptbuilder/gui/ScriptBuilderFrame.java

    r55 r61  
    88import java.awt.Adjustable; 
    99import java.awt.Color; 
    10 import java.awt.Cursor; 
    1110import java.awt.event.AdjustmentEvent; 
    1211import java.awt.event.AdjustmentListener; 
     
    1514import java.io.File; 
    1615import java.io.IOException; 
    17 import java.util.ArrayList; 
    1816import java.util.Observable; 
    1917import java.util.Observer; 
     
    2321import java.util.logging.Logger; 
    2422import javax.swing.DefaultListModel; 
    25 import javax.swing.JButton; 
    2623import javax.swing.JFileChooser; 
    2724import javax.swing.JOptionPane; 
     
    15851582        if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) 
    15861583        { 
     1584            script = new SimulationScript(); 
    15871585            System.out.println(fc.getSelectedFile().getName()); 
    15881586            script.loadScriptFromFile(fc.getSelectedFile()); 
    15891587            script.saveFile = fc.getSelectedFile(); 
    15901588        } 
     1589        update(script, script); 
    15911590        zoomSlider.setValue(zoomSlider.getMinimum()); 
    1592         update(script, script); 
     1591        repaint(); 
    15931592    }//GEN-LAST:event_fileOpenActionPerformed 
    15941593 
     
    18761875    private void fileNewActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_fileNewActionPerformed 
    18771876    {//GEN-HEADEREND:event_fileNewActionPerformed 
    1878         System.out.println("NEW SCRIPT"); 
    18791877        script = new SimulationScript(); 
    18801878        script.update(); 
     
    18971895                script.incidents.get(0)); 
    18981896 
    1899         System.out.println("RESULT = " + result.toString()); 
    1900  
    1901         input = result.toString(); 
    1902  
    1903         System.out.println("INPUT = " + input); 
    1904  
    1905         int i = 0; 
    1906         for (ScriptIncident incident : script.incidents) 
    1907         { 
    1908             if (incident == null) 
    1909             { 
    1910                 continue; 
    1911             } 
    1912             System.out.println((++i) + ": " + incident.toString()); 
    1913             if (incident.toString().equals(input)) 
    1914             { 
    1915                 inc = incident; 
    1916             } 
    1917         } 
    1918  
    1919         if (inc != null) 
    1920         { 
    1921             new IncidentEditorFrame(inc).setVisible(true); 
     1897        if (result != null) 
     1898        { 
     1899            System.out.println("RESULT = " + result.toString()); 
     1900 
     1901            input = result.toString(); 
     1902 
     1903            System.out.println("INPUT = " + input); 
     1904 
     1905            int i = 0; 
     1906            for (ScriptIncident incident : script.incidents) 
     1907            { 
     1908                if (incident == null) 
     1909                { 
     1910                    continue; 
     1911                } 
     1912                System.out.println((++i) + ": " + incident.toString()); 
     1913                if (incident.toString().equals(input)) 
     1914                { 
     1915                    inc = incident; 
     1916                } 
     1917            } 
     1918 
     1919            if (inc != null) 
     1920            { 
     1921                new IncidentEditorFrame(inc).setVisible(true); 
     1922            } 
    19221923        } 
    19231924        update(script, script); 
  • trunk/src/scriptbuilder/gui/application.properties

    r60 r61  
    1 #Mon, 14 Aug 2017 16:50:46 -0700 
     1#Mon, 14 Aug 2017 16:52:48 -0700 
    22 
    33Application.revision=0 
  • trunk/src/scriptbuilder/gui/panels/ScriptBuilderTimelinePanel.java

    r54 r61  
    188188            } 
    189189 
    190             if (incident.slices.get(newSlice) != null) 
     190            if (incident.slices.get(newSlice) != null 
     191                    && getTopLevelAncestor() instanceof IncidentEditorFrame) 
    191192            { 
    192193                ed.setVisible(true); 
  • trunk/test/scriptbuilder/structures/SimulationScriptTest.java

    r60 r61  
    77import java.util.Observable; 
    88import java.util.Observer; 
    9 import java.util.logging.Level; 
    10 import java.util.logging.Logger; 
    119import static junit.framework.Assert.assertFalse; 
    1210import static junit.framework.Assert.assertTrue; 
Note: See TracChangeset for help on using the changeset viewer.