Changeset 68

Show
Ignore:
Timestamp:
31/10/07 19:11:31 (1 year ago)
Author:
altglass
Message:

Documentation and minor code restructuring.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/nbproject/genfiles.properties

    r64 r68  
    66nbproject/build-impl.xml.data.CRC32=9599816b 
    77nbproject/build-impl.xml.script.CRC32=28555a9f 
    8 nbproject/build-impl.xml.stylesheet.CRC32=65d7ca21 
     8nbproject/build-impl.xml.stylesheet.CRC32=20b9345e 
  • trunk/nbproject/project.properties

    r15 r68  
    3131    ${build.classes.dir}:\ 
    3232    ${libs.junit.classpath} 
    33 javadoc.additionalparam= 
     33javadoc.additionalparam=-header "VLC Skin Editor" 
    3434javadoc.author=false 
    3535javadoc.encoding= 
     
    4141javadoc.use=true 
    4242javadoc.version=false 
    43 javadoc.windowtitle= 
     43javadoc.windowtitle="VLC Skin Editor API Documentation" 
    4444main.class=vlcskineditor.Main 
    4545manifest.file=manifest.mf 
  • trunk/src/vlcskineditor/ActionEditor.java

    r54 r68  
    2929 
    3030/** 
    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 
    3235 * @author Daniel Dreibrodt 
    3336 */ 
    3437public class ActionEditor extends JFrame implements ActionListener{ 
    3538   
     39  //The actions in the chain, respectively the Panels representing them  
    3640  java.util.List<ActionPanel> aPanels = new LinkedList<ActionPanel>();   
    3741   
     
    3943  public ImageIcon delete_icon = createIcon("icons/delete.png");   
    4044   
     45  //The panel that handels the scrolling through the list of actions 
    4146  JScrollPane sPane; 
     47  //The panel containing the actual ActionPanels 
    4248  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);   
    4451  JButton ok_btn = new JButton("OK"); 
    4552   
     
    100107  JMenuItem actions_windows_setLayout = new JMenuItem("Change the layout of a window"); 
    101108   
     109  //The skin item to which the represented action chain belongs 
    102110  Item parent; 
    103111   
     
    289297    setResizable(false);     
    290298  } 
     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   */ 
    291304  public String getCode() {      
    292305    String code = ""; 
     
    294307    return code; 
    295308  } 
     309  /** 
     310   * Replaces the current action chain by a new one 
     311   * @param a The action string 
     312   */ 
    296313  public void updateActions(String a) { 
    297314    actions_p.removeAll(); 
     
    301318    actions_p.updateUI(); 
    302319  } 
     320  /** 
     321   * Adds an action to the chain 
     322   * @param act The action string 
     323   */ 
    303324  public void addAction(String act) { 
    304325    act=act.trim(); 
     
    308329    actions_p.updateUI(); 
    309330  } 
     331  /** 
     332   * Shows the dialog for editing the given action 
     333   * @param a The action string to be edited 
     334   */ 
    310335  public void editAction(String a) { 
    311336    updateActions(a); 
    312337    setVisible(true); 
    313338  } 
     339  /** 
     340   * Reacts to user interaction 
     341   */ 
    314342  public void actionPerformed(ActionEvent e) { 
    315343    if(e.getSource().equals(add_btn)) actions_pu.show(add_btn,0,0); 
     
    332360    } 
    333361  } 
     362  /** 
     363   * Creates an ImageIcon out of a file 
     364   */ 
    334365  public ImageIcon createIcon(String filename) { 
    335366      java.awt.Image img = null; 
  • trunk/src/vlcskineditor/ActionPanel.java

    r45 r68  
    2828 
    2929/** 
    30  * ActionPanel 
     30 * A visual representation of a single action providing input components for modifying/deleting the represented action 
    3131 * @author Daniel Dreibrodt 
    3232 */ 
     
    175175    setMaximumSize(new Dimension(445,30)); 
    176176  } 
     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   */ 
    177182  public String getActionCode() { 
    178183    if(action_type.equals("static")) return action; 
  • trunk/src/vlcskineditor/Bezier.java

    r63 r68  
    2727 
    2828/** 
    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&egrave;re <ipkiss@via.ecp.fr> 
    3033 * @author Daniel Dreibrodt 
    31  * Conversion of VLC /trunk/modules/gui/skins2/utils/bezier.cpp 
    32  * original authors: Cyril Deguet     <asmax@via.ecp.fr> 
    33  *                   Olivier TeuliĆ©re <ipkiss@via.ecp.fr> 
    3434 */ 
    3535public class Bezier { 
  • trunk/src/vlcskineditor/BooleanExpressionEvaluator.java

    r54 r68  
    2626 
    2727/** 
    28  * BooleanExpressionEvaluator 
    29  * 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> 
    3030 * Original code by Cyril Deguet <asmax@via.ecp.fr> 
    3131 * @author Daniel Dreibrodt 
  • trunk/src/vlcskineditor/Item.java

    r53 r68  
    7474  /** Show a dialog to modify the items's parameters */ 
    7575  public abstract void showOptions();   
     76  /** Update the Item's attributes according to the user input */ 
     77  public abstract void update(); 
    7678  /** Creates the XML code representing the item */ 
    7779  public abstract String returnCode(); 
  • trunk/src/vlcskineditor/Items/Anchor.java

    r56 r68  
    5252  int[] xpos,ypos; 
    5353   
    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   */ 
    5559  public Anchor(String xmlcode, Skin s_) { 
    5660    s=s_; 
     
    6670    created = true; 
    6771  } 
     72  /** 
     73   * Creates a new Anchor from user input. 
     74   * @param s_ The Skin in which the Anchor is used. 
     75   */ 
    6876  public Anchor(Skin s_) { 
    6977    s = s_; 
     
    8593    b = new Bezier(xpos,ypos,Bezier.kCoordsBoth); 
    8694  } 
    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=lt_
    91     x=x_
    92     y=y_
    93     points=pts_
    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())
    95103    updateBezier(); 
    96104    s.updateItems(); 
     
    211219      } 
    212220      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(); 
    214222    } 
    215223    else if(e.getSource().equals(help_btn)) { 
  • trunk/src/vlcskineditor/Items/Group.java

    r56 r68  
    113113    s.updateItems();         
    114114  } 
    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())
    119119    for(Item i:items) { 
    120120      i.setOffset(x,y); 
     
    197197      } 
    198198      frame.setVisible(false); 
    199       update(id_tf.getText(),Integer.parseInt(x_tf.getText()),Integer.parseInt(y_tf.getText())); 
     199      update(); 
    200200    } 
    201201    else if(e.getSource().equals(help_btn)) { 
  • trunk/src/vlcskineditor/Items/RadialSlider.java

    r37 r68  
    2929 
    3030/** 
    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. 
    3334 * @author Daniel Dreibrodt 
    3435 */ 
     
    7071    showOptions(); 
    7172  } 
     73  public void update() { 
     74     
     75  } 
    7276  public void showOptions() { 
    7377     
  • trunk/src/vlcskineditor/Layout.java

    r56 r68  
    6060  boolean created = false; 
    6161   
    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   */ 
    6367  public Layout(String xmlcode, Skin s_) { 
    6468    s=s_; 
     
    144148    created = true; 
    145149  } 
     150  /** 
     151   * Creates a new Layout from user input. 
     152   * @param s_ The Skin in which the Layout is used. 
     153   */ 
    146154  public Layout(Skin s_) { 
    147155    s=s_; 
     
    151159    showOptions(); 
    152160  } 
    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()); 
    161172    s.updateWindows(); 
    162173    s.expandLayout(id); 
     
    164175    frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE); 
    165176  } 
     177  /** 
     178   * Shows a dialog to edit this Layout's attributes. 
     179   */ 
    166180  public void showOptions() { 
    167181    if(frame==null) { 
     
    267281    frame.setVisible(true); 
    268282  } 
     283  /** 
     284   * Handles the user interaction with the editing dialog. 
     285   */ 
    269286  public void actionPerformed(ActionEvent e) { 
    270287    if(e.getSource().equals(ok_btn)) { 
     
    288305      } 
    289306      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(); 
    291308    } 
    292309    else if(e.getSource().equals(help_btn)) { 
     
    314331    } 
    315332  } 
     333  /** 
     334   * Draws the Layout. 
     335   * @param g The Graphics2D context onto which the Layout will be drawn. 
     336   */ 
    316337  public void draw(Graphics2D g) { 
    317338    for(Item i:items) { 
     
    319340    } 
    320341  } 
     342  /** 
     343   * Generates the XML code represented by this Layout. 
     344   * @return The XML code. 
     345   */ 
    321346  public String returnCode() { 
    322347    String code ="<Layout"; 
     
    334359    return code; 
    335360  } 
     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   */ 
    336365  public DefaultMutableTreeNode getTreeNode() { 
    337366    DefaultMutableTreeNode node = new DefaultMutableTreeNode("Layout: "+id);     
    338367    return node; 
    339368  }   
     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   */ 
    340374  public Item getItem(String id_) {     
    341375    for(int x=0;x<items.size();x++) { 
     
    345379    return null; 
    346380  } 
     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   */ 
    347387  public java.util.List<Item> getParentListOf(String id_) { 
    348388    for(int x=0;x<items.size();x++) { 
     
    358398    return null; 
    359399  } 
     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   */ 
    360405  public Item getParentOf(String id_) { 
    361406    for(int x=0;x<items.size();x++) { 
  • trunk/src/vlcskineditor/Main.java

    r67 r68  
    4646 */ 
    4747public class Main extends javax.swing.JFrame implements ActionListener, TreeSelectionListener, WindowListener, MouseListener{ 
     48  /** 
     49   * The version identification of the current build. 
     50   */ 
    4851  public final String VERSION = "0.6.0a"; 
    4952  String vlc_dir = ""; 
     
    8386  public ImageIcon down_icon = createIcon("icons/move_down.png"); 
    8487  public ImageIcon help_icon = createIcon("icons/help.png"); 
     88  //The VLC Skin Editor icon. 
    8589  public ImageIcon icon = createIcon("icons/icon.png");   
    8690  public ImageIcon open_icon = createIcon("icons/open.png"); 
     
    96100  JFileChooser base_fc, bitmap_adder, font_adder, vlt_saver; 
    97101  PreviewWindow pvwin; 
     102  //Specifies whether changes were made without having saved the skin.   
    98103  public boolean saved = false; 
     104  //Specifies whether a file is currently being opened 
    99105  boolean opening = false;   
     106  //Specifies if a file was opened 
     107  boolean opened = false; 
    100108   
    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   */ 
    102114  public Main(String[] args) { 
    103115    setTitle("New skin - VLC Skin Editor "+VERSION); 
     
    541553    else showWelcomeDialog(); 
    542554  } 
     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   */ 
    543558  public void showWelcomeDialog() { 
    544559    Object[] options= {"Create a new skin", "Open an exisiting skin","Quit"}; 
     
    555570    }  
    556571  } 
     572  /** 
     573   * Shows the "Open File" dialog. 
     574   */ 
    557575  public void openFile() { 
    558576    opening = true; 
     
    562580    if(returnVal == JFileChooser.APPROVE_OPTION) {       
    563581      openFile(base_fc.getSelectedFile()); 
     582      opening = false; 
    564583    } 
    565584    else { 
    566       showWelcomeDialog()
    567     } 
    568     opening = false; 
     585      opening = false
     586      if(!opened) showWelcomeDialog(); 
     587    } 
    569588  } 
     589  /** 
     590   * Opens the given file as a skin. 
     591   * @param f The skin file. 
     592   */ 
    570593  public void openFile(File f) { 
    571594    if(!f.exists()) { 
    572595      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(); 
    574597      return; 
    575598    } 
     
    673696    saved = true;       
    674697    opening = false; 
     698    opened = true; 
    675699    pwin.setVisible(false);     
    676700  } 
     701  /** 
     702   * Shows a dialog to specify the new skin's location and creates an empty skin. 
     703   */ 
    677704  public void createNew() { 
    678705      base_fc.setFileFilter(new CustomFileFilter(base_fc,"xml","*.xml (VLC XML-Skin Files)",false,vlc_dir));       
    679706      int returnVal=base_fc.showSaveDialog(this);         
    680707      if(returnVal != JFileChooser.APPROVE_OPTION) { 
    681         showWelcomeDialog();         
     708        if(!opened) showWelcomeDialog();      
    682709      } 
    683710      else { 
     
    690717        selected_window = null; 
    691718        selected_item = null; 
    692         saved=false; 
     719        saved = false; 
     720        opened = true; 
    693721      } 
    694722  } 
    695   /** Reacts to GUI actions */ 
     723  /** 
     724   * Reacts to GUI actions 
     725   */ 
    696726  public void actionPerformed(ActionEvent e) { 
    697727    // <editor-fold defaultstate="collapsed" desc="New File">  
     
    12071237  } 
    12081238   
    1209   /** Reacts to tree selections */ 
     1239  /** 
     1240   * Reacts to tree selections 
     1241   */ 
    12101242  public void valueChanged(TreeSelectionEvent e) {     
    12111243    if(opening) return; 
     
    13061338  /** 
    13071339   * Creates an ImageIcon of an image included in the JAR 
    1308    * @param filename The path to the image file inside the JAR 
    1309    * @return         An ImageIcon representing the given file 
     1340   * @param filename The path to the image file inside the JAR 
     1341   * @return An ImageIcon representing the given file 
    13101342   */ 
    13111343  public ImageIcon createIcon(String filename) { 
  • trunk/src/vlcskineditor/NumbersOnlyDocument.java

    r17 r68  
    2828 * NumbersOnlyDocument 
    2929 * allows only numbers to be entered into a component 
     30 * @see javax.swing.text.Document 
    3031 * @author Daniel Dreibrodt 
    3132 */ 
     
    3839    super(); 
    3940  } 
    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   */ 
    4144  public NumbersOnlyDocument(boolean negative) { 
    4245    super(); 
    4346    allow_negative = negative; 
    4447  }   
    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 **/ 
    4649  public void insertString(int offset, String str, AttributeSet a) throws BadLocationException { 
    4750    if(str.matches("[-]") && allow_negative) { 
  • trunk/src/vlcskineditor/PreviewWindow.java

    r56 r68  
    3030 
    3131/** 
    32  * PreviewWindow 
    33  * The WYSIWYG renderer 
     32 * Handles the preview window and user interaction with it. 
    3433 * @author Daniel Dreibrodt 
    3534 */ 
    3635public class PreviewWindow extends JPanel implements MouseListener, MouseMotionListener { 
    3736   
     37  /** 
     38   * The JFrame in which a Layout of a Skin will be shown. 
     39   */ 
    3840  public JInternalFrame frame; 
    3941  Layout l; 
     
    4547  JMenuItem up, down, right, left; 
    4648   
    47   /** Creates a new instance of PreviewWindow */ 
     49  /** 
     50   * Creates a new PreviewWindow that is initially hidden. 
     51   */ 
    4852  public PreviewWindow() {    
    4953    frame = new JInternalFrame("No Layout selected"); 
     
    5559    addMouseMotionListener(this);     
    5660  } 
     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   */ 
    5766  public void clearLayout() { 
    5867    l=null; 
     
    6271    fu=null; 
    6372  } 
     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   */ 
    6479  public void setLayout(Window w_, Layout l_) { 
    6580    if(l_==null) { 
     
    8196    }     
    8297  } 
     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   */ 
    83102  public void selectItem(Item i) {     
    84103    if(selected_item!=null) selected_item.setSelected(false); 
     
    87106    selected_item.setSelected(true); 
    88107  } 
     108  /** 
     109   * Paints the selected layout into the window. 
     110   * @param g The Graphics context into which is drawn. 
     111   */ 
    89112  public void paint(Graphics g) {   
    90113    if(l==null) return;    
     
    153176    dragstartitemy=selected_item.y; 
    154177  } 
     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   */ 
    155183  public void moveItem(int x, int y) {     
    156184    try { 
     
    163191    } 
    164192  } 
     193  /** 
     194   * Creates an ImageIcon from a file. 
     195   */ 
    165196  public ImageIcon createIcon(String filename) { 
    166197    java.awt.Image img = null;     
  • trunk/src/vlcskineditor/ProgressWindow.java

    r43 r68  
    2727 
    2828/** 
    29  * ProgressWindow 
     29 * A window displaying a progress bar running back and forth. 
    3030 * @author Daniel Dreibrodt 
    3131 */ 
    3232public class ProgressWindow extends JDialog{ 
    3333   
    34     float position = 0; 
     34  float position = 0; 
    3535  String title = "..."; 
    3636  JProgressBar pbar; 
     
    4848    pbar.setIndeterminate(true); 
    4949  }   
     50  /** Sets the text displayed on the progress bar */ 
    5051  public void setText(String s) { 
    5152    pbar.setString(s); 
  • trunk/src/vlcskineditor/Resource.java

    r32 r68  
    4040  /** Show a dialog to modify the resource's parameters */ 
    4141  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 */   
    4345  public abstract String returnCode(); 
    4446  /** Creates a DefaultMutableTreeNode to be displayed in the resources tree */ 
  • trunk/src/vlcskineditor/Resources/Bitmap.java

    r67 r68  
    4040public class Bitmap extends Resource implements ActionListener{ 
    4141   
    42   /** Creates a new instance of Bitmap */   
    4342  public String file; 
    4443  public final String ALPHACOLOR_DEFAULT = "#000000"; 
     
    4847  public final int FPS_DEFAULT = 0; 
    4948  public int fps = FPS_DEFAULT; 
     49  //The list containing the bitmap's SubBitmaps   
    5050  public java.util.List<SubBitmap> SubBitmaps = new LinkedList<SubBitmap>(); 
     51  //The image represented by the Bitmap item 
    5152  public BufferedImage image; 
    5253   
    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; 
    5758   
    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   */   
    5965  public Bitmap(String xmlcode, Skin s_) {     
    6066    type = "Bitmap"; 
     
    8086      } 
    8187    }     
    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   */ 
    84100  public Bitmap(String id_, String file_, String alphacolor_, int nbframes_, int fps_, Skin s_) { 
    85101    type="Bitmap"; 
     
    90106    nbframes=nbframes_; 
    91107    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   */ 
    94116  public Bitmap(Skin s_, File f_) { 
    95117    s = s_; 
     
    102124    id = id_t; 
    103125    s.updateResources();     
    104     update(); 
     126    updateImage(); 
    105127  }  
    106   public void update() { 
     128  /** 
     129   * Regenerates the image represented by the Bitmap object. 
     130   */ 
     131  public void updateImage() { 
    107132    try { 
    108133      image = ImageIO.read(new File(s.skinfolder+file));        
     
    132157      } 
    133158      for(int i=0;i<SubBitmaps.size();i++) { 
    134         SubBitmaps.get(i).update(); 
     159        SubBitmaps.get(i).updateImage(); 
    135160      } 
    136161    } 
     
    142167    }     
    143168  } 
    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()
    151176      s.updateResources(); 
    152177      s.expandResource(id); 
    153178    } 
    154     update(); 
     179    updateImage(); 
    155180  } 
    156181  public void showOptions() { 
     
    296321      }       
    297322      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();       
    299324    } 
    300325    else if(e.getSource().equals(help_btn)) { 
  • trunk/src/vlcskineditor/Resources/BitmapFont.java

    r17 r68  
    2929/** 
    3030 * Represents a BitmapFont 
    31  * <i>This class exists only to show BitmapFonts in the resources tree, 
    32  * you can't create a new BitmapFont 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> 
    3333 * @author Daniel Dreibrodt 
    3434 */ 
     
    4747    } 
    4848  } 
     49  public void update() { 
     50     
     51  } 
    4952  public void showOptions() { 
    5053     
  • trunk/src/vlcskineditor/Resources/Font.java

    r56 r68  
    4646  JButton file_btn, ok_btn, cancel_btn, help_btn; 
    4747  JFileChooser fc; 
     48  /** 
     49   * The font represented by this Font object as a Java AWT Font. 
     50   */ 
    4851  public java.awt.Font f; 
    4952   
    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   */ 
    5158  public Font(String xmlcode, Skin s_) { 
    5259    type = "Font"; 
     
    8188    } 
    8289  } 
     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   */ 
    8397  public Font(String id_,String file_,int size_, Skin s_) { 
    8498    type="Font"; 
     
    111125    } 
    112126  } 
     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   */ 
    113133  public Font(Skin s_, File f_) { 
    114134    s = s_; 
     
    144164    }     
    145165  } 
     166  /** 
     167   * Creates a new Font from user input. 
     168   * @param s_ The skin in which the Font is used. 
     169   */ 
    146170  public Font(Skin s_) { 
    147171    s=s_; 
  • trunk/src/vlcskineditor/Resources/SubBitmap.java

    r66 r68  
    3535/** 
    3636 * Handles SubBitmap resources 
     37 * @see Bitmap 
    3738 * @author Daniel 
    3839 */ 
     
    4445  final int FPS_DEFAULT = 0; 
    4546  int fps = FPS_DEFAULT; 
     47  //The image represented by the SubBitmap 
    4648  public BufferedImage image;  
     49  //The parent bitmap 
    4750  private Bitmap parent; 
    4851   
     
    5457  boolean created = false; 
    5558   
    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   */ 
    5765  public SubBitmap(String xmlcode, Skin s_, Bitmap parent_) { 
    5866    type="Bitmap"; 
     
    6674    created = true; 
    6775  }   
     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   */ 
    6881  public SubBitmap(Skin s_,Bitmap parent_) { 
    6982    s=s_; 
     
    7790    showOptions();         
    7891  } 
    79   public void update() { 
     92  /** 
     93   * Regenerates the image represented by the SubBitmap object. 
     94   */ 
     95  public void updateImage() { 
    8096    if(parent.image != null) image = parent.image.getSubimage(x,y,width,height);         
    8197  }   
    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());    
    90106    frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE);     
    91     update(); 
     107    updateImage(); 
    92108    s.updateResources(); 
    93109    s.expandResource(id); 
     
    224240      } 
    225241      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();       
    227243    } 
    228244    else if(e.getSource().equals(help_btn)) {