debugwnd.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*=============================================================================
  2. DEBUGWND.H: Definitions for the Windows part of the debug window code.
  3. Created by Luke Moloney June 1997
  4. =============================================================================*/
  5. #ifndef ___DEBUGWND_H
  6. #define ___DEBUGWND_H
  7. /*=============================================================================
  8. Switches:
  9. =============================================================================*/
  10. #define DBW_TO_FILE 1
  11. #define DBW_FILE_NAME "debugMessages.txt"
  12. #ifndef HW_Release
  13. #define DBW_ERROR_CHECKING 1
  14. #else //HW_Debug
  15. #define DBW_ERROR_CHECKING 0
  16. #endif //HW_Debug
  17. /*=============================================================================
  18. Definitions:
  19. =============================================================================*/
  20. //default size and location of window
  21. #define DBW_WindowX (MAIN_WindowWidth + GetSystemMetrics(SM_CXSIZEFRAME) * 2)
  22. #define DBW_WindowY 0
  23. #define DBW_WindowWidth 60
  24. #define DBW_WindowHeight 30
  25. #define DBW_BufferHeight 100
  26. #define DBW_NumberPanes 4
  27. //pane-specific flags
  28. #define DPF_Enabled 1
  29. //name of window/class
  30. #define DBW_ClassName "HW_DebugWindow"
  31. #define DBW_WindowTitle "Homeworld Debug Window"
  32. //font parameters
  33. #define DBW_FontPointsMin 4
  34. #define DBW_FontPointsMax 20
  35. //strings for use with the ini file
  36. #define DIS_SectionName "DebugWindow"
  37. #define DIS_Location "Location"
  38. #define DIS_Size "Size"
  39. #define DIS_Font "Font"
  40. #define DIS_PaneBase "Pane"
  41. #define DIS_FileName "Homeworld.cfg"
  42. #define DIS_StringLength 64
  43. /*=============================================================================
  44. Type definitions:
  45. =============================================================================*/
  46. //structure for data of a single debug pane
  47. typedef struct
  48. {
  49. udword flags; //pane-specific flags
  50. sdword x, y; //top left of pane (chars)
  51. sdword width, height; //size of pane (chars)
  52. sdword cursorX, cursorY; //location of 'cursor'
  53. sdword viewTop; //y location of buffer at top of on-screen pane
  54. sdword bufferHeight; //height of buffer for this pane
  55. char *buffer; //pointer to buffer for this pane
  56. FILE *logFile; //log file handle
  57. }
  58. pane;
  59. /*=============================================================================
  60. Macros
  61. =============================================================================*/
  62. //debug-enabled macro for pane index range checking
  63. #if DBW_ERROR_CHECKING
  64. #define dbwPaneOutRange(pane) ((pane) < 0 || (pane) >= DBW_NumberPanes)
  65. #else
  66. #define dbwPaneOutRange(pane) (0)
  67. #endif //DBW_ERROR_CHECKING
  68. //check to see if pane is enabled
  69. #define dbwPaneEnabled(pane) (bitTest(dbwPane[pane].flags, DPF_Enabled))
  70. /*=============================================================================
  71. Functions:
  72. =============================================================================*/
  73. //start/close down the debug window.
  74. sdword dbwStart(udword hInstance, udword hWndParent);
  75. void dbwClose(void);
  76. void dbwWriteOptions(void);
  77. //setting attributes of window
  78. sdword dbwLocationSet(sdword xPixels, sdword yPixels);
  79. sdword dbwSizeSet(sdword xChars, sdword yChars);
  80. sdword dbwScrollBufferSizeSet(sdword yChars);
  81. //pane attribute functions
  82. sdword dbwPaneEnable(sdword pane, sdword enable);
  83. //logging
  84. sdword dbwLogStart(sdword pane, char *fileName);
  85. sdword dbwLogFlush(sdword pane);
  86. sdword dbwLogEnd(sdword pane);
  87. sdword dbwLogEndAll(void);
  88. //printing strings to the window
  89. sdword dbwPrint(sdword pane, char *string);
  90. sdword dbwLineFeed(sdword pane);
  91. void dbwPaneClear(sdword pane);
  92. sdword dbwCursorSet(sdword pane, sdword x, sdword y);
  93. #endif //___DEBUGWND_H