[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: branch: master updated (1.3.0-20071229-39-gfd56064)



The branch, master has been updated
       via  fd560649436835795f173f0fd3dc498133040f9a (commit)
       via  1556ae85b049e89d77507a636dc42c726bcd328d (commit)
       via  048bd6f8e2fc1c5f5b01ff3f1cad3a7c9bf43f3e (commit)
      from  6d5b5acb9dc6367fd9aa64b0210da7f3ab4bfd5f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 gschem/include/gschem_struct.h |    1 +
 gschem/include/i_vars.h        |    1 +
 gschem/include/prototype.h     |    1 +
 gschem/lib/system-gschemrc.in  |   10 +++
 gschem/src/g_rc.c              |   17 ++++++
 gschem/src/g_register.c        |    1 +
 gschem/src/i_vars.c            |    2 +
 gschem/src/x_event.c           |  121 +++++++++++++++++-----------------------
 gschem/src/x_log.c             |   15 ++++-
 libgeda/include/defines.h      |    4 +
 libgeda/src/libgeda.c          |    1 +
 11 files changed, 102 insertions(+), 72 deletions(-)


=================
 Commit Messages
=================

commit fd560649436835795f173f0fd3dc498133040f9a
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Jan 6 21:02:26 2008 +0000

    Validate log messages to ensure they are UTF-8 before passing to GTK

:100644 100644 ba72022... ac2b6b2... M	gschem/src/x_log.c

commit 1556ae85b049e89d77507a636dc42c726bcd328d
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Jan 6 21:00:40 2008 +0000

    Set encoding for translations in libgeda to UTF-8

:100644 100644 5ad1a03... b753916... M	libgeda/src/libgeda.c

commit 048bd6f8e2fc1c5f5b01ff3f1cad3a7c9bf43f3e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Jan 6 20:36:52 2008 +0000

    Allow configuration of the scroll wheel's action to match GTK app. norms
    
    Adds configuration parameter (scroll-wheel ...) which takes either
    "classic" or "gtk" as a string argument. "classic" remains the default.
    
    Tidies x_event_scroll() to deal with the various options in a neater way.

:100644 100644 6ba4d94... c99c29f... M	gschem/include/gschem_struct.h
:100644 100644 f20926d... 0ebf72a... M	gschem/include/i_vars.h
:100644 100644 c08c0b5... 0089a26... M	gschem/include/prototype.h
:100644 100644 cac762f... 4f9838b... M	gschem/lib/system-gschemrc.in
:100644 100644 114e3ec... ec426cd... M	gschem/src/g_rc.c
:100644 100644 1e7a89f... da021f1... M	gschem/src/g_register.c
:100644 100644 ecd5fd4... 2f8f17a... M	gschem/src/i_vars.c
:100644 100644 d2680ee... 716fe24... M	gschem/src/x_event.c
:100644 100644 873346d... 624b016... M	libgeda/include/defines.h

=========
 Changes
=========

commit fd560649436835795f173f0fd3dc498133040f9a
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Jan 6 21:02:26 2008 +0000

    Validate log messages to ensure they are UTF-8 before passing to GTK

diff --git a/gschem/src/x_log.c b/gschem/src/x_log.c
index ba72022..ac2b6b2 100644
--- a/gschem/src/x_log.c
+++ b/gschem/src/x_log.c
@@ -183,8 +183,19 @@ static void log_message (Log *log, const gchar *message,
   gtk_text_buffer_get_end_iter (buffer, &iter);
   /* Apply the "plain" tag before the level-specific tag in order to
    * reset the formatting */
-  gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, message, -1, 
-                                            "plain", style, NULL);
+
+  if (g_utf8_validate (message, -1, NULL)) {
+    gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, message, -1,
+                                              "plain", style, NULL);
+  } else {
+    /* If UTF-8 wasn't valid (due to a system locale encoded filename or
+     * other string being included by mistake), log a warning, and print
+     * the original message to stderr, where it may be partly intelligible */
+    gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
+      _("** Invalid UTF-8 in log message. See stderr or gschem.log.\n"),
+                                              -1, "plain", style, NULL);
+    fprintf (stderr, "%s", message);
+  }
 
   mark = gtk_text_buffer_create_mark(buffer, NULL, &iter, FALSE);
   gtk_text_view_scroll_to_mark (log->textview, mark, 0, TRUE, 0, 1);

commit 1556ae85b049e89d77507a636dc42c726bcd328d
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Jan 6 21:00:40 2008 +0000

    Set encoding for translations in libgeda to UTF-8

diff --git a/libgeda/src/libgeda.c b/libgeda/src/libgeda.c
index 5ad1a03..b753916 100644
--- a/libgeda/src/libgeda.c
+++ b/libgeda/src/libgeda.c
@@ -54,6 +54,7 @@ void libgeda_init(void)
 
   /* Initialise gettext */
   bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
 
   /* Initialise gobject */
   g_type_init ();

commit 048bd6f8e2fc1c5f5b01ff3f1cad3a7c9bf43f3e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Jan 6 20:36:52 2008 +0000

    Allow configuration of the scroll wheel's action to match GTK app. norms
    
    Adds configuration parameter (scroll-wheel ...) which takes either
    "classic" or "gtk" as a string argument. "classic" remains the default.
    
    Tidies x_event_scroll() to deal with the various options in a neater way.

diff --git a/gschem/include/gschem_struct.h b/gschem/include/gschem_struct.h
index 6ba4d94..c99c29f 100644
--- a/gschem/include/gschem_struct.h
+++ b/gschem/include/gschem_struct.h
@@ -155,6 +155,7 @@ struct st_gschem_toplevel {
   int log_window_type;    /* controls if the log window is decorated or not */
   int third_button;       /* controls what the third mouse button does */
   int middle_button;      /* controls what the third mouse button does */
+  int scroll_wheel;       /* controls what the mouse scroll wheel does */
   int file_preview;       /* controls if the preview area is enabled or not */
   int enforce_hierarchy;  /* controls how much freedom user has when traversing the hierarchy */
   int text_origin_marker; /* controls if text origin marker is displayed or not */
diff --git a/gschem/include/i_vars.h b/gschem/include/i_vars.h
index f20926d..0ebf72a 100644
--- a/gschem/include/i_vars.h
+++ b/gschem/include/i_vars.h
@@ -59,6 +59,7 @@ extern int default_log_window;
 extern int default_log_window_type;
 extern int default_third_button;
 extern int default_middle_button;
+extern int default_scroll_wheel;
 extern int default_net_consolidate;
 extern int default_file_preview;
 extern int default_enforce_hierarchy;
diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index c08c0b5..0089a26 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -241,6 +241,7 @@ SCM g_rc_log_window(SCM mode);
 SCM g_rc_log_window_type(SCM mode);
 SCM g_rc_third_button(SCM mode);
 SCM g_rc_middle_button(SCM mode);
+SCM g_rc_scroll_wheel(SCM mode);
 SCM g_rc_net_consolidate(SCM mode);
 SCM g_rc_file_preview(SCM mode);
 SCM g_rc_enforce_hierarchy(SCM mode);
diff --git a/gschem/lib/system-gschemrc.in b/gschem/lib/system-gschemrc.in
index cac762f..4f9838b 100644
--- a/gschem/lib/system-gschemrc.in
+++ b/gschem/lib/system-gschemrc.in
@@ -667,6 +667,16 @@
 (third-button "popup")
 ;(third-button "mousepan")
 
+; scroll-wheel string
+;
+; Controls the binding of the mouse scroll wheel.
+; "classic" style is the gschem default, where scrolling with no modifier
+; key is mapped to zoom, + CTRL -> x-axis pan, + SHIFT -> y-axis pan.
+; "gtk" style changes the behaviour to be more like other GTK appliactions,
+; no modifier -> y-axis pan, + CTRL -> zoom, + SHIFT -> x-axis pan.
+(scroll-wheel "classic")
+;(scroll-wheel "gtk")
+
 ; warp-cursor string
 ;
 ; Controls if the cursor is warped (or moved) when you zoom in and out.
diff --git a/gschem/src/g_rc.c b/gschem/src/g_rc.c
index 114e3ec..ec426cd 100644
--- a/gschem/src/g_rc.c
+++ b/gschem/src/g_rc.c
@@ -918,6 +918,23 @@ SCM g_rc_middle_button(SCM mode)
  *  \par Function Description
  *
  */
+SCM g_rc_scroll_wheel(SCM mode)
+{
+  static const vstbl_entry mode_table[] = {
+    {SCROLL_WHEEL_CLASSIC, "classic"},
+    {SCROLL_WHEEL_GTK,     "gtk"},
+  };
+
+  RETURN_G_RC_MODE("scroll-wheel",
+                   default_scroll_wheel,
+                   2);
+}
+
+/*! \todo Finish function documentation!!!
+ *  \brief
+ *  \par Function Description
+ *
+ */
 SCM g_rc_net_consolidate(SCM mode)
 {
   static const vstbl_entry mode_table[] = {
diff --git a/gschem/src/g_register.c b/gschem/src/g_register.c
index 1e7a89f..da021f1 100644
--- a/gschem/src/g_register.c
+++ b/gschem/src/g_register.c
@@ -117,6 +117,7 @@ static struct gsubr_t gschem_funcs[] = {
   { "log-window-type",           1, 0, 0, g_rc_log_window_type },
   { "third-button",              1, 0, 0, g_rc_third_button },
   { "middle-button",             1, 0, 0, g_rc_middle_button },
+  { "scroll-wheel",              1, 0, 0, g_rc_scroll_wheel },
   { "net-consolidate",           1, 0, 0, g_rc_net_consolidate },
   { "file-preview",              1, 0, 0, g_rc_file_preview },
   { "enforce-hierarchy",         1, 0, 0, g_rc_enforce_hierarchy },
diff --git a/gschem/src/i_vars.c b/gschem/src/i_vars.c
index ecd5fd4..2f8f17a 100644
--- a/gschem/src/i_vars.c
+++ b/gschem/src/i_vars.c
@@ -88,6 +88,7 @@ int   default_middle_button = STROKE;
 #else
 int   default_middle_button = REPEAT;
 #endif
+int   default_scroll_wheel = SCROLL_WHEEL_CLASSIC;
 int   default_net_consolidate = TRUE;
 int   default_file_preview = FALSE;
 int   default_enforce_hierarchy = TRUE;
@@ -214,6 +215,7 @@ void i_vars_set(GSCHEM_TOPLEVEL *w_current)
   w_current->image_height       = default_image_height;
   w_current->third_button       = default_third_button;
   w_current->middle_button      = default_middle_button;
+  w_current->scroll_wheel       = default_scroll_wheel;
   toplevel->net_consolidate    = default_net_consolidate;
   w_current->file_preview       = default_file_preview;
   w_current->enforce_hierarchy  = default_enforce_hierarchy;
diff --git a/gschem/src/x_event.c b/gschem/src/x_event.c
index d2680ee..716fe24 100644
--- a/gschem/src/x_event.c
+++ b/gschem/src/x_event.c
@@ -1436,6 +1436,11 @@ gint x_event_scroll (GtkWidget *widget, GdkEventScroll *event,
 		     GSCHEM_TOPLEVEL *w_current)
 {
   GtkAdjustment *adj;
+  gboolean pan_xaxis = FALSE;
+  gboolean pan_yaxis = FALSE;
+  gboolean zoom = FALSE;
+  int pan_direction = 1;
+  int zoom_direction = ZOOM_IN;
 
   exit_if_null(w_current);
   global_window_current = w_current;
@@ -1445,83 +1450,59 @@ gint x_event_scroll (GtkWidget *widget, GdkEventScroll *event,
   w_current->CONTROLKEY = (event->state & GDK_CONTROL_MASK) ? 1 : 0;
   w_current->ALTKEY     = (event->state & GDK_MOD1_MASK) ? 1 : 0;
 
-  switch (event->direction) {
-  case(GDK_SCROLL_UP):
-    if (!w_current->CONTROLKEY && !w_current->SHIFTKEY)
-    {
-      /* turn the up/down scroll wheel into a zoom in / out */
-      /*! \todo Change "HOTKEY" TO new "MOUSE" specifier?
-       */
-      a_zoom(w_current, ZOOM_IN, HOTKEY, 0);
- 
-      if (w_current->undo_panzoom) {
-        o_undo_savestate(w_current, UNDO_VIEWPORT_ONLY); 
-      }
+  if (w_current->scroll_wheel == SCROLL_WHEEL_CLASSIC) {
+    /* Classic gschem behaviour */
+    zoom =      !w_current->CONTROLKEY && !w_current->SHIFTKEY;
+    pan_yaxis = !w_current->CONTROLKEY &&  w_current->SHIFTKEY;
+    pan_xaxis =  w_current->CONTROLKEY && !w_current->SHIFTKEY;
+  } else {
+    /* GTK style behaviour */
+    zoom =       w_current->CONTROLKEY && !w_current->SHIFTKEY;
+    pan_yaxis = !w_current->CONTROLKEY && !w_current->SHIFTKEY;
+    pan_xaxis = !w_current->CONTROLKEY &&  w_current->SHIFTKEY;
+  }
 
-    } else if ( !w_current->CONTROLKEY ) {
-      /* if the control key is not held down, scroll up / down */
-      /* You must have scrollbars enabled if you want to use the scroll wheel to pan */
-      if (w_current->scrollbars_flag == FALSE )
-        return 0;
-      adj = gtk_range_get_adjustment(GTK_RANGE(w_current->v_scrollbar));
-      gtk_adjustment_set_value(adj, adj->value - (adj->page_increment / 4));
-    } else {
-      /* if the control key is held down, then scroll left as well */
-      /* You must have scrollbars enabled if you want to use the scroll wheel to pan */
-      if (w_current->scrollbars_flag == FALSE )
-        return 0;
-      adj = gtk_range_get_adjustment(GTK_RANGE(w_current->h_scrollbar));
-      gtk_adjustment_set_value(adj, adj->value - (adj->page_increment / 4));
-    }
-    break;
+  /* You must have scrollbars enabled if you want to use the scroll wheel to pan */
+  if (!w_current->scrollbars_flag) {
+    pan_xaxis = FALSE;
+    pan_yaxis = FALSE;
+  }
 
-  case(GDK_SCROLL_DOWN):
-    if (!w_current->CONTROLKEY && !w_current->SHIFTKEY)
-    {
-      /* turn the up/down scroll wheel into a zoom in / out */
-      /*! \todo Change "HOTKEY" TO new "MOUSE" specifier?
-       */
-      a_zoom(w_current, ZOOM_OUT, HOTKEY, 0);
-      if (w_current->undo_panzoom) {
-        o_undo_savestate(w_current, UNDO_VIEWPORT_ONLY); 
-      }
-    } else if ( !w_current->CONTROLKEY ) {
-      /* if the control key is not held down, scroll up / down */
-      /* You must have scrollbars enabled if you want to use the scroll wheel to pan */
-      if (w_current->scrollbars_flag == FALSE )
-        return 0;
-      adj = gtk_range_get_adjustment(GTK_RANGE(w_current->v_scrollbar));
-      gtk_adjustment_set_value(adj, min(adj->value + (adj->page_increment / 4),
-                                        adj->upper - adj->page_size));
-    } else {
-      /* if the control key is held down, then scroll right as well */
-      /* You must have scrollbars enabled if you want to use the scroll wheel to pan */
-      if (w_current->scrollbars_flag == FALSE )
-        return 0;
-      adj = gtk_range_get_adjustment(GTK_RANGE(w_current->h_scrollbar));
-      gtk_adjustment_set_value(adj, min(adj->value + (adj->page_increment / 4),
-                                        adj->upper - adj->page_size));
-    }
-    break;
+  switch (event->direction) {
+    case GDK_SCROLL_UP:
+    case GDK_SCROLL_LEFT:
+      pan_direction = -1;
+      zoom_direction = ZOOM_IN;
+      break;
+    case GDK_SCROLL_DOWN:
+    case GDK_SCROLL_RIGHT:
+      pan_direction =  1;
+      zoom_direction = ZOOM_OUT;
+      break;
+  }
 
-  case(GDK_SCROLL_LEFT):
-    /* You must have scrollbars enabled if you want to use the scroll wheel to pan */
-    if (w_current->scrollbars_flag == FALSE)
-      return 0;
-    adj = gtk_range_get_adjustment(GTK_RANGE(w_current->h_scrollbar));
-    gtk_adjustment_set_value(adj, adj->value - (adj->page_increment / 4));
-    break;
+  if (zoom) {
+    /*! \todo Change "HOTKEY" TO new "MOUSE" specifier? */
+    a_zoom(w_current, zoom_direction, HOTKEY, 0);
+  }
 
-  case(GDK_SCROLL_RIGHT):
-    /* You must have scrollbars enabled if you want to use the scroll wheel to pan */
-    if (w_current->scrollbars_flag == FALSE)
-      return 0;
+  if (pan_xaxis) {
     adj = gtk_range_get_adjustment(GTK_RANGE(w_current->h_scrollbar));
-    gtk_adjustment_set_value(adj, min(adj->value + (adj->page_increment / 4),
+    gtk_adjustment_set_value(adj, min(adj->value + pan_direction *
+                                        (adj->page_increment / 4),
                                       adj->upper - adj->page_size));
-    break;
+  }
 
+  if (pan_yaxis) {
+    adj = gtk_range_get_adjustment(GTK_RANGE(w_current->v_scrollbar));
+    gtk_adjustment_set_value(adj, min(adj->value + pan_direction *
+                                        (adj->page_increment / 4),
+                                      adj->upper - adj->page_size));
   }
 
-  return(0);
+  if (w_current->undo_panzoom && (zoom || pan_xaxis || pan_yaxis)) {
+    o_undo_savestate(w_current, UNDO_VIEWPORT_ONLY);
+  }
+
+  return 0;
 }
diff --git a/libgeda/include/defines.h b/libgeda/include/defines.h
index 873346d..624b016 100644
--- a/libgeda/include/defines.h
+++ b/libgeda/include/defines.h
@@ -293,6 +293,10 @@
 #define ACTION			2
 #define MID_MOUSEPAN_ENABLED	3
 
+/* for scroll-wheel */
+#define SCROLL_WHEEL_CLASSIC 0
+#define SCROLL_WHEEL_GTK     1
+
 /* for selected_from */
 #define DONTCARE		0
 #define MENU			1




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs