Commits

Herbert Breunung committed b5020cc

little cleanups

  • Participants
  • Parent commits 9d06add

Comments (0)

Files changed (5)

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

 	$position = $self->leftmost_page_pos     if $position eq 'leftmost';
 	$set_active = 1                          unless defined $set_active;
 
+print "L:$label, P:$position \n";
+
 	unless ($new_panel->isa('Wx::Panel')) { # put panel under a none-panel
+print "repanel \n";
 		$new_panel = Kephra::App::Panel->new( $self, $new_panel);
 	}
 	else { $new_panel->Reparent( $self ) }
 
+#return if $position and not $label;
+
 	# document property panel ref has to be set before EVT_AUINOTEBOOK_PAGE_CHANGED 
 	$panel_candidate->panel( $new_panel ) if $panel_candidate->isa('Kephra::Document');
 

File lib/Kephra/App/Panel/Editor.pm

 		$main_doc_bar->SetPageText( $main_doc_bar->GetSelection , $doc->file_name );
 	} else {                                         # make new editor
 		$doc = Kephra::Document->new();
-		$doc->assign_file( $file );
-		$doc->editor( Kephra::App::Editor->new( $win ) );
-		Kephra::DocumentStash::add_and_activate( $doc );
-		$main_doc_bar->add_page( $doc->file_name, -1, 1, $doc);
+		 $doc->assign_file( $file );
+		 $doc->editor( Kephra::App::Editor->new( $win ) );
+		 Kephra::DocumentStash::add_and_activate( $doc );
+		 $main_doc_bar->add_page( $doc->file_name, -1, 1, $doc);
 	}
 	$doc->editor->focus();
 	$win->refresh_title();

File lib/Kephra/App/Panel/FileBrowser.pm

 use Kephra::API;
 use Kephra::File;
 
-#Kephra::CommandList::register_cmd_namespace('filebrowser');
+Kephra::CommandList::register_cmd_namespace('filebrowser');
 Kephra::CommandList::register_cmd({
- 'filebrowser-focus'=>{ sub=>'focus', label => ' ', keys => 'F2' },
+ '+-focus' =>{ sub=>'focus', label => ' ', keys => 'F2' },
 });
 
 

File lib/Kephra/Document.pm

 has folded_lines => ( is  => 'rw', );
 has marked_lines => ( is  => 'rw', );
 
-#after BUILDARGS => sub {
-   #my ( $self, @args ) = @_;
-   #print scalar @args, " $self\n";
-   #print $args[1], " $self\n" if $args[1];
-   #$self->assign_file( $args[1] ) if $args[1];
-   #return $class->$orig( @args );
- #};
-
- 
 sub assign_file {
 	my ($self, $file_path) = @_;
-	return unless defined $file_path;
+	return unless defined $file_path and -e $file_path;
 	if ($file_path){
 		$file_path = Kephra::File::normalize_name($file_path);
 		$self->file_path($file_path);

File lib/Kephra/File.pm

 
 Kephra::CommandList::register_cmd_namespace('file');
 Kephra::CommandList::register_cmd({
- '+-new' => { sub => 'new',         label => 'New',   keys => 'ctrl+n'},
- '+-open'=> { sub => 'open',        label => 'Open',  keys => 'ctrl+o'},
- '+-save'=> { sub => 'save_active', label => 'Save',  keys => 'ctrl+s'},
- '+-close'=>{ sub => 'close_active',label => 'Close', keys => 'ctrl+q'},
+ '+-new' => {sub => 'new',         label => 'New',   keys => 'ctrl+n'},
+ '+-open'=> {sub => 'open',        label => 'Open',  keys => 'ctrl+o'},
+ '+-save'=> {sub => 'save_active', label => 'Save',  keys => 'ctrl+s'},
+ '+-close'=>{sub => 'close_active',label => 'Close', keys => 'ctrl+q'},
 });
 
 sub normalize_name {
 
 sub new  { Kephra::App::Panel::Editor::create_document() }
 sub open {
-	unless (@_) {
-		$_[0] = Kephra::App::Dialog::get_file_open();
-	}
+	# open dialog if no file was given
+	$_[0] = Kephra::App::Dialog::get_file_open() unless @_;
+
 	for my $file (@_){
 		$file = normalize_name( $file );
 		next unless $file and -e $file;