Changeset 50
- Timestamp:
- 12/10/07 13:07:07 (1 year ago)
- Files:
-
- trunk (modified) (1 prop)
- trunk/make-zip-win32.bat (added)
- trunk/make-zip-win32.sh (added)
- trunk/src/vlcskineditor/Bezier.java (modified) (1 diff)
- trunk/src/vlcskineditor/GlobalVariables.java (modified) (1 diff)
- trunk/src/vlcskineditor/Items/Anchor.java (modified) (5 diffs)
- trunk/src/vlcskineditor/Items/Slider.java (modified) (1 diff)
- trunk/src/vlcskineditor/Main.java (modified) (4 diffs)
- trunk/src/vlcskineditor/SliderBGGen.java (modified) (3 diffs)
- trunk/src/vlcskineditor/icons/sliderbg_btt.png (added)
- trunk/src/vlcskineditor/icons/sliderbg_ltr.png (added)
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
- Property svn:ignore changed from
trunk/src/vlcskineditor/Bezier.java
r48 r50 236 236 /** x^n */ 237 237 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 ); 242 239 } 243 240 trunk/src/vlcskineditor/GlobalVariables.java
r48 r50 74 74 boolean dvd_isActive = false; 75 75 76 float slider_value = 0 f;76 float slider_value = 0.5f; 77 77 78 78 JFrame frame; trunk/src/vlcskineditor/Items/Anchor.java
r45 r50 49 49 JButton ok_btn, help_btn; 50 50 51 Bezier b; 52 int[] xpos,ypos; 53 51 54 /** Creates a new instance of Anchor */ 52 55 public Anchor(String xmlcode, Skin s_) { 53 56 s=s_; 54 57 if (xmlcode.indexOf(" points=\"")!=-1) points = XML.getValue(xmlcode,"points"); 58 updateBezier(); 55 59 priority = XML.getIntValue(xmlcode,"priority"); 56 60 if (xmlcode.indexOf(" range=\"")!=-1) range = XML.getIntValue(xmlcode,"range"); … … 65 69 priority = 0; 66 70 id = "Anchor #"+s.getNewId(); 71 updateBezier(); 67 72 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); 68 85 } 69 86 public void update(String id_, int p_, String lt_, int x_, int y_, String pts_, int r_) { … … 75 92 points=pts_; 76 93 range=r_; 94 updateBezier(); 77 95 s.updateItems(); 78 96 s.expandItem(id); … … 149 167 range_l.setBounds(5,105,75,24); 150 168 range_tf.setBounds(85,105,150,24); 151 bounds.setBorder(BorderFactory.createTitledBorder(BorderFactory.create LineBorder(Color.DARK_GRAY), "Boundaries"));169 bounds.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Boundaries")); 152 170 bounds.setMinimumSize(new Dimension(240,140)); 153 171 bounds.setPreferredSize(new Dimension(240,140)); … … 218 236 public void draw(Graphics2D g,int x_,int y_) { 219 237 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 }229 238 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 } 231 247 } 232 248 } 233 249 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); 245 253 } 246 254 public DefaultMutableTreeNode getTreeNode() { trunk/src/vlcskineditor/Items/Slider.java
r48 r50 511 511 int h = b.getHeight(); 512 512 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); 514 514 } 515 515 public DefaultMutableTreeNode getTreeNode() { trunk/src/vlcskineditor/Main.java
r48 r50 46 46 */ 47 47 public 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"; 49 49 String vlc_dir = ""; 50 50 String vlc_skins_dir = ""; … … 97 97 PreviewWindow pvwin; 98 98 public boolean saved = false; 99 boolean opening = false; 100 int res_tree_sel_x, res_tree_sel_y; 99 boolean opening = false; 101 100 102 101 /** Launches the skin editor and initializes GUI and Skin DOM*/ … … 486 485 items_add_pu_video.addActionListener(this); 487 486 items_add_pu.add(items_add_pu_video); 488 jdesk.add(items_add_pu); 489 487 jdesk.add(items_add_pu); 490 488 491 489 jdesk.setMinimumSize(new Dimension(800,600)); … … 1234 1232 else if(e.getSource().equals(items_tree)) actionPerformed(new ActionEvent(items_edit,ActionEvent.ACTION_FIRST,"Doubleclick")); 1235 1233 } 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 } 1236 1254 } 1237 1255 public void mousePressed(MouseEvent e) {} trunk/src/vlcskineditor/SliderBGGen.java
r48 r50 45 45 JRadioButton ltr_rb, btt_rb; 46 46 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; 49 57 50 58 public ImageIcon editor_icon = createIcon("icons/editor.png"); … … 61 69 setLayout(layout); 62 70 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> 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> Slider Background Generator</h1></body></html>"; 81 82 76 83 77 84 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 79 89 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>"); 81 91 card_step1.add(welcome_l); 82 92 welcome_l.setBounds(5,25,630,100); … … 102 112 dir_bg.add(btt_rb); 103 113 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 117 162 setSize(540,400); 118 163 setResizable(false); 119 164 } 120 165 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 } 122 172 } 123 173 /**
