auto-clipboard

This commit is contained in:
rusefillc 2025-03-11 18:44:33 -04:00
parent e2320d7bd0
commit 9ee85419e7
1 changed files with 23 additions and 11 deletions

View File

@ -1,5 +1,8 @@
package com.rusefi;
import java.awt.*;
import java.awt.datatransfer.StringSelection;
public class PinLine {
private static final String PREFIX = "";
@ -7,10 +10,10 @@ public class PinLine {
private static final int INDEX_FROM = 49;
private static final int INDEX_TO = 64;
private static final int Y_FROM = 402;
private static final int X_FROM = 216;
private static final int X_TO = 772;
private static final int X_FROM = 360;
private static final int X_TO = 1013;
private static final int Y_FROM = 215;
public static void main(String[] args) {
@ -18,11 +21,12 @@ public class PinLine {
float width = X_TO - X_FROM;
float perPin = width / count;
System.out.println("# auto-generated by PinLine.java from can-log-tools");
System.out.println("# " + INDEX_FROM + " " + INDEX_TO);
System.out.println("# " + X_FROM + " " + X_TO);
System.out.println("# " + Y_FROM);
StringBuffer sb = new StringBuffer();
sb.append("# auto-generated by PinLine.java from can-log-tools\n");
sb.append("# " + INDEX_FROM + " " + INDEX_TO + "\n");
sb.append("# " + X_FROM + " " + X_TO + "\n");
sb.append("# " + Y_FROM + "\n");
for (int i = INDEX_FROM; i <= INDEX_TO; i++) {
@ -30,12 +34,20 @@ public class PinLine {
int x = (int) (X_FROM + zeroIndex * perPin);
System.out.println(" - pin: " + PREFIX + i);
System.out.println(" x: " + x);
System.out.println(" y: " + Y_FROM);
sb.append(" - pin: " + PREFIX + i + "\n");
sb.append(" x: " + x + "\n");
sb.append(" y: " + Y_FROM + "\n");
if (i % 10 == 0)
System.out.println("\n");
}
sb.append("\n");
}
StringSelection selection = new StringSelection(sb.toString());
System.out.println("Setting clipboard content to:\n\n\n\n\n");
System.out.println(sb);
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection);
}
}