glimmer-cs-gladiator 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55dd5d14035a4d76ce686365ba16ab6a49c8f1fcbef2298d171fdeea2b2777b8
4
- data.tar.gz: 65e5240faa47773332187063daa9500441ecc2a8a6b117aee646f4bf47162588
3
+ metadata.gz: 4027589accf83fa2244350dc416c3ab56bf28c9f65cbf3288d96c0b5f13c27aa
4
+ data.tar.gz: 11e18e7f18605188cd151e4e8307b10dc808b9059a7f275d3a37c1a1ba3cc65a
5
5
  SHA512:
6
- metadata.gz: 77ba3e5e51fc0b9a815ee753c1fbfe839714217a56259dd6a12b6646b08df28a33ecdf5c87dbe169e62fdfd4063d799378fcc7781c46623451ba2d6ac6055fbd
7
- data.tar.gz: 20f95fcdaf04f39d4ce979e30846ab2442ac37d416830d63cc95413dd89942c426c36fbc98f2d6328f97e1717f08243cfa5dcb38cea79b0e89873315c4878f39
6
+ metadata.gz: c774eaa5fb91c4a5ceb08aa98715ab32bddcea61c4793b3d0dfd74119142c2245c7574835dda59d698239b8be3448d1d7fc76fe801643b53d4aa236b3a6bd54e
7
+ data.tar.gz: cab4d312f803a8e93fb5d7954ffd7319092ae4a1c9d827dca95b5670c22ef484475c34989b109b91f922f126a73eea94d7c73b56d53fa6781075011419b8d1fb
@@ -1,5 +1,18 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.7.3
4
+
5
+ - Add gladiator-setup to make gladiator executable available everywhere
6
+ - Package Gladiator as Mac DMG file
7
+ - Shrink minimum height for editor area (too large for putting side by side with another window)
8
+ - Change initial default size of Gladiator window to the entire screen size
9
+ - Made layout more resilient to shrinkage so that the Navigation area widgets don't get jumbled up
10
+ - Show open project dialog when run as Gladiator app (e.g. Mac app) instead of opening the local directory of the app
11
+ - Extract gladiator_menu_bar custom widget and reuse in open_project shell (to use in app version)
12
+ - Extract progress_shell custom shell
13
+ - Fix issue with disposed? error in save_config
14
+ - Fix issue with first open of a file with an empty brand new gladiator session not showing file content until resizing
15
+
3
16
  ## 0.7.2
4
17
 
5
18
  - Fallback font ("Courier") for text editor when "Consolas" is not available
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.7.2 - [Ugliest Text Editor Ever!](https://www.reddit.com/r/ruby/comments/hgve8k/gladiator_glimmer_editor_ugliest_text_editor_ever/)
1
+ # <img src='https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-gladiator/master/images/glimmer-cs-gladiator-logo.svg' height=85 /> Gladiator 0.7.3 - [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
 
@@ -86,6 +86,12 @@ Gladiator currently supports the following text editing features (including keyb
86
86
  - [JRuby](https://www.jruby.org/download): Same version required by [Glimmer](https://github.com/AndyObtiva/glimmer-dsl-swt)
87
87
  - [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) (JRuby Desktop Development GUI Framework): '>= 4.17.2.0', '< 5.0.0.0' (dependency included in Ruby gem).
88
88
 
89
+ ## Download
90
+
91
+ You may download a [packaged version of the Gladiator app](https://www.dropbox.com/s/kcr20unx7obs6z2/Gladiator-0.7.3.dmg?dl=1) on the Mac.
92
+
93
+ Otherwise, if you prefer a command line version, then follow the Setup Instructions below.
94
+
89
95
  ## Setup Instructions
90
96
 
91
97
  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).
@@ -110,6 +116,20 @@ Run (`jruby -S bundle` or `bundle` directly if you have [RVM](https://rvm.io/)):
110
116
  jruby -S bundle
111
117
  ```
112
118
 
119
+ Afterwards, to ensure system wide availablility of the `gladiator` command, run this command in an environment that has JRuby:
120
+
121
+ ```
122
+ gladiator-setup
123
+ ```
124
+
125
+ Finally, start a new terminal session or source .gladiator_source:
126
+
127
+ ```
128
+ source ~/.gladiator_source
129
+ ```
130
+
131
+ You should be able to run `gladiator` from anywhere now, even cross-rubies in [RVM](https://rvm.io).
132
+
113
133
  ## Usage
114
134
 
115
135
  You may run the `gladiator` command to bring up the text editor in the project directory you would like to edit:
@@ -138,19 +158,13 @@ gladiator relative-or-absolute-path/to/project
138
158
 
139
159
  Note: If you cloned this project and bundle installed, you may invoke via `bin/gladiator` instead.
140
160
 
141
- If your project is not a JRuby project, then you cannot install [glimmer-cs-gladiator](https://rubygems.org/gems/glimmer-cs-gladiator), so you must install in a separate JRuby environment and invoke by passing the project path as per command above. Alternatively, you may clone this project, and invoke gladiator via `bin/gladiator` (that's how I use Gladiator for most of my projects):
142
-
143
- ```
144
- bin/gladiator relative-or-absolute-path/to/project
145
- ```
146
-
147
161
  ### Glimmer Custom Shell Reuse
148
162
 
149
163
  To reuse Gladiator as a Glimmer Custom Shell inside another Glimmer application, add the
150
164
  following to the application's `Gemfile`:
151
165
 
152
166
  ```
153
- gem 'glimmer-cs-gladiator', '>= 0.7.2'
167
+ gem 'glimmer-cs-gladiator', '>= 0.7.3'
154
168
  ```
155
169
 
156
170
  Run:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.2
1
+ 0.7.3
@@ -1,8 +1,29 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ # Copyright (c) 2020-2021 Andy Maleh
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining
6
+ # a copy of this software and associated documentation files (the
7
+ # "Software"), to deal in the Software without restriction, including
8
+ # without limitation the rights to use, copy, modify, merge, publish,
9
+ # distribute, sublicense, and/or sell copies of the Software, and to
10
+ # permit persons to whom the Software is furnished to do so, subject to
11
+ # the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be
14
+ # included in all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
3
24
  require 'glimmer/launcher'
4
25
 
5
- gladiator_runner = File.expand_path('../gladiator_runner.rb', __FILE__)
26
+ gladiator_runner = File.expand_path('../glimmer-cs-gladiator', __FILE__)
6
27
  launcher = Glimmer::Launcher.new([gladiator_runner, '-J-Xrs'] + ARGV)
7
28
  launcher.application_paths.to_a.each do |file|
8
29
  if file != gladiator_runner
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Copyright (c) 2020-2021 Andy Maleh
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining
6
+ # a copy of this software and associated documentation files (the
7
+ # "Software"), to deal in the Software without restriction, including
8
+ # without limitation the rights to use, copy, modify, merge, publish,
9
+ # distribute, sublicense, and/or sell copies of the Software, and to
10
+ # permit persons to whom the Software is furnished to do so, subject to
11
+ # the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be
14
+ # included in all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ version = File.read(File.expand_path('../VERSION', __dir__))
25
+ puts "== Gladiator (Glimmer Editor) Version #{version.strip} =="
26
+
27
+ ruby = `which jruby`.to_s.strip
28
+ if ruby.empty?
29
+ return puts('jruby is not available. Make sure you have jruby installed and available in path environment (or selected if using RVM)')
30
+ end
31
+
32
+ rvm_command = `which rvm`
33
+ if rvm_command.to_s.strip.empty?
34
+ command = "#{ruby} #{File.expand_path('../gladiator', __FILE__)}"
35
+ else
36
+ rvm = `rvm current`.strip
37
+ command = "rvm #{rvm} do #{ruby} #{File.expand_path('../gladiator', __FILE__)}"
38
+ end
39
+
40
+ gladiator_script = <<~SHELL_SCRIPT
41
+ function gladiator()
42
+ {
43
+ #{command}
44
+ }
45
+ SHELL_SCRIPT
46
+
47
+
48
+ require 'fileutils'
49
+ home_dir = `echo ~`.strip
50
+ FileUtils.mkdir_p("#{home_dir}/bin")
51
+ gladiator_script_file = "#{home_dir}/.gladiator_source"
52
+ gladiator_script_file_bash = "$HOME/.gladiator_source"
53
+ File.write(gladiator_script_file, gladiator_script)
54
+
55
+ [
56
+ ['.bash_profile', '.bashrc'],
57
+ ['.zprofile', '.zshrc']
58
+ ].each do |profile_and_fallback|
59
+ shell_profile_file_name = profile_and_fallback.first
60
+ shell_profile_file_name = profile_and_fallback.last if !File.exist?("#{home_dir}/#{shell_profile_file_name}")
61
+ shell_profile_file = "#{home_dir}/#{shell_profile_file_name}"
62
+ FileUtils.touch(shell_profile_file)
63
+ shell_profile = File.read(shell_profile_file)
64
+ gladiator_source_statement = "source \"#{gladiator_script_file_bash}\""
65
+ unless shell_profile.split("\n").detect {|line| line.include?(gladiator_source_statement) }
66
+ File.write(shell_profile_file, "#{shell_profile}\n#{gladiator_source_statement}")
67
+ end
68
+ puts "~/#{shell_profile_file_name} has been modified to source the `gladiator` function from ~/.gladiator_source"
69
+ end
70
+
71
+ puts <<~OUTPUT
72
+
73
+ Before using `gladiator`, start a new shell session (open a new terminal tab) or run:
74
+
75
+ source ~/.gladiator_source
76
+
77
+ Afterwards, you may run the following command from anywhere to start Gladiator (Glimmer Editor):
78
+
79
+ gladiator
80
+ OUTPUT
@@ -0,0 +1,22 @@
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_relative '../lib/glimmer-cs-gladiator/launch'
@@ -2,19 +2,19 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: glimmer-cs-gladiator 0.7.2 ruby lib
5
+ # stub: glimmer-cs-gladiator 0.7.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "glimmer-cs-gladiator".freeze
9
- s.version = "0.7.2"
9
+ s.version = "0.7.3"
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-01-17"
14
+ s.date = "2021-01-20"
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
- s.executables = ["gladiator".freeze]
17
+ s.executables = ["glimmer-cs-gladiator".freeze, "gladiator".freeze, "gladiator-setup".freeze]
18
18
  s.extra_rdoc_files = [
19
19
  "LICENSE.txt",
20
20
  "README.md"
@@ -25,20 +25,25 @@ Gem::Specification.new do |s|
25
25
  "README.md",
26
26
  "VERSION",
27
27
  "bin/gladiator",
28
- "bin/gladiator_runner.rb",
28
+ "bin/gladiator-setup",
29
+ "bin/glimmer-cs-gladiator",
29
30
  "glimmer-cs-gladiator.gemspec",
30
31
  "images/glimmer-cs-gladiator-logo.png",
31
32
  "lib/glimmer-cs-gladiator.rb",
33
+ "lib/glimmer-cs-gladiator/launch.rb",
32
34
  "lib/models/glimmer/gladiator/command.rb",
33
35
  "lib/models/glimmer/gladiator/dir.rb",
34
36
  "lib/models/glimmer/gladiator/file.rb",
35
37
  "lib/views/glimmer/gladiator.rb",
36
38
  "lib/views/glimmer/gladiator/file_explorer_tree.rb",
37
39
  "lib/views/glimmer/gladiator/file_lookup_list.rb",
40
+ "lib/views/glimmer/gladiator/gladiator_menu_bar.rb",
41
+ "lib/views/glimmer/gladiator/progress_shell.rb",
38
42
  "lib/views/glimmer/gladiator/text_editor.rb"
39
43
  ]
40
44
  s.homepage = "http://github.com/AndyObtiva/glimmer-cs-gladiator".freeze
41
45
  s.licenses = ["MIT".freeze]
46
+ s.post_install_message = "\nTo make the gladiator command available system-wide (especially with RVM), make sure you run this command with jruby in path: gladiator-setup\n\n".freeze
42
47
  s.rubygems_version = "3.0.6".freeze
43
48
  s.summary = "Gladiator (Glimmer Editor) - Glimmer Custom Shell - Text Editor Built in Ruby".freeze
44
49
 
@@ -51,6 +56,7 @@ Gem::Specification.new do |s|
51
56
  s.add_runtime_dependency(%q<clipboard>.freeze, ["~> 1.3.5"])
52
57
  s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
53
58
  s.add_development_dependency(%q<jeweler>.freeze, ["= 2.3.9"])
59
+ s.add_development_dependency(%q<warbler>.freeze, ["= 2.0.5"])
54
60
  s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
55
61
  else
56
62
  s.add_dependency(%q<glimmer-dsl-swt>.freeze, [">= 4.18.0.2", "< 5.0.0.0"])
@@ -58,6 +64,7 @@ Gem::Specification.new do |s|
58
64
  s.add_dependency(%q<clipboard>.freeze, ["~> 1.3.5"])
59
65
  s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
60
66
  s.add_dependency(%q<jeweler>.freeze, ["= 2.3.9"])
67
+ s.add_dependency(%q<warbler>.freeze, ["= 2.0.5"])
61
68
  s.add_dependency(%q<simplecov>.freeze, [">= 0"])
62
69
  end
63
70
  else
@@ -66,6 +73,7 @@ Gem::Specification.new do |s|
66
73
  s.add_dependency(%q<clipboard>.freeze, ["~> 1.3.5"])
67
74
  s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
68
75
  s.add_dependency(%q<jeweler>.freeze, ["= 2.3.9"])
76
+ s.add_dependency(%q<warbler>.freeze, ["= 2.0.5"])
69
77
  s.add_dependency(%q<simplecov>.freeze, [">= 0"])
70
78
  end
71
79
  end
@@ -1,5 +1,6 @@
1
1
  $LOAD_PATH.unshift(File.expand_path('..', __FILE__))
2
2
 
3
+ require 'glimmer-dsl-swt'
3
4
  require 'filewatcher'
4
5
  require 'clipboard'
5
6
  require 'puts_debuggerer'
@@ -0,0 +1,6 @@
1
+ require_relative '../glimmer-cs-gladiator'
2
+
3
+ include Glimmer
4
+
5
+ local_dir = ENV['LOCAL_DIR'] || '.'
6
+ gladiator(project_dir_path: local_dir).open
@@ -29,6 +29,8 @@ require 'models/glimmer/gladiator/command'
29
29
  require 'views/glimmer/gladiator/text_editor'
30
30
  require 'views/glimmer/gladiator/file_lookup_list'
31
31
  require 'views/glimmer/gladiator/file_explorer_tree'
32
+ require 'views/glimmer/gladiator/gladiator_menu_bar'
33
+ require 'views/glimmer/gladiator/progress_shell'
32
34
 
33
35
  Clipboard.implementation = Clipboard::Java
34
36
  Clipboard.copy(Clipboard.paste) # pre-initialize library to avoid slowdown during use
@@ -80,7 +82,7 @@ module Glimmer
80
82
  pane_count && pane_count > 1
81
83
  end
82
84
 
83
- attr_reader :find_text, :filter_text, :line_number_text, :split_orientation
85
+ attr_reader :find_text, :filter_text, :line_number_text, :split_orientation, :tab_folder_sash_form, :side_bar_sash_form, :file_area_and_editor_area_sash_form
84
86
  attr_accessor :current_tab_item, :current_tab_folder, :current_text_editor, :tab_folder1, :tab_folder2, :maximized_pane, :maximized_editor
85
87
  alias maximized_pane? maximized_pane
86
88
  alias maximized_editor? maximized_editor
@@ -95,6 +97,7 @@ module Glimmer
95
97
  project_dir.selected_child&.write_raw_dirty_content
96
98
  end
97
99
  Display.setAppName('Gladiator')
100
+ Display.setAppVersion(VERSION)
98
101
  # make sure the display events are only hooked once if multiple gladiators are created
99
102
  unless defined?(@@display)
100
103
  @@display = display {
@@ -228,538 +231,441 @@ module Glimmer
228
231
  ## Top-most widget must be a shell or another custom shell
229
232
  #
230
233
  body {
231
- shell {
232
- text "Gladiator - #{::File.expand_path(project_dir.path)}"
233
- minimum_size 520, 250
234
- size 1440, 900
235
- image ICON
236
-
237
- on_swt_show {
238
- swt_widget.setSize(@config[:shell_width], @config[:shell_height]) if @config[:shell_width] && @config[:shell_height]
239
- swt_widget.setLocation(@config[:shell_x], @config[:shell_y]) if @config[:shell_x] && @config[:shell_y]
240
- @loaded_config = true
234
+ if !::Dir.glob(::File.join(project_dir_path, 'glimmer-cs-gladiator.jar')).empty?
235
+ shell(:no_trim, :no_background) {
236
+ gladiator_menu_bar(gladiator: self, editing: false)
237
+
238
+ on_swt_show {
239
+ open_project
240
+ }
241
241
  }
242
-
243
- on_shell_closed {
244
- save_config
245
- project_dir.selected_child&.write_dirty_content
246
- if @tab_folder2
247
- current_tab_folder.swt_widget.getItems.each do |tab_item|
248
- tab_item.getData('proxy')&.dispose
242
+ else
243
+ shell {
244
+ text "Gladiator - #{::File.expand_path(project_dir.path)}"
245
+ minimum_size 590, 250
246
+ image ICON
247
+
248
+ on_swt_show {
249
+ unless @shell_visible
250
+ if @config[:shell_width] && @config[:shell_height]
251
+ swt_widget.set_size(@config[:shell_width], @config[:shell_height])
252
+ else
253
+ swt_widget.set_size(display.bounds.width, display.bounds.height)
254
+ end
249
255
  end
250
- close_tab_folder
251
- end
252
- current_tab_folder.swt_widget.getItems.each do |tab_item|
253
- tab_item.getData('proxy')&.dispose
254
- end
255
- body_root.close unless current_tab_folder.swt_widget.getItems.empty?
256
- }
257
- on_widget_disposed {
258
- project_dir.selected_child&.write_dirty_content
259
- }
260
- on_control_resized {
261
- save_config
262
- }
263
- on_control_moved {
264
- save_config
265
- }
266
- on_shell_deactivated {
267
- project_dir.selected_child&.write_dirty_content
268
- }
269
-
270
- if OS.mac?
271
- display.swt_display.system_menu.items.find {|mi| mi.id == swt(:id_quit)}.add_selection_listener {
256
+ swt_widget.setLocation(@config[:shell_x], @config[:shell_y]) if @config[:shell_x] && @config[:shell_y]
257
+ @loaded_config = true
258
+ @shell_visible = true
259
+ }
260
+
261
+ on_shell_closed {
272
262
  save_config
273
263
  project_dir.selected_child&.write_dirty_content
274
- display.swt_display.shells.each(&:close)
264
+ if @tab_folder2
265
+ current_tab_folder.swt_widget.getItems.each do |tab_item|
266
+ tab_item.getData('proxy')&.dispose
267
+ end
268
+ close_tab_folder
269
+ end
270
+ current_tab_folder.swt_widget.getItems.each do |tab_item|
271
+ tab_item.getData('proxy')&.dispose
272
+ end
273
+ body_root.close unless current_tab_folder.swt_widget.getItems.empty?
275
274
  }
276
- end
277
-
278
- menu_bar {
279
- menu {
280
- text '&File'
281
-
282
- menu_item {
283
- text 'New &Scratchpad'
284
- accelerator COMMAND_KEY, :shift, :s
285
- on_widget_selected {
286
- project_dir.selected_child_path = ''
287
- }
288
- }
289
- menu_item {
290
- text 'Open &Project...'
291
- accelerator COMMAND_KEY, :o
292
- on_widget_selected {
293
- open_project
294
- }
295
- }
296
- menu_item(:separator)
297
- menu_item {
298
- text '&Quit Project'
299
- accelerator COMMAND_KEY, :alt, :q
300
- on_widget_selected {
301
- save_config
302
- project_dir.selected_child&.write_dirty_content
303
- body_root.close
304
- }
305
- }
275
+ on_widget_disposed {
276
+ project_dir.selected_child&.write_dirty_content
306
277
  }
307
- menu {
308
- text '&View'
309
- menu {
310
- text '&Split Pane'
311
- menu { |menu_proxy|
312
- text '&Orientation'
313
- menu_item(:radio) {
314
- text '&Horizontal'
315
- selection bind(self, :split_orientation,
316
- on_read: ->(o) { split_pane? && o == swt(:horizontal) },
317
- on_write: ->(b) { b.nil? ? nil : (b ? swt(:horizontal) : swt(:vertical)) })
318
- }
319
- menu_item(:radio) {
320
- text '&Vertical'
321
- selection bind(self, :split_orientation,
322
- on_read: ->(o) { split_pane? && o == swt(:vertical) },
323
- on_write: ->(b) { b.nil? ? nil : (b ? swt(:vertical) : swt(:horizontal)) })
324
- }
325
- }
326
- menu_item(:check) {
327
- text '&Maximize Pane'
328
- enabled bind(self, :tab_folder2)
329
- accelerator COMMAND_KEY, :shift, :m
330
- selection bind(self, :maximized_pane)
331
- }
332
- menu_item {
333
- text 'Reset &Panes'
334
- enabled bind(self, :tab_folder2)
335
- accelerator COMMAND_KEY, :shift, :p
336
- on_widget_selected {
337
- if tab_folder2
338
- self.maximized_pane = false
339
- @tab_folder_sash_form.weights = [1, 1]
340
- end
341
- }
342
- }
343
- menu_item {
344
- text '&Unsplit'
345
- enabled bind(self, :tab_folder2)
346
- accelerator COMMAND_KEY, :shift, :u
347
- on_widget_selected {
348
- if tab_folder2
349
- self.maximized_pane = false
350
- navigate_to_next_tab_folder if current_tab_folder != tab_folder2
351
- close_all_tabs(tab_folder2)
352
- self.split_orientation = nil
353
- body_root.pack_same_size
354
- end
355
- }
356
- }
357
- }
358
- menu_item(:check) {
359
- text '&Maximize Editor'
360
- accelerator COMMAND_KEY, :ctrl, :m
361
- selection bind(self, :maximized_editor)
362
- }
363
- menu_item {
364
- text '&Reset All'
365
- accelerator COMMAND_KEY, :ctrl, :r
366
- on_widget_selected {
367
- self.maximized_editor = false
368
- @file_area_and_editor_area_sash_form.weights = [1, 5]
369
- @side_bar_sash_form.weights = [1, 1]
370
- }
371
- }
278
+ on_control_resized {
279
+ save_config
372
280
  }
373
- menu {
374
- text '&Run'
375
- # menu_item {
376
- # text 'Launch Glimmer &App'
377
- # on_widget_selected {
378
- # parent_path = project_dir.path
379
- ## current_directory_name = ::File.basename(parent_path)
380
- ## assumed_shell_script = ::File.join(parent_path, 'bin', current_directory_name)
381
- ## assumed_shell_script = ::Dir.glob(::File.join(parent_path, 'bin', '*')).detect {|f| ::File.file?(f) && !::File.read(f).include?('#!/usr/bin/env')} if !::File.exist?(assumed_shell_script)
382
- ## load assumed_shell_script
383
- # FileUtils.cd(parent_path) do
384
- # system 'glimmer run'
385
- # end
386
- # }
387
- # }
388
- menu_item {
389
- text '&Ruby'
390
- accelerator COMMAND_KEY, :shift, :r
391
- on_widget_selected {
392
- begin
393
- project_dir.selected_child.run
394
- rescue Exception => e
395
- dialog {
396
- text 'Run - Ruby - Error Encountered!'
397
- label {
398
- text e.full_message
399
- }
400
- }.open
401
- end
402
- }
403
- }
281
+ on_control_moved {
282
+ save_config
404
283
  }
405
- menu {
406
- text '&Help'
407
- menu_item {
408
- text '&About'
409
- accelerator COMMAND_KEY, :shift, :a
410
- on_widget_selected {
411
- display_about_dialog
412
- }
413
- }
284
+ on_shell_deactivated {
285
+ project_dir.selected_child&.write_dirty_content
414
286
  }
415
- }
416
-
417
- @file_area_and_editor_area_sash_form = sash_form(:horizontal) {
418
- weights 1, 5
419
-
420
- composite {
421
- grid_layout(1, false) {
422
- margin_width 0
423
- margin_height 0
287
+
288
+ if OS.mac?
289
+ display.swt_display.system_menu.items.find {|mi| mi.id == swt(:id_quit)}.add_selection_listener {
290
+ save_config
291
+ project_dir.selected_child&.write_dirty_content
292
+ display.swt_display.shells.each(&:close)
424
293
  }
425
-
426
- @side_bar_sash_form = sash_form(:vertical) {
427
- layout_data(:fill, :fill, true, true)
428
- sash_width 4
429
-
430
- resize_expand_items = lambda { |event=nil|
431
- @file_lookup_expand_item&.swt_expand_item&.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
432
- @file_explorer_expand_item&.swt_expand_item&.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
294
+ end
295
+
296
+ # Menu Bar
297
+ gladiator_menu_bar(gladiator: self, editing: true)
298
+
299
+ @file_area_and_editor_area_sash_form = sash_form(:horizontal) {
300
+ weights 1, 5
301
+
302
+ composite {
303
+ grid_layout(1, false) {
304
+ margin_width 0
305
+ margin_height 0
433
306
  }
434
307
 
435
- @file_lookup_expand_bar = expand_bar {
436
- layout_data :fill, :fill, true, true
437
- font height: 17, style: :bold
438
- foreground @default_foreground
308
+ @side_bar_sash_form = sash_form(:vertical) {
309
+ layout_data(:fill, :fill, true, true)
310
+ sash_width 4
439
311
 
440
- on_swt_show {
441
- @file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
312
+ resize_expand_items = lambda { |event=nil|
313
+ @file_lookup_expand_item&.swt_expand_item&.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
314
+ @file_explorer_expand_item&.swt_expand_item&.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
442
315
  }
443
316
 
444
- on_swt_Resize(&resize_expand_items)
445
-
446
- @file_lookup_expand_item = expand_item {
447
- grid_layout {
448
- margin_width 0
449
- margin_height 0
317
+ @file_lookup_expand_bar = expand_bar {
318
+ layout_data :fill, :fill, true, true
319
+ font height: 17, style: :bold
320
+ foreground @default_foreground
321
+
322
+ on_swt_show {
323
+ @file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
450
324
  }
451
- text 'File Lookup'
452
- height display.bounds.height
453
325
 
454
- @filter_text = text {
455
- layout_data :fill, :center, true, false
456
- text bind(project_dir, 'filter')
457
- on_key_pressed { |key_event|
458
- if key_event.keyCode == swt(:tab) ||
459
- key_event.keyCode == swt(:cr) ||
460
- key_event.keyCode == swt(:arrow_up) ||
461
- key_event.keyCode == swt(:arrow_down)
462
- @file_lookup_list.swt_widget.select(0) if @file_lookup_list.swt_widget.getSelectionIndex() == -1
463
- @file_lookup_list.swt_widget.setFocus
464
- end
326
+ on_swt_Resize(&resize_expand_items)
327
+
328
+ @file_lookup_expand_item = expand_item {
329
+ grid_layout {
330
+ margin_width 0
331
+ margin_height 0
332
+ }
333
+ text 'File Lookup'
334
+ height display.bounds.height
335
+
336
+ @filter_text = text {
337
+ layout_data :fill, :center, true, false
338
+ text bind(project_dir, 'filter')
339
+ on_key_pressed { |key_event|
340
+ if key_event.keyCode == swt(:tab) ||
341
+ key_event.keyCode == swt(:cr) ||
342
+ key_event.keyCode == swt(:arrow_up) ||
343
+ key_event.keyCode == swt(:arrow_down)
344
+ @file_lookup_list.swt_widget.select(0) if @file_lookup_list.swt_widget.getSelectionIndex() == -1
345
+ @file_lookup_list.swt_widget.setFocus
346
+ end
347
+ }
348
+ }
349
+
350
+ @file_lookup_list = file_lookup_list(gladiator: self, foreground_color: @default_foreground) {
351
+ layout_data :fill, :fill, true, true
465
352
  }
466
353
  }
467
-
468
- @file_lookup_list = file_lookup_list(gladiator: self, foreground_color: @default_foreground) {
469
- layout_data :fill, :fill, true, true
354
+
355
+ on_item_collapsed { |event|
356
+ if @file_explorer_expand_item.swt_expand_item.get_expanded
357
+ @file_lookup_expand_item_height = @file_lookup_expand_item.swt_expand_item.height
358
+ @file_lookup_expand_item.swt_expand_item.height = 0
359
+ @file_lookup_expand_bar_height = @file_lookup_expand_bar.swt_widget.size.y
360
+ @file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
361
+ @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]
362
+ end
470
363
  }
471
- }
472
-
473
- on_item_collapsed { |event|
474
- if @file_explorer_expand_item.swt_expand_item.get_expanded
475
- @file_lookup_expand_item_height = @file_lookup_expand_item.swt_expand_item.height
476
- @file_lookup_expand_item.swt_expand_item.height = 0
477
- @file_lookup_expand_bar_height = @file_lookup_expand_bar.swt_widget.size.y
478
- @file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
479
- @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]
480
- end
481
- }
482
-
483
- on_item_expanded {
484
- @file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_item_height if @file_lookup_expand_item_height
485
- @side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
486
- }
487
364
 
488
- }
489
-
490
- @file_explorer_expand_bar = expand_bar {
491
- layout_data :fill, :fill, true, true
492
- font height: 17, style: :bold
493
- foreground @default_foreground
494
-
495
- on_swt_show {
496
- @file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
365
+ on_item_expanded {
366
+ @file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_item_height if @file_lookup_expand_item_height
367
+ @side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
368
+ }
369
+
497
370
  }
498
371
 
499
- on_swt_Resize(&resize_expand_items)
500
-
501
- @file_explorer_expand_item = expand_item {
502
- grid_layout {
503
- margin_width 0
504
- margin_height 0
372
+ @file_explorer_expand_bar = expand_bar {
373
+ layout_data :fill, :fill, true, true
374
+ font height: 17, style: :bold
375
+ foreground @default_foreground
376
+
377
+ on_swt_show {
378
+ @file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
379
+ }
380
+
381
+ on_swt_Resize(&resize_expand_items)
382
+
383
+ @file_explorer_expand_item = expand_item {
384
+ grid_layout {
385
+ margin_width 0
386
+ margin_height 0
387
+ }
388
+ text 'File Explorer'
389
+ height display.bounds.height
390
+
391
+ @file_explorer_tree = file_explorer_tree(gladiator: self, foreground_color: @default_foreground) {
392
+ layout_data :fill, :fill, true, true
393
+ }
505
394
  }
506
- text 'File Explorer'
507
- height display.bounds.height
508
395
 
509
- @file_explorer_tree = file_explorer_tree(gladiator: self, foreground_color: @default_foreground) {
510
- layout_data :fill, :fill, true, true
396
+ on_item_collapsed { |event|
397
+ if @file_lookup_expand_item.swt_expand_item.get_expanded
398
+ @file_explorer_expand_item_height = @file_explorer_expand_item.swt_expand_item.height
399
+ @file_explorer_expand_item.swt_expand_item.height = 0
400
+ @file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
401
+ @file_lookup_expand_bar_height = @file_lookup_expand_bar.swt_widget.size.y
402
+ @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]
403
+ end
511
404
  }
512
- }
513
405
 
514
- on_item_collapsed { |event|
515
- if @file_lookup_expand_item.swt_expand_item.get_expanded
516
- @file_explorer_expand_item_height = @file_explorer_expand_item.swt_expand_item.height
517
- @file_explorer_expand_item.swt_expand_item.height = 0
518
- @file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
519
- @file_lookup_expand_bar_height = @file_lookup_expand_bar.swt_widget.size.y
520
- @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]
521
- end
522
- }
523
-
524
- on_item_expanded {
525
- @file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_item_height if @file_explorer_expand_item_height
526
- @side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
406
+ on_item_expanded {
407
+ @file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_item_height if @file_explorer_expand_item_height
408
+ @side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
409
+ }
410
+
527
411
  }
528
-
529
- }
530
-
531
- }
532
412
 
533
- }
534
-
535
- @editor_area_composite = composite {
536
- grid_layout(1, false) {
537
- margin_width 0
538
- margin_height 0
413
+ }
414
+
539
415
  }
540
416
 
541
- @navigation_expand_bar = expand_bar {
542
- layout_data :fill, :top, true, false
543
- font height: 17, style: :bold
544
- foreground @default_foreground
417
+ @editor_area_composite = composite {
418
+ grid_layout(1, false) {
419
+ margin_width 0
420
+ margin_height 0
421
+ }
545
422
 
546
- @navigation_expand_item = expand_item {
547
- text 'Navigation'
548
- height 115
549
-
550
- grid_layout(5, false) {
551
- margin_right 5
423
+ @navigation_expand_bar = expand_bar {
424
+ layout_data(:fill, :top, true, false) {
425
+ minimum_width 480
552
426
  }
427
+ font height: 17, style: :bold
428
+ foreground @default_foreground
553
429
 
554
- stat_font = {name: 'Consolas', height: OS.mac? ? 15 : 12}
430
+ @navigation_expand_item = expand_item {
431
+ text 'Navigation'
432
+ height 115
555
433
 
556
- # row 1
557
-
558
- label {
559
- layout_data(:left, :center, false, false)
560
- text 'File:'
561
- foreground @default_foreground
562
- }
563
-
564
- @file_path_label = styled_text(:none) {
565
- layout_data(:fill, :center, true, false) {
566
- horizontal_span 2
434
+ grid_layout(5, false) {
435
+ margin_right 5
567
436
  }
568
- background color(:widget_background)
569
- foreground @default_foreground
570
- editable false
571
- caret nil
572
- text bind(project_dir, 'selected_child.path')
573
- on_mouse_up {
574
- @file_path_label.swt_widget.selectAll
437
+
438
+ stat_font = {name: 'Consolas', height: OS.mac? ? 15 : 12}
439
+
440
+ # row 1
441
+
442
+ label {
443
+ layout_data(:left, :center, false, false)
444
+ text 'File:'
445
+ foreground @default_foreground
575
446
  }
576
- on_focus_lost {
577
- @file_path_label.swt_widget.setSelection(0, 0)
447
+
448
+ @file_path_label = styled_text(:none) {
449
+ layout_data(:fill, :center, true, false) {
450
+ horizontal_span 2
451
+ }
452
+ background color(:widget_background)
453
+ foreground @default_foreground
454
+ editable false
455
+ caret nil
456
+ text bind(project_dir, 'selected_child.path')
457
+ on_mouse_up {
458
+ @file_path_label.swt_widget.selectAll
459
+ }
460
+ on_focus_lost {
461
+ @file_path_label.swt_widget.setSelection(0, 0)
462
+ }
578
463
  }
579
- }
580
-
581
- label {
582
- layout_data(:left, :center, false, false)
583
- text 'Caret Position:'
584
- foreground @default_foreground
585
- }
586
- label(:right) {
587
- layout_data(:fill, :center, true, false)
588
- text bind(project_dir, 'selected_child.caret_position')
589
- foreground @default_foreground
590
- font stat_font
591
- }
592
-
593
- # row 2
594
-
595
- label {
596
- layout_data(:left, :center, false, false)
597
- text 'Line:'
598
- foreground @default_foreground
599
- }
600
- @line_number_text = text {
601
- layout_data(:fill, :center, true, false) {
602
- minimum_width 400
464
+
465
+ label {
466
+ layout_data(:left, :center, false, false) {
467
+ minimum_width 100
468
+ }
469
+ text 'Caret Position:'
470
+ foreground @default_foreground
603
471
  }
604
- text bind(project_dir, 'selected_child.line_number', on_read: :to_s, on_write: :to_i)
605
- foreground @default_foreground
606
- font stat_font
607
- on_key_pressed { |key_event|
608
- if key_event.keyCode == swt(:cr)
609
- @current_text_editor&.text_widget&.setFocus
610
- end
472
+ label(:right) {
473
+ layout_data(:fill, :center, true, false) {
474
+ minimum_width 50
475
+ }
476
+ text bind(project_dir, 'selected_child.caret_position')
477
+ foreground @default_foreground
478
+ font stat_font
611
479
  }
612
- on_verify_text { |event|
613
- event.doit = !event.text.match(/^\d*$/).to_a.empty?
480
+
481
+ # row 2
482
+
483
+ label {
484
+ layout_data(:left, :center, false, false)
485
+ text 'Line:'
486
+ foreground @default_foreground
614
487
  }
615
- }
616
- label # filler
617
-
618
- label {
619
- layout_data(:left, :center, false, false)
620
- text 'Line Position:'
621
- foreground @default_foreground
622
- }
623
- label(:right) {
624
- layout_data(:fill, :center, true, false)
625
- text bind(project_dir, 'selected_child.line_position')
626
- foreground @default_foreground
627
- font stat_font
628
- }
629
-
630
- # row 3
631
-
632
- label {
633
- layout_data(:left, :center, false, false)
634
- text 'Find:'
635
- foreground @default_foreground
636
- }
637
- @find_text = text {
638
- layout_data(:fill, :center, true, false) {
639
- minimum_width 400
488
+ @line_number_text = text {
489
+ layout_data(:fill, :center, true, false) {
490
+ width_hint 400
491
+ minimum_width 100
492
+ }
493
+ text bind(project_dir, 'selected_child.line_number', on_read: :to_s, on_write: :to_i)
494
+ foreground @default_foreground
495
+ font stat_font
496
+ on_key_pressed { |key_event|
497
+ if key_event.keyCode == swt(:cr)
498
+ @current_text_editor&.text_widget&.setFocus
499
+ end
500
+ }
501
+ on_verify_text { |event|
502
+ event.doit = !event.text.match(/^\d*$/).to_a.empty?
503
+ }
640
504
  }
641
- text bind(project_dir, 'selected_child.find_text')
642
- foreground @default_foreground
643
- font stat_font
644
- on_key_pressed { |key_event|
645
- if key_event.stateMask == swt(COMMAND_KEY) && key_event.keyCode == swt(:cr)
646
- project_dir.selected_child.case_sensitive = !project_dir.selected_child.case_sensitive
647
- project_dir.selected_child&.find_next
648
- end
649
- if key_event.keyCode == swt(:cr)
650
- project_dir.selected_child&.find_next
651
- end
505
+ label # filler
506
+
507
+ label {
508
+ layout_data(:left, :center, false, false) {
509
+ minimum_width 100
510
+ }
511
+ text 'Line Position:'
512
+ foreground @default_foreground
652
513
  }
653
- }
654
- composite {
655
- layout_data(:left, :center, true, false)
656
- row_layout {
657
- margin_width 0
658
- margin_height 0
514
+ label(:right) {
515
+ layout_data(:fill, :center, true, false) {
516
+ minimum_width 50
517
+ }
518
+ text bind(project_dir, 'selected_child.line_position')
519
+ foreground @default_foreground
520
+ font stat_font
521
+ }
522
+
523
+ # row 3
524
+
525
+ label {
526
+ layout_data(:left, :center, false, false)
527
+ text 'Find:'
528
+ foreground @default_foreground
659
529
  }
660
- button(:check) {
661
- selection bind(project_dir, 'selected_child.case_sensitive')
530
+ @find_text = text {
531
+ layout_data(:fill, :center, true, false) {
532
+ width_hint 400
533
+ minimum_width 100
534
+ }
535
+ text bind(project_dir, 'selected_child.find_text')
536
+ foreground @default_foreground
537
+ font stat_font
662
538
  on_key_pressed { |key_event|
539
+ if key_event.stateMask == swt(COMMAND_KEY) && key_event.keyCode == swt(:cr)
540
+ project_dir.selected_child.case_sensitive = !project_dir.selected_child.case_sensitive
541
+ project_dir.selected_child&.find_next
542
+ end
663
543
  if key_event.keyCode == swt(:cr)
664
544
  project_dir.selected_child&.find_next
665
545
  end
666
546
  }
667
547
  }
548
+ composite {
549
+ layout_data(:left, :center, true, false) {
550
+ minimum_width 120
551
+ }
552
+ row_layout {
553
+ margin_width 0
554
+ margin_height 0
555
+ }
556
+ button(:check) {
557
+ selection bind(project_dir, 'selected_child.case_sensitive')
558
+ on_key_pressed { |key_event|
559
+ if key_event.keyCode == swt(:cr)
560
+ project_dir.selected_child&.find_next
561
+ end
562
+ }
563
+ }
564
+ label {
565
+ text 'Case-sensitive'
566
+ foreground @default_foreground
567
+ }
568
+ }
569
+
668
570
  label {
669
- text 'Case-sensitive'
571
+ layout_data(:left, :center, false, false) {
572
+ minimum_width 100
573
+ }
574
+ text 'Selection Count:'
670
575
  foreground @default_foreground
671
576
  }
672
- }
673
-
674
- label {
675
- layout_data(:left, :center, false, false)
676
- text 'Selection Count:'
677
- foreground @default_foreground
678
- }
679
- label(:right) {
680
- layout_data(:fill, :center, true, false)
681
- text bind(project_dir, 'selected_child.selection_count')
682
- foreground @default_foreground
683
- font stat_font
684
- }
685
-
686
- # row 4
687
-
688
- label {
689
- layout_data(:left, :center, false, false)
690
- text 'Replace:'
691
- foreground @default_foreground
692
- }
693
- @replace_text = text {
694
- layout_data(:fill, :center, true, false) {
695
- minimum_width 400
577
+ label(:right) {
578
+ layout_data(:fill, :center, true, false) {
579
+ minimum_width 50
580
+ }
581
+ text bind(project_dir, 'selected_child.selection_count')
582
+ foreground @default_foreground
583
+ font stat_font
696
584
  }
697
- text bind(project_dir, 'selected_child.replace_text')
698
- foreground @default_foreground
699
- font stat_font
700
- on_focus_gained {
701
- project_dir.selected_child&.ensure_find_next
585
+
586
+ # row 4
587
+
588
+ label {
589
+ layout_data(:left, :center, false, false)
590
+ text 'Replace:'
591
+ foreground @default_foreground
702
592
  }
703
- on_key_pressed { |key_event|
704
- if key_event.keyCode == swt(:cr)
705
- if project_dir.selected_child
706
- Command.do(project_dir.selected_child, :replace_next!)
593
+ @replace_text = text {
594
+ layout_data(:fill, :center, true, false) {
595
+ width_hint 400
596
+ minimum_width 100
597
+ }
598
+ text bind(project_dir, 'selected_child.replace_text')
599
+ foreground @default_foreground
600
+ font stat_font
601
+ on_focus_gained {
602
+ project_dir.selected_child&.ensure_find_next
603
+ }
604
+ on_key_pressed { |key_event|
605
+ if key_event.keyCode == swt(:cr)
606
+ if project_dir.selected_child
607
+ Command.do(project_dir.selected_child, :replace_next!)
608
+ end
707
609
  end
708
- end
610
+ }
611
+ }
612
+ label # filler
613
+ label {
614
+ layout_data(:left, :center, false, false) {
615
+ minimum_width 100
616
+ }
617
+ text 'Top Pixel:'
618
+ foreground @default_foreground
619
+ }
620
+ label(:right) {
621
+ layout_data(:fill, :center, true, false) {
622
+ minimum_width 50
623
+ }
624
+ text bind(project_dir, 'selected_child.top_pixel')
625
+ foreground @default_foreground
626
+ font stat_font
709
627
  }
710
628
  }
711
- label # filler
712
- label {
713
- layout_data(:left, :center, false, false)
714
- text 'Top Pixel:'
715
- foreground @default_foreground
629
+
630
+ on_item_collapsed {
631
+ collapse_navigation_expand_bar_height
716
632
  }
717
- label(:right) {
718
- layout_data(:fill, :center, true, false)
719
- text bind(project_dir, 'selected_child.top_pixel')
720
- foreground @default_foreground
721
- font stat_font
633
+
634
+ on_item_expanded {
635
+ expand_navigation_expand_bar_height
722
636
  }
723
- }
724
637
 
725
- on_item_collapsed {
726
- collapse_navigation_expand_bar_height
727
- }
728
-
729
- on_item_expanded {
730
- expand_navigation_expand_bar_height
731
- }
732
-
733
- }
734
-
735
- @tab_folder_sash_form = sash_form {
736
- layout_data(:fill, :fill, true, true) {
737
- width_hint 768
738
- height_hint 576
739
- minimum_width 768
740
- minimum_height 576
741
638
  }
742
- orientation bind(self, :split_orientation) {|value| async_exec { body_root.pack_same_size}; value}
743
- self.current_tab_folder = self.tab_folder1 = tab_folder {
744
- drag_source(DND::DROP_COPY) {
745
- transfer [TextTransfer.getInstance].to_java(Transfer)
746
- event_data = nil
747
- on_drag_start {|event|
748
- Gladiator.drag = true
749
- tab_folder = event.widget.getControl
750
- tab_item = tab_folder.getItem(Point.new(event.x, event.y))
751
- event_data = tab_item.getData('file_path')
752
- }
753
- on_drag_set_data { |event|
754
- event.data = event_data
639
+
640
+ @tab_folder_sash_form = sash_form {
641
+ layout_data(:fill, :fill, true, true) {
642
+ width_hint 768
643
+ height_hint 576
644
+ minimum_width 168
645
+ minimum_height 176
646
+ }
647
+ orientation bind(self, :split_orientation) {|value| async_exec { body_root.pack_same_size}; value}
648
+ self.current_tab_folder = self.tab_folder1 = tab_folder {
649
+ drag_source(DND::DROP_COPY) {
650
+ transfer [TextTransfer.getInstance].to_java(Transfer)
651
+ event_data = nil
652
+ on_drag_start {|event|
653
+ Gladiator.drag = true
654
+ tab_folder = event.widget.getControl
655
+ tab_item = tab_folder.getItem(Point.new(event.x, event.y))
656
+ event_data = tab_item.getData('file_path')
657
+ }
658
+ on_drag_set_data { |event|
659
+ event.data = event_data
660
+ }
755
661
  }
756
662
  }
663
+ @current_tab_folder.swt_widget.setData('proxy', @current_tab_folder)
757
664
  }
758
- @current_tab_folder.swt_widget.setData('proxy', @current_tab_folder)
759
665
  }
760
- }
761
- } # end of sash form
762
- }
666
+ } # end of sash form
667
+ }
668
+ end
763
669
  }
764
670
 
765
671
  def load_config_ignore_paths
@@ -785,22 +691,10 @@ module Glimmer
785
691
  open_file_paths1 = @config[:open_file_paths1] || @config[:open_file_paths]
786
692
  open_file_paths2 = @config[:open_file_paths2]
787
693
  self.split_orientation = (swt(@config[:split_orientation]) rescue swt(:horizontal)) if @config[:split_orientation]
788
- if @progress_bar_shell.nil?
789
- @progress_bar_shell = shell(body_root, :title) {
790
- text 'Gladiator'
791
- fill_layout(:vertical) {
792
- margin_width 15
793
- margin_height 15
794
- spacing 5
795
- }
796
- label(:center) {
797
- text "Opening Last Open Files"
798
- font height: 20
799
- }
800
- # @progress_bar = progress_bar(:horizontal, :indeterminate)
801
- }
694
+ if @progress_shell.nil?
695
+ @progress_shell = progress_shell(gladiator: self, progress_text: 'Opening Last Open Files')
802
696
  async_exec {
803
- @progress_bar_shell.open
697
+ @progress_shell.open
804
698
  }
805
699
  end
806
700
  open_file_paths1.to_a.each do |file_path|
@@ -842,8 +736,8 @@ module Glimmer
842
736
  }
843
737
  async_exec {
844
738
  Gladiator.drag = false
845
- @progress_bar_shell&.close
846
- @progress_bar_shell = nil
739
+ @progress_shell&.close
740
+ @progress_shell = nil
847
741
  @loaded_config = true
848
742
  }
849
743
  }
@@ -861,7 +755,7 @@ module Glimmer
861
755
  end
862
756
 
863
757
  def save_config
864
- return if !@loaded_config || body_root.disposed?
758
+ return if !@loaded_config || body_root&.disposed?
865
759
  child = project_dir.selected_child
866
760
  return if child.nil?
867
761
  tab_folder1 = @tab_folder1 || @current_tab_folder
@@ -988,27 +882,15 @@ module Glimmer
988
882
  def open_project
989
883
  selected_directory = directory_dialog.open
990
884
  return if selected_directory.nil?
991
- @progress_bar_shell = shell(body_root, :title) {
992
- text 'Gladiator'
993
- fill_layout(:vertical) {
994
- margin_width 15
995
- margin_height 15
996
- spacing 5
997
- }
998
- label(:center) {
999
- text "Opening Project: #{::File.basename(selected_directory)}"
1000
- font height: 20
1001
- }
1002
- # @progress_bar = progress_bar(:horizontal, :indeterminate)
1003
- }
885
+ @progress_shell = progress_shell(gladiator: self, progress_text: "Opening Project: #{::File.basename(selected_directory)}")
1004
886
  async_exec {
1005
- @progress_bar_shell.open
887
+ @progress_shell.open
1006
888
  }
1007
889
  async_exec {
1008
890
  gladiator(project_dir_path: selected_directory) {
1009
891
  on_swt_show {
1010
- @progress_bar_shell.close
1011
- @progress_bar_shell = nil
892
+ @progress_shell.close
893
+ @progress_shell = nil
1012
894
  }
1013
895
  }.open if selected_directory
1014
896
  }
@@ -1033,7 +915,7 @@ module Glimmer
1033
915
  label {
1034
916
  layout_data :fill, :fill, true, true
1035
917
  background :white
1036
- text "Gladiator v#{VERSION}\n\n#{LICENSE}\n\nGladiator icon made by Freepik from www.flaticon.com"
918
+ text "Gladiator v#{VERSION} (Beta)\n\n#{LICENSE}\n\nGladiator icon made by Freepik from www.flaticon.com"
1037
919
  }
1038
920
  }.open
1039
921
  end