--- dia-0.85-0/aclocal.m4	Thu May 18 14:41:11 2000
+++ dia-0.85-1/aclocal.m4	Sun May 21 16:07:31 2000
@@ -1027,7 +1027,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <libart_lgpl/libart.h>
 
 char*
 my_strdup (char *str)
--- dia-0.85-0/app/disp_callbacks.c	Tue Apr 18 23:19:53 2000
+++ dia-0.85-1/app/disp_callbacks.c	Tue May 23 01:15:53 2000
@@ -38,6 +38,64 @@
 /* This contains the point that was clicked to get this menu */
 static Point object_menu_clicked_point;
 
+#ifdef USE_XIM
+void create_input_dialog (DDisplay *ddisp) {
+  if (gdk_im_ready () && (ddisp->ic_attr = gdk_ic_attr_new ()) != NULL) {
+    gint width, height;
+    GdkColormap *colormap;
+    GdkEventMask mask;
+    GdkICAttr *attr = ddisp->ic_attr;
+    GdkICAttributesType attrmask = GDK_IC_ALL_REQ;
+    GdkIMStyle style;
+    GdkIMStyle supported_style = GDK_IM_PREEDIT_NONE | GDK_IM_PREEDIT_NOTHING |
+      GDK_IM_PREEDIT_POSITION | GDK_IM_STATUS_NONE |
+      GDK_IM_STATUS_NOTHING;
+    if(ddisp->canvas->style && ddisp->canvas->style->font->type != GDK_FONT_FONTSET)
+      supported_style &= ~GDK_IM_PREEDIT_POSITION;
+    attr->style = style = gdk_im_decide_style (supported_style);
+    attr->client_window = ddisp->canvas->window;
+    if((colormap = gtk_widget_get_colormap (ddisp->canvas)) != gtk_widget_get_default_colormap ()) {
+      attrmask |= GDK_IC_PREEDIT_COLORMAP;
+      attr->preedit_colormap = colormap;
+    }
+    switch (style & GDK_IM_PREEDIT_MASK) {
+    case GDK_IM_PREEDIT_POSITION:
+      if(ddisp->canvas->style && ddisp->canvas->style->font->type != GDK_FONT_FONTSET) {
+        g_warning ("¤«¤Ê´Á»úÊÑ´¹¤Î¥Õ¥©¥ó¥È¤¬¼èÆÀ¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£");
+        break;
+      }
+      attrmask |= GDK_IC_PREEDIT_POSITION_REQ;
+      gdk_window_get_size (ddisp->canvas->window, &width, &height);
+      attr->spot_location.x = 0;
+      attr->spot_location.y = 14;
+      attr->preedit_area.x = 0;
+      attr->preedit_area.y = 0;
+      attr->preedit_area.width = width;
+      attr->preedit_area.height = height;
+      attr->preedit_fontset = ddisp->canvas->style->font;
+      break;
+    }
+    ddisp->ic = gdk_ic_new (attr, attrmask);
+    if(ddisp->ic == NULL) g_warning ("¤«¤Ê´Á»úÊÑ´¹¤¬»ÈÍÑ¤Ç¤­¤Þ¤»¤ó¡ª");
+    else {
+      mask = gdk_window_get_events (ddisp->canvas->window);
+      mask |= gdk_ic_get_events(ddisp->ic);
+      gdk_window_set_events (ddisp->canvas->window, mask);
+      gdk_im_begin(ddisp->ic, ddisp->canvas->window);
+    }
+  }
+}
+
+void 
+set_input_dialog(DDisplay *ddisp, int x, int y) {
+  if(ddisp->ic && (gdk_ic_get_style(ddisp->ic) & GDK_IM_PREEDIT_POSITION)) {
+    ddisp->ic_attr->spot_location.x = x;
+    ddisp->ic_attr->spot_location.y = y;
+    gdk_ic_set_attr (ddisp->ic, ddisp->ic_attr, GDK_IC_SPOT_LOCATION);
+  }
+}
+#endif
+
 static void
 object_menu_proxy(GtkWidget *widget, gpointer data)
 {
@@ -196,6 +254,9 @@
   int width, height;
   int new_size;
   int modified;
+#ifdef USE_XIM
+  int x, y;
+#endif
 
   return_val = FALSE;
  
@@ -236,6 +297,12 @@
       break;
 
     case GDK_FOCUS_CHANGE:
+#ifdef USE_XIM
+      if(ddisp->ic == NULL)
+	create_input_dialog (ddisp);
+      else
+	gdk_im_begin(ddisp->ic, ddisp->canvas->window);
+#endif
       diagram_update_menu_sensitivity(ddisp->diagram);
       break;
       
@@ -343,6 +410,10 @@
 	  ObjectChange *obj_change = NULL;
 	
 	  object_add_updates(obj, ddisp->diagram);
+#ifdef USE_XIM
+          ddisplay_transform_coords(ddisp, obj->position.x, obj->position.y, &x, &y);
+	  set_input_dialog(ddisp, x, y);
+#endif
 	  modified = (focus->key_event)(focus, kevent->keyval,
 					kevent->string, kevent->length,
 					&obj_change);
@@ -460,8 +531,15 @@
   if (popup_shell == ddisp->shell) {
     popup_shell = NULL;
   }
-
+#ifdef USE_XIM
+  if (ddisp->ic != NULL) {
+    gdk_ic_destroy (ddisp->ic);
+    ddisp->ic = NULL;
+   }
+  if (ddisp->ic_attr) {
+    gdk_ic_attr_destroy (ddisp->ic_attr);
+    ddisp->ic_attr = NULL;
+  }
+#endif
   ddisplay_really_destroy(ddisp);
 }
-
-
--- dia-0.85-0/app/display.c	Tue Apr 11 18:21:51 2000
+++ dia-0.85-1/app/display.c	Mon May 22 12:53:32 2000
@@ -157,6 +157,11 @@
   g_hash_table_insert (display_ht, ddisp->shell, ddisp);
   g_hash_table_insert (display_ht, ddisp->canvas, ddisp);
 
+#ifdef USE_XIM
+  ddisp->ic = NULL;
+  ddisp->ic_attr = NULL;
+#endif
+
   return ddisp;  /*  set the user data  */
 }
 
--- dia-0.85-0/app/display.h	Fri Mar 24 10:52:02 2000
+++ dia-0.85-1/app/display.h	Mon May 22 12:53:52 2000
@@ -64,6 +64,10 @@
   
   GSList *update_areas;           /* Update areas list                 */
   GSList *display_areas;          /* Display areas list                */
+#ifdef USE_XIM
+  GdkIC     *ic;
+  GdkICAttr *ic_attr;
+#endif
 };
 
 extern GdkCursor *default_cursor;
--- dia-0.85-0/configure	Thu May 18 14:41:22 2000
+++ dia-0.85-1/configure	Mon May 22 21:02:31 2000
@@ -2722,7 +2722,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <libart_lgpl/libart.h>
 
 char*
 my_strdup (char *str)
@@ -6072,7 +6071,7 @@
 
 trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
 
-DEFS=-DHAVE_CONFIG_H
+DEFS='-DHAVE_CONFIG_H -DUSE_XIM -DUSE_JAPANESE'
 
 # Without the "./", some shells look in PATH for config.status.
 : ${CONFIG_STATUS=./config.status}
--- dia-0.85-0/lib/font.c	Mon Feb 28 08:29:21 2000
+++ dia-0.85-1/lib/font.c	Mon May 22 22:09:40 2000
@@ -88,21 +88,39 @@
 FontData font_data[] = {
   { "Times-Roman",
     "Times-Roman",
+#ifdef USE_JAPANESE
+    { "-adobe-times-medium-r-normal-*-%d-*-*-*-*-*-*-*,-*-mincho-medium-r-normal-*-%d-*-*-*-*-*-*-*",
+      NULL
+    }
+#else
     { "-adobe-times-medium-r-normal-*-%d-*-*-*-*-*-*-*",
       NULL
     }
+#endif
   }, 
   { "Times-Italic",
     "Times-Italic",
+#ifdef USE_JAPANESE
+    { "-adobe-times-medium-i-normal-*-%d-*-*-*-*-*-*-*,-*-mincho-medium-i-normal-*-%d-*-*-*-*-*-*-*",
+      NULL
+    }
+#else
     { "-adobe-times-medium-i-normal-*-%d-*-*-*-*-*-*-*",
       NULL
     }
+#endif
   }, 
   { "Times-Bold",
     "Times-Bold",
+#ifdef USE_JAPANESE
+    { "-adobe-times-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-mincho-bold-r-normal-*-%d-*-*-*-*-*-*-*",
+      NULL
+    }
+#else
     { "-adobe-times-bold-r-normal-*-%d-*-*-*-*-*-*-*",
       NULL
     }
+#endif
   }, 
   { "Times-BoldItalic",
     "Times-BoldItalic",
@@ -160,51 +178,99 @@
   },
   { "Courier",
     "Courier",
+#ifdef USE_JAPANESE
+    { "-adobe-courier-medium-r-normal-*-%d-*-*-*-*-*-*-*,-*-mincho-medium-r-normal-*-%d-*-*-*-*-*-*-*",
+      NULL
+    }
+#else
     { "-adobe-courier-medium-r-normal-*-%d-*-*-*-*-*-*-*",
       NULL
     }
+#endif
   },
   { "Courier-Oblique",
     "Courier-Oblique",
+#ifdef USE_JAPANESE
+    { "-adobe-courier-medium-o-normal-*-%d-*-*-*-*-*-*-*,-*-mincho-medium-i-normal-*-%d-*-*-*-*-*-*-*",
+      NULL
+    }
+#else
     { "-adobe-courier-medium-o-normal-*-%d-*-*-*-*-*-*-*",
       NULL
     }
+#endif
   },
   { "Courier-Bold",
     "Courier-Bold",
+#ifdef USE_JAPANESE
+    { "-adobe-courier-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-mincho-bold-r-normal-*-%d-*-*-*-*-*-*-*",
+      NULL
+    }
+#else
     { "-adobe-courier-bold-r-normal-*-%d-*-*-*-*-*-*-*",
       NULL
     }
+#endif
   },
   { "Courier-BoldOblique",
     "Courier-BoldOblique",
+#ifdef USE_JAPANESE
+    { "-adobe-courier-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-mincho-bold-i-normal-*-%d-*-*-*-*-*-*-*",
+      NULL
+    }
+#else
     { "-adobe-courier-bold-o-normal-*-%d-*-*-*-*-*-*-*",
       NULL
     }
+#endif
   },
   { "Helvetica",
     "Helvetica",
+#ifdef USE_JAPANESE
+    { "-adobe-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*,-*-mincho-medium-r-normal-*-%d-*-*-*-*-*-*-*",
+      NULL
+    }
+#else
     { "-adobe-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*",
       NULL
     }
+#endif
   },
   { "Helvetica-Oblique",
     "Helvetica-Oblique",
+#ifdef USE_JAPANESE
+    { "-adobe-helvetica-medium-o-normal-*-%d-*-*-*-*-*-*-*,-*-mincho-medium-i-normal-*-%d-*-*-*-*-*-*-*",
+      NULL
+    }
+#else
     { "-adobe-helvetica-medium-o-normal-*-%d-*-*-*-*-*-*-*",
       NULL
     }
+#endif
   },
   { "Helvetica-Bold",
     "Helvetica-Bold",
+#ifdef USE_JAPANESE
+    { "-adobe-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-mincho-bold-r-normal-*-%d-*-*-*-*-*-*-*",
+      NULL
+    }
+#else
     { "-adobe-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*",
       NULL
     }
+#endif
   },
   { "Helvetica-BoldOblique",
     "Helvetica-BoldOblique",
+#ifdef USE_JAPANESE
+    { "-adobe-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-mincho-bold-i-normal-*-%d-*-*-*-*-*-*-*",
+      NULL
+    }
+#else
     { "-adobe-helvetica-bold-o-normal-*-%d-*-*-*-*-*-*-*",
       NULL
     }
+#endif
   },
   { "Helvetica-Narrow",
     "Helvetica-Narrow",
@@ -330,9 +396,17 @@
       break;
     bufsize = strlen(x11_font)+6;  /* Should be enought*/
     buffer = (char *)g_malloc(bufsize);
+#ifdef USE_JAPANESE
+    g_snprintf(buffer, bufsize, x11_font, 100, 100);
+#else
     g_snprintf(buffer, bufsize, x11_font, 100);
-    
+#endif
+
+#ifdef USE_JAPANESE    
+    gdk_font = gdk_fontset_load(buffer);
+#else
     gdk_font = gdk_font_load(buffer);
+#endif
     if (gdk_font!=NULL) {
       font->fontname_x11 = x11_font;
     }
@@ -347,9 +421,17 @@
       x11_font = last_resort_fonts[i];
       bufsize = strlen(x11_font)+6;  /* Should be enought*/
       buffer = (char *)g_malloc(bufsize);
+#ifdef USE_JAPANESE
+      g_snprintf(buffer, bufsize, x11_font, 100, 100);
+#else
       g_snprintf(buffer, bufsize, x11_font, 100);
-      
+#endif
+
+#ifdef USE_JAPANESE      
+      gdk_font = gdk_fontset_load(buffer);
+#else
       gdk_font = gdk_font_load(buffer);
+#endif
       g_free(buffer);
       if (gdk_font!=NULL) {
 	message_warning(_("Warning no X Font for %s found, \nusing %s instead.\n"), font->public.name, x11_font);
@@ -451,8 +533,12 @@
   
   bufsize = strlen(font->fontname_x11)+6;  /* Should be enought*/
   buffer = (char *)malloc(bufsize);
+#ifdef USE_JAPANESE
+  g_snprintf(buffer, bufsize, font->fontname_x11, height, height);
+#else
   g_snprintf(buffer, bufsize, font->fontname_x11, height);
-  gdk_font = gdk_font_load(buffer);
+#endif
+  gdk_font = gdk_fontset_load(buffer);
   free(buffer);
 
   return gdk_font;
--- dia-0.85-0/lib/text.c	Sat Apr  8 01:22:32 2000
+++ dia-0.85-1/lib/text.c	Mon May 22 22:51:30 2000
@@ -507,6 +507,11 @@
     } else {
       return;
     }
+#ifdef USE_JAPANESE
+    if(text->line[row][i]<0) {
+      i++;
+    }
+#endif
   }
   text->cursor_pos = text->strlen[row];
 }
@@ -577,11 +582,27 @@
       text_join_lines(text, row);
     return;
   }
+#ifdef USE_JAPANESE
+  if(text->line[row][text->cursor_pos] > 0) {
+    memmove(text->line[row] + text->cursor_pos,
+           text->line[row] + text->cursor_pos + 1,
+           text->strlen[row] - text->cursor_pos);
+
+    text->strlen[row]--;
+  } else {
+    memmove(text->line[row] + text->cursor_pos,
+	    text->line[row] + text->cursor_pos + 2,
+	    text->strlen[row] - text->cursor_pos - 1);
+
+    text->strlen[row]-=2;
+  }
+#else
   memmove(text->line[row] + text->cursor_pos,
 	  text->line[row] + text->cursor_pos + 1,
 	  text->strlen[row] - text->cursor_pos);
 
   text->strlen[row]--;
+#endif
   
   if (text->cursor_pos > text->strlen[text->cursor_row])
     text->cursor_pos = text->strlen[text->cursor_row];
@@ -608,6 +629,22 @@
       text_join_lines(text, row-1);
     return;
   }
+#ifdef USE_JAPANESE
+  if(text->line[row][text->cursor_pos-1] > 0) {
+    memmove(text->line[row] + text->cursor_pos - 1,
+	    text->line[row] + text->cursor_pos,
+	    text->strlen[row] - text->cursor_pos + 1);
+    text->strlen[row]--;
+    
+    text->cursor_pos --;
+ } else {
+    memmove(text->line[row] + text->cursor_pos - 2,
+	    text->line[row] + text->cursor_pos,
+	    text->strlen[row] - text->cursor_pos + 2);
+    text->strlen[row]-=2;
+    text->cursor_pos -=2;
+  }
+#else
   memmove(text->line[row] + text->cursor_pos - 1,
 	  text->line[row] + text->cursor_pos,
 	  text->strlen[row] - text->cursor_pos + 1);
@@ -615,7 +652,7 @@
   text->strlen[row]--;
 
   text->cursor_pos --;
-  
+#endif  
   if (text->cursor_pos > text->strlen[text->cursor_row])
     text->cursor_pos = text->strlen[text->cursor_row];
 
@@ -719,6 +756,9 @@
   Text *text;
   int return_val;
   int row;
+#ifdef USE_JAPANESE
+  int i;
+#endif
 
   return_val = FALSE;
   *change = NULL;
@@ -749,12 +789,28 @@
     
     break;
   case GDK_Left:
+#ifdef JAPANESE
+    if(text->line[text->cursor_row][text->cursor_pos-1] > 0) {
+      text->cursor_pos--;
+    } else {
+      text->cursor_pos-=2;
+    }
+#else
     text->cursor_pos--;
+#endif
     if (text->cursor_pos<0)
       text->cursor_pos = 0;
     break;
   case GDK_Right:
+#ifdef JAPANESE
+    if(text->line[text->cursor_row][text->cursor_pos+1] > 0) {
+      text->cursor_pos++;
+    } else {
+      text->cursor_pos+=2;
+    }
+#else
     text->cursor_pos++;
+#endif
     if (text->cursor_pos > text->strlen[text->cursor_row])
       text->cursor_pos = text->strlen[text->cursor_row];
     break;
@@ -803,9 +859,17 @@
   default:
     if (strlen>0) {
       return_val = TRUE;
+#ifdef USE_JAPANESE
+      for(i = 0;i < strlen;i++) {
+        *change = text_create_change(text, TYPE_INSERT_CHAR, str[i],
+				     text->cursor_pos, text->cursor_row);
+        text_insert_char(text, str[i]);
+      }
+#else
       *change = text_create_change(text, TYPE_INSERT_CHAR, str[0],
 				   text->cursor_pos, text->cursor_row);
       text_insert_char(text, str[0]);
+#endif
     }
     break;
   }  
