fxri 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
@@ -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', '< 1.3'])
7
- s.version = "0.3.3"
8
- s.date = "2006-02-02"
9
- s.summary = "Graphical interface to the RI documentation, with search engine."
10
- s.require_paths = ["lib"]
11
- s.email = "markus.prinz@qsig.org"
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.6.0', '< 1.7'])
7
+ s.version = "0.3.4"
8
+ s.date = "2006-12-14"
9
+ s.summary = "Graphical interface to the RI documentation, with search engine."
10
+ s.require_paths = ["lib"]
11
+ s.email = "markus.prinz@qsig.org"
12
+ s.homepage = "http://rubyforge.org/projects/fxri/"
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,63 +1,63 @@
1
- # Copyright (c) 2004, 2005 Martin Ankerl
2
- # Shows a grey text in an FXTextField if the user did not enter any input. This is a nice way to
3
- # give the user more information about what to enter into a text field, without the need of additional
4
- # space in the GUI.
5
- class Empty_Text_Field_Handler
6
-
7
- # Create a new handler for the specified textfield, with the given text. From now on you have to use the
8
- # created object to get and set text, not the textfield or this handler would come out of sync
9
- def initialize(textField, myText)
10
- @textField = textField
11
- @myText = myText
12
- @isEmpty = true
13
- onTextFieldFocusOut
14
- # create connections
15
- @textField.connect(SEL_FOCUSIN, method(:onTextFieldFocusIn))
16
- @textField.connect(SEL_FOCUSOUT, method(:onTextFieldFocusOut))
17
- end
18
-
19
- # Check if textfield is empty (no user input).
20
- def empty?
21
- @isEmpty
22
- end
23
-
24
- # Set new text for the textfield
25
- def text=(newText)
26
- onTextFieldFocusIn
27
- @textField.text = newText.to_s
28
- onTextFieldFocusOut
29
- end
30
-
31
- # Get the textfield's text, if the user has entered something.
32
- def text
33
- if empty? && !@inside
34
- ""
35
- else
36
- @textField.text
37
- end
38
- end
39
-
40
- # Set focus to the textfield.
41
- def setFocus
42
- @textField.setFocus
43
- end
44
-
45
- private
46
-
47
- def onTextFieldFocusIn(*args)
48
- @inside = true
49
- return if !@isEmpty
50
- @textField.textColor = FXColor::Black
51
- @textField.text = ""
52
- end
53
-
54
- def onTextFieldFocusOut(*args)
55
- @inside = false
56
- @textField.killSelection
57
- @isEmpty = @textField.text == ""
58
- return if !@isEmpty
59
- @textField.textColor = FXColor::DarkGrey
60
- @textField.text = @myText
61
- @isEmpty = true
62
- end
63
- end
1
+ # Copyright (c) 2004, 2005 Martin Ankerl
2
+ # Shows a grey text in an FXTextField if the user did not enter any input. This is a nice way to
3
+ # give the user more information about what to enter into a text field, without the need of additional
4
+ # space in the GUI.
5
+ class Empty_Text_Field_Handler
6
+
7
+ # Create a new handler for the specified textfield, with the given text. From now on you have to use the
8
+ # created object to get and set text, not the textfield or this handler would come out of sync
9
+ def initialize(textField, myText)
10
+ @textField = textField
11
+ @myText = myText
12
+ @isEmpty = true
13
+ onTextFieldFocusOut
14
+ # create connections
15
+ @textField.connect(SEL_FOCUSIN, method(:onTextFieldFocusIn))
16
+ @textField.connect(SEL_FOCUSOUT, method(:onTextFieldFocusOut))
17
+ end
18
+
19
+ # Check if textfield is empty (no user input).
20
+ def empty?
21
+ @isEmpty
22
+ end
23
+
24
+ # Set new text for the textfield
25
+ def text=(newText)
26
+ onTextFieldFocusIn
27
+ @textField.text = newText.to_s
28
+ onTextFieldFocusOut
29
+ end
30
+
31
+ # Get the textfield's text, if the user has entered something.
32
+ def text
33
+ if empty? && !@inside
34
+ ""
35
+ else
36
+ @textField.text
37
+ end
38
+ end
39
+
40
+ # Set focus to the textfield.
41
+ def setFocus
42
+ @textField.setFocus
43
+ end
44
+
45
+ private
46
+
47
+ def onTextFieldFocusIn(*args)
48
+ @inside = true
49
+ return if !@isEmpty
50
+ @textField.textColor = FXColor::Black
51
+ @textField.text = ""
52
+ end
53
+
54
+ def onTextFieldFocusOut(*args)
55
+ @inside = false
56
+ @textField.killSelection
57
+ @isEmpty = @textField.text == ""
58
+ return if !@isEmpty
59
+ @textField.textColor = FXColor::DarkGrey
60
+ @textField.text = @myText
61
+ @isEmpty = true
62
+ end
63
+ end
@@ -1,148 +1,148 @@
1
- class FoxDisplayer
2
- attr_accessor :reader
3
-
4
- def initialize(text_field)
5
- @text_field = text_field
6
- @formatter = FoxTextFormatter.new(70, "") do |arg, style|
7
- startpos = @str.size
8
- @str << arg
9
- @formats.push [startpos, arg.size, style]
10
- end
11
- @reader = nil
12
- end
13
-
14
- def width=(newWidth)
15
- @formatter.width = newWidth
16
- end
17
-
18
- def no_info_available
19
- @text_field.text="nothing here, move on!"
20
- end
21
-
22
- def init_text
23
- @str = ""
24
- @formats = Array.new
25
- end
26
-
27
- # Sets a new text, and all styles
28
- def set_text
29
- @text_field.text = @str
30
- @formats.each do |start, n, style|
31
- case style
32
- when FoxTextFormatter::STYLE_BOLD
33
- @text_field.changeStyle(start, n, 2)
34
- when FoxTextFormatter::STYLE_H1
35
- @text_field.changeStyle(start, n, 3)
36
- when FoxTextFormatter::STYLE_H2
37
- @text_field.changeStyle(start, n, 4)
38
- when FoxTextFormatter::STYLE_H3
39
- @text_field.changeStyle(start, n, 5)
40
- when FoxTextFormatter::STYLE_TELETYPE
41
- @text_field.changeStyle(start, n, 6)
42
- when FoxTextFormatter::STYLE_CODE
43
- @text_field.changeStyle(start, n, 7)
44
- when FoxTextFormatter::STYLE_EMPHASIS
45
- @text_field.changeStyle(start, n, 8)
46
- when FoxTextFormatter::STYLE_CLASS
47
- @text_field.changeStyle(start, n, 9)
48
- else
49
- @text_field.changeStyle(start, n, 1)
50
- end
51
-
52
- end
53
- end
54
-
55
- # Display method information
56
- def display_method_info(method)
57
- init_text
58
- @formatter.draw_line(method.full_name)
59
- @formatter.display_params(method)
60
- @formatter.draw_line
61
- display_flow(method.comment)
62
-
63
- if method.aliases && !method.aliases.empty?
64
- @formatter.blankline
65
- aka = "(also known as "
66
- aka << method.aliases.map {|a| a.name }.join(", ")
67
- aka << ")"
68
- @formatter.wrap(aka)
69
- end
70
- set_text
71
- end
72
-
73
- def display_information(message)
74
- init_text
75
- display_flow(message)
76
- set_text
77
- end
78
-
79
- def display_class_info(klass)
80
- init_text
81
- superclass = klass.superclass_string
82
- if superclass
83
- superclass = " < " + superclass
84
- else
85
- superclass = ""
86
- end
87
- @formatter.draw_line(klass.display_name + ": " + klass.full_name + superclass)
88
- display_flow(klass.comment)
89
- @formatter.draw_line
90
-
91
- unless klass.includes.empty?
92
- @formatter.blankline
93
- @formatter.display_heading("Includes:", 2, "")
94
- incs = []
95
- klass.includes.each do |inc|
96
- inc_desc = @reader.find_class_by_name(inc.name)
97
- if inc_desc
98
- str = inc.name + "("
99
- str << inc_desc.instance_methods.map{|m| m.name}.join(", ")
100
- str << ")"
101
- incs << str
102
- else
103
- incs << inc.name
104
- end
105
- end
106
- @formatter.wrap(incs.sort.join(', '))
107
- end
108
-
109
- unless klass.constants.empty?
110
- @formatter.blankline
111
- @formatter.display_heading("Constants:", 2, "")
112
- len = 0
113
- klass.constants.each { |c| len = c.name.length if c.name.length > len }
114
- len += 2
115
- klass.constants.each do |c|
116
- @formatter.wrap(c.value, @formatter.indent+((c.name+":").ljust(len)))
117
- end
118
- end
119
-
120
- unless klass.class_methods.empty?
121
- @formatter.blankline
122
- @formatter.display_heading("Class methods:", 2, "")
123
- @formatter.wrap(klass.class_methods.map{|m| m.name}.sort.join(', '))
124
- end
125
-
126
- unless klass.instance_methods.empty?
127
- @formatter.blankline
128
- @formatter.display_heading("Instance methods:", 2, "")
129
- @formatter.wrap(klass.instance_methods.map{|m| m.name}.sort.join(', '))
130
- end
131
-
132
- unless klass.attributes.empty?
133
- @formatter.blankline
134
- @formatter.wrap("Attributes:", "")
135
- @formatter.wrap(klass.attributes.map{|a| a.name}.sort.join(', '))
136
- end
137
-
138
- set_text
139
- end
140
-
141
- def display_flow(flow)
142
- if !flow || flow.empty?
143
- @formatter.wrap("(no description...)\n")
144
- else
145
- @formatter.display_flow(flow)
146
- end
147
- end
148
- end
1
+ class FoxDisplayer
2
+ attr_accessor :reader
3
+
4
+ def initialize(text_field)
5
+ @text_field = text_field
6
+ @formatter = FoxTextFormatter.new(70, "") do |arg, style|
7
+ startpos = @str.size
8
+ @str << arg
9
+ @formats.push [startpos, arg.size, style]
10
+ end
11
+ @reader = nil
12
+ end
13
+
14
+ def width=(newWidth)
15
+ @formatter.width = newWidth
16
+ end
17
+
18
+ def no_info_available
19
+ @text_field.text="nothing here, move on!"
20
+ end
21
+
22
+ def init_text
23
+ @str = ""
24
+ @formats = Array.new
25
+ end
26
+
27
+ # Sets a new text, and all styles
28
+ def set_text
29
+ @text_field.text = @str
30
+ @formats.each do |start, n, style|
31
+ case style
32
+ when FoxTextFormatter::STYLE_BOLD
33
+ @text_field.changeStyle(start, n, 2)
34
+ when FoxTextFormatter::STYLE_H1
35
+ @text_field.changeStyle(start, n, 3)
36
+ when FoxTextFormatter::STYLE_H2
37
+ @text_field.changeStyle(start, n, 4)
38
+ when FoxTextFormatter::STYLE_H3
39
+ @text_field.changeStyle(start, n, 5)
40
+ when FoxTextFormatter::STYLE_TELETYPE
41
+ @text_field.changeStyle(start, n, 6)
42
+ when FoxTextFormatter::STYLE_CODE
43
+ @text_field.changeStyle(start, n, 7)
44
+ when FoxTextFormatter::STYLE_EMPHASIS
45
+ @text_field.changeStyle(start, n, 8)
46
+ when FoxTextFormatter::STYLE_CLASS
47
+ @text_field.changeStyle(start, n, 9)
48
+ else
49
+ @text_field.changeStyle(start, n, 1)
50
+ end
51
+
52
+ end
53
+ end
54
+
55
+ # Display method information
56
+ def display_method_info(method)
57
+ init_text
58
+ @formatter.draw_line(method.full_name)
59
+ @formatter.display_params(method)
60
+ @formatter.draw_line
61
+ display_flow(method.comment)
62
+
63
+ if method.aliases && !method.aliases.empty?
64
+ @formatter.blankline
65
+ aka = "(also known as "
66
+ aka << method.aliases.map {|a| a.name }.join(", ")
67
+ aka << ")"
68
+ @formatter.wrap(aka)
69
+ end
70
+ set_text
71
+ end
72
+
73
+ def display_information(message)
74
+ init_text
75
+ display_flow(message)
76
+ set_text
77
+ end
78
+
79
+ def display_class_info(klass)
80
+ init_text
81
+ superclass = klass.superclass_string
82
+ if superclass
83
+ superclass = " < " + superclass
84
+ else
85
+ superclass = ""
86
+ end
87
+ @formatter.draw_line(klass.display_name + ": " + klass.full_name + superclass)
88
+ display_flow(klass.comment)
89
+ @formatter.draw_line
90
+
91
+ unless klass.includes.empty?
92
+ @formatter.blankline
93
+ @formatter.display_heading("Includes:", 2, "")
94
+ incs = []
95
+ klass.includes.each do |inc|
96
+ inc_desc = @reader.find_class_by_name(inc.name)
97
+ if inc_desc
98
+ str = inc.name + "("
99
+ str << inc_desc.instance_methods.map{|m| m.name}.join(", ")
100
+ str << ")"
101
+ incs << str
102
+ else
103
+ incs << inc.name
104
+ end
105
+ end
106
+ @formatter.wrap(incs.sort.join(', '))
107
+ end
108
+
109
+ unless klass.constants.empty?
110
+ @formatter.blankline
111
+ @formatter.display_heading("Constants:", 2, "")
112
+ len = 0
113
+ klass.constants.each { |c| len = c.name.length if c.name.length > len }
114
+ len += 2
115
+ klass.constants.each do |c|
116
+ @formatter.wrap(c.value, @formatter.indent+((c.name+":").ljust(len)))
117
+ end
118
+ end
119
+
120
+ unless klass.class_methods.empty?
121
+ @formatter.blankline
122
+ @formatter.display_heading("Class methods:", 2, "")
123
+ @formatter.wrap(klass.class_methods.map{|m| m.name}.sort.join(', '))
124
+ end
125
+
126
+ unless klass.instance_methods.empty?
127
+ @formatter.blankline
128
+ @formatter.display_heading("Instance methods:", 2, "")
129
+ @formatter.wrap(klass.instance_methods.map{|m| m.name}.sort.join(', '))
130
+ end
131
+
132
+ unless klass.attributes.empty?
133
+ @formatter.blankline
134
+ @formatter.wrap("Attributes:", "")
135
+ @formatter.wrap(klass.attributes.map{|a| a.name}.sort.join(', '))
136
+ end
137
+
138
+ set_text
139
+ end
140
+
141
+ def display_flow(flow)
142
+ if !flow || flow.empty?
143
+ @formatter.wrap("(no description...)\n")
144
+ else
145
+ @formatter.display_flow(flow)
146
+ end
147
+ end
148
+ end