Commits

Herbert Breunung committed cdb04cc

init 4 main dialogs: about documentation configs and keymap

Comments (0)

Files changed (11)

lib/Kephra/App/Dialog.pm

 #sub choose_color {
 	#require Kephra::App::Dialog::Color; Kephra::App::Dialog::Color::choose_color();
 #}
+sub about {
+	require Kephra::App::Dialog::About;
+	Kephra::App::Dialog::About::create( )->ShowModal;
+}
 sub config {
 	require Kephra::App::Dialog::Config;
-	Kephra::App::Dialog::Config::main( _parent() );
+	Kephra::App::Dialog::Config::create( )->ShowModal;
 }
-#sub info {
-	# require Kephra::App::Dialog::Info; &Kephra::App::Dialog::Info::combined;
-#}
+sub documentation {
+	require Kephra::App::Dialog::Documentation;
+	Kephra::App::Dialog::Documentation::create( )->ShowModal;
+}
+sub keymap {
+	require Kephra::App::Dialog::Keymap;
+	Kephra::App::Dialog::Keymap::create( )->ShowModal;
+}
+
 #sub notify_file_changed {
 	#require Kephra::App::Dialog::Notify; &Kephra::App::Dialog::Notify::file_changed;
 #}
 	#require Kephra::App::Dialog::Exit; &Kephra::App::Dialog::Exit::save_on_exit;
 #}
 
+
 1;

lib/Kephra/App/Dialog/About.pm

+use strict;
+use warnings;
+
+use Wx;
+
+package Kephra::App::Dialog::About;
+my $cache;
+
+sub create {
+	return $cache if defined $cache;
+	my $dialog = $cache = Wx::Dialog->new(
+		Kephra::App::Dialog::_parent(shift), -1,
+		$Kephra::NAME . ' '.$Kephra::VERSION .' Info'
+	);
+	$dialog;
+}
+
+1;

lib/Kephra/App/Dialog/Config.pm

 use Wx;
 
 package Kephra::App::Dialog::Config;
+my $cache;
 
-sub main {
-	my $parent = shift;
-	my $dialog = Wx::Dialog->new($parent, -1, 'Kephra Configs');
-	$dialog->ShowModal;
+sub create {
+	return $cache if defined $cache;
+	my $dialog = $cache = Wx::Dialog->new(
+		Kephra::App::Dialog::_parent(shift), -1,
+		$Kephra::NAME . ' '.$Kephra::VERSION .' Global Configurations'
+	);
+	$dialog;
 }
 
 1;

lib/Kephra/App/Dialog/Documentation.pm

+use strict;
+use warnings;
+
+use Wx;
+
+package Kephra::App::Dialog::Documentation;
+my $cache;
+
+sub create {
+	return $cache if defined $cache;
+	my $dialog = $cache = Wx::Dialog->new(
+		Kephra::App::Dialog::_parent(shift), -1,
+		$Kephra::NAME . ' '.$Kephra::VERSION .' User Guide and Documentation'
+	);
+	$dialog;
+}
+
+1;

lib/Kephra/App/Dialog/Help.pm

-use strict;
-use warnings;
-
-package Kephra::Dialog::Help;
-
-
-1;

lib/Kephra/App/Dialog/Info.pm

-use strict;
-use warnings;
-
-package Kephra::Dialog::Info;
-
-
-1;

lib/Kephra/App/Dialog/Keymap.pm

+use strict;
+use warnings;
+
+use Wx;
+
+package Kephra::App::Dialog::Keymap;
+my $cache;
+
+sub create {
+	return $cache if defined $cache;
+	my $dialog = $cache = Wx::Dialog->new(
+		Kephra::App::Dialog::_parent(shift), -1,
+		$Kephra::NAME . ' '.$Kephra::VERSION .' Keymap Settings'
+	);
+	$dialog;
+}
+
+1;

lib/Kephra/Config/Default/CommandList.pm

 			help  => '',
 			keys  => '',
 		},
-		'config-dialog' => {
+		'config-global-dialog' => {
 			function  => 'Kephra::App::Dialog::config',
-			name => 'Dialog',
+			name => 'Global Dialog',
 			help  => '',
 			keys  => 'Alt + C',
 			icon  => '',
 		},
+		'config-keymap-dialog' => {
+			function  => 'Kephra::App::Dialog::keymap',
+			name => 'Keymapping',
+			help  => '',
+			keys  => 'Alt + K',
+			icon  => '',
+		},
 		'help-documentation' => {
-			function  => 'Kephra::Help::documentation',
+			function  => 'Kephra::App::Dialog::documentation',
 			name => 'Documentation',
 			help  => '',
-			keys  => 'Alt + D',
+			keys  => 'F1',
 			icon  => '',
 		},
 		'help-homepage' => {
 			icon  => '',
 		},
 		'help-about' => {
-			function  => 'Kephra::Help::about',
+			function  => 'Kephra::App::Dialog::about',
 			name => 'About ...',
 			help  => '',
-			keys  => '',
+			keys  => 'Ctrl + Alt + A',
 			icon  => '',
 		},
 	};

lib/Kephra/Config/Default/MainMenu.pm

 			'app-close-save',
 		],
 		[	{menu_ID => 'config'},
-			'-dialog',
+			'-global-dialog',
+			'-keymap-dialog',
 		],
 		[	{menu_ID => 'help'},
 			'-documentation',

lib/Kephra/DocumentStash.pm

 	add($doc);
 	_activate($doc);
 }
-sub add {
+sub add {            # silently
 	my $doc = shift;
 	warn "Kephra::DocumentStash::add: add to me only docs, not $doc!"
 		unless $doc->isa('Kephra::Document');

lib/Kephra/File.pm

 	my $file = normalize_name( shift );
 	return unless $file and -e $file;
 
-	# doc is alread open
+	# raise tab if doc is alread open
 	return Kephra::App::Panel::Editor::raise_document($file)
 		if Kephra::DocumentStash::file_loaded($file);