glimmer-dsl-tk 0.0.26 → 0.0.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -0
- data/README.md +804 -61
- data/VERSION +1 -1
- data/glimmer-dsl-tk.gemspec +0 -0
- data/lib/glimmer/dsl/tk/built_in_dialog_expression.rb +57 -0
- data/lib/glimmer/dsl/tk/dsl.rb +1 -0
- data/lib/glimmer/tk/drag_and_drop_extension.rb +112 -0
- data/lib/glimmer/tk/label_proxy.rb +0 -10
- data/lib/glimmer/tk/text_proxy.rb +210 -50
- data/lib/glimmer/tk/widget_proxy.rb +23 -8
- data/samples/elaborate/meta_sample.rb +6 -6
- data/samples/hello/hello_built_in_dialog.rb +68 -0
- data/samples/hello/hello_drag_and_drop.rb +159 -0
- data/samples/hello/hello_message_box.rb +0 -4
- data/samples/hello/hello_separator.rb +69 -0
- data/samples/hello/hello_text.rb +202 -23
- data/samples/hello/images/align-center.png +0 -0
- data/samples/hello/images/align-left.png +0 -0
- data/samples/hello/images/align-right.png +0 -0
- data/samples/hello/images/copy.png +0 -0
- data/samples/hello/images/cut.png +0 -0
- data/samples/hello/images/paste.png +0 -0
- data/samples/hello/images/picture.png +0 -0
- data/samples/hello/images/redo.png +0 -0
- data/samples/hello/images/search.png +0 -0
- data/samples/hello/images/undo.png +0 -0
- metadata +19 -4
@@ -0,0 +1,68 @@
|
|
1
|
+
# Copyright (c) 2020-2021 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
|
+
require 'glimmer-dsl-tk'
|
23
|
+
|
24
|
+
include Glimmer
|
25
|
+
|
26
|
+
root { |w|
|
27
|
+
title 'Hello, Built-in Dialog!'
|
28
|
+
width 400
|
29
|
+
height 400
|
30
|
+
x 150
|
31
|
+
y 150
|
32
|
+
|
33
|
+
frame {
|
34
|
+
%w[get_open_file get_multiple_open_file get_save_file choose_directory choose_color].each do |dialog|
|
35
|
+
button {
|
36
|
+
text dialog.split('_').map(&:capitalize).join(' ')
|
37
|
+
|
38
|
+
on('command') do
|
39
|
+
result = send(dialog, parent: w)
|
40
|
+
@result_label.text = [result].flatten.join("\n")
|
41
|
+
end
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
button {
|
46
|
+
text 'Choose Font'
|
47
|
+
|
48
|
+
on('command') do
|
49
|
+
choose_font(family: 'Courier New', size: '30', weight: 'bold') do |chosen_font|
|
50
|
+
@result_label.text = chosen_font
|
51
|
+
end
|
52
|
+
end
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
frame {
|
57
|
+
grid sticky: 'nsew', padx: 15, pady: 15
|
58
|
+
|
59
|
+
label {
|
60
|
+
grid row: 0, column: 0
|
61
|
+
text 'Result:'
|
62
|
+
}
|
63
|
+
|
64
|
+
@result_label = label {
|
65
|
+
grid row: 0, column: 1
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}.open
|
@@ -0,0 +1,159 @@
|
|
1
|
+
# Copyright (c) 2020-2021 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
|
+
require "glimmer-dsl-tk"
|
23
|
+
require "glimmer/tk/drag_and_drop_extension"
|
24
|
+
|
25
|
+
include Glimmer
|
26
|
+
|
27
|
+
root {
|
28
|
+
title "Hello, Drag and Drop!"
|
29
|
+
frame {
|
30
|
+
padding 5
|
31
|
+
labelframe {
|
32
|
+
text "Drag sources"
|
33
|
+
padding 5
|
34
|
+
label {
|
35
|
+
text "Entry"
|
36
|
+
grid :row => 0, :column => 0
|
37
|
+
}
|
38
|
+
entry {
|
39
|
+
text "Drag entry text"
|
40
|
+
width 30
|
41
|
+
grid :row => 0, :column => 1, :pady => 5, :sticky => "e"
|
42
|
+
on_drag_start { |event|
|
43
|
+
event.data = event.source.textvariable&.value
|
44
|
+
event.source.configure(:cursor => "hand2")
|
45
|
+
TkLabel.new(event.tooltip) {
|
46
|
+
text event.data + " "
|
47
|
+
bg "yellow"
|
48
|
+
bitmap "warning"
|
49
|
+
compound "right"
|
50
|
+
}.pack
|
51
|
+
}
|
52
|
+
on_drag_motion { |event|
|
53
|
+
if event.drop_accepted
|
54
|
+
event.source.configure(:cursor => "hand1")
|
55
|
+
else
|
56
|
+
event.source.configure(:cursor => "hand2")
|
57
|
+
end
|
58
|
+
event.tooltip.geometry("+#{event.x_root + 10}+#{event.y_root - 4}")
|
59
|
+
}
|
60
|
+
}
|
61
|
+
label {
|
62
|
+
text "Label"
|
63
|
+
grid :row => 1, :column => 0
|
64
|
+
}
|
65
|
+
label {
|
66
|
+
text "Drag label text"
|
67
|
+
width 30
|
68
|
+
grid :row => 1, :column => 1, :pady => 10, :sticky => "e"
|
69
|
+
drag_source true
|
70
|
+
}
|
71
|
+
label {
|
72
|
+
text "Combobox"
|
73
|
+
grid :row => 2, :column => 0
|
74
|
+
}
|
75
|
+
combobox {
|
76
|
+
text "Spain"
|
77
|
+
values %w[USA Canada Mexico Columbia UK Australia Germany Italy Spain]
|
78
|
+
width 27
|
79
|
+
grid :row => 2, :column => 1, :pady => 5, :sticky => "e"
|
80
|
+
on_drag_start { |event|
|
81
|
+
event.data = event.source.textvariable&.value
|
82
|
+
}
|
83
|
+
}
|
84
|
+
label {
|
85
|
+
text "Button"
|
86
|
+
grid :row => 3, :column => 0
|
87
|
+
}
|
88
|
+
button {
|
89
|
+
text "Drag it"
|
90
|
+
grid :row => 3, :column => 1, :pady => 5, :sticky => "w"
|
91
|
+
drag_source true
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
labelframe {
|
96
|
+
text "Drop targets"
|
97
|
+
grid :sticky => "nsew", :pady => 15
|
98
|
+
padding 5
|
99
|
+
label {
|
100
|
+
text "Entry"
|
101
|
+
grid :row => 0, :column => 0
|
102
|
+
}
|
103
|
+
entry {
|
104
|
+
width 30
|
105
|
+
grid :row => 0, :column => 1, :pady => 5, :sticky => "e"
|
106
|
+
on_drop { |event|
|
107
|
+
event.target.textvariable.value = event.data
|
108
|
+
}
|
109
|
+
}
|
110
|
+
label {
|
111
|
+
text "Label"
|
112
|
+
grid :row => 1, :column => 0
|
113
|
+
}
|
114
|
+
label {
|
115
|
+
width 30
|
116
|
+
grid :row => 1, :column => 1, :pady => 10, :sticky => "e"
|
117
|
+
borderwidth 2
|
118
|
+
relief "solid"
|
119
|
+
on_drop { |event|
|
120
|
+
event.target.textvariable.value = event.data
|
121
|
+
}
|
122
|
+
}
|
123
|
+
label {
|
124
|
+
text "Combobox"
|
125
|
+
grid :row => 2, :column => 0
|
126
|
+
}
|
127
|
+
combobox {
|
128
|
+
width 27
|
129
|
+
grid :row => 2, :column => 1, :pady => 5, :sticky => "e"
|
130
|
+
on_drop { |event|
|
131
|
+
event.target.textvariable.value = event.data
|
132
|
+
}
|
133
|
+
}
|
134
|
+
label {
|
135
|
+
text "Button"
|
136
|
+
grid :row => 3, :column => 0
|
137
|
+
}
|
138
|
+
button {
|
139
|
+
text "Drop here"
|
140
|
+
grid :row => 3, :column => 1, :pady => 5, :sticky => "w"
|
141
|
+
on_drop { |event|
|
142
|
+
event.target.text = event.data
|
143
|
+
}
|
144
|
+
}
|
145
|
+
label {
|
146
|
+
text "Checkbutton"
|
147
|
+
grid :row => 4, :column => 0
|
148
|
+
}
|
149
|
+
checkbutton {
|
150
|
+
text "Drop here to destroy a widget\n(except button)"
|
151
|
+
grid :row => 4, :column => 1, :pady => 5, :sticky => "w"
|
152
|
+
on_drop { |event|
|
153
|
+
event.target.text = event.data
|
154
|
+
event.source.destroy unless event.source.is_a? Tk::Button
|
155
|
+
}
|
156
|
+
}
|
157
|
+
}
|
158
|
+
}
|
159
|
+
}.open
|
@@ -27,8 +27,6 @@ root { |r|
|
|
27
27
|
title 'Hello, Message Box!'
|
28
28
|
|
29
29
|
frame {
|
30
|
-
grid sticky: 'nsew', padx: 15, pady: 15
|
31
|
-
|
32
30
|
button {
|
33
31
|
text 'Please Click To Win a Surprise'
|
34
32
|
|
@@ -80,8 +78,6 @@ root { |r|
|
|
80
78
|
}
|
81
79
|
|
82
80
|
frame {
|
83
|
-
grid sticky: 'nsew', padx: 15, pady: 15
|
84
|
-
|
85
81
|
label {
|
86
82
|
grid row: 0, column: 0
|
87
83
|
text 'Result:'
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Copyright (c) 2020-2021 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
|
+
require 'glimmer-dsl-tk'
|
23
|
+
|
24
|
+
include Glimmer
|
25
|
+
|
26
|
+
root {
|
27
|
+
title 'Hello, Separator!'
|
28
|
+
width 200
|
29
|
+
height 200
|
30
|
+
|
31
|
+
label {
|
32
|
+
grid row: 0, column: 0, min_width: 100, min_height: 100, column_weight: 0, sticky: 'nsew'
|
33
|
+
text 'Label 1'
|
34
|
+
anchor 'center'
|
35
|
+
}
|
36
|
+
|
37
|
+
separator {
|
38
|
+
grid row: 0, column: 1
|
39
|
+
orient 'vertical'
|
40
|
+
}
|
41
|
+
|
42
|
+
label {
|
43
|
+
grid row: 0, column: 2, min_width: 100, min_height: 100, sticky: 'nsew'
|
44
|
+
text 'Label 2'
|
45
|
+
anchor 'center'
|
46
|
+
}
|
47
|
+
|
48
|
+
separator {
|
49
|
+
grid row: 1, column: 0, column_span: 3
|
50
|
+
# orient 'horizontal' # default
|
51
|
+
}
|
52
|
+
|
53
|
+
label {
|
54
|
+
grid row: 2, column: 0, min_width: 100, min_height: 100, sticky: 'nsew'
|
55
|
+
text 'Label 3'
|
56
|
+
anchor 'center'
|
57
|
+
}
|
58
|
+
|
59
|
+
separator {
|
60
|
+
grid row: 2, column: 1
|
61
|
+
orient 'vertical'
|
62
|
+
}
|
63
|
+
|
64
|
+
label {
|
65
|
+
grid row: 2, column: 2, min_width: 100, min_height: 100, sticky: 'nsew'
|
66
|
+
text 'Label 4'
|
67
|
+
anchor 'center'
|
68
|
+
}
|
69
|
+
}.open
|
data/samples/hello/hello_text.rb
CHANGED
@@ -25,14 +25,47 @@ class HelloText
|
|
25
25
|
include Glimmer
|
26
26
|
|
27
27
|
COLOR_OPTIONS = %w[black purple blue green orange yellow red white].map(&:capitalize)
|
28
|
-
|
29
|
-
|
28
|
+
FONT_FAMILY_OPTIONS = ::TkFont.families
|
29
|
+
FOREGROUND_PROMPT = '<foreground>'
|
30
|
+
BACKGROUND_PROMPT = '<background>'
|
31
|
+
FONT_FAMILY_PROMPT = '<font family>'
|
32
|
+
FONT_SIZE_PROMPT = '<font size>'
|
30
33
|
|
31
34
|
def initialize
|
32
35
|
@foreground = FOREGROUND_PROMPT
|
33
36
|
@background = BACKGROUND_PROMPT
|
37
|
+
@font_family = FONT_FAMILY_PROMPT
|
38
|
+
@font_size = FONT_SIZE_PROMPT
|
39
|
+
@document = <<~MULTI_LINE_STRING
|
40
|
+
According to the National Post, a heavy metal-loving high school principal in Canada will be allowed to keep her job, days after a public campaign to oust her made headlines around the globe.
|
41
|
+
|
42
|
+
Parents at Eden High School in St. Catharines, Ontario launched a petition to remove principal Sharon Burns after discovering she's an IRON MAIDEN fan.
|
43
|
+
|
44
|
+
The petition, titled "Eden High School Principal, Sharon Burns, Needs to Be Transferred Immediately!" read, "We are deeply disturbed that the principal assigned to the school blatantly showed Satanic symbols and her allegiance to Satanic practices on her public social media platforms where all the students can see them under @edenprincipal (not her personal account)."
|
45
|
+
|
46
|
+
More than 500 people signed the petition to transfer Burns after she posted a picture of herself flashing the "devil horns" hand sign with a doll of the MAIDEN zombie mascot Eddie behind her as well as a personalized license plate reading "IRNMADEN" and a handwritten note that reads "Eddie 666" on a car's dashboard.
|
47
|
+
|
48
|
+
|
49
|
+
The number 666 is used to represent the devil, and is featured prominently in MAIDEN's artwork by the band, whose classic third album is titled "The Number Of The Beast".
|
50
|
+
|
51
|
+
The petition was later updated to state that the demand for her transfer is not because of her love for metal, but for "openly displaying her own handmade sign with the 666 clearly displayed on it".
|
52
|
+
|
53
|
+
The creator of the original petition wrote: "Sharon knows full well what she did was simply inappropriate, unnecessary and not professional but has yet to publicly admit so and is willing to allow people to believe a completely different story, making very real concerns seem petty."
|
54
|
+
|
55
|
+
Meanwhile, a counter-petition supporting Burns garnered over 20,000 signatures.
|
56
|
+
|
57
|
+
"It is ridiculous that a couple of parents judge her role as a principal only based on an Instagram post. (About liking the band IRON MAIDEN. That's it.) Eden High School is a public school. Not a Christian school," the petition titled "We need Mrs Burns" stated. "She has made Eden a safe space for so many people. She spreads nothing but love and kindness."
|
58
|
+
|
59
|
+
After the complaints were aired, the District School Board of Niagara spoke with Burns and the parents who launched the petition, and the issue is over as far as the board is concerned, Kim Sweeney, the board's chief communications officer, told the National Post. No disciplinary action or policy changes were needed.
|
60
|
+
|
61
|
+
"Our belief is that taste in music is subjective and we support that both students and staff enjoy a wide variety of genres," Sweeney said.
|
62
|
+
|
63
|
+
The original petition has since been removed.
|
64
|
+
MULTI_LINE_STRING
|
34
65
|
end
|
35
66
|
|
67
|
+
attr_accessor :document
|
68
|
+
|
36
69
|
attr_accessor :foreground
|
37
70
|
|
38
71
|
def foreground_options
|
@@ -45,54 +78,200 @@ class HelloText
|
|
45
78
|
[BACKGROUND_PROMPT] + COLOR_OPTIONS
|
46
79
|
end
|
47
80
|
|
81
|
+
attr_accessor :font_family
|
82
|
+
|
83
|
+
def font_family_options
|
84
|
+
[FONT_FAMILY_PROMPT] + FONT_FAMILY_OPTIONS
|
85
|
+
end
|
86
|
+
|
87
|
+
attr_accessor :font_size
|
88
|
+
|
89
|
+
def font_size_options
|
90
|
+
[FONT_SIZE_PROMPT] + (9..64).to_a.map(&:to_s)
|
91
|
+
end
|
92
|
+
|
48
93
|
def launch
|
49
94
|
root {
|
50
95
|
title 'Hello, Text!'
|
96
|
+
width 1280
|
97
|
+
height 800
|
51
98
|
|
52
99
|
frame {
|
53
100
|
grid row: 0, column: 0
|
54
101
|
|
102
|
+
label {
|
103
|
+
grid row: 0, column: 0, columnspan: 17
|
104
|
+
text 'Select a region of text and then apply formatting from the toolbar'
|
105
|
+
}
|
106
|
+
|
107
|
+
column_index = -1
|
108
|
+
|
109
|
+
combobox {
|
110
|
+
grid row: 1, column: column_index += 1, column_weight: 1
|
111
|
+
readonly true
|
112
|
+
text <=> [self, :font_family, after_write: ->(value) { @text.toggle_selection_font_format('family', value == FONT_FAMILY_PROMPT ? 'Courier New' : value) }]
|
113
|
+
}
|
114
|
+
|
115
|
+
combobox {
|
116
|
+
grid row: 1, column: column_index += 1, column_weight: 1
|
117
|
+
readonly true
|
118
|
+
text <=> [self, :font_size, after_write: ->(value) { @text.toggle_selection_font_format('size', value == FONT_SIZE_PROMPT ? 13 : value) }]
|
119
|
+
}
|
120
|
+
|
55
121
|
combobox {
|
56
|
-
grid row:
|
122
|
+
grid row: 1, column: column_index += 1, column_weight: 1
|
57
123
|
readonly true
|
58
124
|
text <=> [self, :foreground, after_write: ->(value) { @text.add_selection_format('foreground', value == FOREGROUND_PROMPT ? 'black' : value) }]
|
59
125
|
}
|
60
126
|
|
61
127
|
combobox {
|
62
|
-
grid row:
|
128
|
+
grid row: 1, column: column_index += 1, column_weight: 1
|
63
129
|
readonly true
|
64
|
-
text <=> [self, :background, after_write: ->(value) { @text.add_selection_format('background', value == BACKGROUND_PROMPT ? '
|
130
|
+
text <=> [self, :background, after_write: ->(value) { @text.add_selection_format('background', value == BACKGROUND_PROMPT ? 'white' : value) }]
|
65
131
|
}
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
132
|
+
|
133
|
+
separator {
|
134
|
+
grid row: 1, column: column_index += 1, column_weight: 0
|
135
|
+
orient 'vertical'
|
136
|
+
}
|
137
|
+
|
138
|
+
button {
|
139
|
+
grid row: 1, column: column_index += 1, column_weight: 0
|
140
|
+
text 'B'
|
141
|
+
style font: {weight: 'bold'}
|
72
142
|
|
73
|
-
|
143
|
+
on('command') do
|
144
|
+
@text.toggle_selection_font_format('weight', 'bold')
|
145
|
+
end
|
146
|
+
}
|
147
|
+
|
148
|
+
button {
|
149
|
+
grid row: 1, column: column_index += 1, column_weight: 0
|
150
|
+
text 'I'
|
151
|
+
style font: {slant: 'italic'}
|
74
152
|
|
75
|
-
|
153
|
+
on('command') do
|
154
|
+
@text.toggle_selection_font_format('slant', 'italic')
|
155
|
+
end
|
156
|
+
}
|
157
|
+
|
158
|
+
button {
|
159
|
+
grid row: 1, column: column_index += 1, column_weight: 0
|
160
|
+
text 'U'
|
161
|
+
style font: {underline: true}
|
76
162
|
|
77
|
-
|
163
|
+
on('command') do
|
164
|
+
@text.toggle_selection_font_format('underline', true)
|
165
|
+
end
|
166
|
+
}
|
167
|
+
|
168
|
+
separator {
|
169
|
+
grid row: 1, column: column_index += 1, column_weight: 0
|
170
|
+
orient 'vertical'
|
171
|
+
}
|
172
|
+
|
173
|
+
button {
|
174
|
+
grid row: 1, column: column_index += 1, column_weight: 0
|
175
|
+
image File.expand_path("images/cut.png", __dir__), subsample: 32
|
78
176
|
|
177
|
+
on('command') do
|
178
|
+
@text.text_cut
|
179
|
+
end
|
180
|
+
}
|
181
|
+
|
182
|
+
button {
|
183
|
+
grid row: 1, column: column_index += 1, column_weight: 0
|
184
|
+
image File.expand_path("images/copy.png", __dir__), subsample: 32
|
79
185
|
|
80
|
-
|
186
|
+
on('command') do
|
187
|
+
@text.text_copy
|
188
|
+
end
|
189
|
+
}
|
190
|
+
|
191
|
+
button {
|
192
|
+
grid row: 1, column: column_index += 1, column_weight: 0
|
193
|
+
image File.expand_path("images/paste.png", __dir__), subsample: 32
|
81
194
|
|
82
|
-
|
195
|
+
on('command') do
|
196
|
+
@text.text_paste
|
197
|
+
end
|
198
|
+
}
|
199
|
+
|
200
|
+
separator {
|
201
|
+
grid row: 1, column: column_index += 1, column_weight: 0
|
202
|
+
orient 'vertical'
|
203
|
+
}
|
204
|
+
|
205
|
+
button {
|
206
|
+
grid row: 1, column: column_index += 1, column_weight: 0
|
207
|
+
image File.expand_path("images/align-left.png", __dir__), subsample: 32
|
83
208
|
|
84
|
-
|
209
|
+
on('command') do
|
210
|
+
@text.add_selection_format('justify', 'left')
|
211
|
+
end
|
212
|
+
}
|
213
|
+
|
214
|
+
button {
|
215
|
+
grid row: 1, column: column_index += 1, column_weight: 0
|
216
|
+
image File.expand_path("images/align-center.png", __dir__), subsample: 32
|
85
217
|
|
86
|
-
|
218
|
+
on('command') do
|
219
|
+
@text.add_selection_format('justify', 'center')
|
220
|
+
end
|
221
|
+
}
|
222
|
+
|
223
|
+
button {
|
224
|
+
grid row: 1, column: column_index += 1, column_weight: 0
|
225
|
+
image File.expand_path("images/align-right.png", __dir__), subsample: 32
|
87
226
|
|
88
|
-
|
227
|
+
on('command') do
|
228
|
+
@text.add_selection_format('justify', 'right')
|
229
|
+
end
|
230
|
+
}
|
231
|
+
|
232
|
+
separator {
|
233
|
+
grid row: 1, column: column_index += 1, column_weight: 0
|
234
|
+
orient 'vertical'
|
235
|
+
}
|
236
|
+
|
237
|
+
button {
|
238
|
+
grid row: 1, column: column_index += 1, column_weight: 0
|
239
|
+
image File.expand_path("images/undo.png", __dir__), subsample: 32
|
89
240
|
|
90
|
-
|
241
|
+
on('command') do
|
242
|
+
@text.edit_undo
|
243
|
+
end
|
244
|
+
}
|
245
|
+
|
246
|
+
button {
|
247
|
+
grid row: 1, column: column_index += 1, column_weight: 0
|
248
|
+
image File.expand_path("images/redo.png", __dir__), subsample: 32
|
91
249
|
|
92
|
-
|
250
|
+
on('command') do
|
251
|
+
@text.edit_redo
|
252
|
+
end
|
253
|
+
}
|
254
|
+
|
255
|
+
separator {
|
256
|
+
grid row: 1, column: column_index += 1, column_weight: 0
|
257
|
+
orient 'vertical'
|
258
|
+
}
|
259
|
+
|
260
|
+
button {
|
261
|
+
grid row: 1, column: column_index += 1, column_weight: 0
|
262
|
+
image File.expand_path("images/picture.png", __dir__), subsample: 32
|
93
263
|
|
94
|
-
|
95
|
-
|
264
|
+
on('command') do
|
265
|
+
@text.get_open_file_to_insert_image
|
266
|
+
end
|
267
|
+
}
|
268
|
+
}
|
269
|
+
|
270
|
+
@text = text {
|
271
|
+
grid row: 1, column: 0, row_weight: 1
|
272
|
+
wrap 'word'
|
273
|
+
undo true
|
274
|
+
value <=> [self, :document]
|
96
275
|
}
|
97
276
|
}.open
|
98
277
|
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|