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
GetScreenBufferSizeUnits(IN PCONSOLE_SCREEN_BUFFER Buffer,IN PGUI_CONSOLE_DATA GuiData,OUT PUINT WidthUnit,OUT PUINT HeightUnit)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
SmallRectToRect(PGUI_CONSOLE_DATA GuiData,PRECT Rect,PSMALL_RECT SmallRect)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(
69     _Inout_ PGUI_CONSOLE_DATA GuiData,
70     _In_reads_or_z_(LF_FACESIZE)
71          PCWSTR FaceName,
72     _In_ ULONG FontWeight,
73     _In_ ULONG FontFamily,
74     _In_ COORD FontSize,
75     _In_opt_ UINT CodePage,
76     _In_ BOOL UseDefaultFallback);
77 
78 VOID
79 DeleteFonts(PGUI_CONSOLE_DATA GuiData);
80 
81 
82 /* fullscreen.c */
83 
84 BOOL
85 EnterFullScreen(PGUI_CONSOLE_DATA GuiData);
86 VOID
87 LeaveFullScreen(PGUI_CONSOLE_DATA GuiData);
88 VOID
89 SwitchFullScreen(PGUI_CONSOLE_DATA GuiData, BOOL FullScreen);
90 VOID
91 GuiConsoleSwitchFullScreen(PGUI_CONSOLE_DATA GuiData);
92 
93 
94 /* graphics.c */
95 
96 VOID
97 GuiCopyFromGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer,
98                           PGUI_CONSOLE_DATA GuiData);
99 VOID
100 GuiPasteToGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer,
101                          PGUI_CONSOLE_DATA GuiData);
102 VOID
103 GuiPaintGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer,
104                        PGUI_CONSOLE_DATA GuiData,
105                        PRECT rcView,
106                        PRECT rcFramebuffer);
107 
108 
109 /* text.c */
110 
111 VOID
112 PasteText(
113     IN PCONSRV_CONSOLE Console,
114     IN PWCHAR Buffer,
115     IN SIZE_T cchSize);
116 
117 VOID
118 GuiCopyFromTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
119                           PGUI_CONSOLE_DATA GuiData);
120 VOID
121 GuiPasteToTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
122                          PGUI_CONSOLE_DATA GuiData);
123 VOID
124 GuiPaintTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
125                        PGUI_CONSOLE_DATA GuiData,
126                        PRECT rcView,
127                        PRECT rcFramebuffer);
128 
129 /* EOF */
130