|
|
|
@ -1,22 +1,30 @@ |
|
|
|
|
package sig.windows; |
|
|
|
|
|
|
|
|
|
import java.awt.Color; |
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
import java.awt.GridLayout; |
|
|
|
|
import java.awt.Image; |
|
|
|
|
import java.awt.Rectangle; |
|
|
|
|
import java.awt.geom.Rectangle2D; |
|
|
|
|
import java.io.File; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
import javax.imageio.ImageIO; |
|
|
|
|
import javax.swing.BoxLayout; |
|
|
|
|
import javax.swing.Icon; |
|
|
|
|
import javax.swing.ImageIcon; |
|
|
|
|
import javax.swing.JButton; |
|
|
|
|
import javax.swing.JFrame; |
|
|
|
|
import javax.swing.JLabel; |
|
|
|
|
import javax.swing.JToggleButton; |
|
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
|
|
|
|
|
|
import sig.BackgroundColorButton; |
|
|
|
|
import sig.ColorPanel; |
|
|
|
|
import sig.Module; |
|
|
|
|
import sig.MyPanel; |
|
|
|
|
import sig.sigIRC; |
|
|
|
|
|
|
|
|
@ -27,6 +35,13 @@ public class ProgramWindow extends JFrame{ |
|
|
|
|
List<ModuleButton> buttons = new ArrayList<ModuleButton>(); |
|
|
|
|
|
|
|
|
|
public ProgramWindow() { |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
sigIRC.programIcon = ImageIO.read(new File(sigIRC.BASEDIR+"/sigIRC/sigIRCicon.png")); |
|
|
|
|
} catch (IOException e1) { |
|
|
|
|
e1.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
deselected_icon = new ImageIcon(ImageIO.read(sigIRC.class.getResource("/resource/deselected_button.png"))); |
|
|
|
|
selected_icon = new ImageIcon(ImageIO.read(sigIRC.class.getResource("/resource/selected_button.png"))); |
|
|
|
@ -45,23 +60,57 @@ public class ProgramWindow extends JFrame{ |
|
|
|
|
if (sigIRC.overlayMode && !sigIRC.showWindowControls) { |
|
|
|
|
this.setUndecorated(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sigIRC.panel = new MyPanel(); |
|
|
|
|
|
|
|
|
|
JLabel myLabel = new JLabel("Module Control:"); |
|
|
|
|
if (sigIRC.overlayMode) { |
|
|
|
|
sigIRC.panel.setOpaque(false); |
|
|
|
|
} |
|
|
|
|
sigIRC.panel.setBackground(sigIRC.backgroundcol); |
|
|
|
|
sigIRC.panel.setBackground(Color.BLACK); |
|
|
|
|
myLabel.setBackground(sigIRC.panel.getBackground()); |
|
|
|
|
myLabel.setForeground(Color.WHITE); |
|
|
|
|
myLabel.setIcon(new ImageIcon(sigIRC.programIcon.getScaledInstance(48, 48, Image.SCALE_AREA_AVERAGING))); |
|
|
|
|
|
|
|
|
|
if (!sigIRC.disableChatMessages) { |
|
|
|
|
sigIRC.panel.add(myLabel); |
|
|
|
|
|
|
|
|
|
if (!sigIRC.disableChatMessages) { |
|
|
|
|
ModuleButton button = new ModuleButton("Scrolling Chat"); |
|
|
|
|
sigIRC.panel.add(button); |
|
|
|
|
} |
|
|
|
|
if (sigIRC.chatlogmodule_enabled) { |
|
|
|
|
ModuleButton button = new ModuleButton("Chat Log"); |
|
|
|
|
sigIRC.panel.add(button); |
|
|
|
|
} |
|
|
|
|
if (sigIRC.controllermodule_enabled) { |
|
|
|
|
ModuleButton button = new ModuleButton("Controller"); |
|
|
|
|
sigIRC.panel.add(button); |
|
|
|
|
} |
|
|
|
|
if (sigIRC.twitchmodule_enabled) { |
|
|
|
|
ModuleButton button = new ModuleButton("Twitch"); |
|
|
|
|
sigIRC.panel.add(button); |
|
|
|
|
} |
|
|
|
|
if (sigIRC.rabiracemodule_enabled) { |
|
|
|
|
ModuleButton button = new ModuleButton("Rabi-Race"); |
|
|
|
|
sigIRC.panel.add(button); |
|
|
|
|
sigIRC.panel.add(new ModuleButton("Rabi-Race")); |
|
|
|
|
} |
|
|
|
|
if (sigIRC.touhoumothermodule_enabled) { |
|
|
|
|
ModuleButton button = new ModuleButton("Touhou Mother"); |
|
|
|
|
sigIRC.panel.add(button); |
|
|
|
|
} |
|
|
|
|
GridLayout myLayout = new GridLayout(0,1); |
|
|
|
|
sigIRC.panel.setLayout(myLayout); |
|
|
|
|
|
|
|
|
|
//colorpanel = new ColorPanel();
|
|
|
|
|
//this.add(colorpanel);
|
|
|
|
|
this.setLocationByPlatform(true); |
|
|
|
|
this.add(sigIRC.panel); |
|
|
|
|
this.pack(); |
|
|
|
|
this.setVisible(true); |
|
|
|
|
this.setLocation(sigIRC.windowX, sigIRC.windowY); |
|
|
|
|
this.setSize(sigIRC.windowWidth, sigIRC.windowHeight); |
|
|
|
|
//this.setLocation(sigIRC.windowX, sigIRC.windowY);
|
|
|
|
|
//this.setSize(sigIRC.windowWidth, sigIRC.windowHeight);
|
|
|
|
|
|
|
|
|
|
this.setIconImage(sigIRC.programIcon); |
|
|
|
|
|
|
|
|
@ -72,6 +121,8 @@ public class ProgramWindow extends JFrame{ |
|
|
|
|
} |
|
|
|
|
//this.setOpacity(0.5f);
|
|
|
|
|
this.addWindowListener(sigIRC.panel); |
|
|
|
|
|
|
|
|
|
Module testMod = new Module(new Rectangle(0,0,640,480),"Test"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -82,10 +133,15 @@ class ModuleButton extends JToggleButton { |
|
|
|
|
this.label=label; |
|
|
|
|
this.button=this; |
|
|
|
|
this.setBackground(Color.DARK_GRAY); |
|
|
|
|
button.setForeground(Color.GRAY); |
|
|
|
|
button.setIconTextGap(4); |
|
|
|
|
button.setIcon(IntroDialog.deselected_icon); |
|
|
|
|
button.setSelectedIcon(IntroDialog.selected_icon); |
|
|
|
|
this.setText(label); |
|
|
|
|
this.setToolTipText("Click to enable and disable the \n"+label+" module."); |
|
|
|
|
this.setPreferredSize(new Dimension(160,56)); |
|
|
|
|
this.setForeground(Color.GRAY); |
|
|
|
|
this.setIconTextGap(4); |
|
|
|
|
this.setIcon(ProgramWindow.deselected_icon); |
|
|
|
|
this.setSelectedIcon(ProgramWindow.selected_icon); |
|
|
|
|
this.setSelected(true); |
|
|
|
|
button.setForeground(Color.BLUE); |
|
|
|
|
this.addChangeListener(new ChangeListener() { |
|
|
|
|
@Override |
|
|
|
|
public void stateChanged(ChangeEvent e) { |
|
|
|
|