Compare commits
No commits in common. "eeae61ad473b38207300e6d0b81cf6840f5b86ef" and "586339cac1cf1c766eabec26f72e35099cd2fd84" have entirely different histories.
eeae61ad47
...
586339cac1
@ -35,7 +35,6 @@
|
|||||||
#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.
|
||||||
@ -70,10 +69,8 @@ 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");
|
||||||
@ -84,14 +81,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)
|
||||||
goto ret_destroy_library_list;
|
return;
|
||||||
|
|
||||||
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 ret_destroy_file;
|
goto 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;
|
||||||
@ -103,7 +100,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_layer_list;
|
goto ret_clear_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;
|
||||||
@ -119,15 +116,9 @@ 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_layer_list;
|
goto ret_clear_list;
|
||||||
|
|
||||||
first_lib = (struct gds_library *)libs->data;
|
for (cell_list = ((struct gds_library *)libs->data)->cells; cell_list != NULL; cell_list = g_list_next(cell_list)) {
|
||||||
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;
|
||||||
@ -137,31 +128,9 @@ 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_layer_list;
|
goto ret_clear_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),
|
||||||
@ -171,14 +140,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_layer_list;
|
goto ret_clear_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_layer_list;
|
goto ret_clear_list;
|
||||||
|
|
||||||
/* Render output using external renderer */
|
/* Render output using external renderer */
|
||||||
printf("Invoking external renderer!\n");
|
printf("Invoking external renderer!\n");
|
||||||
@ -186,16 +155,15 @@ 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_layer_list:
|
ret_clear_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);
|
||||||
ret_destroy_file:
|
destroy_file:
|
||||||
g_object_unref(file);
|
g_object_unref(file);
|
||||||
/* Delete all allocated libraries */
|
|
||||||
ret_destroy_library_list:
|
|
||||||
clear_lib_list(&libs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
* @defgroup trigonometric Trigonometric Helper Functions
|
* @defgroup trigonometric Trigonometric Helper Functions
|
||||||
*
|
*
|
||||||
* The trigonometric helper function are used to calculate bounding boxes
|
* The trigonometric helper function are used to calculate bounding boxes
|
||||||
* @warning Code is incomplete. Please double check for functionality!
|
* @warning Code is incomplete. Please double check forfunctionality!
|
||||||
*/
|
*/
|
||||||
|
@ -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
|
||||||
|
@ -17,6 +17,11 @@
|
|||||||
* 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
|
||||||
@ -30,7 +35,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup GDS-Utilities
|
* @addtogroup GDS-Parser
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -299,8 +304,6 @@ 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 */
|
||||||
@ -662,7 +665,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("Cell Reference outside of cell");
|
GDS_ERROR("Path outside of cell");
|
||||||
run = -3;
|
run = -3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -810,11 +813,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SNAME:
|
case SNAME:
|
||||||
if (current_s_reference) {
|
name_cell_ref(current_s_reference, read, workbuff);
|
||||||
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) {
|
||||||
@ -867,7 +866,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 = (enum path_type)gds_convert_signed_int16(workbuff);
|
current_graphics->path_render_type = (int)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");
|
||||||
@ -898,8 +897,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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -908,8 +906,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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -918,9 +915,6 @@ 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);
|
||||||
}
|
}
|
||||||
@ -931,9 +925,6 @@ 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);
|
||||||
@ -945,9 +936,6 @@ 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);
|
||||||
@ -955,12 +943,8 @@ 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;
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup GDS-Utilities
|
* @addtogroup GDS-Parser
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1,200 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @} */
|
|
@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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_ */
|
|
||||||
|
|
||||||
/** @} */
|
|
@ -24,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup GDS-Utilities
|
* @addtogroup GDS-Parser
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -35,15 +35,9 @@
|
|||||||
#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
|
||||||
{
|
{
|
||||||
@ -65,21 +59,6 @@ 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
|
||||||
*/
|
*/
|
||||||
@ -126,7 +105,6 @@ 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 */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,8 +37,6 @@
|
|||||||
#include "widgets/conv-settings-dialog.h"
|
#include "widgets/conv-settings-dialog.h"
|
||||||
#include "cairo-output/cairo-output.h"
|
#include "cairo-output/cairo-output.h"
|
||||||
#include "trigonometric/cell-trigonometrics.h"
|
#include "trigonometric/cell-trigonometrics.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
|
||||||
@ -116,7 +114,7 @@ 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;
|
||||||
unsigned int cell_error_level;
|
GdkRGBA cell_text_color;
|
||||||
|
|
||||||
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, GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||||
"Cancel", GTK_RESPONSE_CANCEL, "Open GDSII", GTK_RESPONSE_ACCEPT, NULL);
|
"Cancel", GTK_RESPONSE_CANCEL, "Open GDSII", GTK_RESPONSE_ACCEPT, NULL);
|
||||||
@ -164,11 +162,6 @@ 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);
|
||||||
@ -182,21 +175,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);
|
||||||
|
|
||||||
/* Get the checking results for this cell */
|
cell_text_color.alpha = 1;
|
||||||
cell_error_level = 0;
|
cell_text_color.red = (double)61.0/(double)255.0;
|
||||||
if (gds_c->checks.unresolved_child_count)
|
cell_text_color.green = (double)152.0/(double)255.0;
|
||||||
cell_error_level |= LIB_CELL_RENDERER_ERROR_WARN;
|
cell_text_color.blue = 0.0;
|
||||||
|
|
||||||
/* Check if it is completely b0rken */
|
/* Add cell to tree store model
|
||||||
if (gds_c->checks.affected_by_reference_loop)
|
* CELL_SEL_CELL_COLOR will always be green,
|
||||||
cell_error_level |= LIB_CELL_RENDERER_ERROR_ERR;
|
* because no cell cehcker is implemented, yet.
|
||||||
|
*/
|
||||||
/* 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_ERROR_STATE, cell_error_level, -1);
|
CELL_SEL_CELL_COLOR, &cell_text_color, // TODO: implement cell checker
|
||||||
|
-1);
|
||||||
|
|
||||||
/* Delete GStrings including string data. */
|
/* Delete GStrings including string data. */
|
||||||
/* Cell store copies String type data items */
|
/* Cell store copies String type data items */
|
||||||
|
2
main.c
2
main.c
@ -133,7 +133,7 @@ int main(int argc, char **argv)
|
|||||||
{"tex-layers", 'l', 0, G_OPTION_ARG_NONE, &pdf_layers, "Create PDF Layers (OCG)", NULL },
|
{"tex-layers", 'l', 0, G_OPTION_ARG_NONE, &pdf_layers, "Create PDF Layers (OCG)", NULL },
|
||||||
{"custom-render-lib", 'P', 0, G_OPTION_ARG_FILENAME, &custom_library_path, "Path to a custom shared object, that implements the " EXTERNAL_LIBRARY_FUNCTION " function", "PATH"},
|
{"custom-render-lib", 'P', 0, G_OPTION_ARG_FILENAME, &custom_library_path, "Path to a custom shared object, that implements the " EXTERNAL_LIBRARY_FUNCTION " function", "PATH"},
|
||||||
{"external-lib-output", 'e', 0, G_OPTION_ARG_FILENAME, &custom_library_file_name, "Output path for external render library", "PATH"},
|
{"external-lib-output", 'e', 0, G_OPTION_ARG_FILENAME, &custom_library_file_name, "Output path for external render library", "PATH"},
|
||||||
{NULL}
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
context = g_option_context_new(" FILE - Convert GDS file <FILE> to graphic");
|
context = g_option_context_new(" FILE - Convert GDS file <FILE> to graphic");
|
||||||
|
@ -25,7 +25,6 @@ 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
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -39,56 +38,24 @@ 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;
|
||||||
@ -122,8 +89,6 @@ 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);
|
||||||
}
|
}
|
||||||
|
@ -27,9 +27,6 @@ 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;
|
||||||
|
@ -49,20 +49,15 @@ 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, CELL_SEL_CELL_ERROR_STATE, &error_level, -1);
|
gtk_tree_model_get(model, &iter, CELL_SEL_CELL, &cell, -1);
|
||||||
|
|
||||||
/* Allow only rows with _valid_ cell to be selected */
|
/* Allow only rows with valid cell to be selected */
|
||||||
if (cell) {
|
if (cell)
|
||||||
/* Cell available. Check if it passed the critical checks */
|
return TRUE;
|
||||||
if (!(error_level & LIB_CELL_RENDERER_ERROR_ERR))
|
else
|
||||||
ret = TRUE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -132,7 +127,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, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING);
|
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);
|
||||||
|
|
||||||
/* Searching */
|
/* Searching */
|
||||||
if (search_entry) {
|
if (search_entry) {
|
||||||
@ -152,8 +147,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);
|
||||||
|
|
||||||
column = gtk_tree_view_column_new_with_attributes("Cell", render_cell, "gds-cell", CELL_SEL_CELL,
|
/* Cell color: #3D9801 */
|
||||||
"error-level", CELL_SEL_CELL_ERROR_STATE, NULL);
|
column = gtk_tree_view_column_new_with_attributes("Cell", render_cell, "gds-cell", CELL_SEL_CELL, "foreground-rgba", CELL_SEL_CELL_COLOR, 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);
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
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_ERROR_STATE, /**< Used for cell color and selectability */
|
CELL_SEL_CELL_COLOR, /**< @brief Cell column color */
|
||||||
CELL_SEL_MODDATE,
|
CELL_SEL_MODDATE,
|
||||||
CELL_SEL_ACCESSDATE,
|
CELL_SEL_ACCESSDATE,
|
||||||
CELL_SEL_COLUMN_COUNT /**< @brief Not a column. Used to determine count of columns */
|
CELL_SEL_COLUMN_COUNT /**< @brief Not a column. Used to determine count of columns */
|
||||||
|
@ -94,16 +94,14 @@ 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;
|
for (sub_cell_list = cell->child_cells; sub_cell_list != NULL; sub_cell_list = sub_cell_list->next) {
|
||||||
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,
|
bounding_box_apply_transform(ABS(sub_cell->magnification), sub_cell->angle, sub_cell->flipped, &temp_box);
|
||||||
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;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file conv-settings-dialog.c
|
* @file conv-settings-dilaog.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>
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user