Various fixes, mostly for win32 console
This commit is contained in:
parent
c3374170a9
commit
f0b3dea792
@ -12,10 +12,33 @@ ______________________________________________________________________
|
|||||||
Notes for GoldED+ 1.1.4.7, November xx 2000
|
Notes for GoldED+ 1.1.4.7, November xx 2000
|
||||||
______________________________________________________________________
|
______________________________________________________________________
|
||||||
|
|
||||||
|
- Cut-n-paste Unicode clipboard under Windows NT now properly filled
|
||||||
|
with Unicode version of control characters with the exception of CR,
|
||||||
|
LF, tabulation. It's fun to copy kludges from GoldED+ to WordPad ;-)
|
||||||
|
|
||||||
|
- Fixed lockout/crash on errorneous exit.
|
||||||
|
|
||||||
|
- Now if there is no address defined GoldED+ will exit with error at
|
||||||
|
startup rather than crashes later.
|
||||||
|
|
||||||
|
! Low-level screen handling routines rearranged. New implementation of
|
||||||
|
Win32 code included. This code should work well with Win2k raster
|
||||||
|
fonts without registry patching.
|
||||||
|
|
||||||
|
- Fixed incorrect timeslicing in DPMI32 version.
|
||||||
|
|
||||||
|
- BADAREA and DUPEAREA now "local"s rather then "echo"s for
|
||||||
|
fidoconfig.
|
||||||
|
|
||||||
|
! Changed keyboard handling under Win32, Win9x code seems to work
|
||||||
|
better. Shift-Tab no longer require additional keypress of Tab.
|
||||||
|
|
||||||
|
+ Address typed in name field now searched in addressbook as well.
|
||||||
|
|
||||||
- Cosmetic fix: MI_CHARSETAUTO now defaults to " Auto " (i.e. with two
|
- Cosmetic fix: MI_CHARSETAUTO now defaults to " Auto " (i.e. with two
|
||||||
spaces around).
|
spaces around).
|
||||||
|
|
||||||
+ Being annoyed by users who dislike read notework, added COLOR READER
|
! Being annoyed by users who dislike read notework, added COLOR READER
|
||||||
QUOTE1. COLOR READER QUOTE now set color for QUOTE1 and QUOTE2 as in
|
QUOTE1. COLOR READER QUOTE now set color for QUOTE1 and QUOTE2 as in
|
||||||
old good times. If QUOTE appears before QUOTE2 you may change
|
old good times. If QUOTE appears before QUOTE2 you may change
|
||||||
nothing in your config.
|
nothing in your config.
|
||||||
|
@ -176,10 +176,15 @@ void Cleanup(void) {
|
|||||||
int smax = MinV((int)GLOG_STORELINES, LOG.storelines);
|
int smax = MinV((int)GLOG_STORELINES, LOG.storelines);
|
||||||
for(int s=0; s<smax; s++)
|
for(int s=0; s<smax; s++)
|
||||||
cout << LOG.storeline[s] << endl;
|
cout << LOG.storeline[s] << endl;
|
||||||
if(LOG.storelines > GLOG_STORELINES)
|
|
||||||
cout << "(See also " << CFG->logfile << ")" << endl;
|
if(CFG) {
|
||||||
if(errorlevel > EXIT_NONAME)
|
if(LOG.storelines > GLOG_STORELINES)
|
||||||
MakeNoise(SND_S_O_S);
|
cout << "(See also " << CFG->logfile << ")" << endl;
|
||||||
|
if(errorlevel > EXIT_NONAME)
|
||||||
|
MakeNoise(SND_S_O_S);
|
||||||
|
|
||||||
|
CfgReset();
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(GUTLOS_FUNCS)
|
#if defined(GUTLOS_FUNCS)
|
||||||
g_deinit_os();
|
g_deinit_os();
|
||||||
@ -256,7 +261,7 @@ int ShellToDos(char* command, char* message, int cls, int cursor, int swap, int
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Store the screen
|
// Store the screen
|
||||||
vatch* scrnbuf = vsave();
|
vsavebuf* scrnbuf = vsave();
|
||||||
|
|
||||||
// Store current drive/dir
|
// Store current drive/dir
|
||||||
Path orgdir;
|
Path orgdir;
|
||||||
|
@ -86,7 +86,7 @@ bool ignore = false;
|
|||||||
int cfgerrors = 0;
|
int cfgerrors = 0;
|
||||||
bool veryverbose = false;
|
bool veryverbose = false;
|
||||||
bool shellvid = true;
|
bool shellvid = true;
|
||||||
word* oldscreen = NULL;
|
vsavebuf* oldscreen = NULL;
|
||||||
|
|
||||||
bool disablesound = false;
|
bool disablesound = false;
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ Win gold_mono1[16] = {
|
|||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// Deallocate CFG at exit
|
// Deallocate CFG at exit
|
||||||
|
|
||||||
static void CfgReset(void) {
|
void CfgReset(void) {
|
||||||
|
|
||||||
throw_delete(QWK);
|
throw_delete(QWK);
|
||||||
throw_delete(EDIT);
|
throw_delete(EDIT);
|
||||||
@ -188,8 +188,6 @@ static void CfgReset(void) {
|
|||||||
|
|
||||||
void CfgInit() {
|
void CfgInit() {
|
||||||
|
|
||||||
atexit(CfgReset);
|
|
||||||
|
|
||||||
CFG = new CfgGed;
|
CFG = new CfgGed;
|
||||||
throw_new(CFG);
|
throw_new(CFG);
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ extern bool ignore;
|
|||||||
extern int cfgerrors;
|
extern int cfgerrors;
|
||||||
extern bool veryverbose;
|
extern bool veryverbose;
|
||||||
extern bool shellvid;
|
extern bool shellvid;
|
||||||
extern word* oldscreen;
|
extern vsavebuf* oldscreen;
|
||||||
|
|
||||||
extern int keysread;
|
extern int keysread;
|
||||||
|
|
||||||
|
@ -374,51 +374,12 @@ static void w_brag() {
|
|||||||
char buf[200];
|
char buf[200];
|
||||||
char* logo[6];
|
char* logo[6];
|
||||||
|
|
||||||
#if defined(__USE_NCURSES__)
|
|
||||||
logo[0] = throw_strdup(" 88 88 88 ");
|
logo[0] = throw_strdup(" 88 88 88 ");
|
||||||
logo[1] = throw_strdup(" oooooo oooooo 88 oooo88 oooooo oooo88 o ");
|
logo[1] = throw_strdup(" oooooo oooooo 88 oooo88 oooooo oooo88 o ");
|
||||||
logo[2] = throw_strdup(" 88 88 88 88 88 88 88 88oo88 88 88 o8o ");
|
logo[2] = throw_strdup(" 88 88 88 88 88 88 88 88oo88 88 88 o8o ");
|
||||||
logo[3] = throw_strdup(" 88oo88 88oo88 88 88oo88 88oooo 88oo88 8 ");
|
logo[3] = throw_strdup(" 88oo88 88oo88 88 88oo88 88oooo 88oo88 8 ");
|
||||||
logo[4] = throw_strdup(" oo 88 ");
|
logo[4] = throw_strdup(" oo 88 ");
|
||||||
logo[5] = throw_strdup(" 88oooooo88 ");
|
logo[5] = throw_strdup(" 88oooooo88 ");
|
||||||
#else
|
|
||||||
if(W_BBRAG == 7) {
|
|
||||||
logo[0] = throw_strdup(" ** ** ** ");
|
|
||||||
logo[1] = throw_strdup(" ****** ****** ** ****** ****** ****** * ");
|
|
||||||
logo[2] = throw_strdup(" ** ** ** ** ** ** ** ****** ** ** *** ");
|
|
||||||
logo[3] = throw_strdup(" ****** ****** ** ****** ****** ****** * ");
|
|
||||||
logo[4] = throw_strdup(" ** ** ");
|
|
||||||
logo[5] = throw_strdup(" ********** ");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
#if defined(__UNIX__)
|
|
||||||
if(gvid_xterm) {
|
|
||||||
logo[0] = throw_strdup(" Ú¿ Ú¿ Ú¿ ");
|
|
||||||
logo[1] = throw_strdup(" ÚÂÄÄ¿ ÚÂÄÄ¿ ³³ ÚÂÄÄ´³ ÚÂÄÄ¿ ÚÂÄÄ´³  ");
|
|
||||||
logo[2] = throw_strdup(" ³³ ³³ ³³ ³³ ³³ ³³ ³³ ³ÃÄÄÁÙ ³³ ³³ ÃÅ´ ");
|
|
||||||
logo[3] = throw_strdup(" ÀÁÄÄ´³ ÀÁÄÄÁÙ ÀÙ ÀÁÄÄÁÙ ÀÁÄÄÁÙ ÀÁÄÄÁÙ Á ");
|
|
||||||
logo[4] = throw_strdup(" Ú¿ ³³ ");
|
|
||||||
logo[5] = throw_strdup(" ÀÁÄÄÄÄÄÄÁÙ ");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
#endif
|
|
||||||
logo[0] = throw_strdup(" É» É» É» ");
|
|
||||||
logo[1] = throw_strdup(" ÉËÍÍË» ÉËÍÍË» ºº ÉËÍ͹º ÉËÍÍË» ÉËÍ͹º Ë ");
|
|
||||||
logo[2] = throw_strdup(" ºº ºº ºº ºº ºº ºº ºº ºÌÍÍʼ ºº ºº Ìι ");
|
|
||||||
logo[3] = throw_strdup(" ÈÊÍ͹º ÈÊÍÍʼ ȼ ÈÊÍÍʼ ÈÊÍÍʼ ÈÊÍÍʼ Ê ");
|
|
||||||
logo[4] = throw_strdup(" É» ºº ");
|
|
||||||
logo[5] = throw_strdup(" ÈÊÍÍÍÍÍÍʼ ");
|
|
||||||
#if defined(__UNIX__)
|
|
||||||
}
|
|
||||||
gvid_boxcvt(logo[0]);
|
|
||||||
gvid_boxcvt(logo[1]);
|
|
||||||
gvid_boxcvt(logo[2]);
|
|
||||||
gvid_boxcvt(logo[3]);
|
|
||||||
gvid_boxcvt(logo[4]);
|
|
||||||
gvid_boxcvt(logo[5]);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
W_READ = wopen_(1, 2, MAXROW-4, MAXCOL-5, W_BBRAG, C_BRAGB, C_BRAGW);
|
W_READ = wopen_(1, 2, MAXROW-4, MAXCOL-5, W_BBRAG, C_BRAGB, C_BRAGW);
|
||||||
w_shadow();
|
w_shadow();
|
||||||
@ -844,6 +805,13 @@ void Initialize(int argc, char* argv[]) {
|
|||||||
|
|
||||||
inforow = ((MAXROW-1)/2)+6;
|
inforow = ((MAXROW-1)/2)+6;
|
||||||
|
|
||||||
|
if(CFG->aka.empty()) {
|
||||||
|
LOG.ErrConfig();
|
||||||
|
LOG.printf("! There do not seem to be any ADDRESS's defined.");
|
||||||
|
LOG.printf("+ Advice: Check your setup of ADDRESS's.");
|
||||||
|
ConfigErrorExit();
|
||||||
|
}
|
||||||
|
|
||||||
bool areasdefined = false;
|
bool areasdefined = false;
|
||||||
|
|
||||||
// Do checking for an area and unknown aka's in area
|
// Do checking for an area and unknown aka's in area
|
||||||
|
@ -573,14 +573,16 @@ static void KludgeREPLYTO(GMsg* msg, const char* ptr) {
|
|||||||
|
|
||||||
static void KludgeFROM(GMsg* msg, const char* ptr) {
|
static void KludgeFROM(GMsg* msg, const char* ptr) {
|
||||||
|
|
||||||
INam fromname;
|
INam _fromname;
|
||||||
IAdr fromaddr;
|
IAdr _fromaddr;
|
||||||
strxmimecpy(msg->ifrom, ptr, msg->charsetlevel, sizeof(INam));
|
char* buf = throw_strdup(ptr);
|
||||||
ParseInternetAddr(msg->ifrom, fromname, fromaddr);
|
strxcpy(msg->ifrom, buf, sizeof(msg->ifrom));
|
||||||
if(*fromaddr)
|
ParseInternetAddr(buf, _fromname, _fromaddr);
|
||||||
strcpy(msg->iorig, fromaddr);
|
throw_free(buf);
|
||||||
if(*fromname)
|
if(*_fromaddr)
|
||||||
strxcpy(msg->realby, fromname, sizeof(msg->realby));
|
strcpy(msg->iorig, _fromaddr);
|
||||||
|
if(*_fromname)
|
||||||
|
strxcpy(msg->realby, _fromname, sizeof(msg->realby));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2533,13 +2535,13 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
|
|||||||
|
|
||||||
// Charset translate header fields
|
// Charset translate header fields
|
||||||
if(header_recode) {
|
if(header_recode) {
|
||||||
strxmimecpy(msg->realby, msg->realby, level, sizeof(INam));
|
strxmimecpy(msg->realby, msg->realby, 0, sizeof(INam));
|
||||||
strxmimecpy(msg->realto, msg->realto, level, sizeof(INam));
|
strxmimecpy(msg->realto, msg->realto, 0, sizeof(INam));
|
||||||
strxmimecpy(msg->by , msg->by , level, sizeof(INam));
|
strxmimecpy(msg->by, msg->by, level, sizeof(INam));
|
||||||
strxmimecpy(msg->to , msg->to , level, sizeof(INam));
|
strxmimecpy(msg->to, msg->to, level, sizeof(INam));
|
||||||
|
|
||||||
if(not (msg->attr.frq() or msg->attr.att() or msg->attr.urq()))
|
if(not (msg->attr.frq() or msg->attr.att() or msg->attr.urq()))
|
||||||
strxmimecpy(msg->re , msg->re , level, sizeof(ISub), true);
|
strxmimecpy(msg->re, msg->re, level, sizeof(ISub), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,8 +59,8 @@ int Area::LoadHdr(GMsg* msg, ulong msgno, bool enable_recode) {
|
|||||||
if(retval and enable_recode) {
|
if(retval and enable_recode) {
|
||||||
// Use default translation by default
|
// Use default translation by default
|
||||||
int table = LoadCharset(NULL, NULL, 1);
|
int table = LoadCharset(NULL, NULL, 1);
|
||||||
if (table == -1)
|
if((table == -1) or not CFG->ignorecharset)
|
||||||
msg->charsetlevel = LoadCharset(CFG->xlatimport, CFG->xlatlocalset);
|
msg->charsetlevel = LoadCharset(AA->Xlatimport(), CFG->xlatlocalset);
|
||||||
else
|
else
|
||||||
msg->charsetlevel = LoadCharset(CFG->xlatcharset[table].imp, CFG->xlatcharset[table].exp);
|
msg->charsetlevel = LoadCharset(CFG->xlatcharset[table].imp, CFG->xlatcharset[table].exp);
|
||||||
|
|
||||||
|
@ -826,6 +826,7 @@ int ChangeXlatImport() {
|
|||||||
CFG->ignorecharset = true;
|
CFG->ignorecharset = true;
|
||||||
AA->SetXlatimport(strtok(Listi[n], " "));
|
AA->SetXlatimport(strtok(Listi[n], " "));
|
||||||
}
|
}
|
||||||
|
LoadCharset(AA->Xlatimport(), CFG->xlatlocalset);
|
||||||
for(n=0; n<xlatimports; n++)
|
for(n=0; n<xlatimports; n++)
|
||||||
throw_free(Listi[n]);
|
throw_free(Listi[n]);
|
||||||
throw_free(Listi);
|
throw_free(Listi);
|
||||||
|
@ -42,16 +42,16 @@ gsound* snd = NULL;
|
|||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(__MSDOS__)
|
#if defined(__MSDOS__)
|
||||||
#define Beep(A,B) { sound(A); usleep(B*CFG->beepfactor+1); }
|
#define Beep(A,B) { sound(A); usleep(CFG ? B*CFG->beepfactor+1 : B*1000); }
|
||||||
#define Sleep(A) { usleep(A*CFG->beepfactor+1); }
|
#define Sleep(A) { usleep(CFG ? A*CFG->beepfactor+1 : A*1000); }
|
||||||
#define NoSound() { nosound(); }
|
#define NoSound() { nosound(); }
|
||||||
#elif defined(__OS2__)
|
#elif defined(__OS2__)
|
||||||
#define Beep(A,B) { DosBeep(A, B*CFG->beepfactor/1000+1); }
|
#define Beep(A,B) { DosBeep(A, CFG ? B*CFG->beepfactor/1000+1 : B); }
|
||||||
#define Sleep(A) { usleep(A*CFG->beepfactor+1); }
|
#define Sleep(A) { usleep(CFG ? A*CFG->beepfactor+1 : A*1000); }
|
||||||
#define NoSound() { }
|
#define NoSound() { }
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
#define Beep(A,B) { (Beep)(A, B*CFG->beepfactor/1000+1); }
|
#define Beep(A,B) { (Beep)(A, CFG ? B*CFG->beepfactor/1000+1 : B); }
|
||||||
#define Sleep(A) { usleep(A*CFG->beepfactor+1); }
|
#define Sleep(A) { usleep(CFG ? A*CFG->beepfactor+1 : A*1000); }
|
||||||
#define NoSound() { }
|
#define NoSound() { }
|
||||||
#else
|
#else
|
||||||
#define Beep(A,B) { }
|
#define Beep(A,B) { }
|
||||||
@ -93,12 +93,12 @@ void InitSound() {
|
|||||||
snd = new gsound;
|
snd = new gsound;
|
||||||
if(snd->is_installed()) {
|
if(snd->is_installed()) {
|
||||||
if(not quiet)
|
if(not quiet)
|
||||||
printf("\n* Soundcard support was successfully initialized.");
|
cout << "* Soundcard support was successfully initialized." << endl;
|
||||||
atexit(ResetSound);
|
atexit(ResetSound);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(not quiet)
|
if(not quiet)
|
||||||
printf("\n* Soundcard support could NOT be initialized!");
|
cout << "* Soundcard support could NOT be initialized!" << endl;
|
||||||
ResetSound();
|
ResetSound();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -149,6 +149,7 @@ void AdvancedSearch(GMsg* msg, int& topline, int& keyok);
|
|||||||
|
|
||||||
void CfgInit();
|
void CfgInit();
|
||||||
void CfgInit2();
|
void CfgInit2();
|
||||||
|
void CfgReset(void);
|
||||||
int PlayMacro(gkey key, int type);
|
int PlayMacro(gkey key, int type);
|
||||||
int IsMacro(gkey key, int type);
|
int IsMacro(gkey key, int type);
|
||||||
|
|
||||||
|
@ -927,7 +927,7 @@ int LoadMessage(GMsg* msg, int margin) {
|
|||||||
msg->orig_timesread = msg->timesread++;
|
msg->orig_timesread = msg->timesread++;
|
||||||
|
|
||||||
if(reader_rcv_noise > 1) {
|
if(reader_rcv_noise > 1) {
|
||||||
GMsg* tmsg = throw_calloc(1, sizeof(GMsg));
|
GMsg* tmsg = (GMsg*) throw_calloc(1, sizeof(GMsg));
|
||||||
AA->LoadHdr(tmsg, msg->msgno, false);
|
AA->LoadHdr(tmsg, msg->msgno, false);
|
||||||
tmsg->attr = msg->attr;
|
tmsg->attr = msg->attr;
|
||||||
tmsg->orig_timesread = msg->orig_timesread;
|
tmsg->orig_timesread = msg->orig_timesread;
|
||||||
|
@ -395,41 +395,31 @@ bool guserbase::edit_entry(uint idx) {
|
|||||||
|
|
||||||
bool guserbase::find_entry(char* name, bool lookup) {
|
bool guserbase::find_entry(char* name, bool lookup) {
|
||||||
|
|
||||||
gusrbaseentry ent;
|
|
||||||
|
|
||||||
if(not strblank(name)) {
|
if(not strblank(name)) {
|
||||||
|
string tmpaddr;
|
||||||
|
gusrbaseentry old_entry = entry;
|
||||||
|
uint old_index = index;
|
||||||
|
|
||||||
refresh_maximum_index();
|
refresh_maximum_index();
|
||||||
usrbase.lseek(sizeof(gusrbaseheader), SEEK_SET);
|
usrbase.lseek(sizeof(gusrbaseheader), SEEK_SET);
|
||||||
for(uint i=0; i<=maximum_index; i++) {
|
for(index=0; index<=maximum_index; index++) {
|
||||||
read_entry(i, &ent);
|
read_entry(index, &entry);
|
||||||
|
|
||||||
if(strieql(name, ent.name) or (lookup and strieql(name, ent.macro))) {
|
if(strieql(name, entry.name))
|
||||||
strcpy(entry.macro, ent.macro);
|
|
||||||
strcpy(entry.name, ent.name);
|
|
||||||
entry.fidoaddr = ent.fidoaddr;
|
|
||||||
strcpy(entry.iaddr, ent.iaddr);
|
|
||||||
entry.prefer_internet = ent.prefer_internet;
|
|
||||||
entry.is_deleted = ent.is_deleted;
|
|
||||||
strcpy(entry.pseudo, ent.pseudo);
|
|
||||||
strcpy(entry.organisation, ent.organisation);
|
|
||||||
strcpy(entry.snail1, ent.snail1);
|
|
||||||
strcpy(entry.snail2, ent.snail2);
|
|
||||||
strcpy(entry.snail3, ent.snail3);
|
|
||||||
strcpy(entry.dataphone, ent.dataphone);
|
|
||||||
strcpy(entry.voicephone, ent.voicephone);
|
|
||||||
strcpy(entry.faxphone, ent.faxphone);
|
|
||||||
entry.firstdate = ent.firstdate;
|
|
||||||
entry.lastdate = ent.lastdate;
|
|
||||||
entry.times = ent.times;
|
|
||||||
strcpy(entry.homepage, ent.homepage);
|
|
||||||
entry.group = ent.group;
|
|
||||||
strcpy(entry.comment1, ent.comment1);
|
|
||||||
strcpy(entry.comment2, ent.comment1);
|
|
||||||
strcpy(entry.comment3, ent.comment1);
|
|
||||||
index = i;
|
|
||||||
return true;
|
return true;
|
||||||
|
else if(lookup) {
|
||||||
|
if(strieql(name, entry.macro) or streql(name, entry.iaddr))
|
||||||
|
return true;
|
||||||
|
else {
|
||||||
|
entry.fidoaddr.make_string(tmpaddr);
|
||||||
|
if (streql(name, tmpaddr.c_str()))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
index = old_index;
|
||||||
|
entry = old_entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -132,9 +132,7 @@ void GKbd::Init() {
|
|||||||
osversion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
osversion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||||
GetVersionEx(&osversion);
|
GetVersionEx(&osversion);
|
||||||
gkbd_nt = (osversion.dwPlatformId & VER_PLATFORM_WIN32_NT) ? true : false;
|
gkbd_nt = (osversion.dwPlatformId & VER_PLATFORM_WIN32_NT) ? true : false;
|
||||||
gkbd_hin = CreateFile("CONIN$", GENERIC_READ | GENERIC_WRITE,
|
gkbd_hin = GetStdHandle(STD_INPUT_HANDLE);
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
|
|
||||||
OPEN_EXISTING, 0, NULL);
|
|
||||||
GetConsoleMode(gkbd_hin, &gkbd_kbdmode);
|
GetConsoleMode(gkbd_hin, &gkbd_kbdmode);
|
||||||
if(gkbd_kbdmode & KBD_TEXTMODE)
|
if(gkbd_kbdmode & KBD_TEXTMODE)
|
||||||
SetConsoleMode(gkbd_hin, gkbd_kbdmode & ~KBD_TEXTMODE);
|
SetConsoleMode(gkbd_hin, gkbd_kbdmode & ~KBD_TEXTMODE);
|
||||||
@ -878,7 +876,7 @@ bool is_numpad_key(const INPUT_RECORD& inp) {
|
|||||||
|
|
||||||
if(not (inp.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY)) {
|
if(not (inp.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY)) {
|
||||||
switch(inp.Event.KeyEvent.wVirtualKeyCode) {
|
switch(inp.Event.KeyEvent.wVirtualKeyCode) {
|
||||||
case 0x0C:
|
case VK_CLEAR:
|
||||||
case VK_PRIOR:
|
case VK_PRIOR:
|
||||||
case VK_NEXT:
|
case VK_NEXT:
|
||||||
case VK_END:
|
case VK_END:
|
||||||
@ -1168,6 +1166,10 @@ gkey kbxget_raw(int mode) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
DWORD &CKS = inp.Event.KeyEvent.dwControlKeyState;
|
||||||
|
WORD &VKC = inp.Event.KeyEvent.wVirtualKeyCode;
|
||||||
|
char &ascii = inp.Event.KeyEvent.uChar.AsciiChar;
|
||||||
|
|
||||||
// Get next key
|
// Get next key
|
||||||
inp.Event.KeyEvent.bKeyDown = false;
|
inp.Event.KeyEvent.bKeyDown = false;
|
||||||
while(1) {
|
while(1) {
|
||||||
@ -1179,53 +1181,88 @@ gkey kbxget_raw(int mode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(inp.EventType == KEY_EVENT and inp.Event.KeyEvent.bKeyDown) {
|
if(inp.EventType == KEY_EVENT and inp.Event.KeyEvent.bKeyDown) {
|
||||||
bool alt_pressed = (inp.Event.KeyEvent.dwControlKeyState & (LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED)) ? true : false;
|
bool alt_pressed = (CKS & (LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED)) ? true : false;
|
||||||
// bool right_alt_pressed = (inp.Event.KeyEvent.dwControlKeyState & RIGHT_ALT_PRESSED) ? true : false;
|
bool ctrl_pressed = (CKS & (LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED)) ? true : false;
|
||||||
bool enhanced_key = (inp.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY) ? true : false;
|
bool shift_pressed = (CKS & SHIFT_PRESSED) ? true : false;
|
||||||
bool numpad_key = is_numpad_key(inp);
|
bool special_key = false;
|
||||||
int vk = inp.Event.KeyEvent.wVirtualKeyCode;
|
|
||||||
char raw_ch = inp.Event.KeyEvent.uChar.AsciiChar;
|
|
||||||
int kc;
|
|
||||||
int test;
|
|
||||||
char ch;
|
|
||||||
|
|
||||||
if(enhanced_key and (raw_ch == 0xE0))
|
k = 0;
|
||||||
inp.Event.KeyEvent.uChar.AsciiChar = raw_ch = 0;
|
|
||||||
if(gkbd_nt)
|
if(alt_pressed)
|
||||||
test = (inp.Event.KeyEvent.uChar.AsciiChar and not alt_pressed and vk != -1) or (alt_pressed and vk == -1) or (alt_pressed and numpad_key);
|
special_key = is_numpad_key(inp); // Alt-<numpad key>
|
||||||
else
|
else if(isalnum(ascii) and not ctrl_pressed)
|
||||||
test = (inp.Event.KeyEvent.uChar.AsciiChar and not alt_pressed and vk != -1) or (alt_pressed and vk == -1) or (alt_pressed and numpad_key) or (vk == 0xBA);
|
special_key = not gkbd_nt; // It is alphanumeric key under Win9x
|
||||||
if(test) {
|
if(special_key) {
|
||||||
// Ascii char
|
ReadConsole(gkbd_hin, &ascii, 1, &nread, NULL);
|
||||||
if(gkbd_nt and not (alt_pressed and numpad_key)) {
|
|
||||||
ch = raw_ch;
|
|
||||||
ReadConsoleInput(gkbd_hin, &inp, 1, &nread);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ReadConsole(gkbd_hin, &ch, 1, &nread, NULL);
|
|
||||||
}
|
|
||||||
if(alt_pressed) {
|
if(alt_pressed) {
|
||||||
k = (gkey)ch;
|
k = (gkey)ascii;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(gkbd_nt) {
|
|
||||||
if(ch == '\x5E' or ch == '\x7E' or ch == '\x60' or ch == '\xF9' or ch == '\xEF')
|
|
||||||
inp.Event.KeyEvent.wVirtualKeyCode = (word)(ch << 8);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(ch == '\x5E' or ch == '\x7E' or ch == '\x60' or ch == '\x27' or ch == '\x2E')
|
|
||||||
inp.Event.KeyEvent.wVirtualKeyCode = (word)(ch << 8);
|
|
||||||
}
|
|
||||||
inp.Event.KeyEvent.uChar.AsciiChar = ch;
|
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
// Control keycode
|
|
||||||
ReadConsoleInput(gkbd_hin, &inp, 1, &nread);
|
ReadConsoleInput(gkbd_hin, &inp, 1, &nread);
|
||||||
}
|
|
||||||
kc = gkbd_nt2bios(inp);
|
switch(VKC) {
|
||||||
if(kc != -1) {
|
// Not meanful keys
|
||||||
k = (gkey)kc;
|
case VK_SHIFT:
|
||||||
break;
|
case VK_CONTROL:
|
||||||
|
case VK_MENU:
|
||||||
|
case VK_CAPITAL:
|
||||||
|
case VK_NUMLOCK:
|
||||||
|
case VK_SCROLL:
|
||||||
|
return (gkey)k; // Return empty key
|
||||||
|
|
||||||
|
case VK_NUMPAD0:
|
||||||
|
case VK_NUMPAD1:
|
||||||
|
case VK_NUMPAD2:
|
||||||
|
case VK_NUMPAD3:
|
||||||
|
case VK_NUMPAD4:
|
||||||
|
case VK_NUMPAD5:
|
||||||
|
case VK_NUMPAD6:
|
||||||
|
case VK_NUMPAD7:
|
||||||
|
case VK_NUMPAD8:
|
||||||
|
case VK_NUMPAD9:
|
||||||
|
if(shift_pressed) {
|
||||||
|
WORD keytrans[10][2] = {
|
||||||
|
{VK_NUMPAD0, VK_INSERT},
|
||||||
|
{VK_NUMPAD1, VK_END},
|
||||||
|
{VK_NUMPAD2, VK_DOWN},
|
||||||
|
{VK_NUMPAD3, VK_NEXT},
|
||||||
|
{VK_NUMPAD4, VK_LEFT},
|
||||||
|
{VK_NUMPAD5, VK_CLEAR},
|
||||||
|
{VK_NUMPAD6, VK_RIGHT},
|
||||||
|
{VK_NUMPAD7, VK_HOME},
|
||||||
|
{VK_NUMPAD8, VK_UP},
|
||||||
|
{VK_NUMPAD9, VK_PRIOR},
|
||||||
|
};
|
||||||
|
for(int i = 0; i < 10; i++)
|
||||||
|
if(VKC == keytrans[i][0]) {
|
||||||
|
VKC = keytrans[i][1];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// fall through
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
int kc = gkbd_nt2bios(inp);
|
||||||
|
if(kc != -1)
|
||||||
|
return (gkey)kc;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
// OEM specific keys
|
||||||
|
case 0x2a:
|
||||||
|
case 0xba: case 0xbb: case 0xbc: case 0xbd: case 0xbe:
|
||||||
|
case 0xbf: case 0xc0:
|
||||||
|
case 0xdb: case 0xdc: case 0xdd: case 0xde: case 0xdf:
|
||||||
|
case 0xe0: case 0xe1: case 0xe2: case 0xe3: case 0xe4:
|
||||||
|
case 0xe6:
|
||||||
|
case 0xe9: case 0xea: case 0xeb: case 0xec: case 0xed:
|
||||||
|
case 0xef: case 0xf0: case 0xf1: case 0xf2: case 0xf3:
|
||||||
|
case 0xf4: case 0xf5:
|
||||||
|
if(ascii)
|
||||||
|
return (gkey)ascii;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -56,7 +56,7 @@ GMTsk::GMTsk() {
|
|||||||
detected = GMTSK_NONE;
|
detected = GMTSK_NONE;
|
||||||
name = "";
|
name = "";
|
||||||
#if defined(__DJGPP__)
|
#if defined(__DJGPP__)
|
||||||
_get_dos_version(true);
|
detected = GMTSK_DOS;
|
||||||
name = "DPMI32";
|
name = "DPMI32";
|
||||||
#elif defined(__UNIX__)
|
#elif defined(__UNIX__)
|
||||||
detected = GMTSK_LINUX;
|
detected = GMTSK_LINUX;
|
||||||
|
@ -113,6 +113,12 @@ char tl[256] = {
|
|||||||
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
|
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
|
||||||
};
|
};
|
||||||
|
|
||||||
|
WCHAR oem2unicode[256] = {
|
||||||
|
0x0000, 0x263a, 0x263b, 0x2665, 0x2666, 0x2663, 0x2660, 0x2219,
|
||||||
|
0x25d8, 0x25cb, 0x25d9, 0x2642, 0x2640, 0x266a, 0x266b, 0x263c,
|
||||||
|
0x25ba, 0x25c4, 0x2195, 0x203c, 0x00b6, 0x00a7, 0x25a0, 0x21a8,
|
||||||
|
0x2191, 0x2193, 0x2192, 0x2190, 0x221f, 0x2194, 0x25b2, 0x25bc
|
||||||
|
};
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
@ -129,6 +135,10 @@ int g_init_os(int flags) {
|
|||||||
for(i = 0; i < 256; i++) {
|
for(i = 0; i < 256; i++) {
|
||||||
tu[i] = (toupper)(i);
|
tu[i] = (toupper)(i);
|
||||||
tl[i] = (tolower)(i);
|
tl[i] = (tolower)(i);
|
||||||
|
if(i >= ' ') {
|
||||||
|
CHAR chr = (CHAR)i;
|
||||||
|
MultiByteToWideChar(CP_OEMCP, 0, &chr, 1, oem2unicode+i, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -224,7 +234,7 @@ char* g_get_clip_text(void) {
|
|||||||
int Format = 0;
|
int Format = 0;
|
||||||
int ReadType = CF_OEMTEXT;
|
int ReadType = CF_OEMTEXT;
|
||||||
while((Format = EnumClipboardFormats(Format)) != 0) {
|
while((Format = EnumClipboardFormats(Format)) != 0) {
|
||||||
if(Format == CF_UNICODETEXT && WinVer.dwPlatformId == VER_PLATFORM_WIN32_NT) {
|
if((Format == CF_UNICODETEXT) and (WinVer.dwPlatformId == VER_PLATFORM_WIN32_NT)) {
|
||||||
Unicode = true;
|
Unicode = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -287,7 +297,15 @@ int g_put_clip_text(const char *Data) {
|
|||||||
if(WinVer.dwPlatformId == VER_PLATFORM_WIN32_NT)
|
if(WinVer.dwPlatformId == VER_PLATFORM_WIN32_NT)
|
||||||
if((hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, BufferSize * 2)) != NULL)
|
if((hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, BufferSize * 2)) != NULL)
|
||||||
if((GData = GlobalLock(hData)) != NULL) {
|
if((GData = GlobalLock(hData)) != NULL) {
|
||||||
MultiByteToWideChar(CP_OEMCP, 0, Data, -1, (LPWSTR)GData, BufferSize);
|
WCHAR *UData = (WCHAR *)GData;
|
||||||
|
|
||||||
|
while(*Data) {
|
||||||
|
if((*Data == '\r') or (*Data == '\n') or (*Data == '\t'))
|
||||||
|
*UData++ = *Data++; // no translation for real control chars
|
||||||
|
else
|
||||||
|
*UData++ = oem2unicode[*Data++];
|
||||||
|
}
|
||||||
|
*UData = 0;
|
||||||
GlobalUnlock(hData);
|
GlobalUnlock(hData);
|
||||||
SetClipboardData(CF_UNICODETEXT, (HANDLE)hData);
|
SetClipboardData(CF_UNICODETEXT, (HANDLE)hData);
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,9 @@
|
|||||||
#define ACS_BOARD '°'
|
#define ACS_BOARD '°'
|
||||||
#define ACS_BLOCK 'Û'
|
#define ACS_BLOCK 'Û'
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__WIN32__)
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
@ -258,6 +261,9 @@ typedef word* gdma; // Video DMA pointer
|
|||||||
#if defined(__USE_NCURSES__)
|
#if defined(__USE_NCURSES__)
|
||||||
typedef chtype vchar; // Type of characters on-screen
|
typedef chtype vchar; // Type of characters on-screen
|
||||||
typedef chtype vatch; // Type of character-attribute groups
|
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
|
#else
|
||||||
typedef char vchar; // Type of characters on-screen
|
typedef char vchar; // Type of characters on-screen
|
||||||
typedef word vatch; // Type of character-attribute groups
|
typedef word vatch; // Type of character-attribute groups
|
||||||
@ -379,9 +385,12 @@ void vposset (int row, int col);
|
|||||||
void vclrscr ();
|
void vclrscr ();
|
||||||
void vclrscr (int atr); // Overloaded
|
void vclrscr (int atr); // Overloaded
|
||||||
|
|
||||||
vatch* vsave (int srow=-1, int scol=-1, int erow=-1, int ecol=-1);
|
typedef struct _vsavebuf {
|
||||||
void vredraw (vatch* buf, int srow=-1, int scol=-1, int erow=-1, int ecol=-1);
|
int top, left, right, bottom;
|
||||||
void vrestore (vatch* buf, int srow=-1, int scol=-1, int erow=-1, int ecol=-1);
|
__extension__ vatch data[0];
|
||||||
|
} vsavebuf;
|
||||||
|
vsavebuf* vsave (int srow=-1, int scol=-1, int erow=-1, int ecol=-1);
|
||||||
|
void vrestore (vsavebuf* buf, int srow=-1, int scol=-1, int erow=-1, int ecol=-1);
|
||||||
|
|
||||||
void vcurget (int* sline, int* eline);
|
void vcurget (int* sline, int* eline);
|
||||||
void vcurset (int sline, int eline);
|
void vcurset (int sline, int eline);
|
||||||
@ -396,17 +405,45 @@ 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, int hiattr, int loattr=-1);
|
||||||
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, int atr);
|
||||||
|
|
||||||
#if not defined(__USE_NCURSES__)
|
vchar vgetc (int row, int col); // Gets the character from position
|
||||||
inline vchar vgetc (int row, int col) { return (vchar)(0xFF & vgetw(row, col)); }
|
vchar vgchar (vatch chat); // Gets the character part of a character-attribute group
|
||||||
#else
|
int vgattr (vatch chat); // Gets the attribute part of a character-attribute group
|
||||||
inline vchar vgetc (int row, int col) { return (vchar)((A_CHARTEXT|A_ALTCHARSET) & vgetw(row, col)); }
|
vatch vschar (vatch chat, vchar chr); // Sets the given character in a character-attribute group
|
||||||
#endif
|
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
|
||||||
|
|
||||||
vchar vgchar (vatch chat);
|
// inline implementation of functions above
|
||||||
int vgattr (vatch chat);
|
|
||||||
vatch vschar (vatch chat, vchar chr);
|
inline vchar vgetc (int row, int col) { return vgchar(vgetw(row, col)); }
|
||||||
vatch vsattr (vatch chat, int atr);
|
|
||||||
vatch vcatch (vchar chr, int atr);
|
#if defined(__USE_NCURSES__)
|
||||||
|
|
||||||
|
int gvid_dosattrcalc (int ourattr);
|
||||||
|
int gvid_attrcalc (int dosattr);
|
||||||
|
|
||||||
|
inline vchar vgchar (vatch chat) { return chat & (A_CHARTEXT | A_ALTCHARSET); }
|
||||||
|
inline int vgattr (vatch chat) { return gvid_dosattrcalc(chat & ~(A_CHARTEXT | A_ALTCHARSET)); }
|
||||||
|
inline vatch vschar (vatch chat, vchar chr) { return (chr & (A_CHARTEXT | A_ALTCHARSET)) | (chat & ~(A_CHARTEXT | A_ALTCHARSET)); }
|
||||||
|
inline vatch vsattr (vatch chat, int atr) { return (chat & (A_CHARTEXT | A_ALTCHARSET)) | gvid_attrcalc(atr); }
|
||||||
|
inline vatch vcatch (vchar chr, int atr) { return chr | gvid_attrcalc(atr); }
|
||||||
|
|
||||||
|
#elif defined(__WIN32__)
|
||||||
|
|
||||||
|
inline vchar vgchar (vatch chat) { return chat.Char.AsciiChar; }
|
||||||
|
inline int vgattr (vatch chat) { return chat.Attributes; }
|
||||||
|
inline vatch vschar (vatch chat, vchar chr) { chat.Char.UnicodeChar = 0; chat.Char.AsciiChar = chr; return chat; }
|
||||||
|
inline vatch vsattr (vatch chat, int atr) { chat.Attributes = atr; return chat; }
|
||||||
|
inline vatch vcatch (vchar chr, int atr) { vatch chat; chat.Char.UnicodeChar = 0; chat.Char.AsciiChar = chr; chat.Attributes = atr; return chat; }
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
inline vchar vgchar (vatch chat) { return chat & 0xff; }
|
||||||
|
inline int vgattr (vatch chat) { return (chat >> 8) & 0xff; }
|
||||||
|
inline vatch vschar (vatch chat, vchar chr) { return (chat & 0xff00) | chr; }
|
||||||
|
inline vatch vsattr (vatch chat, int atr) { return (chat & 0xff) | (atr << 8); }
|
||||||
|
inline vatch vcatch (vchar chr, int atr) { return (chr & 0xff) | ((atr << 8) & 0xff00); }
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef void (*VidPutStrCP)(int,int,int,const char*);
|
typedef void (*VidPutStrCP)(int,int,int,const char*);
|
||||||
|
|
||||||
|
@ -86,6 +86,18 @@ static bool __vcurhidden = false;
|
|||||||
|
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
extern HANDLE gvid_hout;
|
extern HANDLE gvid_hout;
|
||||||
|
extern OSVERSIONINFO WinVer; // defined in gutlwin.cpp
|
||||||
|
extern WCHAR oem2unicode[]; // defined in gutlwin.cpp
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------
|
||||||
|
// Transform character < 32 into printable Unicode equivalent
|
||||||
|
|
||||||
|
|
||||||
|
inline WCHAR gvid_tcpr(vchar chr) {
|
||||||
|
|
||||||
|
return oem2unicode[chr];
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -93,6 +105,10 @@ extern HANDLE gvid_hout;
|
|||||||
|
|
||||||
#if defined(__MSDOS__) or defined(__UNIX__)
|
#if defined(__MSDOS__) or defined(__UNIX__)
|
||||||
|
|
||||||
|
#if defined(__MSDOS__)
|
||||||
|
extern int __gdvdetected;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __DJGPP__
|
#ifndef __DJGPP__
|
||||||
const unsigned short _dos_ds = 0;
|
const unsigned short _dos_ds = 0;
|
||||||
|
|
||||||
@ -344,11 +360,6 @@ void vputansi(int row, int col, word* buf, int len) {
|
|||||||
#endif // not defined(__USE_NCURSES__)
|
#endif // not defined(__USE_NCURSES__)
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
|
||||||
|
|
||||||
extern int __gdvdetected;
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// Converts an attribute to monochrome equivalent
|
// Converts an attribute to monochrome equivalent
|
||||||
|
|
||||||
@ -494,7 +505,7 @@ static USHORT VioWrtCharStrAtt_(PCCH str, USHORT cb, USHORT row, USHORT col, PBY
|
|||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// Compute our attributes from DOS attributes
|
// Compute our attributes from DOS attributes
|
||||||
|
|
||||||
int gvid_attrcalc (int dosattr) {
|
int gvid_attrcalc(int dosattr) {
|
||||||
|
|
||||||
// DOS attrs: XRGBxrgb
|
// DOS attrs: XRGBxrgb
|
||||||
// color pair definition: 00RGBrgb, with last 3 bits negated
|
// color pair definition: 00RGBrgb, with last 3 bits negated
|
||||||
@ -511,7 +522,7 @@ int gvid_attrcalc (int dosattr) {
|
|||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// Compute DOS attributes from our attributes
|
// Compute DOS attributes from our attributes
|
||||||
|
|
||||||
int gvid_dosattrcalc (int ourattr) {
|
int gvid_dosattrcalc(int ourattr) {
|
||||||
|
|
||||||
int attr = 0;
|
int attr = 0;
|
||||||
attr = PAIR_NUMBER(ourattr);
|
attr = PAIR_NUMBER(ourattr);
|
||||||
@ -528,18 +539,18 @@ int gvid_dosattrcalc (int ourattr) {
|
|||||||
// Transform character < 32 into printable equivalent
|
// Transform character < 32 into printable equivalent
|
||||||
|
|
||||||
|
|
||||||
chtype gvid_tcpr (vchar chr) {
|
chtype gvid_tcpr(vchar chr) {
|
||||||
|
|
||||||
chtype gvid_cpr[] = {
|
const chtype gvid_cpr[] = {
|
||||||
(chtype)' ', (chtype)'@', (chtype)'@', (chtype)'x',
|
(chtype)' ', (chtype)'@', (chtype)'@', (chtype)'x',
|
||||||
(chtype) ACS_DIAMOND, (chtype)'x', (chtype)'x', ACS_BULLET,
|
(chtype) ACS_DIAMOND, (chtype)'x', (chtype)'x', ACS_BULLET,
|
||||||
ACS_BULLET, ACS_BULLET, ACS_BULLET, (chtype)'x',
|
ACS_BULLET, ACS_BULLET, ACS_BULLET, (chtype)'x',
|
||||||
(chtype)'x', (chtype)'x', (chtype)'x', ACS_LANTERN,
|
(chtype)'x', (chtype)'x', (chtype)'x', ACS_LANTERN,
|
||||||
ACS_LARROW, (chtype) ACS_RARROW, (chtype)'x', (chtype)'!',
|
(chtype)ACS_RARROW, ACS_LARROW, (chtype)'x', (chtype)'!',
|
||||||
(chtype)'x', (chtype)'x', ACS_S1, (chtype)'x',
|
(chtype)'x', (chtype)'x', ACS_S1, (chtype)'x',
|
||||||
ACS_UARROW, ACS_DARROW, ACS_LARROW, (chtype)ACS_RARROW,
|
ACS_UARROW, ACS_DARROW, ACS_LARROW, (chtype)ACS_RARROW,
|
||||||
(chtype)'x', (chtype)'x', ACS_UARROW, ACS_DARROW
|
(chtype)'x', (chtype)'x', ACS_UARROW, ACS_DARROW
|
||||||
};
|
};
|
||||||
|
|
||||||
chtype ch = chr & A_CHARTEXT;
|
chtype ch = chr & A_CHARTEXT;
|
||||||
chtype at = chr & (~A_CHARTEXT);
|
chtype at = chr & (~A_CHARTEXT);
|
||||||
@ -587,37 +598,39 @@ void vputw(int row, int col, vatch chat) {
|
|||||||
cpu.dl((byte)col);
|
cpu.dl((byte)col);
|
||||||
cpu.genint(0x10);
|
cpu.genint(0x10);
|
||||||
cpu.ah(9);
|
cpu.ah(9);
|
||||||
cpu.al((byte)(chat&0xFF));
|
cpu.al(vgchar(chat));
|
||||||
cpu.bh(0);
|
cpu.bh(0);
|
||||||
cpu.bl((byte)(chat>>8));
|
cpu.bl(vgattr(chat));
|
||||||
cpu.cx(1);
|
cpu.cx(1);
|
||||||
cpu.genint(0x10);
|
cpu.genint(0x10);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__OS2__)
|
#elif defined(__OS2__)
|
||||||
|
|
||||||
BYTE tmp[2];
|
VioWrtNCell(&chat, 1, (USHORT)row, (USHORT)col, 0);
|
||||||
tmp[0] = (BYTE)(chat & 0xFF);
|
|
||||||
tmp[1] = (BYTE)(chat >> 8);
|
|
||||||
VioWrtNCell(tmp, 1, (USHORT)row, (USHORT)col, 0);
|
|
||||||
|
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
|
|
||||||
COORD coord;
|
const COORD coord = {0, 0};
|
||||||
DWORD x;
|
const COORD size = {1, 1};
|
||||||
word atr = (word) (chat >> 8);
|
SMALL_RECT rect;
|
||||||
|
|
||||||
coord.X = (SHORT) col;
|
rect.Top = row;
|
||||||
coord.Y = (SHORT) row;
|
rect.Left = col;
|
||||||
WriteConsoleOutputAttribute(gvid_hout, &atr, 1, coord, &x);
|
rect.Bottom = row+size.Y-1;
|
||||||
WriteConsoleOutputCharacter(gvid_hout, (char* ) &chat, 1, coord, &x);
|
rect.Right = col+size.X-1;
|
||||||
|
if(WinVer.dwPlatformId == VER_PLATFORM_WIN32_NT) {
|
||||||
|
chat.Char.UnicodeChar = gvid_tcpr(vgchar(chat));
|
||||||
|
WriteConsoleOutputW(gvid_hout, &chat, size, coord, &rect);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
WriteConsoleOutputA(gvid_hout, &chat, size, coord, &rect);
|
||||||
|
|
||||||
#elif defined(__UNIX__)
|
#elif defined(__UNIX__)
|
||||||
|
|
||||||
char chr = (char)(chat & 0xFF);
|
char chr = vgchar(chat);
|
||||||
int atr = chat >> 8;
|
int atr = vgattr(chat);
|
||||||
char* color = gvid_newattr(atr);
|
char* color = gvid_newattr(atr);
|
||||||
chat = (word)(chr | (atr << 8));
|
|
||||||
|
|
||||||
gvid_cvtstr(&chat, 1);
|
gvid_cvtstr(&chat, 1);
|
||||||
_vputw(row, col, chat);
|
_vputw(row, col, chat);
|
||||||
@ -669,23 +682,22 @@ void vputws(int row, int col, vatch* buf, uint len) {
|
|||||||
|
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
|
|
||||||
COORD coord;
|
const COORD coord = {0, 0};
|
||||||
DWORD x;
|
COORD size = {len, 1};
|
||||||
|
SMALL_RECT rect;
|
||||||
|
|
||||||
coord.X = (SHORT) col;
|
rect.Top = row;
|
||||||
coord.Y = (SHORT) row;
|
rect.Left = col;
|
||||||
|
rect.Bottom = row+size.Y-1;
|
||||||
char* p = (char *) buf;
|
rect.Right = col+size.X-1;
|
||||||
word* q = gvid->bufwrd;
|
if(WinVer.dwPlatformId == VER_PLATFORM_WIN32_NT) {
|
||||||
char* c = gvid->bufchr;
|
for(int i = 0; i < len; i++) {
|
||||||
|
buf[i].Char.UnicodeChar = gvid_tcpr(vgchar(buf[i]));
|
||||||
for(int i = 0; i < len; i++) {
|
}
|
||||||
*c++ = *p++;
|
WriteConsoleOutputW(gvid_hout, buf, size, coord, &rect);
|
||||||
*q++ = *p++;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
WriteConsoleOutputAttribute(gvid_hout, gvid->bufwrd, len, coord, &x);
|
WriteConsoleOutputA(gvid_hout, buf, size, coord, &rect);
|
||||||
WriteConsoleOutputCharacter(gvid_hout, gvid->bufchr, len, coord, &x);
|
|
||||||
|
|
||||||
#elif defined(__UNIX__)
|
#elif defined(__UNIX__)
|
||||||
|
|
||||||
@ -704,13 +716,13 @@ void vputc(int row, int col, int atr, vchar chr) {
|
|||||||
|
|
||||||
#if defined(__USE_NCURSES__)
|
#if defined(__USE_NCURSES__)
|
||||||
|
|
||||||
mvaddch(row, col, gvid_tcpr(chr) | gvid_attrcalc(atr));
|
mvaddch(row, col, vcatch(gvid_tcpr(chr), atr));
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
#elif defined(__MSDOS__)
|
#elif defined(__MSDOS__)
|
||||||
|
|
||||||
if(gvid->isdma()) {
|
if(gvid->isdma()) {
|
||||||
_vputw(row, col, (word)((atr << 8) | chr));
|
_vputw(row, col, vcatch(chr, atr));
|
||||||
}
|
}
|
||||||
else if(gvid->isbios() or gvid->iscga()) {
|
else if(gvid->isbios() or gvid->iscga()) {
|
||||||
i86 cpu;
|
i86 cpu;
|
||||||
@ -727,28 +739,15 @@ void vputc(int row, int col, int atr, vchar chr) {
|
|||||||
cpu.genint(0x10);
|
cpu.genint(0x10);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__OS2__)
|
#elif defined(__OS2__) or defined(__WIN32__)
|
||||||
|
|
||||||
BYTE tmp[2];
|
vputw(row, col, vcatch(chr, atr));
|
||||||
tmp[0] = chr;
|
|
||||||
tmp[1] = (BYTE)atr;
|
|
||||||
VioWrtNCell(tmp, 1, (USHORT)row, (USHORT)col, 0);
|
|
||||||
|
|
||||||
#elif defined(__WIN32__)
|
|
||||||
|
|
||||||
COORD coord;
|
|
||||||
DWORD x;
|
|
||||||
|
|
||||||
coord.X = (SHORT) col;
|
|
||||||
coord.Y = (SHORT) row;
|
|
||||||
WriteConsoleOutputAttribute(gvid_hout, (word *) &atr, 1, coord, &x);
|
|
||||||
WriteConsoleOutputCharacter(gvid_hout, (char *) &chr, 1, coord, &x);
|
|
||||||
|
|
||||||
#elif defined(__UNIX__)
|
#elif defined(__UNIX__)
|
||||||
|
|
||||||
char* color = gvid_newattr(atr);
|
char* color = gvid_newattr(atr);
|
||||||
gvid_cvtstr(&chr, 1);
|
gvid_cvtstr(&chr, 1);
|
||||||
_vputw(row, col, (word)((atr << 8) | chr));
|
_vputw(row, col, vcatch(chr, atr));
|
||||||
|
|
||||||
gvid_printf("\033[%u;%uH%s%c", row+1, col+1, color, chr);
|
gvid_printf("\033[%u;%uH%s%c", row+1, col+1, color, chr);
|
||||||
|
|
||||||
@ -770,11 +769,11 @@ void vputvs(int row, int col, int atr, const vchar* str) {
|
|||||||
addch(gvid_tcpr(str[counter]) | attr);
|
addch(gvid_tcpr(str[counter]) | attr);
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
vputs(row, col, atr, str);
|
vputs(row, col, atr, str);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -799,7 +798,7 @@ void vputs(int row, int col, int atr, const char* str) {
|
|||||||
gdma p = gdmaptr(col, row);
|
gdma p = gdmaptr(col, row);
|
||||||
_farsetsel(_dos_ds);
|
_farsetsel(_dos_ds);
|
||||||
while(*str) {
|
while(*str) {
|
||||||
_farnspokew(p, (atr << 8) | *str++);
|
_farnspokew(p, vcatch(*str++, atr));
|
||||||
p += ATTRSIZE;
|
p += ATTRSIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -827,15 +826,12 @@ void vputs(int row, int col, int atr, const char* str) {
|
|||||||
|
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
|
|
||||||
COORD coord;
|
int i;
|
||||||
DWORD x;
|
|
||||||
int len = strlen(str);
|
|
||||||
|
|
||||||
coord.X = (SHORT) col;
|
for(i = 0; *str; i++)
|
||||||
coord.Y = (SHORT) row;
|
gvid->bufwrd[i] = vcatch(*str++, atr);
|
||||||
|
if(i)
|
||||||
FillConsoleOutputAttribute(gvid_hout, (word) atr, len, coord, &x);
|
vputws(row, col, gvid->bufwrd, i);
|
||||||
WriteConsoleOutputCharacter(gvid_hout, str, len, coord, &x);
|
|
||||||
|
|
||||||
#elif defined(__UNIX__)
|
#elif defined(__UNIX__)
|
||||||
|
|
||||||
@ -846,7 +842,7 @@ void vputs(int row, int col, int atr, const char* str) {
|
|||||||
gdma p = gdmaptr(col, row);
|
gdma p = gdmaptr(col, row);
|
||||||
_farsetsel(_dos_ds);
|
_farsetsel(_dos_ds);
|
||||||
while(*str) {
|
while(*str) {
|
||||||
_farnspokew(p, (atr << 8) | *str++);
|
_farnspokew(p, vcatch(*str++, atr));
|
||||||
p += ATTRSIZE;
|
p += ATTRSIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -925,29 +921,20 @@ void vputns(int row, int col, int atr, const char* str, uint width) {
|
|||||||
VioWrtCharStrAtt((PCCH)str, (USHORT)minimum_of_two(len,width), (USHORT)row, (USHORT)col, (PBYTE)&atr, 0);
|
VioWrtCharStrAtt((PCCH)str, (USHORT)minimum_of_two(len,width), (USHORT)row, (USHORT)col, (PBYTE)&atr, 0);
|
||||||
|
|
||||||
if(width > len) {
|
if(width > len) {
|
||||||
BYTE tmp[2];
|
vatch filler = vcatch(fillchar, atr);
|
||||||
tmp[0] = fillchar;
|
VioWrtNCell((CHAR *)&filler, (USHORT)(width-len), (USHORT)row, (USHORT)(col+len), 0);
|
||||||
tmp[1] = (BYTE)atr;
|
|
||||||
VioWrtNCell(tmp, (USHORT)(width-len), (USHORT)row, (USHORT)(col+len), 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
|
|
||||||
COORD coord;
|
int i;
|
||||||
DWORD x;
|
|
||||||
int len = minimum_of_two(strlen(str), width);
|
|
||||||
|
|
||||||
coord.X = (SHORT) col;
|
for(i = 0; (i < width) and *str; i++)
|
||||||
coord.Y = (SHORT) row;
|
gvid->bufwrd[i] = vcatch(*str++, atr);
|
||||||
FillConsoleOutputAttribute(gvid_hout, (word) atr, width, coord, &x);
|
vatch filler = vcatch(fillchar, atr);
|
||||||
WriteConsoleOutputCharacter(gvid_hout, str, len, coord, &x);
|
for(; i < width; i++)
|
||||||
|
gvid->bufwrd[i] = filler;
|
||||||
if(width > len) {
|
vputws(row, col, gvid->bufwrd, width);
|
||||||
coord.X += (SHORT) len;
|
|
||||||
len = width - len;
|
|
||||||
|
|
||||||
FillConsoleOutputCharacter(gvid_hout, fillchar, len, coord, &x);
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(__UNIX__)
|
#elif defined(__UNIX__)
|
||||||
|
|
||||||
@ -985,7 +972,7 @@ void vputns(int row, int col, int atr, const char* str, uint width) {
|
|||||||
void _vputx(int row, int col, int atr, char chr, uint len) {
|
void _vputx(int row, int col, int atr, char chr, uint len) {
|
||||||
|
|
||||||
gdma p = gdmaptr(col, row);
|
gdma p = gdmaptr(col, row);
|
||||||
word tmp = (word)((atr << 8) | chr);
|
word tmp = vcatch(chr, atr);
|
||||||
_farsetsel(_dos_ds);
|
_farsetsel(_dos_ds);
|
||||||
for(uint n=0; n<len; n++) {
|
for(uint n=0; n<len; n++) {
|
||||||
_farnspokew(p, tmp);
|
_farnspokew(p, tmp);
|
||||||
@ -1002,8 +989,7 @@ void vputx(int row, int col, int atr, vchar chr, uint len) {
|
|||||||
|
|
||||||
#if defined(__USE_NCURSES__)
|
#if defined(__USE_NCURSES__)
|
||||||
|
|
||||||
int attr = gvid_attrcalc(atr);
|
mvhline(row, col, vcatch(gvid_tcpr(chr), atr), len);
|
||||||
mvhline(row, col, gvid_tcpr(chr) | attr, len);
|
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
#elif defined(__MSDOS__)
|
#elif defined(__MSDOS__)
|
||||||
@ -1028,19 +1014,15 @@ void vputx(int row, int col, int atr, vchar chr, uint len) {
|
|||||||
|
|
||||||
#elif defined(__OS2__)
|
#elif defined(__OS2__)
|
||||||
|
|
||||||
BYTE tmp[2];
|
vatch filler = vcatch(chr, atr);
|
||||||
tmp[0] = chr;
|
VioWrtNCell((CHAR *)&filler, (USHORT)len, (USHORT)row, (USHORT)col, 0);
|
||||||
tmp[1] = (BYTE)atr;
|
|
||||||
VioWrtNCell(tmp, (USHORT)len, (USHORT)row, (USHORT)col, 0);
|
|
||||||
|
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
|
|
||||||
COORD c;
|
vatch filler = vcatch(chr, atr);
|
||||||
c.X = (SHORT)col;
|
for(int i = 0; i < len; i++)
|
||||||
c.Y = (SHORT)row;
|
gvid->bufwrd[i] = filler;
|
||||||
DWORD wr;
|
vputws(row, col, gvid->bufwrd, len);
|
||||||
FillConsoleOutputCharacter(gvid_hout, chr, len, c, &wr);
|
|
||||||
FillConsoleOutputAttribute(gvid_hout, (WORD)atr, len, c, &wr);
|
|
||||||
|
|
||||||
#elif defined(__UNIX__)
|
#elif defined(__UNIX__)
|
||||||
|
|
||||||
@ -1063,7 +1045,7 @@ void vputx(int row, int col, int atr, vchar chr, uint len) {
|
|||||||
inline void _vputy(int row, int col, int atr, char chr, uint len) {
|
inline void _vputy(int row, int col, int atr, char chr, uint len) {
|
||||||
|
|
||||||
gdma p = gdmaptr(col, row);
|
gdma p = gdmaptr(col, row);
|
||||||
word tmp = (word)((atr<<8) | chr);
|
word tmp = vcatch(chr, atr);
|
||||||
_farsetsel(_dos_ds);
|
_farsetsel(_dos_ds);
|
||||||
for(uint n=0; n<len; n++) {
|
for(uint n=0; n<len; n++) {
|
||||||
_farnspokew(p, tmp);
|
_farnspokew(p, tmp);
|
||||||
@ -1080,8 +1062,7 @@ void vputy(int row, int col, int atr, vchar chr, uint len) {
|
|||||||
|
|
||||||
#if defined(__USE_NCURSES__)
|
#if defined(__USE_NCURSES__)
|
||||||
|
|
||||||
int attr = gvid_attrcalc(atr);
|
mvvline(row, col, vcatch(gvid_tcpr(chr), atr), len);
|
||||||
mvvline(row, col, gvid_tcpr(chr) | attr, len);
|
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
#elif defined(__MSDOS__)
|
#elif defined(__MSDOS__)
|
||||||
@ -1108,24 +1089,15 @@ void vputy(int row, int col, int atr, vchar chr, uint len) {
|
|||||||
|
|
||||||
#elif defined(__OS2__)
|
#elif defined(__OS2__)
|
||||||
|
|
||||||
BYTE tmp[2];
|
vatch filler = vcatch(chr, atr);
|
||||||
tmp[0] = chr;
|
|
||||||
tmp[1] = (BYTE)atr;
|
|
||||||
for(int n=0; n<len; n++)
|
for(int n=0; n<len; n++)
|
||||||
VioWrtNCell(tmp, 1, (USHORT)row++, (USHORT)col, 0);
|
VioWrtNCell((CHAR *)&filler, 1, (USHORT)row++, (USHORT)col, 0);
|
||||||
|
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
|
|
||||||
COORD coord;
|
vatch filler = vcatch(chr, atr);
|
||||||
DWORD x;
|
for(int i=0; i < len; i++)
|
||||||
|
vputw(row++, col, filler);
|
||||||
coord.X = (SHORT) col;
|
|
||||||
|
|
||||||
for(int i=0; i < len; i++) {
|
|
||||||
coord.Y = (SHORT) row++;
|
|
||||||
WriteConsoleOutputAttribute(gvid_hout, (word *) &atr, 1, coord, &x);
|
|
||||||
WriteConsoleOutputCharacter(gvid_hout, (char *) &chr, 1, coord, &x);
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(__UNIX__)
|
#elif defined(__UNIX__)
|
||||||
|
|
||||||
@ -1197,31 +1169,27 @@ vatch vgetw(int row, int col) {
|
|||||||
|
|
||||||
#elif defined(__OS2__)
|
#elif defined(__OS2__)
|
||||||
|
|
||||||
word chat;
|
vatch chat;
|
||||||
USHORT _row=(USHORT)row, _col=(USHORT)col, len=sizeof(chat);
|
USHORT len=sizeof(chat);
|
||||||
|
|
||||||
#if defined(__EMX__)
|
VioReadCellStr((CHAR *)&chat, &len, (USHORT)row, (USHORT)col, 0);
|
||||||
VioReadCellStr((PCH)&chat, &len, _row, _col, 0);
|
|
||||||
#else
|
|
||||||
VioReadCellStr((CHAR*)&chat, &len, _row, _col, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return chat;
|
return chat;
|
||||||
|
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
|
|
||||||
COORD coord;
|
vatch chat;
|
||||||
DWORD x;
|
const COORD coord = {0, 0};
|
||||||
word atr;
|
const COORD size = {1, 1};
|
||||||
char chr;
|
SMALL_RECT rect;
|
||||||
|
|
||||||
coord.X = (SHORT) col;
|
rect.Top = row;
|
||||||
coord.Y = (SHORT) row;
|
rect.Left = col;
|
||||||
|
rect.Bottom = row+size.Y-1;
|
||||||
|
rect.Right = col+size.X-1;
|
||||||
|
ReadConsoleOutput(gvid_hout, &chat, size, coord, &rect);
|
||||||
|
|
||||||
ReadConsoleOutputAttribute(gvid_hout, &atr, 1, coord, &x);
|
return chat;
|
||||||
ReadConsoleOutputCharacter(gvid_hout, &chr, 1, coord, &x);
|
|
||||||
|
|
||||||
return (word)((atr << 8) | chr);
|
|
||||||
|
|
||||||
#elif defined(__UNIX__)
|
#elif defined(__UNIX__)
|
||||||
|
|
||||||
@ -1231,79 +1199,15 @@ vatch vgetw(int row, int col) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
|
||||||
// Get character and attribute at cursor position
|
|
||||||
|
|
||||||
#if (defined(__MSDOS__) or defined(__UNIX__)) and not defined(__USE_NCURSES__)
|
|
||||||
inline void _vgetc(int row, int col, int* atr, char* chr) {
|
|
||||||
|
|
||||||
word w = _vgetw(row, col);
|
|
||||||
*chr = (char)(w & 0xFF);
|
|
||||||
*atr = (int)(w >> 8);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// 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, int* atr, vchar* chr) {
|
||||||
|
|
||||||
#if defined(__USE_NCURSES__)
|
vatch tmp = vgetw(row, col);
|
||||||
|
|
||||||
chtype charead = mvinch(row, col);
|
*chr = vgchar(tmp);
|
||||||
*chr = (charead & A_CHARTEXT);
|
*atr = vgattr(tmp);
|
||||||
*atr = gvid_dosattrcalc(charead & (A_ATTRIBUTES | A_COLOR));
|
|
||||||
|
|
||||||
#elif defined(__MSDOS__)
|
|
||||||
|
|
||||||
if(gvid->isdma()) {
|
|
||||||
_vgetc(row, col, atr, chr);
|
|
||||||
}
|
|
||||||
else if(gvid->isbios() or gvid->iscga()) {
|
|
||||||
i86 cpu;
|
|
||||||
cpu.ah(2);
|
|
||||||
cpu.bh(0);
|
|
||||||
cpu.dh((byte)row);
|
|
||||||
cpu.dl((byte)col);
|
|
||||||
cpu.genint(0x10);
|
|
||||||
cpu.ah(8);
|
|
||||||
cpu.bh(0);
|
|
||||||
cpu.genint(0x10);
|
|
||||||
*chr = cpu.al();
|
|
||||||
*atr = cpu.ah();
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(__OS2__)
|
|
||||||
|
|
||||||
CHAR tmp[2];
|
|
||||||
USHORT _row=(USHORT)row, _col=(USHORT)col, len=sizeof(tmp);
|
|
||||||
|
|
||||||
#if defined(__EMX__)
|
|
||||||
VioReadCellStr((PCH)tmp, &len, _row, _col, 0);
|
|
||||||
#else
|
|
||||||
VioReadCellStr(tmp, &len, _row, _col, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
*chr = tmp[0];
|
|
||||||
*atr = tmp[1];
|
|
||||||
|
|
||||||
#elif defined(__WIN32__)
|
|
||||||
|
|
||||||
COORD coord;
|
|
||||||
DWORD x;
|
|
||||||
|
|
||||||
coord.X = (SHORT) col;
|
|
||||||
coord.Y = (SHORT) row;
|
|
||||||
|
|
||||||
ReadConsoleOutputAttribute(gvid_hout, (word* ) atr, 1, coord, &x);
|
|
||||||
ReadConsoleOutputCharacter(gvid_hout, (char* ) chr, 1, coord, &x);
|
|
||||||
|
|
||||||
#elif defined(__UNIX__)
|
|
||||||
|
|
||||||
_vgetc(row, col, atr, chr);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1357,12 +1261,14 @@ void vscroll(int srow, int scol, int erow, int ecol, int atr, int lines) {
|
|||||||
|
|
||||||
#if defined(__USE_NCURSES__)
|
#if defined(__USE_NCURSES__)
|
||||||
|
|
||||||
|
vatch filler = vcatch(' ', atr);
|
||||||
|
|
||||||
// Currently implemented with vsave/vrestore
|
// Currently implemented with vsave/vrestore
|
||||||
// Does anyone know a better solution?
|
// Does anyone know a better solution?
|
||||||
|
|
||||||
if(lines >= 0) {
|
if(lines >= 0) {
|
||||||
if(lines <= 1 + erow - srow) {
|
if(lines <= 1 + erow - srow) {
|
||||||
vatch *buf = vsave(srow + lines, scol, erow, ecol);
|
vsavebuf *buf = vsave(srow + lines, scol, erow, ecol);
|
||||||
vrestore(buf, srow, scol, erow - lines, ecol);
|
vrestore(buf, srow, scol, erow - lines, ecol);
|
||||||
throw_xfree(buf);
|
throw_xfree(buf);
|
||||||
}
|
}
|
||||||
@ -1370,13 +1276,13 @@ void vscroll(int srow, int scol, int erow, int ecol, int atr, int lines) {
|
|||||||
lines = 1 + erow - srow;
|
lines = 1 + erow - srow;
|
||||||
|
|
||||||
for(int counter = 0; counter < lines; counter++)
|
for(int counter = 0; counter < lines; counter++)
|
||||||
mvhline(1 + erow + counter - lines, scol, ' ' | gvid_attrcalc(atr), 1 + ecol - scol);
|
mvhline(1 + erow + counter - lines, scol, filler, 1 + ecol - scol);
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lines*=-1;
|
lines*=-1;
|
||||||
if(lines <= 1 + erow - srow) {
|
if(lines <= 1 + erow - srow) {
|
||||||
vatch *buf = vsave(srow, scol, erow - lines, ecol);
|
vsavebuf *buf = vsave(srow, scol, erow - lines, ecol);
|
||||||
vrestore(buf, srow + lines, scol, erow, ecol);
|
vrestore(buf, srow + lines, scol, erow, ecol);
|
||||||
throw_xfree(buf);
|
throw_xfree(buf);
|
||||||
}
|
}
|
||||||
@ -1384,7 +1290,7 @@ void vscroll(int srow, int scol, int erow, int ecol, int atr, int lines) {
|
|||||||
lines = 1 + erow - srow;
|
lines = 1 + erow - srow;
|
||||||
|
|
||||||
for(int counter = 0; counter < lines; counter++)
|
for(int counter = 0; counter < lines; counter++)
|
||||||
mvhline(srow + counter, scol, ' ' | gvid_attrcalc(atr), 1 + ecol - scol);
|
mvhline(srow + counter, scol, filler, 1 + ecol - scol);
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1407,32 +1313,25 @@ void vscroll(int srow, int scol, int erow, int ecol, int atr, int lines) {
|
|||||||
|
|
||||||
#elif defined(__OS2__)
|
#elif defined(__OS2__)
|
||||||
|
|
||||||
BYTE tmp[2];
|
vatch filler = vcatch(' ', atr);
|
||||||
tmp[0] = ' ';
|
|
||||||
tmp[1] = (BYTE)atr;
|
|
||||||
if(lines > 0)
|
if(lines > 0)
|
||||||
VioScrollUp((USHORT)srow, (USHORT)scol, (USHORT)erow, (USHORT)ecol, (USHORT)lines, tmp, 0);
|
VioScrollUp((USHORT)srow, (USHORT)scol, (USHORT)erow, (USHORT)ecol, (USHORT)lines, (CHAR *)&filler, 0);
|
||||||
else
|
else
|
||||||
VioScrollDn((USHORT)srow, (USHORT)scol, (USHORT)erow, (USHORT)ecol, (USHORT)-lines, tmp, 0);
|
VioScrollDn((USHORT)srow, (USHORT)scol, (USHORT)erow, (USHORT)ecol, (USHORT)-lines, (CHAR *)&filler, 0);
|
||||||
|
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
|
|
||||||
CHAR_INFO fill;
|
|
||||||
fill.Char.UnicodeChar = 0;
|
|
||||||
fill.Char.AsciiChar = ' ';
|
|
||||||
fill.Attributes = (WORD)atr;
|
|
||||||
|
|
||||||
SMALL_RECT r;
|
SMALL_RECT r;
|
||||||
|
COORD c = {scol, srow - lines};
|
||||||
|
vatch filler = vcatch(' ', atr);
|
||||||
|
|
||||||
r.Left = (SHORT)scol;
|
r.Left = (SHORT)scol;
|
||||||
r.Top = (SHORT)srow;
|
r.Top = (SHORT)srow;
|
||||||
r.Right = (SHORT)ecol;
|
r.Right = (SHORT)ecol;
|
||||||
r.Bottom = (SHORT)erow;
|
r.Bottom = (SHORT)erow;
|
||||||
|
|
||||||
COORD c;
|
ScrollConsoleScreenBuffer(gvid_hout, &r, &r, c, &filler);
|
||||||
c.X = (SHORT)scol;
|
|
||||||
c.Y = (SHORT)(srow - lines);
|
|
||||||
|
|
||||||
ScrollConsoleScreenBuffer(gvid_hout, &r, &r, c, &fill);
|
|
||||||
|
|
||||||
#elif defined(__UNIX__)
|
#elif defined(__UNIX__)
|
||||||
|
|
||||||
@ -1528,15 +1427,13 @@ void vposset(int row, int col) {
|
|||||||
|
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
|
|
||||||
// No need to set the cursor position if its not visible
|
// No need to set the cursor position if its not visible
|
||||||
// Strangely, this is a major speedup to screen-output
|
// Strangely, this is a major speedup to screen-output
|
||||||
|
|
||||||
if(__vcurhidden)
|
if(__vcurhidden)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
COORD c;
|
COORD c = {col, row};
|
||||||
c.X = (SHORT)col;
|
|
||||||
c.Y = (SHORT)row;
|
|
||||||
SetConsoleCursorPosition(gvid_hout, c);
|
SetConsoleCursorPosition(gvid_hout, c);
|
||||||
|
|
||||||
#elif defined(__UNIX__)
|
#elif defined(__UNIX__)
|
||||||
@ -1552,11 +1449,7 @@ void vposset(int row, int col) {
|
|||||||
|
|
||||||
void vclrscr() {
|
void vclrscr() {
|
||||||
|
|
||||||
#if defined(__USE_NCURSES__)
|
vclrscr(vgattr(vgetw(gvid->currow, gvid->curcol)));
|
||||||
vclrscr((byte)gvid_dosattrcalc(vgetw(gvid->currow, gvid->curcol)));
|
|
||||||
#else
|
|
||||||
vclrscr((byte)(vgetw(gvid->currow, gvid->curcol) >> 8));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1582,8 +1475,9 @@ void vclrscr(int atr) {
|
|||||||
#if defined(__USE_NCURSES__)
|
#if defined(__USE_NCURSES__)
|
||||||
|
|
||||||
clearok(stdscr, TRUE);
|
clearok(stdscr, TRUE);
|
||||||
|
vatch filler = vcatch(' ', atr);
|
||||||
for(int row = 0; row < LINES; row++)
|
for(int row = 0; row < LINES; row++)
|
||||||
mvhline(row, 0, ' ' | gvid_attrcalc(atr), COLS);
|
mvhline(row, 0, filler, COLS);
|
||||||
move(0, 0);
|
move(0, 0);
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
@ -1604,16 +1498,14 @@ void vclrscr(int atr) {
|
|||||||
|
|
||||||
#elif defined(__OS2__)
|
#elif defined(__OS2__)
|
||||||
|
|
||||||
BYTE tmp[2];
|
vatch filler = vcatch(' ', atr);
|
||||||
tmp[0] = ' ';
|
VioScrollUp(0, 0, 0xFFFF, 0xFFFF, 0xFFFF, (CHAR *)&filler, 0);
|
||||||
tmp[1] = (BYTE)atr;
|
|
||||||
VioScrollUp(0, 0, 0xFFFF, 0xFFFF, 0xFFFF, tmp, 0);
|
|
||||||
|
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
|
|
||||||
COORD c;
|
COORD c = {0, 0};
|
||||||
c.X = c.Y = 0;
|
|
||||||
DWORD wr, len = gvid->numrows * gvid->numcols;
|
DWORD wr, len = gvid->numrows * gvid->numcols;
|
||||||
|
// Filling with space seems to work for both Unicode and regular functions
|
||||||
FillConsoleOutputCharacter(gvid_hout, ' ', len, c, &wr);
|
FillConsoleOutputCharacter(gvid_hout, ' ', len, c, &wr);
|
||||||
FillConsoleOutputAttribute(gvid_hout, (WORD)atr, len, c, &wr);
|
FillConsoleOutputAttribute(gvid_hout, (WORD)atr, len, c, &wr);
|
||||||
|
|
||||||
@ -1649,42 +1541,32 @@ static void _vsave(word* buf, int len1, int srow, int scol, int erow) {
|
|||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// Saves the current screen and returns pointer to buffer
|
// Saves the current screen and returns pointer to buffer
|
||||||
|
|
||||||
vatch* vsave(int __srow, int __scol, int __erow, int __ecol) {
|
vsavebuf* vsave(int srow, int scol, int erow, int ecol) {
|
||||||
|
|
||||||
if(__srow == -1) __srow = 0;
|
if(srow == -1) srow = 0;
|
||||||
if(__scol == -1) __scol = 0;
|
if(scol == -1) scol = 0;
|
||||||
if(__erow == -1) __erow = gvid->numrows-1;
|
if(erow == -1) erow = gvid->numrows-1;
|
||||||
if(__ecol == -1) __ecol = gvid->numcols-1;
|
if(ecol == -1) ecol = gvid->numcols-1;
|
||||||
|
|
||||||
vatch* sbuf = (vatch*)throw_xcalloc((((__erow-__srow+1)*(__ecol-__scol+1))+4), sizeof(vatch));
|
vsavebuf* sbuf = (vsavebuf*)throw_xmalloc(sizeof(vsavebuf) + (erow - srow + 1) * (ecol - scol + 1) * sizeof(vatch));
|
||||||
|
|
||||||
if(sbuf) {
|
if(sbuf) {
|
||||||
|
|
||||||
vatch* buf = sbuf;
|
vatch* buf = sbuf->data;
|
||||||
|
|
||||||
buf[0] = (vatch)__srow;
|
sbuf->top = srow;
|
||||||
buf[1] = (vatch)__scol;
|
sbuf->left = scol;
|
||||||
buf[2] = (vatch)__erow;
|
sbuf->bottom = erow;
|
||||||
buf[3] = (vatch)__ecol;
|
sbuf->right = ecol;
|
||||||
|
|
||||||
#if defined(__USE_NCURSES__)
|
#if defined(__USE_NCURSES__)
|
||||||
|
|
||||||
int srow = *buf++;
|
|
||||||
int scol = *buf++;
|
|
||||||
int erow = *buf++;
|
|
||||||
int ecol = *buf++;
|
|
||||||
|
|
||||||
for(int row=srow; row<=erow; row++)
|
for(int row=srow; row<=erow; row++)
|
||||||
for(int col=scol; col<=ecol; col++)
|
for(int col=scol; col<=ecol; col++)
|
||||||
*buf++ = mvinch(row, col);
|
*buf++ = mvinch(row, col);
|
||||||
|
|
||||||
#elif defined(__MSDOS__)
|
#elif defined(__MSDOS__)
|
||||||
|
|
||||||
int srow = *buf++;
|
|
||||||
int scol = *buf++;
|
|
||||||
int erow = *buf++;
|
|
||||||
int ecol = *buf++;
|
|
||||||
|
|
||||||
int len1 = ecol-scol+1;
|
int len1 = ecol-scol+1;
|
||||||
|
|
||||||
if(gvid->isdma()) {
|
if(gvid->isdma()) {
|
||||||
@ -1711,12 +1593,7 @@ vatch* vsave(int __srow, int __scol, int __erow, int __ecol) {
|
|||||||
|
|
||||||
#elif defined(__OS2__)
|
#elif defined(__OS2__)
|
||||||
|
|
||||||
USHORT srow = *buf++;
|
int len1 = (int)(ecol-scol+1);
|
||||||
USHORT scol = *buf++;
|
|
||||||
USHORT erow = *buf++;
|
|
||||||
USHORT ecol = *buf++;
|
|
||||||
|
|
||||||
USHORT len1 = (USHORT)(ecol-scol+1);
|
|
||||||
|
|
||||||
#if defined(__BORLANDC__)
|
#if defined(__BORLANDC__)
|
||||||
PCHAR16 ptr = (PCHAR16)buf;
|
PCHAR16 ptr = (PCHAR16)buf;
|
||||||
@ -1725,46 +1602,30 @@ vatch* vsave(int __srow, int __scol, int __erow, int __ecol) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
USHORT len2 = (USHORT)(len1*sizeof(word));
|
USHORT len2 = (USHORT)(len1*sizeof(word));
|
||||||
for(USHORT nrow=srow; nrow<=erow; nrow++) {
|
for(int nrow=srow; nrow<=erow; nrow++) {
|
||||||
VioReadCellStr(ptr, &len2, nrow, scol, 0);
|
VioReadCellStr(ptr, &len2, nrow, scol, 0);
|
||||||
ptr += len2;
|
ptr += len2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
|
|
||||||
COORD coord;
|
const COORD coord = {0, 0};
|
||||||
DWORD x;
|
COORD size = {ecol-scol+1, erow-srow+1};
|
||||||
SHORT srow = *buf++;
|
SMALL_RECT r;
|
||||||
SHORT scol = *buf++;
|
|
||||||
SHORT erow = *buf++;
|
|
||||||
SHORT ecol = *buf++;
|
|
||||||
|
|
||||||
coord.X = scol;
|
// Set the source rectangle.
|
||||||
|
r.Top = srow;
|
||||||
|
r.Left = scol;
|
||||||
|
r.Bottom = erow;
|
||||||
|
r.Right = ecol;
|
||||||
|
|
||||||
SHORT len1 = (SHORT)(ecol-scol+1);
|
if(WinVer.dwPlatformId == VER_PLATFORM_WIN32_NT)
|
||||||
char* p = (char *) buf;
|
ReadConsoleOutputW(gvid_hout, buf, size, coord, &r);
|
||||||
|
else
|
||||||
for(SHORT nrow=srow; nrow<=erow; nrow++) {
|
ReadConsoleOutputA(gvid_hout, buf, size, coord, &r);
|
||||||
coord.Y = nrow;
|
|
||||||
ReadConsoleOutputAttribute(gvid_hout, gvid->bufwrd, len1, coord, &x);
|
|
||||||
ReadConsoleOutputCharacter(gvid_hout, gvid->bufchr, len1, coord, &x);
|
|
||||||
|
|
||||||
word* q = gvid->bufwrd;
|
|
||||||
char* c = gvid->bufchr;
|
|
||||||
|
|
||||||
for(int i = 0; i < len1; i++) {
|
|
||||||
*p++ = *c++;
|
|
||||||
*p++ = (byte) *q++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(__UNIX__)
|
#elif defined(__UNIX__)
|
||||||
|
|
||||||
int srow = *buf++;
|
|
||||||
int scol = *buf++;
|
|
||||||
int erow = *buf++;
|
|
||||||
int ecol = *buf++;
|
|
||||||
|
|
||||||
int len1 = ecol-scol+1;
|
int len1 = ecol-scol+1;
|
||||||
|
|
||||||
_vsave(buf, len1, srow, scol, erow);
|
_vsave(buf, len1, srow, scol, erow);
|
||||||
@ -1796,33 +1657,30 @@ static void _vredraw(word* buf, int len1, int srow, int scol, int erow) {
|
|||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// Redraws a previously saved screen
|
// Redraws a previously saved screen
|
||||||
|
|
||||||
void vredraw(vatch* buf, int __srow, int __scol, int __erow, int __ecol) {
|
void vrestore(vsavebuf* sbuf, int srow, int scol, int erow, int ecol) {
|
||||||
|
|
||||||
if(__srow != -1) buf[0] = (vatch)__srow;
|
if(srow != -1) sbuf->top = srow;
|
||||||
if(__scol != -1) buf[1] = (vatch)__scol;
|
if(scol != -1) sbuf->left = scol;
|
||||||
if(__erow != -1) buf[2] = (vatch)__erow;
|
if(erow != -1) sbuf->bottom = erow;
|
||||||
if(__ecol != -1) buf[3] = (vatch)__ecol;
|
if(ecol != -1) sbuf->right = ecol;
|
||||||
|
|
||||||
|
srow = sbuf->top;
|
||||||
|
scol = sbuf->left;
|
||||||
|
erow = sbuf->bottom;
|
||||||
|
ecol = sbuf->right;
|
||||||
|
|
||||||
|
vatch *buf = sbuf->data;
|
||||||
|
|
||||||
#if defined(__USE_NCURSES__)
|
#if defined(__USE_NCURSES__)
|
||||||
|
|
||||||
int srow = *buf++;
|
for(int row=srow; row<=erow; row++)
|
||||||
int scol = *buf++;
|
for(int col=scol; col<=ecol; col++)
|
||||||
int erow = *buf++;
|
mvaddch(row, col, *buf++);
|
||||||
int ecol = *buf++;
|
|
||||||
|
|
||||||
for(int row=srow; row<=erow; row++)
|
|
||||||
for(int col=scol; col<=ecol; col++)
|
|
||||||
mvaddch(row, col, *buf++);
|
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
#elif defined(__MSDOS__)
|
#elif defined(__MSDOS__)
|
||||||
|
|
||||||
int srow = *buf++;
|
|
||||||
int scol = *buf++;
|
|
||||||
int erow = *buf++;
|
|
||||||
int ecol = *buf++;
|
|
||||||
|
|
||||||
int len1 = ecol-scol+1;
|
int len1 = ecol-scol+1;
|
||||||
|
|
||||||
if(gvid->isdma()) {
|
if(gvid->isdma()) {
|
||||||
@ -1850,11 +1708,6 @@ void vredraw(vatch* buf, int __srow, int __scol, int __erow, int __ecol) {
|
|||||||
|
|
||||||
#elif defined(__OS2__)
|
#elif defined(__OS2__)
|
||||||
|
|
||||||
USHORT srow = *buf++;
|
|
||||||
USHORT scol = *buf++;
|
|
||||||
USHORT erow = *buf++;
|
|
||||||
USHORT ecol = *buf++;
|
|
||||||
|
|
||||||
USHORT len1 = (USHORT)(ecol-scol+1);
|
USHORT len1 = (USHORT)(ecol-scol+1);
|
||||||
USHORT len2 = (USHORT)(len1*sizeof(word));
|
USHORT len2 = (USHORT)(len1*sizeof(word));
|
||||||
|
|
||||||
@ -1871,30 +1724,28 @@ void vredraw(vatch* buf, int __srow, int __scol, int __erow, int __ecol) {
|
|||||||
|
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
|
|
||||||
SHORT srow = *buf++;
|
const COORD coord = {0, 0};
|
||||||
SHORT scol = *buf++;
|
COORD size = {ecol-scol+1, erow-srow+1};
|
||||||
SHORT erow = *buf++;
|
SMALL_RECT r;
|
||||||
SHORT ecol = *buf++;
|
|
||||||
|
|
||||||
SHORT len1 = (SHORT)(ecol-scol+1);
|
// Set the source rectangle.
|
||||||
|
r.Top = srow;
|
||||||
|
r.Left = scol;
|
||||||
|
r.Bottom = erow;
|
||||||
|
r.Right = ecol;
|
||||||
|
|
||||||
for(SHORT nrow=srow; nrow<=erow; nrow++) {
|
if(WinVer.dwPlatformId == VER_PLATFORM_WIN32_NT)
|
||||||
vputws(nrow, scol, buf, len1);
|
WriteConsoleOutputW(gvid_hout, buf, size, coord, &r);
|
||||||
buf += len1;
|
else
|
||||||
}
|
WriteConsoleOutputA(gvid_hout, buf, size, coord, &r);
|
||||||
|
|
||||||
#elif defined(__UNIX__)
|
#elif defined(__UNIX__)
|
||||||
|
|
||||||
int srow = *buf++;
|
|
||||||
int scol = *buf++;
|
|
||||||
int erow = *buf++;
|
|
||||||
int ecol = *buf++;
|
|
||||||
|
|
||||||
int len1 = ecol-scol+1;
|
int len1 = ecol-scol+1;
|
||||||
|
|
||||||
_vredraw(buf, len1, srow, scol, erow);
|
_vredraw(buf, len1, srow, scol, erow);
|
||||||
|
|
||||||
int atr = *buf >> 8;
|
int atr = vgattr(*buf);
|
||||||
char* color = gvid_newattr(atr);
|
char* color = gvid_newattr(atr);
|
||||||
gvid_printf("%s", color);
|
gvid_printf("%s", color);
|
||||||
|
|
||||||
@ -1907,15 +1758,6 @@ void vredraw(vatch* buf, int __srow, int __scol, int __erow, int __ecol) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
|
||||||
// Restores a previously saved screen and frees buffer
|
|
||||||
|
|
||||||
void vrestore(vatch* buf, int srow, int scol, int erow, int ecol) {
|
|
||||||
|
|
||||||
vredraw(buf, srow, scol, erow, ecol);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// Sets the cursor shape/size
|
// Sets the cursor shape/size
|
||||||
|
|
||||||
@ -2282,69 +2124,4 @@ void vfill(int srow, int scol, int erow, int ecol, vchar chr, int atr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
|
||||||
// Gets the character part of a character-attribute group
|
|
||||||
|
|
||||||
vchar vgchar (vatch chat) {
|
|
||||||
|
|
||||||
#if defined(__USE_NCURSES__)
|
|
||||||
return chat & (A_CHARTEXT | A_ALTCHARSET);
|
|
||||||
#else
|
|
||||||
return chat & 0xff;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
|
||||||
// Gets the attribute part of a character-attribute group
|
|
||||||
|
|
||||||
int vgattr (vatch chat) {
|
|
||||||
|
|
||||||
#if defined(__USE_NCURSES__)
|
|
||||||
return gvid_dosattrcalc(chat);
|
|
||||||
#else
|
|
||||||
return (chat >> 8) & 0xff;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
|
||||||
// Sets the given character in a character-attribute group
|
|
||||||
|
|
||||||
vatch vschar (vatch chat, vchar chr) {
|
|
||||||
|
|
||||||
#if defined(__USE_NCURSES__)
|
|
||||||
return (chr&(A_CHARTEXT|A_ALTCHARSET))|(chat&~(A_CHARTEXT|A_ALTCHARSET));
|
|
||||||
#else
|
|
||||||
return (chat & 0xff00) | chr;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
|
||||||
// Sets the given attribute in a character-attribute group
|
|
||||||
|
|
||||||
vatch vsattr (vatch chat, int atr) {
|
|
||||||
|
|
||||||
#if defined(__USE_NCURSES__)
|
|
||||||
return (chat & (A_CHARTEXT | A_ALTCHARSET)) | gvid_attrcalc(atr);
|
|
||||||
#else
|
|
||||||
return (chat & 0xff) | (atr << 8);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
|
||||||
// Compose character-attribute group from character and attribute
|
|
||||||
|
|
||||||
vatch vcatch (vchar chr, int atr) {
|
|
||||||
|
|
||||||
#if defined(__USE_NCURSES__)
|
|
||||||
return chr | gvid_attrcalc(atr);
|
|
||||||
#else
|
|
||||||
return (chr & 0xff) | ((atr << 8) & 0xff00) ;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
@ -83,14 +83,8 @@
|
|||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// Global video data
|
// Global video data
|
||||||
|
|
||||||
#ifdef __WIN32__
|
|
||||||
HANDLE gvid_hout;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GVid *gvid;
|
GVid *gvid;
|
||||||
|
|
||||||
int __gdvdetected = false;
|
|
||||||
|
|
||||||
#if defined(__USE_NCURSES__)
|
#if defined(__USE_NCURSES__)
|
||||||
|
|
||||||
// add statics here
|
// add statics here
|
||||||
@ -105,6 +99,14 @@ const char* gvid_acs_disable;
|
|||||||
void _vputx(int row, int col, int atr, char chr, uint len);
|
void _vputx(int row, int col, int atr, char chr, uint len);
|
||||||
void gvid_printf(const char* fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
void gvid_printf(const char* fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
|
|
||||||
|
#elif defined(__WIN32__)
|
||||||
|
|
||||||
|
HANDLE gvid_hout = INVALID_HANDLE_VALUE;
|
||||||
|
|
||||||
|
#elif defined(__MSDOS__)
|
||||||
|
|
||||||
|
int __gdvdetected = false;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -138,12 +140,13 @@ GVid::~GVid() {
|
|||||||
endwin();
|
endwin();
|
||||||
|
|
||||||
#elif defined(__UNIX__)
|
#elif defined(__UNIX__)
|
||||||
|
|
||||||
// "\033<" Enter ANSI mode
|
// "\033<" Enter ANSI mode
|
||||||
// "\033[?5l" Normal screen
|
// "\033[?5l" Normal screen
|
||||||
// "\033[0m" Normal character attributes
|
// "\033[0m" Normal character attributes
|
||||||
|
|
||||||
gvid_printf("\033<\033[?5l\033[0m");
|
gvid_printf("\033<\033[?5l\033[0m");
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifndef __DJGPP__
|
#ifndef __DJGPP__
|
||||||
if(dmaptr != dmadir) throw_xfree(dmaptr);
|
if(dmaptr != dmadir) throw_xfree(dmaptr);
|
||||||
@ -390,12 +393,7 @@ int GVid::detectadapter() {
|
|||||||
|
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
|
|
||||||
gvid_hout = CreateFile("CONOUT$", GENERIC_READ | GENERIC_WRITE,
|
gvid_hout = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
FILE_SHARE_WRITE | FILE_SHARE_READ, NULL,
|
|
||||||
OPEN_EXISTING,
|
|
||||||
FILE_FLAG_NO_BUFFERING|FILE_FLAG_WRITE_THROUGH, NULL);
|
|
||||||
|
|
||||||
SetFileApisToOEM();
|
|
||||||
|
|
||||||
adapter = V_VGA;
|
adapter = V_VGA;
|
||||||
|
|
||||||
@ -1014,8 +1012,8 @@ void GVid::resize_screen(int columns, int rows) {
|
|||||||
numcols = curr.screen.columns = columns;
|
numcols = curr.screen.columns = columns;
|
||||||
numrows = curr.screen.rows = rows;
|
numrows = curr.screen.rows = rows;
|
||||||
|
|
||||||
bufchr = (vchar*)throw_xrealloc(bufchr, numcols);
|
bufchr = (vchar*)throw_xrealloc(bufchr, numcols+1);
|
||||||
bufwrd = (vatch*)throw_xrealloc(bufwrd, numcols*2);
|
bufwrd = (vatch*)throw_xrealloc(bufwrd, (numcols+1)*sizeof(vatch));
|
||||||
bufansi = (vchar*)throw_xrealloc(bufansi, 1+(11*numcols));
|
bufansi = (vchar*)throw_xrealloc(bufansi, 1+(11*numcols));
|
||||||
|
|
||||||
#if defined(__UNIX__) and not defined(__USE_NCURSES__)
|
#if defined(__UNIX__) and not defined(__USE_NCURSES__)
|
||||||
|
@ -214,7 +214,7 @@ struct _wrec_t {
|
|||||||
_wrec_t* prev; // pointer to previous window record
|
_wrec_t* prev; // pointer to previous window record
|
||||||
_wrec_t* next; // pointer to next window record
|
_wrec_t* next; // pointer to next window record
|
||||||
_form_t* form; // pointer to head form record
|
_form_t* form; // pointer to head form record
|
||||||
vatch* wbuf; // address of window's buffer
|
vsavebuf* wbuf; // address of window's buffer
|
||||||
vatch* wsbuf; // address of window shadow's buffer
|
vatch* wsbuf; // address of window shadow's buffer
|
||||||
const char* title; // address of window's title string
|
const char* title; // address of window's title string
|
||||||
int whandle; // window's handle
|
int whandle; // window's handle
|
||||||
@ -423,8 +423,6 @@ inline int wclear () { return wcclear(gwin.active->wattr); }
|
|||||||
inline void wfillch (vchar a) { gwin.fillch=a; }
|
inline void wfillch (vchar a) { gwin.fillch=a; }
|
||||||
inline vchar wgetc (int wrow, int wcol) { return vgetc(gwin.active->srow+wrow+gwin.active->border,gwin.active->scol+wcol+gwin.active->border); }
|
inline vchar wgetc (int wrow, int wcol) { return vgetc(gwin.active->srow+wrow+gwin.active->border,gwin.active->scol+wcol+gwin.active->border); }
|
||||||
inline int wisactiv (int a) { return a == gwin.active->whandle; }
|
inline int wisactiv (int a) { return a == gwin.active->whandle; }
|
||||||
inline void wrestore (vatch* wbuf) { vrestore(wbuf); }
|
|
||||||
inline vatch* wsave (int srow, int scol, int erow, int ecol) { return vsave(srow, scol, erow, ecol); }
|
|
||||||
inline int wsetesc (int a) { int t=gwin.esc; gwin.esc=a; return t; }
|
inline int wsetesc (int a) { int t=gwin.esc; gwin.esc=a; return t; }
|
||||||
inline void wsetstyle (int a) { gwin.style = a; }
|
inline void wsetstyle (int a) { gwin.style = a; }
|
||||||
inline int wstyle () { return gwin.style; }
|
inline int wstyle () { return gwin.style; }
|
||||||
|
@ -149,7 +149,7 @@ int wopen(int srow, int scol, int erow, int ecol, int btype, int battr, int watt
|
|||||||
}
|
}
|
||||||
|
|
||||||
// save affected area of screen
|
// save affected area of screen
|
||||||
vatch* wbuf = vsave(srow,scol,erow,ecol);
|
vsavebuf* wbuf = vsave(srow,scol,erow,ecol);
|
||||||
if(wbuf==NULL) {
|
if(wbuf==NULL) {
|
||||||
throw_xrelease(wrec);
|
throw_xrelease(wrec);
|
||||||
gwin.werrno=W_ALLOCERR;
|
gwin.werrno=W_ALLOCERR;
|
||||||
@ -1003,7 +1003,7 @@ _wrec_t* wfindrec(int whandle) {
|
|||||||
|
|
||||||
int whide() {
|
int whide() {
|
||||||
|
|
||||||
vatch* p;
|
vsavebuf* p;
|
||||||
int shattr;
|
int shattr;
|
||||||
_wrec_t *temp;
|
_wrec_t *temp;
|
||||||
|
|
||||||
@ -1060,7 +1060,7 @@ int whide() {
|
|||||||
|
|
||||||
int wunhide(int whandle) {
|
int wunhide(int whandle) {
|
||||||
|
|
||||||
vatch* p;
|
vsavebuf* p;
|
||||||
_wrec_t* found;
|
_wrec_t* found;
|
||||||
|
|
||||||
// check pointer to hidden window linked list ; must not be NULL
|
// check pointer to hidden window linked list ; must not be NULL
|
||||||
@ -1238,7 +1238,7 @@ static GOLD_INLINE int rshadow_blocking() {
|
|||||||
|
|
||||||
static GOLD_INLINE vatch* calc_window(_wrec_t *wrec) {
|
static GOLD_INLINE vatch* calc_window(_wrec_t *wrec) {
|
||||||
|
|
||||||
return wrec->wbuf+4+((__crow-wrec->srow)*(wrec->ecol-wrec->scol+1))+(__ccol-wrec->scol);
|
return wrec->wbuf->data+((__crow-wrec->srow)*(wrec->ecol-wrec->scol+1))+(__ccol-wrec->scol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1273,7 +1273,7 @@ static void swap_contents(vatch* pfound, vatch* pcurr, int shadow) {
|
|||||||
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) & 0x80) and shadow) ? vsattr(*pcurr, vgattr(*pcurr | 0x80)) : *pcurr;
|
chat = ((vgattr(temp) & BLINK) and shadow) ? vsattr(*pcurr, vgattr(*pcurr) | BLINK) : *pcurr;
|
||||||
vputw(__crow, __ccol, chat);
|
vputw(__crow, __ccol, chat);
|
||||||
|
|
||||||
// let window position directly above position
|
// let window position directly above position
|
||||||
@ -1559,7 +1559,8 @@ static void update_buffers(vatch* pcurr, int shadow) {
|
|||||||
|
|
||||||
if(shadow) {
|
if(shadow) {
|
||||||
if(__curr->next==NULL) {
|
if(__curr->next==NULL) {
|
||||||
vputc(__crow, __ccol, vgattr(*pcurr)&0x80 ? (__curr->wsattr|BLINK) : __curr->wsattr, (vchar)*pcurr);
|
// vputc(__crow, __ccol, vgattr(*pcurr) & BLINK ? (__curr->wsattr | BLINK) : __curr->wsattr, vgchar(*pcurr));
|
||||||
|
vputc(__crow, __ccol, __gattr & BLINK ? (__curr->wsattr | BLINK) : __curr->wsattr, *__p);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tcurr = __curr;
|
tcurr = __curr;
|
||||||
|
@ -215,7 +215,6 @@ public:
|
|||||||
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, int color, char chr, uint len);
|
||||||
void printws(int wrow, int wcol, vatch* buf, uint len);
|
|
||||||
void print_center(int row, int color, const char* text);
|
void print_center(int row, int color, const char* text);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -137,8 +137,8 @@ int wdrag(int direction) {
|
|||||||
int nsrow, nscol, nerow, necol, shad_attr=-1;
|
int nsrow, nscol, nerow, necol, shad_attr=-1;
|
||||||
int chars_per_line, lines_per_win;
|
int chars_per_line, lines_per_win;
|
||||||
int vert_movement, horz_movement;
|
int vert_movement, horz_movement;
|
||||||
vatch* win_image;
|
vsavebuf* win_image;
|
||||||
vatch* wp;
|
vsavebuf* wp;
|
||||||
vatch* p;
|
vatch* p;
|
||||||
register vatch* src;
|
register vatch* src;
|
||||||
register vatch* dest;
|
register vatch* dest;
|
||||||
@ -202,18 +202,13 @@ int wdrag(int direction) {
|
|||||||
return(gwin.werrno=W_ALLOCERR);
|
return(gwin.werrno=W_ALLOCERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// change coordinates in saved window's buffer
|
// restore window to new coordinates
|
||||||
// and restore window to new coordinates
|
vrestore(win_image, nsrow, nscol, nerow, necol);
|
||||||
win_image[0] = (vatch)nsrow;
|
|
||||||
win_image[1] = (vatch)nscol;
|
|
||||||
win_image[2] = (vatch)nerow;
|
|
||||||
win_image[3] = (vatch)necol;
|
|
||||||
vrestore(win_image);
|
|
||||||
throw_xfree(win_image);
|
throw_xfree(win_image);
|
||||||
|
|
||||||
// start buffer positions past coordinates
|
// start buffer positions past coordinates
|
||||||
src = gwin.active->wbuf + 4;
|
src = gwin.active->wbuf->data;
|
||||||
dest = wp + 4;
|
dest = wp->data;
|
||||||
|
|
||||||
if(direction==D_DOWN)
|
if(direction==D_DOWN)
|
||||||
src += chars_per_line;
|
src += chars_per_line;
|
||||||
@ -240,7 +235,7 @@ int wdrag(int direction) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// erase the trail that was left-over
|
// erase the trail that was left-over
|
||||||
p = gwin.active->wbuf + 4;
|
p = gwin.active->wbuf->data;
|
||||||
if(vert_movement) {
|
if(vert_movement) {
|
||||||
if(direction==D_DOWN)
|
if(direction==D_DOWN)
|
||||||
fill_row=srow;
|
fill_row=srow;
|
||||||
|
@ -298,11 +298,11 @@ void gareafile::ReadHPTFile(char* path, char* file, char* options, char* origin,
|
|||||||
aa.type = GMB_NET;
|
aa.type = GMB_NET;
|
||||||
break;
|
break;
|
||||||
case CRC_LOCALAREA:
|
case CRC_LOCALAREA:
|
||||||
|
case CRC_DUPEAREA:
|
||||||
|
case CRC_BADAREA:
|
||||||
aa.type = GMB_LOCAL;
|
aa.type = GMB_LOCAL;
|
||||||
break;
|
break;
|
||||||
case CRC_ECHOAREA:
|
case CRC_ECHOAREA:
|
||||||
case CRC_DUPEAREA:
|
|
||||||
case CRC_BADAREA:
|
|
||||||
aa.type = GMB_ECHO;
|
aa.type = GMB_ECHO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ extern char *alloca ();
|
|||||||
|
|
||||||
static
|
static
|
||||||
#if __GNUC__ - 0 >= 2
|
#if __GNUC__ - 0 >= 2
|
||||||
inline
|
__inline__
|
||||||
#endif
|
#endif
|
||||||
const char *next_brace_sub __P ((const char *begin));
|
const char *next_brace_sub __P ((const char *begin));
|
||||||
static int glob_in_dir __P ((const char *pattern, const char *directory,
|
static int glob_in_dir __P ((const char *pattern, const char *directory,
|
||||||
@ -304,7 +304,7 @@ static int collated_compare __P ((const __ptr_t, const __ptr_t));
|
|||||||
this as an inline function if the compiler permits. */
|
this as an inline function if the compiler permits. */
|
||||||
static
|
static
|
||||||
#if __GNUC__ - 0 >= 2
|
#if __GNUC__ - 0 >= 2
|
||||||
inline
|
__inline__
|
||||||
#endif
|
#endif
|
||||||
const char *
|
const char *
|
||||||
next_brace_sub (begin)
|
next_brace_sub (begin)
|
||||||
@ -386,7 +386,7 @@ glob (pattern, flags, errfunc, pglob)
|
|||||||
const char *rest;
|
const char *rest;
|
||||||
size_t rest_len;
|
size_t rest_len;
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
char onealt[strlen (pattern) - 1];
|
__extension__ char onealt[strlen (pattern) - 1];
|
||||||
#else
|
#else
|
||||||
char *onealt = (char *) malloc (strlen (pattern) - 1);
|
char *onealt = (char *) malloc (strlen (pattern) - 1);
|
||||||
if (onealt == NULL)
|
if (onealt == NULL)
|
||||||
|
@ -235,8 +235,8 @@ char *uuestr_otemp;
|
|||||||
static int
|
static int
|
||||||
UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile)
|
UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile)
|
||||||
{
|
{
|
||||||
unsigned char *itemp = (char *) uuestr_itemp;
|
unsigned char *itemp = (unsigned char *) uuestr_itemp;
|
||||||
unsigned char *otemp = (char *) uuestr_otemp;
|
unsigned char *otemp = (unsigned char *) uuestr_otemp;
|
||||||
unsigned char *optr, *table, *tptr;
|
unsigned char *optr, *table, *tptr;
|
||||||
int index, count;
|
int index, count;
|
||||||
long line=0;
|
long line=0;
|
||||||
|
Reference in New Issue
Block a user