Skip to content

Commit

Permalink
Fixed some enable/disable states.
Browse files Browse the repository at this point in the history
  • Loading branch information
winder committed Dec 15, 2012
1 parent 18b8a79 commit 3bf32b4
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 66 deletions.
70 changes: 35 additions & 35 deletions src/com/willwinder/universalgcodesender/MainWindow.form
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,14 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="manualControlPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="11" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="controlContextTabbedPane" min="-2" pref="203" max="-2" attributes="0"/>
Expand All @@ -75,10 +74,9 @@
<Component id="showVerboseOutputCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jTabbedPane2" pref="0" max="32767" attributes="0"/>
<Component id="jTabbedPane2" min="-2" pref="290" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down Expand Up @@ -562,7 +560,7 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace pref="12" max="32767" attributes="0"/>
<EmptySpace pref="20" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
Expand Down Expand Up @@ -899,60 +897,62 @@
<Container class="javax.swing.JPanel" name="manualControlPanel">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Machine Jogging"/>
</Border>
</Property>
</Properties>

<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="15" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="arrowMovementEnabled" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="xMinusButton" min="-2" pref="50" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="yPlusButton" min="-2" pref="50" max="-2" attributes="0"/>
<Component id="yMinusButton" min="-2" pref="50" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="xPlusButton" pref="50" max="-2" attributes="0"/>
<EmptySpace pref="58" max="32767" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="zPlusButton" min="-2" pref="50" max="-2" attributes="0"/>
<Component id="zMinusButton" min="-2" pref="50" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="15" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="stepSizeLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="stepSizeSpinner" min="-2" pref="70" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="6" pref="6" max="-2" attributes="0"/>
<Component id="xMinusButton" min="-2" pref="50" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="yPlusButton" min="-2" pref="50" max="-2" attributes="0"/>
<Component id="yMinusButton" min="-2" pref="50" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="xPlusButton" pref="50" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="zPlusButton" min="-2" pref="50" max="-2" attributes="0"/>
<Component id="zMinusButton" min="-2" pref="50" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace min="-2" pref="36" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="17" max="-2" attributes="0"/>
<Component id="stepSizeLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="stepSizeSpinner" min="-2" pref="70" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<EmptySpace pref="42" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
<Component id="arrowMovementEnabled" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="stepSizeLabel" linkSize="1" min="-2" max="-2" attributes="0"/>
<Component id="stepSizeSpinner" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="17" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
Expand All @@ -973,7 +973,7 @@
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace pref="25" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down
66 changes: 35 additions & 31 deletions src/com/willwinder/universalgcodesender/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel3Layout.createSequentialGroup()
.addContainerGap(12, Short.MAX_VALUE)
.addContainerGap(20, Short.MAX_VALUE)
.add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
.add(jPanel3Layout.createSequentialGroup()
.add(jLabel7)
Expand Down Expand Up @@ -644,7 +644,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addContainerGap())
);

manualControlPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
manualControlPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Machine Jogging"));

xPlusButton.setText("X+");
xPlusButton.setEnabled(false);
Expand Down Expand Up @@ -718,41 +718,41 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) {
manualControlPanelLayout.setHorizontalGroup(
manualControlPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(manualControlPanelLayout.createSequentialGroup()
.add(15, 15, 15)
.add(manualControlPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(manualControlPanelLayout.createSequentialGroup()
.add(arrowMovementEnabled)
.addContainerGap())
.addContainerGap()
.add(arrowMovementEnabled))
.add(manualControlPanelLayout.createSequentialGroup()
.add(xMinusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(manualControlPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(yPlusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(yMinusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(xPlusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 58, Short.MAX_VALUE)
.add(manualControlPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(zPlusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(zMinusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(36, 36, 36))))
.add(manualControlPanelLayout.createSequentialGroup()
.add(17, 17, 17)
.add(stepSizeLabel)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
.add(stepSizeSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 70, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(0, 0, Short.MAX_VALUE))
.add(15, 15, 15)
.add(manualControlPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(manualControlPanelLayout.createSequentialGroup()
.add(stepSizeLabel)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
.add(stepSizeSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 70, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(manualControlPanelLayout.createSequentialGroup()
.add(6, 6, 6)
.add(xMinusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(manualControlPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(yPlusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(yMinusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(xPlusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(manualControlPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(zPlusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(zMinusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))))
.addContainerGap(42, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
);
manualControlPanelLayout.setVerticalGroup(
manualControlPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, manualControlPanelLayout.createSequentialGroup()
.add(14, 14, 14)
.add(arrowMovementEnabled)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(manualControlPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(stepSizeLabel)
.add(stepSizeSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 17, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
.add(manualControlPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(manualControlPanelLayout.createSequentialGroup()
.add(32, 32, 32)
Expand All @@ -767,7 +767,7 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) {
.add(manualControlPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(yMinusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 60, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(zMinusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 60, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
.addContainerGap())
.addContainerGap(25, Short.MAX_VALUE))
);

manualControlPanelLayout.linkSize(new java.awt.Component[] {stepSizeLabel, stepSizeSpinner}, org.jdesktop.layout.GroupLayout.VERTICAL);
Expand Down Expand Up @@ -795,24 +795,22 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) {
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(manualControlPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(0, 11, Short.MAX_VALUE))
.add(manualControlPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(layout.createSequentialGroup()
.add(controlContextTabbedPane, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 203, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(scrollWindowCheckBox)
.add(showVerboseOutputCheckBox))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTabbedPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))
.addContainerGap())
.add(jTabbedPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 290, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
);

pack();
Expand Down Expand Up @@ -1256,18 +1254,24 @@ private void updateWorkflowCommands(boolean enabled) {
private void updateControlsForSend(boolean isSending) {
// Command tab
this.commandTextField.setEnabled(!isSending);

// File tab
this.sendButton.setEnabled(!isSending);
this.pauseButton.setEnabled(isSending);
this.overrideSpeedCheckBox.setEnabled(!isSending);
this.overrideSpeedValueSpinner.setEnabled(!isSending);
this.cancelButton.setEnabled(isSending);

// Workflow tab
this.updateWorkflowCommands(!isSending);

// Jogging commands
this.arrowMovementEnabled.setEnabled(!isSending);
if (this.arrowMovementEnabled.isSelected()) {
this.updateManualControls(!isSending);
}

// If not sending, reset pause button to "Pause" and disabled.
if (!isSending) {
this.disablePauseResume();
}
Expand Down

0 comments on commit 3bf32b4

Please sign in to comment.