Merge branch 'master' of git.shimatta.de:mhu/gds-render

This commit is contained in:
Mario Hüttel 2019-03-11 10:38:35 +01:00
commit 1ec0f9b297
21 changed files with 545 additions and 97 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "c-style-checker"]
path = c-style-checker
url = https://git.shimatta.de/mhu/c-style-checker

1
c-style-checker Submodule

@ -0,0 +1 @@
Subproject commit 3a58e3dd1c2ef6de78df89c8fdc7ba96b51cd4e0

View File

@ -35,6 +35,7 @@
#include "cairo-output/cairo-output.h" #include "cairo-output/cairo-output.h"
#include "latex-output/latex-output.h" #include "latex-output/latex-output.h"
#include "external-renderer.h" #include "external-renderer.h"
#include "gds-parser/gds-tree-checker.h"
/** /**
* @brief Delete layer_info and free nem element. * @brief Delete layer_info and free nem element.
@ -69,8 +70,10 @@ void command_line_convert_gds(char *gds_name, char *pdf_name, char *tex_name, gb
GList *layer_info_list = NULL; GList *layer_info_list = NULL;
GList *cell_list; GList *cell_list;
struct layer_info *linfo_temp; struct layer_info *linfo_temp;
struct gds_library *first_lib;
struct gds_cell *toplevel_cell = NULL, *temp_cell; struct gds_cell *toplevel_cell = NULL, *temp_cell;
/* Check if parameters are valid */ /* Check if parameters are valid */
if (!gds_name || (!pdf_name && pdf) || (!tex_name && tex) || !layer_file || !cell_name) { if (!gds_name || (!pdf_name && pdf) || (!tex_name && tex) || !layer_file || !cell_name) {
printf("Probably missing argument. Check --help option\n"); printf("Probably missing argument. Check --help option\n");
@ -81,14 +84,14 @@ void command_line_convert_gds(char *gds_name, char *pdf_name, char *tex_name, gb
clear_lib_list(&libs); clear_lib_list(&libs);
res = parse_gds_from_file(gds_name, &libs); res = parse_gds_from_file(gds_name, &libs);
if (res) if (res)
return; goto ret_destroy_library_list;
file = g_file_new_for_path(layer_file); file = g_file_new_for_path(layer_file);
stream = g_file_read(file, NULL, NULL); stream = g_file_read(file, NULL, NULL);
if (!stream) { if (!stream) {
printf("Layer mapping not readable!\n"); printf("Layer mapping not readable!\n");
goto destroy_file; goto ret_destroy_file;
} }
dstream = g_data_input_stream_new(G_INPUT_STREAM(stream)); dstream = g_data_input_stream_new(G_INPUT_STREAM(stream));
i = 0; i = 0;
@ -100,7 +103,7 @@ void command_line_convert_gds(char *gds_name, char *pdf_name, char *tex_name, gb
linfo_temp = (struct layer_info *)malloc(sizeof(struct layer_info)); linfo_temp = (struct layer_info *)malloc(sizeof(struct layer_info));
if (!linfo_temp) { if (!linfo_temp) {
printf("Out of memory\n"); printf("Out of memory\n");
goto ret_clear_list; goto ret_clear_layer_list;
} }
linfo_temp->color.alpha = layer_color.alpha; linfo_temp->color.alpha = layer_color.alpha;
linfo_temp->color.red = layer_color.red; linfo_temp->color.red = layer_color.red;
@ -116,9 +119,15 @@ void command_line_convert_gds(char *gds_name, char *pdf_name, char *tex_name, gb
/* find_cell in first library. */ /* find_cell in first library. */
if (!libs) if (!libs)
goto ret_clear_list; goto ret_clear_layer_list;
for (cell_list = ((struct gds_library *)libs->data)->cells; cell_list != NULL; cell_list = g_list_next(cell_list)) { first_lib = (struct gds_library *)libs->data;
if (!first_lib) {
fprintf(stderr, "No library in library list. This should not happen.\n");
goto ret_clear_layer_list;
}
for (cell_list = first_lib->cells; cell_list != NULL; cell_list = g_list_next(cell_list)) {
temp_cell = (struct gds_cell *)cell_list->data; temp_cell = (struct gds_cell *)cell_list->data;
if (!strcmp(temp_cell->name, cell_name)) { if (!strcmp(temp_cell->name, cell_name)) {
toplevel_cell = temp_cell; toplevel_cell = temp_cell;
@ -128,9 +137,31 @@ void command_line_convert_gds(char *gds_name, char *pdf_name, char *tex_name, gb
if (!toplevel_cell) { if (!toplevel_cell) {
printf("Couldn't find cell in first library!\n"); printf("Couldn't find cell in first library!\n");
goto ret_clear_list; goto ret_clear_layer_list;
} }
/* Check if cell passes vital checks */
res = gds_tree_check_reference_loops(toplevel_cell->parent_library);
if (res < 0) {
fprintf(stderr, "Checking library %s failed.\n", first_lib->name);
goto ret_clear_layer_list;
} else if (res > 0) {
fprintf(stderr, "%d reference loops found.\n", res);
/* do further checking if the specified cell and/or its subcells are affected */
if (toplevel_cell->checks.affected_by_reference_loop == 1) {
fprintf(stderr, "Cell is affected by reference loop. Abort!\n");
goto ret_clear_layer_list;
}
}
if (toplevel_cell->checks.affected_by_reference_loop == GDS_CELL_CHECK_NOT_RUN)
fprintf(stderr, "Cell was not checked. This should not happen. Please report this issue. Will continue either way.\n");
/* Note: unresolved references are not an abort condition.
* Deal with it.
*/
/* Render outputs */ /* Render outputs */
if (pdf == TRUE || svg == TRUE) { if (pdf == TRUE || svg == TRUE) {
cairo_render_cell_to_vector_file(toplevel_cell, layer_info_list, (pdf == TRUE ? pdf_name : NULL), cairo_render_cell_to_vector_file(toplevel_cell, layer_info_list, (pdf == TRUE ? pdf_name : NULL),
@ -140,14 +171,14 @@ void command_line_convert_gds(char *gds_name, char *pdf_name, char *tex_name, gb
if (tex == TRUE) { if (tex == TRUE) {
tex_file = fopen(tex_name, "w"); tex_file = fopen(tex_name, "w");
if (!tex_file) if (!tex_file)
goto ret_clear_list; goto ret_clear_layer_list;
latex_render_cell_to_code(toplevel_cell, layer_info_list, tex_file, scale, pdf_layers, pdf_standalone); latex_render_cell_to_code(toplevel_cell, layer_info_list, tex_file, scale, pdf_layers, pdf_standalone);
fclose(tex_file); fclose(tex_file);
} }
if (so_name && so_out_file) { if (so_name && so_out_file) {
if (strlen(so_name) == 0 || strlen(so_out_file) == 0) if (strlen(so_name) == 0 || strlen(so_out_file) == 0)
goto ret_clear_list; goto ret_clear_layer_list;
/* Render output using external renderer */ /* Render output using external renderer */
printf("Invoking external renderer!\n"); printf("Invoking external renderer!\n");
@ -155,15 +186,16 @@ void command_line_convert_gds(char *gds_name, char *pdf_name, char *tex_name, gb
printf("External renderer finished!\n"); printf("External renderer finished!\n");
} }
ret_clear_list: ret_clear_layer_list:
g_list_free_full(layer_info_list, (GDestroyNotify)delete_layer_info_with_name); g_list_free_full(layer_info_list, (GDestroyNotify)delete_layer_info_with_name);
g_object_unref(dstream); g_object_unref(dstream);
g_object_unref(stream); g_object_unref(stream);
destroy_file: ret_destroy_file:
g_object_unref(file); g_object_unref(file);
/* Delete all allocated libraries */
ret_destroy_library_list:
clear_lib_list(&libs);
} }
/** @} */ /** @} */

View File

@ -2,7 +2,7 @@
/** /**
* @defgroup trigonometric Trigonometric Helper Functions * @defgroup trigonometric Trigonometric Helper Functions
* @description The trigonometric helper function will be used in future releases to pcalculate bounding boxes *
* @note Currently not in use! * The trigonometric helper function are used to calculate bounding boxes
* @warning Code is incomplete. DO NOT USE! * @warning Code is incomplete. Please double check for functionality!
*/ */

View File

@ -6,7 +6,7 @@ To use the application on the command line check 'gds-render --help'.
Application Options: Application Options:
- -t, --tikz Output TikZ code - -t, --tikz Output TikZ code
- -p, --pdf Output PDF document - -p, --pdf Output PDF document
- -s, --scale=<SCALE> Divide output coordinates by <SCALE> - -s, --scale=SCALE Divide output coordinates by SCALE
- -o, --tex-output=PATH Optional path for TeX file - -o, --tex-output=PATH Optional path for TeX file
- -O, --pdf-output=PATH Optional path for PDF file - -O, --pdf-output=PATH Optional path for PDF file
- -m, --mapping=PATH Path for Layer Mapping File - -m, --mapping=PATH Path for Layer Mapping File

View File

@ -32,7 +32,8 @@
#include <dlfcn.h> #include <dlfcn.h>
#include <stdio.h> #include <stdio.h>
int external_renderer_render_cell(struct gds_cell *toplevel_cell, GList *layer_info_list, char *output_file, char *so_path) int external_renderer_render_cell(struct gds_cell *toplevel_cell, GList *layer_info_list,
char *output_file, char *so_path)
{ {
int (*so_render_func)(struct gds_cell *, GList *, char *) = NULL; int (*so_render_func)(struct gds_cell *, GList *, char *) = NULL;
void *so_handle = NULL; void *so_handle = NULL;
@ -40,9 +41,8 @@ int external_renderer_render_cell(struct gds_cell *toplevel_cell, GList *layer_i
int ret = 0; int ret = 0;
/* Check parameter sanity */ /* Check parameter sanity */
if (!output_file || !so_path || !toplevel_cell || !layer_info_list) { if (!output_file || !so_path || !toplevel_cell || !layer_info_list)
return -3000; return -3000;
}
/* Load shared object */ /* Load shared object */
so_handle = dlopen(so_path, RTLD_LAZY); so_handle = dlopen(so_path, RTLD_LAZY);
@ -53,7 +53,8 @@ int external_renderer_render_cell(struct gds_cell *toplevel_cell, GList *layer_i
/* Load symbol from library */ /* Load symbol from library */
so_render_func = (int (*)(struct gds_cell *, GList *, char *))dlsym(so_handle, EXTERNAL_LIBRARY_FUNCTION); so_render_func = (int (*)(struct gds_cell *, GList *, char *))dlsym(so_handle, EXTERNAL_LIBRARY_FUNCTION);
if ((error_msg = dlerror()) != NULL) { error_msg = dlerror();
if (error_msg != NULL) {
printf("Rendering function not found in library:\n%s\n", error_msg); printf("Rendering function not found in library:\n%s\n", error_msg);
goto ret_close_so_handle; goto ret_close_so_handle;
} }

View File

@ -36,7 +36,8 @@
/** /**
* @brief function name expected to be found in external library. * @brief function name expected to be found in external library.
* @detail The function has to be defined as follows: *
* The function has to be defined as follows:
* @code * @code
* int function_name(gds_cell *toplevel, GList *layer_info_list, char *output_file_name) * int function_name(gds_cell *toplevel, GList *layer_info_list, char *output_file_name)
* @endcode * @endcode

View File

@ -17,11 +17,6 @@
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>. * along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
*/ */
/*
*/
/** /**
* @file gds-parser.c * @file gds-parser.c
* @brief Implementation of the GDS-Parser * @brief Implementation of the GDS-Parser
@ -35,7 +30,7 @@
*/ */
/** /**
* @addtogroup GDS-Parser * @addtogroup GDS-Utilities
* @{ * @{
*/ */
@ -304,6 +299,8 @@ static GList *append_cell(GList *curr_list, struct gds_cell **cell_ptr)
cell->graphic_objs = NULL; cell->graphic_objs = NULL;
cell->name[0] = 0; cell->name[0] = 0;
cell->parent_library = NULL; cell->parent_library = NULL;
cell->checks.unresolved_child_count = GDS_CELL_CHECK_NOT_RUN;
cell->checks.affected_by_reference_loop = GDS_CELL_CHECK_NOT_RUN;
} else } else
return NULL; return NULL;
/* return cell */ /* return cell */
@ -665,7 +662,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
break; break;
case SREF: case SREF:
if (current_cell == NULL) { if (current_cell == NULL) {
GDS_ERROR("Path outside of cell"); GDS_ERROR("Cell Reference outside of cell");
run = -3; run = -3;
break; break;
} }
@ -813,7 +810,11 @@ int parse_gds_from_file(const char *filename, GList **library_list)
break; break;
case SNAME: case SNAME:
name_cell_ref(current_s_reference, read, workbuff); if (current_s_reference) {
name_cell_ref(current_s_reference, (unsigned int)read, workbuff);
} else {
GDS_ERROR("reference name set outside of cell reference.\n");
}
break; break;
case WIDTH: case WIDTH:
if (!current_graphics) { if (!current_graphics) {
@ -866,7 +867,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
break; break;
} }
if (current_graphics->gfx_type == GRAPHIC_PATH) { if (current_graphics->gfx_type == GRAPHIC_PATH) {
current_graphics->path_render_type = (int)gds_convert_signed_int16(workbuff); current_graphics->path_render_type = (enum path_type)gds_convert_signed_int16(workbuff);
GDS_INF("\t\tPathtype: %d\n", current_graphics->path_render_type); GDS_INF("\t\tPathtype: %d\n", current_graphics->path_render_type);
} else { } else {
GDS_WARN("Path type defined inside non-path graphics object. Ignoring"); GDS_WARN("Path type defined inside non-path graphics object. Ignoring");
@ -897,6 +898,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
*/ */
static void delete_cell_inst_element(struct gds_cell_instance *cell_inst) static void delete_cell_inst_element(struct gds_cell_instance *cell_inst)
{ {
if (cell_inst)
free(cell_inst); free(cell_inst);
} }
@ -906,6 +908,7 @@ static void delete_cell_inst_element(struct gds_cell_instance *cell_inst)
*/ */
static void delete_vertex(struct gds_point *vertex) static void delete_vertex(struct gds_point *vertex)
{ {
if (vertex)
free(vertex); free(vertex);
} }
@ -915,6 +918,9 @@ static void delete_vertex(struct gds_point *vertex)
*/ */
static void delete_graphics_obj(struct gds_graphics *gfx) static void delete_graphics_obj(struct gds_graphics *gfx)
{ {
if (!gfx)
return;
g_list_free_full(gfx->vertices, (GDestroyNotify)delete_vertex); g_list_free_full(gfx->vertices, (GDestroyNotify)delete_vertex);
free(gfx); free(gfx);
} }
@ -925,6 +931,9 @@ static void delete_graphics_obj(struct gds_graphics *gfx)
*/ */
static void delete_cell_element(struct gds_cell *cell) static void delete_cell_element(struct gds_cell *cell)
{ {
if (!cell)
return;
g_list_free_full(cell->child_cells, (GDestroyNotify)delete_cell_inst_element); g_list_free_full(cell->child_cells, (GDestroyNotify)delete_cell_inst_element);
g_list_free_full(cell->graphic_objs, (GDestroyNotify)delete_graphics_obj); g_list_free_full(cell->graphic_objs, (GDestroyNotify)delete_graphics_obj);
free(cell); free(cell);
@ -936,6 +945,9 @@ static void delete_cell_element(struct gds_cell *cell)
*/ */
static void delete_library_element(struct gds_library *lib) static void delete_library_element(struct gds_library *lib)
{ {
if (!lib)
return;
g_list_free(lib->cell_names); g_list_free(lib->cell_names);
g_list_free_full(lib->cells, (GDestroyNotify)delete_cell_element); g_list_free_full(lib->cells, (GDestroyNotify)delete_cell_element);
free(lib); free(lib);
@ -943,8 +955,12 @@ static void delete_library_element(struct gds_library *lib)
int clear_lib_list(GList **library_list) int clear_lib_list(GList **library_list)
{ {
if (!library_list)
return 0;
if (*library_list == NULL) if (*library_list == NULL)
return 0; return 0;
g_list_free_full(*library_list, (GDestroyNotify)delete_library_element); g_list_free_full(*library_list, (GDestroyNotify)delete_library_element);
*library_list = NULL; *library_list = NULL;
return 0; return 0;

View File

@ -24,7 +24,7 @@
*/ */
/** /**
* @addtogroup GDS-Parser * @addtogroup GDS-Utilities
* @{ * @{
*/ */

View File

@ -0,0 +1,200 @@
/*
* GDSII-Converter
* Copyright (C) 2019 Mario Hüttel <mario.huettel@gmx.net>
*
* This file is part of GDSII-Converter.
*
* GDSII-Converter is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* GDSII-Converter is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file gds-tree-checker.c
* @brief Checking functions of a cell tree
*
* This file contains cehcking functions for the GDS cell tree.
* These functions include checks if all child references could be resolved,
* and if the cell tree contains loops.
*
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/**
* @addtogroup GDS-Utilities
* @{
*/
#include "gds-tree-checker.h"
#include <stdio.h>
int gds_tree_check_cell_references(struct gds_library *lib)
{
GList *cell_iter;
struct gds_cell *cell;
GList *instance_iter;
struct gds_cell_instance *cell_inst;
int total_unresolved_count = 0;
if (!lib)
return -1;
/* Iterate over all cells in library */
for (cell_iter = lib->cells; cell_iter != NULL; cell_iter = g_list_next(cell_iter)) {
cell = (struct gds_cell *)cell_iter->data;
/* Check if this list element is broken. This should never happen */
if (!cell) {
fprintf(stderr, "Broken cell list item found. Will continue.\n");
continue;
}
/* Reset the unresolved cell reference counter to 0 */
cell->checks.unresolved_child_count = 0;
/* Iterate through all child cell references and check if the references are set */
for (instance_iter = cell->child_cells; instance_iter != NULL;
instance_iter = g_list_next(instance_iter)) {
cell_inst = (struct gds_cell_instance *)instance_iter->data;
/* Check if broken. This should not happen */
if (!cell_inst) {
fprintf(stderr, "Broken cell list item found in cell %s. Will continue.\n",
cell->name);
continue;
}
/* Check if instance is valid; else increment "error" counter of cell */
if (!cell_inst->cell_ref) {
total_unresolved_count++;
cell->checks.unresolved_child_count++;
}
}
}
return total_unresolved_count;
}
/**
* @brief Check if list contains a cell
* @param list GList to check. May be a null pointer
* @param cell Cell to check for
* @return 0 if cell is not in list. 1 if cell is in list
*/
static int gds_tree_check_list_contains_cell(GList *list, struct gds_cell *cell) {
GList *iter;
for (iter = list; iter != NULL; iter = g_list_next(iter)) {
if ((struct gds_cell *)iter->data == cell)
return 1;
}
return 0;
}
/**
* @brief This function follows down the reference list of a cell and marks each visited subcell and detects loops
* @param cell_to_check The cell to check for reference loops
* @param visited_cells Pointer to list head. May be zero.
* @return 0 if no loops exist; error in processing: <0; loop found: >0
*/
static int gds_tree_check_iterate_ref_and_check(struct gds_cell *cell_to_check, GList **visited_cells)
{
GList *ref_iter;
struct gds_cell_instance *ref;
struct gds_cell *sub_cell;
int res;
if (!cell_to_check)
return -1;
/* Check if this cell is already contained in visited cells. This indicates a loop */
if (gds_tree_check_list_contains_cell(*visited_cells, cell_to_check))
return 1;
/* Add cell to visited cell list */
*visited_cells = g_list_append(*visited_cells, (gpointer)cell_to_check);
/* Mark references and process sub cells */
for (ref_iter = cell_to_check->child_cells; ref_iter != NULL; ref_iter = g_list_next(ref_iter)) {
ref = (struct gds_cell_instance *)ref_iter->data;
if (!ref)
return -1;
sub_cell = ref->cell_ref;
/* If cell is not resolved, ignore. No harm there */
if (!sub_cell)
continue;
res = gds_tree_check_iterate_ref_and_check(sub_cell, visited_cells);
if (res < 0) {
/* Error. return. */
return -3;
} else if (res > 0) {
/* Loop in subcell found. Propagate to top */
return 1;
}
}
/* Remove cell from visted cells */
*visited_cells = g_list_remove(*visited_cells, cell_to_check);
/* No error found in this chain */
return 0;
}
int gds_tree_check_reference_loops(struct gds_library *lib)
{
int res;
int loop_count = 0;
GList *cell_iter;
struct gds_cell *cell_to_check;
GList *visited_cells = NULL;
if (!lib)
return -1;
for (cell_iter = lib->cells; cell_iter != NULL; cell_iter = g_list_next(cell_iter)) {
cell_to_check = (struct gds_cell *)cell_iter->data;
/* A broken cell reference will be counted fatal in this case */
if (!cell_to_check)
return -2;
/* iterate through references and check if loop exists */
res = gds_tree_check_iterate_ref_and_check(cell_to_check, &visited_cells);
if (res < 0) {
/* Error */
return res;
} else if (res > 0) {
/* Loop found: increment loop count and flag cell */
cell_to_check->checks.affected_by_reference_loop = 1;
loop_count++;
} else if (res == 0) {
/* No error found for this cell */
cell_to_check->checks.affected_by_reference_loop = 0;
}
}
if (visited_cells) {
fprintf(stderr, "Visited cell list should be empty. This is a bug. Please report this.\n");
g_list_free(visited_cells);
}
return loop_count;
}
/** @} */

View File

@ -0,0 +1,61 @@
/*
* GDSII-Converter
* Copyright (C) 2019 Mario Hüttel <mario.huettel@gmx.net>
*
* This file is part of GDSII-Converter.
*
* GDSII-Converter is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* GDSII-Converter is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file gds-tree-checker.h
* @brief Checking functions of a cell tree (Header)
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/**
* @addtogroup GDS-Utilities
* @{
*/
#ifndef _GDS_TREE_CHECKER_H_
#define _GDS_TREE_CHECKER_H_
#include "gds-types.h"
/**
* @brief gds_tree_check_cell_references checks if all child cell references can be resolved in the given library
*
* This function will only mark cells that
* directly contain unresolved references.
*
* If a cell contains a reference to a cell with unresolved references, it is not flagged.
*
* @param lib The GDS library to check
* @return less than 0 if an error occured during processing; 0 if all child cells could be resolved;
* greater than zero if the processing was successful but not all cell references could be resolved.
* In this case the number of unresolved references is returned
*/
int gds_tree_check_cell_references(struct gds_library *lib);
/**
* @brief gds_tree_check_reference_loops checks if the given library contains reference loops
* @param lib GDS library
* @return negative if an error occured, zero if there are no reference loops, else a positive number representing the number
* of affected cells
*/
int gds_tree_check_reference_loops(struct gds_library *lib);
#endif /* _GDS_TREE_CHECKER_H_ */
/** @} */

View File

@ -24,7 +24,7 @@
*/ */
/** /**
* @addtogroup GDS-Parser * @addtogroup GDS-Utilities
* @{ * @{
*/ */
@ -35,9 +35,15 @@
#include <glib.h> #include <glib.h>
#define CELL_NAME_MAX (100) /**< @brief Maximum length of a gds_cell::name or a gds_library::name */ #define CELL_NAME_MAX (100) /**< @brief Maximum length of a gds_cell::name or a gds_library::name */
/* Maybe use the macros that ship with the compiler? */
#define MIN(a,b) (((a) < (b)) ? (a) : (b)) /**< @brief Return smaller number */ #define MIN(a,b) (((a) < (b)) ? (a) : (b)) /**< @brief Return smaller number */
#define MAX(a,b) (((a) > (b)) ? (a) : (b)) /**< @brief Return bigger number */ #define MAX(a,b) (((a) > (b)) ? (a) : (b)) /**< @brief Return bigger number */
/** @brief Defintion of check counter default value
* that indicates that the corresponding check has not yet been executed */
enum {GDS_CELL_CHECK_NOT_RUN = -1};
/** @brief Types of graphic objects */ /** @brief Types of graphic objects */
enum graphics_type enum graphics_type
{ {
@ -59,6 +65,21 @@ struct gds_point {
int y; int y;
}; };
/**
* @brief Stores the result of the cell checks.
*/
struct gds_cell_checks {
int unresolved_child_count; /**< @brief Number of unresolved cell instances inside this cell. Default: GDS_CELL_CHECK_NOT_RUN */
int affected_by_reference_loop; /**< @brief 1 if the cell is affected by a reference loop and therefore not renderable. Default: GDS_CELL_CHECK_NOT_RUN*/
/**
* @brief For the internal use of the checker.
* @warning Do not use this structure and its contents!
*/
struct _check_internals {
int marker;
} _internal;
};
/** /**
* @brief Date information for cells and libraries * @brief Date information for cells and libraries
*/ */
@ -105,6 +126,7 @@ struct gds_cell {
GList *child_cells; /**< @brief List of #gds_cell_instance elements */ GList *child_cells; /**< @brief List of #gds_cell_instance elements */
GList *graphic_objs; /**< @brief List of #gds_graphics */ GList *graphic_objs; /**< @brief List of #gds_graphics */
struct gds_library *parent_library; /**< @brief Pointer to parent library */ struct gds_library *parent_library; /**< @brief Pointer to parent library */
struct gds_cell_checks checks; /**< @brief Checking results */
}; };
/** /**

View File

@ -38,6 +38,8 @@
#include "cairo-output/cairo-output.h" #include "cairo-output/cairo-output.h"
#include "trigonometric/cell-trigonometrics.h" #include "trigonometric/cell-trigonometrics.h"
#include "version/version.h" #include "version/version.h"
#include "tree-renderer/lib-cell-renderer.h"
#include "gds-parser/gds-tree-checker.h"
/** /**
* @brief User data supplied to callback function of the open button * @brief User data supplied to callback function of the open button
@ -115,10 +117,13 @@ static void on_load_gds(gpointer button, gpointer user)
char *filename; char *filename;
GString *mod_date; GString *mod_date;
GString *acc_date; GString *acc_date;
GdkRGBA cell_text_color; unsigned int cell_error_level;
open_dialog = gtk_file_chooser_dialog_new("Open GDSII File", ptr->main_window, GTK_FILE_CHOOSER_ACTION_OPEN, open_dialog = gtk_file_chooser_dialog_new("Open GDSII File", ptr->main_window,
"Cancel", GTK_RESPONSE_CANCEL, "Open GDSII", GTK_RESPONSE_ACCEPT, NULL); GTK_FILE_CHOOSER_ACTION_OPEN,
"Cancel", GTK_RESPONSE_CANCEL,
"Open GDSII", GTK_RESPONSE_ACCEPT,
NULL);
file_chooser = GTK_FILE_CHOOSER(open_dialog); file_chooser = GTK_FILE_CHOOSER(open_dialog);
/* Add GDS II Filter */ /* Add GDS II Filter */
filter = gtk_file_filter_new(); filter = gtk_file_filter_new();
@ -163,6 +168,10 @@ static void on_load_gds(gpointer button, gpointer user)
CELL_SEL_ACCESSDATE, acc_date->str, CELL_SEL_ACCESSDATE, acc_date->str,
-1); -1);
/* Check this library. This might take a while */
(void)gds_tree_check_cell_references(gds_lib);
(void)gds_tree_check_reference_loops(gds_lib);
/* Delete GStrings including string data. */ /* Delete GStrings including string data. */
/* Cell store copies String type data items */ /* Cell store copies String type data items */
g_string_free(mod_date, TRUE); g_string_free(mod_date, TRUE);
@ -176,20 +185,21 @@ static void on_load_gds(gpointer button, gpointer user)
mod_date = generate_string_from_date(&gds_c->mod_time); mod_date = generate_string_from_date(&gds_c->mod_time);
acc_date = generate_string_from_date(&gds_c->access_time); acc_date = generate_string_from_date(&gds_c->access_time);
cell_text_color.alpha = 1; /* Get the checking results for this cell */
cell_text_color.red = (double)61.0/(double)255.0; cell_error_level = 0;
cell_text_color.green = (double)152.0/(double)255.0; if (gds_c->checks.unresolved_child_count)
cell_text_color.blue = 0.0; cell_error_level |= LIB_CELL_RENDERER_ERROR_WARN;
/* Add cell to tree store model /* Check if it is completely b0rken */
* CELL_SEL_CELL_COLOR will always be green, if (gds_c->checks.affected_by_reference_loop)
* because no cell cehcker is implemented, yet. cell_error_level |= LIB_CELL_RENDERER_ERROR_ERR;
*/
/* Add cell to tree store model */
gtk_tree_store_set(store, &celliter, gtk_tree_store_set(store, &celliter,
CELL_SEL_CELL, gds_c, CELL_SEL_CELL, gds_c,
CELL_SEL_MODDATE, mod_date->str, CELL_SEL_MODDATE, mod_date->str,
CELL_SEL_ACCESSDATE, acc_date->str, CELL_SEL_ACCESSDATE, acc_date->str,
CELL_SEL_CELL_COLOR, &cell_text_color, // TODO: implement cell checker CELL_SEL_CELL_ERROR_STATE, cell_error_level,
-1); -1);
/* Delete GStrings including string data. */ /* Delete GStrings including string data. */
@ -232,7 +242,7 @@ static void on_convert_clicked(gpointer button, gpointer user)
gint res; gint res;
char *file_name; char *file_name;
union bounding_box cell_box; union bounding_box cell_box;
double height, width; unsigned int height, width;
/* Get selected cell */ /* Get selected cell */
selection = gtk_tree_view_get_selection(data->tree_view); selection = gtk_tree_view_get_selection(data->tree_view);
@ -251,9 +261,12 @@ static void on_convert_clicked(gpointer button, gpointer user)
bounding_box_prepare_empty(&cell_box); bounding_box_prepare_empty(&cell_box);
calculate_cell_bounding_box(&cell_box, cell_to_render); calculate_cell_bounding_box(&cell_box, cell_to_render);
/* Calculate size in meters database units */ /* Calculate size in database units
height = (cell_box.vectors.upper_right.y - cell_box.vectors.lower_left.y); * Note that the results are bound to be positive,
width = (cell_box.vectors.upper_right.x - cell_box.vectors.lower_left.x); * so casting them to unsigned int is asbsolutely valid
*/
height = (unsigned int)(cell_box.vectors.upper_right.y - cell_box.vectors.lower_left.y);
width = (unsigned int)(cell_box.vectors.upper_right.x - cell_box.vectors.lower_left.x);
/* Show settings dialog */ /* Show settings dialog */
settings = renderer_settings_dialog_new(GTK_WINDOW(data->main_window)); settings = renderer_settings_dialog_new(GTK_WINDOW(data->main_window));
@ -312,8 +325,12 @@ static void on_convert_clicked(gpointer button, gpointer user)
case RENDERER_CAIROGRAPHICS_SVG: case RENDERER_CAIROGRAPHICS_SVG:
case RENDERER_CAIROGRAPHICS_PDF: case RENDERER_CAIROGRAPHICS_PDF:
cairo_render_cell_to_vector_file(cell_to_render, layer_list, cairo_render_cell_to_vector_file(cell_to_render, layer_list,
(sett.renderer == RENDERER_CAIROGRAPHICS_PDF ? file_name : NULL), (sett.renderer == RENDERER_CAIROGRAPHICS_PDF
(sett.renderer == RENDERER_CAIROGRAPHICS_SVG ? file_name : NULL), ? file_name
: NULL),
(sett.renderer == RENDERER_CAIROGRAPHICS_SVG
? file_name
: NULL),
sett.scale); sett.scale);
break; break;
} }
@ -405,7 +422,7 @@ GtkWindow *create_main_window()
g_object_unref(main_builder); g_object_unref(main_builder);
return (conv_data.main_window); return conv_data.main_window;
} }
/** @} */ /** @} */

6
main.c
View File

@ -32,7 +32,7 @@ struct application_data {
static void app_quit(GSimpleAction *action, GVariant *parameter, gpointer user_data) static void app_quit(GSimpleAction *action, GVariant *parameter, gpointer user_data)
{ {
struct application_data *appdata = (struct application_data *)user_data; const struct application_data * const appdata = (const struct application_data *)user_data;
(void)action; (void)action;
(void)parameter; (void)parameter;
@ -43,7 +43,7 @@ static void app_about(GSimpleAction *action, GVariant *parameter, gpointer user_
{ {
GtkBuilder *builder; GtkBuilder *builder;
GtkDialog *dialog; GtkDialog *dialog;
struct application_data *appdata = (struct application_data *)user_data; const struct application_data * const appdata = (const struct application_data *)user_data;
(void)action; (void)action;
(void)parameter; (void)parameter;
@ -64,7 +64,7 @@ const static GActionEntry app_actions[] = {
static void gapp_activate(GApplication *app, gpointer user_data) static void gapp_activate(GApplication *app, gpointer user_data)
{ {
GtkWindow *main_window; GtkWindow *main_window;
struct application_data *appdata = (struct application_data *)user_data; struct application_data * const appdata = (struct application_data *)user_data;
main_window = create_main_window(); main_window = create_main_window();
appdata->main_window = main_window; appdata->main_window = main_window;

View File

@ -25,6 +25,7 @@ G_DEFINE_TYPE(LibCellRenderer, lib_cell_renderer, GTK_TYPE_CELL_RENDERER_TEXT)
enum { enum {
PROP_LIB = 1, PROP_LIB = 1,
PROP_CELL, PROP_CELL,
PROP_ERROR_LEVEL,
PROP_COUNT PROP_COUNT
}; };
@ -38,24 +39,56 @@ static void lib_cell_renderer_constructed(GObject *obj)
G_OBJECT_CLASS(lib_cell_renderer_parent_class)->constructed(obj); G_OBJECT_CLASS(lib_cell_renderer_parent_class)->constructed(obj);
} }
static void convert_error_level_to_color(GdkRGBA *color, unsigned int error_level)
{
/* Always use no transparency */
color->alpha = 1.0;
if (error_level & LIB_CELL_RENDERER_ERROR_ERR) {
/* Error set. Color cell red */
color->red = 1.0;
color->blue = 0.0;
color->green = 0.0;
} else if (error_level & LIB_CELL_RENDERER_ERROR_WARN) {
/* Only warning set; orange color */
color->red = 1.0;
color->blue = 0.0;
color->green = 0.6;
} else {
/* Everything okay; green color */
color->red = (double)61.0/(double)255.0;
color->green = (double)152.0/(double)255.0;
color->blue = 0.0;
}
}
static void lib_cell_renderer_set_property(GObject *object, static void lib_cell_renderer_set_property(GObject *object,
guint param_id, guint param_id,
const GValue *value, const GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GValue val = G_VALUE_INIT; GValue val = G_VALUE_INIT;
GdkRGBA color;
g_value_init(&val, G_TYPE_STRING);
switch (param_id) { switch (param_id) {
case PROP_LIB: case PROP_LIB:
g_value_init(&val, G_TYPE_STRING);
g_value_set_string(&val, ((struct gds_library *)g_value_get_pointer(value))->name); g_value_set_string(&val, ((struct gds_library *)g_value_get_pointer(value))->name);
g_object_set_property(object, "text", &val); g_object_set_property(object, "text", &val);
break; break;
case PROP_CELL: case PROP_CELL:
g_value_init(&val, G_TYPE_STRING);
g_value_set_string(&val, ((struct gds_cell *)g_value_get_pointer(value))->name); g_value_set_string(&val, ((struct gds_cell *)g_value_get_pointer(value))->name);
g_object_set_property(object, "text", &val); g_object_set_property(object, "text", &val);
break; break;
case PROP_ERROR_LEVEL:
/* Set cell color according to error level */
g_value_init(&val, GDK_TYPE_RGBA);
convert_error_level_to_color(&color, g_value_get_uint(value));
g_value_set_boxed(&val, &color);
g_object_set_property(object, "foreground-rgba", &val);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
break; break;
@ -89,6 +122,8 @@ void lib_cell_renderer_class_init(LibCellRendererClass *klass)
properties[PROP_CELL] = g_param_spec_pointer("gds-cell", "gds-cell", properties[PROP_CELL] = g_param_spec_pointer("gds-cell", "gds-cell",
"Cell reference to be displayed", "Cell reference to be displayed",
G_PARAM_WRITABLE); G_PARAM_WRITABLE);
properties[PROP_ERROR_LEVEL] = g_param_spec_uint("error-level", "error-level",
"Error level of this cell", 0, 255, 0, G_PARAM_WRITABLE);
g_object_class_install_properties(oclass, PROP_COUNT, properties); g_object_class_install_properties(oclass, PROP_COUNT, properties);
} }

View File

@ -27,6 +27,9 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE(LibCellRenderer, lib_cell_renderer, LIB_CELL, RENDERER, GtkCellRendererText) G_DECLARE_FINAL_TYPE(LibCellRenderer, lib_cell_renderer, LIB_CELL, RENDERER, GtkCellRendererText)
#define TYPE_LIB_CELL_RENDERER (lib_cell_renderer_get_type()) #define TYPE_LIB_CELL_RENDERER (lib_cell_renderer_get_type())
#define LIB_CELL_RENDERER_ERROR_WARN (1U<<0)
#define LIB_CELL_RENDERER_ERROR_ERR (1U<<1)
typedef struct _LibCellRenderer { typedef struct _LibCellRenderer {
/* Inheritance */ /* Inheritance */
GtkCellRendererText super; GtkCellRendererText super;

View File

@ -49,15 +49,20 @@ static gboolean tree_sel_func(GtkTreeSelection *selection,
{ {
GtkTreeIter iter; GtkTreeIter iter;
struct gds_cell *cell; struct gds_cell *cell;
unsigned int error_level;
gboolean ret = FALSE;
gtk_tree_model_get_iter(model, &iter, path); gtk_tree_model_get_iter(model, &iter, path);
gtk_tree_model_get(model, &iter, CELL_SEL_CELL, &cell, -1); gtk_tree_model_get(model, &iter, CELL_SEL_CELL, &cell, CELL_SEL_CELL_ERROR_STATE, &error_level, -1);
/* Allow only rows with valid cell to be selected */ /* Allow only rows with _valid_ cell to be selected */
if (cell) if (cell) {
return TRUE; /* Cell available. Check if it passed the critical checks */
else if (!(error_level & LIB_CELL_RENDERER_ERROR_ERR))
return FALSE; ret = TRUE;
}
return ret;
} }
/** /**
@ -127,7 +132,7 @@ struct tree_stores *setup_cell_selector(GtkTreeView* view, GtkEntry *search_entr
stores.base_tree_view = view; stores.base_tree_view = view;
stores.search_entry = search_entry; stores.search_entry = search_entry;
stores.base_store = gtk_tree_store_new(CELL_SEL_COLUMN_COUNT, G_TYPE_POINTER, G_TYPE_POINTER, GDK_TYPE_RGBA, G_TYPE_STRING, G_TYPE_STRING); stores.base_store = gtk_tree_store_new(CELL_SEL_COLUMN_COUNT, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING);
/* Searching */ /* Searching */
if (search_entry) { if (search_entry) {
@ -147,8 +152,8 @@ struct tree_stores *setup_cell_selector(GtkTreeView* view, GtkEntry *search_entr
column = gtk_tree_view_column_new_with_attributes("Library", render_lib, "gds-lib", CELL_SEL_LIBRARY, NULL); column = gtk_tree_view_column_new_with_attributes("Library", render_lib, "gds-lib", CELL_SEL_LIBRARY, NULL);
gtk_tree_view_append_column(view, column); gtk_tree_view_append_column(view, column);
/* Cell color: #3D9801 */ column = gtk_tree_view_column_new_with_attributes("Cell", render_cell, "gds-cell", CELL_SEL_CELL,
column = gtk_tree_view_column_new_with_attributes("Cell", render_cell, "gds-cell", CELL_SEL_CELL, "foreground-rgba", CELL_SEL_CELL_COLOR, NULL); "error-level", CELL_SEL_CELL_ERROR_STATE, NULL);
gtk_tree_view_append_column(view, column); gtk_tree_view_append_column(view, column);
column = gtk_tree_view_column_new_with_attributes("Mod. Date", render_dates, "text", CELL_SEL_MODDATE, NULL); column = gtk_tree_view_column_new_with_attributes("Mod. Date", render_dates, "text", CELL_SEL_MODDATE, NULL);

View File

@ -37,10 +37,10 @@
enum cell_store_columns { enum cell_store_columns {
CELL_SEL_LIBRARY = 0, CELL_SEL_LIBRARY = 0,
CELL_SEL_CELL, CELL_SEL_CELL,
CELL_SEL_CELL_COLOR, /**< Cell column color */ CELL_SEL_CELL_ERROR_STATE, /**< Used for cell color and selectability */
CELL_SEL_MODDATE, CELL_SEL_MODDATE,
CELL_SEL_ACCESSDATE, CELL_SEL_ACCESSDATE,
CELL_SEL_COLUMN_COUNT /**< Not a column. Used to determine count of coumns **/ CELL_SEL_COLUMN_COUNT /**< @brief Not a column. Used to determine count of columns */
}; };
struct tree_stores { struct tree_stores {

View File

@ -180,10 +180,11 @@ void bounding_box_update_point(union bounding_box *destination, conv_generic_to_
} }
/** /**
* @brief bounding_box_apply_transform * @brief Apply transformations onto bounding box.
* @param scale scaling factor * @param scale Scaling factor
* @param rotation roation of bounding box around the origin in degrees (counterclockwise) * @param rotation_deg Roation of bounding box around the origin in degrees (counterclockwise)
* @param box bounding box the operations should be applied to * @param flip_at_x Flip the boundig box on the x axis before rotating.
* @param box Bounding box the operations should be applied to.
*/ */
void bounding_box_apply_transform(double scale, double rotation_deg, bool flip_at_x, union bounding_box *box) void bounding_box_apply_transform(double scale, double rotation_deg, bool flip_at_x, union bounding_box *box)
{ {

View File

@ -38,9 +38,9 @@ static void convert_gds_point_to_2d_vector(struct gds_point *pt, struct vector_2
} }
/** /**
* @brief update_box_with_gfx * @brief Update the given bounding box with the bounding box of a graphics element.
* @param box * @param box box to update
* @param gfx_list * @param gfx Graphics element
*/ */
static void update_box_with_gfx(union bounding_box *box, struct gds_graphics *gfx) static void update_box_with_gfx(union bounding_box *box, struct gds_graphics *gfx)
{ {
@ -94,14 +94,16 @@ void calculate_cell_bounding_box(union bounding_box *box, struct gds_cell *cell)
} }
/* Update bounding box with boxes of subcells */ /* Update bounding box with boxes of subcells */
for (sub_cell_list = cell->child_cells; sub_cell_list != NULL; sub_cell_list = sub_cell_list->next) { for (sub_cell_list = cell->child_cells; sub_cell_list != NULL;
sub_cell_list = sub_cell_list->next) {
sub_cell = (struct gds_cell_instance *)sub_cell_list->data; sub_cell = (struct gds_cell_instance *)sub_cell_list->data;
bounding_box_prepare_empty(&temp_box); bounding_box_prepare_empty(&temp_box);
/* Recursion Woohoo!! This dies if your GDS is faulty and contains a reference loop */ /* Recursion Woohoo!! This dies if your GDS is faulty and contains a reference loop */
calculate_cell_bounding_box(&temp_box, sub_cell->cell_ref); calculate_cell_bounding_box(&temp_box, sub_cell->cell_ref);
/* Apply transformations */ /* Apply transformations */
bounding_box_apply_transform(ABS(sub_cell->magnification), sub_cell->angle, sub_cell->flipped, &temp_box); bounding_box_apply_transform(ABS(sub_cell->magnification), sub_cell->angle,
sub_cell->flipped, &temp_box);
/* Move bounding box to origin */ /* Move bounding box to origin */
temp_box.vectors.lower_left.x += sub_cell->origin.x; temp_box.vectors.lower_left.x += sub_cell->origin.x;

View File

@ -18,7 +18,7 @@
*/ */
/** /**
* @file conv-settings-dilaog.c * @file conv-settings-dialog.c
* @brief Implementation of the setting dialog * @brief Implementation of the setting dialog
* @author Mario Hüttel <mario.huettel@gmx.net> * @author Mario Hüttel <mario.huettel@gmx.net>
*/ */
@ -127,24 +127,73 @@ static gboolean shape_drawer_drawing_callback(GtkWidget *widget, cairo_t *cr, gp
return FALSE; return FALSE;
} }
static double convert_number_to_engineering(double input, const char **out_prefix)
{
const char *selected_prefix = NULL;
double return_val = 0.0;
int idx;
const static char * prefixes[] = {"y", "z", "a", "f", "p", "n", "u", "m", "c", "d", /* < 1 */
"", /* 1 */
"h", "k", "M", "G", "T", "P", "E", "Z", "Y"}; /* > 1 */
const static double scale[] = {1E-24, 1E-21, 1E-18, 1E-15, 1E-12, 1E-9, 1E-6, 1E-3, 1E-2, 1E-1,
1,
1E2, 1E3, 1E6, 1E9, 1E12, 1E15, 1E18, 1E21, 1E24};
const int prefix_count = (int)(sizeof(prefixes)/sizeof(char *));
for (idx = 1; idx < prefix_count; idx++) {
if (input < scale[idx]) {
/* This prefix is bigger than the number. Take the previous one */
selected_prefix = prefixes[idx-1];
return_val = input / scale[idx-1];
break;
}
}
/* Check if prefix was set by loop. Else take the largest in the list */
if (selected_prefix == NULL) {
selected_prefix = prefixes[prefix_count-1];
return_val = input / scale[prefix_count-1];
}
if (out_prefix)
*out_prefix = selected_prefix;
return return_val;
}
static void renderer_settings_dialog_update_labels(RendererSettingsDialog *self) static void renderer_settings_dialog_update_labels(RendererSettingsDialog *self)
{ {
char default_buff[100]; char default_buff[100];
double scale; double scale;
double width_meters;
double height_meters;
double width_engineering;
const char *width_prefix;
double height_engineering;
const char *height_prefix;
if (!self) if (!self)
return; return;
snprintf(default_buff, sizeof(default_buff), "Width: %E", self->cell_width * self->unit_in_meters); width_meters = (double)self->cell_width * self->unit_in_meters;
height_meters = (double)self->cell_height * self->unit_in_meters;
width_engineering = convert_number_to_engineering(width_meters, &width_prefix);
height_engineering = convert_number_to_engineering(height_meters, &height_prefix);
snprintf(default_buff, sizeof(default_buff), "Width: %.3lf %sm", width_engineering, width_prefix);
gtk_label_set_text(self->x_label, default_buff); gtk_label_set_text(self->x_label, default_buff);
snprintf(default_buff, sizeof(default_buff), "Height: %E", self->cell_height * self->unit_in_meters); snprintf(default_buff, sizeof(default_buff), "Height: %.3lf %sm", height_engineering, height_prefix);
gtk_label_set_text(self->y_label, default_buff); gtk_label_set_text(self->y_label, default_buff);
scale = gtk_range_get_value(GTK_RANGE(self->scale)); scale = gtk_range_get_value(GTK_RANGE(self->scale));
snprintf(default_buff, sizeof(default_buff), "Output Width: %u px", (unsigned int)((double)self->cell_width / scale)); /* Set the pixel sizes */
snprintf(default_buff, sizeof(default_buff), "Output Width: %u px",
(unsigned int)((double)self->cell_width / scale));
gtk_label_set_text(self->x_output_label, default_buff); gtk_label_set_text(self->x_output_label, default_buff);
snprintf(default_buff, sizeof(default_buff), "Output Height: %u px", (unsigned int)((double)self->cell_height / scale)); snprintf(default_buff, sizeof(default_buff), "Output Height: %u px",
(unsigned int)((double)self->cell_height / scale));
gtk_label_set_text(self->y_output_label, default_buff); gtk_label_set_text(self->y_output_label, default_buff);
} }
@ -265,7 +314,6 @@ void renderer_settings_dialog_set_cell_width(RendererSettingsDialog *dialog, uns
if (width == 0) if (width == 0)
width = 1; width = 1;
dialog->cell_width = width; dialog->cell_width = width;
renderer_settings_dialog_update_labels(dialog); renderer_settings_dialog_update_labels(dialog);
} }