📄 ttysw_menu.c
字号:
HELP_INFO("ttysw:mputget") MENU_INACTIVE, FALSE, 0); } else if (ttysw_is_seln_nonzero(ttysw, SELN_SHELF)) { (void)menu_set(mi, MENU_STRING, 0, MENU_IMAGE, ttysw_get_only_pr, HELP_INFO("ttysw:mgetonly") MENU_INACTIVE, FALSE, 0); } else { (void)menu_set(mi, MENU_IMAGE, 0, MENU_STRING, (new_wording) ? ttysw_copy_then_paste : ttysw_put_then_get, HELP_INFO("ttysw:mputget") MENU_INACTIVE, TRUE, 0); } return mi;}/* * Callout functions *//* ARGSUSED */static voidttysw_menu_stuff(menu, mi) Menu menu; Menu_item mi;{ Ttysw *ttysw = (Ttysw *) LINT_CAST(menu_get(mi, MENU_CLIENT_DATA)); ttygetselection(ttysw);}/* ARGSUSED */static voidttysw_enable_scrolling(menu, mi) Menu menu; Menu_item mi;{ Ttysw *ttysw = (Ttysw *) LINT_CAST(menu_get(mi, MENU_CLIENT_DATA)); ttysw_setopt(ttysw, TTYOPT_TEXT, 1); scroll_disabled_from_menu = FALSE;}extern Menu_itemttysw_get_scroll_cmd_from_menu_for_ttysw(ttysw_menu) Menu ttysw_menu;{ /* The reason for using menu_get() is menu_find() has problem. */ return (Menu_item)menu_get( ttysw_menu, MENU_NTH_ITEM, menu_get(ttysw_menu, MENU_NITEMS, 0));}extern Menu_itemttysw_get_scroll_cmd_from_menu_for_textsw(textsw_menu) Menu textsw_menu;{ /* The reason for using menu_get() is menu_find() has problem. */ Menu_item cmd_modes_item = (Menu_item)menu_get( textsw_menu, MENU_NTH_ITEM, menu_get(textsw_menu, MENU_NITEMS, 0)); Menu cmd_modes_menu = (Menu)menu_get( /* get the pullright menu */ cmd_modes_item, MENU_PULLRIGHT, 0); return (Menu_item)menu_get( cmd_modes_menu, MENU_NTH_ITEM, menu_get(cmd_modes_menu, MENU_NITEMS, 0));}voidttysw_set_scrolling_cmds(disable_scroll, enable_scroll, allow_enable) Menu_item disable_scroll, enable_scroll; int allow_enable;{ if (allow_enable) { (void)menu_set(enable_scroll, MENU_INACTIVE, FALSE, 0); (void)menu_set(disable_scroll, MENU_INACTIVE, TRUE, 0); } else { (void)menu_set(enable_scroll, MENU_INACTIVE, TRUE, 0); (void)menu_set(disable_scroll, MENU_INACTIVE, FALSE, 0); }}extern voidttysw_set_scrolling(textsw_menu, ttysw_menu, allow_enable) Menu textsw_menu, ttysw_menu; int allow_enable;{ Menu_item enable_scroll = ttysw_get_scroll_cmd_from_menu_for_ttysw( ttysw_menu); Menu_item disable_scroll = ttysw_get_scroll_cmd_from_menu_for_textsw( textsw_menu); (void)ttysw_set_scrolling_cmds( disable_scroll, enable_scroll, allow_enable); }/* static voidttysw_do_enable_scrolling(ttysw) Ttysw *ttysw;{ Textsw textsw = (Textsw)ttysw->ttysw_hist; Menu ttysw_menu = (Menu)ttysw->ttysw_menu; Menu textsw_menu = (Menu)textsw_get(textsw, TEXTSW_MENU); int dont_allow_enable = 0; ttysw_setopt(ttysw, TTYOPT_TEXT, 1);} *//* ARGSUSED */static voidttysw_menu_page(menu, mi) Menu menu; Menu_item mi;{ Ttysw *ttysw = (Ttysw *) LINT_CAST(menu_get(mi, MENU_CLIENT_DATA)); if (ttysw->ttysw_frozen) (void) ttysw_freeze(ttysw, 0); else (void)ttysw_setopt((caddr_t) ttysw, TTYOPT_PAGEMODE, !ttysw_getopt((caddr_t) ttysw, TTYOPT_PAGEMODE));}/* ARGSUSED */static voidttysw_menu_flush(menu, mi) Menu menu; Menu_item mi;{ caddr_t ttysw = (caddr_t) LINT_CAST(menu_get(mi, MENU_CLIENT_DATA)); (void)ttysw_flush_input(ttysw);}/* ARGSUSED */static voidttysw_menu_put_get(menu, mi) Menu menu; Menu_item mi;{ Ttysw *ttysw = (Ttysw *) LINT_CAST(menu_get(mi, MENU_CLIENT_DATA)); ttysw_do_put_get(ttysw);}/* cmdsw walking menu definitions */ttysw_set_menu(textsw) Textsw textsw;{ Menu cmd_menu, cmds; Menu_item cmd_item1, cmd_item2, cmd_item, cmd_pullright_item; int ttysw_menu_append_only(); cmd_menu = (Menu)textsw_get(textsw, TEXTSW_MENU); cmds = (Menu)menu_create( MENU_LEFT_MARGIN, 6, MENU_ITEM, MENU_VALUE, TTYSW_APPEND_ONLY, MENU_ACTION, ttysw_menu_append_only, MENU_CLIENT_DATA, textsw, HELP_INFO("ttysw:mappendonly") MENU_INACTIVE, FALSE, 0, MENU_ITEM, MENU_STRING, ttysw_scrolling_disable, MENU_ACTION, ttysw_disable_scrolling, MENU_CLIENT_DATA, textsw, HELP_INFO("ttysw:mdsbscroll") MENU_INACTIVE, FALSE, 0, HELP_INFO("ttysw:mcommands") 0); cmd_pullright_item = (Menu_item)menu_create_item( MENU_PULLRIGHT_ITEM, "Cmd Modes", cmds, 0);/*****Changed to above pullright structure for 3.4 cmd_item1 = (Menu_item)menu_create_item( MENU_VALUE, TTYSW_APPEND_ONLY, MENU_ACTION, ttysw_menu_append_only, MENU_CLIENT_DATA, textsw, MENU_INACTIVE, FALSE, 0); cmd_item2 = (Menu_item)menu_create_item( MENU_STRING, ttysw_scrolling_disable, MENU_ACTION, ttysw_disable_scrolling, MENU_CLIENT_DATA, textsw, MENU_INACTIVE, FALSE, 0); if (cmdsw->append_only_log) { (void)menu_set(cmd_item1, MENU_STRING, ttysw_menu_edit_on, 0); } else { (void)menu_set(cmd_item1, MENU_STRING, ttysw_menu_edit_off, 0); } * * cmd_item2 has to be the last item of the menu; otherwise, * it will confuse menu_get() in ttysw_enable_scrolling() and * ttysw_text_event(). * (void)menu_set(cmd_menu, MENU_APPEND_ITEM, cmd_item1, MENU_APPEND_ITEM, cmd_item2, 0);*************/ cmd_item = (Menu_item)menu_get(cmds, MENU_NTH_ITEM, 1); if (cmdsw->append_only_log) { (void)menu_set(cmd_item, MENU_STRING, ttysw_menu_edit_on, 0); } else { (void)menu_set(cmd_item, MENU_STRING, ttysw_menu_edit_off, 0); } (void)menu_set(cmd_menu, MENU_APPEND_ITEM, cmd_pullright_item, 0);}/* ARGSUSED */ttysw_menu_append_only(cmd_menu, cmd_item) Menu cmd_menu; Menu_item cmd_item;{ Textsw textsw = (Textsw)(LINT_CAST(menu_get(cmd_item, MENU_CLIENT_DATA))); Textsw_index tmp_index, insert; cmdsw->append_only_log = !cmdsw->append_only_log; if (cmdsw->append_only_log) { (void)menu_set(cmd_item, MENU_STRING, ttysw_menu_edit_on, 0); tmp_index = (int)textsw_find_mark(textsw, cmdsw->pty_mark); insert = (Textsw_index)textsw_get(textsw, TEXTSW_INSERTION_POINT); if (insert != tmp_index) { (void)textsw_set(textsw, TEXTSW_INSERTION_POINT, tmp_index, 0); } cmdsw->read_only_mark = textsw_add_mark(textsw, cmdsw->cooked_echo ? tmp_index : TEXTSW_INFINITY-1, TEXTSW_MARK_READ_ONLY); } else { (void)menu_set(cmd_item, MENU_STRING, ttysw_menu_edit_off, 0); textsw_remove_mark(textsw, cmdsw->read_only_mark); } }/* ARGSUSED */static voidttysw_disable_scrolling(cmd_menu, cmd_item) Menu cmd_menu; Menu_item cmd_item;{ /* The reason for using menu_get() is menu_find() has problem. */ Textsw textsw = (Textsw) LINT_CAST (menu_get(cmd_item, MENU_CLIENT_DATA)); Ttysw *ttysw = (Ttysw *) LINT_CAST (textsw_get(textsw, TEXTSW_CLIENT_DATA)); Menu ttysw_menu = (Menu)ttysw->ttysw_menu; Menu_item enable_scroll = ttysw_get_scroll_cmd_from_menu_for_ttysw( ttysw_menu); ttysw->ttysw_hist = (FILE *) LINT_CAST(textsw); ttysw_setopt(ttysw, TTYOPT_TEXT, 0); scroll_disabled_from_menu = TRUE; (void)ttysw_set_scrolling_cmds(cmd_item, enable_scroll, TRUE);} static intttysw_use_new_menu_style(){ if (!ttysw_defaults_checked) { ttysw_use_new_menu = (int)defaults_get_boolean( "/Compatibility/New_Tty_Menu", TRUE, (int *)NULL); ttysw_defaults_checked = 1; } return (ttysw_use_new_menu);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -