Source

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

Full commit
use strict;
use warnings;
use Cwd;
use File::Find;
use File::Spec;
use Kephra::App::Bar::Document;
use Kephra::App::Splitter;

package Kephra::App::Part::Editor;
our @ISA = 'Kephra::App::Panel';
my ($active_bar, @passive_bar, $panel);

sub docbar         { $active_bar }
sub passive_docbars{ @passive_bar}
sub all_docbars    { ($active_bar, @passive_bar) }

sub new {
	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);

	my $splitter = Kephra::App::Splitter->new
		({parent => $self, left => $db, right => $db2, dominant_child => 'left'});
	$self->append( \$splitter );
	$splitter->resize('equal');

	$active_bar = $db2;
	@passive_bar = ($db);

	$self;
}

sub switch_bar {
	
}

sub refresh_doc_label {
	my $doc = shift // Kephra::API::document();
	my $unsaved_mark = '*';

	my $title = $doc->title;
	$title .= $unsaved_mark if $doc->editor->{$active_bar}->GetModify;
	$_->SetPageText($_->GetPageIndex( $doc->panel->{$_} ), $title) for all_docbars();
}

1;