#! /usr/bin/perl -w

#############################################################################
## Author:      Herbert Breunung, Maik Glatki, Wanja Chresta
## Purpose:     Kephra Starter, Checking Directories
## Created:     06/1/2005
## Copyright:   (c) Herbert Breunung, Maik Glatki, Wanja Chresta
## Licence:     GPL
#############################################################################

use strict;
use File::Spec ();

use vars qw{$VERSION $STANDALONE};
my %pathes;
BEGIN {
	$VERSION = '0.3.8.2'; 

	# Is this the standalone Win32 implementation
	$STANDALONE = 1;

	%pathes = (
		config => 'share/config/',
		help   => 'share/help/',
	);

	if  ($^O eq 'MSWin32') {
		push @INC, ( 'pre/lib', 'pre/cpan', 'src', 'lib' );
		my @filenameparts = split( /\\/, __FILE__ );
		my $destination_dir;
		$destination_dir .= "$filenameparts[$_]/" for ( 0 .. $#filenameparts - 2 );
		if ($destination_dir) {
			$pathes{config} = $destination_dir.$pathes{config};
			$pathes{help}   = $destination_dir.$pathes{help};
			chop $destination_dir;
			chdir $destination_dir;
		} else {
		}
	}
	elsif ($^O eq 'linux') {

		# Makefile.PL configuration:
		my $name    = '<name>';
		my $libdir  = '<libdir>';
		my $sharedir= '<sharedir>';
		my $confdir = '<confdir>';
		# Makefile.Pl configuration end

		my $localconf = $ENV{HOME} . '/.' . $name;
		unless ( -e $localconf && -d $localconf ) {
			require File::Copy;    # default package
			require File::Copy::Recursive; #qw(dircopy)
			File::Copy::Recursive::dircopy( $confdir, $localconf ) or die $!;
		}
		$pathes{config} = $localconf . '/';
		$pathes{help}   = $sharedir  . '/help/';
		push @INC, $libdir;
	}
}

use Benchmark ();
my $t0;

BEGIN { $t0 = Benchmark->new; }

use Kephra;
use File::HomeDir ();

	# set directory locations
	$Kephra::temp{path}{config}            = $pathes{config};
	$Kephra::temp{path}{help}              = $pathes{help};
	$Kephra::temp{path}{user}              = $ENV{HOME};
	# set locations of boot files
	$Kephra::temp{file}{config}{auto}      = 'global/autosaved.conf';
	$Kephra::temp{file}{config}{default}   = 'global/default/default.conf';
	# has to be jpeg
	$Kephra::temp{file}{img}{splashscreen} = 'interface/icon/splash/start_kephra.jpg';

	$Kephra::benchmark = 1; # switch for benchmark output

print "src loaded in:",
	Benchmark::timestr( Benchmark::timediff( Benchmark->new, $t0 ) ), "\n"
	if $Kephra::benchmark;

# make config files acessable
push @INC, $Kephra::temp{path}{config};

# first splashscreen without caution to app but fast
#use Wx::Perl::SplashFast ($pathes{config}.$Kephra::temp{file}{img}{splashscreen}, 150) ;

# starter for the main app
Kephra->new->MainLoop;

__END__

=head1 NAME

kephra - crossplatform, CPAN-installable GUI-Texteditor along perllike Paradigms 

=head1 SYNOPSIS

    > kephra [<files>]   # start with certain files open
        

=head1 DESCRIPTION

This module installs a complete editor application with all its configs
and documentation for your programming, web and text authoring. 

=head2 Philosophy

I know, i know, there are plenty text editors out there, even some really
mighty IDE, but this is my attempt to make it better. And by that i don't
meant to make a better vi or emacs nor kommodo, but to carry over to text
editing, what makes perl a great language: A low entry barrier, a high end
and to have a choice between different styles, like the vi command line
input style, the emacs keyboard combinations style and the GUI style. We're
currently not that far but already achieved a good portion.

The other thing is that CPAN, perl's great toolbox has already many modules,
that cover most of the feature, a good IDE needs today. Why don't we use it
for our own programming?

=head2 Features

Beside all the basic stuff that would you expect from a notepad, we have
file sessions, simple templates, recent closed files, and file functions
applied to all files, where it makes sense.

We have also a pile of advanced text navigation, undo, editing, line editing,
and formating funtions like, brace and block navigation, goto last edit,
find in files, fast undo, blockformat and so on, and of cource doc spanning
bookmarks.

Documents have several properties like syntax styling, auto indention, tab
width, tab use, write protection.

View options contain switches for any GUI element and marker for: current
line, end of line bytes, right margin, indetion guides, bracehiglighting,
line wrap and font.


=head1 TO DO

- Complete CPANification

- Lots and lots of other things

=head1 SUPPORT

Bugs should be reported via the CPAN bug tracker at

L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Kephra>

For other issues, contact the author.

=head1 AUTHORS

* Herbert Breunung E<lt>lichtkind@cpan.orgE<gt> (main author)

* Jens Neuwerk E<lt>jenne@gmxpro.netE<gt> (author of icons, GUI advisor)

* Adam Kennedy E<lt>adamk@cpan.orgE<gt> (cpanification)

=head1 COPYRIGHT

This Copyright applies only to the "Kephra" Perl software distribution, not 
the icons bundled within.

Copyright 2004 - 2008 Herbert Breunung. All rights reserved.

This program is free software; you can redistribute
it and/or modify it under the terms of the GNU GPL.

The full text of the license can be found in the
LICENSE file included with this module.
    
=cut