Index: nedit/doc/help.etx =================================================================== RCS file: /cvsroot/nedit/nedit/doc/help.etx,v retrieving revision 1.63 diff -c -r1.63 help.etx *** nedit/doc/help.etx 17 Apr 2004 03:51:48 -0000 1.63 --- nedit/doc/help.etx 17 Apr 2004 19:31:40 -0000 *************** *** 4052,4057 **** --- 4052,4076 ---- set to False, the "Case Sensitive" buttons are independent of the "Regular Expression" toggle. + **nedit.coloredWinMenu**: True + + Controls if the Windows menu shall use colors to code the file's status. + + If above resource is set to True, the following three + resources can be used to define the colors to use. + + **nedit.defaultWinMenuColor**: black + + Defines the default color of files in the Windows menu. + + **nedit.modifiedWinMenuColor**: red + + Defines the color of modified (unsaved) files in the Windows menu. + + **nedit.readOnlyWinMenuColor**: blue + + Defines the color of read-only files in the Windows menu. + **nedit.printDefaultHost**: (system specific) The node name of the default print host. Used only to display in the print Index: nedit/source/menu.c =================================================================== RCS file: /cvsroot/nedit/nedit/source/menu.c,v retrieving revision 1.100 diff -c -r1.100 menu.c *** nedit/source/menu.c 15 Apr 2004 22:32:30 -0000 1.100 --- nedit/source/menu.c 17 Apr 2004 19:31:45 -0000 *************** *** 4470,4475 **** --- 4470,4494 ---- WriteNEditDB(); } + static void colorWindowMenuEntries(const WindowInfo* window, Widget widget) + { + if (GetPrefColoredWinMenu() == True) + { + const char* color; + int colorLength; + if (IS_ANY_LOCKED(window->lockReasons)) { + color = GetPrefRoMenuColor(&colorLength); + } + else if (window->fileChanged == TRUE) { + color = GetPrefModMenuColor(&colorLength); + } + else { + color = GetPrefDefMenuColor(&colorLength); + } + XtVaSetValues(widget, XtVaTypedArg, XmNforeground, XmRString, color, colorLength + 1, NULL); + } + } + static char* getWindowsMenuEntry(const WindowInfo* window) { static char fullTitle[MAXPATHLEN * 2 + 3+ 1]; *************** *** 4548,4553 **** --- 4567,4573 ---- char* title = getWindowsMenuEntry(windows[windowIndex]); XtVaSetValues(items[n], XmNlabelString, st1=XmStringCreateSimple(title), NULL); + colorWindowMenuEntries(windows[windowIndex], items[n]); XtRemoveAllCallbacks(items[n], XmNactivateCallback); XtAddCallback(items[n], XmNactivateCallback, (XtCallbackProc)raiseCB, windows[windowIndex]); *************** *** 4566,4571 **** --- 4586,4593 ---- XmNlabelString, st1=XmStringCreateSimple(title), XmNmarginHeight, 0, XmNuserData, TEMPORARY_MENU_ITEM, NULL); + + colorWindowMenuEntries(windows[windowIndex], btn); XtAddCallback(btn, XmNactivateCallback, (XtCallbackProc)raiseCB, windows[windowIndex]); XmStringFree(st1); Index: nedit/source/preferences.c =================================================================== RCS file: /cvsroot/nedit/nedit/source/preferences.c,v retrieving revision 1.118 diff -c -r1.118 preferences.c *** nedit/source/preferences.c 15 Apr 2004 22:32:31 -0000 1.118 --- nedit/source/preferences.c 17 Apr 2004 19:31:47 -0000 *************** *** 104,109 **** --- 104,112 ---- /* maximum number of file extensions allowed in a language mode */ #define MAX_FILE_EXTENSIONS 20 + /* maximum size of color string */ + #define MAX_COLOR_LENGTH 256 + /* Return values for checkFontStatus */ enum fontStatus {GOOD_FONT, BAD_PRIMARY, BAD_FONT, BAD_SIZE, BAD_SPACING}; *************** *** 312,317 **** --- 315,329 ---- char colorNames[NUM_COLORS][MAX_COLOR_LEN]; char tooltipBgColor[MAX_COLOR_LEN]; int undoModifiesSelection; + /* Color of modified, readonly, and normal menu items for the filenames + * in the window menu*/ + int coloredWinMenu; + char modMenuColor[MAX_COLOR_LENGTH]; + int modMenuColorLength; + char roMenuColor[MAX_COLOR_LENGTH]; + int roMenuColorLength; + char defMenuColor[MAX_COLOR_LENGTH]; + int defMenuColorLength; } PrefData; /* Temporary storage for preferences strings which are discarded after being *************** *** 969,974 **** --- 981,994 ---- PrefData.titleFormat, (void *)sizeof(PrefData.titleFormat), True}, {"undoModifiesSelection", "UndoModifiesSelection", PREF_BOOLEAN, "True", &PrefData.undoModifiesSelection, NULL, False}, + {"coloredWinMenu", "ColoredWinMenu", PREF_BOOLEAN, "True", + &PrefData.coloredWinMenu, NULL, False}, + {"modifiedWinMenuColor", "ModifiedWinMenuColor", PREF_STRING, "red", + PrefData.modMenuColor, (void *)sizeof(PrefData.modMenuColor), False}, + {"readOnlyWinMenuColor", "ReadOnlyWinMenuColor", PREF_STRING, "blue", + PrefData.roMenuColor, (void *)sizeof(PrefData.roMenuColor), False}, + {"defaultWinMenuColor", "DefaultWinMenuColor", PREF_STRING, "black", + PrefData.defMenuColor, (void *)sizeof(PrefData.defMenuColor), False}, }; static XrmOptionDescRec OpTable[] = { *************** *** 1293,1298 **** --- 1313,1323 ---- if (PrefData.autoIndent == 3) PrefData.autoIndent = AUTO_INDENT; if (PrefData.autoIndent == 4) PrefData.autoIndent = NO_AUTO_INDENT; + /* For efficiency, precalculate the lengths of window menu colors */ + SetPrefModMenuColorLength(PrefData.modMenuColor); + SetPrefRoMenuColorLength (PrefData.roMenuColor); + SetPrefDefMenuColorLength(PrefData.defMenuColor); + /* setup language mode dependent info of user menus (to increase performance when switching between documents of different language modes) */ *************** *** 2052,2057 **** --- 2077,2119 ---- { return PrefData.virtKeyOverride; } + int GetPrefColoredWinMenu(void) + { + return PrefData.coloredWinMenu; + } + + const char *GetPrefModMenuColor(int* length) + { + *length = PrefData.modMenuColorLength; + return PrefData.modMenuColor; + } + + void SetPrefModMenuColorLength(const char* string) + { + PrefData.modMenuColorLength = strlen(string); + } + + const char *GetPrefRoMenuColor(int* length) + { + *length = PrefData.roMenuColorLength; + return PrefData.roMenuColor; + } + + void SetPrefRoMenuColorLength(const char* string) + { + PrefData.roMenuColorLength = strlen(string); + } + + const char *GetPrefDefMenuColor(int* length) + { + *length = PrefData.defMenuColorLength; + return PrefData.defMenuColor; + } + + void SetPrefDefMenuColorLength(const char* string) + { + PrefData.defMenuColorLength = strlen(string); + } /* ** If preferences don't get saved, ask the user on exit whether to save Index: nedit/source/preferences.h =================================================================== RCS file: /cvsroot/nedit/nedit/source/preferences.h,v retrieving revision 1.41 diff -c -r1.41 preferences.h *** nedit/source/preferences.h 15 Apr 2004 22:32:31 -0000 1.41 --- nedit/source/preferences.h 17 Apr 2004 19:31:47 -0000 *************** *** 168,173 **** --- 168,180 ---- void SetLangModeMenu(Widget optMenu, const char *modeName); Widget CreateLanguageModeSubMenu(WindowInfo *window, Widget parent, char *name, char *label, char mnemonic); + int GetPrefColoredWinMenu(void); + const char *GetPrefModMenuColor(int* length); + void SetPrefModMenuColorLength(const char* string); + const char *GetPrefRoMenuColor(int* length); + void SetPrefRoMenuColorLength(const char* string); + const char *GetPrefDefMenuColor(int* length); + void SetPrefDefMenuColorLength(const char* string); void SetPrefFindReplaceUsesSelection(int state); int GetPrefFindReplaceUsesSelection(void); int GetPrefStickyCaseSenseBtn(void);