Herbert Breunung avatar Herbert Breunung committed 845d1e8

adding some missing key constants

Comments (0)

Files changed (5)

lib/Kephra/API/KeyMap.pm

 	F1 => &Wx::WXK_F1, F2 => &Wx::WXK_F2,  F3 => &Wx::WXK_F3,  F4 => &Wx::WXK_F4,
 	F5 => &Wx::WXK_F5, F6 => &Wx::WXK_F6,  F7 => &Wx::WXK_F7,  F8 => &Wx::WXK_F8,
 	F9 => &Wx::WXK_F9,F10 => &Wx::WXK_F10,F11 => &Wx::WXK_F11,F12 => &Wx::WXK_F12,
-	pound => 35, tilde => 92,
+	pound => 35, plus => 43, minus => 45, sharp => 47, tilde => 92, 
 	num_left  => &Wx::WXK_NUMPAD_LEFT,  num_right=> &Wx::WXK_NUMPAD_RIGHT,
 	num_up    => &Wx::WXK_NUMPAD_UP,    num_down => &Wx::WXK_NUMPAD_DOWN,
 	num_space => &Wx::WXK_NUMPAD_SPACE, num_tab  => &Wx::WXK_NUMPAD_TAB,

lib/Kephra/App/Bar/Document.pm

 	$_->add_instance($self) for Kephra::API::all_documents();
 	$self->mount_events();
 
-	return $self;
+	$self;
 }
 
 sub Destroy {

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);

lib/Kephra/App/Splitter.pm

 }
 
 sub resize {
-	my ($self, $size) = @_;
-	return unless defined $size;
-	$size = 0.5 if $size eq 'equal';
-	return unless looks_like_number($size);
+	my ($self, $pos) = @_;
+	return unless defined $pos;
+	$pos = 0.5 if $pos eq 'equal';
+	return unless looks_like_number($pos);
 
-	if ($size <= 1 and $size > -1){
+	# negative sizes are counted from right border
+	# sizes between -1 and 1 are percentages of splitter size
+	if ($pos <= 1 and $pos > -1){
 		my $size = $self->GetSize;
 		if ($self->GetSplitMode eq &Wx::wxSPLIT_HORIZONTAL){
-			$self->SetSashPosition( $size->GetHeight * $size, 1);
+			$self->SetSashPosition( $size->GetHeight * $pos, 1);
 		} 
 		elsif ($self->GetSplitMode eq &Wx::wxSPLIT_VERTICAL) {
-			$self->SetSashPosition( $size->GetWidth * $size, 1);
+			#say "resize $pos ",$size->GetHeight;
+			$self->SetSashPosition( $size->GetWidth * $pos, 1);
 		} 
-		else { return }
+		else { return; }
 	} 
-	else { $self->SetSashPosition($size, 1) }
+	else { $self->SetSashPosition($pos, 1) }
 
 	$self->{'position'} = $self->GetSashPosition;
 	$self;

lib/Kephra/App/Window.pm

 	$sizer{'main'}->Add( $splitter{'left'},       1, &Wx::wxGROW);
 	$sizer{'main'}->Add( $gui_part{'statusbar'},  0, &Wx::wxGROW);
 	$self->SetSizer( $sizer{'main'} );
+	$gui_part{'editor'}->resize;
 
 
 	$self->SetMenuBar( Kephra::App::Bar::Menu::get() );
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.