App-Asciio
view release on metacpan or search on metacpan
lib/App/Asciio.pm view on Meta::CPAN
|
O-------------X / |
/ |
/ |
/ v
/
/
v
=head3 multi section wirl arrow
A set of whirl arrows connected to each other
.----------. .
| | \ / \
.-------' ^ \ / \
| \ \ / \
| .-----------> \ ' .
| '----. \ /
| | \ /
'--------' '-------'
=head3 angled arrow and axis
-------. .-------
\ /
\ /
\ /
/ \
/ \
/ \
------' '-------
^
^ | ^
\ | /
\ | /
\ | /
<-------- -------->
/ |\
/ | \
/ | \
v | v
v
=head3 box and text
.----------.
| title |
.----------. |----------| ************
| | | body 1 | * *
'----------' | body 2 | ************
'----------'
anything in a box
(\_/) |
edit_me (O.o) <------------'
(> <)
You can also use the 'External commands in box' to direct an external command output to a box. Default shortcuts are 'x' and CTL + 'x'.
=head3 "if" box and "process" box
____________
.--------------. \ \
/ a == b \ \ \ __________
( && ) ) process ) \ \
\ 'string' ne '' / / / ) process )
'--------------' /___________/ /_________/
=head3 your own stencils
Take a look at I<setup/stencils/computer> for a stencil example. Stencils listed in I<setup/setup.ini> will
be loaded when B<Asciio> starts.
=head3 your own element type
For simple elements, put your design in a box. That should cover 90% of anyone's needs. You can look in
I<lib/stripes> for element implementation examples.
=head2 exporting to ASCII
You can export to a file in ASCII format but using the B<.txt> extension.
Exporting to the clipboard is done with B<ctl + e>.
=head1 EXAMPLES
User code ^ ^ OS code
\ /
\ /
\ /
User code <----Mode----->OS code
/ \
/ \
/ \
User code v v OS code
.---. .---. .---. .---. .---. .---.
OS API '---' '---' '---' '---' '---' '---'
| | | | | |
v v | v | v
.------------. | .-----------. | .-----.
| Filesystem | | | Scheduler | | | MMU |
'------------' | '-----------' | '-----'
| | | |
v | | v
.----. | | .---------.
| IO |<----' | | Network |
'----' | '---------'
| | |
v v v
.---------------------------------------.
lib/App/Asciio.pm view on Meta::CPAN
{
my ($self, $hook_name, @arguments) = @_;
$self->{HOOKS}{$hook_name}->(@arguments) if (exists $self->{HOOKS}{$hook_name}) ;
}
#-----------------------------------------------------------------------------
sub button_release_event
{
my ($self, $event) = @_ ;
my $modifiers = $event->{MODIFIERS} ;
if($self->exists_action("${modifiers}-button_release"))
{
$self->run_actions(["${modifiers}-button_release", $event]) ;
return 1 ;
}
if(defined $self->{MODIFIED_INDEX} && defined $self->{MODIFIED} && $self->{MODIFIED_INDEX} == $self->{MODIFIED})
{
$self->pop_undo_buffer(1) ; # no changes
}
$self->update_display();
}
#-----------------------------------------------------------------------------
sub button_press_event
{
#~ print "button_press_event\n" ;
my ($self, $event, $wrapper_event) = @_ ;
$self->{DRAGGING} = '' ;
delete $self->{RESIZE_CONNECTOR_NAME} ;
$self->create_undo_snapshot() ;
$self->{MODIFIED_INDEX} = $self->{MODIFIED} ;
my $modifiers = $event->{MODIFIERS} ;
my $button = $event->{BUTTON} ;
if($self->exists_action("${modifiers}-button_press-$button"))
{
$self->run_actions(["${modifiers}-button_press-$button", $event]) ;
return 1 ;
}
my($x, $y) = @{$event->{COORDINATES}} ;
if($event->{TYPE} eq '2button-press')
{
my @element_over = grep { $self->is_over_element($_, $x, $y) } reverse @{$self->{ELEMENTS}} ;
if(@element_over)
{
my $selected_element = $element_over[0] ;
$self->edit_element($selected_element) ;
$self->update_display();
}
return 1 ;
}
if($event->{BUTTON} == 1)
{
my $modifiers = $event->{MODIFIERS} ;
my ($first_element) = first_value {$self->is_over_element($_, $x, $y)} reverse @{$self->{ELEMENTS}} ;
if ($modifiers eq 'C00')
{
if(defined $first_element)
{
$self->run_actions_by_name('Copy to clipboard', ['Insert from clipboard', 0, 0]) ;
}
}
else
{
if(defined $first_element)
{
if ($modifiers eq '00S')
{
$self->select_elements_flip($first_element) ;
}
else
{
unless($self->is_element_selected($first_element))
{
# make the element under cursor the only selected element
$self->select_elements(0, @{$self->{ELEMENTS}}) ;
$self->select_elements(1, $first_element) ;
}
}
}
else
{
# deselect all
$self->deselect_all_elements() if ($modifiers eq '000') ;
}
}
$self->{SELECTION_RECTANGLE} = {START_X => $x , START_Y => $y} ;
$self->update_display();
}
if($event->{BUTTON} == 2)
{
$self->{SELECTION_RECTANGLE} = {START_X => $x , START_Y => $y} ;
$self->update_display();
}
if($event->{BUTTON} == 3)
{
$self->display_popup_menu($wrapper_event) ; # display_popup_menu is handled by derived Asciio
}
( run in 0.642 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )