glimmer-dsl-swt 4.17.3.0 → 4.17.4.0

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: 6a29cc3fc40ad3ed6f5aff4fc924a1e5d29dfc505df8f66857e669f687c177be
4
- data.tar.gz: 6e93601aedd65dbce5379f0629f4e42f60a5211829e2c7ffb3e203fb5ae39551
3
+ metadata.gz: 0d8d95c12f301621467ded0dd2abb7b1c055ce22594e5a93e744d4bcfe84e1d4
4
+ data.tar.gz: 7458a6dec1a2700e9005c11eddf7e42c9585b54bb10a18efbd8273a969c2906a
5
5
  SHA512:
6
- metadata.gz: d13f68897613eb659020350fd9ca3877de30f2033e4615c8b07e9ff0539646b9730e7d8b51dfd0f7b49f8d83c30cc22c9bceaca26fa3e7aabbe7a0178bb6b6e0
7
- data.tar.gz: f175a664d832335006ae3a3d7bfc3ba8aabd8f8684247d735eb37e683b8e2ccf77ac37221c611e73a690f5df9e4f5e4378425e97b347fd2c03b1f8b95afcaa80
6
+ metadata.gz: c1595178259263a3d6127035a0917f4e350316f4dd7af6cdc8def67cb0e5f39ed63da8ed3b76a978db6a1b95fe88da413640ed96117f69b55d5596b3f8031b42
7
+ data.tar.gz: e42731662e6757942c3eb7db9ca33e6f45c6990eb37b170dc851c3773a2b7bce8aa9a2a42b52cf961be8937682663104ce6f5298852b263fd0f367025df4dc31
@@ -1,5 +1,16 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.17.4.0
4
+
5
+ - Glimmer sample app to launch samples (sample of samples meta-sample)
6
+ - Syntax Color Highlighting in meta-sample
7
+ - Make sash_form weights accept splat array elements (not wrapped in [])
8
+ - Make sash_form weights not get set till the closing of the sash_form (to allow putting it above content instead of below as originally required by SWT)
9
+ - Replace dependency on tty-markdown gem with dependency on rouge gem instead
10
+ - Remove rake tasks `sample:list`, `sample:code` and `sample:run`
11
+ - Add rake task `samples` to point to the new Glimmer Meta-Sample
12
+ - Have meta-sample load samples from gems
13
+
3
14
  ### 4.17.3.0
4
15
 
5
16
  - `glimmer scaffold:desktopify[appname,website]` Mac
@@ -18,6 +29,7 @@
18
29
 
19
30
  - New `glimmer run` glimmer command task.
20
31
  - Add built in support for handling jar file paths like that in ImageProxy code processing "uri:classloader" path
32
+ - Document that gif background_image only works without on_top and no_trim styles in Windows
21
33
  - Give a good error message when Git is not properly setup for Glimmer Scaffolding
22
34
  - Give an error message when attempting to scaffold over an already scaffolded directory
23
35
  - Fix issue on Windows regarding use of the new EXPERIMENTAL Animated gif support in the `composite#background_image` property
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 SWT 4.17.3.0
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 SWT 4.17.4.0
2
2
  ## JRuby Desktop Development GUI Library
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
4
4
  [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
@@ -40,9 +40,10 @@ shell {
40
40
  }.open
41
41
  ```
42
42
 
43
- Run:
43
+ Run via `glimmer samples` or directly:
44
+
44
45
  ```
45
- glimmer sample:run[hello_world]
46
+ glimmer samples/hello/hello_world.rb
46
47
  ```
47
48
 
48
49
  Glimmer app:
@@ -85,10 +86,10 @@ Glimmer code (from [samples/elaborate/tic_tac_toe.rb](https://github.com/AndyObt
85
86
  # ...
86
87
  ```
87
88
 
88
- Run:
89
+ Run via `glimmer samples` or directly:
89
90
 
90
91
  ```
91
- glimmer sample:run[tic_tac_toe]
92
+ glimmer samples/elaborate/tic_tac_toe.rb
92
93
  ```
93
94
 
94
95
  Glimmer app:
@@ -210,10 +211,10 @@ Glimmer code (from [samples/elaborate/contact_manager.rb](https://github.com/And
210
211
  # ...
211
212
  ```
212
213
 
213
- Run:
214
+ Run via `glimmer samples` or directly:
214
215
 
215
216
  ```
216
- glimmer sample:run[contact_manager]
217
+ glimmer samples/elaborate/contact_manager.rb
217
218
  ```
218
219
 
219
220
  Glimmer App:
@@ -248,12 +249,10 @@ Glimmer App:
248
249
  - [Glimmer Command](#glimmer-command)
249
250
  - [Basic Usage](#basic-usage)
250
251
  - [Advanced Usage](#advanced-usage)
251
- - [Sample List/Run/Code](#sample-listruncode)
252
- - [Sample List](#sample-list)
253
- - [Sample Run](#sample-run)
254
- - [Sample Code](#sample-code)
252
+ - [Samples](#samples)
255
253
  - [Scaffolding](#scaffolding)
256
254
  - [App](#app)
255
+ - [Desktopify](#desktopify)
257
256
  - [Custom Shell](#custom-shell)
258
257
  - [Custom Widget](#custom-widget)
259
258
  - [Custom Shell Gem](#custom-shell-gem)
@@ -309,7 +308,9 @@ Glimmer App:
309
308
  - [Multi-DSL Support](#multi-dsl-support)
310
309
  - [Application Menu Items (About/Preferences)](#application-menu-items-aboutpreferences)
311
310
  - [App Name and Version](#app-name-and-version)
311
+ - [Code Text Widget](#code-text-widget)
312
312
  - [Video Widget](#video-widget)
313
+ - [Sash Form Widget](#sash-form-widget)
313
314
  - [Browser Widget](#browser-widget)
314
315
  - [Glimmer Configuration](#glimmer-configuration)
315
316
  - [logger](#logger)
@@ -338,6 +339,7 @@ Glimmer App:
338
339
  - [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu)
339
340
  - [Hello, Custom Widget!](#hello-custom-widget)
340
341
  - [Hello, Custom Shell!](#hello-custom-shell)
342
+ - [Hello, Sash Form!](#hello-sash-form)
341
343
  - [Elaborate Samples](#elaborate-samples)
342
344
  - [User Profile](#user-profile)
343
345
  - [Login](#login)
@@ -373,7 +375,7 @@ Glimmer App:
373
375
  - [Contributors](#contributors)
374
376
  - [Hire Me](#hire-me)
375
377
  - [License](#license)
376
-
378
+
377
379
  ## Background
378
380
 
379
381
  Ruby is a dynamically-typed object-oriented language, which provides great productivity gains due to its powerful expressive syntax and dynamic nature. While it is proven by the Ruby on Rails framework for web development, it currently lacks a robust platform-independent framework for building desktop applications. Given that Java libraries can now be utilized in Ruby code through JRuby, Eclipse technologies, such as SWT, JFace, and RCP can help fill the gap of desktop application development with Ruby.
@@ -431,7 +433,7 @@ jgem install glimmer-dsl-swt
431
433
 
432
434
  Or this command if you want a specific version:
433
435
  ```
434
- jgem install glimmer-dsl-swt -v 4.17.3.0
436
+ jgem install glimmer-dsl-swt -v 4.17.4.0
435
437
  ```
436
438
 
437
439
  Note: Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT.
@@ -490,17 +492,18 @@ glimmer application.rb
490
492
  Runs a Glimmer application using JRuby, automatically preloading
491
493
  the glimmer ruby gem and SWT jar dependency.
492
494
 
493
- Example:
495
+ Run Glimmer samples with:
496
+
494
497
  ```
495
- glimmer sample:run[hello_world]
498
+ glimmer samples
496
499
  ```
497
- This runs the Glimmer "Hello, World!" sample.
500
+ This brings up the [Glimmer Meta-Sample (The Sample of Samples)](#samples)
498
501
 
499
- If you cloned this project locally, you may run `bin/glimmer` instead.
502
+ If you cloned this project locally instead of installing the gem, run `bin/glimmer` instead.
500
503
 
501
504
  Example:
502
505
  ```
503
- bin/glimmer sample:run[hello_world]
506
+ bin/glimmer samples
504
507
  ```
505
508
 
506
509
  ### Advanced Usage
@@ -508,7 +511,7 @@ bin/glimmer sample:run[hello_world]
508
511
  Below are the full usage instructions that come up when running `glimmer` without args.
509
512
 
510
513
  ```
511
- Glimmer (Ruby Desktop Development GUI Library) - JRuby Gem: glimmer-dsl-swt v4.17.3.0
514
+ Glimmer (Ruby Desktop Development GUI Library) - JRuby Gem: glimmer-dsl-swt v4.17.4.0
512
515
 
513
516
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
514
517
 
@@ -542,9 +545,7 @@ Select a Glimmer task to run: (Press ↑/↓ arrow to move, Enter to select and
542
545
  glimmer package:lock_jars # Lock JARs
543
546
  glimmer package:native[type] # Generate Native files
544
547
  glimmer run[app_path] # Runs Glimmer app or custom shell gem in the current directory, unless app_path is specified, then runs it instead (app_path is optional)
545
- glimmer sample:code[name] # Outputs code for a Glimmer internal sample [included in gem] (name is required)
546
- glimmer sample:list[query] # Lists Glimmer internal samples [included in gem]. Filters by query if specified (query is optional)
547
- glimmer sample:run[name] # Runs a Glimmer internal sample [included in gem]. If no name is supplied, it runs all samples
548
+ glimmer samples # Brings up the Glimmer Meta-Sample app to allow browsing, running, and viewing code of Glimmer samples
548
549
  glimmer scaffold[app_name] # Scaffold Glimmer application directory structure to build a new app
549
550
  glimmer scaffold:customshell[name,namespace] # Scaffold Glimmer::UI::CustomShell subclass (full window view) under app/views (namespace is optional) [alt: scaffold:cs]
550
551
  glimmer scaffold:customwidget[name,namespace] # Scaffold Glimmer::UI::CustomWidget subclass (part of a view) under app/views (namespace is optional) [alt: scaffold:cw]
@@ -566,333 +567,17 @@ glimmer samples/hello/hello_world.rb samples/hello/hello_tab.rb
566
567
 
567
568
  Launches samples/hello/hello_world.rb and samples/hello_tab.rb at the same time, each in a separate JRuby thread.
568
569
 
569
- ### Sample List/Run/Code
570
-
571
- #### Sample List
570
+ ### Glimmer Samples
572
571
 
573
572
  You can list available Glimmer samples by running:
574
573
 
575
574
  ```
576
- glimmer sample:list
577
- ```
578
-
579
- This should output the following (providing the name of each sample, description, and command to run the sample and view its code):
580
-
581
- ```
582
- $ glimmer sample:list
583
-
584
- Glimmer Hello Samples:
585
-
586
- Name Description Run
587
-
588
- hello_browser Hello Browser glimmer sample:run[hello_browser]
589
- hello_combo Hello Combo glimmer sample:run[hello_combo]
590
- hello_computed Hello Computed glimmer sample:run[hello_computed]
591
- hello_drag_and_drop Hello Drag And Drop glimmer sample:run[hello_drag_and_drop]
592
- hello_list_multi_selection Hello List Multi Selection glimmer sample:run[hello_list_multi_selection]
593
- hello_list_single_selection Hello List Single Selection glimmer sample:run[hello_list_single_selection]
594
- hello_menu_bar Hello Menu Bar glimmer sample:run[hello_menu_bar]
595
- hello_message_box Hello Message Box glimmer sample:run[hello_message_box]
596
- hello_pop_up_context_menu Hello Pop Up Context Menu glimmer sample:run[hello_pop_up_context_menu]
597
- hello_tab Hello Tab glimmer sample:run[hello_tab]
598
- hello_world Hello World glimmer sample:run[hello_world]
599
-
600
-
601
- Glimmer Elaborate Samples:
602
-
603
- Name Description Run
604
-
605
- contact_manager Contact Manager glimmer sample:run[contact_manager]
606
- login Login glimmer sample:run[login]
607
- tic_tac_toe Tic Tac Toe glimmer sample:run[tic_tac_toe]
608
- user_profile User Profile glimmer sample:run[user_profile]
575
+ glimmer samples
609
576
  ```
610
577
 
611
- #### Sample Run
612
-
613
- A sample may be run via `glimmer sample:run[name]`. This also outputs the sample code so that you could take a look at it and compare to the GUI that launches.
614
-
615
- If the sample name is left empty (e.g. `glimmer sample:run`), then all samples are run.
578
+ This brings up the [Glimmer Meta-Sample (The Sample of Samples)](#samples):
616
579
 
617
- Example:
618
-
619
- ```
620
- glimmer sample:run[hello_tab]
621
- ```
622
-
623
- This will run the hello_tab sample and output its code:
624
-
625
- ```
626
- $ glimmer sample:run[hello_tab]
627
-
628
- # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.3.0/samples/hello/hello_tab.rb
629
-
630
- class HelloTab
631
- include Glimmer
632
- def launch
633
- shell {
634
- text "Hello, Tab!"
635
- tab_folder {
636
- tab_item {
637
- text "English"
638
- label {
639
- text "Hello, World!"
640
- }
641
- }
642
- tab_item {
643
- text "French"
644
- label {
645
- text "Bonjour, Univers!"
646
- }
647
- }
648
- }
649
- }.open
650
- end
651
- end
652
-
653
- HelloTab.new.launch
654
-
655
- # # #
656
- ```
657
-
658
- ![Hello Tab English](images/glimmer-hello-tab-english.png)
659
-
660
- #### Sample Code
661
-
662
- You may output any sample code via this command: `glimmer sample:code[name]`
663
-
664
- This is very similar to the sample run command, except the name is required.
665
-
666
- It will not only output the main sample file, but any required supporting files as well.
667
-
668
- Example:
669
-
670
- ```
671
- $ glimmer sample:code[tic_tac_toe]
672
-
673
- # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.3.0/samples/elaborate/tic_tac_toe.rb
674
-
675
- require_relative "tic_tac_toe/board"
676
-
677
- class TicTacToe
678
- include Glimmer
679
-
680
- def initialize
681
- @tic_tac_toe_board = Board.new
682
- @shell = shell {
683
- text "Tic-Tac-Toe"
684
- minimum_size 150, 178
685
- composite {
686
- grid_layout 3, true
687
- (1..3).each { |row|
688
- (1..3).each { |column|
689
- button {
690
- layout_data :fill, :fill, true, true
691
- text bind(@tic_tac_toe_board[row, column], :sign)
692
- enabled bind(@tic_tac_toe_board[row, column], :empty)
693
- font style: :bold, height: 20
694
- on_widget_selected {
695
- @tic_tac_toe_board.mark(row, column)
696
- }
697
- }
698
- }
699
- }
700
- }
701
- }
702
- observe(@tic_tac_toe_board, :game_status) { |game_status|
703
- display_win_message if game_status == Board::WIN
704
- display_draw_message if game_status == Board::DRAW
705
- }
706
- end
707
-
708
- def display_win_message
709
- display_game_over_message("Player #{@tic_tac_toe_board.winning_sign} has won!")
710
- end
711
-
712
- def display_draw_message
713
- display_game_over_message("Draw!")
714
- end
715
-
716
- def display_game_over_message(message_text)
717
- message_box(@shell) {
718
- text 'Game Over'
719
- message message_text
720
- }.open
721
- @tic_tac_toe_board.reset
722
- end
723
-
724
- def open
725
- @shell.open
726
- end
727
- end
728
-
729
- TicTacToe.new.open
730
-
731
- # # #
732
-
733
-
734
- # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.3.0/samples/elaborate/tic_tac_toe/cell.rb
735
-
736
- class TicTacToe
737
- class Cell
738
- EMPTY = ""
739
- attr_accessor :sign, :empty
740
-
741
- def initialize
742
- reset
743
- end
744
-
745
- def mark(sign)
746
- self.sign = sign
747
- end
748
-
749
- def reset
750
- self.sign = EMPTY
751
- end
752
-
753
- def sign=(sign_symbol)
754
- @sign = sign_symbol
755
- self.empty = sign == EMPTY
756
- end
757
-
758
- def marked
759
- !empty
760
- end
761
- end
762
- end
763
-
764
- # # #
765
-
766
-
767
- # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.3.0/samples/elaborate/tic_tac_toe/board.rb
768
-
769
- require_relative 'cell'
770
-
771
- class TicTacToe
772
- class Board
773
- DRAW = :draw
774
- IN_PROGRESS = :in_progress
775
- WIN = :win
776
- attr :winning_sign
777
- attr_accessor :game_status
778
-
779
- def initialize
780
- @sign_state_machine = {nil => "X", "X" => "O", "O" => "X"}
781
- build_grid
782
- @winning_sign = Cell::EMPTY
783
- @game_status = IN_PROGRESS
784
- end
785
-
786
- #row and column numbers are 1-based
787
- def mark(row, column)
788
- self[row, column].mark(current_sign)
789
- game_over? #updates winning sign
790
- end
791
-
792
- def current_sign
793
- @current_sign = @sign_state_machine[@current_sign]
794
- end
795
-
796
- def [](row, column)
797
- @grid[row-1][column-1]
798
- end
799
-
800
- def game_over?
801
- win? or draw?
802
- end
803
-
804
- def win?
805
- win = (row_win? or column_win? or diagonal_win?)
806
- self.game_status=WIN if win
807
- win
808
- end
809
-
810
- def reset
811
- (1..3).each do |row|
812
- (1..3).each do |column|
813
- self[row, column].reset
814
- end
815
- end
816
- @winning_sign = Cell::EMPTY
817
- @current_sign = nil
818
- self.game_status=IN_PROGRESS
819
- end
820
-
821
- private
822
-
823
- def build_grid
824
- @grid = []
825
- 3.times do |row_index| #0-based
826
- @grid << []
827
- 3.times { @grid[row_index] << Cell.new }
828
- end
829
- end
830
-
831
- def row_win?
832
- (1..3).each do |row|
833
- if row_has_same_sign(row)
834
- @winning_sign = self[row, 1].sign
835
- return true
836
- end
837
- end
838
- false
839
- end
840
-
841
- def column_win?
842
- (1..3).each do |column|
843
- if column_has_same_sign(column)
844
- @winning_sign = self[1, column].sign
845
- return true
846
- end
847
- end
848
- false
849
- end
850
-
851
- #needs refactoring if we ever decide to make the board size dynamic
852
- def diagonal_win?
853
- if (self[1, 1].sign == self[2, 2].sign) and (self[2, 2].sign == self[3, 3].sign) and self[1, 1].marked
854
- @winning_sign = self[1, 1].sign
855
- return true
856
- end
857
- if (self[3, 1].sign == self[2, 2].sign) and (self[2, 2].sign == self[1, 3].sign) and self[3, 1].marked
858
- @winning_sign = self[3, 1].sign
859
- return true
860
- end
861
- false
862
- end
863
-
864
- def draw?
865
- @board_full = true
866
- 3.times do |x|
867
- 3.times do |y|
868
- @board_full = false if self[x, y].empty
869
- end
870
- end
871
- self.game_status = DRAW if @board_full
872
- @board_full
873
- end
874
-
875
- def row_has_same_sign(number)
876
- row_sign = self[number, 1].sign
877
- [2, 3].each do |column|
878
- return false unless row_sign == (self[number, column].sign)
879
- end
880
- true if self[number, 1].marked
881
- end
882
-
883
- def column_has_same_sign(number)
884
- column_sign = self[1, number].sign
885
- [2, 3].each do |row|
886
- return false unless column_sign == (self[row, number].sign)
887
- end
888
- true if self[1, number].marked
889
- end
890
-
891
- end
892
- end
893
-
894
- # # #
895
- ```
580
+ ![Glimmer Meta-Sample](images/glimmer-meta-sample.png)
896
581
 
897
582
  ### Scaffolding
898
583
 
@@ -915,8 +600,6 @@ letting Glimmer scaffolding take care of initial app file structure concerns, su
915
600
 
916
601
  You need to have your Git `user.name` and `github.user` configured before scaffolding since Glimmer uses Juwelier, which relies on them in creating a Git repo for your Glimmer app.
917
602
 
918
- NOTE: Linux is not fully supported yet with scaffolding. Please report any issues you may encounter.
919
-
920
603
  #### App
921
604
 
922
605
  Before you start, make sure you are in a JRuby environment with Glimmer gem installed as per "Direct Install" pre-requisites.
@@ -927,7 +610,7 @@ To scaffold a Glimmer app from scratch, run the following command:
927
610
  glimmer scaffold[AppName]
928
611
  ```
929
612
 
930
- This will generate an advanced "Hello, World!" app, package it as a Mac or Windows native file (DMG/PKG/APP/MSI), and launch it all in one fell swoop.
613
+ This will generate an advanced "Hello, World!" app, package it as a Mac DMG/PKG/APP, Windows APP, or Linux GEM, and launch it all in one fell swoop.
931
614
 
932
615
  Suppose you run:
933
616
 
@@ -1021,7 +704,7 @@ To scaffold a Glimmer desktopify app from scratch, run the following command:
1021
704
  glimmer scaffold:desktopify[app_name,website]
1022
705
  ```
1023
706
 
1024
- This will generate a Glimmer app, package it as a Mac or Windows native file (DMG/PKG/APP/MSI), and launch it all in one fell swoop.
707
+ This will generate a Glimmer app, package it as a Mac DMG/PKG/APP, Windows APP, or Linux GEM, and launch it all in one fell swoop.
1025
708
 
1026
709
  Suppose you run:
1027
710
 
@@ -1304,8 +987,8 @@ Output:
1304
987
  Name Gem Version Author Description
1305
988
 
1306
989
  Css glimmer-dsl-css 1.1.0 AndyMaleh Glimmer DSL for CSS
1307
- Opal glimmer-dsl-opal 0.3.0 AndyMaleh Glimmer DSL for Opal
1308
- Swt glimmer-dsl-swt 4.17.3.0 AndyMaleh Glimmer DSL for SWT
990
+ Opal glimmer-dsl-opal 0.4.0 AndyMaleh Glimmer DSL for Opal
991
+ Swt glimmer-dsl-swt 4.17.4.0 AndyMaleh Glimmer DSL for SWT
1309
992
  Tk glimmer-dsl-tk 0.0.6 AndyMaleh Glimmer DSL for Tk
1310
993
  Xml glimmer-dsl-xml 1.1.0 AndyMaleh Glimmer DSL for XML
1311
994
  ```
@@ -2824,7 +2507,7 @@ Custom widgets are brand new Glimmer DSL keywords that represent aggregates of e
2824
2507
 
2825
2508
  You can find out about [published Glimmer Custom Widgets](https://github.com/AndyObtiva/glimmer-dsl-swt#gem-listing) by running the `glimmer list:gems:customwidget` command
2826
2509
 
2827
- Glimmer supports two ways of creating custom widgets with minimal code:
2510
+ Glimmer supports three ways of creating custom widgets with minimal code:
2828
2511
  1. Method-based Custom Widgets (for single-view-internal reuse): Extract a method containing Glimmer DSL widget syntax. Useful for quickly eliminating redundant code within a single view.
2829
2512
  2. Class-based Custom Widgets (for multiple-view-external reuse): Create a class that includes the `Glimmer::UI::CustomWidget` module and Glimmer DSL widget syntax in a `body {}` block. This will automatically extend Glimmer's DSL syntax with an underscored lowercase keyword matching the class name by convention. Useful in making a custom widget available in many views.
2830
2513
 
@@ -3370,6 +3053,28 @@ shell(:no_resize) {
3370
3053
 
3371
3054
  Also, you may invoke `Display.setAppVersion('1.0.0')` if needed for OS app version identification reasons during development, replacing `'1.0.0'` with your application version.
3372
3055
 
3056
+ #### Code Text Widget
3057
+
3058
+ `code_text` is a Glimmer built-in custom widget that displays syntax highlighted Ruby code in a customized SWT [StyledText](https://help.eclipse.org/2020-09/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/custom/StyledText.html) widget.
3059
+
3060
+ It is used in the [Glimmer Meta-Sample (The Sample of Samples)](#samples):
3061
+
3062
+ ![Glimmer Meta-Sample](images/glimmer-meta-sample.png)
3063
+
3064
+ Glimmer Meta-Sample Code Example:
3065
+
3066
+ ```ruby
3067
+ # ...
3068
+ code_text {
3069
+ text bind(SampleDirectory, 'selected_sample.content')
3070
+ editable false
3071
+ caret nil
3072
+ }
3073
+ # ...
3074
+ ```
3075
+
3076
+ To use, simply use `code_text` in place of `text` or `styled_text` widget. If you set its `text` value to Ruby code, it automatically styles it with syntax highlighting.
3077
+
3373
3078
  #### Video Widget
3374
3079
 
3375
3080
  [![Video Widget](images/glimmer-video-widget.png)](https://github.com/AndyObtiva/glimmer-cw-video)
@@ -3378,6 +3083,39 @@ Glimmer supports a [video custom widget](https://github.com/AndyObtiva/glimmer-c
3378
3083
 
3379
3084
  You may obtain via `glimmer-cw-video` gem.
3380
3085
 
3086
+ #### Sash Form Widget
3087
+
3088
+ `sash_form` is an SWT built-in custom widget that provides a resizable sash that splits a window area into two or more panes.
3089
+
3090
+ It can be customized with the `weights` attribute by setting initial weights to size the panes at first display.
3091
+
3092
+ Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
3093
+
3094
+ ```ruby
3095
+ shell {
3096
+ text 'Sash Form Example'
3097
+ sash_form {
3098
+ label {
3099
+ text '(resize >>)'
3100
+ background :dark_green
3101
+ foreground :white
3102
+ font height: 20
3103
+ }
3104
+ label {
3105
+ text '(<< resize)'
3106
+ background :red
3107
+ foreground :white
3108
+ font height: 20
3109
+ }
3110
+ weights 1, 2
3111
+ }
3112
+ }.open
3113
+ ```
3114
+
3115
+ You may check out a more full-fledged example in [Hello, Sash Form!](#hello-sash-form)
3116
+
3117
+ ![Hello Sash Form](images/glimmer-hello-sash-form.png)
3118
+
3381
3119
  #### Browser Widget
3382
3120
 
3383
3121
  ![Hello Browser](images/glimmer-hello-browser.png)
@@ -3666,12 +3404,16 @@ https://www.eclipse.org/nebula/
3666
3404
 
3667
3405
  Check the [samples](samples) directory in [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) for examples on how to write Glimmer applications. To run a sample, make sure to install the `glimmer` gem first and then use the `glimmer` command to run it (alternatively, you may clone the repo, follow [CONTRIBUTING.md](CONTRIBUTING.md) instructions, and run samples locally with development glimmer command: `bin/glimmer`).
3668
3406
 
3669
- If you cloned the project and followed [CONTRIBUTING.md](CONTRIBUTING.md) instructions, you may run all samples in [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) at once via `samples/launch` command:
3407
+ You may run any sample via this command:
3670
3408
 
3671
3409
  ```
3672
- samples/launch
3410
+ glimmer samples
3673
3411
  ```
3674
3412
 
3413
+ This brings up the [Glimmer Meta-Sample (The Sample of Samples)](samples/elaborate/meta_sample.rb)
3414
+
3415
+ ![Glimmer Meta-Sample](images/glimmer-meta-sample.png)
3416
+
3675
3417
  ### Hello Samples
3676
3418
 
3677
3419
  For hello-type simple samples, check the following.
@@ -3682,12 +3424,6 @@ Code:
3682
3424
 
3683
3425
  [samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_world.rb)
3684
3426
 
3685
- Run:
3686
-
3687
- ```
3688
- glimmer sample:run[hello_world]
3689
- ```
3690
-
3691
3427
  ![Hello World](images/glimmer-hello-world.png)
3692
3428
 
3693
3429
  #### Hello, Tab!
@@ -3696,12 +3432,6 @@ Code:
3696
3432
 
3697
3433
  [samples/hello/hello_tab.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_tab.rb)
3698
3434
 
3699
- Run:
3700
-
3701
- ```
3702
- glimmer sample:run[hello_tab]
3703
- ```
3704
-
3705
3435
  ![Hello Tab English](images/glimmer-hello-tab-english.png)
3706
3436
  ![Hello Tab French](images/glimmer-hello-tab-french.png)
3707
3437
 
@@ -3713,12 +3443,6 @@ Code:
3713
3443
 
3714
3444
  [samples/hello/hello_combo.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_combo.rb)
3715
3445
 
3716
- Run:
3717
-
3718
- ```
3719
- glimmer sample:run[hello_combo]
3720
- ```
3721
-
3722
3446
  ![Hello Combo](images/glimmer-hello-combo.png)
3723
3447
  ![Hello Combo Expanded](images/glimmer-hello-combo-expanded.png)
3724
3448
 
@@ -3730,12 +3454,6 @@ Code:
3730
3454
 
3731
3455
  [samples/hello/hello_list_single_selection.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_list_single_selection.rb)
3732
3456
 
3733
- Run:
3734
-
3735
- ```
3736
- glimmer sample:run[hello_list_single_selection]
3737
- ```
3738
-
3739
3457
  ![Hello List Single Selection](images/glimmer-hello-list-single-selection.png)
3740
3458
 
3741
3459
  #### Hello, List Multi Selection!
@@ -3746,12 +3464,6 @@ Code:
3746
3464
 
3747
3465
  [samples/hello/hello_list_multi_selection.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_list_multi_selection.rb)
3748
3466
 
3749
- Run:
3750
-
3751
- ```
3752
- glimmer sample:run[hello_list_multi_selection]
3753
- ```
3754
-
3755
3467
  ![Hello List Multi Selection](images/glimmer-hello-list-multi-selection.png)
3756
3468
 
3757
3469
  #### Hello, Computed!
@@ -3762,12 +3474,6 @@ Code:
3762
3474
 
3763
3475
  [samples/hello/hello_computed.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_computed.rb)
3764
3476
 
3765
- Run:
3766
-
3767
- ```
3768
- glimmer sample:run[hello_computed]
3769
- ```
3770
-
3771
3477
  ![Hello Browser](images/glimmer-hello-computed.png)
3772
3478
 
3773
3479
  #### Hello, Message Box!
@@ -3778,12 +3484,6 @@ Code:
3778
3484
 
3779
3485
  [samples/hello/hello_message_box.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_message_box.rb)
3780
3486
 
3781
- Run:
3782
-
3783
- ```
3784
- glimmer sample:run[hello_message_box]
3785
- ```
3786
-
3787
3487
  ![Hello Message Box](images/glimmer-hello-message-box.png)
3788
3488
  ![Hello Message Box Dialog](images/glimmer-hello-message-box-dialog.png)
3789
3489
 
@@ -3795,12 +3495,6 @@ Code:
3795
3495
 
3796
3496
  [samples/hello/hello_browser.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_browser.rb)
3797
3497
 
3798
- Run:
3799
-
3800
- ```
3801
- glimmer sample:run[hello_browser]
3802
- ```
3803
-
3804
3498
  ![Hello Browser](images/glimmer-hello-browser.png)
3805
3499
 
3806
3500
  #### Hello, Drag and Drop!
@@ -3811,12 +3505,6 @@ Code:
3811
3505
 
3812
3506
  [samples/hello/hello_drag_and_drop.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_drag_and_drop.rb)
3813
3507
 
3814
- Run:
3815
-
3816
- ```
3817
- glimmer sample:run[hello_drag_and_drop]
3818
- ```
3819
-
3820
3508
  ![Hello Drag and Drop](images/glimmer-hello-drag-and-drop.gif)
3821
3509
 
3822
3510
  #### Hello, Menu Bar!
@@ -3827,12 +3515,6 @@ Code:
3827
3515
 
3828
3516
  [samples/hello/hello_menu_bar.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_menu_bar.rb)
3829
3517
 
3830
- Run:
3831
-
3832
- ```
3833
- glimmer sample:run[hello_menu_bar]
3834
- ```
3835
-
3836
3518
  ![Hello Menu Bar](images/glimmer-hello-menu-bar.png)
3837
3519
  ![Hello Menu Bar File Menu](images/glimmer-hello-menu-bar-file-menu.png)
3838
3520
  ![Hello Menu Bar History Menu](images/glimmer-hello-menu-bar-history-menu.png)
@@ -3845,12 +3527,6 @@ Code:
3845
3527
 
3846
3528
  [samples/hello/hello_pop_up_context_menu.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_pop_up_context_menu.rb)
3847
3529
 
3848
- Run:
3849
-
3850
- ```
3851
- glimmer sample:run[hello_pop_up_context_menu]
3852
- ```
3853
-
3854
3530
  ![Hello Pop Up Context Menu](images/glimmer-hello-pop-up-context-menu.png)
3855
3531
  ![Hello Pop Up Context Menu Popped Up](images/glimmer-hello-pop-up-context-menu-popped-up.png)
3856
3532
 
@@ -3862,12 +3538,6 @@ Code:
3862
3538
 
3863
3539
  [samples/hello/hello_custom_widget.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_custom_widget.rb)
3864
3540
 
3865
- Run:
3866
-
3867
- ```
3868
- glimmer sample:run[hello_custom_widget]
3869
- ```
3870
-
3871
3541
  ![Hello Custom Widget](images/glimmer-hello-custom-widget.gif)
3872
3542
 
3873
3543
  #### Hello, Custom Shell!
@@ -3878,17 +3548,43 @@ Code:
3878
3548
 
3879
3549
  [samples/hello/hello_custom_shell.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_custom_shell.rb)
3880
3550
 
3881
- Run:
3882
-
3883
- ```
3884
- glimmer sample:run[hello_custom_shell]
3885
- ```
3886
-
3887
3551
  ![Hello Custom Shell](images/glimmer-hello-custom-shell.png)
3888
3552
  ![Hello Custom Shell Email1](images/glimmer-hello-custom-shell-email1.png)
3889
3553
  ![Hello Custom Shell Email2](images/glimmer-hello-custom-shell-email2.png)
3890
3554
  ![Hello Custom Shell Email3](images/glimmer-hello-custom-shell-email3.png)
3891
3555
 
3556
+ #### Hello, Sash Form!
3557
+
3558
+ This sample demonstrates the use of a `sash_form` in Glimmer.
3559
+
3560
+ Code:
3561
+
3562
+ [samples/hello/hello_sash_form.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_sash_form.rb)
3563
+
3564
+ Hello, Sash Form! Horizontal Orientation
3565
+
3566
+ ![Hello Sash Form](images/glimmer-hello-sash-form.png)
3567
+
3568
+ Hello, Sash Form! Resized
3569
+
3570
+ ![Hello Sash Form Resized](images/glimmer-hello-sash-form-resized.png)
3571
+
3572
+ Hello, Sash Form! Sash Width Changed
3573
+
3574
+ ![Hello Sash Form Sash Width Changed](images/glimmer-hello-sash-form-sash-width-changed.png)
3575
+
3576
+ Hello, Sash Form! Vertical Orientation
3577
+
3578
+ ![Hello Sash Form Vertical](images/glimmer-hello-sash-form-vertical.png)
3579
+
3580
+ Hello, Sash Form! Green Label Maximized
3581
+
3582
+ ![Hello Sash Form Green Maximized](images/glimmer-hello-sash-form-green-maximized.png)
3583
+
3584
+ Hello, Sash Form! Red Label Maximized
3585
+
3586
+ ![Hello Sash Form Red Maximized](images/glimmer-hello-sash-form-red-maximized.png)
3587
+
3892
3588
  ### Elaborate Samples
3893
3589
 
3894
3590
  For more elaborate samples, check the following:
@@ -3903,12 +3599,6 @@ Code:
3903
3599
 
3904
3600
  [samples/elaborate/user_profile.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/user_profile.rb)
3905
3601
 
3906
- Run:
3907
-
3908
- ```
3909
- glimmer sample:run[user_profile]
3910
- ```
3911
-
3912
3602
  ![User Profile](images/glimmer-user-profile.png)
3913
3603
 
3914
3604
  #### Login
@@ -3919,12 +3609,6 @@ Code:
3919
3609
 
3920
3610
  [samples/elaborate/login.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/login.rb)
3921
3611
 
3922
- Run:
3923
-
3924
- ```
3925
- glimmer sample:run[login]
3926
- ```
3927
-
3928
3612
  ![Login](images/glimmer-login.png)
3929
3613
  ![Login Filled In](images/glimmer-login-filled-in.png)
3930
3614
  ![Login Logged In](images/glimmer-login-logged-in.png)
@@ -3939,12 +3623,6 @@ Code:
3939
3623
 
3940
3624
  [samples/elaborate/tic_tac_toe.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/tic_tac_toe.rb)
3941
3625
 
3942
- Run:
3943
-
3944
- ```
3945
- glimmer sample:run[tic_tac_toe]
3946
- ```
3947
-
3948
3626
  ![Tic Tac Toe](images/glimmer-tic-tac-toe.png)
3949
3627
  ![Tic Tac Toe In Progress](images/glimmer-tic-tac-toe-in-progress.png)
3950
3628
  ![Tic Tac Toe Game Over](images/glimmer-tic-tac-toe-game-over.png)
@@ -3957,12 +3635,6 @@ Code:
3957
3635
 
3958
3636
  [samples/elaborate/contact_manager.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/contact_manager.rb)
3959
3637
 
3960
- Run:
3961
-
3962
- ```
3963
- glimmer sample:run[contact_manager]
3964
- ```
3965
-
3966
3638
  Contact Manager
3967
3639
 
3968
3640
  ![Contact Manager](images/glimmer-contact-manager.png)
@@ -4034,7 +3706,7 @@ If you have a Glimmer app you would like referenced here, please mention in a Pu
4034
3706
 
4035
3707
  ## Packaging & Distribution
4036
3708
 
4037
- Note: this section mostly applies to Mac and Windows. On Linux, the Glimmer [Custom Shell Gem](#custom-shell-gem) approach provides a [Gem Packaged Shell Script](#custom-shell-gem) (e.g. `calculator` command becomes available after installing the [glimmer-cs-calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) gem)
3709
+ Note: this section mostly applies to Mac and Windows. On Linux, you can just run `glimmer package:gem` and after installing the gem, you get an executable matching the name of the app/custom-shell-gem you are building (e.g. `calculator` command becomes available after installing the [glimmer-cs-calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) gem)
4038
3710
 
4039
3711
  Glimmer simplifies the process of native-executable packaging and distribution on Mac and Windows via a single `glimmer package` command:
4040
3712