* ext: remove trailing spaces.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2011-05-22 09:26:02 +00:00
Родитель 87dbea7bbf
Коммит 0d6d23b25d
83 изменённых файлов: 1033 добавлений и 1033 удалений

Просмотреть файл

@ -51,7 +51,7 @@ You can redistribute it and/or modify it under either the terms of the GPL
* The Author * The Author
Feel free to send comments and bug reports to the author. Here is the Feel free to send comments and bug reports to the author. Here is the
author's latest mail address: author's latest mail address:
shigeo@tinyforest.gr.jp shigeo@tinyforest.gr.jp

Просмотреть файл

@ -31,14 +31,14 @@ pre
<BODY BGCOLOR=#FFFFE0> <BODY BGCOLOR=#FFFFE0>
<H1>BigDecimal(Variable Precision Floating Library for Ruby)</H1> <H1>BigDecimal(Variable Precision Floating Library for Ruby)</H1>
<DIV align="right"><A HREF="./bigdecimal_ja.html">Japanese</A></DIV><BR> <DIV align="right"><A HREF="./bigdecimal_ja.html">Japanese</A></DIV><BR>
BigDecimal is an extension library for the Ruby interpreter. BigDecimal is an extension library for the Ruby interpreter.
Using BigDecimal class, you can obtain any number of significant digits in computation. Using BigDecimal class, you can obtain any number of significant digits in computation.
For the details about Ruby see:<BR> For the details about Ruby see:<BR>
<UL> <UL>
<LI><A HREF="http://www.ruby-lang.org/en/">http://www.ruby-lang.org/en/</A>:Official Ruby page(English).</LI> <LI><A HREF="http://www.ruby-lang.org/en/">http://www.ruby-lang.org/en/</A>:Official Ruby page(English).</LI>
<LI><A HREF="http://kahori.com/ruby/ring/">http://kahori.com/ruby/ring/</A>:Mutually linked pages relating to Ruby(Japanese). <LI><A HREF="http://kahori.com/ruby/ring/">http://kahori.com/ruby/ring/</A>:Mutually linked pages relating to Ruby(Japanese).
</LI> </LI>
</UL> </UL>
NOTE:<BR> NOTE:<BR>
This software is provided "AS IS" and without any express or This software is provided "AS IS" and without any express or
implied warranties,including,without limitation,the implied implied warranties,including,without limitation,the implied
@ -62,15 +62,15 @@ NOTE:<BR>
<A NAME="#INTRO"> <A NAME="#INTRO">
<H2>Introduction</H2> <H2>Introduction</H2>
Ruby already has builtin (variable length integer number) class Bignum. Using Bignum class,you can obtain Ruby already has builtin (variable length integer number) class Bignum. Using Bignum class,you can obtain
any integer value in magnitude. But, variable length decimal number class is not yet built in. any integer value in magnitude. But, variable length decimal number class is not yet built in.
This is why I made variable length floating class BigDecimal. This is why I made variable length floating class BigDecimal.
Feel free to send any comments or bug reports to me. Feel free to send any comments or bug reports to me.
<A HREF="mailto:shigeo@tinyforest.gr.jp">shigeo@tinyforest.gr.jp</A> <A HREF="mailto:shigeo@tinyforest.gr.jp">shigeo@tinyforest.gr.jp</A>
I will try(but can't promise) to fix bugs reported. I will try(but can't promise) to fix bugs reported.
<hr> <hr>
<H2>Installation</H2> <H2>Installation</H2>
The Ruby latest version can be downloaded from <A HREF="http://www.ruby-lang.org/en/">Official Ruby page</A>. The Ruby latest version can be downloaded from <A HREF="http://www.ruby-lang.org/en/">Official Ruby page</A>.
Once decompress the downloaded Ruby archive,follow the normal installation procedures according to the Once decompress the downloaded Ruby archive,follow the normal installation procedures according to the
documents included. documents included.
<A NAME="#SPEC"> <A NAME="#SPEC">
@ -89,7 +89,7 @@ to create BigDecimal objects,the program would like:<BR>
In 32 bits integer system,every 4 digits(in decimal) are computed simultaneously. In 32 bits integer system,every 4 digits(in decimal) are computed simultaneously.
This means the number of significant digits in BigDecimal is always a multiple of 4. This means the number of significant digits in BigDecimal is always a multiple of 4.
<P> <P>
Some more methods are available in Ruby code (not C code). Some more methods are available in Ruby code (not C code).
Functions such as sin,cos ...,are in math.rb in bigdecimal directory. Functions such as sin,cos ...,are in math.rb in bigdecimal directory.
To use them,require math.rb as: To use them,require math.rb as:
<CODE><PRE> <CODE><PRE>
@ -110,7 +110,7 @@ For details,see the util.rb code.
a=BigDecimal::new(s[,n]) or<BR> a=BigDecimal::new(s[,n]) or<BR>
a=BigDecimal(s[,n]) or<BR> a=BigDecimal(s[,n]) or<BR>
where:<BR> where:<BR>
s: Initial value string. Spaces will be ignored. Any unrecognizable character for s: Initial value string. Spaces will be ignored. Any unrecognizable character for
representing initial value terminates the string.<BR> representing initial value terminates the string.<BR>
n: Maximum number of significant digits of a. n must be a Fixnum object. n: Maximum number of significant digits of a. n must be a Fixnum object.
If n is omitted or is equal to 0,then the maximum number of significant digits of a is determined from the length of s. If n is omitted or is equal to 0,then the maximum number of significant digits of a is determined from the length of s.
@ -146,7 +146,7 @@ EXCEPTION_OVERFLOW controls the execution when computation overflows.<BR>
EXCEPTION_ZERODIVIDE controls the execution when zero-division occurs.<BR> EXCEPTION_ZERODIVIDE controls the execution when zero-division occurs.<BR>
EXCEPTION_ALL controls the execution when any defined exception occurs.<BR> EXCEPTION_ALL controls the execution when any defined exception occurs.<BR>
If the flag is true,then the relating exception is thrown.<BR> If the flag is true,then the relating exception is thrown.<BR>
No exception is thrown when the flag is false(default) and computation No exception is thrown when the flag is false(default) and computation
continues with the result:<BR> continues with the result:<BR>
<BLOCKQUOTE> <BLOCKQUOTE>
EXCEPTION_NaN results to NaN<BR> EXCEPTION_NaN results to NaN<BR>
@ -159,7 +159,7 @@ EXCEPTION_INFINITY,EXCEPTION_OVERFLOW, and EXCEPTION_ZERODIVIDE are
currently the same.<BR> currently the same.<BR>
The return value of mode method is the value set.<BR> The return value of mode method is the value set.<BR>
If nil is specified for the second argument,then current setting is returned.<BR> If nil is specified for the second argument,then current setting is returned.<BR>
Suppose the return value of the mode method is f,then Suppose the return value of the mode method is f,then
f &amp; BigDecimal::EXCEPTION_NaN !=0 means EXCEPTION_NaN is set to on. f &amp; BigDecimal::EXCEPTION_NaN !=0 means EXCEPTION_NaN is set to on.
<P> <P>
<B>[ROUND error control]</B><P> <B>[ROUND error control]</B><P>
@ -185,7 +185,7 @@ use truncate/round/ceil/floor/add/sub/mult/div methods for each instance instead
<LI><B>limit[(n)]</B></LI><BLOCKQUOTE> <LI><B>limit[(n)]</B></LI><BLOCKQUOTE>
Limits the maximum digits that the newly created BigDecimal objects can hold never exceed n. Limits the maximum digits that the newly created BigDecimal objects can hold never exceed n.
This means the rounding operation specified by BigDecimal.mode is This means the rounding operation specified by BigDecimal.mode is
performed if necessary. performed if necessary.
limit returns the value before set if n is nil or is not specified. limit returns the value before set if n is nil or is not specified.
Zero,the default value,means no upper limit.<BR> Zero,the default value,means no upper limit.<BR>
@ -194,7 +194,7 @@ mf = BigDecimal::limit(n)<BR>
</BLOCKQUOTE> </BLOCKQUOTE>
<LI><B>double_fig</B></LI><BLOCKQUOTE> <LI><B>double_fig</B></LI><BLOCKQUOTE>
double_fig is a class method which returns the number of digits double_fig is a class method which returns the number of digits
the Float class can have. the Float class can have.
<CODE><PRE> <CODE><PRE>
p BigDecimal::double_fig # ==> 20 (depends on the CPU etc.) p BigDecimal::double_fig # ==> 20 (depends on the CPU etc.)
@ -290,7 +290,7 @@ returns the maximum integer value (in BigDecimal) which is less than or equal to
c = BigDecimal("-1.23456").floor # ==> -2 c = BigDecimal("-1.23456").floor # ==> -2
</PRE></CODE> </PRE></CODE>
As shown in the following example,an optional integer argument (n) specifying the position As shown in the following example,an optional integer argument (n) specifying the position
of the target digit can be given.<BR> of the target digit can be given.<BR>
If n> 0,then the (n+1)th digit counted from the decimal point in fraction part is processed(resulting number of fraction part digits is less than or equal to n).<BR> If n> 0,then the (n+1)th digit counted from the decimal point in fraction part is processed(resulting number of fraction part digits is less than or equal to n).<BR>
If n<0,then the n-th digit counted from the decimal point in integer part is processed(at least n 0's are placed from the decimal point to left). If n<0,then the n-th digit counted from the decimal point in integer part is processed(at least n 0's are placed from the decimal point to left).
@ -308,7 +308,7 @@ returns the minimum integer value (in BigDecimal) which is greater than or equal
c = BigDecimal("-1.23456").ceil # ==> -1 c = BigDecimal("-1.23456").ceil # ==> -1
</PRE></CODE> </PRE></CODE>
As shown in the following example,an optional integer argument (n) specifying the position As shown in the following example,an optional integer argument (n) specifying the position
of the target digit can be given.<BR> of the target digit can be given.<BR>
If n>0,then the (n+1)th digit counted from the decimal point in fraction part is processed(resulting number of fraction part digits is less than or equal to n).<BR> If n>0,then the (n+1)th digit counted from the decimal point in fraction part is processed(resulting number of fraction part digits is less than or equal to n).<BR>
If n<0,then the n-th digit counted from the decimal point in integer part is processed(at least n 0's are placed from the decimal point to left). If n<0,then the n-th digit counted from the decimal point in integer part is processed(at least n 0's are placed from the decimal point to left).
@ -327,7 +327,7 @@ round a to the nearest 1(default)ÅD<BR>
</PRE></CODE> </PRE></CODE>
The rounding operation changes according to BigDecimal::mode(BigDecimal::ROUND_MODE,flag) if specified. The rounding operation changes according to BigDecimal::mode(BigDecimal::ROUND_MODE,flag) if specified.
As shown in the following example,an optional integer argument (n) specifying the position As shown in the following example,an optional integer argument (n) specifying the position
of the target digit can be given.<BR> of the target digit can be given.<BR>
If n>0,then the (n+1)th digit counted from the decimal point in fraction part is processed(resulting number of fraction part digits is less than or equal to n).<BR> If n>0,then the (n+1)th digit counted from the decimal point in fraction part is processed(resulting number of fraction part digits is less than or equal to n).<BR>
If n<0,then the n-th digit counted from the decimal point in integer part is processed(at least n 0's are placed from the decimal point to left). If n<0,then the n-th digit counted from the decimal point in integer part is processed(at least n 0's are placed from the decimal point to left).
@ -346,7 +346,7 @@ c = BigDecimal::new("1.23356").round(3,BigDecimal::ROUND_HALF_EVEN) # ==> 1.2
<LI><B>truncate[(n)]</B></LI><BLOCKQUOTE> <LI><B>truncate[(n)]</B></LI><BLOCKQUOTE>
c = a.truncate<BR> c = a.truncate<BR>
truncate a to the nearest 1ÅD<BR> truncate a to the nearest 1ÅD<BR>
As shown in the following example,an optional integer argument (n) specifying the position As shown in the following example,an optional integer argument (n) specifying the position
of the target digit can be given.<BR> of the target digit can be given.<BR>
If n>0,then the (n+1)th digit counted from the decimal point in fraction part is processed(resulting number of fraction part digits is less than or equal to n).<BR> If n>0,then the (n+1)th digit counted from the decimal point in fraction part is processed(resulting number of fraction part digits is less than or equal to n).<BR>
If n<0,then the n-th digit counted from the decimal point in integer part is processed(at least n 0's are placed from the decimal point to left). If n<0,then the n-th digit counted from the decimal point in integer part is processed(at least n 0's are placed from the decimal point to left).
@ -373,7 +373,7 @@ converts to string(default results look like "0.xxxxxEn").
<CODE><PRE> <CODE><PRE>
BigDecimal("1.23456").to_s # ==> "0.123456E1" BigDecimal("1.23456").to_s # ==> "0.123456E1"
</PRE></CODE> </PRE></CODE>
If n(>0) is given,then a space is inserted to each of two parts divided by the decimal point If n(>0) is given,then a space is inserted to each of two parts divided by the decimal point
after every n digits for readability. after every n digits for readability.
<CODE><PRE> <CODE><PRE>
BigDecimal("0.1234567890123456789").to_s(10) # ==> "0.1234567890 123456789E0" BigDecimal("0.1234567890123456789").to_s(10) # ==> "0.1234567890 123456789E0"
@ -390,7 +390,7 @@ BigDecimal("0.1234567890123456789").to_s("+10") # ==> "+0.1234567890 123456789E
BigDecimal("-0.1234567890123456789").to_s("10") # ==> "-0.1234567890 123456789E0" BigDecimal("-0.1234567890123456789").to_s("10") # ==> "-0.1234567890 123456789E0"
</PRE></CODE> </PRE></CODE>
At the end of the string,'E'(or 'e') or 'F'(or 'f') can be specified to change At the end of the string,'E'(or 'e') or 'F'(or 'f') can be specified to change
number representation. number representation.
<CODE><PRE> <CODE><PRE>
BigDecimal("1234567890.123456789").to_s("E") # ==> "0.1234567890123456789E10" BigDecimal("1234567890.123456789").to_s("E") # ==> "0.1234567890123456789E10"
@ -408,7 +408,7 @@ means a = 0.xxxxxxx*10**n.
<LI><B>precs</B></LI><BLOCKQUOTE> <LI><B>precs</B></LI><BLOCKQUOTE>
n,m = a.precs <BR> n,m = a.precs <BR>
precs returns number of significant digits (n) and maximum number of precs returns number of significant digits (n) and maximum number of
significant digits (m) of a. significant digits (m) of a.
</BLOCKQUOTE> </BLOCKQUOTE>
@ -473,7 +473,7 @@ p a=BigDecimal::new("3.14",10)<BR>
should produce output like "#&lt;0x112344:'0.314E1',4(12)%gt;". should produce output like "#&lt;0x112344:'0.314E1',4(12)%gt;".
where "0x112344" is the address, where "0x112344" is the address,
'0.314E1' is the value,4 is the number of the significant digits, '0.314E1' is the value,4 is the number of the significant digits,
and 12 is the maximum number of the significant digits and 12 is the maximum number of the significant digits
the object can hold. the object can hold.
</BLOCKQUOTE> </BLOCKQUOTE>
@ -527,12 +527,12 @@ same as ==,used in case statement.
<DT> 2.A is the BigDecimal object but B is other than BigDecimal object</DT> <DT> 2.A is the BigDecimal object but B is other than BigDecimal object</DT>
<DD> Operation is performed,after B is translated to corresponding BigDecimal object(because BigDecimal supports coerce method).</DD> <DD> Operation is performed,after B is translated to corresponding BigDecimal object(because BigDecimal supports coerce method).</DD>
<DT> 3.A is not the BigDecimal object but B is BigDecimal object</DT> <DT> 3.A is not the BigDecimal object but B is BigDecimal object</DT>
<DD>If A has coerce method,then B will translate A to corresponding <DD>If A has coerce method,then B will translate A to corresponding
BigDecimal object and the operation is performed,otherwise an error occures.</DD> BigDecimal object and the operation is performed,otherwise an error occures.</DD>
</DL> </DL>
String is not translated to BigDecimal in default. String is not translated to BigDecimal in default.
Uncomment /* #define ENABLE_NUMERIC_STRING */ in bigdecimal.c, compile and install Uncomment /* #define ENABLE_NUMERIC_STRING */ in bigdecimal.c, compile and install
again if you want to enable string to BigDecimal conversion. again if you want to enable string to BigDecimal conversion.
Translation stops without error at the character representing non digit. Translation stops without error at the character representing non digit.
For instance,"10XX" is translated to 10,"XXXX" is translated to 0.<BR> For instance,"10XX" is translated to 10,"XXXX" is translated to 0.<BR>
@ -563,7 +563,7 @@ and define coerce method within the new class.<BR>
Infinite numbers and NaN can be represented by string writing "+Infinity"(or "Infinity"),"-Infinity",and "NaN" respectively in your program. Infinite numbers and NaN can be represented by string writing "+Infinity"(or "Infinity"),"-Infinity",and "NaN" respectively in your program.
Infinite numbers can be obtained by 1.0/0.0(=Infinity) or -1.0/0.0(=-Infinity). Infinite numbers can be obtained by 1.0/0.0(=Infinity) or -1.0/0.0(=-Infinity).
<BR><BR> <BR><BR>
NaN(Not a number) can be obtained by undefined computation like 0.0/0.0 NaN(Not a number) can be obtained by undefined computation like 0.0/0.0
or Infinity-Infinity. or Infinity-Infinity.
Any computation including NaN results to NaN. Any computation including NaN results to NaN.
Comparisons with NaN never become true,including comparison with NaN itself. Comparisons with NaN never become true,including comparison with NaN itself.
@ -602,7 +602,7 @@ where 'x' is any digit representing mantissa(kept in the array frac[]),
BASE is base value(=10000 in 32 bit integer system), BASE is base value(=10000 in 32 bit integer system),
and n is the exponent value.<BR> and n is the exponent value.<BR>
Larger BASE value enables smaller size of the array frac[],and increases computation speed. Larger BASE value enables smaller size of the array frac[],and increases computation speed.
The value of BASE is defined ind VpInit(). In 32 bit integer system, this value is The value of BASE is defined ind VpInit(). In 32 bit integer system, this value is
10000. In 64 bit integer system, the value is 1000000000. 10000. In 64 bit integer system, the value is 1000000000.
When BASE is 10000,an element of the array frac[] can have value of from 0 to 9999. When BASE is 10000,an element of the array frac[] can have value of from 0 to 9999.
(up to 4 digits).<BR> (up to 4 digits).<BR>
@ -630,7 +630,7 @@ The decimal value 1234.56784321 is represented as(BASE=10000):<BR>
0.1234 5678 4321*(10000)**1 0.1234 5678 4321*(10000)**1
</PRE> </PRE>
where frac[0]=1234,frac[1]=5678,frac[2]=4321, where frac[0]=1234,frac[1]=5678,frac[2]=4321,
Prec=3,sign=2,exponent=1. MaxPrec can be any value greater than or equal to Prec=3,sign=2,exponent=1. MaxPrec can be any value greater than or equal to
Prec. Prec.
<hr> <hr>
@ -657,7 +657,7 @@ The reason why I adopted decimal number representation for BigDecimal is:<BR>
end end
</PRE></CODE> </PRE></CODE>
If the internal representation is binary,translation from decimal to If the internal representation is binary,translation from decimal to
binary is required and the translation error is inevitable. binary is required and the translation error is inevitable.
For example, 0.1 can not exactly be represented in binary.<BR> For example, 0.1 can not exactly be represented in binary.<BR>
0.1 => b1*2**(-1)+b1*2**(-2)+b3*2**(-3)+b4*2**(-4)....<BR> 0.1 => b1*2**(-1)+b1*2**(-2)+b3*2**(-3)+b4*2**(-4)....<BR>
@ -669,7 +669,7 @@ Of course, exact "0.1" is printed if the rounding operation is properly done,
<DD>In binary representation,0.1 can not be represented in finite series of digit. <DD>In binary representation,0.1 can not be represented in finite series of digit.
But we only need one element(frac[0]=1) in decimal representation. But we only need one element(frac[0]=1) in decimal representation.
This means that we can always determine the size of the array frac[] in Real This means that we can always determine the size of the array frac[] in Real
structure. structure.
</DL> </DL>
@ -689,11 +689,11 @@ For the fundamental arithmetics such as addition,subtraction,
multiplication,and division,I prepared 2 group of methods<BR> multiplication,and division,I prepared 2 group of methods<BR>
<H3>1. +,-,*,/</H3> <H3>1. +,-,*,/</H3>
For the operation + - * /,you can not specify the resulting For the operation + - * /,you can not specify the resulting
number of significant digits.<BR> number of significant digits.<BR>
Resulting number of significant digits are defined as:<BR> Resulting number of significant digits are defined as:<BR>
1.1 For *,resulting number of significant digits is the sum of the 1.1 For *,resulting number of significant digits is the sum of the
significant digits of both side of the operator. For / ,resulting number of significant digits is the sum of the significant digits of both side of the operator. For / ,resulting number of significant digits is the sum of the
maximum significant digits of both side of the operator.<BR> maximum significant digits of both side of the operator.<BR>
1.2 For + and -,resulting number of significant digits is determined so that 1.2 For + and -,resulting number of significant digits is determined so that
no round operation is needed. <br> no round operation is needed. <br>
@ -705,7 +705,7 @@ which means more memory is required to keep computation results.
But,the division such as c=1.0/3.0 will always be rounded.<BR> But,the division such as c=1.0/3.0 will always be rounded.<BR>
<H3>2. add,sub,mult,div</H3> <H3>2. add,sub,mult,div</H3>
The length of the significant digits obtained from +,-,*,/ The length of the significant digits obtained from +,-,*,/
is always defined by that of right and left side of the operator. is always defined by that of right and left side of the operator.
To specify the length of the significant digits by your self, To specify the length of the significant digits by your self,
use methos add,sub,mult,div. use methos add,sub,mult,div.
@ -724,7 +724,7 @@ decimal point.
<H3>4. Example</H3> <H3>4. Example</H3>
Following example compute the ratio of the circumference of a circle to Following example compute the ratio of the circumference of a circle to
its diameter(pi=3.14159265358979....) using J.Machin's formula. its diameter(pi=3.14159265358979....) using J.Machin's formula.
<BR><BR> <BR><BR>
<CODE><PRE> <CODE><PRE>
@ -746,7 +746,7 @@ def big_pi(sig) # sig: Number of significant figures
k = BigDecimal::new("1") k = BigDecimal::new("1")
w = BigDecimal::new("1") w = BigDecimal::new("1")
t = BigDecimal::new("-80") t = BigDecimal::new("-80")
while (u.nonzero? && u.exponent >= exp) while (u.nonzero? && u.exponent >= exp)
t = t*m25 t = t*m25
u = t.div(k,sig) u = t.div(k,sig)
pi = pi + u pi = pi + u

Просмотреть файл

@ -41,7 +41,7 @@ Ruby
<UL> <UL>
<LI><A HREF="http://www.ruby-lang.org/ja/">http://www.ruby-lang.org/ja/</A>Ruby公式ページ</LI> <LI><A HREF="http://www.ruby-lang.org/ja/">http://www.ruby-lang.org/ja/</A>Ruby公式ページ</LI>
<LI><A HREF="http://kahori.com/ruby/ring/">http://kahori.com/ruby/ring/</A>Rubyに関するページを辿れます</LI> <LI><A HREF="http://kahori.com/ruby/ring/">http://kahori.com/ruby/ring/</A>Rubyに関するページを辿れます</LI>
</UL> </UL>
<hr> <hr>
<H2>目次</H2> <H2>目次</H2>
<UL> <UL>
@ -73,8 +73,8 @@ Ruby
BigDecimal を含む Ruby の最新版は<A HREF="http://www.ruby-lang.org/ja/">Ruby公式ページ</A>からダウンロードできます。 BigDecimal を含む Ruby の最新版は<A HREF="http://www.ruby-lang.org/ja/">Ruby公式ページ</A>からダウンロードできます。
ダウンロードした最新版を解凍したら、通常のインストール手順を実行して下さい。 ダウンロードした最新版を解凍したら、通常のインストール手順を実行して下さい。
Ruby が正しくインストールされれば、同時に BigDecimal も利用できるようになるはずです。 Ruby が正しくインストールされれば、同時に BigDecimal も利用できるようになるはずです。
ソースファイルは ソースファイルは
bigdecimal.c,bigdecimal.h bigdecimal.c,bigdecimal.h
の2個のみです。<BR> の2個のみです。<BR>
<hr> <hr>
@ -332,7 +332,7 @@ n>=0
<LI><B>round[(n[,b])]</B></LI><BLOCKQUOTE> <LI><B>round[(n[,b])]</B></LI><BLOCKQUOTE>
c = a.round<BR> c = a.round<BR>
クラスメソッド BigDecimal::mode(BigDecimal::ROUND_MODE,flag) で指定した クラスメソッド BigDecimal::mode(BigDecimal::ROUND_MODE,flag) で指定した
ROUND_MODE に従って丸め操作を実行します。 ROUND_MODE に従って丸め操作を実行します。
BigDecimal::mode(BigDecimal::ROUND_MODE,flag) で何も指定せず、かつ、引数 BigDecimal::mode(BigDecimal::ROUND_MODE,flag) で何も指定せず、かつ、引数
を指定しない場合は「小数点以下第一位の数を四捨五入して整数BigDecimal 値)」にします。<BR> を指定しない場合は「小数点以下第一位の数を四捨五入して整数BigDecimal 値)」にします。<BR>
@ -505,7 +505,7 @@ c = a.sqrt(n)<BR>
<LI><B>&lt=&gt</B></LI><BLOCKQUOTE> <LI><B>&lt=&gt</B></LI><BLOCKQUOTE>
a==b なら 0、a &gt b なら 1、a &lt b なら -1 になります。<BR> a==b なら 0、a &gt b なら 1、a &lt b なら -1 になります。<BR>
c = a &lt=&gt b c = a &lt=&gt b
</BLOCKQUOTE> </BLOCKQUOTE>
</UL> </UL>
後は、読んで字の如くです。<BR> 後は、読んで字の如くです。<BR>
@ -753,7 +753,7 @@ def big_pi(sig) # sig: Number of significant figures
k = BigDecimal::new("1") k = BigDecimal::new("1")
w = BigDecimal::new("1") w = BigDecimal::new("1")
t = BigDecimal::new("-80") t = BigDecimal::new("-80")
while (u.nonzero? && u.exponent >= exp) while (u.nonzero? && u.exponent >= exp)
t = t*m25 t = t*m25
u = t.div(k,sig) u = t.div(k,sig)
pi = pi + u pi = pi + u

Просмотреть файл

@ -37,7 +37,7 @@ module Jacobian
end end
end end
end end
# Computes the derivative of f[i] at x[i]. # Computes the derivative of f[i] at x[i].
# fx is the value of f at x. # fx is the value of f at x.

Просмотреть файл

@ -8,7 +8,7 @@ class Float < Numeric
# require 'bigdecimal/util' # require 'bigdecimal/util'
# #
# 0.5.to_d # 0.5.to_d
# # => #<BigDecimal:1dc69e0,'0.5E0',9(18)> # # => #<BigDecimal:1dc69e0,'0.5E0',9(18)>
# #
def to_d def to_d
BigDecimal(self.to_s) BigDecimal(self.to_s)
@ -25,7 +25,7 @@ class String
# require 'bigdecimal/util' # require 'bigdecimal/util'
# #
# "0.5".to_d # "0.5".to_d
# # => #<BigDecimal:1dc69e0,'0.5E0',9(18)> # # => #<BigDecimal:1dc69e0,'0.5E0',9(18)>
# #
def to_d def to_d
BigDecimal(self) BigDecimal(self)
@ -69,7 +69,7 @@ class Rational < Numeric
# r.to_d # r.to_d
# # => #<BigDecimal:1a52bd8,'0.3142857142 8571427937 0154144999 105E1',45(63)> # # => #<BigDecimal:1a52bd8,'0.3142857142 8571427937 0154144999 105E1',45(63)>
# r.to_d(3) # r.to_d(3)
# # => #<BigDecimal:1a44d08,'0.314E1',18(36)> # # => #<BigDecimal:1a44d08,'0.314E1',18(36)>
def to_d(nFig=0) def to_d(nFig=0)
num = self.numerator.to_s num = self.numerator.to_s
if nFig<=0 if nFig<=0

Просмотреть файл

@ -219,7 +219,7 @@ curses_closed(void)
* Document-method: Curses.clear * Document-method: Curses.clear
* *
* Clears every position on the screen completely, * Clears every position on the screen completely,
* so that a subsequent call by Curses.refresh for the screen/window * so that a subsequent call by Curses.refresh for the screen/window
* will be repainted from scratch. * will be repainted from scratch.
*/ */
static VALUE static VALUE
@ -230,7 +230,7 @@ curses_clear(VALUE obj)
return Qnil; return Qnil;
} }
/* /*
* Document-method: Curses.clrtoeol * Document-method: Curses.clrtoeol
* *
* Clears to the end of line, that the cursor is currently on. * Clears to the end of line, that the cursor is currently on.
@ -243,7 +243,7 @@ curses_clrtoeol(void)
return Qnil; return Qnil;
} }
/* /*
* Document-method: Curses.refresh * Document-method: Curses.refresh
* *
* Refreshes the windows and lines. * Refreshes the windows and lines.
@ -257,7 +257,7 @@ curses_refresh(VALUE obj)
return Qnil; return Qnil;
} }
/* /*
* Document-method: Curses.doupdate * Document-method: Curses.doupdate
* *
* Refreshes the windows and lines. * Refreshes the windows and lines.
@ -361,7 +361,7 @@ curses_noraw(VALUE obj)
* call Curses.cbreak or Curses.nocbreak explicitly. * call Curses.cbreak or Curses.nocbreak explicitly.
* Most interactive programs using curses set the cbreak mode. * Most interactive programs using curses set the cbreak mode.
* Note that Curses.cbreak overrides Curses.raw. * Note that Curses.cbreak overrides Curses.raw.
* *
* see also Curses.raw * see also Curses.raw
*/ */
static VALUE static VALUE
@ -430,7 +430,7 @@ curses_nonl(VALUE obj)
* *
* Sounds an audible alarm on the terminal, if possible; * Sounds an audible alarm on the terminal, if possible;
* otherwise it flashes the screen (visual bell). * otherwise it flashes the screen (visual bell).
* *
* see also Curses.flash * see also Curses.flash
*/ */
static VALUE static VALUE
@ -448,7 +448,7 @@ curses_beep(VALUE obj)
* *
* Flashs the screen, for visual alarm on the terminal, if possible; * Flashs the screen, for visual alarm on the terminal, if possible;
* otherwise it sounds the alert. * otherwise it sounds the alert.
* *
* see also Curses.beep * see also Curses.beep
*/ */
static VALUE static VALUE
@ -483,7 +483,7 @@ curses_char(VALUE c)
} }
#ifdef HAVE_UNGETCH #ifdef HAVE_UNGETCH
/* /*
* Document-method: Curses.ungetch * Document-method: Curses.ungetch
* call-seq: ungetch(ch) * call-seq: ungetch(ch)
* *
@ -504,7 +504,7 @@ curses_ungetch(VALUE obj, VALUE ch)
#define curses_ungetch rb_f_notimplement #define curses_ungetch rb_f_notimplement
#endif #endif
/* /*
* Document-method: Curses.setpos * Document-method: Curses.setpos
* call-seq: setpos(y, x) * call-seq: setpos(y, x)
* *
@ -520,7 +520,7 @@ curses_setpos(VALUE obj, VALUE y, VALUE x)
return Qnil; return Qnil;
} }
/* /*
* Document-method: Curses.standout * Document-method: Curses.standout
* *
* Enables the best highlighting mode of the terminal. * Enables the best highlighting mode of the terminal.
@ -537,7 +537,7 @@ curses_standout(VALUE obj)
return Qnil; return Qnil;
} }
/* /*
* Document-method: Curses.standend * Document-method: Curses.standend
* *
* Enables the Normal display (no highlight) * Enables the Normal display (no highlight)
@ -554,7 +554,7 @@ curses_standend(VALUE obj)
return Qnil; return Qnil;
} }
/* /*
* Document-method: Curses.inch * Document-method: Curses.inch
* *
* Returns the character at the current position. * Returns the character at the current position.
@ -566,12 +566,12 @@ curses_inch(VALUE obj)
return CH2FIX(inch()); return CH2FIX(inch());
} }
/* /*
* Document-method: Curses.addch * Document-method: Curses.addch
* call-seq: addch(ch) * call-seq: addch(ch)
* *
* Add a character +ch+, with attributes, then advance the cursor. * Add a character +ch+, with attributes, then advance the cursor.
* *
* see also the system manual for curs_addch(3) * see also the system manual for curs_addch(3)
*/ */
static VALUE static VALUE
@ -582,12 +582,12 @@ curses_addch(VALUE obj, VALUE ch)
return Qnil; return Qnil;
} }
/* /*
* Document-method: Curses.insch * Document-method: Curses.insch
* call-seq: insch(ch) * call-seq: insch(ch)
* *
* Insert a character +ch+, before the cursor. * Insert a character +ch+, before the cursor.
* *
*/ */
static VALUE static VALUE
curses_insch(VALUE obj, VALUE ch) curses_insch(VALUE obj, VALUE ch)
@ -794,7 +794,7 @@ curses_curs_set(VALUE obj, VALUE visibility)
#endif #endif
} }
/* /*
* Document-method: Curses.scrl * Document-method: Curses.scrl
* call-seq: scrl(num) * call-seq: scrl(num)
* *
@ -818,7 +818,7 @@ curses_scrl(VALUE obj, VALUE n)
#endif #endif
} }
/* /*
* Document-method: Curses.setscrreg * Document-method: Curses.setscrreg
* call-seq: setscrreg(top, bottom) * call-seq: setscrreg(top, bottom)
* *
@ -843,7 +843,7 @@ curses_setscrreg(VALUE obj, VALUE top, VALUE bottom)
#endif #endif
} }
/* /*
* Document-method: Curses.attroff * Document-method: Curses.attroff
* call-seq: attroff(attrs) * call-seq: attroff(attrs)
* *
@ -859,7 +859,7 @@ curses_attroff(VALUE obj, VALUE attrs)
/* return INT2FIX(attroff(NUM2INT(attrs))); */ /* return INT2FIX(attroff(NUM2INT(attrs))); */
} }
/* /*
* Document-method: Curses.attron * Document-method: Curses.attron
* call-seq: attron(attrs) * call-seq: attron(attrs)
* *
@ -893,7 +893,7 @@ curses_attrset(VALUE obj, VALUE attrs)
/* return INT2FIX(attroff(NUM2INT(attrs))); */ /* return INT2FIX(attroff(NUM2INT(attrs))); */
} }
/* /*
* Document-method: Curses.bkgdset * Document-method: Curses.bkgdset
* call-seq: bkgdset(ch) * call-seq: bkgdset(ch)
* *
@ -916,7 +916,7 @@ curses_bkgdset(VALUE obj, VALUE ch)
return Qnil; return Qnil;
} }
/* /*
* call-seq: bkgd(ch) * call-seq: bkgd(ch)
* *
* Window background manipulation routines. * Window background manipulation routines.
@ -956,7 +956,7 @@ curses_use_default_colors(VALUE obj)
#endif #endif
#if defined(HAVE_TABSIZE) #if defined(HAVE_TABSIZE)
/* /*
* Document-method: TABSIZE= * Document-method: TABSIZE=
* call-seq: TABSIZE=(value) * call-seq: TABSIZE=(value)
* *
@ -973,7 +973,7 @@ curses_tabsize_set(VALUE obj, VALUE val)
#endif #endif
#if defined(HAVE_TABSIZE) #if defined(HAVE_TABSIZE)
/* /*
* Returns the number of positions in a tab. * Returns the number of positions in a tab.
*/ */
static VALUE static VALUE
@ -986,7 +986,7 @@ curses_tabsize_get(VALUE ojb)
#endif #endif
#if defined(HAVE_ESCDELAY) #if defined(HAVE_ESCDELAY)
/* /*
* call-seq: ESCDELAY=(value) * call-seq: ESCDELAY=(value)
* *
* Sets the ESCDELAY to Integer +value+ * Sets the ESCDELAY to Integer +value+
@ -1002,7 +1002,7 @@ curses_escdelay_set(VALUE obj, VALUE val)
#endif #endif
#if defined(HAVE_ESCDELAY) #if defined(HAVE_ESCDELAY)
/* /*
* Returns the total time, in milliseconds, for which * Returns the total time, in milliseconds, for which
* curses will await a character sequence, e.g., a function key * curses will await a character sequence, e.g., a function key
*/ */
@ -1015,7 +1015,7 @@ curses_escdelay_get(VALUE obj)
#define curses_escdelay_get rb_f_notimplement #define curses_escdelay_get rb_f_notimplement
#endif #endif
/* /*
* Document-method: Curses.resize * Document-method: Curses.resize
* call-seq: resize(lines, cols) * call-seq: resize(lines, cols)
* *
@ -1023,7 +1023,7 @@ curses_escdelay_get(VALUE obj)
* *
*/ */
/* /*
* Document-method: Curses.resizeterm * Document-method: Curses.resizeterm
* call-seq: resizeterm(lines, cols) * call-seq: resizeterm(lines, cols)
* *
@ -1180,7 +1180,7 @@ curses_color_pairs(VALUE obj)
* Document-method: Curses.pair_content * Document-method: Curses.pair_content
* call-seq: pair_content(pair) * call-seq: pair_content(pair)
* *
* Returns a 2 item Array, with the foreground and * Returns a 2 item Array, with the foreground and
* background color, in +pair+ * background color, in +pair+
*/ */
static VALUE static VALUE
@ -1248,7 +1248,7 @@ curses_mousedata_free(struct mousedata *mdata)
xfree(mdata->mevent); xfree(mdata->mevent);
} }
/* /*
* Document-method: Curses.getmouse * Document-method: Curses.getmouse
* *
* Returns coordinates of the mouse. * Returns coordinates of the mouse.
@ -1395,7 +1395,7 @@ curses_timeout(VALUE obj, VALUE delay)
* *
* Save the current terminal modes as the "program" * Save the current terminal modes as the "program"
* state for use by the Curses.reset_prog_mode * state for use by the Curses.reset_prog_mode
* *
* This is done automatically by Curses.init_screen * This is done automatically by Curses.init_screen
*/ */
static VALUE static VALUE
@ -1414,7 +1414,7 @@ curses_def_prog_mode(VALUE obj)
* *
* Reset the current terminal modes to the saved state * Reset the current terminal modes to the saved state
* by the Curses.def_prog_mode * by the Curses.def_prog_mode
* *
* This is done automatically by Curses.close_screen * This is done automatically by Curses.close_screen
*/ */
static VALUE static VALUE
@ -1438,14 +1438,14 @@ window_s_allocate(VALUE class)
return Data_Make_Struct(class, struct windata, 0, free_window, winp); return Data_Make_Struct(class, struct windata, 0, free_window, winp);
} }
/* /*
* Document-method: Curses::Window.new * Document-method: Curses::Window.new
* call-seq: new(height, width, top, left) * call-seq: new(height, width, top, left)
* *
* Contruct a new Curses::Window with constraints of * Contruct a new Curses::Window with constraints of
* +height+ lines, +width+ columns, begin at +top+ line, and begin +left+ most column. * +height+ lines, +width+ columns, begin at +top+ line, and begin +left+ most column.
* *
* A new window using full screen is called as * A new window using full screen is called as
* Curses::Window.new(0,0,0,0) * Curses::Window.new(0,0,0,0)
* *
*/ */
@ -1466,11 +1466,11 @@ window_initialize(VALUE obj, VALUE h, VALUE w, VALUE top, VALUE left)
return obj; return obj;
} }
/* /*
* Document-method: Curses::Window.subwin * Document-method: Curses::Window.subwin
* call-seq: subwin(height, width, top, left) * call-seq: subwin(height, width, top, left)
* *
* Contruct a new subwindow with constraints of * Contruct a new subwindow with constraints of
* +height+ lines, +width+ columns, begin at +top+ line, and begin +left+ most column. * +height+ lines, +width+ columns, begin at +top+ line, and begin +left+ most column.
* *
*/ */
@ -1493,7 +1493,7 @@ window_subwin(VALUE obj, VALUE height, VALUE width, VALUE top, VALUE left)
return win; return win;
} }
/* /*
* Document-method: Curses::Window.close * Document-method: Curses::Window.close
* *
* Deletes the window, and frees the memory * Deletes the window, and frees the memory
@ -1510,7 +1510,7 @@ window_close(VALUE obj)
return Qnil; return Qnil;
} }
/* /*
* Document-method: Curses::Window.clear * Document-method: Curses::Window.clear
* *
* Clear the window. * Clear the window.
@ -1526,7 +1526,7 @@ window_clear(VALUE obj)
return Qnil; return Qnil;
} }
/* /*
* Document-method: Curses::Window.clrtoeol * Document-method: Curses::Window.clrtoeol
* *
* Clear the window to the end of line, that the cursor is currently on. * Clear the window to the end of line, that the cursor is currently on.
@ -1542,7 +1542,7 @@ window_clrtoeol(VALUE obj)
return Qnil; return Qnil;
} }
/* /*
* Document-method: Curses::Window.refresh * Document-method: Curses::Window.refresh
* *
* Refreshes the windows and lines. * Refreshes the windows and lines.
@ -1559,7 +1559,7 @@ window_refresh(VALUE obj)
return Qnil; return Qnil;
} }
/* /*
* Document-method: Curses::Window.noutrefresh * Document-method: Curses::Window.noutrefresh
* *
* Refreshes the windows and lines. * Refreshes the windows and lines.
@ -1582,7 +1582,7 @@ window_noutrefresh(VALUE obj)
return Qnil; return Qnil;
} }
/* /*
* Document-method: Curses::Window.move * Document-method: Curses::Window.move
* call-seq: move(y,x) * call-seq: move(y,x)
* *
@ -1599,7 +1599,7 @@ window_move(VALUE obj, VALUE y, VALUE x)
return Qnil; return Qnil;
} }
/* /*
* Document-method: Curses::Window.setpos * Document-method: Curses::Window.setpos
* call-seq: setpos(y, x) * call-seq: setpos(y, x)
* *
@ -1618,7 +1618,7 @@ window_setpos(VALUE obj, VALUE y, VALUE x)
return Qnil; return Qnil;
} }
/* /*
* Document-method: Curses::Window.cury * Document-method: Curses::Window.cury
* *
* A getter for the current line (Y coord) of the window * A getter for the current line (Y coord) of the window
@ -1634,7 +1634,7 @@ window_cury(VALUE obj)
return INT2FIX(y); return INT2FIX(y);
} }
/* /*
* Document-method: Curses::Window.curx * Document-method: Curses::Window.curx
* *
* A getter for the current column (X coord) of the window * A getter for the current column (X coord) of the window
@ -1650,7 +1650,7 @@ window_curx(VALUE obj)
return INT2FIX(x); return INT2FIX(x);
} }
/* /*
* Document-method: Curses::Window.maxy * Document-method: Curses::Window.maxy
* *
* A getter for the maximum lines for the window * A getter for the maximum lines for the window
@ -1674,7 +1674,7 @@ window_maxy(VALUE obj)
#endif #endif
} }
/* /*
* Document-method: Curses::Window.maxx * Document-method: Curses::Window.maxx
* *
* A getter for the maximum columns for the window * A getter for the maximum columns for the window
@ -1698,7 +1698,7 @@ window_maxx(VALUE obj)
#endif #endif
} }
/* /*
* Document-method: Curses::Window.begy * Document-method: Curses::Window.begy
* *
* A getter for the beginning line (Y coord) of the window * A getter for the beginning line (Y coord) of the window
@ -1718,7 +1718,7 @@ window_begy(VALUE obj)
#endif #endif
} }
/* /*
* Document-method: Curses::Window.begx * Document-method: Curses::Window.begx
* *
* A getter for the beginning column (X coord) of the window * A getter for the beginning column (X coord) of the window
@ -1738,7 +1738,7 @@ window_begx(VALUE obj)
#endif #endif
} }
/* /*
* Document-method: Curses::Window.box * Document-method: Curses::Window.box
* call-seq: box(vert, hor) * call-seq: box(vert, hor)
* *
@ -1782,7 +1782,7 @@ window_box(int argc, VALUE *argv, VALUE self)
return Qnil; return Qnil;
} }
/* /*
* Document-method: Curses::Window.standout * Document-method: Curses::Window.standout
* *
* Enables the best highlighting mode of the terminal. * Enables the best highlighting mode of the terminal.
@ -1801,7 +1801,7 @@ window_standout(VALUE obj)
return Qnil; return Qnil;
} }
/* /*
* Document-method: Curses::Window.standend * Document-method: Curses::Window.standend
* *
* Enables the Normal display (no highlight) * Enables the Normal display (no highlight)
@ -1820,7 +1820,7 @@ window_standend(VALUE obj)
return Qnil; return Qnil;
} }
/* /*
* Document-method: Curses::Window.inch * Document-method: Curses::Window.inch
* *
* Returns the character at the current position of the window. * Returns the character at the current position of the window.
@ -1834,12 +1834,12 @@ window_inch(VALUE obj)
return CH2FIX(winch(winp->window)); return CH2FIX(winch(winp->window));
} }
/* /*
* Document-method: Curses::Window.addch * Document-method: Curses::Window.addch
* call-seq: addch(ch) * call-seq: addch(ch)
* *
* Add a character +ch+, with attributes, to the window, then advance the cursor. * Add a character +ch+, with attributes, to the window, then advance the cursor.
* *
* see also the system manual for curs_addch(3) * see also the system manual for curs_addch(3)
*/ */
static VALUE static VALUE
@ -1853,12 +1853,12 @@ window_addch(VALUE obj, VALUE ch)
return Qnil; return Qnil;
} }
/* /*
* Document-method: Curses::Window.insch * Document-method: Curses::Window.insch
* call-seq: insch(ch) * call-seq: insch(ch)
* *
* Insert a character +ch+, before the cursor, in the current window * Insert a character +ch+, before the cursor, in the current window
* *
*/ */
static VALUE static VALUE
window_insch(VALUE obj, VALUE ch) window_insch(VALUE obj, VALUE ch)
@ -2086,7 +2086,7 @@ window_idlok(VALUE obj, VALUE bf)
return Qnil; return Qnil;
} }
/* /*
* Document-method: Curses::Window.setscrreg * Document-method: Curses::Window.setscrreg
* call-seq: setscrreg(top, bottom) * call-seq: setscrreg(top, bottom)
* *
@ -2119,7 +2119,7 @@ window_setscrreg(VALUE obj, VALUE top, VALUE bottom)
/* /*
* Document-method: Curses::Window.color_set * Document-method: Curses::Window.color_set
* call-seq: color_set(col) * call-seq: color_set(col)
* *
* Sets the current color of the given window to the * Sets the current color of the given window to the
* foreground/background combination described by the Fixnum +col+. * foreground/background combination described by the Fixnum +col+.
*/ */
@ -2135,7 +2135,7 @@ window_color_set(VALUE obj, VALUE col)
} }
#endif /* defined(USE_COLOR) && defined(HAVE_WCOLOR_SET) */ #endif /* defined(USE_COLOR) && defined(HAVE_WCOLOR_SET) */
/* /*
* Document-method: Curses::Window.scroll * Document-method: Curses::Window.scroll
* *
* Scrolls the current window up one line. * Scrolls the current window up one line.
@ -2150,7 +2150,7 @@ window_scroll(VALUE obj)
return (scroll(winp->window) == OK) ? Qtrue : Qfalse; return (scroll(winp->window) == OK) ? Qtrue : Qfalse;
} }
/* /*
* Document-method: Curses::Window.scrl * Document-method: Curses::Window.scrl
* call-seq: scrl(num) * call-seq: scrl(num)
* *
@ -2176,7 +2176,7 @@ window_scrl(VALUE obj, VALUE n)
#endif #endif
} }
/* /*
* Document-method: Curses::Window.attroff * Document-method: Curses::Window.attroff
* call-seq: attroff(attrs) * call-seq: attroff(attrs)
* *
@ -2197,7 +2197,7 @@ window_attroff(VALUE obj, VALUE attrs)
#endif #endif
} }
/* /*
* Document-method: Curses::Window.attron * Document-method: Curses::Window.attron
* call-seq: attron(attrs) * call-seq: attron(attrs)
* *
@ -2228,7 +2228,7 @@ window_attron(VALUE obj, VALUE attrs)
#endif #endif
} }
/* /*
* Document-method: Curses::Window.attrset * Document-method: Curses::Window.attrset
* call-seq: attrset(attrs) * call-seq: attrset(attrs)
* *
@ -2329,7 +2329,7 @@ window_getbkgd(VALUE obj)
#endif #endif
} }
/* /*
* Document-method: Curses::Window.resize * Document-method: Curses::Window.resize
* call-seq: resize(lines, cols) * call-seq: resize(lines, cols)
* *
@ -2354,15 +2354,15 @@ window_resize(VALUE obj, VALUE lin, VALUE col)
/* /*
* Document-method: Curses::Window.keypad= * Document-method: Curses::Window.keypad=
* call-seq: keypad=(bool) * call-seq: keypad=(bool)
* *
* see Curses::Window.keypad * see Curses::Window.keypad
*/ */
/* /*
* Document-method: Curses::Window.keypad * Document-method: Curses::Window.keypad
* call-seq: keypad(bool) * call-seq: keypad(bool)
* *
* Enables the keypad of the user's terminal. * Enables the keypad of the user's terminal.
* If enabled (+bool+ is +true+), the user can press a function key * If enabled (+bool+ is +true+), the user can press a function key
* (such as an arrow key) and wgetch returns a single value representing * (such as an arrow key) and wgetch returns a single value representing
* the function key, as in KEY_LEFT. If disabled (+bool+ is +false+), * the function key, as in KEY_LEFT. If disabled (+bool+ is +false+),
@ -2449,7 +2449,7 @@ window_timeout(VALUE obj, VALUE delay)
/*------------------------- Initialization -------------------------*/ /*------------------------- Initialization -------------------------*/
/* /*
* Document-module: Curses * Document-module: Curses
* *
* == Description * == Description
@ -2483,7 +2483,7 @@ window_timeout(VALUE obj, VALUE delay)
* *
* *
* == Examples * == Examples
* *
* * hello.rb * * hello.rb
* :include: hello.rb * :include: hello.rb
* *
@ -2517,7 +2517,7 @@ Init_curses(void)
rb_gc_register_address(&rb_stdscr); rb_gc_register_address(&rb_stdscr);
#ifdef USE_MOUSE #ifdef USE_MOUSE
/* /*
* Document-class: Curses::MouseEvent * Document-class: Curses::MouseEvent
* *
* == Description * == Description
@ -2618,11 +2618,11 @@ Init_curses(void)
/* /*
* Document-class: Curses::Window * Document-class: Curses::Window
* *
* == Description * == Description
* *
* The means by which to create and manage frames or windows. * The means by which to create and manage frames or windows.
* While there may be more than one window at a time, only one window * While there may be more than one window at a time, only one window
* receive the input. * receive the input.
* *
* == Usage * == Usage
@ -2738,56 +2738,56 @@ Init_curses(void)
rb_curses_define_const(A_COLOR); rb_curses_define_const(A_COLOR);
#ifdef COLORS #ifdef COLORS
/* /*
* Document-const: Curses::COLORS * Document-const: Curses::COLORS
* *
* Integer of the colors available * Integer of the colors available
*/ */
rb_curses_define_const(COLORS); rb_curses_define_const(COLORS);
#endif #endif
/* /*
* Document-const: Curses::COLOR_BLACK * Document-const: Curses::COLOR_BLACK
* *
* Integer of the color black * Integer of the color black
*/ */
rb_curses_define_const(COLOR_BLACK); rb_curses_define_const(COLOR_BLACK);
/* /*
* Document-const: COLOR_RED * Document-const: COLOR_RED
* *
* Integer of the color red * Integer of the color red
*/ */
rb_curses_define_const(COLOR_RED); rb_curses_define_const(COLOR_RED);
/* /*
* Document-const: COLOR_GREEN * Document-const: COLOR_GREEN
* *
* Integer of the color green * Integer of the color green
*/ */
rb_curses_define_const(COLOR_GREEN); rb_curses_define_const(COLOR_GREEN);
/* /*
* Document-const: COLOR_YELLOW * Document-const: COLOR_YELLOW
* *
* Integer of the color yellow * Integer of the color yellow
*/ */
rb_curses_define_const(COLOR_YELLOW); rb_curses_define_const(COLOR_YELLOW);
/* /*
* Document-const: COLOR_BLUE * Document-const: COLOR_BLUE
* *
* Integer of the color blue * Integer of the color blue
*/ */
rb_curses_define_const(COLOR_BLUE); rb_curses_define_const(COLOR_BLUE);
/* /*
* Document-const: COLOR_MAGENTA * Document-const: COLOR_MAGENTA
* *
* Integer of the color magenta * Integer of the color magenta
*/ */
rb_curses_define_const(COLOR_MAGENTA); rb_curses_define_const(COLOR_MAGENTA);
/* /*
* Document-const: COLOR_CYAN * Document-const: COLOR_CYAN
* *
* Integer of the color cyan * Integer of the color cyan
*/ */
rb_curses_define_const(COLOR_CYAN); rb_curses_define_const(COLOR_CYAN);
/* /*
* Document-const: COLOR_WHITE * Document-const: COLOR_WHITE
* *
* Integer of the color white * Integer of the color white

Просмотреть файл

@ -1 +1 @@
etc.o : etc.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h etc.o : etc.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h

Просмотреть файл

@ -122,8 +122,8 @@ char MasterDevice[] = "/dev/pty%s",
static VALUE eChildExited; static VALUE eChildExited;
/* Returns the exit status of the child for which PTY#check /* Returns the exit status of the child for which PTY#check
* raised this exception * raised this exception
*/ */
static VALUE static VALUE
echild_status(VALUE self) echild_status(VALUE self)

Просмотреть файл

@ -37,28 +37,28 @@ readline([prompt, [add_hist]]) -> String | nil
エンターキーの押下などでユーザが文字列を入力し終えると、 エンターキーの押下などでユーザが文字列を入力し終えると、
入力した文字列を返します。 入力した文字列を返します。
このとき、add_hist が true であれば、入力した文字列をヒストリに追加します。 このとき、add_hist が true であれば、入力した文字列をヒストリに追加します。
何も入力していない状態で EOF(UNIX では ^D) を入力するなどで、 何も入力していない状態で EOF(UNIX では ^D) を入力するなどで、
ユーザからの入力がない場合は nil を返します。 ユーザからの入力がない場合は nil を返します。
次の条件を全て満たす場合、例外 IOError が発生します。 次の条件を全て満たす場合、例外 IOError が発生します。
1. 標準入力が tty でない。 1. 標準入力が tty でない。
2. 標準入力をクローズしている。(isatty(2) の errno が EBADF である。) 2. 標準入力をクローズしている。(isatty(2) の errno が EBADF である。)
本メソッドはスレッドに対応しています。 本メソッドはスレッドに対応しています。
入力待ち状態のときはスレッドコンテキストの切替えが発生します。 入力待ち状態のときはスレッドコンテキストの切替えが発生します。
入力時には行内編集が可能で、vi モードと Emacs モードが用意されています。 入力時には行内編集が可能で、vi モードと Emacs モードが用意されています。
デフォルトは Emacs モードです。 デフォルトは Emacs モードです。
本メソッドには注意事項があります。 本メソッドには注意事項があります。
入力待ちの状態で ^C すると ruby インタプリタが終了し、端末状態を復帰しません。 入力待ちの状態で ^C すると ruby インタプリタが終了し、端末状態を復帰しません。
これを回避するための例を3つ挙げます。 これを回避するための例を3つ挙げます。
* ^CによるInterrupt例外を補足して、端末状態を復帰します: * ^CによるInterrupt例外を補足して、端末状態を復帰します:
require "readline" require "readline"
stty_save = `stty -g`.chomp stty_save = `stty -g`.chomp
begin begin
while buf = Readline.readline while buf = Readline.readline
@ -70,48 +70,48 @@ readline([prompt, [add_hist]]) -> String | nil
end end
end end
end end
* INTシグナルを補足して、端末状態を復帰します: * INTシグナルを補足して、端末状態を復帰します:
require "readline" require "readline"
stty_save = `stty -g`.chomp stty_save = `stty -g`.chomp
trap("INT") { system "stty", stty_save; exit } trap("INT") { system "stty", stty_save; exit }
while buf = Readline.readline while buf = Readline.readline
p buf p buf
end end
* 単に ^C を無視する方法もあります: * 単に ^C を無視する方法もあります:
require "readline" require "readline"
trap("INT", "SIG_IGN") trap("INT", "SIG_IGN")
while buf = Readline.readline while buf = Readline.readline
p buf p buf
end end
入力履歴 Readline::HISTORY を使用して、空行や直前の入力と同じ内容は入力 入力履歴 Readline::HISTORY を使用して、空行や直前の入力と同じ内容は入力
履歴に残さないということもできます。 履歴に残さないということもできます。
require "readline" require "readline"
while buf = Readline.readline("> ", true) while buf = Readline.readline("> ", true)
# p Readline::HISTORY.to_a # p Readline::HISTORY.to_a
Readline::HISTORY.pop if /^\s*$/ =~ buf Readline::HISTORY.pop if /^\s*$/ =~ buf
begin begin
if Readline::HISTORY[Readline::HISTORY.length-2] == buf if Readline::HISTORY[Readline::HISTORY.length-2] == buf
Readline::HISTORY.pop Readline::HISTORY.pop
end end
rescue IndexError rescue IndexError
end end
# p Readline::HISTORY.to_a # p Readline::HISTORY.to_a
print "-> ", buf, "\n" print "-> ", buf, "\n"
end end
$SAFE が 4 の場合、例外 SecurityError が発生します。 $SAFE が 4 の場合、例外 SecurityError が発生します。
=== クラスメソッド === クラスメソッド
@ -171,7 +171,7 @@ Readline.completion_case_fold -> bool
そのまま取得するので、次のような動作をします。 そのまま取得するので、次のような動作をします。
require "readline" require "readline"
Readline.completion_case_fold = "This is a String." Readline.completion_case_fold = "This is a String."
p Readline.completion_case_fold # => "This is a String." p Readline.completion_case_fold # => "This is a String."
@ -238,7 +238,7 @@ Readline.completion_append_character = char
使用例: 使用例:
require "readline" require "readline"
Readline.readline("> ", true) Readline.readline("> ", true)
Readline.completion_append_character = " " Readline.completion_append_character = " "
@ -246,13 +246,13 @@ Readline.completion_append_character = char
> >
ここで "/var/li" を入力します。 ここで "/var/li" を入力します。
> /var/li > /var/li
ここで TAB キーを入力します。 ここで TAB キーを入力します。
> /var/lib > /var/lib
"b" が補完され、最後に " " が追加されるので、"/usr" を連続して入力できます。 "b" が補完され、最後に " " が追加されるので、"/usr" を連続して入力できます。
> /var/lib /usr > /var/lib /usr
なお、1文字しか指定することはできません。 なお、1文字しか指定することはできません。
@ -304,7 +304,7 @@ Readline.completer_word_break_characters = string
Readline.basic_word_break_characters= との違いは、 Readline.basic_word_break_characters= との違いは、
GNU Readline の rl_complete_internal 関数で使用されることです。 GNU Readline の rl_complete_internal 関数で使用されることです。
GNU Readline のデフォルトの値は、 GNU Readline のデフォルトの値は、
Readline.basic_word_break_characters と同じです。 Readline.basic_word_break_characters と同じです。
サポートしていない環境では、例外 NotImplementedError が発生します。 サポートしていない環境では、例外 NotImplementedError が発生します。
@ -388,7 +388,7 @@ HISTORY
例えば、HISTORY[4] により 5 番目に入力した内容を取り出すことができます。 例えば、HISTORY[4] により 5 番目に入力した内容を取り出すことができます。
require "readline" require "readline"
Readline::HISTORY.push("a", "b", "c", "d", "e") Readline::HISTORY.push("a", "b", "c", "d", "e")
p Readline::HISTORY[4] # => "e" p Readline::HISTORY[4] # => "e"
@ -421,7 +421,7 @@ HISTORY
FILENAME_COMPLETION_PROC FILENAME_COMPLETION_PROC
ファイル名の補完を行う call メソッドを持つオブジェクトです。 ファイル名の補完を行う call メソッドを持つオブジェクトです。
Readline.completion_proc= により、ユーザの入力時にファイル名の補完を Readline.completion_proc= により、ユーザの入力時にファイル名の補完を
行うように設定するために使用することを想定してます。 行うように設定するために使用することを想定してます。

Просмотреть файл

@ -8,7 +8,7 @@ Ripper README
Ripper is still early-alpha version. Ripper is still early-alpha version.
I never assure any kind of backward compatibility. I never assure any kind of backward compatibility.
Requirements Requirements
------------ ------------

Просмотреть файл

@ -13,6 +13,6 @@ This library is based on MoonWolf version written in Ruby. Thanks a lot.
* not implemented: (({fcntl})), (({reopen})). * not implemented: (({fcntl})), (({reopen})).
* (({fileno})) returns nil. * (({fileno})) returns nil.
* (({pos=})) returns new position, not 0. * (({pos=})) returns new position, not 0.
* (({ungetc})) does nothing at start of the string. * (({ungetc})) does nothing at start of the string.
=end =end

Просмотреть файл

@ -1,3 +1,3 @@
stringio.o: stringio.c $(hdrdir)/ruby/ruby.h $(arch_hdrdir)/ruby/config.h \ stringio.o: stringio.c $(hdrdir)/ruby/ruby.h $(arch_hdrdir)/ruby/config.h \
$(hdrdir)/ruby/defines.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/io.h \ $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/io.h \
$(hdrdir)/ruby/encoding.h $(hdrdir)/ruby/encoding.h

Просмотреть файл

@ -75,7 +75,7 @@ Module Methods:
Example: Example:
Syslog.crit("the sky is falling in %d seconds!", 5) Syslog.crit("the sky is falling in %d seconds!", 5)
mask mask
mask=(mask) mask=(mask)
@ -86,7 +86,7 @@ Module Methods:
Example: Example:
Syslog.mask = Syslog::LOG_UPTO(Syslog::LOG_ERR) Syslog.mask = Syslog::LOG_UPTO(Syslog::LOG_ERR)
close close
Closes syslog. Closes syslog.

Просмотреть файл

@ -14,13 +14,13 @@
Tue Nov 25 03:37:42 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> Tue Nov 25 03:37:42 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tkextlib/blt/tabset.rb, * ext/tk/lib/tkextlib/blt/tabset.rb,
ext/tk/lib/tkextlib/blt/tabnotebook.rb: ext/tk/lib/tkextlib/blt/tabnotebook.rb:
fix many bugs. Now, those work properly. fix many bugs. Now, those work properly.
Sat Nov 22 10:31:25 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> Sat Nov 22 10:31:25 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tkextlib/blt.rb, ext/tk/lib/tkextlib/blt/vector.rb: * ext/tk/lib/tkextlib/blt.rb, ext/tk/lib/tkextlib/blt/vector.rb:
fix NameError bug. fix NameError bug.
2008-05-12 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> 2008-05-12 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
@ -39,12 +39,12 @@ Sat Nov 22 10:31:25 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
2007-01-26 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> 2007-01-26 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tkextlib/iwidgets/checkbox.rb: wrong number of arguments * ext/tk/lib/tkextlib/iwidgets/checkbox.rb: wrong number of arguments
[ruby-Bugs-7776]. [ruby-Bugs-7776].
* ext/tk/lib/tkextlib/iwidgets/radiobox.rb: ditto. * ext/tk/lib/tkextlib/iwidgets/radiobox.rb: ditto.
* ext/tk/lib/tkextlib/blt/tile/checkbutton.rb: change primary name * ext/tk/lib/tkextlib/blt/tile/checkbutton.rb: change primary name
of class [ruby-dev:30080]. of class [ruby-dev:30080].
* ext/tk/lib/tkextlib/blt/tile/radiobutton.rb: ditto. * ext/tk/lib/tkextlib/blt/tile/radiobutton.rb: ditto.
@ -53,16 +53,16 @@ Sat Nov 22 10:31:25 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* lib/tkextlib/tile/treeview.rb : minor bug fix. * lib/tkextlib/tile/treeview.rb : minor bug fix.
* lib/tkextlib/blt/table.rb: fix bugs which forbade use of * lib/tkextlib/blt/table.rb: fix bugs which forbade use of
'::blt::table' command. Now, probably, it'll works properly. '::blt::table' command. Now, probably, it'll works properly.
2006-11-06 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> 2006-11-06 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* lib/tkextlib/version.rb: keep release date of tkextlib on * lib/tkextlib/version.rb: keep release date of tkextlib on
"Tk::Tkextlib_RELEASE_DATE". "Tk::Tkextlib_RELEASE_DATE".
* lib/tkextlib/tile/treeview.rb : support Tile 0.7.8. * lib/tkextlib/tile/treeview.rb : support Tile 0.7.8.
Now, you can handle tree items as objects. Now, you can handle tree items as objects.
2006-10-04 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> 2006-10-04 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
@ -112,7 +112,7 @@ Sat Nov 22 10:31:25 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
2005-11-19 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> 2005-11-19 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* sample/tkextlib/treectrl/demo.rb: remove dependency on Ruby's * sample/tkextlib/treectrl/demo.rb: remove dependency on Ruby's
version (1.8 or 1.9). version (1.8 or 1.9).
2005-10-23 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> 2005-10-23 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
@ -375,7 +375,7 @@ Sat Nov 22 10:31:25 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* lib/tkextlib/iwidgets/scrolledtext.rb: ditto. * lib/tkextlib/iwidgets/scrolledtext.rb: ditto.
* lib/tkextlib/iwidgets/scrolledcanvas.rb: bug fix on * lib/tkextlib/iwidgets/scrolledcanvas.rb: bug fix on
TkCanvas#delete when given non-TkcItem arguments. TkCanvas#delete when given non-TkcItem arguments.
2005-05-10 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> 2005-05-10 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
@ -576,7 +576,7 @@ Sat Nov 22 10:31:25 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* lib/tkextlib/blt/component.rb: bug fix on treatment of * lib/tkextlib/blt/component.rb: bug fix on treatment of
component objects. component objects.
* sample/tkextlib/blt/graph6.rb: a new sample script. * sample/tkextlib/blt/graph6.rb: a new sample script.
2005-03-31 ocean <ocean@ruby-lang.org> 2005-03-31 ocean <ocean@ruby-lang.org>
@ -592,7 +592,7 @@ Sat Nov 22 10:31:25 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* sample/tkextlib/iwidgets/sample/hierarchy.rb: show basename * sample/tkextlib/iwidgets/sample/hierarchy.rb: show basename
only [ruby-dev:25970] only [ruby-dev:25970]
* sample/tkextlib/treectrl/demo.rb: add check for existence of * sample/tkextlib/treectrl/demo.rb: add check for existence of
'backgroundimage' option. 'backgroundimage' option.
* sample/tkextlib/treectrl/bitmaps.rb: ditto. * sample/tkextlib/treectrl/bitmaps.rb: ditto.
@ -626,7 +626,7 @@ Sat Nov 22 10:31:25 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
2005-03-29 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> 2005-03-29 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* lib/tkextlib/blt/component.rb: cannot create elements except * lib/tkextlib/blt/component.rb: cannot create elements except
default type of element. default type of element.
* lib/tkextlib/blt/barchart.rb: ditto. * lib/tkextlib/blt/barchart.rb: ditto.
@ -661,7 +661,7 @@ Sat Nov 22 10:31:25 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* lib/tkextlib/blt/component.rb: proper call on xaxis_* and so on. * lib/tkextlib/blt/component.rb: proper call on xaxis_* and so on.
* lib/tkextlib/blt/htext.rb: add TkVariable object to access * lib/tkextlib/blt/htext.rb: add TkVariable object to access
special Tcl variables. special Tcl variables.
* lib/tkextlib/treectrl/tktreectrl.rb: typo fix. * lib/tkextlib/treectrl/tktreectrl.rb: typo fix.
@ -923,8 +923,8 @@ Sat Nov 22 10:31:25 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* use Tk::ValidateConfigure.__def_validcmd() method * use Tk::ValidateConfigure.__def_validcmd() method
(new function to define validatecommand methods easier) (new function to define validatecommand methods easier)
* tcllib.rb : avoid the loading trouble that almost all part of * tcllib.rb : avoid the loading trouble that almost all part of
the extension is not available when some libraries are invalid. the extension is not available when some libraries are invalid.
2004-07-09 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> 2004-07-09 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
@ -942,7 +942,7 @@ Sat Nov 22 10:31:25 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* add ICONS extension demo * add ICONS extension demo
* many bug fix * many bug fix
2004-07-01 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> 2004-07-01 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>

Просмотреть файл

@ -3,16 +3,16 @@
This document discribes about the 'tcltklib' library. Although there This document discribes about the 'tcltklib' library. Although there
is the 'tcltk' library (tcltk.rb) under this directory, no description is the 'tcltk' library (tcltk.rb) under this directory, no description
in this document (because it is not maintained recently). in this document (because it is not maintained recently).
============================================================== ==============================================================
module TclTklib module TclTklib
: Defines methods to do operations which are independed on : Defines methods to do operations which are independed on
: Tcl/Tk interpreters : Tcl/Tk interpreters
module TclTkLib::EventFlag module TclTkLib::EventFlag
: Defines flags to define taget events on 'do_one_event' methos. : Defines flags to define taget events on 'do_one_event' methos.
: When to give, please use bit-operator (e.g. WINDOW | DONT_WAIT). : When to give, please use bit-operator (e.g. WINDOW | DONT_WAIT).
[constants] [constants]
NONE NONE
@ -30,29 +30,29 @@ module TclTklib
IDLE IDLE
: 'idle' operation (e.g. 're-draw'; the operations when the : 'idle' operation (e.g. 're-draw'; the operations when the
: other kinds of events doesn't occur) is processed. : other kinds of events doesn't occur) is processed.
ALL ALL
: All kinds of events are processed. : All kinds of events are processed.
: Same to 'WINDOW | FILE | TIMER | IDLE'. : Same to 'WINDOW | FILE | TIMER | IDLE'.
DONT_WAIT DONT_WAIT
: Without this flag, 'do_one_event' waits the occurence of : Without this flag, 'do_one_event' waits the occurence of
: a target event. With this flag, doesn't wait and returns : a target event. With this flag, doesn't wait and returns
: false if there is no target event for processing. : false if there is no target event for processing.
module TclTkLib::VarAccessFlag module TclTkLib::VarAccessFlag
: Defines flags to give '_get_variable' and so on. When to give, : Defines flags to give '_get_variable' and so on. When to give,
: please use bit-operator (e.g. GLOBAL_ONLY | LEAVE_ERR_MSG ). : please use bit-operator (e.g. GLOBAL_ONLY | LEAVE_ERR_MSG ).
[constants] [constants]
NONE NONE
: Is 0. It means "set no flag". : Is 0. It means "set no flag".
GLOBAL_ONLY GLOBAL_ONLY
: (site Tcl/Tk's man page) : (site Tcl/Tk's man page)
: Under normal circumstances the procedures look up : Under normal circumstances the procedures look up
: variables as follows: If a procedure call is active : variables as follows: If a procedure call is active
: in interp, a variable is looked up at the current : in interp, a variable is looked up at the current
: level of procedure call. Otherwise, a variable is : level of procedure call. Otherwise, a variable is
: looked up first in the current namespace, then in : looked up first in the current namespace, then in
@ -63,9 +63,9 @@ module TclTklib
: given, GLOBAL_ONLY is ignored. : given, GLOBAL_ONLY is ignored.
: :
: *** ATTENTION *** : *** ATTENTION ***
: Tcl7.6 doesn't have namespaces. So NAMESPACE_ONLY : Tcl7.6 doesn't have namespaces. So NAMESPACE_ONLY
: is defined as 0, and then GLOBAL_ONLY is available : is defined as 0, and then GLOBAL_ONLY is available
: even if flag is (GLOBAL_ONLY | NAMESPACE_ONLY). : even if flag is (GLOBAL_ONLY | NAMESPACE_ONLY).
NAMESPACE_ONLY NAMESPACE_ONLY
: (site Tcl/Tk's man page) : (site Tcl/Tk's man page)
@ -80,16 +80,16 @@ module TclTklib
: active. : active.
: :
: *** ATTENTION *** : *** ATTENTION ***
: Tcl7.6 doesn't have namespaces. So NAMESPACE_ONLY : Tcl7.6 doesn't have namespaces. So NAMESPACE_ONLY
: is defined as 0. : is defined as 0.
LEAVE_ERR_MSG LEAVE_ERR_MSG
: (site Tcl/Tk's man page) : (site Tcl/Tk's man page)
: If an error is returned and this bit is set in flags, : If an error is returned and this bit is set in flags,
: then an error message will be left in the interpreter's : then an error message will be left in the interpreter's
: result, where it can be retrieved with Tcl_GetObjResult : result, where it can be retrieved with Tcl_GetObjResult
: or Tcl_GetStringResult. If this flag bit isn't set then : or Tcl_GetStringResult. If this flag bit isn't set then
: no error message is left and the interpreter's result : no error message is left and the interpreter's result
: will not be modified. : will not be modified.
APPEND_VALUE APPEND_VALUE
@ -104,26 +104,26 @@ module TclTklib
: valid Tcl list element before setting (or appending : valid Tcl list element before setting (or appending
: to) the variable. A separator space is appended before : to) the variable. A separator space is appended before
: the new list element unless the list element is going : the new list element unless the list element is going
: to be the first element in a list or sublist (i.e. the : to be the first element in a list or sublist (i.e. the
: variable's current value is empty, or contains the : variable's current value is empty, or contains the
: single character ``{'', or ends in `` }''). : single character ``{'', or ends in `` }'').
PARSE_VARNAME PARSE_VARNAME
: (site Tcl/Tk's man page) : (site Tcl/Tk's man page)
: If this bit is set when calling _set_variable and so : If this bit is set when calling _set_variable and so
: on, var_name argument may contain both an array and an : on, var_name argument may contain both an array and an
: element name: if the name contains an open parenthesis : element name: if the name contains an open parenthesis
: and ends with a close parenthesis, then the value : and ends with a close parenthesis, then the value
: between the parentheses is treated as an element name : between the parentheses is treated as an element name
: (which can have any string value) and the characters : (which can have any string value) and the characters
: before the first open parenthesis are treated as the : before the first open parenthesis are treated as the
: name of an array variable. If the flag PARSE_VARNAME : name of an array variable. If the flag PARSE_VARNAME
: is given, index_name argument should be 'nil' since the : is given, index_name argument should be 'nil' since the
: array and element names are taken from var_name. : array and element names are taken from var_name.
: :
: *** ATTENTION *** : *** ATTENTION ***
: Tcl7.6 doesn't have this flag. So PARSE_VARNAME is : Tcl7.6 doesn't have this flag. So PARSE_VARNAME is
: defined as 0. : defined as 0.
module TclTkLib::RELEASE_TYPE module TclTkLib::RELEASE_TYPE
: Defines release type number of Tcl/Tk : Defines release type number of Tcl/Tk
@ -139,105 +139,105 @@ module TclTklib
[module methods] [module methods]
get_version() get_version()
: return an array of major, minor, release-type number, : return an array of major, minor, release-type number,
: and patchlevel of current Tcl/Tk library. : and patchlevel of current Tcl/Tk library.
mainloop(check_root = true) mainloop(check_root = true)
: Starts the eventloop. If 'check_root' is true, this method : Starts the eventloop. If 'check_root' is true, this method
: doesn't return when a root widget exists. : doesn't return when a root widget exists.
: If 'check_root' is false, doen't return by the other : If 'check_root' is false, doen't return by the other
: reasons than exceptions. : reasons than exceptions.
mainloop_thread? mainloop_thread?
: Returns whether the current thread executes the eventloop. : Returns whether the current thread executes the eventloop.
: If true, the eventloop is working on the current thread. : If true, the eventloop is working on the current thread.
: If no eventloop is working, this method returns nil. : If no eventloop is working, this method returns nil.
: And if the other thread executes the eventloop, returns false. : And if the other thread executes the eventloop, returns false.
: :
: *** ATTENTION *** : *** ATTENTION ***
: When this methods returns false, it is dangerous to call a Tk : When this methods returns false, it is dangerous to call a Tk
: interpreter directly. : interpreter directly.
mainloop_watchdog(check_root = true) mainloop_watchdog(check_root = true)
: On the normal eventloop, some kinds of callback operations : On the normal eventloop, some kinds of callback operations
: cause deadlock. To avoid some of such deadlocks, this : cause deadlock. To avoid some of such deadlocks, this
: method starts an eventloop and a watchdog-thread. : method starts an eventloop and a watchdog-thread.
do_one_event(flag = TclTkLib::EventFlag::ALL | do_one_event(flag = TclTkLib::EventFlag::ALL |
TclTkLib::EventFlag::DONT_WAIT) TclTkLib::EventFlag::DONT_WAIT)
: Do one event for processing. When processed an event, : Do one event for processing. When processed an event,
: returns true. : returns true.
: If NOT set DONT_WAIT flag, this method waits occurrence of : If NOT set DONT_WAIT flag, this method waits occurrence of
: a target event. : a target event.
: If set DONT_WAIT flag and no event for processing, returns : If set DONT_WAIT flag and no event for processing, returns
: false immediately. : false immediately.
: If $SAFE >= 4, or $SAFE >= 1 and the flag is tainted, : If $SAFE >= 4, or $SAFE >= 1 and the flag is tainted,
: force to set DONT_WAIT flag. : force to set DONT_WAIT flag.
set_eventloop_tick(timer_tick) set_eventloop_tick(timer_tick)
: Define the interval of thread-switching with an integer : Define the interval of thread-switching with an integer
: value of mili-seconds. : value of mili-seconds.
: Default timer_tick is 0. It means that thread-switching : Default timer_tick is 0. It means that thread-switching
: is based on the count of processed events. : is based on the count of processed events.
: ( see 'set_eventloop_weight' method ) : ( see 'set_eventloop_weight' method )
: However, if the eventloop thread is the only thread, : However, if the eventloop thread is the only thread,
: timer_tick cannt be set to 0. If 0, then is set to 100 ms : timer_tick cannt be set to 0. If 0, then is set to 100 ms
: automatically (see NO_THREAD_INTERRUPT_TIME on tcltklib.c). : automatically (see NO_THREAD_INTERRUPT_TIME on tcltklib.c).
: On $SAFE >= 4, cannot call this method. : On $SAFE >= 4, cannot call this method.
get_eventloop_tick get_eventloop_tick
: Get current value of 'timer_tick' : Get current value of 'timer_tick'
set_no_event_wait(no_event_wait) set_no_event_wait(no_event_wait)
: Define sleeping time of the eventloop when two or more : Define sleeping time of the eventloop when two or more
: thread are running and there is no event for processing. : thread are running and there is no event for processing.
: Default value is 20 (ms). : Default value is 20 (ms).
: If the eventloop thread is the only thread, this value is : If the eventloop thread is the only thread, this value is
: invalid. : invalid.
: On $SAFE >= 4, cannot call this method. : On $SAFE >= 4, cannot call this method.
get_no_event_wait get_no_event_wait
: Get current value of 'no_event_wait'. : Get current value of 'no_event_wait'.
set_eventloop_weight(loop_max, no_event_tick) set_eventloop_weight(loop_max, no_event_tick)
: Define the weight parameters for the eventloop thread. : Define the weight parameters for the eventloop thread.
: That is invalid when the eventloop is the only thread. : That is invalid when the eventloop is the only thread.
: 'loop_max' is the max events for thread-switching. : 'loop_max' is the max events for thread-switching.
: 'no_event_tick' is the increment value of the event count : 'no_event_tick' is the increment value of the event count
: when no event for processing (And then, the eventloop thead : when no event for processing (And then, the eventloop thead
: sleeps 'no_event_wait' mili-seconds). : sleeps 'no_event_wait' mili-seconds).
: 'loop_max == 800' and 'no_event_tick == 10' are defalut. : 'loop_max == 800' and 'no_event_tick == 10' are defalut.
: On $SAFE >= 4, cannot call this method. : On $SAFE >= 4, cannot call this method.
get_eventloop_weight get_eventloop_weight
: Get current values of 'loop_max' and 'no_event_tick'. : Get current values of 'loop_max' and 'no_event_tick'.
mainloop_abort_on_exception=(bool) mainloop_abort_on_exception=(bool)
: Define whether the eventloop stops on exception or not. : Define whether the eventloop stops on exception or not.
: If true (default value), stops on exception. : If true (default value), stops on exception.
: If false, show a warinig message but ignore the exception. : If false, show a warinig message but ignore the exception.
: If nil, no warning message and ignore the excepsion. : If nil, no warning message and ignore the excepsion.
: This parameter is sometimes useful when multiple Tk : This parameter is sometimes useful when multiple Tk
: interpreters are working. Because the only one eventloop : interpreters are working. Because the only one eventloop
: admins all Tk interpreters, sometimes exception on a : admins all Tk interpreters, sometimes exception on a
: interpreter kills the eventloop thread. Even if such : interpreter kills the eventloop thread. Even if such
: situation, when abort_on_exception == false or nil, : situation, when abort_on_exception == false or nil,
: the eventloop ignores the exception and continue to working. : the eventloop ignores the exception and continue to working.
: On $SAFE >= 4, cannot call this method. : On $SAFE >= 4, cannot call this method.
mainloop_abort_on_exception mainloop_abort_on_exception
: Get current status of that. : Get current status of that.
num_of_mainwindows num_of_mainwindows
: Returns the number of main-windows (root-widget). : Returns the number of main-windows (root-widget).
: Because there is only one main-window for one Tk interpreter, : Because there is only one main-window for one Tk interpreter,
: the value is same to the number of interpreters which has : the value is same to the number of interpreters which has
: available Tk functions. : available Tk functions.
_merge_tklist(str, str, ... ) _merge_tklist(str, str, ... )
: Get a Tcl's list string from arguments with a Tcl/Tk's : Get a Tcl's list string from arguments with a Tcl/Tk's
: library function. Each arguemnt is converted to a valid : library function. Each arguemnt is converted to a valid
: Tcl list element. : Tcl list element.
_conv_listelement(str) _conv_listelement(str)
: Convert the argument to a valid Tcl list element with : Convert the argument to a valid Tcl list element with
@ -252,7 +252,7 @@ module TclTklib
_subst_Tcl_backslash(str) _subst_Tcl_backslash(str)
: Substitute backslash sequence with Tcl's rule (include \uhhhh; : Substitute backslash sequence with Tcl's rule (include \uhhhh;
: give a sixteen-bit hexadecimal value for Unicode character). : give a sixteen-bit hexadecimal value for Unicode character).
: _subst_Tcl_backslash method parses all backslash sequence. : _subst_Tcl_backslash method parses all backslash sequence.
: _subst_UTF_backslash method parses \uhhhh only. : _subst_UTF_backslash method parses \uhhhh only.
encoding_system encoding_system
@ -268,90 +268,90 @@ module TclTklib
class TclTkIp class TclTkIp
[class methods] [class methods]
new(ip_name=nil, options='') new(ip_name=nil, options='')
: Generate an instance of TclTkIp class. : Generate an instance of TclTkIp class.
: If 'ip_name' argument is given as a string, it is the name : If 'ip_name' argument is given as a string, it is the name
: of the Tk interpreter which is shown by 'winfo interps' : of the Tk interpreter which is shown by 'winfo interps'
: command. : command.
: 'options' argument accepts a string which is the command : 'options' argument accepts a string which is the command
: line options of wish; such as '-geometry' or '-use'. : line options of wish; such as '-geometry' or '-use'.
: The information is used to generate the root widget of the : The information is used to generate the root widget of the
: interpreter. : interpreter.
: ( e.g. TclTkIp.new('FOO', '-geometry 500x200 -use 0x2200009') ) : ( e.g. TclTkIp.new('FOO', '-geometry 500x200 -use 0x2200009') )
: If is given nil or falsr for the 'option' argument, generates : If is given nil or falsr for the 'option' argument, generates
: the Tcl interpreter without Tk library. Then the interpreter : the Tcl interpreter without Tk library. Then the interpreter
: doesn't need GUI environment. Therefore, even if a window : doesn't need GUI environment. Therefore, even if a window
: system doesn't exist or cannot be used, Ruby can control the : system doesn't exist or cannot be used, Ruby can control the
: Tcl interpreter and the extention libraries loaded on the : Tcl interpreter and the extention libraries loaded on the
: interpreter. : interpreter.
[instance methods] [instance methods]
create_slave(name, safe=false) create_slave(name, safe=false)
: Create a slave interpreter. : Create a slave interpreter.
: The parent of the interpreter is the receiver of this method. : The parent of the interpreter is the receiver of this method.
: The name of the slave interpreter is given by 'name' argument. : The name of the slave interpreter is given by 'name' argument.
: The 'safe' argument decides whether the slave interpreter is : The 'safe' argument decides whether the slave interpreter is
: created as a safe interpreter or not. If true, create a safe : created as a safe interpreter or not. If true, create a safe
: interpreter. Default is false. However, if the parent : interpreter. Default is false. However, if the parent
: interpreter is a safe interpreter, the created interpreter is : interpreter is a safe interpreter, the created interpreter is
: a safe interpreter (ignore 'safe' argument value). : a safe interpreter (ignore 'safe' argument value).
: If $SAFE >= 4, can create a safe interpreter only. : If $SAFE >= 4, can create a safe interpreter only.
make_safe make_safe
: Make the interpreter to the safe interpreter, and returns : Make the interpreter to the safe interpreter, and returns
: self. If fail, raise RuntimeError. : self. If fail, raise RuntimeError.
safe? safe?
: Check whether the interpreter is the safe interpreter. : Check whether the interpreter is the safe interpreter.
: If is the safe interpreter, returns true. : If is the safe interpreter, returns true.
allow_ruby_exit? allow_ruby_exit?
: Return the mode whether 'exit' function of ruby or 'exit' : Return the mode whether 'exit' function of ruby or 'exit'
: command of Tcl/Tk can quit the ruby process or not on the : command of Tcl/Tk can quit the ruby process or not on the
: interpreter. If false, such a command quit the interpreter : interpreter. If false, such a command quit the interpreter
: only. : only.
: The default value for a master interpreter is true, and : The default value for a master interpreter is true, and
: for a slave interpreter is false. : for a slave interpreter is false.
allow_ruby_exit=(mode) allow_ruby_exit=(mode)
: Change the mode of 'allow_ruby_exit?'. : Change the mode of 'allow_ruby_exit?'.
: If $SAFE >= 4 or the interpreter is a "safe" interpreter, : If $SAFE >= 4 or the interpreter is a "safe" interpreter,
: this is not permitted (raise an exception). : this is not permitted (raise an exception).
delete delete
: Delete the interpreter. : Delete the interpreter.
: The deleted interpreter doesn't accept command and then : The deleted interpreter doesn't accept command and then
: raise an exception. : raise an exception.
deleted? deleted?
: Check whether the interpreter is already deleted. : Check whether the interpreter is already deleted.
: If deleted, returns true. : If deleted, returns true.
has_mainwindow? has_mainwindow?
: Check whether the interpreter has a MainWindow (root widget). : Check whether the interpreter has a MainWindow (root widget).
: If has, returns true. If doesn't, returns false. : If has, returns true. If doesn't, returns false.
: If IP is already deleted, returns nil. : If IP is already deleted, returns nil.
restart restart
: Restart Tk part of the interpreter. : Restart Tk part of the interpreter.
: Use this when you need Tk functions after destroying the : Use this when you need Tk functions after destroying the
: root widget. : root widget.
: On $SAFE >= 4, cannot call this method. : On $SAFE >= 4, cannot call this method.
_eval(str) _eval(str)
_invoke(*args) _invoke(*args)
: Estimates the arguments as a command on the Tk interpreter. : Estimates the arguments as a command on the Tk interpreter.
: The argument of _eval is a script of Tcl/Tk. : The argument of _eval is a script of Tcl/Tk.
: Each argument of _invoke is a token of one command line of : Each argument of _invoke is a token of one command line of
: Tcl/Tk. : Tcl/Tk.
: Because the operation of _invoke doesn't through the : Because the operation of _invoke doesn't through the
: command line parser of Tk interpreter, the cost of : command line parser of Tk interpreter, the cost of
: estimation is smaller than _eval. However, auto_load : estimation is smaller than _eval. However, auto_load
: mechanism of the Tk interpreter doesn't work on _invoke. : mechanism of the Tk interpreter doesn't work on _invoke.
: So _invoke can call only the command which already : So _invoke can call only the command which already
: registered on the interpreter by 'load' command and so on. : registered on the interpreter by 'load' command and so on.
: On _eval command, auto_load mechanism words. So if succeed : On _eval command, auto_load mechanism words. So if succeed
: to _eval and regist the command once, after that, the : to _eval and regist the command once, after that, the
: command can be called by _invoke. : command can be called by _invoke.
_cancel_eval(str) _cancel_eval(str)
_cancel_eval_unwind(str) _cancel_eval_unwind(str)
@ -365,46 +365,46 @@ class TclTkIp
_thread_vwait(var_name) _thread_vwait(var_name)
_thread_tkwait(mode, target) _thread_tkwait(mode, target)
: 'vwait' or 'tkwait' with thread support. : 'vwait' or 'tkwait' with thread support.
: The difference from normal 'vwait' or 'tkwait' command is : The difference from normal 'vwait' or 'tkwait' command is
: doing independent wait from the vwait stack when they are : doing independent wait from the vwait stack when they are
: called on the other thread than the eventloop thread. : called on the other thread than the eventloop thread.
: In the case of Tcl/Tk's vwait / tkwait, if 2nd vwait / : In the case of Tcl/Tk's vwait / tkwait, if 2nd vwait /
: tkwait is called on waiting for 1st vwait / tkwait, : tkwait is called on waiting for 1st vwait / tkwait,
: returns the order of [2nd]->[1st] regardless of the order : returns the order of [2nd]->[1st] regardless of the order
: of when the wait condition was fulfilled. : of when the wait condition was fulfilled.
: If _thread_vwait / _thread_tkwait is called on the : If _thread_vwait / _thread_tkwait is called on the
: eventloop thread, there is no difference from vwait / : eventloop thread, there is no difference from vwait /
: tkwait. But if called on the other thread than the : tkwait. But if called on the other thread than the
: eventloop, stops the thread. And when the wait condition : eventloop, stops the thread. And when the wait condition
: is fulfilled, the thread restarts. The meaning of : is fulfilled, the thread restarts. The meaning of
: "independent from the vwait stack" is that the timing of : "independent from the vwait stack" is that the timing of
: restarting is independent from the waiting status of the : restarting is independent from the waiting status of the
: other threads. That is, even if the eventloop thread is : other threads. That is, even if the eventloop thread is
: waiting by vwait and is not fulfilled the condition, : waiting by vwait and is not fulfilled the condition,
: _thread_vwait completes the waiting when its waiting : _thread_vwait completes the waiting when its waiting
: condition is fulfilled and the thread which stopped by : condition is fulfilled and the thread which stopped by
: _thread_vwait can continue the operation. : _thread_vwait can continue the operation.
_return_value _return_value
: Get the last result value on the interpreter. : Get the last result value on the interpreter.
_get_variable(var_name, flag) _get_variable(var_name, flag)
_get_variable2(var_name, index_name, flag) _get_variable2(var_name, index_name, flag)
: Get the current value of a variable. If specified a : Get the current value of a variable. If specified a
: index_name (see also the PARSE_VARNAME flag), get the : index_name (see also the PARSE_VARNAME flag), get the
: value of the index_name element. : value of the index_name element.
_set_variable(var_name, value, flag) _set_variable(var_name, value, flag)
_set_variable2(var_name, index_name, value, flag) _set_variable2(var_name, index_name, value, flag)
: Create or modify a variable. If specified a index_name : Create or modify a variable. If specified a index_name
: (see also the PARSE_VARNAME flag), create or modify the : (see also the PARSE_VARNAME flag), create or modify the
: index_name element. : index_name element.
_unset_variable(var_name) _unset_variable(var_name)
_unset_variable2(var_name, index_name) _unset_variable2(var_name, index_name)
: Remove a variable. If specified a index_name (see also : Remove a variable. If specified a index_name (see also
: the PARSE_VARNAME flag), remove the index_name element. : the PARSE_VARNAME flag), remove the index_name element.
_get_global_var(var_name) _get_global_var(var_name)
_get_global_var2(var_name, index_name) _get_global_var2(var_name, index_name)
@ -416,13 +416,13 @@ class TclTkIp
: (GLOBAL_ONLY | LEAVE_ERR_MSG). : (GLOBAL_ONLY | LEAVE_ERR_MSG).
_split_tklist(str) _split_tklist(str)
: Split the argument with Tcl/Tk's library function and : Split the argument with Tcl/Tk's library function and
: get an array as a list of Tcl list elements. : get an array as a list of Tcl list elements.
_merge_tklist(str, str, ... ) _merge_tklist(str, str, ... )
: Get a Tcl's list string from arguments with a Tcl/Tk's : Get a Tcl's list string from arguments with a Tcl/Tk's
: library function. Each arguemnt is converted to a valid : library function. Each arguemnt is converted to a valid
: Tcl list element. : Tcl list element.
_conv_listelement(str) _conv_listelement(str)
: Convert the argument to a valid Tcl list element with : Convert the argument to a valid Tcl list element with
@ -431,14 +431,14 @@ class TclTkIp
mainloop mainloop
mainloop_watchdog mainloop_watchdog
: If on the slave interpreter, never start an eventloop and : If on the slave interpreter, never start an eventloop and
: returns nil. : returns nil.
: With the exception that, same to the TclTkLib module method : With the exception that, same to the TclTkLib module method
: with the same name. : with the same name.
do_one_event do_one_event
: With the exception that the argument is forced to set : With the exception that the argument is forced to set
: DONT_WAIT flag on the slave interpreter, same to : DONT_WAIT flag on the slave interpreter, same to
: TclTkLib#do_one_event. : TclTkLib#do_one_event.
set_eventloop_tick set_eventloop_tick
get_eventloop_tick get_eventloop_tick
@ -450,24 +450,24 @@ class TclTkIp
mainloop_abort_on_exception= mainloop_abort_on_exception=
: With the exception that it is ignored to set value on the : With the exception that it is ignored to set value on the
: slave interpreter, same to the TclTkLib module method with : slave interpreter, same to the TclTkLib module method with
: the same name. : the same name.
encoding_table encoding_table
: For Ruby m17n. Return encoding relation table between Ruby's : For Ruby m17n. Return encoding relation table between Ruby's
: Encoding object and Tcl's encoding name. : Encoding object and Tcl's encoding name.
class TkCallbackBreak < StandardError class TkCallbackBreak < StandardError
class TkCallbackContinue < StandardError class TkCallbackContinue < StandardError
: They are exception classes to break or continue the Tk callback : They are exception classes to break or continue the Tk callback
: operation. : operation.
: If raise TkCallbackBreak on the callback procedure, Ruby returns : If raise TkCallbackBreak on the callback procedure, Ruby returns
: 'break' code to Tk interpreter (Then the Tk interpreter will : 'break' code to Tk interpreter (Then the Tk interpreter will
: break the operation for the current event). : break the operation for the current event).
: If raise TkCallbackContinue, returns 'continue' code (Then the Tk : If raise TkCallbackContinue, returns 'continue' code (Then the Tk
: interpreter will break the operateion for the current bindtag and : interpreter will break the operateion for the current bindtag and
: starts the operation for the next buindtag for the current event). : starts the operation for the next buindtag for the current event).
: However, current tcltklib supports Ruby's 'break' and 'next' to : However, current tcltklib supports Ruby's 'break' and 'next' to
: get the same effect. That is, those classes are obsolete. Those : get the same effect. That is, those classes are obsolete. Those
: exist for backward compatibility. : exist for backward compatibility.
(eof) (eof)

Просмотреть файл

@ -41,7 +41,7 @@ tcl/tk
このような考えに基づき, tcltk ライブラリでは, tcl/tk のコマンドやウィ このような考えに基づき, tcltk ライブラリでは, tcl/tk のコマンドやウィ
ジェットに対応するオブジェクトを生成します. オブジェクトに対するメソッ ジェットに対応するオブジェクトを生成します. オブジェクトに対するメソッ
ド呼び出しは, e() メソッドにより実行されます. 例えば, tcl/tk の info ド呼び出しは, e() メソッドにより実行されます. 例えば, tcl/tk の info
コマンドに対応する ruby のオブジェクトが info という名前であるとすると, コマンドに対応する ruby のオブジェクトが info という名前であるとすると,
tcl/tk の tcl/tk の
info commands info commands
@ -53,7 +53,7 @@ tcl/tk
. configure -height 300 -width 300 . configure -height 300 -width 300
という tcl/tk の命令は という tcl/tk の命令は
root.e("configure -height 300 -width 300") root.e("configure -height 300 -width 300")
と記述されます. このような記述は, 見ためには美しくありませんが, そして, と記述されます. このような記述は, 見ためには美しくありませんが, そして,
スクリプトを読む人には見づらいかも知れませんが, 実際にスクリプトを書い スクリプトを読む人には見づらいかも知れませんが, 実際にスクリプトを書い
てみると予想外に手軽です. てみると予想外に手軽です.
@ -173,7 +173,7 @@ require "tcltklib"
定数 DONT_WAIT 定数 DONT_WAIT
: 処理対象イベントが存在しない場合に,イベント発生を待たず : 処理対象イベントが存在しない場合に,イベント発生を待たず
: に do_one_event を終了 ( false を返す ) する : に do_one_event を終了 ( false を返す ) する
モジュール TclTkLib::VarAccessFlag モジュール TclTkLib::VarAccessFlag
: _get_variable などでのフラグを指定するためのもの.フラグに : _get_variable などでのフラグを指定するためのもの.フラグに
@ -217,7 +217,7 @@ require "tcltklib"
: 含む可能性がある (開き括弧を含み,閉じ括弧で終わる) こ : 含む可能性がある (開き括弧を含み,閉じ括弧で終わる) こ
: とを示す.その場合,括弧の間が要素名指定,最初の開き括 : とを示す.その場合,括弧の間が要素名指定,最初の開き括
: 弧までが連想配列名として扱われる_set_variable2 などで : 弧までが連想配列名として扱われる_set_variable2 などで
: このフラグを指定する場合,連想配列名と要素名は var_name : このフラグを指定する場合,連想配列名と要素名は var_name
: から抽出されるはずであるからindex_name 引数は nil と : から抽出されるはずであるからindex_name 引数は nil と
: せねばならない. : せねばならない.
@ -250,7 +250,7 @@ require "tcltklib"
: カレントスレッドがイベントループを実行しているスレッド : カレントスレッドがイベントループを実行しているスレッド
: かどうかを返す. : かどうかを返す.
: イベントループを実行しているスレッドであれば true を, : イベントループを実行しているスレッドであれば true を,
: どのスレッドでもイベントループが実行されていない場合は : どのスレッドでもイベントループが実行されていない場合は
: nil を,他のスレッドでイベントループが実行されている場 : nil を,他のスレッドでイベントループが実行されている場
: 合は false を返す. : 合は false を返す.
: false の際に Tk インタープリタを直接呼ぶのは危険である. : false の際に Tk インタープリタを直接呼ぶのは危険である.
@ -264,7 +264,7 @@ require "tcltklib"
: ( 監視スレッドを生成した後にイベントループを実行する ) : ( 監視スレッドを生成した後にイベントループを実行する )
: 引数の意味は mainloop と同じである. : 引数の意味は mainloop と同じである.
do_one_event(flag = TclTkLib::EventFlag::ALL | do_one_event(flag = TclTkLib::EventFlag::ALL |
TclTkLib::EventFlag::DONT_WAIT) TclTkLib::EventFlag::DONT_WAIT)
: 処理待ちのイベント 1 個を実行する. : 処理待ちのイベント 1 個を実行する.
: イベントを処理した場合は true を返す. : イベントを処理した場合は true を返す.
@ -309,7 +309,7 @@ require "tcltklib"
: 稼働スレッドがイベントループだけの場合には意味をなさない. : 稼働スレッドがイベントループだけの場合には意味をなさない.
: 一度のスレッド切り替えの間に処理するイベントの最大数と, : 一度のスレッド切り替えの間に処理するイベントの最大数と,
: 処理待ちのイベントが存在しない際の加算数とを設定する. : 処理待ちのイベントが存在しない際の加算数とを設定する.
: 処理待ちイベントが存在しない場合は no_event_wait ( see : 処理待ちイベントが存在しない場合は no_event_wait ( see
: set_no_event_wait ) だけの間 sleep 状態に入る. : set_no_event_wait ) だけの間 sleep 状態に入る.
: デフォルトではそれぞれ 800 回と 10 回つまり800 個のイ : デフォルトではそれぞれ 800 回と 10 回つまり800 個のイ
: ベント (アイドルイベントを含む) を処理するとか,イベント : ベント (アイドルイベントを含む) を処理するとか,イベント
@ -363,10 +363,10 @@ require "tcltklib"
_subst_UTF_backslash(str) _subst_UTF_backslash(str)
_subst_Tcl_backslash(str) _subst_Tcl_backslash(str)
: Tcl のルールでバックスラッシュ記法 ( \uhhhh による : Tcl のルールでバックスラッシュ記法 ( \uhhhh による
: Unicode 文字表現を含む ) を解析する. : Unicode 文字表現を含む ) を解析する.
: _subst_Tcl_backslash はすべてのバックスラッシュ記法を : _subst_Tcl_backslash はすべてのバックスラッシュ記法を
: 置き換えるのに対し_subst_UTF_backslash は \uhhhh : 置き換えるのに対し_subst_UTF_backslash は \uhhhh
: による Unicode 文字表現だけを置き換える. : による Unicode 文字表現だけを置き換える.
encoding_system encoding_system
@ -402,7 +402,7 @@ require "tcltklib"
: safe には生成するインタープリタを safe インタープリタとする : safe には生成するインタープリタを safe インタープリタとする
: かを指定する.デフォルトは false ということになっているが, : かを指定する.デフォルトは false ということになっているが,
: たとえ明確に false を指定していたとしても,親となるインター : たとえ明確に false を指定していたとしても,親となるインター
: プリタが safe インタープリタであれば,その設定を引き継いで : プリタが safe インタープリタであれば,その設定を引き継いで
: safe インタープリタとして生成される. : safe インタープリタとして生成される.
: $SAFE >= 4 ではsafe インタープリタ以外の生成が禁止される. : $SAFE >= 4 ではsafe インタープリタ以外の生成が禁止される.
@ -416,7 +416,7 @@ require "tcltklib"
: safe インタープリタであれば true を返す. : safe インタープリタであれば true を返す.
allow_ruby_exit? allow_ruby_exit?
: 対象となるインタープリタ上の評価でruby の exit 関数または : 対象となるインタープリタ上の評価でruby の exit 関数または
: Tcl/Tk 上の exit コマンドによって ruby 自体を終了させること : Tcl/Tk 上の exit コマンドによって ruby 自体を終了させること
: を許すかどうかを返す. : を許すかどうかを返す.
: 許さない場合は対象のインタープリタだけが終了する. : 許さない場合は対象のインタープリタだけが終了する.
@ -500,7 +500,7 @@ require "tcltklib"
_get_variable(var_name, flag) _get_variable(var_name, flag)
_get_variable2(var_name, index_name, flag) _get_variable2(var_name, index_name, flag)
: Tcl/Tk 上の var という変数名の変数の値を返す. : Tcl/Tk 上の var という変数名の変数の値を返す.
: もし index_name が指定 (PARSE_VARNAME フラグの説明も参照) : もし index_name が指定 (PARSE_VARNAME フラグの説明も参照)
: された場合は連想配列 var_name の index_name の要素を返す. : された場合は連想配列 var_name の index_name の要素を返す.
: flag には変数を検索する際の条件を指定するflag に与える : flag には変数を検索する際の条件を指定するflag に与える
: 値はモジュール TclTkLib::VarAccessFlag を参照すること. : 値はモジュール TclTkLib::VarAccessFlag を参照すること.
@ -508,7 +508,7 @@ require "tcltklib"
_set_variable(var_name, value, flag) _set_variable(var_name, value, flag)
_set_variable2(var_name, index_name, value, flag) _set_variable2(var_name, index_name, value, flag)
: Tcl/Tk 上の var という変数名の変数に値を設定する. : Tcl/Tk 上の var という変数名の変数に値を設定する.
: もし index_name が指定 (PARSE_VARNAME フラグの説明も参照) : もし index_name が指定 (PARSE_VARNAME フラグの説明も参照)
: された場合は連想配列 var_name の index_name の要素を設定 : された場合は連想配列 var_name の index_name の要素を設定
: する. : する.
: flag には変数を検索する際の条件を指定するflag に与える : flag には変数を検索する際の条件を指定するflag に与える
@ -517,7 +517,7 @@ require "tcltklib"
_unset_variable(var_name) _unset_variable(var_name)
_unset_variable2(var_name, index_name) _unset_variable2(var_name, index_name)
: Tcl/Tk 上の var_name という変数名の変数を消去する. : Tcl/Tk 上の var_name という変数名の変数を消去する.
: もし index_name が指定 (PARSE_VARNAME フラグの説明も参照) : もし index_name が指定 (PARSE_VARNAME フラグの説明も参照)
: された場合は連想配列 var_name から index_name の要素だけ : された場合は連想配列 var_name から index_name の要素だけ
: を消去する. : を消去する.

Просмотреть файл

@ -1,15 +1,15 @@
If you want to use Ruby/Tk (tk.rb and so on), you must have tcltklib.so If you want to use Ruby/Tk (tk.rb and so on), you must have tcltklib.so
which is working correctly. When you have some troubles on compiling, which is working correctly. When you have some troubles on compiling,
please read README.tcltklib and README.ActiveTcl. please read README.tcltklib and README.ActiveTcl.
Even if there is a tcltklib.so on your Ruby library directry, it will not Even if there is a tcltklib.so on your Ruby library directry, it will not
work without Tcl/Tk libraries (e.g. libtcl8.4.so) on your environment. work without Tcl/Tk libraries (e.g. libtcl8.4.so) on your environment.
You must also check that your Tcl/Tk is installed properly. You must also check that your Tcl/Tk is installed properly.
-------------------------------------------- --------------------------------------------
( the following is written in EUC-JP ) ( the following is written in EUC-JP )
Ruby/Tk (tk.rb など) を使いたい場合にはtcltklib.so が正しく動いていな Ruby/Tk (tk.rb など) を使いたい場合にはtcltklib.so が正しく動いていな
ければなりませんコンパイル時に何か問題が生じた場合はREADME.tcltklib ければなりませんコンパイル時に何か問題が生じた場合はREADME.tcltklib
や README.ActiveTcl を見てください. や README.ActiveTcl を見てください.
たとえ Ruby のライブラリディレクトリに tcltklib.so が存在していたとして たとえ Ruby のライブラリディレクトリに tcltklib.so が存在していたとして
も,実行環境に Tcl/Tk ライブラリ (libtcl8.4.so など) がなければ機能しま も,実行環境に Tcl/Tk ライブラリ (libtcl8.4.so など) がなければ機能しま

Просмотреть файл

@ -1,4 +1,4 @@
ActiveTcl is ActiveState's quality-assured distribution of Tcl. ActiveTcl is ActiveState's quality-assured distribution of Tcl.
# see <http://www.activestate.com/Products/ActiveTcl/> # see <http://www.activestate.com/Products/ActiveTcl/>
# <http://www.tcl.tk/> # <http://www.tcl.tk/>
@ -12,11 +12,11 @@ use --without-ActiveTcl option.
When "extconf.rb" fails to find your ActiveTcl libraries, please try When "extconf.rb" fails to find your ActiveTcl libraries, please try
the followings. the followings.
If you want to use ActiveTcl binary package as the Tcl/Tk libraries, If you want to use ActiveTcl binary package as the Tcl/Tk libraries,
please use the following configure options. please use the following configure options.
--with-ActiveTcl=<ActiveTcl_root> --with-ActiveTcl=<ActiveTcl_root>
( When without argument; no <ActiveTcl_root>; only '--with-ActiveTcl', ( When without argument; no <ActiveTcl_root>; only '--with-ActiveTcl',
it same to '--with-ActiveTcl=/opt/ActiveTcl*/lib' ) it same to '--with-ActiveTcl=/opt/ActiveTcl*/lib' )
--with-tcl-dir=<ActiveTcl_root> --with-tcl-dir=<ActiveTcl_root>
@ -28,7 +28,7 @@ And use the followings if you need.
--with-tklib=<libname> --with-tklib=<libname>
--enable-tcltk-stubs --enable-tcltk-stubs
For example, when you install ActiveTcl-8.4.x to '/usr/local/ActiveTcl', For example, when you install ActiveTcl-8.4.x to '/usr/local/ActiveTcl',
configure --with-tcl-dir=/usr/local/ActiveTcl/ \ configure --with-tcl-dir=/usr/local/ActiveTcl/ \
--with-tk-dir=/usr/local/ActiveTcl/ \ --with-tk-dir=/usr/local/ActiveTcl/ \
@ -36,17 +36,17 @@ For example, when you install ActiveTcl-8.4.x to '/usr/local/ActiveTcl',
--with-tklib=tkstub8.4 \ --with-tklib=tkstub8.4 \
--enable-tcltk-stubs --enable-tcltk-stubs
It depends on your environment that you have to add the directory of It depends on your environment that you have to add the directory of
ActiveTcl's libraries to your library path when execute Ruby/Tk. ActiveTcl's libraries to your library path when execute Ruby/Tk.
One of the way is to add entries to TCLLIBPATH environment variable, One of the way is to add entries to TCLLIBPATH environment variable,
and one of the others add to LD_LIBRARY_PATH environment variable and one of the others add to LD_LIBRARY_PATH environment variable
Probably, using TCLLIBPATH is better. The value is appended at the Probably, using TCLLIBPATH is better. The value is appended at the
head of Tcl's 'auto_path' variable. You can see the value of the head of Tcl's 'auto_path' variable. You can see the value of the
variable by using 'Tk::AUTO_PATH.value' or 'Tk::AUTO_PATH.list'. variable by using 'Tk::AUTO_PATH.value' or 'Tk::AUTO_PATH.list'.
For example, on Linux, one of the ways is to use LD_LIBRARY_PATH For example, on Linux, one of the ways is to use LD_LIBRARY_PATH
environment variable. environment variable.
------------------------------------------------------------------------- -------------------------------------------------------------------------
[bash]$ LD_LIBRARY_PATH=/usr/local/ActiveTcl/lib:$LD_LIBRARY_PATH \ [bash]$ LD_LIBRARY_PATH=/usr/local/ActiveTcl/lib:$LD_LIBRARY_PATH \
ruby your-Ruby/Tk-script ruby your-Ruby/Tk-script
@ -57,6 +57,6 @@ Based on it, the Tcl interpreter changes auto_path variable's value.
Then, you'll be able to use Tcl/Tk extension libraries included in the Then, you'll be able to use Tcl/Tk extension libraries included in the
ActiveTcl package (e.g. call TkPackage.require('BWidget'), and then, ActiveTcl package (e.g. call TkPackage.require('BWidget'), and then,
use functions/widgets of BWidget extention). use functions/widgets of BWidget extention).
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

Просмотреть файл

@ -1,13 +1,13 @@
Ruby/Tk does NOT support forking the process on which Tk interpreter Ruby/Tk does NOT support forking the process on which Tk interpreter
is running (unless NEVER control Tk interpreter under the forked child is running (unless NEVER control Tk interpreter under the forked child
process). In the library 'tk.rb', a Tk interpreter is initialized. process). In the library 'tk.rb', a Tk interpreter is initialized.
Therefore, if you want running Tk under a child process, please call Therefore, if you want running Tk under a child process, please call
"require 'tk'" in the child process. "require 'tk'" in the child process.
# If do fork and exec(<new Ruby/Tk>) on the child process, you can # If do fork and exec(<new Ruby/Tk>) on the child process, you can
# control Ruby/Tk interpreter on the child process by 'send' command # control Ruby/Tk interpreter on the child process by 'send' command
# of Tcl/Tk. About this, please see Tk.appsend and Tk.rb_appsend, or # of Tcl/Tk. About this, please see Tk.appsend and Tk.rb_appsend, or
# 'remote-tk.rb' and the sample 'sample/remote-ip_sample.rb'. # 'remote-tk.rb' and the sample 'sample/remote-ip_sample.rb'.
For example, the following sample1 will NOT work, and sample2 will For example, the following sample1 will NOT work, and sample2 will
work properly. work properly.

Просмотреть файл

@ -3,13 +3,13 @@
First of all, please read README.tcltklib to use Tcl/Tk Aqua Framework. First of all, please read README.tcltklib to use Tcl/Tk Aqua Framework.
With Tcl/Tk Aqua libraries, current tcltklib somtimes freezes when With Tcl/Tk Aqua libraries, current tcltklib somtimes freezes when
using Aqua specific dialogs (e.g. Tk.messageBox). using Aqua specific dialogs (e.g. Tk.messageBox).
This is a known bug of Ruby-1.8.4 release. This is a known bug of Ruby-1.8.4 release.
When you meet the trouble on your GUI, you'll be able to avoid the trouble When you meet the trouble on your GUI, you'll be able to avoid the trouble
by Tcl/Tk's traditional dialogs. by Tcl/Tk's traditional dialogs.
If you want to do that, please call some of the following bits of script If you want to do that, please call some of the following bits of script
after "reqruie 'tk'". after "reqruie 'tk'".
================================================================= =================================================================
@ -57,11 +57,11 @@ Tk.ip_eval(<<'EOS')
EOS EOS
================================================================= =================================================================
Each of them replaces the platform specific dialog command to the Each of them replaces the platform specific dialog command to the
traditional one. traditional one.
If you use some MultiTkIp objects, probably, you'll have to call the If you use some MultiTkIp objects, probably, you'll have to call the
bits of script for each MultiTkIp object. bits of script for each MultiTkIp object.
-- --
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

Просмотреть файл

@ -1,42 +1,42 @@
To compile 'tcltklib', you must have Tcl/Tk libraries on your environment. To compile 'tcltklib', you must have Tcl/Tk libraries on your environment.
Although 'extconf.rb' script searches Tcl/Tk libraries and header files Although 'extconf.rb' script searches Tcl/Tk libraries and header files
(as default, searches tclConfig.sh/tkConfig.sh and use the defintions on (as default, searches tclConfig.sh/tkConfig.sh and use the defintions on
those; ActiveTcl has high priority on searching unless --without-ActiveTcl), those; ActiveTcl has high priority on searching unless --without-ActiveTcl),
sometimes fails to find them. And then, 'tcltklib' cannot be compiled. If sometimes fails to find them. And then, 'tcltklib' cannot be compiled. If
Tcl/Tk libraries or header files are installed but are not found, you can Tcl/Tk libraries or header files are installed but are not found, you can
give the information by arguments of the 'configure' script. Please give give the information by arguments of the 'configure' script. Please give
some or all of the following options. some or all of the following options.
--with-tk-old-extconf use old "extconf.rb" (default: false). --with-tk-old-extconf use old "extconf.rb" (default: false).
If current extconf.rb doesn't work properly If current extconf.rb doesn't work properly
(or your install process is based on old (or your install process is based on old
documant about Ruby/Tk install), please try documant about Ruby/Tk install), please try
this option. this option.
--with-ActiveTcl / --without-ActiveTcl --with-ActiveTcl / --without-ActiveTcl
--with-ActiveTcl=<dir> search ActiveTcl libraries (default: true). --with-ActiveTcl=<dir> search ActiveTcl libraries (default: true).
When true, try to find installed ActiveTcl. When true, try to find installed ActiveTcl.
When <dir> is given, use it as the ActiveTcl's When <dir> is given, use it as the ActiveTcl's
top directory (use <dir>/lib, and so on). top directory (use <dir>/lib, and so on).
Old "extconf.rb" doesn't support this option. Old "extconf.rb" doesn't support this option.
--with-tk-shlib-search-path=<paths> --with-tk-shlib-search-path=<paths>
teach the paths for loading shared-libraries teach the paths for loading shared-libraries
to linker. to linker.
<paths> is a path list with the same format <paths> is a path list with the same format
as PATH environment variable. as PATH environment variable.
This option may be experimental. This option may be experimental.
Old "extconf.rb" doesn't support this option. Old "extconf.rb" doesn't support this option.
--with-tcltkversion=<version> --with-tcltkversion=<version>
force version of Tcl/Tk libaray force version of Tcl/Tk libaray
(e.g. libtcl8.4g.so ==> --with-tcltkversion=8.4g) (e.g. libtcl8.4g.so ==> --with-tcltkversion=8.4g)
--without-tcl-config / --without-tk-config --without-tcl-config / --without-tk-config
--with-tclConfig-dir=<dir> --with-tclConfig-dir=<dir>
--with-tkConfig-dir=<dir> the directory contains 'tclConfig.sh' and --with-tkConfig-dir=<dir> the directory contains 'tclConfig.sh' and
'tkConfig.sh'. 'tkConfig.sh'.
Current "extconf.rb" uses the information Current "extconf.rb" uses the information
on tclConfig.sh/tkConfig.rb, if possible. on tclConfig.sh/tkConfig.rb, if possible.
Old "extconf.rb" doesn't support this option. Old "extconf.rb" doesn't support this option.
@ -45,14 +45,14 @@ some or all of the following options.
--enable-tcltk-stubs (if you force to enable stubs) --enable-tcltk-stubs (if you force to enable stubs)
On old "extconf.rb", default is false. On old "extconf.rb", default is false.
On current "extconf.rb", default is true when On current "extconf.rb", default is true when
tclConfig.sh/tkConfig.sh have TCL_STUB_LIB_SPEC tclConfig.sh/tkConfig.sh have TCL_STUB_LIB_SPEC
/TK_STUB_LIB_SPEC, else default is false. /TK_STUB_LIB_SPEC, else default is false.
--with-tcl-dir=<path> --with-tcl-dir=<path>
equal to "--with-tcl-include=<path>/include --with-tcl-lib=<path>/lib" equal to "--with-tcl-include=<path>/include --with-tcl-lib=<path>/lib"
--with-tk-dir=<path> --with-tk-dir=<path>
equal to "--with-tk-include=<path>/include --with-tk-lib=<path>/lib" equal to "--with-tk-include=<path>/include --with-tk-lib=<path>/lib"
--with-tcl-include=<dir> the directry contains 'tcl.h' --with-tcl-include=<dir> the directry contains 'tcl.h'
@ -66,9 +66,9 @@ some or all of the following options.
--enable-tcltk-framework use Tcl/Tk framework --enable-tcltk-framework use Tcl/Tk framework
--with-tcltk-framework=<dir> the directory contains Tcl/Tk framework; --with-tcltk-framework=<dir> the directory contains Tcl/Tk framework;
"<dir>/Tcl.framework" and "<dir>/Tk.framework". "<dir>/Tcl.framework" and "<dir>/Tk.framework".
When this option is given, it is assumed that When this option is given, it is assumed that
--enable-tcltk-framework option is given also. --enable-tcltk-framework option is given also.
--with-tcl-framework-dir=<dir> --with-tcl-framework-dir=<dir>
@ -78,17 +78,17 @@ some or all of the following options.
Tk framework directory (e.g. "/Library/Frameworks/Tk.framework") Tk framework directory (e.g. "/Library/Frameworks/Tk.framework")
--with-tcl-framework-header=<dir> --with-tcl-framework-header=<dir>
Tcl framework headers directory Tcl framework headers directory
(e.g. "/Library/Frameworks/Tcl.framework/Headers") (e.g. "/Library/Frameworks/Tcl.framework/Headers")
--with-tk-framework-header=<dir> --with-tk-framework-header=<dir>
Tk framework headers directory Tk framework headers directory
(e.g. "/Library/Frameworks/Tk.framework/Headers") (e.g. "/Library/Frameworks/Tk.framework/Headers")
--with-X11 / --without-X11 use / not use the X Window System --with-X11 / --without-X11 use / not use the X Window System
--with-X11-dir=<path> --with-X11-dir=<path>
equal to "--with-X11-include=<path>/include --with-X11-lib=<path>/lib" equal to "--with-X11-include=<path>/include --with-X11-lib=<path>/lib"
--with-X11-include=<dir> the directry contais X11 header files --with-X11-include=<dir> the directry contais X11 header files
@ -104,24 +104,24 @@ directry of Ruby sources, please try something like as the followings.
*** ATTENTION *** *** ATTENTION ***
When your Tcl/Tk libraries are compiled with "pthread support", When your Tcl/Tk libraries are compiled with "pthread support",
Ruby/Tk may cause "Hang-up" or "Segmentation Fault" frequently. Ruby/Tk may cause "Hang-up" or "Segmentation Fault" frequently.
If you have such a trouble, please try to use the '--enable-pthread' If you have such a trouble, please try to use the '--enable-pthread'
option of the 'configure' command and re-compile Ruby sources. option of the 'configure' command and re-compile Ruby sources.
It may help you to avoid this trouble. The following configure It may help you to avoid this trouble. The following configure
options may be useful. options may be useful.
--enable-tcl-thread/--disable-tcl-thread --enable-tcl-thread/--disable-tcl-thread
--with-tclConfig-file=<path of 'tclConfig.sh'> --with-tclConfig-file=<path of 'tclConfig.sh'>
--with-tkConfig-file=<path of 'tkConfig.sh'> --with-tkConfig-file=<path of 'tkConfig.sh'>
It is not need that 'tclConfig.sh' is a normal Tcl/Tk's tclConfig.sh. It is not need that 'tclConfig.sh' is a normal Tcl/Tk's tclConfig.sh.
But the file is expected to include the line "TCL_THREADS=0" or "...=1". But the file is expected to include the line "TCL_THREADS=0" or "...=1".
When no "TCL_THREADS=?" line, if Tcl version is 7.x or 8.0 which is When no "TCL_THREADS=?" line, if Tcl version is 7.x or 8.0 which is
given by "TCL_MAJOR_VERSION=?" line and "TCL_MINOR_VERSION=?" line, given by "TCL_MAJOR_VERSION=?" line and "TCL_MINOR_VERSION=?" line,
then --disable-tcl-thread is expected. Else, ignore the 'tclConfig.sh'. then --disable-tcl-thread is expected. Else, ignore the 'tclConfig.sh'.
If --enable-tcl-thread or --disable-tcl-thread option is given, then If --enable-tcl-thread or --disable-tcl-thread option is given, then
--with-tclConfig-file option is ignored. --with-tclConfig-file option is ignored.
========================================================== ==========================================================
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

Просмотреть файл

@ -9,8 +9,8 @@ tkextlib/ non-standard Tcl/Tk extension support libraries
********************************************************************* *********************************************************************
*** The followings exists for backward compatibility only. *** The followings exists for backward compatibility only.
*** The only thing which they work is that requires current *** The only thing which they work is that requires current
*** library files ( tk/*.rb ). *** library files ( tk/*.rb ).
********************************************************************* *********************************************************************
tkafter.rb handles Tcl after tkafter.rb handles Tcl after
tkbgerror.rb Tk error module tkbgerror.rb Tk error module

Просмотреть файл

@ -6,56 +6,56 @@
The following list shows *CURRENT* status when this file was modifyed The following list shows *CURRENT* status when this file was modifyed
at last. If you want to add other Tcl/Tk extensions to the planed list at last. If you want to add other Tcl/Tk extensions to the planed list
(or change its status position), please request them at the ruby-talk, (or change its status position), please request them at the ruby-talk,
ruby-list, or ruby-dev ML. Although we cannot promise to support your ruby-list, or ruby-dev ML. Although we cannot promise to support your
requests, we'll try to do. requests, we'll try to do.
If you want to check that wrapper libraries are ready to use on your If you want to check that wrapper libraries are ready to use on your
environment, please execute 'pkg_checker.rb' with no arguments. The environment, please execute 'pkg_checker.rb' with no arguments. The
script may give you some hints about that. script may give you some hints about that.
***** IMPORTANT NOTE ********************************************** ***** IMPORTANT NOTE **********************************************
'support' means that Ruby/Tk's wrapper libraries are released. 'support' means that Ruby/Tk's wrapper libraries are released.
'not support' does *NOT* mean that the extension doesn't work 'not support' does *NOT* mean that the extension doesn't work
on Ruby/Tk. on Ruby/Tk.
The version number of each extension means the latest version The version number of each extension means the latest version
which is checked its feature. That is, it does NOT means only which is checked its feature. That is, it does NOT means only
version of working. Library files maybe include some features version of working. Library files maybe include some features
which is included in the former version but removed from the which is included in the former version but removed from the
latest, and maybe able to support the later version then the latest, and maybe able to support the later version then the
shown version. shown version.
Even if the status of the extension is 'not support', you can Even if the status of the extension is 'not support', you can
control the functions/widgets of the extension without wrapper control the functions/widgets of the extension without wrapper
libraries by Tk.tk_call(), Tk.ip_eval(), and so on. libraries by Tk.tk_call(), Tk.ip_eval(), and so on.
If you cannot use installed Tcl/Tk extension, please check the If you cannot use installed Tcl/Tk extension, please check the
followings. followings.
(1) On your Tcl/Tk, does the extention work? (1) On your Tcl/Tk, does the extention work?
(2) Do DLL libraries of the extension exist on DLL load-path? (2) Do DLL libraries of the extension exist on DLL load-path?
(See also "<ruby archive>/ext/tcltklib/README.ActiveTcl") (See also "<ruby archive>/ext/tcltklib/README.ActiveTcl")
(3) Is the Tcl library directory of the extension included in (3) Is the Tcl library directory of the extension included in
library search-path of the Tcl interpreter linked Ruby/Tk? library search-path of the Tcl interpreter linked Ruby/Tk?
The check results may request you to do some setup operations The check results may request you to do some setup operations
before using the extension. If so, then please write the step before using the extension. If so, then please write the step
of setup oprations into the "setup.rb" file in the directory of setup oprations into the "setup.rb" file in the directory
of the wrapper libraries for the extention (It is the wrapper of the wrapper libraries for the extention (It is the wrapper
libraries have the standard structure of the libraries in this libraries have the standard structure of the libraries in this
directory). The "setup" file is required before requiring the directory). The "setup" file is required before requiring the
Tcl library package (TkPackage.require(<libname>)). Tcl library package (TkPackage.require(<libname>)).
******************************************************************* *******************************************************************
===< support with some examples (may be beta quality) >======================= ===< support with some examples (may be beta quality) >=======================
Tcllib 1.11.1 Tcllib 1.11.1
Tklib 0.5 http://sourceforge.net/projects/tcllib ==> tcllib Tklib 0.5 http://sourceforge.net/projects/tcllib ==> tcllib
( partial support; primary support target is Tklib) ( partial support; primary support target is Tklib)
@ -78,7 +78,7 @@ TkImg 1.3 http://sourceforge.net/projects/tkimg ==> tkimg
BLT 2.4z http://sourceforge.net/projects/blt BLT 2.4z http://sourceforge.net/projects/blt
* see also tcltk-ext library on RAA * see also tcltk-ext library on RAA
(http://raa.ruby-lang.org/) (http://raa.ruby-lang.org/)
==> blt ==> blt
@ -97,7 +97,7 @@ IncrTcl CVS/Hd(2008-12-15)
TclX CVS/Hd(2008-12-15) TclX CVS/Hd(2008-12-15)
http://sourceforge.net/projects/tclx http://sourceforge.net/projects/tclx
==> tclx (partial support; infox command and ==> tclx (partial support; infox command and
XPG/3 message catalogs only) XPG/3 message catalogs only)
Trofs 0.4.4 http://math.nist.gov/~DPorter/tcltk/trofs/ Trofs 0.4.4 http://math.nist.gov/~DPorter/tcltk/trofs/
@ -129,7 +129,7 @@ Tkgeomap *** http://tkgeomap.sourceforge.net/index.html
===< not determined to supprt or not >======================================== ===< not determined to supprt or not >========================================
Tix *** http://tixlibrary.sourceforge.net/ Tix *** http://tixlibrary.sourceforge.net/
* see also tcltk-ext library on RAA * see also tcltk-ext library on RAA
(http://raa.ruby-lang.org/) (http://raa.ruby-lang.org/)
TkZinc *** http://www.tkzinc.org/ TkZinc *** http://www.tkzinc.org/
@ -175,7 +175,7 @@ TclDOM *** http://sourceforge.net/projects/tclxml
TclSOAP *** http://sourceforge.net/projects/tclsoap TclSOAP *** http://sourceforge.net/projects/tclsoap
Snack *** http://www.speech.kth.se/~kare/snack2.2.tar.gz Snack *** http://www.speech.kth.se/~kare/snack2.2.tar.gz
* use Snack for Ruby * use Snack for Ruby
(see http://rbsnack.sourceforge.net/) (see http://rbsnack.sourceforge.net/)
Tcom *** http://www.vex.net/~cthuang/tcom/ Tcom *** http://www.vex.net/~cthuang/tcom/
@ -191,7 +191,7 @@ XOTcl *** http://www.xotcl.org/
===< tool (may not supprt) >================================================== ===< tool (may not supprt) >==================================================
tbcload/tclcompiler tbcload/tclcompiler
*** http://www.tcl.tk/software/tclpro/ *** http://www.tcl.tk/software/tclpro/

Просмотреть файл

@ -4,14 +4,14 @@
Tcllib includes many utilities. But currently, supports TKLib part Tcllib includes many utilities. But currently, supports TKLib part
only (see the following 'tcllib contents'). only (see the following 'tcllib contents').
If you request to support others, please send your message to one of If you request to support others, please send your message to one of
ruby-talk/ruby-list/ruby-dev/ruby-ext mailing lists. ruby-talk/ruby-list/ruby-dev/ruby-ext mailing lists.
-----<from "What is tcllib?">---------------------------- -----<from "What is tcllib?">----------------------------
Tcllib is a collection of utility modules for Tcl. These modules provide Tcllib is a collection of utility modules for Tcl. These modules provide
a wide variety of functionality, from implementations of standard data a wide variety of functionality, from implementations of standard data
structures to implementations of common networking protocols. The intent structures to implementations of common networking protocols. The intent
is to collect commonly used function into a single library, which users is to collect commonly used function into a single library, which users
can rely on to be available and stable. can rely on to be available and stable.
--------------------------------------------------------- ---------------------------------------------------------
@ -124,7 +124,7 @@ Grammars and finite automata
TKLib TKLib
* Plotchart - Simple plotting and charting package * Plotchart - Simple plotting and charting package
* autoscroll - Provides for a scrollbar to automatically mapped and * autoscroll - Provides for a scrollbar to automatically mapped and
unmapped as needed unmapped as needed
* ctext - An extended text widget with customizable Syntax highlighting * ctext - An extended text widget with customizable Syntax highlighting
* cursor - Procedures to handle CURSOR data * cursor - Procedures to handle CURSOR data

Просмотреть файл

@ -2,7 +2,7 @@
[ Tcl/Tk Image formats (TkImg) support ] [ Tcl/Tk Image formats (TkImg) support ]
TkImg contains a collection of format handlers for the Tk photo TkImg contains a collection of format handlers for the Tk photo
image type, and a new image type, pixmaps. image type, and a new image type, pixmaps.
Supported formats of TkImg version 1.3 are Supported formats of TkImg version 1.3 are
------------------------------------------------------- -------------------------------------------------------

Просмотреть файл

@ -70,7 +70,7 @@ demo/lines2.rb : tcltk
で作成/動作確認しました. 他の環境では動作するかどうかわかりません. で作成/動作確認しました. 他の環境では動作するかどうかわかりません.
TclTkLib.mainloop を実行中に Control-C が効かないのは不便なので, ruby TclTkLib.mainloop を実行中に Control-C が効かないのは不便なので, ruby
のソースを参考に, #include "sig.h" して trap_immediate を操作していま のソースを参考に, #include "sig.h" して trap_immediate を操作していま
すが, ruby の README.EXT にも書いてないのに, こんなことをして良いのか すが, ruby の README.EXT にも書いてないのに, こんなことをして良いのか
どうかわかりません. どうかわかりません.
@ -86,12 +86,12 @@ extconf.rb
ruby から tcl/tk ライブラリを利用できます. ruby から tcl/tk ライブラリを利用できます.
tcl/tk インタプリタのスクリプトは, 機械的に tcltk ライブラリ用の ruby tcl/tk インタプリタのスクリプトは, 機械的に tcltk ライブラリ用の ruby
スクリプトに変換できます. スクリプトに変換できます.
(`tk.rb' との違い) (`tk.rb' との違い)
1. tcl/tk インタプリタのスクリプトが, どのように, tcltk ライブラリ用の 1. tcl/tk インタプリタのスクリプトが, どのように, tcltk ライブラリ用の
ruby スクリプトに変換されるかが理解できれば, マニュアル類が無いに等 ruby スクリプトに変換されるかが理解できれば, マニュアル類が無いに等
しい `tk.rb' とは異なり しい `tk.rb' とは異なり
@ -136,7 +136,7 @@ tcl/tk
しなければなりません(その代わり, tcl/tk ライブラリの仕様通り, しなければなりません(その代わり, tcl/tk ライブラリの仕様通り,
tcl/tk インタプリタを複数生成することもできますが). tcl/tk インタプリタを複数生成することもできますが).
インターフェースは(おそらく) ruby の思想に沿ったものではありません. インターフェースは(おそらく) ruby の思想に沿ったものではありません.
また, スクリプトの記述は また, スクリプトの記述は
ダサダサ ダサダサ

Просмотреть файл

@ -6,4 +6,4 @@
* Added test to widget and hello versus Tk::TCL_VERSION & Tk::JAPANIZED_TK (per Guy Decoux in [ruby-talk:18559]) before requiring tkencoding.rb. * Added test to widget and hello versus Tk::TCL_VERSION & Tk::JAPANIZED_TK (per Guy Decoux in [ruby-talk:18559]) before requiring tkencoding.rb.

Просмотреть файл

@ -1,14 +1,14 @@
Current Maintainer: Current Maintainer:
Jonathan Conway Jonathan Conway
rise@knavery.net rise@knavery.net
Please direct all bug reports/requests/suggestions to the above Please direct all bug reports/requests/suggestions to the above
address. address.
Notes: Notes:
* The files hello and widget have been changed to test Tk::TCL_VERSION * The files hello and widget have been changed to test Tk::TCL_VERSION
and Tk::JAPANIZED_TK before requiring tkencoding.rb to prevent an and Tk::JAPANIZED_TK before requiring tkencoding.rb to prevent an
infinite loop. This test was taken from a message in infinite loop. This test was taken from a message in
[ruby-talk:18559] by Guy Decoux. [ruby-talk:18559] by Guy Decoux.
@ -18,7 +18,7 @@ Notes:
able to use images exported by a graphics program as Windows able to use images exported by a graphics program as Windows
bitmaps with this demo collection nor will you be able to edit the bitmaps with this demo collection nor will you be able to edit the
included images without setting the file type correctly. included images without setting the file type correctly.
-- Jonathan Conway, 2001-07-26 -- Jonathan Conway, 2001-07-26
@ -28,19 +28,19 @@ Notes:
# To create this version of the Ruby/Tk widget demo, I took the # To create this version of the Ruby/Tk widget demo, I took the
# ruby-tk81-demos and removed all the Kanji strings and comments. I # ruby-tk81-demos and removed all the Kanji strings and comments. I
# have tried to restore the original English strings and comments # have tried to restore the original English strings and comments
# using the Tcl/Tk8.2.2 version of the widget demo. # using the Tcl/Tk8.2.2 version of the widget demo.
# #
# When I tried running the Kanji version, all I got was a mostly blank # When I tried running the Kanji version, all I got was a mostly blank
# panel with a non-functional "File" button. I disovered that if all # panel with a non-functional "File" button. I disovered that if all
# non-ASCII characters were replaced with blanks, then I could get the # non-ASCII characters were replaced with blanks, then I could get the
# gutted stuff running. # gutted stuff running.
# #
# Since English Ruby/Tk documentation is lacking and I needed this # Since English Ruby/Tk documentation is lacking and I needed this
# code to see how it worked and to use as the basis of my try-it # code to see how it worked and to use as the basis of my try-it
# prototype (The Ruby Yielding Interactive Toolkit), plus the fact # prototype (The Ruby Yielding Interactive Toolkit), plus the fact
# that no help was forthcoming for making the Kanji version work (plus # that no help was forthcoming for making the Kanji version work (plus
# the fact that I can't read Kanji anyway), I decided to embark on # the fact that I can't read Kanji anyway), I decided to embark on
# this English restoration project. # this English restoration project.
# #
# Thanks to everyone who worked on the original Ruby/Tk widget demo # Thanks to everyone who worked on the original Ruby/Tk widget demo
# (and the preceding Tcl/Tk version for that matter). The # (and the preceding Tcl/Tk version for that matter). The
@ -86,13 +86,13 @@ Windows(Cygwin)
<eban@os.rim.or.jp> <eban@os.rim.or.jp>
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
Ruby/Tk widget-demo Ruby/Tk widget-demo
version 1.1 ( 1998/07/24 ) version 1.1 ( 1998/07/24 )
永井@知能.九工大 (nagai@ai.kyutech.ac.jp) 永井@知能.九工大 (nagai@ai.kyutech.ac.jp)
標準配布の Tcl/Tk 拡張パッケージを取り込んだ Ruby (以下 Ruby/Tk と呼びます) 標準配布の Tcl/Tk 拡張パッケージを取り込んだ Ruby (以下 Ruby/Tk と呼びます)
ではTk widget を用いた GUI の作成を行うことができます.実際に GUI を作成 ではTk widget を用いた GUI の作成を行うことができます.実際に GUI を作成
していく場合には様々な実例がサンプルとして存在すると便利なのですがRuby/Tk していく場合には様々な実例がサンプルとして存在すると便利なのですがRuby/Tk
にはそのような適当なサンプルスクリプト集合は存在しませんでした.それに対し, にはそのような適当なサンプルスクリプト集合は存在しませんでした.それに対し,
拡張パッケージの元である Tcl/Tk にはTk widget を用いてどのようなことがで 拡張パッケージの元である Tcl/Tk にはTk widget を用いてどのようなことがで
きるかを示すものとして widget-demo が存在しおりTcl/Tk を用いた GUI の作成 きるかを示すものとして widget-demo が存在しおりTcl/Tk を用いた GUI の作成
@ -118,21 +118,21 @@ Tcl/Tk
でしょうRuby/Tk 版の記述を widget-demo を Tcl/Tk 版の記述に近いものにして でしょうRuby/Tk 版の記述を widget-demo を Tcl/Tk 版の記述に近いものにして
おけばその対比によってRuby/Tk の理解を早めることができると考えられます. おけばその対比によってRuby/Tk の理解を早めることができると考えられます.
一旦 Ruby/Tk での 各 widget の使用方法を習得してしまえばRuby らしいスクリ 一旦 Ruby/Tk での 各 widget の使用方法を習得してしまえばRuby らしいスクリ
プトを作成することは難しくないでしょう本アーカイブのスクリプトはRuby/Tk プトを作成することは難しくないでしょう本アーカイブのスクリプトはRuby/Tk
を最初に習得するまでの踏台として利用していただければ幸いです. を最初に習得するまでの踏台として利用していただければ幸いです.
widget-demo の移植にあたっては,次の方にも移植したスクリプトを提供していただ widget-demo の移植にあたっては,次の方にも移植したスクリプトを提供していただ
きました.ここに感謝の意を表します. きました.ここに感謝の意を表します.
立石JAIST (ttate@jaist.ac.jp) さん 立石JAIST (ttate@jaist.ac.jp) さん
平松祥史 (hiramatu@cdrom.co.jp) さん 平松祥史 (hiramatu@cdrom.co.jp) さん
平松さんによる Ruby/Tk 入門の Web page (http://www.cdrom.co.jp/~hiramatu/) 平松さんによる Ruby/Tk 入門の Web page (http://www.cdrom.co.jp/~hiramatu/)
も Ruby/Tk の習得に有用と思えますので,ぜひご参照ください. も Ruby/Tk の習得に有用と思えますので,ぜひご参照ください.
また,前橋 (maebashi@iij.ad.jp) さんをはじめとしてwidget-demo の移植に際し また,前橋 (maebashi@iij.ad.jp) さんをはじめとしてwidget-demo の移植に際し
て必要となった Ruby の Tk 関連ライブラリ修正について,問題点,バグの指摘をし て必要となった Ruby の Tk 関連ライブラリ修正について,問題点,バグの指摘をし
ていただいた方々にも感謝致します. ていただいた方々にも感謝致します.
そして最後に最大の感謝を Ruby 設計者の まつもと ゆきひろ (matz@netlab.co.jp) そして最後に最大の感謝を Ruby 設計者の まつもと ゆきひろ (matz@netlab.co.jp)
さんに捧げたいと思います. さんに捧げたいと思います.

Просмотреть файл

@ -1,18 +1,18 @@
There are Ruby/Tk demo scripts. There are Ruby/Tk demo scripts.
Files with '.rb' extension are sub-scripts which are launched 'widget' Files with '.rb' extension are sub-scripts which are launched 'widget'
script. Those files don't work independently. Please call them from script. Those files don't work independently. Please call them from
'widget' script. 'widget' script.
If you want start some sub-scripts at same time when the launcher If you want start some sub-scripts at same time when the launcher
script tarts, please give the sub-script names as arguments. script tarts, please give the sub-script names as arguments.
(e.g. /usr/local/bin/ruby widget button.rb entry1.rb text.rb ) (e.g. /usr/local/bin/ruby widget button.rb entry1.rb text.rb )
You can ommit '.rb' of the sub-scripts You can ommit '.rb' of the sub-scripts
(e.g. /usr/local/bin/ruby widget button entry1 text ) (e.g. /usr/local/bin/ruby widget button entry1 text )
If you don't need launcher's main window, give -n option. If you don't need launcher's main window, give -n option.
(e.g. /usr/local/bin/ruby widget -n button.rb entry1.rb text.rb ) (e.g. /usr/local/bin/ruby widget -n button.rb entry1.rb text.rb )
Others (browse1, hello, and so on) are standalone scripts. Others (browse1, hello, and so on) are standalone scripts.
2004/04/14 Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) 2004/04/14 Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

Просмотреть файл

@ -1,5 +1,5 @@
This is a original document of 'tkencoding.rb'. This is a original document of 'tkencoding.rb'.
The library 'tkencoding.rb' is obsolete. The library 'tkencoding.rb' is obsolete.
Functions of tkencoding.rb is already included into Ruby/Tk. Functions of tkencoding.rb is already included into Ruby/Tk.
------------------------------------------------- -------------------------------------------------

Просмотреть файл

@ -1,16 +1,16 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# browse -- # browse --
# This script generates a directory browser, which lists the working # This script generates a directory browser, which lists the working
# directory and allow you to open files or subdirectories by # directory and allow you to open files or subdirectories by
# double-clicking. # double-clicking.
require 'tk' require 'tk'
# Create a scrollbar on the right side of the main window and a listbox # Create a scrollbar on the right side of the main window and a listbox
# on the left side. # on the left side.
listbox = TkListbox.new(nil, 'relief'=>'sunken', listbox = TkListbox.new(nil, 'relief'=>'sunken',
'width'=>20, 'height'=>20, 'setgrid'=>'yes') {|l| 'width'=>20, 'height'=>20, 'setgrid'=>'yes') {|l|
TkScrollbar.new(nil, 'command'=>proc{|*args| l.yview *args}) {|s| TkScrollbar.new(nil, 'command'=>proc{|*args| l.yview *args}) {|s|
pack('side'=>'right', 'fill'=>'y') pack('side'=>'right', 'fill'=>'y')
@ -23,10 +23,10 @@ listbox = TkListbox.new(nil, 'relief'=>'sunken',
root = TkRoot.new root = TkRoot.new
root.minsize(1,1) root.minsize(1,1)
# The procedure below is invoked to open a browser on a given file; if the # The procedure below is invoked to open a browser on a given file; if the
# file is a directory then another instance of this program is invoked; if # file is a directory then another instance of this program is invoked; if
# the file is a regular file then the Mx editor is invoked to display # the file is a regular file then the Mx editor is invoked to display
# the file. # the file.
def browse (dir, file) def browse (dir, file)
file = dir + File::Separator + file if dir != '.' file = dir + File::Separator + file if dir != '.'
@ -46,7 +46,7 @@ def browse (dir, file)
end end
end end
# Fill the listbox with a list of all the files in the directory (run # Fill the listbox with a list of all the files in the directory (run
# the "ls" command to get that information). # the "ls" command to get that information).
dir = ARGV[0] ? ARGV[0] : '.' dir = ARGV[0] ? ARGV[0] : '.'
@ -57,7 +57,7 @@ open("|ls -a #{dir}", 'r'){|fid| fid.readlines}.each{|fname|
# Set up bindings for the browser. # Set up bindings for the browser.
Tk.bind_all('Control-c', proc{root.destroy}) Tk.bind_all('Control-c', proc{root.destroy})
listbox.bind('Double-Button-1', listbox.bind('Double-Button-1',
proc{TkSelection.get.each{|f| browse dir, f}}) proc{TkSelection.get.each{|f| browse dir, f}})
Tk.mainloop Tk.mainloop

Просмотреть файл

@ -1,9 +1,9 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# browse -- # browse --
# This script generates a directory browser, which lists the working # This script generates a directory browser, which lists the working
# directory and allow you to open files or subdirectories by # directory and allow you to open files or subdirectories by
# double-clicking. # double-clicking.
require 'tk' require 'tk'
@ -19,9 +19,9 @@ class Browse
title('Browse : ' + dir) title('Browse : ' + dir)
} }
# Create a scrollbar on the right side of the main window and a listbox # Create a scrollbar on the right side of the main window and a listbox
# on the left side. # on the left side.
list = TkListbox.new(base, 'relief'=>'sunken', list = TkListbox.new(base, 'relief'=>'sunken',
'width'=>20, 'height'=>20, 'setgrid'=>'yes') {|l| 'width'=>20, 'height'=>20, 'setgrid'=>'yes') {|l|
TkScrollbar.new(base, 'command'=>proc{|*args| l.yview *args}) {|s| TkScrollbar.new(base, 'command'=>proc{|*args| l.yview *args}) {|s|
pack('side'=>'right', 'fill'=>'y') pack('side'=>'right', 'fill'=>'y')
@ -30,7 +30,7 @@ class Browse
pack('side'=>'left', 'fill'=>'both', 'expand'=>'yes') pack('side'=>'left', 'fill'=>'both', 'expand'=>'yes')
# Fill the listbox with a list of all the files in the directory (run # Fill the listbox with a list of all the files in the directory (run
# the "ls" command to get that information). # the "ls" command to get that information).
open("|ls -a #{dir}", 'r'){|fid| fid.readlines}.each{|fname| open("|ls -a #{dir}", 'r'){|fid| fid.readlines}.each{|fname|
l.insert('end', fname.chomp) l.insert('end', fname.chomp)
@ -44,14 +44,14 @@ class Browse
Browse::BROWSE_WIN_COUNTER.to_i - 1 Browse::BROWSE_WIN_COUNTER.to_i - 1
}) })
base.bind('Control-c', proc{base.destroy}) base.bind('Control-c', proc{base.destroy})
list.bind('Double-Button-1', list.bind('Double-Button-1',
proc{TkSelection.get.each{|f| self.browse dir, f}}) proc{TkSelection.get.each{|f| self.browse dir, f}})
end end
# The method below is invoked to open a browser on a given file; if the # The method below is invoked to open a browser on a given file; if the
# file is a directory then another instance of this program is invoked; if # file is a directory then another instance of this program is invoked; if
# the file is a regular file then the Mx editor is invoked to display # the file is a regular file then the Mx editor is invoked to display
# the file. # the file.
def browse (dir, file) def browse (dir, file)
file = dir + File::Separator + file if dir != '.' file = dir + File::Separator + file if dir != '.'
type = File.ftype(file) type = File.ftype(file)

Просмотреть файл

@ -28,7 +28,7 @@ MODIFICATIONS.
GOVERNMENT USE: If you are acquiring this software on behalf of the GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights" U.S. government, the Government shall have only "Restricted Rights"
in the software and related documentation as defined in the Federal in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the software shall be classified as "Commercial Computer Software" and the

Просмотреть файл

@ -28,7 +28,7 @@ MODIFICATIONS.
GOVERNMENT USE: If you are acquiring this software on behalf of the GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights" U.S. government, the Government shall have only "Restricted Rights"
in the software and related documentation as defined in the Federal in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the software shall be classified as "Commercial Computer Software" and the

Просмотреть файл

@ -164,8 +164,8 @@ class Xsettings
# #
bell = TkFrame.new(@root, 'relief'=>'raised', 'borderwidth'=>2) bell = TkFrame.new(@root, 'relief'=>'raised', 'borderwidth'=>2)
l = TkLabel.new(bell, 'text'=>'Bell Settings') l = TkLabel.new(bell, 'text'=>'Bell Settings')
@w_bellvol = TkScale.new(bell, 'from'=>0, 'to'=>100, 'length'=>200, @w_bellvol = TkScale.new(bell, 'from'=>0, 'to'=>100, 'length'=>200,
'tickinterval'=>20, 'orient'=>'horizontal', 'tickinterval'=>20, 'orient'=>'horizontal',
'label'=>"Volume (%)") 'label'=>"Volume (%)")
f = TkFrame.new(bell) f = TkFrame.new(bell)
@ -180,13 +180,13 @@ class Xsettings
# #
# Keyboard settings # Keyboard settings
# #
kbdonoff = nil kbdonoff = nil
kbdcli = nil kbdcli = nil
kbd = TkFrame.new(@root, 'relief'=>'raised', 'borderwidth'=>2) kbd = TkFrame.new(@root, 'relief'=>'raised', 'borderwidth'=>2)
l = TkLabel.new(kbd, 'text'=>'Keyboard Repeat Settings') l = TkLabel.new(kbd, 'text'=>'Keyboard Repeat Settings')
f = TkFrame.new(kbd) f = TkFrame.new(kbd)
@w_kbdonoff = TkCheckButton.new(f, 'text'=>'On', 'relief'=>'flat', @w_kbdonoff = TkCheckButton.new(f, 'text'=>'On', 'relief'=>'flat',
'onvalue'=>'on', 'offvalue'=>'off', 'onvalue'=>'on', 'offvalue'=>'off',
'variable'=>@w_kbdrep ) { 'variable'=>@w_kbdrep ) {
def self.set(value) def self.set(value)
@ -198,8 +198,8 @@ class Xsettings
end end
pack('side'=>'left', 'expand'=>'yes', 'fill'=>'both') pack('side'=>'left', 'expand'=>'yes', 'fill'=>'both')
} }
@w_kbdcli = TkScale.new(f, 'from'=>0, 'to'=>100, 'length'=>200, @w_kbdcli = TkScale.new(f, 'from'=>0, 'to'=>100, 'length'=>200,
'tickinterval'=>20, 'orient'=>'horizontal', 'tickinterval'=>20, 'orient'=>'horizontal',
'label'=>'Click Volume (%)') 'label'=>'Click Volume (%)')
@w_kbdcli.pack('side'=>'left', 'expand'=>'yes') @w_kbdcli.pack('side'=>'left', 'expand'=>'yes')
l.pack('side'=>'top', 'expand'=>'yes') l.pack('side'=>'top', 'expand'=>'yes')
@ -225,9 +225,9 @@ class Xsettings
l = TkLabel.new(screen, 'text'=>'Screen-saver Settings') l = TkLabel.new(screen, 'text'=>'Screen-saver Settings')
f = TkFrame.new(screen) f = TkFrame.new(screen)
ff1 = TkFrame.new(f) ff1 = TkFrame.new(f)
[ @w_screenblank = TkRadioButton.new(ff1, 'text'=>'Blank', [ @w_screenblank = TkRadioButton.new(ff1, 'text'=>'Blank',
'relief'=>'flat', 'relief'=>'flat',
'variable'=>@w_screenbla, 'variable'=>@w_screenbla,
'value'=>'blank') { 'value'=>'blank') {
def self.set(value) def self.set(value)
if value == 'blank' if value == 'blank'
@ -236,10 +236,10 @@ class Xsettings
self.deselect self.deselect
end end
end end
}, },
@w_screenpat = TkRadioButton.new(ff1, 'text'=>'Pattern', @w_screenpat = TkRadioButton.new(ff1, 'text'=>'Pattern',
'relief'=>'flat', 'relief'=>'flat',
'variable'=>@w_screenbla, 'variable'=>@w_screenbla,
'value'=>'noblank') { 'value'=>'noblank') {
def self.set(value) def self.set(value)
if value != 'blank' if value != 'blank'
@ -252,7 +252,7 @@ class Xsettings
].each {|w| w.pack('side'=>'top', 'pady'=>2, 'anchor'=>'w') } ].each {|w| w.pack('side'=>'top', 'pady'=>2, 'anchor'=>'w') }
ff2 = TkFrame.new(f) ff2 = TkFrame.new(f)
[ @w_screentim = LabelEntry.new(ff2, 'Timeout (s)', 5), [ @w_screentim = LabelEntry.new(ff2, 'Timeout (s)', 5),
@w_screencyc = LabelEntry.new(ff2, 'Cycle (s)', 5) ].each{|w| @w_screencyc = LabelEntry.new(ff2, 'Cycle (s)', 5) ].each{|w|
w.pack('side'=>'top', 'pady'=>2, 'anchor'=>'e') w.pack('side'=>'top', 'pady'=>2, 'anchor'=>'e')
} }

Просмотреть файл

@ -134,8 +134,8 @@ class Xsettings
def initialize(parent, text, length, range=[]) def initialize(parent, text, length, range=[])
@frame = TkFrame.new(parent) @frame = TkFrame.new(parent)
TkLabel.new(@frame, 'text'=>text).pack('side'=>'left') TkLabel.new(@frame, 'text'=>text).pack('side'=>'left')
if range.size > 0 if range.size > 0
@entry = TkSpinbox.new(@frame, 'width'=>length, 'relief'=>'sunken', @entry = TkSpinbox.new(@frame, 'width'=>length, 'relief'=>'sunken',
'from'=>range[0], 'to'=>range[1]) 'from'=>range[0], 'to'=>range[1])
else else
@entry = TkEntry.new(@frame, 'width'=>length, 'relief'=>'sunken') @entry = TkEntry.new(@frame, 'width'=>length, 'relief'=>'sunken')
@ -164,16 +164,16 @@ class Xsettings
# Buttons # Buttons
# #
btn_frame = TkFrame.new(@root) btn_frame = TkFrame.new(@root)
buttons = [ buttons = [
@btn_OK = TkButton.new(btn_frame, 'command'=>proc{win.ok}, @btn_OK = TkButton.new(btn_frame, 'command'=>proc{win.ok},
'default'=>'active', 'text'=>'Ok'), 'default'=>'active', 'text'=>'Ok'),
@btn_APPLY = TkButton.new(btn_frame, 'command'=>proc{win.writesettings}, @btn_APPLY = TkButton.new(btn_frame, 'command'=>proc{win.writesettings},
'default'=>'normal', 'text'=>'Apply', 'default'=>'normal', 'text'=>'Apply',
'state'=>'disabled'), 'state'=>'disabled'),
@btn_CANCEL = TkButton.new(btn_frame, 'command'=>proc{win.cancel}, @btn_CANCEL = TkButton.new(btn_frame, 'command'=>proc{win.cancel},
'default'=>'normal', 'text'=>'Cancel', 'default'=>'normal', 'text'=>'Cancel',
'state'=>'disabled'), 'state'=>'disabled'),
@btn_QUIT = TkButton.new(btn_frame, 'command'=>proc{win.quit}, @btn_QUIT = TkButton.new(btn_frame, 'command'=>proc{win.quit},
'default'=>'normal', 'text'=>'Quit') 'default'=>'normal', 'text'=>'Quit')
] ]
buttons.each{|b| b.pack('side'=>'left', 'expand'=>'yes', 'pady'=>5) } buttons.each{|b| b.pack('side'=>'left', 'expand'=>'yes', 'pady'=>5) }
@ -201,10 +201,10 @@ class Xsettings
# #
# Bell settings # Bell settings
# #
bell = TkLabelframe.new(@root, 'text'=>'Bell Settings', bell = TkLabelframe.new(@root, 'text'=>'Bell Settings',
'padx'=>'1.5m', 'pady'=>'1.5m') 'padx'=>'1.5m', 'pady'=>'1.5m')
@w_bellvol = TkScale.new(bell, 'from'=>0, 'to'=>100, 'length'=>200, @w_bellvol = TkScale.new(bell, 'from'=>0, 'to'=>100, 'length'=>200,
'tickinterval'=>20, 'orient'=>'horizontal', 'tickinterval'=>20, 'orient'=>'horizontal',
'label'=>"Volume (%)") 'label'=>"Volume (%)")
f = TkFrame.new(bell) f = TkFrame.new(bell)
@ -218,13 +218,13 @@ class Xsettings
# #
# Keyboard settings # Keyboard settings
# #
kbdonoff = nil kbdonoff = nil
kbdcli = nil kbdcli = nil
kbd = TkLabelframe.new(@root, 'text'=>'Keyboard Repeat Settings', kbd = TkLabelframe.new(@root, 'text'=>'Keyboard Repeat Settings',
'padx'=>'1.5m', 'pady'=>'1.5m') 'padx'=>'1.5m', 'pady'=>'1.5m')
f = TkFrame.new(kbd) f = TkFrame.new(kbd)
@w_kbdonoff = TkCheckButton.new(f, 'text'=>'On', 'relief'=>'flat', @w_kbdonoff = TkCheckButton.new(f, 'text'=>'On', 'relief'=>'flat',
'onvalue'=>'on', 'offvalue'=>'off', 'onvalue'=>'on', 'offvalue'=>'off',
'variable'=>@w_kbdrep ) { 'variable'=>@w_kbdrep ) {
def self.set(value) def self.set(value)
@ -236,17 +236,17 @@ class Xsettings
end end
pack('side'=>'left', 'expand'=>'yes', 'fill'=>'x', 'padx'=>[0, '1m']) pack('side'=>'left', 'expand'=>'yes', 'fill'=>'x', 'padx'=>[0, '1m'])
} }
@w_kbdcli = TkScale.new(f, 'from'=>0, 'to'=>100, 'length'=>200, @w_kbdcli = TkScale.new(f, 'from'=>0, 'to'=>100, 'length'=>200,
'tickinterval'=>20, 'orient'=>'horizontal', 'tickinterval'=>20, 'orient'=>'horizontal',
'label'=>'Click Volume (%)') 'label'=>'Click Volume (%)')
@w_kbdcli.pack('side'=>'left', 'expand'=>'yes', @w_kbdcli.pack('side'=>'left', 'expand'=>'yes',
'fill'=>'x', 'padx'=>['1m', 0]) 'fill'=>'x', 'padx'=>['1m', 0])
f.pack('side'=>'top', 'expand'=>'yes', 'pady'=>2, 'fill'=>'x') f.pack('side'=>'top', 'expand'=>'yes', 'pady'=>2, 'fill'=>'x')
# #
# Mouse settings # Mouse settings
# #
mouse = TkLabelframe.new(@root, 'text'=>'Mouse Settings', mouse = TkLabelframe.new(@root, 'text'=>'Mouse Settings',
'padx'=>'1.5m', 'pady'=>'1.5m') 'padx'=>'1.5m', 'pady'=>'1.5m')
f = TkFrame.new(mouse) f = TkFrame.new(mouse)
@w_mouseacc = LabelEntry.new(f, 'Acceleration', 5) @w_mouseacc = LabelEntry.new(f, 'Acceleration', 5)
@ -258,11 +258,11 @@ class Xsettings
# #
# Screen Saver settings # Screen Saver settings
# #
screen = TkLabelframe.new(@root, 'text'=>'Screen-saver Settings', screen = TkLabelframe.new(@root, 'text'=>'Screen-saver Settings',
'padx'=>'1.5m', 'pady'=>'1.5m') 'padx'=>'1.5m', 'pady'=>'1.5m')
@w_screenblank = TkRadioButton.new(screen, 'text'=>'Blank', @w_screenblank = TkRadioButton.new(screen, 'text'=>'Blank',
'relief'=>'flat', 'anchor'=>'w', 'relief'=>'flat', 'anchor'=>'w',
'variable'=>@w_screenbla, 'variable'=>@w_screenbla,
'value'=>'blank') { 'value'=>'blank') {
def self.set(value) def self.set(value)
if value == 'blank' if value == 'blank'
@ -273,9 +273,9 @@ class Xsettings
end end
} }
@w_screenpat = TkRadioButton.new(screen, 'text'=>'Pattern', @w_screenpat = TkRadioButton.new(screen, 'text'=>'Pattern',
'relief'=>'flat', 'anchor'=>'w', 'relief'=>'flat', 'anchor'=>'w',
'variable'=>@w_screenbla, 'variable'=>@w_screenbla,
'value'=>'noblank') { 'value'=>'noblank') {
def self.set(value) def self.set(value)
if value != 'blank' if value != 'blank'
@ -297,7 +297,7 @@ class Xsettings
# Main window # Main window
# #
param = { param = {
'side'=>'top', 'fill'=>'both', 'expand'=>'yes', 'side'=>'top', 'fill'=>'both', 'expand'=>'yes',
'padx'=>'1m', 'pady'=>'1m' 'padx'=>'1m', 'pady'=>'1m'
} }
btn_frame.pack('side'=>'top', 'fill'=>'both') btn_frame.pack('side'=>'top', 'fill'=>'both')

Просмотреть файл

@ -1,9 +1,9 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# rmt -- # rmt --
# This script implements a simple remote-control mechanism for # This script implements a simple remote-control mechanism for
# Tk applications. It allows you to select an application and # Tk applications. It allows you to select an application and
# then type commands to that application. # then type commands to that application.
require 'tk' require 'tk'
@ -17,41 +17,41 @@ class Rmt
root = TkWinfo.toplevel(parent) root = TkWinfo.toplevel(parent)
root.minsize(1,1) root.minsize(1,1)
# The instance variable below keeps track of the remote application # The instance variable below keeps track of the remote application
# that we're sending to. If it's an empty string then we execute # that we're sending to. If it's an empty string then we execute
# the commands locally. # the commands locally.
@app = 'local' @app = 'local'
@mode = 'Ruby' @mode = 'Ruby'
# The instance variable below keeps track of whether we're in the # The instance variable below keeps track of whether we're in the
# middle of executing a command entered via the text. # middle of executing a command entered via the text.
@executing = 0 @executing = 0
# The instance variable below keeps track of the last command executed, # The instance variable below keeps track of the last command executed,
# so it can be re-executed in response to !! commands. # so it can be re-executed in response to !! commands.
@lastCommand = "" @lastCommand = ""
# Create menu bar. Arrange to recreate all the information in the # Create menu bar. Arrange to recreate all the information in the
# applications sub-menu whenever it is cascaded to. # applications sub-menu whenever it is cascaded to.
TkFrame.new(root, 'relief'=>'raised', 'bd'=>2) {|f| TkFrame.new(root, 'relief'=>'raised', 'bd'=>2) {|f|
pack('side'=>'top', 'fill'=>'x') pack('side'=>'top', 'fill'=>'x')
TkMenubutton.new(f, 'text'=>'File', 'underline'=>0) {|mb| TkMenubutton.new(f, 'text'=>'File', 'underline'=>0) {|mb|
TkMenu.new(mb) {|mf| TkMenu.new(mb) {|mf|
mb.menu(mf) mb.menu(mf)
TkMenu.new(mf) {|ma| TkMenu.new(mf) {|ma|
postcommand proc{win.fillAppsMenu ma} postcommand proc{win.fillAppsMenu ma}
mf.add('cascade', 'label'=>'Select Application', mf.add('cascade', 'label'=>'Select Application',
'menu'=>ma, 'underline'=>0) 'menu'=>ma, 'underline'=>0)
} }
add('command', 'label'=>'Quit', add('command', 'label'=>'Quit',
'command'=>proc{root.destroy}, 'underline'=>0) 'command'=>proc{root.destroy}, 'underline'=>0)
} }
pack('side'=>'left') pack('side'=>'left')
} }
} }
# Create text window and scrollbar. # Create text window and scrollbar.
@txt = TkText.new(root, 'relief'=>'sunken', 'bd'=>2, 'setgrid'=>true) { @txt = TkText.new(root, 'relief'=>'sunken', 'bd'=>2, 'setgrid'=>true) {
yscrollbar(TkScrollbar.new(root){pack('side'=>'right', 'fill'=>'y')}) yscrollbar(TkScrollbar.new(root){pack('side'=>'right', 'fill'=>'y')})
@ -60,9 +60,9 @@ class Rmt
@promptEnd = TkTextMark.new(@txt, 'insert') @promptEnd = TkTextMark.new(@txt, 'insert')
# Create a binding to forward commands to the target application, # Create a binding to forward commands to the target application,
# plus modify many of the built-in bindings so that only information # plus modify many of the built-in bindings so that only information
# in the current command can be deleted (can still set the cursor # in the current command can be deleted (can still set the cursor
# earlier in the text and select and insert; just can't delete). # earlier in the text and select and insert; just can't delete).
@txt.bindtags([@txt, TkText, root, 'all']) @txt.bindtags([@txt, TkText, root, 'all'])
@ -151,8 +151,8 @@ class Rmt
w.see('insert') w.see('insert')
end end
# The method below is used to print out a prompt at the # The method below is used to print out a prompt at the
# insertion point (which should be at the beginning of a line # insertion point (which should be at the beginning of a line
# right now). # right now).
def prompt def prompt
@ -162,8 +162,8 @@ class Rmt
@txt.tag_add('bold', "#{@promptEnd.path} linestart", @promptEnd) @txt.tag_add('bold', "#{@promptEnd.path} linestart", @promptEnd)
end end
# The method below executes a command (it takes everything on the # The method below executes a command (it takes everything on the
# current line after the prompt and either sends it to the remote # current line after the prompt and either sends it to the remote
# application or executes it locally, depending on "app". # application or executes it locally, depending on "app".
def invoke def invoke
@ -200,8 +200,8 @@ class Rmt
if complete if complete
@lastCommand = cmd @lastCommand = cmd
begin begin
# msg = Tk.appsend(@app, false, # msg = Tk.appsend(@app, false,
# 'ruby', # 'ruby',
# '"(' + cmd.gsub(/[][$"]/, '\\\\\&') + ').to_s"') # '"(' + cmd.gsub(/[][$"]/, '\\\\\&') + ').to_s"')
msg = Tk.rb_appsend(@app, false, cmd) msg = Tk.rb_appsend(@app, false, cmd)
rescue rescue
@ -218,10 +218,10 @@ class Rmt
end end
# The following method is invoked to change the application that # The following method is invoked to change the application that
# we're talking to. It also updates the prompt for the current # we're talking to. It also updates the prompt for the current
# command, unless we're in the middle of executing a command from # command, unless we're in the middle of executing a command from
# the text item (in which case a new prompt is about to be output # the text item (in which case a new prompt is about to be output
# so there's no need to change the old one). # so there's no need to change the old one).
def newApp(appName, mode) def newApp(appName, mode)
@app = appName @app = appName
@ -236,7 +236,7 @@ class Rmt
end end
# The method below will fill in the applications sub-menu with a list # The method below will fill in the applications sub-menu with a list
# of all the applications that currently exist. # of all the applications that currently exist.
def fillAppsMenu(menu) def fillAppsMenu(menu)
win = self win = self
@ -251,14 +251,14 @@ class Rmt
else else
mode = 'Ruby' mode = 'Ruby'
end end
menu.add('command', 'label'=>format("%s (#{mode}/Tk)", ip), menu.add('command', 'label'=>format("%s (#{mode}/Tk)", ip),
'command'=>proc{win.newApp ip, mode}) 'command'=>proc{win.newApp ip, mode})
rescue rescue
menu.add('command', 'label'=>format("%s (unknown Tk)", ip), menu.add('command', 'label'=>format("%s (unknown Tk)", ip),
'command'=>proc{win.newApp ip, mode}, 'state'=>'disabled') 'command'=>proc{win.newApp ip, mode}, 'state'=>'disabled')
end end
} }
menu.add('command', 'label'=>format("local (Ruby/Tk)"), menu.add('command', 'label'=>format("local (Ruby/Tk)"),
'command'=>proc{win.newApp 'local', 'Ruby'}) 'command'=>proc{win.newApp 'local', 'Ruby'})
end end
end end

Просмотреть файл

@ -2,7 +2,7 @@
# #
# rolodex -- # rolodex --
# This script is a part of Tom LaStrange's rolodex # This script is a part of Tom LaStrange's rolodex
# #
# Copyright (C) 1998 by Takaaki Tateishi <ttate@jaist.ac.jp> # Copyright (C) 1998 by Takaaki Tateishi <ttate@jaist.ac.jp>
# Time-stamp: "03/08/02 06:23:06 nagai" # Time-stamp: "03/08/02 06:23:06 nagai"
# #
@ -17,7 +17,7 @@ def show_help(topic,x=0,y=0)
topic = w topic = w
end end
end end
if( $helpTopics.include?(topic) ) if( $helpTopics.include?(topic) )
msg = $helpTopics[topic] msg = $helpTopics[topic]
else else
@ -81,7 +81,7 @@ class RolodexFrame < TkFrame
def initialize(parent=nil,keys=nil) def initialize(parent=nil,keys=nil)
super(parent,keys) super(parent,keys)
self["relief"] = "flat" self["relief"] = "flat"
@i = [] @i = []
@label = [] @label = []
@entry = [] @entry = []

Просмотреть файл

@ -1,10 +1,10 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# square -- # square --
# This script generates a demo application containing only # This script generates a demo application containing only
# a "square" widget. It's only usable if Tk has been compiled # a "square" widget. It's only usable if Tk has been compiled
# with tkSquare.c and with the -DSQUARE_DEMO compiler switch. # with tkSquare.c and with the -DSQUARE_DEMO compiler switch.
# This demo arranges the following bindings for the widget: # This demo arranges the following bindings for the widget:
# #
# Button-1 press/drag: moves square to mouse # Button-1 press/drag: moves square to mouse
# "a": toggle size animation on/off # "a": toggle size animation on/off
@ -19,7 +19,7 @@ class TkSquare<TkWindow
tk_call 'square', path tk_call 'square', path
rescue rescue
STDERR.print "\nSorry. Your Tk interpreter does not contain " + STDERR.print "\nSorry. Your Tk interpreter does not contain " +
'a "square" demonstration widget.' + 'a "square" demonstration widget.' +
"\n ( See documents included the Tcl/Tk source archive. )\n\n" "\n ( See documents included the Tcl/Tk source archive. )\n\n"
exit exit
end end
@ -53,7 +53,7 @@ def center(x,y)
end end
# The procedures below provide a simple form of animation where # The procedures below provide a simple form of animation where
# the box changes size in a pulsing pattern: larger, smaller, larger, # the box changes size in a pulsing pattern: larger, smaller, larger,
# and so on. # and so on.
$inc = 0 $inc = 0

Просмотреть файл

@ -126,7 +126,7 @@ def _null_binding
end end
private :_null_binding private :_null_binding
def doUpdate def doUpdate
newCmd = $command.to_s.gsub("%%","\"#{$color}\"") newCmd = $command.to_s.gsub("%%","\"#{$color}\"")
eval(newCmd, _null_binding) eval(newCmd, _null_binding)
end end
@ -134,7 +134,7 @@ end
def tc_scaleChanged def tc_scaleChanged
if( $updating.to_i == 1 ) if( $updating.to_i == 1 )
return return
end end
$master = :scale if $master == nil $master = :scale if $master == nil
@ -151,7 +151,7 @@ def tc_scaleChanged
when :cmy when :cmy
$red = (65535 - scale1.get * 65.535).to_i $red = (65535 - scale1.get * 65.535).to_i
$green = (65535 - scale2.get * 65.535).to_i $green = (65535 - scale2.get * 65.535).to_i
$blue = (65535 - scale3.get * 65.535).to_i $blue = (65535 - scale3.get * 65.535).to_i
when :hsb when :hsb
list = hsbToRgb(scale1.get / 1000.0, list = hsbToRgb(scale1.get / 1000.0,
scale2.get / 1000.0, scale2.get / 1000.0,
@ -179,7 +179,7 @@ def tc_setScales
scale1 = $root.middle.middle.scale1 scale1 = $root.middle.middle.scale1
scale2 = $root.middle.middle.scale2 scale2 = $root.middle.middle.scale2
scale3 = $root.middle.middle.scale3 scale3 = $root.middle.middle.scale3
case $colorSpace.value.intern case $colorSpace.value.intern
when :rgb when :rgb
scale1.set($red / 65.535) scale1.set($red / 65.535)
@ -205,7 +205,7 @@ end
def tc_loadNamedColor(name) def tc_loadNamedColor(name)
$name.value = name $name.value = name
$master = :name if $master == nil $master = :name if $master == nil
if name[0,1] != "#" if name[0,1] != "#"
list = TkWinfo.rgb($root.middle.right.swatch,name) list = TkWinfo.rgb($root.middle.right.swatch,name)
$red = list[0] $red = list[0]
$green = list[1] $green = list[1]
@ -239,7 +239,7 @@ def tc_loadNamedColor(name)
$green = $green << shift $green = $green << shift
$blue = $blue << shift $blue = $blue << shift
end end
tc_setScales tc_setScales
$color = format("#%04x%04x%04x",$red,$green,$blue) $color = format("#%04x%04x%04x",$red,$green,$blue)
$root.middle.right.set_color($color) $root.middle.right.set_color($color)
@ -318,7 +318,7 @@ class TkColorMenuFrame<TkFrame
"underline" => "0", "underline" => "0",
"command" => proc{exit} "command" => proc{exit}
} }
# assign File menu to File button # assign File menu to File button
menu @file_menu menu @file_menu
@ -354,7 +354,7 @@ class TkColorBotFrame<TkFrame
self self
end end
end end
# left side frame of middle level # left side frame of middle level
@ -459,7 +459,7 @@ class TkColorMiddleRightFrame<TkFrame
super(parent) super(parent)
@swatch = TkFrame.new(self, "width"=>"2c", "height"=>"5c", @swatch = TkFrame.new(self, "width"=>"2c", "height"=>"5c",
"background"=>$color) "background"=>$color)
@value = TkLabel.new(self, @value = TkLabel.new(self,
"text"=>$color, "text"=>$color,
"width"=>"13", "width"=>"13",
"font"=>"-Adobe-Courier-Medium-R-Normal--*-120-*-*-*-*-*-*") "font"=>"-Adobe-Courier-Medium-R-Normal--*-120-*-*-*-*-*-*")

Просмотреть файл

@ -69,7 +69,7 @@ class CountFrame < TkFrame
def initialize(parent=nil,keys=nil) def initialize(parent=nil,keys=nil)
super(parent,keys) super(parent,keys)
@counter = TkLabel.new(self, @counter = TkLabel.new(self,
'text'=>$time, 'text'=>$time,
'relief'=>'raised') 'relief'=>'raised')
@counter.pack('fill'=>'both') @counter.pack('fill'=>'both')
self self

Просмотреть файл

@ -26,15 +26,15 @@ $RubyTk_WidgetDemo = true
# $demo_dir = File.dirname($0) # $demo_dir = File.dirname($0)
$demo_dir = File.dirname(__FILE__) $demo_dir = File.dirname(__FILE__)
# root # root
$root = TkRoot.new{title "Ruby/Tk Widget Demonstration"} $root = TkRoot.new{title "Ruby/Tk Widget Demonstration"}
# tk # tk
$tk_version = Tk::TK_VERSION $tk_version = Tk::TK_VERSION
$tk_major_ver, $tk_minor_ver = $tk_version.split('.').map{|n| n.to_i} $tk_major_ver, $tk_minor_ver = $tk_version.split('.').map{|n| n.to_i}
$tk_patchlevel = Tk::TK_PATCHLEVEL $tk_patchlevel = Tk::TK_PATCHLEVEL
# tcl_platform # tcl_platform
$tk_platform = TkVarAccess.new('tcl_platform') $tk_platform = TkVarAccess.new('tcl_platform')
# #
@ -104,18 +104,18 @@ $image['print'] = TkPhotoImage.new(:height=>19, :format=>'GIF', :data=><<EOD)
EOD EOD
end end
# #
if $tk_major_ver >= 8 if $tk_major_ver >= 8
$root.add_menubar([[['File', 0], $root.add_menubar([[['File', 0],
['About ... ', proc{aboutBox}, 0, '<F1>'], ['About ... ', proc{aboutBox}, 0, '<F1>'],
'---', '---',
['Quit', proc{exit}, 0, 'Ctrl-Q'] ['Quit', proc{exit}, 0, 'Ctrl-Q']
]]) ]])
else else
TkMenubar.new($root, TkMenubar.new($root,
[[['File', 0], [[['File', 0],
['About ... ', proc{aboutBox}, 0, '<F1>'], ['About ... ', proc{aboutBox}, 0, '<F1>'],
'---', '---',
['Quit', proc{exit}, 0, 'Ctrl-Q'] ['Quit', proc{exit}, 0, 'Ctrl-Q']
]]).pack('side'=>'top', 'fill'=>'x') ]]).pack('side'=>'top', 'fill'=>'x')
end end
@ -135,7 +135,7 @@ TkFrame.new($root){|frame|
}.pack('side'=>'top', 'fill'=>'x') }.pack('side'=>'top', 'fill'=>'x')
=end =end
# #
if $tk_version =~ /^4\.[01]/ if $tk_version =~ /^4\.[01]/
scr = TkScrollbar.new($root, 'orient'=>'vertical') scr = TkScrollbar.new($root, 'orient'=>'vertical')
txt = TkText.new($root) { txt = TkText.new($root) {
@ -151,7 +151,7 @@ if $tk_version =~ /^4\.[01]/
txt.pack('expand'=>'yes', 'fill'=>'both') txt.pack('expand'=>'yes', 'fill'=>'both')
else else
textFrame = TkFrame.new($root) textFrame = TkFrame.new($root)
scr = TkScrollbar.new($root, 'orient'=>'vertical', scr = TkScrollbar.new($root, 'orient'=>'vertical',
'highlightthickness'=>0, 'takefocus'=>1) { 'highlightthickness'=>0, 'takefocus'=>1) {
pack('in'=>textFrame, 'side'=>'right', 'fill'=>'y', 'padx'=>1) pack('in'=>textFrame, 'side'=>'right', 'fill'=>'y', 'padx'=>1)
} }
@ -184,10 +184,10 @@ else
statusfont = 'Helvetica 10' statusfont = 'Helvetica 10'
end end
$statusBarLabel = \ $statusBarLabel = \
TkLabel.new(f, 'text'=>" ", 'relief'=>'sunken', 'bd'=>1, 'anchor'=>'w', TkLabel.new(f, 'text'=>" ", 'relief'=>'sunken', 'bd'=>1, 'anchor'=>'w',
'font'=>statusfont) \ 'font'=>statusfont) \
.pack('side'=>'left', 'padx'=>2, 'expand'=>'yes', 'fill'=>'both') .pack('side'=>'left', 'padx'=>2, 'expand'=>'yes', 'fill'=>'both')
TkLabel.new(f, 'width'=>8, 'relief'=>'sunken', 'bd'=>1, 'anchor'=>'w', TkLabel.new(f, 'width'=>8, 'relief'=>'sunken', 'bd'=>1, 'anchor'=>'w',
'font'=>statusfont) \ 'font'=>statusfont) \
.pack('side'=>'left', 'padx'=>2) .pack('side'=>'left', 'padx'=>2)
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>2) }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>2)
@ -196,7 +196,7 @@ end
# Create a bunch of tags to use in the text widget, such as those for # Create a bunch of tags to use in the text widget, such as those for
# section titles and demo descriptions. Also define the bindings for # section titles and demo descriptions. Also define the bindings for
# tags. # tags.
if $tk_version =~ /^4.*/ if $tk_version =~ /^4.*/
tag_title = TkTextTag.new(txt, 'font'=>'-*-Helvetica-Bold-R-Normal--*-180-*-*-*-*-*-*') tag_title = TkTextTag.new(txt, 'font'=>'-*-Helvetica-Bold-R-Normal--*-180-*-*-*-*-*-*')
else else
@ -210,23 +210,23 @@ end
tag_demospace = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c') tag_demospace = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c')
if TkWinfo.depth($root) == 1 if TkWinfo.depth($root) == 1
tag_demo = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c', tag_demo = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c',
'underline'=>1) 'underline'=>1)
$tag_visited = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c', $tag_visited = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c',
'underline'=>1) 'underline'=>1)
tag_hot = TkTextTag.new(txt, 'background'=>'black', 'foreground'=>'white') tag_hot = TkTextTag.new(txt, 'background'=>'black', 'foreground'=>'white')
else else
tag_demo = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c', tag_demo = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c',
'foreground'=>'blue', 'underline'=>1) 'foreground'=>'blue', 'underline'=>1)
$tag_visited = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c', $tag_visited = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c',
'foreground'=>'#303080', 'underline'=>1) 'foreground'=>'#303080', 'underline'=>1)
# tag_hot = TkTextTag.new(txt, 'relief'=>'raised', 'borderwidth'=>1, # tag_hot = TkTextTag.new(txt, 'relief'=>'raised', 'borderwidth'=>1,
# 'background'=>'SeaGreen3') # 'background'=>'SeaGreen3')
tag_hot = TkTextTag.new(txt, 'borderwidth'=>1, 'foreground'=>'red') tag_hot = TkTextTag.new(txt, 'borderwidth'=>1, 'foreground'=>'red')
end end
#tag_demo.bind('Button-1', proc{invoke txt, txt.index('current')}) #tag_demo.bind('Button-1', proc{invoke txt, txt.index('current')})
tag_demo.bind('ButtonRelease-1', tag_demo.bind('ButtonRelease-1',
proc{|x,y|invoke txt, txt.index("@#{x},#{y}")}, '%x %y') proc{|x,y|invoke txt, txt.index("@#{x},#{y}")}, '%x %y')
lastLine = TkVariable.new("") lastLine = TkVariable.new("")
@ -237,7 +237,7 @@ tag_demo.bind('Enter', proc{|x,y|
showStatus txt, txt.index("@#{x},#{y}") showStatus txt, txt.index("@#{x},#{y}")
}, },
'%x %y') '%x %y')
tag_demo.bind('Leave', tag_demo.bind('Leave',
proc{ proc{
tag_hot.remove('1.0','end') tag_hot.remove('1.0','end')
txt.configure('cursor','xterm') txt.configure('cursor','xterm')
@ -248,10 +248,10 @@ tag_demo.bind('Motion', proc{|x, y|
if newLine.value != lastLine.value if newLine.value != lastLine.value
tag_hot.remove('1.0','end') tag_hot.remove('1.0','end')
lastLine.value = newLine.value lastLine.value = newLine.value
if ( txt.tag_names("@#{x},#{y}").find{|t| if ( txt.tag_names("@#{x},#{y}").find{|t|
t.kind_of?(String) && t =~ /^demo-/ t.kind_of?(String) && t =~ /^demo-/
} ) } )
tag_hot.add(lastLine.value, tag_hot.add(lastLine.value,
"#{lastLine.value} lineend -1 chars") "#{lastLine.value} lineend -1 chars")
end end
end end
@ -273,7 +273,7 @@ demonstration. If you wish, you can edit the code and click the \
with the modified code. \ with the modified code. \
Don't worry about breaking the source code. \ Don't worry about breaking the source code. \
Your modifications are not reflected on the original file. \ Your modifications are not reflected on the original file. \
Please try many kind of changes. Please try many kind of changes.
Some demo scripts require the recent version of Tk library \ Some demo scripts require the recent version of Tk library \
(e.g. Tk8.4 or later) \ (e.g. Tk8.4 or later) \
@ -353,8 +353,8 @@ txt.insert('end', "1. Without scrollbars.\n", tag_demo, "demo-entry1")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "2. With scrollbars.\n", tag_demo, "demo-entry2") txt.insert('end', "2. With scrollbars.\n", tag_demo, "demo-entry2")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', txt.insert('end',
"3. Validated entries and password fields. (if supported)\n", "3. Validated entries and password fields. (if supported)\n",
tag_demo, "demo-entry3") tag_demo, "demo-entry3")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "4. Spin-boxes. (if supported)\n", tag_demo, "demo-spin") txt.insert('end', "4. Spin-boxes. (if supported)\n", tag_demo, "demo-spin")
@ -499,7 +499,7 @@ $showVarsWin = {}
def showVars1(parent, *args) def showVars1(parent, *args)
if $showVarsWin[parent.path] if $showVarsWin[parent.path]
begin begin
$showVarsWin[parent.path].destroy $showVarsWin[parent.path].destroy
rescue rescue
end end
end end
@ -539,7 +539,7 @@ end
def showVars2(parent, *args) def showVars2(parent, *args)
if $showVarsWin[parent.path] if $showVarsWin[parent.path]
begin begin
$showVarsWin[parent.path].destroy $showVarsWin[parent.path].destroy
rescue rescue
end end
end end
@ -548,11 +548,11 @@ def showVars2(parent, *args)
base = TkFrame.new(top).pack(:fill=>:both, :expand=>true) base = TkFrame.new(top).pack(:fill=>:both, :expand=>true)
TkLabelFrame.new(base, :text=>"Variable values:", TkLabelFrame.new(base, :text=>"Variable values:",
:font=>{:family=>'Helvetica', :size=>14}){|f| :font=>{:family=>'Helvetica', :size=>14}){|f|
args.each{|vnam,vbody| args.each{|vnam,vbody|
TkGrid(TkLabel.new(f, :text=>"#{vnam}: ", :anchor=>'w'), TkGrid(TkLabel.new(f, :text=>"#{vnam}: ", :anchor=>'w'),
TkLabel.new(f, :textvariable=>vbody, :anchor=>'w'), TkLabel.new(f, :textvariable=>vbody, :anchor=>'w'),
:padx=>2, :pady=>2, :sticky=>'w') :padx=>2, :pady=>2, :sticky=>'w')
} }
@ -560,7 +560,7 @@ def showVars2(parent, *args)
f.grid_columnconfig(1, :weight=>1) f.grid_columnconfig(1, :weight=>1)
f.grid_rowconfig(100, :weight=>1) f.grid_rowconfig(100, :weight=>1)
} }
TkButton.new(base, :text=>"OK", :width=>8, :default=>:active, TkButton.new(base, :text=>"OK", :width=>8, :default=>:active,
:command=>proc{top.destroy}){|b| :command=>proc{top.destroy}){|b|
top.bind('Return', proc{b.invoke}) top.bind('Return', proc{b.invoke})
top.bind('Escape', proc{b.invoke}) top.bind('Escape', proc{b.invoke})
@ -610,9 +610,9 @@ class Object
def method_missing(id, *args) def method_missing(id, *args)
begin begin
has_top = (top = Thread.current[:TOPLEVEL]) && has_top = (top = Thread.current[:TOPLEVEL]) &&
top.respond_to?(:pseudo_toplevel_evaluable?) && top.respond_to?(:pseudo_toplevel_evaluable?) &&
top.pseudo_toplevel_evaluable? && top.pseudo_toplevel_evaluable? &&
top.respond_to?(id) top.respond_to?(id)
rescue Exception => e rescue Exception => e
has_top = false has_top = false
@ -738,7 +738,7 @@ def showStatus (txt, index)
newcursor = 'xterm' newcursor = 'xterm'
else else
demoname = tag[5..-1] demoname = tag[5..-1]
$statusBarLabel.configure('text', $statusBarLabel.configure('text',
"Run the \"#{demoname}\" sample program") "Run the \"#{demoname}\" sample program")
newcursor = 'hand2' newcursor = 'hand2'
end end
@ -800,9 +800,9 @@ def showCode1(demo)
TkFrame.new($code_window) {|f| TkFrame.new($code_window) {|f|
pack('expand'=>'yes', 'fill'=>'both', 'padx'=>1, 'pady'=>1) pack('expand'=>'yes', 'fill'=>'both', 'padx'=>1, 'pady'=>1)
hs = TkScrollbar.new($code_window, 'highlightthickness'=>0, hs = TkScrollbar.new($code_window, 'highlightthickness'=>0,
'orient'=>'horizontal') 'orient'=>'horizontal')
vs = TkScrollbar.new($code_window, 'highlightthickness'=>0, vs = TkScrollbar.new($code_window, 'highlightthickness'=>0,
'orient'=>'vertical') 'orient'=>'vertical')
$code_text = TkText.new($code_window) {|t| $code_text = TkText.new($code_window) {|t|
height 40 height 40
@ -817,11 +817,11 @@ def showCode1(demo)
vs.command(proc{|*args| $code_text.yview(*args)}) vs.command(proc{|*args| $code_text.yview(*args)})
} }
$code_text.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, $code_text.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0,
'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
vs.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, vs.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1,
'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
# xs.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, # xs.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0,
# 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') # 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
# JKC 2001-07-26: segfaults under 1.7.1 (2001-06-19) [i686-linux] # JKC 2001-07-26: segfaults under 1.7.1 (2001-06-19) [i686-linux]
@ -866,8 +866,8 @@ def showCode2(demo)
if $code_window == nil || TkWinfo.exist?($code_window) == false if $code_window == nil || TkWinfo.exist?($code_window) == false
$code_window = TkToplevel.new(nil) $code_window = TkToplevel.new(nil)
tf = TkFrame.new($code_window) tf = TkFrame.new($code_window)
$code_text = TkText.new(tf, :font=>'Courier 10', :height=>30, $code_text = TkText.new(tf, :font=>'Courier 10', :height=>30,
:wrap=>'word', :bd=>1, :setgrid=>true, :wrap=>'word', :bd=>1, :setgrid=>true,
:highlightthickness=>0, :pady=>2, :padx=>3) :highlightthickness=>0, :pady=>2, :padx=>3)
xscr = TkScrollbar.new(tf, :bd=>1){assign($code_text)} xscr = TkScrollbar.new(tf, :bd=>1){assign($code_text)}
yscr = TkScrollbar.new(tf, :bd=>1){assign($code_text)} yscr = TkScrollbar.new(tf, :bd=>1){assign($code_text)}
@ -890,20 +890,20 @@ def showCode2(demo)
posnum.text = pos posnum.text = pos
} }
b_dis = TkButton.new(bf, :text=>'Dismiss', :default=>:active, b_dis = TkButton.new(bf, :text=>'Dismiss', :default=>:active,
:command=>proc{ :command=>proc{
$code_window.destroy $code_window.destroy
$code_window = nil $code_window = nil
}, },
:image=>$image['delete'], :compound=>:left) :image=>$image['delete'], :compound=>:left)
b_prn = TkButton.new(bf, :text=>'Print Code', b_prn = TkButton.new(bf, :text=>'Print Code',
:command=>proc{printCode($code_text, file)}, :command=>proc{printCode($code_text, file)},
:image=>$image['print'], :compound=>:left) :image=>$image['print'], :compound=>:left)
b_run = TkButton.new(bf, :text=>'Rerun Demo', b_run = TkButton.new(bf, :text=>'Rerun Demo',
:command=>proc{ :command=>proc{
# eval($code_text.get('1.0','end'), _null_binding) # eval($code_text.get('1.0','end'), _null_binding)
eval_samplecode($code_text.get('1.0','end'), '<viewer>') eval_samplecode($code_text.get('1.0','end'), '<viewer>')
}, },
:image=>$image['refresh'], :compound=>:left) :image=>$image['refresh'], :compound=>:left)
TkGrid(lf, 'x', b_run, b_prn, b_dis, :padx=>4, :pady=>[6,4]) TkGrid(lf, 'x', b_run, b_prn, b_dis, :padx=>4, :pady=>[6,4])
@ -979,23 +979,23 @@ def printCode(txt, file)
when 'unix' when 'unix'
msg = `lp -c #{fname}` msg = `lp -c #{fname}`
unless $?.exitstatus == 0 unless $?.exitstatus == 0
Tk.messageBox(:title=>'Print spooling failure', Tk.messageBox(:title=>'Print spooling failure',
:message=>'Print spooling probably failed: ' + msg) :message=>'Print spooling probably failed: ' + msg)
end end
when 'windows' when 'windows'
begin begin
printTextWin32(fname) printTextWin32(fname)
rescue => e rescue => e
Tk.messageBox(:title=>'Print spooling failure', Tk.messageBox(:title=>'Print spooling failure',
:message=>'Print spooling probably failed: ' + :message=>'Print spooling probably failed: ' +
e.message) e.message)
end end
when 'macintosh' when 'macintosh'
Tk.messageBox(:title=>'Operation not Implemented', Tk.messageBox(:title=>'Operation not Implemented',
:message=>'Oops, sorry: not implemented yet!') :message=>'Oops, sorry: not implemented yet!')
else else
Tk.messageBox(:title=>'Operation not Implemented', Tk.messageBox(:title=>'Operation not Implemented',
:message=>'Wow! Unknown platform: ' + :message=>'Wow! Unknown platform: ' +
Tk::TCL_PLATFORM('platform')) Tk::TCL_PLATFORM('platform'))
end end
ensure ensure
@ -1025,7 +1025,7 @@ def printTextWin32(fname)
pcmd.gsub!('%1', fname) pcmd.gsub!('%1', fname)
puts pcmd puts pcmd
cmd = Tk.tk_call('auto_execok', 'start') + ' /min ' + pcmd cmd = Tk.tk_call('auto_execok', 'start') + ' /min ' + pcmd
msg = `#{cmd}` msg = `#{cmd}`
unless $?.exitstatus == 0 unless $?.exitstatus == 0
fail RuntimeError, msg fail RuntimeError, msg
@ -1037,16 +1037,16 @@ end
# Pops up a message box with an "about" message # Pops up a message box with an "about" message
# #
def aboutBox def aboutBox
Tk.messageBox('icon'=>'info', 'type'=>'ok', 'title'=>'About Widget Demo', Tk.messageBox('icon'=>'info', 'type'=>'ok', 'title'=>'About Widget Demo',
'message'=>"Ruby/Tk widget demonstration Ver.1.7.1-en\n\n" + 'message'=>"Ruby/Tk widget demonstration Ver.1.7.1-en\n\n" +
"based on demos of Tk8.1 -- 8.5 " + "based on demos of Tk8.1 -- 8.5 " +
"( Copyright of Tcl/Tk demos:: " + "( Copyright of Tcl/Tk demos:: " +
"(c) 1996-1997 Sun Microsystems, Inc. / " + "(c) 1996-1997 Sun Microsystems, Inc. / " +
"(c) 1997-2000 Ajuba Solutions, Inc. / " + "(c) 1997-2000 Ajuba Solutions, Inc. / " +
"(c) 2001-2007 Donal K. Fellows / " + "(c) 2001-2007 Donal K. Fellows / " +
"(c) 2002-2007 Daniel A. Steffen )\n\n" + "(c) 2002-2007 Daniel A. Steffen )\n\n" +
"Your Ruby & Tk Version ::\n" + "Your Ruby & Tk Version ::\n" +
"Ruby#{RUBY_VERSION}(#{RUBY_RELEASE_DATE})[#{RUBY_PLATFORM}] / Tk#{$tk_patchlevel}#{(Tk::JAPANIZED_TK)? '-jp': ''}\n\n" + "Ruby#{RUBY_VERSION}(#{RUBY_RELEASE_DATE})[#{RUBY_PLATFORM}] / Tk#{$tk_patchlevel}#{(Tk::JAPANIZED_TK)? '-jp': ''}\n\n" +
"Ruby/Tk release date :: tcltklib #{TclTkLib::RELEASE_DATE}; tk #{Tk::RELEASE_DATE}") "Ruby/Tk release date :: tcltklib #{TclTkLib::RELEASE_DATE}; tk #{Tk::RELEASE_DATE}")
end end
@ -1060,11 +1060,11 @@ else
# show the root widget to make it lower then demo windows # show the root widget to make it lower then demo windows
Tk.update Tk.update
end end
ARGV.each{|cmd| ARGV.each{|cmd|
if cmd =~ /(.*).rb/ if cmd =~ /(.*).rb/
cmd = $1 cmd = $1
end end
#eval(IO.readlines("#{[$demo_dir, cmd].join(File::Separator)}.rb").join, #eval(IO.readlines("#{[$demo_dir, cmd].join(File::Separator)}.rb").join,
# _null_binding) # _null_binding)
eval_samplecode(IO.readlines("#{[$demo_dir, cmd].join(File::Separator)}.rb").join, cmd + '.rb') eval_samplecode(IO.readlines("#{[$demo_dir, cmd].join(File::Separator)}.rb").join, cmd + '.rb')
} }

Просмотреть файл

@ -1,11 +1,11 @@
Ruby/Tk widget-demo Ruby/Tk widget-demo
version 1.2 ( 2000/04/08 ) version 1.2 ( 2000/04/08 )
永井@知能.九工大 (nagai@ai.kyutech.ac.jp) 永井@知能.九工大 (nagai@ai.kyutech.ac.jp)
標準配布の Tcl/Tk 拡張パッケージを取り込んだ Ruby (以下 Ruby/Tk と呼びます) 標準配布の Tcl/Tk 拡張パッケージを取り込んだ Ruby (以下 Ruby/Tk と呼びます)
ではTk widget を用いた GUI の作成を行うことができます.実際に GUI を作成 ではTk widget を用いた GUI の作成を行うことができます.実際に GUI を作成
していく場合には様々な実例がサンプルとして存在すると便利なのですがRuby/Tk していく場合には様々な実例がサンプルとして存在すると便利なのですがRuby/Tk
にはそのような適当なサンプルスクリプト集合は存在しませんでした.それに対し, にはそのような適当なサンプルスクリプト集合は存在しませんでした.それに対し,
拡張パッケージの元である Tcl/Tk にはTk widget を用いてどのようなことがで 拡張パッケージの元である Tcl/Tk にはTk widget を用いてどのようなことがで
きるかを示すものとして widget-demo が存在しおりTcl/Tk を用いた GUI の作成 きるかを示すものとして widget-demo が存在しおりTcl/Tk を用いた GUI の作成
@ -34,21 +34,21 @@ Tcl/Tk
でしょうRuby/Tk 版の記述を widget-demo を Tcl/Tk 版の記述に近いものにして でしょうRuby/Tk 版の記述を widget-demo を Tcl/Tk 版の記述に近いものにして
おけばその対比によってRuby/Tk の理解を早めることができると考えられます. おけばその対比によってRuby/Tk の理解を早めることができると考えられます.
一旦 Ruby/Tk での 各 widget の使用方法を習得してしまえばRuby らしいスクリ 一旦 Ruby/Tk での 各 widget の使用方法を習得してしまえばRuby らしいスクリ
プトを作成することは難しくないでしょう本アーカイブのスクリプトはRuby/Tk プトを作成することは難しくないでしょう本アーカイブのスクリプトはRuby/Tk
を最初に習得するまでの踏台として利用していただければ幸いです. を最初に習得するまでの踏台として利用していただければ幸いです.
widget-demo の移植にあたっては,次の方にも移植したスクリプトを提供していただ widget-demo の移植にあたっては,次の方にも移植したスクリプトを提供していただ
きました.ここに感謝の意を表します. きました.ここに感謝の意を表します.
立石JAIST (ttate@jaist.ac.jp) さん 立石JAIST (ttate@jaist.ac.jp) さん
平松祥史 (hiramatu@cdrom.co.jp) さん 平松祥史 (hiramatu@cdrom.co.jp) さん
平松さんによる Ruby/Tk 入門の Web page (http://www.cdrom.co.jp/~hiramatu/) 平松さんによる Ruby/Tk 入門の Web page (http://www.cdrom.co.jp/~hiramatu/)
も Ruby/Tk の習得に有用と思えますので,ぜひご参照ください. も Ruby/Tk の習得に有用と思えますので,ぜひご参照ください.
また,前橋 (maebashi@iij.ad.jp) さんをはじめとしてwidget-demo の移植に際し また,前橋 (maebashi@iij.ad.jp) さんをはじめとしてwidget-demo の移植に際し
て必要となった Ruby の Tk 関連ライブラリ修正について,問題点,バグの指摘をし て必要となった Ruby の Tk 関連ライブラリ修正について,問題点,バグの指摘をし
ていただいた方々にも感謝致します. ていただいた方々にも感謝致します.
そして最後に最大の感謝を Ruby 設計者の まつもと ゆきひろ (matz@netlab.co.jp) そして最後に最大の感謝を Ruby 設計者の まつもと ゆきひろ (matz@netlab.co.jp)
さんに捧げたいと思います. さんに捧げたいと思います.

Просмотреть файл

@ -1,16 +1,16 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# browse -- # browse --
# This script generates a directory browser, which lists the working # This script generates a directory browser, which lists the working
# directory and allow you to open files or subdirectories by # directory and allow you to open files or subdirectories by
# double-clicking. # double-clicking.
require 'tk' require 'tk'
# Create a scrollbar on the right side of the main window and a listbox # Create a scrollbar on the right side of the main window and a listbox
# on the left side. # on the left side.
listbox = TkListbox.new(nil, 'relief'=>'sunken', listbox = TkListbox.new(nil, 'relief'=>'sunken',
'width'=>20, 'height'=>20, 'setgrid'=>'yes') {|l| 'width'=>20, 'height'=>20, 'setgrid'=>'yes') {|l|
TkScrollbar.new(nil, 'command'=>proc{|*args| l.yview *args}) {|s| TkScrollbar.new(nil, 'command'=>proc{|*args| l.yview *args}) {|s|
pack('side'=>'right', 'fill'=>'y') pack('side'=>'right', 'fill'=>'y')
@ -23,10 +23,10 @@ listbox = TkListbox.new(nil, 'relief'=>'sunken',
root = TkRoot.new root = TkRoot.new
root.minsize(1,1) root.minsize(1,1)
# The procedure below is invoked to open a browser on a given file; if the # The procedure below is invoked to open a browser on a given file; if the
# file is a directory then another instance of this program is invoked; if # file is a directory then another instance of this program is invoked; if
# the file is a regular file then the Mx editor is invoked to display # the file is a regular file then the Mx editor is invoked to display
# the file. # the file.
def browse (dir, file) def browse (dir, file)
file = dir + File::Separator + file if dir != '.' file = dir + File::Separator + file if dir != '.'
@ -46,7 +46,7 @@ def browse (dir, file)
end end
end end
# Fill the listbox with a list of all the files in the directory (run # Fill the listbox with a list of all the files in the directory (run
# the "ls" command to get that information). # the "ls" command to get that information).
dir = ARGV[0] ? ARGV[0] : '.' dir = ARGV[0] ? ARGV[0] : '.'
@ -57,7 +57,7 @@ open("|ls -a #{dir}", 'r'){|fid| fid.readlines}.each{|fname|
# Set up bindings for the browser. # Set up bindings for the browser.
Tk.bind_all('Control-c', proc{root.destroy}) Tk.bind_all('Control-c', proc{root.destroy})
listbox.bind('Double-Button-1', listbox.bind('Double-Button-1',
proc{TkSelection.get.each{|f| browse dir, f}}) proc{TkSelection.get.each{|f| browse dir, f}})
Tk.mainloop Tk.mainloop

Просмотреть файл

@ -1,9 +1,9 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# browse -- # browse --
# This script generates a directory browser, which lists the working # This script generates a directory browser, which lists the working
# directory and allow you to open files or subdirectories by # directory and allow you to open files or subdirectories by
# double-clicking. # double-clicking.
require 'tk' require 'tk'
@ -19,9 +19,9 @@ class Browse
title('Browse : ' + dir) title('Browse : ' + dir)
} }
# Create a scrollbar on the right side of the main window and a listbox # Create a scrollbar on the right side of the main window and a listbox
# on the left side. # on the left side.
list = TkListbox.new(base, 'relief'=>'sunken', list = TkListbox.new(base, 'relief'=>'sunken',
'width'=>20, 'height'=>20, 'setgrid'=>'yes') {|l| 'width'=>20, 'height'=>20, 'setgrid'=>'yes') {|l|
TkScrollbar.new(base, 'command'=>proc{|*args| l.yview *args}) {|s| TkScrollbar.new(base, 'command'=>proc{|*args| l.yview *args}) {|s|
pack('side'=>'right', 'fill'=>'y') pack('side'=>'right', 'fill'=>'y')
@ -30,7 +30,7 @@ class Browse
pack('side'=>'left', 'fill'=>'both', 'expand'=>'yes') pack('side'=>'left', 'fill'=>'both', 'expand'=>'yes')
# Fill the listbox with a list of all the files in the directory (run # Fill the listbox with a list of all the files in the directory (run
# the "ls" command to get that information). # the "ls" command to get that information).
open("|ls -a #{dir}", 'r'){|fid| fid.readlines}.each{|fname| open("|ls -a #{dir}", 'r'){|fid| fid.readlines}.each{|fname|
l.insert('end', fname.chomp) l.insert('end', fname.chomp)
@ -44,14 +44,14 @@ class Browse
Browse::BROWSE_WIN_COUNTER.to_i - 1 Browse::BROWSE_WIN_COUNTER.to_i - 1
}) })
base.bind('Control-c', proc{base.destroy}) base.bind('Control-c', proc{base.destroy})
list.bind('Double-Button-1', list.bind('Double-Button-1',
proc{TkSelection.get.each{|f| self.browse dir, f}}) proc{TkSelection.get.each{|f| self.browse dir, f}})
end end
# The method below is invoked to open a browser on a given file; if the # The method below is invoked to open a browser on a given file; if the
# file is a directory then another instance of this program is invoked; if # file is a directory then another instance of this program is invoked; if
# the file is a regular file then the Mx editor is invoked to display # the file is a regular file then the Mx editor is invoked to display
# the file. # the file.
def browse (dir, file) def browse (dir, file)
file = dir + File::Separator + file if dir != '.' file = dir + File::Separator + file if dir != '.'
type = File.ftype(file) type = File.ftype(file)

Просмотреть файл

@ -28,7 +28,7 @@ MODIFICATIONS.
GOVERNMENT USE: If you are acquiring this software on behalf of the GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights" U.S. government, the Government shall have only "Restricted Rights"
in the software and related documentation as defined in the Federal in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the software shall be classified as "Commercial Computer Software" and the

Просмотреть файл

@ -28,7 +28,7 @@ MODIFICATIONS.
GOVERNMENT USE: If you are acquiring this software on behalf of the GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights" U.S. government, the Government shall have only "Restricted Rights"
in the software and related documentation as defined in the Federal in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the software shall be classified as "Commercial Computer Software" and the

Просмотреть файл

@ -164,9 +164,9 @@ class Xsettings
# #
bell = TkFrame.new(@root, 'relief'=>'raised', 'borderwidth'=>2) bell = TkFrame.new(@root, 'relief'=>'raised', 'borderwidth'=>2)
l = TkLabel.new(bell, 'text'=>'Bell Settings') l = TkLabel.new(bell, 'text'=>'Bell Settings')
@w_bellvol = TkScale.new(bell, 'from'=>0, 'to'=>100, 'length'=>200, @w_bellvol = TkScale.new(bell, 'from'=>0, 'to'=>100, 'length'=>200,
'tickinterval'=>20, 'orient'=>'horizontal', 'tickinterval'=>20, 'orient'=>'horizontal',
'label'=>"Volume (%)") 'label'=>"Volume (%)")
f = TkFrame.new(bell) f = TkFrame.new(bell)
@w_bellpit = LabelEntry.new(f, "Pitch (Hz)", 6) @w_bellpit = LabelEntry.new(f, "Pitch (Hz)", 6)
@ -180,13 +180,13 @@ class Xsettings
# #
# Keyboard settings # Keyboard settings
# #
kbdonoff = nil kbdonoff = nil
kbdcli = nil kbdcli = nil
kbd = TkFrame.new(@root, 'relief'=>'raised', 'borderwidth'=>2) kbd = TkFrame.new(@root, 'relief'=>'raised', 'borderwidth'=>2)
l = TkLabel.new(kbd, 'text'=>'Keyboard Repeat Settings') l = TkLabel.new(kbd, 'text'=>'Keyboard Repeat Settings')
f = TkFrame.new(kbd) f = TkFrame.new(kbd)
@w_kbdonoff = TkCheckButton.new(f, 'text'=>'On', 'relief'=>'flat', @w_kbdonoff = TkCheckButton.new(f, 'text'=>'On', 'relief'=>'flat',
'onvalue'=>'on', 'offvalue'=>'off', 'onvalue'=>'on', 'offvalue'=>'off',
'variable'=>@w_kbdrep ) { 'variable'=>@w_kbdrep ) {
def self.set(value) def self.set(value)
@ -198,8 +198,8 @@ class Xsettings
end end
pack('side'=>'left', 'expand'=>'yes', 'fill'=>'both') pack('side'=>'left', 'expand'=>'yes', 'fill'=>'both')
} }
@w_kbdcli = TkScale.new(f, 'from'=>0, 'to'=>100, 'length'=>200, @w_kbdcli = TkScale.new(f, 'from'=>0, 'to'=>100, 'length'=>200,
'tickinterval'=>20, 'orient'=>'horizontal', 'tickinterval'=>20, 'orient'=>'horizontal',
'label'=>'Click Volume (%)') 'label'=>'Click Volume (%)')
@w_kbdcli.pack('side'=>'left', 'expand'=>'yes') @w_kbdcli.pack('side'=>'left', 'expand'=>'yes')
l.pack('side'=>'top', 'expand'=>'yes') l.pack('side'=>'top', 'expand'=>'yes')
@ -225,9 +225,9 @@ class Xsettings
l = TkLabel.new(screen, 'text'=>'Screen-saver Settings') l = TkLabel.new(screen, 'text'=>'Screen-saver Settings')
f = TkFrame.new(screen) f = TkFrame.new(screen)
ff1 = TkFrame.new(f) ff1 = TkFrame.new(f)
[ @w_screenblank = TkRadioButton.new(ff1, 'text'=>'Blank', [ @w_screenblank = TkRadioButton.new(ff1, 'text'=>'Blank',
'relief'=>'flat', 'relief'=>'flat',
'variable'=>@w_screenbla, 'variable'=>@w_screenbla,
'value'=>'blank') { 'value'=>'blank') {
def self.set(value) def self.set(value)
if value == 'blank' if value == 'blank'
@ -236,10 +236,10 @@ class Xsettings
self.deselect self.deselect
end end
end end
}, },
@w_screenpat = TkRadioButton.new(ff1, 'text'=>'Pattern', @w_screenpat = TkRadioButton.new(ff1, 'text'=>'Pattern',
'relief'=>'flat', 'relief'=>'flat',
'variable'=>@w_screenbla, 'variable'=>@w_screenbla,
'value'=>'noblank') { 'value'=>'noblank') {
def self.set(value) def self.set(value)
if value != 'blank' if value != 'blank'
@ -252,7 +252,7 @@ class Xsettings
].each {|w| w.pack('side'=>'top', 'pady'=>2, 'anchor'=>'w') } ].each {|w| w.pack('side'=>'top', 'pady'=>2, 'anchor'=>'w') }
ff2 = TkFrame.new(f) ff2 = TkFrame.new(f)
[ @w_screentim = LabelEntry.new(ff2, 'Timeout (s)', 5), [ @w_screentim = LabelEntry.new(ff2, 'Timeout (s)', 5),
@w_screencyc = LabelEntry.new(ff2, 'Cycle (s)', 5) ].each{|w| @w_screencyc = LabelEntry.new(ff2, 'Cycle (s)', 5) ].each{|w|
w.pack('side'=>'top', 'pady'=>2, 'anchor'=>'e') w.pack('side'=>'top', 'pady'=>2, 'anchor'=>'e')
} }

Просмотреть файл

@ -135,8 +135,8 @@ class Xsettings
def initialize(parent, text, length, range=[]) def initialize(parent, text, length, range=[])
@frame = TkFrame.new(parent) @frame = TkFrame.new(parent)
TkLabel.new(@frame, 'text'=>text).pack('side'=>'left') TkLabel.new(@frame, 'text'=>text).pack('side'=>'left')
if range.size > 0 if range.size > 0
@entry = TkSpinbox.new(@frame, 'width'=>length, 'relief'=>'sunken', @entry = TkSpinbox.new(@frame, 'width'=>length, 'relief'=>'sunken',
'from'=>range[0], 'to'=>range[1]) 'from'=>range[0], 'to'=>range[1])
else else
@entry = TkEntry.new(@frame, 'width'=>length, 'relief'=>'sunken') @entry = TkEntry.new(@frame, 'width'=>length, 'relief'=>'sunken')
@ -165,16 +165,16 @@ class Xsettings
# Buttons # Buttons
# #
btn_frame = TkFrame.new(@root) btn_frame = TkFrame.new(@root)
buttons = [ buttons = [
@btn_OK = TkButton.new(btn_frame, 'command'=>proc{win.ok}, @btn_OK = TkButton.new(btn_frame, 'command'=>proc{win.ok},
'default'=>'active', 'text'=>'了解'), 'default'=>'active', 'text'=>'了解'),
@btn_APPLY = TkButton.new(btn_frame, 'command'=>proc{win.writesettings}, @btn_APPLY = TkButton.new(btn_frame, 'command'=>proc{win.writesettings},
'default'=>'normal', 'text'=>'適用', 'default'=>'normal', 'text'=>'適用',
'state'=>'disabled'), 'state'=>'disabled'),
@btn_CANCEL = TkButton.new(btn_frame, 'command'=>proc{win.cancel}, @btn_CANCEL = TkButton.new(btn_frame, 'command'=>proc{win.cancel},
'default'=>'normal', 'text'=>'取消', 'default'=>'normal', 'text'=>'取消',
'state'=>'disabled'), 'state'=>'disabled'),
@btn_QUIT = TkButton.new(btn_frame, 'command'=>proc{win.quit}, @btn_QUIT = TkButton.new(btn_frame, 'command'=>proc{win.quit},
'default'=>'normal', 'text'=>'中止') 'default'=>'normal', 'text'=>'中止')
] ]
buttons.each{|b| b.pack('side'=>'left', 'expand'=>'yes', 'pady'=>5) } buttons.each{|b| b.pack('side'=>'left', 'expand'=>'yes', 'pady'=>5) }
@ -202,10 +202,10 @@ class Xsettings
# #
# Bell settings # Bell settings
# #
bell = TkLabelframe.new(@root, 'text'=>'ベル設定', bell = TkLabelframe.new(@root, 'text'=>'ベル設定',
'padx'=>'1.5m', 'pady'=>'1.5m') 'padx'=>'1.5m', 'pady'=>'1.5m')
@w_bellvol = TkScale.new(bell, 'from'=>0, 'to'=>100, 'length'=>200, @w_bellvol = TkScale.new(bell, 'from'=>0, 'to'=>100, 'length'=>200,
'tickinterval'=>20, 'orient'=>'horizontal', 'tickinterval'=>20, 'orient'=>'horizontal',
'label'=>"音量 (%)") 'label'=>"音量 (%)")
f = TkFrame.new(bell) f = TkFrame.new(bell)
@ -219,14 +219,14 @@ class Xsettings
# #
# Keyboard settings # Keyboard settings
# #
kbdonoff = nil kbdonoff = nil
kbdcli = nil kbdcli = nil
kbd = TkLabelframe.new(@root, 'text'=>'キーボードリピート設定', kbd = TkLabelframe.new(@root, 'text'=>'キーボードリピート設定',
'padx'=>'1.5m', 'pady'=>'1.5m') 'padx'=>'1.5m', 'pady'=>'1.5m')
f = TkFrame.new(kbd) f = TkFrame.new(kbd)
@w_kbdonoff = TkCheckButton.new(f, 'text'=>'クリック音あり', @w_kbdonoff = TkCheckButton.new(f, 'text'=>'クリック音あり',
'relief'=>'flat', 'relief'=>'flat',
'onvalue'=>'on', 'offvalue'=>'off', 'onvalue'=>'on', 'offvalue'=>'off',
'variable'=>@w_kbdrep ) { 'variable'=>@w_kbdrep ) {
def self.set(value) def self.set(value)
@ -238,17 +238,17 @@ class Xsettings
end end
pack('side'=>'left', 'expand'=>'yes', 'fill'=>'x', 'padx'=>[0, '1m']) pack('side'=>'left', 'expand'=>'yes', 'fill'=>'x', 'padx'=>[0, '1m'])
} }
@w_kbdcli = TkScale.new(f, 'from'=>0, 'to'=>100, 'length'=>200, @w_kbdcli = TkScale.new(f, 'from'=>0, 'to'=>100, 'length'=>200,
'tickinterval'=>20, 'orient'=>'horizontal', 'tickinterval'=>20, 'orient'=>'horizontal',
'label'=>'クリック音量 (%)') 'label'=>'クリック音量 (%)')
@w_kbdcli.pack('side'=>'left', 'expand'=>'yes', @w_kbdcli.pack('side'=>'left', 'expand'=>'yes',
'fill'=>'x', 'padx'=>['1m', 0]) 'fill'=>'x', 'padx'=>['1m', 0])
f.pack('side'=>'top', 'expand'=>'yes', 'pady'=>2, 'fill'=>'x') f.pack('side'=>'top', 'expand'=>'yes', 'pady'=>2, 'fill'=>'x')
# #
# Mouse settings # Mouse settings
# #
mouse = TkLabelframe.new(@root, 'text'=>'マウス設定', mouse = TkLabelframe.new(@root, 'text'=>'マウス設定',
'padx'=>'1.5m', 'pady'=>'1.5m') 'padx'=>'1.5m', 'pady'=>'1.5m')
f = TkFrame.new(mouse) f = TkFrame.new(mouse)
@w_mouseacc = LabelEntry.new(f, '加速量', 5) @w_mouseacc = LabelEntry.new(f, '加速量', 5)
@ -260,11 +260,11 @@ class Xsettings
# #
# Screen Saver settings # Screen Saver settings
# #
screen = TkLabelframe.new(@root, 'text'=>'スクリーンセーバ設定', screen = TkLabelframe.new(@root, 'text'=>'スクリーンセーバ設定',
'padx'=>'1.5m', 'pady'=>'1.5m') 'padx'=>'1.5m', 'pady'=>'1.5m')
@w_screenblank = TkRadioButton.new(screen, 'text'=>'ブランク表示', @w_screenblank = TkRadioButton.new(screen, 'text'=>'ブランク表示',
'relief'=>'flat', 'anchor'=>'w', 'relief'=>'flat', 'anchor'=>'w',
'variable'=>@w_screenbla, 'variable'=>@w_screenbla,
'value'=>'blank') { 'value'=>'blank') {
def self.set(value) def self.set(value)
if value == 'blank' if value == 'blank'
@ -275,9 +275,9 @@ class Xsettings
end end
} }
@w_screenpat = TkRadioButton.new(screen, 'text'=>'パターン表示', @w_screenpat = TkRadioButton.new(screen, 'text'=>'パターン表示',
'relief'=>'flat', 'anchor'=>'w', 'relief'=>'flat', 'anchor'=>'w',
'variable'=>@w_screenbla, 'variable'=>@w_screenbla,
'value'=>'noblank') { 'value'=>'noblank') {
def self.set(value) def self.set(value)
if value != 'blank' if value != 'blank'
@ -299,7 +299,7 @@ class Xsettings
# Main window # Main window
# #
param = { param = {
'side'=>'top', 'fill'=>'both', 'expand'=>'yes', 'side'=>'top', 'fill'=>'both', 'expand'=>'yes',
'padx'=>'1m', 'pady'=>'1m' 'padx'=>'1m', 'pady'=>'1m'
} }
btn_frame.pack('side'=>'top', 'fill'=>'both') btn_frame.pack('side'=>'top', 'fill'=>'both')

Просмотреть файл

@ -1,9 +1,9 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# rmt -- # rmt --
# This script implements a simple remote-control mechanism for # This script implements a simple remote-control mechanism for
# Tk applications. It allows you to select an application and # Tk applications. It allows you to select an application and
# then type commands to that application. # then type commands to that application.
require 'tk' require 'tk'
@ -17,41 +17,41 @@ class Rmt
root = TkWinfo.toplevel(parent) root = TkWinfo.toplevel(parent)
root.minsize(1,1) root.minsize(1,1)
# The instance variable below keeps track of the remote application # The instance variable below keeps track of the remote application
# that we're sending to. If it's an empty string then we execute # that we're sending to. If it's an empty string then we execute
# the commands locally. # the commands locally.
@app = 'local' @app = 'local'
@mode = 'Ruby' @mode = 'Ruby'
# The instance variable below keeps track of whether we're in the # The instance variable below keeps track of whether we're in the
# middle of executing a command entered via the text. # middle of executing a command entered via the text.
@executing = 0 @executing = 0
# The instance variable below keeps track of the last command executed, # The instance variable below keeps track of the last command executed,
# so it can be re-executed in response to !! commands. # so it can be re-executed in response to !! commands.
@lastCommand = "" @lastCommand = ""
# Create menu bar. Arrange to recreate all the information in the # Create menu bar. Arrange to recreate all the information in the
# applications sub-menu whenever it is cascaded to. # applications sub-menu whenever it is cascaded to.
TkFrame.new(root, 'relief'=>'raised', 'bd'=>2) {|f| TkFrame.new(root, 'relief'=>'raised', 'bd'=>2) {|f|
pack('side'=>'top', 'fill'=>'x') pack('side'=>'top', 'fill'=>'x')
TkMenubutton.new(f, 'text'=>'File', 'underline'=>0) {|mb| TkMenubutton.new(f, 'text'=>'File', 'underline'=>0) {|mb|
TkMenu.new(mb) {|mf| TkMenu.new(mb) {|mf|
mb.menu(mf) mb.menu(mf)
TkMenu.new(mf) {|ma| TkMenu.new(mf) {|ma|
postcommand proc{win.fillAppsMenu ma} postcommand proc{win.fillAppsMenu ma}
mf.add('cascade', 'label'=>'Select Application', mf.add('cascade', 'label'=>'Select Application',
'menu'=>ma, 'underline'=>0) 'menu'=>ma, 'underline'=>0)
} }
add('command', 'label'=>'Quit', add('command', 'label'=>'Quit',
'command'=>proc{root.destroy}, 'underline'=>0) 'command'=>proc{root.destroy}, 'underline'=>0)
} }
pack('side'=>'left') pack('side'=>'left')
} }
} }
# Create text window and scrollbar. # Create text window and scrollbar.
@txt = TkText.new(root, 'relief'=>'sunken', 'bd'=>2, 'setgrid'=>true) { @txt = TkText.new(root, 'relief'=>'sunken', 'bd'=>2, 'setgrid'=>true) {
yscrollbar(TkScrollbar.new(root){pack('side'=>'right', 'fill'=>'y')}) yscrollbar(TkScrollbar.new(root){pack('side'=>'right', 'fill'=>'y')})
@ -60,9 +60,9 @@ class Rmt
@promptEnd = TkTextMark.new(@txt, 'insert') @promptEnd = TkTextMark.new(@txt, 'insert')
# Create a binding to forward commands to the target application, # Create a binding to forward commands to the target application,
# plus modify many of the built-in bindings so that only information # plus modify many of the built-in bindings so that only information
# in the current command can be deleted (can still set the cursor # in the current command can be deleted (can still set the cursor
# earlier in the text and select and insert; just can't delete). # earlier in the text and select and insert; just can't delete).
@txt.bindtags([@txt, TkText, root, 'all']) @txt.bindtags([@txt, TkText, root, 'all'])
@ -151,8 +151,8 @@ class Rmt
w.see('insert') w.see('insert')
end end
# The method below is used to print out a prompt at the # The method below is used to print out a prompt at the
# insertion point (which should be at the beginning of a line # insertion point (which should be at the beginning of a line
# right now). # right now).
def prompt def prompt
@ -162,8 +162,8 @@ class Rmt
@txt.tag_add('bold', "#{@promptEnd.path} linestart", @promptEnd) @txt.tag_add('bold', "#{@promptEnd.path} linestart", @promptEnd)
end end
# The method below executes a command (it takes everything on the # The method below executes a command (it takes everything on the
# current line after the prompt and either sends it to the remote # current line after the prompt and either sends it to the remote
# application or executes it locally, depending on "app". # application or executes it locally, depending on "app".
def invoke def invoke
@ -200,8 +200,8 @@ class Rmt
if complete if complete
@lastCommand = cmd @lastCommand = cmd
begin begin
# msg = Tk.appsend(@app, false, # msg = Tk.appsend(@app, false,
# 'ruby', # 'ruby',
# '"(' + cmd.gsub(/[][$"]/, '\\\\\&') + ').to_s"') # '"(' + cmd.gsub(/[][$"]/, '\\\\\&') + ').to_s"')
msg = Tk.rb_appsend(@app, false, cmd) msg = Tk.rb_appsend(@app, false, cmd)
rescue rescue
@ -218,10 +218,10 @@ class Rmt
end end
# The following method is invoked to change the application that # The following method is invoked to change the application that
# we're talking to. It also updates the prompt for the current # we're talking to. It also updates the prompt for the current
# command, unless we're in the middle of executing a command from # command, unless we're in the middle of executing a command from
# the text item (in which case a new prompt is about to be output # the text item (in which case a new prompt is about to be output
# so there's no need to change the old one). # so there's no need to change the old one).
def newApp(appName, mode) def newApp(appName, mode)
@app = appName @app = appName
@ -236,7 +236,7 @@ class Rmt
end end
# The method below will fill in the applications sub-menu with a list # The method below will fill in the applications sub-menu with a list
# of all the applications that currently exist. # of all the applications that currently exist.
def fillAppsMenu(menu) def fillAppsMenu(menu)
win = self win = self
@ -251,14 +251,14 @@ class Rmt
else else
mode = 'Ruby' mode = 'Ruby'
end end
menu.add('command', 'label'=>format("%s (#{mode}/Tk)", ip), menu.add('command', 'label'=>format("%s (#{mode}/Tk)", ip),
'command'=>proc{win.newApp ip, mode}) 'command'=>proc{win.newApp ip, mode})
rescue rescue
menu.add('command', 'label'=>format("%s (unknown Tk)", ip), menu.add('command', 'label'=>format("%s (unknown Tk)", ip),
'command'=>proc{win.newApp ip, mode}, 'state'=>'disabled') 'command'=>proc{win.newApp ip, mode}, 'state'=>'disabled')
end end
} }
menu.add('command', 'label'=>format("local (Ruby/Tk)"), menu.add('command', 'label'=>format("local (Ruby/Tk)"),
'command'=>proc{win.newApp 'local', 'Ruby'}) 'command'=>proc{win.newApp 'local', 'Ruby'})
end end
end end

Просмотреть файл

@ -2,7 +2,7 @@
# #
# rolodex -- # rolodex --
# This script is a part of Tom LaStrange's rolodex # This script is a part of Tom LaStrange's rolodex
# #
# Copyright (C) 1998 by Takaaki Tateishi <ttate@jaist.ac.jp> # Copyright (C) 1998 by Takaaki Tateishi <ttate@jaist.ac.jp>
# Time-stamp: "03/08/02 12:45:21 nagai" # Time-stamp: "03/08/02 12:45:21 nagai"
# #
@ -17,7 +17,7 @@ def show_help(topic,x=0,y=0)
topic = w topic = w
end end
end end
if( $helpTopics.include?(topic) ) if( $helpTopics.include?(topic) )
msg = $helpTopics[topic] msg = $helpTopics[topic]
else else
@ -81,7 +81,7 @@ class RolodexFrame < TkFrame
def initialize(parent=nil,keys=nil) def initialize(parent=nil,keys=nil)
super(parent,keys) super(parent,keys)
self["relief"] = "flat" self["relief"] = "flat"
@i = [] @i = []
@label = [] @label = []
@entry = [] @entry = []

Просмотреть файл

@ -3,7 +3,7 @@
# #
# rolodex -- # rolodex --
# このスクリプトは Tom LaStrange の rolodex の一部です。 # このスクリプトは Tom LaStrange の rolodex の一部です。
# #
# Copyright (C) 1998 by Takaaki Tateishi <ttate@jaist.ac.jp> # Copyright (C) 1998 by Takaaki Tateishi <ttate@jaist.ac.jp>
# Time-stamp: "04/04/09 00:32:12 nagai" # Time-stamp: "04/04/09 00:32:12 nagai"
# #
@ -20,7 +20,7 @@ def show_help(topic,x=0,y=0)
end end
end end
end end
if( $helpTopics.include?(topic) ) if( $helpTopics.include?(topic) )
msg = $helpTopics[topic] msg = $helpTopics[topic]
else else

Просмотреть файл

@ -1,10 +1,10 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# square -- # square --
# This script generates a demo application containing only # This script generates a demo application containing only
# a "square" widget. It's only usable if Tk has been compiled # a "square" widget. It's only usable if Tk has been compiled
# with tkSquare.c and with the -DSQUARE_DEMO compiler switch. # with tkSquare.c and with the -DSQUARE_DEMO compiler switch.
# This demo arranges the following bindings for the widget: # This demo arranges the following bindings for the widget:
# #
# Button-1 press/drag: moves square to mouse # Button-1 press/drag: moves square to mouse
# "a": toggle size animation on/off # "a": toggle size animation on/off
@ -19,7 +19,7 @@ class TkSquare<TkWindow
tk_call 'square', path tk_call 'square', path
rescue rescue
STDERR.print "\nSorry. Your Tk interpreter does not contain " + STDERR.print "\nSorry. Your Tk interpreter does not contain " +
'a "square" demonstration widget.' + 'a "square" demonstration widget.' +
"\n ( See documents included the Tcl/Tk source archive. )\n\n" "\n ( See documents included the Tcl/Tk source archive. )\n\n"
exit exit
end end
@ -53,7 +53,7 @@ def center(x,y)
end end
# The procedures below provide a simple form of animation where # The procedures below provide a simple form of animation where
# the box changes size in a pulsing pattern: larger, smaller, larger, # the box changes size in a pulsing pattern: larger, smaller, larger,
# and so on. # and so on.
$inc = 0 $inc = 0

Просмотреть файл

@ -130,7 +130,7 @@ def _null_binding
end end
private :_null_binding private :_null_binding
def doUpdate def doUpdate
newCmd = $command.to_s.gsub("%%","\"#{$color}\"") newCmd = $command.to_s.gsub("%%","\"#{$color}\"")
eval(newCmd, _null_binding) eval(newCmd, _null_binding)
end end
@ -138,7 +138,7 @@ end
def tc_scaleChanged def tc_scaleChanged
if( $updating.to_i == 1 ) if( $updating.to_i == 1 )
return return
end end
$master = :scale if $master == nil $master = :scale if $master == nil
@ -155,7 +155,7 @@ def tc_scaleChanged
when :cmy when :cmy
$red = (65535 - scale1.get * 65.535).to_i $red = (65535 - scale1.get * 65.535).to_i
$green = (65535 - scale2.get * 65.535).to_i $green = (65535 - scale2.get * 65.535).to_i
$blue = (65535 - scale3.get * 65.535).to_i $blue = (65535 - scale3.get * 65.535).to_i
when :hsb when :hsb
list = hsbToRgb(scale1.get / 1000.0, list = hsbToRgb(scale1.get / 1000.0,
scale2.get / 1000.0, scale2.get / 1000.0,
@ -183,7 +183,7 @@ def tc_setScales
scale1 = $root.middle.middle.scale1 scale1 = $root.middle.middle.scale1
scale2 = $root.middle.middle.scale2 scale2 = $root.middle.middle.scale2
scale3 = $root.middle.middle.scale3 scale3 = $root.middle.middle.scale3
case $colorSpace.value.intern case $colorSpace.value.intern
when :rgb when :rgb
scale1.set($red / 65.535) scale1.set($red / 65.535)
@ -209,7 +209,7 @@ end
def tc_loadNamedColor(name) def tc_loadNamedColor(name)
$name.value = name $name.value = name
$master = :name if $master == nil $master = :name if $master == nil
if name[0,1] != "#" if name[0,1] != "#"
list = TkWinfo.rgb($root.middle.right.swatch,name) list = TkWinfo.rgb($root.middle.right.swatch,name)
$red = list[0] $red = list[0]
$green = list[1] $green = list[1]
@ -243,7 +243,7 @@ def tc_loadNamedColor(name)
$green = $green << shift $green = $green << shift
$blue = $blue << shift $blue = $blue << shift
end end
tc_setScales tc_setScales
$color = format("#%04x%04x%04x",$red,$green,$blue) $color = format("#%04x%04x%04x",$red,$green,$blue)
$root.middle.right.set_color($color) $root.middle.right.set_color($color)
@ -325,7 +325,7 @@ class TkColorMenuFrame<TkFrame
"underline" => "0", "underline" => "0",
"command" => proc{exit} "command" => proc{exit}
} }
# FileメニューとFileボタンを関連付ける # FileメニューとFileボタンを関連付ける
menu @file_menu menu @file_menu
@ -361,7 +361,7 @@ class TkColorBotFrame<TkFrame
self self
end end
end end
# 中段左のフレーム # 中段左のフレーム
@ -467,7 +467,7 @@ class TkColorMiddleRightFrame<TkFrame
super(parent) super(parent)
@swatch = TkFrame.new(self, "width"=>"2c", "height"=>"5c", @swatch = TkFrame.new(self, "width"=>"2c", "height"=>"5c",
"background"=>$color) "background"=>$color)
@value = TkLabel.new(self, @value = TkLabel.new(self,
"text"=>$color, "text"=>$color,
"width"=>"13", "width"=>"13",
"font"=>"-Adobe-Courier-Medium-R-Normal--*-120-*-*-*-*-*-*") "font"=>"-Adobe-Courier-Medium-R-Normal--*-120-*-*-*-*-*-*")

Просмотреть файл

@ -69,7 +69,7 @@ class CountFrame < TkFrame
def initialize(parent=nil,keys=nil) def initialize(parent=nil,keys=nil)
super(parent,keys) super(parent,keys)
@counter = TkLabel.new(self, @counter = TkLabel.new(self,
'text'=>$time, 'text'=>$time,
'relief'=>'raised') 'relief'=>'raised')
@counter.pack('fill'=>'both') @counter.pack('fill'=>'both')
self self

Просмотреть файл

@ -125,16 +125,16 @@ end
# メニュー設定 # メニュー設定
if $tk_major_ver >= 8 if $tk_major_ver >= 8
$root.add_menubar([[['File', 0], $root.add_menubar([[['File', 0],
['About ... ', proc{aboutBox}, 0, '<F1>'], ['About ... ', proc{aboutBox}, 0, '<F1>'],
'---', '---',
['Quit', proc{exit}, 0, 'Ctrl-Q'] ['Quit', proc{exit}, 0, 'Ctrl-Q']
]]) ]])
else else
TkMenubar.new($root, TkMenubar.new($root,
[[['File', 0], [[['File', 0],
['About ... ', proc{aboutBox}, 0, '<F1>'], ['About ... ', proc{aboutBox}, 0, '<F1>'],
'---', '---',
['Quit', proc{exit}, 0, 'Ctrl-Q'] ['Quit', proc{exit}, 0, 'Ctrl-Q']
]]).pack('side'=>'top', 'fill'=>'x') ]]).pack('side'=>'top', 'fill'=>'x')
end end
@ -171,7 +171,7 @@ if $tk_version =~ /^4\.[01]/
txt.pack('expand'=>'yes', 'fill'=>'both') txt.pack('expand'=>'yes', 'fill'=>'both')
else else
textFrame = TkFrame.new($root) textFrame = TkFrame.new($root)
scr = TkScrollbar.new($root, 'orient'=>'vertical', scr = TkScrollbar.new($root, 'orient'=>'vertical',
'highlightthickness'=>0, 'takefocus'=>1) { 'highlightthickness'=>0, 'takefocus'=>1) {
pack('in'=>textFrame, 'side'=>'right', 'fill'=>'y', 'padx'=>1) pack('in'=>textFrame, 'side'=>'right', 'fill'=>'y', 'padx'=>1)
} }
@ -206,10 +206,10 @@ else
statusfont = 'Helvetica 10' statusfont = 'Helvetica 10'
end end
$statusBarLabel = \ $statusBarLabel = \
TkLabel.new(f, 'text'=>" ", 'relief'=>'sunken', 'bd'=>1, 'anchor'=>'w', TkLabel.new(f, 'text'=>" ", 'relief'=>'sunken', 'bd'=>1, 'anchor'=>'w',
'font'=>statusfont) \ 'font'=>statusfont) \
.pack('side'=>'left', 'padx'=>2, 'expand'=>'yes', 'fill'=>'both') .pack('side'=>'left', 'padx'=>2, 'expand'=>'yes', 'fill'=>'both')
TkLabel.new(f, 'width'=>8, 'relief'=>'sunken', 'bd'=>1, 'anchor'=>'w', TkLabel.new(f, 'width'=>8, 'relief'=>'sunken', 'bd'=>1, 'anchor'=>'w',
'font'=>statusfont) \ 'font'=>statusfont) \
.pack('side'=>'left', 'padx'=>2) .pack('side'=>'left', 'padx'=>2)
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>2) }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>2)
@ -228,23 +228,23 @@ tag_middle = TkTextTag.new(txt, 'font'=>$kanji_font)
tag_demospace = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c') tag_demospace = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c')
if TkWinfo.depth($root) == 1 if TkWinfo.depth($root) == 1
tag_demo = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c', tag_demo = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c',
'underline'=>1) 'underline'=>1)
$tag_visited = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c', $tag_visited = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c',
'underline'=>1) 'underline'=>1)
tag_hot = TkTextTag.new(txt, 'background'=>'black', 'foreground'=>'white') tag_hot = TkTextTag.new(txt, 'background'=>'black', 'foreground'=>'white')
else else
tag_demo = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c', tag_demo = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c',
'foreground'=>'blue', 'underline'=>1) 'foreground'=>'blue', 'underline'=>1)
$tag_visited = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c', $tag_visited = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c',
'foreground'=>'#303080', 'underline'=>1) 'foreground'=>'#303080', 'underline'=>1)
# tag_hot = TkTextTag.new(txt, 'relief'=>'raised', 'borderwidth'=>1, # tag_hot = TkTextTag.new(txt, 'relief'=>'raised', 'borderwidth'=>1,
# 'background'=>'SeaGreen3') # 'background'=>'SeaGreen3')
tag_hot = TkTextTag.new(txt, 'borderwidth'=>1, 'foreground'=>'red') tag_hot = TkTextTag.new(txt, 'borderwidth'=>1, 'foreground'=>'red')
end end
#tag_demo.bind('Button-1', proc{invoke txt, txt.index('current')}) #tag_demo.bind('Button-1', proc{invoke txt, txt.index('current')})
tag_demo.bind('ButtonRelease-1', tag_demo.bind('ButtonRelease-1',
proc{|x,y|invoke txt, txt.index("@#{x},#{y}")}, '%x %y') proc{|x,y|invoke txt, txt.index("@#{x},#{y}")}, '%x %y')
lastLine = TkVariable.new("") lastLine = TkVariable.new("")
@ -255,7 +255,7 @@ tag_demo.bind('Enter', proc{|x,y|
showStatus txt, txt.index("@#{x},#{y}") showStatus txt, txt.index("@#{x},#{y}")
}, },
'%x %y') '%x %y')
tag_demo.bind('Leave', tag_demo.bind('Leave',
proc{ proc{
tag_hot.remove('1.0','end') tag_hot.remove('1.0','end')
txt.configure('cursor','xterm') txt.configure('cursor','xterm')
@ -266,10 +266,10 @@ tag_demo.bind('Motion', proc{|x, y|
if newLine.value != lastLine.value if newLine.value != lastLine.value
tag_hot.remove('1.0','end') tag_hot.remove('1.0','end')
lastLine.value = newLine.value lastLine.value = newLine.value
if ( txt.tag_names("@#{x},#{y}").find{|t| if ( txt.tag_names("@#{x},#{y}").find{|t|
t.kind_of?(String) && t =~ /^demo-/ t.kind_of?(String) && t =~ /^demo-/
} ) } )
tag_hot.add(lastLine.value, tag_hot.add(lastLine.value,
"#{lastLine.value} lineend -1 chars") "#{lastLine.value} lineend -1 chars")
end end
end end
@ -321,50 +321,50 @@ Ttk
EOT EOT
#txt.insert('end',"ラベル, ボタン, チェックボタン, ラジオボタン\n",tag_middle) #txt.insert('end',"ラベル, ボタン, チェックボタン, ラジオボタン\n",tag_middle)
txt.insert('end', "ラベル, ボタン, チェックボタン, ラジオボタン\n", txt.insert('end', "ラベル, ボタン, チェックボタン, ラジオボタン\n",
tag_kanji_title) tag_kanji_title)
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "1. ラベル (テキスト, ビットマップ)\n", txt.insert('end', "1. ラベル (テキスト, ビットマップ)\n",
tag_demo, "demo-label") tag_demo, "demo-label")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "2. ラベルとUNICODEテキスト (機能に対応したバージョンのTkが必要)\n", tag_demo, "demo-unicodeout") txt.insert('end', "2. ラベルとUNICODEテキスト (機能に対応したバージョンのTkが必要)\n", tag_demo, "demo-unicodeout")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "3. ボタン \n", tag_demo, "demo-button") txt.insert('end', "3. ボタン \n", tag_demo, "demo-button")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "4. チェックボタン (複数を選択可能)\n", txt.insert('end', "4. チェックボタン (複数を選択可能)\n",
tag_demo, "demo-check") tag_demo, "demo-check")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "5. 3状態チェックボタン (機能に対応したバージョンのTkが必要)\n", txt.insert('end', "5. 3状態チェックボタン (機能に対応したバージョンのTkが必要)\n",
tag_demo, "demo-check2") tag_demo, "demo-check2")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "6. ラジオボタン (任意の一つを選択可能)\n", txt.insert('end', "6. ラジオボタン (任意の一つを選択可能)\n",
tag_demo, "demo-radio") tag_demo, "demo-radio")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "7. ラジオボタン (機能に対応したバージョンのTkが必要)\n", txt.insert('end', "7. ラジオボタン (機能に対応したバージョンのTkが必要)\n",
tag_demo, "demo-radio2") tag_demo, "demo-radio2")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "8. 3状態ラジオボタン (機能に対応したバージョンのTkが必要)\n", txt.insert('end', "8. 3状態ラジオボタン (機能に対応したバージョンのTkが必要)\n",
tag_demo, "demo-radio3") tag_demo, "demo-radio3")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "9. ボタンで作られた15-パズルゲーム\n", txt.insert('end', "9. ボタンで作られた15-パズルゲーム\n",
tag_demo, "demo-puzzle") tag_demo, "demo-puzzle")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "10. ビットマップを使用したアイコンボタン\n", txt.insert('end', "10. ビットマップを使用したアイコンボタン\n",
tag_demo, "demo-icon") tag_demo, "demo-icon")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "11. 画像を表示する二つのラベル\n", txt.insert('end', "11. 画像を表示する二つのラベル\n",
tag_demo, "demo-image1") tag_demo, "demo-image1")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "12. 画像を見るための簡単なユーザインターフェース\n", txt.insert('end', "12. 画像を見るための簡単なユーザインターフェース\n",
tag_demo, "demo-image2") tag_demo, "demo-image2")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "13. 画像を見るための簡単なユーザインターフェース (機能に対応したバージョンのTkが必要)\n", txt.insert('end', "13. 画像を見るための簡単なユーザインターフェース (機能に対応したバージョンのTkが必要)\n",
tag_demo, "demo-image3") tag_demo, "demo-image3")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "14. ラベル付きフレーム (機能に対応したバージョンのTkが必要)\n", txt.insert('end', "14. ラベル付きフレーム (機能に対応したバージョンのTkが必要)\n",
tag_demo, "demo-labelframe") tag_demo, "demo-labelframe")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "15. テーマに対応したウィジェットの簡単な例 (Tile/Ttk拡張への対応が必要)\n", txt.insert('end', "15. テーマに対応したウィジェットの簡単な例 (Tile/Ttk拡張への対応が必要)\n",
tag_demo, "demo-ttkbut") tag_demo, "demo-ttkbut")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
@ -374,15 +374,15 @@ txt.insert('end', "
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "1. 都道府県.\n", tag_demo, "demo-states") txt.insert('end', "1. 都道府県.\n", tag_demo, "demo-states")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "2. 色: アプリケーションのための配色を変える\n", txt.insert('end', "2. 色: アプリケーションのための配色を変える\n",
"#{tag_demo.id} demo-colors") "#{tag_demo.id} demo-colors")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "3. 格言集\n", tag_demo, "demo-sayings") txt.insert('end', "3. 格言集\n", tag_demo, "demo-sayings")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "4. 国についてのマルチカラムリスト (Tile/Ttk拡張への対応が必要)\n", txt.insert('end', "4. 国についてのマルチカラムリスト (Tile/Ttk拡張への対応が必要)\n",
tag_demo, "demo-mclist") tag_demo, "demo-mclist")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "5. ディレクトリブラウザ (Tile/Ttk拡張への対応が必要)\n", txt.insert('end', "5. ディレクトリブラウザ (Tile/Ttk拡張への対応が必要)\n",
tag_demo, "demo-tree") tag_demo, "demo-tree")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
@ -394,13 +394,13 @@ txt.insert('end', "1.
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "2. スクロールバーあり\n", tag_demo, "demo-entry2") txt.insert('end', "2. スクロールバーあり\n", tag_demo, "demo-entry2")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "3. 認証処理付きのエントリボックスとパスワードフィールド (機能に対応したバージョンのTkが必要)\n", txt.insert('end', "3. 認証処理付きのエントリボックスとパスワードフィールド (機能に対応したバージョンのTkが必要)\n",
tag_demo, "demo-entry3") tag_demo, "demo-entry3")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "4. スピンボックス (機能に対応したバージョンのTkが必要)\n", txt.insert('end', "4. スピンボックス (機能に対応したバージョンのTkが必要)\n",
tag_demo, "demo-spin") tag_demo, "demo-spin")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "5. コンボボックス (Tile/Ttk拡張への対応が必要)\n", txt.insert('end', "5. コンボボックス (Tile/Ttk拡張への対応が必要)\n",
tag_demo, "demo-combo") tag_demo, "demo-combo")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "6. 簡単なフォーム\n", tag_demo, "demo-form") txt.insert('end', "6. 簡単なフォーム\n", tag_demo, "demo-form")
@ -414,13 +414,13 @@ txt.insert('end', "1.
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "2. 表示スタイル.\n", tag_demo, "demo-style") txt.insert('end', "2. 表示スタイル.\n", tag_demo, "demo-style")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "3. ハイパーテキスト(タグバインド).\n", txt.insert('end', "3. ハイパーテキスト(タグバインド).\n",
tag_demo, "demo-bind") tag_demo, "demo-bind")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "4. ウィンドウを埋め込んだテキスト\n", txt.insert('end', "4. ウィンドウを埋め込んだテキスト\n",
tag_demo, "demo-twind") tag_demo, "demo-twind")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "5. ウィンドウを埋め込んだテキスト (機能に対応したバージョンのTkが必要)\n", txt.insert('end', "5. ウィンドウを埋め込んだテキスト (機能に対応したバージョンのTkが必要)\n",
tag_demo, "demo-twind2") tag_demo, "demo-twind2")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "6. 検索\n", tag_demo, "demo-search") txt.insert('end', "6. 検索\n", tag_demo, "demo-search")
@ -446,10 +446,10 @@ txt.insert('end', "6.
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "7. フロアプラン (異なるキャンバスアイテム作成方法を使用)\n", tag_demo, "demo-floor2") txt.insert('end', "7. フロアプラン (異なるキャンバスアイテム作成方法を使用)\n", tag_demo, "demo-floor2")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "8. スクロール可能なキャンバス\n", txt.insert('end', "8. スクロール可能なキャンバス\n",
tag_demo, "demo-cscroll") tag_demo, "demo-cscroll")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "9. チェスボード上の騎士の巡回 (Tile/Ttk拡張への対応が必要)\n", txt.insert('end', "9. チェスボード上の騎士の巡回 (Tile/Ttk拡張への対応が必要)\n",
tag_demo, "demo-knightstour") tag_demo, "demo-knightstour")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
@ -467,16 +467,16 @@ txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "\n") txt.insert('end', "\n")
txt.insert('end', "ペインドウィンドウとノートブック\n", tag_kanji_title) txt.insert('end', "ペインドウィンドウとノートブック\n", tag_kanji_title)
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "1. 水平方向 (機能に対応したバージョンのTkが必要)\n", txt.insert('end', "1. 水平方向 (機能に対応したバージョンのTkが必要)\n",
tag_demo.id, "demo-paned1") tag_demo.id, "demo-paned1")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "2. 垂直方向 (機能に対応したバージョンのTkが必要)\n", txt.insert('end', "2. 垂直方向 (機能に対応したバージョンのTkが必要)\n",
tag_demo.id, "demo-paned2") tag_demo.id, "demo-paned2")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "3. テーマに対応した埋め込みペイン (Tile/Ttk拡張への対応が必要)\n", txt.insert('end', "3. テーマに対応した埋め込みペイン (Tile/Ttk拡張への対応が必要)\n",
tag_demo.id, "demo-ttkpane") tag_demo.id, "demo-ttkpane")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "4. ノートブックウィジェット (Tile/Ttk拡張への対応が必要)\n", txt.insert('end', "4. ノートブックウィジェット (Tile/Ttk拡張への対応が必要)\n",
tag_demo.id, "demo-ttknote") tag_demo.id, "demo-ttknote")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
@ -484,22 +484,22 @@ txt.insert('end', "\n")
#txt.insert('end', "メニューとツールバー\n", tag_middle) #txt.insert('end', "メニューとツールバー\n", tag_middle)
txt.insert('end', "メニューとツールバー\n", tag_kanji_title) txt.insert('end', "メニューとツールバー\n", tag_kanji_title)
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "1. メニューとカスケードを含んだウィンドウ\n", txt.insert('end', "1. メニューとカスケードを含んだウィンドウ\n",
tag_demo, "demo-menu") tag_demo, "demo-menu")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "2. メニューとカスケードを含んだウィンドウ (Tk8.x 専用)\n", txt.insert('end', "2. メニューとカスケードを含んだウィンドウ (Tk8.x 専用)\n",
tag_demo, "demo-menu8x") tag_demo, "demo-menu8x")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "3. 〃 (機能に対応したバージョンのTkが必要)\n", txt.insert('end', "3. 〃 (機能に対応したバージョンのTkが必要)\n",
tag_demo, "demo-menu84") tag_demo, "demo-menu84")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "4. メニューボタン (Tk8.x 専用)\n", txt.insert('end', "4. メニューボタン (Tk8.x 専用)\n",
tag_demo, "demo-menubu") tag_demo, "demo-menubu")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "5. テーマに対応したメニューボタン (Tile/Ttk拡張への対応が必要)\n", txt.insert('end', "5. テーマに対応したメニューボタン (Tile/Ttk拡張への対応が必要)\n",
tag_demo.id, "demo-ttkmenu") tag_demo.id, "demo-ttkmenu")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "6. テーマに対応したツールバー (Tile/Ttk拡張への対応が必要)\n", txt.insert('end', "6. テーマに対応したツールバー (Tile/Ttk拡張への対応が必要)\n",
tag_demo.id, "demo-toolbar") tag_demo.id, "demo-toolbar")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
@ -534,10 +534,10 @@ txt.insert('end', "
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "1. 組み込みのビットマップ\n", tag_demo, "demo-bitmap") txt.insert('end', "1. 組み込みのビットマップ\n", tag_demo, "demo-bitmap")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "2. モーダルダイアログ(ローカルグラブ)\n", txt.insert('end', "2. モーダルダイアログ(ローカルグラブ)\n",
tag_demo, "demo-dialog1") tag_demo, "demo-dialog1")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "3. モーダルダイアログ(グローバルグラブ)\n", txt.insert('end', "3. モーダルダイアログ(グローバルグラブ)\n",
tag_demo, "demo-dialog2") tag_demo, "demo-dialog2")
txt.insert('end', " \n ", tag_demospace) txt.insert('end', " \n ", tag_demospace)
@ -556,7 +556,7 @@ $showVarsWin = {}
def showVars1(parent, *args) def showVars1(parent, *args)
if $showVarsWin[parent.path] if $showVarsWin[parent.path]
begin begin
$showVarsWin[parent.path].destroy $showVarsWin[parent.path].destroy
rescue rescue
end end
end end
@ -596,7 +596,7 @@ end
def showVars2(parent, *args) def showVars2(parent, *args)
if $showVarsWin[parent.path] if $showVarsWin[parent.path]
begin begin
$showVarsWin[parent.path].destroy $showVarsWin[parent.path].destroy
rescue rescue
end end
end end
@ -605,11 +605,11 @@ def showVars2(parent, *args)
base = TkFrame.new(top).pack(:fill=>:both, :expand=>true) base = TkFrame.new(top).pack(:fill=>:both, :expand=>true)
TkLabelFrame.new(base, :text=>"変数値:", TkLabelFrame.new(base, :text=>"変数値:",
:font=>{:family=>'Helvetica', :size=>14}){|f| :font=>{:family=>'Helvetica', :size=>14}){|f|
args.each{|vnam,vbody| args.each{|vnam,vbody|
TkGrid(TkLabel.new(f, :text=>"#{vnam}: ", :anchor=>'w'), TkGrid(TkLabel.new(f, :text=>"#{vnam}: ", :anchor=>'w'),
TkLabel.new(f, :textvariable=>vbody, :anchor=>'w'), TkLabel.new(f, :textvariable=>vbody, :anchor=>'w'),
:padx=>2, :pady=>2, :sticky=>'w') :padx=>2, :pady=>2, :sticky=>'w')
} }
@ -617,7 +617,7 @@ def showVars2(parent, *args)
f.grid_columnconfig(1, :weight=>1) f.grid_columnconfig(1, :weight=>1)
f.grid_rowconfig(100, :weight=>1) f.grid_rowconfig(100, :weight=>1)
} }
TkButton.new(base, :text=>"了解", :width=>8, :default=>:active, TkButton.new(base, :text=>"了解", :width=>8, :default=>:active,
:command=>proc{top.destroy}){|b| :command=>proc{top.destroy}){|b|
top.bind('Return', proc{b.invoke}) top.bind('Return', proc{b.invoke})
top.bind('Escape', proc{b.invoke}) top.bind('Escape', proc{b.invoke})
@ -667,9 +667,9 @@ class Object
def method_missing(id, *args) def method_missing(id, *args)
begin begin
has_top = (top = Thread.current[:TOPLEVEL]) && has_top = (top = Thread.current[:TOPLEVEL]) &&
top.respond_to?(:pseudo_toplevel_evaluable?) && top.respond_to?(:pseudo_toplevel_evaluable?) &&
top.pseudo_toplevel_evaluable? && top.pseudo_toplevel_evaluable? &&
top.respond_to?(id) top.respond_to?(id)
rescue Exception => e rescue Exception => e
has_top = false has_top = false
@ -733,9 +733,9 @@ def eval_samplecode(code, file=nil)
end end
rescue Exception=>e rescue Exception=>e
#p e #p e
TkBgError.show(e.message + "\n" + TkBgError.show(e.message + "\n" +
"\n---< backtrace of Ruby side >-----\n" + "\n---< backtrace of Ruby side >-----\n" +
e.backtrace.join("\n") + e.backtrace.join("\n") +
"\n---< backtrace of Tk side >-------") "\n---< backtrace of Tk side >-------")
end end
} }
@ -785,7 +785,7 @@ def showStatus (txt, index)
newcursor = 'xterm' newcursor = 'xterm'
else else
demoname = tag[5..-1] demoname = tag[5..-1]
$statusBarLabel.configure('text', $statusBarLabel.configure('text',
"サンプルプログラム \"#{demoname}\" の実行 ") "サンプルプログラム \"#{demoname}\" の実行 ")
newcursor = 'hand2' newcursor = 'hand2'
end end
@ -841,9 +841,9 @@ def showCode1(demo)
TkFrame.new($code_window) {|f| TkFrame.new($code_window) {|f|
pack('expand'=>'yes', 'fill'=>'both', 'padx'=>1, 'pady'=>1) pack('expand'=>'yes', 'fill'=>'both', 'padx'=>1, 'pady'=>1)
hs = TkScrollbar.new($code_window, 'highlightthickness'=>0, hs = TkScrollbar.new($code_window, 'highlightthickness'=>0,
'orient'=>'horizontal') 'orient'=>'horizontal')
vs = TkScrollbar.new($code_window, 'highlightthickness'=>0, vs = TkScrollbar.new($code_window, 'highlightthickness'=>0,
'orient'=>'vertical') 'orient'=>'vertical')
$code_text = TkText.new($code_window) {|t| $code_text = TkText.new($code_window) {|t|
height 40 height 40
@ -859,11 +859,11 @@ def showCode1(demo)
vs.command(proc{|*args| $code_text.yview(*args)}) vs.command(proc{|*args| $code_text.yview(*args)})
} }
$code_text.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, $code_text.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0,
'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
vs.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, vs.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1,
'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
# xs.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, # xs.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0,
# 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') # 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
TkGrid.rowconfigure(f, 0, 'weight'=>1, 'minsize'=>0) TkGrid.rowconfigure(f, 0, 'weight'=>1, 'minsize'=>0)
TkGrid.columnconfigure(f, 0, 'weight'=>1, 'minsize'=>0) TkGrid.columnconfigure(f, 0, 'weight'=>1, 'minsize'=>0)
@ -900,8 +900,8 @@ def showCode2(demo)
if $code_window == nil || TkWinfo.exist?($code_window) == false if $code_window == nil || TkWinfo.exist?($code_window) == false
$code_window = TkToplevel.new(nil) $code_window = TkToplevel.new(nil)
tf = TkFrame.new($code_window) tf = TkFrame.new($code_window)
$code_text = TkText.new(tf, :font=>'Courier 10', :height=>30, $code_text = TkText.new(tf, :font=>'Courier 10', :height=>30,
:wrap=>'word', :bd=>1, :setgrid=>true, :wrap=>'word', :bd=>1, :setgrid=>true,
:highlightthickness=>0, :pady=>2, :padx=>3) :highlightthickness=>0, :pady=>2, :padx=>3)
xscr = TkScrollbar.new(tf, :bd=>1){assign($code_text)} xscr = TkScrollbar.new(tf, :bd=>1){assign($code_text)}
yscr = TkScrollbar.new(tf, :bd=>1){assign($code_text)} yscr = TkScrollbar.new(tf, :bd=>1){assign($code_text)}
@ -924,21 +924,21 @@ def showCode2(demo)
posnum.text = pos posnum.text = pos
} }
#b_dis = TkButton.new(bf, :text=>'了解', :default=>:active, #b_dis = TkButton.new(bf, :text=>'了解', :default=>:active,
b_dis = TkButton.new(bf, :text=>'閉じる', :default=>:active, b_dis = TkButton.new(bf, :text=>'閉じる', :default=>:active,
:command=>proc{ :command=>proc{
$code_window.destroy $code_window.destroy
$code_window = nil $code_window = nil
}, },
:image=>$image['delete'], :compound=>:left) :image=>$image['delete'], :compound=>:left)
b_prn = TkButton.new(bf, :text=>'印刷', b_prn = TkButton.new(bf, :text=>'印刷',
:command=>proc{printCode($code_text, file)}, :command=>proc{printCode($code_text, file)},
:image=>$image['print'], :compound=>:left) :image=>$image['print'], :compound=>:left)
b_run = TkButton.new(bf, :text=>'再実行', b_run = TkButton.new(bf, :text=>'再実行',
:command=>proc{ :command=>proc{
# eval($code_text.get('1.0','end'), _null_binding) # eval($code_text.get('1.0','end'), _null_binding)
eval_samplecode($code_text.get('1.0','end'), '<viewer>') eval_samplecode($code_text.get('1.0','end'), '<viewer>')
}, },
:image=>$image['refresh'], :compound=>:left) :image=>$image['refresh'], :compound=>:left)
TkGrid(lf, 'x', b_run, b_prn, b_dis, :padx=>4, :pady=>[6,4]) TkGrid(lf, 'x', b_run, b_prn, b_dis, :padx=>4, :pady=>[6,4])
@ -1011,27 +1011,27 @@ def printCode(txt, file)
when 'unix' when 'unix'
msg = `lp -c #{fname}` msg = `lp -c #{fname}`
unless $?.exitstatus == 0 unless $?.exitstatus == 0
Tk.messageBox(:title=>'Print spooling failure', Tk.messageBox(:title=>'Print spooling failure',
:message=>'エラーが発生しました.' + :message=>'エラーが発生しました.' +
'印刷に失敗したものと思われます : ' + msg) '印刷に失敗したものと思われます : ' + msg)
end end
when 'windows' when 'windows'
begin begin
printTextWin32(fname) printTextWin32(fname)
rescue => e rescue => e
Tk.messageBox(:title=>'Print spooling failure', Tk.messageBox(:title=>'Print spooling failure',
:message=>'エラーが発生しました.' + :message=>'エラーが発生しました.' +
'印刷に失敗したものと思われます : ' + '印刷に失敗したものと思われます : ' +
e.message) e.message)
end end
when 'macintosh' when 'macintosh'
Tk.messageBox(:title=>'Operation not Implemented', Tk.messageBox(:title=>'Operation not Implemented',
:message=>'印刷機能はまだ実装されていません') :message=>'印刷機能はまだ実装されていません')
else else
Tk.messageBox(:title=>'Operation not Implemented', Tk.messageBox(:title=>'Operation not Implemented',
:message=>'検出された環境 ' + :message=>'検出された環境 ' +
Tk::TCL_PLATFORM('platform') + Tk::TCL_PLATFORM('platform') +
' は未知の環境であるため,' + ' は未知の環境であるため,' +
'印刷機能は実装されていません: ') '印刷機能は実装されていません: ')
end end
ensure ensure
@ -1061,7 +1061,7 @@ def printTextWin32(fname)
pcmd.gsub!('%1', fname) pcmd.gsub!('%1', fname)
puts pcmd puts pcmd
cmd = Tk.tk_call('auto_execok', 'start') + ' /min ' + pcmd cmd = Tk.tk_call('auto_execok', 'start') + ' /min ' + pcmd
msg = `#{cmd}` msg = `#{cmd}`
unless $?.exitstatus == 0 unless $?.exitstatus == 0
fail RuntimeError, msg fail RuntimeError, msg
@ -1073,16 +1073,16 @@ end
# Pops up a message box with an "about" message # Pops up a message box with an "about" message
# #
def aboutBox def aboutBox
Tk.messageBox('icon'=>'info', 'type'=>'ok', 'title'=>'About Widget Demo', Tk.messageBox('icon'=>'info', 'type'=>'ok', 'title'=>'About Widget Demo',
'message'=>"Ruby/Tk ウィジェットデモ Ver.1.7.1-jp\n\n" + 'message'=>"Ruby/Tk ウィジェットデモ Ver.1.7.1-jp\n\n" +
"based on demos of Tk8.1 -- 8.5 " + "based on demos of Tk8.1 -- 8.5 " +
"( Copyright of Tcl/Tk demos:: " + "( Copyright of Tcl/Tk demos:: " +
"(c) 1996-1997 Sun Microsystems, Inc. / " + "(c) 1996-1997 Sun Microsystems, Inc. / " +
"(c) 1997-2000 Ajuba Solutions, Inc. / " + "(c) 1997-2000 Ajuba Solutions, Inc. / " +
"(c) 2001-2007 Donal K. Fellows / " + "(c) 2001-2007 Donal K. Fellows / " +
"(c) 2002-2007 Daniel A. Steffen )\n\n" + "(c) 2002-2007 Daniel A. Steffen )\n\n" +
"Your Ruby & Tk Version ::\n" + "Your Ruby & Tk Version ::\n" +
"Ruby#{RUBY_VERSION}(#{RUBY_RELEASE_DATE})[#{RUBY_PLATFORM}] / Tk#{$tk_patchlevel}#{(Tk::JAPANIZED_TK)? '-jp': ''}\n\n" + "Ruby#{RUBY_VERSION}(#{RUBY_RELEASE_DATE})[#{RUBY_PLATFORM}] / Tk#{$tk_patchlevel}#{(Tk::JAPANIZED_TK)? '-jp': ''}\n\n" +
"Ruby/Tk release date :: tcltklib #{TclTkLib::RELEASE_DATE}; tk #{Tk::RELEASE_DATE}") "Ruby/Tk release date :: tcltklib #{TclTkLib::RELEASE_DATE}; tk #{Tk::RELEASE_DATE}")
end end
@ -1096,11 +1096,11 @@ else
# show the root widget to make it lower then demo windows # show the root widget to make it lower then demo windows
Tk.update Tk.update
end end
ARGV.each{|cmd| ARGV.each{|cmd|
if cmd =~ /(.*).rb/ if cmd =~ /(.*).rb/
cmd = $1 cmd = $1
end end
#eval(IO.readlines("#{[$demo_dir, cmd].join(File::Separator)}.rb").join, #eval(IO.readlines("#{[$demo_dir, cmd].join(File::Separator)}.rb").join,
# _null_binding) # _null_binding)
eval_samplecode(IO.readlines("#{[$demo_dir, cmd].join(File::Separator)}.rb").join, cmd + '.rb') eval_samplecode(IO.readlines("#{[$demo_dir, cmd].join(File::Separator)}.rb").join, cmd + '.rb')
} }

Просмотреть файл

@ -41,12 +41,12 @@ else
fnt = ['courier', '-12'] fnt = ['courier', '-12']
end end
console = TkTextIO.new(top, :mode=>:console, console = TkTextIO.new(top, :mode=>:console,
:width=>80).pack(:side=>:left, :width=>80).pack(:side=>:left,
:expand=>true, :fill=>:both) :expand=>true, :fill=>:both)
console.yscrollbar(TkScrollbar.new(top, :width=>10).pack(:before=>console, console.yscrollbar(TkScrollbar.new(top, :width=>10).pack(:before=>console,
:side=>:right, :side=>:right,
:expand=>false, :expand=>false,
:fill=>:y)) :fill=>:y))
# save original I/O # save original I/O

Просмотреть файл

@ -1,3 +1,3 @@
Message catalogs in this directory depend on Tcl/Tk's message catalogs. Message catalogs in this directory depend on Tcl/Tk's message catalogs.
Texts of each locale are copied from Tcl/Tk8.5a1 widget demos. Texts of each locale are copied from Tcl/Tk8.5a1 widget demos.
Please refer to '../msgs_tk/README'. Please refer to '../msgs_tk/README'.

Просмотреть файл

@ -69,7 +69,7 @@ TkMsgCatalog.new('::tk') {
es "Tcl Scripts", "Scripts Tcl" es "Tcl Scripts", "Scripts Tcl"
es "Tcl for Windows", "Tcl para Windows" es "Tcl for Windows", "Tcl para Windows"
es "Text Files", "Archivos de texto" es "Text Files", "Archivos de texto"
es "&Yes", "&S\\u00ed" es "&Yes", "&S\\u00ed"
es "abort", "abortar" es "abort", "abortar"
es "blue", "azul" es "blue", "azul"
es "cancel", "cancelar" es "cancel", "cancelar"

Просмотреть файл

@ -31,7 +31,7 @@ TkMsgCatalog.new('::tk') {
ru 'Details >>', '\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 >>' ru 'Details >>', '\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 >>'
ru 'Directory "%1\$s" does not exist.', '\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 "%1\$s" \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.' ru 'Directory "%1\$s" does not exist.', '\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 "%1\$s" \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.'
ru '&Directory:', '&\u041a\u0430\u0442\u0430\u043b\u043e\u0433:' ru '&Directory:', '&\u041a\u0430\u0442\u0430\u043b\u043e\u0433:'
ru 'Error: %1\$s', '\u041e\u0448\u0438\u0431\u043a\u0430: %1\$s' ru 'Error: %1\$s', '\u041e\u0448\u0438\u0431\u043a\u0430: %1\$s'
ru 'Exit', '\u0412\u044b\u0445\u043e\u0434' ru 'Exit', '\u0412\u044b\u0445\u043e\u0434'
ru 'File "%1\$s" already exists.' "\n" 'Do you want to overwrite it?' \ ru 'File "%1\$s" already exists.' "\n" 'Do you want to overwrite it?' \
'\u0424\u0430\u0439\u043b "%1\$s" \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.' "\n" '\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0433\u043e?' '\u0424\u0430\u0439\u043b "%1\$s" \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.' "\n" '\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0433\u043e?'
@ -47,7 +47,7 @@ TkMsgCatalog.new('::tk') {
ru 'Hi', '\u041f\u0440\u0438\u0432\u0435\u0442' ru 'Hi', '\u041f\u0440\u0438\u0432\u0435\u0442'
ru 'Hide Console', '\u0421\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u043e\u043b\u044c' ru 'Hide Console', '\u0421\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u043e\u043b\u044c'
ru '&Ignore', '&\u0418\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c' ru '&Ignore', '&\u0418\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c'
ru 'Invalid file name "%1\$s".', '\u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 "%1\$s".' ru 'Invalid file name "%1\$s".', '\u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 "%1\$s".'
ru 'Log Files', '\u0424\u0430\u0439\u043b\u044b \u0436\u0443\u0440\u043d\u0430\u043b\u0430' ru 'Log Files', '\u0424\u0430\u0439\u043b\u044b \u0436\u0443\u0440\u043d\u0430\u043b\u0430'
ru '&No', '&\u041d\u0435\u0442' ru '&No', '&\u041d\u0435\u0442'
ru '&OK', '&\u041e\u041a' ru '&OK', '&\u041e\u041a'

Просмотреть файл

@ -1,5 +1,5 @@
Message catalogs in this directory are written in encodings except Message catalogs in this directory are written in encodings except
UTF-8. As if you have a trouble to edit UTF-8 text, you can write UTF-8. As if you have a trouble to edit UTF-8 text, you can write
message catalogs in your familier encoding. message catalogs in your familier encoding.
Please see '../msgs_rb/README' too. Please see '../msgs_rb/README' too.

Просмотреть файл

@ -1,4 +1,4 @@
Almost all of Message-Catalog files in this directory are quoted Almost all of Message-Catalog files in this directory are quoted
from Tcl/Tk8.5a1 source archive (only a little are modified for from Tcl/Tk8.5a1 source archive (only a little are modified for
'tkmsgcat-load_tk.rb'). Please read the file 'license.terms' in 'tkmsgcat-load_tk.rb'). Please read the file 'license.terms' in
this directry (That was included in demo directory of Tcl/Tk8.5a1). this directry (That was included in demo directory of Tcl/Tk8.5a1).

Просмотреть файл

@ -13,7 +13,7 @@ namespace eval ::tkmsgcat_demo {
} }
# followings are same to original file included into Tk8.5a1's widget demos. # followings are same to original file included into Tk8.5a1's widget demos.
## Messages for the Greek (Hellenic - "el") language. ## Messages for the Greek (Hellenic - "el") language.
## Please report any changes/suggestions to: ## Please report any changes/suggestions to:

Просмотреть файл

@ -69,7 +69,7 @@ namespace eval ::tk {
::msgcat::mcset es "Tcl Scripts" "Scripts Tcl" ::msgcat::mcset es "Tcl Scripts" "Scripts Tcl"
::msgcat::mcset es "Tcl for Windows" "Tcl para Windows" ::msgcat::mcset es "Tcl for Windows" "Tcl para Windows"
::msgcat::mcset es "Text Files" "Archivos de texto" ::msgcat::mcset es "Text Files" "Archivos de texto"
::msgcat::mcset es "&Yes" "&S\u00ed" ::msgcat::mcset es "&Yes" "&S\u00ed"
::msgcat::mcset es "abort" "abortar" ::msgcat::mcset es "abort" "abortar"
::msgcat::mcset es "blue" "azul" ::msgcat::mcset es "blue" "azul"
::msgcat::mcset es "cancel" "cancelar" ::msgcat::mcset es "cancel" "cancelar"

Просмотреть файл

@ -28,7 +28,7 @@ MODIFICATIONS.
GOVERNMENT USE: If you are acquiring this software on behalf of the GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights" U.S. government, the Government shall have only "Restricted Rights"
in the software and related documentation as defined in the Federal in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the software shall be classified as "Commercial Computer Software" and the

Просмотреть файл

@ -31,7 +31,7 @@ namespace eval ::tk {
::msgcat::mcset ru "Details >>" "\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 >>" ::msgcat::mcset ru "Details >>" "\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 >>"
::msgcat::mcset ru "Directory \"%1\$s\" does not exist." "\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \"%1\$s\" \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442." ::msgcat::mcset ru "Directory \"%1\$s\" does not exist." "\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \"%1\$s\" \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442."
::msgcat::mcset ru "&Directory:" "&\u041a\u0430\u0442\u0430\u043b\u043e\u0433:" ::msgcat::mcset ru "&Directory:" "&\u041a\u0430\u0442\u0430\u043b\u043e\u0433:"
::msgcat::mcset ru "Error: %1\$s" "\u041e\u0448\u0438\u0431\u043a\u0430: %1\$s" ::msgcat::mcset ru "Error: %1\$s" "\u041e\u0448\u0438\u0431\u043a\u0430: %1\$s"
::msgcat::mcset ru "Exit" "\u0412\u044b\u0445\u043e\u0434" ::msgcat::mcset ru "Exit" "\u0412\u044b\u0445\u043e\u0434"
::msgcat::mcset ru "File \"%1\$s\" already exists.\nDo you want to overwrite it?" \ ::msgcat::mcset ru "File \"%1\$s\" already exists.\nDo you want to overwrite it?" \
"\u0424\u0430\u0439\u043b \"%1\$s\" \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.\n\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0433\u043e?" "\u0424\u0430\u0439\u043b \"%1\$s\" \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.\n\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0433\u043e?"
@ -47,7 +47,7 @@ namespace eval ::tk {
::msgcat::mcset ru "Hi" "\u041f\u0440\u0438\u0432\u0435\u0442" ::msgcat::mcset ru "Hi" "\u041f\u0440\u0438\u0432\u0435\u0442"
::msgcat::mcset ru "Hide Console" "\u0421\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u043e\u043b\u044c" ::msgcat::mcset ru "Hide Console" "\u0421\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u043e\u043b\u044c"
::msgcat::mcset ru "&Ignore" "&\u0418\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c" ::msgcat::mcset ru "&Ignore" "&\u0418\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c"
::msgcat::mcset ru "Invalid file name \"%1\$s\"." "\u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \"%1\$s\"." ::msgcat::mcset ru "Invalid file name \"%1\$s\"." "\u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \"%1\$s\"."
::msgcat::mcset ru "Log Files" "\u0424\u0430\u0439\u043b\u044b \u0436\u0443\u0440\u043d\u0430\u043b\u0430" ::msgcat::mcset ru "Log Files" "\u0424\u0430\u0439\u043b\u044b \u0436\u0443\u0440\u043d\u0430\u043b\u0430"
::msgcat::mcset ru "&No" "&\u041d\u0435\u0442" ::msgcat::mcset ru "&No" "&\u041d\u0435\u0442"
::msgcat::mcset ru "&OK" "&\u041e\u041a" ::msgcat::mcset ru "&OK" "&\u041e\u041a"

Просмотреть файл

@ -1,2 +1,2 @@
The scripts and image files in this directory are based on demo files The scripts and image files in this directory are based on demo files
of Tcl/Tk's BLT extention. of Tcl/Tk's BLT extention.

Просмотреть файл

@ -1,2 +1,2 @@
All of *.tcl and under themes/ directory (except kroc.rb) are All of *.tcl and under themes/ directory (except kroc.rb) are
quoted from Tcl/Tk's Tile extension. Please read Orig_LICENSE.txt. quoted from Tcl/Tk's Tile extension. Please read Orig_LICENSE.txt.

Просмотреть файл

@ -17,7 +17,7 @@
# Notes: # Notes:
# Repeater buttons work more like scrollbar arrows than # Repeater buttons work more like scrollbar arrows than
# Tk repeating buttons: they fire once immediately when # Tk repeating buttons: they fire once immediately when
# first pressed, and $State(delay) specifies the initial # first pressed, and $State(delay) specifies the initial
# interval before the button starts autorepeating. # interval before the button starts autorepeating.
# #
@ -49,8 +49,8 @@ bind Repeater <B1-Enter> \
### Binding procedures. ### Binding procedures.
# #
## Activate -- Keyboard activation binding. ## Activate -- Keyboard activation binding.
# Simulate clicking the button, and invoke the command once. # Simulate clicking the button, and invoke the command once.
# #
proc tile::Repeater::Activate {w} { proc tile::Repeater::Activate {w} {
$w instate disabled { return } $w instate disabled { return }
@ -61,7 +61,7 @@ proc tile::Repeater::Activate {w} {
} }
## Press -- ButtonPress-1 binding. ## Press -- ButtonPress-1 binding.
# Invoke the command once and start autorepeating after # Invoke the command once and start autorepeating after
# $State(delay) milliseconds. # $State(delay) milliseconds.
# #
proc tile::Repeater::Press {w} { proc tile::Repeater::Press {w} {
@ -104,7 +104,7 @@ proc tile::Repeater::Resume {w} {
} }
## Repeat -- Timer script ## Repeat -- Timer script
# Invoke the command and reschedule another repetition # Invoke the command and reschedule another repetition
# after $State(interval) milliseconds. # after $State(interval) milliseconds.
# #
proc tile::Repeater::Repeat {w} { proc tile::Repeater::Repeat {w} {

Просмотреть файл

@ -68,12 +68,12 @@ namespace eval tile::theme::blue {
style default Toolbutton \ style default Toolbutton \
-width 0 -relief flat -borderwidth 2 -padding 4 \ -width 0 -relief flat -borderwidth 2 -padding 4 \
-background $colors(-frame) -foreground #000000 ; -background $colors(-frame) -foreground #000000 ;
style map Toolbutton -background [list active $colors(-selectbg)] style map Toolbutton -background [list active $colors(-selectbg)]
style map Toolbutton -foreground [list active $colors(-selectfg)] style map Toolbutton -foreground [list active $colors(-selectfg)]
style map Toolbutton -relief { style map Toolbutton -relief {
disabled flat disabled flat
selected sunken selected sunken
pressed sunken pressed sunken
active raised active raised
} }

Просмотреть файл

@ -1,4 +1,4 @@
# keramik.tcl - # keramik.tcl -
# #
# A sample pixmap theme for the tile package. # A sample pixmap theme for the tile package.
# #
@ -48,12 +48,12 @@ namespace eval tile::theme::keramik {
; ;
style map . -foreground [list disabled $colors(-disabledfg)] style map . -foreground [list disabled $colors(-disabledfg)]
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# Button elements # Button elements
# - the button has a large rounded border and needs a bit of # - the button has a large rounded border and needs a bit of
# horizontal padding. # horizontal padding.
# - the checkbutton and radiobutton have the focus drawn around # - the checkbutton and radiobutton have the focus drawn around
# the whole widget - hence the new layouts. # the whole widget - hence the new layouts.
# #
style layout TButton { style layout TButton {
@ -125,7 +125,7 @@ namespace eval tile::theme::keramik {
# one at the top. # one at the top.
# #
style layout Vertical.TScrollbar { style layout Vertical.TScrollbar {
Scrollbar.background Scrollbar.background
Scrollbar.trough -children { Scrollbar.trough -children {
Scrollbar.uparrow -side top Scrollbar.uparrow -side top
Scrollbar.downarrow -side bottom Scrollbar.downarrow -side bottom
@ -133,9 +133,9 @@ namespace eval tile::theme::keramik {
Vertical.Scrollbar.thumb -side top -expand true -sticky ns Vertical.Scrollbar.thumb -side top -expand true -sticky ns
} }
} }
style layout Horizontal.TScrollbar { style layout Horizontal.TScrollbar {
Scrollbar.background Scrollbar.background
Scrollbar.trough -children { Scrollbar.trough -children {
Scrollbar.leftarrow -side left Scrollbar.leftarrow -side left
Scrollbar.rightarrow -side right Scrollbar.rightarrow -side right
@ -149,26 +149,26 @@ namespace eval tile::theme::keramik {
style element create Horizontal.Scrollbar.thumb image $I(hsb-n) \ style element create Horizontal.Scrollbar.thumb image $I(hsb-n) \
-border {6 4} -width 15 -height 16 -sticky news \ -border {6 4} -width 15 -height 16 -sticky news \
-map [list {pressed !disabled} $I(hsb-p)] -map [list {pressed !disabled} $I(hsb-p)]
style element create Vertical.Scrollbar.thumb image $I(vsb-n) \ style element create Vertical.Scrollbar.thumb image $I(vsb-n) \
-border {4 6} -width 16 -height 15 -sticky news \ -border {4 6} -width 16 -height 15 -sticky news \
-map [list {pressed !disabled} $I(vsb-p)] -map [list {pressed !disabled} $I(vsb-p)]
style element create Scale.slider image $I(hslider-n) \ style element create Scale.slider image $I(hslider-n) \
-border 3 -border 3
style element create Vertical.Scale.slider image $I(vslider-n) \ style element create Vertical.Scale.slider image $I(vslider-n) \
-border 3 -border 3
style element create Horizontal.Progress.bar image $I(hsb-n) \ style element create Horizontal.Progress.bar image $I(hsb-n) \
-border {6 4} -border {6 4}
style element create Vertical.Progress.bar image $I(vsb-n) \ style element create Vertical.Progress.bar image $I(vsb-n) \
-border {4 6} -border {4 6}
style element create uparrow image $I(arrowup-n) \ style element create uparrow image $I(arrowup-n) \
-map [list {pressed !disabled} $I(arrowup-p)] -map [list {pressed !disabled} $I(arrowup-p)]
style element create downarrow image $I(arrowdown-n) \ style element create downarrow image $I(arrowdown-n) \
-map [list {pressed !disabled} $I(arrowdown-p)] -map [list {pressed !disabled} $I(arrowdown-p)]
@ -177,7 +177,7 @@ namespace eval tile::theme::keramik {
style element create leftarrow image $I(arrowleft-n) \ style element create leftarrow image $I(arrowleft-n) \
-map [list {pressed !disabled} $I(arrowleft-p)] -map [list {pressed !disabled} $I(arrowleft-p)]
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# Notebook elements # Notebook elements
# #

Просмотреть файл

@ -4,7 +4,7 @@
# or we don't have the right version of Tcl/Tk # or we don't have the right version of Tcl/Tk
# #
# To use this automatically within tile, the tile-using application should # To use this automatically within tile, the tile-using application should
# use tile::availableThemes and tile::setTheme # use tile::availableThemes and tile::setTheme
# #
# $Id$ # $Id$

Просмотреть файл

@ -11,25 +11,25 @@ namespace eval tile {
} }
namespace eval tile::kroc { namespace eval tile::kroc {
set imgdir [file join [file dirname [info script]] kroc] set imgdir [file join [file dirname [info script]] kroc]
array set Images [tile::LoadImages $imgdir *.gif] array set Images [tile::LoadImages $imgdir *.gif]
if {[package vsatisfies [package provide tile] 0.5]} { if {[package vsatisfies [package provide tile] 0.5]} {
set TNoteBook_Tab TNotebook.Tab set TNoteBook_Tab TNotebook.Tab
} else { } else {
set TNoteBook_Tab Tab.TNotebook set TNoteBook_Tab Tab.TNotebook
} }
style theme create kroc -parent alt -settings { style theme create kroc -parent alt -settings {
style default . -background #FCB64F -troughcolor #F8C278 -borderwidth 1 style default . -background #FCB64F -troughcolor #F8C278 -borderwidth 1
style default . -font TkDefaultFont -borderwidth 1 style default . -font TkDefaultFont -borderwidth 1
style map . -background [list active #694418] style map . -background [list active #694418]
style map . -foreground [list disabled #B2B2B2 active #FFE7CB] style map . -foreground [list disabled #B2B2B2 active #FFE7CB]
style default TButton -padding "10 4" style default TButton -padding "10 4"
style default $TNoteBook_Tab -padding {10 3} -font TkDefaultFont style default $TNoteBook_Tab -padding {10 3} -font TkDefaultFont
style map $TNoteBook_Tab \ style map $TNoteBook_Tab \
-background [list selected #FCB64F {} #FFE6BA] \ -background [list selected #FCB64F {} #FFE6BA] \
@ -41,7 +41,7 @@ namespace eval tile::kroc {
-arrowcolor { pressed #FFE7CB } \ -arrowcolor { pressed #FFE7CB } \
-relief { pressed sunken } \ -relief { pressed sunken } \
; ;
style layout Vertical.TScrollbar { style layout Vertical.TScrollbar {
Scrollbar.trough -children { Scrollbar.trough -children {
Scrollbar.uparrow -side top Scrollbar.uparrow -side top
@ -50,7 +50,7 @@ namespace eval tile::kroc {
Scrollbar.thumb -side top -expand true Scrollbar.thumb -side top -expand true
} }
} }
style layout Horizontal.TScrollbar { style layout Horizontal.TScrollbar {
Scrollbar.trough -children { Scrollbar.trough -children {
Scrollbar.leftarrow -side left Scrollbar.leftarrow -side left
@ -59,18 +59,18 @@ namespace eval tile::kroc {
Scrollbar.thumb -side left -expand true Scrollbar.thumb -side left -expand true
} }
} }
# #
# Elements: # Elements:
# #
if {[package vsatisfies [package provide tile] 0.5]} { if {[package vsatisfies [package provide tile] 0.5]} {
style element create Button.button image $Images(button-n) \ style element create Button.button image $Images(button-n) \
-map [list \ -map [list \
pressed $Images(button-p) \ pressed $Images(button-p) \
active $Images(button-h) \ active $Images(button-h) \
] -border 3 -sticky ew ] -border 3 -sticky ew
style element create Checkbutton.indicator image $Images(check-nu) \ style element create Checkbutton.indicator image $Images(check-nu) \
-map [list \ -map [list \
{pressed selected} $Images(check-nc) \ {pressed selected} $Images(check-nc) \
@ -79,7 +79,7 @@ namespace eval tile::kroc {
active $Images(check-hu) \ active $Images(check-hu) \
selected $Images(check-nc) \ selected $Images(check-nc) \
] -sticky w ] -sticky w
style element create Radiobutton.indicator image $Images(radio-nu) \ style element create Radiobutton.indicator image $Images(radio-nu) \
-map [list \ -map [list \
{pressed selected} $Images(radio-nc) \ {pressed selected} $Images(radio-nc) \
@ -88,15 +88,15 @@ namespace eval tile::kroc {
active $Images(radio-hu) \ active $Images(radio-hu) \
selected $Images(radio-nc) \ selected $Images(radio-nc) \
] -sticky w ] -sticky w
} else { } else {
style element create Button.button pixmap -images [list \ style element create Button.button pixmap -images [list \
pressed $Images(button-p) \ pressed $Images(button-p) \
active $Images(button-h) \ active $Images(button-h) \
{} $Images(button-n) \ {} $Images(button-n) \
] -border 3 -tiling tile ] -border 3 -tiling tile
style element create Checkbutton.indicator pixmap -images [list \ style element create Checkbutton.indicator pixmap -images [list \
{pressed selected} $Images(check-nc) \ {pressed selected} $Images(check-nc) \
pressed $Images(check-nu) \ pressed $Images(check-nu) \
@ -105,7 +105,7 @@ namespace eval tile::kroc {
selected $Images(check-nc) \ selected $Images(check-nc) \
{} $Images(check-nu) \ {} $Images(check-nu) \
] -tiling fixed ] -tiling fixed
style element create Radiobutton.indicator pixmap -images [list \ style element create Radiobutton.indicator pixmap -images [list \
{pressed selected} $Images(radio-nc) \ {pressed selected} $Images(radio-nc) \
pressed $Images(radio-nu) \ pressed $Images(radio-nu) \
@ -114,7 +114,7 @@ namespace eval tile::kroc {
selected $Images(radio-nc) \ selected $Images(radio-nc) \
{} $Images(radio-nu) \ {} $Images(radio-nu) \
] -tiling fixed ] -tiling fixed
} }
# #
@ -141,7 +141,7 @@ namespace eval tile::kroc {
} }
} }
} }
style layout TRadiobutton { style layout TRadiobutton {
Radiobutton.border -children { Radiobutton.border -children {
Radiobutton.background Radiobutton.background
@ -153,7 +153,7 @@ namespace eval tile::kroc {
} }
} }
} }
} } } }
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------

Просмотреть файл

@ -4,7 +4,7 @@
# or we don't have the right version of Tcl/Tk # or we don't have the right version of Tcl/Tk
# #
# To use this automatically within tile, the tile-using application should # To use this automatically within tile, the tile-using application should
# use tile::availableThemes and tile::setTheme # use tile::availableThemes and tile::setTheme
# #
# $Id$ # $Id$

Просмотреть файл

@ -4,7 +4,7 @@
# or we don't have the right version of Tcl/Tk # or we don't have the right version of Tcl/Tk
# #
# To use this automatically within tile, the tile-using application should # To use this automatically within tile, the tile-using application should
# use tile::availableThemes and tile::setTheme # use tile::availableThemes and tile::setTheme
# #
# $Id$ # $Id$

Просмотреть файл

@ -7,14 +7,14 @@
# #
# ~ BACKGROUND # ~ BACKGROUND
# #
# Checkbuttons in toolbars have a very different appearance # Checkbuttons in toolbars have a very different appearance
# than regular checkbuttons: there's no indicator, they # than regular checkbuttons: there's no indicator, they
# "pop up" when the mouse is over them, and they appear sunken # "pop up" when the mouse is over them, and they appear sunken
# when selected. # when selected.
# #
# Tk added partial support for toolbar-style buttons in 8.4 # Tk added partial support for toolbar-style buttons in 8.4
# with the "-overrelief" option, and TIP #82 added further # with the "-overrelief" option, and TIP #82 added further
# support with the "-offrelief" option. So to get a toolbar-style # support with the "-offrelief" option. So to get a toolbar-style
# checkbutton, you can configure it with: # checkbutton, you can configure it with:
# #
# checkbutton .cb \ # checkbutton .cb \
@ -34,11 +34,11 @@
# #
# ~ DEMONSTRATION # ~ DEMONSTRATION
# #
# The tile built-in themes (default, "alt", windows, and XP) # The tile built-in themes (default, "alt", windows, and XP)
# already include Toolbutton styles. This script will add # already include Toolbutton styles. This script will add
# them to the "step" and "blue" themes as a demonstration. # them to the "step" and "blue" themes as a demonstration.
# #
# (Note: Pushbuttons and radiobuttons can also use the "Toolbutton" # (Note: Pushbuttons and radiobuttons can also use the "Toolbutton"
# style; see demo.tcl.) # style; see demo.tcl.)
# #
@ -48,7 +48,7 @@ style theme settings "step" {
# First, we use [style layout] to define what elements to # First, we use [style layout] to define what elements to
# use and how they're arranged. Toolbuttons are pretty # use and how they're arranged. Toolbuttons are pretty
# simple, consisting of a border, some internal padding, # simple, consisting of a border, some internal padding,
# and a label. (See also the TScrollbar layout definition # and a label. (See also the TScrollbar layout definition
# in demos/blue.tcl for a more complicated layout spec.) # in demos/blue.tcl for a more complicated layout spec.)
# #
style layout Toolbutton { style layout Toolbutton {
@ -60,8 +60,8 @@ style theme settings "step" {
} }
} }
# (Actually the above isn't strictly necessary, since the same layout # (Actually the above isn't strictly necessary, since the same layout
# is defined in the default theme; we could have inherited it # is defined in the default theme; we could have inherited it
# instead.) # instead.)
# #
# Next, specify default values for element options. # Next, specify default values for element options.
@ -71,17 +71,17 @@ style theme settings "step" {
style default Toolbutton -width 0 -padding 1 -relief flat -borderwidth 2 style default Toolbutton -width 0 -padding 1 -relief flat -borderwidth 2
# #
# Finally, use [style map] to specify state-specific # Finally, use [style map] to specify state-specific
# resource values. We want a flat relief if the widget is # resource values. We want a flat relief if the widget is
# disabled, sunken if it's selected (on) or pressed, # disabled, sunken if it's selected (on) or pressed,
# and raised when it's active (the mouse pointer is # and raised when it's active (the mouse pointer is
# over the widget). Each state-value pair is checked # over the widget). Each state-value pair is checked
# in order, and the first matching state takes precedence. # in order, and the first matching state takes precedence.
# #
style map Toolbutton -relief { style map Toolbutton -relief {
disabled flat disabled flat
selected sunken selected sunken
pressed sunken pressed sunken
active raised active raised
} }
} }
@ -107,10 +107,10 @@ style theme settings "blue" {
# #
style map Toolbutton -relief { style map Toolbutton -relief {
disabled flat disabled flat
selected sunken selected sunken
pressed sunken pressed sunken
active raised active raised
} }
# #
# Adjust the -padding at the same time, to enhance # Adjust the -padding at the same time, to enhance
@ -138,7 +138,7 @@ style theme settings "blue" {
} }
# #
# ~ A final note: # ~ A final note:
# #
# TIP #82 also says: "When -indicatoron is off and the button itself # TIP #82 also says: "When -indicatoron is off and the button itself
# is on, the relief continues to be hard-coded to sunken. For symmetry, # is on, the relief continues to be hard-coded to sunken. For symmetry,

Просмотреть файл

@ -1,12 +1,12 @@
[ TkHtml widget example ] [ TkHtml widget example ]
The directory page1 -- page4 are referd from "test" directory of The directory page1 -- page4 are referd from "test" directory of
original TkHtml extension's source archive. original TkHtml extension's source archive.
( see http://www.hwaci.com/sw/tkhtml/index.html ) ( see http://www.hwaci.com/sw/tkhtml/index.html )
You can see the HTML documents on the 'hv.rb' or 'ss.rb' sample script. You can see the HTML documents on the 'hv.rb' or 'ss.rb' sample script.
e.g. e.g.
LD_LIBRARY_PATH=/usr/local/ActiveTcl/lib:$LD_LIBRARY_PATH /usr/local/bin/ruby ./hv.rb page1/index.html LD_LIBRARY_PATH=/usr/local/ActiveTcl/lib:$LD_LIBRARY_PATH /usr/local/bin/ruby ./hv.rb page1/index.html

Просмотреть файл

@ -10,7 +10,7 @@
<tr> <tr>
<td width="120" valign="TOP"><a href="/"><img src="image1" width="120" height="79" alt="Scriptics" border="0"></a></td> <td width="120" valign="TOP"><a href="/"><img src="image1" width="120" height="79" alt="Scriptics" border="0"></a></td>
<td valign="top" width="548"> <td valign="top" width="548">
<!-- Table to hold tabs --> <!-- Table to hold tabs -->
<table cellpadding="0" cellspacing="0" border="0" width="548"> <table cellpadding="0" cellspacing="0" border="0" width="548">
<tr> <tr>
@ -50,8 +50,8 @@
} }
} }
//--> //-->
</SCRIPT> </SCRIPT>
<!-- MenuSubLevel Resource Software Extensions Tk --> <!-- MenuSubLevel Resource Software Extensions Tk -->
<table cellpadding="0" cellspacing="0" border="0"> <table cellpadding="0" cellspacing="0" border="0">
@ -186,13 +186,13 @@ or higher.
There are also an "<a href="#bltunoff">unofficial</a>" release for 8.0p2 There are also an "<a href="#bltunoff">unofficial</a>" release for 8.0p2
and 8.1a2 that were not done by the author. <a href="/live/annotate?url=http%3a%2f%2fwww%2etcltk%2ecom%2fblt%2f">Edit</a> and 8.1a2 that were not done by the author. <a href="/live/annotate?url=http%3a%2f%2fwww%2etcltk%2ecom%2fblt%2f">Edit</a>
<i><font size="-1">(October 26, 1999 09:43)</font></i><dt><b><a href="http://www.unifix-online.com/BWidget/index.html" ="">BWidget</a></b> <i><font size="-1">(October 26, 1999 09:43)</font></i><dt><b><a href="http://www.unifix-online.com/BWidget/index.html" ="">BWidget</a></b>
<dd>A set of native Tk 8.x Widgets using Tcl8.x namespaces. <dd>A set of native Tk 8.x Widgets using Tcl8.x namespaces.
The ToolKit is available under Unix/X11 and Windows. The ToolKit is available under Unix/X11 and Windows.
The BWidget(s) have a professional look&feel as in other The BWidget(s) have a professional look&feel as in other
well known Toolkits (Tix or Incr Widget) but the concept is well known Toolkits (Tix or Incr Widget) but the concept is
radically different because everything is native radically different because everything is native
so no platform compilation, no compiled extension so no platform compilation, no compiled extension
library are needed. The code is 100 Pure Tcl/Tk. library are needed. The code is 100 Pure Tcl/Tk.
More 30 components : Notebook, PageManager, Tree, PanedWindow, ButtonBox, More 30 components : Notebook, PageManager, Tree, PanedWindow, ButtonBox,
ScrollView, ComboBox, SpinBox, ListBox, SelectFont, SelectColor, ScrollView, ComboBox, SpinBox, ListBox, SelectFont, SelectColor,
ProgressBare ... <a href="/live/annotate?url=http%3a%2f%2fwww%2eunifix%2donline%2ecom%2fBWidget%2findex%2ehtml">Edit</a> ProgressBare ... <a href="/live/annotate?url=http%3a%2f%2fwww%2eunifix%2donline%2ecom%2fBWidget%2findex%2ehtml">Edit</a>
@ -220,10 +220,10 @@ Unix). The console itself provides many more features than the standard console.
<dd>This project seeks to integrate the Tk toolkit <dd>This project seeks to integrate the Tk toolkit
with the Frontier scripting language. <a href="/live/annotate?url=http%3a%2f%2fwww%2escriptmeridian%2eorg%2fprojects%2ftk%2f">Edit</a> with the Frontier scripting language. <a href="/live/annotate?url=http%3a%2f%2fwww%2escriptmeridian%2eorg%2fprojects%2ftk%2f">Edit</a>
<i><font size="-1">(August 19, 1999 15:36)</font></i><dt><b><a href="http://purl.oclc.org/net/nijtmans/img.html" ="">Img image format extension</a></b> <i><font size="-1">(August 19, 1999 15:36)</font></i><dt><b><a href="http://purl.oclc.org/net/nijtmans/img.html" ="">Img image format extension</a></b>
<dd>This package enhances Tk, adding support for many other Image formats: <dd>This package enhances Tk, adding support for many other Image formats:
BMP, XBM, XPM, GIF (with transparency), PNG, BMP, XBM, XPM, GIF (with transparency), PNG,
JPEG, TIFF and postscript. JPEG, TIFF and postscript.
This is implemented as a shared library that can be dynamically loaded into This is implemented as a shared library that can be dynamically loaded into
Tcl/Tk. Tcl/Tk.
<a href="/live/annotate?url=http%3a%2f%2fpurl%2eoclc%2eorg%2fnet%2fnijtmans%2fimg%2ehtml">Edit</a> <a href="/live/annotate?url=http%3a%2f%2fpurl%2eoclc%2eorg%2fnet%2fnijtmans%2fimg%2ehtml">Edit</a>
<i><font size="-1">(November 21, 1999 06:35)</font></i><dt><b><a href="http://purl.oclc.org/net/oakley/tcl/mclistbox/index.html" ="">mclistbox - a multi-column listbox widget</a></b> <i><font size="-1">(November 21, 1999 06:35)</font></i><dt><b><a href="http://purl.oclc.org/net/oakley/tcl/mclistbox/index.html" ="">mclistbox - a multi-column listbox widget</a></b>
@ -234,7 +234,7 @@ requires no other extensions; it is completely
standalone. <a href="/live/annotate?url=http%3a%2f%2fpurl%2eoclc%2eorg%2fnet%2foakley%2ftcl%2fmclistbox%2findex%2ehtml">Edit</a> standalone. <a href="/live/annotate?url=http%3a%2f%2fpurl%2eoclc%2eorg%2fnet%2foakley%2ftcl%2fmclistbox%2findex%2ehtml">Edit</a>
<i><font size="-1">(August 19, 1999 15:37)</font></i><dt><b><a href="http://home.t-online.de/home/dshepherd/tkview.htm" ="">MFC views C++ class for embedding Tk</a></b> <i><font size="-1">(August 19, 1999 15:37)</font></i><dt><b><a href="http://home.t-online.de/home/dshepherd/tkview.htm" ="">MFC views C++ class for embedding Tk</a></b>
<dd>The idea of embedding Tk in MFC windows always seemed very enticing but information was sparse and contradictory - on a <dd>The idea of embedding Tk in MFC windows always seemed very enticing but information was sparse and contradictory - on a
scale between "very easy" and "not yet possible". The only thing for it was to have a go and lo, it wasn't that hard after all. scale between "very easy" and "not yet possible". The only thing for it was to have a go and lo, it wasn't that hard after all.
CTkView is a C++ class which can be used in MFC SDI or MDI applications. An instance of CTkView hosts an embedded Tk CTkView is a C++ class which can be used in MFC SDI or MDI applications. An instance of CTkView hosts an embedded Tk
toplevel widget and performs some management chores for the widget so that it can size, update and react correctly to Windows toplevel widget and performs some management chores for the widget so that it can size, update and react correctly to Windows
events. <a href="/live/annotate?url=http%3a%2f%2fhome%2et%2donline%2ede%2fhome%2fdshepherd%2ftkview%2ehtm">Edit</a> events. <a href="/live/annotate?url=http%3a%2f%2fhome%2et%2donline%2ede%2fhome%2fdshepherd%2ftkview%2ehtm">Edit</a>
@ -244,7 +244,7 @@ standalone. <a href="/live/annotate?url=http%3a%2f%2fpurl%2eoclc%2eorg%2fnet%2fo
Works with <b>8.0</b> Works with <b>8.0</b>
<br>Download: <a href="http://www.cs.umd.edu/hcil/pad++/download.html">download.html</a><br>Pad++ is a Tk widget that provides a Zoomable User Interface (ZUI) that supports real-time interactive zoomable graphics in a fashion similar to the Tk Canvas widget. Pad++ supports tens of thousands of objects which include text, images, graphics, portals, lenses, simple html (and more), including transparency and rotation. <a href="/live/annotate?url=http%3a%2f%2fwww%2ecs%2eumd%2eedu%2fhcil%2fpad%2b%2b">Edit</a> <br>Download: <a href="http://www.cs.umd.edu/hcil/pad++/download.html">download.html</a><br>Pad++ is a Tk widget that provides a Zoomable User Interface (ZUI) that supports real-time interactive zoomable graphics in a fashion similar to the Tk Canvas widget. Pad++ supports tens of thousands of objects which include text, images, graphics, portals, lenses, simple html (and more), including transparency and rotation. <a href="/live/annotate?url=http%3a%2f%2fwww%2ecs%2eumd%2eedu%2fhcil%2fpad%2b%2b">Edit</a>
<i><font size="-1">(August 19, 1999 15:39)</font></i><dt><b><a href="http://home.t-online.de/home/sesam.com/freeware.htm" ="">Progressbar</a></b> <i><font size="-1">(August 19, 1999 15:39)</font></i><dt><b><a href="http://home.t-online.de/home/sesam.com/freeware.htm" ="">Progressbar</a></b>
<dd>Progressbar is a megawidget written in pure tcl (ie: no compiling required - runs on all platforms Macintosh, Unix, Windows). <dd>Progressbar is a megawidget written in pure tcl (ie: no compiling required - runs on all platforms Macintosh, Unix, Windows).
Its primary purpose is to show the progress of any action in percent. <a href="/live/annotate?url=http%3a%2f%2fhome%2et%2donline%2ede%2fhome%2fsesam%2ecom%2ffreeware%2ehtm">Edit</a> Its primary purpose is to show the progress of any action in percent. <a href="/live/annotate?url=http%3a%2f%2fhome%2et%2donline%2ede%2fhome%2fsesam%2ecom%2ffreeware%2ehtm">Edit</a>
<i><font size="-1">(January 24, 2000 09:19)</font></i><dt><b><a href="http://jfontain.free.fr/" ="">scwoop (Simple Composite Widget Object Oriented Package)</a></b> <i><font size="-1">(January 24, 2000 09:19)</font></i><dt><b><a href="http://jfontain.free.fr/" ="">scwoop (Simple Composite Widget Object Oriented Package)</a></b>
<dd>Scwoop is a composite widget (also known as mega widget) extension to the great Tk widget library. Scwoop is <dd>Scwoop is a composite widget (also known as mega widget) extension to the great Tk widget library. Scwoop is
@ -287,7 +287,7 @@ pie charts on a Tk canvas. <a href="/live/annotate?url=http%3a%2f%2fjfontain%2ef
<dd>TkPrint is an extension that allows you to print from a <dd>TkPrint is an extension that allows you to print from a
Tk widget. <a href="/live/annotate?url=http%3a%2f%2fwww%2ecygnus%2ecom%2f%7eirox%2ftkprint%2f">Edit</a> Tk widget. <a href="/live/annotate?url=http%3a%2f%2fwww%2ecygnus%2ecom%2f%7eirox%2ftkprint%2f">Edit</a>
<i><font size="-1">(October 11, 1999 09:58)</font></i><dt><b><a href="http://www.purl.org/net/hobbs/tcl/capp/" ="">TkTable Home Page</a></b> <i><font size="-1">(October 11, 1999 09:58)</font></i><dt><b><a href="http://www.purl.org/net/hobbs/tcl/capp/" ="">TkTable Home Page</a></b>
<dd>The TkTable widget. The <code>table</code> command creates a <dd>The TkTable widget. The <code>table</code> command creates a
2-dimensional grid of cells. The table can use a Tcl array variable or Tcl 2-dimensional grid of cells. The table can use a Tcl array variable or Tcl
command for data storage and retrieval. <a href="/live/annotate?url=http%3a%2f%2fwww%2epurl%2eorg%2fnet%2fhobbs%2ftcl%2fcapp%2f">Edit</a> command for data storage and retrieval. <a href="/live/annotate?url=http%3a%2f%2fwww%2epurl%2eorg%2fnet%2fhobbs%2ftcl%2fcapp%2f">Edit</a>
@ -303,14 +303,14 @@ command for data storage and retrieval. <a href="/live/annotate?url=http%3a%2f%2
distribution. <a href="/live/annotate?url=http%3a%2f%2fftp%2eaustintx%2enet%2fusers%2fjatucker%2fTkTextmatrix%2fdefault%2ehtm">Edit</a> distribution. <a href="/live/annotate?url=http%3a%2f%2fftp%2eaustintx%2enet%2fusers%2fjatucker%2fTkTextmatrix%2fdefault%2ehtm">Edit</a>
<i><font size="-1">(August 23, 1999 12:14)</font></i><dt><b><a href="http://www.cs.umd.edu/~bederson/Togl.html" ="">ToGL - a Tk Open GL widget</a></b> <i><font size="-1">(August 23, 1999 12:14)</font></i><dt><b><a href="http://www.cs.umd.edu/~bederson/Togl.html" ="">ToGL - a Tk Open GL widget</a></b>
<dd>Togl is a Tk widget for OpenGL rendering. Togl is based on OGLTK, originally written by Benjamin Bederson at the <dd>Togl is a Tk widget for OpenGL rendering. Togl is based on OGLTK, originally written by Benjamin Bederson at the
University of New Mexico (who has since moved to the University of Maryland). Togl adds the new features: University of New Mexico (who has since moved to the University of Maryland). Togl adds the new features:
<ul> <ul>
<li> color-index mode support including color allocation functions <li> color-index mode support including color allocation functions
<li> support for requesting stencil, accumulation, alpha buffers, etc <li> support for requesting stencil, accumulation, alpha buffers, etc
<li> multiple OpenGL drawing widgets <li> multiple OpenGL drawing widgets
<li> OpenGL extension testing from Tcl <li> OpenGL extension testing from Tcl
<li> simple, portable font support <li> simple, portable font support
<li> overlay plane support <li> overlay plane support
</ul> </ul>
Togl allows one to create and manage a special Tk/OpenGL widget with Tcl and render into it with a C program. That is, Togl allows one to create and manage a special Tk/OpenGL widget with Tcl and render into it with a C program. That is,
a typical Togl program will have Tcl code for managing the user interface and a C program for computations and a typical Togl program will have Tcl code for managing the user interface and a C program for computations and
@ -383,7 +383,7 @@ tree. The tree can be displayed horizontally or vertically.
Works with <b>Tcl/Tk 8.0 or higher</b> Works with <b>Tcl/Tk 8.0 or higher</b>
<br>Download: <a href="http://www.purl.org/net/hobbs/tcl/script/widget/widget-0.9.tar.gz">widget-0.9.tar.gz</a><br>This is a package of <br>Download: <a href="http://www.purl.org/net/hobbs/tcl/script/widget/widget-0.9.tar.gz">widget-0.9.tar.gz</a><br>This is a package of
megawidgets (i.e., compound widgets) that work almost exactly like Tk widgets. megawidgets (i.e., compound widgets) that work almost exactly like Tk widgets.
You can also build your own new megawidgets. You can also build your own new megawidgets.
Includes: combobox, hierarchy, console, progressbar, Includes: combobox, hierarchy, console, progressbar,
tabnotebook, validating entry, pane geometry manager, baloon help. <a href="/live/annotate?url=http%3a%2f%2fwww%2epurl%2eorg%2fnet%2fhobbs%2ftcl%2fscript%2fwidget%2f">Edit</a> tabnotebook, validating entry, pane geometry manager, baloon help. <a href="/live/annotate?url=http%3a%2f%2fwww%2epurl%2eorg%2fnet%2fhobbs%2ftcl%2fscript%2fwidget%2f">Edit</a>
<i><font size="-1">(August 23, 1999 12:16)</font></i></dl> <i><font size="-1">(August 23, 1999 12:16)</font></i></dl>
@ -419,15 +419,15 @@ tabnotebook, validating entry, pane geometry manager, baloon help. <a href="/liv
over[9].src = "http://images.scriptics.com/images/homeMainRollover3.gif" over[9].src = "http://images.scriptics.com/images/homeMainRollover3.gif"
} }
function MakeImageArray(n) { function MakeImageArray(n) {
this.length = n this.length = n
for (var i = 0; i<=n; i++)="i++)" {="{" this[i]="this[i]" ="" new="new" Image()="Image()" }="}" return="return" this="this" }="}" //="//" --="--"> for (var i = 0; i<=n; i++)="i++)" {="{" this[i]="this[i]" ="" new="new" Image()="Image()" }="}" return="return" this="this" }="}" //="//" --="--">
</SCRIPT><br> </SCRIPT><br>
<font size="2"> <font size="2">
&copy; 1998-2000 Scriptics Corporation. All rights reserved. &copy; 1998-2000 Scriptics Corporation. All rights reserved.
<a href="/legal_notice.html">Legal Notice</a> | <A href="" /privacy.html="/privacy.html"> <a href="/legal_notice.html">Legal Notice</a> | <A href="" /privacy.html="/privacy.html">
Privacy Statement</a> Privacy Statement</a>
</td></tr></table></td></tr></table> </td></tr></table></td></tr></table>
</Body> </Body>
</Html> </Html>

Просмотреть файл

@ -218,7 +218,7 @@
<h2 align="center">How To Compile Under Unix Without Installing Tcl</h2> <h2 align="center">How To Compile Under Unix Without Installing Tcl</h2>
<p><p>Specify the *.a file directly:</p> <p><p>Specify the *.a file directly:</p>
<blockquote><pre> <blockquote><pre>
$ gcc -I../tcl8.2.2/generic hello.c \ $ gcc -I../tcl8.2.2/generic hello.c \
../tcl8.2.2/unix/libtcl8.2.a -lm -ldl ../tcl8.2.2/unix/libtcl8.2.a -lm -ldl
$ strip a.out $ strip a.out
$ ./a.out $ ./a.out
@ -226,7 +226,7 @@
<p>Or, tell the C compiler where to look for *.a files:</p> <p>Or, tell the C compiler where to look for *.a files:</p>
<blockquote><pre> <blockquote><pre>
$ gcc -I../tcl8.2.2/generic hello.c \ $ gcc -I../tcl8.2.2/generic hello.c \
-L../tcl8.2.2/unix -ltcl -lm -ldl -L../tcl8.2.2/unix -ltcl -lm -ldl
$ strip a.out $ strip a.out
$ ./a.out $ ./a.out
@ -982,7 +982,7 @@ int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
<br clear="both"><p><hr></p> <br clear="both"><p><hr></p>
<h2 align="center">Linkage From Tcl To C</h2> <h2 align="center">Linkage From Tcl To C</h2>
<p><p align="center"><img src="image4"></p></p><p><ul><li>3rd parameter of Tcl_CreateCommand() is a pointer to the C subroutine <p><p align="center"><img src="image4"></p></p><p><ul><li>3rd parameter of Tcl_CreateCommand() is a pointer to the C subroutine
that implements the command.</li></ul><ul><li>4th parameter to Tcl_CreateCommand() becomes the 1st parameter to that implements the command.</li></ul><ul><li>4th parameter to Tcl_CreateCommand() becomes the 1st parameter to
the C routine whenever the Tcl command is executed.</li></ul><ul><li>1st parameter to Tcl_CreateCommand() must be a valid Tcl interpreter. the C routine whenever the Tcl command is executed.</li></ul><ul><li>1st parameter to Tcl_CreateCommand() must be a valid Tcl interpreter.
The same pointer appears as the second parameter to the C routine The same pointer appears as the second parameter to the C routine
whenever the Tcl command is executed.</li></ul></p> whenever the Tcl command is executed.</li></ul></p>
@ -990,7 +990,7 @@ int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
<br clear="both"><p><hr></p> <br clear="both"><p><hr></p>
<h2 align="center">Linkage From Tcl To C</h2> <h2 align="center">Linkage From Tcl To C</h2>
<p><p align="center"><img src="image5"></p></p><p><ul><li>5th parameter of Tcl_CreateCommand() is a pointer to the C subroutine <p><p align="center"><img src="image5"></p></p><p><ul><li>5th parameter of Tcl_CreateCommand() is a pointer to the C subroutine
that is called when the Tcl command is deleted.</li></ul><ul><li>4th parameter to Tcl_CreateCommand() becomes the 1st parameter to that is called when the Tcl command is deleted.</li></ul><ul><li>4th parameter to Tcl_CreateCommand() becomes the 1st parameter to
the C routine.</li></ul></p> the C routine.</li></ul></p>
<br clear="both"><p><hr></p> <br clear="both"><p><hr></p>
@ -1035,7 +1035,7 @@ pack&nbsp;.b</tt></small></td>
<br clear="both"><p><hr></p> <br clear="both"><p><hr></p>
<h2 align="center">Linkage From Tcl To C</h2> <h2 align="center">Linkage From Tcl To C</h2>
<p>The <tt>argc</tt> and <tt>argv</tt> parameters work just like in <p>The <tt>argc</tt> and <tt>argv</tt> parameters work just like in
<tt>main()</tt></p><p> <tt>main()</tt></p><p>
<table cellspacing="0" cellpadding="0" border="0"> <table cellspacing="0" cellpadding="0" border="0">
<tr><td valign="center"> <tr><td valign="center">
@ -1139,7 +1139,7 @@ pack&nbsp;.b</tt></small></td>
<td></td><td></td><td></td><td></td> <td></td><td></td><td></td><td></td>
</tr> </tr>
</table> </table>
<p><ul><li>Result should be the text of an error message if you <p><ul><li>Result should be the text of an error message if you
return TCL_ERROR.</li></ul><ul><li>3rd argument to Tcl_SetResult() can be TCL_STATIC, return TCL_ERROR.</li></ul><ul><li>3rd argument to Tcl_SetResult() can be TCL_STATIC,
TCL_DYNAMIC, TCL_VOLATILE, or a function pointer.</li></ul><ul><li>Also consider using Tcl_AppendResult().</li></ul><ul><li>Direct access to <tt>interp->result</tt> is deprecated.</li></ul><ul><li>See the man pages for details.</li></ul></p> TCL_DYNAMIC, TCL_VOLATILE, or a function pointer.</li></ul><ul><li>Also consider using Tcl_AppendResult().</li></ul><ul><li>Direct access to <tt>interp->result</tt> is deprecated.</li></ul><ul><li>See the man pages for details.</li></ul></p>
@ -1443,7 +1443,7 @@ int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
<h2 align="center">Initialization Scripts</h2> <h2 align="center">Initialization Scripts</h2>
<p><ul><li>Run the mini TCLSH implemented above and execute the <tt>parray</tt> command</li></ul><ul><li>It doesn't work! What's wrong? </p></li></li></ul><ul><li><tt>parray</tt> is really a Tcl proc that is read in when the <p><ul><li>Run the mini TCLSH implemented above and execute the <tt>parray</tt> command</li></ul><ul><li>It doesn't work! What's wrong? </p></li></li></ul><ul><li><tt>parray</tt> is really a Tcl proc that is read in when the
interpreter is initialized. </p></li></li></ul><ul><li><tt>parray</tt> (and several other commands) are stored in a interpreter is initialized. </p></li></li></ul><ul><li><tt>parray</tt> (and several other commands) are stored in a
handful of &quot;Initialization Scripts&quot; </p></li></li></ul><ul><li>All the initialization scripts are stored in the handful of &quot;Initialization Scripts&quot; </p></li></li></ul><ul><li>All the initialization scripts are stored in the
&quot;Tcl Library&quot; - a directory on the host &quot;Tcl Library&quot; - a directory on the host
computer. </p></li></li></ul><table><tr><td valign="top"><img src="image3"></td> computer. </p></li></li></ul><table><tr><td valign="top"><img src="image3"></td>
<td valign="top"><b>Invoke the Tcl_Init() function to locate and read the <td valign="top"><b>Invoke the Tcl_Init() function to locate and read the
@ -1668,8 +1668,8 @@ int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
</ul></li></ul><ul><li>Allows us to implement a virtual filesystem that overlays the </ul></li></ul><ul><li>Allows us to implement a virtual filesystem that overlays the
real filesystem.</li></ul><ul><li>The virtual filesystem contains all the initialization scripts real filesystem.</li></ul><ul><li>The virtual filesystem contains all the initialization scripts
as compiled-in strings. The initialization scripts look like as compiled-in strings. The initialization scripts look like
they are resident on disk even though they are built in.</li></ul><ul><li>These functions first appeared in Tcl8.0.3. they are resident on disk even though they are built in.</li></ul><ul><li>These functions first appeared in Tcl8.0.3.
Presumably to support TclPro Wrapper.</li></ul><ul><li>The only documentation is comments on the code. Presumably to support TclPro Wrapper.</li></ul><ul><li>The only documentation is comments on the code.
See the Tcl source file <tt>generic/tclIOUtil.c</tt></li></ul></p> See the Tcl source file <tt>generic/tclIOUtil.c</tt></li></ul></p>
<br clear="both"><p><hr></p> <br clear="both"><p><hr></p>
<h2 align="center">The <tt>TclStatInsertProc()</tt> Function</h2> <h2 align="center">The <tt>TclStatInsertProc()</tt> Function</h2>
@ -1997,7 +1997,7 @@ int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
<h2 align="center">Compiling "Hello, World!" For Tk</h2> <h2 align="center">Compiling "Hello, World!" For Tk</h2>
<p><p><b>Unix:</b></p> <p><p><b>Unix:</b></p>
<blockquote><pre> <blockquote><pre>
$ gcc hello.c -ltk -L/usr/X11R6/lib \ $ gcc hello.c -ltk -L/usr/X11R6/lib \
-lX11 -ltcl -lm -ldl -lX11 -ltcl -lm -ldl
$ ./a.out</pre></blockquote> $ ./a.out</pre></blockquote>
@ -2008,7 +2008,7 @@ int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
<p><b>Windows using Mingw32:</b></p> <p><b>Windows using Mingw32:</b></p>
<blockquote><pre> <blockquote><pre>
C:> gcc -mno-cygwin hello.c -mwindows \ C:> gcc -mno-cygwin hello.c -mwindows \
-ltk82 -ltcl82 -lm -ltk82 -ltcl82 -lm
C:> a.exe</pre></blockquote></p> C:> a.exe</pre></blockquote></p>
<br clear="both"><p><hr></p> <br clear="both"><p><hr></p>
@ -2162,7 +2162,7 @@ int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
<li> FreeWrap - http://www.albany.net/~dlabelle/freewrap/freewrap.html </li> <li> FreeWrap - http://www.albany.net/~dlabelle/freewrap/freewrap.html </li>
<li> Wrap - http://members1.chello.nl/~j.nijtmans/wrap.html </li> <li> Wrap - http://members1.chello.nl/~j.nijtmans/wrap.html </li>
</ul></li></ul><ul><li>No C compiler required!</li></ul><ul><li>TclPro will convert Tcl script into bytecode so that it cannot be </ul></li></ul><ul><li>No C compiler required!</li></ul><ul><li>TclPro will convert Tcl script into bytecode so that it cannot be
easily read by the end user. FreeWrap encrypts the scripts.</li></ul><ul><li>FreeWrap uses compression on its executable. easily read by the end user. FreeWrap encrypts the scripts.</li></ul><ul><li>FreeWrap uses compression on its executable.
Wrap uses compression on both the executable and on the bundled script files.</li></ul><ul><li>Usually include extensions like winico and/or BLT</li></ul></p></td></tr></table> Wrap uses compression on both the executable and on the bundled script files.</li></ul><ul><li>Usually include extensions like winico and/or BLT</li></ul></p></td></tr></table>
<br clear="both"><p><hr></p> <br clear="both"><p><hr></p>
@ -2170,8 +2170,8 @@ int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
<table><tr><td valign="top"><img src="image9"></td> <table><tr><td valign="top"><img src="image9"></td>
<td valign="top"><p><ul><li>Mix C/C++ with Tcl/Tk into a standalone binary</li></ul> <td valign="top"><p><ul><li>Mix C/C++ with Tcl/Tk into a standalone binary</li></ul>
<ul><li><tt>mktclapp</tt> generates an application initialization file <ul><li><tt>mktclapp</tt> generates an application initialization file
that contains Tcl scripts as strings and makes all necessary calls that contains Tcl scripts as strings and makes all necessary calls
to <tt>Tcl_Init</tt>, <tt>Tcl_CreateCommand</tt>, to <tt>Tcl_Init</tt>, <tt>Tcl_CreateCommand</tt>,
<tt>Tcl</tt>*<tt>InsertProc</tt>, etc.</li></ul><ul><li>Features to make it easier to write new Tcl command in C</li></ul><ul><li><tt>xmktclapp.tcl</tt> provides a GUI interface to <tt>mktclapp</tt></li></ul><ul><li>http://www.hwaci.com/sw/mktclapp/</li></ul></p></td></tr></table> <tt>Tcl</tt>*<tt>InsertProc</tt>, etc.</li></ul><ul><li>Features to make it easier to write new Tcl command in C</li></ul><ul><li><tt>xmktclapp.tcl</tt> provides a GUI interface to <tt>mktclapp</tt></li></ul><ul><li>http://www.hwaci.com/sw/mktclapp/</li></ul></p></td></tr></table>
<br clear="both"><p><hr></p> <br clear="both"><p><hr></p>
@ -2400,7 +2400,7 @@ int&nbsp;ET_OBJCOMMAND_add2(ET_OBJARGS){<br>
<h2 align="center">Locations Of Libraries</h2> <h2 align="center">Locations Of Libraries</h2>
<table><tr><td valign="top"><img src="image13"></td> <table><tr><td valign="top"><img src="image13"></td>
<td valign="top"><p><ul><li>Tells mktclapp where to look for script libraries.</li></ul><ul><li>All Tcl scripts in the indicated directories are <td valign="top"><p><ul><li>Tells mktclapp where to look for script libraries.</li></ul><ul><li>All Tcl scripts in the indicated directories are
compiled into the <tt>appinit.c</tt> file.</li></ul><ul><li>Comments and extra white-space are removed. compiled into the <tt>appinit.c</tt> file.</li></ul><ul><li>Comments and extra white-space are removed.
There is no way to turn this off.</li></ul></p></td></tr></table> There is no way to turn this off.</li></ul></p></td></tr></table>
<br clear="both"><p><hr></p> <br clear="both"><p><hr></p>
@ -2607,10 +2607,10 @@ int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){</tt></small></td>
<br clear="both"><p><hr></p> <br clear="both"><p><hr></p>
<h2 align="center">Mktclapp Initialization Sequence</h2> <h2 align="center">Mktclapp Initialization Sequence</h2>
<p><ul><li>Initialization starts when the <tt>Et_Init()</tt> <p><ul><li>Initialization starts when the <tt>Et_Init()</tt>
function is called either by client code or by function is called either by client code or by
the <tt>main()</tt> that mktclapp generates</li></ul><ul><li>Create the main Tcl interpreter</li></ul><ul><li>Construct the virtual filesystem overlay by redefining the <tt>main()</tt> that mktclapp generates</li></ul><ul><li>Create the main Tcl interpreter</li></ul><ul><li>Construct the virtual filesystem overlay by redefining
the <tt>source</tt> command and by using the the <tt>source</tt> command and by using the
<tt>Tcl</tt>*<tt>InsertProc()</tt> functions</li></ul><ul><li>Call <tt>Et_PreInit()</tt> if the client defines it</li></ul><ul><li>Call <tt>Tcl_Init()</tt> and <tt>Tk_Init()</tt></li></ul><ul><li>Call <tt>Tcl_CreateCommand()</tt> and <tt>Tcl_CreateObjCommand()</tt> <tt>Tcl</tt>*<tt>InsertProc()</tt> functions</li></ul><ul><li>Call <tt>Et_PreInit()</tt> if the client defines it</li></ul><ul><li>Call <tt>Tcl_Init()</tt> and <tt>Tk_Init()</tt></li></ul><ul><li>Call <tt>Tcl_CreateCommand()</tt> and <tt>Tcl_CreateObjCommand()</tt>
for every <tt>ET_COMMAND_</tt>* and <tt>ET_OBJCOMMAND_</tt>* function for every <tt>ET_COMMAND_</tt>* and <tt>ET_OBJCOMMAND_</tt>* function
in the client code</li></ul><ul><li>Call <tt>Et_AppInit()</tt> if the client defines it</li></ul><ul><li>Run the main Tcl script if there is one</li></ul><ul><li>Call <tt>Et_CustomMainLoop()</tt> if defined by client code or in the client code</li></ul><ul><li>Call <tt>Et_AppInit()</tt> if the client defines it</li></ul><ul><li>Run the main Tcl script if there is one</li></ul><ul><li>Call <tt>Et_CustomMainLoop()</tt> if defined by client code or
@ -2680,7 +2680,7 @@ void&nbsp;ErrMsg(char&nbsp;*zMsg){<br>
<ul><li> <ul><li>
The command that gets executed is: The command that gets executed is:
<pre> <pre>
tk_messageBox -icon error -msg \ tk_messageBox -icon error -msg \
{Syntax error near "}"} -type ok {Syntax error near "}"} -type ok
</pre> </pre>
</li></ul> </li></ul>
@ -2708,7 +2708,7 @@ void&nbsp;ErrMsg(char&nbsp;*zMsg){<br>
<p><ul><li>The <tt></tt> puts a backslash before all characters that <p><ul><li>The <tt></tt> puts a backslash before all characters that
are special to Tcl</li></ul><ul><li>The Tcl command becomes: are special to Tcl</li></ul><ul><li>The Tcl command becomes:
<pre> <pre>
tk_messageBox -icon error -msg \ tk_messageBox -icon error -msg \
"Syntax error near \"\}\"" -type ok "Syntax error near \"\}\"" -type ok
</pre></li></ul></p> </pre></li></ul></p>

Просмотреть файл

@ -30,7 +30,7 @@ MODIFICATIONS.
GOVERNMENT USE: If you are acquiring this software on behalf of the GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights" U.S. government, the Government shall have only "Restricted Rights"
in the software and related documentation as defined in the Federal in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the software shall be classified as "Commercial Computer Software" and the
@ -38,4 +38,4 @@ Government shall have only "Restricted Rights" as defined in Clause
252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
authors grant the U.S. Government and others acting in its behalf authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the permission to use and distribute the software in accordance with the
terms specified in this license. terms specified in this license.

Просмотреть файл

@ -1,3 +1,3 @@
The script 'demo.rb' is based on 'demo.tcl' of Tcl/Tk's 'Img' extention. The script 'demo.rb' is based on 'demo.tcl' of Tcl/Tk's 'Img' extention.
Image data in 'demo.rb' is those of 'demo.tcl'. Image data in 'demo.rb' is those of 'demo.tcl'.
Please read 'license_terms_of_Img_extension' file. Please read 'license_terms_of_Img_extension' file.

Просмотреть файл

@ -1,2 +1,2 @@
The scripts and image files in this directory are based on demo files The scripts and image files in this directory are based on demo files
of Tcl/Tk's TreeCtrl extention. of Tcl/Tk's TreeCtrl extention.

Просмотреть файл

@ -1 +1 @@
win32ole.o : win32ole.c $(hdrdir)/ruby.h $(hdrdir)/config.h $(hdrdir)/defines.h win32ole.o : win32ole.c $(hdrdir)/ruby.h $(hdrdir)/config.h $(hdrdir)/defines.h