Commits

Herbert Breunung  committed 76d12a1

try fix menu

  • Participants
  • Parent commits b67e43f

Comments (0)

Files changed (2)

File lib/Kephra/App/Menu.pm

 # make real menus from datastructure
 sub compile {
 	my $menu_data = shift;
-	die "__PACKAGE__::compile got no array ref" unless ref $menu_data eq ref [];
+	Kephra::Log::error('got no array ref') unless ref $menu_data eq ref [];
 
 	my $menu = Wx::Menu->new();
 	my $item_ID = $menu_ID;
 			my $item = Wx::MenuItem->new(
 				$menu, $item_ID++, $name, ' ', &Wx::wxITEM_NORMAL, $submenu
 			);
-			#if (defined $item_data->{icon}) {
-				#my $bmp = ;
-				#$menu_item->SetBitmap( $bmp ) if ref $bmp eq 'Wx::Bitmap' and not Wx::wxMAC();
-			#}
 			$menu->Append( $item );
 		}
 		elsif (ref $item_data eq ref {} and exists $item_data->{'type'}) {
 				$menu, $item_ID,
 				$item_data->{'label'}, ' ', &Wx::wxITEM_NORMAL
 			);
+			if (defined $item_data->{icon}) {
+				#my $bmp = ;
+				#$menu_item->SetBitmap( $bmp ) 
+				#	if ref $bmp eq 'Wx::Bitmap' and not Wx::wxMAC();
+			}
 
 			Wx::Event::EVT_MENU( $win, $item_ID, $item_data->{'coderef'} );
 
 			$menu->Append( $item );
 			$item_ID++;
-		} elsif (not ref $item_data and $item_data eq 'separator'){
+		} elsif ($item_data eq 'separator'){
+			print "$menu $item_data\n";
 			$menu->AppendSeparator;
 		}
 	}
 }
 
 1;
+__END__
+
+=pod
+
+=head2 Menu Format
+
+every menu is an aray of items

File lib/Kephra/Edit.pm

 package Kephra::App::Editor;
 Kephra::CommandList::register_cmd_namespace('edit');
 Kephra::CommandList::register_cmd({
-	'-undo'          =>{ sub => '$ed->Undo',             label=> 'Undo',        keys=> 'ctrl+z' },
-	'-redo'          =>{ sub => '$ed->Redo',             label=> 'Redo',        keys=> 'ctrl+shift+z' },
-	'-copy'          =>{ sub => '$ed->Copy',             label=> 'Copy',        keys=> 'ctrl+c' },
-	'-copy-line'     =>{ sub => '$ed->LineCopy',         label=> 'Copy Line',   keys=> 'ctrl+shift+c'},
-	'-cut'           =>{ sub => '$ed->Cut',              label=> 'Cut',         keys=> 'ctrl+x'},
-	'-delete'        =>{ sub => '$ed->Clear',            label=> 'Delete',      keys=> 'delete'},
-	'-delete-back'   =>{ sub => '$ed->DeleteBack',       label=> 'Del Back',    keys=> 'back'},
-	'-delete-word-left'=>{sub=> '$ed->DelWordLeft',      label=> 'Del Word Left',keys=>'ctrl+back'},
-	'-delete-word-right'=>{sub=>'$ed->DelWordRight',     label=> 'Del Word Right',keys=>'ctrl+delete'},
-	'-delete-line'   =>{ sub => '$ed->LineDelete',       label=> 'Del Line',    keys=> 'ctrl+shift+delete'},
-	'-insert'        =>{ sub => '$ed->Paste',            label=> 'Insert',      keys=> 'ctrl+v'},
-	'-insert-newline'=>{ sub => '$ed->NewLine',          label=> 'Newline',     keys=> 'enter'},
-	'-replace'       =>{ sub => '$ed->replace',          label=> 'Replace',     keys=> 'ctrl+shift+v'},
-	'-double'        =>{ sub => '$ed->SelectionDuplicate',label=>'Double',      keys=> 'ctrl+d'},
-	'-select-form'   =>{ sub => '$ed->select_form',      label=> 'Form',        keys=> 'ctrl+y'},
-	'-select-content'=>{ sub => '$ed->select_content',   label=> 'Content',     keys=> 'ctrl+shift+y'},
+	'-undo'             =>{sub=>'$ed->Undo',             label=>'Undo',          keys=> 'ctrl+z'},
+	'-redo'             =>{sub=>'$ed->Redo',             label=>'Redo',          keys=> 'ctrl+shift+z'},
+	'-copy'             =>{sub=>'$ed->Copy',             label=>'Copy',          keys=> 'ctrl+c' },
+	'-copy-line'        =>{sub=>'$ed->LineCopy',         label=>'Copy Line',     keys=> 'ctrl+shift+c'},
+	'-cut'              =>{sub=>'$ed->Cut',              label=>'Cut',           keys=> 'ctrl+x'},
+	'-delete'           =>{sub=>'$ed->Clear',            label=>'Delete',        keys=> 'delete'},
+	'-delete-back'      =>{sub=>'$ed->DeleteBack',       label=>'Del Back',      keys=> 'back'},
+	'-delete-word-left' =>{sub=>'$ed->DelWordLeft',      label=>'Del Word Left', keys=> 'ctrl+back'},
+	'-delete-word-right'=>{sub=>'$ed->DelWordRight',     label=>'Del Word Right',keys=> 'ctrl+delete'},
+	'-delete-line'      =>{sub=>'$ed->LineDelete',       label=>'Del Line',      keys=> 'ctrl+shift+delete'},
+	'-insert'           =>{sub=>'$ed->Paste',            label=>'Insert',        keys=> 'ctrl+v'},
+	'-insert-newline'   =>{sub=>'$ed->NewLine',          label=>'Newline',       keys=> 'enter'},
+	'-replace'          =>{sub=>'$ed->replace',          label=>'Replace',       keys=> 'ctrl+shift+v'},
+	'-double'           =>{sub=>'$ed->SelectionDuplicate',label=>'Double',       keys=> 'ctrl+d'},
+	'-select-form'      =>{sub=>'$ed->select_form',      label=>'Form',          keys=> 'ctrl+y'},
+	'-select-content'   =>{sub=>'$ed->select_content',   label=>'Content',       keys=> 'ctrl+shift+y'},
 });
 
 sub get_clipboard_text {