Commit 0ca107a6 authored by ludwig's avatar ludwig
Browse files

-> Fixed a minor gui bug where the Mouse button was selected instead of the...

-> Fixed a minor gui bug where the Mouse button was selected instead of the actually active drawing button

git-svn-id: https://www2.in.tum.de/repos/ttt/trunk@93 0463f305-d864-43cb-8a47-61cf597d4139
parent d6e92dfc
...@@ -279,16 +279,39 @@ public class PaintControls extends GradientPanel { ...@@ -279,16 +279,39 @@ public class PaintControls extends GradientPanel {
ActionListener actionListener = new ActionListener() { ActionListener actionListener = new ActionListener() {
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
//If the mouseButton gets disabled reactivate the last drawing mode
if(mouseButton.isSelected() && event.getSource() != mouseButton){
switch( paintListener.getPaintMode()){
case Constants.AnnotationText:
textButton.setSelected(true);
break;
case Constants.AnnotationHighlight:
highlightButton.setSelected(true);
break;
case Constants.AnnotationFreehand:
freeButton.setSelected(true);
break;
case Constants.AnnotationRectangle:
rectangleButton.setSelected(true);
break;
case Constants.AnnotationLine:
lineButton.setSelected(true);
break;
case Constants.AnnotationDelete:
deleteButton.setSelected(true);
break;
default:
paintListener.setPaintMode(Constants.AnnotationFreehand);
freeButton.setSelected(true);
}
}
// enable/disable painting // enable/disable painting
if (event.getSource() == activateButton){ if (event.getSource() == activateButton){
paintListener.setActivated(activateButton.isSelected()); paintListener.setActivated(activateButton.isSelected());
mouseButton.setSelected(!activateButton.isSelected());
//deselect the Maus button and activate freehand drawing
if(mouseButton.isSelected() && activateButton.isSelected()){
freeButton.setSelected(true);
} else {
mouseButton.setSelected(true);
}
} }
// automatically enable painting // automatically enable painting
...@@ -360,19 +383,23 @@ public class PaintControls extends GradientPanel { ...@@ -360,19 +383,23 @@ public class PaintControls extends GradientPanel {
} }
else if (event.getSource() == deleteAllButton){ else if (event.getSource() == deleteAllButton){
paintListener.setPaintMode(Constants.AnnotationDeleteAll); paintListener.setPaintMode(Constants.AnnotationDeleteAll);
} }
// set color // set color
else if (event.getSource() == colorButtons[0]) else if (event.getSource() == colorButtons[0]){
paintListener.setColor(Annotation.Red); paintListener.setColor(Annotation.Red);
else if (event.getSource() == colorButtons[1]) }
else if (event.getSource() == colorButtons[1]){
paintListener.setColor(Annotation.Blue); paintListener.setColor(Annotation.Blue);
else if (event.getSource() == colorButtons[2]) }
else if (event.getSource() == colorButtons[2]){
paintListener.setColor(Annotation.Green); paintListener.setColor(Annotation.Green);
else if (event.getSource() == colorButtons[3]) }
else if (event.getSource() == colorButtons[3]){
paintListener.setColor(Annotation.Yellow); paintListener.setColor(Annotation.Yellow);
else if (event.getSource() == colorButtons[4]) }
else if (event.getSource() == colorButtons[4]){
paintListener.setColor(Annotation.Black); paintListener.setColor(Annotation.Black);
}
else if (event.getSource() == whiteboardEnable){ else if (event.getSource() == whiteboardEnable){
paintListener.enableWhiteboard(whiteboardEnable.isSelected()); paintListener.enableWhiteboard(whiteboardEnable.isSelected());
......
...@@ -518,6 +518,11 @@ public class PaintListener extends RFBKeyAndMouseListener implements KeyEventDis ...@@ -518,6 +518,11 @@ public class PaintListener extends RFBKeyAndMouseListener implements KeyEventDis
} }
return false; return false;
} }
public int getPaintMode() {
return this.paintMode;
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment