LayerSelector: Use Layer Settings for CSV export. This makes the mapping parser unnecessary. It can be removed
This commit is contained in:
parent
e16b7f9d25
commit
a9ccf6533d
@ -711,29 +711,14 @@ static void layer_selector_load_mapping_clicked(GtkWidget *button, gpointer user
|
|||||||
*/
|
*/
|
||||||
static void layer_selector_save_layer_mapping_data(LayerSelector *self, const gchar *file_name)
|
static void layer_selector_save_layer_mapping_data(LayerSelector *self, const gchar *file_name)
|
||||||
{
|
{
|
||||||
FILE *file;
|
LayerSettings *layer_settings;
|
||||||
char workbuff[512];
|
|
||||||
GList *le_list;
|
|
||||||
GList *temp;
|
|
||||||
|
|
||||||
/* Overwrite existing file */
|
g_return_if_fail(LAYER_IS_SELECTOR(self));
|
||||||
file = fopen((const char *)file_name, "w");
|
g_return_if_fail(file_name);
|
||||||
|
|
||||||
le_list = gtk_container_get_children(GTK_CONTAINER(self->list_box));
|
/* Get layer settings. No need to check return value. to_csv func is safe */
|
||||||
|
layer_settings = layer_selector_export_rendered_layer_info(self);
|
||||||
/* File format is CSV: <Layer>,<target_pos>,<R>,<G>,<B>,<Alpha>,<Export?>,<Name> */
|
(void)layer_settings_to_csv(layer_settings, file_name);
|
||||||
for (temp = le_list; temp != NULL; temp = temp->next) {
|
|
||||||
/* To be sure it is a valid string */
|
|
||||||
workbuff[0] = 0;
|
|
||||||
mapping_parser_gen_csv_line(LAYER_ELEMENT(temp->data), workbuff, sizeof(workbuff));
|
|
||||||
fwrite(workbuff, sizeof(char), strlen(workbuff), file);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_list_free(le_list);
|
|
||||||
|
|
||||||
/* Save File */
|
|
||||||
fflush(file);
|
|
||||||
fclose(file);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user