diff --git a/src/main/java/org/wingate/assfxmaker/MainFrame.form b/src/main/java/org/wingate/assfxmaker/MainFrame.form
index 68926e0..dacb249 100644
--- a/src/main/java/org/wingate/assfxmaker/MainFrame.form
+++ b/src/main/java/org/wingate/assfxmaker/MainFrame.form
@@ -64,7 +64,7 @@
-
+
@@ -239,10 +239,10 @@
-
+
-
+
@@ -251,63 +251,112 @@
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -324,12 +373,12 @@
-
+
-
+
diff --git a/src/main/java/org/wingate/assfxmaker/MainFrame.java b/src/main/java/org/wingate/assfxmaker/MainFrame.java
index 89f4f5d..5305bce 100644
--- a/src/main/java/org/wingate/assfxmaker/MainFrame.java
+++ b/src/main/java/org/wingate/assfxmaker/MainFrame.java
@@ -17,11 +17,13 @@
package org.wingate.assfxmaker;
import java.io.File;
+import javax.swing.DefaultListModel;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;
import org.wingate.assfxmaker.ass.ASS;
-import org.wingate.assfxmaker.ass.AssEvent;
+import org.wingate.assfxmaker.sfx.AfmLegacy;
import org.wingate.assfxmaker.ui.AssSfxTableModel;
+import org.wingate.assfxmaker.ui.SfxListCellRenderer;
/**
*
@@ -35,6 +37,9 @@ public class MainFrame extends javax.swing.JFrame {
private final AssSfxTableModel orginModel = new AssSfxTableModel();
private final AssSfxTableModel generatedModel = new AssSfxTableModel();
+
+ private final DefaultListModel dlmSFX = new DefaultListModel();
+ private final SfxListCellRenderer sfxTreeCellRenderer = new SfxListCellRenderer();
/**
* Creates new form MainFrame
@@ -73,9 +78,11 @@ public boolean accept(File file) {
public String getDescription() {
return "ASS files";
}
-
});
+ mf.listSFXChoice.setModel(mf.dlmSFX);
+ mf.listSFXChoice.setCellRenderer(mf.sfxTreeCellRenderer);
+
//- INIT END -
mf.setVisible(true);
@@ -122,10 +129,14 @@ private void initComponents() {
panResult = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
tblGenerated = new javax.swing.JTable();
- panBottom = new javax.swing.JPanel();
- jTabbedPane2 = new javax.swing.JTabbedPane();
- jPanel1 = new javax.swing.JPanel();
- jPanel2 = new javax.swing.JPanel();
+ panSFX = new javax.swing.JPanel();
+ panSFXTree = new javax.swing.JPanel();
+ btnUseChosenSFX = new javax.swing.JButton();
+ btnCreatePreset = new javax.swing.JButton();
+ btnCreateCode = new javax.swing.JButton();
+ jScrollPane4 = new javax.swing.JScrollPane();
+ listSFXChoice = new javax.swing.JList<>();
+ panSFXCreator = new javax.swing.JPanel();
panDrawing = new javax.swing.JPanel();
jMenuBar1 = new javax.swing.JMenuBar();
mnuFile = new javax.swing.JMenu();
@@ -133,7 +144,6 @@ private void initComponents() {
mnuFileSave = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
- getContentPane().setLayout(new java.awt.BorderLayout());
panKaraoke.setLayout(new java.awt.BorderLayout());
@@ -225,38 +235,77 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
panKaraoke.add(panTop, java.awt.BorderLayout.CENTER);
- panBottom.setPreferredSize(new java.awt.Dimension(883, 400));
- panBottom.setLayout(new java.awt.BorderLayout());
+ panSFX.setPreferredSize(new java.awt.Dimension(0, 200));
+ panSFX.setLayout(new java.awt.GridLayout(1, 2));
+
+ btnUseChosenSFX.setText("Use -->");
+
+ btnCreatePreset.setText("Create a preset");
+ btnCreatePreset.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCreatePresetActionPerformed(evt);
+ }
+ });
- javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
- jPanel1.setLayout(jPanel1Layout);
- jPanel1Layout.setHorizontalGroup(
- jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 0, Short.MAX_VALUE)
+ btnCreateCode.setText("Create with code");
+ btnCreateCode.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCreateCodeActionPerformed(evt);
+ }
+ });
+
+ listSFXChoice.setModel(new javax.swing.AbstractListModel() {
+ String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
+ public int getSize() { return strings.length; }
+ public String getElementAt(int i) { return strings[i]; }
+ });
+ jScrollPane4.setViewportView(listSFXChoice);
+
+ javax.swing.GroupLayout panSFXTreeLayout = new javax.swing.GroupLayout(panSFXTree);
+ panSFXTree.setLayout(panSFXTreeLayout);
+ panSFXTreeLayout.setHorizontalGroup(
+ panSFXTreeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(panSFXTreeLayout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(panSFXTreeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane4)
+ .addGroup(panSFXTreeLayout.createSequentialGroup()
+ .addComponent(btnCreatePreset)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnCreateCode)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 93, Short.MAX_VALUE)
+ .addComponent(btnUseChosenSFX)))
+ .addContainerGap())
);
- jPanel1Layout.setVerticalGroup(
- jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 0, Short.MAX_VALUE)
+ panSFXTreeLayout.setVerticalGroup(
+ panSFXTreeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panSFXTreeLayout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(panSFXTreeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnUseChosenSFX)
+ .addComponent(btnCreatePreset)
+ .addComponent(btnCreateCode))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE)
+ .addContainerGap())
);
- jTabbedPane2.addTab("Effects", jPanel1);
+ panSFX.add(panSFXTree);
- javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
- jPanel2.setLayout(jPanel2Layout);
- jPanel2Layout.setHorizontalGroup(
- jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 0, Short.MAX_VALUE)
+ javax.swing.GroupLayout panSFXCreatorLayout = new javax.swing.GroupLayout(panSFXCreator);
+ panSFXCreator.setLayout(panSFXCreatorLayout);
+ panSFXCreatorLayout.setHorizontalGroup(
+ panSFXCreatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 410, Short.MAX_VALUE)
);
- jPanel2Layout.setVerticalGroup(
- jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 0, Short.MAX_VALUE)
+ panSFXCreatorLayout.setVerticalGroup(
+ panSFXCreatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 200, Short.MAX_VALUE)
);
- jTabbedPane2.addTab("Code", jPanel2);
+ panSFX.add(panSFXCreator);
- panBottom.add(jTabbedPane2, java.awt.BorderLayout.CENTER);
-
- panKaraoke.add(panBottom, java.awt.BorderLayout.SOUTH);
+ panKaraoke.add(panSFX, java.awt.BorderLayout.SOUTH);
jTabbedPane1.addTab("Karaoke", panKaraoke);
@@ -264,11 +313,11 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
panDrawing.setLayout(panDrawingLayout);
panDrawingLayout.setHorizontalGroup(
panDrawingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 904, Short.MAX_VALUE)
+ .addGap(0, 821, Short.MAX_VALUE)
);
panDrawingLayout.setVerticalGroup(
panDrawingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 555, Short.MAX_VALUE)
+ .addGap(0, 547, Short.MAX_VALUE)
);
jTabbedPane1.addTab("Drawing", panDrawing);
@@ -340,6 +389,14 @@ private void mnuFileSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F
}
}//GEN-LAST:event_mnuFileSaveActionPerformed
+ private void btnCreatePresetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCreatePresetActionPerformed
+ dlmSFX.addElement(new AfmLegacy(AfmLegacy.Type.AFM, "Rouge", "Me", "v1.0", "Fade out"));
+ }//GEN-LAST:event_btnCreatePresetActionPerformed
+
+ private void btnCreateCodeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCreateCodeActionPerformed
+ dlmSFX.addElement(new AfmLegacy(AfmLegacy.Type.JavaScript, "RougeJS", "Me", "v2.0", "Fade in"));
+ }//GEN-LAST:event_btnCreateCodeActionPerformed
+
/**
* @param args the command line arguments
*/
@@ -369,23 +426,27 @@ public static void main(String args[]) {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup bgTextMode;
+ private javax.swing.JButton btnCreateCode;
+ private javax.swing.JButton btnCreatePreset;
+ private javax.swing.JButton btnUseChosenSFX;
private javax.swing.JFileChooser fcASS;
private javax.swing.JMenuBar jMenuBar1;
- private javax.swing.JPanel jPanel1;
- private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
+ private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JTabbedPane jTabbedPane1;
- private javax.swing.JTabbedPane jTabbedPane2;
private javax.swing.JToolBar jToolBar1;
+ private javax.swing.JList listSFXChoice;
private javax.swing.JMenu mnuFile;
private javax.swing.JMenuItem mnuFileOpen;
private javax.swing.JMenuItem mnuFileSave;
- private javax.swing.JPanel panBottom;
private javax.swing.JPanel panDrawing;
private javax.swing.JPanel panKaraoke;
private javax.swing.JPanel panOriginal;
private javax.swing.JPanel panResult;
+ private javax.swing.JPanel panSFX;
+ private javax.swing.JPanel panSFXCreator;
+ private javax.swing.JPanel panSFXTree;
private javax.swing.JPanel panTop;
private javax.swing.JTable tblGenerated;
private javax.swing.JTable tblOrigin;
diff --git a/src/main/java/org/wingate/assfxmaker/sfx/AfmLegacy.java b/src/main/java/org/wingate/assfxmaker/sfx/AfmLegacy.java
new file mode 100644
index 0000000..c29d6e5
--- /dev/null
+++ b/src/main/java/org/wingate/assfxmaker/sfx/AfmLegacy.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2021 util2
+ *
+ * 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 .
+ */
+package org.wingate.assfxmaker.sfx;
+
+/**
+ *
+ * @author util2
+ */
+public class AfmLegacy {
+
+ public enum Type {
+ AFM("AFMO"),
+ Ruby("Ruby"),
+ Python("Python"),
+ JavaScript("JS"),
+ Lua("Lua");
+
+ String sfxType;
+
+ private Type(String sfxType){
+ this.sfxType = sfxType;
+ }
+
+ public String getSfxType() {
+ return sfxType;
+ }
+
+ @Override
+ public String toString() {
+ return sfxType;
+ }
+
+ public static Type get(String s){
+ Type sfx = AFM;
+
+ for(Type type : values()){
+ if(type.getSfxType().equalsIgnoreCase(s) == true){
+ sfx = type;
+ break;
+ }
+ }
+
+ return sfx;
+ }
+ }
+
+ private Type type = Type.AFM;
+ private String code = "";
+ private String name = "Unknown effect";
+ private String author = "Unknown author";
+ private String version = "v1.0";
+ private String description = "No description";
+
+ public AfmLegacy() {
+ }
+
+ public AfmLegacy(Type type, String code, String name, String author, String version, String description) {
+ this.type = type;
+ this.code = code;
+ this.name = name;
+ this.author = author;
+ this.version = version;
+ this.description = description;
+ }
+
+ public AfmLegacy(Type type, String name, String author, String version, String description) {
+ this.type = type;
+ this.name = name;
+ this.author = author;
+ this.version = version;
+ this.description = description;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ public void setType(Type type) {
+ this.type = type;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getAuthor() {
+ return author;
+ }
+
+ public void setAuthor(String author) {
+ this.author = author;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+
+}
diff --git a/src/main/java/org/wingate/assfxmaker/ui/SfxListCellRenderer.java b/src/main/java/org/wingate/assfxmaker/ui/SfxListCellRenderer.java
new file mode 100644
index 0000000..fb50c09
--- /dev/null
+++ b/src/main/java/org/wingate/assfxmaker/ui/SfxListCellRenderer.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2021 util2
+ *
+ * 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 .
+ */
+package org.wingate.assfxmaker.ui;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Font;
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.ListCellRenderer;
+import org.wingate.assfxmaker.sfx.AfmLegacy;
+
+/**
+ *
+ * @author util2
+ */
+public class SfxListCellRenderer extends JPanel implements ListCellRenderer {
+
+ private static final int ICON_WIDTH = 30;
+ private static final int ITEM_WIDTH = 150;
+ private static final int DESC_WIDTH = 350;
+ private static final int WHOLE_HEIGHT = 30;
+
+ private final ImageIcon afmIcon = new ImageIcon(getClass().getResource("/images/xml-icon-small.png"));
+ private final ImageIcon rubyIcon = new ImageIcon(getClass().getResource("/images/rb-icon-small.png"));
+ private final ImageIcon pythonIcon = new ImageIcon(getClass().getResource("/images/py-icon-small.png"));
+ private final ImageIcon javascriptIcon = new ImageIcon(getClass().getResource("/images/js-icon-small.png"));
+ private final ImageIcon luaIcon = new ImageIcon(getClass().getResource("/images/lua-icon-small.png"));
+
+ private final JLabel lblImage = new JLabel();
+ private final JLabel lblName = new JLabel();
+ private final JLabel lblAuthor = new JLabel();
+ private final JLabel lblVersion = new JLabel();
+ private final JLabel lblDescription = new JLabel();
+
+ public SfxListCellRenderer() {
+ init();
+ }
+
+ private void init(){
+ setLayout(null);
+ setPreferredSize(new Dimension(ICON_WIDTH + ITEM_WIDTH + DESC_WIDTH, WHOLE_HEIGHT));
+
+ lblImage.setSize(ICON_WIDTH, WHOLE_HEIGHT);
+ lblImage.setLocation(0, 0);
+ add(lblImage);
+
+ lblName.setSize(ITEM_WIDTH, WHOLE_HEIGHT / 2);
+ lblName.setLocation(ICON_WIDTH, 0);
+ add(lblName);
+
+ lblAuthor.setSize(ICON_WIDTH, WHOLE_HEIGHT / 2);
+ lblAuthor.setLocation(ICON_WIDTH, WHOLE_HEIGHT / 2);
+ lblAuthor.setFont(lblAuthor.getFont().deriveFont(Font.ITALIC));
+ add(lblAuthor);
+
+ lblVersion.setSize(DESC_WIDTH, WHOLE_HEIGHT / 2);
+ lblVersion.setLocation(ICON_WIDTH + ITEM_WIDTH, 0);
+ add(lblVersion);
+
+ lblDescription.setSize(DESC_WIDTH, WHOLE_HEIGHT / 2);
+ lblDescription.setLocation(ICON_WIDTH + ITEM_WIDTH, WHOLE_HEIGHT / 2);
+ lblDescription.setFont(lblDescription.getFont().deriveFont(Font.ITALIC));
+ add(lblDescription);
+ }
+
+ @Override
+ public Component getListCellRendererComponent(JList list, Object o,
+ int index, boolean isSelected, boolean cellHasFocus)
+ {
+ if(o instanceof AfmLegacy){
+ AfmLegacy sfx = (AfmLegacy)o;
+
+ lblName.setText(sfx.getName());
+ lblAuthor.setText(sfx.getAuthor());
+ lblVersion.setText(sfx.getVersion());
+ lblDescription.setText(sfx.getDescription());
+
+ switch(sfx.getType()){
+ case AFM -> {
+ lblImage.setIcon(afmIcon);
+ lblName.setForeground(Color.magenta.darker());
+ }
+ case Ruby -> {
+ lblImage.setIcon(rubyIcon);
+ lblName.setForeground(Color.red.darker());
+ }
+ case Python -> {
+ lblImage.setIcon(pythonIcon);
+ lblName.setForeground(Color.green.darker());
+ }
+ case JavaScript -> {
+ lblImage.setIcon(javascriptIcon);
+ lblName.setForeground(Color.yellow);
+ }
+ case Lua -> {
+ lblImage.setIcon(luaIcon);
+ lblName.setForeground(Color.blue.darker());
+ }
+ }
+
+ if(isSelected == true){
+ setBackground(list.getSelectionBackground());
+ setForeground(list.getSelectionForeground());
+ }else{
+ setBackground(list.getBackground());
+ setForeground(list.getForeground());
+ }
+ }
+
+ return this;
+ }
+
+}
diff --git a/src/main/resources/images/js-icon-small.png b/src/main/resources/images/js-icon-small.png
new file mode 100644
index 0000000..3dedf7d
Binary files /dev/null and b/src/main/resources/images/js-icon-small.png differ
diff --git a/src/main/resources/images/lua-icon-small.png b/src/main/resources/images/lua-icon-small.png
new file mode 100644
index 0000000..c5e7461
Binary files /dev/null and b/src/main/resources/images/lua-icon-small.png differ
diff --git a/src/main/resources/images/py-icon-small.png b/src/main/resources/images/py-icon-small.png
new file mode 100644
index 0000000..9202698
Binary files /dev/null and b/src/main/resources/images/py-icon-small.png differ
diff --git a/src/main/resources/images/rb-icon-small.png b/src/main/resources/images/rb-icon-small.png
new file mode 100644
index 0000000..f0e3d93
Binary files /dev/null and b/src/main/resources/images/rb-icon-small.png differ
diff --git a/src/main/resources/images/xml-icon-small.png b/src/main/resources/images/xml-icon-small.png
new file mode 100644
index 0000000..7892ea9
Binary files /dev/null and b/src/main/resources/images/xml-icon-small.png differ