[r749]: dev / base / lib / Kephra.pm  Maximize  Restore  History

Download this file

474 lines (342 with data), 17.1 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
# See end of file for docs
package Kephra;
use 5.006;
use strict;
use warnings;
our $NAME = __PACKAGE__; # name of entire application
our $VERSION = '0.4.3.33'; # version of entire app
our $PATCHLEVEL; # has just stable versions
our $STANDALONE; # starter flag for moveable installations
our $LOGLEVEL; # flag for benchmark loggings
our $BENCHMARK;
# Configuration Phase
sub load_modules { # -NI = not implemented or used, -DEP = depreciated
require Cwd;
require Encode;
require Encode::Guess;
require File::Find;
require File::Spec::Functions;
require File::UserConfig;
require Config::General; #
require YAML::Tiny;
require Wx; # Core wxWidgets Framework
#Wx->import( ':everything' ); # handy while debugging
require Wx::AUI; # movable Panel controler
require Wx::STC; # Scintilla editor component
require Wx::DND; # Drag'n Drop & Clipboard support (only K::File)
require Wx::Locale; # not yet in use
require Wx::Perl::ProcessStream; #
#require Wx::Print; # Printing Support (used only in Kephra::File )
#require Text::Wrap # for text formating
# these will used in near future
#require Perl::Tidy; # -NI perl formating
#require PPI (); # For refactoring support
#require Params::Util (); # Parameter checking
#require Class::Inspector (); # Class checking
# used internal modules, parts of kephra
require Kephra::API; # API for most inter modul communication
require Kephra::App; # App start & shut down sequence
require Kephra::App::ContextMenu; # contextmenu manager
require Kephra::App::EditPanel; # Events, marker, visual settings of the EP
require Kephra::App::EditPanel::Indicator; # visual marker inside the edit panel
require Kephra::App::EditPanel::Fold; # events and visual stuff of 4 EP marigins
require Kephra::App::EditPanel::Margin;# events and visual stuff of 4 EP marigins
require Kephra::App::MainToolBar; # toolbar below the main menu
require Kephra::App::MenuBar; # main menu
require Kephra::App::Panel::CommandLine;#
require Kephra::App::Panel::TreeTool; #
require Kephra::App::Panel::Notepad; #
require Kephra::App::Panel::Output; #
require Kephra::App::SearchBar; # Toolbar for searching and navigation
require Kephra::App::StatusBar; #
require Kephra::App::TabBar; # API 2 Wx::Notebook
require Kephra::App::Window; # API 2 Wx::Frame and more
require Kephra::CommandList; #
require Kephra::Config; # low level config manipulation
require Kephra::Config::Default; # build in emergency settings
#require Kephra::Config::Default::CommandList;
#require Kephra::Config::Default::ContextMenus;
#require Kephra::Config::Default::GlobalSettings;
#require Kephra::Config::Default::Localisation;
#require Kephra::Config::Default::MainMenu;
#require Kephra::Config::Default::ToolBars;
require Kephra::Config::File; # API 2 ConfigParser: Config::General, YAML
require Kephra::Config::Global; # API 4 config, general content level
require Kephra::Config::Localisation; # load store change localisation
require Kephra::Config::Interface; # loading Interface data menus, bars etc
require Kephra::Config::Tree; # data tree manipulation
require Kephra::Dialog; # API 2 dialogs, fileselectors, msgboxes
#require Kephra::Dialog::Color; # color browsing tool
#require Kephra::Dialog::Config; # config dialog
#require Kephra::Dialog::Exit; # select files to be saved while exit program
#require Kephra::Dialog::Info; # info box
#require Kephra::Dialog::Keymap; # -NI
#require Kephra::Dialog::Notify # inform about filechanges from outside
#require Kephra::Dialog::Search; # find and replace dialog
require Kephra::Document; # internal doc handling: create, destroy, etc
require Kephra::Document::Change; # calls for changing current doc
require Kephra::Document::Data; # manage data structure for all docs
require Kephra::Document::Property; # user alterable document settings
require Kephra::Document::SyntaxMode; # language specific settings
require Kephra::Edit; # basic edit menu funktions
require Kephra::Edit::Comment; # comment functions
require Kephra::Edit::Convert; # convert functions
require Kephra::Edit::Format; # formating functions
require Kephra::Edit::History; # undo redo etc.
require Kephra::Edit::Goto; # editpanel textcursor navigation
require Kephra::Edit::Marker; # doc spanning bookmarks
require Kephra::Edit::Search; # search menu functions
require Kephra::Edit::Search::InputTarget; # enables darg n drob for comboboxes
require Kephra::Edit::Select; # text selection
require Kephra::Edit::Special; # collector of unsorted
require Kephra::EventTable; # internal app API
require Kephra::File; # file menu functions
require Kephra::File::History; # list of recent used Files
require Kephra::File::IO; # API 2 FS, read write files
require Kephra::File::Session; # file session handling
require Kephra::Help; # help docs system
require Kephra::Macro; # macro recorder, creation, replay
require Kephra::Menu; # base menu builder
require Kephra::Plugin; # plugin manager
require Kephra::Plugin::Demo; # cookbook for plugin authors
require Kephra::ToolBar; # toolbar builder base
}
sub configdir {
$_[0] and $_[0] eq $NAME and shift;
File::UserConfig->configdir(@_);
}
sub import { #@_;
}
sub start {
load_modules();
my $basedir;
# $ENV{HOME};
# set locations of boot files
my $config_sub_dir = 'config';
my $help_sub_dir = 'help';
my $start_file = 'autosaved.conf';
my $boot_file = File::Spec->catfile
(Kephra::Config::Global::_sub_dir(), $start_file);
my $splashscreen = 'interface/icon/splash/start_kephra.jpg';
if ($Kephra::STANDALONE) {
$basedir = Cwd::cwd();
$basedir = File::Spec->catdir($basedir, 'share')
if $Kephra::STANDALONE eq 'dev';
} else {
my $copy_defaults;
$basedir = Kephra::configdir();
if (not -d File::Spec->catdir($basedir, $config_sub_dir)) {
$copy_defaults = 1
}
else {
my $boot_file = File::Spec->catfile( $basedir, $boot_file );
if (-r $boot_file) {
my $config_tree = Kephra::Config::File::load($boot_file);
$copy_defaults = 1 if not defined $config_tree->{about}{version}
or $config_tree->{about}{version} ne $Kephra::VERSION;
}
}
#if ($copy_defaults) {
#my $dir = File::UserConfig->new();
#if ($^O =~ /(?:linux|darwin)/i) {
#for (@INC) {
#if (!-d File::Spec->catdir($_, $dir->dist())) { next; }
#$dir->{sharedir_} = $_;
#last;
#}
#File::Find::find( sub {
#$dir->{sharedir} = $File::Find::dir
#if ($File::Find::dir =~ /$dir->{dist}.+$config_sub_dir$/)
#}, $dir->{sharedir_}
#);
#$dir->{sharedir} =~ s/$config_sub_dir$//;
#if (!-d $dir->{configdir}) { mkdir($dir->{configdir}); }
#File::Copy::Recursive::dircopy
#("$dir->{sharedir}*", $dir->{configdir}) || warn("$!");
#File::Find::find(sub{
#if (-d $_) { chmod(0750,$_) }
#elsif (-f $_) { chmod(0640,$_) }
#},$dir->{configdir}
#);
#foreach (sort keys %$dir) {print "$_ : $dir->{$_}\n";} exit;
#}
#}
}
my $config_dir = File::Spec->catdir($basedir, $config_sub_dir);
Kephra::Config::_dir( $config_dir );
#Kephra::App::splashscreen($splashscreen);
#use Wx::Perl::SplashFast ( File::Spec->catfile($config_dir, $splashscreen), 150);
Kephra::Config::Global::auto_file( File::Spec->catdir($config_dir, $boot_file) );
Kephra::Help::_dir( File::Spec->catdir($basedir, $help_sub_dir) );
#$Kephra::temp{path}{logger} = File::Spec->catdir($basedir, 'log');
# make .pm config files acessable - absolete when real syntax modes work
push @INC, $config_dir;
Kephra::App->new->MainLoop; # starter for the main app
}
1;
__END__
=head1 NAME
Kephra - crossplatform GUI-Texteditor along Perl alike Paradigms
=head1 SYNOPSIS
> kephra [<files>] # start with files already open
=head1 DESCRIPTION
This module install's a complete editor application with all its configs
and documentation for your programming, web and text authoring.
=head2 Philosophy
=over 3
=item Main Goals
A visually harmonic and beautiful, sparing and elegantly programed Editor,
that helpes you with all your daily tasks. It should be also able to operate
in the way you prefer and be not afraid to try new things.
=item In Depth
I know, I know, there are plenty text editors out there, even some really
mighty IDE, but still no perfect solution for many programmers. So lets
=over 2
learn from Perl what it takes to build a tool thats powerful and fun to
play with for hours and months.
=item * make a low entry barrier (usable like notepad)
=item * copy what people like and are used to and whats not inherently broken
=item * give choices (TimTowtdi)
=over 2
=item * (e.g. deliver vi and emacs input style)
=item * usable with menu, contextmenu, bars, mouse combo, key combos, commands ...
=item * configure via dialog and yaml/conf files ...
=back
=item * highly configurable / adaptable to personal preferences
=item * beauty / good integration on GUI, code and config level
=item * solve things with minimal effort (no bloat / minimal dependencies)
=item * still everything extendable by easy to write plugins
=back
I believe strongly that there is much more possible with GUI editors
and text editors in general than we are used today. So I try to weave
fresh ideas wherever I can and design Kephra in a way, that every
programmer can alter and extend it easily. That can speed up progress
or at least makes Kephra more comfortable for you.
That is the plan, but we are currently not nearly that far.
=item Name
Especially from the last item derives the name, which is old egyptian and means
something like heart. Because true beauty and a harmonic synchronisation of all
parts of the consciousness begins when your heart awakens. Some call that true
love. In egypt tradition this was symbolized with a rising sun (ra) and the
principle of this was pictured as a scarab beatle with wings. Thats also a
nice metaphor for an editor through which we give birth to programs, before
they rise on their own.
=item Details
I believe that Kephra's agenda is very similar to Perl's. Its common wisdom
that freedom means not only happiness but also life works most effective in
freedom. So there should not only be more than one way to write a program,
but also more than one way use an editor. You could:
=over 3
=item * select menu items
=item * make kombinations of keystrokes
=item * point and click your way with the mouse
=item * type short edit commands
=back
=back
So the question should not be vi or emacs, but how to combine the different
strengths (command input field and optional emacs-like keymap possibilities).
Perl was also a combination of popular tools and concepts into a single
powerful language.
Though I don't want to just adopt what has proven to be mighty. There are a lot
of tools (especially in the graphical realm) that are still waiting to be
discovered or aren't widely known. In Perl we write and rewrite them faster
and much more dense than in C or Java. Some function that help me every day
a lot, I written were in very few lines.
But many good tools are already on CPAN and Kephra should just be the glue
and graphical layer to give you the possibilities of these module to your
fingertips in that form you prefer. This helpes also to improve these modules,
when they have more users that can give the authors feedback. It motivates
the community, when we can use our own tools and the perl ecosystem does not
depend on outer software like eclipse, even if it's sometimes useful.
Perl's second slogan is "Keep easy things easy and make hard things possible".
To me it reads "Don't scare away the beginners and grow as you go". And like
Perl I want to handle the complex things with as least effort as possible.
From the beginning Kephra was a useful program and will continue so.
=head2 Features
Beside all the basic stuff that you would expect I listed here some features
by category in main menu:
=over 2
=item File
file sessions, history, simple templates, open all of a dir, insert,
autosave by timer, save copy as, rename, close all other, detection if
file where changed elsewhere
=item Editing
unlimited undo with fast modes, replace (clipboard and selection),
line edit functions, move line/selection, indenting, block formating,
delete trailing space, comment, convert (case, space or indention)
rectangular selection with mouse and keyboard, auto- and braceindention
=item Navigation
bracenav, blocknav, doc spanning bookmarks, goto last edit, last doc,
rich search, incremental search, searchbar and search dialog
=item Tools
run script (integrated output panel), notepad panel, color picker
=item Doc Property
syntax mode, codepage, tab use, tab width, EOL, write protection
=item View
all app parts and margins can be switched on and off, syntaxhighlighting
bracelight, ight margin, indention guide, caret line, line wrap, EOL marker,
visible whitespace, changeable font
=item Configs
config files to be opened through a menu:
settings, all menus, commandID's, event binding, icon binding, key binding,
localisation (translate just one file to transelate the app), syntaxmodes
and some help texts to be opened as normal files
=back
=head1 ROADMAP
=head2 Overview
Enduser Release 0.1
a very simple editor
Enduser Release 0.2
multiple documents, file session
Enduser Release 0.3
searchbar and more comfort
Enduser Release 0.4
This release was about getting the editor liquid or highly configurable.
Its also about improvements in the user interface and of course the little
things we missed. It also contains interpreter output panel and a notepad.
Enduser Release 0.5
This release is about getting Kephra into the 'real' world out there
and adding feature that are most needed and removing most hindering barriers.
Folding, encodings, printing, .... and lot of minor tools and more help.
Enduser Release 0.6
This release will be about extending Kephra internal extensions like a
file brwoser, command line and tree lib as Plugin API.
Enduser Release 0.7
Introducing Syntaxmodes, for language sensitive data and functionions.
Enduser Release 0.8
more heavier stuff like debugger
=head2 This Cycle
=over 2
=item Testing 0.4.1 - code folding
=item Testing 0.4.2 - folding and GUI refined, movable tabs, 2 more tools, doc data
=item Testing 0.4.3 - utf, marker, folding finished, 3 more tools, help links
=item Testing 0.4.4 - new mouse control, 2 more tools, updated docs
=item Testing 0.4.5 - more encodings, local notepad
=item Testing 0.4.6 - config dialog
=item Stable 0.5 - about dialog
=back
=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.
More info and resources you find on our sourceforge web page under:
L<http://kephra.sourceforge.net>
=head1 ACKNOWLEDGMENTS
=over
=item * Herbert Breunung E<lt>lichtkind@cpan.orgE<gt> (main author)
=item * Jens Neuwerk (author of icons, GUI advisor)
=item * Andreas Kaschner (linux and mac ports)
=item * Adam Kennedy E<lt>adamk@cpan.orgE<gt> (cpanification)
=item * Renee B��cker E<lt>module@renee-baecker.deE<gt> (color picker)
=item * Fabrizio Regalli E<lt>fabreg@fabreg.it<gt> (typos)
=item * many more since we study other editors a lot and also the padre sources
=back
=head1 COPYRIGHT AND LICENSE
This Copyright applies only to the "Kephra" Perl software distribution,
not the icons bundled within.
Copyright 2004 - 2010 Herbert Breunung.
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