toolstroke: suppress auto budget window when mouse is held down

as soon as mouse is released, show the budget window

git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@648 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
jason@long.name 2013-05-16 23:46:21 +00:00
parent 47fdf7c3c2
commit 09932e0f5d

View file

@ -50,6 +50,7 @@ public class MainWindow extends JFrame
boolean dirty1 = false; //indicates if a tool was successfully applied since last save boolean dirty1 = false; //indicates if a tool was successfully applied since last save
boolean dirty2 = false; //indicates if simulator took a step since last save boolean dirty2 = false; //indicates if simulator took a step since last save
long lastSavedTime = 0; //real-time clock of when file was last saved long lastSavedTime = 0; //real-time clock of when file was last saved
boolean autoBudgetPending;
static ImageIcon appIcon; static ImageIcon appIcon;
static { static {
@ -953,6 +954,11 @@ public class MainWindow extends JFrame
} }
onToolHover(ev); onToolHover(ev);
if (autoBudgetPending) {
autoBudgetPending = false;
showBudgetWindow(true);
}
} }
void previewTool() void previewTool()
@ -1110,7 +1116,7 @@ public class MainWindow extends JFrame
if (!engine.autoBudget && engine.isBudgetTime()) if (!engine.autoBudget && engine.isBudgetTime())
{ {
stopTimer(); //redundant stopTimer(); //redundant
showBudgetWindow(true); showAutoBudget();
return; return;
} }
} }
@ -1305,6 +1311,16 @@ public class MainWindow extends JFrame
graphsPane.setVisible(true); graphsPane.setVisible(true);
} }
private void showAutoBudget()
{
if (toolStroke == null) {
showBudgetWindow(true);
}
else {
autoBudgetPending = true;
}
}
private void showBudgetWindow(boolean isEndOfYear) private void showBudgetWindow(boolean isEndOfYear)
{ {
stopTimer(); stopTimer();