File Coverage

lib/Kephra.pm
Criterion Covered Total %
statement 10 103 9.7
branch 0 12 0.0
condition 0 6 0.0
subroutine 4 7 57.1
pod 0 3 0.0
total 14 131 10.6


line stmt bran cond sub pod time code
1             # See end of file for docs
2             package Kephra;
3            
4 1     1   38039 use 5.006;
  1         4  
  1         40  
5 1     1   5 use strict;
  1         2  
  1         32  
6 1     1   5 use warnings;
  1         15  
  1         1216  
7            
8             our $NAME = __PACKAGE__; # name of entire application
9             our $VERSION = '0.4.3.34'; # version of entire app
10             our $PATCHLEVEL; # has just stable versions
11             our $STANDALONE; # starter flag for moveable installations
12             our $LOGLEVEL; # flag for benchmark loggings
13             our $BENCHMARK;
14            
15             # Configuration Phase
16             sub load_modules { # -NI = not implemented or used, -DEP = depreciated
17 0     0 0 0 require Cwd;
18 0         0 require Encode;
19 0         0 require Encode::Guess;
20 0         0 require File::Find;
21 0         0 require File::Spec::Functions;
22 0         0 require File::UserConfig;
23 0         0 require Config::General; #
24 0         0 require YAML::Tiny;
25            
26 0         0 require Wx; # Core wxWidgets Framework
27             #Wx->import( ':everything' ); # handy while debugging
28 0         0 require Wx::AUI; # movable Panel controler
29 0         0 require Wx::STC; # Scintilla editor component
30 0         0 require Wx::DND; # Drag'n Drop & Clipboard support (only K::File)
31 0         0 require Wx::Locale; # not yet in use
32 0         0 require Wx::Perl::ProcessStream; #
33             #require Wx::Print; # Printing Support (used only in Kephra::File )
34             #require Text::Wrap # for text formating
35            
36             # these will used in near future
37             #require Perl::Tidy; # -NI perl formating
38             #require PPI (); # For refactoring support
39             #require Params::Util (); # Parameter checking
40             #require Class::Inspector (); # Class checking
41            
42             # used internal modules, parts of kephra
43 0         0 require Kephra::API; # API for most inter modul communication
44 0         0 require Kephra::App; # App start & shut down sequence
45 0         0 require Kephra::App::ContextMenu; # contextmenu manager
46 0         0 require Kephra::App::EditPanel; # Events, marker, visual settings of the EP
47 0         0 require Kephra::App::EditPanel::Indicator; # visual marker inside the edit panel
48 0         0 require Kephra::App::EditPanel::Fold; # events and visual stuff of 4 EP marigins
49 0         0 require Kephra::App::EditPanel::Margin;# events and visual stuff of 4 EP marigins
50 0         0 require Kephra::App::MainToolBar; # toolbar below the main menu
51 0         0 require Kephra::App::MenuBar; # main menu
52 0         0 require Kephra::App::Panel::CommandLine;#
53 0         0 require Kephra::App::Panel::TreeTool; #
54 0         0 require Kephra::App::Panel::Notepad; #
55 0         0 require Kephra::App::Panel::Output; #
56 0         0 require Kephra::App::SearchBar; # Toolbar for searching and navigation
57 0         0 require Kephra::App::StatusBar; #
58 0         0 require Kephra::App::TabBar; # API 2 Wx::Notebook
59 0         0 require Kephra::App::Window; # API 2 Wx::Frame and more
60 0         0 require Kephra::CommandList; #
61 0         0 require Kephra::Config; # low level config manipulation
62 0         0 require Kephra::Config::Default; # build in emergency settings
63             #require Kephra::Config::Default::CommandList;
64             #require Kephra::Config::Default::ContextMenus;
65             #require Kephra::Config::Default::GlobalSettings;
66             #require Kephra::Config::Default::Localisation;
67             #require Kephra::Config::Default::MainMenu;
68             #require Kephra::Config::Default::ToolBars;
69 0         0 require Kephra::Config::File; # API 2 ConfigParser: Config::General, YAML
70 0         0 require Kephra::Config::Global; # API 4 config, general content level
71 0         0 require Kephra::Config::Localisation; # load store change localisation
72 0         0 require Kephra::Config::Interface; # loading Interface data menus, bars etc
73 0         0 require Kephra::Config::Tree; # data tree manipulation
74 0         0 require Kephra::Dialog; # API 2 dialogs, fileselectors, msgboxes
75             #require Kephra::Dialog::Color; # color browsing tool
76             #require Kephra::Dialog::Config; # config dialog
77             #require Kephra::Dialog::Exit; # select files to be saved while exit program
78             #require Kephra::Dialog::Info; # info box
79             #require Kephra::Dialog::Keymap; # -NI
80             #require Kephra::Dialog::Notify # inform about filechanges from outside
81             #require Kephra::Dialog::Search; # find and replace dialog
82 0         0 require Kephra::Document; # internal doc handling: create, destroy, etc
83 0         0 require Kephra::Document::Change; # calls for changing current doc
84 0         0 require Kephra::Document::Data; # manage data structure for all docs
85 0         0 require Kephra::Document::Property; # user alterable document settings
86 0         0 require Kephra::Document::SyntaxMode; # language specific settings
87 0         0 require Kephra::Edit; # basic edit menu funktions
88 0         0 require Kephra::Edit::Comment; # comment functions
89 0         0 require Kephra::Edit::Convert; # convert functions
90 0         0 require Kephra::Edit::Format; # formating functions
91 0         0 require Kephra::Edit::History; # undo redo etc.
92 0         0 require Kephra::Edit::Goto; # editpanel textcursor navigation
93 0         0 require Kephra::Edit::Marker; # doc spanning bookmarks
94 0         0 require Kephra::Edit::Search; # search menu functions
95 0         0 require Kephra::Edit::Search::InputTarget; # enables darg n drob for comboboxes
96 0         0 require Kephra::Edit::Select; # text selection
97 0         0 require Kephra::Edit::Special; # collector of unsorted
98 0         0 require Kephra::EventTable; # internal app API
99 0         0 require Kephra::File; # file menu functions
100 0         0 require Kephra::File::History; # list of recent used Files
101 0         0 require Kephra::File::IO; # API 2 FS, read write files
102 0         0 require Kephra::File::Session; # file session handling
103 0         0 require Kephra::Help; # help docs system
104 0         0 require Kephra::Macro; # macro recorder, creation, replay
105 0         0 require Kephra::Menu; # base menu builder
106 0         0 require Kephra::Plugin; # plugin manager
107 0         0 require Kephra::Plugin::Demo; # cookbook for plugin authors
108 0         0 require Kephra::ToolBar; # toolbar builder base
109             }
110            
111             sub configdir {
112 0 0 0 0 0 0 $_[0] and $_[0] eq $NAME and shift;
113 0         0 File::UserConfig->configdir(@_);
114             }
115            
116 1     1   1086 sub import { #@_;
117             }
118            
119             sub start {
120 0     0 0   load_modules();
121            
122 0           my $basedir;
123             # $ENV{HOME};
124             # set locations of boot files
125 0           my $config_sub_dir = 'config';
126 0           my $help_sub_dir = 'help';
127 0           my $start_file = 'autosaved.conf';
128 0           my $boot_file = File::Spec->catfile
129             (Kephra::Config::Global::_sub_dir(), $start_file);
130 0           my $splashscreen = 'interface/icon/splash/start_kephra.jpg';
131            
132 0 0         if ($Kephra::STANDALONE) {
133 0           $basedir = Cwd::cwd();
134 0 0         $basedir = File::Spec->catdir($basedir, 'share')
135             if $Kephra::STANDALONE eq 'dev';
136             } else {
137 0           my $copy_defaults;
138 0           $basedir = Kephra::configdir();
139 0 0         if (not -d File::Spec->catdir($basedir, $config_sub_dir)) {
140 0           $copy_defaults = 1
141             }
142             else {
143 0           my $boot_file = File::Spec->catfile( $basedir, $boot_file );
144 0 0         if (-r $boot_file) {
145 0           my $config_tree = Kephra::Config::File::load($boot_file);
146 0 0 0       $copy_defaults = 1 if not defined $config_tree->{about}{version}
147             or $config_tree->{about}{version} ne $Kephra::VERSION;
148             }
149             }
150            
151             #if ($copy_defaults) {
152             #my $dir = File::UserConfig->new();
153             #if ($^O =~ /(?:linux|darwin)/i) {
154             #for (@INC) {
155             #if (!-d File::Spec->catdir($_, $dir->dist())) { next; }
156             #$dir->{sharedir_} = $_;
157             #last;
158             #}
159             #File::Find::find( sub {
160             #$dir->{sharedir} = $File::Find::dir
161             #if ($File::Find::dir =~ /$dir->{dist}.+$config_sub_dir$/)
162             #}, $dir->{sharedir_}
163             #);
164             #$dir->{sharedir} =~ s/$config_sub_dir$//;
165             #if (!-d $dir->{configdir}) { mkdir($dir->{configdir}); }
166             #File::Copy::Recursive::dircopy
167             #("$dir->{sharedir}*", $dir->{configdir}) || warn("$!");
168             #File::Find::find(sub{
169             #if (-d $_) { chmod(0750,$_) }
170             #elsif (-f $_) { chmod(0640,$_) }
171             #},$dir->{configdir}
172             #);
173             #foreach (sort keys %$dir) {print "$_ : $dir->{$_}\n";} exit;
174             #}
175             #}
176             }
177 0           my $config_dir = File::Spec->catdir($basedir, $config_sub_dir);
178 0           Kephra::Config::_dir( $config_dir );
179             #Kephra::App::splashscreen($splashscreen);
180             #use Wx::Perl::SplashFast ( File::Spec->catfile($config_dir, $splashscreen), 150);
181 0           Kephra::Config::Global::auto_file( File::Spec->catdir($config_dir, $boot_file) );
182 0           Kephra::Help::_dir( File::Spec->catdir($basedir, $help_sub_dir) );
183             #$Kephra::temp{path}{logger} = File::Spec->catdir($basedir, 'log');
184            
185             # make .pm config files acessable - absolete when real syntax modes work
186 0           push @INC, $config_dir;
187            
188 0           Kephra::App->new->MainLoop; # starter for the main app
189             }
190             1;
191            
192             __END__