Commits

Herbert Breunung committed e2be771

fill dialogs fromprevious branch

Comments (0)

Files changed (3)

lib/Kephra/App/Dialog.pm

 
 package Kephra::App::Dialog;
 
+sub _win      { #Kephra::App::Window::_ref() 
+}
+
+# standard dialogs
+
+sub msg_box {
+	Wx::MessageBox( @_[0,1], &Wx::wxOK | &Wx::wxSTAY_ON_TOP, _win() );
+}
+
+sub info_box {
+	Wx::MessageBox
+		(@_[0,1], &Wx::wxOK | &Wx::wxICON_INFORMATION | &Wx::wxSTAY_ON_TOP, _win());
+}
+
+sub warning_box {
+	Wx::MessageBox
+		( @_[0,1], &Wx::wxOK | &Wx::wxICON_WARNING | &Wx::wxSTAY_ON_TOP, _win() );
+}
+
+sub get_confirm_2 {
+	Wx::MessageBox
+		(@_[0,1], &Wx::wxYES_NO | &Wx::wxICON_QUESTION | &Wx::wxSTAY_ON_TOP, _win());
+}
+
+sub get_confirm_3 {
+	Wx::MessageBox
+		( @_[0,1], &Wx::wxYES_NO | &Wx::wxCANCEL | &Wx::wxICON_QUESTION, _win() );
+}
+
+sub get_file_open {
+	Wx::FileSelector( @_[0,1], '', '', $_[2], &Wx::wxFD_OPEN, _win());
+}
+
+sub get_files_open {
+	my $dialog = Wx::FileDialog->new(
+		_win(),  @_[0,1], '', $_[2], &Wx::wxFD_OPEN | &Wx::wxFD_MULTIPLE, [-1,-1]
+	);
+	if ($dialog->ShowModal != &Wx::wxID_CANCEL) {
+		my @files = $dialog->GetPaths;
+		return \@files;
+	}
+}
+
+sub get_file_save { 
+	Wx::FileSelector( @_[0,1], '', '', $_[2], &Wx::wxFD_SAVE, _win())
+}
+
+sub get_dir  { Wx::DirSelector      ( @_[0,1] ,0, [-1,-1], _win()) }
+sub get_font { Wx::GetFontFromUser  ( _win(), $_[0]) }
+sub get_text { Wx::GetTextFromUser  ( $_[0], $_[1], "", _win()) }
+sub get_number{Wx::GetNumberFromUser( $_[0], '', $_[1],$_[2], 0, 100000, _win())}
+
+# own dialogs
+sub find {
+	#require Kephra::App::Dialog::Search; &Kephra::App::Dialog::Search::find;
+}
+sub replace {
+	#require Kephra::App::Dialog::Search; &Kephra::App::Dialog::Search::replace;
+}
+sub choose_color {
+	#require Kephra::App::Dialog::Color; Kephra::App::Dialog::Color::choose_color();
+}
+sub config {
+	#require Kephra::App::Dialog::Config; &Kephra::App::Dialog::Config::main;
+}
+sub info {
+	# require Kephra::App::Dialog::Info; &Kephra::App::Dialog::Info::combined;
+}
+sub notify_file_changed {
+	#require Kephra::App::Dialog::Notify; &Kephra::App::Dialog::Notify::file_changed;
+}
+sub notify_file_deleted {
+	#require Kephra::App::Dialog::Notify; &Kephra::App::Dialog::Notify::file_deleted;
+}
+sub save_on_exit {
+	#require Kephra::App::Dialog::Exit; &Kephra::App::Dialog::Exit::save_on_exit;
+}
 
 1;

lib/Kephra/App/EditPanel.pm

 use strict;
 use warnings;
 require Wx::STC;
-
+require Kephra::App::Helper;
+        
 package Kephra::App::EditPanel;
 our @ISA = 'Wx::StyledTextCtrl';
 
     $ep->SetMarginSensitive( 2, 1 );
     if ($style eq 'no') { $ep->SetMarginWidth($_, 0) for 0..2 }
     else {
-        $ep->StyleSetForeground(&Wx::wxSTC_STYLE_LINENUMBER, color(123,123,137));
-        $ep->StyleSetBackground(&Wx::wxSTC_STYLE_LINENUMBER, color(226,226,222));
+        my $color = Kephra::App::Helper::get('make_color_object');
+        $ep->StyleSetForeground(&Wx::wxSTC_STYLE_LINENUMBER, $color->(123,123,137));
+        $ep->StyleSetBackground(&Wx::wxSTC_STYLE_LINENUMBER, $color->(226,226,222));
         $ep->SetMarginWidth(0,  0);
         $ep->SetMarginWidth(1, 31);
         $ep->SetMarginWidth(2,  0);
 
 sub set_colors {
     my ($ep) = @_;
-    $ep->SetCaretLineBack( color(245,245,161) );
+    my $color = Kephra::App::Helper::get('make_color_object');
+    $ep->SetCaretLineBack( $color->(245,245,161) );
     $ep->SetCaretPeriod( 500 );
     $ep->SetCaretWidth( 2 );
-    $ep->SetCaretForeground( color(0,0,255) );
+    $ep->SetCaretForeground( $color->(0,0,255) );
     $ep->SetCaretLineVisible(1);
-    $ep->SetSelForeground( 1, color(255,246,194) );
-    $ep->SetSelBackground( 1, color(0, 17, 119) );
-    $ep->SetWhitespaceForeground( 1, color(204, 204, 153) );
-}
-
-sub color {
-    my ($r,$g,$b) = @_;
-    unless (defined $g){
-        $r = substr $r, 1 if length $r == 7;
-        if ( $r =~ /^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i ) {
-            ($r,$g,$b) = ( hex $1, hex $2, hex $3 );
-        }
-        # Handle comma-seperated
-        if ( $r =~ /^(\d+),(\d+),(\d+)$/ ) {
-            ($r,$g,$b) = ( $1+0, $2 + 0, $3 + 0 );
-        }
-    }
-    return unless defined $b;
-    return unless int $r == $r && $r>=0 && $r<=255;
-    return unless int $g == $g && $g>=0 && $g<=255;
-    return unless int $b == $b && $b>=0 && $b<=255;
-    Wx::Colour->new($r, $g, $b);
+    $ep->SetSelForeground( 1, $color->(255,246,194) );
+    $ep->SetSelBackground( 1, $color->(0, 17, 119) );
+    $ep->SetWhitespaceForeground( 1, $color->(204, 204, 153) );
 }
 
 sub load_font {

lib/Kephra/Logger.pm

 
 package Kephra::Logger;
 
+sub init {
+}
 
 1;