⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 menu.c

📁 nedit 是一款linux下的开发源码的功能强大的编辑器
💻 C
📖 第 1 页 / 共 5 页
字号:
/* List of previously opened files for File menu */static int NPrevOpen = 0;static char **PrevOpen;#ifdef SGI_CUSTOM/* Window to receive items to be toggled on and off in short menus mode */static WindowInfo *ShortMenuWindow;#endifvoid HidePointerOnKeyedEvent(Widget w, XEvent *event){    if (event && (event->type == KeyPress || event->type == KeyRelease)) {        ShowHidePointer((TextWidget)w, True);    }}/*** Install actions for use in translation tables and macro recording, relating** to menu item commands*/void InstallMenuActions(XtAppContext context){    XtAppAddActions(context, Actions, XtNumber(Actions));}/*** Return the (statically allocated) action table for menu item actions.*/XtActionsRec *GetMenuActions(int *nActions){    *nActions = XtNumber(Actions);    return Actions;}/*** Create the menu bar*/Widget CreateMenuBar(Widget parent, WindowInfo *window){    Widget menuBar, menuPane, btn, subPane, subSubPane, subSubSubPane, cascade;    /*    ** Create the menu bar (row column) widget    */    menuBar = XmCreateMenuBar(parent, "menuBar", NULL, 0);#ifdef SGI_CUSTOM    /*    ** Short menu mode is a special feature for the SGI system distribution    ** version of NEdit.    **    ** To make toggling short-menus mode faster (re-creating the menus was    ** too slow), a list is kept in the window data structure of items to    ** be turned on and off.  Initialize that list and give the menu creation    ** routines a pointer to the window on which this list is kept.  This is    ** (unfortunately) a global variable to keep the interface simple for    ** the mainstream case.    */    ShortMenuWindow = window;    window->nToggleShortItems = 0;#endif    /*    ** "File" pull down menu.    */    menuPane = createMenu(menuBar, "fileMenu", "File", 0, NULL, SHORT);    createMenuItem(menuPane, "new", "New", 'N', doActionCB, "new", SHORT);    createMenuItem(menuPane, "open", "Open...", 'O', doActionCB, "open_dialog",    	    SHORT);    window->openSelItem=createMenuItem(menuPane, "openSelected", "Open Selected", 'd',    	    doActionCB, "open_selected", FULL);    if (GetPrefMaxPrevOpenFiles() != 0) {	window->prevOpenMenuPane = createMenu(menuPane, "openPrevious",    		"Open Previous", 'v', &window->prevOpenMenuItem, SHORT);	XtSetSensitive(window->prevOpenMenuItem, NPrevOpen != 0);	XtAddCallback(window->prevOpenMenuItem, XmNcascadingCallback,    		(XtCallbackProc)prevOpenMenuCB, window);    }    createMenuSeparator(menuPane, "sep1", SHORT);    window->closeItem = createMenuItem(menuPane, "close", "Close", 'C',    	    doActionCB, "close", SHORT);    createMenuItem(menuPane, "save", "Save", 'S', doActionCB, "save", SHORT);    createMenuItem(menuPane, "saveAs", "Save As...", 'A', doActionCB,    	    "save_as_dialog", SHORT);    createMenuItem(menuPane, "revertToSaved", "Revert to Saved", 'R',    	    doActionCB, "revert_to_saved_dialog", SHORT);    createMenuSeparator(menuPane, "sep2", SHORT);    createMenuItem(menuPane, "includeFile", "Include File...", 'I',    	    doActionCB, "include_file_dialog", SHORT);    createMenuItem(menuPane, "loadMacroFile", "Load Macro File...", 'M',    	    doActionCB, "load_macro_file_dialog", FULL);    createMenuItem(menuPane, "loadTagsFile", "Load Tags File...", 'T',    	    doActionCB, "load_tags_file_dialog", FULL);    window->unloadTagsMenuPane = createMenu(menuPane, "unloadTagsFiles",	    "Unload Tags File", 'U', &window->unloadTagsMenuItem, FULL);    XtSetSensitive(window->unloadTagsMenuItem, TagsFileList != NULL);    XtAddCallback(window->unloadTagsMenuItem, XmNcascadingCallback,	    (XtCallbackProc)unloadTagsFileMenuCB, window);    createMenuItem(menuPane, "loadTipsFile", "Load Calltips File...", 'F',    	    doActionCB, "load_tips_file_dialog", FULL);    window->unloadTipsMenuPane = createMenu(menuPane, "unloadTipsFiles",	    "Unload Calltips File", 'e', &window->unloadTipsMenuItem, FULL);    XtSetSensitive(window->unloadTipsMenuItem, TipsFileList != NULL);    XtAddCallback(window->unloadTipsMenuItem, XmNcascadingCallback,	    (XtCallbackProc)unloadTipsFileMenuCB, window);    createMenuSeparator(menuPane, "sep3", SHORT);    createMenuItem(menuPane, "print", "Print...", 'P', doActionCB, "print",    	    SHORT);    window->printSelItem = createMenuItem(menuPane, "printSelection",    	    "Print Selection...", 'l', doActionCB, "print_selection",    	    SHORT);    XtSetSensitive(window->printSelItem, window->wasSelected);    createMenuSeparator(menuPane, "sep4", SHORT);    createMenuItem(menuPane, "exit", "Exit", 'x', doActionCB, "exit", SHORT);       CheckCloseDim();    /*     ** "Edit" pull down menu.    */    menuPane = createMenu(menuBar, "editMenu", "Edit", 0, NULL, SHORT);    window->undoItem = createMenuItem(menuPane, "undo", "Undo", 'U',    	    doActionCB, "undo", SHORT);    XtSetSensitive(window->undoItem, False);    window->redoItem = createMenuItem(menuPane, "redo", "Redo", 'R',    	    doActionCB, "redo", SHORT);    XtSetSensitive(window->redoItem, False);    createMenuSeparator(menuPane, "sep1", SHORT);    window->cutItem = createMenuItem(menuPane, "cut", "Cut", 't', doActionCB,    	    "cut_clipboard", SHORT);    XtSetSensitive(window->cutItem, window->wasSelected);    window->copyItem = createMenuItem(menuPane, "copy", "Copy", 'C', doActionCB,    	    "copy_clipboard", SHORT);    XtSetSensitive(window->copyItem, window->wasSelected);    createMenuItem(menuPane, "paste", "Paste", 'P', doActionCB,    	    "paste_clipboard", SHORT);    createMenuItem(menuPane, "pasteColumn", "Paste Column", 's', pasteColCB,    	    window, SHORT);    window->delItem=createMenuItem(menuPane, "delete", "Delete", 'D', doActionCB, "delete_selection",    	    SHORT);    XtSetSensitive(window->delItem, window->wasSelected);    createMenuItem(menuPane, "selectAll", "Select All", 'A', doActionCB,    	    "select_all", SHORT);    createMenuSeparator(menuPane, "sep2", SHORT);    createMenuItem(menuPane, "shiftLeft", "Shift Left", 'L',    	    shiftLeftCB, window, SHORT);    createFakeMenuItem(menuPane, "shiftLeftShift", shiftLeftCB, window);    createMenuItem(menuPane, "shiftRight", "Shift Right", 'g',    	    shiftRightCB, window, SHORT);    createFakeMenuItem(menuPane, "shiftRightShift", shiftRightCB, window);    window->lowerItem=createMenuItem(menuPane, "lowerCase", "Lower-case", 'w',    	    doActionCB, "lowercase", SHORT);    window->upperItem=createMenuItem(menuPane, "upperCase", "Upper-case", 'e',    	    doActionCB, "uppercase", SHORT);    createMenuItem(menuPane, "fillParagraph", "Fill Paragraph", 'F',    	    doActionCB, "fill_paragraph", SHORT);    createMenuSeparator(menuPane, "sep3", FULL);    createMenuItem(menuPane, "insertFormFeed", "Insert Form Feed", 'I',    	    formFeedCB, window, FULL);    createMenuItem(menuPane, "insertCtrlCode", "Insert Ctrl Code...", 'n',    	    doActionCB, "control_code_dialog", FULL);#ifdef SGI_CUSTOM    createMenuSeparator(menuPane, "sep4", SHORT);    createMenuToggle(menuPane, "overtype", "Overtype", 'O',    	    doActionCB, "set_overtype_mode", False, SHORT);    window->readOnlyItem = createMenuToggle(menuPane, "readOnly", "Read Only",    	    'y', doActionCB, "set_locked", IS_USER_LOCKED(window->lockReasons), FULL);#endif    /*     ** "Search" pull down menu.    */    menuPane = createMenu(menuBar, "searchMenu", "Search", 0, NULL, SHORT);    createMenuItem(menuPane, "find", "Find...", 'F', findCB, window, SHORT);    createFakeMenuItem(menuPane, "findShift", findCB, window);    window->findAgainItem=createMenuItem(menuPane, "findAgain", "Find Again", 'i', findSameCB, window,    	    SHORT);    XtSetSensitive(window->findAgainItem, NHist);    createFakeMenuItem(menuPane, "findAgainShift", findSameCB, window);    window->findSelItem=createMenuItem(menuPane, "findSelection", "Find Selection", 'S',    	    findSelCB, window, SHORT);    createFakeMenuItem(menuPane, "findSelectionShift", findSelCB, window);    createMenuItem(menuPane, "findIncremental", "Find Incremental", 'n',	    findIncrCB, window, SHORT);    createFakeMenuItem(menuPane, "findIncrementalShift", findIncrCB, window);    createMenuItem(menuPane, "replace", "Replace...", 'R', replaceCB, window,    	    SHORT);    createFakeMenuItem(menuPane, "replaceShift", replaceCB, window);    window->replaceFindAgainItem=createMenuItem(menuPane, "replaceFindAgain", "Replace Find Again", 'A',    	    replaceFindSameCB, window, SHORT);    XtSetSensitive(window->replaceFindAgainItem, NHist);    createFakeMenuItem(menuPane, "replaceFindAgainShift", replaceFindSameCB, window);    window->replaceAgainItem=createMenuItem(menuPane, "replaceAgain", "Replace Again", 'p',    	    replaceSameCB, window, SHORT);    XtSetSensitive(window->replaceAgainItem, NHist);    createFakeMenuItem(menuPane, "replaceAgainShift", replaceSameCB, window);    createMenuSeparator(menuPane, "sep1", FULL);    createMenuItem(menuPane, "gotoLineNumber", "Goto Line Number...", 'L',    	    doActionCB, "goto_line_number_dialog", FULL);    window->gotoSelItem=createMenuItem(menuPane, "gotoSelected", "Goto Selected", 'G',    	    doActionCB, "goto_selected", FULL);    createMenuSeparator(menuPane, "sep2", FULL);    createMenuItem(menuPane, "mark", "Mark", 'k', markCB, window, FULL);    createMenuItem(menuPane, "gotoMark", "Goto Mark", 'o', gotoMarkCB, window,    	    FULL);    createFakeMenuItem(menuPane, "gotoMarkShift", gotoMarkCB, window);    createMenuSeparator(menuPane, "sep3", FULL);    createMenuItem(menuPane, "gotoMatching", "Goto Matching (..)", 'M',    	    gotoMatchingCB, window, FULL);    createFakeMenuItem(menuPane, "gotoMatchingShift", gotoMatchingCB, window);    window->findDefItem = createMenuItem(menuPane, "findDefinition",    	    "Find Definition", 'D', doActionCB, "find_definition", FULL);    XtSetSensitive(window->findDefItem, TagsFileList != NULL);    window->showTipItem = createMenuItem(menuPane, "showCalltip",    	    "Show Calltip", 'C', doActionCB, "show_tip", FULL);    XtSetSensitive(window->showTipItem, (TagsFileList != NULL ||                                          TipsFileList != NULL) );        /*    ** Preferences menu, Default Settings sub menu    */    menuPane = createMenu(menuBar, "preferencesMenu", "Preferences", 0, NULL,    	    SHORT);    subPane = createMenu(menuPane, "defaultSettings", "Default Settings", 'D',    	    NULL, FULL);    createMenuItem(subPane, "languageModes", "Language Modes...", 'L',    	    languageDefCB, window, FULL);        /* Auto Indent sub menu */    subSubPane = createMenu(subPane, "autoIndent", "Auto Indent", 'A',    	    NULL, FULL);    window->autoIndentOffDefItem = createMenuRadioToggle(subSubPane, "off",    	    "Off", 'O', autoIndentOffDefCB, window,    	    GetPrefAutoIndent(PLAIN_LANGUAGE_MODE) == NO_AUTO_INDENT, SHORT);    window->autoIndentDefItem = createMenuRadioToggle(subSubPane, "on",    	    "On", 'n', autoIndentDefCB, window,    	    GetPrefAutoIndent(PLAIN_LANGUAGE_MODE) == AUTO_INDENT, SHORT);    window->smartIndentDefItem = createMenuRadioToggle(subSubPane, "smart",    	    "Smart", 'S', smartIndentDefCB, window,    	    GetPrefAutoIndent(PLAIN_LANGUAGE_MODE) == SMART_INDENT, SHORT);    createMenuSeparator(subSubPane, "sep1", SHORT);    createMenuItem(subSubPane, "ProgramSmartIndent", "Program Smart Indent...",    	    'P', smartMacrosDefCB, window, FULL);        /* Wrap sub menu */    subSubPane = createMenu(subPane, "wrap", "Wrap", 'W', NULL, FULL);    window->noWrapDefItem = createMenuRadioToggle(subSubPane,    	    "none", "None", 'N', noWrapDefCB,	    window, GetPrefWrap(PLAIN_LANGUAGE_MODE) == NO_WRAP, SHORT);    window->newlineWrapDefItem = createMenuRadioToggle(subSubPane,    	    "autoNewline", "Auto Newline", 'A', newlineWrapDefCB,	    window, GetPrefWrap(PLAIN_LANGUAGE_MODE) == NEWLINE_WRAP, SHORT);    window->contWrapDefItem = createMenuRadioToggle(subSubPane, "continuous",    	    "Continuous", 'C', contWrapDefCB, window,    	    GetPrefWrap(PLAIN_LANGUAGE_MODE) == CONTINUOUS_WRAP, SHORT);    createMenuSeparator(subSubPane, "sep1", SHORT);    createMenuItem(subSubPane, "wrapMargin", "Wrap Margin...", 'W',    	    wrapMarginDefCB, window, SHORT);        /* Smart Tags sub menu */    subSubPane = createMenu(subPane, "smartTags", "Tag Collisions", 'l',	    NULL, FULL);    window->allTagsDefItem = createMenuRadioToggle(subSubPane, "showall",	    "Show All", 'A', showAllTagsDefCB, window, !GetPrefSmartTags(),	    FULL);    window->smartTagsDefItem = createMenuRadioToggle(subSubPane, "smart",	    "Smart", 'S', smartTagsDefCB, window, GetPrefSmartTags(), FULL);    createMenuItem(subPane, "tabDistance", "Tabs...", 'T', tabsDefCB, window,    	    SHORT);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -