1 /* ------------ log .c ------------ */
7 static char *message
[] = {
9 #define DFlatMsg(m) " " #m,
14 static FILE *logfile
= NULL
;
17 void DfLogMessages (DFWINDOW wnd
, DFMESSAGE msg
, DF_PARAM p1
, DF_PARAM p2
)
19 if (logfile
!= NULL
&& message
[msg
][0] != ' ')
21 "%-20.20s %-12.12s %-20.20s, %5.5ld, %5.5ld\n",
22 wnd
? (DfGetTitle(wnd
) ? DfGetTitle(wnd
) : "") : "",
23 wnd
? DfClassNames
[DfGetClass(wnd
)] : "",
24 message
[msg
]+1, p1
, p2
);
27 static int LogProc(DFWINDOW wnd
, DFMESSAGE msg
, DF_PARAM p1
, DF_PARAM p2
)
29 DFWINDOW cwnd
= DfControlWindow(&Log
, DF_ID_LOGLIST
);
32 case DFM_INITIATE_DIALOG
:
33 DfAddAttribute(cwnd
, DF_MULTILINE
| DF_VSCROLLBAR
);
35 DfSendMessage(cwnd
, DFM_ADDTEXT
, (DF_PARAM
) (*mn
), 0);
38 DfSendMessage(cwnd
, DFM_SHOW_WINDOW
, 0, 0);
41 if ((int) p1
== DF_ID_OK
) {
43 int tl
= DfGetTextLines(cwnd
);
44 for (item
= 0; item
< tl
; item
++)
45 if (DfItemSelected(cwnd
, item
))
46 mn
[item
][0] = DF_LISTSELECTOR
;
52 return DfDefaultWndProc(wnd
, msg
, p1
, p2
);
55 void DfMessageLog(DFWINDOW wnd
)
57 if (DfDialogBox(wnd
, &Log
, TRUE
, LogProc
))
59 if (DfCheckBoxSetting(&Log
, DF_ID_LOGGING
))
61 logfile
= fopen("DFLAT.LOG", "wt");
62 DfSetCommandToggle(&DfMainMenu
, DF_ID_LOG
);
64 else if (logfile
!= NULL
)
68 DfClearCommandToggle(&DfMainMenu
, DF_ID_LOG
);