Merge branch 'master' into dev
This commit is contained in:
commit
60e20f45cc
@ -16,7 +16,7 @@ add_definitions(${GLIB2_CFLAGS_OTHER})
|
|||||||
|
|
||||||
aux_source_directory("widgets" LAYER_SOURCES)
|
aux_source_directory("widgets" LAYER_SOURCES)
|
||||||
aux_source_directory("tree-renderer" RENDERER_SOURCES)
|
aux_source_directory("tree-renderer" RENDERER_SOURCES)
|
||||||
aux_source_directory("gds-parser" PARSER_SOURCES)
|
aux_source_directory("gds-utils" GDS_SOURCES)
|
||||||
aux_source_directory("latex-output" LATEX_SOURCES)
|
aux_source_directory("latex-output" LATEX_SOURCES)
|
||||||
aux_source_directory("cairo-output" CAIRO_SOURCES)
|
aux_source_directory("cairo-output" CAIRO_SOURCES)
|
||||||
aux_source_directory("trigonometric" TRIG_SOURCES)
|
aux_source_directory("trigonometric" TRIG_SOURCES)
|
||||||
@ -27,7 +27,7 @@ set(SOURCE
|
|||||||
${SOURCE}
|
${SOURCE}
|
||||||
${LAYER_SOURCES}
|
${LAYER_SOURCES}
|
||||||
${RENDERER_SOURCES}
|
${RENDERER_SOURCES}
|
||||||
${PARSER_SOURCES}
|
${GDS_SOURCES}
|
||||||
${LATEX_SOURCES}
|
${LATEX_SOURCES}
|
||||||
${CAIRO_SOURCES}
|
${CAIRO_SOURCES}
|
||||||
${TRIG_SOURCES}
|
${TRIG_SOURCES}
|
||||||
|
@ -235,8 +235,12 @@ void cairo_render_cell_to_vector_file(struct gds_cell *cell, GList *layer_infos,
|
|||||||
/* Print size */
|
/* Print size */
|
||||||
cairo_recording_surface_ink_extents(layers[linfo->layer].rec, &rec_x0, &rec_y0,
|
cairo_recording_surface_ink_extents(layers[linfo->layer].rec, &rec_x0, &rec_y0,
|
||||||
&rec_width, &rec_height);
|
&rec_width, &rec_height);
|
||||||
printf("Size of layer %d: %lf -- %lf\n", linfo->layer,
|
printf("Size of layer %d%s%s%s: <%lf x %lf> @ (%lf | %lf)\n",
|
||||||
rec_width, rec_height);
|
linfo->layer,
|
||||||
|
(linfo->name && linfo->name[0] ? " (" : ""),
|
||||||
|
(linfo->name && linfo->name[0] ? linfo->name : ""),
|
||||||
|
(linfo->name && linfo->name[0] ? ")" : ""),
|
||||||
|
rec_width, rec_height, rec_x0, rec_y0);
|
||||||
|
|
||||||
/* update bounding box */
|
/* update bounding box */
|
||||||
xmin = MIN(xmin, rec_x0);
|
xmin = MIN(xmin, rec_x0);
|
||||||
@ -250,7 +254,7 @@ void cairo_render_cell_to_vector_file(struct gds_cell *cell, GList *layer_infos,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Bounding box: (%lf,%lf) -- (%lf,%lf)\n", xmin, ymin, xmax, ymax);
|
printf("Cell bounding box: (%lf | %lf) -- (%lf | %lf)\n", xmin, ymin, xmax, ymax);
|
||||||
|
|
||||||
if (pdf_file) {
|
if (pdf_file) {
|
||||||
pdf_surface = cairo_pdf_surface_create(pdf_file, xmax-xmin, ymax-ymin);
|
pdf_surface = cairo_pdf_surface_create(pdf_file, xmax-xmin, ymax-ymin);
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#define __CAIRO_OUTPUT_H__
|
#define __CAIRO_OUTPUT_H__
|
||||||
|
|
||||||
#include "../layer/layer-info.h"
|
#include "../layer/layer-info.h"
|
||||||
#include "../gds-parser/gds-types.h"
|
#include "../gds-utils/gds-types.h"
|
||||||
|
|
||||||
/** @addtogroup Cairo-Renderer
|
/** @addtogroup Cairo-Renderer
|
||||||
* @{
|
* @{
|
||||||
|
@ -30,13 +30,13 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "command-line.h"
|
#include "command-line.h"
|
||||||
#include "gds-parser/gds-parser.h"
|
#include "gds-utils/gds-parser.h"
|
||||||
#include "mapping-parser.h"
|
#include "mapping-parser.h"
|
||||||
#include "layer/layer-info.h"
|
#include "layer/layer-info.h"
|
||||||
#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"
|
#include "gds-utils/gds-tree-checker.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Delete layer_info and free nem element.
|
* @brief Delete layer_info and free nem element.
|
||||||
@ -98,7 +98,7 @@ void command_line_convert_gds(char *gds_name, char *pdf_name, char *tex_name, gb
|
|||||||
dstream = g_data_input_stream_new(G_INPUT_STREAM(stream));
|
dstream = g_data_input_stream_new(G_INPUT_STREAM(stream));
|
||||||
i = 0;
|
i = 0;
|
||||||
do {
|
do {
|
||||||
res = load_csv_line(dstream, &layer_export, &layer_name, &layer, &layer_color);
|
res = mapping_parser_load_line(dstream, &layer_export, &layer_name, &layer, &layer_color);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
if (!layer_export)
|
if (!layer_export)
|
||||||
continue;
|
continue;
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#ifndef _EXTERNAL_RENDERER_H_
|
#ifndef _EXTERNAL_RENDERER_H_
|
||||||
#define _EXTERNAL_RENDERER_H_
|
#define _EXTERNAL_RENDERER_H_
|
||||||
|
|
||||||
#include "gds-parser/gds-types.h"
|
#include "gds-utils/gds-types.h"
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
195
gds-render-gui.c
195
gds-render-gui.c
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include "gds-render-gui.h"
|
#include "gds-render-gui.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "gds-parser/gds-parser.h"
|
#include "gds-utils/gds-parser.h"
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include "layer/layer-selector.h"
|
#include "layer/layer-selector.h"
|
||||||
#include "tree-renderer/tree-store.h"
|
#include "tree-renderer/tree-store.h"
|
||||||
@ -39,7 +39,7 @@
|
|||||||
#include "trigonometric/cell-trigonometrics.h"
|
#include "trigonometric/cell-trigonometrics.h"
|
||||||
#include "version/version.h"
|
#include "version/version.h"
|
||||||
#include "tree-renderer/lib-cell-renderer.h"
|
#include "tree-renderer/lib-cell-renderer.h"
|
||||||
#include "gds-parser/gds-tree-checker.h"
|
#include "gds-utils/gds-tree-checker.h"
|
||||||
|
|
||||||
enum gds_render_gui_signal_sig_ids {SIGNAL_WINDOW_CLOSED = 0, SIGNAL_COUNT};
|
enum gds_render_gui_signal_sig_ids {SIGNAL_WINDOW_CLOSED = 0, SIGNAL_COUNT};
|
||||||
|
|
||||||
@ -57,17 +57,17 @@ struct _GdsRenderGui {
|
|||||||
LayerSelector *layer_selector;
|
LayerSelector *layer_selector;
|
||||||
GtkTreeView *cell_tree_view;
|
GtkTreeView *cell_tree_view;
|
||||||
GList *gds_libraries;
|
GList *gds_libraries;
|
||||||
|
struct render_settings render_dialog_settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE(GdsRenderGui, gds_render_gui, G_TYPE_OBJECT)
|
G_DEFINE_TYPE(GdsRenderGui, gds_render_gui, G_TYPE_OBJECT)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Window close event of main window
|
* @brief Main window close event
|
||||||
*
|
* @param window GtkWindow which is closed
|
||||||
* Closes the main window. This leads to the termination of the whole application
|
* @param event unused event
|
||||||
* @param window main window
|
* @param user GdsRenderGui instance
|
||||||
* @param user not used
|
* @return Status of the event handling. Always true.
|
||||||
* @return TRUE. This indicates that the event has been fully handled
|
|
||||||
*/
|
*/
|
||||||
static gboolean on_window_close(gpointer window, GdkEvent *event, gpointer user)
|
static gboolean on_window_close(gpointer window, GdkEvent *event, gpointer user)
|
||||||
{
|
{
|
||||||
@ -112,7 +112,7 @@ static GString *generate_string_from_date(struct gds_time_field *date)
|
|||||||
/**
|
/**
|
||||||
* @brief Callback function of Load GDS button
|
* @brief Callback function of Load GDS button
|
||||||
* @param button
|
* @param button
|
||||||
* @param user Necessary Data
|
* @param user GdsRenderGui instance
|
||||||
*/
|
*/
|
||||||
static void on_load_gds(gpointer button, gpointer user)
|
static void on_load_gds(gpointer button, gpointer user)
|
||||||
{
|
{
|
||||||
@ -152,85 +152,83 @@ static void on_load_gds(gpointer button, gpointer user)
|
|||||||
|
|
||||||
dialog_result = gtk_dialog_run(GTK_DIALOG(open_dialog));
|
dialog_result = gtk_dialog_run(GTK_DIALOG(open_dialog));
|
||||||
|
|
||||||
if (dialog_result == GTK_RESPONSE_ACCEPT) {
|
if (dialog_result != GTK_RESPONSE_ACCEPT)
|
||||||
|
goto end_destroy;
|
||||||
|
|
||||||
/* Get File name */
|
/* Get File name */
|
||||||
filename = gtk_file_chooser_get_filename(file_chooser);
|
filename = gtk_file_chooser_get_filename(file_chooser);
|
||||||
|
|
||||||
gtk_tree_store_clear(self->cell_tree_store);
|
gtk_tree_store_clear(self->cell_tree_store);
|
||||||
clear_lib_list(&self->gds_libraries);
|
clear_lib_list(&self->gds_libraries);
|
||||||
|
|
||||||
/* Parse new GDSII file */
|
/* Parse new GDSII file */
|
||||||
gds_result = parse_gds_from_file(filename, &self->gds_libraries);
|
gds_result = parse_gds_from_file(filename, &self->gds_libraries);
|
||||||
|
|
||||||
/* Delete file name afterwards */
|
/* Delete file name afterwards */
|
||||||
g_free(filename);
|
g_free(filename);
|
||||||
if (gds_result)
|
if (gds_result)
|
||||||
goto end_destroy;
|
goto end_destroy;
|
||||||
|
|
||||||
/* remove suggested action from Open button */
|
/* remove suggested action from Open button */
|
||||||
button_style = gtk_widget_get_style_context(GTK_WIDGET(button));
|
button_style = gtk_widget_get_style_context(GTK_WIDGET(button));
|
||||||
gtk_style_context_remove_class(button_style, "suggested-action");
|
gtk_style_context_remove_class(button_style, "suggested-action");
|
||||||
|
|
||||||
for (lib = self->gds_libraries; lib != NULL; lib = lib->next) {
|
for (lib = self->gds_libraries; lib != NULL; lib = lib->next) {
|
||||||
gds_lib = (struct gds_library *)lib->data;
|
gds_lib = (struct gds_library *)lib->data;
|
||||||
/* Create top level iter */
|
/* Create top level iter */
|
||||||
gtk_tree_store_append(self->cell_tree_store, &libiter, NULL);
|
gtk_tree_store_append(self->cell_tree_store, &libiter, NULL);
|
||||||
|
|
||||||
|
/* Convert dates to String */
|
||||||
|
mod_date = generate_string_from_date(&gds_lib->mod_time);
|
||||||
|
acc_date = generate_string_from_date(&gds_lib->access_time);
|
||||||
|
|
||||||
|
gtk_tree_store_set(self->cell_tree_store, &libiter,
|
||||||
|
CELL_SEL_LIBRARY, gds_lib,
|
||||||
|
CELL_SEL_MODDATE, mod_date->str,
|
||||||
|
CELL_SEL_ACCESSDATE, acc_date->str,
|
||||||
|
-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. */
|
||||||
|
/* Cell store copies String type data items */
|
||||||
|
g_string_free(mod_date, TRUE);
|
||||||
|
g_string_free(acc_date, TRUE);
|
||||||
|
|
||||||
|
for (cell = gds_lib->cells; cell != NULL; cell = cell->next) {
|
||||||
|
gds_c = (struct gds_cell *)cell->data;
|
||||||
|
gtk_tree_store_append(self->cell_tree_store, &celliter, &libiter);
|
||||||
/* Convert dates to String */
|
/* Convert dates to String */
|
||||||
mod_date = generate_string_from_date(&gds_lib->mod_time);
|
mod_date = generate_string_from_date(&gds_c->mod_time);
|
||||||
acc_date = generate_string_from_date(&gds_lib->access_time);
|
acc_date = generate_string_from_date(&gds_c->access_time);
|
||||||
|
|
||||||
gtk_tree_store_set(self->cell_tree_store, &libiter,
|
/* Get the checking results for this cell */
|
||||||
CELL_SEL_LIBRARY, gds_lib,
|
cell_error_level = 0;
|
||||||
|
if (gds_c->checks.unresolved_child_count)
|
||||||
|
cell_error_level |= LIB_CELL_RENDERER_ERROR_WARN;
|
||||||
|
|
||||||
|
/* Check if it is completely b0rken */
|
||||||
|
if (gds_c->checks.affected_by_reference_loop)
|
||||||
|
cell_error_level |= LIB_CELL_RENDERER_ERROR_ERR;
|
||||||
|
|
||||||
|
/* Add cell to tree store model */
|
||||||
|
gtk_tree_store_set(self->cell_tree_store, &celliter,
|
||||||
|
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);
|
-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);
|
||||||
g_string_free(acc_date, TRUE);
|
g_string_free(acc_date, TRUE);
|
||||||
|
} /* for cells */
|
||||||
|
} /* for libraries */
|
||||||
|
|
||||||
for (cell = gds_lib->cells; cell != NULL; cell = cell->next) {
|
/* Create Layers in Layer Box */
|
||||||
gds_c = (struct gds_cell *)cell->data;
|
layer_selector_generate_layer_widgets(self->layer_selector, self->gds_libraries);
|
||||||
gtk_tree_store_append(self->cell_tree_store, &celliter, &libiter);
|
|
||||||
|
|
||||||
/* Convert dates to String */
|
|
||||||
mod_date = generate_string_from_date(&gds_c->mod_time);
|
|
||||||
acc_date = generate_string_from_date(&gds_c->access_time);
|
|
||||||
|
|
||||||
/* Get the checking results for this cell */
|
|
||||||
cell_error_level = 0;
|
|
||||||
if (gds_c->checks.unresolved_child_count)
|
|
||||||
cell_error_level |= LIB_CELL_RENDERER_ERROR_WARN;
|
|
||||||
|
|
||||||
/* Check if it is completely b0rken */
|
|
||||||
if (gds_c->checks.affected_by_reference_loop)
|
|
||||||
cell_error_level |= LIB_CELL_RENDERER_ERROR_ERR;
|
|
||||||
|
|
||||||
/* Add cell to tree store model */
|
|
||||||
gtk_tree_store_set(self->cell_tree_store, &celliter,
|
|
||||||
CELL_SEL_CELL, gds_c,
|
|
||||||
CELL_SEL_MODDATE, mod_date->str,
|
|
||||||
CELL_SEL_ACCESSDATE, acc_date->str,
|
|
||||||
CELL_SEL_CELL_ERROR_STATE, cell_error_level,
|
|
||||||
-1);
|
|
||||||
|
|
||||||
/* Delete GStrings including string data. */
|
|
||||||
/* Cell store copies String type data items */
|
|
||||||
g_string_free(mod_date, TRUE);
|
|
||||||
g_string_free(acc_date, TRUE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create Layers in Layer Box */
|
|
||||||
layer_selector_generate_layer_widgets(self->layer_selector, self->gds_libraries);
|
|
||||||
}
|
|
||||||
|
|
||||||
end_destroy:
|
end_destroy:
|
||||||
/* Destroy dialog and filter */
|
/* Destroy dialog and filter */
|
||||||
@ -245,10 +243,6 @@ end_destroy:
|
|||||||
static void on_convert_clicked(gpointer button, gpointer user)
|
static void on_convert_clicked(gpointer button, gpointer user)
|
||||||
{
|
{
|
||||||
(void)button;
|
(void)button;
|
||||||
static struct render_settings sett = {
|
|
||||||
.scale = 1000.0,
|
|
||||||
.renderer = RENDERER_LATEX_TIKZ,
|
|
||||||
};
|
|
||||||
GdsRenderGui *self;
|
GdsRenderGui *self;
|
||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
@ -263,12 +257,15 @@ static void on_convert_clicked(gpointer button, gpointer user)
|
|||||||
char *file_name;
|
char *file_name;
|
||||||
union bounding_box cell_box;
|
union bounding_box cell_box;
|
||||||
unsigned int height, width;
|
unsigned int height, width;
|
||||||
|
struct render_settings *sett;
|
||||||
|
|
||||||
self = RENDERER_GUI(user);
|
self = RENDERER_GUI(user);
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
sett = &self->render_dialog_settings;
|
||||||
|
|
||||||
/* Get selected cell */
|
/* Get selected cell */
|
||||||
selection = gtk_tree_view_get_selection(self->cell_tree_view);
|
selection = gtk_tree_view_get_selection(self->cell_tree_view);
|
||||||
if (gtk_tree_selection_get_selected(selection, &model, &iter) == FALSE)
|
if (gtk_tree_selection_get_selected(selection, &model, &iter) == FALSE)
|
||||||
@ -295,14 +292,14 @@ static void on_convert_clicked(gpointer button, gpointer user)
|
|||||||
|
|
||||||
/* Show settings dialog */
|
/* Show settings dialog */
|
||||||
settings = renderer_settings_dialog_new(GTK_WINDOW(self->main_window));
|
settings = renderer_settings_dialog_new(GTK_WINDOW(self->main_window));
|
||||||
renderer_settings_dialog_set_settings(settings, &sett);
|
renderer_settings_dialog_set_settings(settings, sett);
|
||||||
renderer_settings_dialog_set_database_unit_scale(settings, cell_to_render->parent_library->unit_in_meters);
|
renderer_settings_dialog_set_database_unit_scale(settings, cell_to_render->parent_library->unit_in_meters);
|
||||||
renderer_settings_dialog_set_cell_height(settings, height);
|
renderer_settings_dialog_set_cell_height(settings, height);
|
||||||
renderer_settings_dialog_set_cell_width(settings, width);
|
renderer_settings_dialog_set_cell_width(settings, width);
|
||||||
|
|
||||||
res = gtk_dialog_run(GTK_DIALOG(settings));
|
res = gtk_dialog_run(GTK_DIALOG(settings));
|
||||||
if (res == GTK_RESPONSE_OK) {
|
if (res == GTK_RESPONSE_OK) {
|
||||||
renderer_settings_dialog_get_settings(settings, &sett);
|
renderer_settings_dialog_get_settings(settings, sett);
|
||||||
gtk_widget_destroy(GTK_WIDGET(settings));
|
gtk_widget_destroy(GTK_WIDGET(settings));
|
||||||
} else {
|
} else {
|
||||||
gtk_widget_destroy(GTK_WIDGET(settings));
|
gtk_widget_destroy(GTK_WIDGET(settings));
|
||||||
@ -310,13 +307,13 @@ static void on_convert_clicked(gpointer button, gpointer user)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* save file dialog */
|
/* save file dialog */
|
||||||
dialog = gtk_file_chooser_dialog_new((sett.renderer == RENDERER_LATEX_TIKZ
|
dialog = gtk_file_chooser_dialog_new((sett->renderer == RENDERER_LATEX_TIKZ
|
||||||
? "Save LaTeX File" : "Save PDF"),
|
? "Save LaTeX File" : "Save PDF"),
|
||||||
GTK_WINDOW(self->main_window), GTK_FILE_CHOOSER_ACTION_SAVE,
|
GTK_WINDOW(self->main_window), GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||||
"Cancel", GTK_RESPONSE_CANCEL, "Save", GTK_RESPONSE_ACCEPT, NULL);
|
"Cancel", GTK_RESPONSE_CANCEL, "Save", GTK_RESPONSE_ACCEPT, NULL);
|
||||||
/* Set file filter according to settings */
|
/* Set file filter according to settings */
|
||||||
filter = gtk_file_filter_new();
|
filter = gtk_file_filter_new();
|
||||||
switch (sett.renderer) {
|
switch (sett->renderer) {
|
||||||
case RENDERER_LATEX_TIKZ:
|
case RENDERER_LATEX_TIKZ:
|
||||||
gtk_file_filter_add_pattern(filter, "*.tex");
|
gtk_file_filter_add_pattern(filter, "*.tex");
|
||||||
gtk_file_filter_set_name(filter, "LaTeX-Files");
|
gtk_file_filter_set_name(filter, "LaTeX-Files");
|
||||||
@ -340,23 +337,23 @@ static void on_convert_clicked(gpointer button, gpointer user)
|
|||||||
file_name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
|
file_name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
|
||||||
gtk_widget_destroy(dialog);
|
gtk_widget_destroy(dialog);
|
||||||
|
|
||||||
switch (sett.renderer) {
|
switch (sett->renderer) {
|
||||||
case RENDERER_LATEX_TIKZ:
|
case RENDERER_LATEX_TIKZ:
|
||||||
output_file = fopen(file_name, "w");
|
output_file = fopen(file_name, "w");
|
||||||
latex_render_cell_to_code(cell_to_render, layer_list, output_file, sett.scale,
|
latex_render_cell_to_code(cell_to_render, layer_list, output_file, sett->scale,
|
||||||
sett.tex_pdf_layers, sett.tex_standalone);
|
sett->tex_pdf_layers, sett->tex_standalone);
|
||||||
fclose(output_file);
|
fclose(output_file);
|
||||||
break;
|
break;
|
||||||
case RENDERER_CAIROGRAPHICS_SVG:
|
case RENDERER_CAIROGRAPHICS_SVG:
|
||||||
case RENDERER_CAIROGRAPHICS_PDF:
|
case RENDERER_CAIROGRAPHICS_PDF:
|
||||||
cairo_render_cell_to_vector_file(cell_to_render, layer_list,
|
cairo_render_cell_to_vector_file(cell_to_render, layer_list,
|
||||||
(sett.renderer == RENDERER_CAIROGRAPHICS_PDF
|
(sett->renderer == RENDERER_CAIROGRAPHICS_PDF
|
||||||
? file_name
|
? file_name
|
||||||
: NULL),
|
: NULL),
|
||||||
(sett.renderer == RENDERER_CAIROGRAPHICS_SVG
|
(sett->renderer == RENDERER_CAIROGRAPHICS_SVG
|
||||||
? file_name
|
? file_name
|
||||||
: NULL),
|
: NULL),
|
||||||
sett.scale);
|
sett->scale);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
g_free(file_name);
|
g_free(file_name);
|
||||||
@ -369,9 +366,11 @@ ret_layer_destroy:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief cell_tree_view_activated
|
* @brief cell_tree_view_activated Callback for 'double click' on cell selector element
|
||||||
* @param tree_view Not used
|
* @param tree_view The tree view the event occured in
|
||||||
* @param user convert button data
|
* @param path path to the selected row
|
||||||
|
* @param column The clicked column
|
||||||
|
* @param user pointer to GdsRenderGui object
|
||||||
*/
|
*/
|
||||||
static void cell_tree_view_activated(gpointer tree_view, GtkTreePath *path,
|
static void cell_tree_view_activated(gpointer tree_view, GtkTreePath *path,
|
||||||
GtkTreeViewColumn *column, gpointer user)
|
GtkTreeViewColumn *column, gpointer user)
|
||||||
@ -484,7 +483,6 @@ static void gds_render_gui_init(GdsRenderGui *self)
|
|||||||
GtkWidget *sort_down_button;
|
GtkWidget *sort_down_button;
|
||||||
|
|
||||||
main_builder = gtk_builder_new_from_resource("/main.glade");
|
main_builder = gtk_builder_new_from_resource("/main.glade");
|
||||||
gtk_builder_connect_signals(main_builder, NULL);
|
|
||||||
|
|
||||||
self->cell_tree_view = GTK_TREE_VIEW(gtk_builder_get_object(main_builder, "cell-tree"));
|
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"));
|
self->cell_search_entry = GTK_WIDGET(gtk_builder_get_object(main_builder, "cell-search"));
|
||||||
@ -523,10 +521,10 @@ static void gds_render_gui_init(GdsRenderGui *self)
|
|||||||
|
|
||||||
/* Set buttons for loading and saving */
|
/* Set buttons for loading and saving */
|
||||||
layer_selector_set_load_mapping_button(self->layer_selector,
|
layer_selector_set_load_mapping_button(self->layer_selector,
|
||||||
GTK_WIDGET(gtk_builder_get_object(main_builder, "button-load-mapping")),
|
GTK_WIDGET(gtk_builder_get_object(main_builder, "button-load-mapping")),
|
||||||
self->main_window);
|
self->main_window);
|
||||||
layer_selector_set_save_mapping_button(self->layer_selector, GTK_WIDGET(gtk_builder_get_object(main_builder, "button-save-mapping")),
|
layer_selector_set_save_mapping_button(self->layer_selector, GTK_WIDGET(gtk_builder_get_object(main_builder, "button-save-mapping")),
|
||||||
self->main_window);
|
self->main_window);
|
||||||
|
|
||||||
/* Connect delete-event */
|
/* Connect delete-event */
|
||||||
g_signal_connect(GTK_WIDGET(self->main_window), "delete-event",
|
g_signal_connect(GTK_WIDGET(self->main_window), "delete-event",
|
||||||
@ -534,6 +532,13 @@ static void gds_render_gui_init(GdsRenderGui *self)
|
|||||||
|
|
||||||
g_object_unref(main_builder);
|
g_object_unref(main_builder);
|
||||||
|
|
||||||
|
/* Set default conversion/rendering settings */
|
||||||
|
self->render_dialog_settings.scale = 1000;
|
||||||
|
self->render_dialog_settings.renderer = RENDERER_LATEX_TIKZ;
|
||||||
|
self->render_dialog_settings.tex_pdf_layers = FALSE;
|
||||||
|
self->render_dialog_settings.tex_standalone = FALSE;
|
||||||
|
|
||||||
|
|
||||||
/* Reference all objects referenced by this object */
|
/* Reference all objects referenced by this object */
|
||||||
g_object_ref(self->main_window);
|
g_object_ref(self->main_window);
|
||||||
g_object_ref(self->cell_tree_view);
|
g_object_ref(self->cell_tree_view);
|
||||||
|
@ -41,7 +41,7 @@ G_DECLARE_FINAL_TYPE(GdsRenderGui, gds_render_gui, RENDERER, GUI, GObject);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create new GdsRenderGui Object
|
* @brief Create new GdsRenderGui Object
|
||||||
* @return
|
* @return New object
|
||||||
*/
|
*/
|
||||||
GdsRenderGui *gds_render_gui_new();
|
GdsRenderGui *gds_render_gui_new();
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ GdsRenderGui *gds_render_gui_new();
|
|||||||
*
|
*
|
||||||
* This function returns the main window of the GUI, which can later be displayed.
|
* This function returns the main window of the GUI, which can later be displayed.
|
||||||
* All handling of hte GUI is taken care of inside the GdsRenderGui Object
|
* All handling of hte GUI is taken care of inside the GdsRenderGui Object
|
||||||
* @return
|
* @return The generated main window
|
||||||
*/
|
*/
|
||||||
GtkWindow *gds_render_gui_get_main_window(GdsRenderGui *gui);
|
GtkWindow *gds_render_gui_get_main_window(GdsRenderGui *gui);
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
add_custom_target(glib-resources DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/resources.c)
|
add_custom_target(glib-resources DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/resources.c)
|
||||||
add_custom_command(DEPENDS
|
add_custom_command(DEPENDS
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/*.glade
|
${CMAKE_CURRENT_SOURCE_DIR}/*.glade
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/resources.xml
|
||||||
OUTPUT
|
OUTPUT
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/resources.c
|
${CMAKE_CURRENT_BINARY_DIR}/resources.c
|
||||||
COMMAND
|
COMMAND
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<property name="website">https://git.shimatta.de/mhu/gds-render</property>
|
<property name="website">https://git.shimatta.de/mhu/gds-render</property>
|
||||||
<property name="website_label" translatable="yes">Git Repository</property>
|
<property name="website_label" translatable="yes">Git Repository</property>
|
||||||
<property name="authors">Mario Hüttel <mario.huettel@gmx.net></property>
|
<property name="authors">Mario Hüttel <mario.huettel@gmx.net></property>
|
||||||
<property name="logo_icon_name">gds-render</property>
|
<property name="logo_icon_name"/>
|
||||||
<property name="license_type">gpl-2-0-only</property>
|
<property name="license_type">gpl-2-0-only</property>
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<placeholder/>
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="latex-radio">
|
<object class="GtkRadioButton" id="latex-radio">
|
||||||
<property name="label" translatable="yes">Generate LaTeX/TikZ output</property>
|
<property name="label" translatable="yes">Generate LaTeX/TikZ output</property>
|
||||||
<property name="use_action_appearance">True</property>
|
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
@ -32,11 +31,9 @@
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="cairo-pdf-radio">
|
<object class="GtkRadioButton" id="cairo-pdf-radio">
|
||||||
<property name="label" translatable="yes">Render PDF using Cairographics</property>
|
<property name="label" translatable="yes">Render PDF using Cairographics</property>
|
||||||
<property name="use_action_appearance">True</property>
|
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
<property name="active">True</property>
|
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
<property name="group">latex-radio</property>
|
<property name="group">latex-radio</property>
|
||||||
</object>
|
</object>
|
||||||
@ -49,11 +46,10 @@
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="cairo-svg-radio">
|
<object class="GtkRadioButton" id="cairo-svg-radio">
|
||||||
<property name="label" translatable="yes">Render SVG using Cairographics (too buggy at the moment)</property>
|
<property name="label" translatable="yes">Render SVG using Cairographics (too buggy at the moment)</property>
|
||||||
<property name="use_action_appearance">True</property>
|
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="sensitive">False</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
<property name="active">True</property>
|
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
<property name="group">latex-radio</property>
|
<property name="group">latex-radio</property>
|
||||||
</object>
|
</object>
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
<file compressed="true">about.glade</file>
|
<file compressed="true">about.glade</file>
|
||||||
<file>layer-widget.glade</file>
|
<file>layer-widget.glade</file>
|
||||||
<file>dialog.glade</file>
|
<file>dialog.glade</file>
|
||||||
|
<file compressed="true" alias="logo.svg">../icon/gds-render.svg</file>
|
||||||
</gresource>
|
</gresource>
|
||||||
</gresources>
|
</gresources>
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../gds-parser/gds-types.h"
|
#include "../gds-utils/gds-types.h"
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "../layer/layer-info.h"
|
#include "../layer/layer-info.h"
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#include "layer-selector.h"
|
#include "layer-selector.h"
|
||||||
#include "layer-info.h"
|
#include "layer-info.h"
|
||||||
#include "../gds-parser/gds-parser.h"
|
#include "../gds-utils/gds-parser.h"
|
||||||
#include "../widgets/layer-element.h"
|
#include "../widgets/layer-element.h"
|
||||||
#include "../mapping-parser.h"
|
#include "../mapping-parser.h"
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
@ -56,7 +56,9 @@ struct _LayerSelector {
|
|||||||
G_DEFINE_TYPE(LayerSelector, layer_selector, G_TYPE_OBJECT)
|
G_DEFINE_TYPE(LayerSelector, layer_selector, G_TYPE_OBJECT)
|
||||||
|
|
||||||
|
|
||||||
/* Drag and drop code */
|
/* Drag and drop code
|
||||||
|
* Original code from https://blog.gtk.org/2017/06/01/drag-and-drop-in-lists-revisited/
|
||||||
|
*/
|
||||||
|
|
||||||
static void sel_layer_element_drag_begin(GtkWidget *widget, GdkDragContext *context, gpointer data)
|
static void sel_layer_element_drag_begin(GtkWidget *widget, GdkDragContext *context, gpointer data)
|
||||||
{
|
{
|
||||||
@ -422,9 +424,10 @@ static void layer_selector_clear_widgets(LayerSelector *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check if specific layer number is present in list box
|
* @brief Check if a specific layer element with the given layer number is present in the layer selector
|
||||||
* @param layer Layer nu,ber
|
* @param self LayerSelector instance
|
||||||
* @return TRUE if present
|
* @param layer Layer number to check for
|
||||||
|
* @return TRUE if layer is present, else FALSE
|
||||||
*/
|
*/
|
||||||
static gboolean layer_selector_check_if_layer_widget_exists(LayerSelector *self, int layer) {
|
static gboolean layer_selector_check_if_layer_widget_exists(LayerSelector *self, int layer) {
|
||||||
GList *list;
|
GList *list;
|
||||||
@ -447,17 +450,30 @@ static gboolean layer_selector_check_if_layer_widget_exists(LayerSelector *self,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Setup the necessary drag and drop callbacks of layer elements.
|
||||||
|
* @param self LayerSelector instance. Used to get the DnD target entry.
|
||||||
|
* @param element LayerElement instance to set the callbacks
|
||||||
|
*/
|
||||||
static void sel_layer_element_setup_dnd_callbacks(LayerSelector *self, LayerElement *element)
|
static void sel_layer_element_setup_dnd_callbacks(LayerSelector *self, LayerElement *element)
|
||||||
{
|
{
|
||||||
layer_element_set_dnd_callbacks(element, &self->dnd_target, 1,
|
struct layer_element_dnd_data dnd_data;
|
||||||
sel_layer_element_drag_begin,
|
|
||||||
sel_layer_element_drag_data_get,
|
if (!self || !element)
|
||||||
sel_layer_element_drag_end);
|
return;
|
||||||
|
|
||||||
|
dnd_data.entries = &self->dnd_target;
|
||||||
|
dnd_data.entry_count = 1;
|
||||||
|
dnd_data.drag_end = sel_layer_element_drag_end;
|
||||||
|
dnd_data.drag_begin = sel_layer_element_drag_begin;
|
||||||
|
dnd_data.drag_data_get = sel_layer_element_drag_data_get;
|
||||||
|
|
||||||
|
layer_element_set_dnd_callbacks(element, &dnd_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Analyze \p cell and append used layers to list box
|
* @brief Analyze \p cell layers and append detected layers to layer selector \p self
|
||||||
* @param listbox listbox to add layer
|
* @param self LayerSelector instance
|
||||||
* @param cell Cell to analyze
|
* @param cell Cell to analyze
|
||||||
*/
|
*/
|
||||||
static void layer_selector_analyze_cell_layers(LayerSelector *self, struct gds_cell *cell)
|
static void layer_selector_analyze_cell_layers(LayerSelector *self, struct gds_cell *cell)
|
||||||
@ -555,8 +571,15 @@ static LayerElement *layer_selector_find_layer_element_in_list(GList *el_list, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Load file and apply layer definitions to listbox
|
* @brief Load the layer mapping from a CSV formatted file
|
||||||
* @param file_name CSV Layer Mapping File
|
*
|
||||||
|
* This function imports the layer specification from a file (see @ref lmf-spec).
|
||||||
|
* The layer ordering defined in the file is kept. All layers present in the
|
||||||
|
* current loaded library, which are not present in the layer mapping file
|
||||||
|
* are appended at the end of the layer selector list.
|
||||||
|
*
|
||||||
|
* @param self LayerSelector instance
|
||||||
|
* @param file_name File name to load from
|
||||||
*/
|
*/
|
||||||
static void layer_selector_load_layer_mapping_from_file(LayerSelector *self, gchar *file_name)
|
static void layer_selector_load_layer_mapping_from_file(LayerSelector *self, gchar *file_name)
|
||||||
{
|
{
|
||||||
@ -590,7 +613,7 @@ static void layer_selector_load_layer_mapping_from_file(LayerSelector *self, gch
|
|||||||
gtk_container_remove(GTK_CONTAINER(self->list_box), GTK_WIDGET(le));
|
gtk_container_remove(GTK_CONTAINER(self->list_box), GTK_WIDGET(le));
|
||||||
}
|
}
|
||||||
|
|
||||||
while((result = load_csv_line(dstream, &export, &name, &layer, &color)) >= 0) {
|
while((result = mapping_parser_load_line(dstream, &export, &name, &layer, &color)) >= 0) {
|
||||||
/* skip broken line */
|
/* skip broken line */
|
||||||
if (result == 1)
|
if (result == 1)
|
||||||
continue;
|
continue;
|
||||||
@ -656,9 +679,9 @@ static void layer_selector_load_mapping_clicked(GtkWidget *button, gpointer user
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Save layer mapping of whole list box into file
|
* @brief Save layer mapping of selector \p self to a file
|
||||||
* @param file_name layer mapping file
|
* @param self LayerSelector instance
|
||||||
* @param list_box listbox
|
* @param file_name File name to save to
|
||||||
*/
|
*/
|
||||||
static void layer_selector_save_layer_mapping_data(LayerSelector *self, const gchar *file_name)
|
static void layer_selector_save_layer_mapping_data(LayerSelector *self, const gchar *file_name)
|
||||||
{
|
{
|
||||||
@ -676,7 +699,7 @@ static void layer_selector_save_layer_mapping_data(LayerSelector *self, const gc
|
|||||||
for (temp = le_list; temp != NULL; temp = temp->next) {
|
for (temp = le_list; temp != NULL; temp = temp->next) {
|
||||||
/* To be sure it is a valid string */
|
/* To be sure it is a valid string */
|
||||||
workbuff[0] = 0;
|
workbuff[0] = 0;
|
||||||
create_csv_line(LAYER_ELEMENT(temp->data), workbuff, sizeof(workbuff));
|
mapping_parser_gen_csv_line(LAYER_ELEMENT(temp->data), workbuff, sizeof(workbuff));
|
||||||
fwrite(workbuff, sizeof(char), strlen(workbuff), file);
|
fwrite(workbuff, sizeof(char), strlen(workbuff), file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,39 +48,40 @@ enum layer_selector_sort_algo {LAYER_SELECTOR_SORT_DOWN = 0, LAYER_SELECTOR_SORT
|
|||||||
LayerSelector *layer_selector_new(GtkListBox *list_box);
|
LayerSelector *layer_selector_new(GtkListBox *list_box);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Generate layer widgets in \p listbox
|
* @brief Generate layer widgets in in the LayerSelector instance
|
||||||
* @note This clears all previously inserted elements
|
* @note This clears all previously inserted elements
|
||||||
* @param listbox
|
* @param selector LayerSelector instance
|
||||||
* @param libs The libraries to add
|
* @param libs The libraries to add
|
||||||
*/
|
*/
|
||||||
void layer_selector_generate_layer_widgets(LayerSelector *selector, GList *libs);
|
void layer_selector_generate_layer_widgets(LayerSelector *selector, GList *libs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Supply button for loading the layer mapping
|
* @brief Supply button for loading the layer mapping
|
||||||
* @param button
|
* @param selector LayerSelector instance
|
||||||
* @param main_window Parent window for dialogs
|
* @param button Load button. Will be referenced
|
||||||
|
* @param main_window Parent window for dialogs. Will be referenced
|
||||||
*/
|
*/
|
||||||
void layer_selector_set_load_mapping_button(LayerSelector *selector, GtkWidget *button, GtkWindow *main_window);
|
void layer_selector_set_load_mapping_button(LayerSelector *selector, GtkWidget *button, GtkWindow *main_window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Supply button for saving the layer mapping
|
* @brief Supply button for saving the layer mapping
|
||||||
* @param button
|
* @param selector LayerSelector instance
|
||||||
* @param main_window Parent window for dialogs
|
* @param button Save button. Will be refeneced
|
||||||
|
* @param main_window Parent window for dialogs. Will be referenced
|
||||||
*/
|
*/
|
||||||
void layer_selector_set_save_mapping_button(LayerSelector *selector, GtkWidget *button, GtkWindow *main_window);
|
void layer_selector_set_save_mapping_button(LayerSelector *selector, GtkWidget *button, GtkWindow *main_window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get the layer information present in the listbox of the selector
|
* @brief Get a list of all layers that shall be exported when rendering the cells
|
||||||
* @return List with layer_info elements
|
* @param selector Layer selector instance
|
||||||
|
* @return List of layer_info structures containing the layer information
|
||||||
*/
|
*/
|
||||||
GList *layer_selector_export_rendered_layer_info(LayerSelector *selector);
|
GList *layer_selector_export_rendered_layer_info(LayerSelector *selector);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Force sorting of the layer selector in a specified way
|
* @brief Force the layer selector list to be sorted according to \p sort_function
|
||||||
*
|
* @param selector LayerSelector instance
|
||||||
* If the layer selector is not yet set up, this function has no effect.
|
* @param sort_function The sorting method (up or down sorting)
|
||||||
*
|
|
||||||
* @param sort_function Sorting direction
|
|
||||||
*/
|
*/
|
||||||
void layer_selector_force_sort(LayerSelector *selector, enum layer_selector_sort_algo sort_function);
|
void layer_selector_force_sort(LayerSelector *selector, enum layer_selector_sort_algo sort_function);
|
||||||
|
|
||||||
|
16
main.c
16
main.c
@ -52,6 +52,8 @@ static void app_about(GSimpleAction *action, GVariant *parameter, gpointer user_
|
|||||||
{
|
{
|
||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
GtkDialog *dialog;
|
GtkDialog *dialog;
|
||||||
|
GdkPixbuf *logo_buf;
|
||||||
|
GError *error = NULL;
|
||||||
(void)user_data;
|
(void)user_data;
|
||||||
(void)action;
|
(void)action;
|
||||||
(void)parameter;
|
(void)parameter;
|
||||||
@ -60,6 +62,20 @@ static void app_about(GSimpleAction *action, GVariant *parameter, gpointer user_
|
|||||||
dialog = GTK_DIALOG(gtk_builder_get_object(builder, "about-dialog"));
|
dialog = GTK_DIALOG(gtk_builder_get_object(builder, "about-dialog"));
|
||||||
gtk_window_set_transient_for(GTK_WINDOW(dialog), NULL);
|
gtk_window_set_transient_for(GTK_WINDOW(dialog), NULL);
|
||||||
gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), _app_version_string);
|
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);
|
||||||
|
if (logo_buf) {
|
||||||
|
/* Set logo */
|
||||||
|
gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(dialog), logo_buf);
|
||||||
|
|
||||||
|
/* Pixbuf is now owned by about dialog. Unref */
|
||||||
|
g_object_unref(logo_buf);
|
||||||
|
} else if (error) {
|
||||||
|
fprintf(stderr, "Logo could not be displayed: %s\n", error->message);
|
||||||
|
g_error_free(error);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_dialog_run(dialog);
|
gtk_dialog_run(dialog);
|
||||||
|
|
||||||
gtk_widget_destroy(GTK_WIDGET(dialog));
|
gtk_widget_destroy(GTK_WIDGET(dialog));
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include "mapping-parser.h"
|
#include "mapping-parser.h"
|
||||||
|
|
||||||
int load_csv_line(GDataInputStream *stream, gboolean *export, char **name, int *layer, GdkRGBA *color)
|
int mapping_parser_load_line(GDataInputStream *stream, gboolean *export, char **name, int *layer, GdkRGBA *color)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
gsize len;
|
gsize len;
|
||||||
@ -94,7 +94,7 @@ ret_direct:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void create_csv_line(LayerElement *layer_element, char *line_buffer, size_t max_len)
|
void mapping_parser_gen_csv_line(LayerElement *layer_element, char *line_buffer, size_t max_len)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
GString *string;
|
GString *string;
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
* @param color RGBA color.
|
* @param color RGBA color.
|
||||||
* @return 1 if malformatted line, 0 if parsing was successful and parameters are valid, -1 if file end
|
* @return 1 if malformatted line, 0 if parsing was successful and parameters are valid, -1 if file end
|
||||||
*/
|
*/
|
||||||
int load_csv_line(GDataInputStream *stream, gboolean *export, char **name, int *layer, GdkRGBA *color);
|
int mapping_parser_load_line(GDataInputStream *stream, gboolean *export, char **name, int *layer, GdkRGBA *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create Line for LayerMapping file with supplied information
|
* @brief Create Line for LayerMapping file with supplied information
|
||||||
@ -51,7 +51,7 @@ int load_csv_line(GDataInputStream *stream, gboolean *export, char **name, int *
|
|||||||
* @param line_buffer buffer to write to
|
* @param line_buffer buffer to write to
|
||||||
* @param max_len Maximum length that cna be used in \p line_buffer
|
* @param max_len Maximum length that cna be used in \p line_buffer
|
||||||
*/
|
*/
|
||||||
void create_csv_line(LayerElement *layer_element, char *line_buffer, size_t max_len);
|
void mapping_parser_gen_csv_line(LayerElement *layer_element, char *line_buffer, size_t max_len);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "lib-cell-renderer.h"
|
#include "lib-cell-renderer.h"
|
||||||
#include "../gds-parser/gds-types.h"
|
#include "../gds-utils/gds-types.h"
|
||||||
|
|
||||||
G_DEFINE_TYPE(LibCellRenderer, lib_cell_renderer, GTK_TYPE_CELL_RENDERER_TEXT)
|
G_DEFINE_TYPE(LibCellRenderer, lib_cell_renderer, GTK_TYPE_CELL_RENDERER_TEXT)
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#include "tree-store.h"
|
#include "tree-store.h"
|
||||||
#include "lib-cell-renderer.h"
|
#include "lib-cell-renderer.h"
|
||||||
#include "../gds-parser/gds-types.h"
|
#include "../gds-utils/gds-types.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief this function olny allows cells to be selected
|
* @brief this function olny allows cells to be selected
|
||||||
@ -51,6 +51,9 @@ static gboolean tree_sel_func(GtkTreeSelection *selection,
|
|||||||
struct gds_cell *cell;
|
struct gds_cell *cell;
|
||||||
unsigned int error_level;
|
unsigned int error_level;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
(void)selection;
|
||||||
|
(void)path_currently_selected;
|
||||||
|
(void)data;
|
||||||
|
|
||||||
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, CELL_SEL_CELL_ERROR_STATE, &error_level, -1);
|
||||||
@ -112,6 +115,8 @@ exit_filter:
|
|||||||
static void change_filter(GtkWidget *entry, gpointer data)
|
static void change_filter(GtkWidget *entry, gpointer data)
|
||||||
{
|
{
|
||||||
struct tree_stores *stores = (struct tree_stores *)data;
|
struct tree_stores *stores = (struct tree_stores *)data;
|
||||||
|
(void)entry;
|
||||||
|
|
||||||
gtk_tree_model_filter_refilter(stores->filter);
|
gtk_tree_model_filter_refilter(stores->filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#define _CELL_TRIGONOMETRICS_H_
|
#define _CELL_TRIGONOMETRICS_H_
|
||||||
|
|
||||||
#include "bounding-box.h"
|
#include "bounding-box.h"
|
||||||
#include "../gds-parser/gds-types.h"
|
#include "../gds-utils/gds-types.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief calculate_cell_bounding_box Calculate bounding box of gds cell
|
* @brief calculate_cell_bounding_box Calculate bounding box of gds cell
|
||||||
|
@ -140,6 +140,7 @@ static double convert_number_to_engineering(double input, const char **out_prefi
|
|||||||
1E2, 1E3, 1E6, 1E9, 1E12, 1E15, 1E18, 1E21, 1E24};
|
1E2, 1E3, 1E6, 1E9, 1E12, 1E15, 1E18, 1E21, 1E24};
|
||||||
const int prefix_count = (int)(sizeof(prefixes)/sizeof(char *));
|
const int prefix_count = (int)(sizeof(prefixes)/sizeof(char *));
|
||||||
|
|
||||||
|
/* Start with the 2nd smallest prefix */
|
||||||
for (idx = 1; idx < prefix_count; idx++) {
|
for (idx = 1; idx < prefix_count; idx++) {
|
||||||
if (input < scale[idx]) {
|
if (input < scale[idx]) {
|
||||||
/* This prefix is bigger than the number. Take the previous one */
|
/* This prefix is bigger than the number. Take the previous one */
|
||||||
@ -212,7 +213,7 @@ static void renderer_settings_dialog_init(RendererSettingsDialog *self)
|
|||||||
GtkWidget *box;
|
GtkWidget *box;
|
||||||
GtkDialog *dialog;
|
GtkDialog *dialog;
|
||||||
|
|
||||||
dialog = &(self->parent);
|
dialog = &self->parent;
|
||||||
|
|
||||||
builder = gtk_builder_new_from_resource("/dialog.glade");
|
builder = gtk_builder_new_from_resource("/dialog.glade");
|
||||||
box = GTK_WIDGET(gtk_builder_get_object(builder, "dialog-box"));
|
box = GTK_WIDGET(gtk_builder_get_object(builder, "dialog-box"));
|
||||||
@ -260,10 +261,7 @@ RendererSettingsDialog *renderer_settings_dialog_new(GtkWindow *parent)
|
|||||||
|
|
||||||
void renderer_settings_dialog_get_settings(RendererSettingsDialog *dialog, struct render_settings *settings)
|
void renderer_settings_dialog_get_settings(RendererSettingsDialog *dialog, struct render_settings *settings)
|
||||||
{
|
{
|
||||||
/*GList *radio_buttons;
|
|
||||||
*GList *temp_button_list;
|
|
||||||
*GtkToggleButton *temp_button = NULL;
|
|
||||||
*/
|
|
||||||
if (!settings || !dialog)
|
if (!settings || !dialog)
|
||||||
return;
|
return;
|
||||||
settings->scale = gtk_range_get_value(GTK_RANGE(dialog->scale));
|
settings->scale = gtk_range_get_value(GTK_RANGE(dialog->scale));
|
||||||
|
@ -120,26 +120,29 @@ void layer_element_get_color(LayerElement *elem, GdkRGBA *rgba)
|
|||||||
{
|
{
|
||||||
if (!rgba)
|
if (!rgba)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(elem->priv.color), rgba);
|
gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(elem->priv.color), rgba);
|
||||||
}
|
}
|
||||||
|
|
||||||
void layer_element_set_color(LayerElement *elem, GdkRGBA *rgba)
|
void layer_element_set_color(LayerElement *elem, GdkRGBA *rgba)
|
||||||
{
|
{
|
||||||
|
if (!elem || !rgba)
|
||||||
|
return;
|
||||||
|
|
||||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(elem->priv.color), rgba);
|
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(elem->priv.color), rgba);
|
||||||
}
|
}
|
||||||
|
|
||||||
void layer_element_set_dnd_callbacks(LayerElement *elem, GtkTargetEntry *entries, int entry_count,
|
void layer_element_set_dnd_callbacks(LayerElement *elem, struct layer_element_dnd_data *data)
|
||||||
void (*drag_begin)(GtkWidget *, GdkDragContext *, gpointer),
|
|
||||||
void (*drag_data_get)(GtkWidget *, GdkDragContext *,
|
|
||||||
GtkSelectionData *, guint , guint, gpointer),
|
|
||||||
void (*drag_end)(GtkWidget *, GdkDragContext *, gpointer))
|
|
||||||
{
|
{
|
||||||
|
if (!elem || !data)
|
||||||
|
return;
|
||||||
|
|
||||||
/* Setup drag and drop */
|
/* Setup drag and drop */
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context(GTK_WIDGET(elem)), "row");
|
gtk_style_context_add_class (gtk_widget_get_style_context(GTK_WIDGET(elem)), "row");
|
||||||
gtk_drag_source_set(GTK_WIDGET(elem->priv.event_handle), GDK_BUTTON1_MASK, entries, entry_count, GDK_ACTION_MOVE);
|
gtk_drag_source_set(GTK_WIDGET(elem->priv.event_handle), GDK_BUTTON1_MASK, data->entries, data->entry_count, GDK_ACTION_MOVE);
|
||||||
g_signal_connect(elem->priv.event_handle, "drag-begin", G_CALLBACK(drag_begin), NULL);
|
g_signal_connect(elem->priv.event_handle, "drag-begin", G_CALLBACK(data->drag_begin), NULL);
|
||||||
g_signal_connect(elem->priv.event_handle, "drag-data-get", G_CALLBACK(drag_data_get), NULL);
|
g_signal_connect(elem->priv.event_handle, "drag-data-get", G_CALLBACK(data->drag_data_get), NULL);
|
||||||
g_signal_connect(elem->priv.event_handle, "drag-end", G_CALLBACK(drag_end), NULL);
|
g_signal_connect(elem->priv.event_handle, "drag-end", G_CALLBACK(data->drag_end), NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +56,22 @@ struct _LayerElement {
|
|||||||
LayerElementPriv priv;
|
LayerElementPriv priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This structure holds the necessary data to set up a LayerElement for Drag'n'Drop
|
||||||
|
*/
|
||||||
|
struct layer_element_dnd_data {
|
||||||
|
/** @brief Array of target entries for the DnD operation */
|
||||||
|
GtkTargetEntry *entries;
|
||||||
|
/** @brief Count of elements in layer_element_dnd_data::entries array */
|
||||||
|
int entry_count;
|
||||||
|
/** @brief Callback function for drag_begin event */
|
||||||
|
void (*drag_begin)(GtkWidget *, GdkDragContext *, gpointer);
|
||||||
|
/** @brief Callback fucktion for data_get event */
|
||||||
|
void (*drag_data_get)(GtkWidget *, GdkDragContext *, GtkSelectionData *, guint, guint, gpointer);
|
||||||
|
/** @brief Callback function for drag_end event */
|
||||||
|
void (*drag_end)(GtkWidget *, GdkDragContext *, gpointer);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create new layer element object
|
* @brief Create new layer element object
|
||||||
* @return new object
|
* @return new object
|
||||||
@ -119,16 +135,11 @@ void layer_element_get_color(LayerElement *elem, GdkRGBA *rgba);
|
|||||||
void layer_element_set_color(LayerElement *elem, GdkRGBA *rgba);
|
void layer_element_set_color(LayerElement *elem, GdkRGBA *rgba);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief layer_element_set_dnd_callbacks
|
* @brief Setup drag and drop of \p elem for use in the LayerSelector
|
||||||
* @param elem
|
* @param elem Layer element to set up
|
||||||
* @param entries
|
* @param data Data array containing the necessary callbacks etc. for drag and drop.
|
||||||
* @param entry_count
|
|
||||||
*/
|
*/
|
||||||
void layer_element_set_dnd_callbacks(LayerElement *elem, GtkTargetEntry *entries, int entry_count,
|
void layer_element_set_dnd_callbacks(LayerElement *elem, struct layer_element_dnd_data *data);
|
||||||
void (*drag_begin)(GtkWidget *, GdkDragContext *, gpointer),
|
|
||||||
void (*drag_data_get)(GtkWidget *, GdkDragContext *,
|
|
||||||
GtkSelectionData *, guint , guint, gpointer),
|
|
||||||
void (*drag_end)(GtkWidget *, GdkDragContext *, gpointer));
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user