Changeset 68
- Timestamp:
- 31/10/07 19:11:31 (1 year ago)
- Files:
-
- trunk/nbproject/genfiles.properties (modified) (1 diff)
- trunk/nbproject/project.properties (modified) (2 diffs)
- trunk/src/vlcskineditor/ActionEditor.java (modified) (8 diffs)
- trunk/src/vlcskineditor/ActionPanel.java (modified) (2 diffs)
- trunk/src/vlcskineditor/Bezier.java (modified) (1 diff)
- trunk/src/vlcskineditor/BooleanExpressionEvaluator.java (modified) (1 diff)
- trunk/src/vlcskineditor/Item.java (modified) (1 diff)
- trunk/src/vlcskineditor/Items/Anchor.java (modified) (4 diffs)
- trunk/src/vlcskineditor/Items/Group.java (modified) (2 diffs)
- trunk/src/vlcskineditor/Items/RadialSlider.java (modified) (2 diffs)
- trunk/src/vlcskineditor/Layout.java (modified) (11 diffs)
- trunk/src/vlcskineditor/Main.java (modified) (10 diffs)
- trunk/src/vlcskineditor/NumbersOnlyDocument.java (modified) (2 diffs)
- trunk/src/vlcskineditor/PreviewWindow.java (modified) (8 diffs)
- trunk/src/vlcskineditor/ProgressWindow.java (modified) (2 diffs)
- trunk/src/vlcskineditor/Resource.java (modified) (1 diff)
- trunk/src/vlcskineditor/Resources/Bitmap.java (modified) (8 diffs)
- trunk/src/vlcskineditor/Resources/BitmapFont.java (modified) (2 diffs)
- trunk/src/vlcskineditor/Resources/Font.java (modified) (4 diffs)
- trunk/src/vlcskineditor/Resources/SubBitmap.java (modified) (6 diffs)
- trunk/src/vlcskineditor/package.html (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/nbproject/genfiles.properties
r64 r68 6 6 nbproject/build-impl.xml.data.CRC32=9599816b 7 7 nbproject/build-impl.xml.script.CRC32=28555a9f 8 nbproject/build-impl.xml.stylesheet.CRC32= 65d7ca218 nbproject/build-impl.xml.stylesheet.CRC32=20b9345e trunk/nbproject/project.properties
r15 r68 31 31 ${build.classes.dir}:\ 32 32 ${libs.junit.classpath} 33 javadoc.additionalparam= 33 javadoc.additionalparam=-header "VLC Skin Editor" 34 34 javadoc.author=false 35 35 javadoc.encoding= … … 41 41 javadoc.use=true 42 42 javadoc.version=false 43 javadoc.windowtitle= 43 javadoc.windowtitle="VLC Skin Editor API Documentation" 44 44 main.class=vlcskineditor.Main 45 45 manifest.file=manifest.mf trunk/src/vlcskineditor/ActionEditor.java
r54 r68 29 29 30 30 /** 31 * ActionEditor 31 * A window representing a specific action chain, that allows the user to add 32 * actions to the chain. Actions are edited within the ActionPanels generated 33 * for each action in the chain 34 * @see ActionPanel 32 35 * @author Daniel Dreibrodt 33 36 */ 34 37 public class ActionEditor extends JFrame implements ActionListener{ 35 38 39 //The actions in the chain, respectively the Panels representing them 36 40 java.util.List<ActionPanel> aPanels = new LinkedList<ActionPanel>(); 37 41 … … 39 43 public ImageIcon delete_icon = createIcon("icons/delete.png"); 40 44 45 //The panel that handels the scrolling through the list of actions 41 46 JScrollPane sPane; 47 //The panel containing the actual ActionPanels 42 48 JPanel actions_p = new JPanel(); 43 JButton add_btn = new JButton(add_icon); 49 //Opens a PopupMenu from which the user can add an action to the end of the chain 50 JButton add_btn = new JButton(add_icon); 44 51 JButton ok_btn = new JButton("OK"); 45 52 … … 100 107 JMenuItem actions_windows_setLayout = new JMenuItem("Change the layout of a window"); 101 108 109 //The skin item to which the represented action chain belongs 102 110 Item parent; 103 111 … … 289 297 setResizable(false); 290 298 } 299 /** 300 * Generates the code by calling the getActionCode() function of each ActionPanel 301 * @see ActionPanel#getActionCode() 302 * @return A string readable by VLC representing the action chain 303 */ 291 304 public String getCode() { 292 305 String code = ""; … … 294 307 return code; 295 308 } 309 /** 310 * Replaces the current action chain by a new one 311 * @param a The action string 312 */ 296 313 public void updateActions(String a) { 297 314 actions_p.removeAll(); … … 301 318 actions_p.updateUI(); 302 319 } 320 /** 321 * Adds an action to the chain 322 * @param act The action string 323 */ 303 324 public void addAction(String act) { 304 325 act=act.trim(); … … 308 329 actions_p.updateUI(); 309 330 } 331 /** 332 * Shows the dialog for editing the given action 333 * @param a The action string to be edited 334 */ 310 335 public void editAction(String a) { 311 336 updateActions(a); 312 337 setVisible(true); 313 338 } 339 /** 340 * Reacts to user interaction 341 */ 314 342 public void actionPerformed(ActionEvent e) { 315 343 if(e.getSource().equals(add_btn)) actions_pu.show(add_btn,0,0); … … 332 360 } 333 361 } 362 /** 363 * Creates an ImageIcon out of a file 364 */ 334 365 public ImageIcon createIcon(String filename) { 335 366 java.awt.Image img = null; trunk/src/vlcskineditor/ActionPanel.java
r45 r68 28 28 29 29 /** 30 * A ctionPanel30 * A visual representation of a single action providing input components for modifying/deleting the represented action 31 31 * @author Daniel Dreibrodt 32 32 */ … … 175 175 setMaximumSize(new Dimension(445,30)); 176 176 } 177 /** 178 * Generates the action string from the type of the represented action and from user modifications. 179 * The string ends with a semicolon. 180 * @return A string readable by VLC representing the action that is represented by the panel 181 */ 177 182 public String getActionCode() { 178 183 if(action_type.equals("static")) return action; trunk/src/vlcskineditor/Bezier.java
r63 r68 27 27 28 28 /** 29 * Bezier 29 * Helper class for drawing beziers in sliders and anchors. 30 * Conversion of VLC /trunk/modules/gui/skins2/utils/bezier.cpp <br> 31 * original authors: Cyril Deguet <asmax@via.ecp.fr> and 32 * Olivier Teulière <ipkiss@via.ecp.fr> 30 33 * @author Daniel Dreibrodt 31 * Conversion of VLC /trunk/modules/gui/skins2/utils/bezier.cpp32 * original authors: Cyril Deguet <asmax@via.ecp.fr>33 * Olivier TeuliĆ©re <ipkiss@via.ecp.fr>34 34 */ 35 35 public class Bezier { trunk/src/vlcskineditor/BooleanExpressionEvaluator.java
r54 r68 26 26 27 27 /** 28 * BooleanExpressionEvaluator29 * conversion of vlc/trunk/modules/gui/skins2/parser/expr_evaluator.cpp 28 * Helper class to evaluate boolean expressions. 29 * conversion of vlc/trunk/modules/gui/skins2/parser/expr_evaluator.cpp. <br> 30 30 * Original code by Cyril Deguet <asmax@via.ecp.fr> 31 31 * @author Daniel Dreibrodt trunk/src/vlcskineditor/Item.java
r53 r68 74 74 /** Show a dialog to modify the items's parameters */ 75 75 public abstract void showOptions(); 76 /** Update the Item's attributes according to the user input */ 77 public abstract void update(); 76 78 /** Creates the XML code representing the item */ 77 79 public abstract String returnCode(); trunk/src/vlcskineditor/Items/Anchor.java
r56 r68 52 52 int[] xpos,ypos; 53 53 54 /** Creates a new instance of Anchor */ 54 /** 55 * Creates a new Anchor from XML. 56 * @param xmlcode The XML code from which the Anchor should be created. One line per tag. 57 * @param s_ The skin in which the Anchor is used. 58 */ 55 59 public Anchor(String xmlcode, Skin s_) { 56 60 s=s_; … … 66 70 created = true; 67 71 } 72 /** 73 * Creates a new Anchor from user input. 74 * @param s_ The Skin in which the Anchor is used. 75 */ 68 76 public Anchor(Skin s_) { 69 77 s = s_; … … 85 93 b = new Bezier(xpos,ypos,Bezier.kCoordsBoth); 86 94 } 87 public void update( String id_, int p_, String lt_, int x_, int y_, String pts_, int r_) {88 id=id_ ;89 priority= p_;90 lefttop=l t_;91 x= x_;92 y= y_;93 points=p ts_;94 range= r_;95 public void update() { 96 id=id_tf.getText(); 97 priority=Integer.parseInt(priority_tf.getText()); 98 lefttop=lefttop_cb.getSelectedItem().toString(); 99 x=Integer.parseInt(x_tf.getText()); 100 y=Integer.parseInt(y_tf.getText()); 101 points=points_tf.getText(); 102 range=Integer.parseInt(range_tf.getText()); 95 103 updateBezier(); 96 104 s.updateItems(); … … 211 219 } 212 220 frame.setVisible(false); 213 update( id_tf.getText(),Integer.parseInt(priority_tf.getText()),(String)lefttop_cb.getSelectedItem(),Integer.parseInt(x_tf.getText()),Integer.parseInt(y_tf.getText()),points_tf.getText(),Integer.parseInt(range_tf.getText()));221 update(); 214 222 } 215 223 else if(e.getSource().equals(help_btn)) { trunk/src/vlcskineditor/Items/Group.java
r56 r68 113 113 s.updateItems(); 114 114 } 115 public void update( String id_, int x_, int y_) {116 id=id_ ;117 x= x_;118 y= y_;115 public void update() { 116 id=id_tf.getText(); 117 x=Integer.parseInt(x_tf.getText()); 118 y=Integer.parseInt(y_tf.getText()); 119 119 for(Item i:items) { 120 120 i.setOffset(x,y); … … 197 197 } 198 198 frame.setVisible(false); 199 update( id_tf.getText(),Integer.parseInt(x_tf.getText()),Integer.parseInt(y_tf.getText()));199 update(); 200 200 } 201 201 else if(e.getSource().equals(help_btn)) { trunk/src/vlcskineditor/Items/RadialSlider.java
r37 r68 29 29 30 30 /** 31 * RadialSlider item 32 * Not planned to be implemented for use (to complicated to display^^) 31 * RadialSlider item. 32 * <i>Not planned to be implemented for use</i><br> 33 * If you know how RadialSliders actually work or are displayed, let me know or fill out the missing parts of this file. 33 34 * @author Daniel Dreibrodt 34 35 */ … … 70 71 showOptions(); 71 72 } 73 public void update() { 74 75 } 72 76 public void showOptions() { 73 77 trunk/src/vlcskineditor/Layout.java
r56 r68 60 60 boolean created = false; 61 61 62 /** Creates a new instance of Layout */ 62 /** 63 * Creates a new Layout from XML. 64 * @param xmlcode The XML code from which the Layout should be created. 65 * @param s_ The Skin in which the Layout is used. 66 */ 63 67 public Layout(String xmlcode, Skin s_) { 64 68 s=s_; … … 144 148 created = true; 145 149 } 150 /** 151 * Creates a new Layout from user input. 152 * @param s_ The Skin in which the Layout is used. 153 */ 146 154 public Layout(Skin s_) { 147 155 s=s_; … … 151 159 showOptions(); 152 160 } 153 public void update(String id_, int w_, int h_, int minw_, int minh_, int maxw_, int maxh_) { 154 id=id_; 155 width=w_; 156 height=h_; 157 minwidth=minw_; 158 minheight=minh_; 159 maxwidth=maxw_; 160 maxheight=maxh_; 161 /** 162 * Updates the Layout's attributes according to the user input. 163 */ 164 public void update() { 165 id=id_tf.getText(); 166 width=Integer.parseInt(width_tf.getText()); 167 height=Integer.parseInt(height_tf.getText()); 168 minwidth=Integer.parseInt(minwidth_tf.getText()); 169 minheight=Integer.parseInt(minheight_tf.getText()); 170 maxwidth=Integer.parseInt(maxwidth_tf.getText()); 171 maxheight=Integer.parseInt(maxheight_tf.getText()); 161 172 s.updateWindows(); 162 173 s.expandLayout(id); … … 164 175 frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE); 165 176 } 177 /** 178 * Shows a dialog to edit this Layout's attributes. 179 */ 166 180 public void showOptions() { 167 181 if(frame==null) { … … 267 281 frame.setVisible(true); 268 282 } 283 /** 284 * Handles the user interaction with the editing dialog. 285 */ 269 286 public void actionPerformed(ActionEvent e) { 270 287 if(e.getSource().equals(ok_btn)) { … … 288 305 } 289 306 frame.setVisible(false); 290 update( id_tf.getText(),Integer.parseInt(width_tf.getText()),Integer.parseInt(height_tf.getText()),Integer.parseInt(minwidth_tf.getText()),Integer.parseInt(minheight_tf.getText()),Integer.parseInt(maxwidth_tf.getText()),Integer.parseInt(maxheight_tf.getText()));307 update(); 291 308 } 292 309 else if(e.getSource().equals(help_btn)) { … … 314 331 } 315 332 } 333 /** 334 * Draws the Layout. 335 * @param g The Graphics2D context onto which the Layout will be drawn. 336 */ 316 337 public void draw(Graphics2D g) { 317 338 for(Item i:items) { … … 319 340 } 320 341 } 342 /** 343 * Generates the XML code represented by this Layout. 344 * @return The XML code. 345 */ 321 346 public String returnCode() { 322 347 String code ="<Layout"; … … 334 359 return code; 335 360 } 361 /** 362 * Creates a TreeNode visualizing this Layout in the windows and layouts tree. 363 * @return The TreeNode to display this Layout in a JTree. 364 */ 336 365 public DefaultMutableTreeNode getTreeNode() { 337 366 DefaultMutableTreeNode node = new DefaultMutableTreeNode("Layout: "+id); 338 367 return node; 339 368 } 369 /** 370 * Gets the Item of the given id if it is contained in the Layout. 371 * @param id_ The ID of the desired Item. 372 * @return If the Item was found the Item object is returned. Otherwise <pre>null</pre> is returned. 373 */ 340 374 public Item getItem(String id_) { 341 375 for(int x=0;x<items.size();x++) { … … 345 379 return null; 346 380 } 381 /** 382 * Gets the List in which the Item specified by the given ID is stored. 383 * @param id_ The ID of the desired Item. 384 * @return If the Item was found in the Layout the List containing the Item is returned. Otherwise <pre>null</pre> is returned. 385 * @see java.util.List 386 */ 347 387 public java.util.List<Item> getParentListOf(String id_) { 348 388 for(int x=0;x<items.size();x++) { … … 358 398 return null; 359 399 } 400 /** 401 * Gets the parent Item of the Item specified by the given ID. 402 * @param id_ The ID of the Item of which one wants the parent. 403 * @return If the Item was found in the Layout its parent is returned. Otherwise <pre>null</pre> is returned. 404 */ 360 405 public Item getParentOf(String id_) { 361 406 for(int x=0;x<items.size();x++) { trunk/src/vlcskineditor/Main.java
r67 r68 46 46 */ 47 47 public class Main extends javax.swing.JFrame implements ActionListener, TreeSelectionListener, WindowListener, MouseListener{ 48 /** 49 * The version identification of the current build. 50 */ 48 51 public final String VERSION = "0.6.0a"; 49 52 String vlc_dir = ""; … … 83 86 public ImageIcon down_icon = createIcon("icons/move_down.png"); 84 87 public ImageIcon help_icon = createIcon("icons/help.png"); 88 //The VLC Skin Editor icon. 85 89 public ImageIcon icon = createIcon("icons/icon.png"); 86 90 public ImageIcon open_icon = createIcon("icons/open.png"); … … 96 100 JFileChooser base_fc, bitmap_adder, font_adder, vlt_saver; 97 101 PreviewWindow pvwin; 102 //Specifies whether changes were made without having saved the skin. 98 103 public boolean saved = false; 104 //Specifies whether a file is currently being opened 99 105 boolean opening = false; 106 //Specifies if a file was opened 107 boolean opened = false; 100 108 101 /** Launches the skin editor and initializes GUI and Skin DOM*/ 109 /** 110 * Launches the skin editor and initializes the GUI. 111 * @param args Command line arguments passed by the console. 112 * If there exist one or more arguments, the first argument is intepreted as a file locator for a skin to be loaded. 113 */ 102 114 public Main(String[] args) { 103 115 setTitle("New skin - VLC Skin Editor "+VERSION); … … 541 553 else showWelcomeDialog(); 542 554 } 555 /** 556 * Shows a dialog from which the user can choose to either create a new skin, open an existing skin or quit the skin editor. 557 */ 543 558 public void showWelcomeDialog() { 544 559 Object[] options= {"Create a new skin", "Open an exisiting skin","Quit"}; … … 555 570 } 556 571 } 572 /** 573 * Shows the "Open File" dialog. 574 */ 557 575 public void openFile() { 558 576 opening = true; … … 562 580 if(returnVal == JFileChooser.APPROVE_OPTION) { 563 581 openFile(base_fc.getSelectedFile()); 582 opening = false; 564 583 } 565 584 else { 566 showWelcomeDialog();567 }568 opening = false;585 opening = false; 586 if(!opened) showWelcomeDialog(); 587 } 569 588 } 589 /** 590 * Opens the given file as a skin. 591 * @param f The skin file. 592 */ 570 593 public void openFile(File f) { 571 594 if(!f.exists()) { 572 595 JOptionPane.showMessageDialog(this,"The file \""+f.getPath()+"\" does not exist and thus could not be opened!","Error while opening file",JOptionPane.ERROR_MESSAGE); 573 showWelcomeDialog();596 if(!opened) showWelcomeDialog(); 574 597 return; 575 598 } … … 673 696 saved = true; 674 697 opening = false; 698 opened = true; 675 699 pwin.setVisible(false); 676 700 } 701 /** 702 * Shows a dialog to specify the new skin's location and creates an empty skin. 703 */ 677 704 public void createNew() { 678 705 base_fc.setFileFilter(new CustomFileFilter(base_fc,"xml","*.xml (VLC XML-Skin Files)",false,vlc_dir)); 679 706 int returnVal=base_fc.showSaveDialog(this); 680 707 if(returnVal != JFileChooser.APPROVE_OPTION) { 681 showWelcomeDialog();708 if(!opened) showWelcomeDialog(); 682 709 } 683 710 else { … … 690 717 selected_window = null; 691 718 selected_item = null; 692 saved=false; 719 saved = false; 720 opened = true; 693 721 } 694 722 } 695 /** Reacts to GUI actions */ 723 /** 724 * Reacts to GUI actions 725 */ 696 726 public void actionPerformed(ActionEvent e) { 697 727 // <editor-fold defaultstate="collapsed" desc="New File"> … … 1207 1237 } 1208 1238 1209 /** Reacts to tree selections */ 1239 /** 1240 * Reacts to tree selections 1241 */ 1210 1242 public void valueChanged(TreeSelectionEvent e) { 1211 1243 if(opening) return; … … 1306 1338 /** 1307 1339 * Creates an ImageIcon of an image included in the JAR 1308 * @param filename The path to the image file inside the JAR1309 * @return An ImageIcon representing the given file1340 * @param filename The path to the image file inside the JAR 1341 * @return An ImageIcon representing the given file 1310 1342 */ 1311 1343 public ImageIcon createIcon(String filename) { trunk/src/vlcskineditor/NumbersOnlyDocument.java
r17 r68 28 28 * NumbersOnlyDocument 29 29 * allows only numbers to be entered into a component 30 * @see javax.swing.text.Document 30 31 * @author Daniel Dreibrodt 31 32 */ … … 38 39 super(); 39 40 } 40 /** Creates a new instance of NumbersOnlyDocument that allows only positive numbers if [pre]negative[/pre] is false**/ 41 /** 42 * Creates a new instance of NumbersOnlyDocument that allows only positive numbers if <pre>negative</pre> is false* 43 */ 41 44 public NumbersOnlyDocument(boolean negative) { 42 45 super(); 43 46 allow_negative = negative; 44 47 } 45 /** Does nothing if [pre]str[/pre]is not a digit or a dash, otherwise calls the super function **/48 /** Does nothing if <pre>str</pre> is not a digit or a dash, otherwise calls the super function **/ 46 49 public void insertString(int offset, String str, AttributeSet a) throws BadLocationException { 47 50 if(str.matches("[-]") && allow_negative) { trunk/src/vlcskineditor/PreviewWindow.java
r56 r68 30 30 31 31 /** 32 * PreviewWindow 33 * The WYSIWYG renderer 32 * Handles the preview window and user interaction with it. 34 33 * @author Daniel Dreibrodt 35 34 */ 36 35 public class PreviewWindow extends JPanel implements MouseListener, MouseMotionListener { 37 36 37 /** 38 * The JFrame in which a Layout of a Skin will be shown. 39 */ 38 40 public JInternalFrame frame; 39 41 Layout l; … … 45 47 JMenuItem up, down, right, left; 46 48 47 /** Creates a new instance of PreviewWindow */ 49 /** 50 * Creates a new PreviewWindow that is initially hidden. 51 */ 48 52 public PreviewWindow() { 49 53 frame = new JInternalFrame("No Layout selected"); … … 55 59 addMouseMotionListener(this); 56 60 } 61 /** 62 * Is invoked when the user deselects a layout. 63 * All references to the old layout are cleared and the window is hidden. 64 * Additionally the FrameUpdater is stopped. 65 */ 57 66 public void clearLayout() { 58 67 l=null; … … 62 71 fu=null; 63 72 } 73 /** 74 * Invoked when the user selects a Layout. 75 * Shows the preview window and there draws the selected layout. 76 * @param w_ The Window containing the Layout. 77 * @param l_ The Layout that should be displayed. 78 */ 64 79 public void setLayout(Window w_, Layout l_) { 65 80 if(l_==null) { … … 81 96 } 82 97 } 98 /** 99 * Invoked when a user selects an Item. This tells the PreviewWindow which item should be moved when the user interacts with the window. 100 * @param i The Item selected by the user. 101 */ 83 102 public void selectItem(Item i) { 84 103 if(selected_item!=null) selected_item.setSelected(false); … … 87 106 selected_item.setSelected(true); 88 107 } 108 /** 109 * Paints the selected layout into the window. 110 * @param g The Graphics context into which is drawn. 111 */ 89 112 public void paint(Graphics g) { 90 113 if(l==null) return; … … 153 176 dragstartitemy=selected_item.y; 154 177 } 178 /** 179 * Moves the currently selected item about the given distance. 180 * @param x Movement along the X-Axis. 181 * @param y Movement along the Y-Axis. 182 */ 155 183 public void moveItem(int x, int y) { 156 184 try { … … 163 191 } 164 192 } 193 /** 194 * Creates an ImageIcon from a file. 195 */ 165 196 public ImageIcon createIcon(String filename) { 166 197 java.awt.Image img = null; trunk/src/vlcskineditor/ProgressWindow.java
r43 r68 27 27 28 28 /** 29 * ProgressWindow29 * A window displaying a progress bar running back and forth. 30 30 * @author Daniel Dreibrodt 31 31 */ 32 32 public class ProgressWindow extends JDialog{ 33 33 34 float position = 0;34 float position = 0; 35 35 String title = "..."; 36 36 JProgressBar pbar; … … 48 48 pbar.setIndeterminate(true); 49 49 } 50 /** Sets the text displayed on the progress bar */ 50 51 public void setText(String s) { 51 52 pbar.setString(s); trunk/src/vlcskineditor/Resource.java
r32 r68 40 40 /** Show a dialog to modify the resource's parameters */ 41 41 public abstract void showOptions(); 42 /** Creates the XML code representing the resource */ 42 /** Update the Resource's attributes according to user input */ 43 public abstract void update(); 44 /** Creates the XML code representing the resource */ 43 45 public abstract String returnCode(); 44 46 /** Creates a DefaultMutableTreeNode to be displayed in the resources tree */ trunk/src/vlcskineditor/Resources/Bitmap.java
r67 r68 40 40 public class Bitmap extends Resource implements ActionListener{ 41 41 42 /** Creates a new instance of Bitmap */43 42 public String file; 44 43 public final String ALPHACOLOR_DEFAULT = "#000000"; … … 48 47 public final int FPS_DEFAULT = 0; 49 48 public int fps = FPS_DEFAULT; 49 //The list containing the bitmap's SubBitmaps 50 50 public java.util.List<SubBitmap> SubBitmaps = new LinkedList<SubBitmap>(); 51 //The image represented by the Bitmap item 51 52 public BufferedImage image; 52 53 53 JFrame frame = null;54 JTextField id_tf, file_tf, alphacolor_tf, nbframes_tf, fps_tf;55 JButton file_btn, alphacolor_btn, ok_btn, cancel_btn, help_btn;56 JFileChooser fc;54 private JFrame frame = null; 55 private JTextField id_tf, file_tf, alphacolor_tf, nbframes_tf, fps_tf; 56 private JButton file_btn, alphacolor_btn, ok_btn, cancel_btn, help_btn; 57 private JFileChooser fc; 57 58 58 59 /** 60 * Creates a new Bitmap from xml code 61 * @param xmlcode The XML code from which the Bitmap should be created. One line per tag. 62 * @param s_ The skin in which the Bitmap is used. 63 * This is necessary in order that the image file can be located relatively to the skin file. 64 */ 59 65 public Bitmap(String xmlcode, Skin s_) { 60 66 type = "Bitmap"; … … 80 86 } 81 87 } 82 update(); 83 } 88 updateImage(); 89 } 90 /** 91 * Creates a new Bitmap from given attributes 92 * @param id_ The ID of the new Bitmap 93 * @param file_ The relative path to the image file. 94 * @param alphacolor_ The alphacolor of the Bitmap. Format is #RRGGBB. 95 * @param nbframes_ If the Bitmap is animated this defines the number of frames. 96 * @param fps_ If the Bitmap is animated this defines the frames displayed per second. 97 * @param s_ The skin in which the Bitmap is used. 98 * This is necessary in order that the image file can be located relatively to the skin file. 99 */ 84 100 public Bitmap(String id_, String file_, String alphacolor_, int nbframes_, int fps_, Skin s_) { 85 101 type="Bitmap"; … … 90 106 nbframes=nbframes_; 91 107 fps=fps_; 92 update(); 93 } 108 updateImage(); 109 } 110 /** 111 * Creates a new Bitmap from a given file. 112 * @param s_ The skin in which the Bitmap is used. 113 * This is necessary in order that the image file can be located relatively to the skin file. 114 * @param f_ The image file represented by this Bitmap. 115 */ 94 116 public Bitmap(Skin s_, File f_) { 95 117 s = s_; … … 102 124 id = id_t; 103 125 s.updateResources(); 104 update ();126 updateImage(); 105 127 } 106 public void update() { 128 /** 129 * Regenerates the image represented by the Bitmap object. 130 */ 131 public void updateImage() { 107 132 try { 108 133 image = ImageIO.read(new File(s.skinfolder+file)); … … 132 157 } 133 158 for(int i=0;i<SubBitmaps.size();i++) { 134 SubBitmaps.get(i).update ();159 SubBitmaps.get(i).updateImage(); 135 160 } 136 161 } … … 142 167 } 143 168 } 144 public void update( String id_, String file_, String alphacolor_, int nbframes_, int fps_) {145 file=file_ ;146 alphacolor=alphacolor_ ;147 nbframes= nbframes_;148 fps= fps_;149 if(!id_ .equals(id)) {150 id=id_ ;169 public void update() { 170 file=file_tf.getText(); 171 alphacolor=alphacolor_tf.getText(); 172 nbframes=Integer.parseInt(nbframes_tf.getText()); 173 fps=Integer.parseInt(fps_tf.getText()); 174 if(!id_tf.getText().equals(id)) { 175 id=id_tf.getText(); 151 176 s.updateResources(); 152 177 s.expandResource(id); 153 178 } 154 update ();179 updateImage(); 155 180 } 156 181 public void showOptions() { … … 296 321 } 297 322 frame.setVisible(false); 298 update( id_tf.getText(),file_tf.getText(),alphacolor_tf.getText(),Integer.parseInt(nbframes_tf.getText()),Integer.parseInt(fps_tf.getText()));323 update(); 299 324 } 300 325 else if(e.getSource().equals(help_btn)) { trunk/src/vlcskineditor/Resources/BitmapFont.java
r17 r68 29 29 /** 30 30 * Represents a BitmapFont 31 * <i>This class exists only to show BitmapFonts in the resources tree ,32 * you can't create a newBitmapFont in the editor nor are they displayed in the preview!</i>31 * <i>This class exists only to show BitmapFonts in the resources tree. 32 * You can't create or edit a BitmapFont in the editor nor are they displayed in the preview!</i> 33 33 * @author Daniel Dreibrodt 34 34 */ … … 47 47 } 48 48 } 49 public void update() { 50 51 } 49 52 public void showOptions() { 50 53 trunk/src/vlcskineditor/Resources/Font.java
r56 r68 46 46 JButton file_btn, ok_btn, cancel_btn, help_btn; 47 47 JFileChooser fc; 48 /** 49 * The font represented by this Font object as a Java AWT Font. 50 */ 48 51 public java.awt.Font f; 49 52 50 /** Creates a new instance of Font */ 53 /** 54 * Creates a Font from XML. 55 * @param xmlcode The XML code from which the Font should be created. One line per tag. 56 * @param s_ The Skin in which the Font is used. 57 */ 51 58 public Font(String xmlcode, Skin s_) { 52 59 type = "Font"; … … 81 88 } 82 89 } 90 /** 91 * Creates a new Font from the given attributes. 92 * @param id_ The ID of the Font. 93 * @param file_ The relative path to the font file. 94 * @param size_ The Font's size. 95 * @param s_ The Skin in which the Font is used. 96 */ 83 97 public Font(String id_,String file_,int size_, Skin s_) { 84 98 type="Font"; … … 111 125 } 112 126 } 127 /** 128 * Creates a new Font from a given file. 129 * @param s_ The skin in which the Font is used. 130 * @param f_ The font file. TrueType or OpenType. Notice that only OpenType fonts in a TrueType container 131 * can be displayed by the Skin Editor. VLC can display both. 132 */ 113 133 public Font(Skin s_, File f_) { 114 134 s = s_; … … 144 164 } 145 165 } 166 /** 167 * Creates a new Font from user input. 168 * @param s_ The skin in which the Font is used. 169 */ 146 170 public Font(Skin s_) { 147 171 s=s_; trunk/src/vlcskineditor/Resources/SubBitmap.java
r66 r68 35 35 /** 36 36 * Handles SubBitmap resources 37 * @see Bitmap 37 38 * @author Daniel 38 39 */ … … 44 45 final int FPS_DEFAULT = 0; 45 46 int fps = FPS_DEFAULT; 47 //The image represented by the SubBitmap 46 48 public BufferedImage image; 49 //The parent bitmap 47 50 private Bitmap parent; 48 51 … … 54 57 boolean created = false; 55 58 56 /** Creates a new instance of SubBitmap */ 59 /** 60 * Creates a new SubBitmap from XML. 61 * @param xmlcode The XML code from which the SubBitmap should be created. One line per tag. 62 * @param s_ The skin in which the SubBitmap is used. 63 * @param parent_ The parent Bitmap. This is necessary to create the image represented by the SubBitmap. 64 */ 57 65 public SubBitmap(String xmlcode, Skin s_, Bitmap parent_) { 58 66 type="Bitmap"; … … 66 74 created = true; 67 75 } 76 /** 77 * Creates a new SubBitmap from user input. 78 * @param s_ The skin in which the SubBitmap is used. 79 * @param parent_ The parent Bitmap. 80 */ 68 81 public SubBitmap(Skin s_,Bitmap parent_) { 69 82 s=s_; … … 77 90 showOptions(); 78 91 } 79 public void update() { 92 /** 93 * Regenerates the image represented by the SubBitmap object. 94 */ 95 public void updateImage() { 80 96 if(parent.image != null) image = parent.image.getSubimage(x,y,width,height); 81 97 } 82 public void update( String id_, int x_, int y_, int width_, int height_, int nbframes_, int fps_) {83 id=id_ ;84 x= x_;85 y= y_;86 width= width_;87 height= height_;88 nbframes= nbframes_;89 fps= fps_;98 public void update() { 99 id=id_tf.getText(); 100 x=Integer.parseInt(x_tf.getText()); 101 y=Integer.parseInt(y_tf.getText()); 102 width=Integer.parseInt(width_tf.getText()); 103 height=Integer.parseInt(height_tf.getText()); 104 nbframes=Integer.parseInt(nbframes_tf.getText()); 105 fps=Integer.parseInt(fps_tf.getText()); 90 106 frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE); 91 update ();107 updateImage(); 92 108 s.updateResources(); 93 109 s.expandResource(id); … … 224 240 } 225 241 frame.setVisible(false); 226 update( id_tf.getText(),Integer.parseInt(x_tf.getText()),Integer.parseInt(y_tf.getText()),Integer.parseInt(width_tf.getText()),Integer.parseInt(height_tf.getText()),Integer.parseInt(nbframes_tf.getText()),Integer.parseInt(fps_tf.getText()));242 update(); 227 243 } 228 244 else if(e.getSource().equals(help_btn)) {
