diff --git a/golded3/gccfgg2.cpp b/golded3/gccfgg2.cpp index a4ea985..03d77ea 100644 --- a/golded3/gccfgg2.cpp +++ b/golded3/gccfgg2.cpp @@ -267,7 +267,7 @@ void CfgColorname() ptr = strskip_wht(ptr); Node cn; - int color = atoi(ptr); + vattr color = atoi(ptr); // color was given *ptr = NUL; @@ -291,7 +291,7 @@ void CfgColorname() strxcpy(cn.name, val, sizeof(cn.name)); - CFG->colorname.push_back(std::pair(cn, color)); + CFG->colorname.push_back(std::pair(cn, color)); } // ------------------------------------------------------------------ diff --git a/golded3/gcmisc.cpp b/golded3/gcmisc.cpp index c29fe4c..6e624e1 100644 --- a/golded3/gcmisc.cpp +++ b/golded3/gcmisc.cpp @@ -233,72 +233,72 @@ const word CRC_SCERROR = 0xAB65; // ------------------------------------------------------------------ // Get color value -int GetColor(char* ink) { - +vattr GetColor(char* ink) +{ word crc; - int color=0; + vattr color = BLACK|_BLACK; crc = strCrc16(strupr(ink)); switch(crc) { // Black is the default case CRC_BLACK: - color = 0; + color = BLACK|_BLACK; break; case CRC_BLUE: - color = 1; + color = BLUE|_BLACK; break; case CRC_GREEN: - color = 2; + color = GREEN|_BLACK; break; case CRC_CYAN: - color = 3; + color = CYAN|_BLACK; break; case CRC_RED: - color = 4; + color = RED|_BLACK; break; case CRC_MAGENTA: - color = 5; + color = MAGENTA|_BLACK; break; case CRC_BROWN: - color = 6; + color = BROWN|_BLACK; break; case CRC_LGRAY: case CRC_LGREY: case CRC_LIGHTGRAY: case CRC_LIGHTGREY: - color = 7; + color = LGREY|_BLACK; break; case CRC_DGRAY: case CRC_DGREY: case CRC_DARKGRAY: case CRC_DARKGREY: - color = 8; + color = DGREY|_BLACK; break; case CRC_LBLUE: case CRC_LIGHTBLUE: - color = 9; + color = LBLUE|_BLACK; break; case CRC_LGREEN: case CRC_LIGHTGREEN: - color = 10; + color = LGREEN|_BLACK; break; case CRC_LCYAN: case CRC_LIGHTCYAN: - color = 11; + color = LCYAN|_BLACK; break; case CRC_LRED: case CRC_LIGHTRED: - color = 12; + color = LRED|_BLACK; break; case CRC_LMAGENTA: case CRC_LIGHTMAGENTA: - color = 13; + color = LMAGENTA|_BLACK; break; case CRC_YELLOW: - color = 14; + color = YELLOW|_BLACK; break; case CRC_WHITE: - color = 15; + color = WHITE|_BLACK; break; case CRC_UNDERLINE: color = UNDERLINE; @@ -320,7 +320,7 @@ int GetColor(char* ink) { // ------------------------------------------------------------------ // Evaluates a color string -int MakeColor(char* colors) { +vattr MakeColor(char* colors) { static int paper=0; int ink=0, blink; @@ -356,10 +356,10 @@ int MakeColor(char* colors) { void GetColors(char* value) { - word crc; - Win* wptr; - int attr; - char buf[256]; + word crc; + Win* wptr; + vattr attr; + char buf[256]; char* win; char* colors; char* part=NULL; diff --git a/golded3/geall.h b/golded3/geall.h index f13cb72..c0885b8 100644 --- a/golded3/geall.h +++ b/golded3/geall.h @@ -562,8 +562,8 @@ struct MLst { time32_t arrived; time32_t received; char goldmark; - int colorby; - int colorto; + vattr colorby; + vattr colorto; }; @@ -877,9 +877,9 @@ struct SaveUtil { // Window structure struct Win { - int btype; // Border type - int c[16]; // Colors - int w; // Window handle + int btype; // Border type + vattr c[16]; // Colors + int w; // Window handle }; // ------------------------------------------------------------------ diff --git a/golded3/gealst.cpp b/golded3/gealst.cpp index 07a8895..b3ce229 100644 --- a/golded3/gealst.cpp +++ b/golded3/gealst.cpp @@ -467,7 +467,7 @@ public: void SelMaskPick::open() { - window.openxy(ypos, xpos, ylen+2, xlen+2, btype, battr, 7); + window.openxy(ypos, xpos, ylen+2, xlen+2, btype, battr, LGREY); window.title(title, tattr); window.shadow(C_SHADOW); update(); diff --git a/golded3/gecfgg.h b/golded3/gecfgg.h index c44afb1..33b9bed 100644 --- a/golded3/gecfgg.h +++ b/golded3/gecfgg.h @@ -190,7 +190,7 @@ public: int beepyourmail; int carboncopylist; // cclist; Win color[16]; - std::vector< std::pair > colorname; + std::vector< std::pair > colorname; Path confirmfile; // goldedcfm; int confirmresponse; Path cookiepath; diff --git a/golded3/gecmfd.cpp b/golded3/gecmfd.cpp index 200da7f..55530f1 100644 --- a/golded3/gecmfd.cpp +++ b/golded3/gecmfd.cpp @@ -192,7 +192,7 @@ void Area::DelMsgs(GMsg* msg) { if(delask) { if(msg->attr.uns() and not (msg->attr.rcv() or msg->attr.del())) { AA->LoadMsg(msg, msgno, CFG->dispmargin-(int)CFG->switches.get(disppagebar)); - w_progress(MODE_QUIT, 0, 0, 0, NULL); + w_progress(MODE_QUIT, BLACK|_BLACK, 0, 0, NULL); HeaderView->Use(AA, msg); HeaderView->Paint(); BodyView->Use(AA, msg, topline); @@ -213,7 +213,7 @@ void Area::DelMsgs(GMsg* msg) { } if(msg->attr.lok() and not dellocked and not deletethis) { AA->LoadMsg(msg, msgno, CFG->dispmargin-(int)CFG->switches.get(disppagebar)); - w_progress(MODE_QUIT, 0, 0, 0, NULL); + w_progress(MODE_QUIT, BLACK|_BLACK, 0, 0, NULL); HeaderView->Use(AA, msg); HeaderView->Paint(); BodyView->Use(AA, msg, topline); @@ -238,7 +238,7 @@ void Area::DelMsgs(GMsg* msg) { isreadmark = false; Mark.ResetAll(); } - w_progress(MODE_QUIT, 0, 0, 0, NULL); + w_progress(MODE_QUIT, BLACK|_BLACK, 0, 0, NULL); } } if(n == 0) { diff --git a/golded3/gectnr.cpp b/golded3/gectnr.cpp index 131182c..b4505df 100644 --- a/golded3/gectnr.cpp +++ b/golded3/gectnr.cpp @@ -85,7 +85,7 @@ inline bool isstylechar(char c) { return (c == '*') or (c == '/') or (c == '_') or (c == '#'); } -void Container::StyleCodeHighlight(const char* text, int row, int col, bool dohide, int color) { +void Container::StyleCodeHighlight(const char* text, int row, int col, bool dohide, vattr color) { uint sclen = 0; const char* txptr = text; diff --git a/golded3/gectnr.h b/golded3/gectnr.h index be6a3ed..8d91808 100644 --- a/golded3/gectnr.h +++ b/golded3/gectnr.h @@ -31,13 +31,13 @@ class Container { - virtual void prints(int, int, int, const char*) = 0; + virtual void prints(int, int, vattr, const char*) = 0; public: virtual ~Container() { } - void StyleCodeHighlight(const char* text, int row, int col, bool dohide, int color); + void StyleCodeHighlight(const char* text, int row, int col, bool dohide, vattr color); }; diff --git a/golded3/gedoit.cpp b/golded3/gedoit.cpp index 46367d8..4f66404 100644 --- a/golded3/gedoit.cpp +++ b/golded3/gedoit.cpp @@ -262,7 +262,7 @@ static void WriteMsgs(GMsg* msg) { remove(fname); } - w_progress(MODE_QUIT, 0, 0, 0, NULL); + w_progress(MODE_QUIT, BLACK|_BLACK, 0, 0, NULL); } else if(source == WRITE_CURRENT) { if(target & WRITE_FILE) { diff --git a/golded3/gedoss.cpp b/golded3/gedoss.cpp index 3b093f1..5e64982 100644 --- a/golded3/gedoss.cpp +++ b/golded3/gedoss.cpp @@ -147,7 +147,7 @@ void Cleanup(void) { } // Reset border color - if(C_BACKB != 0) + if (C_BACKB != (BLACK|_BLACK)) gvid->setoverscan(gvid->orig.color.overscan); wcloseall(); // Close all windows @@ -215,7 +215,7 @@ void Cleanup(void) { // ------------------------------------------------------------------ // Multipurpose DOS shell function -int ShellToDos(char* command, char* message, int cls, int cursor, int pause) { +int ShellToDos(char* command, char* message, vattr cls, int cursor, int pause) { int error = 0; @@ -292,11 +292,11 @@ int ShellToDos(char* command, char* message, int cls, int cursor, int pause) { gvid->setmode(gvid->orig.screen.mode); // Clear screen - if(cls) + if (cls != (BLACK|_BLACK)) vclrscr(cls); // Reset border color - if(C_BACKB != 0) + if (C_BACKB != (BLACK|_BLACK)) gvid->setoverscan(gvid->orig.color.overscan); // Turn on the blinking attributes @@ -314,10 +314,9 @@ int ShellToDos(char* command, char* message, int cls, int cursor, int pause) { #endif // Return cursor into 1st column - if(cls) puts(""); + if (cls != (BLACK|_BLACK)) puts(""); // Write message on screen - if(*message) - puts(message); + if(*message) puts(message); // Turn on cursor int yy, xx; @@ -405,7 +404,7 @@ int ShellToDos(char* command, char* message, int cls, int cursor, int pause) { gvid->setintensity(CFG->intensecolors); // Restore border color - if(C_BACKB != 0) + if (C_BACKB != (BLACK|_BLACK)) gvid->setoverscan(C_BACKB); // Set palette if changes were specified diff --git a/golded3/geedit.cpp b/golded3/geedit.cpp index e2aa5d6..e09c634 100644 --- a/golded3/geedit.cpp +++ b/golded3/geedit.cpp @@ -130,7 +130,7 @@ void IEclass::setlinetype(Line* __line) { // ------------------------------------------------------------------ // Zero-based -int IEclass::dispchar(vchar __ch, int attr) { +vattr IEclass::dispchar(vchar __ch, vattr attr) { if(__ch == NUL) // possible if line empty __ch = ' '; @@ -141,10 +141,10 @@ int IEclass::dispchar(vchar __ch, int attr) { __ch = EDIT->CharSpace(); } - int atr; + vattr atr; vchar chr; editwin.getc(crow, ccol, &atr, &chr); - editwin.printc(crow, ccol, attr == -1 ? atr : attr, __ch); + editwin.printc(crow, ccol, attr == DEFATTR ? atr : attr, __ch); return atr; } @@ -186,7 +186,7 @@ void IEclass::scrolldown(int __scol, int __srow, int __ecol, int __erow, int __l // ------------------------------------------------------------------ // Zero-based -void IEclass::prints(int wrow, int wcol, int atr, const char* str) { +void IEclass::prints(int wrow, int wcol, vattr atr, const char* str) { editwin.prints(wrow, wcol, atr, str); } @@ -290,7 +290,7 @@ void IEclass::dispstringsc(char *__buf, uint __beg, uint __end, uint __row, uint { char savechar = __buf[bend]; __buf[bend] = NUL; - StyleCodeHighlight(__buf+bbeg, __row, __col+bbeg-__beg, false, -1); + StyleCodeHighlight(__buf+bbeg, __row, __col+bbeg-__beg, false, DEFATTR); __buf[bend] = savechar; bbeg = bend; bend += scpos; @@ -313,7 +313,7 @@ void IEclass::dispstringsc(char *__buf, uint __beg, uint __end, uint __row, uint } if (bbeg < bend) - StyleCodeHighlight(__buf+bbeg, __row, __col+bbeg-__beg, false, -1); + StyleCodeHighlight(__buf+bbeg, __row, __col+bbeg-__beg, false, DEFATTR); } @@ -414,7 +414,7 @@ void IEclass::dispstring(Line* line, uint __row) dispstringsc(_buf, 0, begblock, __row, mincol, savechar); } else - StyleCodeHighlight(_buf, __row, mincol, false, -1); + StyleCodeHighlight(_buf, __row, mincol, false, DEFATTR); _buf[begblock] = savechar; } @@ -443,7 +443,7 @@ void IEclass::dispstring(Line* line, uint __row) dispstringsc(_buf, endblock, maxcol+1, __row, mincol+endblock, 0); } else - StyleCodeHighlight(_buf+endblock, __row, mincol+endblock, false, -1); + StyleCodeHighlight(_buf+endblock, __row, mincol+endblock, false, DEFATTR); } GFTRK(NULL); @@ -2913,7 +2913,7 @@ int IEclass::Start(int __mode, uint* __position, GMsg* __msg) { gotorowcol(col, row); batch_mode = 0; - int backattr = 0; + vattr backattr = BLACK|_BLACK; if(blockcol == -1) { backattr = dispchar(currline->txt.c_str()[col], C_READC); gotorowcol(col, row); diff --git a/golded3/geedit.h b/golded3/geedit.h index 77347b8..c67840b 100644 --- a/golded3/geedit.h +++ b/golded3/geedit.h @@ -295,7 +295,7 @@ protected: void cursoroff (); void cursoron (); void deleteline (bool zapquotesbelow = false); - int dispchar (vchar __ch, int attr=-1); + vattr dispchar (vchar __ch, vattr attr = DEFATTR); void dispins (); void dispdl (); void displine (Line* __line, uint __row); @@ -320,7 +320,7 @@ protected: int isempty (Line* __line=NULL); void killkillbuf (); void killpastebuf (); - void prints (int wrow, int wcol, int atr, const char* str); + void prints (int wrow, int wcol, vattr atr, const char* str); int reflowok (char* __qstr); void refresh (Line* __currline, uint __row); void savefile (int __status); diff --git a/golded3/geedit2.cpp b/golded3/geedit2.cpp index c419cf0..2a1850e 100644 --- a/golded3/geedit2.cpp +++ b/golded3/geedit2.cpp @@ -949,7 +949,7 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) { isPipe = YES; mktemp(strxcpy(tmpfile, AddPath(CFG->temppath, "GIXXXXXX"), sizeof(Path))); strxmerge(cmdline, sizeof(Path), filenamebuf.c_str()+1, " > ", tmpfile, NULL); - ShellToDos(cmdline, "", NO, NO); + ShellToDos(cmdline, "", BLACK|_BLACK, NO); filenamebuf = tmpfile; fileselected = true; } else { diff --git a/golded3/gefile.cpp b/golded3/gefile.cpp index 754c2dd..b7380b1 100644 --- a/golded3/gefile.cpp +++ b/golded3/gefile.cpp @@ -608,7 +608,7 @@ void CreateFileMsgs(int mode, GMsg* msg) { msg->TextToLines(CFG->dispmargin); if(specfiles > 1) - w_progress(MODE_QUIT, 0, 0, 0, NULL); + w_progress(MODE_QUIT, BLACK|_BLACK, 0, 0, NULL); } diff --git a/golded3/gefind.cpp b/golded3/gefind.cpp index 5c9b543..dafd09f 100644 --- a/golded3/gefind.cpp +++ b/golded3/gefind.cpp @@ -83,7 +83,7 @@ void FindHdr(GMsg* msg, int& topline, int& keyok) { // ------------------------------------------------------------------ -bool SearchHighlight(const Line*, int, int, int) { +bool SearchHighlight(const Line*, int, int, vattr) { return false; } @@ -181,7 +181,7 @@ bool FindString(GMsg* msg, const char* prompt, int what) { AA->set_lastread(last); } - w_progress(MODE_QUIT, 0, 0, 0, NULL); + w_progress(MODE_QUIT, BLACK|_BLACK, 0, 0, NULL); if(breakloop) HandleGEvent(EVTT_BREAKLOOP); diff --git a/golded3/geglob.cpp b/golded3/geglob.cpp index 84b2d71..baed047 100644 --- a/golded3/geglob.cpp +++ b/golded3/geglob.cpp @@ -46,9 +46,9 @@ Subj information = ""; Area* AA = NULL; -char m_title[80]; // Menu title string -int m_titlepos; // Menu title position -int m_titleattr; // Menu title color +char m_title[80]; // Menu title string +int m_titlepos; // Menu title position +vattr m_titleattr; // Menu title color int AreaKeys = 0; int ReadKeys = 0; diff --git a/golded3/geglob.h b/golded3/geglob.h index 9e39647..5fc9fdc 100644 --- a/golded3/geglob.h +++ b/golded3/geglob.h @@ -100,9 +100,9 @@ extern Subj information; extern Area* AA; -extern char m_title[]; -extern int m_titlepos; -extern int m_titleattr; +extern char m_title[]; +extern int m_titlepos; +extern vattr m_titleattr; extern int AreaKeys, ReadKeys, ListKeys, NodeKeys, EditKeys, FileKeys, AddressbookKeys, HeaderKeys; extern std::list::iterator AreaKey, ReadKey, ListKey, NodeKey, EditKey, FileKey, AddressbookKey, HeaderKey; diff --git a/golded3/geinit.cpp b/golded3/geinit.cpp index 92ae02f..ca8eb5f 100644 --- a/golded3/geinit.cpp +++ b/golded3/geinit.cpp @@ -786,7 +786,7 @@ void Initialize(int argc, char* argv[]) { gvid->setintensity(CFG->intensecolors); - if(C_BACKB != 0) + if (C_BACKB != (BLACK|_BLACK)) gvid->setoverscan(C_BACKB); vcurhide(); diff --git a/golded3/gemlst.cpp b/golded3/gemlst.cpp index 9aaf7cc..14471eb 100644 --- a/golded3/gemlst.cpp +++ b/golded3/gemlst.cpp @@ -210,8 +210,8 @@ void GMsgList::ReadMlst(int n) { strcpy(ml->re, msg.re); { Addr zero; - ml->colorby = GetColorName(ml->by, msg.orig, -1); - ml->colorto = GetColorName(ml->to, AA->isnet() ? msg.dest : zero, -1); + ml->colorby = GetColorName(ml->by, msg.orig, DEFATTR); + ml->colorto = GetColorName(ml->to, AA->isnet() ? msg.dest : zero, DEFATTR); } } @@ -294,7 +294,7 @@ void GMsgList::print_line(uint idx, uint pos, bool isbar) { update_marks(ml); - int wattr_, hattr_, mattr_; + vattr wattr_, hattr_, mattr_; if(isbar) { wattr_ = sattr; hattr_ = sattr; @@ -353,16 +353,16 @@ void GMsgList::print_line(uint idx, uint pos, bool isbar) { if (ml->high & (MLST_HIGH_BOOK|MLST_HIGH_MARK)) window.prints(pos, 5, mattr_, ml->marks); - if ((ml->high & MLST_HIGH_FROM) || (ml->colorby != -1)) + if ((ml->high & MLST_HIGH_FROM) || (ml->colorby != DEFATTR)) { - int color = ((ml->colorby != -1) && !isbar) ? ml->colorby : hattr_; + vattr color = ((ml->colorby != DEFATTR) && !isbar) ? ml->colorby : hattr_; window.printns(pos, bycol, color, ml->by, bysiz); } - if (((ml->high & MLST_HIGH_TO) || (ml->colorto != -1)) && + if (((ml->high & MLST_HIGH_TO) || (ml->colorto != DEFATTR)) && !AA->Msglistwidesubj()) { - int color = ((ml->colorto != -1) && !isbar) ? ml->colorto : hattr_; + vattr color = ((ml->colorto != DEFATTR) && !isbar) ? ml->colorto : hattr_; window.printns(pos, tocol, color, ml->to, tosiz); } @@ -733,7 +733,7 @@ public: void GThreadlist::open() { - window.openxy(ypos, xpos, ylen+2, xlen+2, btype, battr, 7); + window.openxy(ypos, xpos, ylen+2, xlen+2, btype, battr, LGREY); update_title(); center(CFG->displistcursor); @@ -886,7 +886,7 @@ void GThreadlist::print_line(uint idx, uint pos, bool isbar) { AA->LoadMsg(&msg, t.msgno, CFG->dispmargin-(int)CFG->switches.get(disppagebar)); } - int attrh, attrw; + vattr attrh, attrw; if(msg.attr.uns() and not msg.attr.rcv() and not msg.attr.del()) { attrw = C_MENUW_UNSENT; attrh = C_MENUQ_UNSENTHIGH; @@ -950,7 +950,7 @@ void GThreadlist::print_line(uint idx, uint pos, bool isbar) { window.prints(pos, 8, isbar ? (sattr|ACSET) : (wattr|ACSET), buf); } - int attr = attrw; + vattr attr = attrw; for(std::vector::iterator x = CFG->username.begin(); x != CFG->username.end(); x++) if(strieql(msg.By(), x->name)) { diff --git a/golded3/gemnus.cpp b/golded3/gemnus.cpp index 9158bfc..1d81f72 100644 --- a/golded3/gemnus.cpp +++ b/golded3/gemnus.cpp @@ -32,7 +32,7 @@ void GMnuAsk::AskInit(int __row, int __col, char* __title, int __help) { Init(); - SetColor(C_ASKW, C_ASKQ, C_ASKN, C_ASKS, CFG->switches.get(screenshadows) ? C_SHADOW : -1); + SetColor(C_ASKW, C_ASKQ, C_ASKN, C_ASKS, CFG->switches.get(screenshadows) ? C_SHADOW : DEFATTR); SetTitle(__title, C_ASKT); SetBorder(W_BASK, C_ASKB); SetPos(__row, __col); @@ -884,7 +884,7 @@ int GMenuEditHeader::Run(int mode, GMsg* msg) { if(EDIT->Menu()) { Init(); - SetColor(C_MENUW, C_MENUQ, C_MENUN, C_MENUS, CFG->switches.get(screenshadows) ? C_SHADOW : -1); + SetColor(C_MENUW, C_MENUQ, C_MENUN, C_MENUS, CFG->switches.get(screenshadows) ? C_SHADOW : DEFATTR); SetTitle(LNG->MsgOptions, C_MENUT); SetBorder(W_BMENU, C_MENUB); SetPos(6, 0); @@ -1014,7 +1014,7 @@ int GMenuNavigate::Run() { Begin(M_HORZ); SetBorder(W_BASK, C_ASKB); - SetColor(C_ASKW, C_ASKQ, C_ASKN, C_ASKS, CFG->switches.get(screenshadows) ? C_SHADOW : -1); + SetColor(C_ASKW, C_ASKQ, C_ASKN, C_ASKS, CFG->switches.get(screenshadows) ? C_SHADOW : DEFATTR); Item(TAG_MAIN, LNG->MMMain); BeginPullDown(); Item(TAG_MAIN_SHELL, LNG->MMShell); @@ -1095,7 +1095,7 @@ int GMenuSChecker::Run(CSpellChecker &schecker, const char *word) } Init(); - SetColor(C_ASKW, C_ASKQ, C_ASKN, C_ASKS, CFG->switches.get(screenshadows) ? C_SHADOW : -1); + SetColor(C_ASKW, C_ASKQ, C_ASKN, C_ASKS, CFG->switches.get(screenshadows) ? C_SHADOW : DEFATTR); SetTitle(title.c_str(), C_ASKT, TLEFT); SetPos(6, 0, title.length()+2, 0); SetBorder(W_BASK, C_ASKB); diff --git a/golded3/gemrks.cpp b/golded3/gemrks.cpp index 0ac86aa..df09913 100644 --- a/golded3/gemrks.cpp +++ b/golded3/gemrks.cpp @@ -209,7 +209,7 @@ void MarkMsgs_Txt(int item, char* markstring) { } } - w_progress(MODE_QUIT, 0, 0, 0, NULL); + w_progress(MODE_QUIT, BLACK|_BLACK, 0, 0, NULL); ResetMsg(msg); throw_free(msg); diff --git a/golded3/genode.cpp b/golded3/genode.cpp index fcb3b35..7aa921b 100644 --- a/golded3/genode.cpp +++ b/golded3/genode.cpp @@ -49,20 +49,20 @@ class NodelistBrowser { public: - int ypos; // Window Starting Row - int xpos; // Window Starting Column - int ylen; // Window Height - int xlen; // Window Width - int btype; // Window Border Type - int battr; // Window Border Color - int wattr; // Window Color - int tattr; // Window Title Color - int sattr; // Window Selection Bar Color - int hattr; // Window Highlight Color - int loattr; // Window LoAttr Color - int sbattr; // Window Scrollbar Color - char* title; // Window Title - int helpcat; // Window Help Category + int ypos; // Window Starting Row + int xpos; // Window Starting Column + int ylen; // Window Height + int xlen; // Window Width + int btype; // Window Border Type + vattr battr; // Window Border Color + vattr wattr; // Window Color + vattr tattr; // Window Title Color + vattr sattr; // Window Selection Bar Color + vattr hattr; // Window Highlight Color + vattr loattr; // Window LoAttr Color + vattr sbattr; // Window Scrollbar Color + char* title; // Window Title + int helpcat; // Window Help Category int pos; // Display Pos (1 to maxpos) int maxpos; // Display Pos diff --git a/golded3/geprot.h b/golded3/geprot.h index 0f10fb2..c1aca58 100644 --- a/golded3/geprot.h +++ b/golded3/geprot.h @@ -77,11 +77,11 @@ void LoadLanguage(const char* file); // ------------------------------------------------------------------ // GCMISC prototypes -int ReadHelpCfg(int force); -int GetColor(char* ink); -int MakeColor(char* colors); -void GetColors(char* value); -void ReadXlatTables(); +int ReadHelpCfg(int force); +vattr GetColor(char* ink); +vattr MakeColor(char* colors); +void GetColors(char* value); +void ReadXlatTables(); // ------------------------------------------------------------------ @@ -118,7 +118,7 @@ void SaveLines(int mode, const char* savefile, GMsg* msg, int margin, bool clip= // GEDOSS prototypes void Cleanup(void); -int ShellToDos(char* command, char* message, int cls, int cursor, int pause=NO); +int ShellToDos(char* command, char* message, vattr cls, int cursor, int pause=NO); // ------------------------------------------------------------------ @@ -142,7 +142,7 @@ void FileSelect(GMsg* msg, char* title, FileSpec* fspec); bool FindString(GMsg* msg, const char* prompt, int what); void FindAll(GMsg* msg, int& topline, int& keyok); void FindHdr(GMsg* msg, int& topline, int& keyok); -bool SearchHighlight(const Line* line, int row, int width, int highlight_color); +bool SearchHighlight(const Line* line, int row, int width, vattr highlight_color); void SearchExit(); void AdvancedSearch(GMsg* msg, int& topline, int& keyok); @@ -405,21 +405,21 @@ int ReadCfg(const char* cfg, int ignoreunknown=false); void ScanMsgTxtForAddr(GMsg* msg); gkey SearchKey(gkey key, std::list::iterator keys, int totkeys); int SearchTaglist(Echo* taglist, char* tag); -void set_title(const char* t, int p, int a); +void set_title(const char* t, int p, vattr a); void title_shadow(); void update_statusline(const char* info); void update_statuslinef(const char* format, const char *token, ...) __attribute__ ((format (printf, 1, 3))); void update_statuslines(); void w_info(const char* info=NULL); void w_infof(const char* format, ...) __attribute__ ((format (printf, 1, 2))); -void w_progress(int mode, int attr, long pos, long size, const char* title); +void w_progress(int mode, vattr attr, long pos, long size, const char* title); void w_shadow(); void ZonegateIt(ftn_addr& gate, ftn_addr& orig, ftn_addr& dest); char* strtmp(const char* str); -int quotecolor(const char* line); +vattr quotecolor(const char* line); void doinvalidate(char* text, const char* find, const char* replace, bool is_tearline = false); bool find(const std::vector &vec, const char *str); -int GetColorName(const char *name, Addr &addr, int color); +vattr GetColorName(const char *name, Addr &addr, vattr color); // ------------------------------------------------------------------ diff --git a/golded3/geread2.cpp b/golded3/geread2.cpp index bac3855..572d4bb 100644 --- a/golded3/geread2.cpp +++ b/golded3/geread2.cpp @@ -567,7 +567,7 @@ int ExternUtil(GMsg *msg, ExtUtil *extutil) { pauseval = 1; ShellToDos(cmdline, "", - extutil->options & EXTUTIL_CLS ? LGREY|_BLACK : 0, + extutil->options & EXTUTIL_CLS ? LGREY|_BLACK : BLACK|_BLACK, extutil->options & EXTUTIL_CURSOR, pauseval ); @@ -777,7 +777,7 @@ void ReadPeekURLs(GMsg* msg) { pauseval = 1; ShellToDos(cmdline, "", - CFG->urlhandler.options & EXTUTIL_CLS ? LGREY|_BLACK : 0, + CFG->urlhandler.options & EXTUTIL_CLS ? LGREY|_BLACK : BLACK|_BLACK, CFG->urlhandler.options & EXTUTIL_CURSOR, pauseval ); @@ -827,7 +827,7 @@ void UUDecode(GMsg* msg) { SaveLines(overwrite ? MODE_WRITE : MODE_APPEND, infile, msg, 79); } if(AA->Mark.Count()) - w_progress(MODE_QUIT, 0, 0, 0, NULL); + w_progress(MODE_QUIT, BLACK|_BLACK, 0, 0, NULL); } else if(source == WRITE_CURRENT) { AA->LoadMsg(msg, msg->msgno, 79); @@ -903,7 +903,7 @@ void Make_Userlist(const char* userlist) { } } throw_free(crclist); - w_progress(MODE_QUIT, 0, 0, 0, NULL); + w_progress(MODE_QUIT, BLACK|_BLACK, 0, 0, NULL); fclose(fp); } @@ -982,7 +982,7 @@ void make_pathreport(const char* reportfile) { fp.printf("%s\n", path.c_str()); } } - w_progress(MODE_QUIT, 0, 0, 0, NULL); + w_progress(MODE_QUIT, BLACK|_BLACK, 0, 0, NULL); fp.fclose(); ResetMsg(msg); throw_free(msg); diff --git a/golded3/gesrch.cpp b/golded3/gesrch.cpp index 8185e2d..a7d4c8d 100644 --- a/golded3/gesrch.cpp +++ b/golded3/gesrch.cpp @@ -429,9 +429,9 @@ void search_mgr_form::select(gstrarray& menu, const char* title) { GMnu m; m.Init(); - m.SetColor(7, 7, 7, 112, 8); - m.SetTitle(title, 14); - m.SetBorder(0, 7); + m.SetColor(LGREY, LGREY, LGREY, _LGREY, DGREY); + m.SetTitle(title, YELLOW); + m.SetBorder(0, LGREY); m.SetPos(srow, scol); m.SetMask(0); m.Begin(); @@ -520,20 +520,20 @@ bool search_mgr_form::validate() { void AdvancedSearch(GMsg*, int&, int&) { - int patterns = 9; - int width = 77; - int height = patterns+11; - int widths[3] = { 55, 5, 7 }; - int field_widths[3] = { 100, 5, 7 }; - int border_type = BT_SINGLE; - int title_color = YELLOW | _BLUE; - int heading_color = YELLOW | _BLUE; - int window_color = LGREY | _BLUE; - int border_color = LBLUE | _BLUE; - int edit_color = YELLOW | _BLUE; - int idle_color = LGREY | _BLUE; - int active_color = WHITE | _BLUE; - int shadow_color = DGREY | _BLACK; + int patterns = 9; + int width = 77; + int height = patterns+11; + int widths[3] = { 55, 5, 7 }; + int field_widths[3] = { 100, 5, 7 }; + int border_type = BT_SINGLE; + vattr title_color = YELLOW | _BLUE; + vattr heading_color = YELLOW | _BLUE; + vattr window_color = LGREY | _BLUE; + vattr border_color = LBLUE | _BLUE; + vattr edit_color = YELLOW | _BLUE; + vattr idle_color = LGREY | _BLUE; + vattr active_color = WHITE | _BLUE; + vattr shadow_color = DGREY | _BLACK; widths[0] = width - 3*2 - 2 - 5 - 7 - 2; diff --git a/golded3/geusrbse.cpp b/golded3/geusrbse.cpp index d0c64d2..c0896ef 100644 --- a/golded3/geusrbse.cpp +++ b/golded3/geusrbse.cpp @@ -167,7 +167,7 @@ void guserbase::unlock() { void guserbase::open() { - window.openxy(ypos, xpos, ylen+2, xlen+2, btype, battr, 7); + window.openxy(ypos, xpos, ylen+2, xlen+2, btype, battr, LGREY); cwidth = (xlen-28) / 2; window.message(LNG->UserHeaderName, TP_BORD, 3, tattr); diff --git a/golded3/geutil.cpp b/golded3/geutil.cpp index 3cc4929..23109dc 100644 --- a/golded3/geutil.cpp +++ b/golded3/geutil.cpp @@ -253,7 +253,7 @@ void w_infof(const char* format, ...) { // ------------------------------------------------------------------ -void w_progress(int mode, int attr, long pos, long size, const char* title) { +void w_progress(int mode, vattr attr, long pos, long size, const char* title) { static int wh = -1; static long prev_pos = 0; @@ -313,7 +313,7 @@ int maketitle_and_status(char *dir) { // ------------------------------------------------------------------ -void set_title(const char* t, int p, int a) { +void set_title(const char* t, int p, vattr a) { strcpy(m_title, t); m_titlepos = p; @@ -490,7 +490,7 @@ bool is_quote2(Line* line, const char* ptr) // ------------------------------------------------------------------ -int quotecolor(const char* line) { +vattr quotecolor(const char* line) { char buf[MAXQUOTELEN]; uint len; diff --git a/golded3/geutil2.cpp b/golded3/geutil2.cpp index 4e433dd..3c8171b 100644 --- a/golded3/geutil2.cpp +++ b/golded3/geutil2.cpp @@ -283,9 +283,9 @@ void ScreenBlankIdle() { if(blanked and (whb == -1)) { wascurhid = vcurhidden(); vcurhide(); - if(C_BACKB != 0) - gvid->setoverscan(0); - whb = wopen(0,0,MAXROW-1,MAXCOL-1, 5, 7, 7); + if (C_BACKB != (BLACK|_BLACK)) + gvid->setoverscan(BLACK|_BLACK); + whb = wopen(0,0,MAXROW-1,MAXCOL-1, 5, LGREY, LGREY); if(CFG->screenblankertype == BLANK_SLIDEWIN) whh = wopen_(ry, rx, windowheight, blankmsglen+2, W_BINFO, C_INFOB, C_INFOW); lastmoved = gkbd.tickvalue; @@ -300,7 +300,7 @@ void ScreenBlankIdle() { wactiv_(whb); wclose(); whb = -1; - if(C_BACKB != 0) + if (C_BACKB != (BLACK|_BLACK)) gvid->setoverscan(C_BACKB); if(wascurhid) vcurhide(); @@ -330,7 +330,7 @@ void ScreenBlankIdle() { // ------------------------------------------------------------------ -int GetColorName(const char *name, Addr &addr, int color) +vattr GetColorName(const char *name, Addr &addr, vattr color) { bool addr_valid = addr.valid(); bool name_valid = (name != NULL); @@ -338,7 +338,7 @@ int GetColorName(const char *name, Addr &addr, int color) if (!addr_valid && !name_valid) return color; - std::vector< std::pair >::iterator it; + std::vector< std::pair >::iterator it; for (it = CFG->colorname.begin(); it != CFG->colorname.end(); it++) { if (addr_valid && addr.match(it->first.addr)) diff --git a/golded3/geview.cpp b/golded3/geview.cpp index a52f8b3..9062eba 100644 --- a/golded3/geview.cpp +++ b/golded3/geview.cpp @@ -214,7 +214,7 @@ void GMsgHeaderView::Paint() { strsetsz(buf, nodegenerated ? namewidth : (namewidth+nodewidth)); window.prints(2, 0, window_color, LNG->From); - int color = ((msg->foundwhere&GFIND_FROM) or msg->attr.fmu() or (msg->attr.loc() and CFG->switches.get(displocalhigh))) ? highlight_color : from_color; + vattr color = ((msg->foundwhere&GFIND_FROM) or msg->attr.fmu() or (msg->attr.loc() and CFG->switches.get(displocalhigh))) ? highlight_color : from_color; color = GetColorName(msg->By(), msg->orig, color); window.prints(2, CFG->disphdrnameset.pos, color, buf); @@ -451,7 +451,7 @@ void GMsgBodyView::Use(Area *areaptr, GMsg *msgptr, int startline) { scrollbar_visible = CFG->switches.get(disppagebar) ? (msg->lines > height) : false; visible_width = scrollbar_visible ? width-1 : width; - window.set_scrollbar_color(scrollbar_visible ? scrollbar_color : -1); + window.set_scrollbar_color(scrollbar_visible ? scrollbar_color : DEFATTR); } @@ -463,7 +463,7 @@ void GMsgBodyView::PaintLine(int row, Line *line) { int vrow = gwin.active->srow + row; uint llen = line->txt.length(); - int color = (line->type & GLINE_HIGH) ? highlight_color : line->color; + vattr color = (line->type & GLINE_HIGH) ? highlight_color : line->color; // Trim line if it longer than should be. This actually happens in very rare // cases, but always when hex dump displayed. @@ -475,16 +475,16 @@ void GMsgBodyView::PaintLine(int row, Line *line) { // Print it if(not SearchHighlight(line, vrow, visible_width, highlight_color)) { if(line->type & GLINE_ORIG and strneql(line->txt.c_str(), " * Origin: ", 11)) { - vputs(vrow, 0, color, " * Origin: "); + prints(vrow, 0, color, " * Origin: "); StyleCodeHighlight(line->txt.c_str()+11, vrow, 11, not AA->attr().hex() and AA->adat->hidestylies, color); } else StyleCodeHighlight(line->txt.c_str(), vrow, 0, not AA->attr().hex() and AA->adat->hidestylies, color); int tlen = strlen(line->txt.c_str()); - vputns(vrow, tlen, color, "", visible_width-tlen); + printns(vrow, tlen, color, "", visible_width-tlen); } else - vputns(vrow, 0, color, line->txt.c_str(), visible_width); + printns(vrow, 0, color, line->txt.c_str(), visible_width); } @@ -676,11 +676,18 @@ void GMsgBodyView::UpdateScrollbar() { // ------------------------------------------------------------------ -void GMsgBodyView::prints(int wrow, int wcol, int atr, const char* str) { - +void GMsgBodyView::prints(int wrow, int wcol, vattr atr, const char* str) +{ vputs(wrow, wcol, atr, str); } // ------------------------------------------------------------------ +void GMsgBodyView::printns(int wrow, int wcol, vattr atr, const char* str, uint len) +{ + vputns(wrow, wcol, atr, str, len); +} + + +// ------------------------------------------------------------------ diff --git a/golded3/geview.h b/golded3/geview.h index 6a61e47..b5a801e 100644 --- a/golded3/geview.h +++ b/golded3/geview.h @@ -45,20 +45,20 @@ public: ~GMsgHeaderView(); // Window setup - int at_row; - int at_column; - int width; - int height; - int border_type; - int border_color; - int window_color; - int title_color; + int at_row; + int at_column; + int width; + int height; + int border_type; + vattr border_color; + vattr window_color; + vattr title_color; - int highlight_color; - int from_color; - int to_color; - int subject_color; - int location_color; + vattr highlight_color; + vattr from_color; + vattr to_color; + vattr subject_color; + vattr location_color; void Use(Area *areaptr, GMsg *msgptr); @@ -87,7 +87,8 @@ protected: void PaintLine(int row, Line *line); void UpdateScrollbar(); - void prints(int wrow, int wcol, int atr, const char* str); + void prints(int wrow, int wcol, vattr atr, const char* str); + void printns(int wrow, int wcol, vattr atr, const char* str, uint len); public: @@ -99,16 +100,15 @@ public: ~GMsgBodyView(); // Window setup - int at_row; - int at_column; - int width; - int height; - int border_type; - int border_color; - int window_color; - int scrollbar_color; - - int highlight_color; + int at_row; + int at_column; + int width; + int height; + int border_type; + vattr border_color; + vattr window_color; + vattr scrollbar_color; + vattr highlight_color; void Use(Area *areaptr, GMsg *msgptr, int startline=0); diff --git a/goldlib/gall/gmnubase.h b/goldlib/gall/gmnubase.h index ed01e83..c752f6d 100644 --- a/goldlib/gall/gmnubase.h +++ b/goldlib/gall/gmnubase.h @@ -46,23 +46,23 @@ class GMnu { protected: - int bordertype; - int bordercolor; + int bordertype; + vattr bordercolor; - int textcolor; - int quickcolor; - int noselcolor; - int barcolor; - int shadowcolor; + vattr textcolor; + vattr quickcolor; + vattr noselcolor; + vattr barcolor; + vattr shadowcolor; const char* title; - int titlepos; - int titlecolor; + int titlepos; + vattr titlecolor; - int deschdl; - int descrow; - int desccolumn; - int desccolor; + int deschdl; + int descrow; + int desccolumn; + vattr desccolor; int helpnumber; @@ -95,11 +95,11 @@ public: void Init(); - void SetBorder(int type, int color); - void SetColor(int text, int quick, int nosel, int bar, int shadow=-1); - void SetTitle(const char* title, int color, int pos=TCENTER); + void SetBorder(int type, vattr color); + void SetColor(vattr text, vattr quick, vattr nosel, vattr bar, vattr shadow = DEFATTR); + void SetTitle(const char* title, vattr color, int pos=TCENTER); void SetTitle(const char* title); - void SetDesc(int hdl, int row, int col, int color); + void SetDesc(int hdl, int row, int col, vattr color); void SetPos(int row, int col, int width=0, int height=0); void SetEsc(int option); void SetHelp(int help); diff --git a/goldlib/gall/gvidall.h b/goldlib/gall/gvidall.h index a3061f8..f402039 100644 --- a/goldlib/gall/gvidall.h +++ b/goldlib/gall/gvidall.h @@ -31,6 +31,7 @@ // ------------------------------------------------------------------ + #include #if defined(__USE_NCURSES__) #include @@ -38,11 +39,97 @@ #if defined(__WIN32__) #include #endif + #if defined(_MSC_VER) #pragma warning(disable: 4200) #endif +// ------------------------------------------------------------------ + +#ifdef BLINK +#undef BLINK +#endif +#define BLINK 128 + +#ifdef INTENSE +#undef INTENSE +#endif +#define INTENSE 8 + +#if defined(__UNIX__) && !defined(__USE_NCURSES__) +#define ACSET BLINK +#else +#define ACSET 0 +#endif + + +// ------------------------------------------------------------------ + +#if defined(__USE_NCURSES__) +typedef chtype vchar; // Type of characters on-screen +typedef int vattr; // Type of screen attributes +typedef chtype vatch; // Type of character-attribute groups +#elif defined(__WIN32__) +typedef char vchar; // Type of characters on-screen +typedef int vattr; // Type of screen attributes +typedef CHAR_INFO vatch; // Type of character-attribute groups +#else +typedef char vchar; // Type of characters on-screen +typedef int vattr; // Type of screen attributes +typedef word vatch; // Type of character-attribute groups +#endif + + +// ------------------------------------------------------------------ +// Attribute codes for functions that use them + +const vattr DEFATTR = -1; + +const vattr BLACK = 0; +const vattr BLUE = 1; +const vattr GREEN = 2; +const vattr CYAN = 3; +const vattr RED = 4; +const vattr MAGENTA = 5; +const vattr BROWN = 6; +const vattr LGREY = 7; +const vattr DGREY = 8; +const vattr LBLUE = 9; +const vattr LGREEN = 10; +const vattr LCYAN = 11; +const vattr LRED = 12; +const vattr LMAGENTA = 13; +const vattr YELLOW = 14; +const vattr WHITE = 15; + +const vattr _BLACK = (BLACK << 4); +const vattr _BLUE = (BLUE << 4); +const vattr _GREEN = (GREEN << 4); +const vattr _CYAN = (CYAN << 4); +const vattr _RED = (RED << 4); +const vattr _MAGENTA = (MAGENTA << 4); +const vattr _BROWN = (BROWN << 4); +const vattr _LGREY = (LGREY << 4); +const vattr _DGREY = (DGREY << 4); +const vattr _LBLUE = (LBLUE << 4); +const vattr _LGREEN = (LGREEN << 4); +const vattr _LCYAN = (LCYAN << 4); +const vattr _LRED = (LRED << 4); +const vattr _LMAGENTA = (LMAGENTA << 4); +const vattr _YELLOW = (YELLOW << 4); +const vattr _WHITE = (WHITE << 4); + + +// ------------------------------------------------------------------ +// Additional monochrome color values + +const vattr UNDERLINE = 1; +const vattr NORMAL = 7; +const vattr HIGHLIGHT = 15; +const vattr REVERSE = 112; + + // ------------------------------------------------------------------ // Display adapter types returned from vidtype() // If bit 0 is set, the adapter was detected in monochrome mode @@ -145,68 +232,6 @@ struct __int10_ah1b_statebuf { #endif -// ------------------------------------------------------------------ -// Attribute codes for functions that use them - -#define BLACK 0 -#define BLUE 1 -#define GREEN 2 -#define CYAN 3 -#define RED 4 -#define MAGENTA 5 -#define BROWN 6 -#define LGREY 7 -#define DGREY 8 -#define LBLUE 9 -#define LGREEN 10 -#define LCYAN 11 -#define LRED 12 -#define LMAGENTA 13 -#define YELLOW 14 -#define WHITE 15 - -#define _BLACK (BLACK << 4) -#define _BLUE (BLUE << 4) -#define _GREEN (GREEN << 4) -#define _CYAN (CYAN << 4) -#define _RED (RED << 4) -#define _MAGENTA (MAGENTA << 4) -#define _BROWN (BROWN << 4) -#define _LGREY (LGREY << 4) -#define _DGREY (DGREY << 4) -#define _LBLUE (LBLUE << 4) -#define _LGREEN (LGREEN << 4) -#define _LCYAN (LCYAN << 4) -#define _LRED (LRED << 4) -#define _LMAGENTA (LMAGENTA << 4) -#define _YELLOW (YELLOW << 4) -#define _WHITE (WHITE << 4) - -#ifdef BLINK -#undef BLINK -#endif -#define BLINK 128 -#ifdef INTENSE -#undef INTENSE -#endif -#define INTENSE 8 - -#if defined(__UNIX__) && !defined(__USE_NCURSES__) -#define ACSET BLINK -#else -#define ACSET 0 -#endif - - -// ------------------------------------------------------------------ -// Additional monochrome color values - -#define UNDERLINE 1 -#define NORMAL 7 -#define HIGHLIGHT 15 -#define REVERSE 112 - - // ------------------------------------------------------------------ // Border types @@ -226,29 +251,32 @@ struct __int10_ah1b_statebuf { struct GVidInfo { // Screen info - struct { - int mode; // Video mode - int rows; // Number of rows - int columns; // Number of columns - int cheight; // Character height - int cwidth; // Character width + struct _screen + { + int mode; // Video mode + int rows; // Number of rows + int columns; // Number of columns + int cheight; // Character height + int cwidth; // Character width } screen; // Cursor info - struct { - int column; // Cursor column - int row; // Cursor row - int start; // Cursor start line - int end; // Cursor end line - word attr; // Cursor attribute. Hidden if attr == 0xFFFF + struct _cursor + { + int column; // Cursor column + int row; // Cursor row + int start; // Cursor start line + int end; // Cursor end line + word attr; // Cursor attribute. Hidden if attr == 0xFFFF } cursor; // Colors - struct { - int textattr; // Text attribute - int overscan; // Overscan color - int intensity; // Background color state (intense or blinking) - int palette[16]; // Palette state + struct _color + { + vattr textattr; // Text attribute + vattr overscan; // Overscan color + int intensity; // Background color state (intense or blinking) + int palette[16]; // Palette state } color; }; @@ -261,19 +289,6 @@ typedef uint32_t gdma; // Video DMA linear address typedef word* gdma; // Video DMA pointer #endif -// ------------------------------------------------------------------ - -#if defined(__USE_NCURSES__) -typedef chtype vchar; // Type of characters on-screen -typedef chtype vatch; // Type of character-attribute groups -#elif defined(__WIN32__) -typedef char vchar; // Type of characters on-screen -typedef CHAR_INFO vatch; // Type of character-attribute groups -#else -typedef char vchar; // Type of characters on-screen -typedef word vatch; // Type of character-attribute groups -#endif - // ------------------------------------------------------------------ // Video information record @@ -322,7 +337,7 @@ public: void setmode (int _mode); void setrows (int _rows); - void setoverscan (int _overscan); + void setoverscan (vattr _overscan); void setintensity (int _intensity); void getpalette (int* _palette); @@ -361,31 +376,31 @@ chtype _box_table(int type, int c); int setvparam (int setting); -int mapattr (int attr); -int revsattr (int attr); +vattr mapattr (vattr attr); +vattr revsattr (vattr attr); -inline int attrib(int f, int b, int i, int bl) { return (int)((b<<4)|(f)|(i<<3)|(bl<<7)); } +inline vattr attrib(int f, int b, int i, int bl) { return (int)((b<<4)|(f)|(i<<3)|(bl<<7)); } void vputw (int row, int col, vatch chat); void vputws (int row, int col, vatch* buf, uint len); -void vputc (int row, int col, int atr, vchar chr); -void vputvs (int row, int col, int atr, const vchar* str); -void vputs (int row, int col, int atr, const char* str); -void vputs_box (int row, int col, int atr, const char* str); -void vputns (int row, int col, int atr, const char* str, uint len); -void vputx (int row, int col, int atr, vchar chr, uint len); -void vputy (int row, int col, int atr, vchar chr, uint len); +void vputc (int row, int col, vattr atr, vchar chr); +void vputvs (int row, int col, vattr atr, const vchar* str); +void vputs (int row, int col, vattr atr, const char* str); +void vputs_box (int row, int col, vattr atr, const char* str); +void vputns (int row, int col, vattr atr, const char* str, uint len); +void vputx (int row, int col, vattr atr, vchar chr, uint len); +void vputy (int row, int col, vattr atr, vchar chr, uint len); vatch vgetw (int row, int col); -void vgetc (int row, int col, int* atr, vchar* chr); +void vgetc (int row, int col, vattr* atr, vchar* chr); -void vscroll (int srow, int scol, int erow, int ecol, int atr, int lines); +void vscroll (int srow, int scol, int erow, int ecol, vattr atr, int lines); void vposget (int* row, int* col); void vposset (int row, int col); void vclrscr (); -void vclrscr (int atr); // Overloaded +void vclrscr (vattr atr); // Overloaded typedef struct _vsavebuf { int top, left, right, bottom; @@ -404,19 +419,9 @@ bool vcurhidden (); void vcurlarge (); void vcursmall (); -void vbox (int srow, int scol, int erow, int ecol, int box, int hiattr, int loattr=-1); -void vfill (int srow, int scol, int erow, int ecol, vchar chr, int atr); +void vbox (int srow, int scol, int erow, int ecol, int box, vattr hiattr, vattr loattr = DEFATTR); +void vfill (int srow, int scol, int erow, int ecol, vchar chr, vattr atr); -vchar vgetc (int row, int col); // Gets the character from position -vchar vgchar (vatch chat); // Gets the character part of a character-attribute group -int vgattr (vatch chat); // Gets the attribute part of a character-attribute group -vatch vschar (vatch chat, vchar chr); // Sets the given character in a character-attribute group -vatch vsattr (vatch chat, int atr); // Sets the given attribute in a character-attribute group -vatch vcatch (vchar chr, int atr); // Compose character-attribute group from character and attribute - -// inline implementation of functions above - -inline vchar vgetc (int row, int col) { return vgchar(vgetw(row, col)); } #if defined(__USE_NCURSES__) @@ -424,29 +429,31 @@ int gvid_dosattrcalc (int ourattr); int gvid_attrcalc (int dosattr); inline vchar vgchar (vatch chat) { return chat & (A_CHARTEXT | A_ALTCHARSET); } -inline int vgattr (vatch chat) { return gvid_dosattrcalc(chat & ~(A_CHARTEXT | A_ALTCHARSET)); } +inline vattr vgattr (vatch chat) { return gvid_dosattrcalc(chat & ~(A_CHARTEXT | A_ALTCHARSET)); } inline vatch vschar (vatch chat, vchar chr) { return (chr & (A_CHARTEXT | A_ALTCHARSET)) | (chat & ~(A_CHARTEXT | A_ALTCHARSET)); } -inline vatch vsattr (vatch chat, int atr) { return (chat & (A_CHARTEXT | A_ALTCHARSET)) | gvid_attrcalc(atr); } -inline vatch vcatch (vchar chr, int atr) { return chr | gvid_attrcalc(atr); } +inline vatch vsattr (vatch chat, vattr atr) { return (chat & (A_CHARTEXT | A_ALTCHARSET)) | gvid_attrcalc(atr); } +inline vatch vcatch (vchar chr, vattr atr) { return chr | gvid_attrcalc(atr); } #elif defined(__WIN32__) inline vchar vgchar (vatch chat) { return chat.Char.AsciiChar; } -inline int vgattr (vatch chat) { return chat.Attributes; } +inline vattr vgattr (vatch chat) { return chat.Attributes; } inline vatch vschar (vatch chat, vchar chr) { chat.Char.UnicodeChar = 0; chat.Char.AsciiChar = chr; return chat; } -inline vatch vsattr (vatch chat, int atr) { chat.Attributes = atr; return chat; } -inline vatch vcatch (vchar chr, int atr) { vatch chat; chat.Char.UnicodeChar = 0; chat.Char.AsciiChar = chr; chat.Attributes = atr; return chat; } +inline vatch vsattr (vatch chat, vattr atr) { chat.Attributes = atr; return chat; } +inline vatch vcatch (vchar chr, vattr atr) { vatch chat; chat.Char.UnicodeChar = 0; chat.Char.AsciiChar = chr; chat.Attributes = atr; return chat; } #else inline vchar vgchar (vatch chat) { return chat & 0xff; } -inline int vgattr (vatch chat) { return (chat >> 8) & 0xff; } +inline vattr vgattr (vatch chat) { return (chat >> 8) & 0xff; } inline vatch vschar (vatch chat, vchar chr) { return (chat & 0xff00) | chr; } -inline vatch vsattr (vatch chat, int atr) { return (chat & 0xff) | (atr << 8); } -inline vatch vcatch (vchar chr, int atr) { return (chr & 0xff) | ((atr << 8) & 0xff00); } +inline vatch vsattr (vatch chat, vattr atr) { return (chat & 0xff) | (atr << 8); } +inline vatch vcatch (vchar chr, vattr atr) { return (chr & 0xff) | ((atr << 8) & 0xff00); } #endif +inline vchar vgetc (int row, int col) { return vgchar(vgetw(row, col)); } + typedef void (*VidPutStrCP)(int,int,int,const char*); void gvid_boxcvt(char* s); diff --git a/goldlib/gall/gvidbase.cpp b/goldlib/gall/gvidbase.cpp index b4da147..9e454e1 100644 --- a/goldlib/gall/gvidbase.cpp +++ b/goldlib/gall/gvidbase.cpp @@ -365,8 +365,8 @@ void vputansi(int row, int col, word* buf, int len) { // ------------------------------------------------------------------ // Converts an attribute to monochrome equivalent -int mapattr(int attr) { - +vattr mapattr(vattr attr) +{ switch(attr&112) { // test for a light background case _LGREY: @@ -391,9 +391,9 @@ int mapattr(int attr) { // ------------------------------------------------------------------ // Reverses the attribute given -int revsattr(int attr) { - - return (int)(((attr>>4)&0x07)|((attr<<4)&0x70)|(attr&0x80)|(attr&0x08)); +vattr revsattr(vattr attr) +{ + return (vattr)(((attr>>4)&0x07)|((attr<<4)&0x70)|(attr&0x80)|(attr&0x08)); } #if !defined(__USE_NCURSES__) @@ -714,7 +714,7 @@ void vputws(int row, int col, vatch* buf, uint len) { // ------------------------------------------------------------------ // Print character and attribute at specfied location -void vputc(int row, int col, int atr, vchar chr) { +void vputc(int row, int col, vattr atr, vchar chr) { #if defined(__USE_NCURSES__) @@ -760,7 +760,7 @@ void vputc(int row, int col, int atr, vchar chr) { // ------------------------------------------------------------------ // Print string with attribute at specfied location -void vputvs(int row, int col, int atr, const vchar* str) { +void vputvs(int row, int col, vattr atr, const vchar* str) { #if defined(__USE_NCURSES__) @@ -782,7 +782,7 @@ void vputvs(int row, int col, int atr, const vchar* str) { // ------------------------------------------------------------------ // Print string with attribute at specfied location -void vputs_box(int row, int col, int atr, const char* str) { +void vputs_box(int row, int col, vattr atr, const char* str) { #if defined(__USE_NCURSES__) uint counter; int len = strlen(str); @@ -796,7 +796,7 @@ void vputs_box(int row, int col, int atr, const char* str) { #endif } -void vputs(int row, int col, int atr, const char* str) { +void vputs(int row, int col, vattr atr, const char* str) { #if defined(__USE_NCURSES__) @@ -889,7 +889,7 @@ static void _vputns(int row, int col, int atr, const char* str, uint width) { // ------------------------------------------------------------------ // Print string with attribute at specfied location -void vputns(int row, int col, int atr, const char* str, uint width) { +void vputns(int row, int col, vattr atr, const char* str, uint width) { char fillchar = ' '; @@ -1004,7 +1004,7 @@ void _vputx(int row, int col, int atr, char chr, uint len) { // ------------------------------------------------------------------ // Print horizontal line of character and attribute -void vputx(int row, int col, int atr, vchar chr, uint len) { +void vputx(int row, int col, vattr atr, vchar chr, uint len) { #if defined(__USE_NCURSES__) @@ -1080,7 +1080,7 @@ inline void _vputy(int row, int col, int atr, char chr, uint len) { // ------------------------------------------------------------------ // Print vertical line of character and attribute -void vputy(int row, int col, int atr, vchar chr, uint len) { +void vputy(int row, int col, vattr atr, vchar chr, uint len) { #if defined(__USE_NCURSES__) @@ -1224,11 +1224,11 @@ vatch vgetw(int row, int col) { // ------------------------------------------------------------------ // Get character and attribute at cursor position -void vgetc(int row, int col, int* atr, vchar* chr) { +void vgetc(int row, int col, vattr* atr, vchar* chr) { if((row < 0) or (row > gvid->numrows-1) or (col < 0) or (col > gvid->numcols-1)) { *chr = ' '; - *atr = 0; + *atr = BLACK|_BLACK; } else { vatch tmp = vgetw(row, col); @@ -1285,7 +1285,7 @@ static void _vscroll(int srow, int scol, int erow, int ecol, int atr, int lines) // ------------------------------------------------------------------ // Scroll screen area -void vscroll(int srow, int scol, int erow, int ecol, int atr, int lines) { +void vscroll(int srow, int scol, int erow, int ecol, vattr atr, int lines) { #if defined(__USE_NCURSES__) @@ -1485,7 +1485,7 @@ void vclrscr() { // Clears the screen using given attribute and homes the cursor #if (defined(__MSDOS__) || defined(__UNIX__)) && !defined(__USE_NCURSES__) -static void _vclrscr(int atr) { +static void _vclrscr(vattr atr) { int len = gvid->numrows * gvid->numcols; @@ -1498,7 +1498,7 @@ static void _vclrscr(int atr) { // ------------------------------------------------------------------ // Clears the screen using given attribute and homes the cursor -void vclrscr(int atr) { +void vclrscr(vattr atr) { #if defined(__USE_NCURSES__) @@ -2147,9 +2147,9 @@ static uint32_t gvid_boxcvtc(char c) { // ------------------------------------------------------------------ // Draws a text box on the screen -void vbox(int srow, int scol, int erow, int ecol, int box, int hiattr, int loattr) { - - if(loattr == -1) +void vbox(int srow, int scol, int erow, int ecol, int box, vattr hiattr, vattr loattr) +{ + if (loattr == DEFATTR) loattr = hiattr; else if(loattr == -2) loattr = (int)((hiattr & 0x08) ? (hiattr & 0xF7) : (hiattr | 0x08)); @@ -2173,7 +2173,7 @@ void vbox(int srow, int scol, int erow, int ecol, int box, int hiattr, int loatt // ------------------------------------------------------------------ // Fills an area of screen with a character & attribute -void vfill(int srow, int scol, int erow, int ecol, vchar chr, int atr) { +void vfill(int srow, int scol, int erow, int ecol, vchar chr, vattr atr) { int width = ecol-scol+1; for(int crow=srow; crow<=erow; crow++) diff --git a/goldlib/gall/gvidinit.cpp b/goldlib/gall/gvidinit.cpp index 550c212..5e86e05 100644 --- a/goldlib/gall/gvidinit.cpp +++ b/goldlib/gall/gvidinit.cpp @@ -439,8 +439,8 @@ int GVid::detectadapter() { // ------------------------------------------------------------------ // Video info detect -void GVid::detectinfo(GVidInfo* _info) { - +void GVid::detectinfo(GVidInfo* _info) +{ // Reset all original values memset(_info, 0, sizeof(GVidInfo)); @@ -826,7 +826,7 @@ void GVid::setrows(int _rows) { #endif if(origrows < _rows) - vfill(origrows, 0, _rows, 80, ' ', 7); + vfill(origrows, 0, _rows, 80, ' ', LGREY); detectinfo(&curr); resetcurr(); @@ -836,8 +836,8 @@ void GVid::setrows(int _rows) { // ------------------------------------------------------------------ // Set the screen border (overscan) color -void GVid::setoverscan(int _overscan) { - +void GVid::setoverscan(vattr _overscan) +{ #if defined(__USE_NCURSES__) NW (_overscan); @@ -871,8 +871,8 @@ void GVid::setoverscan(int _overscan) { // ------------------------------------------------------------------ // Set intensity/blinking state -void GVid::setintensity(int _intensity) { - +void GVid::setintensity(int _intensity) +{ #if defined(__USE_NCURSES__) NW(_intensity); @@ -928,8 +928,8 @@ void GVid::setintensity(int _intensity) { // ------------------------------------------------------------------ -void GVid::getpalette(int* _palette) { - +void GVid::getpalette(int* _palette) +{ #if defined(__USE_NCURSES__) NW(_palette); @@ -977,8 +977,8 @@ void GVid::getpalette(int* _palette) { // ------------------------------------------------------------------ -void GVid::setpalette(int* _palette) { - +void GVid::setpalette(int* _palette) +{ #if defined(__USE_NCURSES__) NW(_palette); diff --git a/goldlib/gall/gwinall.h b/goldlib/gall/gwinall.h index d81dd03..8a88228 100644 --- a/goldlib/gall/gwinall.h +++ b/goldlib/gall/gwinall.h @@ -119,7 +119,7 @@ struct _item_t { int dwhdl; // description window handle int dwrow; // description window row int dwcol; // description window column - int dattr; // description attribute + vattr dattr; // description attribute int redisp; // redisplay flag }; @@ -141,21 +141,21 @@ struct _menu_t { int erow; // ending row of menu window int ecol; // ending column of menu window int btype; // menu window border type - int battr; // menu window "hi" border attribute - int loattr; // menu window "lo" border attribute - int sbattr; // menu window scrollbar attribute - int wattr; // menu window attribute + vattr battr; // menu window "hi" border attribute + vattr loattr; // menu window "lo" border attribute + vattr sbattr; // menu window scrollbar attribute + vattr wattr; // menu window attribute int menutype; // menu type mask int barwidth; // width of menu bar or zero int textpos; // offset of text from start of bar - int textattr; // attribute of menu text - int scharattr; // attribute of selection character - int noselattr; // non-selectable text attribute - int barattr; // attribute of selection bar + vattr textattr; // attribute of menu text + vattr scharattr; // attribute of selection character + vattr noselattr; // non-selectable text attribute + vattr barattr; // attribute of selection bar const char* title; // menu title string or NULL if no title int titlepos; // position of menu title (TLEFT,TCENTER,TRIGHT) - int titleattr; // attribute of menu title - int shadattr; // shadow attribute or -1 if no shadow + vattr titleattr; // attribute of menu title + vattr shadattr; // shadow attribute or -1 if no shadow int items; // number of items in menu bool hotkey; }; @@ -226,17 +226,17 @@ struct _wrec_t { int erow; // end row of window int ecol; // end column of window int btype; // window's box type - int wattr; // window's initial text attribute - int battr; // attribute of window's border - int loattr; // attribute of window's border - int sbattr; // attribute of window's scrollbar + vattr wattr; // window's initial text attribute + vattr battr; // attribute of window's border + vattr loattr; // attribute of window's border + vattr sbattr; // attribute of window's scrollbar int border; // has border? 0 = no, 1 = yes int row; // window's current cursor row int column; // window's current cursor column - int attr; // window's current text attribute + vattr attr; // window's current text attribute int tpos; // position of window's title - int tattr; // attribute of window's title - int wsattr; // attribute of window's shadow + vattr tattr; // attribute of window's title + vattr wsattr; // attribute of window's shadow }; @@ -345,8 +345,8 @@ int wactiv (int whandle); int wactiv_ (int whandle); int wborder (int btype); int wbox (int wsrow, int wscol, int werow, int wecol, int btype, int attr); -int wcclear (int attr); -int wcenters (int wrow, int attr, const char* str); +int wcclear (vattr attr); +int wcenters (int wrow, vattr attr, const char* str); int wchkbox (int wsrow, int wscol, int werow, int wecol); int wchkcol (int wcol); int wchkcoord (int wrow, int wcol); @@ -359,55 +359,55 @@ int wcopy (int nsrow, int nscol); int wdelline (int wrow, int direc); int wdrag (int direction); int wdupc (char ch, int count); -int wfill (int wsrow, int wscol, int werow, int wecol, vchar ch, int attr); +int wfill (int wsrow, int wscol, int werow, int wecol, vchar ch, vattr attr); _wrec_t* wfindrec (int whandle); int wgotoxy (int wrow, int wcol); int whandle (); int whide (); -int whline (int wsrow, int wscol, int count, int btype, int attr); -int wmessage (const char* str, int border, int leftofs, int attr); +int whline (int wsrow, int wscol, int count, int btype, vattr attr); +int wmessage (const char* str, int border, int leftofs, vattr attr); int wmove (int nsrow, int nscol); -int wopen (int srow, int scol, int erow, int ecol, int btype, int battr, int wattr, int sbattr=-1, int loattr=-1); -inline int wopen_ (int srow, int scol, int vlen, int hlen, int btype, int battr, int wattr, int sbattr=-1, int loattr=-1) { return wopen(srow, scol, srow+vlen-1, scol+hlen-1, btype, battr, wattr, sbattr, loattr); } +int wopen (int srow, int scol, int erow, int ecol, int btype, vattr battr, vattr wattr, vattr sbattr = DEFATTR, vattr loattr = DEFATTR); +inline int wopen_ (int srow, int scol, int vlen, int hlen, int btype, vattr battr, vattr wattr, vattr sbattr = DEFATTR, vattr loattr = DEFATTR) { return wopen(srow, scol, srow+vlen-1, scol+hlen-1, btype, battr, wattr, sbattr, loattr); } int wperror (const char* message); -bool wpickfile (int srow, int scol, int erow, int ecol, int btype, int bordattr, int winattr, int barattr, bool title, std::string &filespec, IfcpCP open, bool casesens=false); -int wpickstr (int srow, int scol, int erow, int ecol, int btype, int bordattr, int winattr, int barattr, char* strarr[], int initelem, VfvCP open); -int wprintc (int wrow, int wcol, int attr, vchar ch); +bool wpickfile (int srow, int scol, int erow, int ecol, int btype, vattr bordattr, vattr winattr, vattr barattr, bool title, std::string &filespec, IfcpCP open, bool casesens=false); +int wpickstr (int srow, int scol, int erow, int ecol, int btype, vattr bordattr, vattr winattr, vattr barattr, char* strarr[], int initelem, VfvCP open); +int wprintc (int wrow, int wcol, vattr attr, vchar ch); int wprintf (const char* format, ...) __attribute__ ((format (printf, 1, 2))); int wprintaf (int attr, const char* format, ...) __attribute__ ((format (printf, 2, 3))); -int wprintfs (int wrow, int wcol, int attr, const char* format, ...) __attribute__ ((format (printf, 4, 5))); -int wprints (int wrow, int wcol, int attr, const char* str); -int wprints_box (int wrow, int wcol, int attr, const char* str); -int wprintvs (int wrow, int wcol, int attr, const vchar* str); -int wprintns (int wrow, int wcol, int attr, const char* str, uint len, vchar fill=' ', int fill_attr=-1); -int wprintsf (int wrow, int wcol, int attr, const char* format, const char* str); +int wprintfs (int wrow, int wcol, vattr attr, const char* format, ...) __attribute__ ((format (printf, 4, 5))); +int wprints (int wrow, int wcol, vattr attr, const char* str); +int wprints_box (int wrow, int wcol, vattr attr, const char* str); +int wprintvs (int wrow, int wcol, vattr attr, const vchar* str); +int wprintns (int wrow, int wcol, vattr attr, const char* str, uint len, vchar fill=' ', vattr fill_attr = DEFATTR); +int wprintsf (int wrow, int wcol, vattr attr, const char* format, const char* str); int wprintws (int wrow, int wcol, vatch* buf, uint len); -void wpropbar (int xx, int yy, long len, int attr, long pos, long size); +void wpropbar (int xx, int yy, long len, vattr attr, long pos, long size); int wputc (vchar ch); int wputs (const char* str); -int wputx (int wrow, int wcol, int attr, vchar chr, uint len); -int wputy (int wrow, int wcol, int attr, vchar chr, uint len); +int wputx (int wrow, int wcol, vattr attr, vchar chr, uint len); +int wputy (int wrow, int wcol, vattr attr, vchar chr, uint len); int wreadcur (int* wrow, int* wcol); int wscroll (int count, int direc); void wscrollbar (int orientation, uint total, uint maxpos, uint pos, int sadd=0); int wscrollbox (int wsrow, int wscol, int werow, int wecol, int count, int direction); int wshadoff (); -int wshadow (int attr); +int wshadow (vattr attr); int wsize (int nerow, int necol); int wslide (int nsrow, int nscol); -void wtextattr (int attr); -int wtitle (const char* str, int tpos, int tattr); +void wtextattr (vattr attr); +int wtitle (const char* str, int tpos, vattr tattr); int wunhide (int whandle); int wunlink (int w); -int wvline (int wsrow, int wscol, int count, int btype, int attr); -int wwprintc (int whandle, int wrow, int wcol, int attr, const vchar chr); -int wwprints (int whandle, int wrow, int wcol, int attr, const char* str); -int wwprintstr (int whandle, int wrow, int wcol, int attr, const char* str); +int wvline (int wsrow, int wscol, int count, int btype, vattr attr); +int wwprintc (int whandle, int wrow, int wcol, vattr attr, const vchar chr); +int wwprints (int whandle, int wrow, int wcol, vattr attr, const char* str); +int wwprintstr (int whandle, int wrow, int wcol, vattr attr, const char* str); -int wmenubeg (int srow, int scol, int erow, int ecol, int btype, int battr, int wattr, VfvCP open, int menutype=M_VERT); -inline int wmenubeg_ (int srow, int scol, int vlen, int hlen, int btype, int battr, int wattr, VfvCP open, int menutype=M_VERT) { return wmenubeg(srow, scol, srow+vlen-1, scol+hlen-1, btype, battr, wattr, open, menutype); } +int wmenubeg (int srow, int scol, int erow, int ecol, int btype, vattr battr, vattr wattr, VfvCP open, int menutype=M_VERT); +inline int wmenubeg_ (int srow, int scol, int vlen, int hlen, int btype, vattr battr, vattr wattr, VfvCP open, int menutype=M_VERT) { return wmenubeg(srow, scol, srow+vlen-1, scol+hlen-1, btype, battr, wattr, open, menutype); } int wmenubegc (); -int wmenuend (int taginit, int menutype, int barwidth, int textpos, int textattr, int scharattr, int noselattr, int barattr); +int wmenuend (int taginit, int menutype, int barwidth, int textpos, vattr textattr, vattr scharattr, vattr noselattr, vattr barattr); int wmenuget (); int wmenuiba (VfvCP before, VfvCP after); int wmenuidsab (int tagid); @@ -415,13 +415,13 @@ int wmenuienab (int tagid); _item_t* wmenuifind (int tagid); int wmenuinext (int tagid); int wmenuitem (int wrow, int wcol, const char* str, char schar, int tagid, int fmask, VfvCP select, gkey hotkey, int help); -int wmenuitxt (int whdl, int wrow, int wcol, int attr, const char* str); +int wmenuitxt (int whdl, int wrow, int wcol, vattr attr, const char* str); // ------------------------------------------------------------------ // Inline functions -inline void wtextattr(int attr) { gwin.active->attr = attr; } +inline void wtextattr(vattr attr) { gwin.active->attr = attr; } inline int wclear () { return wcclear(gwin.active->wattr); } inline void wfillch (vchar a) { gwin.fillch=a; } @@ -437,7 +437,7 @@ inline _field_t* winpfcurr () { return gwin.active->form->cfield; } inline _menu_t* wmenumcurr () { return gwin.cmenu; } inline _item_t* wmenuicurr () { return wmenumcurr()->citem; } -inline int wmenutitshad(const char* title, int pos, int attr, int shadattr) { gwin.cmenu->title=title; gwin.cmenu->titlepos=pos; gwin.cmenu->titleattr=attr; gwin.cmenu->shadattr=shadattr; return W_NOERROR; } +inline int wmenutitshad(const char* title, int pos, vattr attr, vattr shadattr) { gwin.cmenu->title=title; gwin.cmenu->titlepos=pos; gwin.cmenu->titleattr=attr; gwin.cmenu->shadattr=shadattr; return W_NOERROR; } // ------------------------------------------------------------------ diff --git a/goldlib/gall/gwinbase.cpp b/goldlib/gall/gwinbase.cpp index ea0063e..e2ee4d9 100644 --- a/goldlib/gall/gwinbase.cpp +++ b/goldlib/gall/gwinbase.cpp @@ -124,7 +124,7 @@ int wgotoxy(int wrow, int wcol) { // ------------------------------------------------------------------ // Opens a window and makes it active -int wopen(int srow, int scol, int erow, int ecol, int btype, int battr, int wattr, int sbattr, int loattr) { +int wopen(int srow, int scol, int erow, int ecol, int btype, vattr battr, vattr wattr, vattr sbattr, vattr loattr) { // check for valid box type if(btype<0 or btype>7) { @@ -279,7 +279,7 @@ int wcloseall() { // ------------------------------------------------------------------ // Gives active window a shadow -int wshadow(int attr) { +int wshadow(vattr attr) { // check for active window if(!gwin.total) @@ -408,7 +408,7 @@ int wshadoff() { throw_xrelease(gwin.active->wsbuf); // update window's record - gwin.active->wsattr = 0xFF; + gwin.active->wsattr = WHITE|_WHITE; // return with no error return gwin.werrno=W_NOERROR; @@ -427,7 +427,7 @@ int wscroll(int count, int direction) { gwin.active->srow + border, gwin.active->scol + border, gwin.active->erow - border, - gwin.active->ecol - ((border or (gwin.active->sbattr != -1)) ? 1 : 0), + gwin.active->ecol - ((border or (gwin.active->sbattr != DEFATTR)) ? 1 : 0), gwin.active->wattr, direction == SUP ? count : -count ); @@ -570,7 +570,7 @@ int wdupc(char ch, int count) { // ------------------------------------------------------------------ // Clears the active window in specified attribute -int wcclear(int attr) { +int wcclear(vattr attr) { // check for active window @@ -658,14 +658,14 @@ int wclreos() { // ------------------------------------------------------------------ // This function will process an Escape sequence when encountered -static const char* process_esc(const char* str) { - +static const char* process_esc(const char* str) +{ int wrow,wcol; const char *p = str; for(; *p==ESC; p++) { - int attr = gwin.active->attr; + vattr attr = gwin.active->attr; switch(*(++p)) { @@ -811,7 +811,7 @@ int wputs(const char* str) { // ------------------------------------------------------------------ // Displays a character inside active window -int wprintc(int wrow, int wcol, int atr, vchar chr) { +int wprintc(int wrow, int wcol, vattr atr, vchar chr) { // check for active window if(!gwin.total) @@ -853,7 +853,7 @@ int wprintf(const char* format, ...) { // ------------------------------------------------------------------ // Print a formatted string at a specific position and attribute -int wprintfs(int wrow, int wcol, int attr, const char* format, ...) { +int wprintfs(int wrow, int wcol, vattr attr, const char* format, ...) { va_list argptr; char buf[256]; @@ -872,7 +872,7 @@ int wprintfs(int wrow, int wcol, int attr, const char* format, ...) { // ------------------------------------------------------------------ // Displays a string inside active window -int wprints(int wrow, int wcol, int attr, const char* str) { +int wprints(int wrow, int wcol, vattr attr, const char* str) { // check for active window if(!gwin.total) @@ -889,7 +889,7 @@ int wprints(int wrow, int wcol, int attr, const char* str) { return gwin.werrno=W_NOERROR; } -int wprints_box(int wrow, int wcol, int attr, const char* str) { +int wprints_box(int wrow, int wcol, vattr attr, const char* str) { // check for active window if(!gwin.total) @@ -910,7 +910,7 @@ int wprints_box(int wrow, int wcol, int attr, const char* str) { // ------------------------------------------------------------------ // Displays a string inside active window -int wprintvs(int wrow, int wcol, int attr, const vchar* str) { +int wprintvs(int wrow, int wcol, vattr attr, const vchar* str) { // check for active window if(!gwin.total) @@ -930,7 +930,7 @@ int wprintvs(int wrow, int wcol, int attr, const vchar* str) { // ------------------------------------------------------------------ -int wputx(int wrow, int wcol, int attr, vchar chr, uint len) { +int wputx(int wrow, int wcol, vattr attr, vchar chr, uint len) { const int &border = gwin.active->border; vputx(gwin.active->srow+wrow+border,gwin.active->scol+wcol+border,attr,chr,len); @@ -940,7 +940,7 @@ int wputx(int wrow, int wcol, int attr, vchar chr, uint len) { // ------------------------------------------------------------------ -int wputy(int wrow, int wcol, int attr, vchar chr, uint len) { +int wputy(int wrow, int wcol, vattr attr, vchar chr, uint len) { const int &border = gwin.active->border; vputy(gwin.active->srow+wrow+border,gwin.active->scol+wcol+border,attr,chr,len); @@ -951,8 +951,8 @@ int wputy(int wrow, int wcol, int attr, vchar chr, uint len) { // ------------------------------------------------------------------ // Displays a string inside active window -int wprintns(int wrow, int wcol, int attr, const char* str, uint len, vchar fill, int fill_attr) { - +int wprintns(int wrow, int wcol, vattr attr, const char* str, uint len, vchar fill, vattr fill_attr) +{ char* istr = throw_xstrdup(str); char* ostr = istr; char och = *ostr; @@ -966,7 +966,7 @@ int wprintns(int wrow, int wcol, int attr, const char* str, uint len, vchar fill if(len < olen) *ostr = och; else if(len > olen) - retval = wputx(wrow, wcol+olen, (fill_attr != -1) ? fill_attr : attr, fill, len-olen); + retval = wputx(wrow, wcol+olen, (fill_attr != DEFATTR) ? fill_attr : attr, fill, len-olen); throw_xfree(istr); return retval; } @@ -1039,9 +1039,9 @@ _wrec_t* wfindrec(int whandle) { int whide() { - vsavebuf* p; - int shattr; - _wrec_t *temp; + vsavebuf *p; + vattr shattr; + _wrec_t *temp; // check for active window if(!gwin.total) @@ -1057,7 +1057,7 @@ int whide() { gwin.active->wsattr = shattr; } else { - gwin.active->wsattr = -1; + gwin.active->wsattr = DEFATTR; } // restore contents of active window's buffer @@ -1152,7 +1152,7 @@ int wunhide(int whandle) { gwin.total++; // if window had a shadow before hiding, give it one again - if(gwin.active->wsattr!=-1) + if(gwin.active->wsattr != DEFATTR) wshadow(gwin.active->wsattr); // update help category @@ -1223,8 +1223,8 @@ int wunlink(int w) { // Local variables static _wrec_t *__curr, *__found; -static int __crow, __ccol; -static int __gattr; +static int __crow, __ccol; +static vattr __gattr; static const char* __p; @@ -1307,6 +1307,7 @@ static void swap_contents(vatch* pfound, vatch* pcurr, int shadow) { // shadow, reflect the character on the screen. temp = vgetw(__crow, __ccol); + if(shadow&2) *pcurr = vschar(*pcurr, vgchar(temp)); chat = ((vgattr(temp) & BLINK) and shadow) ? vsattr(*pcurr, vgattr(*pcurr) | BLINK) : *pcurr; @@ -1581,8 +1582,8 @@ int wactiv_(int whandle) { static void update_buffers(vatch* pcurr, int shadow) { - _wrec_t* tcurr; - int tgattr; + _wrec_t *tcurr; + vattr tgattr; // put current string character and attribute into found window's buffer @@ -1620,7 +1621,7 @@ static void update_buffers(vatch* pcurr, int shadow) { // ------------------------------------------------------------------ -int wwprintc(int whandle, int wrow, int wcol, int attr, const vchar chr) { +int wwprintc(int whandle, int wrow, int wcol, vattr attr, const vchar chr) { // check for existance of active window or hidden windows if(!gwin.total and gwin.hidden==NULL) @@ -1648,7 +1649,7 @@ int wwprintc(int whandle, int wrow, int wcol, int attr, const vchar chr) { // ------------------------------------------------------------------ -int wwprints(int whandle, int wrow, int wcol, int attr, const char* str) { +int wwprints(int whandle, int wrow, int wcol, vattr attr, const char* str) { // check for existance of active window or hidden windows if(!gwin.total and gwin.hidden==NULL) @@ -1750,7 +1751,7 @@ int wwprints(int whandle, int wrow, int wcol, int attr, const char* str) { // ------------------------------------------------------------------ -int wwprintstr(int whandle, int wrow, int wcol, int attr, const char* str) { +int wwprintstr(int whandle, int wrow, int wcol, vattr attr, const char* str) { // check for existance of active window or hidden windows if(!gwin.total and gwin.hidden==NULL) @@ -1830,7 +1831,7 @@ int wborder(int btype) { // ------------------------------------------------------------------ // Fills a region of active window w/specified char/attribute -int wfill(int wsrow, int wscol, int werow, int wecol, vchar chr, int atr) { +int wfill(int wsrow, int wscol, int werow, int wecol, vchar chr, vattr atr) { // check for active window if(!gwin.total) @@ -1878,7 +1879,7 @@ int whandle() { // ------------------------------------------------------------------ // Displays text on window's top or bottom border -int wmessage(const char* str, int border, int leftofs, int attr) { +int wmessage(const char* str, int border, int leftofs, vattr attr) { // check for active window if(!gwin.total) @@ -1912,7 +1913,7 @@ int wmessage(const char* str, int border, int leftofs, int attr) { // ------------------------------------------------------------------ // Proportion bar -void wpropbar(int xx, int yy, long len, int attr, long pos, long size) { +void wpropbar(int xx, int yy, long len, vattr attr, long pos, long size) { // xx, yy = start position in window. // len = length (in chars) of progress field. @@ -1923,10 +1924,10 @@ void wpropbar(int xx, int yy, long len, int attr, long pos, long size) { const vchar barchar = _box_table(gwin.active->btype, 13); #ifdef __UNIX__ // prefferable under xterm const vchar thumbchar = ' '; - int thumbattr = revsattr(attr); + vattr thumbattr = revsattr(attr); #else const vchar thumbchar = '\xDB'; - int thumbattr = attr; + vattr thumbattr = attr; #endif long thumblen = (pos*len)/size; @@ -1944,7 +1945,7 @@ void wpropbar(int xx, int yy, long len, int attr, long pos, long size) { // ------------------------------------------------------------------ // Gives active window a title -int wtitle(const char* str, int tpos, int tattr) { +int wtitle(const char* str, int tpos, vattr tattr) { // check for active window if(!gwin.total) @@ -2023,8 +2024,8 @@ int wtitle(const char* str, int tpos, int tattr) { void wscrollbar(int orientation, uint total, uint maxpos, uint pos, int sadd) { - int attr = (gwin.active->sbattr == -1) ? gwin.active->battr : gwin.active->sbattr; - int invattr = revsattr(attr); + vattr attr = (gwin.active->sbattr == DEFATTR) ? gwin.active->battr : gwin.active->sbattr; + vattr invattr = revsattr(attr); const vchar barchar = _box_table(gwin.active->btype, 13); const vchar arrowupchar = '\x18'; @@ -2033,10 +2034,10 @@ void wscrollbar(int orientation, uint total, uint maxpos, uint pos, int sadd) { const vchar arrowrightchar = '\x1A'; #ifdef __UNIX__ // prefferable under xterm const vchar thumbchar = ' '; - int thumbattr = revsattr(attr); + vattr thumbattr = revsattr(attr); #else const vchar thumbchar = '\xDB'; - int thumbattr = attr; + vattr thumbattr = attr; #endif if(maxpos == 0) diff --git a/goldlib/gall/gwindow.cpp b/goldlib/gall/gwindow.cpp index ee00025..aa86bbd 100644 --- a/goldlib/gall/gwindow.cpp +++ b/goldlib/gall/gwindow.cpp @@ -45,7 +45,7 @@ int gwindow::printf(const char* format, ...) { // ------------------------------------------------------------------ -int gwindow::printf(int color, const char* format, ...) { +int gwindow::printf(vattr color, const char* format, ...) { char buf[255]; va_list argptr; @@ -75,7 +75,7 @@ int gwindow::printf(int row, int col, const char* format, ...) { // ------------------------------------------------------------------ -int gwindow::printf(int row, int col, int color, const char* format, ...) { +int gwindow::printf(int row, int col, vattr color, const char* format, ...) { va_list argptr; char buf[256]; diff --git a/goldlib/gall/gwindow.h b/goldlib/gall/gwindow.h index 02a82f5..93c09ec 100644 --- a/goldlib/gall/gwindow.h +++ b/goldlib/gall/gwindow.h @@ -40,7 +40,7 @@ // ------------------------------------------------------------------ -inline void wgetc(int wrow, int wcol, int* atr, vchar* chr) { +inline void wgetc(int wrow, int wcol, vattr* atr, vchar* chr) { vgetc(wrow+gwin.active->srow+gwin.active->border, wcol+gwin.active->scol+gwin.active->border, atr, chr); } @@ -68,19 +68,19 @@ protected: int window_style; - int window_color; + vattr window_color; - int border_hi_color; - int border_lo_color; + vattr border_hi_color; + vattr border_lo_color; - int scrollbar_color; + vattr scrollbar_color; - int title_color; - int title_position; + vattr title_color; + int title_position; - int message_color; + vattr message_color; - int shadow_color; + vattr shadow_color; public: @@ -146,8 +146,8 @@ public: void set_window_at(int srow, int scol); void set_window_size(int vlen, int hlen); - void open(int srow, int scol, int erow, int ecol, int style, int bcolor, int wcolor, int sbcolor=-1, int locolor=-1); - void openxy(int srow, int scol, int vlen, int hlen, int style, int bcolor, int wcolor, int sbcolor=-1, int locolor=-1); + void open(int srow, int scol, int erow, int ecol, int style, vattr bcolor, vattr wcolor, vattr sbcolor = DEFATTR, vattr locolor = DEFATTR); + void openxy(int srow, int scol, int vlen, int hlen, int style, vattr bcolor, vattr wcolor, vattr sbcolor = DEFATTR, vattr locolor = DEFATTR); void open(); void close(); void unlink(); @@ -162,16 +162,16 @@ public: int cursor_row(); int cursor_column(); - void text_color(int color); + void text_color(vattr color); void move_cursor(int row, int column); - void title(const char* title, int color=-1, int position=-1); + void title(const char* title, vattr color = DEFATTR, int position=-1); void no_title(); - void message(const char* text, int border, int leftofs, int color=-1); + void message(const char* text, int border, int leftofs, vattr color = DEFATTR); - void shadow(int color=-1); + void shadow(vattr color = DEFATTR); void no_shadow(); void set_vscrollbar_range(int minpos, int maxpos, int visible, int total, int redraw); @@ -180,7 +180,7 @@ public: void set_vscrollbar_pos(int pos, int redraw); void set_hscrollbar_pos(int pos, int redraw); - void set_scrollbar_color(int color); + void set_scrollbar_color(vattr color); void vscrollbar(uint total, uint maxpos, uint pos, int sadd=0); void hscrollbar(uint total, uint maxpos, uint pos, int sadd=0); @@ -191,31 +191,31 @@ public: void scroll_box_down(int scol, int srow, int ecol, int erow, int count=1); void scroll_box_up(int scol, int srow, int ecol, int erow, int count=1); - void getc(int row, int col, int* atr, vchar* chr); + void getc(int row, int col, vattr* atr, vchar* chr); void putc(vchar ch); void puts(const char* text); - void printc(int row, int col, int color, vchar ch); - void prints(int row, int col, int color, const char* text); - void printvs(int row, int col, int color, const vchar* text); - void prints(int row, int col, int color, const std::string& text); - void printns(int row, int col, int color, const char* text, int len, vchar fill=' ', int fill_color=-1); + void printc(int row, int col, vattr color, vchar ch); + void prints(int row, int col, vattr color, const char* text); + void printvs(int row, int col, vattr color, const vchar* text); + void prints(int row, int col, vattr color, const std::string& text); + void printns(int row, int col, vattr color, const char* text, int len, vchar fill=' ', vattr fill_color = DEFATTR); int printf(const char* format, ...) __attribute__ ((format (printf, 2, 3))); - int printf(int color, const char* format, ...) __attribute__ ((format (printf, 3, 4))); + int printf(vattr color, const char* format, ...) __attribute__ ((format (printf, 3, 4))); int printf(int row, int col, const char* format, ...) __attribute__ ((format (printf, 4, 5))); - int printf(int row, int col, int color, const char* format, ...) __attribute__ ((format (printf, 5, 6))); + int printf(int row, int col, vattr color, const char* format, ...) __attribute__ ((format (printf, 5, 6))); void fill_char(vchar ch); - void fill(int wsrow, int wscol, int werow, int wecol, vchar ch, int color); - void vertical_line(int wsrow, int wscol, int count, int btype, int color); - void horizontal_line(int wsrow, int wscol, int count, int btype, int color); - void clear(int color=-1); + void fill(int wsrow, int wscol, int werow, int wecol, vchar ch, vattr color); + void vertical_line(int wsrow, int wscol, int count, int btype, vattr color); + void horizontal_line(int wsrow, int wscol, int count, int btype, vattr color); + void clear(vattr color = DEFATTR); void clear_eol(); void drag(int direction, int howmuch=1); void slide(int row, int col); - void putx(int wrow, int wcol, int color, char chr, uint len); - void print_center(int row, int color, const char* text); + void putx(int wrow, int wcol, vattr color, char chr, uint len); + void print_center(int row, vattr color, const char* text); }; @@ -230,8 +230,8 @@ inline void gwindow::init() { window_style = 0; window_color = BLACK|_LGREY; border_hi_color = BLUE|_LGREY; - border_lo_color = -1; - scrollbar_color = -1; + border_lo_color = DEFATTR; + scrollbar_color = DEFATTR; title_color = BLUE|_LGREY; title_position = title_center; message_color = BLUE|_LGREY; @@ -259,7 +259,7 @@ inline void gwindow::set_window_size(int vlen, int hlen) { // ------------------------------------------------------------------ -inline void gwindow::open(int srow, int scol, int erow, int ecol, int style, int bcolor, int wcolor, int sbcolor, int locolor) { +inline void gwindow::open(int srow, int scol, int erow, int ecol, int style, vattr bcolor, vattr wcolor, vattr sbcolor, vattr locolor) { start_row = srow; start_column = scol; @@ -278,7 +278,7 @@ inline void gwindow::open(int srow, int scol, int erow, int ecol, int style, int // ------------------------------------------------------------------ -inline void gwindow::openxy(int srow, int scol, int vlen, int hlen, int style, int bcolor, int wcolor, int sbcolor, int locolor) { +inline void gwindow::openxy(int srow, int scol, int vlen, int hlen, int style, vattr bcolor, vattr wcolor, vattr sbcolor, vattr locolor) { open(srow, scol, srow+vlen-1, scol+hlen-1, style, bcolor, wcolor, sbcolor, locolor); } @@ -374,7 +374,7 @@ inline int gwindow::cursor_column() { // ------------------------------------------------------------------ -inline void gwindow::text_color(int color) { +inline void gwindow::text_color(vattr color) { window_color = color; activate_quick(); @@ -384,7 +384,7 @@ inline void gwindow::text_color(int color) { // ------------------------------------------------------------------ -inline void gwindow::set_scrollbar_color(int color) { +inline void gwindow::set_scrollbar_color(vattr color) { wrec->sbattr = color; scrollbar_color = color; @@ -402,9 +402,9 @@ inline void gwindow::move_cursor(int row, int column) { // ------------------------------------------------------------------ -inline void gwindow::title(const char* title, int color, int position) { +inline void gwindow::title(const char* title, vattr color, int position) { - if(color != -1) + if(color != DEFATTR) title_color = color; if(position != -1) title_position = position; @@ -423,9 +423,9 @@ inline void gwindow::no_title() { // ------------------------------------------------------------------ -inline void gwindow::message(const char* text, int border, int leftofs, int color) { +inline void gwindow::message(const char* text, int border, int leftofs, vattr color) { - if(color != -1) + if(color != DEFATTR) message_color = color; activate_quick(); wmessage(text, border, leftofs, message_color); @@ -434,9 +434,9 @@ inline void gwindow::message(const char* text, int border, int leftofs, int colo // ------------------------------------------------------------------ -inline void gwindow::shadow(int color) { +inline void gwindow::shadow(vattr color) { - if(color != -1) + if(color != DEFATTR) shadow_color = color; activate_quick(); wshadow(shadow_color); @@ -508,7 +508,7 @@ inline void gwindow::scroll_box_up(int scol, int srow, int ecol, int erow, int c // ------------------------------------------------------------------ -inline void gwindow::getc(int row, int col, int* atr, vchar* chr) { +inline void gwindow::getc(int row, int col, vattr* atr, vchar* chr) { activate_quick(); wgetc(row, col, atr, chr); @@ -535,7 +535,7 @@ inline void gwindow::puts(const char* text) { // ------------------------------------------------------------------ -inline void gwindow::printc(int row, int col, int color, vchar ch) { +inline void gwindow::printc(int row, int col, vattr color, vchar ch) { activate_quick(); wprintc(row, col, color, ch); @@ -544,25 +544,25 @@ inline void gwindow::printc(int row, int col, int color, vchar ch) { // ------------------------------------------------------------------ -inline void gwindow::prints(int row, int col, int color, const char* text) { +inline void gwindow::prints(int row, int col, vattr color, const char* text) { activate_quick(); - wprints(row, col, color == -1 ? window_color : color, text); + wprints(row, col, color == DEFATTR ? window_color : color, text); } // ------------------------------------------------------------------ -inline void gwindow::printvs(int row, int col, int color, const vchar* text) { +inline void gwindow::printvs(int row, int col, vattr color, const vchar* text) { activate_quick(); - wprintvs(row, col, color == -1 ? window_color : color, text); + wprintvs(row, col, color == DEFATTR ? window_color : color, text); } // ------------------------------------------------------------------ -inline void gwindow::prints(int row, int col, int color, const std::string& text) { +inline void gwindow::prints(int row, int col, vattr color, const std::string& text) { prints(row, col, color, text.c_str()); } @@ -570,7 +570,7 @@ inline void gwindow::prints(int row, int col, int color, const std::string& text // ------------------------------------------------------------------ -inline void gwindow::printns(int row, int col, int color, const char* text, int len, vchar fill, int fill_color) { +inline void gwindow::printns(int row, int col, vattr color, const char* text, int len, vchar fill, vattr fill_color) { activate_quick(); wprintns(row, col, color, text, len, fill, fill_color); @@ -588,7 +588,7 @@ inline void gwindow::fill_char(vchar ch) { // ------------------------------------------------------------------ -inline void gwindow::fill(int wsrow, int wscol, int werow, int wecol, vchar ch, int color) { +inline void gwindow::fill(int wsrow, int wscol, int werow, int wecol, vchar ch, vattr color) { activate_quick(); wfill(wsrow, wscol, werow, wecol, ch, color); @@ -597,7 +597,7 @@ inline void gwindow::fill(int wsrow, int wscol, int werow, int wecol, vchar ch, // ------------------------------------------------------------------ -inline void gwindow::vertical_line(int wsrow, int wscol, int count, int btype, int color) { +inline void gwindow::vertical_line(int wsrow, int wscol, int count, int btype, vattr color) { activate_quick(); wvline(wsrow, wscol, count, btype, color); @@ -606,7 +606,7 @@ inline void gwindow::vertical_line(int wsrow, int wscol, int count, int btype, i // ------------------------------------------------------------------ -inline void gwindow::horizontal_line(int wsrow, int wscol, int count, int btype, int color) { +inline void gwindow::horizontal_line(int wsrow, int wscol, int count, int btype, vattr color) { activate_quick(); whline(wsrow, wscol, count, btype, color); @@ -615,10 +615,10 @@ inline void gwindow::horizontal_line(int wsrow, int wscol, int count, int btype, // ------------------------------------------------------------------ -inline void gwindow::clear(int color) { +inline void gwindow::clear(vattr color) { activate_quick(); - wcclear(color == -1 ? window_color : color); + wcclear(color == DEFATTR ? window_color : color); } @@ -672,7 +672,7 @@ inline void gwindow::slide(int row, int col) { // ------------------------------------------------------------------ -inline void gwindow::print_center(int row, int color, const char* text) { +inline void gwindow::print_center(int row, vattr color, const char* text) { activate_quick(); wcenters(row, color, text); diff --git a/goldlib/gall/gwinhelp.h b/goldlib/gall/gwinhelp.h index 41be15b..17fae04 100644 --- a/goldlib/gall/gwinhelp.h +++ b/goldlib/gall/gwinhelp.h @@ -46,10 +46,10 @@ public: const char* file; // help file name int helpptr; // help stack pointer gkey key; // help hot key - int winattr; // help window attribute - int textattr; // help window text attribute - int selattr; // selection text attribute - int barattr; // selection bar attribute + vattr winattr; // help window attribute + vattr textattr; // help window text attribute + vattr selattr; // selection text attribute + vattr barattr; // selection bar attribute int srow; // help window start row int scol; // help window start column int erow; // help window end row @@ -59,6 +59,27 @@ public: VfvCP open; // pointer to open function gfile* fp; // help file long offset; // help file offset + + _help_t() + { + memset(help, 0, sizeof(help)); + file = NULL; + helpptr = -1; + key = 0; + winattr = BLACK|_BLACK; + textattr = BLACK|_BLACK; + selattr = BLACK|_BLACK; + barattr = BLACK|_BLACK; + srow = 3; + scol = 8; + erow = 21; + ecol = 71; + btype = 0; + title = YES; + open = NULL; + fp = NULL; + offset = 0; + } }; @@ -84,7 +105,7 @@ typedef struct _hlpidx_t { int whelpcat(int cat); int whelpclr(); -int whelpdef(const char* file, gkey key, int winattr, int textattr, int selattr, int barattr, VfvCP open); +int whelpdef(const char* file, gkey key, vattr winattr, vattr textattr, vattr selattr, vattr barattr, VfvCP open); int whelpop(); int whelpopc(); int whelppcat(int cat); @@ -92,7 +113,7 @@ int whelpush(); int whelpushc(int cat); int whelpwin(int srow, int scol, int erow, int ecol, int btype, int title); void whelpcompile(const char* helpfile, long& offset); -inline int whelpundef() { return whelpdef(NULL,0,0,0,0,0,NULL); } +inline int whelpundef() { return whelpdef(NULL,0,BLACK|_BLACK,BLACK|_BLACK,BLACK|_BLACK,BLACK|_BLACK,NULL); } // ------------------------------------------------------------------ diff --git a/goldlib/gall/gwinhlp1.cpp b/goldlib/gall/gwinhlp1.cpp index 8398e01..9879eda 100644 --- a/goldlib/gall/gwinhlp1.cpp +++ b/goldlib/gall/gwinhlp1.cpp @@ -71,10 +71,7 @@ static char* catarray[MAXXREF]; static int arraycnt = 0; static char buf[BUFSIZE+1]; -_help_t whelp = { - { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, - NULL,-1,0,0,0,0,0,3,8,21,71,0,YES,NULL,NULL,0 -}; +_help_t whelp; // ------------------------------------------------------------------ @@ -306,7 +303,7 @@ static void disp_cat() { setonkey(Key_Esc,esc_esc,0); // end the menu and process it - wmenuend(BASETAGID,M_OMNI|M_NOQS,0,0,whelp.selattr,whelp.selattr,0,whelp.barattr); + wmenuend(BASETAGID,M_OMNI|M_NOQS,0,0,whelp.selattr,whelp.selattr,BLACK|_BLACK,whelp.barattr); gmnudropthrough = YES; kbch = i = (gkey)wmenuget(); gmnudropthrough = NO; @@ -560,7 +557,7 @@ static void help_handler() { // ------------------------------------------------------------------ -int whelpdef(const char* file, gkey key, int winattr, int textattr, int selattr, int barattr, VfvCP open) { +int whelpdef(const char* file, gkey key, vattr winattr, vattr textattr, vattr selattr, vattr barattr, VfvCP open) { // is help disengagement requested? If so, un-define the help key. if(file==NULL) { diff --git a/goldlib/gall/gwininit.cpp b/goldlib/gall/gwininit.cpp index a96ea9e..14b1db6 100644 --- a/goldlib/gall/gwininit.cpp +++ b/goldlib/gall/gwininit.cpp @@ -83,7 +83,7 @@ GWin::~GWin() { // ------------------------------------------------------------------ // Displays a string in centered in active window -int wcenters(int wrow, int attr, const char* str) { +int wcenters(int wrow, vattr attr, const char* str) { register int window_width, string_length; int start_column, border; @@ -133,10 +133,11 @@ int wcenters(int wrow, int attr, const char* str) { int wdrag(int direction) { - int srow, scol, erow, ecol, fill_row, fill_col, i; - int nsrow, nscol, nerow, necol, shad_attr=-1; - int chars_per_line, lines_per_win; - int vert_movement, horz_movement; + int srow, scol, erow, ecol, fill_row, fill_col, i; + int nsrow, nscol, nerow, necol; + vattr shad_attr = DEFATTR; + int chars_per_line, lines_per_win; + int vert_movement, horz_movement; vsavebuf* win_image; vsavebuf* wp; vatch* p; @@ -243,6 +244,7 @@ int wdrag(int direction) { p += (lines_per_win * chars_per_line); fill_row=erow; } + vputx(fill_row, scol, vgattr(*p), vgchar(*p), ecol-scol+1); } else { @@ -252,6 +254,7 @@ int wdrag(int direction) { p += chars_per_line; fill_col=ecol; } + for(i=srow;i<=erow;i++,p+=chars_per_line+1) vputc(i, fill_col, vgattr(*p), vgchar(*p)); } @@ -269,8 +272,8 @@ int wdrag(int direction) { gwin.active->ecol = necol; // if window has shadow, redraw it - if(shad_attr!=-1) - wshadow((int)shad_attr); + if(shad_attr != DEFATTR) + wshadow(shad_attr); // reset cursor position vposset(gwin.active->row,gwin.active->column); @@ -285,7 +288,8 @@ int wdrag(int direction) { int wslide(int nsrow, int nscol) { - int shattr=-1, err=0; + vattr shattr = DEFATTR; + int err = 0; // check for active windows if(!gwin.total) @@ -312,8 +316,8 @@ int wslide(int nsrow, int nscol) { return gwin.werrno; // if window has shadow, redraw it - if(shattr!=-1) - wshadow((int)shattr); + if(shattr != DEFATTR) + wshadow(shattr); // return normally return gwin.werrno=W_NOERROR; diff --git a/goldlib/gall/gwinline.cpp b/goldlib/gall/gwinline.cpp index 632c92a..3f2b74b 100644 --- a/goldlib/gall/gwinline.cpp +++ b/goldlib/gall/gwinline.cpp @@ -56,9 +56,9 @@ // ------------------------------------------------------------------ -static int disp_char(int wrow,int wcol,int attr,int btype,vchar ch,int direc) { +static int disp_char(int wrow,int wcol, vattr attr,int btype,vchar ch,int direc) { - attr |= ACSET; + attr = attr|ACSET; // see if next to a border, if so, connect to it if(gwin.active->border) { @@ -156,7 +156,7 @@ static inline int isrighthorz(int btype, vchar ch) { // ------------------------------------------------------------------ -int whline(int wsrow, int wscol, int count, int btype, int attr) { +int whline(int wsrow, int wscol, int count, int btype, vattr attr) { register int bt; int row,col,up,down; @@ -237,7 +237,7 @@ int whline(int wsrow, int wscol, int count, int btype, int attr) { // ------------------------------------------------------------------ -int wvline(int wsrow, int wscol, int count, int btype, int attr) { +int wvline(int wsrow, int wscol, int count, int btype, vattr attr) { register int bt; int row,col,left,right; diff --git a/goldlib/gall/gwinmenu.cpp b/goldlib/gall/gwinmenu.cpp index 4d32fe7..769d564 100644 --- a/goldlib/gall/gwinmenu.cpp +++ b/goldlib/gall/gwinmenu.cpp @@ -208,7 +208,7 @@ static void disp_item(_item_t *witem,int bar) __extension__ char buf[sizeof(vatch)*gvid->numcols]; #endif char ch; - int chattr; + vattr chattr; _wrec_t* whp; register const char* p; register vatch* ptr=(vatch*)buf; @@ -229,7 +229,7 @@ static void disp_item(_item_t *witem,int bar) { const int &border = gwin.active->border; const int &btype = gwin.active->btype; - const int &attr = gwin.active->loattr; + const vattr &attr = gwin.active->loattr; vatch line = vcatch(_box_table(btype, 1), attr); if (border) *ptr++ = vcatch(_box_table(btype, 9), attr); @@ -719,7 +719,7 @@ static _item_t * up_item(_item_t *curr) // ------------------------------------------------------------------ -int wmenubeg(int srow, int scol, int erow, int ecol, int btype, int battr, int wattr, VfvCP open, int menutype) { +int wmenubeg(int srow, int scol, int erow, int ecol, int btype, vattr battr, vattr wattr, VfvCP open, int menutype) { _menu_t* wmenu; @@ -762,8 +762,8 @@ int wmenubeg(int srow, int scol, int erow, int ecol, int btype, int battr, int w wmenu->item=NULL; wmenu->title = ""; wmenu->titlepos = -1; - wmenu->titleattr = 0; - wmenu->shadattr = -1; + wmenu->titleattr = BLACK|_BLACK; + wmenu->shadattr = DEFATTR; wmenu->items = 0; // increment menu level @@ -809,7 +809,7 @@ int wmenuitem(int wrow, int wcol, const char* str, char schar, int tagid, int fm witem->dwhdl = -1; witem->dwrow = 0; witem->dwcol = 0; - witem->dattr = 0; + witem->dattr = BLACK|_BLACK; witem->redisp = NO; witem->help = help; witem->child = NULL; @@ -843,7 +843,7 @@ int wmenuitem(int wrow, int wcol, const char* str, char schar, int tagid, int fm // ------------------------------------------------------------------ -int wmenuend(int taginit, int menutype, int barwidth, int textpos, int textattr, int scharattr, int noselattr, int barattr) { +int wmenuend(int taginit, int menutype, int barwidth, int textpos, vattr textattr, vattr scharattr, vattr noselattr, vattr barattr) { _item_t* item; int w_width, border, found; @@ -926,8 +926,8 @@ int wmenuget() { hide_mouse_cursor_mnu(); if(!wopen(gwin.cmenu->srow,gwin.cmenu->scol,gwin.cmenu->erow,gwin.cmenu->ecol,gwin.cmenu->btype,gwin.cmenu->battr,gwin.cmenu->wattr,gwin.cmenu->sbattr,gwin.cmenu->loattr)) return -1; - if(gwin.cmenu->shadattr != -1) - wshadow((int)gwin.cmenu->shadattr); + if(gwin.cmenu->shadattr != DEFATTR) + wshadow(gwin.cmenu->shadattr); if(gwin.cmenu->title and *gwin.cmenu->title) wtitle(gwin.cmenu->title, gwin.cmenu->titlepos, gwin.cmenu->titleattr); show_mouse_cursor_mnu(); @@ -1352,7 +1352,7 @@ _item_t* wmenuifind(int tagid) { // ------------------------------------------------------------------ // Adds a text description to menu item -int wmenuitxt(int whdl, int wrow, int wcol, int attr, const char* str) { +int wmenuitxt(int whdl, int wrow, int wcol, vattr attr, const char* str) { // make sure at least 1 menu item has been defined if(!gwin.mlevel or gwin.mlevel>gwin.ilevel) @@ -1363,7 +1363,7 @@ int wmenuitxt(int whdl, int wrow, int wcol, int attr, const char* str) { citem->dwhdl = whdl; citem->dwrow = wrow; citem->dwcol = wcol; - citem->dattr = (int)attr; + citem->dattr = attr; citem->desc = str; // return normally diff --git a/goldlib/gall/gwinmnub.cpp b/goldlib/gall/gwinmnub.cpp index b83d432..5cfd9b2 100644 --- a/goldlib/gall/gwinmnub.cpp +++ b/goldlib/gall/gwinmnub.cpp @@ -34,22 +34,22 @@ void GMnu::Init() { bordertype = 0; - bordercolor = 0; + bordercolor = BLACK|_BLACK; - textcolor = 0; - quickcolor = 0; - noselcolor = 0; - barcolor = 0; - shadowcolor = -1; + textcolor = BLACK|_BLACK; + quickcolor = BLACK|_BLACK; + noselcolor = BLACK|_BLACK; + barcolor = BLACK|_BLACK; + shadowcolor = DEFATTR; title = NULL; titlepos = TCENTER; - titlecolor = 0; + titlecolor = BLACK|_BLACK; deschdl = -1; descrow = 0; desccolumn = 0; - desccolor = 0; + desccolor = BLACK|_BLACK; helpnumber = -1; @@ -70,7 +70,7 @@ void GMnu::Init() { // ------------------------------------------------------------------ -void GMnu::SetBorder(int type, int color) { +void GMnu::SetBorder(int type, vattr color) { bordertype = type; bordercolor = color; @@ -79,7 +79,7 @@ void GMnu::SetBorder(int type, int color) { // ------------------------------------------------------------------ -void GMnu::SetColor(int text, int quick, int nosel, int bar, int shadow) { +void GMnu::SetColor(vattr text, vattr quick, vattr nosel, vattr bar, vattr shadow) { textcolor = text; quickcolor = quick; @@ -91,7 +91,7 @@ void GMnu::SetColor(int text, int quick, int nosel, int bar, int shadow) { // ------------------------------------------------------------------ -void GMnu::SetTitle(const char* text, int color, int pos) { +void GMnu::SetTitle(const char* text, vattr color, int pos) { title = text; titlepos = pos; @@ -109,7 +109,7 @@ void GMnu::SetTitle(const char* text) { // ------------------------------------------------------------------ -void GMnu::SetDesc(int hdl, int row, int col, int color) { +void GMnu::SetDesc(int hdl, int row, int col, vattr color) { deschdl = hdl; descrow = row; diff --git a/goldlib/gall/gwinpckf.cpp b/goldlib/gall/gwinpckf.cpp index 38f1d52..53ad3c3 100644 --- a/goldlib/gall/gwinpckf.cpp +++ b/goldlib/gall/gwinpckf.cpp @@ -122,7 +122,7 @@ static void pre_exit(char** p, int numelems) { // ------------------------------------------------------------------ -bool wpickfile(int srow, int scol, int erow, int ecol, int btype, int bordattr, int winattr, int barattr, bool title, std::string &filespec, IfcpCP open, bool casesens) { +bool wpickfile(int srow, int scol, int erow, int ecol, int btype, vattr bordattr, vattr winattr, vattr barattr, bool title, std::string &filespec, IfcpCP open, bool casesens) { Path cwd, dir, namext, tcwd, path, spec; diff --git a/goldlib/gall/gwinpcks.cpp b/goldlib/gall/gwinpcks.cpp index ab88eab..5238684 100644 --- a/goldlib/gall/gwinpcks.cpp +++ b/goldlib/gall/gwinpcks.cpp @@ -47,22 +47,22 @@ int wpickstr_tag = false; // define record that will hold pick window info struct r_t { - int numelems; - int lastelem; - int curr; - int first; - int last; - int strsperline; - int strsperwin; - int maxstrlen; - int wwidth; - int wheight; - int fillspaces; - int gapspaces; - int xtraspaces; - int winattr; - int barattr; - int scrollbar; + int numelems; + int lastelem; + int curr; + int first; + int last; + int strsperline; + int strsperwin; + int maxstrlen; + int wwidth; + int wheight; + int fillspaces; + int gapspaces; + int xtraspaces; + vattr winattr; + vattr barattr; + int scrollbar; }; @@ -403,7 +403,7 @@ static gkey read_mouse(char* strarr[], r_t* r) { // ------------------------------------------------------------------ -int wpickstr(int srow, int scol, int erow, int ecol, int btype, int bordattr, int winattr, int barattr, char* strarr[], int initelem, VfvCP open) { +int wpickstr(int srow, int scol, int erow, int ecol, int btype, vattr bordattr, vattr winattr, vattr barattr, char* strarr[], int initelem, VfvCP open) { int i, j, maxlen, outside; gkey xch; diff --git a/goldlib/gall/gwinpick.cpp b/goldlib/gall/gwinpick.cpp index 6b99443..3cbeac6 100644 --- a/goldlib/gall/gwinpick.cpp +++ b/goldlib/gall/gwinpick.cpp @@ -43,7 +43,8 @@ gwinpick::gwinpick() { key = 0; keyok = false; ypos = xpos = ylen = xlen = 0; - btype = battr = wattr = tattr = sattr = hattr = loattr = sbattr = 0; + btype = 0; + battr = wattr = tattr = sattr = hattr = loattr = sbattr = BLACK|_BLACK; title = NULL; helpcat = 0; maximum_index = minimum_index = maximum_position = index = position = 0; diff --git a/goldlib/gall/gwinpick.h b/goldlib/gall/gwinpick.h index dea0c3b..1b5eb06 100644 --- a/goldlib/gall/gwinpick.h +++ b/goldlib/gall/gwinpick.h @@ -85,13 +85,13 @@ public: uint ylen; // Window Height uint xlen; // Window Width int btype; // Window Border Type - int battr; // Window Border Color - int wattr; // Window Color - int tattr; // Window Title Color - int sattr; // Window Selection Bar Color - int hattr; // Window Highlight Color - int loattr; // Window LoAttr Color - int sbattr; // Window Scrollbar Color + vattr battr; // Window Border Color + vattr wattr; // Window Color + vattr tattr; // Window Title Color + vattr sattr; // Window Selection Bar Color + vattr hattr; // Window Highlight Color + vattr loattr; // Window LoAttr Color + vattr sbattr; // Window Scrollbar Color const char* title; // Window Title int helpcat; // Window Help Category uint maximum_index; // List Entries - 1 diff --git a/goldlib/gall/gwinput.h b/goldlib/gall/gwinput.h index c8433bb..b0a1029 100644 --- a/goldlib/gall/gwinput.h +++ b/goldlib/gall/gwinput.h @@ -46,12 +46,12 @@ public: gwinput* form; - int pos; - int max_pos; - int attr; - bool fill_acs; + int pos; + int max_pos; + vattr attr; + bool fill_acs; vchar fill; - int entry; + int entry; char* buf; int buf_left_pos; @@ -128,9 +128,9 @@ public: cvt_mixedcase }; - int idle_attr; - int active_attr; - int edit_attr; + vattr idle_attr; + vattr active_attr; + vattr edit_attr; bool fill_acs; vchar idle_fill; @@ -151,7 +151,7 @@ public: gwinput(gwindow &w); virtual ~gwinput(); - void setup(int i_attr, int a_attr, int e_attr, vchar fill, bool fill_acs); + void setup(vattr i_attr, vattr a_attr, vattr e_attr, vchar fill, bool fill_acs); void add_field(int idnum, int wrow, int wcol, int field_width, std::string& dest, int dest_size, int cvt=gwinput::cvt_none, int mode=gwinput::entry_conditional); diff --git a/goldlib/gall/gwinput2.cpp b/goldlib/gall/gwinput2.cpp index db05a32..087ef18 100644 --- a/goldlib/gall/gwinput2.cpp +++ b/goldlib/gall/gwinput2.cpp @@ -41,7 +41,7 @@ gwinput::gwinput(gwindow &w) : window(w) { first_field = current = NULL; fill_acs = false; - idle_attr = active_attr = edit_attr = 7; + idle_attr = active_attr = edit_attr = LGREY; idle_fill = active_fill = edit_fill = ' '; insert_mode = true; done = dropped = false; @@ -66,7 +66,7 @@ gwinput::~gwinput() { // ------------------------------------------------------------------ -void gwinput::setup(int i_attr, int a_attr, int e_attr, vchar fill, bool f_acs) { +void gwinput::setup(vattr i_attr, vattr a_attr, vattr e_attr, vchar fill, bool f_acs) { idle_attr = i_attr; active_attr = a_attr; diff --git a/goldlib/gmb3/gmo_msg.h b/goldlib/gmb3/gmo_msg.h index 60b3a64..3a4971c 100644 --- a/goldlib/gmb3/gmo_msg.h +++ b/goldlib/gmb3/gmo_msg.h @@ -36,6 +36,7 @@ #include #include +#include #include @@ -141,15 +142,15 @@ class Line { public: - int color; // Line color + vattr color; // Line color uint type; // GLINE_* uint kludge; // GKLUD_* std::string txt; // The line text Line* prev; // Pointer to previous line Line* next; // Pointer to next line - Line() : txt ("") { color = type = kludge = 0; prev = next = NULL; } - Line(const char *str) : txt (str) { color = type = kludge = 0; prev = next = NULL; } + Line() : txt ("") { color = BLACK|_BLACK; type = kludge = 0; prev = next = NULL; } + Line(const char *str) : txt (str) { color = BLACK|_BLACK; type = kludge = 0; prev = next = NULL; } ~Line() {} int istearline() { return !!(type & GLINE_TEAR); }