Commits

Herbert Breunung committed 4cebb84

first tests

Comments (0)

Files changed (2)

 our $VERSION  = '0.5.0.001';
 
 sub start {
-	start_worker_thread();
-	load_libs();
-	print "good\n";
+    #start_worker_thread();
+    load_libs();
+    #configdir();
+    Kephra::App->new()->MainLoop();
 }
 
-our @external_modules = qw//;
+our @external_dependencies = (
+    qw/Benchmark Encode Encode::Guess /,
+    qw/File::Find File::Spec File::UserConfig Config::General YAML::Tiny/,
+    qw/PPI Moo/,
+    qw/Wx Wx::Perl::ProcessStream/
+);
+our @used_wx_modules = qw/Wx::AUI Wx::STC/;
 
 sub load_libs {
-	require 'Benchmark';
-	require Encode;
-	require Encode::Guess;
-	require File::Find;
-	require File::Spec::Functions;
-	require File::UserConfig;
-	require Config::General;
-	require YAML::Tiny;
-	require PPI;
-	require Moo;
-	require Wx;
-	require Wx::AUI;
-	require Wx::DND;
-	require Wx::Perl::ProcessStream;
+    eval "require $_" for @external_dependencies, @used_wx_modules;
 
-	#require Kephra::API;   # 
-	require Kephra::App;   # visible main application
-	#require Kephra::App::MenuBar;
-	#require Kephra::App::TabBar;
-	#require Kephra::CommandList;
-	#require Kephra::Config::Localisation;
-	#require Kephra::Document;
-	#require Kephra::EventTable;
-	#require Kephra::Logger;
-	#require Kephra::Plugin;
-	#require Kephra::Worker;
+    #require Kephra::API;   # 
+    require Kephra::App;   # visible main application
+    #require Kephra::App::MenuBar;
+    #require Kephra::App::TabBar;
+    #require Kephra::CommandList;
+    #require Kephra::Config::Localisation;
+    #require Kephra::Document;
+    #require Kephra::EventTable;
+    #require Kephra::Logger;
+    #require Kephra::Plugin;
+    #require Kephra::Worker;
 }
 
 
-sub start_worker_thread{ }
+sub start_worker_thread{
+}
 
 sub configdir {
-	$_[0] and $_[0] eq $NAME and shift;
-	print File::UserConfig->configdir(@_);
+    $_[0] and $_[0] eq $NAME and shift;
+    print File::UserConfig->configdir(@_);
 }
 
 sub debug{
-	#Wx->import( ':everything' );
+    #Wx->import( ':everything' );
 }
 
 1;

lib/Kephra/App.pm

 use strict;
 use warnings;
+require Wx;
 
 package Kephra::App;
-
-our @ISA = 'Wx::App';       # $NAME is a wx application
+our @ISA = 'Wx::App';
 
 sub OnInit {
     my $app = shift;
-    my $frame = 
+    my $frame = Wx::Frame->new(undef, -1, __PACKAGE__);
+    my %sizer;
+    $sizer{'main'} = Wx::BoxSizer->new(&Wx::wxHORIZONTAL);
+    $sizer{'leftcolumn'} = Wx::BoxSizer->new(&Wx::wxVERTICAL);
+    $sizer{'centercolumn'} = Wx::BoxSizer->new(&Wx::wxVERTICAL);
+    $sizer{'rightcolumn'} = Wx::BoxSizer->new(&Wx::wxVERTICAL);
+    my $nb = Wx::AuiNotebook->new($frame,-1, [-1,-1], [-1,-1],
+        &Wx::wxAUI_NB_TOP | &Wx::wxAUI_NB_TAB_SPLIT | &Wx::wxAUI_NB_TAB_MOVE | 
+        &Wx::wxAUI_NB_SCROLL_BUTTONS | &Wx::wxAUI_NB_CLOSE_ON_ACTIVE_TAB,
+    );
+    $nb->AddPage(Wx::StyledTextCtrl->new($nb,-1),'<untitled>',1);
+    $sizer{'main'}->Add($sizer{'centercolumn'}, 1, &Wx::wxGROW);
+    $sizer{'centercolumn'}->Add($nb, 1, &Wx::wxGROW);
+
+    Wx::Event::EVT_CLOSE($frame, sub{$frame->Close; $_[1]->Skip });
+
+    $frame->SetSizer( $sizer{'main'});
+    $frame->Center();
+    $frame->Show();
+     $app->ExitMainLoop(1);
     1;
 }
 
 sub OnExit {
+    1;
 }
 
 1;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.