Commit 18b3e5e6 authored by Daniel Dreibrodt's avatar Daniel Dreibrodt

fix: undo/redo of id changes lead to inacessibility of objects in GUI

fix: tiling of middle image in the slider bg generator was not working properly
improvement: prevent possible null-pointer exception in image rendering
improvement: elements can be quickly deleteted by pressing the DELETE key
parent c3316ef3
This diff is collapsed.
......@@ -695,10 +695,10 @@ public class Skin implements ActionListener{
public Item getItem(String id_) {
active_window = null;
active_layout = null;
if(m.selected_window!=null && m.selected_layout!=null) {
active_window = getWindow(m.selected_window);
if(m.getSelectedWindow()!=null && m.getSelectedLayout()!=null) {
active_window = getWindow(m.getSelectedWindow());
if(active_window!=null) {
active_layout = active_window.getLayout(m.selected_layout);
active_layout = active_window.getLayout(m.getSelectedLayout());
}
}
if(active_layout!=null) {
......@@ -737,10 +737,10 @@ public class Skin implements ActionListener{
/** Creates the layout's items hierarchy **/
public DefaultMutableTreeNode getItemsTree() {
DefaultMutableTreeNode top = new DefaultMutableTreeNode("Root: Items");
if(m.selected_window!=null && m.selected_layout!=null) {
active_window = getWindow(m.selected_window);
if(m.getSelectedWindow()!=null && m.getSelectedLayout()!=null) {
active_window = getWindow(m.getSelectedWindow());
if(active_window!=null) {
active_layout = active_window.getLayout(m.selected_layout);
active_layout = active_window.getLayout(m.getSelectedLayout());
}
}
if(active_layout!=null) {
......@@ -837,7 +837,7 @@ public class Skin implements ActionListener{
public void expandLayout(String id) {
TreePath wtp = null;
if(active_window!=null) wtp = findInTree(m.win_tree,active_window.id);
else wtp = findInTree(m.win_tree,m.selected_window);
else wtp = findInTree(m.win_tree,m.getSelectedLayout());
if(wtp==null) return;
m.win_tree.expandPath(wtp);
......
......@@ -35,7 +35,7 @@ public class SliderBGBuilder {
public int nbframes;
int total_height;
boolean usebg, usee1, usee2, useoverlay, tile_bg, tile_middle, horizontal;
int bg_width, e1_width, middle_width, e2_width, e1_height, e2_height, middle_height, bg_height;
int bg_width = 0, e1_width = 0, middle_width = 0, e2_width = 0, e1_height = 0, e2_height = 0, middle_height = 0, bg_height = 0;
BufferedImage output;
JFrame frame;
ProgressWindow pg_win;
......@@ -102,7 +102,9 @@ public class SliderBGBuilder {
//overlay_y = Integer.parseInt(sbgg.overlay_y_tf.getText());
tile_bg = sbgg.bgt_rb.isSelected();
tile_middle = sbgg.mdt_rb.isSelected();
horizontal = sbgg.ltr_rb.isSelected();
horizontal = sbgg.ltr_rb.isSelected();
System.out.println("tile_bg: "+tile_bg);
System.out.println("tile_middle: "+tile_middle);
}
public void build() {
if (horizontal && cancontinue) {
......@@ -129,15 +131,20 @@ public class SliderBGBuilder {
}
}
if (i>0) {
if(i<e1_width) {
if(i<=e1_width) {
BufferedImage tmp = e1.getSubimage(0, 0, i, e1_height);
g.drawImage(tmp,margin_left,height*i+margin_top,i,height-margin_top-margin_bottom,sbgg);
}
else if (i<e1_width+middle_width) {
else if (i<=e1_width+middle_width) {
g.drawImage(e1,margin_left,height*i+margin_top,sbgg);
g.drawImage(middle,margin_left+e1_width,height*i+margin_top,i-e1_width,height-margin_top-margin_bottom,sbgg);
if(!tile_middle)
g.drawImage(middle,margin_left+e1_width,height*i+margin_top,i-e1_width,height-margin_top-margin_bottom,sbgg);
else {
g.drawImage(middle.getSubimage(0, 0, i-e1_width,height-margin_top-margin_bottom),
margin_left+e1_width,height*i+margin_top,i-e1_width,height-margin_top-margin_bottom,sbgg);
}
}
else if(i<e1_width+middle_width+e2_width) {
else if(i<=e1_width+middle_width+e2_width) {
g.drawImage(e1,margin_left,height*i+margin_top,sbgg);
g.drawImage(middle,margin_left+e1_width,height*i+margin_top,sbgg);
g.drawImage(e2,margin_left+e1_width+middle_width,height*i+margin_top,i-e1_width-middle_width,height-margin_top-margin_bottom,sbgg);
......@@ -149,10 +156,10 @@ public class SliderBGBuilder {
int middle_r = gap/middle_width;
int middle_d = gap % middle_width;
for (int x=0;x<middle_r;x++) {
g.drawImage(middle,margin_left+e1_width+x*middle_width,height*i+margin_top,sbgg);
g.drawImage(middle,margin_left+e1_width+x*middle_width,height*i+margin_top,sbgg);
}
g.drawImage(middle, margin_left+e1_width+middle_r*middle_width, height*i+margin_top, middle_d, height-margin_top-margin_bottom, sbgg);
}
g.drawImage(middle, margin_left+e1_width+middle_r*middle_width, height*i+margin_top, middle_d, height-margin_top-margin_bottom, sbgg);
}
else {
int gap = i-e1_width-e2_width;
g.drawImage(middle,margin_left+e1_width,height*i+margin_top,gap,height-margin_top-margin_bottom,sbgg);
......
......@@ -88,6 +88,18 @@ public class History {
}
m.setUndoEnabled(true);
m.setUndoString(current.getDescription());
String s_res = m.getSelectedResource();
m.s.updateResources();
m.s.expandResource(s_res);
String s_win = m.getSelectedInWindows();
m.s.updateWindows();
m.s.expandLayout(s_win);
String s_item = m.getSelectedItem();
m.s.updateItems();
m.s.expandItem(s_item);
}
/**
......@@ -103,6 +115,18 @@ public class History {
m.setRedoString(current.getNext().getDescription());
m.setUndoEnabled(current != root);
m.setUndoString(current.getDescription());
String s_res = m.getSelectedResource();
m.s.updateResources();
m.s.expandResource(s_res);
String s_win = m.getSelectedInWindows();
m.s.updateWindows();
m.s.expandLayout(s_win);
String s_item = m.getSelectedItem();
m.s.updateItems();
m.s.expandItem(s_item);
}
}
......@@ -514,8 +514,9 @@ public class Image extends Item implements ActionListener{
}
@Override
public void draw(Graphics2D g,int x_, int y_, int z) {
if(!created) return;
if(!created) return;
BufferedImage bi = image_res.image;
if(bi==null) return;
if(vis) g.drawImage(bi,(x+x_)*z,(y+y_)*z,bi.getWidth()*z,bi.getHeight()*z,null);
if(selected) {
g.setColor(Color.RED);
......
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