FS2_Open
Open source remastering of the Freespace 2 engine
outwnd.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on the
6  * source.
7  *
8 */
9 
10 
11 
12 #ifndef NDEBUG
13 
14 #include <windows.h>
15 #include <stdio.h>
16 #include <stdarg.h>
17 #include <string.h>
18 
19 // to disable otherwise well-lodged compiler warning
20 #pragma warning(disable: 4201) // nameless struct/union
21 
22 #include <winioctl.h>
23 #include <conio.h>
24 
25 #include "osapi/osapi.h"
26 #include "osapi/outwnd.h"
27 #include "osapi/monopub.h"
28 #include "graphics/2d.h"
30 #include "globalincs/systemvars.h"
31 #include "cfile/cfilesystem.h"
32 #include "globalincs/globals.h"
33 #include "parse/parselo.h"
34 
35 
36 extern int Cmdline_debug_window;
37 
38 
39 #define SCROLL_BUFFER_SIZE 512
40 #define MAX_LINE_WIDTH 128
41 #define TASKBAR_HEIGHT 30
42 
43 #define ID_COPY 32000
44 #define ID_FIND 32010
45 #define ID_FILTER 32100
46 #define TIMER1 1
47 #define UP_FAST 65537
48 #define DOWN_FAST 65538
49 
52 
54 char szOutputClass[] = "OutputWindow";
57 char find_text[85];
58 
61  bool enabled;
62 };
63 
65 
68 int old_scroll_pos = -32768;
70 bool outwnd_inited = false;
71 bool outwnd_disabled = true;
73 static int marked = 0;
77 int scroll_wait = 1;
81 int find_line = -1, find_pos;
82 
83 // monochrome screen info
84 #define NMONO
85 HANDLE mono_driver=NULL; // handle to the monochrome driver
86 
87 void outwnd_print(const char *id = NULL, const char *temp = NULL);
89 void find_text_in_outwindow(int n, int p);
91 void outwnd_update_marking(LPARAM l_parm, HWND hwnd);
92 void outwnd_paint(HWND hwnd);
93 
94 ubyte Outwnd_no_filter_file = 0; // 0 = .cfg file found, 1 = not found and warning not printed yet, 2 = not found and warning printed
95 
96 // used for file logging
98 FILE *Log_fp = NULL;
99 char *FreeSpace_logfilename = NULL;
100 
102 
103 
104 
105 #ifndef _MSC_VER
106 inline void _outp(unsigned short port, unsigned char value)
107 {
108  asm(
109  "mov %0,%%al;"
110  "mov %1,%%dx;"
111  "out %%al,%%dx;"
112  : : "g" (value), "g" (port) : "al", "dx");
113 }
114 
115 inline unsigned char _inp(unsigned short port)
116 {
117  unsigned char value;
118  asm(
119  "mov %1,%%dx;"
120  "in %%dx,%%al;"
121  "mov %%al,%0"
122  : "=g"(value) : "g" (port) : "al", "dx");
123  return value;
124 }
125 #endif
126 
127 
128 inline void text_hilight(HDC &hdc)
129 {
130  SetBkColor(hdc, RGB(0, 0, 0));
131  SetTextColor(hdc, RGB(255, 255, 255));
132 }
133 
134 inline void text_normal(HDC &hdc)
135 {
136  SetBkColor(hdc, RGB(255, 255, 255));
137  SetTextColor(hdc, RGB(0, 0, 0));
138 }
139 
140 inline void fix_marking_coords(int &x, int &y, LPARAM l_parm)
141 {
142  x = (signed short) LOWORD(l_parm) / nTextWidth;
143  y = ((signed short) HIWORD(l_parm) - client_top_yoffset) / nTextHeight + cur_line_index;
144 
145  if (y < 0)
146  y = x = 0;
147 
148  if (y > SCROLL_BUFFER_SIZE)
149  {
150  y = SCROLL_BUFFER_SIZE;
151  x = 0;
152  }
153 
154  if (x < 0)
155  x = -1;
156 
157  if (x > MAX_LINE_WIDTH)
158  {
159  y++;
160  x = 0; // marks to end of line
161  }
162 }
163 
164 
165 // InvalidateRect(hOutputWnd,NULL,0);
166 
168 {
169  FILE *fp = NULL;
170  char pathname[MAX_PATH_LEN];
171  char inbuf[NAME_LENGTH+4];
172  outwnd_filter_struct new_filter;
173  int z;
174 
176 
177  memset( pathname, 0, sizeof(pathname) );
178  snprintf( pathname, MAX_PATH_LEN, "%s\\%s\\%s", detect_home(), Pathtypes[CF_TYPE_DATA].path, NOX("debug_filter.cfg") );
179 
180  fp = fopen(pathname, "rt");
181 
182  if (!fp) {
184 
185  strcpy_s( new_filter.name, "error" );
186  new_filter.enabled = true;
187  OutwndFilter.push_back( new_filter );
188 
189  strcpy_s( new_filter.name, "general" );
190  new_filter.enabled = true;
191  OutwndFilter.push_back( new_filter );
192 
193  strcpy_s( new_filter.name, "warning" );
194  new_filter.enabled = true;
195  OutwndFilter.push_back( new_filter );
196 
197  return;
198  }
199 
201 
202  while ( fgets(inbuf, NAME_LENGTH+3, fp) ) {
203 
204  if (*inbuf == '+')
205  new_filter.enabled = true;
206  else if (*inbuf == '-')
207  new_filter.enabled = false;
208  else
209  continue; // skip everything else
210 
211  z = strlen(inbuf) - 1;
212  if (inbuf[z] == '\n')
213  inbuf[z] = 0;
214 
215  Assert( strlen(inbuf+1) < NAME_LENGTH );
216  strcpy_s(new_filter.name, inbuf + 1);
217 
218  if ( !stricmp(new_filter.name, "error") ) {
219  new_filter.enabled = true;
220  } else if ( !stricmp(new_filter.name, "general") ) {
221  new_filter.enabled = true;
222  } else if ( !stricmp(new_filter.name, "warning") ) {
223  new_filter.enabled = true;
224  }
225 
226  OutwndFilter.push_back( new_filter );
227  }
228 
229  if ( ferror(fp) && !feof(fp) )
230  nprintf(("Error", "Error reading \"%s\"\n", pathname));
231 
232  fclose(fp);
233 }
234 
236 {
237  FILE *fp = NULL;
238  char pathname[MAX_PATH_LEN];
239 
240  if ( !outwnd_filter_loaded )
241  return;
242 
244  return; // No file, don't save
245 
246 
247  memset( pathname, 0, sizeof(pathname) );
248  snprintf( pathname, MAX_PATH_LEN, "%s\\%s\\%s", detect_home(), Pathtypes[CF_TYPE_DATA].path, NOX("debug_filter.cfg") );
249 
250  fp = fopen(pathname, "wt");
251 
252  if (fp) {
253  for (uint i = 0; i < OutwndFilter.size(); i++)
254  fprintf(fp, "%c%s\n", OutwndFilter[i].enabled ? '+' : '-', OutwndFilter[i].name);
255 
256  fclose(fp);
257  }
258 }
259 
260 void outwnd_printf2(const char *format, ...)
261 {
263  va_list args;
264 
265  if (format == NULL)
266  return;
267 
268  va_start(args, format);
269  vsprintf(temp, format, args);
270  va_end(args);
271 
272  outwnd_print("General", temp.c_str());
273 }
274 
275 #ifndef NMONO
276 char mono_ram[80*25*2];
277 int mono_x, mono_y;
278 int mono_found = 0;
279 
280 void mono_flush()
281 {
282  if ( !mono_found ) return;
283  memcpy( (void *)0xb0000, mono_ram, 80*25*2 );
284 }
285 
286 void mono_init()
287 {
288  int i;
289 
290  OSVERSIONINFO ver;
291 
292  ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
293  GetVersionEx(&ver);
294  if ( ver.dwPlatformId == VER_PLATFORM_WIN32_NT ) {
295  mono_found = 0;
296  return;
297  }
298 
299  _outp( 0x3b4, 0x0f );
300  _outp( 0x3b4+1, 0x55 );
301 
302  if ( _inp( 0x3b4+1 ) == 0x55 ) {
303  mono_found = 1;
304  _outp( 0x3b4+1, 0 );
305  } else {
306  mono_found = 0;
307  return;
308  }
309 
310 
311  for (i=0; i<80*25; i++ ) {
312  mono_ram[i*2+0] = ' ';
313  mono_ram[i*2+1] = 0x07;
314  }
315  mono_flush();
316  mono_x = mono_y = 0;
317 }
318 
319 
320 void mono_print( char * text, int len )
321 {
322  int i, j;
323 
324  if ( !mono_found )
325  return;
326 
327 
328  for (i=0; i<len; i++ ) {
329  int scroll_it = 0;
330 
331  switch( text[i] ) {
332  case '\n':
333  scroll_it = 1;
334  break;
335  default:
336  mono_ram[mono_y*160+mono_x*2] = text[i];
337  if ( mono_x < 79 ) {
338  mono_x++;
339  } else {
340  scroll_it = 1;
341  }
342  break;
343  }
344 
345  if ( scroll_it ) {
346  if ( mono_y < 24 ) {
347  mono_y++;
348  mono_x = 0;
349  } else {
350  memmove( mono_ram, mono_ram+160, 80*24*2 );
351  for (j=0; j<80; j++ ) {
352  mono_ram[24*160+j*2] = ' ';
353  }
354  mono_y = 24;
355  mono_x = 0;
356  }
357  }
358  }
359  mono_flush();
360 }
361 #endif // NMONO
362 
363 
364 void outwnd_printf(const char *id, const char *format, ...)
365 {
367  va_list args;
368 
369  if ( (id == NULL) || (format == NULL) )
370  return;
371 
372  va_start(args, format);
373  vsprintf(temp, format, args);
374  va_end(args);
375 
376  outwnd_print(id, temp.c_str());
377 }
378 
379 void outwnd_print(const char *id, const char *tmp)
380 {
381  const char *sptr;
382  char *dptr;
383  int nrows, ccol;
384  uint i;
385 
386  if ( (id == NULL) || (tmp == NULL) )
387  return;
388 
389  if ( !outwnd_inited )
390  return;
391 
392  if (Outwnd_no_filter_file == 1) {
394 
395  outwnd_print( "general", "==========================================================================\n" );
396  outwnd_print( "general", "DEBUG SPEW: No debug_filter.cfg found, so only general, error, and warning\n" );
397  outwnd_print( "general", "categories can be shown and no debug_filter.cfg info will be saved.\n" );
398  outwnd_print( "general", "==========================================================================\n" );
399  }
400 
401  uint outwnd_size = OutwndFilter.size();
402 
403  for (i = 0; i < OutwndFilter.size(); i++) {
404  if ( !stricmp(id, OutwndFilter[i].name) )
405  break;
406  }
407 
408  // id found that isn't in the filter list yet
409  if ( i == outwnd_size ) {
410  // Only create new filters if there was a filter file
412  return;
413 
414  Assert( strlen(id)+1 < NAME_LENGTH );
415  outwnd_filter_struct new_filter;
416 
417  strcpy_s(new_filter.name, id);
418  new_filter.enabled = true;
419 
420  OutwndFilter.push_back( new_filter );
422  }
423 
424  if ( !OutwndFilter[i].enabled )
425  return;
426 
428  if (Log_fp != NULL) {
429  fputs(tmp, Log_fp);
430  fflush(Log_fp);
431  }
432  }
433 
434  if ( !Cmdline_debug_window )
435  return;
436 
437  // everything after this point relates to printing in the debug window
438 
439  if (mprintf_last_line == -1 ) {
440  for (i=0; i<SCROLL_BUFFER_SIZE;i++) {
441  outtext[i][0] = 0;
442  }
443 
444  mprintf_last_line = 0;
445  }
446 
447  // printf out to the monochrome screen first
448  if ( mono_driver != ((HANDLE)-1) ) {
449  DWORD cbReturned;
450 
451  DeviceIoControl (mono_driver, (DWORD)IOCTL_MONO_PRINT, const_cast<char*>(tmp), strlen(tmp), NULL, 0, &cbReturned, 0 );
452 #ifndef NMONO
453  } else {
454  mono_print(tmp, strlen(tmp) );
455 #endif
456  }
457 
458  sptr = tmp;
459  ccol = strlen(outtext[mprintf_last_line] );
460  dptr = &outtext[mprintf_last_line][ccol];
461  nrows = 0;
462 
463  while(*sptr) {
464  if ( (*sptr == '\n') || (ccol >= MAX_LINE_WIDTH-1 ) ) {
465  nrows++;
466  mprintf_last_line++;
467  if (mprintf_last_line >= SCROLL_BUFFER_SIZE )
468  mprintf_last_line = 0;
469  ccol = 0;
470  if ( *sptr != '\n' ) {
471  outtext[mprintf_last_line][ccol] = *sptr;
472  ccol++;
473  }
474  outtext[mprintf_last_line][ccol] = '\0';
475  dptr = &outtext[mprintf_last_line][ccol];
476  } else {
477  *dptr++ = *sptr;
478  *dptr = '\0';
479  ccol++;
480  }
481  sptr++;
482  }
483 
484  if (outwnd_disabled)
485  return;
486 
487  if ( !OutputActive ) {
488  int oldpos = GetScrollPos( hOutputWnd, SB_VERT );
489  if ( oldpos != max_scroll_pos ) {
490  SCROLLINFO si;
491  si.cbSize = sizeof(SCROLLINFO);
492  si.fMask = SIF_POS;
493  si.nPos = max_scroll_pos;
494  SetScrollInfo(hOutputWnd, SB_VERT, &si, 1 );
495  InvalidateRect(hOutputWnd,NULL,0);
496  UpdateWindow(hOutputWnd);
497  } else {
498  if ( nrows ) {
499  RECT client;
500  ScrollWindow(hOutputWnd,0,-nTextHeight*nrows,NULL,NULL);
501  GetClientRect(hOutputWnd, &client);
502  client.top = client.bottom - nTextHeight*(nrows+1);
503  InvalidateRect(hOutputWnd,&client,0);
504 
505  UpdateWindow(hOutputWnd);
506  } else {
507  Outwnd_changed++;
508  }
509  }
510  }
511 }
512 
514 {
515  switch(msg) {
516  case WM_ACTIVATEAPP:
517  // The application z-ordering has change
518  // foreground application wParm will be
519  OutputActive = (BOOL)wParam;
520  break;
521 
522  case WM_CREATE: {
523  SCROLLINFO si;
524  si.cbSize = sizeof(SCROLLINFO);
525  si.fMask = SIF_RANGE | SIF_POS;
526  si.nMin = 0;
527  si.nMax = max_scroll_pos;
528  si.nPos = max_scroll_pos;
529  SetScrollInfo(hwnd, SB_VERT, &si, 1 );
530  }
531  break;
532 
533  case WM_TIMER:
534  if (scroll_wait)
535  PostMessage(hwnd, WM_MOUSEMOVE, 0, last_mousemove);
536 
537  if ( Outwnd_changed ) {
538  RECT client;
539  GetClientRect(hOutputWnd, &client);
540  client.top = client.bottom - nTextHeight;
541  InvalidateRect(hOutputWnd,&client,0);
542  }
543 
544  scroll_wait = 0;
545  break;
546 
547  case WM_COMMAND: {
548  int z;
549 
550  z = LOWORD(wParam);
551  if (z >= ID_FILTER && z < ID_FILTER + (int)OutwndFilter.size())
552  {
553  z -= ID_FILTER;
554  OutwndFilter[z].enabled = !OutwndFilter[z].enabled;
555 
556  if ( !stricmp( OutwndFilter[z].name, "error" ) ) {
557  OutwndFilter[z].enabled = 1;
558  } else if ( !stricmp( OutwndFilter[z].name, "general" ) ) {
559  OutwndFilter[z].enabled = 1;
560  } else if ( !stricmp( OutwndFilter[z].name, "warning" ) ) {
561  OutwndFilter[z].enabled = 1;
562  }
564  break;
565  }
566 
567  switch (z)
568  {
569  case ID_COPY:
571  break;
572 
573  /*
574  case ID_FIND:
575  if (DialogBox(GetModuleHandle(NULL), "FIND_DIALOG", hOutputWnd,
576  (int (__stdcall *)(void)) find_dlg_handler) == IDOK)
577  {
578  find_text_in_outwindow(mprintf_last_line, 0);
579  }
580 
581  break;
582  */
583  }
584  break;
585  }
586 
587  case WM_RBUTTONDOWN: {
588  HMENU h_menu = CreatePopupMenu();
589  HMENU h_sub_menu = CreatePopupMenu();
590  POINT pt;
591 
592  for (uint i = 0; i < OutwndFilter.size(); i++) {
593  UINT flags = MFT_STRING; //MF_GRAYED;
594 
595  if ( !stricmp( OutwndFilter[i].name, "error" ) ) {
596  flags |= MF_GRAYED;
597  } else if ( !stricmp( OutwndFilter[i].name, "general" ) ) {
598  flags |= MF_GRAYED;
599  } else if ( !stricmp( OutwndFilter[i].name, "warning" ) ) {
600  flags |= MF_GRAYED;
601  }
602 
603  if (OutwndFilter[i].enabled)
604  AppendMenu(h_sub_menu, flags | MF_CHECKED, ID_FILTER + i, OutwndFilter[i].name);
605  else
606  AppendMenu(h_sub_menu, flags, ID_FILTER + i, OutwndFilter[i].name);
607  }
608 
609  AppendMenu(h_menu, MFT_STRING, ID_COPY, "&Copy\tEnter");
610  AppendMenu(h_menu, MFT_STRING, ID_FIND, "&Find Text");
611  AppendMenu(h_menu, MF_POPUP, (unsigned int) h_sub_menu, "Filter &Messages");
612  pt.x = LOWORD(lParam);
613  pt.y = HIWORD(lParam);
614  ClientToScreen(hwnd, &pt);
615 
616  TrackPopupMenu(h_menu, 0, pt.x, pt.y, 0, hwnd, NULL);
617  DestroyMenu(h_menu);
618  break;
619  }
620 
621  case WM_LBUTTONDOWN:
623  SetCapture(hwnd); // monopolize mouse
624  marking_active = 1;
625  outwnd_update_marking(lParam, hwnd);
626  break;
627 
628  case WM_MOUSEMOVE:
630  if (marking_active){
631  outwnd_update_marking(lParam, hwnd);
632  }
633  break;
634 
635  case WM_LBUTTONUP:
636  if (marking_active)
637  {
638  ReleaseCapture();
639  marking_active = 0;
640  outwnd_update_marking(lParam, hwnd);
641  }
642  break;
643 
644  case WM_VSCROLL: {
645  SCROLLINFO si;
646  int vpos = GetScrollPos( hwnd, SB_VERT );
647  int old_vpos=vpos;
648  switch (LOWORD(wParam)) {
649  case SB_LINEDOWN:
650  vpos++;
651  break;
652  case SB_LINEUP:
653  vpos--;
654  break;
655  case SB_THUMBPOSITION:
656  vpos = HIWORD(wParam);
657  break;
658  case SB_THUMBTRACK:
659  vpos = HIWORD(wParam);
660  break;
661  case SB_PAGEDOWN:
662  vpos += nCharRows;
663  break;
664  case SB_PAGEUP:
665  vpos -= nCharRows;
666  break;
667  }
668  if ( vpos < 0 ) vpos = 0;
669  else if ( vpos > max_scroll_pos ) vpos = max_scroll_pos;
670  si.cbSize = sizeof(SCROLLINFO);
671  si.fMask = SIF_POS;
672  si.nPos = vpos;
673  SetScrollInfo(hwnd, SB_VERT, &si, 1 );
674  ScrollWindow(hwnd,0,(old_vpos-vpos)*nTextHeight,NULL,NULL);
675  UpdateWindow(hOutputWnd);
676  //InvalidateRect(hOutputWnd,NULL,0);
677  }
678  break;
679 
680  case WM_KEYDOWN: {
681  SCROLLINFO si;
682  int vpos = GetScrollPos( hwnd, SB_VERT );
683  int old_vpos=vpos;
684  int nVirtKey = (int) wParam; // virtual-key code
685  switch(nVirtKey) {
686  case VK_DOWN:
687  case VK_RIGHT:
688  vpos++;
689  break;
690  case VK_UP:
691  case VK_LEFT:
692  vpos--;
693  break;
694  case VK_NEXT:
695  vpos += nCharRows;
696  break;
697  case VK_PRIOR:
698  vpos -= nCharRows;
699  break;
700  case VK_END:
701  vpos = 0;
702  break;
703  case VK_HOME:
704  vpos = max_scroll_pos;
705  break;
706  case VK_RETURN:
708  break;
709  case UP_FAST: // special value we define
710  vpos -= 5;
711  break;
712  case DOWN_FAST: // special value we define
713  vpos += 5;
714  break;
715  }
716 
717  if ( vpos < 0 ) vpos = 0;
718  else if ( vpos > max_scroll_pos ) vpos = max_scroll_pos;
719  si.cbSize = sizeof(SCROLLINFO);
720  si.fMask = SIF_POS;
721  si.nPos = vpos;
722  SetScrollInfo(hwnd, SB_VERT, &si, 1 );
723  ScrollWindow(hwnd, 0, (old_vpos-vpos)*nTextHeight, NULL, NULL);
724  UpdateWindow(hOutputWnd);
725  //InvalidateRect(hOutputWnd,NULL,0);
726  }
727  break;
728 
729  case WM_SIZE:
730  InvalidateRect(hOutputWnd,NULL,0);
731  break;
732 
733  case WM_PAINT:
734  outwnd_paint(hwnd);
735  break;
736 
737  case WM_DESTROY:
738  outwnd_disabled = true;
739  PostQuitMessage(0);
740  break;
741 
742  default:
743  return DefWindowProc(hwnd, msg, wParam, lParam);
744  break;
745  }
746 
747  return 0;
748 }
749 
751 {
752  HGLOBAL h_text;
753  int i, size = 1;
754  char *ptr;
755 
756  if (marked_top == marked_bottom)
757  {
758  size += marked_right - marked_left;
759 
760  } else {
761  i = marked_top;
762  size += strlen(outtext[i++]) - marked_left + 2;
763 
764  while (i < marked_bottom)
765  size += strlen(outtext[i++]) + 2;
766 
767  size += marked_right;
768  }
769 
770  h_text = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, size);
771  ptr = (char *) GlobalLock(h_text);
772 
773  if (marked_top == marked_bottom)
774  {
776  memcpy(ptr, outtext[marked_top] + marked_left, i);
777  ptr[i] = 0;
778 
779  } else {
780  i = marked_top;
781  strcpy(ptr, outtext[i] + marked_left);
782  strcat(ptr, "\r\n");
783  i++;
784 
785  while (i < marked_bottom)
786  {
787  strcat(ptr, outtext[i++]);
788  strcat(ptr, "\r\n");
789  }
790 
791  ptr[strlen(ptr) + marked_right] = 0;
792  strncat(ptr, outtext[i], marked_right);
793  }
794 
795  GlobalUnlock(h_text);
796  OpenClipboard(hwnd);
797  EmptyClipboard();
798  SetClipboardData(CF_TEXT, h_text);
799  CloseClipboard();
800 
801  marked = 0;
802  InvalidateRect(hwnd, NULL, 0);
803 }
804 
805 void outwnd_paint(HWND hwnd)
806 {
807  int i, n, x, y, len;
808  int old_nrows, scroll_pos;
809  HDC hdc;
810  PAINTSTRUCT ps;
811  RECT client;
812  TEXTMETRIC tm;
813  HFONT newfont, oldfont;
814  HBRUSH newbrush, oldbrush;
815 
816  Outwnd_changed = 0;
817 
818  hdc = BeginPaint(hwnd, &ps);
819  GetClientRect(hOutputWnd, &client);
820  newfont = (HFONT)GetStockObject(ANSI_FIXED_FONT);
821  oldfont = (HFONT)SelectObject(hdc,newfont);
822 
823  GetTextMetrics(hdc, &tm);
824  nTextHeight = tm.tmHeight + tm.tmExternalLeading;
825  nTextWidth = tm.tmAveCharWidth;
826  old_nrows = nCharRows;
827  nCharRows = ((client.bottom-client.top)/nTextHeight)+1;
828 
829  newbrush = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
830  oldbrush = (HBRUSH)SelectObject(hdc,newbrush);
831 
832  y = client.bottom - nTextHeight * nCharRows; // starting y position at top
834  scroll_pos = (max_scroll_pos - GetScrollPos( hOutputWnd, SB_VERT ));
835  cur_line_index = x = mprintf_last_line - scroll_pos - nCharRows;
836  if (x >= marked_top && x < marked_bottom) // starting in marked area
837  text_hilight(hdc);
838  else
839  text_normal(hdc);
840  if (scroll_pos != old_scroll_pos) {
841  if (!scroll_pos) {
842  char tmp[1024];
843  sprintf( tmp, "Debug Spew");
844  SetWindowText( hOutputWnd, tmp );
845 
846  } else {
847  char tmp[1024];
848  sprintf( tmp, "Debug Spew [Scrolled back %d lines]", scroll_pos );
849  SetWindowText( hOutputWnd, tmp );
850  }
851 
852  old_scroll_pos = scroll_pos;
853  }
854 
855  i = nCharRows;
856  while (i--)
857  {
858  n = mprintf_last_line - scroll_pos - i;
859  if (n < 0)
860  n += SCROLL_BUFFER_SIZE;
861 
862  if (n >= 0 && n < SCROLL_BUFFER_SIZE)
863  {
864  len = strlen(outtext[n]);
865  if (marked)
866  {
867  if (n == marked_top && n == marked_bottom) // special 1 line case
868  {
869  if (marked_left)
870  TextOut(hdc, 0, y, outtext[n], marked_left);
871 
872  text_hilight(hdc);
873  x = marked_left * nTextWidth;
874  TextOut(hdc, x, y, outtext[n] + marked_left, marked_right -
875  marked_left);
876 
877  text_normal(hdc);
878  x = marked_right * nTextWidth;
879  if (marked_right < len)
880  TextOut(hdc, x, y, outtext[n] + marked_right, len - marked_right);
881 
882  x = len * nTextWidth;
883  TextOut(hdc, x, y, spaces, MAX_LINE_WIDTH - len);
884 
885  } else if (n == marked_top) { // start marked on this line
886  if (marked_left)
887  TextOut(hdc, 0, y, outtext[n], marked_left);
888 
889  text_hilight(hdc);
890  x = marked_left * nTextWidth;
891 
892  TextOut(hdc, x, y, outtext[n] + marked_left, len - marked_left);
893 
894  x = len * nTextWidth;
896  TextOut(hdc, x, y, spaces, MAX_LINE_WIDTH - marked_left);
897 
898  } else if (n == marked_bottom) { // end marked on this line
899  if (marked_right)
900  TextOut(hdc, 0, y, outtext[n], marked_right);
901 
902  text_normal(hdc);
903  x = marked_right * nTextWidth;
904  if (marked_right < len)
905  TextOut(hdc, x, y, outtext[n] + marked_right, len - marked_right);
906 
907  x = len * nTextWidth;
908  TextOut(hdc, x, y, spaces, MAX_LINE_WIDTH - len);
909 
910  } else { // whole line marked
911  TextOut(hdc, 0, y, outtext[n], len);
912  x = len * nTextWidth;
913  TextOut(hdc, x, y, spaces, MAX_LINE_WIDTH - len);
914  }
915 
916  } else {
917  TextOut(hdc, 0, y, outtext[n], len);
918  x = len * nTextWidth;
919  TextOut(hdc, x, y, spaces, MAX_LINE_WIDTH - len);
920  }
921  } else
922  TextOut(hdc, 0, y, spaces, MAX_LINE_WIDTH);
923 
924  y += nTextHeight;
925  }
926 
927  text_normal(hdc);
928  SelectObject(hdc, oldfont);
929  SelectObject(hdc, oldbrush);
930  DeleteObject(newbrush);
931 
932  if ( old_nrows != nCharRows ) {
933  SCROLLINFO si;
934  max_scroll_pos = SCROLL_BUFFER_SIZE-nCharRows - 1;
935  si.cbSize = sizeof(SCROLLINFO);
936  si.fMask = SIF_RANGE;
937  si.nMin = 0;
938  si.nMax = max_scroll_pos;
939  SetScrollInfo(hwnd, SB_VERT, &si, 1 );
940  }
941 
942  EndPaint(hwnd, &ps);
943 
944 }
945 
947 {
948  int x, y;
949  RECT rect;
950 
951  if (!scroll_wait) {
952  y = (signed short) HIWORD(l_parm);
953  GetClientRect(hwnd, &rect);
954 
955  if (y < -150) {
956  SendMessage(hwnd, WM_KEYDOWN, UP_FAST, 0);
957  scroll_wait = 1;
958 
959  } else if (y < 0) {
960  SendMessage(hwnd, WM_KEYDOWN, VK_UP, 0);
961  scroll_wait = 1;
962  }
963 
964  if (y >= rect.bottom + 150) {
965  SendMessage(hwnd, WM_KEYDOWN, DOWN_FAST, 0);
966  scroll_wait = 1;
967 
968  } else if (y >= rect.bottom) {
969  SendMessage(hwnd, WM_KEYDOWN, VK_DOWN, 0);
970  scroll_wait = 1;
971  }
972  }
973 
974  fix_marking_coords(x, y, l_parm);
975  marked = 1;
979 
980  if (y < marked_top)
981  {
982  marked_top = y;
983  marked_left = x;
984 
985  } else if (y > marked_bottom) {
986  marked_bottom = y;
987  marked_right = x + 1;
988 
989  } else { // must be single line case
990  if (x < marked_left)
991  marked_left = x;
992  if (x >= marked_right)
993  marked_right = x + 1;
994 
995  if (marked_left >= (signed int) strlen(outtext[y]))
996  {
997  marked = 0; // this isn't going to even show up
998  return;
999  }
1000  }
1001 
1002  if (marked_left >= (signed int) strlen(outtext[marked_top]))
1003  {
1004  marked_top++;
1005  marked_left = 0;
1006  }
1007 
1008  if (marked_right > (signed int) strlen(outtext[marked_bottom]))
1009  marked_right = strlen(outtext[marked_bottom]);
1010 
1011  if (marked && (marked_top > marked_bottom || (marked_top == marked_bottom &&
1013  {
1014  char msg[1024];
1015 
1016  sprintf(msg, "Marking limits invalid!\n"
1017  "(%d,%d) to (%d,%d)", marked_left, marked_top, marked_right, marked_bottom);
1018 
1019  MessageBox(hwnd, msg, "Error", MB_OK | MB_ICONERROR);
1020  marked = 0;
1021  }
1022 
1023  if (marked != old_marked || marked_top != old_marked_top || marked_bottom !=
1026  {
1027  old_marked = marked;
1032  InvalidateRect(hwnd, NULL, 0);
1033  }
1034 }
1035 
1036 BOOL outwnd_create(int display_under_freespace_window)
1037 {
1038  WNDCLASSEX wclass;
1039  HINSTANCE hInst = GetModuleHandle(NULL);
1040  RECT rect;
1041  DWORD style;
1042 
1043  wclass.hInstance = hInst;
1044  wclass.lpszClassName = szOutputClass;
1045  wclass.lpfnWndProc = (WNDPROC) outwnd_handler;
1046  wclass.style = CS_BYTEALIGNCLIENT | CS_OWNDC; //CS_DBLCLKS | CS_PARENTDC| CS_VREDRAW | CS_HREDRAW |;
1047  wclass.cbSize = sizeof(WNDCLASSEX);
1048  wclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
1049  wclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
1050  wclass.hCursor = LoadCursor(NULL, IDC_ARROW);
1051  wclass.lpszMenuName = NULL; //"FreeSpaceMenu";
1052  wclass.cbClsExtra = 0;
1053  wclass.cbWndExtra = 0;
1054  wclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); //(HBRUSH)NULL;
1055 
1056  if (!RegisterClassEx(&wclass))
1057  return FALSE;
1058 
1059  if (display_under_freespace_window) {
1060  style = WS_OVERLAPPEDWINDOW;
1061 
1062  RECT client_rect;
1063  client_rect.left = client_rect.top = 0;
1064  client_rect.right = 640;
1065  client_rect.bottom = 480;
1066  AdjustWindowRect(&client_rect,WS_CAPTION | WS_SYSMENU,FALSE);
1067 
1068  int _x = (GetSystemMetrics( SM_CXSCREEN )-(client_rect.right - client_rect.left))/2;
1069  int _y = 0;
1070  if ( _x < 0 ) _x = 0;
1071 
1072  rect.left = _x;
1073  rect.top = _y;
1074  rect.right = _x + client_rect.right - client_rect.left - 1;
1075  rect.bottom = _y + client_rect.bottom - client_rect.top - 1;
1076 
1077  if(!Is_standalone){
1078  rect.top = rect.bottom;
1079  rect.bottom = GetSystemMetrics(SM_CYSCREEN) - TASKBAR_HEIGHT - rect.top;
1080  rect.right -= rect.left;
1081  } else {
1082  rect.left += 350;
1083  rect.right = 550;
1084  rect.bottom = 400;
1085  }
1086  } else {
1087  style = WS_OVERLAPPEDWINDOW | WS_MINIMIZE;
1088  rect.top = rect.bottom = rect.left = rect.right = CW_USEDEFAULT;
1089  }
1090 
1091  // Create Game Window
1092  hOutputWnd = CreateWindow(szOutputClass, "Debug Spew", style, rect.left,
1093  rect.top, rect.right, rect.bottom, NULL, NULL, hInst, NULL);
1094 
1095  // Show it, but don't activate it. If you activate it, it cause problems
1096  // with fullscreen startups in main window.
1097  SetWindowPos( hOutputWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_SHOWWINDOW );
1098 
1099  outwnd_disabled = false;
1100  SetTimer(hOutputWnd, TIMER1, 50, NULL);
1101  for (int i=0; i<MAX_LINE_WIDTH; i++)
1102  spaces[i] = ' ';
1103 
1104  spaces[MAX_LINE_WIDTH] = 0;
1105  return TRUE;
1106 }
1107 
1108 DWORD outwnd_thread(int display_under_freespace_window)
1109 {
1110  MSG msg;
1111 
1112  if (!outwnd_create(display_under_freespace_window))
1113  return 0;
1114 
1115  while (1) {
1116  if (WaitMessage()) {
1117  while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
1118  TranslateMessage(&msg);
1119  DispatchMessage(&msg);
1120  }
1121  }
1122 
1123  if (outwnd_disabled) break;
1124  }
1125  return 0;
1126 }
1127 
1129 {
1130 // DeviceIoControl (mono_driver, (DWORD) IOCTL_MONO_CLEAR_SCREEN, NULL, 0, NULL, 0, &cbReturned, 0);
1131  if (hOutputThread) {
1132  CloseHandle(hOutputThread);
1133  hOutputThread = NULL;
1134  }
1135 
1136  if (mono_driver) {
1137  CloseHandle(mono_driver);
1138  mono_driver = NULL;
1139  }
1140 }
1141 
1142 void outwnd_init_debug_window(int display_under_freespace_window)
1143 {
1144  static bool debug_window_inited = false;
1145 
1146  if ( !Cmdline_debug_window || !outwnd_inited || debug_window_inited )
1147  return;
1148 
1149  hOutputThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)outwnd_thread, (LPVOID)display_under_freespace_window, 0, &OutputThreadID);
1150  //SetThreadPriority(hOutputThread, THREAD_PRIORITY_TIME_CRITICAL);
1151 
1152 #ifndef NMONO
1153  // set up the monochrome drivers
1154  if ( (mono_driver = CreateFile("\\\\.\\MONO", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == ((HANDLE)-1)) {
1155  outwnd_printf2("Cannot get handle to monochrome driver.\n");
1156  mono_init();
1157  }
1158 
1159  atexit(close_mono);
1160 #endif
1161 
1162  debug_window_inited = true;
1163 }
1164 
1165 void outwnd_init(int display_under_freespace_window)
1166 {
1167  if (outwnd_inited)
1168  return;
1169 /*
1170  if (Cmdline_debug_window) {
1171  hOutputThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)outwnd_thread, (LPVOID)display_under_freespace_window, 0, &OutputThreadID);
1172  //SetThreadPriority(hOutputThread, THREAD_PRIORITY_TIME_CRITICAL);
1173 #ifndef NMONO
1174  // set up the monochrome drivers
1175  if ( (mono_driver = CreateFile("\\\\.\\MONO", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == ((HANDLE)-1)) {
1176  outwnd_printf2("Cannot get handle to monochrome driver.\n");
1177  mono_init();
1178  }
1179 
1180  atexit(close_mono);
1181 #endif
1182  }
1183 */
1184  if (Log_fp == NULL) {
1185  char pathname[MAX_PATH_LEN];
1186 
1187  /* Set where the log file is going to go */
1188  // Zacam: Set various conditions based on what type of log to generate.
1189  if (Fred_running) {
1190  FreeSpace_logfilename = "fred2_open.log";
1191  } else if (Is_standalone) {
1192  FreeSpace_logfilename = "fs2_standalone.log";
1193  } else {
1194  FreeSpace_logfilename = "fs2_open.log";
1195  }
1196 
1197  memset( pathname, 0, sizeof(pathname) );
1198  snprintf(pathname, MAX_PATH_LEN-1, "%s\\%s\\%s", detect_home(), Pathtypes[CF_TYPE_DATA].path, FreeSpace_logfilename);
1199 
1200  Log_fp = fopen(pathname, "wb");
1201 
1202  if (Log_fp == NULL) {
1203  outwnd_printf("Error", "Error opening %s\n", pathname);
1204  } else {
1205  time_t timedate = time(NULL);
1206  char datestr[50];
1207 
1208  memset( datestr, 0, sizeof(datestr) );
1209  strftime( datestr, sizeof(datestr)-1, "%a %b %d %H:%M:%S %Y", localtime(&timedate) );
1210 
1211  outwnd_printf("General", "Opened log '%s', %s ...\n", pathname, datestr);
1212  }
1213  }
1214 
1215  outwnd_inited = true;
1216 }
1217 
1219 {
1220  switch (msg)
1221  {
1222  case WM_COMMAND:
1223  switch (LOWORD(wParam)) {
1224  case IDOK:
1225  GetDlgItemText(hwnd, IDC_TEXT, find_text, 82); // get the text to find
1226  EndDialog(hwnd, IDOK);
1227  return 1;
1228 
1229  case IDCANCEL:
1230  EndDialog(hwnd, 0);
1231  return 1;
1232  }
1233  break;
1234 
1235  case WM_INITDIALOG:
1236  SendDlgItemMessage(hwnd, IDC_TEXT, EM_LIMITTEXT, 80, 0); // limit text to 80 chars
1237  if (GetDlgCtrlID((HWND) wParam) != IDC_TEXT) {
1238  SetFocus(GetDlgItem(hwnd, IDC_TEXT));
1239  return FALSE;
1240  }
1241 
1242  return TRUE;
1243  }
1244 
1245  return 0;
1246 }
1247 
1249 {
1250  char *ptr, *str;
1251 
1252  str = outtext[n] + p;
1253  while (1)
1254  {
1255  ptr = strstr(str, find_text);
1256  if (ptr)
1257  {
1258  int scroll_pos, pos;
1259 
1260  find_pos = ptr - str;
1261  find_line = n;
1262  marked = 1;
1265  marked_right = find_pos + strlen(find_text);
1266 
1267  scroll_pos = (max_scroll_pos - GetScrollPos(hOutputWnd, SB_VERT));
1268  pos = mprintf_last_line - scroll_pos;
1269  if (pos < 0)
1270  pos += SCROLL_BUFFER_SIZE;
1271 
1272  pos -= n;
1273  if (pos < 0)
1274  pos += SCROLL_BUFFER_SIZE;
1275 
1276  Assert(pos >= 0);
1277  if (pos >= nCharRows - 1) // outside of window viewport, so scroll
1278  {
1279  SCROLLINFO si;
1280 
1281  pos = mprintf_last_line - n - nCharRows / 2;
1282  if (pos < 0)
1283  pos += SCROLL_BUFFER_SIZE;
1284 
1285  if (pos > max_scroll_pos)
1286  pos = max_scroll_pos;
1287 
1288  scroll_pos = max_scroll_pos - GetScrollPos(hOutputWnd, SB_VERT);
1289  si.cbSize = sizeof(SCROLLINFO);
1290  si.fMask = SIF_POS;
1291  si.nPos = max_scroll_pos - pos;
1292  SetScrollInfo(hOutputWnd, SB_VERT, &si, 1);
1293  ScrollWindow(hOutputWnd, 0, (scroll_pos - pos) * nTextHeight, NULL, NULL);
1294  }
1295 
1296  InvalidateRect(hOutputWnd, NULL, 0);
1297  UpdateWindow(hOutputWnd);
1298  return;
1299  }
1300 
1301  n--;
1302  if (n < 0)
1303  n += SCROLL_BUFFER_SIZE;
1304 
1305  if (n == mprintf_last_line)
1306  {
1307  MessageBox(hOutputWnd, "Search text not found", "Find Error", MB_OK | MB_ICONERROR);
1308  find_line = -1;
1309  return;
1310  }
1311 
1312  str = outtext[n];
1313  }
1314 }
1315 
1317 {
1318  if ( Log_fp != NULL ) {
1319  time_t timedate = time(NULL);
1320  char datestr[50];
1321 
1322  memset( datestr, 0, sizeof(datestr) );
1323  strftime( datestr, sizeof(datestr)-1, "%a %b %d %H:%M:%S %Y", localtime(&timedate) );
1324 
1325  outwnd_printf("General", "... Log closed, %s\n", datestr);
1326 
1327  fclose(Log_fp);
1328  Log_fp = NULL;
1329  }
1330 
1331  outwnd_inited = false;
1332 }
1333 
1334 void safe_point_print(const char *format, ...)
1335 {
1336  SCP_string temp;
1337  va_list args;
1338 
1339  va_start(args, format);
1340  vsprintf(temp, format, args);
1341  va_end(args);
1342 
1343  safe_string = temp;
1344 }
1345 
1346 void safe_point(const char *file, int line, const char *format, ...)
1347 {
1348  safe_point_print("last safepoint: %s, %d; [%s]", file, line, format);
1349 }
1350 
1351 #endif //NDEBUG
GLenum GLsizei GLenum format
Definition: Gl.h:1509
int marking_started_y
Definition: outwnd.cpp:76
void * HWND
Definition: config.h:104
char * FreeSpace_logfilename
Definition: outwnd.cpp:99
int i
Definition: multi_pxo.cpp:466
void outwnd_copy_marked_selection(HWND hwnd)
Definition: outwnd.cpp:750
ubyte outwnd_filter_loaded
Definition: outwnd.cpp:56
int Log_debug_output_to_file
Definition: outwnd.cpp:97
int marking_active
Definition: outwnd.cpp:76
void outwnd_init(int display_under_freespace_window)
Definition: outwnd.cpp:1165
Definition: config.h:286
int old_marked_right
Definition: outwnd.cpp:75
GLsizei const GLfloat * value
Definition: Glext.h:5646
int find_pos
Definition: outwnd.cpp:81
int Fred_running
Definition: fred.cpp:44
void find_text_in_outwindow(int n, int p)
Definition: outwnd.cpp:1248
#define ID_FILTER
Definition: outwnd.cpp:45
Assert(pm!=NULL)
void safe_point(const char *file, int line, const char *format,...)
Definition: outwnd.cpp:1346
void * HINSTANCE
Definition: config.h:105
bool outwnd_disabled
Definition: outwnd.cpp:71
#define DOWN_FAST
Definition: outwnd.cpp:48
int client_top_yoffset
Definition: outwnd.cpp:76
#define TRUE
Definition: pstypes.h:399
DWORD outwnd_thread(int display_under_freespace_window)
Definition: outwnd.cpp:1108
void outwnd_printf2(const char *format,...)
Definition: outwnd.cpp:260
UINT WPARAM wParam
Definition: msacm.h:1064
HWND hOutputWnd
Definition: outwnd.cpp:53
#define IDC_TEXT
Definition: resource.h:771
UINT WPARAM LPARAM lParam
Definition: msacm.h:1064
unsigned int UINT
Definition: config.h:82
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
Definition: vmallocator.h:21
DWORD OutputThreadID
Definition: outwnd.cpp:51
void outwnd_close()
Definition: outwnd.cpp:1316
const char * detect_home(void)
Definition: osapi.cpp:101
GLsizeiptr size
Definition: Glext.h:5496
BOOL CALLBACK find_dlg_handler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: outwnd.cpp:1218
void text_hilight(HDC &hdc)
Definition: outwnd.cpp:128
FILE * Log_fp
Definition: outwnd.cpp:98
long LPARAM
Definition: config.h:101
int nTextHeight
Definition: outwnd.cpp:69
void _outp(unsigned short port, unsigned char value)
Definition: outwnd.cpp:106
#define SCROLL_BUFFER_SIZE
Definition: outwnd.cpp:39
int scroll_wait
Definition: outwnd.cpp:77
void save_filter_info(void)
Definition: outwnd.cpp:235
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
char find_text[85]
Definition: outwnd.cpp:57
void outwnd_update_marking(LPARAM l_parm, HWND hwnd)
Definition: outwnd.cpp:946
unsigned int uint
Definition: pstypes.h:64
void outwnd_print(const char *id=NULL, const char *temp=NULL)
Definition: outwnd.cpp:379
int mprintf_last_line
Definition: outwnd.cpp:66
void vsprintf(SCP_string &dest, const char *format, va_list ap)
Definition: parselo.cpp:3800
#define nprintf(args)
Definition: pstypes.h:239
bool outwnd_inited
Definition: outwnd.cpp:70
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: Glext.h:7307
cf_pathtype Pathtypes[CF_MAX_PATH_TYPES]
Definition: cfile.cpp:49
int find_line
Definition: outwnd.cpp:81
sprintf(buf,"(%f,%f,%f)", v3->xyz.x, v3->xyz.y, v3->xyz.z)
int marking_started_x
Definition: outwnd.cpp:76
GLdouble GLdouble z
Definition: Glext.h:5451
#define ID_FIND
Definition: outwnd.cpp:44
#define MB_OK
Definition: config.h:179
void outwnd_paint(HWND hwnd)
Definition: outwnd.cpp:805
unsigned char _inp(unsigned short port)
Definition: outwnd.cpp:115
int marked_left
Definition: outwnd.cpp:74
unsigned long DWORD
Definition: config.h:90
SCP_vector< outwnd_filter_struct > OutwndFilter
Definition: outwnd.cpp:64
HANDLE mono_driver
Definition: outwnd.cpp:85
char name[NAME_LENGTH]
Definition: outwnd.cpp:60
cfbp fp
Definition: cfile.cpp:1065
#define MB_ICONERROR
Definition: config.h:190
int nCharRows
Definition: outwnd.cpp:69
GLint GLint GLint GLint GLint x
Definition: Glext.h:5182
GLclampd n
Definition: Glext.h:7286
unsigned char ubyte
Definition: pstypes.h:62
int x
Definition: config.h:287
int nTextWidth
Definition: outwnd.cpp:69
int old_marked_top
Definition: outwnd.cpp:75
typedef HDC(WINAPI *PFNWGLGETCURRENTREADDCARBPROC)(void)
#define NOX(s)
Definition: pstypes.h:473
#define MAX_LINE_WIDTH
Definition: outwnd.cpp:40
#define CALLBACK
Definition: config.h:75
GLbitfield flags
Definition: Glext.h:6722
char szOutputClass[]
Definition: outwnd.cpp:54
int cur_line_index
Definition: outwnd.cpp:76
void fix_marking_coords(int &x, int &y, LPARAM l_parm)
Definition: outwnd.cpp:140
GLuint const GLchar * name
Definition: Glext.h:5608
#define MAX_PATH_LEN
Definition: pstypes.h:325
int BOOL
Definition: config.h:80
#define UP_FAST
Definition: outwnd.cpp:47
#define CF_TYPE_DATA
Definition: cfile.h:46
char outtext[SCROLL_BUFFER_SIZE][MAX_LINE_WIDTH]
Definition: outwnd.cpp:67
ubyte Outwnd_no_filter_file
Definition: outwnd.cpp:94
HANDLE hOutputThread
Definition: outwnd.cpp:50
int old_marked_left
Definition: outwnd.cpp:75
int marked_right
Definition: outwnd.cpp:74
int old_scroll_pos
Definition: outwnd.cpp:68
#define NAME_LENGTH
Definition: globals.h:15
#define TASKBAR_HEIGHT
Definition: outwnd.cpp:41
int marked_top
Definition: outwnd.cpp:74
long LRESULT
Definition: config.h:100
void outwnd_init_debug_window(int display_under_freespace_window)
Definition: outwnd.cpp:1142
GLsizei const GLchar ** path
Definition: Glext.h:6795
void text_normal(HDC &hdc)
Definition: outwnd.cpp:134
GLfloat GLfloat p
Definition: Glext.h:8373
#define TIMER1
Definition: outwnd.cpp:46
int MessageBox(HWND h, const char *s1, const char *s2, int i)
#define ID_COPY
Definition: outwnd.cpp:43
void outwnd_printf(const char *id, const char *format,...)
Definition: outwnd.cpp:364
hull_check pos
Definition: lua.cpp:5050
int old_marked
Definition: outwnd.cpp:75
LPARAM last_mousemove
Definition: outwnd.cpp:79
typedef LPVOID
Definition: vddraw.h:119
GLenum GLsizei len
Definition: Glext.h:6283
int temp
Definition: lua.cpp:4996
#define IOCTL_MONO_PRINT
Definition: monopub.h:50
SCP_string safe_string
Definition: outwnd.cpp:101
void * HANDLE
Definition: config.h:106
int y
Definition: config.h:287
LRESULT CALLBACK outwnd_handler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: outwnd.cpp:513
#define FALSE
Definition: pstypes.h:400
int marked_bottom
Definition: outwnd.cpp:74
void close_mono()
Definition: outwnd.cpp:1128
int old_marked_bottom
Definition: outwnd.cpp:75
#define stricmp(s1, s2)
Definition: config.h:271
int max_scroll_pos
Definition: outwnd.cpp:72
BOOL OutputActive
Definition: outwnd.cpp:78
void safe_point_print(const char *format,...)
Definition: outwnd.cpp:1334
char spaces[MAX_LINE_WIDTH+1]
Definition: outwnd.cpp:55
int Cmdline_debug_window
Definition: cmdline.cpp:501
void load_filter_info(void)
Definition: outwnd.cpp:167
int Outwnd_changed
Definition: outwnd.cpp:80
GLint y
Definition: Gl.h:1505
BOOL outwnd_create(int display_under_freespace_window)
Definition: outwnd.cpp:1036
#define strcpy_s(...)
Definition: safe_strings.h:67
int Is_standalone
Definition: systemvars.cpp:59