Compare commits

..

No commits in common. "3a72796b2f24413eea84279ac0614393d24889a7" and "27f5a5e3d2f9cd9b3f54991aff4a51f4c1a73349" have entirely different histories.

2 changed files with 1 additions and 42 deletions

View File

@ -103,21 +103,10 @@ void layer_selector_select_all_layers(LayerSelector *layer_selector, gboolean se
* @brief Apply colors from palette to all layers. Aditionally set alpha
* @param layer_selector LayerSelector object
* @param palette Color palette to use
* @param global_alpha Additional alpha value that is applied to all layers. Must be > 0
* @param global_alpha Additional alpha value that is applied to all layers
*/
void layer_selector_auto_color_layers(LayerSelector *layer_selector, ColorPalette *palette, double global_alpha);
/**
* @brief Auto name all layers in the layer selector.
*
* This functions sets the name of the layer equal to its number.
* The \p overwrite parameter specifies if already set layer names are overwritten.
*
* @param layer_selector LayerSelector
* @param overwrite Overwrite existing layer names
*/
void layer_selector_auto_name_layers(LayerSelector *layer_selector, gboolean overwrite);
G_END_DECLS
#endif /* __LAYER_SELECTOR_H__ */

View File

@ -857,34 +857,4 @@ ret_free_le_list:
g_list_free(le_list);
}
void layer_selector_auto_name_layers(LayerSelector *layer_selector, gboolean overwrite)
{
GList *le_list;
GList *le_list_ptr;
LayerElement *le;
const char *old_layer_name;
GString *new_layer_name;
g_return_if_fail(LAYER_IS_SELECTOR(layer_selector));
new_layer_name = g_string_new_len(NULL, 10);
le_list = gtk_container_get_children(GTK_CONTAINER(layer_selector->list_box));
for (le_list_ptr = le_list; le_list_ptr != NULL; le_list_ptr = g_list_next(le_list_ptr)) {
le = LAYER_ELEMENT(le_list_ptr->data);
if (!le)
continue;
old_layer_name = layer_element_get_name(le);
/* Check if layer name is empty or may be overwritten */
if (!old_layer_name || *old_layer_name == '\0' || overwrite) {
g_string_printf(new_layer_name, "Layer %d", layer_element_get_layer(le));
layer_element_set_name(le, new_layer_name->str);
}
}
g_string_free(new_layer_name, TRUE);
g_list_free(le_list);
}
/** @} */