Changeset 94
- Timestamp:
- 02/02/08 17:51:20 (10 months ago)
- Files:
-
- trunk/src/vlcskineditor/ProgressWindow.java (modified) (1 diff)
- trunk/src/vlcskineditor/SliderBGBuilder.java (added)
- trunk/src/vlcskineditor/SliderBGGen.java (modified) (14 diffs)
- trunk/src/vlcskineditor/icons/sbg_bg_h.png (added)
- trunk/src/vlcskineditor/icons/sbg_bg_v.png (added)
- trunk/src/vlcskineditor/icons/sbg_bottom.png (added)
- trunk/src/vlcskineditor/icons/sbg_height.png (modified) (1 prop)
- trunk/src/vlcskineditor/icons/sbg_left.png (added)
- trunk/src/vlcskineditor/icons/sbg_margin_b.png (modified) (1 prop)
- trunk/src/vlcskineditor/icons/sbg_margin_l.png (modified) (1 prop)
- trunk/src/vlcskineditor/icons/sbg_margin_r.png (modified) (1 prop)
- trunk/src/vlcskineditor/icons/sbg_margin_t.png (modified) (1 prop)
- trunk/src/vlcskineditor/icons/sbg_middle_h.png (added)
- trunk/src/vlcskineditor/icons/sbg_middle_v.png (added)
- trunk/src/vlcskineditor/icons/sbg_right.png (added)
- trunk/src/vlcskineditor/icons/sbg_stretch.png (added)
- trunk/src/vlcskineditor/icons/sbg_tile.png (added)
- trunk/src/vlcskineditor/icons/sbg_top.png (added)
- trunk/src/vlcskineditor/icons/sbg_width.png (modified) (1 prop)
- trunk/src/vlcskineditor/icons/windows.png (modified) (1 prop)
- trunk/src/vlcskineditor/items/SliderBackground.java (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/vlcskineditor/ProgressWindow.java
r68 r94 48 48 pbar.setIndeterminate(true); 49 49 } 50 public void setProgress(int i) { 51 pbar.setIndeterminate(false); 52 pbar.setMaximum(1000); 53 pbar.setMinimum(0); 54 pbar.setValue(i); 55 } 50 56 /** Sets the text displayed on the progress bar */ 51 57 public void setText(String s) { trunk/src/vlcskineditor/SliderBGGen.java
r93 r94 25 25 import java.awt.*; 26 26 import java.awt.event.*; 27 import java.io.File; 27 28 import javax.swing.*; 29 import javax.swing.border.EtchedBorder; 28 30 import vlcskineditor.items.SliderBackground; 31 import vlcskineditor.resources.Bitmap; 29 32 30 33 /** … … 70 73 JButton bg_btn, e1_btn, md_btn, e2_btn; 71 74 JFileChooser bg_fc, e1_fc, md_fc, e2_fc; 75 76 JLabel bg_l, e1_l, md_l, e2_l; 77 JPanel bg_p, e1_p, md_p, e2_p; 78 72 79 JButton step2_prev_btn, step2_finish_btn, step2_cancel_btn; 73 80 … … 81 88 ImageIcon margin_t_i = createIcon("icons/sbg_margin_t.png"); 82 89 ImageIcon margin_b_i = createIcon("icons/sbg_margin_b.png"); 90 ImageIcon bg_h = createIcon("icons/sbg_bg_h.png"); 91 ImageIcon bg_v = createIcon("icons/sbg_bg_v.png"); 92 ImageIcon left = createIcon("icons/sbg_left.png"); 93 ImageIcon right = createIcon("icons/sbg_right.png"); 94 ImageIcon top = createIcon("icons/sbg_top.png"); 95 ImageIcon bottom = createIcon("icons/sbg_bottom.png"); 96 ImageIcon middle_h = createIcon("icons/sbg_middle_h.png"); 97 ImageIcon middle_v = createIcon("icons/sbg_middle_v.png"); 98 ImageIcon tile = createIcon("icons/sbg_tile.png"); 99 ImageIcon stretch = createIcon("icons/sbg_stretch.png"); 83 100 84 101 /** … … 111 128 card_step1.add(header1_l); 112 129 113 JLabel welcome_l = new JLabel("<html><div style=\"width:400px;margin-top:2px\">Welcome to the slider background generator. <br>" +130 JLabel welcome_l = new JLabel("<html><div style=\"width:400px;margin-top:2px\">Welcome to the slider background generator. It will help you to create a neat slider from your images, in just a few steps.<br>" + 114 131 "As a first step, please choose whether the slider is going from left to right or from the bottom to the top and what size the background should have.</div></html>"); 115 132 card_step1.add(welcome_l); 116 welcome_l.setBounds(5, 25,630,100);133 welcome_l.setBounds(5,30,630,100); 117 134 ltr_rb = new JRadioButton(""); 118 135 card_step1.add(ltr_rb); 119 ltr_rb.setBounds(5,1 05,20,100);136 ltr_rb.setBounds(5,125,20,60); 120 137 ltr_rb.setSelected(true); 121 138 JLabel ltr_l = new JLabel(ltr_icon); 122 139 ltr_l.setLabelFor(ltr_rb); 123 140 card_step1.add(ltr_l); 124 ltr_l.setBounds(30,1 05,100,100);141 ltr_l.setBounds(30,125,100,60); 125 142 126 143 btt_rb = new JRadioButton(""); 127 144 card_step1.add(btt_rb); 128 btt_rb.setBounds(255,1 05,20,100);145 btt_rb.setBounds(255,125,20,60); 129 146 JLabel btt_l = new JLabel(btt_icon); 130 147 btt_l.setLabelFor(btt_rb); … … 132 149 btt_l.setBounds(280,105,100,100); 133 150 151 btt_rb.setEnabled(false); 152 btt_l.setEnabled(false); 153 134 154 ButtonGroup dir_bg = new ButtonGroup(); 135 155 dir_bg.add(ltr_rb); 156 ltr_rb.addActionListener(this); 136 157 dir_bg.add(btt_rb); 158 btt_rb.addActionListener(this); 137 159 138 160 JSeparator horz2_s = new JSeparator(JSeparator.HORIZONTAL); … … 140 162 horz2_s.setBounds(5,215,525,215); 141 163 142 JLabel width_l = new JLabel("Width:",width_i,JLabel.RIGHT); 164 JLabel width_l = new JLabel("Width:",width_i,JLabel.TRAILING); 165 width_l.setHorizontalAlignment(JLabel.LEFT); 143 166 width_tf = new JTextField(); 144 167 width_tf.setDocument(new NumbersOnlyDocument(false)); … … 150 173 width_tf.setBounds(90,230,50,25); 151 174 152 JLabel height_l = new JLabel("Height:",height_i,JLabel.RIGHT); 175 JLabel height_l = new JLabel("Height:",height_i,JLabel.TRAILING); 176 height_l.setHorizontalAlignment(JLabel.LEFT); 153 177 height_tf = new JTextField(); 154 178 height_tf.setDocument(new NumbersOnlyDocument(false)); … … 160 184 height_tf.setBounds(90,265,50,25); 161 185 162 JLabel margin_l_l = new JLabel("Left margin:", margin_l_i, JLabel.RIGHT); 186 JLabel margin_l_l = new JLabel("Left margin:", margin_l_i, JLabel.TRAILING); 187 margin_l_l.setHorizontalAlignment(JLabel.LEFT); 163 188 margin_l_tf = new JTextField(); 164 189 margin_l_tf.setDocument(new NumbersOnlyDocument(false)); 165 190 margin_l_l.setLabelFor(margin_l_tf); 166 JLabel margin_r_l = new JLabel("Right margin:", margin_r_i, JLabel.RIGHT); 191 JLabel margin_r_l = new JLabel("Right margin:", margin_r_i, JLabel.TRAILING); 192 margin_r_l.setHorizontalAlignment(JLabel.LEFT); 167 193 margin_r_tf = new JTextField(); 168 194 margin_r_tf.setDocument(new NumbersOnlyDocument(false)); 169 195 margin_r_l.setLabelFor(margin_r_tf); 170 JLabel margin_t_l = new JLabel("Top margin:", margin_t_i, JLabel.RIGHT); 196 JLabel margin_t_l = new JLabel("Top margin:", margin_t_i, JLabel.TRAILING); 197 margin_t_l.setHorizontalAlignment(JLabel.LEFT); 171 198 margin_t_tf = new JTextField(); 172 199 margin_t_tf.setDocument(new NumbersOnlyDocument(false)); 173 200 margin_t_l.setLabelFor(margin_t_tf); 174 JLabel margin_b_l = new JLabel("Bottom margin:", margin_b_i, JLabel.RIGHT); 201 JLabel margin_b_l = new JLabel("Bottom margin:", margin_b_i, JLabel.TRAILING); 202 margin_b_l.setHorizontalAlignment(JLabel.LEFT); 175 203 margin_b_tf = new JTextField(); 176 204 margin_b_tf.setDocument(new NumbersOnlyDocument(false)); … … 194 222 margin_b_tf.setBounds(445,265,50,25); 195 223 224 JSeparator separator2 = new JSeparator(JSeparator.HORIZONTAL); 225 JLabel info_l = new JLabel("<html>In the following step you have to choose the correct image files associated" + 226 " to the different parts of your slider.<br>Note that the icons are just examples to illustrate" + 227 " what the different parts represent. They are not a preview of the images that will be used in" + 228 " the background generation.</html>"); 229 230 card_step1.add(separator2); 231 card_step1.add(info_l); 232 233 separator2.setBounds(5,300,525,5); 234 info_l.setBounds(5,310,525,80); 235 196 236 step1_horz_s = new JSeparator(JSeparator.HORIZONTAL); 197 237 step1_next_btn = new JButton("Next >"); … … 204 244 card_step1.add(step1_cancel_btn); 205 245 206 step1_horz_s.setBounds(5,3 45,525,5);207 step1_next_btn.setBounds(370, 350,75,20);208 step1_cancel_btn.setBounds(450, 350,75,20);246 step1_horz_s.setBounds(5,395,525,5); 247 step1_next_btn.setBounds(370, 400,75,20); 248 step1_cancel_btn.setBounds(450,400,75,20); 209 249 210 250 card_step1.setSize(540,400); … … 217 257 card_step2.add(header2_l); 218 258 219 JPanelbg_p = new JPanel(null);220 JLabel bg_l = new JLabel("Image file:");259 bg_p = new JPanel(null); 260 bg_l = new JLabel("Image file:",bg_h,JLabel.TRAILING); 221 261 bg_tf = new JTextField(""); 222 262 bg_btn = new JButton("Open..."); 223 263 bg_btn.addActionListener(this); 264 JLabel bg_rs_l = new JLabel("Resize behaviour:"); 265 ButtonGroup bg_rs_g = new ButtonGroup(); 266 bgt_rb = new JRadioButton("",true); 267 JLabel bgt_l = new JLabel("Tile",tile,JLabel.TRAILING); 268 bgt_l.setHorizontalAlignment(JLabel.LEFT); 269 bg_rs_g.add(bgt_rb); 270 bgs_rb = new JRadioButton("",false); 271 JLabel bgs_l = new JLabel("Stretch",stretch,JLabel.TRAILING); 272 bgs_l.setHorizontalAlignment(JLabel.LEFT); 273 bg_rs_g.add(bgs_rb); 274 bg_p.add(bg_l); 275 bg_p.add(bg_tf); 276 bg_p.add(bg_btn); 277 bg_p.add(bg_rs_l); 278 bg_p.add(bgt_rb); 279 bg_p.add(bgt_l); 280 bg_p.add(bgs_rb); 281 bg_p.add(bgs_l); 282 bg_l.setBounds(10,20,100,25); 283 bg_tf.setBounds(115,20,300,25); 284 bg_btn.setBounds(420,20,100,25); 285 bg_rs_l.setBounds(10,60,100,25); 286 bgt_rb.setBounds(115,60,25,25); 287 bgt_l.setBounds(140,60,100,25); 288 bgs_rb.setBounds(220,60,25,25); 289 bgs_l.setBounds(250,60,100,25); 290 bg_p.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Background")); 291 card_step2.add(bg_p); 292 bg_p.setBounds(5,60,530,95); 293 294 e1_p = new JPanel(null); 295 e1_l = new JLabel("Image file:",left,JLabel.TRAILING); 296 e1_tf = new JTextField(); 297 e1_btn = new JButton("Open..."); 298 e1_btn.addActionListener(this); 299 e1_p.add(e1_l); 300 e1_p.add(e1_tf); 301 e1_p.add(e1_btn); 302 e1_l.setBounds(10,20,100,25); 303 e1_tf.setBounds(115,20,300,25); 304 e1_btn.setBounds(420,20,100,25); 305 e1_p.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Left edge")); 306 card_step2.add(e1_p); 307 e1_p.setBounds(5,160,530,55); 308 309 md_p = new JPanel(null); 310 md_l = new JLabel("Image file:",middle_h,JLabel.TRAILING); 311 md_tf = new JTextField(""); 312 md_btn = new JButton("Open..."); 313 md_btn.addActionListener(this); 314 JLabel md_rs_l = new JLabel("Resize behaviour:"); 315 ButtonGroup md_rs_g = new ButtonGroup(); 316 mdt_rb = new JRadioButton("",true); 317 JLabel mdt_l = new JLabel("Tile",tile,JLabel.TRAILING); 318 mdt_l.setHorizontalAlignment(JLabel.LEFT); 319 md_rs_g.add(mdt_rb); 320 mds_rb = new JRadioButton("",false); 321 JLabel mds_l = new JLabel("Stretch",stretch,JLabel.TRAILING); 322 mds_l.setHorizontalAlignment(JLabel.LEFT); 323 md_rs_g.add(mds_rb); 324 md_p.add(md_l); 325 md_p.add(md_tf); 326 md_p.add(md_btn); 327 md_p.add(md_rs_l); 328 md_p.add(mdt_rb); 329 md_p.add(mdt_l); 330 md_p.add(mds_rb); 331 md_p.add(mds_l); 332 md_l.setBounds(10,20,100,25); 333 md_tf.setBounds(115,20,300,25); 334 md_btn.setBounds(420,20,100,25); 335 md_rs_l.setBounds(10,60,100,25); 336 mdt_rb.setBounds(115,60,25,25); 337 mdt_l.setBounds(140,60,100,25); 338 mds_rb.setBounds(220,60,25,25); 339 mds_l.setBounds(250,60,100,25); 340 md_p.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Middle part")); 341 card_step2.add(md_p); 342 md_p.setBounds(5,220,530,95); 343 344 e2_p = new JPanel(null); 345 e2_l = new JLabel("Image file:",right,JLabel.TRAILING); 346 e2_tf = new JTextField(); 347 e2_btn = new JButton("Open..."); 348 e2_btn.addActionListener(this); 349 e2_p.add(e2_l); 350 e2_p.add(e2_tf); 351 e2_p.add(e2_btn); 352 e2_l.setBounds(10,20,100,25); 353 e2_tf.setBounds(115,20,300,25); 354 e2_btn.setBounds(420,20,100,25); 355 e2_p.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Right edge")); 356 card_step2.add(e2_p); 357 e2_p.setBounds(5,320,530,55); 224 358 225 359 JSeparator step2_horz_s = new JSeparator(JSeparator.HORIZONTAL); … … 236 370 card_step2.add(step2_cancel_btn); 237 371 238 step2_horz_s.setBounds(5,3 45,525,5);239 step2_prev_btn.setBounds(275, 350,90,20);240 step2_finish_btn.setBounds(370, 350,75,20);241 step2_cancel_btn.setBounds(450, 350,75,20);372 step2_horz_s.setBounds(5,395,525,5); 373 step2_prev_btn.setBounds(275,400,90,20); 374 step2_finish_btn.setBounds(370,400,75,20); 375 step2_cancel_btn.setBounds(450,400,75,20); 242 376 243 377 add(card_step2,STEP2); 244 378 245 setSize(540,4 00);379 setSize(540,450); 246 380 setResizable(false); 247 381 } 248 382 public void actionPerformed(ActionEvent e) { 249 383 if(e.getActionCommand().equals("Cancel")) { 250 System.exit(1); 384 setVisible(false); 385 dispose(); 251 386 } 252 387 else if (e.getSource().equals(step1_next_btn)) { … … 257 392 } 258 393 else if (e.getSource().equals(step2_finish_btn)) { 259 //Do something 394 File f = new File(s.skinfolder+sbg.id+".png"); 395 int i = 1; 396 while(f.exists()) { 397 f = new File(s.skinfolder+sbg.id+"_"+String.valueOf(i)+".png"); 398 i++; 399 } 400 SliderBGBuilder sbgb = new SliderBGBuilder(this); 401 if(sbgb.cancontinue) { 402 sbgb.build(); 403 sbgb.save(f); 404 Bitmap b = new Bitmap(s, f); 405 s.resources.add(b); 406 sbg.image_tf.setText(b.id); 407 sbg.nbvert_tf.setText(String.valueOf(sbgb.nbframes)); 408 sbg.nbhoriz_tf.setText("1"); 409 sbg.padhoriz_tf.setText("0"); 410 sbg.padvert_tf.setText("0"); 411 setVisible(false); 412 dispose(); 413 } 414 } 415 else if(e.getSource().equals(ltr_rb)) { 416 bg_l.setIcon(bg_h); 417 e1_p.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Left edge")); 418 e1_l.setIcon(left); 419 md_l.setIcon(middle_h); 420 e2_p.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Right edge")); 421 e2_l.setIcon(right); 422 } 423 else if(e.getSource().equals(btt_rb)) { 424 bg_l.setIcon(bg_v); 425 e1_p.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Top edge")); 426 e1_l.setIcon(top); 427 md_l.setIcon(middle_v); 428 e2_p.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Bottom edge")); 429 e2_l.setIcon(bottom); 430 } 431 else if(e.getSource().equals(bg_btn)) { 432 JFileChooser fc = new JFileChooser(new File(s.skinfolder)); 433 int i = fc.showOpenDialog(this); 434 if(i==JFileChooser.APPROVE_OPTION && fc.getSelectedFile().exists()) { 435 bg_tf.setText(fc.getSelectedFile().getPath()); 436 } 437 } 438 else if(e.getSource().equals(e1_btn)) { 439 JFileChooser fc = new JFileChooser(new File(s.skinfolder)); 440 int i = fc.showOpenDialog(this); 441 if(i==JFileChooser.APPROVE_OPTION && fc.getSelectedFile().exists()) { 442 e1_tf.setText(fc.getSelectedFile().getPath()); 443 } 444 } 445 else if(e.getSource().equals(md_btn)) { 446 JFileChooser fc = new JFileChooser(new File(s.skinfolder)); 447 int i = fc.showOpenDialog(this); 448 if(i==JFileChooser.APPROVE_OPTION && fc.getSelectedFile().exists()) { 449 md_tf.setText(fc.getSelectedFile().getPath()); 450 } 451 } 452 else if(e.getSource().equals(e2_btn)) { 453 JFileChooser fc = new JFileChooser(new File(s.skinfolder)); 454 int i = fc.showOpenDialog(this); 455 if(i==JFileChooser.APPROVE_OPTION && fc.getSelectedFile().exists()) { 456 e2_tf.setText(fc.getSelectedFile().getPath()); 457 } 260 458 } 261 459 } … … 271 469 //img = ImageIO.read(file); 272 470 return new ImageIcon(img); 273 } catch (Exception e) { 471 } catch (Exception e) { 274 472 System.out.println(e); 275 473 return null; trunk/src/vlcskineditor/icons/sbg_height.png
- Property svn:mime-type changed from application/octet-stream to image/png
trunk/src/vlcskineditor/icons/sbg_margin_b.png
- Property svn:mime-type changed from application/octet-stream to image/png
trunk/src/vlcskineditor/icons/sbg_margin_l.png
- Property svn:mime-type changed from application/octet-stream to image/png
trunk/src/vlcskineditor/icons/sbg_margin_r.png
- Property svn:mime-type changed from application/octet-stream to image/png
trunk/src/vlcskineditor/icons/sbg_margin_t.png
- Property svn:mime-type changed from application/octet-stream to image/png
trunk/src/vlcskineditor/icons/sbg_width.png
- Property svn:mime-type changed from application/octet-stream to image/png
trunk/src/vlcskineditor/icons/windows.png
- Property svn:mime-type changed from application/octet-stream to image/png
trunk/src/vlcskineditor/items/SliderBackground.java
r92 r94 50 50 51 51 JFrame frame; 52 JTextField id_tf, image_tf, nbhoriz_tf, nbvert_tf, padhoriz_tf, padvert_tf;52 public JTextField id_tf, image_tf, nbhoriz_tf, nbvert_tf, padhoriz_tf, padvert_tf; 53 53 JButton gen_btn, ok_btn, cancel_btn, help_btn; 54 54 BufferedImage bi = null; … … 86 86 padhoriz = Integer.parseInt(padhoriz_tf.getText()); 87 87 padvert = Integer.parseInt(padvert_tf.getText()); 88 frame.setDefaultCloseOperation(JFrame. HIDE_ON_CLOSE);88 frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); 89 89 created = true; 90 90 … … 219 219 } 220 220 update(); 221 s.updateItems(); 222 s.expandItem(id); 221 223 frame.setVisible(false); 222 224 frame.dispose(); … … 239 241 } 240 242 else if(e.getSource().equals(gen_btn)) { 241 //TODO 243 SliderBGGen sbgg = new SliderBGGen(this, s); 244 sbgg.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); 245 sbgg.setVisible(true); 242 246 } 243 247 else if(e.getSource().equals(cancel_btn)) { … … 246 250 frame = null; 247 251 if(!created) sl.removeBG(); 248 } 249 } 252 } 253 } 250 254 public String returnCode() { 251 255 String code = "<SliderBackground";
