[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: g_keys.c
User: ahvezda
Date: 06/08/06 15:23:19
Modified: . g_keys.c g_rc.c g_register.c i_callbacks.c i_vars.c
Log:
Applied patch by Tomaz Solc to add cursor key panning. Minor cleanup of
the code afterwards (mainly to add the keyboardpan_gain to the toplevel
as a proper rc variable).
Revision Changes Path
1.3 +4 -0 eda/geda/gaf/gschem/src/g_keys.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: g_keys.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/g_keys.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- g_keys.c 15 Jul 2006 18:51:40 -0000 1.2
+++ g_keys.c 6 Aug 2006 19:23:19 -0000 1.3
@@ -220,6 +220,10 @@
DEFINE_G_KEYS(view_zoom_box)
DEFINE_G_KEYS(view_zoom_box_hotkey)
DEFINE_G_KEYS(view_pan)
+DEFINE_G_KEYS(view_pan_left)
+DEFINE_G_KEYS(view_pan_right)
+DEFINE_G_KEYS(view_pan_up)
+DEFINE_G_KEYS(view_pan_down)
DEFINE_G_KEYS(view_pan_hotkey)
DEFINE_G_KEYS(view_update_cues)
DEFINE_G_KEYS(page_manager)
1.39 +23 -0 eda/geda/gaf/gschem/src/g_rc.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: g_rc.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/g_rc.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- g_rc.c 24 Jul 2006 03:29:21 -0000 1.38
+++ g_rc.c 6 Aug 2006 19:23:19 -0000 1.39
@@ -1687,3 +1687,26 @@
return SCM_BOOL_T;
}
+
+/*! \brief Scheme function for setting the step for keyboard pan.
+ *
+ * Default setting is 20.
+ */
+SCM g_rc_keyboardpan_gain(SCM gain)
+{
+ int val;
+
+ SCM_ASSERT (SCM_INUMP (gain), gain, SCM_ARG1, "keyboardpan-gain");
+
+ val = SCM_INUM (gain);
+
+ if (val <= 0) {
+ fprintf(stderr, _("Invalid gain [%d] passed to keyboardpan-gain\n"),
+ val);
+ val = 20; /* absolute default */
+ }
+
+ default_keyboardpan_gain = val;
+
+ return SCM_BOOL_T;
+}
1.43 +5 -0 eda/geda/gaf/gschem/src/g_register.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: g_register.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/g_register.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- g_register.c 24 Jul 2006 03:29:21 -0000 1.42
+++ g_register.c 6 Aug 2006 19:23:19 -0000 1.43
@@ -147,6 +147,7 @@
{ "output-vector-threshold", 1, 0, 0, g_rc_output_vector_threshold },
{ "add-attribute-offset", 1, 0, 0, g_rc_add_attribute_offset },
{ "mousepan-gain", 1, 0, 0, g_rc_mousepan_gain },
+ { "keyboardpan-gain", 1, 0, 0, g_rc_keyboardpan_gain },
/* backup functions */
{ "auto-save-interval", 1, 0, 0, g_rc_auto_save_interval },
@@ -245,6 +246,10 @@
{ "view-zoom-box-hotkey", 0, 0, 0, g_keys_view_zoom_box_hotkey },
{ "view-pan", 0, 0, 0, g_keys_view_pan },
{ "view-pan-hotkey", 0, 0, 0, g_keys_view_pan_hotkey },
+ { "view-pan-left", 0, 0, 0, g_keys_view_pan_left },
+ { "view-pan-right", 0, 0, 0, g_keys_view_pan_right },
+ { "view-pan-up", 0, 0, 0, g_keys_view_pan_up },
+ { "view-pan-down", 0, 0, 0, g_keys_view_pan_down },
{ "view-update-cues", 0, 0, 0, g_keys_view_update_cues },
{ "page-manager", 0, 0, 0, g_keys_page_manager },
{ "page-next", 0, 0, 0, g_keys_page_next },
1.60 +54 -0 eda/geda/gaf/gschem/src/i_callbacks.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: i_callbacks.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/i_callbacks.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -b -r1.59 -r1.60
--- i_callbacks.c 6 Aug 2006 16:45:29 -0000 1.59
+++ i_callbacks.c 6 Aug 2006 19:23:19 -0000 1.60
@@ -1546,6 +1546,60 @@
i_update_middle_button(w_current, i_callback_view_pan, _("Pan"));
}
+/*! \brief Scheme callback function that moves the viewport to the left.
+ *
+ * The distance can be set with "keyboardpan-gain" scheme callback.
+ */
+DEFINE_I_CALLBACK(view_pan_left)
+{
+ TOPLEVEL *w_current = (TOPLEVEL *) data;
+
+ exit_if_null(w_current);
+
+ a_pan_mouse(w_current, w_current->keyboardpan_gain, 0);
+}
+
+/*! \brief Scheme callback function that moves the viewport to the right.
+ *
+ * The distance can be set with "keyboardpan-gain" scheme callback.
+ */
+DEFINE_I_CALLBACK(view_pan_right)
+{
+ TOPLEVEL *w_current = (TOPLEVEL *) data;
+
+ exit_if_null(w_current);
+
+ /* yes, that's a negative sign there */
+ a_pan_mouse(w_current, -w_current->keyboardpan_gain, 0);
+}
+
+/*! \brief Scheme callback function that moves the viewport up.
+ *
+ * The distance can be set with "keyboardpan-gain" scheme callback.
+ */
+DEFINE_I_CALLBACK(view_pan_up)
+{
+ TOPLEVEL *w_current = (TOPLEVEL *) data;
+
+ exit_if_null(w_current);
+
+ a_pan_mouse(w_current, 0, w_current->keyboardpan_gain);
+}
+
+/*! \brief Scheme callback function that moves the viewport down.
+ *
+ * The distance can be set with "keyboardpan-gain" scheme callback.
+ */
+DEFINE_I_CALLBACK(view_pan_down)
+{
+ TOPLEVEL *w_current = (TOPLEVEL *) data;
+
+ exit_if_null(w_current);
+
+ /* yes, that's a negative sign there */
+ a_pan_mouse(w_current, 0, -w_current->keyboardpan_gain);
+}
+
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
1.33 +6 -3 eda/geda/gaf/gschem/src/i_vars.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: i_vars.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/i_vars.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- i_vars.c 24 Jul 2006 03:29:21 -0000 1.32
+++ i_vars.c 6 Aug 2006 19:23:19 -0000 1.33
@@ -126,6 +126,7 @@
int default_text_feedback = ONLY_WHEN_READABLE;
int default_mousepan_gain = 5;
+int default_keyboardpan_gain = 20;
/*! \todo Finish function documentation!!!
* \brief
@@ -241,10 +242,12 @@
w_current->drag_can_move = default_drag_can_move;
w_current->mousepan_gain = default_mousepan_gain;
+ w_current->keyboardpan_gain = default_keyboardpan_gain;
w_current->auto_save_interval = default_auto_save_interval;
if (w_current->auto_save_interval != 0) {
- w_current->auto_save_timeout = g_timeout_add(w_current->auto_save_interval*1000,
+ w_current->auto_save_timeout =
+ g_timeout_add(w_current->auto_save_interval*1000,
(GSourceFunc) s_page_autosave,
w_current);
}
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs