glimmer-dsl-swt 4.17.2.4 → 4.17.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +44 -0
- data/README.md +294 -467
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +14 -6
- data/lib/glimmer-dsl-swt.rb +1 -0
- data/lib/glimmer/dsl/swt/custom_widget_expression.rb +1 -0
- data/lib/glimmer/dsl/swt/expand_item_expression.rb +60 -0
- data/lib/glimmer/dsl/swt/widget_expression.rb +2 -0
- data/lib/glimmer/rake_task.rb +19 -21
- data/lib/glimmer/rake_task/package.rb +9 -2
- data/lib/glimmer/rake_task/scaffold.rb +138 -42
- data/lib/glimmer/swt/custom/code_text.rb +95 -0
- data/lib/glimmer/swt/expand_item_proxy.rb +98 -0
- data/lib/glimmer/swt/image_proxy.rb +5 -0
- data/lib/glimmer/swt/message_box_proxy.rb +1 -1
- data/lib/glimmer/swt/sash_form_proxy.rb +53 -0
- data/lib/glimmer/swt/styled_text_proxy.rb +43 -0
- data/lib/glimmer/swt/tab_item_proxy.rb +1 -1
- data/lib/glimmer/swt/widget_proxy.rb +92 -33
- data/samples/elaborate/meta_sample.rb +166 -0
- data/samples/hello/hello_expand_bar.rb +108 -0
- data/samples/hello/hello_sash_form.rb +137 -0
- data/samples/hello/hello_styled_text.rb +138 -0
- metadata +16 -8
- data/lib/glimmer/rake_task/sample.rb +0 -115
@@ -0,0 +1,166 @@
|
|
1
|
+
class Sample
|
2
|
+
attr_accessor :sample_directory, :file, :selected
|
3
|
+
|
4
|
+
def initialize(file, sample_directory: )
|
5
|
+
self.file = file
|
6
|
+
self.sample_directory = sample_directory
|
7
|
+
end
|
8
|
+
|
9
|
+
def name
|
10
|
+
if @name.nil?
|
11
|
+
@name = File.basename(file, '.rb').split('_').map(&:capitalize).join(' ')
|
12
|
+
if @name.start_with?('Hello')
|
13
|
+
name_parts = @name.split
|
14
|
+
name_parts[0] = name_parts.first + ','
|
15
|
+
name_parts[-1] = name_parts.last + '!'
|
16
|
+
@name = name_parts.join(' ')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
@name
|
20
|
+
end
|
21
|
+
|
22
|
+
def content
|
23
|
+
@content ||= File.read(file)
|
24
|
+
end
|
25
|
+
|
26
|
+
def launch
|
27
|
+
load file
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class SampleDirectory
|
32
|
+
class << self
|
33
|
+
attr_accessor :selected_sample
|
34
|
+
|
35
|
+
def sample_directories
|
36
|
+
if @sample_directories.nil?
|
37
|
+
@sample_directories = Dir.glob(File.join(File.expand_path('..', __FILE__), '*')).
|
38
|
+
select { |file| File.directory?(file) }.
|
39
|
+
map { |file| SampleDirectory.new(file) }
|
40
|
+
glimmer_gems = Gem.find_latest_files("glimmer-*-*")
|
41
|
+
sample_directories = glimmer_gems.map do |lib|
|
42
|
+
File.dirname(File.dirname(lib))
|
43
|
+
end.select do |gem|
|
44
|
+
Dir.exist?(File.join(gem, 'samples'))
|
45
|
+
end.map do |gem|
|
46
|
+
Dir.glob(File.join(gem, 'samples', '*')).select {|file_or_dir| Dir.exist?(file_or_dir)}
|
47
|
+
end.flatten.uniq.reverse
|
48
|
+
if Dir.exist?('samples')
|
49
|
+
Dir.glob(File.join('samples', '*')).to_a.reverse.each do |dir|
|
50
|
+
sample_directories << dir if Dir.exist?(dir)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
sample_directories = sample_directories.uniq {|dir| File.basename(dir)}
|
54
|
+
@sample_directories = sample_directories.map { |file| SampleDirectory.new(file) }
|
55
|
+
end
|
56
|
+
@sample_directories
|
57
|
+
end
|
58
|
+
|
59
|
+
def all_samples
|
60
|
+
@all_samples ||= sample_directories.map(&:samples).reduce(:+)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
include Glimmer # used for observe syntax
|
65
|
+
|
66
|
+
attr_accessor :file
|
67
|
+
|
68
|
+
def initialize(file)
|
69
|
+
self.file = file
|
70
|
+
end
|
71
|
+
|
72
|
+
def name
|
73
|
+
File.basename(file).split('_').map(&:capitalize).join(' ')
|
74
|
+
end
|
75
|
+
|
76
|
+
def samples
|
77
|
+
if @samples.nil?
|
78
|
+
@samples = Dir.glob(File.join(file, '*')).
|
79
|
+
select { |file| File.file?(file) }.
|
80
|
+
map { |sample_file| Sample.new(sample_file, sample_directory: self) }.
|
81
|
+
sort_by(&:name)
|
82
|
+
|
83
|
+
@samples.each do |sample|
|
84
|
+
observe(sample, :selected) do |new_selected_value|
|
85
|
+
if new_selected_value
|
86
|
+
self.class.all_samples.reject {|a_sample| a_sample.name == sample.name}.each do |other_sample|
|
87
|
+
other_sample.selected = false
|
88
|
+
end
|
89
|
+
self.class.selected_sample = sample
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
@samples
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
class MetaSampleApplication
|
99
|
+
include Glimmer
|
100
|
+
|
101
|
+
def launch
|
102
|
+
shell {
|
103
|
+
minimum_size 1280, 768
|
104
|
+
text 'Glimmer Meta-Sample (The Sample of Samples)'
|
105
|
+
|
106
|
+
on_swt_show {
|
107
|
+
SampleDirectory.selected_sample = SampleDirectory.all_samples.first
|
108
|
+
}
|
109
|
+
|
110
|
+
sash_form {
|
111
|
+
composite {
|
112
|
+
grid_layout 1, false
|
113
|
+
|
114
|
+
expand_bar {
|
115
|
+
layout_data(:fill, :fill, true, true)
|
116
|
+
font height: 30
|
117
|
+
|
118
|
+
SampleDirectory.sample_directories.each { |sample_directory|
|
119
|
+
expand_item {
|
120
|
+
layout_data(:fill, :fill, true, true)
|
121
|
+
grid_layout 2, false
|
122
|
+
text "#{sample_directory.name} Samples"
|
123
|
+
|
124
|
+
sample_directory.samples.each { |sample|
|
125
|
+
label_radio = radio {
|
126
|
+
selection bind(sample, :selected)
|
127
|
+
}
|
128
|
+
label {
|
129
|
+
layout_data :fill, :center, true, false
|
130
|
+
text sample.name
|
131
|
+
font height: 24
|
132
|
+
|
133
|
+
on_mouse_up {
|
134
|
+
sample.selected = true
|
135
|
+
}
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
button {
|
143
|
+
layout_data(:fill, :center, true, false) {
|
144
|
+
height_hint 120
|
145
|
+
}
|
146
|
+
text 'Launch Sample'
|
147
|
+
font height: 30
|
148
|
+
on_widget_selected {
|
149
|
+
SampleDirectory.selected_sample.launch
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
154
|
+
code_text {
|
155
|
+
text bind(SampleDirectory, 'selected_sample.content')
|
156
|
+
editable false
|
157
|
+
caret nil
|
158
|
+
}
|
159
|
+
|
160
|
+
weights 1, 2
|
161
|
+
}
|
162
|
+
}.open
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
MetaSampleApplication.new.launch
|
@@ -0,0 +1,108 @@
|
|
1
|
+
# Copyright (c) 2007-2020 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
class HelloExpandBar
|
23
|
+
include Glimmer
|
24
|
+
|
25
|
+
def launch
|
26
|
+
shell {
|
27
|
+
grid_layout(1, false) {
|
28
|
+
margin_width 0
|
29
|
+
margin_height 0
|
30
|
+
}
|
31
|
+
minimum_size 320, 240
|
32
|
+
text 'Hello, Expand Bar!'
|
33
|
+
|
34
|
+
@status_label = label(:center) {
|
35
|
+
text ' '
|
36
|
+
layout_data :fill, :center, true, false
|
37
|
+
font height: 24
|
38
|
+
}
|
39
|
+
|
40
|
+
expand_bar {
|
41
|
+
layout_data :fill, :fill, true, true
|
42
|
+
|
43
|
+
expand_item {
|
44
|
+
text 'Productivity'
|
45
|
+
|
46
|
+
button {
|
47
|
+
text 'Word Processing'
|
48
|
+
}
|
49
|
+
button {
|
50
|
+
text 'Spreadsheets'
|
51
|
+
}
|
52
|
+
button {
|
53
|
+
text 'Presentations'
|
54
|
+
}
|
55
|
+
button {
|
56
|
+
text 'Database'
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
expand_item {
|
61
|
+
text 'Tools'
|
62
|
+
|
63
|
+
button {
|
64
|
+
text 'Calculator'
|
65
|
+
}
|
66
|
+
button {
|
67
|
+
text 'Unit Converter'
|
68
|
+
}
|
69
|
+
button {
|
70
|
+
text 'Currency Converter'
|
71
|
+
}
|
72
|
+
button {
|
73
|
+
text 'Scientific Calculator'
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
expand_item {
|
78
|
+
text 'Reading'
|
79
|
+
|
80
|
+
button {
|
81
|
+
text 'eBooks'
|
82
|
+
}
|
83
|
+
button {
|
84
|
+
text 'News'
|
85
|
+
}
|
86
|
+
button {
|
87
|
+
text 'Blogs'
|
88
|
+
}
|
89
|
+
button {
|
90
|
+
text 'Papers'
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
on_item_expanded { |expand_event|
|
95
|
+
@status_label.text = "#{expand_event.item.text} Expanded!"
|
96
|
+
}
|
97
|
+
|
98
|
+
on_item_collapsed { |expand_event|
|
99
|
+
@status_label.text = "#{expand_event.item.text} Collapsed!"
|
100
|
+
}
|
101
|
+
|
102
|
+
|
103
|
+
}
|
104
|
+
}.open
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
HelloExpandBar.new.launch
|
@@ -0,0 +1,137 @@
|
|
1
|
+
# Copyright (c) 2007-2020 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
class SashFormPresenter
|
23
|
+
include Glimmer
|
24
|
+
|
25
|
+
attr_accessor :sash_width, :orientation, :orientation_style
|
26
|
+
|
27
|
+
def initialize
|
28
|
+
@sash_width = 10
|
29
|
+
self.orientation = 'horizontal'
|
30
|
+
end
|
31
|
+
|
32
|
+
def orientation_options
|
33
|
+
['horizontal', 'vertical']
|
34
|
+
end
|
35
|
+
|
36
|
+
def orientation=(value)
|
37
|
+
@orientation = value
|
38
|
+
self.orientation_style = swt(@orientation)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
@presenter = SashFormPresenter.new
|
43
|
+
|
44
|
+
include Glimmer
|
45
|
+
|
46
|
+
shell {
|
47
|
+
grid_layout 1, false
|
48
|
+
minimum_size 740, 0
|
49
|
+
text 'Hello, Sash Form!'
|
50
|
+
|
51
|
+
@sash_form = sash_form {
|
52
|
+
layout_data(:fill, :fill, true, true) {
|
53
|
+
height_hint 200
|
54
|
+
}
|
55
|
+
sash_width bind(@presenter, :sash_width)
|
56
|
+
orientation bind(@presenter, :orientation_style)
|
57
|
+
weights 1, 2
|
58
|
+
|
59
|
+
@green_label = label {
|
60
|
+
text 'Hello, (resize >>)'
|
61
|
+
background :dark_green
|
62
|
+
foreground :white
|
63
|
+
font height: 30
|
64
|
+
}
|
65
|
+
|
66
|
+
@red_label = label {
|
67
|
+
text '(<< resize) Sash Form!'
|
68
|
+
background :red
|
69
|
+
foreground :white
|
70
|
+
font height: 30
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
composite {
|
75
|
+
layout_data(:fill, :fill, true, true)
|
76
|
+
grid_layout 2, true
|
77
|
+
|
78
|
+
label {
|
79
|
+
layout_data(:right, :center, true, false)
|
80
|
+
text 'Sash Width:'
|
81
|
+
font height: 16
|
82
|
+
}
|
83
|
+
spinner {
|
84
|
+
layout_data(:fill, :center, true, false) {
|
85
|
+
width_hint 100
|
86
|
+
}
|
87
|
+
selection bind(@presenter, :sash_width)
|
88
|
+
font height: 16
|
89
|
+
}
|
90
|
+
|
91
|
+
label {
|
92
|
+
layout_data(:right, :center, true, false)
|
93
|
+
text 'Orientation:'
|
94
|
+
font height: 16
|
95
|
+
}
|
96
|
+
combo(:read_only, :border) {
|
97
|
+
layout_data(:fill, :center, true, false) {
|
98
|
+
width_hint 100
|
99
|
+
}
|
100
|
+
selection bind(@presenter, :orientation)
|
101
|
+
font height: 16
|
102
|
+
}
|
103
|
+
|
104
|
+
button {
|
105
|
+
layout_data(:fill, :center, true, false)
|
106
|
+
text 'Maximize Green Label'
|
107
|
+
foreground :dark_green
|
108
|
+
font height: 16
|
109
|
+
|
110
|
+
on_widget_selected {
|
111
|
+
@sash_form.maximized_control = @green_label.swt_widget
|
112
|
+
}
|
113
|
+
}
|
114
|
+
button {
|
115
|
+
layout_data(:fill, :center, true, false)
|
116
|
+
text 'Maximize Red Label'
|
117
|
+
foreground :red
|
118
|
+
font height: 16
|
119
|
+
|
120
|
+
on_widget_selected {
|
121
|
+
@sash_form.maximized_control = @red_label.swt_widget
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
button {
|
126
|
+
layout_data(:fill, :center, true, false) {
|
127
|
+
horizontal_span 2
|
128
|
+
}
|
129
|
+
text 'Maximize None'
|
130
|
+
font height: 16
|
131
|
+
|
132
|
+
on_widget_selected {
|
133
|
+
@sash_form.maximized_control = nil
|
134
|
+
}
|
135
|
+
}
|
136
|
+
}
|
137
|
+
}.open
|
@@ -0,0 +1,138 @@
|
|
1
|
+
# Copyright (c) 2007-2020 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
verbiage = <<-MULTI_LINE_STRING
|
23
|
+
|
24
|
+
Glimmer DSL for SWT is a native-GUI cross-platform desktop development library written in JRuby,
|
25
|
+
an OS-threaded faster version of Ruby.
|
26
|
+
Glimmer's main innovation is a declarative Ruby DSL that enables productive and efficient authoring
|
27
|
+
of desktop application user-interfaces while relying on the robust Eclipse SWT library.
|
28
|
+
Glimmer additionally innovates by having built-in data-binding support, which greatly facilitates
|
29
|
+
synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components
|
30
|
+
and enabling developers to solve business problems (test-first) without worrying about GUI concerns.
|
31
|
+
To get started quickly, Glimmer offers scaffolding options for Apps, Gems, and Custom Widgets.
|
32
|
+
Glimmer also includes native-executable packaging support, sorely lacking in other libraries,
|
33
|
+
thus enabling the delivery of desktop apps written in Ruby as truly native DMG/PKG/APP files on
|
34
|
+
the Mac + App Store, MSI/EXE files on Windows, and Gem Packaged Shell Scripts on Linux.
|
35
|
+
|
36
|
+
MULTI_LINE_STRING
|
37
|
+
|
38
|
+
class StyledTextPresenter
|
39
|
+
include Glimmer
|
40
|
+
attr_accessor :text, :caret_offset, :selection_count, :selection, :top_pixel
|
41
|
+
|
42
|
+
def line_index_for_offset(line_offset)
|
43
|
+
text[0..line_offset].split("\n").size
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
include Glimmer
|
48
|
+
|
49
|
+
@presenter = StyledTextPresenter.new
|
50
|
+
@presenter.text = verbiage*8
|
51
|
+
@presenter.caret_offset = 0
|
52
|
+
@presenter.selection_count = 0
|
53
|
+
@presenter.selection = Point.new(0, 0)
|
54
|
+
@presenter.top_pixel = 0
|
55
|
+
|
56
|
+
shell {
|
57
|
+
text 'Hello, Styled Text!'
|
58
|
+
|
59
|
+
composite {
|
60
|
+
@styled_text = styled_text {
|
61
|
+
layout_data :fill, :fill, true, true
|
62
|
+
text bind(@presenter, :text)
|
63
|
+
left_margin 5
|
64
|
+
top_margin 5
|
65
|
+
right_margin 5
|
66
|
+
bottom_margin 5
|
67
|
+
# caret offset scrolls text to view when out of page
|
68
|
+
caret_offset bind(@presenter, :caret_offset)
|
69
|
+
# selection_count is not needed if selection is used
|
70
|
+
selection_count bind(@presenter, :selection_count)
|
71
|
+
# selection contains both caret_offset and selection_count, but setting it does not scroll text into view if out of page
|
72
|
+
selection bind(@presenter, :selection)
|
73
|
+
# top_pixel indicates vertically what pixel scrolling is at in a long multi-page text document
|
74
|
+
top_pixel bind(@presenter, :top_pixel)
|
75
|
+
|
76
|
+
# This demonstrates how to set styles via a listener
|
77
|
+
on_line_get_style { |line_style_event|
|
78
|
+
line_offset = line_style_event.lineOffset
|
79
|
+
if @presenter.line_index_for_offset(line_offset) % 52 < 13
|
80
|
+
line_size = line_style_event.lineText.size
|
81
|
+
style_range = StyleRange.new(line_offset, line_size, color(:blue).swt_color, nil, swt(:italic))
|
82
|
+
style_range.font = Font.new(display.swt_display, 'Times New Roman', 18, swt(:normal))
|
83
|
+
line_style_event.styles = [style_range].to_java(StyleRange)
|
84
|
+
elsif @presenter.line_index_for_offset(line_offset) % 52 < 26
|
85
|
+
line_size = line_style_event.lineText.size
|
86
|
+
style_range = StyleRange.new(line_offset, line_size, color(:dark_green).swt_color, color(:yellow).swt_color, swt(:bold))
|
87
|
+
line_style_event.styles = [style_range].to_java(StyleRange)
|
88
|
+
elsif @presenter.line_index_for_offset(line_offset) % 52 < 39
|
89
|
+
line_size = line_style_event.lineText.size
|
90
|
+
style_range = StyleRange.new(line_offset, line_size, color(:red).swt_color, nil, swt(:normal))
|
91
|
+
style_range.underline = true
|
92
|
+
style_range.font = Font.new(display.swt_display, 'Arial', 16, swt(:normal))
|
93
|
+
line_style_event.styles = [style_range].to_java(StyleRange)
|
94
|
+
else
|
95
|
+
line_size = line_style_event.lineText.size
|
96
|
+
style_range = StyleRange.new(line_offset, line_size, color(:dark_magenta).swt_color, color(:cyan).swt_color, swt(:normal))
|
97
|
+
style_range.strikeout = true
|
98
|
+
line_style_event.styles = [style_range].to_java(StyleRange)
|
99
|
+
end
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
composite {
|
104
|
+
row_layout :horizontal
|
105
|
+
|
106
|
+
label {
|
107
|
+
text 'Caret Offset:'
|
108
|
+
}
|
109
|
+
text {
|
110
|
+
text bind(@presenter, :caret_offset, on_read: ->(o) {"%04d" % [o] })
|
111
|
+
}
|
112
|
+
label {
|
113
|
+
text 'Selection Count:'
|
114
|
+
}
|
115
|
+
text {
|
116
|
+
text bind(@presenter, :selection_count, on_read: ->(o) {"%04d" % [o] })
|
117
|
+
}
|
118
|
+
label {
|
119
|
+
text 'Selection Start:'
|
120
|
+
}
|
121
|
+
text {
|
122
|
+
text bind(@presenter, 'selection.x', on_read: ->(o) {"%04d" % [o] })
|
123
|
+
}
|
124
|
+
label {
|
125
|
+
text 'Selection End:'
|
126
|
+
}
|
127
|
+
text {
|
128
|
+
text bind(@presenter, 'selection.y', on_read: ->(o) {"%04d" % [o] })
|
129
|
+
}
|
130
|
+
label {
|
131
|
+
text 'Top Pixel:'
|
132
|
+
}
|
133
|
+
text {
|
134
|
+
text bind(@presenter, :top_pixel, on_read: ->(o) {"%04d" % [o] })
|
135
|
+
}
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}.open
|