glimmer-cs-gladiator 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +46 -22
- data/VERSION +1 -1
- data/bin/gladiator +4 -7
- data/bin/gladiator-setup +1 -1
- data/glimmer-cs-gladiator.gemspec +9 -6
- data/lib/models/glimmer/gladiator/dir.rb +15 -3
- data/lib/models/glimmer/gladiator/file.rb +7 -2
- data/lib/views/glimmer/gladiator/file_explorer_tree.rb +2 -2
- data/lib/views/glimmer/gladiator.rb +125 -119
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2bd61ab016bc1d3992e56c082f137a5ed81941806fd20249c3a94020cb9970c
|
4
|
+
data.tar.gz: 293d2e2c7928fd5098e9f831b92cda26fc293bba8fdc5d8f11f06ef965877660
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 468c13aaba846681e204d56e730b3a4c673fbee65f85423817f3580560bfb6c0361655504dfcffbcfe1c44aab184b1db637aa2e07713bf6f77a1f288579e8672
|
7
|
+
data.tar.gz: 99929299b521b244b8d4912a4fec64f7b6e0bd630b3e4e49a257ad7247391187dcb5a0dcb85ff06726170fb706d1998b8f496fe38f40996c93316cf444798186
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.9.2
|
4
|
+
|
5
|
+
- Ensure cleaning filewatcher/thread resources when closing a project dir/file
|
6
|
+
- Fix issue with `gladiator` function command produced by `gladiator-setup` not forwarding arguments in
|
7
|
+
- Fix issue with making changes to file through Find/Replace not persisting if I close Gladiator right afterwards unless I focus/unfocus open text editor
|
8
|
+
- Fix issue with not being able to open a project by passing project directory as first argument to `gladiator` command
|
9
|
+
- Fix issue with sometimes not remembering last open tabs when opening Gladiator
|
10
|
+
- Fix issues with renaming files in file explorer not reflecting change in open tab file name
|
11
|
+
- Fix minor issue with leaving `'-J-Xrs'` option in `bin/gladiator`
|
12
|
+
- Fix issue with Scratchpad not running content anymore
|
13
|
+
- Fix issue of stopping file watcher for open files that still need watching
|
14
|
+
|
3
15
|
## 0.9.1
|
4
16
|
|
5
17
|
- Upgrade to glimmer-dsl-swt 4.20.15.4
|
data/README.md
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
# <img src='https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-gladiator/master/images/glimmer-cs-gladiator-logo.svg' height=85 /> Gladiator 0.9.
|
1
|
+
# <img src='https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-gladiator/master/images/glimmer-cs-gladiator-logo.svg' height=85 /> Gladiator 0.9.2 - [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
|
|
5
5
|
![Gladiator](images/glimmer-gladiator.png)
|
6
6
|
|
7
|
-
Gladiator (short for Glimmer Editor) is a [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) sample beta project under on-going development that demonstrates how to build a text editor in Ruby using [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) (JRuby Desktop Development GUI Library).
|
7
|
+
[Gladiator](https://rubygems.org/gems/glimmer-cs-gladiator) (short for Glimmer Editor) is a [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) sample beta project under on-going development that demonstrates how to build a text editor in Ruby using [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) (JRuby Desktop Development GUI Library).
|
8
8
|
It is not intended to be a full-fledged editor by any means, yet mostly a fun educational exercise in using [Glimmer](https://github.com/AndyObtiva/glimmer).
|
9
|
-
Gladiator is also a personal tool for shaping an editor exactly the way I like, with all the keyboard shortcuts I prefer.
|
10
|
-
I leave building truly professional text editors to software tooling experts who would hopefully use [Glimmer](https://github.com/AndyObtiva/glimmer) one day. Otherwise, I have been happily using Gladiator to develop all my [open-source projects](https://github.com/AndyObtiva) since May of 2020.
|
9
|
+
[Gladiator](https://rubygems.org/gems/glimmer-cs-gladiator) is also a personal tool for shaping an editor exactly the way I like, with all the keyboard shortcuts I prefer.
|
10
|
+
I leave building truly professional text editors to software tooling experts who would hopefully use [Glimmer](https://github.com/AndyObtiva/glimmer) one day. Otherwise, I have been happily using [Gladiator](https://rubygems.org/gems/glimmer-cs-gladiator) to develop all my [open-source projects](https://github.com/AndyObtiva) since May of 2020.
|
11
11
|
|
12
|
-
You may now [download](#download) a packaged version of Gladiator.
|
12
|
+
You may now [download](#download) a packaged version of [Gladiator](https://rubygems.org/gems/glimmer-cs-gladiator).
|
13
13
|
|
14
14
|
## Features
|
15
15
|
|
16
|
-
Gladiator currently supports the following text editing features (including keyboard shortcuts with Mac CMD=CTRL/CTRL=ALT on Windows/Linux)
|
16
|
+
[Gladiator](https://rubygems.org/gems/glimmer-cs-gladiator) currently supports the following text editing features (including keyboard shortcuts with Mac CMD=CTRL/CTRL=ALT on Windows/Linux)
|
17
17
|
|
18
18
|
![Gladiator Demo](images/glimmer-gladiator.gif)
|
19
19
|
|
@@ -105,9 +105,9 @@ Gladiator currently supports the following text editing features (including keyb
|
|
105
105
|
|
106
106
|
## Platforms
|
107
107
|
|
108
|
-
- Mac: Gladiator works best on the Mac. This is the platform it is most used on and receives the most maintenance for.
|
109
|
-
- Windows: Gladiator works OK on Windows, but has a few annoying issues.
|
110
|
-
- Linux: Gladiator works with handicaps on Linux (performing some text editing operations causes scroll jitter). Contributers could help fix.
|
108
|
+
- Mac: [Gladiator](https://rubygems.org/gems/glimmer-cs-gladiator) works best on the Mac. This is the platform it is most used on and receives the most maintenance for.
|
109
|
+
- Windows: [Gladiator](https://rubygems.org/gems/glimmer-cs-gladiator) works OK on Windows, but has a few annoying issues.
|
110
|
+
- Linux: [Gladiator](https://rubygems.org/gems/glimmer-cs-gladiator) works with handicaps on Linux (performing some text editing operations causes scroll jitter). Contributers could help fix.
|
111
111
|
|
112
112
|
## Pre-requisites
|
113
113
|
|
@@ -117,11 +117,13 @@ Gladiator currently supports the following text editing features (including keyb
|
|
117
117
|
|
118
118
|
## Download
|
119
119
|
|
120
|
-
[Download Gladiator 0.9.
|
120
|
+
[Download Gladiator 0.9.2 Mac DMG Installer (x64 Catalina & Older)](https://www.dropbox.com/s/8gvthczqhb9szwp/Gladiator-0.9.2.dmg?dl=1)
|
121
121
|
|
122
|
-
[Download Gladiator 0.
|
122
|
+
[Download Gladiator 0.9.2 Windows MSI Installer (x64 Windows 10)](https://www.dropbox.com/s/xxik700jh0utn8q/Gladiator-0.9.2.msi?dl=1)
|
123
123
|
|
124
|
-
|
124
|
+
[Download Gladiator 0.9.1 Mac DMG Installer (x64 Big Sur & Older)](https://www.dropbox.com/s/s9yp6qtelh85qko/Gladiator-0.9.1.dmg?dl=1)
|
125
|
+
|
126
|
+
The packaged version starts with a dialog asking you what project to open. [Gladiator](https://rubygems.org/gems/glimmer-cs-gladiator) does not fully show up until you have selected a project directory.
|
125
127
|
|
126
128
|
Otherwise, if you prefer a command line version, then follow the Setup Instructions below.
|
127
129
|
|
@@ -129,7 +131,7 @@ Otherwise, if you prefer a command line version, then follow the Setup Instructi
|
|
129
131
|
|
130
132
|
Note: if you encounter any issues, check if they are documented in [TODO.md](TODO.md), [issues](https://github.com/AndyObtiva/glimmer-cs-gladiator/issues), or [pull requests](https://github.com/AndyObtiva/glimmer-cs-gladiator/pulls) as they might be on my radar to fix. Otherwise, please report as an [issue](https://github.com/AndyObtiva/glimmer-cs-gladiator/issues) or better yet fix and submit a [pull request](https://github.com/AndyObtiva/glimmer-cs-gladiator/pulls). Also, try going back to a [previous version of the gem](https://rubygems.org/gems/glimmer-cs-gladiator/versions) until you find one that works. Keep in mind this is open-source software provided as is, so there are no guarantees of functionality. If you would like such guarantees, you are welcome to [hire me full-time](https://www.linkedin.com/in/andymaleh/).
|
131
133
|
|
132
|
-
Install Gladiator gem by running (`jgem`, `jruby -S gem`, or `gem` directly if you have [RVM](https://rvm.io/)):
|
134
|
+
Install [Gladiator](https://rubygems.org/gems/glimmer-cs-gladiator) gem by running (`jgem`, `jruby -S gem`, or `gem` directly if you have [RVM](https://rvm.io/)):
|
133
135
|
|
134
136
|
```
|
135
137
|
jgem install glimmer-cs-gladiator
|
@@ -139,7 +141,7 @@ Or add to a JRuby project Bundler `Gemfile` under the `:developement` group:
|
|
139
141
|
|
140
142
|
```
|
141
143
|
group :development do
|
142
|
-
gem 'glimmer-cs-gladiator'
|
144
|
+
gem 'glimmer-cs-gladiator', '> 0'
|
143
145
|
end
|
144
146
|
```
|
145
147
|
|
@@ -158,6 +160,10 @@ source ~/.gladiator_source
|
|
158
160
|
|
159
161
|
You should be able to run `gladiator` from anywhere now.
|
160
162
|
|
163
|
+
You can pass a project path as a first argument to open a particular project.
|
164
|
+
|
165
|
+
Alternatively, open in app mode (gives you a dialog to open any project) by passing `APP_MODE=true` argument/env-var.
|
166
|
+
|
161
167
|
## Usage
|
162
168
|
|
163
169
|
You may run the `gladiator` command to bring up the text editor in the project directory you would like to edit:
|
@@ -188,11 +194,11 @@ Note: If you cloned this project and bundle installed, you may invoke via `bin/g
|
|
188
194
|
|
189
195
|
### Glimmer Custom Shell Reuse
|
190
196
|
|
191
|
-
To reuse Gladiator as a Glimmer Custom Shell inside another Glimmer application, add the
|
197
|
+
To reuse [Gladiator](https://rubygems.org/gems/glimmer-cs-gladiator) as a Glimmer Custom Shell inside another Glimmer application, add the
|
192
198
|
following to the application's `Gemfile`:
|
193
199
|
|
194
200
|
```
|
195
|
-
gem 'glimmer-cs-gladiator', '>= 0.9.
|
201
|
+
gem 'glimmer-cs-gladiator', '>= 0.9.2'
|
196
202
|
```
|
197
203
|
|
198
204
|
Run:
|
@@ -201,11 +207,17 @@ Run:
|
|
201
207
|
jruby -S bundle
|
202
208
|
```
|
203
209
|
|
204
|
-
And, then instantiate the Gladiator [custom shell](https://github.com/AndyObtiva/glimmer-dsl-swt#custom-shells) in your [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) application via the `gladiator` keyword assuming you already have `include Glimmer` in your class, module, or main object.
|
210
|
+
And, then instantiate the [Gladiator](https://rubygems.org/gems/glimmer-cs-gladiator) [custom shell](https://github.com/AndyObtiva/glimmer-dsl-swt#custom-shells) in your [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) application via the `gladiator` keyword assuming you already have `include Glimmer` in your class, module, or main object.
|
205
211
|
|
206
212
|
## Env Var Options
|
207
213
|
|
208
|
-
Gladiator
|
214
|
+
[Gladiator](https://rubygems.org/gems/glimmer-cs-gladiator) supports these environment variable options.
|
215
|
+
|
216
|
+
### LOCAL_DIR
|
217
|
+
|
218
|
+
(String / default: `'.'`)
|
219
|
+
|
220
|
+
[Gladiator](https://rubygems.org/gems/glimmer-cs-gladiator) opens with the current directory as the root by default.
|
209
221
|
If you would like to open another directory, set `LOCAL_DIR` environment variable.
|
210
222
|
|
211
223
|
Example:
|
@@ -214,11 +226,23 @@ Example:
|
|
214
226
|
LOCAL_DIR="/Users/User/code" gladiator
|
215
227
|
```
|
216
228
|
|
217
|
-
Opens Gladiator with "/Users/User/code" as the root directory.
|
229
|
+
Opens [Gladiator](https://rubygems.org/gems/glimmer-cs-gladiator) with "/Users/User/code" as the root directory.
|
230
|
+
|
231
|
+
### APP_MODE
|
232
|
+
|
233
|
+
(`true` or `false` / default: `false` from terminal/command-line and `true` from [packaged Gladiator](#download))
|
234
|
+
|
235
|
+
Specifies whether to run in app mode, thus providing a dialog to open any project path instead of starting with a specific project from the get-go.
|
236
|
+
|
237
|
+
Example:
|
238
|
+
|
239
|
+
```
|
240
|
+
APP_MODE=true gladiator
|
241
|
+
```
|
218
242
|
|
219
243
|
## Configuration
|
220
244
|
|
221
|
-
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.
|
245
|
+
[Gladiator](https://rubygems.org/gems/glimmer-cs-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.
|
222
246
|
|
223
247
|
It currently remembers:
|
224
248
|
- Last opened files (in both split panes if split)
|
@@ -229,7 +253,7 @@ It currently remembers:
|
|
229
253
|
|
230
254
|
### Signaling Error
|
231
255
|
|
232
|
-
Gladiator repetitively displays a signaling error that is harmless in practice:
|
256
|
+
[Gladiator](https://rubygems.org/gems/glimmer-cs-gladiator) repetitively displays a signaling error that is harmless in practice:
|
233
257
|
```
|
234
258
|
The signal HUP is in use by the JVM and will not work correctly on this platform
|
235
259
|
The signal INT is in use by the JVM and will not work correctly on this platform
|
@@ -239,7 +263,7 @@ The signal TERM is in use by the JVM and will not work correctly on this platfor
|
|
239
263
|
### App Is Not Responding
|
240
264
|
|
241
265
|
If you run the `gladiator` command from the root directory or some parent directory to many projects, it assumes that is
|
242
|
-
the project directory and attempts to pre-load all files (just part of Gladiator's architectural design and assumptions for optimizing use per project), taking a very long time and not responding for quite a while.
|
266
|
+
the project directory and attempts to pre-load all files (just part of [Gladiator](https://rubygems.org/gems/glimmer-cs-gladiator)'s architectural design and assumptions for optimizing use per project), taking a very long time and not responding for quite a while.
|
243
267
|
|
244
268
|
To avoid this problem, always make sure you are running the `gladiator` command from a single project's directory.
|
245
269
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.2
|
data/bin/gladiator
CHANGED
@@ -24,11 +24,8 @@
|
|
24
24
|
require 'glimmer/launcher'
|
25
25
|
|
26
26
|
gladiator_runner = File.expand_path('../glimmer-cs-gladiator', __FILE__)
|
27
|
-
launcher = Glimmer::Launcher.new([gladiator_runner
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
ENV['LOCAL_DIR'] ||= file
|
32
|
-
end
|
33
|
-
end
|
27
|
+
launcher = Glimmer::Launcher.new([gladiator_runner] + ARGV)
|
28
|
+
local_dir = ARGV.find {|arg| !arg.include?('=') }
|
29
|
+
local_dir = File.expand_path(local_dir) if local_dir
|
30
|
+
ENV['LOCAL_DIR'] ||= local_dir if local_dir != gladiator_runner
|
34
31
|
launcher.launch
|
data/bin/gladiator-setup
CHANGED
@@ -1,21 +1,22 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in
|
3
|
+
# Instead, edit Jeweler::Tasks in rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: glimmer-cs-gladiator 0.9.
|
5
|
+
# stub: glimmer-cs-gladiator 0.9.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "glimmer-cs-gladiator".freeze
|
9
|
-
s.version = "0.9.
|
9
|
+
s.version = "0.9.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Andy Maleh".freeze]
|
14
|
-
s.date = "2021-
|
14
|
+
s.date = "2021-12-10"
|
15
15
|
s.description = "Gladiator (short for Glimmer Editor) is a Glimmer sample project under on-going development. It is not intended to be a full-fledged editor by any means, yet mostly a fun educational exercise in using Glimmer to build a text editor. Gladiator is also a personal tool for shaping an editor exactly the way I like. I leave building truly professional text editors to software tooling experts who would hopefully use Glimmer one day.".freeze
|
16
16
|
s.email = "andy.am@gmail.com".freeze
|
17
17
|
s.executables = ["glimmer-cs-gladiator".freeze, "gladiator".freeze, "gladiator-setup".freeze]
|
18
18
|
s.extra_rdoc_files = [
|
19
|
+
"CHANGELOG.md",
|
19
20
|
"LICENSE.txt",
|
20
21
|
"README.md"
|
21
22
|
]
|
@@ -53,20 +54,22 @@ Gem::Specification.new do |s|
|
|
53
54
|
end
|
54
55
|
|
55
56
|
if s.respond_to? :add_runtime_dependency then
|
56
|
-
s.add_runtime_dependency(%q<glimmer-dsl-swt>.freeze, ["~> 4.20.
|
57
|
+
s.add_runtime_dependency(%q<glimmer-dsl-swt>.freeze, ["~> 4.20.16.0"])
|
57
58
|
s.add_runtime_dependency(%q<filewatcher>.freeze, ["~> 1.1.1"])
|
58
59
|
s.add_runtime_dependency(%q<clipboard>.freeze, ["~> 1.3.5"])
|
59
60
|
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
60
61
|
s.add_development_dependency(%q<jeweler>.freeze, ["= 2.3.9"])
|
61
62
|
s.add_development_dependency(%q<warbler>.freeze, ["= 2.0.5"])
|
63
|
+
s.add_development_dependency(%q<jruby-jars>.freeze, ["= 9.2.19.0"])
|
62
64
|
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
63
65
|
else
|
64
|
-
s.add_dependency(%q<glimmer-dsl-swt>.freeze, ["~> 4.20.
|
66
|
+
s.add_dependency(%q<glimmer-dsl-swt>.freeze, ["~> 4.20.16.0"])
|
65
67
|
s.add_dependency(%q<filewatcher>.freeze, ["~> 1.1.1"])
|
66
68
|
s.add_dependency(%q<clipboard>.freeze, ["~> 1.3.5"])
|
67
69
|
s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
68
70
|
s.add_dependency(%q<jeweler>.freeze, ["= 2.3.9"])
|
69
71
|
s.add_dependency(%q<warbler>.freeze, ["= 2.0.5"])
|
72
|
+
s.add_dependency(%q<jruby-jars>.freeze, ["= 9.2.19.0"])
|
70
73
|
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
71
74
|
end
|
72
75
|
end
|
@@ -16,7 +16,7 @@ module Glimmer
|
|
16
16
|
@project_dir = project_dir
|
17
17
|
if is_local_dir
|
18
18
|
@filewatcher = Filewatcher.new(path)
|
19
|
-
Thread.new(@filewatcher) do |fw|
|
19
|
+
@filewatcher_thread = Thread.new(@filewatcher) do |fw|
|
20
20
|
begin
|
21
21
|
fw.watch do |filename, event|
|
22
22
|
# TODO do fine grained processing of events for enhanced performance (e.g. dir refresh vs file change)
|
@@ -109,6 +109,19 @@ module Glimmer
|
|
109
109
|
def selected_child_path_history
|
110
110
|
@selected_child_path_history ||= []
|
111
111
|
end
|
112
|
+
|
113
|
+
def close
|
114
|
+
all_children_files.each(&:close)
|
115
|
+
stop_filewatcher
|
116
|
+
end
|
117
|
+
|
118
|
+
def stop_filewatcher
|
119
|
+
@filewatcher&.stop
|
120
|
+
@filewatcher_thread&.kill
|
121
|
+
@filewatcher_thread = nil
|
122
|
+
@filewatcher&.finalize
|
123
|
+
@filewatcher = nil
|
124
|
+
end
|
112
125
|
|
113
126
|
def pause_refresh
|
114
127
|
@refresh_paused = true
|
@@ -177,7 +190,7 @@ module Glimmer
|
|
177
190
|
# scratchpad scenario
|
178
191
|
if selected_path.empty? # Scratchpad
|
179
192
|
@selected_child&.write_dirty_content
|
180
|
-
@scratchpad = (self.selected_child = File.new('', project_dir
|
193
|
+
@scratchpad = (self.selected_child = File.new('', project_dir)) if @scratchpad.nil? || @scratchpad.closed?
|
181
194
|
return @scratchpad
|
182
195
|
end
|
183
196
|
full_selected_path = selected_path.include?(project_dir.path) ? selected_path : ::File.join(project_dir.path, selected_path)
|
@@ -189,7 +202,6 @@ module Glimmer
|
|
189
202
|
new_child = find_child_file(selected_path)
|
190
203
|
begin
|
191
204
|
unless new_child.dirty_content.nil?
|
192
|
-
self.selected_child&.stop_filewatcher
|
193
205
|
selected_child_path_history << new_child.path if new_child && !selected_child_path_history.include?(new_child.path)
|
194
206
|
self.selected_child = new_child
|
195
207
|
self.selected_child.start_filewatcher
|
@@ -244,8 +244,8 @@ module Glimmer
|
|
244
244
|
|
245
245
|
def start_filewatcher
|
246
246
|
return if scratchpad?
|
247
|
-
@filewatcher
|
248
|
-
@
|
247
|
+
@filewatcher ||= Filewatcher.new(@path)
|
248
|
+
@filewatcher_thread ||= Thread.new(@filewatcher) do |fw|
|
249
249
|
fw.watch do |filename, event|
|
250
250
|
async_exec do
|
251
251
|
begin
|
@@ -261,6 +261,10 @@ module Glimmer
|
|
261
261
|
|
262
262
|
def stop_filewatcher
|
263
263
|
@filewatcher&.stop
|
264
|
+
@filewatcher_thread&.kill
|
265
|
+
@filewatcher_thread = nil
|
266
|
+
@filewatcher&.finalize
|
267
|
+
@filewatcher = nil
|
264
268
|
end
|
265
269
|
|
266
270
|
def write_dirty_content
|
@@ -519,6 +523,7 @@ module Glimmer
|
|
519
523
|
self.dirty_content = new_dirty_content
|
520
524
|
find_next
|
521
525
|
find_next if replace_text.to_s.include?(find_text) && !replace_text.to_s.start_with?(find_text)
|
526
|
+
write_dirty_content
|
522
527
|
end
|
523
528
|
|
524
529
|
def page_up
|
@@ -218,14 +218,14 @@ module Glimmer
|
|
218
218
|
found_tab_item&.setData('file', file)
|
219
219
|
found_tab_item&.setData('file_path', file.path)
|
220
220
|
found_tab_item&.setText(file.name)
|
221
|
-
body_root.pack_same_size
|
222
221
|
if current_file
|
223
222
|
project_dir.selected_child_path = file_path
|
224
223
|
else
|
225
|
-
selected_tab_item&.getData('text_editor')&.text_widget&.setFocus
|
224
|
+
gladiator.selected_tab_item&.getData('text_editor')&.text_widget&.setFocus
|
226
225
|
end
|
227
226
|
async_exec {
|
228
227
|
swt_widget.showItem(edited_tree_item)
|
228
|
+
gladiator.body_root.pack_same_size
|
229
229
|
}
|
230
230
|
end
|
231
231
|
end
|
@@ -96,11 +96,12 @@ module Glimmer
|
|
96
96
|
## Uncomment before_body block to pre-initialize variables to use in body
|
97
97
|
#
|
98
98
|
#
|
99
|
-
before_body
|
99
|
+
before_body do
|
100
|
+
@@quitting = false
|
100
101
|
# TODO consider doing loading project files after displaying the GUI instead of holding it up before
|
101
|
-
project_dir #pre-initialize directory
|
102
|
-
TOPLEVEL_BINDING.receiver.send(:
|
103
|
-
|
102
|
+
project_dir unless app_mode? #pre-initialize directory
|
103
|
+
TOPLEVEL_BINDING.receiver.send(:trap, "SIGINT") do |signal|
|
104
|
+
quit
|
104
105
|
end
|
105
106
|
Display.setAppName('Gladiator')
|
106
107
|
Display.setAppVersion(VERSION)
|
@@ -108,20 +109,12 @@ module Glimmer
|
|
108
109
|
unless defined?(@@display)
|
109
110
|
@@display = display {
|
110
111
|
# TODO look into why a weird java dialog comes up on about (maybe a non-issue once packaged)
|
111
|
-
on_about {
|
112
|
-
|
113
|
-
|
114
|
-
on_quit {
|
115
|
-
display.swt_display.shells.each { |shell|
|
116
|
-
gladiator = shell.get_data('custom_shell')
|
117
|
-
gladiator.project_dir.selected_child&.write_dirty_content
|
118
|
-
shell.close
|
119
|
-
}
|
120
|
-
}
|
121
|
-
on_swt_keydown { |key_event|
|
112
|
+
on_about { display_about_dialog }
|
113
|
+
on_quit { quit }
|
114
|
+
on_swt_keydown do |key_event|
|
122
115
|
focused_gladiator = display.focus_control.shell&.get_data('custom_shell')
|
123
116
|
focused_gladiator.handle_display_shortcut(key_event) if !focused_gladiator.nil? && focused_gladiator.is_a?(Glimmer::Gladiator) && key_event.widget.shell == focused_gladiator&.swt_widget
|
124
|
-
|
117
|
+
end
|
125
118
|
}
|
126
119
|
end
|
127
120
|
|
@@ -132,119 +125,121 @@ module Glimmer
|
|
132
125
|
@config = {}
|
133
126
|
load_config_ignore_paths
|
134
127
|
end
|
135
|
-
|
128
|
+
end
|
136
129
|
|
137
130
|
## Uncomment after_body block to setup observers for widgets in body
|
138
131
|
#
|
139
|
-
after_body
|
140
|
-
|
141
|
-
|
142
|
-
end
|
143
|
-
observe(project_dir, 'selected_child') do |selected_file|
|
144
|
-
if selected_file
|
145
|
-
if Gladiator.drag && !@tab_folder2
|
146
|
-
self.tab_folder1 = current_tab_folder
|
147
|
-
@tab_folder_sash_form.content {
|
148
|
-
self.current_tab_folder = self.tab_folder2 = text_editor_group_tab_folder
|
149
|
-
@current_tab_folder.swt_widget.setData('proxy', @current_tab_folder)
|
150
|
-
}
|
151
|
-
body_root.pack_same_size
|
152
|
-
end
|
132
|
+
after_body do
|
133
|
+
unless app_mode?
|
134
|
+
observe(project_dir, 'children') do
|
153
135
|
@file_explorer_tree.select_tree_item unless Gladiator.startup
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
136
|
+
end
|
137
|
+
observe(project_dir, 'selected_child') do |selected_file|
|
138
|
+
if selected_file
|
139
|
+
if Gladiator.drag && !@tab_folder2
|
140
|
+
self.tab_folder1 = current_tab_folder
|
141
|
+
@tab_folder_sash_form.content {
|
142
|
+
self.current_tab_folder = self.tab_folder2 = text_editor_group_tab_folder
|
143
|
+
@current_tab_folder.swt_widget.setData('proxy', @current_tab_folder)
|
144
|
+
}
|
145
|
+
body_root.pack_same_size
|
146
|
+
end
|
147
|
+
@file_explorer_tree.select_tree_item unless Gladiator.startup
|
148
|
+
found_tab_item = selected_tab_item
|
149
|
+
if found_tab_item
|
150
|
+
@current_tab_folder.swt_widget.setSelection(found_tab_item)
|
151
|
+
@current_tab_item = found_tab_item.getData('proxy')
|
152
|
+
@current_text_editor = found_tab_item.getData('text_editor') unless found_tab_item.getData('text_editor').nil?
|
153
|
+
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
154
|
+
else
|
155
|
+
begin
|
156
|
+
@current_tab_folder.content {
|
157
|
+
@current_tab_item = tab_item { |the_tab_item|
|
158
|
+
text selected_file.name
|
159
|
+
fill_layout(:horizontal) {
|
160
|
+
margin_width 0
|
161
|
+
margin_height 0
|
174
162
|
}
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
163
|
+
tab_folder = nil
|
164
|
+
the_text_editor = nil
|
165
|
+
the_tab_item.content {
|
166
|
+
@current_text_editor = the_text_editor = text_editor(project_dir: project_dir, file: selected_file) {
|
167
|
+
layout_data :fill, :fill, true, true
|
168
|
+
}
|
169
|
+
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
170
|
+
the_tab_item.swt_tab_item.setData('text_editor', @current_text_editor)
|
171
|
+
@current_text_editor.text_proxy.content {
|
172
|
+
on_focus_gained {
|
173
|
+
tab_folder = the_text_editor.swt_widget.getParent.getParent
|
174
|
+
self.current_tab_folder = tab_folder.getData('proxy')
|
175
|
+
@current_tab_item = the_tab_item
|
176
|
+
@current_text_editor = the_text_editor
|
177
|
+
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
178
|
+
@current_tab_folder.swt_widget.setSelection(@current_tab_item.swt_tab_item)
|
179
|
+
project_dir.selected_child = @current_tab_item.swt_tab_item.getData('file')
|
180
|
+
}
|
186
181
|
}
|
187
182
|
}
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
tab_item_file.close
|
183
|
+
|
184
|
+
on_swt_show do
|
185
|
+
@current_tab_item = the_tab_item
|
186
|
+
@current_text_editor = the_text_editor
|
187
|
+
self.current_tab_folder = @current_tab_item.swt_widget.getParent.getData('proxy')
|
188
|
+
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
189
|
+
@current_tab_folder.swt_widget.setSelection(@current_tab_item.swt_tab_item)
|
190
|
+
project_dir.selected_child = selected_file
|
191
|
+
@current_text_editor&.load_content
|
192
|
+
@current_text_editor&.text_widget&.setFocus
|
193
|
+
save_config unless selected_file.nil?
|
194
|
+
end
|
195
|
+
|
196
|
+
on_widget_disposed do
|
197
|
+
project_dir.selected_child&.write_dirty_content
|
198
|
+
tab_item_file = the_tab_item.swt_tab_item.get_data('file')
|
199
|
+
tab_item_file.close if !@@quitting && (@tab_folder1 != @current_tab_folder && !@tab_folder1&.items&.detect {|ti| ti.get_data('file') == tab_item_file}) || (@tab_folder2 != @current_tab_folder && !@tab_folder2&.items&.detect {|ti| ti.get_data('file') == tab_item_file})
|
205
200
|
end
|
206
201
|
}
|
202
|
+
@current_tab_item.swt_tab_item.setData('file_path', selected_file.path)
|
203
|
+
@current_tab_item.swt_tab_item.setData('file', selected_file)
|
204
|
+
@current_tab_item.swt_tab_item.setData('proxy', @current_tab_item)
|
207
205
|
}
|
208
|
-
@
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
body_root.pack_same_size
|
214
|
-
rescue => e
|
215
|
-
Glimmer::Config.logger.error {e.full_message}
|
206
|
+
@current_tab_folder.swt_widget.setSelection(@current_tab_item.swt_tab_item)
|
207
|
+
body_root.pack_same_size
|
208
|
+
rescue => e
|
209
|
+
Glimmer::Config.logger.error {e.full_message}
|
210
|
+
end
|
216
211
|
end
|
212
|
+
@current_text_editor&.text_widget&.setFocus
|
217
213
|
end
|
218
|
-
@current_text_editor&.text_widget&.setFocus
|
219
214
|
end
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
215
|
+
observe(self, 'maximized_pane') do
|
216
|
+
if tab_folder2
|
217
|
+
@tab_folder_sash_form.maximized_control = (current_tab_folder.swt_widget if maximized_pane?)
|
218
|
+
end
|
224
219
|
end
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
220
|
+
observe(self, 'maximized_editor') do
|
221
|
+
@file_area_and_editor_area_sash_form.maximized_control = (@editor_area_composite.swt_widget if maximized_editor?)
|
222
|
+
if !maximized_editor?
|
223
|
+
expand_navigation_expand_bar_height
|
224
|
+
else
|
225
|
+
collapse_navigation_expand_bar_height
|
226
|
+
end
|
227
|
+
@navigation_expand_item.swt_expand_item.set_expanded !maximized_editor?
|
228
|
+
body_root.pack_same_size
|
229
|
+
async_exec { body_root.pack_same_size }
|
232
230
|
end
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
observe(project_dir, 'selected_child.top_pixel') do
|
244
|
-
save_config
|
231
|
+
observe(project_dir, 'selected_child') do
|
232
|
+
save_config
|
233
|
+
end
|
234
|
+
observe(project_dir, 'selected_child.caret_position') do
|
235
|
+
save_config
|
236
|
+
end
|
237
|
+
observe(project_dir, 'selected_child.top_pixel') do
|
238
|
+
save_config
|
239
|
+
end
|
240
|
+
load_config
|
245
241
|
end
|
246
|
-
|
247
|
-
}
|
242
|
+
end
|
248
243
|
|
249
244
|
## Add widget content inside custom shell body
|
250
245
|
## Top-most widget must be a shell or another custom shell
|
@@ -287,6 +282,7 @@ module Glimmer
|
|
287
282
|
on_shell_closed {
|
288
283
|
project_dir.selected_child&.write_dirty_content
|
289
284
|
save_config
|
285
|
+
@paused_save_config = true
|
290
286
|
if @tab_folder2
|
291
287
|
current_tab_folder.swt_widget.getItems.each do |tab_item|
|
292
288
|
tab_item.getData('proxy')&.dispose
|
@@ -297,6 +293,7 @@ module Glimmer
|
|
297
293
|
tab_item.getData('proxy')&.dispose
|
298
294
|
end
|
299
295
|
gladiator_shells = display.shells.select {|s| s.get_data('custom_shell')&.is_a?(Glimmer::Gladiator)}
|
296
|
+
project_dir.close unless @@quitting
|
300
297
|
body_root.close unless current_tab_folder.swt_widget.getItems.empty?
|
301
298
|
async_exec { @@app_mode_shell.show } if defined?(@@app_mode_shell) && gladiator_shells.count <= 2
|
302
299
|
}
|
@@ -766,28 +763,28 @@ module Glimmer
|
|
766
763
|
project_dir.selected_child&.top_pixel = @config[:top_pixel].to_i if @config[:top_pixel]
|
767
764
|
end
|
768
765
|
}
|
769
|
-
async_exec
|
766
|
+
async_exec do
|
770
767
|
Gladiator.drag = false
|
771
768
|
@progress_shell&.close
|
772
769
|
@progress_shell = nil
|
773
770
|
@loaded_config = true
|
774
|
-
|
771
|
+
end
|
775
772
|
}
|
776
|
-
async_exec
|
773
|
+
async_exec do
|
777
774
|
Thread.new {
|
778
775
|
all_files = open_file_paths1.to_a + open_file_paths2.to_a
|
779
776
|
all_files.each do |file|
|
780
777
|
project_dir.find_child_file(file)&.dirty_content
|
781
778
|
end
|
782
779
|
}
|
783
|
-
|
780
|
+
end
|
784
781
|
else
|
785
782
|
@loaded_config = true
|
786
783
|
end
|
787
784
|
end
|
788
785
|
|
789
786
|
def save_config
|
790
|
-
return if !@loaded_config || body_root&.disposed?
|
787
|
+
return if !@loaded_config || body_root&.disposed? || @paused_save_config
|
791
788
|
child = project_dir.selected_child
|
792
789
|
return if child.nil?
|
793
790
|
tab_folder1 = @tab_folder1 || @current_tab_folder
|
@@ -918,7 +915,7 @@ module Glimmer
|
|
918
915
|
async_exec {
|
919
916
|
@progress_shell.open
|
920
917
|
}
|
921
|
-
async_exec
|
918
|
+
async_exec do
|
922
919
|
gladiator(project_dir_path: selected_directory) {
|
923
920
|
on_swt_show {
|
924
921
|
@@app_mode_shell.hide if app_mode?
|
@@ -926,6 +923,15 @@ module Glimmer
|
|
926
923
|
@progress_shell = nil
|
927
924
|
}
|
928
925
|
}.open if selected_directory
|
926
|
+
end
|
927
|
+
end
|
928
|
+
|
929
|
+
def quit
|
930
|
+
@@quitting = true
|
931
|
+
display.shells.each { |shell|
|
932
|
+
gladiator = shell.get_data('custom_shell')
|
933
|
+
gladiator.project_dir.selected_child&.write_dirty_content unless app_mode?
|
934
|
+
shell.get_data('proxy').close
|
929
935
|
}
|
930
936
|
end
|
931
937
|
|
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.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-10 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.20.
|
18
|
+
version: 4.20.16.0
|
19
19
|
name: glimmer-dsl-swt
|
20
20
|
prerelease: false
|
21
21
|
type: :runtime
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.20.
|
26
|
+
version: 4.20.16.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 2.0.5
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - '='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 9.2.19.0
|
103
|
+
name: jruby-jars
|
104
|
+
prerelease: false
|
105
|
+
type: :development
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 9.2.19.0
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
requirement: !ruby/object:Gem::Requirement
|
99
113
|
requirements:
|
@@ -121,6 +135,7 @@ executables:
|
|
121
135
|
- gladiator-setup
|
122
136
|
extensions: []
|
123
137
|
extra_rdoc_files:
|
138
|
+
- CHANGELOG.md
|
124
139
|
- LICENSE.txt
|
125
140
|
- README.md
|
126
141
|
files:
|