UNIXworkcode

1 /******************************************************************************* 2 * * 3 * preference.h -- Nirvana Editor Preferences Header File * 4 * * 5 * Copyright 2004 The NEdit Developers * 6 * * 7 * This is free software; you can redistribute it and/or modify it under the * 8 * terms of the GNU General Public License as published by the Free Software * 9 * Foundation; either version 2 of the License, or (at your option) any later * 10 * version. In addition, you may distribute versions of this program linked to * 11 * Motif or Open Motif. See README for details. * 12 * * 13 * This software is distributed in the hope that it will be useful, but WITHOUT * 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 16 * more details. * 17 * * 18 * You should have received a copy of the GNU General Public License along with * 19 * software; if not, write to the Free Software Foundation, Inc., 59 Temple * 20 * Place, Suite 330, Boston, MA 02111-1307 USA * 21 * * 22 * Nirvana Text Editor * 23 * July 31, 2001 * 24 * * 25 *******************************************************************************/ 26 27 #ifndef NEDIT_PREFERENCES_H_INCLUDED 28 #define NEDIT_PREFERENCES_H_INCLUDED 29 30 #include "nedit.h" 31 32 #include <X11/Intrinsic.h> 33 #include <X11/Xresource.h> 34 #include <Xm/Xm.h> 35 #include <X11/Xlib.h> 36 37 #define PLAIN_LANGUAGE_MODE -1 38 39 /* maximum number of language modes allowed */ 40 #define MAX_LANGUAGE_MODES 127 41 42 #define MAX_TITLE_FORMAT_LEN 50 43 44 /* Identifiers for individual fonts in the help fonts list */ 45 enum helpFonts {HELP_FONT, BOLD_HELP_FONT, ITALIC_HELP_FONT, 46 BOLD_ITALIC_HELP_FONT, FIXED_HELP_FONT, BOLD_FIXED_HELP_FONT, 47 ITALIC_FIXED_HELP_FONT, BOLD_ITALIC_FIXED_HELP_FONT, HELP_LINK_FONT, 48 H1_HELP_FONT, H2_HELP_FONT, H3_HELP_FONT, NUM_HELP_FONTS 49 }; 50 51 typedef struct ColorList { 52 char *liststr; 53 char **colors; 54 size_t ncolors; 55 } ColorList; 56 57 XrmDatabase CreateNEditPrefDB(int *argcInOut, char **argvInOut); 58 void RestoreNEditPrefs(XrmDatabase prefDB, XrmDatabase appDB); 59 void SaveNEditPrefs(Widget parent, int quietly); 60 void ImportPrefFile(const char *filename, int convertOld); 61 void MarkPrefsChanged(void); 62 int CheckPrefsChangesSaved(Widget dialogParent); 63 void SetPrefWrap(WrapStyle state); 64 WrapStyle GetPrefWrap(int langMode); 65 void SetPrefWrapMargin(int margin); 66 int GetPrefWrapMargin(void); 67 void SetPrefSaveSearchHistory(int state); 68 int GetPrefSaveSearchHistory(void); 69 void SetPrefSearchDlogs(int state); 70 int GetPrefSearchDlogs(void); 71 void SetPrefKeepSearchDlogs(int state); 72 int GetPrefKeepSearchDlogs(void); 73 void SetPrefSearchWraps(int state); 74 int GetPrefSearchWraps(void); 75 void SetPrefStatsLine(int state); 76 int GetPrefStatsLine(void); 77 void SetPrefISearchLine(int state); 78 int GetPrefISearchLine(void); 79 void SetPrefTabBar(int state); 80 int GetPrefTabBar(void); 81 int GetZoomStep(void); 82 void SetPrefSortTabs(int state); 83 int GetPrefSortTabs(void); 84 void SetPrefTabBarHideOne(int state); 85 int GetPrefTabBarHideOne(void); 86 void SetPrefGlobalTabNavigate(int state); 87 int GetPrefGlobalTabNavigate(void); 88 void SetPrefToolTips(int state); 89 int GetPrefToolTips(void); 90 void SetPrefLineNums(int state); 91 int GetPrefLineNums(void); 92 void SetPrefShowPathInWindowsMenu(int state); 93 int GetPrefShowPathInWindowsMenu(void); 94 void SetPrefWarnFileMods(int state); 95 int GetPrefWarnFileMods(void); 96 void SetPrefWarnRealFileMods(int state); 97 int GetPrefWarnRealFileMods(void); 98 void SetPrefWarnExit(int state); 99 int GetPrefWarnExit(void); 100 void SetPrefSearch(int searchType); 101 int GetPrefSearch(void); 102 void SetPrefAutoIndent(IndentStyle state); 103 IndentStyle GetPrefAutoIndent(int langMode); 104 void SetPrefAutoSave(int state); 105 int GetPrefAutoSave(void); 106 void SetPrefSaveOldVersion(int state); 107 int GetPrefSaveOldVersion(void); 108 void SetPrefRows(int nRows); 109 int GetPrefRows(void); 110 void SetPrefCols(int nCols); 111 int GetPrefCols(void); 112 void SetPrefTabDist(int tabDist); 113 int GetPrefTabDist(int langMode); 114 void SetPrefEmTabDist(int tabDist); 115 int GetPrefEmTabDist(int langMode); 116 void SetPrefInsertTabs(int state); 117 int GetPrefInsertTabs(void); 118 void SetPrefShowMatching(ShowMatchingStyle state); 119 ShowMatchingStyle GetPrefShowMatching(void); 120 void SetPrefMatchSyntaxBased(int state); 121 int GetPrefMatchSyntaxBased(void); 122 void SetPrefHighlightSyntax(Boolean state); 123 Boolean GetPrefHighlightSyntax(void); 124 void SetPrefIndentRainbow(int state); 125 int GetPrefIndentRainbow(void); 126 void SetPrefHighlightCursorLine(int state); 127 int GetPrefHighlightCursorLine(void); 128 void SetPrefIndentRainbowColors(const char *colorList); 129 char *GetPrefIndentRainbowColors(void); 130 void SetPrefAnsiColorList(const char *colorList); 131 char *GetPrefAnsiColorList(void); 132 void SetPrefAnsiColors(int state); 133 Boolean GetPrefAnsiColors(void); 134 void SetPrefBacklightChars(int state); 135 int GetPrefBacklightChars(void); 136 char *GetPrefBacklightCharTypes(void); 137 void SetPrefRepositionDialogs(int state); 138 int GetPrefRepositionDialogs(void); 139 void SetPrefAutoScroll(int state); 140 int GetPrefAutoScroll(void); 141 void SetPrefEditorConfig(int state); 142 int GetPrefEditorConfig(void); 143 int GetVerticalAutoScroll(void); 144 void SetPrefAppendLF(int state); 145 int GetPrefAppendLF(void); 146 void SetPrefSortOpenPrevMenu(int state); 147 int GetPrefSortOpenPrevMenu(void); 148 char *GetPrefTagFile(void); 149 int GetPrefSmartTags(void); 150 void SetPrefSmartTags(int state); 151 int GetPrefAlwaysCheckRelTagsSpecs(void); 152 void SetPrefFont(char *fontName); 153 void SetPrefBoldFont(char *fontName); 154 void SetPrefItalicFont(char *fontName); 155 void SetPrefBoldItalicFont(char *fontName); 156 char *GetPrefFontName(void); 157 char *GetPrefBoldFontName(void); 158 char *GetPrefItalicFontName(void); 159 char *GetPrefBoldItalicFontName(void); 160 XmFontList GetPrefFontList(void); 161 NFont *GetPrefFont(void); 162 NFont *GetPrefBoldFont(void); 163 NFont *GetPrefItalicFont(void); 164 NFont *GetPrefBoldItalicFont(void); 165 char *GetPrefTooltipBgColor(void); 166 char *GetPrefHelpFontName(int index); 167 char *GetPrefHelpLinkColor(void); 168 char *GetPrefColorName(int colorIndex); 169 void SetPrefColorName(int colorIndex, const char *color); 170 void SetPrefShell(const char *shell); 171 const char* GetPrefShell(void); 172 char *GetPrefGeometry(void); 173 char *GetPrefServerName(void); 174 char *GetPrefBGMenuBtn(void); 175 void RowColumnPrefDialog(Widget parent); 176 void TabsPrefDialog(Widget parent, WindowInfo *forWindow); 177 void WrapMarginDialog(Widget parent, WindowInfo *forWindow); 178 int GetPrefMapDelete(void); 179 int GetPrefStdOpenDialog(void); 180 char *GetPrefDelimiters(void); 181 int GetPrefMaxPrevOpenFiles(void); 182 int GetPrefTypingHidesPointer(void); 183 int GetEditorConfig(void); 184 #ifdef SGI_CUSTOM 185 void SetPrefShortMenus(int state); 186 int GetPrefShortMenus(void); 187 #endif 188 void SelectShellDialog(Widget parent, WindowInfo* forWindow); 189 void EditLanguageModes(void); 190 void ChooseFonts(WindowInfo *window, int forWindow); 191 void ChooseColors(WindowInfo *window); 192 char *LanguageModeName(int mode); 193 char *GetWindowDelimiters(const WindowInfo *window); 194 int ReadNumericField(char **inPtr, int *value); 195 char *ReadSymbolicField(char **inPtr); 196 char *ReadSymbolicFieldTextWidget(Widget textW, const char *fieldName, int silent); 197 int ReadQuotedString(char **inPtr, char **errMsg, char **string); 198 char *MakeQuotedString(const char *string); 199 char *EscapeSensitiveChars(const char *string); 200 int SkipDelimiter(char **inPtr, char **errMsg); 201 int SkipOptSeparator(char separator, char **inPtr); 202 int ParseError(Widget toDialog, const char *stringStart, const char *stoppedAt, 203 const char *errorIn, const char *message); 204 int AllocatedStringsDiffer(const char *s1, const char *s2); 205 void SetLanguageMode(WindowInfo *window, int mode, int forceNewDefaults); 206 int FindLanguageMode(const char *languageName); 207 void UnloadLanguageModeTipsFile(WindowInfo *window); 208 void DetermineLanguageMode(WindowInfo *window, int forceNewDefaults); 209 Widget CreateLanguageModeMenu(Widget parent, XtCallbackProc cbProc, 210 void *cbArg); 211 void SetLangModeMenu(Widget optMenu, const char *modeName); 212 void CreateLanguageModeSubMenu(WindowInfo* window, const Widget parent, 213 const char* name, const char* label, char mnemonic); 214 void CreateColorProfilesSubMenu(WindowInfo *window, const Widget parent, 215 const char *name, const char *label, char mnemonic); 216 void SetPrefFindReplaceUsesSelection(int state); 217 int GetPrefFindReplaceUsesSelection(void); 218 int GetPrefStickyCaseSenseBtn(void); 219 void SetPrefBeepOnSearchWrap(int state); 220 int GetPrefBeepOnSearchWrap(void); 221 #ifdef REPLACE_SCOPE 222 void SetPrefReplaceDefScope(int scope); 223 int GetPrefReplaceDefScope(void); 224 #endif 225 void SetPrefTitleFormat(const char* format); 226 const char* GetPrefTitleFormat(void); 227 int GetPrefOverrideVirtKeyBindings(void); 228 int GetPrefTruncSubstitution(void); 229 int GetPrefOpenInTab(void); 230 void SetPrefUndoModifiesSelection(Boolean); 231 void SetPrefOpenInTab(int state); 232 Boolean GetPrefUndoModifiesSelection(void); 233 Boolean GetPrefFocusOnRaise(void); 234 Boolean GetPrefHonorSymlinks(void); 235 Boolean GetAutoEnableXattr(void); 236 Boolean GetWindowDarkTheme(void); 237 int GetFsbView(void); 238 Boolean GetFsbShowHidden(void); 239 Boolean GetPrefForceOSConversion(void); 240 void SetPrefFocusOnRaise(Boolean); 241 const char* GetPrefDefaultCharset(void); 242 const char* GetPrefFallbackCharset(void); 243 244 int GetPrefCloseIconSize(void); 245 int GetPrefISrcFindIconSize(void); 246 int GetPrefISrcClearIconSize(void); 247 248 void SetPrefLockEncodingError(int state); 249 int GetPrefLockEncodingError(void); 250 251 ColorProfile* GetDefaultColorProfile(void); 252 ColorProfile* GetColorProfiles(void); 253 ColorProfile* GetColorProfile(const char *name); 254 void EnableDefaultColorProfileResourceDB(Display *dp); 255 char* GetPrefDefaultColorProfileName(void); 256 void SetPrefDefaultColorProfileName(const char *str); 257 258 void ColorProfileCopySettings(ColorProfile *from, ColorProfile *to); 259 int ColorProfileResourceDBEqual(ColorProfile *c1, ColorProfile *c2); 260 261 int GetNumColorProfiles(void); 262 263 char* WriteColorProfilesString(void); 264 265 266 void SetPrefUndoPurgeLimit(int limit); 267 int GetPrefUndoPurgeLimit(void); 268 void SetPrefUndoPurgeTrimTo(int limit); 269 int GetPrefUndoPurgeTrimTo(void); 270 void SetPrefUndoWorryLimit(int limit); 271 int GetPrefUndoWorryLimit(void); 272 void SetPrefUndoWorryTrimTo(int limit); 273 int GetPrefUndoWorryTrimTo(void); 274 void SetPrefUndoOpLimit(int limit); 275 int GetPrefUndoOpLimit(void); 276 void SetPrefUndoOpTrimTo(int limit); 277 int GetPrefUndoOpTrimTo(void); 278 279 char* ChangeFontSize(const char *name, int newsize); 280 281 ColorList ParseColorList(const char *str, size_t len); 282 void ColorProfileDestroy(ColorProfile *profile); 283 void ColorProfileFreeContent(ColorProfile *profile); 284 char* ParseAnsiColorList(char **array, const char *str); 285 286 void ParseColorProfiles(const char *str); 287 288 #endif /* NEDIT_PREFERENCES_H_INCLUDED */ 289