Startup
This commit is contained in:
@@ -210,7 +210,6 @@ public class ScreenPanel extends Panel {
|
||||
((Camtool) camera).setRoi(new int[]{roi.x + cur[0], roi.y + cur[1], roi.width, roi.height});
|
||||
} else {
|
||||
((Camtool) camera).setRoi(new int[]{roi.x, roi.y, roi.width, roi.height});
|
||||
((Camtool) camera).setRoiEnabled(true);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
} finally {
|
||||
@@ -233,7 +232,7 @@ public class ScreenPanel extends Panel {
|
||||
renderer.abortSelection();
|
||||
if (camera instanceof Camtool) {
|
||||
try {
|
||||
((Camtool) camera).setRoiEnabled(false);
|
||||
((Camtool) camera).resetRoi();
|
||||
} catch (IOException ex) {
|
||||
showException(ex);
|
||||
}
|
||||
@@ -400,7 +399,9 @@ public class ScreenPanel extends Panel {
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
} finally{
|
||||
updateStop();
|
||||
}
|
||||
}
|
||||
|
||||
void manageFit(BufferedImage bi, Data data) {
|
||||
@@ -627,7 +628,7 @@ public class ScreenPanel extends Panel {
|
||||
((Camtool) camera).startPipeline(cameraName, null);
|
||||
updateCamtoolControls();
|
||||
} else {
|
||||
((Camtool) camera).startPipeline(cameraName, null, checkBackground.isSelected(), null, null, null);
|
||||
((Camtool) camera).startPipeline(cameraName, null, checkBackground.isSelected(), null, checkThreshold.isSelected() ? (Double) spinnerThreshold.getValue() : null, null);
|
||||
}
|
||||
spinnerThreshold.setEnabled(true);
|
||||
checkThreshold.setEnabled(true);
|
||||
@@ -867,6 +868,21 @@ public class ScreenPanel extends Panel {
|
||||
}
|
||||
}
|
||||
|
||||
boolean isCameraStopped(){
|
||||
if ((camera!=null) && (camera instanceof Camtool)) {
|
||||
if (!((Camtool) camera).isPipelineStarted()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return ((camera == null) || (camera.isClosed()) || !buttonStop.isEnabled());
|
||||
}
|
||||
|
||||
void updateStop(){
|
||||
buttonStop.setEnabled(comboCameras.getSelectedItem()!=null);
|
||||
buttonStop.setText(isCameraStopped() ? "Start": "Stop");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTimer() {
|
||||
for (Device dev : new Device[]{screen, filter}) {
|
||||
@@ -898,6 +914,7 @@ public class ScreenPanel extends Panel {
|
||||
}
|
||||
updateZoom();
|
||||
updateColormap();
|
||||
updateStop();
|
||||
buttonSave.setSelected(renderer.isSnapshotDialogVisible());
|
||||
checkHistogram.setSelected((histogramDialog != null) && (histogramDialog.isShowing()));
|
||||
}
|
||||
@@ -1456,6 +1473,7 @@ public class ScreenPanel extends Panel {
|
||||
buttonSetup = new javax.swing.JButton();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
buttonConfig = new javax.swing.JButton();
|
||||
buttonStop = new javax.swing.JButton();
|
||||
renderer = new ch.psi.pshell.imaging.Renderer();
|
||||
jPanel4 = new javax.swing.JPanel();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
@@ -1607,6 +1625,13 @@ public class ScreenPanel extends Panel {
|
||||
}
|
||||
});
|
||||
|
||||
buttonStop.setText("Stop");
|
||||
buttonStop.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonStopActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
|
||||
jPanel6.setLayout(jPanel6Layout);
|
||||
jPanel6Layout.setHorizontalGroup(
|
||||
@@ -1615,19 +1640,21 @@ public class ScreenPanel extends Panel {
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(comboCameras, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(comboCameras, 0, 178, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonConfig)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonSetup)
|
||||
.addGap(50, 50, 50)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonStop)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(jLabel2)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(textState, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(textState, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0))
|
||||
);
|
||||
|
||||
jPanel6Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonConfig, buttonSetup});
|
||||
jPanel6Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonConfig, buttonSetup, buttonStop});
|
||||
|
||||
jPanel6Layout.setVerticalGroup(
|
||||
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@@ -1639,7 +1666,8 @@ public class ScreenPanel extends Panel {
|
||||
.addComponent(jLabel2)
|
||||
.addComponent(textState, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(buttonConfig)
|
||||
.addComponent(buttonSetup))
|
||||
.addComponent(buttonSetup)
|
||||
.addComponent(buttonStop))
|
||||
.addGap(0, 0, 0))
|
||||
);
|
||||
|
||||
@@ -2124,6 +2152,7 @@ public class ScreenPanel extends Panel {
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
updateStop();
|
||||
comboCameras.setEnabled(true);
|
||||
buttonCamtool.setEnabled(true);
|
||||
buttonDirect.setEnabled(true);
|
||||
@@ -2458,6 +2487,24 @@ public class ScreenPanel extends Panel {
|
||||
}
|
||||
}//GEN-LAST:event_checkThresholdActionPerformed
|
||||
|
||||
private void buttonStopActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStopActionPerformed
|
||||
try {
|
||||
if (buttonStop.getText().equals("Stop")){
|
||||
if ((camera!=null) && !camera.isClosed()){
|
||||
camera.close();
|
||||
}
|
||||
} else {
|
||||
if (isCameraStopped()){
|
||||
comboCamerasActionPerformed(null);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
} finally {
|
||||
updateStop();
|
||||
}
|
||||
}//GEN-LAST:event_buttonStopActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JRadioButton buttonAutomatic;
|
||||
private javax.swing.JRadioButton buttonCamtool;
|
||||
@@ -2478,6 +2525,7 @@ public class ScreenPanel extends Panel {
|
||||
private javax.swing.JToggleButton buttonReticle;
|
||||
private javax.swing.JToggleButton buttonSave;
|
||||
private javax.swing.JButton buttonSetup;
|
||||
private javax.swing.JButton buttonStop;
|
||||
private javax.swing.JRadioButton buttonTemperature;
|
||||
private javax.swing.JRadioButton buttonZoom025;
|
||||
private javax.swing.JRadioButton buttonZoom05;
|
||||
|
||||
Reference in New Issue
Block a user