CodeManager

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

2. Now on $project_color variable is randomly generated from the array @warpColors

3. menuBackColor is synchronized with project_color.

4. changed the order in menu: the Project.

5. added colors (synchronized with the project one) to frames and some other minor

changes in a look.

6. Added to popup show window the option (Full) Delete and the old one changed into Backup.
Added modal feature to this popup. Also added Copy feature.

File.pm
7. Some order changes.

Notebooks.pm
8. changed the width of edit area and file formating changes.

lib/Prima/CodeManager/Changes  view on Meta::CPAN


2. Now on $project_color variable is randomly generated from the array @warpColors

3. menuBackColor is synchronized with project_color.

4. changed the order in menu: the Project.

5. added colors (synchronized with the project one) to frames and some other minor
changes in a look.

6. Added to popup show window the option (Full) Delete and the old one changed into Backup.
Added modal feature to this popup. Also added Copy feature.

7. Added saving modified files during closing whole program

8. Added independent encoding for each project

9. Some order changes.

10. changed the width of edit area and file formating changes.

11. Replace the way of files displaying; instead just those

lib/Prima/CodeManager/CodeManager.pm  view on Meta::CPAN


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

our %developer;
our %info_of_files;
our @list_of_files;
our %file_encodings; #this is a hash of the files encodings
our %all_extensions;
our $file_number = 0;

my $popup;

#-------------------------------------------------------
my $int_color = int(rand(360));
my $int_white = 170;
my $int_black =  40;
my $project_color = Prima::CodeManager::Misc::angle_color( undef, $int_color, $int_white, $int_black );

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

sub new

lib/Prima/CodeManager/CodeManager.pm  view on Meta::CPAN

			backColor	=>	$self->licz_kolor( 0xffffff, $project_color, 0.5 ),
			light3DColor=>	$self->licz_kolor( 0xffffff, $project_color, 0.6 ),
			dark3DColor	=>	$self->licz_kolor( 0xffffff, $project_color, 0.4 ),
		},
		items			=>	@items,
		indent			=>	$self->{global}->{GLOBAL}{tree_itemIndent},
		itemHeight		=>	$self->{global}->{GLOBAL}{tree_itemHeight},
#		multiSelect		=>	1,
		hScroll			=>	1,
		vScroll			=>	1,
		popupFont	=>	{
			name		=>	'DejaVu Sans',
			size		=>	9,
			style		=>	fs::Normal,
		},
		font		=>	{
			name		=>	$self->{global}->{GLOBAL}{tree_fontName},
			$type_dimen	=>	$font_dimen,
			style		=>	fs::Normal,
		},
		onMouseClick	=>	sub {
			my ($this, $btn, $mod, $x, $y, $dblclk) = @_;
			my $clicked = int( $this->topItem + ($self->{tree}-> height - $y)/$this-> itemHeight );
			if ( $btn == 4 && !$dblclk ) {
				$this-> deselect_all ();
				$this-> select_item ( $clicked );
				$this-> focusedItem ( $clicked );
				$popup = $self->popup_show (
					$this,
					$clicked,
					left		=>	$self->{frame_left}-> left   + $x,
					bottom		=>	$self->{frame_left}-> bottom + $y,
					title		=>	'Making tree',
					itemHeight	=>	$this-> itemHeight,
				);
			}
			my @arr = $this-> get_item( $clicked );
			if ( $arr[0]->[0] ) {

lib/Prima/CodeManager/CodeManager.pm  view on Meta::CPAN

#		Prima::Notebook::delete_page( $developer{notes}, $page, 1 ) ;
#	}
	@list_of_files = ();
	$file_number = 0;
	$developer{notes}-> set_tabs( @list_of_files );
	$developer{notes}-> repaint;
}

################################################################################

sub popup_show
{
	my ( $self, $tree, $clicked ) = @_;
	my @arr   = $tree-> get_item( $clicked );
	my $level = $arr[0]->[0]->[2];
	my $name  = $arr[0]->[0]->[0];
	my $type  = $arr[0]->[0]->[3]||'',
	my $dir   = $arr[0]->[0]->[4],
	my $bra   = $arr[0]->[0]->[5],
	my %par;
	my $i = 3;
	while ( my $key = $_[$i] ) { $par{$key} = $_[$i+1]; $i += 2 }
	$par{left}   = 0 unless $par{left};
	$par{bottom} = 0 unless $par{bottom};
	$par{width}  = 740;
	$par{height} = 240;
	my $x = [$self->{mw}->origin]->[0] + [$self->{frame_left}->pointerPos]->[0];
	my $y = [$self->{mw}->origin]->[1] + [$self->{frame_left}->pointerPos]->[1] - $par{height} + $par{itemHeight};
	my $tmp_popup = Prima::Dialog-> create(
		title		=> $par{title},
		text		=> $par{title},
		origin		=> [ $x,          $y ],
		size		=> [ $par{width}, $par{height} ],
#		borderIcons	=> 0,
#		borderStyle	=> bs::None,
		backColor	=> $self->licz_kolor( 0xffffff, $project_color, 0.5, 0 ),
		onPaint => sub {
			my ( $this, $canvas) = @_;
			$canvas-> clear;

lib/Prima/CodeManager/CodeManager.pm  view on Meta::CPAN

			]);
			$canvas-> color( $self->licz_kolor( 0xffffff, $project_color, 0.5, 0 ) );
			$canvas-> fillpoly([
				$margin + $width,						$margin + $width,
				$margin + $width,						$this-> height - $margin - 1 - $width,
				$this-> width - $margin - 1 - $width,	$this-> height - $margin - 1 - $width,
				$this-> width - $margin - 1 - $width,	$margin + $width
			]);
		},
	);
	$tmp_popup->insert( Label =>
		origin	=>	[ 10, $par{height} - 30 ],
		size	=>	[ $par{width} - 20,  20 ],
		text	=>	$name,
		flat	=>	1,
		x_centered	=> 1,
		alignment	=>	ta::Center,
		color		=>	$self->licz_kolor( 0x000000, $project_color, 0.8, 0 ),
		borderWidth	=>	1,
		font 		=>	{	size	=>	10,	style	=>	fs::Normal,	},
	);
	$tmp_popup->insert( Button =>
		origin		=>	[ 10, 10 ],
		size		=>	[ 80, 20 ],
		text		=>	'Cancel',
		enabled		=>	1,
		flat		=>	0,
		color		=>	0x000000,
		borderWidth	=>	1,
		borderColor =>	0xffffff,
		backColor	=>	$self->licz_kolor( 0xffffff, $project_color, 0.8, 0 ),
		font 		=>	{	size	=>	9,	style	=>	fs::Normal,	},
		onClick	=>	sub {
			$tmp_popup->close;
			undef $popup;
		},
	);
#----------------------------------------------------------------
	my $input = $tmp_popup-> insert( InputLine =>
		origin		=>	[  10,  $par{height} -55 ],
		size		=>	[ 480,  20 ],
		text		=>	$name,
		flat		=>	0,
		alignment	=>	ta::Left,
		color		=>	0x000000,
		borderWidth	=>	1,
		font 		=>	{
			size	=>	10,
			style	=>	fs::Normal,

lib/Prima/CodeManager/CodeManager.pm  view on Meta::CPAN

			next unless $file && $name;
			if ( $file ne 'line' ) {
				$j++;
				push @template_files, $file;
				push @template_names, "$j. $name";
			} else {
				push @template_names, "";
			}
		}
	}
	my $check1 = $tmp_popup-> insert( ComboBox =>
		origin		=>	[  10,  $par{height} -80 ],
		size		=>	[ 480,  20 ],
		style		=>	(cs::DropDownList),
		items		=>	[( @template_names )],
		flat		=>	1,
		font 		=>	{
			size	=>	9,
			style	=>	fs::Normal,
		},
	);
#-------------------------------------------------------------
	$tmp_popup-> insert( Button =>
		origin		=>	[ 500, $par{height} - 55 ],
		size		=>	[ 230,  20 ],
		text		=>	'Insert',
		enabled		=>	1,
		flat		=>	0,
		color		=>	0x000000,
		borderWidth	=>	1,
		borderColor =>	0xffffff,
		backColor	=>	$self->licz_kolor( 0xffffff, $project_color, 0.8, 0 ),
		font 		=>	{	size	=>	9,	style	=>	fs::Normal,	},

lib/Prima/CodeManager/CodeManager.pm  view on Meta::CPAN

						action	=>	'Insert',
						name	=>	"$dir/$tmp_name".$input-> text,
						branch	=>	$bra,
						template=>	$template_file,
					);
					if ( $info eq 'OK' ) {
							$self-> make_tree;
					} else {
						Prima::message ( $info );
					}
					$tmp_popup-> close();
					undef $popup ;
				} else {
					Prima::message ( "The name [$name] already exists!" );
				}
			}
		},
	);
#-------------------------------------------------------------
	$tmp_popup->insert( Button =>
		origin		=>	[ 500,  $par{height} - 80 ],
		size		=>	[ 230,  20 ],
		text		=>	'Update',
		enabled		=>	1,
		flat		=>	0,
		color		=>	0x000000,
		borderWidth	=>	1,
		borderColor =>	0xffffff,
		backColor	=>	$self->licz_kolor( 0xffffff, $project_color, 0.8, 0 ),
		font 		=>	{ size => 9, style => fs::Normal, },

lib/Prima/CodeManager/CodeManager.pm  view on Meta::CPAN

				Prima::message ( "The same name!" );
			} else {
				my $info = $self-> make_object (
					action		=>	'Update',
					name		=>	"$dir/".$input->text,
					branch		=>	$bra,
					old_name	=>	"$dir/".$name,
				);
				if ( $info eq 'OK' ) {
					$self-> make_tree;
					$tmp_popup->close();
					undef $popup ;
				} else {
					Prima::message ( $info );
				}
			}
		},
	);
#-------------------------------------------------------------
	$tmp_popup->insert( Button =>
		origin		=>	[ 500,  $par{height} -105 ],
		size		=>	[ 230,  20 ],
		text		=>	'Backup',
		enabled		=>	1,
		flat		=>	0,
		color		=>	0x000000,
		borderWidth	=>	1,
		borderColor =>	0xffffff,
		backColor	=>	$self->licz_kolor( 0xffffff, $project_color, 0.8, 0 ),
		font 		=>	{	size	=>	9,	style	=>	fs::Normal,	},
		onClick		=>	sub {
			my $info = $self-> make_object (
				action	=>	'Backup',
				name	=>	"$dir/".$name,
				branch	=>	$bra,
			);
			if ( $info eq 'OK' ) {
				my ( $x, $l ) = $tree-> get_item( $tree-> focusedItem );
				$tree-> delete_item ( $x );
				$tmp_popup->close();
				undef $popup ;
			} else {
				Prima::message ( $info );
			}
		},
	);
#-------------------------------------------------------------
	$tmp_popup->insert( Button =>
		origin		=>	[ 500,  $par{height} -130 ],
		size		=>	[ 230,  20 ],
		text		=>	'Copy',
		enabled		=>	1,
		flat		=>	0,
		color		=>	0x000000,
		borderWidth	=>	1,
		borderColor =>	0xffffff,
		backColor	=>	$self->licz_kolor( 0xffffff, $project_color, 0.8, 0 ),
		font 		=>	{	size	=>	9,	style	=>	fs::Normal,	},

lib/Prima/CodeManager/CodeManager.pm  view on Meta::CPAN

				Prima::message ( "The same name!" );
			} else {
				my $info = $self-> make_object (
					action		=>	'Copy',
					old_name	=>	"$dir/".$name,
					name		=>	"$dir/".$input->text,
					branch		=>	$bra,
				);
				if ( $info eq 'OK' ) {
					$self-> make_tree;
					$tmp_popup->close();
					undef $popup ;
				} else {
					Prima::message ( $info );
				}
			}
		},
	);

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

	$tmp_popup->insert( Button =>
		origin		=>	[ 500,  $par{height} -155 ],
		size		=>	[ 230,  20 ],
		text		=>	'Delete',
		enabled		=>	1,
		flat		=>	0,
		color		=>	0x000000,
		borderWidth	=>	1,
		borderColor =>	0xffffff,
		backColor	=>	$self->licz_kolor( 0xffffff, $project_color, 0.8, 0 ),
		font 		=>	{	size	=>	9,	style	=>	fs::Normal,	},
		onClick		=>	sub {
			my $info = $self-> make_object (
				action	=>	'Delete',
				name	=>	"$dir/".$name,
				branch	=>	$bra,
			);
			if ( $info eq 'OK' ) {
				my ( $x, $l ) = $tree-> get_item( $tree-> focusedItem );
				$tree-> delete_item ( $x );
				$tmp_popup->close();
				undef $popup ;
			} else {
				Prima::message ( $info );
			}
		},
	);
#-------------------------------------------------------------
	$tmp_popup->insert( Button =>
		origin		=>	[ 500,  10 ],
		size		=>	[ 230,  20 ],
		text		=>	'find files with the text',
		enabled		=>	1,
		flat		=>	0,
		color		=>	0x000000,
		borderWidth	=>	1,
		borderColor =>	0xffffff,
		backColor	=>	$self-> licz_kolor( 0xffffff, $project_color, 0.8, 0 ),
		font 		=>	{ size => 9, style => fs::Normal, },

lib/Prima/CodeManager/CodeManager.pm  view on Meta::CPAN

			my $cap = join "\n",@files,"\n";
			$developer{ftt}-> set (
				items	=>	[@files],
				onMouseClick	=>	sub {
					my ($this, $btn, $mod, $x, $y, $dblclk ) = @_;
					my $clicked	= int( $this-> topItem + ($developer{ftt}-> height - $y)/$this-> itemHeight );
					my $fn		= $developer{ftt}-> items-> [$clicked] ? $developer{ftt}-> items-> [$clicked] : '';
					$self-> file_edit( $fn, $bra ) if $dblclk && -f $fn;
				}
			);
			$tmp_popup-> close();
			undef $popup ;
		},
	);
	$tmp_popup->execute;
	return $tmp_popup;
}

########################################################################

sub make_object
{
	my ( $self ) = shift;
	my %par;
	while ( my $key = shift ) { $par{$key} = shift }
	return "No name defined!" unless $par{name};

lib/Prima/CodeManager/File.pm  view on Meta::CPAN

	return unless find_dialog(0);
	$self-> do_find;
}
################################################################################
sub about
{
	my ( $self ) = @_;
	my $project_color = 0x0088ff;
	my @dim = ( 360, 170 );
#	my $img = $self-> load_icon( "$::Prima::CodeManager::CodeManager_directory/img/CodeManager64.png" );
	my $tmp_popup = Prima::Dialog-> create(
		icon => $self-> load_icon( "$Prima::CodeManager::CodeManager_directory/img/cm64.png" ),
		title		=> "CodeManager - About",
		text		=> "CodeManager - About",
		size		=>	[ @dim ],
		origin		=>	[ 0, 0 ],
		borderIcons	=>  bi::SystemMenu,
		centered	=>	1,
#		borderStyle	=> bs::None,
		backColor	=> $self->licz_kolor( 0xffffff, $project_color, 0.5, 0 ),
		onPaint => sub {

lib/Prima/CodeManager/File.pm  view on Meta::CPAN

			$canvas-> fillpoly([
				$margin + $width,						$margin + $width,
				$margin + $width,						$this-> height - $margin - 1 - $width,
				$this-> width - $margin - 1 - $width,	$this-> height - $margin - 1 - $width,
				$this-> width - $margin - 1 - $width,	$margin + $width
			]);
#			$canvas-> put_image( $dim[0]/2-64, $dim[1] - 64 - 10, $img );
		},
	);
	my $height = 18;
	$tmp_popup-> insert (
		Label	=>
		origin		=>	[ 10, $dim[1]-15 - $height ],
		size		=>	[ $dim[0]-20, $height ],
		text		=>	"This is CodeManager, ver. $Prima::CodeManager::VERSION",
		flat		=>	1,
		x_centered	=> 1,
		alignment	=>	ta::Center,
		color		=>	$self->licz_kolor( 0x000000, $project_color, 0.6, 0 ),
		borderWidth	=>	1,
		font 		=>	{
			height	=>	$height,
			style	=>	fs::Bold,
		},
	);
	my $about = "Copyright 2009-2013 by Waldemar Biernacki\n" .
		"http://codemanager.sao.pl\n" .
		"\n" .
		"\nLicense statement:\n" .
		"This program/library is free software; you can redistribute it\n" .
		"and/or modify it under the same terms as Perl itself.";
	$tmp_popup->insert( Label =>
		origin		=>	[ 10, 30 ],
		size		=>	[ $dim[0] - 20, $dim[1] - 75 ],
		text		=>	$about,
		flat		=>	1,
		x_centered	=>	1,
		alignment	=>	ta::Center,
		color		=>	$self->licz_kolor( 0x000000, $project_color, 0.6, 0 ),
		borderWidth	=>	1,
		font 		=>	{ size=>8, style=>fs::Normal, },
	);
	$tmp_popup->insert( Button =>
		origin		=>	[ int($dim[0]/2) - 40, 10 ],
		size		=>	[ 80, 20 ],
		text		=>	'OK',
		enabled		=>	1,
		flat		=>	0,
		color		=>	0x000000,
		color		=>	0xffffff,
		borderWidth	=>	1,
		borderColor =>	0xffffff,
		backColor	=>	$self->licz_kolor( 0xffffff, $project_color, 0.3, 0 ),
		font 		=>	{	size	=>	9,	style	=>	fs::Normal,	},
		onClick	=>	sub { $tmp_popup->close; },
	);
	$tmp_popup->execute;
	return;
}
1;
__END__

=pod

=head1 NAME

Prima::CodeManager::File - functions to open, read, save and close project files



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