Compare commits
No commits in common. "9a6aee1410913ce169e4a359596daae2aad35332" and "35d10a5a24bfb2b5c6c2016680b8f0351992b6c1" have entirely different histories.
9a6aee1410
...
35d10a5a24
@ -15,48 +15,63 @@
|
|||||||
<property name="subtitle" translatable="yes">GDSII to PDF Converter</property>
|
<property name="subtitle" translatable="yes">GDSII to PDF Converter</property>
|
||||||
<property name="show_close_button">True</property>
|
<property name="show_close_button">True</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="button-load-gds">
|
<object class="GtkBox">
|
||||||
<property name="label">gtk-open</property>
|
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="receives_default">True</property>
|
<child>
|
||||||
<property name="use_stock">True</property>
|
<object class="GtkButton" id="button-load-gds">
|
||||||
<property name="always_show_image">True</property>
|
<property name="label">gtk-open</property>
|
||||||
<style>
|
<property name="visible">True</property>
|
||||||
<class name="suggested-action"/>
|
<property name="can_focus">True</property>
|
||||||
</style>
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
<property name="always_show_image">True</property>
|
||||||
|
<style>
|
||||||
|
<class name="suggested-action"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="button-load-mapping">
|
||||||
|
<property name="label" translatable="yes">Load Mapping</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="sensitive">False</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<style>
|
||||||
|
<class name="destructive-action"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="button-save-mapping">
|
||||||
|
<property name="label" translatable="yes">Save Mapping</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="sensitive">False</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<style>
|
||||||
|
<class name="suggested-action"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkButton" id="button-load-mapping">
|
|
||||||
<property name="label" translatable="yes">Load Mapping</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="sensitive">False</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">True</property>
|
|
||||||
<style>
|
|
||||||
<class name="destructive-action"/>
|
|
||||||
</style>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkButton" id="button-save-mapping">
|
|
||||||
<property name="label" translatable="yes">Save Mapping</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="sensitive">False</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">True</property>
|
|
||||||
<style>
|
|
||||||
<class name="suggested-action"/>
|
|
||||||
</style>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="position">2</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -62,7 +62,7 @@ static void layer_element_init(LayerElement *self)
|
|||||||
|
|
||||||
GtkWidget *layer_element_new(void)
|
GtkWidget *layer_element_new(void)
|
||||||
{
|
{
|
||||||
return GTK_WIDGET(g_object_new(TYPE_LAYER_ELEMENT, NULL));
|
return GTK_WIDGET(g_object_new(layer_element_get_type(), NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *layer_element_get_name(LayerElement *elem)
|
const char *layer_element_get_name(LayerElement *elem)
|
||||||
|
@ -21,13 +21,11 @@
|
|||||||
#define __LAYER_ELEMENT_H__
|
#define __LAYER_ELEMENT_H__
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
// #include <gdk/gdk.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
#define LAYER_ELEMENT(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, layer_element_get_type(), LayerElement)
|
||||||
|
#define LAYER_ELEMENT_CLASS(klass) G_TYPE_CHECK_CLASS_CAST(klass, layer_element_get_type(), LayerElementClass)
|
||||||
/* Creates Class structure etc */
|
#define IS_LAYER_ELEMENT(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, layer_element_get_type())
|
||||||
G_DECLARE_FINAL_TYPE(LayerElement, layer_element, LAYER, ELEMENT, GtkBox)
|
|
||||||
|
|
||||||
#define TYPE_LAYER_ELEMENT (layer_element_get_type())
|
|
||||||
|
|
||||||
typedef struct _LayerElementPriv {
|
typedef struct _LayerElementPriv {
|
||||||
GtkEntry *name;
|
GtkEntry *name;
|
||||||
@ -44,6 +42,12 @@ typedef struct _LayerElement {
|
|||||||
LayerElementPriv priv;
|
LayerElementPriv priv;
|
||||||
} LayerElement;
|
} LayerElement;
|
||||||
|
|
||||||
|
typedef struct _LayerElementClass {
|
||||||
|
GtkBoxClass parent_class;
|
||||||
|
} LayerElementClass;
|
||||||
|
|
||||||
|
|
||||||
|
GType layer_element_get_type(void);
|
||||||
GtkWidget *layer_element_new(void);
|
GtkWidget *layer_element_new(void);
|
||||||
|
|
||||||
const char *layer_element_get_name(LayerElement *elem);
|
const char *layer_element_get_name(LayerElement *elem);
|
||||||
@ -55,6 +59,4 @@ gboolean layer_element_get_export(LayerElement *elem);
|
|||||||
void layer_element_get_color(LayerElement *elem, GdkRGBA *rgba);
|
void layer_element_get_color(LayerElement *elem, GdkRGBA *rgba);
|
||||||
void layer_element_set_color(LayerElement *elem, GdkRGBA *rgba);
|
void layer_element_set_color(LayerElement *elem, GdkRGBA *rgba);
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __LAYER_ELEMENT_H__ */
|
#endif /* __LAYER_ELEMENT_H__ */
|
||||||
|
77
main.c
77
main.c
@ -23,7 +23,16 @@
|
|||||||
#include <layer-element.h>
|
#include <layer-element.h>
|
||||||
#include "layer-selector.h"
|
#include "layer-selector.h"
|
||||||
#include "tree-renderer/lib-cell-renderer.h"
|
#include "tree-renderer/lib-cell-renderer.h"
|
||||||
#include "tree-renderer/tree-store.h"
|
|
||||||
|
|
||||||
|
enum cell_store_columns {
|
||||||
|
LIBRARY,
|
||||||
|
CELL,
|
||||||
|
MODDATE,
|
||||||
|
ACCESSDATE,
|
||||||
|
STORE_COLUMN_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct open_button_data {
|
struct open_button_data {
|
||||||
GtkWindow *main_window;
|
GtkWindow *main_window;
|
||||||
@ -114,9 +123,9 @@ void on_load_gds(gpointer button, gpointer user)
|
|||||||
acc_date = generate_string_from_date(&gds_lib->access_time);
|
acc_date = generate_string_from_date(&gds_lib->access_time);
|
||||||
|
|
||||||
gtk_tree_store_set (store, &libiter,
|
gtk_tree_store_set (store, &libiter,
|
||||||
CELL_SEL_LIBRARY, gds_lib,
|
LIBRARY, gds_lib,
|
||||||
CELL_SEL_MODDATE, mod_date->str,
|
MODDATE, mod_date->str,
|
||||||
CELL_SEL_ACCESSDATE, acc_date->str,
|
ACCESSDATE, acc_date->str,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
/* Delete GStrings including string data. */
|
/* Delete GStrings including string data. */
|
||||||
@ -133,9 +142,9 @@ void on_load_gds(gpointer button, gpointer user)
|
|||||||
acc_date = generate_string_from_date(&gds_c->access_time);
|
acc_date = generate_string_from_date(&gds_c->access_time);
|
||||||
|
|
||||||
gtk_tree_store_set (store, &celliter,
|
gtk_tree_store_set (store, &celliter,
|
||||||
CELL_SEL_CELL, gds_c,
|
CELL, gds_c,
|
||||||
CELL_SEL_MODDATE, mod_date->str,
|
MODDATE, mod_date->str,
|
||||||
CELL_SEL_ACCESSDATE, acc_date->str,
|
ACCESSDATE, acc_date->str,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
/* Delete GStrings including string data. */
|
/* Delete GStrings including string data. */
|
||||||
@ -154,11 +163,63 @@ end_destroy:
|
|||||||
gtk_widget_destroy(open_dialog);
|
gtk_widget_destroy(open_dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_convert_clicked(gpointer button, gpointer user)
|
void on_convert_clicked(gpointer button, gpointer user)
|
||||||
{
|
{
|
||||||
printf("convert\n");
|
printf("convert\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GtkTreeStore * setup_cell_selector(GtkTreeView* view)
|
||||||
|
{
|
||||||
|
GtkTreeStore *cell_store;
|
||||||
|
|
||||||
|
GtkCellRenderer *render_dates;
|
||||||
|
GtkCellRenderer *render_cell;
|
||||||
|
GtkCellRenderer *render_lib;
|
||||||
|
GtkTreeViewColumn *column;
|
||||||
|
GdkRGBA cell_text_color;
|
||||||
|
GValue val = G_VALUE_INIT;
|
||||||
|
|
||||||
|
cell_store = gtk_tree_store_new(STORE_COLUMN_COUNT, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_STRING);
|
||||||
|
gtk_tree_view_set_model(view, GTK_TREE_MODEL(cell_store));
|
||||||
|
|
||||||
|
render_dates = gtk_cell_renderer_text_new();
|
||||||
|
render_cell = lib_cell_renderer_new();
|
||||||
|
render_lib = lib_cell_renderer_new();
|
||||||
|
|
||||||
|
/* Set foreground color for cell column */
|
||||||
|
cell_text_color.alpha = 1;
|
||||||
|
cell_text_color.red = (double)61.0/(double)255.0;
|
||||||
|
cell_text_color.green = (double)152.0/(double)255.0;
|
||||||
|
cell_text_color.blue = 0.0;
|
||||||
|
|
||||||
|
g_value_init(&val, G_TYPE_BOOLEAN);
|
||||||
|
g_value_set_boolean(&val, TRUE);
|
||||||
|
g_object_set_property(G_OBJECT(render_cell), "foreground-set", &val);
|
||||||
|
g_value_unset(&val);
|
||||||
|
|
||||||
|
g_value_init(&val, GDK_TYPE_RGBA);
|
||||||
|
g_value_set_boxed(&val, &cell_text_color);
|
||||||
|
g_object_set_property(G_OBJECT(render_cell), "foreground-rgba", &val);
|
||||||
|
g_value_unset(&val);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
column = gtk_tree_view_column_new_with_attributes("Library", render_lib, "gds-lib", LIBRARY, NULL);
|
||||||
|
gtk_tree_view_append_column(view, column);
|
||||||
|
|
||||||
|
/* Cell color: #3D9801 */
|
||||||
|
column = gtk_tree_view_column_new_with_attributes("Cell", render_cell, "gds-cell", CELL, NULL);
|
||||||
|
gtk_tree_view_append_column(view, column);
|
||||||
|
|
||||||
|
column = gtk_tree_view_column_new_with_attributes("Mod. Date", render_dates, "text", MODDATE, NULL);
|
||||||
|
gtk_tree_view_append_column(view, column);
|
||||||
|
|
||||||
|
column = gtk_tree_view_column_new_with_attributes("Acc. Date", render_dates, "text", ACCESSDATE, NULL);
|
||||||
|
gtk_tree_view_append_column(view, column);
|
||||||
|
|
||||||
|
return cell_store;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -20,11 +20,12 @@
|
|||||||
#ifndef __LIB_CELL_RENDERER_H__
|
#ifndef __LIB_CELL_RENDERER_H__
|
||||||
#define __LIB_CELL_RENDERER_H__
|
#define __LIB_CELL_RENDERER_H__
|
||||||
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
#define LIB_CELL_RENDERER(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, lib_cell_renderer_get_type(), LibCellRenderer)
|
||||||
|
#define LIB_CELL_RENDERER_CLASS(klass) G_TYPE_CHECK_CLASS_CAST(klass, lib_cell_renderer_get_type(), LibCellRendererClass)
|
||||||
G_DECLARE_FINAL_TYPE(LibCellRenderer, lib_cell_renderer, LIB_CELL, RENDERER, GtkCellRendererText)
|
#define IS_LIB_CELL_RENDERER(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, layer_element_get_type())
|
||||||
#define TYPE_LIB_CELL_RENDERER (lib_cell_renderer_get_type())
|
#define TYPE_LIB_CELL_RENDERER (lib_cell_renderer_get_type())
|
||||||
|
|
||||||
typedef struct _LibCellRenderer {
|
typedef struct _LibCellRenderer {
|
||||||
@ -33,9 +34,14 @@ typedef struct _LibCellRenderer {
|
|||||||
/* Custom Elements */
|
/* Custom Elements */
|
||||||
} LibCellRenderer;
|
} LibCellRenderer;
|
||||||
|
|
||||||
|
typedef struct _LibCellRendererClass {
|
||||||
|
GtkCellRendererTextClass parent;
|
||||||
|
} LibCellRendererClass;
|
||||||
|
|
||||||
|
|
||||||
GType lib_cell_renderer_get_type(void);
|
GType lib_cell_renderer_get_type(void);
|
||||||
GtkCellRenderer *lib_cell_renderer_new(void);
|
GtkCellRenderer *lib_cell_renderer_new(void);
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __LIB_CELL_RENDERER_H__ */
|
#endif /* __LIB_CELL_RENDERER_H__ */
|
||||||
|
@ -1,81 +0,0 @@
|
|||||||
#include "tree-store.h"
|
|
||||||
#include "lib-cell-renderer.h"
|
|
||||||
#include "../gds-types.h"
|
|
||||||
|
|
||||||
static gboolean tree_sel_func(GtkTreeSelection *selection,
|
|
||||||
GtkTreeModel *model,
|
|
||||||
GtkTreePath *path,
|
|
||||||
gboolean path_currently_selected,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
static int cnt = 0;
|
|
||||||
GtkTreeIter iter;
|
|
||||||
struct gds_cell *cell;
|
|
||||||
gchar *p;
|
|
||||||
|
|
||||||
gtk_tree_model_get_iter(model, &iter, path);
|
|
||||||
gtk_tree_model_get(model, &iter, CELL_SEL_CELL, &cell, -1);
|
|
||||||
|
|
||||||
/* Allow only rows with valid cell to be selected */
|
|
||||||
if (cell)
|
|
||||||
return TRUE;
|
|
||||||
else
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
GtkTreeStore *setup_cell_selector(GtkTreeView* view)
|
|
||||||
{
|
|
||||||
GtkTreeStore *cell_store;
|
|
||||||
|
|
||||||
GtkCellRenderer *render_dates;
|
|
||||||
GtkCellRenderer *render_cell;
|
|
||||||
GtkCellRenderer *render_lib;
|
|
||||||
GtkTreeViewColumn *column;
|
|
||||||
GdkRGBA cell_text_color;
|
|
||||||
GValue val = G_VALUE_INIT;
|
|
||||||
|
|
||||||
cell_store = gtk_tree_store_new(CELL_SEL_COLUMN_COUNT, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_STRING);
|
|
||||||
gtk_tree_view_set_model(view, GTK_TREE_MODEL(cell_store));
|
|
||||||
|
|
||||||
render_dates = gtk_cell_renderer_text_new();
|
|
||||||
render_cell = lib_cell_renderer_new();
|
|
||||||
render_lib = lib_cell_renderer_new();
|
|
||||||
|
|
||||||
/* Set foreground color for cell column */
|
|
||||||
cell_text_color.alpha = 1;
|
|
||||||
cell_text_color.red = (double)61.0/(double)255.0;
|
|
||||||
cell_text_color.green = (double)152.0/(double)255.0;
|
|
||||||
cell_text_color.blue = 0.0;
|
|
||||||
|
|
||||||
g_value_init(&val, G_TYPE_BOOLEAN);
|
|
||||||
g_value_set_boolean(&val, TRUE);
|
|
||||||
g_object_set_property(G_OBJECT(render_cell), "foreground-set", &val);
|
|
||||||
g_value_unset(&val);
|
|
||||||
|
|
||||||
g_value_init(&val, GDK_TYPE_RGBA);
|
|
||||||
g_value_set_boxed(&val, &cell_text_color);
|
|
||||||
g_object_set_property(G_OBJECT(render_cell), "foreground-rgba", &val);
|
|
||||||
g_value_unset(&val);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
column = gtk_tree_view_column_new_with_attributes("Library", render_lib, "gds-lib", CELL_SEL_LIBRARY, NULL);
|
|
||||||
gtk_tree_view_append_column(view, column);
|
|
||||||
|
|
||||||
/* Cell color: #3D9801 */
|
|
||||||
column = gtk_tree_view_column_new_with_attributes("Cell", render_cell, "gds-cell", CELL_SEL_CELL, NULL);
|
|
||||||
gtk_tree_view_append_column(view, column);
|
|
||||||
|
|
||||||
column = gtk_tree_view_column_new_with_attributes("Mod. Date", render_dates, "text", CELL_SEL_MODDATE, NULL);
|
|
||||||
gtk_tree_view_append_column(view, column);
|
|
||||||
|
|
||||||
column = gtk_tree_view_column_new_with_attributes("Acc. Date", render_dates, "text", CELL_SEL_ACCESSDATE, NULL);
|
|
||||||
gtk_tree_view_append_column(view, column);
|
|
||||||
|
|
||||||
/* Callback for selection
|
|
||||||
* This prevents selecting a library */
|
|
||||||
gtk_tree_selection_set_select_function(gtk_tree_view_get_selection(view), tree_sel_func, NULL, NULL);
|
|
||||||
|
|
||||||
return cell_store;
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
#ifndef __TREE_STORE_H__
|
|
||||||
#define __TREE_STORE_H__
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
enum cell_store_columns {
|
|
||||||
CELL_SEL_LIBRARY = 0,
|
|
||||||
CELL_SEL_CELL,
|
|
||||||
CELL_SEL_MODDATE,
|
|
||||||
CELL_SEL_ACCESSDATE,
|
|
||||||
CELL_SEL_COLUMN_COUNT
|
|
||||||
};
|
|
||||||
|
|
||||||
GtkTreeStore *setup_cell_selector(GtkTreeView* view);
|
|
||||||
|
|
||||||
#endif /* __TREE_STORE_H__ */
|
|
Loading…
Reference in New Issue
Block a user