diff --git a/ChangeLog b/ChangeLog index 663cd984..d142478b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4304,6 +4304,8 @@ v0.33.19 26-Oct-2001 Changed users password length to 14 characters instead of 12. When you make a tty line available, some settings are automatic set to reasonable defaults. + The color editor now has a rangecheck. + Rewrote calling of the color editor for Sparc systems. mbsebbs: Added menu 317, change FS editor shortcut keys to (Emacs/ diff --git a/mbsetup/ledit.c b/mbsetup/ledit.c index f5d49dac..a1523999 100644 --- a/mbsetup/ledit.c +++ b/mbsetup/ledit.c @@ -1442,14 +1442,14 @@ void show_aka(int y, int x, fidoaddr aka) -void edit_color(int *fg, int *bg, char *help) +void edit_color(int *fg, int *bg, char *title, char *help) { int ch, f, b; char temp[81]; clr_index(); set_color(WHITE, BLACK); - mvprintw(5, 6, "1.8 EDIT COLORS"); + mvprintw(5, 6, title); sprintf(temp, "Change the ^%s^ color with arrow keys, press whene done", help); showhelp(temp); @@ -1458,15 +1458,16 @@ void edit_color(int *fg, int *bg, char *help) set_color(f, b); mvprintw(b + 9, f + 33, "."); } - f = (* fg); - b = (* bg); + + f = (*fg) & 15; + b = (*bg) & 7; for (;;) { set_color(f, b); mvprintw(7, 6, "This is an example..."); fflush(stdout); mvprintw(b + 9, f + 33, "*"); - ch = readkey(7,28,f,b); + ch = readkey(7,28, f, b); mvprintw(b + 9, f + 33, "."); switch(ch) { case KEY_LINEFEED: diff --git a/mbsetup/ledit.h b/mbsetup/ledit.h index 9ac33693..0e7f5757 100644 --- a/mbsetup/ledit.h +++ b/mbsetup/ledit.h @@ -1,3 +1,5 @@ +/* $Id$ */ + #ifndef _LEDIT_H #define _LEDIT_H @@ -58,7 +60,7 @@ char *getmagictype(int); void show_magictype(int, int, int); int edit_magictype(int, int, int); void show_aka(int, int, fidoaddr); -void edit_color(int *, int *, char *); +void edit_color(int *, int *, char *, char *); char *get_color(int); char *getmenutype(int); diff --git a/mbsetup/m_global.c b/mbsetup/m_global.c index 1de63bc5..d83bd67f 100644 --- a/mbsetup/m_global.c +++ b/mbsetup/m_global.c @@ -436,6 +436,14 @@ void e_newuser(void) void e_colors(void) { + int fg, bg; + +/* + * With this macro intermediate variables are passed to the color editor to prevent SIGBUS + * on some CPU's (Sparc). + */ +#define ED_COL(f, b, t, h) fg = f; bg = b; edit_color(&fg, &bg, (char *)t, (char *)h); f = fg; b = bg; break; + for (;;) { clr_index(); set_color(WHITE, BLACK); @@ -466,17 +474,17 @@ void e_colors(void) switch(select_menu(11)) { case 0: return; - case 1: edit_color(&CFG.TextColourF, &CFG.TextColourB, (char *)"normal text"); break; - case 2: edit_color(&CFG.UnderlineColourF, &CFG.UnderlineColourB, (char *)"underline"); break; - case 3: edit_color(&CFG.InputColourF, &CFG.InputColourB, (char *)"input"); break; - case 4: edit_color(&CFG.CRColourF, &CFG.CRColourB, (char *)""); break; - case 5: edit_color(&CFG.MoreF, &CFG.MoreB, (char *)"more prompt"); break; - case 6: edit_color(&CFG.HiliteF, &CFG.HiliteB, (char *)"hilite text"); break; - case 7: edit_color(&CFG.FilenameF, &CFG.FilenameB, (char *)"file name"); break; - case 8: edit_color(&CFG.FilesizeF, &CFG.FilesizeB, (char *)"file size"); break; - case 9: edit_color(&CFG.FiledateF, &CFG.FiledateB, (char *)"file date"); break; - case 10:edit_color(&CFG.FiledescF, &CFG.FiledescB, (char *)"file description"); break; - case 11:edit_color(&CFG.MsgInputColourF, &CFG.MsgInputColourB, (char *)"message input"); break; + case 1: ED_COL(CFG.TextColourF, CFG.TextColourB, "1.8.1 EDIT COLOR", "normal text") + case 2: ED_COL(CFG.UnderlineColourF, CFG.UnderlineColourB, "1.8.2 EDIT COLOR", "underline") + case 3: ED_COL(CFG.InputColourF, CFG.InputColourB, "1.8.3 EDIT COLOR", "input") + case 4: ED_COL(CFG.CRColourF, CFG.CRColourB, "1.8.4 EDIT COLOR", "") + case 5: ED_COL(CFG.MoreF, CFG.MoreB, "1.8.5 EDIT COLOR", "more prompt") + case 6: ED_COL(CFG.HiliteF, CFG.HiliteB, "1.8.6 EDIT COLOR", "hilite text") + case 7: ED_COL(CFG.FilenameF, CFG.FilenameB, "1.8.7 EDIT COLOR", "file name") + case 8: ED_COL(CFG.FilesizeF, CFG.FilesizeB, "1.8.8 EDIT COLOR", "file size") + case 9: ED_COL(CFG.FiledateF, CFG.FiledateB, "1.8.9 EDIT COLOR", "file date") + case 10:ED_COL(CFG.FiledescF, CFG.FiledescB, "1.8.10 EDIT COLOR", "file description") + case 11:ED_COL(CFG.MsgInputColourF, CFG.MsgInputColourB, "1.8.11 EDIT COLOR", "message input") } }; } diff --git a/mbsetup/m_menu.c b/mbsetup/m_menu.c index e9b4d10e..9064b31b 100644 --- a/mbsetup/m_menu.c +++ b/mbsetup/m_menu.c @@ -209,6 +209,8 @@ int GetMenuType(void) void Edit_A_Menu(void); void Edit_A_Menu(void) { + int fg, bg; + Show_A_Menu(); for (;;) { @@ -226,15 +228,23 @@ void Edit_A_Menu(void) break; case 3: E_STR( 9,16,64, menus.OptionalData, "The ^optional data^ for this menu item") case 4: E_STR(11,16,64, menus.Display, "The text to ^display^ for this menu") - case 5: E_SEC(12,16, menus.MenuSecurity, "7.3.5 MENU ACCESS SECURITY", Show_A_Menu) + case 5: E_SEC(12,16, menus.MenuSecurity, "8.3.5 MENU ACCESS SECURITY", Show_A_Menu) case 6: E_INT(13,16, menus.Age, "The minimum ^Age^ to select this menu, 0 is don't care") case 7: E_INT(14,16, menus.MaxSecurity, "The maximum ^Security level^ to access this menu") case 8: E_STR(15,16,14, menus.Password, "The ^password^ to access this menu item") case 9: E_INT(16,16, menus.Credit, "The ^credit cost^ for this menu item") - case 10:edit_color(&menus.ForeGnd, &menus.BackGnd, (char *)"normal"); + case 10:fg = menus.ForeGnd; + bg = menus.BackGnd; + edit_color(&fg, &bg, (char *)"8.3.10 EDIT COLOR", (char *)"normal"); + menus.ForeGnd = fg; + menus.BackGnd = bg; Show_A_Menu(); break; - case 11:edit_color(&menus.HiForeGnd, &menus.HiBackGnd, (char *)"bright"); + case 11:fg = menus.HiForeGnd; + bg = menus.HiBackGnd; + edit_color(&fg, &bg, (char *)"8.3.11 EDIT COLOR", (char *)"bright"); + menus.HiForeGnd = fg; + menus.HiBackGnd = bg; Show_A_Menu(); break; case 12:E_BOOL(19,16, menus.AutoExec, "Is this an ^Autoexecute^ menu item") @@ -339,7 +349,7 @@ void EditMenu(char *Name) if ((fil = fopen(temp, "w+")) == NULL) { working(2, 0, 0); } else { - Syslog('+', "Updated menu %s", temp); + Syslog('+', "Updated menu %s (%s)", temp, lang.Name); fseek(tmp, 0, SEEK_SET); while (fread(&menus, sizeof(menus), 1, tmp) == 1) { if (menus.MenuKey[0] || menus.AutoExec) diff --git a/mbsetup/screen.c b/mbsetup/screen.c index 55ca59d5..cde19e2e 100644 --- a/mbsetup/screen.c +++ b/mbsetup/screen.c @@ -74,12 +74,15 @@ static int old_b = -1; void set_color(int f, int b) { - if ((f != old_f) || (b != old_b)) { - old_f = f; - old_b = b; - colour(f, b); - fflush(stdout); - } + f = f & 15; + b = b & 7; + + if ((f != old_f) || (b != old_b)) { + old_f = f; + old_b = b; + colour(f, b); + fflush(stdout); + } }