xoblite™ / Blackbox for Windows bb5 | RC6 preview | 0.25.2.14
http://xoblite.net/
Console Class Reference

#include <Console.h>

Public Types

typedef vector< messageListItem * > messageListVector
 

Public Member Functions

 Console (HINSTANCE hInstance)
 
 ~Console ()
 
void UpdateConsoleWindow ()
 
void DrawMessage (HDC hdc, RECT r, messageListItem *mLI)
 
void GetDimensions ()
 
void UpdatePosition ()
 
void ToggleMaximized ()
 
void BlockMessage (char *message)
 
void ClearHistory (bool redraw)
 

Public Attributes

HINSTANCE hConsoleInstance
 
HWND hBlackboxWnd
 
HWND hConsoleWnd
 
HDC cachedBackground
 
int ScreenWidth
 
int ScreenHeight
 
int ConsoleX
 
int ConsoleY
 
int ConsoleWidth
 
int ConsoleHeight
 
int consoleTrueFontHeight
 
int lineSpacing
 
bool ConsoleHidden
 
bool blockMessages
 
RECT consoleZoomButtonRect
 
RECT consoleLockGlyphRect
 
messageListVector messageList
 
char messageToBlock [MAX_LINE_LENGTH]
 

Friends

LRESULT CALLBACK ConsoleWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 

Member Typedef Documentation

◆ messageListVector

Constructor & Destructor Documentation

◆ Console()

Console::Console ( HINSTANCE hInstance)
46{
47 hConsoleWnd = NULL;
49 hConsoleInstance = hInstance;
50 ZeroMemory(&messageList, sizeof(messageList));
51 cachedBackground = CreateCompatibleDC(NULL);
52 messageToBlock[0] = '\0';
53
54 //====================
55
56 // Get size and position for our window...
58
59 //====================
60
61 // Register window class...
62 WNDCLASS wc;
63 ZeroMemory(&wc,sizeof(wc));
64 wc.hInstance = hConsoleInstance; // hInstance
65 wc.lpfnWndProc = ConsoleWndProc; // window procedure
66 wc.lpszClassName = szConsoleName; // window class name
67 wc.hbrBackground = NULL; // no class background brush
68 wc.style = CS_DBLCLKS; // class styles (e.g. accept doubleclicks)
69 wc.hCursor = LoadCursor(NULL, IDC_ARROW); // always display the regular arrow cursor
70
71 if (!RegisterClass(&wc))
72 {
73 MessageBox(0, "Error registering console window class!", szConsoleName, MB_OK | MB_ICONERROR | MB_TOPMOST);
74 Log("Console", "Error registering window class!");
75 return;
76 }
77
78 // Create console window...
79 hConsoleWnd = CreateWindowEx(
80 WS_EX_TOOLWINDOW | WS_EX_ACCEPTFILES | WS_EX_NOACTIVATE | WS_EX_LAYERED, // window style
81 szConsoleName, // window class
82 NULL, // window name
83 WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, // window parameters
84 ConsoleX, // x position
85 ConsoleY, // y position
86 ConsoleWidth, // window width
87 ConsoleHeight, // window height
88 NULL, //pDesktop->hDesktopWnd, // owner window
89 NULL, // no menu
90 hConsoleInstance, // hInstance
91 NULL // no window creation data
92 );
93
94 if (!hConsoleWnd)
95 {
96 UnregisterClass(szConsoleName,hConsoleInstance); // unregister window class
97 MessageBox(0, "Error creating console window!", szConsoleName, MB_OK | MB_ICONERROR | MB_TOPMOST);
98 Log("Console", "Error creating window!");
99 return;
100 }
101
102 //====================
103
104 // Subscribe to Blackbox messages applicable to the console...
106
107 // Make the console window sticky...
109 // Set console window z-order position to be right above the desktop...
110 SetWindowPos(hConsoleWnd, pDesktop->hDesktopWnd, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOOWNERZORDER);
111
112 // Update the console window...
113 ShowWindow(hConsoleWnd, pSettings->consoleHidden ? SW_HIDE : SW_SHOWNOACTIVATE);
115}
Desktop * pDesktop
Definition Blackbox.cpp:37
void MakeSticky(HWND window)
Definition BBApi.cpp:2965
#define WS_EX_LAYERED
Definition BBApi.cpp:61
void Log(LPCSTR des, LPCSTR line)
Definition BBApi.cpp:638
Settings * pSettings
Definition Blackbox.cpp:46
HWND GetBBWnd()
Definition BBApi.cpp:128
#define BB_REGISTERMESSAGE
Definition BBApi.h:142
const char szConsoleName[]
Definition Console.cpp:33
int consoleMessageSubscription[]
Definition Console.cpp:41
friend LRESULT CALLBACK ConsoleWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition Console.cpp:134
HDC cachedBackground
Definition Console.h:76
int ConsoleY
Definition Console.h:79
char messageToBlock[MAX_LINE_LENGTH]
Definition Console.h:91
HWND hConsoleWnd
Definition Console.h:74
int ConsoleWidth
Definition Console.h:79
void UpdateConsoleWindow()
Definition Console.cpp:458
HINSTANCE hConsoleInstance
Definition Console.h:72
int ConsoleHeight
Definition Console.h:79
messageListVector messageList
Definition Console.h:89
HWND hBlackboxWnd
Definition Console.h:73
void GetDimensions()
Definition Console.cpp:846
int ConsoleX
Definition Console.h:79
HWND hDesktopWnd
Definition Desktop.h:81
bool consoleHidden
Definition Settings.h:241

◆ ~Console()

Console::~Console ( )
120{
121 // Unsubscribe to previously subscribed Blackbox messages...
123
124 if (hConsoleWnd) DestroyWindow(hConsoleWnd); // Destroy the console window...
125 UnregisterClass(szConsoleName, hConsoleInstance); // Unregister the console window class...
126
127 if (cachedBackground) DeleteDC(cachedBackground); // Delete the cached gradient...
128
129 ClearHistory(false); // Clear all elements in the messageList...
130}
#define BB_UNREGISTERMESSAGE
Definition BBApi.h:143
void ClearHistory(bool redraw)
Definition Console.cpp:1071

Member Function Documentation

◆ UpdateConsoleWindow()

void Console::UpdateConsoleWindow ( )
459{
460 // Fetch the new size and position parameters for our window...
461// GetDimensions();
462
463 RECT r;
464 SetRect(&r, 0, 0, ConsoleWidth, ConsoleHeight);
465
466 HDC hdc = GetWindowDC(hConsoleWnd);
467 HBITMAP bufbmp = CreateCompatibleBitmap(hdc, r.right-r.left, r.bottom-r.top);
468 DeleteObject(SelectObject(cachedBackground, bufbmp));
469 ReleaseDC(hConsoleWnd, hdc);
470
471 //====================
472
473 // Draw console background...
474 HBRUSH brush;
475 if (pSettings->consoleDesktopMode) brush = CreateSolidBrush(0x000000);
476 else brush = CreateSolidBrush(pSettings->Console->Color);
477 FillRect(cachedBackground, &r, brush);
478 DeleteObject(brush);
479
480 //====================
481
483 {
484 // Draw maximize/restore button background...
485 brush = CreateSolidBrush(pSettings->Console->PicColor);
486 FillRect(cachedBackground, &consoleZoomButtonRect, brush);
487 DeleteObject(brush);
488
489 // Draw maximize/restore button glyph...
490 HPEN zoomPen = CreatePen(PS_SOLID, 1, pSettings->Console->Color);
491 HPEN oldPen = (HPEN) SelectObject(cachedBackground, zoomPen);
492
493 int offsetY = consoleZoomButtonRect.top + 7;
494 int offsetX = consoleZoomButtonRect.left + 7;
495
497 {
498 MoveToEx(cachedBackground, offsetX-4, offsetY-1, NULL);
499 LineTo(cachedBackground, offsetX+1, offsetY-1);
500 LineTo(cachedBackground, offsetX+1, offsetY+4);
501 LineTo(cachedBackground, offsetX-4, offsetY+4);
502 LineTo(cachedBackground, offsetX-4, offsetY-1);
503 MoveToEx(cachedBackground, offsetX-4, offsetY, NULL);
504 LineTo(cachedBackground, offsetX+1, offsetY);
505
506 MoveToEx(cachedBackground, offsetX-1, offsetY-4, NULL);
507 LineTo(cachedBackground, offsetX+4, offsetY-4);
508 LineTo(cachedBackground, offsetX+4, offsetY+1);
509 LineTo(cachedBackground, offsetX+1, offsetY+1);
510 MoveToEx(cachedBackground, offsetX-1, offsetY, NULL);
511 LineTo(cachedBackground, offsetX-1, offsetY-4);
512 MoveToEx(cachedBackground, offsetX-1, offsetY-3, NULL);
513 LineTo(cachedBackground, offsetX+4, offsetY-3);
514 }
515 else
516 {
517 MoveToEx(cachedBackground, offsetX-4, offsetY-4, NULL);
518 LineTo(cachedBackground, offsetX+4, offsetY-4);
519 LineTo(cachedBackground, offsetX+4, offsetY+4);
520 LineTo(cachedBackground, offsetX-4, offsetY+4);
521 LineTo(cachedBackground, offsetX-4, offsetY-4);
522 MoveToEx(cachedBackground, offsetX-4, offsetY-3, NULL);
523 LineTo(cachedBackground, offsetX+4, offsetY-3);
524 }
525
526// if (pSettings->doubleScaleHiDPI) StretchBlt(cachedBackground, consoleZoomButtonRect.left, consoleZoomButtonRect.top, 30, 30, cachedBackground, consoleZoomButtonRect.left, consoleZoomButtonRect.top, 15, 15, SRCCOPY);
528
529 SelectObject(cachedBackground, oldPen);
530 DeleteObject(zoomPen);
531
532 //====================
533
534 // Draw "lock" indicator if write protection is enabled...
536 {
537 // Draw "lock" background...
538 brush = CreateSolidBrush(pSettings->Console->PicColor); //0x000066
539 FillRect(cachedBackground, &consoleLockGlyphRect, brush);
540 DeleteObject(brush);
541
542 // Draw "lock" glyph...
543 HPEN protectPen = CreatePen(PS_SOLID, 1, pSettings->Console->Color);
544 HPEN oldPen = (HPEN) SelectObject(cachedBackground, protectPen);
545
546 MoveToEx(cachedBackground, consoleLockGlyphRect.left+4, consoleLockGlyphRect.top+7, NULL);
548 MoveToEx(cachedBackground, consoleLockGlyphRect.left+4, consoleLockGlyphRect.top+8, NULL);
550 MoveToEx(cachedBackground, consoleLockGlyphRect.left+4, consoleLockGlyphRect.top+9, NULL);
552 MoveToEx(cachedBackground, consoleLockGlyphRect.left + 4, consoleLockGlyphRect.top + 10, NULL);
554 MoveToEx(cachedBackground, consoleLockGlyphRect.left + 4, consoleLockGlyphRect.top + 11, NULL);
556
557 MoveToEx(cachedBackground, consoleLockGlyphRect.left + 6, consoleLockGlyphRect.top + 3, NULL);
559 MoveToEx(cachedBackground, consoleLockGlyphRect.left + 5, consoleLockGlyphRect.top + 4, NULL);
561 MoveToEx(cachedBackground, consoleLockGlyphRect.left + 9, consoleLockGlyphRect.top + 4, NULL);
563
565 {
567 MoveToEx(cachedBackground, consoleLockGlyphRect.left + 8, consoleLockGlyphRect.top + 13, NULL);
569 MoveToEx(cachedBackground, consoleLockGlyphRect.left + 11, consoleLockGlyphRect.top + 7, NULL);
571 MoveToEx(cachedBackground, consoleLockGlyphRect.left + 18, consoleLockGlyphRect.top + 7, NULL);
573
575 {
576 // Temporary lazy solution... (ie. for now just stretching the 2x glyph, with no further pixel fine-tuning like for 2x above)
578 }
579 }
580
581 SelectObject(cachedBackground, oldPen);
582 DeleteObject(protectPen);
583 }
584 }
585
586 //====================
587
588 // Draw messages...
589 SetRect(&r, 0, 0, ConsoleWidth, ConsoleHeight);
590
591 HFONT font = CreateFont(pSettings->Console->FontHeight, 0, 0, 0, pSettings->Console->FontWeight, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, pSettings->Console->Font);
592 HGDIOBJ oldfont = SelectObject(cachedBackground, font);
593 SetBkMode(cachedBackground, TRANSPARENT);
594
595 for (int i=0; i < (int)messageList.size(); i++) SetRectEmpty(&messageList[i]->r); // Flush any prior message RECTs to enable detection of clicks on currently visible messages only...
596
597 int messagesToDraw;
599 else messagesToDraw = pSettings->consoleRestoredMessages;
600
601 if (messagesToDraw > 1)
602 {
604 r.bottom = r.top + consoleTrueFontHeight;
605
606 int i = 0;
607 int mlSize = (int)messageList.size();
608 if (mlSize > messagesToDraw) i = mlSize - messagesToDraw; // Display latest received messages
609 for (i; i < (int)messageList.size(); i++)
610 {
612 CopyRect(&messageList[i]->r, &r);
613 OffsetRect(&r, 0, lineSpacing);
614 }
615 }
616 else
617 {
618 if (!pSettings->consoleDesktopMode) InflateRect(&r, (-5 * pSettings->scalingFactorHiDPI), 0);
619 r.top = (r.bottom - r.top - consoleTrueFontHeight) / 2;
620 r.bottom = r.top + consoleTrueFontHeight;
621
622 int latestMsg = (int)messageList.size() - 1;
623 if (latestMsg >= 0)
624 {
626 CopyRect(&messageList[latestMsg]->r, &r);
627 }
628 }
629
630 DeleteObject(SelectObject(cachedBackground, oldfont));
631
632 //====================
633
634 SetRect(&r, 0, 0, ConsoleWidth, ConsoleHeight);
635
637 {
638 // Apply per pixel alpha, selectively per placement, creating nice rounded corners... 8)
640
642 {
644 {
645 /*
646 // Original: Rounding all applicable corners
647 case PLACEMENT_MANUAL: AlphaCorner(cachedBackground, r, CORNER_TOPLEFT | CORNER_TOPRIGHT | CORNER_BOTTOMLEFT | CORNER_BOTTOMRIGHT, 0, 0, 0, pSettings->Toolbar->borderWidth, 0, pSettings->consoleTransparencyAlpha); break;
648 case PLACEMENT_TOP_LEFT: AlphaCorner(cachedBackground, r, CORNER_BOTTOMRIGHT, 0, 0, 0, pSettings->Toolbar->borderWidth, 0, pSettings->consoleTransparencyAlpha); break;
649 case PLACEMENT_CENTER_LEFT: AlphaCorner(cachedBackground, r, CORNER_TOPRIGHT | CORNER_BOTTOMRIGHT, 0, 0, 0, pSettings->Toolbar->borderWidth, 0, pSettings->consoleTransparencyAlpha); break;
650 case PLACEMENT_BOTTOM_LEFT: AlphaCorner(cachedBackground, r, CORNER_TOPRIGHT, 0, 0, 0, pSettings->Toolbar->borderWidth, 0, pSettings->consoleTransparencyAlpha); break;
651 case PLACEMENT_TOP_CENTER: AlphaCorner(cachedBackground, r, CORNER_BOTTOMLEFT | CORNER_BOTTOMRIGHT, 0, 0, 0, pSettings->Toolbar->borderWidth, 0, pSettings->consoleTransparencyAlpha); break;
652 case PLACEMENT_CENTER_CENTER: AlphaCorner(cachedBackground, r, CORNER_TOPLEFT | CORNER_TOPRIGHT | CORNER_BOTTOMLEFT | CORNER_BOTTOMRIGHT, 0, 0, 0, pSettings->Toolbar->borderWidth, 0, pSettings->consoleTransparencyAlpha); break;
653 case PLACEMENT_BOTTOM_CENTER: AlphaCorner(cachedBackground, r, CORNER_TOPLEFT | CORNER_TOPRIGHT, 0, 0, 0, pSettings->Toolbar->borderWidth, 0, pSettings->consoleTransparencyAlpha); break;
654 case PLACEMENT_TOP_RIGHT: AlphaCorner(cachedBackground, r, CORNER_BOTTOMLEFT, 0, 0, 0, pSettings->Toolbar->borderWidth, 0, pSettings->consoleTransparencyAlpha); break;
655 case PLACEMENT_CENTER_RIGHT: AlphaCorner(cachedBackground, r, CORNER_TOPLEFT | CORNER_BOTTOMLEFT, 0, 0, 0, pSettings->Toolbar->borderWidth, 0, pSettings->consoleTransparencyAlpha); break;
656 case PLACEMENT_BOTTOM_RIGHT: AlphaCorner(cachedBackground, r, CORNER_TOPLEFT, 0, 0, 0, pSettings->Toolbar->borderWidth, 0, pSettings->consoleTransparencyAlpha); break;
657 default: AlphaCorner(cachedBackground, r, CORNER_TOPLEFT | CORNER_TOPRIGHT | CORNER_BOTTOMLEFT | CORNER_BOTTOMRIGHT, 0, 0, 0, pSettings->Toolbar->borderWidth, 0, pSettings->consoleTransparencyAlpha);
658 */
659 // Alternative: Rounding all applicable corners *except* the top right one since that's where the square-sized "window controls" are located
671 }
672 }
673 }
674 else AlphaFromRGB(cachedBackground, r, 0, pSettings->consoleTransparencyAlpha, true, pSettings->desktopWidgetColor); // Console "desktop mode" -> Fully transparent console background, white text with varying transparency, etc
675
677
678 //====================
679
680 if (bufbmp) DeleteObject(bufbmp);
681
682 POINT pt;
683 pt.x = ConsoleX, pt.y = ConsoleY;
684 POINT ptSrc;
685 ptSrc.x = 0, ptSrc.y = 0;
686
687 BLENDFUNCTION bf;
688 bf.BlendOp = AC_SRC_OVER;
689 bf.BlendFlags = 0;
690 bf.AlphaFormat = AC_SRC_ALPHA;
691 bf.SourceConstantAlpha = (unsigned char)255;
692
693 SIZE windowSize = {ConsoleWidth, ConsoleHeight};
694 BOOL result = UpdateLayeredWindow(hConsoleWnd, NULL, &pt, &windowSize, cachedBackground, &ptSrc, 0, &bf, ULW_ALPHA);
695/*
696 if (!cachedBackground) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"xoblite -> Console -> Invalid cachedBackground!");
697
698 if (result == 0)
699 {
700 int error = GetLastError();
701 char msg[255];
702 sprintf(msg, "xoblite -> Console -> UpdateLayeredWindow failed! [error code %d]", error);
703 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_ERROR_MESSAGE, (LPARAM)msg);
704 }
705*/
706
707 // Finally, we move the console window to be just above the desktop in the z-order...
708 if (pDesktop) SetWindowPos(hConsoleWnd, pDesktop->hDesktopWnd, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOSENDCHANGING | SWP_NOOWNERZORDER);
709}
void AlphaFromRGB(HDC hdc, RECT rect, unsigned char minAlpha, unsigned char maxAlpha, bool recolor, COLORREF color)
Definition BBApi.cpp:2439
void AlphaApply(HDC hdc, RECT rect)
Definition BBApi.cpp:2449
void AlphaCorner(HDC hdc, RECT rect, int corner, int bevelStyle, int bevelPosition, int bevelWidth, int borderWidth, unsigned char minAlpha, unsigned char maxAlpha)
Definition BBApi.cpp:2431
void AlphaRect(HDC hdc, RECT rect, unsigned char alpha)
Definition BBApi.cpp:2419
#define CORNER_BOTTOMRIGHT
Definition BBApi.h:128
#define CORNER_BOTTOMLEFT
Definition BBApi.h:127
#define CORNER_TOPLEFT
Definition BBApi.h:125
#define PLACEMENT_CENTER_LEFT
Definition Settings.h:71
#define PLACEMENT_TOP_CENTER
Definition Settings.h:69
#define PLACEMENT_BOTTOM_CENTER
Definition Settings.h:75
#define PLACEMENT_MANUAL
Definition Settings.h:67
#define PLACEMENT_BOTTOM_LEFT
Definition Settings.h:74
#define PLACEMENT_TOP_LEFT
Definition Settings.h:68
#define PLACEMENT_CENTER_CENTER
Definition Settings.h:72
#define PLACEMENT_TOP_RIGHT
Definition Settings.h:70
#define PLACEMENT_BOTTOM_RIGHT
Definition Settings.h:76
#define PLACEMENT_CENTER_RIGHT
Definition Settings.h:73
int consoleTrueFontHeight
Definition Console.h:80
RECT consoleLockGlyphRect
Definition Console.h:86
void DrawMessage(HDC hdc, RECT r, messageListItem *mLI)
Definition Console.cpp:716
int lineSpacing
Definition Console.h:81
RECT consoleZoomButtonRect
Definition Console.h:85
int scalingFactorHiDPI
Definition Settings.h:327
bool consoleDesktopMode
Definition Settings.h:249
StyleItem * Console
Definition Settings.h:453
int consoleMaximizedMessages
Definition Settings.h:245
int consoleRestoredMessages
Definition Settings.h:247
BYTE consoleTransparencyAlpha
Definition Settings.h:248
bool consoleMaximized
Definition Settings.h:243
bool consoleRoundedCorners
Definition Settings.h:250
Placement ConsolePlacement
Definition Settings.h:242
bool writeProtection
Definition Settings.h:331
COLORREF desktopWidgetColor
Definition Settings.h:295
StyleItem * Toolbar
Definition Settings.h:424
int placement
Definition Settings.h:89
int borderWidth
Definition BBApi.h:417
COLORREF Color
Definition BBApi.h:406
int FontWeight
Definition BBApi.h:410
int FontHeight
Definition BBApi.h:409
char Font[128]
Definition BBApi.h:413

◆ DrawMessage()

void Console::DrawMessage ( HDC hdc,
RECT r,
messageListItem * mLI )
717{
718 RECT msgRect, tempRect;
719 CopyRect(&msgRect, &r);
720
722 {
723 if (IntersectRect(&tempRect, &msgRect, &consoleZoomButtonRect)) msgRect.right = consoleZoomButtonRect.left - (5 * pSettings->scalingFactorHiDPI);
724 if (pSettings->writeProtection && IntersectRect(&tempRect, &msgRect, &consoleLockGlyphRect)) msgRect.right = consoleLockGlyphRect.left - (5 * pSettings->scalingFactorHiDPI);
725 }
726
727 COLORREF colorHighAlpha, colorMediumAlpha;
729 {
732 }
733
734 //====================
735
736 if (mLI->type == CONSOLE_SEPARATOR)
737 {
738 int separatorOffset = (msgRect.bottom - msgRect.top) / 2;
739 msgRect.top = msgRect.top + separatorOffset - 1;
740 msgRect.bottom = msgRect.top + 2;
741 if (pSettings->doubleScaleHiDPI) InflateRect(&msgRect, 0, 1);
742 HBRUSH background;
743 if (pSettings->consoleDesktopMode) background = CreateSolidBrush(colorMediumAlpha);
744// else background = CreateSolidBrush(pSettings->Console->TextColor);
745 else background = CreateSolidBrush(pSettings->MixColors(pSettings->Console->Color, pSettings->Console->TextColor));
746 FillRect(hdc, &msgRect, background);
747 DeleteObject(background);
748 }
749
750 //====================
751
752 else if (mLI->type == CONSOLE_REGULAR_MESSAGE || mLI->type == CONSOLE_PLAIN_MESSAGE)
753 {
754 InflateRect(&msgRect, -3, 0);
756 {
757 char timestamp[16];
758// strncpy(timestamp, mLI->msg, 12);
759 strncpy_s(timestamp, sizeof(timestamp), mLI->msg, 12);
760 timestamp[12] = '\0';
761 DrawTextWithEffects(hdc, msgRect, mLI->msg, DT_LEFT | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_WORD_ELLIPSIS, colorHighAlpha, false, 0, false, 0, 0, 0);
762 DrawTextWithEffects(hdc, msgRect, timestamp, DT_LEFT | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_WORD_ELLIPSIS, colorMediumAlpha, false, 0, false, 0, 0, 0);
763 }
764 else DrawTextWithEffects(hdc, msgRect, mLI->msg, DT_LEFT | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_WORD_ELLIPSIS, pSettings->Console->TextColor, false, 0, false, 0, 0, 0);
765
766 // Highlight clickable URL?
767 if (strlen(mLI->url))
768 {
769 char msgWithoutURL[sizeof(mLI->msg)];
770 strcpy(msgWithoutURL, mLI->msg);
771 char* msgPtr = msgWithoutURL;
772 char* urlPtr = StrStrI(msgWithoutURL, "http://");
773 if (urlPtr == NULL) urlPtr = StrStrI(msgWithoutURL, "https://");
774 if (urlPtr == NULL) urlPtr = StrStrI(msgWithoutURL, "file://");
775 if (urlPtr != NULL)
776 {
777 int n = urlPtr - msgPtr;
778 msgWithoutURL[n] = '\0';
779
780 SIZE sizeMsg, sizeURL, sizeSpace;
781 HDC fonthdc = CreateDC("DISPLAY", NULL, NULL, NULL);
782 HFONT tempFont = CreateFont(pSettings->Console->FontHeight, 0, 0, 0, pSettings->Console->FontWeight, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, pSettings->Console->Font);
783 HGDIOBJ oldFont = SelectObject(fonthdc, tempFont);
784 GetTextExtentPoint32(fonthdc, msgWithoutURL, strlen(msgWithoutURL), &sizeMsg);
785 GetTextExtentPoint32(fonthdc, mLI->url, strlen(mLI->url), &sizeURL);
786 GetTextExtentPoint32(fonthdc, " ", 1, &sizeSpace);
787 if (sizeSpace.cx & 1) sizeSpace.cx += 1; // Note: Even number of pixels -> Extra URL background width always divideable by two (see below)
788 if (sizeSpace.cx < 4) sizeSpace.cx = 4;
789 DeleteObject(SelectObject(fonthdc, oldFont));
790 DeleteDC(fonthdc);
791
792 msgRect.left = msgRect.left + sizeMsg.cx - (sizeSpace.cx/2);
793 msgRect.right = msgRect.left + sizeURL.cx + sizeSpace.cx;
794
795 // URLs are drawn with inverted colours...
796 HBRUSH background;
797 if (pSettings->consoleDesktopMode) background = CreateSolidBrush(colorHighAlpha);
798 else background = CreateSolidBrush(pSettings->Console->TextColor);
799 FillRect(hdc, &msgRect, background);
800 DeleteObject(background);
801 if (pSettings->consoleDesktopMode) DrawTextWithEffects(hdc, msgRect, mLI->url, DT_CENTER | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_WORD_ELLIPSIS, 0x000000, false, 0, false, 0, 0, 0);
802 else DrawTextWithEffects(hdc, msgRect, mLI->url, DT_CENTER | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_WORD_ELLIPSIS, pSettings->Console->Color, false, 0, false, 0, 0, 0);
803 }
804 }
805 }
806
807 //====================
808
809 else
810 {
811 int msgHeight = msgRect.bottom - msgRect.top;
812 int iconSize = msgHeight - 2;
813// if (iconSize > 16) iconSize = 16;
814 if (iconSize > 32) iconSize = 32;
815// else if (iconSize > 16) iconSize = 16;
816
817 // Draw message icon...
818 RECT iconRect;
819 if (mLI->type != CONSOLE_INDENTED_MESSAGE)
820 {
821 iconRect.left = msgRect.left + 4;
822 iconRect.top = msgRect.top + (msgHeight/2) - (iconSize/2);
823 iconRect.right = iconRect.left + iconSize;
824 iconRect.bottom = iconRect.top + iconSize;
825// HICON bIcon = LoadIcon(NULL, mLI->icon);
826// DrawIconEx(hdc, iconRect.left, iconRect.top, bIcon, iconSize, iconSize, 0, NULL, DI_NORMAL);
827// DeleteObject(bIcon);
828 DrawIconEx(hdc, iconRect.left, iconRect.top, mLI->icon, iconSize, iconSize, 0, NULL, DI_NORMAL);
829 }
830 else if (mLI->type == CONSOLE_INDENTED_MESSAGE) iconRect.right = msgRect.left + (iconSize/2) + 1;
831
832 // Draw message text...
833 msgRect.left = iconRect.right + 3;
834 if (pSettings->doubleScaleHiDPI) msgRect.left += 3;
835 msgRect.right -= 2;
836 if (pSettings->consoleDesktopMode) DrawTextWithEffects(hdc, msgRect, mLI->msg, DT_LEFT | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_EXPANDTABS | DT_WORD_ELLIPSIS, colorHighAlpha, false, 0, false, 0, 0, 0);
837 else DrawTextWithEffects(hdc, msgRect, mLI->msg, DT_LEFT | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_EXPANDTABS | DT_WORD_ELLIPSIS, pSettings->Console->TextColor, false, 0, false, 0, 0, 0);
838 }
839}
void DrawTextWithEffects(HDC hdc, RECT r, LPSTR text, unsigned int format, COLORREF textColor, bool outline, COLORREF outlineColor, bool shadow, COLORREF shadowColor, int shadowX, int shadowY)
Definition BBApi.cpp:3519
#define CONSOLE_SEPARATOR
Definition BBApi.h:304
#define CONSOLE_REGULAR_MESSAGE
Definition BBApi.h:297
#define CONSOLE_PLAIN_MESSAGE
Definition BBApi.h:302
#define CONSOLE_INDENTED_MESSAGE
Definition BBApi.h:303
bool doubleScaleHiDPI
Definition Settings.h:326
COLORREF MixColors(COLORREF colorA, COLORREF colorB)
Definition Settings.cpp:2231
COLORREF TextColor
Definition BBApi.h:408
char msg[350]
Definition Console.h:45
int type
Definition Console.h:44
char url[256]
Definition Console.h:47
HICON icon
Definition Console.h:46

◆ GetDimensions()

void Console::GetDimensions ( )
847{
849 {
850 RECT workArea;
851 SystemParametersInfo(SPI_GETWORKAREA, 0, (PVOID)&workArea, SPIF_SENDCHANGE);
852 ScreenWidth = workArea.right - workArea.left;
853 ScreenHeight = workArea.bottom - workArea.top;
854 }
855 else
856 {
857 ScreenWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
858 ScreenHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
859 }
860
861 //====================
862
863 // First we need to check the *real* size of the font as some style
864 // authors use non-matching font heights with bitmap fonts just to
865 // tweak the appearance of the toolbar (e.g. to shrink its size)
866 SIZE size;
867 HDC fonthdc = CreateDC("DISPLAY", NULL, NULL, NULL);
868 HFONT tempFont = CreateFont(pSettings->Console->FontHeight, 0, 0, 0, pSettings->Console->FontWeight, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, pSettings->Console->Font);
869 HGDIOBJ oldFont = SelectObject(fonthdc, tempFont);
870 GetTextExtentPoint32(fonthdc, "TQkgfp/", 8, &size);
871 consoleTrueFontHeight = size.cy + 1;
873 DeleteObject(SelectObject(fonthdc, oldFont));
874 DeleteDC(fonthdc);
875
877// if (pSettings->doubleScaleHiDPI) lineSpacing += 2;
879
880 //====================
881
882 if (pSettings->consoleMaximized) // Console window size "maximized" (nb. each state's #rows etc fully configurable though)
883 {
885 {
888 }
890 else ConsoleWidth = ScreenWidth - 10; // Default used when consoleMaximizedWidth == 0
891
893 {
895 {
896/*
897 ConsoleHeight = consoleTrueFontHeight + 10;
898 if (pSettings->doubleScaleHiDPI)
899 {
900 ConsoleHeight += 10;
901 if (ConsoleHeight & 1) ConsoleHeight++;
902 }
903 else
904 {
905 ConsoleHeight = ConsoleHeight | 1;
906 if (ConsoleHeight < 25) ConsoleHeight = 25;
907 }
908*/
911 {
912 if (ConsoleHeight & 1) ConsoleHeight++;
913 }
914 else // if ((pSettings->scalingFactorHiDPI == 1) || (pSettings->scalingFactorHiDPI == 3))
915 {
917 if (ConsoleHeight < 25) ConsoleHeight = 25;
918 }
919 }
921 }
922 else
923 {
925 {
926// ConsoleHeight = (lineSpacing * pSettings->consoleMaximizedMessages) + 8 + pSettings->consolePadding; // Padding 5+5 pixels minus 2 pixels from lineSpacing
927// if (pSettings->doubleScaleHiDPI) ConsoleHeight += 8; // Padding 10+10 pixels minus 4 pixels from lineSpacing
929 }
930 else
931 {
933// if (pSettings->doubleScaleHiDPI) ConsoleHeight -= 4; // No padding and minus 4 pixels from lineSpacing
934// else ConsoleHeight -= 2; // No padding and minus 2 pixels from lineSpacing
936 }
937 }
938 }
939 else // Console window size "restored" (nb. each state's #rows etc fully configurable though)
940 {
942 {
945 }
947 else ConsoleWidth = ScreenWidth / 3; // Default used when consoleRestoredWidth == 0
948
950 {
952 {
953/*
954 ConsoleHeight = consoleTrueFontHeight + 10;
955 if (pSettings->doubleScaleHiDPI)
956 {
957 ConsoleHeight += 10;
958 if (ConsoleHeight & 1) ConsoleHeight++;
959 }
960 else
961 {
962 ConsoleHeight = ConsoleHeight | 1;
963 if (ConsoleHeight < 25) ConsoleHeight = 25;
964 }
965*/
968 {
969 if (ConsoleHeight & 1) ConsoleHeight++;
970 }
971 else // if ((pSettings->scalingFactorHiDPI == 1) || (pSettings->scalingFactorHiDPI == 3))
972 {
974 if (ConsoleHeight < 25) ConsoleHeight = 25;
975 }
976 }
978 }
979 else
980 {
982 {
983// ConsoleHeight = (lineSpacing * pSettings->consoleRestoredMessages) + 8 + pSettings->consolePadding; // Padding 5+5 pixels minus 2 pixels padding from last lineSpacing
984// if (pSettings->doubleScaleHiDPI) ConsoleHeight += 8; // Padding 10+10 pixels minus 4 pixels padding from last lineSpacing
986 }
987 else
988 {
990// if (pSettings->doubleScaleHiDPI) ConsoleHeight -= 4; // No padding and minus 4 pixels from lineSpacing
991// else ConsoleHeight -= 2; // No padding and minus 2 pixels from lineSpacing
993 }
994 }
995 }
996
997 if (ConsoleWidth < 300) ConsoleWidth = 300; // Minimum console width is 300 pixels
998
999 //====================
1000
1002 {
1004 }
1005 else
1006 {
1007 int padding = ((ConsoleHeight - (15 * pSettings->scalingFactorHiDPI)) / 2);
1009 }
1010
1012 OffsetRect(&consoleLockGlyphRect, (-20 * pSettings->scalingFactorHiDPI), 0);
1013
1014 //====================
1015
1018
1020
1023}
Console(HINSTANCE hInstance)
Definition Console.cpp:45
int ScreenHeight
Definition Console.h:78
int ScreenWidth
Definition Console.h:78
void PositionFromPlacement(Placement *inputPlacement)
Definition Settings.cpp:3236
int consolePadding
Definition Settings.h:251
bool explorerHidden
Definition Settings.h:337
int consoleRestoredWidth
Definition Settings.h:246
int consoleMaximizedWidth
Definition Settings.h:244
int height
Definition Settings.h:97
int width
Definition Settings.h:96
int x
Definition Settings.h:94
int y
Definition Settings.h:95

◆ UpdatePosition()

void Console::UpdatePosition ( )
1031{
1032 // Get the new size and position for our window...
1033 GetDimensions();
1034 // Update the console window...
1036}

◆ ToggleMaximized()

void Console::ToggleMaximized ( )
1044{
1046 else pSettings->consoleMaximized = true;
1047
1048 // Resize the console window... (restored<->maximized)
1051
1052 // Save setting to xoblite.rc...
1053 WriteBool(pSettings->xobrcFile, "xoblite.console.maximized:", pSettings->consoleMaximized);
1054}
void WriteBool(LPCSTR fp, LPCSTR keyword, bool value)
Definition BBApi.cpp:3131
void PlaySoundFX(int sound)
Definition Sounds.cpp:40
@ SFX_TOGGLE_ELEMENT
Definition Sounds.h:48
void UpdatePosition()
Definition Console.cpp:1030
char xobrcFile[MAX_LINE_LENGTH]
Definition Settings.h:405

◆ BlockMessage()

void Console::BlockMessage ( char * message)
1062{
1063 strcpy(messageToBlock, message);
1064}

◆ ClearHistory()

void Console::ClearHistory ( bool redraw)
1072{
1073 // Clear all elements in the messageList...
1074 for (int i=0; i<(int)messageList.size(); i++)
1075 {
1076 if (messageList[i]->icon != NULL) DeleteObject(&messageList[i]->icon);
1077 delete messageList[i];
1078 }
1079 messageList.clear();
1080// ZeroMemory(&messageList, sizeof(messageList));
1081
1082 // Update the console window...
1083 if (redraw) UpdatePosition();
1084}

Friends And Related Symbol Documentation

◆ ConsoleWndProc

LRESULT CALLBACK ConsoleWndProc ( HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam )
friend
135{
136 switch (message)
137 {
138 //====================
139
141 {
142 if (strlen(pConsole->messageToBlock) > 0)
143 {
144 if (!_stricmp((LPCSTR)lParam, pConsole->messageToBlock))
145 {
146 // This message (typically a bro@m part of an @Script) should not be echoed in the console...
147 pConsole->messageToBlock[0] = '\0';
148 break;
149 }
150 }
151
152 //====================
153
154 if ((int)pConsole->messageList.size() >= 50)
155 {
156 // We already have the maximum 50 messages in the list, remove the oldest...
157 if (pConsole->messageList[0]->icon != NULL) DeleteObject(&pConsole->messageList[0]->icon);
158 delete pConsole->messageList[0];
159 pConsole->messageList.erase(pConsole->messageList.begin());
160 }
161
162 //====================
163
164 messageListItem *newMessage = new messageListItem;
165
166 newMessage->type = (int)wParam;
167
168 //====================
169
170 if (newMessage->type == CONSOLE_INFORMATION_MESSAGE) newMessage->icon = LoadIcon(NULL, IDI_INFORMATION);
171 else if (newMessage->type == CONSOLE_WARNING_MESSAGE) newMessage->icon = LoadIcon(NULL, IDI_WARNING);
172 else if (newMessage->type == CONSOLE_ERROR_MESSAGE) newMessage->icon = LoadIcon(NULL, IDI_ERROR);
173 else if (newMessage->type == CONSOLE_SHELL_MESSAGE) newMessage->icon = LoadIcon(pConsole->hConsoleInstance, MAKEINTRESOURCE(IDI_XOBLITE));
174 else newMessage->icon = NULL; // CONSOLE_REGULAR_MESSAGE, CONSOLE_PLAIN_MESSAGE, CONSOLE_INDENTED_MESSAGE, CONSOLE_SEPARATOR
175
176 //====================
177
178 if (newMessage->type != CONSOLE_SEPARATOR)
179 {
180 char message[MAX_LINE_LENGTH];
181 if (newMessage->type == CONSOLE_REGULAR_MESSAGE)
182 {
183 // Add a timestamp to regular messages...
184 _strtime(message);
185 strncat_s(message, sizeof(message), " -> ", _TRUNCATE);
186 strncat_s(message, sizeof(message), (LPCSTR)lParam, _TRUNCATE);
187 }
188 else strncpy_s(message, sizeof(message), (LPCSTR)lParam, _TRUNCATE);
189 message[sizeof(message)-1] = '\0'; // Failsafe
190
191 // Replace any \r\n in the string with a single space character...
192 LPSTR ptr;
193 while (ptr = strchr(message, '\r'))
194 {
195// int nLen = strlen(ptr);
196// memmove(ptr+3, ptr, nLen);
197// strncpy(ptr, " -> ", 4);
198 ptr[0] = ' ';
199 }
200 while (ptr = strchr(message, '\n'))
201 {
202 int nLen = strlen(ptr);
203 memmove(ptr, ptr+1, nLen);
204 }
205
206// strncpy(newMessage->msg, message, sizeof(newMessage->msg));
207 strncpy_s(newMessage->msg, sizeof(newMessage->msg), message, _TRUNCATE);
208 newMessage->msg[sizeof(newMessage->msg)-1] = '\0';
209
210 //====================
211
212 // Detect any URL in the message and if found make it clickable...
213 char* url = StrStrI(newMessage->msg, "http://");
214 if (url == NULL) url = StrStrI(newMessage->msg, "https://");
215 if (url == NULL) url = StrStrI(newMessage->msg, "file://");
216 if (url == NULL) newMessage->url[0] = '\0';
217 else
218 {
219 strncpy_s(newMessage->url, sizeof(newMessage->url), url, _TRUNCATE);
220 newMessage->url[sizeof(newMessage->url)-1] = '\0';
221
222 // Check whether the URL is part of an @Script, and if so perform some additional operations on the two strings... (URL+message)
223 if (IsInString(newMessage->msg, "@Script"))
224 {
225 char* first = newMessage->url;
226 char* pipe = StrStrI(newMessage->url, "|");
227 if (pipe != NULL) newMessage->url[pipe-first] = '\0';
228 else if (newMessage->url[strlen(newMessage->url)-1] == ']') newMessage->url[strlen(newMessage->url)-1] = '\0';
229
230 char updatedMsg[350];
231 updatedMsg[sizeof(updatedMsg) - 1] = '\0';
232 int n = url - newMessage->msg;
233 strncpy_s(updatedMsg, sizeof(updatedMsg), newMessage->msg, n);
234 strcat_s(updatedMsg, " "); // ...to avoid the later URL highlighting covering the character immediately *before* the URL...
235 strcat_s(updatedMsg, newMessage->url);
236 strcat_s(updatedMsg, " "); // ...to avoid the later URL highlighting covering the character immediately *after* the URL...
237 strcat_s(updatedMsg, &url[strlen(newMessage->url)]);
238 strncpy_s(newMessage->msg, sizeof(newMessage->msg), updatedMsg, _TRUNCATE);
239 newMessage->msg[sizeof(newMessage->msg)-1] = '\0';
240 }
241
242 // If not part of an @Script, we remove everything else after the URL (using blank space as delimiter) including any ending parantheses and commas...
243 else if (strchr(newMessage->url, ' '))
244 {
245 char temp[sizeof(newMessage->url)];
246 Tokenize(newMessage->url, temp, " ");
247 strcpy(newMessage->url, temp);
248 switch(newMessage->url[strlen(newMessage->url)-1])
249 {
250 case ')':
251 case '>':
252 case ',':
253 {
254 newMessage->url[strlen(newMessage->url)-1] = '\0';
255 }
256 }
257 }
258 }
259 }
260
261 //====================
262
263 pConsole->messageList.push_back(newMessage);
264
265 //====================
266
268 {
270
271/*
272 if (!SetTimer(pConsole->hConsoleWnd, CONSOLE_SETLABEL_TIMER, 4000, (TIMERPROC)NULL))
273 {
274 MessageBox(0, "Error creating console timer!", szConsoleName, MB_OK | MB_ICONERROR | MB_TOPMOST);
275 Log("Could not create console timer!", NULL);
276 return 0;
277 }
278*/
279 }
280 }
281 break;
282
283 //===========================================================================
284/*
285 case WM_TIMER:
286 {
287 if (wParam == CONSOLE_SETLABEL_TIMER)
288 {
289 KillTimer(pConsole->hConsoleWnd, CONSOLE_SETLABEL_TIMER);
290 if (pSettings->consoleHidden) ShowWindow(pConsole->hConsoleWnd, SW_HIDE);
291 }
292
293 return 0;
294 }
295 break;
296*/
297 //====================
298
299 case BB_RECONFIGURE:
300 case WM_DISPLAYCHANGE:
301 {
303 }
304 break;
305
306 case WM_SETTINGCHANGE:
307 {
308 // Update the console's position (and maybe also dimensions) if the work area changes...
309 // (e.g. if the Explorer taskbar is moved to another screen edge)
310 if (wParam == SPI_SETWORKAREA) pConsole->UpdatePosition();
311 return 0;
312 }
313
314 //====================
315
316 case BB_TOGGLECONSOLE:
317 {
319 {
320 // Show window and force update...
321 pSettings->consoleHidden = false;
322 ShowWindow(pConsole->hConsoleWnd, SW_SHOWNOACTIVATE);
324 }
325 else
326 {
327 // Hide window...
328 pSettings->consoleHidden = true;
329 ShowWindow(pConsole->hConsoleWnd, SW_HIDE);
330 }
331
333
334 WriteBool(pSettings->xobrcFile, "xoblite.console.hidden:", pSettings->consoleHidden);
335 }
336 break;
337
338 //====================
339/*
340 case WM_WINDOWPOSCHANGING:
341 {
342 // ##### FOR SOME REASON THIS WILL CRASH THE SHELL...? #####
343 if (pDesktop) SetWindowPos(pConsole->hConsoleWnd, pDesktop->hDesktopWnd, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOSENDCHANGING | SWP_NOOWNERZORDER);
344 return 0;
345 }
346*/
347 //====================
348
349 case WM_GETMINMAXINFO:
350 {
351 MINMAXINFO *mmi = (MINMAXINFO*)lParam;
352 mmi->ptMaxSize.y = pConsole->ConsoleHeight;
353 return 0;
354 }
355
356 //====================
357
358 case WM_CLOSE:
359 return 0;
360
361 //====================
362
363 case WM_MOUSEACTIVATE:
364 return MA_NOACTIVATE;
365
366// case WM_ACTIVATE:
367// if (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE) SetActiveWindow(hwnd);
368// return 0;
369
370 //====================
371
372 case WM_NCHITTEST:
373 {
374 if ((GetAsyncKeyState(VK_CONTROL) & 0x8000)) return HTCAPTION;
375 else return HTCLIENT;
376 }
377 break;
378
379 //====================
380
381 case WM_LBUTTONDBLCLK:
382 {
383 // Check which message was clicked...
384 POINT pt;
385 pt.x = LOWORD(lParam);
386 pt.y = HIWORD(lParam);
387
388 int i = 0;
389 for (i; i < (int)pConsole->messageList.size(); i++)
390 {
391 if (PtInRect(&pConsole->messageList[i]->r, pt)) break;
392 }
393 if (i == (int)pConsole->messageList.size()) break; // No message clicked
394
395 //====================
396
397 if (strlen(pConsole->messageList[i]->url) > 0) // Message including a clickable URL...
398 {
399 BBExecute(GetDesktopWindow(), NULL, pConsole->messageList[i]->url, NULL, NULL, SW_SHOWNORMAL, true);
400 }
401 else
402 {
403 // Relay all mouse actions and drag'n'dropped files to the desktop...
404// SendMessage(pDesktop->hDesktopWnd, message, wParam, lParam);
405 }
406 }
407 break;
408
409
410 //====================
411
412 case WM_LBUTTONDOWN:
413 case WM_LBUTTONUP:
414 case WM_RBUTTONDOWN:
415 case WM_RBUTTONUP:
416 case WM_MBUTTONDOWN:
417 case WM_MBUTTONUP:
418 case WM_XBUTTONDOWN:
419 case WM_XBUTTONUP:
420 case WM_MOUSEWHEEL:
421 case WM_MOUSEHWHEEL:
422 case WM_DROPFILES:
423 {
424 if (message == WM_LBUTTONUP)
425 {
426 POINT pt;
427 pt.x = LOWORD(lParam);
428 pt.y = HIWORD(lParam);
429
430 // Did the user click the maximize/restore button?
431 if (PtInRect(&pConsole->consoleZoomButtonRect, pt))
432 {
434 break;
435 }
436 }
437
438 // If not, we relay all mouse actions and drag'n'dropped files to the desktop...
439 pDesktop->MouseAndDropHandler(pDesktop->hDesktopWnd, message, wParam, lParam);
440 }
441 break;
442
443 //====================
444
445 default:
446 return DefWindowProc(hwnd,message,wParam,lParam);
447
448 //====================
449 }
450 return 0;
451}
LPSTR Tokenize(LPCSTR string, LPSTR buf, LPSTR delims)
Definition BBApi.cpp:273
bool IsInString(LPCSTR inputString, LPCSTR searchString)
Definition BBApi.cpp:2519
HINSTANCE BBExecute(HWND Owner, LPCSTR szOperation, LPCSTR szCommand, LPCSTR szArgs, LPCSTR szDirectory, int nShowCmd, bool noErrorMsgs)
Definition BBApi.cpp:1648
#define BB_TOGGLECONSOLE
Definition BBApi.h:173
#define BB_CONSOLEMESSAGE
Definition BBApi.h:165
#define BB_RECONFIGURE
Definition BBApi.h:147
#define CONSOLE_SHELL_MESSAGE
Definition BBApi.h:301
#define CONSOLE_ERROR_MESSAGE
Definition BBApi.h:300
#define MAX_LINE_LENGTH
Definition BBApi.h:64
#define CONSOLE_INFORMATION_MESSAGE
Definition BBApi.h:298
#define CONSOLE_WARNING_MESSAGE
Definition BBApi.h:299
Console * pConsole
Definition Blackbox.cpp:36
struct messageListItem messageListItem
void ToggleMaximized()
Definition Console.cpp:1043
LRESULT MouseAndDropHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition Desktop.cpp:1058

Member Data Documentation

◆ hConsoleInstance

HINSTANCE Console::hConsoleInstance

◆ hBlackboxWnd

HWND Console::hBlackboxWnd

◆ hConsoleWnd

HWND Console::hConsoleWnd

◆ cachedBackground

HDC Console::cachedBackground

◆ ScreenWidth

int Console::ScreenWidth

◆ ScreenHeight

int Console::ScreenHeight

◆ ConsoleX

int Console::ConsoleX

◆ ConsoleY

int Console::ConsoleY

◆ ConsoleWidth

int Console::ConsoleWidth

◆ ConsoleHeight

int Console::ConsoleHeight

◆ consoleTrueFontHeight

int Console::consoleTrueFontHeight

◆ lineSpacing

int Console::lineSpacing

◆ ConsoleHidden

bool Console::ConsoleHidden

◆ blockMessages

bool Console::blockMessages

◆ consoleZoomButtonRect

RECT Console::consoleZoomButtonRect

◆ consoleLockGlyphRect

RECT Console::consoleLockGlyphRect

◆ messageList

messageListVector Console::messageList

◆ messageToBlock

char Console::messageToBlock[MAX_LINE_LENGTH]