Commits

Herbert Breunung committed 5c87064

complete rename to app::part::main

Comments (0)

Files changed (4)

lib/Kephra/API.pm

 
 sub app                 { $Kephra::App::_ref }
 sub main_window         { $Kephra::App::Window::_ref }
-sub tabbar              { $Kephra::App::Bar::Tab::_ref #Kephra::App::Part::Editor::tabbar() 
+sub tabbar              { $Kephra::App::Bar::Tab::_ref #Kephra::App::Part::Main::tabbar() 
 }
-sub all_tabbars         { $Kephra::App::Bar::Tab::_ref #Kephra::App::Part::Editor::all_tabbars()
+sub all_tabbars         { $Kephra::App::Bar::Tab::_ref #Kephra::App::Part::Main::all_tabbars()
 }
 #sub passive_tabbars     { Kephra::App::Part::Editor::passive_tabbars() }
 sub document            { Kephra::API::DocumentStash::active_doc() }

lib/Kephra/App.pm

 package Kephra::App;
 use base qw(Wx::App);
 use Kephra::API;
+use Kephra::App::Dialog;
 use Kephra::App::Window;
 use Kephra::File;
 

lib/Kephra/App/Part/.DS_Store

Binary file removed.

lib/Kephra/App/Part/Main.pm

 use Cwd;
 use File::Find;
 use File::Spec;
+use Kephra::App::Bar::Tab;
 use Kephra::App::Panel;
-use Kephra::App::Bar::Tab;
 use Kephra::App::Splitter;
 
 package Kephra::App::Part::Main;
 use Scalar::Util qw(blessed);
 
 #Kephra::API::Command::register({
-# 'tabbar-prev' =>{sub=>'select_tabbar_prev', label=>'Prev Docbar',  keys=>'alt+pageup'},
-# 'tabbar-next' =>{sub=>'select_tabbar_next', label=>'Next Docbar',  keys=>'alt+pagedown'},
-# 'tabbar-add'  =>{sub=>'select_tabbar_add',  label=>'Prev Docbar',  keys=>'ctrl+alt+pagedown'},
-# 'tabbar-del'  =>{sub=>'select_tabbar_del',  label=>'Next Docbar',  keys=>'ctrl+alt+pageup'},
+# 'tabbar-prev' =>{sub=>'select_tabbar_prev', label=>'Prev TabBar',  keys=>'alt+pageup'},
+# 'tabbar-next' =>{sub=>'select_tabbar_next', label=>'Next TabBar',  keys=>'alt+pagedown'},
+# 'tabbar-add'  =>{sub=>'select_tabbar_add',  label=>'Prev TabBar',  keys=>'ctrl+alt+pagedown'},
+# 'tabbar-del'  =>{sub=>'select_tabbar_del',  label=>'Next TabBar',  keys=>'ctrl+alt+pageup'},
 # 'tabbar-resize-left' =>{sub=>'resize_left', label=>'',  keys=>'ctrl+alt+plus'},
 # 'tabbar-resize-right'=>{sub=>'resize_right',label=>'',  keys=>'ctrl+alt+minus'},
 #});
 
 
 sub tabbar         { $active_bar }
-sub passive_docbars{ @passive_bar}
-sub all_docbars    { $active_bar, @passive_bar }
+sub passive_tabbars{ @passive_bar}
+sub all_tabbars    { $active_bar, @passive_bar }
 
 sub new {
 	my( $class, $parent) = @_;
 	my $self = $panel = $class->SUPER::new($parent);
 
-	$active_bar = Kephra::App::Bar::Document->new($self);
-	@passive_bar = Kephra::App::Bar::Document->new($self);
+	$active_bar = Kephra::App::Bar::Tab->new($self);
+	@passive_bar = Kephra::App::Bar::Tab->new($self);
 
 	my $splitter = $splitter{'main'} = Kephra::App::Splitter->new({ parent => $self,
 		left => $active_bar, right => $passive_bar[-1], dominant_child => 'left' });
 	$self;
 }
 
-sub select_docbar_del {
-	my $docbar_count = scalar @passive_bar + 1;
-	return if $docbar_count < 2;
-	if    ($docbar_count == 4){
+sub delete_selected_tabbar {
+	my $tabbar_count = scalar @passive_bar + 1;
+	return if $tabbar_count < 2;
+	if    ($tabbar_count == 4){
 		
 	}
-	elsif ($docbar_count == 3){
+	elsif ($tabbar_count == 3){
 		
 	}
-	elsif ($docbar_count == 2){
+	elsif ($tabbar_count == 2){
 		$splitter{'main'}->set({dominant_child => $active_bar});
 		$splitter{'main'}->unsplit();
 	}
 	Kephra::API::focus( $active_bar->GetPage( $active_bar->GetSelection ) );
 }
 
-sub select_docbar_add {
-	my $docbar_count = scalar @passive_bar + 1;
-	return if $docbar_count > 3;
+sub and_and_select_tabbar {
+	my $tabbar_count = scalar @passive_bar + 1;
+	return if $tabbar_count > 3;
 
-	if    ($docbar_count == 3){
+	if    ($tabbar_count == 3){
 		
 	}
-	elsif ($docbar_count == 2){
+	elsif ($tabbar_count == 2){
 		
 	}
-	elsif ($docbar_count == 1){
+	elsif ($tabbar_count == 1){
 		
-		push @passive_bar, Kephra::App::Bar::Document->new( $splitter{'main'} );
+		push @passive_bar, Kephra::App::Bar::Tab->new( $splitter{'main'} );
 		$splitter{'main'}->set(
 			{left => $active_bar, right => $passive_bar[0], dominant_child => 'left'}
 		);
 }
 
 
-sub select_docbar_next {
+sub select_tabbar_next {
 	push @passive_bar, $active_bar;
 	$active_bar = shift @passive_bar;
 	$active_bar->raise_page( $active_bar->GetSelection );
 }
-sub select_docbar_prev {
+sub select_tabbar_prev {
 	unshift @passive_bar, $active_bar;
 	$active_bar = pop @passive_bar;
 	$active_bar->raise_page( $active_bar->GetSelection );
 }
-sub select_docbar {
+sub select_tabbar {
 	my $bar = shift;
-	return Kephra::Log::warning("need a Kephra::App::Bar::Document instance")
-		unless ref $bar eq 'Kephra::App::Bar::Document';
+	return Kephra::Log::warning("need a Kephra::App::Bar::Tab instance")
+		unless ref $bar eq 'Kephra::App::Bar::Tab';
 	return if $active_bar eq $bar;
 	my $i;
 	for (0 ..  $#passive_bar){ $i = $_ if $bar eq $passive_bar[$_] }
 }
 
 
-sub resize { $splitter{'main'}->resize('equal') }
-
-sub resize_left { $splitter{'main'}
-}
-sub resize_right { $splitter{'main'}
-}
+sub resize      { $splitter{'main'}->resize('equal') }
+sub resize_left { $splitter{'main'} }
+sub resize_right{ $splitter{'main'} }
 
 
 sub refresh_doc_label {
 	my $doc = shift // Kephra::API::document();
-	return unless Kephra::API::Doc::is($doc);
+	return unless Kephra::API::DocumentStash::is($doc);
 	my $unsaved_mark = '*';
 
 	my $title = $doc->title;
 	$title .= $unsaved_mark if $doc->editor->{$active_bar}->GetModify;
-	$_->SetPageText($_->GetPageIndex( $doc->panel->{$_} ), $title) for all_docbars();
+	$_->SetPageText($_->GetPageIndex( $doc->panel->{$_} ), $title) for all_tabbars();
 }
 
 1;