Herbert Breunung avatar Herbert Breunung committed aef1b2e

keymap get an own (storage and build) module

Comments (0)

Files changed (6)

 	CommandList Config 
 	Edit File EventTable PluginRegistrar SanddrumInterpreter/;
 our @oop_interfaces = 
-	qw/App::Editor App::Panel App::Splitter App::Bar::Document Document/;
+	qw/App::Editor App::Panel App::Splitter App::SidePanelController 
+	   App::Bar::Document Document/;
 
 sub start {
 	start_worker_thread();

lib/Kephra/App.pm

 use Kephra::API;
 use Kephra::App::Window;
 use Kephra::CommandList;
+use Kephra::Config::Global;
 
 package Kephra::App;
 our @ISA = 'Wx::App';

lib/Kephra/App/Keymap.pm

+use strict;
+use warnings;
+use Wx;
+use Kephra::CommandList;
+
+package Kephra::App::Keymap;
+
+my %map;
+
+sub apply {}
+sub build {}
+sub copy {}
+
+1;

lib/Kephra/App/Panel/IOUnit.pm

 use Wx::AUI;
 use Wx::Perl::ProcessStream;
 use Kephra::App::Util;
+use Kephra::Log;
 
 package Kephra::App::Panel::IOUnit;
 our @ISA = 'Wx::Panel';
 	my ($self, $slot_name, $msg, $raise) = @_;
 	return unless defined $self->{'output_slots'}{ $slot_name };
 	my $slot = $self->{'output_slots'}{ $slot_name };
-	my $stamped_msg = timestamp() . ' ' . $msg;
+	my $stamped_msg = Kephra::Log::timestamp() . ' ' . $msg;
 	if ($slot_name eq 'log') {
 		$slot->AppendText("\n") if $slot->GetValue;
 		$slot->AppendText($stamped_msg);
 sub get_line  {}
 sub get_click {}
 
-sub timestamp { sprintf("[%02u:%02u:%02u]", (localtime)[2,1,0]) }
-
 1;

lib/Kephra/CommandList.pm

 my %namespace;
 my %object_alias;
 
+# register means: to be called before init-on compile/module block execution time
 sub register_object_switch_var {
 	return unless $_[0] and ref $_[0] eq ref {};
 	my %alias = %{$_[0]};
 	for my $var ( keys %alias ){
-		Kephra::Log::error
+		return Kephra::Log::error
 			("register_object_switch_var: $var already registered as ".$object_alias{$var})
 				if exists $object_alias{$var};
 		my $switch = $alias{$var};
 	}
 }
 sub register_cmd_namespace {
-	Kephra::Log::error
+	return Kephra::Log::error
 		("register_cmd_namespace: called without value from ". (caller)[0] )
 			unless $_[0];
 	$namespace{ (caller)[0] } = $_[0];
 sub register_cmd {
 	my $cmd = shift;
 	$cmd = [$cmd] unless ref $cmd eq ref [];
+	my $caller = (caller)[0];
 	for my $cmd (@$cmd) {
-		die "$cmd already registered to do ". cmd_property($cmd, 'function') .
-		                             " by " . cmd_property($cmd, 'source')
+		Kephra::Log::warning( 'register_cmd: '.
+			"$cmd already registered to do ". cmd_property($cmd, 'function') .
+		                             " by " . cmd_property($cmd, 'source')  ), next
 			if cmd_exists( $cmd );
+		Kephra::Log::warning( 'register_cmd: "$cmd" has to be a hash ref'), next
+			unless ref $cmd eq ref {};
 		#$list{$cmd}{'function'} = 
+		#$list{$cmd}{'source'} = $caller;
 	}
 }
 
 sub init {
+print "----";
 	%list = %{ Kephra::Config::Default::commandlist() };
 	for (values %list){
 		$_->{'callref'} = eval 'sub {'. $_->{'function'}.'}';
 	}
 }
 
+sub call {}
+
 sub cmd_exists          { 1 if defined $_[0]     and exists $list{ $_[0] }          }
 sub cmd_property_exists { 1 if cmd_exists($_[0]) and exists $list{ $_[0] }{ $_[1] } }
 sub cmd_add {}
 
 
 1;
+
+__END__
+
+cmd_ID => {
+	callref   => # compiled function with maybe one option
+	function  => 'Kephra::File::new',
+	options   => [],
+	source    => # module file where function is located
+	state     => '',
+	event     => '',
+	name      => 'New',
+	help      => '',
+	keys      => 'Ctrl + N',
+	icon      => '',
+}

lib/Kephra/Config/Default/CommandList.pm

 }
 
 1;
-
-__END__
-
-file_new => {
-	callref   => compiled function with maybe one option
-	function  => 'Kephra::File::new',
-	options   => [],
-	source    => '',
-	state     => '',
-	event     => '',
-	name      => 'New',
-	help      => '',
-	keys      => 'Ctrl + N',
-	icon      => '',
-}
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.