Compare commits
14 Commits
dac834aef2
...
4c5784c3a4
Author | SHA1 | Date | |
---|---|---|---|
4c5784c3a4 | |||
f765e27ce8 | |||
40760725b8 | |||
d4f2d6798e | |||
59ec0c5a10 | |||
2a615367d7 | |||
3167da4648 | |||
b72466957c | |||
d9f0f3cdd5 | |||
4c04ce3614 | |||
a2bc980c64 | |||
73ea4d6838 | |||
526785cffd | |||
6a8b359f3d |
@ -13,10 +13,11 @@ link_directories(${GLIB_LINK_DIRS} ${GTK3_LINK_DIRS} ${CAIRO_LINK_DIRS})
|
|||||||
add_definitions(${GLIB2_CFLAGS_OTHER})
|
add_definitions(${GLIB2_CFLAGS_OTHER})
|
||||||
|
|
||||||
|
|
||||||
aux_source_directory("layer-widget" 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-parser" PARSER_SOURCES)
|
||||||
aux_source_directory("latex-output" LATEX_SOURCES)
|
aux_source_directory("latex-output" LATEX_SOURCES)
|
||||||
|
aux_source_directory("cairo-output" CAIRO_SOURCES)
|
||||||
set(SOURCE "main.c" "layer-selector.c")
|
set(SOURCE "main.c" "layer-selector.c")
|
||||||
|
|
||||||
|
|
||||||
@ -26,6 +27,7 @@ set(SOURCE
|
|||||||
${RENDERER_SOURCES}
|
${RENDERER_SOURCES}
|
||||||
${PARSER_SOURCES}
|
${PARSER_SOURCES}
|
||||||
${LATEX_SOURCES}
|
${LATEX_SOURCES}
|
||||||
|
${CAIRO_SOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_compile_options(-Wall)
|
add_compile_options(-Wall)
|
||||||
|
248
cairo-output/cairo-output.c
Normal file
248
cairo-output/cairo-output.c
Normal file
@ -0,0 +1,248 @@
|
|||||||
|
/*
|
||||||
|
* GDSII-Converter
|
||||||
|
* Copyright (C) 2018 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "cairo-output.h"
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <cairo.h>
|
||||||
|
#include <cairo-pdf.h>
|
||||||
|
|
||||||
|
struct cairo_layer {
|
||||||
|
cairo_t *cr;
|
||||||
|
cairo_surface_t *rec;
|
||||||
|
struct layer_info *linfo;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void revert_inherited_transform(struct cairo_layer *layers)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < MAX_LAYERS; i++) {
|
||||||
|
if (layers[i].cr == NULL)
|
||||||
|
continue;
|
||||||
|
cairo_restore(layers[i].cr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void apply_inherited_transform_to_all_layers(struct cairo_layer *layers,
|
||||||
|
const struct gds_point *origin,
|
||||||
|
double magnification,
|
||||||
|
gboolean flipping,
|
||||||
|
double rotation,
|
||||||
|
double scale)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
cairo_t *temp_layer_cr;
|
||||||
|
|
||||||
|
for (i = 0; i < MAX_LAYERS; i++) {
|
||||||
|
temp_layer_cr = layers[i].cr;
|
||||||
|
if (temp_layer_cr == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Save the state and apply transformation */
|
||||||
|
cairo_save(temp_layer_cr);
|
||||||
|
cairo_translate(temp_layer_cr, (double)origin->x/scale, (double)origin->y/scale);
|
||||||
|
cairo_rotate(temp_layer_cr, M_PI*rotation/180.0);
|
||||||
|
cairo_scale(temp_layer_cr, magnification,
|
||||||
|
(flipping == TRUE ? -magnification : magnification));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void render_cell(struct gds_cell *cell, struct cairo_layer *layers, double scale)
|
||||||
|
{
|
||||||
|
GList *instance_list;
|
||||||
|
struct gds_cell *temp_cell;
|
||||||
|
struct gds_cell_instance *cell_instance;
|
||||||
|
GList *gfx_list;
|
||||||
|
struct gds_graphics *gfx;
|
||||||
|
GList *vertex_list;
|
||||||
|
struct gds_point *vertex;
|
||||||
|
cairo_t *cr;
|
||||||
|
|
||||||
|
/* Render child cells */
|
||||||
|
for (instance_list = cell->child_cells; instance_list != NULL; instance_list = instance_list->next) {
|
||||||
|
cell_instance = (struct gds_cell_instance *)instance_list->data;
|
||||||
|
if ((temp_cell = cell_instance->cell_ref) != NULL) {
|
||||||
|
apply_inherited_transform_to_all_layers(layers,
|
||||||
|
&cell_instance->origin,
|
||||||
|
cell_instance->magnification,
|
||||||
|
cell_instance->flipped,
|
||||||
|
cell_instance->angle,
|
||||||
|
scale);
|
||||||
|
render_cell(temp_cell, layers, scale);
|
||||||
|
revert_inherited_transform(layers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Render graphics */
|
||||||
|
for (gfx_list = cell->graphic_objs; gfx_list != NULL; gfx_list = gfx_list->next) {
|
||||||
|
gfx = (struct gds_graphics *)gfx_list->data;
|
||||||
|
|
||||||
|
/* Get layer renderer */
|
||||||
|
if (gfx->layer >= MAX_LAYERS)
|
||||||
|
continue;
|
||||||
|
if ((cr = layers[gfx->layer].cr) == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Apply settings */
|
||||||
|
cairo_set_line_width(cr, (gfx->width_absolute ? gfx->width_absolute/scale : 1));
|
||||||
|
|
||||||
|
switch (gfx->path_render_type) {
|
||||||
|
case PATH_FLUSH:
|
||||||
|
cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
|
||||||
|
break;
|
||||||
|
case PATH_ROUNDED:
|
||||||
|
cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
|
||||||
|
break;
|
||||||
|
case PATH_SQUARED:
|
||||||
|
cairo_set_line_cap(cr, CAIRO_LINE_CAP_SQUARE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add vertices */
|
||||||
|
for (vertex_list = gfx->vertices; vertex_list != NULL; vertex_list = vertex_list->next) {
|
||||||
|
vertex = (struct gds_point *)vertex_list->data;
|
||||||
|
|
||||||
|
/* If first point -> move to, else line to */
|
||||||
|
if (vertex_list->prev == NULL)
|
||||||
|
cairo_move_to(cr, vertex->x/scale, vertex->y/scale);
|
||||||
|
else
|
||||||
|
cairo_line_to(cr, vertex->x/scale, vertex->y/scale);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create graphics object */
|
||||||
|
switch (gfx->gfx_type) {
|
||||||
|
case GRAPHIC_PATH:
|
||||||
|
cairo_stroke(cr);
|
||||||
|
break;
|
||||||
|
case GRAPHIC_BOX:
|
||||||
|
case GRAPHIC_POLYGON:
|
||||||
|
cairo_set_line_width(cr, 0.1/scale);
|
||||||
|
cairo_close_path(cr);
|
||||||
|
cairo_stroke_preserve(cr); // Prevent graphic glitches
|
||||||
|
cairo_fill(cr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void cairo_render_cell_to_pdf(struct gds_cell *cell, GList *layer_infos, char *pdf_file, double scale)
|
||||||
|
{
|
||||||
|
cairo_surface_t *pdf_surface;
|
||||||
|
cairo_t *pdf_cr;
|
||||||
|
struct layer_info *linfo;
|
||||||
|
struct cairo_layer *layers;
|
||||||
|
struct cairo_layer *lay;
|
||||||
|
GList *info_list;
|
||||||
|
int i;
|
||||||
|
double rec_x0, rec_y0, rec_width, rec_height;
|
||||||
|
double xmin = INT32_MAX, xmax = INT32_MIN, ymin = INT32_MAX, ymax = INT32_MIN;
|
||||||
|
|
||||||
|
layers = (struct cairo_layer *)calloc(MAX_LAYERS, sizeof(struct cairo_layer));
|
||||||
|
|
||||||
|
/* Clear layers */
|
||||||
|
for (i = 0; i < MAX_LAYERS; i++) {
|
||||||
|
layers[i].cr = NULL;
|
||||||
|
layers[i].rec = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create recording surface for each layer */
|
||||||
|
for (info_list = layer_infos; info_list != NULL; info_list = g_list_next(info_list)) {
|
||||||
|
linfo = (struct layer_info *)info_list->data;
|
||||||
|
if (linfo->layer < MAX_LAYERS) {
|
||||||
|
lay = &(layers[(unsigned int)linfo->layer]);
|
||||||
|
lay->linfo = linfo;
|
||||||
|
lay->rec = cairo_recording_surface_create(CAIRO_CONTENT_COLOR_ALPHA,
|
||||||
|
NULL);
|
||||||
|
lay->cr = cairo_create(layers[(unsigned int)linfo->layer].rec);
|
||||||
|
cairo_scale(lay->cr, 1, -1); // Fix coordinate system
|
||||||
|
cairo_set_source_rgb(lay->cr, linfo->color.red, linfo->color.green, linfo->color.blue);
|
||||||
|
} else {
|
||||||
|
printf("Layer number (%d) too high!\n", linfo->layer);
|
||||||
|
goto ret_clear_layers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render_cell(cell, layers, scale);
|
||||||
|
|
||||||
|
/* get size of image and top left coordinate */
|
||||||
|
for (info_list = layer_infos; info_list != NULL; info_list = g_list_next(info_list)) {
|
||||||
|
linfo = (struct layer_info *)info_list->data;
|
||||||
|
|
||||||
|
if (linfo->layer >= MAX_LAYERS) {
|
||||||
|
printf("Layer outside of Spec.\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Print size */
|
||||||
|
cairo_recording_surface_ink_extents(layers[linfo->layer].rec, &rec_x0, &rec_y0,
|
||||||
|
&rec_width, &rec_height);
|
||||||
|
printf("Size of layer %d: %lf -- %lf\n", linfo->layer,
|
||||||
|
rec_width, rec_height);
|
||||||
|
|
||||||
|
/* update bounding box */
|
||||||
|
xmin = MIN(xmin, rec_x0);
|
||||||
|
xmax = MAX(xmax, rec_x0);
|
||||||
|
ymin = MIN(ymin, rec_y0);
|
||||||
|
ymax = MAX(ymax, rec_y0);
|
||||||
|
xmin = MIN(xmin, rec_x0+rec_width);
|
||||||
|
xmax = MAX(xmax, rec_x0+rec_width);
|
||||||
|
ymin = MIN(ymin, rec_y0+rec_height);
|
||||||
|
ymax = MAX(ymax, rec_y0+rec_height);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Bounding box: (%lf,%lf) -- (%lf,%lf)\n", xmin, ymin, xmax, ymax);
|
||||||
|
|
||||||
|
pdf_surface = cairo_pdf_surface_create(pdf_file, xmax-xmin, ymax-ymin);
|
||||||
|
pdf_cr = cairo_create(pdf_surface);
|
||||||
|
|
||||||
|
/* Write layers to PDF */
|
||||||
|
for (info_list = layer_infos; info_list != NULL; info_list = g_list_next(info_list)) {
|
||||||
|
linfo = (struct layer_info *)info_list->data;
|
||||||
|
|
||||||
|
if (linfo->layer >= MAX_LAYERS) {
|
||||||
|
printf("Layer outside of Spec.\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
cairo_set_source_surface(pdf_cr, layers[linfo->layer].rec, -xmin, -ymin);
|
||||||
|
cairo_paint_with_alpha(pdf_cr, linfo->color.alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
cairo_show_page(pdf_cr);
|
||||||
|
cairo_destroy(pdf_cr);
|
||||||
|
cairo_surface_destroy(pdf_surface);
|
||||||
|
|
||||||
|
ret_clear_layers:
|
||||||
|
for (i = 0; i < MAX_LAYERS; i++) {
|
||||||
|
lay = &layers[i];
|
||||||
|
if(lay->cr) {
|
||||||
|
cairo_destroy(lay->cr);
|
||||||
|
cairo_surface_destroy(lay->rec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(layers);
|
||||||
|
|
||||||
|
printf("cairo export finished. It might still be buggy!\n");
|
||||||
|
}
|
30
cairo-output/cairo-output.h
Normal file
30
cairo-output/cairo-output.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* GDSII-Converter
|
||||||
|
* Copyright (C) 2018 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __CAIRO_OUTPUT_H__
|
||||||
|
#define __CAIRO_OUTPUT_H__
|
||||||
|
|
||||||
|
#include "../layer-selector.h"
|
||||||
|
#include "../gds-parser/gds-types.h"
|
||||||
|
|
||||||
|
#define MAX_LAYERS (300)
|
||||||
|
|
||||||
|
void cairo_render_cell_to_pdf(struct gds_cell *cell, GList *layer_infos, char *pdf_file, double scale);
|
||||||
|
|
||||||
|
#endif /* __CAIRO_OUTPUT_H__ */
|
@ -37,8 +37,6 @@
|
|||||||
|
|
||||||
#define GDS_ERROR(fmt, ...) printf("[PARSE_ERROR] " fmt "\n", ##__VA_ARGS__)
|
#define GDS_ERROR(fmt, ...) printf("[PARSE_ERROR] " fmt "\n", ##__VA_ARGS__)
|
||||||
#define GDS_WARN(fmt, ...) printf("[PARSE_WARNING] " fmt "\n", ##__VA_ARGS__)
|
#define GDS_WARN(fmt, ...) printf("[PARSE_WARNING] " fmt "\n", ##__VA_ARGS__)
|
||||||
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
|
||||||
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
|
||||||
|
|
||||||
enum record {
|
enum record {
|
||||||
INVALID = 0x0000,
|
INVALID = 0x0000,
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#define CELL_NAME_MAX (100)
|
#define CELL_NAME_MAX (100)
|
||||||
|
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||||
|
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
||||||
|
|
||||||
enum graphics_type {GRAPHIC_PATH = 0, GRAPHIC_POLYGON = 1, GRAPHIC_BOX};
|
enum graphics_type {GRAPHIC_PATH = 0, GRAPHIC_POLYGON = 1, GRAPHIC_BOX};
|
||||||
enum path_type {PATH_FLUSH = 0, PATH_ROUNDED = 1, PATH_SQUARED = 2};
|
enum path_type {PATH_FLUSH = 0, PATH_ROUNDED = 1, PATH_SQUARED = 2};
|
||||||
|
90
glade/dialog.glade
Normal file
90
glade/dialog.glade
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Generated with glade 3.22.1 -->
|
||||||
|
<interface>
|
||||||
|
<requires lib="gtk+" version="3.20"/>
|
||||||
|
<object class="GtkAdjustment" id="adjustment1">
|
||||||
|
<property name="lower">1</property>
|
||||||
|
<property name="upper">3000</property>
|
||||||
|
<property name="value">1000</property>
|
||||||
|
<property name="step_increment">10</property>
|
||||||
|
<property name="page_increment">1000</property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkBox" id="dialog-box">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRadioButton" id="latex-radio">
|
||||||
|
<property name="label" translatable="yes">Generate LaTeX/TikZ output</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="active">True</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRadioButton" id="cairo-radio">
|
||||||
|
<property name="label" translatable="yes">Render PDF using Cairographics</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="active">True</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
<property name="group">latex-radio</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScale" id="dialog-scale">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="adjustment">adjustment1</property>
|
||||||
|
<property name="round_digits">0</property>
|
||||||
|
<property name="digits">0</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="standalone-check">
|
||||||
|
<property name="label" translatable="yes">Configure LaTeX as standalone document</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="layer-check">
|
||||||
|
<property name="label" translatable="yes">Generate PDF Layers</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</interface>
|
@ -3,6 +3,7 @@
|
|||||||
<gresource prefix="/">
|
<gresource prefix="/">
|
||||||
<file compressed="true">main.glade</file>
|
<file compressed="true">main.glade</file>
|
||||||
<file>layer-widget.glade</file>
|
<file>layer-widget.glade</file>
|
||||||
|
<file>dialog.glade</file>
|
||||||
</gresource>
|
</gresource>
|
||||||
</gresources>
|
</gresources>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ static gboolean write_layer_env(FILE *tex_file, GdkRGBA *color, int layer, GList
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void generate_graphics(FILE *tex_file, GList *graphics, GList *linfo, GString *buffer)
|
static void generate_graphics(FILE *tex_file, GList *graphics, GList *linfo, GString *buffer, double scale)
|
||||||
{
|
{
|
||||||
GList *temp;
|
GList *temp;
|
||||||
GList *temp_vertex;
|
GList *temp_vertex;
|
||||||
@ -102,7 +102,7 @@ static void generate_graphics(FILE *tex_file, GList *graphics, GList *linfo, GSt
|
|||||||
/* Append vertices */
|
/* Append vertices */
|
||||||
for (temp_vertex = gfx->vertices; temp_vertex != NULL; temp_vertex = temp_vertex->next) {
|
for (temp_vertex = gfx->vertices; temp_vertex != NULL; temp_vertex = temp_vertex->next) {
|
||||||
pt = (struct gds_point *)temp_vertex->data;
|
pt = (struct gds_point *)temp_vertex->data;
|
||||||
g_string_printf(buffer, "(%lf pt, %lf pt) -- ", ((double)pt->x)/1000.0, ((double)pt->y)/1000.0);
|
g_string_printf(buffer, "(%lf pt, %lf pt) -- ", ((double)pt->x)/scale, ((double)pt->y)/scale);
|
||||||
WRITEOUT_BUFFER(buffer);
|
WRITEOUT_BUFFER(buffer);
|
||||||
}
|
}
|
||||||
g_string_printf(buffer, "cycle;\n");
|
g_string_printf(buffer, "cycle;\n");
|
||||||
@ -120,7 +120,7 @@ static void generate_graphics(FILE *tex_file, GList *graphics, GList *linfo, GSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_string_printf(buffer, "\\draw[line width=%lf pt, draw={c%d}, opacity={%lf}, cap=%s] ",
|
g_string_printf(buffer, "\\draw[line width=%lf pt, draw={c%d}, opacity={%lf}, cap=%s] ",
|
||||||
gfx->width_absolute/1000.0, gfx->layer, color.alpha,
|
gfx->width_absolute/scale, gfx->layer, color.alpha,
|
||||||
line_caps[gfx->path_render_type]);
|
line_caps[gfx->path_render_type]);
|
||||||
WRITEOUT_BUFFER(buffer);
|
WRITEOUT_BUFFER(buffer);
|
||||||
|
|
||||||
@ -128,8 +128,8 @@ static void generate_graphics(FILE *tex_file, GList *graphics, GList *linfo, GSt
|
|||||||
for (temp_vertex = gfx->vertices; temp_vertex != NULL; temp_vertex = temp_vertex->next) {
|
for (temp_vertex = gfx->vertices; temp_vertex != NULL; temp_vertex = temp_vertex->next) {
|
||||||
pt = (struct gds_point *)temp_vertex->data;
|
pt = (struct gds_point *)temp_vertex->data;
|
||||||
g_string_printf(buffer, "(%lf pt, %lf pt)%s",
|
g_string_printf(buffer, "(%lf pt, %lf pt)%s",
|
||||||
((double)pt->x)/1000.0,
|
((double)pt->x)/scale,
|
||||||
((double)pt->y)/1000.0,
|
((double)pt->y)/scale,
|
||||||
(temp_vertex->next ? " -- " : ""));
|
(temp_vertex->next ? " -- " : ""));
|
||||||
WRITEOUT_BUFFER(buffer);
|
WRITEOUT_BUFFER(buffer);
|
||||||
}
|
}
|
||||||
@ -145,14 +145,14 @@ static void generate_graphics(FILE *tex_file, GList *graphics, GList *linfo, GSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void render_cell(struct gds_cell *cell, GList *layer_infos, FILE *tex_file, GString *buffer)
|
static void render_cell(struct gds_cell *cell, GList *layer_infos, FILE *tex_file, GString *buffer, double scale)
|
||||||
{
|
{
|
||||||
|
|
||||||
GList *list_child;
|
GList *list_child;
|
||||||
struct gds_cell_instance *inst;
|
struct gds_cell_instance *inst;
|
||||||
|
|
||||||
/* Draw polygons of current cell */
|
/* Draw polygons of current cell */
|
||||||
generate_graphics(tex_file, cell->graphic_objs, layer_infos, buffer);
|
generate_graphics(tex_file, cell->graphic_objs, layer_infos, buffer, scale);
|
||||||
|
|
||||||
/* Draw polygons of childs */
|
/* Draw polygons of childs */
|
||||||
for (list_child = cell->child_cells; list_child != NULL; list_child = list_child->next) {
|
for (list_child = cell->child_cells; list_child != NULL; list_child = list_child->next) {
|
||||||
@ -164,7 +164,7 @@ static void render_cell(struct gds_cell *cell, GList *layer_infos, FILE *tex_fil
|
|||||||
|
|
||||||
/* generate translation scope */
|
/* generate translation scope */
|
||||||
g_string_printf(buffer, "\\begin{scope}[shift={(%lf pt,%lf pt)}]\n",
|
g_string_printf(buffer, "\\begin{scope}[shift={(%lf pt,%lf pt)}]\n",
|
||||||
((double)inst->origin.x)/1000.0,((double)inst->origin.y)/1000.0);
|
((double)inst->origin.x)/scale,((double)inst->origin.y)/scale);
|
||||||
WRITEOUT_BUFFER(buffer);
|
WRITEOUT_BUFFER(buffer);
|
||||||
|
|
||||||
g_string_printf(buffer, "\\begin{scope}[rotate=%lf]\n", inst->angle);
|
g_string_printf(buffer, "\\begin{scope}[rotate=%lf]\n", inst->angle);
|
||||||
@ -174,7 +174,7 @@ static void render_cell(struct gds_cell *cell, GList *layer_infos, FILE *tex_fil
|
|||||||
inst->magnification);
|
inst->magnification);
|
||||||
WRITEOUT_BUFFER(buffer);
|
WRITEOUT_BUFFER(buffer);
|
||||||
|
|
||||||
render_cell(inst->cell_ref, layer_infos, tex_file, buffer);
|
render_cell(inst->cell_ref, layer_infos, tex_file, buffer, scale);
|
||||||
|
|
||||||
g_string_printf(buffer, "\\end{scope}\n");
|
g_string_printf(buffer, "\\end{scope}\n");
|
||||||
WRITEOUT_BUFFER(buffer);
|
WRITEOUT_BUFFER(buffer);
|
||||||
@ -188,7 +188,8 @@ static void render_cell(struct gds_cell *cell, GList *layer_infos, FILE *tex_fil
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void render_cell_to_code(struct gds_cell *cell, GList *layer_infos, FILE *tex_file)
|
void latex_render_cell_to_code(struct gds_cell *cell, GList *layer_infos, FILE *tex_file, double scale,
|
||||||
|
gboolean create_pdf_layers, gboolean standalone_document)
|
||||||
{
|
{
|
||||||
GString *working_line;
|
GString *working_line;
|
||||||
|
|
||||||
@ -200,9 +201,11 @@ void render_cell_to_code(struct gds_cell *cell, GList *layer_infos, FILE *tex_fi
|
|||||||
working_line = g_string_new_len(NULL, LATEX_LINE_BUFFER_KB*1024);
|
working_line = g_string_new_len(NULL, LATEX_LINE_BUFFER_KB*1024);
|
||||||
|
|
||||||
/* standalone foo */
|
/* standalone foo */
|
||||||
g_string_printf(working_line, "\\newif\\iftestmode\n\\testmodefalse %% Change to true for standalone rendering\n");
|
g_string_printf(working_line, "\\newif\\iftestmode\n\\testmode%s\n",
|
||||||
|
(standalone_document ? "true" : "false"));
|
||||||
WRITEOUT_BUFFER(working_line);
|
WRITEOUT_BUFFER(working_line);
|
||||||
g_string_printf(working_line, "\\newif\\ifcreatepdflayers\n\\createpdflayersfalse %% Change to true for Embedded layers in PDF output\n");
|
g_string_printf(working_line, "\\newif\\ifcreatepdflayers\n\\createpdflayers%s\n",
|
||||||
|
(create_pdf_layers ? "true" : "false"));
|
||||||
WRITEOUT_BUFFER(working_line);
|
WRITEOUT_BUFFER(working_line);
|
||||||
g_string_printf(working_line, "\\iftestmode\n");
|
g_string_printf(working_line, "\\iftestmode\n");
|
||||||
WRITEOUT_BUFFER(working_line);
|
WRITEOUT_BUFFER(working_line);
|
||||||
@ -219,7 +222,7 @@ void render_cell_to_code(struct gds_cell *cell, GList *layer_infos, FILE *tex_fi
|
|||||||
WRITEOUT_BUFFER(working_line);
|
WRITEOUT_BUFFER(working_line);
|
||||||
|
|
||||||
/* Generate graphics output */
|
/* Generate graphics output */
|
||||||
render_cell(cell, layer_infos, tex_file, working_line);
|
render_cell(cell, layer_infos, tex_file, working_line, scale);
|
||||||
|
|
||||||
|
|
||||||
g_string_printf(working_line, "\\end{tikzpicture}\n");
|
g_string_printf(working_line, "\\end{tikzpicture}\n");
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#define LATEX_LINE_BUFFER_KB (10)
|
#define LATEX_LINE_BUFFER_KB (10)
|
||||||
|
|
||||||
void render_cell_to_code(struct gds_cell *cell, GList *layer_infos, FILE *tex_file);
|
void latex_render_cell_to_code(struct gds_cell *cell, GList *layer_infos, FILE *tex_file, double scale,
|
||||||
|
gboolean create_pdf_layers, gboolean standalone_document);
|
||||||
|
|
||||||
#endif /* __LATEX_OUTPUT_H__ */
|
#endif /* __LATEX_OUTPUT_H__ */
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "layer-selector.h"
|
#include "layer-selector.h"
|
||||||
#include "gds-parser/gds-parser.h"
|
#include "gds-parser/gds-parser.h"
|
||||||
#include "layer-widget/layer-element.h"
|
#include "widgets/layer-element.h"
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
59
main.c
59
main.c
@ -20,10 +20,11 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "gds-parser/gds-parser.h"
|
#include "gds-parser/gds-parser.h"
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include "layer-widget/layer-element.h"
|
|
||||||
#include "layer-selector.h"
|
#include "layer-selector.h"
|
||||||
#include "tree-renderer/tree-store.h"
|
#include "tree-renderer/tree-store.h"
|
||||||
#include "latex-output/latex-output.h"
|
#include "latex-output/latex-output.h"
|
||||||
|
#include "widgets/conv-settings-dialog.h"
|
||||||
|
#include "cairo-output/cairo-output.h"
|
||||||
|
|
||||||
struct open_button_data {
|
struct open_button_data {
|
||||||
GtkWindow *main_window;
|
GtkWindow *main_window;
|
||||||
@ -161,14 +162,20 @@ end_destroy:
|
|||||||
|
|
||||||
static void on_convert_clicked(gpointer button, gpointer user)
|
static void on_convert_clicked(gpointer button, gpointer user)
|
||||||
{
|
{
|
||||||
|
static struct render_settings sett = {
|
||||||
|
.scale = 1000.0f,
|
||||||
|
.renderer = RENDERER_LATEX_TIKZ,
|
||||||
|
};
|
||||||
struct convert_button_data *data = (struct convert_button_data *)user;
|
struct convert_button_data *data = (struct convert_button_data *)user;
|
||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
GList *layer_list;
|
GList *layer_list;
|
||||||
struct gds_cell *cell_to_render;
|
struct gds_cell *cell_to_render;
|
||||||
FILE *tex_file;
|
FILE *output_file;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
|
RendererSettingsDialog *settings;
|
||||||
|
GtkFileFilter *filter;
|
||||||
gint res;
|
gint res;
|
||||||
char *file_name;
|
char *file_name;
|
||||||
|
|
||||||
@ -185,21 +192,57 @@ static void on_convert_clicked(gpointer button, gpointer user)
|
|||||||
/* Get layers that are rendered */
|
/* Get layers that are rendered */
|
||||||
layer_list = export_rendered_layer_info();
|
layer_list = export_rendered_layer_info();
|
||||||
|
|
||||||
|
settings = renderer_settings_dialog_new(GTK_WINDOW(data->main_window));
|
||||||
|
renderer_settings_dialog_set_settings(settings, &sett);
|
||||||
|
res = gtk_dialog_run(GTK_DIALOG(settings));
|
||||||
|
if (res == GTK_RESPONSE_OK) {
|
||||||
|
renderer_settings_dialog_get_settings(settings, &sett);
|
||||||
|
gtk_widget_destroy(GTK_WIDGET(settings));
|
||||||
|
} else {
|
||||||
|
gtk_widget_destroy(GTK_WIDGET(settings));
|
||||||
|
goto ret_layer_destroy;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* save file dialog */
|
/* save file dialog */
|
||||||
dialog = gtk_file_chooser_dialog_new("Save TeX File", GTK_WINDOW(data->main_window), GTK_FILE_CHOOSER_ACTION_SAVE,
|
dialog = gtk_file_chooser_dialog_new((sett.renderer == RENDERER_LATEX_TIKZ
|
||||||
|
? "Save LaTeX File" : "Save PDF"),
|
||||||
|
GTK_WINDOW(data->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 */
|
||||||
|
filter = gtk_file_filter_new();
|
||||||
|
if (sett.renderer == RENDERER_LATEX_TIKZ) {
|
||||||
|
gtk_file_filter_add_pattern(filter, "*.tex");
|
||||||
|
gtk_file_filter_set_name(filter, "LaTeX-Files");
|
||||||
|
} else {
|
||||||
|
gtk_file_filter_add_pattern(filter, "*.pdf");
|
||||||
|
gtk_file_filter_set_name(filter, "PDF-Files");
|
||||||
|
}
|
||||||
|
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
|
||||||
|
|
||||||
res = gtk_dialog_run(GTK_DIALOG(dialog));
|
res = gtk_dialog_run(GTK_DIALOG(dialog));
|
||||||
if (res == GTK_RESPONSE_ACCEPT) {
|
if (res == GTK_RESPONSE_ACCEPT) {
|
||||||
file_name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
|
file_name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
|
||||||
tex_file = fopen(file_name, "w");
|
|
||||||
g_free(file_name);
|
|
||||||
gtk_widget_destroy(dialog);
|
gtk_widget_destroy(dialog);
|
||||||
render_cell_to_code(cell_to_render, layer_list, tex_file);
|
|
||||||
fclose(tex_file);
|
switch (sett.renderer) {
|
||||||
|
case RENDERER_LATEX_TIKZ:
|
||||||
|
output_file = fopen(file_name, "w");
|
||||||
|
latex_render_cell_to_code(cell_to_render, layer_list, output_file, sett.scale,
|
||||||
|
sett.tex_pdf_layers, sett.tex_standalone);
|
||||||
|
fclose(output_file);
|
||||||
|
break;
|
||||||
|
case RENDERER_CAIROGRAPHICS:
|
||||||
|
cairo_render_cell_to_pdf(cell_to_render, layer_list, file_name, sett.scale);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
g_free(file_name);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
gtk_widget_destroy(dialog);
|
gtk_widget_destroy(dialog);
|
||||||
}
|
}
|
||||||
|
ret_layer_destroy:
|
||||||
g_list_free_full(layer_list, (GDestroyNotify)delete_layer_info_struct);
|
g_list_free_full(layer_list, (GDestroyNotify)delete_layer_info_struct);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
128
widgets/conv-settings-dialog.c
Normal file
128
widgets/conv-settings-dialog.c
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
/*
|
||||||
|
* GDSII-Converter
|
||||||
|
* Copyright (C) 2018 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "conv-settings-dialog.h"
|
||||||
|
|
||||||
|
struct _RendererSettingsDialog {
|
||||||
|
GtkDialog parent;
|
||||||
|
/* Private loot */
|
||||||
|
GtkWidget *radio_latex;
|
||||||
|
GtkWidget *radio_cairo;
|
||||||
|
GtkWidget *scale;
|
||||||
|
GtkWidget *layer_check;
|
||||||
|
GtkWidget *standalone_check;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE(RendererSettingsDialog, renderer_settings_dialog, GTK_TYPE_DIALOG)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void renderer_settings_dialog_class_init(RendererSettingsDialogClass *klass)
|
||||||
|
{
|
||||||
|
/* No special code needed. Child cells are destroyed automatically due to reference counter */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void show_tex_options(RendererSettingsDialog *self)
|
||||||
|
{
|
||||||
|
gtk_widget_show(self->layer_check);
|
||||||
|
gtk_widget_show(self->standalone_check);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hide_tex_options(RendererSettingsDialog *self)
|
||||||
|
{
|
||||||
|
gtk_widget_hide(self->layer_check);
|
||||||
|
gtk_widget_hide(self->standalone_check);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void latex_render_callback(GtkToggleButton *radio, RendererSettingsDialog *dialog)
|
||||||
|
{
|
||||||
|
if (gtk_toggle_button_get_active(radio))
|
||||||
|
show_tex_options(dialog);
|
||||||
|
else
|
||||||
|
hide_tex_options(dialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void renderer_settings_dialog_init(RendererSettingsDialog *self)
|
||||||
|
{
|
||||||
|
GtkBuilder *builder;
|
||||||
|
GtkWidget *box;
|
||||||
|
GtkDialog *dialog;
|
||||||
|
|
||||||
|
|
||||||
|
dialog = &(self->parent);
|
||||||
|
|
||||||
|
builder = gtk_builder_new_from_resource("/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 = GTK_WIDGET(gtk_builder_get_object(builder, "cairo-radio"));
|
||||||
|
self->scale = GTK_WIDGET(gtk_builder_get_object(builder, "dialog-scale"));
|
||||||
|
self->standalone_check = GTK_WIDGET(gtk_builder_get_object(builder, "standalone-check"));
|
||||||
|
self->layer_check = GTK_WIDGET(gtk_builder_get_object(builder, "layer-check"));
|
||||||
|
|
||||||
|
gtk_dialog_add_buttons(dialog, "Cancel", GTK_RESPONSE_CANCEL, "OK", GTK_RESPONSE_OK, NULL);
|
||||||
|
gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(dialog)), box);
|
||||||
|
gtk_window_set_title(GTK_WINDOW(self), "Renderer Settings");
|
||||||
|
|
||||||
|
g_signal_connect(self->radio_latex, "toggled", G_CALLBACK(latex_render_callback), (gpointer)self);
|
||||||
|
|
||||||
|
g_object_unref(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
RendererSettingsDialog *renderer_settings_dialog_new(GtkWindow *parent)
|
||||||
|
{
|
||||||
|
RendererSettingsDialog *res;
|
||||||
|
|
||||||
|
res = RENDERER_SETTINGS_DIALOG(g_object_new(RENDERER_TYPE_SETTINGS_DIALOG, NULL));
|
||||||
|
if (res && parent) {
|
||||||
|
gtk_window_set_transient_for(GTK_WINDOW(res), parent);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
void renderer_settings_dialog_get_settings(RendererSettingsDialog *dialog, struct render_settings *settings)
|
||||||
|
{
|
||||||
|
if (!settings || !dialog)
|
||||||
|
return;
|
||||||
|
settings->scale = gtk_range_get_value(GTK_RANGE(dialog->scale));
|
||||||
|
settings->renderer = (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->radio_latex)) == TRUE ? RENDERER_LATEX_TIKZ : RENDERER_CAIROGRAPHICS);
|
||||||
|
settings->tex_pdf_layers = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->layer_check));
|
||||||
|
settings->tex_standalone = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->standalone_check));
|
||||||
|
}
|
||||||
|
void renderer_settings_dialog_set_settings(RendererSettingsDialog *dialog, struct render_settings *settings)
|
||||||
|
{
|
||||||
|
if (!settings || !dialog)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gtk_range_set_value(GTK_RANGE(dialog->scale), settings->scale);
|
||||||
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->layer_check), settings->tex_pdf_layers);
|
||||||
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->standalone_check), settings->tex_standalone);
|
||||||
|
|
||||||
|
switch (settings->renderer) {
|
||||||
|
case RENDERER_LATEX_TIKZ:
|
||||||
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->radio_latex), TRUE);
|
||||||
|
show_tex_options(dialog);
|
||||||
|
break;
|
||||||
|
case RENDERER_CAIROGRAPHICS:
|
||||||
|
hide_tex_options(dialog);
|
||||||
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->radio_cairo), TRUE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
48
widgets/conv-settings-dialog.h
Normal file
48
widgets/conv-settings-dialog.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* GDSII-Converter
|
||||||
|
* Copyright (C) 2018 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __CONV_SETTINGS_DIALOG_H__
|
||||||
|
#define __CONV_SETTINGS_DIALOG_H__
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
enum output_renderer {RENDERER_LATEX_TIKZ, RENDERER_CAIROGRAPHICS};
|
||||||
|
|
||||||
|
G_DECLARE_FINAL_TYPE(RendererSettingsDialog, renderer_settings_dialog, RENDERER, SETTINGS_DIALOG, GtkDialog)
|
||||||
|
|
||||||
|
RendererSettingsDialog *renderer_settings_dialog_new(GtkWindow *parent);
|
||||||
|
|
||||||
|
#define RENDERER_TYPE_SETTINGS_DIALOG (renderer_settings_dialog_get_type())
|
||||||
|
|
||||||
|
struct render_settings {
|
||||||
|
double scale;
|
||||||
|
enum output_renderer renderer;
|
||||||
|
gboolean tex_pdf_layers;
|
||||||
|
gboolean tex_standalone;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
||||||
|
void renderer_settings_dialog_set_settings(RendererSettingsDialog *dialog, struct render_settings *settings);
|
||||||
|
void renderer_settings_dialog_get_settings(RendererSettingsDialog *dialog, struct render_settings *settings);
|
||||||
|
|
||||||
|
#endif /* __CONV_SETTINGS_DIALOG_H__ */
|
@ -38,12 +38,12 @@ typedef struct _LayerElementPriv {
|
|||||||
GtkCheckButton *export;
|
GtkCheckButton *export;
|
||||||
} LayerElementPriv;
|
} LayerElementPriv;
|
||||||
|
|
||||||
typedef struct _LayerElement {
|
struct _LayerElement {
|
||||||
/* Inheritance */
|
/* Inheritance */
|
||||||
GtkListBoxRow parent;
|
GtkListBoxRow parent;
|
||||||
/* Custom Elements */
|
/* Custom Elements */
|
||||||
LayerElementPriv priv;
|
LayerElementPriv priv;
|
||||||
} LayerElement;
|
};
|
||||||
|
|
||||||
GtkWidget *layer_element_new(void);
|
GtkWidget *layer_element_new(void);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user