Fix dragging/label updating bug in DisplayManager
This commit is contained in:
parent
847df8b091
commit
bca52f69a8
@ -1,4 +1,4 @@
|
|||||||
589
|
438
|
||||||
378
|
290
|
||||||
1501
|
1329
|
||||||
888
|
787
|
||||||
|
@ -106,9 +106,11 @@ public class Display {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void AdvanceCycle() {
|
private void AdvanceCycle() {
|
||||||
|
if (labels.length!=0) {
|
||||||
cycle=(cycle+1)%labels.length;
|
cycle=(cycle+1)%labels.length;
|
||||||
currentText=interpretLabel(labels[cycle]);
|
currentText=interpretLabel(labels[cycle]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
t.start();
|
t.start();
|
||||||
}
|
}
|
||||||
|
@ -153,13 +153,13 @@ public class DrawCanvas extends JPanel implements KeyListener,ComponentListener,
|
|||||||
if (lastRating<overallrating) {ratingTime=System.currentTimeMillis();}
|
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;
|
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) {
|
if (bounds.getWidth()>1345) {
|
||||||
scrolling=true;
|
scrolling=true;
|
||||||
} else {
|
} else {
|
||||||
scrolling=false;
|
scrolling=false;
|
||||||
}
|
}
|
||||||
scrollX = 0;
|
scrollX = 0;*/
|
||||||
MyRobot.p.repaint(0,0,MyRobot.p.getWidth(),MyRobot.p.getHeight());
|
MyRobot.p.repaint(0,0,MyRobot.p.getWidth(),MyRobot.p.getHeight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class ListTransferHandler extends TransferHandler {
|
|||||||
JList list = (JList)c;
|
JList list = (JList)c;
|
||||||
start = (DefaultListModel)list.getModel();
|
start = (DefaultListModel)list.getModel();
|
||||||
indices = list.getSelectedIndices();
|
indices = list.getSelectedIndices();
|
||||||
System.out.println("Selected indexes: "+Arrays.toString(indices));
|
//System.out.println("Selected indexes: "+Arrays.toString(indices));
|
||||||
|
|
||||||
Object[] values = list.getSelectedValues();
|
Object[] values = list.getSelectedValues();
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ public class ListTransferHandler extends TransferHandler {
|
|||||||
buff.append("\n");
|
buff.append("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println(buff.toString());
|
// System.out.println(buff.toString());
|
||||||
|
|
||||||
return new StringSelection(buff.toString());
|
return new StringSelection(buff.toString());
|
||||||
}
|
}
|
||||||
@ -90,11 +90,11 @@ public class ListTransferHandler extends TransferHandler {
|
|||||||
addIndex = index;
|
addIndex = index;
|
||||||
addCount = values.length;
|
addCount = values.length;
|
||||||
|
|
||||||
//System.out.println(Arrays.toString(values));
|
//System.out.println(listModel);
|
||||||
if (!start.equals(listModel)) {
|
|
||||||
for (int i=0;i<values.length;i++) {
|
for (int i=0;i<values.length;i++) {
|
||||||
listModel.add(listModel.getSize(),values[i]);
|
listModel.add(listModel.getSize(),values[i]);
|
||||||
}
|
}
|
||||||
|
if (!start.equals(listModel)) {
|
||||||
for (int i=0;i<values.length;i++) {
|
for (int i=0;i<values.length;i++) {
|
||||||
for (int j=0;j<start.getSize();j++) {
|
for (int j=0;j<start.getSize();j++) {
|
||||||
if (values[i].equals(start.get(j))) {
|
if (values[i].equals(start.get(j))) {
|
||||||
@ -104,11 +104,21 @@ public class ListTransferHandler extends TransferHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//System.out.println(start);
|
||||||
|
//System.out.println(listModel);
|
||||||
|
if (listModel.equals(DisplayManager.model2)) {
|
||||||
String[] labels = new String[listModel.getSize()];
|
String[] labels = new String[listModel.getSize()];
|
||||||
for (int i=0;i<listModel.getSize();i++) {
|
for (int i=0;i<listModel.getSize();i++) {
|
||||||
labels[i]=(String)listModel.get(i);
|
labels[i]=(String)listModel.get(i);
|
||||||
}
|
}
|
||||||
DisplayManager.selectedDisplay.labels=labels;
|
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;
|
||||||
|
}
|
||||||
MyRobot.p.repaint();
|
MyRobot.p.repaint();
|
||||||
//System.out.println("Selected indexes: "+Arrays.toString(indices));
|
//System.out.println("Selected indexes: "+Arrays.toString(indices));
|
||||||
for (int i=0;i<indices.length;i++) {
|
for (int i=0;i<indices.length;i++) {
|
||||||
@ -123,6 +133,7 @@ public class ListTransferHandler extends TransferHandler {
|
|||||||
listModel.remove(indices[i]);
|
listModel.remove(indices[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//System.out.println(listModel);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,6 +155,7 @@ public class MyRobot{
|
|||||||
public static boolean DEBUG_MODE=false;
|
public static boolean DEBUG_MODE=false;
|
||||||
public static ColorPanel CP;
|
public static ColorPanel CP;
|
||||||
public static DisplayManager DM;
|
public static DisplayManager DM;
|
||||||
|
public static boolean FUTURETONE = false;
|
||||||
|
|
||||||
public static ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
|
public static ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
|
||||||
|
|
||||||
@ -220,6 +221,7 @@ public class MyRobot{
|
|||||||
Calibrator c = new Calibrator();
|
Calibrator c = new Calibrator();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
//ImageIO.write(MYROBOT.currentScreen,"png",new File("test.png"));
|
||||||
if (checkSongSelect()) {
|
if (checkSongSelect()) {
|
||||||
if (!overlayHidden) {
|
if (!overlayHidden) {
|
||||||
overlayHidden=true;
|
overlayHidden=true;
|
||||||
@ -767,7 +769,17 @@ public class MyRobot{
|
|||||||
public static boolean checkSongSelect() throws IOException {
|
public static boolean checkSongSelect() throws IOException {
|
||||||
Color c = new Color(MYROBOT.createScreenCapture(new Rectangle(845,638,1,1)).getRGB(0, 0));
|
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;
|
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);
|
//System.out.println(onSongSelect+"/"+c);
|
||||||
|
|
||||||
|
//777,179 FUTURE TONE
|
||||||
return onSongSelect;
|
return onSongSelect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user