diff --git a/rosapps/dflat32/applicat.c b/rosapps/dflat32/applicat.c index 89649d9c90e..8111fa20bb0 100644 --- a/rosapps/dflat32/applicat.c +++ b/rosapps/dflat32/applicat.c @@ -3,13 +3,13 @@ #include "dflat.h" static BOOL DisplayModified = FALSE; -DFWINDOW ApplicationWindow; +DFWINDOW DfApplicationWindow; -extern DBOX Display; -extern DBOX Windows; +extern DF_DBOX Display; +extern DF_DBOX Windows; #ifdef INCLUDE_LOGGING -extern DBOX Log; +extern DF_DBOX Log; #endif #ifdef INCLUDE_SHELLDOS @@ -46,21 +46,21 @@ static char Menus[9][26] = }; #endif -/* --------------- CREATE_WINDOW Message -------------- */ +/* --------------- DFM_CREATE_WINDOW Message -------------- */ static int CreateWindowMsg(DFWINDOW wnd) { int rtn; - ApplicationWindow = wnd; + DfApplicationWindow = wnd; #ifdef INCLUDE_WINDOWOPTIONS - if (cfg.Border) - SetCheckBox(&Display, ID_BORDER); - if (cfg.Title) - SetCheckBox(&Display, ID_TITLE); - if (cfg.StatusBar) - SetCheckBox(&Display, ID_STATUSBAR); - if (cfg.Texture) - SetCheckBox(&Display, ID_TEXTURE); + if (DfCfg.Border) + DfSetCheckBox(&Display, DF_ID_BORDER); + if (DfCfg.Title) + DfSetCheckBox(&Display, DF_ID_TITLE); + if (DfCfg.StatusBar) + DfSetCheckBox(&Display, DF_ID_STATUSBAR); + if (DfCfg.Texture) + DfSetCheckBox(&Display, DF_ID_TEXTURE); #endif SelectColors(wnd); #ifdef INCLUDE_WINDOWOPTIONS @@ -68,135 +68,135 @@ static int CreateWindowMsg(DFWINDOW wnd) SelectTitle(wnd); SelectStatusBar(wnd); #endif - rtn = BaseWndProc(APPLICATION, wnd, CREATE_WINDOW, 0, 0); + rtn = DfBaseWndProc(DF_APPLICATION, wnd, DFM_CREATE_WINDOW, 0, 0); if (wnd->extension != NULL) DfCreateMenu(wnd); CreateStatusBar(wnd); return rtn; } -/* --------- ADDSTATUS Message ---------- */ -static void AddStatusMsg(DFWINDOW wnd, PARAM p1) +/* --------- DFM_ADDSTATUS Message ---------- */ +static void AddStatusMsg(DFWINDOW wnd, DF_PARAM p1) { if (wnd->StatusBar != NULL) { if (p1 && *(char *)p1) - DfSendMessage(wnd->StatusBar, SETTEXT, p1, 0); + DfSendMessage(wnd->StatusBar, DFM_SETTEXT, p1, 0); else - DfSendMessage(wnd->StatusBar, CLEARTEXT, 0, 0); - DfSendMessage(wnd->StatusBar, PAINT, 0, 0); + DfSendMessage(wnd->StatusBar, DFM_CLEARTEXT, 0, 0); + DfSendMessage(wnd->StatusBar, DFM_PAINT, 0, 0); } } -/* -------- SETFOCUS Message -------- */ +/* -------- DFM_SETFOCUS Message -------- */ static void SetFocusMsg(DFWINDOW wnd, BOOL p1) { if (p1) - DfSendMessage(inFocus, SETFOCUS, FALSE, 0); - inFocus = p1 ? wnd : NULL; - if (isVisible(wnd)) - DfSendMessage(wnd, BORDER, 0, 0); + DfSendMessage(DfInFocus, DFM_SETFOCUS, FALSE, 0); + DfInFocus = p1 ? wnd : NULL; + if (DfIsVisible(wnd)) + DfSendMessage(wnd, DFM_BORDER, 0, 0); else - DfSendMessage(wnd, SHOW_WINDOW, 0, 0); + DfSendMessage(wnd, DFM_SHOW_WINDOW, 0, 0); } /* ------- SIZE Message -------- */ -static void SizeMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +static void SizeMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { BOOL WasVisible; - WasVisible = isVisible(wnd); + WasVisible = DfIsVisible(wnd); if (WasVisible) DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0); - if (p1-GetLeft(wnd) < 30) - p1 = GetLeft(wnd) + 30; - BaseWndProc(APPLICATION, wnd, DFM_SIZE, p1, p2); + if (p1-DfGetLeft(wnd) < 30) + p1 = DfGetLeft(wnd) + 30; + DfBaseWndProc(DF_APPLICATION, wnd, DFM_DFM_SIZE, p1, p2); DfCreateMenu(wnd); CreateStatusBar(wnd); if (WasVisible) - DfSendMessage(wnd, SHOW_WINDOW, 0, 0); + DfSendMessage(wnd, DFM_SHOW_WINDOW, 0, 0); } -/* ----------- KEYBOARD Message ------------ */ -static int KeyboardMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* ----------- DFM_KEYBOARD Message ------------ */ +static int KeyboardMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - if (WindowMoving || WindowSizing || (int) p1 == F1) - return BaseWndProc(APPLICATION, wnd, KEYBOARD, p1, p2); + if (DfWindowMoving || DfWindowSizing || (int) p1 == DF_F1) + return DfBaseWndProc(DF_APPLICATION, wnd, DFM_KEYBOARD, p1, p2); switch ((int) p1) { - case ALT_F4: - DfPostMessage(wnd, CLOSE_WINDOW, 0, 0); + case DF_ALT_F4: + DfPostMessage(wnd, DFM_CLOSE_WINDOW, 0, 0); return TRUE; #ifdef INCLUDE_MULTI_WINDOWS - case ALT_F6: - SetNextFocus(); + case DF_ALT_F6: + DfSetNextFocus(); return TRUE; #endif - case ALT_HYPHEN: - BuildSystemMenu(wnd); + case DF_ALT_HYPHEN: + DfBuildSystemMenu(wnd); return TRUE; default: break; } - DfPostMessage(wnd->MenuBarWnd, KEYBOARD, p1, p2); + DfPostMessage(wnd->MenuBarWnd, DFM_KEYBOARD, p1, p2); return TRUE; } -/* --------- SHIFT_CHANGED Message -------- */ -static void ShiftChangedMsg(DFWINDOW wnd, PARAM p1) +/* --------- DFM_SHIFT_CHANGED Message -------- */ +static void ShiftChangedMsg(DFWINDOW wnd, DF_PARAM p1) { extern BOOL AltDown; - if ((int)p1 & ALTKEY) + if ((int)p1 & DF_ALTKEY) AltDown = TRUE; else if (AltDown) { AltDown = FALSE; - if (wnd->MenuBarWnd != inFocus) - DfSendMessage(NULL, HIDE_CURSOR, 0, 0); - DfSendMessage(wnd->MenuBarWnd, KEYBOARD, F10, 0); + if (wnd->MenuBarWnd != DfInFocus) + DfSendMessage(NULL, DFM_HIDE_CURSOR, 0, 0); + DfSendMessage(wnd->MenuBarWnd, DFM_KEYBOARD, DF_F10, 0); } } /* -------- COMMAND Message ------- */ -static void CommandMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +static void CommandMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { switch ((int)p1) { - case ID_HELP: - DisplayHelp(wnd, DFlatApplication); + case DF_ID_HELP: + DfDisplayHelp(wnd, DFlatApplication); break; - case ID_HELPHELP: - DisplayHelp(wnd, "HelpHelp"); + case DF_ID_HELPHELP: + DfDisplayHelp(wnd, "HelpHelp"); break; - case ID_EXTHELP: - DisplayHelp(wnd, "ExtHelp"); + case DF_ID_EXTHELP: + DfDisplayHelp(wnd, "ExtHelp"); break; - case ID_KEYSHELP: - DisplayHelp(wnd, "KeysHelp"); + case DF_ID_KEYSHELP: + DfDisplayHelp(wnd, "KeysHelp"); break; - case ID_HELPINDEX: - DisplayHelp(wnd, "HelpIndex"); + case DF_ID_HELPINDEX: + DfDisplayHelp(wnd, "HelpIndex"); break; #ifdef TESTING_DFLAT - case ID_LOADHELP: - LoadHelpFile(); + case DF_ID_LOADHELP: + DfLoadHelpFile(); break; #endif #ifdef INCLUDE_LOGGING - case ID_LOG: - MessageLog(wnd); + case DF_ID_LOG: + DfMessageLog(wnd); break; #endif #ifdef INCLUDE_SHELLDOS - case ID_DOS: + case DF_ID_DOS: ShellDOS(wnd); break; #endif - case ID_EXIT: - case ID_SYSCLOSE: - DfPostMessage(wnd, CLOSE_WINDOW, 0, 0); + case DF_ID_EXIT: + case DF_ID_SYSCLOSE: + DfPostMessage(wnd, DFM_CLOSE_WINDOW, 0, 0); break; - case ID_DISPLAY: + case DF_ID_DISPLAY: if (DfDialogBox(wnd, &Display, TRUE, NULL)) { - if (inFocus == wnd->MenuBarWnd || inFocus == wnd->StatusBar) - oldFocus = ApplicationWindow; + if (DfInFocus == wnd->MenuBarWnd || DfInFocus == wnd->StatusBar) + oldFocus = DfApplicationWindow; else - oldFocus = inFocus; + oldFocus = DfInFocus; DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0); SelectColors(wnd); #ifdef INCLUDE_WINDOWOPTIONS @@ -207,45 +207,45 @@ static void CommandMsg(DFWINDOW wnd, PARAM p1, PARAM p2) #endif DfCreateMenu(wnd); CreateStatusBar(wnd); - DfSendMessage(wnd, SHOW_WINDOW, 0, 0); - DfSendMessage(oldFocus, SETFOCUS, TRUE, 0); + DfSendMessage(wnd, DFM_SHOW_WINDOW, 0, 0); + DfSendMessage(oldFocus, DFM_SETFOCUS, TRUE, 0); } break; - case ID_SAVEOPTIONS: - SaveConfig(); + case DF_ID_SAVEOPTIONS: + DfSaveConfig(); break; #ifdef INCLUDE_MULTI_WINDOWS - case ID_WINDOW: + case DF_ID_WINDOW: ChooseWindow(wnd, (int)p2-2); break; - case ID_CLOSEALL: + case DF_ID_CLOSEALL: CloseAll(wnd, FALSE); break; - case ID_MOREWINDOWS: + case DF_ID_MOREWINDOWS: MoreWindows(wnd); break; #endif #ifdef INCLUDE_RESTORE - case ID_SYSRESTORE: + case DF_ID_SYSRESTORE: #endif - case ID_SYSMOVE: - case ID_SYSSIZE: + case DF_ID_SYSMOVE: + case DF_ID_SYSSIZE: #ifdef INCLUDE_MINIMIZE - case ID_SYSMINIMIZE: + case DF_ID_SYSMINIMIZE: #endif #ifdef INCLUDE_MAXIMIZE - case ID_SYSMAXIMIZE: + case DF_ID_SYSMAXIMIZE: #endif - BaseWndProc(APPLICATION, wnd, DFM_COMMAND, p1, p2); + DfBaseWndProc(DF_APPLICATION, wnd, DFM_COMMAND, p1, p2); break; default: - if (inFocus != wnd->MenuBarWnd && inFocus != wnd) - DfPostMessage(inFocus, DFM_COMMAND, p1, p2); + if (DfInFocus != wnd->MenuBarWnd && DfInFocus != wnd) + DfPostMessage(DfInFocus, DFM_COMMAND, p1, p2); break; } } -/* --------- CLOSE_WINDOW Message -------- */ +/* --------- DFM_CLOSE_WINDOW Message -------- */ static int CloseWindowMsg(DFWINDOW wnd) { int rtn; @@ -254,78 +254,78 @@ static int CloseWindowMsg(DFWINDOW wnd) WindowSel = 0; #endif DfPostMessage(NULL, DFM_STOP, 0, 0); - rtn = BaseWndProc(APPLICATION, wnd, CLOSE_WINDOW, 0, 0); - UnLoadHelpFile(); + rtn = DfBaseWndProc(DF_APPLICATION, wnd, DFM_CLOSE_WINDOW, 0, 0); + DfUnLoadHelpFile(); DisplayModified = FALSE; - ApplicationWindow = NULL; + DfApplicationWindow = NULL; return rtn; } -/* --- APPLICATION Window Class window processing module --- */ -int ApplicationProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +/* --- DF_APPLICATION Window Class window processing module --- */ +int DfApplicationProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { switch (msg) { - case CREATE_WINDOW: + case DFM_CREATE_WINDOW: return CreateWindowMsg(wnd); case DFM_HIDE_WINDOW: - if (wnd == inFocus) - inFocus = NULL; + if (wnd == DfInFocus) + DfInFocus = NULL; break; - case ADDSTATUS: + case DFM_ADDSTATUS: AddStatusMsg(wnd, p1); return TRUE; - case SETFOCUS: - if ((int)p1 == (inFocus != wnd)) { + case DFM_SETFOCUS: + if ((int)p1 == (DfInFocus != wnd)) { SetFocusMsg(wnd, (BOOL) p1); return TRUE; } break; - case DFM_SIZE: + case DFM_DFM_SIZE: SizeMsg(wnd, p1, p2); return TRUE; #ifdef INCLUDE_MINIMIZE - case MINIMIZE: + case DFM_MINIMIZE: return TRUE; #endif - case KEYBOARD: + case DFM_KEYBOARD: return KeyboardMsg(wnd, p1, p2); - case SHIFT_CHANGED: + case DFM_SHIFT_CHANGED: ShiftChangedMsg(wnd, p1); return TRUE; - case PAINT: - if (isVisible(wnd)) { + case DFM_PAINT: + if (DfIsVisible(wnd)) { #ifdef INCLUDE_WINDOWOPTIONS - int cl = cfg.Texture ? APPLCHAR : ' '; + int cl = DfCfg.Texture ? DF_APPLCHAR : ' '; #else - int cl = APPLCHAR; + int cl = DF_APPLCHAR; #endif - ClearWindow(wnd, (DFRECT *)p1, cl); + DfClearWindow(wnd, (DFRECT *)p1, cl); } return TRUE; case DFM_COMMAND: CommandMsg(wnd, p1, p2); return TRUE; - case CLOSE_WINDOW: + case DFM_CLOSE_WINDOW: return CloseWindowMsg(wnd); default: break; } - return BaseWndProc(APPLICATION, wnd, msg, p1, p2); + return DfBaseWndProc(DF_APPLICATION, wnd, msg, p1, p2); } #ifdef INCLUDE_SHELLDOS static void SwitchCursor(void) { - DfSendMessage(NULL, SAVE_CURSOR, 0, 0); - SwapCursorStack(); - DfSendMessage(NULL, RESTORE_CURSOR, 0, 0); + DfSendMessage(NULL, DFM_SAVE_CURSOR, 0, 0); + DfSwapCursorStack(); + DfSendMessage(NULL, DFM_RESTORE_CURSOR, 0, 0); } /* ------- Shell out to DOS ---------- */ static void ShellDOS(DFWINDOW wnd) { - oldFocus = inFocus; + oldFocus = DfInFocus; DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0); SwitchCursor(); printf("To return to %s, execute the DOS exit command.", @@ -333,51 +333,51 @@ static void ShellDOS(DFWINDOW wnd) fflush(stdout); _spawnl(P_WAIT, getenv("COMSPEC"), " ", NULL); SwitchCursor(); - DfSendMessage(wnd, SHOW_WINDOW, 0, 0); - DfSendMessage(oldFocus, SETFOCUS, TRUE, 0); + DfSendMessage(wnd, DFM_SHOW_WINDOW, 0, 0); + DfSendMessage(oldFocus, DFM_SETFOCUS, TRUE, 0); } #endif /* -------- Create the menu bar -------- */ static void DfCreateMenu(DFWINDOW wnd) { - AddAttribute(wnd, HASMENUBAR); + DfAddAttribute(wnd, DF_HASMENUBAR); if (wnd->MenuBarWnd != NULL) - DfSendMessage(wnd->MenuBarWnd, CLOSE_WINDOW, 0, 0); - wnd->MenuBarWnd = DfCreateWindow(MENUBAR, + DfSendMessage(wnd->MenuBarWnd, DFM_CLOSE_WINDOW, 0, 0); + wnd->MenuBarWnd = DfDfCreateWindow(DF_MENUBAR, NULL, - GetClientLeft(wnd), - GetClientTop(wnd)-1, + DfGetClientLeft(wnd), + DfGetClientTop(wnd)-1, 1, - ClientWidth(wnd), + DfClientWidth(wnd), NULL, wnd, NULL, 0); - DfSendMessage(wnd->MenuBarWnd,BUILDMENU, - (PARAM)wnd->extension,0); - AddAttribute(wnd->MenuBarWnd, VISIBLE); + DfSendMessage(wnd->MenuBarWnd,DFM_BUILDMENU, + (DF_PARAM)wnd->extension,0); + DfAddAttribute(wnd->MenuBarWnd, DF_VISIBLE); } /* ----------- Create the status bar ------------- */ static void CreateStatusBar(DFWINDOW wnd) { if (wnd->StatusBar != NULL) { - DfSendMessage(wnd->StatusBar, CLOSE_WINDOW, 0, 0); + DfSendMessage(wnd->StatusBar, DFM_CLOSE_WINDOW, 0, 0); wnd->StatusBar = NULL; } - if (TestAttribute(wnd, HASSTATUSBAR)) { - wnd->StatusBar = DfCreateWindow(STATUSBAR, + if (DfTestAttribute(wnd, DF_HASSTATUSBAR)) { + wnd->StatusBar = DfDfCreateWindow(DF_STATUSBAR, NULL, - GetClientLeft(wnd), - GetBottom(wnd), + DfGetClientLeft(wnd), + DfGetBottom(wnd), 1, - ClientWidth(wnd), + DfClientWidth(wnd), NULL, wnd, NULL, 0); - AddAttribute(wnd->StatusBar, VISIBLE); + DfAddAttribute(wnd->StatusBar, DF_VISIBLE); } } @@ -385,44 +385,44 @@ static void CreateStatusBar(DFWINDOW wnd) /* -------- return the name of a document window ------- */ static char *WindowName(DFWINDOW wnd) { - if (GetTitle(wnd) == NULL) + if (DfGetTitle(wnd) == NULL) { - if (GetClass(wnd) == DIALOG) - return ((DBOX *)(wnd->extension))->HelpName; + if (DfGetClass(wnd) == DF_DIALOG) + return ((DF_DBOX *)(wnd->extension))->HelpName; else return "Untitled"; } else - return GetTitle(wnd); + return DfGetTitle(wnd); } /* ----------- Prepare the Window menu ------------ */ -void PrepWindowMenu(void *w, struct Menu *mnu) +void DfPrepWindowMenu(void *w, struct DfMenu *mnu) { DFWINDOW wnd = w; - struct PopDown *p0 = mnu->Selections; - struct PopDown *pd = mnu->Selections + 2; - struct PopDown *ca = mnu->Selections + 13; + struct DfPopDown *p0 = mnu->Selections; + struct DfPopDown *pd = mnu->Selections + 2; + struct DfPopDown *ca = mnu->Selections + 13; int MenuNo = 0; DFWINDOW cwnd; mnu->Selection = 0; oldFocus = NULL; - if (GetClass(wnd) != APPLICATION) + if (DfGetClass(wnd) != DF_APPLICATION) { oldFocus = wnd; - /* point to the APPLICATION window */ - if (ApplicationWindow == NULL) + /* point to the DF_APPLICATION window */ + if (DfApplicationWindow == NULL) return; - cwnd = FirstWindow(ApplicationWindow); + cwnd = DfFirstWindow(DfApplicationWindow); /* get the first 9 document windows */ while (cwnd != NULL && MenuNo < 9) { - if (GetClass(cwnd) != MENUBAR && - GetClass(cwnd) != STATUSBAR) + if (DfGetClass(cwnd) != DF_MENUBAR && + DfGetClass(cwnd) != DF_STATUSBAR) { /* add the document window to the menu */ strncpy (Menus[MenuNo]+4, WindowName(cwnd), 20); @@ -430,15 +430,15 @@ void PrepWindowMenu(void *w, struct Menu *mnu) if (cwnd == oldFocus) { /* mark the current document */ - pd->Attrib |= CHECKED; + pd->Attrib |= DF_CHECKED; mnu->Selection = MenuNo+2; } else - pd->Attrib &= ~CHECKED; + pd->Attrib &= ~DF_CHECKED; pd++; MenuNo++; } - cwnd = NextWindow(cwnd); + cwnd = DfNextWindow(cwnd); } } @@ -457,44 +457,44 @@ void PrepWindowMenu(void *w, struct Menu *mnu) } /* window processing module for the More Windows dialog box */ -static int WindowPrep(DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2) +static int WindowPrep(DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2) { switch (msg) { - case INITIATE_DIALOG: { + case DFM_INITIATE_DIALOG: { DFWINDOW wnd1; - DFWINDOW cwnd = ControlWindow(&Windows,ID_WINDOWLIST); + DFWINDOW cwnd = DfControlWindow(&Windows,DF_ID_WINDOWLIST); int sel = 0; if (cwnd == NULL) return FALSE; - wnd1 = FirstWindow(ApplicationWindow); + wnd1 = DfFirstWindow(DfApplicationWindow); while (wnd1 != NULL) { - if (wnd1 != wnd && GetClass(wnd1) != MENUBAR && - GetClass(wnd1) != STATUSBAR) { + if (wnd1 != wnd && DfGetClass(wnd1) != DF_MENUBAR && + DfGetClass(wnd1) != DF_STATUSBAR) { if (wnd1 == oldFocus) WindowSel = sel; - DfSendMessage(cwnd, ADDTEXT, - (PARAM) WindowName(wnd1), 0); + DfSendMessage(cwnd, DFM_ADDTEXT, + (DF_PARAM) WindowName(wnd1), 0); sel++; } - wnd1 = NextWindow(wnd1); + wnd1 = DfNextWindow(wnd1); } - DfSendMessage(cwnd, LB_SETSELECTION, WindowSel, 0); - AddAttribute(cwnd, VSCROLLBAR); - DfPostMessage(cwnd, SHOW_WINDOW, 0, 0); + DfSendMessage(cwnd, DFM_LB_SETSELECTION, WindowSel, 0); + DfAddAttribute(cwnd, DF_VSCROLLBAR); + DfPostMessage(cwnd, DFM_SHOW_WINDOW, 0, 0); break; } case DFM_COMMAND: switch ((int) p1) { - case ID_OK: + case DF_ID_OK: if ((int)p2 == 0) WindowSel = DfSendMessage( - ControlWindow(&Windows, - ID_WINDOWLIST), - LB_CURRENTSELECTION, 0, 0); + DfControlWindow(&Windows, + DF_ID_WINDOWLIST), + DFM_LB_CURRENTSELECTION, 0, 0); break; - case ID_WINDOWLIST: - if ((int) p2 == LB_CHOOSE) - DfSendMessage(wnd, DFM_COMMAND, ID_OK, 0); + case DF_ID_WINDOWLIST: + if ((int) p2 == DFM_LB_CHOOSE) + DfSendMessage(wnd, DFM_COMMAND, DF_ID_OK, 0); break; default: break; @@ -503,7 +503,7 @@ static int WindowPrep(DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2) default: break; } - return DefaultWndProc(wnd, msg, p1, p2); + return DfDefaultWndProc(wnd, msg, p1, p2); } /* ---- the More Windows command on the Window menu ---- */ @@ -517,19 +517,19 @@ static void MoreWindows(DFWINDOW wnd) or the More Window dialog box ----- */ static void ChooseWindow(DFWINDOW wnd, int WindowNo) { - DFWINDOW cwnd = FirstWindow(wnd); + DFWINDOW cwnd = DfFirstWindow(wnd); while (cwnd != NULL) { - if (GetClass(cwnd) != MENUBAR && - GetClass(cwnd) != STATUSBAR) + if (DfGetClass(cwnd) != DF_MENUBAR && + DfGetClass(cwnd) != DF_STATUSBAR) if (WindowNo-- == 0) break; - cwnd = NextWindow(cwnd); + cwnd = DfNextWindow(cwnd); } if (cwnd != NULL) { - DfSendMessage(cwnd, SETFOCUS, TRUE, 0); - if (cwnd->condition == ISMINIMIZED) - DfSendMessage(cwnd, RESTORE, 0, 0); + DfSendMessage(cwnd, DFM_SETFOCUS, TRUE, 0); + if (cwnd->condition == DF_ISMINIMIZED) + DfSendMessage(cwnd, DFM_RESTORE, 0, 0); } } @@ -538,20 +538,20 @@ static void CloseAll(DFWINDOW wnd, int closing) { DFWINDOW wnd1, wnd2; - DfSendMessage(wnd, SETFOCUS, TRUE, 0); - wnd1 = LastWindow(wnd); + DfSendMessage(wnd, DFM_SETFOCUS, TRUE, 0); + wnd1 = DfLastWindow(wnd); while (wnd1 != NULL) { - wnd2 = PrevWindow(wnd1); - if (GetClass(wnd1) != MENUBAR && GetClass(wnd1) != STATUSBAR) + wnd2 = DfPrevWindow(wnd1); + if (DfGetClass(wnd1) != DF_MENUBAR && DfGetClass(wnd1) != DF_STATUSBAR) { - ClearVisible(wnd1); - DfSendMessage(wnd1, CLOSE_WINDOW, 0, 0); + DfClearVisible(wnd1); + DfSendMessage(wnd1, DFM_CLOSE_WINDOW, 0, 0); } wnd1 = wnd2; } if (!closing) - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } #endif /* #ifdef INCLUDE_MULTI_WINDOWS */ @@ -560,21 +560,21 @@ static void DoWindowColors(DFWINDOW wnd) { DFWINDOW cwnd; - InitWindowColors(wnd); - cwnd = FirstWindow(wnd); + DfInitWindowColors(wnd); + cwnd = DfFirstWindow(wnd); while (cwnd != NULL) { DoWindowColors(cwnd); - if (GetClass(cwnd) == TEXT && GetText(cwnd) != NULL) - DfSendMessage(cwnd, CLEARTEXT, 0, 0); - cwnd = NextWindow(cwnd); + if (DfGetClass(cwnd) == DF_TEXT && DfGetText(cwnd) != NULL) + DfSendMessage(cwnd, DFM_CLEARTEXT, 0, 0); + cwnd = DfNextWindow(cwnd); } } /* set up colors for the application window */ static void SelectColors(DFWINDOW wnd) { - memcpy(cfg.clr, color, sizeof color); + memcpy(DfCfg.clr, DfColor, sizeof DfColor); DoWindowColors(wnd); } @@ -584,37 +584,37 @@ static void SelectColors(DFWINDOW wnd) /* ----- select the screen texture ----- */ static void SelectTexture(void) { - cfg.Texture = CheckBoxSetting(&Display, ID_TEXTURE); + DfCfg.Texture = DfCheckBoxSetting(&Display, DF_ID_TEXTURE); } /* -- select whether the application screen has a border -- */ static void SelectBorder(DFWINDOW wnd) { - cfg.Border = CheckBoxSetting(&Display, ID_BORDER); - if (cfg.Border) - AddAttribute(wnd, HASBORDER); + DfCfg.Border = DfCheckBoxSetting(&Display, DF_ID_BORDER); + if (DfCfg.Border) + DfAddAttribute(wnd, DF_HASBORDER); else - ClearAttribute(wnd, HASBORDER); + DfClearAttribute(wnd, DF_HASBORDER); } /* select whether the application screen has a status bar */ static void SelectStatusBar(DFWINDOW wnd) { - cfg.StatusBar = CheckBoxSetting(&Display, ID_STATUSBAR); - if (cfg.StatusBar) - AddAttribute(wnd, HASSTATUSBAR); + DfCfg.StatusBar = DfCheckBoxSetting(&Display, DF_ID_STATUSBAR); + if (DfCfg.StatusBar) + DfAddAttribute(wnd, DF_HASSTATUSBAR); else - ClearAttribute(wnd, HASSTATUSBAR); + DfClearAttribute(wnd, DF_HASSTATUSBAR); } /* select whether the application screen has a title bar */ static void SelectTitle(DFWINDOW wnd) { - cfg.Title = CheckBoxSetting(&Display, ID_TITLE); - if (cfg.Title) - AddAttribute(wnd, HASTITLEBAR); + DfCfg.Title = DfCheckBoxSetting(&Display, DF_ID_TITLE); + if (DfCfg.Title) + DfAddAttribute(wnd, DF_HASTITLEBAR); else - ClearAttribute(wnd, HASTITLEBAR); + DfClearAttribute(wnd, DF_HASTITLEBAR); } #endif diff --git a/rosapps/dflat32/barchart.c b/rosapps/dflat32/barchart.c index 020c1543e42..6148b9ab585 100644 --- a/rosapps/dflat32/barchart.c +++ b/rosapps/dflat32/barchart.c @@ -24,22 +24,22 @@ static char *Title = " PROJECT SCHEDULE"; static char *Months = " Jan Feb Mar Apr May Jun"; static int BarChartProc(DFWINDOW wnd, DFMESSAGE msg, - PARAM p1, PARAM p2) + DF_PARAM p1, DF_PARAM p2) { switch (msg) { case DFM_COMMAND: - if ((int)p1 == ID_HELP) { - DisplayHelp(wnd, "BarChart"); + if ((int)p1 == DF_ID_HELP) { + DfDisplayHelp(wnd, "BarChart"); return TRUE; } break; - case CLOSE_WINDOW: + case DFM_CLOSE_WINDOW: Bwnd = NULL; break; default: break; } - return DefaultWndProc(wnd, msg, p1, p2); + return DfDefaultWndProc(wnd, msg, p1, p2); } void BarChart(DFWINDOW pwnd) @@ -48,27 +48,27 @@ void BarChart(DFWINDOW pwnd) int i; if (Bwnd == NULL) { - Bwnd = DfCreateWindow(PICTUREBOX, + Bwnd = DfDfCreateWindow(DF_PICTUREBOX, "BarChart", -1, -1, BCHEIGHT, BCWIDTH, NULL, pwnd, BarChartProc, - SHADOW | - CONTROLBOX | - MOVEABLE | - HASBORDER + DF_SHADOW | + DF_CONTROLBOX | + DF_MOVEABLE | + DF_HASBORDER ); - DfSendMessage(Bwnd, ADDTEXT, (PARAM) Title, 0); - DfSendMessage(Bwnd, ADDTEXT, (PARAM) "", 0); + DfSendMessage(Bwnd, DFM_ADDTEXT, (DF_PARAM) Title, 0); + DfSendMessage(Bwnd, DFM_ADDTEXT, (DF_PARAM) "", 0); for (i = 0; i < pct; i++) { - DfSendMessage(Bwnd,ADDTEXT,(PARAM)projs[i].prj,0); - DrawBar(Bwnd, SOLIDBAR+(i%4), + DfSendMessage(Bwnd,DFM_ADDTEXT,(DF_PARAM)projs[i].prj,0); + DfDrawBar(Bwnd, DF_SOLIDBAR+(i%4), 11+projs[i].start*COLWIDTH, 2+i, (1 + projs[i].stop-projs[i].start) * COLWIDTH, TRUE); } - DfSendMessage(Bwnd, ADDTEXT, (PARAM) "", 0); - DfSendMessage(Bwnd, ADDTEXT, (PARAM) Months, 0); - DrawBox(Bwnd, 10, 1, pct+2, 25); + DfSendMessage(Bwnd, DFM_ADDTEXT, (DF_PARAM) "", 0); + DfSendMessage(Bwnd, DFM_ADDTEXT, (DF_PARAM) Months, 0); + DfDrawBox(Bwnd, 10, 1, pct+2, 25); } - DfSendMessage(Bwnd, SETFOCUS, TRUE, 0); + DfSendMessage(Bwnd, DFM_SETFOCUS, TRUE, 0); } diff --git a/rosapps/dflat32/box.c b/rosapps/dflat32/box.c index f23604218a2..fb72b6c0fc6 100644 --- a/rosapps/dflat32/box.c +++ b/rosapps/dflat32/box.c @@ -2,43 +2,43 @@ #include "dflat.h" -int BoxProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +int DfBoxProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { int rtn; DFWINDOW oldFocus; - CTLWINDOW *ct = GetControl(wnd); + DF_CTLWINDOW *ct = DfGetControl(wnd); static BOOL SettingFocus = FALSE; if (ct != NULL) { switch (msg) { - case SETFOCUS: - SettingFocus = isVisible(wnd); - rtn = BaseWndProc(BOX, wnd, msg, p1, p2); + case DFM_SETFOCUS: + SettingFocus = DfIsVisible(wnd); + rtn = DfBaseWndProc(DF_BOX, wnd, msg, p1, p2); SettingFocus = FALSE; return rtn; - case PAINT: + case DFM_PAINT: return FALSE; - case LEFT_BUTTON: + case DFM_LEFT_BUTTON: case DFM_BUTTON_RELEASED: - return DfSendMessage(GetParent(wnd), msg, p1, p2); - case BORDER: + return DfSendMessage(DfGetParent(wnd), msg, p1, p2); + case DFM_BORDER: if (SettingFocus) return TRUE; - oldFocus = inFocus; - inFocus = NULL; - rtn = BaseWndProc(BOX, wnd, msg, p1, p2); - inFocus = oldFocus; + oldFocus = DfInFocus; + DfInFocus = NULL; + rtn = DfBaseWndProc(DF_BOX, wnd, msg, p1, p2); + DfInFocus = oldFocus; if (ct != NULL) if (ct->itext != NULL) - writeline(wnd, ct->itext, 1, 0, FALSE); + DfWriteLine(wnd, ct->itext, 1, 0, FALSE); return rtn; default: break; } } - return BaseWndProc(BOX, wnd, msg, p1, p2); + return DfBaseWndProc(DF_BOX, wnd, msg, p1, p2); } /* EOF */ diff --git a/rosapps/dflat32/button.c b/rosapps/dflat32/button.c index 46f0b26b4d8..461d9b9d276 100644 --- a/rosapps/dflat32/button.c +++ b/rosapps/dflat32/button.c @@ -2,91 +2,91 @@ #include "dflat.h" -void PaintMsg(DFWINDOW wnd, CTLWINDOW *ct, DFRECT *rc) +void PaintMsg(DFWINDOW wnd, DF_CTLWINDOW *ct, DFRECT *rc) { - if (isVisible(wnd)) + if (DfIsVisible(wnd)) { - if (TestAttribute(wnd, SHADOW)) + if (DfTestAttribute(wnd, DF_SHADOW)) { /* -------- draw the button's shadow ------- */ int x; - background = WndBackground(GetParent(wnd)); - foreground = BLACK; - for (x = 1; x <= WindowWidth(wnd); x++) - wputch(wnd, (char)223, x, 1); - wputch(wnd, (char)220, WindowWidth(wnd), 0); + DfBackground = DfWndBackground(DfGetParent(wnd)); + DfForeground = BLACK; + for (x = 1; x <= DfWindowWidth(wnd); x++) + DfWPutch(wnd, (char)223, x, 1); + DfWPutch(wnd, (char)220, DfWindowWidth(wnd), 0); } if (ct->itext != NULL) { unsigned char *txt; - txt = DFcalloc(1, strlen(ct->itext)+10); - if (ct->setting == OFF) { - txt[0] = CHANGECOLOR; + txt = DfCalloc(1, strlen(ct->itext)+10); + if (ct->setting == DF_OFF) { + txt[0] = DF_CHANGECOLOR; txt[1] = wnd->WindowColors - [HILITE_COLOR] [FG] | 0x80; + [DF_HILITE_COLOR] [DF_FG] | 0x80; txt[2] = wnd->WindowColors - [STD_COLOR] [BG] | 0x80; + [DF_STD_COLOR] [DF_BG] | 0x80; } - CopyCommand(txt+strlen(txt),ct->itext,!ct->setting, - WndBackground(wnd)); - DfSendMessage(wnd, CLEARTEXT, 0, 0); - DfSendMessage(wnd, ADDTEXT, (PARAM) txt, 0); + DfCopyCommand(txt+strlen(txt),ct->itext,!ct->setting, + DfWndBackground(wnd)); + DfSendMessage(wnd, DFM_CLEARTEXT, 0, 0); + DfSendMessage(wnd, DFM_ADDTEXT, (DF_PARAM) txt, 0); free(txt); } /* --------- write the button's text ------- */ - WriteTextLine(wnd, rc, 0, wnd == inFocus); + DfWriteTextLine(wnd, rc, 0, wnd == DfInFocus); } } -void LeftButtonMsg(DFWINDOW wnd, DFMESSAGE msg, CTLWINDOW *ct) +void LeftButtonMsg(DFWINDOW wnd, DFMESSAGE msg, DF_CTLWINDOW *ct) { /* --------- draw a pushed button -------- */ int x; - background = WndBackground(GetParent(wnd)); - foreground = WndBackground(wnd); - wputch(wnd, ' ', 0, 0); - for (x = 0; x < WindowWidth(wnd); x++) + DfBackground = DfWndBackground(DfGetParent(wnd)); + DfForeground = DfWndBackground(wnd); + DfWPutch(wnd, ' ', 0, 0); + for (x = 0; x < DfWindowWidth(wnd); x++) { - wputch(wnd, (char)220, x+1, 0); - wputch(wnd, (char)223, x+1, 1); + DfWPutch(wnd, (char)220, x+1, 0); + DfWPutch(wnd, (char)223, x+1, 1); } - if (msg == LEFT_BUTTON) - DfSendMessage(NULL, WAITMOUSE, 0, 0); + if (msg == DFM_LEFT_BUTTON) + DfSendMessage(NULL, DFM_WAITMOUSE, 0, 0); else - DfSendMessage(NULL, WAITKEYBOARD, 0, 0); - DfSendMessage(wnd, PAINT, 0, 0); - if (ct->setting == ON) - DfPostMessage(GetParent(wnd), DFM_COMMAND, ct->command, 0); + DfSendMessage(NULL, DFM_WAITKEYBOARD, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); + if (ct->setting == DF_ON) + DfPostMessage(DfGetParent(wnd), DFM_COMMAND, ct->command, 0); else - beep(); + DfBeep(); } -int ButtonProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +int DfButtonProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { - CTLWINDOW *ct = GetControl(wnd); + DF_CTLWINDOW *ct = DfGetControl(wnd); if (ct != NULL) { switch (msg) { - case SETFOCUS: - BaseWndProc(BUTTON, wnd, msg, p1, p2); + case DFM_SETFOCUS: + DfBaseWndProc(DF_BUTTON, wnd, msg, p1, p2); p1 = 0; /* ------- fall through ------- */ - case PAINT: + case DFM_PAINT: PaintMsg(wnd, ct, (DFRECT*)p1); return TRUE; - case KEYBOARD: + case DFM_KEYBOARD: if (p1 != '\r') break; /* ---- fall through ---- */ - case LEFT_BUTTON: + case DFM_LEFT_BUTTON: LeftButtonMsg(wnd, msg, ct); return TRUE; - case HORIZSCROLL: + case DFM_HORIZSCROLL: return TRUE; default: break; } } - return BaseWndProc(BUTTON, wnd, msg, p1, p2); + return DfBaseWndProc(DF_BUTTON, wnd, msg, p1, p2); } /* EOF */ diff --git a/rosapps/dflat32/calendar.c b/rosapps/dflat32/calendar.c index 13dea84c007..b3b3c7fd3cc 100644 --- a/rosapps/dflat32/calendar.c +++ b/rosapps/dflat32/calendar.c @@ -58,11 +58,11 @@ static void BuildDateArray(void) static void CreateWindowMsg(DFWINDOW wnd) { int x, y; - DrawBox(wnd, 1, 2, CALHEIGHT-4, CALWIDTH-4); + DfDrawBox(wnd, 1, 2, CALHEIGHT-4, CALWIDTH-4); for (x = 5; x < CALWIDTH-4; x += 4) - DrawVector(wnd, x, 2, CALHEIGHT-4, FALSE); + DfDrawVector(wnd, x, 2, CALHEIGHT-4, FALSE); for (y = 4; y < CALHEIGHT-3; y+=2) - DrawVector(wnd, 1, y, CALWIDTH-4, TRUE); + DfDrawVector(wnd, 1, y, CALWIDTH-4, TRUE); } static void DisplayDates(DFWINDOW wnd) @@ -73,14 +73,14 @@ static void DisplayDates(DFWINDOW wnd) char banner[CALWIDTH-1]; char banner1[30]; - SetStandardColor(wnd); - PutWindowLine(wnd, "Sun Mon Tue Wed Thu Fri Sat", 2, 1); + DfSetStandardColor(wnd); + DfPutWindowLine(wnd, "Sun Mon Tue Wed Thu Fri Sat", 2, 1); memset(banner, ' ', CALWIDTH-2); strftime(banner1, 16, "%B, %Y", &ttm); offset = (CALWIDTH-2 - strlen(banner1)) / 2; strcpy(banner+offset, banner1); strcat(banner, " "); - PutWindowLine(wnd, banner, 0, 0); + DfPutWindowLine(wnd, banner, 0, 0); BuildDateArray(); for (week = 0; week < 6; week++) { for (day = 0; day < 7; day++) { @@ -90,23 +90,23 @@ static void DisplayDates(DFWINDOW wnd) else { if (dy == ttm.tm_mday) sprintf(dyln, "%c%c%c%2d %c", - CHANGECOLOR, - SelectForeground(wnd)+0x80, - SelectBackground(wnd)+0x80, - dy, RESETCOLOR); + DF_CHANGECOLOR, + DfSelectForeground(wnd)+0x80, + DfSelectBackground(wnd)+0x80, + dy, DF_RESETCOLOR); else sprintf(dyln, "%2d ", dy); } - SetStandardColor(wnd); - PutWindowLine(wnd, dyln, 2 + day * 4, 3 + week*2); + DfSetStandardColor(wnd); + DfPutWindowLine(wnd, dyln, 2 + day * 4, 3 + week*2); } } } -static int KeyboardMsg(DFWINDOW wnd, PARAM p1) +static int KeyboardMsg(DFWINDOW wnd, DF_PARAM p1) { switch ((int)p1) { - case PGUP: + case DF_PGUP: if (ttm.tm_mon == 0) { ttm.tm_mon = 12; ttm.tm_year--; @@ -116,7 +116,7 @@ static int KeyboardMsg(DFWINDOW wnd, PARAM p1) mktime(&ttm); DisplayDates(wnd); return TRUE; - case PGDN: + case DF_PGDN: ttm.tm_mon++; if (ttm.tm_mon == 12) { ttm.tm_mon = 0; @@ -133,34 +133,34 @@ static int KeyboardMsg(DFWINDOW wnd, PARAM p1) } static int CalendarProc(DFWINDOW wnd,DFMESSAGE msg, - PARAM p1,PARAM p2) + DF_PARAM p1,DF_PARAM p2) { switch (msg) { - case CREATE_WINDOW: - DefaultWndProc(wnd, msg, p1, p2); + case DFM_CREATE_WINDOW: + DfDefaultWndProc(wnd, msg, p1, p2); CreateWindowMsg(wnd); return TRUE; - case KEYBOARD: + case DFM_KEYBOARD: if (KeyboardMsg(wnd, p1)) return TRUE; break; - case PAINT: - DefaultWndProc(wnd, msg, p1, p2); + case DFM_PAINT: + DfDefaultWndProc(wnd, msg, p1, p2); DisplayDates(wnd); return TRUE; case DFM_COMMAND: - if ((int)p1 == ID_HELP) { - DisplayHelp(wnd, "Calendar"); + if ((int)p1 == DF_ID_HELP) { + DfDisplayHelp(wnd, "Calendar"); return TRUE; } break; - case CLOSE_WINDOW: + case DFM_CLOSE_WINDOW: Cwnd = NULL; break; default: break; } - return DefaultWndProc(wnd, msg, p1, p2); + return DfDefaultWndProc(wnd, msg, p1, p2); } void Calendar(DFWINDOW pwnd) @@ -168,18 +168,18 @@ void Calendar(DFWINDOW pwnd) if (Cwnd == NULL) { time_t tim = time(NULL); ttm = *localtime(&tim); - Cwnd = DfCreateWindow(PICTUREBOX, + Cwnd = DfDfCreateWindow(DF_PICTUREBOX, "Calendar", -1, -1, CALHEIGHT, CALWIDTH, NULL, pwnd, CalendarProc, - SHADOW | - MINMAXBOX | - CONTROLBOX | - MOVEABLE | - HASBORDER + DF_SHADOW | + DF_MINMAXBOX | + DF_CONTROLBOX | + DF_MOVEABLE | + DF_HASBORDER ); } - DfSendMessage(Cwnd, SETFOCUS, TRUE, 0); + DfSendMessage(Cwnd, DFM_SETFOCUS, TRUE, 0); } /* EOF */ diff --git a/rosapps/dflat32/checkbox.c b/rosapps/dflat32/checkbox.c index 3f41abe5c89..e39fd8f8d72 100644 --- a/rosapps/dflat32/checkbox.c +++ b/rosapps/dflat32/checkbox.c @@ -2,47 +2,47 @@ #include "dflat.h" -int CheckBoxProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +int DfCheckBoxProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { int rtn; - CTLWINDOW *ct = GetControl(wnd); + DF_CTLWINDOW *ct = DfGetControl(wnd); if (ct != NULL) { switch (msg) { - case SETFOCUS: + case DFM_SETFOCUS: if (!(int)p1) - DfSendMessage(NULL, HIDE_CURSOR, 0, 0); - case MOVE: - rtn = BaseWndProc(CHECKBOX, wnd, msg, p1, p2); - SetFocusCursor(wnd); + DfSendMessage(NULL, DFM_HIDE_CURSOR, 0, 0); + case DFM_MOVE: + rtn = DfBaseWndProc(DF_CHECKBOX, wnd, msg, p1, p2); + DfSetFocusCursor(wnd); return rtn; - case PAINT: { + case DFM_PAINT: { char cb[] = "[ ]"; if (ct->setting) cb[1] = 'X'; - DfSendMessage(wnd, CLEARTEXT, 0, 0); - DfSendMessage(wnd, ADDTEXT, (PARAM) cb, 0); - SetFocusCursor(wnd); + DfSendMessage(wnd, DFM_CLEARTEXT, 0, 0); + DfSendMessage(wnd, DFM_ADDTEXT, (DF_PARAM) cb, 0); + DfSetFocusCursor(wnd); break; } - case KEYBOARD: + case DFM_KEYBOARD: if ((int)p1 != ' ') break; - case LEFT_BUTTON: - ct->setting ^= ON; - DfSendMessage(wnd, PAINT, 0, 0); + case DFM_LEFT_BUTTON: + ct->setting ^= DF_ON; + DfSendMessage(wnd, DFM_PAINT, 0, 0); return TRUE; default: break; } } - return BaseWndProc(CHECKBOX, wnd, msg, p1, p2); + return DfBaseWndProc(DF_CHECKBOX, wnd, msg, p1, p2); } -BOOL CheckBoxSetting(DBOX *db, enum commands cmd) +BOOL DfCheckBoxSetting(DF_DBOX *db, enum DfCommands cmd) { - CTLWINDOW *ct = FindCommand(db, cmd, CHECKBOX); + DF_CTLWINDOW *ct = DfFindCommand(db, cmd, DF_CHECKBOX); if (ct != NULL) - return (ct->isetting == ON); + return (ct->isetting == DF_ON); return FALSE; } diff --git a/rosapps/dflat32/classdef.h b/rosapps/dflat32/classdef.h index 086ee493651..7f137d2c0c0 100644 --- a/rosapps/dflat32/classdef.h +++ b/rosapps/dflat32/classdef.h @@ -3,29 +3,29 @@ #ifndef CLASSDEF_H #define CLASSDEF_H -typedef struct classdefs { +typedef struct DfClassDefs { DFCLASS base; /* base window class */ - int (*wndproc)(struct window *,enum messages,PARAM,PARAM); + int (*wndproc)(struct DfWindow *,enum DfMessages,DF_PARAM,DF_PARAM); int attrib; -} CLASSDEFS; +} DFCLASSDEFS; -extern CLASSDEFS classdefs[]; +extern DFCLASSDEFS DfClassDefs[]; -#define SHADOW 0x0001 -#define MOVEABLE 0x0002 -#define SIZEABLE 0x0004 -#define HASMENUBAR 0x0008 -#define VSCROLLBAR 0x0010 -#define HSCROLLBAR 0x0020 -#define VISIBLE 0x0040 -#define SAVESELF 0x0080 -#define HASTITLEBAR 0x0100 -#define CONTROLBOX 0x0200 -#define MINMAXBOX 0x0400 -#define NOCLIP 0x0800 -#define READONLY 0x1000 -#define MULTILINE 0x2000 -#define HASBORDER 0x4000 -#define HASSTATUSBAR 0x8000 +#define DF_SHADOW 0x0001 +#define DF_MOVEABLE 0x0002 +#define DF_SIZEABLE 0x0004 +#define DF_HASMENUBAR 0x0008 +#define DF_VSCROLLBAR 0x0010 +#define DF_HSCROLLBAR 0x0020 +#define DF_VISIBLE 0x0040 +#define DF_SAVESELF 0x0080 +#define DF_HASTITLEBAR 0x0100 +#define DF_CONTROLBOX 0x0200 +#define DF_MINMAXBOX 0x0400 +#define DF_NOCLIP 0x0800 +#define DF_READONLY 0x1000 +#define DF_MULTILINE 0x2000 +#define DF_HASBORDER 0x4000 +#define DF_HASSTATUSBAR 0x8000 #endif diff --git a/rosapps/dflat32/classes.h b/rosapps/dflat32/classes.h index bfd1fdab055..d0f3a15fbe8 100644 --- a/rosapps/dflat32/classes.h +++ b/rosapps/dflat32/classes.h @@ -4,53 +4,53 @@ * Make class changes to this source file * Other source files will adapt * - * You must add entries to the color tables in - * CONFIG.C for new classes. + * You must add entries to the DfColor tables in + * DFCONFIG.C for new classes. * * Class Name Base Class Processor Attribute * ------------ --------- --------------- ----------- */ -ClassDef( NORMAL, -1, NormalProc, 0 ) -ClassDef( APPLICATION, NORMAL, ApplicationProc, VISIBLE | - SAVESELF | - CONTROLBOX ) -ClassDef( TEXTBOX, NORMAL, TextBoxProc, 0 ) -ClassDef( LISTBOX, TEXTBOX, ListBoxProc, 0 ) -ClassDef( EDITBOX, TEXTBOX, EditBoxProc, 0 ) -ClassDef( MENUBAR, NORMAL, MenuBarProc, NOCLIP ) -ClassDef( POPDOWNMENU, LISTBOX, PopDownProc, SAVESELF | - NOCLIP | - HASBORDER ) +DfClassDef( DF_NORMAL, -1, DfNormalProc, 0 ) +DfClassDef( DF_APPLICATION, DF_NORMAL, DfApplicationProc, DF_VISIBLE | + DF_SAVESELF | + DF_CONTROLBOX ) +DfClassDef( DF_TEXTBOX, DF_NORMAL, DfTextBoxProc, 0 ) +DfClassDef( DF_LISTBOX, DF_TEXTBOX, DfListBoxProc, 0 ) +DfClassDef( DF_EDITBOX, DF_TEXTBOX, DfEditBoxProc, 0 ) +DfClassDef( DF_MENUBAR, DF_NORMAL, DfMenuBarProc, DF_NOCLIP ) +DfClassDef( DF_POPDOWNMENU, DF_LISTBOX, DfPopDownProc, DF_SAVESELF | + DF_NOCLIP | + DF_HASBORDER ) #ifdef INCLUDE_PICTUREBOX -ClassDef( PICTUREBOX, TEXTBOX, PictureProc, 0 ) +DfClassDef( DF_PICTUREBOX, DF_TEXTBOX, DfPictureProc, 0 ) #endif -ClassDef( DIALOG, NORMAL, DialogProc, SHADOW | - MOVEABLE | - CONTROLBOX| - HASBORDER | - NOCLIP ) -ClassDef( BOX, NORMAL, BoxProc, HASBORDER ) -ClassDef( BUTTON, TEXTBOX, ButtonProc, SHADOW ) -ClassDef( COMBOBOX, EDITBOX, ComboProc, 0 ) -ClassDef( TEXT, TEXTBOX, TextProc, 0 ) -ClassDef( RADIOBUTTON, TEXTBOX, RadioButtonProc, 0 ) -ClassDef( CHECKBOX, TEXTBOX, CheckBoxProc, 0 ) -ClassDef( SPINBUTTON, LISTBOX, SpinButtonProc, 0 ) -ClassDef( ERRORBOX, DIALOG, NULL, SHADOW | - HASBORDER ) -ClassDef( MESSAGEBOX, DIALOG, NULL, SHADOW | - HASBORDER ) -ClassDef( HELPBOX, DIALOG, HelpBoxProc, MOVEABLE | - SAVESELF | - HASBORDER | - NOCLIP | - CONTROLBOX ) -ClassDef( STATUSBAR, TEXTBOX, StatusBarProc, NOCLIP ) +DfClassDef( DF_DIALOG, DF_NORMAL, DfDialogProc, DF_SHADOW | + DF_MOVEABLE | + DF_CONTROLBOX| + DF_HASBORDER | + DF_NOCLIP ) +DfClassDef( DF_BOX, DF_NORMAL, DfBoxProc, DF_HASBORDER ) +DfClassDef( DF_BUTTON, DF_TEXTBOX, DfButtonProc, DF_SHADOW ) +DfClassDef( DF_COMBOBOX, DF_EDITBOX, DfComboProc, 0 ) +DfClassDef( DF_TEXT, DF_TEXTBOX, DfTextProc, 0 ) +DfClassDef( DF_RADIOBUTTON, DF_TEXTBOX, DfRadioButtonProc, 0 ) +DfClassDef( DF_CHECKBOX, DF_TEXTBOX, DfCheckBoxProc, 0 ) +DfClassDef( DF_SPINBUTTON, DF_LISTBOX, DfSpinButtonProc, 0 ) +DfClassDef( DF_ERRORBOX, DF_DIALOG, NULL, DF_SHADOW | + DF_HASBORDER ) +DfClassDef( DF_MESSAGEBOX, DF_DIALOG, NULL, DF_SHADOW | + DF_HASBORDER ) +DfClassDef( DF_HELPBOX, DF_DIALOG, DfHelpBoxProc, DF_MOVEABLE | + DF_SAVESELF | + DF_HASBORDER | + DF_NOCLIP | + DF_CONTROLBOX ) +DfClassDef( DF_STATUSBAR, DF_TEXTBOX, DfStatusBarProc, DF_NOCLIP ) /* * ========> Add new classes here <======== */ /* ---------- pseudo classes to create enums, etc. ---------- */ -ClassDef( TITLEBAR, -1, NULL, 0 ) -ClassDef( DUMMY, -1, NULL, HASBORDER ) +DfClassDef( DF_TITLEBAR, -1, NULL, 0 ) +DfClassDef( DF_DUMMY, -1, NULL, DF_HASBORDER ) diff --git a/rosapps/dflat32/clipbord.c b/rosapps/dflat32/clipbord.c index bfa52f771fc..dd1c89158be 100644 --- a/rosapps/dflat32/clipbord.c +++ b/rosapps/dflat32/clipbord.c @@ -1,49 +1,49 @@ /* ----------- clipbord.c ------------ */ #include "dflat.h" -char *Clipboard; -unsigned ClipboardLength; +char *DfClipboard; +unsigned DfClipboardLength; -void CopyTextToClipboard(char *text) +void DfCopyTextToClipboard(char *text) { - ClipboardLength = strlen(text); - Clipboard = DFrealloc(Clipboard, ClipboardLength); - memmove(Clipboard, text, ClipboardLength); + DfClipboardLength = strlen(text); + DfClipboard = DfRealloc(DfClipboard, DfClipboardLength); + memmove(DfClipboard, text, DfClipboardLength); } -void CopyToClipboard(DFWINDOW wnd) +void DfCopyToClipboard(DFWINDOW wnd) { - if (TextBlockMarked(wnd)) { - char *bbl=TextLine(wnd,wnd->BlkBegLine)+wnd->BlkBegCol; - char *bel=TextLine(wnd,wnd->BlkEndLine)+wnd->BlkEndCol; - ClipboardLength = (int) (bel - bbl); - Clipboard = DFrealloc(Clipboard, ClipboardLength); - memmove(Clipboard, bbl, ClipboardLength); + if (DfTextBlockMarked(wnd)) { + char *bbl=DfTextLine(wnd,wnd->BlkBegLine)+wnd->BlkBegCol; + char *bel=DfTextLine(wnd,wnd->BlkEndLine)+wnd->BlkEndCol; + DfClipboardLength = (int) (bel - bbl); + DfClipboard = DfRealloc(DfClipboard, DfClipboardLength); + memmove(DfClipboard, bbl, DfClipboardLength); } } -void ClearClipboard(void) +void DfClearClipboard(void) { - if (Clipboard != NULL) { - free(Clipboard); - Clipboard = NULL; + if (DfClipboard != NULL) { + free(DfClipboard); + DfClipboard = NULL; } } -BOOL PasteText(DFWINDOW wnd, char *SaveTo, unsigned len) +BOOL DfPasteText(DFWINDOW wnd, char *SaveTo, unsigned len) { if (SaveTo != NULL && len > 0) { unsigned plen = strlen(wnd->text) + len; if (plen <= wnd->MaxTextLength) { if (plen+1 > wnd->textlen) { - wnd->text = DFrealloc(wnd->text, plen+3); + wnd->text = DfRealloc(wnd->text, plen+3); wnd->textlen = plen+1; } - memmove(CurrChar+len, CurrChar, strlen(CurrChar)+1); - memmove(CurrChar, SaveTo, len); - BuildTextPointers(wnd); + memmove(DfCurrChar+len, DfCurrChar, strlen(DfCurrChar)+1); + memmove(DfCurrChar, SaveTo, len); + DfBuildTextPointers(wnd); wnd->TextChanged = TRUE; return TRUE; } diff --git a/rosapps/dflat32/combobox.c b/rosapps/dflat32/combobox.c index 5bb6da894aa..387980086ef 100644 --- a/rosapps/dflat32/combobox.c +++ b/rosapps/dflat32/combobox.c @@ -2,54 +2,54 @@ #include "dflat.h" -int ListProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); +int ListProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); -int ComboProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +int DfComboProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { switch (msg) { - case CREATE_WINDOW: - wnd->extension = DfCreateWindow( - LISTBOX, + case DFM_CREATE_WINDOW: + wnd->extension = DfDfCreateWindow( + DF_LISTBOX, NULL, wnd->rc.lf,wnd->rc.tp+1, wnd->ht-1, wnd->wd+1, NULL, wnd, ListProc, - HASBORDER | NOCLIP | SAVESELF); + DF_HASBORDER | DF_NOCLIP | DF_SAVESELF); ((DFWINDOW)(wnd->extension))->ct->command = wnd->ct->command; wnd->ht = 1; wnd->rc.bt = wnd->rc.tp; break; - case PAINT: - foreground = WndBackground(wnd); - background = WndForeground(wnd); - wputch(wnd, DOWNSCROLLBOX, WindowWidth(wnd), 0); + case DFM_PAINT: + DfForeground = DfWndBackground(wnd); + DfBackground = DfWndForeground(wnd); + DfWPutch(wnd, DF_DOWNSCROLLBOX, DfWindowWidth(wnd), 0); break; - case KEYBOARD: - if ((int)p1 == DN) { - DfSendMessage(wnd->extension, SETFOCUS, TRUE, 0); + case DFM_KEYBOARD: + if ((int)p1 == DF_DN) { + DfSendMessage(wnd->extension, DFM_SETFOCUS, TRUE, 0); return TRUE; } break; - case LEFT_BUTTON: - if ((int)p1 == GetRight(wnd) + 1) - DfSendMessage(wnd->extension, SETFOCUS, TRUE, 0); + case DFM_LEFT_BUTTON: + if ((int)p1 == DfGetRight(wnd) + 1) + DfSendMessage(wnd->extension, DFM_SETFOCUS, TRUE, 0); break; - case CLOSE_WINDOW: - DfSendMessage(wnd->extension, CLOSE_WINDOW, 0, 0); + case DFM_CLOSE_WINDOW: + DfSendMessage(wnd->extension, DFM_CLOSE_WINDOW, 0, 0); break; default: break; } - return BaseWndProc(COMBOBOX, wnd, msg, p1, p2); + return DfBaseWndProc(DF_COMBOBOX, wnd, msg, p1, p2); } -int ListProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +int ListProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { - DFWINDOW pwnd = GetParent(GetParent(wnd)); - DBOX *db = pwnd->extension; + DFWINDOW pwnd = DfGetParent(DfGetParent(wnd)); + DF_DBOX *db = pwnd->extension; DFWINDOW cwnd; char text[130]; int rtn; @@ -57,59 +57,59 @@ int ListProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) switch (msg) { - case CREATE_WINDOW: - wnd->ct = DFmalloc(sizeof(CTLWINDOW)); - wnd->ct->setting = OFF; - wnd->WindowColors[FRAME_COLOR][FG] = - wnd->WindowColors[STD_COLOR][FG]; - wnd->WindowColors[FRAME_COLOR][BG] = - wnd->WindowColors[STD_COLOR][BG]; - rtn = DefaultWndProc(wnd, msg, p1, p2); + case DFM_CREATE_WINDOW: + wnd->ct = DfMalloc(sizeof(DF_CTLWINDOW)); + wnd->ct->setting = DF_OFF; + wnd->WindowColors[DF_FRAME_COLOR][DF_FG] = + wnd->WindowColors[DF_STD_COLOR][DF_FG]; + wnd->WindowColors[DF_FRAME_COLOR][DF_BG] = + wnd->WindowColors[DF_STD_COLOR][DF_BG]; + rtn = DfDefaultWndProc(wnd, msg, p1, p2); return rtn; - case SETFOCUS: + case DFM_SETFOCUS: if ((int)p1 == FALSE) { if (!wnd->isHelping) { DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0); - wnd->ct->setting = OFF; + wnd->ct->setting = DF_OFF; } } else - wnd->ct->setting = ON; + wnd->ct->setting = DF_ON; break; - case SHOW_WINDOW: - if (wnd->ct->setting == OFF) + case DFM_SHOW_WINDOW: + if (wnd->ct->setting == DF_OFF) return TRUE; break; - case BORDER: - currFocus = inFocus; - inFocus = NULL; - rtn = DefaultWndProc(wnd, msg, p1, p2); - inFocus = currFocus; + case DFM_BORDER: + currFocus = DfInFocus; + DfInFocus = NULL; + rtn = DfDefaultWndProc(wnd, msg, p1, p2); + DfInFocus = currFocus; return rtn; - case LB_SELECTION: - rtn = DefaultWndProc(wnd, msg, p1, p2); + case DFM_LB_SELECTION: + rtn = DfDefaultWndProc(wnd, msg, p1, p2); DfSendMessage(wnd, DFM_LB_GETTEXT, - (PARAM) text, wnd->selection); - PutItemText(pwnd, wnd->ct->command, text); - cwnd = ControlWindow(db, wnd->ct->command); - DfSendMessage(cwnd, PAINT, 0, 0); + (DF_PARAM) text, wnd->selection); + DfPutItemText(pwnd, wnd->ct->command, text); + cwnd = DfControlWindow(db, wnd->ct->command); + DfSendMessage(cwnd, DFM_PAINT, 0, 0); cwnd->TextChanged = TRUE; return rtn; - case KEYBOARD: + case DFM_KEYBOARD: switch ((int) p1) { - case ESC: - case FWD: - case BS: - cwnd = ControlWindow(db, wnd->ct->command); - DfSendMessage(cwnd, SETFOCUS, TRUE, 0); + case DF_ESC: + case DF_FWD: + case DF_BS: + cwnd = DfControlWindow(db, wnd->ct->command); + DfSendMessage(cwnd, DFM_SETFOCUS, TRUE, 0); return TRUE; default: @@ -117,12 +117,12 @@ int ListProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) } break; - case LB_CHOOSE: - cwnd = ControlWindow(db, wnd->ct->command); - DfSendMessage(cwnd, SETFOCUS, TRUE, 0); + case DFM_LB_CHOOSE: + cwnd = DfControlWindow(db, wnd->ct->command); + DfSendMessage(cwnd, DFM_SETFOCUS, TRUE, 0); return TRUE; - case CLOSE_WINDOW: + case DFM_CLOSE_WINDOW: if (wnd->ct != NULL) free(wnd->ct); wnd->ct = NULL; @@ -132,17 +132,17 @@ int ListProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) break; } - return DefaultWndProc(wnd, msg, p1, p2); + return DfDefaultWndProc(wnd, msg, p1, p2); } -void PutComboListText(DFWINDOW wnd, enum commands cmd, char *text) +void DfPutComboListText(DFWINDOW wnd, enum DfCommands cmd, char *text) { - CTLWINDOW *ct = FindCommand(wnd->extension, cmd, COMBOBOX); + DF_CTLWINDOW *ct = DfFindCommand(wnd->extension, cmd, DF_COMBOBOX); if (ct != NULL) { DFWINDOW lwnd = ((DFWINDOW)(ct->wnd))->extension; - DfSendMessage(lwnd, ADDTEXT, (PARAM) text, 0); + DfSendMessage(lwnd, DFM_ADDTEXT, (DF_PARAM) text, 0); } } diff --git a/rosapps/dflat32/commands.h b/rosapps/dflat32/commands.h index 6850ac68f29..37d9bf1086e 100644 --- a/rosapps/dflat32/commands.h +++ b/rosapps/dflat32/commands.h @@ -10,112 +10,112 @@ #ifndef COMMANDS_H #define COMMANDS_H -enum commands { +enum DfCommands { /* --------------- File menu ---------------- */ - ID_OPEN, - ID_NEW, - ID_SAVE, - ID_SAVEAS, - ID_DELETEFILE, - ID_PRINT, - ID_PRINTSETUP, - ID_DOS, - ID_EXIT, + DF_ID_OPEN, + DF_ID_NEW, + DF_ID_SAVE, + DF_ID_SAVEAS, + DF_ID_DELETEFILE, + DF_ID_PRINT, + DF_ID_PRINTSETUP, + DF_ID_DOS, + DF_ID_EXIT, /* --------------- Edit menu ---------------- */ - ID_UNDO, - ID_CUT, - ID_COPY, - ID_PASTE, - ID_PARAGRAPH, - ID_CLEAR, - ID_DELETETEXT, + DF_ID_UNDO, + DF_ID_CUT, + DF_ID_COPY, + DF_ID_PASTE, + DF_ID_PARAGRAPH, + DF_ID_CLEAR, + DF_ID_DELETETEXT, /* --------------- Search Menu -------------- */ - ID_SEARCH, - ID_REPLACE, - ID_SEARCHNEXT, + DF_ID_SEARCH, + DF_ID_REPLACE, + DF_ID_SEARCHNEXT, /* --------------- Utilities Menu ------------- */ - ID_CALENDAR, - ID_BARCHART, + DF_ID_CALENDAR, + DF_ID_BARCHART, /* -------------- Options menu -------------- */ - ID_INSERT, - ID_WRAP, - ID_LOG, - ID_TABS, - ID_DISPLAY, - ID_SAVEOPTIONS, + DF_ID_INSERT, + DF_ID_WRAP, + DF_ID_LOG, + DF_ID_TABS, + DF_ID_DISPLAY, + DF_ID_SAVEOPTIONS, /* --------------- Window menu -------------- */ - ID_CLOSEALL, - ID_WINDOW, - ID_MOREWINDOWS, + DF_ID_CLOSEALL, + DF_ID_WINDOW, + DF_ID_MOREWINDOWS, /* --------------- Help menu ---------------- */ - ID_HELPHELP, - ID_EXTHELP, - ID_KEYSHELP, - ID_HELPINDEX, - ID_ABOUT, - ID_LOADHELP, + DF_ID_HELPHELP, + DF_ID_EXTHELP, + DF_ID_KEYSHELP, + DF_ID_HELPINDEX, + DF_ID_ABOUT, + DF_ID_LOADHELP, /* --------------- System menu -------------- */ #ifdef INCLUDE_RESTORE - ID_SYSRESTORE, + DF_ID_SYSRESTORE, #endif - ID_SYSMOVE, - ID_SYSSIZE, + DF_ID_SYSMOVE, + DF_ID_SYSSIZE, #ifdef INCLUDE_MINIMIZE - ID_SYSMINIMIZE, + DF_ID_SYSMINIMIZE, #endif #ifdef INCLUDE_MAXIMIZE - ID_SYSMAXIMIZE, + DF_ID_SYSMAXIMIZE, #endif - ID_SYSCLOSE, + DF_ID_SYSCLOSE, /* ---- FileOpen and SaveAs dialog boxes ---- */ - ID_FILENAME, - ID_FILES, - ID_DRIVE, - ID_PATH, + DF_ID_FILENAME, + DF_ID_FILES, + DF_ID_DRIVE, + DF_ID_PATH, /* ----- Search and Replace dialog boxes ---- */ - ID_SEARCHFOR, - ID_REPLACEWITH, - ID_MATCHCASE, - ID_REPLACEALL, + DF_ID_SEARCHFOR, + DF_ID_REPLACEWITH, + DF_ID_MATCHCASE, + DF_ID_REPLACEALL, /* ----------- Windows dialog box ----------- */ - ID_WINDOWLIST, + DF_ID_WINDOWLIST, /* --------- generic command buttons -------- */ - ID_OK, - ID_CANCEL, - ID_HELP, + DF_ID_OK, + DF_ID_CANCEL, + DF_ID_HELP, /* -------------- TabStops menu ------------- */ - ID_TAB2, - ID_TAB4, - ID_TAB6, - ID_TAB8, + DF_ID_TAB2, + DF_ID_TAB4, + DF_ID_TAB6, + DF_ID_TAB8, /* ------------ Display dialog box ---------- */ - ID_BORDER, - ID_TITLE, - ID_STATUSBAR, - ID_TEXTURE, - ID_SNOWY, - ID_COLOR, - ID_MONO, - ID_REVERSE, - ID_25LINES, - ID_43LINES, - ID_50LINES, + DF_ID_BORDER, + DF_ID_TITLE, + DF_ID_STATUSBAR, + DF_ID_TEXTURE, + DF_ID_SNOWY, + DF_ID_COLOR, + DF_ID_MONO, + DF_ID_REVERSE, + DF_ID_25LINES, + DF_ID_43LINES, + DF_ID_50LINES, /* ------------- Log dialog box ------------- */ - ID_LOGLIST, - ID_LOGGING, + DF_ID_LOGLIST, + DF_ID_LOGGING, /* ------------ HelpBox dialog box ---------- */ - ID_HELPTEXT, - ID_BACK, - ID_PREV, - ID_NEXT, + DF_ID_HELPTEXT, + DF_ID_BACK, + DF_ID_PREV, + DF_ID_NEXT, /* ---------- Print Select dialog box --------- */ - ID_PRINTERPORT, - ID_LEFTMARGIN, - ID_RIGHTMARGIN, - ID_TOPMARGIN, - ID_BOTTOMMARGIN, - /* ----------- InputBox dialog box ------------ */ - ID_INPUTTEXT + DF_ID_PRINTERPORT, + DF_ID_LEFTMARGIN, + DF_ID_RIGHTMARGIN, + DF_ID_TOPMARGIN, + DF_ID_BOTTOMMARGIN, + /* ----------- DfInputBox dialog box ------------ */ + DF_ID_INPUTTEXT }; #endif diff --git a/rosapps/dflat32/config.c b/rosapps/dflat32/config.c index d87ff48c7d4..a80a0a5a5d8 100644 --- a/rosapps/dflat32/config.c +++ b/rosapps/dflat32/config.c @@ -2,425 +2,425 @@ #include "dflat.h" -/* ----- default colors for color video system ----- */ -unsigned char color[CLASSCOUNT] [4] [2] = { - /* ------------ NORMAL ------------ */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {LIGHTGRAY, BLACK}},/* HILITE_COLOR */ +/* ----- default colors for DfColor video system ----- */ +unsigned char DfColor[DF_CLASSCOUNT] [4] [2] = { + /* ------------ DF_NORMAL ------------ */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {LIGHTGRAY, BLACK}},/* DF_HILITE_COLOR */ - /* ---------- APPLICATION --------- */ - {{LIGHTGRAY, BLUE}, /* STD_COLOR */ - {LIGHTGRAY, BLUE}, /* SELECT_COLOR */ - {LIGHTGRAY, BLUE}, /* FRAME_COLOR */ - {LIGHTGRAY, BLUE}}, /* HILITE_COLOR */ + /* ---------- DF_APPLICATION --------- */ + {{LIGHTGRAY, BLUE}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLUE}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLUE}, /* DF_FRAME_COLOR */ + {LIGHTGRAY, BLUE}}, /* DF_HILITE_COLOR */ - /* ------------ TEXTBOX ----------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ------------ DF_TEXTBOX ----------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ------------ LISTBOX ----------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {LIGHTGRAY, BLUE}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ------------ DF_LISTBOX ----------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLUE}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ----------- EDITBOX ------------ */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {LIGHTGRAY, BLUE}, /* SELECT_COLOR */ - {LIGHTGRAY, BLUE}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ----------- DF_EDITBOX ------------ */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLUE}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLUE}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ---------- MENUBAR ------------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {BLACK, CYAN}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {DARKGRAY, RED}}, /* HILITE_COLOR - Inactive, Shortcut (both FG) */ + /* ---------- DF_MENUBAR ------------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {BLACK, CYAN}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {DARKGRAY, RED}}, /* DF_HILITE_COLOR + Inactive, Shortcut (both DF_FG) */ - /* ---------- POPDOWNMENU --------- */ - {{BLACK, CYAN}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {BLACK, CYAN}, /* FRAME_COLOR */ - {DARKGRAY, RED}}, /* HILITE_COLOR - Inactive ,Shortcut (both FG) */ + /* ---------- DF_POPDOWNMENU --------- */ + {{BLACK, CYAN}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {BLACK, CYAN}, /* DF_FRAME_COLOR */ + {DARKGRAY, RED}}, /* DF_HILITE_COLOR + Inactive ,Shortcut (both DF_FG) */ #ifdef INCLUDE_PICTUREBOX - /* ------------ PICTUREBOX ----------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ------------ DF_PICTUREBOX ----------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ #endif - /* ------------- DIALOG ----------- */ - {{LIGHTGRAY, BLUE}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {LIGHTGRAY, BLUE}, /* FRAME_COLOR */ - {LIGHTGRAY, BLUE}}, /* HILITE_COLOR */ + /* ------------- DF_DIALOG ----------- */ + {{LIGHTGRAY, BLUE}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLUE}, /* DF_FRAME_COLOR */ + {LIGHTGRAY, BLUE}}, /* DF_HILITE_COLOR */ - /* ------------ BOX --------------- */ - {{LIGHTGRAY, BLUE}, /* STD_COLOR */ - {LIGHTGRAY, BLUE}, /* SELECT_COLOR */ - {LIGHTGRAY, BLUE}, /* FRAME_COLOR */ - {LIGHTGRAY, BLUE}}, /* HILITE_COLOR */ + /* ------------ DF_BOX --------------- */ + {{LIGHTGRAY, BLUE}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLUE}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLUE}, /* DF_FRAME_COLOR */ + {LIGHTGRAY, BLUE}}, /* DF_HILITE_COLOR */ - /* ------------ BUTTON ------------ */ - {{BLACK, CYAN}, /* STD_COLOR */ - {WHITE, CYAN}, /* SELECT_COLOR */ - {BLACK, CYAN}, /* FRAME_COLOR */ - {DARKGRAY, RED}}, /* HILITE_COLOR - Inactive ,Shortcut (both FG) */ - /* ------------ COMBOBOX ----------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ------------ DF_BUTTON ------------ */ + {{BLACK, CYAN}, /* DF_STD_COLOR */ + {WHITE, CYAN}, /* DF_SELECT_COLOR */ + {BLACK, CYAN}, /* DF_FRAME_COLOR */ + {DARKGRAY, RED}}, /* DF_HILITE_COLOR + Inactive ,Shortcut (both DF_FG) */ + /* ------------ DF_COMBOBOX ----------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ------------- TEXT ----------- */ - {{0xff, 0xff}, /* STD_COLOR */ - {0xff, 0xff}, /* SELECT_COLOR */ - {0xff, 0xff}, /* FRAME_COLOR */ - {0xff, 0xff}}, /* HILITE_COLOR */ + /* ------------- DF_TEXT ----------- */ + {{0xff, 0xff}, /* DF_STD_COLOR */ + {0xff, 0xff}, /* DF_SELECT_COLOR */ + {0xff, 0xff}, /* DF_FRAME_COLOR */ + {0xff, 0xff}}, /* DF_HILITE_COLOR */ - /* ------------- RADIOBUTTON ----------- */ - {{LIGHTGRAY, BLUE}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {LIGHTGRAY, BLUE}, /* FRAME_COLOR */ - {LIGHTGRAY, BLUE}}, /* HILITE_COLOR */ + /* ------------- DF_RADIOBUTTON ----------- */ + {{LIGHTGRAY, BLUE}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLUE}, /* DF_FRAME_COLOR */ + {LIGHTGRAY, BLUE}}, /* DF_HILITE_COLOR */ - /* ------------- CHECKBOX ----------- */ - {{LIGHTGRAY, BLUE}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {LIGHTGRAY, BLUE}, /* FRAME_COLOR */ - {LIGHTGRAY, BLUE}}, /* HILITE_COLOR */ + /* ------------- DF_CHECKBOX ----------- */ + {{LIGHTGRAY, BLUE}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLUE}, /* DF_FRAME_COLOR */ + {LIGHTGRAY, BLUE}}, /* DF_HILITE_COLOR */ - /* ------------ SPINBUTTON ----------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ------------ DF_SPINBUTTON ----------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ----------- ERRORBOX ----------- */ - {{YELLOW, RED}, /* STD_COLOR */ - {YELLOW, RED}, /* SELECT_COLOR */ - {YELLOW, RED}, /* FRAME_COLOR */ - {YELLOW, RED}}, /* HILITE_COLOR */ + /* ----------- DF_ERRORBOX ----------- */ + {{YELLOW, RED}, /* DF_STD_COLOR */ + {YELLOW, RED}, /* DF_SELECT_COLOR */ + {YELLOW, RED}, /* DF_FRAME_COLOR */ + {YELLOW, RED}}, /* DF_HILITE_COLOR */ - /* ----------- MESSAGEBOX --------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ----------- DF_MESSAGEBOX --------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ----------- HELPBOX ------------ */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {LIGHTGRAY, BLUE}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {WHITE, LIGHTGRAY}},/* HILITE_COLOR */ + /* ----------- DF_HELPBOX ------------ */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLUE}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {WHITE, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ---------- STATUSBAR ------------- */ - {{BLACK, CYAN}, /* STD_COLOR */ - {BLACK, CYAN}, /* SELECT_COLOR */ - {BLACK, CYAN}, /* FRAME_COLOR */ - {BLACK, CYAN}}, /* HILITE_COLOR */ + /* ---------- DF_STATUSBAR ------------- */ + {{BLACK, CYAN}, /* DF_STD_COLOR */ + {BLACK, CYAN}, /* DF_SELECT_COLOR */ + {BLACK, CYAN}, /* DF_FRAME_COLOR */ + {BLACK, CYAN}}, /* DF_HILITE_COLOR */ - /* ---------- TITLEBAR ------------ */ - {{BLACK, CYAN}, /* STD_COLOR */ - {BLACK, CYAN}, /* SELECT_COLOR */ - {BLACK, CYAN}, /* FRAME_COLOR */ - {WHITE, CYAN}}, /* HILITE_COLOR */ + /* ---------- DF_TITLEBAR ------------ */ + {{BLACK, CYAN}, /* DF_STD_COLOR */ + {BLACK, CYAN}, /* DF_SELECT_COLOR */ + {BLACK, CYAN}, /* DF_FRAME_COLOR */ + {WHITE, CYAN}}, /* DF_HILITE_COLOR */ - /* ------------ DUMMY ------------- */ - {{GREEN, LIGHTGRAY}, /* STD_COLOR */ - {GREEN, LIGHTGRAY}, /* SELECT_COLOR */ - {GREEN, LIGHTGRAY}, /* FRAME_COLOR */ - {GREEN, LIGHTGRAY}} /* HILITE_COLOR */ + /* ------------ DF_DUMMY ------------- */ + {{GREEN, LIGHTGRAY}, /* DF_STD_COLOR */ + {GREEN, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {GREEN, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {GREEN, LIGHTGRAY}} /* DF_HILITE_COLOR */ }; /* ----- default colors for mono video system ----- */ -unsigned char bw[CLASSCOUNT] [4] [2] = { - /* ------------ NORMAL ------------ */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {LIGHTGRAY, BLACK}},/* HILITE_COLOR */ +unsigned char DfBW[DF_CLASSCOUNT] [4] [2] = { + /* ------------ DF_NORMAL ------------ */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {LIGHTGRAY, BLACK}},/* DF_HILITE_COLOR */ - /* ---------- APPLICATION --------- */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {LIGHTGRAY, BLACK}},/* HILITE_COLOR */ + /* ---------- DF_APPLICATION --------- */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {LIGHTGRAY, BLACK}},/* DF_HILITE_COLOR */ - /* ------------ TEXTBOX ----------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ------------ DF_TEXTBOX ----------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ------------ LISTBOX ----------- */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ------------ DF_LISTBOX ----------- */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ----------- EDITBOX ------------ */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ----------- DF_EDITBOX ------------ */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ---------- MENUBAR ------------- */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {DARKGRAY, WHITE}}, /* HILITE_COLOR - Inactive, Shortcut (both FG) */ + /* ---------- DF_MENUBAR ------------- */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {DARKGRAY, WHITE}}, /* DF_HILITE_COLOR + Inactive, Shortcut (both DF_FG) */ - /* ---------- POPDOWNMENU --------- */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {DARKGRAY, WHITE}}, /* HILITE_COLOR - Inactive ,Shortcut (both FG) */ + /* ---------- DF_POPDOWNMENU --------- */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {DARKGRAY, WHITE}}, /* DF_HILITE_COLOR + Inactive ,Shortcut (both DF_FG) */ #ifdef INCLUDE_PICTUREBOX - /* ------------ PICTUREBOX ----------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ------------ DF_PICTUREBOX ----------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ #endif - /* ------------- DIALOG ----------- */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {LIGHTGRAY, BLACK}}, /* HILITE_COLOR */ + /* ------------- DF_DIALOG ----------- */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {LIGHTGRAY, BLACK}}, /* DF_HILITE_COLOR */ - /* ------------ BOX --------------- */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {LIGHTGRAY, BLACK}}, /* HILITE_COLOR */ + /* ------------ DF_BOX --------------- */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {LIGHTGRAY, BLACK}}, /* DF_HILITE_COLOR */ - /* ------------ BUTTON ------------ */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {WHITE, LIGHTGRAY}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {DARKGRAY, WHITE}}, /* HILITE_COLOR - Inactive ,Shortcut (both FG) */ - /* ------------ COMBOBOX ----------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ------------ DF_BUTTON ------------ */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {WHITE, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {DARKGRAY, WHITE}}, /* DF_HILITE_COLOR + Inactive ,Shortcut (both DF_FG) */ + /* ------------ DF_COMBOBOX ----------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ------------- TEXT ----------- */ - {{0xff, 0xff}, /* STD_COLOR */ - {0xff, 0xff}, /* SELECT_COLOR */ - {0xff, 0xff}, /* FRAME_COLOR */ - {0xff, 0xff}}, /* HILITE_COLOR */ + /* ------------- DF_TEXT ----------- */ + {{0xff, 0xff}, /* DF_STD_COLOR */ + {0xff, 0xff}, /* DF_SELECT_COLOR */ + {0xff, 0xff}, /* DF_FRAME_COLOR */ + {0xff, 0xff}}, /* DF_HILITE_COLOR */ - /* ------------- RADIOBUTTON ----------- */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {LIGHTGRAY, BLACK}}, /* HILITE_COLOR */ + /* ------------- DF_RADIOBUTTON ----------- */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {LIGHTGRAY, BLACK}}, /* DF_HILITE_COLOR */ - /* ------------- CHECKBOX ----------- */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {LIGHTGRAY, BLACK}}, /* HILITE_COLOR */ + /* ------------- DF_CHECKBOX ----------- */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {LIGHTGRAY, BLACK}}, /* DF_HILITE_COLOR */ - /* ------------ SPINBUTTON ----------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ------------ DF_SPINBUTTON ----------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ----------- ERRORBOX ----------- */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {LIGHTGRAY, BLACK}},/* HILITE_COLOR */ + /* ----------- DF_ERRORBOX ----------- */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {LIGHTGRAY, BLACK}},/* DF_HILITE_COLOR */ - /* ----------- MESSAGEBOX --------- */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {LIGHTGRAY, BLACK}},/* HILITE_COLOR */ + /* ----------- DF_MESSAGEBOX --------- */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {LIGHTGRAY, BLACK}},/* DF_HILITE_COLOR */ - /* ----------- HELPBOX ------------ */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {WHITE, BLACK}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {WHITE, LIGHTGRAY}},/* HILITE_COLOR */ + /* ----------- DF_HELPBOX ------------ */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {WHITE, BLACK}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {WHITE, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ---------- STATUSBAR ------------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ---------- DF_STATUSBAR ------------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ---------- TITLEBAR ------------ */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ---------- DF_TITLEBAR ------------ */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ------------ DUMMY ------------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}} /* HILITE_COLOR */ + /* ------------ DF_DUMMY ------------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}} /* DF_HILITE_COLOR */ }; -/* ----- default colors for reverse mono video ----- */ -unsigned char reverse[CLASSCOUNT] [4] [2] = { - /* ------------ NORMAL ------------ */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ +/* ----- default colors for DfReverse mono video ----- */ +unsigned char DfReverse[DF_CLASSCOUNT] [4] [2] = { + /* ------------ DF_NORMAL ------------ */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ---------- APPLICATION --------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ---------- DF_APPLICATION --------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ------------ TEXTBOX ----------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ------------ DF_TEXTBOX ----------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ------------ LISTBOX ----------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ------------ DF_LISTBOX ----------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ----------- EDITBOX ------------ */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ----------- DF_EDITBOX ------------ */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ---------- MENUBAR ------------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {DARKGRAY, WHITE}}, /* HILITE_COLOR - Inactive, Shortcut (both FG) */ + /* ---------- DF_MENUBAR ------------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {DARKGRAY, WHITE}}, /* DF_HILITE_COLOR + Inactive, Shortcut (both DF_FG) */ - /* ---------- POPDOWNMENU --------- */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {DARKGRAY, WHITE}}, /* HILITE_COLOR - Inactive ,Shortcut (both FG) */ + /* ---------- DF_POPDOWNMENU --------- */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {DARKGRAY, WHITE}}, /* DF_HILITE_COLOR + Inactive ,Shortcut (both DF_FG) */ #ifdef INCLUDE_PICTUREBOX - /* ------------ PICTUREBOX ----------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ------------ DF_PICTUREBOX ----------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ #endif - /* ------------- DIALOG ----------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}}, /* HILITE_COLOR */ + /* ------------- DF_DIALOG ----------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}}, /* DF_HILITE_COLOR */ - /* ------------ BOX --------------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}}, /* HILITE_COLOR */ + /* ------------ DF_BOX --------------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}}, /* DF_HILITE_COLOR */ - /* ------------ BUTTON ------------ */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {WHITE, BLACK}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {DARKGRAY, WHITE}}, /* HILITE_COLOR - Inactive ,Shortcut (both FG) */ - /* ------------ COMBOBOX ----------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ------------ DF_BUTTON ------------ */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {WHITE, BLACK}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {DARKGRAY, WHITE}}, /* DF_HILITE_COLOR + Inactive ,Shortcut (both DF_FG) */ + /* ------------ DF_COMBOBOX ----------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ------------- TEXT ----------- */ - {{0xff, 0xff}, /* STD_COLOR */ - {0xff, 0xff}, /* SELECT_COLOR */ - {0xff, 0xff}, /* FRAME_COLOR */ - {0xff, 0xff}}, /* HILITE_COLOR */ + /* ------------- DF_TEXT ----------- */ + {{0xff, 0xff}, /* DF_STD_COLOR */ + {0xff, 0xff}, /* DF_SELECT_COLOR */ + {0xff, 0xff}, /* DF_FRAME_COLOR */ + {0xff, 0xff}}, /* DF_HILITE_COLOR */ - /* ------------- RADIOBUTTON ----------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}}, /* HILITE_COLOR */ + /* ------------- DF_RADIOBUTTON ----------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}}, /* DF_HILITE_COLOR */ - /* ------------- CHECKBOX ----------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}}, /* HILITE_COLOR */ + /* ------------- DF_CHECKBOX ----------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}}, /* DF_HILITE_COLOR */ - /* ------------ SPINBUTTON ----------- */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ------------ DF_SPINBUTTON ----------- */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ----------- ERRORBOX ----------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}}, /* HILITE_COLOR */ + /* ----------- DF_ERRORBOX ----------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}}, /* DF_HILITE_COLOR */ - /* ----------- MESSAGEBOX --------- */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {BLACK, LIGHTGRAY}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {BLACK, LIGHTGRAY}},/* HILITE_COLOR */ + /* ----------- DF_MESSAGEBOX --------- */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ----------- HELPBOX ------------ */ - {{BLACK, LIGHTGRAY}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {BLACK, LIGHTGRAY}, /* FRAME_COLOR */ - {WHITE, LIGHTGRAY}},/* HILITE_COLOR */ + /* ----------- DF_HELPBOX ------------ */ + {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */ + {WHITE, LIGHTGRAY}},/* DF_HILITE_COLOR */ - /* ---------- STATUSBAR ------------- */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {LIGHTGRAY, BLACK}}, /* HILITE_COLOR */ + /* ---------- DF_STATUSBAR ------------- */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {LIGHTGRAY, BLACK}}, /* DF_HILITE_COLOR */ - /* ---------- TITLEBAR ------------ */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {LIGHTGRAY, BLACK}}, /* HILITE_COLOR */ + /* ---------- DF_TITLEBAR ------------ */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {LIGHTGRAY, BLACK}}, /* DF_HILITE_COLOR */ - /* ------------ DUMMY ------------- */ - {{LIGHTGRAY, BLACK}, /* STD_COLOR */ - {LIGHTGRAY, BLACK}, /* SELECT_COLOR */ - {LIGHTGRAY, BLACK}, /* FRAME_COLOR */ - {LIGHTGRAY, BLACK}} /* HILITE_COLOR */ + /* ------------ DF_DUMMY ------------- */ + {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */ + {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */ + {LIGHTGRAY, BLACK}} /* DF_HILITE_COLOR */ }; /* ------ default configuration values ------- */ -CONFIG cfg = { - VERSION, +DFCONFIG DfCfg = { + DF_VERSION, TRUE, /* Editor Insert Mode */ 4, /* Editor tab stops */ TRUE, /* Editor word wrap */ @@ -440,7 +440,7 @@ CONFIG cfg = { 55 /* Bottom printer margin */ }; -void BuildFileName(char *path, char *ext) +void DfBuildFileName(char *path, char *ext) { extern char **Argv; char *cp; @@ -455,32 +455,32 @@ void BuildFileName(char *path, char *ext) strcat(cp, ext); } -FILE *OpenConfig(char *mode) +FILE *DfOpenConfig(char *mode) { char path[64]; - BuildFileName(path, ".cfg"); + DfBuildFileName(path, ".DfCfg"); return fopen(path, mode); } /* ------ load a configuration file from disk ------- */ -BOOL LoadConfig(void) +BOOL DfLoadConfig(void) { static BOOL ConfigLoaded = FALSE; if (ConfigLoaded == FALSE) { - FILE *fp = OpenConfig("rb"); + FILE *fp = DfOpenConfig("rb"); if (fp != NULL) { - fread(cfg.version, sizeof cfg.version+1, 1, fp); - if (strcmp(cfg.version, VERSION) == 0) { + fread(DfCfg.version, sizeof DfCfg.version+1, 1, fp); + if (strcmp(DfCfg.version, DF_VERSION) == 0) { fseek(fp, 0L, SEEK_SET); - fread(&cfg, sizeof(CONFIG), 1, fp); + fread(&DfCfg, sizeof(DFCONFIG), 1, fp); fclose(fp); } else { char path[64]; - BuildFileName(path, ".cfg"); + DfBuildFileName(path, ".DfCfg"); fclose(fp); unlink(path); - strcpy(cfg.version, VERSION); + strcpy(DfCfg.version, DF_VERSION); } ConfigLoaded = TRUE; } @@ -489,26 +489,26 @@ BOOL LoadConfig(void) } /* ------ save a configuration file to disk ------- */ -void SaveConfig(void) +void DfSaveConfig(void) { - FILE *fp = OpenConfig("wb"); + FILE *fp = DfOpenConfig("wb"); if (fp != NULL) { - fwrite(&cfg, sizeof(CONFIG), 1, fp); + fwrite(&DfCfg, sizeof(DFCONFIG), 1, fp); fclose(fp); } } /* --------- set window colors --------- */ -void SetStandardColor(DFWINDOW wnd) +void DfSetStandardColor(DFWINDOW wnd) { - foreground = WndForeground(wnd); - background = WndBackground(wnd); + DfForeground = DfWndForeground(wnd); + DfBackground = DfWndBackground(wnd); } -void SetReverseColor(DFWINDOW wnd) +void DfSetReverseColor(DFWINDOW wnd) { - foreground = SelectForeground(wnd); - background = SelectBackground(wnd); + DfForeground = DfSelectForeground(wnd); + DfBackground = DfSelectBackground(wnd); } /* EOF */ diff --git a/rosapps/dflat32/config.h b/rosapps/dflat32/config.h index 065e197e598..5ed7b44f486 100644 --- a/rosapps/dflat32/config.h +++ b/rosapps/dflat32/config.h @@ -3,18 +3,18 @@ #ifndef CONFIG_H #define CONFIG_H -enum colortypes { - STD_COLOR, - SELECT_COLOR, - FRAME_COLOR, - HILITE_COLOR +enum DfColorTypes { + DF_STD_COLOR, + DF_SELECT_COLOR, + DF_FRAME_COLOR, + DF_HILITE_COLOR }; -enum grounds { FG, BG }; +enum DfGrounds { DF_FG, DF_BG }; /* ----------- configuration parameters ----------- */ -typedef struct config { - char version[sizeof VERSION]; +typedef struct DfConfig { + char version[sizeof DF_VERSION]; BOOL InsertMode; /* Editor insert mode */ int Tabs; /* Editor tab stops */ BOOL WordWrap; /* True to word wrap editor */ @@ -32,17 +32,17 @@ typedef struct config { int RightMargin; int TopMargin; int BottomMargin; - unsigned char clr[CLASSCOUNT] [4] [2]; /* Colors */ -} CONFIG; + unsigned char clr[DF_CLASSCOUNT] [4] [2]; /* Colors */ +} DFCONFIG; -extern CONFIG cfg; -extern unsigned char color[CLASSCOUNT] [4] [2]; -extern unsigned char bw[CLASSCOUNT] [4] [2]; -extern unsigned char reverse[CLASSCOUNT] [4] [2]; +extern DFCONFIG DfCfg; +extern unsigned char DfColor[DF_CLASSCOUNT] [4] [2]; +extern unsigned char DfBW[DF_CLASSCOUNT] [4] [2]; +extern unsigned char DfReverse[DF_CLASSCOUNT] [4] [2]; -BOOL LoadConfig(void); -void SaveConfig(void); -FILE *OpenConfig(char *); +BOOL DfLoadConfig(void); +void DfSaveConfig(void); +FILE *DfOpenConfig(char *); #endif diff --git a/rosapps/dflat32/console.c b/rosapps/dflat32/console.c index 9c638d1092e..53b9602183e 100644 --- a/rosapps/dflat32/console.c +++ b/rosapps/dflat32/console.c @@ -10,20 +10,20 @@ /* ----- table of alt keys for finding shortcut keys ----- */ #if 0 static int altconvert[] = { - ALT_A,ALT_B,ALT_C,ALT_D,ALT_E,ALT_F,ALT_G,ALT_H, - ALT_I,ALT_J,ALT_K,ALT_L,ALT_M,ALT_N,ALT_O,ALT_P, - ALT_Q,ALT_R,ALT_S,ALT_T,ALT_U,ALT_V,ALT_W,ALT_X, - ALT_Y,ALT_Z,ALT_0,ALT_1,ALT_2,ALT_3,ALT_4,ALT_5, - ALT_6,ALT_7,ALT_8,ALT_9 + DF_ALT_A,DF_ALT_B,DF_ALT_C,DF_ALT_D,DF_ALT_E,DF_ALT_F,DF_ALT_G,DF_ALT_H, + DF_ALT_I,DF_ALT_J,DF_ALT_K,DF_ALT_L,DF_ALT_M,DF_ALT_N,DF_ALT_O,DF_ALT_P, + DF_ALT_Q,DF_ALT_R,DF_ALT_S,DF_ALT_T,DF_ALT_U,DF_ALT_V,DF_ALT_W,DF_ALT_X, + DF_ALT_Y,DF_ALT_Z,DF_ALT_0,DF_ALT_1,DF_ALT_2,DF_ALT_3,DF_ALT_4,DF_ALT_5, + DF_ALT_6,DF_ALT_7,DF_ALT_8,DF_ALT_9 }; #endif -static COORD cursorpos[MAXSAVES]; -static CONSOLE_CURSOR_INFO cursorinfo[MAXSAVES]; +static COORD cursorpos[DF_MAXSAVES]; +static CONSOLE_CURSOR_INFO cursorinfo[DF_MAXSAVES]; static int cs = 0; -void SwapCursorStack(void) +void DfSwapCursorStack(void) { if (cs > 1) { @@ -48,17 +48,17 @@ void SwapCursorStack(void) /* ---- Read a keystroke ---- */ -void GetKey (PINPUT_RECORD lpBuffer) +void DfGetKey (PINPUT_RECORD lpBuffer) { - HANDLE hInput; + HANDLE DfInput; DWORD dwRead; - hInput = GetStdHandle (STD_INPUT_HANDLE); + DfInput = GetStdHandle (STD_INPUT_HANDLE); do { -// WaitForSingleObject (hInput, INFINITE); - ReadConsoleInput (hInput, lpBuffer, 1, &dwRead); +// WaitForSingleObject (DfInput, INFINITE); + ReadConsoleInput (DfInput, lpBuffer, 1, &dwRead); if ((lpBuffer->EventType == KEY_EVENT) && (lpBuffer->Event.KeyEvent.bKeyDown == TRUE)) break; @@ -69,7 +69,7 @@ void GetKey (PINPUT_RECORD lpBuffer) /* ---------- read the keyboard shift status --------- */ -int getshift(void) +int DfGetShift(void) { // regs.h.ah = 2; // int86(KEYBRD, ®s, ®s); @@ -81,15 +81,15 @@ int getshift(void) /* -------- sound a buzz tone ---------- */ -void beep(void) +void DfBeep(void) { Beep(440, 50); // MessageBeep (-1); } -/* ------ position the cursor ------ */ -void cursor(int x, int y) +/* ------ position the DfCursor ------ */ +void DfCursor(int x, int y) { COORD coPos; @@ -99,8 +99,8 @@ void cursor(int x, int y) } -/* ------- get the current cursor position ------- */ -void curr_cursor(int *x, int *y) +/* ------- get the current DfCursor position ------- */ +void DfCurrCursor(int *x, int *y) //VOID GetCursorXY (PSHORT x, PSHORT y) { CONSOLE_SCREEN_BUFFER_INFO csbi; @@ -112,10 +112,10 @@ void curr_cursor(int *x, int *y) } -/* ------ save the current cursor configuration ------ */ -void savecursor(void) +/* ------ save the current DfCursor configuration ------ */ +void DfSaveCursor(void) { - if (cs < MAXSAVES) + if (cs < DF_MAXSAVES) { CONSOLE_SCREEN_BUFFER_INFO csbi; @@ -130,8 +130,8 @@ void savecursor(void) } } -/* ---- restore the saved cursor configuration ---- */ -void restorecursor(void) +/* ---- restore the saved DfCursor configuration ---- */ +void DfRestoreCursor(void) { if (cs) { @@ -143,8 +143,8 @@ void restorecursor(void) } } -/* ------ make a normal cursor ------ */ -void normalcursor(void) +/* ------ make a normal DfCursor ------ */ +void DfNormalCursor(void) { CONSOLE_CURSOR_INFO csi; @@ -154,8 +154,8 @@ void normalcursor(void) &csi); } -/* ------ hide the cursor ------ */ -void hidecursor(void) +/* ------ hide the DfCursor ------ */ +void DfHideCursor(void) { CONSOLE_CURSOR_INFO csi; @@ -166,8 +166,8 @@ void hidecursor(void) &csi); } -/* ------ unhide the cursor ------ */ -void unhidecursor(void) +/* ------ unhide the DfCursor ------ */ +void DfUnhideCursor(void) { CONSOLE_CURSOR_INFO csi; @@ -178,8 +178,8 @@ void unhidecursor(void) &csi); } -/* set the cursor size (in percent) */ -void set_cursor_size (unsigned t) +/* set the DfCursor size (in percent) */ +void DfSetCursorSize (unsigned t) { CONSOLE_CURSOR_INFO csi; @@ -198,7 +198,7 @@ void set_cursor_size (unsigned t) /* ------ convert an Alt+ key to its letter equivalent ----- */ -int AltConvert(int c) +int DfAltConvert(int c) { return c; #if 0 diff --git a/rosapps/dflat32/decomp.c b/rosapps/dflat32/decomp.c index 9660107ea63..85e9f5c67d0 100644 --- a/rosapps/dflat32/decomp.c +++ b/rosapps/dflat32/decomp.c @@ -12,20 +12,20 @@ static int in8; static int ct8 = 8; static FILE *fi; -static BYTECOUNTER bytectr; +static DF_BYTECOUNTER bytectr; static int LoadingASCII; -struct htr *HelpTree; +struct DfHTr *DfHelpTree; static int root; /* ------- open the help database file -------- */ -FILE *OpenHelpFile(void) +FILE *DfOpenHelpFile(void) { char *cp; int treect, i; char helpname[65]; /* -------- get the name of the help file ---------- */ - BuildFileName(helpname, ".hlp"); + DfBuildFileName(helpname, ".hlp"); LoadingASCII = FALSE; if ((fi = fopen(helpname, "rb")) == NULL) { /* ---- no .hlp file, look for .txt file ---- */ @@ -38,25 +38,25 @@ FILE *OpenHelpFile(void) LoadingASCII = TRUE; } - if (!LoadingASCII && HelpTree == NULL) { + if (!LoadingASCII && DfHelpTree == NULL) { /* ----- read the byte count ------ */ fread(&bytectr, sizeof bytectr, 1, fi); /* ----- read the frequency count ------ */ fread(&treect, sizeof treect, 1, fi); /* ----- read the root offset ------ */ fread(&root, sizeof root, 1, fi); - HelpTree = DFcalloc(treect-256, sizeof(struct htr)); + DfHelpTree = DfCalloc(treect-256, sizeof(struct DfHTr)); /* ---- read in the tree --- */ for (i = 0; i < treect-256; i++) { - fread(&HelpTree[i].left, sizeof(int), 1, fi); - fread(&HelpTree[i].right, sizeof(int), 1, fi); + fread(&DfHelpTree[i].left, sizeof(int), 1, fi); + fread(&DfHelpTree[i].right, sizeof(int), 1, fi); } } return fi; } /* ----- read a line of text from the help database ----- */ -void *GetHelpLine(char *line) +void *DfGetHelpLine(char *line) { int h; if (LoadingASCII) { @@ -83,9 +83,9 @@ void *GetHelpLine(char *line) } /* -- point to left or right node based on msb -- */ if (in8 & 0x80) - h = HelpTree[h-256].left; + h = DfHelpTree[h-256].left; else - h = HelpTree[h-256].right; + h = DfHelpTree[h-256].right; /* --- shift the next bit in --- */ in8 <<= 1; ct8++; @@ -104,7 +104,7 @@ void *GetHelpLine(char *line) } /* --- compute the database file byte and bit position --- */ -void HelpFilePosition(long *offset, int *bit) +void DfHelpFilePosition(long *offset, int *bit) { *offset = ftell(fi); if (LoadingASCII) @@ -117,7 +117,7 @@ void HelpFilePosition(long *offset, int *bit) } /* -- position the database to the specified byte and bit -- */ -void SeekHelpLine(long offset, int bit) +void DfSeekHelpLine(long offset, int bit) { int i; fseek(fi, offset, 0); diff --git a/rosapps/dflat32/dfalloc.c b/rosapps/dflat32/dfalloc.c index f34b2a62982..6c3163d6d4a 100644 --- a/rosapps/dflat32/dfalloc.c +++ b/rosapps/dflat32/dfalloc.c @@ -24,24 +24,24 @@ static void AllocationError(void) { OnceIn = TRUE; /* ------ close all windows ------ */ - DfSendMessage(ApplicationWindow, CLOSE_WINDOW, 0, 0); - GetVideo(rc, savbuf); + DfSendMessage(DfApplicationWindow, DFM_CLOSE_WINDOW, 0, 0); + DfGetVideo(rc, savbuf); for (x = 0; x < 18; x++) { for (y = 0; y < 3; y++) { int c = (255 & (*(*(ErrMsg+y)+x))) | 0x7000; - PutVideoChar(x+rc.lf, y+rc.tp, c); + DfPutVideoChar(x+rc.lf, y+rc.tp, c); } } - GetKey(&ir); - StoreVideo(rc, savbuf); + DfGetKey(&ir); + DfStoreVideo(rc, savbuf); if (AllocTesting) longjmp(AllocError, 1); } } -void *DFcalloc(size_t nitems, size_t size) +void *DfCalloc(size_t nitems, size_t size) { void *rtn = calloc(nitems, size); if (size && rtn == NULL) @@ -49,7 +49,7 @@ void *DFcalloc(size_t nitems, size_t size) return rtn; } -void *DFmalloc(size_t size) +void *DfMalloc(size_t size) { void *rtn = malloc(size); if (size && rtn == NULL) @@ -57,7 +57,7 @@ void *DFmalloc(size_t size) return rtn; } -void *DFrealloc(void *block, size_t size) +void *DfRealloc(void *block, size_t size) { void *rtn; diff --git a/rosapps/dflat32/dflat.h b/rosapps/dflat32/dflat.h index f030e25fda1..e12f6b978f9 100644 --- a/rosapps/dflat32/dflat.h +++ b/rosapps/dflat32/dflat.h @@ -28,24 +28,24 @@ #include #include -#ifndef VERSION -#define VERSION "Beta Version 0.3" +#ifndef DF_VERSION +#define DF_VERSION "Beta Version 0.3" #endif -void *DFcalloc(size_t, size_t); -void *DFmalloc(size_t); -void *DFrealloc(void *, size_t); +void *DfCalloc(size_t, size_t); +void *DfMalloc(size_t); +void *DfRealloc(void *, size_t); -#define MAXMESSAGES 50 -#define DELAYTICKS 1 -#define FIRSTDELAY 7 -#define DOUBLETICKS 5 +#define DF_MAXMESSAGES 50 +#define DF_DELAYTICKS 1 +#define DF_FIRSTDELAY 7 +#define DF_DOUBLETICKS 5 -#define MAXTEXTLEN 65000U /* maximum text buffer */ -#define EDITLEN 1024 /* starting length for multiliner */ -#define ENTRYLEN 256 /* starting length for one-liner */ -#define GROWLENGTH 64 /* buffers grow by this much */ +#define DF_MAXTEXTLEN 65000U /* maximum text buffer */ +#define DF_EDITLEN 1024 /* starting length for multiliner */ +#define DF_ENTRYLEN 256 /* starting length for one-liner */ +#define DF_GROWLENGTH 64 /* buffers grow by this much */ #include "system.h" #include "config.h" @@ -56,18 +56,18 @@ void *DFrealloc(void *, size_t); #include "dialbox.h" /* ------ integer type for message parameters ----- */ -typedef long PARAM; +typedef long DF_PARAM; -enum Condition +enum DfCondition { - ISRESTORED, ISMINIMIZED, ISMAXIMIZED, ISCLOSING + DF_SRESTORED, DF_ISMINIMIZED, DF_ISMAXIMIZED, DF_ISCLOSING }; -typedef struct window +typedef struct DfWindow { DFCLASS class; /* window class */ char *title; /* window title */ - int (*wndproc)(struct window *, enum messages, PARAM, PARAM); + int (*wndproc)(struct DfWindow *, enum DfMessages, DF_PARAM, DF_PARAM); /* ----------------- window colors -------------------- */ char WindowColors[4][2]; @@ -78,24 +78,24 @@ typedef struct window DFRECT RestoredRC; /* restored condition rect */ /* -------------- linked list pointers ---------------- */ - struct window *parent; /* parent window */ - struct window *firstchild; /* first child this parent */ - struct window *lastchild; /* last child this parent */ - struct window *nextsibling; /* next sibling */ - struct window *prevsibling; /* previous sibling */ - struct window *childfocus; /* child that ha(s/d) focus */ + struct DfWindow *parent; /* parent window */ + struct DfWindow *firstchild; /* first child this parent */ + struct DfWindow *lastchild; /* last child this parent */ + struct DfWindow *nextsibling; /* next sibling */ + struct DfWindow *prevsibling; /* previous sibling */ + struct DfWindow *childfocus; /* child that ha(s/d) focus */ int attrib; /* Window attributes */ PCHAR_INFO videosave; /* video save buffer */ - enum Condition condition; /* Restored, Maximized, + enum DfCondition condition; /* Restored, Maximized, Minimized, Closing */ - enum Condition oldcondition;/* previous condition */ + enum DfCondition oldcondition;/* previous condition */ int restored_attrib; /* attributes when restored */ void *extension; /* menus, dialogs, documents, etc */ - struct window *PrevMouse; - struct window *PrevKeyboard; - struct window *MenuBarWnd;/* menu bar */ - struct window *StatusBar; /* status bar */ + struct DfWindow *PrevMouse; + struct DfWindow *PrevKeyboard; + struct DfWindow *MenuBarWnd;/* menu bar */ + struct DfWindow *StatusBar; /* status bar */ int isHelping; /* > 0 when help is being displayed */ /* ----------------- text box fields ------------------ */ @@ -133,12 +133,12 @@ typedef struct window /* ---------------- dialog box fields ----------------- */ int ReturnCode; /* return code from a dialog box */ BOOL Modal; /* True if a modeless dialog box */ - CTLWINDOW *ct; /* control structure */ - struct window *dfocus; /* control window that has focus */ + DF_CTLWINDOW *ct; /* control structure */ + struct DfWindow *dfocus; /* control window that has focus */ /* -------------- popdownmenu fields ------------------ */ - MENU *mnu; /* points to menu structure */ - MBAR *holdmenu; /* previous active menu */ - struct window *oldFocus; + DF_MENU *mnu; /* points to menu structure */ + DF_MBAR *holdmenu; /* previous active menu */ + struct DfWindow *oldFocus; /* --------------- help box fields -------------------- */ void *firstword; /* -> first in list of key words */ @@ -156,332 +156,332 @@ typedef struct window #include "classdef.h" #include "video.h" -void LogMessages (DFWINDOW, DFMESSAGE, PARAM, PARAM); -void MessageLog(DFWINDOW); +void DfLogMessages (DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +void DfMessageLog(DFWINDOW); /* ------- window methods ----------- */ -#define ICONHEIGHT 3 -#define ICONWIDTH 10 -#define WindowHeight(w) ((w)->ht) -#define WindowWidth(w) ((w)->wd) -#define BorderAdj(w) (TestAttribute(w,HASBORDER)?1:0) -#define BottomBorderAdj(w) (TestAttribute(w,HASSTATUSBAR)?1:BorderAdj(w)) -#define TopBorderAdj(w) ((TestAttribute(w,HASTITLEBAR) && \ - TestAttribute(w,HASMENUBAR)) ? \ - 2 : (TestAttribute(w,HASTITLEBAR | \ - HASMENUBAR | HASBORDER) ? 1 : 0)) -#define ClientWidth(w) (WindowWidth(w)-BorderAdj(w)*2) -#define ClientHeight(w) (WindowHeight(w)-TopBorderAdj(w)-\ - BottomBorderAdj(w)) -#define WindowRect(w) ((w)->rc) -#define GetTop(w) (RectTop(WindowRect(w))) -#define GetBottom(w) (RectBottom(WindowRect(w))) -#define GetLeft(w) (RectLeft(WindowRect(w))) -#define GetRight(w) (RectRight(WindowRect(w))) -#define GetClientTop(w) (GetTop(w)+TopBorderAdj(w)) -#define GetClientBottom(w) (GetBottom(w)-BottomBorderAdj(w)) -#define GetClientLeft(w) (GetLeft(w)+BorderAdj(w)) -#define GetClientRight(w) (GetRight(w)-BorderAdj(w)) -#define GetTitle(w) ((w)->title) -#define GetParent(w) ((w)->parent) -#define FirstWindow(w) ((w)->firstchild) -#define LastWindow(w) ((w)->lastchild) -#define NextWindow(w) ((w)->nextsibling) -#define PrevWindow(w) ((w)->prevsibling) -#define GetClass(w) ((w)->class) -#define GetAttribute(w) ((w)->attrib) -#define AddAttribute(w,a) (GetAttribute(w) |= a) -#define ClearAttribute(w,a) (GetAttribute(w) &= ~(a)) -#define TestAttribute(w,a) (GetAttribute(w) & (a)) -#define isHidden(w) (!(GetAttribute(w) & VISIBLE)) -#define SetVisible(w) (GetAttribute(w) |= VISIBLE) -#define ClearVisible(w) (GetAttribute(w) &= ~VISIBLE) -#define gotoxy(w,x,y) cursor(w->rc.lf+(x)+1,w->rc.tp+(y)+1) -BOOL isVisible(DFWINDOW); -DFWINDOW DfCreateWindow(DFCLASS,char *,int,int,int,int,void*,DFWINDOW, - int (*)(struct window *,enum messages,PARAM,PARAM),int); -void AddTitle(DFWINDOW, char *); -void InsertTitle(DFWINDOW, char *); -void DisplayTitle(DFWINDOW, DFRECT *); -void RepaintBorder(DFWINDOW, DFRECT *); -void PaintShadow(DFWINDOW); -void ClearWindow(DFWINDOW, DFRECT *, int); -void writeline(DFWINDOW, char *, int, int, BOOL); -void InitWindowColors(DFWINDOW); +#define DF_ICONHEIGHT 3 +#define DF_ICONWIDTH 10 +#define DfWindowHeight(w) ((w)->ht) +#define DfWindowWidth(w) ((w)->wd) +#define DfBorderAdj(w) (DfTestAttribute(w,DF_HASBORDER)?1:0) +#define DfBottomBorderAdj(w) (DfTestAttribute(w,DF_HASSTATUSBAR)?1:DfBorderAdj(w)) +#define DfTopBorderAdj(w) ((DfTestAttribute(w,DF_HASTITLEBAR) && \ + DfTestAttribute(w,DF_HASMENUBAR)) ? \ + 2 : (DfTestAttribute(w,DF_HASTITLEBAR | \ + DF_HASMENUBAR | DF_HASBORDER) ? 1 : 0)) +#define DfClientWidth(w) (DfWindowWidth(w)-DfBorderAdj(w)*2) +#define DfClientHeight(w) (DfWindowHeight(w)-DfTopBorderAdj(w)-\ + DfBottomBorderAdj(w)) +#define DfWindowRect(w) ((w)->rc) +#define DfGetTop(w) (DfRectTop(DfWindowRect(w))) +#define DfGetBottom(w) (DfRectBottom(DfWindowRect(w))) +#define DfGetLeft(w) (DfRectLeft(DfWindowRect(w))) +#define DfGetRight(w) (DfRectRight(DfWindowRect(w))) +#define DfGetClientTop(w) (DfGetTop(w)+DfTopBorderAdj(w)) +#define DfGetClientBottom(w) (DfGetBottom(w)-DfBottomBorderAdj(w)) +#define DfGetClientLeft(w) (DfGetLeft(w)+DfBorderAdj(w)) +#define DfGetClientRight(w) (DfGetRight(w)-DfBorderAdj(w)) +#define DfGetTitle(w) ((w)->title) +#define DfGetParent(w) ((w)->parent) +#define DfFirstWindow(w) ((w)->firstchild) +#define DfLastWindow(w) ((w)->lastchild) +#define DfNextWindow(w) ((w)->nextsibling) +#define DfPrevWindow(w) ((w)->prevsibling) +#define DfGetClass(w) ((w)->class) +#define DfGetAttribute(w) ((w)->attrib) +#define DfAddAttribute(w,a) (DfGetAttribute(w) |= a) +#define DfClearAttribute(w,a) (DfGetAttribute(w) &= ~(a)) +#define DfTestAttribute(w,a) (DfGetAttribute(w) & (a)) +#define isHidden(w) (!(DfGetAttribute(w) & DF_VISIBLE)) +#define DfSetVisible(w) (DfGetAttribute(w) |= DF_VISIBLE) +#define DfClearVisible(w) (DfGetAttribute(w) &= ~DF_VISIBLE) +#define DfGotoXY(w,x,y) DfCursor(w->rc.lf+(x)+1,w->rc.tp+(y)+1) +BOOL DfIsVisible(DFWINDOW); +DFWINDOW DfDfCreateWindow(DFCLASS,char *,int,int,int,int,void*,DFWINDOW, + int (*)(struct DfWindow *,enum DfMessages,DF_PARAM,DF_PARAM),int); +void DfAddTitle(DFWINDOW, char *); +void DfInsertTitle(DFWINDOW, char *); +void DfDisplayTitle(DFWINDOW, DFRECT *); +void DfRepaintBorder(DFWINDOW, DFRECT *); +void DfPaintShadow(DFWINDOW); +void DfClearWindow(DFWINDOW, DFRECT *, int); +void DfWriteLine(DFWINDOW, char *, int, int, BOOL); +void DfInitWindowColors(DFWINDOW); -void SetNextFocus(void); -void SetPrevFocus(void); -void RemoveWindow(DFWINDOW); -void AppendWindow(DFWINDOW); -void ReFocus(DFWINDOW); -void SkipApplicationControls(void); +void DfSetNextFocus(void); +void DfSetPrevFocus(void); +void DfRemoveWindow(DFWINDOW); +void DfAppendWindow(DFWINDOW); +void DfReFocus(DFWINDOW); +void DfSkipApplicationControls(void); -BOOL CharInView(DFWINDOW, int, int); -void CreatePath(char *, char *, int, int); -#define SwapVideoBuffer(wnd, ish, fh) swapvideo(wnd, wnd->videosave, ish, fh) -int LineLength(char *); -DFRECT AdjustRectangle(DFWINDOW, DFRECT); -BOOL isDerivedFrom(DFWINDOW, DFCLASS); -DFWINDOW GetAncestor(DFWINDOW); -void PutWindowChar(DFWINDOW,char,int,int); -void PutWindowLine(DFWINDOW, void *,int,int); -#define BaseWndProc(class,wnd,msg,p1,p2) \ - (*classdefs[(classdefs[class].base)].wndproc)(wnd,msg,p1,p2) -#define DefaultWndProc(wnd,msg,p1,p2) \ - (classdefs[wnd->class].wndproc == NULL) ? \ - BaseWndProc(wnd->class,wnd,msg,p1,p2) : \ - (*classdefs[wnd->class].wndproc)(wnd,msg,p1,p2) -struct LinkedList { - DFWINDOW FirstWindow; - DFWINDOW LastWindow; +BOOL DfCharInView(DFWINDOW, int, int); +void DfCreatePath(char *, char *, int, int); +#define DfSwapVideoBuffer(wnd, ish, fh) swapvideo(wnd, wnd->videosave, ish, fh) +int DfLineLength(char *); +DFRECT DfAdjustRectangle(DFWINDOW, DFRECT); +BOOL DfIsDerivedFrom(DFWINDOW, DFCLASS); +DFWINDOW DfGetAncestor(DFWINDOW); +void DfPutWindowChar(DFWINDOW,char,int,int); +void DfPutWindowLine(DFWINDOW, void *,int,int); +#define DfBaseWndProc(class,wnd,msg,p1,p2) \ + (*DfClassDefs[(DfClassDefs[class].base)].wndproc)(wnd,msg,p1,p2) +#define DfDefaultWndProc(wnd,msg,p1,p2) \ + (DfClassDefs[wnd->class].wndproc == NULL) ? \ + DfBaseWndProc(wnd->class,wnd,msg,p1,p2) : \ + (*DfClassDefs[wnd->class].wndproc)(wnd,msg,p1,p2) +struct DfLinkedList { + DFWINDOW DfFirstWindow; + DFWINDOW DfLastWindow; }; -extern DFWINDOW ApplicationWindow; -extern DFWINDOW inFocus; -extern DFWINDOW CaptureMouse; -extern DFWINDOW CaptureKeyboard; -extern int foreground, background; -extern BOOL WindowMoving; -extern BOOL WindowSizing; -extern BOOL VSliding; -extern BOOL HSliding; +extern DFWINDOW DfApplicationWindow; +extern DFWINDOW DfInFocus; +extern DFWINDOW DfCaptureMouse; +extern DFWINDOW DfCaptureKeyboard; +extern int DfForeground, DfBackground; +extern BOOL DfWindowMoving; +extern BOOL DfWindowSizing; +extern BOOL DfVSliding; +extern BOOL DfHSliding; extern char DFlatApplication[]; -extern char *Clipboard; -extern unsigned ClipboardLength; -extern BOOL ClipString; +extern char *DfClipboard; +extern unsigned DfClipboardLength; +extern BOOL DfClipString; /* --------- space between menubar labels --------- */ -#define MSPACE 2 +#define DF_MSPACE 2 /* --------------- border characters ------------- */ -#define FOCUS_NW (unsigned char) '\xc9' -#define FOCUS_NE (unsigned char) '\xbb' -#define FOCUS_SE (unsigned char) '\xbc' -#define FOCUS_SW (unsigned char) '\xc8' -#define FOCUS_SIDE (unsigned char) '\xba' -#define FOCUS_LINE (unsigned char) '\xcd' -#define NW (unsigned char) '\xda' -#define NE (unsigned char) '\xbf' -#define SE (unsigned char) '\xd9' -#define SW (unsigned char) '\xc0' -#define SIDE (unsigned char) '\xb3' -#define LINE (unsigned char) '\xc4' -#define LEDGE (unsigned char) '\xc3' -#define REDGE (unsigned char) '\xb4' +#define DF_FOCUS_NW (unsigned char) '\xc9' +#define DF_FOCUS_NE (unsigned char) '\xbb' +#define DF_FOCUS_SE (unsigned char) '\xbc' +#define DF_FOCUS_SW (unsigned char) '\xc8' +#define DF_FOCUS_SIDE (unsigned char) '\xba' +#define DF_FOCUS_LINE (unsigned char) '\xcd' +#define DF_NW (unsigned char) '\xda' +#define DF_NE (unsigned char) '\xbf' +#define DF_SE (unsigned char) '\xd9' +#define DF_SW (unsigned char) '\xc0' +#define DF_SIDE (unsigned char) '\xb3' +#define DF_LINE (unsigned char) '\xc4' +#define DF_LEDGE (unsigned char) '\xc3' +#define DF_REDGE (unsigned char) '\xb4' /* ------------- scroll bar characters ------------ */ -#define UPSCROLLBOX (unsigned char) '\x1e' -#define DOWNSCROLLBOX (unsigned char) '\x1f' -#define LEFTSCROLLBOX (unsigned char) '\x11' -#define RIGHTSCROLLBOX (unsigned char) '\x10' -#define SCROLLBARCHAR (unsigned char) 176 -#define SCROLLBOXCHAR (unsigned char) 178 +#define DF_UPSCROLLBOX (unsigned char) '\x1e' +#define DF_DOWNSCROLLBOX (unsigned char) '\x1f' +#define DF_LEFTSCROLLBOX (unsigned char) '\x11' +#define DF_RIGHTSCROLLBOX (unsigned char) '\x10' +#define DF_SCROLLBARCHAR (unsigned char) 176 +#define DF_SCROLLBOXCHAR (unsigned char) 178 /* ------------------ menu characters --------------------- */ -#define CHECKMARK (unsigned char) '\x04' //(SCREENHEIGHT==25?251:4) -#define CASCADEPOINTER (unsigned char) '\x10' +#define DF_CHECKMARK (unsigned char) '\x04' //(DF_SCREENHEIGHT==25?251:4) +#define DF_CASCADEPOINTER (unsigned char) '\x10' /* ----------------- title bar characters ----------------- */ -#define CONTROLBOXCHAR (unsigned char) '\xf0' -#define MAXPOINTER 24 /* maximize token */ -#define MINPOINTER 25 /* minimize token */ -#define RESTOREPOINTER 18 /* restore token */ +#define DF_CONTROLBOXCHAR (unsigned char) '\xf0' +#define DF_MAXPOINTER 24 /* maximize token */ +#define DF_MINPOINTER 25 /* minimize token */ +#define DF_RESTOREPOINTER 18 /* restore token */ /* --------------- text control characters ---------------- */ -#define APPLCHAR (unsigned char) 176 /* fills application window */ -#define SHORTCUTCHAR '~' /* prefix: shortcut key display */ -#define CHANGECOLOR (unsigned char) 174 /* prefix to change colors */ -#define RESETCOLOR (unsigned char) 175 /* reset colors to default */ -#define LISTSELECTOR 4 /* selected list box entry */ +#define DF_APPLCHAR (unsigned char) 176 /* fills application window */ +#define DF_SHORTCUTCHAR '~' /* prefix: shortcut key display */ +#define DF_CHANGECOLOR (unsigned char) 174 /* prefix to change colors */ +#define DF_RESETCOLOR (unsigned char) 175 /* reset colors to default */ +#define DF_LISTSELECTOR 4 /* selected list box entry */ /* --------- message prototypes ----------- */ BOOL DfInitialize (void); void DfTerminate (void); -void DfPostMessage (DFWINDOW, DFMESSAGE, PARAM, PARAM); -int DfSendMessage (DFWINDOW, DFMESSAGE, PARAM, PARAM); +void DfPostMessage (DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfSendMessage (DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); BOOL DfDispatchMessage (void); -void handshake(void); +void DfHandshake(void); SHORT DfGetScreenHeight (void); SHORT DfGetScreenWidth (void); /* ---- standard window message processing prototypes ----- */ -int ApplicationProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int NormalProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int TextBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int ListBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int EditBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int PictureProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int MenuBarProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int PopDownProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int ButtonProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int ComboProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int TextProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int RadioButtonProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int CheckBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int SpinButtonProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int BoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int DialogProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int SystemMenuProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int HelpBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int MessageBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int CancelBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int ErrorBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int YesNoBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int StatusBarProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -int WatchIconProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); +int DfApplicationProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfNormalProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfTextBoxProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfListBoxProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfEditBoxProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfPictureProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfMenuBarProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfPopDownProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfButtonProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfComboProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfTextProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfRadioButtonProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfCheckBoxProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfSpinButtonProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfBoxProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfDialogProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfSystemMenuProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfHelpBoxProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfMessageBoxProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfCancelBoxProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfErrorBoxProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfYesNoBoxProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfStatusBarProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +int DfWatchIconProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); /* ------------- normal box prototypes ------------- */ -void SetStandardColor(DFWINDOW); -void SetReverseColor(DFWINDOW); -BOOL isAncestor(DFWINDOW, DFWINDOW); -#define HitControlBox(wnd, p1, p2) \ - (TestAttribute(wnd, CONTROLBOX) && \ +void DfSetStandardColor(DFWINDOW); +void DfSetReverseColor(DFWINDOW); +BOOL DfIsAncestor(DFWINDOW, DFWINDOW); +#define DfHitControlBox(wnd, p1, p2) \ + (DfTestAttribute(wnd, DF_CONTROLBOX) && \ p1 == 2 && p2 == 0) -#define WndForeground(wnd) \ - (wnd->WindowColors [STD_COLOR] [FG]) -#define WndBackground(wnd) \ - (wnd->WindowColors [STD_COLOR] [BG]) -#define FrameForeground(wnd) \ - (wnd->WindowColors [FRAME_COLOR] [FG]) -#define FrameBackground(wnd) \ - (wnd->WindowColors [FRAME_COLOR] [BG]) -#define SelectForeground(wnd) \ - (wnd->WindowColors [SELECT_COLOR] [FG]) -#define SelectBackground(wnd) \ - (wnd->WindowColors [SELECT_COLOR] [BG]) -#define HighlightForeground(wnd) \ - (wnd->WindowColors [HILITE_COLOR] [FG]) -#define HighlightBackground(wnd) \ - (wnd->WindowColors [HILITE_COLOR] [BG]) -#define WindowClientColor(wnd, fg, bg) \ - WndForeground(wnd) = fg, WndBackground(wnd) = bg -#define WindowReverseColor(wnd, fg, bg) \ - SelectForeground(wnd) = fg, SelectBackground(wnd) = bg -#define WindowFrameColor(wnd, fg, bg) \ - FrameForeground(wnd) = fg, FrameBackground(wnd) = bg -#define WindowHighlightColor(wnd, fg, bg) \ - HighlightForeground(wnd) = fg, HighlightBackground(wnd) = bg +#define DfWndForeground(wnd) \ + (wnd->WindowColors [DF_STD_COLOR] [DF_FG]) +#define DfWndBackground(wnd) \ + (wnd->WindowColors [DF_STD_COLOR] [DF_BG]) +#define DfFrameForeground(wnd) \ + (wnd->WindowColors [DF_FRAME_COLOR] [DF_FG]) +#define DfFrameBackground(wnd) \ + (wnd->WindowColors [DF_FRAME_COLOR] [DF_BG]) +#define DfSelectForeground(wnd) \ + (wnd->WindowColors [DF_SELECT_COLOR] [DF_FG]) +#define DfSelectBackground(wnd) \ + (wnd->WindowColors [DF_SELECT_COLOR] [DF_BG]) +#define DfHighlightForeground(wnd) \ + (wnd->WindowColors [DF_HILITE_COLOR] [DF_FG]) +#define DfHighlightBackground(wnd) \ + (wnd->WindowColors [DF_HILITE_COLOR] [DF_BG]) +#define DfWindowClientColor(wnd, fg, bg) \ + DfWndForeground(wnd) = fg, DfWndBackground(wnd) = bg +#define DfWindowReverseColor(wnd, fg, bg) \ + DfSelectForeground(wnd) = fg, DfSelectBackground(wnd) = bg +#define DfWindowFrameColor(wnd, fg, bg) \ + DfFrameForeground(wnd) = fg, DfFrameBackground(wnd) = bg +#define DfWindowHighlightColor(wnd, fg, bg) \ + DfHighlightForeground(wnd) = fg, DfHighlightBackground(wnd) = bg /* -------- text box prototypes ---------- */ -#define TextLine(wnd, sel) \ +#define DfTextLine(wnd, sel) \ (wnd->text + *((wnd->TextPointers) + sel)) -void WriteTextLine(DFWINDOW, DFRECT *, int, BOOL); -#define TextBlockMarked(wnd) ( wnd->BlkBegLine || \ +void DfWriteTextLine(DFWINDOW, DFRECT *, int, BOOL); +#define DfTextBlockMarked(wnd) ( wnd->BlkBegLine || \ wnd->BlkEndLine || \ wnd->BlkBegCol || \ wnd->BlkEndCol) -void MarkTextBlock(DFWINDOW, int, int, int, int); -#define ClearTextBlock(wnd) wnd->BlkBegLine = wnd->BlkEndLine = \ +void DfMarkTextBlock(DFWINDOW, int, int, int, int); +#define DfClearTextBlock(wnd) wnd->BlkBegLine = wnd->BlkEndLine = \ wnd->BlkBegCol = wnd->BlkEndCol = 0; -#define GetText(w) ((w)->text) -#define GetTextLines(w) ((w)->wlines) -void ClearTextPointers(DFWINDOW); -void BuildTextPointers(DFWINDOW); -int TextLineNumber(DFWINDOW, char *); -/* ------------ Clipboard prototypes ------------- */ -void CopyTextToClipboard(char *); -void CopyToClipboard(DFWINDOW); -#define PasteFromClipboard(wnd) PasteText(wnd,Clipboard,ClipboardLength) -BOOL PasteText(DFWINDOW, char *, unsigned); -void ClearClipboard(void); +#define DfGetText(w) ((w)->text) +#define DfGetTextLines(w) ((w)->wlines) +void DfClearTextPointers(DFWINDOW); +void DfBuildTextPointers(DFWINDOW); +int DfTextLineNumber(DFWINDOW, char *); +/* ------------ DfClipboard prototypes ------------- */ +void DfCopyTextToClipboard(char *); +void DfCopyToClipboard(DFWINDOW); +#define DfPasteFromClipboard(wnd) DfPasteText(wnd,DfClipboard,DfClipboardLength) +BOOL DfPasteText(DFWINDOW, char *, unsigned); +void DfClearClipboard(void); /* --------- menu prototypes ---------- */ -int CopyCommand(unsigned char *, unsigned char *, int, int); -void PrepFileMenu(void *, struct Menu *); -void PrepEditMenu(void *, struct Menu *); -void PrepSearchMenu(void *, struct Menu *); -void PrepWindowMenu(void *, struct Menu *); -void BuildSystemMenu(DFWINDOW); -BOOL isActive(MBAR *, int); -char *GetCommandText(MBAR *, int); -BOOL isCascadedCommand(MBAR *,int); -void ActivateCommand(MBAR *,int); -void DeactivateCommand(MBAR *,int); -BOOL GetCommandToggle(MBAR *,int); -void SetCommandToggle(MBAR *,int); -void ClearCommandToggle(MBAR *,int); -void InvertCommandToggle(MBAR *,int); -int BarSelection(int); +int DfCopyCommand(unsigned char *, unsigned char *, int, int); +void DfPrepFileMenu(void *, struct DfMenu *); +void DfPrepEditMenu(void *, struct DfMenu *); +void DfPrepSearchMenu(void *, struct DfMenu *); +void DfPrepWindowMenu(void *, struct DfMenu *); +void DfBuildSystemMenu(DFWINDOW); +BOOL isActive(DF_MBAR *, int); +char *DfGetCommandText(DF_MBAR *, int); +BOOL DfIsCascadedCommand(DF_MBAR *,int); +void DfActivateCommand(DF_MBAR *,int); +void DfDeactivateCommand(DF_MBAR *,int); +BOOL DfGetCommandToggle(DF_MBAR *,int); +void DfSetCommandToggle(DF_MBAR *,int); +void DfClearCommandToggle(DF_MBAR *,int); +void DfInvertCommandToggle(DF_MBAR *,int); +int DfBarSelection(int); /* ------------- list box prototypes -------------- */ -BOOL ItemSelected(DFWINDOW, int); +BOOL DfItemSelected(DFWINDOW, int); /* ------------- edit box prototypes ----------- */ -#define CurrChar (TextLine(wnd, wnd->CurrLine)+wnd->CurrCol) -#define WndCol (wnd->CurrCol-wnd->wleft) -#define isMultiLine(wnd) TestAttribute(wnd, MULTILINE) +#define DfCurrChar (DfTextLine(wnd, wnd->CurrLine)+wnd->CurrCol) +#define DfWndCol (wnd->CurrCol-wnd->wleft) +#define DfIsMultiLine(wnd) DfTestAttribute(wnd, DF_MULTILINE) void DfSearchText(DFWINDOW); void DfReplaceText(DFWINDOW); void DfSearchNext(DFWINDOW); /* --------- message box prototypes -------- */ -DFWINDOW SliderBox(int, char *, char *); -BOOL InputBox(DFWINDOW, char *, char *, char *, int); -BOOL GenericMessage(DFWINDOW, char *, char *, int, - int (*)(struct window *, enum messages, PARAM, PARAM), +DFWINDOW DfSliderBox(int, char *, char *); +BOOL DfInputBox(DFWINDOW, char *, char *, char *, int); +BOOL DfGenericMessage(DFWINDOW, char *, char *, int, + int (*)(struct DfWindow *, enum DfMessages, DF_PARAM, DF_PARAM), char *, char *, int, int, int); #define DfTestErrorMessage(msg) \ - GenericMessage(NULL, "Error", msg, 2, ErrorBoxProc, \ - Ok, Cancel, ID_OK, ID_CANCEL, TRUE) + DfGenericMessage(NULL, "Error", msg, 2, DfErrorBoxProc, \ + Ok, Cancel, DF_ID_OK, DF_ID_CANCEL, TRUE) #define DfErrorMessage(msg) \ - GenericMessage(NULL, "Error", msg, 1, ErrorBoxProc, \ - Ok, NULL, ID_OK, 0, TRUE) + DfGenericMessage(NULL, "Error", msg, 1, DfErrorBoxProc, \ + Ok, NULL, DF_ID_OK, 0, TRUE) #define DfMessageBox(ttl, msg) \ - GenericMessage(NULL, ttl, msg, 1, MessageBoxProc, \ - Ok, NULL, ID_OK, 0, TRUE) + DfGenericMessage(NULL, ttl, msg, 1, DfMessageBoxProc, \ + Ok, NULL, DF_ID_OK, 0, TRUE) #define DfYesNoBox(msg) \ - GenericMessage(NULL, NULL, msg, 2, YesNoBoxProc, \ - Yes, No, ID_OK, ID_CANCEL, TRUE) + DfGenericMessage(NULL, NULL, msg, 2, DfYesNoBoxProc, \ + Yes, No, DF_ID_OK, DF_ID_CANCEL, TRUE) #define DfCancelBox(wnd, msg) \ - GenericMessage(wnd, "Wait...", msg, 1, CancelBoxProc, \ - Cancel, NULL, ID_CANCEL, 0, FALSE) -void CloseCancelBox(void); -DFWINDOW MomentaryMessage(char *); -int MsgHeight(char *); -int MsgWidth(char *); + DfGenericMessage(wnd, "Wait...", msg, 1, DfCancelBoxProc, \ + Cancel, NULL, DF_ID_CANCEL, 0, FALSE) +void DfCloseCancelBox(void); +DFWINDOW DfMomentaryMessage(char *); +int DfMsgHeight(char *); +int DfMsgWidth(char *); /* ------------- dialog box prototypes -------------- */ -BOOL DfDialogBox(DFWINDOW, DBOX *, BOOL, - int (*)(struct window *, enum messages, PARAM, PARAM)); -void ClearDialogBoxes(void); -BOOL OpenFileDialogBox(char *, char *); -BOOL SaveAsDialogBox(char *); -void GetDlgListText(DFWINDOW, char *, enum commands); -BOOL DfDlgDirList(DFWINDOW, char *, enum commands, - enum commands, unsigned); -BOOL RadioButtonSetting(DBOX *, enum commands); -void PushRadioButton(DBOX *, enum commands); -void PutItemText(DFWINDOW, enum commands, char *); -void PutComboListText(DFWINDOW, enum commands, char *); -void GetItemText(DFWINDOW, enum commands, char *, int); -char *GetDlgTextString(DBOX *, enum commands, DFCLASS); -void SetDlgTextString(DBOX *, enum commands, char *, DFCLASS); -BOOL CheckBoxSetting(DBOX *, enum commands); -CTLWINDOW *FindCommand(DBOX *, enum commands, int); -DFWINDOW ControlWindow(DBOX *, enum commands); -void SetScrollBars(DFWINDOW); -void SetRadioButton(DBOX *, CTLWINDOW *); -void ControlSetting(DBOX *, enum commands, int, int); -void SetFocusCursor(DFWINDOW); +BOOL DfDialogBox(DFWINDOW, DF_DBOX *, BOOL, + int (*)(struct DfWindow *, enum DfMessages, DF_PARAM, DF_PARAM)); +void DfClearDialogBoxes(void); +BOOL DfOpenFileDialogBox(char *, char *); +BOOL DfSaveAsDialogBox(char *); +void DfGetDlgListText(DFWINDOW, char *, enum DfCommands); +BOOL DfDlgDirList(DFWINDOW, char *, enum DfCommands, + enum DfCommands, unsigned); +BOOL DfRadioButtonSetting(DF_DBOX *, enum DfCommands); +void DfPushRadioButton(DF_DBOX *, enum DfCommands); +void DfPutItemText(DFWINDOW, enum DfCommands, char *); +void DfPutComboListText(DFWINDOW, enum DfCommands, char *); +void DfGetItemText(DFWINDOW, enum DfCommands, char *, int); +char *DfGetDlgTextString(DF_DBOX *, enum DfCommands, DFCLASS); +void DfSetDlgTextString(DF_DBOX *, enum DfCommands, char *, DFCLASS); +BOOL DfCheckBoxSetting(DF_DBOX *, enum DfCommands); +DF_CTLWINDOW *DfFindCommand(DF_DBOX *, enum DfCommands, int); +DFWINDOW DfControlWindow(DF_DBOX *, enum DfCommands); +void DfSetScrollBars(DFWINDOW); +void DfSetRadioButton(DF_DBOX *, DF_CTLWINDOW *); +void DfControlSetting(DF_DBOX *, enum DfCommands, int, int); +void DfSetFocusCursor(DFWINDOW); -#define GetControl(wnd) (wnd->ct) -#define GetDlgText(db, cmd) GetDlgTextString(db, cmd, TEXT) -#define GetDlgTextBox(db, cmd) GetDlgTextString(db, cmd, TEXTBOX) -#define GetEditBoxText(db, cmd) GetDlgTextString(db, cmd, EDITBOX) -#define GetComboBoxText(db, cmd) GetDlgTextString(db, cmd, COMBOBOX) -#define SetDlgText(db, cmd, s) SetDlgTextString(db, cmd, s, TEXT) -#define SetDlgTextBox(db, cmd, s) SetDlgTextString(db, cmd, s, TEXTBOX) -#define SetEditBoxText(db, cmd, s) SetDlgTextString(db, cmd, s, EDITBOX) -#define SetComboBoxText(db, cmd, s) SetDlgTextString(db, cmd, s, COMBOBOX) -#define SetDlgTitle(db, ttl) ((db)->dwnd.title = ttl) -#define SetCheckBox(db, cmd) ControlSetting(db, cmd, CHECKBOX, ON) -#define ClearCheckBox(db, cmd) ControlSetting(db, cmd, CHECKBOX, OFF) -#define EnableButton(db, cmd) ControlSetting(db, cmd, BUTTON, ON) -#define DisableButton(db, cmd) ControlSetting(db, cmd, BUTTON, OFF) +#define DfGetControl(wnd) (wnd->ct) +#define DfGetDlgText(db, cmd) DfGetDlgTextString(db, cmd, DF_TEXT) +#define DfGetDlgTextBox(db, cmd) DfGetDlgTextString(db, cmd, DF_TEXTBOX) +#define DfGetEditBoxText(db, cmd) DfGetDlgTextString(db, cmd, DF_EDITBOX) +#define DfGetComboBoxText(db, cmd) DfGetDlgTextString(db, cmd, DF_COMBOBOX) +#define DfSetDlgText(db, cmd, s) DfSetDlgTextString(db, cmd, s, DF_TEXT) +#define DfSetDlgTextBox(db, cmd, s) DfSetDlgTextString(db, cmd, s, DF_TEXTBOX) +#define DfSetEditBoxText(db, cmd, s) DfSetDlgTextString(db, cmd, s, DF_EDITBOX) +#define DfSetComboBoxText(db, cmd, s) DfSetDlgTextString(db, cmd, s, DF_COMBOBOX) +#define DfSetDlgTitle(db, ttl) ((db)->dwnd.title = ttl) +#define DfSetCheckBox(db, cmd) DfControlSetting(db, cmd, DF_CHECKBOX, DF_ON) +#define DfClearCheckBox(db, cmd) DfControlSetting(db, cmd, DF_CHECKBOX, DF_OFF) +#define DfEnableButton(db, cmd) DfControlSetting(db, cmd, DF_BUTTON, DF_ON) +#define DfDisableButton(db, cmd) DfControlSetting(db, cmd, DF_BUTTON, DF_OFF) /* ---- types of vectors that can be in a picture box ------- */ -enum VectTypes {VECTOR, SOLIDBAR, HEAVYBAR, CROSSBAR, LIGHTBAR}; +enum DfVectTypes {DF_VECTOR, DF_SOLIDBAR, DF_HEAVYBAR, DF_CROSSBAR, DF_LIGHTBAR}; /* ------------- picture box prototypes ------------- */ -void DrawVector(DFWINDOW, int, int, int, int); -void DrawBox(DFWINDOW, int, int, int, int); -void DrawBar(DFWINDOW, enum VectTypes, int, int, int, int); -DFWINDOW WatchIcon(void); +void DfDrawVector(DFWINDOW, int, int, int, int); +void DfDrawBox(DFWINDOW, int, int, int, int); +void DfDrawBar(DFWINDOW, enum DfVectTypes, int, int, int, int); +DFWINDOW DfWatchIcon(void); /* ------------- help box prototypes ------------- */ -void LoadHelpFile(void); -void UnLoadHelpFile(void); -BOOL DisplayHelp(DFWINDOW, char *); +void DfLoadHelpFile(void); +void DfUnLoadHelpFile(void); +BOOL DfDisplayHelp(DFWINDOW, char *); -extern char *ClassNames[]; +extern char *DfClassNames[]; -void BuildFileName(char *, char *); +void DfBuildFileName(char *, char *); #endif diff --git a/rosapps/dflat32/dflatmsg.h b/rosapps/dflat32/dflatmsg.h index cfca23e4b1c..b714849a26a 100644 --- a/rosapps/dflat32/dflatmsg.h +++ b/rosapps/dflat32/dflatmsg.h @@ -11,90 +11,90 @@ DFlatMsg(DFM_START) /* start message processing */ DFlatMsg(DFM_STOP) /* stop message processing */ DFlatMsg(DFM_COMMAND) /* send a command to a window */ /* -------------- window management messages --------------- */ -DFlatMsg(CREATE_WINDOW) /* create a window */ -DFlatMsg(SHOW_WINDOW) /* show a window */ +DFlatMsg(DFM_CREATE_WINDOW) /* create a window */ +DFlatMsg(DFM_SHOW_WINDOW) /* show a window */ DFlatMsg(DFM_HIDE_WINDOW) /* hide a window */ -DFlatMsg(CLOSE_WINDOW) /* delete a window */ -DFlatMsg(SETFOCUS) /* set and clear the focus */ -DFlatMsg(PAINT) /* paint the window's data space*/ -DFlatMsg(BORDER) /* paint the window's border */ -DFlatMsg(TITLE) /* display the window's title */ -DFlatMsg(MOVE) /* move the window */ -DFlatMsg(DFM_SIZE) /* change the window's size */ +DFlatMsg(DFM_CLOSE_WINDOW) /* delete a window */ +DFlatMsg(DFM_SETFOCUS) /* set and clear the focus */ +DFlatMsg(DFM_PAINT) /* paint the window's data space*/ +DFlatMsg(DFM_BORDER) /* paint the window's border */ +DFlatMsg(DFM_TITLE) /* display the window's title */ +DFlatMsg(DFM_MOVE) /* move the window */ +DFlatMsg(DFM_DFM_SIZE) /* change the window's size */ #ifdef INCLUDE_MAXIMIZE -DFlatMsg(MAXIMIZE) /* maximize the window */ +DFlatMsg(DFM_MAXIMIZE) /* maximize the window */ #endif #ifdef INCLUDE_MINIMIZE -DFlatMsg(MINIMIZE) /* minimize the window */ +DFlatMsg(DFM_MINIMIZE) /* minimize the window */ #endif -DFlatMsg(RESTORE) /* restore the window */ -DFlatMsg(INSIDE_WINDOW) /* test x/y inside a window */ +DFlatMsg(DFM_RESTORE) /* restore the window */ +DFlatMsg(DFM_INSIDE_WINDOW) /* test x/y inside a window */ /* ---------------- clock messages ------------------------- */ -DFlatMsg(CLOCKTICK) /* the clock ticked */ -DFlatMsg(CAPTURE_CLOCK) /* capture clock into a window */ -DFlatMsg(RELEASE_CLOCK) /* release clock to the system */ +DFlatMsg(DFM_CLOCKTICK) /* the clock ticked */ +DFlatMsg(DFM_CAPTURE_CLOCK) /* capture clock into a window */ +DFlatMsg(DFM_RELEASE_CLOCK) /* release clock to the system */ /* -------------- keyboard and screen messages ------------- */ -DFlatMsg(KEYBOARD) /* key was pressed */ -DFlatMsg(CAPTURE_KEYBOARD) /* capture keyboard into a window */ -DFlatMsg(RELEASE_KEYBOARD) /* release keyboard to system */ -DFlatMsg(KEYBOARD_CURSOR) /* position the keyboard cursor */ -DFlatMsg(CURRENT_KEYBOARD_CURSOR) /*read the cursor position */ -DFlatMsg(HIDE_CURSOR) /* hide the keyboard cursor */ -DFlatMsg(SHOW_CURSOR) /* display the keyboard cursor */ -DFlatMsg(SAVE_CURSOR) /* save the cursor's configuration*/ -DFlatMsg(RESTORE_CURSOR) /* restore the saved cursor */ -DFlatMsg(SHIFT_CHANGED) /* the shift status changed */ -DFlatMsg(WAITKEYBOARD) /* waits for a key to be released */ +DFlatMsg(DFM_KEYBOARD) /* key was pressed */ +DFlatMsg(DFM_CAPTURE_KEYBOARD) /* capture keyboard into a window */ +DFlatMsg(DFM_RELEASE_KEYBOARD) /* release keyboard to system */ +DFlatMsg(DFM_KEYBOARD_CURSOR) /* position the keyboard DfCursor */ +DFlatMsg(DFM_CURRENT_KEYBOARD_CURSOR) /*read the DfCursor position */ +DFlatMsg(DFM_HIDE_CURSOR) /* hide the keyboard DfCursor */ +DFlatMsg(DFM_SHOW_CURSOR) /* display the keyboard DfCursor */ +DFlatMsg(DFM_SAVE_CURSOR) /* save the DfCursor's configuration*/ +DFlatMsg(DFM_RESTORE_CURSOR) /* restore the saved DfCursor */ +DFlatMsg(DFM_SHIFT_CHANGED) /* the shift status changed */ +DFlatMsg(DFM_WAITKEYBOARD) /* waits for a key to be released */ /* ---------------- mouse messages ------------------------- */ -DFlatMsg(MOUSE_TRAVEL) /* set the mouse travel */ -DFlatMsg(RIGHT_BUTTON) /* right button pressed */ -DFlatMsg(LEFT_BUTTON) /* left button pressed */ +DFlatMsg(DFM_MOUSE_TRAVEL) /* set the mouse travel */ +DFlatMsg(DFM_RIGHT_BUTTON) /* right button pressed */ +DFlatMsg(DFM_LEFT_BUTTON) /* left button pressed */ DFlatMsg(DFM_DOUBLE_CLICK) /* left button double-clicked */ DFlatMsg(DFM_MOUSE_MOVED) /* mouse changed position */ DFlatMsg(DFM_BUTTON_RELEASED) /* mouse button released */ -DFlatMsg(WAITMOUSE) /* wait until button released */ -DFlatMsg(TESTMOUSE) /* test any mouse button pressed*/ -DFlatMsg(CAPTURE_MOUSE) /* capture mouse into a window */ -DFlatMsg(RELEASE_MOUSE) /* release the mouse to system */ +DFlatMsg(DFM_WAITMOUSE) /* wait until button released */ +DFlatMsg(DFM_TESTMOUSE) /* test any mouse button pressed*/ +DFlatMsg(DFM_CAPTURE_MOUSE) /* capture mouse into a window */ +DFlatMsg(DFM_RELEASE_MOUSE) /* release the mouse to system */ /* ---------------- text box messages ---------------------- */ -DFlatMsg(ADDTEXT) /* append text to the text box */ -DFlatMsg(INSERTTEXT) /* insert line of text */ -DFlatMsg(DELETETEXT) /* delete line of text */ -DFlatMsg(CLEARTEXT) /* clear the edit box */ -DFlatMsg(SETTEXT) /* copy text to text buffer */ -DFlatMsg(SCROLL) /* vertical line scroll */ -DFlatMsg(HORIZSCROLL) /* horizontal column scroll */ -DFlatMsg(SCROLLPAGE) /* vertical page scroll */ -DFlatMsg(HORIZPAGE) /* horizontal page scroll */ -DFlatMsg(SCROLLDOC) /* scroll to beginning/end */ +DFlatMsg(DFM_ADDTEXT) /* append text to the text box */ +DFlatMsg(DFM_INSERTTEXT) /* insert line of text */ +DFlatMsg(DFM_DELETETEXT) /* delete line of text */ +DFlatMsg(DFM_CLEARTEXT) /* clear the edit box */ +DFlatMsg(DFM_SETTEXT) /* copy text to text buffer */ +DFlatMsg(DFM_SCROLL) /* vertical line scroll */ +DFlatMsg(DFM_HORIZSCROLL) /* horizontal column scroll */ +DFlatMsg(DFM_SCROLLPAGE) /* vertical page scroll */ +DFlatMsg(DFM_HORIZPAGE) /* horizontal page scroll */ +DFlatMsg(DFM_SCROLLDOC) /* scroll to beginning/end */ /* ---------------- edit box messages ---------------------- */ -DFlatMsg(GETTEXT) /* get text from an edit box */ -DFlatMsg(SETTEXTLENGTH) /* set maximum text length */ +DFlatMsg(DFM_GETTEXT) /* get text from an edit box */ +DFlatMsg(DFM_SETTEXTLENGTH) /* set maximum text length */ /* ---------------- menubar messages ----------------------- */ -DFlatMsg(BUILDMENU) /* build the menu display */ -DFlatMsg(MB_SELECTION) /* menubar selection */ +DFlatMsg(DFM_BUILDMENU) /* build the menu display */ +DFlatMsg(DFM_MB_SELECTION) /* menubar selection */ /* ---------------- popdown messages ----------------------- */ -DFlatMsg(BUILD_SELECTIONS) /* build the menu display */ -DFlatMsg(CLOSE_POPDOWN) /* tell parent popdown is closing */ +DFlatMsg(DFM_BUILD_SELECTIONS) /* build the menu display */ +DFlatMsg(DFM_CLOSE_POPDOWN) /* tell parent popdown is closing */ /* ---------------- list box messages ---------------------- */ -DFlatMsg(LB_SELECTION) /* sent to parent on selection */ -DFlatMsg(LB_CHOOSE) /* sent when user chooses */ -DFlatMsg(LB_CURRENTSELECTION)/* return the current selection */ +DFlatMsg(DFM_LB_SELECTION) /* sent to parent on selection */ +DFlatMsg(DFM_LB_CHOOSE) /* sent when user chooses */ +DFlatMsg(DFM_LB_CURRENTSELECTION)/* return the current selection */ DFlatMsg(DFM_LB_GETTEXT) /* return the text of selection */ -DFlatMsg(LB_SETSELECTION) /* sets the listbox selection */ +DFlatMsg(DFM_LB_SETSELECTION) /* sets the listbox selection */ /* ---------------- dialog box messages -------------------- */ -DFlatMsg(INITIATE_DIALOG) /* begin a dialog */ -DFlatMsg(ENTERFOCUS) /* tell DB control got focus */ -DFlatMsg(LEAVEFOCUS) /* tell DB control lost focus */ -DFlatMsg(ENDDIALOG) /* end a dialog */ +DFlatMsg(DFM_INITIATE_DIALOG) /* begin a dialog */ +DFlatMsg(DFM_ENTERFOCUS) /* tell DB control got focus */ +DFlatMsg(DFM_LEAVEFOCUS) /* tell DB control lost focus */ +DFlatMsg(DFM_ENDDIALOG) /* end a dialog */ /* ---------------- help box messages ---------------------- */ -DFlatMsg(DISPLAY_HELP) +DFlatMsg(DFM_DISPLAY_HELP) /* --------------- application window messages ------------- */ -DFlatMsg(ADDSTATUS) +DFlatMsg(DFM_ADDSTATUS) /* --------------- picture box messages -------------------- */ -DFlatMsg(DRAWVECTOR) -DFlatMsg(DRAWBOX) -DFlatMsg(DRAWBAR) +DFlatMsg(DFM_DRAWVECTOR) +DFlatMsg(DFM_DRAWBOX) +DFlatMsg(DFM_DRAWBAR) diff --git a/rosapps/dflat32/dialbox.c b/rosapps/dflat32/dialbox.c index 9e7fd3e652f..122b00afd3d 100644 --- a/rosapps/dflat32/dialbox.c +++ b/rosapps/dflat32/dialbox.c @@ -2,32 +2,32 @@ #include "dflat.h" -static int inFocusCommand(DBOX *); -static void dbShortcutKeys(DBOX *, int); -static int ControlProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); -static void FirstFocus(DBOX *db); -static void NextFocus(DBOX *db); -static void PrevFocus(DBOX *db); -static CTLWINDOW *AssociatedControl(DBOX *, enum commands); +static int inFocusCommand(DF_DBOX *); +static void dbShortcutKeys(DF_DBOX *, int); +static int ControlProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); +static void FirstFocus(DF_DBOX *db); +static void NextFocus(DF_DBOX *db); +static void PrevFocus(DF_DBOX *db); +static DF_CTLWINDOW *AssociatedControl(DF_DBOX *, enum DfCommands); static BOOL SysMenuOpen; -static DBOX **dbs = NULL; +static DF_DBOX **dbs = NULL; static int dbct = 0; /* --- clear all heap allocations to control text fields --- */ -void ClearDialogBoxes(void) +void DfClearDialogBoxes(void) { int i; for (i = 0; i < dbct; i++) { - CTLWINDOW *ct = (*(dbs+i))->ctl; + DF_CTLWINDOW *ct = (*(dbs+i))->ctl; while (ct->class) { - if ((ct->class == EDITBOX || - ct->class == COMBOBOX) && + if ((ct->class == DF_EDITBOX || + ct->class == DF_COMBOBOX) && ct->itext != NULL) { free(ct->itext); @@ -45,11 +45,11 @@ void ClearDialogBoxes(void) } -/* -------- CREATE_WINDOW Message --------- */ -static int CreateWindowMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* -------- DFM_CREATE_WINDOW Message --------- */ +static int CreateWindowMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - DBOX *db = wnd->extension; - CTLWINDOW *ct = db->ctl; + DF_DBOX *db = wnd->extension; + DF_CTLWINDOW *ct = db->ctl; DFWINDOW cwnd; int rtn, i; /* ---- build a table of processed dialog boxes ---- */ @@ -57,70 +57,70 @@ static int CreateWindowMsg(DFWINDOW wnd, PARAM p1, PARAM p2) if (db == dbs[i]) break; if (i == dbct) { - dbs = DFrealloc(dbs, sizeof(DBOX *) * (dbct+1)); + dbs = DfRealloc(dbs, sizeof(DF_DBOX *) * (dbct+1)); *(dbs + dbct++) = db; } - rtn = BaseWndProc(DIALOG, wnd, CREATE_WINDOW, p1, p2); + rtn = DfBaseWndProc(DF_DIALOG, wnd, DFM_CREATE_WINDOW, p1, p2); ct = db->ctl; while (ct->class) { int attrib = 0; - if (TestAttribute(wnd, NOCLIP)) - attrib |= NOCLIP; + if (DfTestAttribute(wnd, DF_NOCLIP)) + attrib |= DF_NOCLIP; if (wnd->Modal) - attrib |= SAVESELF; + attrib |= DF_SAVESELF; ct->setting = ct->isetting; - if (ct->class == EDITBOX && ct->dwnd.h > 1) - attrib |= (MULTILINE | HASBORDER); - else if ((ct->class == LISTBOX || ct->class == TEXTBOX) && + if (ct->class == DF_EDITBOX && ct->dwnd.h > 1) + attrib |= (DF_MULTILINE | DF_HASBORDER); + else if ((ct->class == DF_LISTBOX || ct->class == DF_TEXTBOX) && ct->dwnd.h > 2) - attrib |= HASBORDER; - cwnd = DfCreateWindow(ct->class, + attrib |= DF_HASBORDER; + cwnd = DfDfCreateWindow(ct->class, ct->dwnd.title, - ct->dwnd.x+GetClientLeft(wnd), - ct->dwnd.y+GetClientTop(wnd), + ct->dwnd.x+DfGetClientLeft(wnd), + ct->dwnd.y+DfGetClientTop(wnd), ct->dwnd.h, ct->dwnd.w, ct, wnd, ControlProc, attrib); - if ((ct->class == EDITBOX || - ct->class == COMBOBOX) && + if ((ct->class == DF_EDITBOX || + ct->class == DF_COMBOBOX) && ct->itext != NULL) - DfSendMessage(cwnd, SETTEXT, (PARAM) ct->itext, 0); + DfSendMessage(cwnd, DFM_SETTEXT, (DF_PARAM) ct->itext, 0); ct++; } return rtn; } -/* -------- LEFT_BUTTON Message --------- */ -static BOOL LeftButtonMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* -------- DFM_LEFT_BUTTON Message --------- */ +static BOOL LeftButtonMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - DBOX *db = wnd->extension; - CTLWINDOW *ct = db->ctl; - if (WindowSizing || WindowMoving) + DF_DBOX *db = wnd->extension; + DF_CTLWINDOW *ct = db->ctl; + if (DfWindowSizing || DfWindowMoving) return TRUE; - if (HitControlBox(wnd, p1-GetLeft(wnd), p2-GetTop(wnd))) { - DfPostMessage(wnd, KEYBOARD, ' ', ALTKEY); + if (DfHitControlBox(wnd, p1-DfGetLeft(wnd), p2-DfGetTop(wnd))) { + DfPostMessage(wnd, DFM_KEYBOARD, ' ', DF_ALTKEY); return TRUE; } while (ct->class) { DFWINDOW cwnd = ct->wnd; - if (ct->class == COMBOBOX) { - if (p2 == GetTop(cwnd)) { - if (p1 == GetRight(cwnd)+1) { - DfSendMessage(cwnd, LEFT_BUTTON, p1, p2); + if (ct->class == DF_COMBOBOX) { + if (p2 == DfGetTop(cwnd)) { + if (p1 == DfGetRight(cwnd)+1) { + DfSendMessage(cwnd, DFM_LEFT_BUTTON, p1, p2); return TRUE; } } - if (GetClass(inFocus) == LISTBOX) - DfSendMessage(wnd, SETFOCUS, TRUE, 0); + if (DfGetClass(DfInFocus) == DF_LISTBOX) + DfSendMessage(wnd, DFM_SETFOCUS, TRUE, 0); } - else if (ct->class == SPINBUTTON) { - if (p2 == GetTop(cwnd)) { - if (p1 == GetRight(cwnd)+1 || - p1 == GetRight(cwnd)+2) { - DfSendMessage(cwnd, LEFT_BUTTON, p1, p2); + else if (ct->class == DF_SPINBUTTON) { + if (p2 == DfGetTop(cwnd)) { + if (p1 == DfGetRight(cwnd)+1 || + p1 == DfGetRight(cwnd)+2) { + DfSendMessage(cwnd, DFM_LEFT_BUTTON, p1, p2); return TRUE; } } @@ -130,42 +130,42 @@ static BOOL LeftButtonMsg(DFWINDOW wnd, PARAM p1, PARAM p2) return FALSE; } -/* -------- KEYBOARD Message --------- */ -static BOOL KeyboardMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* -------- DFM_KEYBOARD Message --------- */ +static BOOL KeyboardMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - DBOX *db = wnd->extension; - CTLWINDOW *ct; + DF_DBOX *db = wnd->extension; + DF_CTLWINDOW *ct; - if (WindowMoving || WindowSizing) + if (DfWindowMoving || DfWindowSizing) return FALSE; switch ((int)p1) { - case F1: - ct = GetControl(inFocus); + case DF_F1: + ct = DfGetControl(DfInFocus); if (ct != NULL) - if (DisplayHelp(wnd, ct->help)) + if (DfDisplayHelp(wnd, ct->help)) return TRUE; break; - case SHIFT_HT: - case BS: - case UP: + case DF_SHIFT_HT: + case DF_BS: + case DF_UP: PrevFocus(db); break; - case ALT_F6: + case DF_ALT_F6: case '\t': - case FWD: - case DN: + case DF_FWD: + case DF_DN: NextFocus(db); break; case ' ': - if (((int)p2 & ALTKEY) && - TestAttribute(wnd, CONTROLBOX)) { + if (((int)p2 & DF_ALTKEY) && + DfTestAttribute(wnd, DF_CONTROLBOX)) { SysMenuOpen = TRUE; - BuildSystemMenu(wnd); + DfBuildSystemMenu(wnd); } break; - case CTRL_F4: - case ESC: - DfSendMessage(wnd, DFM_COMMAND, ID_CANCEL, 0); + case DF_CTRL_F4: + case DF_ESC: + DfSendMessage(wnd, DFM_COMMAND, DF_ID_CANCEL, 0); break; default: /* ------ search all the shortcut keys ----- */ @@ -176,56 +176,56 @@ static BOOL KeyboardMsg(DFWINDOW wnd, PARAM p1, PARAM p2) } /* -------- COMMAND Message --------- */ -static BOOL CommandMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +static BOOL CommandMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - DBOX *db = wnd->extension; + DF_DBOX *db = wnd->extension; switch ((int) p1) { - case ID_OK: - case ID_CANCEL: + case DF_ID_OK: + case DF_ID_CANCEL: if ((int)p2 != 0) return TRUE; wnd->ReturnCode = (int) p1; if (wnd->Modal) - DfPostMessage(wnd, ENDDIALOG, 0, 0); + DfPostMessage(wnd, DFM_ENDDIALOG, 0, 0); else - DfSendMessage(wnd, CLOSE_WINDOW, TRUE, 0); + DfSendMessage(wnd, DFM_CLOSE_WINDOW, TRUE, 0); return TRUE; - case ID_HELP: + case DF_ID_HELP: if ((int)p2 != 0) return TRUE; - return DisplayHelp(wnd, db->HelpName); + return DfDisplayHelp(wnd, db->HelpName); default: break; } return FALSE; } -/* ----- window-processing module, DIALOG window class ----- */ -int DialogProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +/* ----- window-processing module, DF_DIALOG window class ----- */ +int DfDialogProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { int rtn; - DBOX *db = wnd->extension; + DF_DBOX *db = wnd->extension; switch (msg) { - case CREATE_WINDOW: + case DFM_CREATE_WINDOW: return CreateWindowMsg(wnd, p1, p2); - case SHIFT_CHANGED: + case DFM_SHIFT_CHANGED: if (wnd->Modal) return TRUE; break; - case LEFT_BUTTON: + case DFM_LEFT_BUTTON: if (LeftButtonMsg(wnd, p1, p2)) return TRUE; break; - case KEYBOARD: + case DFM_KEYBOARD: if (KeyboardMsg(wnd, p1, p2)) return TRUE; break; - case CLOSE_POPDOWN: + case DFM_CLOSE_POPDOWN: SysMenuOpen = FALSE; break; - case LB_SELECTION: - case LB_CHOOSE: + case DFM_LB_SELECTION: + case DFM_LB_CHOOSE: if (SysMenuOpen) return TRUE; DfSendMessage(wnd, DFM_COMMAND, inFocusCommand(db), msg); @@ -234,20 +234,20 @@ int DialogProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) if (CommandMsg(wnd, p1, p2)) return TRUE; break; - case PAINT: + case DFM_PAINT: p2 = TRUE; break; - case MOVE: - case DFM_SIZE: - rtn = BaseWndProc(DIALOG, wnd, msg, p1, p2); + case DFM_MOVE: + case DFM_DFM_SIZE: + rtn = DfBaseWndProc(DF_DIALOG, wnd, msg, p1, p2); if (wnd->dfocus != NULL) - DfSendMessage(wnd->dfocus, SETFOCUS, TRUE, 0); + DfSendMessage(wnd->dfocus, DFM_SETFOCUS, TRUE, 0); return rtn; - case CLOSE_WINDOW: + case DFM_CLOSE_WINDOW: if (!p1) { - DfSendMessage(wnd, DFM_COMMAND, ID_CANCEL, 0); + DfSendMessage(wnd, DFM_COMMAND, DF_ID_CANCEL, 0); return TRUE; } break; @@ -255,12 +255,12 @@ int DialogProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) default: break; } - return BaseWndProc(DIALOG, wnd, msg, p1, p2); + return DfBaseWndProc(DF_DIALOG, wnd, msg, p1, p2); } /* ------- create and execute a dialog box ---------- */ -BOOL DfDialogBox(DFWINDOW wnd, DBOX *db, BOOL Modal, - int (*wndproc)(struct window *, enum messages, PARAM, PARAM)) +BOOL DfDialogBox(DFWINDOW wnd, DF_DBOX *db, BOOL Modal, + int (*wndproc)(struct DfWindow *, enum DfMessages, DF_PARAM, DF_PARAM)) { BOOL rtn; int x = db->dwnd.x, y = db->dwnd.y; @@ -268,10 +268,10 @@ BOOL DfDialogBox(DFWINDOW wnd, DBOX *db, BOOL Modal, if (!Modal && wnd != NULL) { - x += GetLeft(wnd); - y += GetTop(wnd); + x += DfGetLeft(wnd); + y += DfGetTop(wnd); } - DialogWnd = DfCreateWindow(DIALOG, + DialogWnd = DfDfCreateWindow(DF_DIALOG, db->dwnd.title, x, y, db->dwnd.h, @@ -279,31 +279,31 @@ BOOL DfDialogBox(DFWINDOW wnd, DBOX *db, BOOL Modal, db, wnd, wndproc, - Modal ? SAVESELF : 0); + Modal ? DF_SAVESELF : 0); DialogWnd->Modal = Modal; FirstFocus(db); - DfPostMessage(DialogWnd, INITIATE_DIALOG, 0, 0); + DfPostMessage(DialogWnd, DFM_INITIATE_DIALOG, 0, 0); if (Modal) { - DfSendMessage(DialogWnd, CAPTURE_MOUSE, 0, 0); - DfSendMessage(DialogWnd, CAPTURE_KEYBOARD, 0, 0); + DfSendMessage(DialogWnd, DFM_CAPTURE_MOUSE, 0, 0); + DfSendMessage(DialogWnd, DFM_CAPTURE_KEYBOARD, 0, 0); while (DfDispatchMessage ()) ; - rtn = DialogWnd->ReturnCode == ID_OK; - DfSendMessage(DialogWnd, RELEASE_MOUSE, 0, 0); - DfSendMessage(DialogWnd, RELEASE_KEYBOARD, 0, 0); - DfSendMessage(DialogWnd, CLOSE_WINDOW, TRUE, 0); + rtn = DialogWnd->ReturnCode == DF_ID_OK; + DfSendMessage(DialogWnd, DFM_RELEASE_MOUSE, 0, 0); + DfSendMessage(DialogWnd, DFM_RELEASE_KEYBOARD, 0, 0); + DfSendMessage(DialogWnd, DFM_CLOSE_WINDOW, TRUE, 0); return rtn; } return FALSE; } /* ----- return command code of in-focus control window ---- */ -static int inFocusCommand(DBOX *db) +static int inFocusCommand(DF_DBOX *db) { - CTLWINDOW *ct = db->ctl; + DF_CTLWINDOW *ct = db->ctl; while (ct->class) { - if (ct->wnd == inFocus) + if (ct->wnd == DfInFocus) return ct->command; ct++; } @@ -311,9 +311,9 @@ static int inFocusCommand(DBOX *db) } /* -------- find a specified control structure ------- */ -CTLWINDOW *FindCommand(DBOX *db, enum commands cmd, int class) +DF_CTLWINDOW *DfFindCommand(DF_DBOX *db, enum DfCommands cmd, int class) { - CTLWINDOW *ct = db->ctl; + DF_CTLWINDOW *ct = db->ctl; while (ct->class) { if (ct->class == class) @@ -325,12 +325,12 @@ CTLWINDOW *FindCommand(DBOX *db, enum commands cmd, int class) } /* ---- return the window handle of a specified command ---- */ -DFWINDOW ControlWindow(DBOX *db, enum commands cmd) +DFWINDOW DfControlWindow(DF_DBOX *db, enum DfCommands cmd) { - CTLWINDOW *ct = db->ctl; + DF_CTLWINDOW *ct = db->ctl; while (ct->class) { - if (ct->class != TEXT && cmd == ct->command) + if (ct->class != DF_TEXT && cmd == ct->command) return ct->wnd; ct++; } @@ -338,9 +338,9 @@ DFWINDOW ControlWindow(DBOX *db, enum commands cmd) } /* --- return a pointer to the control structure that matches a window --- */ -CTLWINDOW *WindowControl(DBOX *db, DFWINDOW wnd) +DF_CTLWINDOW *WindowControl(DF_DBOX *db, DFWINDOW wnd) { - CTLWINDOW *ct = db->ctl; + DF_CTLWINDOW *ct = db->ctl; while (ct->class) { if (ct->wnd == wnd) @@ -350,11 +350,11 @@ CTLWINDOW *WindowControl(DBOX *db, DFWINDOW wnd) return NULL; } -/* ---- set a control ON or OFF ----- */ -void ControlSetting(DBOX *db, enum commands cmd, +/* ---- set a control DF_ON or DF_OFF ----- */ +void DfControlSetting(DF_DBOX *db, enum DfCommands cmd, int class, int setting) { - CTLWINDOW *ct = FindCommand(db, cmd, class); + DF_CTLWINDOW *ct = DfFindCommand(db, cmd, class); if (ct != NULL) { ct->isetting = setting; if (ct->wnd != NULL) @@ -363,9 +363,9 @@ void ControlSetting(DBOX *db, enum commands cmd, } /* ---- return pointer to the text of a control window ---- */ -char *GetDlgTextString(DBOX *db,enum commands cmd,DFCLASS class) +char *DfGetDlgTextString(DF_DBOX *db,enum DfCommands cmd,DFCLASS class) { - CTLWINDOW *ct = FindCommand(db, cmd, class); + DF_CTLWINDOW *ct = DfFindCommand(db, cmd, class); if (ct != NULL) return ct->itext; else @@ -373,50 +373,50 @@ char *GetDlgTextString(DBOX *db,enum commands cmd,DFCLASS class) } /* ------- set the text of a control specification ------ */ -void SetDlgTextString(DBOX *db, enum commands cmd, +void DfSetDlgTextString(DF_DBOX *db, enum DfCommands cmd, char *text, DFCLASS class) { - CTLWINDOW *ct = FindCommand(db, cmd, class); + DF_CTLWINDOW *ct = DfFindCommand(db, cmd, class); if (ct != NULL) { - ct->itext = DFrealloc(ct->itext, strlen(text)+1); + ct->itext = DfRealloc(ct->itext, strlen(text)+1); strcpy(ct->itext, text); } } /* ------- set the text of a control window ------ */ -void PutItemText(DFWINDOW wnd, enum commands cmd, char *text) +void DfPutItemText(DFWINDOW wnd, enum DfCommands cmd, char *text) { - CTLWINDOW *ct = FindCommand(wnd->extension, cmd, EDITBOX); + DF_CTLWINDOW *ct = DfFindCommand(wnd->extension, cmd, DF_EDITBOX); if (ct == NULL) - ct = FindCommand(wnd->extension, cmd, TEXTBOX); + ct = DfFindCommand(wnd->extension, cmd, DF_TEXTBOX); if (ct == NULL) - ct = FindCommand(wnd->extension, cmd, COMBOBOX); + ct = DfFindCommand(wnd->extension, cmd, DF_COMBOBOX); if (ct == NULL) - ct = FindCommand(wnd->extension, cmd, LISTBOX); + ct = DfFindCommand(wnd->extension, cmd, DF_LISTBOX); if (ct == NULL) - ct = FindCommand(wnd->extension, cmd, SPINBUTTON); + ct = DfFindCommand(wnd->extension, cmd, DF_SPINBUTTON); if (ct == NULL) - ct = FindCommand(wnd->extension, cmd, TEXT); + ct = DfFindCommand(wnd->extension, cmd, DF_TEXT); if (ct != NULL) { DFWINDOW cwnd = (DFWINDOW) (ct->wnd); switch (ct->class) { - case COMBOBOX: - case EDITBOX: - DfSendMessage(cwnd, CLEARTEXT, 0, 0); - DfSendMessage(cwnd, ADDTEXT, (PARAM) text, 0); - if (!isMultiLine(cwnd)) - DfSendMessage(cwnd, PAINT, 0, 0); + case DF_COMBOBOX: + case DF_EDITBOX: + DfSendMessage(cwnd, DFM_CLEARTEXT, 0, 0); + DfSendMessage(cwnd, DFM_ADDTEXT, (DF_PARAM) text, 0); + if (!DfIsMultiLine(cwnd)) + DfSendMessage(cwnd, DFM_PAINT, 0, 0); break; - case LISTBOX: - case TEXTBOX: - case SPINBUTTON: - DfSendMessage(cwnd, ADDTEXT, (PARAM) text, 0); + case DF_LISTBOX: + case DF_TEXTBOX: + case DF_SPINBUTTON: + DfSendMessage(cwnd, DFM_ADDTEXT, (DF_PARAM) text, 0); break; - case TEXT: { - DfSendMessage(cwnd, CLEARTEXT, 0, 0); - DfSendMessage(cwnd, ADDTEXT, (PARAM) text, 0); - DfSendMessage(cwnd, PAINT, 0, 0); + case DF_TEXT: { + DfSendMessage(cwnd, DFM_CLEARTEXT, 0, 0); + DfSendMessage(cwnd, DFM_ADDTEXT, (DF_PARAM) text, 0); + DfSendMessage(cwnd, DFM_PAINT, 0, 0); break; } default: @@ -426,38 +426,38 @@ void PutItemText(DFWINDOW wnd, enum commands cmd, char *text) } /* ------- get the text of a control window ------ */ -void GetItemText(DFWINDOW wnd, enum commands cmd, +void DfGetItemText(DFWINDOW wnd, enum DfCommands cmd, char *text, int len) { - CTLWINDOW *ct = FindCommand(wnd->extension, cmd, EDITBOX); + DF_CTLWINDOW *ct = DfFindCommand(wnd->extension, cmd, DF_EDITBOX); unsigned char *cp; if (ct == NULL) - ct = FindCommand(wnd->extension, cmd, COMBOBOX); + ct = DfFindCommand(wnd->extension, cmd, DF_COMBOBOX); if (ct == NULL) - ct = FindCommand(wnd->extension, cmd, TEXTBOX); + ct = DfFindCommand(wnd->extension, cmd, DF_TEXTBOX); if (ct == NULL) - ct = FindCommand(wnd->extension, cmd, TEXT); + ct = DfFindCommand(wnd->extension, cmd, DF_TEXT); if (ct != NULL) { DFWINDOW cwnd = (DFWINDOW) (ct->wnd); if (cwnd != NULL) { switch (ct->class) { - case TEXT: - if (GetText(cwnd) != NULL) { - cp = strchr(GetText(cwnd), '\n'); + case DF_TEXT: + if (DfGetText(cwnd) != NULL) { + cp = strchr(DfGetText(cwnd), '\n'); if (cp != NULL) - len = (int) (cp - GetText(cwnd)); - strncpy(text, GetText(cwnd), len); + len = (int) (cp - DfGetText(cwnd)); + strncpy(text, DfGetText(cwnd), len); *(text+len) = '\0'; } break; - case TEXTBOX: - if (GetText(cwnd) != NULL) - strncpy(text, GetText(cwnd), len); + case DF_TEXTBOX: + if (DfGetText(cwnd) != NULL) + strncpy(text, DfGetText(cwnd), len); break; - case COMBOBOX: - case EDITBOX: - DfSendMessage(cwnd,GETTEXT,(PARAM)text,len); + case DF_COMBOBOX: + case DF_EDITBOX: + DfSendMessage(cwnd,DFM_GETTEXT,(DF_PARAM)text,len); break; default: break; @@ -467,19 +467,19 @@ void GetItemText(DFWINDOW wnd, enum commands cmd, } /* ------- set the text of a listbox control window ------ */ -void GetDlgListText(DFWINDOW wnd, char *text, enum commands cmd) +void DfGetDlgListText(DFWINDOW wnd, char *text, enum DfCommands cmd) { - CTLWINDOW *ct = FindCommand(wnd->extension, cmd, LISTBOX); - int sel = DfSendMessage(ct->wnd, LB_CURRENTSELECTION, 0, 0); - DfSendMessage(ct->wnd, DFM_LB_GETTEXT, (PARAM) text, sel); + DF_CTLWINDOW *ct = DfFindCommand(wnd->extension, cmd, DF_LISTBOX); + int sel = DfSendMessage(ct->wnd, DFM_LB_CURRENTSELECTION, 0, 0); + DfSendMessage(ct->wnd, DFM_LB_GETTEXT, (DF_PARAM) text, sel); } /* -- find control structure associated with text control -- */ -static CTLWINDOW *AssociatedControl(DBOX *db,enum commands Tcmd) +static DF_CTLWINDOW *AssociatedControl(DF_DBOX *db,enum DfCommands Tcmd) { - CTLWINDOW *ct = db->ctl; + DF_CTLWINDOW *ct = db->ctl; while (ct->class) { - if (ct->class != TEXT) + if (ct->class != DF_TEXT) if (ct->command == Tcmd) break; ct++; @@ -488,30 +488,30 @@ static CTLWINDOW *AssociatedControl(DBOX *db,enum commands Tcmd) } /* --- process dialog box shortcut keys --- */ -static void dbShortcutKeys(DBOX *db, int ky) +static void dbShortcutKeys(DF_DBOX *db, int ky) { - CTLWINDOW *ct; - int ch = AltConvert(ky); + DF_CTLWINDOW *ct; + int ch = DfAltConvert(ky); if (ch != 0) { ct = db->ctl; while (ct->class) { char *cp = ct->itext; while (cp && *cp) { - if (*cp == SHORTCUTCHAR && + if (*cp == DF_SHORTCUTCHAR && tolower(*(cp+1)) == ch) { - if (ct->class == TEXT) + if (ct->class == DF_TEXT) ct = AssociatedControl(db, ct->command); - if (ct->class == RADIOBUTTON) - SetRadioButton(db, ct); - else if (ct->class == CHECKBOX) { - ct->setting ^= ON; - DfSendMessage(ct->wnd, PAINT, 0, 0); + if (ct->class == DF_RADIOBUTTON) + DfSetRadioButton(db, ct); + else if (ct->class == DF_CHECKBOX) { + ct->setting ^= DF_ON; + DfSendMessage(ct->wnd, DFM_PAINT, 0, 0); } else if (ct->class) { - DfSendMessage(ct->wnd, SETFOCUS, TRUE, 0); - if (ct->class == BUTTON) - DfSendMessage(ct->wnd,KEYBOARD,'\r',0); + DfSendMessage(ct->wnd, DFM_SETFOCUS, TRUE, 0); + if (ct->class == DF_BUTTON) + DfSendMessage(ct->wnd,DFM_KEYBOARD,'\r',0); } return; } @@ -524,85 +524,85 @@ static void dbShortcutKeys(DBOX *db, int ky) /* --- dynamically add or remove scroll bars from a control window ---- */ -void SetScrollBars(DFWINDOW wnd) +void DfSetScrollBars(DFWINDOW wnd) { - int oldattr = GetAttribute(wnd); - if (wnd->wlines > ClientHeight(wnd)) - AddAttribute(wnd, VSCROLLBAR); + int oldattr = DfGetAttribute(wnd); + if (wnd->wlines > DfClientHeight(wnd)) + DfAddAttribute(wnd, DF_VSCROLLBAR); else - ClearAttribute(wnd, VSCROLLBAR); - if (wnd->textwidth > ClientWidth(wnd)) - AddAttribute(wnd, HSCROLLBAR); + DfClearAttribute(wnd, DF_VSCROLLBAR); + if (wnd->textwidth > DfClientWidth(wnd)) + DfAddAttribute(wnd, DF_HSCROLLBAR); else - ClearAttribute(wnd, HSCROLLBAR); - if (GetAttribute(wnd) != oldattr) - DfSendMessage(wnd, BORDER, 0, 0); + DfClearAttribute(wnd, DF_HSCROLLBAR); + if (DfGetAttribute(wnd) != oldattr) + DfSendMessage(wnd, DFM_BORDER, 0, 0); } -/* ------- CREATE_WINDOW Message (Control) ----- */ +/* ------- DFM_CREATE_WINDOW Message (Control) ----- */ static void CtlCreateWindowMsg(DFWINDOW wnd) { - CTLWINDOW *ct; + DF_CTLWINDOW *ct; ct = wnd->ct = wnd->extension; wnd->extension = NULL; if (ct != NULL) ct->wnd = wnd; } -/* ------- KEYBOARD Message (Control) ----- */ -static BOOL CtlKeyboardMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* ------- DFM_KEYBOARD Message (Control) ----- */ +static BOOL CtlKeyboardMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - CTLWINDOW *ct = GetControl(wnd); + DF_CTLWINDOW *ct = DfGetControl(wnd); switch ((int) p1) { - case F1: - if (WindowMoving || WindowSizing) + case DF_F1: + if (DfWindowMoving || DfWindowSizing) break; - if (!DisplayHelp(wnd, ct->help)) - DfSendMessage(GetParent(wnd),DFM_COMMAND,ID_HELP,0); + if (!DfDisplayHelp(wnd, ct->help)) + DfSendMessage(DfGetParent(wnd),DFM_COMMAND,DF_ID_HELP,0); return TRUE; case ' ': - if (!((int)p2 & ALTKEY)) + if (!((int)p2 & DF_ALTKEY)) break; - case ALT_F6: - case CTRL_F4: - case ALT_F4: - DfPostMessage(GetParent(wnd), KEYBOARD, p1, p2); + case DF_ALT_F6: + case DF_CTRL_F4: + case DF_ALT_F4: + DfPostMessage(DfGetParent(wnd), DFM_KEYBOARD, p1, p2); return TRUE; default: break; } - if (GetClass(wnd) == EDITBOX) - if (isMultiLine(wnd)) + if (DfGetClass(wnd) == DF_EDITBOX) + if (DfIsMultiLine(wnd)) return FALSE; switch ((int) p1) { - case UP: - if (!isDerivedFrom(wnd, LISTBOX)) { - p1 = CTRL_FIVE; - p2 = LEFTSHIFT; + case DF_UP: + if (!DfIsDerivedFrom(wnd, DF_LISTBOX)) { + p1 = DF_CTRL_FIVE; + p2 = DF_LEFTSHIFT; } break; - case BS: - if (!isDerivedFrom(wnd, EDITBOX)) { - p1 = CTRL_FIVE; - p2 = LEFTSHIFT; + case DF_BS: + if (!DfIsDerivedFrom(wnd, DF_EDITBOX)) { + p1 = DF_CTRL_FIVE; + p2 = DF_LEFTSHIFT; } break; - case DN: - if (!isDerivedFrom(wnd, LISTBOX) && - !isDerivedFrom(wnd, COMBOBOX)) + case DF_DN: + if (!DfIsDerivedFrom(wnd, DF_LISTBOX) && + !DfIsDerivedFrom(wnd, DF_COMBOBOX)) p1 = '\t'; break; - case FWD: - if (!isDerivedFrom(wnd, EDITBOX)) + case DF_FWD: + if (!DfIsDerivedFrom(wnd, DF_EDITBOX)) p1 = '\t'; break; case '\r': - if (isDerivedFrom(wnd, EDITBOX)) - if (isMultiLine(wnd)) + if (DfIsDerivedFrom(wnd, DF_EDITBOX)) + if (DfIsMultiLine(wnd)) break; - if (isDerivedFrom(wnd, BUTTON)) + if (DfIsDerivedFrom(wnd, DF_BUTTON)) break; - DfSendMessage(GetParent(wnd), DFM_COMMAND, ID_OK, 0); + DfSendMessage(DfGetParent(wnd), DFM_COMMAND, DF_ID_OK, 0); return TRUE; default: break; @@ -610,25 +610,25 @@ static BOOL CtlKeyboardMsg(DFWINDOW wnd, PARAM p1, PARAM p2) return FALSE; } -/* ------- CLOSE_WINDOW Message (Control) ----- */ +/* ------- DFM_CLOSE_WINDOW Message (Control) ----- */ static void CtlCloseWindowMsg(DFWINDOW wnd) { - CTLWINDOW *ct = GetControl(wnd); + DF_CTLWINDOW *ct = DfGetControl(wnd); if (ct != NULL) { ct->wnd = NULL; - if (GetParent(wnd)->ReturnCode == ID_OK) { - if (ct->class == EDITBOX || ct->class == COMBOBOX) { + if (DfGetParent(wnd)->ReturnCode == DF_ID_OK) { + if (ct->class == DF_EDITBOX || ct->class == DF_COMBOBOX) { if (wnd->TextChanged) { - ct->itext=DFrealloc(ct->itext,strlen(wnd->text)+1); + ct->itext=DfRealloc(ct->itext,strlen(wnd->text)+1); strcpy(ct->itext, wnd->text); - if (!isMultiLine(wnd)) { + if (!DfIsMultiLine(wnd)) { char *cp = ct->itext+strlen(ct->itext)-1; if (*cp == '\n') *cp = '\0'; } } } - else if (ct->class == RADIOBUTTON || ct->class == CHECKBOX) + else if (ct->class == DF_RADIOBUTTON || ct->class == DF_CHECKBOX) ct->isetting = ct->setting; } } @@ -637,22 +637,22 @@ static void CtlCloseWindowMsg(DFWINDOW wnd) static void FixColors(DFWINDOW wnd) { - CTLWINDOW *ct = wnd->ct; + DF_CTLWINDOW *ct = wnd->ct; - if (ct->class != BUTTON) + if (ct->class != DF_BUTTON) { - if (ct->class != SPINBUTTON && ct->class != COMBOBOX) + if (ct->class != DF_SPINBUTTON && ct->class != DF_COMBOBOX) { - wnd->WindowColors[FRAME_COLOR][FG] = - GetParent(wnd)->WindowColors[FRAME_COLOR][FG]; - wnd->WindowColors[FRAME_COLOR][BG] = - GetParent(wnd)->WindowColors[FRAME_COLOR][BG]; - if (ct->class != EDITBOX && ct->class != LISTBOX) + wnd->WindowColors[DF_FRAME_COLOR][DF_FG] = + DfGetParent(wnd)->WindowColors[DF_FRAME_COLOR][DF_FG]; + wnd->WindowColors[DF_FRAME_COLOR][DF_BG] = + DfGetParent(wnd)->WindowColors[DF_FRAME_COLOR][DF_BG]; + if (ct->class != DF_EDITBOX && ct->class != DF_LISTBOX) { - wnd->WindowColors[STD_COLOR][FG] = - GetParent(wnd)->WindowColors[STD_COLOR][FG]; - wnd->WindowColors[STD_COLOR][BG] = - GetParent(wnd)->WindowColors[STD_COLOR][BG]; + wnd->WindowColors[DF_STD_COLOR][DF_FG] = + DfGetParent(wnd)->WindowColors[DF_STD_COLOR][DF_FG]; + wnd->WindowColors[DF_STD_COLOR][DF_BG] = + DfGetParent(wnd)->WindowColors[DF_STD_COLOR][DF_BG]; } } } @@ -660,85 +660,85 @@ static void FixColors(DFWINDOW wnd) /* -- generic window processor used by dialog box controls -- */ -static int ControlProc(DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2) +static int ControlProc(DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2) { - DBOX *db; + DF_DBOX *db; if (wnd == NULL) return FALSE; - db = GetParent(wnd) ? GetParent(wnd)->extension : NULL; + db = DfGetParent(wnd) ? DfGetParent(wnd)->extension : NULL; switch (msg) { - case CREATE_WINDOW: + case DFM_CREATE_WINDOW: CtlCreateWindowMsg(wnd); break; - case KEYBOARD: + case DFM_KEYBOARD: if (CtlKeyboardMsg(wnd, p1, p2)) return TRUE; break; - case PAINT: + case DFM_PAINT: FixColors(wnd); - if (GetClass(wnd) == EDITBOX || - GetClass(wnd) == LISTBOX || - GetClass(wnd) == TEXTBOX) - SetScrollBars(wnd); + if (DfGetClass(wnd) == DF_EDITBOX || + DfGetClass(wnd) == DF_LISTBOX || + DfGetClass(wnd) == DF_TEXTBOX) + DfSetScrollBars(wnd); break; - case BORDER: + case DFM_BORDER: FixColors(wnd); - if (GetClass(wnd) == EDITBOX) { - DFWINDOW oldFocus = inFocus; - inFocus = NULL; - DefaultWndProc(wnd, msg, p1, p2); - inFocus = oldFocus; + if (DfGetClass(wnd) == DF_EDITBOX) { + DFWINDOW oldFocus = DfInFocus; + DfInFocus = NULL; + DfDefaultWndProc(wnd, msg, p1, p2); + DfInFocus = oldFocus; return TRUE; } break; - case SETFOCUS: { - DFWINDOW pwnd = GetParent(wnd); + case DFM_SETFOCUS: { + DFWINDOW pwnd = DfGetParent(wnd); if (p1) { - DefaultWndProc(wnd, msg, p1, p2); + DfDefaultWndProc(wnd, msg, p1, p2); if (pwnd != NULL) { pwnd->dfocus = wnd; DfSendMessage(pwnd, DFM_COMMAND, - inFocusCommand(db), ENTERFOCUS); + inFocusCommand(db), DFM_ENTERFOCUS); } return TRUE; } else DfSendMessage(pwnd, DFM_COMMAND, - inFocusCommand(db), LEAVEFOCUS); + inFocusCommand(db), DFM_LEAVEFOCUS); break; } - case CLOSE_WINDOW: + case DFM_CLOSE_WINDOW: CtlCloseWindowMsg(wnd); break; default: break; } - return DefaultWndProc(wnd, msg, p1, p2); + return DfDefaultWndProc(wnd, msg, p1, p2); } /* ---- change the focus to the first control --- */ -static void FirstFocus(DBOX *db) +static void FirstFocus(DF_DBOX *db) { - CTLWINDOW *ct = db->ctl; + DF_CTLWINDOW *ct = db->ctl; if (ct != NULL) { - while (ct->class == TEXT || ct->class == BOX) { + while (ct->class == DF_TEXT || ct->class == DF_BOX) { ct++; if (ct->class == 0) return; } - DfSendMessage(ct->wnd, SETFOCUS, TRUE, 0); + DfSendMessage(ct->wnd, DFM_SETFOCUS, TRUE, 0); } } /* ---- change the focus to the next control --- */ -static void NextFocus(DBOX *db) +static void NextFocus(DF_DBOX *db) { - CTLWINDOW *ct = WindowControl(db, inFocus); + DF_CTLWINDOW *ct = WindowControl(db, DfInFocus); int looped = 0; if (ct != NULL) { @@ -752,15 +752,15 @@ static void NextFocus(DBOX *db) looped++; ct = db->ctl; } - } while (ct->class == TEXT || ct->class == BOX); - DfSendMessage(ct->wnd, SETFOCUS, TRUE, 0); + } while (ct->class == DF_TEXT || ct->class == DF_BOX); + DfSendMessage(ct->wnd, DFM_SETFOCUS, TRUE, 0); } } /* ---- change the focus to the previous control --- */ -static void PrevFocus(DBOX *db) +static void PrevFocus(DF_DBOX *db) { - CTLWINDOW *ct = WindowControl(db, inFocus); + DF_CTLWINDOW *ct = WindowControl(db, DfInFocus); int looped = 0; if (ct != NULL) { @@ -775,17 +775,17 @@ static void PrevFocus(DBOX *db) ct++; } --ct; - } while (ct->class == TEXT || ct->class == BOX); - DfSendMessage(ct->wnd, SETFOCUS, TRUE, 0); + } while (ct->class == DF_TEXT || ct->class == DF_BOX); + DfSendMessage(ct->wnd, DFM_SETFOCUS, TRUE, 0); } } -void SetFocusCursor(DFWINDOW wnd) +void DfSetFocusCursor(DFWINDOW wnd) { - if (wnd == inFocus) + if (wnd == DfInFocus) { - DfSendMessage(NULL, SHOW_CURSOR, 0, 0); - DfSendMessage(wnd, KEYBOARD_CURSOR, 1, 0); + DfSendMessage(NULL, DFM_SHOW_CURSOR, 0, 0); + DfSendMessage(wnd, DFM_KEYBOARD_CURSOR, 1, 0); } } diff --git a/rosapps/dflat32/dialbox.h b/rosapps/dflat32/dialbox.h index a32119d1d2a..e0898760328 100644 --- a/rosapps/dflat32/dialbox.h +++ b/rosapps/dflat32/dialbox.h @@ -5,47 +5,47 @@ #include -#define MAXCONTROLS 30 -#define MAXRADIOS 20 +#define DF_MAXCONTROLS 30 +#define DF_MAXRADIOS 20 -#define OFF FALSE -#define ON TRUE +#define DF_OFF FALSE +#define DF_ON TRUE /* -------- dialog box and control window structure ------- */ typedef struct { char *title; /* window title */ int x, y; /* relative coordinates */ int h, w; /* size */ -} DIALOGWINDOW; +} DF_DIALOGWINDOW; /* ------ one of these for each control window ------- */ typedef struct { - DIALOGWINDOW dwnd; - DFCLASS class; /* LISTBOX, BUTTON, etc */ + DF_DIALOGWINDOW dwnd; + DFCLASS class; /* DF_LISTBOX, DF_BUTTON, etc */ char *itext; /* initialized text */ int command; /* command code */ char *help; /* help mnemonic */ - BOOL isetting; /* initially ON or OFF */ - BOOL setting; /* ON or OFF */ + BOOL isetting; /* initially DF_ON or DF_OFF */ + BOOL setting; /* DF_ON or DF_OFF */ void *wnd; /* window handle */ -} CTLWINDOW; +} DF_CTLWINDOW; /* --------- one of these for each dialog box ------- */ typedef struct { char *HelpName; - DIALOGWINDOW dwnd; - CTLWINDOW ctl[MAXCONTROLS+1]; -} DBOX; + DF_DIALOGWINDOW dwnd; + DF_CTLWINDOW ctl[DF_MAXCONTROLS+1]; +} DF_DBOX; /* -------- macros for dialog box resource compile -------- */ -#define DIALOGBOX(db) DBOX db={ #db, -#define DB_TITLE(ttl,x,y,h,w) {ttl,x,y,h,w},{ -#define CONTROL(ty,tx,x,y,h,w,c) \ +#define DF_DIALOGBOX(db) DF_DBOX db={ #db, +#define DF_DB_TITLE(ttl,x,y,h,w) {ttl,x,y,h,w},{ +#define DF_CONTROL(ty,tx,x,y,h,w,c) \ {{NULL,x,y,h,w},ty, \ - (ty==EDITBOX||ty==COMBOBOX?NULL:tx), \ - c,#c,(ty==BUTTON?ON:OFF),OFF,NULL}, + (ty==DF_EDITBOX||ty==DF_COMBOBOX?NULL:tx), \ + c,#c,(ty==DF_BUTTON?DF_ON:DF_OFF),DF_OFF,NULL}, -#define ENDDB {{NULL}} }}; +#define DF_ENDDB {{NULL}} }}; #define Cancel " Cancel " #define Ok " OK " diff --git a/rosapps/dflat32/dialogs.c b/rosapps/dflat32/dialogs.c index 09fd022f12c..4719349b8fa 100644 --- a/rosapps/dflat32/dialogs.c +++ b/rosapps/dflat32/dialogs.c @@ -3,158 +3,158 @@ #include "dflat.h" /* -------------- the File Open dialog box --------------- */ -DIALOGBOX( FileOpen ) - DB_TITLE( "Open File", -1,-1,19,48) - CONTROL(TEXT, "~Filename", 2, 1, 1, 8, ID_FILENAME) - CONTROL(EDITBOX, NULL, 13, 1, 1,29, ID_FILENAME) - CONTROL(TEXT, "Directory:", 2, 3, 1,10, 0) - CONTROL(TEXT, NULL, 13, 3, 1,28, ID_PATH) - CONTROL(TEXT, "F~iles", 2, 5, 1, 5, ID_FILES) - CONTROL(LISTBOX, NULL, 2, 6,11,16, ID_FILES) - CONTROL(TEXT, "~Directories", 19, 5, 1,11, ID_DRIVE) - CONTROL(LISTBOX, NULL, 19, 6,11,16, ID_DRIVE) - CONTROL(BUTTON, " ~OK ", 36, 7, 1, 8, ID_OK) - CONTROL(BUTTON, " ~Cancel ", 36,10, 1, 8, ID_CANCEL) - CONTROL(BUTTON, " ~Help ", 36,13, 1, 8, ID_HELP) -ENDDB +DF_DIALOGBOX( FileOpen ) + DF_DB_TITLE( "Open File", -1,-1,19,48) + DF_CONTROL(DF_TEXT, "~Filename", 2, 1, 1, 8, DF_ID_FILENAME) + DF_CONTROL(DF_EDITBOX, NULL, 13, 1, 1,29, DF_ID_FILENAME) + DF_CONTROL(DF_TEXT, "Directory:", 2, 3, 1,10, 0) + DF_CONTROL(DF_TEXT, NULL, 13, 3, 1,28, DF_ID_PATH) + DF_CONTROL(DF_TEXT, "F~iles", 2, 5, 1, 5, DF_ID_FILES) + DF_CONTROL(DF_LISTBOX, NULL, 2, 6,11,16, DF_ID_FILES) + DF_CONTROL(DF_TEXT, "~Directories", 19, 5, 1,11, DF_ID_DRIVE) + DF_CONTROL(DF_LISTBOX, NULL, 19, 6,11,16, DF_ID_DRIVE) + DF_CONTROL(DF_BUTTON, " ~OK ", 36, 7, 1, 8, DF_ID_OK) + DF_CONTROL(DF_BUTTON, " ~Cancel ", 36,10, 1, 8, DF_ID_CANCEL) + DF_CONTROL(DF_BUTTON, " ~Help ", 36,13, 1, 8, DF_ID_HELP) +DF_ENDDB /* -------------- the Save As dialog box --------------- */ -DIALOGBOX( SaveAs ) - DB_TITLE( "Save As", -1,-1,19,48) - CONTROL(TEXT, "~Filename", 2, 1, 1, 8, ID_FILENAME) - CONTROL(EDITBOX, NULL, 13, 1, 1,29, ID_FILENAME) - CONTROL(TEXT, "Directory:", 2, 3, 1,10, 0) - CONTROL(TEXT, NULL, 13, 3, 1,28, ID_PATH) - CONTROL(TEXT, "~Directories",2, 5, 1,11, ID_DRIVE) - CONTROL(LISTBOX, NULL, 2, 6,11,16, ID_DRIVE) - CONTROL(BUTTON, " ~OK ", 36, 7, 1, 8, ID_OK) - CONTROL(BUTTON, " ~Cancel ", 36,10, 1, 8, ID_CANCEL) - CONTROL(BUTTON, " ~Help ", 36,13, 1, 8, ID_HELP) -ENDDB +DF_DIALOGBOX( SaveAs ) + DF_DB_TITLE( "Save As", -1,-1,19,48) + DF_CONTROL(DF_TEXT, "~Filename", 2, 1, 1, 8, DF_ID_FILENAME) + DF_CONTROL(DF_EDITBOX, NULL, 13, 1, 1,29, DF_ID_FILENAME) + DF_CONTROL(DF_TEXT, "Directory:", 2, 3, 1,10, 0) + DF_CONTROL(DF_TEXT, NULL, 13, 3, 1,28, DF_ID_PATH) + DF_CONTROL(DF_TEXT, "~Directories",2, 5, 1,11, DF_ID_DRIVE) + DF_CONTROL(DF_LISTBOX, NULL, 2, 6,11,16, DF_ID_DRIVE) + DF_CONTROL(DF_BUTTON, " ~OK ", 36, 7, 1, 8, DF_ID_OK) + DF_CONTROL(DF_BUTTON, " ~Cancel ", 36,10, 1, 8, DF_ID_CANCEL) + DF_CONTROL(DF_BUTTON, " ~Help ", 36,13, 1, 8, DF_ID_HELP) +DF_ENDDB /* -------------- The Printer Setup dialog box ------------------ */ -DIALOGBOX( PrintSetup ) - DB_TITLE( "Printer Setup", -1, -1, 17, 32) - CONTROL(BOX, "Margins", 2, 3, 9, 26, 0 ) - CONTROL(TEXT, "~Port:", 4, 1, 1, 5, ID_PRINTERPORT) - CONTROL(COMBOBOX, NULL, 12, 1, 8, 9, ID_PRINTERPORT) - CONTROL(TEXT, "~Left:", 6, 4, 1, 5, ID_LEFTMARGIN) - CONTROL(SPINBUTTON, NULL, 17, 4, 1, 6, ID_LEFTMARGIN) - CONTROL(TEXT, "~Right:", 6, 6, 1, 6, ID_RIGHTMARGIN) - CONTROL(SPINBUTTON, NULL, 17, 6, 1, 6, ID_RIGHTMARGIN) - CONTROL(TEXT, "~Top:", 6, 8, 1, 4, ID_TOPMARGIN) - CONTROL(SPINBUTTON, NULL, 17, 8, 1, 6, ID_TOPMARGIN) - CONTROL(TEXT, "~Bottom:", 6, 10, 1, 7, ID_BOTTOMMARGIN) - CONTROL(SPINBUTTON, NULL, 17, 10, 1, 6, ID_BOTTOMMARGIN) - CONTROL(BUTTON, " ~OK ", 1, 13, 1, 8, ID_OK) - CONTROL(BUTTON, " ~Cancel ", 11, 13, 1, 8, ID_CANCEL) - CONTROL(BUTTON, " ~Help ", 21, 13, 1, 8, ID_HELP) -ENDDB +DF_DIALOGBOX( PrintSetup ) + DF_DB_TITLE( "Printer Setup", -1, -1, 17, 32) + DF_CONTROL(DF_BOX, "Margins", 2, 3, 9, 26, 0 ) + DF_CONTROL(DF_TEXT, "~Port:", 4, 1, 1, 5, DF_ID_PRINTERPORT) + DF_CONTROL(DF_COMBOBOX, NULL, 12, 1, 8, 9, DF_ID_PRINTERPORT) + DF_CONTROL(DF_TEXT, "~Left:", 6, 4, 1, 5, DF_ID_LEFTMARGIN) + DF_CONTROL(DF_SPINBUTTON, NULL, 17, 4, 1, 6, DF_ID_LEFTMARGIN) + DF_CONTROL(DF_TEXT, "~Right:", 6, 6, 1, 6, DF_ID_RIGHTMARGIN) + DF_CONTROL(DF_SPINBUTTON, NULL, 17, 6, 1, 6, DF_ID_RIGHTMARGIN) + DF_CONTROL(DF_TEXT, "~Top:", 6, 8, 1, 4, DF_ID_TOPMARGIN) + DF_CONTROL(DF_SPINBUTTON, NULL, 17, 8, 1, 6, DF_ID_TOPMARGIN) + DF_CONTROL(DF_TEXT, "~Bottom:", 6, 10, 1, 7, DF_ID_BOTTOMMARGIN) + DF_CONTROL(DF_SPINBUTTON, NULL, 17, 10, 1, 6, DF_ID_BOTTOMMARGIN) + DF_CONTROL(DF_BUTTON, " ~OK ", 1, 13, 1, 8, DF_ID_OK) + DF_CONTROL(DF_BUTTON, " ~Cancel ", 11, 13, 1, 8, DF_ID_CANCEL) + DF_CONTROL(DF_BUTTON, " ~Help ", 21, 13, 1, 8, DF_ID_HELP) +DF_ENDDB /* -------------- the Search Text dialog box --------------- */ -DIALOGBOX( SearchTextDB ) - DB_TITLE( "Search Text", -1,-1,9,48) - CONTROL(TEXT, "~Search for:", 2, 1, 1, 11, ID_SEARCHFOR) - CONTROL(EDITBOX, NULL, 14, 1, 1, 29, ID_SEARCHFOR) - CONTROL(TEXT, "~Match upper/lower case:", 2, 3, 1, 23, ID_MATCHCASE) - CONTROL(CHECKBOX, NULL, 26, 3, 1, 3, ID_MATCHCASE) - CONTROL(BUTTON, " ~OK ", 7, 5, 1, 8, ID_OK) - CONTROL(BUTTON, " ~Cancel ", 19, 5, 1, 8, ID_CANCEL) - CONTROL(BUTTON, " ~Help ", 31, 5, 1, 8, ID_HELP) -ENDDB +DF_DIALOGBOX( SearchTextDB ) + DF_DB_TITLE( "Search Text", -1,-1,9,48) + DF_CONTROL(DF_TEXT, "~Search for:", 2, 1, 1, 11, DF_ID_SEARCHFOR) + DF_CONTROL(DF_EDITBOX, NULL, 14, 1, 1, 29, DF_ID_SEARCHFOR) + DF_CONTROL(DF_TEXT, "~Match upper/lower case:", 2, 3, 1, 23, DF_ID_MATCHCASE) + DF_CONTROL(DF_CHECKBOX, NULL, 26, 3, 1, 3, DF_ID_MATCHCASE) + DF_CONTROL(DF_BUTTON, " ~OK ", 7, 5, 1, 8, DF_ID_OK) + DF_CONTROL(DF_BUTTON, " ~Cancel ", 19, 5, 1, 8, DF_ID_CANCEL) + DF_CONTROL(DF_BUTTON, " ~Help ", 31, 5, 1, 8, DF_ID_HELP) +DF_ENDDB /* -------------- the Replace Text dialog box --------------- */ -DIALOGBOX( ReplaceTextDB ) - DB_TITLE( "Replace Text", -1,-1,12,50) - CONTROL(TEXT, "~Search for:", 2, 1, 1, 11, ID_SEARCHFOR) - CONTROL(EDITBOX, NULL, 16, 1, 1, 29, ID_SEARCHFOR) - CONTROL(TEXT, "~Replace with:", 2, 3, 1, 13, ID_REPLACEWITH) - CONTROL(EDITBOX, NULL, 16, 3, 1, 29, ID_REPLACEWITH) - CONTROL(TEXT, "~Match upper/lower case:", 2, 5, 1, 23, ID_MATCHCASE) - CONTROL(CHECKBOX, NULL, 26, 5, 1, 3, ID_MATCHCASE) - CONTROL(TEXT, "Replace ~Every Match:", 2, 6, 1, 23, ID_REPLACEALL) - CONTROL(CHECKBOX, NULL, 26, 6, 1, 3, ID_REPLACEALL) - CONTROL(BUTTON, " ~OK ", 7, 8, 1, 8, ID_OK) - CONTROL(BUTTON, " ~Cancel ", 20, 8, 1, 8, ID_CANCEL) - CONTROL(BUTTON, " ~Help ", 33, 8, 1, 8, ID_HELP) -ENDDB +DF_DIALOGBOX( ReplaceTextDB ) + DF_DB_TITLE( "Replace Text", -1,-1,12,50) + DF_CONTROL(DF_TEXT, "~Search for:", 2, 1, 1, 11, DF_ID_SEARCHFOR) + DF_CONTROL(DF_EDITBOX, NULL, 16, 1, 1, 29, DF_ID_SEARCHFOR) + DF_CONTROL(DF_TEXT, "~Replace with:", 2, 3, 1, 13, DF_ID_REPLACEWITH) + DF_CONTROL(DF_EDITBOX, NULL, 16, 3, 1, 29, DF_ID_REPLACEWITH) + DF_CONTROL(DF_TEXT, "~Match upper/lower case:", 2, 5, 1, 23, DF_ID_MATCHCASE) + DF_CONTROL(DF_CHECKBOX, NULL, 26, 5, 1, 3, DF_ID_MATCHCASE) + DF_CONTROL(DF_TEXT, "Replace ~Every Match:", 2, 6, 1, 23, DF_ID_REPLACEALL) + DF_CONTROL(DF_CHECKBOX, NULL, 26, 6, 1, 3, DF_ID_REPLACEALL) + DF_CONTROL(DF_BUTTON, " ~OK ", 7, 8, 1, 8, DF_ID_OK) + DF_CONTROL(DF_BUTTON, " ~Cancel ", 20, 8, 1, 8, DF_ID_CANCEL) + DF_CONTROL(DF_BUTTON, " ~Help ", 33, 8, 1, 8, DF_ID_HELP) +DF_ENDDB /* -------------- generic message dialog box --------------- */ -DIALOGBOX( MsgBox ) - DB_TITLE( NULL, -1,-1, 0, 0) - CONTROL(TEXT, NULL, 1, 1, 0, 0, 0) - CONTROL(BUTTON, NULL, 0, 0, 1, 8, ID_OK) - CONTROL(0, NULL, 0, 0, 1, 8, ID_CANCEL) -ENDDB +DF_DIALOGBOX( MsgBox ) + DF_DB_TITLE( NULL, -1,-1, 0, 0) + DF_CONTROL(DF_TEXT, NULL, 1, 1, 0, 0, 0) + DF_CONTROL(DF_BUTTON, NULL, 0, 0, 1, 8, DF_ID_OK) + DF_CONTROL(0, NULL, 0, 0, 1, 8, DF_ID_CANCEL) +DF_ENDDB -/* ----------- InputBox Dialog Box ------------ */ -DIALOGBOX( InputBoxDB ) - DB_TITLE( NULL, -1,-1, 9, 0) - CONTROL(TEXT, NULL, 1, 1, 1, 0, 0) - CONTROL(EDITBOX, NULL, 1, 3, 1, 0, ID_INPUTTEXT) - CONTROL(BUTTON, " ~OK ", 0, 5, 1, 8, ID_OK) - CONTROL(BUTTON, " ~Cancel ", 0, 5, 1, 8, ID_CANCEL) -ENDDB +/* ----------- DfInputBox Dialog Box ------------ */ +DF_DIALOGBOX( InputBoxDB ) + DF_DB_TITLE( NULL, -1,-1, 9, 0) + DF_CONTROL(DF_TEXT, NULL, 1, 1, 1, 0, 0) + DF_CONTROL(DF_EDITBOX, NULL, 1, 3, 1, 0, DF_ID_INPUTTEXT) + DF_CONTROL(DF_BUTTON, " ~OK ", 0, 5, 1, 8, DF_ID_OK) + DF_CONTROL(DF_BUTTON, " ~Cancel ", 0, 5, 1, 8, DF_ID_CANCEL) +DF_ENDDB -/* ----------- SliderBox Dialog Box ------------- */ -DIALOGBOX( SliderBoxDB ) - DB_TITLE( NULL, -1,-1, 9, 0) - CONTROL(TEXT, NULL, 0, 1, 1, 0, 0) - CONTROL(TEXT, NULL, 0, 3, 1, 0, 0) - CONTROL(BUTTON, " Cancel ", 0, 5, 1, 8, ID_CANCEL) -ENDDB +/* ----------- DfSliderBox Dialog Box ------------- */ +DF_DIALOGBOX( SliderBoxDB ) + DF_DB_TITLE( NULL, -1,-1, 9, 0) + DF_CONTROL(DF_TEXT, NULL, 0, 1, 1, 0, 0) + DF_CONTROL(DF_TEXT, NULL, 0, 3, 1, 0, 0) + DF_CONTROL(DF_BUTTON, " Cancel ", 0, 5, 1, 8, DF_ID_CANCEL) +DF_ENDDB /* ------------ Display dialog box -------------- */ -DIALOGBOX( Display ) - DB_TITLE( "Display", -1, -1, 12, 35) +DF_DIALOGBOX( Display ) + DF_DB_TITLE( "Display", -1, -1, 12, 35) - CONTROL(BOX, "Window", 7, 1, 6,20, 0) - CONTROL(CHECKBOX, NULL, 9, 2, 1, 3, ID_TITLE) - CONTROL(TEXT, "~Title", 15, 2, 1, 5, ID_TITLE) - CONTROL(CHECKBOX, NULL, 9, 3, 1, 3, ID_BORDER) - CONTROL(TEXT, "~Border", 15, 3, 1, 6, ID_BORDER) - CONTROL(CHECKBOX, NULL, 9, 4, 1, 3, ID_STATUSBAR) - CONTROL(TEXT, "~Status bar",15, 4, 1,10, ID_STATUSBAR) - CONTROL(CHECKBOX, NULL, 9, 5, 1, 3, ID_TEXTURE) - CONTROL(TEXT, "Te~xture", 15, 5, 1, 7, ID_TEXTURE) + DF_CONTROL(DF_BOX, "Window", 7, 1, 6,20, 0) + DF_CONTROL(DF_CHECKBOX, NULL, 9, 2, 1, 3, DF_ID_TITLE) + DF_CONTROL(DF_TEXT, "~Title", 15, 2, 1, 5, DF_ID_TITLE) + DF_CONTROL(DF_CHECKBOX, NULL, 9, 3, 1, 3, DF_ID_BORDER) + DF_CONTROL(DF_TEXT, "~Border", 15, 3, 1, 6, DF_ID_BORDER) + DF_CONTROL(DF_CHECKBOX, NULL, 9, 4, 1, 3, DF_ID_STATUSBAR) + DF_CONTROL(DF_TEXT, "~Status bar",15, 4, 1,10, DF_ID_STATUSBAR) + DF_CONTROL(DF_CHECKBOX, NULL, 9, 5, 1, 3, DF_ID_TEXTURE) + DF_CONTROL(DF_TEXT, "Te~xture", 15, 5, 1, 7, DF_ID_TEXTURE) - CONTROL(BUTTON, " ~OK ", 2, 8,1,8,ID_OK) - CONTROL(BUTTON, " ~Cancel ", 12, 8,1,8,ID_CANCEL) - CONTROL(BUTTON, " ~Help ", 22, 8,1,8,ID_HELP) -ENDDB + DF_CONTROL(DF_BUTTON, " ~OK ", 2, 8,1,8,DF_ID_OK) + DF_CONTROL(DF_BUTTON, " ~Cancel ", 12, 8,1,8,DF_ID_CANCEL) + DF_CONTROL(DF_BUTTON, " ~Help ", 22, 8,1,8,DF_ID_HELP) +DF_ENDDB /* ------------ Windows dialog box -------------- */ -DIALOGBOX( Windows ) - DB_TITLE( "Windows", -1, -1, 19, 24) - CONTROL(LISTBOX, NULL, 1, 1,11,20, ID_WINDOWLIST) - CONTROL(BUTTON, " ~OK ", 2, 13, 1, 8, ID_OK) - CONTROL(BUTTON, " ~Cancel ", 12, 13, 1, 8, ID_CANCEL) - CONTROL(BUTTON, " ~Help ", 7, 15, 1, 8, ID_HELP) -ENDDB +DF_DIALOGBOX( Windows ) + DF_DB_TITLE( "Windows", -1, -1, 19, 24) + DF_CONTROL(DF_LISTBOX, NULL, 1, 1,11,20, DF_ID_WINDOWLIST) + DF_CONTROL(DF_BUTTON, " ~OK ", 2, 13, 1, 8, DF_ID_OK) + DF_CONTROL(DF_BUTTON, " ~Cancel ", 12, 13, 1, 8, DF_ID_CANCEL) + DF_CONTROL(DF_BUTTON, " ~Help ", 7, 15, 1, 8, DF_ID_HELP) +DF_ENDDB #ifdef INCLUDE_LOGGING /* ------------ Message Log dialog box -------------- */ -DIALOGBOX( Log ) - DB_TITLE( "D-Flat Message Log", -1, -1, 18, 41) - CONTROL(TEXT, "~Messages", 10, 1, 1, 8, ID_LOGLIST) - CONTROL(LISTBOX, NULL, 1, 2, 14, 26, ID_LOGLIST) - CONTROL(TEXT, "~Logging:", 29, 4, 1, 10, ID_LOGGING) - CONTROL(CHECKBOX, NULL, 31, 5, 1, 3, ID_LOGGING) - CONTROL(BUTTON, " ~OK ", 29, 7, 1, 8, ID_OK) - CONTROL(BUTTON, " ~Cancel ", 29, 10, 1, 8, ID_CANCEL) - CONTROL(BUTTON, " ~Help ", 29, 13, 1, 8, ID_HELP) -ENDDB +DF_DIALOGBOX( Log ) + DF_DB_TITLE( "D-Flat Message Log", -1, -1, 18, 41) + DF_CONTROL(DF_TEXT, "~Messages", 10, 1, 1, 8, DF_ID_LOGLIST) + DF_CONTROL(DF_LISTBOX, NULL, 1, 2, 14, 26, DF_ID_LOGLIST) + DF_CONTROL(DF_TEXT, "~Logging:", 29, 4, 1, 10, DF_ID_LOGGING) + DF_CONTROL(DF_CHECKBOX, NULL, 31, 5, 1, 3, DF_ID_LOGGING) + DF_CONTROL(DF_BUTTON, " ~OK ", 29, 7, 1, 8, DF_ID_OK) + DF_CONTROL(DF_BUTTON, " ~Cancel ", 29, 10, 1, 8, DF_ID_CANCEL) + DF_CONTROL(DF_BUTTON, " ~Help ", 29, 13, 1, 8, DF_ID_HELP) +DF_ENDDB #endif /* ------------ the Help window dialog box -------------- */ -DIALOGBOX( HelpBox ) - DB_TITLE( NULL, -1, -1, 0, 45) - CONTROL(TEXTBOX, NULL, 1, 1, 0, 40, ID_HELPTEXT) - CONTROL(BUTTON, " ~Close ", 0, 0, 1, 8, ID_CANCEL) - CONTROL(BUTTON, " ~Back ", 10, 0, 1, 8, ID_BACK) - CONTROL(BUTTON, "<< ~Prev ", 20, 0, 1, 8, ID_PREV) - CONTROL(BUTTON, " ~Next >>", 30, 0, 1, 8, ID_NEXT) -ENDDB +DF_DIALOGBOX( HelpBox ) + DF_DB_TITLE( NULL, -1, -1, 0, 45) + DF_CONTROL(DF_TEXTBOX, NULL, 1, 1, 0, 40, DF_ID_HELPTEXT) + DF_CONTROL(DF_BUTTON, " ~Close ", 0, 0, 1, 8, DF_ID_CANCEL) + DF_CONTROL(DF_BUTTON, " ~Back ", 10, 0, 1, 8, DF_ID_BACK) + DF_CONTROL(DF_BUTTON, "<< ~Prev ", 20, 0, 1, 8, DF_ID_PREV) + DF_CONTROL(DF_BUTTON, " ~Next >>", 30, 0, 1, 8, DF_ID_NEXT) +DF_ENDDB /* EOF */ diff --git a/rosapps/dflat32/direct.c b/rosapps/dflat32/direct.c index 4635d44ef54..afb4b09857d 100644 --- a/rosapps/dflat32/direct.c +++ b/rosapps/dflat32/direct.c @@ -19,7 +19,7 @@ static char ext[_MAX_EXT]; /* ----- Create unambiguous path from file spec, filling in the drive and directory if incomplete. Optionally change to the new drive and subdirectory ------ */ -void CreatePath(char *path,char *fspec,int InclName,int Change) +void DfCreatePath(char *path,char *fspec,int InclName,int Change) { int cm = 0; char currdir[MAX_PATH]; @@ -83,20 +83,20 @@ static int dircmp(const void *c1, const void *c2) BOOL DfDlgDirList(DFWINDOW wnd, char *fspec, - enum commands nameid, enum commands pathid, + enum DfCommands nameid, enum DfCommands pathid, unsigned attrib) { int ax, i = 0; struct _finddata_t ff; - CTLWINDOW *ct = FindCommand(wnd->extension,nameid,LISTBOX); + DF_CTLWINDOW *ct = DfFindCommand(wnd->extension,nameid,DF_LISTBOX); DFWINDOW lwnd; char **dirlist = NULL; - CreatePath(path, fspec, TRUE, TRUE); + DfCreatePath(path, fspec, TRUE, TRUE); if (ct != NULL) { lwnd = ct->wnd; - DfSendMessage(ct->wnd, CLEARTEXT, 0, 0); + DfSendMessage(ct->wnd, DFM_CLEARTEXT, 0, 0); if (attrib & 0x8000) { @@ -122,10 +122,10 @@ BOOL DfDlgDirList(DFWINDOW wnd, char *fspec, strcat(drname, " (RAMdisk)"); } #endif - DfSendMessage(lwnd,ADDTEXT,(PARAM)drname,0); + DfSendMessage(lwnd,DFM_ADDTEXT,(DF_PARAM)drname,0); } } - DfSendMessage(lwnd, PAINT, 0, 0); + DfSendMessage(lwnd, DFM_PAINT, 0, 0); } ax = _findfirst(path, &ff); if (ax == -1) @@ -139,9 +139,9 @@ BOOL DfDlgDirList(DFWINDOW wnd, char *fspec, char fname[MAX_PATH+2]; sprintf(fname, (ff.attrib & FILE_ATTRIBUTE_DIRECTORY) ? "[%s]" : "%s" , ff.name); - dirlist = DFrealloc(dirlist, + dirlist = DfRealloc(dirlist, sizeof(char *)*(i+1)); - dirlist[i] = DFmalloc(strlen(fname)+1); + dirlist[i] = DfMalloc(strlen(fname)+1); if (dirlist[i] != NULL) strcpy(dirlist[i], fname); i++; @@ -157,17 +157,17 @@ BOOL DfDlgDirList(DFWINDOW wnd, char *fspec, /* ---- send sorted list to list box ---- */ for (j = 0; j < i; j++) { - DfSendMessage(lwnd,ADDTEXT,(PARAM)dirlist[j],0); + DfSendMessage(lwnd,DFM_ADDTEXT,(DF_PARAM)dirlist[j],0); free(dirlist[j]); } free(dirlist); } - DfSendMessage(lwnd, SHOW_WINDOW, 0, 0); + DfSendMessage(lwnd, DFM_SHOW_WINDOW, 0, 0); } if (pathid) { _makepath(path, drive, dir, NULL, NULL); - PutItemText(wnd, pathid, path); + DfPutItemText(wnd, pathid, path); } return TRUE; } diff --git a/rosapps/dflat32/edit.c b/rosapps/dflat32/edit.c index e8cbab8e018..a323e1e34d7 100644 --- a/rosapps/dflat32/edit.c +++ b/rosapps/dflat32/edit.c @@ -2,7 +2,7 @@ #include "dflat.h" -extern DBOX PrintSetup; +extern DF_DBOX PrintSetup; char DFlatApplication[] = "Edit"; @@ -10,7 +10,7 @@ static char Untitled[] = "Untitled"; static int wndpos; -static int MemoPadProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); +static int MemoPadProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); static void NewFile(DFWINDOW,char *); static void SelectFile(DFWINDOW); static void PadWindow(DFWINDOW, char *); @@ -19,9 +19,9 @@ static void LoadFile(DFWINDOW); static void PrintPad(DFWINDOW); static void SaveFile(DFWINDOW, int); static void EditDeleteFile(DFWINDOW); -static int EditorProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); +static int EditorProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); static char *NameComponent(char *); -static int PrintSetupProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); +static int PrintSetupProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); static void FixTabMenu(void); #ifndef TURBOC void Calendar(DFWINDOW); @@ -41,23 +41,23 @@ int main (int argc, char *argv[]) return 1; Argv = argv; - LoadConfig (); -// if (!LoadConfig()) -// cfg.ScreenLines = SCREENHEIGHT; - wnd = DfCreateWindow (APPLICATION, - "FreeDos Edit " VERSION, + DfLoadConfig (); +// if (!DfLoadConfig()) +// DfCfg.ScreenLines = DF_SCREENHEIGHT; + wnd = DfDfCreateWindow (DF_APPLICATION, + "FreeDos Edit " DF_VERSION, 0, 0, -1, -1, - &MainMenu, + &DfMainMenu, NULL, MemoPadProc, -// MOVEABLE | -// SIZEABLE | -// HASBORDER | -// MINMAXBOX | - HASSTATUSBAR); +// DF_MOVEABLE | +// DF_SIZEABLE | +// DF_HASBORDER | +// DF_MINMAXBOX | + DF_HASSTATUSBAR); - LoadHelpFile (); - DfSendMessage (wnd, SETFOCUS, TRUE, 0); + DfLoadHelpFile (); + DfSendMessage (wnd, DFM_SETFOCUS, TRUE, 0); // Load the files from args - if the file does not exist, open a new window.... while (argc > 1) @@ -90,9 +90,9 @@ static void PadWindow(DFWINDOW wnd, char *FileName) char path[MAX_PATH]; char *cp; - CreatePath(path, FileName, FALSE, FALSE); + DfCreatePath(path, FileName, FALSE, FALSE); cp = path+strlen(path); - CreatePath(path, FileName, TRUE, FALSE); + DfCreatePath(path, FileName, TRUE, FALSE); ax = _findfirst(path, &ff); if (ax == -1) return; @@ -107,92 +107,92 @@ static void PadWindow(DFWINDOW wnd, char *FileName) /* ------- window processing module for the Edit application window ----- */ -static int MemoPadProc(DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2) +static int MemoPadProc(DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2) { int rtn; switch (msg) { - case CREATE_WINDOW: - rtn = DefaultWndProc(wnd, msg, p1, p2); - if (cfg.InsertMode) - SetCommandToggle(&MainMenu, ID_INSERT); - if (cfg.WordWrap) - SetCommandToggle(&MainMenu, ID_WRAP); + case DFM_CREATE_WINDOW: + rtn = DfDefaultWndProc(wnd, msg, p1, p2); + if (DfCfg.InsertMode) + DfSetCommandToggle(&DfMainMenu, DF_ID_INSERT); + if (DfCfg.WordWrap) + DfSetCommandToggle(&DfMainMenu, DF_ID_WRAP); FixTabMenu(); return rtn; case DFM_COMMAND: switch ((int)p1) { - case ID_NEW: + case DF_ID_NEW: NewFile(wnd,NULL); return TRUE; - case ID_OPEN: + case DF_ID_OPEN: SelectFile(wnd); return TRUE; - case ID_SAVE: - SaveFile(inFocus, FALSE); + case DF_ID_SAVE: + SaveFile(DfInFocus, FALSE); return TRUE; - case ID_SAVEAS: - SaveFile(inFocus, TRUE); + case DF_ID_SAVEAS: + SaveFile(DfInFocus, TRUE); return TRUE; - case ID_DELETEFILE: - EditDeleteFile(inFocus); + case DF_ID_DELETEFILE: + EditDeleteFile(DfInFocus); return TRUE; - case ID_PRINTSETUP: + case DF_ID_PRINTSETUP: DfDialogBox(wnd, &PrintSetup, TRUE, PrintSetupProc); return TRUE; - case ID_PRINT: - PrintPad(inFocus); + case DF_ID_PRINT: + PrintPad(DfInFocus); return TRUE; - case ID_EXIT: + case DF_ID_EXIT: if (!DfYesNoBox("Exit FreeDos Edit?")) return FALSE; break; - case ID_WRAP: - cfg.WordWrap = GetCommandToggle(&MainMenu, ID_WRAP); + case DF_ID_WRAP: + DfCfg.WordWrap = DfGetCommandToggle(&DfMainMenu, DF_ID_WRAP); return TRUE; - case ID_INSERT: - cfg.InsertMode = GetCommandToggle(&MainMenu, ID_INSERT); + case DF_ID_INSERT: + DfCfg.InsertMode = DfGetCommandToggle(&DfMainMenu, DF_ID_INSERT); return TRUE; - case ID_TAB2: - cfg.Tabs = 2; + case DF_ID_TAB2: + DfCfg.Tabs = 2; FixTabMenu(); return TRUE; - case ID_TAB4: - cfg.Tabs = 4; + case DF_ID_TAB4: + DfCfg.Tabs = 4; FixTabMenu(); return TRUE; - case ID_TAB6: - cfg.Tabs = 6; + case DF_ID_TAB6: + DfCfg.Tabs = 6; FixTabMenu(); return TRUE; - case ID_TAB8: - cfg.Tabs = 8; + case DF_ID_TAB8: + DfCfg.Tabs = 8; FixTabMenu(); return TRUE; - case ID_CALENDAR: + case DF_ID_CALENDAR: Calendar(wnd); return TRUE; -// case ID_BARCHART: +// case DF_ID_BARCHART: // BarChart(wnd); // return TRUE; - case ID_ABOUT: + case DF_ID_ABOUT: DfMessageBox( "About D-Flat and FreeDos Edit", " ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\n" @@ -220,7 +220,7 @@ static int MemoPadProc(DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2) break; } - return DefaultWndProc(wnd, msg, p1, p2); + return DfDefaultWndProc(wnd, msg, p1, p2); } /* --- The New command. Open an empty editor window --- */ @@ -234,20 +234,20 @@ static void SelectFile(DFWINDOW wnd) { char FileName[MAX_PATH]; - if (OpenFileDialogBox("*.*", FileName)) + if (DfOpenFileDialogBox("*.*", FileName)) { /* see if the document is already in a window */ - DFWINDOW wnd1 = FirstWindow(wnd); + DFWINDOW wnd1 = DfFirstWindow(wnd); while (wnd1 != NULL) { if (wnd1->extension && stricmp(FileName, wnd1->extension) == 0) { - DfSendMessage(wnd1, SETFOCUS, TRUE, 0); - DfSendMessage(wnd1, RESTORE, 0, 0); + DfSendMessage(wnd1, DFM_SETFOCUS, TRUE, 0); + DfSendMessage(wnd1, DFM_RESTORE, 0, 0); return; } - wnd1 = NextWindow(wnd1); + wnd1 = DfNextWindow(wnd1); } OpenPadWindow(wnd, FileName, NULL); } @@ -267,7 +267,7 @@ static void OpenPadWindow(DFWINDOW wnd, char *FileName,char *NewFileName) { if (stat(FileName, &sb)) { - ermsg = DFmalloc(strlen(FileName)+20); + ermsg = DfMalloc(strlen(FileName)+20); strcpy(ermsg, "No such file as\n"); strcat(ermsg, FileName); DfErrorMessage(ermsg); @@ -280,7 +280,7 @@ static void OpenPadWindow(DFWINDOW wnd, char *FileName,char *NewFileName) // check file size if (sb.st_size > 64000) { - ermsg = DFmalloc(strlen(FileName)+20); + ermsg = DfMalloc(strlen(FileName)+20); strcpy(ermsg, "File too large for this version of Edit\n"); DfErrorMessage(ermsg); free(ermsg); @@ -288,7 +288,7 @@ static void OpenPadWindow(DFWINDOW wnd, char *FileName,char *NewFileName) } } - wwnd = WatchIcon(); + wwnd = DfWatchIcon(); wndpos += 2; if (NewFileName != NULL) @@ -297,29 +297,29 @@ static void OpenPadWindow(DFWINDOW wnd, char *FileName,char *NewFileName) if (wndpos == 20) wndpos = 2; - wnd1 = DfCreateWindow(EDITBOX, + wnd1 = DfDfCreateWindow(DF_EDITBOX, Fname, (wndpos-1)*2, wndpos, 10, 40, NULL, wnd, EditorProc, - SHADOW | - MINMAXBOX | - CONTROLBOX | - VSCROLLBAR | - HSCROLLBAR | - MOVEABLE | - HASBORDER | - SIZEABLE | - MULTILINE); + DF_SHADOW | + DF_MINMAXBOX | + DF_CONTROLBOX | + DF_VSCROLLBAR | + DF_HSCROLLBAR | + DF_MOVEABLE | + DF_HASBORDER | + DF_SIZEABLE | + DF_MULTILINE); if (strcmp(FileName, Untitled)) { - wnd1->extension = DFmalloc(strlen(FileName)+1); + wnd1->extension = DfMalloc(strlen(FileName)+1); strcpy(wnd1->extension, FileName); LoadFile(wnd1); } - DfSendMessage(wwnd, CLOSE_WINDOW, 0, 0); - DfSendMessage(wnd1, SETFOCUS, TRUE, 0); - DfSendMessage(wnd1, MAXIMIZE, 0, 0); + DfSendMessage(wwnd, DFM_CLOSE_WINDOW, 0, 0); + DfSendMessage(wnd1, DFM_SETFOCUS, TRUE, 0); + DfSendMessage(wnd1, DFM_MAXIMIZE, 0, 0); } /* --- Load the notepad file into the editor text buffer --- */ @@ -333,8 +333,8 @@ static void LoadFile(DFWINDOW wnd) { while (!feof(fp)) { - handshake(); - Buf = DFrealloc(Buf, recptr+150); + DfHandshake(); + Buf = DfRealloc(Buf, recptr+150); memset(Buf+recptr, 0, 150); fgets(Buf+recptr, 150, fp); recptr += strlen(Buf+recptr); @@ -342,7 +342,7 @@ static void LoadFile(DFWINDOW wnd) fclose(fp); if (Buf != NULL) { - DfSendMessage(wnd, SETTEXT, (PARAM) Buf, 0); + DfSendMessage(wnd, DFM_SETTEXT, (DF_PARAM) Buf, 0); free(Buf); } } @@ -356,16 +356,16 @@ static void PrintChar(FILE *prn, int c) { int i; - if (c == '\n' || CharCtr == cfg.RightMargin) + if (c == '\n' || CharCtr == DfCfg.RightMargin) { fputs("\r\n", prn); LineCtr++; - if (LineCtr == cfg.BottomMargin) + if (LineCtr == DfCfg.BottomMargin) { fputc('\f', prn); - for (i = 0; i < cfg.TopMargin; i++) + for (i = 0; i < DfCfg.TopMargin; i++) fputc('\n', prn); - LineCtr = cfg.TopMargin; + LineCtr = DfCfg.TopMargin; } CharCtr = 0; if (c == '\n') @@ -373,7 +373,7 @@ static void PrintChar(FILE *prn, int c) } if (CharCtr == 0) { - for (i = 0; i < cfg.LeftMargin; i++) + for (i = 0; i < DfCfg.LeftMargin; i++) { fputc(' ', prn); CharCtr++; @@ -386,16 +386,16 @@ static void PrintChar(FILE *prn, int c) /* --- print the current notepad --- */ static void PrintPad(DFWINDOW wnd) { - if (*cfg.PrinterPort) + if (*DfCfg.PrinterPort) { FILE *prn; - if ((prn = fopen(cfg.PrinterPort, "wt")) != NULL) + if ((prn = fopen(DfCfg.PrinterPort, "wt")) != NULL) { long percent; BOOL KeepPrinting = TRUE; - unsigned char *text = GetText(wnd); + unsigned char *text = DfGetText(wnd); unsigned oldpct = 100, cct = 0, len = strlen(text); - DFWINDOW swnd = SliderBox(20, GetTitle(wnd), "Printing"); + DFWINDOW swnd = DfSliderBox(20, DfGetTitle(wnd), "Printing"); /* ------- print the notepad text --------- */ LineCtr = CharCtr = 0; while (KeepPrinting && *text) @@ -405,13 +405,13 @@ static void PrintPad(DFWINDOW wnd) if ((int)percent != (int)oldpct) { oldpct = (int) percent; - KeepPrinting = DfSendMessage(swnd, PAINT, 0, oldpct); + KeepPrinting = DfSendMessage(swnd, DFM_PAINT, 0, oldpct); } } if (KeepPrinting) /* ---- user did not cancel ---- */ if (oldpct < 100) - DfSendMessage(swnd, PAINT, 0, 100); + DfSendMessage(swnd, DFM_PAINT, 0, 100); /* ------- follow with a form feed? --------- */ if (DfYesNoBox("Form Feed?")) fputc('\f', prn); @@ -430,27 +430,27 @@ static void SaveFile(DFWINDOW wnd, int Saveas) FILE *fp; if (wnd->extension == NULL || Saveas) { char FileName[MAX_PATH]; - if (SaveAsDialogBox(FileName)) { + if (DfSaveAsDialogBox(FileName)) { if (wnd->extension != NULL) free(wnd->extension); - wnd->extension = DFmalloc(strlen(FileName)+1); + wnd->extension = DfMalloc(strlen(FileName)+1); strcpy(wnd->extension, FileName); - AddTitle(wnd, NameComponent(FileName)); - DfSendMessage(wnd, BORDER, 0, 0); + DfAddTitle(wnd, NameComponent(FileName)); + DfSendMessage(wnd, DFM_BORDER, 0, 0); } else return; } if (wnd->extension != NULL) { - DFWINDOW mwnd = MomentaryMessage("Saving the file"); + DFWINDOW mwnd = DfMomentaryMessage("Saving the file"); if ((fp = fopen(wnd->extension, "wt")) != NULL) { - fwrite(GetText(wnd), strlen(GetText(wnd)), 1, fp); + fwrite(DfGetText(wnd), strlen(DfGetText(wnd)), 1, fp); fclose(fp); wnd->TextChanged = FALSE; } - DfSendMessage(mwnd, CLOSE_WINDOW, 0, 0); + DfSendMessage(mwnd, DFM_CLOSE_WINDOW, 0, 0); } } /* -------- delete a file ------------ */ @@ -464,7 +464,7 @@ static void EditDeleteFile(DFWINDOW wnd) sprintf(msg, "Delete %s?", fn); if (DfYesNoBox(msg)) { unlink(wnd->extension); - DfSendMessage(wnd, CLOSE_WINDOW, 0, 0); + DfSendMessage(wnd, DFM_CLOSE_WINDOW, 0, 0); } } } @@ -476,91 +476,91 @@ static void ShowPosition(DFWINDOW wnd) char status[30]; sprintf(status, "Line:%4d Column: %2d", wnd->CurrLine, wnd->CurrCol); - DfSendMessage(GetParent(wnd), ADDSTATUS, (PARAM) status, 0); + DfSendMessage(DfGetParent(wnd), DFM_ADDSTATUS, (DF_PARAM) status, 0); } /* window processing module for the editboxes */ -static int EditorProc(DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2) +static int EditorProc(DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2) { int rtn; switch (msg) { - case SETFOCUS: + case DFM_SETFOCUS: if ((int)p1) { - wnd->InsertMode = GetCommandToggle(&MainMenu, ID_INSERT); - wnd->WordWrapMode = GetCommandToggle(&MainMenu, ID_WRAP); + wnd->InsertMode = DfGetCommandToggle(&DfMainMenu, DF_ID_INSERT); + wnd->WordWrapMode = DfGetCommandToggle(&DfMainMenu, DF_ID_WRAP); } - rtn = DefaultWndProc(wnd, msg, p1, p2); + rtn = DfDefaultWndProc(wnd, msg, p1, p2); if ((int)p1 == FALSE) - DfSendMessage(GetParent(wnd), ADDSTATUS, 0, 0); + DfSendMessage(DfGetParent(wnd), DFM_ADDSTATUS, 0, 0); else ShowPosition(wnd); return rtn; - case KEYBOARD_CURSOR: - rtn = DefaultWndProc(wnd, msg, p1, p2); + case DFM_KEYBOARD_CURSOR: + rtn = DfDefaultWndProc(wnd, msg, p1, p2); ShowPosition(wnd); return rtn; case DFM_COMMAND: switch ((int) p1) { - case ID_SEARCH: + case DF_ID_SEARCH: DfSearchText(wnd); return TRUE; - case ID_REPLACE: + case DF_ID_REPLACE: DfReplaceText(wnd); return TRUE; - case ID_SEARCHNEXT: + case DF_ID_SEARCHNEXT: DfSearchNext(wnd); return TRUE; - case ID_CUT: - CopyToClipboard(wnd); - DfSendMessage(wnd, DFM_COMMAND, ID_DELETETEXT, 0); - DfSendMessage(wnd, PAINT, 0, 0); + case DF_ID_CUT: + DfCopyToClipboard(wnd); + DfSendMessage(wnd, DFM_COMMAND, DF_ID_DELETETEXT, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); return TRUE; - case ID_COPY: - CopyToClipboard(wnd); - ClearTextBlock(wnd); - DfSendMessage(wnd, PAINT, 0, 0); + case DF_ID_COPY: + DfCopyToClipboard(wnd); + DfClearTextBlock(wnd); + DfSendMessage(wnd, DFM_PAINT, 0, 0); return TRUE; - case ID_PASTE: - PasteFromClipboard(wnd); - DfSendMessage(wnd, PAINT, 0, 0); + case DF_ID_PASTE: + DfPasteFromClipboard(wnd); + DfSendMessage(wnd, DFM_PAINT, 0, 0); return TRUE; - case ID_DELETETEXT: - case ID_CLEAR: - rtn = DefaultWndProc(wnd, msg, p1, p2); - DfSendMessage(wnd, PAINT, 0, 0); + case DF_ID_DELETETEXT: + case DF_ID_CLEAR: + rtn = DfDefaultWndProc(wnd, msg, p1, p2); + DfSendMessage(wnd, DFM_PAINT, 0, 0); return rtn; - case ID_HELP: - DisplayHelp(wnd, "MEMOPADDOC"); + case DF_ID_HELP: + DfDisplayHelp(wnd, "MEMOPADDOC"); return TRUE; - case ID_WRAP: - DfSendMessage(GetParent(wnd), DFM_COMMAND, ID_WRAP, 0); - wnd->WordWrapMode = cfg.WordWrap; + case DF_ID_WRAP: + DfSendMessage(DfGetParent(wnd), DFM_COMMAND, DF_ID_WRAP, 0); + wnd->WordWrapMode = DfCfg.WordWrap; return TRUE; - case ID_INSERT: - DfSendMessage(GetParent(wnd), DFM_COMMAND, ID_INSERT, 0); - wnd->InsertMode = cfg.InsertMode; - DfSendMessage(NULL, SHOW_CURSOR, wnd->InsertMode, 0); + case DF_ID_INSERT: + DfSendMessage(DfGetParent(wnd), DFM_COMMAND, DF_ID_INSERT, 0); + wnd->InsertMode = DfCfg.InsertMode; + DfSendMessage(NULL, DFM_SHOW_CURSOR, wnd->InsertMode, 0); return TRUE; default: break; } break; - case CLOSE_WINDOW: + case DFM_CLOSE_WINDOW: if (wnd->TextChanged) { - char *cp = DFmalloc(25+strlen(GetTitle(wnd))); - DfSendMessage(wnd, SETFOCUS, TRUE, 0); - strcpy(cp, GetTitle(wnd)); + char *cp = DfMalloc(25+strlen(DfGetTitle(wnd))); + DfSendMessage(wnd, DFM_SETFOCUS, TRUE, 0); + strcpy(cp, DfGetTitle(wnd)); strcat(cp, "\nText changed. Save it?"); if (DfYesNoBox(cp)) - DfSendMessage(GetParent(wnd), DFM_COMMAND, ID_SAVE, 0); + DfSendMessage(DfGetParent(wnd), DFM_COMMAND, DF_ID_SAVE, 0); free(cp); } wndpos = 0; @@ -575,7 +575,7 @@ static int EditorProc(DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2) break; } - return DefaultWndProc(wnd, msg, p1, p2); + return DfDefaultWndProc(wnd, msg, p1, p2); } /* -- point to the name component of a file specification -- */ @@ -594,7 +594,7 @@ static char *ports[] = { NULL }; -static int PrintSetupProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +static int PrintSetupProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { int rtn, i = 0, mar; char marg[10]; @@ -602,63 +602,63 @@ static int PrintSetupProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) switch (msg) { - case CREATE_WINDOW: - rtn = DefaultWndProc(wnd, msg, p1, p2); - PutItemText(wnd, ID_PRINTERPORT, cfg.PrinterPort); + case DFM_CREATE_WINDOW: + rtn = DfDefaultWndProc(wnd, msg, p1, p2); + DfPutItemText(wnd, DF_ID_PRINTERPORT, DfCfg.PrinterPort); while (ports[i] != NULL) - PutComboListText(wnd, ID_PRINTERPORT, ports[i++]); + DfPutComboListText(wnd, DF_ID_PRINTERPORT, ports[i++]); for (mar = CHARSLINE; mar >= 0; --mar) { sprintf(marg, "%3d", mar); - PutItemText(wnd, ID_LEFTMARGIN, marg); - PutItemText(wnd, ID_RIGHTMARGIN, marg); + DfPutItemText(wnd, DF_ID_LEFTMARGIN, marg); + DfPutItemText(wnd, DF_ID_RIGHTMARGIN, marg); } for (mar = LINESPAGE; mar >= 0; --mar) { sprintf(marg, "%3d", mar); - PutItemText(wnd, ID_TOPMARGIN, marg); - PutItemText(wnd, ID_BOTTOMMARGIN, marg); + DfPutItemText(wnd, DF_ID_TOPMARGIN, marg); + DfPutItemText(wnd, DF_ID_BOTTOMMARGIN, marg); } - cwnd = ControlWindow(&PrintSetup, ID_LEFTMARGIN); - DfSendMessage(cwnd, LB_SETSELECTION, - CHARSLINE-cfg.LeftMargin, 0); - cwnd = ControlWindow(&PrintSetup, ID_RIGHTMARGIN); - DfSendMessage(cwnd, LB_SETSELECTION, - CHARSLINE-cfg.RightMargin, 0); - cwnd = ControlWindow(&PrintSetup, ID_TOPMARGIN); - DfSendMessage(cwnd, LB_SETSELECTION, - LINESPAGE-cfg.TopMargin, 0); - cwnd = ControlWindow(&PrintSetup, ID_BOTTOMMARGIN); - DfSendMessage(cwnd, LB_SETSELECTION, - LINESPAGE-cfg.BottomMargin, 0); + cwnd = DfControlWindow(&PrintSetup, DF_ID_LEFTMARGIN); + DfSendMessage(cwnd, DFM_LB_SETSELECTION, + CHARSLINE-DfCfg.LeftMargin, 0); + cwnd = DfControlWindow(&PrintSetup, DF_ID_RIGHTMARGIN); + DfSendMessage(cwnd, DFM_LB_SETSELECTION, + CHARSLINE-DfCfg.RightMargin, 0); + cwnd = DfControlWindow(&PrintSetup, DF_ID_TOPMARGIN); + DfSendMessage(cwnd, DFM_LB_SETSELECTION, + LINESPAGE-DfCfg.TopMargin, 0); + cwnd = DfControlWindow(&PrintSetup, DF_ID_BOTTOMMARGIN); + DfSendMessage(cwnd, DFM_LB_SETSELECTION, + LINESPAGE-DfCfg.BottomMargin, 0); return rtn; case DFM_COMMAND: - if ((int) p1 == ID_OK && (int) p2 == 0) + if ((int) p1 == DF_ID_OK && (int) p2 == 0) { - GetItemText(wnd, ID_PRINTERPORT, cfg.PrinterPort, 4); - cwnd = ControlWindow(&PrintSetup, ID_LEFTMARGIN); - cfg.LeftMargin = CHARSLINE - - DfSendMessage(cwnd, LB_CURRENTSELECTION, 0, 0); - cwnd = ControlWindow(&PrintSetup, ID_RIGHTMARGIN); - cfg.RightMargin = CHARSLINE - - DfSendMessage(cwnd, LB_CURRENTSELECTION, 0, 0); - cwnd = ControlWindow(&PrintSetup, ID_TOPMARGIN); - cfg.TopMargin = LINESPAGE - - DfSendMessage(cwnd, LB_CURRENTSELECTION, 0, 0); - cwnd = ControlWindow(&PrintSetup, ID_BOTTOMMARGIN); - cfg.BottomMargin = LINESPAGE - - DfSendMessage(cwnd, LB_CURRENTSELECTION, 0, 0); + DfGetItemText(wnd, DF_ID_PRINTERPORT, DfCfg.PrinterPort, 4); + cwnd = DfControlWindow(&PrintSetup, DF_ID_LEFTMARGIN); + DfCfg.LeftMargin = CHARSLINE - + DfSendMessage(cwnd, DFM_LB_CURRENTSELECTION, 0, 0); + cwnd = DfControlWindow(&PrintSetup, DF_ID_RIGHTMARGIN); + DfCfg.RightMargin = CHARSLINE - + DfSendMessage(cwnd, DFM_LB_CURRENTSELECTION, 0, 0); + cwnd = DfControlWindow(&PrintSetup, DF_ID_TOPMARGIN); + DfCfg.TopMargin = LINESPAGE - + DfSendMessage(cwnd, DFM_LB_CURRENTSELECTION, 0, 0); + cwnd = DfControlWindow(&PrintSetup, DF_ID_BOTTOMMARGIN); + DfCfg.BottomMargin = LINESPAGE - + DfSendMessage(cwnd, DFM_LB_CURRENTSELECTION, 0, 0); } break; default: break; } - return DefaultWndProc(wnd, msg, p1, p2); + return DfDefaultWndProc(wnd, msg, p1, p2); } static void FixTabMenu(void) { - char *cp = GetCommandText(&MainMenu, ID_TABS); + char *cp = DfGetCommandText(&DfMainMenu, DF_ID_TABS); char *p; if (cp != NULL) @@ -666,75 +666,75 @@ static void FixTabMenu(void) p = strchr(cp, '('); if (p != NULL) { -// *(p+1) = (char)(cfg.Tabs + '0'); -// if (GetClass(inFocus) == POPDOWNMENU) -// DfSendMessage(inFocus, PAINT, 0, 0); +// *(p+1) = (char)(DfCfg.Tabs + '0'); +// if (DfGetClass(DfInFocus) == DF_POPDOWNMENU) +// DfSendMessage(DfInFocus, DFM_PAINT, 0, 0); } } } -void PrepFileMenu(void *w, struct Menu *mnu) +void DfPrepFileMenu(void *w, struct DfMenu *mnu) { DFWINDOW wnd = w; - DeactivateCommand(&MainMenu, ID_SAVE); - DeactivateCommand(&MainMenu, ID_SAVEAS); - DeactivateCommand(&MainMenu, ID_DELETEFILE); - DeactivateCommand(&MainMenu, ID_PRINT); - if (wnd != NULL && GetClass(wnd) == EDITBOX) + DfDeactivateCommand(&DfMainMenu, DF_ID_SAVE); + DfDeactivateCommand(&DfMainMenu, DF_ID_SAVEAS); + DfDeactivateCommand(&DfMainMenu, DF_ID_DELETEFILE); + DfDeactivateCommand(&DfMainMenu, DF_ID_PRINT); + if (wnd != NULL && DfGetClass(wnd) == DF_EDITBOX) { - if (isMultiLine(wnd)) + if (DfIsMultiLine(wnd)) { - ActivateCommand(&MainMenu, ID_SAVE); - ActivateCommand(&MainMenu, ID_SAVEAS); - ActivateCommand(&MainMenu, ID_DELETEFILE); - ActivateCommand(&MainMenu, ID_PRINT); + DfActivateCommand(&DfMainMenu, DF_ID_SAVE); + DfActivateCommand(&DfMainMenu, DF_ID_SAVEAS); + DfActivateCommand(&DfMainMenu, DF_ID_DELETEFILE); + DfActivateCommand(&DfMainMenu, DF_ID_PRINT); } } } -void PrepSearchMenu(void *w, struct Menu *mnu) +void DfPrepSearchMenu(void *w, struct DfMenu *mnu) { DFWINDOW wnd = w; - DeactivateCommand(&MainMenu, ID_SEARCH); - DeactivateCommand(&MainMenu, ID_REPLACE); - DeactivateCommand(&MainMenu, ID_SEARCHNEXT); - if (wnd != NULL && GetClass(wnd) == EDITBOX) + DfDeactivateCommand(&DfMainMenu, DF_ID_SEARCH); + DfDeactivateCommand(&DfMainMenu, DF_ID_REPLACE); + DfDeactivateCommand(&DfMainMenu, DF_ID_SEARCHNEXT); + if (wnd != NULL && DfGetClass(wnd) == DF_EDITBOX) { - if (isMultiLine(wnd)) + if (DfIsMultiLine(wnd)) { - ActivateCommand(&MainMenu, ID_SEARCH); - ActivateCommand(&MainMenu, ID_REPLACE); - ActivateCommand(&MainMenu, ID_SEARCHNEXT); + DfActivateCommand(&DfMainMenu, DF_ID_SEARCH); + DfActivateCommand(&DfMainMenu, DF_ID_REPLACE); + DfActivateCommand(&DfMainMenu, DF_ID_SEARCHNEXT); } } } -void PrepEditMenu(void *w, struct Menu *mnu) +void DfPrepEditMenu(void *w, struct DfMenu *mnu) { DFWINDOW wnd = w; - DeactivateCommand(&MainMenu, ID_CUT); - DeactivateCommand(&MainMenu, ID_COPY); - DeactivateCommand(&MainMenu, ID_CLEAR); - DeactivateCommand(&MainMenu, ID_DELETETEXT); - DeactivateCommand(&MainMenu, ID_PARAGRAPH); - DeactivateCommand(&MainMenu, ID_PASTE); - DeactivateCommand(&MainMenu, ID_UNDO); - if (wnd != NULL && GetClass(wnd) == EDITBOX) + DfDeactivateCommand(&DfMainMenu, DF_ID_CUT); + DfDeactivateCommand(&DfMainMenu, DF_ID_COPY); + DfDeactivateCommand(&DfMainMenu, DF_ID_CLEAR); + DfDeactivateCommand(&DfMainMenu, DF_ID_DELETETEXT); + DfDeactivateCommand(&DfMainMenu, DF_ID_PARAGRAPH); + DfDeactivateCommand(&DfMainMenu, DF_ID_PASTE); + DfDeactivateCommand(&DfMainMenu, DF_ID_UNDO); + if (wnd != NULL && DfGetClass(wnd) == DF_EDITBOX) { - if (isMultiLine(wnd)) + if (DfIsMultiLine(wnd)) { - if (TextBlockMarked(wnd)) + if (DfTextBlockMarked(wnd)) { - ActivateCommand(&MainMenu, ID_CUT); - ActivateCommand(&MainMenu, ID_COPY); - ActivateCommand(&MainMenu, ID_CLEAR); - ActivateCommand(&MainMenu, ID_DELETETEXT); + DfActivateCommand(&DfMainMenu, DF_ID_CUT); + DfActivateCommand(&DfMainMenu, DF_ID_COPY); + DfActivateCommand(&DfMainMenu, DF_ID_CLEAR); + DfActivateCommand(&DfMainMenu, DF_ID_DELETETEXT); } - ActivateCommand(&MainMenu, ID_PARAGRAPH); - if (!TestAttribute(wnd, READONLY) && Clipboard != NULL) - ActivateCommand(&MainMenu, ID_PASTE); + DfActivateCommand(&DfMainMenu, DF_ID_PARAGRAPH); + if (!DfTestAttribute(wnd, DF_READONLY) && DfClipboard != NULL) + DfActivateCommand(&DfMainMenu, DF_ID_PASTE); if (wnd->DeletedText != NULL) - ActivateCommand(&MainMenu, ID_UNDO); + DfActivateCommand(&DfMainMenu, DF_ID_UNDO); } } } diff --git a/rosapps/dflat32/editbox.c b/rosapps/dflat32/editbox.c index cb7dc4731d7..1e2ed1958ae 100644 --- a/rosapps/dflat32/editbox.c +++ b/rosapps/dflat32/editbox.c @@ -1,7 +1,7 @@ /* ------------- editbox.c ------------ */ #include "dflat.h" -#define EditBufLen(wnd) (isMultiLine(wnd) ? EDITLEN : ENTRYLEN) +#define EditBufLen(wnd) (DfIsMultiLine(wnd) ? DF_EDITLEN : DF_ENTRYLEN) #define SetLinePointer(wnd, ln) (wnd->CurrLine = ln) #define isWhite(c) ((c)==' '||(c)=='\n') /* ---------- local prototypes ----------- */ @@ -23,30 +23,30 @@ static BOOL TextMarking; static int ButtonX, ButtonY; static int PrevY = -1; -/* ----------- CREATE_WINDOW Message ---------- */ +/* ----------- DFM_CREATE_WINDOW Message ---------- */ static int CreateWindowMsg(DFWINDOW wnd) { - int rtn = BaseWndProc(EDITBOX, wnd, CREATE_WINDOW, 0, 0); - wnd->MaxTextLength = MAXTEXTLEN+1; + int rtn = DfBaseWndProc(DF_EDITBOX, wnd, DFM_CREATE_WINDOW, 0, 0); + wnd->MaxTextLength = DF_MAXTEXTLEN+1; wnd->textlen = EditBufLen(wnd); wnd->InsertMode = TRUE; - DfSendMessage(wnd, CLEARTEXT, 0, 0); + DfSendMessage(wnd, DFM_CLEARTEXT, 0, 0); return rtn; } -/* ----------- SETTEXT Message ---------- */ -static int SetTextMsg(DFWINDOW wnd, PARAM p1) +/* ----------- DFM_SETTEXT Message ---------- */ +static int SetTextMsg(DFWINDOW wnd, DF_PARAM p1) { int rtn = FALSE; if (strlen((char *)p1) <= wnd->MaxTextLength) - rtn = BaseWndProc(EDITBOX, wnd, SETTEXT, p1, 0); + rtn = DfBaseWndProc(DF_EDITBOX, wnd, DFM_SETTEXT, p1, 0); return rtn; } -/* ----------- CLEARTEXT Message ------------ */ +/* ----------- DFM_CLEARTEXT Message ------------ */ static int ClearTextMsg(DFWINDOW wnd) { - int rtn = BaseWndProc(EDITBOX, wnd, CLEARTEXT, 0, 0); + int rtn = DfBaseWndProc(DF_EDITBOX, wnd, DFM_CLEARTEXT, 0, 0); unsigned blen = EditBufLen(wnd)+2; - wnd->text = DFrealloc(wnd->text, blen); + wnd->text = DfRealloc(wnd->text, blen); memset(wnd->text, 0, blen); wnd->wlines = 0; wnd->CurrLine = 0; @@ -58,30 +58,30 @@ static int ClearTextMsg(DFWINDOW wnd) wnd->TextChanged = FALSE; return rtn; } -/* ----------- ADDTEXT Message ---------- */ -static int AddTextMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* ----------- DFM_ADDTEXT Message ---------- */ +static int AddTextMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { int rtn = FALSE; if (strlen((char *)p1)+wnd->textlen <= wnd->MaxTextLength) { - rtn = BaseWndProc(EDITBOX, wnd, ADDTEXT, p1, p2); + rtn = DfBaseWndProc(DF_EDITBOX, wnd, DFM_ADDTEXT, p1, p2); if (rtn != FALSE) { - if (!isMultiLine(wnd)) { + if (!DfIsMultiLine(wnd)) { wnd->CurrLine = 0; wnd->CurrCol = strlen((char *)p1); - if (wnd->CurrCol >= ClientWidth(wnd)) { - wnd->wleft = wnd->CurrCol-ClientWidth(wnd); + if (wnd->CurrCol >= DfClientWidth(wnd)) { + wnd->wleft = wnd->CurrCol-DfClientWidth(wnd); wnd->CurrCol -= wnd->wleft; } wnd->BlkEndCol = wnd->CurrCol; - DfSendMessage(wnd, KEYBOARD_CURSOR, - WndCol, wnd->WndRow); + DfSendMessage(wnd, DFM_KEYBOARD_CURSOR, + DfWndCol, wnd->WndRow); } } } return rtn; } -/* ----------- GETTEXT Message ---------- */ -static int GetTextMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* ----------- DFM_GETTEXT Message ---------- */ +static int GetTextMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { char *cp1 = (char *)p1; char *cp2 = wnd->text; @@ -93,55 +93,55 @@ static int GetTextMsg(DFWINDOW wnd, PARAM p1, PARAM p2) } return FALSE; } -/* ----------- SETTEXTLENGTH Message ---------- */ +/* ----------- DFM_SETTEXTLENGTH Message ---------- */ static int SetTextLengthMsg(DFWINDOW wnd, unsigned int len) { - if (++len < MAXTEXTLEN) { + if (++len < DF_MAXTEXTLEN) { wnd->MaxTextLength = len; if (len < wnd->textlen) { - wnd->text=DFrealloc(wnd->text, len+2); + wnd->text=DfRealloc(wnd->text, len+2); wnd->textlen = len; *((wnd->text)+len) = '\0'; *((wnd->text)+len+1) = '\0'; - BuildTextPointers(wnd); + DfBuildTextPointers(wnd); } return TRUE; } return FALSE; } -/* ----------- KEYBOARD_CURSOR Message ---------- */ -static void KeyboardCursorMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* ----------- DFM_KEYBOARD_CURSOR Message ---------- */ +static void KeyboardCursorMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { wnd->CurrCol = (int)p1 + wnd->wleft; wnd->WndRow = (int)p2; wnd->CurrLine = (int)p2 + wnd->wtop; - if (wnd == inFocus) { - if (CharInView(wnd, (int)p1, (int)p2)) - DfSendMessage(NULL, SHOW_CURSOR, + if (wnd == DfInFocus) { + if (DfCharInView(wnd, (int)p1, (int)p2)) + DfSendMessage(NULL, DFM_SHOW_CURSOR, (wnd->InsertMode && !TextMarking), 0); else - DfSendMessage(NULL, HIDE_CURSOR, 0, 0); + DfSendMessage(NULL, DFM_HIDE_CURSOR, 0, 0); } } /* ----------- SIZE Message ---------- */ -int SizeMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +int SizeMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - int rtn = BaseWndProc(EDITBOX, wnd, DFM_SIZE, p1, p2); - if (WndCol > ClientWidth(wnd)-1) - wnd->CurrCol = ClientWidth(wnd)-1 + wnd->wleft; - if (wnd->WndRow > ClientHeight(wnd)-1) { - wnd->WndRow = ClientHeight(wnd)-1; + int rtn = DfBaseWndProc(DF_EDITBOX, wnd, DFM_DFM_SIZE, p1, p2); + if (DfWndCol > DfClientWidth(wnd)-1) + wnd->CurrCol = DfClientWidth(wnd)-1 + wnd->wleft; + if (wnd->WndRow > DfClientHeight(wnd)-1) { + wnd->WndRow = DfClientHeight(wnd)-1; SetLinePointer(wnd, wnd->WndRow+wnd->wtop); } - DfSendMessage(wnd, KEYBOARD_CURSOR, WndCol, wnd->WndRow); + DfSendMessage(wnd, DFM_KEYBOARD_CURSOR, DfWndCol, wnd->WndRow); return rtn; } -/* ----------- SCROLL Message ---------- */ -static int ScrollMsg(DFWINDOW wnd, PARAM p1) +/* ----------- DFM_SCROLL Message ---------- */ +static int ScrollMsg(DFWINDOW wnd, DF_PARAM p1) { int rtn = FALSE; - if (isMultiLine(wnd)) { - rtn = BaseWndProc(EDITBOX,wnd,SCROLL,p1,0); + if (DfIsMultiLine(wnd)) { + rtn = DfBaseWndProc(DF_EDITBOX,wnd,DFM_SCROLL,p1,0); if (rtn != FALSE) { if (p1) { /* -------- scrolling up --------- */ @@ -154,7 +154,7 @@ static int ScrollMsg(DFWINDOW wnd, PARAM p1) } else { /* -------- scrolling down --------- */ - if (wnd->WndRow == ClientHeight(wnd)-1) { + if (wnd->WndRow == DfClientHeight(wnd)-1) { if (wnd->CurrLine > 0) --wnd->CurrLine; StickEnd(wnd); @@ -162,52 +162,52 @@ static int ScrollMsg(DFWINDOW wnd, PARAM p1) else wnd->WndRow++; } - DfSendMessage(wnd,KEYBOARD_CURSOR,WndCol,wnd->WndRow); + DfSendMessage(wnd,DFM_KEYBOARD_CURSOR,DfWndCol,wnd->WndRow); } } return rtn; } -/* ----------- HORIZSCROLL Message ---------- */ -static int HorizScrollMsg(DFWINDOW wnd, PARAM p1) +/* ----------- DFM_HORIZSCROLL Message ---------- */ +static int HorizScrollMsg(DFWINDOW wnd, DF_PARAM p1) { int rtn = FALSE; - char *currchar = CurrChar; + char *currchar = DfCurrChar; if (!(p1 && wnd->CurrCol == wnd->wleft && *currchar == '\n')) { - rtn = BaseWndProc(EDITBOX, wnd, HORIZSCROLL, p1, 0); + rtn = DfBaseWndProc(DF_EDITBOX, wnd, DFM_HORIZSCROLL, p1, 0); if (rtn != FALSE) { if (wnd->CurrCol < wnd->wleft) wnd->CurrCol++; - else if (WndCol == ClientWidth(wnd)) + else if (DfWndCol == DfClientWidth(wnd)) --wnd->CurrCol; - DfSendMessage(wnd,KEYBOARD_CURSOR,WndCol,wnd->WndRow); + DfSendMessage(wnd,DFM_KEYBOARD_CURSOR,DfWndCol,wnd->WndRow); } } return rtn; } -/* ----------- SCROLLPAGE Message ---------- */ -static int ScrollPageMsg(DFWINDOW wnd, PARAM p1) +/* ----------- DFM_SCROLLPAGE Message ---------- */ +static int ScrollPageMsg(DFWINDOW wnd, DF_PARAM p1) { int rtn = FALSE; - if (isMultiLine(wnd)) { - rtn = BaseWndProc(EDITBOX, wnd, SCROLLPAGE, p1, 0); + if (DfIsMultiLine(wnd)) { + rtn = DfBaseWndProc(DF_EDITBOX, wnd, DFM_SCROLLPAGE, p1, 0); SetLinePointer(wnd, wnd->wtop+wnd->WndRow); StickEnd(wnd); - DfSendMessage(wnd, KEYBOARD_CURSOR,WndCol, wnd->WndRow); + DfSendMessage(wnd, DFM_KEYBOARD_CURSOR,DfWndCol, wnd->WndRow); } return rtn; } /* ----------- HORIZSCROLLPAGE Message ---------- */ -static int HorizPageMsg(DFWINDOW wnd, PARAM p1) +static int HorizPageMsg(DFWINDOW wnd, DF_PARAM p1) { - int rtn = BaseWndProc(EDITBOX, wnd, HORIZPAGE, p1, 0); + int rtn = DfBaseWndProc(DF_EDITBOX, wnd, DFM_HORIZPAGE, p1, 0); if ((int) p1 == FALSE) { - if (wnd->CurrCol > wnd->wleft+ClientWidth(wnd)-1) - wnd->CurrCol = wnd->wleft+ClientWidth(wnd)-1; + if (wnd->CurrCol > wnd->wleft+DfClientWidth(wnd)-1) + wnd->CurrCol = wnd->wleft+DfClientWidth(wnd)-1; } else if (wnd->CurrCol < wnd->wleft) wnd->CurrCol = wnd->wleft; - DfSendMessage(wnd, KEYBOARD_CURSOR, WndCol, wnd->WndRow); + DfSendMessage(wnd, DFM_KEYBOARD_CURSOR, DfWndCol, wnd->WndRow); return rtn; } /* ----- Extend the marked block to the new x,y position ---- */ @@ -216,75 +216,75 @@ static void ExtendBlock(DFWINDOW wnd, int x, int y) int bbl, bel; int ptop = min(wnd->BlkBegLine, wnd->BlkEndLine); int pbot = max(wnd->BlkBegLine, wnd->BlkEndLine); - char *lp = TextLine(wnd, wnd->wtop+y); + char *lp = DfTextLine(wnd, wnd->wtop+y); int len = (int) (strchr(lp, '\n') - lp); x = max(0, min(x, len)); y = max(0, y); wnd->BlkEndCol = min(len, x+wnd->wleft); wnd->BlkEndLine = y+wnd->wtop; - DfSendMessage(wnd, KEYBOARD_CURSOR, wnd->BlkEndCol, wnd->BlkEndLine); + DfSendMessage(wnd, DFM_KEYBOARD_CURSOR, wnd->BlkEndCol, wnd->BlkEndLine); bbl = min(wnd->BlkBegLine, wnd->BlkEndLine); bel = max(wnd->BlkBegLine, wnd->BlkEndLine); while (ptop < bbl) { - WriteTextLine(wnd, NULL, ptop, FALSE); + DfWriteTextLine(wnd, NULL, ptop, FALSE); ptop++; } for (y = bbl; y <= bel; y++) - WriteTextLine(wnd, NULL, y, FALSE); + DfWriteTextLine(wnd, NULL, y, FALSE); while (pbot > bel) { - WriteTextLine(wnd, NULL, pbot, FALSE); + DfWriteTextLine(wnd, NULL, pbot, FALSE); --pbot; } } -/* ----------- LEFT_BUTTON Message ---------- */ -static int LeftButtonMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* ----------- DFM_LEFT_BUTTON Message ---------- */ +static int LeftButtonMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - int MouseX = (int) p1 - GetClientLeft(wnd); - int MouseY = (int) p2 - GetClientTop(wnd); - DFRECT rc = ClientRect(wnd); + int MouseX = (int) p1 - DfGetClientLeft(wnd); + int MouseY = (int) p2 - DfGetClientTop(wnd); + DFRECT rc = DfClientRect(wnd); char *lp; int len; if (KeyBoardMarking) return TRUE; - if (WindowMoving || WindowSizing) + if (DfWindowMoving || DfWindowSizing) return FALSE; - if (isMultiLine(wnd)) { + if (DfIsMultiLine(wnd)) { if (TextMarking) { - if (!InsideRect(p1, p2, rc)) { + if (!DfInsideRect(p1, p2, rc)) { int x = MouseX, y = MouseY; int dir; DFMESSAGE msg = 0; - if ((int)p2 == GetTop(wnd)) - y++, dir = FALSE, msg = SCROLL; - else if ((int)p2 == GetBottom(wnd)) - --y, dir = TRUE, msg = SCROLL; - else if ((int)p1 == GetLeft(wnd)) - --x, dir = FALSE, msg = HORIZSCROLL; - else if ((int)p1 == GetRight(wnd)) - x++, dir = TRUE, msg = HORIZSCROLL; + if ((int)p2 == DfGetTop(wnd)) + y++, dir = FALSE, msg = DFM_SCROLL; + else if ((int)p2 == DfGetBottom(wnd)) + --y, dir = TRUE, msg = DFM_SCROLL; + else if ((int)p1 == DfGetLeft(wnd)) + --x, dir = FALSE, msg = DFM_HORIZSCROLL; + else if ((int)p1 == DfGetRight(wnd)) + x++, dir = TRUE, msg = DFM_HORIZSCROLL; if (msg != 0) { if (DfSendMessage(wnd, msg, dir, 0)) ExtendBlock(wnd, x, y); - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } } return TRUE; } - if (!InsideRect(p1, p2, rc)) + if (!DfInsideRect(p1, p2, rc)) return FALSE; - if (TextBlockMarked(wnd)) { - ClearTextBlock(wnd); - DfSendMessage(wnd, PAINT, 0, 0); + if (DfTextBlockMarked(wnd)) { + DfClearTextBlock(wnd); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } if (wnd->wlines) { if (MouseY > wnd->wlines-1) return TRUE; - lp = TextLine(wnd, MouseY+wnd->wtop); + lp = DfTextLine(wnd, MouseY+wnd->wtop); len = (int) (strchr(lp, '\n') - lp); MouseX = min(MouseX, len); if (MouseX < wnd->wleft) { MouseX = 0; - DfSendMessage(wnd, KEYBOARD, HOME, 0); + DfSendMessage(wnd, DFM_KEYBOARD, DF_HOME, 0); } ButtonDown = TRUE; ButtonX = MouseX; @@ -295,31 +295,31 @@ static int LeftButtonMsg(DFWINDOW wnd, PARAM p1, PARAM p2) wnd->WndRow = MouseY; SetLinePointer(wnd, MouseY+wnd->wtop); } - if (isMultiLine(wnd) || - (!TextBlockMarked(wnd) + if (DfIsMultiLine(wnd) || + (!DfTextBlockMarked(wnd) && (int)(MouseX+wnd->wleft) < (int)strlen(wnd->text))) wnd->CurrCol = MouseX+wnd->wleft; - DfSendMessage(wnd, KEYBOARD_CURSOR, WndCol, wnd->WndRow); + DfSendMessage(wnd, DFM_KEYBOARD_CURSOR, DfWndCol, wnd->WndRow); return TRUE; } /* ----------- MOUSE_MOVED Message ---------- */ -static int MouseMovedMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +static int MouseMovedMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - int MouseX = (int) p1 - GetClientLeft(wnd); - int MouseY = (int) p2 - GetClientTop(wnd); - DFRECT rc = ClientRect(wnd); - if (!InsideRect(p1, p2, rc)) + int MouseX = (int) p1 - DfGetClientLeft(wnd); + int MouseY = (int) p2 - DfGetClientTop(wnd); + DFRECT rc = DfClientRect(wnd); + if (!DfInsideRect(p1, p2, rc)) return FALSE; if (MouseY > wnd->wlines-1) return FALSE; if (ButtonDown) { SetAnchor(wnd, ButtonX+wnd->wleft, ButtonY+wnd->wtop); TextMarking = TRUE; - rc = WindowRect(wnd); - DfSendMessage(NULL,MOUSE_TRAVEL,(PARAM) &rc, 0); + rc = DfWindowRect(wnd); + DfSendMessage(NULL,DFM_MOUSE_TRAVEL,(DF_PARAM) &rc, 0); ButtonDown = FALSE; } - if (TextMarking && !(WindowMoving || WindowSizing)) { + if (TextMarking && !(DfWindowMoving || DfWindowSizing)) { ExtendBlock(wnd, MouseX, MouseY); return TRUE; } @@ -339,11 +339,11 @@ static void StopMarking(DFWINDOW wnd) /* ----------- BUTTON_RELEASED Message ---------- */ static int ButtonReleasedMsg(DFWINDOW wnd) { - if (isMultiLine(wnd)) { + if (DfIsMultiLine(wnd)) { ButtonDown = FALSE; - if (TextMarking && !(WindowMoving || WindowSizing)) { + if (TextMarking && !(DfWindowMoving || DfWindowSizing)) { /* release the mouse ouside the edit box */ - DfSendMessage(NULL, MOUSE_TRAVEL, 0, 0); + DfSendMessage(NULL, DFM_MOUSE_TRAVEL, 0, 0); StopMarking(wnd); return TRUE; } @@ -353,25 +353,25 @@ static int ButtonReleasedMsg(DFWINDOW wnd) return FALSE; } /* ---- Process text block keys for multiline text box ---- */ -static void DoMultiLines(DFWINDOW wnd, int c, PARAM p2) +static void DoMultiLines(DFWINDOW wnd, int c, DF_PARAM p2) { - if (isMultiLine(wnd) && !KeyBoardMarking) { - if ((int)p2 & (LEFTSHIFT | RIGHTSHIFT)) { + if (DfIsMultiLine(wnd) && !KeyBoardMarking) { + if ((int)p2 & (DF_LEFTSHIFT | DF_RIGHTSHIFT)) { switch (c) { - case HOME: - case CTRL_HOME: - case CTRL_BS: - case PGUP: - case CTRL_PGUP: - case UP: - case BS: - case END: - case CTRL_END: - case PGDN: - case CTRL_PGDN: - case DN: - case FWD: - case CTRL_FWD: + case DF_HOME: + case DF_CTRL_HOME: + case DF_CTRL_BS: + case DF_PGUP: + case DF_CTRL_PGUP: + case DF_UP: + case DF_BS: + case DF_END: + case DF_CTRL_END: + case DF_PGDN: + case DF_CTRL_PGDN: + case DF_DN: + case DF_FWD: + case DF_CTRL_FWD: KeyBoardMarking = TextMarking = TRUE; SetAnchor(wnd, wnd->CurrCol, wnd->CurrLine); break; @@ -382,149 +382,149 @@ static void DoMultiLines(DFWINDOW wnd, int c, PARAM p2) } } /* ---------- page/scroll keys ----------- */ -static int DoScrolling(DFWINDOW wnd, int c, PARAM p2) +static int DoScrolling(DFWINDOW wnd, int c, DF_PARAM p2) { switch (c) { - case PGUP: - case PGDN: - if (isMultiLine(wnd)) - BaseWndProc(EDITBOX, wnd, KEYBOARD, c, p2); + case DF_PGUP: + case DF_PGDN: + if (DfIsMultiLine(wnd)) + DfBaseWndProc(DF_EDITBOX, wnd, DFM_KEYBOARD, c, p2); break; - case CTRL_PGUP: - case CTRL_PGDN: - BaseWndProc(EDITBOX, wnd, KEYBOARD, c, p2); + case DF_CTRL_PGUP: + case DF_CTRL_PGDN: + DfBaseWndProc(DF_EDITBOX, wnd, DFM_KEYBOARD, c, p2); break; - case HOME: + case DF_HOME: Home(wnd); break; - case END: + case DF_END: End(wnd); break; - case CTRL_FWD: + case DF_CTRL_FWD: NextWord(wnd); break; - case CTRL_BS: + case DF_CTRL_BS: PrevWord(wnd); break; - case CTRL_HOME: - if (isMultiLine(wnd)) { - DfSendMessage(wnd, SCROLLDOC, TRUE, 0); + case DF_CTRL_HOME: + if (DfIsMultiLine(wnd)) { + DfSendMessage(wnd, DFM_SCROLLDOC, TRUE, 0); wnd->CurrLine = 0; wnd->WndRow = 0; } Home(wnd); break; - case CTRL_END: - if (isMultiLine(wnd) && + case DF_CTRL_END: + if (DfIsMultiLine(wnd) && wnd->WndRow+wnd->wtop+1 < wnd->wlines && wnd->wlines > 0) { - DfSendMessage(wnd, SCROLLDOC, FALSE, 0); + DfSendMessage(wnd, DFM_SCROLLDOC, FALSE, 0); SetLinePointer(wnd, wnd->wlines-1); wnd->WndRow = - min(ClientHeight(wnd)-1, wnd->wlines-1); + min(DfClientHeight(wnd)-1, wnd->wlines-1); Home(wnd); } End(wnd); break; - case UP: - if (isMultiLine(wnd)) + case DF_UP: + if (DfIsMultiLine(wnd)) Upward(wnd); break; - case DN: - if (isMultiLine(wnd)) + case DF_DN: + if (DfIsMultiLine(wnd)) Downward(wnd); break; - case FWD: + case DF_FWD: Forward(wnd); break; - case BS: + case DF_BS: Backward(wnd); break; default: return FALSE; } - if (!KeyBoardMarking && TextBlockMarked(wnd)) { - ClearTextBlock(wnd); - DfSendMessage(wnd, PAINT, 0, 0); + if (!KeyBoardMarking && DfTextBlockMarked(wnd)) { + DfClearTextBlock(wnd); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } - DfSendMessage(wnd, KEYBOARD_CURSOR, WndCol, wnd->WndRow); + DfSendMessage(wnd, DFM_KEYBOARD_CURSOR, DfWndCol, wnd->WndRow); return TRUE; } /* -------------- Del key ---------------- */ static void DelKey(DFWINDOW wnd) { - char *currchar = CurrChar; + char *currchar = DfCurrChar; int repaint = *currchar == '\n'; - if (TextBlockMarked(wnd)) { - DfSendMessage(wnd, DFM_COMMAND, ID_DELETETEXT, 0); - DfSendMessage(wnd, PAINT, 0, 0); + if (DfTextBlockMarked(wnd)) { + DfSendMessage(wnd, DFM_COMMAND, DF_ID_DELETETEXT, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); return; } - if (isMultiLine(wnd) && *currchar == '\n' && *(currchar+1) == '\0') + if (DfIsMultiLine(wnd) && *currchar == '\n' && *(currchar+1) == '\0') return; strcpy(currchar, currchar+1); if (repaint) { - BuildTextPointers(wnd); - DfSendMessage(wnd, PAINT, 0, 0); + DfBuildTextPointers(wnd); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } else { ModTextPointers(wnd, wnd->CurrLine+1, -1); - WriteTextLine(wnd, NULL, wnd->WndRow+wnd->wtop, FALSE); + DfWriteTextLine(wnd, NULL, wnd->WndRow+wnd->wtop, FALSE); } wnd->TextChanged = TRUE; } /* ------------ Tab key ------------ */ -static void TabKey(DFWINDOW wnd, PARAM p2) +static void TabKey(DFWINDOW wnd, DF_PARAM p2) { - if (isMultiLine(wnd)) { + if (DfIsMultiLine(wnd)) { int insmd = wnd->InsertMode; do { - char *cc = CurrChar+1; + char *cc = DfCurrChar+1; if (!insmd && *cc == '\0') break; if (wnd->textlen == wnd->MaxTextLength) break; - DfSendMessage(wnd,KEYBOARD,insmd ? ' ' : FWD,0); - } while (wnd->CurrCol % cfg.Tabs); + DfSendMessage(wnd,DFM_KEYBOARD,insmd ? ' ' : DF_FWD,0); + } while (wnd->CurrCol % DfCfg.Tabs); } else - DfPostMessage(GetParent(wnd), KEYBOARD, '\t', p2); + DfPostMessage(DfGetParent(wnd), DFM_KEYBOARD, '\t', p2); } /* ------------ Shift+Tab key ------------ */ -static void ShiftTabKey(DFWINDOW wnd, PARAM p2) +static void ShiftTabKey(DFWINDOW wnd, DF_PARAM p2) { - if (isMultiLine(wnd)) { + if (DfIsMultiLine(wnd)) { do { - if (CurrChar == GetText(wnd)) + if (DfCurrChar == DfGetText(wnd)) break; - DfSendMessage(wnd,KEYBOARD,BS,0); - } while (wnd->CurrCol % cfg.Tabs); + DfSendMessage(wnd,DFM_KEYBOARD,DF_BS,0); + } while (wnd->CurrCol % DfCfg.Tabs); } else - DfPostMessage(GetParent(wnd), KEYBOARD, SHIFT_HT, p2); + DfPostMessage(DfGetParent(wnd), DFM_KEYBOARD, DF_SHIFT_HT, p2); } /* --------- All displayable typed keys ------------- */ static void KeyTyped(DFWINDOW wnd, int c) { - char *currchar = CurrChar; + char *currchar = DfCurrChar; if ((c != '\n' && c < ' ') || (c & 0x1000)) /* ---- not recognized by editor --- */ return; - if (!isMultiLine(wnd) && TextBlockMarked(wnd)) { - DfSendMessage(wnd, CLEARTEXT, 0, 0); - currchar = CurrChar; + if (!DfIsMultiLine(wnd) && DfTextBlockMarked(wnd)) { + DfSendMessage(wnd, DFM_CLEARTEXT, 0, 0); + currchar = DfCurrChar; } /* ---- test typing at end of text ---- */ if (currchar == wnd->text+wnd->MaxTextLength) { /* ---- typing at the end of maximum buffer ---- */ - beep(); + DfBeep(); return; } if (*currchar == '\0') { /* --- insert a newline at end of text --- */ *currchar = '\n'; *(currchar+1) = '\0'; - BuildTextPointers(wnd); + DfBuildTextPointers(wnd); } /* --- displayable char or newline --- */ if (c == '\n' || wnd->InsertMode || *currchar == '\n') { @@ -533,28 +533,28 @@ static void KeyTyped(DFWINDOW wnd, int c) /* --- the current text buffer is full --- */ if (wnd->textlen == wnd->MaxTextLength) { /* --- text buffer is at maximum size --- */ - beep(); + DfBeep(); return; } /* ---- increase the text buffer size ---- */ - wnd->textlen += GROWLENGTH; + wnd->textlen += DF_GROWLENGTH; /* --- but not above maximum size --- */ if (wnd->textlen > wnd->MaxTextLength) wnd->textlen = wnd->MaxTextLength; - wnd->text = DFrealloc(wnd->text, wnd->textlen+2); + wnd->text = DfRealloc(wnd->text, wnd->textlen+2); wnd->text[wnd->textlen-1] = '\0'; - currchar = CurrChar; + currchar = DfCurrChar; } memmove(currchar+1, currchar, strlen(currchar)+1); ModTextPointers(wnd, wnd->CurrLine+1, 1); - if (isMultiLine(wnd) && wnd->wlines > 1) + if (DfIsMultiLine(wnd) && wnd->wlines > 1) wnd->textwidth = max(wnd->textwidth, - (int) (TextLine(wnd, wnd->CurrLine+1)- - TextLine(wnd, wnd->CurrLine))); + (int) (DfTextLine(wnd, wnd->CurrLine+1)- + DfTextLine(wnd, wnd->CurrLine))); else wnd->textwidth = max((int)wnd->textwidth, (int)strlen(wnd->text)); - WriteTextLine(wnd, NULL, + DfWriteTextLine(wnd, NULL, wnd->wtop+wnd->WndRow, FALSE); } /* ----- put the char in the buffer ----- */ @@ -562,35 +562,35 @@ static void KeyTyped(DFWINDOW wnd, int c) wnd->TextChanged = TRUE; if (c == '\n') { wnd->wleft = 0; - BuildTextPointers(wnd); + DfBuildTextPointers(wnd); End(wnd); Forward(wnd); - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); return; } /* ---------- test end of window --------- */ - if (WndCol == ClientWidth(wnd)-1) { - if (!isMultiLine(wnd)) { + if (DfWndCol == DfClientWidth(wnd)-1) { + if (!DfIsMultiLine(wnd)) { if (!(currchar == wnd->text+wnd->MaxTextLength-2)) - DfSendMessage(wnd, HORIZSCROLL, TRUE, 0); + DfSendMessage(wnd, DFM_HORIZSCROLL, TRUE, 0); } else { char *cp = currchar; - while (*cp != ' ' && cp != TextLine(wnd, wnd->CurrLine)) + while (*cp != ' ' && cp != DfTextLine(wnd, wnd->CurrLine)) --cp; - if (cp == TextLine(wnd, wnd->CurrLine) || + if (cp == DfTextLine(wnd, wnd->CurrLine) || !wnd->WordWrapMode) - DfSendMessage(wnd, HORIZSCROLL, TRUE, 0); + DfSendMessage(wnd, DFM_HORIZSCROLL, TRUE, 0); else { int dif = 0; if (c != ' ') { dif = (int) (currchar - cp); wnd->CurrCol -= dif; - DfSendMessage(wnd, KEYBOARD, DEL, 0); + DfSendMessage(wnd, DFM_KEYBOARD, DF_DEL, 0); --dif; } - DfSendMessage(wnd, KEYBOARD, '\n', 0); - currchar = CurrChar; + DfSendMessage(wnd, DFM_KEYBOARD, '\n', 0); + currchar = DfCurrChar; wnd->CurrCol = dif; if (c == ' ') return; @@ -598,82 +598,82 @@ static void KeyTyped(DFWINDOW wnd, int c) } } /* ------ display the character ------ */ - SetStandardColor(wnd); - PutWindowChar(wnd, c, WndCol, wnd->WndRow); + DfSetStandardColor(wnd); + DfPutWindowChar(wnd, c, DfWndCol, wnd->WndRow); /* ----- advance the pointers ------ */ wnd->CurrCol++; } /* ------------ screen changing key strokes ------------- */ -static void DoKeyStroke(DFWINDOW wnd, int c, PARAM p2) +static void DoKeyStroke(DFWINDOW wnd, int c, DF_PARAM p2) { switch (c) { - case RUBOUT: + case DF_RUBOUT: if (wnd->CurrCol == 0 && wnd->CurrLine == 0) break; Backward(wnd); - case DEL: + case DF_DEL: DelKey(wnd); break; - case SHIFT_HT: + case DF_SHIFT_HT: ShiftTabKey(wnd, p2); break; case '\t': TabKey(wnd, p2); break; case '\r': - if (!isMultiLine(wnd)) { - DfPostMessage(GetParent(wnd), KEYBOARD, c, p2); + if (!DfIsMultiLine(wnd)) { + DfPostMessage(DfGetParent(wnd), DFM_KEYBOARD, c, p2); break; } c = '\n'; default: - if (TextBlockMarked(wnd)) { - DfSendMessage(wnd, DFM_COMMAND, ID_DELETETEXT, 0); - DfSendMessage(wnd, PAINT, 0, 0); + if (DfTextBlockMarked(wnd)) { + DfSendMessage(wnd, DFM_COMMAND, DF_ID_DELETETEXT, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } KeyTyped(wnd, c); break; } } -/* ----------- KEYBOARD Message ---------- */ -static int KeyboardMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* ----------- DFM_KEYBOARD Message ---------- */ +static int KeyboardMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { int c = (int) p1; - if (WindowMoving || WindowSizing || ((int)p2 & ALTKEY)) + if (DfWindowMoving || DfWindowSizing || ((int)p2 & DF_ALTKEY)) return FALSE; switch (c) { /* these keys get processed by lower classes */ - case ESC: - case F1: - case F2: - case F3: - case F4: - case F5: - case F6: - case F7: - case F8: - case F9: - case F10: - case INS: - case SHIFT_INS: - case SHIFT_DEL: + case DF_ESC: + case DF_F1: + case DF_F2: + case DF_F3: + case DF_F4: + case DF_F5: + case DF_F6: + case DF_F7: + case DF_F8: + case DF_F9: + case DF_F10: + case DF_INS: + case DF_SHIFT_INS: + case DF_SHIFT_DEL: return FALSE; /* these keys get processed here */ - case CTRL_FWD: - case CTRL_BS: - case CTRL_HOME: - case CTRL_END: - case CTRL_PGUP: - case CTRL_PGDN: + case DF_CTRL_FWD: + case DF_CTRL_BS: + case DF_CTRL_HOME: + case DF_CTRL_END: + case DF_CTRL_PGUP: + case DF_CTRL_PGDN: break; default: /* other ctrl keys get processed by lower classes */ - if ((int)p2 & CTRLKEY) + if ((int)p2 & DF_CTRLKEY) return FALSE; /* all other keys get processed here */ break; @@ -683,59 +683,59 @@ static int KeyboardMsg(DFWINDOW wnd, PARAM p1, PARAM p2) if (DoScrolling(wnd, c, p2)) { if (KeyBoardMarking) - ExtendBlock(wnd, WndCol, wnd->WndRow); + ExtendBlock(wnd, DfWndCol, wnd->WndRow); } - else if (!TestAttribute(wnd, READONLY)) + else if (!DfTestAttribute(wnd, DF_READONLY)) { DoKeyStroke(wnd, c, p2); - DfSendMessage(wnd, KEYBOARD_CURSOR, WndCol, wnd->WndRow); + DfSendMessage(wnd, DFM_KEYBOARD_CURSOR, DfWndCol, wnd->WndRow); } else - beep(); + DfBeep(); return TRUE; } -/* ----------- SHIFT_CHANGED Message ---------- */ -static void ShiftChangedMsg(DFWINDOW wnd, PARAM p1) +/* ----------- DFM_SHIFT_CHANGED Message ---------- */ +static void ShiftChangedMsg(DFWINDOW wnd, DF_PARAM p1) { - if (!((int)p1 & (LEFTSHIFT | RIGHTSHIFT)) && + if (!((int)p1 & (DF_LEFTSHIFT | DF_RIGHTSHIFT)) && KeyBoardMarking) { StopMarking(wnd); KeyBoardMarking = FALSE; } } -/* ----------- ID_DELETETEXT Command ---------- */ +/* ----------- DF_ID_DELETETEXT Command ---------- */ static void DeleteTextCmd(DFWINDOW wnd) { - if (TextBlockMarked(wnd)) { - char *bbl=TextLine(wnd,wnd->BlkBegLine)+wnd->BlkBegCol; - char *bel=TextLine(wnd,wnd->BlkEndLine)+wnd->BlkEndCol; + if (DfTextBlockMarked(wnd)) { + char *bbl=DfTextLine(wnd,wnd->BlkBegLine)+wnd->BlkBegCol; + char *bel=DfTextLine(wnd,wnd->BlkEndLine)+wnd->BlkEndCol; int len = (int) (bel - bbl); SaveDeletedText(wnd, bbl, len); wnd->TextChanged = TRUE; strcpy(bbl, bel); - wnd->CurrLine = TextLineNumber(wnd, bbl-wnd->BlkBegCol); + wnd->CurrLine = DfTextLineNumber(wnd, bbl-wnd->BlkBegCol); wnd->CurrCol = wnd->BlkBegCol; wnd->WndRow = wnd->BlkBegLine - wnd->wtop; if (wnd->WndRow < 0) { wnd->wtop = wnd->BlkBegLine; wnd->WndRow = 0; } - DfSendMessage(wnd, KEYBOARD_CURSOR, WndCol, wnd->WndRow); - ClearTextBlock(wnd); - BuildTextPointers(wnd); + DfSendMessage(wnd, DFM_KEYBOARD_CURSOR, DfWndCol, wnd->WndRow); + DfClearTextBlock(wnd); + DfBuildTextPointers(wnd); } } -/* ----------- ID_CLEAR Command ---------- */ +/* ----------- DF_ID_CLEAR Command ---------- */ static void ClearCmd(DFWINDOW wnd) { - if (TextBlockMarked(wnd)) { - char *bbl=TextLine(wnd,wnd->BlkBegLine)+wnd->BlkBegCol; - char *bel=TextLine(wnd,wnd->BlkEndLine)+wnd->BlkEndCol; + if (DfTextBlockMarked(wnd)) { + char *bbl=DfTextLine(wnd,wnd->BlkBegLine)+wnd->BlkBegCol; + char *bel=DfTextLine(wnd,wnd->BlkEndLine)+wnd->BlkEndCol; int len = (int) (bel - bbl); SaveDeletedText(wnd, bbl, len); - wnd->CurrLine = TextLineNumber(wnd, bbl); + wnd->CurrLine = DfTextLineNumber(wnd, bbl); wnd->CurrCol = wnd->BlkBegCol; wnd->WndRow = wnd->BlkBegLine - wnd->wtop; if (wnd->WndRow < 0) { @@ -751,34 +751,34 @@ static void ClearCmd(DFWINDOW wnd) bel -= (int) (cp - bbl); bbl++; } - ClearTextBlock(wnd); - BuildTextPointers(wnd); - DfSendMessage(wnd, KEYBOARD_CURSOR, WndCol, wnd->WndRow); + DfClearTextBlock(wnd); + DfBuildTextPointers(wnd); + DfSendMessage(wnd, DFM_KEYBOARD_CURSOR, DfWndCol, wnd->WndRow); wnd->TextChanged = TRUE; } } -/* ----------- ID_UNDO Command ---------- */ +/* ----------- DF_ID_UNDO Command ---------- */ static void UndoCmd(DFWINDOW wnd) { if (wnd->DeletedText != NULL) { - PasteText(wnd, wnd->DeletedText, wnd->DeletedLength); + DfPasteText(wnd, wnd->DeletedText, wnd->DeletedLength); free(wnd->DeletedText); wnd->DeletedText = NULL; wnd->DeletedLength = 0; - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } } -/* ----------- ID_PARAGRAPH Command ---------- */ +/* ----------- DF_ID_PARAGRAPH Command ---------- */ static void ParagraphCmd(DFWINDOW wnd) { int bc, fl; char *bl, *bbl, *bel, *bb; - ClearTextBlock(wnd); - /* ---- forming paragraph from cursor position --- */ + DfClearTextBlock(wnd); + /* ---- forming paragraph from DfCursor position --- */ fl = wnd->wtop + wnd->WndRow; - bbl = bel = bl = TextLine(wnd, wnd->CurrLine); - if ((bc = wnd->CurrCol) >= ClientWidth(wnd)) + bbl = bel = bl = DfTextLine(wnd, wnd->CurrLine); + if ((bc = wnd->CurrCol) >= DfClientWidth(wnd)) bc = 0; Home(wnd); /* ---- locate the end of the paragraph ---- */ @@ -799,7 +799,7 @@ static void ParagraphCmd(DFWINDOW wnd) bel++; } if (bel == bbl) { - DfSendMessage(wnd, KEYBOARD, DN, 0); + DfSendMessage(wnd, DFM_KEYBOARD, DF_DN, 0); return; } if (*bel == '\0') @@ -807,9 +807,9 @@ static void ParagraphCmd(DFWINDOW wnd) if (*bel == '\n') --bel; /* --- change all newlines in block to spaces --- */ - while (CurrChar < bel) { - if (*CurrChar == '\n') { - *CurrChar = ' '; + while (DfCurrChar < bel) { + if (*DfCurrChar == '\n') { + *DfCurrChar = ' '; wnd->CurrLine++; wnd->CurrCol = 0; } @@ -820,7 +820,7 @@ static void ParagraphCmd(DFWINDOW wnd) bb = bbl; while (bbl < bel) { bbl++; - if ((int)(bbl - bb) == ClientWidth(wnd)-1) { + if ((int)(bbl - bb) == DfClientWidth(wnd)-1) { while (*bbl != ' ' && bbl > bb) --bbl; if (*bbl != ' ') { @@ -832,32 +832,32 @@ static void ParagraphCmd(DFWINDOW wnd) bb = bbl+1; } } - BuildTextPointers(wnd); - /* --- put cursor back at beginning --- */ - wnd->CurrLine = TextLineNumber(wnd, bl); + DfBuildTextPointers(wnd); + /* --- put DfCursor back at beginning --- */ + wnd->CurrLine = DfTextLineNumber(wnd, bl); wnd->CurrCol = bc; if (fl < wnd->wtop) wnd->wtop = fl; wnd->WndRow = fl - wnd->wtop; - DfSendMessage(wnd, PAINT, 0, 0); - DfSendMessage(wnd, KEYBOARD_CURSOR, WndCol, wnd->WndRow); + DfSendMessage(wnd, DFM_PAINT, 0, 0); + DfSendMessage(wnd, DFM_KEYBOARD_CURSOR, DfWndCol, wnd->WndRow); wnd->TextChanged = TRUE; - BuildTextPointers(wnd); + DfBuildTextPointers(wnd); } /* ----------- COMMAND Message ---------- */ -static int CommandMsg(DFWINDOW wnd, PARAM p1) +static int CommandMsg(DFWINDOW wnd, DF_PARAM p1) { switch ((int)p1) { - case ID_DELETETEXT: + case DF_ID_DELETETEXT: DeleteTextCmd(wnd); return TRUE; - case ID_CLEAR: + case DF_ID_CLEAR: ClearCmd(wnd); return TRUE; - case ID_UNDO: + case DF_ID_UNDO: UndoCmd(wnd); return TRUE; - case ID_PARAGRAPH: + case DF_ID_PARAGRAPH: ParagraphCmd(wnd); return TRUE; default: @@ -865,11 +865,11 @@ static int CommandMsg(DFWINDOW wnd, PARAM p1) } return FALSE; } -/* ---------- CLOSE_WINDOW Message ----------- */ -static int CloseWindowMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* ---------- DFM_CLOSE_WINDOW Message ----------- */ +static int CloseWindowMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { int rtn; - DfSendMessage(NULL, HIDE_CURSOR, 0, 0); + DfSendMessage(NULL, DFM_HIDE_CURSOR, 0, 0); if (wnd->DeletedText != NULL) free(wnd->DeletedText); if (wnd->text != NULL) @@ -877,49 +877,49 @@ static int CloseWindowMsg(DFWINDOW wnd, PARAM p1, PARAM p2) free(wnd->text); wnd->text = NULL; } - rtn = BaseWndProc(EDITBOX, wnd, CLOSE_WINDOW, p1, p2); + rtn = DfBaseWndProc(DF_EDITBOX, wnd, DFM_CLOSE_WINDOW, p1, p2); return rtn; } -/* ------- Window processing module for EDITBOX class ------ */ -int EditBoxProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +/* ------- Window processing module for DF_EDITBOX class ------ */ +int DfEditBoxProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { int rtn; switch (msg) { - case CREATE_WINDOW: + case DFM_CREATE_WINDOW: return CreateWindowMsg(wnd); - case ADDTEXT: + case DFM_ADDTEXT: return AddTextMsg(wnd, p1, p2); - case SETTEXT: + case DFM_SETTEXT: return SetTextMsg(wnd, p1); - case CLEARTEXT: + case DFM_CLEARTEXT: return ClearTextMsg(wnd); - case GETTEXT: + case DFM_GETTEXT: return GetTextMsg(wnd, p1, p2); - case SETTEXTLENGTH: + case DFM_SETTEXTLENGTH: return SetTextLengthMsg(wnd, (unsigned) p1); - case KEYBOARD_CURSOR: + case DFM_KEYBOARD_CURSOR: KeyboardCursorMsg(wnd, p1, p2); return TRUE; - case SETFOCUS: + case DFM_SETFOCUS: if (!(int)p1) - DfSendMessage(NULL, HIDE_CURSOR, 0, 0); - case PAINT: - case MOVE: - rtn = BaseWndProc(EDITBOX, wnd, msg, p1, p2); - DfSendMessage(wnd,KEYBOARD_CURSOR,WndCol,wnd->WndRow); + DfSendMessage(NULL, DFM_HIDE_CURSOR, 0, 0); + case DFM_PAINT: + case DFM_MOVE: + rtn = DfBaseWndProc(DF_EDITBOX, wnd, msg, p1, p2); + DfSendMessage(wnd,DFM_KEYBOARD_CURSOR,DfWndCol,wnd->WndRow); return rtn; - case DFM_SIZE: + case DFM_DFM_SIZE: return SizeMsg(wnd, p1, p2); - case SCROLL: + case DFM_SCROLL: return ScrollMsg(wnd, p1); - case HORIZSCROLL: + case DFM_HORIZSCROLL: return HorizScrollMsg(wnd, p1); - case SCROLLPAGE: + case DFM_SCROLLPAGE: return ScrollPageMsg(wnd, p1); - case HORIZPAGE: + case DFM_HORIZPAGE: return HorizPageMsg(wnd, p1); - case LEFT_BUTTON: + case DFM_LEFT_BUTTON: if (LeftButtonMsg(wnd, p1, p2)) return TRUE; break; @@ -931,97 +931,97 @@ int EditBoxProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) if (ButtonReleasedMsg(wnd)) return TRUE; break; - case KEYBOARD: + case DFM_KEYBOARD: if (KeyboardMsg(wnd, p1, p2)) return TRUE; break; - case SHIFT_CHANGED: + case DFM_SHIFT_CHANGED: ShiftChangedMsg(wnd, p1); break; case DFM_COMMAND: if (CommandMsg(wnd, p1)) return TRUE; break; - case CLOSE_WINDOW: + case DFM_CLOSE_WINDOW: return CloseWindowMsg(wnd, p1, p2); default: break; } - return BaseWndProc(EDITBOX, wnd, msg, p1, p2); + return DfBaseWndProc(DF_EDITBOX, wnd, msg, p1, p2); } /* ------ save deleted text for the Undo command ------ */ static void SaveDeletedText(DFWINDOW wnd, char *bbl, int len) { wnd->DeletedLength = len; - wnd->DeletedText=DFrealloc(wnd->DeletedText,len); + wnd->DeletedText=DfRealloc(wnd->DeletedText,len); memmove(wnd->DeletedText, bbl, len); } -/* ---- cursor right key: right one character position ---- */ +/* ---- DfCursor right key: right one character position ---- */ static void Forward(DFWINDOW wnd) { - char *cc = CurrChar+1; + char *cc = DfCurrChar+1; if (*cc == '\0') return; - if (*CurrChar == '\n') { + if (*DfCurrChar == '\n') { Home(wnd); Downward(wnd); } else { wnd->CurrCol++; - if (WndCol == ClientWidth(wnd)) - DfSendMessage(wnd, HORIZSCROLL, TRUE, 0); + if (DfWndCol == DfClientWidth(wnd)) + DfSendMessage(wnd, DFM_HORIZSCROLL, TRUE, 0); } } -/* ----- stick the moving cursor to the end of the line ---- */ +/* ----- stick the moving DfCursor to the end of the line ---- */ static void StickEnd(DFWINDOW wnd) { - char *cp = TextLine(wnd, wnd->CurrLine); + char *cp = DfTextLine(wnd, wnd->CurrLine); char *cp1 = strchr(cp, '\n'); int len = cp1 ? (int) (cp1 - cp) : 0; wnd->CurrCol = min(len, wnd->CurrCol); if (wnd->wleft > wnd->CurrCol) { wnd->wleft = max(0, wnd->CurrCol - 4); - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } - else if (wnd->CurrCol-wnd->wleft >= ClientWidth(wnd)) { - wnd->wleft = wnd->CurrCol - (ClientWidth(wnd)-1); - DfSendMessage(wnd, PAINT, 0, 0); + else if (wnd->CurrCol-wnd->wleft >= DfClientWidth(wnd)) { + wnd->wleft = wnd->CurrCol - (DfClientWidth(wnd)-1); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } } -/* --------- cursor down key: down one line --------- */ +/* --------- DfCursor down key: down one line --------- */ static void Downward(DFWINDOW wnd) { - if (isMultiLine(wnd) && + if (DfIsMultiLine(wnd) && wnd->WndRow+wnd->wtop+1 < wnd->wlines) { wnd->CurrLine++; - if (wnd->WndRow == ClientHeight(wnd)-1) - BaseWndProc(EDITBOX, wnd, SCROLL, TRUE, 0); + if (wnd->WndRow == DfClientHeight(wnd)-1) + DfBaseWndProc(DF_EDITBOX, wnd, DFM_SCROLL, TRUE, 0); else wnd->WndRow++; StickEnd(wnd); } } -/* -------- cursor up key: up one line ------------ */ +/* -------- DfCursor up key: up one line ------------ */ static void Upward(DFWINDOW wnd) { - if (isMultiLine(wnd) && wnd->CurrLine != 0) { + if (DfIsMultiLine(wnd) && wnd->CurrLine != 0) { --wnd->CurrLine; if (wnd->WndRow == 0) - BaseWndProc(EDITBOX, wnd, SCROLL, FALSE, 0); + DfBaseWndProc(DF_EDITBOX, wnd, DFM_SCROLL, FALSE, 0); else --wnd->WndRow; StickEnd(wnd); } } -/* ---- cursor left key: left one character position ---- */ +/* ---- DfCursor left key: left one character position ---- */ static void Backward(DFWINDOW wnd) { if (wnd->CurrCol) { --wnd->CurrCol; if (wnd->CurrCol < wnd->wleft) - DfSendMessage(wnd, HORIZSCROLL, FALSE, 0); + DfSendMessage(wnd, DFM_HORIZSCROLL, FALSE, 0); } - else if (isMultiLine(wnd) && wnd->CurrLine != 0) { + else if (DfIsMultiLine(wnd) && wnd->CurrLine != 0) { Upward(wnd); End(wnd); } @@ -1029,11 +1029,11 @@ static void Backward(DFWINDOW wnd) /* -------- End key: to end of line ------- */ static void End(DFWINDOW wnd) { - while (*CurrChar && *CurrChar != '\n') + while (*DfCurrChar && *DfCurrChar != '\n') ++wnd->CurrCol; - if (WndCol >= ClientWidth(wnd)) { - wnd->wleft = wnd->CurrCol - (ClientWidth(wnd)-1); - DfSendMessage(wnd, PAINT, 0, 0); + if (DfWndCol >= DfClientWidth(wnd)) { + wnd->wleft = wnd->CurrCol - (DfClientWidth(wnd)-1); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } } /* -------- Home key: to beginning of line ------- */ @@ -1042,56 +1042,56 @@ static void Home(DFWINDOW wnd) wnd->CurrCol = 0; if (wnd->wleft != 0) { wnd->wleft = 0; - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } } -/* -- Ctrl+cursor right key: to beginning of next word -- */ +/* -- Ctrl+DfCursor right key: to beginning of next word -- */ static void NextWord(DFWINDOW wnd) { int savetop = wnd->wtop; int saveleft = wnd->wleft; - ClearVisible(wnd); - while (!isWhite(*CurrChar)) { - char *cc = CurrChar+1; + DfClearVisible(wnd); + while (!isWhite(*DfCurrChar)) { + char *cc = DfCurrChar+1; if (*cc == '\0') break; Forward(wnd); } - while (isWhite(*CurrChar)) { - char *cc = CurrChar+1; + while (isWhite(*DfCurrChar)) { + char *cc = DfCurrChar+1; if (*cc == '\0') break; Forward(wnd); } - SetVisible(wnd); - DfSendMessage(wnd, KEYBOARD_CURSOR, WndCol, wnd->WndRow); + DfSetVisible(wnd); + DfSendMessage(wnd, DFM_KEYBOARD_CURSOR, DfWndCol, wnd->WndRow); if (wnd->wtop != savetop || wnd->wleft != saveleft) - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } -/* -- Ctrl+cursor left key: to beginning of previous word -- */ +/* -- Ctrl+DfCursor left key: to beginning of previous word -- */ static void PrevWord(DFWINDOW wnd) { int savetop = wnd->wtop; int saveleft = wnd->wleft; - ClearVisible(wnd); + DfClearVisible(wnd); Backward(wnd); - while (isWhite(*CurrChar)) { + while (isWhite(*DfCurrChar)) { if (wnd->CurrLine == 0 && wnd->CurrCol == 0) break; Backward(wnd); } - while (wnd->CurrCol != 0 && !isWhite(*CurrChar)) + while (wnd->CurrCol != 0 && !isWhite(*DfCurrChar)) Backward(wnd); - if (isWhite(*CurrChar)) + if (isWhite(*DfCurrChar)) Forward(wnd); - SetVisible(wnd); + DfSetVisible(wnd); if (wnd->wleft != saveleft) if (wnd->CurrCol >= saveleft) - if (wnd->CurrCol - saveleft < ClientWidth(wnd)) + if (wnd->CurrCol - saveleft < DfClientWidth(wnd)) wnd->wleft = saveleft; - DfSendMessage(wnd, KEYBOARD_CURSOR, WndCol, wnd->WndRow); + DfSendMessage(wnd, DFM_KEYBOARD_CURSOR, DfWndCol, wnd->WndRow); if (wnd->wtop != savetop || wnd->wleft != saveleft) - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } /* ----- modify text pointers from a specified position by a specified plus or minus amount ----- */ @@ -1103,11 +1103,11 @@ static void ModTextPointers(DFWINDOW wnd, int lineno, int var) /* ----- set anchor point for marking text block ----- */ static void SetAnchor(DFWINDOW wnd, int mx, int my) { - ClearTextBlock(wnd); + DfClearTextBlock(wnd); /* ------ set the anchor ------ */ wnd->BlkBegLine = wnd->BlkEndLine = my; wnd->BlkBegCol = wnd->BlkEndCol = mx; - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } /* EOF */ diff --git a/rosapps/dflat32/fileopen.c b/rosapps/dflat32/fileopen.c index b4dd9b9734d..ee3cc1d5498 100644 --- a/rosapps/dflat32/fileopen.c +++ b/rosapps/dflat32/fileopen.c @@ -2,8 +2,8 @@ #include "dflat.h" -static BOOL DlgFileOpen(char *, char *, DBOX *); -static int DlgFnOpen(DFWINDOW, DFMESSAGE, PARAM, PARAM); +static BOOL DlgFileOpen(char *, char *, DF_DBOX *); +static int DlgFnOpen(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); static void InitDlgBox(DFWINDOW); static void StripPath(char *); static BOOL IncompleteFilename(char *); @@ -14,13 +14,13 @@ static char *FileName; static char *NewFileName; static BOOL Saving; -extern DBOX FileOpen; -extern DBOX SaveAs; +extern DF_DBOX FileOpen; +extern DF_DBOX SaveAs; /* * Dialog Box to select a file to open */ -BOOL OpenFileDialogBox(char *Fpath, char *Fname) +BOOL DfOpenFileDialogBox(char *Fpath, char *Fname) { return DlgFileOpen(Fpath, Fname, &FileOpen); } @@ -28,13 +28,13 @@ BOOL OpenFileDialogBox(char *Fpath, char *Fname) /* * Dialog Box to select a file to save as */ -BOOL SaveAsDialogBox(char *Fname) +BOOL DfSaveAsDialogBox(char *Fname) { return DlgFileOpen(NULL, Fname, &SaveAs); } /* --------- generic file open ---------- */ -static BOOL DlgFileOpen(char *Fpath, char *Fname, DBOX *db) +static BOOL DlgFileOpen(char *Fpath, char *Fname, DF_DBOX *db) { BOOL rtn; char savedir[MAX_PATH]; @@ -74,48 +74,48 @@ static BOOL DlgFileOpen(char *Fpath, char *Fname, DBOX *db) /* * Process dialog box messages */ -static int DlgFnOpen(DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2) +static int DlgFnOpen(DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2) { int rtn; - DBOX *db; + DF_DBOX *db; DFWINDOW cwnd; switch (msg) { - case CREATE_WINDOW: - rtn = DefaultWndProc(wnd, msg, p1, p2); + case DFM_CREATE_WINDOW: + rtn = DfDefaultWndProc(wnd, msg, p1, p2); db = wnd->extension; - cwnd = ControlWindow(db, ID_FILENAME); - DfSendMessage(cwnd, SETTEXTLENGTH, 64, 0); + cwnd = DfControlWindow(db, DF_ID_FILENAME); + DfSendMessage(cwnd, DFM_SETTEXTLENGTH, 64, 0); return rtn; - case INITIATE_DIALOG: + case DFM_INITIATE_DIALOG: InitDlgBox(wnd); break; case DFM_COMMAND: switch ((int) p1) { - case ID_FILENAME: - if (p2 != ENTERFOCUS) + case DF_ID_FILENAME: + if (p2 != DFM_ENTERFOCUS) { /* allow user to modify the file spec */ - GetItemText(wnd, ID_FILENAME, + DfGetItemText(wnd, DF_ID_FILENAME, FileName, 65); if (IncompleteFilename(FileName) || Saving) { strcpy(OrigSpec, FileName); StripPath(OrigSpec); } - if (p2 != LEAVEFOCUS) - DfSendMessage(wnd, DFM_COMMAND, ID_OK, 0); + if (p2 != DFM_LEAVEFOCUS) + DfSendMessage(wnd, DFM_COMMAND, DF_ID_OK, 0); } return TRUE; - case ID_OK: + case DF_ID_OK: if (p2 != 0) break; - GetItemText(wnd, ID_FILENAME, + DfGetItemText(wnd, DF_ID_FILENAME, FileName, 65); strcpy(FileSpec, FileName); if (IncompleteFilename(FileName)) @@ -126,50 +126,50 @@ static int DlgFnOpen(DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2) return TRUE; } else { - GetItemText(wnd, ID_PATH, FileName, 65); + DfGetItemText(wnd, DF_ID_PATH, FileName, 65); strcat(FileName, FileSpec); strcpy(NewFileName, FileName); } break; - case ID_FILES: + case DF_ID_FILES: switch ((int) p2) { - case ENTERFOCUS: - case LB_SELECTION: + case DFM_ENTERFOCUS: + case DFM_LB_SELECTION: /* selected a different filename */ - GetDlgListText(wnd, FileName, - ID_FILES); - PutItemText(wnd, ID_FILENAME, + DfGetDlgListText(wnd, FileName, + DF_ID_FILES); + DfPutItemText(wnd, DF_ID_FILENAME, FileName); break; - case LB_CHOOSE: + case DFM_LB_CHOOSE: /* chose a file name */ - GetDlgListText(wnd, FileName, - ID_FILES); - DfSendMessage(wnd, DFM_COMMAND, ID_OK, 0); + DfGetDlgListText(wnd, FileName, + DF_ID_FILES); + DfSendMessage(wnd, DFM_COMMAND, DF_ID_OK, 0); break; default: break; } return TRUE; - case ID_DRIVE: + case DF_ID_DRIVE: switch ((int) p2) { - case ENTERFOCUS: + case DFM_ENTERFOCUS: if (Saving) *FileSpec = '\0'; break; - case LEAVEFOCUS: + case DFM_LEAVEFOCUS: if (Saving) strcpy(FileSpec, FileName); break; - case LB_SELECTION: + case DFM_LB_SELECTION: { char dd[25]; /* selected different drive/dir */ - GetDlgListText(wnd, dd, ID_DRIVE); + DfGetDlgListText(wnd, dd, DF_ID_DRIVE); if (*(dd+2) == ':') *(dd+3) = '\0'; else @@ -180,7 +180,7 @@ static int DlgFnOpen(DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2) strcat(FileName, OrigSpec); if (*(FileName+1) != ':' && *FileName != '.') { - GetItemText(wnd, ID_PATH, FileSpec, 65); + DfGetItemText(wnd, DF_ID_PATH, FileSpec, 65); strcat(FileSpec, FileName); } else @@ -188,16 +188,16 @@ static int DlgFnOpen(DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2) } break; - case LB_CHOOSE: + case DFM_LB_CHOOSE: /* chose drive/dir */ if (Saving) - PutItemText(wnd, ID_FILENAME, ""); + DfPutItemText(wnd, DF_ID_FILENAME, ""); InitDlgBox(wnd); return TRUE; default: break; } - PutItemText(wnd, ID_FILENAME, FileSpec); + DfPutItemText(wnd, DF_ID_FILENAME, FileSpec); return TRUE; @@ -207,7 +207,7 @@ static int DlgFnOpen(DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2) default: break; } - return DefaultWndProc(wnd, msg, p1, p2); + return DfDefaultWndProc(wnd, msg, p1, p2); } /* @@ -216,11 +216,11 @@ static int DlgFnOpen(DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2) static void InitDlgBox(DFWINDOW wnd) { if (*FileSpec && !Saving) - PutItemText(wnd, ID_FILENAME, FileSpec); - if (DfDlgDirList(wnd, FileSpec, ID_FILES, ID_PATH, 0)) + DfPutItemText(wnd, DF_ID_FILENAME, FileSpec); + if (DfDlgDirList(wnd, FileSpec, DF_ID_FILES, DF_ID_PATH, 0)) { StripPath(FileSpec); - DfDlgDirList(wnd, "*.*", ID_DRIVE, 0, 0xc010); + DfDlgDirList(wnd, "*.*", DF_ID_DRIVE, 0, 0xc010); } } diff --git a/rosapps/dflat32/helpbox.c b/rosapps/dflat32/helpbox.c index 196f47cc248..70d6ca4c3d1 100644 --- a/rosapps/dflat32/helpbox.c +++ b/rosapps/dflat32/helpbox.c @@ -3,13 +3,13 @@ #include "dflat.h" #include "htree.h" -extern DBOX HelpBox; +extern DF_DBOX HelpBox; /* -------- strings of D-Flat classes for calling default help text collections -------- */ -char *ClassNames[] = { - #undef ClassDef - #define ClassDef(c,b,p,a) #c, +char *DfClassNames[] = { + #undef DfClassDef + #define DfClassDef(c,b,p,a) #c, #include "classes.h" NULL }; @@ -60,23 +60,23 @@ static void ReadHelp(DFWINDOW); static void FindHelp(char *); static void FindHelpWindow(DFWINDOW); static void DisplayDefinition(DFWINDOW, char *); -static void BestFit(DFWINDOW, DIALOGWINDOW *); +static void BestFit(DFWINDOW, DF_DIALOGWINDOW *); -/* ------------- CREATE_WINDOW message ------------ */ +/* ------------- DFM_CREATE_WINDOW message ------------ */ static void CreateWindowMsg(DFWINDOW wnd) { Helping = TRUE; - GetClass(wnd) = HELPBOX; - InitWindowColors(wnd); + DfGetClass(wnd) = DF_HELPBOX; + DfInitWindowColors(wnd); if (ThisHelp != NULL) ThisHelp->hwnd = wnd; } /* ------------- COMMAND message ------------ */ -static BOOL CommandMsg(DFWINDOW wnd, PARAM p1) +static BOOL CommandMsg(DFWINDOW wnd, DF_PARAM p1) { switch ((int)p1) { - case ID_CANCEL: + case DF_ID_CANCEL: ThisStack = LastStack; while (ThisStack != NULL) { LastStack = ThisStack->PrevStack; @@ -86,17 +86,17 @@ static BOOL CommandMsg(DFWINDOW wnd, PARAM p1) ThisStack = LastStack; } break; - case ID_PREV: + case DF_ID_PREV: FindHelpWindow(wnd); if (ThisHelp != NULL) SelectHelp(wnd, ThisHelp->PrevName); return TRUE; - case ID_NEXT: + case DF_ID_NEXT: FindHelpWindow(wnd); if (ThisHelp != NULL) SelectHelp(wnd, ThisHelp->NextName); return TRUE; - case ID_BACK: + case DF_ID_BACK: if (LastStack != NULL) { if (LastStack->PrevStack != NULL) { ThisStack = LastStack->PrevStack; @@ -114,22 +114,22 @@ static BOOL CommandMsg(DFWINDOW wnd, PARAM p1) return FALSE; } -/* ------------- KEYBOARD message ------------ */ -static BOOL KeyboardMsg(DFWINDOW wnd, PARAM p1) +/* ------------- DFM_KEYBOARD message ------------ */ +static BOOL KeyboardMsg(DFWINDOW wnd, DF_PARAM p1) { DFWINDOW cwnd; struct keywords *thisword; static char HelpName[50]; - cwnd = ControlWindow(wnd->extension, ID_HELPTEXT); - if (cwnd == NULL || inFocus != cwnd) + cwnd = DfControlWindow(wnd->extension, DF_ID_HELPTEXT); + if (cwnd == NULL || DfInFocus != cwnd) return FALSE; thisword = cwnd->thisword; switch ((int)p1) { case '\r': if (thisword != NULL) { if (thisword->isDefinition) - DisplayDefinition(GetParent(wnd), + DisplayDefinition(DfGetParent(wnd), thisword->hname); else { strncpy(HelpName, thisword->hname, @@ -148,7 +148,7 @@ static BOOL KeyboardMsg(DFWINDOW wnd, PARAM p1) thisword = thisword->nextword; } break; - case SHIFT_HT: + case DF_SHIFT_HT: if (thisword == NULL) thisword = cwnd->lastword; else { @@ -166,30 +166,30 @@ static BOOL KeyboardMsg(DFWINDOW wnd, PARAM p1) cwnd->thisword = thisword; if (thisword->lineno < cwnd->wtop || thisword->lineno >= - cwnd->wtop + ClientHeight(cwnd)) { - int distance = ClientHeight(cwnd)/2; + cwnd->wtop + DfClientHeight(cwnd)) { + int distance = DfClientHeight(cwnd)/2; do { cwnd->wtop = thisword->lineno-distance; distance /= 2; } while (cwnd->wtop < 0); } - DfSendMessage(cwnd, PAINT, 0, 0); + DfSendMessage(cwnd, DFM_PAINT, 0, 0); return TRUE; } return FALSE; } -/* ---- window processing module for the HELPBOX ------- */ -int HelpBoxProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +/* ---- window processing module for the DF_HELPBOX ------- */ +int DfHelpBoxProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { - DBOX *db = wnd->extension; + DF_DBOX *db = wnd->extension; switch (msg) { - case CREATE_WINDOW: + case DFM_CREATE_WINDOW: CreateWindowMsg(wnd); break; - case INITIATE_DIALOG: + case DFM_INITIATE_DIALOG: ReadHelp(wnd); break; case DFM_COMMAND: @@ -198,13 +198,13 @@ int HelpBoxProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) if (CommandMsg(wnd, p1)) return TRUE; break; - case KEYBOARD: - if (WindowMoving) + case DFM_KEYBOARD: + if (DfWindowMoving) break; if (KeyboardMsg(wnd, p1)) return TRUE; break; - case CLOSE_WINDOW: + case DFM_CLOSE_WINDOW: if (db != NULL) { if (db->dwnd.title != NULL) { free(db->dwnd.title); @@ -219,53 +219,53 @@ int HelpBoxProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) default: break; } - return BaseWndProc(HELPBOX, wnd, msg, p1, p2); + return DfBaseWndProc(DF_HELPBOX, wnd, msg, p1, p2); } /* ----- select a new help window from its name ----- */ static void SelectHelp(DFWINDOW wnd, char *hname) { if (hname != NULL) { - DFWINDOW pwnd = GetParent(wnd); - DfPostMessage(wnd, ENDDIALOG, 0, 0); - DfPostMessage(pwnd, DISPLAY_HELP, (PARAM) hname, 0); + DFWINDOW pwnd = DfGetParent(wnd); + DfPostMessage(wnd, DFM_ENDDIALOG, 0, 0); + DfPostMessage(pwnd, DFM_DISPLAY_HELP, (DF_PARAM) hname, 0); } } -/* ---- PAINT message for the helpbox text editbox ---- */ -static int PaintMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* ---- DFM_PAINT message for the helpbox text editbox ---- */ +static int PaintMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { struct keywords *thisword; int rtn; if (wnd->thisword != NULL) { - DFWINDOW pwnd = GetParent(wnd); + DFWINDOW pwnd = DfGetParent(wnd); char *cp; thisword = wnd->thisword; - cp = TextLine(wnd, thisword->lineno); + cp = DfTextLine(wnd, thisword->lineno); cp += thisword->off1; *(cp+1) = - (pwnd->WindowColors[SELECT_COLOR][FG] & 255) | 0x80; + (pwnd->WindowColors[DF_SELECT_COLOR][DF_FG] & 255) | 0x80; *(cp+2) = - (pwnd->WindowColors[SELECT_COLOR][BG] & 255) | 0x80; - rtn = DefaultWndProc(wnd, PAINT, p1, p2); + (pwnd->WindowColors[DF_SELECT_COLOR][DF_BG] & 255) | 0x80; + rtn = DfDefaultWndProc(wnd, DFM_PAINT, p1, p2); *(cp+1) = - (pwnd->WindowColors[HILITE_COLOR][FG] & 255) | 0x80; + (pwnd->WindowColors[DF_HILITE_COLOR][DF_FG] & 255) | 0x80; *(cp+2) = - (pwnd->WindowColors[HILITE_COLOR][BG] & 255) | 0x80; + (pwnd->WindowColors[DF_HILITE_COLOR][DF_BG] & 255) | 0x80; return rtn; } - return DefaultWndProc(wnd, PAINT, p1, p2); + return DfDefaultWndProc(wnd, DFM_PAINT, p1, p2); } -/* ---- LEFT_BUTTON message for the helpbox text editbox ---- */ -static int LeftButtonMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* ---- DFM_LEFT_BUTTON message for the helpbox text editbox ---- */ +static int LeftButtonMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { struct keywords *thisword; int rtn, mx, my; - rtn = DefaultWndProc(wnd, LEFT_BUTTON, p1, p2); - mx = (int)p1 - GetClientLeft(wnd); - my = (int)p2 - GetClientTop(wnd); + rtn = DfDefaultWndProc(wnd, DFM_LEFT_BUTTON, p1, p2); + mx = (int)p1 - DfGetClientLeft(wnd); + my = (int)p2 - DfGetClientTop(wnd); my += wnd->wtop; thisword = wnd->firstword; while (thisword != NULL) { @@ -273,11 +273,11 @@ static int LeftButtonMsg(DFWINDOW wnd, PARAM p1, PARAM p2) if (mx >= thisword->off2 && mx < thisword->off3) { wnd->thisword = thisword; - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); if (thisword->isDefinition) { - DFWINDOW pwnd = GetParent(wnd); + DFWINDOW pwnd = DfGetParent(wnd); if (pwnd != NULL) - DisplayDefinition(GetParent(pwnd), + DisplayDefinition(DfGetParent(pwnd), thisword->hname); } break; @@ -288,19 +288,19 @@ static int LeftButtonMsg(DFWINDOW wnd, PARAM p1, PARAM p2) return rtn; } -/* --- window processing module for HELPBOX's text EDITBOX -- */ -int HelpTextProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +/* --- window processing module for DF_HELPBOX's text DF_EDITBOX -- */ +int HelpTextProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { struct keywords *thisword; switch (msg) { - case PAINT: + case DFM_PAINT: return PaintMsg(wnd, p1, p2); - case LEFT_BUTTON: + case DFM_LEFT_BUTTON: return LeftButtonMsg(wnd, p1, p2); case DOUBLE_CLICK: - DfPostMessage(wnd, KEYBOARD, '\r', 0); + DfPostMessage(wnd, DFM_KEYBOARD, '\r', 0); break; - case CLOSE_WINDOW: + case DFM_CLOSE_WINDOW: thisword = wnd->firstword; while (thisword != NULL) { struct keywords *nextword = thisword->nextword; @@ -313,13 +313,13 @@ int HelpTextProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) default: break; } - return DefaultWndProc(wnd, msg, p1, p2); + return DfDefaultWndProc(wnd, msg, p1, p2); } /* -------- read the help text into the editbox ------- */ static void ReadHelp(DFWINDOW wnd) { - DFWINDOW cwnd = ControlWindow(wnd->extension, ID_HELPTEXT); + DFWINDOW cwnd = DfControlWindow(wnd->extension, DF_ID_HELPTEXT); int linectr = 0; if (cwnd == NULL) return; @@ -328,7 +328,7 @@ static void ReadHelp(DFWINDOW wnd) while (TRUE) { unsigned char *cp = hline, *cp1; int colorct = 0; - if (GetHelpLine(hline) == NULL) + if (DfGetHelpLine(hline) == NULL) break; if (*hline == '<') break; @@ -342,7 +342,7 @@ static void ReadHelp(DFWINDOW wnd) cp++; continue; } - thisword = DFcalloc(1, sizeof(struct keywords)); + thisword = DfCalloc(1, sizeof(struct keywords)); if (cwnd->firstword == NULL) cwnd->firstword = thisword; if (cwnd->lastword != NULL) { @@ -356,37 +356,37 @@ static void ReadHelp(DFWINDOW wnd) thisword->off2 = thisword->off1 - colorct * 4; thisword->isDefinition = *(cp+1) == '*'; colorct++; - *cp++ = CHANGECOLOR; + *cp++ = DF_CHANGECOLOR; *cp++ = - (wnd->WindowColors [HILITE_COLOR] [FG] & 255) | 0x80; + (wnd->WindowColors [DF_HILITE_COLOR] [DF_FG] & 255) | 0x80; *cp++ = - (wnd->WindowColors [HILITE_COLOR] [BG] & 255) | 0x80; + (wnd->WindowColors [DF_HILITE_COLOR] [DF_BG] & 255) | 0x80; cp1 = cp; if ((cp = strchr(cp, ']')) != NULL) { if (thisword != NULL) thisword->off3 = thisword->off2 + (int) (cp - cp1); - *cp++ = RESETCOLOR; + *cp++ = DF_RESETCOLOR; } if ((cp = strchr(cp, '<')) != NULL) { char *cp1 = strchr(cp, '>'); if (cp1 != NULL) { int len = (int) ((int)cp1 - (int)cp); - thisword->hname = DFcalloc(1, len); + thisword->hname = DfCalloc(1, len); strncpy(thisword->hname, cp+1, len-1); memmove(cp, cp1+1, strlen(cp1)); } } } } - PutItemText(wnd, ID_HELPTEXT, hline); + DfPutItemText(wnd, DF_ID_HELPTEXT, hline); /* -- display help text as soon as window is full -- */ - if (++linectr == ClientHeight(cwnd)) - DfSendMessage(cwnd, PAINT, 0, 0); - if (linectr > ClientHeight(cwnd) && - !TestAttribute(cwnd, VSCROLLBAR)) { - AddAttribute(cwnd, VSCROLLBAR); - DfSendMessage(cwnd, BORDER, 0, 0); + if (++linectr == DfClientHeight(cwnd)) + DfSendMessage(cwnd, DFM_PAINT, 0, 0); + if (linectr > DfClientHeight(cwnd) && + !DfTestAttribute(cwnd, DF_VSCROLLBAR)) { + DfAddAttribute(cwnd, DF_VSCROLLBAR); + DfSendMessage(cwnd, DFM_BORDER, 0, 0); } } } @@ -411,18 +411,18 @@ static int HelpLength(char *s) } /* ----------- load the help text file ------------ */ -void LoadHelpFile() +void DfLoadHelpFile() { char *cp; if (Helping) return; - UnLoadHelpFile(); - if ((helpfp = OpenHelpFile()) == NULL) + DfUnLoadHelpFile(); + if ((helpfp = DfOpenHelpFile()) == NULL) return; *hline = '\0'; while (*hline != '<') { - if (GetHelpLine(hline) == NULL) { + if (DfGetHelpLine(hline) == NULL) { fclose(helpfp); return; } @@ -433,21 +433,21 @@ void LoadHelpFile() /* -------- parse the help window's text name ----- */ if ((cp = strchr(hline, '>')) != NULL) { - ThisHelp = DFcalloc(1, sizeof(struct helps)); + ThisHelp = DfCalloc(1, sizeof(struct helps)); if (FirstHelp == NULL) FirstHelp = ThisHelp; *cp = '\0'; - ThisHelp->hname=DFmalloc(strlen(hline+1)+1); + ThisHelp->hname=DfMalloc(strlen(hline+1)+1); strcpy(ThisHelp->hname, hline+1); - HelpFilePosition(&ThisHelp->hptr, &ThisHelp->bit); + DfHelpFilePosition(&ThisHelp->hptr, &ThisHelp->bit); - if (GetHelpLine(hline) == NULL) + if (DfGetHelpLine(hline) == NULL) break; /* ------- build the help linked list entry --- */ while (*hline == '[') { - HelpFilePosition(&ThisHelp->hptr, + DfHelpFilePosition(&ThisHelp->hptr, &ThisHelp->bit); /* ---- parse the <'); if (cp1 != NULL) { int len = (int) (cp1-cp); - ThisHelp->PrevName=DFcalloc(1,len); + ThisHelp->PrevName=DfCalloc(1,len); strncpy(ThisHelp->PrevName, cp+1,len-1); } } - if (GetHelpLine(hline) == NULL) + if (DfGetHelpLine(hline) == NULL) break; continue; } @@ -472,12 +472,12 @@ void LoadHelpFile() char *cp1 = strchr(cp, '>'); if (cp1 != NULL) { int len = (int) (cp1-cp); - ThisHelp->NextName=DFcalloc(1,len); + ThisHelp->NextName=DfCalloc(1,len); strncpy(ThisHelp->NextName, cp+1,len-1); } } - if (GetHelpLine(hline) == NULL) + if (DfGetHelpLine(hline) == NULL) break; continue; } @@ -494,13 +494,13 @@ void LoadHelpFile() LastHelp = ThisHelp; } /* -------- move to the next token ------ */ - if (GetHelpLine(hline) == NULL) + if (DfGetHelpLine(hline) == NULL) strcpy(hline, ""); while (*hline != '<') { ThisHelp->hwidth = max(ThisHelp->hwidth, HelpLength(hline)); ThisHelp->hheight++; - if (GetHelpLine(hline) == NULL) + if (DfGetHelpLine(hline) == NULL) strcpy(hline, ""); } } @@ -508,7 +508,7 @@ void LoadHelpFile() } /* ------ free the memory used by the help file table ------ */ -void UnLoadHelpFile(void) +void DfUnLoadHelpFile(void) { while (FirstHelp != NULL) { ThisHelp = FirstHelp; @@ -522,12 +522,12 @@ void UnLoadHelpFile(void) free(ThisHelp); } ThisHelp = LastHelp = NULL; - free(HelpTree); - HelpTree = NULL; + free(DfHelpTree); + DfHelpTree = NULL; } /* ---------- display a specified help text ----------- */ -BOOL DisplayHelp(DFWINDOW wnd, char *Help) +BOOL DfDisplayHelp(DFWINDOW wnd, char *Help) { BOOL rtn = FALSE; if (Helping) @@ -538,25 +538,25 @@ BOOL DisplayHelp(DFWINDOW wnd, char *Help) if (LastStack == NULL || stricmp(Help, LastStack->hname)) { /* ---- add the window to the history stack ---- */ - ThisStack = DFcalloc(1,sizeof(struct HelpStack)); - ThisStack->hname = DFmalloc(strlen(Help)+1); + ThisStack = DfCalloc(1,sizeof(struct HelpStack)); + ThisStack->hname = DfMalloc(strlen(Help)+1); if (ThisStack->hname != NULL) strcpy(ThisStack->hname, Help); ThisStack->PrevStack = LastStack; LastStack = ThisStack; } - if ((helpfp = OpenHelpFile()) != NULL) { - DBOX *db; + if ((helpfp = DfOpenHelpFile()) != NULL) { + DF_DBOX *db; int offset, i; - db = DFcalloc(1,sizeof HelpBox); + db = DfCalloc(1,sizeof HelpBox); memcpy(db, &HelpBox, sizeof HelpBox); /* -- seek to the first line of the help text -- */ - SeekHelpLine(ThisHelp->hptr, ThisHelp->bit); + DfSeekHelpLine(ThisHelp->hptr, ThisHelp->bit); /* ----- read the title ----- */ - GetHelpLine(hline); + DfGetHelpLine(hline); hline[strlen(hline)-1] = '\0'; - db->dwnd.title = DFmalloc(strlen(hline)+1); + db->dwnd.title = DfMalloc(strlen(hline)+1); strcpy(db->dwnd.title, hline); /* ----- set the height and width ----- */ db->dwnd.h = min(ThisHelp->hheight, MAXHEIGHT)+7; @@ -576,13 +576,13 @@ BOOL DisplayHelp(DFWINDOW wnd, char *Help) /* ---- disable ineffective buttons ---- */ if (ThisStack != NULL) if (ThisStack->PrevStack == NULL) - DisableButton(db, ID_BACK); + DfDisableButton(db, DF_ID_BACK); if (ThisHelp->NextName == NULL) - DisableButton(db, ID_NEXT); + DfDisableButton(db, DF_ID_NEXT); if (ThisHelp->PrevName == NULL) - DisableButton(db, ID_PREV); + DfDisableButton(db, DF_ID_PREV); /* ------- display the help window ----- */ - DfDialogBox(NULL, db, TRUE, HelpBoxProc); + DfDialogBox(NULL, db, TRUE, DfHelpBoxProc); free(db); fclose(helpfp); rtn = TRUE; @@ -599,38 +599,38 @@ static void DisplayDefinition(DFWINDOW wnd, char *def) DFWINDOW hwnd = wnd; int y; - if (GetClass(wnd) == POPDOWNMENU) - hwnd = GetParent(wnd); - y = GetClass(hwnd) == MENUBAR ? 2 : 1; + if (DfGetClass(wnd) == DF_POPDOWNMENU) + hwnd = DfGetParent(wnd); + y = DfGetClass(hwnd) == DF_MENUBAR ? 2 : 1; FindHelp(def); if (ThisHelp != NULL) { - if ((helpfp = OpenHelpFile()) != NULL) { - dwnd = DfCreateWindow( - TEXTBOX, + if ((helpfp = DfOpenHelpFile()) != NULL) { + dwnd = DfDfCreateWindow( + DF_TEXTBOX, NULL, - GetClientLeft(hwnd), - GetClientTop(hwnd)+y, + DfGetClientLeft(hwnd), + DfGetClientTop(hwnd)+y, min(ThisHelp->hheight, MAXHEIGHT)+3, ThisHelp->hwidth+2, NULL, wnd, NULL, - HASBORDER | NOCLIP | SAVESELF); + DF_HASBORDER | DF_NOCLIP | DF_SAVESELF); if (dwnd != NULL) { /* ----- read the help text ------- */ - SeekHelpLine(ThisHelp->hptr, ThisHelp->bit); + DfSeekHelpLine(ThisHelp->hptr, ThisHelp->bit); while (TRUE) { - if (GetHelpLine(hline) == NULL) + if (DfGetHelpLine(hline) == NULL) break; if (*hline == '<') break; hline[strlen(hline)-1] = '\0'; - DfSendMessage(dwnd,ADDTEXT,(PARAM)hline,0); + DfSendMessage(dwnd,DFM_ADDTEXT,(DF_PARAM)hline,0); } - DfSendMessage(dwnd, SHOW_WINDOW, 0, 0); - DfSendMessage(NULL, WAITKEYBOARD, 0, 0); - DfSendMessage(NULL, WAITMOUSE, 0, 0); - DfSendMessage(dwnd, CLOSE_WINDOW, 0, 0); + DfSendMessage(dwnd, DFM_SHOW_WINDOW, 0, 0); + DfSendMessage(NULL, DFM_WAITKEYBOARD, 0, 0); + DfSendMessage(NULL, DFM_WAITMOUSE, 0, 0); + DfSendMessage(dwnd, DFM_CLOSE_WINDOW, 0, 0); } fclose(helpfp); } @@ -680,37 +680,37 @@ static int OverLap(int a, int b) } /* ----- compute the best location for a help dialogbox ----- */ -static void BestFit(DFWINDOW wnd, DIALOGWINDOW *dwnd) +static void BestFit(DFWINDOW wnd, DF_DIALOGWINDOW *dwnd) { int above, below, right, left; - if (GetClass(wnd) == MENUBAR || - GetClass(wnd) == APPLICATION) { + if (DfGetClass(wnd) == DF_MENUBAR || + DfGetClass(wnd) == DF_APPLICATION) { dwnd->x = dwnd->y = -1; return; } /* --- compute above overlap ---- */ - above = OverLap(dwnd->h, GetTop(wnd)); + above = OverLap(dwnd->h, DfGetTop(wnd)); /* --- compute below overlap ---- */ - below = OverLap(GetBottom(wnd), DfGetScreenHeight()-dwnd->h); + below = OverLap(DfGetBottom(wnd), DfGetScreenHeight()-dwnd->h); /* --- compute right overlap ---- */ - right = OverLap(GetRight(wnd), DfGetScreenWidth()-dwnd->w); + right = OverLap(DfGetRight(wnd), DfGetScreenWidth()-dwnd->w); /* --- compute left overlap ---- */ - left = OverLap(dwnd->w, GetLeft(wnd)); + left = OverLap(dwnd->w, DfGetLeft(wnd)); if (above < below) - dwnd->y = max(0, GetTop(wnd)-dwnd->h-2); + dwnd->y = max(0, DfGetTop(wnd)-dwnd->h-2); else - dwnd->y = min(DfGetScreenHeight()-dwnd->h, GetBottom(wnd)+2); + dwnd->y = min(DfGetScreenHeight()-dwnd->h, DfGetBottom(wnd)+2); if (right < left) - dwnd->x = min(GetRight(wnd)+2, DfGetScreenWidth()-dwnd->w); + dwnd->x = min(DfGetRight(wnd)+2, DfGetScreenWidth()-dwnd->w); else - dwnd->x = max(0, GetLeft(wnd)-dwnd->w-2); + dwnd->x = max(0, DfGetLeft(wnd)-dwnd->w-2); - if (dwnd->x == GetRight(wnd)+2 || - dwnd->x == GetLeft(wnd)-dwnd->w-2) + if (dwnd->x == DfGetRight(wnd)+2 || + dwnd->x == DfGetLeft(wnd)-dwnd->w-2) dwnd->y = -1; - if (dwnd->y ==GetTop(wnd)-dwnd->h-2 || - dwnd->y == GetBottom(wnd)+2) + if (dwnd->y ==DfGetTop(wnd)-dwnd->h-2 || + dwnd->y == DfGetBottom(wnd)+2) dwnd->x = -1; } diff --git a/rosapps/dflat32/htree.c b/rosapps/dflat32/htree.c index fb5b97613a0..3cc2a980342 100644 --- a/rosapps/dflat32/htree.c +++ b/rosapps/dflat32/htree.c @@ -3,12 +3,12 @@ #include "dflat.h" #include "htree.h" -struct htree *ht; +struct DfHTree *ht; int root; int treect; /* ------ build a Huffman tree from a frequency array ------ */ -void buildtree(void) +void DfBuildTree(void) { int i; @@ -25,7 +25,7 @@ void buildtree(void) /* ---- find the two lowest frequencies ---- */ for (i = 0; i < treect; i++) { if (i != h1) { - struct htree *htt = ht+i; + struct DfHTree *htt = ht+i; /* --- find a node without a parent --- */ if (htt->cnt > 0 && htt->parent == -1) { /* ---- h1 & h2 -> lowest nodes ---- */ @@ -47,7 +47,7 @@ void buildtree(void) /* --- combine two nodes and add one --- */ ht[h1].parent = treect; ht[h2].parent = treect; - ht = realloc(ht, (treect+1) * sizeof(struct htree)); + ht = realloc(ht, (treect+1) * sizeof(struct DfHTree)); if (ht == NULL) break; /* --- the new node's frequency is the sum of the two diff --git a/rosapps/dflat32/htree.h b/rosapps/dflat32/htree.h index db25e0a3039..6338a39a283 100644 --- a/rosapps/dflat32/htree.h +++ b/rosapps/dflat32/htree.h @@ -3,29 +3,29 @@ #ifndef HTREE_H #define HTREE_H -typedef unsigned int BYTECOUNTER; +typedef unsigned int DF_BYTECOUNTER; /* ---- Huffman tree structure for building ---- */ -struct htree { - BYTECOUNTER cnt; /* character frequency */ +struct DfHTree { + DF_BYTECOUNTER cnt; /* character frequency */ int parent; /* offset to parent node */ int right; /* offset to right child node */ int left; /* offset to left child node */ }; /* ---- Huffman tree structure in compressed file ---- */ -struct htr { +struct DfHTr { int right; /* offset to right child node */ int left; /* offset to left child node */ }; -extern struct htr *HelpTree; +extern struct DfHTr *DfHelpTree; -void buildtree(void); -FILE *OpenHelpFile(void); -void HelpFilePosition(long *, int *); -void *GetHelpLine(char *); -void SeekHelpLine(long, int); +void DfBuildTree(void); +FILE *DfOpenHelpFile(void); +void DfHelpFilePosition(long *, int *); +void *DfGetHelpLine(char *); +void DfSeekHelpLine(long, int); #endif diff --git a/rosapps/dflat32/huffc.c b/rosapps/dflat32/huffc.c index 98b1f761f03..d8a006cf44d 100644 --- a/rosapps/dflat32/huffc.c +++ b/rosapps/dflat32/huffc.c @@ -3,7 +3,7 @@ #include "dflat.h" #include "htree.h" -extern struct htree *ht; +extern struct DfHTree *ht; extern int root; extern int treect; static int lastchar = '\n'; @@ -29,7 +29,7 @@ void main(int argc, char *argv[]) { FILE *fi, *fo; int c; - BYTECOUNTER bytectr = 0; + DF_BYTECOUNTER bytectr = 0; if (argc < 3) { printf("\nusage: huffc infile outfile"); @@ -46,7 +46,7 @@ void main(int argc, char *argv[]) exit(1); } - ht = calloc(256, sizeof(struct htree)); + ht = calloc(256, sizeof(struct DfHTree)); /* - read the input file and count character frequency - */ while ((c = fgetcx(fi)) != EOF) { @@ -56,7 +56,7 @@ void main(int argc, char *argv[]) } /* ---- build the huffman tree ---- */ - buildtree(); + DfBuildTree(); /* --- write the byte count to the output file --- */ fwrite(&bytectr, sizeof bytectr, 1, fo); diff --git a/rosapps/dflat32/keys.c b/rosapps/dflat32/keys.c index 1aeba0bb95c..39db3ba7746 100644 --- a/rosapps/dflat32/keys.c +++ b/rosapps/dflat32/keys.c @@ -3,83 +3,83 @@ #include #include "keys.h" -struct keys keys[] = { - {F1, "F1"}, - {F2, "F2"}, - {F3, "F3"}, - {F4, "F4"}, - {F5, "F5"}, - {F6, "F6"}, - {F7, "F7"}, - {F8, "F8"}, - {F9, "F9"}, - {F10, "F10"}, - {CTRL_F1, "Ctrl+F1"}, - {CTRL_F2, "Ctrl+F2"}, - {CTRL_F3, "Ctrl+F3"}, - {CTRL_F4, "Ctrl+F4"}, - {CTRL_F5, "Ctrl+F5"}, - {CTRL_F6, "Ctrl+F6"}, - {CTRL_F7, "Ctrl+F7"}, - {CTRL_F8, "Ctrl+F8"}, - {CTRL_F9, "Ctrl+F9"}, - {CTRL_F10, "Ctrl+F10"}, - {ALT_F1, "Alt+F1"}, - {ALT_F2, "Alt+F2"}, - {ALT_F3, "Alt+F3"}, - {ALT_F4, "Alt+F4"}, - {ALT_F5, "Alt+F5"}, - {ALT_F6, "Alt+F6"}, - {ALT_F7, "Alt+F7"}, - {ALT_F8, "Alt+F8"}, - {ALT_F9, "Alt+F9"}, - {ALT_F10, "Alt+F10"}, - {HOME, "Home"}, - {UP, "Up"}, - {PGUP, "PgUp"}, - {BS, "BS"}, - {END, "End"}, - {DN, "Dn"}, - {PGDN, "PgDn"}, - {INS, "Ins"}, - {DEL, "Del"}, - {CTRL_HOME, "Ctrl+Home"}, - {CTRL_PGUP, "Ctrl+PgUp"}, - {CTRL_BS, "Ctrl+BS"}, - {CTRL_END, "Ctrl+End"}, - {CTRL_PGDN, "Ctrl+PgDn"}, - {SHIFT_HT, "Shift+Tab"}, - {ALT_BS, "Alt+BS"}, - {ALT_DEL, "Alt+Del"}, - {SHIFT_DEL, "Shift+Del"}, - {SHIFT_INS, "Shift+Ins"}, - {CTRL_INS, "Ctrl+Ins"}, - {ALT_A, "Alt+A"}, - {ALT_B, "Alt+B"}, - {ALT_C, "Alt+C"}, - {ALT_D, "Alt+D"}, - {ALT_E, "Alt+E"}, - {ALT_F, "Alt+F"}, - {ALT_G, "Alt+G"}, - {ALT_H, "Alt+H"}, - {ALT_I, "Alt+I"}, - {ALT_J, "Alt+J"}, - {ALT_K, "Alt+K"}, - {ALT_L, "Alt+L"}, - {ALT_M, "Alt+M"}, - {ALT_N, "Alt+N"}, - {ALT_O, "Alt+O"}, - {ALT_P, "Alt+P"}, - {ALT_Q, "Alt+Q"}, - {ALT_R, "Alt+R"}, - {ALT_S, "Alt+S"}, - {ALT_T, "Alt+T"}, - {ALT_U, "Alt+U"}, - {ALT_V, "Alt+V"}, - {ALT_W, "Alt+W"}, - {ALT_X, "Alt+X"}, - {ALT_Y, "Alt+Y"}, - {ALT_Z, "Alt+Z"}, +struct DfKeys keys[] = { + {DF_F1, "DF_F1"}, + {DF_F2, "DF_F2"}, + {DF_F3, "DF_F3"}, + {DF_F4, "DF_F4"}, + {DF_F5, "DF_F5"}, + {DF_F6, "DF_F6"}, + {DF_F7, "DF_F7"}, + {DF_F8, "DF_F8"}, + {DF_F9, "DF_F9"}, + {DF_F10, "DF_F10"}, + {DF_CTRL_F1, "Ctrl+DF_F1"}, + {DF_CTRL_F2, "Ctrl+DF_F2"}, + {DF_CTRL_F3, "Ctrl+DF_F3"}, + {DF_CTRL_F4, "Ctrl+DF_F4"}, + {DF_CTRL_F5, "Ctrl+DF_F5"}, + {DF_CTRL_F6, "Ctrl+DF_F6"}, + {DF_CTRL_F7, "Ctrl+DF_F7"}, + {DF_CTRL_F8, "Ctrl+DF_F8"}, + {DF_CTRL_F9, "Ctrl+DF_F9"}, + {DF_CTRL_F10, "Ctrl+DF_F10"}, + {DF_ALT_F1, "Alt+DF_F1"}, + {DF_ALT_F2, "Alt+DF_F2"}, + {DF_ALT_F3, "Alt+DF_F3"}, + {DF_ALT_F4, "Alt+DF_F4"}, + {DF_ALT_F5, "Alt+DF_F5"}, + {DF_ALT_F6, "Alt+DF_F6"}, + {DF_ALT_F7, "Alt+DF_F7"}, + {DF_ALT_F8, "Alt+DF_F8"}, + {DF_ALT_F9, "Alt+DF_F9"}, + {DF_ALT_F10, "Alt+DF_F10"}, + {DF_HOME, "Home"}, + {DF_UP, "Up"}, + {DF_PGUP, "PgUp"}, + {DF_BS, "DF_BS"}, + {DF_END, "End"}, + {DF_DN, "Dn"}, + {DF_PGDN, "PgDn"}, + {DF_INS, "Ins"}, + {DF_DEL, "Del"}, + {DF_CTRL_HOME, "Ctrl+Home"}, + {DF_CTRL_PGUP, "Ctrl+PgUp"}, + {DF_CTRL_BS, "Ctrl+DF_BS"}, + {DF_CTRL_END, "Ctrl+End"}, + {DF_CTRL_PGDN, "Ctrl+PgDn"}, + {DF_SHIFT_HT, "Shift+Tab"}, + {DF_ALT_BS, "Alt+DF_BS"}, + {DF_ALT_DEL, "Alt+Del"}, + {DF_SHIFT_DEL, "Shift+Del"}, + {DF_SHIFT_INS, "Shift+Ins"}, + {DF_CTRL_INS, "Ctrl+Ins"}, + {DF_ALT_A, "Alt+A"}, + {DF_ALT_B, "Alt+B"}, + {DF_ALT_C, "Alt+C"}, + {DF_ALT_D, "Alt+D"}, + {DF_ALT_E, "Alt+E"}, + {DF_ALT_F, "Alt+F"}, + {DF_ALT_G, "Alt+G"}, + {DF_ALT_H, "Alt+H"}, + {DF_ALT_I, "Alt+I"}, + {DF_ALT_J, "Alt+J"}, + {DF_ALT_K, "Alt+K"}, + {DF_ALT_L, "Alt+L"}, + {DF_ALT_M, "Alt+M"}, + {DF_ALT_N, "Alt+N"}, + {DF_ALT_O, "Alt+O"}, + {DF_ALT_P, "Alt+P"}, + {DF_ALT_Q, "Alt+Q"}, + {DF_ALT_R, "Alt+R"}, + {DF_ALT_S, "Alt+S"}, + {DF_ALT_T, "Alt+T"}, + {DF_ALT_U, "Alt+U"}, + {DF_ALT_V, "Alt+V"}, + {DF_ALT_W, "Alt+W"}, + {DF_ALT_X, "Alt+X"}, + {DF_ALT_Y, "Alt+Y"}, + {DF_ALT_Z, "Alt+Z"}, {-1, NULL} }; diff --git a/rosapps/dflat32/keys.h b/rosapps/dflat32/keys.h index 51707d889b6..d8a780d4461 100644 --- a/rosapps/dflat32/keys.h +++ b/rosapps/dflat32/keys.h @@ -3,117 +3,117 @@ #ifndef KEYS_H #define KEYS_H -#define OFFSET 0x1000 +#define DF_OFFSET 0x1000 -#define RUBOUT 8 /* BACHSPACE KEY */ -#define BELL 7 -#define ESC 27 -#define ALT_BS (197+OFFSET) -#define ALT_DEL (184+OFFSET) -#define SHIFT_DEL (198+OFFSET) -#define CTRL_INS (186+OFFSET) -#define SHIFT_INS (185+OFFSET) -#define SHIFT_F8 (219+OFFSET) -#define F1 (187+OFFSET) -#define F2 (188+OFFSET) -#define F3 (189+OFFSET) -#define F4 (190+OFFSET) -#define F5 (191+OFFSET) -#define F6 (192+OFFSET) -#define F7 (193+OFFSET) -#define F8 (194+OFFSET) -#define F9 (195+OFFSET) -#define F10 (196+OFFSET) -#define CTRL_F1 (222+OFFSET) -#define CTRL_F2 (223+OFFSET) -#define CTRL_F3 (224+OFFSET) -#define CTRL_F4 (225+OFFSET) -#define CTRL_F5 (226+OFFSET) -#define CTRL_F6 (227+OFFSET) -#define CTRL_F7 (228+OFFSET) -#define CTRL_F8 (229+OFFSET) -#define CTRL_F9 (230+OFFSET) -#define CTRL_F10 (231+OFFSET) -#define ALT_F1 (232+OFFSET) -#define ALT_F2 (233+OFFSET) -#define ALT_F3 (234+OFFSET) -#define ALT_F4 (235+OFFSET) -#define ALT_F5 (236+OFFSET) -#define ALT_F6 (237+OFFSET) -#define ALT_F7 (238+OFFSET) -#define ALT_F8 (239+OFFSET) -#define ALT_F9 (240+OFFSET) -#define ALT_F10 (241+OFFSET) -#define HOME (199+OFFSET) -#define UP (200+OFFSET) -#define PGUP (201+OFFSET) -#define BS (203+OFFSET) /* CURSOR LEFT KEY */ -#define FWD (205+OFFSET) /* CURSOR RIGHT KEY */ -#define END (207+OFFSET) -#define DN (208+OFFSET) -#define PGDN (209+OFFSET) -#define INS (210+OFFSET) -#define DEL (211+OFFSET) -#define CTRL_HOME (247+OFFSET) -#define CTRL_PGUP (132+OFFSET) -#define CTRL_BS (243+OFFSET) -#define CTRL_FIVE (143+OFFSET) -#define CTRL_FWD (244+OFFSET) -#define CTRL_END (245+OFFSET) -#define CTRL_PGDN (246+OFFSET) -#define SHIFT_HT (143+OFFSET) -#define ALT_A (158+OFFSET) -#define ALT_B (176+OFFSET) -#define ALT_C (174+OFFSET) -#define ALT_D (160+OFFSET) -#define ALT_E (146+OFFSET) -#define ALT_F (161+OFFSET) -#define ALT_G (162+OFFSET) -#define ALT_H (163+OFFSET) -#define ALT_I (151+OFFSET) -#define ALT_J (164+OFFSET) -#define ALT_K (165+OFFSET) -#define ALT_L (166+OFFSET) -#define ALT_M (178+OFFSET) -#define ALT_N (177+OFFSET) -#define ALT_O (152+OFFSET) -#define ALT_P (153+OFFSET) -#define ALT_Q (144+OFFSET) -#define ALT_R (147+OFFSET) -#define ALT_S (159+OFFSET) -#define ALT_T (148+OFFSET) -#define ALT_U (150+OFFSET) -#define ALT_V (175+OFFSET) -#define ALT_W (145+OFFSET) -#define ALT_X (173+OFFSET) -#define ALT_Y (149+OFFSET) -#define ALT_Z (172+OFFSET) -#define ALT_1 (0xf8+OFFSET) -#define ALT_2 (0xf9+OFFSET) -#define ALT_3 (0xfa+OFFSET) -#define ALT_4 (0xfb+OFFSET) -#define ALT_5 (0xfc+OFFSET) -#define ALT_6 (0xfd+OFFSET) -#define ALT_7 (0xfe+OFFSET) -#define ALT_8 (0xff+OFFSET) -#define ALT_9 (0x80+OFFSET) -#define ALT_0 (0x81+OFFSET) -#define ALT_HYPHEN (130+OFFSET) +#define DF_RUBOUT 8 /* BACHSPACE KEY */ +#define DF_BELL 7 +#define DF_ESC 27 +#define DF_ALT_BS (197+DF_OFFSET) +#define DF_ALT_DEL (184+DF_OFFSET) +#define DF_SHIFT_DEL (198+DF_OFFSET) +#define DF_CTRL_INS (186+DF_OFFSET) +#define DF_SHIFT_INS (185+DF_OFFSET) +#define DF_SHIFT_F8 (219+DF_OFFSET) +#define DF_F1 (187+DF_OFFSET) +#define DF_F2 (188+DF_OFFSET) +#define DF_F3 (189+DF_OFFSET) +#define DF_F4 (190+DF_OFFSET) +#define DF_F5 (191+DF_OFFSET) +#define DF_F6 (192+DF_OFFSET) +#define DF_F7 (193+DF_OFFSET) +#define DF_F8 (194+DF_OFFSET) +#define DF_F9 (195+DF_OFFSET) +#define DF_F10 (196+DF_OFFSET) +#define DF_CTRL_F1 (222+DF_OFFSET) +#define DF_CTRL_F2 (223+DF_OFFSET) +#define DF_CTRL_F3 (224+DF_OFFSET) +#define DF_CTRL_F4 (225+DF_OFFSET) +#define DF_CTRL_F5 (226+DF_OFFSET) +#define DF_CTRL_F6 (227+DF_OFFSET) +#define DF_CTRL_F7 (228+DF_OFFSET) +#define DF_CTRL_F8 (229+DF_OFFSET) +#define DF_CTRL_F9 (230+DF_OFFSET) +#define DF_CTRL_F10 (231+DF_OFFSET) +#define DF_ALT_F1 (232+DF_OFFSET) +#define DF_ALT_F2 (233+DF_OFFSET) +#define DF_ALT_F3 (234+DF_OFFSET) +#define DF_ALT_F4 (235+DF_OFFSET) +#define DF_ALT_F5 (236+DF_OFFSET) +#define DF_ALT_F6 (237+DF_OFFSET) +#define DF_ALT_F7 (238+DF_OFFSET) +#define DF_ALT_F8 (239+DF_OFFSET) +#define DF_ALT_F9 (240+DF_OFFSET) +#define DF_ALT_F10 (241+DF_OFFSET) +#define DF_HOME (199+DF_OFFSET) +#define DF_UP (200+DF_OFFSET) +#define DF_PGUP (201+DF_OFFSET) +#define DF_BS (203+DF_OFFSET) /* CURSOR LEFT KEY */ +#define DF_FWD (205+DF_OFFSET) /* CURSOR RIGHT KEY */ +#define DF_END (207+DF_OFFSET) +#define DF_DN (208+DF_OFFSET) +#define DF_PGDN (209+DF_OFFSET) +#define DF_INS (210+DF_OFFSET) +#define DF_DEL (211+DF_OFFSET) +#define DF_CTRL_HOME (247+DF_OFFSET) +#define DF_CTRL_PGUP (132+DF_OFFSET) +#define DF_CTRL_BS (243+DF_OFFSET) +#define DF_CTRL_FIVE (143+DF_OFFSET) +#define DF_CTRL_FWD (244+DF_OFFSET) +#define DF_CTRL_END (245+DF_OFFSET) +#define DF_CTRL_PGDN (246+DF_OFFSET) +#define DF_SHIFT_HT (143+DF_OFFSET) +#define DF_ALT_A (158+DF_OFFSET) +#define DF_ALT_B (176+DF_OFFSET) +#define DF_ALT_C (174+DF_OFFSET) +#define DF_ALT_D (160+DF_OFFSET) +#define DF_ALT_E (146+DF_OFFSET) +#define DF_ALT_F (161+DF_OFFSET) +#define DF_ALT_G (162+DF_OFFSET) +#define DF_ALT_H (163+DF_OFFSET) +#define DF_ALT_I (151+DF_OFFSET) +#define DF_ALT_J (164+DF_OFFSET) +#define DF_ALT_K (165+DF_OFFSET) +#define DF_ALT_L (166+DF_OFFSET) +#define DF_ALT_M (178+DF_OFFSET) +#define DF_ALT_N (177+DF_OFFSET) +#define DF_ALT_O (152+DF_OFFSET) +#define DF_ALT_P (153+DF_OFFSET) +#define DF_ALT_Q (144+DF_OFFSET) +#define DF_ALT_R (147+DF_OFFSET) +#define DF_ALT_S (159+DF_OFFSET) +#define DF_ALT_T (148+DF_OFFSET) +#define DF_ALT_U (150+DF_OFFSET) +#define DF_ALT_V (175+DF_OFFSET) +#define DF_ALT_W (145+DF_OFFSET) +#define DF_ALT_X (173+DF_OFFSET) +#define DF_ALT_Y (149+DF_OFFSET) +#define DF_ALT_Z (172+DF_OFFSET) +#define DF_ALT_1 (0xf8+DF_OFFSET) +#define DF_ALT_2 (0xf9+DF_OFFSET) +#define DF_ALT_3 (0xfa+DF_OFFSET) +#define DF_ALT_4 (0xfb+DF_OFFSET) +#define DF_ALT_5 (0xfc+DF_OFFSET) +#define DF_ALT_6 (0xfd+DF_OFFSET) +#define DF_ALT_7 (0xfe+DF_OFFSET) +#define DF_ALT_8 (0xff+DF_OFFSET) +#define DF_ALT_9 (0x80+DF_OFFSET) +#define DF_ALT_0 (0x81+DF_OFFSET) +#define DF_ALT_HYPHEN (130+DF_OFFSET) -#define RIGHTSHIFT 0x01 -#define LEFTSHIFT 0x02 -#define CTRLKEY 0x04 -#define ALTKEY 0x08 -#define SCROLLLOCK 0x10 -#define NUMLOCK 0x20 -#define CAPSLOCK 0x40 -#define INSERTKEY 0x80 +#define DF_RIGHTSHIFT 0x01 +#define DF_LEFTSHIFT 0x02 +#define DF_CTRLKEY 0x04 +#define DF_ALTKEY 0x08 +#define DF_SCROLLLOCK 0x10 +#define DF_NUMLOCK 0x20 +#define DF_CAPSLOCK 0x40 +#define DF_INSERTKEY 0x80 -struct keys { +struct DfKeys { int keycode; char *keylabel; }; -extern struct keys keys[]; +extern struct DfKeys keys[]; #endif diff --git a/rosapps/dflat32/listbox.c b/rosapps/dflat32/listbox.c index cc31110fb40..c6f9d15a69d 100644 --- a/rosapps/dflat32/listbox.c +++ b/rosapps/dflat32/listbox.c @@ -4,7 +4,7 @@ #ifdef INCLUDE_EXTENDEDSELECTIONS static int ExtendSelections(DFWINDOW, int, int); -static void TestExtended(DFWINDOW, PARAM); +static void TestExtended(DFWINDOW, DF_PARAM); static void ClearAllSelections(DFWINDOW); static void SetSelection(DFWINDOW, int); static void FlipSelection(DFWINDOW, int); @@ -19,106 +19,106 @@ static BOOL SelectionInWindow(DFWINDOW, int); static int py = -1; /* the previous y mouse coordinate */ #ifdef INCLUDE_EXTENDEDSELECTIONS -/* --------- SHIFT_F8 Key ------------ */ +/* --------- DF_SHIFT_F8 Key ------------ */ static void AddModeKey(DFWINDOW wnd) { - if (isMultiLine(wnd)) { + if (DfIsMultiLine(wnd)) { wnd->AddMode ^= TRUE; - DfSendMessage(GetParent(wnd), ADDSTATUS, - wnd->AddMode ? ((PARAM) "Add Mode") : 0, 0); + DfSendMessage(DfGetParent(wnd), DFM_ADDSTATUS, + wnd->AddMode ? ((DF_PARAM) "Add Mode") : 0, 0); } } #endif -/* --------- UP (Up Arrow) Key ------------ */ -static void UpKey(DFWINDOW wnd, PARAM p2) +/* --------- DF_UP (Up Arrow) Key ------------ */ +static void UpKey(DFWINDOW wnd, DF_PARAM p2) { if (wnd->selection > 0) { if (wnd->selection == wnd->wtop) { - BaseWndProc(LISTBOX, wnd, KEYBOARD, UP, p2); - DfPostMessage(wnd, LB_SELECTION, wnd->selection-1, - isMultiLine(wnd) ? p2 : FALSE); + DfBaseWndProc(DF_LISTBOX, wnd, DFM_KEYBOARD, DF_UP, p2); + DfPostMessage(wnd, DFM_LB_SELECTION, wnd->selection-1, + DfIsMultiLine(wnd) ? p2 : FALSE); } else { int newsel = wnd->selection-1; - if (wnd->wlines == ClientHeight(wnd)) - while (*TextLine(wnd, newsel) == LINE) + if (wnd->wlines == DfClientHeight(wnd)) + while (*DfTextLine(wnd, newsel) == DF_LINE) --newsel; - DfPostMessage(wnd, LB_SELECTION, newsel, + DfPostMessage(wnd, DFM_LB_SELECTION, newsel, #ifdef INCLUDE_EXTENDEDSELECTIONS - isMultiLine(wnd) ? p2 : + DfIsMultiLine(wnd) ? p2 : #endif FALSE); } } } -/* --------- DN (Down Arrow) Key ------------ */ -static void DnKey(DFWINDOW wnd, PARAM p2) +/* --------- DF_DN (Down Arrow) Key ------------ */ +static void DnKey(DFWINDOW wnd, DF_PARAM p2) { if (wnd->selection < wnd->wlines-1) { - if (wnd->selection == wnd->wtop+ClientHeight(wnd)-1) { - BaseWndProc(LISTBOX, wnd, KEYBOARD, DN, p2); - DfPostMessage(wnd, LB_SELECTION, wnd->selection+1, - isMultiLine(wnd) ? p2 : FALSE); + if (wnd->selection == wnd->wtop+DfClientHeight(wnd)-1) { + DfBaseWndProc(DF_LISTBOX, wnd, DFM_KEYBOARD, DF_DN, p2); + DfPostMessage(wnd, DFM_LB_SELECTION, wnd->selection+1, + DfIsMultiLine(wnd) ? p2 : FALSE); } else { int newsel = wnd->selection+1; - if (wnd->wlines == ClientHeight(wnd)) - while (*TextLine(wnd, newsel) == LINE) + if (wnd->wlines == DfClientHeight(wnd)) + while (*DfTextLine(wnd, newsel) == DF_LINE) newsel++; - DfPostMessage(wnd, LB_SELECTION, newsel, + DfPostMessage(wnd, DFM_LB_SELECTION, newsel, #ifdef INCLUDE_EXTENDEDSELECTIONS - isMultiLine(wnd) ? p2 : + DfIsMultiLine(wnd) ? p2 : #endif FALSE); } } } -/* --------- HOME and PGUP Keys ------------ */ -static void HomePgUpKey(DFWINDOW wnd, PARAM p1, PARAM p2) +/* --------- DF_HOME and DF_PGUP Keys ------------ */ +static void HomePgUpKey(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - BaseWndProc(LISTBOX, wnd, KEYBOARD, p1, p2); - DfPostMessage(wnd, LB_SELECTION, wnd->wtop, + DfBaseWndProc(DF_LISTBOX, wnd, DFM_KEYBOARD, p1, p2); + DfPostMessage(wnd, DFM_LB_SELECTION, wnd->wtop, #ifdef INCLUDE_EXTENDEDSELECTIONS - isMultiLine(wnd) ? p2 : + DfIsMultiLine(wnd) ? p2 : #endif FALSE); } -/* --------- END and PGDN Keys ------------ */ -static void EndPgDnKey(DFWINDOW wnd, PARAM p1, PARAM p2) +/* --------- DF_END and DF_PGDN Keys ------------ */ +static void EndPgDnKey(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { int bot; - BaseWndProc(LISTBOX, wnd, KEYBOARD, p1, p2); - bot = wnd->wtop+ClientHeight(wnd)-1; + DfBaseWndProc(DF_LISTBOX, wnd, DFM_KEYBOARD, p1, p2); + bot = wnd->wtop+DfClientHeight(wnd)-1; if (bot > wnd->wlines-1) bot = wnd->wlines-1; - DfPostMessage(wnd, LB_SELECTION, bot, + DfPostMessage(wnd, DFM_LB_SELECTION, bot, #ifdef INCLUDE_EXTENDEDSELECTIONS - isMultiLine(wnd) ? p2 : + DfIsMultiLine(wnd) ? p2 : #endif FALSE); } #ifdef INCLUDE_EXTENDEDSELECTIONS /* --------- Space Bar Key ------------ */ -static void SpacebarKey(DFWINDOW wnd, PARAM p2) +static void SpacebarKey(DFWINDOW wnd, DF_PARAM p2) { - if (isMultiLine(wnd)) { - int sel = DfSendMessage(wnd, LB_CURRENTSELECTION, 0, 0); + if (DfIsMultiLine(wnd)) { + int sel = DfSendMessage(wnd, DFM_LB_CURRENTSELECTION, 0, 0); if (sel != -1) { if (wnd->AddMode) FlipSelection(wnd, sel); - if (ItemSelected(wnd, sel)) { - if (!((int) p2 & (LEFTSHIFT | RIGHTSHIFT))) + if (DfItemSelected(wnd, sel)) { + if (!((int) p2 & (DF_LEFTSHIFT | DF_RIGHTSHIFT))) wnd->AnchorPoint = sel; ExtendSelections(wnd, sel, (int) p2); } else wnd->AnchorPoint = -1; - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } } } @@ -128,32 +128,32 @@ static void SpacebarKey(DFWINDOW wnd, PARAM p2) static void EnterKey(DFWINDOW wnd) { if (wnd->selection != -1) { - DfSendMessage(wnd, LB_SELECTION, wnd->selection, TRUE); - DfSendMessage(wnd, LB_CHOOSE, wnd->selection, 0); + DfSendMessage(wnd, DFM_LB_SELECTION, wnd->selection, TRUE); + DfSendMessage(wnd, DFM_LB_CHOOSE, wnd->selection, 0); } } /* --------- All Other Key Presses ------------ */ -static void KeyPress(DFWINDOW wnd, PARAM p1, PARAM p2) +static void KeyPress(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { int sel = wnd->selection+1; while (sel < wnd->wlines) { - char *cp = TextLine(wnd, sel); + char *cp = DfTextLine(wnd, sel); if (cp == NULL) break; #ifdef INCLUDE_EXTENDEDSELECTIONS - if (isMultiLine(wnd)) + if (DfIsMultiLine(wnd)) cp++; #endif /* --- special for directory list box --- */ if (*cp == '[') cp++; if (tolower(*cp) == (int)p1) { - DfSendMessage(wnd, LB_SELECTION, sel, - isMultiLine(wnd) ? p2 : FALSE); + DfSendMessage(wnd, DFM_LB_SELECTION, sel, + DfIsMultiLine(wnd) ? p2 : FALSE); if (!SelectionInWindow(wnd, sel)) { - wnd->wtop = sel-ClientHeight(wnd)+1; - DfSendMessage(wnd, PAINT, 0, 0); + wnd->wtop = sel-DfClientHeight(wnd)+1; + DfSendMessage(wnd, DFM_PAINT, 0, 0); } break; } @@ -161,30 +161,30 @@ static void KeyPress(DFWINDOW wnd, PARAM p1, PARAM p2) } } -/* --------- KEYBOARD Message ------------ */ -static int KeyboardMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* --------- DFM_KEYBOARD Message ------------ */ +static int KeyboardMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { switch ((int) p1) { #ifdef INCLUDE_EXTENDEDSELECTIONS - case SHIFT_F8: + case DF_SHIFT_F8: AddModeKey(wnd); return TRUE; #endif - case UP: + case DF_UP: TestExtended(wnd, p2); UpKey(wnd, p2); return TRUE; - case DN: + case DF_DN: TestExtended(wnd, p2); DnKey(wnd, p2); return TRUE; - case PGUP: - case HOME: + case DF_PGUP: + case DF_HOME: TestExtended(wnd, p2); HomePgUpKey(wnd, p1, p2); return TRUE; - case PGDN: - case END: + case DF_PGDN: + case DF_END: TestExtended(wnd, p2); EndPgDnKey(wnd, p1, p2); return TRUE; @@ -203,89 +203,89 @@ static int KeyboardMsg(DFWINDOW wnd, PARAM p1, PARAM p2) return FALSE; } -/* ------- LEFT_BUTTON Message -------- */ -static int LeftButtonMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* ------- DFM_LEFT_BUTTON Message -------- */ +static int LeftButtonMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - int my = (int) p2 - GetTop(wnd); + int my = (int) p2 - DfGetTop(wnd); if (my >= wnd->wlines-wnd->wtop) my = wnd->wlines - wnd->wtop; - if (!InsideRect(p1, p2, ClientRect(wnd))) + if (!DfInsideRect(p1, p2, DfClientRect(wnd))) return FALSE; if (wnd->wlines && my != py) { int sel = wnd->wtop+my-1; #ifdef INCLUDE_EXTENDEDSELECTIONS - int sh = getshift(); - if (!(sh & (LEFTSHIFT | RIGHTSHIFT))) { - if (!(sh & CTRLKEY)) + int sh = DfGetShift(); + if (!(sh & (DF_LEFTSHIFT | DF_RIGHTSHIFT))) { + if (!(sh & DF_CTRLKEY)) ClearAllSelections(wnd); wnd->AnchorPoint = sel; - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } #endif - DfSendMessage(wnd, LB_SELECTION, sel, TRUE); + DfSendMessage(wnd, DFM_LB_SELECTION, sel, TRUE); py = my; } return TRUE; } /* ------------- DOUBLE_CLICK Message ------------ */ -static int DoubleClickMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +static int DoubleClickMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - if (WindowMoving || WindowSizing) + if (DfWindowMoving || DfWindowSizing) return FALSE; if (wnd->wlines) { - DFRECT rc = ClientRect(wnd); - BaseWndProc(LISTBOX, wnd, DOUBLE_CLICK, p1, p2); - if (InsideRect(p1, p2, rc)) - DfSendMessage(wnd, LB_CHOOSE, wnd->selection, 0); + DFRECT rc = DfClientRect(wnd); + DfBaseWndProc(DF_LISTBOX, wnd, DOUBLE_CLICK, p1, p2); + if (DfInsideRect(p1, p2, rc)) + DfSendMessage(wnd, DFM_LB_CHOOSE, wnd->selection, 0); } return TRUE; } -/* ------------ ADDTEXT Message -------------- */ -static int AddTextMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* ------------ DFM_ADDTEXT Message -------------- */ +static int AddTextMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - int rtn = BaseWndProc(LISTBOX, wnd, ADDTEXT, p1, p2); + int rtn = DfBaseWndProc(DF_LISTBOX, wnd, DFM_ADDTEXT, p1, p2); if (wnd->selection == -1) - DfSendMessage(wnd, LB_SETSELECTION, 0, 0); + DfSendMessage(wnd, DFM_LB_SETSELECTION, 0, 0); #ifdef INCLUDE_EXTENDEDSELECTIONS - if (*(char *)p1 == LISTSELECTOR) + if (*(char *)p1 == DF_LISTSELECTOR) wnd->SelectCount++; #endif return rtn; } -/* --------- GETTEXT Message ------------ */ -static void GetTextMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* --------- DFM_GETTEXT Message ------------ */ +static void GetTextMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { if ((int)p2 != -1) { char *cp1 = (char *)p1; - char *cp2 = TextLine(wnd, (int)p2); + char *cp2 = DfTextLine(wnd, (int)p2); while (cp2 && *cp2 && *cp2 != '\n') *cp1++ = *cp2++; *cp1 = '\0'; } } -/* --------- LISTBOX Window Processing Module ------------ */ -int ListBoxProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +/* --------- DF_LISTBOX Window Processing Module ------------ */ +int DfListBoxProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { switch (msg) { - case CREATE_WINDOW: - BaseWndProc(LISTBOX, wnd, msg, p1, p2); + case DFM_CREATE_WINDOW: + DfBaseWndProc(DF_LISTBOX, wnd, msg, p1, p2); wnd->selection = -1; #ifdef INCLUDE_EXTENDEDSELECTIONS wnd->AnchorPoint = -1; #endif return TRUE; - case KEYBOARD: - if (WindowMoving || WindowSizing) + case DFM_KEYBOARD: + if (DfWindowMoving || DfWindowSizing) break; if (KeyboardMsg(wnd, p1, p2)) return TRUE; break; - case LEFT_BUTTON: + case DFM_LEFT_BUTTON: if (LeftButtonMsg(wnd, p1, p2) == TRUE) return TRUE; break; @@ -294,84 +294,84 @@ int ListBoxProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) return TRUE; break; case DFM_BUTTON_RELEASED: - if (WindowMoving || WindowSizing || VSliding) + if (DfWindowMoving || DfWindowSizing || DfVSliding) break; py = -1; return TRUE; - case ADDTEXT: + case DFM_ADDTEXT: return AddTextMsg(wnd, p1, p2); case DFM_LB_GETTEXT: GetTextMsg(wnd, p1, p2); return TRUE; - case CLEARTEXT: + case DFM_CLEARTEXT: wnd->selection = -1; #ifdef INCLUDE_EXTENDEDSELECTIONS wnd->AnchorPoint = -1; #endif wnd->SelectCount = 0; break; - case PAINT: - BaseWndProc(LISTBOX, wnd, msg, p1, p2); + case DFM_PAINT: + DfBaseWndProc(DF_LISTBOX, wnd, msg, p1, p2); WriteSelection(wnd, wnd->selection, TRUE, (DFRECT *)p1); return TRUE; - case SCROLL: - case HORIZSCROLL: - case SCROLLPAGE: - case HORIZPAGE: - case SCROLLDOC: - BaseWndProc(LISTBOX, wnd, msg, p1, p2); + case DFM_SCROLL: + case DFM_HORIZSCROLL: + case DFM_SCROLLPAGE: + case DFM_HORIZPAGE: + case DFM_SCROLLDOC: + DfBaseWndProc(DF_LISTBOX, wnd, msg, p1, p2); WriteSelection(wnd,wnd->selection,TRUE,NULL); return TRUE; - case LB_CHOOSE: - DfSendMessage(GetParent(wnd), LB_CHOOSE, p1, p2); + case DFM_LB_CHOOSE: + DfSendMessage(DfGetParent(wnd), DFM_LB_CHOOSE, p1, p2); return TRUE; - case LB_SELECTION: + case DFM_LB_SELECTION: ChangeSelection(wnd, (int) p1, (int) p2); - DfSendMessage(GetParent(wnd), LB_SELECTION, + DfSendMessage(DfGetParent(wnd), DFM_LB_SELECTION, wnd->selection, 0); return TRUE; - case LB_CURRENTSELECTION: + case DFM_LB_CURRENTSELECTION: return wnd->selection; - case LB_SETSELECTION: + case DFM_LB_SETSELECTION: ChangeSelection(wnd, (int) p1, 0); return TRUE; #ifdef INCLUDE_EXTENDEDSELECTIONS - case CLOSE_WINDOW: - if (isMultiLine(wnd) && wnd->AddMode) { + case DFM_CLOSE_WINDOW: + if (DfIsMultiLine(wnd) && wnd->AddMode) { wnd->AddMode = FALSE; - DfSendMessage(GetParent(wnd), ADDSTATUS, 0, 0); + DfSendMessage(DfGetParent(wnd), DFM_ADDSTATUS, 0, 0); } break; #endif default: break; } - return BaseWndProc(LISTBOX, wnd, msg, p1, p2); + return DfBaseWndProc(DF_LISTBOX, wnd, msg, p1, p2); } static BOOL SelectionInWindow(DFWINDOW wnd, int sel) { return (wnd->wlines && sel >= wnd->wtop && - sel < wnd->wtop+ClientHeight(wnd)); + sel < wnd->wtop+DfClientHeight(wnd)); } static void WriteSelection(DFWINDOW wnd, int sel, - int reverse, DFRECT *rc) + int _reverse, DFRECT *rc) { - if (isVisible(wnd)) + if (DfIsVisible(wnd)) if (SelectionInWindow(wnd, sel)) - WriteTextLine(wnd, rc, sel, reverse); + DfWriteTextLine(wnd, rc, sel, _reverse); } #ifdef INCLUDE_EXTENDEDSELECTIONS /* ----- Test for extended selections in the listbox ----- */ -static void TestExtended(DFWINDOW wnd, PARAM p2) +static void TestExtended(DFWINDOW wnd, DF_PARAM p2) { - if (isMultiLine(wnd) && !wnd->AddMode && - !((int) p2 & (LEFTSHIFT | RIGHTSHIFT))) { + if (DfIsMultiLine(wnd) && !wnd->AddMode && + !((int) p2 & (DF_LEFTSHIFT | DF_RIGHTSHIFT))) { if (wnd->SelectCount > 1) { ClearAllSelections(wnd); - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } } } @@ -379,7 +379,7 @@ static void TestExtended(DFWINDOW wnd, PARAM p2) /* ----- Clear selections in the listbox ----- */ static void ClearAllSelections(DFWINDOW wnd) { - if (isMultiLine(wnd) && wnd->SelectCount > 0) { + if (DfIsMultiLine(wnd) && wnd->SelectCount > 0) { int sel; for (sel = 0; sel < wnd->wlines; sel++) ClearSelection(wnd, sel); @@ -389,8 +389,8 @@ static void ClearAllSelections(DFWINDOW wnd) /* ----- Invert a selection in the listbox ----- */ static void FlipSelection(DFWINDOW wnd, int sel) { - if (isMultiLine(wnd)) { - if (ItemSelected(wnd, sel)) + if (DfIsMultiLine(wnd)) { + if (DfItemSelected(wnd, sel)) ClearSelection(wnd, sel); else SetSelection(wnd, sel); @@ -399,7 +399,7 @@ static void FlipSelection(DFWINDOW wnd, int sel) static int ExtendSelections(DFWINDOW wnd, int sel, int shift) { - if (shift & (LEFTSHIFT | RIGHTSHIFT) && + if (shift & (DF_LEFTSHIFT | DF_RIGHTSHIFT) && wnd->AnchorPoint != -1) { int i = sel; int j = wnd->AnchorPoint; @@ -416,27 +416,27 @@ static int ExtendSelections(DFWINDOW wnd, int sel, int shift) static void SetSelection(DFWINDOW wnd, int sel) { - if (isMultiLine(wnd) && !ItemSelected(wnd, sel)) { - char *lp = TextLine(wnd, sel); - *lp = LISTSELECTOR; + if (DfIsMultiLine(wnd) && !DfItemSelected(wnd, sel)) { + char *lp = DfTextLine(wnd, sel); + *lp = DF_LISTSELECTOR; wnd->SelectCount++; } } static void ClearSelection(DFWINDOW wnd, int sel) { - if (isMultiLine(wnd) && ItemSelected(wnd, sel)) { - char *lp = TextLine(wnd, sel); + if (DfIsMultiLine(wnd) && DfItemSelected(wnd, sel)) { + char *lp = DfTextLine(wnd, sel); *lp = ' '; --wnd->SelectCount; } } -BOOL ItemSelected(DFWINDOW wnd, int sel) +BOOL DfItemSelected(DFWINDOW wnd, int sel) { - if (sel != -1 && isMultiLine(wnd) && sel < wnd->wlines) { - char *cp = TextLine(wnd, sel); - return (int)((*cp) & 255) == LISTSELECTOR; + if (sel != -1 && DfIsMultiLine(wnd) && sel < wnd->wlines) { + char *cp = DfTextLine(wnd, sel); + return (int)((*cp) & 255) == DF_LISTSELECTOR; } return FALSE; } @@ -446,13 +446,13 @@ static void ChangeSelection(DFWINDOW wnd,int sel,int shift) { if (sel != wnd->selection) { #ifdef INCLUDE_EXTENDEDSELECTIONS - if (isMultiLine(wnd)) { + if (DfIsMultiLine(wnd)) { int sels; if (!wnd->AddMode) ClearAllSelections(wnd); sels = ExtendSelections(wnd, sel, shift); if (sels > 1) - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); if (sels == 0 && !wnd->AddMode) { ClearSelection(wnd, wnd->selection); SetSelection(wnd, sel); diff --git a/rosapps/dflat32/lists.c b/rosapps/dflat32/lists.c index c67987a03ca..4625c7c1b99 100644 --- a/rosapps/dflat32/lists.c +++ b/rosapps/dflat32/lists.c @@ -3,125 +3,125 @@ #include "dflat.h" /* ----- set focus to the next sibling ----- */ -void SetNextFocus (void) +void DfSetNextFocus (void) { - if (inFocus != NULL) + if (DfInFocus != NULL) { - DFWINDOW wnd1 = inFocus, pwnd; + DFWINDOW wnd1 = DfInFocus, pwnd; while (TRUE) { - pwnd = GetParent(wnd1); - if (NextWindow(wnd1) != NULL) - wnd1 = NextWindow(wnd1); + pwnd = DfGetParent(wnd1); + if (DfNextWindow(wnd1) != NULL) + wnd1 = DfNextWindow(wnd1); else if (pwnd != NULL) - wnd1 = FirstWindow(pwnd); - if (wnd1 == NULL || wnd1 == inFocus) + wnd1 = DfFirstWindow(pwnd); + if (wnd1 == NULL || wnd1 == DfInFocus) { wnd1 = pwnd; break; } - if (GetClass(wnd1) == STATUSBAR || GetClass(wnd1) == MENUBAR) + if (DfGetClass(wnd1) == DF_STATUSBAR || DfGetClass(wnd1) == DF_MENUBAR) continue; - if (isVisible(wnd1)) + if (DfIsVisible(wnd1)) break; } if (wnd1 != NULL) { while (wnd1->childfocus != NULL) wnd1 = wnd1->childfocus; - if (wnd1->condition != ISCLOSING) - DfSendMessage(wnd1, SETFOCUS, TRUE, 0); + if (wnd1->condition != DF_ISCLOSING) + DfSendMessage(wnd1, DFM_SETFOCUS, TRUE, 0); } } } /* ----- set focus to the previous sibling ----- */ -void SetPrevFocus(void) +void DfSetPrevFocus(void) { - if (inFocus != NULL) + if (DfInFocus != NULL) { - DFWINDOW wnd1 = inFocus, pwnd; + DFWINDOW wnd1 = DfInFocus, pwnd; while (TRUE) { - pwnd = GetParent(wnd1); - if (PrevWindow(wnd1) != NULL) - wnd1 = PrevWindow(wnd1); + pwnd = DfGetParent(wnd1); + if (DfPrevWindow(wnd1) != NULL) + wnd1 = DfPrevWindow(wnd1); else if (pwnd != NULL) - wnd1 = LastWindow(pwnd); - if (wnd1 == NULL || wnd1 == inFocus) + wnd1 = DfLastWindow(pwnd); + if (wnd1 == NULL || wnd1 == DfInFocus) { wnd1 = pwnd; break; } - if (GetClass(wnd1) == STATUSBAR) + if (DfGetClass(wnd1) == DF_STATUSBAR) continue; - if (isVisible(wnd1)) + if (DfIsVisible(wnd1)) break; } if (wnd1 != NULL) { while (wnd1->childfocus != NULL) wnd1 = wnd1->childfocus; - if (wnd1->condition != ISCLOSING) - DfSendMessage(wnd1, SETFOCUS, TRUE, 0); + if (wnd1->condition != DF_ISCLOSING) + DfSendMessage(wnd1, DFM_SETFOCUS, TRUE, 0); } } } /* ------- move a window to the end of its parents list ----- */ -void ReFocus(DFWINDOW wnd) +void DfReFocus(DFWINDOW wnd) { - if (GetParent(wnd) != NULL) + if (DfGetParent(wnd) != NULL) { - RemoveWindow(wnd); - AppendWindow(wnd); - ReFocus(GetParent(wnd)); + DfRemoveWindow(wnd); + DfAppendWindow(wnd); + DfReFocus(DfGetParent(wnd)); } } /* ---- remove a window from the linked list ---- */ -void RemoveWindow(DFWINDOW wnd) +void DfRemoveWindow(DFWINDOW wnd) { if (wnd != NULL) { - DFWINDOW pwnd = GetParent(wnd); + DFWINDOW pwnd = DfGetParent(wnd); - if (PrevWindow(wnd) != NULL) - NextWindow(PrevWindow(wnd)) = NextWindow(wnd); - if (NextWindow(wnd) != NULL) - PrevWindow(NextWindow(wnd)) = PrevWindow(wnd); + if (DfPrevWindow(wnd) != NULL) + DfNextWindow(DfPrevWindow(wnd)) = DfNextWindow(wnd); + if (DfNextWindow(wnd) != NULL) + DfPrevWindow(DfNextWindow(wnd)) = DfPrevWindow(wnd); if (pwnd != NULL) { - if (wnd == FirstWindow(pwnd)) - FirstWindow(pwnd) = NextWindow(wnd); - if (wnd == LastWindow(pwnd)) - LastWindow(pwnd) = PrevWindow(wnd); + if (wnd == DfFirstWindow(pwnd)) + DfFirstWindow(pwnd) = DfNextWindow(wnd); + if (wnd == DfLastWindow(pwnd)) + DfLastWindow(pwnd) = DfPrevWindow(wnd); } } } /* ---- append a window to the linked list ---- */ -void AppendWindow(DFWINDOW wnd) +void DfAppendWindow(DFWINDOW wnd) { if (wnd != NULL) { - DFWINDOW pwnd = GetParent(wnd); + DFWINDOW pwnd = DfGetParent(wnd); if (pwnd != NULL) { - if (FirstWindow(pwnd) == NULL) + if (DfFirstWindow(pwnd) == NULL) { - FirstWindow(pwnd) = wnd; - LastWindow(pwnd) = wnd; - PrevWindow(wnd) = NULL; + DfFirstWindow(pwnd) = wnd; + DfLastWindow(pwnd) = wnd; + DfPrevWindow(wnd) = NULL; } else { - NextWindow(LastWindow(pwnd)) = wnd; - PrevWindow(wnd) = LastWindow(pwnd); - LastWindow(pwnd) = wnd; + DfNextWindow(DfLastWindow(pwnd)) = wnd; + DfPrevWindow(wnd) = DfLastWindow(pwnd); + DfLastWindow(pwnd) = wnd; } } - NextWindow(wnd) = NULL; + DfNextWindow(wnd) = NULL; } } @@ -129,17 +129,17 @@ void AppendWindow(DFWINDOW wnd) * if document windows and statusbar or menubar get the focus, * pass it on */ -void SkipApplicationControls(void) +void DfSkipApplicationControls(void) { BOOL EmptyAppl = FALSE; int ct = 0; - while (!EmptyAppl && inFocus != NULL) + while (!EmptyAppl && DfInFocus != NULL) { - DFCLASS cl = GetClass(inFocus); - if (cl == MENUBAR || cl == STATUSBAR) + DFCLASS cl = DfGetClass(DfInFocus); + if (cl == DF_MENUBAR || cl == DF_STATUSBAR) { - SetPrevFocus(); - EmptyAppl = (cl == MENUBAR && ct++); + DfSetPrevFocus(); + EmptyAppl = (cl == DF_MENUBAR && ct++); } else break; diff --git a/rosapps/dflat32/log.c b/rosapps/dflat32/log.c index 87f305374cc..eff14f37026 100644 --- a/rosapps/dflat32/log.c +++ b/rosapps/dflat32/log.c @@ -12,60 +12,60 @@ static char *message[] = { }; static FILE *logfile = NULL; -extern DBOX Log; +extern DF_DBOX Log; -void LogMessages (DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +void DfLogMessages (DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { if (logfile != NULL && message[msg][0] != ' ') fprintf(logfile, "%-20.20s %-12.12s %-20.20s, %5.5ld, %5.5ld\n", - wnd ? (GetTitle(wnd) ? GetTitle(wnd) : "") : "", - wnd ? ClassNames[GetClass(wnd)] : "", + wnd ? (DfGetTitle(wnd) ? DfGetTitle(wnd) : "") : "", + wnd ? DfClassNames[DfGetClass(wnd)] : "", message[msg]+1, p1, p2); } -static int LogProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +static int LogProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { - DFWINDOW cwnd = ControlWindow(&Log, ID_LOGLIST); + DFWINDOW cwnd = DfControlWindow(&Log, DF_ID_LOGLIST); char **mn = message; switch (msg) { - case INITIATE_DIALOG: - AddAttribute(cwnd, MULTILINE | VSCROLLBAR); + case DFM_INITIATE_DIALOG: + DfAddAttribute(cwnd, DF_MULTILINE | DF_VSCROLLBAR); while (*mn) { - DfSendMessage(cwnd, ADDTEXT, (PARAM) (*mn), 0); + DfSendMessage(cwnd, DFM_ADDTEXT, (DF_PARAM) (*mn), 0); mn++; } - DfSendMessage(cwnd, SHOW_WINDOW, 0, 0); + DfSendMessage(cwnd, DFM_SHOW_WINDOW, 0, 0); break; case DFM_COMMAND: - if ((int) p1 == ID_OK) { + if ((int) p1 == DF_ID_OK) { int item; - int tl = GetTextLines(cwnd); + int tl = DfGetTextLines(cwnd); for (item = 0; item < tl; item++) - if (ItemSelected(cwnd, item)) - mn[item][0] = LISTSELECTOR; + if (DfItemSelected(cwnd, item)) + mn[item][0] = DF_LISTSELECTOR; } break; default: break; } - return DefaultWndProc(wnd, msg, p1, p2); + return DfDefaultWndProc(wnd, msg, p1, p2); } -void MessageLog(DFWINDOW wnd) +void DfMessageLog(DFWINDOW wnd) { if (DfDialogBox(wnd, &Log, TRUE, LogProc)) { - if (CheckBoxSetting(&Log, ID_LOGGING)) + if (DfCheckBoxSetting(&Log, DF_ID_LOGGING)) { logfile = fopen("DFLAT.LOG", "wt"); - SetCommandToggle(&MainMenu, ID_LOG); + DfSetCommandToggle(&DfMainMenu, DF_ID_LOG); } else if (logfile != NULL) { fclose(logfile); logfile = NULL; - ClearCommandToggle(&MainMenu, ID_LOG); + DfClearCommandToggle(&DfMainMenu, DF_ID_LOG); } } } diff --git a/rosapps/dflat32/memopad.c b/rosapps/dflat32/memopad.c index b94a924f604..8e3236ee289 100644 --- a/rosapps/dflat32/memopad.c +++ b/rosapps/dflat32/memopad.c @@ -2,14 +2,14 @@ #include "dflat.h" -extern DBOX PrintSetup; +extern DF_DBOX PrintSetup; char DFlatApplication[] = "MemoPad"; static char Untitled[] = "Untitled"; static int wndpos; -static int MemoPadProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); +static int MemoPadProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); static void NewFile(DFWINDOW); static void SelectFile(DFWINDOW); static void PadWindow(DFWINDOW, char *); @@ -18,9 +18,9 @@ static void LoadFile(DFWINDOW); static void PrintPad(DFWINDOW); static void SaveFile(DFWINDOW, int); static void MemoPadDeleteFile(DFWINDOW); -static int EditorProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); +static int EditorProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); static char *NameComponent(char *); -static int PrintSetupProc(DFWINDOW, DFMESSAGE, PARAM, PARAM); +static int PrintSetupProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM); static void FixTabMenu(void); #ifndef TURBOC void Calendar(DFWINDOW); @@ -37,24 +37,24 @@ void main(int argc, char *argv[]) if (!init_messages()) return; Argv = argv; - LoadConfig(); -// if (!LoadConfig()) -// cfg.ScreenLines = SCREENHEIGHT; - wnd = DfCreateWindow(APPLICATION, - "FreeDos Edit " VERSION, + DfLoadConfig(); +// if (!DfLoadConfig()) +// DfCfg.ScreenLines = DF_SCREENHEIGHT; + wnd = DfDfCreateWindow(DF_APPLICATION, + "FreeDos Edit " DF_VERSION, 0, 0, -1, -1, - &MainMenu, + &DfMainMenu, NULL, MemoPadProc, - MOVEABLE | - SIZEABLE | - HASBORDER | - MINMAXBOX | - HASSTATUSBAR + DF_MOVEABLE | + DF_SIZEABLE | + DF_HASBORDER | + DF_MINMAXBOX | + DF_HASSTATUSBAR ); - LoadHelpFile(); - DfSendMessage(wnd, SETFOCUS, TRUE, 0); + DfLoadHelpFile(); + DfSendMessage(wnd, DFM_SETFOCUS, TRUE, 0); while (argc > 1) { PadWindow(wnd, argv[1]); --argc; @@ -72,9 +72,9 @@ static void PadWindow(DFWINDOW wnd, char *FileName) char path[64]; char *cp; - CreatePath(path, FileName, FALSE, FALSE); + DfCreatePath(path, FileName, FALSE, FALSE); cp = path+strlen(path); - CreatePath(path, FileName, TRUE, FALSE); + DfCreatePath(path, FileName, TRUE, FALSE); ax = _findfirst(path, &ff); if (ax == -1) return; @@ -90,76 +90,76 @@ static void PadWindow(DFWINDOW wnd, char *FileName) /* ------- window processing module for the memopad application window ----- */ -static int MemoPadProc(DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2) +static int MemoPadProc(DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2) { int rtn; switch (msg) { - case CREATE_WINDOW: - rtn = DefaultWndProc(wnd, msg, p1, p2); - if (cfg.InsertMode) - SetCommandToggle(&MainMenu, ID_INSERT); - if (cfg.WordWrap) - SetCommandToggle(&MainMenu, ID_WRAP); + case DFM_CREATE_WINDOW: + rtn = DfDefaultWndProc(wnd, msg, p1, p2); + if (DfCfg.InsertMode) + DfSetCommandToggle(&DfMainMenu, DF_ID_INSERT); + if (DfCfg.WordWrap) + DfSetCommandToggle(&DfMainMenu, DF_ID_WRAP); FixTabMenu(); return rtn; case DFM_COMMAND: switch ((int)p1) { - case ID_NEW: + case DF_ID_NEW: NewFile(wnd); return TRUE; - case ID_OPEN: + case DF_ID_OPEN: SelectFile(wnd); return TRUE; - case ID_SAVE: - SaveFile(inFocus, FALSE); + case DF_ID_SAVE: + SaveFile(DfInFocus, FALSE); return TRUE; - case ID_SAVEAS: - SaveFile(inFocus, TRUE); + case DF_ID_SAVEAS: + SaveFile(DfInFocus, TRUE); return TRUE; - case ID_DELETEFILE: - MemoPadDeleteFile(inFocus); + case DF_ID_DELETEFILE: + MemoPadDeleteFile(DfInFocus); return TRUE; - case ID_PRINTSETUP: + case DF_ID_PRINTSETUP: DfDialogBox(wnd, &PrintSetup, TRUE, PrintSetupProc); return TRUE; - case ID_PRINT: - PrintPad(inFocus); + case DF_ID_PRINT: + PrintPad(DfInFocus); return TRUE; - case ID_EXIT: + case DF_ID_EXIT: if (!DfYesNoBox("Exit Memopad?")) return FALSE; break; - case ID_WRAP: - cfg.WordWrap = GetCommandToggle(&MainMenu, ID_WRAP); + case DF_ID_WRAP: + DfCfg.WordWrap = DfGetCommandToggle(&DfMainMenu, DF_ID_WRAP); return TRUE; - case ID_INSERT: - cfg.InsertMode = GetCommandToggle(&MainMenu, ID_INSERT); + case DF_ID_INSERT: + DfCfg.InsertMode = DfGetCommandToggle(&DfMainMenu, DF_ID_INSERT); return TRUE; - case ID_TAB2: - cfg.Tabs = 2; + case DF_ID_TAB2: + DfCfg.Tabs = 2; FixTabMenu(); return TRUE; - case ID_TAB4: - cfg.Tabs = 4; + case DF_ID_TAB4: + DfCfg.Tabs = 4; FixTabMenu(); return TRUE; - case ID_TAB6: - cfg.Tabs = 6; + case DF_ID_TAB6: + DfCfg.Tabs = 6; FixTabMenu(); return TRUE; - case ID_TAB8: - cfg.Tabs = 8; + case DF_ID_TAB8: + DfCfg.Tabs = 8; FixTabMenu(); return TRUE; - case ID_CALENDAR: + case DF_ID_CALENDAR: #ifndef TURBOC Calendar(wnd); #endif return TRUE; -// case ID_BARCHART: +// case DF_ID_BARCHART: // BarChart(wnd); // return TRUE; - case ID_ABOUT: + case DF_ID_ABOUT: DfMessageBox( "About D-Flat and the MemoPad", " ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\n" @@ -184,7 +184,7 @@ static int MemoPadProc(DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2) default: break; } - return DefaultWndProc(wnd, msg, p1, p2); + return DfDefaultWndProc(wnd, msg, p1, p2); } /* --- The New command. Open an empty editor window --- */ static void NewFile(DFWINDOW wnd) @@ -195,16 +195,16 @@ static void NewFile(DFWINDOW wnd) static void SelectFile(DFWINDOW wnd) { char FileName[64]; - if (OpenFileDialogBox("*.PAD", FileName)) { + if (DfOpenFileDialogBox("*.PAD", FileName)) { /* --- see if the document is already in a window --- */ - DFWINDOW wnd1 = FirstWindow(wnd); + DFWINDOW wnd1 = DfFirstWindow(wnd); while (wnd1 != NULL) { if (stricmp(FileName, wnd1->extension) == 0) { - DfSendMessage(wnd1, SETFOCUS, TRUE, 0); - DfSendMessage(wnd1, RESTORE, 0, 0); + DfSendMessage(wnd1, DFM_SETFOCUS, TRUE, 0); + DfSendMessage(wnd1, DFM_RESTORE, 0, 0); return; } - wnd1 = NextWindow(wnd1); + wnd1 = DfNextWindow(wnd1); } OpenPadWindow(wnd, FileName); } @@ -220,7 +220,7 @@ static void OpenPadWindow(DFWINDOW wnd, char *FileName) char *ermsg; if (strcmp(FileName, Untitled)) { if (stat(FileName, &sb)) { - ermsg = DFmalloc(strlen(FileName)+20); + ermsg = DfMalloc(strlen(FileName)+20); strcpy(ermsg, "No such file as\n"); strcat(ermsg, FileName); DfErrorMessage(ermsg); @@ -229,32 +229,32 @@ static void OpenPadWindow(DFWINDOW wnd, char *FileName) } Fname = NameComponent(FileName); } - wwnd = WatchIcon(); + wwnd = DfWatchIcon(); wndpos += 2; if (wndpos == 20) wndpos = 2; - wnd1 = DfCreateWindow(EDITBOX, + wnd1 = DfDfCreateWindow(DF_EDITBOX, Fname, (wndpos-1)*2, wndpos, 10, 40, NULL, wnd, EditorProc, - SHADOW | - MINMAXBOX | - CONTROLBOX | - VSCROLLBAR | - HSCROLLBAR | - MOVEABLE | - HASBORDER | - SIZEABLE | - MULTILINE + DF_SHADOW | + DF_MINMAXBOX | + DF_CONTROLBOX | + DF_VSCROLLBAR | + DF_HSCROLLBAR | + DF_MOVEABLE | + DF_HASBORDER | + DF_SIZEABLE | + DF_MULTILINE ); if (strcmp(FileName, Untitled)) { - wnd1->extension = DFmalloc(strlen(FileName)+1); + wnd1->extension = DfMalloc(strlen(FileName)+1); strcpy(wnd1->extension, FileName); LoadFile(wnd1); } - DfSendMessage(wwnd, CLOSE_WINDOW, 0, 0); - DfSendMessage(wnd1, SETFOCUS, TRUE, 0); - DfSendMessage(wnd1, MAXIMIZE, 0, 0); + DfSendMessage(wwnd, DFM_CLOSE_WINDOW, 0, 0); + DfSendMessage(wnd1, DFM_SETFOCUS, TRUE, 0); + DfSendMessage(wnd1, DFM_MAXIMIZE, 0, 0); } /* --- Load the notepad file into the editor text buffer --- */ @@ -266,15 +266,15 @@ static void LoadFile(DFWINDOW wnd) if ((fp = fopen(wnd->extension, "rt")) != NULL) { while (!feof(fp)) { - handshake(); - Buf = DFrealloc(Buf, recptr+150); + DfHandshake(); + Buf = DfRealloc(Buf, recptr+150); memset(Buf+recptr, 0, 150); fgets(Buf+recptr, 150, fp); recptr += strlen(Buf+recptr); } fclose(fp); if (Buf != NULL) { - DfSendMessage(wnd, SETTEXT, (PARAM) Buf, 0); + DfSendMessage(wnd, DFM_SETTEXT, (DF_PARAM) Buf, 0); free(Buf); } } @@ -287,21 +287,21 @@ static int CharCtr; static void PrintChar(FILE *prn, int c) { int i; - if (c == '\n' || CharCtr == cfg.RightMargin) { + if (c == '\n' || CharCtr == DfCfg.RightMargin) { fputs("\r\n", prn); LineCtr++; - if (LineCtr == cfg.BottomMargin) { + if (LineCtr == DfCfg.BottomMargin) { fputc('\f', prn); - for (i = 0; i < cfg.TopMargin; i++) + for (i = 0; i < DfCfg.TopMargin; i++) fputc('\n', prn); - LineCtr = cfg.TopMargin; + LineCtr = DfCfg.TopMargin; } CharCtr = 0; if (c == '\n') return; } if (CharCtr == 0) { - for (i = 0; i < cfg.LeftMargin; i++) { + for (i = 0; i < DfCfg.LeftMargin; i++) { fputc(' ', prn); CharCtr++; } @@ -313,14 +313,14 @@ static void PrintChar(FILE *prn, int c) /* --- print the current notepad --- */ static void PrintPad(DFWINDOW wnd) { - if (*cfg.PrinterPort) { + if (*DfCfg.PrinterPort) { FILE *prn; - if ((prn = fopen(cfg.PrinterPort, "wt")) != NULL) { + if ((prn = fopen(DfCfg.PrinterPort, "wt")) != NULL) { long percent; BOOL KeepPrinting = TRUE; - unsigned char *text = GetText(wnd); + unsigned char *text = DfGetText(wnd); unsigned oldpct = 100, cct = 0, len = strlen(text); - DFWINDOW swnd = SliderBox(20, GetTitle(wnd), "Printing"); + DFWINDOW swnd = DfSliderBox(20, DfGetTitle(wnd), "Printing"); /* ------- print the notepad text --------- */ LineCtr = CharCtr = 0; while (KeepPrinting && *text) { @@ -328,13 +328,13 @@ static void PrintPad(DFWINDOW wnd) percent = ((long) ++cct * 100) / len; if ((int)percent != (int)oldpct) { oldpct = (int) percent; - KeepPrinting = DfSendMessage(swnd, PAINT, 0, oldpct); + KeepPrinting = DfSendMessage(swnd, DFM_PAINT, 0, oldpct); } } if (KeepPrinting) /* ---- user did not cancel ---- */ if (oldpct < 100) - DfSendMessage(swnd, PAINT, 0, 100); + DfSendMessage(swnd, DFM_PAINT, 0, 100); /* ------- follow with a form feed? --------- */ if (DfYesNoBox("Form Feed?")) fputc('\f', prn); @@ -353,25 +353,25 @@ static void SaveFile(DFWINDOW wnd, int Saveas) FILE *fp; if (wnd->extension == NULL || Saveas) { char FileName[64]; - if (SaveAsDialogBox(FileName)) { + if (DfSaveAsDialogBox(FileName)) { if (wnd->extension != NULL) free(wnd->extension); - wnd->extension = DFmalloc(strlen(FileName)+1); + wnd->extension = DfMalloc(strlen(FileName)+1); strcpy(wnd->extension, FileName); - AddTitle(wnd, NameComponent(FileName)); - DfSendMessage(wnd, BORDER, 0, 0); + DfAddTitle(wnd, NameComponent(FileName)); + DfSendMessage(wnd, DFM_BORDER, 0, 0); } else return; } if (wnd->extension != NULL) { - DFWINDOW mwnd = MomentaryMessage("Saving the file"); + DFWINDOW mwnd = DfMomentaryMessage("Saving the file"); if ((fp = fopen(wnd->extension, "wt")) != NULL) { - fwrite(GetText(wnd), strlen(GetText(wnd)), 1, fp); + fwrite(DfGetText(wnd), strlen(DfGetText(wnd)), 1, fp); fclose(fp); wnd->TextChanged = FALSE; } - DfSendMessage(mwnd, CLOSE_WINDOW, 0, 0); + DfSendMessage(mwnd, DFM_CLOSE_WINDOW, 0, 0); } } /* -------- delete a file ------------ */ @@ -385,7 +385,7 @@ static void MemoPadDeleteFile(DFWINDOW wnd) sprintf(msg, "Delete %s?", fn); if (DfYesNoBox(msg)) { unlink(wnd->extension); - DfSendMessage(wnd, CLOSE_WINDOW, 0, 0); + DfSendMessage(wnd, DFM_CLOSE_WINDOW, 0, 0); } } } @@ -398,84 +398,84 @@ static void ShowPosition(DFWINDOW wnd) char status[30]; sprintf(status, "Line:%4d Column: %2d", wnd->CurrLine, wnd->CurrCol); - DfSendMessage(GetParent(wnd), ADDSTATUS, (PARAM) status, 0); + DfSendMessage(DfGetParent(wnd), DFM_ADDSTATUS, (DF_PARAM) status, 0); } /* ----- window processing module for the editboxes ----- */ -static int EditorProc(DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2) +static int EditorProc(DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2) { int rtn; switch (msg) { - case SETFOCUS: + case DFM_SETFOCUS: if ((int)p1) { - wnd->InsertMode = GetCommandToggle(&MainMenu, ID_INSERT); - wnd->WordWrapMode = GetCommandToggle(&MainMenu, ID_WRAP); + wnd->InsertMode = DfGetCommandToggle(&DfMainMenu, DF_ID_INSERT); + wnd->WordWrapMode = DfGetCommandToggle(&DfMainMenu, DF_ID_WRAP); } - rtn = DefaultWndProc(wnd, msg, p1, p2); + rtn = DfDefaultWndProc(wnd, msg, p1, p2); if ((int)p1 == FALSE) - DfSendMessage(GetParent(wnd), ADDSTATUS, 0, 0); + DfSendMessage(DfGetParent(wnd), DFM_ADDSTATUS, 0, 0); else ShowPosition(wnd); return rtn; - case KEYBOARD_CURSOR: - rtn = DefaultWndProc(wnd, msg, p1, p2); + case DFM_KEYBOARD_CURSOR: + rtn = DfDefaultWndProc(wnd, msg, p1, p2); ShowPosition(wnd); return rtn; case DFM_COMMAND: switch ((int) p1) { - case ID_SEARCH: + case DF_ID_SEARCH: SearchText(wnd); return TRUE; - case ID_REPLACE: + case DF_ID_REPLACE: ReplaceText(wnd); return TRUE; - case ID_SEARCHNEXT: + case DF_ID_SEARCHNEXT: SearchNext(wnd); return TRUE; - case ID_CUT: - CopyToClipboard(wnd); - DfSendMessage(wnd, DFM_COMMAND, ID_DELETETEXT, 0); - DfSendMessage(wnd, PAINT, 0, 0); + case DF_ID_CUT: + DfCopyToClipboard(wnd); + DfSendMessage(wnd, DFM_COMMAND, DF_ID_DELETETEXT, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); return TRUE; - case ID_COPY: - CopyToClipboard(wnd); - ClearTextBlock(wnd); - DfSendMessage(wnd, PAINT, 0, 0); + case DF_ID_COPY: + DfCopyToClipboard(wnd); + DfClearTextBlock(wnd); + DfSendMessage(wnd, DFM_PAINT, 0, 0); return TRUE; - case ID_PASTE: - PasteFromClipboard(wnd); - DfSendMessage(wnd, PAINT, 0, 0); + case DF_ID_PASTE: + DfPasteFromClipboard(wnd); + DfSendMessage(wnd, DFM_PAINT, 0, 0); return TRUE; - case ID_DELETETEXT: - case ID_CLEAR: - rtn = DefaultWndProc(wnd, msg, p1, p2); - DfSendMessage(wnd, PAINT, 0, 0); + case DF_ID_DELETETEXT: + case DF_ID_CLEAR: + rtn = DfDefaultWndProc(wnd, msg, p1, p2); + DfSendMessage(wnd, DFM_PAINT, 0, 0); return rtn; - case ID_HELP: - DisplayHelp(wnd, "MEMOPADDOC"); + case DF_ID_HELP: + DfDisplayHelp(wnd, "MEMOPADDOC"); return TRUE; - case ID_WRAP: - DfSendMessage(GetParent(wnd), DFM_COMMAND, ID_WRAP, 0); - wnd->WordWrapMode = cfg.WordWrap; + case DF_ID_WRAP: + DfSendMessage(DfGetParent(wnd), DFM_COMMAND, DF_ID_WRAP, 0); + wnd->WordWrapMode = DfCfg.WordWrap; return TRUE; - case ID_INSERT: - DfSendMessage(GetParent(wnd), DFM_COMMAND, ID_INSERT, 0); - wnd->InsertMode = cfg.InsertMode; - DfSendMessage(NULL, SHOW_CURSOR, wnd->InsertMode, 0); + case DF_ID_INSERT: + DfSendMessage(DfGetParent(wnd), DFM_COMMAND, DF_ID_INSERT, 0); + wnd->InsertMode = DfCfg.InsertMode; + DfSendMessage(NULL, DFM_SHOW_CURSOR, wnd->InsertMode, 0); return TRUE; default: break; } break; - case CLOSE_WINDOW: + case DFM_CLOSE_WINDOW: if (wnd->TextChanged) { - char *cp = DFmalloc(25+strlen(GetTitle(wnd))); - DfSendMessage(wnd, SETFOCUS, TRUE, 0); - strcpy(cp, GetTitle(wnd)); + char *cp = DfMalloc(25+strlen(DfGetTitle(wnd))); + DfSendMessage(wnd, DFM_SETFOCUS, TRUE, 0); + strcpy(cp, DfGetTitle(wnd)); strcat(cp, "\nText changed. Save it?"); if (DfYesNoBox(cp)) - DfSendMessage(GetParent(wnd), - DFM_COMMAND, ID_SAVE, 0); + DfSendMessage(DfGetParent(wnd), + DFM_COMMAND, DF_ID_SAVE, 0); free(cp); } wndpos = 0; @@ -487,7 +487,7 @@ static int EditorProc(DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2) default: break; } - return DefaultWndProc(wnd, msg, p1, p2); + return DfDefaultWndProc(wnd, msg, p1, p2); } /* -- point to the name component of a file specification -- */ static char *NameComponent(char *FileName) @@ -505,132 +505,132 @@ static char *ports[] = { NULL }; -static int PrintSetupProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +static int PrintSetupProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { int rtn, i = 0, mar; char marg[10]; DFWINDOW cwnd; switch (msg) { - case CREATE_WINDOW: - rtn = DefaultWndProc(wnd, msg, p1, p2); - PutItemText(wnd, ID_PRINTERPORT, cfg.PrinterPort); + case DFM_CREATE_WINDOW: + rtn = DfDefaultWndProc(wnd, msg, p1, p2); + DfPutItemText(wnd, DF_ID_PRINTERPORT, DfCfg.PrinterPort); while (ports[i] != NULL) - PutComboListText(wnd, ID_PRINTERPORT, ports[i++]); + DfPutComboListText(wnd, DF_ID_PRINTERPORT, ports[i++]); for (mar = CHARSLINE; mar >= 0; --mar) { sprintf(marg, "%3d", mar); - PutItemText(wnd, ID_LEFTMARGIN, marg); - PutItemText(wnd, ID_RIGHTMARGIN, marg); + DfPutItemText(wnd, DF_ID_LEFTMARGIN, marg); + DfPutItemText(wnd, DF_ID_RIGHTMARGIN, marg); } for (mar = LINESPAGE; mar >= 0; --mar) { sprintf(marg, "%3d", mar); - PutItemText(wnd, ID_TOPMARGIN, marg); - PutItemText(wnd, ID_BOTTOMMARGIN, marg); + DfPutItemText(wnd, DF_ID_TOPMARGIN, marg); + DfPutItemText(wnd, DF_ID_BOTTOMMARGIN, marg); } - cwnd = ControlWindow(&PrintSetup, ID_LEFTMARGIN); - DfSendMessage(cwnd, LB_SETSELECTION, - CHARSLINE-cfg.LeftMargin, 0); - cwnd = ControlWindow(&PrintSetup, ID_RIGHTMARGIN); - DfSendMessage(cwnd, LB_SETSELECTION, - CHARSLINE-cfg.RightMargin, 0); - cwnd = ControlWindow(&PrintSetup, ID_TOPMARGIN); - DfSendMessage(cwnd, LB_SETSELECTION, - LINESPAGE-cfg.TopMargin, 0); - cwnd = ControlWindow(&PrintSetup, ID_BOTTOMMARGIN); - DfSendMessage(cwnd, LB_SETSELECTION, - LINESPAGE-cfg.BottomMargin, 0); + cwnd = DfControlWindow(&PrintSetup, DF_ID_LEFTMARGIN); + DfSendMessage(cwnd, DFM_LB_SETSELECTION, + CHARSLINE-DfCfg.LeftMargin, 0); + cwnd = DfControlWindow(&PrintSetup, DF_ID_RIGHTMARGIN); + DfSendMessage(cwnd, DFM_LB_SETSELECTION, + CHARSLINE-DfCfg.RightMargin, 0); + cwnd = DfControlWindow(&PrintSetup, DF_ID_TOPMARGIN); + DfSendMessage(cwnd, DFM_LB_SETSELECTION, + LINESPAGE-DfCfg.TopMargin, 0); + cwnd = DfControlWindow(&PrintSetup, DF_ID_BOTTOMMARGIN); + DfSendMessage(cwnd, DFM_LB_SETSELECTION, + LINESPAGE-DfCfg.BottomMargin, 0); return rtn; case DFM_COMMAND: - if ((int) p1 == ID_OK && (int) p2 == 0) { - GetItemText(wnd, ID_PRINTERPORT, cfg.PrinterPort, 4); - cwnd = ControlWindow(&PrintSetup, ID_LEFTMARGIN); - cfg.LeftMargin = CHARSLINE - - DfSendMessage(cwnd, LB_CURRENTSELECTION, 0, 0); - cwnd = ControlWindow(&PrintSetup, ID_RIGHTMARGIN); - cfg.RightMargin = CHARSLINE - - DfSendMessage(cwnd, LB_CURRENTSELECTION, 0, 0); - cwnd = ControlWindow(&PrintSetup, ID_TOPMARGIN); - cfg.TopMargin = LINESPAGE - - DfSendMessage(cwnd, LB_CURRENTSELECTION, 0, 0); - cwnd = ControlWindow(&PrintSetup, ID_BOTTOMMARGIN); - cfg.BottomMargin = LINESPAGE - - DfSendMessage(cwnd, LB_CURRENTSELECTION, 0, 0); + if ((int) p1 == DF_ID_OK && (int) p2 == 0) { + DfGetItemText(wnd, DF_ID_PRINTERPORT, DfCfg.PrinterPort, 4); + cwnd = DfControlWindow(&PrintSetup, DF_ID_LEFTMARGIN); + DfCfg.LeftMargin = CHARSLINE - + DfSendMessage(cwnd, DFM_LB_CURRENTSELECTION, 0, 0); + cwnd = DfControlWindow(&PrintSetup, DF_ID_RIGHTMARGIN); + DfCfg.RightMargin = CHARSLINE - + DfSendMessage(cwnd, DFM_LB_CURRENTSELECTION, 0, 0); + cwnd = DfControlWindow(&PrintSetup, DF_ID_TOPMARGIN); + DfCfg.TopMargin = LINESPAGE - + DfSendMessage(cwnd, DFM_LB_CURRENTSELECTION, 0, 0); + cwnd = DfControlWindow(&PrintSetup, DF_ID_BOTTOMMARGIN); + DfCfg.BottomMargin = LINESPAGE - + DfSendMessage(cwnd, DFM_LB_CURRENTSELECTION, 0, 0); } break; default: break; } - return DefaultWndProc(wnd, msg, p1, p2); + return DfDefaultWndProc(wnd, msg, p1, p2); } static void FixTabMenu(void) { - char *cp = GetCommandText(&MainMenu, ID_TABS); + char *cp = DfGetCommandText(&DfMainMenu, DF_ID_TABS); if (cp != NULL) { cp = strchr(cp, '('); if (cp != NULL) { - *(cp+1) = cfg.Tabs + '0'; - if (GetClass(inFocus) == POPDOWNMENU) - DfSendMessage(inFocus, PAINT, 0, 0); + *(cp+1) = DfCfg.Tabs + '0'; + if (DfGetClass(DfInFocus) == DF_POPDOWNMENU) + DfSendMessage(DfInFocus, DFM_PAINT, 0, 0); } } } -void PrepFileMenu(void *w, struct Menu *mnu) +void DfPrepFileMenu(void *w, struct DfMenu *mnu) { DFWINDOW wnd = w; - DeactivateCommand(&MainMenu, ID_SAVE); - DeactivateCommand(&MainMenu, ID_SAVEAS); - DeactivateCommand(&MainMenu, ID_DELETEFILE); - DeactivateCommand(&MainMenu, ID_PRINT); - if (wnd != NULL && GetClass(wnd) == EDITBOX) { - if (isMultiLine(wnd)) { - ActivateCommand(&MainMenu, ID_SAVE); - ActivateCommand(&MainMenu, ID_SAVEAS); - ActivateCommand(&MainMenu, ID_DELETEFILE); - ActivateCommand(&MainMenu, ID_PRINT); + DfDeactivateCommand(&DfMainMenu, DF_ID_SAVE); + DfDeactivateCommand(&DfMainMenu, DF_ID_SAVEAS); + DfDeactivateCommand(&DfMainMenu, DF_ID_DELETEFILE); + DfDeactivateCommand(&DfMainMenu, DF_ID_PRINT); + if (wnd != NULL && DfGetClass(wnd) == DF_EDITBOX) { + if (DfIsMultiLine(wnd)) { + DfActivateCommand(&DfMainMenu, DF_ID_SAVE); + DfActivateCommand(&DfMainMenu, DF_ID_SAVEAS); + DfActivateCommand(&DfMainMenu, DF_ID_DELETEFILE); + DfActivateCommand(&DfMainMenu, DF_ID_PRINT); } } } -void PrepSearchMenu(void *w, struct Menu *mnu) +void DfPrepSearchMenu(void *w, struct DfMenu *mnu) { DFWINDOW wnd = w; - DeactivateCommand(&MainMenu, ID_SEARCH); - DeactivateCommand(&MainMenu, ID_REPLACE); - DeactivateCommand(&MainMenu, ID_SEARCHNEXT); - if (wnd != NULL && GetClass(wnd) == EDITBOX) { - if (isMultiLine(wnd)) { - ActivateCommand(&MainMenu, ID_SEARCH); - ActivateCommand(&MainMenu, ID_REPLACE); - ActivateCommand(&MainMenu, ID_SEARCHNEXT); + DfDeactivateCommand(&DfMainMenu, DF_ID_SEARCH); + DfDeactivateCommand(&DfMainMenu, DF_ID_REPLACE); + DfDeactivateCommand(&DfMainMenu, DF_ID_SEARCHNEXT); + if (wnd != NULL && DfGetClass(wnd) == DF_EDITBOX) { + if (DfIsMultiLine(wnd)) { + DfActivateCommand(&DfMainMenu, DF_ID_SEARCH); + DfActivateCommand(&DfMainMenu, DF_ID_REPLACE); + DfActivateCommand(&DfMainMenu, DF_ID_SEARCHNEXT); } } } -void PrepEditMenu(void *w, struct Menu *mnu) +void DfPrepEditMenu(void *w, struct DfMenu *mnu) { DFWINDOW wnd = w; - DeactivateCommand(&MainMenu, ID_CUT); - DeactivateCommand(&MainMenu, ID_COPY); - DeactivateCommand(&MainMenu, ID_CLEAR); - DeactivateCommand(&MainMenu, ID_DELETETEXT); - DeactivateCommand(&MainMenu, ID_PARAGRAPH); - DeactivateCommand(&MainMenu, ID_PASTE); - DeactivateCommand(&MainMenu, ID_UNDO); - if (wnd != NULL && GetClass(wnd) == EDITBOX) { - if (isMultiLine(wnd)) { - if (TextBlockMarked(wnd)) { - ActivateCommand(&MainMenu, ID_CUT); - ActivateCommand(&MainMenu, ID_COPY); - ActivateCommand(&MainMenu, ID_CLEAR); - ActivateCommand(&MainMenu, ID_DELETETEXT); + DfDeactivateCommand(&DfMainMenu, DF_ID_CUT); + DfDeactivateCommand(&DfMainMenu, DF_ID_COPY); + DfDeactivateCommand(&DfMainMenu, DF_ID_CLEAR); + DfDeactivateCommand(&DfMainMenu, DF_ID_DELETETEXT); + DfDeactivateCommand(&DfMainMenu, DF_ID_PARAGRAPH); + DfDeactivateCommand(&DfMainMenu, DF_ID_PASTE); + DfDeactivateCommand(&DfMainMenu, DF_ID_UNDO); + if (wnd != NULL && DfGetClass(wnd) == DF_EDITBOX) { + if (DfIsMultiLine(wnd)) { + if (DfTextBlockMarked(wnd)) { + DfActivateCommand(&DfMainMenu, DF_ID_CUT); + DfActivateCommand(&DfMainMenu, DF_ID_COPY); + DfActivateCommand(&DfMainMenu, DF_ID_CLEAR); + DfActivateCommand(&DfMainMenu, DF_ID_DELETETEXT); } - ActivateCommand(&MainMenu, ID_PARAGRAPH); - if (!TestAttribute(wnd, READONLY) && - Clipboard != NULL) - ActivateCommand(&MainMenu, ID_PASTE); + DfActivateCommand(&DfMainMenu, DF_ID_PARAGRAPH); + if (!DfTestAttribute(wnd, DF_READONLY) && + DfClipboard != NULL) + DfActivateCommand(&DfMainMenu, DF_ID_PASTE); if (wnd->DeletedText != NULL) - ActivateCommand(&MainMenu, ID_UNDO); + DfActivateCommand(&DfMainMenu, DF_ID_UNDO); } } } diff --git a/rosapps/dflat32/menu.c b/rosapps/dflat32/menu.c index 5c9ef115dc6..d696b43becb 100644 --- a/rosapps/dflat32/menu.c +++ b/rosapps/dflat32/menu.c @@ -2,11 +2,11 @@ #include "dflat.h" -static struct PopDown *FindCmd(MBAR *mn, int cmd) +static struct DfPopDown *FindCmd(DF_MBAR *mn, int cmd) { - MENU *mnu = mn->PullDown; + DF_MENU *mnu = mn->PullDown; while (mnu->Title != (void *)-1) { - struct PopDown *pd = mnu->Selections; + struct DfPopDown *pd = mnu->Selections; while (pd->SelectionTitle != NULL) { if (pd->ActionId == cmd) return pd; @@ -17,69 +17,69 @@ static struct PopDown *FindCmd(MBAR *mn, int cmd) return NULL; } -char *GetCommandText(MBAR *mn, int cmd) +char *DfGetCommandText(DF_MBAR *mn, int cmd) { - struct PopDown *pd = FindCmd(mn, cmd); + struct DfPopDown *pd = FindCmd(mn, cmd); if (pd != NULL) return pd->SelectionTitle; return NULL; } -BOOL isCascadedCommand(MBAR *mn, int cmd) +BOOL DfIsCascadedCommand(DF_MBAR *mn, int cmd) { - struct PopDown *pd = FindCmd(mn, cmd); + struct DfPopDown *pd = FindCmd(mn, cmd); if (pd != NULL) - return pd->Attrib & CASCADED; + return pd->Attrib & DF_CASCADED; return FALSE; } -void ActivateCommand(MBAR *mn, int cmd) +void DfActivateCommand(DF_MBAR *mn, int cmd) { - struct PopDown *pd = FindCmd(mn, cmd); + struct DfPopDown *pd = FindCmd(mn, cmd); if (pd != NULL) - pd->Attrib &= ~INACTIVE; + pd->Attrib &= ~DF_INACTIVE; } -void DeactivateCommand(MBAR *mn, int cmd) +void DfDeactivateCommand(DF_MBAR *mn, int cmd) { - struct PopDown *pd = FindCmd(mn, cmd); + struct DfPopDown *pd = FindCmd(mn, cmd); if (pd != NULL) - pd->Attrib |= INACTIVE; + pd->Attrib |= DF_INACTIVE; } -BOOL isActive(MBAR *mn, int cmd) +BOOL isActive(DF_MBAR *mn, int cmd) { - struct PopDown *pd = FindCmd(mn, cmd); + struct DfPopDown *pd = FindCmd(mn, cmd); if (pd != NULL) - return !(pd->Attrib & INACTIVE); + return !(pd->Attrib & DF_INACTIVE); return FALSE; } -BOOL GetCommandToggle(MBAR *mn, int cmd) +BOOL DfGetCommandToggle(DF_MBAR *mn, int cmd) { - struct PopDown *pd = FindCmd(mn, cmd); + struct DfPopDown *pd = FindCmd(mn, cmd); if (pd != NULL) - return (pd->Attrib & CHECKED) != 0; + return (pd->Attrib & DF_CHECKED) != 0; return FALSE; } -void SetCommandToggle(MBAR *mn, int cmd) +void DfSetCommandToggle(DF_MBAR *mn, int cmd) { - struct PopDown *pd = FindCmd(mn, cmd); + struct DfPopDown *pd = FindCmd(mn, cmd); if (pd != NULL) - pd->Attrib |= CHECKED; + pd->Attrib |= DF_CHECKED; } -void ClearCommandToggle(MBAR *mn, int cmd) +void DfClearCommandToggle(DF_MBAR *mn, int cmd) { - struct PopDown *pd = FindCmd(mn, cmd); + struct DfPopDown *pd = FindCmd(mn, cmd); if (pd != NULL) - pd->Attrib &= ~CHECKED; + pd->Attrib &= ~DF_CHECKED; } -void InvertCommandToggle(MBAR *mn, int cmd) +void DfInvertCommandToggle(DF_MBAR *mn, int cmd) { - struct PopDown *pd = FindCmd(mn, cmd); + struct DfPopDown *pd = FindCmd(mn, cmd); if (pd != NULL) - pd->Attrib ^= CHECKED; + pd->Attrib ^= DF_CHECKED; } diff --git a/rosapps/dflat32/menu.h b/rosapps/dflat32/menu.h index 28c509ac02c..d19f1f42413 100644 --- a/rosapps/dflat32/menu.h +++ b/rosapps/dflat32/menu.h @@ -3,61 +3,61 @@ #ifndef MENU_H #define MENU_H -#define MAXPULLDOWNS 15 -#define MAXSELECTIONS 20 -#define MAXCASCADES 3 /* nesting level of cascaded menus */ +#define DF_MAXPULLDOWNS 15 +#define DF_MAXSELECTIONS 20 +#define DF_MAXCASCADES 3 /* nesting level of cascaded menus */ /* ----------- popdown menu selection structure one for each selection on a popdown menu --------- */ -struct PopDown { +struct DfPopDown { unsigned char *SelectionTitle; /* title of the selection */ int ActionId; /* the command executed */ int Accelerator; /* the accelerator key */ - int Attrib; /* INACTIVE | CHECKED | TOGGLE | CASCADED*/ + int Attrib; /* DF_INACTIVE | DF_CHECKED | DF_TOGGLE | DF_CASCADED*/ char *help; /* Help mnemonic */ }; /* ----------- popdown menu structure one for each popdown menu on the menu bar -------- */ -typedef struct Menu { +typedef struct DfMenu { char *Title; /* title on the menu bar */ - void (*PrepMenu)(void *, struct Menu *); /* function */ + void (*PrepMenu)(void *, struct DfMenu *); /* function */ char *StatusText; /* text for the status bar */ int CascadeId; /* command id of cascading selection */ int Selection; /* most recent selection */ - struct PopDown Selections[MAXSELECTIONS+1]; -} MENU; + struct DfPopDown Selections[DF_MAXSELECTIONS+1]; +} DF_MENU; /* ----- one for each menu bar ----- */ -typedef struct MenuBar { +typedef struct DfMenuBar { int ActiveSelection; - MENU PullDown[MAXPULLDOWNS+1]; -} MBAR; + DF_MENU PullDown[DF_MAXPULLDOWNS+1]; +} DF_MBAR; /* --------- macros to define a menu bar with popdowns and selections ------------- */ -#define SEPCHAR "\xc4" -#define DEFMENU(m) MBAR m = {-1,{ -#define POPDOWN(ttl,func,stat) {ttl,func,stat,-1,0,{ -#define CASCADED_POPDOWN(id,func) {NULL,func,NULL,id,0,{ -#define SELECTION(stxt,acc,id,attr) {stxt,acc,id,attr,#acc}, -#define SEPARATOR {SEPCHAR}, -#define ENDPOPDOWN {NULL}}}, -#define ENDMENU {(void *)-1} }}; +#define DF_SEPCHAR "\xc4" +#define DF_DEFMENU(m) DF_MBAR m = {-1,{ +#define DF_POPDOWN(ttl,func,stat) {ttl,func,stat,-1,0,{ +#define DF_CASCADED_POPDOWN(id,func) {NULL,func,NULL,id,0,{ +#define DF_SELECTION(stxt,acc,id,attr) {stxt,acc,id,attr,#acc}, +#define DF_SEPARATOR {DF_SEPCHAR}, +#define DF_ENDPOPDOWN {NULL}}}, +#define DF_ENDMENU {(void *)-1} }}; /* -------- menu selection attributes -------- */ -#define INACTIVE 1 -#define CHECKED 2 -#define TOGGLE 4 -#define CASCADED 8 +#define DF_INACTIVE 1 +#define DF_CHECKED 2 +#define DF_TOGGLE 4 +#define DF_CASCADED 8 /* --------- the standard menus ---------- */ -extern MBAR MainMenu; -extern MBAR SystemMenu; -extern MBAR *ActiveMenuBar; +extern DF_MBAR DfMainMenu; +extern DF_MBAR DfSystemMenu; +extern DF_MBAR *DfActiveMenuBar; -int MenuHeight(struct PopDown *); -int MenuWidth(struct PopDown *); +int DfMenuHeight(struct DfPopDown *); +int DfMenuWidth(struct DfPopDown *); #endif diff --git a/rosapps/dflat32/menubar.c b/rosapps/dflat32/menubar.c index a67b1f367ff..841b541c780 100644 --- a/rosapps/dflat32/menubar.c +++ b/rosapps/dflat32/menubar.c @@ -10,115 +10,115 @@ static struct { } menu[10]; static int mctr; -MBAR *ActiveMenuBar; -static MENU *ActiveMenu; +DF_MBAR *DfActiveMenuBar; +static DF_MENU *ActiveMenu; static DFWINDOW mwnd; static BOOL Selecting; -static DFWINDOW Cascaders[MAXCASCADES]; +static DFWINDOW Cascaders[DF_MAXCASCADES]; static int casc; static DFWINDOW GetDocFocus(void); -/* ----------- SETFOCUS Message ----------- */ -static int SetFocusMsg(DFWINDOW wnd, PARAM p1) +/* ----------- DFM_SETFOCUS Message ----------- */ +static int SetFocusMsg(DFWINDOW wnd, DF_PARAM p1) { int rtn; - rtn = BaseWndProc(MENUBAR, wnd, SETFOCUS, p1, 0); + rtn = DfBaseWndProc(DF_MENUBAR, wnd, DFM_SETFOCUS, p1, 0); if (!(int)p1) - DfSendMessage(GetParent(wnd), ADDSTATUS, 0, 0); + DfSendMessage(DfGetParent(wnd), DFM_ADDSTATUS, 0, 0); return rtn; } -/* --------- BUILDMENU Message --------- */ -static void BuildMenuMsg(DFWINDOW wnd, PARAM p1) +/* --------- DFM_BUILDMENU Message --------- */ +static void BuildMenuMsg(DFWINDOW wnd, DF_PARAM p1) { int offset = 3; reset_menubar(wnd); mctr = 0; - ActiveMenuBar = (MBAR *) p1; - ActiveMenu = ActiveMenuBar->PullDown; + DfActiveMenuBar = (DF_MBAR *) p1; + ActiveMenu = DfActiveMenuBar->PullDown; while (ActiveMenu->Title != NULL && ActiveMenu->Title != (void*)-1) { char *cp; - if (strlen(GetText(wnd)+offset) < + if (strlen(DfGetText(wnd)+offset) < strlen(ActiveMenu->Title)+3) break; - GetText(wnd) = DFrealloc(GetText(wnd), - strlen(GetText(wnd))+5); - memmove(GetText(wnd) + offset+4, GetText(wnd) + offset, - strlen(GetText(wnd))-offset+1); - CopyCommand(GetText(wnd)+offset,ActiveMenu->Title,FALSE, - wnd->WindowColors [STD_COLOR] [BG]); + DfGetText(wnd) = DfRealloc(DfGetText(wnd), + strlen(DfGetText(wnd))+5); + memmove(DfGetText(wnd) + offset+4, DfGetText(wnd) + offset, + strlen(DfGetText(wnd))-offset+1); + DfCopyCommand(DfGetText(wnd)+offset,ActiveMenu->Title,FALSE, + wnd->WindowColors [DF_STD_COLOR] [DF_BG]); menu[mctr].x1 = offset; - offset += strlen(ActiveMenu->Title) + (3+MSPACE); - menu[mctr].x2 = offset-MSPACE; - cp = strchr(ActiveMenu->Title, SHORTCUTCHAR); + offset += strlen(ActiveMenu->Title) + (3+DF_MSPACE); + menu[mctr].x2 = offset-DF_MSPACE; + cp = strchr(ActiveMenu->Title, DF_SHORTCUTCHAR); if (cp) menu[mctr].sc = tolower(*(cp+1)); mctr++; ActiveMenu++; } - ActiveMenu = ActiveMenuBar->PullDown; + ActiveMenu = DfActiveMenuBar->PullDown; } -/* ---------- PAINT Message ---------- */ +/* ---------- DFM_PAINT Message ---------- */ static void PaintMsg(DFWINDOW wnd) { if (Selecting) return; - if (wnd == inFocus) - DfSendMessage(GetParent(wnd), ADDSTATUS, 0, 0); - SetStandardColor(wnd); - wputs(wnd, GetText(wnd), 0, 0); - if (ActiveMenuBar == NULL) + if (wnd == DfInFocus) + DfSendMessage(DfGetParent(wnd), DFM_ADDSTATUS, 0, 0); + DfSetStandardColor(wnd); + DfWPuts(wnd, DfGetText(wnd), 0, 0); + if (DfActiveMenuBar == NULL) return; - if (ActiveMenuBar->ActiveSelection != -1 && - (wnd == inFocus || mwnd != NULL)) { + if (DfActiveMenuBar->ActiveSelection != -1 && + (wnd == DfInFocus || mwnd != NULL)) { char *sel, *cp; int offset, offset1; - sel = DFmalloc(200); - offset=menu[ActiveMenuBar->ActiveSelection].x1; - offset1=menu[ActiveMenuBar->ActiveSelection].x2; - GetText(wnd)[offset1] = '\0'; - SetReverseColor(wnd); + sel = DfMalloc(200); + offset=menu[DfActiveMenuBar->ActiveSelection].x1; + offset1=menu[DfActiveMenuBar->ActiveSelection].x2; + DfGetText(wnd)[offset1] = '\0'; + DfSetReverseColor(wnd); memset(sel, '\0', 200); - strcpy(sel, GetText(wnd)+offset); - cp = strchr(sel, CHANGECOLOR); + strcpy(sel, DfGetText(wnd)+offset); + cp = strchr(sel, DF_CHANGECOLOR); if (cp != NULL) - *(cp + 2) = background | 0x80; - wputs(wnd, sel, - offset-ActiveMenuBar->ActiveSelection*4, 0); - GetText(wnd)[offset1] = ' '; - if (mwnd == NULL && wnd == inFocus) { + *(cp + 2) = DfBackground | 0x80; + DfWPuts(wnd, sel, + offset-DfActiveMenuBar->ActiveSelection*4, 0); + DfGetText(wnd)[offset1] = ' '; + if (mwnd == NULL && wnd == DfInFocus) { char *st = ActiveMenu - [ActiveMenuBar->ActiveSelection].StatusText; + [DfActiveMenuBar->ActiveSelection].StatusText; if (st != NULL) - DfSendMessage(GetParent(wnd), ADDSTATUS, - (PARAM)st, 0); + DfSendMessage(DfGetParent(wnd), DFM_ADDSTATUS, + (DF_PARAM)st, 0); } free(sel); } } -/* ------------ KEYBOARD Message ------------- */ -static void KeyboardMsg(DFWINDOW wnd, PARAM p1) +/* ------------ DFM_KEYBOARD Message ------------- */ +static void KeyboardMsg(DFWINDOW wnd, DF_PARAM p1) { - MENU *mnu; + DF_MENU *mnu; int sel; if (mwnd == NULL) { /* ----- search for menu bar shortcut keys ---- */ int c = tolower((int)p1); - int a = AltConvert((int)p1); + int a = DfAltConvert((int)p1); int j; for (j = 0; j < mctr; j++) { - if ((inFocus == wnd && menu[j].sc == c) || + if ((DfInFocus == wnd && menu[j].sc == c) || (a && menu[j].sc == a)) { - DfSendMessage(wnd, SETFOCUS, TRUE, 0); - DfSendMessage(wnd, MB_SELECTION, j, 0); + DfSendMessage(wnd, DFM_SETFOCUS, TRUE, 0); + DfSendMessage(wnd, DFM_MB_SELECTION, j, 0); return; } } @@ -126,19 +126,19 @@ static void KeyboardMsg(DFWINDOW wnd, PARAM p1) /* -------- search for accelerator keys -------- */ mnu = ActiveMenu; while (mnu->Title != (void *)-1) { - struct PopDown *pd = mnu->Selections; + struct DfPopDown *pd = mnu->Selections; if (mnu->PrepMenu) (*(mnu->PrepMenu))(GetDocFocus(), mnu); while (pd->SelectionTitle != NULL) { if (pd->Accelerator == (int) p1) { - if (pd->Attrib & INACTIVE) - beep(); + if (pd->Attrib & DF_INACTIVE) + DfBeep(); else { - if (pd->Attrib & TOGGLE) - pd->Attrib ^= CHECKED; + if (pd->Attrib & DF_TOGGLE) + pd->Attrib ^= DF_CHECKED; DfSendMessage(GetDocFocus(), - SETFOCUS, TRUE, 0); - DfPostMessage(GetParent(wnd), + DFM_SETFOCUS, TRUE, 0); + DfPostMessage(DfGetParent(wnd), DFM_COMMAND, pd->ActionId, 0); } return; @@ -149,164 +149,164 @@ static void KeyboardMsg(DFWINDOW wnd, PARAM p1) } switch ((int)p1) { - case F1: - if (ActiveMenu == NULL || ActiveMenuBar == NULL) + case DF_F1: + if (ActiveMenu == NULL || DfActiveMenuBar == NULL) break; - sel = ActiveMenuBar->ActiveSelection; + sel = DfActiveMenuBar->ActiveSelection; if (sel == -1) { - BaseWndProc(MENUBAR, wnd, KEYBOARD, F1, 0); + DfBaseWndProc(DF_MENUBAR, wnd, DFM_KEYBOARD, DF_F1, 0); return; } mnu = ActiveMenu+sel; if (mwnd == NULL || mnu->Selections[0].SelectionTitle == NULL) { - DisplayHelp(wnd,mnu->Title+1); + DfDisplayHelp(wnd,mnu->Title+1); return; } break; case '\r': if (mwnd == NULL && - ActiveMenuBar->ActiveSelection != -1) - DfSendMessage(wnd, MB_SELECTION, - ActiveMenuBar->ActiveSelection, 0); + DfActiveMenuBar->ActiveSelection != -1) + DfSendMessage(wnd, DFM_MB_SELECTION, + DfActiveMenuBar->ActiveSelection, 0); break; - case F10: - if (wnd != inFocus && mwnd == NULL) { - DfSendMessage(wnd, SETFOCUS, TRUE, 0); - if ( ActiveMenuBar->ActiveSelection == -1) - ActiveMenuBar->ActiveSelection = 0; - DfSendMessage(wnd, PAINT, 0, 0); + case DF_F10: + if (wnd != DfInFocus && mwnd == NULL) { + DfSendMessage(wnd, DFM_SETFOCUS, TRUE, 0); + if ( DfActiveMenuBar->ActiveSelection == -1) + DfActiveMenuBar->ActiveSelection = 0; + DfSendMessage(wnd, DFM_PAINT, 0, 0); break; } /* ------- fall through ------- */ - case ESC: - if (inFocus == wnd && mwnd == NULL) { - ActiveMenuBar->ActiveSelection = -1; - DfSendMessage(GetDocFocus(),SETFOCUS,TRUE,0); - DfSendMessage(wnd, PAINT, 0, 0); + case DF_ESC: + if (DfInFocus == wnd && mwnd == NULL) { + DfActiveMenuBar->ActiveSelection = -1; + DfSendMessage(GetDocFocus(),DFM_SETFOCUS,TRUE,0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } break; - case FWD: - ActiveMenuBar->ActiveSelection++; - if (ActiveMenuBar->ActiveSelection == mctr) - ActiveMenuBar->ActiveSelection = 0; + case DF_FWD: + DfActiveMenuBar->ActiveSelection++; + if (DfActiveMenuBar->ActiveSelection == mctr) + DfActiveMenuBar->ActiveSelection = 0; if (mwnd != NULL) - DfSendMessage(wnd, MB_SELECTION, - ActiveMenuBar->ActiveSelection, 0); + DfSendMessage(wnd, DFM_MB_SELECTION, + DfActiveMenuBar->ActiveSelection, 0); else - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); break; - case BS: - if (ActiveMenuBar->ActiveSelection == 0 || - ActiveMenuBar->ActiveSelection == -1) - ActiveMenuBar->ActiveSelection = mctr; - --ActiveMenuBar->ActiveSelection; + case DF_BS: + if (DfActiveMenuBar->ActiveSelection == 0 || + DfActiveMenuBar->ActiveSelection == -1) + DfActiveMenuBar->ActiveSelection = mctr; + --DfActiveMenuBar->ActiveSelection; if (mwnd != NULL) - DfSendMessage(wnd, MB_SELECTION, - ActiveMenuBar->ActiveSelection, 0); + DfSendMessage(wnd, DFM_MB_SELECTION, + DfActiveMenuBar->ActiveSelection, 0); else - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); break; default: break; } } -/* --------------- LEFT_BUTTON Message ---------- */ -static void LeftButtonMsg(DFWINDOW wnd, PARAM p1) +/* --------------- DFM_LEFT_BUTTON Message ---------- */ +static void LeftButtonMsg(DFWINDOW wnd, DF_PARAM p1) { int i; - int mx = (int) p1 - GetLeft(wnd); + int mx = (int) p1 - DfGetLeft(wnd); /* --- compute the selection that the left button hit --- */ for (i = 0; i < mctr; i++) if (mx >= menu[i].x1-4*i && mx <= menu[i].x2-4*i-5) break; if (i < mctr) - if (i != ActiveMenuBar->ActiveSelection || mwnd == NULL) - DfSendMessage(wnd, MB_SELECTION, i, 0); + if (i != DfActiveMenuBar->ActiveSelection || mwnd == NULL) + DfSendMessage(wnd, DFM_MB_SELECTION, i, 0); } -/* -------------- MB_SELECTION Message -------------- */ -static void SelectionMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* -------------- DFM_MB_SELECTION Message -------------- */ +static void SelectionMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { int wd, mx, my; - MENU *mnu; + DF_MENU *mnu; if (!p2) { - ActiveMenuBar->ActiveSelection = -1; - DfSendMessage(wnd, PAINT, 0, 0); + DfActiveMenuBar->ActiveSelection = -1; + DfSendMessage(wnd, DFM_PAINT, 0, 0); } Selecting = TRUE; mnu = ActiveMenu+(int)p1; if (mnu->PrepMenu != NULL) (*(mnu->PrepMenu))(GetDocFocus(), mnu); - wd = MenuWidth(mnu->Selections); + wd = DfMenuWidth(mnu->Selections); if (p2) { - int brd = GetRight(wnd); - mx = GetLeft(mwnd) + WindowWidth(mwnd) - 1; + int brd = DfGetRight(wnd); + mx = DfGetLeft(mwnd) + DfWindowWidth(mwnd) - 1; if (mx + wd > brd) mx = brd - wd; - my = GetTop(mwnd) + mwnd->selection; + my = DfGetTop(mwnd) + mwnd->selection; } else { int offset = menu[(int)p1].x1 - 4 * (int)p1; if (mwnd != NULL) - DfSendMessage(mwnd, CLOSE_WINDOW, 0, 0); - ActiveMenuBar->ActiveSelection = (int) p1; - if (offset > WindowWidth(wnd)-wd) - offset = WindowWidth(wnd)-wd; - mx = GetLeft(wnd)+offset; - my = GetTop(wnd)+1; + DfSendMessage(mwnd, DFM_CLOSE_WINDOW, 0, 0); + DfActiveMenuBar->ActiveSelection = (int) p1; + if (offset > DfWindowWidth(wnd)-wd) + offset = DfWindowWidth(wnd)-wd; + mx = DfGetLeft(wnd)+offset; + my = DfGetTop(wnd)+1; } - mwnd = DfCreateWindow(POPDOWNMENU, NULL, + mwnd = DfDfCreateWindow(DF_POPDOWNMENU, NULL, mx, my, - MenuHeight(mnu->Selections), + DfMenuHeight(mnu->Selections), wd, NULL, wnd, NULL, - SHADOW); + DF_SHADOW); if (!p2) { Selecting = FALSE; - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); Selecting = TRUE; } if (mnu->Selections[0].SelectionTitle != NULL) { - DfSendMessage(mwnd, BUILD_SELECTIONS, (PARAM) mnu, 0); - DfSendMessage(mwnd, SETFOCUS, TRUE, 0); - DfSendMessage(mwnd, SHOW_WINDOW, 0, 0); + DfSendMessage(mwnd, DFM_BUILD_SELECTIONS, (DF_PARAM) mnu, 0); + DfSendMessage(mwnd, DFM_SETFOCUS, TRUE, 0); + DfSendMessage(mwnd, DFM_SHOW_WINDOW, 0, 0); } Selecting = FALSE; } /* --------- COMMAND Message ---------- */ -static void CommandMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +static void CommandMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - if (p1 == ID_HELP) + if (p1 == DF_ID_HELP) { - BaseWndProc(MENUBAR, wnd, DFM_COMMAND, p1, p2); + DfBaseWndProc(DF_MENUBAR, wnd, DFM_COMMAND, p1, p2); return; } - if (isCascadedCommand(ActiveMenuBar, (int)p1)) + if (DfIsCascadedCommand(DfActiveMenuBar, (int)p1)) { /* find the cascaded menu based on command id in p1 */ - MENU *mnu = ActiveMenu+mctr; + DF_MENU *mnu = ActiveMenu+mctr; while (mnu->Title != (void *)-1) { if (mnu->CascadeId == (int) p1) { - if (casc < MAXCASCADES) { + if (casc < DF_MAXCASCADES) { Cascaders[casc++] = mwnd; - DfSendMessage(wnd, MB_SELECTION, - (PARAM)(mnu-ActiveMenu), TRUE); + DfSendMessage(wnd, DFM_MB_SELECTION, + (DF_PARAM)(mnu-ActiveMenu), TRUE); } break; } @@ -315,118 +315,118 @@ static void CommandMsg(DFWINDOW wnd, PARAM p1, PARAM p2) } else { if (mwnd != NULL) - DfSendMessage(mwnd, CLOSE_WINDOW, 0, 0); - DfSendMessage(GetDocFocus(), SETFOCUS, TRUE, 0); - DfPostMessage(GetParent(wnd), DFM_COMMAND, p1, p2); + DfSendMessage(mwnd, DFM_CLOSE_WINDOW, 0, 0); + DfSendMessage(GetDocFocus(), DFM_SETFOCUS, TRUE, 0); + DfPostMessage(DfGetParent(wnd), DFM_COMMAND, p1, p2); } } -/* --------------- CLOSE_POPDOWN Message --------------- */ +/* --------------- DFM_CLOSE_POPDOWN Message --------------- */ static void ClosePopdownMsg(DFWINDOW wnd) { if (casc > 0) - DfSendMessage(Cascaders[--casc], CLOSE_WINDOW, 0, 0); + DfSendMessage(Cascaders[--casc], DFM_CLOSE_WINDOW, 0, 0); else { mwnd = NULL; - ActiveMenuBar->ActiveSelection = -1; + DfActiveMenuBar->ActiveSelection = -1; if (!Selecting) { - DfSendMessage(GetDocFocus(), SETFOCUS, TRUE, 0); - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(GetDocFocus(), DFM_SETFOCUS, TRUE, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } } } -/* ---------------- CLOSE_WINDOW Message --------------- */ +/* ---------------- DFM_CLOSE_WINDOW Message --------------- */ static void CloseWindowMsg(DFWINDOW wnd) { - if (GetText(wnd) != NULL) + if (DfGetText(wnd) != NULL) { - free(GetText(wnd)); - GetText(wnd) = NULL; + free(DfGetText(wnd)); + DfGetText(wnd) = NULL; } mctr = 0; - ActiveMenuBar->ActiveSelection = -1; + DfActiveMenuBar->ActiveSelection = -1; ActiveMenu = NULL; - ActiveMenuBar = NULL; + DfActiveMenuBar = NULL; } -/* --- Window processing module for MENUBAR window class --- */ -int MenuBarProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +/* --- Window processing module for DF_MENUBAR window class --- */ +int DfMenuBarProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { int rtn; switch (msg) { - case CREATE_WINDOW: + case DFM_CREATE_WINDOW: reset_menubar(wnd); break; - case SETFOCUS: + case DFM_SETFOCUS: return SetFocusMsg(wnd, p1); - case BUILDMENU: + case DFM_BUILDMENU: BuildMenuMsg(wnd, p1); break; - case PAINT: - if (!isVisible(wnd) || GetText(wnd) == NULL) + case DFM_PAINT: + if (!DfIsVisible(wnd) || DfGetText(wnd) == NULL) break; PaintMsg(wnd); return FALSE; - case BORDER: + case DFM_BORDER: if (mwnd == NULL) - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); return TRUE; - case KEYBOARD: + case DFM_KEYBOARD: KeyboardMsg(wnd, p1); return TRUE; - case LEFT_BUTTON: + case DFM_LEFT_BUTTON: LeftButtonMsg(wnd, p1); return TRUE; - case MB_SELECTION: + case DFM_MB_SELECTION: SelectionMsg(wnd, p1, p2); break; case DFM_COMMAND: CommandMsg(wnd, p1, p2); return TRUE; - case INSIDE_WINDOW: - return InsideRect(p1, p2, WindowRect(wnd)); - case CLOSE_POPDOWN: + case DFM_INSIDE_WINDOW: + return DfInsideRect(p1, p2, DfWindowRect(wnd)); + case DFM_CLOSE_POPDOWN: ClosePopdownMsg(wnd); return TRUE; - case CLOSE_WINDOW: + case DFM_CLOSE_WINDOW: CloseWindowMsg(wnd); - rtn = BaseWndProc(MENUBAR, wnd, msg, p1, p2); + rtn = DfBaseWndProc(DF_MENUBAR, wnd, msg, p1, p2); return rtn; default: break; } - return BaseWndProc(MENUBAR, wnd, msg, p1, p2); + return DfBaseWndProc(DF_MENUBAR, wnd, msg, p1, p2); } -/* ------------- reset the MENUBAR -------------- */ +/* ------------- reset the DF_MENUBAR -------------- */ static void reset_menubar(DFWINDOW wnd) { - GetText(wnd) = DFrealloc(GetText(wnd), DfGetScreenWidth()+5); - memset(GetText(wnd), ' ', DfGetScreenWidth()); - *(GetText(wnd)+WindowWidth(wnd)) = '\0'; + DfGetText(wnd) = DfRealloc(DfGetText(wnd), DfGetScreenWidth()+5); + memset(DfGetText(wnd), ' ', DfGetScreenWidth()); + *(DfGetText(wnd)+DfWindowWidth(wnd)) = '\0'; } static DFWINDOW GetDocFocus(void) { - DFWINDOW wnd = ApplicationWindow; + DFWINDOW wnd = DfApplicationWindow; if (wnd != NULL) { - wnd = LastWindow(wnd); + wnd = DfLastWindow(wnd); while (wnd != NULL && - (GetClass(wnd) == MENUBAR || - GetClass(wnd) == STATUSBAR)) - wnd = PrevWindow(wnd); + (DfGetClass(wnd) == DF_MENUBAR || + DfGetClass(wnd) == DF_STATUSBAR)) + wnd = DfPrevWindow(wnd); if (wnd != NULL) { while (wnd->childfocus != NULL) wnd = wnd->childfocus; } } - return wnd ? wnd : ApplicationWindow; + return wnd ? wnd : DfApplicationWindow; } /* EOF */ diff --git a/rosapps/dflat32/menus.c b/rosapps/dflat32/menus.c index 573161c8381..2e129f80fb7 100644 --- a/rosapps/dflat32/menus.c +++ b/rosapps/dflat32/menus.c @@ -3,124 +3,124 @@ #include "dflat.h" /* --------------------- the main menu --------------------- */ -DEFMENU(MainMenu) +DF_DEFMENU(DfMainMenu) /* --------------- the File popdown menu ----------------*/ - POPDOWN( "~File", PrepFileMenu, "Read/write/print files. Go to DOS" ) - SELECTION( "~New", ID_NEW, 0, 0 ) - SELECTION( "~Open...", ID_OPEN, 0, 0 ) - SEPARATOR - SELECTION( "~Save", ID_SAVE, ALT_S, INACTIVE) - SELECTION( "Save ~as...", ID_SAVEAS, 0, INACTIVE) - SELECTION( "D~elete", ID_DELETEFILE, 0, INACTIVE) - SEPARATOR - SELECTION( "~Print", ID_PRINT, 0, INACTIVE) - SELECTION( "P~rinter setup...", ID_PRINTSETUP, 0, 0 ) - SEPARATOR - SELECTION( "~DOS", ID_DOS, 0, 0 ) - SELECTION( "E~xit", ID_EXIT, ALT_X, 0 ) - ENDPOPDOWN + DF_POPDOWN( "~File", DfPrepFileMenu, "Read/write/print files. Go to DOS" ) + DF_SELECTION( "~New", DF_ID_NEW, 0, 0 ) + DF_SELECTION( "~Open...", DF_ID_OPEN, 0, 0 ) + DF_SEPARATOR + DF_SELECTION( "~Save", DF_ID_SAVE, DF_ALT_S, DF_INACTIVE) + DF_SELECTION( "Save ~as...", DF_ID_SAVEAS, 0, DF_INACTIVE) + DF_SELECTION( "D~elete", DF_ID_DELETEFILE, 0, DF_INACTIVE) + DF_SEPARATOR + DF_SELECTION( "~Print", DF_ID_PRINT, 0, DF_INACTIVE) + DF_SELECTION( "P~rinter setup...", DF_ID_PRINTSETUP, 0, 0 ) + DF_SEPARATOR + DF_SELECTION( "~DOS", DF_ID_DOS, 0, 0 ) + DF_SELECTION( "E~xit", DF_ID_EXIT, DF_ALT_X, 0 ) + DF_ENDPOPDOWN /* --------------- the Edit popdown menu ----------------*/ - POPDOWN( "~Edit", PrepEditMenu, "Clipboard, delete text, paragraph" ) - SELECTION( "~Undo", ID_UNDO, ALT_BS, INACTIVE) - SEPARATOR - SELECTION( "Cu~t", ID_CUT, SHIFT_DEL, INACTIVE) - SELECTION( "~Copy", ID_COPY, CTRL_INS, INACTIVE) - SELECTION( "~Paste", ID_PASTE, SHIFT_INS, INACTIVE) - SEPARATOR - SELECTION( "Cl~ear", ID_CLEAR, 0, INACTIVE) - SELECTION( "~Delete", ID_DELETETEXT, DEL, INACTIVE) - SEPARATOR - SELECTION( "Pa~ragraph", ID_PARAGRAPH, ALT_P,INACTIVE) - ENDPOPDOWN + DF_POPDOWN( "~Edit", DfPrepEditMenu, "DfClipboard, delete text, paragraph" ) + DF_SELECTION( "~Undo", DF_ID_UNDO, DF_ALT_BS, DF_INACTIVE) + DF_SEPARATOR + DF_SELECTION( "Cu~t", DF_ID_CUT, DF_SHIFT_DEL, DF_INACTIVE) + DF_SELECTION( "~Copy", DF_ID_COPY, DF_CTRL_INS, DF_INACTIVE) + DF_SELECTION( "~Paste", DF_ID_PASTE, DF_SHIFT_INS, DF_INACTIVE) + DF_SEPARATOR + DF_SELECTION( "Cl~ear", DF_ID_CLEAR, 0, DF_INACTIVE) + DF_SELECTION( "~Delete", DF_ID_DELETETEXT, DF_DEL, DF_INACTIVE) + DF_SEPARATOR + DF_SELECTION( "Pa~ragraph", DF_ID_PARAGRAPH, DF_ALT_P,DF_INACTIVE) + DF_ENDPOPDOWN /* --------------- the Search popdown menu ----------------*/ - POPDOWN( "~Search", PrepSearchMenu, "Search and replace" ) - SELECTION( "~Search...", ID_SEARCH, 0, INACTIVE) - SELECTION( "~Replace...",ID_REPLACE, 0, INACTIVE) - SELECTION( "~Next", ID_SEARCHNEXT, F3, INACTIVE) - ENDPOPDOWN + DF_POPDOWN( "~Search", DfPrepSearchMenu, "Search and replace" ) + DF_SELECTION( "~Search...", DF_ID_SEARCH, 0, DF_INACTIVE) + DF_SELECTION( "~Replace...",DF_ID_REPLACE, 0, DF_INACTIVE) + DF_SELECTION( "~Next", DF_ID_SEARCHNEXT, DF_F3, DF_INACTIVE) + DF_ENDPOPDOWN /* ------------ the Utilities popdown menu --------------- */ - POPDOWN( "~Utilities", NULL, "Utility programs" ) - SELECTION( "~Calendar", ID_CALENDAR, 0, 0) -// SELECTION( "~Bar chart", ID_BARCHART, 0, 0) - ENDPOPDOWN + DF_POPDOWN( "~Utilities", NULL, "Utility programs" ) + DF_SELECTION( "~Calendar", DF_ID_CALENDAR, 0, 0) +// DF_SELECTION( "~Bar chart", DF_ID_BARCHART, 0, 0) + DF_ENDPOPDOWN /* ------------- the Options popdown menu ---------------*/ - POPDOWN( "~Options", NULL, "Editor and display options" ) - SELECTION( "~Display...", ID_DISPLAY, 0, 0 ) - SEPARATOR + DF_POPDOWN( "~Options", NULL, "Editor and display options" ) + DF_SELECTION( "~Display...", DF_ID_DISPLAY, 0, 0 ) + DF_SEPARATOR #ifdef INCLUDE_LOGGING - SELECTION( "~Log messages", ID_LOG, ALT_L, 0 ) - SEPARATOR + DF_SELECTION( "~Log messages", DF_ID_LOG, DF_ALT_L, 0 ) + DF_SEPARATOR #endif - SELECTION( "~Insert", ID_INSERT, INS, TOGGLE) - SELECTION( "~Word wrap", ID_WRAP, 0, TOGGLE) - SELECTION( "~Tabs ( )", ID_TABS, 0, CASCADED) - SEPARATOR - SELECTION( "~Save options", ID_SAVEOPTIONS, 0, 0 ) - ENDPOPDOWN + DF_SELECTION( "~Insert", DF_ID_INSERT, DF_INS, DF_TOGGLE) + DF_SELECTION( "~Word wrap", DF_ID_WRAP, 0, DF_TOGGLE) + DF_SELECTION( "~Tabs ( )", DF_ID_TABS, 0, DF_CASCADED) + DF_SEPARATOR + DF_SELECTION( "~Save options", DF_ID_SAVEOPTIONS, 0, 0 ) + DF_ENDPOPDOWN /* --------------- the Window popdown menu --------------*/ - POPDOWN( "~Window", PrepWindowMenu, "Select/close document windows" ) - SELECTION( NULL, ID_CLOSEALL, 0, 0) - SEPARATOR - SELECTION( NULL, ID_WINDOW, 0, 0 ) - SELECTION( NULL, ID_WINDOW, 0, 0 ) - SELECTION( NULL, ID_WINDOW, 0, 0 ) - SELECTION( NULL, ID_WINDOW, 0, 0 ) - SELECTION( NULL, ID_WINDOW, 0, 0 ) - SELECTION( NULL, ID_WINDOW, 0, 0 ) - SELECTION( NULL, ID_WINDOW, 0, 0 ) - SELECTION( NULL, ID_WINDOW, 0, 0 ) - SELECTION( NULL, ID_WINDOW, 0, 0 ) - SELECTION( NULL, ID_WINDOW, 0, 0 ) - SELECTION( NULL, ID_WINDOW, 0, 0 ) - SELECTION( "~More Windows...", ID_MOREWINDOWS, 0, 0) - SELECTION( NULL, ID_WINDOW, 0, 0 ) - ENDPOPDOWN + DF_POPDOWN( "~Window", DfPrepWindowMenu, "Select/close document windows" ) + DF_SELECTION( NULL, DF_ID_CLOSEALL, 0, 0) + DF_SEPARATOR + DF_SELECTION( NULL, DF_ID_WINDOW, 0, 0 ) + DF_SELECTION( NULL, DF_ID_WINDOW, 0, 0 ) + DF_SELECTION( NULL, DF_ID_WINDOW, 0, 0 ) + DF_SELECTION( NULL, DF_ID_WINDOW, 0, 0 ) + DF_SELECTION( NULL, DF_ID_WINDOW, 0, 0 ) + DF_SELECTION( NULL, DF_ID_WINDOW, 0, 0 ) + DF_SELECTION( NULL, DF_ID_WINDOW, 0, 0 ) + DF_SELECTION( NULL, DF_ID_WINDOW, 0, 0 ) + DF_SELECTION( NULL, DF_ID_WINDOW, 0, 0 ) + DF_SELECTION( NULL, DF_ID_WINDOW, 0, 0 ) + DF_SELECTION( NULL, DF_ID_WINDOW, 0, 0 ) + DF_SELECTION( "~More Windows...", DF_ID_MOREWINDOWS, 0, 0) + DF_SELECTION( NULL, DF_ID_WINDOW, 0, 0 ) + DF_ENDPOPDOWN /* --------------- the Help popdown menu ----------------*/ - POPDOWN( "~Help", NULL, "Get help" ) - SELECTION( "~Help for help...", ID_HELPHELP, 0, 0 ) - SELECTION( "~Extended help...", ID_EXTHELP, 0, 0 ) - SELECTION( "~Keys help...", ID_KEYSHELP, 0, 0 ) - SELECTION( "Help ~index...", ID_HELPINDEX, 0, 0 ) - SEPARATOR - SELECTION( "~About...", ID_ABOUT, 0, 0 ) + DF_POPDOWN( "~Help", NULL, "Get help" ) + DF_SELECTION( "~Help for help...", DF_ID_HELPHELP, 0, 0 ) + DF_SELECTION( "~Extended help...", DF_ID_EXTHELP, 0, 0 ) + DF_SELECTION( "~Keys help...", DF_ID_KEYSHELP, 0, 0 ) + DF_SELECTION( "Help ~index...", DF_ID_HELPINDEX, 0, 0 ) + DF_SEPARATOR + DF_SELECTION( "~About...", DF_ID_ABOUT, 0, 0 ) #ifdef TESTING_DFLAT - SEPARATOR - SELECTION( "~Reload help database",ID_LOADHELP,0, 0 ) + DF_SEPARATOR + DF_SELECTION( "~Reload help database",DF_ID_LOADHELP,0, 0 ) #endif - ENDPOPDOWN + DF_ENDPOPDOWN /* ----- cascaded pulldown from Tabs... above ----- */ - CASCADED_POPDOWN( ID_TABS, NULL ) - SELECTION( "~2 tab stops", ID_TAB2, 0, 0) - SELECTION( "~4 tab stops", ID_TAB4, 0, 0) - SELECTION( "~6 tab stops", ID_TAB6, 0, 0) - SELECTION( "~8 tab stops", ID_TAB8, 0, 0) - ENDPOPDOWN + DF_CASCADED_POPDOWN( DF_ID_TABS, NULL ) + DF_SELECTION( "~2 tab stops", DF_ID_TAB2, 0, 0) + DF_SELECTION( "~4 tab stops", DF_ID_TAB4, 0, 0) + DF_SELECTION( "~6 tab stops", DF_ID_TAB6, 0, 0) + DF_SELECTION( "~8 tab stops", DF_ID_TAB8, 0, 0) + DF_ENDPOPDOWN -ENDMENU +DF_ENDMENU /* ------------- the System Menu --------------------- */ -DEFMENU(SystemMenu) - POPDOWN("System Menu", NULL, NULL) +DF_DEFMENU(DfSystemMenu) + DF_POPDOWN("System Menu", NULL, NULL) #ifdef INCLUDE_RESTORE - SELECTION("~Restore", ID_SYSRESTORE, 0, 0 ) + DF_SELECTION("~Restore", DF_ID_SYSRESTORE, 0, 0 ) #endif - SELECTION("~Move", ID_SYSMOVE, 0, 0 ) - SELECTION("~Size", ID_SYSSIZE, 0, 0 ) + DF_SELECTION("~Move", DF_ID_SYSMOVE, 0, 0 ) + DF_SELECTION("~Size", DF_ID_SYSSIZE, 0, 0 ) #ifdef INCLUDE_MINIMIZE - SELECTION("Mi~nimize", ID_SYSMINIMIZE, 0, 0 ) + DF_SELECTION("Mi~nimize", DF_ID_SYSMINIMIZE, 0, 0 ) #endif #ifdef INCLUDE_MAXIMIZE - SELECTION("Ma~ximize", ID_SYSMAXIMIZE, 0, 0 ) + DF_SELECTION("Ma~ximize", DF_ID_SYSMAXIMIZE, 0, 0 ) #endif - SEPARATOR - SELECTION("~Close", ID_SYSCLOSE, CTRL_F4, 0 ) - ENDPOPDOWN -ENDMENU + DF_SEPARATOR + DF_SELECTION("~Close", DF_ID_SYSCLOSE, DF_CTRL_F4, 0 ) + DF_ENDPOPDOWN +DF_ENDMENU diff --git a/rosapps/dflat32/message.c b/rosapps/dflat32/message.c index 47bcda5b4d4..69713cf317b 100644 --- a/rosapps/dflat32/message.c +++ b/rosapps/dflat32/message.c @@ -15,16 +15,16 @@ static struct events DFMESSAGE event; int mx; int my; -} EventQueue[MAXMESSAGES]; +} EventQueue[DF_MAXMESSAGES]; /* ---------- message queue --------- */ static struct msgs { DFWINDOW wnd; DFMESSAGE msg; - PARAM p1; - PARAM p2; -} MsgQueue[MAXMESSAGES]; + DF_PARAM p1; + DF_PARAM p2; +} MsgQueue[DF_MAXMESSAGES]; static int EventQueueOnCtr; static int EventQueueOffCtr; @@ -35,8 +35,8 @@ static int MsgQueueOffCtr; static int MsgQueueCtr; -DFWINDOW CaptureMouse; -DFWINDOW CaptureKeyboard; +DFWINDOW DfCaptureMouse; +DFWINDOW DfCaptureKeyboard; static BOOL NoChildCaptureMouse; static BOOL NoChildCaptureKeyboard; @@ -51,20 +51,20 @@ static DFWINDOW Cwnd; static void StopMsg(void) { - ClearClipboard(); - ClearDialogBoxes(); - restorecursor(); - unhidecursor(); + DfClearClipboard(); + DfClearDialogBoxes(); + DfRestoreCursor(); + DfUnhideCursor(); } SHORT DfGetScreenHeight (void) { - return sScreenHeight; + return DfScreenHeight; } SHORT DfGetScreenWidth (void) { - return sScreenWidth; + return DfScreenWidth; } /* ------------ initialize the message system --------- */ @@ -80,22 +80,22 @@ BOOL DfInitialize (VOID) } /* get input and output handles */ - hInput = GetStdHandle (STD_INPUT_HANDLE); - hOutput = GetStdHandle (STD_OUTPUT_HANDLE); + DfInput = GetStdHandle (STD_INPUT_HANDLE); + DfOutput = 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; + GetConsoleScreenBufferInfo (DfOutput, &csbi); + DfScreenHeight = (csbi.srWindow.Bottom - csbi.srWindow.Top) + 1; + DfScreenWidth = (csbi.srWindow.Right - csbi.srWindow.Left) + 1; /* enable mouse events */ - SetConsoleMode (hInput, ENABLE_MOUSE_INPUT); + SetConsoleMode (DfInput, ENABLE_MOUSE_INPUT); - savecursor(); - hidecursor(); + DfSaveCursor(); + DfHideCursor(); - CaptureMouse = NULL; - CaptureKeyboard = NULL; + DfCaptureMouse = NULL; + DfCaptureKeyboard = NULL; NoChildCaptureMouse = FALSE; NoChildCaptureKeyboard = FALSE; MsgQueueOnCtr = 0; @@ -118,11 +118,11 @@ void DfTerminate (void) /* ----- post an event and parameters to event queue ---- */ static void PostEvent(DFMESSAGE event, int p1, int p2) { - if (EventQueueCtr != MAXMESSAGES) { + if (EventQueueCtr != DF_MAXMESSAGES) { EventQueue[EventQueueOnCtr].event = event; EventQueue[EventQueueOnCtr].mx = p1; EventQueue[EventQueueOnCtr].my = p2; - if (++EventQueueOnCtr == MAXMESSAGES) + if (++EventQueueOnCtr == DF_MAXMESSAGES) EventQueueOnCtr = 0; EventQueueCtr++; } @@ -141,14 +141,14 @@ static void collect_events(void) int hr; #endif - HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE); + HANDLE DfInput = GetStdHandle (STD_INPUT_HANDLE); INPUT_RECORD ir; DWORD dwRead; int c; #ifdef TIMER_AVAILABLE /* -------- test for a clock event (one/second) ------- */ - if (timed_out(clocktimer)) + if (DfTimedOut(clocktimer)) { /* ----- get the current time ----- */ time_t t = time(NULL); @@ -165,14 +165,14 @@ static void collect_events(void) *(timestr+2) = ' '; flipflop ^= TRUE; /* -------- reset the timer -------- */ - set_timer(clocktimer, 1); + DfSetTimer(clocktimer, 1); /* -------- post the clock event -------- */ - PostEvent(CLOCKTICK, (PARAM)timestr, 0); + PostEvent(DFM_CLOCKTICK, (DF_PARAM)timestr, 0); } #endif -// WaitForSingleObject (hInput, INFINITE); - ReadConsoleInput (hInput, &ir, 1, &dwRead); +// WaitForSingleObject (DfInput, INFINITE); + ReadConsoleInput (DfInput, &ir, 1, &dwRead); if ((ir.EventType == KEY_EVENT) && (ir.Event.KeyEvent.bKeyDown == TRUE)) @@ -183,25 +183,25 @@ static void collect_events(void) if (ir.Event.KeyEvent.dwControlKeyState & (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)) { - sk |= ALTKEY; + sk |= DF_ALTKEY; } if (ir.Event.KeyEvent.dwControlKeyState & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) { - sk |= CTRLKEY; + sk |= DF_CTRLKEY; } if (ir.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED) { - sk |= LEFTSHIFT + RIGHTSHIFT; + sk |= DF_LEFTSHIFT + DF_RIGHTSHIFT; } if (sk != OldShiftKeys) { OldShiftKeys = sk; /* the shift status changed */ - PostEvent(SHIFT_CHANGED, sk, 0); + PostEvent(DFM_SHIFT_CHANGED, sk, 0); #if 0 - if (sk & ALTKEY) + if (sk & DF_ALTKEY) AltDown = TRUE; else AltDown = FALSE; @@ -213,59 +213,59 @@ static void collect_events(void) switch (ir.Event.KeyEvent.wVirtualKeyCode) { case VK_F1: - c = F1; + c = DF_F1; break; case VK_F4: - if (sk & ALTKEY) - c = ALT_F4; - else if (sk & CTRLKEY) - c = CTRL_F4; + if (sk & DF_ALTKEY) + c = DF_ALT_F4; + else if (sk & DF_CTRLKEY) + c = DF_CTRL_F4; else - c = F4; + c = DF_F4; case VK_F10: - c = F10; + c = DF_F10; break; case VK_UP: - c = UP; + c = DF_UP; break; case VK_DOWN: - c = DN; + c = DF_DN; break; case VK_LEFT: - c = BS; + c = DF_BS; break; case VK_RIGHT: - c = FWD; + c = DF_FWD; break; case VK_INSERT: - c = INS; + c = DF_INS; break; case VK_DELETE: - c = DEL; + c = DF_DEL; break; case VK_HOME: - c = HOME; + c = DF_HOME; break; case VK_END: - c = END; + c = DF_END; break; case VK_PRIOR: - c = PGUP; + c = DF_PGUP; break; case VK_NEXT: - c = PGDN; + c = DF_PGDN; break; default: @@ -277,12 +277,12 @@ static void collect_events(void) /* special handling of SHIFT+TAB */ if (ir.Event.KeyEvent.uChar.AsciiChar == VK_TAB && (ir.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED)) - c = SHIFT_HT; + c = DF_SHIFT_HT; else c = ir.Event.KeyEvent.uChar.AsciiChar; } - PostEvent (KEYBOARD, c, sk); + PostEvent (DFM_KEYBOARD, c, sk); } else if (ir.EventType == MOUSE_EVENT) { @@ -309,14 +309,14 @@ static void collect_events(void) if (ir.Event.MouseEvent.dwButtonState == FROM_LEFT_1ST_BUTTON_PRESSED) { - PostEvent (LEFT_BUTTON, + PostEvent (DFM_LEFT_BUTTON, ir.Event.MouseEvent.dwMousePosition.X, ir.Event.MouseEvent.dwMousePosition.Y); } else if (ir.Event.MouseEvent.dwButtonState == RIGHTMOST_BUTTON_PRESSED) { - PostEvent (RIGHT_BUTTON, + PostEvent (DFM_RIGHT_BUTTON, ir.Event.MouseEvent.dwMousePosition.X, ir.Event.MouseEvent.dwMousePosition.Y); } @@ -332,57 +332,57 @@ static void collect_events(void) /* ----- post a message and parameters to msg queue ---- */ -void DfPostMessage(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +void DfPostMessage(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { - if (msg == ENDDIALOG) + if (msg == DFM_ENDDIALOG) { msg++; --msg; } - if (MsgQueueCtr != MAXMESSAGES) + if (MsgQueueCtr != DF_MAXMESSAGES) { MsgQueue[MsgQueueOnCtr].wnd = wnd; MsgQueue[MsgQueueOnCtr].msg = msg; MsgQueue[MsgQueueOnCtr].p1 = p1; MsgQueue[MsgQueueOnCtr].p2 = p2; - if (++MsgQueueOnCtr == MAXMESSAGES) + if (++MsgQueueOnCtr == DF_MAXMESSAGES) MsgQueueOnCtr = 0; MsgQueueCtr++; } } /* --------- send a message to a window ----------- */ -int DfSendMessage(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +int DfSendMessage(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { int rtn = TRUE, x, y; #ifdef INCLUDE_LOGGING - LogMessages(wnd, msg, p1, p2); + DfLogMessages(wnd, msg, p1, p2); #endif if (wnd != NULL) switch (msg) { - case PAINT: - case BORDER: + case DFM_PAINT: + case DFM_BORDER: /* ------- don't send these messages unless the window is visible -------- */ - if (isVisible(wnd)) + if (DfIsVisible(wnd)) rtn = (*wnd->wndproc)(wnd, msg, p1, p2); break; - case RIGHT_BUTTON: - case LEFT_BUTTON: + case DFM_RIGHT_BUTTON: + case DFM_LEFT_BUTTON: case DOUBLE_CLICK: case DFM_BUTTON_RELEASED: /* --- don't send these messages unless the window is visible or has captured the mouse -- */ - if (isVisible(wnd) || wnd == CaptureMouse) + if (DfIsVisible(wnd) || wnd == DfCaptureMouse) rtn = (*wnd->wndproc)(wnd, msg, p1, p2); break; - case KEYBOARD: - case SHIFT_CHANGED: + case DFM_KEYBOARD: + case DFM_SHIFT_CHANGED: /* ------- don't send these messages unless the window is visible or has captured the keyboard -- */ - if (!(isVisible(wnd) || wnd == CaptureKeyboard)) + if (!(DfIsVisible(wnd) || wnd == DfCaptureKeyboard)) break; default: rtn = (*wnd->wndproc)(wnd, msg, p1, p2); @@ -398,38 +398,38 @@ int DfSendMessage(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) StopMsg(); break; /* ------- clock messages --------- */ - case CAPTURE_CLOCK: + case DFM_CAPTURE_CLOCK: Cwnd = wnd; - set_timer(clocktimer, 0); + DfSetTimer(clocktimer, 0); break; - case RELEASE_CLOCK: + case DFM_RELEASE_CLOCK: Cwnd = NULL; - disable_timer(clocktimer); + DfDisableTimer(clocktimer); break; /* -------- keyboard messages ------- */ - case KEYBOARD_CURSOR: + case DFM_KEYBOARD_CURSOR: if (wnd == NULL) - cursor((int)p1, (int)p2); - else if (wnd == inFocus) - cursor(GetClientLeft(wnd)+(int)p1, - GetClientTop(wnd)+(int)p2); + DfCursor((int)p1, (int)p2); + else if (wnd == DfInFocus) + DfCursor(DfGetClientLeft(wnd)+(int)p1, + DfGetClientTop(wnd)+(int)p2); break; - case CAPTURE_KEYBOARD: + case DFM_CAPTURE_KEYBOARD: if (p2) - ((DFWINDOW)p2)->PrevKeyboard=CaptureKeyboard; + ((DFWINDOW)p2)->PrevKeyboard=DfCaptureKeyboard; else - wnd->PrevKeyboard = CaptureKeyboard; - CaptureKeyboard = wnd; + wnd->PrevKeyboard = DfCaptureKeyboard; + DfCaptureKeyboard = wnd; NoChildCaptureKeyboard = (int)p1; break; - case RELEASE_KEYBOARD: + case DFM_RELEASE_KEYBOARD: if (wnd != NULL) { - if (CaptureKeyboard == wnd || (int)p1) - CaptureKeyboard = wnd->PrevKeyboard; + if (DfCaptureKeyboard == wnd || (int)p1) + DfCaptureKeyboard = wnd->PrevKeyboard; else { - DFWINDOW twnd = CaptureKeyboard; + DFWINDOW twnd = DfCaptureKeyboard; while (twnd != NULL) { if (twnd->PrevKeyboard == wnd) @@ -440,54 +440,54 @@ int DfSendMessage(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) twnd = twnd->PrevKeyboard; } if (twnd == NULL) - CaptureKeyboard = NULL; + DfCaptureKeyboard = NULL; } wnd->PrevKeyboard = NULL; } else - CaptureKeyboard = NULL; + DfCaptureKeyboard = NULL; NoChildCaptureKeyboard = FALSE; break; - case CURRENT_KEYBOARD_CURSOR: - curr_cursor(&x, &y); + case DFM_CURRENT_KEYBOARD_CURSOR: + DfCurrCursor(&x, &y); *(int*)p1 = x; *(int*)p2 = y; break; - case SAVE_CURSOR: - savecursor(); + case DFM_SAVE_CURSOR: + DfSaveCursor(); break; - case RESTORE_CURSOR: - restorecursor(); + case DFM_RESTORE_CURSOR: + DfRestoreCursor(); break; - case HIDE_CURSOR: - normalcursor(); - hidecursor(); + case DFM_HIDE_CURSOR: + DfNormalCursor(); + DfHideCursor(); break; - case SHOW_CURSOR: + case DFM_SHOW_CURSOR: if (p1) - set_cursor_size(100); + DfSetCursorSize(100); else - set_cursor_size(5); - unhidecursor(); + DfSetCursorSize(5); + DfUnhideCursor(); break; - case CAPTURE_MOUSE: + case DFM_CAPTURE_MOUSE: if (p2) - ((DFWINDOW)p2)->PrevMouse = CaptureMouse; + ((DFWINDOW)p2)->PrevMouse = DfCaptureMouse; else - wnd->PrevMouse = CaptureMouse; - CaptureMouse = wnd; + wnd->PrevMouse = DfCaptureMouse; + DfCaptureMouse = wnd; NoChildCaptureMouse = (int)p1; break; - case RELEASE_MOUSE: + case DFM_RELEASE_MOUSE: if (wnd != NULL) { - if (CaptureMouse == wnd || (int)p1) - CaptureMouse = wnd->PrevMouse; + if (DfCaptureMouse == wnd || (int)p1) + DfCaptureMouse = wnd->PrevMouse; else { - DFWINDOW twnd = CaptureMouse; + DFWINDOW twnd = DfCaptureMouse; while (twnd != NULL) { if (twnd->PrevMouse == wnd) @@ -498,12 +498,12 @@ int DfSendMessage(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) twnd = twnd->PrevMouse; } if (twnd == NULL) - CaptureMouse = NULL; + DfCaptureMouse = NULL; } wnd->PrevMouse = NULL; } else - CaptureMouse = NULL; + DfCaptureMouse = NULL; NoChildCaptureMouse = FALSE; break; @@ -516,21 +516,21 @@ int DfSendMessage(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) static DFRECT VisibleRect(DFWINDOW wnd) { - DFRECT rc = WindowRect(wnd); - if (!TestAttribute(wnd, NOCLIP)) + DFRECT rc = DfWindowRect(wnd); + if (!DfTestAttribute(wnd, DF_NOCLIP)) { - DFWINDOW pwnd = GetParent(wnd); + DFWINDOW pwnd = DfGetParent(wnd); DFRECT prc; - prc = ClientRect(pwnd); + prc = DfClientRect(pwnd); while (pwnd != NULL) { - if (TestAttribute(pwnd, NOCLIP)) + if (DfTestAttribute(pwnd, DF_NOCLIP)) break; - rc = subRectangle(rc, prc); - if (!ValidRect(rc)) + rc = DfSubRectangle(rc, prc); + if (!DfValidRect(rc)) break; - if ((pwnd = GetParent(pwnd)) != NULL) - prc = ClientRect(pwnd); + if ((pwnd = DfGetParent(pwnd)) != NULL) + prc = DfClientRect(pwnd); } } return rc; @@ -541,17 +541,17 @@ static DFWINDOW inWindow(DFWINDOW wnd, int x, int y) { DFWINDOW Hit = NULL; while (wnd != NULL) { - if (isVisible(wnd)) { + if (DfIsVisible(wnd)) { DFWINDOW wnd1; DFRECT rc = VisibleRect(wnd); - if (InsideRect(x, y, rc)) + if (DfInsideRect(x, y, rc)) Hit = wnd; - if ((wnd1 = inWindow(LastWindow(wnd), x, y)) != NULL) + if ((wnd1 = inWindow(DfLastWindow(wnd), x, y)) != NULL) Hit = wnd1; if (Hit != NULL) break; } - wnd = PrevWindow(wnd); + wnd = DfPrevWindow(wnd); } return Hit; } @@ -559,21 +559,21 @@ static DFWINDOW inWindow(DFWINDOW wnd, int x, int y) static DFWINDOW MouseWindow(int x, int y) { /* get the window in which a mouse event occurred */ - DFWINDOW Mwnd = inWindow(ApplicationWindow, x, y); + DFWINDOW Mwnd = inWindow(DfApplicationWindow, x, y); /* ---- process mouse captures ----- */ - if (CaptureMouse != NULL) + if (DfCaptureMouse != NULL) { if (NoChildCaptureMouse || Mwnd == NULL || - !isAncestor(Mwnd, CaptureMouse)) - Mwnd = CaptureMouse; + !DfIsAncestor(Mwnd, DfCaptureMouse)) + Mwnd = DfCaptureMouse; } return Mwnd; } -void handshake(void) +void DfHandshake(void) { handshaking++; DfDispatchMessage (); @@ -595,50 +595,50 @@ BOOL DfDispatchMessage (void) struct events ev; ev = EventQueue[EventQueueOffCtr]; - if (++EventQueueOffCtr == MAXMESSAGES) + if (++EventQueueOffCtr == DF_MAXMESSAGES) EventQueueOffCtr = 0; --EventQueueCtr; /* get the window in which a keyboard event occurred */ - Kwnd = inFocus; + Kwnd = DfInFocus; /* process keyboard captures */ - if (CaptureKeyboard != NULL) + if (DfCaptureKeyboard != NULL) { if (Kwnd == NULL || NoChildCaptureKeyboard || - !isAncestor(Kwnd, CaptureKeyboard)) - Kwnd = CaptureKeyboard; + !DfIsAncestor(Kwnd, DfCaptureKeyboard)) + Kwnd = DfCaptureKeyboard; } /* send mouse and keyboard messages to the window that should get them */ switch (ev.event) { - case SHIFT_CHANGED: - case KEYBOARD: + case DFM_SHIFT_CHANGED: + case DFM_KEYBOARD: if (!handshaking) DfSendMessage(Kwnd, ev.event, ev.mx, ev.my); break; - case LEFT_BUTTON: + case DFM_LEFT_BUTTON: if (!handshaking) { Mwnd = MouseWindow(ev.mx, ev.my); - if (!CaptureMouse || + if (!DfCaptureMouse || (!NoChildCaptureMouse && - isAncestor(Mwnd, CaptureMouse))) + DfIsAncestor(Mwnd, DfCaptureMouse))) { - if (Mwnd != inFocus) - DfSendMessage(Mwnd, SETFOCUS, TRUE, 0); - DfSendMessage(Mwnd, LEFT_BUTTON, ev.mx, ev.my); + if (Mwnd != DfInFocus) + DfSendMessage(Mwnd, DFM_SETFOCUS, TRUE, 0); + DfSendMessage(Mwnd, DFM_LEFT_BUTTON, ev.mx, ev.my); } } break; case DFM_BUTTON_RELEASED: case DOUBLE_CLICK: - case RIGHT_BUTTON: + case DFM_RIGHT_BUTTON: if (handshaking) break; @@ -647,7 +647,7 @@ BOOL DfDispatchMessage (void) DfSendMessage(Mwnd, ev.event, ev.mx, ev.my); break; - case CLOCKTICK: + case DFM_CLOCKTICK: DfSendMessage(Cwnd, ev.event, ev.mx, ev.my); break; @@ -663,12 +663,12 @@ BOOL DfDispatchMessage (void) mq = MsgQueue[MsgQueueOffCtr]; - if (++MsgQueueOffCtr == MAXMESSAGES) + if (++MsgQueueOffCtr == DF_MAXMESSAGES) MsgQueueOffCtr = 0; --MsgQueueCtr; DfSendMessage (mq.wnd, mq.msg, mq.p1, mq.p2); - if (mq.msg == ENDDIALOG) + if (mq.msg == DFM_ENDDIALOG) return FALSE; if (mq.msg == DFM_STOP) diff --git a/rosapps/dflat32/msgbox.c b/rosapps/dflat32/msgbox.c index 6d7b8dedc31..6de724c5c2b 100644 --- a/rosapps/dflat32/msgbox.c +++ b/rosapps/dflat32/msgbox.c @@ -2,123 +2,123 @@ #include "dflat.h" -extern DBOX MsgBox; -extern DBOX InputBoxDB; +extern DF_DBOX MsgBox; +extern DF_DBOX InputBoxDB; DFWINDOW CancelWnd; static int ReturnValue; -int MessageBoxProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +int DfMessageBoxProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { switch (msg) { - case CREATE_WINDOW: - GetClass(wnd) = MESSAGEBOX; - InitWindowColors(wnd); - ClearAttribute(wnd, CONTROLBOX); + case DFM_CREATE_WINDOW: + DfGetClass(wnd) = DF_MESSAGEBOX; + DfInitWindowColors(wnd); + DfClearAttribute(wnd, DF_CONTROLBOX); break; - case KEYBOARD: - if (p1 == '\r' || p1 == ESC) + case DFM_KEYBOARD: + if (p1 == '\r' || p1 == DF_ESC) ReturnValue = (int)p1; break; default: break; } - return BaseWndProc(MESSAGEBOX, wnd, msg, p1, p2); + return DfBaseWndProc(DF_MESSAGEBOX, wnd, msg, p1, p2); } -int YesNoBoxProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +int DfYesNoBoxProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { switch (msg) { - case CREATE_WINDOW: - GetClass(wnd) = MESSAGEBOX; - InitWindowColors(wnd); - ClearAttribute(wnd, CONTROLBOX); + case DFM_CREATE_WINDOW: + DfGetClass(wnd) = DF_MESSAGEBOX; + DfInitWindowColors(wnd); + DfClearAttribute(wnd, DF_CONTROLBOX); break; - case KEYBOARD: { + case DFM_KEYBOARD: { int c = tolower((int)p1); if (c == 'y') - DfSendMessage(wnd, DFM_COMMAND, ID_OK, 0); + DfSendMessage(wnd, DFM_COMMAND, DF_ID_OK, 0); else if (c == 'n') - DfSendMessage(wnd, DFM_COMMAND, ID_CANCEL, 0); + DfSendMessage(wnd, DFM_COMMAND, DF_ID_CANCEL, 0); break; } default: break; } - return BaseWndProc(MESSAGEBOX, wnd, msg, p1, p2); + return DfBaseWndProc(DF_MESSAGEBOX, wnd, msg, p1, p2); } -int ErrorBoxProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +int DfErrorBoxProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { switch (msg) { - case CREATE_WINDOW: - GetClass(wnd) = ERRORBOX; - InitWindowColors(wnd); + case DFM_CREATE_WINDOW: + DfGetClass(wnd) = DF_ERRORBOX; + DfInitWindowColors(wnd); break; - case KEYBOARD: - if (p1 == '\r' || p1 == ESC) + case DFM_KEYBOARD: + if (p1 == '\r' || p1 == DF_ESC) ReturnValue = (int)p1; break; default: break; } - return BaseWndProc(ERRORBOX, wnd, msg, p1, p2); + return DfBaseWndProc(DF_ERRORBOX, wnd, msg, p1, p2); } -int CancelBoxProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +int DfCancelBoxProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { switch (msg) { - case CREATE_WINDOW: + case DFM_CREATE_WINDOW: CancelWnd = wnd; - DfSendMessage(wnd, CAPTURE_MOUSE, 0, 0); - DfSendMessage(wnd, CAPTURE_KEYBOARD, 0, 0); + DfSendMessage(wnd, DFM_CAPTURE_MOUSE, 0, 0); + DfSendMessage(wnd, DFM_CAPTURE_KEYBOARD, 0, 0); break; case DFM_COMMAND: - if ((int) p1 == ID_CANCEL && (int) p2 == 0) - DfSendMessage(GetParent(wnd), msg, p1, p2); + if ((int) p1 == DF_ID_CANCEL && (int) p2 == 0) + DfSendMessage(DfGetParent(wnd), msg, p1, p2); return TRUE; - case CLOSE_WINDOW: + case DFM_CLOSE_WINDOW: CancelWnd = NULL; - DfSendMessage(wnd, RELEASE_MOUSE, 0, 0); - DfSendMessage(wnd, RELEASE_KEYBOARD, 0, 0); + DfSendMessage(wnd, DFM_RELEASE_MOUSE, 0, 0); + DfSendMessage(wnd, DFM_RELEASE_KEYBOARD, 0, 0); p1 = TRUE; break; default: break; } - return BaseWndProc(MESSAGEBOX, wnd, msg, p1, p2); + return DfBaseWndProc(DF_MESSAGEBOX, wnd, msg, p1, p2); } -void CloseCancelBox(void) +void DfCloseCancelBox(void) { if (CancelWnd != NULL) - DfSendMessage(CancelWnd, CLOSE_WINDOW, 0, 0); + DfSendMessage(CancelWnd, DFM_CLOSE_WINDOW, 0, 0); } static char *InputText; static int TextLength; -int InputBoxProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +int InputBoxProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { int rtn; switch (msg) { - case CREATE_WINDOW: - rtn = DefaultWndProc(wnd, msg, p1, p2); - DfSendMessage(ControlWindow(&InputBoxDB,ID_INPUTTEXT), - SETTEXTLENGTH, TextLength, 0); + case DFM_CREATE_WINDOW: + rtn = DfDefaultWndProc(wnd, msg, p1, p2); + DfSendMessage(DfControlWindow(&InputBoxDB,DF_ID_INPUTTEXT), + DFM_SETTEXTLENGTH, TextLength, 0); return rtn; case DFM_COMMAND: - if ((int) p1 == ID_OK && (int) p2 == 0) - GetItemText(wnd, ID_INPUTTEXT, + if ((int) p1 == DF_ID_OK && (int) p2 == 0) + DfGetItemText(wnd, DF_ID_INPUTTEXT, InputText, TextLength); break; default: break; } - return DefaultWndProc(wnd, msg, p1, p2); + return DfDefaultWndProc(wnd, msg, p1, p2); } -BOOL InputBox(DFWINDOW wnd,char *ttl,char *msg,char *text,int len) +BOOL DfInputBox(DFWINDOW wnd,char *ttl,char *msg,char *text,int len) { InputText = text; TextLength = len; @@ -131,23 +131,23 @@ BOOL InputBox(DFWINDOW wnd,char *ttl,char *msg,char *text,int len) InputBoxDB.ctl[1].dwnd.w = len; InputBoxDB.ctl[2].dwnd.x = (InputBoxDB.dwnd.w - 20) / 2; InputBoxDB.ctl[3].dwnd.x = InputBoxDB.ctl[2].dwnd.x + 10; - InputBoxDB.ctl[2].isetting = ON; - InputBoxDB.ctl[3].isetting = ON; + InputBoxDB.ctl[2].isetting = DF_ON; + InputBoxDB.ctl[3].isetting = DF_ON; return DfDialogBox(wnd, &InputBoxDB, TRUE, InputBoxProc); } -BOOL GenericMessage(DFWINDOW wnd,char *ttl,char *msg,int buttonct, - int (*wndproc)(struct window *,enum messages,PARAM,PARAM), +BOOL DfGenericMessage(DFWINDOW wnd,char *ttl,char *msg,int buttonct, + int (*wndproc)(struct DfWindow *,enum DfMessages,DF_PARAM,DF_PARAM), char *b1, char *b2, int c1, int c2, int isModal) { BOOL rtn; MsgBox.dwnd.title = ttl; - MsgBox.ctl[0].dwnd.h = MsgHeight(msg); + MsgBox.ctl[0].dwnd.h = DfMsgHeight(msg); if (ttl) - MsgBox.ctl[0].dwnd.w = max(max(MsgWidth(msg), + MsgBox.ctl[0].dwnd.w = max(max(DfMsgWidth(msg), (int)(buttonct*8 + buttonct + 2)), (int)strlen(ttl)+2); else - MsgBox.ctl[0].dwnd.w = max(MsgWidth(msg), (int)(buttonct*8 + buttonct + 2)); + MsgBox.ctl[0].dwnd.w = max(DfMsgWidth(msg), (int)(buttonct*8 + buttonct + 2)); MsgBox.dwnd.h = MsgBox.ctl[0].dwnd.h+6; MsgBox.dwnd.w = MsgBox.ctl[0].dwnd.w+4; if (buttonct == 1) @@ -155,7 +155,7 @@ BOOL GenericMessage(DFWINDOW wnd,char *ttl,char *msg,int buttonct, else { MsgBox.ctl[1].dwnd.x = (MsgBox.dwnd.w - 20) / 2; MsgBox.ctl[2].dwnd.x = MsgBox.ctl[1].dwnd.x + 10; - MsgBox.ctl[2].class = BUTTON; + MsgBox.ctl[2].class = DF_BUTTON; } MsgBox.ctl[1].dwnd.y = MsgBox.dwnd.h - 4; MsgBox.ctl[2].dwnd.y = MsgBox.dwnd.h - 4; @@ -164,29 +164,29 @@ BOOL GenericMessage(DFWINDOW wnd,char *ttl,char *msg,int buttonct, MsgBox.ctl[2].itext = b2; MsgBox.ctl[1].command = c1; MsgBox.ctl[2].command = c2; - MsgBox.ctl[1].isetting = ON; - MsgBox.ctl[2].isetting = ON; + MsgBox.ctl[1].isetting = DF_ON; + MsgBox.ctl[2].isetting = DF_ON; rtn = DfDialogBox(wnd, &MsgBox, isModal, wndproc); MsgBox.ctl[2].class = 0; return rtn; } -DFWINDOW MomentaryMessage(char *msg) +DFWINDOW DfMomentaryMessage(char *msg) { - DFWINDOW wnd = DfCreateWindow( - TEXTBOX, + DFWINDOW wnd = DfDfCreateWindow( + DF_TEXTBOX, NULL, - -1,-1,MsgHeight(msg)+2,MsgWidth(msg)+2, + -1,-1,DfMsgHeight(msg)+2,DfMsgWidth(msg)+2, NULL,NULL,NULL, - HASBORDER | SHADOW | SAVESELF); - DfSendMessage(wnd, SETTEXT, (PARAM) msg, 0); - WindowClientColor(wnd, WHITE, GREEN); - WindowFrameColor(wnd, WHITE, GREEN); - DfSendMessage (wnd, SHOW_WINDOW, 0, 0); + DF_HASBORDER | DF_SHADOW | DF_SAVESELF); + DfSendMessage(wnd, DFM_SETTEXT, (DF_PARAM) msg, 0); + DfWindowClientColor(wnd, WHITE, GREEN); + DfWindowFrameColor(wnd, WHITE, GREEN); + DfSendMessage (wnd, DFM_SHOW_WINDOW, 0, 0); return wnd; } -int MsgHeight(char *msg) +int DfMsgHeight(char *msg) { int h = 1; @@ -199,7 +199,7 @@ int MsgHeight(char *msg) return min(h, DfGetScreenHeight ()-10); } -int MsgWidth(char *msg) +int DfMsgWidth(char *msg) { int w = 0; char *cp = msg; diff --git a/rosapps/dflat32/normal.c b/rosapps/dflat32/normal.c index 32740ba48b1..aeba2c36a68 100644 --- a/rosapps/dflat32/normal.c +++ b/rosapps/dflat32/normal.c @@ -20,48 +20,48 @@ static void dragborder(DFWINDOW, int, int); static void sizeborder(DFWINDOW, int, int); static int px = -1, py = -1; static int diff; -static struct window dwnd = {DUMMY, NULL, NormalProc, +static struct DfWindow dwnd = {DF_DUMMY, NULL, DfNormalProc, {-1,-1,-1,-1}}; static PCHAR_INFO Bsave; static int Bht, Bwd; -BOOL WindowMoving; -BOOL WindowSizing; +BOOL DfWindowMoving; +BOOL DfWindowSizing; /* -------- array of class definitions -------- */ -CLASSDEFS classdefs[] = { - #undef ClassDef - #define ClassDef(c,b,p,a) {b,p,a}, +DFCLASSDEFS DfClassDefs[] = { + #undef DfClassDef + #define DfClassDef(c,b,p,a) {b,p,a}, #include "classes.h" }; DFWINDOW HiddenWindow; -/* --------- CREATE_WINDOW Message ---------- */ +/* --------- DFM_CREATE_WINDOW Message ---------- */ static void CreateWindowMsg(DFWINDOW wnd) { - AppendWindow(wnd); -// ClearAttribute(wnd, VSCROLLBAR | HSCROLLBAR); - if (TestAttribute(wnd, SAVESELF) && isVisible(wnd)) + DfAppendWindow(wnd); +// DfClearAttribute(wnd, DF_VSCROLLBAR | DF_HSCROLLBAR); + if (DfTestAttribute(wnd, DF_SAVESELF) && DfIsVisible(wnd)) GetVideoBuffer(wnd); } -/* --------- SHOW_WINDOW Message ---------- */ -static void ShowWindowMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* --------- DFM_SHOW_WINDOW Message ---------- */ +static void ShowWindowMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - if (GetParent(wnd) == NULL || isVisible(GetParent(wnd))) + if (DfGetParent(wnd) == NULL || DfIsVisible(DfGetParent(wnd))) { DFWINDOW cwnd; - if (TestAttribute(wnd, SAVESELF) && wnd->videosave == NULL) + if (DfTestAttribute(wnd, DF_SAVESELF) && wnd->videosave == NULL) GetVideoBuffer(wnd); - SetVisible(wnd); - DfSendMessage(wnd, PAINT, 0, TRUE); - DfSendMessage(wnd, BORDER, 0, 0); + DfSetVisible(wnd); + DfSendMessage(wnd, DFM_PAINT, 0, TRUE); + DfSendMessage(wnd, DFM_BORDER, 0, 0); /* --- show the children of this window --- */ - cwnd = FirstWindow(wnd); + cwnd = DfFirstWindow(wnd); while (cwnd != NULL) { - if (cwnd->condition != ISCLOSING) - DfSendMessage(cwnd, SHOW_WINDOW, p1, p2); - cwnd = NextWindow(cwnd); + if (cwnd->condition != DF_ISCLOSING) + DfSendMessage(cwnd, DFM_SHOW_WINDOW, p1, p2); + cwnd = DfNextWindow(cwnd); } } } @@ -69,11 +69,11 @@ static void ShowWindowMsg(DFWINDOW wnd, PARAM p1, PARAM p2) /* --------- HIDE_WINDOW Message ---------- */ static void HideWindowMsg(DFWINDOW wnd) { - if (isVisible(wnd)) + if (DfIsVisible(wnd)) { - ClearVisible(wnd); + DfClearVisible(wnd); /* --- paint what this window covered --- */ - if (TestAttribute(wnd, SAVESELF)) + if (DfTestAttribute(wnd, DF_SAVESELF)) PutVideoBuffer(wnd); #ifdef INCLUDE_MULTI_WINDOWS else @@ -82,31 +82,31 @@ static void HideWindowMsg(DFWINDOW wnd) } } -/* --------- KEYBOARD Message ---------- */ -static BOOL KeyboardMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* --------- DFM_KEYBOARD Message ---------- */ +static BOOL KeyboardMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - if (WindowMoving || WindowSizing) { + if (DfWindowMoving || DfWindowSizing) { /* -- move or size a window with keyboard -- */ int x, y; - x=WindowMoving?GetLeft(&dwnd):GetRight(&dwnd); - y=WindowMoving?GetTop(&dwnd):GetBottom(&dwnd); + x=DfWindowMoving?DfGetLeft(&dwnd):DfGetRight(&dwnd); + y=DfWindowMoving?DfGetTop(&dwnd):DfGetBottom(&dwnd); switch ((int)p1) { - case ESC: + case DF_ESC: TerminateMoveSize(); return TRUE; - case UP: + case DF_UP: if (y) --y; break; - case DN: + case DF_DN: if (y < DfGetScreenHeight()-1) y++; break; - case FWD: + case DF_FWD: if (x < DfGetScreenWidth()-1) x++; break; - case BS: + case DF_BS: if (x) --x; break; @@ -122,22 +122,22 @@ static BOOL KeyboardMsg(DFWINDOW wnd, PARAM p1, PARAM p2) switch ((int)p1) { - case F1: - DfSendMessage(wnd, DFM_COMMAND, ID_HELP, 0); + case DF_F1: + DfSendMessage(wnd, DFM_COMMAND, DF_ID_HELP, 0); return TRUE; case ' ': - if ((int)p2 & ALTKEY) - if (TestAttribute(wnd, HASTITLEBAR)) - if (TestAttribute(wnd, CONTROLBOX)) - BuildSystemMenu(wnd); + if ((int)p2 & DF_ALTKEY) + if (DfTestAttribute(wnd, DF_HASTITLEBAR)) + if (DfTestAttribute(wnd, DF_CONTROLBOX)) + DfBuildSystemMenu(wnd); return TRUE; - case CTRL_F4: - if (TestAttribute(wnd, CONTROLBOX)) + case DF_CTRL_F4: + if (DfTestAttribute(wnd, DF_CONTROLBOX)) { - DfSendMessage(wnd, CLOSE_WINDOW, 0, 0); - SkipApplicationControls(); + DfSendMessage(wnd, DFM_CLOSE_WINDOW, 0, 0); + DfSkipApplicationControls(); return TRUE; } break; @@ -150,69 +150,69 @@ static BOOL KeyboardMsg(DFWINDOW wnd, PARAM p1, PARAM p2) } /* --------- COMMAND Message ---------- */ -static void CommandMsg(DFWINDOW wnd, PARAM p1) +static void CommandMsg(DFWINDOW wnd, DF_PARAM p1) { switch ((int)p1) { - case ID_HELP: - DisplayHelp(wnd,ClassNames[GetClass(wnd)]); + case DF_ID_HELP: + DfDisplayHelp(wnd,DfClassNames[DfGetClass(wnd)]); break; #ifdef INCLUDE_RESTORE - case ID_SYSRESTORE: - DfSendMessage(wnd, RESTORE, 0, 0); + case DF_ID_SYSRESTORE: + DfSendMessage(wnd, DFM_RESTORE, 0, 0); break; #endif - case ID_SYSMOVE: - DfSendMessage(wnd, CAPTURE_MOUSE, TRUE, - (PARAM) &dwnd); - DfSendMessage(wnd, CAPTURE_KEYBOARD, TRUE, - (PARAM) &dwnd); - WindowMoving = TRUE; - dragborder(wnd, GetLeft(wnd), GetTop(wnd)); + case DF_ID_SYSMOVE: + DfSendMessage(wnd, DFM_CAPTURE_MOUSE, TRUE, + (DF_PARAM) &dwnd); + DfSendMessage(wnd, DFM_CAPTURE_KEYBOARD, TRUE, + (DF_PARAM) &dwnd); + DfWindowMoving = TRUE; + dragborder(wnd, DfGetLeft(wnd), DfGetTop(wnd)); break; - case ID_SYSSIZE: - DfSendMessage(wnd, CAPTURE_MOUSE, TRUE, - (PARAM) &dwnd); - DfSendMessage(wnd, CAPTURE_KEYBOARD, TRUE, - (PARAM) &dwnd); - WindowSizing = TRUE; - dragborder(wnd, GetLeft(wnd), GetTop(wnd)); + case DF_ID_SYSSIZE: + DfSendMessage(wnd, DFM_CAPTURE_MOUSE, TRUE, + (DF_PARAM) &dwnd); + DfSendMessage(wnd, DFM_CAPTURE_KEYBOARD, TRUE, + (DF_PARAM) &dwnd); + DfWindowSizing = TRUE; + dragborder(wnd, DfGetLeft(wnd), DfGetTop(wnd)); break; #ifdef INCLUDE_MINIMIZE - case ID_SYSMINIMIZE: - DfSendMessage(wnd, MINIMIZE, 0, 0); + case DF_ID_SYSMINIMIZE: + DfSendMessage(wnd, DFM_MINIMIZE, 0, 0); break; #endif #ifdef INCLUDE_MAXIMIZE - case ID_SYSMAXIMIZE: - DfSendMessage(wnd, MAXIMIZE, 0, 0); + case DF_ID_SYSMAXIMIZE: + DfSendMessage(wnd, DFM_MAXIMIZE, 0, 0); break; #endif - case ID_SYSCLOSE: - DfSendMessage(wnd, CLOSE_WINDOW, 0, 0); - SkipApplicationControls(); + case DF_ID_SYSCLOSE: + DfSendMessage(wnd, DFM_CLOSE_WINDOW, 0, 0); + DfSkipApplicationControls(); break; default: break; } } -/* --------- SETFOCUS Message ---------- */ -static void SetFocusMsg(DFWINDOW wnd, PARAM p1) +/* --------- DFM_SETFOCUS Message ---------- */ +static void SetFocusMsg(DFWINDOW wnd, DF_PARAM p1) { DFRECT rc = {0,0,0,0}; - if (p1 && wnd != NULL && inFocus != wnd) + if (p1 && wnd != NULL && DfInFocus != wnd) { DFWINDOW this, thispar; DFWINDOW that = NULL, thatpar = NULL; - DFWINDOW cwnd = wnd, fwnd = GetParent(wnd); + DFWINDOW cwnd = wnd, fwnd = DfGetParent(wnd); /* ---- post focus in ancestors ---- */ while (fwnd != NULL) { fwnd->childfocus = cwnd; cwnd = fwnd; - fwnd = GetParent(fwnd); + fwnd = DfGetParent(fwnd); } /* ---- de-post focus in self and children ---- */ fwnd = wnd; @@ -224,7 +224,7 @@ static void SetFocusMsg(DFWINDOW wnd, PARAM p1) } this = wnd; - that = thatpar = inFocus; + that = thatpar = DfInFocus; /* ---- find common ancestor of prev focus and this window --- */ while (thatpar != NULL) @@ -232,7 +232,7 @@ static void SetFocusMsg(DFWINDOW wnd, PARAM p1) thispar = wnd; while (thispar != NULL) { - if (this == CaptureMouse || this == CaptureKeyboard) + if (this == DfCaptureMouse || this == DfCaptureKeyboard) { /* ---- don't repaint if this window has capture ---- */ that = thatpar = NULL; @@ -240,166 +240,166 @@ static void SetFocusMsg(DFWINDOW wnd, PARAM p1) } if (thispar == thatpar) { - /* ---- don't repaint if SAVESELF window had focus ---- */ - if (this != that && TestAttribute(that, SAVESELF)) + /* ---- don't repaint if DF_SAVESELF window had focus ---- */ + if (this != that && DfTestAttribute(that, DF_SAVESELF)) that = thatpar = NULL; break; } this = thispar; - thispar = GetParent(thispar); + thispar = DfGetParent(thispar); } if (thispar != NULL) break; that = thatpar; - thatpar = GetParent(thatpar); + thatpar = DfGetParent(thatpar); } - if (inFocus != NULL) - DfSendMessage(inFocus, SETFOCUS, FALSE, 0); - inFocus = wnd; - if (that != NULL && isVisible(wnd)) + if (DfInFocus != NULL) + DfSendMessage(DfInFocus, DFM_SETFOCUS, FALSE, 0); + DfInFocus = wnd; + if (that != NULL && DfIsVisible(wnd)) { - rc = subRectangle(WindowRect(that), WindowRect(this)); - if (!ValidRect(rc)) + rc = DfSubRectangle(DfWindowRect(that), DfWindowRect(this)); + if (!DfValidRect(rc)) { - if (ApplicationWindow != NULL) + if (DfApplicationWindow != NULL) { - DFWINDOW fwnd = FirstWindow(ApplicationWindow); + DFWINDOW fwnd = DfFirstWindow(DfApplicationWindow); while (fwnd != NULL) { - if (!isAncestor(wnd, fwnd)) + if (!DfIsAncestor(wnd, fwnd)) { - rc = subRectangle(WindowRect(wnd),WindowRect(fwnd)); - if (ValidRect(rc)) + rc = DfSubRectangle(DfWindowRect(wnd),DfWindowRect(fwnd)); + if (DfValidRect(rc)) break; } - fwnd = NextWindow(fwnd); + fwnd = DfNextWindow(fwnd); } } } } - if (that != NULL && !ValidRect(rc) && isVisible(wnd)) + if (that != NULL && !DfValidRect(rc) && DfIsVisible(wnd)) { - DfSendMessage(wnd, BORDER, 0, 0); + DfSendMessage(wnd, DFM_BORDER, 0, 0); this = NULL; } - ReFocus(wnd); + DfReFocus(wnd); if (this != NULL) - DfSendMessage(this, SHOW_WINDOW, 0, 0); + DfSendMessage(this, DFM_SHOW_WINDOW, 0, 0); } - else if (!p1 && inFocus == wnd) + else if (!p1 && DfInFocus == wnd) { /* clearing focus */ - inFocus = NULL; - DfSendMessage(wnd, BORDER, 0, 0); + DfInFocus = NULL; + DfSendMessage(wnd, DFM_BORDER, 0, 0); } } /* --------- DOUBLE_CLICK Message ---------- */ -static void DoubleClickMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +static void DoubleClickMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - int mx = (int) p1 - GetLeft(wnd); - int my = (int) p2 - GetTop(wnd); - if (!WindowSizing && !WindowMoving) { - if (HitControlBox(wnd, mx, my)) { - DfPostMessage(wnd, CLOSE_WINDOW, 0, 0); - SkipApplicationControls(); + int mx = (int) p1 - DfGetLeft(wnd); + int my = (int) p2 - DfGetTop(wnd); + if (!DfWindowSizing && !DfWindowMoving) { + if (DfHitControlBox(wnd, mx, my)) { + DfPostMessage(wnd, DFM_CLOSE_WINDOW, 0, 0); + DfSkipApplicationControls(); } } } -/* --------- LEFT_BUTTON Message ---------- */ -static void LeftButtonMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* --------- DFM_LEFT_BUTTON Message ---------- */ +static void LeftButtonMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - int mx = (int) p1 - GetLeft(wnd); - int my = (int) p2 - GetTop(wnd); - if (WindowSizing || WindowMoving) + int mx = (int) p1 - DfGetLeft(wnd); + int my = (int) p2 - DfGetTop(wnd); + if (DfWindowSizing || DfWindowMoving) return; - if (HitControlBox(wnd, mx, my)) { - BuildSystemMenu(wnd); + if (DfHitControlBox(wnd, mx, my)) { + DfBuildSystemMenu(wnd); return; } - if (my == 0 && mx > -1 && mx < WindowWidth(wnd)) { + if (my == 0 && mx > -1 && mx < DfWindowWidth(wnd)) { /* ---------- hit the top border -------- */ - if (TestAttribute(wnd, MINMAXBOX) && - TestAttribute(wnd, HASTITLEBAR)) { - if (mx == WindowWidth(wnd)-2) { - if (wnd->condition != ISRESTORED) + if (DfTestAttribute(wnd, DF_MINMAXBOX) && + DfTestAttribute(wnd, DF_HASTITLEBAR)) { + if (mx == DfWindowWidth(wnd)-2) { + if (wnd->condition != DF_SRESTORED) /* --- hit the restore box --- */ - DfSendMessage(wnd, RESTORE, 0, 0); + DfSendMessage(wnd, DFM_RESTORE, 0, 0); #ifdef INCLUDE_MAXIMIZE else /* --- hit the maximize box --- */ - DfSendMessage(wnd, MAXIMIZE, 0, 0); + DfSendMessage(wnd, DFM_MAXIMIZE, 0, 0); #endif return; } #ifdef INCLUDE_MINIMIZE - if (mx == WindowWidth(wnd)-3) { + if (mx == DfWindowWidth(wnd)-3) { /* --- hit the minimize box --- */ - if (wnd->condition != ISMINIMIZED) - DfSendMessage(wnd, MINIMIZE, 0, 0); + if (wnd->condition != DF_ISMINIMIZED) + DfSendMessage(wnd, DFM_MINIMIZE, 0, 0); return; } #endif } #ifdef INCLUDE_MAXIMIZE - if (wnd->condition == ISMAXIMIZED) + if (wnd->condition == DF_ISMAXIMIZED) return; #endif - if (TestAttribute(wnd, MOVEABLE)) { - WindowMoving = TRUE; + if (DfTestAttribute(wnd, DF_MOVEABLE)) { + DfWindowMoving = TRUE; px = mx; py = my; diff = (int) mx; - DfSendMessage(wnd, CAPTURE_MOUSE, TRUE, - (PARAM) &dwnd); - dragborder(wnd, GetLeft(wnd), GetTop(wnd)); + DfSendMessage(wnd, DFM_CAPTURE_MOUSE, TRUE, + (DF_PARAM) &dwnd); + dragborder(wnd, DfGetLeft(wnd), DfGetTop(wnd)); } return; } - if (mx == WindowWidth(wnd)-1 && - my == WindowHeight(wnd)-1) { + if (mx == DfWindowWidth(wnd)-1 && + my == DfWindowHeight(wnd)-1) { /* ------- hit the resize corner ------- */ #ifdef INCLUDE_MINIMIZE - if (wnd->condition == ISMINIMIZED) + if (wnd->condition == DF_ISMINIMIZED) return; #endif - if (!TestAttribute(wnd, SIZEABLE)) + if (!DfTestAttribute(wnd, DF_SIZEABLE)) return; #ifdef INCLUDE_MAXIMIZE - if (wnd->condition == ISMAXIMIZED) { - if (GetParent(wnd) == NULL) + if (wnd->condition == DF_ISMAXIMIZED) { + if (DfGetParent(wnd) == NULL) return; - if (TestAttribute(GetParent(wnd),HASBORDER)) + if (DfTestAttribute(DfGetParent(wnd),DF_HASBORDER)) return; /* ----- resizing a maximized window over a borderless parent ----- */ - wnd = GetParent(wnd); + wnd = DfGetParent(wnd); } #endif - WindowSizing = TRUE; - DfSendMessage(wnd, CAPTURE_MOUSE, - TRUE, (PARAM) &dwnd); - dragborder(wnd, GetLeft(wnd), GetTop(wnd)); + DfWindowSizing = TRUE; + DfSendMessage(wnd, DFM_CAPTURE_MOUSE, + TRUE, (DF_PARAM) &dwnd); + dragborder(wnd, DfGetLeft(wnd), DfGetTop(wnd)); } } /* --------- MOUSE_MOVED Message ---------- */ -static BOOL MouseMovedMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +static BOOL MouseMovedMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - if (WindowMoving) { + if (DfWindowMoving) { int leftmost = 0, topmost = 0, bottommost = DfGetScreenHeight()-2, rightmost = DfGetScreenWidth()-2; int x = (int) p1 - diff; int y = (int) p2; - if (GetParent(wnd) != NULL && - !TestAttribute(wnd, NOCLIP)) { - DFWINDOW wnd1 = GetParent(wnd); - topmost = GetClientTop(wnd1); - leftmost = GetClientLeft(wnd1); - bottommost = GetClientBottom(wnd1); - rightmost = GetClientRight(wnd1); + if (DfGetParent(wnd) != NULL && + !DfTestAttribute(wnd, DF_NOCLIP)) { + DFWINDOW wnd1 = DfGetParent(wnd); + topmost = DfGetClientTop(wnd1); + leftmost = DfGetClientLeft(wnd1); + bottommost = DfGetClientBottom(wnd1); + rightmost = DfGetClientRight(wnd1); } if (x < leftmost || x > rightmost || y < topmost || y > bottommost) { @@ -416,7 +416,7 @@ static BOOL MouseMovedMsg(DFWINDOW wnd, PARAM p1, PARAM p2) } return TRUE; } - if (WindowSizing) { + if (DfWindowSizing) { sizeborder(wnd, (int) p1, (int) p2); return TRUE; } @@ -424,7 +424,7 @@ static BOOL MouseMovedMsg(DFWINDOW wnd, PARAM p1, PARAM p2) } #ifdef INCLUDE_MAXIMIZE -/* --------- MAXIMIZE Message ---------- */ +/* --------- DFM_MAXIMIZE Message ---------- */ static void MaximizeMsg(DFWINDOW wnd) { DFRECT rc = {0, 0, 0, 0}; @@ -432,25 +432,25 @@ static void MaximizeMsg(DFWINDOW wnd) holdrc = wnd->RestoredRC; rc.rt = DfGetScreenWidth()-1; rc.bt = DfGetScreenHeight()-1; - if (GetParent(wnd)) - rc = ClientRect(GetParent(wnd)); + if (DfGetParent(wnd)) + rc = DfClientRect(DfGetParent(wnd)); wnd->oldcondition = wnd->condition; - wnd->condition = ISMAXIMIZED; + wnd->condition = DF_ISMAXIMIZED; DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0); - DfSendMessage(wnd, MOVE, - RectLeft(rc), RectTop(rc)); - DfSendMessage(wnd, DFM_SIZE, - RectRight(rc), RectBottom(rc)); + DfSendMessage(wnd, DFM_MOVE, + DfRectLeft(rc), DfRectTop(rc)); + DfSendMessage(wnd, DFM_DFM_SIZE, + DfRectRight(rc), DfRectBottom(rc)); if (wnd->restored_attrib == 0) wnd->restored_attrib = wnd->attrib; - ClearAttribute(wnd, SHADOW); - DfSendMessage(wnd, SHOW_WINDOW, 0, 0); + DfClearAttribute(wnd, DF_SHADOW); + DfSendMessage(wnd, DFM_SHOW_WINDOW, 0, 0); wnd->RestoredRC = holdrc; } #endif #ifdef INCLUDE_MINIMIZE -/* --------- MINIMIZE Message ---------- */ +/* --------- DFM_MINIMIZE Message ---------- */ static void MinimizeMsg(DFWINDOW wnd) { DFRECT rc; @@ -459,52 +459,52 @@ static void MinimizeMsg(DFWINDOW wnd) holdrc = wnd->RestoredRC; rc = PositionIcon(wnd); wnd->oldcondition = wnd->condition; - wnd->condition = ISMINIMIZED; + wnd->condition = DF_ISMINIMIZED; DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0); - DfSendMessage(wnd, MOVE, - RectLeft(rc), RectTop(rc)); - DfSendMessage(wnd, DFM_SIZE, - RectRight(rc), RectBottom(rc)); - if (wnd == inFocus) - SetNextFocus(); + DfSendMessage(wnd, DFM_MOVE, + DfRectLeft(rc), DfRectTop(rc)); + DfSendMessage(wnd, DFM_DFM_SIZE, + DfRectRight(rc), DfRectBottom(rc)); + if (wnd == DfInFocus) + DfSetNextFocus(); if (wnd->restored_attrib == 0) wnd->restored_attrib = wnd->attrib; - ClearAttribute(wnd, - SHADOW | SIZEABLE | HASMENUBAR | - VSCROLLBAR | HSCROLLBAR); - DfSendMessage(wnd, SHOW_WINDOW, 0, 0); + DfClearAttribute(wnd, + DF_SHADOW | DF_SIZEABLE | DF_HASMENUBAR | + DF_VSCROLLBAR | DF_HSCROLLBAR); + DfSendMessage(wnd, DFM_SHOW_WINDOW, 0, 0); wnd->RestoredRC = holdrc; } #endif #ifdef INCLUDE_RESTORE -/* --------- RESTORE Message ---------- */ +/* --------- DFM_RESTORE Message ---------- */ static void RestoreMsg(DFWINDOW wnd) { DFRECT holdrc; holdrc = wnd->RestoredRC; wnd->oldcondition = wnd->condition; - wnd->condition = ISRESTORED; + wnd->condition = DF_SRESTORED; DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0); wnd->attrib = wnd->restored_attrib; wnd->restored_attrib = 0; - DfSendMessage(wnd, MOVE, wnd->RestoredRC.lf, + DfSendMessage(wnd, DFM_MOVE, wnd->RestoredRC.lf, wnd->RestoredRC.tp); wnd->RestoredRC = holdrc; - DfSendMessage(wnd, DFM_SIZE, wnd->RestoredRC.rt, + DfSendMessage(wnd, DFM_DFM_SIZE, wnd->RestoredRC.rt, wnd->RestoredRC.bt); - if (wnd != inFocus) - DfSendMessage(wnd, SETFOCUS, TRUE, 0); + if (wnd != DfInFocus) + DfSendMessage(wnd, DFM_SETFOCUS, TRUE, 0); else - DfSendMessage(wnd, SHOW_WINDOW, 0, 0); + DfSendMessage(wnd, DFM_SHOW_WINDOW, 0, 0); } #endif -/* --------- MOVE Message ---------- */ -static void MoveMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* --------- DFM_MOVE Message ---------- */ +static void MoveMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { DFWINDOW cwnd; - BOOL wasVisible = isVisible(wnd); + BOOL wasVisible = DfIsVisible(wnd); int xdif = (int) p1 - wnd->rc.lf; int ydif = (int) p2 - wnd->rc.tp; @@ -514,24 +514,24 @@ static void MoveMsg(DFWINDOW wnd, PARAM p1, PARAM p2) DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0); wnd->rc.lf = (int) p1; wnd->rc.tp = (int) p2; - wnd->rc.rt = GetLeft(wnd)+WindowWidth(wnd)-1; - wnd->rc.bt = GetTop(wnd)+WindowHeight(wnd)-1; - if (wnd->condition == ISRESTORED) + wnd->rc.rt = DfGetLeft(wnd)+DfWindowWidth(wnd)-1; + wnd->rc.bt = DfGetTop(wnd)+DfWindowHeight(wnd)-1; + if (wnd->condition == DF_SRESTORED) wnd->RestoredRC = wnd->rc; - cwnd = FirstWindow(wnd); + cwnd = DfFirstWindow(wnd); while (cwnd != NULL) { - DfSendMessage(cwnd, MOVE, cwnd->rc.lf+xdif, cwnd->rc.tp+ydif); - cwnd = NextWindow(cwnd); + DfSendMessage(cwnd, DFM_MOVE, cwnd->rc.lf+xdif, cwnd->rc.tp+ydif); + cwnd = DfNextWindow(cwnd); } if (wasVisible) - DfSendMessage(wnd, SHOW_WINDOW, 0, 0); + DfSendMessage(wnd, DFM_SHOW_WINDOW, 0, 0); } /* --------- SIZE Message ---------- */ -static void SizeMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +static void SizeMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - BOOL wasVisible = isVisible(wnd); + BOOL wasVisible = DfIsVisible(wnd); DFWINDOW cwnd; DFRECT rc; int xdif = (int) p1 - wnd->rc.rt; @@ -543,113 +543,113 @@ static void SizeMsg(DFWINDOW wnd, PARAM p1, PARAM p2) DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0); wnd->rc.rt = (int) p1; wnd->rc.bt = (int) p2; - wnd->ht = GetBottom(wnd)-GetTop(wnd)+1; - wnd->wd = GetRight(wnd)-GetLeft(wnd)+1; + wnd->ht = DfGetBottom(wnd)-DfGetTop(wnd)+1; + wnd->wd = DfGetRight(wnd)-DfGetLeft(wnd)+1; - if (wnd->condition == ISRESTORED) - wnd->RestoredRC = WindowRect(wnd); + if (wnd->condition == DF_SRESTORED) + wnd->RestoredRC = DfWindowRect(wnd); #ifdef INCLUDE_MAXIMIZE - rc = ClientRect(wnd); + rc = DfClientRect(wnd); - cwnd = FirstWindow(wnd); + cwnd = DfFirstWindow(wnd); while (cwnd != NULL) { - if (cwnd->condition == ISMAXIMIZED) - DfSendMessage(cwnd, DFM_SIZE, RectRight(rc), RectBottom(rc)); - cwnd = NextWindow(cwnd); + if (cwnd->condition == DF_ISMAXIMIZED) + DfSendMessage(cwnd, DFM_DFM_SIZE, DfRectRight(rc), DfRectBottom(rc)); + cwnd = DfNextWindow(cwnd); } #endif if (wasVisible) - DfSendMessage(wnd, SHOW_WINDOW, 0, 0); + DfSendMessage(wnd, DFM_SHOW_WINDOW, 0, 0); } -/* --------- CLOSE_WINDOW Message ---------- */ +/* --------- DFM_CLOSE_WINDOW Message ---------- */ static void CloseWindowMsg(DFWINDOW wnd) { DFWINDOW cwnd; - wnd->condition = ISCLOSING; + wnd->condition = DF_ISCLOSING; if (wnd->PrevMouse != NULL) - DfSendMessage(wnd, RELEASE_MOUSE, 0, 0); + DfSendMessage(wnd, DFM_RELEASE_MOUSE, 0, 0); if (wnd->PrevKeyboard != NULL) - DfSendMessage(wnd, RELEASE_KEYBOARD, 0, 0); + DfSendMessage(wnd, DFM_RELEASE_KEYBOARD, 0, 0); /* ----------- hide this window ------------ */ DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0); /* --- close the children of this window --- */ - cwnd = LastWindow(wnd); + cwnd = DfLastWindow(wnd); while (cwnd != NULL) { - if (inFocus == cwnd) - inFocus = wnd; - DfSendMessage(cwnd,CLOSE_WINDOW,0,0); - cwnd = LastWindow(wnd); + if (DfInFocus == cwnd) + DfInFocus = wnd; + DfSendMessage(cwnd,DFM_CLOSE_WINDOW,0,0); + cwnd = DfLastWindow(wnd); } /* --- change focus if this window had it -- */ - if (wnd == inFocus) - SetPrevFocus(); + if (wnd == DfInFocus) + DfSetPrevFocus(); /* -- free memory allocated to this window - */ if (wnd->title != NULL) free(wnd->title); if (wnd->videosave != NULL) free(wnd->videosave); /* -- remove window from parent's list of children -- */ - RemoveWindow(wnd); - if (wnd == inFocus) - inFocus = NULL; + DfRemoveWindow(wnd); + if (wnd == DfInFocus) + DfInFocus = NULL; free(wnd); } -/* ---- Window-processing module for NORMAL window class ---- */ -int NormalProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +/* ---- Window-processing module for DF_NORMAL window class ---- */ +int DfNormalProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { switch (msg) { - case CREATE_WINDOW: + case DFM_CREATE_WINDOW: CreateWindowMsg(wnd); break; - case SHOW_WINDOW: + case DFM_SHOW_WINDOW: ShowWindowMsg(wnd, p1, p2); break; case DFM_HIDE_WINDOW: HideWindowMsg(wnd); break; - case DISPLAY_HELP: - DisplayHelp(wnd, (char *)p1); + case DFM_DISPLAY_HELP: + DfDisplayHelp(wnd, (char *)p1); break; - case INSIDE_WINDOW: + case DFM_INSIDE_WINDOW: return InsideWindow(wnd, (int) p1, (int) p2); - case KEYBOARD: + case DFM_KEYBOARD: if (KeyboardMsg(wnd, p1, p2)) return TRUE; /* ------- fall through ------- */ - case ADDSTATUS: - case SHIFT_CHANGED: - if (GetParent(wnd) != NULL) - DfPostMessage(GetParent(wnd), msg, p1, p2); + case DFM_ADDSTATUS: + case DFM_SHIFT_CHANGED: + if (DfGetParent(wnd) != NULL) + DfPostMessage(DfGetParent(wnd), msg, p1, p2); break; - case PAINT: - if (isVisible(wnd)) - ClearWindow(wnd, (DFRECT *)p1, ' '); + case DFM_PAINT: + if (DfIsVisible(wnd)) + DfClearWindow(wnd, (DFRECT *)p1, ' '); break; - case BORDER: - if (isVisible(wnd)) + case DFM_BORDER: + if (DfIsVisible(wnd)) { - if (TestAttribute(wnd, HASBORDER)) - RepaintBorder(wnd, (DFRECT *)p1); - else if (TestAttribute(wnd, HASTITLEBAR)) - DisplayTitle(wnd, (DFRECT *)p1); + if (DfTestAttribute(wnd, DF_HASBORDER)) + DfRepaintBorder(wnd, (DFRECT *)p1); + else if (DfTestAttribute(wnd, DF_HASTITLEBAR)) + DfDisplayTitle(wnd, (DFRECT *)p1); } break; case DFM_COMMAND: CommandMsg(wnd, p1); break; - case SETFOCUS: + case DFM_SETFOCUS: SetFocusMsg(wnd, p1); break; case DFM_DOUBLE_CLICK: DoubleClickMsg(wnd, p1, p2); break; - case LEFT_BUTTON: + case DFM_LEFT_BUTTON: LeftButtonMsg(wnd, p1, p2); break; case MOUSE_MOVED: @@ -657,47 +657,47 @@ int NormalProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) return TRUE; break; case DFM_BUTTON_RELEASED: - if (WindowMoving || WindowSizing) + if (DfWindowMoving || DfWindowSizing) { - if (WindowMoving) - DfPostMessage(wnd,MOVE,dwnd.rc.lf,dwnd.rc.tp); + if (DfWindowMoving) + DfPostMessage(wnd,DFM_MOVE,dwnd.rc.lf,dwnd.rc.tp); else - DfPostMessage(wnd, DFM_SIZE,dwnd.rc.rt,dwnd.rc.bt); + DfPostMessage(wnd, DFM_DFM_SIZE,dwnd.rc.rt,dwnd.rc.bt); TerminateMoveSize(); } break; #ifdef INCLUDE_MAXIMIZE - case MAXIMIZE: - if (wnd->condition != ISMAXIMIZED) + case DFM_MAXIMIZE: + if (wnd->condition != DF_ISMAXIMIZED) MaximizeMsg(wnd); break; #endif #ifdef INCLUDE_MINIMIZE - case MINIMIZE: - if (wnd->condition != ISMINIMIZED) + case DFM_MINIMIZE: + if (wnd->condition != DF_ISMINIMIZED) MinimizeMsg(wnd); break; #endif #ifdef INCLUDE_RESTORE - case RESTORE: - if (wnd->condition != ISRESTORED) { + case DFM_RESTORE: + if (wnd->condition != DF_SRESTORED) { #ifdef INCLUDE_MAXIMIZE - if (wnd->oldcondition == ISMAXIMIZED) - DfSendMessage(wnd, MAXIMIZE, 0, 0); + if (wnd->oldcondition == DF_ISMAXIMIZED) + DfSendMessage(wnd, DFM_MAXIMIZE, 0, 0); else #endif RestoreMsg(wnd); } break; #endif - case MOVE: + case DFM_MOVE: MoveMsg(wnd, p1, p2); break; - case DFM_SIZE: { + case DFM_DFM_SIZE: { SizeMsg(wnd, p1, p2); break; } - case CLOSE_WINDOW: + case DFM_CLOSE_WINDOW: CloseWindowMsg(wnd); break; default: @@ -710,48 +710,48 @@ int NormalProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) static DFRECT LowerRight(DFRECT prc) { DFRECT rc; - RectLeft(rc) = RectRight(prc) - ICONWIDTH; - RectTop(rc) = RectBottom(prc) - ICONHEIGHT; - RectRight(rc) = RectLeft(rc)+ICONWIDTH-1; - RectBottom(rc) = RectTop(rc)+ICONHEIGHT-1; + DfRectLeft(rc) = DfRectRight(prc) - DF_ICONWIDTH; + DfRectTop(rc) = DfRectBottom(prc) - DF_ICONHEIGHT; + DfRectRight(rc) = DfRectLeft(rc)+DF_ICONWIDTH-1; + DfRectBottom(rc) = DfRectTop(rc)+DF_ICONHEIGHT-1; return rc; } /* ----- compute a position for a minimized window icon ---- */ static DFRECT PositionIcon(DFWINDOW wnd) { - DFWINDOW pwnd = GetParent(wnd); + DFWINDOW pwnd = DfGetParent(wnd); DFRECT rc; - RectLeft(rc) = DfGetScreenWidth()-ICONWIDTH; - RectTop(rc) = DfGetScreenHeight()-ICONHEIGHT; - RectRight(rc) = DfGetScreenWidth()-1; - RectBottom(rc) = DfGetScreenHeight()-1; + DfRectLeft(rc) = DfGetScreenWidth()-DF_ICONWIDTH; + DfRectTop(rc) = DfGetScreenHeight()-DF_ICONHEIGHT; + DfRectRight(rc) = DfGetScreenWidth()-1; + DfRectBottom(rc) = DfGetScreenHeight()-1; if (pwnd != NULL) { - DFRECT prc = WindowRect(pwnd); - DFWINDOW cwnd = FirstWindow(pwnd); + DFRECT prc = DfWindowRect(pwnd); + DFWINDOW cwnd = DfFirstWindow(pwnd); rc = LowerRight(prc); /* - search for icon available location - */ while (cwnd != NULL) { - if (cwnd->condition == ISMINIMIZED) { + if (cwnd->condition == DF_ISMINIMIZED) { DFRECT rc1; - rc1 = WindowRect(cwnd); - if (RectLeft(rc1) == RectLeft(rc) && - RectTop(rc1) == RectTop(rc)) { - RectLeft(rc) -= ICONWIDTH; - RectRight(rc) -= ICONWIDTH; - if (RectLeft(rc) < RectLeft(prc)+1) { - RectLeft(rc) = - RectRight(prc)-ICONWIDTH; - RectRight(rc) = - RectLeft(rc)+ICONWIDTH-1; - RectTop(rc) -= ICONHEIGHT; - RectBottom(rc) -= ICONHEIGHT; - if (RectTop(rc) < RectTop(prc)+1) + rc1 = DfWindowRect(cwnd); + if (DfRectLeft(rc1) == DfRectLeft(rc) && + DfRectTop(rc1) == DfRectTop(rc)) { + DfRectLeft(rc) -= DF_ICONWIDTH; + DfRectRight(rc) -= DF_ICONWIDTH; + if (DfRectLeft(rc) < DfRectLeft(prc)+1) { + DfRectLeft(rc) = + DfRectRight(prc)-DF_ICONWIDTH; + DfRectRight(rc) = + DfRectLeft(rc)+DF_ICONWIDTH-1; + DfRectTop(rc) -= DF_ICONHEIGHT; + DfRectBottom(rc) -= DF_ICONHEIGHT; + if (DfRectTop(rc) < DfRectTop(prc)+1) return LowerRight(prc); } break; } } - cwnd = NextWindow(cwnd); + cwnd = DfNextWindow(cwnd); } } return rc; @@ -762,10 +762,10 @@ static void TerminateMoveSize(void) { px = py = -1; diff = 0; - DfSendMessage(&dwnd, RELEASE_MOUSE, TRUE, 0); - DfSendMessage(&dwnd, RELEASE_KEYBOARD, TRUE, 0); + DfSendMessage(&dwnd, DFM_RELEASE_MOUSE, TRUE, 0); + DfSendMessage(&dwnd, DFM_RELEASE_KEYBOARD, TRUE, 0); RestoreBorder(dwnd.rc); - WindowMoving = WindowSizing = FALSE; + DfWindowMoving = DfWindowSizing = FALSE; } /* ---- build a dummy window border for moving or sizing --- */ static void dragborder(DFWINDOW wnd, int x, int y) @@ -774,28 +774,28 @@ static void dragborder(DFWINDOW wnd, int x, int y) /* ------- build the dummy window -------- */ dwnd.rc.lf = x; dwnd.rc.tp = y; - dwnd.rc.rt = dwnd.rc.lf+WindowWidth(wnd)-1; - dwnd.rc.bt = dwnd.rc.tp+WindowHeight(wnd)-1; - dwnd.ht = WindowHeight(wnd); - dwnd.wd = WindowWidth(wnd); - dwnd.parent = GetParent(wnd); - dwnd.attrib = VISIBLE | HASBORDER | NOCLIP; - InitWindowColors(&dwnd); + dwnd.rc.rt = dwnd.rc.lf+DfWindowWidth(wnd)-1; + dwnd.rc.bt = dwnd.rc.tp+DfWindowHeight(wnd)-1; + dwnd.ht = DfWindowHeight(wnd); + dwnd.wd = DfWindowWidth(wnd); + dwnd.parent = DfGetParent(wnd); + dwnd.attrib = DF_VISIBLE | DF_HASBORDER | DF_NOCLIP; + DfInitWindowColors(&dwnd); SaveBorder(dwnd.rc); - RepaintBorder(&dwnd, NULL); + DfRepaintBorder(&dwnd, NULL); } /* ---- write the dummy window border for sizing ---- */ static void sizeborder(DFWINDOW wnd, int rt, int bt) { - int leftmost = GetLeft(wnd)+10; - int topmost = GetTop(wnd)+3; + int leftmost = DfGetLeft(wnd)+10; + int topmost = DfGetTop(wnd)+3; int bottommost = DfGetScreenHeight()-1; int rightmost = DfGetScreenWidth()-1; - if (GetParent(wnd)) { + if (DfGetParent(wnd)) { bottommost = min(bottommost, - GetClientBottom(GetParent(wnd))); + DfGetClientBottom(DfGetParent(wnd))); rightmost = min(rightmost, - GetClientRight(GetParent(wnd))); + DfGetClientRight(DfGetParent(wnd))); } rt = min(rt, rightmost); bt = min(bt, bottommost); @@ -814,7 +814,7 @@ static void sizeborder(DFWINDOW wnd, int rt, int bt) px = rt; py = bt; SaveBorder(dwnd.rc); - RepaintBorder(&dwnd, NULL); + DfRepaintBorder(&dwnd, NULL); } } #ifdef INCLUDE_MULTI_WINDOWS @@ -823,57 +823,57 @@ static DFRECT adjShadow(DFWINDOW wnd) { DFRECT rc; rc = wnd->rc; - if (TestAttribute(wnd, SHADOW)) { - if (RectRight(rc) < DfGetScreenWidth()-1) - RectRight(rc)++; - if (RectBottom(rc) < DfGetScreenHeight()-1) - RectBottom(rc)++; + if (DfTestAttribute(wnd, DF_SHADOW)) { + if (DfRectRight(rc) < DfGetScreenWidth()-1) + DfRectRight(rc)++; + if (DfRectBottom(rc) < DfGetScreenHeight()-1) + DfRectBottom(rc)++; } return rc; } /* --- repaint a rectangular subsection of a window --- */ static void PaintOverLap(DFWINDOW wnd, DFRECT rc) { - if (isVisible(wnd)) { + if (DfIsVisible(wnd)) { int isBorder, isTitle, isData; isBorder = isTitle = FALSE; isData = TRUE; - if (TestAttribute(wnd, HASBORDER)) { - isBorder = RectLeft(rc) == 0 && - RectTop(rc) < WindowHeight(wnd); - isBorder |= RectLeft(rc) < WindowWidth(wnd) && - RectRight(rc) >= WindowWidth(wnd)-1 && - RectTop(rc) < WindowHeight(wnd); - isBorder |= RectTop(rc) == 0 && - RectLeft(rc) < WindowWidth(wnd); - isBorder |= RectTop(rc) < WindowHeight(wnd) && - RectBottom(rc) >= WindowHeight(wnd)-1 && - RectLeft(rc) < WindowWidth(wnd); + if (DfTestAttribute(wnd, DF_HASBORDER)) { + isBorder = DfRectLeft(rc) == 0 && + DfRectTop(rc) < DfWindowHeight(wnd); + isBorder |= DfRectLeft(rc) < DfWindowWidth(wnd) && + DfRectRight(rc) >= DfWindowWidth(wnd)-1 && + DfRectTop(rc) < DfWindowHeight(wnd); + isBorder |= DfRectTop(rc) == 0 && + DfRectLeft(rc) < DfWindowWidth(wnd); + isBorder |= DfRectTop(rc) < DfWindowHeight(wnd) && + DfRectBottom(rc) >= DfWindowHeight(wnd)-1 && + DfRectLeft(rc) < DfWindowWidth(wnd); } - else if (TestAttribute(wnd, HASTITLEBAR)) - isTitle = RectTop(rc) == 0 && - RectRight(rc) > 0 && - RectLeft(rc) 0 && + DfRectLeft(rc)= WindowWidth(wnd)-BorderAdj(wnd)) + if (DfRectLeft(rc) >= DfWindowWidth(wnd)-DfBorderAdj(wnd)) isData = FALSE; - if (RectTop(rc) >= WindowHeight(wnd)-BottomBorderAdj(wnd)) + if (DfRectTop(rc) >= DfWindowHeight(wnd)-DfBottomBorderAdj(wnd)) isData = FALSE; - if (TestAttribute(wnd, HASBORDER)) { - if (RectRight(rc) == 0) + if (DfTestAttribute(wnd, DF_HASBORDER)) { + if (DfRectRight(rc) == 0) isData = FALSE; - if (RectBottom(rc) == 0) + if (DfRectBottom(rc) == 0) isData = FALSE; } - if (TestAttribute(wnd, SHADOW)) - isBorder |= RectRight(rc) == WindowWidth(wnd) || - RectBottom(rc) == WindowHeight(wnd); + if (DfTestAttribute(wnd, DF_SHADOW)) + isBorder |= DfRectRight(rc) == DfWindowWidth(wnd) || + DfRectBottom(rc) == DfWindowHeight(wnd); if (isData) - DfSendMessage(wnd, PAINT, (PARAM) &rc, TRUE); + DfSendMessage(wnd, DFM_PAINT, (DF_PARAM) &rc, TRUE); if (isBorder) - DfSendMessage(wnd, BORDER, (PARAM) &rc, 0); + DfSendMessage(wnd, DFM_BORDER, (DF_PARAM) &rc, 0); else if (isTitle) - DisplayTitle(wnd, &rc); + DfDisplayTitle(wnd, &rc); } } /* ------ paint the part of a window that is overlapped @@ -883,26 +883,26 @@ static void PaintOver(DFWINDOW wnd) DFRECT wrc, rc; wrc = adjShadow(HiddenWindow); rc = adjShadow(wnd); - rc = subRectangle(rc, wrc); - if (ValidRect(rc)) - PaintOverLap(wnd, RelativeWindowRect(wnd, rc)); + rc = DfSubRectangle(rc, wrc); + if (DfValidRect(rc)) + PaintOverLap(wnd, DfRelativeWindowRect(wnd, rc)); } /* --- paint the overlapped parts of all children --- */ static void PaintOverChildren(DFWINDOW pwnd) { - DFWINDOW cwnd = FirstWindow(pwnd); + DFWINDOW cwnd = DfFirstWindow(pwnd); while (cwnd != NULL) { if (cwnd != HiddenWindow) { PaintOver(cwnd); PaintOverChildren(cwnd); } - cwnd = NextWindow(cwnd); + cwnd = DfNextWindow(cwnd); } } /* -- recursive overlapping paint of parents -- */ static void PaintOverParents(DFWINDOW wnd) { - DFWINDOW pwnd = GetParent(wnd); + DFWINDOW pwnd = DfGetParent(wnd); if (pwnd != NULL) { PaintOverParents(pwnd); PaintOver(pwnd); @@ -918,46 +918,46 @@ static void PaintOverLappers(DFWINDOW wnd) /* --- paint those parts of a window that are overlapped --- */ static void PaintUnderLappers(DFWINDOW wnd) { - DFWINDOW hwnd = NextWindow(wnd); + DFWINDOW hwnd = DfNextWindow(wnd); while (hwnd != NULL) { /* ------- test only at document window level ------ */ - DFWINDOW pwnd = GetParent(hwnd); -/* if (pwnd == NULL || GetClass(pwnd) == APPLICATION) */ { + DFWINDOW pwnd = DfGetParent(hwnd); +/* if (pwnd == NULL || DfGetClass(pwnd) == DF_APPLICATION) */ { /* ---- don't bother testing self ----- */ - if (isVisible(hwnd) && hwnd != wnd) { + if (DfIsVisible(hwnd) && hwnd != wnd) { /* --- see if other window is descendent --- */ while (pwnd != NULL) { if (pwnd == wnd) break; - pwnd = GetParent(pwnd); + pwnd = DfGetParent(pwnd); } /* ----- don't test descendent overlaps ----- */ if (pwnd == NULL) { /* -- see if other window is ancestor --- */ - pwnd = GetParent(wnd); + pwnd = DfGetParent(wnd); while (pwnd != NULL) { if (pwnd == hwnd) break; - pwnd = GetParent(pwnd); + pwnd = DfGetParent(pwnd); } /* --- don't test ancestor overlaps --- */ if (pwnd == NULL) { - HiddenWindow = GetAncestor(hwnd); - ClearVisible(HiddenWindow); + HiddenWindow = DfGetAncestor(hwnd); + DfClearVisible(HiddenWindow); PaintOver(wnd); - SetVisible(HiddenWindow); + DfSetVisible(HiddenWindow); } } } } - hwnd = NextWindow(hwnd); + hwnd = DfNextWindow(hwnd); } /* --------- repaint all children of this window the same way ----------- */ - hwnd = FirstWindow(wnd); + hwnd = DfFirstWindow(wnd); while (hwnd != NULL) { PaintUnderLappers(hwnd); - hwnd = NextWindow(hwnd); + hwnd = DfNextWindow(hwnd); } } #endif /* #ifdef INCLUDE_MULTI_WINDOWS */ @@ -965,18 +965,18 @@ static void PaintUnderLappers(DFWINDOW wnd) /* --- save video area to be used by dummy window border --- */ static void SaveBorder(DFRECT rc) { - Bht = RectBottom(rc) - RectTop(rc) + 1; - Bwd = RectRight(rc) - RectLeft(rc) + 1; - Bsave = DFrealloc(Bsave, Bht * Bwd * sizeof(CHAR_INFO)); + Bht = DfRectBottom(rc) - DfRectTop(rc) + 1; + Bwd = DfRectRight(rc) - DfRectLeft(rc) + 1; + Bsave = DfRealloc(Bsave, Bht * Bwd * sizeof(CHAR_INFO)); - GetVideo(rc,Bsave); + DfGetVideo(rc,Bsave); } /* ---- restore video area used by dummy window border ---- */ static void RestoreBorder(DFRECT rc) { if (Bsave != NULL) { - StoreVideo(rc, Bsave); + DfStoreVideo(rc, Bsave); free(Bsave); Bsave = NULL; } @@ -985,49 +985,49 @@ static void RestoreBorder(DFRECT rc) static BOOL InsideWindow(DFWINDOW wnd, int x, int y) { DFRECT rc; - rc = WindowRect(wnd); - if (!TestAttribute(wnd, NOCLIP)) + rc = DfWindowRect(wnd); + if (!DfTestAttribute(wnd, DF_NOCLIP)) { - DFWINDOW pwnd = GetParent(wnd); + DFWINDOW pwnd = DfGetParent(wnd); while (pwnd != NULL) { - rc = subRectangle(rc, ClientRect(pwnd)); - pwnd = GetParent(pwnd); + rc = DfSubRectangle(rc, DfClientRect(pwnd)); + pwnd = DfGetParent(pwnd); } } - return InsideRect(x, y, rc); + return DfInsideRect(x, y, rc); } -BOOL isDerivedFrom(DFWINDOW wnd, DFCLASS class) +BOOL DfIsDerivedFrom(DFWINDOW wnd, DFCLASS class) { - DFCLASS tclass = GetClass(wnd); + DFCLASS tclass = DfGetClass(wnd); while (tclass != -1) { if (tclass == class) return TRUE; - tclass = (classdefs[tclass].base); + tclass = (DfClassDefs[tclass].base); } return FALSE; } /* -- find the oldest document window ancestor of a window -- */ -DFWINDOW GetAncestor(DFWINDOW wnd) +DFWINDOW DfGetAncestor(DFWINDOW wnd) { if (wnd != NULL) { - while (GetParent(wnd) != NULL) { - if (GetClass(GetParent(wnd)) == APPLICATION) + while (DfGetParent(wnd) != NULL) { + if (DfGetClass(DfGetParent(wnd)) == DF_APPLICATION) break; - wnd = GetParent(wnd); + wnd = DfGetParent(wnd); } } return wnd; } -BOOL isVisible(DFWINDOW wnd) +BOOL DfIsVisible(DFWINDOW wnd) { while (wnd != NULL) { if (isHidden(wnd)) return FALSE; - wnd = GetParent(wnd); + wnd = DfGetParent(wnd); } return TRUE; } @@ -1036,12 +1036,12 @@ BOOL isVisible(DFWINDOW wnd) static DFRECT ClipRect(DFWINDOW wnd) { DFRECT rc; - rc = WindowRect(wnd); - if (TestAttribute(wnd, SHADOW)) { - RectBottom(rc)++; - RectRight(rc)++; + rc = DfWindowRect(wnd); + if (DfTestAttribute(wnd, DF_SHADOW)) { + DfRectBottom(rc)++; + DfRectRight(rc)++; } - return ClipRectangle(wnd, rc); + return DfClipRectangle(wnd, rc); } /* -- get the video memory that is to be used by a window -- */ @@ -1052,10 +1052,10 @@ static void GetVideoBuffer(DFWINDOW wnd) int wd; rc = ClipRect(wnd); - ht = RectBottom(rc) - RectTop(rc) + 1; - wd = RectRight(rc) - RectLeft(rc) + 1; - wnd->videosave = DFrealloc(wnd->videosave, (ht * wd * sizeof(CHAR_INFO))); - GetVideo(rc, wnd->videosave); + ht = DfRectBottom(rc) - DfRectTop(rc) + 1; + wd = DfRectRight(rc) - DfRectLeft(rc) + 1; + wnd->videosave = DfRealloc(wnd->videosave, (ht * wd * sizeof(CHAR_INFO))); + DfGetVideo(rc, wnd->videosave); } /* -- put the video memory that is used by a window -- */ @@ -1065,19 +1065,19 @@ static void PutVideoBuffer(DFWINDOW wnd) { DFRECT rc; rc = ClipRect(wnd); - StoreVideo(rc, wnd->videosave); + DfStoreVideo(rc, wnd->videosave); free(wnd->videosave); wnd->videosave = NULL; } } /* ------- return TRUE if awnd is an ancestor of wnd ------- */ -BOOL isAncestor(DFWINDOW wnd, DFWINDOW awnd) +BOOL DfIsAncestor(DFWINDOW wnd, DFWINDOW awnd) { while (wnd != NULL) { if (wnd == awnd) return TRUE; - wnd = GetParent(wnd); + wnd = DfGetParent(wnd); } return FALSE; } diff --git a/rosapps/dflat32/pictbox.c b/rosapps/dflat32/pictbox.c index fc17e9e8ade..f791b15f26c 100644 --- a/rosapps/dflat32/pictbox.c +++ b/rosapps/dflat32/pictbox.c @@ -3,7 +3,7 @@ #include "dflat.h" typedef struct { - enum VectTypes vt; + enum DfVectTypes vt; DFRECT rc; } VECT; @@ -58,7 +58,7 @@ static int FindVector(DFWINDOW wnd, DFRECT rc, int x, int y) VECT *vc = wnd->VectorList; int i, coll = -1; for (i = 0; i < wnd->VectorCount; i++) { - if ((vc+i)->vt == VECTOR) { + if ((vc+i)->vt == DF_VECTOR) { rcc = (vc+i)->rc; /* --- skip the colliding vector --- */ if (rcc.lf == rc.lf && rcc.rt == rc.rt && @@ -124,8 +124,8 @@ static void PaintVector(DFWINDOW wnd, DFRECT rc) yi = i; else xi = i; - ch = videochar(GetClientLeft(wnd)+rc.lf+xi, - GetClientTop(wnd)+rc.tp+yi); + ch = DfVideoChar(DfGetClientLeft(wnd)+rc.lf+xi, + DfGetClientTop(wnd)+rc.tp+yi); for (cw = 0; cw < sizeof(CharInWnd); cw++) { if (ch == CharInWnd[cw]) { /* ---- hit another vector character ---- */ @@ -141,11 +141,11 @@ static void PaintVector(DFWINDOW wnd, DFRECT rc) } } } - PutWindowChar(wnd, newch, rc.lf+xi, rc.tp+yi); + DfPutWindowChar(wnd, newch, rc.lf+xi, rc.tp+yi); } } -static void PaintBar(DFWINDOW wnd, DFRECT rc, enum VectTypes vt) +static void PaintBar(DFWINDOW wnd, DFRECT rc, enum DfVectTypes vt) { int i, vertbar, len; unsigned int tys[] = {219, 178, 177, 176}; @@ -170,7 +170,7 @@ static void PaintBar(DFWINDOW wnd, DFRECT rc, enum VectTypes vt) yi = i; else xi = i; - PutWindowChar(wnd, nc, rc.lf+xi, rc.tp+yi); + DfPutWindowChar(wnd, nc, rc.lf+xi, rc.tp+yi); } } @@ -179,7 +179,7 @@ static void PaintMsg(DFWINDOW wnd) int i; VECT *vc = wnd->VectorList; for (i = 0; i < wnd->VectorCount; i++) { - if (vc->vt == VECTOR) + if (vc->vt == DF_VECTOR) PaintVector(wnd, vc->rc); else PaintBar(wnd, vc->rc, vc->vt); @@ -187,11 +187,11 @@ static void PaintMsg(DFWINDOW wnd) } } -static void DrawVectorMsg(DFWINDOW wnd,PARAM p1,enum VectTypes vt) +static void DrawVectorMsg(DFWINDOW wnd,DF_PARAM p1,enum DfVectTypes vt) { if (p1) { VECT vc; - wnd->VectorList = DFrealloc(wnd->VectorList, + wnd->VectorList = DfRealloc(wnd->VectorList, sizeof(VECT) * (wnd->VectorCount + 1)); vc.vt = vt; vc.rc = *(DFRECT *)p1; @@ -200,48 +200,48 @@ static void DrawVectorMsg(DFWINDOW wnd,PARAM p1,enum VectTypes vt) } } -static void DrawBoxMsg(DFWINDOW wnd, PARAM p1) +static void DrawBoxMsg(DFWINDOW wnd, DF_PARAM p1) { if (p1) { DFRECT rc = *(DFRECT *)p1; rc.bt = rc.tp; - DfSendMessage(wnd, DRAWVECTOR, (PARAM) &rc, TRUE); + DfSendMessage(wnd, DFM_DRAWVECTOR, (DF_PARAM) &rc, TRUE); rc = *(DFRECT *)p1; rc.lf = rc.rt; - DfSendMessage(wnd, DRAWVECTOR, (PARAM) &rc, FALSE); + DfSendMessage(wnd, DFM_DRAWVECTOR, (DF_PARAM) &rc, FALSE); rc = *(DFRECT *)p1; rc.tp = rc.bt; - DfSendMessage(wnd, DRAWVECTOR, (PARAM) &rc, TRUE); + DfSendMessage(wnd, DFM_DRAWVECTOR, (DF_PARAM) &rc, TRUE); rc = *(DFRECT *)p1; rc.rt = rc.lf; - DfSendMessage(wnd, DRAWVECTOR, (PARAM) &rc, FALSE); + DfSendMessage(wnd, DFM_DRAWVECTOR, (DF_PARAM) &rc, FALSE); } } -int PictureProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +int DfPictureProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { switch (msg) { - case PAINT: - BaseWndProc(PICTUREBOX, wnd, msg, p1, p2); + case DFM_PAINT: + DfBaseWndProc(DF_PICTUREBOX, wnd, msg, p1, p2); PaintMsg(wnd); return TRUE; - case DRAWVECTOR: - DrawVectorMsg(wnd, p1, VECTOR); + case DFM_DRAWVECTOR: + DrawVectorMsg(wnd, p1, DF_VECTOR); return TRUE; - case DRAWBOX: + case DFM_DRAWBOX: DrawBoxMsg(wnd, p1); return TRUE; - case DRAWBAR: - DrawVectorMsg(wnd, p1, (enum VectTypes)p2); + case DFM_DRAWBAR: + DrawVectorMsg(wnd, p1, (enum DfVectTypes)p2); return TRUE; - case CLOSE_WINDOW: + case DFM_CLOSE_WINDOW: if (wnd->VectorList != NULL) free(wnd->VectorList); break; default: break; } - return BaseWndProc(PICTUREBOX, wnd, msg, p1, p2); + return DfBaseWndProc(DF_PICTUREBOX, wnd, msg, p1, p2); } static DFRECT PictureRect(int x, int y, int len, int hv) @@ -258,27 +258,27 @@ static DFRECT PictureRect(int x, int y, int len, int hv) return rc; } -void DrawVector(DFWINDOW wnd, int x, int y, int len, int hv) +void DfDrawVector(DFWINDOW wnd, int x, int y, int len, int hv) { DFRECT rc = PictureRect(x,y,len,hv); - DfSendMessage(wnd, DRAWVECTOR, (PARAM) &rc, 0); + DfSendMessage(wnd, DFM_DRAWVECTOR, (DF_PARAM) &rc, 0); } -void DrawBox(DFWINDOW wnd, int x, int y, int ht, int wd) +void DfDrawBox(DFWINDOW wnd, int x, int y, int ht, int wd) { DFRECT rc; rc.lf = x; rc.tp = y; rc.rt = x+wd-1; rc.bt = y+ht-1; - DfSendMessage(wnd, DRAWBOX, (PARAM) &rc, 0); + DfSendMessage(wnd, DFM_DRAWBOX, (DF_PARAM) &rc, 0); } -void DrawBar(DFWINDOW wnd,enum VectTypes vt, +void DfDrawBar(DFWINDOW wnd,enum DfVectTypes vt, int x,int y,int len,int hv) { DFRECT rc = PictureRect(x,y,len,hv); - DfSendMessage(wnd, DRAWBAR, (PARAM) &rc, (PARAM) vt); + DfSendMessage(wnd, DFM_DRAWBAR, (DF_PARAM) &rc, (DF_PARAM) vt); } /* EOF */ diff --git a/rosapps/dflat32/popdown.c b/rosapps/dflat32/popdown.c index b24726fadda..846740136cd 100644 --- a/rosapps/dflat32/popdown.c +++ b/rosapps/dflat32/popdown.c @@ -2,20 +2,20 @@ #include "dflat.h" -static int SelectionWidth(struct PopDown *); +static int SelectionWidth(struct DfPopDown *); static int py = -1; -/* ------------ CREATE_WINDOW Message ------------- */ +/* ------------ DFM_CREATE_WINDOW Message ------------- */ static int CreateWindowMsg(DFWINDOW wnd) { int rtn, adj; - ClearAttribute (wnd, - HASTITLEBAR | - VSCROLLBAR | - MOVEABLE | - SIZEABLE | - HSCROLLBAR); + DfClearAttribute (wnd, + DF_HASTITLEBAR | + DF_VSCROLLBAR | + DF_MOVEABLE | + DF_SIZEABLE | + DF_HSCROLLBAR); /* ------ adjust to keep popdown on screen ----- */ adj = DfGetScreenHeight()-1-wnd->rc.bt; @@ -31,89 +31,89 @@ static int CreateWindowMsg(DFWINDOW wnd) wnd->rc.rt += adj; } - rtn = BaseWndProc(POPDOWNMENU, wnd, CREATE_WINDOW, 0, 0); - DfSendMessage(wnd, CAPTURE_MOUSE, 0, 0); - DfSendMessage(wnd, CAPTURE_KEYBOARD, 0, 0); - DfSendMessage(NULL, SAVE_CURSOR, 0, 0); - DfSendMessage(NULL, HIDE_CURSOR, 0, 0); - wnd->oldFocus = inFocus; - inFocus = wnd; + rtn = DfBaseWndProc(DF_POPDOWNMENU, wnd, DFM_CREATE_WINDOW, 0, 0); + DfSendMessage(wnd, DFM_CAPTURE_MOUSE, 0, 0); + DfSendMessage(wnd, DFM_CAPTURE_KEYBOARD, 0, 0); + DfSendMessage(NULL, DFM_SAVE_CURSOR, 0, 0); + DfSendMessage(NULL, DFM_HIDE_CURSOR, 0, 0); + wnd->oldFocus = DfInFocus; + DfInFocus = wnd; return rtn; } -/* --------- LEFT_BUTTON Message --------- */ -static void LeftButtonMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* --------- DFM_LEFT_BUTTON Message --------- */ +static void LeftButtonMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - int my = (int) p2 - GetTop(wnd); - if (InsideRect(p1, p2, ClientRect(wnd))) { + int my = (int) p2 - DfGetTop(wnd); + if (DfInsideRect(p1, p2, DfClientRect(wnd))) { if (my != py) { - DfSendMessage(wnd, LB_SELECTION, - (PARAM) wnd->wtop+my-1, TRUE); + DfSendMessage(wnd, DFM_LB_SELECTION, + (DF_PARAM) wnd->wtop+my-1, TRUE); py = my; } } - else if ((int)p2 == GetTop(GetParent(wnd))) - if (GetClass(GetParent(wnd)) == MENUBAR) - DfPostMessage(GetParent(wnd), LEFT_BUTTON, p1, p2); + else if ((int)p2 == DfGetTop(DfGetParent(wnd))) + if (DfGetClass(DfGetParent(wnd)) == DF_MENUBAR) + DfPostMessage(DfGetParent(wnd), DFM_LEFT_BUTTON, p1, p2); } /* -------- BUTTON_RELEASED Message -------- */ -static BOOL ButtonReleasedMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +static BOOL ButtonReleasedMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { py = -1; - if (InsideRect((int)p1, (int)p2, ClientRect(wnd))) { - int sel = (int)p2 - GetClientTop(wnd); - if (*TextLine(wnd, sel) != LINE) - DfSendMessage(wnd, LB_CHOOSE, wnd->selection, 0); + if (DfInsideRect((int)p1, (int)p2, DfClientRect(wnd))) { + int sel = (int)p2 - DfGetClientTop(wnd); + if (*DfTextLine(wnd, sel) != DF_LINE) + DfSendMessage(wnd, DFM_LB_CHOOSE, wnd->selection, 0); } else { - DFWINDOW pwnd = GetParent(wnd); - if (GetClass(pwnd) == MENUBAR && (int)p2==GetTop(pwnd)) + DFWINDOW pwnd = DfGetParent(wnd); + if (DfGetClass(pwnd) == DF_MENUBAR && (int)p2==DfGetTop(pwnd)) return FALSE; - if ((int)p1 == GetLeft(pwnd)+2) + if ((int)p1 == DfGetLeft(pwnd)+2) return FALSE; - DfSendMessage(wnd, CLOSE_WINDOW, 0, 0); + DfSendMessage(wnd, DFM_CLOSE_WINDOW, 0, 0); return TRUE; } return FALSE; } -/* --------- PAINT Message -------- */ +/* --------- DFM_PAINT Message -------- */ static void PaintMsg(DFWINDOW wnd) { int wd; unsigned char sep[80], *cp = sep; unsigned char sel[80]; - struct PopDown *ActivePopDown; - struct PopDown *pd1; + struct DfPopDown *ActivePopDown; + struct DfPopDown *pd1; ActivePopDown = pd1 = wnd->mnu->Selections; - wd = MenuWidth(ActivePopDown)-2; + wd = DfMenuWidth(ActivePopDown)-2; while (wd--) - *cp++ = LINE; + *cp++ = DF_LINE; *cp = '\0'; - DfSendMessage(wnd, CLEARTEXT, 0, 0); + DfSendMessage(wnd, DFM_CLEARTEXT, 0, 0); wnd->selection = wnd->mnu->Selection; while (pd1->SelectionTitle != NULL) { - if (*pd1->SelectionTitle == LINE) - DfSendMessage(wnd, ADDTEXT, (PARAM) sep, 0); + if (*pd1->SelectionTitle == DF_LINE) + DfSendMessage(wnd, DFM_ADDTEXT, (DF_PARAM) sep, 0); else { int len; memset(sel, '\0', sizeof sel); - if (pd1->Attrib & INACTIVE) + if (pd1->Attrib & DF_INACTIVE) /* ------ inactive menu selection ----- */ sprintf(sel, "%c%c%c", - CHANGECOLOR, - wnd->WindowColors [HILITE_COLOR] [FG]|0x80, - wnd->WindowColors [STD_COLOR] [BG]|0x80); + DF_CHANGECOLOR, + wnd->WindowColors [DF_HILITE_COLOR] [DF_FG]|0x80, + wnd->WindowColors [DF_STD_COLOR] [DF_BG]|0x80); strcat(sel, " "); - if (pd1->Attrib & CHECKED) + if (pd1->Attrib & DF_CHECKED) /* ---- paint the toggle checkmark ---- */ - sel[strlen(sel)-1] = CHECKMARK; - len=CopyCommand(sel+strlen(sel),pd1->SelectionTitle, - pd1->Attrib & INACTIVE, - wnd->WindowColors [STD_COLOR] [BG]); + sel[strlen(sel)-1] = DF_CHECKMARK; + len=DfCopyCommand(sel+strlen(sel),pd1->SelectionTitle, + pd1->Attrib & DF_INACTIVE, + wnd->WindowColors [DF_STD_COLOR] [DF_BG]); if (pd1->Accelerator) { /* ---- paint accelerator key ---- */ int i; @@ -129,67 +129,67 @@ static void PaintMsg(DFWINDOW wnd) } } } - if (pd1->Attrib & CASCADED) { + if (pd1->Attrib & DF_CASCADED) { /* ---- paint cascaded menu token ---- */ if (!pd1->Accelerator) { - wd = MenuWidth(ActivePopDown)-len+1; + wd = DfMenuWidth(ActivePopDown)-len+1; while (wd--) strcat(sel, " "); } - sel[strlen(sel)-1] = CASCADEPOINTER; + sel[strlen(sel)-1] = DF_CASCADEPOINTER; } else strcat(sel, " "); strcat(sel, " "); - sel[strlen(sel)-1] = RESETCOLOR; - DfSendMessage(wnd, ADDTEXT, (PARAM) sel, 0); + sel[strlen(sel)-1] = DF_RESETCOLOR; + DfSendMessage(wnd, DFM_ADDTEXT, (DF_PARAM) sel, 0); } pd1++; } } -/* ---------- BORDER Message ----------- */ +/* ---------- DFM_BORDER Message ----------- */ static int BorderMsg(DFWINDOW wnd) { int i, rtn = TRUE; DFWINDOW currFocus; if (wnd->mnu != NULL) { - currFocus = inFocus; - inFocus = NULL; - rtn = BaseWndProc(POPDOWNMENU, wnd, BORDER, 0, 0); - inFocus = currFocus; - for (i = 0; i < ClientHeight(wnd); i++) { - if (*TextLine(wnd, i) == LINE) { - wputch(wnd, LEDGE, 0, i+1); - wputch(wnd, REDGE, WindowWidth(wnd)-1, i+1); + currFocus = DfInFocus; + DfInFocus = NULL; + rtn = DfBaseWndProc(DF_POPDOWNMENU, wnd, DFM_BORDER, 0, 0); + DfInFocus = currFocus; + for (i = 0; i < DfClientHeight(wnd); i++) { + if (*DfTextLine(wnd, i) == DF_LINE) { + DfWPutch(wnd, DF_LEDGE, 0, i+1); + DfWPutch(wnd, DF_REDGE, DfWindowWidth(wnd)-1, i+1); } } } return rtn; } -/* -------------- LB_CHOOSE Message -------------- */ -static void LBChooseMsg(DFWINDOW wnd, PARAM p1) +/* -------------- DFM_LB_CHOOSE Message -------------- */ +static void LBChooseMsg(DFWINDOW wnd, DF_PARAM p1) { - struct PopDown *ActivePopDown = wnd->mnu->Selections; + struct DfPopDown *ActivePopDown = wnd->mnu->Selections; if (ActivePopDown != NULL) { int *attr = &(ActivePopDown+(int)p1)->Attrib; wnd->mnu->Selection = (int)p1; - if (!(*attr & INACTIVE)) { - if (*attr & TOGGLE) - *attr ^= CHECKED; - DfPostMessage(GetParent(wnd), DFM_COMMAND, + if (!(*attr & DF_INACTIVE)) { + if (*attr & DF_TOGGLE) + *attr ^= DF_CHECKED; + DfPostMessage(DfGetParent(wnd), DFM_COMMAND, (ActivePopDown+(int)p1)->ActionId, p1); } else - beep(); + DfBeep(); } } -/* ---------- KEYBOARD Message --------- */ -static BOOL KeyboardMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* ---------- DFM_KEYBOARD Message --------- */ +static BOOL KeyboardMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - struct PopDown *ActivePopDown = wnd->mnu->Selections; + struct DfPopDown *ActivePopDown = wnd->mnu->Selections; if (wnd->mnu != NULL) { @@ -198,23 +198,23 @@ static BOOL KeyboardMsg(DFWINDOW wnd, PARAM p1, PARAM p2) int c = (int)p1; int sel = 0; int a; - struct PopDown *pd = ActivePopDown; + struct DfPopDown *pd = ActivePopDown; - if ((c & OFFSET) == 0) + if ((c & DF_OFFSET) == 0) c = tolower(c); - a = AltConvert(c); + a = DfAltConvert(c); while (pd->SelectionTitle != NULL) { - char *cp = strchr(pd->SelectionTitle, SHORTCUTCHAR); + char *cp = strchr(pd->SelectionTitle, DF_SHORTCUTCHAR); -/* FIXME: AltConvert bug !! */ +/* FIXME: DfAltConvert bug !! */ if ((cp && tolower(*(cp+1)) == c) || // (a && tolower(*(cp+1)) == a) || pd->Accelerator == c) { - DfPostMessage(wnd, LB_SELECTION, sel, 0); - DfPostMessage(wnd, LB_CHOOSE, sel, TRUE); + DfPostMessage(wnd, DFM_LB_SELECTION, sel, 0); + DfPostMessage(wnd, DFM_LB_CHOOSE, sel, TRUE); return TRUE; } pd++; @@ -225,40 +225,40 @@ static BOOL KeyboardMsg(DFWINDOW wnd, PARAM p1, PARAM p2) switch ((int)p1) { - case F1: + case DF_F1: if (ActivePopDown == NULL) - DfSendMessage(GetParent(wnd), KEYBOARD, p1, p2); + DfSendMessage(DfGetParent(wnd), DFM_KEYBOARD, p1, p2); else - DisplayHelp(wnd, + DfDisplayHelp(wnd, (ActivePopDown+wnd->selection)->help); return TRUE; - case ESC: - DfSendMessage(wnd, CLOSE_WINDOW, 0, 0); + case DF_ESC: + DfSendMessage(wnd, DFM_CLOSE_WINDOW, 0, 0); return TRUE; - case FWD: - case BS: - if (GetClass(GetParent(wnd)) == MENUBAR) - DfPostMessage(GetParent(wnd), KEYBOARD, p1, p2); + case DF_FWD: + case DF_BS: + if (DfGetClass(DfGetParent(wnd)) == DF_MENUBAR) + DfPostMessage(DfGetParent(wnd), DFM_KEYBOARD, p1, p2); return TRUE; - case UP: + case DF_UP: if (wnd->selection == 0) { - if (wnd->wlines == ClientHeight(wnd)) { - DfPostMessage(wnd, LB_SELECTION, + if (wnd->wlines == DfClientHeight(wnd)) { + DfPostMessage(wnd, DFM_LB_SELECTION, wnd->wlines-1, FALSE); return TRUE; } } break; - case DN: + case DF_DN: if (wnd->selection == wnd->wlines-1) { - if (wnd->wlines == ClientHeight(wnd)) { - DfPostMessage(wnd, LB_SELECTION, 0, FALSE); + if (wnd->wlines == DfClientHeight(wnd)) { + DfPostMessage(wnd, DFM_LB_SELECTION, 0, FALSE); return TRUE; } } break; - case HOME: - case END: + case DF_HOME: + case DF_END: case '\r': break; default: @@ -267,33 +267,33 @@ static BOOL KeyboardMsg(DFWINDOW wnd, PARAM p1, PARAM p2) return FALSE; } -/* ----------- CLOSE_WINDOW Message ---------- */ +/* ----------- DFM_CLOSE_WINDOW Message ---------- */ static int CloseWindowMsg(DFWINDOW wnd) { int rtn; - DFWINDOW pwnd = GetParent(wnd); - DfSendMessage(wnd, RELEASE_MOUSE, 0, 0); - DfSendMessage(wnd, RELEASE_KEYBOARD, 0, 0); - DfSendMessage(NULL, RESTORE_CURSOR, 0, 0); - inFocus = wnd->oldFocus; - rtn = BaseWndProc(POPDOWNMENU, wnd, CLOSE_WINDOW, 0, 0); - DfSendMessage(pwnd, CLOSE_POPDOWN, 0, 0); + DFWINDOW pwnd = DfGetParent(wnd); + DfSendMessage(wnd, DFM_RELEASE_MOUSE, 0, 0); + DfSendMessage(wnd, DFM_RELEASE_KEYBOARD, 0, 0); + DfSendMessage(NULL, DFM_RESTORE_CURSOR, 0, 0); + DfInFocus = wnd->oldFocus; + rtn = DfBaseWndProc(DF_POPDOWNMENU, wnd, DFM_CLOSE_WINDOW, 0, 0); + DfSendMessage(pwnd, DFM_CLOSE_POPDOWN, 0, 0); return rtn; } -/* - Window processing module for POPDOWNMENU window class - */ -int PopDownProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +/* - Window processing module for DF_POPDOWNMENU window class - */ +int DfPopDownProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { switch (msg) { - case CREATE_WINDOW: + case DFM_CREATE_WINDOW: return CreateWindowMsg(wnd); - case LEFT_BUTTON: + case DFM_LEFT_BUTTON: LeftButtonMsg(wnd, p1, p2); return FALSE; case DOUBLE_CLICK: return TRUE; - case LB_SELECTION: - if (*TextLine(wnd, (int)p1) == LINE) + case DFM_LB_SELECTION: + if (*DfTextLine(wnd, (int)p1) == DF_LINE) return TRUE; wnd->mnu->Selection = (int)p1; break; @@ -301,34 +301,34 @@ int PopDownProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) if (ButtonReleasedMsg(wnd, p1, p2)) return TRUE; break; - case BUILD_SELECTIONS: + case DFM_BUILD_SELECTIONS: wnd->mnu = (void *) p1; wnd->selection = wnd->mnu->Selection; break; - case PAINT: + case DFM_PAINT: if (wnd->mnu == NULL) return TRUE; PaintMsg(wnd); break; - case BORDER: + case DFM_BORDER: return BorderMsg(wnd); - case LB_CHOOSE: + case DFM_LB_CHOOSE: LBChooseMsg(wnd, p1); return TRUE; - case KEYBOARD: + case DFM_KEYBOARD: if (KeyboardMsg(wnd, p1, p2)) return TRUE; break; - case CLOSE_WINDOW: + case DFM_CLOSE_WINDOW: return CloseWindowMsg(wnd); default: break; } - return BaseWndProc(POPDOWNMENU, wnd, msg, p1, p2); + return DfBaseWndProc(DF_POPDOWNMENU, wnd, msg, p1, p2); } /* --------- compute menu height -------- */ -int MenuHeight(struct PopDown *pd) +int DfMenuHeight(struct DfPopDown *pd) { int ht = 0; while (pd[ht].SelectionTitle != NULL) @@ -337,7 +337,7 @@ int MenuHeight(struct PopDown *pd) } /* --------- compute menu width -------- */ -int MenuWidth(struct PopDown *pd) +int DfMenuWidth(struct DfPopDown *pd) { int wd = 0, i; int len = 0; @@ -351,7 +351,7 @@ int MenuWidth(struct PopDown *pd) break; } } - if (pd->Attrib & CASCADED) + if (pd->Attrib & DF_CASCADED) len = max(len, 2); pd++; } @@ -359,7 +359,7 @@ int MenuWidth(struct PopDown *pd) } /* ---- compute the maximum selection width in a menu ---- */ -static int SelectionWidth(struct PopDown *pd) +static int SelectionWidth(struct DfPopDown *pd) { int wd = 0; while (pd->SelectionTitle != NULL) { @@ -371,20 +371,20 @@ static int SelectionWidth(struct PopDown *pd) } /* ----- copy a menu command to a display buffer ---- */ -int CopyCommand(unsigned char *dest, unsigned char *src, +int DfCopyCommand(unsigned char *dest, unsigned char *src, int skipcolor, int bg) { unsigned char *d = dest; while (*src && *src != '\n') { - if (*src == SHORTCUTCHAR) { + if (*src == DF_SHORTCUTCHAR) { src++; if (!skipcolor) { - *dest++ = CHANGECOLOR; - *dest++ = cfg.clr[POPDOWNMENU] - [HILITE_COLOR] [BG] | 0x80; + *dest++ = DF_CHANGECOLOR; + *dest++ = DfCfg.clr[DF_POPDOWNMENU] + [DF_HILITE_COLOR] [DF_BG] | 0x80; *dest++ = bg | 0x80; *dest++ = *src++; - *dest++ = RESETCOLOR; + *dest++ = DF_RESETCOLOR; } } else diff --git a/rosapps/dflat32/radio.c b/rosapps/dflat32/radio.c index 07ad2b861e3..32118e45350 100644 --- a/rosapps/dflat32/radio.c +++ b/rosapps/dflat32/radio.c @@ -2,57 +2,57 @@ #include "dflat.h" -static CTLWINDOW *rct[MAXRADIOS]; +static DF_CTLWINDOW *rct[DF_MAXRADIOS]; -int RadioButtonProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +int DfRadioButtonProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { int rtn; - DBOX *db = GetParent(wnd)->extension; - CTLWINDOW *ct = GetControl(wnd); + DF_DBOX *db = DfGetParent(wnd)->extension; + DF_CTLWINDOW *ct = DfGetControl(wnd); if (ct != NULL) { switch (msg) { - case SETFOCUS: + case DFM_SETFOCUS: if (!(int)p1) - DfSendMessage(NULL, HIDE_CURSOR, 0, 0); - case MOVE: - rtn = BaseWndProc(RADIOBUTTON,wnd,msg,p1,p2); - SetFocusCursor(wnd); + DfSendMessage(NULL, DFM_HIDE_CURSOR, 0, 0); + case DFM_MOVE: + rtn = DfBaseWndProc(DF_RADIOBUTTON,wnd,msg,p1,p2); + DfSetFocusCursor(wnd); return rtn; - case PAINT: { + case DFM_PAINT: { char rb[] = "( )"; if (ct->setting) rb[1] = 7; - DfSendMessage(wnd, CLEARTEXT, 0, 0); - DfSendMessage(wnd, ADDTEXT, (PARAM) rb, 0); - SetFocusCursor(wnd); + DfSendMessage(wnd, DFM_CLEARTEXT, 0, 0); + DfSendMessage(wnd, DFM_ADDTEXT, (DF_PARAM) rb, 0); + DfSetFocusCursor(wnd); break; } - case KEYBOARD: + case DFM_KEYBOARD: if ((int)p1 != ' ') break; - case LEFT_BUTTON: - SetRadioButton(db, ct); + case DFM_LEFT_BUTTON: + DfSetRadioButton(db, ct); break; default: break; } } - return BaseWndProc(RADIOBUTTON, wnd, msg, p1, p2); + return DfBaseWndProc(DF_RADIOBUTTON, wnd, msg, p1, p2); } static BOOL Setting = TRUE; -void SetRadioButton(DBOX *db, CTLWINDOW *ct) +void DfSetRadioButton(DF_DBOX *db, DF_CTLWINDOW *ct) { Setting = FALSE; - PushRadioButton(db, ct->command); + DfPushRadioButton(db, ct->command); Setting = TRUE; } -void PushRadioButton(DBOX *db, enum commands cmd) +void DfPushRadioButton(DF_DBOX *db, enum DfCommands cmd) { - CTLWINDOW *ctt = db->ctl; - CTLWINDOW *ct = FindCommand(db, cmd, RADIOBUTTON); + DF_CTLWINDOW *ctt = db->ctl; + DF_CTLWINDOW *ct = DfFindCommand(db, cmd, DF_RADIOBUTTON); int i; if (ct == NULL) @@ -63,10 +63,10 @@ void PushRadioButton(DBOX *db, enum commands cmd) /* -------- build a table of all radio buttons at the same x vector ---------- */ - for (i = 0; i < MAXRADIOS; i++) + for (i = 0; i < DF_MAXRADIOS; i++) rct[i] = NULL; while (ctt->class) { - if (ctt->class == RADIOBUTTON) + if (ctt->class == DF_RADIOBUTTON) if (ct->dwnd.x == ctt->dwnd.x) rct[ctt->dwnd.y] = ctt; ctt++; @@ -82,34 +82,34 @@ void PushRadioButton(DBOX *db, enum commands cmd) /* ----- find the end of the radiobutton group ---- */ i = ct->dwnd.y; - while (i < MAXRADIOS && rct[i] != NULL) + while (i < DF_MAXRADIOS && rct[i] != NULL) i++; /* ---- ignore everthing past the group ------ */ - while (i < MAXRADIOS) + while (i < DF_MAXRADIOS) rct[i++] = NULL; - for (i = 0; i < MAXRADIOS; i++) { + for (i = 0; i < DF_MAXRADIOS; i++) { if (rct[i] != NULL) { int wason = rct[i]->setting; - rct[i]->setting = OFF; + rct[i]->setting = DF_OFF; if (Setting) - rct[i]->isetting = OFF; + rct[i]->isetting = DF_OFF; if (wason) - DfSendMessage(rct[i]->wnd, PAINT, 0, 0); + DfSendMessage(rct[i]->wnd, DFM_PAINT, 0, 0); } } /* ----- set the specified radio button on ----- */ - ct->setting = ON; + ct->setting = DF_ON; if (Setting) - ct->isetting = ON; - DfSendMessage(ct->wnd, PAINT, 0, 0); + ct->isetting = DF_ON; + DfSendMessage(ct->wnd, DFM_PAINT, 0, 0); } -BOOL RadioButtonSetting(DBOX *db, enum commands cmd) +BOOL DfRadioButtonSetting(DF_DBOX *db, enum DfCommands cmd) { - CTLWINDOW *ct = FindCommand(db, cmd, RADIOBUTTON); + DF_CTLWINDOW *ct = DfFindCommand(db, cmd, DF_RADIOBUTTON); if (ct != NULL) - return (ct->setting == ON); + return (ct->setting == DF_ON); return FALSE; } diff --git a/rosapps/dflat32/rect.c b/rosapps/dflat32/rect.c index 15edfe721bf..721ede02d4d 100644 --- a/rosapps/dflat32/rect.c +++ b/rosapps/dflat32/rect.c @@ -8,30 +8,30 @@ static void subVector(int *v1, int *v2, int t1, int t2, int o1, int o2) { *v1 = *v2 = -1; - if (within(o1, t1, t2)) { + if (DfWithin(o1, t1, t2)) { *v1 = o1; - if (within(o2, t1, t2)) + if (DfWithin(o2, t1, t2)) *v2 = o2; else *v2 = t2; } - else if (within(o2, t1, t2)) { + else if (DfWithin(o2, t1, t2)) { *v2 = o2; - if (within(o1, t1, t2)) + if (DfWithin(o1, t1, t2)) *v1 = o1; else *v1 = t1; } - else if (within(t1, o1, o2)) { + else if (DfWithin(t1, o1, o2)) { *v1 = t1; - if (within(t2, o1, o2)) + if (DfWithin(t2, o1, o2)) *v2 = t2; else *v2 = o2; } - else if (within(t2, o1, o2)) { + else if (DfWithin(t2, o1, o2)) { *v2 = t2; - if (within(t1, o1, o2)) + if (DfWithin(t1, o1, o2)) *v1 = t1; else *v1 = o1; @@ -40,67 +40,67 @@ static void subVector(int *v1, int *v2, /* --- Return the rectangle produced by the overlap of two other rectangles ---- */ -DFRECT subRectangle(DFRECT r1, DFRECT r2) +DFRECT DfSubRectangle(DFRECT r1, DFRECT r2) { DFRECT r = {0,0,0,0}; - subVector((int *) &RectLeft(r), (int *) &RectRight(r), - RectLeft(r1), RectRight(r1), - RectLeft(r2), RectRight(r2)); - subVector((int *) &RectTop(r), (int *) &RectBottom(r), - RectTop(r1), RectBottom(r1), - RectTop(r2), RectBottom(r2)); - if (RectRight(r) == -1 || RectTop(r) == -1) - RectRight(r) = - RectLeft(r) = - RectTop(r) = - RectBottom(r) = 0; + subVector((int *) &DfRectLeft(r), (int *) &DfRectRight(r), + DfRectLeft(r1), DfRectRight(r1), + DfRectLeft(r2), DfRectRight(r2)); + subVector((int *) &DfRectTop(r), (int *) &DfRectBottom(r), + DfRectTop(r1), DfRectBottom(r1), + DfRectTop(r2), DfRectBottom(r2)); + if (DfRectRight(r) == -1 || DfRectTop(r) == -1) + DfRectRight(r) = + DfRectLeft(r) = + DfRectTop(r) = + DfRectBottom(r) = 0; return r; } /* ------- return the client rectangle of a window ------ */ -DFRECT ClientRect(void *wnd) +DFRECT DfClientRect(void *wnd) { DFRECT rc; if (wnd == NULL) { - RectLeft(rc) = 1; // GetClientLeft((DFWINDOW)wnd); - RectTop(rc) = 2; // GetClientTop((DFWINDOW)wnd); - RectRight(rc) = DfGetScreenWidth () - 2; // GetClientRight((DFWINDOW)wnd); - RectBottom(rc) = DfGetScreenHeight () - 2; // GetClientBottom((DFWINDOW)wnd); + DfRectLeft(rc) = 1; // DfGetClientLeft((DFWINDOW)wnd); + DfRectTop(rc) = 2; // DfGetClientTop((DFWINDOW)wnd); + DfRectRight(rc) = DfGetScreenWidth () - 2; // DfGetClientRight((DFWINDOW)wnd); + DfRectBottom(rc) = DfGetScreenHeight () - 2; // DfGetClientBottom((DFWINDOW)wnd); return rc; } - RectLeft(rc) = GetClientLeft((DFWINDOW)wnd); - RectTop(rc) = GetClientTop((DFWINDOW)wnd); - RectRight(rc) = GetClientRight((DFWINDOW)wnd); - RectBottom(rc) = GetClientBottom((DFWINDOW)wnd); + DfRectLeft(rc) = DfGetClientLeft((DFWINDOW)wnd); + DfRectTop(rc) = DfGetClientTop((DFWINDOW)wnd); + DfRectRight(rc) = DfGetClientRight((DFWINDOW)wnd); + DfRectBottom(rc) = DfGetClientBottom((DFWINDOW)wnd); return rc; } /* ----- return the rectangle relative to its window's screen position -------- */ -DFRECT RelativeWindowRect(void *wnd, DFRECT rc) +DFRECT DfRelativeWindowRect(void *wnd, DFRECT rc) { - RectLeft(rc) -= GetLeft((DFWINDOW)wnd); - RectRight(rc) -= GetLeft((DFWINDOW)wnd); - RectTop(rc) -= GetTop((DFWINDOW)wnd); - RectBottom(rc) -= GetTop((DFWINDOW)wnd); + DfRectLeft(rc) -= DfGetLeft((DFWINDOW)wnd); + DfRectRight(rc) -= DfGetLeft((DFWINDOW)wnd); + DfRectTop(rc) -= DfGetTop((DFWINDOW)wnd); + DfRectBottom(rc) -= DfGetTop((DFWINDOW)wnd); return rc; } /* ----- clip a rectangle to the parents of the window ----- */ -DFRECT ClipRectangle(void *wnd, DFRECT rc) +DFRECT DfClipRectangle(void *wnd, DFRECT rc) { DFRECT sr; - RectLeft(sr) = RectTop(sr) = 0; - RectRight(sr) = DfGetScreenWidth()-1; - RectBottom(sr) = DfGetScreenHeight()-1; - if (!TestAttribute((DFWINDOW)wnd, NOCLIP)) - while ((wnd = GetParent((DFWINDOW)wnd)) != NULL) - rc = subRectangle(rc, ClientRect(wnd)); - return subRectangle(rc, sr); + DfRectLeft(sr) = DfRectTop(sr) = 0; + DfRectRight(sr) = DfGetScreenWidth()-1; + DfRectBottom(sr) = DfGetScreenHeight()-1; + if (!DfTestAttribute((DFWINDOW)wnd, DF_NOCLIP)) + while ((wnd = DfGetParent((DFWINDOW)wnd)) != NULL) + rc = DfSubRectangle(rc, DfClientRect(wnd)); + return DfSubRectangle(rc, sr); } /* EOF */ diff --git a/rosapps/dflat32/rect.h b/rosapps/dflat32/rect.h index c4497e13e99..ed4f172d2a9 100644 --- a/rosapps/dflat32/rect.h +++ b/rosapps/dflat32/rect.h @@ -5,20 +5,20 @@ typedef struct { int lf,tp,rt,bt; } DFRECT; -#define within(p,v1,v2) ((p)>=(v1)&&(p)<=(v2)) -#define RectTop(r) (r.tp) -#define RectBottom(r) (r.bt) -#define RectLeft(r) (r.lf) -#define RectRight(r) (r.rt) -#define InsideRect(x,y,r) (within((x),RectLeft(r),RectRight(r))\ +#define DfWithin(p,v1,v2) ((p)>=(v1)&&(p)<=(v2)) +#define DfRectTop(r) (r.tp) +#define DfRectBottom(r) (r.bt) +#define DfRectLeft(r) (r.lf) +#define DfRectRight(r) (r.rt) +#define DfInsideRect(x,y,r) (DfWithin((x),DfRectLeft(r),DfRectRight(r))\ && \ - within((y),RectTop(r),RectBottom(r))) -#define ValidRect(r) (RectRight(r) || RectLeft(r) || \ - RectTop(r) || RectBottom(r)) -#define RectWidth(r) (RectRight(r)-RectLeft(r)+1) -#define RectHeight(r) (RectBottom(r)-RectTop(r)+1) -DFRECT subRectangle(DFRECT, DFRECT); -DFRECT ClientRect(void *); -DFRECT RelativeWindowRect(void *, DFRECT); -DFRECT ClipRectangle(void *, DFRECT); + DfWithin((y),DfRectTop(r),DfRectBottom(r))) +#define DfValidRect(r) (DfRectRight(r) || DfRectLeft(r) || \ + DfRectTop(r) || DfRectBottom(r)) +#define DfRectWidth(r) (DfRectRight(r)-DfRectLeft(r)+1) +#define DfRectHeight(r) (DfRectBottom(r)-DfRectTop(r)+1) +DFRECT DfSubRectangle(DFRECT, DFRECT); +DFRECT DfClientRect(void *); +DFRECT DfRelativeWindowRect(void *, DFRECT); +DFRECT DfClipRectangle(void *, DFRECT); #endif diff --git a/rosapps/dflat32/search.c b/rosapps/dflat32/search.c index 52a2a4a1d2a..eb35b98e8d2 100644 --- a/rosapps/dflat32/search.c +++ b/rosapps/dflat32/search.c @@ -1,8 +1,8 @@ /* ---------------- search.c ------------- */ #include "dflat.h" -extern DBOX SearchTextDB; -extern DBOX ReplaceTextDB; +extern DF_DBOX SearchTextDB; +extern DF_DBOX ReplaceTextDB; static int CheckCase = TRUE; static int Replacing = FALSE; @@ -17,10 +17,10 @@ static BOOL SearchCmp(int a, int b) } /* ----- replace a matching block of text ----- */ -static void replacetext(DFWINDOW wnd, char *cp1, DBOX *db) +static void replacetext(DFWINDOW wnd, char *cp1, DF_DBOX *db) { - char *cr = GetEditBoxText(db, ID_REPLACEWITH); - char *cp = GetEditBoxText(db, ID_SEARCHFOR); + char *cr = DfGetEditBoxText(db, DF_ID_REPLACEWITH); + char *cp = DfGetEditBoxText(db, DF_ID_SEARCHFOR); int oldlen = strlen(cp); /* length of text being replaced */ int newlen = strlen(cr); /* length of replacing text */ int dif; @@ -31,7 +31,7 @@ static void replacetext(DFWINDOW wnd, char *cp1, DBOX *db) /* ---- need to reallocate the text buffer ---- */ int offset = (int)((int)cp1-(int)wnd->text); wnd->textlen += dif; - wnd->text = DFrealloc(wnd->text, wnd->textlen+2); + wnd->text = DfRealloc(wnd->text, wnd->textlen+2); cp1 = wnd->text + offset; } memmove(cp1+dif, cp1, strlen(cp1)+1); @@ -48,20 +48,20 @@ static void replacetext(DFWINDOW wnd, char *cp1, DBOX *db) static void SearchTextBox(DFWINDOW wnd, int incr) { char *s1 = NULL, *s2, *cp1; - DBOX *db = Replacing ? &ReplaceTextDB : &SearchTextDB; - char *cp = GetEditBoxText(db, ID_SEARCHFOR); + DF_DBOX *db = Replacing ? &ReplaceTextDB : &SearchTextDB; + char *cp = DfGetEditBoxText(db, DF_ID_SEARCHFOR); BOOL rpl = TRUE, FoundOne = FALSE; while (rpl == TRUE && cp != NULL && *cp) { rpl = Replacing ? - CheckBoxSetting(&ReplaceTextDB, ID_REPLACEALL) : + DfCheckBoxSetting(&ReplaceTextDB, DF_ID_REPLACEALL) : FALSE; - if (TextBlockMarked(wnd)) { - ClearTextBlock(wnd); - DfSendMessage(wnd, PAINT, 0, 0); + if (DfTextBlockMarked(wnd)) { + DfClearTextBlock(wnd); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } - /* search for a match starting at cursor position */ - cp1 = CurrChar; + /* search for a match starting at DfCursor position */ + cp1 = DfCurrChar; if (incr) cp1++; /* start past the last hit */ /* --- compare at each character position --- */ @@ -82,44 +82,44 @@ static void SearchTextBox(DFWINDOW wnd, int incr) FoundOne = TRUE; /* mark a block at beginning of matching text */ - wnd->BlkEndLine = TextLineNumber(wnd, s2); - wnd->BlkBegLine = TextLineNumber(wnd, cp1); + wnd->BlkEndLine = DfTextLineNumber(wnd, s2); + wnd->BlkBegLine = DfTextLineNumber(wnd, cp1); if (wnd->BlkEndLine < wnd->BlkBegLine) wnd->BlkEndLine = wnd->BlkBegLine; wnd->BlkEndCol = - (int)((int)s2 - (int)TextLine(wnd, wnd->BlkEndLine)); + (int)((int)s2 - (int)DfTextLine(wnd, wnd->BlkEndLine)); wnd->BlkBegCol = - (int)((int)cp1 - (int)TextLine(wnd, wnd->BlkBegLine)); + (int)((int)cp1 - (int)DfTextLine(wnd, wnd->BlkBegLine)); - /* position the cursor at the matching text */ + /* position the DfCursor at the matching text */ wnd->CurrCol = wnd->BlkBegCol; wnd->CurrLine = wnd->BlkBegLine; wnd->WndRow = wnd->CurrLine - wnd->wtop; /* align the window scroll to matching text */ - if (WndCol > ClientWidth(wnd)-1) + if (DfWndCol > DfClientWidth(wnd)-1) wnd->wleft = wnd->CurrCol; - if (wnd->WndRow > ClientHeight(wnd)-1) { + if (wnd->WndRow > DfClientHeight(wnd)-1) { wnd->wtop = wnd->CurrLine; wnd->WndRow = 0; } - DfSendMessage(wnd, PAINT, 0, 0); - DfSendMessage(wnd, KEYBOARD_CURSOR, - WndCol, wnd->WndRow); + DfSendMessage(wnd, DFM_PAINT, 0, 0); + DfSendMessage(wnd, DFM_KEYBOARD_CURSOR, + DfWndCol, wnd->WndRow); if (Replacing) { if (rpl || DfYesNoBox("Replace the text?")) { replacetext(wnd, cp1, db); wnd->TextChanged = TRUE; - BuildTextPointers(wnd); + DfBuildTextPointers(wnd); } if (rpl) { incr = TRUE; continue; } - ClearTextBlock(wnd); - DfSendMessage(wnd, PAINT, 0, 0); + DfClearTextBlock(wnd); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } return; } @@ -135,9 +135,9 @@ void DfReplaceText(DFWINDOW wnd) { Replacing = TRUE; if (CheckCase) - SetCheckBox(&ReplaceTextDB, ID_MATCHCASE); + DfSetCheckBox(&ReplaceTextDB, DF_ID_MATCHCASE); if (DfDialogBox(NULL, &ReplaceTextDB, TRUE, NULL)) { - CheckCase=CheckBoxSetting(&ReplaceTextDB,ID_MATCHCASE); + CheckCase=DfCheckBoxSetting(&ReplaceTextDB,DF_ID_MATCHCASE); SearchTextBox(wnd, FALSE); } } @@ -147,9 +147,9 @@ void DfSearchText(DFWINDOW wnd) { Replacing = FALSE; if (CheckCase) - SetCheckBox(&SearchTextDB, ID_MATCHCASE); + DfSetCheckBox(&SearchTextDB, DF_ID_MATCHCASE); if (DfDialogBox(NULL, &SearchTextDB, TRUE, NULL)) { - CheckCase=CheckBoxSetting(&SearchTextDB,ID_MATCHCASE); + CheckCase=DfCheckBoxSetting(&SearchTextDB,DF_ID_MATCHCASE); SearchTextBox(wnd, FALSE); } } diff --git a/rosapps/dflat32/slidebox.c b/rosapps/dflat32/slidebox.c index d98719473b5..2a1c89268d3 100644 --- a/rosapps/dflat32/slidebox.c +++ b/rosapps/dflat32/slidebox.c @@ -3,11 +3,11 @@ #include "dflat.h" static int (*GenericProc) - (DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2); + (DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2); static BOOL KeepRunning; static int SliderLen; static int Percent; -extern DBOX SliderBoxDB; +extern DF_DBOX SliderBoxDB; static void InsertPercent(char *s) { @@ -15,9 +15,9 @@ static void InsertPercent(char *s) char pcc[5]; sprintf(s, "%c%c%c", - CHANGECOLOR, - color[DIALOG][SELECT_COLOR][FG]+0x80, - color[DIALOG][SELECT_COLOR][BG]+0x80); + DF_CHANGECOLOR, + DfColor[DF_DIALOG][DF_SELECT_COLOR][DF_FG]+0x80, + DfColor[DF_DIALOG][DF_SELECT_COLOR][DF_BG]+0x80); s += 3; memset(s, ' ', SliderLen); *(s+SliderLen) = '\0'; @@ -26,28 +26,28 @@ static void InsertPercent(char *s) offset = (SliderLen * Percent) / 100; memmove(s+offset+4, s+offset, strlen(s+offset)+1); sprintf(pcc, "%c%c%c%c", - RESETCOLOR, - CHANGECOLOR, - color[DIALOG][SELECT_COLOR][BG]+0x80, - color[DIALOG][SELECT_COLOR][FG]+0x80); + DF_RESETCOLOR, + DF_CHANGECOLOR, + DfColor[DF_DIALOG][DF_SELECT_COLOR][DF_BG]+0x80, + DfColor[DF_DIALOG][DF_SELECT_COLOR][DF_FG]+0x80); strncpy(s+offset, pcc, 4); - *(s + strlen(s) - 1) = RESETCOLOR; + *(s + strlen(s) - 1) = DF_RESETCOLOR; } static int -SliderTextProc (DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2) +SliderTextProc (DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2) { switch (msg) { - case PAINT: + case DFM_PAINT: Percent = (int)p2; - InsertPercent(GetText(wnd) ? - GetText(wnd) : SliderBoxDB.ctl[1].itext); - GenericProc(wnd, PAINT, 0, 0); + InsertPercent(DfGetText(wnd) ? + DfGetText(wnd) : SliderBoxDB.ctl[1].itext); + GenericProc(wnd, DFM_PAINT, 0, 0); if (Percent >= 100) - DfSendMessage(GetParent(wnd),DFM_COMMAND,ID_CANCEL,0); + DfSendMessage(DfGetParent(wnd),DFM_COMMAND,DF_ID_CANCEL,0); if (!DfDispatchMessage ()) - DfPostMessage(GetParent(wnd), ENDDIALOG, 0, 0); + DfPostMessage(DfGetParent(wnd), DFM_ENDDIALOG, 0, 0); return KeepRunning; default: break; @@ -56,23 +56,23 @@ SliderTextProc (DFWINDOW wnd,DFMESSAGE msg,PARAM p1,PARAM p2) } static int -SliderBoxProc (DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +SliderBoxProc (DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { int rtn; DFWINDOW twnd; switch (msg) { - case CREATE_WINDOW: - AddAttribute(wnd, SAVESELF); - rtn = DefaultWndProc(wnd, msg, p1, p2); + case DFM_CREATE_WINDOW: + DfAddAttribute(wnd, DF_SAVESELF); + rtn = DfDefaultWndProc(wnd, msg, p1, p2); twnd = SliderBoxDB.ctl[1].wnd; GenericProc = twnd->wndproc; twnd->wndproc = SliderTextProc; KeepRunning = TRUE; - DfSendMessage(wnd, CAPTURE_MOUSE, 0, 0); - DfSendMessage(wnd, CAPTURE_KEYBOARD, 0, 0); + DfSendMessage(wnd, DFM_CAPTURE_MOUSE, 0, 0); + DfSendMessage(wnd, DFM_CAPTURE_KEYBOARD, 0, 0); return rtn; case DFM_COMMAND: - if ((int)p2 == 0 && (int)p1 == ID_CANCEL) { + if ((int)p2 == 0 && (int)p1 == DF_ID_CANCEL) { if (Percent >= 100 || DfYesNoBox("Terminate process?")) KeepRunning = FALSE; @@ -80,17 +80,17 @@ SliderBoxProc (DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) return TRUE; } break; - case CLOSE_WINDOW: - DfSendMessage(wnd, RELEASE_MOUSE, 0, 0); - DfSendMessage(wnd, RELEASE_KEYBOARD, 0, 0); + case DFM_CLOSE_WINDOW: + DfSendMessage(wnd, DFM_RELEASE_MOUSE, 0, 0); + DfSendMessage(wnd, DFM_RELEASE_KEYBOARD, 0, 0); break; default: break; } - return DefaultWndProc(wnd, msg, p1, p2); + return DfDefaultWndProc(wnd, msg, p1, p2); } -DFWINDOW SliderBox(int len, char *ttl, char *msg) +DFWINDOW DfSliderBox(int len, char *ttl, char *msg) { SliderLen = len; SliderBoxDB.dwnd.title = ttl; @@ -101,7 +101,7 @@ DFWINDOW SliderBox(int len, char *ttl, char *msg) SliderBoxDB.ctl[0].dwnd.x = (SliderBoxDB.dwnd.w - strlen(msg)-1) / 2; SliderBoxDB.ctl[1].itext = - DFrealloc(SliderBoxDB.ctl[1].itext, len+10); + DfRealloc(SliderBoxDB.ctl[1].itext, len+10); Percent = 0; InsertPercent(SliderBoxDB.ctl[1].itext); SliderBoxDB.ctl[1].dwnd.w = len; diff --git a/rosapps/dflat32/spinbutt.c b/rosapps/dflat32/spinbutt.c index 262797d61ea..e94a85065ad 100644 --- a/rosapps/dflat32/spinbutt.c +++ b/rosapps/dflat32/spinbutt.c @@ -2,47 +2,47 @@ #include "dflat.h" -int SpinButtonProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +int DfSpinButtonProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { int rtn; - CTLWINDOW *ct = GetControl(wnd); + DF_CTLWINDOW *ct = DfGetControl(wnd); if (ct != NULL) { switch (msg) { - case CREATE_WINDOW: + case DFM_CREATE_WINDOW: wnd->wd -= 2; wnd->rc.rt -= 2; break; - case SETFOCUS: - rtn = BaseWndProc(SPINBUTTON, wnd, msg, p1, p2); + case DFM_SETFOCUS: + rtn = DfBaseWndProc(DF_SPINBUTTON, wnd, msg, p1, p2); if (!(int)p1) - DfSendMessage(NULL, HIDE_CURSOR, 0, 0); - SetFocusCursor(wnd); + DfSendMessage(NULL, DFM_HIDE_CURSOR, 0, 0); + DfSetFocusCursor(wnd); return rtn; - case PAINT: - foreground = WndBackground(wnd); - background = WndForeground(wnd); - wputch(wnd,UPSCROLLBOX,WindowWidth(wnd), 0); - wputch(wnd,DOWNSCROLLBOX,WindowWidth(wnd)+1,0); - SetFocusCursor(wnd); + case DFM_PAINT: + DfForeground = DfWndBackground(wnd); + DfBackground = DfWndForeground(wnd); + DfWPutch(wnd,DF_UPSCROLLBOX,DfWindowWidth(wnd), 0); + DfWPutch(wnd,DF_DOWNSCROLLBOX,DfWindowWidth(wnd)+1,0); + DfSetFocusCursor(wnd); break; - case LEFT_BUTTON: - if (p1 == GetRight(wnd) + 1) - DfSendMessage(wnd, KEYBOARD, UP, 0); - else if (p1 == GetRight(wnd) + 2) - DfSendMessage(wnd, KEYBOARD, DN, 0); - if (wnd != inFocus) - DfSendMessage(wnd, SETFOCUS, TRUE, 0); + case DFM_LEFT_BUTTON: + if (p1 == DfGetRight(wnd) + 1) + DfSendMessage(wnd, DFM_KEYBOARD, DF_UP, 0); + else if (p1 == DfGetRight(wnd) + 2) + DfSendMessage(wnd, DFM_KEYBOARD, DF_DN, 0); + if (wnd != DfInFocus) + DfSendMessage(wnd, DFM_SETFOCUS, TRUE, 0); return TRUE; - case LB_SETSELECTION: - rtn = BaseWndProc(SPINBUTTON, wnd, msg, p1, p2); + case DFM_LB_SETSELECTION: + rtn = DfBaseWndProc(DF_SPINBUTTON, wnd, msg, p1, p2); wnd->wtop = (int) p1; - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); return rtn; default: break; } } - return BaseWndProc(SPINBUTTON, wnd, msg, p1, p2); + return DfBaseWndProc(DF_SPINBUTTON, wnd, msg, p1, p2); } /* EOF */ diff --git a/rosapps/dflat32/statbar.c b/rosapps/dflat32/statbar.c index 7a459e072dd..3a81cdd9576 100644 --- a/rosapps/dflat32/statbar.c +++ b/rosapps/dflat32/statbar.c @@ -2,52 +2,52 @@ #include "dflat.h" -int StatusBarProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +int DfStatusBarProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { char *statusbar; switch (msg) { - case CREATE_WINDOW: - case MOVE: - DfSendMessage(wnd, CAPTURE_CLOCK, 0, 0); + case DFM_CREATE_WINDOW: + case DFM_MOVE: + DfSendMessage(wnd, DFM_CAPTURE_CLOCK, 0, 0); break; - case KEYBOARD: - if ((int)p1 == CTRL_F4) + case DFM_KEYBOARD: + if ((int)p1 == DF_CTRL_F4) return TRUE; break; - case PAINT: - if (!isVisible(wnd)) + case DFM_PAINT: + if (!DfIsVisible(wnd)) break; - statusbar = DFcalloc(1, WindowWidth(wnd)+1); - memset(statusbar, ' ', WindowWidth(wnd)); - *(statusbar+WindowWidth(wnd)) = '\0'; - strncpy(statusbar+1, "F1=Help Ý FreeDos Edit", 22); + statusbar = DfCalloc(1, DfWindowWidth(wnd)+1); + memset(statusbar, ' ', DfWindowWidth(wnd)); + *(statusbar+DfWindowWidth(wnd)) = '\0'; + strncpy(statusbar+1, "DF_F1=Help Ý FreeDos Edit", 22); if (wnd->text) { - int len = min((int)strlen(wnd->text), (int)(WindowWidth(wnd)-17)); + int len = min((int)strlen(wnd->text), (int)(DfWindowWidth(wnd)-17)); if (len > 0) { - int off=(WindowWidth(wnd)-len)/2; + int off=(DfWindowWidth(wnd)-len)/2; strncpy(statusbar+off, wnd->text, len); } } if (wnd->TimePosted) - *(statusbar+WindowWidth(wnd)-8) = '\0'; - SetStandardColor(wnd); - PutWindowLine(wnd, statusbar, 0, 0); + *(statusbar+DfWindowWidth(wnd)-8) = '\0'; + DfSetStandardColor(wnd); + DfPutWindowLine(wnd, statusbar, 0, 0); free(statusbar); return TRUE; - case BORDER: + case DFM_BORDER: return TRUE; - case CLOCKTICK: - SetStandardColor(wnd); - PutWindowLine(wnd, (char *)p1, WindowWidth(wnd)-8, 0); + case DFM_CLOCKTICK: + DfSetStandardColor(wnd); + DfPutWindowLine(wnd, (char *)p1, DfWindowWidth(wnd)-8, 0); wnd->TimePosted = TRUE; return TRUE; - case CLOSE_WINDOW: - DfSendMessage(NULL, RELEASE_CLOCK, 0, 0); + case DFM_CLOSE_WINDOW: + DfSendMessage(NULL, DFM_RELEASE_CLOCK, 0, 0); break; default: break; } - return BaseWndProc(STATUSBAR, wnd, msg, p1, p2); + return DfBaseWndProc(DF_STATUSBAR, wnd, msg, p1, p2); } /* EOF */ diff --git a/rosapps/dflat32/sysmenu.c b/rosapps/dflat32/sysmenu.c index 00e4aafc968..44edf3dbbf5 100644 --- a/rosapps/dflat32/sysmenu.c +++ b/rosapps/dflat32/sysmenu.c @@ -2,107 +2,107 @@ #include "dflat.h" -int SystemMenuProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +int DfSystemMenuProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { int mx, my; DFWINDOW wnd1; switch (msg) { - case CREATE_WINDOW: - wnd->holdmenu = ActiveMenuBar; - ActiveMenuBar = &SystemMenu; - SystemMenu.PullDown[0].Selection = 0; + case DFM_CREATE_WINDOW: + wnd->holdmenu = DfActiveMenuBar; + DfActiveMenuBar = &DfSystemMenu; + DfSystemMenu.PullDown[0].Selection = 0; break; - case LEFT_BUTTON: - wnd1 = GetParent(wnd); - mx = (int) p1 - GetLeft(wnd1); - my = (int) p2 - GetTop(wnd1); - if (HitControlBox(wnd1, mx, my)) + case DFM_LEFT_BUTTON: + wnd1 = DfGetParent(wnd); + mx = (int) p1 - DfGetLeft(wnd1); + my = (int) p2 - DfGetTop(wnd1); + if (DfHitControlBox(wnd1, mx, my)) return TRUE; break; - case LB_CHOOSE: - DfPostMessage(wnd, CLOSE_WINDOW, 0, 0); + case DFM_LB_CHOOSE: + DfPostMessage(wnd, DFM_CLOSE_WINDOW, 0, 0); break; case DOUBLE_CLICK: - if (p2 == GetTop(GetParent(wnd))) { - DfPostMessage(GetParent(wnd), msg, p1, p2); - DfSendMessage(wnd, CLOSE_WINDOW, TRUE, 0); + if (p2 == DfGetTop(DfGetParent(wnd))) { + DfPostMessage(DfGetParent(wnd), msg, p1, p2); + DfSendMessage(wnd, DFM_CLOSE_WINDOW, TRUE, 0); } return TRUE; - case SHIFT_CHANGED: + case DFM_SHIFT_CHANGED: return TRUE; - case CLOSE_WINDOW: - ActiveMenuBar = wnd->holdmenu; + case DFM_CLOSE_WINDOW: + DfActiveMenuBar = wnd->holdmenu; break; default: break; } - return DefaultWndProc(wnd, msg, p1, p2); + return DfDefaultWndProc(wnd, msg, p1, p2); } /* ------- Build a system menu -------- */ -void BuildSystemMenu(DFWINDOW wnd) +void DfBuildSystemMenu(DFWINDOW wnd) { int lf, tp, ht, wd; DFWINDOW SystemMenuWnd; - SystemMenu.PullDown[0].Selections[6].Accelerator = - (GetClass(wnd) == APPLICATION) ? ALT_F4 : CTRL_F4; + DfSystemMenu.PullDown[0].Selections[6].Accelerator = + (DfGetClass(wnd) == DF_APPLICATION) ? DF_ALT_F4 : DF_CTRL_F4; - lf = GetLeft(wnd)+1; - tp = GetTop(wnd)+1; - ht = MenuHeight(SystemMenu.PullDown[0].Selections); - wd = MenuWidth(SystemMenu.PullDown[0].Selections); + lf = DfGetLeft(wnd)+1; + tp = DfGetTop(wnd)+1; + ht = DfMenuHeight(DfSystemMenu.PullDown[0].Selections); + wd = DfMenuWidth(DfSystemMenu.PullDown[0].Selections); if (lf+wd > DfGetScreenWidth()-1) lf = (DfGetScreenWidth()-1) - wd; if (tp+ht > DfGetScreenHeight()-2) tp = (DfGetScreenHeight()-2) - ht; - SystemMenuWnd = DfCreateWindow(POPDOWNMENU, NULL, - lf,tp,ht,wd,NULL,wnd,SystemMenuProc, 0); + SystemMenuWnd = DfDfCreateWindow(DF_POPDOWNMENU, NULL, + lf,tp,ht,wd,NULL,wnd,DfSystemMenuProc, 0); #ifdef INCLUDE_RESTORE - if (wnd->condition == ISRESTORED) - DeactivateCommand(&SystemMenu, ID_SYSRESTORE); + if (wnd->condition == DF_SRESTORED) + DfDeactivateCommand(&DfSystemMenu, DF_ID_SYSRESTORE); else - ActivateCommand(&SystemMenu, ID_SYSRESTORE); + DfActivateCommand(&DfSystemMenu, DF_ID_SYSRESTORE); #endif - if (TestAttribute(wnd, MOVEABLE) + if (DfTestAttribute(wnd, DF_MOVEABLE) #ifdef INCLUDE_MAXIMIZE - && wnd->condition != ISMAXIMIZED + && wnd->condition != DF_ISMAXIMIZED #endif ) - ActivateCommand(&SystemMenu, ID_SYSMOVE); + DfActivateCommand(&DfSystemMenu, DF_ID_SYSMOVE); else - DeactivateCommand(&SystemMenu, ID_SYSMOVE); + DfDeactivateCommand(&DfSystemMenu, DF_ID_SYSMOVE); - if (wnd->condition != ISRESTORED || - TestAttribute(wnd, SIZEABLE) == FALSE) - DeactivateCommand(&SystemMenu, ID_SYSSIZE); + if (wnd->condition != DF_SRESTORED || + DfTestAttribute(wnd, DF_SIZEABLE) == FALSE) + DfDeactivateCommand(&DfSystemMenu, DF_ID_SYSSIZE); else - ActivateCommand(&SystemMenu, ID_SYSSIZE); + DfActivateCommand(&DfSystemMenu, DF_ID_SYSSIZE); #ifdef INCLUDE_MINIMIZE - if (wnd->condition == ISMINIMIZED || - TestAttribute(wnd, MINMAXBOX) == FALSE) - DeactivateCommand(&SystemMenu, ID_SYSMINIMIZE); + if (wnd->condition == DF_ISMINIMIZED || + DfTestAttribute(wnd, DF_MINMAXBOX) == FALSE) + DfDeactivateCommand(&DfSystemMenu, DF_ID_SYSMINIMIZE); else - ActivateCommand(&SystemMenu, ID_SYSMINIMIZE); + DfActivateCommand(&DfSystemMenu, DF_ID_SYSMINIMIZE); #endif #ifdef INCLUDE_MAXIMIZE - if (wnd->condition != ISRESTORED || - TestAttribute(wnd, MINMAXBOX) == FALSE) - DeactivateCommand(&SystemMenu, ID_SYSMAXIMIZE); + if (wnd->condition != DF_SRESTORED || + DfTestAttribute(wnd, DF_MINMAXBOX) == FALSE) + DfDeactivateCommand(&DfSystemMenu, DF_ID_SYSMAXIMIZE); else - ActivateCommand(&SystemMenu, ID_SYSMAXIMIZE); + DfActivateCommand(&DfSystemMenu, DF_ID_SYSMAXIMIZE); #endif - DfSendMessage(SystemMenuWnd, BUILD_SELECTIONS, - (PARAM) &SystemMenu.PullDown[0], 0); - DfSendMessage(SystemMenuWnd, SETFOCUS, TRUE, 0); - DfSendMessage(SystemMenuWnd, SHOW_WINDOW, 0, 0); + DfSendMessage(SystemMenuWnd, DFM_BUILD_SELECTIONS, + (DF_PARAM) &DfSystemMenu.PullDown[0], 0); + DfSendMessage(SystemMenuWnd, DFM_SETFOCUS, TRUE, 0); + DfSendMessage(SystemMenuWnd, DFM_SHOW_WINDOW, 0, 0); } /* EOF */ diff --git a/rosapps/dflat32/system.h b/rosapps/dflat32/system.h index 42136c1b242..498955da736 100644 --- a/rosapps/dflat32/system.h +++ b/rosapps/dflat32/system.h @@ -10,48 +10,48 @@ #define swap(a,b){int x=a;a=b;b=x;} /* ------- platform-dependent values ------ */ -#define KEYBOARDPORT 0x60 -#define FREQUENCY 100 -#define COUNT (1193280L / FREQUENCY) -#define ZEROFLAG 0x40 -#define MAXSAVES 50 +#define DF_KEYBOARDPORT 0x60 +#define DF_FREQUENCY 100 +#define DF_COUNT (1193280L / DF_FREQUENCY) +#define DF_ZEROFLAG 0x40 +#define DF_MAXSAVES 50 -//#define SCREENWIDTH (80) -//#define SCREENHEIGHT (25) +//#define DF_SCREENWIDTH (80) +//#define DF_SCREENHEIGHT (25) -HANDLE hInput; -HANDLE hOutput; +HANDLE DfInput; +HANDLE DfOutput; -SHORT sScreenHeight; -SHORT sScreenWidth; +SHORT DfScreenHeight; +SHORT DfScreenWidth; /* ---------- keyboard prototypes -------- */ -int AltConvert(int); -void GetKey(PINPUT_RECORD); -int getshift(void); -BOOL keyhit(void); -void beep(void); +int DfAltConvert(int); +void DfGetKey(PINPUT_RECORD); +int DfGetShift(void); +BOOL DfKeyHit(void); +void DfBeep(void); -/* ---------- cursor prototypes -------- */ -void curr_cursor(int *x, int *y); -void cursor(int x, int y); -void hidecursor(void); -void unhidecursor(void); -void savecursor(void); -void restorecursor(void); -void normalcursor(void); -void set_cursor_size(unsigned t); -void videomode(void); -void SwapCursorStack(void); +/* ---------- DfCursor prototypes -------- */ +void DfCurrCursor(int *x, int *y); +void DfCursor(int x, int y); +void DfHideCursor(void); +void DfUnhideCursor(void); +void DfSaveCursor(void); +void DfRestoreCursor(void); +void DfNormalCursor(void); +void DfSetCursorSize(unsigned t); +void DfVideoMode(void); +void DfSwapCursorStack(void); /* ------------ timer macros -------------- */ -#define timed_out(timer) (timer==0) -#define set_timer(timer, secs) timer=(secs)*182/10+1 -#define disable_timer(timer) timer = -1 -#define timer_running(timer) (timer > 0) -#define countdown(timer) --timer -#define timer_disabled(timer) (timer == -1) +#define DfTimedOut(timer) (timer==0) +#define DfSetTimer(timer, secs) timer=(secs)*182/10+1 +#define DfDisableTimer(timer) timer = -1 +#define DfTimerRunning(timer) (timer > 0) +#define DfCountdown(timer) --timer +#define DfTimerDisabled(timer) (timer == -1) #ifndef TURBOC @@ -73,27 +73,27 @@ void SwapCursorStack(void); #define LIGHTMAGENTA 13 #define YELLOW 14 #define WHITE 15 -#define keyhit kbhit +#define DfKeyHit kbhit #endif #endif -typedef enum messages { +typedef enum DfMessages { #ifdef WATCOM - WATCOMFIX1 = -1, + DF_WATCOMFIX1 = -1, #endif #undef DFlatMsg #define DFlatMsg(m) m, #include "dflatmsg.h" - MESSAGECOUNT + DF_MESSAGECOUNT } DFMESSAGE; -typedef enum window_class { +typedef enum DfWindowClass { #ifdef WATCOM - WATCOMFIX2 = -1, + DF_WATCOMFIX2 = -1, #endif - #define ClassDef(c,b,p,a) c, + #define DfClassDef(c,b,p,a) c, #include "classes.h" - CLASSCOUNT + DF_CLASSCOUNT } DFCLASS; #endif diff --git a/rosapps/dflat32/text.c b/rosapps/dflat32/text.c index c9635e63dc8..586fda23d81 100644 --- a/rosapps/dflat32/text.c +++ b/rosapps/dflat32/text.c @@ -2,29 +2,29 @@ #include "dflat.h" -int TextProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +int DfTextProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { int i, len; - CTLWINDOW *ct = GetControl(wnd); + DF_CTLWINDOW *ct = DfGetControl(wnd); char *cp, *cp2 = ct->itext; char *ptr; switch (msg) { - case SETFOCUS: + case DFM_SETFOCUS: return TRUE; - case LEFT_BUTTON: + case DFM_LEFT_BUTTON: return TRUE; - case PAINT: + case DFM_PAINT: if (ct == NULL || ct->itext == NULL || - GetText(wnd) != NULL) + DfGetText(wnd) != NULL) break; - len = min(ct->dwnd.h, MsgHeight(cp2)); + len = min(ct->dwnd.h, DfMsgHeight(cp2)); - ptr = DFmalloc (strlen (cp2) + 1); + ptr = DfMalloc (strlen (cp2) + 1); strcpy (ptr, cp2); cp = ptr; for (i = 0; i < len; i++) @@ -36,7 +36,7 @@ int TextProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) if (np != NULL) *np = '\0'; mlen = strlen(cp); - while ((cp1=strchr(cp1,SHORTCUTCHAR)) != NULL) + while ((cp1=strchr(cp1,DF_SHORTCUTCHAR)) != NULL) { mlen += 3; cp1++; @@ -44,10 +44,10 @@ int TextProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) if (np != NULL) *np = '\n'; - txt = DFmalloc(mlen+1); - CopyCommand(txt, cp, FALSE, WndBackground(wnd)); + txt = DfMalloc(mlen+1); + DfCopyCommand(txt, cp, FALSE, DfWndBackground(wnd)); txt[mlen] = '\0'; - DfSendMessage(wnd, ADDTEXT, (PARAM)txt, 0); + DfSendMessage(wnd, DFM_ADDTEXT, (DF_PARAM)txt, 0); if ((cp = strchr(cp, '\n')) != NULL) cp++; free(txt); @@ -59,7 +59,7 @@ int TextProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) break; } - return BaseWndProc(TEXT, wnd, msg, p1, p2); + return DfBaseWndProc(DF_TEXT, wnd, msg, p1, p2); } /* EOF */ diff --git a/rosapps/dflat32/textbox.c b/rosapps/dflat32/textbox.c index 6e13bb17926..fcfc3bb4dbe 100644 --- a/rosapps/dflat32/textbox.c +++ b/rosapps/dflat32/textbox.c @@ -9,10 +9,10 @@ static int ComputeHScrollBox(DFWINDOW); static void MoveScrollBox(DFWINDOW, int); static char *GetTextLine(DFWINDOW, int); -BOOL VSliding; -BOOL HSliding; +BOOL DfVSliding; +BOOL DfHSliding; -/* ------------ ADDTEXT Message -------------- */ +/* ------------ DFM_ADDTEXT Message -------------- */ static BOOL AddTextMsg(DFWINDOW wnd, char *txt) { /* --- append text to the textbox's buffer --- */ @@ -25,67 +25,67 @@ static BOOL AddTextMsg(DFWINDOW wnd, char *txt) if ((long)txln+adln > (unsigned) 0xfff0) return FALSE; if (txln+adln > wnd->textlen) { - wnd->text = DFrealloc(wnd->text, txln+adln+3); + wnd->text = DfRealloc(wnd->text, txln+adln+3); wnd->textlen = txln+adln+1; } } else { /* ------ 1st text appended ------ */ - wnd->text = DFcalloc(1, adln+3); + wnd->text = DfCalloc(1, adln+3); wnd->textlen = adln+1; } if (wnd->text != NULL) { /* ---- append the text ---- */ strcat(wnd->text, txt); strcat(wnd->text, "\n"); - BuildTextPointers(wnd); + DfBuildTextPointers(wnd); return TRUE; } return FALSE; } -/* ------------ DELETETEXT Message -------------- */ +/* ------------ DFM_DELETETEXT Message -------------- */ static void DeleteTextMsg(DFWINDOW wnd, int lno) { - char *cp1 = TextLine(wnd, lno); + char *cp1 = DfTextLine(wnd, lno); --wnd->wlines; if (lno == wnd->wlines) *cp1 = '\0'; else { - char *cp2 = TextLine(wnd, lno+1); + char *cp2 = DfTextLine(wnd, lno+1); memmove(cp1, cp2, strlen(cp2)+1); } - BuildTextPointers(wnd); + DfBuildTextPointers(wnd); } -/* ------------ INSERTTEXT Message -------------- */ +/* ------------ DFM_INSERTTEXT Message -------------- */ static void InsertTextMsg(DFWINDOW wnd, char *txt, int lno) { if (AddTextMsg(wnd, txt)) { int len = strlen(txt); - char *cp2 = TextLine(wnd, lno); + char *cp2 = DfTextLine(wnd, lno); char *cp1 = cp2+len+1; memmove(cp1, cp2, strlen(cp2)-len); strcpy(cp2, txt); *(cp2+len) = '\n'; - BuildTextPointers(wnd); + DfBuildTextPointers(wnd); } } -/* ------------ SETTEXT Message -------------- */ +/* ------------ DFM_SETTEXT Message -------------- */ static void SetTextMsg(DFWINDOW wnd, char *txt) { /* -- assign new text value to textbox buffer -- */ unsigned int len = strlen(txt)+1; - DfSendMessage(wnd, CLEARTEXT, 0, 0); + DfSendMessage(wnd, DFM_CLEARTEXT, 0, 0); wnd->textlen = len; - wnd->text=DFrealloc(wnd->text, len+1); + wnd->text=DfRealloc(wnd->text, len+1); wnd->text[len] = '\0'; strcpy(wnd->text, txt); - BuildTextPointers(wnd); + DfBuildTextPointers(wnd); } -/* ------------ CLEARTEXT Message -------------- */ +/* ------------ DFM_CLEARTEXT Message -------------- */ static void ClearTextMsg(DFWINDOW wnd) { /* ----- clear text from textbox ----- */ @@ -96,128 +96,128 @@ static void ClearTextMsg(DFWINDOW wnd) wnd->wlines = 0; wnd->textwidth = 0; wnd->wtop = wnd->wleft = 0; - ClearTextBlock(wnd); - ClearTextPointers(wnd); + DfClearTextBlock(wnd); + DfClearTextPointers(wnd); } -/* ------------ KEYBOARD Message -------------- */ -static int KeyboardMsg(DFWINDOW wnd, PARAM p1) +/* ------------ DFM_KEYBOARD Message -------------- */ +static int KeyboardMsg(DFWINDOW wnd, DF_PARAM p1) { switch ((int) p1) { - case UP: - return DfSendMessage(wnd,SCROLL,FALSE,0); - case DN: - return DfSendMessage(wnd,SCROLL,TRUE,0); - case FWD: - return DfSendMessage(wnd,HORIZSCROLL,TRUE,0); - case BS: - return DfSendMessage(wnd,HORIZSCROLL,FALSE,0); - case PGUP: - return DfSendMessage(wnd,SCROLLPAGE,FALSE,0); - case PGDN: - return DfSendMessage(wnd,SCROLLPAGE,TRUE,0); - case CTRL_PGUP: - return DfSendMessage(wnd,HORIZPAGE,FALSE,0); - case CTRL_PGDN: - return DfSendMessage(wnd,HORIZPAGE,TRUE,0); - case HOME: - return DfSendMessage(wnd,SCROLLDOC,TRUE,0); - case END: - return DfSendMessage(wnd,SCROLLDOC,FALSE,0); + case DF_UP: + return DfSendMessage(wnd,DFM_SCROLL,FALSE,0); + case DF_DN: + return DfSendMessage(wnd,DFM_SCROLL,TRUE,0); + case DF_FWD: + return DfSendMessage(wnd,DFM_HORIZSCROLL,TRUE,0); + case DF_BS: + return DfSendMessage(wnd,DFM_HORIZSCROLL,FALSE,0); + case DF_PGUP: + return DfSendMessage(wnd,DFM_SCROLLPAGE,FALSE,0); + case DF_PGDN: + return DfSendMessage(wnd,DFM_SCROLLPAGE,TRUE,0); + case DF_CTRL_PGUP: + return DfSendMessage(wnd,DFM_HORIZPAGE,FALSE,0); + case DF_CTRL_PGDN: + return DfSendMessage(wnd,DFM_HORIZPAGE,TRUE,0); + case DF_HOME: + return DfSendMessage(wnd,DFM_SCROLLDOC,TRUE,0); + case DF_END: + return DfSendMessage(wnd,DFM_SCROLLDOC,FALSE,0); default: break; } return FALSE; } -/* ------------ LEFT_BUTTON Message -------------- */ -static int LeftButtonMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* ------------ DFM_LEFT_BUTTON Message -------------- */ +static int LeftButtonMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - int mx = (int) p1 - GetLeft(wnd); - int my = (int) p2 - GetTop(wnd); - if (TestAttribute(wnd, VSCROLLBAR) && - mx == WindowWidth(wnd)-1) { + int mx = (int) p1 - DfGetLeft(wnd); + int my = (int) p2 - DfGetTop(wnd); + if (DfTestAttribute(wnd, DF_VSCROLLBAR) && + mx == DfWindowWidth(wnd)-1) { /* -------- in the right border ------- */ - if (my == 0 || my == ClientHeight(wnd)+1) + if (my == 0 || my == DfClientHeight(wnd)+1) /* --- above or below the scroll bar --- */ return FALSE; if (my == 1) /* -------- top scroll button --------- */ - return DfSendMessage(wnd, SCROLL, FALSE, 0); - if (my == ClientHeight(wnd)) + return DfSendMessage(wnd, DFM_SCROLL, FALSE, 0); + if (my == DfClientHeight(wnd)) /* -------- bottom scroll button --------- */ - return DfSendMessage(wnd, SCROLL, TRUE, 0); + return DfSendMessage(wnd, DFM_SCROLL, TRUE, 0); /* ---------- in the scroll bar ----------- */ - if (!VSliding && my-1 == wnd->VScrollBox) { + if (!DfVSliding && my-1 == wnd->VScrollBox) { DFRECT rc; - VSliding = TRUE; - rc.lf = rc.rt = GetRight(wnd); - rc.tp = GetTop(wnd)+2; - rc.bt = GetBottom(wnd)-2; - return DfSendMessage(NULL, MOUSE_TRAVEL, - (PARAM) &rc, 0); + DfVSliding = TRUE; + rc.lf = rc.rt = DfGetRight(wnd); + rc.tp = DfGetTop(wnd)+2; + rc.bt = DfGetBottom(wnd)-2; + return DfSendMessage(NULL, DFM_MOUSE_TRAVEL, + (DF_PARAM) &rc, 0); } if (my-1 < wnd->VScrollBox) - return DfSendMessage(wnd,SCROLLPAGE,FALSE,0); + return DfSendMessage(wnd,DFM_SCROLLPAGE,FALSE,0); if (my-1 > wnd->VScrollBox) - return DfSendMessage(wnd,SCROLLPAGE,TRUE,0); + return DfSendMessage(wnd,DFM_SCROLLPAGE,TRUE,0); } - if (TestAttribute(wnd, HSCROLLBAR) && - my == WindowHeight(wnd)-1) { + if (DfTestAttribute(wnd, DF_HSCROLLBAR) && + my == DfWindowHeight(wnd)-1) { /* -------- in the bottom border ------- */ - if (mx == 0 || my == ClientWidth(wnd)+1) + if (mx == 0 || my == DfClientWidth(wnd)+1) /* ------ outside the scroll bar ---- */ return FALSE; if (mx == 1) - return DfSendMessage(wnd, HORIZSCROLL,FALSE,0); - if (mx == WindowWidth(wnd)-2) - return DfSendMessage(wnd, HORIZSCROLL,TRUE,0); - if (!HSliding && mx-1 == wnd->HScrollBox) { + return DfSendMessage(wnd, DFM_HORIZSCROLL,FALSE,0); + if (mx == DfWindowWidth(wnd)-2) + return DfSendMessage(wnd, DFM_HORIZSCROLL,TRUE,0); + if (!DfHSliding && mx-1 == wnd->HScrollBox) { /* --- hit the scroll box --- */ DFRECT rc; - rc.lf = GetLeft(wnd)+2; - rc.rt = GetRight(wnd)-2; - rc.tp = rc.bt = GetBottom(wnd); + rc.lf = DfGetLeft(wnd)+2; + rc.rt = DfGetRight(wnd)-2; + rc.tp = rc.bt = DfGetBottom(wnd); /* - keep the mouse in the scroll bar - */ - DfSendMessage(NULL,MOUSE_TRAVEL,(PARAM)&rc,0); - HSliding = TRUE; + DfSendMessage(NULL,DFM_MOUSE_TRAVEL,(DF_PARAM)&rc,0); + DfHSliding = TRUE; return TRUE; } if (mx-1 < wnd->HScrollBox) - return DfSendMessage(wnd,HORIZPAGE,FALSE,0); + return DfSendMessage(wnd,DFM_HORIZPAGE,FALSE,0); if (mx-1 > wnd->HScrollBox) - return DfSendMessage(wnd,HORIZPAGE,TRUE,0); + return DfSendMessage(wnd,DFM_HORIZPAGE,TRUE,0); } return FALSE; } /* ------------ MOUSE_MOVED Message -------------- */ -static BOOL MouseMovedMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +static BOOL MouseMovedMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { - int mx = (int) p1 - GetLeft(wnd); - int my = (int) p2 - GetTop(wnd); - if (VSliding) { + int mx = (int) p1 - DfGetLeft(wnd); + int my = (int) p2 - DfGetTop(wnd); + if (DfVSliding) { /* ---- dragging the vertical scroll box --- */ if (my-1 != wnd->VScrollBox) { - foreground = FrameForeground(wnd); - background = FrameBackground(wnd); - wputch(wnd, SCROLLBARCHAR, WindowWidth(wnd)-1, + DfForeground = DfFrameForeground(wnd); + DfBackground = DfFrameBackground(wnd); + DfWPutch(wnd, DF_SCROLLBARCHAR, DfWindowWidth(wnd)-1, wnd->VScrollBox+1); wnd->VScrollBox = my-1; - wputch(wnd, SCROLLBOXCHAR, WindowWidth(wnd)-1, + DfWPutch(wnd, DF_SCROLLBOXCHAR, DfWindowWidth(wnd)-1, my); } return TRUE; } - if (HSliding) { + if (DfHSliding) { /* --- dragging the horizontal scroll box --- */ if (mx-1 != wnd->HScrollBox) { - foreground = FrameForeground(wnd); - background = FrameBackground(wnd); - wputch(wnd, SCROLLBARCHAR, wnd->HScrollBox+1, - WindowHeight(wnd)-1); + DfForeground = DfFrameForeground(wnd); + DfBackground = DfFrameBackground(wnd); + DfWPutch(wnd, DF_SCROLLBARCHAR, wnd->HScrollBox+1, + DfWindowHeight(wnd)-1); wnd->HScrollBox = mx-1; - wputch(wnd, SCROLLBOXCHAR, mx, WindowHeight(wnd)-1); + DfWPutch(wnd, DF_SCROLLBOXCHAR, mx, DfWindowHeight(wnd)-1); } return TRUE; } @@ -227,23 +227,23 @@ static BOOL MouseMovedMsg(DFWINDOW wnd, PARAM p1, PARAM p2) /* ------------ BUTTON_RELEASED Message -------------- */ static void ButtonReleasedMsg(DFWINDOW wnd) { - if (HSliding || VSliding) { + if (DfHSliding || DfVSliding) { /* release the mouse ouside the scroll bar */ - DfSendMessage(NULL, MOUSE_TRAVEL, 0, 0); - VSliding ? ComputeWindowTop(wnd):ComputeWindowLeft(wnd); - DfSendMessage(wnd, PAINT, 0, 0); - DfSendMessage(wnd, KEYBOARD_CURSOR, 0, 0); - VSliding = HSliding = FALSE; + DfSendMessage(NULL, DFM_MOUSE_TRAVEL, 0, 0); + DfVSliding ? ComputeWindowTop(wnd):ComputeWindowLeft(wnd); + DfSendMessage(wnd, DFM_PAINT, 0, 0); + DfSendMessage(wnd, DFM_KEYBOARD_CURSOR, 0, 0); + DfVSliding = DfHSliding = FALSE; } } -/* ------------ SCROLL Message -------------- */ -static BOOL ScrollMsg(DFWINDOW wnd, PARAM p1) +/* ------------ DFM_SCROLL Message -------------- */ +static BOOL ScrollMsg(DFWINDOW wnd, DF_PARAM p1) { /* ---- vertical scroll one line ---- */ if (p1) { /* ----- scroll one line up ----- */ - if (wnd->wtop+ClientHeight(wnd) >= wnd->wlines) + if (wnd->wtop+DfClientHeight(wnd) >= wnd->wlines) return FALSE; wnd->wtop++; } @@ -253,28 +253,28 @@ static BOOL ScrollMsg(DFWINDOW wnd, PARAM p1) return FALSE; --wnd->wtop; } - if (isVisible(wnd)) { + if (DfIsVisible(wnd)) { DFRECT rc; - rc = ClipRectangle(wnd, ClientRect(wnd)); - if (ValidRect(rc)) { + rc = DfClipRectangle(wnd, DfClientRect(wnd)); + if (DfValidRect(rc)) { /* ---- scroll the window ----- */ - if (wnd != inFocus) - DfSendMessage(wnd, PAINT, 0, 0); + if (wnd != DfInFocus) + DfSendMessage(wnd, DFM_PAINT, 0, 0); else { - scroll_window(wnd, rc, (int)p1); + DfScrollWindow(wnd, rc, (int)p1); if (!(int)p1) /* -- write top line (down) -- */ - WriteTextLine(wnd,NULL,wnd->wtop,FALSE); + DfWriteTextLine(wnd,NULL,wnd->wtop,FALSE); else { /* -- write bottom line (up) -- */ - int y=RectBottom(rc)-GetClientTop(wnd); - WriteTextLine(wnd, NULL, + int y=DfRectBottom(rc)-DfGetClientTop(wnd); + DfWriteTextLine(wnd, NULL, wnd->wtop+y, FALSE); } } } /* ---- reset the scroll box ---- */ - if (TestAttribute(wnd, VSCROLLBAR)) { + if (DfTestAttribute(wnd, DF_VSCROLLBAR)) { int vscrollbox = ComputeVScrollBox(wnd); if (vscrollbox != wnd->VScrollBox) MoveScrollBox(wnd, vscrollbox); @@ -283,13 +283,13 @@ static BOOL ScrollMsg(DFWINDOW wnd, PARAM p1) return TRUE; } -/* ------------ HORIZSCROLL Message -------------- */ -static BOOL HorizScrollMsg(DFWINDOW wnd, PARAM p1) +/* ------------ DFM_HORIZSCROLL Message -------------- */ +static BOOL HorizScrollMsg(DFWINDOW wnd, DF_PARAM p1) { /* --- horizontal scroll one column --- */ if (p1) { /* --- scroll left --- */ - if (wnd->wleft + ClientWidth(wnd)-1 >= wnd->textwidth) + if (wnd->wleft + DfClientWidth(wnd)-1 >= wnd->textwidth) return FALSE; wnd->wleft++; } @@ -299,65 +299,65 @@ static BOOL HorizScrollMsg(DFWINDOW wnd, PARAM p1) return FALSE; --wnd->wleft; } - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); return TRUE; } -/* ------------ SCROLLPAGE Message -------------- */ -static void ScrollPageMsg(DFWINDOW wnd, PARAM p1) +/* ------------ DFM_SCROLLPAGE Message -------------- */ +static void ScrollPageMsg(DFWINDOW wnd, DF_PARAM p1) { /* --- vertical scroll one page --- */ if ((int) p1 == FALSE) { /* ---- page up ---- */ if (wnd->wtop) - wnd->wtop -= ClientHeight(wnd); + wnd->wtop -= DfClientHeight(wnd); } else { /* ---- page down ---- */ - if (wnd->wtop+ClientHeight(wnd) < wnd->wlines) { - wnd->wtop += ClientHeight(wnd); - if (wnd->wtop>wnd->wlines-ClientHeight(wnd)) - wnd->wtop=wnd->wlines-ClientHeight(wnd); + if (wnd->wtop+DfClientHeight(wnd) < wnd->wlines) { + wnd->wtop += DfClientHeight(wnd); + if (wnd->wtop>wnd->wlines-DfClientHeight(wnd)) + wnd->wtop=wnd->wlines-DfClientHeight(wnd); } } if (wnd->wtop < 0) wnd->wtop = 0; - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } /* ------------ HORIZSCROLLPAGE Message -------------- */ -static void HorizScrollPageMsg(DFWINDOW wnd, PARAM p1) +static void HorizScrollPageMsg(DFWINDOW wnd, DF_PARAM p1) { /* --- horizontal scroll one page --- */ if ((int) p1 == FALSE) /* ---- page left ----- */ - wnd->wleft -= ClientWidth(wnd); + wnd->wleft -= DfClientWidth(wnd); else { /* ---- page right ----- */ - wnd->wleft += ClientWidth(wnd); - if (wnd->wleft > wnd->textwidth-ClientWidth(wnd)) - wnd->wleft = wnd->textwidth-ClientWidth(wnd); + wnd->wleft += DfClientWidth(wnd); + if (wnd->wleft > wnd->textwidth-DfClientWidth(wnd)) + wnd->wleft = wnd->textwidth-DfClientWidth(wnd); } if (wnd->wleft < 0) wnd->wleft = 0; - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } -/* ------------ SCROLLDOC Message -------------- */ -static void ScrollDocMsg(DFWINDOW wnd, PARAM p1) +/* ------------ DFM_SCROLLDOC Message -------------- */ +static void ScrollDocMsg(DFWINDOW wnd, DF_PARAM p1) { /* --- scroll to beginning or end of document --- */ if ((int) p1) wnd->wtop = wnd->wleft = 0; - else if (wnd->wtop+ClientHeight(wnd) < wnd->wlines){ - wnd->wtop = wnd->wlines-ClientHeight(wnd); + else if (wnd->wtop+DfClientHeight(wnd) < wnd->wlines){ + wnd->wtop = wnd->wlines-DfClientHeight(wnd); wnd->wleft = 0; } - DfSendMessage(wnd, PAINT, 0, 0); + DfSendMessage(wnd, DFM_PAINT, 0, 0); } -/* ------------ PAINT Message -------------- */ -static void PaintMsg(DFWINDOW wnd, PARAM p1, PARAM p2) +/* ------------ DFM_PAINT Message -------------- */ +static void PaintMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2) { /* ------ paint the client area ----- */ DFRECT rc, rcc; @@ -366,102 +366,102 @@ static void PaintMsg(DFWINDOW wnd, PARAM p1, PARAM p2) /* ----- build the rectangle to paint ----- */ if ((DFRECT *)p1 == NULL) - rc=RelativeWindowRect(wnd, WindowRect(wnd)); + rc=DfRelativeWindowRect(wnd, DfWindowRect(wnd)); else rc= *(DFRECT *)p1; - if (TestAttribute(wnd, HASBORDER) && - RectRight(rc) >= WindowWidth(wnd)-1) { - if (RectLeft(rc) >= WindowWidth(wnd)-1) + if (DfTestAttribute(wnd, DF_HASBORDER) && + DfRectRight(rc) >= DfWindowWidth(wnd)-1) { + if (DfRectLeft(rc) >= DfWindowWidth(wnd)-1) return; - RectRight(rc) = WindowWidth(wnd)-2; + DfRectRight(rc) = DfWindowWidth(wnd)-2; } - rcc = AdjustRectangle(wnd, rc); + rcc = DfAdjustRectangle(wnd, rc); - if (!p2 && wnd != inFocus) - ClipString++; + if (!p2 && wnd != DfInFocus) + DfClipString++; /* ----- blank line for padding ----- */ memset(blankline, ' ', DfGetScreenWidth()); - blankline[RectRight(rcc)+1] = '\0'; + blankline[DfRectRight(rcc)+1] = '\0'; - /* ------- each line within rectangle ------ */ - for (y = RectTop(rc); y <= RectBottom(rc); y++){ + /* ------- each line DfWithin rectangle ------ */ + for (y = DfRectTop(rc); y <= DfRectBottom(rc); y++){ int yy; /* ---- test outside of Client area ---- */ - if (TestAttribute(wnd, - HASBORDER | HASTITLEBAR)) { - if (y < TopBorderAdj(wnd)) + if (DfTestAttribute(wnd, + DF_HASBORDER | DF_HASTITLEBAR)) { + if (y < DfTopBorderAdj(wnd)) continue; - if (y > WindowHeight(wnd)-2) + if (y > DfWindowHeight(wnd)-2) continue; } - yy = y-TopBorderAdj(wnd); + yy = y-DfTopBorderAdj(wnd); if (yy < wnd->wlines-wnd->wtop) /* ---- paint a text line ---- */ - WriteTextLine(wnd, &rc, + DfWriteTextLine(wnd, &rc, yy+wnd->wtop, FALSE); else { /* ---- paint a blank line ---- */ - SetStandardColor(wnd); - writeline(wnd, blankline+RectLeft(rcc), - RectLeft(rcc)+BorderAdj(wnd), y, FALSE); + DfSetStandardColor(wnd); + DfWriteLine(wnd, blankline+DfRectLeft(rcc), + DfRectLeft(rcc)+DfBorderAdj(wnd), y, FALSE); } } /* ------- position the scroll box ------- */ - if (TestAttribute(wnd, VSCROLLBAR|HSCROLLBAR)) { + if (DfTestAttribute(wnd, DF_VSCROLLBAR|DF_HSCROLLBAR)) { int hscrollbox = ComputeHScrollBox(wnd); int vscrollbox = ComputeVScrollBox(wnd); if (hscrollbox != wnd->HScrollBox || vscrollbox != wnd->VScrollBox) { wnd->HScrollBox = hscrollbox; wnd->VScrollBox = vscrollbox; - DfSendMessage(wnd, BORDER, p1, 0); + DfSendMessage(wnd, DFM_BORDER, p1, 0); } } - if (!p2 && wnd != inFocus) - --ClipString; + if (!p2 && wnd != DfInFocus) + --DfClipString; } -/* ------------ CLOSE_WINDOW Message -------------- */ +/* ------------ DFM_CLOSE_WINDOW Message -------------- */ static void CloseWindowMsg(DFWINDOW wnd) { - DfSendMessage(wnd, CLEARTEXT, 0, 0); + DfSendMessage(wnd, DFM_CLEARTEXT, 0, 0); if (wnd->TextPointers != NULL) { free(wnd->TextPointers); wnd->TextPointers = NULL; } } -/* ----------- TEXTBOX Message-processing Module ----------- */ -int TextBoxProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +/* ----------- DF_TEXTBOX Message-processing Module ----------- */ +int DfTextBoxProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { switch (msg) { - case CREATE_WINDOW: + case DFM_CREATE_WINDOW: wnd->HScrollBox = wnd->VScrollBox = 1; - ClearTextPointers(wnd); + DfClearTextPointers(wnd); break; - case ADDTEXT: + case DFM_ADDTEXT: return AddTextMsg(wnd, (char *) p1); - case DELETETEXT: + case DFM_DELETETEXT: DeleteTextMsg(wnd, (int) p1); return TRUE; - case INSERTTEXT: + case DFM_INSERTTEXT: InsertTextMsg(wnd, (char *) p1, (int) p2); return TRUE; - case SETTEXT: + case DFM_SETTEXT: SetTextMsg(wnd, (char *) p1); return TRUE; - case CLEARTEXT: + case DFM_CLEARTEXT: ClearTextMsg(wnd); break; - case KEYBOARD: - if (WindowMoving || WindowSizing) + case DFM_KEYBOARD: + if (DfWindowMoving || DfWindowSizing) break; if (KeyboardMsg(wnd, p1)) return TRUE; break; - case LEFT_BUTTON: - if (WindowSizing || WindowMoving) + case DFM_LEFT_BUTTON: + if (DfWindowSizing || DfWindowMoving) return FALSE; if (LeftButtonMsg(wnd, p1, p2)) return TRUE; @@ -473,41 +473,41 @@ int TextBoxProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) case DFM_BUTTON_RELEASED: ButtonReleasedMsg(wnd); break; - case SCROLL: + case DFM_SCROLL: return ScrollMsg(wnd, p1); - case HORIZSCROLL: + case DFM_HORIZSCROLL: return HorizScrollMsg(wnd, p1); - case SCROLLPAGE: + case DFM_SCROLLPAGE: ScrollPageMsg(wnd, p1); return TRUE; - case HORIZPAGE: + case DFM_HORIZPAGE: HorizScrollPageMsg(wnd, p1); return TRUE; - case SCROLLDOC: + case DFM_SCROLLDOC: ScrollDocMsg(wnd, p1); return TRUE; - case PAINT: - if (isVisible(wnd)) + case DFM_PAINT: + if (DfIsVisible(wnd)) { PaintMsg(wnd, p1, p2); return FALSE; } break; - case CLOSE_WINDOW: + case DFM_CLOSE_WINDOW: CloseWindowMsg(wnd); break; default: break; } - return BaseWndProc(TEXTBOX, wnd, msg, p1, p2); + return DfBaseWndProc(DF_TEXTBOX, wnd, msg, p1, p2); } /* ------ compute the vertical scroll box position from the text pointers --------- */ static int ComputeVScrollBox(DFWINDOW wnd) { - int pagelen = wnd->wlines - ClientHeight(wnd); - int barlen = ClientHeight(wnd)-2; + int pagelen = wnd->wlines - DfClientHeight(wnd); + int barlen = DfClientHeight(wnd)-2; int lines_tick; int vscrollbox; @@ -519,9 +519,9 @@ static int ComputeVScrollBox(DFWINDOW wnd) else lines_tick = barlen / pagelen; vscrollbox = 1 + (wnd->wtop / lines_tick); - if (vscrollbox > ClientHeight(wnd)-2 || - wnd->wtop + ClientHeight(wnd) >= wnd->wlines) - vscrollbox = ClientHeight(wnd)-2; + if (vscrollbox > DfClientHeight(wnd)-2 || + wnd->wtop + DfClientHeight(wnd) >= wnd->wlines) + vscrollbox = DfClientHeight(wnd)-2; } return vscrollbox; } @@ -529,13 +529,13 @@ static int ComputeVScrollBox(DFWINDOW wnd) /* ---- compute top text line from scroll box position ---- */ static void ComputeWindowTop(DFWINDOW wnd) { - int pagelen = wnd->wlines - ClientHeight(wnd); + int pagelen = wnd->wlines - DfClientHeight(wnd); if (wnd->VScrollBox == 0) wnd->wtop = 0; - else if (wnd->VScrollBox == ClientHeight(wnd)-2) + else if (wnd->VScrollBox == DfClientHeight(wnd)-2) wnd->wtop = pagelen; else { - int barlen = ClientHeight(wnd)-2; + int barlen = DfClientHeight(wnd)-2; int lines_tick; if (pagelen > barlen) @@ -543,7 +543,7 @@ static void ComputeWindowTop(DFWINDOW wnd) else lines_tick = pagelen ? (barlen / pagelen) : 0; wnd->wtop = (wnd->VScrollBox-1) * lines_tick; - if (wnd->wtop + ClientHeight(wnd) > wnd->wlines) + if (wnd->wtop + DfClientHeight(wnd) > wnd->wlines) wnd->wtop = pagelen; } if (wnd->wtop < 0) @@ -554,8 +554,8 @@ static void ComputeWindowTop(DFWINDOW wnd) the text pointers --------- */ static int ComputeHScrollBox(DFWINDOW wnd) { - int pagewidth = wnd->textwidth - ClientWidth(wnd); - int barlen = ClientWidth(wnd)-2; + int pagewidth = wnd->textwidth - DfClientWidth(wnd); + int barlen = DfClientWidth(wnd)-2; int chars_tick; int hscrollbox; @@ -567,9 +567,9 @@ static int ComputeHScrollBox(DFWINDOW wnd) else chars_tick = pagewidth ? (barlen / pagewidth) : 0; hscrollbox = 1 + (chars_tick ? (wnd->wleft / chars_tick) : 0); - if (hscrollbox > ClientWidth(wnd)-2 || - wnd->wleft + ClientWidth(wnd) >= wnd->textwidth) - hscrollbox = ClientWidth(wnd)-2; + if (hscrollbox > DfClientWidth(wnd)-2 || + wnd->wleft + DfClientWidth(wnd) >= wnd->textwidth) + hscrollbox = DfClientWidth(wnd)-2; } return hscrollbox; } @@ -577,14 +577,14 @@ static int ComputeHScrollBox(DFWINDOW wnd) /* ---- compute left column from scroll box position ---- */ static void ComputeWindowLeft(DFWINDOW wnd) { - int pagewidth = wnd->textwidth - ClientWidth(wnd); + int pagewidth = wnd->textwidth - DfClientWidth(wnd); if (wnd->HScrollBox == 0) wnd->wleft = 0; - else if (wnd->HScrollBox == ClientWidth(wnd)-2) + else if (wnd->HScrollBox == DfClientWidth(wnd)-2) wnd->wleft = pagewidth; else { - int barlen = ClientWidth(wnd)-2; + int barlen = DfClientWidth(wnd)-2; int chars_tick; if (pagewidth > barlen) @@ -592,7 +592,7 @@ static void ComputeWindowLeft(DFWINDOW wnd) else chars_tick = barlen / pagewidth; wnd->wleft = (wnd->HScrollBox-1) * chars_tick; - if (wnd->wleft + ClientWidth(wnd) > wnd->textwidth) + if (wnd->wleft + DfClientWidth(wnd) > wnd->textwidth) wnd->wleft = pagewidth; } if (wnd->wleft < 0) @@ -605,19 +605,19 @@ static char *GetTextLine(DFWINDOW wnd, int selection) char *line; int len = 0; char *cp, *cp1; - cp = cp1 = TextLine(wnd, selection); + cp = cp1 = DfTextLine(wnd, selection); while (*cp && *cp != '\n') { len++; cp++; } - line = DFmalloc(len+7); + line = DfMalloc(len+7); memmove(line, cp1, len); line[len] = '\0'; return line; } /* ------- write a line of text to a textbox window ------- */ -void WriteTextLine(DFWINDOW wnd, DFRECT *rcc, int y, BOOL reverse) +void DfWriteTextLine(DFWINDOW wnd, DFRECT *rcc, int y, BOOL _reverse) { int len = 0; int dif = 0; @@ -629,36 +629,36 @@ void WriteTextLine(DFWINDOW wnd, DFRECT *rcc, int y, BOOL reverse) BOOL trunc = FALSE; /* ------ make sure y is inside the window ----- */ - if (y < wnd->wtop || y >= wnd->wtop+ClientHeight(wnd)) + if (y < wnd->wtop || y >= wnd->wtop+DfClientHeight(wnd)) return; - /* ---- build the retangle within which can write ---- */ + /* ---- build the retangle DfWithin which can write ---- */ if (rcc == NULL) { - rc = RelativeWindowRect(wnd, WindowRect(wnd)); - if (TestAttribute(wnd, HASBORDER) && - RectRight(rc) >= WindowWidth(wnd)-1) - RectRight(rc) = WindowWidth(wnd)-2; + rc = DfRelativeWindowRect(wnd, DfWindowRect(wnd)); + if (DfTestAttribute(wnd, DF_HASBORDER) && + DfRectRight(rc) >= DfWindowWidth(wnd)-1) + DfRectRight(rc) = DfWindowWidth(wnd)-2; } else rc = *rcc; - /* ----- make sure rectangle is within window ------ */ - if (RectLeft(rc) >= WindowWidth(wnd)-1) + /* ----- make sure rectangle is DfWithin window ------ */ + if (DfRectLeft(rc) >= DfWindowWidth(wnd)-1) return; - if (RectRight(rc) == 0) + if (DfRectRight(rc) == 0) return; - rc = AdjustRectangle(wnd, rc); - if (y-wnd->wtopwtop>RectBottom(rc)) + rc = DfAdjustRectangle(wnd, rc); + if (y-wnd->wtopwtop>DfRectBottom(rc)) return; /* --- get the text and length of the text line --- */ lp = svlp = GetTextLine(wnd, y); if (svlp == NULL) return; - lnlen = LineLength(lp); + lnlen = DfLineLength(lp); - /* -------- insert block color change controls ------- */ - if (TextBlockMarked(wnd)) { + /* -------- insert block DfColor change controls ------- */ + if (DfTextBlockMarked(wnd)) { int bbl = wnd->BlkBegLine; int bel = wnd->BlkEndLine; int bbc = wnd->BlkBegCol; @@ -690,24 +690,24 @@ void WriteTextLine(DFWINDOW wnd, DFRECT *rcc, int y, BOOL reverse) strcpy(lp, " "); blkend++; } - /* ----- insert the reset color token ----- */ + /* ----- insert the reset DfColor token ----- */ memmove(lp+blkend+1,lp+blkend,strlen(lp+blkend)+1); - lp[blkend] = RESETCOLOR; - /* ----- insert the change color token ----- */ + lp[blkend] = DF_RESETCOLOR; + /* ----- insert the change DfColor token ----- */ memmove(lp+blkbeg+3,lp+blkbeg,strlen(lp+blkbeg)+1); - lp[blkbeg] = CHANGECOLOR; - /* ----- insert the color tokens ----- */ - SetReverseColor(wnd); - lp[blkbeg+1] = foreground | 0x80; - lp[blkbeg+2] = background | 0x80; + lp[blkbeg] = DF_CHANGECOLOR; + /* ----- insert the DfColor tokens ----- */ + DfSetReverseColor(wnd); + lp[blkbeg+1] = DfForeground | 0x80; + lp[blkbeg+2] = DfBackground | 0x80; lnlen += 4; } } - /* - make sure left margin doesn't overlap color change - */ + /* - make sure left margin doesn't overlap DfColor change - */ for (i = 0; i < wnd->wleft+3; i++) { if (*(lp+i) == '\0') break; - if (*(unsigned char *)(lp + i) == RESETCOLOR) + if (*(unsigned char *)(lp + i) == DF_RESETCOLOR) break; } if (*(lp+i) && i < wnd->wleft+3) { @@ -717,11 +717,11 @@ void WriteTextLine(DFWINDOW wnd, DFRECT *rcc, int y, BOOL reverse) lp += 4; } else { - /* --- it does, shift the color change over --- */ + /* --- it does, shift the DfColor change over --- */ for (i = 0; i < wnd->wleft; i++) { if (*(lp+i) == '\0') break; - if (*(unsigned char *)(lp + i) == CHANGECOLOR) { + if (*(unsigned char *)(lp + i) == DF_CHANGECOLOR) { *(lp+wnd->wleft+2) = *(lp+i+2); *(lp+wnd->wleft+1) = *(lp+i+1); *(lp+wnd->wleft) = *(lp+i); @@ -735,29 +735,29 @@ void WriteTextLine(DFWINDOW wnd, DFRECT *rcc, int y, BOOL reverse) lnlen = 0; else lp += wnd->wleft; - if (lnlen > RectLeft(rc)) { + if (lnlen > DfRectLeft(rc)) { /* ---- the line exceeds the rectangle ---- */ - int ct = RectLeft(rc); + int ct = DfRectLeft(rc); char *initlp = lp; /* --- point to end of clipped line --- */ while (ct) { - if (*(unsigned char *)lp == CHANGECOLOR) + if (*(unsigned char *)lp == DF_CHANGECOLOR) lp += 3; - else if (*(unsigned char *)lp == RESETCOLOR) + else if (*(unsigned char *)lp == DF_RESETCOLOR) lp++; else lp++, --ct; } - if (RectLeft(rc)) { + if (DfRectLeft(rc)) { char *lpp = lp; while (*lpp) { - if (*(unsigned char*)lpp==CHANGECOLOR) + if (*(unsigned char*)lpp==DF_CHANGECOLOR) break; - if (*(unsigned char*)lpp==RESETCOLOR) { + if (*(unsigned char*)lpp==DF_RESETCOLOR) { lpp = lp; while (lpp >= initlp) { if (*(unsigned char *)lpp == - CHANGECOLOR) { + DF_CHANGECOLOR) { lp -= 3; memmove(lp,lpp,3); break; @@ -769,8 +769,8 @@ void WriteTextLine(DFWINDOW wnd, DFRECT *rcc, int y, BOOL reverse) lpp++; } } - lnlen = LineLength(lp); - len = min(lnlen, RectWidth(rc)); + lnlen = DfLineLength(lp); + len = min(lnlen, DfRectWidth(rc)); dif = strlen(lp) - lnlen; len += dif; if (len > 0) @@ -778,31 +778,31 @@ void WriteTextLine(DFWINDOW wnd, DFRECT *rcc, int y, BOOL reverse) } } /* -------- pad the line --------- */ - while (len < RectWidth(rc)+dif) + while (len < DfRectWidth(rc)+dif) line[len++] = ' '; line[len] = '\0'; dif = 0; - /* ------ establish the line's main color ----- */ - if (reverse) { + /* ------ establish the line's main DfColor ----- */ + if (_reverse) { char *cp = line; - SetReverseColor(wnd); - while ((cp = strchr(cp, CHANGECOLOR)) != NULL) { + DfSetReverseColor(wnd); + while ((cp = strchr(cp, DF_CHANGECOLOR)) != NULL) { cp += 2; - *cp++ = background | 0x80; + *cp++ = DfBackground | 0x80; } - if (*(unsigned char *)line == CHANGECOLOR) + if (*(unsigned char *)line == DF_CHANGECOLOR) dif = 3; } else - SetStandardColor(wnd); + DfSetStandardColor(wnd); /* ------- display the line -------- */ - writeline(wnd, line+dif, - RectLeft(rc)+BorderAdj(wnd), - y-wnd->wtop+TopBorderAdj(wnd), FALSE); + DfWriteLine(wnd, line+dif, + DfRectLeft(rc)+DfBorderAdj(wnd), + y-wnd->wtop+DfTopBorderAdj(wnd), FALSE); free(svlp); } -void MarkTextBlock(DFWINDOW wnd, int BegLine, int BegCol, +void DfMarkTextBlock(DFWINDOW wnd, int BegLine, int BegCol, int EndLine, int EndCol) { wnd->BlkBegLine = BegLine; @@ -812,16 +812,16 @@ void MarkTextBlock(DFWINDOW wnd, int BegLine, int BegCol, } /* ----- clear and initialize text line pointer array ----- */ -void ClearTextPointers(DFWINDOW wnd) +void DfClearTextPointers(DFWINDOW wnd) { - wnd->TextPointers = DFrealloc(wnd->TextPointers, sizeof(int)); + wnd->TextPointers = DfRealloc(wnd->TextPointers, sizeof(int)); *(wnd->TextPointers) = 0; } #define INITLINES 100 /* ---- build array of pointers to text lines ---- */ -void BuildTextPointers(DFWINDOW wnd) +void DfBuildTextPointers(DFWINDOW wnd) { char *cp = wnd->text, *cp1; int incrs = INITLINES; @@ -830,7 +830,7 @@ void BuildTextPointers(DFWINDOW wnd) while (*cp) { if (incrs == INITLINES) { incrs = 0; - wnd->TextPointers = DFrealloc(wnd->TextPointers, + wnd->TextPointers = DfRealloc(wnd->TextPointers, (wnd->wlines + INITLINES) * sizeof(int)); } off = (unsigned int) ((unsigned int)cp - (unsigned int)wnd->text); @@ -848,16 +848,16 @@ void BuildTextPointers(DFWINDOW wnd) static void MoveScrollBox(DFWINDOW wnd, int vscrollbox) { - foreground = FrameForeground(wnd); - background = FrameBackground(wnd); - wputch(wnd, SCROLLBARCHAR, WindowWidth(wnd)-1, + DfForeground = DfFrameForeground(wnd); + DfBackground = DfFrameBackground(wnd); + DfWPutch(wnd, DF_SCROLLBARCHAR, DfWindowWidth(wnd)-1, wnd->VScrollBox+1); - wputch(wnd, SCROLLBOXCHAR, WindowWidth(wnd)-1, + DfWPutch(wnd, DF_SCROLLBOXCHAR, DfWindowWidth(wnd)-1, vscrollbox+1); wnd->VScrollBox = vscrollbox; } -int TextLineNumber(DFWINDOW wnd, char *lp) +int DfTextLineNumber(DFWINDOW wnd, char *lp) { int lineno; char *cp; diff --git a/rosapps/dflat32/video.c b/rosapps/dflat32/video.c index 51398402919..bbed0cccfbf 100644 --- a/rosapps/dflat32/video.c +++ b/rosapps/dflat32/video.c @@ -4,25 +4,25 @@ #define clr(fg,bg) ((fg)|((bg)<<4)) -BOOL ClipString; +BOOL DfClipString; /* -- read a rectangle of video memory into a save buffer -- */ -void GetVideo(DFRECT rc, PCHAR_INFO bf) +void DfGetVideo(DFRECT rc, PCHAR_INFO bf) { COORD Size; COORD Pos; SMALL_RECT Rect; - Size.X = RectRight(rc) - RectLeft(rc) + 1; - Size.Y = RectBottom(rc) - RectTop(rc) + 1; + Size.X = DfRectRight(rc) - DfRectLeft(rc) + 1; + Size.Y = DfRectBottom(rc) - DfRectTop(rc) + 1; Pos.X = 0; Pos.Y = 0; - Rect.Left = RectLeft(rc); - Rect.Top = RectTop(rc); - Rect.Right = RectRight(rc); - Rect.Bottom = RectBottom(rc); + Rect.Left = DfRectLeft(rc); + Rect.Top = DfRectTop(rc); + Rect.Right = DfRectRight(rc); + Rect.Bottom = DfRectBottom(rc); ReadConsoleOutput (GetStdHandle (STD_OUTPUT_HANDLE), bf, @@ -32,22 +32,22 @@ void GetVideo(DFRECT rc, PCHAR_INFO bf) } /* -- write a rectangle of video memory from a save buffer -- */ -void StoreVideo(DFRECT rc, PCHAR_INFO bf) +void DfStoreVideo(DFRECT rc, PCHAR_INFO bf) { COORD Size; COORD Pos; SMALL_RECT Rect; - Size.X = RectRight(rc) - RectLeft(rc) + 1; - Size.Y = RectBottom(rc) - RectTop(rc) + 1; + Size.X = DfRectRight(rc) - DfRectLeft(rc) + 1; + Size.Y = DfRectBottom(rc) - DfRectTop(rc) + 1; Pos.X = 0; Pos.Y = 0; - Rect.Left = RectLeft(rc); - Rect.Top = RectTop(rc); - Rect.Right = RectRight(rc); - Rect.Bottom = RectBottom(rc); + Rect.Left = DfRectLeft(rc); + Rect.Top = DfRectTop(rc); + Rect.Right = DfRectRight(rc); + Rect.Bottom = DfRectBottom(rc); WriteConsoleOutput (GetStdHandle (STD_OUTPUT_HANDLE), bf, @@ -57,7 +57,7 @@ void StoreVideo(DFRECT rc, PCHAR_INFO bf) } /* -------- read a character of video memory ------- */ -char GetVideoChar(int x, int y) +char DfGetVideoChar(int x, int y) { COORD pos; DWORD dwRead; @@ -76,12 +76,12 @@ char GetVideoChar(int x, int y) } /* -------- write a character of video memory ------- */ -void PutVideoChar(int x, int y, int ch) +void DfPutVideoChar(int x, int y, int ch) { COORD pos; DWORD dwWritten; - if (x < sScreenWidth && y < sScreenHeight) + if (x < DfScreenWidth && y < DfScreenHeight) { pos.X = x; pos.Y = y; @@ -94,69 +94,69 @@ void PutVideoChar(int x, int y, int ch) } } -BOOL CharInView(DFWINDOW wnd, int x, int y) +BOOL DfCharInView(DFWINDOW wnd, int x, int y) { - DFWINDOW nwnd = NextWindow(wnd); + DFWINDOW nwnd = DfNextWindow(wnd); DFWINDOW pwnd; DFRECT rc; - int x1 = GetLeft(wnd)+x; - int y1 = GetTop(wnd)+y; + int x1 = DfGetLeft(wnd)+x; + int y1 = DfGetTop(wnd)+y; - if (!TestAttribute(wnd, VISIBLE)) + if (!DfTestAttribute(wnd, DF_VISIBLE)) return FALSE; - if (!TestAttribute(wnd, NOCLIP)) + if (!DfTestAttribute(wnd, DF_NOCLIP)) { - DFWINDOW wnd1 = GetParent(wnd); + DFWINDOW wnd1 = DfGetParent(wnd); while (wnd1 != NULL) { /* clip character to parent's borders */ - if (!TestAttribute(wnd1, VISIBLE)) + if (!DfTestAttribute(wnd1, DF_VISIBLE)) return FALSE; - if (!InsideRect(x1, y1, ClientRect(wnd1))) + if (!DfInsideRect(x1, y1, DfClientRect(wnd1))) return FALSE; - wnd1 = GetParent(wnd1); + wnd1 = DfGetParent(wnd1); } } while (nwnd != NULL) { - if (!isHidden(nwnd) && !isAncestor(wnd, nwnd)) + if (!isHidden(nwnd) && !DfIsAncestor(wnd, nwnd)) { - rc = WindowRect(nwnd); - if (TestAttribute(nwnd, SHADOW)) + rc = DfWindowRect(nwnd); + if (DfTestAttribute(nwnd, DF_SHADOW)) { - RectBottom(rc)++; - RectRight(rc)++; + DfRectBottom(rc)++; + DfRectRight(rc)++; } - if (!TestAttribute(nwnd, NOCLIP)) + if (!DfTestAttribute(nwnd, DF_NOCLIP)) { pwnd = nwnd; - while (GetParent(pwnd)) + while (DfGetParent(pwnd)) { - pwnd = GetParent(pwnd); - rc = subRectangle(rc, ClientRect(pwnd)); + pwnd = DfGetParent(pwnd); + rc = DfSubRectangle(rc, DfClientRect(pwnd)); } } - if (InsideRect(x1,y1,rc)) + if (DfInsideRect(x1,y1,rc)) return FALSE; } - nwnd = NextWindow(nwnd); + nwnd = DfNextWindow(nwnd); } - return (x1 < sScreenWidth && y1 < sScreenHeight); + return (x1 < DfScreenWidth && y1 < DfScreenHeight); } /* -------- write a character to a window ------- */ -void wputch(DFWINDOW wnd, int c, int x, int y) +void DfWPutch(DFWINDOW wnd, int c, int x, int y) { - if (CharInView(wnd, x, y)) + if (DfCharInView(wnd, x, y)) { DWORD dwWritten; COORD pos; WORD Attr; - pos.X = GetLeft(wnd)+x; - pos.Y = GetTop(wnd)+y; + pos.X = DfGetLeft(wnd)+x; + pos.Y = DfGetTop(wnd)+y; - Attr = clr(foreground, background); + Attr = clr(DfForeground, DfBackground); WriteConsoleOutputAttribute (GetStdHandle(STD_OUTPUT_HANDLE), &Attr, @@ -173,46 +173,46 @@ void wputch(DFWINDOW wnd, int c, int x, int y) } /* ------- write a string to a window ---------- */ -void wputs(DFWINDOW wnd, void *s, int x, int y) +void DfWPuts(DFWINDOW wnd, void *s, int x, int y) { - int x1 = GetLeft(wnd)+x; + int x1 = DfGetLeft(wnd)+x; int x2 = x1; - int y1 = GetTop(wnd)+y; + int y1 = DfGetTop(wnd)+y; - if (x1 < sScreenWidth && y1 < sScreenHeight && isVisible(wnd)) + if (x1 < DfScreenWidth && y1 < DfScreenHeight && DfIsVisible(wnd)) { char ln[200]; WORD attr[200]; char *cp = ln; WORD *ap = attr; unsigned char *str = s; - int fg = foreground; - int bg = background; + int fg = DfForeground; + int bg = DfBackground; int len; int off = 0; while (*str) { - if (*str == CHANGECOLOR) + if (*str == DF_CHANGECOLOR) { str++; - foreground = (*str++) & 0x7f; - background = (*str++) & 0x7f; + DfForeground = (*str++) & 0x7f; + DfBackground = (*str++) & 0x7f; continue; } - if (*str == RESETCOLOR) + if (*str == DF_RESETCOLOR) { - foreground = fg & 0x7f; - background = bg & 0x7f; + DfForeground = fg & 0x7f; + DfBackground = bg & 0x7f; str++; continue; } *cp = (*str & 255); - *ap = (WORD)clr(foreground, background); -// *cp1 = (*str & 255) | (clr(foreground, background) << 8); -// if (ClipString) -// if (!CharInView(wnd, x, y)) + *ap = (WORD)clr(DfForeground, DfBackground); +// *cp1 = (*str & 255) | (clr(DfForeground, DfBackground) << 8); +// if (DfClipString) +// if (!DfCharInView(wnd, x, y)) // *cp1 = peek(video_address, vad(x2,y1)); cp++; ap++; @@ -220,28 +220,28 @@ void wputs(DFWINDOW wnd, void *s, int x, int y) x++; x2++; } - foreground = fg; - background = bg; + DfForeground = fg; + DfBackground = bg; len = (int)(cp-ln); - if (x1+len > sScreenWidth) - len = sScreenWidth-x1; + if (x1+len > DfScreenWidth) + len = DfScreenWidth-x1; - if (!ClipString && !TestAttribute(wnd, NOCLIP)) + if (!DfClipString && !DfTestAttribute(wnd, DF_NOCLIP)) { - /* -- clip the line to within ancestor windows -- */ - DFRECT rc = WindowRect(wnd); - DFWINDOW nwnd = GetParent(wnd); + /* -- clip the line to DfWithin ancestor windows -- */ + DFRECT rc = DfWindowRect(wnd); + DFWINDOW nwnd = DfGetParent(wnd); while (len > 0 && nwnd != NULL) { - if (!isVisible(nwnd)) + if (!DfIsVisible(nwnd)) { len = 0; break; } - rc = subRectangle(rc, ClientRect(nwnd)); - nwnd = GetParent(nwnd); + rc = DfSubRectangle(rc, DfClientRect(nwnd)); + nwnd = DfGetParent(nwnd); } - while (len > 0 && !InsideRect(x1+off,y1,rc)) + while (len > 0 && !DfInsideRect(x1+off,y1,rc)) { off++; --len; @@ -249,7 +249,7 @@ void wputs(DFWINDOW wnd, void *s, int x, int y) if (len > 0) { x2 = x1+len-1; - while (len && !InsideRect(x2,y1,rc)) + while (len && !DfInsideRect(x2,y1,rc)) { --x2; --len; @@ -280,36 +280,36 @@ void wputs(DFWINDOW wnd, void *s, int x, int y) } /* --------- scroll the window. d: 1 = up, 0 = dn ---------- */ -void scroll_window(DFWINDOW wnd, DFRECT rc, int d) +void DfScrollWindow(DFWINDOW wnd, DFRECT rc, int d) { - if (RectTop(rc) != RectBottom(rc)) + if (DfRectTop(rc) != DfRectBottom(rc)) { CHAR_INFO ciFill; SMALL_RECT rcScroll; SMALL_RECT rcClip; COORD pos; - ciFill.Attributes = clr(WndForeground(wnd),WndBackground(wnd)); + ciFill.Attributes = clr(DfWndForeground(wnd),DfWndBackground(wnd)); ciFill.Char.AsciiChar = ' '; - rcScroll.Left = RectLeft(rc); - rcScroll.Right = RectRight(rc); - rcScroll.Top = RectTop(rc); - rcScroll.Bottom = RectBottom(rc); + rcScroll.Left = DfRectLeft(rc); + rcScroll.Right = DfRectRight(rc); + rcScroll.Top = DfRectTop(rc); + rcScroll.Bottom = DfRectBottom(rc); rcClip = rcScroll; - pos.X = RectLeft(rc); + pos.X = DfRectLeft(rc); if (d == 0) { /* scroll 1 line down */ - pos.Y = RectTop(rc)+1; + pos.Y = DfRectTop(rc)+1; } else { /* scroll 1 line up */ - pos.Y = RectTop(rc)-1; + pos.Y = DfRectTop(rc)-1; } ScrollConsoleScreenBuffer (GetStdHandle(STD_OUTPUT_HANDLE), diff --git a/rosapps/dflat32/video.h b/rosapps/dflat32/video.h index cc8996c970f..7d985840811 100644 --- a/rosapps/dflat32/video.h +++ b/rosapps/dflat32/video.h @@ -5,14 +5,14 @@ #include "rect.h" -void GetVideo(DFRECT, PCHAR_INFO); -void StoreVideo(DFRECT, PCHAR_INFO); -void wputch(DFWINDOW, int, int, int); -char GetVideoChar(int, int); -void PutVideoChar(int, int, int); -void wputs(DFWINDOW, void *, int, int); -void scroll_window(DFWINDOW, DFRECT, int); +void DfGetVideo(DFRECT, PCHAR_INFO); +void DfStoreVideo(DFRECT, PCHAR_INFO); +void DfWPutch(DFWINDOW, int, int, int); +char DfGetVideoChar(int, int); +void DfPutVideoChar(int, int, int); +void DfWPuts(DFWINDOW, void *, int, int); +void DfScrollWindow(DFWINDOW, DFRECT, int); -#define videochar(x,y) (GetVideoChar(x,y) & 0xFF) +#define DfVideoChar(x,y) (DfGetVideoChar(x,y) & 0xFF) #endif diff --git a/rosapps/dflat32/watch.c b/rosapps/dflat32/watch.c index c7871129f66..6da6f73e95a 100644 --- a/rosapps/dflat32/watch.c +++ b/rosapps/dflat32/watch.c @@ -2,56 +2,56 @@ #include "dflat.h" -int WatchIconProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2) +int DfWatchIconProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2) { int rtn; switch (msg) { - case CREATE_WINDOW: - rtn = DefaultWndProc(wnd, msg, p1, p2); - DfSendMessage(wnd, CAPTURE_MOUSE, 0, 0); - DfSendMessage(wnd, CAPTURE_KEYBOARD, 0, 0); + case DFM_CREATE_WINDOW: + rtn = DfDefaultWndProc(wnd, msg, p1, p2); + DfSendMessage(wnd, DFM_CAPTURE_MOUSE, 0, 0); + DfSendMessage(wnd, DFM_CAPTURE_KEYBOARD, 0, 0); return rtn; - case PAINT: - SetStandardColor(wnd); - writeline(wnd, " R ", 1, 1, FALSE); + case DFM_PAINT: + DfSetStandardColor(wnd); + DfWriteLine(wnd, " R ", 1, 1, FALSE); return TRUE; - case BORDER: - rtn = DefaultWndProc(wnd, msg, p1, p2); - writeline(wnd, "Í", 2, 0, FALSE); + case DFM_BORDER: + rtn = DfDefaultWndProc(wnd, msg, p1, p2); + DfWriteLine(wnd, "Í", 2, 0, FALSE); return rtn; case MOUSE_MOVED: DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0); - DfSendMessage(wnd, MOVE, p1, p2); - DfSendMessage(wnd, SHOW_WINDOW, 0, 0); + DfSendMessage(wnd, DFM_MOVE, p1, p2); + DfSendMessage(wnd, DFM_SHOW_WINDOW, 0, 0); return TRUE; - case CLOSE_WINDOW: - DfSendMessage(wnd, RELEASE_MOUSE, 0, 0); - DfSendMessage(wnd, RELEASE_KEYBOARD, 0, 0); + case DFM_CLOSE_WINDOW: + DfSendMessage(wnd, DFM_RELEASE_MOUSE, 0, 0); + DfSendMessage(wnd, DFM_RELEASE_KEYBOARD, 0, 0); break; default: break; } - return DefaultWndProc(wnd, msg, p1, p2); + return DfDefaultWndProc(wnd, msg, p1, p2); } -DFWINDOW WatchIcon(void) +DFWINDOW DfWatchIcon(void) { int mx, my; DFWINDOW wnd; /* this won't work !! */ // DfSendMessage(NULL, DFM_CURRENT_MOUSE_CURSOR, -// (PARAM) &mx, (PARAM) &my); +// (DF_PARAM) &mx, (DF_PARAM) &my); - mx = 0;//SCREENWIDTH / 2; - mx = 0;//SCREENHEIGHT / 2; - wnd = DfCreateWindow( - BOX, + mx = 0;//DF_SCREENWIDTH / 2; + mx = 0;//DF_SCREENHEIGHT / 2; + wnd = DfDfCreateWindow( + DF_BOX, NULL, mx, my, 3, 5, NULL,NULL, - WatchIconProc, - VISIBLE | HASBORDER | SHADOW | SAVESELF); + DfWatchIconProc, + DF_VISIBLE | DF_HASBORDER | DF_SHADOW | DF_SAVESELF); return wnd; } diff --git a/rosapps/dflat32/window.c b/rosapps/dflat32/window.c index 8fa334d4ac1..e1daf41dcad 100644 --- a/rosapps/dflat32/window.c +++ b/rosapps/dflat32/window.c @@ -2,102 +2,102 @@ #include "dflat.h" -DFWINDOW inFocus = NULL; +DFWINDOW DfInFocus = NULL; -int foreground, background; /* current video colors */ +int DfForeground, DfBackground; /* current video colors */ static void TopLine(DFWINDOW, int, DFRECT); /* --------- create a window ------------ */ -DFWINDOW DfCreateWindow( +DFWINDOW DfDfCreateWindow( DFCLASS class, /* class of this window */ char *ttl, /* title or NULL */ int left, int top, /* upper left coordinates */ int height, int width, /* dimensions */ void *extension, /* pointer to additional data */ DFWINDOW parent, /* parent of this window */ - int (*wndproc)(struct window *,enum messages,PARAM,PARAM), + int (*wndproc)(struct DfWindow *,enum DfMessages,DF_PARAM,DF_PARAM), int attrib) /* window attribute */ { - DFWINDOW wnd = DFcalloc(1, sizeof(struct window)); + DFWINDOW wnd = DfCalloc(1, sizeof(struct DfWindow)); if (wnd != NULL) { int base; /* ----- height, width = -1: fill the screen ------- */ if (height == -1) - height = sScreenHeight; + height = DfScreenHeight; if (width == -1) - width = sScreenWidth; + width = DfScreenWidth; /* ----- coordinates -1, -1 = center the window ---- */ if (left == -1) - wnd->rc.lf = (sScreenWidth-width)/2; + wnd->rc.lf = (DfScreenWidth-width)/2; else wnd->rc.lf = left; if (top == -1) - wnd->rc.tp = (sScreenHeight-height)/2; + wnd->rc.tp = (DfScreenHeight-height)/2; else wnd->rc.tp = top; wnd->attrib = attrib; if (ttl != NULL) - AddAttribute(wnd, HASTITLEBAR); + DfAddAttribute(wnd, DF_HASTITLEBAR); if (wndproc == NULL) - wnd->wndproc = classdefs[class].wndproc; + wnd->wndproc = DfClassDefs[class].wndproc; else wnd->wndproc = wndproc; /* ---- derive attributes of base classes ---- */ base = class; while (base != -1) { - AddAttribute(wnd, classdefs[base].attrib); - base = classdefs[base].base; + DfAddAttribute(wnd, DfClassDefs[base].attrib); + base = DfClassDefs[base].base; } if (parent) { - if (!TestAttribute(wnd, NOCLIP)) + if (!DfTestAttribute(wnd, DF_NOCLIP)) { - /* -- keep upper left within borders of parent - */ - wnd->rc.lf = max(wnd->rc.lf,GetClientLeft(parent)); - wnd->rc.tp = max(wnd->rc.tp,GetClientTop(parent)); + /* -- keep upper left DfWithin borders of parent - */ + wnd->rc.lf = max(wnd->rc.lf,DfGetClientLeft(parent)); + wnd->rc.tp = max(wnd->rc.tp,DfGetClientTop(parent)); } } else - parent = ApplicationWindow; + parent = DfApplicationWindow; wnd->class = class; wnd->extension = extension; - wnd->rc.rt = GetLeft(wnd)+width-1; - wnd->rc.bt = GetTop(wnd)+height-1; + wnd->rc.rt = DfGetLeft(wnd)+width-1; + wnd->rc.bt = DfGetTop(wnd)+height-1; wnd->ht = height; wnd->wd = width; if (ttl != NULL) - InsertTitle(wnd, ttl); + DfInsertTitle(wnd, ttl); wnd->parent = parent; - wnd->oldcondition = wnd->condition = ISRESTORED; + wnd->oldcondition = wnd->condition = DF_SRESTORED; wnd->RestoredRC = wnd->rc; - InitWindowColors(wnd); - DfSendMessage(wnd, CREATE_WINDOW, 0, 0); - if (isVisible(wnd)) - DfSendMessage(wnd, SHOW_WINDOW, 0, 0); + DfInitWindowColors(wnd); + DfSendMessage(wnd, DFM_CREATE_WINDOW, 0, 0); + if (DfIsVisible(wnd)) + DfSendMessage(wnd, DFM_SHOW_WINDOW, 0, 0); } return wnd; } /* -------- add a title to a window --------- */ -void AddTitle(DFWINDOW wnd, char *ttl) +void DfAddTitle(DFWINDOW wnd, char *ttl) { - InsertTitle(wnd, ttl); - DfSendMessage(wnd, BORDER, 0, 0); + DfInsertTitle(wnd, ttl); + DfSendMessage(wnd, DFM_BORDER, 0, 0); } /* ----- insert a title into a window ---------- */ -void InsertTitle(DFWINDOW wnd, char *ttl) +void DfInsertTitle(DFWINDOW wnd, char *ttl) { - wnd->title=DFrealloc(wnd->title,strlen(ttl)+1); + wnd->title=DfRealloc(wnd->title,strlen(ttl)+1); strcpy(wnd->title, ttl); } static unsigned char line[300]; /* ------ write a line to video window client area ------ */ -void writeline(DFWINDOW wnd, char *str, int x, int y, BOOL pad) +void DfWriteLine(DFWINDOW wnd, char *str, int x, int y, BOOL pad) { char *cp; int len; @@ -105,100 +105,100 @@ void writeline(DFWINDOW wnd, char *str, int x, int y, BOOL pad) char wline[200]; memset(wline, 0, 200); - len = LineLength(str); + len = DfLineLength(str); dif = strlen(str) - len; - strncpy(wline, str, ClientWidth(wnd) + dif); + strncpy(wline, str, DfClientWidth(wnd) + dif); if (pad) { cp = wline+strlen(wline); - while (len++ < ClientWidth(wnd)-x) + while (len++ < DfClientWidth(wnd)-x) *cp++ = ' '; } - wputs(wnd, wline, x, y); + DfWPuts(wnd, wline, x, y); } -DFRECT AdjustRectangle(DFWINDOW wnd, DFRECT rc) +DFRECT DfAdjustRectangle(DFWINDOW wnd, DFRECT rc) { /* -------- adjust the rectangle ------- */ - if (TestAttribute(wnd, HASBORDER)) { - if (RectLeft(rc) == 0) + if (DfTestAttribute(wnd, DF_HASBORDER)) { + if (DfRectLeft(rc) == 0) --rc.rt; - else if (RectLeft(rc) < RectRight(rc) && - RectLeft(rc) < WindowWidth(wnd)+1) + else if (DfRectLeft(rc) < DfRectRight(rc) && + DfRectLeft(rc) < DfWindowWidth(wnd)+1) --rc.lf; } - if (TestAttribute(wnd, HASBORDER | HASTITLEBAR)) { - if (RectTop(rc) == 0) + if (DfTestAttribute(wnd, DF_HASBORDER | DF_HASTITLEBAR)) { + if (DfRectTop(rc) == 0) --rc.bt; - else if (RectTop(rc) < RectBottom(rc) && - RectTop(rc) < WindowHeight(wnd)+1) + else if (DfRectTop(rc) < DfRectBottom(rc) && + DfRectTop(rc) < DfWindowHeight(wnd)+1) --rc.tp; } - RectRight(rc) = max(RectLeft(rc), - min(RectRight(rc),WindowWidth(wnd))); - RectBottom(rc) = max(RectTop(rc), - min(RectBottom(rc),WindowHeight(wnd))); + DfRectRight(rc) = max(DfRectLeft(rc), + min(DfRectRight(rc),DfWindowWidth(wnd))); + DfRectBottom(rc) = max(DfRectTop(rc), + min(DfRectBottom(rc),DfWindowHeight(wnd))); return rc; } /* -------- display a window's title --------- */ -void DisplayTitle(DFWINDOW wnd, DFRECT *rcc) +void DfDisplayTitle(DFWINDOW wnd, DFRECT *rcc) { - if (GetTitle(wnd) != NULL) + if (DfGetTitle(wnd) != NULL) { - int tlen = min((int)strlen(GetTitle(wnd)), (int)WindowWidth(wnd)-2); - int tend = WindowWidth(wnd)-3-BorderAdj(wnd); + int tlen = min((int)strlen(DfGetTitle(wnd)), (int)DfWindowWidth(wnd)-2); + int tend = DfWindowWidth(wnd)-3-DfBorderAdj(wnd); DFRECT rc; if (rcc == NULL) - rc = RelativeWindowRect(wnd, WindowRect(wnd)); + rc = DfRelativeWindowRect(wnd, DfWindowRect(wnd)); else rc = *rcc; - rc = AdjustRectangle(wnd, rc); + rc = DfAdjustRectangle(wnd, rc); - if (DfSendMessage(wnd, TITLE, (PARAM) rcc, 0)) + if (DfSendMessage(wnd, DFM_TITLE, (DF_PARAM) rcc, 0)) { - if (wnd == inFocus) + if (wnd == DfInFocus) { - foreground = cfg.clr[TITLEBAR] [HILITE_COLOR] [FG]; - background = cfg.clr[TITLEBAR] [HILITE_COLOR] [BG]; + DfForeground = DfCfg.clr[DF_TITLEBAR] [DF_HILITE_COLOR] [DF_FG]; + DfBackground = DfCfg.clr[DF_TITLEBAR] [DF_HILITE_COLOR] [DF_BG]; } else { - foreground = cfg.clr[TITLEBAR] [STD_COLOR] [FG]; - background = cfg.clr[TITLEBAR] [STD_COLOR] [BG]; + DfForeground = DfCfg.clr[DF_TITLEBAR] [DF_STD_COLOR] [DF_FG]; + DfBackground = DfCfg.clr[DF_TITLEBAR] [DF_STD_COLOR] [DF_BG]; } - memset(line,' ',WindowWidth(wnd)); + memset(line,' ',DfWindowWidth(wnd)); #ifdef INCLUDE_MINIMIZE - if (wnd->condition != ISMINIMIZED) + if (wnd->condition != DF_ISMINIMIZED) #endif - strncpy (line + ((WindowWidth(wnd)-2 - tlen) / 2), + strncpy (line + ((DfWindowWidth(wnd)-2 - tlen) / 2), wnd->title, tlen); - if (TestAttribute(wnd, CONTROLBOX)) - line[2-BorderAdj(wnd)] = CONTROLBOXCHAR; - if (TestAttribute(wnd, MINMAXBOX)) + if (DfTestAttribute(wnd, DF_CONTROLBOX)) + line[2-DfBorderAdj(wnd)] = DF_CONTROLBOXCHAR; + if (DfTestAttribute(wnd, DF_MINMAXBOX)) { switch (wnd->condition) { - case ISRESTORED: + case DF_SRESTORED: #ifdef INCLUDE_MAXIMIZE - line[tend+1] = MAXPOINTER; + line[tend+1] = DF_MAXPOINTER; #endif #ifdef INCLUDE_MINIMIZE - line[tend] = MINPOINTER; + line[tend] = DF_MINPOINTER; #endif break; #ifdef INCLUDE_MINIMIZE - case ISMINIMIZED: - line[tend+1] = MAXPOINTER; + case DF_ISMINIMIZED: + line[tend+1] = DF_MAXPOINTER; break; #endif #ifdef INCLUDE_MAXIMIZE - case ISMAXIMIZED: + case DF_ISMAXIMIZED: #ifdef INCLUDE_MINIMIZE - line[tend] = MINPOINTER; + line[tend] = DF_MINPOINTER; #endif #ifdef INCLUDE_RESTORE - line[tend+1] = RESTOREPOINTER; + line[tend+1] = DF_RESTOREPOINTER; #endif break; #endif @@ -206,14 +206,14 @@ void DisplayTitle(DFWINDOW wnd, DFRECT *rcc) break; } } - line[RectRight(rc)+1] = line[tend+3] = '\0'; - if (wnd != inFocus) - ClipString++; - writeline(wnd, line+RectLeft(rc), - RectLeft(rc)+BorderAdj(wnd), + line[DfRectRight(rc)+1] = line[tend+3] = '\0'; + if (wnd != DfInFocus) + DfClipString++; + DfWriteLine(wnd, line+DfRectLeft(rc), + DfRectLeft(rc)+DfBorderAdj(wnd), 0, FALSE); - ClipString = 0; + DfClipString = 0; } } } @@ -221,52 +221,52 @@ void DisplayTitle(DFWINDOW wnd, DFRECT *rcc) /* --- display right border shadow character of a window --- */ static void shadow_char(DFWINDOW wnd, int y) { - int fg = foreground; - int bg = background; - int x = WindowWidth(wnd); - char c = videochar(GetLeft(wnd)+x, GetTop(wnd)+y); + int fg = DfForeground; + int bg = DfBackground; + int x = DfWindowWidth(wnd); + char c = DfVideoChar(DfGetLeft(wnd)+x, DfGetTop(wnd)+y); - if (TestAttribute(wnd, SHADOW) == 0) + if (DfTestAttribute(wnd, DF_SHADOW) == 0) return; - foreground = DARKGRAY; - background = BLACK; - wputch(wnd, c, x, y); - foreground = fg; - background = bg; + DfForeground = DARKGRAY; + DfBackground = BLACK; + DfWPutch(wnd, c, x, y); + DfForeground = fg; + DfBackground = bg; } /* --- display the bottom border shadow line for a window -- */ static void shadowline(DFWINDOW wnd, DFRECT rc) { int i; - int y = GetBottom(wnd)+1; - int fg = foreground; - int bg = background; + int y = DfGetBottom(wnd)+1; + int fg = DfForeground; + int bg = DfBackground; - if ((TestAttribute(wnd, SHADOW)) == 0) + if ((DfTestAttribute(wnd, DF_SHADOW)) == 0) return; - for (i = 0; i < WindowWidth(wnd)+1; i++) - line[i] = videochar(GetLeft(wnd)+i, y); + for (i = 0; i < DfWindowWidth(wnd)+1; i++) + line[i] = DfVideoChar(DfGetLeft(wnd)+i, y); line[i] = '\0'; - foreground = DARKGRAY; - background = BLACK; - line[RectRight(rc)+1] = '\0'; - if (RectLeft(rc) == 0) + DfForeground = DARKGRAY; + DfBackground = BLACK; + line[DfRectRight(rc)+1] = '\0'; + if (DfRectLeft(rc) == 0) rc.lf++; - ClipString++; - wputs(wnd, line+RectLeft(rc), RectLeft(rc), - WindowHeight(wnd)); - --ClipString; - foreground = fg; - background = bg; + DfClipString++; + DfWPuts(wnd, line+DfRectLeft(rc), DfRectLeft(rc), + DfWindowHeight(wnd)); + --DfClipString; + DfForeground = fg; + DfBackground = bg; } static DFRECT ParamRect(DFWINDOW wnd, DFRECT *rcc) { DFRECT rc; if (rcc == NULL) { - rc = RelativeWindowRect(wnd, WindowRect(wnd)); - if (TestAttribute(wnd, SHADOW)) { + rc = DfRelativeWindowRect(wnd, DfWindowRect(wnd)); + if (DfTestAttribute(wnd, DF_SHADOW)) { rc.rt++; rc.bt++; } @@ -276,182 +276,182 @@ static DFRECT ParamRect(DFWINDOW wnd, DFRECT *rcc) return rc; } -void PaintShadow(DFWINDOW wnd) +void DfPaintShadow(DFWINDOW wnd) { int y; DFRECT rc = ParamRect(wnd, NULL); - for (y = 1; y < WindowHeight(wnd); y++) + for (y = 1; y < DfWindowHeight(wnd); y++) shadow_char(wnd, y); shadowline(wnd, rc); } /* ------- display a window's border ----- */ -void RepaintBorder(DFWINDOW wnd, DFRECT *rcc) +void DfRepaintBorder(DFWINDOW wnd, DFRECT *rcc) { int y; char lin, side, ne, nw, se, sw; DFRECT rc, clrc; - if (!TestAttribute(wnd, HASBORDER)) + if (!DfTestAttribute(wnd, DF_HASBORDER)) return; rc = ParamRect(wnd, rcc); - clrc = AdjustRectangle(wnd, rc); + clrc = DfAdjustRectangle(wnd, rc); - if (wnd == inFocus) { - lin = FOCUS_LINE; - side = FOCUS_SIDE; - ne = FOCUS_NE; - nw = FOCUS_NW; - se = FOCUS_SE; - sw = FOCUS_SW; + if (wnd == DfInFocus) { + lin = DF_FOCUS_LINE; + side = DF_FOCUS_SIDE; + ne = DF_FOCUS_NE; + nw = DF_FOCUS_NW; + se = DF_FOCUS_SE; + sw = DF_FOCUS_SW; } else { - lin = LINE; - side = SIDE; - ne = NE; - nw = NW; - se = SE; - sw = SW; + lin = DF_LINE; + side = DF_SIDE; + ne = DF_NE; + nw = DF_NW; + se = DF_SE; + sw = DF_SW; } - line[WindowWidth(wnd)] = '\0'; + line[DfWindowWidth(wnd)] = '\0'; /* ---------- window title ------------ */ - if (TestAttribute(wnd, HASTITLEBAR)) - if (RectTop(rc) == 0) - if (RectLeft(rc) < WindowWidth(wnd)-BorderAdj(wnd)) - DisplayTitle(wnd, &rc); - foreground = FrameForeground(wnd); - background = FrameBackground(wnd); + if (DfTestAttribute(wnd, DF_HASTITLEBAR)) + if (DfRectTop(rc) == 0) + if (DfRectLeft(rc) < DfWindowWidth(wnd)-DfBorderAdj(wnd)) + DfDisplayTitle(wnd, &rc); + DfForeground = DfFrameForeground(wnd); + DfBackground = DfFrameBackground(wnd); /* -------- top frame corners --------- */ - if (RectTop(rc) == 0) { - if (RectLeft(rc) == 0) - wputch(wnd, nw, 0, 0); - if (RectLeft(rc) < WindowWidth(wnd)) { - if (RectRight(rc) >= WindowWidth(wnd)-1) - wputch(wnd, ne, WindowWidth(wnd)-1, 0); + if (DfRectTop(rc) == 0) { + if (DfRectLeft(rc) == 0) + DfWPutch(wnd, nw, 0, 0); + if (DfRectLeft(rc) < DfWindowWidth(wnd)) { + if (DfRectRight(rc) >= DfWindowWidth(wnd)-1) + DfWPutch(wnd, ne, DfWindowWidth(wnd)-1, 0); TopLine(wnd, lin, clrc); } } /* ----------- window body ------------ */ - for (y = RectTop(rc); y <= RectBottom(rc); y++) { + for (y = DfRectTop(rc); y <= DfRectBottom(rc); y++) { char ch; - if (y == 0 || y >= WindowHeight(wnd)-1) + if (y == 0 || y >= DfWindowHeight(wnd)-1) continue; - if (RectLeft(rc) == 0) - wputch(wnd, side, 0, y); - if (RectLeft(rc) < WindowWidth(wnd) && - RectRight(rc) >= WindowWidth(wnd)-1) { - if (TestAttribute(wnd, VSCROLLBAR)) - ch = ( y == 1 ? UPSCROLLBOX : - y == WindowHeight(wnd)-2 ? - DOWNSCROLLBOX : + if (DfRectLeft(rc) == 0) + DfWPutch(wnd, side, 0, y); + if (DfRectLeft(rc) < DfWindowWidth(wnd) && + DfRectRight(rc) >= DfWindowWidth(wnd)-1) { + if (DfTestAttribute(wnd, DF_VSCROLLBAR)) + ch = ( y == 1 ? DF_UPSCROLLBOX : + y == DfWindowHeight(wnd)-2 ? + DF_DOWNSCROLLBOX : y-1 == wnd->VScrollBox ? - SCROLLBOXCHAR : - SCROLLBARCHAR ); + DF_SCROLLBOXCHAR : + DF_SCROLLBARCHAR ); else ch = side; - wputch(wnd, ch, WindowWidth(wnd)-1, y); + DfWPutch(wnd, ch, DfWindowWidth(wnd)-1, y); } - if (RectRight(rc) == WindowWidth(wnd)) + if (DfRectRight(rc) == DfWindowWidth(wnd)) shadow_char(wnd, y); } - if (RectTop(rc) <= WindowHeight(wnd)-1 && - RectBottom(rc) >= WindowHeight(wnd)-1) { + if (DfRectTop(rc) <= DfWindowHeight(wnd)-1 && + DfRectBottom(rc) >= DfWindowHeight(wnd)-1) { /* -------- bottom frame corners ---------- */ - if (RectLeft(rc) == 0) - wputch(wnd, sw, 0, WindowHeight(wnd)-1); - if (RectLeft(rc) < WindowWidth(wnd) && - RectRight(rc) >= WindowWidth(wnd)-1) - wputch(wnd, se, WindowWidth(wnd)-1, - WindowHeight(wnd)-1); + if (DfRectLeft(rc) == 0) + DfWPutch(wnd, sw, 0, DfWindowHeight(wnd)-1); + if (DfRectLeft(rc) < DfWindowWidth(wnd) && + DfRectRight(rc) >= DfWindowWidth(wnd)-1) + DfWPutch(wnd, se, DfWindowWidth(wnd)-1, + DfWindowHeight(wnd)-1); if (wnd->StatusBar == NULL) { /* ----------- bottom line ------------- */ - memset(line,lin,WindowWidth(wnd)-1); - if (TestAttribute(wnd, HSCROLLBAR)) { - line[0] = LEFTSCROLLBOX; - line[WindowWidth(wnd)-3] = RIGHTSCROLLBOX; - memset(line+1, SCROLLBARCHAR, WindowWidth(wnd)-4); - line[wnd->HScrollBox] = SCROLLBOXCHAR; + memset(line,lin,DfWindowWidth(wnd)-1); + if (DfTestAttribute(wnd, DF_HSCROLLBAR)) { + line[0] = DF_LEFTSCROLLBOX; + line[DfWindowWidth(wnd)-3] = DF_RIGHTSCROLLBOX; + memset(line+1, DF_SCROLLBARCHAR, DfWindowWidth(wnd)-4); + line[wnd->HScrollBox] = DF_SCROLLBOXCHAR; } - line[WindowWidth(wnd)-2] = line[RectRight(rc)] = '\0'; - if (RectLeft(rc) != RectRight(rc) || - (RectLeft(rc) && RectLeft(rc) < WindowWidth(wnd)-1)) + line[DfWindowWidth(wnd)-2] = line[DfRectRight(rc)] = '\0'; + if (DfRectLeft(rc) != DfRectRight(rc) || + (DfRectLeft(rc) && DfRectLeft(rc) < DfWindowWidth(wnd)-1)) { - if (wnd != inFocus) - ClipString++; - writeline(wnd, - line+(RectLeft(clrc)), - RectLeft(clrc)+1, - WindowHeight(wnd)-1, + if (wnd != DfInFocus) + DfClipString++; + DfWriteLine(wnd, + line+(DfRectLeft(clrc)), + DfRectLeft(clrc)+1, + DfWindowHeight(wnd)-1, FALSE); - ClipString = 0; + DfClipString = 0; } } - if (RectRight(rc) == WindowWidth(wnd)) - shadow_char(wnd, WindowHeight(wnd)-1); + if (DfRectRight(rc) == DfWindowWidth(wnd)) + shadow_char(wnd, DfWindowHeight(wnd)-1); } - if (RectBottom(rc) == WindowHeight(wnd)) + if (DfRectBottom(rc) == DfWindowHeight(wnd)) /* ---------- bottom shadow ------------- */ shadowline(wnd, rc); } static void TopLine(DFWINDOW wnd, int lin, DFRECT rc) { - if (TestAttribute(wnd, HASMENUBAR)) + if (DfTestAttribute(wnd, DF_HASMENUBAR)) return; - if (TestAttribute(wnd, HASTITLEBAR) && GetTitle(wnd)) + if (DfTestAttribute(wnd, DF_HASTITLEBAR) && DfGetTitle(wnd)) return; - if (RectLeft(rc) == 0) { - RectLeft(rc) += BorderAdj(wnd); - RectRight(rc) += BorderAdj(wnd); + if (DfRectLeft(rc) == 0) { + DfRectLeft(rc) += DfBorderAdj(wnd); + DfRectRight(rc) += DfBorderAdj(wnd); } - if (RectRight(rc) < WindowWidth(wnd)-1) - RectRight(rc)++; + if (DfRectRight(rc) < DfWindowWidth(wnd)-1) + DfRectRight(rc)++; - if (RectLeft(rc) < RectRight(rc)) { + if (DfRectLeft(rc) < DfRectRight(rc)) { /* ----------- top line ------------- */ - memset(line,lin,WindowWidth(wnd)-1); - if (TestAttribute(wnd, CONTROLBOX)) { + memset(line,lin,DfWindowWidth(wnd)-1); + if (DfTestAttribute(wnd, DF_CONTROLBOX)) { strncpy(line+1, " ", 3); - *(line+2) = CONTROLBOXCHAR; + *(line+2) = DF_CONTROLBOXCHAR; } - line[RectRight(rc)] = '\0'; - writeline(wnd, line+RectLeft(rc), - RectLeft(rc), 0, FALSE); + line[DfRectRight(rc)] = '\0'; + DfWriteLine(wnd, line+DfRectLeft(rc), + DfRectLeft(rc), 0, FALSE); } } /* ------ clear the data space of a window -------- */ -void ClearWindow(DFWINDOW wnd, DFRECT *rcc, int clrchar) +void DfClearWindow(DFWINDOW wnd, DFRECT *rcc, int clrchar) { - if (isVisible(wnd)) { + if (DfIsVisible(wnd)) { int y; DFRECT rc; if (rcc == NULL) - rc = RelativeWindowRect(wnd, WindowRect(wnd)); + rc = DfRelativeWindowRect(wnd, DfWindowRect(wnd)); else rc = *rcc; - if (RectLeft(rc) == 0) - RectLeft(rc) = BorderAdj(wnd); - if (RectRight(rc) > WindowWidth(wnd)-1) - RectRight(rc) = WindowWidth(wnd)-1; - SetStandardColor(wnd); + if (DfRectLeft(rc) == 0) + DfRectLeft(rc) = DfBorderAdj(wnd); + if (DfRectRight(rc) > DfWindowWidth(wnd)-1) + DfRectRight(rc) = DfWindowWidth(wnd)-1; + DfSetStandardColor(wnd); memset(line, clrchar, sizeof line); - line[RectRight(rc)+1] = '\0'; - for (y = RectTop(rc); y <= RectBottom(rc); y++) + line[DfRectRight(rc)+1] = '\0'; + for (y = DfRectTop(rc); y <= DfRectBottom(rc); y++) { - if (y < TopBorderAdj(wnd) || - y > ClientHeight(wnd)+ - (TestAttribute(wnd, HASMENUBAR) ? 1 : 0)) + if (y < DfTopBorderAdj(wnd) || + y > DfClientHeight(wnd)+ + (DfTestAttribute(wnd, DF_HASMENUBAR) ? 1 : 0)) continue; - writeline(wnd, - line+(RectLeft(rc)), - RectLeft(rc), + DfWriteLine(wnd, + line+(DfRectLeft(rc)), + DfRectLeft(rc), y, FALSE); } @@ -459,17 +459,17 @@ void ClearWindow(DFWINDOW wnd, DFRECT *rcc, int clrchar) } /* ------ compute the logical line length of a window ------ */ -int LineLength(char *ln) +int DfLineLength(char *ln) { int len = strlen(ln); char *cp = ln; - while ((cp = strchr(cp, CHANGECOLOR)) != NULL) + while ((cp = strchr(cp, DF_CHANGECOLOR)) != NULL) { cp++; len -= 3; } cp = ln; - while ((cp = strchr(cp, RESETCOLOR)) != NULL) + while ((cp = strchr(cp, DF_RESETCOLOR)) != NULL) { cp++; --len; @@ -477,42 +477,42 @@ int LineLength(char *ln) return len; } -void InitWindowColors(DFWINDOW wnd) +void DfInitWindowColors(DFWINDOW wnd) { int fbg,col; - int cls = GetClass(wnd); + int cls = DfGetClass(wnd); /* window classes without assigned colors inherit parent's colors */ - if (cfg.clr[cls][0][0] == 0xff && GetParent(wnd) != NULL) - cls = GetClass(GetParent(wnd)); + if (DfCfg.clr[cls][0][0] == 0xff && DfGetParent(wnd) != NULL) + cls = DfGetClass(DfGetParent(wnd)); /* ---------- set the colors ---------- */ for (fbg = 0; fbg < 2; fbg++) for (col = 0; col < 4; col++) - wnd->WindowColors[col][fbg] = cfg.clr[cls][col][fbg]; + wnd->WindowColors[col][fbg] = DfCfg.clr[cls][col][fbg]; } -void PutWindowChar(DFWINDOW wnd, char c, int x, int y) +void DfPutWindowChar(DFWINDOW wnd, char c, int x, int y) { - if (x < ClientWidth(wnd) && y < ClientHeight(wnd)) - wputch(wnd, c, x+BorderAdj(wnd), y+TopBorderAdj(wnd)); + if (x < DfClientWidth(wnd) && y < DfClientHeight(wnd)) + DfWPutch(wnd, c, x+DfBorderAdj(wnd), y+DfTopBorderAdj(wnd)); } -void PutWindowLine(DFWINDOW wnd, void *s, int x, int y) +void DfPutWindowLine(DFWINDOW wnd, void *s, int x, int y) { int saved = FALSE; int sv = 0; - if (x < ClientWidth(wnd) && y < ClientHeight(wnd)) + if (x < DfClientWidth(wnd) && y < DfClientHeight(wnd)) { - char *en = (char *)s+ClientWidth(wnd)-x; - if ((int)(strlen(s)+x) > (int)ClientWidth(wnd)) + char *en = (char *)s+DfClientWidth(wnd)-x; + if ((int)(strlen(s)+x) > (int)DfClientWidth(wnd)) { sv = *en; *en = '\0'; saved = TRUE; } - ClipString++; - wputs(wnd, s, x+BorderAdj(wnd), y+TopBorderAdj(wnd)); - --ClipString; + DfClipString++; + DfWPuts(wnd, s, x+DfBorderAdj(wnd), y+DfTopBorderAdj(wnd)); + --DfClipString; if (saved) *en = sv; }