Skip to content

Commit

Permalink
CHANGED: slide mode
Browse files Browse the repository at this point in the history
- support slide steps
- support code elements
	- will support script
- support per slide bindings
  • Loading branch information
nkh committed Dec 5, 2023
1 parent 61de49d commit 3cd9e7f
Show file tree
Hide file tree
Showing 9 changed files with 316 additions and 61 deletions.
88 changes: 88 additions & 0 deletions documentation/mdbook_asciio/src/modes/slides.md
Original file line number Diff line number Diff line change
@@ -1 +1,89 @@
# slides

You can create a slide show with Asciio ... but it's a work in progress. We write some documentation here but you're better off asking the developers directly.

## Bindings

| binding | action |
| ------- | ------ |
| S | enter slides mode |
| Escape | escape slides mode |
| L | Load slides |
| n | next slide |
| N | previous slide |
| g | first slide |
| s | run script |
| n/a | show previous message |
| n/a | show next message |


## Slides Format

Slides are a very simplified script.

```
use strict ;
use warnings ;
use App::Asciio::Utils::Presentation ;
# the slides definition
[
# first slide
[
# text is added to a box at 0, 0
"0 intro",
# you can add scritpt with shortcuts per slide
{
a => sub
{
my ($self) = @_ ;
App::Asciio::Actions::Elements::add_element($self, ['Asciio/box', 0, 20, 20]) ;
},
},
],
# second slide
[
# if you have multiple elements in squre bracket, Asciio uses them as steps in your slide
[ "1.0", ],
[ "1.1", ],
# a step within a step, thereäs no limit but navigation becomes more intricate
[
["1.2.0", ]
],
],
# third slide
[
clear_and_box_at(0, 0, "2"), ],
],
# fourth slide
[
# you can load an asciio file
load(0, 0, 'path/file.asciio'),
# and add elements to the slide
box(10, 20, 'title', '3', 0),
],
# final slide
[
clear_all(),
# multiline box
box(19, 11, '', <<'EOT', 0),
6.0
(\_/)
(O.o) ASCII world domination is near!
(> <)
EOT
],
]
```

Utilities are defined in *lib/App/Asciio/Utils/Presentation.pm*

68 changes: 49 additions & 19 deletions documentation/presentation.pl
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,56 @@
use App::Asciio::Utils::Presentation ;

[

new_slide_single_box_at(13, 10, <<EOT),
A BOX at a specific coordinates
EOT

new_slide_single_box_at(0, 0, "box at at 0, 0"),

new_slide_single_box_at(0, 0, "other box at at 0, 0"),

load_diagram(0, 0, 'path/file.asciio'),

new_slide_single_box_at(0, 0, "Generated by Asciio"),

new_slide_single_box_at(19, 11,<<'EOT'),
[
"0 intro",
{
a => sub
{
my ($self) = @_ ;
App::Asciio::Actions::Elements::add_element($self, ['Asciio/box', 0, 20, 20]) ;
},
},
],

[
[ "1.0", ],
[ "1.1", ],
[
["1.2.0", ]
],
],

[ clear_and_box_at(0, 0, "2"), ],

[
load(0, 0, 'path/file.asciio'),
box(10, 20, 'title', '3', 0),
],

[
clear_all(),
box(0, 0, '', "4 -", 0),
box(10, 20, 'title', '4 --', 0),
],

# multi element slide
[
[ clear_and_box_at(0, 0, "5.0"), ],

[
box(10, 20, 'title', '5.1 -', 0),
box(10, 30, 'title', '5.1 --', 0),
],
],

# final slide
[
clear_all(),
box(19, 11, '', <<'EOT', 0),
6.0
(\_/)
(O.o) ASCII world domination is near!
(> <)
EOT

] ;

],
]
13 changes: 13 additions & 0 deletions documentation/simple_presentation.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use strict ;
use warnings ;

use App::Asciio::Utils::Presentation ;

[
[ "0 intro" ],
[ "1" ],
[ "2" ],
[ "3" ],
[ "4" ],
[ "5 end" ],
]
2 changes: 1 addition & 1 deletion lib/App/Asciio/Actions.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sub use_action_group
{
my ($self, $action) = @_ ; ;

$self->{CURRENT_ACTIONS} = $self->{ACTIONS}{$action} ;
$self->{CURRENT_ACTIONS} = $self->{ACTIONS}{$action} // $self->{ACTIONS_BY_NAME}{$action} ;
}

sub show_binding_completions
Expand Down
4 changes: 2 additions & 2 deletions lib/App/Asciio/Actions/Elements.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ $self->create_undo_snapshot() ;

$self->deselect_all_elements() ;

my ($name, $edit) = @{$name_and_edit} ;
my ($name, $edit, $x, $y) = @{$name_and_edit} ;

my $element = $self->add_new_element_named($name, $self->{MOUSE_X}, $self->{MOUSE_Y}) ;
my $element = $self->add_new_element_named($name, $x // $self->{MOUSE_X}, $y // $self->{MOUSE_Y}) ;

if($edit)
{
Expand Down
Loading

0 comments on commit 3cd9e7f

Please sign in to comment.