Attempt to repaint entire windows on resize and window move. Updated
window move detection to use proper window position variables.
This commit is contained in:
parent
2e356bb986
commit
1d1e7b1910
BIN
sigIRCv2.jar
BIN
sigIRCv2.jar
Binary file not shown.
@ -1,9 +1,11 @@
|
|||||||
package sig;
|
package sig;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.awt.Component;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
|
import java.awt.GraphicsEnvironment;
|
||||||
import java.awt.MouseInfo;
|
import java.awt.MouseInfo;
|
||||||
import java.awt.PointerInfo;
|
import java.awt.PointerInfo;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
@ -166,23 +168,17 @@ public class MyPanel extends JPanel implements MouseListener, ActionListener, Mo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentResized(ComponentEvent ev) {
|
public void componentResized(ComponentEvent ev) {
|
||||||
sigIRC.windowX = sigIRC.window.getX();
|
UpdateComponent(ev.getComponent());
|
||||||
sigIRC.windowY = sigIRC.window.getY();
|
|
||||||
sigIRC.windowWidth = sigIRC.window.getWidth();
|
|
||||||
sigIRC.windowHeight = sigIRC.window.getHeight();
|
|
||||||
sigIRC.config.setInteger("windowX", sigIRC.windowX);
|
|
||||||
sigIRC.config.setInteger("windowY", sigIRC.windowY);
|
|
||||||
sigIRC.config.setInteger("windowWidth", sigIRC.windowWidth);
|
|
||||||
sigIRC.config.setInteger("windowHeight", sigIRC.windowHeight);
|
|
||||||
sigIRC.button.x = sigIRC.panel.getX()+sigIRC.panel.getWidth()-96;
|
|
||||||
sigIRC.button.y = 64+sigIRC.rowobj.size()*sigIRC.rowSpacing;
|
|
||||||
sigIRC.config.saveProperties();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentMoved(ComponentEvent ev) {
|
public void componentMoved(ComponentEvent ev) {
|
||||||
sigIRC.windowX = sigIRC.window.getX();
|
UpdateComponent(ev.getComponent());
|
||||||
sigIRC.windowY = sigIRC.window.getY();
|
}
|
||||||
|
|
||||||
|
public static void UpdateComponent(Component com) {
|
||||||
|
sigIRC.windowX = (int)sigIRC.window.getLocationOnScreen().getX();
|
||||||
|
sigIRC.windowY = (int)sigIRC.window.getLocationOnScreen().getY();
|
||||||
sigIRC.windowWidth = sigIRC.window.getWidth();
|
sigIRC.windowWidth = sigIRC.window.getWidth();
|
||||||
sigIRC.windowHeight = sigIRC.window.getHeight();
|
sigIRC.windowHeight = sigIRC.window.getHeight();
|
||||||
sigIRC.config.setInteger("windowX", sigIRC.windowX);
|
sigIRC.config.setInteger("windowX", sigIRC.windowX);
|
||||||
@ -191,6 +187,8 @@ public class MyPanel extends JPanel implements MouseListener, ActionListener, Mo
|
|||||||
sigIRC.config.setInteger("windowHeight", sigIRC.windowHeight);
|
sigIRC.config.setInteger("windowHeight", sigIRC.windowHeight);
|
||||||
sigIRC.button.x = sigIRC.panel.getX()+sigIRC.panel.getWidth()-96;
|
sigIRC.button.x = sigIRC.panel.getX()+sigIRC.panel.getWidth()-96;
|
||||||
sigIRC.button.y = 64+sigIRC.rowobj.size()*sigIRC.rowSpacing;
|
sigIRC.button.y = 64+sigIRC.rowobj.size()*sigIRC.rowSpacing;
|
||||||
|
com.repaint();
|
||||||
|
sigIRC.panel.repaint();
|
||||||
sigIRC.config.saveProperties();
|
sigIRC.config.saveProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -243,19 +243,23 @@ public class ScrollingText {
|
|||||||
sigIRC.emoticon_queue.clear();
|
sigIRC.emoticon_queue.clear();
|
||||||
for (Emoticon e : sigIRC.emoticons) {
|
for (Emoticon e : sigIRC.emoticons) {
|
||||||
//System.out.println("Checking for emoticon "+e.getEmoteName());
|
//System.out.println("Checking for emoticon "+e.getEmoteName());
|
||||||
if (e.getEmoteName().equals(word)) {
|
try {
|
||||||
if (e instanceof SubEmoticon) {
|
if (e.getEmoteName().equals(word)) {
|
||||||
SubEmoticon se = (SubEmoticon)e;
|
if (e instanceof SubEmoticon) {
|
||||||
if (!se.canUserUseEmoticon(username)) {
|
SubEmoticon se = (SubEmoticon)e;
|
||||||
//System.out.println("User "+username+" is not subscribed to "+se.channelName+"'s channel!");
|
if (!se.canUserUseEmoticon(username)) {
|
||||||
break;
|
//System.out.println("User "+username+" is not subscribed to "+se.channelName+"'s channel!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
//System.out.println(" Found one!");
|
||||||
|
basemsg = TextUtils.replaceFirst(basemsg, e.getEmoteName(), e.getSpaceFiller());
|
||||||
|
GenerateEmoticon(marker+1, basemsg, e);
|
||||||
|
space = basemsg.indexOf(" ", marker+1);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
//System.out.println(" Found one!");
|
} catch (NullPointerException ex) {
|
||||||
basemsg = TextUtils.replaceFirst(basemsg, e.getEmoteName(), e.getSpaceFiller());
|
ex.printStackTrace();
|
||||||
GenerateEmoticon(marker+1, basemsg, e);
|
|
||||||
space = basemsg.indexOf(" ", marker+1);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
marker=space;
|
marker=space;
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
package sig;
|
package sig;
|
||||||
|
import java.awt.Component;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
@ -10,12 +11,29 @@ public class UpdateEvent implements ActionListener{
|
|||||||
long lasttime = System.currentTimeMillis();
|
long lasttime = System.currentTimeMillis();
|
||||||
int avgfps = 30;
|
int avgfps = 30;
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
|
int windowUpdateCounter=30;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent ev) {
|
public void actionPerformed(ActionEvent ev) {
|
||||||
if (ev!=null) {
|
if (ev!=null) {
|
||||||
UpdateScrollingText();
|
UpdateScrollingText();
|
||||||
UpdateAuthenticationCountdownMessage();
|
UpdateAuthenticationCountdownMessage();
|
||||||
|
UpdateWindowPosition();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateWindowPosition() {
|
||||||
|
if (windowUpdateCounter--<=0) {
|
||||||
|
if (sigIRC.lastWindowX!=(int)sigIRC.window.getLocationOnScreen().getX() ||
|
||||||
|
sigIRC.lastWindowY!=(int)sigIRC.window.getLocationOnScreen().getY()) {
|
||||||
|
sigIRC.lastWindowX = (int)sigIRC.window.getLocationOnScreen().getX();
|
||||||
|
sigIRC.lastWindowY = (int)sigIRC.window.getLocationOnScreen().getY();
|
||||||
|
//Trigger Window Update.
|
||||||
|
for (Component c : sigIRC.window.getComponents()) {
|
||||||
|
MyPanel.UpdateComponent(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
windowUpdateCounter=30;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,8 +58,8 @@ public class UpdateEvent implements ActionListener{
|
|||||||
} else
|
} else
|
||||||
if (last_autosave>=AUTOSAVETIMER) {
|
if (last_autosave>=AUTOSAVETIMER) {
|
||||||
last_autosave=0;
|
last_autosave=0;
|
||||||
sigIRC.windowX = sigIRC.window.getX();
|
sigIRC.windowX = (int)sigIRC.window.getLocationOnScreen().getX();
|
||||||
sigIRC.windowY = sigIRC.window.getY();
|
sigIRC.windowY = (int)sigIRC.window.getLocationOnScreen().getY();
|
||||||
sigIRC.windowWidth = sigIRC.window.getWidth();
|
sigIRC.windowWidth = sigIRC.window.getWidth();
|
||||||
sigIRC.windowHeight = sigIRC.window.getHeight();
|
sigIRC.windowHeight = sigIRC.window.getHeight();
|
||||||
sigIRC.config.setInteger("windowX", sigIRC.windowX);
|
sigIRC.config.setInteger("windowX", sigIRC.windowX);
|
||||||
|
|||||||
@ -111,6 +111,9 @@ public class sigIRC{
|
|||||||
public static long channel_id = -1;
|
public static long channel_id = -1;
|
||||||
public static int lastSubEmoteUpdate = -1;
|
public static int lastSubEmoteUpdate = -1;
|
||||||
|
|
||||||
|
static int lastWindowX = 0;
|
||||||
|
static int lastWindowY = 0;
|
||||||
|
|
||||||
public static Twitch manager = new Twitch();
|
public static Twitch manager = new Twitch();
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user