1. Herbert Breunung
  2. Kephra

Commits

Herbert Breunung  committed f7883e8

refacuring menu generation

  • Participants
  • Parent commits d1ff653
  • Branches default

Comments (0)

Files changed (6)

File lib/Kephra/App/Bar/Menu.pm

View file
     my $bar = Wx::MenuBar->new();
 
     for my $menu_def (@$menu_def) {
+        my $built_menu = Wx::Menu->new();
+        my $menuitemID = $menu_ID;
         my @names = keys %$menu_def;
 
-        my $built_menu = Wx::Menu->new();
-        my $menuitemID = $menu_ID;
-        
         for my $command_ID (@{ $menu_def->{$names[0]} }) {
             unless ($command_ID and $command_ID) {
                 $built_menu->AppendSeparator;

File lib/Kephra/App/Menu.pm

View file
 use strict;
 use warnings;
 
+use Kephra::API;
 use Kephra::CommandList;
-use Kephra::Config::Default;
 
 package Kephra::App::Menu;
 
 
 my $menuID = 1000;
+my %storage;
 
 # build ready to compile data structure from menu definitions (list of commandID)
 sub assemble {
 	my $menu_data;
 	
 	for my $menu_def (@$menu_def) {
-		my @names = keys %{ $menu_def->[0] };
-
-		my $built_menu = Wx::Menu->new();
-		my $menuitemID = $menu_ID;
-		
-		for my $command_ID (@{ $menu_def->[0]{$names[0]} }) {
-			unless ($command_ID and $command_ID) {
-				$built_menu->AppendSeparator;
-				next;
-			}
+		#my @names = keys %$menu_def;
+#
+		#my $built_menu = Wx::Menu->new();
+		#my $menuitemID = $menu_ID;
+#
+		#for my $command_ID (@{ $menu_def->{$names[0]} }) {
+			#unless ($command_ID and $command_ID) {
+				#$built_menu->AppendSeparator;
+				#next;
+			#}
 			#print $cmd_list->{$command_ID}{'call'}, "\n";
-			my $item = Wx::MenuItem->new(
-				$built_menu, $menuitemID,
-				$cmd_list->{$command_ID}{'name'}, '',
-				&Wx::wxITEM_NORMAL
-			);
-
-			Wx::Event::EVT_MENU ( 
-				$win, $menuitemID, $cmd_list->{$command_ID}{'callref'}
-			);
-
-			$built_menu->Append( $item );
-			$menuitemID++;
-		}
-
+			#my $item = Wx::MenuItem->new(
+				#$built_menu, $menuitemID,
+				#$cmd_list->{$command_ID}{'name'}, '',
+				#&Wx::wxITEM_NORMAL
+			#);
+#
+			#Wx::Event::EVT_MENU ( 
+				#$win, $menuitemID, $cmd_list->{$command_ID}{'callref'}
+			#);
+#
+			#$built_menu->Append( $item );
+			#$menuitemID++;
+	}
+	return $menu_data;
 }
 
 # make real menus from datastructure
 	my $menu_def = Kephra::Config::Default::mainmenu();
 	my $cmd_list = Kephra::CommandList::_raw();
 	my $start_ID = my $menu_ID = 1000;
+	my $win = Kephra::API::widget('main_window');
 
 	my $bar = Wx::MenuBar->new();
 

File lib/Kephra/CommandList.pm

View file
 	%list = %{ Kephra::Config::Default::commandlist() };
 	for (values %list){
 		$_->{'callref'} = eval 'sub {'. $_->{'function'}.'}';
-		print $_->{'function'}, " ", $_->{'callref'};
 	}
 }
 

File lib/Kephra/Config/Default/MainMenu.pm

View file
 	];
 }
 
-1;
+1;
+
+__END__
+
+[
+	{ ID => 'file'}
+	'file_new',
+	'file_open',
+	'file_save',
+	'file_close',
+	'',
+	'app_close_save',
+],

File lib/Kephra/Config/File.pm

View file
+use strict;
+use warnings;
+
+package Kephra::Config::File;
+
+
+
+
+1;
+
+__END__
+
+	YAML::DumpFile('text.yml',
+	[
+		{ ID => 'file'},
+		'file_new',
+		'file_open',
+		'file_save',
+		'file_close',
+		'',
+		'app_close_save',
+	]
+	);

File lib/Kephra/Config/Localisation.pm

View file
 
 
 1;
-__END__
-
-API:
-sub get_localisation_lang {}
-sub set_localisation_lang {}
-sub available_localisation_lang {}