Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Commit

Permalink
fixed issue #115
Browse files Browse the repository at this point in the history
  • Loading branch information
Schneegans committed Aug 7, 2015
1 parent d2ada61 commit 577bbb8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
8 changes: 6 additions & 2 deletions src/images/themedIcon.vala
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public class ThemedIcon : Image {
if (layer.layer_type == SliceLayer.Type.ICON) {
ctx.push_group();

ctx.translate(layer.x, layer.y);
layer.image.paint_on(ctx);

ctx.set_operator(Cairo.Operator.IN);
Expand All @@ -86,18 +87,21 @@ public class ThemedIcon : Image {
}

icon.paint_on(ctx);
ctx.translate(-layer.x, -layer.y);

ctx.pop_group_to_source();
ctx.paint();
ctx.set_operator(Cairo.Operator.OVER);

} else if (layer.layer_type == SliceLayer.Type.CAPTION) {
Image text = new RenderedText(caption, layer.width, layer.height, layer.font, layer.color, Config.global.global_scale);
ctx.translate(0, layer.position);
ctx.translate(layer.x, layer.y);
text.paint_on(ctx);
ctx.translate(0, -layer.position);
ctx.translate(-layer.x, -layer.y);
} else if (layer.layer_type == SliceLayer.Type.FILE) {
ctx.translate(layer.x, layer.y);
layer.image.paint_on(ctx);
ctx.translate(-layer.x, -layer.y);
}

// colorize the whole layer if neccasary
Expand Down
16 changes: 11 additions & 5 deletions src/themes/sliceLayer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,41 @@ public class SliceLayer : GLib.Object {
public string font {get; private set; default="";}
public int width {get; private set; default=0;}
public int height {get; private set; default=0;}
public int position {get; private set; default=0;}
public int x {get; private set; default=0;}
public int y {get; private set; default=0;}
public Color color {get; private set; default=new Color();}

/////////////////////////////////////////////////////////////////////
/// C'tor, initializes all members of the layer.
/////////////////////////////////////////////////////////////////////

public SliceLayer.file(string icon_file, int icon_size, bool colorize, Visibility visibility) {
public SliceLayer.file(string icon_file, int icon_size, int x, int y, bool colorize, Visibility visibility) {
this.layer_type = Type.FILE;
this.icon_file = icon_file;
this.colorize = colorize;
this.icon_size = icon_size;
this.x = x;
this.y = y;
this.visibility = visibility;
}

public SliceLayer.icon(string icon_file, int icon_size, bool colorize, Visibility visibility) {
public SliceLayer.icon(string icon_file, int icon_size, int x, int y, bool colorize, Visibility visibility) {
this.layer_type = Type.ICON;
this.icon_file = icon_file;
this.colorize = colorize;
this.icon_size = icon_size;
this.x = x;
this.y = y;
this.visibility = visibility;
}

public SliceLayer.caption(string font, int width, int height, int position, Color color, bool colorize, Visibility visibility) {
public SliceLayer.caption(string font, int width, int height, int x, int y, Color color, bool colorize, Visibility visibility) {
this.layer_type = Type.CAPTION;
this.font = font;
this.width = width;
this.height = height;
this.position = position;
this.x = x;
this.y = y;
this.color = color;
this.visibility = visibility;
this.colorize = colorize;
Expand Down
12 changes: 6 additions & 6 deletions src/themes/theme.vala
Original file line number Diff line number Diff line change
Expand Up @@ -486,17 +486,17 @@ public class Theme : GLib.Object {
this.visible_slice_radius = Math.fmax(slice_radius*scale, this.visible_slice_radius);

if (slice->name.down() == "activeslice") {
if (type == SliceLayer.Type.ICON) active_slice_layers.add(new SliceLayer.icon(file, size, colorize, visibility));
if (type == SliceLayer.Type.ICON) active_slice_layers.add(new SliceLayer.icon(file, size, pos_x, pos_y, colorize, visibility));
else if (type == SliceLayer.Type.CAPTION) active_slice_layers.add(new SliceLayer.caption(slice_caption_font,
slice_caption_width, slice_caption_height,
pos_y, slice_caption_color, colorize, visibility));
else active_slice_layers.add(new SliceLayer.file(file, size, colorize, visibility));
pos_x, pos_y, slice_caption_color, colorize, visibility));
else active_slice_layers.add(new SliceLayer.file(file, size, pos_x, pos_y, colorize, visibility));
} else {
if (type == SliceLayer.Type.ICON) inactive_slice_layers.add(new SliceLayer.icon(file, size, colorize, visibility));
if (type == SliceLayer.Type.ICON) inactive_slice_layers.add(new SliceLayer.icon(file, size, pos_x, pos_y, colorize, visibility));
else if (type == SliceLayer.Type.CAPTION) inactive_slice_layers.add(new SliceLayer.caption(slice_caption_font,
slice_caption_width, slice_caption_height,
pos_y, slice_caption_color, colorize, visibility));
else inactive_slice_layers.add(new SliceLayer.file(file, size, colorize, visibility));
pos_x, pos_y, slice_caption_color, colorize, visibility));
else inactive_slice_layers.add(new SliceLayer.file(file, size, pos_x, pos_y, colorize, visibility));
}

} else {
Expand Down

0 comments on commit 577bbb8

Please sign in to comment.