Herbert Breunung avatar Herbert Breunung committed a7c5fb2

introduce API

Comments (0)

Files changed (7)

Binary file added.

lib/Kephra/API.pm

+use v5.12;
+use warnings;
+use Exporter;
+
+#use Kephra::API::DocumentStash;
+#use Kephra::API::Event;
+#use Kephra::API::GuiBuilder;
+#use Kephra::API::KeyMap;
+use Kephra::API::Log;
+#use Kephra::API::MacroRecorder;
+#use Kephra::API::Plugin;
+#use Kephra::API::Sandrum;
+#use Kephra::API::UserCommand;
+
+#use Kephra::App::Focus;
+#use Kephra::App::Window;
+#use Kephra::App::Bar::Document;
+#use Kephra::Config;
+#use Kephra::Worker;
+
+
+package Kephra::API;
+our $VERSION = 0.1002;
+our @ISA = qw(Exporter);
+our @EXPORT = qw(note warn error);
+our @EXPORT_OK = qw();  # symbols to export on request
+#%EXPORT_TAGS = (T => [qw()], 2 => [qw()]);
+
+sub note  {}
+sub warn  {}
+sub error {}
+
+
+'all you need';
Add a comment to this file

lib/Kephra/API/.DS_Store

Binary file added.

lib/Kephra/API/Log.pm

+use v5.12;
+use warnings;
+
+package Kephra::API::Log;
+
+use Kephra::API;
+
+our $level;
+our @output;
+our %switch;
+
+our $global_switch = 1;    # do_logging
+our $GUI_switch = 0;
+our $CLI_switch = 1;
+our %local_switch;
+
+sub mode {
+	my $mode = shift;
+	return unless defined $mode;
+	return unless $mode eq 'on' or $mode eq 'off'
+		or $mode eq 'gui' or $mode eq 'text' or $mode eq 'all';
+	$global_switch = $mode eq 'off' ? 0 : 1;
+	if ($mode eq 'text'){ $GUI_switch = 0; $CLI_switch = 1 }
+	if ($mode eq 'gui') { $GUI_switch = 1; $CLI_switch = 0 }
+	if ($mode eq 'all') { $GUI_switch = 1; $CLI_switch = 1 }
+}
+
+
+sub note {
+	return unless $global_switch;
+	say message( @_ ) if $CLI_switch;
+}
+
+sub warning {
+	return unless $global_switch;
+	my $msg = message( @_ );
+	warn $msg if $CLI_switch;
+	Kephra::API::output('warn', $msg) if $GUI_switch;
+}
+
+sub error {
+	return unless $global_switch;
+	my $msg = message( @_ );
+	die $msg if $CLI_switch;
+	Kephra::API::output('warn', 'ERROR: '.$msg) if $GUI_switch;
+}
+
+sub message     { 
+	my ($text, $name_parent) = @_;
+	my $msg = timestamp() . ' ' . calling_sub(3) . ': "'. $text.'"';
+	$msg .= ', when called by '. calling_sub(3+$name_parent) if $name_parent;
+	return $msg;
+}
+sub timestamp   { sprintf("[%02u:%02u:%02u]", (localtime)[2,1,0]) }
+sub calling_sub { ( caller($_[0]) )[3] } 
+
+1;

lib/Kephra/API/Logging.pm

-use v5.12;
-use warnings;
-
-package Kephra::API::Log;
-
-use Kephra::API;
-
-our $level;
-our @output;
-our %switch;
-
-our $global_switch = 1;    # do_logging
-our $GUI_switch = 0;
-our $CLI_switch = 1;
-our %local_switch;
-
-sub mode {
-	my $mode = shift;
-	return unless defined $mode;
-	return unless $mode eq 'on' or $mode eq 'off'
-		or $mode eq 'gui' or $mode eq 'text' or $mode eq 'all';
-	$global_switch = $mode eq 'off' ? 0 : 1;
-	if ($mode eq 'text'){ $GUI_switch = 0; $CLI_switch = 1 }
-	if ($mode eq 'gui') { $GUI_switch = 1; $CLI_switch = 0 }
-	if ($mode eq 'all') { $GUI_switch = 1; $CLI_switch = 1 }
-}
-
-
-sub note {
-	return unless $global_switch;
-	say message( @_ ) if $CLI_switch;
-}
-
-sub warning {
-	return unless $global_switch;
-	my $msg = message( @_ );
-	warn $msg if $CLI_switch;
-	Kephra::API::output('warn', $msg) if $GUI_switch;
-}
-
-sub error {
-	return unless $global_switch;
-	my $msg = message( @_ );
-	die $msg if $CLI_switch;
-	Kephra::API::output('warn', 'ERROR: '.$msg) if $GUI_switch;
-}
-
-sub message     { 
-	my ($text, $name_parent) = @_;
-	my $msg = timestamp() . ' ' . calling_sub(3) . ': "'. $text.'"';
-	$msg .= ', when called by '. calling_sub(3+$name_parent) if $name_parent;
-	return $msg;
-}
-sub timestamp   { sprintf("[%02u:%02u:%02u]", (localtime)[2,1,0]) }
-sub calling_sub { ( caller($_[0]) )[3] } 
-
-1;

Empty file added.

 #!usr/bin/perl
 use v5.12;
 use warnings;
+BEGIN { unshift @INC, '.' }
 
 package SingleEdit;
 use Wx;
 use base qw(Wx::App);
+use Kephra::API qw(warn);
 use Kephra::App::Dialog;
 use Kephra::App::Editor;
 use Kephra::IO::LocalFile;
 	});
 	($content, $encoding) = Kephra::IO::LocalFile::read( $file );
 	$ed->SetText( $content );
+
+	#say $Kephra::API::VERSION;
 
 	$frame->Center();
 	$frame->Show(1);
 
 # autosave
 # save status
-# logging
+# logging
+# show file name
+# status line
+# how insert edit functions
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.