glimmer-cs-gladiator 0.5.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +46 -20
- data/VERSION +1 -1
- data/lib/models/glimmer/gladiator/command.rb +41 -8
- data/lib/models/glimmer/gladiator/dir.rb +1 -1
- data/lib/models/glimmer/gladiator/file.rb +72 -55
- data/lib/views/glimmer/gladiator.rb +400 -196
- data/lib/views/glimmer/gladiator/text_editor.rb +12 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 686df61b4e15ac85a1cc5d08cb3e83f088bce3a40b2a6e155101f657189075f3
|
4
|
+
data.tar.gz: 12874887ef0d8a846ef43d5eb89ad2d1ec184fe3d0171a4cf692a1f9348efe61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8816804e0a23b860d98b6f583dba265cafac70ce3960b297f5c99dfa6de27d55441c5f959378d4851901e7cf059ec565bdbfc5911c114e8f41e250191f4b27fb
|
7
|
+
data.tar.gz: 288eccb3f7edbd055d54c0f05d9878a1630c057ca1f7464f7ecb586e5a632d33466197511f0e564900816dbb0b76b3a86ddc743d0fb0d60763a776ef592eb9d2
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# <img src='https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-gladiator/master/images/glimmer-cs-gladiator-logo.svg' height=85 /> Gladiator 0.
|
1
|
+
# <img src='https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-gladiator/master/images/glimmer-cs-gladiator-logo.svg' height=85 /> Gladiator 0.6.0 - [Ugliest Text Editor Ever](https://www.reddit.com/r/ruby/comments/hgve8k/gladiator_glimmer_editor_ugliest_text_editor_ever/)
|
2
2
|
## [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 /> Glimmer Custom Shell](https://github.com/AndyObtiva/glimmer-dsl-swt#custom-shell-gem)
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-cs-gladiator.svg)](http://badge.fury.io/rb/glimmer-cs-gladiator)
|
4
4
|
|
@@ -11,21 +11,14 @@ I leave building truly professional text editors to software tooling experts who
|
|
11
11
|
|
12
12
|
## Features
|
13
13
|
|
14
|
-
Gladiator currently supports the following text editing features (including keyboard shortcuts with Mac CMD=CTRL on Windows/Linux)
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
-
|
19
|
-
- File explorer navigation with context menu to open file, rename, delete, add new file, add new directory, or refresh tree (CMD+T)
|
20
|
-
- File lookup by name ignoring slashes, underscores, and dots to ease lookup (CMD+R)
|
21
|
-
- Watch open file for external changes to automatically refresh in editor
|
22
|
-
- Watch project subdirectories for changes to automatically refresh in file explorer/file lookup
|
23
|
-
- Find & Replace (CMD+F)
|
14
|
+
Gladiator currently supports the following text editing features (including keyboard shortcuts with Mac CMD=CTRL on Windows/Linux)
|
15
|
+
|
16
|
+
### Text Editor
|
17
|
+
|
18
|
+
- Text Editor with Colored Ruby Syntax Highlighting
|
24
19
|
- Show Line Numbers
|
25
|
-
-
|
26
|
-
-
|
27
|
-
- Remember opened tabs, caret position, top line, window size, and window location
|
28
|
-
- Autosave on focus out/quit/open new file
|
20
|
+
- Multi-tab support (CMD+SHIFT+[ & CMD+SHIFT+] for tab navigation. CMD+1-9 to jump to a specific tab)
|
21
|
+
- Drag and drop split pane (drag a file from File Tree or File Lookup List, and it splits the pane)
|
29
22
|
- Duplicate Line(s)/selection (CMD+D)
|
30
23
|
- Kill Line(s)/selection (CMD+K)
|
31
24
|
- Move line/selection up (CMD+UP)
|
@@ -33,8 +26,41 @@ Gladiator currently supports the following text editing features (including keyb
|
|
33
26
|
- Comment/Uncomment line/selection (CMD+/)
|
34
27
|
- Indent/Unindent line/selection (CMD+] & CMD+[)
|
35
28
|
- Insert/Prefix New Line (CMD+ENTER & CMD+SHIFT+ENTER)
|
36
|
-
|
37
|
-
|
29
|
+
|
30
|
+
### File Explorer Tree
|
31
|
+
|
32
|
+
- Collapsable file explorer tree listing files and directories for open project
|
33
|
+
- Context menu to open file, rename, delete, add new file, add new directory, and refresh tree
|
34
|
+
- Jump to open file in tree (CMD+T)
|
35
|
+
|
36
|
+
### File Lookup List Filter
|
37
|
+
|
38
|
+
- Collapsable file lookup list filter (CMD+R)
|
39
|
+
- Semi-fuzzy filtering by ignoring slashes, underscores, and dots to ease lookup
|
40
|
+
|
41
|
+
### Navigation Area
|
42
|
+
|
43
|
+
- Show current text editor file name
|
44
|
+
- Show file navigation stats (Caret Position / Line Position / Selection Count / Top Pixel)
|
45
|
+
- Jump to Line (CMD+L)
|
46
|
+
- Find & Replace (CMD+F)
|
47
|
+
|
48
|
+
### Menus
|
49
|
+
|
50
|
+
- File Menu to Open Project (CMD+SHIFT+P) and open Scratchpad for running arbitrary Ruby/Glimmer code without saving to disk (CMD+SHIFT+S)
|
51
|
+
- View Menu to Split Pane & Change Split Orientation to Horizontal/Vertical (CMD+SHIFT+O)
|
52
|
+
- Run Menu to run Ruby code (CMD+SHIFT+R)
|
53
|
+
|
54
|
+
### Watch External Changes
|
55
|
+
|
56
|
+
- Watch open file for external changes to automatically refresh in editor
|
57
|
+
- Watch project subdirectories for changes to automatically refresh in file explorer/file lookup
|
58
|
+
|
59
|
+
### Automatic Data Management
|
60
|
+
|
61
|
+
- Autosave on focus out/quit/open new file
|
62
|
+
- Remember opened tabs, caret position, top pixel, window size, and window location
|
63
|
+
- [Default](#configuration) "ignore paths" to avoid bogging down editor with irrelevant directory files
|
38
64
|
|
39
65
|
## Platforms
|
40
66
|
|
@@ -110,7 +136,7 @@ To reuse Gladiator as a Glimmer Custom Shell inside another Glimmer application,
|
|
110
136
|
following to the application's `Gemfile`:
|
111
137
|
|
112
138
|
```
|
113
|
-
gem 'glimmer-cs-gladiator', '~> 0.
|
139
|
+
gem 'glimmer-cs-gladiator', '~> 0.6.0'
|
114
140
|
```
|
115
141
|
|
116
142
|
Run:
|
@@ -136,7 +162,7 @@ Opens Gladiator with "/Users/User/code" as the root directory.
|
|
136
162
|
|
137
163
|
## Configuration
|
138
164
|
|
139
|
-
Gladiator automatically saves configuration data in a `.gladiator` file at the directory it is run from.
|
165
|
+
Gladiator automatically saves configuration data in a `.gladiator` file at the directory it is run from. It may be edited to add extra ignore paths.
|
140
166
|
|
141
167
|
It currently remembers:
|
142
168
|
- Last opened files (in both split panes if split)
|
@@ -176,4 +202,4 @@ Copyright (c) 2020 Andy Maleh. See [LICENSE.txt](LICENSE.txt) for further detail
|
|
176
202
|
|
177
203
|
[<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 />](https://github.com/AndyObtiva/glimmer) Built with [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) (JRuby Desktop Development GUI Library)
|
178
204
|
|
179
|
-
Gladiator icon made by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a>
|
205
|
+
Gladiator icon made by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Glimmer
|
2
2
|
class Gladiator
|
3
3
|
class Command
|
4
|
+
include Glimmer
|
5
|
+
|
4
6
|
class << self
|
5
7
|
include Glimmer
|
6
8
|
|
@@ -13,11 +15,18 @@ module Glimmer
|
|
13
15
|
command_history[file] ||= [Command.new(file)]
|
14
16
|
end
|
15
17
|
|
16
|
-
def do(file, method = nil, command: nil)
|
17
|
-
command
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
def do(file, method = nil, *args, command: nil)
|
19
|
+
if command.nil?
|
20
|
+
command ||= Command.new(file, method, *args)
|
21
|
+
command.previous_command = command_history_for(file).last
|
22
|
+
unless command_history_for(file).last.method == :change_content! && method == :change_content!
|
23
|
+
command_history_for(file).last.next_command = command
|
24
|
+
end
|
25
|
+
command.do
|
26
|
+
command_history_for(file) << command unless command_history_for(file).last.method == :change_content! && method == :change_content!
|
27
|
+
else
|
28
|
+
command_history_for(file) << command
|
29
|
+
end
|
21
30
|
end
|
22
31
|
|
23
32
|
def undo(file)
|
@@ -30,15 +39,22 @@ module Glimmer
|
|
30
39
|
command = command_history_for(file).last
|
31
40
|
command&.redo
|
32
41
|
end
|
42
|
+
|
43
|
+
def clear(file)
|
44
|
+
command_history[file] = [Command.new(file)]
|
45
|
+
end
|
33
46
|
end
|
34
47
|
|
35
|
-
attr_accessor :file, :method, :
|
48
|
+
attr_accessor :file, :method, :args, :previous_command, :next_command,
|
49
|
+
:file_dirty_content, :file_caret_position, :file_selection_count, :previous_file_dirty_content, :previous_file_caret_position, :previous_file_selection_count
|
36
50
|
|
37
|
-
def initialize(file, method = nil)
|
51
|
+
def initialize(file, method = nil, *args)
|
38
52
|
@file = file
|
39
53
|
@method = method
|
54
|
+
@args = args
|
40
55
|
end
|
41
56
|
|
57
|
+
|
42
58
|
def native?
|
43
59
|
@method.nil?
|
44
60
|
end
|
@@ -56,6 +72,9 @@ module Glimmer
|
|
56
72
|
|
57
73
|
def redo
|
58
74
|
return if next_command.nil?# || next_command.native?
|
75
|
+
@file.dirty_content = next_command.file_dirty_content.clone
|
76
|
+
@file.caret_position = next_command.file_caret_position
|
77
|
+
@file.selection_count = next_command.file_selection_count
|
59
78
|
Command.do(next_command.file, command: next_command)
|
60
79
|
end
|
61
80
|
|
@@ -63,6 +82,10 @@ module Glimmer
|
|
63
82
|
@previous_file_dirty_content = @file.dirty_content.clone
|
64
83
|
@previous_file_caret_position = @file.caret_position
|
65
84
|
@previous_file_selection_count = @file.selection_count
|
85
|
+
if @method == :change_content!
|
86
|
+
@previous_file_caret_position = @file.last_caret_position
|
87
|
+
@previous_file_selection_count = @file.last_selection_count
|
88
|
+
end
|
66
89
|
end
|
67
90
|
|
68
91
|
def restore
|
@@ -72,7 +95,17 @@ module Glimmer
|
|
72
95
|
end
|
73
96
|
|
74
97
|
def execute
|
75
|
-
@file.
|
98
|
+
@file.start_command
|
99
|
+
@file.send(@method, *@args)
|
100
|
+
@file.end_command
|
101
|
+
@file_dirty_content = @file.dirty_content.clone
|
102
|
+
@file_caret_position = @file.caret_position
|
103
|
+
@file_selection_count = @file.selection_count
|
104
|
+
if previous_command.method == :change_content! && @method == :change_content!
|
105
|
+
previous_command.file_dirty_content = @file_dirty_content
|
106
|
+
previous_command.file_caret_position = @file_caret_position
|
107
|
+
previous_command.file_selection_count = @file_selection_count
|
108
|
+
end
|
76
109
|
end
|
77
110
|
end
|
78
111
|
end
|
@@ -3,7 +3,7 @@ module Glimmer
|
|
3
3
|
class File
|
4
4
|
include Glimmer
|
5
5
|
|
6
|
-
attr_accessor :line_numbers_content, :
|
6
|
+
attr_accessor :line_numbers_content, :line_number, :find_text, :replace_text, :top_pixel, :display_path, :case_sensitive, :caret_position, :selection_count, :last_caret_position, :last_selection_count, :line_position
|
7
7
|
attr_reader :name, :path, :project_dir
|
8
8
|
|
9
9
|
def initialize(path='', project_dir=nil)
|
@@ -13,9 +13,11 @@ module Glimmer
|
|
13
13
|
@name = path.empty? ? 'Scratchpad' : ::File.basename(path)
|
14
14
|
self.path = ::File.expand_path(path) unless path.empty?
|
15
15
|
@top_pixel = 0
|
16
|
+
@caret_position = 0
|
16
17
|
@selection_count = 0
|
17
|
-
@
|
18
|
+
@last_selection_count = 0
|
18
19
|
@line_number = 1
|
20
|
+
@init = nil
|
19
21
|
end
|
20
22
|
|
21
23
|
def init_content
|
@@ -24,29 +26,28 @@ module Glimmer
|
|
24
26
|
begin
|
25
27
|
# test read dirty content
|
26
28
|
observe(self, :dirty_content) do
|
27
|
-
|
29
|
+
line_count = lines.empty? ? 1 : lines.size
|
30
|
+
lines_text_size = [line_count.to_s.size, 4].max
|
28
31
|
old_top_pixel = top_pixel
|
29
|
-
self.line_numbers_content =
|
32
|
+
self.line_numbers_content = line_count.times.map {|n| (' ' * (lines_text_size - (n+1).to_s.size)) + (n+1).to_s }.join("\n")
|
30
33
|
self.top_pixel = old_top_pixel
|
31
34
|
end
|
32
35
|
the_dirty_content = read_dirty_content
|
33
36
|
the_dirty_content.split("\n") # test that it is not a binary file (crashes to rescue block otherwise)
|
34
37
|
self.dirty_content = the_dirty_content
|
35
|
-
observe(self, :
|
38
|
+
observe(self, :caret_position) do |new_caret_position|
|
36
39
|
new_line_number = line_index_for_caret_position(caret_position) + 1
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
+
current_line_number = line_number
|
41
|
+
self.line_number = new_line_number unless current_line_number && current_line_number == new_line_number
|
42
|
+
self.line_position = caret_position - caret_position_for_line_index(line_number - 1) + 1
|
40
43
|
end
|
41
|
-
observe(self, :line_number) do
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
}
|
49
|
-
end
|
44
|
+
observe(self, :line_number) do |new_line_number|
|
45
|
+
line_index = line_number - 1
|
46
|
+
new_caret_position = caret_position_for_line_index(line_index)
|
47
|
+
current_caret_position = caret_position
|
48
|
+
line_index_for_new_caret_position = line_index_for_caret_position(new_caret_position)
|
49
|
+
line_index_for_current_caret_position = line_index_for_caret_position(current_caret_position)
|
50
|
+
self.caret_position = new_caret_position unless (current_caret_position && line_index_for_new_caret_position == line_index_for_current_caret_position)
|
50
51
|
end
|
51
52
|
rescue # in case of a binary file
|
52
53
|
stop_filewatcher
|
@@ -63,6 +64,15 @@ module Glimmer
|
|
63
64
|
return if @path.empty?
|
64
65
|
@display_path = @path.sub(project_dir.path, '').sub(/^\//, '')
|
65
66
|
end
|
67
|
+
|
68
|
+
def name=(the_name)
|
69
|
+
new_path = path.sub(/#{Regexp.escape(@name)}$/, the_name) unless scratchpad?
|
70
|
+
@name = the_name
|
71
|
+
if !scratchpad? && ::File.exist?(path)
|
72
|
+
FileUtils.mv(path, new_path)
|
73
|
+
self.path = new_path
|
74
|
+
end
|
75
|
+
end
|
66
76
|
|
67
77
|
def scratchpad?
|
68
78
|
path.to_s.empty?
|
@@ -80,48 +90,18 @@ module Glimmer
|
|
80
90
|
send("#{property}=", value)
|
81
91
|
end
|
82
92
|
end
|
83
|
-
|
84
|
-
# to use for widget data-binding
|
85
|
-
def content=(value)
|
86
|
-
value = value.gsub("\t", ' ')
|
87
|
-
if dirty_content != value
|
88
|
-
# TODO fix this command recording hack by truly recording every text change as a proper command (add process_key command, paste command, cut command, etc...)
|
89
|
-
Command.do(self) # record a native (OS-widget) operation
|
90
|
-
self.dirty_content = value
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
def content
|
95
|
-
dirty_content
|
96
|
-
end
|
97
|
-
|
93
|
+
|
98
94
|
def caret_position=(value)
|
99
|
-
|
100
|
-
|
101
|
-
self.top_pixel = old_top_pixel
|
102
|
-
end
|
103
|
-
|
104
|
-
def caret_position
|
105
|
-
selection.x
|
106
|
-
end
|
107
|
-
|
108
|
-
def selection_count
|
109
|
-
selection.y - selection.x
|
95
|
+
@last_caret_position = @caret_position
|
96
|
+
@caret_position = value
|
110
97
|
end
|
111
98
|
|
112
99
|
def selection_count=(value)
|
113
|
-
|
100
|
+
#@last_selection_count = @selection_count
|
101
|
+
@selection_count = value
|
102
|
+
@last_selection_count = @selection_count
|
114
103
|
end
|
115
104
|
|
116
|
-
def name=(the_name)
|
117
|
-
new_path = path.sub(/#{Regexp.escape(@name)}$/, the_name) unless scratchpad?
|
118
|
-
@name = the_name
|
119
|
-
if !scratchpad? && ::File.exist?(path)
|
120
|
-
FileUtils.mv(path, new_path)
|
121
|
-
self.path = new_path
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
105
|
def dirty_content
|
126
106
|
init_content
|
127
107
|
@dirty_content
|
@@ -132,14 +112,49 @@ module Glimmer
|
|
132
112
|
@dirty_content = the_content
|
133
113
|
old_caret_position = caret_position
|
134
114
|
old_top_pixel = top_pixel
|
115
|
+
|
135
116
|
notify_observers(:content)
|
136
117
|
if @formatting_dirty_content_for_writing
|
137
118
|
self.caret_position = old_caret_position
|
138
|
-
self.selection_count = 0
|
139
119
|
self.top_pixel = old_top_pixel
|
140
120
|
end
|
141
121
|
end
|
142
122
|
|
123
|
+
def content
|
124
|
+
dirty_content
|
125
|
+
end
|
126
|
+
|
127
|
+
# to use for widget data-binding
|
128
|
+
def content=(value)
|
129
|
+
value = value.gsub("\t", ' ')
|
130
|
+
if dirty_content != value
|
131
|
+
Command.do(self, :change_content!, value)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def change_content!(value)
|
136
|
+
self.dirty_content = value
|
137
|
+
end
|
138
|
+
|
139
|
+
def start_command
|
140
|
+
@commmand_in_progress = true
|
141
|
+
end
|
142
|
+
|
143
|
+
def end_command
|
144
|
+
@commmand_in_progress = false
|
145
|
+
end
|
146
|
+
|
147
|
+
def command_in_progress?
|
148
|
+
@commmand_in_progress
|
149
|
+
end
|
150
|
+
|
151
|
+
def close
|
152
|
+
stop_filewatcher
|
153
|
+
remove_all_observers
|
154
|
+
initialize(path, project_dir)
|
155
|
+
Command.clear(self)
|
156
|
+
end
|
157
|
+
|
143
158
|
def read_dirty_content
|
144
159
|
path.empty? ? '' : ::File.read(path)
|
145
160
|
end
|
@@ -176,7 +191,9 @@ module Glimmer
|
|
176
191
|
end
|
177
192
|
|
178
193
|
def format_dirty_content_for_writing!
|
179
|
-
|
194
|
+
return if @commmand_in_progress
|
195
|
+
# TODO f ix c ar e t pos it ion after formatting dirty content (diff?)
|
196
|
+
new_dirty_content = dirty_content.to_s.split("\n").map {|line| line.strip.empty? ? line : line.rstrip }.join("\n")
|
180
197
|
new_dirty_content = "#{new_dirty_content.gsub("\r\n", "\n").gsub("\r", "\n").sub(/\n+\z/, '')}\n"
|
181
198
|
if new_dirty_content != self.dirty_content
|
182
199
|
@formatting_dirty_content_for_writing = true
|
@@ -76,6 +76,7 @@ module Glimmer
|
|
76
76
|
}
|
77
77
|
end
|
78
78
|
|
79
|
+
@default_foreground = :dark_blue
|
79
80
|
@split_orientation = swt(:horizontal)
|
80
81
|
@config_file_path = ::File.join(project_dir.path, '.gladiator')
|
81
82
|
@config = {}
|
@@ -109,7 +110,10 @@ module Glimmer
|
|
109
110
|
@current_tab_folder.content {
|
110
111
|
@current_tab_item = tab_item { |the_tab_item|
|
111
112
|
text selected_file.name
|
112
|
-
fill_layout
|
113
|
+
fill_layout(:horizontal) {
|
114
|
+
margin_width 0
|
115
|
+
margin_height 0
|
116
|
+
}
|
113
117
|
@current_text_editor = the_text_editor = text_editor(project_dir: project_dir, file: selected_file)
|
114
118
|
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
115
119
|
@current_text_editor.text_proxy.content {
|
@@ -134,6 +138,9 @@ module Glimmer
|
|
134
138
|
@current_text_editor&.text_widget&.setFocus
|
135
139
|
}
|
136
140
|
}
|
141
|
+
on_widget_disposed {
|
142
|
+
the_tab_item.swt_tab_item.get_data('file').close
|
143
|
+
}
|
137
144
|
}
|
138
145
|
@current_tab_item.swt_tab_item.setData('file_path', selected_file.path)
|
139
146
|
@current_tab_item.swt_tab_item.setData('file', selected_file)
|
@@ -163,10 +170,12 @@ module Glimmer
|
|
163
170
|
#
|
164
171
|
body {
|
165
172
|
shell {
|
173
|
+
grid_layout(2, false)
|
174
|
+
|
166
175
|
text "Gladiator - #{::File.expand_path(project_dir.path)}"
|
167
176
|
minimum_size 520, 250
|
168
177
|
size 1440, 900
|
169
|
-
|
178
|
+
|
170
179
|
on_swt_show {
|
171
180
|
swt_widget.setSize(@config[:shell_width], @config[:shell_height]) if @config[:shell_width] && @config[:shell_height]
|
172
181
|
swt_widget.setLocation(@config[:shell_x], @config[:shell_y]) if @config[:shell_x] && @config[:shell_y]
|
@@ -216,14 +225,14 @@ module Glimmer
|
|
216
225
|
text '&Split'
|
217
226
|
menu_item(:radio) {
|
218
227
|
text '&Horizontal'
|
219
|
-
selection bind(self, :split_orientation,
|
220
|
-
on_read: ->(o) { split_pane? && o == swt(:horizontal)},
|
228
|
+
selection bind(self, :split_orientation,
|
229
|
+
on_read: ->(o) { split_pane? && o == swt(:horizontal)},
|
221
230
|
on_write: ->(b) { b ? swt(:horizontal) : swt(:vertical) })
|
222
231
|
}
|
223
232
|
menu_item(:radio) {
|
224
233
|
text '&Vertical'
|
225
|
-
selection bind(self, :split_orientation,
|
226
|
-
on_read: ->(o) { split_pane? && o == swt(:vertical)},
|
234
|
+
selection bind(self, :split_orientation,
|
235
|
+
on_read: ->(o) { split_pane? && o == swt(:vertical)},
|
227
236
|
on_write: ->(b) { b ? swt(:vertical) : swt(:horizontal) })
|
228
237
|
}
|
229
238
|
}
|
@@ -253,124 +262,215 @@ module Glimmer
|
|
253
262
|
}
|
254
263
|
|
255
264
|
composite {
|
256
|
-
grid_layout
|
265
|
+
grid_layout(1, false) {
|
266
|
+
margin_width 0
|
267
|
+
margin_height 0
|
268
|
+
}
|
269
|
+
|
257
270
|
layout_data(:fill, :fill, false, true) {
|
258
271
|
width_hint 300
|
259
272
|
}
|
260
|
-
@
|
261
|
-
layout_data :fill, :center, true, false
|
262
|
-
text bind(project_dir, 'filter')
|
263
|
-
on_key_pressed { |key_event|
|
264
|
-
if key_event.keyCode == swt(:tab) ||
|
265
|
-
key_event.keyCode == swt(:cr) ||
|
266
|
-
key_event.keyCode == swt(:arrow_up) ||
|
267
|
-
key_event.keyCode == swt(:arrow_down)
|
268
|
-
@list.swt_widget.select(0) if @list.swt_widget.getSelectionIndex() == -1
|
269
|
-
@list.swt_widget.setFocus
|
270
|
-
end
|
271
|
-
}
|
272
|
-
}
|
273
|
-
sash_form(:vertical) {
|
273
|
+
@side_bar_sash_form = sash_form(:vertical) {
|
274
274
|
layout_data(:fill, :fill, true, true)
|
275
275
|
sash_width 4
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
project_dir.selected_child_path = @list.swt_widget.getSelection.first
|
281
|
-
}
|
282
|
-
on_key_pressed { |key_event|
|
283
|
-
if Glimmer::SWT::SWTProxy.include?(key_event.keyCode, :cr)
|
284
|
-
project_dir.selected_child_path = @list.swt_widget.getSelection.first
|
285
|
-
@current_text_editor&.text_widget&.setFocus
|
286
|
-
end
|
287
|
-
}
|
288
|
-
drag_source(DND::DROP_COPY) {
|
289
|
-
transfer [TextTransfer.getInstance].to_java(Transfer)
|
290
|
-
on_drag_set_data { |event|
|
291
|
-
Gladiator.drag = true
|
292
|
-
list = event.widget.getControl
|
293
|
-
event.data = list.getSelection.first
|
294
|
-
}
|
295
|
-
}
|
276
|
+
|
277
|
+
resize_expand_items = lambda { |event=nil|
|
278
|
+
@file_lookup_expand_item&.swt_expand_item&.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
|
279
|
+
@file_explorer_expand_item&.swt_expand_item&.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
|
296
280
|
}
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
281
|
+
|
282
|
+
@file_lookup_expand_bar = expand_bar {
|
283
|
+
layout_data :fill, :fill, true, true
|
284
|
+
font height: 17, style: :bold
|
285
|
+
foreground @default_foreground
|
286
|
+
|
287
|
+
on_swt_show {
|
288
|
+
@file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
|
289
|
+
}
|
290
|
+
|
291
|
+
on_swt_Resize(&resize_expand_items)
|
292
|
+
|
293
|
+
@file_lookup_expand_item = expand_item {
|
294
|
+
grid_layout {
|
295
|
+
margin_width 0
|
296
|
+
margin_height 0
|
297
|
+
}
|
298
|
+
text 'File Lookup'
|
299
|
+
height display.bounds.height
|
300
|
+
|
301
|
+
@filter_text = text {
|
302
|
+
layout_data :fill, :center, true, false
|
303
|
+
text bind(project_dir, 'filter')
|
304
|
+
on_key_pressed { |key_event|
|
305
|
+
if key_event.keyCode == swt(:tab) ||
|
306
|
+
key_event.keyCode == swt(:cr) ||
|
307
|
+
key_event.keyCode == swt(:arrow_up) ||
|
308
|
+
key_event.keyCode == swt(:arrow_down)
|
309
|
+
@file_lookup_list.swt_widget.select(0) if @file_lookup_list.swt_widget.getSelectionIndex() == -1
|
310
|
+
@file_lookup_list.swt_widget.setFocus
|
311
|
+
end
|
314
312
|
}
|
315
313
|
}
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
314
|
+
|
315
|
+
@file_lookup_list = list(:border, :h_scroll, :v_scroll) {
|
316
|
+
layout_data :fill, :fill, true, true
|
317
|
+
#visible bind(self, 'project_dir.filter') {|f| !!f}
|
318
|
+
selection bind(project_dir, :filtered_path)
|
319
|
+
foreground @default_foreground
|
320
|
+
on_mouse_up {
|
321
|
+
project_dir.selected_child_path = @file_lookup_list.swt_widget.getSelection.first
|
322
322
|
}
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
323
|
+
on_key_pressed { |key_event|
|
324
|
+
if Glimmer::SWT::SWTProxy.include?(key_event.keyCode, :cr)
|
325
|
+
project_dir.selected_child_path = @file_lookup_list.swt_widget.getSelection.first
|
326
|
+
@current_text_editor&.text_widget&.setFocus
|
327
|
+
end
|
328
328
|
}
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
329
|
+
drag_source(DND::DROP_COPY) {
|
330
|
+
transfer [TextTransfer.getInstance].to_java(Transfer)
|
331
|
+
on_drag_set_data { |event|
|
332
|
+
Gladiator.drag = true
|
333
|
+
list = event.widget.getControl
|
334
|
+
event.data = list.getSelection.first
|
335
|
+
}
|
334
336
|
}
|
335
337
|
}
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
338
|
+
}
|
339
|
+
|
340
|
+
on_item_collapsed { |event|
|
341
|
+
if @file_explorer_expand_item.swt_expand_item.get_expanded
|
342
|
+
@file_lookup_expand_item_height = @file_lookup_expand_item.swt_expand_item.height
|
343
|
+
@file_lookup_expand_item.swt_expand_item.height = 0
|
344
|
+
@file_lookup_expand_bar_height = @file_lookup_expand_bar.swt_widget.size.y
|
345
|
+
@file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
|
346
|
+
@side_bar_sash_form.weights = [@file_lookup_expand_item.swt_expand_item.header_height, @file_lookup_expand_bar_height + @file_explorer_expand_bar_height - @file_lookup_expand_item.swt_expand_item.header_height]
|
347
|
+
end
|
348
|
+
}
|
349
|
+
|
350
|
+
on_item_expanded {
|
351
|
+
@file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_item_height if @file_lookup_expand_item_height
|
352
|
+
@side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
|
353
|
+
}
|
354
|
+
|
355
|
+
}
|
356
|
+
|
357
|
+
@file_explorer_expand_bar = expand_bar {
|
358
|
+
layout_data :fill, :fill, true, true
|
359
|
+
font height: 17, style: :bold
|
360
|
+
foreground @default_foreground
|
361
|
+
|
362
|
+
on_swt_show {
|
363
|
+
@file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
|
364
|
+
}
|
365
|
+
|
366
|
+
on_swt_Resize(&resize_expand_items)
|
367
|
+
|
368
|
+
@file_explorer_expand_item = expand_item {
|
369
|
+
grid_layout {
|
370
|
+
margin_width 0
|
371
|
+
margin_height 0
|
372
|
+
}
|
373
|
+
text 'File Explorer'
|
374
|
+
height display.bounds.height
|
375
|
+
|
376
|
+
@file_tree = tree(:virtual, :border, :h_scroll, :v_scroll) {
|
377
|
+
layout_data :fill, :fill, true, true
|
378
|
+
#visible bind(self, 'project_dir.filter') {|f| !f}
|
379
|
+
items bind(self, :project_dir), tree_properties(children: :children, text: :name)
|
380
|
+
foreground @default_foreground
|
381
|
+
drag_source(DND::DROP_COPY) {
|
382
|
+
transfer [TextTransfer.getInstance].to_java(Transfer)
|
383
|
+
on_drag_set_data { |event|
|
384
|
+
Gladiator.drag = true
|
385
|
+
tree = event.widget.getControl
|
386
|
+
tree_item = tree.getSelection.first
|
387
|
+
event.data = tree_item.getData.path
|
388
|
+
}
|
340
389
|
}
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
390
|
+
menu {
|
391
|
+
@open_menu_item = menu_item {
|
392
|
+
text 'Open'
|
393
|
+
on_widget_selected {
|
394
|
+
project_dir.selected_child_path = extract_tree_item_path(@file_tree.swt_widget.getSelection.first)
|
395
|
+
}
|
396
|
+
}
|
397
|
+
menu_item(:separator)
|
398
|
+
menu_item {
|
399
|
+
text 'Delete'
|
400
|
+
on_widget_selected {
|
401
|
+
tree_item = @file_tree.swt_widget.getSelection.first
|
402
|
+
delete_tree_item(tree_item)
|
403
|
+
}
|
404
|
+
}
|
405
|
+
menu_item {
|
406
|
+
text 'Refresh'
|
407
|
+
on_widget_selected {
|
408
|
+
project_dir.refresh
|
409
|
+
}
|
410
|
+
}
|
411
|
+
menu_item {
|
412
|
+
text 'Rename'
|
413
|
+
on_widget_selected {
|
414
|
+
rename_selected_tree_item
|
415
|
+
}
|
416
|
+
}
|
417
|
+
menu_item {
|
418
|
+
text 'New Directory'
|
419
|
+
on_widget_selected {
|
420
|
+
add_new_directory_to_selected_tree_item
|
421
|
+
}
|
422
|
+
}
|
423
|
+
menu_item {
|
424
|
+
text 'New File'
|
425
|
+
on_widget_selected {
|
426
|
+
add_new_file_to_selected_tree_item
|
427
|
+
}
|
428
|
+
}
|
429
|
+
}
|
430
|
+
on_swt_menudetect { |event|
|
431
|
+
path = extract_tree_item_path(@file_tree.swt_widget.getSelection.first)
|
432
|
+
@open_menu_item.swt_widget.setEnabled(!::Dir.exist?(path)) if path
|
433
|
+
}
|
434
|
+
on_mouse_up {
|
435
|
+
if Gladiator.drag_and_drop
|
436
|
+
Gladiator.drag_and_drop = false
|
437
|
+
else
|
438
|
+
project_dir.selected_child_path = extract_tree_item_path(@file_tree.swt_widget.getSelection&.first)
|
439
|
+
@current_text_editor&.text_widget&.setFocus
|
440
|
+
end
|
441
|
+
}
|
442
|
+
on_key_pressed { |key_event|
|
443
|
+
if Glimmer::SWT::SWTProxy.include?(key_event.keyCode, :cr)
|
444
|
+
project_dir.selected_child_path = extract_tree_item_path(@file_tree.swt_widget.getSelection&.first)
|
445
|
+
@current_text_editor&.text_widget&.setFocus
|
446
|
+
end
|
447
|
+
}
|
448
|
+
on_paint_control {
|
449
|
+
root_item = @file_tree.swt_widget.getItems.first
|
450
|
+
if root_item && !root_item.getExpanded
|
451
|
+
root_item.setExpanded(true)
|
452
|
+
end
|
346
453
|
}
|
347
454
|
}
|
348
455
|
}
|
349
|
-
|
350
|
-
|
351
|
-
@
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
project_dir.selected_child_path = extract_tree_item_path(@file_tree.swt_widget.getSelection&.first)
|
358
|
-
@current_text_editor&.text_widget&.setFocus
|
359
|
-
end
|
360
|
-
}
|
361
|
-
on_key_pressed { |key_event|
|
362
|
-
if Glimmer::SWT::SWTProxy.include?(key_event.keyCode, :cr)
|
363
|
-
project_dir.selected_child_path = extract_tree_item_path(@file_tree.swt_widget.getSelection&.first)
|
364
|
-
@current_text_editor&.text_widget&.setFocus
|
456
|
+
|
457
|
+
on_item_collapsed { |event|
|
458
|
+
if @file_lookup_expand_item.swt_expand_item.get_expanded
|
459
|
+
@file_explorer_expand_item_height = @file_explorer_expand_item.swt_expand_item.height
|
460
|
+
@file_explorer_expand_item.swt_expand_item.height = 0
|
461
|
+
@file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
|
462
|
+
@file_lookup_expand_bar_height = @file_lookup_expand_bar.swt_widget.size.y
|
463
|
+
@side_bar_sash_form.weights = [@file_explorer_expand_bar_height + @file_explorer_expand_bar_height - @file_explorer_expand_item.swt_expand_item.header_height, @file_explorer_expand_item.swt_expand_item.header_height]
|
365
464
|
end
|
366
|
-
}
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
}
|
465
|
+
}
|
466
|
+
|
467
|
+
on_item_expanded {
|
468
|
+
@file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_item_height if @file_explorer_expand_item_height
|
469
|
+
@side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
|
470
|
+
}
|
471
|
+
|
472
|
+
}
|
473
|
+
|
374
474
|
}
|
375
475
|
|
376
476
|
# TODO see if you could replace some of this with Glimmer DSL/API syntax
|
@@ -380,117 +480,220 @@ module Glimmer
|
|
380
480
|
@file_tree_editor.minimumHeight = 20;
|
381
481
|
|
382
482
|
}
|
383
|
-
|
384
|
-
|
483
|
+
|
484
|
+
composite {
|
485
|
+
grid_layout(1, false) {
|
486
|
+
margin_width 0
|
487
|
+
margin_height 0
|
488
|
+
}
|
385
489
|
layout_data :fill, :fill, true, true
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
490
|
+
|
491
|
+
@navigation_expand_bar = expand_bar {
|
492
|
+
layout_data :fill, :top, true, false
|
493
|
+
font height: 17, style: :bold
|
494
|
+
foreground @default_foreground
|
495
|
+
|
496
|
+
@navigation_expand_item = expand_item {
|
497
|
+
text 'Navigation'
|
498
|
+
height 115
|
394
499
|
|
395
|
-
|
396
|
-
|
397
|
-
horizontal_span 2
|
500
|
+
grid_layout(5, false) {
|
501
|
+
margin_right 5
|
398
502
|
}
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
503
|
+
|
504
|
+
stat_font = {name: 'Consolas', height: OS.mac? ? 15 : 12}
|
505
|
+
|
506
|
+
# row 1
|
507
|
+
|
508
|
+
label {
|
509
|
+
layout_data(:left, :center, false, false)
|
510
|
+
text 'File:'
|
511
|
+
foreground @default_foreground
|
405
512
|
}
|
406
|
-
|
407
|
-
|
513
|
+
|
514
|
+
@file_path_label = styled_text(:none) {
|
515
|
+
layout_data(:fill, :center, true, false) {
|
516
|
+
horizontal_span 2
|
517
|
+
}
|
518
|
+
background color(:widget_background)
|
519
|
+
foreground @default_foreground
|
520
|
+
editable false
|
521
|
+
caret nil
|
522
|
+
text bind(project_dir, 'selected_child.path')
|
523
|
+
on_mouse_up {
|
524
|
+
@file_path_label.swt_widget.selectAll
|
525
|
+
}
|
526
|
+
on_focus_lost {
|
527
|
+
@file_path_label.swt_widget.setSelection(0, 0)
|
528
|
+
}
|
408
529
|
}
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
text 'Line:'
|
415
|
-
}
|
416
|
-
@line_number_text = text {
|
417
|
-
layout_data(:fill, :fill, true, false) {
|
418
|
-
minimum_width 400
|
530
|
+
|
531
|
+
label {
|
532
|
+
layout_data(:left, :center, false, false)
|
533
|
+
text 'Caret Position:'
|
534
|
+
foreground @default_foreground
|
419
535
|
}
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
536
|
+
label(:right) {
|
537
|
+
layout_data(:fill, :center, true, false)
|
538
|
+
text bind(project_dir, 'selected_child.caret_position')
|
539
|
+
foreground @default_foreground
|
540
|
+
font stat_font
|
425
541
|
}
|
426
|
-
|
427
|
-
|
542
|
+
|
543
|
+
# row 2
|
544
|
+
|
545
|
+
label {
|
546
|
+
layout_data(:left, :center, false, false)
|
547
|
+
text 'Line:'
|
548
|
+
foreground @default_foreground
|
428
549
|
}
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
550
|
+
@line_number_text = text {
|
551
|
+
layout_data(:fill, :center, true, false) {
|
552
|
+
minimum_width 400
|
553
|
+
}
|
554
|
+
text bind(project_dir, 'selected_child.line_number', on_read: :to_s, on_write: :to_i)
|
555
|
+
foreground @default_foreground
|
556
|
+
font stat_font
|
557
|
+
on_key_pressed { |key_event|
|
558
|
+
if key_event.keyCode == swt(:cr)
|
559
|
+
@current_text_editor&.text_widget&.setFocus
|
560
|
+
end
|
561
|
+
}
|
562
|
+
on_verify_text { |event|
|
563
|
+
event.doit = !event.text.match(/^\d*$/).to_a.empty?
|
564
|
+
}
|
440
565
|
}
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
if key_event.keyCode == swt(:cr)
|
448
|
-
project_dir.selected_child&.find_next
|
449
|
-
end
|
566
|
+
label # filler
|
567
|
+
|
568
|
+
label {
|
569
|
+
layout_data(:left, :center, false, false)
|
570
|
+
text 'Line Position:'
|
571
|
+
foreground @default_foreground
|
450
572
|
}
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
573
|
+
label(:right) {
|
574
|
+
layout_data(:fill, :center, true, false)
|
575
|
+
text bind(project_dir, 'selected_child.line_position')
|
576
|
+
foreground @default_foreground
|
577
|
+
font stat_font
|
578
|
+
}
|
579
|
+
|
580
|
+
# row 3
|
581
|
+
|
582
|
+
label {
|
583
|
+
layout_data(:left, :center, false, false)
|
584
|
+
text 'Find:'
|
585
|
+
foreground @default_foreground
|
586
|
+
}
|
587
|
+
@find_text = text {
|
588
|
+
layout_data(:fill, :center, true, false) {
|
589
|
+
minimum_width 400
|
590
|
+
}
|
591
|
+
text bind(project_dir, 'selected_child.find_text')
|
592
|
+
foreground @default_foreground
|
593
|
+
font stat_font
|
456
594
|
on_key_pressed { |key_event|
|
595
|
+
if key_event.stateMask == swt(COMMAND_KEY) && key_event.keyCode == swt(:cr)
|
596
|
+
project_dir.selected_child.case_sensitive = !project_dir.selected_child.case_sensitive
|
597
|
+
project_dir.selected_child&.find_next
|
598
|
+
end
|
457
599
|
if key_event.keyCode == swt(:cr)
|
458
600
|
project_dir.selected_child&.find_next
|
459
601
|
end
|
460
602
|
}
|
461
603
|
}
|
604
|
+
composite {
|
605
|
+
layout_data(:left, :center, true, false)
|
606
|
+
row_layout {
|
607
|
+
margin_width 0
|
608
|
+
margin_height 0
|
609
|
+
}
|
610
|
+
button(:check) {
|
611
|
+
selection bind(project_dir, 'selected_child.case_sensitive')
|
612
|
+
on_key_pressed { |key_event|
|
613
|
+
if key_event.keyCode == swt(:cr)
|
614
|
+
project_dir.selected_child&.find_next
|
615
|
+
end
|
616
|
+
}
|
617
|
+
}
|
618
|
+
label {
|
619
|
+
text 'Case-sensitive'
|
620
|
+
}
|
621
|
+
}
|
622
|
+
|
462
623
|
label {
|
463
|
-
|
624
|
+
layout_data(:left, :center, false, false)
|
625
|
+
text 'Selection Count:'
|
626
|
+
foreground @default_foreground
|
464
627
|
}
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
text 'Replace:'
|
471
|
-
}
|
472
|
-
@replace_text = text {
|
473
|
-
layout_data(:fill, :fill, true, false) {
|
474
|
-
minimum_width 300
|
628
|
+
label(:right) {
|
629
|
+
layout_data(:fill, :center, true, false)
|
630
|
+
text bind(project_dir, 'selected_child.selection_count')
|
631
|
+
foreground @default_foreground
|
632
|
+
font stat_font
|
475
633
|
}
|
476
|
-
|
477
|
-
|
478
|
-
|
634
|
+
|
635
|
+
# row 4
|
636
|
+
|
637
|
+
label {
|
638
|
+
layout_data(:left, :center, false, false)
|
639
|
+
text 'Replace:'
|
640
|
+
foreground @default_foreground
|
479
641
|
}
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
642
|
+
@replace_text = text {
|
643
|
+
layout_data(:fill, :center, true, false) {
|
644
|
+
minimum_width 400
|
645
|
+
}
|
646
|
+
text bind(project_dir, 'selected_child.replace_text')
|
647
|
+
foreground @default_foreground
|
648
|
+
font stat_font
|
649
|
+
on_focus_gained {
|
650
|
+
project_dir.selected_child&.ensure_find_next
|
651
|
+
}
|
652
|
+
on_key_pressed { |key_event|
|
653
|
+
if key_event.keyCode == swt(:cr)
|
654
|
+
if project_dir.selected_child
|
655
|
+
Command.do(project_dir.selected_child, :replace_next!)
|
656
|
+
end
|
484
657
|
end
|
485
|
-
|
658
|
+
}
|
659
|
+
}
|
660
|
+
label # filler
|
661
|
+
label {
|
662
|
+
layout_data(:left, :center, false, false)
|
663
|
+
text 'Top Pixel:'
|
664
|
+
foreground @default_foreground
|
665
|
+
}
|
666
|
+
label(:right) {
|
667
|
+
layout_data(:fill, :center, true, false)
|
668
|
+
text bind(project_dir, 'selected_child.top_pixel')
|
669
|
+
foreground @default_foreground
|
670
|
+
font stat_font
|
486
671
|
}
|
487
672
|
}
|
488
|
-
|
673
|
+
|
674
|
+
on_item_collapsed {
|
675
|
+
@navigation_expand_item_height = @navigation_expand_item.swt_expand_item.height if @navigation_expand_item.swt_expand_item.height > 0
|
676
|
+
@navigation_expand_item.swt_expand_item.height = 0
|
677
|
+
async_exec {
|
678
|
+
body_root.pack_same_size
|
679
|
+
}
|
680
|
+
}
|
681
|
+
|
682
|
+
on_item_expanded {
|
683
|
+
@navigation_expand_item.swt_expand_item.height = @navigation_expand_item_height if @navigation_expand_item_height
|
684
|
+
async_exec {
|
685
|
+
body_root.pack_same_size
|
686
|
+
}
|
687
|
+
}
|
688
|
+
|
489
689
|
}
|
690
|
+
|
490
691
|
@tab_folder_sash_form = sash_form {
|
491
692
|
layout_data(:fill, :fill, true, true) {
|
492
|
-
width_hint
|
493
|
-
height_hint
|
693
|
+
width_hint 768
|
694
|
+
height_hint 576
|
695
|
+
minimum_width 768
|
696
|
+
minimum_height 576
|
494
697
|
}
|
495
698
|
sash_width 10
|
496
699
|
orientation bind(self, :split_orientation)
|
@@ -539,8 +742,8 @@ module Glimmer
|
|
539
742
|
open_file_paths2 = @config[:open_file_paths2]
|
540
743
|
self.split_orientation = swt(@config[:split_orientation] || :horizontal) rescue swt(:horizontal)
|
541
744
|
if @progress_bar_shell.nil?
|
542
|
-
@progress_bar_shell = shell(body_root) {
|
543
|
-
text '
|
745
|
+
@progress_bar_shell = shell(body_root, :title) {
|
746
|
+
text 'Gladiator'
|
544
747
|
fill_layout(:vertical) {
|
545
748
|
margin_width 15
|
546
749
|
margin_height 15
|
@@ -674,6 +877,7 @@ module Glimmer
|
|
674
877
|
parent_path = ::File.dirname(file.path)
|
675
878
|
if file.is_a?(Gladiator::Dir)
|
676
879
|
file_paths = file.all_children.select {|f| f.is_a?(Gladiator::File)}.map(&:path)
|
880
|
+
file.remove_all_observers
|
677
881
|
else
|
678
882
|
file_paths = [file.path]
|
679
883
|
end
|
@@ -777,8 +981,8 @@ module Glimmer
|
|
777
981
|
|
778
982
|
def open_project
|
779
983
|
selected_directory = directory_dialog.open
|
780
|
-
@progress_bar_shell = shell(body_root) {
|
781
|
-
text '
|
984
|
+
@progress_bar_shell = shell(body_root, :title) {
|
985
|
+
text 'Gladiator'
|
782
986
|
fill_layout(:vertical) {
|
783
987
|
margin_width 15
|
784
988
|
margin_height 15
|
@@ -19,13 +19,19 @@ module Glimmer
|
|
19
19
|
|
20
20
|
body {
|
21
21
|
composite {
|
22
|
+
grid_layout(2, false)
|
23
|
+
# TODO troubleshoot why adding margin height 0 causes gladiator to start resizing window smaller than necessary upon launch of Gladiator
|
24
|
+
# {
|
25
|
+
# margin_height 0
|
26
|
+
# }
|
27
|
+
|
22
28
|
layout_data :fill, :fill, true, true
|
23
|
-
|
24
|
-
@line_numbers_text = styled_text(:multi, :wrap, :border) {
|
29
|
+
@line_numbers_text = styled_text(:multi, :border) {
|
25
30
|
layout_data(:right, :fill, false, true)
|
31
|
+
|
26
32
|
font name: 'Consolas', height: OS.mac? ? 15 : 12
|
27
33
|
background color(:widget_background)
|
28
|
-
foreground
|
34
|
+
foreground :dark_blue
|
29
35
|
text bind(self, 'file.line_numbers_content')
|
30
36
|
top_pixel bind(self, 'file.top_pixel', read_only: true)
|
31
37
|
top_margin 5
|
@@ -33,7 +39,6 @@ module Glimmer
|
|
33
39
|
bottom_margin 5
|
34
40
|
left_margin 5
|
35
41
|
editable false
|
36
|
-
alignment swt(:right)
|
37
42
|
on_focus_gained {
|
38
43
|
@text&.swt_widget.setFocus
|
39
44
|
}
|
@@ -51,7 +56,8 @@ module Glimmer
|
|
51
56
|
foreground rgb(75, 75, 75)
|
52
57
|
text bind(self, 'file.content')
|
53
58
|
focus true
|
54
|
-
|
59
|
+
selection_count bind(self, 'file.selection_count')
|
60
|
+
caret_position bind(self, 'file.caret_position')
|
55
61
|
top_pixel bind(self, 'file.top_pixel')
|
56
62
|
top_margin 5
|
57
63
|
right_margin 5
|
@@ -144,7 +150,7 @@ module Glimmer
|
|
144
150
|
}
|
145
151
|
}
|
146
152
|
}
|
147
|
-
|
153
|
+
|
148
154
|
def extract_char(event)
|
149
155
|
event.keyCode.chr
|
150
156
|
rescue => e
|
metadata
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-cs-gladiator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
16
|
- - ">="
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 4.17.10.
|
18
|
+
version: 4.17.10.2
|
19
19
|
- - "<"
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 5.0.0.0
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 4.17.10.
|
29
|
+
version: 4.17.10.2
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 5.0.0.0
|