Replaced a part of color attributes from int type to vattr type

This commit is contained in:
Ianos Gnatiuc 2006-01-13 14:26:31 +00:00
parent 5c13c7c8c9
commit b4f52b3d1e
51 changed files with 625 additions and 587 deletions

View File

@ -267,7 +267,7 @@ void CfgColorname()
ptr = strskip_wht(ptr); ptr = strskip_wht(ptr);
Node cn; Node cn;
int color = atoi(ptr); vattr color = atoi(ptr);
// color was given // color was given
*ptr = NUL; *ptr = NUL;
@ -291,7 +291,7 @@ void CfgColorname()
strxcpy(cn.name, val, sizeof(cn.name)); strxcpy(cn.name, val, sizeof(cn.name));
CFG->colorname.push_back(std::pair<Node, int>(cn, color)); CFG->colorname.push_back(std::pair<Node, vattr>(cn, color));
} }
// ------------------------------------------------------------------ // ------------------------------------------------------------------

View File

@ -233,72 +233,72 @@ const word CRC_SCERROR = 0xAB65;
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Get color value // Get color value
int GetColor(char* ink) { vattr GetColor(char* ink)
{
word crc; word crc;
int color=0; vattr color = BLACK|_BLACK;
crc = strCrc16(strupr(ink)); crc = strCrc16(strupr(ink));
switch(crc) { switch(crc) {
// Black is the default // Black is the default
case CRC_BLACK: case CRC_BLACK:
color = 0; color = BLACK|_BLACK;
break; break;
case CRC_BLUE: case CRC_BLUE:
color = 1; color = BLUE|_BLACK;
break; break;
case CRC_GREEN: case CRC_GREEN:
color = 2; color = GREEN|_BLACK;
break; break;
case CRC_CYAN: case CRC_CYAN:
color = 3; color = CYAN|_BLACK;
break; break;
case CRC_RED: case CRC_RED:
color = 4; color = RED|_BLACK;
break; break;
case CRC_MAGENTA: case CRC_MAGENTA:
color = 5; color = MAGENTA|_BLACK;
break; break;
case CRC_BROWN: case CRC_BROWN:
color = 6; color = BROWN|_BLACK;
break; break;
case CRC_LGRAY: case CRC_LGRAY:
case CRC_LGREY: case CRC_LGREY:
case CRC_LIGHTGRAY: case CRC_LIGHTGRAY:
case CRC_LIGHTGREY: case CRC_LIGHTGREY:
color = 7; color = LGREY|_BLACK;
break; break;
case CRC_DGRAY: case CRC_DGRAY:
case CRC_DGREY: case CRC_DGREY:
case CRC_DARKGRAY: case CRC_DARKGRAY:
case CRC_DARKGREY: case CRC_DARKGREY:
color = 8; color = DGREY|_BLACK;
break; break;
case CRC_LBLUE: case CRC_LBLUE:
case CRC_LIGHTBLUE: case CRC_LIGHTBLUE:
color = 9; color = LBLUE|_BLACK;
break; break;
case CRC_LGREEN: case CRC_LGREEN:
case CRC_LIGHTGREEN: case CRC_LIGHTGREEN:
color = 10; color = LGREEN|_BLACK;
break; break;
case CRC_LCYAN: case CRC_LCYAN:
case CRC_LIGHTCYAN: case CRC_LIGHTCYAN:
color = 11; color = LCYAN|_BLACK;
break; break;
case CRC_LRED: case CRC_LRED:
case CRC_LIGHTRED: case CRC_LIGHTRED:
color = 12; color = LRED|_BLACK;
break; break;
case CRC_LMAGENTA: case CRC_LMAGENTA:
case CRC_LIGHTMAGENTA: case CRC_LIGHTMAGENTA:
color = 13; color = LMAGENTA|_BLACK;
break; break;
case CRC_YELLOW: case CRC_YELLOW:
color = 14; color = YELLOW|_BLACK;
break; break;
case CRC_WHITE: case CRC_WHITE:
color = 15; color = WHITE|_BLACK;
break; break;
case CRC_UNDERLINE: case CRC_UNDERLINE:
color = UNDERLINE; color = UNDERLINE;
@ -320,7 +320,7 @@ int GetColor(char* ink) {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Evaluates a color string // Evaluates a color string
int MakeColor(char* colors) { vattr MakeColor(char* colors) {
static int paper=0; static int paper=0;
int ink=0, blink; int ink=0, blink;
@ -356,10 +356,10 @@ int MakeColor(char* colors) {
void GetColors(char* value) { void GetColors(char* value) {
word crc; word crc;
Win* wptr; Win* wptr;
int attr; vattr attr;
char buf[256]; char buf[256];
char* win; char* win;
char* colors; char* colors;
char* part=NULL; char* part=NULL;

View File

@ -562,8 +562,8 @@ struct MLst {
time32_t arrived; time32_t arrived;
time32_t received; time32_t received;
char goldmark; char goldmark;
int colorby; vattr colorby;
int colorto; vattr colorto;
}; };
@ -877,9 +877,9 @@ struct SaveUtil {
// Window structure // Window structure
struct Win { struct Win {
int btype; // Border type int btype; // Border type
int c[16]; // Colors vattr c[16]; // Colors
int w; // Window handle int w; // Window handle
}; };
// ------------------------------------------------------------------ // ------------------------------------------------------------------

View File

@ -467,7 +467,7 @@ public:
void SelMaskPick::open() { 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.title(title, tattr);
window.shadow(C_SHADOW); window.shadow(C_SHADOW);
update(); update();

View File

@ -190,7 +190,7 @@ public:
int beepyourmail; int beepyourmail;
int carboncopylist; // cclist; int carboncopylist; // cclist;
Win color[16]; Win color[16];
std::vector< std::pair<Node, int> > colorname; std::vector< std::pair<Node, vattr> > colorname;
Path confirmfile; // goldedcfm; Path confirmfile; // goldedcfm;
int confirmresponse; int confirmresponse;
Path cookiepath; Path cookiepath;

View File

@ -192,7 +192,7 @@ void Area::DelMsgs(GMsg* msg) {
if(delask) { if(delask) {
if(msg->attr.uns() and not (msg->attr.rcv() or msg->attr.del())) { if(msg->attr.uns() and not (msg->attr.rcv() or msg->attr.del())) {
AA->LoadMsg(msg, msgno, CFG->dispmargin-(int)CFG->switches.get(disppagebar)); 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->Use(AA, msg);
HeaderView->Paint(); HeaderView->Paint();
BodyView->Use(AA, msg, topline); BodyView->Use(AA, msg, topline);
@ -213,7 +213,7 @@ void Area::DelMsgs(GMsg* msg) {
} }
if(msg->attr.lok() and not dellocked and not deletethis) { if(msg->attr.lok() and not dellocked and not deletethis) {
AA->LoadMsg(msg, msgno, CFG->dispmargin-(int)CFG->switches.get(disppagebar)); 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->Use(AA, msg);
HeaderView->Paint(); HeaderView->Paint();
BodyView->Use(AA, msg, topline); BodyView->Use(AA, msg, topline);
@ -238,7 +238,7 @@ void Area::DelMsgs(GMsg* msg) {
isreadmark = false; isreadmark = false;
Mark.ResetAll(); Mark.ResetAll();
} }
w_progress(MODE_QUIT, 0, 0, 0, NULL); w_progress(MODE_QUIT, BLACK|_BLACK, 0, 0, NULL);
} }
} }
if(n == 0) { if(n == 0) {

View File

@ -85,7 +85,7 @@ inline bool isstylechar(char c) {
return (c == '*') or (c == '/') or (c == '_') or (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; uint sclen = 0;
const char* txptr = text; const char* txptr = text;

View File

@ -31,13 +31,13 @@
class Container { class Container {
virtual void prints(int, int, int, const char*) = 0; virtual void prints(int, int, vattr, const char*) = 0;
public: public:
virtual ~Container() { } 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);
}; };

View File

@ -262,7 +262,7 @@ static void WriteMsgs(GMsg* msg) {
remove(fname); remove(fname);
} }
w_progress(MODE_QUIT, 0, 0, 0, NULL); w_progress(MODE_QUIT, BLACK|_BLACK, 0, 0, NULL);
} }
else if(source == WRITE_CURRENT) { else if(source == WRITE_CURRENT) {
if(target & WRITE_FILE) { if(target & WRITE_FILE) {

View File

@ -147,7 +147,7 @@ void Cleanup(void) {
} }
// Reset border color // Reset border color
if(C_BACKB != 0) if (C_BACKB != (BLACK|_BLACK))
gvid->setoverscan(gvid->orig.color.overscan); gvid->setoverscan(gvid->orig.color.overscan);
wcloseall(); // Close all windows wcloseall(); // Close all windows
@ -215,7 +215,7 @@ void Cleanup(void) {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Multipurpose DOS shell function // 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; 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); gvid->setmode(gvid->orig.screen.mode);
// Clear screen // Clear screen
if(cls) if (cls != (BLACK|_BLACK))
vclrscr(cls); vclrscr(cls);
// Reset border color // Reset border color
if(C_BACKB != 0) if (C_BACKB != (BLACK|_BLACK))
gvid->setoverscan(gvid->orig.color.overscan); gvid->setoverscan(gvid->orig.color.overscan);
// Turn on the blinking attributes // Turn on the blinking attributes
@ -314,10 +314,9 @@ int ShellToDos(char* command, char* message, int cls, int cursor, int pause) {
#endif #endif
// Return cursor into 1st column // Return cursor into 1st column
if(cls) puts(""); if (cls != (BLACK|_BLACK)) puts("");
// Write message on screen // Write message on screen
if(*message) if(*message) puts(message);
puts(message);
// Turn on cursor // Turn on cursor
int yy, xx; int yy, xx;
@ -405,7 +404,7 @@ int ShellToDos(char* command, char* message, int cls, int cursor, int pause) {
gvid->setintensity(CFG->intensecolors); gvid->setintensity(CFG->intensecolors);
// Restore border color // Restore border color
if(C_BACKB != 0) if (C_BACKB != (BLACK|_BLACK))
gvid->setoverscan(C_BACKB); gvid->setoverscan(C_BACKB);
// Set palette if changes were specified // Set palette if changes were specified

View File

@ -130,7 +130,7 @@ void IEclass::setlinetype(Line* __line) {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Zero-based // Zero-based
int IEclass::dispchar(vchar __ch, int attr) { vattr IEclass::dispchar(vchar __ch, vattr attr) {
if(__ch == NUL) // possible if line empty if(__ch == NUL) // possible if line empty
__ch = ' '; __ch = ' ';
@ -141,10 +141,10 @@ int IEclass::dispchar(vchar __ch, int attr) {
__ch = EDIT->CharSpace(); __ch = EDIT->CharSpace();
} }
int atr; vattr atr;
vchar chr; vchar chr;
editwin.getc(crow, ccol, &atr, &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; return atr;
} }
@ -186,7 +186,7 @@ void IEclass::scrolldown(int __scol, int __srow, int __ecol, int __erow, int __l
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Zero-based // 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); 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]; char savechar = __buf[bend];
__buf[bend] = NUL; __buf[bend] = NUL;
StyleCodeHighlight(__buf+bbeg, __row, __col+bbeg-__beg, false, -1); StyleCodeHighlight(__buf+bbeg, __row, __col+bbeg-__beg, false, DEFATTR);
__buf[bend] = savechar; __buf[bend] = savechar;
bbeg = bend; bend += scpos; bbeg = bend; bend += scpos;
@ -313,7 +313,7 @@ void IEclass::dispstringsc(char *__buf, uint __beg, uint __end, uint __row, uint
} }
if (bbeg < bend) 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); dispstringsc(_buf, 0, begblock, __row, mincol, savechar);
} }
else else
StyleCodeHighlight(_buf, __row, mincol, false, -1); StyleCodeHighlight(_buf, __row, mincol, false, DEFATTR);
_buf[begblock] = savechar; _buf[begblock] = savechar;
} }
@ -443,7 +443,7 @@ void IEclass::dispstring(Line* line, uint __row)
dispstringsc(_buf, endblock, maxcol+1, __row, mincol+endblock, 0); dispstringsc(_buf, endblock, maxcol+1, __row, mincol+endblock, 0);
} }
else else
StyleCodeHighlight(_buf+endblock, __row, mincol+endblock, false, -1); StyleCodeHighlight(_buf+endblock, __row, mincol+endblock, false, DEFATTR);
} }
GFTRK(NULL); GFTRK(NULL);
@ -2913,7 +2913,7 @@ int IEclass::Start(int __mode, uint* __position, GMsg* __msg) {
gotorowcol(col, row); gotorowcol(col, row);
batch_mode = 0; batch_mode = 0;
int backattr = 0; vattr backattr = BLACK|_BLACK;
if(blockcol == -1) { if(blockcol == -1) {
backattr = dispchar(currline->txt.c_str()[col], C_READC); backattr = dispchar(currline->txt.c_str()[col], C_READC);
gotorowcol(col, row); gotorowcol(col, row);

View File

@ -295,7 +295,7 @@ protected:
void cursoroff (); void cursoroff ();
void cursoron (); void cursoron ();
void deleteline (bool zapquotesbelow = false); void deleteline (bool zapquotesbelow = false);
int dispchar (vchar __ch, int attr=-1); vattr dispchar (vchar __ch, vattr attr = DEFATTR);
void dispins (); void dispins ();
void dispdl (); void dispdl ();
void displine (Line* __line, uint __row); void displine (Line* __line, uint __row);
@ -320,7 +320,7 @@ protected:
int isempty (Line* __line=NULL); int isempty (Line* __line=NULL);
void killkillbuf (); void killkillbuf ();
void killpastebuf (); 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); int reflowok (char* __qstr);
void refresh (Line* __currline, uint __row); void refresh (Line* __currline, uint __row);
void savefile (int __status); void savefile (int __status);

View File

@ -949,7 +949,7 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) {
isPipe = YES; isPipe = YES;
mktemp(strxcpy(tmpfile, AddPath(CFG->temppath, "GIXXXXXX"), sizeof(Path))); mktemp(strxcpy(tmpfile, AddPath(CFG->temppath, "GIXXXXXX"), sizeof(Path)));
strxmerge(cmdline, sizeof(Path), filenamebuf.c_str()+1, " > ", tmpfile, NULL); strxmerge(cmdline, sizeof(Path), filenamebuf.c_str()+1, " > ", tmpfile, NULL);
ShellToDos(cmdline, "", NO, NO); ShellToDos(cmdline, "", BLACK|_BLACK, NO);
filenamebuf = tmpfile; filenamebuf = tmpfile;
fileselected = true; fileselected = true;
} else { } else {

View File

@ -608,7 +608,7 @@ void CreateFileMsgs(int mode, GMsg* msg) {
msg->TextToLines(CFG->dispmargin); msg->TextToLines(CFG->dispmargin);
if(specfiles > 1) if(specfiles > 1)
w_progress(MODE_QUIT, 0, 0, 0, NULL); w_progress(MODE_QUIT, BLACK|_BLACK, 0, 0, NULL);
} }

View File

@ -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; return false;
} }
@ -181,7 +181,7 @@ bool FindString(GMsg* msg, const char* prompt, int what) {
AA->set_lastread(last); AA->set_lastread(last);
} }
w_progress(MODE_QUIT, 0, 0, 0, NULL); w_progress(MODE_QUIT, BLACK|_BLACK, 0, 0, NULL);
if(breakloop) if(breakloop)
HandleGEvent(EVTT_BREAKLOOP); HandleGEvent(EVTT_BREAKLOOP);

View File

@ -46,9 +46,9 @@ Subj information = "";
Area* AA = NULL; Area* AA = NULL;
char m_title[80]; // Menu title string char m_title[80]; // Menu title string
int m_titlepos; // Menu title position int m_titlepos; // Menu title position
int m_titleattr; // Menu title color vattr m_titleattr; // Menu title color
int AreaKeys = 0; int AreaKeys = 0;
int ReadKeys = 0; int ReadKeys = 0;

View File

@ -100,9 +100,9 @@ extern Subj information;
extern Area* AA; extern Area* AA;
extern char m_title[]; extern char m_title[];
extern int m_titlepos; extern int m_titlepos;
extern int m_titleattr; extern vattr m_titleattr;
extern int AreaKeys, ReadKeys, ListKeys, NodeKeys, EditKeys, FileKeys, AddressbookKeys, HeaderKeys; extern int AreaKeys, ReadKeys, ListKeys, NodeKeys, EditKeys, FileKeys, AddressbookKeys, HeaderKeys;
extern std::list<CmdKey>::iterator AreaKey, ReadKey, ListKey, NodeKey, EditKey, FileKey, AddressbookKey, HeaderKey; extern std::list<CmdKey>::iterator AreaKey, ReadKey, ListKey, NodeKey, EditKey, FileKey, AddressbookKey, HeaderKey;

View File

@ -786,7 +786,7 @@ void Initialize(int argc, char* argv[]) {
gvid->setintensity(CFG->intensecolors); gvid->setintensity(CFG->intensecolors);
if(C_BACKB != 0) if (C_BACKB != (BLACK|_BLACK))
gvid->setoverscan(C_BACKB); gvid->setoverscan(C_BACKB);
vcurhide(); vcurhide();

View File

@ -210,8 +210,8 @@ void GMsgList::ReadMlst(int n) {
strcpy(ml->re, msg.re); strcpy(ml->re, msg.re);
{ Addr zero; { Addr zero;
ml->colorby = GetColorName(ml->by, msg.orig, -1); ml->colorby = GetColorName(ml->by, msg.orig, DEFATTR);
ml->colorto = GetColorName(ml->to, AA->isnet() ? msg.dest : zero, -1); 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); update_marks(ml);
int wattr_, hattr_, mattr_; vattr wattr_, hattr_, mattr_;
if(isbar) { if(isbar) {
wattr_ = sattr; wattr_ = sattr;
hattr_ = 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)) if (ml->high & (MLST_HIGH_BOOK|MLST_HIGH_MARK))
window.prints(pos, 5, mattr_, ml->marks); 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); 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()) !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); window.printns(pos, tocol, color, ml->to, tosiz);
} }
@ -733,7 +733,7 @@ public:
void GThreadlist::open() { 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(); update_title();
center(CFG->displistcursor); 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)); 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()) { if(msg.attr.uns() and not msg.attr.rcv() and not msg.attr.del()) {
attrw = C_MENUW_UNSENT; attrw = C_MENUW_UNSENT;
attrh = C_MENUQ_UNSENTHIGH; 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); window.prints(pos, 8, isbar ? (sattr|ACSET) : (wattr|ACSET), buf);
} }
int attr = attrw; vattr attr = attrw;
for(std::vector<Node>::iterator x = CFG->username.begin(); x != CFG->username.end(); x++) for(std::vector<Node>::iterator x = CFG->username.begin(); x != CFG->username.end(); x++)
if(strieql(msg.By(), x->name)) { if(strieql(msg.By(), x->name)) {

View File

@ -32,7 +32,7 @@
void GMnuAsk::AskInit(int __row, int __col, char* __title, int __help) { void GMnuAsk::AskInit(int __row, int __col, char* __title, int __help) {
Init(); 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); SetTitle(__title, C_ASKT);
SetBorder(W_BASK, C_ASKB); SetBorder(W_BASK, C_ASKB);
SetPos(__row, __col); SetPos(__row, __col);
@ -884,7 +884,7 @@ int GMenuEditHeader::Run(int mode, GMsg* msg) {
if(EDIT->Menu()) { if(EDIT->Menu()) {
Init(); 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); SetTitle(LNG->MsgOptions, C_MENUT);
SetBorder(W_BMENU, C_MENUB); SetBorder(W_BMENU, C_MENUB);
SetPos(6, 0); SetPos(6, 0);
@ -1014,7 +1014,7 @@ int GMenuNavigate::Run() {
Begin(M_HORZ); Begin(M_HORZ);
SetBorder(W_BASK, C_ASKB); 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); Item(TAG_MAIN, LNG->MMMain);
BeginPullDown(); BeginPullDown();
Item(TAG_MAIN_SHELL, LNG->MMShell); Item(TAG_MAIN_SHELL, LNG->MMShell);
@ -1095,7 +1095,7 @@ int GMenuSChecker::Run(CSpellChecker &schecker, const char *word)
} }
Init(); 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); SetTitle(title.c_str(), C_ASKT, TLEFT);
SetPos(6, 0, title.length()+2, 0); SetPos(6, 0, title.length()+2, 0);
SetBorder(W_BASK, C_ASKB); SetBorder(W_BASK, C_ASKB);

View File

@ -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); ResetMsg(msg);
throw_free(msg); throw_free(msg);

View File

@ -49,20 +49,20 @@ class NodelistBrowser {
public: public:
int ypos; // Window Starting Row int ypos; // Window Starting Row
int xpos; // Window Starting Column int xpos; // Window Starting Column
int ylen; // Window Height int ylen; // Window Height
int xlen; // Window Width int xlen; // Window Width
int btype; // Window Border Type int btype; // Window Border Type
int battr; // Window Border Color vattr battr; // Window Border Color
int wattr; // Window Color vattr wattr; // Window Color
int tattr; // Window Title Color vattr tattr; // Window Title Color
int sattr; // Window Selection Bar Color vattr sattr; // Window Selection Bar Color
int hattr; // Window Highlight Color vattr hattr; // Window Highlight Color
int loattr; // Window LoAttr Color vattr loattr; // Window LoAttr Color
int sbattr; // Window Scrollbar Color vattr sbattr; // Window Scrollbar Color
char* title; // Window Title char* title; // Window Title
int helpcat; // Window Help Category int helpcat; // Window Help Category
int pos; // Display Pos (1 to maxpos) int pos; // Display Pos (1 to maxpos)
int maxpos; // Display Pos int maxpos; // Display Pos

View File

@ -77,11 +77,11 @@ void LoadLanguage(const char* file);
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// GCMISC prototypes // GCMISC prototypes
int ReadHelpCfg(int force); int ReadHelpCfg(int force);
int GetColor(char* ink); vattr GetColor(char* ink);
int MakeColor(char* colors); vattr MakeColor(char* colors);
void GetColors(char* value); void GetColors(char* value);
void ReadXlatTables(); void ReadXlatTables();
// ------------------------------------------------------------------ // ------------------------------------------------------------------
@ -118,7 +118,7 @@ void SaveLines(int mode, const char* savefile, GMsg* msg, int margin, bool clip=
// GEDOSS prototypes // GEDOSS prototypes
void Cleanup(void); 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); bool FindString(GMsg* msg, const char* prompt, int what);
void FindAll(GMsg* msg, int& topline, int& keyok); void FindAll(GMsg* msg, int& topline, int& keyok);
void FindHdr(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 SearchExit();
void AdvancedSearch(GMsg* msg, int& topline, int& keyok); void AdvancedSearch(GMsg* msg, int& topline, int& keyok);
@ -405,21 +405,21 @@ int ReadCfg(const char* cfg, int ignoreunknown=false);
void ScanMsgTxtForAddr(GMsg* msg); void ScanMsgTxtForAddr(GMsg* msg);
gkey SearchKey(gkey key, std::list<CmdKey>::iterator keys, int totkeys); gkey SearchKey(gkey key, std::list<CmdKey>::iterator keys, int totkeys);
int SearchTaglist(Echo* taglist, char* tag); 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 title_shadow();
void update_statusline(const char* info); void update_statusline(const char* info);
void update_statuslinef(const char* format, const char *token, ...) __attribute__ ((format (printf, 1, 3))); void update_statuslinef(const char* format, const char *token, ...) __attribute__ ((format (printf, 1, 3)));
void update_statuslines(); void update_statuslines();
void w_info(const char* info=NULL); void w_info(const char* info=NULL);
void w_infof(const char* format, ...) __attribute__ ((format (printf, 1, 2))); 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 w_shadow();
void ZonegateIt(ftn_addr& gate, ftn_addr& orig, ftn_addr& dest); void ZonegateIt(ftn_addr& gate, ftn_addr& orig, ftn_addr& dest);
char* strtmp(const char* str); 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); void doinvalidate(char* text, const char* find, const char* replace, bool is_tearline = false);
bool find(const std::vector<const char *> &vec, const char *str); bool find(const std::vector<const char *> &vec, const char *str);
int GetColorName(const char *name, Addr &addr, int color); vattr GetColorName(const char *name, Addr &addr, vattr color);
// ------------------------------------------------------------------ // ------------------------------------------------------------------

View File

@ -567,7 +567,7 @@ int ExternUtil(GMsg *msg, ExtUtil *extutil) {
pauseval = 1; pauseval = 1;
ShellToDos(cmdline, "", ShellToDos(cmdline, "",
extutil->options & EXTUTIL_CLS ? LGREY|_BLACK : 0, extutil->options & EXTUTIL_CLS ? LGREY|_BLACK : BLACK|_BLACK,
extutil->options & EXTUTIL_CURSOR, extutil->options & EXTUTIL_CURSOR,
pauseval pauseval
); );
@ -777,7 +777,7 @@ void ReadPeekURLs(GMsg* msg) {
pauseval = 1; pauseval = 1;
ShellToDos(cmdline, "", ShellToDos(cmdline, "",
CFG->urlhandler.options & EXTUTIL_CLS ? LGREY|_BLACK : 0, CFG->urlhandler.options & EXTUTIL_CLS ? LGREY|_BLACK : BLACK|_BLACK,
CFG->urlhandler.options & EXTUTIL_CURSOR, CFG->urlhandler.options & EXTUTIL_CURSOR,
pauseval pauseval
); );
@ -827,7 +827,7 @@ void UUDecode(GMsg* msg) {
SaveLines(overwrite ? MODE_WRITE : MODE_APPEND, infile, msg, 79); SaveLines(overwrite ? MODE_WRITE : MODE_APPEND, infile, msg, 79);
} }
if(AA->Mark.Count()) 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) { else if(source == WRITE_CURRENT) {
AA->LoadMsg(msg, msg->msgno, 79); AA->LoadMsg(msg, msg->msgno, 79);
@ -903,7 +903,7 @@ void Make_Userlist(const char* userlist) {
} }
} }
throw_free(crclist); throw_free(crclist);
w_progress(MODE_QUIT, 0, 0, 0, NULL); w_progress(MODE_QUIT, BLACK|_BLACK, 0, 0, NULL);
fclose(fp); fclose(fp);
} }
@ -982,7 +982,7 @@ void make_pathreport(const char* reportfile) {
fp.printf("%s\n", path.c_str()); 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(); fp.fclose();
ResetMsg(msg); ResetMsg(msg);
throw_free(msg); throw_free(msg);

View File

@ -429,9 +429,9 @@ void search_mgr_form::select(gstrarray& menu, const char* title) {
GMnu m; GMnu m;
m.Init(); m.Init();
m.SetColor(7, 7, 7, 112, 8); m.SetColor(LGREY, LGREY, LGREY, _LGREY, DGREY);
m.SetTitle(title, 14); m.SetTitle(title, YELLOW);
m.SetBorder(0, 7); m.SetBorder(0, LGREY);
m.SetPos(srow, scol); m.SetPos(srow, scol);
m.SetMask(0); m.SetMask(0);
m.Begin(); m.Begin();
@ -520,20 +520,20 @@ bool search_mgr_form::validate() {
void AdvancedSearch(GMsg*, int&, int&) { void AdvancedSearch(GMsg*, int&, int&) {
int patterns = 9; int patterns = 9;
int width = 77; int width = 77;
int height = patterns+11; int height = patterns+11;
int widths[3] = { 55, 5, 7 }; int widths[3] = { 55, 5, 7 };
int field_widths[3] = { 100, 5, 7 }; int field_widths[3] = { 100, 5, 7 };
int border_type = BT_SINGLE; int border_type = BT_SINGLE;
int title_color = YELLOW | _BLUE; vattr title_color = YELLOW | _BLUE;
int heading_color = YELLOW | _BLUE; vattr heading_color = YELLOW | _BLUE;
int window_color = LGREY | _BLUE; vattr window_color = LGREY | _BLUE;
int border_color = LBLUE | _BLUE; vattr border_color = LBLUE | _BLUE;
int edit_color = YELLOW | _BLUE; vattr edit_color = YELLOW | _BLUE;
int idle_color = LGREY | _BLUE; vattr idle_color = LGREY | _BLUE;
int active_color = WHITE | _BLUE; vattr active_color = WHITE | _BLUE;
int shadow_color = DGREY | _BLACK; vattr shadow_color = DGREY | _BLACK;
widths[0] = width - 3*2 - 2 - 5 - 7 - 2; widths[0] = width - 3*2 - 2 - 5 - 7 - 2;

View File

@ -167,7 +167,7 @@ void guserbase::unlock() {
void guserbase::open() { 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; cwidth = (xlen-28) / 2;
window.message(LNG->UserHeaderName, TP_BORD, 3, tattr); window.message(LNG->UserHeaderName, TP_BORD, 3, tattr);

View File

@ -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 int wh = -1;
static long prev_pos = 0; 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); strcpy(m_title, t);
m_titlepos = p; 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]; char buf[MAXQUOTELEN];
uint len; uint len;

View File

@ -283,9 +283,9 @@ void ScreenBlankIdle() {
if(blanked and (whb == -1)) { if(blanked and (whb == -1)) {
wascurhid = vcurhidden(); wascurhid = vcurhidden();
vcurhide(); vcurhide();
if(C_BACKB != 0) if (C_BACKB != (BLACK|_BLACK))
gvid->setoverscan(0); gvid->setoverscan(BLACK|_BLACK);
whb = wopen(0,0,MAXROW-1,MAXCOL-1, 5, 7, 7); whb = wopen(0,0,MAXROW-1,MAXCOL-1, 5, LGREY, LGREY);
if(CFG->screenblankertype == BLANK_SLIDEWIN) if(CFG->screenblankertype == BLANK_SLIDEWIN)
whh = wopen_(ry, rx, windowheight, blankmsglen+2, W_BINFO, C_INFOB, C_INFOW); whh = wopen_(ry, rx, windowheight, blankmsglen+2, W_BINFO, C_INFOB, C_INFOW);
lastmoved = gkbd.tickvalue; lastmoved = gkbd.tickvalue;
@ -300,7 +300,7 @@ void ScreenBlankIdle() {
wactiv_(whb); wactiv_(whb);
wclose(); wclose();
whb = -1; whb = -1;
if(C_BACKB != 0) if (C_BACKB != (BLACK|_BLACK))
gvid->setoverscan(C_BACKB); gvid->setoverscan(C_BACKB);
if(wascurhid) if(wascurhid)
vcurhide(); 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 addr_valid = addr.valid();
bool name_valid = (name != NULL); bool name_valid = (name != NULL);
@ -338,7 +338,7 @@ int GetColorName(const char *name, Addr &addr, int color)
if (!addr_valid && !name_valid) if (!addr_valid && !name_valid)
return color; return color;
std::vector< std::pair<Node, int> >::iterator it; std::vector< std::pair<Node, vattr> >::iterator it;
for (it = CFG->colorname.begin(); it != CFG->colorname.end(); it++) for (it = CFG->colorname.begin(); it != CFG->colorname.end(); it++)
{ {
if (addr_valid && addr.match(it->first.addr)) if (addr_valid && addr.match(it->first.addr))

View File

@ -214,7 +214,7 @@ void GMsgHeaderView::Paint() {
strsetsz(buf, nodegenerated ? namewidth : (namewidth+nodewidth)); strsetsz(buf, nodegenerated ? namewidth : (namewidth+nodewidth));
window.prints(2, 0, window_color, LNG->From); 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); color = GetColorName(msg->By(), msg->orig, color);
window.prints(2, CFG->disphdrnameset.pos, color, buf); 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; scrollbar_visible = CFG->switches.get(disppagebar) ? (msg->lines > height) : false;
visible_width = scrollbar_visible ? width-1 : width; 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; int vrow = gwin.active->srow + row;
uint llen = line->txt.length(); 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 // Trim line if it longer than should be. This actually happens in very rare
// cases, but always when hex dump displayed. // cases, but always when hex dump displayed.
@ -475,16 +475,16 @@ void GMsgBodyView::PaintLine(int row, Line *line) {
// Print it // Print it
if(not SearchHighlight(line, vrow, visible_width, highlight_color)) { if(not SearchHighlight(line, vrow, visible_width, highlight_color)) {
if(line->type & GLINE_ORIG and strneql(line->txt.c_str(), " * Origin: ", 11)) { 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); StyleCodeHighlight(line->txt.c_str()+11, vrow, 11, not AA->attr().hex() and AA->adat->hidestylies, color);
} }
else else
StyleCodeHighlight(line->txt.c_str(), vrow, 0, not AA->attr().hex() and AA->adat->hidestylies, color); StyleCodeHighlight(line->txt.c_str(), vrow, 0, not AA->attr().hex() and AA->adat->hidestylies, color);
int tlen = strlen(line->txt.c_str()); int tlen = strlen(line->txt.c_str());
vputns(vrow, tlen, color, "", visible_width-tlen); printns(vrow, tlen, color, "", visible_width-tlen);
} }
else 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); 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);
}
// ------------------------------------------------------------------

View File

@ -45,20 +45,20 @@ public:
~GMsgHeaderView(); ~GMsgHeaderView();
// Window setup // Window setup
int at_row; int at_row;
int at_column; int at_column;
int width; int width;
int height; int height;
int border_type; int border_type;
int border_color; vattr border_color;
int window_color; vattr window_color;
int title_color; vattr title_color;
int highlight_color; vattr highlight_color;
int from_color; vattr from_color;
int to_color; vattr to_color;
int subject_color; vattr subject_color;
int location_color; vattr location_color;
void Use(Area *areaptr, GMsg *msgptr); void Use(Area *areaptr, GMsg *msgptr);
@ -87,7 +87,8 @@ protected:
void PaintLine(int row, Line *line); void PaintLine(int row, Line *line);
void UpdateScrollbar(); 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: public:
@ -99,16 +100,15 @@ public:
~GMsgBodyView(); ~GMsgBodyView();
// Window setup // Window setup
int at_row; int at_row;
int at_column; int at_column;
int width; int width;
int height; int height;
int border_type; int border_type;
int border_color; vattr border_color;
int window_color; vattr window_color;
int scrollbar_color; vattr scrollbar_color;
vattr highlight_color;
int highlight_color;
void Use(Area *areaptr, GMsg *msgptr, int startline=0); void Use(Area *areaptr, GMsg *msgptr, int startline=0);

View File

@ -46,23 +46,23 @@ class GMnu {
protected: protected:
int bordertype; int bordertype;
int bordercolor; vattr bordercolor;
int textcolor; vattr textcolor;
int quickcolor; vattr quickcolor;
int noselcolor; vattr noselcolor;
int barcolor; vattr barcolor;
int shadowcolor; vattr shadowcolor;
const char* title; const char* title;
int titlepos; int titlepos;
int titlecolor; vattr titlecolor;
int deschdl; int deschdl;
int descrow; int descrow;
int desccolumn; int desccolumn;
int desccolor; vattr desccolor;
int helpnumber; int helpnumber;
@ -95,11 +95,11 @@ public:
void Init(); void Init();
void SetBorder(int type, int color); void SetBorder(int type, vattr color);
void SetColor(int text, int quick, int nosel, int bar, int shadow=-1); void SetColor(vattr text, vattr quick, vattr nosel, vattr bar, vattr shadow = DEFATTR);
void SetTitle(const char* title, int color, int pos=TCENTER); void SetTitle(const char* title, vattr color, int pos=TCENTER);
void SetTitle(const char* title); 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 SetPos(int row, int col, int width=0, int height=0);
void SetEsc(int option); void SetEsc(int option);
void SetHelp(int help); void SetHelp(int help);

View File

@ -31,6 +31,7 @@
// ------------------------------------------------------------------ // ------------------------------------------------------------------
#include <gdefs.h> #include <gdefs.h>
#if defined(__USE_NCURSES__) #if defined(__USE_NCURSES__)
#include <gcurses.h> #include <gcurses.h>
@ -38,11 +39,97 @@
#if defined(__WIN32__) #if defined(__WIN32__)
#include <windows.h> #include <windows.h>
#endif #endif
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma warning(disable: 4200) #pragma warning(disable: 4200)
#endif #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() // Display adapter types returned from vidtype()
// If bit 0 is set, the adapter was detected in monochrome mode // If bit 0 is set, the adapter was detected in monochrome mode
@ -145,68 +232,6 @@ struct __int10_ah1b_statebuf {
#endif #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 // Border types
@ -226,29 +251,32 @@ struct __int10_ah1b_statebuf {
struct GVidInfo { struct GVidInfo {
// Screen info // Screen info
struct { struct _screen
int mode; // Video mode {
int rows; // Number of rows int mode; // Video mode
int columns; // Number of columns int rows; // Number of rows
int cheight; // Character height int columns; // Number of columns
int cwidth; // Character width int cheight; // Character height
int cwidth; // Character width
} screen; } screen;
// Cursor info // Cursor info
struct { struct _cursor
int column; // Cursor column {
int row; // Cursor row int column; // Cursor column
int start; // Cursor start line int row; // Cursor row
int end; // Cursor end line int start; // Cursor start line
word attr; // Cursor attribute. Hidden if attr == 0xFFFF int end; // Cursor end line
word attr; // Cursor attribute. Hidden if attr == 0xFFFF
} cursor; } cursor;
// Colors // Colors
struct { struct _color
int textattr; // Text attribute {
int overscan; // Overscan color vattr textattr; // Text attribute
int intensity; // Background color state (intense or blinking) vattr overscan; // Overscan color
int palette[16]; // Palette state int intensity; // Background color state (intense or blinking)
int palette[16]; // Palette state
} color; } color;
}; };
@ -261,19 +289,6 @@ typedef uint32_t gdma; // Video DMA linear address
typedef word* gdma; // Video DMA pointer typedef word* gdma; // Video DMA pointer
#endif #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 // Video information record
@ -322,7 +337,7 @@ public:
void setmode (int _mode); void setmode (int _mode);
void setrows (int _rows); void setrows (int _rows);
void setoverscan (int _overscan); void setoverscan (vattr _overscan);
void setintensity (int _intensity); void setintensity (int _intensity);
void getpalette (int* _palette); void getpalette (int* _palette);
@ -361,31 +376,31 @@ chtype _box_table(int type, int c);
int setvparam (int setting); int setvparam (int setting);
int mapattr (int attr); vattr mapattr (vattr attr);
int revsattr (int 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 vputw (int row, int col, vatch chat);
void vputws (int row, int col, vatch* buf, uint len); void vputws (int row, int col, vatch* buf, uint len);
void vputc (int row, int col, int atr, vchar chr); void vputc (int row, int col, vattr atr, vchar chr);
void vputvs (int row, int col, int atr, const vchar* str); void vputvs (int row, int col, vattr atr, const vchar* str);
void vputs (int row, int col, int atr, const char* str); void vputs (int row, int col, vattr atr, const char* str);
void vputs_box (int row, int col, int atr, const char* str); void vputs_box (int row, int col, vattr atr, const char* str);
void vputns (int row, int col, int atr, const char* str, uint len); void vputns (int row, int col, vattr atr, const char* str, uint len);
void vputx (int row, int col, int atr, vchar chr, uint len); void vputx (int row, int col, vattr atr, vchar chr, uint len);
void vputy (int row, int col, int atr, vchar chr, uint len); void vputy (int row, int col, vattr atr, vchar chr, uint len);
vatch vgetw (int row, int col); 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 vposget (int* row, int* col);
void vposset (int row, int col); void vposset (int row, int col);
void vclrscr (); void vclrscr ();
void vclrscr (int atr); // Overloaded void vclrscr (vattr atr); // Overloaded
typedef struct _vsavebuf { typedef struct _vsavebuf {
int top, left, right, bottom; int top, left, right, bottom;
@ -404,19 +419,9 @@ bool vcurhidden ();
void vcurlarge (); void vcurlarge ();
void vcursmall (); void vcursmall ();
void vbox (int srow, int scol, int erow, int ecol, int box, int hiattr, int loattr=-1); 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, int atr); 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__) #if defined(__USE_NCURSES__)
@ -424,29 +429,31 @@ int gvid_dosattrcalc (int ourattr);
int gvid_attrcalc (int dosattr); int gvid_attrcalc (int dosattr);
inline vchar vgchar (vatch chat) { return chat & (A_CHARTEXT | A_ALTCHARSET); } 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 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 vsattr (vatch chat, vattr atr) { return (chat & (A_CHARTEXT | A_ALTCHARSET)) | gvid_attrcalc(atr); }
inline vatch vcatch (vchar chr, int atr) { return chr | gvid_attrcalc(atr); } inline vatch vcatch (vchar chr, vattr atr) { return chr | gvid_attrcalc(atr); }
#elif defined(__WIN32__) #elif defined(__WIN32__)
inline vchar vgchar (vatch chat) { return chat.Char.AsciiChar; } 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 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 vsattr (vatch chat, vattr 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 vcatch (vchar chr, vattr atr) { vatch chat; chat.Char.UnicodeChar = 0; chat.Char.AsciiChar = chr; chat.Attributes = atr; return chat; }
#else #else
inline vchar vgchar (vatch chat) { return chat & 0xff; } 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 vschar (vatch chat, vchar chr) { return (chat & 0xff00) | chr; }
inline vatch vsattr (vatch chat, int atr) { return (chat & 0xff) | (atr << 8); } inline vatch vsattr (vatch chat, vattr atr) { return (chat & 0xff) | (atr << 8); }
inline vatch vcatch (vchar chr, int atr) { return (chr & 0xff) | ((atr << 8) & 0xff00); } inline vatch vcatch (vchar chr, vattr atr) { return (chr & 0xff) | ((atr << 8) & 0xff00); }
#endif #endif
inline vchar vgetc (int row, int col) { return vgchar(vgetw(row, col)); }
typedef void (*VidPutStrCP)(int,int,int,const char*); typedef void (*VidPutStrCP)(int,int,int,const char*);
void gvid_boxcvt(char* s); void gvid_boxcvt(char* s);

View File

@ -365,8 +365,8 @@ void vputansi(int row, int col, word* buf, int len) {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Converts an attribute to monochrome equivalent // Converts an attribute to monochrome equivalent
int mapattr(int attr) { vattr mapattr(vattr attr)
{
switch(attr&112) { // test for a light background switch(attr&112) { // test for a light background
case _LGREY: case _LGREY:
@ -391,9 +391,9 @@ int mapattr(int attr) {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Reverses the attribute given // Reverses the attribute given
int revsattr(int attr) { vattr revsattr(vattr attr)
{
return (int)(((attr>>4)&0x07)|((attr<<4)&0x70)|(attr&0x80)|(attr&0x08)); return (vattr)(((attr>>4)&0x07)|((attr<<4)&0x70)|(attr&0x80)|(attr&0x08));
} }
#if !defined(__USE_NCURSES__) #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 // 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__) #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 // 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__) #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 // 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__) #if defined(__USE_NCURSES__)
uint counter; uint counter;
int len = strlen(str); int len = strlen(str);
@ -796,7 +796,7 @@ void vputs_box(int row, int col, int atr, const char* str) {
#endif #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__) #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 // 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 = ' '; 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 // 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__) #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 // 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__) #if defined(__USE_NCURSES__)
@ -1224,11 +1224,11 @@ vatch vgetw(int row, int col) {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Get character and attribute at cursor position // 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)) { if((row < 0) or (row > gvid->numrows-1) or (col < 0) or (col > gvid->numcols-1)) {
*chr = ' '; *chr = ' ';
*atr = 0; *atr = BLACK|_BLACK;
} }
else { else {
vatch tmp = vgetw(row, col); 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 // 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__) #if defined(__USE_NCURSES__)
@ -1485,7 +1485,7 @@ void vclrscr() {
// Clears the screen using given attribute and homes the cursor // Clears the screen using given attribute and homes the cursor
#if (defined(__MSDOS__) || defined(__UNIX__)) && !defined(__USE_NCURSES__) #if (defined(__MSDOS__) || defined(__UNIX__)) && !defined(__USE_NCURSES__)
static void _vclrscr(int atr) { static void _vclrscr(vattr atr) {
int len = gvid->numrows * gvid->numcols; 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 // Clears the screen using given attribute and homes the cursor
void vclrscr(int atr) { void vclrscr(vattr atr) {
#if defined(__USE_NCURSES__) #if defined(__USE_NCURSES__)
@ -2147,9 +2147,9 @@ static uint32_t gvid_boxcvtc(char c) {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Draws a text box on the screen // Draws a text box on the screen
void vbox(int srow, int scol, int erow, int ecol, int box, int hiattr, int loattr) { void vbox(int srow, int scol, int erow, int ecol, int box, vattr hiattr, vattr loattr)
{
if(loattr == -1) if (loattr == DEFATTR)
loattr = hiattr; loattr = hiattr;
else if(loattr == -2) else if(loattr == -2)
loattr = (int)((hiattr & 0x08) ? (hiattr & 0xF7) : (hiattr | 0x08)); 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 // 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; int width = ecol-scol+1;
for(int crow=srow; crow<=erow; crow++) for(int crow=srow; crow<=erow; crow++)

View File

@ -439,8 +439,8 @@ int GVid::detectadapter() {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Video info detect // Video info detect
void GVid::detectinfo(GVidInfo* _info) { void GVid::detectinfo(GVidInfo* _info)
{
// Reset all original values // Reset all original values
memset(_info, 0, sizeof(GVidInfo)); memset(_info, 0, sizeof(GVidInfo));
@ -826,7 +826,7 @@ void GVid::setrows(int _rows) {
#endif #endif
if(origrows < _rows) if(origrows < _rows)
vfill(origrows, 0, _rows, 80, ' ', 7); vfill(origrows, 0, _rows, 80, ' ', LGREY);
detectinfo(&curr); detectinfo(&curr);
resetcurr(); resetcurr();
@ -836,8 +836,8 @@ void GVid::setrows(int _rows) {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Set the screen border (overscan) color // Set the screen border (overscan) color
void GVid::setoverscan(int _overscan) { void GVid::setoverscan(vattr _overscan)
{
#if defined(__USE_NCURSES__) #if defined(__USE_NCURSES__)
NW (_overscan); NW (_overscan);
@ -871,8 +871,8 @@ void GVid::setoverscan(int _overscan) {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Set intensity/blinking state // Set intensity/blinking state
void GVid::setintensity(int _intensity) { void GVid::setintensity(int _intensity)
{
#if defined(__USE_NCURSES__) #if defined(__USE_NCURSES__)
NW(_intensity); 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__) #if defined(__USE_NCURSES__)
NW(_palette); 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__) #if defined(__USE_NCURSES__)
NW(_palette); NW(_palette);

View File

@ -119,7 +119,7 @@ struct _item_t {
int dwhdl; // description window handle int dwhdl; // description window handle
int dwrow; // description window row int dwrow; // description window row
int dwcol; // description window column int dwcol; // description window column
int dattr; // description attribute vattr dattr; // description attribute
int redisp; // redisplay flag int redisp; // redisplay flag
}; };
@ -141,21 +141,21 @@ struct _menu_t {
int erow; // ending row of menu window int erow; // ending row of menu window
int ecol; // ending column of menu window int ecol; // ending column of menu window
int btype; // menu window border type int btype; // menu window border type
int battr; // menu window "hi" border attribute vattr battr; // menu window "hi" border attribute
int loattr; // menu window "lo" border attribute vattr loattr; // menu window "lo" border attribute
int sbattr; // menu window scrollbar attribute vattr sbattr; // menu window scrollbar attribute
int wattr; // menu window attribute vattr wattr; // menu window attribute
int menutype; // menu type mask int menutype; // menu type mask
int barwidth; // width of menu bar or zero int barwidth; // width of menu bar or zero
int textpos; // offset of text from start of bar int textpos; // offset of text from start of bar
int textattr; // attribute of menu text vattr textattr; // attribute of menu text
int scharattr; // attribute of selection character vattr scharattr; // attribute of selection character
int noselattr; // non-selectable text attribute vattr noselattr; // non-selectable text attribute
int barattr; // attribute of selection bar vattr barattr; // attribute of selection bar
const char* title; // menu title string or NULL if no title const char* title; // menu title string or NULL if no title
int titlepos; // position of menu title (TLEFT,TCENTER,TRIGHT) int titlepos; // position of menu title (TLEFT,TCENTER,TRIGHT)
int titleattr; // attribute of menu title vattr titleattr; // attribute of menu title
int shadattr; // shadow attribute or -1 if no shadow vattr shadattr; // shadow attribute or -1 if no shadow
int items; // number of items in menu int items; // number of items in menu
bool hotkey; bool hotkey;
}; };
@ -226,17 +226,17 @@ struct _wrec_t {
int erow; // end row of window int erow; // end row of window
int ecol; // end column of window int ecol; // end column of window
int btype; // window's box type int btype; // window's box type
int wattr; // window's initial text attribute vattr wattr; // window's initial text attribute
int battr; // attribute of window's border vattr battr; // attribute of window's border
int loattr; // attribute of window's border vattr loattr; // attribute of window's border
int sbattr; // attribute of window's scrollbar vattr sbattr; // attribute of window's scrollbar
int border; // has border? 0 = no, 1 = yes int border; // has border? 0 = no, 1 = yes
int row; // window's current cursor row int row; // window's current cursor row
int column; // window's current cursor column 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 tpos; // position of window's title
int tattr; // attribute of window's title vattr tattr; // attribute of window's title
int wsattr; // attribute of window's shadow vattr wsattr; // attribute of window's shadow
}; };
@ -345,8 +345,8 @@ int wactiv (int whandle);
int wactiv_ (int whandle); int wactiv_ (int whandle);
int wborder (int btype); int wborder (int btype);
int wbox (int wsrow, int wscol, int werow, int wecol, int btype, int attr); int wbox (int wsrow, int wscol, int werow, int wecol, int btype, int attr);
int wcclear (int attr); int wcclear (vattr attr);
int wcenters (int wrow, int attr, const char* str); int wcenters (int wrow, vattr attr, const char* str);
int wchkbox (int wsrow, int wscol, int werow, int wecol); int wchkbox (int wsrow, int wscol, int werow, int wecol);
int wchkcol (int wcol); int wchkcol (int wcol);
int wchkcoord (int wrow, 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 wdelline (int wrow, int direc);
int wdrag (int direction); int wdrag (int direction);
int wdupc (char ch, int count); 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); _wrec_t* wfindrec (int whandle);
int wgotoxy (int wrow, int wcol); int wgotoxy (int wrow, int wcol);
int whandle (); int whandle ();
int whide (); int whide ();
int whline (int wsrow, int wscol, int count, int btype, int attr); int whline (int wsrow, int wscol, int count, int btype, vattr attr);
int wmessage (const char* str, int border, int leftofs, int attr); int wmessage (const char* str, int border, int leftofs, vattr attr);
int wmove (int nsrow, int nscol); 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); 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, 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); } 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); 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); 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, 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 wprintc (int wrow, int wcol, int attr, vchar ch); int wprintc (int wrow, int wcol, vattr attr, vchar ch);
int wprintf (const char* format, ...) __attribute__ ((format (printf, 1, 2))); int wprintf (const char* format, ...) __attribute__ ((format (printf, 1, 2)));
int wprintaf (int attr, const char* format, ...) __attribute__ ((format (printf, 2, 3))); 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 wprintfs (int wrow, int wcol, vattr attr, const char* format, ...) __attribute__ ((format (printf, 4, 5)));
int wprints (int wrow, int wcol, int attr, const char* str); int wprints (int wrow, int wcol, vattr attr, const char* str);
int wprints_box (int wrow, int wcol, int attr, const char* str); int wprints_box (int wrow, int wcol, vattr attr, const char* str);
int wprintvs (int wrow, int wcol, int attr, const vchar* str); int wprintvs (int wrow, int wcol, vattr attr, const vchar* str);
int wprintns (int wrow, int wcol, int attr, const char* str, uint len, vchar fill=' ', int fill_attr=-1); 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, int attr, const char* format, const char* str); int wprintsf (int wrow, int wcol, vattr attr, const char* format, const char* str);
int wprintws (int wrow, int wcol, vatch* buf, uint len); 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 wputc (vchar ch);
int wputs (const char* str); int wputs (const char* 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);
int wputy (int wrow, int wcol, int attr, vchar chr, uint len); int wputy (int wrow, int wcol, vattr attr, vchar chr, uint len);
int wreadcur (int* wrow, int* wcol); int wreadcur (int* wrow, int* wcol);
int wscroll (int count, int direc); int wscroll (int count, int direc);
void wscrollbar (int orientation, uint total, uint maxpos, uint pos, int sadd=0); 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 wscrollbox (int wsrow, int wscol, int werow, int wecol, int count, int direction);
int wshadoff (); int wshadoff ();
int wshadow (int attr); int wshadow (vattr attr);
int wsize (int nerow, int necol); int wsize (int nerow, int necol);
int wslide (int nsrow, int nscol); int wslide (int nsrow, int nscol);
void wtextattr (int attr); void wtextattr (vattr attr);
int wtitle (const char* str, int tpos, int tattr); int wtitle (const char* str, int tpos, vattr tattr);
int wunhide (int whandle); int wunhide (int whandle);
int wunlink (int w); int wunlink (int w);
int wvline (int wsrow, int wscol, int count, int btype, int attr); int wvline (int wsrow, int wscol, int count, int btype, vattr attr);
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);
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);
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);
int wmenubeg (int srow, int scol, int erow, int ecol, int btype, int battr, int wattr, VfvCP open, int menutype=M_VERT); 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, 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); } 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 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 wmenuget ();
int wmenuiba (VfvCP before, VfvCP after); int wmenuiba (VfvCP before, VfvCP after);
int wmenuidsab (int tagid); int wmenuidsab (int tagid);
@ -415,13 +415,13 @@ int wmenuienab (int tagid);
_item_t* wmenuifind (int tagid); _item_t* wmenuifind (int tagid);
int wmenuinext (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 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 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 int wclear () { return wcclear(gwin.active->wattr); }
inline void wfillch (vchar a) { gwin.fillch=a; } 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 _menu_t* wmenumcurr () { return gwin.cmenu; }
inline _item_t* wmenuicurr () { return wmenumcurr()->citem; } 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; }
// ------------------------------------------------------------------ // ------------------------------------------------------------------

View File

@ -124,7 +124,7 @@ int wgotoxy(int wrow, int wcol) {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Opens a window and makes it active // 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 // check for valid box type
if(btype<0 or btype>7) { if(btype<0 or btype>7) {
@ -279,7 +279,7 @@ int wcloseall() {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Gives active window a shadow // Gives active window a shadow
int wshadow(int attr) { int wshadow(vattr attr) {
// check for active window // check for active window
if(!gwin.total) if(!gwin.total)
@ -408,7 +408,7 @@ int wshadoff() {
throw_xrelease(gwin.active->wsbuf); throw_xrelease(gwin.active->wsbuf);
// update window's record // update window's record
gwin.active->wsattr = 0xFF; gwin.active->wsattr = WHITE|_WHITE;
// return with no error // return with no error
return gwin.werrno=W_NOERROR; return gwin.werrno=W_NOERROR;
@ -427,7 +427,7 @@ int wscroll(int count, int direction) {
gwin.active->srow + border, gwin.active->srow + border,
gwin.active->scol + border, gwin.active->scol + border,
gwin.active->erow - 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, gwin.active->wattr,
direction == SUP ? count : -count direction == SUP ? count : -count
); );
@ -570,7 +570,7 @@ int wdupc(char ch, int count) {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Clears the active window in specified attribute // Clears the active window in specified attribute
int wcclear(int attr) { int wcclear(vattr attr) {
// check for active window // check for active window
@ -658,14 +658,14 @@ int wclreos() {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// This function will process an Escape sequence when encountered // 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; int wrow,wcol;
const char *p = str; const char *p = str;
for(; *p==ESC; p++) { for(; *p==ESC; p++) {
int attr = gwin.active->attr; vattr attr = gwin.active->attr;
switch(*(++p)) { switch(*(++p)) {
@ -811,7 +811,7 @@ int wputs(const char* str) {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Displays a character inside active window // 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 // check for active window
if(!gwin.total) if(!gwin.total)
@ -853,7 +853,7 @@ int wprintf(const char* format, ...) {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Print a formatted string at a specific position and attribute // 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; va_list argptr;
char buf[256]; char buf[256];
@ -872,7 +872,7 @@ int wprintfs(int wrow, int wcol, int attr, const char* format, ...) {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Displays a string inside active window // 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 // check for active window
if(!gwin.total) if(!gwin.total)
@ -889,7 +889,7 @@ int wprints(int wrow, int wcol, int attr, const char* str) {
return gwin.werrno=W_NOERROR; 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 // check for active window
if(!gwin.total) 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 // 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 // check for active window
if(!gwin.total) 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; const int &border = gwin.active->border;
vputx(gwin.active->srow+wrow+border,gwin.active->scol+wcol+border,attr,chr,len); 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; const int &border = gwin.active->border;
vputy(gwin.active->srow+wrow+border,gwin.active->scol+wcol+border,attr,chr,len); 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 // 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* istr = throw_xstrdup(str);
char* ostr = istr; char* ostr = istr;
char och = *ostr; 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) if(len < olen)
*ostr = och; *ostr = och;
else if(len > olen) 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); throw_xfree(istr);
return retval; return retval;
} }
@ -1039,9 +1039,9 @@ _wrec_t* wfindrec(int whandle) {
int whide() { int whide() {
vsavebuf* p; vsavebuf *p;
int shattr; vattr shattr;
_wrec_t *temp; _wrec_t *temp;
// check for active window // check for active window
if(!gwin.total) if(!gwin.total)
@ -1057,7 +1057,7 @@ int whide() {
gwin.active->wsattr = shattr; gwin.active->wsattr = shattr;
} }
else { else {
gwin.active->wsattr = -1; gwin.active->wsattr = DEFATTR;
} }
// restore contents of active window's buffer // restore contents of active window's buffer
@ -1152,7 +1152,7 @@ int wunhide(int whandle) {
gwin.total++; gwin.total++;
// if window had a shadow before hiding, give it one again // 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); wshadow(gwin.active->wsattr);
// update help category // update help category
@ -1223,8 +1223,8 @@ int wunlink(int w) {
// Local variables // Local variables
static _wrec_t *__curr, *__found; static _wrec_t *__curr, *__found;
static int __crow, __ccol; static int __crow, __ccol;
static int __gattr; static vattr __gattr;
static const char* __p; 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. // shadow, reflect the character on the screen.
temp = vgetw(__crow, __ccol); temp = vgetw(__crow, __ccol);
if(shadow&2) if(shadow&2)
*pcurr = vschar(*pcurr, vgchar(temp)); *pcurr = vschar(*pcurr, vgchar(temp));
chat = ((vgattr(temp) & BLINK) and shadow) ? vsattr(*pcurr, vgattr(*pcurr) | BLINK) : *pcurr; 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) { static void update_buffers(vatch* pcurr, int shadow) {
_wrec_t* tcurr; _wrec_t *tcurr;
int tgattr; vattr tgattr;
// put current string character and attribute into found window's buffer // 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 // check for existance of active window or hidden windows
if(!gwin.total and gwin.hidden==NULL) 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 // check for existance of active window or hidden windows
if(!gwin.total and gwin.hidden==NULL) 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 // check for existance of active window or hidden windows
if(!gwin.total and gwin.hidden==NULL) 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 // 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 // check for active window
if(!gwin.total) if(!gwin.total)
@ -1878,7 +1879,7 @@ int whandle() {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Displays text on window's top or bottom border // 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 // check for active window
if(!gwin.total) if(!gwin.total)
@ -1912,7 +1913,7 @@ int wmessage(const char* str, int border, int leftofs, int attr) {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Proportion bar // 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. // xx, yy = start position in window.
// len = length (in chars) of progress field. // 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); const vchar barchar = _box_table(gwin.active->btype, 13);
#ifdef __UNIX__ // prefferable under xterm #ifdef __UNIX__ // prefferable under xterm
const vchar thumbchar = ' '; const vchar thumbchar = ' ';
int thumbattr = revsattr(attr); vattr thumbattr = revsattr(attr);
#else #else
const vchar thumbchar = '\xDB'; const vchar thumbchar = '\xDB';
int thumbattr = attr; vattr thumbattr = attr;
#endif #endif
long thumblen = (pos*len)/size; 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 // 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 // check for active window
if(!gwin.total) 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) { void wscrollbar(int orientation, uint total, uint maxpos, uint pos, int sadd) {
int attr = (gwin.active->sbattr == -1) ? gwin.active->battr : gwin.active->sbattr; vattr attr = (gwin.active->sbattr == DEFATTR) ? gwin.active->battr : gwin.active->sbattr;
int invattr = revsattr(attr); vattr invattr = revsattr(attr);
const vchar barchar = _box_table(gwin.active->btype, 13); const vchar barchar = _box_table(gwin.active->btype, 13);
const vchar arrowupchar = '\x18'; const vchar arrowupchar = '\x18';
@ -2033,10 +2034,10 @@ void wscrollbar(int orientation, uint total, uint maxpos, uint pos, int sadd) {
const vchar arrowrightchar = '\x1A'; const vchar arrowrightchar = '\x1A';
#ifdef __UNIX__ // prefferable under xterm #ifdef __UNIX__ // prefferable under xterm
const vchar thumbchar = ' '; const vchar thumbchar = ' ';
int thumbattr = revsattr(attr); vattr thumbattr = revsattr(attr);
#else #else
const vchar thumbchar = '\xDB'; const vchar thumbchar = '\xDB';
int thumbattr = attr; vattr thumbattr = attr;
#endif #endif
if(maxpos == 0) if(maxpos == 0)

View File

@ -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]; char buf[255];
va_list argptr; 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; va_list argptr;
char buf[256]; char buf[256];

View File

@ -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); 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_style;
int window_color; vattr window_color;
int border_hi_color; vattr border_hi_color;
int border_lo_color; vattr border_lo_color;
int scrollbar_color; vattr scrollbar_color;
int title_color; vattr title_color;
int title_position; int title_position;
int message_color; vattr message_color;
int shadow_color; vattr shadow_color;
public: public:
@ -146,8 +146,8 @@ public:
void set_window_at(int srow, int scol); void set_window_at(int srow, int scol);
void set_window_size(int vlen, int hlen); 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 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, int bcolor, int wcolor, int sbcolor=-1, int locolor=-1); 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 open();
void close(); void close();
void unlink(); void unlink();
@ -162,16 +162,16 @@ public:
int cursor_row(); int cursor_row();
int cursor_column(); int cursor_column();
void text_color(int color); void text_color(vattr color);
void move_cursor(int row, int column); 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 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 no_shadow();
void set_vscrollbar_range(int minpos, int maxpos, int visible, int total, int redraw); 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_vscrollbar_pos(int pos, int redraw);
void set_hscrollbar_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 vscrollbar(uint total, uint maxpos, uint pos, int sadd=0);
void hscrollbar(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_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 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 putc(vchar ch);
void puts(const char* text); void puts(const char* text);
void printc(int row, int col, int color, vchar ch); void printc(int row, int col, vattr color, vchar ch);
void prints(int row, int col, int color, const char* text); void prints(int row, int col, vattr color, const char* text);
void printvs(int row, int col, int color, const vchar* text); void printvs(int row, int col, vattr color, const vchar* text);
void prints(int row, int col, int color, const std::string& text); void prints(int row, int col, vattr 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 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(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, 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_char(vchar ch);
void fill(int wsrow, int wscol, int werow, int wecol, vchar ch, int color); 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, int 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, int color); void horizontal_line(int wsrow, int wscol, int count, int btype, vattr color);
void clear(int color=-1); void clear(vattr color = DEFATTR);
void clear_eol(); void clear_eol();
void drag(int direction, int howmuch=1); void drag(int direction, int howmuch=1);
void slide(int row, int col); void slide(int row, int col);
void putx(int wrow, int wcol, int color, char chr, uint len); void putx(int wrow, int wcol, vattr color, char chr, uint len);
void print_center(int row, int color, const char* text); void print_center(int row, vattr color, const char* text);
}; };
@ -230,8 +230,8 @@ inline void gwindow::init() {
window_style = 0; window_style = 0;
window_color = BLACK|_LGREY; window_color = BLACK|_LGREY;
border_hi_color = BLUE|_LGREY; border_hi_color = BLUE|_LGREY;
border_lo_color = -1; border_lo_color = DEFATTR;
scrollbar_color = -1; scrollbar_color = DEFATTR;
title_color = BLUE|_LGREY; title_color = BLUE|_LGREY;
title_position = title_center; title_position = title_center;
message_color = BLUE|_LGREY; 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_row = srow;
start_column = scol; 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); 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; window_color = color;
activate_quick(); 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; wrec->sbattr = color;
scrollbar_color = 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; title_color = color;
if(position != -1) if(position != -1)
title_position = position; 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; message_color = color;
activate_quick(); activate_quick();
wmessage(text, border, leftofs, message_color); 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; shadow_color = color;
activate_quick(); activate_quick();
wshadow(shadow_color); 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(); activate_quick();
wgetc(row, col, atr, chr); 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(); activate_quick();
wprintc(row, col, color, ch); 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(); 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(); 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()); 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(); activate_quick();
wprintns(row, col, color, text, len, fill, fill_color); 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(); activate_quick();
wfill(wsrow, wscol, werow, wecol, ch, color); 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(); activate_quick();
wvline(wsrow, wscol, count, btype, color); 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(); activate_quick();
whline(wsrow, wscol, count, btype, color); 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(); 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(); activate_quick();
wcenters(row, color, text); wcenters(row, color, text);

View File

@ -46,10 +46,10 @@ public:
const char* file; // help file name const char* file; // help file name
int helpptr; // help stack pointer int helpptr; // help stack pointer
gkey key; // help hot key gkey key; // help hot key
int winattr; // help window attribute vattr winattr; // help window attribute
int textattr; // help window text attribute vattr textattr; // help window text attribute
int selattr; // selection text attribute vattr selattr; // selection text attribute
int barattr; // selection bar attribute vattr barattr; // selection bar attribute
int srow; // help window start row int srow; // help window start row
int scol; // help window start column int scol; // help window start column
int erow; // help window end row int erow; // help window end row
@ -59,6 +59,27 @@ public:
VfvCP open; // pointer to open function VfvCP open; // pointer to open function
gfile* fp; // help file gfile* fp; // help file
long offset; // help file offset 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 whelpcat(int cat);
int whelpclr(); 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 whelpop();
int whelpopc(); int whelpopc();
int whelppcat(int cat); int whelppcat(int cat);
@ -92,7 +113,7 @@ int whelpush();
int whelpushc(int cat); int whelpushc(int cat);
int whelpwin(int srow, int scol, int erow, int ecol, int btype, int title); int whelpwin(int srow, int scol, int erow, int ecol, int btype, int title);
void whelpcompile(const char* helpfile, long& offset); 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); }
// ------------------------------------------------------------------ // ------------------------------------------------------------------

View File

@ -71,10 +71,7 @@ static char* catarray[MAXXREF];
static int arraycnt = 0; static int arraycnt = 0;
static char buf[BUFSIZE+1]; static char buf[BUFSIZE+1];
_help_t whelp = { _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
};
// ------------------------------------------------------------------ // ------------------------------------------------------------------
@ -306,7 +303,7 @@ static void disp_cat() {
setonkey(Key_Esc,esc_esc,0); setonkey(Key_Esc,esc_esc,0);
// end the menu and process it // 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; gmnudropthrough = YES;
kbch = i = (gkey)wmenuget(); kbch = i = (gkey)wmenuget();
gmnudropthrough = NO; 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. // is help disengagement requested? If so, un-define the help key.
if(file==NULL) { if(file==NULL) {

View File

@ -83,7 +83,7 @@ GWin::~GWin() {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Displays a string in centered in active window // 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; register int window_width, string_length;
int start_column, border; int start_column, border;
@ -133,10 +133,11 @@ int wcenters(int wrow, int attr, const char* str) {
int wdrag(int direction) { int wdrag(int direction) {
int srow, scol, erow, ecol, fill_row, fill_col, i; int srow, scol, erow, ecol, fill_row, fill_col, i;
int nsrow, nscol, nerow, necol, shad_attr=-1; int nsrow, nscol, nerow, necol;
int chars_per_line, lines_per_win; vattr shad_attr = DEFATTR;
int vert_movement, horz_movement; int chars_per_line, lines_per_win;
int vert_movement, horz_movement;
vsavebuf* win_image; vsavebuf* win_image;
vsavebuf* wp; vsavebuf* wp;
vatch* p; vatch* p;
@ -243,6 +244,7 @@ int wdrag(int direction) {
p += (lines_per_win * chars_per_line); p += (lines_per_win * chars_per_line);
fill_row=erow; fill_row=erow;
} }
vputx(fill_row, scol, vgattr(*p), vgchar(*p), ecol-scol+1); vputx(fill_row, scol, vgattr(*p), vgchar(*p), ecol-scol+1);
} }
else { else {
@ -252,6 +254,7 @@ int wdrag(int direction) {
p += chars_per_line; p += chars_per_line;
fill_col=ecol; fill_col=ecol;
} }
for(i=srow;i<=erow;i++,p+=chars_per_line+1) for(i=srow;i<=erow;i++,p+=chars_per_line+1)
vputc(i, fill_col, vgattr(*p), vgchar(*p)); vputc(i, fill_col, vgattr(*p), vgchar(*p));
} }
@ -269,8 +272,8 @@ int wdrag(int direction) {
gwin.active->ecol = necol; gwin.active->ecol = necol;
// if window has shadow, redraw it // if window has shadow, redraw it
if(shad_attr!=-1) if(shad_attr != DEFATTR)
wshadow((int)shad_attr); wshadow(shad_attr);
// reset cursor position // reset cursor position
vposset(gwin.active->row,gwin.active->column); vposset(gwin.active->row,gwin.active->column);
@ -285,7 +288,8 @@ int wdrag(int direction) {
int wslide(int nsrow, int nscol) { int wslide(int nsrow, int nscol) {
int shattr=-1, err=0; vattr shattr = DEFATTR;
int err = 0;
// check for active windows // check for active windows
if(!gwin.total) if(!gwin.total)
@ -312,8 +316,8 @@ int wslide(int nsrow, int nscol) {
return gwin.werrno; return gwin.werrno;
// if window has shadow, redraw it // if window has shadow, redraw it
if(shattr!=-1) if(shattr != DEFATTR)
wshadow((int)shattr); wshadow(shattr);
// return normally // return normally
return gwin.werrno=W_NOERROR; return gwin.werrno=W_NOERROR;

View File

@ -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 // see if next to a border, if so, connect to it
if(gwin.active->border) { 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; register int bt;
int row,col,up,down; 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; register int bt;
int row,col,left,right; int row,col,left,right;

View File

@ -208,7 +208,7 @@ static void disp_item(_item_t *witem,int bar)
__extension__ char buf[sizeof(vatch)*gvid->numcols]; __extension__ char buf[sizeof(vatch)*gvid->numcols];
#endif #endif
char ch; char ch;
int chattr; vattr chattr;
_wrec_t* whp; _wrec_t* whp;
register const char* p; register const char* p;
register vatch* ptr=(vatch*)buf; 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 &border = gwin.active->border;
const int &btype = gwin.active->btype; 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); vatch line = vcatch(_box_table(btype, 1), attr);
if (border) *ptr++ = vcatch(_box_table(btype, 9), 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; _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->item=NULL;
wmenu->title = ""; wmenu->title = "";
wmenu->titlepos = -1; wmenu->titlepos = -1;
wmenu->titleattr = 0; wmenu->titleattr = BLACK|_BLACK;
wmenu->shadattr = -1; wmenu->shadattr = DEFATTR;
wmenu->items = 0; wmenu->items = 0;
// increment menu level // 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->dwhdl = -1;
witem->dwrow = 0; witem->dwrow = 0;
witem->dwcol = 0; witem->dwcol = 0;
witem->dattr = 0; witem->dattr = BLACK|_BLACK;
witem->redisp = NO; witem->redisp = NO;
witem->help = help; witem->help = help;
witem->child = NULL; 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; _item_t* item;
int w_width, border, found; int w_width, border, found;
@ -926,8 +926,8 @@ int wmenuget() {
hide_mouse_cursor_mnu(); 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)) 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; return -1;
if(gwin.cmenu->shadattr != -1) if(gwin.cmenu->shadattr != DEFATTR)
wshadow((int)gwin.cmenu->shadattr); wshadow(gwin.cmenu->shadattr);
if(gwin.cmenu->title and *gwin.cmenu->title) if(gwin.cmenu->title and *gwin.cmenu->title)
wtitle(gwin.cmenu->title, gwin.cmenu->titlepos, gwin.cmenu->titleattr); wtitle(gwin.cmenu->title, gwin.cmenu->titlepos, gwin.cmenu->titleattr);
show_mouse_cursor_mnu(); show_mouse_cursor_mnu();
@ -1352,7 +1352,7 @@ _item_t* wmenuifind(int tagid) {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Adds a text description to menu item // 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 // make sure at least 1 menu item has been defined
if(!gwin.mlevel or gwin.mlevel>gwin.ilevel) 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->dwhdl = whdl;
citem->dwrow = wrow; citem->dwrow = wrow;
citem->dwcol = wcol; citem->dwcol = wcol;
citem->dattr = (int)attr; citem->dattr = attr;
citem->desc = str; citem->desc = str;
// return normally // return normally

View File

@ -34,22 +34,22 @@
void GMnu::Init() { void GMnu::Init() {
bordertype = 0; bordertype = 0;
bordercolor = 0; bordercolor = BLACK|_BLACK;
textcolor = 0; textcolor = BLACK|_BLACK;
quickcolor = 0; quickcolor = BLACK|_BLACK;
noselcolor = 0; noselcolor = BLACK|_BLACK;
barcolor = 0; barcolor = BLACK|_BLACK;
shadowcolor = -1; shadowcolor = DEFATTR;
title = NULL; title = NULL;
titlepos = TCENTER; titlepos = TCENTER;
titlecolor = 0; titlecolor = BLACK|_BLACK;
deschdl = -1; deschdl = -1;
descrow = 0; descrow = 0;
desccolumn = 0; desccolumn = 0;
desccolor = 0; desccolor = BLACK|_BLACK;
helpnumber = -1; 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; bordertype = type;
bordercolor = color; 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; textcolor = text;
quickcolor = quick; 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; title = text;
titlepos = pos; 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; deschdl = hdl;
descrow = row; descrow = row;

View File

@ -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; Path cwd, dir, namext, tcwd, path, spec;

View File

@ -47,22 +47,22 @@ int wpickstr_tag = false;
// define record that will hold pick window info // define record that will hold pick window info
struct r_t { struct r_t {
int numelems; int numelems;
int lastelem; int lastelem;
int curr; int curr;
int first; int first;
int last; int last;
int strsperline; int strsperline;
int strsperwin; int strsperwin;
int maxstrlen; int maxstrlen;
int wwidth; int wwidth;
int wheight; int wheight;
int fillspaces; int fillspaces;
int gapspaces; int gapspaces;
int xtraspaces; int xtraspaces;
int winattr; vattr winattr;
int barattr; vattr barattr;
int scrollbar; 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; int i, j, maxlen, outside;
gkey xch; gkey xch;

View File

@ -43,7 +43,8 @@ gwinpick::gwinpick() {
key = 0; key = 0;
keyok = false; keyok = false;
ypos = xpos = ylen = xlen = 0; 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; title = NULL;
helpcat = 0; helpcat = 0;
maximum_index = minimum_index = maximum_position = index = position = 0; maximum_index = minimum_index = maximum_position = index = position = 0;

View File

@ -85,13 +85,13 @@ public:
uint ylen; // Window Height uint ylen; // Window Height
uint xlen; // Window Width uint xlen; // Window Width
int btype; // Window Border Type int btype; // Window Border Type
int battr; // Window Border Color vattr battr; // Window Border Color
int wattr; // Window Color vattr wattr; // Window Color
int tattr; // Window Title Color vattr tattr; // Window Title Color
int sattr; // Window Selection Bar Color vattr sattr; // Window Selection Bar Color
int hattr; // Window Highlight Color vattr hattr; // Window Highlight Color
int loattr; // Window LoAttr Color vattr loattr; // Window LoAttr Color
int sbattr; // Window Scrollbar Color vattr sbattr; // Window Scrollbar Color
const char* title; // Window Title const char* title; // Window Title
int helpcat; // Window Help Category int helpcat; // Window Help Category
uint maximum_index; // List Entries - 1 uint maximum_index; // List Entries - 1

View File

@ -46,12 +46,12 @@ public:
gwinput* form; gwinput* form;
int pos; int pos;
int max_pos; int max_pos;
int attr; vattr attr;
bool fill_acs; bool fill_acs;
vchar fill; vchar fill;
int entry; int entry;
char* buf; char* buf;
int buf_left_pos; int buf_left_pos;
@ -128,9 +128,9 @@ public:
cvt_mixedcase cvt_mixedcase
}; };
int idle_attr; vattr idle_attr;
int active_attr; vattr active_attr;
int edit_attr; vattr edit_attr;
bool fill_acs; bool fill_acs;
vchar idle_fill; vchar idle_fill;
@ -151,7 +151,7 @@ public:
gwinput(gwindow &w); gwinput(gwindow &w);
virtual ~gwinput(); 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); 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);

View File

@ -41,7 +41,7 @@ gwinput::gwinput(gwindow &w) : window(w) {
first_field = current = NULL; first_field = current = NULL;
fill_acs = false; fill_acs = false;
idle_attr = active_attr = edit_attr = 7; idle_attr = active_attr = edit_attr = LGREY;
idle_fill = active_fill = edit_fill = ' '; idle_fill = active_fill = edit_fill = ' ';
insert_mode = true; insert_mode = true;
done = dropped = false; 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; idle_attr = i_attr;
active_attr = a_attr; active_attr = a_attr;

View File

@ -36,6 +36,7 @@
#include <gftnall.h> #include <gftnall.h>
#include <gtimall.h> #include <gtimall.h>
#include <gvidall.h>
#include <gmsgattr.h> #include <gmsgattr.h>
@ -141,15 +142,15 @@ class Line {
public: public:
int color; // Line color vattr color; // Line color
uint type; // GLINE_* uint type; // GLINE_*
uint kludge; // GKLUD_* uint kludge; // GKLUD_*
std::string txt; // The line text std::string txt; // The line text
Line* prev; // Pointer to previous line Line* prev; // Pointer to previous line
Line* next; // Pointer to next line Line* next; // Pointer to next line
Line() : txt ("") { 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 = type = kludge = 0; prev = next = NULL; } Line(const char *str) : txt (str) { color = BLACK|_BLACK; type = kludge = 0; prev = next = NULL; }
~Line() {} ~Line() {}
int istearline() { return !!(type & GLINE_TEAR); } int istearline() { return !!(type & GLINE_TEAR); }