Ignore:
Timestamp:
Dec 8, 2018, 12:17:23 AM (6 years ago)
Author:
Andreas Schnellbacher
Message:
  • Replaced Tab and Backtab configuration.
  • Added more options for Tab and Backtab keys and its altered variants.
  • Backtab now handles tab chars in a line correctly. For that tab chars are expanded first. The cursor sol. is now correct.
  • Removed obsolete funcs, consts and universals like WANT_TAB_INSERTION_TO_SPACE and tab_keys.
  • Also removed SMARTFILE.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/netlabs/macros/newmenu.e

    r3293 r3300  
    26592659
    26602660   DefNextItemStartsSubMenu()
    2661    DefMenuItem( 'streamnewline',                                              -- Stream and Newline
     2661   DefMenuItem( 'streamnewline',                                              -- Stream and Newline  >
    26622662                'Stream and Ne~wline',
    26632663                '',
     
    27802780                '',
    27812781                'STATIC')
    2782    DefMenuItem( 'defaulttabkey',                                                    -- Tabkey: Tab key enters tab char
    2783                 '~Tabkey: tab key enters tab char',
    2784                 'toggle_default_tabkey',
    2785                 'Tabkey enters a tab char instead of spaces',
     2782   DefMenuItem( 'tab',                                                              -- Tab []
     2783                'Tab []',
     2784                'ChangeTab tab',
     2785                'Change behavior of Tab',
     2786                '',
     2787                NoDismiss)
     2788   DefMenuItem( 'c_tab',                                                            -- Ctrl+Tab []
     2789                CTRL_KEY__MSG'+Tab []',
     2790                'ChangeTab c_tab',
     2791                'Change behavior of 'CTRL_KEY__MSG'+Tab',
     2792                '',
     2793                NoDismiss)
     2794   DefMenuItem( 'c_a_tab',                                                          -- Ctrl+Alt+Tab []
     2795                CTRL_KEY__MSG'+'ALT_KEY__MSG'+Tab []',
     2796                'ChangeTab c_a_tab',
     2797                'Change behavior of 'CTRL_KEY__MSG'+'ALT_KEY__MSG'+Tab',
     2798                '',
     2799                NoDismiss)
     2800   DefMenuItem( 's_backtab',                                                        -- Backtab []
     2801                'Backtab []',
     2802                'ChangeTab s_backtab',
     2803                'Change behavior of Backtab',
     2804                '',
     2805                NoDismiss)
     2806   DefMenuItem( 'c_s_backtab',                                                      -- Ctrl+Backtab []
     2807                CTRL_KEY__MSG'+Backtab []',
     2808                'ChangeTab c_s_backtab',
     2809                'Change behavior of 'CTRL_KEY__MSG'+Backtab',
    27862810                '',
    27872811                NoDismiss)
     
    36753699   universal stream_mode
    36763700   universal expand_on
    3677    universal tab_key
    36783701   universal matchtab_on
    36793702compile if CHECK_FOR_LEXAM
     
    44744497
    44754498defc menuinit_specialkeys
    4476    universal default_tab_key
    44774499   universal cua_menu_accel
    44784500
    4479    SetMenuAttribute( GetAVar('mid_defaulttabkey'), MIA_CHECKED, not default_tab_key)
     4501   MenuText_tab()
     4502   MenuText_c_tab()
     4503   MenuText_c_a_tab()
     4504   MenuText_s_backtab()
     4505   MenuText_c_s_backtab()
    44804506
    44814507   KeyPath = '\NEPMD\User\SpecialKeys\Tab\MatchWordsAbove'
     
    45224548   on = QueryConfigKey( KeyPath)
    45234549   SetMenuAttribute( GetAVar('mid_blockrightaltkey'),   MIA_CHECKED, not on)
     4550
     4551defc ChangeTab
     4552   KeyString = arg( 1)
     4553   KeyPath = '\NEPMD\User\SpecialKeys\'KeyString
     4554   Options = QueryConfigKey( KeyPath)
     4555   NewOptions = Options
     4556   if wordpos( KeyString, 'tab c_tab c_a_tab') then
     4557      List = 'Text,Spaces Text,Tab TextIns,Spaces TextIns,Tab Cursor'
     4558      wp = wordpos( Options, List)
     4559      Nextwp = wp + 1
     4560      if Nextwp > words( List) then
     4561         Nextwp = 1
     4562      endif
     4563      NewOptions = word( List, Nextwp)
     4564   elseif wordpos( KeyString, 's_backtab c_s_backtab') then
     4565      List = 'Text,Spaces TextIns,Spaces Cursor'
     4566      wp = wordpos( Options, List)
     4567      Nextwp = wp + 1
     4568      if Nextwp > words( List) then
     4569         Nextwp = 1
     4570      endif
     4571      NewOptions = word( List, Nextwp)
     4572   endif
     4573   if NewOptions <> Options & NewOptions <> '' then
     4574      WriteConfigKey( KeyPath, NewOptions)
     4575   endif
     4576   SetMenuVarText( KeyString, TabOptionsToText( NewOptions))
     4577
     4578defproc TabOptionsToText
     4579   Options = arg( 1)
     4580   Text = ''
     4581   if Options = 'Text,Spaces' then
     4582      Text = 'moves text with spaces'
     4583   elseif Options = 'Text,Tab' then
     4584      Text = 'moves text with tab'
     4585   elseif Options = 'TextIns,Spaces' then
     4586      Text = 'moves text in insert mode with spaces'
     4587   elseif Options = 'TextIns,Tab' then
     4588      Text = 'moves text in insert mode with tab'
     4589   elseif Options = 'Cursor' then
     4590      Text = 'moves cursor'
     4591   endif
     4592   return Text
     4593
     4594defproc MenuText_tab
     4595   KeyString = 'tab'
     4596   KeyPath = '\NEPMD\User\SpecialKeys\'KeyString
     4597   Options = QueryConfigKey( KeyPath)
     4598   SetMenuVarText( KeyString, TabOptionsToText( Options))
     4599
     4600defproc MenuText_c_tab
     4601   KeyString = 'c_tab'
     4602   KeyPath = '\NEPMD\User\SpecialKeys\'KeyString
     4603   Options = QueryConfigKey( KeyPath)
     4604   SetMenuVarText( KeyString, TabOptionsToText( Options))
     4605
     4606defproc MenuText_c_a_tab
     4607   KeyString = 'c_a_tab'
     4608   KeyPath = '\NEPMD\User\SpecialKeys\'KeyString
     4609   Options = QueryConfigKey( KeyPath)
     4610   SetMenuVarText( KeyString, TabOptionsToText( Options))
     4611
     4612defproc MenuText_s_backtab
     4613   KeyString = 's_backtab'
     4614   KeyPath = '\NEPMD\User\SpecialKeys\'KeyString
     4615   Options = QueryConfigKey( KeyPath)
     4616   SetMenuVarText( KeyString, TabOptionsToText( Options))
     4617
     4618defproc MenuText_c_s_backtab
     4619   KeyString = 'c_s_backtab'
     4620   KeyPath = '\NEPMD\User\SpecialKeys\'KeyString
     4621   Options = QueryConfigKey( KeyPath)
     4622   SetMenuVarText( KeyString, TabOptionsToText( Options))
    45244623
    45254624defproc MenuText_scrollafterlocate
     
    54815580
    54825581; ---------------------------------------------------------------------------
    5483 defc toggle_tabkey
    5484    universal tab_key
    5485    universal menuloaded
    5486    -- Change tab_key for current file
    5487    tab_key = not tab_key
    5488    'SetTabKey' tab_key
    5489    if menuloaded then
    5490       -- Set MIA_CHECKED attribute for the case MIA_NODISMISS attribute is on
    5491       SetMenuAttribute( GetAVar('mid_tabkey'), MIA_CHECKED, not tab_key)
    5492    endif
    5493 
    5494 ; ---------------------------------------------------------------------------
    5495 defc toggle_default_tabkey
    5496    universal default_tab_key
    5497    universal tab_key
    5498    universal menuloaded
    5499    universal app_hini
    5500    universal appname
    5501 
    5502    default_tab_key = not default_tab_key
    5503    -- Change tab_key for current file if it has default tabkey setting
    5504    getfileid fid
    5505    next = GetAVar(fid'.tabkey')  -- query file setting
    5506    if next = 'DEFAULT' | next = '' then  -- unset if tabkey was not changed by any modeexecute
    5507       tab_key = default_tab_key
    5508       'RefreshInfoLine TABKEY'
    5509    endif
    5510    if menuloaded then
    5511       -- Set MIA_CHECKED attribute for the case MIA_NODISMISS attribute is on
    5512       SetMenuAttribute( GetAVar('mid_defaulttabkey'), MIA_CHECKED, not default_tab_key)
    5513       old = queryprofile( app_hini, appname, INI_OPTFLAGS)
    5514       new = subword( old, 1, 13)' 'default_tab_key' 'subword( old, 15)
    5515       call setprofile( app_hini, appname, INI_OPTFLAGS, new)
    5516    endif
    5517 
    5518 ; ---------------------------------------------------------------------------
    55195582defc toggle_matchtab
    55205583   universal menuloaded
     
    55395602   getfileid fid
    55405603   next = GetAVar(fid'.matchtab')  -- query file setting
    5541    if next = 'DEFAULT' | next = '' then  -- unset if tabkey was not changed by any modeexecute
     5604   if next = 'DEFAULT' | next = '' then
    55425605      matchtab_on = on
    55435606      'RefreshInfoLine MATCHTAB'
Note: See TracChangeset for help on using the changeset viewer.