glimmer-dsl-libui 0.5.7 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +159 -51
- data/VERSION +1 -1
- data/examples/basic_code_area.rb +31 -0
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/libui/control_proxy/area_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy.rb +1 -1
- data/lib/glimmer/libui/custom_control/code_area.rb +65 -0
- data/lib/glimmer/libui/custom_control.rb +6 -3
- data/lib/glimmer/libui/custom_window.rb +4 -0
- data/lib/glimmer/libui.rb +3 -5
- data/lib/glimmer-dsl-libui/ext/rouge/theme/glimmer.rb +29 -0
- metadata +26 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d99fb74f5b4aa47cf07f00cf6afb426a66cbac0947d1e854c859703b9158d635
|
4
|
+
data.tar.gz: 75a27219914e19011e47051b60312e11ac83980d98e18fcb387ea84bfbfb6dd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf483f831272a8d2443a1b932ab2e25043377d3c349a6dbd1810055ed87b6b8409b78e74e7e8d938dda8945108258dd692626dcc2f859d8309066c7e6c1ef058
|
7
|
+
data.tar.gz: 94d01b95cab06dbab277fdd1e2478b5f49c635e07c0702fb51e3726594de6a76a55d3d15185abeed8064ab12cec9bd16bbee5f1aa131ebae9c6e22d5401c4584
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.5.8
|
4
|
+
|
5
|
+
- Support `code_area` class-based custom control as a code-syntax-highlighted `area` control using the `rouge` gem
|
6
|
+
- `examples/basic_code_area.rb`
|
7
|
+
- Handle hex colors that have a 3-digit shorthand
|
8
|
+
- Stop annoying false negative logs when using `Glimmer::LibUI::CustomWindow`
|
9
|
+
|
3
10
|
## 0.5.7
|
4
11
|
|
5
12
|
- Support Custom Window keywords (aka Applications) using `Glimmer::LibUI::CustomWindow` or alias of `Glimmer::LibUI::Application`
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.5.
|
1
|
+
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.5.8
|
2
2
|
## Prerequisite-Free Ruby Desktop Development GUI Library
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-libui.svg)](http://badge.fury.io/rb/glimmer-dsl-libui)
|
4
4
|
[![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
@@ -405,6 +405,7 @@ DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
|
|
405
405
|
- [Basic Image](#basic-image)
|
406
406
|
- [Basic Transform](#basic-transform)
|
407
407
|
- [Basic Draw Text](#basic-draw-text)
|
408
|
+
- [Basic Code Area](#basic-code-area)
|
408
409
|
- [Advanced Examples](#advanced-examples)
|
409
410
|
- [Area Gallery](#area-gallery)
|
410
411
|
- [Button Counter](#button-counter)
|
@@ -577,7 +578,7 @@ gem install glimmer-dsl-libui
|
|
577
578
|
Or install via Bundler `Gemfile`:
|
578
579
|
|
579
580
|
```ruby
|
580
|
-
gem 'glimmer-dsl-libui', '~> 0.5.
|
581
|
+
gem 'glimmer-dsl-libui', '~> 0.5.8'
|
581
582
|
```
|
582
583
|
|
583
584
|
Test that installation worked by running the [Meta-Example](#examples):
|
@@ -590,14 +591,40 @@ Mac | Windows | Linux
|
|
590
591
|
----|---------|------
|
591
592
|
![glimmer-dsl-libui-mac-meta-example.png](images/glimmer-dsl-libui-mac-meta-example.png) | ![glimmer-dsl-libui-windows-meta-example.png](images/glimmer-dsl-libui-windows-meta-example.png) | ![glimmer-dsl-libui-linux-meta-example.png](images/glimmer-dsl-libui-linux-meta-example.png)
|
592
593
|
|
593
|
-
Now to use [glimmer-dsl-libui](https://rubygems.org/gems/glimmer-dsl-libui), add `require 'glimmer-dsl-libui'` at the top
|
594
|
+
Now to use [glimmer-dsl-libui](https://rubygems.org/gems/glimmer-dsl-libui), add `require 'glimmer-dsl-libui'` at the top.
|
594
595
|
|
595
|
-
|
596
|
+
Afterwards, `include Glimmer` into the top-level main object for testing or into an actual class for serious usage.
|
597
|
+
|
598
|
+
Alternatively, `include Glimmer::LibUI::Application` to conveniently declare the GUI `body` and run via the `::launch` method (`Glimmer::LibUI::Application` is an alias for `Glimmer::LibUI::CustomWindow` since that is what it represents).
|
599
|
+
|
600
|
+
Example including `Glimmer::LibUI::Application` (you may copy/paste in [`girb`](#girb-glimmer-irb)):
|
601
|
+
|
602
|
+
```ruby
|
603
|
+
require 'glimmer-dsl-libui'
|
604
|
+
|
605
|
+
class SomeGlimmerApp
|
606
|
+
include Glimmer::LibUI::Application
|
607
|
+
|
608
|
+
body {
|
609
|
+
window('hello world', 300, 200) {
|
610
|
+
button('Button') {
|
611
|
+
on_clicked do
|
612
|
+
puts 'Button Clicked'
|
613
|
+
end
|
614
|
+
}
|
615
|
+
}
|
616
|
+
}
|
617
|
+
end
|
618
|
+
|
619
|
+
SomeGlimmerApp.launch
|
620
|
+
```
|
621
|
+
|
622
|
+
Example including `Glimmer` and manually implementing the `#launch` method (you may copy/paste in [`girb`](#girb-glimmer-irb)):
|
596
623
|
|
597
624
|
```ruby
|
598
625
|
require 'glimmer-dsl-libui'
|
599
626
|
|
600
|
-
class
|
627
|
+
class SomeGlimmerApp
|
601
628
|
include Glimmer
|
602
629
|
|
603
630
|
def launch
|
@@ -611,7 +638,23 @@ class Application
|
|
611
638
|
end
|
612
639
|
end
|
613
640
|
|
614
|
-
|
641
|
+
SomeGlimmerApp.new.launch
|
642
|
+
```
|
643
|
+
|
644
|
+
Example including `Glimmer` at the top-level scope just for some prototyping/demoing/testing (you may copy/paste in [`girb`](#girb-glimmer-irb)):
|
645
|
+
|
646
|
+
```ruby
|
647
|
+
require 'glimmer-dsl-libui'
|
648
|
+
|
649
|
+
include Glimmer
|
650
|
+
|
651
|
+
window('hello world', 300, 200) {
|
652
|
+
button('Button') {
|
653
|
+
on_clicked do
|
654
|
+
puts 'Button Clicked'
|
655
|
+
end
|
656
|
+
}
|
657
|
+
}.show
|
615
658
|
```
|
616
659
|
|
617
660
|
If you are new to [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui), check out [Girb](#girb-glimmer-irb) and [Examples](#examples) to quickly learn through copy/paste. You may refer to the [API](#api) later on once you have gotten your feet wet with [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) and need more detailed reference information.
|
@@ -675,6 +718,7 @@ Keyword(Args) | Properties | Listeners
|
|
675
718
|
`checkbox_text_column(name as String)` | `editable` (Boolean), `editable_checkbox` (Boolean), `editable_text` (Boolean) | None
|
676
719
|
`checkbox_text_color_column(name as String)` | `editable` (Boolean), `editable_checkbox` (Boolean), `editable_text` (Boolean) | None
|
677
720
|
`check_menu_item(text as String)` | `checked` (Boolean) | `on_clicked`
|
721
|
+
`code_area` | `language` (String) (default: `'ruby'`), `theme` (String) (default: `'glimmer'`), `code` (String) | None
|
678
722
|
`combobox` | `items` (`Array` of `String`), `selected` (`Integer`), `selected_item` (`String`) | `on_selected`
|
679
723
|
`color_button` | `color` (Array of `red` as `Float`, `green` as `Float`, `blue` as `Float`, `alpha` as `Float`), `red` as `Float`, `green` as `Float`, `blue` as `Float`, `alpha` as `Float` | `on_changed`
|
680
724
|
`date_picker` | `time` (`Hash` of keys: `sec` as `Integer`, `min` as `Integer`, `hour` as `Integer`, `mday` as `Integer`, `mon` as `Integer`, `year` as `Integer`, `wday` as `Integer`, `yday` as `Integer`, `dst` as Boolean) | `on_changed`
|
@@ -4987,6 +5031,62 @@ end
|
|
4987
5031
|
BasicDrawText.new.launch
|
4988
5032
|
```
|
4989
5033
|
|
5034
|
+
#### Basic Code Area
|
5035
|
+
|
5036
|
+
[examples/basic_code_area.rb](examples/basic_code_area.rb)
|
5037
|
+
|
5038
|
+
Run with this command from the root of the project if you cloned the project:
|
5039
|
+
|
5040
|
+
```
|
5041
|
+
ruby -r './lib/glimmer-dsl-libui' examples/basic_code_area.rb
|
5042
|
+
```
|
5043
|
+
|
5044
|
+
Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-libui):
|
5045
|
+
|
5046
|
+
```
|
5047
|
+
ruby -r glimmer-dsl-libui -e "require 'examples/basic_code_area'"
|
5048
|
+
```
|
5049
|
+
|
5050
|
+
Mac | Windows | Linux
|
5051
|
+
----|---------|------
|
5052
|
+
![glimmer-dsl-libui-mac-basic-code-area.png](images/glimmer-dsl-libui-mac-basic-code-area.png) | ![glimmer-dsl-libui-windows-basic-code-area.png](images/glimmer-dsl-libui-windows-basic-code-area.png) | ![glimmer-dsl-libui-linux-basic-code-area.png](images/glimmer-dsl-libui-linux-basic-code-area.png)
|
5053
|
+
|
5054
|
+
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
5055
|
+
|
5056
|
+
```ruby
|
5057
|
+
require 'glimmer-dsl-libui'
|
5058
|
+
|
5059
|
+
class BasicCodeArea
|
5060
|
+
include Glimmer::LibUI::Application
|
5061
|
+
|
5062
|
+
before_body do
|
5063
|
+
@code = <<~CODE
|
5064
|
+
# Greets target with greeting
|
5065
|
+
def greet(greeting: 'Hello', target: 'World')
|
5066
|
+
|
5067
|
+
puts "\#{greeting}, \#{target}!"
|
5068
|
+
end
|
5069
|
+
|
5070
|
+
greet
|
5071
|
+
greet(target: 'Robert')
|
5072
|
+
greet(greeting: 'Aloha')
|
5073
|
+
greet(greeting: 'Aloha', target: 'Nancy')
|
5074
|
+
greet(greeting: 'Howdy', target: 'Doodle')
|
5075
|
+
CODE
|
5076
|
+
end
|
5077
|
+
|
5078
|
+
body {
|
5079
|
+
window('Basic Code Area', 400, 300) {
|
5080
|
+
margined true
|
5081
|
+
|
5082
|
+
code_area(language: 'ruby', code: @code)
|
5083
|
+
}
|
5084
|
+
}
|
5085
|
+
end
|
5086
|
+
|
5087
|
+
BasicCodeArea.launch
|
5088
|
+
```
|
5089
|
+
|
4990
5090
|
### Advanced Examples
|
4991
5091
|
|
4992
5092
|
#### Area Gallery
|
@@ -8967,8 +9067,6 @@ New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version
|
|
8967
9067
|
require 'glimmer-dsl-libui'
|
8968
9068
|
require 'facets'
|
8969
9069
|
|
8970
|
-
include Glimmer
|
8971
|
-
|
8972
9070
|
Address = Struct.new(:street, :p_o_box, :city, :state, :zip_code)
|
8973
9071
|
|
8974
9072
|
class FormField
|
@@ -9029,54 +9127,64 @@ class AddressView
|
|
9029
9127
|
}
|
9030
9128
|
end
|
9031
9129
|
|
9032
|
-
|
9033
|
-
|
9034
|
-
|
9035
|
-
window('Class-Based Custom Keyword') {
|
9036
|
-
margined true
|
9130
|
+
class ClassBasedCustomControls
|
9131
|
+
include Glimmer::LibUI::Application # alias: Glimmer::LibUI::CustomWindow
|
9037
9132
|
|
9038
|
-
|
9039
|
-
|
9040
|
-
|
9041
|
-
|
9042
|
-
|
9043
|
-
|
9044
|
-
|
9045
|
-
|
9046
|
-
horizontal_separator {
|
9047
|
-
stretchy false
|
9048
|
-
}
|
9049
|
-
|
9050
|
-
label('Address 1 (Saved)') {
|
9051
|
-
stretchy false
|
9052
|
-
}
|
9053
|
-
|
9054
|
-
address_view(address: address1)
|
9055
|
-
}
|
9056
|
-
|
9057
|
-
vertical_separator {
|
9058
|
-
stretchy false
|
9059
|
-
}
|
9060
|
-
|
9061
|
-
vertical_box {
|
9062
|
-
label('Address 2') {
|
9063
|
-
stretchy false
|
9064
|
-
}
|
9065
|
-
|
9066
|
-
address_form(address: address2)
|
9067
|
-
|
9068
|
-
horizontal_separator {
|
9069
|
-
stretchy false
|
9070
|
-
}
|
9133
|
+
before_body do
|
9134
|
+
@address1 = Address.new('123 Main St', '23923', 'Denver', 'Colorado', '80014')
|
9135
|
+
@address2 = Address.new('2038 Park Ave', '83272', 'Boston', 'Massachusetts', '02101')
|
9136
|
+
end
|
9137
|
+
|
9138
|
+
body {
|
9139
|
+
window('Class-Based Custom Keyword') {
|
9140
|
+
margined true
|
9071
9141
|
|
9072
|
-
|
9073
|
-
|
9142
|
+
horizontal_box {
|
9143
|
+
vertical_box {
|
9144
|
+
label('Address 1') {
|
9145
|
+
stretchy false
|
9146
|
+
}
|
9147
|
+
|
9148
|
+
address_form(address: @address1)
|
9149
|
+
|
9150
|
+
horizontal_separator {
|
9151
|
+
stretchy false
|
9152
|
+
}
|
9153
|
+
|
9154
|
+
label('Address 1 (Saved)') {
|
9155
|
+
stretchy false
|
9156
|
+
}
|
9157
|
+
|
9158
|
+
address_view(address: @address1)
|
9159
|
+
}
|
9160
|
+
|
9161
|
+
vertical_separator {
|
9162
|
+
stretchy false
|
9163
|
+
}
|
9164
|
+
|
9165
|
+
vertical_box {
|
9166
|
+
label('Address 2') {
|
9167
|
+
stretchy false
|
9168
|
+
}
|
9169
|
+
|
9170
|
+
address_form(address: @address2)
|
9171
|
+
|
9172
|
+
horizontal_separator {
|
9173
|
+
stretchy false
|
9174
|
+
}
|
9175
|
+
|
9176
|
+
label('Address 2 (Saved)') {
|
9177
|
+
stretchy false
|
9178
|
+
}
|
9179
|
+
|
9180
|
+
address_view(address: @address2)
|
9181
|
+
}
|
9074
9182
|
}
|
9075
|
-
|
9076
|
-
address_view(address: address2)
|
9077
9183
|
}
|
9078
9184
|
}
|
9079
|
-
|
9185
|
+
end
|
9186
|
+
|
9187
|
+
ClassBasedCustomControls.launch
|
9080
9188
|
```
|
9081
9189
|
|
9082
9190
|
#### Area-Based Custom Controls
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.8
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'glimmer-dsl-libui'
|
2
|
+
|
3
|
+
class BasicCodeArea
|
4
|
+
include Glimmer::LibUI::Application
|
5
|
+
|
6
|
+
before_body do
|
7
|
+
@code = <<~CODE
|
8
|
+
# Greets target with greeting
|
9
|
+
def greet(greeting: 'Hello', target: 'World')
|
10
|
+
|
11
|
+
puts "\#{greeting}, \#{target}!"
|
12
|
+
end
|
13
|
+
|
14
|
+
greet
|
15
|
+
greet(target: 'Robert')
|
16
|
+
greet(greeting: 'Aloha')
|
17
|
+
greet(greeting: 'Aloha', target: 'Nancy')
|
18
|
+
greet(greeting: 'Howdy', target: 'Doodle')
|
19
|
+
CODE
|
20
|
+
end
|
21
|
+
|
22
|
+
body {
|
23
|
+
window('Basic Code Area', 400, 300) {
|
24
|
+
margined true
|
25
|
+
|
26
|
+
code_area(language: 'ruby', code: @code)
|
27
|
+
}
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
BasicCodeArea.launch
|
data/glimmer-dsl-libui.gemspec
CHANGED
Binary file
|
@@ -85,7 +85,7 @@ module Glimmer
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def post_add_content
|
88
|
-
|
88
|
+
if OS.linux? && parent_proxy.is_a?(WindowProxy)
|
89
89
|
unless @content_added
|
90
90
|
original_parent_proxy = @parent_proxy
|
91
91
|
@vertical_box_parent_proxy = ControlProxy.create('vertical_box', parent_proxy, []) {} # block prevents calling post add content
|
@@ -0,0 +1,65 @@
|
|
1
|
+
class CodeArea
|
2
|
+
class << self
|
3
|
+
def languages
|
4
|
+
require 'rouge'
|
5
|
+
Rouge::Lexer.all.map {|lexer| lexer.tag}.sort
|
6
|
+
end
|
7
|
+
|
8
|
+
def lexers
|
9
|
+
require 'rouge'
|
10
|
+
Rouge::Lexer.all.sort_by(&:title)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
include Glimmer::LibUI::CustomControl
|
15
|
+
|
16
|
+
REGEX_COLOR_HEX6 = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/
|
17
|
+
|
18
|
+
option :language, default: 'ruby'
|
19
|
+
option :theme, default: 'glimmer'
|
20
|
+
option :code
|
21
|
+
|
22
|
+
body {
|
23
|
+
area {
|
24
|
+
rectangle(0, 0, 8000, 8000) {
|
25
|
+
fill :white
|
26
|
+
}
|
27
|
+
text {
|
28
|
+
default_font family: OS.mac? ? 'Consolas' : 'Courier', size: 13, weight: :medium, italic: :normal, stretch: :normal
|
29
|
+
|
30
|
+
syntax_highlighting(code).each do |token|
|
31
|
+
style_data = Rouge::Theme.find(theme).new.style_for(token[:token_type])
|
32
|
+
|
33
|
+
string(token[:token_text]) {
|
34
|
+
color style_data[:fg] || :black
|
35
|
+
background style_data[:bg] || :white
|
36
|
+
}
|
37
|
+
end
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
def lexer
|
43
|
+
require 'rouge'
|
44
|
+
require 'glimmer-dsl-libui/ext/rouge/theme/glimmer'
|
45
|
+
# TODO Try to use Rouge::Lexer.find_fancy('guess', code) in the future to guess the language or otherwise detect it from file extension
|
46
|
+
@lexer ||= Rouge::Lexer.find_fancy(language)
|
47
|
+
@lexer ||= Rouge::Lexer.find_fancy('ruby') # default to Ruby if no lexer is found
|
48
|
+
end
|
49
|
+
|
50
|
+
def syntax_highlighting(text)
|
51
|
+
return [] if text.to_s.strip.empty?
|
52
|
+
@syntax_highlighting ||= {}
|
53
|
+
unless @syntax_highlighting.keys.include?(text)
|
54
|
+
lex = lexer.lex(text).to_a
|
55
|
+
text_size = 0
|
56
|
+
@syntax_highlighting[text] = lex.map do |pair|
|
57
|
+
{token_type: pair.first, token_text: pair.last}
|
58
|
+
end.each do |hash|
|
59
|
+
hash[:token_index] = text_size
|
60
|
+
text_size += hash[:token_text].size
|
61
|
+
end
|
62
|
+
end
|
63
|
+
@syntax_highlighting[text]
|
64
|
+
end
|
65
|
+
end
|
@@ -232,9 +232,10 @@ module Glimmer
|
|
232
232
|
end
|
233
233
|
|
234
234
|
def respond_to?(method_name, *args, &block)
|
235
|
-
|
236
|
-
|
237
|
-
|
235
|
+
result = false
|
236
|
+
result ||= super
|
237
|
+
result ||= can_handle_listener?(method_name)
|
238
|
+
result ||= @body_root.respond_to?(method_name, *args, &block)
|
238
239
|
end
|
239
240
|
|
240
241
|
private
|
@@ -250,3 +251,5 @@ module Glimmer
|
|
250
251
|
end
|
251
252
|
end
|
252
253
|
end
|
254
|
+
|
255
|
+
Dir[File.expand_path("./#{File.basename(__FILE__, '.rb')}/*.rb", __dir__)].each {|f| require f}
|
@@ -37,7 +37,11 @@ module Glimmer
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def initialize(parent, *swt_constants, options, &content)
|
40
|
+
original_logger = Glimmer::Config.logger
|
41
|
+
require 'stringio'
|
42
|
+
Glimmer::Config.logger = Logger.new(StringIO.new)
|
40
43
|
super
|
44
|
+
Glimmer::Config.logger = original_logger
|
41
45
|
raise Glimmer::Error, 'Invalid custom window body root! Must be a window, another custom window, or a custom control with window as its body root!' unless body_root.is_a?(Glimmer::LibUI::ControlProxy::WindowProxy) || body_root.is_a?(Glimmer::LibUI::CustomWindow) || (body_root.is_a?(Glimmer::LibUI::CustomControl) && body_root.body_root.is_a?(Glimmer::LibUI::ControlProxy::WindowProxy))
|
42
46
|
end
|
43
47
|
|
data/lib/glimmer/libui.rb
CHANGED
@@ -80,11 +80,9 @@ module Glimmer
|
|
80
80
|
|
81
81
|
def hex_to_rgb(value)
|
82
82
|
if value.is_a?(String)
|
83
|
-
value =
|
84
|
-
if
|
85
|
-
|
86
|
-
value = "0x#{value}"
|
87
|
-
end
|
83
|
+
value = value[2..-1] if value.start_with?('0x')
|
84
|
+
value = value[1..-1] if value.start_with?('#')
|
85
|
+
value = value.chars.map {|char| [char, char]}.flatten.join if value.length == 3
|
88
86
|
value = value.to_i(16)
|
89
87
|
end
|
90
88
|
if value.is_a?(Integer)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Rouge
|
2
|
+
module Themes
|
3
|
+
# A port of the pastie style from Pygments.
|
4
|
+
# See https://bitbucket.org/birkenfeld/pygments-main/src/default/pygments/styles/pastie.py
|
5
|
+
class Glimmer < Github
|
6
|
+
name 'glimmer'
|
7
|
+
style Comment::Single, fg: [106,115,125], italic: true # Also, Comments
|
8
|
+
style Keyword::Pseudo, fg: [:dark_red]
|
9
|
+
style Keyword, fg: [:blue]
|
10
|
+
style Literal::String::Single, fg: [106,115,125] # Also, Comments
|
11
|
+
style Literal::String::Double, fg: [0,92,197]
|
12
|
+
style Literal::String::Escape, fg: [:red]
|
13
|
+
style Literal::Number::Integer, fg: [:blue]
|
14
|
+
style Literal::String::Interpol, fg: [:blue]
|
15
|
+
style Literal::String::Symbol, fg: [:dark_green]
|
16
|
+
style Literal::String, fg: [:dark_blue]
|
17
|
+
style Name::Builtin, fg: [215,58,73]
|
18
|
+
style Name::Class, fg: [3,47,98]
|
19
|
+
style Name::Namespace, fg: [3,47,98]
|
20
|
+
style Name::Constant, fg: [0,92,197]
|
21
|
+
style Name::Function, fg: [:blue]
|
22
|
+
style Name::Variable::Instance, fg: [227,98,9]
|
23
|
+
style Name, fg: [111,66,193] #purple
|
24
|
+
style Operator, fg: [:red]
|
25
|
+
style Punctuation, fg: [:blue]
|
26
|
+
style Text, fg: [75, 75, 75]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-libui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -128,6 +128,26 @@ dependencies:
|
|
128
128
|
- - '='
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: 0.0.11
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: rouge
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: 3.26.0
|
138
|
+
- - "<"
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: 4.0.0
|
141
|
+
type: :runtime
|
142
|
+
prerelease: false
|
143
|
+
version_requirements: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: 3.26.0
|
148
|
+
- - "<"
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: 4.0.0
|
131
151
|
- !ruby/object:Gem::Dependency
|
132
152
|
name: juwelier
|
133
153
|
requirement: !ruby/object:Gem::Requirement
|
@@ -265,6 +285,7 @@ files:
|
|
265
285
|
- examples/basic_area3.rb
|
266
286
|
- examples/basic_area4.rb
|
267
287
|
- examples/basic_button.rb
|
288
|
+
- examples/basic_code_area.rb
|
268
289
|
- examples/basic_draw_text.rb
|
269
290
|
- examples/basic_draw_text2.rb
|
270
291
|
- examples/basic_entry.rb
|
@@ -359,6 +380,7 @@ files:
|
|
359
380
|
- icons/glimmer.png
|
360
381
|
- lib/glimmer-dsl-libui.rb
|
361
382
|
- lib/glimmer-dsl-libui/ext/glimmer.rb
|
383
|
+
- lib/glimmer-dsl-libui/ext/rouge/theme/glimmer.rb
|
362
384
|
- lib/glimmer/dsl/libui/bind_expression.rb
|
363
385
|
- lib/glimmer/dsl/libui/control_expression.rb
|
364
386
|
- lib/glimmer/dsl/libui/custom_control_expression.rb
|
@@ -444,6 +466,7 @@ files:
|
|
444
466
|
- lib/glimmer/libui/control_proxy/triple_column.rb
|
445
467
|
- lib/glimmer/libui/control_proxy/window_proxy.rb
|
446
468
|
- lib/glimmer/libui/custom_control.rb
|
469
|
+
- lib/glimmer/libui/custom_control/code_area.rb
|
447
470
|
- lib/glimmer/libui/custom_window.rb
|
448
471
|
- lib/glimmer/libui/data_bindable.rb
|
449
472
|
- lib/glimmer/libui/image_path_renderer.rb
|
@@ -486,7 +509,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
486
509
|
- !ruby/object:Gem::Version
|
487
510
|
version: '0'
|
488
511
|
requirements: []
|
489
|
-
rubygems_version: 3.3.
|
512
|
+
rubygems_version: 3.3.6
|
490
513
|
signing_key:
|
491
514
|
specification_version: 4
|
492
515
|
summary: Glimmer DSL for LibUI
|