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

📄 menu.c

📁 nedit 是一款linux下的开发源码的功能强大的编辑器
💻 C
📖 第 1 页 / 共 5 页
字号:
    XtVaSetValues(window->cancelShellItem, XmNuserData, PERMANENT_MENU_ITEM,    	    XmNsensitive, False, NULL);    btn = createMenuSeparator(menuPane, "sep1", SHORT);    XtVaSetValues(btn, XmNuserData, PERMANENT_MENU_ITEM, NULL);    /* UpdateShellMenu(window) now done in DetermineLanguageMode */#endif    /*    ** Create the Macro menu    */    menuPane = window->macroMenuPane =    	    createMenu(menuBar, "macroMenu", "Macro", 0, NULL, FULL);    window->learnItem = createMenuItem(menuPane, "learnKeystrokes",    	    "Learn Keystrokes", 'L', learnCB, window, SHORT);    XtVaSetValues(window->learnItem , XmNuserData, PERMANENT_MENU_ITEM, NULL);    window->finishLearnItem = createMenuItem(menuPane, "finishLearn",    	    "Finish Learn", 'F', finishLearnCB, window, SHORT);    XtVaSetValues(window->finishLearnItem , XmNuserData, PERMANENT_MENU_ITEM,    	    XmNsensitive, False, NULL);    window->cancelMacroItem = createMenuItem(menuPane, "cancelLearn",    	    "Cancel Learn", 'C', cancelLearnCB, window, SHORT);    XtVaSetValues(window->cancelMacroItem, XmNuserData, PERMANENT_MENU_ITEM,    	    XmNsensitive, False, NULL);    window->replayItem = createMenuItem(menuPane, "replayKeystrokes",    	    "Replay Keystrokes", 'K', replayCB, window, SHORT);    XtVaSetValues(window->replayItem, XmNuserData, PERMANENT_MENU_ITEM,    	    XmNsensitive, GetReplayMacro() != NULL, NULL);    window->repeatItem = createMenuItem(menuPane, "repeat",    	    "Repeat...", 'R', doActionCB, "repeat_dialog", SHORT);    XtVaSetValues(window->repeatItem, XmNuserData, PERMANENT_MENU_ITEM, NULL);    XtVaSetValues(btn, XmNuserData, PERMANENT_MENU_ITEM, NULL);    btn = createMenuSeparator(menuPane, "sep1", SHORT);    XtVaSetValues(btn, XmNuserData, PERMANENT_MENU_ITEM, NULL);    /* UpdateMacroMenu(window) now done in DetermineLanguageMode */    /*    ** Create the Windows menu    */    menuPane = window->windowMenuPane = createMenu(menuBar, "windowsMenu",    	    "Windows", 0, &cascade, FULL);    XtAddCallback(cascade, XmNcascadingCallback, (XtCallbackProc)windowMenuCB,    	    window);    window->splitWindowItem = createMenuItem(menuPane, "splitWindow",    	    "Split Window", 'S', doActionCB, "split_window", SHORT);    XtVaSetValues(window->splitWindowItem, XmNuserData, PERMANENT_MENU_ITEM,	    NULL);    window->closePaneItem = createMenuItem(menuPane, "closePane",    	    "Close Pane", 'C', doActionCB, "close_pane", SHORT);    XtVaSetValues(window->closePaneItem, XmNuserData, PERMANENT_MENU_ITEM,NULL);    XtSetSensitive(window->closePaneItem, False);    btn = createMenuSeparator(menuPane, "sep1", SHORT);    XtVaSetValues(btn, XmNuserData, PERMANENT_MENU_ITEM, NULL);        /*     ** Create "Help" pull down menu.    */    menuPane = createMenu(menuBar, "helpMenu", "Help", 0, &cascade, SHORT);    XtVaSetValues(menuBar, XmNmenuHelpWidget, cascade, NULL);    buildHelpMenu( menuPane, &H_M[0], window );    return menuBar;}/*----------------------------------------------------------------------------*/static Widget makeHelpMenuItem(    Widget           parent,    char            *name,      /* to be assigned to the child widget */    char            *label,     /* text to be displayed in menu       */    char             mnemonic,  /* letter in label to be underlined   */    menuCallbackProc callback,  /* activated when menu item selected  */    void            *cbArg,     /* passed to activated call back      */    int              mode,      /* SGI_CUSTOM menu option             */    enum HelpTopic   topic      /* associated with this menu item     */){    Widget menuItem =         createMenuItem( parent, name, label, mnemonic, callback, cbArg, mode );        XtVaSetValues( menuItem, XmNuserData, topic, 0 );    return menuItem;}/*----------------------------------------------------------------------------*/static void helpCB( Widget menuItem, XtPointer clientData, XtPointer callData ){    enum HelpTopic topic;        HidePointerOnKeyedEvent(WidgetToWindow(MENU_WIDGET(menuItem))->lastFocus,            ((XmAnyCallbackStruct *)callData)->event);    XtVaGetValues( menuItem, XmNuserData, &topic, 0 );        Help(topic);}/*----------------------------------------------------------------------------*/#define NON_MENU_HELP 9static HelpMenu * buildHelpMenu(     Widget       pane,  /* Menu pane on which to place new menu items */    HelpMenu   * menu,  /* Data to drive building the help menu       */    WindowInfo * window /* Main NEdit window information              */){#ifdef VMS    int hideIt = 1;  /* All menu items matching this will be inaccessible */#else    int hideIt = -1; /* This value should make all menu items accessible  */#endif    if( menu != NULL )    {        int crntLevel = menu->level;        /*-------------------------        * For each menu element ...        *-------------------------*/        while( menu != NULL && menu->level == crntLevel )        {            /*----------------------------------------------            * ... see if dealing with a separator or submenu            *----------------------------------------------*/            if( menu->topic == HELP_none )            {                if( menu->mnemonic == '-' )                {                    createMenuSeparator(pane, menu->wgtName, SHORT);                    menu = menu->next;                }                else                {                    /*-------------------------------------------------------                    * Do not show any of the submenu when it is to be hidden.                    *-------------------------------------------------------*/                    if( menu->hideIt == hideIt || menu->hideIt == NON_MENU_HELP )                    {                        do {     menu = menu->next;                        } while( menu != NULL && menu->level > crntLevel );                                            }                    else                    {                        Widget subPane =                             createMenu( pane, menu->wgtName, menu->subTitle,                                menu->mnemonic, NULL, FULL);                        menu = buildHelpMenu( subPane, menu->next, window );                    }                }            }            else            {                /*---------------------------------------                * Show menu item if not going to hide it.                * This is the easy way out of hiding                * menu items. When entire submenus want                * to be hidden, either the entire branch                * will have to be marked, or this algorithm                * will have to become a lot smarter.                *---------------------------------------*/                if( menu->hideIt != hideIt && menu->hideIt != NON_MENU_HELP )                    makeHelpMenuItem(                         pane, menu->wgtName, HelpTitles[menu->topic],                         menu->mnemonic, helpCB, window, SHORT, menu->topic );                menu = menu->next;            }        }    }        return menu;}/*----------------------------------------------------------------------------*/static void doActionCB(Widget w, XtPointer clientData, XtPointer callData){    Widget menu = MENU_WIDGET(w);    HidePointerOnKeyedEvent(WidgetToWindow(menu)->lastFocus,            ((XmAnyCallbackStruct *)callData)->event);    XtCallActionProc(WidgetToWindow(menu)->lastFocus, (char *)clientData,    	    ((XmAnyCallbackStruct *)callData)->event, NULL, 0);}static void pasteColCB(Widget w, XtPointer clientData, XtPointer callData) {    static char *params[1] = {"rect"};        HidePointerOnKeyedEvent(WidgetToWindow(MENU_WIDGET(w))->lastFocus,            ((XmAnyCallbackStruct *)callData)->event);    XtCallActionProc(((WindowInfo *)clientData)->lastFocus, "paste_clipboard",    	    ((XmAnyCallbackStruct *)callData)->event, params, 1);}static void shiftLeftCB(Widget w, XtPointer clientData, XtPointer callData){    HidePointerOnKeyedEvent(WidgetToWindow(MENU_WIDGET(w))->lastFocus,            ((XmAnyCallbackStruct *)callData)->event);    XtCallActionProc(((WindowInfo *)clientData)->lastFocus,    	    ((XmAnyCallbackStruct *)callData)->event->xbutton.state & ShiftMask    	    ? "shift_left_by_tab" : "shift_left",    	    ((XmAnyCallbackStruct *)callData)->event, NULL, 0);}static void shiftRightCB(Widget w, XtPointer clientData, XtPointer callData){    HidePointerOnKeyedEvent(WidgetToWindow(MENU_WIDGET(w))->lastFocus,            ((XmAnyCallbackStruct *)callData)->event);    XtCallActionProc(((WindowInfo *)clientData)->lastFocus,    	    ((XmAnyCallbackStruct *)callData)->event->xbutton.state & ShiftMask    	    ? "shift_right_by_tab" : "shift_right",    	    ((XmAnyCallbackStruct *)callData)->event, NULL, 0);}static void findCB(Widget w, XtPointer clientData, XtPointer callData){    HidePointerOnKeyedEvent(WidgetToWindow(MENU_WIDGET(w))->lastFocus,            ((XmAnyCallbackStruct *)callData)->event);    XtCallActionProc(((WindowInfo *)clientData)->lastFocus, "find_dialog",    	    ((XmAnyCallbackStruct *)callData)->event,    	    shiftKeyToDir(callData), 1);}static void findSameCB(Widget w, XtPointer clientData, XtPointer callData){    HidePointerOnKeyedEvent(WidgetToWindow(MENU_WIDGET(w))->lastFocus,            ((XmAnyCallbackStruct *)callData)->event);     XtCallActionProc(((WindowInfo *)clientData)->lastFocus, "find_again",    	    ((XmAnyCallbackStruct *)callData)->event,    	    shiftKeyToDir(callData), 1);}static void findSelCB(Widget w, XtPointer clientData, XtPointer callData){    HidePointerOnKeyedEvent(WidgetToWindow(MENU_WIDGET(w))->lastFocus,            ((XmAnyCallbackStruct *)callData)->event);    XtCallActionProc(((WindowInfo *)clientData)->lastFocus, "find_selection",    	    ((XmAnyCallbackStruct *)callData)->event,     	    shiftKeyToDir(callData), 1);}static void findIncrCB(Widget w, XtPointer clientData, XtPointer callData){    HidePointerOnKeyedEvent(WidgetToWindow(MENU_WIDGET(w))->lastFocus,            ((XmAnyCallbackStruct *)callData)->event);    XtCallActionProc(((WindowInfo *)clientData)->lastFocus,	    "start_incremental_find", ((XmAnyCallbackStruct *)callData)->event,     	    shiftKeyToDir(callData), 1);}static void replaceCB(Widget w, XtPointer clientData, XtPointer callData){    HidePointerOnKeyedEvent(WidgetToWindow(MENU_WIDGET(w))->lastFocus,            ((XmAnyCallbackStruct *)callData)->event);    XtCallActionProc(((WindowInfo *)clientData)->lastFocus, "replace_dialog",    	    ((XmAnyCallbackStruct *)callData)->event,    	    shiftKeyToDir(callData), 1);}static void replaceSameCB(Widget w, XtPointer clientData, XtPointer callData){    HidePoin

⌨️ 快捷键说明

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