From a2bc980c64df42a6ff75dded79876af661a8cdbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Thu, 19 Jul 2018 15:47:57 +0200 Subject: [PATCH] dialog implementation --- glade/dialog.glade | 158 +++++++++------------------------ widgets/conv-settings-dialog.c | 48 ++++++++++ widgets/conv-settings-dialog.h | 39 ++++++++ widgets/layer-element.h | 4 +- 4 files changed, 132 insertions(+), 117 deletions(-) create mode 100644 widgets/conv-settings-dialog.c create mode 100644 widgets/conv-settings-dialog.h diff --git a/glade/dialog.glade b/glade/dialog.glade index 048f2c6..88a35a1 100644 --- a/glade/dialog.glade +++ b/glade/dialog.glade @@ -9,125 +9,53 @@ 10 1000 - + True False - gtk-save - - - False - Render Options - dialog + vertical - - - - - False - vertical - 2 - - - False - end - - - Cancel - True - True - True - - - True - True - 0 - - - - - Convert - True - True - True - image1 - True - - - True - True - 1 - - - - - False - False - 0 - - - - - True - False - Please select Render Engine and Output Scale - - - False - True - 0 - - - - - Generate laTeX/TikZ Code - True - True - False - True - True - cairo-radio - - - False - True - 1 - - - - - Generate PDF using Cairographics - True - True - False - True - True - - - False - True - 2 - - - - - True - True - adjustment1 - 0 - 0 - left - - - False - True - 3 - - + + Generate LaTeX/TikZ output + True + True + False + True + True + + False + True + 0 + + + + + Render PDF using Cairographics + True + True + False + True + True + latex-radio + + + False + True + 1 + + + + + True + True + adjustment1 + 1 + + + False + True + 2 + - - button1 - button2 - diff --git a/widgets/conv-settings-dialog.c b/widgets/conv-settings-dialog.c new file mode 100644 index 0000000..d68f515 --- /dev/null +++ b/widgets/conv-settings-dialog.c @@ -0,0 +1,48 @@ +/* + * GDSII-Converter + * Copyright (C) 2018 Mario Hüttel + * + * 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 . + */ + +#include "conv-settings-dialog.h" + +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 renderer_settings_dialog_init(RendererSettingsDialog *self) +{ + GtkBuilder *builder; + GtkBox *box; + GtkDialog *dialog; + + dialog = &(self->parent); + + builder = gtk_builder_new_from_resource("/dialog.glade"); + box = GTK_BOX(gtk_builder_get_object(builder, "dialog-box")); + gtk_dialog_add_buttons(dialog, "Cancel", GTK_RESPONSE_CANCEL, "OK", GTK_RESPONSE_OK, NULL); + gtk_container_add(GTK_CONTAINER(dialog), box); + g_object_unref(builder); +} + +GtkWidget *renderer_settings_dialog_new(void) +{ + return (GtkWidget *) g_object_new(RENDERER_TYPE_SETTINGS_DIALOG, NULL); +} diff --git a/widgets/conv-settings-dialog.h b/widgets/conv-settings-dialog.h new file mode 100644 index 0000000..cb61916 --- /dev/null +++ b/widgets/conv-settings-dialog.h @@ -0,0 +1,39 @@ +/* + * GDSII-Converter + * Copyright (C) 2018 Mario Hüttel + * + * 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 . + */ + +#ifndef __CONV_SETTINGS_DIALOG_H__ +#define __CONV_SETTINGS_DIALOG_H__ + +#include + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(RendererSettingsDialog, renderer_settings_dialog, RENDERER, SETTINGS_DIALOG, GtkDialog) + +GtkWidget *renderer_settings_dialog_new(void); + +struct _RendererSettingsDialog { + GtkDialog parent; +}; + +#define RENDERER_TYPE_SETTINGS_DIALOG (renderer_settings_dialog_get_type()) + +G_END_DECLS + +#endif /* __CONV_SETTINGS_DIALOG_H__ */ diff --git a/widgets/layer-element.h b/widgets/layer-element.h index 4c98de3..7434ffb 100644 --- a/widgets/layer-element.h +++ b/widgets/layer-element.h @@ -38,12 +38,12 @@ typedef struct _LayerElementPriv { GtkCheckButton *export; } LayerElementPriv; -typedef struct _LayerElement { +struct _LayerElement { /* Inheritance */ GtkListBoxRow parent; /* Custom Elements */ LayerElementPriv priv; -} LayerElement; +}; GtkWidget *layer_element_new(void);