Skip to content

Commit 327ed28

Browse files
committed
Added Filters and many Blocks
+corrected display renderer +a lot more
1 parent 878e9e8 commit 327ed28

File tree

12 files changed

+1169
-50
lines changed

12 files changed

+1169
-50
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
.bin/*
2-
.cache/thumbnails/*
1+
bin/*
2+
cache/thumbnails/*.jpg
33
*.class
44

55
# Windows image file caches

src/com/inverseinnovations/VisualMALSignatureDesigner/BlockWindow.java

Lines changed: 84 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.awt.Container;
55
import java.awt.Dimension;
66
import java.awt.GridLayout;
7+
import java.awt.Point;
78
import java.awt.event.ActionEvent;
89
import java.awt.event.ActionListener;
910

@@ -20,10 +21,12 @@
2021
import javax.swing.JMenuItem;
2122
import javax.swing.JPanel;
2223
import javax.swing.JScrollPane;
24+
import javax.swing.JTabbedPane;
2325
import javax.swing.ListSelectionModel;
2426
import javax.swing.SwingUtilities;
2527
import javax.swing.WindowConstants;
2628
import com.inverseinnovations.VisualMALSignatureDesigner.BuildingBlock.*;
29+
import com.inverseinnovations.VisualMALSignatureDesigner.BuildingBlock.Filter.*;
2730

2831
public class BlockWindow {
2932
public final Main Main;
@@ -122,7 +125,9 @@ public void actionPerformed(ActionEvent e){
122125

123126
//blockFrame.getContentPane().add(imageLabel, BorderLayout.CENTER);
124127
blockFrame.pack();
125-
blockFrame.setLocationRelativeTo(null);
128+
//blockFrame.setLocationRelativeTo(null);
129+
Point loc = Main.ImageWindow.getLocation();
130+
blockFrame.setLocation((int) loc.getX()-400, (int) loc.getY());
126131
blockFrame.setVisible(true);
127132

128133
}
@@ -136,37 +141,89 @@ public void actionPerformed(ActionEvent e){
136141
public JDialog createBlockSelectionDialog(){
137142
final JDialog d = new JDialog(blockFrame, "Add Block", true);
138143

139-
//show selection panel
140-
String[] types = {"Background","Text","Anime Title","Anime Status"};
141-
final JList<String> list = new JList<String>(types); //data has type Object[]
142-
list.setPrototypeCellValue(" Anime Status ");
143-
list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
144-
list.setLayoutOrientation(JList.HORIZONTAL_WRAP);
145-
list.setVisibleRowCount(-1);
146-
JScrollPane listScroller = new JScrollPane(list);
147-
listScroller.setPreferredSize(new Dimension(250, 80));
148-
listScroller.setAlignmentX(JScrollPane.LEFT_ALIGNMENT);
149-
150-
JPanel listPane = new JPanel();
151-
listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS));
152-
listPane.add(Box.createRigidArea(new Dimension(0,5)));
153-
listPane.add(listScroller);
154-
listPane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
155-
144+
String longestBlockName = " Anime Thumbnail ";
145+
146+
//show block selection panel
147+
String[] blockTypes = {"Background","Text","Image","Anime Thumbnail","Anime Title","Anime Status"};
148+
final JList<String> blockList = new JList<String>(blockTypes); //data has type Object[]
149+
blockList.setPrototypeCellValue(longestBlockName);
150+
blockList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
151+
blockList.setLayoutOrientation(JList.HORIZONTAL_WRAP);
152+
blockList.setVisibleRowCount(-1);
153+
JScrollPane blockListScroller = new JScrollPane(blockList);
154+
blockListScroller.setPreferredSize(new Dimension(250, 80));
155+
blockListScroller.setAlignmentX(JScrollPane.LEFT_ALIGNMENT);
156+
157+
JPanel blockListPane = new JPanel();
158+
blockListPane.setLayout(new BoxLayout(blockListPane, BoxLayout.PAGE_AXIS));
159+
blockListPane.add(Box.createRigidArea(new Dimension(0,5)));
160+
blockListPane.add(blockListScroller);
161+
blockListPane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
162+
163+
//show filter selection panel
164+
String[] filterTypes = {"Rotate"};
165+
final JList<String> filterList = new JList<String>(filterTypes); //data has type Object[]
166+
filterList.setPrototypeCellValue(longestBlockName);
167+
filterList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
168+
filterList.setLayoutOrientation(JList.HORIZONTAL_WRAP);
169+
filterList.setVisibleRowCount(-1);
170+
JScrollPane filterListScroller = new JScrollPane(filterList);
171+
filterListScroller.setPreferredSize(new Dimension(250, 80));
172+
filterListScroller.setAlignmentX(JScrollPane.LEFT_ALIGNMENT);
173+
174+
JPanel filterListPane = new JPanel();
175+
filterListPane.setLayout(new BoxLayout(filterListPane, BoxLayout.PAGE_AXIS));
176+
filterListPane.add(Box.createRigidArea(new Dimension(0,5)));
177+
filterListPane.add(filterListScroller);
178+
filterListPane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
179+
180+
//buttons
156181
JButton okButton = new JButton("OK");
182+
183+
JButton cancelButton = new JButton("Cancel");
184+
cancelButton.addActionListener(new ActionListener(){
185+
public void actionPerformed(ActionEvent e){
186+
d.dispose();
187+
}
188+
});
189+
190+
JPanel buttonPane = new JPanel();
191+
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
192+
buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 3, 3, 3));
193+
buttonPane.add(Box.createHorizontalGlue());
194+
buttonPane.add(okButton);
195+
buttonPane.add(Box.createRigidArea(new Dimension(25, 0)));
196+
buttonPane.add(cancelButton);
197+
buttonPane.add(Box.createHorizontalGlue());
198+
199+
//tabs
200+
final JTabbedPane tabbedPane = new JTabbedPane();
201+
tabbedPane.addTab("Blocks", blockListPane);
202+
tabbedPane.addTab("Filters", filterListPane);
203+
157204
okButton.addActionListener(new ActionListener(){
158205
public void actionPerformed(ActionEvent e){
159-
if(list.getSelectedValue() != null){
206+
JList<String> selectedList;
207+
if(tabbedPane.getSelectedIndex() == 1){selectedList = filterList;}
208+
else{selectedList = blockList;}
209+
if(selectedList.getSelectedValue() != null){
160210
BuildingBlock child = new BuildingBlock("Null", Main);
161-
switch(list.getSelectedValue()){
211+
switch(selectedList.getSelectedValue()){
162212
case "Background":
163213
d.dispose();
164214
child = new AddBackground(Main);
165215
break;
166216
case "Text":
167217
d.dispose();
168218
child = new AddText(Main);
169-
219+
break;
220+
case "Image":
221+
d.dispose();
222+
child = new AddImage(Main);
223+
break;
224+
case "Anime Thumbnail":
225+
d.dispose();
226+
child = new AddThumbnail(Main);
170227
break;
171228
case "Anime Title":
172229
d.dispose();
@@ -176,30 +233,19 @@ public void actionPerformed(ActionEvent e){
176233
d.dispose();
177234
child = new AddStatus(Main);
178235
break;
236+
case "Rotate":
237+
d.dispose();
238+
child = new FilterRotate(Main);
239+
break;
179240
}
180241
blocks.addObject(child);
181242
child.settingsDialog(blockFrame);
182243
}
183244
}
184245
});
185-
JButton cancelButton = new JButton("Cancel");
186-
cancelButton.addActionListener(new ActionListener(){
187-
public void actionPerformed(ActionEvent e){
188-
d.dispose();
189-
}
190-
});
191-
192-
JPanel buttonPane = new JPanel();
193-
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
194-
buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 3, 3, 3));
195-
buttonPane.add(Box.createHorizontalGlue());
196-
buttonPane.add(okButton);
197-
buttonPane.add(Box.createRigidArea(new Dimension(25, 0)));
198-
buttonPane.add(cancelButton);
199-
buttonPane.add(Box.createHorizontalGlue());
200-
246+
//content
201247
Container contentPane = d.getContentPane();
202-
contentPane.add(listPane, BorderLayout.CENTER);
248+
contentPane.add(tabbedPane, BorderLayout.CENTER);
203249
contentPane.add(buttonPane, BorderLayout.PAGE_END);
204250

205251
d.pack();

src/com/inverseinnovations/VisualMALSignatureDesigner/BuildingBlock/AddBackground.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public BufferedImage display(BufferedImage image){
141141
if(getChildCount() > 0){
142142
//send this to each child to rerender(filter)
143143
for(int i = 0; i< getChildCount(); i++){
144-
if(!((BuildingBlock) ((DefaultMutableTreeNode) getChildAt(i)).getUserObject()).ISFILTER){
144+
if(!((BuildingBlock) ((DefaultMutableTreeNode) getChildAt(i)).getUserObject()).isFilter()){
145145
image = Main.sig.filter.composite(image, ((BuildingBlock) ((DefaultMutableTreeNode) getChildAt(i)).getUserObject()).display(image), 0, 0);
146146
}
147147
else{//if filter

0 commit comments

Comments
 (0)