Skip to content

Commit

Permalink
Fixing more issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
phase1geo committed Dec 7, 2024
1 parent 54dc1ac commit 5efe3fa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
27 changes: 12 additions & 15 deletions src/DrawArea.vala
Original file line number Diff line number Diff line change
Expand Up @@ -1276,21 +1276,18 @@ public class DrawArea : Gtk.DrawingArea {
item and redraws the canvas.
*/
public void add_current_image() {
var nodes = _selected.nodes();
if( nodes.length == 1 ) {
var current = nodes.index( 0 );
if( current.image == null ) {
image_manager.choose_image( win, (id) => {
stdout.printf( "Setting current: %s\n", (current == null) ? "NA" : current.name.text.text );
current.set_image( image_manager, new NodeImage( image_manager, id, current.style.node_width ) );
if( current.image != null ) {
undo_buffer.add_item( new UndoNodeImage( current, null ) );
queue_draw();
current_changed( this );
auto_save();
}
});
}
var current = _selected.current_node();
if( (current != null) && (current.image == null) ) {
image_manager.choose_image( win, (id) => {
var curr = _selected.current_node();
curr.set_image( image_manager, new NodeImage( image_manager, id, curr.style.node_width ) );
if( curr.image != null ) {
undo_buffer.add_item( new UndoNodeImage( curr, null ) );
queue_draw();
current_changed( this );
auto_save();
}
});
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/NodeInspector.vala
Original file line number Diff line number Diff line change
Expand Up @@ -350,25 +350,29 @@ public class NodeInspector : Box {

var lbl = new Label( Utils.make_title( _( "Image" ) ) ) {
halign = Align.START,
hexpand = true,
xalign = (float)0,
use_markup = true
};

var btn_edit = new Button.from_icon_name( "document-edit-symbolic" ) {
halign = Align.END,
tooltip_text = _( "Edit Image" )
};
btn_edit.clicked.connect(() => {
_da.edit_current_image();
});

var btn_del = new Button.from_icon_name( "edit-delete-symbolic" ) {
halign = Align.END,
tooltip_text = _( "Remove Image" )
};
btn_del.clicked.connect(() => {
_da.delete_current_image();
});

_resize = new ToggleButton() {
halign = Align.END,
icon_name = "view-fullscreen-symbolic",
tooltip_text = _( "Resizable" )
};
Expand Down

0 comments on commit 5efe3fa

Please sign in to comment.