App-Codit

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

bin/codit
Changes
lib/App/Codit.pm
lib/App/Codit/BaseClasses/TextModPlugin.pm
lib/App/Codit/CodeTextManager.pm
lib/App/Codit/codit_logo.png
lib/App/Codit/CoditTagsEditor.pm
lib/App/Codit/Commands.pod
lib/App/Codit/ConfigVariables.pod
lib/App/Codit/Ext/CoditMDI.pm
lib/App/Codit/highlight_theme.ctt
lib/App/Codit/Icons/bookmark_delete.png
lib/App/Codit/Icons/bookmark_new.png
lib/App/Codit/Icons/bookmark_next.png
lib/App/Codit/Icons/bookmark_previous.png
lib/App/Codit/Icons/bookmark_remove.png
lib/App/Codit/Icons/bookmarks.png
lib/App/Codit/Icons/git-icon.png
lib/App/Codit/Icons/show-spaces.png
lib/App/Codit/Macro.pm
lib/App/Codit/Plugins/Backups.pm
lib/App/Codit/Plugins/Bookmarks.pm
lib/App/Codit/Plugins/Colors.pm
lib/App/Codit/Plugins/Console.pm
lib/App/Codit/Plugins/Exporter.pm
lib/App/Codit/Plugins/FileBrowser.pm
lib/App/Codit/Plugins/Git.pm
lib/App/Codit/Plugins/Icons.pm
lib/App/Codit/Plugins/PerlSubs.pm

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

=over 4

=cut

sub Populate {
	my ($self,$args) = @_;

	my $rawdir = Tk::findINC('App/Codit/Icons');
	my %opts = (
#		-appname => 'Codit',
		-logo => Tk::findINC('App/Codit/codit_logo.png'),
		-extensions => [qw[Art CoditMDI ToolBar StatusBar MenuBar Selector Help Settings Plugins]],
		-documentinterface => 'CoditMDI',
		-namespace => 'App::Codit',
		-rawiconpath => [ $rawdir ],
		-savegeometry => 1,
		-updatesmenuitem => 1,

		#configure the application layout.
		-panelgeometry => 'grid',
		-panellayout => [

lib/App/Codit/ConfigVariables.pod  view on Meta::CPAN


Callback to log messages.

=item B<-logerrorcall> in L<Tk::AppWindow>

Callback to log errors.

=item B<-logo> in L<Tk::AppWindow>

Specifies the image file to be used as logo for your application.
Default value is Tk::findINC('Tk/AppWindow/aw_logo.png').

=item B<-logwarningcall> in L<Tk::AppWindow>

Callback to log warnings.

=item B<-mainmenuitems> in L<Tk::AppWindow::Ext::MenuBar>

Default value [].

Configure your menu here. See the section B<CONFIGURING MENUS> below.

lib/App/Codit/Plugins/Exporter.pm  view on Meta::CPAN

	$self->{BACKGROUND} = undef;
	$self->{IMAGE} = undef;
	$self->{IHEIGHT} = 0;
	$self->{IWIDTH} = 0;
	$self->{MAXWIDTH} = 0;
	$self->{XPOS} = 0;
	$self->{TABSTRING} = '';
	$self->{YPOS} = 0;
	$self->cmdConfig(
		'export_html' => ['export2html', $self],
		'export_png' => ['export2png', $self],
	);
	return $self;
}

sub background {
	my $self = shift;
	$self->{BACKGROUND} = shift if @_;
	return $self->{BACKGROUND}
}

lib/App/Codit/Plugins/Exporter.pm  view on Meta::CPAN

	my $text = $widg->get('1.0', 'end - 1c');
	$hl->Parse($text);
	if (open my $fh, '>', $file) {
		print $fh $hl->Format;
		close $fh
	} else {
		$self->logWarning("Can not open '$file'");
	}
}

sub export2png {
	my $self = shift;
	my $mdi = $self->mdi;

	#setting initial values
	my %iv = ();
	my $name = $mdi->docSelected;
	return unless defined $name;
	my $widg = $mdi->docWidget;

	my $folder = $self->configGet('-configfolder');
	if (-e "$folder/export2pngrc") {
		my $cff = $self->extGet('ConfigFolder');
		%iv = $cff->loadHash('export2pngrc', 'exporterpng');
	} else {
		$iv{'background'} = $widg->Subwidget('XText')->cget('-background');
		$iv{'foreground'} = $widg->Subwidget('XText')->cget('-foreground');
		$iv{'themefile'} = $self->extGet('ConfigFolder')->ConfigFolder . '/highlight_theme.ctt';
		$iv{'font'} = $self->configGet('-contentfont');
		$iv{'linenumbers'} = 1;
		$iv{'margins'} = 10;
		$iv{'maxwidth'} = 0;
		$iv{'tabsize'} = 3;
	}
	$iv{'outfile'} = "$name.png";

	#popping the form
	my %options = $self->popForm(
#		-acceptempty => 1,
		-initialvalues => \%iv,
		-oktext => 'Export',
		-structure => [
			'*section' => 'Output',
			outfile => ['file', 'File', -width => 50],
			'*end',

lib/App/Codit/Plugins/Exporter.pm  view on Meta::CPAN

			maxwidth => ['spin', 'Max width', -width => 6],
			margins => ['spin', 'Margins', -width => 6],
			'*end',
		],
		-title => 'Export to PNG',
	);
	return unless %options;

	#saving options
	my $cff = $self->extGet('ConfigFolder');
	$cff->saveHash('export2pngrc', 'exporterpng', %options);

	#checking data
	my $file = delete $options{'outfile'};
	croak "Outfile not specified" if $file eq '';
	my $tabstr = '';
	for (1 .. $options{'tabsize'}) { $tabstr = "$tabstr " }
	$self->background(Imager::Color->new($options{'background'}));
	$self->imargin($options{'margins'});
	$self->linenumbers($options{'linenumbers'});
	$self->linecolumn(length($widg->linenumber('end - 1c')));

lib/App/Codit/Plugins/Exporter.pm  view on Meta::CPAN

			};
			$self->iprint("\n", $fntnorm, $foreground) if $line =~ /\n$/;
		}
		$count++;
		$self->update;
	}
	$self->mdi->progressRemove('exporter');
	
	my $out = $self->inew($self->iwidth, $self->iheight);
	$out->paste(src => $self->image);
	$out->write(file => $file, type => 'png');

}

sub iheight {
	my $self = shift;
	$self->{IHEIGHT} = shift if @_;
	return $self->{IHEIGHT}
}

sub image {

lib/App/Codit/Plugins/Exporter.pm  view on Meta::CPAN

sub maxwidth {
	my $self = shift;
	$self->{MAXWIDTH} = shift if @_;
	return $self->{MAXWIDTH}
}

sub MenuItems {
	my $self = shift;
	return (
		[ 'menu_normal', 'File::Close', 'Export to ~HTML', 'export_html', 'text-html'],
		[ 'menu_normal', 'File::Close', 'Export to P~NG', 'export_png', 'image-x-generic'],
		[ 'menu_separator', 'File::Close',  'F3'],
	)
}

sub tabstring {
	my $self = shift;
	$self->{TABSTRING} = shift if @_;
	return $self->{TABSTRING}
}

sub Unload {
	my $self = shift;
	$self->cmdRemove('export_html');
	$self->cmdRemove('export_png');
	return $self->SUPER::Unload;
}

sub xpos {
	my $self = shift;
	$self->{XPOS} = shift if @_;
	return $self->{XPOS}
}

sub ypos {



( run in 0.924 second using v1.01-cache-2.11-cpan-df04353d9ac )