unfuck code, kill robin, erase evidence

This commit is contained in:
Downforce Agent 2024-07-16 01:22:40 -05:00
parent 13513987c8
commit 785b101245
4 changed files with 40 additions and 38 deletions

View File

@ -45,14 +45,39 @@ public class Clifford implements ActionListener {
private JButton savebtn; private JButton savebtn;
private JButton cancelbtn; private JButton cancelbtn;
Robin invoker; JFrame invoker;
MissPiggy invokerPig;
boolean isPig = false;
Main.Mod mod; Main.Mod mod;
int index; int index;
File directory; File directory;
boolean creating; boolean creating;
public void Action(Robin inv, int modindex) { // Editor public void Action(MissPiggy inv, int modindex) {
invokerPig = inv;
invoker = invokerPig.frame;
mod = Main.Mods.get(modindex);
index = modindex;
creating = false;
isPig = true;
Action(invoker, modindex);
}
public void Action(MissPiggy inv, File dir) {
invokerPig = inv;
invoker = invokerPig.frame;
directory = dir;
creating = true;
isPig = true;
Action(invoker, dir);
}
public void Action(JFrame inv, int modindex) { // Editor
invoker = inv; invoker = inv;
mod = Main.Mods.get(modindex); mod = Main.Mods.get(modindex);
index = modindex; index = modindex;
@ -71,7 +96,7 @@ public class Clifford implements ActionListener {
frame.setResizable(false); frame.setResizable(false);
frame.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); frame.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
frame.setLayout(new GridLayout()); frame.setLayout(new GridLayout());
frame.setLocationRelativeTo(inv.frame); frame.setLocationRelativeTo(inv);
frame.setAlwaysOnTop(true); frame.setAlwaysOnTop(true);
fName.setText(mod.friendlyName); fName.setText(mod.friendlyName);
@ -87,13 +112,13 @@ public class Clifford implements ActionListener {
@Override @Override
public void windowClosing(WindowEvent e) public void windowClosing(WindowEvent e)
{ {
invoker.frame.setEnabled(true); invoker.setEnabled(true);
e.getWindow().dispose(); e.getWindow().dispose();
} }
}); });
} }
public void Action(Robin inv, File dir) { // Generator public void Action(JFrame inv, File dir) { // Generator
invoker = inv; invoker = inv;
directory = dir; directory = dir;
creating = true; creating = true;
@ -116,7 +141,7 @@ public class Clifford implements ActionListener {
@Override @Override
public void windowClosing(WindowEvent e) public void windowClosing(WindowEvent e)
{ {
invoker.frame.setEnabled(true); invoker.setEnabled(true);
e.getWindow().dispose(); e.getWindow().dispose();
} }
}); });
@ -125,7 +150,7 @@ public class Clifford implements ActionListener {
@Override @Override
public void actionPerformed(ActionEvent actionEvent) { public void actionPerformed(ActionEvent actionEvent) {
if (actionEvent.getSource() == cancelbtn) { if (actionEvent.getSource() == cancelbtn) {
invoker.frame.setEnabled(true); invoker.setEnabled(true);
frame.dispose(); frame.dispose();
} else if (actionEvent.getSource() == savebtn && !creating) { } else if (actionEvent.getSource() == savebtn && !creating) {
try { try {
@ -158,8 +183,8 @@ public class Clifford implements ActionListener {
} }
Main.Mods.set(index, mod); Main.Mods.set(index, mod);
invoker.frame.setEnabled(true); invoker.setEnabled(true);
if (invoker instanceof MissPiggy) ((MissPiggy)invoker).InitializeModListInGUI(); if (isPig) {invokerPig.InitializeModListInGUI();}
frame.dispose(); frame.dispose();
} else if (actionEvent.getSource() == savebtn && creating) { } else if (actionEvent.getSource() == savebtn && creating) {
if (fName.getText().isEmpty()) { if (fName.getText().isEmpty()) {
@ -203,7 +228,7 @@ public class Clifford implements ActionListener {
return; return;
} }
JOptionPane.showMessageDialog(frame, "Mod file created", "Success", JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(frame, "Mod file created", "Success", JOptionPane.INFORMATION_MESSAGE);
invoker.frame.setEnabled(true); invoker.setEnabled(true);
frame.dispose(); frame.dispose();
} }
} }

View File

@ -48,7 +48,7 @@ import static java.nio.file.StandardCopyOption.*;
import static javax.swing.WindowConstants.EXIT_ON_CLOSE; import static javax.swing.WindowConstants.EXIT_ON_CLOSE;
public class MissPiggy implements Robin, ActionListener { public class MissPiggy implements ActionListener {
BufferedImage windowIcon; BufferedImage windowIcon;
JFrame frame = new JFrame(); JFrame frame = new JFrame();
JPanel frameContainer; JPanel frameContainer;
@ -107,7 +107,7 @@ public class MissPiggy implements Robin, ActionListener {
toolsMenu.add(new JMenuItem("Edit Metadata")); // disabled if a mod is not selected from the list toolsMenu.add(new JMenuItem("Edit Metadata")); // disabled if a mod is not selected from the list
toolsMenu.add(new JMenuItem("Generate New Mod from Folder...")); toolsMenu.add(new JMenuItem("Generate New Mod from Folder..."));
//toolsMenu.add(new JMenuItem("Create Soundtrack Mod...")); toolsMenu.add(new JMenuItem("Create Soundtrack Mod..."));
//toolsMenu.add(new JMenuItem("Download Mod from URL")); // TODO: implement. move option to File menu. should be ez //toolsMenu.add(new JMenuItem("Download Mod from URL")); // TODO: implement. move option to File menu. should be ez
helpMenu.add(new JMenuItem("Manual")); helpMenu.add(new JMenuItem("Manual"));
@ -136,7 +136,7 @@ public class MissPiggy implements Robin, ActionListener {
fileMenu.getItem(5).addActionListener(this); fileMenu.getItem(5).addActionListener(this);
toolsMenu.getItem(0).addActionListener(this); toolsMenu.getItem(0).addActionListener(this);
toolsMenu.getItem(1).addActionListener(this); toolsMenu.getItem(1).addActionListener(this);
//toolsMenu.getItem(2).addActionListener(this); toolsMenu.getItem(2).addActionListener(this);
helpMenu.getItem(0).addActionListener(this); helpMenu.getItem(0).addActionListener(this);
helpMenu.getItem(2).addActionListener(this); helpMenu.getItem(2).addActionListener(this);
helpMenu.getItem(3).addActionListener(this); helpMenu.getItem(3).addActionListener(this);

View File

@ -1,23 +0,0 @@
/*
* Firestar Mod Manager
* Copyright (C) 2024 bonkmaykr
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
import javax.swing.JFrame;
public interface Robin {
public JFrame frame = new JFrame();
}

View File

@ -47,7 +47,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
public class Suggs implements Robin, ActionListener, ListSelectionListener { public class Suggs implements ActionListener, ListSelectionListener {
public JFrame frame = new JFrame(); public JFrame frame = new JFrame();
private JPanel frameContainer; private JPanel frameContainer;
private JList dSongList; private JList dSongList;
@ -331,7 +331,7 @@ public class Suggs implements Robin, ActionListener, ListSelectionListener {
progressDialog.destroyDialog(); progressDialog.destroyDialog();
frame.dispose(); frame.dispose();
new Clifford().Action(this, new File(System.getProperty("user.home") + "/.firestar/temp/")); new Clifford().Action(frame, new File(System.getProperty("user.home") + "/.firestar/temp/"));
System.out.println("Post Clifford"); System.out.println("Post Clifford");
parent.setEnabled(true); parent.setEnabled(true);
}).start(); }).start();