diff --git a/.gitignore b/.gitignore
index ae3c172..983c3ec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,10 @@
-/bin/
+/bin/
+/sigIRC/
+/sigIRC/Emotes/
+/backcolor.png
+/kill.png
+/memory
+/sigIRCv2.conf
+/swap.png
+/update.png
+/WSplits
\ No newline at end of file
diff --git a/projectBuilder.xml b/projectBuilder.xml
index 682fdab..48c0b4c 100644
--- a/projectBuilder.xml
+++ b/projectBuilder.xml
@@ -1,6 +1,19 @@
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sigIRCv2.jar b/sigIRCv2.jar
index ba08ee0..5bb2c62 100644
Binary files a/sigIRCv2.jar and b/sigIRCv2.jar differ
diff --git a/src/sig/BackgroundColorButton.java b/src/sig/BackgroundColorButton.java
index 7f7b9a6..3dbee0b 100644
--- a/src/sig/BackgroundColorButton.java
+++ b/src/sig/BackgroundColorButton.java
@@ -40,7 +40,7 @@ public class BackgroundColorButton {
}
public void onClickEvent(MouseEvent ev) {
- if (buttonEnabled) {
+ if (buttonEnabled && !sigIRC.overlayMode) {
if (ev.getX()>=x && ev.getX()<=x+buttonimg.getWidth() &&
ev.getY()>=y && ev.getY()<=y+buttonimg.getHeight()) {
sigIRC.backgroundcol=sigIRC.colorpanel.getBackgroundColor();
diff --git a/src/sig/ConfigFile.java b/src/sig/ConfigFile.java
index 4ee16e7..5ed04a8 100644
--- a/src/sig/ConfigFile.java
+++ b/src/sig/ConfigFile.java
@@ -56,10 +56,37 @@ public class ConfigFile {
}
}
+ public String getProperty(String key, String def) {
+ String val = properties.getProperty(key);
+ if (val==null) {
+ this.setProperty(key, def);
+ this.saveProperties();
+ return properties.getProperty(key);
+ } else {
+ return val;
+ }
+ }
+
+ public boolean getBoolean(String key, boolean def) {
+ return Boolean.parseBoolean(getProperty(key,Boolean.toString(def)));
+ }
+
+ public int getInteger(String key, int def) {
+ return Integer.parseInt(getProperty(key,Integer.toString(def)));
+ }
+
public void setProperty(String key, String value) {
properties.setProperty(key, value);
}
+ public void setBoolean(String key, boolean value) {
+ properties.setProperty(key, Boolean.toString(value));
+ }
+
+ public void setInteger(String key, int value) {
+ properties.setProperty(key, Integer.toString(value));
+ }
+
public void saveProperties() {
try {
properties.store(GetFileWriter(basepath), "Properties file for sigIRCv2\n");
diff --git a/src/sig/Module.java b/src/sig/Module.java
index 2f3cd51..359daef 100644
--- a/src/sig/Module.java
+++ b/src/sig/Module.java
@@ -5,6 +5,8 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.geom.Rectangle2D;
+import javax.swing.SwingUtilities;
+
public class Module {
protected Rectangle2D bounds;
protected boolean enabled;
@@ -29,7 +31,11 @@ public class Module {
}
public void draw(Graphics g) {
- sigIRC.panel.repaint(bounds.getBounds());
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ sigIRC.panel.repaint(bounds.getBounds());
+ }
+ });
}
public void mouseWheel(MouseWheelEvent ev) {
diff --git a/src/sig/MyPanel.java b/src/sig/MyPanel.java
index 3eec2c9..e1087a0 100644
--- a/src/sig/MyPanel.java
+++ b/src/sig/MyPanel.java
@@ -7,6 +7,8 @@ import java.awt.Graphics;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ComponentListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
@@ -19,16 +21,17 @@ import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
-public class MyPanel extends JPanel implements MouseListener, ActionListener, MouseWheelListener, KeyListener{
+public class MyPanel extends JPanel implements MouseListener, ActionListener, MouseWheelListener, KeyListener, ComponentListener{
//List messages = new ArrayList();
- final public static Font programFont = new Font("Gill Sans Ultra Bold Condensed",0,24);
- final public static Font userFont = new Font("Gill Sans",0,16);
- final public static Font smallFont = new Font("Agency FB Bold",0,12);
+ final public static Font programFont = new Font(sigIRC.messageFont,0,24);
+ final public static Font userFont = new Font(sigIRC.usernameFont,0,16);
+ final public static Font smallFont = new Font(sigIRC.touhoumotherConsoleFont,0,12);
public MyPanel() {
//setBorder(BorderFactory.createLineBorder(Color.black));
addMouseListener(this);
addMouseWheelListener(this);
+ addComponentListener(this);
addKeyListener(this);
setFocusable(true);
}
@@ -58,7 +61,9 @@ public class MyPanel extends JPanel implements MouseListener, ActionListener, Mo
for (Module m : sigIRC.modules) {
m.draw(g);
}
- sigIRC.button.draw(g);
+ if (!sigIRC.overlayMode) {
+ sigIRC.button.draw(g);
+ }
}
public void addMessage(String message) {
@@ -121,4 +126,42 @@ public class MyPanel extends JPanel implements MouseListener, ActionListener, Mo
m.keyreleased(ev);
}
}
+
+ @Override
+ public void componentResized(ComponentEvent ev) {
+ sigIRC.windowX = sigIRC.window.getX();
+ 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
+ public void componentMoved(ComponentEvent ev) {
+ sigIRC.windowX = sigIRC.window.getX();
+ 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
+ public void componentShown(ComponentEvent ev) {
+ }
+
+ @Override
+ public void componentHidden(ComponentEvent ev) {
+ }
}
diff --git a/src/sig/ScrollingText.java b/src/sig/ScrollingText.java
index a0ae4ea..8df7b8e 100644
--- a/src/sig/ScrollingText.java
+++ b/src/sig/ScrollingText.java
@@ -18,6 +18,7 @@ import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;
+import javax.swing.SwingUtilities;
public class ScrollingText {
private String username;
@@ -127,11 +128,15 @@ public class ScrollingText {
public boolean run() {
x-=myRow.getScrollSpd();
//System.out.println("X: "+x);
- sigIRC.panel.repaint(
- FindLeftMostCornerInDisplay(),
- FindTopMostCornerInDisplay()-32,
- (int)Math.max(FindRightMostCornerInDisplay(),(int)TextUtils.calculateStringBoundsFont(username, MyPanel.userFont).getWidth())+4,
- FindBottomMostCornerInDisplay()+(stringHeight*2)+4);
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ sigIRC.panel.repaint(
+ FindLeftMostCornerInDisplay(),
+ FindTopMostCornerInDisplay()-32,
+ (int)Math.max(FindRightMostCornerInDisplay(),(int)TextUtils.calculateStringBoundsFont(username, MyPanel.userFont).getWidth())+4,
+ FindBottomMostCornerInDisplay()+(stringHeight*2)+4);
+ }
+ });
//sigIRC.panel.repaint();
if (x+stringWidth<0) {
isAlive=false;
diff --git a/src/sig/TextRow.java b/src/sig/TextRow.java
index a24b429..35a0592 100644
--- a/src/sig/TextRow.java
+++ b/src/sig/TextRow.java
@@ -42,7 +42,7 @@ public class TextRow {
}
private int DetermineScrollSpd() {
- return maxX/1000+sigIRC.BASESCROLLSPD;
+ return maxX/Math.max(1000,sigIRC.windowWidth)+sigIRC.chatScrollSpd;
}
public static TextRow PickRandomTextRow(String username) {
diff --git a/src/sig/TwitchEmote.java b/src/sig/TwitchEmote.java
index 4d1805d..d55c918 100644
--- a/src/sig/TwitchEmote.java
+++ b/src/sig/TwitchEmote.java
@@ -1,6 +1,8 @@
package sig;
import java.awt.Graphics;
+import javax.swing.SwingUtilities;
+
public class TwitchEmote {
Emoticon emote;
int x=0; //X Offset
@@ -17,11 +19,15 @@ public class TwitchEmote {
public boolean run() {
//this.x-=paint.TEXTSCROLLSPD;
- sigIRC.panel.repaint(
- Math.max(x,0),
- Math.max(y, 0),
- Math.min(sigIRC.panel.getWidth()-x,emote.getImage().getWidth()),
- Math.min(sigIRC.panel.getHeight()-y,emote.getImage().getHeight()));
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ sigIRC.panel.repaint(
+ Math.max(x,0),
+ Math.max(y, 0),
+ Math.min(sigIRC.panel.getWidth()-x,emote.getImage().getWidth()),
+ Math.min(sigIRC.panel.getHeight()-y,emote.getImage().getHeight()));
+ }
+ });
if (x+emote.getImage().getWidth()<0 || text==null || !text.isActive()) {
active=false;
return false;
diff --git a/src/sig/UpdateEvent.java b/src/sig/UpdateEvent.java
index eb23ad0..c3f8dd6 100644
--- a/src/sig/UpdateEvent.java
+++ b/src/sig/UpdateEvent.java
@@ -4,7 +4,12 @@ import java.awt.event.ActionListener;
public class UpdateEvent implements ActionListener{
final static int MSGTIMER = 300;
+ final static int AUTOSAVETIMER = 600;
int last_authentication_msg = MSGTIMER;
+ int last_autosave = AUTOSAVETIMER;
+ long lasttime = System.currentTimeMillis();
+ int avgfps = 30;
+ int counter = 0;
@Override
public void actionPerformed(ActionEvent ev) {
@@ -15,14 +20,51 @@ public class UpdateEvent implements ActionListener{
private void UpdateAuthenticationCountdownMessage() {
if (!sigIRC.authenticated && last_authentication_msg=MSGTIMER) {
last_authentication_msg=0;
sigIRC.panel.addMessage("SYSTEM: Your oauthToken was not successful. Please go to the sigIRC folder and make sure your oauthToken.txt file is correct!!! SwiftRage");
}
+ if (last_autosave=AUTOSAVETIMER) {
+ last_autosave=0;
+ sigIRC.windowX = sigIRC.window.getX();
+ 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.config.saveProperties();
+ }
if (sigIRC.lastPlayedDing>0) {
sigIRC.lastPlayedDing--;
}
+ updateFPSCounter();
+ sigIRC.window.setTitle("sigIRCv2 - "+(avgfps)+" FPS");
+ lasttime=System.currentTimeMillis();
+ }
+
+ public void updateFPSCounter() {
+ if (System.currentTimeMillis()-lasttime>1000/avgfps) {
+ //System.out.println("WARNING! Last update took "+(System.currentTimeMillis()-lasttime)+"ms! Lagging?");
+ if (counter<30) {
+ counter++;
+ } else {
+ counter=0;
+ avgfps--;
+ }
+ } else {
+ if (counter>-30) {
+ counter--;
+ } else {
+ counter=0;
+ avgfps++;
+ }
+ }
}
public void UpdateScrollingText() {
diff --git a/src/sig/sigIRC.java b/src/sig/sigIRC.java
index f92e328..8393dee 100644
--- a/src/sig/sigIRC.java
+++ b/src/sig/sigIRC.java
@@ -12,6 +12,8 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;
import java.io.BufferedReader;
import java.io.BufferedWriter;
@@ -56,6 +58,20 @@ public class sigIRC{
static int dingThreshold;
static Color backgroundcol;
public static BackgroundColorButton button;
+ public static JFrame window;
+ static boolean overlayMode=false;
+ static boolean showWindowControls=false;
+ static int windowX=0;
+ static int windowY=0;
+ static int windowWidth=0;
+ static int windowHeight=0;
+ static int chatRows=3;
+ static int chatScrollSpd=4;
+ static int rowSpacing=64;
+ static String messageFont="Gill Sans Ultra Bold Condensed";
+ static String usernameFont="Gill Sans";
+ static String touhoumotherConsoleFont="Agency FB Bold";
+ static boolean touhoumothermodule_enabled=true;
public static void main(String[] args) {
@@ -64,8 +80,21 @@ public class sigIRC{
server = config.getProperty("server");
nickname = config.getProperty("nickname");
channel = config.getProperty("channel");
+ overlayMode = config.getBoolean("overlayMode", false);
+ showWindowControls = config.getBoolean("showWindowControls", true);
+ windowX = config.getInteger("windowX", 0);
+ windowY = config.getInteger("windowY", 0);
+ windowWidth = config.getInteger("windowWidth", (int)java.awt.Toolkit.getDefaultToolkit().getScreenSize().getWidth());
+ windowHeight = config.getInteger("windowHeight", (int)java.awt.Toolkit.getDefaultToolkit().getScreenSize().getHeight());
+ chatRows = config.getInteger("chatRows", 3);
+ chatScrollSpd = config.getInteger("chatScrollSpd", 4);
+ rowSpacing = config.getInteger("rowSpacing", 64);
dingThreshold = Integer.parseInt(config.getProperty("dingThreshold"));
backgroundcol = new Color(Integer.parseInt(config.getProperty("backgroundColor")));
+ messageFont = config.getProperty("messageFont","Gill Sans Ultra Bold Condensed");
+ usernameFont = config.getProperty("usernameFont","Gill Sans");
+ touhoumotherConsoleFont = config.getProperty("touhoumotherConsoleFont","Agency FB Bold");
+ touhoumothermodule_enabled = config.getBoolean("Module_touhoumother_Enabled",true);
DownloadAllRequiredDependencies();
@@ -76,12 +105,12 @@ public class sigIRC{
WriteBreakToLogFile();
programClock.start();
- InitializeRows(3);
+ InitializeRows(chatRows);
InitializeCustomSounds();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
- createAndShowGUI();
+ window = createAndShowGUI();
InitializeModules();
performTwitchEmoteUpdate();
@@ -117,10 +146,12 @@ public class sigIRC{
}
private static void InitializeModules() {
- modules.add(new TouhouMotherModule(
- new Rectangle(0,panel.getHeight()/2,320,panel.getHeight()/2),
- "Touhou Mother"
- ));
+ if (touhoumothermodule_enabled) {
+ modules.add(new TouhouMotherModule(
+ new Rectangle(0,panel.getHeight()/2,320,panel.getHeight()/2),
+ "Touhou Mother"
+ ));
+ }
}
private static void InitializeCustomSounds() {
@@ -214,7 +245,7 @@ public class sigIRC{
private static void InitializeRows(int rowcount) {
for (int i=0;i