fxri 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/bugs/fxri bug `concat' can't convert nil into Array (TypeError).eml +50 -0
- data/bugs/fxri with Ruby v1.8.5 via OneClickInstaller v1.8.5-21.eml +167 -0
- data/fxri +344 -319
- data/fxri-0.3.4.gem +0 -0
- data/fxri.gemspec +24 -24
- data/lib/Empty_Text_Field_Handler.rb +63 -63
- data/lib/FoxDisplayer.rb +148 -148
- data/lib/FoxTextFormatter.rb +274 -274
- data/lib/Globals.rb +50 -48
- data/lib/Icon_Loader.rb +35 -35
- data/lib/Packet_Item.rb +178 -178
- data/lib/Packet_List.rb +192 -192
- data/lib/Recursive_Open_Struct.rb +238 -233
- data/lib/RiManager.rb +159 -154
- data/lib/Search_Engine.rb +165 -165
- data/lib/fxirb-0.2.1/CHANGELOG +31 -0
- data/lib/fxirb-0.2.1/fxirb.rb +395 -0
- data/lib/fxirb.rb +400 -395
- metadata +24 -17
- data/fxri.kpf +0 -66
@@ -0,0 +1,50 @@
|
|
1
|
+
Return-Path: <initcontact@grahamwideman.com>
|
2
|
+
X-Original-To: markus.prinz@qsig.org
|
3
|
+
Delivered-To: cypher@qsig.org
|
4
|
+
Received: from fed1rmmtao07.cox.net (fed1rmmtao07.cox.net [68.230.241.32])
|
5
|
+
by quaternion.qsig.org (Postfix) with ESMTP id 7313144E58B
|
6
|
+
for <markus.prinz@qsig.org>; Sat, 2 Sep 2006 12:10:23 +0200 (CEST)
|
7
|
+
Received: from fed1rmimpo01.cox.net ([70.169.32.71])
|
8
|
+
by fed1rmmtao07.cox.net
|
9
|
+
(InterMail vM.6.01.06.01 201-2131-130-101-20060113) with ESMTP
|
10
|
+
id <20060902101350.JQJJ21457.fed1rmmtao07.cox.net@fed1rmimpo01.cox.net>
|
11
|
+
for <markus.prinz@qsig.org>; Sat, 2 Sep 2006 06:13:50 -0400
|
12
|
+
Received: from gw-p4 ([68.7.44.49])
|
13
|
+
by fed1rmimpo01.cox.net with bizsmtp
|
14
|
+
id HNDl1V00p13fJ3o0000000
|
15
|
+
Sat, 02 Sep 2006 06:13:45 -0400
|
16
|
+
Message-Id: <4.1.20060902031100.003759f8@grahamwideman.com>
|
17
|
+
X-Sender: (Unverified)
|
18
|
+
X-Mailer: QUALCOMM Windows Eudora Pro Version 4.1
|
19
|
+
Date: Sat, 02 Sep 2006 03:14:02 -0700
|
20
|
+
To: markus.prinz@qsig.org
|
21
|
+
From: Graham Wideman <initcontact@grahamwideman.com>
|
22
|
+
Subject: fxri bug: `concat': can't convert nil into Array (TypeError)
|
23
|
+
Mime-Version: 1.0
|
24
|
+
Content-Type: text/plain; charset="us-ascii"
|
25
|
+
|
26
|
+
Markus:
|
27
|
+
|
28
|
+
Using fxri included in the current stable ruby 1.8.4 for Windows.
|
29
|
+
|
30
|
+
Upon selecting Class File, fxri disappears, and this remains in the console
|
31
|
+
window:
|
32
|
+
|
33
|
+
d:/ruby/lib/ruby/1.8/rdoc/ri/ri_descriptions.rb:99:in `concat': can't convert nil into Array (TypeError)
|
34
|
+
from d:/ruby/lib/ruby/1.8/rdoc/ri/ri_descriptions.rb:99:in `merge_in'
|
35
|
+
from d:/ruby/lib/ruby/1.8/rdoc/ri/ri_reader.rb:56:in `get_class'
|
36
|
+
from d:/ruby/lib/ruby/1.8/rdoc/ri/ri_reader.rb:52:in `get_class'
|
37
|
+
from d:/ruby/lib/ruby/gems/1.8/gems/fxri-0.3.3/./lib/RiManager.rb:102:in `report_class_stuff'
|
38
|
+
from d:/ruby/lib/ruby/gems/1.8/gems/fxri-0.3.3/./lib/RiManager.rb:96:in `show'
|
39
|
+
from d:/ruby/lib/ruby/gems/1.8/gems/fxri-0.3.3/./fxri:288:in `on_show'
|
40
|
+
from d:/ruby/lib/ruby/gems/1.8/gems/fxri-0.3.3/./fxri:296:in `show_info'
|
41
|
+
from d:/ruby/lib/ruby/gems/1.8/gems/fxri-0.3.3/./fxri:153:in `build'
|
42
|
+
from d:/ruby/lib/ruby/gems/1.8/gems/fxruby-1.2.6-mswin32/lib/fox12/responder2.rb:57:in `onHandleMsg'
|
43
|
+
from d:/ruby/lib/ruby/gems/1.8/gems/fxri-0.3.3/./fxri:319
|
44
|
+
from d:/ruby/bin/fxri.bat:25
|
45
|
+
-----------------------------------------
|
46
|
+
|
47
|
+
Thanks,
|
48
|
+
|
49
|
+
Graham
|
50
|
+
|
@@ -0,0 +1,167 @@
|
|
1
|
+
Return-Path: <smartgpx@gmail.com>
|
2
|
+
X-Original-To: markus.prinz@qsig.org
|
3
|
+
Delivered-To: cypher@qsig.org
|
4
|
+
Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.237])
|
5
|
+
by quaternion.qsig.org (Postfix) with ESMTP id 1FEAF45A42D
|
6
|
+
for <markus.prinz@qsig.org>; Fri, 1 Sep 2006 08:23:43 +0200 (CEST)
|
7
|
+
Received: by wx-out-0506.google.com with SMTP id t5so856535wxc
|
8
|
+
for <markus.prinz@qsig.org>; Thu, 31 Aug 2006 23:27:09 -0700 (PDT)
|
9
|
+
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
|
10
|
+
s=beta; d=gmail.com;
|
11
|
+
h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references;
|
12
|
+
b=o80C5lQCAe4z4RLhucntkvryUG6yHppbdAwf0PHVjzxlcV+yOtqwO7HcS48xO6Ki89yRj6LVJrlrLJZKjVAafyW4hKYiZi81TipiG+xSqEYPlPlZN/gIXkHpp0Cpn1dD+p5AVk0SiDeak+ChL8RyvpgDUcwQLjz7EOW0oTb9ie8=
|
13
|
+
Received: by 10.90.25.9 with SMTP id 9mr385559agy;
|
14
|
+
Thu, 31 Aug 2006 23:27:09 -0700 (PDT)
|
15
|
+
Received: by 10.90.54.15 with HTTP; Thu, 31 Aug 2006 23:27:08 -0700 (PDT)
|
16
|
+
Message-ID: <533048b70608312327q421f738ct5da10a8d4aba5638@mail.gmail.com>
|
17
|
+
Date: Fri, 1 Sep 2006 07:27:08 +0100
|
18
|
+
From: DeeJay <smartgpx@gmail.com>
|
19
|
+
To: markus.prinz@qsig.org
|
20
|
+
Subject: Re: fxri with Ruby v1.8.5 via OneClickInstaller v1.8.5-21
|
21
|
+
In-Reply-To: <44F7272E.6040302@qsig.org>
|
22
|
+
MIME-Version: 1.0
|
23
|
+
Content-Type: multipart/alternative;
|
24
|
+
boundary="----=_Part_55553_6337346.1157092028967"
|
25
|
+
References: <533048b70608310459t6720f0c1lb13db13155182c85@mail.gmail.com>
|
26
|
+
<44F6F0E3.30206@qsig.org>
|
27
|
+
<533048b70608310850q7c8b80e3ub2985380c8d08226@mail.gmail.com>
|
28
|
+
<44F7272E.6040302@qsig.org>
|
29
|
+
|
30
|
+
------=_Part_55553_6337346.1157092028967
|
31
|
+
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
|
32
|
+
Content-Transfer-Encoding: 7bit
|
33
|
+
Content-Disposition: inline
|
34
|
+
|
35
|
+
On 31/08/06, Markus Prinz <markus.prinz@qsig.org> wrote:
|
36
|
+
>
|
37
|
+
> DeeJay wrote:
|
38
|
+
> > fire up a 'clean' fxri
|
39
|
+
> >
|
40
|
+
> > in the 'search' box, type
|
41
|
+
> >
|
42
|
+
> > shdrlhu [deliberately a 'nonsense' word that I would not expect
|
43
|
+
> to
|
44
|
+
> > find]
|
45
|
+
> >
|
46
|
+
> > and then delete it one character at a time. If you want a genuine search
|
47
|
+
> > term, try 'scintilla'.
|
48
|
+
>
|
49
|
+
> Hm. With the nonsense nothing happened, but when I typed 'scintilla' I
|
50
|
+
> got the string "Fox::FXRegistry#asciiMode?, Fox::FXRegistry#asciiMode?"
|
51
|
+
> inserted into the irb pane upon typing the 'i'. Is your output in the
|
52
|
+
> irb-pane similar?
|
53
|
+
>
|
54
|
+
> > Incidentally, while researching this I found that if I tried to search
|
55
|
+
> for
|
56
|
+
> > 'array' fxri would die
|
57
|
+
> > under me on typing the 3rd letter (the second 'r')
|
58
|
+
> >
|
59
|
+
> > Hypothesis - if you have 2 adjacent Classes with the first 2 characters
|
60
|
+
> of
|
61
|
+
> > their name identical,
|
62
|
+
> > fxri dies when entering the 3rd char of the Second possibility... but
|
63
|
+
> not
|
64
|
+
> > the first.
|
65
|
+
> >
|
66
|
+
> > It happens with arr [cf argument], fal [cf fake], and with 'ra', where
|
67
|
+
> it
|
68
|
+
> > dies on the 2nd char!
|
69
|
+
>
|
70
|
+
> Hm. Nothing happens here when I type it into the search pane, but I'm
|
71
|
+
> using the OCI 185-21 here. I'll test it with the 184-19 and -20 tomorrow.
|
72
|
+
>
|
73
|
+
> > Everything installed via OneClickInstaller 184-19
|
74
|
+
>
|
75
|
+
> Would it be possible for you to try installing the OCI 184-20 or 185-21
|
76
|
+
> and test if the bugs still occur?
|
77
|
+
|
78
|
+
|
79
|
+
Retested with OCI 185-21 on WinXP-home SP1. (185-21 [or later] is where
|
80
|
+
I want to be - I'm not keen on reinstalling earlier versions - I just happen
|
81
|
+
to have a copy of 184-19 still running, although on XP-proSP2.)
|
82
|
+
|
83
|
+
At 185-21 the 'premature exit during search' problem is not apparent. But
|
84
|
+
there are still circumstances I have not isolated where fxri dissappears
|
85
|
+
without warning.
|
86
|
+
|
87
|
+
The 'unexpected input to irb>' problem is still there.
|
88
|
+
|
89
|
+
The following search phrases trigger it -
|
90
|
+
'ascii'
|
91
|
+
'until'
|
92
|
+
'never'
|
93
|
+
'shrd'
|
94
|
+
'Match'
|
95
|
+
'World'
|
96
|
+
|
97
|
+
I note that in each case the string that is injected into irb is the name of
|
98
|
+
an instance method in Fox::, in which the partial search string appears as a
|
99
|
+
substring. The name found is injected twice as it is first found, and again
|
100
|
+
twice as characters are deleted from the search string.
|
101
|
+
|
102
|
+
|
103
|
+
One possibility I thought of and have eliminated: I installed OCI185-21 with
|
104
|
+
RubyGems and Eurokeyboard selected, so I have Windows Envt variables of
|
105
|
+
RUBYOPT=-rubygems and INPUTRC=...... I have tried removing INPUTRC from the
|
106
|
+
Envt [set INPUTRC= ] in case this was upsetting the startup of irb, but it
|
107
|
+
seems to make no difference. Likewise removing RUBYOPT the same way.
|
108
|
+
(Assuming that doing this SET operation from the Command window that fxri is
|
109
|
+
started from is the right way to change its Environment?)
|
110
|
+
|
111
|
+
The fact that ri now finds 15,000 entries makes it more noticable that fxri
|
112
|
+
is very cpu intensive at startup - these tests are on a machine with a
|
113
|
+
1.8Ghz cpu which gets saturated for some time while the index is being
|
114
|
+
populated.
|
115
|
+
|
116
|
+
Regards -
|
117
|
+
|
118
|
+
David
|
119
|
+
Leicester, UK
|
120
|
+
|
121
|
+
------=_Part_55553_6337346.1157092028967
|
122
|
+
Content-Type: text/html; charset=ISO-8859-1
|
123
|
+
Content-Transfer-Encoding: 7bit
|
124
|
+
Content-Disposition: inline
|
125
|
+
|
126
|
+
<br><br>
|
127
|
+
<div><span class="gmail_quote">On 31/08/06, <b class="gmail_sendername">Markus Prinz</b> <<a href="mailto:markus.prinz@qsig.org">markus.prinz@qsig.org</a>> wrote:</span>
|
128
|
+
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">DeeJay wrote:<br>> fire up a 'clean' fxri<br>><br>> in the 'search' box, type<br>><br>> shdrlhu [deliberately a 'nonsense' word that I would not expect to
|
129
|
+
<br>> find]<br>><br>> and then delete it one character at a time. If you want a genuine search<br>> term, try 'scintilla'.<br><br>Hm. With the nonsense nothing happened, but when I typed 'scintilla' I<br>got the string "Fox::FXRegistry#asciiMode?, Fox::FXRegistry#asciiMode?"
|
130
|
+
<br>inserted into the irb pane upon typing the 'i'. Is your output in the<br>irb-pane similar?<br><br>> Incidentally, while researching this I found that if I tried to search for<br>> 'array' fxri would die<br>> under me on typing the 3rd letter (the second 'r')
|
131
|
+
<br>><br>> Hypothesis - if you have 2 adjacent Classes with the first 2 characters of<br>> their name identical,<br>> fxri dies when entering the 3rd char of the Second possibility... but not<br>> the first.
|
132
|
+
<br>><br>> It happens with arr [cf argument], fal [cf fake], and with 'ra', where it<br>> dies on the 2nd char!<br><br>Hm. Nothing happens here when I type it into the search pane, but I'm<br>using the OCI 185-21 here. I'll test it with the 184-19 and -20 tomorrow.
|
133
|
+
<br><br>> Everything installed via OneClickInstaller 184-19<br><br>Would it be possible for you to try installing the OCI 184-20 or 185-21<br>and test if the bugs still occur?</blockquote>
|
134
|
+
<div> </div>
|
135
|
+
<div>Retested with OCI 185-21 on WinXP-home SP1. (185-21 [or later] is where</div>
|
136
|
+
<div>I want to be - I'm not keen on reinstalling earlier versions - I just happen to have a copy of 184-19 still running, although on XP-proSP2.)</div>
|
137
|
+
<div> </div>
|
138
|
+
<div>At 185-21 the 'premature exit during search' problem is not apparent. But there are still circumstances I have not isolated where fxri dissappears without warning.</div>
|
139
|
+
<div> </div>
|
140
|
+
<div>The 'unexpected input to irb>' problem is still there.</div>
|
141
|
+
<div> </div>
|
142
|
+
<div>The following search phrases trigger it -</div>
|
143
|
+
<div> 'ascii'</div>
|
144
|
+
<div> 'until'</div>
|
145
|
+
<div> 'never'</div>
|
146
|
+
<div> 'shrd'</div>
|
147
|
+
<div> 'Match'</div>
|
148
|
+
<div> 'World'</div>
|
149
|
+
<div> </div>
|
150
|
+
<div>I note that in each case the string that is injected into irb is the name of an instance method in Fox::, in which the partial search string appears as a substring. The name found is injected twice as it is first found, and again twice as characters are deleted from the search string.
|
151
|
+
</div>
|
152
|
+
<div> </div>
|
153
|
+
<div> </div>
|
154
|
+
<div>One possibility I thought of and have eliminated: I installed OCI185-21 with RubyGems and Eurokeyboard selected, so I have Windows Envt variables of RUBYOPT=-rubygems and INPUTRC=...... I have tried removing INPUTRC from the Envt [set INPUTRC= ] in case this was upsetting the startup of irb, but it seems to make no difference. Likewise removing RUBYOPT the same way. (Assuming that doing this SET operation from the Command window that fxri is started from is the right way to change its Environment?)
|
155
|
+
</div>
|
156
|
+
<div> </div>
|
157
|
+
<div>The fact that ri now finds 15,000 entries makes it more noticable that fxri is very cpu intensive at startup - these tests are on a machine with a 1.8Ghz cpu which gets saturated for some time while the index is being populated.
|
158
|
+
</div>
|
159
|
+
<div> </div>
|
160
|
+
<div>Regards -</div>
|
161
|
+
<div> </div>
|
162
|
+
<div>David</div>
|
163
|
+
<div>Leicester, UK</div>
|
164
|
+
<div> </div>
|
165
|
+
<div> </div><br> </div>
|
166
|
+
|
167
|
+
------=_Part_55553_6337346.1157092028967--
|
data/fxri
CHANGED
@@ -1,319 +1,344 @@
|
|
1
|
-
#!/bin/env ruby
|
2
|
-
|
3
|
-
# move to directory of this file, so that icons can load correctly.
|
4
|
-
Dir.chdir(File.dirname(File.expand_path(__FILE__)))
|
5
|
-
|
6
|
-
|
7
|
-
# Load FXRuby: try gem, then Fox 1.2, then Fox 1.0
|
8
|
-
begin
|
9
|
-
# try fxruby gem
|
10
|
-
require 'rubygems'
|
11
|
-
require_gem 'fxruby', '= 1.
|
12
|
-
require '
|
13
|
-
require '
|
14
|
-
FOXVERSION="1.
|
15
|
-
include Fox
|
16
|
-
rescue LoadError
|
17
|
-
# no gem? try
|
18
|
-
begin
|
19
|
-
require
|
20
|
-
require
|
21
|
-
FOXVERSION="1.
|
22
|
-
include Fox
|
23
|
-
rescue LoadError
|
24
|
-
# no gem, no
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
require '
|
37
|
-
|
38
|
-
require 'lib/
|
39
|
-
require 'lib/
|
40
|
-
require 'lib/
|
41
|
-
require 'lib/
|
42
|
-
require 'lib/
|
43
|
-
require 'lib/
|
44
|
-
require 'lib/
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
@data.
|
99
|
-
|
100
|
-
@
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
end
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
hs
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
hs =
|
214
|
-
hs.
|
215
|
-
hs.
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
styles.
|
222
|
-
|
223
|
-
#
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
hs
|
230
|
-
|
231
|
-
|
232
|
-
hs
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
hs
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
styles
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
@
|
289
|
-
|
290
|
-
|
291
|
-
end
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
1
|
+
#!/bin/env ruby
|
2
|
+
|
3
|
+
# move to directory of this file, so that icons can load correctly.
|
4
|
+
Dir.chdir(File.dirname(File.expand_path(__FILE__)))
|
5
|
+
|
6
|
+
|
7
|
+
# Load FXRuby: try gem, then Fox 1.2, then Fox 1.0
|
8
|
+
begin
|
9
|
+
# try fxruby gem
|
10
|
+
require 'rubygems'
|
11
|
+
require_gem 'fxruby', '= 1.6'
|
12
|
+
require 'fox16'
|
13
|
+
require 'fox16/colors'
|
14
|
+
FOXVERSION="1.6"
|
15
|
+
include Fox
|
16
|
+
rescue LoadError
|
17
|
+
# no gem? try fox16 direct.
|
18
|
+
begin
|
19
|
+
require 'fox16'
|
20
|
+
require 'fox16/colors'
|
21
|
+
FOXVERSION="1.6"
|
22
|
+
include Fox
|
23
|
+
rescue LoadError
|
24
|
+
# no gem, no fox16? -> die
|
25
|
+
STDERR << "ERROR: You need FXRuby 1.6!"
|
26
|
+
exit
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
require 'thread'
|
31
|
+
#require 'optparse'
|
32
|
+
#require 'ostruct'
|
33
|
+
|
34
|
+
require 'lib/RiManager'
|
35
|
+
require 'lib/Recursive_Open_Struct'
|
36
|
+
require 'lib/Globals'
|
37
|
+
require 'lib/Packet_List'
|
38
|
+
require 'lib/Packet_Item'
|
39
|
+
require 'lib/Empty_Text_Field_Handler'
|
40
|
+
require 'lib/Icon_Loader'
|
41
|
+
require 'lib/Search_Engine'
|
42
|
+
require 'lib/FoxDisplayer'
|
43
|
+
require 'lib/FoxTextFormatter'
|
44
|
+
require 'lib/fxirb'
|
45
|
+
|
46
|
+
=begin
|
47
|
+
# Parse any options passed to fxri and store them in $options
|
48
|
+
$options = OpenStruct.new
|
49
|
+
$options.search_paths = []
|
50
|
+
|
51
|
+
opts = OptionParser.new { |opts|
|
52
|
+
opts.banner = "fxri - A graphical interface to the Ruby documentation.\nUsage: fxri [options]"
|
53
|
+
|
54
|
+
opts.separator ""
|
55
|
+
opts.separator "Specific options:"
|
56
|
+
|
57
|
+
opts.on( "-I", "--search-path [PATH]",
|
58
|
+
"Specify additional search paths to look for ri documentation",
|
59
|
+
"(may be used multiple times)") { |path|
|
60
|
+
$options.search_paths << path if File.directory? path
|
61
|
+
}
|
62
|
+
|
63
|
+
opts.separator ""
|
64
|
+
opts.separator "Common options:"
|
65
|
+
|
66
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
67
|
+
puts opts
|
68
|
+
exit
|
69
|
+
end
|
70
|
+
}
|
71
|
+
|
72
|
+
opts.parse!( ARGV )
|
73
|
+
=end
|
74
|
+
|
75
|
+
# Responsible for application initialization
|
76
|
+
class FXri < FXHorizontalFrame
|
77
|
+
|
78
|
+
# Initializes the XDCC-application.
|
79
|
+
def initialize(p, opts=0, x=0 ,y=0 ,w=0 ,h=0 , pl=DEFAULT_SPACING, pr=DEFAULT_SPACING, pt=DEFAULT_SPACING, pb=DEFAULT_SPACING, hs=DEFAULT_SPACING, vs=DEFAULT_SPACING)
|
80
|
+
super(p, opts, x ,y ,w ,h , pl, pr, pt, pb, hs, vs)
|
81
|
+
@isLoaded = false
|
82
|
+
set_default_font
|
83
|
+
# load icons
|
84
|
+
icon_loader = Icon_Loader.new(FXApp::instance)
|
85
|
+
icon_loader.cfg_to_icons($cfg.icons)
|
86
|
+
|
87
|
+
@gui = Recursive_Open_Struct.new
|
88
|
+
@gui.main = self
|
89
|
+
@data = Recursive_Open_Struct.new
|
90
|
+
@data.gui_mutex = Mutex.new
|
91
|
+
|
92
|
+
build(self)
|
93
|
+
FXToolTip.new(FXApp::instance, TOOLTIP_NORMAL)
|
94
|
+
|
95
|
+
@gui.close
|
96
|
+
create_data
|
97
|
+
|
98
|
+
@data.close
|
99
|
+
|
100
|
+
@search_engine = Search_Engine.new(@gui, @data)
|
101
|
+
|
102
|
+
# show init message
|
103
|
+
@data.displayer.display_information($cfg.text.help)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Automatically called when the Fox application is created
|
107
|
+
def create
|
108
|
+
super
|
109
|
+
show
|
110
|
+
# load items
|
111
|
+
Thread.new do
|
112
|
+
# delayed loading, this speeds up freeride's startup.
|
113
|
+
sleep 1 if $cfg.delayed_loading
|
114
|
+
@gui.search_field.enabled = false
|
115
|
+
load_items
|
116
|
+
@isLoaded = true
|
117
|
+
@gui.search_field.enabled = true
|
118
|
+
@gui.search_field.text = ""
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def create_data
|
123
|
+
@data.displayer = FoxDisplayer.new(@gui.text)
|
124
|
+
@data.ri_manager = RiManager.new(@data.displayer)
|
125
|
+
@data.items = Array.new
|
126
|
+
@desc = nil
|
127
|
+
end
|
128
|
+
|
129
|
+
|
130
|
+
# Set the default font to the first font of $cfg.app.font.name that is available on this system.
|
131
|
+
def set_default_font
|
132
|
+
@font = load_font($cfg.app.font.name)
|
133
|
+
FXApp::instance.normalFont = @font if @font
|
134
|
+
end
|
135
|
+
|
136
|
+
# Returns the first font of the given array of font names that can be loaded, or nil.
|
137
|
+
def load_font(font_array)
|
138
|
+
# load default font
|
139
|
+
font = nil
|
140
|
+
font_array.detect do |name|
|
141
|
+
next if FXFont.listFonts(name).empty?
|
142
|
+
font = FXFont.new(FXApp::instance, name, $cfg.app.font.size)
|
143
|
+
end
|
144
|
+
font
|
145
|
+
end
|
146
|
+
|
147
|
+
# build gui
|
148
|
+
def build(parent)
|
149
|
+
FXSplitter.new(parent, SPLITTER_TRACKING|LAYOUT_FILL_X|LAYOUT_FILL_Y) do |base|
|
150
|
+
FXVerticalFrame.new(base, LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,$cfg.packet_list_width,0, 0,0,0,0,0,0) do |search_frame|
|
151
|
+
|
152
|
+
@gui.search_field = FXTextField.new(search_frame, 1, nil, 0, TEXTFIELD_NORMAL|LAYOUT_FILL_X|FRAME_SUNKEN)
|
153
|
+
@gui.search_field.connect(SEL_CHANGED) do |*args|
|
154
|
+
on_search
|
155
|
+
end
|
156
|
+
|
157
|
+
|
158
|
+
FXVerticalFrame.new(search_frame, FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,0,0, 0,0,0,0,0,0) do |list_frame|
|
159
|
+
@gui.packet_list = Packet_List.new(@data, list_frame, nil, 0,
|
160
|
+
ICONLIST_DETAILED|
|
161
|
+
ICONLIST_COLUMNS|
|
162
|
+
#ICONLIST_MINI_ICONS|
|
163
|
+
HSCROLLER_NEVER|
|
164
|
+
VSCROLLER_ALWAYS|
|
165
|
+
ICONLIST_BROWSESELECT|
|
166
|
+
LAYOUT_FILL_X|
|
167
|
+
LAYOUT_FILL_Y) do |packet_list|
|
168
|
+
packet_list.add_header($cfg.text.method_name, $cfg.packet_list_width) { |x| make_sortable(x) }
|
169
|
+
end
|
170
|
+
|
171
|
+
@gui.packet_list.setHeaderSize(0, 1000)
|
172
|
+
end
|
173
|
+
|
174
|
+
@gui.search_label = FXLabel.new(search_frame, "", nil, LAYOUT_FILL_X|LABEL_NORMAL|JUSTIFY_RIGHT, 0,0,0,0, 0,0,0,0)
|
175
|
+
|
176
|
+
@gui.packet_list.connect(SEL_SELECTED) do |sender, sel, data|
|
177
|
+
item = sender.getItem(data).packet_item
|
178
|
+
show_info(item.data)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
split = FXSplitter.new(base, SPLITTER_TRACKING|LAYOUT_FILL_X|LAYOUT_FILL_Y|SPLITTER_VERTICAL) if $cfg.launch_irb
|
183
|
+
right = FXHorizontalFrame.new(($cfg.launch_irb ? split : base), FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,0,0, 0,0,0,0,0,0)
|
184
|
+
@gui.text = FXText.new(right, nil, 0, TEXT_READONLY|TEXT_WORDWRAP|LAYOUT_FILL_X|LAYOUT_FILL_Y)
|
185
|
+
if $cfg.launch_irb
|
186
|
+
irb_frame = FXHorizontalFrame.new(split, FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,0,0, 0,0,0,0,0,0)
|
187
|
+
@irb_frame = irb_frame
|
188
|
+
@gui.irb = FXIrb.init(irb_frame, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_WORDWRAP|TEXT_SHOWACTIVE)
|
189
|
+
@gui.irb.setFont(@font) if @font
|
190
|
+
split.setSplit(0, $cfg.irb_height)
|
191
|
+
end
|
192
|
+
font = load_font($cfg.ri_font)
|
193
|
+
@gui.text.font = font if font
|
194
|
+
font.create
|
195
|
+
@gui.text_width = font.fontWidth
|
196
|
+
|
197
|
+
@gui.text.connect(SEL_CONFIGURE) do
|
198
|
+
on_show if @desc
|
199
|
+
end
|
200
|
+
|
201
|
+
# construct hilite styles
|
202
|
+
@gui.text.styled = true
|
203
|
+
@gui.text.hiliteStyles = create_styles
|
204
|
+
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
def create_empty_style
|
209
|
+
hs = FXHiliteStyle.new
|
210
|
+
hs.activeBackColor = FXColor::White
|
211
|
+
hs.hiliteBackColor = FXColor::DarkBlue
|
212
|
+
hs.normalBackColor = FXColor::White
|
213
|
+
hs.normalForeColor = FXColor::Black
|
214
|
+
hs.selectBackColor = FXColor::DarkBlue
|
215
|
+
hs.selectForeColor = FXColor::White
|
216
|
+
hs.style = 0
|
217
|
+
hs
|
218
|
+
end
|
219
|
+
|
220
|
+
def create_styles
|
221
|
+
styles = Array.new
|
222
|
+
|
223
|
+
#normal
|
224
|
+
styles.push create_empty_style
|
225
|
+
|
226
|
+
# bold
|
227
|
+
hs = create_empty_style
|
228
|
+
hs.style = FXText::STYLE_BOLD
|
229
|
+
styles.push hs
|
230
|
+
|
231
|
+
# H1
|
232
|
+
hs = create_empty_style
|
233
|
+
hs.style = FXText::STYLE_UNDERLINE|FXText::STYLE_BOLD
|
234
|
+
hs.normalForeColor = FXColor::ForestGreen
|
235
|
+
styles.push hs
|
236
|
+
|
237
|
+
# H2
|
238
|
+
hs = create_empty_style
|
239
|
+
hs.style = FXText::STYLE_UNDERLINE
|
240
|
+
hs.normalForeColor = FXColor::ForestGreen
|
241
|
+
styles.push hs
|
242
|
+
|
243
|
+
# H3
|
244
|
+
hs = create_empty_style
|
245
|
+
hs.normalForeColor = FXColor::ForestGreen
|
246
|
+
styles.push hs
|
247
|
+
|
248
|
+
# teletype
|
249
|
+
hs = create_empty_style
|
250
|
+
hs.normalForeColor = FXColor::DarkCyan
|
251
|
+
styles.push hs
|
252
|
+
|
253
|
+
# code
|
254
|
+
hs = create_empty_style
|
255
|
+
hs.activeBackColor = FXColor::LightGrey
|
256
|
+
hs.normalForeColor = FXColor::DarkGreen
|
257
|
+
hs.style = FXText::STYLE_UNDERLINE|FXText::STYLE_BOLD
|
258
|
+
styles.push hs
|
259
|
+
|
260
|
+
# emphasis
|
261
|
+
hs = create_empty_style
|
262
|
+
hs.normalForeColor = FXColor::DarkCyan
|
263
|
+
styles.push hs
|
264
|
+
|
265
|
+
# class
|
266
|
+
hs = create_empty_style
|
267
|
+
hs.style = FXText::STYLE_BOLD
|
268
|
+
hs.normalForeColor = FXColor::Blue
|
269
|
+
styles.push hs
|
270
|
+
|
271
|
+
styles
|
272
|
+
end
|
273
|
+
|
274
|
+
|
275
|
+
# loads all ri items
|
276
|
+
def load_items
|
277
|
+
@gui.search_field.text = "loading..."
|
278
|
+
@data.ri_manager.all_names.each do |name|
|
279
|
+
icon = case name.type
|
280
|
+
when NameDescriptor::CLASS
|
281
|
+
$cfg.icons.klass
|
282
|
+
when NameDescriptor::INSTANCE_METHOD
|
283
|
+
$cfg.icons.instance_method
|
284
|
+
when NameDescriptor::CLASS_METHOD
|
285
|
+
$cfg.icons.class_method
|
286
|
+
end
|
287
|
+
item = Packet_Item.new(@gui.packet_list, icon, name.to_s)
|
288
|
+
@search_engine.update_search_status_text
|
289
|
+
item.data = name
|
290
|
+
@data.items.push item
|
291
|
+
end
|
292
|
+
@gui.search_field.text = "sorting..."
|
293
|
+
@gui.packet_list.on_cmd_header(0)
|
294
|
+
@gui.packet_list.update_header_width
|
295
|
+
recalc
|
296
|
+
end
|
297
|
+
|
298
|
+
def go_search(string)
|
299
|
+
@gui.search_field.text = string
|
300
|
+
on_search
|
301
|
+
end
|
302
|
+
|
303
|
+
def on_search
|
304
|
+
# do nothing if not fully loaded
|
305
|
+
return if !@isLoaded
|
306
|
+
@search_engine.on_search
|
307
|
+
end
|
308
|
+
|
309
|
+
def on_show
|
310
|
+
begin
|
311
|
+
w = @gui.text.width / @gui.text_width - 3
|
312
|
+
w = [w, $cfg.minimum_letters_per_line].max
|
313
|
+
@data.ri_manager.show(@desc, w)
|
314
|
+
rescue RiError => e
|
315
|
+
#puts desc
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
def show_info(desc)
|
320
|
+
@desc = desc
|
321
|
+
on_show
|
322
|
+
end
|
323
|
+
|
324
|
+
|
325
|
+
# x beeing the name of the ri doc, like "Set#delete"
|
326
|
+
# This creates a sortable representation. First class, then class methods, then instance.
|
327
|
+
def make_sortable(x)
|
328
|
+
[ x.downcase.gsub("::", " 1 ").gsub("#", " 2 "),
|
329
|
+
x.downcase,
|
330
|
+
x]
|
331
|
+
end
|
332
|
+
|
333
|
+
end
|
334
|
+
|
335
|
+
Thread.abort_on_exception= true
|
336
|
+
|
337
|
+
application = FXApp.new($cfg.app.name, $cfg.app.name)
|
338
|
+
application.threadsEnabled = true
|
339
|
+
#application.init(ARGV)
|
340
|
+
window = FXMainWindow.new(application, $cfg.app.name, nil, nil, DECOR_ALL, 0, 0, $cfg.app.width, $cfg.app.height)
|
341
|
+
FXri.new(window,FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y,0,0,0,0,0,0,0,0,0,0)
|
342
|
+
application.create
|
343
|
+
window.show(PLACEMENT_SCREEN)
|
344
|
+
application.run
|