Update include file hierarchy: Move include file to central include tree

This commit is contained in:
2019-03-26 19:57:19 +01:00
parent 60e20f45cc
commit e8c7f78af4
41 changed files with 182 additions and 109 deletions

View 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/>.
*/
/**
* @file cairo-output.h
* @brief Header File for Cairo output renderer
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
#ifndef _CAIRO_OUTPUT_H_
#define _CAIRO_OUTPUT_H_
#include <gds-render/gds-utils/gds-types.h>
#include <gds-render/layer/layer-info.h>
/** @addtogroup Cairo-Renderer
* @{
*/
#define MAX_LAYERS (300) /**< \brief Maximum layer count the output renderer can process. Typically GDS only specifies up to 255 layers.*/
/**
* @brief Render \p cell to a PDF file specified by \p pdf_file
* @param cell Toplevel cell to @ref Cairo-Renderer
* @param layer_infos List of layer information. Specifies color and layer stacking
* @param pdf_file PDF output file. Set to NULL if no PDF file has to be generated
* @param svg_file SVG output file. Set to NULL if no SVG file has to be generated
* @param scale Scale the output image down by \p scale
*/
void cairo_render_cell_to_vector_file(struct gds_cell *cell, GList *layer_infos, char *pdf_file, char *svg_file, double scale);
/** @} */
#endif /* _CAIRO_OUTPUT_H_ */

View File

@@ -0,0 +1,61 @@
/*
* 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/>.
*/
/**
* @file command-line.h
* @brief Render according to command line parameters
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/**
* @addtogroup MainApplication
* @{
*/
#ifndef _COMMAND_LINE_H_
#define _COMMAND_LINE_H_
#include <glib.h>
/**
* @brief Convert GDS according to supplied parameters
* @param gds_name GDS File path
* @param pdf_name Cairo-PDF path
* @param tex_name TeX/TikZ path
* @param pdf Render Cairo
* @param tex Render LaTeX
* @param layer_file Layer mapping file
* @param cell_name Cell name to render
* @param scale Scale image down by this value
* @param pdf_layers TikZ creates OCG layers
* @param pdf_standalone LaTeX document is standalone7
* @param svg Render to SVG file
* @param so_name Path to shared object of custom renderer
* @param so_out_file Output file path for custom renderer
* @param svg_name SVG file name
*
* @note This function is pretty damn retarded (Lots of parameters). Will be reworked when generating GObjects for renderers.
*/
void command_line_convert_gds(char *gds_name, char *pdf_name, char *tex_name, gboolean pdf, gboolean tex,
char *layer_file, char *cell_name, double scale, gboolean pdf_layers,
gboolean pdf_standalone, gboolean svg, char *svg_name, char *so_name, char *so_out_file);
#endif /* _COMMAND_LINE_H_ */
/** @} */

View File

@@ -0,0 +1,59 @@
/*
* 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/>.
*/
/**
* @file external-renderer.h
* @brief Render according to command line parameters
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/**
* @addtogroup MainApplication
* @{
*/
#ifndef _EXTERNAL_RENDERER_H_
#define _EXTERNAL_RENDERER_H_
#include <gds-render/gds-utils/gds-types.h>
#include <glib.h>
/**
* @brief function name expected to be found in external library.
*
* The function has to be defined as follows:
* @code
* int function_name(gds_cell *toplevel, GList *layer_info_list, char *output_file_name)
* @endcode
*/
#define EXTERNAL_LIBRARY_FUNCTION "render_cell_to_file"
/**
* @brief external_renderer_render_cell
* @param toplevel_cell The toplevel cell to render
* @param layer_info_list The layer information. Contains #layer_info elements
* @param output_file Output file
* @param so_path Path to the shared object file containing #EXTERNAL_LIBRARY_FUNCTION
* @return 0 on success
*/
int external_renderer_render_cell(struct gds_cell *toplevel_cell, GList *layer_info_list, char *output_file, char *so_path);
#endif /* _EXTERNAL_RENDERER_H_ */
/** @} */

View File

@@ -0,0 +1,61 @@
/*
* 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/>.
*/
/**
* @file gds-render-gui.h
* @brief Header for GdsRenderGui Object
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
#ifndef _GDS_RENDER_GUI_
#define _GDS_RENDER_GUI_
/**
* @addtogroup MainApplication
* @{
*/
#include <gtk/gtk.h>
G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE(GdsRenderGui, gds_render_gui, RENDERER, GUI, GObject);
#define RENDERER_TYPE_GUI (gds_render_gui_get_type())
/**
* @brief Create new GdsRenderGui Object
* @return New object
*/
GdsRenderGui *gds_render_gui_new();
/**
* @brief Get main window
*
* 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
* @return The generated main window
*/
GtkWindow *gds_render_gui_get_main_window(GdsRenderGui *gui);
G_END_DECLS
/** @} */
#endif /* _GDS_RENDER_GUI_ */

View File

@@ -0,0 +1,50 @@
/*
* 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/>.
*/
/**
* @file gds-parser.h
* @brief Header file for the GDS-Parser
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/**
* @addtogroup GDS-Utilities
* @{
*/
#ifndef _GDSPARSER_H_
#define _GDSPARSER_H_
#include <glib.h>
#include <gds-render/gds-utils/gds-types.h>
#define GDS_PRINT_DEBUG_INFOS (0) /**< @brief 1: Print infos, 0: Don't print */
int parse_gds_from_file(const char *filename, GList **library_array);
/**
* @brief Deletes all libraries including cells, references etc.
* @param library_list Pointer to a list of #gds_library. Is set to NULL after completion.
* @return 0
*/
int clear_lib_list(GList **library_list);
/** @} */
#endif /* _GDSPARSE_H_ */

View File

@@ -0,0 +1,61 @@
/*
* GDSII-Converter
* Copyright (C) 2019 Mario Hüttel <mario.huettel@gmx.net>
*
* This file is part of GDSII-Converter.
*
* GDSII-Converter is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* GDSII-Converter is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file gds-tree-checker.h
* @brief Checking functions of a cell tree (Header)
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/**
* @addtogroup GDS-Utilities
* @{
*/
#ifndef _GDS_TREE_CHECKER_H_
#define _GDS_TREE_CHECKER_H_
#include <gds-render/gds-utils/gds-types.h>
/**
* @brief gds_tree_check_cell_references checks if all child cell references can be resolved in the given library
*
* This function will only mark cells that
* directly contain unresolved references.
*
* If a cell contains a reference to a cell with unresolved references, it is not flagged.
*
* @param lib The GDS library to check
* @return less than 0 if an error occured during processing; 0 if all child cells could be resolved;
* greater than zero if the processing was successful but not all cell references could be resolved.
* In this case the number of unresolved references is returned
*/
int gds_tree_check_cell_references(struct gds_library *lib);
/**
* @brief gds_tree_check_reference_loops checks if the given library contains reference loops
* @param lib GDS library
* @return negative if an error occured, zero if there are no reference loops, else a positive number representing the number
* of affected cells
*/
int gds_tree_check_reference_loops(struct gds_library *lib);
#endif /* _GDS_TREE_CHECKER_H_ */
/** @} */

View File

@@ -0,0 +1,146 @@
/*
* 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/>.
*/
/**
* @file gds-types.h
* @brief Defines types and macros used by the GDS-Parser
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/**
* @addtogroup GDS-Utilities
* @{
*/
#ifndef __GDS_TYPES_H__
#define __GDS_TYPES_H__
#include <stdint.h>
#include <glib.h>
#define CELL_NAME_MAX (100) /**< @brief Maximum length of a gds_cell::name or a gds_library::name */
/* Maybe use the macros that ship with the compiler? */
#define MIN(a,b) (((a) < (b)) ? (a) : (b)) /**< @brief Return smaller number */
#define MAX(a,b) (((a) > (b)) ? (a) : (b)) /**< @brief Return bigger number */
/** @brief Defintion of check counter default value
* that indicates that the corresponding check has not yet been executed */
enum {GDS_CELL_CHECK_NOT_RUN = -1};
/** @brief Types of graphic objects */
enum graphics_type
{
GRAPHIC_PATH = 0, /**< @brief Path. Esentially a line */
GRAPHIC_POLYGON = 1, /**< @brief An arbitrary polygon */
GRAPHIC_BOX = 2 /**< @brief A rectangle. @warning Implementation in renderers might be buggy!*/
};
/**
* @brief Defines the line caps of a path
*/
enum path_type {PATH_FLUSH = 0, PATH_ROUNDED = 1, PATH_SQUARED = 2}; /**< Path line caps */
/**
* @brief A point in the 2D plane. Sometimes references as vertex
*/
struct gds_point {
int x;
int y;
};
/**
* @brief Stores the result of the cell checks.
*/
struct gds_cell_checks {
int unresolved_child_count; /**< @brief Number of unresolved cell instances inside this cell. Default: GDS_CELL_CHECK_NOT_RUN */
int affected_by_reference_loop; /**< @brief 1 if the cell is affected by a reference loop and therefore not renderable. Default: GDS_CELL_CHECK_NOT_RUN*/
/**
* @brief For the internal use of the checker.
* @warning Do not use this structure and its contents!
*/
struct _check_internals {
int marker;
} _internal;
};
/**
* @brief Date information for cells and libraries
*/
struct gds_time_field {
uint16_t year;
uint16_t month;
uint16_t day;
uint16_t hour;
uint16_t minute;
uint16_t second;
};
/**
* @brief A GDS graphics object
*/
struct gds_graphics {
enum graphics_type gfx_type; /**< \brief Type of graphic */
GList *vertices; /**< @brief List of #gds_point */
enum path_type path_render_type; /**< @brief Line cap */
int width_absolute; /**< @brief Width. Not used for objects other than paths */
int16_t layer; /**< @brief Layer the graphic object is on */
uint16_t datatype;
};
/**
* @brief This represents an instanc of a cell inside another cell
*/
struct gds_cell_instance {
char ref_name[CELL_NAME_MAX]; /**< @brief Name of referenced cell */
struct gds_cell *cell_ref; /**< @brief Referenced gds_cell structure */
struct gds_point origin; /**< @brief Origin */
int flipped; /**< @brief Mirrored on x-axis before rotation */
double angle; /**< @brief Angle of rotation (counter clockwise) in degrees */
double magnification; /**< @brief magnification */
};
/**
* @brief A Cell inside a gds_library
*/
struct gds_cell {
char name[CELL_NAME_MAX];
struct gds_time_field mod_time;
struct gds_time_field access_time;
GList *child_cells; /**< @brief List of #gds_cell_instance elements */
GList *graphic_objs; /**< @brief List of #gds_graphics */
struct gds_library *parent_library; /**< @brief Pointer to parent library */
struct gds_cell_checks checks; /**< @brief Checking results */
};
/**
* @brief GDS Toplevel library
*/
struct gds_library {
char name[CELL_NAME_MAX];
struct gds_time_field mod_time;
struct gds_time_field access_time;
double unit_in_meters; /**< Length of a database unit in meters */
GList *cells; /**< List of #gds_cell that contains all cells in this library*/
GList *cell_names /**< List of strings that contains all cell names */;
};
/** @} */
#endif /* __GDS_TYPES_H__ */

View File

@@ -0,0 +1,58 @@
/*
* 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/>.
*/
/**
* @file bounding-box.h
* @brief Header for calculation of bounding boxes
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/**
* @addtogroup geometric
* @{
*/
#ifndef _BOUNDING_BOX_H_
#define _BOUNDING_BOX_H_
#include <glib.h>
#include <gds-render/geometric/vector-operations.h>
#include <stdbool.h>
union bounding_box {
/** Coordinate System is (y up | x right) */
struct _vectors {
struct vector_2d lower_left;
struct vector_2d upper_right;
} vectors;
struct vector_2d vector_array[2];
};
typedef void (*conv_generic_to_vector_2d_t)(void *, struct vector_2d *);
void bounding_box_calculate_polygon(GList *vertices, conv_generic_to_vector_2d_t conv_func, union bounding_box *box);
void bounding_box_update_box(union bounding_box *destination, union bounding_box *update);
void bounding_box_prepare_empty(union bounding_box *box);
void bounding_box_update_point(union bounding_box *destination, conv_generic_to_vector_2d_t conv_func, void *pt);
void bounding_box_apply_transform(double scale, double rotation_deg, bool flip_at_x, union bounding_box *box);
void bounding_box_calculate_path_box(GList *vertices, double thickness, conv_generic_to_vector_2d_t conv_func, union bounding_box *box);
#endif /* _BOUNDING_BOX_H_ */
/** @} */

View File

@@ -0,0 +1,47 @@
/*
* 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/>.
*/
/**
* @file cell-trigonometrics.h
* @brief Calculation of gds_cell trigonometrics
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/**
* @addtogroup geometric
* @{
*/
#ifndef _CELL_TRIGONOMETRICS_H_
#define _CELL_TRIGONOMETRICS_H_
#include <gds-render/geometric/bounding-box.h>
#include <gds-render/gds-utils/gds-types.h>
/**
* @brief calculate_cell_bounding_box Calculate bounding box of gds cell
* @param box Resulting boundig box. Will be uüdated and not overwritten
* @param cell toplevel cell
* @warning Path handling not yet implemented correctly.
*/
void calculate_cell_bounding_box(union bounding_box *box, struct gds_cell *cell);
#endif /* _CELL_TRIGONOMETRICS_H_ */
/** @} */

View File

@@ -0,0 +1,58 @@
/*
* 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/>.
*/
/**
* @file vector-operations.h
* @brief Header for 2D Vector operations
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/**
* @addtogroup geometric
* @{
*/
#ifndef _VECTOR_OPERATIONS_H_
#define _VECTOR_OPERATIONS_H_
#include <math.h>
struct vector_2d {
double x;
double y;
};
#define DEG2RAD(a) ((a)*M_PI/180.0)
double vector_2d_scalar_multipy(struct vector_2d *a, struct vector_2d *b);
void vector_2d_normalize(struct vector_2d *vec);
void vector_2d_rotate(struct vector_2d *vec, double angle);
struct vector_2d *vector_2d_copy(struct vector_2d *opt_res, struct vector_2d *vec);
struct vector_2d *vector_2d_alloc(void);
void vector_2d_free(struct vector_2d *vec);
void vector_2d_scale(struct vector_2d *vec, double scale);
double vector_2d_abs(struct vector_2d *vec);
double vector_2d_calculate_angle_between(struct vector_2d *a, struct vector_2d *b);
void vector_2d_subtract(struct vector_2d *res, struct vector_2d *a, struct vector_2d *b);
void vector_2d_add(struct vector_2d *res, struct vector_2d *a, struct vector_2d *b);
#endif /* _VECTOR_OPERATIONS_H_ */
/** @} */

View File

@@ -0,0 +1,56 @@
/*
* 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/>.
*/
/**
* @file latex-output.h
* @brief LaTeX output renderer
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
#ifndef __LATEX_OUTPUT_H__
#define __LATEX_OUTPUT_H__
/**
* @addtogroup LaTeX-Renderer
* @{
*/
#include <glib.h>
#include <stdio.h>
#include "gds-render/layer/layer-info.h"
#include <gds-render/gds-utils/gds-types.h>
#define LATEX_LINE_BUFFER_KB (10) /**< @brief Buffer for LaTeX Code line in KiB */
/**
* @brief Render \p cell to LateX/TikZ code
* @param cell Cell to render
* @param layer_infos Layer information
* @param tex_file Already opened file to write data in
* @param scale Scale image down by this value
* @param create_pdf_layers Optional content groups used
* @param standalone_document document can be compiled standalone
*/
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__ */

View File

@@ -0,0 +1,51 @@
/*
* GDSII-Converter
* Copyright (C) 2019 Mario Hüttel <mario.huettel@gmx.net>
*
* This file is part of GDSII-Converter.
*
* GDSII-Converter is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* GDSII-Converter is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file layer-info.c
* @brief Helper functions and definition of layer info struct
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
#ifndef _LAYER_INFO_H_
#define _LAYER_INFO_H_
#include <gtk/gtk.h>
/**
* @brief Layer information.
*
* This structs contains information on how to render a layer
*/
struct layer_info
{
int layer; /**< @brief Layer number */
char *name; /**< @brief Layer name */
int stacked_position; ///< @brief Position of layer in output @warning This parameter is not used by any renderer so far @note Lower is bottom, higher is top
GdkRGBA color; /**< @brief RGBA color used to render this layer */
};
/**
* @brief Delete a layer_info struct
* @param info Struct to be deleted.
* @note The layer_info::name Element has to be freed manually
*/
void layer_info_delete_struct(struct layer_info *info);
#endif // _LAYER_INFO_H_

View File

@@ -0,0 +1,90 @@
/*
* 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/>.
*/
/**
* @file layer-selector.h
* @brief Implementation of the Layer selection list
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
#ifndef __LAYER_SELECTOR_H__
#define __LAYER_SELECTOR_H__
#include <gtk/gtk.h>
#include <glib.h>
G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE(LayerSelector, layer_selector, LAYER, SELECTOR, GObject);
#define TYPE_LAYER_SELECTOR (layer_selector_get_type())
/**
* @brief Defines how to sort the layer selector list box.
*/
enum layer_selector_sort_algo {LAYER_SELECTOR_SORT_DOWN = 0, LAYER_SELECTOR_SORT_UP};
/**
* @brief layer_selector_new
* @param list_box The associated list box, the content is displayed in
* @return Newly created layer selector
*/
LayerSelector *layer_selector_new(GtkListBox *list_box);
/**
* @brief Generate layer widgets in in the LayerSelector instance
* @note This clears all previously inserted elements
* @param selector LayerSelector instance
* @param libs The libraries to add
*/
void layer_selector_generate_layer_widgets(LayerSelector *selector, GList *libs);
/**
* @brief Supply button for loading the layer mapping
* @param selector LayerSelector instance
* @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);
/**
* @brief Supply button for saving the layer mapping
* @param selector LayerSelector instance
* @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);
/**
* @brief Get a list of all layers that shall be exported when rendering the cells
* @param selector Layer selector instance
* @return List of layer_info structures containing the layer information
*/
GList *layer_selector_export_rendered_layer_info(LayerSelector *selector);
/**
* @brief Force the layer selector list to be sorted according to \p sort_function
* @param selector LayerSelector instance
* @param sort_function The sorting method (up or down sorting)
*/
void layer_selector_force_sort(LayerSelector *selector, enum layer_selector_sort_algo sort_function);
G_END_DECLS
#endif /* __LAYER_SELECTOR_H__ */

View File

@@ -0,0 +1,59 @@
/*
* 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/>.
*/
/**
* @file mapping-parser.h
* @brief Function to read a mapping file line and parse it.
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
#ifndef __MAPPING_PARSER_H__
#define __MAPPING_PARSER_H__
/**
* @addtogroup MainApplication
* @{
*/
#include <glib.h>
#include <gds-render/widgets/layer-element.h>
/**
* @brief Load a line from \p stream and parse try to parse it as layer information
* @param stream Input data stream
* @param export Layer shall be exported
* @param name Layer name. Free returned pointer after using.
* @param layer Layer number
* @param color RGBA color.
* @return 1 if malformatted line, 0 if parsing was successful and parameters are valid, -1 if file end
*/
int mapping_parser_load_line(GDataInputStream *stream, gboolean *export, char **name, int *layer, GdkRGBA *color);
/**
* @brief Create Line for LayerMapping file with supplied information
* @param layer_element information
* @param line_buffer buffer to write to
* @param max_len Maximum length that cna be used in \p line_buffer
*/
void mapping_parser_gen_csv_line(LayerElement *layer_element, char *line_buffer, size_t max_len);
/** @} */
#endif /* __MAPPING_PARSER_H__ */

View File

@@ -0,0 +1,44 @@
/*
* 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 __LIB_CELL_RENDERER_H__
#define __LIB_CELL_RENDERER_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE(LibCellRenderer, lib_cell_renderer, LIB_CELL, RENDERER, GtkCellRendererText)
#define TYPE_LIB_CELL_RENDERER (lib_cell_renderer_get_type())
#define LIB_CELL_RENDERER_ERROR_WARN (1U<<0)
#define LIB_CELL_RENDERER_ERROR_ERR (1U<<1)
typedef struct _LibCellRenderer {
/* Inheritance */
GtkCellRendererText super;
/* Custom Elements */
} LibCellRenderer;
GType lib_cell_renderer_get_type(void);
GtkCellRenderer *lib_cell_renderer_new(void);
G_END_DECLS
#endif /* __LIB_CELL_RENDERER_H__ */

View File

@@ -0,0 +1,57 @@
/*
* 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/>.
*/
/**
* @file tree-store.h
* @brief Header file for Tree store implementation
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/**
* @addtogroup MainApplication
* @{
*/
#ifndef __TREE_STORE_H__
#define __TREE_STORE_H__
#include <gtk/gtk.h>
/** @brief Columns of selection tree view */
enum cell_store_columns {
CELL_SEL_LIBRARY = 0,
CELL_SEL_CELL,
CELL_SEL_CELL_ERROR_STATE, /**< Used for cell color and selectability */
CELL_SEL_MODDATE,
CELL_SEL_ACCESSDATE,
CELL_SEL_COLUMN_COUNT /**< @brief Not a column. Used to determine count of columns */
};
struct tree_stores {
GtkTreeView *base_tree_view;
GtkTreeStore *base_store;
GtkTreeModelFilter *filter;
GtkEntry *search_entry;
};
struct tree_stores *setup_cell_selector(GtkTreeView* view, GtkEntry *search_entry);
#endif /* __TREE_STORE_H__ */
/** @} */

View File

@@ -0,0 +1,28 @@
/*
* 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/>.
*/
/**
* @addtogroup MainApplication
* @{
*/
/** @brief This string holds the 'git describe' version of the app */
extern char *_app_version_string;
/** @} */

View File

@@ -0,0 +1,101 @@
/*
* 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/>.
*/
/**
* @file conv-settings-dialog.h
* @brief Header file for the Conversion Settings Dialog
* @author Mario.Huettel@gmx.net <mario.huettel@gmx.net>
*/
/**
* @addtogroup Widgets
* @{
*/
#ifndef __CONV_SETTINGS_DIALOG_H__
#define __CONV_SETTINGS_DIALOG_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
/** @brief return type of the RedererSettingsDialog */
enum output_renderer {RENDERER_LATEX_TIKZ, RENDERER_CAIROGRAPHICS_PDF, RENDERER_CAIROGRAPHICS_SVG};
G_DECLARE_FINAL_TYPE(RendererSettingsDialog, renderer_settings_dialog, RENDERER, SETTINGS_DIALOG, GtkDialog)
/**
* @brief Create a new RedererSettingsDialog GObject
* @param parent Parent window
* @return Created dialog object
*/
RendererSettingsDialog *renderer_settings_dialog_new(GtkWindow *parent);
#define RENDERER_TYPE_SETTINGS_DIALOG (renderer_settings_dialog_get_type())
/**
* @brief This struct holds the renderer configuration
*/
struct render_settings {
double scale; /**< @brief Scale image down by this factor. @note Used to keep image in bound of maximum coordinate limit */
enum output_renderer renderer; /**< The renderer to use */
gboolean tex_pdf_layers; /**< Create OCG layers when rendering with TikZ */
gboolean tex_standalone; /**< Create a standalone compile TeX file */
};
G_END_DECLS
/**
* @brief Apply settings to dialog
* @param dialog
* @param settings
*/
void renderer_settings_dialog_set_settings(RendererSettingsDialog *dialog, struct render_settings *settings);
/**
* @brief Get the settings configured in the dialog
* @param dialog
* @param settings
*/
void renderer_settings_dialog_get_settings(RendererSettingsDialog *dialog, struct render_settings *settings);
/**
* @brief renderer_settings_dialog_set_cell_width Set width for rendered cell
* @param dialog
* @param width Width in database units
*/
void renderer_settings_dialog_set_cell_width(RendererSettingsDialog *dialog, unsigned int width);
/**
* @brief renderer_settings_dialog_set_cell_height Set height for rendered cell
* @param dialog
* @param height Height in database units
*/
void renderer_settings_dialog_set_cell_height(RendererSettingsDialog *dialog, unsigned int height);
/**
* @brief renderer_settings_dialog_set_database_unit_scale Set database scale
* @param dialog dialog element
* @param unit_in_meters Database unit in meters
*/
void renderer_settings_dialog_set_database_unit_scale(RendererSettingsDialog *dialog, double unit_in_meters);
#endif /* __CONV_SETTINGS_DIALOG_H__ */
/** @} */

View File

@@ -0,0 +1,148 @@
/*
* 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/>.
*/
/**
* @file layer-element.h
* @brief Omplementation of the layer element used for configuring layer colors etc.
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/**
* @addtogroup Widgets
* @{
*/
#ifndef __LAYER_ELEMENT_H__
#define __LAYER_ELEMENT_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
/* Creates Class structure etc */
G_DECLARE_FINAL_TYPE(LayerElement, layer_element, LAYER, ELEMENT, GtkListBoxRow)
#define TYPE_LAYER_ELEMENT (layer_element_get_type())
typedef struct _LayerElementPriv {
GtkEntry *name;
GtkLabel *layer;
int layer_num;
GtkEventBox *event_handle;
GtkColorButton *color;
GtkCheckButton *export;
} LayerElementPriv;
struct _LayerElement {
/* Inheritance */
GtkListBoxRow parent;
/* Custom Elements */
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
* @return new object
*/
GtkWidget *layer_element_new(void);
/**
* @brief get name of the layer
* @param elem Layer element
* @return Name. Must not be changed, freed or anything else.
*/
const char *layer_element_get_name(LayerElement *elem);
/**
* @brief layer_element_set_name
* @param elem set the name of the layer
* @param name Name. Can be freed after call to this function
*/
void layer_element_set_name(LayerElement *elem, const char* name);
/**
* @brief Set layer number for this layer
* @param elem Layer element
* @param layer Layer number
*/
void layer_element_set_layer(LayerElement *elem, int layer);
/**
* @brief Get layer number
* @param elem Layer Element
* @return Number of this layer
*/
int layer_element_get_layer(LayerElement *elem);
/**
* @brief Set export flag for this layer
* @param elem Layer Element
* @param export flag
*/
void layer_element_set_export(LayerElement *elem, gboolean export);
/**
* @brief Get export flag of layer
* @param elem Layer Element
* @return
*/
gboolean layer_element_get_export(LayerElement *elem);
/**
* @brief Get color of layer
* @param elem Layer Element
* @param rgba RGBA color
*/
void layer_element_get_color(LayerElement *elem, GdkRGBA *rgba);
/**
* @brief Set color of layer
* @param elem Layer Element
* @param rgba RGBA color
*/
void layer_element_set_color(LayerElement *elem, GdkRGBA *rgba);
/**
* @brief Setup drag and drop of \p elem for use in the LayerSelector
* @param elem Layer element to set up
* @param data Data array containing the necessary callbacks etc. for drag and drop.
*/
void layer_element_set_dnd_callbacks(LayerElement *elem, struct layer_element_dnd_data *data);
G_END_DECLS
#endif /* __LAYER_ELEMENT_H__ */
/** @} */