Compare commits
8 Commits
a4f9be1ef4
...
85f037ce59
Author | SHA1 | Date | |
---|---|---|---|
85f037ce59 | |||
92506485e0 | |||
3ec91ab322 | |||
a38946b803 | |||
943e924337 | |||
e0f2e7d605 | |||
bd64e13d87 | |||
0123385b40 |
@ -41,14 +41,13 @@
|
|||||||
|
|
||||||
static int string_array_count(char **string_array)
|
static int string_array_count(char **string_array)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count;
|
||||||
|
|
||||||
if (!string_array)
|
if (!string_array)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (; *string_array; string_array++) {
|
for (count = 0; *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-output.h>
|
#include <gds-render/output-renderers/latex-renderer.h>
|
||||||
//#include <gds-render/output-renderers/cairo-output.h>
|
#include <gds-render/output-renderers/cairo-renderer.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,9 +266,7 @@ 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;
|
||||||
@ -277,6 +275,8 @@ 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_list = layer_selector_export_rendered_layer_info(self->layer_selector);
|
layer_settings = 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,31 +359,35 @@ static void on_convert_clicked(gpointer button, gpointer user)
|
|||||||
|
|
||||||
switch (sett->renderer) {
|
switch (sett->renderer) {
|
||||||
case RENDERER_LATEX_TIKZ:
|
case RENDERER_LATEX_TIKZ:
|
||||||
output_file = fopen(file_name, "w");
|
render_engine =
|
||||||
/*latex_render_cell_to_code(cell_to_render, layer_list, output_file, sett->scale,
|
GDS_RENDER_OUTPUT_RENDERER(latex_renderer_new_with_options(sett->tex_pdf_layers,
|
||||||
sett->tex_pdf_layers, sett->tex_standalone);
|
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:
|
||||||
/*cairo_render_cell_to_vector_file(cell_to_render, layer_list,
|
render_engine = GDS_RENDER_OUTPUT_RENDERER(cairo_renderer_new_pdf());
|
||||||
(sett->renderer == RENDERER_CAIROGRAPHICS_PDF
|
break;
|
||||||
? 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 /* _GDSPARSE_H_ */
|
#endif /* _GDSPARSER_H_ */
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#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
|
||||||
|
|
||||||
@ -80,9 +81,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 List of layer_info structures containing the layer information
|
* @return LayerSettings containing the layer information
|
||||||
*/
|
*/
|
||||||
GList *layer_selector_export_rendered_layer_info(LayerSelector *selector);
|
LayerSettings *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,38 +371,39 @@ LayerSelector *layer_selector_new(GtkListBox *list_box)
|
|||||||
return selector;
|
return selector;
|
||||||
}
|
}
|
||||||
|
|
||||||
GList *layer_selector_export_rendered_layer_info(LayerSelector *selector)
|
LayerSettings *layer_selector_export_rendered_layer_info(LayerSelector *selector)
|
||||||
{
|
{
|
||||||
GList *info_list = NULL;
|
LayerSettings *layer_settings;
|
||||||
LayerElement *le;
|
struct layer_info linfo;
|
||||||
struct layer_info *linfo;
|
|
||||||
GList *row_list;
|
GList *row_list;
|
||||||
GList *temp;
|
GList *iterator;
|
||||||
|
LayerElement *le;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!selector)
|
layer_settings = layer_settings_new();
|
||||||
|
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));
|
||||||
|
|
||||||
/* Iterate through widgets and add layers that shall be exported */
|
for (i = 0,iterator = row_list; iterator != NULL; iterator = g_list_next(iterator), i++) {
|
||||||
for (i = 0, temp = row_list; temp != NULL; temp = temp->next, i++) {
|
le = LAYER_ELEMENT(iterator->data);
|
||||||
|
|
||||||
le = LAYER_ELEMENT(temp->data);
|
/* Get name from layer element. This must not be freed */
|
||||||
|
linfo.name =(char *)layer_element_get_name(le);
|
||||||
|
|
||||||
if (layer_element_get_export(le) == TRUE) {
|
layer_element_get_color(le, &linfo.color);
|
||||||
/* Allocate new info and fill with info */
|
linfo.render = (layer_element_get_export(le) ? 1 : 0);
|
||||||
linfo = (struct layer_info *)malloc(sizeof(struct layer_info));
|
linfo.stacked_position = i;
|
||||||
layer_element_get_color(le, &linfo->color);
|
linfo.layer = layer_element_get_layer(le);
|
||||||
linfo->layer = layer_element_get_layer(le);
|
|
||||||
linfo->name = (char *)layer_element_get_name(le);
|
|
||||||
|
|
||||||
/* Append to list */
|
/* This function copies the entire layer info struct including the name string.
|
||||||
info_list = g_list_append(info_list, (gpointer)linfo);
|
* Therefore, using the same layer_info struct over and over is safe.
|
||||||
}
|
*/
|
||||||
|
layer_settings_append_layer_info(layer_settings, &linfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
return info_list;
|
return layer_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void layer_selector_clear_widgets(LayerSelector *self)
|
static void layer_selector_clear_widgets(LayerSelector *self)
|
||||||
|
@ -220,7 +220,10 @@ 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) {
|
||||||
@ -239,7 +242,11 @@ 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 && linfo->render) {
|
if (linfo->layer < MAX_LAYERS) {
|
||||||
|
/* 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