Fix dragging/label updating bug in DisplayManager

secondmonitor
sigonasr2 4 years ago
parent 847df8b091
commit bca52f69a8
  1. 8
      DivaBot/calibration_data.txt
  2. 6
      DivaBot/src/sig/Display.java
  3. 4
      DivaBot/src/sig/DrawCanvas.java
  4. 31
      DivaBot/src/sig/ListTransferHandler.java
  5. 12
      DivaBot/src/sig/MyRobot.java

@ -1,4 +1,4 @@
589
378
1501
888
438
290
1329
787

@ -106,8 +106,10 @@ public class Display {
}
private void AdvanceCycle() {
cycle=(cycle+1)%labels.length;
currentText=interpretLabel(labels[cycle]);
if (labels.length!=0) {
cycle=(cycle+1)%labels.length;
currentText=interpretLabel(labels[cycle]);
}
}
};
t.start();

@ -153,13 +153,13 @@ public class DrawCanvas extends JPanel implements KeyListener,ComponentListener,
if (lastRating<overallrating) {ratingTime=System.currentTimeMillis();}
*/
String text = songname+" / "+((romanizedname.length()>0)?romanizedname:englishname)+" "+(artist.length()>0?"by "+artist:"")+" "+((plays>0)?("Plays - "+(passes)+"/"+(plays)):"")+" "+((plays!=0)?"("+((int)(Math.floor(((float)passes)/plays*100)))+"% pass rate"+((fcCount>0)?" - "+fcCount+" FC"+(fcCount==1?"":"s")+" "+((int)(Math.floor(((float)fcCount)/plays*100)))+"% FC rate":"")+")":"No plays")+" "+((bestPlay!=null)?"Best Play - "+bestPlay.display():"")+" Overall Rating: "+overallrating;
Rectangle2D bounds = TextUtils.calculateStringBoundsFont(text, programFont);
/*Rectangle2D bounds = TextUtils.calculateStringBoundsFont(text, programFont);
if (bounds.getWidth()>1345) {
scrolling=true;
} else {
scrolling=false;
}
scrollX = 0;
scrollX = 0;*/
MyRobot.p.repaint(0,0,MyRobot.p.getWidth(),MyRobot.p.getHeight());
}
}

@ -35,7 +35,7 @@ public class ListTransferHandler extends TransferHandler {
JList list = (JList)c;
start = (DefaultListModel)list.getModel();
indices = list.getSelectedIndices();
System.out.println("Selected indexes: "+Arrays.toString(indices));
//System.out.println("Selected indexes: "+Arrays.toString(indices));
Object[] values = list.getSelectedValues();
@ -48,7 +48,7 @@ public class ListTransferHandler extends TransferHandler {
buff.append("\n");
}
}
System.out.println(buff.toString());
// System.out.println(buff.toString());
return new StringSelection(buff.toString());
}
@ -90,11 +90,11 @@ public class ListTransferHandler extends TransferHandler {
addIndex = index;
addCount = values.length;
//System.out.println(Arrays.toString(values));
//System.out.println(listModel);
for (int i=0;i<values.length;i++) {
listModel.add(listModel.getSize(),values[i]);
}
if (!start.equals(listModel)) {
for (int i=0;i<values.length;i++) {
listModel.add(listModel.getSize(),values[i]);
}
for (int i=0;i<values.length;i++) {
for (int j=0;j<start.getSize();j++) {
if (values[i].equals(start.get(j))) {
@ -104,11 +104,21 @@ public class ListTransferHandler extends TransferHandler {
}
}
}
String[] labels = new String[listModel.getSize()];
for (int i=0;i<listModel.getSize();i++) {
labels[i]=(String)listModel.get(i);
//System.out.println(start);
//System.out.println(listModel);
if (listModel.equals(DisplayManager.model2)) {
String[] labels = new String[listModel.getSize()];
for (int i=0;i<listModel.getSize();i++) {
labels[i]=(String)listModel.get(i);
}
DisplayManager.selectedDisplay.labels=labels;
} else {
String[] labels = new String[start.getSize()];
for (int i=0;i<start.getSize();i++) {
labels[i]=(String)start.get(i);
}
DisplayManager.selectedDisplay.labels=labels;
}
DisplayManager.selectedDisplay.labels=labels;
MyRobot.p.repaint();
//System.out.println("Selected indexes: "+Arrays.toString(indices));
for (int i=0;i<indices.length;i++) {
@ -123,6 +133,7 @@ public class ListTransferHandler extends TransferHandler {
listModel.remove(indices[i]);
}
}
//System.out.println(listModel);
return true;
}

@ -155,6 +155,7 @@ public class MyRobot{
public static boolean DEBUG_MODE=false;
public static ColorPanel CP;
public static DisplayManager DM;
public static boolean FUTURETONE = false;
public static ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
@ -220,6 +221,7 @@ public class MyRobot{
Calibrator c = new Calibrator();
}
} else {
//ImageIO.write(MYROBOT.currentScreen,"png",new File("test.png"));
if (checkSongSelect()) {
if (!overlayHidden) {
overlayHidden=true;
@ -767,7 +769,17 @@ public class MyRobot{
public static boolean checkSongSelect() throws IOException {
Color c = new Color(MYROBOT.createScreenCapture(new Rectangle(845,638,1,1)).getRGB(0, 0));
onSongSelect = c.getRed()==43 && c.getGreen()==88 && c.getBlue()==213;
if (onSongSelect) {
FUTURETONE=false;
} else
if (!onSongSelect&&(c.getRed()>=165&&c.getRed()<=185&&c.getGreen()<=10&&c.getBlue()>=185&&c.getBlue()<=200)) {
FUTURETONE=true;
onSongSelect=true;
}
//System.out.println(onSongSelect+"/"+c);
//777,179 FUTURE TONE
return onSongSelect;
}

Loading…
Cancel
Save