Source

Kephra / lib / Kephra / App / Part / Editor.pm

Diff from to

lib/Kephra/App/Part/Editor.pm

 Kephra::API::Command::register({
  'docbar-prev' =>{sub=>'select_docbar_prev', label=>'Prev Docbar',  keys=>'alt+pageup'},
  'docbar-next' =>{sub=>'select_docbar_next', label=>'Next Docbar',  keys=>'alt+pagedown'},
- 'docbar-del'  =>{sub=>'select_docbar_del', label=>'Next Docbar',  keys=>'ctrl+alt+pageup'},
- 'docbar-add'  =>{sub=>'select_docbar_add', label=>'Prev Docbar',  keys=>'ctrl+alt+pagedown'},
+ 'docbar-add'  =>{sub=>'select_docbar_add',  label=>'Prev Docbar',  keys=>'ctrl+alt+pagedown'},
+ 'docbar-del'  =>{sub=>'select_docbar_del',  label=>'Next Docbar',  keys=>'ctrl+alt+pageup'},
+ 'docbar-resize-left' =>{sub=>'resize_left', label=>'',  keys=>'alt+plus'},
+ 'docbar-resize-right'=>{sub=>'resize_right',label=>'',  keys=>'alt+minus'},
 });
 
 
 	my( $class, $parent) = @_;
 	my $self = $panel = $class->SUPER::new($parent);
 
-	my $db  = Kephra::App::Bar::Document->new($self);
-	my $db2 = Kephra::App::Bar::Document->new($self);
+	$active_bar = Kephra::App::Bar::Document->new($self);
+	@passive_bar = Kephra::App::Bar::Document->new($self);
 
-	my $splitter = $splitter{'main'} = Kephra::App::Splitter->new
-		({parent => $self, left => $db, right => $db2, dominant_child => 'left'});
+	my $splitter = $splitter{'main'} = Kephra::App::Splitter->new({ parent => $self,
+		left => $active_bar, right => $passive_bar[-1], dominant_child => 'left' });
 	$self->append( \$splitter );
-	$splitter->resize('equal');
-
-	$active_bar = $db;
-	@passive_bar = ($db2);
-
+	#$splitter->resize('equal');
 	$self;
 }
 
 sub select_docbar_add {
 	my $docbar_count = scalar @passive_bar + 1;
 	return if $docbar_count > 3;
+
 	if    ($docbar_count == 3){
 		
 	}
 		
 	}
 	elsif ($docbar_count == 1){
-		$passive_bar[0]->Show(1);
-		$splitter{'main'}->resplit();
+		
+		push @passive_bar, Kephra::App::Bar::Document->new( $splitter{'main'} );
+		$splitter{'main'}->set(
+			{left => $active_bar, right => $passive_bar[0], dominant_child => 'left'}
+		);
+		$splitter{'main'}->resize('equal');
+		#$splitter{'main'}->resplit();
+		#$passive_bar[0]->Show(1);
 	}
+	Kephra::API::focus( $active_bar->GetPage( $active_bar->GetSelection ) );
 }
 
+
 sub select_docbar_next {
 	push @passive_bar, $active_bar;
 	$active_bar = shift @passive_bar;
 }
 
 
+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);