1. Herbert Breunung
  2. Kephra

Commits

Herbert Breunung  committed ed39599

creating moduleKephra::App::Panel::Editor as stash and chief for the 4 planned doc bars

  • Participants
  • Parent commits e20bd84
  • Branches default

Comments (0)

Files changed (6)

File doc/Components.pod

View file
 
 
 =head2 Visual Overview
-________________________________________________________________________________
-|_____________________________________menu_____________________________________|
-|_________________________________global_toolbar_______________________________|
-|                  |                                         |                 |
-|                  |                                         |                 |
-|                  |                                         |                 |
-|                  |                                         |                 |
-|                  |                                         |                 |
-|                  |                 editor                  |                 |
-|                  |                                         |                 |
-|                  |                                         |                 |
-|      left        |                                         |      right      |
-|                  |                                         |                 |
-|                  |                                         |                 |
-|                  |_________________________________________|                 |
-|                  |_________________search__________________|                 |
-|                  |                                         |                 |
-|                  |                 output                  |                 |
-|                  |                                         |                 |
-|                  |_________________________________________|                 |
-|__________________|_________________input___________________|_________________|
-|___________________________status_____________________________________________|
+_______________________________________________________________________________
+|____________________________________menu_____________________________________|
+|________________________________global_toolbar_______________________________|
+|                  |                    |                   |                 |
+|                  |    editor leftup   |  editor rightup   |                 |
+|                  |                    |                   |                 |
+|                  |                    |                   |                 |
+|                  |                    |                   |                 |
+|                  |               ditor panel              |                 |
+|                  |____________________|___________________|                 |
+|                  |                    |                   |                 |
+|      left        |                    |                   |      right      |
+|                  |      left down     |    right down     |                 |
+|                  |                    |                   |                 |
+|                  |____________________|___________________|                 |
+|                  |__________________find__________________|                 |
+|                  |_________________replace________________|                 |
+|                  |                                        |                 |
+|                  |                 output                 |                 |
+|                  |                                        |                 |
+|                  |________________________________________|                 |
+|__________________|_________________input__________________|_________________|
+|___________________________status____________________________________________|

File lib/Kephra/API.pm

View file
 
 use Carp;
 
-my %widget = (
-	main_win => => $Kephra::App::Window::_ref,
-	main_window => $Kephra::App::Window::_ref,
-	doc_bar => $Kephra::App::Window::_ref->{'tabbar'}{'lo'},
+my %widget_caller = (
+	main_win => sub { $Kephra::App::Window::_ref },
+	main_window => sub { $Kephra::App::Window::_ref },
+	doc_bar => sub { $Kephra::App::Window::_ref },
 	document_bar => $Kephra::App::Window::_ref->{'tabbar'}{'lo'},
 );
 
 sub widget { # widget names are same as in the config
 	my $name = shift;
 	croak "requested widget withou name from Kephra::API::widget " unless $name;
-	my $demand = $widget{ $name };
-	croak caller, "wanted a widget noneexisting in the API: ", $name unless $demand;
+	my $coderef = $widget_caller{ $name };
+	croak caller, "wanted a widget noneexisting in the API: ", $name
+		unless ref $coderef eq ref sub {};
+	return &$coderef();
 }
 
 sub configs  { }

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

View file
 
     $tb->InsertPage( $pos, $panel, '<untitled>', $active );
     $ep->set_focus() if $active;
-    $tb;
+
+    return $tb;
 }
 
 1;

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

View file
     $bar->Append($help_menu, 'Help');
 
     my $win = Kephra::API::widget('main_window');
-print "--- $win", keys %$win;
-    #Wx::Event::EVT_MENU( $win, 1000, sub { } );
-    #Wx::Event::EVT_MENU( $win, 1000, sub { Kephra::API::widget('doc_bar')->add_edit_page() } );
+    #print "--- $win", keys %$win;
+    Wx::Event::EVT_MENU( $win, 1000, sub { Kephra::App::Panel::Editor::create_document() } );
 
     return $bar;
 }

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

View file
+use strict;
+use warnings;
+
+package Kephra::App::Panel::Editor;
+my %doc_bar;
+my $_ref;
+use Kephra::App::Bar::Document;
+
+sub _active_docbar{ $doc_bar{'leftup'} }
+
+sub new {
+    my( $class, $parent) = @_;
+    $doc_bar{'leftup'} = Kephra::App::Bar::Document->new( $parent );
+    # Wx::SplitterWindow->new( $splitter{'left'}, -1 );
+
+    return $doc_bar{'leftup'};
+}
+
+sub create_document { $doc_bar{'leftup'}->add_edit_page() }
+
+1;

File lib/Kephra/App/Window.pm

View file
 use Kephra::API;
 use Kephra::App::Bar::Menu;
 use Kephra::App::Bar::MainTool;
-use Kephra::App::Bar::Document;
 use Kephra::App::Bar::Search;
 use Kephra::App::Bar::Status;
+use Kephra::App::Panel::Editor;
 use Kephra::App::Panel::TextLab;
 use Kephra::App::Panel::IOUnit;
 use Kephra::App::Panel::FileBrowser;
                                                                or $name eq 'below';
         $panel{ $name }->SetSizer( $sizer{ $name } );
     }
-    my $tabbar_lo   = $win->{'tabbar'}{'lo'}  = Kephra::App::Bar::Document    ->new( $panel{'edit'} );
+    my $editor      = Kephra::App::Panel::Editor     ->new( $panel{'edit'} );
     my $searchbar   = Kephra::App::Bar::Search       ->new( $panel{'above'} );
     my $iounit      = Kephra::App::Panel::IOUnit     ->new( $panel{'below'} );
     my $filebrowser = Kephra::App::Panel::FileBrowser->new( $panel{'left'} );
     $splitter{'below'}->SetMinimumPaneSize(100);
     $splitter{'edit'}->Initialize( $panel{'edit'} );
 
-    $sizer{'edit'} ->Add( $tabbar_lo,       1, &Wx::wxGROW );
+    $sizer{'edit'} ->Add( $editor,          1, &Wx::wxGROW );
     $sizer{'above'}->Add( $splitter{'edit'},1, &Wx::wxGROW );
     $sizer{'above'}->Add( $searchbar,       0, &Wx::wxGROW );
     $sizer{'below'}->Add( $iounit,          1, &Wx::wxGROW );