Changeset 25
- Timestamp:
- 07/09/07 12:31:21 (1 year ago)
- Files:
-
- trunk/README.TXT (modified) (3 diffs)
- trunk/src/vlcskineditor/Items/Playtree.java (modified) (4 diffs)
- trunk/src/vlcskineditor/Items/Text.java (modified) (1 diff)
- trunk/src/vlcskineditor/Resources/Bitmap.java (modified) (1 diff)
- trunk/src/vlcskineditor/Resources/Font.java (modified) (4 diffs)
- trunk/src/vlcskineditor/Resources/SubBitmap.java (modified) (2 diffs)
- trunk/src/vlcskineditor/Skin.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/README.TXT
r17 r25 1 VLC Skin Editor release 0.3. 0b1 VLC Skin Editor release 0.3.5a 2 2 ----------------------------------------------------------- 3 3 Changelog: 4 4 ----------------------------------------------------------- 5 0.3.5a - Preview of Layouts 6 - XML parsing/generating fixes 5 7 0.3.0b - All items can be edited 6 8 - Theme attributes can be edited … … 26 28 System Requirements 27 29 ----------------------------------------------------------- 28 Java Runtime Environment 6+ (java.sun.com)29 a t least 256MB RAM and a half-decent cpu30 Java SE RE 6 or later (DL at java.sun.com) 31 approximately at least 256MB RAM and a 500-1000MHz CPU 30 32 ----------------------------------------------------------- 31 33 Usage: … … 33 35 To run the skin editor simply open the jar file. 34 36 Or manually run "java -jar VLCSkinEditor.jar". 35 36 To edit things select the item in the trees and click on37 the edit button. To add things use the add buttons. Self-38 explanatory isn't it?39 37 ----------------------------------------------------------- 40 38 Copyright: 41 39 ----------------------------------------------------------- 42 (c)2007 Daniel "aLtgLasS" Dreibrodt (altglass@nurfuerspam.de) 40 (c)2007 Daniel "aLtgLasS" Dreibrodt 41 (altglass@nurfuerspam.de) 43 42 See LICENSE.TXT for further details trunk/src/vlcskineditor/Items/Playtree.java
r22 r25 26 26 import java.awt.*; 27 27 import java.awt.event.*; 28 import java.awt.image.*; 28 29 import javax.swing.*; 29 30 import javax.swing.tree.*; … … 66 67 67 68 Slider slider = null; 68 69 69 70 70 JFrame frame = null; … … 547 547 g.setFont(f); 548 548 FontMetrics fm = g.getFontMetrics(); 549 if(!bgimage. startsWith("none")) {549 if(!bgimage.equals("none")) { 550 550 g.drawImage(s.getBitmapImage(bgimage),x+x_,y+y_,null); 551 551 } … … 558 558 } 559 559 } 560 int liney = y+y_; 561 BufferedImage cfi = s.getBitmapImage(closedimage); 562 BufferedImage ofi = s.getBitmapImage(openimage); 563 BufferedImage iti = s.getBitmapImage(itemimage); 564 int lineheight = fm.getHeight(); 565 if(cfi!=null) { 566 if(cfi.getHeight()>lineheight) lineheight=cfi.getHeight(); 567 } 568 if(ofi!=null) { 569 if(ofi.getHeight()>lineheight) lineheight=ofi.getHeight(); 570 } 571 if(iti!=null) { 572 if(iti.getHeight()>lineheight) lineheight=iti.getHeight(); 573 } 574 int text_offset = (lineheight-fm.getAscent())/2; 575 int cfi_offset = (lineheight-cfi.getHeight())/2; 576 int ofi_offset = (lineheight-ofi.getHeight())/2; 577 int iti_offset = (lineheight-iti.getHeight())/2; 578 579 g.setColor(Color.decode(fgcolor)); 580 if(cfi!=null && !flat) { 581 g.drawImage(cfi,x+x_,liney+cfi_offset,null); 582 liney+=lineheight; 583 g.drawString("Closed folder",x+x_+cfi.getWidth()+2,liney-text_offset); 584 } 585 if(ofi!=null && !flat) { 586 g.drawImage(ofi,x+x_,liney+ofi_offset,null); 587 liney+=lineheight; 588 g.drawString("Open folder",x+x_+ofi.getWidth()+2,liney-text_offset); 589 } 590 if(ofi!=null && iti!=null && !flat) { 591 g.drawImage(iti,x+x_+ofi.getWidth()+2,liney+iti_offset,null); 592 liney+=lineheight; 593 g.drawString("Normal item",x+x_+ofi.getWidth()+iti.getWidth()+4,liney-text_offset); 594 } 595 else if(iti!=null) { 596 g.drawImage(iti,x+x_,liney+iti_offset,null); 597 liney+=fm.getHeight(); 598 g.drawString("Normal item",x+x_+iti.getWidth()+4,liney-text_offset); 599 } 600 else { 601 liney+=fm.getHeight(); 602 g.drawString("Normal item",x+x_,liney-text_offset); 603 } 604 g.setColor(Color.decode(playcolor)); 605 if(ofi!=null && iti!=null && !flat) { 606 g.drawImage(iti,x+x_+ofi.getWidth()+2,liney+iti_offset,null); 607 liney+=lineheight; 608 g.drawString("Playing item",x+x_+ofi.getWidth()+iti.getWidth()+4,liney-text_offset); 609 } 610 else if(iti!=null) { 611 g.drawImage(iti,x+x_,liney+iti_offset,null); 612 liney+=lineheight; 613 g.drawString("Playing item",x+x_+iti.getWidth()+2,liney-text_offset); 614 } 615 else { 616 liney+=lineheight; 617 g.drawString("Playing item",x+x_,liney-text_offset); 618 } 619 g.setColor(Color.decode(selcolor)); 620 g.fillRect(x+x_,liney,width,lineheight); 621 g.setColor(Color.decode(fgcolor)); 622 if(ofi!=null && iti!=null && !flat) { 623 g.drawImage(iti,x+x_+ofi.getWidth()+2,liney+iti_offset,null); 624 liney+=lineheight; 625 g.drawString("Selected item",x+x_+ofi.getWidth()+iti.getWidth()+4,liney-text_offset); 626 } 627 else if(iti!=null) { 628 g.drawImage(iti,x+x_,liney+iti_offset,null); 629 liney+=lineheight; 630 g.drawString("Selected item",x+x_+iti.getWidth()+2,liney-text_offset); 631 } 632 else { 633 liney+=lineheight; 634 g.drawString("Selected item",x+x_,liney-text_offset); 635 } 636 560 637 slider.draw(g); 561 638 } trunk/src/vlcskineditor/Items/Text.java
r22 r25 349 349 else { 350 350 g2d.drawString(text,0,0+g2d.getFontMetrics().getAscent()); 351 } 352 353 354 355 356 g.drawImage(bi,x+x_,y+y_,null); 357 351 } 352 g.drawImage(bi,x+x_,y+y_,null); 358 353 } 359 354 public DefaultMutableTreeNode getTreeNode() { trunk/src/vlcskineditor/Resources/Bitmap.java
r22 r25 110 110 try { 111 111 image = ImageIO.read(new File(s.skinfolder+file)); 112 image = image.getSubimage(0,0,image.getWidth(),image.getHeight()/nbframes); 112 image = image.getSubimage(0,0,image.getWidth(),image.getHeight()/nbframes); 113 BufferedImage bi = new BufferedImage(image.getWidth(),image.getHeight(),BufferedImage.TYPE_INT_ARGB); 114 Graphics g2d = bi.createGraphics(); 115 int alphargb = Color.decode(alphacolor).getRGB(); 116 for(int x=0;x<image.getWidth();x++) { 117 for(int y=0;y<image.getHeight();y++) { 118 if(image.getRGB(x,y)!=alphargb) { 119 g2d.setColor(new Color(image.getRGB(x,y))); 120 g2d.drawRect(x,y,0,0); 121 } 122 } 123 } 124 image = bi; 113 125 for(int i=0;i<SubBitmaps.size();i++) { 114 126 SubBitmaps.get(i).update(image); trunk/src/vlcskineditor/Resources/Font.java
r22 r25 67 67 } 68 68 else { 69 JOptionPane.showMessageDialog(frame,"You have chosen an OpenType font, VLC will display it correctly but the Skin Editor can not display it. In the Skin Editor you will see instead of the chosen font the default font FreeSans","Notice",JOptionPane.INFORMATION_MESSAGE);69 JOptionPane.showMessageDialog(frame,"You have chosen an OpenType font, VLC will display it correctly but the Skin Editor can not display it.\nIn the Skin Editor you will see instead of the chosen font the default font FreeSans","Notice",JOptionPane.INFORMATION_MESSAGE); 70 70 try { 71 71 f = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT,new File(Main.class.getResource("FreeSans.ttf").toString())); … … 91 91 catch(Exception e) { 92 92 e.printStackTrace(); 93 JOptionPane.showMessageDialog(frame,"Error while loading font file!\n Please choose another file","Font file not valid",JOptionPane.INFORMATION_MESSAGE); 94 showOptions(); 93 if(file.indexOf(".otf")==-1) { 94 JOptionPane.showMessageDialog(frame,"Error while loading font file!\n Please choose another file\n","Font file not valid",JOptionPane.ERROR_MESSAGE); 95 showOptions(); 96 } 97 else { 98 JOptionPane.showMessageDialog(frame,"You have chosen an OpenType font, VLC will display it correctly but the Skin Editor can not display it.\nIn the Skin Editor you will see instead of the chosen font the default font FreeSans","Notice",JOptionPane.INFORMATION_MESSAGE); 99 try { 100 f = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT,new File(Main.class.getResource("FreeSans.ttf").toString())); 101 f = f.deriveFont(12); 102 } 103 catch(Exception ex) { 104 ex.printStackTrace(); 105 f=null; 106 } 107 } 95 108 } 96 109 } … … 106 119 catch(Exception e) { 107 120 e.printStackTrace(); 108 JOptionPane.showMessageDialog(frame,"Error while loading font file!\n Please choose another file","Font file not valid",JOptionPane.INFORMATION_MESSAGE); 109 showOptions(); 121 if(file.indexOf(".otf")==-1) { 122 JOptionPane.showMessageDialog(frame,"Error while loading font file!\n Please choose another file\n","Font file not valid",JOptionPane.ERROR_MESSAGE); 123 showOptions(); 124 } 125 else { 126 JOptionPane.showMessageDialog(frame,"You have chosen an OpenType font, VLC will display it correctly but the Skin Editor can not display it.\nIn the Skin Editor you will see instead of the chosen font the default font FreeSans","Notice",JOptionPane.INFORMATION_MESSAGE); 127 try { 128 f = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT,new File(Main.class.getResource("FreeSans.ttf").toString())); 129 f = f.deriveFont(12); 130 } 131 catch(Exception ex) { 132 ex.printStackTrace(); 133 f=null; 134 } 135 } 110 136 } 111 137 } … … 133 159 catch(Exception e) { 134 160 e.printStackTrace(); 135 JOptionPane.showMessageDialog(frame,"Error while loading font file!\n Please choose another file","Font file not valid",JOptionPane.INFORMATION_MESSAGE); 136 showOptions(); 161 if(file.indexOf(".otf")==-1) { 162 JOptionPane.showMessageDialog(frame,"Error while loading font file!\n Please choose another file\n","Font file not valid",JOptionPane.ERROR_MESSAGE); 163 showOptions(); 164 } 165 else { 166 JOptionPane.showMessageDialog(frame,"You have chosen an OpenType font, VLC will display it correctly but the Skin Editor can not display it.\nIn the Skin Editor you will see instead of the chosen font the default font FreeSans","Notice",JOptionPane.INFORMATION_MESSAGE); 167 try { 168 f = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT,new File(Main.class.getResource("FreeSans.ttf").toString())); 169 f = f.deriveFont(12); 170 } 171 catch(Exception ex) { 172 ex.printStackTrace(); 173 f=null; 174 } 175 } 137 176 } 138 177 trunk/src/vlcskineditor/Resources/SubBitmap.java
r17 r25 63 63 s=s_; 64 64 parent=parent_; 65 type="Bitmap"; 65 66 id = "Unnamed subbitmap #"+s.getNewId(); 66 67 x = 0; … … 72 73 } 73 74 public void update() { 74 image = parent.getSubimage(x,y,width,height); 75 image = parent.getSubimage(x,y,width,height); 75 76 s.updateResources(); 76 77 } trunk/src/vlcskineditor/Skin.java
r22 r25 26 26 import java.awt.*; 27 27 import java.awt.event.*; 28 import java.awt.image.*; 28 29 import java.io.*; 29 30 import javax.swing.*; … … 380 381 } 381 382 /** Returns the image object of a bitmap **/ 382 public Image getBitmapImage(String id) {383 public BufferedImage getBitmapImage(String id) { 383 384 Resource r = getResource(id); 384 385 if(r==null) {
