Skip to content

Commit

Permalink
Added clear button
Browse files Browse the repository at this point in the history
  • Loading branch information
maccasoft committed Jul 12, 2023
1 parent 03b1ea3 commit 7fb6bdc
Showing 1 changed file with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public class SerialTerminal {
Button rts;
Button cts;

Button clear;
Button monitor;
Button taqoz;

Expand Down Expand Up @@ -1365,9 +1366,29 @@ public void widgetSelected(SelectionEvent e) {
FontMetrics fontMetrics = gc.getFontMetrics();
gc.dispose();

clear = new Button(container, SWT.PUSH);
clear.setText("Clear");
GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
data.widthHint = Math.max(Dialog.convertHorizontalDLUsToPixels(fontMetrics,
IDialogConstants.BUTTON_WIDTH),
clear.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
clear.setLayoutData(data);
clear.addSelectionListener(new SelectionAdapter() {

@Override
public void widgetSelected(SelectionEvent e) {
try {
clear();
} catch (Exception ex) {
ex.printStackTrace();
}
setFocus();
}
});

monitor = new Button(container, SWT.PUSH);
monitor.setText("Monitor");
GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
data.widthHint = Math.max(Dialog.convertHorizontalDLUsToPixels(fontMetrics,
IDialogConstants.BUTTON_WIDTH),
monitor.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
Expand Down Expand Up @@ -1518,6 +1539,7 @@ void updateButtonsEnablement() {
rts.setEnabled(serialPort != null);
cts.setEnabled(serialPort != null);

clear.setEnabled(serialPort != null);
monitor.setEnabled(serialPort != null);
taqoz.setEnabled(serialPort != null);
}
Expand Down Expand Up @@ -1712,6 +1734,8 @@ else if ("light".equals(id)) {
//cts.setBackground(widgetBackground);
cts.setForeground(widgetForeground);

clear.setBackground(widgetBackground);
clear.setForeground(widgetForeground);
monitor.setBackground(widgetBackground);
monitor.setForeground(widgetForeground);
taqoz.setBackground(widgetBackground);
Expand Down

0 comments on commit 7fb6bdc

Please sign in to comment.