Changeset 72
- Timestamp:
- 07/11/07 17:42:40 (1 year ago)
- Files:
-
- trunk/src/vlcskineditor/Layout.java (modified) (5 diffs)
- trunk/src/vlcskineditor/Skin.java (modified) (1 diff)
- trunk/src/vlcskineditor/Window.java (modified) (8 diffs)
- trunk/src/vlcskineditor/history/History.java (modified) (2 diffs)
- trunk/src/vlcskineditor/history/LayoutAddEvent.java (added)
- trunk/src/vlcskineditor/history/LayoutEditEvent.java (added)
- trunk/src/vlcskineditor/history/WindowAddEvent.java (added)
- trunk/src/vlcskineditor/history/WindowEditEvent.java (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/vlcskineditor/Layout.java
r71 r72 24 24 25 25 import vlcskineditor.items.*; 26 import vlcskineditor.history.*; 26 27 import java.util.*; 27 28 import java.awt.*; … … 49 50 public int width, height; 50 51 Skin s; 52 Window parent; 51 53 52 54 JFrame frame = null; … … 65 67 * @param s_ The Skin in which the Layout is used. 66 68 */ 67 public Layout(String xmlcode, Skin s_) {69 public Layout(String xmlcode, Window w_, Skin s_) { 68 70 s=s_; 71 parent=w_; 69 72 String[] code = xmlcode.split("\n"); 70 73 width = XML.getIntValue(code[0],"width"); … … 152 155 * @param s_ The Skin in which the Layout is used. 153 156 */ 154 public Layout( Skin s_) {157 public Layout(Window w_, Skin s_) { 155 158 s=s_; 159 parent=w_; 156 160 id = "Unnamed layout #"+s.getNewId(); 157 161 width=0; … … 163 167 */ 164 168 public void update() { 165 id=id_tf.getText(); 166 width=Integer.parseInt(width_tf.getText()); 167 height=Integer.parseInt(height_tf.getText()); 168 minwidth=Integer.parseInt(minwidth_tf.getText()); 169 minheight=Integer.parseInt(minheight_tf.getText()); 170 maxwidth=Integer.parseInt(maxwidth_tf.getText()); 171 maxheight=Integer.parseInt(maxheight_tf.getText()); 172 s.updateWindows(); 173 s.expandLayout(id); 174 created = true; 175 frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE); 169 if(!created) { 170 LayoutAddEvent lae = new LayoutAddEvent(parent,this); 171 id=id_tf.getText(); 172 width=Integer.parseInt(width_tf.getText()); 173 height=Integer.parseInt(height_tf.getText()); 174 minwidth=Integer.parseInt(minwidth_tf.getText()); 175 minheight=Integer.parseInt(minheight_tf.getText()); 176 maxwidth=Integer.parseInt(maxwidth_tf.getText()); 177 maxheight=Integer.parseInt(maxheight_tf.getText()); 178 s.updateWindows(); 179 s.expandLayout(id); 180 created = true; 181 frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE); 182 s.m.hist.addEvent(lae); 183 } 184 else { 185 LayoutEditEvent lee = new LayoutEditEvent(this); 186 id=id_tf.getText(); 187 width=Integer.parseInt(width_tf.getText()); 188 height=Integer.parseInt(height_tf.getText()); 189 minwidth=Integer.parseInt(minwidth_tf.getText()); 190 minheight=Integer.parseInt(minheight_tf.getText()); 191 maxwidth=Integer.parseInt(maxwidth_tf.getText()); 192 maxheight=Integer.parseInt(maxheight_tf.getText()); 193 s.updateWindows(); 194 s.expandLayout(id); 195 lee.setNew(); 196 s.m.hist.addEvent(lee); 197 } 176 198 } 177 199 /** trunk/src/vlcskineditor/Skin.java
r71 r72 40 40 public class Skin implements ActionListener{ 41 41 42 java.util.List<Resource> resources = new LinkedList<Resource>();43 java.util.List<Window> windows = new LinkedList<Window>();42 public java.util.List<Resource> resources = new LinkedList<Resource>(); 43 public java.util.List<Window> windows = new LinkedList<Window>(); 44 44 final String HEADER = "<!DOCTYPE Theme PUBLIC \"-//VideoLAN//DTD VLC Skins V2.0//EN\" \"skin.dtd\">"; 45 45 final String THEME_VERSION_DEFAULT = "2.0"; trunk/src/vlcskineditor/Window.java
r62 r72 23 23 package vlcskineditor; 24 24 25 import vlcskineditor.history.*; 25 26 import java.util.*; 26 27 import java.awt.*; … … 36 37 public class Window implements ActionListener{ 37 38 38 /** Creates a new instance of Window */39 39 final String ID_DEFAULT="none"; 40 40 final String VISIBLE_DEFAULT = "true"; … … 44 44 final boolean PLAYONDROP_DEFAULT=true; 45 45 46 String id=ID_DEFAULT;47 String visible = VISIBLE_DEFAULT;48 int x = X_DEFAULT;49 int y = Y_DEFAULT;50 boolean dragdrop = DRAGDROP_DEFAULT;51 boolean playondrop = PLAYONDROP_DEFAULT;52 53 java.util.List<Layout> layouts = new LinkedList<Layout>();54 55 Skin s;46 public String id=ID_DEFAULT; 47 public String visible = VISIBLE_DEFAULT; 48 public int x = X_DEFAULT; 49 public int y = Y_DEFAULT; 50 public boolean dragdrop = DRAGDROP_DEFAULT; 51 public boolean playondrop = PLAYONDROP_DEFAULT; 52 53 public java.util.List<Layout> layouts = new LinkedList<Layout>(); 54 55 public Skin s; 56 56 57 57 JFrame frame = null; … … 60 60 boolean created = false; 61 61 62 /** Creates a new instance of Window */ 62 63 public Window(String xmlcode, Skin s_) { 63 64 s = s_; … … 82 83 else if(code[i].startsWith("</Layout>")) { 83 84 layoutcode+="\n"+code[i]; 84 layouts.add(new Layout(layoutcode, s));85 layouts.add(new Layout(layoutcode,this,s)); 85 86 layoutcode = ""; 86 87 } … … 97 98 showOptions(); 98 99 } 99 public void update(String id_, int x_, int y_, String v_, boolean dd_, boolean pod_) { 100 id=id_; 101 x=x_; 102 y=y_; 103 visible=v_; 104 dragdrop=dd_; 105 playondrop=pod_; 106 s.updateWindows(); 107 created = true; 108 frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE); 100 public void update() { 101 if(!created) { 102 WindowAddEvent wae = new WindowAddEvent(s,this); 103 id=id_tf.getText(); 104 x=Integer.parseInt(x_tf.getText()); 105 y=Integer.parseInt(y_tf.getText()); 106 visible=visible_tf.getText(); 107 dragdrop=Boolean.parseBoolean(dragdrop_tf.getText()); 108 playondrop=Boolean.parseBoolean(playondrop_tf.getText()); 109 s.updateWindows(); 110 created = true; 111 frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE); 112 s.m.hist.addEvent(wae); 113 } 114 else { 115 WindowEditEvent wee = new WindowEditEvent(this); 116 id=id_tf.getText(); 117 x=Integer.parseInt(x_tf.getText()); 118 y=Integer.parseInt(y_tf.getText()); 119 visible=visible_tf.getText(); 120 dragdrop=Boolean.parseBoolean(dragdrop_tf.getText()); 121 playondrop=Boolean.parseBoolean(playondrop_tf.getText()); 122 s.updateWindows(); 123 wee.setNew(); 124 s.m.hist.addEvent(wee); 125 } 109 126 } 110 127 public void showOptions() { … … 215 232 } 216 233 frame.setVisible(false); 217 update( id_tf.getText(),Integer.parseInt(x_tf.getText()),Integer.parseInt(y_tf.getText()),visible_tf.getText(),Boolean.parseBoolean(dragdrop_tf.getText()),Boolean.parseBoolean(playondrop_tf.getText()));234 update(); 218 235 } 219 236 else if(e.getSource().equals(help_btn)) { … … 238 255 } 239 256 public void addLayout() { 240 layouts.add(new Layout( s));257 layouts.add(new Layout(this,s)); 241 258 } 242 259 public String returnCode() { trunk/src/vlcskineditor/history/History.java
r71 r72 44 44 current = main; 45 45 } 46 /** Adds an Event to the history*/46 /** Adds an Event at the current point in the history list and removes any actions that could be redone*/ 47 47 public void addEvent(HistoryEvent h) { 48 48 current.setNext(h); … … 51 51 m.setRedoEnabled(false); 52 52 m.setUndoEnabled(true); 53 m.setUndoString(current.getDescription()); 53 54 } 54 55 /** Redoes the action that is next in the history list */
