1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS Console Server DLL
4  * FILE:            win32ss/user/winsrv/consrv/frontends/gui/guiterm.h
5  * PURPOSE:         GUI Terminal Front-End
6  * PROGRAMMERS:     G� van Geldorp
7  *                  Johannes Anderwald
8  *                  Jeffrey Morlan
9  *                  Hermes Belusca-Maito (hermes.belusca@sfr.fr)
10  */
11 
12 #pragma once
13 
14 #include "guisettings.h"
15 #include "conwnd.h"
16 
17 
18 /* HELPER FUNCTIONS ***********************************************************/
19 
20 FORCEINLINE
21 VOID
22 GetScreenBufferSizeUnits(IN PCONSOLE_SCREEN_BUFFER Buffer,
23                          IN PGUI_CONSOLE_DATA GuiData,
24                          OUT PUINT WidthUnit,
25                          OUT PUINT HeightUnit)
26 {
27     ASSERT(Buffer && GuiData && WidthUnit && HeightUnit);
28 
29     if (GetType(Buffer) == TEXTMODE_BUFFER)
30     {
31         *WidthUnit  = GuiData->CharWidth ;
32         *HeightUnit = GuiData->CharHeight;
33     }
34     else /* if (GetType(Buffer) == GRAPHICS_BUFFER) */
35     {
36         *WidthUnit  = 1;
37         *HeightUnit = 1;
38     }
39 }
40 
41 FORCEINLINE
42 VOID
43 SmallRectToRect(PGUI_CONSOLE_DATA GuiData, PRECT Rect, PSMALL_RECT SmallRect)
44 {
45     PCONSOLE_SCREEN_BUFFER Buffer = GuiData->ActiveBuffer;
46     UINT WidthUnit, HeightUnit;
47 
48     GetScreenBufferSizeUnits(Buffer, GuiData, &WidthUnit, &HeightUnit);
49 
50     Rect->left   = (SmallRect->Left       - Buffer->ViewOrigin.X) * WidthUnit ;
51     Rect->top    = (SmallRect->Top        - Buffer->ViewOrigin.Y) * HeightUnit;
52     Rect->right  = (SmallRect->Right  + 1 - Buffer->ViewOrigin.X) * WidthUnit ;
53     Rect->bottom = (SmallRect->Bottom + 1 - Buffer->ViewOrigin.Y) * HeightUnit;
54 }
55 
56 
57 /* FUNCTIONS ******************************************************************/
58 
59 /* guiterm.c */
60 
61 VOID
62 GuiConsoleMoveWindow(PGUI_CONSOLE_DATA GuiData);
63 
64 
65 /* conwnd.c */
66 
67 BOOL
68 InitFonts(PGUI_CONSOLE_DATA GuiData,
69           LPWSTR FaceName, // Points to a WCHAR array of LF_FACESIZE elements.
70           ULONG  FontFamily,
71           COORD  FontSize,
72           ULONG  FontWeight);
73 VOID
74 DeleteFonts(PGUI_CONSOLE_DATA GuiData);
75 
76 
77 /* fullscreen.c */
78 
79 BOOL
80 EnterFullScreen(PGUI_CONSOLE_DATA GuiData);
81 VOID
82 LeaveFullScreen(PGUI_CONSOLE_DATA GuiData);
83 VOID
84 SwitchFullScreen(PGUI_CONSOLE_DATA GuiData, BOOL FullScreen);
85 VOID
86 GuiConsoleSwitchFullScreen(PGUI_CONSOLE_DATA GuiData);
87 
88 
89 /* graphics.c */
90 
91 VOID
92 GuiCopyFromGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer,
93                           PGUI_CONSOLE_DATA GuiData);
94 VOID
95 GuiPasteToGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer,
96                          PGUI_CONSOLE_DATA GuiData);
97 VOID
98 GuiPaintGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer,
99                        PGUI_CONSOLE_DATA GuiData,
100                        PRECT rcView,
101                        PRECT rcFramebuffer);
102 
103 
104 /* text.c */
105 
106 VOID
107 PasteText(
108     IN PCONSRV_CONSOLE Console,
109     IN PWCHAR Buffer,
110     IN SIZE_T cchSize);
111 
112 VOID
113 GuiCopyFromTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
114                           PGUI_CONSOLE_DATA GuiData);
115 VOID
116 GuiPasteToTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
117                          PGUI_CONSOLE_DATA GuiData);
118 VOID
119 GuiPaintTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
120                        PGUI_CONSOLE_DATA GuiData,
121                        PRECT rcView,
122                        PRECT rcFramebuffer);
123 
124 /* EOF */
125