- Remove dflat32.dll, no active work on it since 2002.
<[Tycho]>: Fireball ustroil subbotnik.
svn path=/trunk/; revision=40346
+++ /dev/null
-/* ------------- applicat.c ------------- */
-
-#include "dflat.h"
-
-static BOOL DisplayModified = FALSE;
-DFWINDOW DfApplicationWindow;
-
-extern DF_DBOX Display;
-extern DF_DBOX Windows;
-
-#ifdef INCLUDE_LOGGING
-extern DF_DBOX Log;
-#endif
-
-#ifdef INCLUDE_SHELLDOS
-static void ShellDOS(DFWINDOW);
-#endif
-static void DfCreateMenu(DFWINDOW);
-static void CreateStatusBar(DFWINDOW);
-static void SelectColors(DFWINDOW);
-
-#ifdef INCLUDE_WINDOWOPTIONS
-static void SelectTexture(void);
-static void SelectBorder(DFWINDOW);
-static void SelectTitle(DFWINDOW);
-static void SelectStatusBar(DFWINDOW);
-#endif
-
-static DFWINDOW oldFocus;
-#ifdef INCLUDE_MULTI_WINDOWS
-static void CloseAll(DFWINDOW, int);
-static void MoreWindows(DFWINDOW);
-static void ChooseWindow(DFWINDOW, int);
-static int WindowSel;
-static char Menus[9][26] =
-{
- "~1. ",
- "~2. ",
- "~3. ",
- "~4. ",
- "~5. ",
- "~6. ",
- "~7. ",
- "~8. ",
- "~9. "
-};
-#endif
-
-/* --------------- DFM_CREATE_WINDOW Message -------------- */
-static int CreateWindowMsg(DFWINDOW wnd)
-{
- int rtn;
-
- DfApplicationWindow = wnd;
-#ifdef INCLUDE_WINDOWOPTIONS
- 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
- SelectBorder(wnd);
- SelectTitle(wnd);
- SelectStatusBar(wnd);
-#endif
- rtn = DfBaseWndProc(DF_APPLICATION, wnd, DFM_CREATE_WINDOW, 0, 0);
- if (wnd->extension != NULL)
- DfCreateMenu(wnd);
- CreateStatusBar(wnd);
- return rtn;
-}
-
-/* --------- DFM_ADDSTATUS Message ---------- */
-static void AddStatusMsg(DFWINDOW wnd, DF_PARAM p1)
-{
- if (wnd->StatusBar != NULL) {
- if (p1 && *(char *)p1)
- DfSendMessage(wnd->StatusBar, DFM_SETTEXT, p1, 0);
- else
- DfSendMessage(wnd->StatusBar, DFM_CLEARTEXT, 0, 0);
- DfSendMessage(wnd->StatusBar, DFM_PAINT, 0, 0);
- }
-}
-
-/* -------- DFM_SETFOCUS Message -------- */
-static void SetFocusMsg(DFWINDOW wnd, BOOL p1)
-{
- if (p1)
- DfSendMessage(DfInFocus, DFM_SETFOCUS, FALSE, 0);
- DfInFocus = p1 ? wnd : NULL;
- if (DfIsVisible(wnd))
- DfSendMessage(wnd, DFM_BORDER, 0, 0);
- else
- DfSendMessage(wnd, DFM_SHOW_WINDOW, 0, 0);
-}
-
-/* ------- SIZE Message -------- */
-static void SizeMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2)
-{
- BOOL WasVisible;
- WasVisible = DfIsVisible(wnd);
- if (WasVisible)
- DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0);
- 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, DFM_SHOW_WINDOW, 0, 0);
-}
-
-/* ----------- DFM_KEYBOARD Message ------------ */
-static int KeyboardMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2)
-{
- if (DfWindowMoving || DfWindowSizing || (int) p1 == DF_F1)
- return DfBaseWndProc(DF_APPLICATION, wnd, DFM_KEYBOARD, p1, p2);
- switch ((int) p1) {
- case DF_ALT_F4:
- DfPostMessage(wnd, DFM_CLOSE_WINDOW, 0, 0);
- return TRUE;
-#ifdef INCLUDE_MULTI_WINDOWS
- case DF_ALT_F6:
- DfSetNextFocus();
- return TRUE;
-#endif
- case DF_ALT_HYPHEN:
- DfBuildSystemMenu(wnd);
- return TRUE;
- default:
- break;
- }
- DfPostMessage(wnd->MenuBarWnd, DFM_KEYBOARD, p1, p2);
- return TRUE;
-}
-
-/* --------- DFM_SHIFT_CHANGED Message -------- */
-static void ShiftChangedMsg(DFWINDOW wnd, DF_PARAM p1)
-{
- extern BOOL AltDown;
- if ((int)p1 & DF_ALTKEY)
- AltDown = TRUE;
- else if (AltDown) {
- AltDown = FALSE;
- 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, DF_PARAM p1, DF_PARAM p2)
-{
- switch ((int)p1) {
- case DF_ID_HELP:
- DfDisplayHelp(wnd, DFlatApplication);
- break;
- case DF_ID_HELPHELP:
- DfDisplayHelp(wnd, "HelpHelp");
- break;
- case DF_ID_EXTHELP:
- DfDisplayHelp(wnd, "ExtHelp");
- break;
- case DF_ID_KEYSHELP:
- DfDisplayHelp(wnd, "KeysHelp");
- break;
- case DF_ID_HELPINDEX:
- DfDisplayHelp(wnd, "HelpIndex");
- break;
-#ifdef TESTING_DFLAT
- case DF_ID_LOADHELP:
- DfLoadHelpFile();
- break;
-#endif
-#ifdef INCLUDE_LOGGING
- case DF_ID_LOG:
- DfMessageLog(wnd);
- break;
-#endif
-#ifdef INCLUDE_SHELLDOS
- case DF_ID_DOS:
- ShellDOS(wnd);
- break;
-#endif
- case DF_ID_EXIT:
- case DF_ID_SYSCLOSE:
- DfPostMessage(wnd, DFM_CLOSE_WINDOW, 0, 0);
- break;
- case DF_ID_DISPLAY:
- if (DfDialogBox(wnd, &Display, TRUE, NULL)) {
- if (DfInFocus == wnd->MenuBarWnd || DfInFocus == wnd->StatusBar)
- oldFocus = DfApplicationWindow;
- else
- oldFocus = DfInFocus;
- DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0);
- SelectColors(wnd);
-#ifdef INCLUDE_WINDOWOPTIONS
- SelectBorder(wnd);
- SelectTitle(wnd);
- SelectStatusBar(wnd);
- SelectTexture();
-#endif
- DfCreateMenu(wnd);
- CreateStatusBar(wnd);
- DfSendMessage(wnd, DFM_SHOW_WINDOW, 0, 0);
- DfSendMessage(oldFocus, DFM_SETFOCUS, TRUE, 0);
- }
- break;
- case DF_ID_SAVEOPTIONS:
- DfSaveConfig();
- break;
-#ifdef INCLUDE_MULTI_WINDOWS
- case DF_ID_WINDOW:
- ChooseWindow(wnd, (int)p2-2);
- break;
- case DF_ID_CLOSEALL:
- CloseAll(wnd, FALSE);
- break;
- case DF_ID_MOREWINDOWS:
- MoreWindows(wnd);
- break;
-#endif
-#ifdef INCLUDE_RESTORE
- case DF_ID_SYSRESTORE:
-#endif
- case DF_ID_SYSMOVE:
- case DF_ID_SYSSIZE:
-#ifdef INCLUDE_MINIMIZE
- case DF_ID_SYSMINIMIZE:
-#endif
-#ifdef INCLUDE_MAXIMIZE
- case DF_ID_SYSMAXIMIZE:
-#endif
- DfBaseWndProc(DF_APPLICATION, wnd, DFM_COMMAND, p1, p2);
- break;
- default:
- if (DfInFocus != wnd->MenuBarWnd && DfInFocus != wnd)
- DfPostMessage(DfInFocus, DFM_COMMAND, p1, p2);
- break;
- }
-}
-
-/* --------- DFM_CLOSE_WINDOW Message -------- */
-static int CloseWindowMsg(DFWINDOW wnd)
-{
- int rtn;
-#ifdef INCLUDE_MULTI_WINDOWS
- CloseAll(wnd, TRUE);
- WindowSel = 0;
-#endif
- DfPostMessage(NULL, DFM_STOP, 0, 0);
- rtn = DfBaseWndProc(DF_APPLICATION, wnd, DFM_CLOSE_WINDOW, 0, 0);
- DfUnLoadHelpFile();
- DisplayModified = FALSE;
- DfApplicationWindow = NULL;
- return rtn;
-}
-
-/* --- DF_APPLICATION Window Class window processing module --- */
-int DfApplicationProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2)
-{
- switch (msg)
- {
- case DFM_CREATE_WINDOW:
- return CreateWindowMsg(wnd);
- case DFM_HIDE_WINDOW:
- if (wnd == DfInFocus)
- DfInFocus = NULL;
- break;
- case DFM_ADDSTATUS:
- AddStatusMsg(wnd, p1);
- return TRUE;
- case DFM_SETFOCUS:
- if ((int)p1 == (DfInFocus != wnd)) {
- SetFocusMsg(wnd, (BOOL) p1);
- return TRUE;
- }
- break;
- case DFM_DFM_SIZE:
- SizeMsg(wnd, p1, p2);
- return TRUE;
-#ifdef INCLUDE_MINIMIZE
- case DFM_MINIMIZE:
- return TRUE;
-#endif
- case DFM_KEYBOARD:
- return KeyboardMsg(wnd, p1, p2);
- case DFM_SHIFT_CHANGED:
- ShiftChangedMsg(wnd, p1);
- return TRUE;
- case DFM_PAINT:
- if (DfIsVisible(wnd)) {
-#ifdef INCLUDE_WINDOWOPTIONS
- int cl = DfCfg.Texture ? DF_APPLCHAR : ' ';
-#else
- int cl = DF_APPLCHAR;
-#endif
- DfClearWindow(wnd, (DFRECT *)p1, cl);
- }
- return TRUE;
- case DFM_COMMAND:
- CommandMsg(wnd, p1, p2);
- return TRUE;
- case DFM_CLOSE_WINDOW:
- return CloseWindowMsg(wnd);
- default:
- break;
- }
- return DfBaseWndProc(DF_APPLICATION, wnd, msg, p1, p2);
-}
-
-#ifdef INCLUDE_SHELLDOS
-static void SwitchCursor(void)
-{
- 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 = DfInFocus;
- DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0);
- SwitchCursor();
- printf("To return to %s, execute the DOS exit command.",
- DFlatApplication);
- fflush(stdout);
- _spawnl(P_WAIT, getenv("COMSPEC"), " ", NULL);
- SwitchCursor();
- DfSendMessage(wnd, DFM_SHOW_WINDOW, 0, 0);
- DfSendMessage(oldFocus, DFM_SETFOCUS, TRUE, 0);
-}
-#endif
-
-/* -------- Create the menu bar -------- */
-static void DfCreateMenu(DFWINDOW wnd)
-{
- DfAddAttribute(wnd, DF_HASMENUBAR);
- if (wnd->MenuBarWnd != NULL)
- DfSendMessage(wnd->MenuBarWnd, DFM_CLOSE_WINDOW, 0, 0);
- wnd->MenuBarWnd = DfDfCreateWindow(DF_MENUBAR,
- NULL,
- DfGetClientLeft(wnd),
- DfGetClientTop(wnd)-1,
- 1,
- DfClientWidth(wnd),
- NULL,
- wnd,
- NULL,
- 0);
- 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, DFM_CLOSE_WINDOW, 0, 0);
- wnd->StatusBar = NULL;
- }
- if (DfTestAttribute(wnd, DF_HASSTATUSBAR)) {
- wnd->StatusBar = DfDfCreateWindow(DF_STATUSBAR,
- NULL,
- DfGetClientLeft(wnd),
- DfGetBottom(wnd),
- 1,
- DfClientWidth(wnd),
- NULL,
- wnd,
- NULL,
- 0);
- DfAddAttribute(wnd->StatusBar, DF_VISIBLE);
- }
-}
-
-#ifdef INCLUDE_MULTI_WINDOWS
-/* -------- return the name of a document window ------- */
-static char *WindowName(DFWINDOW wnd)
-{
- if (DfGetTitle(wnd) == NULL)
- {
- if (DfGetClass(wnd) == DF_DIALOG)
- return ((DF_DBOX *)(wnd->extension))->HelpName;
- else
- return "Untitled";
- }
- else
- return DfGetTitle(wnd);
-}
-
-/* ----------- Prepare the Window menu ------------ */
-void DfPrepWindowMenu(void *w, struct DfMenu *mnu)
-{
- DFWINDOW wnd = w;
- 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 (DfGetClass(wnd) != DF_APPLICATION)
- {
- oldFocus = wnd;
-
- /* point to the DF_APPLICATION window */
- if (DfApplicationWindow == NULL)
- return;
-
- cwnd = DfFirstWindow(DfApplicationWindow);
- /* get the first 9 document windows */
- while (cwnd != NULL && MenuNo < 9)
- {
- if (DfGetClass(cwnd) != DF_MENUBAR &&
- DfGetClass(cwnd) != DF_STATUSBAR)
- {
- /* add the document window to the menu */
- strncpy (Menus[MenuNo]+4, WindowName(cwnd), 20);
- pd->SelectionTitle = Menus[MenuNo];
- if (cwnd == oldFocus)
- {
- /* mark the current document */
- pd->Attrib |= DF_CHECKED;
- mnu->Selection = MenuNo+2;
- }
- else
- pd->Attrib &= ~DF_CHECKED;
- pd++;
- MenuNo++;
- }
- cwnd = DfNextWindow(cwnd);
- }
- }
-
- if (MenuNo)
- p0->SelectionTitle = "~Close all";
- else
- p0->SelectionTitle = NULL;
-
- if (MenuNo >= 9)
- {
- *pd++ = *ca;
- if (mnu->Selection == 0)
- mnu->Selection = 11;
- }
- pd->SelectionTitle = NULL;
-}
-
-/* window processing module for the More Windows dialog box */
-static int WindowPrep(DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2)
-{
- switch (msg) {
- case DFM_INITIATE_DIALOG: {
- DFWINDOW wnd1;
- DFWINDOW cwnd = DfControlWindow(&Windows,DF_ID_WINDOWLIST);
- int sel = 0;
- if (cwnd == NULL)
- return FALSE;
- wnd1 = DfFirstWindow(DfApplicationWindow);
- while (wnd1 != NULL) {
- if (wnd1 != wnd && DfGetClass(wnd1) != DF_MENUBAR &&
- DfGetClass(wnd1) != DF_STATUSBAR) {
- if (wnd1 == oldFocus)
- WindowSel = sel;
- DfSendMessage(cwnd, DFM_ADDTEXT,
- (DF_PARAM) WindowName(wnd1), 0);
- sel++;
- }
- wnd1 = DfNextWindow(wnd1);
- }
- 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 DF_ID_OK:
- if ((int)p2 == 0)
- WindowSel = DfSendMessage(
- DfControlWindow(&Windows,
- DF_ID_WINDOWLIST),
- DFM_LB_CURRENTSELECTION, 0, 0);
- break;
- case DF_ID_WINDOWLIST:
- if ((int) p2 == DFM_LB_CHOOSE)
- DfSendMessage(wnd, DFM_COMMAND, DF_ID_OK, 0);
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- return DfDefaultWndProc(wnd, msg, p1, p2);
-}
-
-/* ---- the More Windows command on the Window menu ---- */
-static void MoreWindows(DFWINDOW wnd)
-{
- if (DfDialogBox(wnd, &Windows, TRUE, WindowPrep))
- ChooseWindow(wnd, WindowSel);
-}
-
-/* ----- user chose a window from the Window menu
- or the More Window dialog box ----- */
-static void ChooseWindow(DFWINDOW wnd, int WindowNo)
-{
- DFWINDOW cwnd = DfFirstWindow(wnd);
- while (cwnd != NULL)
- {
- if (DfGetClass(cwnd) != DF_MENUBAR &&
- DfGetClass(cwnd) != DF_STATUSBAR)
- if (WindowNo-- == 0)
- break;
- cwnd = DfNextWindow(cwnd);
- }
- if (cwnd != NULL) {
- DfSendMessage(cwnd, DFM_SETFOCUS, TRUE, 0);
- if (cwnd->condition == DF_ISMINIMIZED)
- DfSendMessage(cwnd, DFM_RESTORE, 0, 0);
- }
-}
-
-/* ----- Close all document windows ----- */
-static void CloseAll(DFWINDOW wnd, int closing)
-{
- DFWINDOW wnd1, wnd2;
-
- DfSendMessage(wnd, DFM_SETFOCUS, TRUE, 0);
- wnd1 = DfLastWindow(wnd);
- while (wnd1 != NULL)
- {
- wnd2 = DfPrevWindow(wnd1);
- if (DfGetClass(wnd1) != DF_MENUBAR && DfGetClass(wnd1) != DF_STATUSBAR)
- {
- DfClearVisible(wnd1);
- DfSendMessage(wnd1, DFM_CLOSE_WINDOW, 0, 0);
- }
- wnd1 = wnd2;
- }
- if (!closing)
- DfSendMessage(wnd, DFM_PAINT, 0, 0);
-}
-
-#endif /* #ifdef INCLUDE_MULTI_WINDOWS */
-
-static void DoWindowColors(DFWINDOW wnd)
-{
- DFWINDOW cwnd;
-
- DfInitWindowColors(wnd);
- cwnd = DfFirstWindow(wnd);
- while (cwnd != NULL)
- {
- DoWindowColors(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(DfCfg.clr, DfColor, sizeof DfColor);
- DoWindowColors(wnd);
-}
-
-
-#ifdef INCLUDE_WINDOWOPTIONS
-
-/* ----- select the screen texture ----- */
-static void SelectTexture(void)
-{
- DfCfg.Texture = DfCheckBoxSetting(&Display, DF_ID_TEXTURE);
-}
-
-/* -- select whether the application screen has a border -- */
-static void SelectBorder(DFWINDOW wnd)
-{
- DfCfg.Border = DfCheckBoxSetting(&Display, DF_ID_BORDER);
- if (DfCfg.Border)
- DfAddAttribute(wnd, DF_HASBORDER);
- else
- DfClearAttribute(wnd, DF_HASBORDER);
-}
-
-/* select whether the application screen has a status bar */
-static void SelectStatusBar(DFWINDOW wnd)
-{
- DfCfg.StatusBar = DfCheckBoxSetting(&Display, DF_ID_STATUSBAR);
- if (DfCfg.StatusBar)
- DfAddAttribute(wnd, DF_HASSTATUSBAR);
- else
- DfClearAttribute(wnd, DF_HASSTATUSBAR);
-}
-
-/* select whether the application screen has a title bar */
-static void SelectTitle(DFWINDOW wnd)
-{
- DfCfg.Title = DfCheckBoxSetting(&Display, DF_ID_TITLE);
- if (DfCfg.Title)
- DfAddAttribute(wnd, DF_HASTITLEBAR);
- else
- DfClearAttribute(wnd, DF_HASTITLEBAR);
-}
-
-#endif
-
-/* EOF */
+++ /dev/null
-/* ------------ barchart.c ----------- */
-#include "dflat.h"
-
-#define BCHEIGHT 12
-#define BCWIDTH 44
-#define COLWIDTH 4
-
-static DFWINDOW Bwnd;
-
-/* ------- project schedule array ------- */
-static struct ProjChart {
- char *prj;
- int start, stop;
-} projs[] = {
- {"Center St", 0,3},
- {"City Hall", 0,5},
- {"Rt 395 ", 1,4},
- {"Sky Condo", 2,3},
- {"Out Hs ", 0,4},
- {"Bk Palace", 1,5}
-};
-
-static char *Title = " PROJECT SCHEDULE";
-static char *Months = " Jan Feb Mar Apr May Jun";
-
-static int BarChartProc(DFWINDOW wnd, DFMESSAGE msg,
- DF_PARAM p1, DF_PARAM p2)
-{
- switch (msg) {
- case DFM_COMMAND:
- if ((int)p1 == DF_ID_HELP) {
- DfDisplayHelp(wnd, "BarChart");
- return TRUE;
- }
- break;
- case DFM_CLOSE_WINDOW:
- Bwnd = NULL;
- break;
- default:
- break;
- }
- return DfDefaultWndProc(wnd, msg, p1, p2);
-}
-
-void BarChart(DFWINDOW pwnd)
-{
- int pct = sizeof projs / sizeof(struct ProjChart);
- int i;
-
- if (Bwnd == NULL) {
- Bwnd = DfDfCreateWindow(DF_PICTUREBOX,
- "BarChart",
- -1, -1, BCHEIGHT, BCWIDTH,
- NULL, pwnd, BarChartProc,
- DF_SHADOW |
- DF_CONTROLBOX |
- DF_MOVEABLE |
- DF_HASBORDER
- );
- DfSendMessage(Bwnd, DFM_ADDTEXT, (DF_PARAM) Title, 0);
- DfSendMessage(Bwnd, DFM_ADDTEXT, (DF_PARAM) "", 0);
- for (i = 0; i < pct; i++) {
- 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, DFM_ADDTEXT, (DF_PARAM) "", 0);
- DfSendMessage(Bwnd, DFM_ADDTEXT, (DF_PARAM) Months, 0);
- DfDrawBox(Bwnd, 10, 1, pct+2, 25);
- }
- DfSendMessage(Bwnd, DFM_SETFOCUS, TRUE, 0);
-}
+++ /dev/null
-/* ----------- box.c ------------ */
-
-#include "dflat.h"
-
-int DfBoxProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2)
-{
- int rtn;
- DFWINDOW oldFocus;
- DF_CTLWINDOW *ct = DfGetControl(wnd);
- static BOOL SettingFocus = FALSE;
- if (ct != NULL)
- {
- switch (msg)
- {
- case DFM_SETFOCUS:
- SettingFocus = DfIsVisible(wnd);
- rtn = DfBaseWndProc(DF_BOX, wnd, msg, p1, p2);
- SettingFocus = FALSE;
- return rtn;
-
- case DFM_PAINT:
- return FALSE;
- case DFM_LEFT_BUTTON:
- case DFM_BUTTON_RELEASED:
- return DfSendMessage(DfGetParent(wnd), msg, p1, p2);
- case DFM_BORDER:
- if (SettingFocus)
- return TRUE;
- oldFocus = DfInFocus;
- DfInFocus = NULL;
- rtn = DfBaseWndProc(DF_BOX, wnd, msg, p1, p2);
- DfInFocus = oldFocus;
- if (ct != NULL)
- if (ct->itext != NULL)
- DfWriteLine(wnd, ct->itext, 1, 0, FALSE);
- return rtn;
- default:
- break;
- }
- }
- return DfBaseWndProc(DF_BOX, wnd, msg, p1, p2);
-}
-
-/* EOF */
+++ /dev/null
-/* -------------- button.c -------------- */
-
-#include "dflat.h"
-
-void PaintMsg(DFWINDOW wnd, DF_CTLWINDOW *ct, DFRECT *rc)
-{
- if (DfIsVisible(wnd))
- {
- if (DfTestAttribute(wnd, DF_SHADOW))
- {
- /* -------- draw the button's shadow ------- */
- int x;
- 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)
- {
- char *txt;
- txt = DfCalloc(1, strlen(ct->itext)+10);
- if (ct->setting == DF_OFF) {
- txt[0] = DF_CHANGECOLOR;
- txt[1] = wnd->WindowColors
- [DF_HILITE_COLOR] [DF_FG] | 0x80;
- txt[2] = wnd->WindowColors
- [DF_STD_COLOR] [DF_BG] | 0x80;
- }
- 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 ------- */
- DfWriteTextLine(wnd, rc, 0, wnd == DfInFocus);
- }
-}
-
-void LeftButtonMsg(DFWINDOW wnd, DFMESSAGE msg, DF_CTLWINDOW *ct)
-{
- /* --------- draw a pushed button -------- */
- int x;
- DfBackground = DfWndBackground(DfGetParent(wnd));
- DfForeground = DfWndBackground(wnd);
- DfWPutch(wnd, ' ', 0, 0);
- for (x = 0; x < DfWindowWidth(wnd); x++)
- {
- DfWPutch(wnd, (char)220, x+1, 0);
- DfWPutch(wnd, (char)223, x+1, 1);
- }
- if (msg == DFM_LEFT_BUTTON)
- DfSendMessage(NULL, DFM_WAITMOUSE, 0, 0);
- else
- 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
- DfBeep();
-}
-
-int DfButtonProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2)
-{
- DF_CTLWINDOW *ct = DfGetControl(wnd);
- if (ct != NULL) {
- switch (msg) {
- case DFM_SETFOCUS:
- DfBaseWndProc(DF_BUTTON, wnd, msg, p1, p2);
- p1 = 0;
- /* ------- fall through ------- */
- case DFM_PAINT:
- PaintMsg(wnd, ct, (DFRECT*)p1);
- return TRUE;
- case DFM_KEYBOARD:
- if (p1 != '\r')
- break;
- /* ---- fall through ---- */
- case DFM_LEFT_BUTTON:
- LeftButtonMsg(wnd, msg, ct);
- return TRUE;
- case DFM_HORIZSCROLL:
- return TRUE;
- default:
- break;
- }
- }
- return DfBaseWndProc(DF_BUTTON, wnd, msg, p1, p2);
-}
-
-/* EOF */
+++ /dev/null
-/* ------------- calendar.c ------------- */
-#include "dflat.h"
-
-#define CALHEIGHT 17
-#define CALWIDTH 33
-
-static int DyMo[] = {31,28,31,30,31,30,31,31,30,31,30,31};
-static struct tm ttm;
-static int dys[42];
-static DFWINDOW Cwnd;
-
-static void FixDate(void)
-{
- /* ---- adjust Feb for leap year ---- */
- if (ttm.tm_year % 4 == 0)
- {
- if (ttm.tm_year % 100 == 0)
- {
- if (ttm.tm_year % 400 == 0)
- {
- DyMo[1] = 29;
- }
- else
- {
- DyMo[1] = 28;
- }
- }
- else
- {
- DyMo[1] = 29;
- }
- }
- else
- {
- DyMo[1] = 28;
- }
-
- ttm.tm_mday = min(ttm.tm_mday, DyMo[ttm.tm_mon]);
-}
-
-/* ---- build calendar dates array ---- */
-static void BuildDateArray(void)
-{
- int offset, dy = 0;
- memset(dys, 0, sizeof dys);
- FixDate();
- /* ----- compute the weekday for the 1st ----- */
- offset = ((ttm.tm_mday-1) - ttm.tm_wday) % 7;
- if (offset < 0)
- offset += 7;
- if (offset)
- offset = (offset - 7) * -1;
- /* ----- build the dates into the array ---- */
- for (dy = 1; dy <= DyMo[ttm.tm_mon]; dy++)
- dys[offset++] = dy;
-}
-
-static void CreateWindowMsg(DFWINDOW wnd)
-{
- int x, y;
- DfDrawBox(wnd, 1, 2, CALHEIGHT-4, CALWIDTH-4);
- for (x = 5; x < CALWIDTH-4; x += 4)
- DfDrawVector(wnd, x, 2, CALHEIGHT-4, FALSE);
- for (y = 4; y < CALHEIGHT-3; y+=2)
- DfDrawVector(wnd, 1, y, CALWIDTH-4, TRUE);
-}
-
-static void DisplayDates(DFWINDOW wnd)
-{
- int week, day;
- char dyln[10];
- int offset;
- char banner[CALWIDTH-1];
- char banner1[30];
-
- 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, " ");
- DfPutWindowLine(wnd, banner, 0, 0);
- BuildDateArray();
- for (week = 0; week < 6; week++) {
- for (day = 0; day < 7; day++) {
- int dy = dys[week*7+day];
- if (dy == 0)
- strcpy(dyln, " ");
- else {
- if (dy == ttm.tm_mday)
- sprintf(dyln, "%c%c%c%2d %c",
- DF_CHANGECOLOR,
- DfSelectForeground(wnd)+0x80,
- DfSelectBackground(wnd)+0x80,
- dy, DF_RESETCOLOR);
- else
- sprintf(dyln, "%2d ", dy);
- }
- DfSetStandardColor(wnd);
- DfPutWindowLine(wnd, dyln, 2 + day * 4, 3 + week*2);
- }
- }
-}
-
-static int KeyboardMsg(DFWINDOW wnd, DF_PARAM p1)
-{
- switch ((int)p1) {
- case DF_PGUP:
- if (ttm.tm_mon == 0) {
- ttm.tm_mon = 12;
- ttm.tm_year--;
- }
- ttm.tm_mon--;
- FixDate();
- mktime(&ttm);
- DisplayDates(wnd);
- return TRUE;
- case DF_PGDN:
- ttm.tm_mon++;
- if (ttm.tm_mon == 12) {
- ttm.tm_mon = 0;
- ttm.tm_year++;
- }
- FixDate();
- mktime(&ttm);
- DisplayDates(wnd);
- return TRUE;
- default:
- break;
- }
- return FALSE;
-}
-
-static int CalendarProc(DFWINDOW wnd,DFMESSAGE msg,
- DF_PARAM p1,DF_PARAM p2)
-{
- switch (msg) {
- case DFM_CREATE_WINDOW:
- DfDefaultWndProc(wnd, msg, p1, p2);
- CreateWindowMsg(wnd);
- return TRUE;
- case DFM_KEYBOARD:
- if (KeyboardMsg(wnd, p1))
- return TRUE;
- break;
- case DFM_PAINT:
- DfDefaultWndProc(wnd, msg, p1, p2);
- DisplayDates(wnd);
- return TRUE;
- case DFM_COMMAND:
- if ((int)p1 == DF_ID_HELP) {
- DfDisplayHelp(wnd, "Calendar");
- return TRUE;
- }
- break;
- case DFM_CLOSE_WINDOW:
- Cwnd = NULL;
- break;
- default:
- break;
- }
- return DfDefaultWndProc(wnd, msg, p1, p2);
-}
-
-void Calendar(DFWINDOW pwnd)
-{
- if (Cwnd == NULL) {
- time_t tim = time(NULL);
- ttm = *localtime(&tim);
- Cwnd = DfDfCreateWindow(DF_PICTUREBOX,
- "Calendar",
- -1, -1, CALHEIGHT, CALWIDTH,
- NULL, pwnd, CalendarProc,
- DF_SHADOW |
- DF_MINMAXBOX |
- DF_CONTROLBOX |
- DF_MOVEABLE |
- DF_HASBORDER
- );
- }
- DfSendMessage(Cwnd, DFM_SETFOCUS, TRUE, 0);
-}
-
-/* EOF */
+++ /dev/null
-/* -------------- checkbox.c ------------ */
-
-#include "dflat.h"
-
-int DfCheckBoxProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2)
-{
- int rtn;
- DF_CTLWINDOW *ct = DfGetControl(wnd);
- if (ct != NULL) {
- switch (msg) {
- case DFM_SETFOCUS:
- if (!(int)p1)
- DfSendMessage(NULL, DFM_HIDE_CURSOR, 0, 0);
- case DFM_MOVE:
- rtn = DfBaseWndProc(DF_CHECKBOX, wnd, msg, p1, p2);
- DfSetFocusCursor(wnd);
- return rtn;
- case DFM_PAINT: {
- char cb[] = "[ ]";
- if (ct->setting)
- cb[1] = 'X';
- DfSendMessage(wnd, DFM_CLEARTEXT, 0, 0);
- DfSendMessage(wnd, DFM_ADDTEXT, (DF_PARAM) cb, 0);
- DfSetFocusCursor(wnd);
- break;
- }
- case DFM_KEYBOARD:
- if ((int)p1 != ' ')
- break;
- case DFM_LEFT_BUTTON:
- ct->setting ^= DF_ON;
- DfSendMessage(wnd, DFM_PAINT, 0, 0);
- return TRUE;
- default:
- break;
- }
- }
- return DfBaseWndProc(DF_CHECKBOX, wnd, msg, p1, p2);
-}
-
-BOOL DfCheckBoxSetting(DF_DBOX *db, enum DfCommands cmd)
-{
- DF_CTLWINDOW *ct = DfFindCommand(db, cmd, DF_CHECKBOX);
- if (ct != NULL)
- return (ct->isetting == DF_ON);
- return FALSE;
-}
-
-/* EOF */
+++ /dev/null
-/* ---------------- classdef.h --------------- */
-
-#ifndef CLASSDEF_H
-#define CLASSDEF_H
-
-typedef struct DfClassDefs {
- DFCLASS base; /* base window class */
- int (*wndproc)(struct DfWindow *,enum DfMessages,DF_PARAM,DF_PARAM);
- int attrib;
-} DFCLASSDEFS;
-
-extern DFCLASSDEFS DfClassDefs[];
-
-#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
+++ /dev/null
-/* ----------- classes.h ------------ */
-/*
- * Class definition source file
- * Make class changes to this source file
- * Other source files will adapt
- *
- * You must add entries to the DfColor tables in
- * DFCONFIG.C for new classes.
- *
- * Class Name Base Class Processor Attribute
- * ------------ --------- --------------- -----------
- */
-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
-DfClassDef( DF_PICTUREBOX, DF_TEXTBOX, DfPictureProc, 0 )
-#endif
-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. ---------- */
-DfClassDef( DF_TITLEBAR, -1, NULL, 0 )
-DfClassDef( DF_DUMMY, -1, NULL, DF_HASBORDER )
+++ /dev/null
-/* ----------- clipbord.c ------------ */
-#include "dflat.h"
-
-char *DfClipboard;
-unsigned DfClipboardLength;
-
-void DfCopyTextToClipboard(char *text)
-{
- DfClipboardLength = strlen(text);
- DfClipboard = DfRealloc(DfClipboard, DfClipboardLength);
- memmove(DfClipboard, text, DfClipboardLength);
-}
-
-void DfCopyToClipboard(DFWINDOW wnd)
-{
- 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 DfClearClipboard(void)
-{
- if (DfClipboard != NULL) {
- free(DfClipboard);
- DfClipboard = NULL;
- }
-}
-
-
-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->textlen = plen+1;
- }
- memmove(DfCurrChar+len, DfCurrChar, strlen(DfCurrChar)+1);
- memmove(DfCurrChar, SaveTo, len);
- DfBuildTextPointers(wnd);
- wnd->TextChanged = TRUE;
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/* EOF */
+++ /dev/null
-/* -------------- combobox.c -------------- */
-
-#include "dflat.h"
-
-int ListProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM);
-
-int DfComboProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2)
-{
- switch (msg) {
- 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,
- 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 DFM_PAINT:
- DfForeground = DfWndBackground(wnd);
- DfBackground = DfWndForeground(wnd);
- DfWPutch(wnd, DF_DOWNSCROLLBOX, DfWindowWidth(wnd), 0);
- break;
- case DFM_KEYBOARD:
- if ((int)p1 == DF_DN) {
- DfSendMessage(wnd->extension, DFM_SETFOCUS, TRUE, 0);
- return TRUE;
- }
- break;
- case DFM_LEFT_BUTTON:
- if ((int)p1 == DfGetRight(wnd) + 1)
- DfSendMessage(wnd->extension, DFM_SETFOCUS, TRUE, 0);
- break;
- case DFM_CLOSE_WINDOW:
- DfSendMessage(wnd->extension, DFM_CLOSE_WINDOW, 0, 0);
- break;
- default:
- break;
- }
- return DfBaseWndProc(DF_COMBOBOX, wnd, msg, p1, p2);
-}
-
-int ListProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2)
-{
- DFWINDOW pwnd = DfGetParent(DfGetParent(wnd));
- DF_DBOX *db = pwnd->extension;
- DFWINDOW cwnd;
- char text[130];
- int rtn;
- DFWINDOW currFocus;
-
- switch (msg)
- {
- 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 DFM_SETFOCUS:
- if ((int)p1 == FALSE)
- {
- if (!wnd->isHelping)
- {
- DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0);
- wnd->ct->setting = DF_OFF;
- }
- }
- else
- wnd->ct->setting = DF_ON;
- break;
-
- case DFM_SHOW_WINDOW:
- if (wnd->ct->setting == DF_OFF)
- return TRUE;
- break;
-
- case DFM_BORDER:
- currFocus = DfInFocus;
- DfInFocus = NULL;
- rtn = DfDefaultWndProc(wnd, msg, p1, p2);
- DfInFocus = currFocus;
- return rtn;
-
- case DFM_LB_SELECTION:
- rtn = DfDefaultWndProc(wnd, msg, p1, p2);
- DfSendMessage(wnd, DFM_LB_GETTEXT,
- (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 DFM_KEYBOARD:
- switch ((int) p1)
- {
- case DF_ESC:
- case DF_FWD:
- case DF_BS:
- cwnd = DfControlWindow(db, wnd->ct->command);
- DfSendMessage(cwnd, DFM_SETFOCUS, TRUE, 0);
- return TRUE;
-
- default:
- break;
- }
- break;
-
- case DFM_LB_CHOOSE:
- cwnd = DfControlWindow(db, wnd->ct->command);
- DfSendMessage(cwnd, DFM_SETFOCUS, TRUE, 0);
- return TRUE;
-
- case DFM_CLOSE_WINDOW:
- if (wnd->ct != NULL)
- free(wnd->ct);
- wnd->ct = NULL;
- break;
-
- default:
- break;
- }
-
- return DfDefaultWndProc(wnd, msg, p1, p2);
-}
-
-void DfPutComboListText(DFWINDOW wnd, enum DfCommands cmd, char *text)
-{
- DF_CTLWINDOW *ct = DfFindCommand(wnd->extension, cmd, DF_COMBOBOX);
-
- if (ct != NULL)
- {
- DFWINDOW lwnd = ((DFWINDOW)(ct->wnd))->extension;
- DfSendMessage(lwnd, DFM_ADDTEXT, (DF_PARAM) text, 0);
- }
-}
-
-/* EOF */
+++ /dev/null
-/* ---------------- commands.h ----------------- */
-
-/*
- * Command values sent as the first parameter
- * in the COMMAND message
- *
- * Add application-specific commands to this enum
- */
-
-#ifndef COMMANDS_H
-#define COMMANDS_H
-
-enum DfCommands {
- /* --------------- File menu ---------------- */
- 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 ---------------- */
- DF_ID_UNDO,
- DF_ID_CUT,
- DF_ID_COPY,
- DF_ID_PASTE,
- DF_ID_PARAGRAPH,
- DF_ID_CLEAR,
- DF_ID_DELETETEXT,
- /* --------------- Search Menu -------------- */
- DF_ID_SEARCH,
- DF_ID_REPLACE,
- DF_ID_SEARCHNEXT,
- /* --------------- Utilities Menu ------------- */
- DF_ID_CALENDAR,
- DF_ID_BARCHART,
- /* -------------- Options menu -------------- */
- DF_ID_INSERT,
- DF_ID_WRAP,
- DF_ID_LOG,
- DF_ID_TABS,
- DF_ID_DISPLAY,
- DF_ID_SAVEOPTIONS,
- /* --------------- Window menu -------------- */
- DF_ID_CLOSEALL,
- DF_ID_WINDOW,
- DF_ID_MOREWINDOWS,
- /* --------------- Help menu ---------------- */
- DF_ID_HELPHELP,
- DF_ID_EXTHELP,
- DF_ID_KEYSHELP,
- DF_ID_HELPINDEX,
- DF_ID_ABOUT,
- DF_ID_LOADHELP,
- /* --------------- System menu -------------- */
-#ifdef INCLUDE_RESTORE
- DF_ID_SYSRESTORE,
-#endif
- DF_ID_SYSMOVE,
- DF_ID_SYSSIZE,
-#ifdef INCLUDE_MINIMIZE
- DF_ID_SYSMINIMIZE,
-#endif
-#ifdef INCLUDE_MAXIMIZE
- DF_ID_SYSMAXIMIZE,
-#endif
- DF_ID_SYSCLOSE,
- /* ---- FileOpen and SaveAs dialog boxes ---- */
- DF_ID_FILENAME,
- DF_ID_FILES,
- DF_ID_DRIVE,
- DF_ID_PATH,
- /* ----- Search and Replace dialog boxes ---- */
- DF_ID_SEARCHFOR,
- DF_ID_REPLACEWITH,
- DF_ID_MATCHCASE,
- DF_ID_REPLACEALL,
- /* ----------- Windows dialog box ----------- */
- DF_ID_WINDOWLIST,
- /* --------- generic command buttons -------- */
- DF_ID_OK,
- DF_ID_CANCEL,
- DF_ID_HELP,
- /* -------------- TabStops menu ------------- */
- DF_ID_TAB2,
- DF_ID_TAB4,
- DF_ID_TAB6,
- DF_ID_TAB8,
- /* ------------ Display dialog box ---------- */
- 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 ------------- */
- DF_ID_LOGLIST,
- DF_ID_LOGGING,
- /* ------------ HelpBox dialog box ---------- */
- DF_ID_HELPTEXT,
- DF_ID_BACK,
- DF_ID_PREV,
- DF_ID_NEXT,
- /* ---------- Print Select dialog box --------- */
- DF_ID_PRINTERPORT,
- DF_ID_LEFTMARGIN,
- DF_ID_RIGHTMARGIN,
- DF_ID_TOPMARGIN,
- DF_ID_BOTTOMMARGIN,
- /* ----------- DfInputBox dialog box ------------ */
- DF_ID_INPUTTEXT
-};
-
-#endif
+++ /dev/null
-/* ------------- config.c ------------- */
-
-#include "dflat.h"
-
-/* ----- 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 */
-
- /* ---------- DF_APPLICATION --------- */
- {{LIGHTGRAY, BLUE}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLUE}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLUE}, /* DF_FRAME_COLOR */
- {LIGHTGRAY, BLUE}}, /* DF_HILITE_COLOR */
-
- /* ------------ DF_TEXTBOX ----------- */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */
-
- /* ------------ DF_LISTBOX ----------- */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLUE}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */
-
- /* ----------- DF_EDITBOX ------------ */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLUE}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLUE}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */
-
- /* ---------- 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) */
-
- /* ---------- 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
- /* ------------ DF_PICTUREBOX ----------- */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */
-#endif
-
- /* ------------- DF_DIALOG ----------- */
- {{LIGHTGRAY, BLUE}, /* DF_STD_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLUE}, /* DF_FRAME_COLOR */
- {LIGHTGRAY, BLUE}}, /* DF_HILITE_COLOR */
-
- /* ------------ DF_BOX --------------- */
- {{LIGHTGRAY, BLUE}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLUE}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLUE}, /* DF_FRAME_COLOR */
- {LIGHTGRAY, BLUE}}, /* DF_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 */
-
- /* ------------- DF_TEXT ----------- */
- {{0xff, 0xff}, /* DF_STD_COLOR */
- {0xff, 0xff}, /* DF_SELECT_COLOR */
- {0xff, 0xff}, /* DF_FRAME_COLOR */
- {0xff, 0xff}}, /* DF_HILITE_COLOR */
-
- /* ------------- DF_RADIOBUTTON ----------- */
- {{LIGHTGRAY, BLUE}, /* DF_STD_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLUE}, /* DF_FRAME_COLOR */
- {LIGHTGRAY, BLUE}}, /* DF_HILITE_COLOR */
-
- /* ------------- DF_CHECKBOX ----------- */
- {{LIGHTGRAY, BLUE}, /* DF_STD_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLUE}, /* DF_FRAME_COLOR */
- {LIGHTGRAY, BLUE}}, /* DF_HILITE_COLOR */
-
- /* ------------ DF_SPINBUTTON ----------- */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */
-
- /* ----------- DF_ERRORBOX ----------- */
- {{YELLOW, RED}, /* DF_STD_COLOR */
- {YELLOW, RED}, /* DF_SELECT_COLOR */
- {YELLOW, RED}, /* DF_FRAME_COLOR */
- {YELLOW, RED}}, /* DF_HILITE_COLOR */
-
- /* ----------- DF_MESSAGEBOX --------- */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */
-
- /* ----------- DF_HELPBOX ------------ */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLUE}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {WHITE, LIGHTGRAY}},/* DF_HILITE_COLOR */
-
- /* ---------- DF_STATUSBAR ------------- */
- {{BLACK, CYAN}, /* DF_STD_COLOR */
- {BLACK, CYAN}, /* DF_SELECT_COLOR */
- {BLACK, CYAN}, /* DF_FRAME_COLOR */
- {BLACK, CYAN}}, /* DF_HILITE_COLOR */
-
- /* ---------- DF_TITLEBAR ------------ */
- {{BLACK, CYAN}, /* DF_STD_COLOR */
- {BLACK, CYAN}, /* DF_SELECT_COLOR */
- {BLACK, CYAN}, /* DF_FRAME_COLOR */
- {WHITE, CYAN}}, /* DF_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 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 */
-
- /* ---------- DF_APPLICATION --------- */
- {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */
- {LIGHTGRAY, BLACK}},/* DF_HILITE_COLOR */
-
- /* ------------ DF_TEXTBOX ----------- */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */
-
- /* ------------ DF_LISTBOX ----------- */
- {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */
-
- /* ----------- DF_EDITBOX ------------ */
- {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */
-
- /* ---------- 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) */
-
- /* ---------- 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
- /* ------------ DF_PICTUREBOX ----------- */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */
-#endif
-
- /* ------------- DF_DIALOG ----------- */
- {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */
- {LIGHTGRAY, BLACK}}, /* DF_HILITE_COLOR */
-
- /* ------------ DF_BOX --------------- */
- {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */
- {LIGHTGRAY, BLACK}}, /* DF_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 */
-
- /* ------------- DF_TEXT ----------- */
- {{0xff, 0xff}, /* DF_STD_COLOR */
- {0xff, 0xff}, /* DF_SELECT_COLOR */
- {0xff, 0xff}, /* DF_FRAME_COLOR */
- {0xff, 0xff}}, /* DF_HILITE_COLOR */
-
- /* ------------- DF_RADIOBUTTON ----------- */
- {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */
- {LIGHTGRAY, BLACK}}, /* DF_HILITE_COLOR */
-
- /* ------------- DF_CHECKBOX ----------- */
- {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */
- {LIGHTGRAY, BLACK}}, /* DF_HILITE_COLOR */
-
- /* ------------ DF_SPINBUTTON ----------- */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */
-
- /* ----------- DF_ERRORBOX ----------- */
- {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */
- {LIGHTGRAY, BLACK}},/* DF_HILITE_COLOR */
-
- /* ----------- DF_MESSAGEBOX --------- */
- {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */
- {LIGHTGRAY, BLACK}},/* DF_HILITE_COLOR */
-
- /* ----------- DF_HELPBOX ------------ */
- {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */
- {WHITE, BLACK}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */
- {WHITE, LIGHTGRAY}},/* DF_HILITE_COLOR */
-
- /* ---------- DF_STATUSBAR ------------- */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */
-
- /* ---------- DF_TITLEBAR ------------ */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_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 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 */
-
- /* ---------- DF_APPLICATION --------- */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */
-
- /* ------------ DF_TEXTBOX ----------- */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */
-
- /* ------------ DF_LISTBOX ----------- */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */
-
- /* ----------- DF_EDITBOX ------------ */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */
-
- /* ---------- 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) */
-
- /* ---------- 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
- /* ------------ DF_PICTUREBOX ----------- */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */
-#endif
-
- /* ------------- DF_DIALOG ----------- */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}}, /* DF_HILITE_COLOR */
-
- /* ------------ DF_BOX --------------- */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}}, /* DF_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 */
-
- /* ------------- DF_TEXT ----------- */
- {{0xff, 0xff}, /* DF_STD_COLOR */
- {0xff, 0xff}, /* DF_SELECT_COLOR */
- {0xff, 0xff}, /* DF_FRAME_COLOR */
- {0xff, 0xff}}, /* DF_HILITE_COLOR */
-
- /* ------------- DF_RADIOBUTTON ----------- */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}}, /* DF_HILITE_COLOR */
-
- /* ------------- DF_CHECKBOX ----------- */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}}, /* DF_HILITE_COLOR */
-
- /* ------------ DF_SPINBUTTON ----------- */
- {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */
-
- /* ----------- DF_ERRORBOX ----------- */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}}, /* DF_HILITE_COLOR */
-
- /* ----------- DF_MESSAGEBOX --------- */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {BLACK, LIGHTGRAY}},/* DF_HILITE_COLOR */
-
- /* ----------- DF_HELPBOX ------------ */
- {{BLACK, LIGHTGRAY}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {BLACK, LIGHTGRAY}, /* DF_FRAME_COLOR */
- {WHITE, LIGHTGRAY}},/* DF_HILITE_COLOR */
-
- /* ---------- DF_STATUSBAR ------------- */
- {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */
- {LIGHTGRAY, BLACK}}, /* DF_HILITE_COLOR */
-
- /* ---------- DF_TITLEBAR ------------ */
- {{LIGHTGRAY, BLACK}, /* DF_STD_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_SELECT_COLOR */
- {LIGHTGRAY, BLACK}, /* DF_FRAME_COLOR */
- {LIGHTGRAY, BLACK}}, /* DF_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 ------- */
-DFCONFIG DfCfg = {
- DF_VERSION,
- TRUE, /* Editor Insert Mode */
- 4, /* Editor tab stops */
- TRUE, /* Editor word wrap */
-#ifdef INCLUDE_WINDOWOPTIONS
- TRUE, /* Application Border */
- TRUE, /* Application Title */
- TRUE, /* Status Bar */
- TRUE, /* Textured application window */
-#endif
-// 25, /* Number of screen lines */
- "Lpt1", /* Printer Port */
- 66, /* Lines per printer page */
- 80, /* characters per printer line */
- 6, /* Left printer margin */
- 70, /* Right printer margin */
- 3, /* Top printer margin */
- 55 /* Bottom printer margin */
-};
-
-void DfBuildFileName(char *path, char *ext)
-{
- extern char **Argv;
- char *cp;
-
- strcpy(path, Argv[0]);
- cp = strrchr(path, '\\');
- if (cp == NULL)
- cp = path;
- else
- cp++;
- strcpy(cp, DFlatApplication);
- strcat(cp, ext);
-}
-
-FILE *DfOpenConfig(char *mode)
-{
- char path[64];
- DfBuildFileName(path, ".DfCfg");
- return fopen(path, mode);
-}
-
-/* ------ load a configuration file from disk ------- */
-BOOL DfLoadConfig(void)
-{
- static BOOL ConfigLoaded = FALSE;
- if (ConfigLoaded == FALSE) {
- FILE *fp = DfOpenConfig("rb");
- if (fp != NULL) {
- fread(DfCfg.version, sizeof DfCfg.version+1, 1, fp);
- if (strcmp(DfCfg.version, DF_VERSION) == 0) {
- fseek(fp, 0L, SEEK_SET);
- fread(&DfCfg, sizeof(DFCONFIG), 1, fp);
- fclose(fp);
- }
- else {
- char path[64];
- DfBuildFileName(path, ".DfCfg");
- fclose(fp);
- _unlink(path);
- strcpy(DfCfg.version, DF_VERSION);
- }
- ConfigLoaded = TRUE;
- }
- }
- return ConfigLoaded;
-}
-
-/* ------ save a configuration file to disk ------- */
-void DfSaveConfig(void)
-{
- FILE *fp = DfOpenConfig("wb");
- if (fp != NULL) {
- fwrite(&DfCfg, sizeof(DFCONFIG), 1, fp);
- fclose(fp);
- }
-}
-
-/* --------- set window colors --------- */
-void DfSetStandardColor(DFWINDOW wnd)
-{
- DfForeground = DfWndForeground(wnd);
- DfBackground = DfWndBackground(wnd);
-}
-
-void DfSetReverseColor(DFWINDOW wnd)
-{
- DfForeground = DfSelectForeground(wnd);
- DfBackground = DfSelectBackground(wnd);
-}
-
-/* EOF */
+++ /dev/null
-/* ---------------- config.h -------------- */
-
-#ifndef CONFIG_H
-#define CONFIG_H
-
-enum DfColorTypes {
- DF_STD_COLOR,
- DF_SELECT_COLOR,
- DF_FRAME_COLOR,
- DF_HILITE_COLOR
-};
-
-enum DfGrounds { DF_FG, DF_BG };
-
-/* ----------- configuration parameters ----------- */
-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 */
-#ifdef INCLUDE_WINDOWOPTIONS
- BOOL Border; /* True for application window border */
- BOOL Title; /* True for application window title */
- BOOL StatusBar; /* True for appl'n window status bar */
- BOOL Texture; /* True for textured appl window */
-#endif
-// int ScreenLines; /* Number of screen lines (25/43/50) */
- char PrinterPort[5];
- int LinesPage; /* Lines per printer page */
- int CharsLine; /* Characters per printer line */
- int LeftMargin; /* Printer margins */
- int RightMargin;
- int TopMargin;
- int BottomMargin;
- unsigned char clr[DF_CLASSCOUNT] [4] [2]; /* Colors */
-} DFCONFIG;
-
-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 DfLoadConfig(void);
-void DfSaveConfig(void);
-FILE *DfOpenConfig(char *);
-
-#endif
-
+++ /dev/null
-/* ----------- console.c ---------- */
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-
-#include "dflat.h"
-
-
-/* ----- table of alt keys for finding shortcut keys ----- */
-#if 0
-static int altconvert[] = {
- 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[DF_MAXSAVES];
-static CONSOLE_CURSOR_INFO cursorinfo[DF_MAXSAVES];
-static int cs = 0;
-
-
-void DfSwapCursorStack(void)
-{
- if (cs > 1)
- {
- COORD coord;
- CONSOLE_CURSOR_INFO csi;
-
- coord = cursorpos[cs-2];
- cursorpos[cs-2] = cursorpos[cs-1];
- cursorpos[cs-1] = coord;
-
- memcpy (&csi,
- &cursorinfo[cs-2],
- sizeof(CONSOLE_CURSOR_INFO));
- memcpy (&cursorinfo[cs-2],
- &cursorinfo[cs-1],
- sizeof(CONSOLE_CURSOR_INFO));
- memcpy (&cursorinfo[cs-1],
- &csi,
- sizeof(CONSOLE_CURSOR_INFO));
- }
-}
-
-
-/* ---- Read a keystroke ---- */
-void DfGetKey (PINPUT_RECORD lpBuffer)
-{
- HANDLE DfInput;
- DWORD dwRead;
-
- DfInput = GetStdHandle (STD_INPUT_HANDLE);
-
- do
- {
-// WaitForSingleObject (DfInput, INFINITE);
- ReadConsoleInput (DfInput, lpBuffer, 1, &dwRead);
- if ((lpBuffer->EventType == KEY_EVENT) &&
- (lpBuffer->Event.KeyEvent.bKeyDown == TRUE))
- break;
- }
- while (TRUE);
-}
-
-
-/* ---------- read the keyboard shift status --------- */
-
-int DfGetShift(void)
-{
-// regs.h.ah = 2;
-// int86(KEYBRD, ®s, ®s);
-// return regs.h.al;
-/* FIXME */
-
- return 0;
-}
-
-
-/* -------- sound a buzz tone ---------- */
-void DfBeep(void)
-{
- Beep(440, 50);
-// MessageBeep (-1);
-}
-
-
-/* ------ position the DfCursor ------ */
-void DfCursor(int x, int y)
-{
- COORD coPos;
-
- coPos.X = (USHORT)x;
- coPos.Y = (USHORT)y;
- SetConsoleCursorPosition (GetStdHandle (STD_OUTPUT_HANDLE), coPos);
-}
-
-
-/* ------- get the current DfCursor position ------- */
-void DfCurrCursor(int *x, int *y)
-//VOID GetCursorXY (PSHORT x, PSHORT y)
-{
- CONSOLE_SCREEN_BUFFER_INFO csbi;
-
- GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &csbi);
-
- *x = (int)csbi.dwCursorPosition.X;
- *y = (int)csbi.dwCursorPosition.Y;
-}
-
-
-/* ------ save the current DfCursor configuration ------ */
-void DfSaveCursor(void)
-{
- if (cs < DF_MAXSAVES)
- {
- CONSOLE_SCREEN_BUFFER_INFO csbi;
-
- GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &csbi);
- cursorpos[cs].X = csbi.dwCursorPosition.X;
- cursorpos[cs].Y = csbi.dwCursorPosition.Y;
-
- GetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE),
- &(cursorinfo[cs]));
-
- cs++;
- }
-}
-
-/* ---- restore the saved DfCursor configuration ---- */
-void DfRestoreCursor(void)
-{
- if (cs)
- {
- --cs;
- SetConsoleCursorPosition (GetStdHandle (STD_OUTPUT_HANDLE),
- cursorpos[cs]);
- SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE),
- &(cursorinfo[cs]));
- }
-}
-
-/* ------ make a normal DfCursor ------ */
-void DfNormalCursor(void)
-{
- CONSOLE_CURSOR_INFO csi;
-
- csi.bVisible = TRUE;
- csi.dwSize = 5;
- SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE),
- &csi);
-}
-
-/* ------ hide the DfCursor ------ */
-void DfHideCursor(void)
-{
- CONSOLE_CURSOR_INFO csi;
-
- GetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE),
- &csi);
- csi.bVisible = FALSE;
- SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE),
- &csi);
-}
-
-/* ------ unhide the DfCursor ------ */
-void DfUnhideCursor(void)
-{
- CONSOLE_CURSOR_INFO csi;
-
- GetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE),
- &csi);
- csi.bVisible = TRUE;
- SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE),
- &csi);
-}
-
-/* set the DfCursor size (in percent) */
-void DfSetCursorSize (unsigned t)
-{
- CONSOLE_CURSOR_INFO csi;
-
- GetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE),
- &csi);
-
- if (t < 2)
- csi.dwSize = 2;
- else if (t > 90)
- csi.dwSize = 90;
- else
- csi.dwSize = t;
- SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE),
- &csi);
-}
-
-
-/* ------ convert an Alt+ key to its letter equivalent ----- */
-int DfAltConvert(int c)
-{
- return c;
-#if 0
- int i, a = 0;
- for (i = 0; i < 36; i++)
- if (c == altconvert[i])
- break;
- if (i < 26)
- a = 'a' + i;
- else if (i < 36)
- a = '0' + i - 26;
- return a;
-#endif
-}
-
-/* EOF */
+++ /dev/null
-/* ------------------- decomp.c -------------------- */
-
-/*
- * Decompress the application.HLP file
- * or load the application.TXT file if the .HLP file
- * does not exist
- */
-
-#include "dflat.h"
-#include "htree.h"
-
-static int in8;
-static int ct8 = 8;
-static FILE *fi;
-static DF_BYTECOUNTER bytectr;
-static int LoadingASCII;
-struct DfHTr *DfHelpTree;
-static int root;
-
-/* ------- open the help database file -------- */
-FILE *DfOpenHelpFile(void)
-{
- char *cp;
- int treect, i;
- char helpname[65];
-
- /* -------- get the name of the help file ---------- */
- DfBuildFileName(helpname, ".hlp");
- LoadingASCII = FALSE;
- if ((fi = fopen(helpname, "rb")) == NULL) {
- /* ---- no .hlp file, look for .txt file ---- */
- if ((cp = strrchr(helpname, '.')) != NULL) {
- strcpy(cp, ".TXT");
- fi = fopen(helpname, "rt");
- }
- if (fi == NULL)
- return NULL;
- LoadingASCII = TRUE;
- }
-
- 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);
- DfHelpTree = DfCalloc(treect-256, sizeof(struct DfHTr));
- /* ---- read in the tree --- */
- for (i = 0; i < treect-256; i++) {
- 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 *DfGetHelpLine(char *line)
-{
- int h;
- if (LoadingASCII) {
- void *hp;
- do
- hp = fgets(line, 160, fi);
- while (*line == ';');
- return hp;
- }
- *line = '\0';
- while (TRUE) {
- /* ----- decompress a line from the file ------ */
- h = root;
- /* ----- walk the Huffman tree ----- */
- while (h > 255) {
- /* --- h is a node pointer --- */
- if (ct8 == 8) {
- /* --- read 8 bits of compressed data --- */
- if ((in8 = fgetc(fi)) == EOF) {
- *line = '\0';
- return NULL;
- }
- ct8 = 0;
- }
- /* -- point to left or right node based on msb -- */
- if (in8 & 0x80)
- h = DfHelpTree[h-256].left;
- else
- h = DfHelpTree[h-256].right;
- /* --- shift the next bit in --- */
- in8 <<= 1;
- ct8++;
- }
- /* --- h < 255 = decompressed character --- */
- if (h == '\r')
- continue; /* skip the '\r' character */
- /* --- put the character in the buffer --- */
- *line++ = h;
- /* --- if '\n', end of line --- */
- if (h == '\n')
- break;
- }
- *line = '\0'; /* null-terminate the line */
- return line;
-}
-
-/* --- compute the database file byte and bit position --- */
-void DfHelpFilePosition(long *offset, int *bit)
-{
- *offset = ftell(fi);
- if (LoadingASCII)
- *bit = 0;
- else {
- if (ct8 < 8)
- --*offset;
- *bit = ct8;
- }
-}
-
-/* -- position the database to the specified byte and bit -- */
-void DfSeekHelpLine(long offset, int bit)
-{
- int i;
- fseek(fi, offset, 0);
- if (!LoadingASCII) {
- ct8 = bit;
- if (ct8 < 8) {
- in8 = fgetc(fi);
- for (i = 0; i < bit; i++)
- in8 <<= 1;
- }
- }
-}
-
-
+++ /dev/null
-/* ---------- dfalloc.c ---------- */
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-#include "dflat.h"
-
-static void AllocationError(void)
-{
- static BOOL OnceIn = FALSE;
- extern jmp_buf AllocError;
- extern BOOL AllocTesting;
- static char *ErrMsg[] = {
- "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿",
- "³ Out of Memory! ³",
- "RÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄU"
- };
- int x, y;
- CHAR_INFO savbuf[54];
- DFRECT rc = {30,11,47,13};
- INPUT_RECORD ir;
-
- if (!OnceIn)
- {
- OnceIn = TRUE;
- /* ------ close all windows ------ */
- 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;
- DfPutVideoChar(x+rc.lf, y+rc.tp, c);
- }
- }
- DfGetKey(&ir);
- DfStoreVideo(rc, savbuf);
- if (AllocTesting)
- longjmp(AllocError, 1);
- }
-}
-
-void *DfCalloc(size_t nitems, size_t size)
-{
- void *rtn = calloc(nitems, size);
- if (size && rtn == NULL)
- AllocationError();
- return rtn;
-}
-
-void *DfMalloc(size_t size)
-{
- void *rtn = malloc(size);
- if (size && rtn == NULL)
- AllocationError();
- return rtn;
-}
-
-void *DfRealloc(void *block, size_t size)
-{
- void *rtn;
-
- rtn = realloc(block, size);
- if (size && rtn == NULL)
- AllocationError();
- return rtn;
-}
-
-/* EOF */
+++ /dev/null
-Window Classes:
-
-Window classes define the behavior of windows. Each class has its own
-unique reaction to messages. Classes derive from other classes.
-
- NORMAL base window for all window classes
- APPLICATION application window. has the menu
- (derived from NORMAL)
- TEXTBOX textbox. base window for listbox, editbox, etc.
- (derived from NORMAL)
- LISTBOX listbox. base window for menubar
- (derived from TEXTBOX)
- PICTUREBOX picturebox. a text box onto which you can draw lines
- (derived from TEXTBOX)
- EDITBOX editbox
- (derived from TEXTBOX)
- MENUBAR the application's menu bar
- (derived from NORMAL)
- POPDOWNMENU popdown menu
- (derived from LISTBOX)
- BUTTON command button in a dialog box
- (derived from TEXTBOX)
- SPINBUTTON spin button in a dialog box
- (derived from LISTBOX)
- COMBOBOX combination editbox/listbox
- (derived from EDITBOX)
- DIALOG dialog box. parent to editbox, button, listbox, etc.
- (derived from NORMAL)
- ERRORBOX for displaying an error message
- (derived from DIALOG)
- MESSAGEBOX for displaying a message
- (derived from DIALOG)
- HELPBOX help window
- (derived from DIALOG)
- TEXT static text on a dialog box
- (derived from TEXTBOX)
- RADIOBUTTON radio button on a dialog box
- (derived from TEXTBOX)
- CHECKBOX check box on a dialog box
- (derived from TEXTBOX)
- STATUSBAR status bar at the bottom of application window
- (derived from TEXTBOX)
-
- D-Flat Window Class Tree
- ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
- ³ ³
- ³ NORMAL ³
- ³ ³ ³
- ³ ÃÄÄ APPLICATION ³
- ³ ³ ³
- ³ ÃÄÄ MENUBAR ³
- ³ ³ ³
- ³ ÃÄÄ TEXTBOX ³
- ³ ³ ³ ³
- ³ ³ ÃÄÄ LISTBOX ³
- ³ ³ ³ ³ ³
- ³ ³ ³ ÃÄÄÄÄ POPDOWNMENU ³
- ³ ³ ³ ³ ³
- ³ ³ ³ ÀÄÄÄÄ SPINBUTTON ³
- ³ ³ ³ ³
- ³ ³ ÃÄÄ EDITBOX ³
- ³ ³ ³ ³ ³
- ³ ³ ³ ÀÄÄÄÄ COMBOBOX ³
- ³ ³ ³ ³
- ³ ³ ÃÄÄ PICTUREBOX ³
- ³ ³ ³ ³
- ³ ³ ÃÄÄ STATUSBAR ³
- ³ ³ ³ ³
- ³ ³ ÃÄÄ TEXT ³
- ³ ³ ³ ³
- ³ ³ ÃÄÄ BUTTON ³
- ³ ³ ³ ³
- ³ ³ ÃÄÄ RADIOBUTTON ³
- ³ ³ ³ ³
- ³ ³ ÀÄÄ CHECKBOX ³
- ³ ³ ³
- ³ ÀÄÄ DIALOG ³
- ³ ³ ³
- ³ ÃÄÄ ERRORBOX ³
- ³ ³ ³
- ³ ÃÄÄ MESSAGEBOX ³
- ³ ³ ³
- ³ ÀÄÄ HELPBOX ³
- ³ ³
- ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
-
-
-Window Attributes:
-
-Every window has an attribute word that defines some of its
-appearance and behavior. The following values are bitwise flags that
-OR together to make a window's attributes.
-
-You can establish default attributes for a window's class, add
-additional attributes when you create the window, and use the
-AddAttribute, ClearAttribute, and TestAttribute macros to change and
-test a window's attributes.
-
- SHADOW has a shadow
- MOVEABLE can move the window with mouse or cursor
- SIZEABLE can resize the window with mouse or cursor
- HASMENUBAR has a menubar (an application window)
- VSCROLLBAR has a vertical scroll bar
- HSCROLLBAR has a horizontal scroll bar
- VISIBLE is visible
- SAVESELF saves its own video memory
- TITLEBAR has a title bar
- CONTROLBOX has a control box and control menu
- MINMAXBOX has a min/max box
- NOCLIP is not clipped to its parent's borders
- READONLY is a readonly textbox
- MULTILINE is a multiline editbox or listbox
- HASBORDER has a border
- HASSTATUSBAR has a statusbar (application window only)
-
-Messages:
-
-A D-Flat program is message-driven. You initiate message processing
-with the init_messages function, create a window with the
-CreateWindow function, and go into the message dispatching loop with
-the dispatch_message function.
-
-A window can have a window-processing function. When the user causes
-events to occur by pressing keys and using the mouse, D-Flat sends
-messages to the window's function. That function can send messages to
-itself and other windows with the SendMessage and PostMessage
-functions.
-
-Windows are declared as members of a class. Every class has a default
-window-processing function. If you do not provide one for an instance
-of a window class, the default one receives messages for the window.
-Your custom window-processing function--if one exists--should chain to
-the default window-processing function for the blass by calling the
-DefaultWndProc function.
-
-There are five things a window-processing function can do with a
-message:
- - ignore it and let the D-Flat default processing occur.
- - suppress it by returning without chaining to the default
- window-processing function for the window class.
- - chain to the default window-processing function and then do some
- additional processing.
- - do some preliminary processing and then chain to the default
- window-processing function.
- - do all the processing of the message and then return without
- chaining to the default window-processing function for the
- window class.
-
-Following are the messages that an application program would use.
-There are other messages, but they are used by D-Flat only.
-
-Process Communication Messages
-
-START start message processing (not used now)
- Sent:
- P1:
- P2:
- Returns:
-
-STOP stop message processing
- Sent: by application window to NULL to stop message
- dispatch loop
- P1:
- P2:
- Returns:
-
-COMMAND send a command to a window
- Sent: to send command
- P1: command code (commands.h)
- P2: additional data (command-dependent)
- If the command code is a menu selection, P2 is the
- position of the selection on the menu (1,2,...)
- If the command code is a dialog box control, P2 is
- ENTERFOCUS when the command gets the focus, LEAVEFOCUS
- when the command loses the focus, and 0 when the user
- executes the control's command, e.g. presses a button.
- Returns: Nothing if sent by PostCommand
- Command-dependent value if sent by SendCommand
-
-
-Window Management Messages
-
-CREATE_WINDOW create a window
- Sent: by DFLAT to new window after window is created
- P1:
- P2:
- Returns:
-
-OPEN_WINDOW open a window
- Sent: (posted) by DFLAT to new window after window is created
- P1:
- P2:
- Returns:
-
-SHOW_WINDOW show a window
- Sent: by the app to the window to display the window
- P1:
- P2:
- Returns:
-
-HIDE_WINDOW hide a window
- Sent: by the app to the window to hide the window
- P1:
- P2:
- Returns:
-
-CLOSE_WINDOW delete a window
- Sent: by the app to destroy a window
- P1:
- P2:
- Returns:
-
-SETFOCUS set and clear the focus
- Sent: by D-Flat or the app to set or release the focus
- P1: true = set, false = release
- P2:
- Returns:
-
-PAINT paint the window's data space
- Sent: to paint the client area of a window
- P1: address of RECT relative to window (0/0 = upper left)
- to paint or 0 to paint entire client area
- P2: True to make non-focus window paint without clipping
- Returns:
-
-BORDER paint the window's border
- Sent: to paint a window's border
- P1: address of RECT relative to window (0/0 = upper left)
- to paint or 0 to paint entire border
- P2:
- Returns: FALSE to suppress D-Flat title display
- (e.g. the window displays its own border)
-
-TITLE display the window's title
- Sent: by D-Flat when it is about to display a window's title
- P1: address of RECT relative to window (0/0 = upper left)
- to paint or 0 to paint entire title
- P2:
- Returns: FALSE to suppress D-Flat title display
- (e.g. the window displays its own title)
-
-MOVE move the window
- Sent: to move a window
- P1: new left coordinate
- P2: new upper coordinate
- Returns:
-
-SIZE change the window's size
- Sent: to resize a window
- P1: new right coordinate
- P2: new lower coordinate
- Returns:
-
-MAXIMIZE maximize the window
- Sent: to maximize a window within its parent's client area
- P1:
- P2:
- Returns:
-
-MINIMIZE minimize the window
- Sent: to minimize a window to an icon
- P1:
- P2:
- Returns:
-
-RESTORE restore the window
- Sent: to restore a window to its position and size prior to the
- maximize or minimize operation
- P1:
- P2:
- Returns:
-
-INSIDE_WINDOW test x/y inside a window
- Sent: to test to see if coordinates are inside a window
- P1: x
- P2: y
- Returns: true or false
-
-
-Clock Messages
-
-CLOCKTICK the clock ticked
- Sent: every second to a window that has captured the clock
- P1: segment of time display string
- P2: offset of time display string
- Returns:
-
-CAPTURE_CLOCK capture clock into a window
- Sent: to capture the clock. To chain clock ticks, send this
- message to wnd->PrevClock when you receive the message.
- P1:
- P2:
- Returns:
-
-RELEASE_CLOCK release clock to the system
- Sent: to release the captured clock
- P1:
- P2:
- Returns:
-
-
-Keyboard and Screen Messages
-
-KEYBOARD key was pressed
- Sent: when key is pressed. sent to the window that has the focus
- P1: keystroke
- P2: shift key mask
- Returns:
-
-CAPTURE_KEYBOARD capture keyboard into a window
- Sent: by window to itself to capture the keyboard
- regardless of focus
- P1:
- P2:
- Returns:
-
-RELEASE_KEYBOARD release keyboard to system
- Sent: by window to itelf to release the captured keyboard
- P1:
- P2:
- Returns:
-
-KEYBOARD_CURSOR position the keyboard cursor
- Sent: to position the keyboard cursor
- P1: x (if sent by window, 0 = left client area)
- P2: y (if sent by window, 0 = top client area)
- if sent with NULL, x/y are relative to the screen
- Returns:
-
-CURRENT_KEYBOARD_CURSOR read the cursor position
- Sent: to retrieve the cursor position
- P1: x (relative to the screen)
- P2: y (relative to the screen)
- Returns:
-
-HIDE_CURSOR hide the keyboard cursor
- Sent: to hide the keyboard cursor
- P1:
- P2:
- Returns:
-
-SHOW_CURSOR display the keyboard cursor
- Sent: to display the keyboard cursor
- P1:
- P2:
- Returns:
-
-SAVE_CURSOR save the cursor's configuration
- Sent: to save the keyboard cursor's current configuration
- P1:
- P2:
- Returns:
-
-RESTORE_CURSOR restore the saved cursor
- Sent: to restore a keyboard cursor's saved configuration
- P1:
- P2:
- Returns:
-
-SHIFT_CHANGED the shift status changed
- Sent: to in-focus window when the user presses or
- releases shift, alt, or ctrl key
- P1: BIOS shift key mask
- P2:
- Returns:
-
-WAITKEYBOARD wait for key release
- Sent: to wait for a keypress release
- P1:
- P2:
- Returns:
-
-
-Mouse Messages
-
-RESET_MOUSE reset the mouse
- Sent: to reset the mouse to the current screen configuration
- P1:
- P2:
- Returns:
-
-MOUSE_TRAVEL set the mouse's travel
- Sent: to limit the mouse travel to a screen rectangle
- P1: address of a RECT
- P2:
- Returns:
-
-MOUSE_INSTALLED test for mouse installed
- Sent: to see if the mouse is installed
- P1:
- P2:
- Returns: true or false
-
-RIGHT_BUTTON right button pressed
- Sent: to window when the user presses the right button
- (sent only when mouse cursor is within the window
- or the window has captured the mouse)
- P1: x
- P2: y
- Returns:
-
-LEFT_BUTTON left button pressed
- Sent: to window when the user presses the left button
- (sent only when mouse cursor is within the window
- or the window has captured the mouse)
- P1: x
- P2: y
- Returns:
-
-DOUBLE_CLICK left button doubleclicked
- Sent: to window when the user double-clicks the left button
- (sent only when mouse cursor is within the window
- or the window has captured the mouse)
- (a LEFT_BUTTON message will have preceded this one)
- P1: x
- P2: y
- Returns:
-
-MOUSE_MOVED mouse changed position
- Sent: to window when the mouse has moved
- (sent only when mouse cursor is within the window
- or the window has captured the mouse)
- P1: x
- P2: y
- Returns:
-
-BUTTON_RELEASED mouse button released
- Sent: to window when user releases mouse button
- (sent only when mouse cursor is within the window
- or the window has captured the mouse)
- P1: x
- P2: y
- Returns:
-
-CURRENT_MOUSE_CURSOR get mouse position
- Sent: to determine the current mouse position
- P1: address of x
- P2: address of y
- Returns: mouse coordinates in x and y. If no mouse is installed,
- returns -1 in x and y.
-
-MOUSE_CURSOR set mouse position
- Sent: to set the current mouse position
- P1: x
- P2: y
- Returns:
-
-SHOW_MOUSE make mouse cursor visible
- Sent: to display the mouse cursor
- P1:
- P2:
- Returns:
-
-HIDE_MOUSE hide mouse cursor
- Sent: to hide the mouse cursor
- P1:
- P2:
- Returns:
-
-WAITMOUSE wait until button released
- Sent: to wait until the user releases the mouse button
- P1:
- P2:
- Returns:
-
-TESTMOUSE test any mouse button pressed
- Sent: to see if either mouse button is pressed
- P1:
- P2:
- Returns: true or false
-
-CAPTURE_MOUSE capture mouse into a window
- Sent: by/to a window to capture all mouse activity
- regardless of whether it occurs inside this window
- P1:
- P2:
- Returns:
-
-RELEASE_MOUSE release the mouse to system
- Sent: release a captured mouse
- P1:
- P2:
- Returns:
-
-
-Text Box Messages
-
-ADDTEXT add text to the text box
- Sent: to append a line of text to the text box
- P1: address of null-terminated string without \n
- (textbox makes its own copy. string can go out of scope.)
- P2:
- Returns:
-
-DELETETEXT delete line of text from the text box
- Sent: to delete a line of text from the text box
- P1: line number relative to zero
- P2:
- Returns:
-
-INSERTTEXT insert line of text into the text box
- Sent: to insert a line of text into the text box
- P1: address of null-terminated string without \n
- P2: line number relative to zero that will follow new line.
- Returns:
-
-CLEARTEXT clear the text box
- Sent: clear all text from the text box
- P1:
- P2:
- Returns:
-
-SETTEXT set text buffer contents
- Sent: To set text buffer to caller's text.
- P1: address of text buffer
- (lines are terminated by \n without \0)
- (textbox makes its own copy. string can go out of scope.)
- P2: length of text buffer
- Returns:
-
-SCROLL vertical scroll of text box
- Sent: to scroll a text window vertically one line
- P1: true = scroll up, false = scroll down
- P2:
- Returns:
-
-HORIZSCROLL horizontal scroll of text box
- Sent: to scroll a text window horizontally one column
- P1: true = scroll left, false = scroll right
- P2:
- Returns:
-
-SCROLLPAGE vertical scroll of text box 1 page
- Sent: to scroll a text window vertically one page
- P1: true = scroll up, false = scroll down
- P2:
- Returns:
-
-HORIZSCROLLPAGE horizontal scroll of text box 1 page
- Sent: to scroll a text window horizontally one page
- P1: true = scroll left, false = scroll right
- P2:
- Returns:
-
-SCROLLDOC document scroll of text box
- Sent: to scroll a text window to beginning/end of document
- P1: true = scroll to beginning, false = scroll to end
- P2:
- Returns:
-
-Edit Box Messages
-
-GETTEXT get text from an edit box
- Sent: Get the line of text from a single-line editbox
- P1: address of receiving buffer
- P2: max length to copy
- Returns:
-
-SETTEXTLENGTH set maximum text length in an edit box
- Sent: to set the maximum number of characters that an editbox
- may hold in its buffer.
- P1: maximum character count
- P2:
- Returns:
-
-
-Application Window Messages
-
-ADDSTATUS write text to the status bar
- Sent: to write to or clear status bar text area
- P1: address of text (null-terminated string) or NULL to clear
- P2:
- Returns:
-
-List Box Messages
-
-LB_SELECTION list box selection
- Sent: sent by list box to self and to parent (if parent is not
- a simple LISTBOX window) when user moves to an entry on
- the list box.
- P1: selection number: 0, 1, ...
- P2: if multi-line selection listbox, shift status mask
- if not, true = selection was same as choice (e.g. mouse)
- Returns:
-
-LB_CHOOSE list box choice
- Sent: sent to parent of list box when user chooses an item
- from the list box
- P1: selection number: 0, 1, ...
- P2:
- Returns:
-
-LB_CURRENTSELECTION return the current selection
- Sent: To get the current selection number (where the listbox
- cursor is positioned)
- P1:
- P2:
- Returns: selection number: 0, 1, ..., or -1 if listbox is empty or
- no line is selected.
-
-LB_GETTEXT return the text of selection
- Sent: To get a copy of the text at a specified line
- P1: Address of string to receive copy of text
- P2: Line number: 0, 1, ...
- Returns:
-
-LB_SETSELECTION sets the listbox selection
- Sent: To change where the listbox cursor points
- P1: Line number: 0, 1, ...
- P2:
- Returns:
-
-Picture Box Messages
-
-DRAWVECTOR Draws a vector
- Sent: To draw a vector in the window's client area
- P1: address of RECT that describes the vector relative to the
- window's client area
- (either lf = rt [vertical vector] or tp = bt [horizontal
- vector])
- P2:
- Returns:
-
-DRAWBOX Draws a box
- Sent: To draw a box in the window's client area
- P1: address of RECT that describes the box relative to the
- window's client area
- P2:
- Returns:
-
-DRAWBAR Draws a barchart bar
- Sent: To draw a bar in the window's client area
- P1: address of RECT that describes the bar relative to the
- window's client area
- (either lf = rt [vertical vector] or tp = bt [horizontal
- vector])
- P2: one of these: SOLIDBAR, HEAVYBAR, CROSSBAR, LIGHTBAR
- (4 different bar textures)
- Returns:
-
-=====================================================
-
-API Functions & Macros:
-
-These are functions and macros defined for use by applications
-programs. There are many others defined in the header files. These
-others are for D-Flat to use, and programmers need not be concerned
-about them except as an expression of their curiosity about how
-D-Flat works.
-
-
-(Note: These specifications are not in any orderly sequence yet.)
-
-
--------------------------------------------------------------------
-void init_messages(void)
-
-Call this function first to initialize message processing. Continue
-only if the function returns a true value. Otherwise, terminate the
-processing of your program. A false return occurs from a longjmp that
-is executed when D-Flat attempts to allocate memory that is not
-available.
-
--------------------------------------------------------------------
-WINDOW CreateWindow(
- CLASS 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 */
- WINDOW parent, /* parent of this window */
- int (*wndproc)(struct window *,MESSAGE,PARAM,PARAM),
- int attrib) /* window attribute */
-
-This function creates a window. It returns the WINDOW handle that
-messages and functions use to identify the window. If you specify
-NULL for the parent, the APPLICATION window becomes the parent.
-
--------------------------------------------------------------------
-void PostMessage(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
-
-Post a message to a window. The window will receive the message in
-turn during the message-dispatching loop.
-
--------------------------------------------------------------------
-int SendMessage(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
-
-Send a message to a window. The window will receive the message
-immediately. Control returns to the sender after the window has
-processed the message. The window can return an integer value.
-
-This function can send system messages to NULL. System messages
-are ones that D-Flat processes without regard to a particular window.
--------------------------------------------------------------------
-int dispatch_message(void)
-
-The message dispatching loop. After opening the first window (usually
-the applications window), continue to call this function until it
-returns a FALSE value.
--------------------------------------------------------------------
-void handshake(void)
-
-This function dispatches messages without allowing any keyboard or
-click events to pass through. You use it to allow the clock to run or
-the watch icon to move during a lengthy process without allowing
-anything to execute a command that might interfere with what your
-program is doing.
-
--------------------------------------------------------------------
-int TestCriticalError(void)
-
--------------------------------------------------------------------
-int DefaultWndProc(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
-
-Call this from a window-processing function to chain to the default
-window-processing function for the window's class.
-
--------------------------------------------------------------------
-int BaseWndProc(CLASS Class, WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
-
-Call this from the window-processing function of a derived window
-class to chain to the window-processing function of the base window's
-class.
-
--------------------------------------------------------------------
-int WindowHeight(WINDOW wnd)
-int WindowWidth(WINDOW wnd)
-
-These functions return the window's height and width.
--------------------------------------------------------------------
-int ClientWidth(WINDOW wnd)
-int ClientHeight(WINDOW wnd)
-
-These functions return the height and width of the window's client
-area.
-
--------------------------------------------------------------------
-int GetTop(WINDOW wnd)
-int GetBottom(WINDOW wnd)
-int GetLeft(WINDOW wnd)
-int GetRight(WINDOW wnd)
-
-These functions return the screen coordinates of the four corners of
-the window.
-
--------------------------------------------------------------------
-int GetClientTop(WINDOW wnd)
-int GetClientBottom(WINDOW wnd)
-int GetClientLeft(WINDOW wnd)
-int GetClientRight(WINDOW wnd)
-
-These functions return the screen coordinates of the four corners of
-the window's client area.
-
--------------------------------------------------------------------
-WINDOW GetParent(WINDOW wnd)
-
-Returns the parent of the window or NULL if the window has no
-parent.
-
--------------------------------------------------------------------
-WINDOW FirstWindow(wnd)
-
-Returns the first child window that wnd is a parent of or NULL if
-wnd has no children.
-
--------------------------------------------------------------------
-WINDOW LastWindow(wnd)
-
-Returns the last child window that wnd is a parent of or NULL if
-wnd has no children.
-
--------------------------------------------------------------------
-WINDOW NextWindow(wnd)
-
-Returns the next adjacent sibling window of wnd or NULL if wnd has no
-siblings.
-
--------------------------------------------------------------------
-WINDOW PrevWindow(wnd)
-
-Returns the previous adjacent sibling window of wnd or NULL if wnd
-has no siblings.
-
--------------------------------------------------------------------
-int CharInView(WINDOW wnd, int x, int y)
-
-Returns true if the x/y character position, relative to the window,
-is in view (not clipped at the border of a parent window or the
-screen.
-
--------------------------------------------------------------------
-int TopBorderAdj(WINDOW wnd)
-
-Returns the value to add to a y coordinate of the window's client
-area to make it relative to the window top.
-
--------------------------------------------------------------------
-int BorderAdj(WINDOW wnd)
-
-Returns the value to add to an x coordinate relative to the window's
-client area to make it relative to the window's left edge.
-
--------------------------------------------------------------------
-char *GetTitle(WINDOW wnd)
-
-Returns the address of a window's title, or NULL if the window has no
-title.
-
--------------------------------------------------------------------
-void AddTitle(WINDOW wnd, char *title)
-
-Adds or changes the title to an existing window.
-
--------------------------------------------------------------------
-CLASS GetClass(WINDOW wnd)
-
-Returns the class of the window.
-
--------------------------------------------------------------------
-int GetAttribute(WINDOW wnd)
-
-Returns the attribute word of a window.
-
--------------------------------------------------------------------
-void AddAttribute(WINDOW wnd, int attrib)
-
-Adds one or more attributes to a window. OR the attribute values
-together.
-
--------------------------------------------------------------------
-void ClearAttribute(WINDOW wnd, int attrib)
-
-Clears one or more attributes from a window. OR the attribute values
-together.
-
--------------------------------------------------------------------
-int TestAttribute(WINDOW wnd, int attrib)
-
-Tests one or more attributes in a window. Returns true if any of them
-are set. OR the attribute values together.
-
--------------------------------------------------------------------
-int isVisible(WINDOW wnd)
-
-Returns true if the window is visible.
-
--------------------------------------------------------------------
-char *GetText(WINDOW wnd)
-
-Returns the address of the text buffer for a TEXTBOX or derived
-window class.
-
--------------------------------------------------------------------
-int GetTextLines(WINDOW wnd)
-
-Returns the number of text lines in a TEXTBOX or derived
-window class.
-
--------------------------------------------------------------------
-char *TextLine(WINDOW wnd, int line)
-
-Returns the address of a specified line of text (0, 1, ...) in a
-TEXTBOX or derived class.
-
--------------------------------------------------------------------
-void SetProtected(WINDOW wnd)
-
-Protects a TEXTBOX or control derived from a TEXT from having its
-data displayed. Displays * for each displayable character. Typically
-used for EDITBOX controls used for password input.
-
--------------------------------------------------------------------
-int isActive(MENU *mnu, int command)
-
-Returns true if the command (commands.h) on the menu is active
-(enabled).
-
--------------------------------------------------------------------
-char *GetCommandText(MBAR *mn, int cmd)
-
-Returns the address of a menu command's title text.
-
--------------------------------------------------------------------
-void ActivateCommand(MENU *mnu, int command)
-void DeactivateCommand(MENU *mnu, int command)
-
-Activate (enable) or deactivate (disable) a command (commands.h) on a
-menu.
-
--------------------------------------------------------------------
-int GetCommandToggle(MENU *mnu, int command)
-void SetCommandToggle(MENU *mnu, int command)
-void ClearCommandToggle(MENU *mnu, int command)
-void InvertCommandToggle(MENU *mnu, int command)
-
-Some menu commands are toggles rather than executors of processes.
-Examples are the Insert and Word wrap commands on the Options menu.
-These functions get, set, clear, and invert the toggle setting for a
-specified command on a specified menu.
-
--------------------------------------------------------------------
-int ItemSelected(WINDOW wnd, int line)
-
-This function returns true if the specified item (0, 1, ...) on a
-multiple-line selection listbox is selected.
-
--------------------------------------------------------------------
-int DialogBox(
- WINDOW wnd, /* parent window of the dialog box */
- DBOX *db, /* address of dialog box definition array */
- int Modal, /* true if it is a modal dialog box */
- int (*wndproc)(struct window *, MESSAGE, PARAM, PARAM)
- /* the window processing function or NULL */
-)
-
-This function executes a dialog box. If it is a modal dialog box, the
-function does not return until the user completes the dialog box. The
-return value will be true if the user has selected OK and false if
-the user has selected Cancel on the dialog box. If the dialog box is
-modeless, the function returns immediately, and the user can select
-other things from the screen while the dialog box is still active.
-
--------------------------------------------------------------------
-WINDOW ControlWindow(DBOX *db, enum commands cmd)
-
-This function returns the WINDOW handle of the control specified by
-the cmd parameter.
--------------------------------------------------------------------
-void MessageBox(char *title, char *message)
-void CancelBox(wnd, char *message)
-void ErrorMessage(char *message)
-int TestErrorMessage(char *message)
-int YesNoBox(char *question)
-WINDOW MomentaryMessage(char *message)
-
-These functions display generic message boxes. The message text is
-one null-terminated string with newlines (\n) to indicate where lines
-are to be broken. The size of the boxes adjusts to the width of the
-longest line and the number of lines of text. A message may have no
-more lines of text than will fit into the largest window that the
-screen can display. You must account for the window's border's and
-the presence at the bottom of one or more command buttons.
-
-The MessageBox function displays a message in a window with a title
-provided by the caller. The window contains the message and an OK
-command button.
-
-The CancelBox function displays a message in a window with a
-"Wait..." title. The window contains the message and a Cancel command
-button. If the user presses the Cancel button before the program
-closes the window, the COMMAND, ID_CANCEL message is sent to the
-parent window.
-
-The ErrorMessage function displays the message in an error box window
-with an OK command button.
-
-The TestErrorMessage function is an error message with OK and Cancel
-command buttons. The function returns true if the user selects OK or
-presses Enter and false if the user selects Cancel or presses Esc.
-
-The YesNoBox function displays the message with Yes and No command
-buttons. The function returns true if the user selects Yes or
-presses Enter and false if the user selects No or presses Esc.
-
-The MomentaryMessage function displays a message box and returns its
-WINDOW handle. The caller must close the window. The purpose of this
-function is to allow you to display a message while some time
-consuming process is underway and then erase the message after the
-process is done but without any action required from the user.
-
--------------------------------------------------------------------
-int InputBox(WINDOW wnd, char *ttl, char *msg, char *text, int len, int wd)
-
-This function executes a generic one-line user input dialog box. The
-wnd parameter is the parent window of the dialog box. The ttl
-parameter points to a title string for the dialog box. The msg
-parameter points to a prompting text message. The text parameter
-points to the string that will receive the user's input. The len
-parameter is the length of the input string not including the null
-terminator. The wd parameter is the width of the string display. If
-the wd parameter is 0, the function computes a width based on the len
-parameter.
-
-The function returns a true value if the user chooses the OK command
-button and false if the user selects Cancel.
-
--------------------------------------------------------------------
-WINDOW SliderBox(int len, char *ttl, char *msg)
-
-This function displays a dialog box with the specified title and
-message, a slider bar of the specified length, and a Cancel button.
-The slider bar displays a percent value.
-
-You use the slider box to display feedback to the user when the
-program is doing a time-consuming task, such as printing a file.
-Periodically, through your process, you send a PAINT message to the
-window handle that the SliderBox function returns. The second
-parameter is the new percent value. When you have sent 100, the
-slider dialog box closes itself. If the user chooses the Cancel
-command on the dialog box, your next PAINT message returns FALSE.
-Otherwise it returns TRUE.
-
--------------------------------------------------------------------
-int RadioButtonSetting(DBOX *db, enum commands cmd)
-
-This function returns true if the specified command on the specified
-dialog box is a pressed radio button.
-
--------------------------------------------------------------------
-void EnableButton(DBOX *db, enum commands cmd)
-
-This function enables a command button on a dialog box. command
-buttons are initially enabled when the dialog box is first opened.
-
--------------------------------------------------------------------
-void DisableButton(DBOX *db, enum commands cmd)
-
-This function disables a command button on a dialog box. command
-buttons are initially enabled when the dialog box is first opened.
-
--------------------------------------------------------------------
-int ButtonEnabled(DBOX *db, enum commands cmd)
-
-Returns true if the button is enabled.
--------------------------------------------------------------------
-void PushRadioButton(DBOX *db, enum commands cmd)
-
-This function presses the specified radio button command on the
-specified dialog box.
-
--------------------------------------------------------------------
-void PutItemText(WINDOW wnd, enum commands cmd, char *text)
-
-This function appends a line of text to a TEXT, TEXTBOX, EDITBOX,
-LISTBOX, SPINBUTTON, or COMBOBOX control window in a dialog box. The
-wnd parameter is the WINDOW handle of the dialog box. The cmd
-parameter specifies the command associated with the control item. The
-text parameter points to the text to be added. The control window
-makes its own copy of the text, so the caller's copy can go out of
-scope. If the control window is a COMBOBOX, TEXTBOX, or EDITBOX
-window, you must send a PAINT message to the control window so that
-the new text will display.
-
-You must call this function while the dialog box is active. That
-means that if the dialog box is modal, you must call this function
-from within a custom window processing function that you supply when
-you call DialogBox.
-
--------------------------------------------------------------------
-void PutComboListText(WINDOW wnd, enum commands cmd, char *text)
-
-This function appends a line of text to the LISTBOX of a COMBOBOX
-control window in a dialog box. The wnd parameter is the WINDOW
-handle of the dialog box. The cmd parameter specifies the command
-associated with the combo box. The text parameter points to the
-text to be added. The control window makes its own copy of the text,
-so the caller's copy can go out of scope.
-
-You must call this function while the dialog box is active. That
-means that if the dialog box is modal, you must call this function
-from within a custom window processing function that you supply when
-you call DialogBox.
-
--------------------------------------------------------------------
-void GetItemText(WINDOW wnd, enum commands cmd, char *text, int length)
-
-This function copies the text from a TEXT, TEXTBOX, COMBOBOX, or
-EDITBOX control window in a dialog box. The wnd parameter is the
-WINDOW handle of the dialog box. The cmd parameter specifies the
-command associated with the control item. The text parameter points
-to the caller's buffer where the text will be copied. The length
-parameter specifies the maximum number of characters to copy.
-
-You must call this function while the dialog box is active. That
-means that if the dialog box is modal, you must call this function
-from within a custom window processing function that you supply when
-you call DialogBox.
-
--------------------------------------------------------------------
-char *GetEditBoxText(DBOX *db, enum commands cmd)
-
-This function returns a pointer to the text associated with an
-editbox control in a dialog box. You can call it after the dialog box
-has completed processing. The buffer is on the heap. Do not free it.
-Instead, call SetEditBoxText with a NULL pointer.
-
--------------------------------------------------------------------
-char *GetComboBoxText(DBOX *db, enum commands cmd)
-
-This function returns a pointer to the text associated with an
-combo box control in a dialog box. You can call it after the dialog box
-has completed processing. The buffer is on the heap. Do not free it.
-Instead, call SetEditBoxText with a NULL pointer.
-
--------------------------------------------------------------------
-void SetEditBoxText(DBOX *db, enum commands cmd, char *text)
-
-This function sets the text of a dialog box editbox. You can call
-this function before or while the dialog box is open. The dialog box
-makes its own copy on the heap, so your text can go out of scope.
-
--------------------------------------------------------------------
-void SetComboBoxText(DBOX *db, enum commands cmd, char *text)
-
-This function sets the text of a dialog box combo box. You can call
-this function before or while the dialog box is open. The dialog box
-makes its own copy on the heap, so your text can go out of scope.
-
--------------------------------------------------------------------
-char *GetDlgText(DBOX *db, enum commands cmd, char *text)
-
-Similar to GetEditBoxText except that it works with text controls.
-
--------------------------------------------------------------------
-char *SetDlgText(DBOX *db, enum commands cmd, char *text)
-
-Similar to SetEditBoxText except that it works with text controls.
-
--------------------------------------------------------------------
-char *GetDlgTextBox(DBOX *db, enum commands cmd, char *text)
-
-Similar to GetEditBoxText except that it works with textbox controls.
-
--------------------------------------------------------------------
-char *SetDlgTextBox(DBOX *db, enum commands cmd, char *text)
-
-Similar to SetEditBoxText except that it works with textbox controls.
-
--------------------------------------------------------------------
-void SetCheckBox(DBOX *db, enum commands cmd)
-void ClearCheckBox(DBOX *db, enum commands cmd)
-int CheckBoxSetting(DBOX *db, enum commands cmd)
-
-These functions set, clear, and test the setting of a specified check
-box control item on a dialog box.
-
--------------------------------------------------------------------
-void SetDlgTitle(DBOX *db, char *ttl)
-
-This function changes the specified dialog box's title.
--------------------------------------------------------------------
-void LoadHelpFile(char *apname);
-
-This function loads the help file. The apname parameter points to
-the helpfile name without the .hlp extension.
-
-Call this function at the beginning of an application program or to
-change the help file midstream.
-
--------------------------------------------------------------------
-void DisplayHelp(WINDOW wnd, char *Help)
-
-Display the help window identified by the Help parameter. See the
-comments in memopad.txt for the format of a help database. You can
-get the same effect by sending the DISPLAY_HELP message with a
-pointer to the Help string as the first parameter after the message
-id.
-
--------------------------------------------------------------------
-char *HelpComment(char *Help)
-
-Retrieve a pointer to the comment text associated with the specified
-Help parameter.
-
--------------------------------------------------------------------
-void UnLoadHelpFile(void);
-
-Call this function at the end of a D-Flat application to free the
-memory used by a help file.
-
--------------------------------------------------------------------
-void SearchText(WINDOW wnd)
-
-Opens a dialog box for the user to enter a search string. Searches
-the wnd TEXTBOX for a match on the string.
-
--------------------------------------------------------------------
-void ReplaceText(WINDOW wnd)
-
-Opens a dialog box for the user to enter search and replacement
-strings. Searches the wnd TEXTBOX for a match on the string and
-replaces it if found. The dialog box includes an option to replace
-all matches.
-
--------------------------------------------------------------------
-void SearchNext(WINDOW wnd)
-
-Assumes that a previous SearchText call has found a match. Searches
-for the next match of the same string in the specified EDITBOX
-window.
-
--------------------------------------------------------------------
-void WriteTextLine(WINDOW wnd, RECT *rcc, int y, int reverse)
-
-This function displays a text line from a TEXTBOX or derived window
-class. The text has already been added to the window with ADDTEXT,
-etc. The y parameter specifies which line (0, 1, ...) relative to the
-window's text buffer to display. If the specified line is not in
-view, the function does nothing. If the reverse parameter is true,
-the line displays in the reverse-video colors of the window. The rcc
-RECT pointer is usually NULL for applications calls. It points to a
-rectangle relative to the window outside of which displays will not
-occur.
-
--------------------------------------------------------------------
-void PutWindowLine(WINDOW wnd, void *s, int x, int y)
-
-This function writes a line of text to a window. The x and y
-coordinates point to the first character in the window's client area
-where the line is to be written. The text must be null-terminated.
-This function clips the line if it goes beyond the window or the
-screen. The function clips the line if it goes outside the borders of
-the window's parent. If other windows overlap the target window, the
-text is clipped. Do not use negative values in x or y.
-
-You can assign color values to the global variables foreground and
-background to affect the color of the line's display.
-
--------------------------------------------------------------------
-void PutWindowChar(WINDOW wnd, int c, int x, int y)
-
-This function writes the character c to a window. The x and y
-coordinates are relative to the window's client area.
-
-The function performs clipping. If the character is beyond the
-window's or the screen's borders it is not written. If the window
-does not have the NOCLIP attribute, the character is not written if
-its coordinates are beyond the margins of its parent window (if the
-window has a parent). If other windows overlap the target window, the
-text is clipped. Do not use negative values in x or y.
-
-You can assign color values to the global variables foreground and
-background to affect the color of the character's display.
-
--------------------------------------------------------------------
-void DrawVector(WINDOW wnd, int x, int y, int len, int hv)
-
-Draw a horizontal vector in a picture box. x and y are character
-coordinates relative to the starting position of the vector. len is
-the length. hv is TRUE for a horizontal vector and FALSE for a
-vertical vector. Sends a DRAWVECTOR message to the window.
-
-Send a PAINT message to the window to display the vectors.
-
--------------------------------------------------------------------
-void DrawBox(WINDOW wnd, int x, int y, int ht, int wd)
-
-Draw a box in a picture box. x and y are character coordinates
-relative to the upper left corner of the box. ht and wd are the
-height and width of the box. Sends a DRAWBOX message to the window.
-
-Send a PAINT message to the window to display the box.
-
--------------------------------------------------------------------
-void DrawBar(WINDOW wnd, enum VectTypes vt, int x, int y, int len, int hv)
-
-Draw a graph bar in a picture box. vt is one of the following values
-to specify the character box used to display the bar: SOLIDBAR,
-HEAVYBAR, CROSSBAR, LIGHTBAR. x and y are character coordinates
-relative to the starting position of the bar. len is the length. hv
-is TRUE for a horizontal bar and FALSE for a vertical bar. Sends a
-DRAWBAR message to the window.
-
-Send a PAINT message to the window to display the bars.
-
--------------------------------------------------------------------
-void WindowClientColor(WINDOW wnd, int fg, int bg)
-
-Changes the window client space's foreground and background colors.
--------------------------------------------------------------------
-void WindowReverseColor(WINDOW wnd, int fg, int bg)
-
-Changes the window's foreground and background reverse colors, which
-are used to display such things as selected text blocks.
--------------------------------------------------------------------
-void WindowFrameColor(WINDOW wnd, int fg, int bg)
-
-Changes the window's foreground and background frame colors.
--------------------------------------------------------------------
-void WindowHighlightColor(WINDOW wnd, int fg, int bg)
-
-Changes the window's foreground and background highlight colors,
-which are used to display highlighted items such as menu selector
-bars.
--------------------------------------------------------------------
-void MarkTextBlock(WINDOW wnd, int BegLine, int BegCol,
- int EndLine, int EndCol)
-
-Marks a block in the specified TEXTBOX window.
-
--------------------------------------------------------------------
-void ClearTextBlock(WINDOW wnd)
-
-Unmarks a marked block in the specified TEXTBOX window.
-
--------------------------------------------------------------------
-void CopyToClipboard(WINDOW wnd)
-
-Copies the marked block from the WINDOW into the Clipboard.
-
--------------------------------------------------------------------
-void CopyTextToClipboard(char *string)
-
-Copies a null-terminated string into the Clipboard.
-
--------------------------------------------------------------------
-void PasteFromClipboard(WINDOW wnd)
-
-Pastes the Clipboard's contents into the specified EDITBOX window at
-the current cursor location.
-
--------------------------------------------------------------------
-void ClearClipboard(void)
-
-Clears the clipboard and frees the memory allocated for it. Called by
-D-Flat when message processing terminates.
-
--------------------------------------------------------------------
-WINDOW WatchIcon(void)
-
-Displays a wristwatch icon on the screen. The icon has control of the
-keyboard and mouse. You must send the CLOSE_WINDOW message to the
-WINDOW handle that WatchIcon returns to get rid of the icon.
-
-Use this icon to tell the user to please stand by during long
-processes. Call handshake frequently during these processes to
-update the date display in the status bar and to allow the watch icon
-to move when the user moves the mouse.
-
--------------------------------------------------------------------
-Configurable Items
-
-Global Symbol File Value Description
-------------- --------- ----- ---------------------------------------
-MAXMESSAGES DFLAT.H 50 Maximum D-Flat messages queued
-MAXCONTROLS DIALBOX.H 26 Maximum Controls on a dialog box
-MAXRADIOS DIALBOX.H 20 Maximum radio buttons in a group
-MAXSAVES SYSTEM.H 50 Maximum cursor saves
-MAXPULLDOWNS MENU.H 15 Maximum number of pull-down menus on
- a menu bar (including cascading menus)
-MAXSELECTIONS MENU.H 15 Maximum number of selections on
- a pull-down menu (includes separators)
-MAXCASCADES MENU.H 3 Maximum nesting level of cascaded menus
-MAXTEXTLEN DFLAT.H 65000 Maximum text buffer
-EDITLEN DFLAT.H 1024 Starting length for multiline EDITBOX
-ENTRYLEN DFLAT.H 256 Starting length for single-line EDITBOX
-GROWLENGTH DFLAT.H 64 EDITBOX buffers grow by this much
-
-
+++ /dev/null
-/* ------------- dflat.h ----------- */
-#ifndef DFLAT_H
-#define DFLAT_H
-
-//#ifdef BUILD_FULL_DFLAT
-#define INCLUDE_MULTI_WINDOWS
-#define INCLUDE_LOGGING
-#define INCLUDE_SHELLDOS
-#define INCLUDE_WINDOWOPTIONS
-#define INCLUDE_PICTUREBOX
-#define INCLUDE_MINIMIZE
-#define INCLUDE_MAXIMIZE
-#define INCLUDE_RESTORE
-#define INCLUDE_EXTENDEDSELECTIONS
-//#endif
-
-#include <windows.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <dos.h>
-#include <process.h>
-#include <conio.h>
-#include <ctype.h>
-#include <io.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <time.h>
-#include <setjmp.h>
-
-#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);
-
-
-#define DF_MAXMESSAGES 50
-#define DF_DELAYTICKS 1
-#define DF_FIRSTDELAY 7
-#define DF_DOUBLETICKS 5
-
-#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"
-#include "rect.h"
-#include "menu.h"
-#include "keys.h"
-#include "commands.h"
-#include "dialbox.h"
-
-/* ------ integer type for message parameters ----- */
-typedef long DF_PARAM;
-
-enum DfCondition
-{
- DF_SRESTORED, DF_ISMINIMIZED, DF_ISMAXIMIZED, DF_ISCLOSING
-};
-
-typedef struct DfWindow
-{
- DFCLASS class; /* window class */
- char *title; /* window title */
- int (*wndproc)(struct DfWindow *, enum DfMessages, DF_PARAM, DF_PARAM);
-
- /* ----------------- window colors -------------------- */
- char WindowColors[4][2];
-
- /* ---------------- window dimensions ----------------- */
- DFRECT rc; /* window coordinates (0/0 to 79/24) */
- int ht, wd; /* window height and width */
- DFRECT RestoredRC; /* restored condition rect */
-
- /* -------------- linked list pointers ---------------- */
- 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 DfCondition condition; /* Restored, Maximized,
- Minimized, Closing */
- enum DfCondition oldcondition;/* previous condition */
- int restored_attrib; /* attributes when restored */
- void *extension; /* menus, dialogs, documents, etc */
- 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 ------------------ */
- int wlines; /* number of lines of text */
- int wtop; /* text line that is on the top display */
- char *text; /* window text */
- unsigned int textlen; /* text length */
- int wleft; /* left position in window viewport */
- int textwidth; /* width of longest line in textbox */
- int BlkBegLine; /* beginning line of marked block */
- int BlkBegCol; /* beginning column of marked block */
- int BlkEndLine; /* ending line of marked block */
- int BlkEndCol; /* ending column of marked block */
- int HScrollBox; /* position of horizontal scroll box */
- int VScrollBox; /* position of vertical scroll box */
- unsigned int *TextPointers; /* -> list of line offsets */
-
- /* ----------------- list box fields ------------------ */
- int selection; /* current selection */
- BOOL AddMode; /* adding extended selections mode */
- int AnchorPoint;/* anchor point for extended selections */
- int SelectCount;/* count of selected items */
-
- /* ----------------- edit box fields ------------------ */
- int CurrCol; /* Current column */
- int CurrLine; /* Current line */
- int WndRow; /* Current window row */
- BOOL TextChanged; /* TRUE if text has changed */
- char *DeletedText; /* for undo */
- unsigned DeletedLength; /* Length of deleted field */
- BOOL InsertMode; /* TRUE or FALSE for text insert */
- BOOL WordWrapMode; /* TRUE or FALSE for word wrap */
- unsigned int MaxTextLength; /* maximum text length */
-
- /* ---------------- dialog box fields ----------------- */
- int ReturnCode; /* return code from a dialog box */
- BOOL Modal; /* True if a modeless dialog box */
- DF_CTLWINDOW *ct; /* control structure */
- struct DfWindow *dfocus; /* control window that has focus */
- /* -------------- popdownmenu fields ------------------ */
- 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 */
- void *lastword; /* -> last in list of key words */
- void *thisword; /* -> current in list of key words */
- /* -------------- status bar fields ------------------- */
- BOOL TimePosted; /* True if time has been posted */
-#ifdef INCLUDE_PICTUREBOX
- /* ------------- picture box fields ------------------- */
- int VectorCount; /* number of vectors in vector list */
- void *VectorList; /* list of picture box vectors */
-#endif
-} * DFWINDOW;
-
-#include "classdef.h"
-#include "video.h"
-
-void DfLogMessages (DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM);
-void DfMessageLog(DFWINDOW);
-/* ------- window methods ----------- */
-#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 DfSetNextFocus(void);
-void DfSetPrevFocus(void);
-void DfRemoveWindow(DFWINDOW);
-void DfAppendWindow(DFWINDOW);
-void DfReFocus(DFWINDOW);
-void DfSkipApplicationControls(void);
-
-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 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 *DfClipboard;
-extern unsigned DfClipboardLength;
-extern BOOL DfClipString;
-/* --------- space between menubar labels --------- */
-#define DF_MSPACE 2
-/* --------------- border characters ------------- */
-#define DF_FOCUS_NW '\xc9'
-#define DF_FOCUS_NE '\xbb'
-#define DF_FOCUS_SE '\xbc'
-#define DF_FOCUS_SW '\xc8'
-#define DF_FOCUS_SIDE '\xba'
-#define DF_FOCUS_LINE '\xcd'
-#define DF_NW '\xda'
-#define DF_NE '\xbf'
-#define DF_SE '\xd9'
-#define DF_SW '\xc0'
-#define DF_SIDE '\xb3'
-#define DF_LINE '\xc4'
-#define DF_LEDGE '\xc3'
-#define DF_REDGE '\xb4'
-/* ------------- scroll bar characters ------------ */
-#define DF_UPSCROLLBOX '\x1e'
-#define DF_DOWNSCROLLBOX '\x1f'
-#define DF_LEFTSCROLLBOX '\x11'
-#define DF_RIGHTSCROLLBOX '\x10'
-#define DF_SCROLLBARCHAR '\xb0'
-#define DF_SCROLLBOXCHAR '\xb2'
-/* ------------------ menu characters --------------------- */
-#define DF_CHECKMARK '\x04' //(DF_SCREENHEIGHT==25?251:4)
-#define DF_CASCADEPOINTER '\x10'
-/* ----------------- title bar characters ----------------- */
-#define DF_CONTROLBOXCHAR '\xf0'
-#define DF_MAXPOINTER '\x18' /* maximize token */
-#define DF_MINPOINTER '\x19' /* minimize token */
-#define DF_RESTOREPOINTER '\x12' /* restore token */
-/* --------------- text control characters ---------------- */
-#define DF_APPLCHAR '\xb0' /* fills application window */
-#define DF_SHORTCUTCHAR '~' /* prefix: shortcut key display */
-#define DF_CHANGECOLOR '\xae' /* prefix to change colors */
-#define DF_RESETCOLOR '\xaf' /* reset colors to default */
-#define DF_LISTSELECTOR 4 /* selected list box entry */
-
-/* --------- message prototypes ----------- */
-BOOL DfInitialize (void);
-void DfTerminate (void);
-void DfPostMessage (DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM);
-int DfSendMessage (DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM);
-BOOL DfDispatchMessage (void);
-void DfHandshake(void);
-SHORT DfGetScreenHeight (void);
-SHORT DfGetScreenWidth (void);
-
-/* ---- standard window message processing prototypes ----- */
-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 DfSetStandardColor(DFWINDOW);
-void DfSetReverseColor(DFWINDOW);
-BOOL DfIsAncestor(DFWINDOW, DFWINDOW);
-#define DfHitControlBox(wnd, p1, p2) \
- (DfTestAttribute(wnd, DF_CONTROLBOX) && \
- p1 == 2 && p2 == 0)
-#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 DfTextLine(wnd, sel) \
- (wnd->text + *((wnd->TextPointers) + sel))
-void DfWriteTextLine(DFWINDOW, DFRECT *, int, BOOL);
-#define DfTextBlockMarked(wnd) ( wnd->BlkBegLine || \
- wnd->BlkEndLine || \
- wnd->BlkBegCol || \
- wnd->BlkEndCol)
-void DfMarkTextBlock(DFWINDOW, int, int, int, int);
-#define DfClearTextBlock(wnd) wnd->BlkBegLine = wnd->BlkEndLine = \
- wnd->BlkBegCol = wnd->BlkEndCol = 0;
-#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 DfCopyCommand(char *, 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 DfItemSelected(DFWINDOW, int);
-/* ------------- edit box prototypes ----------- */
-#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 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) \
- DfGenericMessage(NULL, "Error", msg, 2, DfErrorBoxProc, \
- DfOk, DfCancel, DF_ID_OK, DF_ID_CANCEL, TRUE)
-#define DfErrorMessage(msg) \
- DfGenericMessage(NULL, "Error", msg, 1, DfErrorBoxProc, \
- DfOk, NULL, DF_ID_OK, 0, TRUE)
-#define DfMessageBox(ttl, msg) \
- DfGenericMessage(NULL, ttl, msg, 1, DfMessageBoxProc, \
- DfOk, NULL, DF_ID_OK, 0, TRUE)
-#define DfYesNoBox(msg) \
- DfGenericMessage(NULL, NULL, msg, 2, DfYesNoBoxProc, \
- DfYes, DfNo, DF_ID_OK, DF_ID_CANCEL, TRUE)
-#define DfCancelBox(wnd, msg) \
- DfGenericMessage(wnd, "Wait...", msg, 1, DfCancelBoxProc, \
- DfCancel, NULL, DF_ID_CANCEL, 0, FALSE)
-void DfCloseCancelBox(void);
-DFWINDOW DfMomentaryMessage(char *);
-int DfMsgHeight(char *);
-int DfMsgWidth(char *);
-
-/* ------------- dialog box prototypes -------------- */
-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 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 DfVectTypes {DF_VECTOR, DF_SOLIDBAR, DF_HEAVYBAR, DF_CROSSBAR, DF_LIGHTBAR};
-
-/* ------------- picture box prototypes ------------- */
-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 DfLoadHelpFile(void);
-void DfUnLoadHelpFile(void);
-BOOL DfDisplayHelp(DFWINDOW, char *);
-
-extern char *DfClassNames[];
-
-void DfBuildFileName(char *, char *);
-
-#endif
+++ /dev/null
-<module name="dflat32" type="win32cui" installbase="system32" installname="edit.exe">
- <include base="ReactOS">include/wine</include>
- <include base="dflat32">.</include>
- <library>kernel32</library>
- <library>gdi32</library>
- <file>applicat.c</file>
- <file>barchart.c</file>
- <file>box.c</file>
- <file>button.c</file>
- <file>calendar.c</file>
- <file>checkbox.c</file>
- <file>clipbord.c</file>
- <file>combobox.c</file>
- <file>config.c</file>
- <file>console.c</file>
- <file>decomp.c</file>
- <file>dfalloc.c</file>
- <file>dialbox.c</file>
- <file>dialogs.c</file>
- <file>direct.c</file>
- <file>edit.c</file>
- <file>editbox.c</file>
- <file>fileopen.c</file>
- <file>helpbox.c</file>
- <file>htree.c</file>
- <file>keys.c</file>
- <file>listbox.c</file>
- <file>lists.c</file>
- <file>log.c</file>
- <file>menu.c</file>
- <file>menubar.c</file>
- <file>menus.c</file>
- <file>message.c</file>
- <file>msgbox.c</file>
- <file>normal.c</file>
- <file>pictbox.c</file>
- <file>popdown.c</file>
- <file>radio.c</file>
- <file>rect.c</file>
- <file>search.c</file>
- <file>slidebox.c</file>
- <file>spinbutt.c</file>
- <file>statbar.c</file>
- <file>sysmenu.c</file>
- <file>text.c</file>
- <file>textbox.c</file>
- <file>video.c</file>
- <file>watch.c</file>
- <file>window.c</file>
-</module>
+++ /dev/null
-/* ----------- dflatmsg.h ------------ */
-
-/*
- * message foundation file
- * make message changes here
- * other source files will adapt
- */
-
-/* -------------- process communication messages ----------- */
-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(DFM_CREATE_WINDOW) /* create a window */
-DFlatMsg(DFM_SHOW_WINDOW) /* show a window */
-DFlatMsg(DFM_HIDE_WINDOW) /* hide a window */
-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(DFM_MAXIMIZE) /* maximize the window */
-#endif
-#ifdef INCLUDE_MINIMIZE
-DFlatMsg(DFM_MINIMIZE) /* minimize the window */
-#endif
-DFlatMsg(DFM_RESTORE) /* restore the window */
-DFlatMsg(DFM_INSIDE_WINDOW) /* test x/y inside a window */
-/* ---------------- clock messages ------------------------- */
-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(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(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(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(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(DFM_GETTEXT) /* get text from an edit box */
-DFlatMsg(DFM_SETTEXTLENGTH) /* set maximum text length */
-/* ---------------- menubar messages ----------------------- */
-DFlatMsg(DFM_BUILDMENU) /* build the menu display */
-DFlatMsg(DFM_MB_SELECTION) /* menubar selection */
-/* ---------------- popdown messages ----------------------- */
-DFlatMsg(DFM_BUILD_SELECTIONS) /* build the menu display */
-DFlatMsg(DFM_CLOSE_POPDOWN) /* tell parent popdown is closing */
-/* ---------------- list box messages ---------------------- */
-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(DFM_LB_SETSELECTION) /* sets the listbox selection */
-/* ---------------- dialog box messages -------------------- */
-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(DFM_DISPLAY_HELP)
-/* --------------- application window messages ------------- */
-DFlatMsg(DFM_ADDSTATUS)
-/* --------------- picture box messages -------------------- */
-DFlatMsg(DFM_DRAWVECTOR)
-DFlatMsg(DFM_DRAWBOX)
-DFlatMsg(DFM_DRAWBAR)
-
+++ /dev/null
-/* ----------------- dialbox.c -------------- */
-
-#include "dflat.h"
-
-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 DF_DBOX **dbs = NULL;
-static int dbct = 0;
-
-/* --- clear all heap allocations to control text fields --- */
-void DfClearDialogBoxes(void)
-{
- int i;
-
- for (i = 0; i < dbct; i++)
- {
- DF_CTLWINDOW *ct = (*(dbs+i))->ctl;
-
- while (ct->class)
- {
- if ((ct->class == DF_EDITBOX ||
- ct->class == DF_COMBOBOX) &&
- ct->itext != NULL)
- {
- free(ct->itext);
- }
- ct++;
- }
- }
-
- if (dbs != NULL)
- {
- free(dbs);
- dbs = NULL;
- }
- dbct = 0;
-}
-
-
-/* -------- DFM_CREATE_WINDOW Message --------- */
-static int CreateWindowMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2)
-{
- DF_DBOX *db = wnd->extension;
- DF_CTLWINDOW *ct = db->ctl;
- DFWINDOW cwnd;
- int rtn, i;
- /* ---- build a table of processed dialog boxes ---- */
- for (i = 0; i < dbct; i++)
- if (db == dbs[i])
- break;
- if (i == dbct) {
- dbs = DfRealloc(dbs, sizeof(DF_DBOX *) * (dbct+1));
- *(dbs + dbct++) = db;
- }
- rtn = DfBaseWndProc(DF_DIALOG, wnd, DFM_CREATE_WINDOW, p1, p2);
- ct = db->ctl;
- while (ct->class) {
- int attrib = 0;
- if (DfTestAttribute(wnd, DF_NOCLIP))
- attrib |= DF_NOCLIP;
- if (wnd->Modal)
- attrib |= DF_SAVESELF;
- ct->setting = ct->isetting;
- 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 |= DF_HASBORDER;
- cwnd = DfDfCreateWindow(ct->class,
- ct->dwnd.title,
- ct->dwnd.x+DfGetClientLeft(wnd),
- ct->dwnd.y+DfGetClientTop(wnd),
- ct->dwnd.h,
- ct->dwnd.w,
- ct,
- wnd,
- ControlProc,
- attrib);
- if ((ct->class == DF_EDITBOX ||
- ct->class == DF_COMBOBOX) &&
- ct->itext != NULL)
- DfSendMessage(cwnd, DFM_SETTEXT, (DF_PARAM) ct->itext, 0);
- ct++;
- }
- return rtn;
-}
-
-/* -------- DFM_LEFT_BUTTON Message --------- */
-static BOOL LeftButtonMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2)
-{
- DF_DBOX *db = wnd->extension;
- DF_CTLWINDOW *ct = db->ctl;
- if (DfWindowSizing || DfWindowMoving)
- return TRUE;
- 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 == DF_COMBOBOX) {
- if (p2 == DfGetTop(cwnd)) {
- if (p1 == DfGetRight(cwnd)+1) {
- DfSendMessage(cwnd, DFM_LEFT_BUTTON, p1, p2);
- return TRUE;
- }
- }
- if (DfGetClass(DfInFocus) == DF_LISTBOX)
- DfSendMessage(wnd, DFM_SETFOCUS, TRUE, 0);
- }
- 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;
- }
- }
- }
- ct++;
- }
- return FALSE;
-}
-
-/* -------- DFM_KEYBOARD Message --------- */
-static BOOL KeyboardMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2)
-{
- DF_DBOX *db = wnd->extension;
- DF_CTLWINDOW *ct;
-
- if (DfWindowMoving || DfWindowSizing)
- return FALSE;
- switch ((int)p1) {
- case DF_F1:
- ct = DfGetControl(DfInFocus);
- if (ct != NULL)
- if (DfDisplayHelp(wnd, ct->help))
- return TRUE;
- break;
- case DF_SHIFT_HT:
- case DF_BS:
- case DF_UP:
- PrevFocus(db);
- break;
- case DF_ALT_F6:
- case '\t':
- case DF_FWD:
- case DF_DN:
- NextFocus(db);
- break;
- case ' ':
- if (((int)p2 & DF_ALTKEY) &&
- DfTestAttribute(wnd, DF_CONTROLBOX)) {
- SysMenuOpen = TRUE;
- DfBuildSystemMenu(wnd);
- }
- break;
- case DF_CTRL_F4:
- case DF_ESC:
- DfSendMessage(wnd, DFM_COMMAND, DF_ID_CANCEL, 0);
- break;
- default:
- /* ------ search all the shortcut keys ----- */
- dbShortcutKeys(db, (int) p1);
- break;
- }
- return wnd->Modal;
-}
-
-/* -------- COMMAND Message --------- */
-static BOOL CommandMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2)
-{
- DF_DBOX *db = wnd->extension;
- switch ((int) p1) {
- case DF_ID_OK:
- case DF_ID_CANCEL:
- if ((int)p2 != 0)
- return TRUE;
- wnd->ReturnCode = (int) p1;
- if (wnd->Modal)
- DfPostMessage(wnd, DFM_ENDDIALOG, 0, 0);
- else
- DfSendMessage(wnd, DFM_CLOSE_WINDOW, TRUE, 0);
- return TRUE;
- case DF_ID_HELP:
- if ((int)p2 != 0)
- return TRUE;
- return DfDisplayHelp(wnd, db->HelpName);
- default:
- break;
- }
- return FALSE;
-}
-
-/* ----- window-processing module, DF_DIALOG window class ----- */
-int DfDialogProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2)
-{
- int rtn;
- DF_DBOX *db = wnd->extension;
-
- switch (msg) {
- case DFM_CREATE_WINDOW:
- return CreateWindowMsg(wnd, p1, p2);
- case DFM_SHIFT_CHANGED:
- if (wnd->Modal)
- return TRUE;
- break;
- case DFM_LEFT_BUTTON:
- if (LeftButtonMsg(wnd, p1, p2))
- return TRUE;
- break;
- case DFM_KEYBOARD:
- if (KeyboardMsg(wnd, p1, p2))
- return TRUE;
- break;
- case DFM_CLOSE_POPDOWN:
- SysMenuOpen = FALSE;
- break;
- case DFM_LB_SELECTION:
- case DFM_LB_CHOOSE:
- if (SysMenuOpen)
- return TRUE;
- DfSendMessage(wnd, DFM_COMMAND, inFocusCommand(db), msg);
- break;
- case DFM_COMMAND:
- if (CommandMsg(wnd, p1, p2))
- return TRUE;
- break;
- case DFM_PAINT:
- p2 = TRUE;
- break;
- case DFM_MOVE:
- case DFM_DFM_SIZE:
- rtn = DfBaseWndProc(DF_DIALOG, wnd, msg, p1, p2);
- if (wnd->dfocus != NULL)
- DfSendMessage(wnd->dfocus, DFM_SETFOCUS, TRUE, 0);
- return rtn;
-
- case DFM_CLOSE_WINDOW:
- if (!p1)
- {
- DfSendMessage(wnd, DFM_COMMAND, DF_ID_CANCEL, 0);
- return TRUE;
- }
- break;
-
- default:
- break;
- }
- return DfBaseWndProc(DF_DIALOG, wnd, msg, p1, p2);
-}
-
-/* ------- create and execute a dialog box ---------- */
-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;
- DFWINDOW DialogWnd;
-
- if (!Modal && wnd != NULL)
- {
- x += DfGetLeft(wnd);
- y += DfGetTop(wnd);
- }
- DialogWnd = DfDfCreateWindow(DF_DIALOG,
- db->dwnd.title,
- x, y,
- db->dwnd.h,
- db->dwnd.w,
- db,
- wnd,
- wndproc,
- Modal ? DF_SAVESELF : 0);
- DialogWnd->Modal = Modal;
- FirstFocus(db);
- DfPostMessage(DialogWnd, DFM_INITIATE_DIALOG, 0, 0);
- if (Modal)
- {
- DfSendMessage(DialogWnd, DFM_CAPTURE_MOUSE, 0, 0);
- DfSendMessage(DialogWnd, DFM_CAPTURE_KEYBOARD, 0, 0);
- while (DfDispatchMessage ())
- ;
- 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(DF_DBOX *db)
-{
- DF_CTLWINDOW *ct = db->ctl;
- while (ct->class) {
- if (ct->wnd == DfInFocus)
- return ct->command;
- ct++;
- }
- return -1;
-}
-
-/* -------- find a specified control structure ------- */
-DF_CTLWINDOW *DfFindCommand(DF_DBOX *db, enum DfCommands cmd, int class)
-{
- DF_CTLWINDOW *ct = db->ctl;
- while (ct->class)
- {
- if (ct->class == class)
- if (cmd == ct->command)
- return ct;
- ct++;
- }
- return NULL;
-}
-
-/* ---- return the window handle of a specified command ---- */
-DFWINDOW DfControlWindow(DF_DBOX *db, enum DfCommands cmd)
-{
- DF_CTLWINDOW *ct = db->ctl;
- while (ct->class)
- {
- if (ct->class != DF_TEXT && cmd == ct->command)
- return ct->wnd;
- ct++;
- }
- return NULL;
-}
-
-/* --- return a pointer to the control structure that matches a window --- */
-DF_CTLWINDOW *WindowControl(DF_DBOX *db, DFWINDOW wnd)
-{
- DF_CTLWINDOW *ct = db->ctl;
- while (ct->class)
- {
- if (ct->wnd == wnd)
- return ct;
- ct++;
- }
- return NULL;
-}
-
-/* ---- set a control DF_ON or DF_OFF ----- */
-void DfControlSetting(DF_DBOX *db, enum DfCommands cmd,
- int class, int setting)
-{
- DF_CTLWINDOW *ct = DfFindCommand(db, cmd, class);
- if (ct != NULL) {
- ct->isetting = setting;
- if (ct->wnd != NULL)
- ct->setting = setting;
- }
-}
-
-/* ---- return pointer to the text of a control window ---- */
-char *DfGetDlgTextString(DF_DBOX *db,enum DfCommands cmd,DFCLASS class)
-{
- DF_CTLWINDOW *ct = DfFindCommand(db, cmd, class);
- if (ct != NULL)
- return ct->itext;
- else
- return NULL;
-}
-
-/* ------- set the text of a control specification ------ */
-void DfSetDlgTextString(DF_DBOX *db, enum DfCommands cmd,
- char *text, DFCLASS class)
-{
- DF_CTLWINDOW *ct = DfFindCommand(db, cmd, class);
- if (ct != NULL) {
- ct->itext = DfRealloc(ct->itext, strlen(text)+1);
- strcpy(ct->itext, text);
- }
-}
-
-/* ------- set the text of a control window ------ */
-void DfPutItemText(DFWINDOW wnd, enum DfCommands cmd, char *text)
-{
- DF_CTLWINDOW *ct = DfFindCommand(wnd->extension, cmd, DF_EDITBOX);
-
- if (ct == NULL)
- ct = DfFindCommand(wnd->extension, cmd, DF_TEXTBOX);
- if (ct == NULL)
- ct = DfFindCommand(wnd->extension, cmd, DF_COMBOBOX);
- if (ct == NULL)
- ct = DfFindCommand(wnd->extension, cmd, DF_LISTBOX);
- if (ct == NULL)
- ct = DfFindCommand(wnd->extension, cmd, DF_SPINBUTTON);
- if (ct == NULL)
- ct = DfFindCommand(wnd->extension, cmd, DF_TEXT);
- if (ct != NULL) {
- DFWINDOW cwnd = (DFWINDOW) (ct->wnd);
- switch (ct->class) {
- 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 DF_LISTBOX:
- case DF_TEXTBOX:
- case DF_SPINBUTTON:
- DfSendMessage(cwnd, DFM_ADDTEXT, (DF_PARAM) text, 0);
- break;
- 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:
- break;
- }
- }
-}
-
-/* ------- get the text of a control window ------ */
-void DfGetItemText(DFWINDOW wnd, enum DfCommands cmd,
- char *text, int len)
-{
- DF_CTLWINDOW *ct = DfFindCommand(wnd->extension, cmd, DF_EDITBOX);
- char *cp;
-
- if (ct == NULL)
- ct = DfFindCommand(wnd->extension, cmd, DF_COMBOBOX);
- if (ct == NULL)
- ct = DfFindCommand(wnd->extension, cmd, DF_TEXTBOX);
- if (ct == NULL)
- ct = DfFindCommand(wnd->extension, cmd, DF_TEXT);
- if (ct != NULL) {
- DFWINDOW cwnd = (DFWINDOW) (ct->wnd);
- if (cwnd != NULL) {
- switch (ct->class) {
- case DF_TEXT:
- if (DfGetText(cwnd) != NULL) {
- cp = strchr(DfGetText(cwnd), '\n');
- if (cp != NULL)
- len = (int) (cp - DfGetText(cwnd));
- strncpy(text, DfGetText(cwnd), len);
- *(text+len) = '\0';
- }
- break;
- case DF_TEXTBOX:
- if (DfGetText(cwnd) != NULL)
- strncpy(text, DfGetText(cwnd), len);
- break;
- case DF_COMBOBOX:
- case DF_EDITBOX:
- DfSendMessage(cwnd,DFM_GETTEXT,(DF_PARAM)text,len);
- break;
- default:
- break;
- }
- }
- }
-}
-
-/* ------- set the text of a listbox control window ------ */
-void DfGetDlgListText(DFWINDOW wnd, char *text, enum DfCommands cmd)
-{
- 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 DF_CTLWINDOW *AssociatedControl(DF_DBOX *db,enum DfCommands Tcmd)
-{
- DF_CTLWINDOW *ct = db->ctl;
- while (ct->class) {
- if (ct->class != DF_TEXT)
- if (ct->command == Tcmd)
- break;
- ct++;
- }
- return ct;
-}
-
-/* --- process dialog box shortcut keys --- */
-static void dbShortcutKeys(DF_DBOX *db, int 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 == DF_SHORTCUTCHAR &&
- tolower(*(cp+1)) == ch) {
- if (ct->class == DF_TEXT)
- ct = AssociatedControl(db, ct->command);
- 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, DFM_SETFOCUS, TRUE, 0);
- if (ct->class == DF_BUTTON)
- DfSendMessage(ct->wnd,DFM_KEYBOARD,'\r',0);
- }
- return;
- }
- cp++;
- }
- ct++;
- }
- }
-}
-
-/* --- dynamically add or remove scroll bars
- from a control window ---- */
-void DfSetScrollBars(DFWINDOW wnd)
-{
- int oldattr = DfGetAttribute(wnd);
- if (wnd->wlines > DfClientHeight(wnd))
- DfAddAttribute(wnd, DF_VSCROLLBAR);
- else
- DfClearAttribute(wnd, DF_VSCROLLBAR);
- if (wnd->textwidth > DfClientWidth(wnd))
- DfAddAttribute(wnd, DF_HSCROLLBAR);
- else
- DfClearAttribute(wnd, DF_HSCROLLBAR);
- if (DfGetAttribute(wnd) != oldattr)
- DfSendMessage(wnd, DFM_BORDER, 0, 0);
-}
-
-/* ------- DFM_CREATE_WINDOW Message (Control) ----- */
-static void CtlCreateWindowMsg(DFWINDOW wnd)
-{
- DF_CTLWINDOW *ct;
- ct = wnd->ct = wnd->extension;
- wnd->extension = NULL;
- if (ct != NULL)
- ct->wnd = wnd;
-}
-
-/* ------- DFM_KEYBOARD Message (Control) ----- */
-static BOOL CtlKeyboardMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2)
-{
- DF_CTLWINDOW *ct = DfGetControl(wnd);
- switch ((int) p1) {
- case DF_F1:
- if (DfWindowMoving || DfWindowSizing)
- break;
- if (!DfDisplayHelp(wnd, ct->help))
- DfSendMessage(DfGetParent(wnd),DFM_COMMAND,DF_ID_HELP,0);
- return TRUE;
- case ' ':
- if (!((int)p2 & DF_ALTKEY))
- break;
- case DF_ALT_F6:
- case DF_CTRL_F4:
- case DF_ALT_F4:
- DfPostMessage(DfGetParent(wnd), DFM_KEYBOARD, p1, p2);
- return TRUE;
- default:
- break;
- }
- if (DfGetClass(wnd) == DF_EDITBOX)
- if (DfIsMultiLine(wnd))
- return FALSE;
- switch ((int) p1) {
- case DF_UP:
- if (!DfIsDerivedFrom(wnd, DF_LISTBOX)) {
- p1 = DF_CTRL_FIVE;
- p2 = DF_LEFTSHIFT;
- }
- break;
- case DF_BS:
- if (!DfIsDerivedFrom(wnd, DF_EDITBOX)) {
- p1 = DF_CTRL_FIVE;
- p2 = DF_LEFTSHIFT;
- }
- break;
- case DF_DN:
- if (!DfIsDerivedFrom(wnd, DF_LISTBOX) &&
- !DfIsDerivedFrom(wnd, DF_COMBOBOX))
- p1 = '\t';
- break;
- case DF_FWD:
- if (!DfIsDerivedFrom(wnd, DF_EDITBOX))
- p1 = '\t';
- break;
- case '\r':
- if (DfIsDerivedFrom(wnd, DF_EDITBOX))
- if (DfIsMultiLine(wnd))
- break;
- if (DfIsDerivedFrom(wnd, DF_BUTTON))
- break;
- DfSendMessage(DfGetParent(wnd), DFM_COMMAND, DF_ID_OK, 0);
- return TRUE;
- default:
- break;
- }
- return FALSE;
-}
-
-/* ------- DFM_CLOSE_WINDOW Message (Control) ----- */
-static void CtlCloseWindowMsg(DFWINDOW wnd)
-{
- DF_CTLWINDOW *ct = DfGetControl(wnd);
- if (ct != NULL) {
- ct->wnd = NULL;
- 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);
- strcpy(ct->itext, wnd->text);
- if (!DfIsMultiLine(wnd)) {
- char *cp = ct->itext+strlen(ct->itext)-1;
- if (*cp == '\n')
- *cp = '\0';
- }
- }
- }
- else if (ct->class == DF_RADIOBUTTON || ct->class == DF_CHECKBOX)
- ct->isetting = ct->setting;
- }
- }
-}
-
-
-static void FixColors(DFWINDOW wnd)
-{
- DF_CTLWINDOW *ct = wnd->ct;
-
- if (ct->class != DF_BUTTON)
- {
- if (ct->class != DF_SPINBUTTON && ct->class != DF_COMBOBOX)
- {
- 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[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];
- }
- }
- }
-}
-
-
-/* -- generic window processor used by dialog box controls -- */
-static int ControlProc(DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2)
-{
- DF_DBOX *db;
-
- if (wnd == NULL)
- return FALSE;
- db = DfGetParent(wnd) ? DfGetParent(wnd)->extension : NULL;
-
- switch (msg) {
- case DFM_CREATE_WINDOW:
- CtlCreateWindowMsg(wnd);
- break;
- case DFM_KEYBOARD:
- if (CtlKeyboardMsg(wnd, p1, p2))
- return TRUE;
- break;
- case DFM_PAINT:
- FixColors(wnd);
- if (DfGetClass(wnd) == DF_EDITBOX ||
- DfGetClass(wnd) == DF_LISTBOX ||
- DfGetClass(wnd) == DF_TEXTBOX)
- DfSetScrollBars(wnd);
- break;
- case DFM_BORDER:
- FixColors(wnd);
- if (DfGetClass(wnd) == DF_EDITBOX) {
- DFWINDOW oldFocus = DfInFocus;
- DfInFocus = NULL;
- DfDefaultWndProc(wnd, msg, p1, p2);
- DfInFocus = oldFocus;
- return TRUE;
- }
- break;
- case DFM_SETFOCUS: {
- DFWINDOW pwnd = DfGetParent(wnd);
- if (p1)
- {
- DfDefaultWndProc(wnd, msg, p1, p2);
- if (pwnd != NULL)
- {
- pwnd->dfocus = wnd;
- DfSendMessage(pwnd, DFM_COMMAND,
- inFocusCommand(db), DFM_ENTERFOCUS);
- }
- return TRUE;
- }
- else
- DfSendMessage(pwnd, DFM_COMMAND,
- inFocusCommand(db), DFM_LEAVEFOCUS);
- break;
- }
- case DFM_CLOSE_WINDOW:
- CtlCloseWindowMsg(wnd);
- break;
- default:
- break;
- }
- return DfDefaultWndProc(wnd, msg, p1, p2);
-}
-
-/* ---- change the focus to the first control --- */
-static void FirstFocus(DF_DBOX *db)
-{
- DF_CTLWINDOW *ct = db->ctl;
- if (ct != NULL)
- {
- while (ct->class == DF_TEXT || ct->class == DF_BOX) {
- ct++;
- if (ct->class == 0)
- return;
- }
- DfSendMessage(ct->wnd, DFM_SETFOCUS, TRUE, 0);
- }
-}
-
-/* ---- change the focus to the next control --- */
-static void NextFocus(DF_DBOX *db)
-{
- DF_CTLWINDOW *ct = WindowControl(db, DfInFocus);
- int looped = 0;
- if (ct != NULL)
- {
- do
- {
- ct++;
- if (ct->class == 0)
- {
- if (looped)
- return;
- looped++;
- ct = db->ctl;
- }
- } 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(DF_DBOX *db)
-{
- DF_CTLWINDOW *ct = WindowControl(db, DfInFocus);
- int looped = 0;
- if (ct != NULL)
- {
- do
- {
- if (ct == db->ctl)
- {
- if (looped)
- return;
- looped++;
- while (ct->class)
- ct++;
- }
- --ct;
- } while (ct->class == DF_TEXT || ct->class == DF_BOX);
- DfSendMessage(ct->wnd, DFM_SETFOCUS, TRUE, 0);
- }
-}
-
-void DfSetFocusCursor(DFWINDOW wnd)
-{
- if (wnd == DfInFocus)
- {
- DfSendMessage(NULL, DFM_SHOW_CURSOR, 0, 0);
- DfSendMessage(wnd, DFM_KEYBOARD_CURSOR, 1, 0);
- }
-}
-
-/* EOF */
+++ /dev/null
-/* ----------------- dialbox.h ---------------- */
-
-#ifndef DIALOG_H
-#define DIALOG_H
-
-#include <stdio.h>
-
-#define DF_MAXCONTROLS 30
-#define DF_MAXRADIOS 20
-
-#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 */
-} DF_DIALOGWINDOW;
-
-/* ------ one of these for each control window ------- */
-typedef struct {
- 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 DF_ON or DF_OFF */
- BOOL setting; /* DF_ON or DF_OFF */
- void *wnd; /* window handle */
-} DF_CTLWINDOW;
-
-/* --------- one of these for each dialog box ------- */
-typedef struct {
- char *HelpName;
- DF_DIALOGWINDOW dwnd;
- DF_CTLWINDOW ctl[DF_MAXCONTROLS+1];
-} DF_DBOX;
-
-/* -------- macros for dialog box resource compile -------- */
-#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==DF_EDITBOX||ty==DF_COMBOBOX?NULL:tx), \
- c,#c,(ty==DF_BUTTON?DF_ON:DF_OFF),DF_OFF,NULL},
-
-#define DF_ENDDB {{NULL}} }};
-
-#define DfCancel " Cancel "
-#define DfOk " OK "
-#define DfYes " Yes "
-#define DfNo " No "
-
-#endif
+++ /dev/null
-/* ----------- dialogs.c --------------- */
-
-#include "dflat.h"
-
-/* -------------- the File Open dialog box --------------- */
-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 --------------- */
-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 ------------------ */
-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 --------------- */
-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 --------------- */
-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 --------------- */
-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
-
-/* ----------- 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
-
-/* ----------- 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 -------------- */
-DF_DIALOGBOX( Display )
- DF_DB_TITLE( "Display", -1, -1, 12, 35)
-
- 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)
-
- 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 -------------- */
-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 -------------- */
-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 -------------- */
-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 */
+++ /dev/null
-/* ---------- direct.c --------- */
-
-#include <direct.h>
-#include <io.h>
-
-#include "dflat.h"
-
-#define DRIVE 1
-#define DIRECTORY 2
-#define FILENAME 4
-#define EXTENSION 8
-
-static char path[MAX_PATH];
-static char drive[_MAX_DRIVE] = " :";
-static char dir[_MAX_DIR];
-static char name[_MAX_FNAME];
-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 DfCreatePath(char *path,char *fspec,int InclName,int Change)
-{
- int cm = 0;
- char currdir[MAX_PATH];
- char *cp;
-
- /* save the current directory */
- if (!Change)
- GetCurrentDirectory (MAX_PATH, currdir);
-
- *drive = *dir = *name = *ext = '\0';
- _splitpath(fspec, drive, dir, name, ext);
- if (!InclName)
- *name = *ext = '\0';
- *drive = toupper(*drive);
- if (*ext)
- cm |= EXTENSION;
- if (InclName && *name)
- cm |= FILENAME;
- if (*dir)
- cm |= DIRECTORY;
- if (*drive)
- cm |= DRIVE;
- if (cm & DRIVE)
- _chdrive(*drive - '@');
- else
- {
- *drive = _getdrive();
- *drive += '@';
- }
- if (cm & DIRECTORY)
- {
- cp = dir+strlen(dir)-1;
- if (*cp == '\\')
- *cp = '\0';
- chdir(dir);
- }
- getcwd(dir, sizeof dir);
- memmove(dir, dir+2, strlen(dir+1));
- if (InclName) {
- if (!(cm & FILENAME))
- strcpy(name, "*");
- if (!(cm & EXTENSION) && strchr(fspec, '.') != NULL)
- strcpy(ext, ".*");
- }
- else
- *name = *ext = '\0';
- if (dir[strlen(dir)-1] != '\\')
- strcat(dir, "\\");
- memset(path, 0, sizeof path);
- _makepath(path, drive, dir, name, ext);
-
- if (!Change)
- SetCurrentDirectory (currdir);
-}
-
-
-static int dircmp(const void *c1, const void *c2)
-{
- return _stricmp(*(char **)c1, *(char **)c2);
-}
-
-
-BOOL DfDlgDirList(DFWINDOW wnd, char *fspec,
- enum DfCommands nameid, enum DfCommands pathid,
- unsigned attrib)
-{
- int ax, i = 0;
- struct _finddata_t ff;
- DF_CTLWINDOW *ct = DfFindCommand(wnd->extension,nameid,DF_LISTBOX);
- DFWINDOW lwnd;
- char **dirlist = NULL;
-
- DfCreatePath(path, fspec, TRUE, TRUE);
- if (ct != NULL)
- {
- lwnd = ct->wnd;
- DfSendMessage(ct->wnd, DFM_CLEARTEXT, 0, 0);
-
- if (attrib & 0x8000)
- {
- DWORD cd, dr;
-
- cd = GetLogicalDrives ();
- for (dr = 0; dr < 26; dr++)
- {
- if (cd & (1 << dr))
- {
- char drname[15];
-
- sprintf(drname, "[%c:\\]", (char)(dr+'A'));
-#if 0
- /* ---- test for network or RAM disk ---- */
- regs.x.ax = 0x4409; /* IOCTL func 9 */
- regs.h.bl = dr+1;
- int86(DOS, ®s, ®s);
- if (!regs.x.cflag) {
- if (regs.x.dx & 0x1000)
- strcat(drname, " (Network)");
- else if (regs.x.dx == 0x0800)
- strcat(drname, " (RAMdisk)");
- }
-#endif
- DfSendMessage(lwnd,DFM_ADDTEXT,(DF_PARAM)drname,0);
- }
- }
- DfSendMessage(lwnd, DFM_PAINT, 0, 0);
- }
- ax = _findfirst(path, &ff);
- if (ax == -1)
- return FALSE;
- do
- {
- if (!((attrib & 0x4000) &&
- (ff.attrib & (attrib & 0x3f)) == 0) &&
- strcmp(ff.name, "."))
- {
- char fname[MAX_PATH+2];
- sprintf(fname, (ff.attrib & FILE_ATTRIBUTE_DIRECTORY) ?
- "[%s]" : "%s" , ff.name);
- dirlist = DfRealloc(dirlist,
- sizeof(char *)*(i+1));
- dirlist[i] = DfMalloc(strlen(fname)+1);
- if (dirlist[i] != NULL)
- strcpy(dirlist[i], fname);
- i++;
- }
- }
- while (_findnext(ax, &ff) == 0);
- _findclose(ax);
- if (dirlist != NULL)
- {
- int j;
- /* -- sort file/drive/directory list box data -- */
- qsort(dirlist, i, sizeof(void *), dircmp);
-
- /* ---- send sorted list to list box ---- */
- for (j = 0; j < i; j++) {
- DfSendMessage(lwnd,DFM_ADDTEXT,(DF_PARAM)dirlist[j],0);
- free(dirlist[j]);
- }
- free(dirlist);
- }
- DfSendMessage(lwnd, DFM_SHOW_WINDOW, 0, 0);
- }
- if (pathid)
- {
- _makepath(path, drive, dir, NULL, NULL);
- DfPutItemText(wnd, pathid, path);
- }
- return TRUE;
-}
-
-/* EOF */
+++ /dev/null
-/* --------------- edit.c ----------- */
-
-#include "dflat.h"
-
-extern DF_DBOX PrintSetup;
-
-char DFlatApplication[] = "Edit";
-
-static char Untitled[] = "Untitled";
-
-static int wndpos;
-
-static int MemoPadProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM);
-static void NewFile(DFWINDOW,char *);
-static void SelectFile(DFWINDOW);
-static void PadWindow(DFWINDOW, char *);
-static void OpenPadWindow(DFWINDOW, char *,char *);
-static void LoadFile(DFWINDOW);
-static void PrintPad(DFWINDOW);
-static void SaveFile(DFWINDOW, int);
-static void EditDeleteFile(DFWINDOW);
-static int EditorProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM);
-static char *NameComponent(char *);
-static int PrintSetupProc(DFWINDOW, DFMESSAGE, DF_PARAM, DF_PARAM);
-static void FixTabMenu(void);
-#ifndef TURBOC
-void Calendar(DFWINDOW);
-#endif
-//void BarChart(DFWINDOW);
-char **Argv;
-
-#define CHARSLINE 80
-#define LINESPAGE 66
-
-int main (int argc, char *argv[])
-{
- DFWINDOW wnd;
- FILE *fp;
-
- if (DfInitialize () == FALSE)
- return 1;
-
- Argv = argv;
- DfLoadConfig ();
-// if (!DfLoadConfig())
-// DfCfg.ScreenLines = DF_SCREENHEIGHT;
- wnd = DfDfCreateWindow (DF_APPLICATION,
- "FreeDos Edit " DF_VERSION,
- 0, 0, -1, -1,
- &DfMainMenu,
- NULL,
- MemoPadProc,
-// DF_MOVEABLE |
-// DF_SIZEABLE |
-// DF_HASBORDER |
-// DF_MINMAXBOX |
- DF_HASSTATUSBAR);
-
- 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)
- {
- // check if the file exists....
- if (( fp = fopen(argv[1],"r")) == NULL )
- {
- // file does not exist - create new window
- NewFile(wnd,argv[1]);
- }
- else
- PadWindow(wnd, argv[1]);
- --argc;
- argv++;
- }
-
- while (DfDispatchMessage ())
- ;
-
- DfTerminate ();
-
- return 0;
-}
-
-/* ------ open text files and put them into editboxes ----- */
-static void PadWindow(DFWINDOW wnd, char *FileName)
-{
- int ax;
- struct _finddata_t ff;
- char path[MAX_PATH];
- char *cp;
-
- DfCreatePath(path, FileName, FALSE, FALSE);
- cp = path+strlen(path);
- DfCreatePath(path, FileName, TRUE, FALSE);
- ax = _findfirst(path, &ff);
- if (ax == -1)
- return;
- do
- {
- strcpy(cp, ff.name);
- OpenPadWindow(wnd, path,NULL);
- }
- while (_findnext(ax, &ff) == 0);
- _findclose (ax);
-}
-
-/* ------- window processing module for the
- Edit application window ----- */
-static int MemoPadProc(DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2)
-{
- int rtn;
- switch (msg)
- {
- 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 DF_ID_NEW:
- NewFile(wnd,NULL);
- return TRUE;
-
- case DF_ID_OPEN:
- SelectFile(wnd);
- return TRUE;
-
- case DF_ID_SAVE:
- SaveFile(DfInFocus, FALSE);
- return TRUE;
-
- case DF_ID_SAVEAS:
- SaveFile(DfInFocus, TRUE);
- return TRUE;
-
- case DF_ID_DELETEFILE:
- EditDeleteFile(DfInFocus);
- return TRUE;
-
- case DF_ID_PRINTSETUP:
- DfDialogBox(wnd, &PrintSetup, TRUE, PrintSetupProc);
- return TRUE;
-
- case DF_ID_PRINT:
- PrintPad(DfInFocus);
- return TRUE;
-
- case DF_ID_EXIT:
- if (!DfYesNoBox("Exit FreeDos Edit?"))
- return FALSE;
- break;
-
- case DF_ID_WRAP:
- DfCfg.WordWrap = DfGetCommandToggle(&DfMainMenu, DF_ID_WRAP);
- return TRUE;
-
- case DF_ID_INSERT:
- DfCfg.InsertMode = DfGetCommandToggle(&DfMainMenu, DF_ID_INSERT);
- return TRUE;
-
- case DF_ID_TAB2:
- DfCfg.Tabs = 2;
- FixTabMenu();
- return TRUE;
-
- case DF_ID_TAB4:
- DfCfg.Tabs = 4;
- FixTabMenu();
- return TRUE;
-
- case DF_ID_TAB6:
- DfCfg.Tabs = 6;
- FixTabMenu();
- return TRUE;
-
- case DF_ID_TAB8:
- DfCfg.Tabs = 8;
- FixTabMenu();
- return TRUE;
-
- case DF_ID_CALENDAR:
- Calendar(wnd);
- return TRUE;
-
-// case DF_ID_BARCHART:
-// BarChart(wnd);
-// return TRUE;
-
- case DF_ID_ABOUT:
- DfMessageBox(
- "About D-Flat and FreeDos Edit",
- " ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\n"
- " ³ ÜÜÜ ÜÜÜ Ü ³\n"
- " ³ Û Û Û Û Û ³\n"
- " ³ Û Û Û Û Û ³\n"
- " ³ Û Û Û Û Û Û ³\n"
- " ³ ßßß ßßß ßß ³\n"
- " RÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄU\n"
- "D-Flat implements the SAA/CUA\n"
- "interface in a public domain\n"
- "C language library originally\n"
- "published in Dr. Dobb's Journal\n"
- " ------------------------ \n"
- "FreeDos Edit is a clone of MSDOS\n"
- "editor for the FREEDOS Project");
- return TRUE;
-
- default:
- break;
- }
- break;
-
- default:
- break;
- }
-
- return DfDefaultWndProc(wnd, msg, p1, p2);
-}
-
-/* --- The New command. Open an empty editor window --- */
-static void NewFile(DFWINDOW wnd, char *FileName)
-{
- OpenPadWindow(wnd, Untitled,FileName);
-}
-
-/* --- The Open... command. Select a file --- */
-static void SelectFile(DFWINDOW wnd)
-{
- char FileName[MAX_PATH];
-
- if (DfOpenFileDialogBox("*.*", FileName))
- {
- /* see if the document is already in a window */
- DFWINDOW wnd1 = DfFirstWindow(wnd);
- while (wnd1 != NULL)
- {
- if (wnd1->extension &&
- _stricmp(FileName, wnd1->extension) == 0)
- {
- DfSendMessage(wnd1, DFM_SETFOCUS, TRUE, 0);
- DfSendMessage(wnd1, DFM_RESTORE, 0, 0);
- return;
- }
- wnd1 = DfNextWindow(wnd1);
- }
- OpenPadWindow(wnd, FileName, NULL);
- }
-}
-
-/* --- open a document window and load a file --- */
-static void OpenPadWindow(DFWINDOW wnd, char *FileName,char *NewFileName)
-{
- static DFWINDOW wnd1 = NULL;
- DFWINDOW wwnd;
- struct stat sb;
- char *Fname = FileName;
- char *ermsg;
-
- if (strcmp(FileName, Untitled))
- {
- if (stat(FileName, &sb))
- {
- ermsg = DfMalloc(strlen(FileName)+20);
- strcpy(ermsg, "No such file as\n");
- strcat(ermsg, FileName);
- DfErrorMessage(ermsg);
- free(ermsg);
- return;
- }
-
- Fname = NameComponent(FileName);
-
- // check file size
- if (sb.st_size > 64000)
- {
- ermsg = DfMalloc(strlen(FileName)+20);
- strcpy(ermsg, "File too large for this version of Edit\n");
- DfErrorMessage(ermsg);
- free(ermsg);
- return;
- }
- }
-
- wwnd = DfWatchIcon();
- wndpos += 2;
-
- if (NewFileName != NULL)
- Fname = NameComponent(NewFileName);
-
- if (wndpos == 20)
- wndpos = 2;
-
- wnd1 = DfDfCreateWindow(DF_EDITBOX,
- Fname,
- (wndpos-1)*2, wndpos, 10, 40,
- NULL, wnd, EditorProc,
- 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);
- strcpy(wnd1->extension, FileName);
- LoadFile(wnd1);
- }
- 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 --- */
-static void LoadFile(DFWINDOW wnd)
-{
- char *Buf = NULL;
- int recptr = 0;
- FILE *fp;
-
- if ((fp = fopen(wnd->extension, "rt")) != NULL)
- {
- while (!feof(fp))
- {
- 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, DFM_SETTEXT, (DF_PARAM) Buf, 0);
- free(Buf);
- }
- }
-}
-
-static int LineCtr;
-static int CharCtr;
-
-/* ------- print a character -------- */
-static void PrintChar(FILE *prn, int c)
-{
- int i;
-
- if (c == '\n' || CharCtr == DfCfg.RightMargin)
- {
- fputs("\r\n", prn);
- LineCtr++;
- if (LineCtr == DfCfg.BottomMargin)
- {
- fputc('\f', prn);
- for (i = 0; i < DfCfg.TopMargin; i++)
- fputc('\n', prn);
- LineCtr = DfCfg.TopMargin;
- }
- CharCtr = 0;
- if (c == '\n')
- return;
- }
- if (CharCtr == 0)
- {
- for (i = 0; i < DfCfg.LeftMargin; i++)
- {
- fputc(' ', prn);
- CharCtr++;
- }
- }
- CharCtr++;
- fputc(c, prn);
-}
-
-/* --- print the current notepad --- */
-static void PrintPad(DFWINDOW wnd)
-{
- if (*DfCfg.PrinterPort)
- {
- FILE *prn;
- if ((prn = fopen(DfCfg.PrinterPort, "wt")) != NULL)
- {
- long percent;
- BOOL KeepPrinting = TRUE;
- char *text = DfGetText(wnd);
- unsigned oldpct = 100, cct = 0, len = strlen(text);
- DFWINDOW swnd = DfSliderBox(20, DfGetTitle(wnd), "Printing");
- /* ------- print the notepad text --------- */
- LineCtr = CharCtr = 0;
- while (KeepPrinting && *text)
- {
- PrintChar(prn, *text++);
- percent = ((long) ++cct * 100) / len;
- if ((int)percent != (int)oldpct)
- {
- oldpct = (int) percent;
- KeepPrinting = DfSendMessage(swnd, DFM_PAINT, 0, oldpct);
- }
- }
- if (KeepPrinting)
- /* ---- user did not cancel ---- */
- if (oldpct < 100)
- DfSendMessage(swnd, DFM_PAINT, 0, 100);
- /* ------- follow with a form feed? --------- */
- if (DfYesNoBox("Form Feed?"))
- fputc('\f', prn);
- fclose(prn);
- }
- else
- DfErrorMessage("Cannot open printer file");
- }
- else
- DfErrorMessage("No printer selected");
-}
-
-/* ---------- save a file to disk ------------ */
-static void SaveFile(DFWINDOW wnd, int Saveas)
-{
- FILE *fp;
- if (wnd->extension == NULL || Saveas) {
- char FileName[MAX_PATH];
- if (DfSaveAsDialogBox(FileName)) {
- if (wnd->extension != NULL)
- free(wnd->extension);
- wnd->extension = DfMalloc(strlen(FileName)+1);
- strcpy(wnd->extension, FileName);
- DfAddTitle(wnd, NameComponent(FileName));
- DfSendMessage(wnd, DFM_BORDER, 0, 0);
- }
- else
- return;
- }
- if (wnd->extension != NULL)
- {
- DFWINDOW mwnd = DfMomentaryMessage("Saving the file");
- if ((fp = fopen(wnd->extension, "wt")) != NULL)
- {
- fwrite(DfGetText(wnd), strlen(DfGetText(wnd)), 1, fp);
- fclose(fp);
- wnd->TextChanged = FALSE;
- }
- DfSendMessage(mwnd, DFM_CLOSE_WINDOW, 0, 0);
- }
-}
-/* -------- delete a file ------------ */
-static void EditDeleteFile(DFWINDOW wnd)
-{
- if (wnd->extension != NULL) {
- if (strcmp(wnd->extension, Untitled)) {
- char *fn = NameComponent(wnd->extension);
- if (fn != NULL) {
- char msg[30];
- sprintf(msg, "Delete %s?", fn);
- if (DfYesNoBox(msg)) {
- _unlink(wnd->extension);
- DfSendMessage(wnd, DFM_CLOSE_WINDOW, 0, 0);
- }
- }
- }
- }
-}
-/* ------ display the row and column in the statusbar ------ */
-static void ShowPosition(DFWINDOW wnd)
-{
- char status[30];
- sprintf(status, "Line:%4d Column: %2d",
- wnd->CurrLine, wnd->CurrCol);
- DfSendMessage(DfGetParent(wnd), DFM_ADDSTATUS, (DF_PARAM) status, 0);
-}
-
-/* window processing module for the editboxes */
-static int EditorProc(DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2)
-{
- int rtn;
-
- switch (msg)
- {
- case DFM_SETFOCUS:
- if ((int)p1)
- {
- wnd->InsertMode = DfGetCommandToggle(&DfMainMenu, DF_ID_INSERT);
- wnd->WordWrapMode = DfGetCommandToggle(&DfMainMenu, DF_ID_WRAP);
- }
- rtn = DfDefaultWndProc(wnd, msg, p1, p2);
- if ((int)p1 == FALSE)
- DfSendMessage(DfGetParent(wnd), DFM_ADDSTATUS, 0, 0);
- else
- ShowPosition(wnd);
- return rtn;
-
- case DFM_KEYBOARD_CURSOR:
- rtn = DfDefaultWndProc(wnd, msg, p1, p2);
- ShowPosition(wnd);
- return rtn;
-
- case DFM_COMMAND:
- switch ((int) p1)
- {
- case DF_ID_SEARCH:
- DfSearchText(wnd);
- return TRUE;
- case DF_ID_REPLACE:
- DfReplaceText(wnd);
- return TRUE;
- case DF_ID_SEARCHNEXT:
- DfSearchNext(wnd);
- return TRUE;
- case DF_ID_CUT:
- DfCopyToClipboard(wnd);
- DfSendMessage(wnd, DFM_COMMAND, DF_ID_DELETETEXT, 0);
- DfSendMessage(wnd, DFM_PAINT, 0, 0);
- return TRUE;
- case DF_ID_COPY:
- DfCopyToClipboard(wnd);
- DfClearTextBlock(wnd);
- DfSendMessage(wnd, DFM_PAINT, 0, 0);
- return TRUE;
- case DF_ID_PASTE:
- DfPasteFromClipboard(wnd);
- DfSendMessage(wnd, DFM_PAINT, 0, 0);
- return TRUE;
- case DF_ID_DELETETEXT:
- case DF_ID_CLEAR:
- rtn = DfDefaultWndProc(wnd, msg, p1, p2);
- DfSendMessage(wnd, DFM_PAINT, 0, 0);
- return rtn;
- case DF_ID_HELP:
- DfDisplayHelp(wnd, "MEMOPADDOC");
- return TRUE;
- case DF_ID_WRAP:
- DfSendMessage(DfGetParent(wnd), DFM_COMMAND, DF_ID_WRAP, 0);
- wnd->WordWrapMode = DfCfg.WordWrap;
- return TRUE;
- 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 DFM_CLOSE_WINDOW:
- if (wnd->TextChanged)
- {
- 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(DfGetParent(wnd), DFM_COMMAND, DF_ID_SAVE, 0);
- free(cp);
- }
- wndpos = 0;
- if (wnd->extension != NULL)
- {
- free(wnd->extension);
- wnd->extension = NULL;
- }
- break;
-
- default:
- break;
- }
-
- return DfDefaultWndProc(wnd, msg, p1, p2);
-}
-
-/* -- point to the name component of a file specification -- */
-static char *NameComponent(char *FileName)
-{
- char *Fname;
- if ((Fname = strrchr(FileName, '\\')) == NULL)
- if ((Fname = strrchr(FileName, ':')) == NULL)
- Fname = FileName-1;
- return Fname + 1;
-}
-
-static char *ports[] = {
- "Lpt1", "Lpt2", "Lpt3",
- "Com1", "Com2", "Com3", "Com4",
- NULL
-};
-
-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 DFM_CREATE_WINDOW:
- rtn = DfDefaultWndProc(wnd, msg, p1, p2);
- DfPutItemText(wnd, DF_ID_PRINTERPORT, DfCfg.PrinterPort);
- while (ports[i] != NULL)
- DfPutComboListText(wnd, DF_ID_PRINTERPORT, ports[i++]);
- for (mar = CHARSLINE; mar >= 0; --mar)
- {
- sprintf(marg, "%3d", mar);
- DfPutItemText(wnd, DF_ID_LEFTMARGIN, marg);
- DfPutItemText(wnd, DF_ID_RIGHTMARGIN, marg);
- }
- for (mar = LINESPAGE; mar >= 0; --mar)
- {
- sprintf(marg, "%3d", mar);
- DfPutItemText(wnd, DF_ID_TOPMARGIN, marg);
- DfPutItemText(wnd, DF_ID_BOTTOMMARGIN, marg);
- }
- 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 == 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 DfDefaultWndProc(wnd, msg, p1, p2);
-}
-
-static void FixTabMenu(void)
-{
- char *cp = DfGetCommandText(&DfMainMenu, DF_ID_TABS);
- char *p;
-
- if (cp != NULL)
- {
- p = strchr(cp, '(');
- if (p != NULL)
- {
-// *(p+1) = (char)(DfCfg.Tabs + '0');
-// if (DfGetClass(DfInFocus) == DF_POPDOWNMENU)
-// DfSendMessage(DfInFocus, DFM_PAINT, 0, 0);
- }
- }
-}
-
-void DfPrepFileMenu(void *w, struct DfMenu *mnu)
-{
- DFWINDOW wnd = w;
- 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 DfPrepSearchMenu(void *w, struct DfMenu *mnu)
-{
- DFWINDOW wnd = w;
- 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 DfPrepEditMenu(void *w, struct DfMenu *mnu)
-{
- DFWINDOW wnd = w;
- 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);
- }
- DfActivateCommand(&DfMainMenu, DF_ID_PARAGRAPH);
- if (!DfTestAttribute(wnd, DF_READONLY) && DfClipboard != NULL)
- DfActivateCommand(&DfMainMenu, DF_ID_PASTE);
- if (wnd->DeletedText != NULL)
- DfActivateCommand(&DfMainMenu, DF_ID_UNDO);
- }
- }
-}
-
-/* EOF */
+++ /dev/null
-/* $Id$ */
-
-#define REACTOS_STR_FILE_DESCRIPTION "FreeDOS/ReactOS Text Editor\0"
-#define REACTOS_STR_INTERNAL_NAME "edit\0"
-#define REACTOS_STR_ORIGINAL_FILENAME "edit.exe\0"
-#define REACTOS_STR_ORIGINAL_COPYRIGHT "FreeDOS Project\0"
-#include <reactos/version.rc>
-
-/* EOF */
+++ /dev/null
-; ------------------------ MEMOPAD.TXT ---------------------
-;
-; This is the help text file for the MEMOPAD application. It
-; includes the help text that a D-Flat application would use
-; for the user interface.
-;
-; There can be a help window with a helptag name for each
-; command in commands.h, each menu label on the menu bar
-; as defined in menus.c, and each dialog box name in dialogs.c
-;
-; There can be other help windows as well. Some of them will
-; be displayed as the result of hypertext and definition key
-; words embedded in the help text of other help windows. Others
-; can be implemented from within an application software system.
-;
-; Following is the format for a help window:
-;
-; ÚÄÄ (1st column of each line)
-; \1f
-; ; anything with a semicolon in the 1st column is a comment
-; <helptag> (names the help window)
-; [<<]<helptag> (names the previous window in chain)
-; [>>]<helptag> (names the next window in chain)
-; Help Window Title (displays in window's title bar)
-; Help text follows until next helptag occurs
-; Hypertext reference [..keyword]<helptag> embedded in text
-; Definition reference [**keyword]<helptag> embedded in text
-; <helptag> (names another window)
-;
-; Notes:
-; 1. A hypertext reference, when selected, causes the
-; associated help window named by the <helptag> to
-; become the active help window.
-; 2. A definition reference, when selected, displays
-; a momentary window with the text of the associated
-; help window named by the <helptag>. The window
-; closes when the user releases the Enter key or
-; mouse button.
-; 3. A definition window has no title.
-; 4. The last window is followed by the <end> helptag.
-; 5. The window's height and width adjust to the text.
-; 6. The [..], [**], and <helptags> do not display and
-; do not figure in the width of the line in which
-; they occur.
-;
-; -----------------------------------------
-<Application>
-[<<]<MEMOPAD>
-[>>]<Menubar>
-Application Window
-The Application Window is the desktop for the
-application.
-
-The Application window contains the application's
-[..Document Windows]<docwindow>. Before you open any documents,
-the Application window is empty.
-
-The application window has an [..Action Bar]<Menubar> just below
-its [..Title Bar]<titlebar> and a [..Status Bar]<statusbar> at the bottom.
-
-Note that there might not be a title or status bar
-depending on the [..Display]<ID_DISPLAY> option on the [..Options]<Options>
-menu.
-; -----------------------------------------
-<MEMOPAD>
-[>>]<Application>
-The MEMOPAD Application
-MEMOPAD is a multi-window notepad program that
-demonstrates the programmer's [**API]<API> to the D-Flat
-Common User Access interface library.
-; -----------------------------------------
-<MEMOPADDOC>
-[<<]<Application>
-The MEMOPAD Document Window
-This [..Document Window]<docwindow> is a basic notepad text editor. You can
-have many of these windows open at one time.
-; -----------------------------------------
-<docwindow>
-Document Window
-A Document Window contains the data that you work
-on. It displays within the [..Application Window]<Application> and
-consists of these parts:
-
- [..Client Area]<client>
- [..Border]<border>
- [..Title Bar]<titlebar>
- [..Status Bar]<statusbar>
- [..Scroll Bars]<scrollbar>
- [..Control Box]<controlbox>
- [..Minimize Box]<minbox>
- [..Maximize Box]<maxbox>
- [..Restore Box]<restorebox>
- [..Resize Box]<sizebox>
-
-; -----------------------------------------
-<client>
-[<<]<docwindow>
-[>>]<border>
-Client Area
-The Client Area is the space inside the window's
-borders where the application's data values are
-displayed and manipulated.
-; -----------------------------------------
-<border>
-[<<]<client>
-[>>]<titlebar>
-Border
-The Border is the frame around a window. When the
-window has the focus, the border is a double line.
-When a different window has the focus, the border
-is a single line.
-
-The window's [..Scroll Bars]<scrollbar>, if any, are positioned
-in the right and bottom parts of the border.
-; -----------------------------------------
-<titlebar>
-[<<]<border>
-[>>]<statusbar>
-Title Bar
-The Title Bar is at the top of the window and
-contains the window's title. When the window
-has the focus, the title is highlighted. The
-Title Bar includes these items as well:
-
- [..Control Box]<controlbox>
- [..Minimize Box]<minbox>
- [..Maximize Box]<maxbox>
- [..Restore Box]<restorebox>
-
-You can move the window with the mouse by clicking
-the title bar and dragging the window to its new
-location.
-; -----------------------------------------
-<statusbar>
-[<<]<titlebar>
-[>>]<scrollbar>
-Status Bar
-The Status Bar is at the bottom of the application window.
-It displays the time and brief contextual messages about
-the menus and other application-dependent features.
-; -----------------------------------------
-<scrollbar>
-[<<]<statusbar>
-[>>]<controlbox>
-Scroll Bars
-You use Scroll Bars to scroll a window's data with the
-mouse. A window can have one or two Scroll Bars - one
-at the right and one at the bottom parts of the
-window's Border. The Scroll Bar at the right scrolls
-the document's data up and down. The Scroll Bar on
-the bottom scrolls the window's data right and left.
-
-To scroll a window a line at a time, click the arrow
-tokens at either end of the Scroll Bar. The Scroll Bar
-includes a slider box that indicates the relative
-position of the window's display with respect to the
-total document. You can page to an approximate position
-within the document by clicking inside the Scroll Bar.
-You can drag the slider box in either direction to
-scroll the document.
-; -----------------------------------------
-<controlbox>
-[<<]<scrollbar>
-[>>]<minbox>
-Control Box
-The Control Box is indicated by the character (ð) at
-the left end of the window's [..Title Bar]<titlebar>. You can
-click it to select the System Menu or double click
-it to close the window.
-; -----------------------------------------
-<minbox>
-[<<]<controlbox>
-[>>]<maxbox>
-Minimize Box
-The Minimize Box is the \19 token at the right
-end of the window's [..Title Bar]<titlebar>.
-
-When you click on the Minimize Box, the window
-is reduced to an icon at the bottom of the
-[..Application Window]<Application>
-; -----------------------------------------
-<maxbox>
-[<<]<minbox>
-[>>]<restorebox>
-Maximize Box
-The Maximize Box is the \18 token at the right
-end of the window's [..Title Bar]<titlebar>.
-
-When you click on the Maximize Box, the window
-grows to occupy the entire [..Client Area]<client> of the
-[..Application Window]<Application>
-; -----------------------------------------
-<restorebox>
-[<<]<maxbox>
-[>>]<sizebox>
-Restore Box
-The Restore Box is the \18 token character at the right
-end of a minimized window's [..Title Bar]<titlebar> and the \12 token
-character at the right end of a maximized window's
-Title Bar. You click the Restore Box to restore the
-window to the position and size it had before it was
-minimized or maximized.
-; -----------------------------------------
-<sizebox>
-[<<]<restorebox>
-Resize Box
-The Resize Box is the lower right corner of the
-window's border. To change the window's size,
-drag the Resize Box. The window's upper left
-coordinates remain the same, and the lower right
-coordinates change as you drag the mouse around.
-; -----------------------------------------
-<Menubar>
-[<<]<application>
-[>>]<Pulldowns>
-The Action Bar
-To select the action bar, do one of these:
- 1. Press F10
- 2. Press and release the Alt key
- 3. Press Alt+the letter that is highlighted
- in a menu's title on the action bar. The
- selected menu will pull down.
- 4. Click the action bar. If you click a
- pull-down menu selection's title, that
- menu will pull down.
-
-To exit from the action bar and return to the
-document or application window, do one of these:
- 1. Press Esc
- 2. Press and release the Alt key
-; -----------------------------------------
-;
-; Following are the Help system windows
-;
-; -----------------------------------------
-<HelpHelp>
-[<<]<Help>
-[>>]<ExtHelp>
-Help for Help
-Getting Into the Help System
-----------------------------
-There are three ways to get into the Help system:
-
- 1. Execute commands on the [..Help]<Help> menu
- 2. Press F1
- 3. Press the Help command button on a dialog box.
-
-Contextual Help (F1)
---------------------
-The F1 key provides contextual help--help for the
-part of the application that currently has the
-focus. You can press F1 with the action bar selected,
-a pull-down menu displayed, a field on a dialog box
-selected, or a document window in focus.
-
-The Help Command Button
------------------------
-The Help command button on a dialog box displays
-information about the dialog box and its purpose.
-The help window that displays when you press F1 with
-a dialog box field selected relates to the field
-itself.
-
-References to Other Help Windows
---------------------------------
-A Help window can include a reference to another
-help window. That reference is highlighted like
-this:
-
- [..Help]<Help>
-
-You can Tab to the highlighted reference and press
-the Enter key to select the referenced help window.
-You can select it with the mouse by double-clicking
-on it.
-
-Definitions
------------
-Some references, such as [**function key]<shortcut>, are
-definitions of terms. These definitions are
-highlighted the same as references. When you select
-the definition, a window displays in the upper left
-corner of the desktop. The window contains the
-definition of the selected term and stays in view
-until you release the Enter key or the mouse
-button.
-
-Command Buttons on the Help Windows
------------------------------------
-Each help window contains these [..command buttons]<cmdbuttons>:
-
- Close This button closes the help window and
- exits from the help system.
- Back This button changes to the help window
- that you viewed before the current one.
- Prev This button changes to the help window
- that logically preceeds the current one.
- Next This button changes to the help window
- that logically follows the current one.
-
-Exiting from the Help System
-----------------------------
-You exit from the Help system by closing the current
-help window in one of these three ways:
-
- 1. Press the Esc key
- 2. Use the Close command button on the Help
- window.
- 5. Double click the window's [..Control Box]<controlbox>.
- 4. Close the help window from its [..System Menu]<sysmenu>.
-
-; -----------------------------------------
-<ExtHelp>
-[<<]<HelpHelp>
-[>>]<KeysHelp>
-Extended Help
-The MEMOPAD program has few features and procedures
-that are not taken directly from the SAA/CUA
-interface that D-Flat implements. The [..Log Messages]<ID_LOG>
-and [..Display]<ID_DISPLAY> selections on the [..Options]<Options> menu are
-unique to MEMOPAD and would not necessarily be in
-an application. Some of the Display features would
-be useful to a user who is not developing D-Flat
-programs. Others, such as the [..Title]<ID_TITLE>, [..Border]<ID_BORDER>,
-[..Status Bar]<ID_STATUSBAR>, and [..Texture]<ID_TEXTURE> check boxes on the [..Display]<Display>
-dialog box, are to allow a programmer to see how
-the screen looks with these features enabled and
-disabled.
-; -----------------------------------------
-<KeysHelp>
-[<<]<ExtHelp>
-[>>]<HelpIndex>
-Keys Help
-From the Desktop
-----------------
- Alt+Hyphen Open the desktop's [..SystemMenu]<sysmenu>.
- F10 or Alt Activate the [..ActionBar]<menubar>.
- Esc Deactivate the Action Bar.
- Alt+letter Open the associated [..Pull-down menu]<Pulldowns>.
- Alt+F6 Change focus to another document.
- Alt+X Exit the application.
-
-From a [..Document Window]<docwindow>
-----------------------
- Alt+Spacebar Open the window's [..System Menu]<sysmenu>
- Alt+S Save the document to a disk file.
-
-[..Edit Box]<editbox> Keys
------------
- Arrow keys Move the cursor one character.
- Ctrl+arrow Move the cursor one word.
- Del Delete character to the right of
- the cursor. If a [..block]<Block> is marked,
- delete the block.
- Backspace Delete character to the left of
- the cursor. If a block is marked,
- delete the block.
- Alt+BackSpace Undo the last block deletion.
- PgUp/PgDn Scroll forward and back one page.
- Ctrl+PgUp/PgDn Scroll horizontally one page.
- Home/End Move the cursor to the beginning
- and end of the line.
- Ctrl+Home/End Move the cursor to the beginning
- and end of the document.
- Alt+P Form a paragraph from the cursor
- position to the next blank line.
- Ins Toggle Insert/Overstrike mode.
- Tab Tab to the next Tab Stop position.
-
-[..Clipboard]<clipboard> Keys
---------------
- Shift+Del [..Cut]<ID_CUT> the marked text to the
- Clipboard
- Ctrl+Ins [..Copy]<ID_COPY> the marked text to the
- Clipboard.
- Shift+Ins [..Paste]<ID_PASTE> the contents of the
- Clipboard into the document.
-
-[..Dialog Box]<dialog> Keys
----------------
- Tab Move to the next control.
- Shift+Tab Move to the previous control.
- Enter Execute the control.
- Esc Close the Dialog Box with no
- action.
-
-[..Listbox]<listbox> Keys
-------------
- Up/down arrows Move the selection cursor
- Ctrl+arrows Select a group of entries.
- Enter Choose the selected entry
- or entries.
- Shift+F8 Toggle Add mode.
- Spacebar In Add mode, select/deselect an
- entry.
-; -----------------------------------------
-<HelpIndex>
-[<<]<KeysHelp>
-Index of Help Titles
-Select (Tab then Enter or double-click) from these
-titles to view the help screens related to each one.
-
- [..Application Window]<Application>
- [..Action Bar]<Menubar>
- [..Pull-down Menus]<Pulldowns>
- [..The File Menu]<File>
- [..The Edit Menu]<Edit>
- [..The Search Menu]<Search>
- [..The Utilities Menu]<Utilities>
- [..The Options Menu]<Options>
- [..The Window Menu]<Window>
- [..The Help Menu]<Help>
- [..Dialog Boxes]<Dialog>
- [..The File Open Dialog Box]<FileOpen>
- [..The Save As Dialog Box]<SaveAs>
- [..The MsgBox Dialog Box]<MsgBox>
- [..The Display Dialog Box]<Display>
- [..The Windows Dialog Box]<Windows>
- [..The Log Dialog Box]<Log>
- [..The Help System]<Help>
- [..Help for help...]<ID_HELPHELP>
- [..Extended help...]<ID_EXTHELP>
- [..Keys help...]<ID_KEYSHELP>
- [..Help index...]<ID_HELPINDEX>
- [..Reload Help Database]<ID_LOADHELP>
-
-; -----------------------------------------
-;
-; Following are menu command help windows
-;
-; -----------------------------------------
-<ID_NEW>
-[<<]<File>
-[>>]<ID_OPEN>
-The New Command
-This command opens a new, untitled document
-window. An untitled document is one that has
-not been given a file name. When you use the
-[..Save]<ID_SAVE> or [..Save as]<ID_SAVEAS> command on the File menu the
-document gets a file name.
-; -----------------------------------------
-<ID_OPEN>
-[<<]<ID_NEW>
-[>>]<ID_SAVE>
-The Open Command
-This command opens an existing document and loads
-it into a window. You select the document by filling
-in the [..File Open]<FileOpen> dialog box.
-; -----------------------------------------
-<ID_SAVE>
-[<<]<ID_OPEN>
-[>>]<ID_SAVEAS>
-The Save Command
-This command saves the document in the currently
-active document window into a disk file. The file
-name is the same as when the file was loaded. If
-the window contains an untitled document, this
-command works just like the [..Save as]<ID_SAVEAS> command.
-; -----------------------------------------
-<ID_SAVEAS>
-[<<]<ID_SAVE>
-[>>]<ID_DELETEFILE>
-The Save As Command
-This command allows you to save the document in the
-currently active document window under a new file
-name. You specify the file's name by filling in the
-fields on the [..Save as]<SaveAs> dialog box.
-
-The new file name becomes the title of the
-currently active document window where the file is
-displayed.
-; -----------------------------------------
-<ID_DELETEFILE>
-[<<]<ID_SAVEAS>
-[>>]<ID_PRINT>
-The Delete Command
-Use this command to delete the text file displayed
-in the active editbox window.
-; -----------------------------------------
-<ID_PRINT>
-[<<]<ID_DELETEFILE>
-[>>]<ID_PRINTSETUP>
-The Print Command
-This command prints the document in the
-currently-selected document window.
-; -----------------------------------------
-<ID_PRINTSETUP>
-[<<]<ID_PRINT>
-[>>]<ID_DOS>
-The Print Setup Command
-This command displays the [..Print Setup]<PrintSetup> dialog
-box to allow you to change the printer port
-and margins for the printout.
-; -----------------------------------------
-<ID_DOS>
-[<<]<ID_PRINT>
-[>>]<ID_EXIT>
-The DOS Command
-This command "shells" out to DOS. You return to the
-application from DOS by executing the DOS exit
-command at the DOS command line.
-; -----------------------------------------
-<ID_EXIT>
-[<<]<ID_DOS>
-The Exit Command
-This command exits to DOS from the application. If
-there are any changed documents that you have not
-saved, the program will ask if you want to save
-them and allow you to do so, one at a time.
-; -----------------------------------------
-<ID_UNDO>
-[<<]<Edit>
-[>>]<ID_CUT>
-The Undo Command
-This command "undoes" the most recent [..Delete]<ID_DELETETEXT> or
-[..Clear]<ID_CLEAR> command. The text that was deleted by one of
-these commands is written into the document at the
-current cursor location.
-; -----------------------------------------
-<ID_CUT>
-[<<]<ID_UNDO>
-[>>]<ID_COPY>
-The Cut Command
-This command is active only when the current
-document window has a [..marked block]<Block>. The command
-deletes the text in the marked block, copies it to
-the [..Clipboard]<Clipboard>, and closes up the space in the
-document that the text previously occupied.
-; -----------------------------------------
-<ID_COPY>
-[<<]<ID_CUT>
-[>>]<ID_PASTE>
-The Copy Command
-This command is active only when the current
-document window has a [..marked block]<Block>. The command
-copies the text in the marked block to the
-[..Clipboard]<Clipboard>, and closes up the space in the document
-that the text previously occupied.
-; -----------------------------------------
-<ID_PASTE>
-[<<]<ID_COPY>
-[>>]<ID_CLEAR>
-The Paste Command
-This command is active only when the [..Clipboard]<Clipboard>
-contains text. The command inserts the text from the
-Clipboard into the currently active document window
-at the current cursor location.
-; -----------------------------------------
-<ID_CLEAR>
-[<<]<ID_PASTE>
-[>>]<ID_DELETETEXT>
-The Clear Command
-This command is active only when the current
-document window has a [..marked block]<Block>. The command
-deletes the block of text, leaving empty space in
-the document where the text had been.
-
-You can undo the text deletion with the
-[..Undo]<ID_UNDO> command.
-; -----------------------------------------
-<ID_DELETETEXT>
-[<<]<ID_CLEAR>
-[>>]<ID_PARAGRAPH>
-The Delete Command
-This command is active only when the current
-document window has a [..marked block]<Block>. The command
-deletes the block of text, closing the space in the
-document where the text had been.
-
-You can undo the text deletion with the
-[..Undo]<ID_UNDO> command.
-; -----------------------------------------
-<ID_PARAGRAPH>
-[<<]<ID_DELETETEXT>
-The Paragraph Command
-This command reforms a paragraph beginning at the
-current keyboard cursor position. The end of the
-paragraph is the last line preceding the next blank
-line.
-; -----------------------------------------
-<ID_SEARCH>
-[<<]<Search>
-[>>]<ID_REPLACE>
-The Search Command
-This command opens the [..Search Text]<SearchTextDB> Dialog Box to
-allow you to search the text for a
-matching string.
-; -----------------------------------------
-<ID_REPLACE>
-[<<]<ID_SEARCH>
-[>>]<ID_SEARCHNEXT>
-The Replace Command
-This command opens the [..Replace Text]<ReplaceText> Dialog Box to
-allow you to search the text for a
-matching string and replace it with a
-different text string.
-; -----------------------------------------
-<ID_SEARCHNEXT>
-[<<]<ID_REPLACE>
-The Next Command
-This command continues the most recent [..Search]<ID_SEARCH>
-command beginning at the current cursor position.
-; -----------------------------------------
-<ID_INSERT>
-[<<]<Options>
-[>>]<ID_WRAP>
-The Insert Toggle
-This [**toggle]<toggle> command turns the editor's insert mode
-on and off. When insert mode is on, the editor
-inserts the text that you write. Otherwise each
-character typed overwrites the one at the current
-cursor position.
-; -----------------------------------------
-<ID_WRAP>
-[<<]<ID_INSERT>
-[>>]<ID_TABS>
-The Word Wrap Toggle
-This [**toggle]<toggle> command turns the editor's word wrap
-feature on and off. When word wrap is on, the editor
-will wrap words as you type at the right margin of
-the document window. When word wrap is off, the
-editor will scroll the display horizontally as you
-type beyond the right margin.
-; -----------------------------------------
-<ID_TAB?>
-[<<]<ID_WRAP>
-[>>]<ID_DISPLAY>
-The Tabs Command
-This command allows you to
-change the editor's tab settings.
-; -----------------------------------------
-<ID_DISPLAY>
-[<<]<ID_TABS>
-[>>]<ID_LOG>
-The Display Command
-This command displays the [..Display]<Display> dialog box to
-allow you to modify the screen's colors and
-configuration.
-; -----------------------------------------
-<ID_LOG>
-[<<]<ID_DISPLAY>
-[>>]<ID_SAVEOPTIONS>
-The Log Messages Command
-This command is used primarily for debugging. It
-opens the [..Log Message]<Log> dialog box to allow the
-programmer to select the D-Flat messages to log and
-to turn message logging on and off.
-; -----------------------------------------
-<ID_SAVEOPTIONS>
-[<<]<ID_LOG>
-The Save Options Command
-This command saves the current options in a
-configuration file that the application reads when
-it first starts up.
-; -----------------------------------------
-<ID_CLOSEALL>
-[<<]<Window>
-[>>]<ID_WINDOW>
-The Close All Command
-This command closes all the document windows on the
-desktop.
-; -----------------------------------------
-<ID_WINDOW>
-[<<]<ID_CLOSEALL>
-[>>]<ID_MOREWINDOWS>
-The Open Window List
-The [..Window]<Window> menu displays a list of open document
-windows. You can select one of them as the current
-active window by selecting its title on the Window
-menu. When the menu first displays, the active
-window has a check mark (û) next to it.
-<ID_MOREWINDOWS>
-[<<]<ID_WINDOW>
-More Windows
-This command indicates that there are more open document
-windows than the [..Window]<Window> menu can display.
-Choose this command to see the [..Windows]<Windows> dialog box.
-; -----------------------------------------
-<ID_HELPHELP>
-[<<]<Help>
-[>>]<ID_EXTHELP>
-Help for Help
-This command describes how to use the Help system.
-; -----------------------------------------
-<ID_EXTHELP>
-[<<]<ID_HELPHELP>
-[>>]<ID_KEYSHELP>
-Extended Help
-Extended Help displays information about the
-application.
-; -----------------------------------------
-<ID_KEYSHELP>
-[<<]<ID_EXTHELP>
-[>>]<ID_HELPINDEX>
-Keys Help
-This command displays a help window that shows the
-keystrokes that you use to operate the application.
-; -----------------------------------------
-<ID_HELPINDEX>
-[<<]<ID_KEYSHELP>
-[>>]<ID_LOADHELP>
-Help Index
-The Help index lists the subjects covered in the
-Help database. You can go directly to a subject from
-the index by selecting the subject's name.
-; -----------------------------------------
-<ID_LOADHELP>
-[<<]<ID_HELPINDEX>
-[>>]<ID_ABOUT>
-Reload Help Database
-This command allows you to reload the Help
-database. It is useful when you use the
-Memopad program to modify its Help database.
-You can change and save the MEMOPAD.TXT file,
-use this command to reload it, then use the
-Help system to view the results. Without this
-command, your changes would corrupt the
-current Memopad's picture of the database
-with respect to its pointers.
-
-You must delete the MEMOPAD.HLP compressed
-help database in order for this program to
-load the most recent changes.
-; -----------------------------------------
-<ID_ABOUT>
-[<<]<ID_LOADHELP>
-The About Command
-This command displays a message that tells you what
-the application is.
-; -----------------------------------------
-<ID_FILENAME>
-[>>]<ID_FILES>
-The Filename Field
-
-On the Open File dialog box:
- Enter the name of the file you wish to
- open into a document window, or enter
- the file specification with wild cards
- to display a list of files in the
- [..Files]<ID_FILES> field.
-
-On the Save As dialog box:
- Enter the name with which you wish to
- save the file.
-; -----------------------------------------
-<ID_FILES>
-[<<]<ID_FILENAME>
-[>>]<ID_DRIVE>
-The Files Field
-Select a file from the listbox by using one
-of these methods:
-
-Keyboard: Move the selection cursor to
- the file name and press Enter.
-
-Mouse: Double-click the file name.
-; -----------------------------------------
-<ID_DRIVE>
-[<<]<ID_FILES>
-The Directories Field
-Use this listbox to select a different
-drive or subdirectory. Select a drive or
-subdirectory from the listbox by using one
-of these methods:
-
-Keyboard: Move the selection cursor to
- the drive or subdirectory and
- press Enter.
-
-Mouse: Double-click the drive or
- subdirectory.
-; -----------------------------------------
-<ID_PRINTERPORT>
-[<<]<PrintSetup>
-[>>]<ID_LEFTMARGIN>
-The Printer Port Combo Box
-Use this combo box to change the printer
-port and to set the report's margins.
-; -----------------------------------------
-<ID_LEFTMARGIN>
-[<<]<ID_PRINTERPORT>
-[>>]<ID_RIGHTMARGIN>
-The Left Margin Spin Button
-Change the left margin by increasing
-and decreasing the value in this
-spin box.
-; -----------------------------------------
-<ID_RIGHTMARGIN>
-[<<]<ID_LEFTMARGIN>
-[>>]<ID_TOPMARGIN>
-The Right Margin Spin Button
-Change the right margin by increasing
-and decreasing the value in this
-spin box.
-; -----------------------------------------
-<ID_TOPMARGIN>
-[<<]<ID_RIGHTMARGIN>
-[>>]<ID_BOTTOMMARGIN>
-The Top Margin Spin Button
-Change the top margin by increasing
-and decreasing the value in this
-spin box.
-; -----------------------------------------
-<ID_BOTTOMMARGIN>
-[<<]<ID_TOPMARGIN>
-The Bottom Margin Spin Button
-Change the bottom margin by increasing
-and decreasing the value in this
-spin box.
-; -----------------------------------------
-<ID_SEARCHFOR>
-[>>]<ID_REPLACEWITH>
-The Search For Text Entry Box
-Enter the text you want to search for in this
-text box. Press Enter or the OK command button
-to begin the search. Press Esc to forget it.
-Use the [..Match Upper/Lower Case Check Box]<ID_MATCHCASE> to
-select whether the search will match only if
-the case matches or if the search is insensitive
-to the case of the two strings.
-; -----------------------------------------
-<ID_REPLACEWITH>
-[<<]<ID_SEARCHFOR>
-[>>]<ID_MATCHCASE>
-The Replace With Text Entry Box
-Enter the text string that will replace
-the matching text string in the
-[..Search For Text Entry Box]<ID_SEARCHFOR>.
-; -----------------------------------------
-<ID_MATCHCASE>
-[<<]<ID_REPLACEWITH>
-[>>]<ID_REPLACEALL>
-The Match Upper/Lower Case Check Box
-Use this checkbox to select whether the search
-will match only if the case matches or if the
-search is insensitive to the case of the two
-strings.
-; -----------------------------------------
-<ID_REPLACEALL>
-[<<]<ID_MATCHCASE>
-The Replace Every Match Check Box
-Use this checkbox to select whether the search
-will replace every match in the document.
-; -----------------------------------------
-<ID_TITLE>
-[<<]<Display>
-[>>]<ID_BORDER>
-The Title Check Box
-Select this Check Box to toggle the application
-window's title on and off. Without a title, the
-window also loses its [..Control Box]<controlbox>.
-; -----------------------------------------
-<ID_BORDER>
-[<<]<ID_TITLE>
-[>>]<ID_STATUSBAR>
-The Border Check Box
-Select this Check Box to toggle the application
-window's border on and off. Without a border, the
-window also loses its [..Status Bar]<statusbar>.
-; -----------------------------------------
-<ID_STATUSBAR>
-[<<]<ID_BORDER>
-[>>]<ID_TEXTURE>
-The Status Bar Check Box
-Select this Check Box to toggle the application
-window's [..Status Bar]<statusbar> on and off.
-; -----------------------------------------
-<ID_TEXTURE>
-[<<]<ID_STATUSBAR>
-[>>]<ID_COLOR>
-The Texture Check Box
-Select this Check Box to toggle the application
-window's background texture on and off.
-; -----------------------------------------
-<ID_COLOR>
-[<<]<ID_TEXTURE>
-[>>]<ID_MONO>
-The Color Option Button
-Select this option for a color display.
-; -----------------------------------------
-<ID_MONO>
-[<<]<ID_COLOR>
-[>>]<ID_REVERSE>
-The Mono Option Button
-Select this option for a monochrome display.
-; -----------------------------------------
-<ID_REVERSE>
-[<<]<ID_MONO>
-[>>]<ID_25LINES>
-The Reverse Option Button
-Select this option for a reverse monochrome
-display. You might find that this option
-works well with the LCD screens of some laptop
-computers, particularly when you turn off the
-[..Texture]<ID_TEXTURE> check box.
-; -----------------------------------------
-<ID_25LINES>
-[<<]<ID_REVERSE>
-[>>]<ID_43LINES>
-The 25 Lines Option Button
-Use this button to select a 25-line display.
-; -----------------------------------------
-<ID_43LINES>
-[<<]<ID_25LINES>
-[>>]<ID_50LINES>
-The 43 Lines Option Button
-Use this button to select a 43-line display.
-(EGA and VGA)
-; -----------------------------------------
-<ID_50LINES>
-[<<]<ID_43LINES>
-[>>]<ID_SNOWY>
-The 50 Lines Option Button
-Use this button to select a 50-line display.
-(VGA only)
-; -----------------------------------------
-<ID_SNOWY>
-[<<]<ID_50LINES>
-Snowy Display
-Select this check box if your display
-(usually a CGA) displays video snow when
-you change the screen.
-; -----------------------------------------
-<ID_LOGLIST>
-[<<]<Options>
-[>>]<ID_LOGGING>
-The Messages Listbox
-This is a list of D-Flat messages that
-you can log when the [..Logging]<ID_LOGGING> checkbox is
-selected. The list is a [..Multiple-Selection]<MultiSel>
-listbox.
-; -----------------------------------------
-<ID_LOGGING> [<<]<ID_LOGLIST> The Logging
-CheckBox This checkbox turns message
-logging on and off. ;
------------------------------------------
-<TEXTBOX> The TEXTBOX Window Class
-
- ======== Text needed =========
-
-; -----------------------------------------
-<LISTBOX>
-The LISTBOX Window Class
-
- ======== Text needed =========
-
-; -----------------------------------------
-<EDITBOX>
-The EDITBOX Window Class
-
- ======== Text needed =========
-
-; -----------------------------------------
-<Pulldowns>
-[<<]<menubar>
-[>>]<File>
-Pull-down Menus
-Pull-down menus contain the commands to operate
-the program. Read about the [..Action Bar]<menubar> to see
-how to select the pull-down menus. Following
-is a list of the pull-down menus.
-
- [..The File Menu]<File>
- [..The Edit Menu]<Edit>
- [..The Search Menu]<Search>
- [..The Options Menu]<Options>
- [..The Window Menu]<Window>
- [..The Help Menu]<Help>
-
-The [..System Menu]<sysmenu> is another kind of pull-down menu.
-; -----------------------------------------
-<File>
-[<<]<Pulldowns>
-[>>]<Edit>
-The File Menu
-The File menu contains commands that
-open, save, and print files. The menu
-also has the command that exits the
-program. Following are the commands
-and associated [**function keys]<shortcut>.
-
- [..New]<ID_NEW>
- [..Open]<ID_OPEN>
- [..Save]<ID_SAVE> (Alt+S)
- [..Save as]<ID_SAVEAS>
- [..Print]<ID_PRINT>
- [..Exit]<ID_EXIT> (Alt+X or Alt+F4)
-
-[**Inactive]<inactive> commands display in a dim font.
-; -----------------------------------------
-<Edit>
-[<<]<File>
-[>>]<Search>
-The Edit Menu
-The Edit menu contains commands that support
-text editing. Following are the commands and
-associated [**function keys]<shortcut>.
-
- [..Undo]<ID_UNDO> (Alt+BS)
- [..Cut]<ID_CUT> (Shift+Del)
- [..Copy]<ID_COPY> (Ctrl+Ins)
- [..Paste]<ID_PASTE> (Shift+Ins)
- [..Clear]<ID_CLEAR>
- [..Delete]<ID_DELETETEXT> (Del)
- [..Paragraph]<ID_PARAGRAPH> (Alt+P)
-
-[**Inactive]<inactive> commands display in a dim font.
-; -----------------------------------------
-<Search>
-[<<]<Edit>
-[>>]<Utilities>
-The Search Menu
-The Search menu allows you to search the text
-for a matching string. The commands are:
-
- [..Search]<ID_SEARCH>
- [..Next]<ID_SEARCHNEXT> (F3)
-; -----------------------------------------
-<Utilities>
-[<<]<Search>
-[>>]<Options>
-The Utilities Menu
-The Utilities Menu has two commands that
-demonstrate the use of the PICTUREBOX window
-class. The commands are:
-
- [..Calendar]<ID_CALENDAR>
- [..Bar Chart]<ID_BARCHART>
-; -----------------------------------------
-<Options>
-[<<]<Utilities>
-[>>]<Window>
-The Options Menu
-The Options menu contains commands that let you
-control the editor's behavior, the video display
-characteristics, and whether to [**log]<logging> messages.
-You can save the options in a configuration file.
-Following are the commands on the Options menu.
-
- [..Insert]<ID_INSERT> (Ins)
- [..Word wrap]<ID_WRAP>
- [..Tabs]<ID_TABS>
- [..Display]<ID_DISPLAY>
- [..Log Messages]<ID_LOG>
- [..Save Options]<ID_SAVEOPTIONS>
-; -----------------------------------------
-<Window>
-[<<]<Options>
-[>>]<Help>
-The Window Menu
-The Window menu has no selections unless the
-[..Application window]<Application> has one or more document
-windows displayed. When documents are displayed,
-the Window menu contains a [..Close All]<ID_CLOSEALL> command
-and an entry for the first nine document windows.
-You can select a document window from the Window
-menu. If the Application window has more than nine
-document windows, the Window menu has the [**More Windows]<MoreWins>
-command, which displays the [..Windows]<Windows> dialog box.
-; -----------------------------------------
-<Help>
-[<<]<Window>
-The Help Menu
-The Help menu provides information about the
-application and the desktop. The selections are:
-
- [..Help for help...]<ID_HELPHELP>
- [..Extended help...]<ID_EXTHELP>
- [..Keys help...]<ID_KEYSHELP>
- [..Help index...]<ID_HELPINDEX>
- [..About...]<ID_ABOUT>
-
-; -----------------------------------------
-<sysmenu>
-[<<]<Pulldowns>
-[>>]<ID_SYSRESTORE>
-The System Menu
-Most windows have a system menu. If the window has a
-System Menu, the window will have a [..Control Box]<controlbox>. You
-can select the System Menu by clicking the control
-box or by pressing Alt+Spacebar for the application
-window's system menu and Alt+Hyphen for the system
-menu of other windows.
-
-Following are the commands on the System Menu:
-
- [..Restore]<ID_SYSRESTORE>
- [..Move]<ID_SYSMOVE>
- [..Size]<ID_SYSSIZE>
- [..Minimize]<ID_SYSMINIMIZE>
- [..Maximize]<ID_SYSMAXIMIZE>
- [..Close]<ID_SYSCLOSE>
-
-; -----------------------------------------
-<ID_SYSRESTORE>
-[<<]<sysmenu>
-[>>]<ID_SYSMOVE>
-The Restore Command on the System Menu
-This command restores a [..Minimized]<ID_SYSMINIMIZE> or [..Maximized]<ID_SYSMAXIMIZE>
-window to the size and position it had before it
-was minimized or maximized.
-
-You can also restore a minimized or maximized
-window by clicking its [..Restore Box]<restorebox>.
-; -----------------------------------------
-<ID_SYSMOVE>
-[<<]<ID_SYSRESTORE>
-[>>]<ID_SYSSIZE>
-The Move Command on the System Menu
-The Move command lets you move a window with the
-keyboard. Select the command from the System Menu. A
-movable window frame comes into view over the
-window's border. Use the up, down, left, and right
-arrow keys to move the frame to the new window
-position. Press the Enter key when the movable frame
-is where you want to move the window. Press the Esc
-key to ignore the movement.
-
-You can move a window with the mouse by clicking on
-the window's [..Title Bar]<titlebar> and dragging the window to
-the new location.
-; -----------------------------------------
-<ID_SYSSIZE>
-[<<]<ID_SYSMOVE>
-[>>]<ID_SYSMINIMIZE>
-The Size Command on the System Menu
-The Size command lets you re-size a window with the
-keyboard. Select the command from the System Menu.
-A sizeable window frame comes into view over the
-window's border. Use the up, down, left, and right
-arrow keys to change the frame to the new window
-size. Press the Enter key when the sizeable frame
-is the size you want for the window. Press the Esc
-key to ignore the size change.
-
-You can re-size a window with the mouse by clicking
-on the window border's [..Resize Box]<sizebox> and dragging the
-window to the new size.
-; -----------------------------------------
-<ID_SYSMINIMIZE>
-[<<]<ID_SYSSIZE>
-[>>]<ID_SYSMAXIMIZE>
-The Minimize Command on the System Menu
-This command minimizes the window to an icon at the
-bottom of the application window.
-
-You can minimize a window with the mouse by clicking
-on the window's [..Minimize Box]<minbox>.
-
-The [..Restore]<ID_SYSRESTORE> command restores a minimized window to
-the size and position it had before it was
-minimized.
-; -----------------------------------------
-<ID_SYSMAXIMIZE>
-[<<]<ID_SYSMINIMIZE>
-[>>]<ID_SYSCLOSE>
-The Maximize Command on the System Menu
-This command maximizes the window to occupy all of
-the application window's client area.
-
-You can maximize a window with the mouse by clicking
-on the window's [..Maximize Box]<maxbox>.
-
-The [..Restore]<ID_SYSRESTORE> command restores a maximized window to
-the size and position it had before it was
-maximized.
-; -----------------------------------------
-<ID_SYSCLOSE>
-[<<]<ID_SYSMAXIMIZE>
-The Close Command on the System Menu
-This command closes the window with which the System
-Menu is associated.
-
-You can also close the window by double-clicking the
-[..Control Box]<controlbox> or pressing Ctrl+F4.
-; -----------------------------------------
-;
-; Following are dialog box help windows
-;
-; -----------------------------------------
-<Dialog>
-[>>]<cmdbuttons>
-Dialog Boxes
-Dialog Boxes allow you to enter data into the
-application. A Dialog Box consists of these
-controls:
-
- [..Command Buttons]<cmdbuttons>
- [..Check Boxes]<checkboxes>
- [..Option Buttons]<optbuttons>
- [..Edit Boxes]<editboxes>
- [..List Boxes]<listboxes>
- [..Multiple-Selection Listboxes]<MultiSel>
- [..Combo Boxes]<combobox>
- [..Spin Buttons]<spinbutton>
-
-Move from control to control by using the Tab key
-or by pressing Alt+ the highlighted character in
-the control's label. Execute a control by pressing
-the Enter key.
-
-Exit the Dialog Box and accept its data entries by
-executing the OK command button.
-
-Exit the Dialog Box and reject its data entries by
-executing the Cancel command button.
-; -----------------------------------------
-<cmdbuttons>
-[<<]<Dialog>
-[>>]<checkboxes>
-Command Buttons
-Select a command button to execute its
-command by using one of these procedures:
-
- 1. Click the button.
- 2. Press Alt+ the shortcut key.
- 3. Tab to the button and press Enter.
-; -----------------------------------------
-<checkboxes>
-[<<]<cmdbuttons>
-[>>]<optbuttons>
-Check Boxes
-A check box can be on [X] or off [ ].
-Toggle the check box with one of these
-procedures:
-
- 1. Click the check box.
- 2. Press Alt+ the shortcut key.
-; -----------------------------------------
-<optbuttons>
-[<<]<checkboxes>
-[>>]<editboxes>
-Option Buttons
-Option buttons are in groups of 2 or
-more. One option button in a group
-is on (\a) and the others are off ( ).
-Select the option button with one of
-these procedures:
-
- 1. Click the option button.
- 2. Press Alt+ the shortcut key.
-; -----------------------------------------
-<editboxes>
-[<<]<optbuttons>
-[>>]<listboxes>
-Edit Boxes
-
- ======== Text needed =========
-
-; -----------------------------------------
-<listboxes>
-[<<]<editboxes>
-[>>]<MultiSel>
-List Boxes
-
- ======== Text needed =========
-
-; -----------------------------------------
-<MultiSel>
-[<<]<listboxes>
-[>>]<combobox>
-Multiple-Selection Listboxes
-
- ======== Text needed =========
-
-; -----------------------------------------
-<combobox>
-[<<]<MultiSel>
-[>>]<spinbutton>
-Combo Boxes
-
- ======== Text needed =========
-
-; -----------------------------------------
-<spinbutton>
-[<<]<combobox>
-Spin Buttons
-
- ======== Text needed =========
-
-; -----------------------------------------
-<FileOpen>
-The File Open Dialog Box
-
- ======== Text needed =========
-
-; -----------------------------------------
-<SaveAs>
-The Save As Dialog Box
-
- ======== Text needed =========
-
-; -----------------------------------------
-<PrintSetup>
-The Print Setup Dialog Box
-
- ======== Text needed =========
-
-; -----------------------------------------
-<SearchTextDB>
-The Search Text Dialog Box
-
- ======== Text needed =========
-
-; -----------------------------------------
-<ReplaceTextDB>
-The Replace Text Dialog Box
-
- ======== Text needed =========
-
-; -----------------------------------------
-<MsgBox>
-The MsgBox Dialog Box
-
- ======== Text needed =========
-
-; -----------------------------------------
-<Display>
-The Display Dialog Box
-
- ======== Text needed =========
-
- [..Title]<ID_TITLE>
- [..Border]<ID_BORDER>
- [..Status Bar]<ID_STATUSBAR>
- [..Texture]<ID_TEXTURE>
-
- [..Color]<ID_COLOR>
- [..Mono]<ID_MONO>
- [..Reverse]<ID_REVERSE>
-
-; -----------------------------------------
-<Windows>
-The Windows Dialog Box
-This dialog box lists all the open windows.
-Select one and choose OK to make that window
-the active one.
-; -----------------------------------------
-<Log>
-The Log Message Dialog Box
-
- ======== Text needed =========
-
-; -----------------------------------------
-;
-; Following are keyword reference definition windows
-;
-; -----------------------------------------
-<inactive>
-An inactive menu command is one that is, for
-the moment, not available. The command becomes
-active at another time when conditions within
-the program require or permit its use.
-; -----------------------------------------
-<shortcut>
-Function keys are key combinations that
-you can press to execute a menu command
-without selecting the pull-down menu
-itself. Not all menu commands have
-function keys. The most frequently used
-operations do.
-; -----------------------------------------
-<logging>
-The message log is a debug tool. You should
-delete it from the system by turning off the
-INCLUDE_LOGGING global definition in dflat.h.
-You should then eliminate references to it in
-the MEMOPAD.TXT help database.
-; -----------------------------------------
-<MoreWins>
-A menu can have only so many selections.
-The length of the screen is the limiting
-factor. The CUA standard defines nine
-windows as the maximum number of windows
-that the Window menu can display. The
-Windows menu has the More Windows command
-to provide a way for you to choose from
-the rest of the document windows.
-; -----------------------------------------
-<API>
-Applications Program Interface (API):
-The functions, messages, macros, and
-data structures that a programmer
-uses to interface with the processes
-of a function library.
-; -----------------------------------------
-<Block>
-Marking Text Blocks
-Marked text blocks affect the operation of these
-commands:
-
- [..Cut]<ID_CUT>
- [..Copy]<ID_COPY>
- [..Paste]<ID_PASTE>
- [..Clear]<ID_CLEAR>
- [..Delete]<ID_DELETETEXT>
- [..Paragraph]<ID_PARAGRAPH>
-
-Mark a text block by using one of these operations:
-
- Keyboard:
- ---------
- Hold the Shift key down and move the
- keyboard cursor. The block will be marked in
- reverse video.
-
- To clear the marked block, release the Shift
- key and press any text entry or cursor movement
- key.
-
- Mouse:
- ------
- Click on the first or last character of the
- block. Hold the mouse button down and move
- the mouse cursor around. The marked block
- will follow the mouse cursor.
-
- To clear the marked block, release the mouse
- cursor and click anywhere.
-
-; -----------------------------------------
-<Clipboard>
-The Clipboard
-The Clipboard is a scratchpad where you can save
-text that can be pasted into a different location
-in the same or another document. You save text with
-the [..Copy]<ID_COPY> and [..Cut]<ID_CUT> commands, and you paste text into
-from the Clipboard into a document with the [..Paste]<ID_PASTE>
-command.
-; -----------------------------------------
-<toggle>
-A toggle command is one that is
-either on or off. When it is on,
-its command on the menu is preceded
-by a check mark (û).
-<ID_CALENDAR>
-Calendar
-This command displays a calendar to demonstrate
-the use of the PICTUREBOX class to draw line
-vectors.
-<ID_BARCHART>
-Bar Chart
-This command displays a bar chart to demonstrate
-the use of the PICTUREBOX class to draw bars.
-<Calendar>
-Calendar
-This calendar is an example of a picture box
-with line vectors. The PgUp and PgDn keys
-will page through the months. You can close
-the window from the [..System Menu]<sysmenu>.
-<BarChart>
-Bar Chart
-This window is an example of a bar chart. You
-can close the window from the [..System Menu]<sysmenu>.
-<end>
+++ /dev/null
-/* ------------- editbox.c ------------ */
-#include "dflat.h"
-
-#define EditBufLen(wnd) (DfIsMultiLine(wnd) ? DF_EDITLEN : DF_ENTRYLEN)
-#define SetLinePointer(wnd, ln) (wnd->CurrLine = ln)
-#define isWhite(c) ((c)==' '||(c)=='\n')
-/* ---------- local prototypes ----------- */
-static void SaveDeletedText(DFWINDOW, char *, int);
-static void Forward(DFWINDOW);
-static void Backward(DFWINDOW);
-static void End(DFWINDOW);
-static void Home(DFWINDOW);
-static void Downward(DFWINDOW);
-static void Upward(DFWINDOW);
-static void StickEnd(DFWINDOW);
-static void NextWord(DFWINDOW);
-static void PrevWord(DFWINDOW);
-static void ModTextPointers(DFWINDOW, int, int);
-static void SetAnchor(DFWINDOW, int, int);
-/* -------- local variables -------- */
-static BOOL KeyBoardMarking, ButtonDown;
-static BOOL TextMarking;
-static int ButtonX, ButtonY;
-static int PrevY = -1;
-
-/* ----------- DFM_CREATE_WINDOW Message ---------- */
-static int CreateWindowMsg(DFWINDOW wnd)
-{
- 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, DFM_CLEARTEXT, 0, 0);
- return rtn;
-}
-/* ----------- DFM_SETTEXT Message ---------- */
-static int SetTextMsg(DFWINDOW wnd, DF_PARAM p1)
-{
- int rtn = FALSE;
- if (strlen((char *)p1) <= wnd->MaxTextLength)
- rtn = DfBaseWndProc(DF_EDITBOX, wnd, DFM_SETTEXT, p1, 0);
- return rtn;
-}
-/* ----------- DFM_CLEARTEXT Message ------------ */
-static int ClearTextMsg(DFWINDOW wnd)
-{
- int rtn = DfBaseWndProc(DF_EDITBOX, wnd, DFM_CLEARTEXT, 0, 0);
- unsigned blen = EditBufLen(wnd)+2;
- wnd->text = DfRealloc(wnd->text, blen);
- memset(wnd->text, 0, blen);
- wnd->wlines = 0;
- wnd->CurrLine = 0;
- wnd->CurrCol = 0;
- wnd->WndRow = 0;
- wnd->wleft = 0;
- wnd->wtop = 0;
- wnd->textwidth = 0;
- wnd->TextChanged = FALSE;
- return rtn;
-}
-/* ----------- 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 = DfBaseWndProc(DF_EDITBOX, wnd, DFM_ADDTEXT, p1, p2);
- if (rtn != FALSE) {
- if (!DfIsMultiLine(wnd)) {
- wnd->CurrLine = 0;
- wnd->CurrCol = strlen((char *)p1);
- if (wnd->CurrCol >= DfClientWidth(wnd)) {
- wnd->wleft = wnd->CurrCol-DfClientWidth(wnd);
- wnd->CurrCol -= wnd->wleft;
- }
- wnd->BlkEndCol = wnd->CurrCol;
- DfSendMessage(wnd, DFM_KEYBOARD_CURSOR,
- DfWndCol, wnd->WndRow);
- }
- }
- }
- return rtn;
-}
-/* ----------- DFM_GETTEXT Message ---------- */
-static int GetTextMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2)
-{
- char *cp1 = (char *)p1;
- char *cp2 = wnd->text;
- if (cp2 != NULL) {
- while (p2-- && *cp2 && *cp2 != '\n')
- *cp1++ = *cp2++;
- *cp1 = '\0';
- return TRUE;
- }
- return FALSE;
-}
-/* ----------- DFM_SETTEXTLENGTH Message ---------- */
-static int SetTextLengthMsg(DFWINDOW wnd, unsigned int len)
-{
- if (++len < DF_MAXTEXTLEN) {
- wnd->MaxTextLength = len;
- if (len < wnd->textlen) {
- wnd->text=DfRealloc(wnd->text, len+2);
- wnd->textlen = len;
- *((wnd->text)+len) = '\0';
- *((wnd->text)+len+1) = '\0';
- DfBuildTextPointers(wnd);
- }
- return TRUE;
- }
- return FALSE;
-}
-/* ----------- 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 == DfInFocus) {
- if (DfCharInView(wnd, (int)p1, (int)p2))
- DfSendMessage(NULL, DFM_SHOW_CURSOR,
- (wnd->InsertMode && !TextMarking), 0);
- else
- DfSendMessage(NULL, DFM_HIDE_CURSOR, 0, 0);
- }
-}
-/* ----------- SIZE Message ---------- */
-int SizeMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2)
-{
- 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, DFM_KEYBOARD_CURSOR, DfWndCol, wnd->WndRow);
- return rtn;
-}
-/* ----------- DFM_SCROLL Message ---------- */
-static int ScrollMsg(DFWINDOW wnd, DF_PARAM p1)
-{
- int rtn = FALSE;
- if (DfIsMultiLine(wnd)) {
- rtn = DfBaseWndProc(DF_EDITBOX,wnd,DFM_SCROLL,p1,0);
- if (rtn != FALSE) {
- if (p1) {
- /* -------- scrolling up --------- */
- if (wnd->WndRow == 0) {
- wnd->CurrLine++;
- StickEnd(wnd);
- }
- else
- --wnd->WndRow;
- }
- else {
- /* -------- scrolling down --------- */
- if (wnd->WndRow == DfClientHeight(wnd)-1) {
- if (wnd->CurrLine > 0)
- --wnd->CurrLine;
- StickEnd(wnd);
- }
- else
- wnd->WndRow++;
- }
- DfSendMessage(wnd,DFM_KEYBOARD_CURSOR,DfWndCol,wnd->WndRow);
- }
- }
- return rtn;
-}
-/* ----------- DFM_HORIZSCROLL Message ---------- */
-static int HorizScrollMsg(DFWINDOW wnd, DF_PARAM p1)
-{
- int rtn = FALSE;
- char *currchar = DfCurrChar;
- if (!(p1 &&
- wnd->CurrCol == wnd->wleft && *currchar == '\n')) {
- rtn = DfBaseWndProc(DF_EDITBOX, wnd, DFM_HORIZSCROLL, p1, 0);
- if (rtn != FALSE) {
- if (wnd->CurrCol < wnd->wleft)
- wnd->CurrCol++;
- else if (DfWndCol == DfClientWidth(wnd))
- --wnd->CurrCol;
- DfSendMessage(wnd,DFM_KEYBOARD_CURSOR,DfWndCol,wnd->WndRow);
- }
- }
- return rtn;
-}
-/* ----------- DFM_SCROLLPAGE Message ---------- */
-static int ScrollPageMsg(DFWINDOW wnd, DF_PARAM p1)
-{
- int rtn = FALSE;
- if (DfIsMultiLine(wnd)) {
- rtn = DfBaseWndProc(DF_EDITBOX, wnd, DFM_SCROLLPAGE, p1, 0);
- SetLinePointer(wnd, wnd->wtop+wnd->WndRow);
- StickEnd(wnd);
- DfSendMessage(wnd, DFM_KEYBOARD_CURSOR,DfWndCol, wnd->WndRow);
- }
- return rtn;
-}
-/* ----------- HORIZSCROLLPAGE Message ---------- */
-static int HorizPageMsg(DFWINDOW wnd, DF_PARAM p1)
-{
- int rtn = DfBaseWndProc(DF_EDITBOX, wnd, DFM_HORIZPAGE, p1, 0);
- if ((int) p1 == FALSE) {
- 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, DFM_KEYBOARD_CURSOR, DfWndCol, wnd->WndRow);
- return rtn;
-}
-/* ----- Extend the marked block to the new x,y position ---- */
-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 = 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, DFM_KEYBOARD_CURSOR, wnd->BlkEndCol, wnd->BlkEndLine);
- bbl = min(wnd->BlkBegLine, wnd->BlkEndLine);
- bel = max(wnd->BlkBegLine, wnd->BlkEndLine);
- while (ptop < bbl) {
- DfWriteTextLine(wnd, NULL, ptop, FALSE);
- ptop++;
- }
- for (y = bbl; y <= bel; y++)
- DfWriteTextLine(wnd, NULL, y, FALSE);
- while (pbot > bel) {
- DfWriteTextLine(wnd, NULL, pbot, FALSE);
- --pbot;
- }
-}
-/* ----------- DFM_LEFT_BUTTON Message ---------- */
-static int LeftButtonMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2)
-{
- 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 (DfWindowMoving || DfWindowSizing)
- return FALSE;
- if (DfIsMultiLine(wnd)) {
- if (TextMarking) {
- if (!DfInsideRect(p1, p2, rc)) {
- int x = MouseX, y = MouseY;
- int dir;
- DFMESSAGE msg = 0;
- 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, DFM_PAINT, 0, 0);
- }
- }
- return TRUE;
- }
- if (!DfInsideRect(p1, p2, rc))
- return FALSE;
- if (DfTextBlockMarked(wnd)) {
- DfClearTextBlock(wnd);
- DfSendMessage(wnd, DFM_PAINT, 0, 0);
- }
- if (wnd->wlines) {
- if (MouseY > wnd->wlines-1)
- return TRUE;
- lp = DfTextLine(wnd, MouseY+wnd->wtop);
- len = (int) (strchr(lp, '\n') - lp);
- MouseX = min(MouseX, len);
- if (MouseX < wnd->wleft) {
- MouseX = 0;
- DfSendMessage(wnd, DFM_KEYBOARD, DF_HOME, 0);
- }
- ButtonDown = TRUE;
- ButtonX = MouseX;
- ButtonY = MouseY;
- }
- else
- MouseX = MouseY = 0;
- wnd->WndRow = MouseY;
- SetLinePointer(wnd, MouseY+wnd->wtop);
- }
- if (DfIsMultiLine(wnd) ||
- (!DfTextBlockMarked(wnd)
- && (int)(MouseX+wnd->wleft) < (int)strlen(wnd->text)))
- wnd->CurrCol = MouseX+wnd->wleft;
- DfSendMessage(wnd, DFM_KEYBOARD_CURSOR, DfWndCol, wnd->WndRow);
- return TRUE;
-}
-/* ----------- MOUSE_MOVED Message ---------- */
-static int MouseMovedMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2)
-{
- 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 = DfWindowRect(wnd);
- DfSendMessage(NULL,DFM_MOUSE_TRAVEL,(DF_PARAM) &rc, 0);
- ButtonDown = FALSE;
- }
- if (TextMarking && !(DfWindowMoving || DfWindowSizing)) {
- ExtendBlock(wnd, MouseX, MouseY);
- return TRUE;
- }
- return FALSE;
-}
-static void StopMarking(DFWINDOW wnd)
-{
- TextMarking = FALSE;
- if (wnd->BlkBegLine > wnd->BlkEndLine) {
- swap(wnd->BlkBegLine, wnd->BlkEndLine);
- swap(wnd->BlkBegCol, wnd->BlkEndCol);
- }
- if (wnd->BlkBegLine == wnd->BlkEndLine &&
- wnd->BlkBegCol > wnd->BlkEndCol)
- swap(wnd->BlkBegCol, wnd->BlkEndCol);
-}
-/* ----------- BUTTON_RELEASED Message ---------- */
-static int ButtonReleasedMsg(DFWINDOW wnd)
-{
- if (DfIsMultiLine(wnd)) {
- ButtonDown = FALSE;
- if (TextMarking && !(DfWindowMoving || DfWindowSizing)) {
- /* release the mouse ouside the edit box */
- DfSendMessage(NULL, DFM_MOUSE_TRAVEL, 0, 0);
- StopMarking(wnd);
- return TRUE;
- }
- else
- PrevY = -1;
- }
- return FALSE;
-}
-/* ---- Process text block keys for multiline text box ---- */
-static void DoMultiLines(DFWINDOW wnd, int c, DF_PARAM p2)
-{
- if (DfIsMultiLine(wnd) && !KeyBoardMarking) {
- if ((int)p2 & (DF_LEFTSHIFT | DF_RIGHTSHIFT)) {
- switch (c) {
- 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;
- default:
- break;
- }
- }
- }
-}
-/* ---------- page/scroll keys ----------- */
-static int DoScrolling(DFWINDOW wnd, int c, DF_PARAM p2)
-{
- switch (c) {
- case DF_PGUP:
- case DF_PGDN:
- if (DfIsMultiLine(wnd))
- DfBaseWndProc(DF_EDITBOX, wnd, DFM_KEYBOARD, c, p2);
- break;
- case DF_CTRL_PGUP:
- case DF_CTRL_PGDN:
- DfBaseWndProc(DF_EDITBOX, wnd, DFM_KEYBOARD, c, p2);
- break;
- case DF_HOME:
- Home(wnd);
- break;
- case DF_END:
- End(wnd);
- break;
- case DF_CTRL_FWD:
- NextWord(wnd);
- break;
- case DF_CTRL_BS:
- PrevWord(wnd);
- break;
- case DF_CTRL_HOME:
- if (DfIsMultiLine(wnd)) {
- DfSendMessage(wnd, DFM_SCROLLDOC, TRUE, 0);
- wnd->CurrLine = 0;
- wnd->WndRow = 0;
- }
- Home(wnd);
- break;
- case DF_CTRL_END:
- if (DfIsMultiLine(wnd) &&
- wnd->WndRow+wnd->wtop+1 < wnd->wlines
- && wnd->wlines > 0) {
- DfSendMessage(wnd, DFM_SCROLLDOC, FALSE, 0);
- SetLinePointer(wnd, wnd->wlines-1);
- wnd->WndRow =
- min(DfClientHeight(wnd)-1, wnd->wlines-1);
- Home(wnd);
- }
- End(wnd);
- break;
- case DF_UP:
- if (DfIsMultiLine(wnd))
- Upward(wnd);
- break;
- case DF_DN:
- if (DfIsMultiLine(wnd))
- Downward(wnd);
- break;
- case DF_FWD:
- Forward(wnd);
- break;
- case DF_BS:
- Backward(wnd);
- break;
- default:
- return FALSE;
- }
- if (!KeyBoardMarking && DfTextBlockMarked(wnd)) {
- DfClearTextBlock(wnd);
- DfSendMessage(wnd, DFM_PAINT, 0, 0);
- }
- DfSendMessage(wnd, DFM_KEYBOARD_CURSOR, DfWndCol, wnd->WndRow);
- return TRUE;
-}
-/* -------------- Del key ---------------- */
-static void DelKey(DFWINDOW wnd)
-{
- char *currchar = DfCurrChar;
- int repaint = *currchar == '\n';
- if (DfTextBlockMarked(wnd)) {
- DfSendMessage(wnd, DFM_COMMAND, DF_ID_DELETETEXT, 0);
- DfSendMessage(wnd, DFM_PAINT, 0, 0);
- return;
- }
- if (DfIsMultiLine(wnd) && *currchar == '\n' && *(currchar+1) == '\0')
- return;
- strcpy(currchar, currchar+1);
- if (repaint) {
- DfBuildTextPointers(wnd);
- DfSendMessage(wnd, DFM_PAINT, 0, 0);
- }
- else {
- ModTextPointers(wnd, wnd->CurrLine+1, -1);
- DfWriteTextLine(wnd, NULL, wnd->WndRow+wnd->wtop, FALSE);
- }
- wnd->TextChanged = TRUE;
-}
-/* ------------ Tab key ------------ */
-static void TabKey(DFWINDOW wnd, DF_PARAM p2)
-{
- if (DfIsMultiLine(wnd)) {
- int insmd = wnd->InsertMode;
- do {
- char *cc = DfCurrChar+1;
- if (!insmd && *cc == '\0')
- break;
- if (wnd->textlen == wnd->MaxTextLength)
- break;
- DfSendMessage(wnd,DFM_KEYBOARD,insmd ? ' ' : DF_FWD,0);
- } while (wnd->CurrCol % DfCfg.Tabs);
- }
- else
- DfPostMessage(DfGetParent(wnd), DFM_KEYBOARD, '\t', p2);
-}
-/* ------------ Shift+Tab key ------------ */
-static void ShiftTabKey(DFWINDOW wnd, DF_PARAM p2)
-{
- if (DfIsMultiLine(wnd)) {
- do {
- if (DfCurrChar == DfGetText(wnd))
- break;
- DfSendMessage(wnd,DFM_KEYBOARD,DF_BS,0);
- } while (wnd->CurrCol % DfCfg.Tabs);
- }
- else
- DfPostMessage(DfGetParent(wnd), DFM_KEYBOARD, DF_SHIFT_HT, p2);
-}
-/* --------- All displayable typed keys ------------- */
-static void KeyTyped(DFWINDOW wnd, int c)
-{
- char *currchar = DfCurrChar;
- if ((c != '\n' && c < ' ') || (c & 0x1000))
- /* ---- not recognized by editor --- */
- return;
- if (!DfIsMultiLine(wnd) && DfTextBlockMarked(wnd)) {
- DfSendMessage(wnd, DFM_CLEARTEXT, 0, 0);
- currchar = DfCurrChar;
- }
- /* ---- test typing at end of text ---- */
- if (currchar == (char*)(wnd->text+wnd->MaxTextLength)) {
- /* ---- typing at the end of maximum buffer ---- */
- DfBeep();
- return;
- }
- if (*currchar == '\0') {
- /* --- insert a newline at end of text --- */
- *currchar = '\n';
- *(currchar+1) = '\0';
- DfBuildTextPointers(wnd);
- }
- /* --- displayable char or newline --- */
- if (c == '\n' || wnd->InsertMode || *currchar == '\n') {
- /* ------ inserting the keyed character ------ */
- if (wnd->text[wnd->textlen-1] != '\0') {
- /* --- the current text buffer is full --- */
- if (wnd->textlen == wnd->MaxTextLength) {
- /* --- text buffer is at maximum size --- */
- DfBeep();
- return;
- }
- /* ---- increase the text buffer size ---- */
- wnd->textlen += DF_GROWLENGTH;
- /* --- but not above maximum size --- */
- if&nb