mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
Improved keyboard handling code
Fixed problems with differnet console sizes Started function renaming svn path=/trunk/; revision=1034
This commit is contained in:
parent
1eed2a945a
commit
a12836346f
20 changed files with 301 additions and 240 deletions
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include "dflat.h"
|
#include "dflat.h"
|
||||||
|
|
||||||
static int ScreenHeight;
|
|
||||||
static BOOL DisplayModified = FALSE;
|
static BOOL DisplayModified = FALSE;
|
||||||
DFWINDOW ApplicationWindow;
|
DFWINDOW ApplicationWindow;
|
||||||
|
|
||||||
|
@ -50,9 +49,9 @@ static char Menus[9][26] =
|
||||||
/* --------------- CREATE_WINDOW Message -------------- */
|
/* --------------- CREATE_WINDOW Message -------------- */
|
||||||
static int CreateWindowMsg(DFWINDOW wnd)
|
static int CreateWindowMsg(DFWINDOW wnd)
|
||||||
{
|
{
|
||||||
int rtn;
|
int rtn;
|
||||||
|
|
||||||
ApplicationWindow = wnd;
|
ApplicationWindow = wnd;
|
||||||
ScreenHeight = SCREENHEIGHT;
|
|
||||||
#ifdef INCLUDE_WINDOWOPTIONS
|
#ifdef INCLUDE_WINDOWOPTIONS
|
||||||
if (cfg.Border)
|
if (cfg.Border)
|
||||||
SetCheckBox(&Display, ID_BORDER);
|
SetCheckBox(&Display, ID_BORDER);
|
||||||
|
@ -386,7 +385,8 @@ static void CreateStatusBar(DFWINDOW wnd)
|
||||||
/* -------- return the name of a document window ------- */
|
/* -------- return the name of a document window ------- */
|
||||||
static char *WindowName(DFWINDOW wnd)
|
static char *WindowName(DFWINDOW wnd)
|
||||||
{
|
{
|
||||||
if (GetTitle(wnd) == NULL) {
|
if (GetTitle(wnd) == NULL)
|
||||||
|
{
|
||||||
if (GetClass(wnd) == DIALOG)
|
if (GetClass(wnd) == DIALOG)
|
||||||
return ((DBOX *)(wnd->extension))->HelpName;
|
return ((DBOX *)(wnd->extension))->HelpName;
|
||||||
else
|
else
|
||||||
|
@ -518,7 +518,8 @@ static void MoreWindows(DFWINDOW wnd)
|
||||||
static void ChooseWindow(DFWINDOW wnd, int WindowNo)
|
static void ChooseWindow(DFWINDOW wnd, int WindowNo)
|
||||||
{
|
{
|
||||||
DFWINDOW cwnd = FirstWindow(wnd);
|
DFWINDOW cwnd = FirstWindow(wnd);
|
||||||
while (cwnd != NULL) {
|
while (cwnd != NULL)
|
||||||
|
{
|
||||||
if (GetClass(cwnd) != MENUBAR &&
|
if (GetClass(cwnd) != MENUBAR &&
|
||||||
GetClass(cwnd) != STATUSBAR)
|
GetClass(cwnd) != STATUSBAR)
|
||||||
if (WindowNo-- == 0)
|
if (WindowNo-- == 0)
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
/* ------------- calendar.c ------------- */
|
/* ------------- calendar.c ------------- */
|
||||||
#include "dflat.h"
|
#include "dflat.h"
|
||||||
|
|
||||||
#ifndef TURBOC
|
|
||||||
|
|
||||||
#define CALHEIGHT 17
|
#define CALHEIGHT 17
|
||||||
#define CALWIDTH 33
|
#define CALWIDTH 33
|
||||||
|
|
||||||
|
@ -13,9 +11,31 @@ static DFWINDOW Cwnd;
|
||||||
|
|
||||||
static void FixDate(void)
|
static void FixDate(void)
|
||||||
{
|
{
|
||||||
/* ---- adjust Feb for leap year ---- */
|
/* ---- adjust Feb for leap year ---- */
|
||||||
DyMo[1] = (ttm.tm_year % 4) ? 28 : 29;
|
if (ttm.tm_year % 4 == 0)
|
||||||
ttm.tm_mday = min(ttm.tm_mday, DyMo[ttm.tm_mon]);
|
{
|
||||||
|
if (ttm.tm_year % 100 == 0)
|
||||||
|
{
|
||||||
|
if (ttm.tm_year % 400 == 0)
|
||||||
|
{
|
||||||
|
DyMo[1] = 29;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DyMo[1] = 28;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DyMo[1] = 29;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DyMo[1] = 28;
|
||||||
|
}
|
||||||
|
|
||||||
|
ttm.tm_mday = min(ttm.tm_mday, DyMo[ttm.tm_mon]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---- build calendar dates array ---- */
|
/* ---- build calendar dates array ---- */
|
||||||
|
@ -162,4 +182,4 @@ void Calendar(DFWINDOW pwnd)
|
||||||
DfSendMessage(Cwnd, SETFOCUS, TRUE, 0);
|
DfSendMessage(Cwnd, SETFOCUS, TRUE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
/* EOF */
|
||||||
|
|
|
@ -18,16 +18,31 @@ static int altconvert[] = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int cursorpos[MAXSAVES];
|
static COORD cursorpos[MAXSAVES];
|
||||||
static int cursorshape[MAXSAVES];
|
static CONSOLE_CURSOR_INFO cursorinfo[MAXSAVES];
|
||||||
static int cs;
|
static int cs = 0;
|
||||||
|
|
||||||
|
|
||||||
void SwapCursorStack(void)
|
void SwapCursorStack(void)
|
||||||
{
|
{
|
||||||
if (cs > 1) {
|
if (cs > 1)
|
||||||
swap(cursorpos[cs-2], cursorpos[cs-1]);
|
{
|
||||||
swap(cursorshape[cs-2], cursorshape[cs-1]);
|
COORD coord;
|
||||||
|
CONSOLE_CURSOR_INFO csi;
|
||||||
|
|
||||||
|
coord = cursorpos[cs-2];
|
||||||
|
cursorpos[cs-2] = cursorpos[cs-1];
|
||||||
|
cursorpos[cs-1] = coord;
|
||||||
|
|
||||||
|
memcpy (&csi,
|
||||||
|
&cursorinfo[cs-2],
|
||||||
|
sizeof(CONSOLE_CURSOR_INFO));
|
||||||
|
memcpy (&cursorinfo[cs-2],
|
||||||
|
&cursorinfo[cs-1],
|
||||||
|
sizeof(CONSOLE_CURSOR_INFO));
|
||||||
|
memcpy (&cursorinfo[cs-1],
|
||||||
|
&csi,
|
||||||
|
sizeof(CONSOLE_CURSOR_INFO));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +68,7 @@ void GetKey (PINPUT_RECORD lpBuffer)
|
||||||
|
|
||||||
|
|
||||||
/* ---------- read the keyboard shift status --------- */
|
/* ---------- read the keyboard shift status --------- */
|
||||||
|
|
||||||
int getshift(void)
|
int getshift(void)
|
||||||
{
|
{
|
||||||
// regs.h.ah = 2;
|
// regs.h.ah = 2;
|
||||||
|
@ -82,20 +98,8 @@ void cursor(int x, int y)
|
||||||
SetConsoleCursorPosition (GetStdHandle (STD_OUTPUT_HANDLE), coPos);
|
SetConsoleCursorPosition (GetStdHandle (STD_OUTPUT_HANDLE), coPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------ get cursor shape and position ------ */
|
|
||||||
static void getcursor(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
videomode();
|
|
||||||
regs.h.ah = READCURSOR;
|
|
||||||
regs.x.bx = video_page;
|
|
||||||
int86(VIDEO, ®s, ®s);
|
|
||||||
*/
|
|
||||||
/* FIXME */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ------- get the current cursor position ------- */
|
/* ------- get the current cursor position ------- */
|
||||||
|
|
||||||
void curr_cursor(int *x, int *y)
|
void curr_cursor(int *x, int *y)
|
||||||
//VOID GetCursorXY (PSHORT x, PSHORT y)
|
//VOID GetCursorXY (PSHORT x, PSHORT y)
|
||||||
{
|
{
|
||||||
|
@ -111,70 +115,85 @@ void curr_cursor(int *x, int *y)
|
||||||
/* ------ save the current cursor configuration ------ */
|
/* ------ save the current cursor configuration ------ */
|
||||||
void savecursor(void)
|
void savecursor(void)
|
||||||
{
|
{
|
||||||
/*
|
if (cs < MAXSAVES)
|
||||||
if (cs < MAXSAVES) {
|
{
|
||||||
getcursor();
|
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||||
cursorshape[cs] = regs.x.cx;
|
|
||||||
cursorpos[cs] = regs.x.dx;
|
GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &csbi);
|
||||||
cs++;
|
cursorpos[cs].X = csbi.dwCursorPosition.X;
|
||||||
}
|
cursorpos[cs].Y = csbi.dwCursorPosition.Y;
|
||||||
*/
|
|
||||||
|
GetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE),
|
||||||
|
&(cursorinfo[cs]));
|
||||||
|
|
||||||
|
cs++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---- restore the saved cursor configuration ---- */
|
/* ---- restore the saved cursor configuration ---- */
|
||||||
void restorecursor(void)
|
void restorecursor(void)
|
||||||
{
|
{
|
||||||
/*
|
if (cs)
|
||||||
if (cs) {
|
{
|
||||||
--cs;
|
--cs;
|
||||||
videomode();
|
SetConsoleCursorPosition (GetStdHandle (STD_OUTPUT_HANDLE),
|
||||||
regs.x.dx = cursorpos[cs];
|
cursorpos[cs]);
|
||||||
regs.h.ah = SETCURSOR;
|
SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE),
|
||||||
regs.x.bx = video_page;
|
&(cursorinfo[cs]));
|
||||||
int86(VIDEO, ®s, ®s);
|
}
|
||||||
set_cursor_type(cursorshape[cs]);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------ make a normal cursor ------ */
|
/* ------ make a normal cursor ------ */
|
||||||
void normalcursor(void)
|
void normalcursor(void)
|
||||||
{
|
{
|
||||||
// set_cursor_type(0x0607);
|
CONSOLE_CURSOR_INFO csi;
|
||||||
|
|
||||||
|
csi.bVisible = TRUE;
|
||||||
|
csi.dwSize = 5;
|
||||||
|
SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE),
|
||||||
|
&csi);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------ hide the cursor ------ */
|
/* ------ hide the cursor ------ */
|
||||||
void hidecursor(void)
|
void hidecursor(void)
|
||||||
{
|
{
|
||||||
/*
|
CONSOLE_CURSOR_INFO csi;
|
||||||
getcursor();
|
|
||||||
regs.h.ch |= HIDECURSOR;
|
GetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE),
|
||||||
regs.h.ah = SETCURSORTYPE;
|
&csi);
|
||||||
int86(VIDEO, ®s, ®s);
|
csi.bVisible = FALSE;
|
||||||
*/
|
SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE),
|
||||||
|
&csi);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------ unhide the cursor ------ */
|
/* ------ unhide the cursor ------ */
|
||||||
void unhidecursor(void)
|
void unhidecursor(void)
|
||||||
{
|
{
|
||||||
/*
|
CONSOLE_CURSOR_INFO csi;
|
||||||
getcursor();
|
|
||||||
regs.h.ch &= ~HIDECURSOR;
|
GetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE),
|
||||||
regs.h.ah = SETCURSORTYPE;
|
&csi);
|
||||||
int86(VIDEO, ®s, ®s);
|
csi.bVisible = TRUE;
|
||||||
*/
|
SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE),
|
||||||
|
&csi);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---- use BIOS to set the cursor type ---- */
|
/* set the cursor size (in percent) */
|
||||||
void set_cursor_type(unsigned t)
|
void set_cursor_size (unsigned t)
|
||||||
{
|
{
|
||||||
/*
|
CONSOLE_CURSOR_INFO csi;
|
||||||
videomode();
|
|
||||||
regs.h.ah = SETCURSORTYPE;
|
GetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE),
|
||||||
regs.x.bx = video_page;
|
&csi);
|
||||||
regs.x.cx = t;
|
|
||||||
int86(VIDEO, ®s, ®s);
|
if (t < 2)
|
||||||
*/
|
csi.dwSize = 2;
|
||||||
|
else if (t > 90)
|
||||||
|
csi.dwSize = 90;
|
||||||
|
else
|
||||||
|
csi.dwSize = t;
|
||||||
|
SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE),
|
||||||
|
&csi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -272,7 +272,7 @@ extern BOOL ClipString;
|
||||||
#define SCROLLBARCHAR (unsigned char) 176
|
#define SCROLLBARCHAR (unsigned char) 176
|
||||||
#define SCROLLBOXCHAR (unsigned char) 178
|
#define SCROLLBOXCHAR (unsigned char) 178
|
||||||
/* ------------------ menu characters --------------------- */
|
/* ------------------ menu characters --------------------- */
|
||||||
#define CHECKMARK (unsigned char) (SCREENHEIGHT==25?251:4)
|
#define CHECKMARK (unsigned char) '\x04' //(SCREENHEIGHT==25?251:4)
|
||||||
#define CASCADEPOINTER (unsigned char) '\x10'
|
#define CASCADEPOINTER (unsigned char) '\x10'
|
||||||
/* ----------------- title bar characters ----------------- */
|
/* ----------------- title bar characters ----------------- */
|
||||||
#define CONTROLBOXCHAR (unsigned char) '\xf0'
|
#define CONTROLBOXCHAR (unsigned char) '\xf0'
|
||||||
|
@ -285,12 +285,16 @@ extern BOOL ClipString;
|
||||||
#define CHANGECOLOR (unsigned char) 174 /* prefix to change colors */
|
#define CHANGECOLOR (unsigned char) 174 /* prefix to change colors */
|
||||||
#define RESETCOLOR (unsigned char) 175 /* reset colors to default */
|
#define RESETCOLOR (unsigned char) 175 /* reset colors to default */
|
||||||
#define LISTSELECTOR 4 /* selected list box entry */
|
#define LISTSELECTOR 4 /* selected list box entry */
|
||||||
|
|
||||||
/* --------- message prototypes ----------- */
|
/* --------- message prototypes ----------- */
|
||||||
BOOL init_messages(void);
|
BOOL DfInitialize (void);
|
||||||
|
void DfTerminate (void);
|
||||||
void DfPostMessage (DFWINDOW, DFMESSAGE, PARAM, PARAM);
|
void DfPostMessage (DFWINDOW, DFMESSAGE, PARAM, PARAM);
|
||||||
int DfSendMessage (DFWINDOW, DFMESSAGE, PARAM, PARAM);
|
int DfSendMessage (DFWINDOW, DFMESSAGE, PARAM, PARAM);
|
||||||
BOOL DfDispatchMessage (void);
|
BOOL DfDispatchMessage (void);
|
||||||
void handshake(void);
|
void handshake(void);
|
||||||
|
SHORT DfGetScreenHeight (void);
|
||||||
|
SHORT DfGetScreenWidth (void);
|
||||||
|
|
||||||
/* ---- standard window message processing prototypes ----- */
|
/* ---- standard window message processing prototypes ----- */
|
||||||
int ApplicationProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
|
int ApplicationProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
|
||||||
|
@ -317,6 +321,7 @@ int ErrorBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
|
||||||
int YesNoBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
|
int YesNoBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
|
||||||
int StatusBarProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
|
int StatusBarProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
|
||||||
int WatchIconProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
|
int WatchIconProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
|
||||||
|
|
||||||
/* ------------- normal box prototypes ------------- */
|
/* ------------- normal box prototypes ------------- */
|
||||||
void SetStandardColor(DFWINDOW);
|
void SetStandardColor(DFWINDOW);
|
||||||
void SetReverseColor(DFWINDOW);
|
void SetReverseColor(DFWINDOW);
|
||||||
|
|
|
@ -36,8 +36,10 @@ int main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
DFWINDOW wnd;
|
DFWINDOW wnd;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
if (!init_messages())
|
|
||||||
|
if (DfInitialize () == FALSE)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
Argv = argv;
|
Argv = argv;
|
||||||
LoadConfig ();
|
LoadConfig ();
|
||||||
// if (!LoadConfig())
|
// if (!LoadConfig())
|
||||||
|
@ -75,6 +77,8 @@ int main (int argc, char *argv[])
|
||||||
while (DfDispatchMessage ())
|
while (DfDispatchMessage ())
|
||||||
;
|
;
|
||||||
|
|
||||||
|
DfTerminate ();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ char *ClassNames[] = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAXHEIGHT (SCREENHEIGHT-10)
|
#define MAXHEIGHT (DfGetScreenHeight()-10)
|
||||||
|
|
||||||
/* --------- linked list of help text collections -------- */
|
/* --------- linked list of help text collections -------- */
|
||||||
struct helps {
|
struct helps {
|
||||||
|
@ -691,18 +691,18 @@ static void BestFit(DFWINDOW wnd, DIALOGWINDOW *dwnd)
|
||||||
/* --- compute above overlap ---- */
|
/* --- compute above overlap ---- */
|
||||||
above = OverLap(dwnd->h, GetTop(wnd));
|
above = OverLap(dwnd->h, GetTop(wnd));
|
||||||
/* --- compute below overlap ---- */
|
/* --- compute below overlap ---- */
|
||||||
below = OverLap(GetBottom(wnd), SCREENHEIGHT-dwnd->h);
|
below = OverLap(GetBottom(wnd), DfGetScreenHeight()-dwnd->h);
|
||||||
/* --- compute right overlap ---- */
|
/* --- compute right overlap ---- */
|
||||||
right = OverLap(GetRight(wnd), SCREENWIDTH-dwnd->w);
|
right = OverLap(GetRight(wnd), DfGetScreenWidth()-dwnd->w);
|
||||||
/* --- compute left overlap ---- */
|
/* --- compute left overlap ---- */
|
||||||
left = OverLap(dwnd->w, GetLeft(wnd));
|
left = OverLap(dwnd->w, GetLeft(wnd));
|
||||||
|
|
||||||
if (above < below)
|
if (above < below)
|
||||||
dwnd->y = max(0, GetTop(wnd)-dwnd->h-2);
|
dwnd->y = max(0, GetTop(wnd)-dwnd->h-2);
|
||||||
else
|
else
|
||||||
dwnd->y = min(SCREENHEIGHT-dwnd->h, GetBottom(wnd)+2);
|
dwnd->y = min(DfGetScreenHeight()-dwnd->h, GetBottom(wnd)+2);
|
||||||
if (right < left)
|
if (right < left)
|
||||||
dwnd->x = min(GetRight(wnd)+2, SCREENWIDTH-dwnd->w);
|
dwnd->x = min(GetRight(wnd)+2, DfGetScreenWidth()-dwnd->w);
|
||||||
else
|
else
|
||||||
dwnd->x = max(0, GetLeft(wnd)-dwnd->w-2);
|
dwnd->x = max(0, GetLeft(wnd)-dwnd->w-2);
|
||||||
|
|
||||||
|
|
|
@ -82,19 +82,22 @@ void ReFocus(DFWINDOW wnd)
|
||||||
/* ---- remove a window from the linked list ---- */
|
/* ---- remove a window from the linked list ---- */
|
||||||
void RemoveWindow(DFWINDOW wnd)
|
void RemoveWindow(DFWINDOW wnd)
|
||||||
{
|
{
|
||||||
if (wnd != NULL) {
|
if (wnd != NULL)
|
||||||
|
{
|
||||||
DFWINDOW pwnd = GetParent(wnd);
|
DFWINDOW pwnd = GetParent(wnd);
|
||||||
if (PrevWindow(wnd) != NULL)
|
|
||||||
NextWindow(PrevWindow(wnd)) = NextWindow(wnd);
|
if (PrevWindow(wnd) != NULL)
|
||||||
if (NextWindow(wnd) != NULL)
|
NextWindow(PrevWindow(wnd)) = NextWindow(wnd);
|
||||||
PrevWindow(NextWindow(wnd)) = PrevWindow(wnd);
|
if (NextWindow(wnd) != NULL)
|
||||||
if (pwnd != NULL) {
|
PrevWindow(NextWindow(wnd)) = PrevWindow(wnd);
|
||||||
if (wnd == FirstWindow(pwnd))
|
if (pwnd != NULL)
|
||||||
FirstWindow(pwnd) = NextWindow(wnd);
|
{
|
||||||
if (wnd == LastWindow(pwnd))
|
if (wnd == FirstWindow(pwnd))
|
||||||
LastWindow(pwnd) = PrevWindow(wnd);
|
FirstWindow(pwnd) = NextWindow(wnd);
|
||||||
|
if (wnd == LastWindow(pwnd))
|
||||||
|
LastWindow(pwnd) = PrevWindow(wnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---- append a window to the linked list ---- */
|
/* ---- append a window to the linked list ---- */
|
||||||
|
@ -105,14 +108,6 @@ void AppendWindow(DFWINDOW wnd)
|
||||||
DFWINDOW pwnd = GetParent(wnd);
|
DFWINDOW pwnd = GetParent(wnd);
|
||||||
if (pwnd != NULL)
|
if (pwnd != NULL)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (FirstWindow(pwnd) == NULL)
|
|
||||||
FirstWindow(pwnd) = wnd;
|
|
||||||
if (LastWindow(pwnd) != NULL)
|
|
||||||
NextWindow(LastWindow(pwnd)) = wnd;
|
|
||||||
PrevWindow(wnd) = LastWindow(pwnd);
|
|
||||||
LastWindow(pwnd) = wnd;
|
|
||||||
*/
|
|
||||||
if (FirstWindow(pwnd) == NULL)
|
if (FirstWindow(pwnd) == NULL)
|
||||||
{
|
{
|
||||||
FirstWindow(pwnd) = wnd;
|
FirstWindow(pwnd) = wnd;
|
||||||
|
@ -130,8 +125,10 @@ void AppendWindow(DFWINDOW wnd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----- if document windows and statusbar or menubar get the focus,
|
/*
|
||||||
pass it on ------- */
|
* if document windows and statusbar or menubar get the focus,
|
||||||
|
* pass it on
|
||||||
|
*/
|
||||||
void SkipApplicationControls(void)
|
void SkipApplicationControls(void)
|
||||||
{
|
{
|
||||||
BOOL EmptyAppl = FALSE;
|
BOOL EmptyAppl = FALSE;
|
||||||
|
|
|
@ -49,7 +49,7 @@ else
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
WITH_DEBUGGING=yes
|
#WITH_DEBUGGING=yes
|
||||||
|
|
||||||
include ../rules.mak
|
include ../rules.mak
|
||||||
|
|
||||||
|
|
|
@ -405,22 +405,26 @@ int MenuBarProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2)
|
||||||
/* ------------- reset the MENUBAR -------------- */
|
/* ------------- reset the MENUBAR -------------- */
|
||||||
static void reset_menubar(DFWINDOW wnd)
|
static void reset_menubar(DFWINDOW wnd)
|
||||||
{
|
{
|
||||||
GetText(wnd) = DFrealloc(GetText(wnd), SCREENWIDTH+5);
|
GetText(wnd) = DFrealloc(GetText(wnd), DfGetScreenWidth()+5);
|
||||||
memset(GetText(wnd), ' ', SCREENWIDTH);
|
memset(GetText(wnd), ' ', DfGetScreenWidth());
|
||||||
*(GetText(wnd)+WindowWidth(wnd)) = '\0';
|
*(GetText(wnd)+WindowWidth(wnd)) = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
static DFWINDOW GetDocFocus(void)
|
static DFWINDOW GetDocFocus(void)
|
||||||
{
|
{
|
||||||
DFWINDOW wnd = ApplicationWindow;
|
DFWINDOW wnd = ApplicationWindow;
|
||||||
if (wnd != NULL) {
|
if (wnd != NULL)
|
||||||
|
{
|
||||||
wnd = LastWindow(wnd);
|
wnd = LastWindow(wnd);
|
||||||
while (wnd != NULL && (GetClass(wnd) == MENUBAR ||
|
while (wnd != NULL &&
|
||||||
GetClass(wnd) == STATUSBAR))
|
(GetClass(wnd) == MENUBAR ||
|
||||||
|
GetClass(wnd) == STATUSBAR))
|
||||||
wnd = PrevWindow(wnd);
|
wnd = PrevWindow(wnd);
|
||||||
if (wnd != NULL)
|
if (wnd != NULL)
|
||||||
|
{
|
||||||
while (wnd->childfocus != NULL)
|
while (wnd->childfocus != NULL)
|
||||||
wnd = wnd->childfocus;
|
wnd = wnd->childfocus;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return wnd ? wnd : ApplicationWindow;
|
return wnd ? wnd : ApplicationWindow;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* --------- message.c ---------- */
|
/* --------- message.c ---------- */
|
||||||
|
|
||||||
#include "dflat.h"
|
#include "dflat.h"
|
||||||
|
#include "system.h"
|
||||||
|
|
||||||
static int handshaking = 0;
|
static int handshaking = 0;
|
||||||
|
|
||||||
|
@ -56,9 +57,21 @@ static void StopMsg(void)
|
||||||
unhidecursor();
|
unhidecursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------ initialize the message system --------- */
|
SHORT DfGetScreenHeight (void)
|
||||||
BOOL init_messages (VOID)
|
|
||||||
{
|
{
|
||||||
|
return sScreenHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
SHORT DfGetScreenWidth (void)
|
||||||
|
{
|
||||||
|
return sScreenWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------ initialize the message system --------- */
|
||||||
|
BOOL DfInitialize (VOID)
|
||||||
|
{
|
||||||
|
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||||
|
|
||||||
AllocTesting = TRUE;
|
AllocTesting = TRUE;
|
||||||
if (setjmp(AllocError) != 0)
|
if (setjmp(AllocError) != 0)
|
||||||
{
|
{
|
||||||
|
@ -66,9 +79,17 @@ BOOL init_messages (VOID)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* get input and output handles */
|
||||||
|
hInput = GetStdHandle (STD_INPUT_HANDLE);
|
||||||
|
hOutput = GetStdHandle (STD_OUTPUT_HANDLE);
|
||||||
|
|
||||||
|
/* get screen size */
|
||||||
|
GetConsoleScreenBufferInfo (hOutput, &csbi);
|
||||||
|
sScreenHeight = (csbi.srWindow.Bottom - csbi.srWindow.Top) + 1;
|
||||||
|
sScreenWidth = (csbi.srWindow.Right - csbi.srWindow.Left) + 1;
|
||||||
|
|
||||||
/* enable mouse events */
|
/* enable mouse events */
|
||||||
SetConsoleMode (GetStdHandle (STD_INPUT_HANDLE),
|
SetConsoleMode (hInput, ENABLE_MOUSE_INPUT);
|
||||||
ENABLE_MOUSE_INPUT);
|
|
||||||
|
|
||||||
savecursor();
|
savecursor();
|
||||||
hidecursor();
|
hidecursor();
|
||||||
|
@ -88,6 +109,12 @@ BOOL init_messages (VOID)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DfTerminate (void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* ----- post an event and parameters to event queue ---- */
|
/* ----- post an event and parameters to event queue ---- */
|
||||||
static void PostEvent(DFMESSAGE event, int p1, int p2)
|
static void PostEvent(DFMESSAGE event, int p1, int p2)
|
||||||
{
|
{
|
||||||
|
@ -163,19 +190,23 @@ static void collect_events(void)
|
||||||
{
|
{
|
||||||
sk |= CTRLKEY;
|
sk |= CTRLKEY;
|
||||||
}
|
}
|
||||||
|
if (ir.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED)
|
||||||
|
{
|
||||||
|
sk |= LEFTSHIFT + RIGHTSHIFT;
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (sk != OldShiftKeys)
|
if (sk != OldShiftKeys)
|
||||||
{
|
{
|
||||||
OldShiftKeys = sk;
|
OldShiftKeys = sk;
|
||||||
/* the shift status changed */
|
/* the shift status changed */
|
||||||
PostEvent(SHIFT_CHANGED, sk, 0);
|
PostEvent(SHIFT_CHANGED, sk, 0);
|
||||||
|
#if 0
|
||||||
if (sk & ALTKEY)
|
if (sk & ALTKEY)
|
||||||
AltDown = TRUE;
|
AltDown = TRUE;
|
||||||
else
|
else
|
||||||
AltDown = FALSE;
|
AltDown = FALSE;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (ir.Event.KeyEvent.uChar.AsciiChar == 0)
|
if (ir.Event.KeyEvent.uChar.AsciiChar == 0)
|
||||||
{
|
{
|
||||||
|
@ -213,6 +244,14 @@ static void collect_events(void)
|
||||||
c = FWD;
|
c = FWD;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VK_INSERT:
|
||||||
|
c = INS;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VK_DELETE:
|
||||||
|
c = DEL;
|
||||||
|
break;
|
||||||
|
|
||||||
case VK_HOME:
|
case VK_HOME:
|
||||||
c = HOME;
|
c = HOME;
|
||||||
break;
|
break;
|
||||||
|
@ -234,7 +273,14 @@ static void collect_events(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
c = ir.Event.KeyEvent.uChar.AsciiChar;
|
{
|
||||||
|
/* special handling of SHIFT+TAB */
|
||||||
|
if (ir.Event.KeyEvent.uChar.AsciiChar == VK_TAB &&
|
||||||
|
(ir.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED))
|
||||||
|
c = SHIFT_HT;
|
||||||
|
else
|
||||||
|
c = ir.Event.KeyEvent.uChar.AsciiChar;
|
||||||
|
}
|
||||||
|
|
||||||
PostEvent (KEYBOARD, c, sk);
|
PostEvent (KEYBOARD, c, sk);
|
||||||
}
|
}
|
||||||
|
@ -282,66 +328,9 @@ static void collect_events(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* --------- keyboard events ---------- */
|
|
||||||
if ((sk = getshift()) != ShiftKeys)
|
|
||||||
{
|
|
||||||
ShiftKeys = sk;
|
|
||||||
/* ---- the shift status changed ---- */
|
|
||||||
PostEvent(SHIFT_CHANGED, sk, 0);
|
|
||||||
if (sk & ALTKEY)
|
|
||||||
AltDown = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---- build keyboard events for key combinations that
|
|
||||||
BIOS doesn't report --------- */
|
|
||||||
if (sk & ALTKEY) {
|
|
||||||
if (keyportvalue == 14) {
|
|
||||||
AltDown = FALSE;
|
|
||||||
PostEvent(KEYBOARD, ALT_BS, sk);
|
|
||||||
}
|
|
||||||
if (keyportvalue == 83) {
|
|
||||||
AltDown = FALSE;
|
|
||||||
PostEvent(KEYBOARD, ALT_DEL, sk);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sk & CTRLKEY)
|
|
||||||
{
|
|
||||||
AltDown = FALSE;
|
|
||||||
if (keyportvalue == 82) {
|
|
||||||
PostEvent(KEYBOARD, CTRL_INS, sk);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* ----------- test for keystroke ------- */
|
|
||||||
if (keyhit()) {
|
|
||||||
static int cvt[] = {SHIFT_INS,END,DN,PGDN,BS,'5',
|
|
||||||
FWD,HOME,UP,PGUP};
|
|
||||||
INPUT_RECORD ir;
|
|
||||||
int c;
|
|
||||||
|
|
||||||
GetKey(&ir);
|
|
||||||
c = ir.Event.KeyEvent.uChar.AsciiChar;
|
|
||||||
|
|
||||||
AltDown = FALSE;
|
|
||||||
/* -------- convert numeric pad keys ------- */
|
|
||||||
if (sk & (LEFTSHIFT | RIGHTSHIFT))
|
|
||||||
{
|
|
||||||
if (c >= '0' && c <= '9')
|
|
||||||
c = cvt[c-'0'];
|
|
||||||
else if (c == '.' || c == DEL)
|
|
||||||
c = SHIFT_DEL;
|
|
||||||
else if (c == INS)
|
|
||||||
c = SHIFT_INS;
|
|
||||||
}
|
|
||||||
/* ------ post the keyboard event ------ */
|
|
||||||
PostEvent(KEYBOARD, c, sk);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----- post a message and parameters to msg queue ---- */
|
/* ----- post a message and parameters to msg queue ---- */
|
||||||
void DfPostMessage(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2)
|
void DfPostMessage(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2)
|
||||||
{
|
{
|
||||||
|
@ -476,9 +465,9 @@ int DfSendMessage(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2)
|
||||||
break;
|
break;
|
||||||
case SHOW_CURSOR:
|
case SHOW_CURSOR:
|
||||||
if (p1)
|
if (p1)
|
||||||
set_cursor_type(0x0106);
|
set_cursor_size(100);
|
||||||
else
|
else
|
||||||
set_cursor_type(0x0607);
|
set_cursor_size(5);
|
||||||
unhidecursor();
|
unhidecursor();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -188,23 +188,29 @@ DFWINDOW MomentaryMessage(char *msg)
|
||||||
|
|
||||||
int MsgHeight(char *msg)
|
int MsgHeight(char *msg)
|
||||||
{
|
{
|
||||||
int h = 1;
|
int h = 1;
|
||||||
while ((msg = strchr(msg, '\n')) != NULL) {
|
|
||||||
h++;
|
while ((msg = strchr(msg, '\n')) != NULL)
|
||||||
msg++;
|
{
|
||||||
}
|
h++;
|
||||||
return min(h, SCREENHEIGHT-10);
|
msg++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return min(h, DfGetScreenHeight ()-10);
|
||||||
}
|
}
|
||||||
|
|
||||||
int MsgWidth(char *msg)
|
int MsgWidth(char *msg)
|
||||||
{
|
{
|
||||||
int w = 0;
|
int w = 0;
|
||||||
char *cp = msg;
|
char *cp = msg;
|
||||||
while ((cp = strchr(msg, '\n')) != NULL) {
|
|
||||||
w = max(w, (int) (cp-msg));
|
while ((cp = strchr(msg, '\n')) != NULL)
|
||||||
msg = cp+1;
|
{
|
||||||
}
|
w = max(w, (int) (cp-msg));
|
||||||
return min(max((int)strlen(msg), (int)w), SCREENWIDTH-10);
|
msg = cp+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return min(max((int)strlen(msg), (int)w), DfGetScreenWidth()-10);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
|
@ -99,11 +99,11 @@ static BOOL KeyboardMsg(DFWINDOW wnd, PARAM p1, PARAM p2)
|
||||||
--y;
|
--y;
|
||||||
break;
|
break;
|
||||||
case DN:
|
case DN:
|
||||||
if (y < SCREENHEIGHT-1)
|
if (y < DfGetScreenHeight()-1)
|
||||||
y++;
|
y++;
|
||||||
break;
|
break;
|
||||||
case FWD:
|
case FWD:
|
||||||
if (x < SCREENWIDTH-1)
|
if (x < DfGetScreenWidth()-1)
|
||||||
x++;
|
x++;
|
||||||
break;
|
break;
|
||||||
case BS:
|
case BS:
|
||||||
|
@ -389,8 +389,8 @@ static BOOL MouseMovedMsg(DFWINDOW wnd, PARAM p1, PARAM p2)
|
||||||
{
|
{
|
||||||
if (WindowMoving) {
|
if (WindowMoving) {
|
||||||
int leftmost = 0, topmost = 0,
|
int leftmost = 0, topmost = 0,
|
||||||
bottommost = SCREENHEIGHT-2,
|
bottommost = DfGetScreenHeight()-2,
|
||||||
rightmost = SCREENWIDTH-2;
|
rightmost = DfGetScreenWidth()-2;
|
||||||
int x = (int) p1 - diff;
|
int x = (int) p1 - diff;
|
||||||
int y = (int) p2;
|
int y = (int) p2;
|
||||||
if (GetParent(wnd) != NULL &&
|
if (GetParent(wnd) != NULL &&
|
||||||
|
@ -430,8 +430,8 @@ static void MaximizeMsg(DFWINDOW wnd)
|
||||||
DFRECT rc = {0, 0, 0, 0};
|
DFRECT rc = {0, 0, 0, 0};
|
||||||
DFRECT holdrc;
|
DFRECT holdrc;
|
||||||
holdrc = wnd->RestoredRC;
|
holdrc = wnd->RestoredRC;
|
||||||
rc.rt = SCREENWIDTH-1;
|
rc.rt = DfGetScreenWidth()-1;
|
||||||
rc.bt = SCREENHEIGHT-1;
|
rc.bt = DfGetScreenHeight()-1;
|
||||||
if (GetParent(wnd))
|
if (GetParent(wnd))
|
||||||
rc = ClientRect(GetParent(wnd));
|
rc = ClientRect(GetParent(wnd));
|
||||||
wnd->oldcondition = wnd->condition;
|
wnd->oldcondition = wnd->condition;
|
||||||
|
@ -721,10 +721,10 @@ static DFRECT PositionIcon(DFWINDOW wnd)
|
||||||
{
|
{
|
||||||
DFWINDOW pwnd = GetParent(wnd);
|
DFWINDOW pwnd = GetParent(wnd);
|
||||||
DFRECT rc;
|
DFRECT rc;
|
||||||
RectLeft(rc) = SCREENWIDTH-ICONWIDTH;
|
RectLeft(rc) = DfGetScreenWidth()-ICONWIDTH;
|
||||||
RectTop(rc) = SCREENHEIGHT-ICONHEIGHT;
|
RectTop(rc) = DfGetScreenHeight()-ICONHEIGHT;
|
||||||
RectRight(rc) = SCREENWIDTH-1;
|
RectRight(rc) = DfGetScreenWidth()-1;
|
||||||
RectBottom(rc) = SCREENHEIGHT-1;
|
RectBottom(rc) = DfGetScreenHeight()-1;
|
||||||
if (pwnd != NULL) {
|
if (pwnd != NULL) {
|
||||||
DFRECT prc = WindowRect(pwnd);
|
DFRECT prc = WindowRect(pwnd);
|
||||||
DFWINDOW cwnd = FirstWindow(pwnd);
|
DFWINDOW cwnd = FirstWindow(pwnd);
|
||||||
|
@ -789,8 +789,8 @@ static void sizeborder(DFWINDOW wnd, int rt, int bt)
|
||||||
{
|
{
|
||||||
int leftmost = GetLeft(wnd)+10;
|
int leftmost = GetLeft(wnd)+10;
|
||||||
int topmost = GetTop(wnd)+3;
|
int topmost = GetTop(wnd)+3;
|
||||||
int bottommost = SCREENHEIGHT-1;
|
int bottommost = DfGetScreenHeight()-1;
|
||||||
int rightmost = SCREENWIDTH-1;
|
int rightmost = DfGetScreenWidth()-1;
|
||||||
if (GetParent(wnd)) {
|
if (GetParent(wnd)) {
|
||||||
bottommost = min(bottommost,
|
bottommost = min(bottommost,
|
||||||
GetClientBottom(GetParent(wnd)));
|
GetClientBottom(GetParent(wnd)));
|
||||||
|
@ -824,9 +824,9 @@ static DFRECT adjShadow(DFWINDOW wnd)
|
||||||
DFRECT rc;
|
DFRECT rc;
|
||||||
rc = wnd->rc;
|
rc = wnd->rc;
|
||||||
if (TestAttribute(wnd, SHADOW)) {
|
if (TestAttribute(wnd, SHADOW)) {
|
||||||
if (RectRight(rc) < SCREENWIDTH-1)
|
if (RectRight(rc) < DfGetScreenWidth()-1)
|
||||||
RectRight(rc)++;
|
RectRight(rc)++;
|
||||||
if (RectBottom(rc) < SCREENHEIGHT-1)
|
if (RectBottom(rc) < DfGetScreenHeight()-1)
|
||||||
RectBottom(rc)++;
|
RectBottom(rc)++;
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
|
|
|
@ -8,31 +8,38 @@ static int py = -1;
|
||||||
/* ------------ CREATE_WINDOW Message ------------- */
|
/* ------------ CREATE_WINDOW Message ------------- */
|
||||||
static int CreateWindowMsg(DFWINDOW wnd)
|
static int CreateWindowMsg(DFWINDOW wnd)
|
||||||
{
|
{
|
||||||
int rtn, adj;
|
int rtn, adj;
|
||||||
ClearAttribute(wnd, HASTITLEBAR |
|
|
||||||
VSCROLLBAR |
|
ClearAttribute (wnd,
|
||||||
MOVEABLE |
|
HASTITLEBAR |
|
||||||
SIZEABLE |
|
VSCROLLBAR |
|
||||||
HSCROLLBAR);
|
MOVEABLE |
|
||||||
|
SIZEABLE |
|
||||||
|
HSCROLLBAR);
|
||||||
|
|
||||||
/* ------ adjust to keep popdown on screen ----- */
|
/* ------ adjust to keep popdown on screen ----- */
|
||||||
adj = SCREENHEIGHT-1-wnd->rc.bt;
|
adj = DfGetScreenHeight()-1-wnd->rc.bt;
|
||||||
if (adj < 0) {
|
if (adj < 0)
|
||||||
|
{
|
||||||
wnd->rc.tp += adj;
|
wnd->rc.tp += adj;
|
||||||
wnd->rc.bt += adj;
|
wnd->rc.bt += adj;
|
||||||
}
|
}
|
||||||
adj = SCREENWIDTH-1-wnd->rc.rt;
|
adj = DfGetScreenWidth()-1-wnd->rc.rt;
|
||||||
if (adj < 0) {
|
if (adj < 0)
|
||||||
|
{
|
||||||
wnd->rc.lf += adj;
|
wnd->rc.lf += adj;
|
||||||
wnd->rc.rt += adj;
|
wnd->rc.rt += adj;
|
||||||
}
|
}
|
||||||
rtn = BaseWndProc(POPDOWNMENU, wnd, CREATE_WINDOW, 0, 0);
|
|
||||||
DfSendMessage(wnd, CAPTURE_MOUSE, 0, 0);
|
rtn = BaseWndProc(POPDOWNMENU, wnd, CREATE_WINDOW, 0, 0);
|
||||||
DfSendMessage(wnd, CAPTURE_KEYBOARD, 0, 0);
|
DfSendMessage(wnd, CAPTURE_MOUSE, 0, 0);
|
||||||
DfSendMessage(NULL, SAVE_CURSOR, 0, 0);
|
DfSendMessage(wnd, CAPTURE_KEYBOARD, 0, 0);
|
||||||
DfSendMessage(NULL, HIDE_CURSOR, 0, 0);
|
DfSendMessage(NULL, SAVE_CURSOR, 0, 0);
|
||||||
|
DfSendMessage(NULL, HIDE_CURSOR, 0, 0);
|
||||||
wnd->oldFocus = inFocus;
|
wnd->oldFocus = inFocus;
|
||||||
inFocus = wnd;
|
inFocus = wnd;
|
||||||
return rtn;
|
|
||||||
|
return rtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------- LEFT_BUTTON Message --------- */
|
/* --------- LEFT_BUTTON Message --------- */
|
||||||
|
|
|
@ -18,7 +18,7 @@ Things that have to be fixed (incomplete list):
|
||||||
collisions (e.g. CreateWindow() --> DfCreateWindow())
|
collisions (e.g. CreateWindow() --> DfCreateWindow())
|
||||||
- fix short dos filename buffers
|
- fix short dos filename buffers
|
||||||
- add code to register external window classes
|
- add code to register external window classes
|
||||||
- implement recognition of current console screen size
|
- implement recognition of current console screen size (done)
|
||||||
- fix remaining bugs
|
- fix remaining bugs
|
||||||
- update documentation
|
- update documentation
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,8 @@ DFRECT ClientRect(void *wnd)
|
||||||
{
|
{
|
||||||
RectLeft(rc) = 1; // GetClientLeft((DFWINDOW)wnd);
|
RectLeft(rc) = 1; // GetClientLeft((DFWINDOW)wnd);
|
||||||
RectTop(rc) = 2; // GetClientTop((DFWINDOW)wnd);
|
RectTop(rc) = 2; // GetClientTop((DFWINDOW)wnd);
|
||||||
RectRight(rc) = SCREENWIDTH - 2; // GetClientRight((DFWINDOW)wnd);
|
RectRight(rc) = DfGetScreenWidth () - 2; // GetClientRight((DFWINDOW)wnd);
|
||||||
RectBottom(rc) = SCREENHEIGHT - 2; // GetClientBottom((DFWINDOW)wnd);
|
RectBottom(rc) = DfGetScreenHeight () - 2; // GetClientBottom((DFWINDOW)wnd);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,8 +95,8 @@ DFRECT ClipRectangle(void *wnd, DFRECT rc)
|
||||||
{
|
{
|
||||||
DFRECT sr;
|
DFRECT sr;
|
||||||
RectLeft(sr) = RectTop(sr) = 0;
|
RectLeft(sr) = RectTop(sr) = 0;
|
||||||
RectRight(sr) = SCREENWIDTH-1;
|
RectRight(sr) = DfGetScreenWidth()-1;
|
||||||
RectBottom(sr) = SCREENHEIGHT-1;
|
RectBottom(sr) = DfGetScreenHeight()-1;
|
||||||
if (!TestAttribute((DFWINDOW)wnd, NOCLIP))
|
if (!TestAttribute((DFWINDOW)wnd, NOCLIP))
|
||||||
while ((wnd = GetParent((DFWINDOW)wnd)) != NULL)
|
while ((wnd = GetParent((DFWINDOW)wnd)) != NULL)
|
||||||
rc = subRectangle(rc, ClientRect(wnd));
|
rc = subRectangle(rc, ClientRect(wnd));
|
||||||
|
|
|
@ -53,10 +53,10 @@ void BuildSystemMenu(DFWINDOW wnd)
|
||||||
ht = MenuHeight(SystemMenu.PullDown[0].Selections);
|
ht = MenuHeight(SystemMenu.PullDown[0].Selections);
|
||||||
wd = MenuWidth(SystemMenu.PullDown[0].Selections);
|
wd = MenuWidth(SystemMenu.PullDown[0].Selections);
|
||||||
|
|
||||||
if (lf+wd > SCREENWIDTH-1)
|
if (lf+wd > DfGetScreenWidth()-1)
|
||||||
lf = (SCREENWIDTH-1) - wd;
|
lf = (DfGetScreenWidth()-1) - wd;
|
||||||
if (tp+ht > SCREENHEIGHT-2)
|
if (tp+ht > DfGetScreenHeight()-2)
|
||||||
tp = (SCREENHEIGHT-2) - ht;
|
tp = (DfGetScreenHeight()-2) - ht;
|
||||||
|
|
||||||
SystemMenuWnd = DfCreateWindow(POPDOWNMENU, NULL,
|
SystemMenuWnd = DfCreateWindow(POPDOWNMENU, NULL,
|
||||||
lf,tp,ht,wd,NULL,wnd,SystemMenuProc, 0);
|
lf,tp,ht,wd,NULL,wnd,SystemMenuProc, 0);
|
||||||
|
|
|
@ -16,8 +16,15 @@
|
||||||
#define ZEROFLAG 0x40
|
#define ZEROFLAG 0x40
|
||||||
#define MAXSAVES 50
|
#define MAXSAVES 50
|
||||||
|
|
||||||
#define SCREENWIDTH (80)
|
//#define SCREENWIDTH (80)
|
||||||
#define SCREENHEIGHT (25)
|
//#define SCREENHEIGHT (25)
|
||||||
|
|
||||||
|
HANDLE hInput;
|
||||||
|
HANDLE hOutput;
|
||||||
|
|
||||||
|
SHORT sScreenHeight;
|
||||||
|
SHORT sScreenWidth;
|
||||||
|
|
||||||
|
|
||||||
/* ---------- keyboard prototypes -------- */
|
/* ---------- keyboard prototypes -------- */
|
||||||
int AltConvert(int);
|
int AltConvert(int);
|
||||||
|
@ -34,7 +41,7 @@ void unhidecursor(void);
|
||||||
void savecursor(void);
|
void savecursor(void);
|
||||||
void restorecursor(void);
|
void restorecursor(void);
|
||||||
void normalcursor(void);
|
void normalcursor(void);
|
||||||
void set_cursor_type(unsigned t);
|
void set_cursor_size(unsigned t);
|
||||||
void videomode(void);
|
void videomode(void);
|
||||||
void SwapCursorStack(void);
|
void SwapCursorStack(void);
|
||||||
|
|
||||||
|
|
|
@ -381,7 +381,7 @@ static void PaintMsg(DFWINDOW wnd, PARAM p1, PARAM p2)
|
||||||
ClipString++;
|
ClipString++;
|
||||||
|
|
||||||
/* ----- blank line for padding ----- */
|
/* ----- blank line for padding ----- */
|
||||||
memset(blankline, ' ', SCREENWIDTH);
|
memset(blankline, ' ', DfGetScreenWidth());
|
||||||
blankline[RectRight(rcc)+1] = '\0';
|
blankline[RectRight(rcc)+1] = '\0';
|
||||||
|
|
||||||
/* ------- each line within rectangle ------ */
|
/* ------- each line within rectangle ------ */
|
||||||
|
|
|
@ -81,7 +81,7 @@ void PutVideoChar(int x, int y, int ch)
|
||||||
COORD pos;
|
COORD pos;
|
||||||
DWORD dwWritten;
|
DWORD dwWritten;
|
||||||
|
|
||||||
if (x < SCREENWIDTH && y < SCREENHEIGHT)
|
if (x < sScreenWidth && y < sScreenHeight)
|
||||||
{
|
{
|
||||||
pos.X = x;
|
pos.X = x;
|
||||||
pos.Y = y;
|
pos.Y = y;
|
||||||
|
@ -141,7 +141,7 @@ BOOL CharInView(DFWINDOW wnd, int x, int y)
|
||||||
}
|
}
|
||||||
nwnd = NextWindow(nwnd);
|
nwnd = NextWindow(nwnd);
|
||||||
}
|
}
|
||||||
return (x1 < SCREENWIDTH && y1 < SCREENHEIGHT);
|
return (x1 < sScreenWidth && y1 < sScreenHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------- write a character to a window ------- */
|
/* -------- write a character to a window ------- */
|
||||||
|
@ -180,7 +180,7 @@ void wputs(DFWINDOW wnd, void *s, int x, int y)
|
||||||
int x2 = x1;
|
int x2 = x1;
|
||||||
int y1 = GetTop(wnd)+y;
|
int y1 = GetTop(wnd)+y;
|
||||||
|
|
||||||
if (x1 < SCREENWIDTH && y1 < SCREENHEIGHT && isVisible(wnd))
|
if (x1 < sScreenWidth && y1 < sScreenHeight && isVisible(wnd))
|
||||||
{
|
{
|
||||||
char ln[200];
|
char ln[200];
|
||||||
WORD attr[200];
|
WORD attr[200];
|
||||||
|
@ -223,8 +223,8 @@ void wputs(DFWINDOW wnd, void *s, int x, int y)
|
||||||
foreground = fg;
|
foreground = fg;
|
||||||
background = bg;
|
background = bg;
|
||||||
len = (int)(cp-ln);
|
len = (int)(cp-ln);
|
||||||
if (x1+len > SCREENWIDTH)
|
if (x1+len > sScreenWidth)
|
||||||
len = SCREENWIDTH-x1;
|
len = sScreenWidth-x1;
|
||||||
|
|
||||||
if (!ClipString && !TestAttribute(wnd, NOCLIP))
|
if (!ClipString && !TestAttribute(wnd, NOCLIP))
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,16 +24,16 @@ DFWINDOW DfCreateWindow(
|
||||||
int base;
|
int base;
|
||||||
/* ----- height, width = -1: fill the screen ------- */
|
/* ----- height, width = -1: fill the screen ------- */
|
||||||
if (height == -1)
|
if (height == -1)
|
||||||
height = SCREENHEIGHT;
|
height = sScreenHeight;
|
||||||
if (width == -1)
|
if (width == -1)
|
||||||
width = SCREENWIDTH;
|
width = sScreenWidth;
|
||||||
/* ----- coordinates -1, -1 = center the window ---- */
|
/* ----- coordinates -1, -1 = center the window ---- */
|
||||||
if (left == -1)
|
if (left == -1)
|
||||||
wnd->rc.lf = (SCREENWIDTH-width)/2;
|
wnd->rc.lf = (sScreenWidth-width)/2;
|
||||||
else
|
else
|
||||||
wnd->rc.lf = left;
|
wnd->rc.lf = left;
|
||||||
if (top == -1)
|
if (top == -1)
|
||||||
wnd->rc.tp = (SCREENHEIGHT-height)/2;
|
wnd->rc.tp = (sScreenHeight-height)/2;
|
||||||
else
|
else
|
||||||
wnd->rc.tp = top;
|
wnd->rc.tp = top;
|
||||||
wnd->attrib = attrib;
|
wnd->attrib = attrib;
|
||||||
|
@ -498,7 +498,9 @@ void PutWindowChar(DFWINDOW wnd, char c, int x, int y)
|
||||||
|
|
||||||
void PutWindowLine(DFWINDOW wnd, void *s, int x, int y)
|
void PutWindowLine(DFWINDOW wnd, void *s, int x, int y)
|
||||||
{
|
{
|
||||||
int saved = FALSE, sv;
|
int saved = FALSE;
|
||||||
|
int sv = 0;
|
||||||
|
|
||||||
if (x < ClientWidth(wnd) && y < ClientHeight(wnd))
|
if (x < ClientWidth(wnd) && y < ClientHeight(wnd))
|
||||||
{
|
{
|
||||||
char *en = (char *)s+ClientWidth(wnd)-x;
|
char *en = (char *)s+ClientWidth(wnd)-x;
|
||||||
|
|
Loading…
Reference in a new issue