Skip to content

Commit

Permalink
Last minute fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LogisimIt committed May 8, 2018
1 parent 4194117 commit 226e7a2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
Binary file modified Compiled/Logisim-ITA.exe
Binary file not shown.
Binary file modified Compiled/Logisim-ITA.jar
Binary file not shown.
35 changes: 30 additions & 5 deletions Logisim-Fork/com/cburch/logisim/gui/main/Canvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,12 @@ public void mouseMoved(MouseEvent e) {
public void mousePressed(MouseEvent e) {
viewport.setErrorMessage(null, null);
if (proj.isStartupScreen()) {
Bounds bounds = proj.getCurrentCircuit().getBounds(getGraphics());
Graphics g = getGraphics();
Bounds bounds;
if (g != null)
bounds = proj.getCurrentCircuit().getBounds(getGraphics());
else
bounds = proj.getCurrentCircuit().getBounds();
// set the project as dirty only if it contains something
if (bounds.getHeight() != 0 || bounds.getWidth() != 0)
proj.setStartupScreen(false);
Expand Down Expand Up @@ -787,7 +792,12 @@ public Canvas(Project proj) {
}

public void autoZoomCenter() {
Bounds bounds = proj.getCurrentCircuit().getBounds(getGraphics());
Graphics g = getGraphics();
Bounds bounds;
if (g != null)
bounds = proj.getCurrentCircuit().getBounds(getGraphics());
else
bounds = proj.getCurrentCircuit().getBounds();
if (bounds.getHeight() == 0 || bounds.getWidth() == 0) {
setScrollBar(0, 0);
return;
Expand Down Expand Up @@ -829,7 +839,12 @@ private void completeAction() {
}

public void computeSize(boolean immediate) {
Bounds bounds = proj.getCurrentCircuit().getBounds(getGraphics());
Graphics g = getGraphics();
Bounds bounds;
if (g != null)
bounds = proj.getCurrentCircuit().getBounds(getGraphics());
else
bounds = proj.getCurrentCircuit().getBounds();
int height = 0, width = 0;
if (bounds != null && viewport != null) {
width = bounds.getX() + bounds.getWidth() + viewport.getWidth();
Expand Down Expand Up @@ -1091,7 +1106,12 @@ private void repairMouseEvent(MouseEvent e) {
}

public void setArrows() {
Bounds circBds = proj.getCurrentCircuit().getBounds(getGraphics());
Graphics g = getGraphics();
Bounds circBds;
if (g != null)
circBds = proj.getCurrentCircuit().getBounds(getGraphics());
else
circBds = proj.getCurrentCircuit().getBounds();
// no circuit
if (circBds == null || circBds.getHeight() == 0 || circBds.getWidth() == 0)
return;
Expand All @@ -1110,7 +1130,12 @@ public void setArrows(int x0, int y0, int x1, int y1) {
if (canvasPane != null) {
viewableBase = canvasPane.getViewport().getViewRect();
} else {
Bounds bds = proj.getCurrentCircuit().getBounds(getGraphics());
Graphics g = getGraphics();
Bounds bds;
if (g != null)
bds = proj.getCurrentCircuit().getBounds(getGraphics());
else
bds = proj.getCurrentCircuit().getBounds();
viewableBase = new Rectangle(0, 0, bds.getWidth(), bds.getHeight());
}
double zoom = getZoomFactor();
Expand Down

0 comments on commit 226e7a2

Please sign in to comment.