Skip to content

Commit 207148f

Browse files
committed
Altered Block selection box
+Added Block AddTime +Added Filters BlureSimple, Chrome, Emboss, GlowInner, Opacity, ShadowSimple, Smear, Solarize, Sparkle, Sphere, and Unsharp
1 parent 2c3e31d commit 207148f

17 files changed

+1277
-99
lines changed

src/com/inverseinnovations/VisualMALSignatureDesigner/BlockWindow.java

Lines changed: 34 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,22 @@ public void actionPerformed(ActionEvent e){
142142
public JDialog createBlockSelectionDialog(){
143143
final JDialog d = new JDialog(blockFrame, "Add Block", true);
144144

145-
String longestBlockName = " Anime Thumbnail ";
145+
//which has the logest name...?
146+
BuildingBlock longestBlock = new AddThumbnail(Main);
146147

147148
//show block selection panel
148-
String[] blockTypes = {"Background","Text","Anime Title","Anime Status","Anime Episodes","Image","Anime Thumbnail"};
149-
final JList<String> blockList = new JList<String>(blockTypes); //data has type Object[]
150-
blockList.setPrototypeCellValue(longestBlockName);
149+
BuildingBlock[] blockTypes = {
150+
new AddBackground(Main),
151+
new AddText(Main),
152+
new AddTitle(Main),
153+
new AddStatus(Main),
154+
new AddEpisodes(Main),
155+
new AddTime(Main),
156+
new AddImage(Main),
157+
new AddThumbnail(Main)
158+
};
159+
final JList<BuildingBlock> blockList = new JList<BuildingBlock>(blockTypes); //data has type Object[]
160+
blockList.setPrototypeCellValue(longestBlock);
151161
blockList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
152162
blockList.setLayoutOrientation(JList.HORIZONTAL_WRAP);
153163
blockList.setVisibleRowCount(-1);
@@ -162,9 +172,23 @@ public JDialog createBlockSelectionDialog(){
162172
blockListPane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
163173

164174
//show filter selection panel
165-
String[] filterTypes = {"Perspective","Rotate","Unsharp"};
166-
final JList<String> filterList = new JList<String>(filterTypes); //data has type Object[]
167-
filterList.setPrototypeCellValue(longestBlockName);
175+
BuildingBlock[] filterTypes = {
176+
new FilterBlurSimple(Main),
177+
new FilterChrome(Main),
178+
new FilterEmboss(Main),
179+
new FilterGlowInner(Main),
180+
new FilterOpacity(Main),
181+
new FilterPerspective(Main),
182+
new FilterRotate(Main),
183+
new FilterShadowSimple(Main),
184+
new FilterSmear(Main),
185+
new FilterSolarize(Main),
186+
new FilterSparkle(Main),
187+
new FilterSphere(Main),
188+
new FilterUnsharp(Main)
189+
};
190+
final JList<BuildingBlock> filterList = new JList<BuildingBlock>(filterTypes); //data has type Object[]
191+
filterList.setPrototypeCellValue(longestBlock);
168192
filterList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
169193
filterList.setLayoutOrientation(JList.HORIZONTAL_WRAP);
170194
filterList.setVisibleRowCount(-1);
@@ -204,55 +228,13 @@ public void actionPerformed(ActionEvent e){
204228

205229
okButton.addActionListener(new ActionListener(){
206230
public void actionPerformed(ActionEvent e){
207-
JList<String> selectedList;
231+
JList<BuildingBlock> selectedList;
208232
if(tabbedPane.getSelectedIndex() == 1){selectedList = filterList;}
209233
else{selectedList = blockList;}
210234
if(selectedList.getSelectedValue() != null){
211-
BuildingBlock child = new BuildingBlock("Null", Main);
212-
switch(selectedList.getSelectedValue()){
213-
case "Background":
214-
d.dispose();
215-
child = new AddBackground(Main);
216-
break;
217-
case "Text":
218-
d.dispose();
219-
child = new AddText(Main);
220-
break;
221-
case "Image":
222-
d.dispose();
223-
child = new AddImage(Main);
224-
break;
225-
case "Anime Thumbnail":
226-
d.dispose();
227-
child = new AddThumbnail(Main);
228-
break;
229-
case "Anime Title":
230-
d.dispose();
231-
child = new AddTitle(Main);
232-
break;
233-
case "Anime Status":
234-
d.dispose();
235-
child = new AddStatus(Main);
236-
break;
237-
case "Anime Episodes":
238-
d.dispose();
239-
child = new AddEpisodes(Main);
240-
break;
241-
case "Perspective":
242-
d.dispose();
243-
child = new FilterPerspective(Main);
244-
break;
245-
case "Rotate":
246-
d.dispose();
247-
child = new FilterRotate(Main);
248-
break;
249-
case "Unsharp":
250-
d.dispose();
251-
child = new FilterUnsharp(Main);
252-
break;
253-
}
254-
235+
BuildingBlock child = selectedList.getSelectedValue();
255236
blocks.addObject(child);
237+
d.dispose();
256238
child.settingsDialog(blockFrame);
257239
}
258240
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ public JDialog settingsDialog(final Frame owner){
168168
final int oldy = getY();
169169

170170
final JDialog d = new JDialog(owner, "Image Settings", true);
171+
Main.ImageWindow.update();
171172

172173
//Name
173174
JLabel text = new JLabel("Name:");

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

Lines changed: 83 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import javax.swing.JSpinner;
3030
import javax.swing.JTextField;
3131
import javax.swing.SpinnerNumberModel;
32+
import javax.swing.UIManager;
3233
import javax.swing.colorchooser.AbstractColorChooserPanel;
3334
import javax.swing.event.ChangeEvent;
3435
import javax.swing.event.ChangeListener;
@@ -53,9 +54,11 @@ public class AddText extends BuildingBlock {
5354

5455
public AddText(Main Main){
5556
super("Text", Main);
57+
setTextFont(Main.sig.newFont(UIManager.getDefaults().getFont("TabbedPane.font").getFamily(), "plain", 12, "#000000"));
5658
}
5759
public AddText(String name,Main Main){
5860
super(name, Main);
61+
setTextFont(Main.sig.newFont(UIManager.getDefaults().getFont("TabbedPane.font").getFamily(), "plain", 12, "#000000"));
5962
}
6063

6164
/**
@@ -175,6 +178,58 @@ protected JDialog settingsTextFont(JDialog owner){
175178
final JComboBox<String> fontBox = new JComboBox<String>(GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames());fontBox.setEditable(false);if(getTextFont() != null){fontBox.addItem(getTextFont().getFontname());fontBox.setSelectedItem(getTextFont().getFontname());}
176179

177180
final JButton fontBut = new JButton("...");
181+
182+
183+
JPanel fontPane = new JPanel();
184+
fontPane.setLayout(new BoxLayout(fontPane, BoxLayout.LINE_AXIS));
185+
fontPane.setBorder(BorderFactory.createEmptyBorder(15, 25, 3, 25));
186+
fontPane.add(Box.createHorizontalGlue());
187+
//fontPane.add(fontLab);
188+
//fontPane.add(Box.createRigidArea(new Dimension(10, 0)));
189+
fontPane.add(fontBox);
190+
fontPane.add(Box.createRigidArea(new Dimension(10, 0)));
191+
fontPane.add(fontBut);
192+
fontPane.add(Box.createHorizontalGlue());
193+
194+
//Size Style
195+
JLabel sizeLab = new JLabel("Size:");JLabel styleLab = new JLabel("Style:");
196+
final JSpinner sizeSpinner = new JSpinner();
197+
sizeSpinner.setModel(new SpinnerNumberModel(12,1,999,1));if(getTextFont() != null){sizeSpinner.setValue(getTextFont().getSize());}
198+
String[] styleStrings = { "Plain", "Bold", "Italic"};
199+
final JComboBox<String> styleBox = new JComboBox<String>(styleStrings);
200+
styleBox.setSelectedIndex(0);
201+
if(getTextFont() != null){
202+
switch(getTextFont().getStyle().toLowerCase()){
203+
case "bold":styleBox.setSelectedIndex(1);break;
204+
case "italic":styleBox.setSelectedIndex(2);break;
205+
default:styleBox.setSelectedIndex(0);break;
206+
}
207+
}
208+
209+
JPanel sizePane = new JPanel();
210+
sizePane.setLayout(new BoxLayout(sizePane, BoxLayout.LINE_AXIS));
211+
sizePane.setBorder(BorderFactory.createEmptyBorder(15, 25, 3, 25));
212+
sizePane.add(Box.createHorizontalGlue());
213+
sizePane.add(sizeLab);
214+
sizePane.add(Box.createRigidArea(new Dimension(10, 0)));
215+
sizePane.add(sizeSpinner);
216+
sizePane.add(Box.createRigidArea(new Dimension(10, 0)));
217+
sizePane.add(styleLab);
218+
sizePane.add(Box.createRigidArea(new Dimension(10, 0)));
219+
sizePane.add(styleBox);
220+
sizePane.add(Box.createHorizontalGlue());
221+
222+
//Color
223+
final JTextField colorField = new JTextField();colorField.setText("#000000");if(getTextFont() != null){colorField.setText(getTextFont().getHexColor());}
224+
JButton colorBut = new JButton("Color:");
225+
226+
fontBox.addItemListener(new ItemListener(){
227+
public void itemStateChanged(ItemEvent e){
228+
setTextFont(Main.sig.newFont((String)fontBox.getSelectedItem(), ((String)styleBox.getSelectedItem()).toLowerCase(), (int)sizeSpinner.getValue(), colorField.getText()));
229+
saveObject();
230+
Main.ImageWindow.update();
231+
}
232+
});
178233
fontBut.addActionListener(new ActionListener(){
179234
public void actionPerformed(ActionEvent e){
180235
File dir = new File(System.getProperty("user.dir") + "/fonts");
@@ -210,6 +265,9 @@ public void actionPerformed(ActionEvent e){
210265
catch (IOException e1) {
211266
System.out.println("!!COPY FAILED!!");
212267
}
268+
setTextFont(Main.sig.newFont((String)fontBox.getSelectedItem(), ((String)styleBox.getSelectedItem()).toLowerCase(), (int)sizeSpinner.getValue(), colorField.getText()));
269+
saveObject();
270+
Main.ImageWindow.update();
213271
}
214272
}
215273
}
@@ -220,49 +278,13 @@ public void actionPerformed(ActionEvent e){
220278
}
221279
}
222280
});
223-
224-
JPanel fontPane = new JPanel();
225-
fontPane.setLayout(new BoxLayout(fontPane, BoxLayout.LINE_AXIS));
226-
fontPane.setBorder(BorderFactory.createEmptyBorder(15, 25, 3, 25));
227-
fontPane.add(Box.createHorizontalGlue());
228-
//fontPane.add(fontLab);
229-
//fontPane.add(Box.createRigidArea(new Dimension(10, 0)));
230-
fontPane.add(fontBox);
231-
fontPane.add(Box.createRigidArea(new Dimension(10, 0)));
232-
fontPane.add(fontBut);
233-
fontPane.add(Box.createHorizontalGlue());
234-
235-
//Size Style
236-
JLabel sizeLab = new JLabel("Size:");JLabel styleLab = new JLabel("Style:");
237-
final JSpinner sizeSpinner = new JSpinner();
238-
sizeSpinner.setModel(new SpinnerNumberModel(12,1,999,1));if(getTextFont() != null){sizeSpinner.setValue(getTextFont().getSize());}
239-
String[] styleStrings = { "Plain", "Bold", "Italic"};
240-
final JComboBox<String> styleBox = new JComboBox<String>(styleStrings);
241-
styleBox.setSelectedIndex(0);
242-
if(getTextFont() != null){
243-
switch(getTextFont().getStyle().toLowerCase()){
244-
case "bold":styleBox.setSelectedIndex(1);break;
245-
case "italic":styleBox.setSelectedIndex(2);break;
246-
default:styleBox.setSelectedIndex(0);break;
247-
}
248-
}
249-
250-
JPanel sizePane = new JPanel();
251-
sizePane.setLayout(new BoxLayout(sizePane, BoxLayout.LINE_AXIS));
252-
sizePane.setBorder(BorderFactory.createEmptyBorder(15, 25, 3, 25));
253-
sizePane.add(Box.createHorizontalGlue());
254-
sizePane.add(sizeLab);
255-
sizePane.add(Box.createRigidArea(new Dimension(10, 0)));
256-
sizePane.add(sizeSpinner);
257-
sizePane.add(Box.createRigidArea(new Dimension(10, 0)));
258-
sizePane.add(styleLab);
259-
sizePane.add(Box.createRigidArea(new Dimension(10, 0)));
260-
sizePane.add(styleBox);
261-
sizePane.add(Box.createHorizontalGlue());
262-
263-
//Color
264-
final JTextField colorField = new JTextField();colorField.setText("#000000");if(getTextFont() != null){colorField.setText(getTextFont().getHexColor());}
265-
JButton colorBut = new JButton("Color:");
281+
styleBox.addItemListener(new ItemListener(){
282+
public void itemStateChanged(ItemEvent e){
283+
setTextFont(Main.sig.newFont((String)fontBox.getSelectedItem(), ((String)styleBox.getSelectedItem()).toLowerCase(), (int)sizeSpinner.getValue(), colorField.getText()));
284+
saveObject();
285+
Main.ImageWindow.update();
286+
}
287+
});
266288
colorBut.addActionListener(new ActionListener(){
267289
public void actionPerformed(ActionEvent e){
268290
final JDialog colorD = new JDialog(d, "Font Color", true);
@@ -284,6 +306,14 @@ public void actionPerformed(ActionEvent e){
284306
}
285307
cc.setChooserPanels(newcolorPanel);
286308
cc.setPreviewPanel(new JPanel());
309+
cc.getSelectionModel().addChangeListener(new ChangeListener(){
310+
public void stateChanged(ChangeEvent e){
311+
colorField.setText(Main.toHexString(cc.getColor()));
312+
setTextFont(Main.sig.newFont((String)fontBox.getSelectedItem(), ((String)styleBox.getSelectedItem()).toLowerCase(), (int)sizeSpinner.getValue(), Main.toHexString(cc.getColor())));
313+
saveObject();
314+
Main.ImageWindow.update();
315+
}
316+
});
287317

288318
JPanel colorPane = new JPanel();
289319
colorPane.setLayout(new BoxLayout(colorPane, BoxLayout.PAGE_AXIS));
@@ -296,6 +326,7 @@ public void actionPerformed(ActionEvent e){
296326
public void actionPerformed(ActionEvent e){
297327
//save and close
298328
colorField.setText(Main.toHexString(cc.getColor()));
329+
setTextFont(Main.sig.newFont((String)fontBox.getSelectedItem(), ((String)styleBox.getSelectedItem()).toLowerCase(), (int)sizeSpinner.getValue(), Main.toHexString(cc.getColor())));
299330
colorD.dispose();
300331
}
301332
});
@@ -324,6 +355,13 @@ public void actionPerformed(ActionEvent e){
324355
colorD.setVisible(true);
325356
}
326357
});
358+
sizeSpinner.addChangeListener(new ChangeListener(){
359+
public void stateChanged(ChangeEvent e){
360+
setTextFont(Main.sig.newFont((String)fontBox.getSelectedItem(), ((String)styleBox.getSelectedItem()).toLowerCase(), (int)sizeSpinner.getValue(), colorField.getText()));
361+
saveObject();
362+
Main.ImageWindow.update();
363+
}
364+
});
327365

328366
JPanel colorPane = new JPanel();
329367
colorPane.setLayout(new BoxLayout(colorPane, BoxLayout.LINE_AXIS));
@@ -380,6 +418,7 @@ public void actionPerformed(ActionEvent e){
380418
contentPane.add(buttonPane, BorderLayout.PAGE_END);
381419

382420
//d.setPreferredSize(new Dimension(400,130));
421+
383422
d.setLocationRelativeTo(owner);
384423
d.pack();
385424
d.setVisible(true);
@@ -396,6 +435,7 @@ public JDialog settingsDialog(final Frame owner){
396435
final int oldangdeg = getAngdeg();
397436

398437
final JDialog d = new JDialog(owner, getClass().getSimpleName()+" Settings", true);
438+
Main.ImageWindow.update();
399439

400440
//Name
401441
JLabel text = new JLabel("Name:");
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
package com.inverseinnovations.VisualMALSignatureDesigner.BuildingBlock;
2+
3+
import java.awt.Dimension;
4+
import java.awt.event.ItemEvent;
5+
import java.awt.event.ItemListener;
6+
import java.awt.image.BufferedImage;
7+
8+
import javax.swing.BorderFactory;
9+
import javax.swing.Box;
10+
import javax.swing.BoxLayout;
11+
import javax.swing.JComboBox;
12+
import javax.swing.JLabel;
13+
import javax.swing.JPanel;
14+
15+
import com.inverseinnovations.VisualMALSignatureDesigner.Main;
16+
17+
public class AddTime extends AddText {
18+
private static final long serialVersionUID = 1L;
19+
private int id = 1;//12 titles
20+
21+
public AddTime(Main Main){
22+
super("Anime Time", Main);
23+
}
24+
25+
/**
26+
* @return the id
27+
*/
28+
public int getId() {
29+
return id;
30+
}
31+
/**
32+
* @param id the id to set
33+
*/
34+
public void setId(int id) {
35+
this.id = id;
36+
}
37+
@Override
38+
public JPanel settingsText(){
39+
JLabel idLab = new JLabel("Anime #:");
40+
Integer[] idStrings = new Integer[12];
41+
for(int i = 1;i <= 12;i++){
42+
idStrings[i-1] = i;
43+
}
44+
final JComboBox<Integer> idBox = new JComboBox<Integer>(idStrings);
45+
idBox.setSelectedIndex(getId()-1);
46+
idBox.addItemListener(new ItemListener(){
47+
public void itemStateChanged(ItemEvent e){
48+
setId(idBox.getSelectedIndex()+1);
49+
saveObject();
50+
Main.ImageWindow.update();
51+
}
52+
});
53+
54+
JPanel textPane = new JPanel();
55+
textPane.setLayout(new BoxLayout(textPane, BoxLayout.LINE_AXIS));
56+
textPane.setBorder(BorderFactory.createEmptyBorder(15, 25, 3, 25));
57+
textPane.add(Box.createHorizontalGlue());
58+
textPane.add(idLab);
59+
textPane.add(Box.createRigidArea(new Dimension(10, 0)));
60+
textPane.add(idBox);
61+
textPane.add(Box.createHorizontalGlue());
62+
63+
return textPane;
64+
}
65+
@Override
66+
public BufferedImage generateImage(){
67+
return Main.sig.makeTime(getId(), getX(), getY(), getTextFont(), getAlign(), getAngdeg());
68+
}
69+
}

0 commit comments

Comments
 (0)