Source

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

Diff from to

lib/Kephra/App/Bar/Document.pm

 package Kephra::App::Bar::Document;
 our @ISA = 'Wx::AuiNotebook';
 our $_ref;
-my $lowest_free_untitled_ID = 1;
 
+use Scalar::Util qw(blessed);
 
 Kephra::API::Command::register({
  'docbar-select-left'     =>{sub=>'$docbar->select_page_left',     label=>'Previous Tab',  keys=>'ctrl+pageup'},
 
 	$new_page->Reparent($self);
 	$self->InsertPage( $position, $new_page, $title, $set_active);
-	$self->set_page_title( $title, $new_page );
+	#$self->set_page_title( $title, $new_page );
 	Kephra::API::focus($new_page) if $set_active;
 	Kephra::API::main_window()->refresh_title() if $set_active;
 
 
 sub set_page_title {
 	my ($self, $label, $page) = @_;
-	return if ref $page and $page ne ref $page and $page->isa(' Wx::Window');
+	return if blessed($page) and $page->isa('Kephra::App::Panel');
 	my $position = $page ? $self->GetPageIndex($page) : $self->GetSelection;
 	return unless $self->valid_page_pos($position);
-	$label = '<untitled '.($lowest_free_untitled_ID++).'>' unless $label;
-	my $max_width = 15;
-	if ( length($label) > $max_width and $max_width > 7 ) {
-		$label = substr( $label, 0, $max_width - 2 ) . '..';
-	}
 	$self->SetPageText( $position, $label );
 }
-sub refresh_page_title {
-	my $self = shift;
-	my $doc = shift // Kephra::API::document();
-	my $unsaved_mark = '*';
-	my $position = $self->GetSelection;
-	my $label = $self->GetPageText( $position);
-	chop $label if substr($label,-1) eq $unsaved_mark;
-	$label .= $unsaved_mark if $doc->editor->{$self}->GetModify;
-	$self->SetPageText($position, $label);
-}
-
 
 
 1;