[PATCH] show preedit string

2004-01-16 Thread Kouhei Sutou
I made a patch for showing preedit string when using input
method.


Index: disp_callbacks.c
===
RCS file: /cvs/gnome/dia/app/disp_callbacks.c,v
retrieving revision 1.73
diff -u -r1.73 disp_callbacks.c
--- disp_callbacks.c2 Nov 2003 10:58:30 -   1.73
+++ disp_callbacks.c16 Jan 2004 13:57:29 -
@@ -364,11 +364,24 @@
  (the default IM on X should perform the local->UTF8 conversion)
   */
   
+  ddisplay_im_context_preedit_reset(ddisp, active_focus());
+
   handle_key_event(ddisp, active_focus(), 0, str, g_utf8_strlen(str,-1));
 }
 
 void ddisplay_im_context_preedit_changed(GtkIMContext *context,
  DDisplay *ddisp) {
+  gint cursor_pos;
+  Focus *focus = active_focus();
+
+  ddisplay_im_context_preedit_reset(ddisp, focus);
+  
+  gtk_im_context_get_preedit_string(context, &ddisp->preedit_string,
+NULL, &cursor_pos);
+  if (ddisp->preedit_string != NULL) {
+handle_key_event(ddisp, active_focus(), 0, ddisp->preedit_string,
+ g_utf8_strlen(ddisp->preedit_string,-1));
+  }
 /*  char *str;
   PangoAttrList *attrs;
   gint cursor_pos;
Index: display.c
===
RCS file: /cvs/gnome/dia/app/display.c,v
retrieving revision 1.81
diff -u -r1.81 display.c
--- display.c   31 Dec 2003 11:44:37 -  1.81
+++ display.c   16 Jan 2004 13:57:30 -
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #ifdef GNOME
 #include 
@@ -33,6 +34,7 @@
 #include "display.h"
 #include "group.h"
 #include "interface.h"
+#include "focus.h"
 #include "color.h"
 #include "handle_ops.h"
 #include "connectionpoint_ops.h"
@@ -173,6 +175,7 @@
   ddisp->im_context = gtk_im_multicontext_new();
   g_signal_connect (G_OBJECT (ddisp->im_context), "commit",
 G_CALLBACK (ddisplay_im_context_commit), ddisp);
+  ddisp->preedit_string = NULL;
   g_signal_connect (G_OBJECT (ddisp->im_context), "preedit_changed",
 G_CALLBACK (ddisplay_im_context_preedit_changed),
 ddisp);
@@ -938,6 +941,8 @@
   g_object_unref (G_OBJECT (ddisp->im_context));
   ddisp->im_context = NULL;
 
+  ddisplay_im_context_preedit_reset(ddisp, active_focus());
+
   gtk_widget_destroy (ddisp->shell);
 }
 
@@ -1189,5 +1194,20 @@
  GTK_WINDOW(ddisp->shell));
   }
 }
+  }
+}
+
+void
+ddisplay_im_context_preedit_reset(DDisplay *ddisp, Focus *focus)
+{
+  if (ddisp->preedit_string != NULL) {
+int i;
+ObjectChange *change;
+
+for (i = 0; i < g_utf8_strlen(ddisp->preedit_string, -1); i++) {
+  (focus->key_event)(focus, GDK_BackSpace, NULL, 0, &change);
+}
+   g_free(ddisp->preedit_string);
+ddisp->preedit_string = NULL;
   }
 }
Index: display.h
===
RCS file: /cvs/gnome/dia/app/display.h,v
retrieving revision 1.29
diff -u -r1.29 display.h
--- display.h   10 Sep 2003 21:05:56 -  1.29
+++ display.h   16 Jan 2004 13:57:30 -
@@ -92,6 +92,9 @@
   guint update_id;/* idle handler ID for redraws   */
 
   GtkIMContext *im_context;
+
+   /* Preedit String */
+   gchar* preedit_string;
 };
 
 extern GdkCursor *default_cursor;
@@ -154,5 +157,7 @@
 void ddisplay_do_update_menu_sensitivity (DDisplay *ddisp);
 
 void display_set_active(DDisplay *ddisp);
+
+void ddisplay_im_context_preedit_reset(DDisplay *ddisp, Focus *focus);
 
 #endif /* DDISPLAY_H */

--
kou
___
Dia-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.lysator.liu.se/~alla/dia/faq.html
Main page at http://www.lysator.liu.se/~alla/dia



Re: [PATCH] show preedit string

2004-01-16 Thread Kouhei Sutou
Sory, I noticed the patch which I sent before doesn't
include all diff. I attach a collect patch.

In <[EMAIL PROTECTED]>
  "[PATCH] show preedit string" on Fri, 16 Jan 2004 23:00:07 +0900 (JST),
  Kouhei Sutou <[EMAIL PROTECTED]> wrote:
> I made a patch for showing preedit string when using input
> method.


Index: app/disp_callbacks.c
===
RCS file: /cvs/gnome/dia/app/disp_callbacks.c,v
retrieving revision 1.73
diff -u -r1.73 disp_callbacks.c
--- app/disp_callbacks.c2 Nov 2003 10:58:30 -   1.73
+++ app/disp_callbacks.c16 Jan 2004 14:26:21 -
@@ -364,11 +364,24 @@
  (the default IM on X should perform the local->UTF8 conversion)
   */
   
+  ddisplay_im_context_preedit_reset(ddisp, active_focus());
+
   handle_key_event(ddisp, active_focus(), 0, str, g_utf8_strlen(str,-1));
 }
 
 void ddisplay_im_context_preedit_changed(GtkIMContext *context,
  DDisplay *ddisp) {
+  gint cursor_pos;
+  Focus *focus = active_focus();
+
+  ddisplay_im_context_preedit_reset(ddisp, focus);
+  
+  gtk_im_context_get_preedit_string(context, &ddisp->preedit_string,
+NULL, &cursor_pos);
+  if (ddisp->preedit_string != NULL) {
+handle_key_event(ddisp, active_focus(), 0, ddisp->preedit_string,
+ g_utf8_strlen(ddisp->preedit_string,-1));
+  }
 /*  char *str;
   PangoAttrList *attrs;
   gint cursor_pos;
Index: app/display.c
===
RCS file: /cvs/gnome/dia/app/display.c,v
retrieving revision 1.81
diff -u -r1.81 display.c
--- app/display.c   31 Dec 2003 11:44:37 -  1.81
+++ app/display.c   16 Jan 2004 14:26:22 -
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #ifdef GNOME
 #include 
@@ -33,6 +34,7 @@
 #include "display.h"
 #include "group.h"
 #include "interface.h"
+#include "focus.h"
 #include "color.h"
 #include "handle_ops.h"
 #include "connectionpoint_ops.h"
@@ -173,6 +175,7 @@
   ddisp->im_context = gtk_im_multicontext_new();
   g_signal_connect (G_OBJECT (ddisp->im_context), "commit",
 G_CALLBACK (ddisplay_im_context_commit), ddisp);
+  ddisp->preedit_string = NULL;
   g_signal_connect (G_OBJECT (ddisp->im_context), "preedit_changed",
 G_CALLBACK (ddisplay_im_context_preedit_changed),
 ddisp);
@@ -938,6 +941,8 @@
   g_object_unref (G_OBJECT (ddisp->im_context));
   ddisp->im_context = NULL;
 
+  ddisplay_im_context_preedit_reset(ddisp, active_focus());
+
   gtk_widget_destroy (ddisp->shell);
 }
 
@@ -1189,5 +1194,20 @@
  GTK_WINDOW(ddisp->shell));
   }
 }
+  }
+}
+
+void
+ddisplay_im_context_preedit_reset(DDisplay *ddisp, Focus *focus)
+{
+  if (ddisp->preedit_string != NULL) {
+int i;
+ObjectChange *change;
+
+for (i = 0; i < g_utf8_strlen(ddisp->preedit_string, -1); i++) {
+  (focus->key_event)(focus, GDK_BackSpace, NULL, 0, &change);
+}
+   g_free(ddisp->preedit_string);
+ddisp->preedit_string = NULL;
   }
 }
Index: app/display.h
===
RCS file: /cvs/gnome/dia/app/display.h,v
retrieving revision 1.29
diff -u -r1.29 display.h
--- app/display.h   10 Sep 2003 21:05:56 -  1.29
+++ app/display.h   16 Jan 2004 14:26:22 -
@@ -92,6 +92,9 @@
   guint update_id;/* idle handler ID for redraws   */
 
   GtkIMContext *im_context;
+
+   /* Preedit String */
+   gchar* preedit_string;
 };
 
 extern GdkCursor *default_cursor;
@@ -154,5 +157,7 @@
 void ddisplay_do_update_menu_sensitivity (DDisplay *ddisp);
 
 void display_set_active(DDisplay *ddisp);
+
+void ddisplay_im_context_preedit_reset(DDisplay *ddisp, Focus *focus);
 
 #endif /* DDISPLAY_H */
Index: lib/text.c
===
RCS file: /cvs/gnome/dia/lib/text.c,v
retrieving revision 1.51
diff -u -r1.51 text.c
--- lib/text.c  30 Nov 2003 13:19:38 -  1.51
+++ lib/text.c  16 Jan 2004 14:26:23 -
@@ -872,9 +872,11 @@
   default:
 if (str || (strlen>0)) {
 
+  glong str_len = g_utf8_strlen(str, -1);
   return_val = TRUE;
   utf = str;
-  for (utf = str ; utf && *utf && (utf-str <= strlen) ; 
+  for (utf = str ; utf && *utf &&
+ ((g_utf8_strlen(utf, -1) - str_len) <= strlen) ; 
   utf = g_utf8_next_char (utf)) {
 c = g_utf8_get_char (utf);
   
  
--
kou
___
Dia-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.lysator.liu.se/~alla/dia/faq.html
Main page at http://www.lysator.liu.se/~alla/dia



(no subject)

2004-01-16 Thread X002009
Hi, I've installed Dia 0.92.2 on a Win95 machine. I received no errors during installation. However, when I start Dia, a DOS command window opens (expected), however the window is filled with the following error messages:

"Cannot load module ../lib/pango/1.2.0/modules/pango-basic-win32.dll: One of the
library files needed to run this application cannot be found."

How can I fix this problem?

Larry



Re: (no subject)

2004-01-16 Thread Steffen Macke
> "Cannot load module ../lib/pango/1.2.0/modules/pango-basic-win32.dll: One
> of the
> library files needed to run this application cannot be found."
>
> How can I fix this problem?

Try to edit dia.bat and replace "program files" with "progra~1" (check with
"dir" whether this is how your Windows  95 calls the program files folder).

Steffen

___
Dia-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.lysator.liu.se/~alla/dia/faq.html
Main page at http://www.lysator.liu.se/~alla/dia