fxri 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -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> &lt;<a href="mailto:markus.prinz@qsig.org">markus.prinz@qsig.org</a>&gt; 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>&gt; fire up a 'clean' fxri<br>&gt;<br>&gt; in the 'search' box, type<br>&gt;<br>&gt; shdrlhu&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [deliberately a 'nonsense' word that I would not expect to
129
+ <br>&gt; find]<br>&gt;<br>&gt; and then delete it one character at a time. If you want a genuine search<br>&gt; term, try 'scintilla'.<br><br>Hm. With the nonsense nothing happened, but when I typed 'scintilla' I<br>got the string &quot;Fox::FXRegistry#asciiMode?, Fox::FXRegistry#asciiMode?&quot;
130
+ <br>inserted into the irb pane upon typing the 'i'. Is your output in the<br>irb-pane similar?<br><br>&gt; Incidentally, while researching this I found that if I tried to search for<br>&gt; 'array' fxri would die<br>&gt; under me on typing the 3rd letter (the second 'r')
131
+ <br>&gt;<br>&gt; Hypothesis - if you have 2 adjacent Classes with the first 2 characters of<br>&gt; their name identical,<br>&gt; fxri dies when entering the 3rd char of the Second possibility... but not<br>&gt; the first.
132
+ <br>&gt;<br>&gt; It happens with arr [cf argument], fal [cf fake], and with 'ra', where it<br>&gt; 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>&gt; 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>&nbsp;</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>&nbsp;</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>&nbsp;</div>
140
+ <div>The 'unexpected input to irb&gt;' problem is still there.</div>
141
+ <div>&nbsp;</div>
142
+ <div>The following search phrases trigger it -</div>
143
+ <div>&nbsp;'ascii'</div>
144
+ <div>&nbsp;'until'</div>
145
+ <div>&nbsp;'never'</div>
146
+ <div>&nbsp;'shrd'</div>
147
+ <div>&nbsp;'Match'</div>
148
+ <div>&nbsp;'World'</div>
149
+ <div>&nbsp;</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>&nbsp;</div>
153
+ <div>&nbsp;</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>&nbsp;</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>&nbsp;</div>
160
+ <div>Regards -</div>
161
+ <div>&nbsp;</div>
162
+ <div>David</div>
163
+ <div>Leicester, UK</div>
164
+ <div>&nbsp;</div>
165
+ <div>&nbsp;</div><br>&nbsp;</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.2.0'
12
- require 'fox12'
13
- require 'fox12/colors'
14
- FOXVERSION="1.2"
15
- include Fox
16
- rescue LoadError
17
- # no gem? try fox12 direct.
18
- begin
19
- require "fox12"
20
- require "fox12/colors"
21
- FOXVERSION="1.2"
22
- include Fox
23
- rescue LoadError
24
- # no gem, no fox12? try fox 1.0
25
- require "fox"
26
- require "fox/colors"
27
- # grep for FOXVERSION to find all code that depends on this
28
- FOXVERSION="1.0"
29
- include Fox
30
- FXMenuBar = FXMenubar
31
- FXToolTip = FXTooltip
32
- FXStatusBar = FXStatusbar
33
- end
34
- end
35
-
36
- require 'thread'
37
-
38
- require 'lib/RiManager'
39
- require 'lib/Recursive_Open_Struct'
40
- require 'lib/Globals'
41
- require 'lib/Packet_List'
42
- require 'lib/Packet_Item'
43
- require 'lib/Empty_Text_Field_Handler'
44
- require 'lib/Icon_Loader'
45
- require 'lib/Search_Engine'
46
- require 'lib/FoxDisplayer'
47
- require 'lib/FoxTextFormatter'
48
- require 'lib/fxirb'
49
-
50
- # Responsible for application initialization
51
- class FXri < FXHorizontalFrame
52
-
53
- # Initializes the XDCC-application.
54
- 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)
55
- super(p, opts, x ,y ,w ,h , pl, pr, pt, pb, hs, vs)
56
- @isLoaded = false
57
- set_default_font
58
- # load icons
59
- icon_loader = Icon_Loader.new(FXApp::instance)
60
- icon_loader.cfg_to_icons($cfg.icons)
61
-
62
- @gui = Recursive_Open_Struct.new
63
- @gui.main = self
64
- @data = Recursive_Open_Struct.new
65
- @data.gui_mutex = Mutex.new
66
-
67
- build(self)
68
- FXToolTip.new(FXApp::instance, TOOLTIP_NORMAL)
69
-
70
- @gui.close
71
- create_data
72
-
73
- @data.close
74
-
75
- @search_engine = Search_Engine.new(@gui, @data)
76
-
77
- # show init message
78
- @data.displayer.display_information($cfg.text.help)
79
- end
80
-
81
- # Automatically called when the Fox application is created
82
- def create
83
- super
84
- show
85
- # load items
86
- Thread.new do
87
- # delayed loading, this speeds up freeride's startup.
88
- sleep 1 if $cfg.delayed_loading
89
- @gui.search_field.enabled = false
90
- load_items
91
- @isLoaded = true
92
- @gui.search_field.enabled = true
93
- @gui.search_field.text = ""
94
- end
95
- end
96
-
97
- def create_data
98
- @data.displayer = FoxDisplayer.new(@gui.text)
99
- @data.ri_manager = RiManager.new(@data.displayer)
100
- @data.items = Array.new
101
- @desc = nil
102
- end
103
-
104
-
105
- # Set the default font to the first font of $cfg.app.font.name that is available on this system.
106
- def set_default_font
107
- @font = load_font($cfg.app.font.name)
108
- FXApp::instance.normalFont = @font if @font
109
- end
110
-
111
- # Returns the first font of the given array of font names that can be loaded, or nil.
112
- def load_font(font_array)
113
- # load default font
114
- font = nil
115
- font_array.detect do |name|
116
- next if FXFont.listFonts(name).empty?
117
- font = FXFont.new(FXApp::instance, name, $cfg.app.font.size)
118
- end
119
- font
120
- end
121
-
122
- # build gui
123
- def build(parent)
124
- FXSplitter.new(parent, SPLITTER_TRACKING|LAYOUT_FILL_X|LAYOUT_FILL_Y) do |base|
125
- 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|
126
-
127
- @gui.search_field = FXTextField.new(search_frame, 1, nil, 0, TEXTFIELD_NORMAL|LAYOUT_FILL_X|FRAME_SUNKEN)
128
- @gui.search_field.connect(SEL_CHANGED) do |*args|
129
- on_search
130
- end
131
-
132
-
133
- 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|
134
- @gui.packet_list = Packet_List.new(@data, list_frame, nil, 0,
135
- ICONLIST_DETAILED|
136
- ICONLIST_COLUMNS|
137
- #ICONLIST_MINI_ICONS|
138
- HSCROLLER_NEVER|
139
- VSCROLLER_ALWAYS|
140
- ICONLIST_BROWSESELECT|
141
- LAYOUT_FILL_X|
142
- LAYOUT_FILL_Y) do |packet_list|
143
- packet_list.add_header($cfg.text.method_name, $cfg.packet_list_width) { |x| make_sortable(x) }
144
- end
145
-
146
- @gui.packet_list.setHeaderSize(0, 1000)
147
- end
148
-
149
- @gui.search_label = FXLabel.new(search_frame, "", nil, LAYOUT_FILL_X|LABEL_NORMAL|JUSTIFY_RIGHT, 0,0,0,0, 0,0,0,0)
150
-
151
- @gui.packet_list.connect(SEL_SELECTED) do |sender, sel, data|
152
- item = sender.getItem(data).packet_item
153
- show_info(item.data)
154
- end
155
- end
156
-
157
- split = FXSplitter.new(base, SPLITTER_TRACKING|LAYOUT_FILL_X|LAYOUT_FILL_Y|SPLITTER_VERTICAL) if $cfg.launch_irb
158
- 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)
159
- @gui.text = FXText.new(right, nil, 0, TEXT_READONLY|TEXT_WORDWRAP|LAYOUT_FILL_X|LAYOUT_FILL_Y)
160
- if $cfg.launch_irb
161
- irb_frame = FXHorizontalFrame.new(split, FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,0,0, 0,0,0,0,0,0)
162
- @irb_frame = irb_frame
163
- @gui.irb = FXIrb.init(irb_frame, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_WORDWRAP|TEXT_SHOWACTIVE)
164
- @gui.irb.setFont(@font) if @font
165
- split.setSplit(0, $cfg.irb_height)
166
- end
167
- font = load_font($cfg.ri_font)
168
- @gui.text.font = font if font
169
- font.create
170
- @gui.text_width = font.fontWidth
171
-
172
- @gui.text.connect(SEL_CONFIGURE) do
173
- on_show if @desc
174
- end
175
-
176
- # construct hilite styles
177
- @gui.text.styled = true
178
- @gui.text.hiliteStyles = create_styles
179
-
180
- end
181
- end
182
-
183
- def create_empty_style
184
- hs = FXHiliteStyle.new
185
- hs.activeBackColor = FXColor::White
186
- hs.hiliteBackColor = FXColor::DarkBlue
187
- hs.normalBackColor = FXColor::White
188
- hs.normalForeColor = FXColor::Black
189
- hs.selectBackColor = FXColor::DarkBlue
190
- hs.selectForeColor = FXColor::White
191
- hs.style = 0
192
- hs
193
- end
194
-
195
- def create_styles
196
- styles = Array.new
197
-
198
- #normal
199
- styles.push create_empty_style
200
-
201
- # bold
202
- hs = create_empty_style
203
- hs.style = FXText::STYLE_BOLD
204
- styles.push hs
205
-
206
- # H1
207
- hs = create_empty_style
208
- hs.style = FXText::STYLE_UNDERLINE|FXText::STYLE_BOLD
209
- hs.normalForeColor = FXColor::ForestGreen
210
- styles.push hs
211
-
212
- # H2
213
- hs = create_empty_style
214
- hs.style = FXText::STYLE_UNDERLINE
215
- hs.normalForeColor = FXColor::ForestGreen
216
- styles.push hs
217
-
218
- # H3
219
- hs = create_empty_style
220
- hs.normalForeColor = FXColor::ForestGreen
221
- styles.push hs
222
-
223
- # teletype
224
- hs = create_empty_style
225
- hs.normalForeColor = FXColor::DarkCyan
226
- styles.push hs
227
-
228
- # code
229
- hs = create_empty_style
230
- hs.activeBackColor = FXColor::LightGrey
231
- hs.normalForeColor = FXColor::DarkGreen
232
- hs.style = FXText::STYLE_UNDERLINE|FXText::STYLE_BOLD
233
- styles.push hs
234
-
235
- # emphasis
236
- hs = create_empty_style
237
- hs.normalForeColor = FXColor::DarkCyan
238
- styles.push hs
239
-
240
- # class
241
- hs = create_empty_style
242
- hs.style = FXText::STYLE_BOLD
243
- hs.normalForeColor = FXColor::Blue
244
- styles.push hs
245
-
246
- styles
247
- end
248
-
249
-
250
- # loads all ri items
251
- def load_items
252
- @gui.search_field.text = "loading..."
253
- @data.ri_manager.all_names.each do |name|
254
- icon = case name.type
255
- when NameDescriptor::CLASS
256
- $cfg.icons.klass
257
- when NameDescriptor::INSTANCE_METHOD
258
- $cfg.icons.instance_method
259
- when NameDescriptor::CLASS_METHOD
260
- $cfg.icons.class_method
261
- end
262
- item = Packet_Item.new(@gui.packet_list, icon, name.to_s)
263
- @search_engine.update_search_status_text
264
- item.data = name
265
- @data.items.push item
266
- end
267
- @gui.search_field.text = "sorting..."
268
- @gui.packet_list.on_cmd_header(0)
269
- @gui.packet_list.update_header_width
270
- recalc
271
- end
272
-
273
- def go_search(string)
274
- @gui.search_field.text = string
275
- on_search
276
- end
277
-
278
- def on_search
279
- # do nothing if not fully loaded
280
- return if !@isLoaded
281
- @search_engine.on_search
282
- end
283
-
284
- def on_show
285
- begin
286
- w = @gui.text.width / @gui.text_width - 3
287
- w = [w, $cfg.minimum_letters_per_line].max
288
- @data.ri_manager.show(@desc, w)
289
- rescue RiError => e
290
- #puts desc
291
- end
292
- end
293
-
294
- def show_info(desc)
295
- @desc = desc
296
- on_show
297
- end
298
-
299
-
300
- # x beeing the name of the ri doc, like "Set#delete"
301
- # This creates a sortable representation. First class, then class methods, then instance.
302
- def make_sortable(x)
303
- [ x.downcase.gsub("::", " 1 ").gsub("#", " 2 "),
304
- x.downcase,
305
- x]
306
- end
307
-
308
- end
309
-
310
- Thread.abort_on_exception= true
311
-
312
- application = FXApp.new($cfg.app.name, $cfg.app.name)
313
- application.threadsEnabled = true
314
- #application.init(ARGV)
315
- window = FXMainWindow.new(application, $cfg.app.name, nil, nil, DECOR_ALL, 0, 0, $cfg.app.width, $cfg.app.height)
316
- FXri.new(window,FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y,0,0,0,0,0,0,0,0,0,0)
317
- application.create
318
- window.show(PLACEMENT_SCREEN)
319
- application.run
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