From 18ec498d9996d85f5c3db9b6c14afd198d431534 Mon Sep 17 00:00:00 2001 From: Peter TB Brett Date: Mon, 26 Aug 2013 16:16:12 +0100 Subject: [PATCH] gschem: Add keybinding and menu entries for "Add Path" function. --- gschem/include/prototype.h | 2 ++ gschem/lib/system-gschemrc.scm | 2 ++ gschem/src/g_keys.c | 1 + gschem/src/g_register.c | 1 + gschem/src/i_callbacks.c | 14 ++++++++++++++ 5 files changed, 20 insertions(+) diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h index d384b9819..fbf4204f6 100644 --- a/gschem/include/prototype.h +++ b/gschem/include/prototype.h @@ -146,6 +146,7 @@ SCM g_keys_add_bus_hotkey(SCM rest); SCM g_keys_add_text(SCM rest); SCM g_keys_add_line(SCM rest); SCM g_keys_add_line_hotkey(SCM rest); +SCM g_keys_add_path (SCM rest); SCM g_keys_add_box(SCM rest); SCM g_keys_add_box_hotkey(SCM rest); SCM g_keys_add_picture(SCM rest); @@ -385,6 +386,7 @@ void i_callback_add_text(gpointer data, guint callback_action, GtkWidget *widget void i_callback_toolbar_add_text(GtkWidget *widget, gpointer data); void i_callback_add_line(gpointer data, guint callback_action, GtkWidget *widget); void i_callback_add_line_hotkey(gpointer data, guint callback_action, GtkWidget *widget); +void i_callback_add_path (gpointer data, guint callback_action, GtkWidget *widget); void i_callback_add_box(gpointer data, guint callback_action, GtkWidget *widget); void i_callback_add_box_hotkey(gpointer data, guint callback_action, GtkWidget *widget); void i_callback_add_picture(gpointer data, guint callback_action, GtkWidget *widget); diff --git a/gschem/lib/system-gschemrc.scm b/gschem/lib/system-gschemrc.scm index 4cfb02b51..593c66acc 100644 --- a/gschem/lib/system-gschemrc.scm +++ b/gschem/lib/system-gschemrc.scm @@ -921,6 +921,7 @@ (global-set-key "A U" 'add-bus-hotkey) (global-set-key "A T" 'add-text) (global-set-key "A L" 'add-line-hotkey) +(global-set-key "A H" 'add-path) (global-set-key "A B" 'add-box-hotkey) (global-set-key "A I" 'add-circle-hotkey) (global-set-key "A R" 'add-arc-hotkey) @@ -1219,6 +1220,7 @@ (,(N_ "_Text...") add-text add-text) ("SEPARATOR" #f #f) (,(N_ "_Line") add-line add-line-hotkey) + (,(N_ "Pat_h") add-path add-path) (,(N_ "_Box") add-box add-box-hotkey) (,(N_ "C_ircle") add-circle add-circle-hotkey) (,(N_ "A_rc") add-arc add-arc-hotkey) diff --git a/gschem/src/g_keys.c b/gschem/src/g_keys.c index a26108431..34ba105ae 100644 --- a/gschem/src/g_keys.c +++ b/gschem/src/g_keys.c @@ -185,6 +185,7 @@ DEFINE_G_KEYS(add_bus_hotkey) DEFINE_G_KEYS(add_text) DEFINE_G_KEYS(add_line) DEFINE_G_KEYS(add_line_hotkey) +DEFINE_G_KEYS(add_path) DEFINE_G_KEYS(add_box) DEFINE_G_KEYS(add_box_hotkey) DEFINE_G_KEYS(add_picture) diff --git a/gschem/src/g_register.c b/gschem/src/g_register.c index ec563ff2f..c3c341bfc 100644 --- a/gschem/src/g_register.c +++ b/gschem/src/g_register.c @@ -230,6 +230,7 @@ static struct gsubr_t gschem_funcs[] = { { "add-bus", 0, 0, 0, g_keys_add_bus }, { "add-bus-hotkey", 0, 0, 0, g_keys_add_bus_hotkey }, { "add-text", 0, 0, 0, g_keys_add_text }, + { "add-path", 0, 0, 0, g_keys_add_path }, { "add-line", 0, 0, 0, g_keys_add_line }, { "add-line-hotkey", 0, 0, 0, g_keys_add_line_hotkey }, { "add-box", 0, 0, 0, g_keys_add_box }, diff --git a/gschem/src/i_callbacks.c b/gschem/src/i_callbacks.c index f2b46f961..19499156a 100644 --- a/gschem/src/i_callbacks.c +++ b/gschem/src/i_callbacks.c @@ -2535,6 +2535,20 @@ DEFINE_I_CALLBACK(add_line_hotkey) i_set_state(w_current, ENDLINE); } +DEFINE_I_CALLBACK(add_path) +{ + GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL *) data; + + g_assert (w_current != NULL); + + o_redraw_cleanstates (w_current); + o_invalidate_rubber (w_current); + + i_update_middle_button (w_current, i_callback_add_path, _("Path")); + i_set_state (w_current, DRAWPATH); + w_current->inside_action = FALSE; +} + /*! \todo Finish function documentation!!! * \brief * \par Function Description -- 2.11.4.GIT