Skip to content

Commit

Permalink
Fixed screenshot region lines, single file upload naming.
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanSweet committed May 31, 2016
1 parent 5186d2d commit 53e8d1b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 23 deletions.
40 changes: 19 additions & 21 deletions src/com/esotericsoftware/clippy/Screenshot.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,6 @@ public void keyReleased (KeyEvent e) {
public void windowDeactivated (WindowEvent e) {
dispose();
};

public void windowClosed (WindowEvent e) {
// robot.mouseMove(x, y);
}
});
}

Expand Down Expand Up @@ -282,23 +278,25 @@ else if (y + magY + magD > height) //
g.drawRect(cx + cw + mag * 3, cy, cw + 1, mag + 1);

// Dotted guide lines.
// g.setColor(Color.black);
// g.drawLine(x - crosshair - 1, y, 0, y);
// g.drawLine(x + crosshair + 1, y, width, y);
// g.drawLine(x, y - crosshair - 1, x, 0);
// g.drawLine(x, y + crosshair + 1, x, height);
// g.setColor(Color.white);
// Stroke solid = g.getStroke();
// g.setStroke(dashed);
// g.drawLine(x - crosshair, y, 0, y);
// g.drawLine(x + crosshair, y, width, y);
// g.drawLine(x, y - crosshair, x, 0);
// g.drawLine(x, y + crosshair, x, height);
// g.setXORMode(Color.white);
// g.setColor(Color.black);
// g.fillRect(x - 1, y - crosshair, 3, crosshair * 2 + 1);
// g.fillRect(x - crosshair, y - 1, crosshair - 1, 3);
// g.fillRect(x + 2, y - 1, crosshair - 1, 3);
if (!drag) {
g.setColor(Color.black);
g.drawLine(x - crosshair - 1, y, 0, y);
g.drawLine(x + crosshair + 1, y, width, y);
g.drawLine(x, y - crosshair - 1, x, 0);
g.drawLine(x, y + crosshair + 1, x, height);
g.setColor(Color.white);
Stroke solid = g.getStroke();
g.setStroke(dashed);
g.drawLine(x - crosshair, y, 0, y);
g.drawLine(x + crosshair, y, width, y);
g.drawLine(x, y - crosshair, x, 0);
g.drawLine(x, y + crosshair, x, height);
g.setXORMode(Color.white);
g.setColor(Color.black);
g.fillRect(x - 1, y - crosshair, 3, crosshair * 2 + 1);
g.fillRect(x - crosshair, y - 1, crosshair - 1, 3);
g.fillRect(x + 2, y - 1, crosshair - 1, 3);
}
}
};
frame.setType(Frame.Type.UTILITY);
Expand Down
15 changes: 13 additions & 2 deletions src/com/esotericsoftware/clippy/Upload.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.esotericsoftware.clippy.util.Util;
import com.esotericsoftware.minlog.Log;
import com.esotericsoftware.scar.Scar;
import com.esotericsoftware.scar.Scar.ProgressMonitor;
import com.esotericsoftware.wildcard.Paths;

import retrofit.Callback;
Expand Down Expand Up @@ -271,15 +272,25 @@ public void complete (String url) {
});
}

static public void uploadFile (File file, boolean deleteAfterUpload) {
static public void uploadFile (final File file, final boolean deleteAfterUpload) {
if (clippy.fileUpload == null) return;
clippy.fileUpload.upload(file, deleteAfterUpload, new UploadListener() {

String path;
try {
path = copyFile(file.getAbsolutePath(), Util.nextUploadFile(file.getName()).getAbsolutePath());
} catch (IOException ex) {
if (ERROR) error("Error copying file: " + file.getAbsolutePath(), ex);
return;
}

clippy.fileUpload.upload(new File(path), true, new UploadListener() {
public void complete (String url) {
if (clippy.config.pasteAfterUpload)
clippy.paste(url);
else
clippy.clipboard.setContents(url);
clippy.store(url);
if (deleteAfterUpload) file.delete();
}
});
}
Expand Down

0 comments on commit 53e8d1b

Please sign in to comment.