Changeset 71

Show
Ignore:
Timestamp:
06/11/07 20:38:12 (1 year ago)
Author:
altglass
Message:

Renaming items and resources package to lowercase. First history implementation for resources.

Files:

Legend:

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

    r68 r71  
    2323package vlcskineditor; 
    2424 
    25 import vlcskineditor.Items.*; 
     25import vlcskineditor.items.*; 
    2626import java.util.*; 
    2727import java.awt.*; 
     
    8484      } 
    8585      else if(code[i].startsWith("<Anchor")) items.add(new Anchor(code[i],s)); 
    86       else if(code[i].startsWith("<Button")) items.add(new vlcskineditor.Items.Button(code[i],s)); 
    87       else if(code[i].startsWith("<Checkbox")) items.add(new vlcskineditor.Items.Checkbox(code[i],s)); 
    88       else if(code[i].startsWith("<Image")) items.add(new vlcskineditor.Items.Image(code[i],s)); 
     86      else if(code[i].startsWith("<Button")) items.add(new vlcskineditor.items.Button(code[i],s)); 
     87      else if(code[i].startsWith("<Checkbox")) items.add(new vlcskineditor.items.Checkbox(code[i],s)); 
     88      else if(code[i].startsWith("<Image")) items.add(new vlcskineditor.items.Image(code[i],s)); 
    8989      else if(code[i].startsWith("<Text")) items.add(new Text(code[i],s)); 
    9090      else if(code[i].startsWith("<Video")) items.add(new Video(code[i],s)); 
     
    108108        } 
    109109        itemcode += "\n"+code[i]; 
    110         items.add(new vlcskineditor.Items.Panel(itemcode,s));         
     110        items.add(new vlcskineditor.items.Panel(itemcode,s));         
    111111      } 
    112112      else if(code[i].startsWith("<Playlist")) { 
  • trunk/src/vlcskineditor/Main.java

    r68 r71  
    3535import java.util.zip.*; 
    3636import javax.imageio.*; 
    37 import vlcskineditor.Items.*
    38 import vlcskineditor.Resources.*; 
     37import vlcskineditor.resources.Bitmap
     38import vlcskineditor.items.*; 
    3939import com.ice.tar.*; 
    4040import com.ice.jni.registry.*; 
     41import vlcskineditor.history.*; 
    4142 
    4243 
     
    5556  JMenu m_file, m_edit, m_help; 
    5657  JMenuItem m_file_new, m_file_open, m_file_save, m_file_test, m_file_vlt, m_file_quit; 
    57   JMenuItem m_edit_theme, m_edit_global, m_edit_up, m_edit_down, m_edit_right, m_edit_left; 
     58  JMenuItem m_edit_undo, m_edit_redo, m_edit_theme, m_edit_global, m_edit_up, m_edit_down, m_edit_right, m_edit_left; 
    5859  JMenuItem m_help_doc, m_help_about;   
    5960  JDesktopPane jdesk; 
     
    7879  public ImageIcon add_font_icon = createIcon("icons/add_font.png"); 
    7980  public ImageIcon edit_icon = createIcon("icons/edit.png"); 
     81  public ImageIcon edit_undo_icon = createIcon("icons/edit-undo.png"); 
     82  public ImageIcon edit_redo_icon = createIcon("icons/edit-redo.png"); 
    8083  public ImageIcon editor_icon = createIcon("icons/editor.png"); 
    8184  public ImageIcon delete_icon = createIcon("icons/delete.png"); 
     
    107110  boolean opened = false; 
    108111   
     112  public History hist; 
     113   
    109114  /** 
    110115   * Launches the skin editor and initializes the GUI. 
     
    129134    m_file_open = new JMenuItem("Open"); 
    130135    m_file_open.setIcon(open_icon); 
    131     m_file_open.setMnemonic("O".charAt(0)); 
     136    m_file_open.setMnemonic('O'); 
    132137    m_file_open.setAccelerator(KeyStroke.getKeyStroke("ctrl O")); 
    133138    m_file_open.addActionListener(this);     
    134139    m_file_save = new JMenuItem("Save"); 
    135140    m_file_save.setIcon(save_icon); 
    136     m_file_save.setMnemonic("S".charAt(0)); 
     141    m_file_save.setMnemonic('S'); 
    137142    m_file_save.setAccelerator(KeyStroke.getKeyStroke("ctrl S"));    
    138143    m_file_save.addActionListener(this); 
    139144    m_file_test = new JMenuItem("Test skin in VLC..."); 
    140     m_file_test.setMnemonic("T".charAt(0)); 
     145    m_file_test.setMnemonic('T'); 
    141146    m_file_test.addActionListener(this); 
    142147    m_file_vlt = new JMenuItem("Export as VLT..."); 
    143     m_file_vlt.setMnemonic("V".charAt(0)); 
     148    m_file_vlt.setMnemonic('V'); 
    144149    m_file_vlt.setAccelerator(KeyStroke.getKeyStroke("ctrl v"));    
    145150    m_file_vlt.addActionListener(this); 
    146151    m_file_quit = new JMenuItem("Quit"); 
    147152    m_file_quit.setIcon(exit_icon); 
    148     m_file_quit.setMnemonic("Q".charAt(0)); 
     153    m_file_quit.setMnemonic('Q'); 
    149154    m_file_quit.setAccelerator(KeyStroke.getKeyStroke("ctrl Q")); 
    150155    m_file_quit.addActionListener(this); 
     
    162167    m_edit = new JMenu("Edit"); 
    163168    m_edit.setMnemonic("E".charAt(0)); 
     169    m_edit_undo = new JMenuItem("Undo"); 
     170    m_edit_undo.setIcon(edit_undo_icon); 
     171    m_edit_undo.setMnemonic('U'); 
     172    m_edit_undo.setAccelerator(KeyStroke.getKeyStroke("ctrl Z")); 
     173    m_edit_undo.addActionListener(this); 
     174    m_edit_redo = new JMenuItem("Redo"); 
     175    m_edit_redo.setIcon(edit_redo_icon); 
     176    m_edit_redo.setMnemonic('R');     
     177    m_edit_redo.setAccelerator(KeyStroke.getKeyStroke("ctrl Y")); 
     178    m_edit_redo.addActionListener(this); 
    164179    m_edit_theme = new JMenuItem("Theme settings"); 
    165180    m_edit_theme.setIcon(edit_icon); 
    166     m_edit_theme.setMnemonic("I".charAt(0)); 
     181    m_edit_theme.setMnemonic('I'); 
    167182    m_edit_theme.setAccelerator(KeyStroke.getKeyStroke("ctrl I")); 
    168183    m_edit_theme.addActionListener(this); 
    169184    m_edit_global = new JMenuItem("Global variables"); 
    170     m_edit_global.setMnemonic("G".charAt(0)); 
     185    m_edit_global.setMnemonic('G'); 
    171186    m_edit_global.setAccelerator(KeyStroke.getKeyStroke("ctrl G")); 
    172187    m_edit_global.addActionListener(this); 
     
    184199    m_edit_right.addActionListener(this); 
    185200     
     201    m_edit.add(m_edit_undo); 
     202    m_edit.add(m_edit_redo); 
     203    m_edit.addSeparator(); 
    186204    m_edit.add(m_edit_theme); 
    187205    m_edit.addSeparator(); 
     
    194212         
    195213    m_help = new JMenu("Help"); 
    196     m_help.setMnemonic("H".charAt(0));     
     214    m_help.setMnemonic('H');     
    197215    m_help_doc = new JMenuItem("Skins2 documentation");     
    198216    m_help_doc.setIcon(help_icon); 
    199     m_help_doc.setMnemonic("D".charAt(0)); 
     217    m_help_doc.setMnemonic('D'); 
    200218    m_help_doc.addActionListener(this); 
    201219    m_help_doc.setAccelerator(KeyStroke.getKeyStroke("F1"));     
    202220    m_help_about = new JMenuItem("About"); 
    203     m_help_about.setMnemonic("H".charAt(0)); 
     221    m_help_about.setMnemonic('A'); 
    204222    m_help_about.addActionListener(this); 
    205223     
     
    682700        opening=false; 
    683701        return; 
    684       } 
    685       setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); 
     702      }       
     703      setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));       
    686704    }      
    687705    pwin.setText("Parsing XML..."); 
     
    698716    opened = true; 
    699717    pwin.setVisible(false);     
     718    hist = new History(this); 
    700719  } 
    701720  /** 
     
    719738        saved = false; 
    720739        opened = true; 
     740        hist = new History(this); 
    721741      } 
    722742  } 
     
    813833          else if(s.resources.get(i).type.equals("Font")) { 
    814834            try { 
    815               vlcskineditor.Resources.Font fnt = (vlcskineditor.Resources.Font)s.resources.get(i);               
     835              vlcskineditor.resources.Font fnt = (vlcskineditor.resources.Font)s.resources.get(i);               
    816836              String fn = s.skinfolder+fnt.file;               
    817837              if(!files.contains(fn)) { //To avoid double files (e.g. one font file used by several font objects) 
     
    922942        File[] files = bitmap_adder.getSelectedFiles(); 
    923943        for(int i=0;i<files.length;i++) { 
    924           s.resources.add(new vlcskineditor.Resources.Bitmap(s,files[i])); 
     944          s.resources.add(new vlcskineditor.resources.Bitmap(s,files[i])); 
    925945        } 
    926946        s.updateResources(); 
     
    934954        if(r!=null) { 
    935955          if(r.type.equals("Bitmap")) { 
    936             vlcskineditor.Resources.Bitmap b = (vlcskineditor.Resources.Bitmap)r; 
    937             b.SubBitmaps.add(new vlcskineditor.Resources.SubBitmap(s,b));   
     956            vlcskineditor.resources.Bitmap b = (vlcskineditor.resources.Bitmap)r; 
     957            b.SubBitmaps.add(new vlcskineditor.resources.SubBitmap(s,b));   
    938958          } 
    939959          else { 
     
    964984        File[] files = font_adder.getSelectedFiles(); 
    965985        for(int i=0;i<files.length;i++) { 
    966           s.resources.add(new vlcskineditor.Resources.Font(s,files[i])); 
     986          s.resources.add(new vlcskineditor.resources.Font(s,files[i])); 
    967987        } 
    968988        s.updateResources(); 
     
    11321152      if(selected_item!=null ) i = s.getParentListOf(selected_item); 
    11331153      if(i==null) i = s.getWindow(selected_window).getLayout(selected_layout).items;        
    1134       i.add(new vlcskineditor.Items.Button(s));            
     1154      i.add(new vlcskineditor.items.Button(s));            
    11351155    } 
    11361156    else if(e.getSource().equals(items_add_pu_checkbox)) {       
     
    11381158      if(selected_item!=null ) i = s.getParentListOf(selected_item); 
    11391159      if(i==null) i = s.getWindow(selected_window).getLayout(selected_layout).items;        
    1140       i.add(new vlcskineditor.Items.Checkbox(s));            
     1160      i.add(new vlcskineditor.items.Checkbox(s));            
    11411161    } 
    11421162    else if(e.getSource().equals(items_add_pu_panel)) {       
     
    11441164      if(selected_item!=null ) i = s.getParentListOf(selected_item); 
    11451165      if(i==null) i = s.getWindow(selected_window).getLayout(selected_layout).items;        
    1146       i.add(new vlcskineditor.Items.Panel(s));            
     1166      i.add(new vlcskineditor.items.Panel(s));            
    11471167    } 
    11481168    else if(e.getSource().equals(items_add_pu_image)) {       
     
    11501170      if(selected_item!=null ) i = s.getParentListOf(selected_item); 
    11511171      if(i==null) i = s.getWindow(selected_window).getLayout(selected_layout).items;        
    1152       i.add(new vlcskineditor.Items.Image(s));            
     1172      i.add(new vlcskineditor.items.Image(s));            
    11531173    } 
    11541174    else if(e.getSource().equals(items_add_pu_playtree)) {       
     
    11781198    else if(e.getSource().equals(items_add_pu_tp_anchor)) {       
    11791199      java.util.List<Item> l = s.getListOf(selected_item); 
    1180       if(l!=null) l.add(new vlcskineditor.Items.Anchor(s));            
     1200      if(l!=null) l.add(new vlcskineditor.items.Anchor(s));            
    11811201    } 
    11821202    else if(e.getSource().equals(items_add_pu_tp_button)) {       
    11831203      java.util.List<Item> l = s.getListOf(selected_item); 
    1184       if(l!=null) l.add(new vlcskineditor.Items.Button(s));            
     1204      if(l!=null) l.add(new vlcskineditor.items.Button(s));            
    11851205    } 
    11861206    else if(e.getSource().equals(items_add_pu_tp_checkbox)) {       
    11871207      java.util.List<Item> l = s.getListOf(selected_item); 
    1188       if(l!=null) l.add(new vlcskineditor.Items.Checkbox(s));            
     1208      if(l!=null) l.add(new vlcskineditor.items.Checkbox(s));            
    11891209    } 
    11901210    else if(e.getSource().equals(items_add_pu_tp_image)) {       
    11911211      java.util.List<Item> l = s.getListOf(selected_item); 
    1192       if(l!=null) l.add(new vlcskineditor.Items.Image(s));            
     1212      if(l!=null) l.add(new vlcskineditor.items.Image(s));            
    11931213    } 
    11941214    else if(e.getSource().equals(items_add_pu_tp_panel)) {       
    11951215      java.util.List<Item> l = s.getListOf(selected_item); 
    1196       if(l!=null) l.add(new vlcskineditor.Items.Panel(s));            
     1216      if(l!=null) l.add(new vlcskineditor.items.Panel(s));            
    11971217    } 
    11981218    else if(e.getSource().equals(items_add_pu_tp_playtree)) {       
    11991219      java.util.List<Item> l = s.getListOf(selected_item); 
    1200       if(l!=null) l.add(new vlcskineditor.Items.Playtree(s));            
     1220      if(l!=null) l.add(new vlcskineditor.items.Playtree(s));            
    12011221    } 
    12021222    else if(e.getSource().equals(items_add_pu_tp_slider)) {       
    12031223      java.util.List<Item> l = s.getListOf(selected_item); 
    1204       if(l!=null) l.add(new vlcskineditor.Items.Slider(s));            
     1224      if(l!=null) l.add(new vlcskineditor.items.Slider(s));            
    12051225    } 
    12061226    else if(e.getSource().equals(items_add_pu_tp_text)) {       
    12071227      java.util.List<Item> l = s.getListOf(selected_item); 
    1208       if(l!=null) l.add(new vlcskineditor.Items.Text(s));            
     1228      if(l!=null) l.add(new vlcskineditor.items.Text(s));            
    12091229    } 
    12101230    else if(e.getSource().equals(items_add_pu_tp_video)) {       
    12111231      java.util.List<Item> l = s.getListOf(selected_item); 
    1212       if(l!=null) l.add(new vlcskineditor.Items.Video(s));            
     1232      if(l!=null) l.add(new vlcskineditor.items.Video(s));            
    12131233    } 
    12141234    //</editor-fold> 
     
    12351255    else if(e.getSource().equals(m_edit_left)) pvwin.moveItem(-1,0); 
    12361256    // </editor-fold> 
     1257    else if(e.getSource().equals(m_edit_undo)) { 
     1258      if(hist!=null) hist.undo(); 
     1259    } 
     1260    else if(e.getSource().equals(m_edit_redo)) { 
     1261      if(hist!=null) hist.redo(); 
     1262    } 
    12371263  } 
    12381264   
     
    13361362  public void mouseEntered(MouseEvent e) {} 
    13371363  public void mouseExited(MouseEvent e) {} 
     1364  /** Sets the activity state of the undo menu item to the given argument */ 
     1365  public void setUndoEnabled(boolean enabled) { 
     1366    m_edit_undo.setEnabled(enabled); 
     1367  } 
     1368  /** Sets the activity state of the redo menu item to the given argument */ 
     1369  public void setRedoEnabled(boolean enabled) { 
     1370    m_edit_redo.setEnabled(enabled); 
     1371  } 
     1372  /** Sets the action description that can be undone */ 
     1373  public void setUndoString(String s) { 
     1374    if(s.isEmpty()) m_edit_undo.setText("Undo"); 
     1375    else m_edit_undo.setText("Undo: "+s); 
     1376  } 
     1377  /** Sets the action description that can be redone */ 
     1378  public void setRedoString(String s) { 
     1379    if(s.isEmpty()) m_edit_redo.setText("Redo"); 
     1380    else m_edit_redo.setText("Redo: "+s); 
     1381  } 
    13381382  /** 
    13391383   * Creates an ImageIcon of an image included in the JAR 
  • trunk/src/vlcskineditor/Resource.java

    r68 r71  
    4646  /** Creates a DefaultMutableTreeNode to be displayed in the resources tree */ 
    4747  public abstract DefaultMutableTreeNode getTreeNode();   
    48   /** If an Resource does contain another Resource of the given id (e.g. a SubBitmap) the containing Resource is returned **/ 
     48  /** If a Resource does contain another Resource of the given id (e.g. a SubBitmap) the containing Resource is returned **/ 
    4949  public Resource getParentOf(String id_) { 
    5050    return null; 
  • trunk/src/vlcskineditor/Skin.java

    r60 r71  
    2323package vlcskineditor; 
    2424 
    25 import vlcskineditor.Resources.*; 
     25import vlcskineditor.resources.Bitmap; 
     26import vlcskineditor.resources.BitmapFont; 
     27import vlcskineditor.resources.SubBitmap; 
    2628import java.awt.*; 
    2729import java.awt.event.*; 
     
    172174        } 
    173175        //</editor-fold> 
    174         else if(line.startsWith("<Font")) resources.add(new vlcskineditor.Resources.Font(line,this)); 
     176        else if(line.startsWith("<Font")) resources.add(new vlcskineditor.resources.Font(line,this)); 
    175177        else if(line.startsWith("<BitmapFont")) resources.add(new BitmapFont(line,this));         
    176178        //<editor-fold defaultstate="collapsed" desc=" Window tag ">  
     
    428430    try { 
    429431      if(r.type.equals("Font")) { 
    430         vlcskineditor.Resources.Font fr = (vlcskineditor.Resources.Font)r; 
     432        vlcskineditor.resources.Font fr = (vlcskineditor.resources.Font)r; 
    431433        return fr.f; 
    432434      } 
     
    462464    java.util.List<Item> l = null;           
    463465    try { 
    464       vlcskineditor.Items.Panel p = (vlcskineditor.Items.Panel)i; 
     466      vlcskineditor.items.Panel p = (vlcskineditor.items.Panel)i; 
    465467      l = p.items; 
    466468    } 
    467469    catch(Exception ex1) { 
    468470      try { 
    469         vlcskineditor.Items.Group g = (vlcskineditor.Items.Group)i; 
     471        vlcskineditor.items.Group g = (vlcskineditor.items.Group)i; 
    470472        l = g.items; 
    471473      } 
  • trunk/src/vlcskineditor/SliderBGGen.java

    r52 r71  
    2626import java.awt.event.*; 
    2727import javax.swing.*; 
    28 import vlcskineditor.Items.SliderBackground; 
     28import vlcskineditor.items.SliderBackground; 
    2929 
    3030/** 
    31  * SliderBGGen 
     31 * A wizard that generates a slider background from several image files. 
    3232 * @author Daniel Dreibrodt 
    3333 */ 
     
    5151  JPanel card_step2; 
    5252   
    53   JTextField bg_tf, e1_tf, md_tf, e2_tf; 
     53  /** Contains the path to the background image file */ 
     54  JTextField bg_tf; 
     55  /** Contains the path to the image file for the left or upper edge of the bar */ 
     56  JTextField e1_tf; 
     57  /** Contains the path to the image file for the middle part of the bar */ 
     58  JTextField md_tf; 
     59  /** Contains the path to the image file for the right or bottom edge of the bar */ 
     60  JTextField e2_tf; 
     61  /** Sets whether the background image should be tiled to fill the slider background size */ 
     62  JRadioButton bgt_rb; 
     63  /** Sets whether the background image should be stretched to fill the slider background size */ 
     64  JRadioButton bgs_rb; 
     65  /** Sets whether the middle image should be tiled to fill the slider background size */ 
     66  JRadioButton mdt_rb; 
     67  /** Sets whether the middle image should be stretched to fill the slider background size */ 
     68  JRadioButton mds_rb;   
    5469  JButton bg_btn, e1_btn, md_btn, e2_btn; 
    5570  JFileChooser bg_fc, e1_fc, md_fc, e2_fc; 
    56   JButton step2_prev_btn, step2_finish_btn, step2_cancel_btn; 
    57    
    58   public ImageIcon editor_icon = createIcon("icons/editor.png"); 
    59   public ImageIcon ltr_icon = createIcon("icons/sliderbg_ltr.png"); 
    60   public ImageIcon btt_icon = createIcon("icons/sliderbg_btt.png");   
    61    
    62   /** Creates a new instance of SliderBGGen */ 
     71  JButton step2_prev_btn, step2_finish_btn, step2_cancel_btn;   
     72   
     73  ImageIcon editor_icon = createIcon("icons/editor.png"); 
     74  ImageIcon ltr_icon = createIcon("icons/sliderbg_ltr.png"); 
     75  ImageIcon btt_icon = createIcon("icons/sliderbg_btt.png");   
     76   
     77  /** 
     78   * Creates a new Slider Background Generator 
     79   * @param sbg_ The SliderBackground object into which the generated slider background should be stored. 
     80   * @param s_ The Skin in which the slider background will be used. 
     81   */ 
    6382  public SliderBGGen(SliderBackground sbg_, Skin s_) {     
    6483    sbg=sbg_; 
     
    7998     
    8099    String header_str = "<html><body style=\"background:"+header_bgh+";color:#FFFFFF;width:540px;\"><h1>&nbsp;Slider Background Generator</h1></body></html>"; 
    81      
    82      
    83100     
    84101    card_step1 = new JPanel(null);     
     
    157174    card_step2.add(header2_l);  
    158175     
     176    JPanel bg_p = new JPanel(null); 
     177    JLabel bg_l = new JLabel("Image file:"); 
     178    bg_tf = new JTextField(""); 
     179    bg_btn = new JButton("Open..."); 
     180     
     181     
    159182    JSeparator step2_horz_s = new JSeparator(JSeparator.HORIZONTAL); 
    160183    step2_prev_btn = new JButton("< Previous"); 
     
    196219  /** 
    197220   * Creates an ImageIcon of an image included in the JAR 
    198    * @param filename The path to the image file inside the JAR 
    199    * @return         An ImageIcon representing the given file 
     221   * @param filename The path to the image file inside the JAR 
     222   * @return An ImageIcon representing the given file 
    200223   */ 
    201224  public ImageIcon createIcon(String filename) {       
  • trunk/src/vlcskineditor/items/Anchor.java

    r68 r71  
    2121 *****************************************************************************/ 
    2222 
    23 package vlcskineditor.Items; 
     23package vlcskineditor.items; 
    2424 
    2525import vlcskineditor.*; 
  • trunk/src/vlcskineditor/items/Button.java

    r61 r71  
    2121 *****************************************************************************/ 
    2222 
    23 package vlcskineditor.Items; 
     23package vlcskineditor.items; 
    2424 
    2525import vlcskineditor.*; 
  • trunk/src/vlcskineditor/items/Checkbox.java

    r61 r71  
    2121 *****************************************************************************/ 
    2222 
    23 package vlcskineditor.Items; 
     23package vlcskineditor.items; 
    2424 
    2525import vlcskineditor.*; 
  • trunk/src/vlcskineditor/items/Group.java

    r68 r71  
    2121 *****************************************************************************/ 
    2222 
    23 package vlcskineditor.Items; 
     23package vlcskineditor.items; 
    2424 
    2525import vlcskineditor.*; 
  • trunk/src/vlcskineditor/items/Image.java

    r61 r71  
    2121 *****************************************************************************/ 
    2222 
    23 package vlcskineditor.Items; 
     23package vlcskineditor.items; 
    2424 
    2525import vlcskineditor.*; 
  • trunk/src/vlcskineditor/items/Panel.java

    r61 r71  
    2121 *****************************************************************************/ 
    2222 
    23 package vlcskineditor.Items; 
     23package vlcskineditor.items; 
    2424 
    2525import vlcskineditor.*; 
  • trunk/src/vlcskineditor/items/Playtree.java

    r61 r71  
    2121 *****************************************************************************/ 
    2222 
    23 package vlcskineditor.Items; 
     23package vlcskineditor.items; 
    2424 
    2525import vlcskineditor.*; 
  • trunk/src/vlcskineditor/items/RadialSlider.java

    r68 r71  
    2121 *****************************************************************************/ 
    2222 
    23 package vlcskineditor.Items; 
     23package vlcskineditor.items; 
    2424 
    2525import vlcskineditor.*; 
  • trunk/src/vlcskineditor/items/Slider.java

    r62 r71  
    2121 *****************************************************************************/ 
    2222 
    23 package vlcskineditor.Items; 
     23package vlcskineditor.items; 
    2424 
    2525import java.util.Collection; 
  • trunk/src/vlcskineditor/items/SliderBackground.java

    r62 r71  
    2121 *****************************************************************************/ 
    2222 
    23 package vlcskineditor.Items; 
     23package vlcskineditor.items; 
    2424 
    2525import vlcskineditor.*; 
  • trunk/src/vlcskineditor/items/Text.java

    r61 r71  
    2121 *****************************************************************************/ 
    2222 
    23 package vlcskineditor.Items; 
     23package vlcskineditor.items; 
    2424 
    2525import vlcskineditor.*; 
     
    375375      Resource fr = s.getResource(font); 
    376376      if(fr.type.equals("Font")) { 
    377         vlcskineditor.Resources.Font fnt = (vlcskineditor.Resources.Font)fr; 
     377        vlcskineditor.resources.Font fnt = (vlcskineditor.resources.Font)fr; 
    378378        f = new Font(Font.SANS_SERIF,Font.PLAIN,fnt.size); 
    379379      } 
  • trunk/src/vlcskineditor/items/Video.java

    r61 r71  
    2121 *****************************************************************************/ 
    2222 
    23 package vlcskineditor.Items; 
     23package vlcskineditor.items; 
    2424 
    2525import vlcskineditor.*; 
  • trunk/src/vlcskineditor/resources/Bitmap.java

    r68 r71  
    2121 *****************************************************************************/ 
    2222 
    23 package vlcskineditor.Resources; 
     23package vlcskineditor.resources; 
    2424 
    2525import vlcskineditor.*; 
     26import vlcskineditor.history.*; 
    2627import java.util.*; 
    2728import javax.swing.*; 
     
    168169  } 
    169170  public void update() { 
     171    BitmapEditEvent be = new BitmapEditEvent(this); 
    170172    file=file_tf.getText(); 
    171173    alphacolor=alphacolor_tf.getText(); 
     
    178180    } 
    179181    updateImage(); 
     182    be.setNew(); 
     183    s.m.hist.addEvent(be); 
    180184  } 
    181185  public void showOptions() { 
  • trunk/src/vlcskineditor/resources/BitmapFont.java

    r68 r71  
    2121 *****************************************************************************/ 
    2222 
    23 package vlcskineditor.Resources; 
     23package vlcskineditor.resources; 
    2424 
    2525import vlcskineditor.*; 
  • trunk/src/vlcskineditor/resources/Font.java

    r68 r71  
    2121 *****************************************************************************/ 
    2222 
    23 package vlcskineditor.Resources; 
     23package vlcskineditor.resources; 
    2424 
    2525import vlcskineditor.*; 
     26import vlcskineditor.history.*; 
    2627import java.util.*; 
    2728import javax.swing.*; 
     
    6465      size = Integer.parseInt(XML.getValue(xmlcode,"size")); 
    6566    } 
     67    updateFont(); 
     68  } 
     69  /** 
     70   * Creates a new Font from the given attributes. 
     71   * @param id_ The ID of the Font. 
     72   * @param file_ The relative path to the font file. 
     73   * @param size_ The Font's size. 
     74   * @param s_ The Skin in which the Font is used. 
     75   */ 
     76  public Font(String id_,String file_,int size_, Skin s_) { 
     77    type="Font"; 
     78    s=s_; 
     79    id=id_; 
     80    file=file_; 
     81    size=size_; 
     82    updateFont(); 
     83  } 
     84  /** 
     85   * Creates a new Font from a given file. 
     86   * @param s_ The skin in which the Font is used. 
     87   * @param f_ The font file. TrueType or OpenType. Notice that only OpenType fonts in a TrueType container 
     88   * can be displayed by the Skin Editor. VLC can display both. 
     89   */ 
     90  public Font(Skin s_, File f_) { 
     91    s = s_; 
     92    type = "Font"; 
     93    String id_t = f_.getName().substring(0,f_.getName().lastIndexOf(".")); 
     94    if(s.idExists(id_t)) id_t += "_"+s.getNewId(); 
     95    id = id_t; 
     96    file = f_.getPath().replace(s.skinfolder,"");     
     97    s.updateResources(); 
     98    s.expandResource(id); 
     99    updateFont(); 
     100  } 
     101  /** 
     102   * Creates a new Font from user input. 
     103   * @param s_ The skin in which the Font is used. 
     104   */ 
     105  public Font(Skin s_) { 
     106    s=s_; 
     107    type="Font"; 
     108    id = "Unnamed font #"+s.getNewId(); 
     109    file=""; 
     110    s.updateResources(); 
     111    s.expandResource(id); 
     112    showOptions(); 
     113  } 
     114  public void updateFont() { 
    66115    try {       
    67116      f = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT,new File(s.skinfolder+file)); 
     
    88137    } 
    89138  } 
    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    */ 
    97   public Font(String id_,String file_,int size_, Skin s_) { 
    98     type="Font"; 
    99     s=s_; 
    100     id=id_; 
    101     file=file_; 
    102     size=size_; 
    103     try {       
    104       f = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT,new File(s.skinfolder+file)); 
    105       f = f.deriveFont((float)size); 
    106     } 
    107     catch(Exception e) { 
    108       e.printStackTrace(); 
    109       if(file.indexOf(".otf")==-1) { 
    110         JOptionPane.showMessageDialog(frame,"Error while loading font file!\n Please choose another file\n","Font file not valid",JOptionPane.ERROR_MESSAGE); 
    111         f = new java.awt.Font(java.awt.Font.SANS_SERIF,java.awt.Font.PLAIN,size); 
    112         showOptions(); 
    113       } 
    114       else { 
    115         JOptionPane.showMessageDialog(frame,"You have chosen an OpenType font, VLC will display it correctly but the Skin Editor can not display it.\nIn the Skin Editor you will see instead of the chosen font the default font FreeSans","Notice",JOptionPane.INFORMATION_MESSAGE); 
    116         try {       
    117           f = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT,new File(Main.class.getResource("FreeSans.ttf").toURI())); 
    118           f = f.deriveFont(12); 
    119         } 
    120         catch(Exception ex) { 
    121           ex.printStackTrace(); 
    122           f = new java.awt.Font(java.awt.Font.SANS_SERIF,java.awt.Font.PLAIN,size); 
    123         } 
    124       }   
    125     } 
    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    */ 
    133   public Font(Skin s_, File f_) { 
    134     s = s_; 
    135     type = "Font"; 
    136     String id_t = f_.getName().substring(0,f_.getName().lastIndexOf(".")); 
    137     if(s.idExists(id_t)) id_t += "_"+s.getNewId(); 
    138     id = id_t; 
    139     file = f_.getPath().replace(s.skinfolder,"");     
    140     s.updateResources(); 
    141     s.expandResource(id); 
    142     try {       
    143       f = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT,new File(s.skinfolder+file)); 
    144       f = f.deriveFont((float)size); 
    145     } 
    146     catch(Exception e) { 
    147       e.printStackTrace(); 
    148       if(file.indexOf(".otf")==-1) { 
    149         JOptionPane.showMessageDialog(frame,"Error while loading font file!\n Please choose another file\n","Font file not valid",JOptionPane.ERROR_MESSAGE); 
    150         f = new java.awt.Font(java.awt.Font.SANS_SERIF,java.awt.Font.PLAIN,size); 
    151         showOptions(); 
    152       } 
    153       else { 
    154         JOptionPane.showMessageDialog(frame,"You have chosen an OpenType font, VLC will display it correctly but the Skin Editor can not display it.\nIn the Skin Editor you will see instead of the chosen font the default font FreeSans","Notice",JOptionPane.INFORMATION_MESSAGE); 
    155         try {       
    156           f = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT,new File(Main.class.getResource("FreeSans.ttf").toURI())); 
    157           f = f.deriveFont(12); 
    158         } 
    159         catch(Exception ex) { 
    160           ex.printStackTrace(); 
    161           f = new java.awt.Font(java.awt.Font.SANS_SERIF,java.awt.Font.PLAIN,size); 
    162         } 
    163       }   
    164     }     
    165   } 
    166   /** 
    167    * Creates a new Font from user input. 
    168    * @param s_ The skin in which the Font is used. 
    169    */ 
    170   public Font(Skin s_) { 
    171     s=s_; 
    172     type="Font"; 
    173     id = "Unnamed font #"+s.getNewId(); 
    174     file=""; 
    175     s.updateResources(); 
    176     s.expandResource(id); 
    177     showOptions(); 
    178   } 
    179139  public void update() { 
     140    FontEditEvent fe = new FontEditEvent(this); 
    180141    type="Font";     
    181142    file=file_tf.getText(); 
     
    184145    s.updateResources(); 
    185146    s.expandResource(id); 
    186     try {       
    187       f = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT,new File(s.skinfolder+file)); 
    188       f = f.deriveFont((float)size); 
    189     } 
    190     catch(Exception e) { 
    191       e.printStackTrace(); 
    192       if(file.indexOf(".otf")==-1) { 
    193         JOptionPane.showMessageDialog(frame,"Error while loading font file!\n Please choose another file\n","Font file not valid",JOptionPane.ERROR_MESSAGE); 
    194         f = new java.awt.Font(java.awt.Font.SANS_SERIF,java.awt.Font.PLAIN,size); 
    195         showOptions(); 
    196       } 
    197       else { 
    198         JOptionPane.showMessageDialog(frame,"You have chosen an OpenType font, VLC will display it correctly but the Skin Editor can not display it.\nIn the Skin Editor you will see instead of the chosen font the default font FreeSans","Notice",JOptionPane.INFORMATION_MESSAGE); 
    199         try {       
    200           f = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT,new File(Main.class.getResource("FreeSans.ttf").toURI())); 
    201           f = f.deriveFont(12); 
    202         } 
    203         catch(Exception ex) { 
    204           ex.printStackTrace(); 
    205           f = new java.awt.Font(java.awt.Font.SANS_SERIF,java.awt.Font.PLAIN,size); 
    206         } 
    207       }   
    208     }     
     147    updateFont(); 
     148    fe.setNew(); 
     149    s.m.hist.addEvent(fe); 
    209150  } 
    210151  public void showOptions() { 
  • trunk/src/vlcskineditor/resources/SubBitmap.java

    r68 r71  
    2121 *****************************************************************************/ 
    2222 
    23 package vlcskineditor.Resources; 
     23package vlcskineditor.resources; 
    2424 
    2525import vlcskineditor.*; 
     
    3333import java.awt.event.*; 
    3434import java.io.*; 
     35import vlcskineditor.history.SubBitmapAddEvent; 
    3536/** 
    3637 * Handles SubBitmap resources 
     
    4041public class SubBitmap extends Resource implements ActionListener{ 
    4142   
    42   int x, y, width, height; 
     43  public int x, y, width, height; 
    4344  final int NBFRAMES_DEFAULT = 1; 
    44   int nbframes = NBFRAMES_DEFAULT; 
     45  public int nbframes = NBFRAMES_DEFAULT; 
    4546  final int FPS_DEFAULT = 0; 
    46   int fps = FPS_DEFAULT; 
     47  public int fps = FPS_DEFAULT; 
    4748  //The image represented by the SubBitmap 
    4849  public BufferedImage image;  
     
    9798  }   
    9899  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());    
    106     frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE);     
    107     updateImage(); 
    108     s.updateResources(); 
    109     s.expandResource(id); 
    110     created = true; 
     100    if(!created) {       
     101      id=id_tf.getText(); 
     102      x=Integer.parseInt(x_tf.getText()); 
     103      y=Integer.parseInt(y_tf.getText()); 
     104      width=Integer.parseInt(width_tf.getText()); 
     105      height=Integer.parseInt(height_tf.getText()); 
     106      nbframes=Integer.parseInt(nbframes_tf.getText()); 
     107      fps=Integer.parseInt(fps_tf.getText());    
     108      frame.setDefaultCloseOperation(frame.HIDE_ON_CLOSE);     
     109      updateImage(); 
     110      s.updateResources(); 
     111      s.expandResource(id); 
     112      SubBitmapAddEvent sae = new SubBitmapAddEvent(parent,this); 
     113      s.m.hist.addEvent(sae); 
     114      created = true; 
     115    } 
     116    else { 
     117      id=id_tf.getText(); 
     118      x=Integer.parseInt(x_tf.getText()); </