App-Asciio

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

lib/App/Asciio/Dialogs.pm
lib/App/Asciio/Elements.pm
lib/App/Asciio/Io.pm
lib/App/Asciio/Menues.pm
lib/App/Asciio/Setup.pm
lib/App/Asciio/Undo.pm
lib/App/Asciio/Options.pm
lib/App/Asciio/Stencil.pm

lib/App/Asciio/stripes/angled_arrow.pm
lib/App/Asciio/stripes/editable_arrow2.pm
lib/App/Asciio/stripes/editable_box2.pm
lib/App/Asciio/stripes/if_box.pm
lib/App/Asciio/stripes/process_box.pm
lib/App/Asciio/stripes/wirl_arrow.pm
lib/App/Asciio/stripes/section_wirl_arrow.pm
lib/App/Asciio/stripes/single_stripe.pm
lib/App/Asciio/stripes/stripes.pm

lib/App/Asciio/Utils/Presentation.pm


lib/App/Asciio/GTK/Asciio.pm

lib/App/Asciio/GTK/Asciio/Dialogs.pm
lib/App/Asciio/GTK/Asciio/Menues.pm

lib/App/Asciio/GTK/Asciio/stripes/editable_arrow2.pm
lib/App/Asciio/GTK/Asciio/stripes/wirl_arrow.pm
lib/App/Asciio/GTK/Asciio/stripes/editable_box2.pm

);

for(@pm_files)
	{
	$all_modules{$_} = $_ ;
	push @split_modules, $_ ;
	}

my @setup_lib=

MANIFEST  view on Meta::CPAN

lib/App/Asciio/Dialogs.pm
lib/App/Asciio/Elements.pm
lib/App/Asciio/Io.pm
lib/App/Asciio/Menues.pm
lib/App/Asciio/Setup.pm
lib/App/Asciio/Undo.pm
lib/App/Asciio/Options.pm
lib/App/Asciio/Stencil.pm

lib/App/Asciio/stripes/angled_arrow.pm
lib/App/Asciio/stripes/editable_arrow2.pm
lib/App/Asciio/stripes/editable_box2.pm
lib/App/Asciio/stripes/if_box.pm
lib/App/Asciio/stripes/process_box.pm
lib/App/Asciio/stripes/section_wirl_arrow.pm
lib/App/Asciio/stripes/single_stripe.pm
lib/App/Asciio/stripes/stripes.pm
lib/App/Asciio/stripes/wirl_arrow.pm

lib/App/Asciio/Utils/Presentation.pm

t/001_load.t

MANIFEST  view on Meta::CPAN

documentation/text/permissions.txt

documentation/presentation.pl

# GTK
script/asciio

lib/App/Asciio/GTK/Asciio.pm
lib/App/Asciio/GTK/Asciio/Dialogs.pm
lib/App/Asciio/GTK/Asciio/stripes/wirl_arrow.pm
lib/App/Asciio/GTK/Asciio/stripes/editable_box2.pm
lib/App/Asciio/GTK/Asciio/stripes/editable_arrow2.pm
lib/App/Asciio/GTK/Asciio/Menues.pm

setup/GTK/setup.ini
setup/GTK/actions/clipboard.pl
setup/GTK/import_export/png.pl


META.json

META.json  view on Meta::CPAN

      "App::Asciio::GTK::Asciio" : {
         "file" : "lib/App/Asciio/GTK/Asciio.pm",
         "version" : "0.01"
      },
      "App::Asciio::Stencil" : {
         "file" : "lib/App/Asciio/Stencil.pm"
      },
      "App::Asciio::stripes::angled_arrow" : {
         "file" : "lib/App/Asciio/stripes/angled_arrow.pm"
      },
      "App::Asciio::stripes::editable_arrow2" : {
         "file" : "lib/App/Asciio/stripes/editable_arrow2.pm"
      },
      "App::Asciio::stripes::editable_box2" : {
         "file" : "lib/App/Asciio/stripes/editable_box2.pm"
      },
      "App::Asciio::stripes::if_box" : {
         "file" : "lib/App/Asciio/stripes/if_box.pm"
      },
      "App::Asciio::stripes::process_box" : {
         "file" : "lib/App/Asciio/stripes/process_box.pm"
      },
      "App::Asciio::stripes::section_wirl_arrow" : {
         "file" : "lib/App/Asciio/stripes/section_wirl_arrow.pm"
      },

META.yml  view on Meta::CPAN

  App::Asciio:
    file: lib/App/Asciio.pm
    version: '1.51'
  App::Asciio::GTK::Asciio:
    file: lib/App/Asciio/GTK/Asciio.pm
    version: '0.01'
  App::Asciio::Stencil:
    file: lib/App/Asciio/Stencil.pm
  App::Asciio::stripes::angled_arrow:
    file: lib/App/Asciio/stripes/angled_arrow.pm
  App::Asciio::stripes::editable_arrow2:
    file: lib/App/Asciio/stripes/editable_arrow2.pm
  App::Asciio::stripes::editable_box2:
    file: lib/App/Asciio/stripes/editable_box2.pm
  App::Asciio::stripes::if_box:
    file: lib/App/Asciio/stripes/if_box.pm
  App::Asciio::stripes::process_box:
    file: lib/App/Asciio/stripes/process_box.pm
  App::Asciio::stripes::section_wirl_arrow:
    file: lib/App/Asciio/stripes/section_wirl_arrow.pm
  App::Asciio::stripes::single_stripe:
    file: lib/App/Asciio/stripes/single_stripe.pm
  App::Asciio::stripes::stripes:
    file: lib/App/Asciio/stripes/stripes.pm

Todo.txt  view on Meta::CPAN


zoom on pointer
	#not ctl to zoom
	panning
	scrollbars
	
autosave

connector grouping

cancel button in editing windows

handle unicode (remove write_file)

now arrow can match inside a box, moving an arrow around has become more tricky
	=> do not connect if both ends are unconnected and arrow is being moved

move action constants to module

optimize do_stack serialization
	# use bzip2

Todo.txt  view on Meta::CPAN

#auto stencil
	stencils are 'run' this means that they can be created from other data
	
#remove section at the begining of the arrow
	
#add section at the begining of the arrow
	=> auto connection works but moving the connected object -> error

#dialogs
	#button missing icons
	!assign ctl + enter as OK in edit boxes
		=> alt + C

#vertical text
	
!signing objects and diagrams?

#toggle grid

#text object should be resized to the text size when created

Todo.txt  view on Meta::CPAN

			this let ascioo decide where they should be placed instead for 
			deciding it's around the box
		- the user can add connectors with the same mechanism
		- the connector must be handled when resizing the box object
			by the box object or by the connector itself

#Box added via 'B' shortcut should be selected

#reselect elements after quick link

#select text an focus in text editing window

#error: title has frame when text doesn't

#link to camel box

#background color, grid color

#save file in exit dialog

#continuation _from_ diagonal is not correct

!allow diagonals in setup

#diagonal lines
	#error: connector character is wrong
	#dynamically choose if the arrow allows diagonal or not (keyboard)

#handle error when running external command
	Can't exec "dsq": No such file or directory at '/devel/perl_modules/App/Asciio/blib/lib/App/Asciio/setup//actions/unsorted.pl' line 365.
	Use of uninitialized value in split at /devel/perl_modules/App/Asciio/blib/lib/App/Asciio/stripes/editable_box2.pm line 50.

#paste at the mouse position
	
#per arrow autoconnect

#dynamically add connectors

#copy selected elements to clipboard
	
#move ruler line definition to the setup

Todo.txt  view on Meta::CPAN

	Emanuel Haupt <ehaupt@freebsd.org>

#screencast demo

#remove section

#export png

#possibility to close the application from a script

#return edits the currently selected box

#error: targets are not opened

#register_action_handlers return own data not the evaled package

#script to generate a list of the actions available

#error: |------------>

#error: moving connectors on each other bugs the connector size

Todo.txt  view on Meta::CPAN

	=> load multiple stencils and keep the filesystem structure in the popup menues
	=> allow shortcut to be associated with the stencil elements (by name and in setup files)

#drawing arrow into box connects the arrow

#transfor tabs to space

#only allow start-end connectors to link for multiwirl
	but allow moving of the intermediate connectors

#shortcut that adds elements but opens the edit dialog directly before inserting the object
	should this be the default for object creation from stencils?
		=> shall we add a EDIT_ON_CREATE fields=

#ctl + shift + arrows => connect arrows as connect boxes does

#color groups when using solid background
	=> through a get_element_background_color

#error shift plus select area doesn't work

#do notshow resize rectangle if attribut is not set

#error after aligning box centers, the connectors are real weird in if_elsif.gpad

#verify all the '* $character_' and '\ $character_'

#editing box breaks the connections

#?use DTD::GTK for dumps

!? table element
	=> user defined plugin in the future
	
!one character element should move not resize

#keyboard mapping

Todo.txt  view on Meta::CPAN


#script using cononize_connection doesn't work, path was changed

#make a script library

!update_diagram should be called when running in script mode
	let the script writer decide if they want "optimized" connections or not

# proper setup structure

#editable arrow has connections!! use resize/info/highlight points instead

# export ASCII to clipboard

#quick connect
	if selected elements
		connect element under to selected elements
		deselect all
	else
		select element
		

Todo.txt  view on Meta::CPAN


#front back break connections
#keyboard move doesn't move connections

!cycle color for selection points like for groups?

#move $previous_x, $previous_y to the class

#error: drawing connections on move
#error: drawing connections on resize box
#error: drawing connections on edit

#refactor other end offsetting (used in move and resize)

#missing: save connections

#error moving groups looses connection

#thrown a few boxes and arrows in an empty document

#keyboard short cut

Todo.txt  view on Meta::CPAN


!selection cycles through objects when clicking + tab

#BOX2 with title and text only displays wrong size

#box and arrow streching are not ont the same
	box doesn't accept row 0

#can't loade face file

#edit text to empty string

#if only one element is editable in a group, edit it
	present selection box if multiple editable objects

#handle \ in text for pango

#_ is removed from name in menues

spell cheker

#grouping

Window size in character multiples

documentation/scripting/lib/scripting_lib.pm  view on Meta::CPAN

use strict;
use warnings;
use lib qw(lib lib/stripes) ;

#--------------------------------------------------------------------------------------------

sub new_box
{
my (@arguments_to_constructor) = @_ ;

use App::Asciio::stripes::editable_box2 ;

my $box = new App::Asciio::stripes::editable_box2
				({
				TEXT_ONLY => 'box',
				TITLE => '',
				EDITABLE => 1,
				RESIZABLE => 1,
				@arguments_to_constructor,
				}) ;
				
return($box) ;
}

documentation/scripting/objects.pl  view on Meta::CPAN


use strict;
use warnings;
use lib qw(lib lib/stripes) ;
use Data::TreeDumper ;

use App::Asciio ;
use App::Asciio::stripes::editable_box2 ;
use App::Asciio::stripes::process_box ;
use App::Asciio::stripes::single_stripe ;

#-----------------------------------------------------------------------------

my $asciio = new App::Asciio() ;

#-----------------------------------------------------------------------------

my ($current_x, $current_y) = (0, 0) ;

my $new_box = new App::Asciio::stripes::editable_box2
				({
				TEXT_ONLY => 'box',
				TITLE => '',
				EDITABLE => 1,
				RESIZABLE => 1,
				}) ;
$asciio->add_element_at($new_box, 0, 0) ;

my $new_process = new App::Asciio::stripes::process_box
				({

documentation/scripting/three_boxes.pl  view on Meta::CPAN


use strict;
use warnings;
use lib qw(lib lib/stripes) ;

use App::Asciio;
use App::Asciio::stripes::editable_box2 ;

#-----------------------------------------------------------------------------

my $asciio = new App::Asciio() ;

#-----------------------------------------------------------------------------

my ($current_x, $current_y) = (0, 0) ;

for my $element_text (qw(box_1 box_2 box_3))
	{
	my $new_element = new App::Asciio::stripes::editable_box2
						({
						TEXT_ONLY => $element_text,
						TITLE => '',
						EDITABLE => 1,
						RESIZABLE => 1,
						}) ;
						
	$asciio->add_element_at($new_element, $current_x, $current_y) ;
	
	$current_x += $asciio->{COPY_OFFSET_X} ; 

lib/App/Asciio.pm  view on Meta::CPAN

=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         \     \           \   __________

lib/App/Asciio.pm  view on Meta::CPAN


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} ;
	

lib/App/Asciio/Dialogs.pm  view on Meta::CPAN


print "$title\n$text\n" ;
print "Yes/No/Cancel\n" ;

my $answer = <STDIN> ;
chomp ($answer) ;

return $answer ;
}

sub display_edit_dialog
{
my ($self, $title, $text) = @_ ;

print "$title\n$text\n" ;

my $answer = <STDIN> ;
chomp ($answer) ;

return $answer ;
}

lib/App/Asciio/Elements.pm  view on Meta::CPAN

		}
	}
	
@{$self->{ELEMENTS}} = grep { defined $_} @{$self->{ELEMENTS}} ;

$self->{MODIFIED }++ ;
}

#-----------------------------------------------------------------------------

sub edit_element
{
my ($self, $selected_element) = @_ ;

$selected_element->edit($self) ;

# handle connections
if($self->is_connected($selected_element))
	{
	# disconnect current connections
	$self->delete_connections_containing($selected_element) ;
	}
	
#~ !!! TODO if not already connected to them (same connection)
$self->connect_elements($selected_element) ; # connect to new elements if any

lib/App/Asciio/GTK/Asciio.pm  view on Meta::CPAN


$|++ ;

use strict;
use warnings;

use Glib ':constants';
use Gtk2 -init;
use Gtk2::Gdk::Keysyms ;

use App::Asciio::GTK::Asciio::stripes::editable_arrow2;
use App::Asciio::GTK::Asciio::stripes::wirl_arrow ;
use App::Asciio::GTK::Asciio::stripes::editable_box2;

use App::Asciio::GTK::Asciio::Dialogs ;
use App::Asciio::GTK::Asciio::Menues ;

#-----------------------------------------------------------------------------

our $VERSION = '0.01' ;

#-----------------------------------------------------------------------------

lib/App/Asciio/GTK/Asciio/Dialogs.pm  view on Meta::CPAN


sub display_quit_dialog
{
my ($self, $title, $text) = @_ ;

my $window = new Gtk2::Window() ;

my $dialog = Gtk2::Dialog->new($title, $window, 'destroy-with-parent')  ;
$dialog->set_default_size (300, 150);

add_button_with_icon ($dialog, 'Continue editing', 'gtk-cancel' => 'cancel');
add_button_with_icon ($dialog, 'Save and Quit', 'gtk-save' => 999);
add_button_with_icon ($dialog, 'Quit and lose changes', 'gtk-ok' => 'ok');

my $lable = Gtk2::Label->new($text);
$dialog->vbox->add ($lable);
$lable->show;

my $result = $dialog->run() ;
$result = 'save_and_quit' if "$result" eq "999" ;

lib/App/Asciio/GTK/Asciio/Dialogs.pm  view on Meta::CPAN

        $hbox->show_all ();

        $button->add ($hbox);

        return $button;
}


#-----------------------------------------------------------------------------

sub display_edit_dialog
{
my ($self, $title, $text) = @_ ;

$text ='' unless defined $text ;

my $window = new Gtk2::Window() ;

my $dialog = Gtk2::Dialog->new($title, $window, 'destroy-with-parent')  ;
$dialog->set_default_size (300, 150);
$dialog->add_button ('gtk-ok' => 'ok');

lib/App/Asciio/GTK/Asciio/stripes/editable_arrow2.pm  view on Meta::CPAN


package App::Asciio::stripes::editable_arrow2 ;

use base App::Asciio::stripes::stripes ;

use strict;
use warnings;

use Glib ':constants';
use Gtk2 -init;
use Glib qw(TRUE FALSE);

sub display_box_edit_dialog
{
my ($self) = @_ ;

my $rows = $self->{ARROW_TYPE} ;
my $window = new Gtk2::Window() ;

my $dialog = Gtk2::Dialog->new('Arrow attributes', $window, 'destroy-with-parent')  ;
$dialog->set_default_size (220, 270);
$dialog->add_button ('gtk-ok' => 'ok');

lib/App/Asciio/GTK/Asciio/stripes/editable_arrow2.pm  view on Meta::CPAN

			text => 0,
			) ;
my $column = $treeview->get_column(0) ;
$column->set_sizing('fixed') ;
$column->set_fixed_width(80) ;

my $current_column = 1 ;
for my $column_title('start', 'body', 'end')
	{
	my $renderer = Gtk2::CellRendererText->new;
	$renderer->signal_connect (edited => \&cell_edited, [$model, $rows]);
	$renderer->set_data (column => $current_column );

	$treeview->insert_column_with_attributes 
				(
				-1, $column_title, $renderer,
				text => $current_column,
				editable => 4, 
				);
				
	$current_column++ ;
	}
}

#-----------------------------------------------------------------------------

sub cell_edited 
{
my ($cell, $path_string, $new_text, $model_and_rows) = @_;

my ($model, $rows) = @{$model_and_rows} ;

my $path = Gtk2::TreePath->new_from_string ($path_string);
my $column = $cell->get_data ("column");
my $iter = $model->get_iter($path);
my $row = ($path->get_indices)[0];

lib/App/Asciio/GTK/Asciio/stripes/editable_box2.pm  view on Meta::CPAN


package App::Asciio::stripes::editable_box2 ;

use base App::Asciio::stripes::single_stripe ;

use strict;
use warnings;

use Glib ':constants';
use Gtk2 -init;
use Glib qw(TRUE FALSE);

#-----------------------------------------------------------------------------

sub display_box_edit_dialog
{
my ($self, $title, $text) = @_ ;

my $rows = $self->{BOX_TYPE} ;
	
my $window = new Gtk2::Window() ;

my $dialog = Gtk2::Dialog->new('Box attributes', $window, 'destroy-with-parent')  ;
$dialog->set_default_size (450, 305);
$dialog->add_button ('gtk-ok' => 'ok');

lib/App/Asciio/GTK/Asciio/stripes/editable_box2.pm  view on Meta::CPAN

$row_renderer->set_data (column => 1);

$treeview->insert_column_with_attributes(-1, '', $row_renderer, text => 1) ;

#~ $column->set_sort_column_id (COLUMN_NUMBER);

my $current_column = 2 ;
for my $column_title('left', 'body', 'right')
	{
	my $renderer = Gtk2::CellRendererText->new;
	$renderer->signal_connect (edited => \&cell_edited, [$model, $rows]);
	$renderer->set_data (column => $current_column );

	$treeview->insert_column_with_attributes 
				(
				-1, $column_title, $renderer,
				text => $current_column,
				editable => 5, 
				);
				
	$current_column++ ;
	}
}

#-----------------------------------------------------------------------------

sub cell_edited 
{
my ($cell, $path_string, $new_text, $model_and_rows) = @_;

my ($model, $rows) = @{$model_and_rows} ;

my $path = Gtk2::TreePath->new_from_string ($path_string);
my $column = $cell->get_data ("column");
my $iter = $model->get_iter($path);
my $row = ($path->get_indices)[0];

lib/App/Asciio/GTK/Asciio/stripes/editable_box2.pm  view on Meta::CPAN

}

#-----------------------------------------------------------------------------

#~ sub add_item {
  #~ my ($button, $model) = @_;

  #~ push @articles, {
	#~ number => 0,
	#~ product => "Description here",
	#~ editable => TRUE,
  #~ };

  #~ my $iter = $model->append;
  #~ $model->set ($iter,
               #~ COLUMN_NUMBER, $articles[-1]{number},
               #~ COLUMN_PRODUCT, $articles[-1]{product},
               #~ COLUMN_EDITABLE, $articles[-1]{editable});
#~ }

#~ sub remove_item {
  #~ my ($widget, $treeview) = @_;
  #~ my $model = $treeview->get_model;
  #~ my $selection = $treeview->get_selection;

  #~ my $iter = $selection->get_selected;
  #~ if ($iter) {
      #~ my $path = $model->get_path ($iter);

lib/App/Asciio/GTK/Asciio/stripes/wirl_arrow.pm  view on Meta::CPAN


use base App::Asciio::stripes::stripes ;

use strict;
use warnings;

use Glib ':constants';
use Gtk2 -init;
use Glib qw(TRUE FALSE);

sub display_arrow_edit_dialog
{
my ($self) = @_ ;

my $rows = $self->{ARROW_TYPE} ;
my $window = new Gtk2::Window() ;

my $dialog = Gtk2::Dialog->new('Arrow attributes', $window, 'destroy-with-parent')  ;
$dialog->set_default_size (450, 505);
$dialog->add_button ('gtk-ok' => 'ok');

lib/App/Asciio/GTK/Asciio/stripes/wirl_arrow.pm  view on Meta::CPAN

			text => 0,
			) ;
my $column = $treeview->get_column(0) ;
$column->set_sizing('fixed') ;
$column->set_fixed_width(120) ;

my $current_column = 1 ;
for my $column_title('start', 'body', 'connection', 'body_2', 'end')
	{
	my $renderer = Gtk2::CellRendererText->new;
	$renderer->signal_connect (edited => \&cell_edited, [$model, $rows]);
	$renderer->set_data (column => $current_column );

	$treeview->insert_column_with_attributes 
				(
				-1, $column_title, $renderer,
				text => $current_column,
				editable => 6, 
				);
				
	$current_column++ ;
	}
}

#-----------------------------------------------------------------------------

sub cell_edited 
{
my ($cell, $path_string, $new_text, $model_and_rows) = @_;

my ($model, $rows) = @{$model_and_rows} ;

my $path = Gtk2::TreePath->new_from_string ($path_string);
my $column = $cell->get_data ("column");
my $iter = $model->get_iter($path);
my $row = ($path->get_indices)[0];

lib/App/Asciio/Io.pm  view on Meta::CPAN

		}
	}
}

#-----------------------------------------------------------------------------

sub save_stencil
{
my ($self) = @_ ;

my $name = $self->display_edit_dialog('stencil name') ;

if(defined $name && $name ne q[])
	{
	my $file_name = $self->get_file_name('save') ;

	if(defined $file_name && $file_name ne q[])
		{
		if(-e $file_name)
			{
			my $override = $self->display_yes_no_cancel_dialog

lib/App/Asciio/Stencil.pm  view on Meta::CPAN


BEGIN 
{
use Sub::Exporter -setup => { exports => [ qw(create_box create_element) ] } ;
}

sub create_box
{
my (%element_definition) = @_ ;

use App::Asciio::stripes::editable_box2 ;
my $element = new App::Asciio::stripes::editable_box2
					({
					TEXT_ONLY => '',
					TITLE => '',
					EDITABLE => 1,
					RESIZABLE => 1,
					%element_definition,
					}) ;

unless($element_definition{WITH_FRAME})
	{

lib/App/Asciio/stripes/angled_arrow.pm  view on Meta::CPAN

	$element_definition->{EDITABLE},
	) ;

return $self ;
}

#-----------------------------------------------------------------------------

sub setup
{
my ($self, $glyphs, $end_x, $end_y, $direction, $editable) = @_ ;

(my ($stripes, $width, $height), $direction) = get_arrow($glyphs, $end_x, $end_y, $direction) ;

$self->set
	(
	GLYPHS => $glyphs,
	STRIPES => $stripes,
	WIDTH => $width,
	HEIGHT => $height,
	DIRECTION => $direction,

lib/App/Asciio/stripes/editable_arrow2.pm  view on Meta::CPAN


package App::Asciio::stripes::editable_arrow2 ;

use base App::Asciio::stripes::stripes ;

use strict;
use warnings;

use List::Util qw(min max) ;
use Readonly ;
use Clone ;

lib/App/Asciio/stripes/editable_arrow2.pm  view on Meta::CPAN

	$element_definition->{EDITABLE},
	) ;

return $self ;
}

#-----------------------------------------------------------------------------

sub setup
{
my ($self, $arrow_type, $end_x, $end_y, $editable) = @_ ;

my ($stripes, $real_end_x, $real_end_y) = get_arrow($arrow_type, $end_x, $end_y) ;

$self->set
	(
	STRIPES => $stripes,
	END_X => $real_end_x,
	END_Y => $real_end_y,
	ARROW_TYPE => $arrow_type,
	) ;

lib/App/Asciio/stripes/editable_arrow2.pm  view on Meta::CPAN


#-----------------------------------------------------------------------------

sub set_text
{
my ($self) = @_ ;
}

#-----------------------------------------------------------------------------

sub edit
{
my ($self, $asciio) = @_ ;

return unless $self->{EDITABLE} ;

$self->display_box_edit_dialog() ;

$self->setup($self->{ARROW_TYPE}, $self->{END_X}, $self->{END_Y}, $self->{EDITABLE}) ;
}


#-----------------------------------------------------------------------------

1 ;

lib/App/Asciio/stripes/editable_box2.pm  view on Meta::CPAN


package App::Asciio::stripes::editable_box2 ;

use base App::Asciio::stripes::single_stripe ;

use strict;
use warnings;

use List::Util qw(min max) ;
use Readonly ;
use Clone ;

lib/App/Asciio/stripes/editable_box2.pm  view on Meta::CPAN

	$element_definition->{AUTO_SHRINK},
	) ;

return $self ;
}

#-----------------------------------------------------------------------------

sub setup
{
my ($self, $text_only, $title_text, $box_type, $end_x, $end_y, $resizable, $editable, $auto_shrink) = @_ ;

my ($text_width,  @lines) = (0) ;

for my $line (split("\n", $text_only))
	{
	$text_width  = max($text_width, length($line)) ;
	push @lines, $line ;
	}
	
my ($title_width,  @title_lines) = (0) ;

lib/App/Asciio/stripes/editable_box2.pm  view on Meta::CPAN


$self->set
	(
	TEXT => $text,
	TITLE => $title_text,
	WIDTH => $end_x,
	HEIGHT => $end_y,
	TEXT_ONLY => $text_only,
	BOX_TYPE => $box_type,
	RESIZABLE => $resizable,
	EDITABLE => $editable,
	AUTO_SHRINK => $auto_shrink,
	) ;
}

#-----------------------------------------------------------------------------

use Readonly ;

Readonly my  $TOP => 0 ;
Readonly my  $TITLE_SEPARATOR => 1 ;

lib/App/Asciio/stripes/editable_box2.pm  view on Meta::CPAN

return($self->{TITLE}, $self->{TEXT_ONLY})  ;
}

#-----------------------------------------------------------------------------

sub set_text
{
my ($self, $title, $text) = @_ ;

my @displayed_elements = grep { $_->[$DISPLAY] } @{$self->{BOX_TYPE}} ;
$text = 'edit_me' if($text eq '' && @displayed_elements == 0) ;

$self->setup
	(
	$text,
	$title,
	$self->{BOX_TYPE},
	$self->{WIDTH},
	$self->{HEIGHT},
	$self->{RESIZABLE},
	$self->{EDITABLE},

lib/App/Asciio/stripes/editable_box2.pm  view on Meta::CPAN

	$self->{WIDTH},
	$self->{HEIGHT},
	$self->{RESIZABLE},
	$self->{EDITABLE},
	$self->{AUTO_SHRINK},
	) ;
}

#-----------------------------------------------------------------------------

sub edit
{
my ($self, $asciio) = @_ ;

return unless $self->{EDITABLE} ;

my $text = $self->{TEXT_ONLY} ;
$text = make_vertical_text($text)  if $self->{VERTICAL_TEXT} ;

($text, my $title) = $self->display_box_edit_dialog($self->{TITLE}, $text) ;

my $tab_as_space = $self->{TAB_AS_SPACES} || (' ' x 3) ;

$text =~ s/\t/$tab_as_space/g ;
$title=~ s/\t/$tab_as_space/g ;

$text = make_vertical_text($text) if $self->{VERTICAL_TEXT} ;
	
$self->set_text($title, $text) ;
}

lib/App/Asciio/stripes/if_box.pm  view on Meta::CPAN

	$element_definition->{EDITABLE},
	) ;

return $self ;
}

#-----------------------------------------------------------------------------

sub setup
{
my ($self, $text_only, $end_x, $end_y, $resizable, $editable) = @_ ;

# $end_x, $end_y are used if we want to keep a box size constant if the included text gets smaller
# if_boxes automatically fit to their content (so far) so those variables are not used

$text_only = '' unless defined $text_only ;

my ($text_width,  @lines) = (0) ;

for my $line (split("\n", $text_only))
	{

lib/App/Asciio/stripes/if_box.pm  view on Meta::CPAN


$text .= ' ' x ($half_the_lines + 1) . q{'} . '-' x $text_width . q{'} . "\n" ;

$self->set
	(
	TEXT => $text,
	WIDTH => $width,
	HEIGHT => $number_of_lines + 2,
	TEXT_ONLY => $text_only,
	RESIZABLE => $resizable,
	EDITABLE => $editable,
	) ;
}

#-----------------------------------------------------------------------------

sub get_selection_action
{
my ($self, $x, $y) = @_ ;

if	(

lib/App/Asciio/stripes/if_box.pm  view on Meta::CPAN

my ($self) = @_ ;
return($self->{TEXT_ONLY})  ;
}

#-----------------------------------------------------------------------------

sub set_text
{
my ($self, $text) = @_ ;

$text = 'edit_me' if($text eq '') ;

$self->setup($text, $self->{WIDTH}, $self->{HEIGHT}, $self->{RESIZABLE}, $self->{EDITABLE}) ;
}

#-----------------------------------------------------------------------------

sub edit
{
my ($self, $asciio) = @_ ;

return unless $self->{EDITABLE} ;

my ($text) = $asciio->display_edit_dialog('asciio', $self->{TEXT_ONLY}) ;

my $tab_as_space = $self->{TAB_AS_SPACES} || (' ' x 3) ;
$text =~ s/\t/$tab_as_space/g ;

$self->set_text($text) ;
}

#-----------------------------------------------------------------------------

1 ;

lib/App/Asciio/stripes/process_box.pm  view on Meta::CPAN

	$element_definition->{RESIZABLE},
	) ;

return $self ;
}

#-----------------------------------------------------------------------------

sub setup
{
my ($self, $text_only, $end_x, $end_y, $editable, $resizable) = @_ ;

Readonly my $side_glyphs_size => 4 ; 

$text_only = '' unless defined $text_only ;

my @lines = split("\n", $text_only) ;
@lines = ('')  unless @lines;

my $number_of_lines = scalar(@lines) ;

lib/App/Asciio/stripes/process_box.pm  view on Meta::CPAN

	};
	
$self->set
	(
	STRIPES => \@stripes,
	WIDTH => $element_width,
	HEIGHT => $y_offset + 1,
	LEFT_CENTER_X => $left_center_x,
	RESIZE_POINT_X => $text_width_plus_offset + $side_glyphs_size - 1,
	TEXT_ONLY => $text_only,
	EDITABLE => $editable,
	RESIZABLE => $resizable,
	) ;
}

#-----------------------------------------------------------------------------

sub get_selection_action
{
my ($self, $x, $y) = @_ ;

lib/App/Asciio/stripes/process_box.pm  view on Meta::CPAN

		(
		$text,
		$self->{RESIZE_POINT_X} -	3, # magic number are ugly
		$self->{HEIGHT} - 1,
		$self->{EDITABLE}, $self->{RESIZABLE}
		) ;
}

#-----------------------------------------------------------------------------

sub edit
{
my ($self, $asciio) = @_ ;

return unless $self->{EDITABLE} ;

my ($text_only) = $asciio->display_edit_dialog('asciio', $self->{TEXT_ONLY}) ;

my $tab_as_space = $self->{TAB_AS_SPACES} || (' ' x 3) ;
$text_only =~ s/\t/$tab_as_space/g ;

$self->set_text($text_only) ;
}

#-----------------------------------------------------------------------------

1 ;

lib/App/Asciio/stripes/section_wirl_arrow.pm  view on Meta::CPAN

	$element_definition->{NOT_CONNECTABLE_END},
	) ;

return $self ;
}

#-----------------------------------------------------------------------------

sub setup
{
my ($self, $arrow_type, $points, $direction, $allow_diagonal_lines, $editable, $not_connectable_start, $not_connectable_end) = @_ ;

if('ARRAY' eq ref $points && @{$points} > 0)
	{
	my ($start_x, $start_y, $arrows) = (0, 0, []) ;
	
	my $points_offsets ;
	my $arrow_index = 0 ; # must have a numeric index or 'undo' won't work
	
	for my $point (@{$points})
		{
		my ($x, $y, $point_direction) = @{$point} ;
		
		my $arrow = new App::Asciio::stripes::wirl_arrow
					({
					ARROW_TYPE => $arrow_type,
					END_X => $x - $start_x,
					END_Y => $y - $start_y,
					DIRECTION => $point_direction || $direction,
					ALLOW_DIAGONAL_LINES => $allow_diagonal_lines,
					EDITABLE => $editable,
					}) ;
						
		$points_offsets->[$arrow_index++] = [$start_x, $start_y] ;
		
		push @{$arrows},  $arrow ;
		($start_x, $start_y) = ($x, $y) ;
		}
		
	$self->set
		(
		POINTS_OFFSETS => $points_offsets,
		ARROWS => $arrows,
		
		# keep data to allow section insertion later
		ARROW_TYPE => $arrow_type,
		DIRECTION => $direction,
		ALLOW_DIAGONAL_LINES => $allow_diagonal_lines,
		EDITABLE => $editable,
		NOT_CONNECTABLE_START => $not_connectable_start,
		NOT_CONNECTABLE_END => $not_connectable_end,
		) ;
		
	my ($width, $height) = $self->get_width_and_height() ;
	$self->set
			(
			WIDTH => $width,
			HEIGHT => $height,
			) ;

lib/App/Asciio/stripes/section_wirl_arrow.pm  view on Meta::CPAN

	push @points, [$x_offset + $end_connector->{X}, $y_offset + $end_connector->{Y}, $direction] ;
	
	$arrow_index++ ;
	}

return \@points ;
}

#-----------------------------------------------------------------------------

sub edit
{
my ($self) = @_ ;

return unless $self->{EDITABLE} ;

# add section
# remove section

# handle offset array
}

lib/App/Asciio/stripes/stripes.pm  view on Meta::CPAN

}

#-----------------------------------------------------------------------------

sub set_text
{
}

#-----------------------------------------------------------------------------

sub edit
{
}

#-----------------------------------------------------------------------------

sub match_connector
{
}

#-----------------------------------------------------------------------------

lib/App/Asciio/stripes/wirl_arrow.pm  view on Meta::CPAN

	$element_definition->{EDITABLE},
	) ;

return $self ;
}

#-----------------------------------------------------------------------------

sub setup
{
my ($self, $arrow_type, $end_x, $end_y, $direction, $allow_diagonal_lines, $editable) = @_ ;

my ($stripes, $width, $height) ;

($stripes, $width, $height, $direction) = get_arrow($arrow_type, $end_x, $end_y, $direction, $allow_diagonal_lines) ;

$self->set
	(
	STRIPES => $stripes,
	WIDTH => $width,
	HEIGHT => $height,

lib/App/Asciio/stripes/wirl_arrow.pm  view on Meta::CPAN

	my $new_end_y = $new_y ;

	$self->setup($self->{ARROW_TYPE}, $new_end_x, $new_end_y, $hint || $self->{DIRECTION}, $self ->{ALLOW_DIAGONAL_LINES}, $self->{EDITABLE}) ;

	return(0, 0, $self->{WIDTH}, $self->{HEIGHT}, 'end') ;
	}
}

#-----------------------------------------------------------------------------

sub edit
{
my ($self, $asciio) = @_ ;

return unless $self->{EDITABLE} ;

$self->display_arrow_edit_dialog() ;

my ($stripes, $width, $height, $x_offset, $y_offset) =
	$direction_to_arrow{$self->{DIRECTION}}->($self->{ARROW_TYPE}, $self->{END_X}, $self->{END_Y}) ;

$self->set(STRIPES => $stripes,) ;
}

#-----------------------------------------------------------------------------

1 ;

setup/actions/context_menu_box.pl  view on Meta::CPAN


sub box_context_menu
{
my ($self, $popup_x, $popup_y) = @_ ;
my @context_menu_entries ;

my ($character_width, $character_height) = $self->get_character_size() ;

my @selected_elements = $self->get_selected_elements(1) ;

if(@selected_elements == 1 && 'App::Asciio::stripes::editable_box2' eq ref $selected_elements[0])
	{
	my $element = $selected_elements[0] ;
	
	my ($x, $y) = $self->closest_character($popup_x - ($element->{X} * $character_width) , $popup_y - ($element->{Y} * $character_height)) ;
	
	push @context_menu_entries, 
		[
		'/Rotate text', 
		sub {$element->rotate_text() ;},
		] ;

setup/actions/elements_manipulation.pl  view on Meta::CPAN

	'Select all elements' => ['C00-a', \&select_all_elements],
	'Delete selected elements' =>  ['000-Delete', \&delete_selected_elements],

	'Group selected elements' => ['C00-g', \&group_selected_elements],
	'Ungroup selected elements' => ['C00-u', \&ungroup_selected_elements],
	
	'Move selected elements to the front' => ['C00-f', \&move_selected_elements_to_front],
	'Move selected elements to the back' => ['C00-b', \&move_selected_elements_to_back],
	'Temporary move selected element to the front' => ['0A0-f', \&temporary_move_selected_element_to_front],
	
	'Edit selected element' => ['000-Return', \&edit_selected_element],
	
	'Move selected elements left' => ['000-Left', \&move_selection_left],
	'Move selected elements right' => ['000-Right', \&move_selection_right],
	'Move selected elements up' => ['000-Up', \&move_selection_up],
	'Move selected elements down' => ['000-Down', \&move_selection_down],
	
	'Change arrow direction' => ['000-d', \&change_arrow_direction],
	'Flip arrow start and end' => ['000-f', \&flip_arrow_ends],
	) ;
	
#----------------------------------------------------------------------------------------------

sub edit_selected_element
{
my ($self) = @_ ;

my @selected_elements = $self->get_selected_elements(1) ;

if(@selected_elements == 1)
	{
	$self->create_undo_snapshot() ;
	$self->edit_element($selected_elements[0]) ;
	$self->update_display();
	}
}

#----------------------------------------------------------------------------------------------

sub change_arrow_direction
{
my ($self) = @_ ;

setup/actions/new_elements.pl  view on Meta::CPAN

	'Add if' => ['000-i', \&add_element, ['stencils/asciio/boxes/if', 1]],
	'Add process' => ['000-p', \&add_element, ['stencils/asciio/boxes/process', 1]],
	'Add arrow' => ['000-a', \&add_element, ['stencils/asciio/wirl_arrow', 0]],
	'Add angled arrow' => ['00S-A', \&add_element, ['stencils/asciio/angled_arrow', 0]],
	) ;
	
#----------------------------------------------------------------------------------------------

sub add_element
{
my ($self, $name_and_edit) = @_ ;

$self->create_undo_snapshot() ;

$self->deselect_all_elements() ;

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

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

$element->edit($self) if $edit;

$self->select_elements(1, $element);

$self->update_display() ;
} ;

setup/actions/unsorted.pl  view on Meta::CPAN



$self->display_message_modal(<<EOM) ;

Very short help:

k show the keyboard mapping
CTL+SHIFT+k 
	
b, Add a box
B, Add a box, edit the text directly
CTL+m, Add multiple boxes in one shot

t, Add a text element
CTL+SHIFT+M, Add multiple texts in one shot

quick link:
	select a box
	CTL+SHIFT+ left mouse on the other element
	
a, add a wirl arrow (AsciiO arrow)

setup/actions/unsorted.pl  view on Meta::CPAN

f, flip the arrows (selection)


CTL+click, copy elements
SHIFT+click: add elements to the selection

CTL+g, group elements
CTL+u, ungroup object

Mouse right button shows a context menu.
Double click shows the element editing dialog

EOM
}

#----------------------------------------------------------------------------------------------

sub zoom
{
my ($self, $direction) = @_ ;

setup/actions/unsorted.pl  view on Meta::CPAN


$self->show_dump_window($statistics, 'Undo stack statistics:') ;
}

#----------------------------------------------------------------------------------------------

sub insert_multiple_boxes_from_text_description
{
my ($self, $boxed) = @_ ;

my $text = $self->display_edit_dialog('multiple texts from input', "\ntext\ntext\ntext\ntext" ) ;

if(defined $text && $text ne '')
	{
	$self->create_undo_snapshot() ;
	
	my ($current_x, $current_y) = ($self->{MOUSE_X}, $self->{MOUSE_Y}) ;
	my ($separator) = split("\n", $text) ;
	
	$text =~ s/$separator\n// ;

	my @new_elements ;
	
	for my $element_text (split("$separator\n", $text))
		{
		chomp $element_text ;
		
		my $new_element = new App::Asciio::stripes::editable_box2
							({
							TITLE => '',
							TEXT_ONLY => $element_text,
							EDITABLE => 1,
							RESIZABLE => 1,
							}) ;
							
		if(! $boxed)
			{
			my $box_type = $new_element->get_box_type() ;

setup/actions/unsorted.pl  view on Meta::CPAN

}
	
#----------------------------------------------------------------------------------------------

sub external_command_output
{
my ($self, $in_box) = @_ ;

$self->create_undo_snapshot() ;

my $command = $self->display_edit_dialog('Enter command', '') ;

if(defined $command && $command ne '')
	{
	(my $command_stderr_redirected = $command) =~ s/$/ 2>&1/gsm ;
	my $output = `$command_stderr_redirected` ;
	
	if($?)
		{
		$output = '' unless defined $output ;
		$output = "Can't execute '$command':\noutput:\n$output\nerror:\n$! [$?]" ;

setup/actions/unsorted.pl  view on Meta::CPAN

		push @box,
			BOX_TYPE =>
				[
				[0, 'top', '.', '-', '.', 1, ],
				[0, 'title separator', '|', '-', '|', 1, ],
				[0, 'body separator', '| ', '|', ' |', 1, ], 
				[0, 'bottom', '\'', '-', '\'', 1, ],
				]  ;
		}
		
	use App::Asciio::stripes::editable_box2 ;
	my $new_element = new App::Asciio::stripes::editable_box2
					({
					TEXT_ONLY => $output,
					TITLE => '',
					EDITABLE => 1,
					RESIZABLE => 1,
					@box
					}) ;
		
	$self->add_element_at($new_element, $self->{MOUSE_X}, $self->{MOUSE_Y}) ;



( run in 1.327 second using v1.01-cache-2.11-cpan-de7293f3b23 )