Changeset 107

Show
Ignore:
Timestamp:
20/09/08 17:30:25 (2 months ago)
Author:
altglass
Message:

V.0.7 FINAL

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/vlcskineditor/Item.java

    r100 r107  
    7878  /** Creates the XML code representing the item */ 
    7979  public abstract String returnCode(String indent); 
    80   /** Draws the item to a graphics context */ 
     80  /** Draws the item to a graphics context 
     81   * @param g graphics context 
     82   * @param z zoom factor 
     83   */ 
    8184  public abstract void draw(Graphics2D g, int z); 
    82    /** Draws the item to a graphics context with the offset x,y */ 
     85  /** Draws the item to a graphics context with the offset x,y 
     86   * @param g Graphics context 
     87   * @param x X offset 
     88   * @param y Y offset 
     89   * @param z Zoom factor 
     90   */ 
    8391  public abstract void draw(Graphics2D g, int x, int y, int z); 
    8492  /** Creates a DefaultMutableTreeNode to be displayed in the items tree */ 
  • trunk/src/vlcskineditor/Main.java

    r106 r107  
    763763      }       
    764764      setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));       
    765     }      
     765    } 
    766766    pwin.setText("Parsing XML..."); 
    767767    pwin.setVisible(true); 
  • trunk/src/vlcskineditor/items/Button.java

    r106 r107  
    397397  } 
    398398  public void draw(Graphics2D g, int x_, int y_, int z) { 
    399     if(!created) return; 
    400     if(s.gvars.parseBoolean(visible)==false) return; 
     399    if(!created) return;     
    401400    java.awt.image.BufferedImage bi; 
    402401    if(!hovered || ( (over.equals("none") && !clicked)||(clicked && down.equals("none")) ) ) { 
     
    409408      bi = s.getBitmapImage(down); 
    410409    } 
    411     g.drawImage(bi,(x+x_)*z,(y+y_)*z,bi.getWidth()*z,bi.getHeight()*z,null); 
     410    if(s.gvars.parseBoolean(visible)==true) g.drawImage(bi,(x+x_)*z,(y+y_)*z,bi.getWidth()*z,bi.getHeight()*z,null); 
    412411    if(selected) { 
    413412      g.setColor(Color.RED); 
  • trunk/src/vlcskineditor/items/Checkbox.java

    r106 r107  
    537537  } 
    538538  public void draw(Graphics2D g, int x_, int y_, int z) { 
    539     if(!created) return; 
    540     if(s.gvars.parseBoolean(visible)==false) return; 
     539    if(!created) return;     
    541540    java.awt.image.BufferedImage bi = null;  
    542541    if(s.gvars.parseBoolean(state)) {       
     
    550549      else bi = s.getBitmapImage(down2); 
    551550    } 
    552     g.drawImage(bi,(x+x_)*z,(y+y_)*z,bi.getWidth()*z,bi.getHeight()*z,null); 
     551    if(s.gvars.parseBoolean(visible)==true )g.drawImage(bi,(x+x_)*z,(y+y_)*z,bi.getWidth()*z,bi.getHeight()*z,null); 
    553552    if(selected) { 
    554553      g.setColor(Color.RED); 
  • trunk/src/vlcskineditor/items/Image.java

    r106 r107  
    380380  } 
    381381  public void draw(Graphics2D g,int x_, int y_, int z) { 
    382     if(!created) return; 
    383     if(s.gvars.parseBoolean(visible)==false) return; 
     382    if(!created) return;     
    384383    java.awt.image.BufferedImage bi = s.getBitmapImage(image); 
    385     g.drawImage(bi,(x+x_)*z,(y+y_)*z,bi.getWidth()*z,bi.getHeight()*z,null); 
     384    if(s.gvars.parseBoolean(visible)==true) g.drawImage(bi,(x+x_)*z,(y+y_)*z,bi.getWidth()*z,bi.getHeight()*z,null); 
    386385    if(selected) { 
    387386      g.setColor(Color.RED); 
  • trunk/src/vlcskineditor/items/Playtree.java

    r106 r107  
    643643    g.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON ); 
    644644    if(!created) return; 
    645     if(s.gvars.parseBoolean(visible)==false) return; 
    646     Font f = s.getFont(font); 
    647     g.setFont(f); 
    648     FontMetrics fm = g.getFontMetrics(); 
    649     if(!bgimage.equals("none")) { 
    650       g.drawImage(s.getBitmapImage(bgimage).getSubimage(0, 0, width, height),0,0,null); 
    651    
    652     else {       
    653       g.setColor(Color.decode(bgcolor1)); 
    654       g.fillRect(0,0,width,height); 
    655       for(int i=fm.getHeight();i<height;i=i+fm.getHeight()*2) { 
    656         g.setColor(Color.decode(bgcolor2)); 
    657         g.fillRect(x,0+i,width,fm.getHeight()); 
    658      
    659    
    660     int liney = 0;     
    661     BufferedImage cfi = s.getBitmapImage(closedimage); 
    662     BufferedImage ofi = s.getBitmapImage(openimage); 
    663     BufferedImage iti = s.getBitmapImage(itemimage); 
    664     int lineheight = fm.getHeight();     
    665     int cfi_offset=0,ofi_offset=0,iti_offset=0; 
    666     if(cfi!=null) { 
    667       if(cfi.getHeight()>lineheight) lineheight=cfi.getHeight(); 
    668        cfi_offset = (lineheight-cfi.getHeight())/2; 
    669    
    670     if(ofi!=null) { 
    671       if(ofi.getHeight()>lineheight) lineheight=ofi.getHeight(); 
    672       ofi_offset = (lineheight-ofi.getHeight())/2; 
    673    
    674     if(iti!=null) { 
    675       if(iti.getHeight()>lineheight) lineheight=iti.getHeight(); 
    676       iti_offset = (lineheight-iti.getHeight())/2;  
    677    
    678     int text_offset = (lineheight-fm.getAscent())/2;       
    679      
    680     g.setColor(Color.decode(fgcolor)); 
    681     if(cfi!=null && !flat) {         
    682       g.drawImage(cfi,0,liney+cfi_offset,null); 
    683       liney+=lineheight; 
    684       g.drawString("Closed folder",0+cfi.getWidth()+2,liney-text_offset);           
    685    
    686     if(ofi!=null && !flat) { 
    687       g.drawImage(ofi,0,liney+ofi_offset,null); 
    688       liney+=lineheight; 
    689       g.drawString("Open folder",0+ofi.getWidth()+2,liney-text_offset);           
    690    
    691     if(ofi!=null && iti!=null && !flat) { 
    692       g.drawImage(iti,0+ofi.getWidth()+2,liney+iti_offset,null); 
    693       liney+=lineheight; 
    694       g.drawString("Normal item",0+ofi.getWidth()+iti.getWidth()+4,liney-text_offset); 
    695    
    696     else if(iti!=null) { 
    697       g.drawImage(iti,0,liney+iti_offset,null); 
    698       liney+=fm.getHeight(); 
    699       g.drawString("Normal item",0+iti.getWidth()+4,liney-text_offset); 
    700    
    701     else { 
    702       liney+=fm.getHeight(); 
    703       g.drawString("Normal item",0,liney-text_offset); 
    704    
    705     g.setColor(Color.decode(playcolor)); 
    706     if(ofi!=null && iti!=null && !flat) { 
    707       g.drawImage(iti,0+ofi.getWidth()+2,liney+iti_offset,null); 
    708       liney+=lineheight; 
    709       g.drawString("Playing item",0+ofi.getWidth()+iti.getWidth()+4,liney-text_offset); 
    710    
    711     else if(iti!=null) { 
    712       g.drawImage(iti,0,liney+iti_offset,null); 
    713       liney+=lineheight; 
    714       g.drawString("Playing item",0+iti.getWidth()+2,liney-text_offset); 
    715    
    716     else { 
    717       liney+=lineheight; 
    718       g.drawString("Playing item",0,liney-text_offset); 
    719    
    720     g.setColor(Color.decode(selcolor)); 
    721     g.fillRect(0,liney,width,lineheight); 
    722     g.setColor(Color.decode(fgcolor)); 
    723     if(ofi!=null && iti!=null && !flat) { 
    724       g.drawImage(iti,0+ofi.getWidth()+2,liney+iti_offset,null); 
    725       liney+=lineheight; 
    726       g.drawString("Selected item",0+ofi.getWidth()+iti.getWidth()+4,liney-text_offset); 
    727    
    728     else if(iti!=null) { 
    729       g.drawImage(iti,0,liney+iti_offset,null); 
    730       liney+=lineheight; 
    731       g.drawString("Selected item",0+iti.getWidth()+2,liney-text_offset); 
    732    
    733     else { 
    734       liney+=lineheight; 
    735       g.drawString("Selected item",0,liney-text_offset); 
    736    
    737      
    738     g_.drawImage(buffi, (x+x_)*z, (y+y_)*z, width*z, height*z, null); 
    739     slider.draw(g_,1); 
    740      
     645    if(s.gvars.parseBoolean(visible)==true) { 
     646      Font f = s.getFont(font); 
     647      g.setFont(f); 
     648      FontMetrics fm = g.getFontMetrics(); 
     649      if(!bgimage.equals("none")) { 
     650        g.drawImage(s.getBitmapImage(bgimage).getSubimage(0, 0, width, height),0,0,null); 
     651     
     652      else { 
     653        g.setColor(Color.decode(bgcolor1)); 
     654        g.fillRect(0,0,width,height); 
     655        for(int i=fm.getHeight();i<height;i=i+fm.getHeight()*2) { 
     656          g.setColor(Color.decode(bgcolor2)); 
     657          g.fillRect(x,0+i,width,fm.getHeight()); 
     658       
     659     
     660      int liney = 0; 
     661      BufferedImage cfi = s.getBitmapImage(closedimage); 
     662      BufferedImage ofi = s.getBitmapImage(openimage); 
     663      BufferedImage iti = s.getBitmapImage(itemimage); 
     664      int lineheight = fm.getHeight(); 
     665      int cfi_offset=0,ofi_offset=0,iti_offset=0; 
     666      if(cfi!=null) { 
     667        if(cfi.getHeight()>lineheight) lineheight=cfi.getHeight(); 
     668         cfi_offset = (lineheight-cfi.getHeight())/2; 
     669     
     670      if(ofi!=null) { 
     671        if(ofi.getHeight()>lineheight) lineheight=ofi.getHeight(); 
     672        ofi_offset = (lineheight-ofi.getHeight())/2; 
     673     
     674      if(iti!=null) { 
     675        if(iti.getHeight()>lineheight) lineheight=iti.getHeight(); 
     676        iti_offset = (lineheight-iti.getHeight())/2; 
     677     
     678      int text_offset = (lineheight-fm.getAscent())/2; 
     679 
     680      g.setColor(Color.decode(fgcolor)); 
     681      if(cfi!=null && !flat) { 
     682        g.drawImage(cfi,0,liney+cfi_offset,null); 
     683        liney+=lineheight; 
     684        g.drawString("Closed folder",0+cfi.getWidth()+2,liney-text_offset); 
     685     
     686      if(ofi!=null && !flat) { 
     687        g.drawImage(ofi,0,liney+ofi_offset,null); 
     688        liney+=lineheight; 
     689        g.drawString("Open folder",0+ofi.getWidth()+2,liney-text_offset); 
     690     
     691      if(ofi!=null && iti!=null && !flat) { 
     692        g.drawImage(iti,0+ofi.getWidth()+2,liney+iti_offset,null); 
     693        liney+=lineheight; 
     694        g.drawString("Normal item",0+ofi.getWidth()+iti.getWidth()+4,liney-text_offset); 
     695     
     696      else if(iti!=null) { 
     697        g.drawImage(iti,0,liney+iti_offset,null); 
     698        liney+=fm.getHeight(); 
     699        g.drawString("Normal item",0+iti.getWidth()+4,liney-text_offset); 
     700     
     701      else { 
     702        liney+=fm.getHeight(); 
     703        g.drawString("Normal item",0,liney-text_offset); 
     704     
     705      g.setColor(Color.decode(playcolor)); 
     706      if(ofi!=null && iti!=null && !flat) { 
     707        g.drawImage(iti,0+ofi.getWidth()+2,liney+iti_offset,null); 
     708        liney+=lineheight; 
     709        g.drawString("Playing item",0+ofi.getWidth()+iti.getWidth()+4,liney-text_offset); 
     710     
     711      else if(iti!=null) { 
     712        g.drawImage(iti,0,liney+iti_offset,null); 
     713        liney+=lineheight; 
     714        g.drawString("Playing item",0+iti.getWidth()+2,liney-text_offset); 
     715     
     716      else { 
     717        liney+=lineheight; 
     718        g.drawString("Playing item",0,liney-text_offset); 
     719     
     720      g.setColor(Color.decode(selcolor)); 
     721      g.fillRect(0,liney,width,lineheight); 
     722      g.setColor(Color.decode(fgcolor)); 
     723      if(ofi!=null && iti!=null && !flat) { 
     724        g.drawImage(iti,0+ofi.getWidth()+2,liney+iti_offset,null); 
     725        liney+=lineheight; 
     726        g.drawString("Selected item",0+ofi.getWidth()+iti.getWidth()+4,liney-text_offset); 
     727     
     728      else if(iti!=null) { 
     729        g.drawImage(iti,0,liney+iti_offset,null); 
     730        liney+=lineheight; 
     731        g.drawString("Selected item",0+iti.getWidth()+2,liney-text_offset); 
     732     
     733      else { 
     734        liney+=lineheight; 
     735        g.drawString("Selected item",0,liney-text_offset); 
     736     
     737 
     738      g_.drawImage(buffi, (x+x_)*z, (y+y_)*z, width*z, height*z, null); 
     739      slider.draw(g_,1); 
     740    } 
    741741    if(selected) { 
    742742      g_.setColor(Color.RED); 
  • trunk/src/vlcskineditor/items/Slider.java

    r106 r107  
    553553    offsetx=x_; 
    554554    offsety=y_; 
    555     if(s.gvars.parseBoolean(visible)==false) return;         
    556     if(sbg!=null) { 
     555    boolean vis = s.gvars.parseBoolean(visible); 
     556    if(sbg!=null && vis) { 
    557557      sbg.draw(g,x+x_,y+y_,z); 
    558558      sbg.setOffset(x+offsetx,y+offsety); 
    559559    }     
    560     java.awt.image.BufferedImage si = s.getBitmapImage(up); 
    561     if(si==null) return; 
     560    java.awt.image.BufferedImage si = s.getBitmapImage(up);     
    562561    Point2D.Float p = b.getPoint(s.gvars.getSliderValue()); 
    563     g.drawImage(si,(int)(p.getX()+x+x_-si.getWidth()/2)*z,(int)(p.getY()+y+y_-si.getHeight()/2)*z,si.getWidth()*z,si.getHeight()*z,null); 
     562    if(vis && si!=null) g.drawImage(si,(int)(p.getX()+x+x_-si.getWidth()/2)*z,(int)(p.getY()+y+y_-si.getHeight()/2)*z,si.getWidth()*z,si.getHeight()*z,null); 
    564563    if(selected) { 
    565564      g.setColor(Color.RED); 
  • trunk/src/vlcskineditor/items/Text.java

    r106 r107  
    410410  public void draw(Graphics2D g, int x_, int y_, int z) { 
    411411    if(!created || font==null) return; 
    412     if(s.gvars.parseBoolean(visible)==false) return; 
     412     
    413413    Font f = s.getFont(font); 
    414414    if(f==null) { 
     
    422422      }       
    423423    }     
    424     g.setFont(f); 
    425     g.setColor(Color.decode(color))
    426     BufferedImage bi
    427     String ptext = s.gvars.parseString(text); 
    428     if(width==0) { 
    429       bi = new BufferedImage((int)g.getFontMetrics().getStringBounds(ptext,g).getWidth(),g.getFontMetrics().getHeight(),BufferedImage.TYPE_INT_ARGB); 
    430     } 
    431     else bi = new BufferedImage(width,g.getFontMetrics().getHeight(),BufferedImage.TYPE_INT_ARGB); 
    432     Graphics2D g2d = bi.createGraphics();     
    433     g2d.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON ); 
    434     g2d.setFont(f); 
    435     g2d.setColor(Color.decode(color)); 
    436     if(width!=0 && alignment.equals("right")) { 
    437       g2d.drawString(ptext,(int)(width-g2d.getFontMetrics().getStringBounds(ptext,g).getWidth()),0+g2d.getFontMetrics().getAscent()); 
    438     }     
    439     else if(width!=0 && alignment.equals("center")) { 
    440       g2d.drawString(ptext,(int)((width-g2d.getFontMetrics().getStringBounds(ptext,g).getWidth())/2),0+g2d.getFontMetrics().getAscent()); 
    441     } 
    442     else { 
    443       g2d.drawString(ptext,0,0+g2d.getFontMetrics().getAscent());   
    444     }    
    445     g.drawImage(bi,(x+x_)*z,(y+y_)*z,bi.getWidth()*z, bi.getHeight()*z,null);   
     424    if(s.gvars.parseBoolean(visible)==true) { 
     425      BufferedImage bi
     426      String ptext = s.gvars.parseString(text)
     427      if(width==0) { 
     428        bi = new BufferedImage((int)g.getFontMetrics().getStringBounds(ptext,g).getWidth(),g.getFontMetrics().getHeight(),BufferedImage.TYPE_INT_ARGB); 
     429      } 
     430      else bi = new BufferedImage(width,g.getFontMetrics().getHeight(),BufferedImage.TYPE_INT_ARGB); 
     431      Graphics2D g2d = bi.createGraphics(); 
     432      g2d.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON ); 
     433      g2d.setFont(f); 
     434      g2d.setColor(Color.decode(color)); 
     435      if(width!=0 && alignment.equals("right")) { 
     436        g2d.drawString(ptext,(int)(width-g2d.getFontMetrics().getStringBounds(ptext,g).getWidth()),0+g2d.getFontMetrics().getAscent()); 
     437      } 
     438      else if(width!=0 && alignment.equals("center")) { 
     439        g2d.drawString(ptext,(int)((width-g2d.getFontMetrics().getStringBounds(ptext,g).getWidth())/2),0+g2d.getFontMetrics().getAscent()); 
     440      } 
     441      else { 
     442        g2d.drawString(ptext,0,0+g2d.getFontMetrics().getAscent()); 
     443      } 
     444      g.drawImage(bi,(x+x_)*z,(y+y_)*z,bi.getWidth()*z, bi.getHeight()*z,null); 
     445    } 
    446446    if(selected) { 
    447447      g.setColor(Color.RED); 
  • trunk/src/vlcskineditor/items/Video.java

    r106 r107  
    351351  public void draw(Graphics2D g, int x_, int y_, int z) { 
    352352    if(!created) return; 
    353     if(s.gvars.parseBoolean(visible)==false) return; 
     353     
    354354    g.setColor(Color.BLACK); 
    355     g.fillRect((x+x_)*z,(y+y_)*z,width*z,height*z);    
     355    if(s.gvars.parseBoolean(visible)==true) g.fillRect((x+x_)*z,(y+y_)*z,width*z,height*z); 
    356356    if(selected) { 
    357357      g.setColor(Color.RED);