Kephra

 view release on metacpan or  search on metacpan

lib/Kephra/App/Window/Menu.pm  view on Meta::CPAN

use v5.12;
use warnings;
use Wx;

package Kephra::App::Window::Menu;

my $edit;

sub mount {
    my ($win) = @_;
    my $ed = $win->{'editor'};

    $win->{'file_menu'} = my $file_menu = Wx::Menu->new();
    $file_menu->Append( 11100, "&New\tCtrl+N", "create new empty document" );
    $file_menu->AppendSeparator();
    $file_menu->Append( 11200, "&Open\tCtrl+O", "create document by loading a given (dialog) file" );
    $file_menu->Append( 11210, "&Reload\tCtrl+Shift+O", "disregard current state of document and laod associated file" );
    $file_menu->AppendSeparator();
    $file_menu->Append( 11400, "&Save\tCtrl+S", "save current sate of document into associated file" );
    $file_menu->Append( 11500, "Save &As\tCtrl+Shift+S", "save document into different file, which will be the new associated file" );
    $file_menu->Append( 11600, "Save &Under\tAlt+Shift+S", "save document into different file, but keep the old associated file" );
    $file_menu->AppendSeparator();
    $file_menu->Append( 11900, "&Quit\tCtrl+Q", "close program" );
    $file_menu->Append( 11910, "No Ask Qui&t\tCtrl+Shift+Q", "close program without file dialog" );

    my $edit_menu = Wx::Menu->new();
    $edit_menu->Append( 12110, "&Undo\tCtrl+Z",       "undo last text change" );
    $edit_menu->Append( 12120, "&Redo\tCtrl+Y",       "undo last undo" );
    $edit_menu->Append( 12130, "&fast Undo\tCtrl+Shift+Z",       "undo last five changes" );
    $edit_menu->Append( 12140, "f&ast Redo\tCtrl+Shift+Y",       "undo last five undo" );
    $edit_menu->Append( 12150, "&total Undo\tAlt+Shift+Z",       "undo all changes" );
    $edit_menu->Append( 12160, "t&otal Redo\tAlt+Shift+Y",       "redo all changes" );
    $edit_menu->AppendSeparator();
    $edit_menu->Append( 12200, "&Cut\tCtrl+X",        "delete selected text and move it into clipboard" );
    $edit_menu->Append( 12210, "Cop&y\tCtrl+C",       "move selected text into clipboard" );
    $edit_menu->Append( 12220, "&Paste\tCtrl+V",      "insert clipboard content at cursor position" );
    $edit_menu->Append( 12230, "S&wap\tCtrl+Shift+V", "replace selected text with clipboard content" );
    $edit_menu->Append( 12240, "De&lete\tDel",        "delete selected text" );
    $edit_menu->Append( 12310, "Del&ete Row\tAlt+Del",        "delete row of caret location" );
    $edit_menu->AppendSeparator();
    $edit_menu->Append( 12410, "&Grow Selection\tCtrl+A", "select entire text" );
    $edit_menu->Append( 12420, "&Shrink Selection\tCtrl+Shift+A", "select entire text" );
    $edit_menu->AppendSeparator();
    $edit_menu->Append( 12510, "&Duplicate\tCtrl+D",     "copy and paste selected text or current line" );

    my $format_menu = Wx::Menu->new();
    $format_menu->Append( 13100, "Move &Left\tAlt+Left",  "move current line or selected lines one character to the left" );
    $format_menu->Append( 13110, "Move &Right\tAlt+Right","move current line or selected lines one character to right" );
    $format_menu->Append( 13120, "Move &Up\tAlt+Up",      "move current line or selected lines one row up" );
    $format_menu->Append( 13130, "Move &Down\tAlt+Down",  "move current line or selected lines one row down" );
    $format_menu->AppendSeparator();
    $format_menu->Append( 13200, "&Indent\tTab",       "move current line or selected block one tab to right" );
    $format_menu->Append( 13210, "D&edent\tShift+Tab", "move current line or selected block one tab to left" );
    $format_menu->AppendSeparator();
    $format_menu->Append( 13300, "&Block Comment\tCtrl+K", "insert or remove (toggle) script comment with #~" );
    $format_menu->Append( 13310, "&Comment\tCtrl+Shift+K", "insert or remove (toggle) script comment with #" );

    my $search_menu = Wx::Menu->new();
    $search_menu->Append( 14110, "&Find\tCtrl+F",        "enter search phrase into search bar" );
    $search_menu->Append( 14120, "Find &Prev\tShift+F3", "jump to previous match of search term" );
    $search_menu->Append( 14130, "Find &Next\tF3",       "jump to next match of search text" );
    $search_menu->AppendSeparator();
    $search_menu->Append( 14210, "&Replace\tCtrl+Shift+F",      "enter replace term into replace bar" );
    $search_menu->Append( 14220, "Replace Pre&v\tAlt+Shift+F3", "replace selection and go to previous match" );
    $search_menu->Append( 14230, "Replace Ne&xt\tAlt+F3",       "replace selection and go to next match" );
    $search_menu->Append( 14240, "Replace In &Selection\tAlt+Shift+F", "replace all search term matches inside selected text" );
    $search_menu->Append( 14250, "Replace &All\tAlt+F",         "replace all search term matches in the document" );
    $search_menu->AppendSeparator();
    $search_menu->Append( 14310, "&Toggle Marker\tCtrl+M", "set or remove marker on current line" );
    $search_menu->Append( 14320, "Prev Mar&ker\tShift+F2", "jump to previous marked line above current caret position " );
    $search_menu->Append( 14330, "Next &Marker\tF2",       "jump to next marked line below current caret position" );
    $search_menu->Append( 14340, "&Delete All Marker\tCtrl+Shift+M", "remove all marker" );
    $search_menu->AppendSeparator();
    $search_menu->Append( 14400, "&Goto Edit\tCtrl+E", "move cursor position of last change" );

    my $doc_menu  = Wx::Menu->new();
    $doc_menu->AppendCheckItem( 15100, "&Soft Tabs",    "several space characters (see below) will inserted instead of one tab character" );
    $doc_menu->Check(15100, 1);
    my $doc_tab_menu  = Wx::Menu->new();
    my @tab_range = 1..10;
    $doc_tab_menu->AppendRadioItem( 15200+$_, $_ ,  ) for @tab_range;
    $doc_tab_menu->Check(15204, 1);
    $doc_menu->Append( 15200, '&Indention Size', $doc_tab_menu, 'size of tab character' );
    $doc_menu->AppendSeparator();
        my $doc_eol_menu  = Wx::Menu->new();
        $doc_eol_menu->AppendRadioItem( 15411, '&Linux (LF)', 'use only LF as line end character and convert all line endings to it' );
        $doc_eol_menu->AppendRadioItem( 15412, '&Mac (CR)', 'use only CR as line end character and convert all line endings to it' );
        $doc_eol_menu->AppendRadioItem( 15413, '&Windows (CR+LF)', 'use CR and LF combination as line end character and convert all line endings to it' );
        $doc_menu->Check(15410, 1);
    $doc_menu->Append( 15400, '&Line Ending', $doc_eol_menu, '' );
        my $doc_encoding_menu  = Wx::Menu->new();
        $doc_encoding_menu->AppendRadioItem( 15601, 'ASCII' );
        $doc_encoding_menu->AppendRadioItem( 15602, 'UTF-8' );
        $doc_encoding_menu->AppendRadioItem( 15603, 'UTF-16' );
        $doc_encoding_menu->AppendRadioItem( 15604, 'Latin 1' );
        $doc_encoding_menu->AppendRadioItem( 15605, 'Latin 2' );
        $doc_encoding_menu->AppendRadioItem( 15606, 'Latin 3' );



( run in 0.472 second using v1.01-cache-2.11-cpan-81fc1098f69 )