Herbert Breunung avatar Herbert Breunung committed 799a84d

org- and scratch pad switched to App::Editor //editor component handling more centralized, wonder to keep IO on RichText

Comments (0)

Files changed (4)

     qw/Benchmark Encode Encode::Guess Cwd/,
     qw/File::Find File::Spec File::UserConfig Config::General YAML/,
     qw/PPI Moo/,
-    qw/Wx Wx::Scintilla Wx::Perl::ProcessStream/,
+    qw/Wx Wx::STC Wx::Perl::ProcessStream/, # Wx::Scintilla 
 );
 our @used_wx_modules = qw/Wx::AUI Wx::DND Wx::RichText/; # Wx::STC
 
 sub load_libs {
     eval "require $_" for @external_dependencies, @used_wx_modules;
     eval "require Kephra::$_" for @needed_at_first;
-
 }
 
 

lib/Kephra/App/Editor.pm

 use warnings;
 use Wx;
 #use Wx::DND;
-#use Wx::STC;
-use Wx::Scintilla;
+use Wx::STC;
+#use Wx::Scintilla;
 use Kephra::App::Util;
 
 package Kephra::App::Editor;
-#our @ISA = 'Wx::StyledTextCtrl';
-our @ISA = 'Wx::ScintillaTextCtrl';
+our @ISA = 'Wx::StyledTextCtrl';
+#our @ISA = 'Wx::ScintillaTextCtrl';
     
 my $mk_color = Kephra::App::Util::get('make_color');
 
 
 sub set_margin {
     my ($self, $style) = @_;
-    $style = '' unless defined $style;
+    $style = 'default' unless defined $style;
 
-    $self->SetMarginType( 0, &Wx::wxSTC_MARGIN_SYMBOL );
-    $self->SetMarginType( 1, &Wx::wxSTC_MARGIN_NUMBER );
-    $self->SetMarginType( 2, &Wx::wxSTC_MARGIN_SYMBOL );
-    $self->SetMarginMask( 0, 0x01FFFFFF );
-    $self->SetMarginMask( 1, 0 );
-    $self->SetMarginMask( 2, &Wx::wxSTC_MASK_FOLDERS );
-    $self->SetMarginSensitive( 0, 1 );
-    $self->SetMarginSensitive( 1, 1 );
-    $self->SetMarginSensitive( 2, 1 );
-    if ($style eq 'no') { $self->SetMarginWidth($_, 0) for 0..2 }
-    else {
-        $self->StyleSetForeground(&Wx::wxSTC_STYLE_LINENUMBER, $mk_color->(123,123,137));
-        $self->StyleSetBackground(&Wx::wxSTC_STYLE_LINENUMBER, $mk_color->(226,226,222));
-        $self->SetMarginWidth(0,  0);
-        $self->SetMarginWidth(1, 31);
-        $self->SetMarginWidth(2,  0);
+    if ( $style eq 'default' ){
+        $self->SetMarginType( 0, &Wx::wxSTC_MARGIN_SYMBOL );
+        $self->SetMarginType( 1, &Wx::wxSTC_MARGIN_NUMBER );
+        $self->SetMarginType( 2, &Wx::wxSTC_MARGIN_SYMBOL );
+        $self->SetMarginMask( 0, 0x01FFFFFF );
+        $self->SetMarginMask( 1, 0 );
+        $self->SetMarginMask( 2, &Wx::wxSTC_MASK_FOLDERS );
+        $self->SetMarginSensitive( 0, 1 );
+        $self->SetMarginSensitive( 1, 1 );
+        $self->SetMarginSensitive( 2, 1 );
+        if ($style eq 'no') { $self->SetMarginWidth($_, 0) for 0..2 }
+        else {
+            $self->StyleSetForeground(&Wx::wxSTC_STYLE_LINENUMBER, $mk_color->(123,123,137));
+            $self->StyleSetBackground(&Wx::wxSTC_STYLE_LINENUMBER, $mk_color->(226,226,222));
+            $self->SetMarginWidth(0,  0);
+            $self->SetMarginWidth(1, 31);
+            $self->SetMarginWidth(2,  0);
+        }
+        $self->SetMargins(2, 2 );
+        $self->SetScrollWidth(200);
     }
-    $self->SetMargins(2, 2 );
-    $self->SetScrollWidth(200);
+    elsif ( $style eq 'no' ) {
+    }
+    
 }
 
 sub insert_text {

lib/Kephra/App/Panel/OrgPad.pm

 use strict;
 use warnings;
 
-use Wx::Scintilla;
-
+use Kephra::App::Editor;
 
 package Kephra::App::Panel::OrgPad;
-#our @ISA = 'Wx::StyledTextCtrl';
-our @ISA = 'Wx::ScintillaTextCtrl';
+our @ISA = 'Kephra::App::Editor';
 
 
 sub new {
     my( $class, $parent, $style) = @_;
-    my $ep = $class->SUPER::new($parent, -1);
+    my $ed = $class->SUPER::new($parent, -1);
+    $ed->set_margin('no');
 
-    return $ep;
+    return $ed;
 }
 
 

lib/Kephra/App/Panel/ScratchSheet.pm

 use strict;
 use warnings;
 
-use Wx::Scintilla;
+use Kephra::App::Editor;
 
 
 package Kephra::App::Panel::NotePad;
-#our @ISA = 'Wx::StyledTextCtrl';
-our @ISA = 'Wx::ScintillaTextCtrl';
+our @ISA = 'Kephra::App::Editor';
 
 
 sub new {
     my( $class, $parent, $style) = @_;
-    my $ep = $class->SUPER::new($parent, -1);
+    my $ed = $class->SUPER::new($parent, -1);
+    $ed->set_margin('no');
 
-    return $ep;
+
+    return $ed;
 }
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.