Compare commits
No commits in common. "85f037ce59d88a6eab9fed2371d6daeae45c4f9e" and "a4f9be1ef4d135e111b008d019a0efa1152981eb" have entirely different histories.
85f037ce59
...
a4f9be1ef4
@ -41,13 +41,14 @@
|
|||||||
|
|
||||||
static int string_array_count(char **string_array)
|
static int string_array_count(char **string_array)
|
||||||
{
|
{
|
||||||
int count;
|
int count = 0;
|
||||||
|
|
||||||
if (!string_array)
|
if (!string_array)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (count = 0; *string_array; string_array++)
|
for (; *string_array; string_array++) {
|
||||||
count++;
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,8 @@
|
|||||||
#include <gds-render/widgets/activity-bar.h>
|
#include <gds-render/widgets/activity-bar.h>
|
||||||
#include <gds-render/cell-selector/tree-store.h>
|
#include <gds-render/cell-selector/tree-store.h>
|
||||||
#include <gds-render/cell-selector/lib-cell-renderer.h>
|
#include <gds-render/cell-selector/lib-cell-renderer.h>
|
||||||
#include <gds-render/output-renderers/latex-renderer.h>
|
//#include <gds-render/output-renderers/latex-output.h>
|
||||||
#include <gds-render/output-renderers/cairo-renderer.h>
|
//#include <gds-render/output-renderers/cairo-output.h>
|
||||||
#include <gds-render/widgets/conv-settings-dialog.h>
|
#include <gds-render/widgets/conv-settings-dialog.h>
|
||||||
#include <gds-render/geometric/cell-geometrics.h>
|
#include <gds-render/geometric/cell-geometrics.h>
|
||||||
#include <gds-render/version.h>
|
#include <gds-render/version.h>
|
||||||
@ -266,7 +266,9 @@ static void on_convert_clicked(gpointer button, gpointer user)
|
|||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
|
GList *layer_list;
|
||||||
struct gds_cell *cell_to_render;
|
struct gds_cell *cell_to_render;
|
||||||
|
FILE *output_file;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
RendererSettingsDialog *settings;
|
RendererSettingsDialog *settings;
|
||||||
GtkFileFilter *filter;
|
GtkFileFilter *filter;
|
||||||
@ -275,8 +277,6 @@ static void on_convert_clicked(gpointer button, gpointer user)
|
|||||||
union bounding_box cell_box;
|
union bounding_box cell_box;
|
||||||
unsigned int height, width;
|
unsigned int height, width;
|
||||||
struct render_settings *sett;
|
struct render_settings *sett;
|
||||||
LayerSettings *layer_settings;
|
|
||||||
GdsOutputRenderer *render_engine;
|
|
||||||
|
|
||||||
self = RENDERER_GUI(user);
|
self = RENDERER_GUI(user);
|
||||||
|
|
||||||
@ -296,7 +296,7 @@ static void on_convert_clicked(gpointer button, gpointer user)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* Get layers that are rendered */
|
/* Get layers that are rendered */
|
||||||
layer_settings = layer_selector_export_rendered_layer_info(self->layer_selector);
|
//layer_list = layer_selector_export_rendered_layer_info(self->layer_selector);
|
||||||
|
|
||||||
/* Calculate cell size in DB units */
|
/* Calculate cell size in DB units */
|
||||||
bounding_box_prepare_empty(&cell_box);
|
bounding_box_prepare_empty(&cell_box);
|
||||||
@ -359,35 +359,31 @@ static void on_convert_clicked(gpointer button, gpointer user)
|
|||||||
|
|
||||||
switch (sett->renderer) {
|
switch (sett->renderer) {
|
||||||
case RENDERER_LATEX_TIKZ:
|
case RENDERER_LATEX_TIKZ:
|
||||||
render_engine =
|
output_file = fopen(file_name, "w");
|
||||||
GDS_RENDER_OUTPUT_RENDERER(latex_renderer_new_with_options(sett->tex_pdf_layers,
|
/*latex_render_cell_to_code(cell_to_render, layer_list, output_file, sett->scale,
|
||||||
sett->tex_standalone));
|
sett->tex_pdf_layers, sett->tex_standalone);
|
||||||
|
*/fclose(output_file);
|
||||||
break;
|
break;
|
||||||
case RENDERER_CAIROGRAPHICS_SVG:
|
case RENDERER_CAIROGRAPHICS_SVG:
|
||||||
render_engine = GDS_RENDER_OUTPUT_RENDERER(cairo_renderer_new_svg());
|
|
||||||
break;
|
|
||||||
case RENDERER_CAIROGRAPHICS_PDF:
|
case RENDERER_CAIROGRAPHICS_PDF:
|
||||||
render_engine = GDS_RENDER_OUTPUT_RENDERER(cairo_renderer_new_pdf());
|
/*cairo_render_cell_to_vector_file(cell_to_render, layer_list,
|
||||||
break;
|
(sett->renderer == RENDERER_CAIROGRAPHICS_PDF
|
||||||
|
? file_name
|
||||||
|
: NULL),
|
||||||
|
(sett->renderer == RENDERER_CAIROGRAPHICS_SVG
|
||||||
|
? file_name
|
||||||
|
: NULL),
|
||||||
|
sett->scale);
|
||||||
|
*/break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (render_engine) {
|
|
||||||
gds_output_renderer_set_output_file(render_engine, file_name);
|
|
||||||
gds_output_renderer_set_layer_settings(render_engine, layer_settings);
|
|
||||||
|
|
||||||
/* TODO: Replace this with asynchronous rendering. However, this fixes issue #19 */
|
|
||||||
gds_output_renderer_render_output(render_engine, cell_to_render, sett->scale);
|
|
||||||
|
|
||||||
g_object_unref(render_engine);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free(file_name);
|
g_free(file_name);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
gtk_widget_destroy(dialog);
|
gtk_widget_destroy(dialog);
|
||||||
}
|
}
|
||||||
ret_layer_destroy:
|
ret_layer_destroy:
|
||||||
g_object_unref(layer_settings);
|
;
|
||||||
|
// g_list_free_full(layer_list, (GDestroyNotify)layer_info_delete_struct);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,14 +23,14 @@
|
|||||||
* @author Mario Hüttel <mario.huettel@gmx.net>
|
* @author Mario Hüttel <mario.huettel@gmx.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _GDSPARSER_H_
|
|
||||||
#define _GDSPARSER_H_
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup GDS-Utilities
|
* @addtogroup GDS-Utilities
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef _GDSPARSER_H_
|
||||||
|
#define _GDSPARSER_H_
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include <gds-render/gds-utils/gds-types.h>
|
#include <gds-render/gds-utils/gds-types.h>
|
||||||
@ -61,4 +61,4 @@ int clear_lib_list(GList **library_list);
|
|||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
#endif /* _GDSPARSER_H_ */
|
#endif /* _GDSPARSE_H_ */
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <gds-render/layer/color-palette.h>
|
#include <gds-render/layer/color-palette.h>
|
||||||
#include <gds-render/layer/layer-info.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
@ -81,9 +80,9 @@ void layer_selector_set_save_mapping_button(LayerSelector *selector, GtkWidget *
|
|||||||
/**
|
/**
|
||||||
* @brief Get a list of all layers that shall be exported when rendering the cells
|
* @brief Get a list of all layers that shall be exported when rendering the cells
|
||||||
* @param selector Layer selector instance
|
* @param selector Layer selector instance
|
||||||
* @return LayerSettings containing the layer information
|
* @return List of layer_info structures containing the layer information
|
||||||
*/
|
*/
|
||||||
LayerSettings *layer_selector_export_rendered_layer_info(LayerSelector *selector);
|
GList *layer_selector_export_rendered_layer_info(LayerSelector *selector);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Force the layer selector list to be sorted according to \p sort_function
|
* @brief Force the layer selector list to be sorted according to \p sort_function
|
||||||
|
@ -371,39 +371,38 @@ LayerSelector *layer_selector_new(GtkListBox *list_box)
|
|||||||
return selector;
|
return selector;
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerSettings *layer_selector_export_rendered_layer_info(LayerSelector *selector)
|
GList *layer_selector_export_rendered_layer_info(LayerSelector *selector)
|
||||||
{
|
{
|
||||||
LayerSettings *layer_settings;
|
GList *info_list = NULL;
|
||||||
struct layer_info linfo;
|
|
||||||
GList *row_list;
|
|
||||||
GList *iterator;
|
|
||||||
LayerElement *le;
|
LayerElement *le;
|
||||||
|
struct layer_info *linfo;
|
||||||
|
GList *row_list;
|
||||||
|
GList *temp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
layer_settings = layer_settings_new();
|
if (!selector)
|
||||||
if (!layer_settings)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
row_list = gtk_container_get_children(GTK_CONTAINER(selector->list_box));
|
row_list = gtk_container_get_children(GTK_CONTAINER(selector->list_box));
|
||||||
|
|
||||||
for (i = 0,iterator = row_list; iterator != NULL; iterator = g_list_next(iterator), i++) {
|
/* Iterate through widgets and add layers that shall be exported */
|
||||||
le = LAYER_ELEMENT(iterator->data);
|
for (i = 0, temp = row_list; temp != NULL; temp = temp->next, i++) {
|
||||||
|
|
||||||
/* Get name from layer element. This must not be freed */
|
le = LAYER_ELEMENT(temp->data);
|
||||||
linfo.name =(char *)layer_element_get_name(le);
|
|
||||||
|
|
||||||
layer_element_get_color(le, &linfo.color);
|
if (layer_element_get_export(le) == TRUE) {
|
||||||
linfo.render = (layer_element_get_export(le) ? 1 : 0);
|
/* Allocate new info and fill with info */
|
||||||
linfo.stacked_position = i;
|
linfo = (struct layer_info *)malloc(sizeof(struct layer_info));
|
||||||
linfo.layer = layer_element_get_layer(le);
|
layer_element_get_color(le, &linfo->color);
|
||||||
|
linfo->layer = layer_element_get_layer(le);
|
||||||
|
linfo->name = (char *)layer_element_get_name(le);
|
||||||
|
|
||||||
/* This function copies the entire layer info struct including the name string.
|
/* Append to list */
|
||||||
* Therefore, using the same layer_info struct over and over is safe.
|
info_list = g_list_append(info_list, (gpointer)linfo);
|
||||||
*/
|
}
|
||||||
layer_settings_append_layer_info(layer_settings, &linfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return layer_settings;
|
return info_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void layer_selector_clear_widgets(LayerSelector *self)
|
static void layer_selector_clear_widgets(LayerSelector *self)
|
||||||
|
@ -220,10 +220,7 @@ static int cairo_renderer_render_cell_to_vector_file(struct gds_cell *cell, GLis
|
|||||||
*
|
*
|
||||||
* And by the way: This now bricks all Windows compatibility. Deal with it.
|
* And by the way: This now bricks all Windows compatibility. Deal with it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Use fork for production code and -1 as value for debugging */
|
|
||||||
process_id = fork();
|
process_id = fork();
|
||||||
//process_id = -1;
|
|
||||||
if (process_id < 0) {
|
if (process_id < 0) {
|
||||||
/* Well... shit... We have to run it in our process. */
|
/* Well... shit... We have to run it in our process. */
|
||||||
} else if (process_id > 0) {
|
} else if (process_id > 0) {
|
||||||
@ -242,11 +239,7 @@ static int cairo_renderer_render_cell_to_vector_file(struct gds_cell *cell, GLis
|
|||||||
/* Create recording surface for each layer */
|
/* Create recording surface for each layer */
|
||||||
for (info_list = layer_infos; info_list != NULL; info_list = g_list_next(info_list)) {
|
for (info_list = layer_infos; info_list != NULL; info_list = g_list_next(info_list)) {
|
||||||
linfo = (struct layer_info *)info_list->data;
|
linfo = (struct layer_info *)info_list->data;
|
||||||
if (linfo->layer < MAX_LAYERS) {
|
if (linfo->layer < MAX_LAYERS && linfo->render) {
|
||||||
/* Layer shall not be rendered */
|
|
||||||
if (!linfo->render)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
lay = &(layers[(unsigned int)linfo->layer]);
|
lay = &(layers[(unsigned int)linfo->layer]);
|
||||||
lay->linfo = linfo;
|
lay->linfo = linfo;
|
||||||
lay->rec = cairo_recording_surface_create(CAIRO_CONTENT_COLOR_ALPHA,
|
lay->rec = cairo_recording_surface_create(CAIRO_CONTENT_COLOR_ALPHA,
|
||||||
|
@ -260,7 +260,7 @@ void gds_output_renderer_set_layer_settings(GdsOutputRenderer *renderer, LayerSe
|
|||||||
{
|
{
|
||||||
g_return_if_fail(GDS_RENDER_IS_LAYER_SETTINGS(settings));
|
g_return_if_fail(GDS_RENDER_IS_LAYER_SETTINGS(settings));
|
||||||
|
|
||||||
g_object_set(renderer, "layer-settings", settings, NULL);
|
g_object_set(renderer, "layer_settings", settings, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int gds_output_renderer_render_output(GdsOutputRenderer *renderer, struct gds_cell *cell, double scale)
|
int gds_output_renderer_render_output(GdsOutputRenderer *renderer, struct gds_cell *cell, double scale)
|
||||||
|
Loading…
Reference in New Issue
Block a user