Skip to content

Commit

Permalink
Update the enabling of the paste button
Browse files Browse the repository at this point in the history
  • Loading branch information
madd-games committed Oct 2, 2024
1 parent 4a99101 commit 2d982c8
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/gui/edit_panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@

#include "goxel.h"

static bool have_volume_to_paste()
{
const char *clipboard_text;
int size[3];

clipboard_text = sys_callbacks.get_clipboard_text(sys_callbacks.user);
if (clipboard_text == NULL) {
return false;
}

if (volume_parse_string_header(clipboard_text, size) == NULL) {
return false;
}

return true;
}

void gui_edit_panel(void)
{
image_t *img = goxel.image;
Expand All @@ -40,7 +57,7 @@ void gui_edit_panel(void)
gui_enabled_begin(!volume_is_empty(goxel.image->selection_mask));
gui_action_button(ACTION_copy, _("Copy"), 1.0);
gui_enabled_end();
gui_enabled_begin(!volume_is_empty(goxel.clipboard.volume));
gui_enabled_begin(have_volume_to_paste());
gui_action_button(ACTION_paste, _("Paste"), 1.0);
gui_enabled_end();
gui_group_end();
Expand Down

0 comments on commit 2d982c8

Please sign in to comment.