fxri 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/fxri +79 -51
- data/fxri.gemspec +24 -24
- data/lib/Globals.rb +5 -0
- data/lib/Packet_List.rb +2 -2
- metadata +12 -12
data/fxri
CHANGED
@@ -44,11 +44,12 @@ require 'lib/FoxTextFormatter'
|
|
44
44
|
require 'lib/fxirb'
|
45
45
|
|
46
46
|
# Responsible for application initialization
|
47
|
-
class
|
47
|
+
class FXri < FXHorizontalFrame
|
48
48
|
|
49
49
|
# Initializes the XDCC-application.
|
50
|
-
def initialize(
|
51
|
-
super(
|
50
|
+
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)
|
51
|
+
super(p, opts, x ,y ,w ,h , pl, pr, pt, pb, hs, vs)
|
52
|
+
@isLoaded = false
|
52
53
|
set_default_font
|
53
54
|
# load icons
|
54
55
|
icon_loader = Icon_Loader.new(FXApp::instance)
|
@@ -76,11 +77,18 @@ class Main_Window < FXMainWindow
|
|
76
77
|
# Automatically called when the Fox application is created
|
77
78
|
def create
|
78
79
|
super
|
79
|
-
show
|
80
|
+
show
|
80
81
|
# load items
|
81
|
-
|
82
|
-
|
83
|
-
|
82
|
+
Thread.new do
|
83
|
+
# delayed loading, this speeds up freeride's startup.
|
84
|
+
sleep 1 if $cfg.delayed_loading
|
85
|
+
@gui.search_field.enabled = false
|
86
|
+
load_items
|
87
|
+
@isLoaded = true
|
88
|
+
@gui.search_field.enabled = true
|
89
|
+
@gui.search_field.text = ""
|
90
|
+
end
|
91
|
+
end
|
84
92
|
|
85
93
|
def create_data
|
86
94
|
@data.displayer = FoxDisplayer.new(@gui.text)
|
@@ -110,19 +118,28 @@ class Main_Window < FXMainWindow
|
|
110
118
|
# build gui
|
111
119
|
def build(parent)
|
112
120
|
FXSplitter.new(parent, SPLITTER_TRACKING|LAYOUT_FILL_X|LAYOUT_FILL_Y) do |base|
|
113
|
-
FXVerticalFrame.new(base, LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,$cfg.packet_list_width,0,
|
121
|
+
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|
|
114
122
|
|
115
123
|
@gui.search_field = FXTextField.new(search_frame, 1, nil, 0, TEXTFIELD_NORMAL|LAYOUT_FILL_X|FRAME_SUNKEN)
|
116
|
-
Empty_Text_Field_Handler.new(@gui.search_field, $cfg.text.search_field)
|
117
124
|
@gui.search_field.connect(SEL_CHANGED) do |*args|
|
118
125
|
on_search
|
119
126
|
end
|
120
127
|
|
121
128
|
|
122
129
|
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|
|
123
|
-
@gui.packet_list = Packet_List.new(@data, list_frame, nil, 0,
|
130
|
+
@gui.packet_list = Packet_List.new(@data, list_frame, nil, 0,
|
131
|
+
ICONLIST_DETAILED|
|
132
|
+
ICONLIST_COLUMNS|
|
133
|
+
#ICONLIST_MINI_ICONS|
|
134
|
+
HSCROLLER_NEVER|
|
135
|
+
VSCROLLER_ALWAYS|
|
136
|
+
ICONLIST_BROWSESELECT|
|
137
|
+
LAYOUT_FILL_X|
|
138
|
+
LAYOUT_FILL_Y) do |packet_list|
|
124
139
|
packet_list.add_header($cfg.text.method_name, $cfg.packet_list_width) { |x| make_sortable(x) }
|
125
140
|
end
|
141
|
+
|
142
|
+
@gui.packet_list.setHeaderSize(0, 1000)
|
126
143
|
end
|
127
144
|
|
128
145
|
@gui.search_label = FXLabel.new(search_frame, "", nil, LAYOUT_FILL_X|LABEL_NORMAL|JUSTIFY_RIGHT, 0,0,0,0, 0,0,0,0)
|
@@ -133,22 +150,19 @@ class Main_Window < FXMainWindow
|
|
133
150
|
end
|
134
151
|
end
|
135
152
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
end
|
147
|
-
split.setSplit(0, $cfg.irb_height)
|
148
|
-
end
|
153
|
+
split = FXSplitter.new(base, SPLITTER_TRACKING|LAYOUT_FILL_X|LAYOUT_FILL_Y|SPLITTER_VERTICAL) if $cfg.launch_irb
|
154
|
+
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)
|
155
|
+
@gui.text = FXText.new(right, nil, 0, TEXT_READONLY|TEXT_WORDWRAP|LAYOUT_FILL_X|LAYOUT_FILL_Y)
|
156
|
+
if $cfg.launch_irb
|
157
|
+
irb_frame = FXHorizontalFrame.new(split, FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,0,0, 0,0,0,0,0,0)
|
158
|
+
@irb_frame = irb_frame
|
159
|
+
@gui.irb = FXIrb.init(irb_frame, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_WORDWRAP|TEXT_SHOWACTIVE)
|
160
|
+
@gui.irb.setFont(@font) if @font
|
161
|
+
split.setSplit(0, $cfg.irb_height)
|
162
|
+
end
|
149
163
|
font = load_font($cfg.ri_font)
|
150
164
|
@gui.text.font = font if font
|
151
|
-
font.create
|
165
|
+
font.create
|
152
166
|
@gui.text_width = font.fontWidth
|
153
167
|
|
154
168
|
@gui.text.connect(SEL_CONFIGURE) do
|
@@ -231,27 +245,35 @@ class Main_Window < FXMainWindow
|
|
231
245
|
|
232
246
|
# loads all ri items
|
233
247
|
def load_items
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
248
|
+
@gui.search_field.text = "loading..."
|
249
|
+
@data.ri_manager.all_names.each do |name|
|
250
|
+
icon = case name.type
|
251
|
+
when NameDescriptor::CLASS
|
252
|
+
$cfg.icons.klass
|
253
|
+
when NameDescriptor::INSTANCE_METHOD
|
254
|
+
$cfg.icons.instance_method
|
255
|
+
when NameDescriptor::CLASS_METHOD
|
256
|
+
$cfg.icons.class_method
|
257
|
+
end
|
258
|
+
item = Packet_Item.new(@gui.packet_list, icon, name.to_s)
|
259
|
+
@search_engine.update_search_status_text
|
260
|
+
item.data = name
|
261
|
+
@data.items.push item
|
262
|
+
end
|
263
|
+
@gui.search_field.text = "sorting..."
|
264
|
+
@gui.packet_list.on_cmd_header(0)
|
265
|
+
@gui.packet_list.update_header_width
|
266
|
+
recalc
|
267
|
+
end
|
268
|
+
|
269
|
+
def go_search(string)
|
270
|
+
@gui.search_field.text = string
|
271
|
+
on_search
|
252
272
|
end
|
253
273
|
|
254
274
|
def on_search
|
275
|
+
# do nothing if not fully loaded
|
276
|
+
return if !@isLoaded
|
255
277
|
@search_engine.on_search
|
256
278
|
end
|
257
279
|
|
@@ -275,18 +297,24 @@ class Main_Window < FXMainWindow
|
|
275
297
|
# This creates a sortable representation. First class, then class methods, then instance.
|
276
298
|
def make_sortable(x)
|
277
299
|
[ x.downcase.gsub("::", " 1 ").gsub("#", " 2 "),
|
278
|
-
|
279
|
-
|
300
|
+
x.downcase,
|
301
|
+
x]
|
280
302
|
end
|
281
303
|
|
282
304
|
end
|
283
305
|
|
284
|
-
|
306
|
+
if __FILE__ == $0
|
307
|
+
Thread.abort_on_exception= true
|
285
308
|
|
286
|
-
# move to directory of this file, so that icons can load correctly.
|
287
|
-
Dir.chdir(File.dirname(File.expand_path(__FILE__)))
|
309
|
+
# move to directory of this file, so that icons can load correctly.
|
310
|
+
Dir.chdir(File.dirname(File.expand_path(__FILE__)))
|
288
311
|
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
$app.
|
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
|
320
|
+
end
|
data/fxri.gemspec
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
#!/bin/env ruby
|
2
|
-
require 'rubygems'
|
3
|
-
|
4
|
-
spec = Gem::Specification.new do |s|
|
5
|
-
s.name = "fxri"
|
6
|
-
s.add_dependency('fxruby', '>= 1.2.0')
|
7
|
-
s.version = "0.
|
8
|
-
s.date = "2005-
|
9
|
-
s.summary = "Graphical interface to the RI documentation, with search engine."
|
10
|
-
s.require_paths = ["lib"]
|
11
|
-
s.email = "martin.ankerl@gmail.com"
|
12
|
-
s.homepage = "http://fxri.rubyforge.org/"
|
13
|
-
s.rubyforge_project = "fxri"
|
14
|
-
s.description = "FxRi is an FXRuby interface to the RI documentation, with a search engine that allows for search-on-typing."
|
15
|
-
s.has_rdoc = false
|
16
|
-
s.files = Dir.glob("**/*")
|
17
|
-
s.bindir = "."
|
18
|
-
s.executables = ["fxri"]
|
19
|
-
end
|
20
|
-
|
21
|
-
if __FILE__ == $0
|
22
|
-
Gem.manage_gems
|
23
|
-
Gem::Builder.new(spec).build
|
24
|
-
end
|
1
|
+
#!/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
|
4
|
+
spec = Gem::Specification.new do |s|
|
5
|
+
s.name = "fxri"
|
6
|
+
s.add_dependency('fxruby', '>= 1.2.0')
|
7
|
+
s.version = "0.3.0"
|
8
|
+
s.date = "2005-04-16"
|
9
|
+
s.summary = "Graphical interface to the RI documentation, with search engine."
|
10
|
+
s.require_paths = ["lib"]
|
11
|
+
s.email = "martin.ankerl@gmail.com"
|
12
|
+
s.homepage = "http://fxri.rubyforge.org/"
|
13
|
+
s.rubyforge_project = "fxri"
|
14
|
+
s.description = "FxRi is an FXRuby interface to the RI documentation, with a search engine that allows for search-on-typing."
|
15
|
+
s.has_rdoc = false
|
16
|
+
s.files = Dir.glob("**/*")
|
17
|
+
s.bindir = "."
|
18
|
+
s.executables = ["fxri"]
|
19
|
+
end
|
20
|
+
|
21
|
+
if __FILE__ == $0
|
22
|
+
Gem.manage_gems
|
23
|
+
Gem::Builder.new(spec).build
|
24
|
+
end
|
data/lib/Globals.rb
CHANGED
@@ -4,6 +4,8 @@ $cfg = Recursive_Open_Struct.new
|
|
4
4
|
|
5
5
|
$cfg.app.name = "fxri - Instant Ruby Enlightenment"
|
6
6
|
|
7
|
+
$cfg.delayed_loading = false
|
8
|
+
|
7
9
|
# uses the first font that is available
|
8
10
|
$cfg.app.font.name = ["Bitstream Vera Sans", "Verdana", "Trebuchet MS", "Tahoma", "Arial"]
|
9
11
|
$cfg.ri_font = ["Bitstream Vera Sans Mono", "Courier New", "Courier"]
|
@@ -20,6 +22,7 @@ $cfg.status_line_update_interval = 0.1
|
|
20
22
|
$cfg.list.opts = ICONLIST_SINGLESELECT|ICONLIST_DETAILED|LAYOUT_FILL_X|LAYOUT_FILL_Y|ICONLIST_AUTOSIZE
|
21
23
|
|
22
24
|
# icons, are automatically loaded from Icon_Loader.
|
25
|
+
$cfg.icons_path = File.join("lib","icons")
|
23
26
|
$cfg.icons.klass = "class.png"
|
24
27
|
$cfg.icons.class_method = "module.png"
|
25
28
|
$cfg.icons.instance_method = "method.png"
|
@@ -29,6 +32,8 @@ $cfg.text.search = "%d / %d entries"
|
|
29
32
|
$cfg.text.search_field = "What do you want to know?"
|
30
33
|
$cfg.text.method_name = "name"
|
31
34
|
|
35
|
+
# IRB
|
36
|
+
$cfg.launch_irb = true
|
32
37
|
|
33
38
|
$cfg.text.help = %|This is <b>fxri</b>, a graphical interface to the <em>Ruby</em> documentation. Fxri comes with a search engine with quite a few features. Here are several examples:
|
34
39
|
'<em>Array</em>': Lists all classes with the name <em>Array</em>. Note that upcase words are treated case sensitive, lowercase words insensitive.
|
data/lib/Packet_List.rb
CHANGED
@@ -18,7 +18,7 @@ class Packet_List < FXIconList
|
|
18
18
|
end
|
19
19
|
|
20
20
|
@header_item_index = 0
|
21
|
-
@reversed =
|
21
|
+
@reversed = true
|
22
22
|
@conversions = Array.new
|
23
23
|
@items = Set.new
|
24
24
|
super(*args)
|
@@ -53,7 +53,7 @@ class Packet_List < FXIconList
|
|
53
53
|
if @header_item_index == header_item_index
|
54
54
|
@reversed = !@reversed
|
55
55
|
else
|
56
|
-
@reversed =
|
56
|
+
@reversed = true
|
57
57
|
end
|
58
58
|
@header_item_index = header_item_index
|
59
59
|
header.setArrowDir(@header_item_index, @reversed)
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.6
|
|
3
3
|
specification_version: 1
|
4
4
|
name: fxri
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2005-
|
6
|
+
version: 0.3.0
|
7
|
+
date: 2005-04-16
|
8
8
|
summary: "Graphical interface to the RI documentation, with search engine."
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -27,24 +27,24 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
27
27
|
platform: ruby
|
28
28
|
authors: []
|
29
29
|
files:
|
30
|
+
- lib
|
30
31
|
- fxri
|
31
32
|
- fxri.gemspec
|
32
|
-
- lib
|
33
|
-
- lib/Empty_Text_Field_Handler.rb
|
34
33
|
- lib/FoxDisplayer.rb
|
35
|
-
- lib/FoxTextFormatter.rb
|
36
|
-
- lib/fxirb.rb
|
37
|
-
- lib/Globals.rb
|
38
34
|
- lib/icons
|
39
|
-
- lib/Icon_Loader.rb
|
40
|
-
- lib/Packet_Item.rb
|
41
|
-
- lib/Packet_List.rb
|
42
35
|
- lib/Recursive_Open_Struct.rb
|
43
36
|
- lib/RiManager.rb
|
37
|
+
- lib/Globals.rb
|
38
|
+
- lib/fxirb.rb
|
39
|
+
- lib/Packet_Item.rb
|
44
40
|
- lib/Search_Engine.rb
|
45
|
-
- lib/
|
46
|
-
- lib/
|
41
|
+
- lib/Empty_Text_Field_Handler.rb
|
42
|
+
- lib/FoxTextFormatter.rb
|
43
|
+
- lib/Packet_List.rb
|
44
|
+
- lib/Icon_Loader.rb
|
47
45
|
- lib/icons/module.png
|
46
|
+
- lib/icons/method.png
|
47
|
+
- lib/icons/class.png
|
48
48
|
test_files: []
|
49
49
|
rdoc_options: []
|
50
50
|
extra_rdoc_files: []
|