--Multipart_Fri_Apr_14_16:26:27_2000-1
Content-Type: text/plain; charset=ISO-2022-JP

許可を頂いたので、転送します。

--Multipart_Fri_Apr_14_16:26:27_2000-1
Content-Type: message/rfc822

Received: from hqvsbh1.ms.com (hqvsbh1.ms.com [205.228.12.103])
	by bleu.ueda.info.waseda.ac.jp (8.9.3+3.2W/3.7Wpl2/UEDALAB) with ESMTP id PAA16733
	for <igarashi / ueda.info.waseda.ac.jp>; Fri, 14 Apr 2000 15:19:57 +0900 (JST)
	(envelope-from araki / ms.com)
Received: (from uucp@localhost)
        by hqvsbh1.ms.com (8.9.3/fw v1.30) id CAA21586;
        Fri, 14 Apr 2000 02:19:42 -0400 (EDT)
Received: from localhost(127.0.0.1) by hqvsbh1 via smap (4.1)
	id sma.9556931741.021452; Fri, 14 Apr 00 02:19:34 -0400
Received: (from uucp@localhost)
	by hqvsbh1.ms.com (8.9.3/8.9.3(vs)) id CAA21428;
	Fri, 14 Apr 2000 02:19:33 -0400 (EDT)
X-Authentication-Warning: hqvsbh1.ms.com: Processed from queue /var/spool/mqueue-vs
X-Authentication-Warning: hqvsbh1.ms.com: Processed by uucp with -C /etc/mail/sendmail.vs.cf
Received: from ebsmh1.ms.com(161.144.69.46) by hqvsbh1 via smap (4.1)
	id sma.9556931631.021163; Fri, 14 Apr 00 02:19:23 -0400
Received: from ebid530.morgan.com (ebid530.morgan.com [161.144.75.72])
        by ebsmh1 (8.8.5/imap+ldap v2.4) with ESMTP id PAA22124;
        Fri, 14 Apr 2000 15:19:21 +0900 (JST)
Received: from localhost (localhost.morgan.com [127.0.0.1]) by ebid530.morgan.com (8.8.5/sendmail.cf.client v1.05) with ESMTP id PAA11699; Fri, 14 Apr 2000 15:19:20 +0900 (JST)
To: igarashi / ueda.info.waseda.ac.jp
Cc: hiro / zob.ne.jp
Subject: Re: Ruby/GTK
From: Hiroyuki ARAKI <Hiroyuki.Araki / msdw.com>
X-Mailer: Mew version 1.94.1 on Emacs 19.34 / Mule 2.3
 so-2022-jp?B?KBskQkt2RSYyVhsoQik
Reply-To: hiro / zob.ne.jp
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
Message-Id: <20000414151919B.araki / ebid530.ms.com>
Date: Fri, 14 Apr 2000 15:19:19 +0900
Sender: araki / ms.com (Hiroyuki ARAKI)
X-Dispatcher: imput version 990905(IM130)
Lines: 220
Content-Type: Multipart/Mixed;
 boundary-Next_Part(Fri_Apr_14_15:19:07_2000_595)--"
X-UIDL: abfcafd98a3b9eafd9473b6eaf2bf22c

----Next_Part(Fri_Apr_14_15:19:07_2000_595)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit

いがらしさん、こんにちは。以前アクセラレータのパッチを採用して頂いた
あらきです。

実は先日来、必要性があって、GtkExtra(http://www.ifir.edu.ar/grupos/gtk/)
の Ruby のラッパをつくっています。

で、これのサンプルを動作させようとすると、Ruby/Gtk にもいくつかの機濡不足があったので、またもやパッチを作成しました。

採用して頂けるとうれしいです。

追加は Gdk 回りです。

Gdk::Font::char_width
Gdk::Font::char_width_wc
Gdk::Font::char_measure
Gdk::Font::char_height

Gdk::Color::parse
Gdk::Color::alloc

Gdk::Pixmap::colormap_create_from_xpm
Gdk::Pixmap::colormap_create_from_xpm_d

の8つのエントリを追加しました。
GtkExtra のラッパは GtkSheet, GtkItemEntry, GtkFontCombo,
GtkColorCombo, GtkBorderCombo まで作成してあります。
形がついたら、公開しようかなと思っているのですが、RAA には
見当たりませんが世間様が既につくっているとかいう嬉しいことは
……ありますか? (^^;

# GtkSheet は pointer を返すコールバックがあるのと
# Ruby/Gtk の枠組に突っ込むと、signal_connect を呼んだあと
# オリジナルのGtkSheet 内で呼び気譴 皷芬瘡焙蜩竢銕繝烽煕
が警告メッセージを垢茲Δ砲覆辰討靴泙事が解決できないえ
困っているのですが……(^^;
# あと、非常にキタナイ(^^;; > 自分のつくったコード(^^;

作成したパッチを添付しますので宜しくお願いします。
ではでは。

あらき
---
Hiroyuki Araki <Hiroyuki.Araki / msdw.com>
Morgan Stanley Dean Witter Japan Limited/Tokyo Branch


----Next_Part(Fri_Apr_14_15:19:07_2000_595)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="gtk.diff"

*** gtk-0.23/src/rbgdk.c	Sat Jan  8 20:52:27 2000
--- gtk-new/src/rbgdk.c	Thu Apr 13 22:49:13 2000
***************
*** 569,574 ****
--- 569,602 ----
  		       INT2NUM(width), INT2NUM(ascent), INT2NUM(descent));
  }
  
+ static VALUE
+ gdkfnt_char_width(self, character)
+      VALUE self, character;
+ {
+   return INT2NUM(gdk_char_width(get_gdkfont(self), (gchar)NUM2INT(character)));
+ }
+ 
+ static VALUE
+ gdkfnt_char_width_wc(self, character)
+      VALUE self, character;
+ {
+   return INT2NUM(gdk_char_width_wc(get_gdkfont(self), NUM2INT(character)));
+ }
+ 
+ static VALUE
+ gdkfnt_char_measure(self, character)
+      VALUE self, character;
+ {
+   return INT2NUM(gdk_char_measure(get_gdkfont(self), (gchar)NUM2INT(character)));
+ }
+ 
+ static VALUE
+ gdkfnt_char_height(self, character)
+      VALUE self, character;
+ {
+   return INT2NUM(gdk_char_height(get_gdkfont(self), (gchar)NUM2INT(character)));
+ }
+ 
  /*
   * Gdk::Image
   */
***************
*** 850,855 ****
--- 878,887 ----
      rb_define_method(gdkFont, "descent", gdkfnt_descent, 0);
      rb_define_method(gdkFont, ", gdkfnt_equal, 1);
      rb_define_method(gdkFont, "string_extents", gdkfnt_string_extents, 1);
+     rb_define_method(gdkFont, "char_width", gdkfnt_char_width, 1);
+     rb_define_method(gdkFont, "char_width_wc", gdkfnt_char_width_wc, 1);
+     rb_define_method(gdkFont, "char_measure", gdkfnt_char_measure, 1);
+     rb_define_method(gdkFont, "char_height", gdkfnt_char_height, 1);
  
      /*
       * Gdk::GC
*** gtk-0.23/src/rbgdkcolor.c	Sat Jan  8 20:52:27 2000
--- gtk-new/src/rbgdkcolor.c	Thu Apr 13 19:56:08 2000
***************
*** 78,83 ****
--- 78,101 ----
      return make_gdkcolor(&c);
  }
  
+ static VALUE
+ gdkcolor_s_parse(self, name)
+      VALUE self;
+      VALUE name;
+ {
+   GdkColor c;
+   gdk_color_parse(STR2CSTR(name), &c);
+   return make_gdkcolor(&c);
+ }
+ 
+ static VALUE
+ gdkcolor_alloc(self, colormap)
+      VALUE self;
+      VALUE colormap;
+ {
+   gdk_color_alloc(get_gdkcmap(colormap), get_gdkcolor(self));
+   return self;
+ }
  
  /*
   * Gdk::ColorContext
***************
*** 104,109 ****
--- 122,129 ----
      gdkColor  b_define_class_under(mGdk, "Color", rb_cData);
  
      rb_define_singleton_method(gdkColor, "new", gdkcolor_s_new, 3);
+     rb_define_singleton_method(gdkColor, "parse", gdkcolor_s_parse, 1);
+     rb_define_method(gdkColor, "alloc", gdkcolor_alloc, 1);
  
      /*
       * Gdk::ColorContext
*** gtk-0.23/src/rbgdkpixmap.c	Sat Jan  8 20:52:28 2000
--- gtk-new/src/rbgdkpixmap.c	Fri Apr 14 11:15:06 2000
***************
*** 88,93 ****
--- 88,139 ----
  			new_gdkbitmap(mask));
  }
  
+ static VALUE
+ gdkpmap_colormap_create_from_xpm(self, win, colormap, tcolor, fname)
+     VALUE self, win, colormap, tcolor, fname;
+ {
+     GdkPixmap *new;
+     GdkBitmap *mask;
+     GdkWindow *window  et_gdkwindow(win);
+ 
+     new  dk_pixmap_colormap_create_from_xpm(window, 
+ 					      get_gdkcmap(colormap),
+ 					      &mask,
+ 					      get_gdkcolor(tcolor),
+ 					      STR2CSTR(fname));
+     if (!new) {
+ 	rb_raise(rb_eArgError, "Pixmap not created from %s", STR2CSTR(fname));
+     }
+     return rb_assoc_new(new_gdkpixmap(new),
+ 			new_gdkbitmap(mask));
+ }
+ 
+ static VALUE
+ gdkpmap_colormap_create_from_xpm_d(self, win, colormap, tcolor, data)
+     VALUE self, win, colormap, tcolor, data;
+ {
+     GdkPixmap *new;
+     GdkBitmap *mask;
+     GdkWindow *window  et_gdkwindow(win);
+     int i;
+     gchar **buf;
+ 
+     Check_Type(data, T_ARRAY);
+     buf  LLOCA_N(char*, RARRAY(data)->len);
+     for (i i<RARRAY(data)->len; i++) {
+ 	buf[i]  TR2CSTR(RARRAY(data)->ptr[i]);
+     }
+ 
+     new  dk_pixmap_colormap_create_from_xpm_d(window,
+ 						get_gdkcmap(colormap),
+ 						&mask,
+ 						get_gdkcolor(tcolor),
+ 						buf);
+ 
+     return rb_assoc_new(new_gdkpixmap(new),
+ 			new_gdkbitmap(mask));
+ }
+ 
  
  /*
   * Gdk::Bitmap
***************
*** 156,161 ****
--- 202,211 ----
  			       gdkpmap_create_from_xpm, 3);
      rb_define_singleton_method(gdkPixmap, "create_from_xpm_d",
  			       gdkpmap_create_from_xpm_d, 3);
+     rb_define_singleton_method(gdkPixmap, "colormap_create_from_xpm",
+ 			       gdkpmap_colormap_create_from_xpm, 4);
+     rb_define_singleton_method(gdkPixmap, "colormap_create_from_xpm_d",
+ 			       gdkpmap_colormap_create_from_xpm_d, 4);
  
      /*
       * GdkBitmap

----Next_Part(Fri_Apr_14_15:19:07_2000_595)----


--Multipart_Fri_Apr_14_16:26:27_2000-1--