Commit d58bc29d authored by Daniel Dreibrodt's avatar Daniel Dreibrodt

Bugfixing

parent 1df0555b
......@@ -24,7 +24,6 @@ package vlcskineditor;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
......
......@@ -845,14 +845,19 @@ public class Skin implements ActionListener{
if(ltp==null) return;
m.win_tree.setSelectionPath(ltp);
}
/** Make an item of the given id visible in the tree (expand the TreePath) **/
/**
* Make an item of the given id visible in the tree (expand the TreePath)
* @param id The id of the item to expand
**/
public void expandItem(String id) {
java.util.List<String> parents = new LinkedList<String>();
Item p = getItem(id);
if(p==null) return;
//Trace parents
while((p=active_layout.getParentOf(p.id))!=null) {
parents.add(p.id);
}
//Open each parent, starting with the highest one in hierarchy
for(int i=parents.size()-1;i>=0;i--) {
TreePath tp = findInTree(m.items_tree,parents.get(i));
if(tp==null) {
......@@ -860,10 +865,11 @@ public class Skin implements ActionListener{
return;
}
m.items_tree.expandPath(tp);
TreePath stp = findInTree(m.items_tree,id);
if(stp==null) return;
m.items_tree.setSelectionPath(stp);
}
}
//Finding selection path
TreePath stp = findInTree(m.items_tree,id);
if(stp==null) return;
m.items_tree.setSelectionPath(stp);
}
/** Finds the first occurence of id in the first expanded tree in the given JTree**/
public TreePath findInTree(JTree jt, String id) {
......
......@@ -53,7 +53,7 @@ public class GroupEditEvent extends HistoryEvent{
g.y = y_old;
for(Item i:g.items) {
i.setOffset(x_old,y_old);
i.setOffset(x_old+i.offsetx,y_old+i.offsety);
}
}
@Override
......@@ -63,7 +63,7 @@ public class GroupEditEvent extends HistoryEvent{
g.y = y_new;
for(Item i:g.items) {
i.setOffset(x_new,y_new);
i.setOffset(x_new+i.offsetx,y_new+i.offsety);
}
}
@Override
......
......@@ -85,7 +85,7 @@ public class PanelEditEvent extends HistoryEvent{
p.height = height_old;
for(Item i:p.items) {
i.setOffset(x_old,y_old);
i.setOffset(x_old+p.offsetx,y_old+p.offsety);
}
}
@Override
......@@ -104,7 +104,7 @@ public class PanelEditEvent extends HistoryEvent{
p.height = height_new;
for(Item i:p.items) {
i.setOffset(x_new,y_new);
i.setOffset(x_new+i.offsetx,y_new+i.offsety);
}
}
@Override
......
......@@ -121,7 +121,7 @@ public class Group extends Item implements ActionListener{
}
}
for(Item i:items) {
i.setOffset(x,y);
i.setOffset(x+offsetx,y+offsety);
}
created = true;
}
......@@ -138,7 +138,7 @@ public class Group extends Item implements ActionListener{
x=Integer.parseInt(x_tf.getText());
y=Integer.parseInt(y_tf.getText());
for(Item i:items) {
i.setOffset(x,y);
i.setOffset(x+offsetx,y+offsety);
}
s.updateItems();
s.expandItem(id);
......@@ -154,7 +154,7 @@ public class Group extends Item implements ActionListener{
x=Integer.parseInt(x_tf.getText());
y=Integer.parseInt(y_tf.getText());
for(Item i:items) {
i.setOffset(x,y);
i.setOffset(x+offsetx,y+offsety);
}
s.updateItems();
s.expandItem(id);
......@@ -320,8 +320,8 @@ public class Group extends Item implements ActionListener{
@Override
public void draw(Graphics2D g,int x_,int y_, int z) {
for(Item i:items) {
i.setOffset(x+x_,y+y_);
i.draw(g,x+x,y+y_,z);
i.setOffset(x+offsetx,y+offsety);
}
}
@Override
......
......@@ -137,7 +137,7 @@ public class Panel extends Item implements ActionListener{
}
}
for(Item i:items) {
i.setOffset(x,y);
i.setOffset(x+offsetx,y+offsety);
}
created = true;
}
......@@ -167,7 +167,7 @@ public class Panel extends Item implements ActionListener{
s.updateItems();
s.expandItem(id);
for(Item i:items) {
i.setOffset(x,y);
i.setOffset(x+offsetx,y+offsety);
}
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
created = true;
......@@ -194,7 +194,7 @@ public class Panel extends Item implements ActionListener{
s.updateItems();
s.expandItem(id);
for(Item i:items) {
i.setOffset(x,y);
i.setOffset(x+offsetx,y+offsety);
}
pee.setNew();
......@@ -236,8 +236,10 @@ public class Panel extends Item implements ActionListener{
help_tf.setToolTipText(Language.get("WIN_ITEM_HELP_TIP"));
JLabel width_l = new JLabel(Language.get("WIN_PANEL_WIDTH"));
width_tf = new JTextField();
width_tf.setDocument(new NumbersOnlyDocument());
JLabel height_l = new JLabel(Language.get("WIN_PANEL_HEIGHT"));
height_tf = new JTextField();
height_tf.setDocument(new NumbersOnlyDocument());
JLabel attr_l = new JLabel(Language.get("NOTE_STARRED"));
ok_btn = new JButton(Language.get("BUTTON_OK"));
ok_btn.addActionListener(this);
......@@ -453,12 +455,12 @@ public class Panel extends Item implements ActionListener{
return code;
}
public void draw(Graphics2D g, int z) {
draw(g,offsetx, offsety, z);
draw(g, offsetx, offsety, z);
}
public void draw(Graphics2D g, int x_, int y_, int z) {
for(Item i:items) {
i.draw(g, x+x, y+y_, z);
i.setOffset(x+offsetx,y+offsety);
i.setOffset(x+x_,y+y_);
i.draw(g, x+x_, y+y_, z);
}
if(selected) {
g.setColor(Color.RED);
......
......@@ -732,8 +732,8 @@ public class Slider extends Item implements ActionListener{
offsety=y_;
//boolean vis = s.gvars.parseBoolean(visible);
if(sbg!=null && vis) {
sbg.draw(g,x+x_,y+y_,z);
sbg.setOffset(x+offsetx,y+offsety);
sbg.setOffset(x+x_,y+y_);
sbg.draw(g,x+x_,y+y_,z);
}
java.awt.image.BufferedImage si = up_res.image;
if(vis && si!=null) g.drawImage(si,(int)(sliderPos.getX()+x+x_-si.getWidth()/2)*z,(int)(sliderPos.getY()+y+y_-si.getHeight()/2)*z,si.getWidth()*z,si.getHeight()*z,null);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment