Compare commits

...

3 Commits

4 changed files with 73 additions and 10 deletions

View File

@ -62,6 +62,7 @@ struct _GdsRenderGui {
GtkWidget *open_button;
GtkWidget *load_layer_button;
GtkWidget *save_layer_button;
GtkWidget *select_all_button;
GtkTreeStore *cell_tree_store;
GtkWidget *cell_search_entry;
LayerSelector *layer_selector;
@ -540,6 +541,7 @@ static void gds_render_gui_dispose(GObject *gobject)
g_clear_object(&self->load_layer_button);
g_clear_object(&self->save_layer_button);
g_clear_object(&self->open_button);
g_clear_object(&self->select_all_button);
if (self->main_window) {
g_signal_handlers_destroy(self->main_window);
@ -569,6 +571,15 @@ static void gds_render_gui_class_init(GdsRenderGuiClass *klass)
gobject_class->dispose = gds_render_gui_dispose;
}
static void on_select_all_layers_clicked(GtkWidget *button, gpointer user_data)
{
GdsRenderGui *gui;
(void)button;
gui = RENDERER_GUI(user_data);
layer_selector_select_all_layers(gui->layer_selector, TRUE);
}
GtkWindow *gds_render_gui_get_main_window(GdsRenderGui *gui)
{
return gui->main_window;
@ -651,6 +662,10 @@ static void gds_render_gui_init(GdsRenderGui *self)
self->render_dialog_settings.tex_pdf_layers = FALSE;
self->render_dialog_settings.tex_standalone = FALSE;
/* Get select all button and connect callback */
self->select_all_button = GTK_WIDGET(gtk_builder_get_object(main_builder, "button-select-all"));
g_signal_connect(self->select_all_button, "clicked", G_CALLBACK(on_select_all_layers_clicked), self);
g_object_unref(main_builder);
/* Setup default button sensibility data */
@ -669,6 +684,7 @@ static void gds_render_gui_init(GdsRenderGui *self)
g_object_ref(self->open_button);
g_object_ref(self->load_layer_button);
g_object_ref(self->save_layer_button);
g_object_ref(self->select_all_button);
}
GdsRenderGui *gds_render_gui_new()

View File

@ -92,6 +92,13 @@ LayerSettings *layer_selector_export_rendered_layer_info(LayerSelector *selector
*/
void layer_selector_force_sort(LayerSelector *selector, enum layer_selector_sort_algo sort_function);
/**
* @brief Set 'export' value of all layers in the LayerSelector to the supplied select value
* @param layer_selector LayerSelector object
* @param select
*/
void layer_selector_select_all_layers(LayerSelector *layer_selector, gboolean select);
/**
* @brief Apply colors from palette to all layers. Aditionally set alpha
* @param layer_selector LayerSelector object

View File

@ -780,6 +780,27 @@ void layer_selector_force_sort(LayerSelector *selector, enum layer_selector_sort
gtk_list_box_set_sort_func(box, NULL, NULL, NULL);
}
void layer_selector_select_all_layers(LayerSelector *layer_selector, gboolean select)
{
GList *le_list;
GList *iter;
LayerElement *le;
g_return_if_fail(LAYER_IS_SELECTOR(layer_selector));
g_return_if_fail(GTK_IS_LIST_BOX(layer_selector->list_box));
le_list = gtk_container_get_children(GTK_CONTAINER(layer_selector->list_box));
for (iter = le_list; iter != NULL; iter = g_list_next(iter)) {
le = LAYER_ELEMENT(iter->data);
if (LAYER_IS_ELEMENT(le)) {
layer_element_set_export(le, select);
}
}
g_list_free(le_list);
}
void layer_selector_auto_color_layers(LayerSelector *layer_selector, ColorPalette *palette, double global_alpha)
{
GList *le_list;

View File

@ -17,6 +17,21 @@
<property name="can_focus">False</property>
<property name="stock">gtk-save-as</property>
</object>
<object class="GtkImage" id="select-all-img">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-apply</property>
</object>
<object class="GtkImage" id="sort-down-img">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-sort-ascending</property>
</object>
<object class="GtkImage" id="sort-up-img">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-sort-descending</property>
</object>
<object class="GtkWindow" id="main-window">
<property name="height_request">250</property>
<property name="can_focus">False</property>
@ -205,6 +220,20 @@
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button-select-all">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">select-all-img</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
@ -270,14 +299,4 @@
</object>
</child>
</object>
<object class="GtkImage" id="sort-down-img">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-sort-ascending</property>
</object>
<object class="GtkImage" id="sort-up-img">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-sort-descending</property>
</object>
</interface>