App-Asciio

 view release on metacpan or  search on metacpan

Todo.txt  view on Meta::CPAN

		- 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

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

					({
					TEXT_ONLY => '',
					TITLE => '',
					EDITABLE => 1,
					RESIZABLE => 1,
					%element_definition,
					}) ;

unless($element_definition{WITH_FRAME})
	{
	# default object attribute is with frame, remove it
	my $box_type = $element->get_box_type() ;
	my ($title, $text) = $element->get_text() ;

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

	for (0 .. $#$box_type)
		{
		next if $_ == $TITLE_SEPARATOR && $title eq '' ;
		

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

my ($title_width,  @title_lines) = (0) ;

$title_text = '' unless defined $title_text ;

for my $title_line (split("\n", $title_text))
	{
	$title_width  = max($title_width, length($title_line)) ;
	push @title_lines, $title_line ;
	}

my ($extra_width, $extra_height) = get_box_frame_size_overhead($box_type) ;

my $display_title = (defined $title_text and $title_text ne '') ? 1 : 0 ;
$text_width  = max($text_width, $title_width)  if $display_title;

if($auto_shrink)
	{
	($end_x, $end_y) = (-5, -5) ;
	}

$end_x = max($end_x, $text_width + $extra_width, $title_width + $extra_width) ;
$end_y = max($end_y, scalar(@lines) + $extra_height + scalar(@title_lines)) ;

my ($box_top, $box_left, $box_right, $box_bottom, $title_separator, $title_left, $title_right) = get_box_frame_elements($box_type, $end_x) ;

my $text = $box_top ;

for my $title_line (@title_lines)
	{
	my $pading =  ($end_x - (length($title_left . $title_line . $title_right))) ;
	my $left_pading =  int($pading / 2) ;
	my $right_pading = $pading - $left_pading ;
	
	$text .= $title_left . (' ' x $left_pading) . $title_line . (' ' x $right_pading) . $title_right ."\n" ;

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

Readonly my  $TITLE_SEPARATOR => 1 ;
Readonly my  $BODY_SEPARATOR => 2 ;
Readonly my  $BOTTOM => 3;

Readonly my  $DISPLAY => 0 ;
Readonly my  $NAME => 1 ;
Readonly my  $LEFT => 2 ;
Readonly my  $BODY => 3 ;
Readonly my  $RIGHT => 4 ;

sub get_box_frame_size_overhead
{
my ($box_type) = @_ ;

my @displayed_elements = grep { $_->[$DISPLAY] } @{$box_type} ;
my $extra_width = max(0, map {length} map {$_->[$LEFT]}@displayed_elements)
				+ max(0, map {length} map {$_->[$RIGHT]}@displayed_elements) ;
				
my $extra_height = 0 ;

for ($TOP, $TITLE_SEPARATOR, $BOTTOM)
	{
	$extra_height++ if defined $box_type->[$_][$DISPLAY] && $box_type->[$_][$DISPLAY] ;
	}

return($extra_width, $extra_height) ;
}

sub get_box_frame_elements
{
my ($box_type, $width) = @_ ;

my ($box_top, $box_left, $box_right, $box_bottom, $title_separator, $title_left, $title_right) = map {''} (1 .. 7) ;

if($box_type->[$TOP][$DISPLAY])
	{
	my $box_left_and_right_length = length($box_type->[$TOP][$LEFT]) + length($box_type->[$TOP][$RIGHT]) ;
	$box_top = $box_type->[$TOP][$LEFT] 
			. ($box_type->[$TOP][$BODY] x ($width - $box_left_and_right_length))   

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

use Clone ;

if(exists $box_types{$data->{TYPE}})
	{
	$self->create_undo_snapshot() ;
	
	my $element_type = $data->{ELEMENT}->get_box_type() ;
	
	my $new_type = Clone::clone($box_types{$data->{TYPE}}) ;
	
	for (my $frame_element_index = 0 ; $frame_element_index < @{$new_type} ; $frame_element_index++)
		{
		$new_type->[$frame_element_index][$DISPLAY] = $element_type->[$frame_element_index][$DISPLAY] 
		}
		
	$data->{ELEMENT}->set_box_type($new_type) ;
	
	$self->update_display() ;
	}
}

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

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

	'Redo' => ['C00-y', \&redo],
	'Display keyboard mapping' => ['000-k', \&display_keyboard_mapping],
	'Display commands' => ['C00-k', \&display_commands],
	'Display action files' => ['C0S-K', \&display_action_files],
	'Zoom in' => ['000-KP_Add', \&zoom, 1],
	'Zoom out' => ['000-minus', \&zoom, -1],
	'Zoom in' => ['000-plus', \&zoom, 1],
	'Zoom out' => ['000-KP_Subtract', \&zoom, -1],
	'Help' => ['000-F1', \&display_help],
	'External command output in a box' => ['000-x', \&external_command_output, 1],
	'External command output in a box no frame' => ['C00-x', \&external_command_output, 0],
	) ;

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

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


$self->display_message_modal(<<EOM) ;

setup/stencils/computer  view on Meta::CPAN

/::::/

EOA

	'computer_small' => <<'EOA',
 __  _ 
[__]|=|
/::/|_|
EOA

	'mainframe' => <<'EOA',
 ________ 
|==|=====|
|  |     |
|  |     |
|  |     |
|  |     |
|  |====°|
|__|_____|
EOA



( run in 2.101 seconds using v1.01-cache-2.11-cpan-e1769b4cff6 )