diff --git a/command-line.c b/command-line.c index c610df9..ceb90f6 100644 --- a/command-line.c +++ b/command-line.c @@ -17,6 +17,17 @@ * along with GDSII-Converter. If not, see . */ +/** + * @file command-line.c + * @brief Function to render according to command line parameters + * @author Mario Hüttel + */ + +/** + * @addtogroup MainApplication + * @{ + */ + #include #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: } + +/** @} */ diff --git a/command-line.h b/command-line.h index 143460e..eaa9de8 100644 --- a/command-line.h +++ b/command-line.h @@ -17,6 +17,17 @@ * along with GDSII-Converter. If not, see . */ +/** + * @file command-line.c + * @brief Render according to command line parameters + * @author Mario Hüttel + */ + +/** + * @addtogroup MainApplication + * @{ + */ + #ifndef _COMMAND_LINE_H_ #define _COMMAND_LINE_H_ #include @@ -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_ */ + +/** @} */ diff --git a/layer-selector.c b/layer-selector.c index 08e929c..6eb9e1a 100644 --- a/layer-selector.c +++ b/layer-selector.c @@ -17,6 +17,17 @@ * along with GDSII-Converter. If not, see . */ +/** + * @file layer-selection.c + * @brief Implementation of the layer selector + * @author Mario Hüttel + */ + +/** + * @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); } + +/** @} */ diff --git a/layer-selector.h b/layer-selector.h index 2338d18..0fd7c18 100644 --- a/layer-selector.h +++ b/layer-selector.h @@ -17,6 +17,12 @@ * along with GDSII-Converter. If not, see . */ +/** + * @file layer-selector.h + * @brief Implementation of the Layer selection list + * @author Mario Hüttel + */ + #ifndef __LAYER_SELECTOR_H__ #define __LAYER_SELECTOR_H__ @@ -24,10 +30,38 @@ #include #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__ */ diff --git a/main-window.c b/main-window.c index f700628..fabc19f 100644 --- a/main-window.c +++ b/main-window.c @@ -17,6 +17,16 @@ * along with GDSII-Converter. If not, see . */ +/** + * @file main-window.c + * @brief Handling of GUI + * @author Mario Hüttel + */ + +/** @addtogroup MainApplication + * @{ + */ + #include "main-window.h" #include #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); } + +/** @} */ diff --git a/main-window.h b/main-window.h index ec9a0a3..6799ec0 100644 --- a/main-window.h +++ b/main-window.h @@ -17,11 +17,30 @@ * along with GDSII-Converter. If not, see . */ +/** + * @file main-window.h + * @brief Header for main-window + * @author Mario Hüttel + */ + #ifndef _MAIN_WINDOW_H_ #define _MAIN_WINDOW_H_ +/** + * @addtogroup MainApplication + * @{ + */ + #include +/** + * @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_ */