📄 preferences.c
字号:
&PrefData.saveOldVersion, NULL, True}, {"showMatching", "ShowMatching", PREF_ENUM, "Delimiter", &PrefData.showMatchingStyle, ShowMatchingTypes, True}, {"matchSyntaxBased", "MatchSyntaxBased", PREF_BOOLEAN, "True", &PrefData.matchSyntaxBased, NULL, True}, {"highlightSyntax", "HighlightSyntax", PREF_BOOLEAN, "True", &PrefData.highlightSyntax, NULL, True}, {"backlightChars", "BacklightChars", PREF_BOOLEAN, "False", &PrefData.backlightChars, NULL, True}, {"backlightCharTypes", "BacklightCharTypes", PREF_ALLOC_STRING, "0-8,10-31,127:red;9:#dedede;32-126,160-255:#f0f0f0;128-159:orange", /* gray87 gray94 */ &PrefData.backlightCharTypes, NULL, False}, {"searchDialogs", "SearchDialogs", PREF_BOOLEAN, "False", &PrefData.searchDlogs, NULL, True}, {"beepOnSearchWrap", "BeepOnSearchWrap", PREF_BOOLEAN, "False", &PrefData.searchWrapBeep, NULL, True}, {"retainSearchDialogs", "RetainSearchDialogs", PREF_BOOLEAN, "False", &PrefData.keepSearchDlogs, NULL, True}, {"searchWraps", "SearchWraps", PREF_BOOLEAN, "True", &PrefData.searchWraps, NULL, True}, {"stickyCaseSenseButton", "StickyCaseSenseButton", PREF_BOOLEAN, "True", &PrefData.stickyCaseSenseBtn, NULL, True},#if XmVersion < 1002 /* Flashing is annoying in 1.1 versions */ {"repositionDialogs", "RepositionDialogs", PREF_BOOLEAN, "False", &PrefData.repositionDialogs, NULL, True},#else {"repositionDialogs", "RepositionDialogs", PREF_BOOLEAN, "True", &PrefData.repositionDialogs, NULL, True},#endif {"appendLF", "AppendLF", PREF_BOOLEAN, "True", &PrefData.appendLF, NULL, True}, {"sortOpenPrevMenu", "SortOpenPrevMenu", PREF_BOOLEAN, "True", &PrefData.sortOpenPrevMenu, NULL, True}, {"statisticsLine", "StatisticsLine", PREF_BOOLEAN, "False", &PrefData.statsLine, NULL, True}, {"iSearchLine", "ISearchLine", PREF_BOOLEAN, "False", &PrefData.iSearchLine, NULL, True}, {"lineNumbers", "LineNumbers", PREF_BOOLEAN, "False", &PrefData.lineNums, NULL, True}, {"pathInWindowsMenu", "PathInWindowsMenu", PREF_BOOLEAN, "True", &PrefData.pathInWindowsMenu, NULL, True}, {"warnFileMods", "WarnFileMods", PREF_BOOLEAN, "True", &PrefData.warnFileMods, NULL, True}, {"warnRealFileMods", "WarnRealFileMods", PREF_BOOLEAN, "True", &PrefData.warnRealFileMods, NULL, True}, {"warnExit", "WarnExit", PREF_BOOLEAN, "True", &PrefData.warnExit, NULL, True}, {"searchMethod", "SearchMethod", PREF_ENUM, "Literal", &PrefData.searchMethod, SearchMethodStrings, True},#ifdef REPLACE_SCOPE {"replaceDefaultScope", "ReplaceDefaultAllScope", PREF_ENUM, "Smart", &PrefData.replaceDefScope, ReplaceDefScopeStrings, True},#endif {"textRows", "TextRows", PREF_INT, "24", &PrefData.textRows, NULL, True}, {"textCols", "TextCols", PREF_INT, "80", &PrefData.textCols, NULL, True}, {"tabDistance", "TabDistance", PREF_INT, "8", &PrefData.tabDist, NULL, True}, {"emulateTabs", "EmulateTabs", PREF_INT, "0", &PrefData.emTabDist, NULL, True}, {"insertTabs", "InsertTabs", PREF_BOOLEAN, "True", &PrefData.insertTabs, NULL, True}, {"textFont", "TextFont", PREF_STRING, "-*-courier-medium-r-normal--*-120-*-*-*-iso8859-1", PrefData.fontString, (void *)sizeof(PrefData.fontString), True}, {"boldHighlightFont", "BoldHighlightFont", PREF_STRING, "-*-courier-bold-r-normal--*-120-*-*-*-iso8859-1", PrefData.boldFontString, (void *)sizeof(PrefData.boldFontString), True}, {"italicHighlightFont", "ItalicHighlightFont", PREF_STRING, "-*-courier-medium-o-normal--*-120-*-*-*-iso8859-1", PrefData.italicFontString, (void *)sizeof(PrefData.italicFontString), True}, {"boldItalicHighlightFont", "BoldItalicHighlightFont", PREF_STRING, "-*-courier-bold-o-normal--*-120-*-*-*-iso8859-1", PrefData.boldItalicFontString, (void *)sizeof(PrefData.boldItalicFontString), True}, {"helpFont", "helpFont", PREF_STRING, "-*-helvetica-medium-r-normal--*-120-*-*-*-iso8859-1", PrefData.helpFontNames[HELP_FONT], (void *)sizeof(PrefData.helpFontNames[HELP_FONT]), False}, {"boldHelpFont", "BoldHelpFont", PREF_STRING, "-*-helvetica-bold-r-normal--*-120-*-*-*-iso8859-1", PrefData.helpFontNames[BOLD_HELP_FONT], (void *)sizeof(PrefData.helpFontNames[BOLD_HELP_FONT]), False}, {"italicHelpFont", "ItalicHelpFont", PREF_STRING, "-*-helvetica-medium-o-normal--*-120-*-*-*-iso8859-1", PrefData.helpFontNames[ITALIC_HELP_FONT], (void *)sizeof(PrefData.helpFontNames[ITALIC_HELP_FONT]), False}, {"boldItalicHelpFont", "BoldItalicHelpFont", PREF_STRING, "-*-helvetica-bold-o-normal--*-120-*-*-*-iso8859-1", PrefData.helpFontNames[BOLD_ITALIC_HELP_FONT], (void *)sizeof(PrefData.helpFontNames[BOLD_ITALIC_HELP_FONT]), False}, {"fixedHelpFont", "fixedHelpFont", PREF_STRING, "-*-courier-medium-r-normal--*-120-*-*-*-iso8859-1", PrefData.helpFontNames[FIXED_HELP_FONT], (void *)sizeof(PrefData.helpFontNames[FIXED_HELP_FONT]), False}, {"boldFixedHelpFont", "BoldFixedHelpFont", PREF_STRING, "-*-courier-bold-r-normal--*-120-*-*-*-iso8859-1", PrefData.helpFontNames[BOLD_FIXED_HELP_FONT], (void *)sizeof(PrefData.helpFontNames[BOLD_FIXED_HELP_FONT]), False}, {"italicFixedHelpFont", "ItalicFixedHelpFont", PREF_STRING, "-*-courier-medium-o-normal--*-120-*-*-*-iso8859-1", PrefData.helpFontNames[ITALIC_FIXED_HELP_FONT], (void *)sizeof(PrefData.helpFontNames[ITALIC_FIXED_HELP_FONT]), False}, {"boldItalicFixedHelpFont", "BoldItalicFixedHelpFont", PREF_STRING, "-*-courier-bold-o-normal--*-120-*-*-*-iso8859-1", PrefData.helpFontNames[BOLD_ITALIC_FIXED_HELP_FONT], (void *)sizeof(PrefData.helpFontNames[BOLD_ITALIC_FIXED_HELP_FONT]), False}, {"helpLinkFont", "helpLinkFont", PREF_STRING, "-*-helvetica-medium-r-normal--*-120-*-*-*-iso8859-1", PrefData.helpFontNames[HELP_LINK_FONT], (void *)sizeof(PrefData.helpFontNames[HELP_LINK_FONT]), False}, {"h1HelpFont", "H1HelpFont", PREF_STRING, "-*-helvetica-bold-r-normal--*-140-*-*-*-iso8859-1", PrefData.helpFontNames[H1_HELP_FONT], (void *)sizeof(PrefData.helpFontNames[H1_HELP_FONT]), False}, {"h2HelpFont", "H2HelpFont", PREF_STRING, "-*-helvetica-bold-o-normal--*-120-*-*-*-iso8859-1", PrefData.helpFontNames[H2_HELP_FONT], (void *)sizeof(PrefData.helpFontNames[H2_HELP_FONT]), False}, {"h3HelpFont", "H3HelpFont", PREF_STRING, "-*-courier-bold-r-normal--*-120-*-*-*-iso8859-1", PrefData.helpFontNames[H3_HELP_FONT], (void *)sizeof(PrefData.helpFontNames[H3_HELP_FONT]), False}, {"helpLinkColor", "helpLinkColor", PREF_STRING, "#009900", PrefData.helpLinkColor, (void *)sizeof(PrefData.helpLinkColor), False}, {"textFgColor", "textFgColor", PREF_STRING, NEDIT_DEFAULT_FG, PrefData.colorNames[TEXT_FG_COLOR], (void *)sizeof(PrefData.colorNames[TEXT_FG_COLOR]), True}, {"textBgColor", "textBgColor", PREF_STRING, NEDIT_DEFAULT_TEXT_BG, PrefData.colorNames[TEXT_BG_COLOR], (void *)sizeof(PrefData.colorNames[TEXT_BG_COLOR]), True}, {"selectFgColor", "selectFgColor", PREF_STRING, NEDIT_DEFAULT_SEL_FG, PrefData.colorNames[SELECT_FG_COLOR], (void *)sizeof(PrefData.colorNames[SELECT_FG_COLOR]), True}, {"selectBgColor", "selectBgColor", PREF_STRING, NEDIT_DEFAULT_SEL_BG, PrefData.colorNames[SELECT_BG_COLOR], (void *)sizeof(PrefData.colorNames[SELECT_BG_COLOR]), True}, {"hiliteFgColor", "hiliteFgColor", PREF_STRING, NEDIT_DEFAULT_HI_FG, PrefData.colorNames[HILITE_FG_COLOR], (void *)sizeof(PrefData.colorNames[HILITE_FG_COLOR]), True}, {"hiliteBgColor", "hiliteBgColor", PREF_STRING, NEDIT_DEFAULT_HI_BG, PrefData.colorNames[HILITE_BG_COLOR], (void *)sizeof(PrefData.colorNames[HILITE_BG_COLOR]), True}, {"lineNoFgColor", "lineNoFgColor", PREF_STRING, NEDIT_DEFAULT_LINENO_FG, PrefData.colorNames[LINENO_FG_COLOR], (void *)sizeof(PrefData.colorNames[LINENO_FG_COLOR]), True}, {"cursorFgColor", "cursorFgColor", PREF_STRING, NEDIT_DEFAULT_CURSOR_FG, PrefData.colorNames[CURSOR_FG_COLOR], (void *)sizeof(PrefData.colorNames[CURSOR_FG_COLOR]), True}, {"shell", "Shell", PREF_STRING,#if defined(__MVS__) || defined(__EMX__) "/bin/sh",#else "/bin/csh",#endif PrefData.shell, (void *)sizeof(PrefData.shell), False}, {"geometry", "Geometry", PREF_STRING, "", PrefData.geometry, (void *)sizeof(PrefData.geometry), False}, {"remapDeleteKey", "RemapDeleteKey", PREF_BOOLEAN, "False", &PrefData.mapDelete, NULL, False}, {"stdOpenDialog", "StdOpenDialog", PREF_BOOLEAN, "False", &PrefData.stdOpenDialog, NULL, False}, {"tagFile", "TagFile", PREF_STRING, "", PrefData.tagFile, (void *)sizeof(PrefData.tagFile), False}, {"wordDelimiters", "WordDelimiters", PREF_STRING, ".,/\\`'!|@#%^&*()-=+{}[]\":;<>?", PrefData.delimiters, (void *)sizeof(PrefData.delimiters), False}, {"serverName", "serverName", PREF_STRING, "", PrefData.serverName, (void *)sizeof(PrefData.serverName), False}, {"maxPrevOpenFiles", "MaxPrevOpenFiles", PREF_INT, "30", &PrefData.maxPrevOpenFiles, NULL, False}, {"bgMenuButton", "BGMenuButton" , PREF_STRING, "~Shift~Ctrl~Meta~Alt<Btn3Down>", PrefData.bgMenuBtn, (void *)sizeof(PrefData.bgMenuBtn), False}, {"smartTags", "SmartTags", PREF_BOOLEAN, "True", &PrefData.smartTags, NULL, True}, {"typingHidesPointer", "TypingHidesPointer", PREF_BOOLEAN, "False", &PrefData.typingHidesPointer, NULL, False}, {"alwaysCheckRelativeTagsSpecs", "AlwaysCheckRelativeTagsSpecs", PREF_BOOLEAN, "True", &PrefData.alwaysCheckRelativeTagsSpecs, NULL, False}, {"prefFileRead", "PrefFileRead", PREF_BOOLEAN, "False", &PrefData.prefFileRead, NULL, True},#ifdef SGI_CUSTOM {"shortMenus", "ShortMenus", PREF_BOOLEAN, "False", &PrefData.shortMenus, NULL, True},#endif {"findReplaceUsesSelection", "FindReplaceUsesSelection", PREF_BOOLEAN, "False", &PrefData.findReplaceUsesSelection, NULL, False}, {"overrideDefaultVirtualKeyBindings", "OverrideDefaultVirtualKeyBindings", PREF_ENUM, "Auto", &PrefData.virtKeyOverride, VirtKeyOverrideModes, False}, {"titleFormat", "TitleFormat", PREF_STRING, "{%c} [%s] %f (%S) - %d", PrefData.titleFormat, (void *)sizeof(PrefData.titleFormat), True}, {"undoModifiesSelection", "UndoModifiesSelection", PREF_BOOLEAN, "True", &PrefData.undoModifiesSelection, NULL, False},};static XrmOptionDescRec OpTable[] = { {"-wrap", ".autoWrap", XrmoptionNoArg, (caddr_t)"Continuous"}, {"-nowrap", ".autoWrap", XrmoptionNoArg, (caddr_t)"None"}, {"-autowrap", ".autoWrap", XrmoptionNoArg, (caddr_t)"Newline"}, {"-noautowrap", ".autoWrap", XrmoptionNoArg, (caddr_t)"None"}, {"-autoindent", ".autoIndent", XrmoptionNoArg, (caddr_t)"Auto"}, {"-noautoindent", ".autoIndent", XrmoptionNoArg, (caddr_t)"False"}, {"-autosave", ".autoSave", XrmoptionNoArg, (caddr_t)"True"}, {"-noautosave", ".autoSave", XrmoptionNoArg, (caddr_t)"False"}, {"-rows", ".textRows", XrmoptionSepArg, (caddr_t)NULL}, {"-columns", ".textCols", XrmoptionSepArg, (caddr_t)NULL}, {"-tabs", ".tabDistance", XrmoptionSepArg, (caddr_t)NULL}, {"-font", ".textFont", XrmoptionSepArg, (caddr_t)NULL}, {"-fn", ".textFont", XrmoptionSepArg, (caddr_t)NULL}, {"-svrname", ".serverName", XrmoptionSepArg, (caddr_t)NULL},};static const char HeaderText[] = "\! Preferences file for NEdit\n\!\n\! This file is overwritten by the \"Save Defaults...\" command in NEdit \n\! and serves only the interactively settable options presented in the NEdit\n\! \"Preferences\" menu. To modify other options, such as key bindings, use \n\! the .Xdefaults file in your home directory (or the X resource \n\! specification method appropriate to your system). The contents of this \n\! file can be moved into an X resource file, but since resources in this file\n\! override their corresponding X resources, either this file should be \n\! deleted or individual resource lines in the file should be deleted for the\n\! moved lines to take effect.\n";/* Module-global variable set when any preference changes (for asking the user about re-saving on exit) */ static int PrefsHaveChanged = False;/* Module-global variable set when user uses -import to load additional preferences on top of the defaults. Contains name of file loaded */static char *ImportedFile = NULL;/* Module-global variables to support Initial Window Size... dialog */static int DoneWithSizeDialog;static Widget RowText, ColText;/* Module-global variables for Tabs dialog */static int DoneWithTabsDialog;static WindowInfo *TabsDialogForWindow;static Widget TabDistText, EmTabText, EmTabToggle, UseTabsToggle, EmTabLabel;/* Module-global variables for Wrap Margin dialog */static int DoneWithWrapDialog;static WindowInfo *WrapDialogForWindow;static Widget WrapText, WrapTextLabel, WrapWindowToggle;static void translatePrefFormats(int convertOld, int fileVer);static void setIntPref(int *prefDataField, int newValue);static void setStringPref(char *prefDataField, const char *newValue);static void sizeOKCB(Widget w, XtPointer clientData, XtPointer callData);static void setStringAllocPref(char **pprefDataField, char *newValue);static void sizeCancelCB(Widget w, XtPointer clientData, XtPointer callData);static void tabsOKCB(Widget w, XtPointer clientData, XtPointer callData);static void tabsCancelCB(Widget w, XtPointer clientData, XtPointer callData);static void tabsHelpCB(Widget w, XtPointer clientData, XtPointer callData);static void emTabsCB(Widget w, XtPointer clientData, XtPointer callData);static void wrapOKCB(Widget w, XtPointer clientData, XtPointer callData);static void wrapCancelCB(Widget w, XtPointer clientData, XtPointer callData);static void wrapWindowCB(Widget w, XtPointer clientData, XtPointer callData);static void reapplyLanguageMode(WindowInfo *window, int mode,int forceDefaults);static void fillFromPrimaryCB(Widget w, XtPointer clientData, XtPointer callData);static int checkFontStatus(fontDialog *fd, Widget fontTextFieldW);static int showFontStatus(fontDialog *fd, Widget fontTextFieldW, Widget errorLabelW);static void primaryModifiedCB(Widget w, XtPointer clientData, XtPointer callData);static void italicModifiedCB(Widget w, XtPointer clientData, XtPointer callData);static void boldModifiedCB(Widget w, XtPointer clientData, XtPointer callData);static void boldItalicModifiedCB(Widget w, XtPointer clientData, XtPointer callData);static void primaryBrowseCB(Widget w, XtPointer clientData, XtPointer callData);static void italicBrowseCB(Widget w, XtPointer clientData, XtPointer callData);static void boldBrowseCB(Widget w, XtPointer clientData, XtPointer callData);static void boldItalicBrowseCB(Widget w, XtPointer clientData, XtPointer callData);static void browseFont(Widget parent, Widget fontTextW, fontDialog *fd);static void fontDestroyCB(Widget w, XtPointer clientData, XtPointer callData);static void fontOkCB(Widget w, XtPointer clientData, XtPointer callData);static void fontApplyCB(Widget w, XtPointer clientData, XtPointer callData);static void fontDismissCB(Widget w, XtPointer clientData, XtPointer callData);static void updateFonts(fontDialog *fd);static Boolean checkColorStatus(colorDialog *cd, Widget colorFieldW);static int verifyAllColors (colorDialog *cd);static void showColorStatus (colorDialog *cd, Widget colorFieldW, Widget errorLabelW);static void updateColors(colorDialog *cd);static void colorDestroyCB(Widget w, XtPointer clientData, XtPointer callData);static void colorOkCB (Widget w, XtPointer clientData, XtPointer callData);static void colorApplyCB (Widget w, XtPointer clientData, XtPointer callData);static void colorDismissCB(Widget w, XtPointer clientData, XtPointer callData);static void textFgModifiedCB (Widget w, XtPointer clientData, XtPointer callData);static void textBgModifiedCB (Widget w, XtPointer clientData, XtPointer callData);static void selectFgModifiedCB(Widget w, XtPointer clientData, XtPointer callData);static void selectBgModifiedCB(Widget w, XtPointer clientData, XtPointer callData);static void hiliteFgModifiedCB(Widget w, XtPointer clientData, XtPointer callData);static void hiliteBgModifiedCB(Widget w, XtPointer clientData, XtPointer callData);static void lineNoFgModifiedCB(Widget w, XtPointer clientData, XtPointer callData);static void cursorFgModifiedCB(Widget w, XtPointer clientData, XtPointer callData);static int matchLanguageMode(WindowInfo *window);static int loadLanguageModesString(char *inString, int fileVer);static char *writeLanguageModesString(void);static char *createExtString(char **extensions, int nExtensions);static char **readExtensionList(char **inPtr, int *nExtensions);static void updateLanguageModeSubmenu(WindowInfo *window);static void setLangModeCB(Widget w, XtPointer clientData, XtPointer callData);static int modeError(languageModeRec *lm, const char *stringStart, const char *stoppedAt, const char *message);static void lmDestroyCB(Widget w, XtPointer clientData, XtPointer callData);static void lmOkCB(Widget w, XtPointer clientData, XtPointer callData);static void lmApplyCB(Widget w, XtPointer clientData, XtPointer callData);static void lmDismissCB(Widget w, XtPointer clientData, XtPointer callData);static int lmDeleteConfirmCB(int itemIndex, void *cbArg);static int updateLMList(void);static languageModeRec *copyLanguageModeRec(languageModeRec *lm);static void *lmGetDisplayedCB(void *oldItem, int explicitRequest, int *abort, void *cbArg);static void lmSetDisplayedCB(void *item, void *cbArg);static languageModeRec *readLMDialogFields(int silent);static void lmFreeItemCB(void *item);static void freeLanguageModeRec(languageModeRec *lm);static int lmDialogEmpty(void);static void updatePatternsTo5dot1(void);static void updatePatternsTo5dot2(void);static void updatePatternsTo5dot3(void);static void updatePatternsTo5dot4(void);static void updateShellCmdsTo5dot3(void);static void updateShellCmdsTo5dot4(void);static void migrateColorResources(XrmDatabase prefDB, XrmDatabase appDB);static void spliceString(char **intoString, const char *insertString, const char *atExpr);static int regexFind(const char *inString, const char *expr);static int regexReplace(char **inString, const char *expr, const char *replaceWith);#ifdef SGI_CUSTOMstatic int shortPrefToDefault(Widget parent, const char *settingName, int *setDefault);#endifXrmDatabase CreateNEditPrefDB(int *argcInOut, char **argvInOut){ return CreatePreferencesDatabase(GetRCFileName(NEDIT_RC), APP_NAME, OpTable, XtNumber(OpTable), (unsigned int *)argcInOut, argvInOut);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -