Compare commits
25 Commits
v1.0
...
88cd834d13
Author | SHA1 | Date | |
---|---|---|---|
88cd834d13 | |||
7f7b4cc7bf | |||
f625d2daba | |||
e42aa36520 | |||
2ffa09d104 | |||
feb69b6d60 | |||
20ec6bd41b | |||
eef012fc4d | |||
0d6b2c7a36 | |||
583f01faae | |||
795d496949 | |||
6ebd05007e | |||
906225f47f | |||
dadafa43a3 | |||
2d3241d8b7 | |||
0ecc60d2a1 | |||
9b0f268bbd | |||
082a823575 | |||
1f7f3118fa | |||
5cfd93c18d | |||
6818357f64 | |||
b0fdb261e0 | |||
de8d6967c6 | |||
493f787fd1 | |||
a7b7ba71e5 |
@@ -6,7 +6,7 @@ pkg_search_module(GLIB REQUIRED glib-2.0)
|
||||
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
|
||||
pkg_check_modules(CAIRO REQUIRED cairo)
|
||||
|
||||
add_subdirectory(glade)
|
||||
add_subdirectory(resources)
|
||||
add_subdirectory(doxygen)
|
||||
add_subdirectory(version)
|
||||
|
||||
@@ -36,10 +36,10 @@ set(SOURCE
|
||||
|
||||
add_compile_options(-Wall)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCE} ${CMAKE_CURRENT_BINARY_DIR}/glade/resources.c)
|
||||
add_executable(${PROJECT_NAME} ${SOURCE} ${CMAKE_CURRENT_BINARY_DIR}/resources/resources.c)
|
||||
add_dependencies(${PROJECT_NAME} glib-resources)
|
||||
add_dependencies(${PROJECT_NAME} version)
|
||||
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/glade/resources.c PROPERTIES GENERATED 1)
|
||||
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/resources/resources.c PROPERTIES GENERATED 1)
|
||||
target_link_libraries(${PROJECT_NAME} ${GLIB_LDFLAGS} ${GTK3_LDFLAGS} ${CAIRO_LDFLAGS} m version ${CMAKE_DL_LIBS})
|
||||
install (TARGETS ${PROJECT_NAME} DESTINATION bin)
|
||||
|
||||
|
@@ -33,6 +33,8 @@
|
||||
#include <cairo-svg.h>
|
||||
|
||||
#include <gds-render/cairo-renderer/cairo-output.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/**
|
||||
* @brief The cairo_layer struct
|
||||
@@ -181,8 +183,8 @@ static void render_cell(struct gds_cell *cell, struct cairo_layer *layers, doubl
|
||||
|
||||
void cairo_render_cell_to_vector_file(struct gds_cell *cell, GList *layer_infos, char *pdf_file, char *svg_file, double scale)
|
||||
{
|
||||
cairo_surface_t *pdf_surface, *svg_surface;
|
||||
cairo_t *pdf_cr, *svg_cr;
|
||||
cairo_surface_t *pdf_surface = NULL, *svg_surface = NULL;
|
||||
cairo_t *pdf_cr = NULL, *svg_cr = NULL;
|
||||
struct layer_info *linfo;
|
||||
struct cairo_layer *layers;
|
||||
struct cairo_layer *lay;
|
||||
@@ -190,12 +192,26 @@ void cairo_render_cell_to_vector_file(struct gds_cell *cell, GList *layer_infos,
|
||||
int i;
|
||||
double rec_x0, rec_y0, rec_width, rec_height;
|
||||
double xmin = INT32_MAX, xmax = INT32_MIN, ymin = INT32_MAX, ymax = INT32_MIN;
|
||||
pid_t process_id;
|
||||
|
||||
if (pdf_file == NULL && svg_file == NULL) {
|
||||
/* No output specified */
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fork to a new child process. This ensures the memory leaks (see issue #16) in Cairo don't
|
||||
* brick everything.
|
||||
*
|
||||
* And by the way: This now bricks all Windows compatibility. Deal with it.
|
||||
*/
|
||||
process_id = fork();
|
||||
if (process_id < 0) {
|
||||
/* Well... shit... We have to run it in our process. */
|
||||
} else if (process_id > 0) {
|
||||
/* Woohoo... Successfully dumped the shitty code to an unknowing victim */
|
||||
goto ret_parent;
|
||||
}
|
||||
|
||||
layers = (struct cairo_layer *)calloc(MAX_LAYERS, sizeof(struct cairo_layer));
|
||||
|
||||
/* Clear layers */
|
||||
@@ -276,16 +292,15 @@ void cairo_render_cell_to_vector_file(struct gds_cell *cell, GList *layer_infos,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pdf_file) {
|
||||
if (pdf_file && pdf_cr) {
|
||||
cairo_set_source_surface(pdf_cr, layers[linfo->layer].rec, -xmin, -ymin);
|
||||
cairo_paint_with_alpha(pdf_cr, linfo->color.alpha);
|
||||
}
|
||||
|
||||
if (svg_file) {
|
||||
if (svg_file && svg_cr) {
|
||||
cairo_set_source_surface(svg_cr, layers[linfo->layer].rec, -xmin, -ymin);
|
||||
cairo_paint_with_alpha(svg_cr, linfo->color.alpha);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (pdf_file) {
|
||||
@@ -310,7 +325,17 @@ ret_clear_layers:
|
||||
}
|
||||
free(layers);
|
||||
|
||||
printf("cairo export finished. It might still be buggy!\n");
|
||||
printf("Cairo export finished. It might still be buggy!\n");
|
||||
|
||||
/* If forked, suspend process */
|
||||
if (process_id == 0)
|
||||
exit(0);
|
||||
|
||||
/* Fork didn't work. Just return here */
|
||||
return;
|
||||
ret_parent:
|
||||
waitpid(process_id, NULL, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
@@ -234,7 +234,7 @@ SEPARATE_MEMBER_PAGES = NO
|
||||
# uses this value to replace tabs by spaces in code fragments.
|
||||
# Minimum value: 1, maximum value: 16, default value: 4.
|
||||
|
||||
TAB_SIZE = 4
|
||||
TAB_SIZE = 8
|
||||
|
||||
# This tag can be used to specify a number of aliases that act as commands in
|
||||
# the documentation. An alias has the form:
|
||||
|
6
doxygen/activity-bar.dox
Normal file
6
doxygen/activity-bar.dox
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* @defgroup ActivityBar Activity Bar
|
||||
* @ingroup Widgets
|
||||
*
|
||||
* Activity Status Bar
|
||||
*/
|
@@ -31,6 +31,6 @@ In tabular form: *v1.0-rc4-41-gaa41373-dirty*
|
||||
| 1.0-rc4 | 41 | aa41373 | yes |
|
||||
|
||||
|
||||
This git-based version number is automatically put into the application and this doxumentation during the application's compilation / the documentation's generation. For this *git* is needed. Therefore, it is highly recommended to have 'git' installed for compilation although it is no build dependency. In case of a missing git installation, the string "! version not set !" is compiled into the application.
|
||||
This git-based version number is automatically put into the application and this documentation during the application's compilation / the documentation's generation. For this *git* is needed. Therefore, it is highly recommended to have 'git' installed for compilation although it is no build dependency. In case of a missing git installation, the string "! version not set !" is compiled into the application.
|
||||
|
||||
**/
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include <gds-render/gds-utils/gds-parser.h>
|
||||
#include <gds-render/gds-utils/gds-tree-checker.h>
|
||||
#include <gds-render/layer/layer-selector.h>
|
||||
#include <gds-render/widgets/activity-bar.h>
|
||||
#include <gds-render/tree-renderer/tree-store.h>
|
||||
#include <gds-render/tree-renderer/lib-cell-renderer.h>
|
||||
#include <gds-render/latex-renderer/latex-output.h>
|
||||
@@ -58,6 +59,7 @@ struct _GdsRenderGui {
|
||||
LayerSelector *layer_selector;
|
||||
GtkTreeView *cell_tree_view;
|
||||
GList *gds_libraries;
|
||||
ActivityBar *activity_status_bar;
|
||||
struct render_settings render_dialog_settings;
|
||||
};
|
||||
|
||||
@@ -442,6 +444,7 @@ static void gds_render_gui_dispose(GObject *gobject)
|
||||
g_clear_object(&self->layer_selector);
|
||||
g_clear_object(&self->cell_tree_store);
|
||||
g_clear_object(&self->cell_search_entry);
|
||||
g_clear_object(&self->activity_status_bar);
|
||||
|
||||
if (self->main_window) {
|
||||
g_signal_handlers_destroy(self->main_window);
|
||||
@@ -484,8 +487,9 @@ static void gds_render_gui_init(GdsRenderGui *self)
|
||||
struct tree_stores *cell_selector_stores;
|
||||
GtkWidget *sort_up_button;
|
||||
GtkWidget *sort_down_button;
|
||||
GtkWidget *activity_bar_box;
|
||||
|
||||
main_builder = gtk_builder_new_from_resource("/main.glade");
|
||||
main_builder = gtk_builder_new_from_resource("/gui/main.glade");
|
||||
|
||||
self->cell_tree_view = GTK_TREE_VIEW(gtk_builder_get_object(main_builder, "cell-tree"));
|
||||
self->cell_search_entry = GTK_WIDGET(gtk_builder_get_object(main_builder, "cell-search"));
|
||||
@@ -505,6 +509,7 @@ static void gds_render_gui_init(GdsRenderGui *self)
|
||||
/* Create layer selector */
|
||||
self->layer_selector = layer_selector_new(GTK_LIST_BOX(listbox));
|
||||
|
||||
activity_bar_box = GTK_WIDGET(gtk_builder_get_object(main_builder, "activity-bar"));
|
||||
|
||||
/* Callback for selection change of cell selector */
|
||||
g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(self->cell_tree_view)), "changed",
|
||||
@@ -535,6 +540,11 @@ static void gds_render_gui_init(GdsRenderGui *self)
|
||||
|
||||
g_object_unref(main_builder);
|
||||
|
||||
/* Create and apply ActivityBar */
|
||||
self->activity_status_bar = activity_bar_new();
|
||||
gtk_container_add(GTK_CONTAINER(activity_bar_box), GTK_WIDGET(self->activity_status_bar));
|
||||
gtk_widget_show(GTK_WIDGET(self->activity_status_bar));
|
||||
|
||||
/* Set default conversion/rendering settings */
|
||||
self->render_dialog_settings.scale = 1000;
|
||||
self->render_dialog_settings.renderer = RENDERER_LATEX_TIKZ;
|
||||
@@ -543,6 +553,7 @@ static void gds_render_gui_init(GdsRenderGui *self)
|
||||
|
||||
|
||||
/* Reference all objects referenced by this object */
|
||||
g_object_ref(self->activity_status_bar);
|
||||
g_object_ref(self->main_window);
|
||||
g_object_ref(self->cell_tree_view);
|
||||
g_object_ref(self->convert_button);
|
||||
|
@@ -53,7 +53,8 @@
|
||||
#define GDS_WARN(fmt, ...) printf("[PARSE_WARNING] " fmt "\n", ##__VA_ARGS__) /**< @brief Print GDS warning */
|
||||
|
||||
#if GDS_PRINT_DEBUG_INFOS
|
||||
#define GDS_INF(fmt, ...) printf(fmt, ##__VA_ARGS__) /**< @brief standard printf. But can be disabled in code */
|
||||
/**< @brief standard printf. But can be disabled in code. */
|
||||
#define GDS_INF(fmt, ...) printf(fmt, ##__VA_ARGS__)
|
||||
#else
|
||||
#define GDS_INF(fmt, ...)
|
||||
#endif
|
||||
@@ -79,7 +80,26 @@ enum gds_record {
|
||||
BOX = 0x2D00,
|
||||
LAYER = 0x0D02,
|
||||
WIDTH = 0x0F03,
|
||||
PATHTYPE = 0x2102
|
||||
PATHTYPE = 0x2102,
|
||||
COLROW = 0x1302,
|
||||
AREF = 0x0B00
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Struct representing an array instantiation.
|
||||
*
|
||||
* This struct is defined locally because it is not exposed to the outside of the
|
||||
* parser. Array references are internally converted to a bunch of standard @ref gds_cell_instance elements.
|
||||
*/
|
||||
struct gds_cell_array_instance {
|
||||
char ref_name[CELL_NAME_MAX]; /**< @brief Name of referenced cell */
|
||||
struct gds_cell *cell_ref; /**< @brief Referenced gds_cell structure */
|
||||
struct gds_point control_points[3]; /**< @brief The three control points */
|
||||
int flipped; /**< @brief Mirror each instance on x-axis before rotation */
|
||||
double angle; /**< @brief Angle of rotation for each instance (counter clockwise) in degrees */
|
||||
double magnification; /**< @brief Magnification of each instance */
|
||||
int columns; /**< @brief Column count */
|
||||
int rows; /**< @brief Row count */
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -112,6 +132,36 @@ static int name_cell_ref(struct gds_cell_instance *cell_inst,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Name cell reference
|
||||
* @param cell_inst Cell reference
|
||||
* @param bytes Length of name
|
||||
* @param data Name
|
||||
* @return 0 if successful
|
||||
*/
|
||||
static int name_array_cell_ref(struct gds_cell_array_instance *cell_inst,
|
||||
unsigned int bytes, char *data)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (cell_inst == NULL) {
|
||||
GDS_ERROR("Naming array cell ref with no opened cell ref");
|
||||
return -1;
|
||||
}
|
||||
data[bytes] = 0; // Append '0'
|
||||
len = (int)strlen(data);
|
||||
if (len > CELL_NAME_MAX-1) {
|
||||
GDS_ERROR("Cell name '%s' too long: %d\n", data, len);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* else: */
|
||||
strcpy(cell_inst->ref_name, data);
|
||||
GDS_INF("\tCell referenced: %s\n", cell_inst->ref_name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert GDS 8-byte real to double
|
||||
* @param data 8 Byte GDS real
|
||||
@@ -133,7 +183,7 @@ static double gds_convert_double(const char *data)
|
||||
if (data[i] != 0)
|
||||
break;
|
||||
if (i == 7) {
|
||||
/* 7 bytes all 0 */
|
||||
/* All 8 bytes are 0 */
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
@@ -327,9 +377,9 @@ static GList *append_cell_ref(GList *curr_list, struct gds_cell_instance **insta
|
||||
if (inst) {
|
||||
inst->cell_ref = NULL;
|
||||
inst->ref_name[0] = 0;
|
||||
inst->magnification = 1;
|
||||
inst->magnification = 1.0;
|
||||
inst->flipped = 0;
|
||||
inst->angle = 0;
|
||||
inst->angle = 0.0;
|
||||
} else
|
||||
return NULL;
|
||||
|
||||
@@ -509,6 +559,62 @@ static void gds_parse_date(const char *buffer, int length, struct gds_time_field
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert AREF to a bunch of SREFs and append them to \p container_cell
|
||||
*
|
||||
* This function converts a single array reference (\p aref) to gds_cell_array_instance::rows * gds_cell_array_instance::columns
|
||||
* single references (SREFs). See @ref gds_cell_instance.
|
||||
*
|
||||
* Both gds_cell_array_instance::rows and gds_cell_array_instance::columns must be larger than zero.
|
||||
*
|
||||
* @param[in] aref Array reference to parse
|
||||
* @param[in] container_cell cell to add the converted single references to.
|
||||
*/
|
||||
static void convert_aref_to_sref(struct gds_cell_array_instance *aref, struct gds_cell *container_cell)
|
||||
{
|
||||
struct gds_point origin;
|
||||
struct gds_point row_shift_vector;
|
||||
struct gds_point col_shift_vector;
|
||||
struct gds_cell_instance *sref_inst;
|
||||
int col;
|
||||
int row;
|
||||
|
||||
if (!aref || !container_cell)
|
||||
return;
|
||||
|
||||
if (aref->columns == 0 || aref->rows == 0) {
|
||||
GDS_ERROR("Conversion of array instance aborted. No rows / columns.");
|
||||
return;
|
||||
}
|
||||
origin.x = aref->control_points[0].x;
|
||||
origin.y = aref->control_points[0].y;
|
||||
|
||||
row_shift_vector.x = (aref->control_points[2].x - origin.x) / aref->rows;
|
||||
row_shift_vector.y = (aref->control_points[2].y - origin.y) / aref->rows;
|
||||
col_shift_vector.x = (aref->control_points[1].x - origin.x) / aref->columns;
|
||||
col_shift_vector.y = (aref->control_points[1].y - origin.y) / aref->columns;
|
||||
|
||||
/* Iterate over columns and rows */
|
||||
for (col = 0; col < aref->columns; col++) {
|
||||
for (row = 0; row < aref->rows; row++) {
|
||||
/* Create new instance for this row/column and aconfigure data */
|
||||
container_cell->child_cells = append_cell_ref(container_cell->child_cells, &sref_inst);
|
||||
if (!sref_inst) {
|
||||
GDS_ERROR("Appending cell ref failed!");
|
||||
continue;
|
||||
}
|
||||
|
||||
sref_inst->angle = aref->angle;
|
||||
sref_inst->magnification = aref->magnification;
|
||||
sref_inst->flipped = aref->flipped;
|
||||
strncpy(sref_inst->ref_name, aref->ref_name, CELL_NAME_MAX);
|
||||
sref_inst->origin.x = origin.x + row_shift_vector.x * row + col_shift_vector.x * col;
|
||||
sref_inst->origin.y = origin.y + row_shift_vector.y * row + col_shift_vector.y * col;
|
||||
}
|
||||
}
|
||||
GDS_INF("Converted AREF to SREFs\n");
|
||||
}
|
||||
|
||||
int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
{
|
||||
char *workbuff;
|
||||
@@ -522,6 +628,8 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
struct gds_cell *current_cell = NULL;
|
||||
struct gds_graphics *current_graphics = NULL;
|
||||
struct gds_cell_instance *current_s_reference = NULL;
|
||||
struct gds_cell_array_instance *current_a_reference = NULL;
|
||||
struct gds_cell_array_instance temp_a_reference;
|
||||
int x, y;
|
||||
////////////
|
||||
GList *lib_list;
|
||||
@@ -583,6 +691,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
}
|
||||
rec_type = gds_convert_unsigend_int16(workbuff);
|
||||
|
||||
|
||||
/* if begin: Allocate structures */
|
||||
switch (rec_type) {
|
||||
case BGNLIB:
|
||||
@@ -626,7 +735,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
|
||||
current_cell->parent_library = current_lib;
|
||||
|
||||
GDS_INF("Entering Cell\n");
|
||||
GDS_INF("Entering cell\n");
|
||||
break;
|
||||
case ENDSTR:
|
||||
if (current_cell == NULL) {
|
||||
@@ -693,7 +802,6 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
break;
|
||||
case ENDEL:
|
||||
if (current_graphics != NULL) {
|
||||
|
||||
GDS_INF("\tLeaving %s\n", (current_graphics->gfx_type == GRAPHIC_POLYGON ? "boundary" : "path"));
|
||||
current_graphics = NULL;
|
||||
}
|
||||
@@ -701,6 +809,12 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
GDS_INF("\tLeaving Reference\n");
|
||||
current_s_reference = NULL;
|
||||
}
|
||||
if (current_a_reference != NULL) {
|
||||
GDS_INF("\tLeaving Array Reference\n");
|
||||
convert_aref_to_sref(current_a_reference, current_cell);
|
||||
current_a_reference = NULL;
|
||||
}
|
||||
|
||||
break;
|
||||
case XY:
|
||||
if (current_graphics) {
|
||||
@@ -709,24 +823,51 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
if (rec_data_length != 8) {
|
||||
GDS_WARN("Instance has weird coordinates. Rendered output might be screwed!");
|
||||
}
|
||||
} else if (current_a_reference) {
|
||||
if (rec_data_length != (3*(4+4)))
|
||||
GDS_WARN("Array instance has weird coordinates. Rendered output might be screwed!");
|
||||
}
|
||||
break;
|
||||
case AREF:
|
||||
if (current_cell == NULL) {
|
||||
GDS_ERROR("Cell array reference outside of cell");
|
||||
run = -3;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
if (current_a_reference != NULL) {
|
||||
GDS_ERROR("Recursive cell array reference");
|
||||
run = -3;
|
||||
break;
|
||||
}
|
||||
|
||||
GDS_INF("Entering Array Reference\n");
|
||||
|
||||
/* Array references are coverted after fully declared. Therefore,
|
||||
* only a static buffer is needed
|
||||
*/
|
||||
current_a_reference = &temp_a_reference;
|
||||
current_a_reference->ref_name[0] = '\0';
|
||||
current_a_reference->angle = 0.0;
|
||||
current_a_reference->magnification = 1.0;
|
||||
current_a_reference->flipped = 0;
|
||||
current_a_reference->rows = 0;
|
||||
current_a_reference->columns = 0;
|
||||
break;
|
||||
case COLROW:
|
||||
case MAG:
|
||||
break;
|
||||
case ANGLE:
|
||||
break;
|
||||
case STRANS:
|
||||
break;
|
||||
case WIDTH:
|
||||
break;
|
||||
case PATHTYPE:
|
||||
break;
|
||||
case UNITS:
|
||||
case LIBNAME:
|
||||
case SNAME:
|
||||
case LAYER:
|
||||
case STRNAME:
|
||||
break;
|
||||
default:
|
||||
//GDS_WARN("Record: %04x, len: %u", (unsigned int)rec_type, (unsigned int)rec_data_length);
|
||||
GDS_INF("Unhandled Record: %04x, len: %u\n", (unsigned int)rec_type, (unsigned int)rec_data_length);
|
||||
break;
|
||||
} /* switch(rec_type) */
|
||||
|
||||
@@ -744,7 +885,7 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
}
|
||||
|
||||
switch (rec_type) {
|
||||
|
||||
case AREF:
|
||||
case HEADER:
|
||||
case ENDLIB:
|
||||
case ENDSTR:
|
||||
@@ -756,6 +897,20 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
case INVALID:
|
||||
break;
|
||||
|
||||
case COLROW:
|
||||
if (!current_a_reference) {
|
||||
GDS_ERROR("COLROW record defined outside of array instance");
|
||||
break;
|
||||
}
|
||||
if (rec_data_length != 4 || read != 4) {
|
||||
GDS_ERROR("COLUMN/ROW count record contains too few data. Won't set column and row counts (%d, %d)",
|
||||
rec_data_length, read);
|
||||
break;
|
||||
}
|
||||
current_a_reference->columns = (int)gds_convert_signed_int16(&workbuff[0]);
|
||||
current_a_reference->rows = (int)gds_convert_signed_int16(&workbuff[2]);
|
||||
GDS_INF("\tRows: %d\n\tColumns: %d\n", current_a_reference->rows, current_a_reference->columns);
|
||||
break;
|
||||
case UNITS:
|
||||
if (!current_lib) {
|
||||
GDS_WARN("Units defined outside of library!\n");
|
||||
@@ -799,21 +954,33 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
GDS_INF("\t\tSet coordinate: %d/%d\n", x, y);
|
||||
|
||||
}
|
||||
} else if (current_a_reference) {
|
||||
for (i = 0; i < 3; i++) {
|
||||
x = gds_convert_signed_int(&workbuff[i*8]);
|
||||
y = gds_convert_signed_int(&workbuff[i*8+4]);
|
||||
current_a_reference->control_points[i].x = x;
|
||||
current_a_reference->control_points[i].y = y;
|
||||
GDS_INF("\tSet control point %d: %d/%d\n", i, x, y);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case STRANS:
|
||||
if (!current_s_reference) {
|
||||
if (current_s_reference) {
|
||||
current_s_reference->flipped = ((workbuff[0] & 0x80) ? 1 : 0);
|
||||
} else if (current_a_reference) {
|
||||
current_a_reference->flipped = ((workbuff[0] & 0x80) ? 1 : 0);
|
||||
} else {
|
||||
GDS_ERROR("Transformation defined outside of instance");
|
||||
break;
|
||||
}
|
||||
current_s_reference->flipped = ((workbuff[0] & 0x80) ? 1 : 0);
|
||||
break;
|
||||
|
||||
case SNAME:
|
||||
if (current_s_reference) {
|
||||
name_cell_ref(current_s_reference, (unsigned int)read, workbuff);
|
||||
} else if (current_a_reference) {
|
||||
name_array_cell_ref(current_a_reference, (unsigned int)read, workbuff);
|
||||
} else {
|
||||
GDS_ERROR("reference name set outside of cell reference.\n");
|
||||
GDS_ERROR("Reference name set outside of cell reference");
|
||||
}
|
||||
break;
|
||||
case WIDTH:
|
||||
@@ -846,12 +1013,16 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
current_s_reference->magnification = gds_convert_double(workbuff);
|
||||
GDS_INF("\t\tMagnification defined: %lf\n", current_s_reference->magnification);
|
||||
}
|
||||
if (current_a_reference != NULL) {
|
||||
current_a_reference->magnification = gds_convert_double(workbuff);
|
||||
GDS_INF("\t\tMagnification defined: %lf\n", current_a_reference->magnification);
|
||||
}
|
||||
break;
|
||||
case ANGLE:
|
||||
if (rec_data_length != 8) {
|
||||
GDS_WARN("Angle is not an 8 byte real. Results may be wrong");
|
||||
}
|
||||
if (current_graphics != NULL && current_s_reference != NULL) {
|
||||
if (current_graphics != NULL && current_s_reference != NULL && current_a_reference != NULL) {
|
||||
GDS_ERROR("Open Graphics and Cell Reference\n\tMissing ENDEL?");
|
||||
run = -6;
|
||||
break;
|
||||
@@ -860,6 +1031,10 @@ int parse_gds_from_file(const char *filename, GList **library_list)
|
||||
current_s_reference->angle = gds_convert_double(workbuff);
|
||||
GDS_INF("\t\tAngle defined: %lf\n", current_s_reference->angle);
|
||||
}
|
||||
if (current_a_reference != NULL) {
|
||||
current_a_reference->angle = gds_convert_double(workbuff);
|
||||
GDS_INF("\t\tAngle defined: %lf\n", current_a_reference->angle);
|
||||
}
|
||||
break;
|
||||
case PATHTYPE:
|
||||
if (current_graphics == NULL) {
|
||||
|
@@ -176,6 +176,16 @@ int gds_tree_check_reference_loops(struct gds_library *lib)
|
||||
/* iterate through references and check if loop exists */
|
||||
res = gds_tree_check_iterate_ref_and_check(cell_to_check, &visited_cells);
|
||||
|
||||
if (visited_cells) {
|
||||
/* If cell contains no loop, print error when list not empty.
|
||||
* In case of a loop, it is completely normal that the list is not empty,
|
||||
* due to the instant return from gds_tree_check_iterate_ref_and_check()
|
||||
*/
|
||||
if (res == 0)
|
||||
fprintf(stderr, "Visited cell list should be empty. This is a bug. Please report this.\n");
|
||||
g_list_free(visited_cells);
|
||||
}
|
||||
|
||||
if (res < 0) {
|
||||
/* Error */
|
||||
return res;
|
||||
@@ -190,10 +200,6 @@ int gds_tree_check_reference_loops(struct gds_library *lib)
|
||||
|
||||
}
|
||||
|
||||
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,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/">
|
||||
<file compressed="true">main.glade</file>
|
||||
<file compressed="true">about.glade</file>
|
||||
<file>layer-widget.glade</file>
|
||||
<file>dialog.glade</file>
|
||||
<file compressed="true" alias="logo.svg">../icon/gds-render.svg</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
|
||||
|
@@ -37,7 +37,21 @@
|
||||
|
||||
#define GDS_PRINT_DEBUG_INFOS (0) /**< @brief 1: Print infos, 0: Don't print */
|
||||
|
||||
/**
|
||||
* @brief Parse a GDS file
|
||||
*
|
||||
* This function parses a GDS File and creates a list of libraries,
|
||||
* which then contain the different cells.
|
||||
*
|
||||
* The function appends The detected libraries to the \p library_array list.
|
||||
* The library array may be empty, meaning *library_list may be NULL.
|
||||
*
|
||||
* @param[in] filename Path to the GDS file
|
||||
* @param[in,out] library_array GList Pointer.
|
||||
* @return 0 if successful
|
||||
*/
|
||||
int parse_gds_from_file(const char *filename, GList **library_array);
|
||||
|
||||
/**
|
||||
* @brief Deletes all libraries including cells, references etc.
|
||||
* @param library_list Pointer to a list of #gds_library. Is set to NULL after completion.
|
||||
|
70
include/gds-render/layer/color-palette.h
Normal file
70
include/gds-render/layer/color-palette.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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 color-palette.h
|
||||
* @brief Class representing a color palette
|
||||
* @author Mario Hüttel <mario.huettel@gmx.net>
|
||||
*/
|
||||
|
||||
#ifndef _COLOR_PALETTE_H_
|
||||
#define _COLOR_PALETTE_H_
|
||||
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE(ColorPalette, color_palette, GDS_RENDER, COLOR_PALETTE, GObject);
|
||||
|
||||
#define TYPE_GDS_RENDER_COLOR_PALETTE (color_palette_get_type())
|
||||
|
||||
/**
|
||||
* @brief Create a new object with from a resource containing the html hex color scheme
|
||||
* @param resource_name Name of the resource
|
||||
* @return New object
|
||||
*/
|
||||
ColorPalette *color_palette_new_from_resource(char *resource_name);
|
||||
|
||||
/**
|
||||
* @brief Get the n-th color in the palette identified by the index.
|
||||
*
|
||||
* This function fills the nth color into the supplied \p color.
|
||||
* \p color is returned.
|
||||
*
|
||||
* If \p color is NULL, a new GdkRGBA is created and returned.
|
||||
* This element must be freed afterwards.
|
||||
*
|
||||
* @param palette Color palette
|
||||
* @param color GdkRGBA struct to fill data in. May be NULL.
|
||||
* @param index Index of color. Starts at 0
|
||||
* @return GdkRGBA color. If \p color is NULL, the returned color must be freed afterwards
|
||||
*/
|
||||
GdkRGBA *color_palette_get_color(ColorPalette *palette, GdkRGBA *color, unsigned int index);
|
||||
|
||||
/**
|
||||
* @brief Return amount of stored colors in \p palette
|
||||
* @param palette Color palette
|
||||
* @return Count of colors
|
||||
*/
|
||||
unsigned int color_palette_get_color_count(ColorPalette *palette);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* _COLOR_PALETTE_H_ */
|
60
include/gds-render/widgets/activity-bar.h
Normal file
60
include/gds-render/widgets/activity-bar.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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 activity-bar.h
|
||||
* @brief Header file for activity bar widget
|
||||
* @author Mario Hüttel <mario.huettel@gmx.net>
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup ActivityBar
|
||||
* @ingroup Widgets
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __LAYER_ELEMENT_H__
|
||||
#define __LAYER_ELEMENT_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* Creates Class structure etc */
|
||||
G_DECLARE_FINAL_TYPE(ActivityBar, activity_bar, ACTIVITY, BAR, GtkBox)
|
||||
|
||||
#define TYPE_ACTIVITY_BAR (activity_bar_get_type())
|
||||
|
||||
/**
|
||||
* @brief Create new Object ActivityBar
|
||||
* @return New object. In case of error: NULL.
|
||||
*/
|
||||
ActivityBar *activity_bar_new();
|
||||
|
||||
/**
|
||||
* @brief Deletes all applied tasks and sets bar to "Ready".
|
||||
* @param[in] bar AcitivityBar object.
|
||||
*/
|
||||
void activity_bar_set_ready(ActivityBar *bar);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __LAYER_ELEMENT_H__ */
|
||||
|
||||
/** @} */
|
@@ -19,7 +19,7 @@
|
||||
|
||||
/**
|
||||
* @file layer-element.h
|
||||
* @brief Omplementation of the layer element used for configuring layer colors etc.
|
||||
* @brief Implementation of the layer element used for configuring layer colors etc.
|
||||
* @author Mario Hüttel <mario.huettel@gmx.net>
|
||||
*/
|
||||
|
||||
|
124
layer/color-palette.c
Normal file
124
layer/color-palette.c
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* 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 color-palette.c
|
||||
* @brief Class representing a color palette
|
||||
* @author Mario Hüttel <mario.huettel@gmx.net>
|
||||
*/
|
||||
|
||||
#include <gds-render/layer/color-palette.h>
|
||||
|
||||
struct _ColorPalette {
|
||||
/* Inheritance */
|
||||
GObject parent;
|
||||
|
||||
/* Custom fields */
|
||||
/** @brief The internal array to store the colors */
|
||||
GdkRGBA *color_array;
|
||||
/** @brief The length of the _ColorPalette::color_array array */
|
||||
unsigned int color_array_length;
|
||||
|
||||
gpointer dummy[4];
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(ColorPalette, color_palette, G_TYPE_OBJECT)
|
||||
|
||||
/**
|
||||
* @brief color_palette_fill_with_resource
|
||||
* @param palette
|
||||
* @param resource_name
|
||||
* @return 0 if successful
|
||||
*/
|
||||
static int color_palette_fill_with_resource(ColorPalette *palette, char *resource_name)
|
||||
{
|
||||
GBytes *data;
|
||||
char *char_array;
|
||||
|
||||
if (!palette || !resource_name)
|
||||
return -1;
|
||||
|
||||
data = g_resources_lookup_data(resource_name, 0, NULL);
|
||||
|
||||
if (!data)
|
||||
return -2;
|
||||
|
||||
|
||||
g_bytes_unref(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
ColorPalette *color_palette_new_from_resource(char *resource_name)
|
||||
{
|
||||
ColorPalette *palette;
|
||||
|
||||
palette = GDS_RENDER_COLOR_PALETTE(g_object_new(TYPE_GDS_RENDER_COLOR_PALETTE, NULL));
|
||||
if (palette)
|
||||
(void)color_palette_fill_with_resource(palette, resource_name);
|
||||
|
||||
return palette;
|
||||
}
|
||||
|
||||
GdkRGBA *color_palette_get_color(ColorPalette *palette, GdkRGBA *color, unsigned int index)
|
||||
{
|
||||
GdkRGBA *c = NULL;
|
||||
|
||||
if (!palette)
|
||||
goto ret_c;
|
||||
|
||||
if (index >= palette->color_array_length)
|
||||
goto ret_c;
|
||||
|
||||
if (color)
|
||||
c = color;
|
||||
else
|
||||
c = (GdkRGBA *)malloc(sizeof(GdkRGBA));
|
||||
|
||||
/* Copy color */
|
||||
c->red = palette->color_array[index].red;
|
||||
c->green = palette->color_array[index].green;
|
||||
c->blue = palette->color_array[index].blue;
|
||||
c->alpha = palette->color_array[index].alpha;
|
||||
ret_c:
|
||||
return c;
|
||||
}
|
||||
|
||||
unsigned int color_palette_get_color_count(ColorPalette *palette)
|
||||
{
|
||||
unsigned int return_val = 0;
|
||||
|
||||
if (palette)
|
||||
return_val = palette->color_array_length;
|
||||
|
||||
return return_val;
|
||||
}
|
||||
|
||||
static void color_palette_class_init(ColorPaletteClass *klass)
|
||||
{
|
||||
(void)klass;
|
||||
/* Nothing to do for now */
|
||||
return;
|
||||
}
|
||||
|
||||
static void color_palette_init(ColorPalette *self)
|
||||
{
|
||||
self->color_array = NULL;
|
||||
self->color_array_length = 0;
|
||||
}
|
4
main.c
4
main.c
@@ -90,13 +90,13 @@ static void app_about(GSimpleAction *action, GVariant *parameter, gpointer user_
|
||||
(void)action;
|
||||
(void)parameter;
|
||||
|
||||
builder = gtk_builder_new_from_resource("/about.glade");
|
||||
builder = gtk_builder_new_from_resource("/gui/about.glade");
|
||||
dialog = GTK_DIALOG(gtk_builder_get_object(builder, "about-dialog"));
|
||||
gtk_window_set_transient_for(GTK_WINDOW(dialog), NULL);
|
||||
gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), _app_version_string);
|
||||
|
||||
/* Load icon from resource */
|
||||
logo_buf = gdk_pixbuf_new_from_resource_at_scale("/logo.svg", 100, 100, TRUE, &error);
|
||||
logo_buf = gdk_pixbuf_new_from_resource_at_scale("/images/logo.svg", 100, 100, TRUE, &error);
|
||||
if (logo_buf) {
|
||||
/* Set logo */
|
||||
gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(dialog), logo_buf);
|
||||
|
@@ -2,6 +2,7 @@ add_custom_target(glib-resources DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/resources.c
|
||||
add_custom_command(DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.glade
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/resources.xml
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/color-palette.txt
|
||||
OUTPUT
|
||||
${CMAKE_CURRENT_BINARY_DIR}/resources.c
|
||||
COMMAND
|
255
resources/color-palette.txt
Normal file
255
resources/color-palette.txt
Normal file
@@ -0,0 +1,255 @@
|
||||
800000
|
||||
008000
|
||||
808000
|
||||
000080
|
||||
800080
|
||||
008080
|
||||
c0c0c0
|
||||
808080
|
||||
ff0000
|
||||
00ff00
|
||||
ffff00
|
||||
0000ff
|
||||
ff00ff
|
||||
00ffff
|
||||
f105f5
|
||||
000000
|
||||
00005f
|
||||
000087
|
||||
0000af
|
||||
0000d7
|
||||
0000ff
|
||||
005f00
|
||||
005f5f
|
||||
005f87
|
||||
005faf
|
||||
005fd7
|
||||
005fff
|
||||
008700
|
||||
00875f
|
||||
008787
|
||||
0087af
|
||||
0087d7
|
||||
0087ff
|
||||
00af00
|
||||
00af5f
|
||||
00af87
|
||||
00afaf
|
||||
00afd7
|
||||
00afff
|
||||
00d700
|
||||
00d75f
|
||||
00d787
|
||||
00d7af
|
||||
00d7d7
|
||||
00d7ff
|
||||
00ff00
|
||||
00ff5f
|
||||
00ff87
|
||||
00ffaf
|
||||
00ffd7
|
||||
00ffff
|
||||
5f0000
|
||||
5f005f
|
||||
5f0087
|
||||
5f00af
|
||||
5f00d7
|
||||
5f00ff
|
||||
5f5f00
|
||||
5f5f5f
|
||||
5f5f87
|
||||
5f5faf
|
||||
5f5fd7
|
||||
5f5fff
|
||||
5f8700
|
||||
5f875f
|
||||
5f8787
|
||||
5f87af
|
||||
5f87d7
|
||||
5f87ff
|
||||
5faf00
|
||||
5faf5f
|
||||
5faf87
|
||||
5fafaf
|
||||
5fafd7
|
||||
5fafff
|
||||
5fd700
|
||||
5fd75f
|
||||
5fd787
|
||||
5fd7af
|
||||
5fd7d7
|
||||
5fd7ff
|
||||
5fff00
|
||||
5fff5f
|
||||
5fff87
|
||||
5fffaf
|
||||
5fffd7
|
||||
5fffff
|
||||
870000
|
||||
87005f
|
||||
870087
|
||||
8700af
|
||||
8700d7
|
||||
8700ff
|
||||
875f00
|
||||
875f5f
|
||||
875f87
|
||||
875faf
|
||||
875fd7
|
||||
875fff
|
||||
878700
|
||||
87875f
|
||||
878787
|
||||
8787af
|
||||
8787d7
|
||||
8787ff
|
||||
87af00
|
||||
87af5f
|
||||
87af87
|
||||
87afaf
|
||||
87afd7
|
||||
87afff
|
||||
87d700
|
||||
87d75f
|
||||
87d787
|
||||
87d7af
|
||||
87d7d7
|
||||
87d7ff
|
||||
87ff00
|
||||
87ff5f
|
||||
87ff87
|
||||
87ffaf
|
||||
87ffd7
|
||||
87ffff
|
||||
af0000
|
||||
af005f
|
||||
af0087
|
||||
af00af
|
||||
af00d7
|
||||
af00ff
|
||||
af5f00
|
||||
af5f5f
|
||||
af5f87
|
||||
af5faf
|
||||
af5fd7
|
||||
af5fff
|
||||
af8700
|
||||
af875f
|
||||
af8787
|
||||
af87af
|
||||
af87d7
|
||||
af87ff
|
||||
afaf00
|
||||
afaf5f
|
||||
afaf87
|
||||
afafaf
|
||||
afafd7
|
||||
afafff
|
||||
afd700
|
||||
afd75f
|
||||
afd787
|
||||
afd7af
|
||||
afd7d7
|
||||
afd7ff
|
||||
afff00
|
||||
afff5f
|
||||
afff87
|
||||
afffaf
|
||||
afffd7
|
||||
afffff
|
||||
d70000
|
||||
d7005f
|
||||
d70087
|
||||
d700af
|
||||
d700d7
|
||||
d700ff
|
||||
d75f00
|
||||
d75f5f
|
||||
d75f87
|
||||
d75faf
|
||||
d75fd7
|
||||
d75fff
|
||||
d78700
|
||||
d7875f
|
||||
d78787
|
||||
d787af
|
||||
d787d7
|
||||
d787ff
|
||||
d7af00
|
||||
d7af5f
|
||||
d7af87
|
||||
d7afaf
|
||||
d7afd7
|
||||
d7afff
|
||||
d7d700
|
||||
d7d75f
|
||||
d7d787
|
||||
d7d7af
|
||||
d7d7d7
|
||||
d7d7ff
|
||||
d7ff00
|
||||
d7ff5f
|
||||
d7ff87
|
||||
d7ffaf
|
||||
d7ffd7
|
||||
d7ffff
|
||||
ff0000
|
||||
ff005f
|
||||
ff0087
|
||||
ff00af
|
||||
ff00d7
|
||||
ff00ff
|
||||
ff5f00
|
||||
ff5f5f
|
||||
ff5f87
|
||||
ff5faf
|
||||
ff5fd7
|
||||
ff5fff
|
||||
ff8700
|
||||
ff875f
|
||||
ff8787
|
||||
ff87af
|
||||
ff87d7
|
||||
ff87ff
|
||||
ffaf00
|
||||
ffaf5f
|
||||
ffaf87
|
||||
ffafaf
|
||||
ffafd7
|
||||
ffafff
|
||||
ffd700
|
||||
ffd75f
|
||||
ffd787
|
||||
ffd7af
|
||||
ffd7d7
|
||||
ffd7ff
|
||||
ffff00
|
||||
ffff5f
|
||||
ffff87
|
||||
ffffaf
|
||||
ffffd7
|
||||
ffffff
|
||||
080808
|
||||
121212
|
||||
1c1c1c
|
||||
262626
|
||||
303030
|
||||
3a3a3a
|
||||
444444
|
||||
4e4e4e
|
||||
585858
|
||||
626262
|
||||
6c6c6c
|
||||
767676
|
||||
808080
|
||||
8a8a8a
|
||||
949494
|
||||
9e9e9e
|
||||
a8a8a8
|
||||
b2b2b2
|
||||
bcbcbc
|
||||
c6c6c6
|
||||
d0d0d0
|
||||
dadada
|
||||
e4e4e4
|
||||
eeeeee
|
@@ -2,15 +2,20 @@
|
||||
<!-- Generated with glade 3.22.1 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkImage" id="image1">
|
||||
<object class="GtkImage" id="color-img">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-go-up</property>
|
||||
<property name="stock">gtk-select-color</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image2">
|
||||
<object class="GtkImage" id="load-mapping-img">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-go-down</property>
|
||||
<property name="stock">gtk-open</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="save-mapping-img">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-save-as</property>
|
||||
</object>
|
||||
<object class="GtkWindow" id="main-window">
|
||||
<property name="height_request">250</property>
|
||||
@@ -43,6 +48,8 @@
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">load-mapping-img</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<style>
|
||||
<class name="suggested-action"/>
|
||||
</style>
|
||||
@@ -58,6 +65,8 @@
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">save-mapping-img</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<style>
|
||||
<class name="suggested-action"/>
|
||||
</style>
|
||||
@@ -90,42 +99,144 @@
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="cell-search">
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="primary_icon_name">edit-find-symbolic</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="cell-search">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="primary_icon_name">edit-find-symbolic</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="cell-tree">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="enable_search">False</property>
|
||||
<property name="enable_grid_lines">both</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection"/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="cell-tree">
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_clickable">False</property>
|
||||
<property name="enable_search">False</property>
|
||||
<property name="enable_grid_lines">both</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection"/>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button-up-sort">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">sort-up-img</property>
|
||||
<property name="always_show_image">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button-down-sort">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">sort-down-img</property>
|
||||
<property name="always_show_image">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="auto-color-button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">color-img</property>
|
||||
<property name="always_show_image">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="layer-list">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="selection_mode">none</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
@@ -142,83 +253,31 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<object class="GtkBox" id="activity-bar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button-up-sort">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">image1</property>
|
||||
<property name="always_show_image">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button-down-sort">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">image2</property>
|
||||
<property name="always_show_image">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="layer-list">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="selection_mode">none</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</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>
|
17
resources/resources.xml
Normal file
17
resources/resources.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/gui">
|
||||
<file compressed="true">main.glade</file>
|
||||
<file compressed="true">about.glade</file>
|
||||
<file>layer-widget.glade</file>
|
||||
<file>dialog.glade</file>
|
||||
</gresource>
|
||||
<gresource prefix="/data">
|
||||
<file compressed="true">color-palette.txt</file>
|
||||
</gresource>
|
||||
<gresource prefix="/images">
|
||||
<file compressed="true" alias="logo.svg">../icon/gds-render.svg</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
|
||||
|
109
widgets/activity-bar.c
Normal file
109
widgets/activity-bar.c
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The drag and drop implementation is adapted from
|
||||
* https://gitlab.gnome.org/GNOME/gtk/blob/gtk-3-22/tests/testlist3.c
|
||||
*
|
||||
* Thanks to the GTK3 people for creating these examples.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file activity-bar.c
|
||||
* @brief Status bar indicating activity of the program
|
||||
* @author Mario Hüttel <mario.huettel@gmx.net>
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup ActivityBar
|
||||
* @ingroup Widgets
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <gds-render/widgets/activity-bar.h>
|
||||
|
||||
/** @brief Opaque ActivityBar object. Not viewable outside this source file. */
|
||||
struct _ActivityBar {
|
||||
GtkBox super;
|
||||
/* Private stuff */
|
||||
GtkWidget *spinner;
|
||||
GtkWidget *label;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(ActivityBar, activity_bar, GTK_TYPE_BOX)
|
||||
|
||||
static void activity_bar_dispose(GObject *obj)
|
||||
{
|
||||
ActivityBar *bar;
|
||||
|
||||
bar = ACTIVITY_BAR(obj);
|
||||
|
||||
/* Clear references on owned objects */
|
||||
g_clear_object(&bar->label);
|
||||
g_clear_object(&bar->spinner);
|
||||
|
||||
/* Chain up */
|
||||
G_OBJECT_CLASS(activity_bar_parent_class)->dispose(obj);
|
||||
}
|
||||
|
||||
static void activity_bar_class_init(ActivityBarClass *klass)
|
||||
{
|
||||
GObjectClass *oclass = G_OBJECT_CLASS(klass);
|
||||
|
||||
oclass->dispose = activity_bar_dispose;
|
||||
}
|
||||
|
||||
static void activity_bar_init(ActivityBar *self)
|
||||
{
|
||||
GtkContainer *box = GTK_CONTAINER(self);
|
||||
|
||||
/* Create Widgets */
|
||||
self->label = gtk_label_new("");
|
||||
self->spinner = gtk_spinner_new();
|
||||
|
||||
/* Add to this widget and show */
|
||||
gtk_container_add(box, self->spinner);
|
||||
gtk_container_add(box, self->label);
|
||||
gtk_widget_show(self->label);
|
||||
gtk_widget_show(self->spinner);
|
||||
|
||||
g_object_ref(self->spinner);
|
||||
g_object_ref(self->label);
|
||||
}
|
||||
|
||||
ActivityBar *activity_bar_new()
|
||||
{
|
||||
ActivityBar *bar;
|
||||
|
||||
bar = ACTIVITY_BAR(g_object_new(TYPE_ACTIVITY_BAR, "orientation", GTK_ORIENTATION_HORIZONTAL, NULL));
|
||||
if (bar)
|
||||
activity_bar_set_ready(bar);
|
||||
|
||||
return bar;
|
||||
}
|
||||
|
||||
/* TODO: Complete this once the task list is fully implemented */
|
||||
void activity_bar_set_ready(ActivityBar *bar)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(bar->label), "Ready");
|
||||
gtk_spinner_stop(GTK_SPINNER(bar->spinner));
|
||||
}
|
||||
|
||||
|
||||
/** @} */
|
@@ -270,7 +270,7 @@ static void renderer_settings_dialog_init(RendererSettingsDialog *self)
|
||||
|
||||
dialog = &self->parent;
|
||||
|
||||
builder = gtk_builder_new_from_resource("/dialog.glade");
|
||||
builder = gtk_builder_new_from_resource("/gui/dialog.glade");
|
||||
box = GTK_WIDGET(gtk_builder_get_object(builder, "dialog-box"));
|
||||
self->radio_latex = GTK_WIDGET(gtk_builder_get_object(builder, "latex-radio"));
|
||||
self->radio_cairo_pdf = GTK_WIDGET(gtk_builder_get_object(builder, "cairo-pdf-radio"));
|
||||
|
@@ -62,7 +62,7 @@ static void layer_element_init(LayerElement *self)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *glade_box;
|
||||
builder = gtk_builder_new_from_resource("/layer-widget.glade");
|
||||
builder = gtk_builder_new_from_resource("/gui/layer-widget.glade");
|
||||
glade_box = GTK_WIDGET(gtk_builder_get_object(builder, "box"));
|
||||
gtk_container_add(GTK_CONTAINER(self), glade_box);
|
||||
|
||||
|
Reference in New Issue
Block a user