Changeset 54 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder/gui/panels/TimeStampPanel.java


Ignore:
Timestamp:
08/09/2017 04:12:39 PM (9 years ago)
Author:
bmcguffin
Message:

Duplicated main ScriptBuilder? window. The new window will become the Incident Editor window (see Storyboard 2a-B). The main ScriptBuilder? window will become the Incident Combiner window (see storyboard 1a-B).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/scriptbuilder/gui/panels/TimeStampPanel.java

    r1 r54  
    8989 
    9090    /** 
     91     * Update the length interval and the dimensions of the panel. NOTE: This 
     92     * method implementation is an exact duplication of the update method in 
     93     * panels.TimelineTickPanel. I'm not sure if it actually accomplishes 
     94     * anything here. 
     95     * 
     96     * @param script The simulation script model 
     97     */ 
     98    public void update(ScriptIncident incident) 
     99    { 
     100        longestLength = ScriptBuilderGuiConstants.TICK_TIMELINE_SMALLEST_LENGTH; 
     101 
     102        // Get the stats on the incidents 
     103        int height = ScriptBuilderGuiConstants.TICK_TOP_MARGIN * 4; 
     104        if (incident != null) 
     105        { 
     106            height += incident.collapsed 
     107                    ? ScriptBuilderGuiConstants.TIMELINE_OPENED_HEIGHT 
     108                    : ScriptBuilderGuiConstants.TIMELINE_OPENED_HEIGHT; 
     109            if ((incident.length + incident.offset) > longestLength) 
     110            { 
     111                longestLength = incident.length + incident.offset; 
     112            } 
     113        } 
     114 
     115        if (incident != null && incident.number == 100) 
     116        { 
     117            incident.length = longestLength; 
     118            incident.offset = 0; 
     119        } 
     120 
     121        Dimension newSize = new Dimension(longestLength 
     122                / ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION 
     123                * ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK 
     124                + ScriptBuilderGuiConstants.TICK_TIMELINE_LEFT_MARGIN + 50, 
     125                height); 
     126        this.setPreferredSize(newSize); 
     127        this.setSize(newSize); 
     128 
     129        this.invalidate(); 
     130    } 
     131 
     132    /** 
    91133     * Refresh the panel. Draw the timestamps for the appropriate intervals 
    92134     * based on zoom level. 
Note: See TracChangeset for help on using the changeset viewer.