aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/connectbot/bean/SelectionArea.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/connectbot/bean/SelectionArea.java')
-rw-r--r--src/org/connectbot/bean/SelectionArea.java71
1 files changed, 41 insertions, 30 deletions
diff --git a/src/org/connectbot/bean/SelectionArea.java b/src/org/connectbot/bean/SelectionArea.java
index 0024494..6175fd0 100644
--- a/src/org/connectbot/bean/SelectionArea.java
+++ b/src/org/connectbot/bean/SelectionArea.java
@@ -69,66 +69,76 @@ public class SelectionArea {
selectingOrigin = false;
}
- public void setTop(int top) {
- this.top = bottom = checkBounds(top, maxRows);
+ public void decrementRow() {
+ if (selectingOrigin)
+ setTop(top - 1);
+ else
+ setBottom(bottom - 1);
}
- public void decrementTop() {
- setTop(--top);
+ public void incrementRow() {
+ if (selectingOrigin)
+ setTop(top + 1);
+ else
+ setBottom(bottom + 1);
}
- public void incrementTop() {
- setTop(++top);
+ public void setRow(int row) {
+ if (selectingOrigin)
+ setTop(row);
+ else
+ setBottom(row);
+ }
+
+ private void setTop(int top) {
+ this.top = bottom = checkBounds(top, maxRows);
}
public int getTop() {
return Math.min(top, bottom);
}
- public void setBottom(int bottom) {
+ private void setBottom(int bottom) {
this.bottom = checkBounds(bottom, maxRows);
}
- public void decrementBottom() {
- setBottom(--bottom);
- }
-
- public void incrementBottom() {
- setBottom(++bottom);
- }
-
public int getBottom() {
return Math.max(top, bottom);
}
- public void setLeft(int left) {
- this.left = right = checkBounds(left, maxColumns);
+ public void decrementColumn() {
+ if (selectingOrigin)
+ setLeft(left - 1);
+ else
+ setRight(right - 1);
}
- public void decrementLeft() {
- setLeft(--left);
+ public void incrementColumn() {
+ if (selectingOrigin)
+ setLeft(left + 1);
+ else
+ setRight(right + 1);
}
- public void incrementLeft() {
- setLeft(++left);
+ public void setColumn(int column) {
+ if (selectingOrigin)
+ setLeft(column);
+ else
+ setRight(column);
+ }
+
+ private void setLeft(int left) {
+ this.left = right = checkBounds(left, maxColumns);
}
public int getLeft() {
return Math.min(left, right);
}
- public void setRight(int right) {
+ private void setRight(int right) {
this.right = checkBounds(right, maxColumns);
}
- public void decrementRight() {
- setRight(--right);
- }
-
- public void incrementRight() {
- setRight(++right);
- }
-
public int getRight() {
return Math.max(left, right);
}
@@ -166,6 +176,7 @@ public class SelectionArea {
return buffer.toString();
}
+ @Override
public String toString() {
StringBuilder buffer = new StringBuilder();