App-Asciio

 view release on metacpan or  search on metacpan

Todo.txt  view on Meta::CPAN

#saving as xx.txt will not save anything in gpad anymore

! add --setup to locate the setup directory
	=> use file::Repository
	=> use getopt

#override/move gpad internally set variables with variables set in the setup files
	#=> wait till tab to space is defined
	
#command to generate a stencil ready definition from the current state of an object
	=> 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

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

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

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

sub motion_notify_event 
{
my ($self, $event) = @_ ;

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

use strict;
use warnings;

use Data::TreeDumper ;

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

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

sub display_popup_menu
{
my ($self, $event) = @_;

my ($popup_x, $popup_y) = $event->coords() ;

my @menu_items ;

for my $element (@{$self->{ELEMENT_TYPES}})
	{
	(my $name_with_underscore = $element->{NAME}) =~ s/_/__/g ;
	
	push @menu_items, 
		[ "/$name_with_underscore", undef , insert_generator($self, $element, $popup_x, $popup_y), 0 , '<Item>', undef],
	}

for my $menu_entry (@{$self->get_context_menu_entries($popup_x, $popup_y)})
	{
	my($name, $sub, $data) = @{$menu_entry} ;
	(my $name_with_underscore = $name) =~ s/_/__/g ;
	
	push @menu_items, [ $name_with_underscore, undef , $self->menue_entry_wrapper($sub, $data), 0, '<Item>', undef],
	}

push @menu_items, 
	(
	['/File/open', undef , sub {$self->run_actions_by_name('Open') ;}, 0 , '<Item>', undef],
	['/File/save', undef , sub {$self->run_actions_by_name('Save') ;}, 0 , '<Item>', undef],
	[ '/File/save as', undef , sub {$self->run_actions_by_name(['Save', 1]) ;}, 0 , '<Item>', undef],
	) ;
	
if($self->get_selected_elements(1) == 1)
	{
	push @menu_items, [ '/File/save stencil', undef , $self->menue_entry_wrapper(\&save_stencil), 0 , '<Item>', undef ] ;
	}	

my $item_factory = Gtk2::ItemFactory->new("Gtk2::Menu" ,"<popup>") ;
$item_factory ->create_items($self->{widget}, @menu_items) ;

my $menu = $item_factory->get_widget("<popup>") ;

$menu->popup(undef, undef, undef, undef, $event->button, $event->time) ;
}

sub insert_generator 
{ 
my ($self, $element, $x, $y) = @_ ; 
my ($character_width, $character_height) = $self->get_character_size() ;

return sub
	{
	$self->add_new_element_of_type($element, $self->closest_character($x, $y)) ;

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


my Readonly $SHORTCUTS = 0 ;
my Readonly $CODE = 1 ;
my Readonly $ARGUMENTS = 2 ;
my Readonly $CONTEXT_MENUE_SUB = 3 ;
my Readonly $CONTEXT_MENUE_ARGUMENTS = 4 ;
my Readonly $NAME= 5 ;

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

for my $context_menu_handler
	(
	map {$self->{CURRENT_ACTIONS}{$_}}
		grep 
			{
			'ARRAY' eq ref $self->{CURRENT_ACTIONS}{$_} # not a sub actions definition
			&& defined $self->{CURRENT_ACTIONS}{$_}[$CONTEXT_MENUE_SUB]
			} sort keys %{$self->{CURRENT_ACTIONS}}

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

	{
	#~ print "Adding context menue from action '$context_menu_handler->[$NAME]'.\n" ;
	
	if(defined $context_menu_handler->[$CONTEXT_MENUE_ARGUMENTS])
		{
		push @context_menu_entries, 
			$context_menu_handler->[$CONTEXT_MENUE_SUB]->
				(
				$self,
				$context_menu_handler->[$CONTEXT_MENUE_ARGUMENTS],
				$popup_x, $popup_y,
				) ;
		}
	else
		{
		push @context_menu_entries, $context_menu_handler->[$CONTEXT_MENUE_SUB]->($self, $popup_x, $popup_y) ;
		}
	}
	
return(\@context_menu_entries) ;
}

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

1 ;

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


package App::Asciio ;

use strict;
use warnings;

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

sub display_popup_menu
{
}

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

1 ;

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

			[0, 'title separator', '*', '*', '*', 1, ],
			[1, 'body separator', '* ', '*', ' *', 1, ], 
			[1, 'bottom', '*', '*', '*', 1, ],
		],
	) ;

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

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() ;},
		] ;
		
	push @context_menu_entries, 
		[
		'/box selected element', 

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

	$self->move_elements($second_arrow_x_offset, $second_arrow_y_offset, $element) ;

	$self->update_display() ;
	}
}

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

sub multi_wirl_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::section_wirl_arrow' 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, 
		[
			'/append section', 
			\&add_section_to_section_wirl_arrow,
			{ELEMENT => $selected_elements[0], X => $x, Y => $y,}
		] ;
		
	if($element->is_connection_allowed('start'))
		{

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

	
$self->create_undo_snapshot() ;
$self->remove_ruler_lines($data) ;
$self->update_display();
}

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

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

my ($x, $y) = $self->closest_character($popup_x, $popup_y) ;

my $vertical = {TYPE => 'VERTICAL', POSITION => $x} ;
my $horizontal = {TYPE => 'HORIZONTAL', POSITION => $y} ;

if($self->exists_ruler_line($vertical))
	{
	push @context_menu_entries, ["/Ruler/remove vertical ruler", \&remove_ruler,  $vertical] ;
	}
else
	{



( run in 1.695 second using v1.01-cache-2.11-cpan-364913b4093 )