13 Commits

38 changed files with 310 additions and 2096 deletions

View File

@@ -24,7 +24,7 @@
*/
/**
* @addtogroup MainApplication
* @addtogroup cmdline
* @{
*/

View File

@@ -9,7 +9,7 @@ done
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )"
cd "$DIR"
export PROJECT_NUMBER=`git describe --tags`
export PROJECT_NUMBER=`../version/generate-version-string.sh`
if [ $# != 1 ]; then
export OUTPUT_DIRECTORY="./output"

View File

@@ -0,0 +1,4 @@
/**
* @defgroup Cairo-Renderer Cairo Renderer
* @ingroup renderers
*/

3
doxygen/command-line.dox Normal file
View File

@@ -0,0 +1,3 @@
/**
* @defgroup cmdline Command Line Interface
*/

View File

@@ -0,0 +1,4 @@
/**
* @defgroup external-renderer External Shared Object Renderer
* @ingroup renderers
*/

View File

@@ -2,5 +2,4 @@
/**
* @defgroup GUI Graphical User Interface
* @ingroup MainApplication
*/

Binary file not shown.

BIN
doxygen/images/gui.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 114 KiB

View File

@@ -0,0 +1,4 @@
/**
* @defgroup LaTeX-Renderer LaTeX/TikZ Renderer
* @ingroup renderers
*/

View File

@@ -0,0 +1,7 @@
/**
* @defgroup layer-selector LayerSelector Object
* @ingroup GUI
*
* This objects implements the layer selector and displays the layers in a list box.
* It uses @ref LayerElement objects to display the individual layers inside the list box.
*/

View File

@@ -0,0 +1,18 @@
/**
* @defgroup LibCellRenderer LibCellRenderer GObject
* @ingroup GUI
*
* The LibCellRenderer Object is used to render @ref gds_cell and @ref gds_library elements
* to a GtkTreeView.
*
* The LibCellRenderer class is derived from a GtkCellRendererText and works the same way.
* The additinal features are three new properties:
*
* - *gds-lib*: This property can be used to set a @ref gds_library structure. The renderer will render the name of the library.
* - *gds-cell*: This property can be used to set a @ref gds_cell structure. The renderer will render the name of the cell.
* - *error-level*: Set the error level of the cell/library. This affects the foreground color of hte rendered output.
*
* Internally the class operates by setting the 'text' property, which is inherited form the base class to the library/cell name (gds_library::name and gds_cell::name fields).
* The error level (@ref LIB_CELL_RENDERER_ERROR_WARN and @ref LIB_CELL_RENDERER_ERROR_ERR) is translated to the inherited 'foreground-rgba' property.
*
*/

View File

@@ -1,6 +0,0 @@
/* This file only contains help information for doxygen */
/**
* @defgroup MainApplication Main Application
*
*/

View File

@@ -6,10 +6,7 @@ This programm converts GDS layout files to
- PDF Files using the @ref Cairo-Renderer
- Latex code (TikZ) using the @ref LaTeX-Renderer
See the @subpage usage page for details and @subpage compilation for building instructions.
See the @subpage usage page for details and @subpage compilation for building instructions and @subpage versioning for the versioning scheme of this program.

9
doxygen/renderers.dox Normal file
View File

@@ -0,0 +1,9 @@
/**
* @defgroup renderers Output Renderers
*
* The renderers are used to convert the cell structures read from the GDS layout file
* into different output formats.
*
* Currently the renders are statically implemented without the use of GObjects.
* This will probably change in future releases in order to make it easier to integrate new rendering methods.
*/

View File

@@ -1,21 +1,21 @@
/**
@page usage Usage
@section cmd Command Line Interface
To use the application on the command line check 'gds-render --help'.
To use the application on the command line check 'gds-render `--`help'.
Application Options:
- -t, --tikz Output TikZ code
- -p, --pdf Output PDF document
- -s, --scale=SCALE Divide output coordinates by SCALE
- -o, --tex-output=PATH Optional path for TeX file
- -O, --pdf-output=PATH Optional path for PDF file
- -m, --mapping=PATH Path for Layer Mapping File
- -c, --cell=NAME Cell to render
- -a, --tex-standalone Create standalone PDF
- -l, --tex-layers Create PDF Layers (OCG)
- -P, --custom-render-lib=PATH Path to a custom shared object, that implements the render_cell_to_file function
- -e, --external-lib-output=PATH Output path for external render library
- --display=DISPLAY X display to use
- -t, `--`tikz Output TikZ code
- -p, `--`pdf Output PDF document
- -s, `--`scale=SCALE Divide output coordinates by SCALE
- -o, `--`tex-output=PATH Optional path for TeX file
- -O, `--`pdf-output=PATH Optional path for PDF file
- -m, `--`mapping=PATH Path for Layer Mapping File
- -c, `--`cell=NAME Cell to render
- -a, `--`tex-standalone Create standalone PDF
- -l, `--`tex-layers Create PDF Layers (OCG)
- -P, `--`custom-render-lib=PATH Path to a custom shared object, that implements the render_cell_to_file function
- -e, `--`external-lib-output=PATH Output path for external render library
- `--`display=DISPLAY X display to use
@section gui Graphical User Interface
@@ -24,7 +24,11 @@ The graphical user interface (GUI) can be used to open GDS Files, configure the
It is possible to export the layer configurations so they can be used later on. Even in the @ref cmd
@image html gui.svg
@image latex gui.pdf
@image html gui.png
@image latex gui.png
The cell selector on the left shows the GDS Libraries and Cells. The cells are marked green if all references inside the cell could be found. If not all references could be found, the cell is marked orange. This doens't show if child cells have missing childs. Only one level of the hierarchy is checked in order to make it easier to spot an errorneous cell. Cells with missing child cells are still renderable but -- obviously -- faulty. If a cell or any sub-cell contains a reference loop, the cell is marked red. In this case it can't be selected for rendering.
In the above image the cell is green; so everything is okay.
*/

36
doxygen/versioning.dox Normal file
View File

@@ -0,0 +1,36 @@
/**
@page versioning Version Number
@section main-version Main Versioning Scheme
The version number of this application consists of a given version in the format of 'v1.0'.
Where the first number indicates a major release and the second number indicates minor changes.
Versions, including release candidates and path-levels, are tagged in git.
@subsection rc Release Candidates
Release candidates are software versions that seem stable and functional to become a new version but testing is not fully finished. These versions are marked with an '-rcX', where X is the number of the release candidate.
The 3rd release candidate of version 4.2 would be '*v4.2-rc3*'.
Release candidates are in a frozen state. Only bugfixes that are necessary for functionality are applied to these versions before releasing the final version.
@subsection patch-level Patch Levels
If an already released version contains bugs that need to be fixed, the version number is not incremented. Insted a new version number with a patch-level is created. The patch-level is appended with a dash directly after the version number. The fist patch-level of version 3.5 would be: 'v3.5-1'.
@section git-version-num Git Based Version Number
The application and this documentation contain a git-based version number. With this version number not only released versions but all development points of the software can be uniquely identified.
An example for such a version number is: *v1.0-rc4-41-gaa41373-dirty*
It consists of the last @ref main-version (in this case version 1.0 -- Release candidate 4) and some other information from the source code management system. The number after the version tag is the commit count after the given version. In this case the specified version is 41 commits after the last tagged version 'v1.0-rc4'. The next section always starts with a 'g' (for git) and after that contains the first letters of the commit ID. In this case an additional '-dirty' is appended, showing that the software version contains unstaged changes.
In tabular form: *v1.0-rc4-41-gaa41373-dirty*
| Last tagged version | Commits since that version | Start of commit ID | Unstaged changes? |
|---------------------|----------------------------|--------------------|---------------------|
| 1.0-rc4 | 41 | aa41373 | yes |
This git-based version number is automatically put into the application and this doxumentation during the application's compilation / the documentation's generation. For this *git* is needed. Therefore, it is highly recommended to have 'git' installed for compilation although it is no build dependency. In case of a missing git installation, the string "! version not set !" is compiled into the application.
**/

View File

@@ -24,7 +24,7 @@
*/
/**
* @addtogroup MainApplication
* @addtogroup external-renderer
* @{
*/

View File

@@ -23,7 +23,7 @@
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/** @addtogroup MainApplication
/** @addtogroup GUI
* @{
*/
@@ -145,6 +145,7 @@ static void on_load_gds(gpointer button, gpointer user)
"Open GDSII", GTK_RESPONSE_ACCEPT,
NULL);
file_chooser = GTK_FILE_CHOOSER(open_dialog);
/* Add GDS II Filter */
filter = gtk_file_filter_new();
gtk_file_filter_add_pattern(filter, "*.gds");
@@ -297,6 +298,7 @@ static void on_convert_clicked(gpointer button, gpointer user)
renderer_settings_dialog_set_database_unit_scale(settings, cell_to_render->parent_library->unit_in_meters);
renderer_settings_dialog_set_cell_height(settings, height);
renderer_settings_dialog_set_cell_width(settings, width);
g_object_set(G_OBJECT(settings), "cell-name", cell_to_render->name, NULL);
res = gtk_dialog_run(GTK_DIALOG(settings));
if (res == GTK_RESPONSE_OK) {

View File

@@ -24,7 +24,7 @@
*/
/**
* @addtogroup MainApplication
* @addtogroup cmdline
* @{
*/

View File

@@ -24,7 +24,7 @@
*/
/**
* @addtogroup MainApplication
* @addtogroup external-renderer
* @{
*/

View File

@@ -27,7 +27,7 @@
#define _GDS_RENDER_GUI_
/**
* @addtogroup MainApplication
* @addtogroup GUI
* @{
*/

View File

@@ -69,8 +69,8 @@ struct gds_point {
* @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*/
int unresolved_child_count; /**< @brief Number of unresolved cell instances inside this cell. Default: @ref 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: @ref GDS_CELL_CHECK_NOT_RUN*/
/**
* @brief For the internal use of the checker.
* @warning Do not use this structure and its contents!

View File

@@ -18,7 +18,7 @@
*/
/**
* @file layer-info.c
* @file layer-info.h
* @brief Helper functions and definition of layer info struct
* @author Mario Hüttel <mario.huettel@gmx.net>
*/

View File

@@ -23,6 +23,11 @@
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/**
* @addtogroup layer-selector
* @{
*/
#ifndef __LAYER_SELECTOR_H__
#define __LAYER_SELECTOR_H__
@@ -88,3 +93,5 @@ void layer_selector_force_sort(LayerSelector *selector, enum layer_selector_sort
G_END_DECLS
#endif /* __LAYER_SELECTOR_H__ */
/** @} */

View File

@@ -27,7 +27,7 @@
#define __MAPPING_PARSER_H__
/**
* @addtogroup MainApplication
* @addtogroup Mapping-Parser
* @{
*/

View File

@@ -17,6 +17,17 @@
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file lib-cell-renderer.h
* @brief Header file for the LibCellRenderer GObject Class
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/**
* @addtogroup LibCellRenderer
* @{
*/
#ifndef __LIB_CELL_RENDERER_H__
#define __LIB_CELL_RENDERER_H__
@@ -27,8 +38,12 @@ 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())
/** @{
* Error levels
*/
#define LIB_CELL_RENDERER_ERROR_WARN (1U<<0)
#define LIB_CELL_RENDERER_ERROR_ERR (1U<<1)
/** @} */
typedef struct _LibCellRenderer {
/* Inheritance */
@@ -36,9 +51,20 @@ typedef struct _LibCellRenderer {
/* Custom Elements */
} LibCellRenderer;
/**
* @brief lib_cell_renderer_get_type
* @return GObject Type
*/
GType lib_cell_renderer_get_type(void);
/**
* @brief Create a new renderer for renderering @ref gds_cell and @ref gds_library elements.
* @return New renderer object
*/
GtkCellRenderer *lib_cell_renderer_new(void);
G_END_DECLS
#endif /* __LIB_CELL_RENDERER_H__ */
/** @} */

View File

@@ -24,7 +24,7 @@
*/
/**
* @addtogroup MainApplication
* @addtogroup GUI
* @{
*/

View File

@@ -18,11 +18,11 @@
*/
/**
* @addtogroup MainApplication
* @addtogroup version
* @{
*/
/** @brief This string holds the 'git describe' version of the app */
extern char *_app_version_string;
/** @brief This string holds the @ref git-version-num of the app */
extern const char *_app_version_string;
/** @} */

View File

@@ -23,11 +23,6 @@
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/**
* @addtogroup MainApplication
* @{
*/
#include <gds-render/layer/layer-info.h>
void layer_info_delete_struct(struct layer_info *info)
@@ -36,4 +31,3 @@ void layer_info_delete_struct(struct layer_info *info)
free(info);
}
/** @} */

View File

@@ -24,7 +24,7 @@
*/
/**
* @addtogroup MainApplication
* @addtogroup layer-selector
* @{
*/
@@ -101,7 +101,8 @@ static void sel_layer_element_drag_end(GtkWidget *widget, GdkDragContext *contex
gtk_style_context_remove_class(gtk_widget_get_style_context(row), "drag-hover");
}
static void sel_layer_element_drag_data_get(GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection_data,
static void sel_layer_element_drag_data_get(GtkWidget *widget, GdkDragContext *context,
GtkSelectionData *selection_data,
guint info, guint time, gpointer data)
{
(void)context;
@@ -216,10 +217,12 @@ static gboolean layer_selector_drag_motion(GtkWidget *widget, GdkDragContext *co
if (y < hover_row_y + hover_row_height/2) {
row_after = row;
row_before = GTK_WIDGET(layer_selector_get_row_before(GTK_LIST_BOX(widget), GTK_LIST_BOX_ROW(row)));
row_before = GTK_WIDGET(layer_selector_get_row_before(GTK_LIST_BOX(widget),
GTK_LIST_BOX_ROW(row)));
} else {
row_before = row;
row_after = GTK_WIDGET(layer_selector_get_row_after(GTK_LIST_BOX(widget), GTK_LIST_BOX_ROW(row)));
row_after = GTK_WIDGET(layer_selector_get_row_after(GTK_LIST_BOX(widget),
GTK_LIST_BOX_ROW(row)));
}
} else {
row_before = GTK_WIDGET(layer_selector_get_last_row(GTK_LIST_BOX(widget)));

View File

@@ -25,7 +25,7 @@
*/
/**
* @addtogroup MainApplication
* @addtogroup Mapping-Parser
* @{
*/

70
main.c
View File

@@ -17,6 +17,12 @@
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file main.c
* @brief main.c
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
#include <stdio.h>
#include <gtk/gtk.h>
#include <glib.h>
@@ -26,11 +32,27 @@
#include <gds-render/external-renderer.h>
#include <gds-render/version.h>
/**
* @brief Structure containing The GtkApplication and a list containing the GdsRenderGui objects.
*/
struct application_data {
GtkApplication *app;
GList *gui_list;
};
/**
* @brief Callback for the menu entry 'Quit'
*
* Destroys all GUIs contained in the application_data structure
* provided by \p user_data.
*
* The complete suspension of all main windows leads to the termination of the
* GApplication.
*
* @param action unused
* @param parameter unused
* @param user_data application_data structure
*/
static void app_quit(GSimpleAction *action, GVariant *parameter, gpointer user_data)
{
struct application_data * const appdata = (struct application_data *)user_data;
@@ -49,6 +71,15 @@ static void app_quit(GSimpleAction *action, GVariant *parameter, gpointer user_d
appdata->gui_list = NULL;
}
/**
* @brief Callback for the 'About' menu entry
*
* This function shows the about dialog.
*
* @param action GSimpleAction, unused
* @param parameter Unused.
* @param user_data Unused
*/
static void app_about(GSimpleAction *action, GVariant *parameter, gpointer user_data)
{
GtkBuilder *builder;
@@ -83,11 +114,23 @@ static void app_about(GSimpleAction *action, GVariant *parameter, gpointer user_
g_object_unref(builder);
}
/**
* @brief Contains the application menu entries
*/
const static GActionEntry app_actions[] = {
{"quit", app_quit, NULL, NULL, NULL, {0}},
{"about", app_about, NULL, NULL, NULL, {0}}
};
/**
* @brief Called when a GUI main window is closed
*
* The GdsRenderGui object associated with the closed main window
* is removed from the list of open GUIs (\p user_data) and unreferenced.
*
* @param gui The GUI instance the closed main window belongs to
* @param user_data List of GUIs
*/
static void gui_window_closed_callback(GdsRenderGui *gui, gpointer user_data)
{
GList **gui_list = (GList **)user_data;
@@ -97,6 +140,11 @@ static void gui_window_closed_callback(GdsRenderGui *gui, gpointer user_data)
g_object_unref(gui);
}
/**
* @brief Activation of the GUI
* @param app The GApplication reference
* @param user_data Used to store the individual GUI instances.
*/
static void gapp_activate(GApplication *app, gpointer user_data)
{
GtkWindow *main_window;
@@ -115,6 +163,17 @@ static void gapp_activate(GApplication *app, gpointer user_data)
gtk_widget_show(GTK_WIDGET(main_window));
}
/**
* @brief Start the graphical interface.
*
* This function starts the GUI. If there's already a
* running instance of this program, a second window will be
* created in that instance and the second one is terminated.
*
* @param argc
* @param argv
* @return
*/
static int start_gui(int argc, char **argv)
{
@@ -160,12 +219,21 @@ static int start_gui(int argc, char **argv)
return app_status;
}
static void print_version()
/**
* @brief Print the application version string to stdout
*/
static void print_version(void)
{
printf("This is gds-render, version: %s\n\nFor a list of supported commands execute with --help option.\n",
_app_version_string);
}
/**
* @brief The "entry point" of the application
* @param argc Number of command line parameters
* @param argv Command line parameters
* @return Execution status of the application
*/
int main(int argc, char **argv)
{
int i;

View File

@@ -17,6 +17,17 @@
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file lib-cell-renderer.c
* @brief LibCellRenderer GObject Class
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/**
* @addtogroup LibCellRenderer
* @{
*/
#include <gds-render/tree-renderer/lib-cell-renderer.h>
#include <gds-render/gds-utils/gds-types.h>
@@ -107,11 +118,12 @@ static void lib_cell_renderer_get_property(GObject *object,
}
}
static GParamSpec *properties [PROP_COUNT];
static GParamSpec *properties[PROP_COUNT];
void lib_cell_renderer_class_init(LibCellRendererClass *klass)
{
GObjectClass *oclass = G_OBJECT_CLASS(klass);
oclass->constructed = lib_cell_renderer_constructed;
oclass->set_property = lib_cell_renderer_set_property;
oclass->get_property = lib_cell_renderer_get_property;
@@ -132,3 +144,5 @@ GtkCellRenderer *lib_cell_renderer_new()
{
return GTK_CELL_RENDERER(g_object_new(TYPE_LIB_CELL_RENDERER, NULL));
}
/** @} */

View File

@@ -24,7 +24,7 @@
*/
/**
* @addtogroup MainApplication
* @addtogroup GUI
* @{
*/

View File

@@ -1 +1 @@
git describe --tags
git describe --tags --dirty

View File

@@ -17,8 +17,11 @@
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @addtogroup MainApplication
* @defgroup version Version Number
* See @ref git-version-num
* @addtogroup version
* @{
*/

View File

@@ -54,10 +54,60 @@ struct _RendererSettingsDialog {
G_DEFINE_TYPE(RendererSettingsDialog, renderer_settings_dialog, GTK_TYPE_DIALOG)
enum {
PROP_CELL_NAME = 1,
PROP_COUNT
};
static GParamSpec *properties[PROP_COUNT];
static void renderer_settings_dialog_set_property(GObject *object, guint property_id,
const GValue *value, GParamSpec *pspec)
{
const gchar *title = NULL;
switch (property_id) {
case PROP_CELL_NAME:
title = g_value_get_string(value);
if (title)
gtk_window_set_title(GTK_WINDOW(object), title);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
break;
}
}
static void renderer_settings_dialog_get_property(GObject *object, guint property_id,
GValue *value, GParamSpec *pspec)
{
const gchar *title;
switch (property_id) {
case PROP_CELL_NAME:
title = gtk_window_get_title(GTK_WINDOW(object));
g_value_set_string(value, title);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
break;
}
}
static void renderer_settings_dialog_class_init(RendererSettingsDialogClass *klass)
{
/* No special code needed. Child cells are destroyed automatically due to reference counter */
return;
GObjectClass *oclass = G_OBJECT_CLASS(klass);
/* Override virtual functions */
oclass->set_property = renderer_settings_dialog_set_property;
oclass->get_property = renderer_settings_dialog_get_property;
properties[PROP_CELL_NAME] = g_param_spec_string("cell-name",
"cell-name",
"Cell name to be displayed in header bar",
"",
G_PARAM_READWRITE);
g_object_class_install_properties(oclass, PROP_COUNT, properties);
}
static void show_tex_options(RendererSettingsDialog *self)
@@ -141,6 +191,10 @@ static double convert_number_to_engineering(double input, const char **out_prefi
1E2, 1E3, 1E6, 1E9, 1E12, 1E15, 1E18, 1E21, 1E24};
const int prefix_count = (int)(sizeof(prefixes)/sizeof(char *));
/* If pointer is invalid, return NaN */
if (!out_prefix)
return 0.0 / 0.0;
/* Start with the 2nd smallest prefix */
for (idx = 1; idx < prefix_count; idx++) {
if (input < scale[idx]) {