Changeset 50

Show
Ignore:
Timestamp:
12/10/07 13:07:07 (1 year ago)
Author:
altglass
Message:

package creation script + latest source

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk

    • Property svn:ignore changed from
      dist
      registry-3.13-win32-src
      src_bak
      build
      no_svn
      to
      dist
      registry-3.13-win32-src
      src_bak
      build
      no_svn
      VLCSkinEditor.jar
  • trunk/src/vlcskineditor/Bezier.java

    r48 r50  
    236236  /** x^n */ 
    237237  private float power( float x, int n ) { 
    238     if( n > 0 ) 
    239         return x * (float)Math.pow( x, n - 1); 
    240     else 
    241         return 1; 
     238    return (float)Math.pow( x, n ); 
    242239  }  
    243240  
  • trunk/src/vlcskineditor/GlobalVariables.java

    r48 r50  
    7474  boolean dvd_isActive = false; 
    7575   
    76   float slider_value = 0f; 
     76  float slider_value = 0.5f; 
    7777   
    7878  JFrame frame; 
  • trunk/src/vlcskineditor/Items/Anchor.java

    r45 r50  
    4949  JButton ok_btn, help_btn; 
    5050   
     51  Bezier b; 
     52  int[] xpos,ypos; 
     53   
    5154  /** Creates a new instance of Anchor */ 
    5255  public Anchor(String xmlcode, Skin s_) { 
    5356    s=s_; 
    5457    if (xmlcode.indexOf(" points=\"")!=-1) points = XML.getValue(xmlcode,"points"); 
     58    updateBezier(); 
    5559    priority = XML.getIntValue(xmlcode,"priority"); 
    5660    if (xmlcode.indexOf(" range=\"")!=-1) range = XML.getIntValue(xmlcode,"range"); 
     
    6569    priority = 0; 
    6670    id = "Anchor #"+s.getNewId(); 
     71    updateBezier(); 
    6772    showOptions(); 
     73  } 
     74  public void updateBezier() { 
     75    String[] pnts = points.split("\\),\\("); 
     76    xpos = new int[pnts.length]; 
     77    ypos = new int[pnts.length]; 
     78    for(int i=0;i<pnts.length;i++) { 
     79      String pnt = pnts[i];       
     80      String[] coords = pnt.split(",");         
     81      xpos[i] = Integer.parseInt(coords[0].replaceAll("\\(","")); 
     82      ypos[i] = Integer.parseInt(coords[1].replaceAll("\\)","")); 
     83    }           
     84    b = new Bezier(xpos,ypos,Bezier.kCoordsBoth); 
    6885  } 
    6986  public void update(String id_, int p_, String lt_, int x_, int y_, String pts_, int r_) { 
     
    7592    points=pts_; 
    7693    range=r_; 
     94    updateBezier(); 
    7795    s.updateItems(); 
    7896    s.expandItem(id); 
     
    149167      range_l.setBounds(5,105,75,24); 
    150168      range_tf.setBounds(85,105,150,24); 
    151       bounds.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.DARK_GRAY), "Boundaries"));        
     169      bounds.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Boundaries"));        
    152170      bounds.setMinimumSize(new Dimension(240,140)); 
    153171      bounds.setPreferredSize(new Dimension(240,140)); 
     
    218236  public void draw(Graphics2D g,int x_,int y_) { 
    219237    if(selected) {         
    220       String[] pnts = points.split("\\),\\("); 
    221       int[] xpos = new int[pnts.length]; 
    222       int[] ypos = new int[pnts.length]; 
    223       for(int i=0;i<pnts.length;i++) { 
    224         String pnt = pnts[i];       
    225         String[] coords = pnt.split(",");         
    226         xpos[i] = Integer.parseInt(coords[0].replaceAll("\\(",""))+x+x_; 
    227         ypos[i] = Integer.parseInt(coords[1].replaceAll("\\)",""))+y+y_; 
    228       } 
    229238      g.setColor(Color.RED); 
    230       g.drawPolyline(xpos,ypos,pnts.length); 
     239      for(float f=0f;f<=1f;f=f+0.1f) { 
     240        Point2D.Float p1 = b.getPoint(f); 
     241        Point2D.Float p2 = b.getPoint(f+0.1f);         
     242        g.drawLine((int)p1.getX()+x+x_,(int)p1.getY()+y+y_,(int)p2.getX()+x+x_,(int)p2.getY()+y+y_); 
     243      } 
     244      for(int i=0;i<xpos.length;i++) { 
     245        g.fillOval(xpos[i]+x+x_-1,ypos[i]+y+y_-1,3,3); 
     246      } 
    231247    } 
    232248  } 
    233249  public boolean contains(int x_, int y_) { 
    234     String[] pnts = points.split("\\),\\("); 
    235     Path2D.Double path = new Path2D.Double(); 
    236     for(int i=0;i<pnts.length;i++) { 
    237       String pnt = pnts[i];       
    238       String[] coords = pnt.split(",");         
    239       int xpos = Integer.parseInt(coords[0].replaceAll("\\(",""))+x+x_; 
    240       int ypos = Integer.parseInt(coords[1].replaceAll("\\)",""))+y+y_; 
    241       if(i==0) path.moveTo(xpos,ypos); 
    242       else path.lineTo(xpos,ypos); 
    243     } 
    244     return(path.getBounds2D().contains(x_,y_)); 
     250    int h = b.getHeight(); 
     251    int w = b.getWidth(); 
     252    return (x_>=x+offsetx && x_<=x+offsetx+w && y_>=y+offsety && y_<=y+offsety+h);   
    245253  } 
    246254  public DefaultMutableTreeNode getTreeNode() { 
  • trunk/src/vlcskineditor/Items/Slider.java

    r48 r50  
    511511    int h = b.getHeight(); 
    512512    int w = b.getWidth(); 
    513     return (x_>=x+offsetx && x_<=x+offsetx+w && y_>=y+offsety && y<=y+offsety+h);    
     513    return (x_>=x+offsetx && x_<=x+offsetx+w && y_>=y+offsety && y_<=y+offsety+h);    
    514514  } 
    515515  public DefaultMutableTreeNode getTreeNode() { 
  • trunk/src/vlcskineditor/Main.java

    r48 r50  
    4646 */ 
    4747public class Main extends javax.swing.JFrame implements ActionListener, TreeSelectionListener, WindowListener, MouseListener{ 
    48   final String VERSION = "0.5.0a"; 
     48  public final String VERSION = "0.5.0a"; 
    4949  String vlc_dir = ""; 
    5050  String vlc_skins_dir = ""; 
     
    9797  PreviewWindow pvwin; 
    9898  public boolean saved = false; 
    99   boolean opening = false; 
    100   int res_tree_sel_x, res_tree_sel_y; 
     99  boolean opening = false;   
    101100   
    102101  /** Launches the skin editor and initializes GUI and Skin DOM*/ 
     
    486485    items_add_pu_video.addActionListener(this); 
    487486    items_add_pu.add(items_add_pu_video); 
    488     jdesk.add(items_add_pu);    
    489      
     487    jdesk.add(items_add_pu);      
    490488     
    491489    jdesk.setMinimumSize(new Dimension(800,600)); 
     
    12341232      else if(e.getSource().equals(items_tree)) actionPerformed(new ActionEvent(items_edit,ActionEvent.ACTION_FIRST,"Doubleclick")); 
    12351233    } 
     1234    else { 
     1235      if(e.getSource().equals(res_tree)) { 
     1236        TreePath tp = res_tree.getSelectionPath(); 
     1237        if(tp==null) return; 
     1238        if(res_tree.isExpanded(tp)) res_tree.collapsePath(tp); 
     1239        else res_tree.expandPath(tp); 
     1240      } 
     1241      else if(e.getSource().equals(win_tree)) { 
     1242        TreePath tp = win_tree.getSelectionPath(); 
     1243        if(tp==null) return; 
     1244        if(win_tree.isExpanded(tp)) win_tree.collapsePath(tp); 
     1245        else win_tree.expandPath(tp); 
     1246      } 
     1247      else if(e.getSource().equals(items_tree)) { 
     1248        TreePath tp = items_tree.getSelectionPath(); 
     1249        if(tp==null) return; 
     1250        if(items_tree.isExpanded(tp)) items_tree.collapsePath(tp); 
     1251        else items_tree.expandPath(tp); 
     1252      } 
     1253    } 
    12361254  } 
    12371255  public void mousePressed(MouseEvent e) {} 
  • trunk/src/vlcskineditor/SliderBGGen.java

    r48 r50  
    4545  JRadioButton ltr_rb, btt_rb; 
    4646   
    47   JSeparator horz_s; 
    48   JButton prev_btn, next_btn, cancel_btn, finish_btn; 
     47  JSeparator step1_horz_s; 
     48  JButton step1_next_btn, step1_cancel_btn; 
     49  JTextField width_tf, height_tf; 
     50   
     51  JPanel card_step2; 
     52   
     53  JTextField bg_tf, e1_tf, md_tf, e2_tf; 
     54  JButton bg_btn, e1_btn, md_btn, e2_btn; 
     55  JFileChooser bg_fc, e1_fc, md_fc, e2_fc; 
     56  JButton step2_prev_btn, step2_finish_btn, step2_cancel_btn; 
    4957   
    5058  public ImageIcon editor_icon = createIcon("icons/editor.png"); 
     
    6169    setLayout(layout); 
    6270     
    63     horz_s = new JSeparator(SwingConstants.HORIZONTAL); 
    64     prev_btn = new JButton("< Previous"); 
    65     prev_btn.addActionListener(this);     
    66     next_btn = new JButton("Next >"); 
    67     next_btn.addActionListener(this); 
    68     cancel_btn = new JButton("Cancel"); 
    69     cancel_btn.addActionListener(this); 
    70     finish_btn = new JButton("Finish"); 
    71     finish_btn.addActionListener(this); 
    72      
    73     JLabel header_text_l = new JLabel("<html><body style=\"background:#babdb6;width:540px;\"><h1>&nbsp;Slider Background Generator</h1></body></html>");   
    74      
    75     header_text_l.setBounds(0,0,540,50); 
     71    Color header_bgc = getBackground().darker().darker();     
     72    String header_bgh = "#"; 
     73    if(header_bgc.getRed()<16) header_bgh+="0"; 
     74    header_bgh+=Integer.toHexString(header_bgc.getRed()).toUpperCase(); 
     75    if(header_bgc.getGreen()<16) header_bgh+="0"; 
     76    header_bgh+=Integer.toHexString(header_bgc.getGreen()).toUpperCase(); 
     77    if(header_bgc.getBlue()<16) header_bgh+="0"; 
     78    header_bgh+=Integer.toHexString(header_bgc.getBlue()).toUpperCase();    
     79     
     80    String header_str = "<html><body style=\"background:"+header_bgh+";color:#FFFFFF;width:540px;\"><h1>&nbsp;Slider Background Generator</h1></body></html>"; 
     81     
     82     
    7683     
    7784    card_step1 = new JPanel(null);     
    78     card_step1.add(header_text_l); 
     85    JLabel header1_l = new JLabel(header_str);      
     86    header1_l.setBounds(0,0,540,50); 
     87    card_step1.add(header1_l);  
     88     
    7989    JLabel welcome_l = new JLabel("<html>Welcome to the slider background generator.<br>" + 
    80                                   "As a first step, please choose whether the slider is going from left to right or from the bottom to the top.</html>");     
     90                                  "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.</html>");     
    8191    card_step1.add(welcome_l);     
    8292    welcome_l.setBounds(5,25,630,100); 
     
    102112    dir_bg.add(btt_rb); 
    103113     
    104     card_step1.add(horz_s); 
    105     card_step1.add(next_btn); 
    106     card_step1.add(cancel_btn); 
    107      
    108     card_step1.setSize(540,400); 
    109      
    110     horz_s.setBounds(5,345,525,5); 
    111     prev_btn.setBounds(290,350,75,20); 
    112     next_btn.setBounds(370,350,75,20); 
    113     cancel_btn.setBounds(450,350,75,20); 
    114     finish_btn.setBounds(370,350,75,20); 
    115      
    116     add(card_step1,STEP1);     
     114    JSeparator horz2_s = new JSeparator(JSeparator.HORIZONTAL); 
     115    card_step1.add(horz2_s); 
     116    horz2_s.setBounds(5,215,525,215);     
     117     
     118    JLabel width_l = new JLabel("Width:"); 
     119    width_tf = new JTextField();     
     120     
     121    card_step1.add(width_l); 
     122    width_l.setBounds(5,230,75,25); 
     123    card_step1.add(width_tf); 
     124    width_tf.setBounds(80,230,150,25); 
     125     
     126    JLabel height_l = new JLabel("Height:"); 
     127    height_tf = new JTextField(); 
     128     
     129    card_step1.add(height_l); 
     130    height_l.setBounds(5,265,75,25); 
     131    card_step1.add(height_tf); 
     132    height_tf.setBounds(80,265,150,25); 
     133     
     134    step1_horz_s = new JSeparator(JSeparator.HORIZONTAL);    
     135    step1_next_btn = new JButton("Next >"); 
     136    step1_next_btn.addActionListener(this); 
     137    step1_cancel_btn = new JButton("Cancel"); 
     138    step1_cancel_btn.addActionListener(this); 
     139     
     140    card_step1.add(step1_horz_s); 
     141    card_step1.add(step1_next_btn); 
     142    card_step1.add(step1_cancel_btn); 
     143     
     144    step1_horz_s.setBounds(5,345,525,5);     
     145    step1_next_btn.setBounds(370,350,75,20); 
     146    step1_cancel_btn.setBounds(450,350,75,20);     
     147     
     148    card_step1.setSize(540,400);    
     149     
     150    add(card_step1,STEP1);    
     151     
     152    card_step2 = new JPanel(null); 
     153    JLabel header2_l = new JLabel(header_str);      
     154    header2_l.setBounds(0,0,540,50); 
     155    card_step2.add(header2_l);  
     156     
     157   
     158    add(card_step2,STEP2); 
     159     
     160     
     161     
    117162    setSize(540,400); 
    118163    setResizable(false); 
    119164  } 
    120165  public void actionPerformed(ActionEvent e) { 
    121      
     166    if(e.getSource().equals(step1_cancel_btn)) { 
     167      System.exit(1); 
     168    } 
     169    else if (e.getSource().equals(step1_next_btn)) { 
     170      layout.show(getContentPane(),STEP2); 
     171    } 
    122172  } 
    123173  /**