/* FUNCTIONS ******************************************************************/
-COLORREF RGBFromAttrib2(PCONSOLE Console, WORD Attribute)
+COLORREF PaletteRGBFromAttrib(PCONSOLE Console, WORD Attribute)
{
HPALETTE hPalette = Console->ActiveBuffer->PaletteHandle;
PALETTEENTRY pe;
* This function supposes that the system clipboard was opened.
*/
- PCONSOLE Console = Buffer->Header.Console;
-
/*
* Pressing the Shift key while copying text, allows us to copy
* text without newline characters (inline-text copy mode).
ULONG selWidth, selHeight;
ULONG xPos, yPos, size;
- selWidth = Console->Selection.srSelection.Right - Console->Selection.srSelection.Left + 1;
- selHeight = Console->Selection.srSelection.Bottom - Console->Selection.srSelection.Top + 1;
+ selWidth = GuiData->Selection.srSelection.Right - GuiData->Selection.srSelection.Left + 1;
+ selHeight = GuiData->Selection.srSelection.Bottom - GuiData->Selection.srSelection.Top + 1;
DPRINT("Selection is (%d|%d) to (%d|%d)\n",
- Console->Selection.srSelection.Left,
- Console->Selection.srSelection.Top,
- Console->Selection.srSelection.Right,
- Console->Selection.srSelection.Bottom);
+ GuiData->Selection.srSelection.Left,
+ GuiData->Selection.srSelection.Top,
+ GuiData->Selection.srSelection.Right,
+ GuiData->Selection.srSelection.Bottom);
#ifdef IS_WHITESPACE
#undef IS_WHITESPACE
ULONG length = selWidth;
ptr = ConioCoordToPointer(Buffer,
- Console->Selection.srSelection.Left,
- Console->Selection.srSelection.Top + yPos);
+ GuiData->Selection.srSelection.Left,
+ GuiData->Selection.srSelection.Top + yPos);
/* Trim whitespace from the right */
while (length > 0)
if (Buffer->Buffer == NULL) return;
+ if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return;
+
rcFramebuffer->left = Buffer->ViewOrigin.X * GuiData->CharWidth + rcView->left;
rcFramebuffer->top = Buffer->ViewOrigin.Y * GuiData->CharHeight + rcView->top;
rcFramebuffer->right = Buffer->ViewOrigin.X * GuiData->CharWidth + rcView->right;
LastAttribute = ConioCoordToPointer(Buffer, LeftChar, TopLine)->Attributes;
- SetTextColor(GuiData->hMemDC, RGBFromAttrib2(Console, TextAttribFromAttrib(LastAttribute)));
- SetBkColor(GuiData->hMemDC, RGBFromAttrib2(Console, BkgdAttribFromAttrib(LastAttribute)));
+ SetTextColor(GuiData->hMemDC, PaletteRGBFromAttrib(Console, TextAttribFromAttrib(LastAttribute)));
+ SetBkColor(GuiData->hMemDC, PaletteRGBFromAttrib(Console, BkgdAttribFromAttrib(LastAttribute)));
OldFont = SelectObject(GuiData->hMemDC, GuiData->Font);
Attribute = From->Attributes;
if (Attribute != LastAttribute)
{
- SetTextColor(GuiData->hMemDC, RGBFromAttrib2(Console, TextAttribFromAttrib(Attribute)));
- SetBkColor(GuiData->hMemDC, RGBFromAttrib2(Console, BkgdAttribFromAttrib(Attribute)));
+ SetTextColor(GuiData->hMemDC, PaletteRGBFromAttrib(Console, TextAttribFromAttrib(Attribute)));
+ SetBkColor(GuiData->hMemDC, PaletteRGBFromAttrib(Console, BkgdAttribFromAttrib(Attribute)));
LastAttribute = Attribute;
}
}
Attribute = ConioCoordToPointer(Buffer, Buffer->CursorPosition.X, Buffer->CursorPosition.Y)->Attributes;
if (Attribute == DEFAULT_SCREEN_ATTRIB) Attribute = Buffer->ScreenDefaultAttrib;
- CursorBrush = CreateSolidBrush(RGBFromAttrib2(Console, TextAttribFromAttrib(Attribute)));
+ CursorBrush = CreateSolidBrush(PaletteRGBFromAttrib(Console, TextAttribFromAttrib(Attribute)));
OldBrush = SelectObject(GuiData->hMemDC, CursorBrush);
PatBlt(GuiData->hMemDC,
}
SelectObject(GuiData->hMemDC, OldFont);
+
+ LeaveCriticalSection(&Console->Lock);
}
/* EOF */