📄 menu.c
字号:
/* * New editor name: TDE, the Thomson-Davis Editor. * Author: Frank Davis and Jason Hood * Date: August 9, 1998 * * This file contains the pull-down menu and strings for the keys. */#include "tdestr.h"#include "define.h"/* * simple pull-down menu stuff * * pull.c auto calculates the number of selections under each menu choice. * end the selections with a NULL string and ERROR in the function list. * pull.c also calculates the width of the pull menu. * * jmh - added some extra functions and spacing * jmh 980524: removed the borders, added the #defines. * jmh 980809: use sizeof to calculate the number of selections, * removing the need for the last NULL. * jmh 991021: added an array of item names. * jmh 991025: added another menu - "Move"; * modified the method of creating key strings. * jmh 991104: added the two HorizontalScreen functions to "Move" (and * removed them from the help screen). * jmh 010624: added pop-out menus, re-organised menus as a result. * jmh 031129: added Item & SubM macros; * added User menu. * jmh 050710: added Help menu. * jmh 050722: to assist customisation start the name/label with a NUL to * indicate static memory, rather than allocated; likewise * the first line has ERROR-1 instead of ERROR. */#define Begin( name ) static MINOR_STR name[] = { \ { NULL, ERROR-1, NULL, FALSE, NULL },#define Item( name, func ) { "\000" name, func | _FUNCTION, NULL, FALSE, NULL },#define SubM( name, num ) { "\000" name, 0,&popout_default[num].popout, FALSE, NULL },#define Separator { NULL, ERROR, NULL, FALSE, NULL },#define SepLabel( label ) { "\000" label, ERROR, NULL, FALSE, NULL },#define End Separator };Begin( file_special ) Item( "Save all", SaveAll ) Item( "Save to", SaveTo ) Item( "Save untouched", SaveUntouched ) Item( "Revert", Revert ) Item( "Insert File", InsertFile ) Item( "Write Block", BlockToFile ) Item( "Print", PrintBlock )EndBegin( block_conversion ) Item( "Upper Case", BlockUpperCase ) Item( "Lower Case", BlockLowerCase ) Item( "Invert Case", BlockInvertCase ) Item( "Capitalise", BlockCapitalise ) Separator Item( "Strip hi bit", BlockStripHiBit ) Item( "Rot13", BlockRot13 ) Item( "Fix UUE prob", BlockFixUUE )EndBegin( block_comment ) Item( "Block", BlockBlockComment ) Item( "Line", BlockLineComment ) Item( "Remove", BlockUnComment )End#if defined( __DJGPP__ ) || defined( __WIN32__ )Begin( block_clipboard ) Item( "Copy", CopyToClipboard ) Item( "Kopy", KopyToClipboard ) Item( "Cut", CutToClipboard ) Item( "Paste", PasteFromClipboard )End#endifBegin( block_border ) Item( "Standard", BorderBlock ) Item( "Enhanced", BorderBlockEx )EndBegin( block_fill ) Item( "Character", FillBlock ) Item( "Down", FillBlockDown ) Item( "Pattern", FillBlockPattern )EndBegin( word_tabs ) Item( "Set tabs", SetTabs ) Item( "Smart tabs", ToggleSmartTabs ) Item( "Inflate tabs", ToggleTabInflate ) Item( "Dynamic size", DynamicTabSize )EndBegin( word_indent ) Item( "Indent spaces", BlockIndentN ) Item( "Undent spaces", BlockUndentN ) Item( "Indent", BlockIndent ) Item( "Undent", BlockUndent )EndBegin( macro_file ) Item( "Load", LoadMacro ) Item( "Save", SaveMacro ) Item( "Clear", ClearAllMacros )End#define Popout( menu ) \ { menu, sizeof(menu) / sizeof(*menu), 0, 0, 0, 0, 0 }#define PopoutList( idx, menu ) { &popout_default[idx+1], Popout( menu ) },#define PopoutLEnd( idx, menu ) { NULL, Popout( menu ) }MENU_LIST popout_default[] = { PopoutList( 0, block_conversion ) PopoutList( 1, word_tabs ) PopoutList( 2, word_indent ) PopoutList( 3, macro_file ) PopoutList( 4, block_comment ) PopoutList( 5, block_border ) PopoutList( 6, block_fill )#if defined( __DJGPP__ ) || defined( __WIN32__ ) PopoutList( 7, file_special ) PopoutLEnd( 8, block_clipboard )#else PopoutLEnd( 7, file_special )#endif};MENU_LIST *popout_last = popout_default + sizeof(popout_default) / sizeof(*popout_default) - 1;MENU_LIST *popout_menu = popout_default;Begin( file_opts ) Item( "Directory", DirList ) Item( "Load", EditFile ) Item( "Load Next", EditNextFile ) Item( "File Find", DefineGrep ) Item( "Next File", RepeatGrep ) Item( "Scratch", ScratchWindow ) Item( "Save", Save ) Item( "Save as", SaveAs ) Item( "Save & Close", File ) Item( "Close", Quit ) Item( "File attr", FileAttributes ) SubM( "Special", 7 ) Separator Item( "Select Language", SyntaxSelect ) Item( "Read Config", ReadConfig ) Item( "Status", Status ) Item( "Statistics", Statistics ) Item( "Set directory", SetDirectory ) Separator Item( "Save Workspace", SaveWorkspace ) Item( "Exit", QuitAll ) Item( "Save and Exit", FileAll )EndBegin( search_opts ) Item( "Search", DefineSearch ) Item( "Repeat", RepeatSearch ) Item( "Replace", ReplaceString ) Separator Item( "Find forward", FindForward ) Item( "Find backward", FindBackward ) Item( "Repeat >", RepeatFindForward ) Item( "Repeat <", RepeatFindBackward ) Item( "ISearch >", ISearchForward ) Item( "ISearch <", ISearchBackward ) Separator Item( "Regx forward", RegXForward ) Item( "Regx backward", RegXBackward ) Item( "Repeat >", RepeatRegXForward ) Item( "Repeat <", RepeatRegXBackward ) Separator Item( "Toggle Case", ToggleSearchCase ) Separator Item( "Begin Diff", DefineDiff ) Item( "Next Diff", RepeatDiff )EndBegin( block_opts ) Item( "Copy", CopyBlock ) Item( "Kopy", KopyBlock ) Item( "Delete", DeleteBlock ) Item( "Move", MoveBlock ) Item( "Overlay", OverlayBlock ) Item( "Swap", SwapBlock ) Item( "Sort", SortBoxBlock ) SubM( "Comment", 4 ) SubM( "Conversions", 0 )#if defined( __DJGPP__ ) || defined( __WIN32__ ) SubM( "Clipboard", sizeof(popout_default) / sizeof(*popout_default) - 1 )#endif Item( "Move Mark", MoveMark ) SepLabel( "Line only" )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -