Commits

Herbert Breunung  committed eddfad5

first half of switch from editor to docbar view

  • Participants
  • Parent commits 2856f2b
  • Branches sp3

Comments (0)

Files changed (5)

File lib/Kephra/API.pm

  #'$ed'     => { switch => 'editor',      class => 'Kephra::App::Editor' },
 #});
 
-#sub app                 { $Kephra::App::_ref }
-#sub main_window         { $Kephra::App::Window::_ref }
+sub app                 { $Kephra::App::_ref }
+sub main_window         { $Kephra::App::Window::_ref }
 #sub docbar              { Kephra::App::Part::Editor::docbar() }
 #sub all_docbars         { Kephra::App::Part::Editor::all_docbars() }
 #sub passive_docbars     { Kephra::App::Part::Editor::passive_docbars() }
-#sub document            { Kephra::API::Doc::active() }
-#sub all_documents       { Kephra::API::Doc::all() }
+sub document            { Kephra::API::DocumentStash::active_doc() }
+sub all_documents       { Kephra::API::DocumentStash::all_docs() }
 #sub do_with_all_editors {&Kephra::API::Doc::do_with_all_editors }
 #sub editor              { Kephra::API::Doc::active_editor() }
 

File lib/Kephra/API/DocumentStash.pm

 use Scalar::Util qw(blessed looks_like_number);
 
 
-sub active        { $active || '' }
+sub active_doc    { $active || '' }
 sub active_editor { $active->editor->{Kephra::API::docbar()} if $active }
 sub active_panel  { $active->panel->{Kephra::API::docbar()} if $active }
 sub set_active {
 	$active = $doc if $doc;
 }
 sub previous      { App::Kephra::Focus::last( DOC_CLASS ) }
-sub all           { values %{$document{'ID'}} }
+sub all_docs      { values %{$document{'ID'}} }
 
 sub is { return 1 if blessed($_[0]) and $_[0]->isa( DOC_CLASS ); return 0 }
 
 sub file_loaded {
 	my $file_path = shift;
 	#Kephra::Log::warning("needs a file path as input!") unless $file_path and -e $file_path;
-	for my $doc ( all() ) {
+	for my $doc ( all_docs() ) {
 		return 1 if $doc->file_path and $doc->file_path eq $file_path;
 	}
 }
 
 sub all_editors { keys %{$document{'editor'}} }
 sub do_with_all_editors {
+	
 }
 
 1;

File lib/Kephra/App.pm

 use Kephra::API;
 use Kephra::App::Window;
 
+our $_ref;
+
 sub OnInit {
-	my $app   = shift;
+	my $app   = $_ref = shift;
 	my $frame = Kephra::App::Window->new($Kephra::NAME.' SP3 '.$Kephra::VERSION);
 
 	$frame->Show(1);

File lib/Kephra/App/Bar/Document.pm

 		$event->Veto;
 		Kephra::File::close_active();
 	});
-	 keep focus on editor even when klicking on tab bar
-	Wx::Event::EVT_LEFT_DOWN( $self, sub { Kephra::API::active_editor()->focus; print "--down"; });
-	$self->Connect( -1, -1, &Wx::wxEVT_SET_FOCUS, sub {  print "--"; } )
-	Wx::Event::EVT_SET_FOCUS( $self, sub { my ($bar, $event ) = @_; $event->Skip; say "--bar"; });
+	# keep focus on editor even when klicking on tab bar
+	Wx::Event::EVT_LEFT_DOWN( $self, sub { Kephra::API::active_editor()->focus; }); #print "--down";
+	$self->Connect( -1, -1, &Wx::wxEVT_SET_FOCUS, sub {  } ); #print "--";
+	Wx::Event::EVT_SET_FOCUS( $self, sub { my ($bar, $event ) = @_; $event->Skip; }); # say "--bar";
+
+	$self;
 }
 
 sub unmount_events {

File lib/Kephra/App/Window.pm

 
 package Kephra::App::Window;
 use base qw(Wx::Frame);
+use Kephra::App::Bar::Document;
 use Kephra::App::Editor;
 our $_ref;
 my $title_end = "$Kephra::NAME $Kephra::VERSION";
 	my( $class, $title ) = @_;
 	my( $self ) = $_ref = $class->SUPER::new (  undef, -1, $title, [-1,-1], [800,600] );
 	$self->SetIcon( Wx::GetWxPerlIcon() );
-	my $ed = Kephra::App::Editor->new($self, -1);
+	#my $ed = Kephra::App::Editor->new($self);
+	my $ed = Kephra::App::Bar::Document->new($self);
 
 	Wx::Window::SetFocus( $ed );
 	Kephra::API::focus($ed);