glimmer-cs-gladiator 0.7.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,31 @@
1
+ module Glimmer
2
+ class Gladiator
3
+ class ProgressShell
4
+ include Glimmer::UI::CustomShell
5
+
6
+ option :gladiator
7
+ option :progress_text, default: 'Work In Progress'
8
+
9
+ body {
10
+ shell(gladiator.body_root, :title) {
11
+ fill_layout(:vertical) {
12
+ margin_width 15
13
+ margin_height 15
14
+ spacing 5
15
+ }
16
+
17
+ text 'Gladiator'
18
+
19
+ gladiator_menu_bar(gladiator: gladiator, editing: true)
20
+
21
+ label(:center) {
22
+ text progress_text
23
+ font height: 20
24
+ }
25
+ # @progress_bar = progress_bar(:horizontal, :indeterminate)
26
+ }
27
+ }
28
+
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,24 @@
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
+
1
22
  module Glimmer
2
23
  class Gladiator
3
24
  class TextEditor
@@ -7,6 +28,10 @@ module Glimmer
7
28
 
8
29
  attr_reader :text_proxy
9
30
 
31
+ before_body {
32
+ @font_name = display.get_font_list(nil, true).map(&:name).include?('Consolas') ? 'Consolas' : 'Courier'
33
+ }
34
+
10
35
  after_body {
11
36
  load_content
12
37
  }
@@ -14,11 +39,11 @@ module Glimmer
14
39
  body {
15
40
  composite {
16
41
  grid_layout(2, false)
17
- layout_data :fill, :fill, true, true
42
+
18
43
  @line_numbers_text = styled_text(:multi, :border) {
19
44
  layout_data(:right, :fill, false, true)
20
45
  text ' '*4
21
- font name: 'Consolas', height: OS.mac? ? 15 : 12
46
+ font name: @font_name, height: OS.mac? ? 15 : 12
22
47
  background color(:widget_background)
23
48
  foreground :dark_blue
24
49
  top_margin 5
@@ -37,9 +62,9 @@ module Glimmer
37
62
  }
38
63
  }
39
64
 
40
- @text_proxy = send(text_widget_keyword) { |the_text|
65
+ @text_proxy = code_text(language: file.language) {
41
66
  layout_data :fill, :fill, true, true
42
- font name: 'Consolas', height: OS.mac? ? 15 : 12
67
+ font name: @font_name, height: OS.mac? ? 15 : 12
43
68
  foreground rgb(75, 75, 75)
44
69
  focus true
45
70
  top_margin 5
@@ -72,11 +97,6 @@ module Glimmer
72
97
  nil
73
98
  end
74
99
 
75
- def text_widget_keyword
76
- is_code_file = file.scratchpad? || file.path.end_with?('.rb')
77
- is_code_file ? 'code_text' : 'styled_text'
78
- end
79
-
80
100
  def text_widget
81
101
  @text_proxy.swt_widget
82
102
  end
@@ -102,6 +122,7 @@ module Glimmer
102
122
  selection_count bind(self, 'file.selection_count')
103
123
  caret_position bind(self, 'file.caret_position')
104
124
  top_pixel bind(self, 'file.top_pixel')
125
+ # key_binding swt(:ctrl, :home), ST::TEXT_START # This seems to make the caret disappear on Windows so disabling for now and relying on key event instead
105
126
  on_focus_lost {
106
127
  file&.write_dirty_content
107
128
  }
@@ -112,11 +133,17 @@ module Glimmer
112
133
  key_event.doit = !Command.undo(file)
113
134
  elsif key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == 'a'
114
135
  key_event.widget.selectAll
115
- elsif !OS.windows? && key_event.stateMask == swt(:ctrl) && extract_char(key_event) == 'a'
116
- Command.do(file, :start_of_line)
136
+ elsif (OS.mac? && key_event.keyCode == swt(:home)) || (!OS.mac? && Glimmer::SWT::SWTProxy.include?(key_event.stateMask, :ctrl) && key_event.keyCode == swt(:home))
137
+ file.home
117
138
  key_event.doit = false
118
- elsif !OS.windows? && key_event.stateMask == swt(:ctrl) && extract_char(key_event) == 'e'
119
- Command.do(file, :end_of_line)
139
+ elsif (OS.mac? && key_event.keyCode == swt(:home)) || (!OS.mac? && Glimmer::SWT::SWTProxy.include?(key_event.stateMask, :ctrl) && key_event.keyCode == swt(:end))
140
+ file.end
141
+ key_event.doit = false
142
+ elsif (OS.mac? && key_event.stateMask == swt(:ctrl) && extract_char(key_event) == 'a') || (!OS.mac? && key_event.keyCode == swt(:home))
143
+ file.start_of_line
144
+ key_event.doit = false
145
+ elsif (OS.mac? && key_event.stateMask == swt(:ctrl) && extract_char(key_event) == 'e') || (!OS.mac? && key_event.keyCode == swt(:end))
146
+ file.end_of_line
120
147
  key_event.doit = false
121
148
  elsif key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == '/'
122
149
  Command.do(file, :comment_line!)
@@ -145,12 +172,6 @@ module Glimmer
145
172
  elsif key_event.keyCode == swt(:page_down)
146
173
  file.page_down
147
174
  key_event.doit = false
148
- elsif key_event.keyCode == swt(:home)
149
- file.home
150
- key_event.doit = false
151
- elsif key_event.keyCode == swt(:end)
152
- file.end
153
- key_event.doit = false
154
175
  elsif key_event.stateMask == swt(COMMAND_KEY) && key_event.keyCode == swt(:arrow_up)
155
176
  Command.do(file, :move_up!)
156
177
  key_event.doit = false
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.7.0
4
+ version: 0.8.1
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-01-11 00:00:00.000000000 Z
11
+ date: 2021-02-07 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.18.0.0
18
+ version: 4.18.4.3
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.18.0.0
29
+ version: 4.18.4.3
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 5.0.0.0
@@ -86,6 +86,20 @@ dependencies:
86
86
  - - '='
87
87
  - !ruby/object:Gem::Version
88
88
  version: 2.3.9
89
+ - !ruby/object:Gem::Dependency
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - '='
93
+ - !ruby/object:Gem::Version
94
+ version: 2.0.5
95
+ name: warbler
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - '='
101
+ - !ruby/object:Gem::Version
102
+ version: 2.0.5
89
103
  - !ruby/object:Gem::Dependency
90
104
  requirement: !ruby/object:Gem::Requirement
91
105
  requirements:
@@ -108,9 +122,12 @@ description: Gladiator (short for Glimmer Editor) is a Glimmer sample project un
108
122
  use Glimmer one day.
109
123
  email: andy.am@gmail.com
110
124
  executables:
125
+ - glimmer-cs-gladiator
111
126
  - gladiator
127
+ - gladiator-setup
112
128
  extensions: []
113
129
  extra_rdoc_files:
130
+ - CHANGELOG.md
114
131
  - LICENSE.txt
115
132
  - README.md
116
133
  files:
@@ -119,20 +136,29 @@ files:
119
136
  - README.md
120
137
  - VERSION
121
138
  - bin/gladiator
122
- - bin/gladiator_runner.rb
139
+ - bin/gladiator-setup
140
+ - bin/glimmer-cs-gladiator
123
141
  - glimmer-cs-gladiator.gemspec
124
142
  - images/glimmer-cs-gladiator-logo.png
125
143
  - lib/glimmer-cs-gladiator.rb
144
+ - lib/glimmer-cs-gladiator/launch.rb
126
145
  - lib/models/glimmer/gladiator/command.rb
127
146
  - lib/models/glimmer/gladiator/dir.rb
128
147
  - lib/models/glimmer/gladiator/file.rb
129
148
  - lib/views/glimmer/gladiator.rb
149
+ - lib/views/glimmer/gladiator/file_explorer_tree.rb
150
+ - lib/views/glimmer/gladiator/file_lookup_list.rb
151
+ - lib/views/glimmer/gladiator/gladiator_menu_bar.rb
152
+ - lib/views/glimmer/gladiator/progress_shell.rb
130
153
  - lib/views/glimmer/gladiator/text_editor.rb
131
154
  homepage: http://github.com/AndyObtiva/glimmer-cs-gladiator
132
155
  licenses:
133
156
  - MIT
134
157
  metadata: {}
135
- post_install_message:
158
+ post_install_message: |2+
159
+
160
+ To make the gladiator command available system-wide (especially with RVM), make sure you run this command with jruby in path: gladiator-setup
161
+
136
162
  rdoc_options: []
137
163
  require_paths:
138
164
  - lib
@@ -1,6 +0,0 @@
1
- require_relative '../lib/glimmer-cs-gladiator'
2
-
3
- include Glimmer
4
-
5
- local_dir = ENV['LOCAL_DIR'] || '.'
6
- gladiator(project_dir_path: local_dir).open