1. Herbert Breunung
  2. Kephra

Commits

Herbert Breunung  committed 02a56ba

test fo win platform

  • Participants
  • Parent commits c8f0f29
  • Branches sp2

Comments (0)

Files changed (6)

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

View file
  • Ignore whitespace
 use Wx qw/ :everything /;
 use Wx::STC;
 use Wx::DND;
-use Kephra::API qw(:log);
+use Kephra::API qw(:log is_editor);
 #use Wx::Scintilla;
 
 
 	$self->set_perlhighlight();
 	$self->set_colors(); # after highlight
 	$self->set_margin();
-	$self->mount_events();
 	$self->set_tab_size(4);
 	$self->set_tab_usage(1);
 	$self->SetScrollWidth(300);
 	$self->reset('');
+	$self->mount_events();
 	return $self;
 }
 
 	$self->SetText($text);
 	$self->EmptyUndoBuffer;
 	$self->SetSavePoint;
+
 }
 
+sub clone { # this editor will display the same as an other
+	my ($self, $original) = @_;
+	return unless is_editor($original);
+	$self->{'original'} = $original;
+	$self->SetDocPointer($original->GetDocPointer() );
+	$original->AddRefDocument($original->GetDocPointer() );
+}
+
+sub unclone {  #
+	my ($self) = @_;
+	$self->ReleaseDocument($self->{'original'}->GetDocPointer());
+	$self->{'original'} == 'empty';
+}
+
+
 sub mount_events {
 	my ($self, @which) = @_;
 	$self->DragAcceptFiles(1) if $^O eq 'MSWin32'; # enable drop files on win

File lib/ded/Kephra/App/KeyMap.pm

View file
  • Ignore whitespace
 sub definition_from_event {
 	my $event = shift;
 	#Kephra::Log::warning ("got no event, but $event") unless ref $event and $event->isa('Wx::Event');
-	my $code = $event->GetUnicodeKey;
+	#my $code = $event->GetUnicodeKey;
+	my $code = $event->GetKeyCode;
 	my $definition;
 	$definition .= 'shift+' if $event->ShiftDown;
 	$definition .= 'ctrl+' if $event->ControlDown;

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

View file
  • Ignore whitespace
 	my $class = shift;
 	my $parent = shift;
 	$parent = Kephra::API::app_window() unless defined $parent and is_widget($parent);
-
 	my $self = $class->SUPER::new( $parent );
 	$self->{'sizer'} = Kephra::App::Sizer->new('vertical');
 	$self->SetSizer( $self->{'sizer'}->bare_sizer );

File lib/ded/Kephra/App/Part/Main.pm

View file
  • Ignore whitespace
 	my ($self) = @_;
 	if ($self->{'number'} < 2){
 		$self->{'doc_bar'}[$self->{'number'}] = Kephra::App::DocBar->new( $self )
-			unless $self->{'doc_bar'}[$self->{'number'}];
+			unless defined $self->{'doc_bar'}[$self->{'number'}];
 		Kephra::DocumentStash::add_doc_bar( $self->{'doc_bar'}[$self->{'number'}] );
 		$self->{'number'}++;
 	}
 
 	if ($self->{'number'} == 2){
+		$self->{'doc_bar'}[1]->Reparent($self->{'splitter'}[0]);
 		$self->{'splitter'}[0]->set({
 			'left' => $self->{'doc_bar'}[0],
 			'right'=> $self->{'doc_bar'}[1] 
 	if ($self->{'number'} > 1){
 		$self->{'number'}--;
 		Kephra::DocumentStash::remove_doc_bar( $self->{'doc_bar'}[ $self->{'number'} ] );
-		$self->{'doc_bar'}[ $self->{'number'} ]->Destroy();
+		$self->{'doc_bar'}[ $self->{'number'} ]->Show(0);
+		$self->{'doc_bar'}[ $self->{'number'} ]->remove_all_pages();
+#say "unsplit ",$self->{'doc_bar'}[1]->GetParent;
 		#delete $self->{'doc_bar'}[ $self->{'number'} ];
 		$self->{'active'} = 0 if $self->{'active'} == $self->{'number'};
 	}

File lib/ded/Kephra/DocumentStash.pm

View file
  • Ignore whitespace
 my @queue;      # order of alst usage
 my $lowest_free_anon_NR = 1; # for untitled docs
 my $max_title_width = 22;
+my %used_doc_panels; # wih_sci_refs and without
 
 sub active_doc    { $queue[0] }
 sub active_editor { $queue[0]->{'active_editor'} }
 		$doc->{'panel'}{$doc_bar} = Kephra::App::Panel->new($doc_bar);
 		$doc->{'editor'}{$doc_bar} = Kephra::App::Editor->new($doc->{'panel'}{$doc_bar});
 		$doc->{'panel'}{$doc_bar}->append_expanded($doc->{'editor'}{$doc_bar});
-		if (defined $ed_pointer) { $doc->{'editor'}{$doc_bar}->SetDocPointer( $ed_pointer ) }
+		if (defined $ed_pointer) { $doc->{'editor'}{$doc_bar}->clone( $ed_pointer ) }
 		else      { $ed_pointer =  $doc->{'editor'}{$doc_bar}->GetDocPointer() }
 		$document{'panel'}{ $doc->{'panel'}{$doc_bar} } = $doc;
 		$document{'editor'}{ $doc->{'editor'}{$doc_bar} } = $doc;
 		$doc->{'panel'}{$doc_bar} = Kephra::App::Panel->new($doc_bar);
 		$doc->{'editor'}{$doc_bar} = Kephra::App::Editor->new($doc->{'panel'}{$doc_bar});
 		$doc->{'panel'}{$doc_bar}->append_expanded($doc->{'editor'}{$doc_bar});
-		$doc->{'editor'}{$doc_bar}->SetDocPointer( $doc->{'active_editor'}->GetDocPointer() );
+say "bc ", $doc->{'active_editor'};
+say $doc->{'active_editor'}->GetDocPointer();
+		$doc->{'editor'}{$doc_bar}->clone( $doc->{'active_editor'} );
+#say "  $doc  $doc_bar ", $doc->{'panel'}{$doc_bar};
 		$document{'panel'}{ $doc->{'panel'}{$doc_bar} } = $doc;
 		$document{'editor'}{ $doc->{'editor'}{$doc_bar} } = $doc;
 		$doc_bar->add_page( $doc->{'panel'}{$doc_bar}, $doc->{'title'}, -1, 0);

File lib/ded/Kephra/Log.pm

View file
  • Ignore whitespace
 
 sub msg_text{ 
 	my ($text, $name_parent) = @_;
-	my $msg = timestamp() . ' ' . calling_sub(4) . ': "'. $text.'"';
-	$msg .= ', when called by '. calling_sub(3 + $name_parent) if $name_parent;
+	my $calldepth = 3;
+	$calldepth++ if  ( caller(1) )[0] eq 'Kephra::API';
+	my $msg = timestamp() . ' ' . calling_sub($calldepth) . ': "'. $text.'"';
+	$msg .= ', when called by '. calling_sub($calldepth + $name_parent) if $name_parent;
 	return $msg;
 }