Doxygen Header created

This commit is contained in:
Mario Hüttel 2018-07-24 18:47:29 +02:00
parent 5526e403a3
commit c502b65297
6 changed files with 215 additions and 8 deletions

View File

@ -17,6 +17,17 @@
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file command-line.c
* @brief Function to render according to command line parameters
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/**
* @addtogroup MainApplication
* @{
*/
#include <stdio.h>
#include "command-line.h"
#include "gds-parser/gds-parser.h"
@ -24,6 +35,12 @@
#include "cairo-output/cairo-output.h"
#include "latex-output/latex-output.h"
/**
* @brief Delete layer_info and free nem element.
*
* Like delete_layer_info_struct() but also frees layer_info::name
* @param info
*/
static void delete_layer_info_with_name(struct layer_info *info)
{
if (info) {
@ -33,6 +50,19 @@ static void delete_layer_info_with_name(struct layer_info *info)
}
}
/**
* @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 standalone
*/
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)
{
@ -135,3 +165,5 @@ destroy_file:
}
/** @} */

View File

@ -17,6 +17,17 @@
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file command-line.c
* @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>
@ -25,3 +36,5 @@ void command_line_convert_gds(char *gds_name, char *pdf_name, char *tex_name, gb
char *layer_file, char *cell_name, double scale, gboolean pdf_layers, gboolean pdf_standalone);
#endif /* _COMMAND_LINE_H_ */
/** @} */

View File

@ -17,6 +17,17 @@
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file layer-selection.c
* @brief Implementation of the layer selector
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/**
* @addtogroup MainApplication
* @{
*/
#include "layer-selector.h"
#include "gds-parser/gds-parser.h"
#include "widgets/layer-element.h"
@ -89,6 +100,11 @@ void clear_list_box_widgets(GtkListBox *box)
gtk_widget_set_sensitive(global_save_button, FALSE);
}
/**
* @brief Check if specific layer number is present in list box
* @param layer Layer nu,ber
* @return TRUE if present
*/
static gboolean check_if_layer_widget_exists(int layer) {
GList *list;
GList *temp;
@ -110,6 +126,11 @@ static gboolean check_if_layer_widget_exists(int layer) {
return ret;
}
/**
* @brief Analyze \p cell and append used layers to list box
* @param listbox listbox to add layer
* @param cell Cell to analyze
*/
static void analyze_cell_layers(GtkListBox *listbox, struct gds_cell *cell)
{
GList *graphics;
@ -129,7 +150,15 @@ static void analyze_cell_layers(GtkListBox *listbox, struct gds_cell *cell)
}
}
gint sort_func(GtkListBoxRow *row1, GtkListBoxRow *row2, gpointer unused)
/**
* @brief sort_func Sort callback for list box
* @param row1
* @param row2
* @param unused
* @note Do not use this function
* @return
*/
static gint sort_func(GtkListBoxRow *row1, GtkListBoxRow *row2, gpointer unused)
{
LayerElement *le1, *le2;
gint ret;
@ -170,6 +199,12 @@ void generate_layer_widgets(GtkListBox *listbox, GList *libs)
gtk_widget_set_sensitive(global_save_button, TRUE);
}
/**
* @brief Find LayerElement in list with specified layer number
* @param el_list List with elements of type LayerElement
* @param layer Layer number
* @return Found LayerElement. If nothing is found, NULL.
*/
static LayerElement *find_layer_element_in_list(GList *el_list, int layer)
{
LayerElement *ret = NULL;
@ -182,6 +217,10 @@ static LayerElement *find_layer_element_in_list(GList *el_list, int layer)
return ret;
}
/**
* @brief Load file and apply layer definitions to listbox
* @param file_name CSV Layer Mapping File
*/
static void load_layer_mapping_from_file(gchar *file_name)
{
GFile *file;
@ -252,6 +291,11 @@ destroy_file:
g_object_unref(file);
}
/**
* @brief Callback for Load Mapping Button
* @param button
* @param user_data
*/
static void load_mapping_clicked(GtkWidget *button, gpointer user_data)
{
GtkWidget *dialog;
@ -269,6 +313,12 @@ static void load_mapping_clicked(GtkWidget *button, gpointer user_data)
gtk_widget_destroy(dialog);
}
/**
* @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
*/
static void create_csv_line(LayerElement *layer_element, char *line_buffer, size_t max_len)
{
GString *string;
@ -304,6 +354,11 @@ static void create_csv_line(LayerElement *layer_element, char *line_buffer, size
g_string_free(string, TRUE);
}
/**
* @brief Save layer mapping of whole list box into file
* @param file_name layer mapping file
* @param list_box listbox
*/
static void save_layer_mapping_data(const gchar *file_name, GtkListBox *list_box)
{
FILE *file;
@ -331,6 +386,11 @@ static void save_layer_mapping_data(const gchar *file_name, GtkListBox *list_box
fclose(file);
}
/**
* @brief Callback for Save Layer Mapping Button
* @param button
* @param user_data
*/
static void save_mapping_clicked(GtkWidget *button, gpointer user_data)
{
GtkWidget *dialog;
@ -361,3 +421,5 @@ void setup_save_mapping_callback(GtkWidget *button, GtkWindow *main_window)
global_save_button = button;
g_signal_connect(button, "clicked", G_CALLBACK(save_mapping_clicked), main_window);
}
/** @} */

View File

@ -17,6 +17,12 @@
* 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__
@ -24,10 +30,38 @@
#include <glib.h>
#include "mapping-parser.h"
/**
* @brief Generate layer widgets in \p listbox
* @note This clears all previously inserted elements
* @param listbox
* @param libs The library to add
*/
void generate_layer_widgets(GtkListBox *listbox, GList *libs);
void setup_load_mapping_callback(GtkWidget *button, GtkWindow *main_window);
void setup_save_mapping_callback(GtkWidget *button, GtkWindow *main_window);
GList *export_rendered_layer_info();
void delete_layer_info_struct(struct layer_info *info);
/**
* @brief Supply button for loading the layer mapping
* @param button
* @param main_window Parent window for dialogs
*/
void setup_load_mapping_callback(GtkWidget *button, GtkWindow *main_window);
/**
* @brief Supply button for saving the layer mapping
* @param button
* @param main_window
*/
void setup_save_mapping_callback(GtkWidget *button, GtkWindow *main_window);
/**
* @brief get the layer information present in the listbox of the selector
* @return List with layer_info elements
*/
GList *export_rendered_layer_info();
/**
* @brief Delete a layer_info struct
* @param info Struct to be deleted.
* @note The layer_info::name Element has to be freed manually
*/
void delete_layer_info_struct(struct layer_info *info);
#endif /* __LAYER_SELECTOR_H__ */

View File

@ -17,6 +17,16 @@
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file main-window.c
* @brief Handling of GUI
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
/** @addtogroup MainApplication
* @{
*/
#include "main-window.h"
#include <stdio.h>
#include "gds-parser/gds-parser.h"
@ -27,6 +37,9 @@
#include "widgets/conv-settings-dialog.h"
#include "cairo-output/cairo-output.h"
/**
* @brief User data supplied to callback function of the open button
*/
struct open_button_data {
GtkWindow *main_window;
GList **list_ptr;
@ -34,17 +47,33 @@ struct open_button_data {
GtkListBox *layer_box;
};
/**
* @brief User data supplied to callback function of the convert button
*/
struct convert_button_data {
GtkTreeView *tree_view;
GtkWindow *main_window;
};
/**
* @brief Window close event of main window
*
* Closes the main window. This leads to the termination of the whole application
* @param window main window
* @param user not used
* @return TRUE. This indicates that the event has been fully handled
*/
static gboolean on_window_close(gpointer window, gpointer user)
{
gtk_widget_destroy(GTK_WIDGET(window));
return TRUE;
}
/**
* @brief generate string from gds_time_field
* @param date Date to convert
* @return String with date
*/
static GString *generate_string_from_date(struct gds_time_field *date)
{
GString *str;
@ -59,7 +88,11 @@ static GString *generate_string_from_date(struct gds_time_field *date)
return str;
}
/**
* @brief Callback function of Load GDS button
* @param button
* @param user Necessary Data
*/
static void on_load_gds(gpointer button, gpointer user)
{
GList *cell;
@ -161,6 +194,11 @@ end_destroy:
gtk_widget_destroy(open_dialog);
}
/**
* @brief Convert button callback
* @param button
* @param user
*/
static void on_convert_clicked(gpointer button, gpointer user)
{
static struct render_settings sett = {
@ -247,8 +285,15 @@ ret_layer_destroy:
g_list_free_full(layer_list, (GDestroyNotify)delete_layer_info_struct);
}
/* This function activates/deactivates the convert button depending on whether
* a cell is selected for conversion or not */
/**
* @brief Callback for cell-selection change event
*
* This function activates/deactivates the convert button depending on whether
* a cell is selected for conversion or not
* @param sel
* @param convert_button
*/
static void cell_selection_changed(GtkTreeSelection *sel, GtkWidget *convert_button)
{
GtkTreeModel *model = NULL;
@ -314,3 +359,5 @@ GtkWindow *create_main_window()
return (conv_data.main_window);
}
/** @} */

View File

@ -17,11 +17,30 @@
* along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file main-window.h
* @brief Header for main-window
* @author Mario Hüttel <mario.huettel@gmx.net>
*/
#ifndef _MAIN_WINDOW_H_
#define _MAIN_WINDOW_H_
/**
* @addtogroup MainApplication
* @{
*/
#include <gtk/gtk.h>
/**
* @brief Create main window
*
* This function creates the main window and sets the necessary callback routines.
* @return
*/
GtkWindow *create_main_window();
/** @} */
#endif /* _MAIN_WINDOW_H_ */