Skip to content

Commit

Permalink
Internal. WINDOW_LONG_FADE refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximus5 committed Jul 11, 2020
1 parent 34fd722 commit 611d621
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/ConEmu/VirtualConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4866,10 +4866,10 @@ bool CVirtualConsole::UpdatePanelView(bool abLeftPanel, bool abOnRegister/*=fals
if (!mn_ConEmuFadeMsg)
mn_ConEmuFadeMsg = RegisterWindowMessage(CONEMUMSG_PNLVIEWFADE);

LONG nNewFadeValue = isFade ? 2 : 1;
const auto nNewFadeValue = static_cast<LONG>(isFade ? ConEmuPanelViewFade::Fade : ConEmuPanelViewFade::Normal);
WARNING("Нифига не будет работать на Win7 RunAsAdmin");

if (GetWindowLong(pp->hWnd, 16*4) != nNewFadeValue)
if (GetWindowLong(pp->hWnd, PANEL_VIEW_WINDOW_LONG_FADE) != nNewFadeValue)
PostMessage(pp->hWnd, mn_ConEmuFadeMsg, 100, nNewFadeValue);

// Подготовить размеры
Expand Down
18 changes: 8 additions & 10 deletions src/ConEmuTh/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ MFileLog* gpLogLoad = NULL;
MFileLog* gpLogPaint = NULL;
#endif

#define WINDOW_LONG_FADE (16*sizeof(DWORD))

void ResetUngetBuffer();
int ShowLastError();

Expand Down Expand Up @@ -271,7 +269,7 @@ HWND CeFullPanelInfo::CreateView()

LRESULT CALLBACK CeFullPanelInfo::DisplayWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
switch (uMsg)
{
case WM_CREATE:
{
Expand All @@ -280,8 +278,8 @@ LRESULT CALLBACK CeFullPanelInfo::DisplayWndProc(HWND hwnd, UINT uMsg, WPARAM wP
_ASSERTE(pi && pi->cbSize==sizeof(CeFullPanelInfo));
_ASSERTE(pi == (&pviLeft) || pi == (&pviRight));
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pi); //-V107
TODO("Вроде WINDOW_LONG_FADE не используется нигде?");
SetWindowLong(hwnd, WINDOW_LONG_FADE, 1); // Fade == false
SetWindowLong(hwnd, PANEL_VIEW_WINDOW_LONG_FADE,
static_cast<LONG>(ConEmuPanelViewFade::Normal)); // Fade == false
return 0; //continue creation
}
#ifdef _DEBUG
Expand Down Expand Up @@ -459,9 +457,7 @@ LRESULT CALLBACK CeFullPanelInfo::DisplayWndProc(HWND hwnd, UINT uMsg, WPARAM wP

if (uMsg == gnConEmuFadeMsg)
{
TODO("Вроде WINDOW_LONG_FADE не используется нигде?");
SetWindowLong(hwnd, WINDOW_LONG_FADE, (DWORD)lParam);

SetWindowLong(hwnd, PANEL_VIEW_WINDOW_LONG_FADE, static_cast<LONG>(lParam));
RefreshPalette(lParam == static_cast<LPARAM>(ConEmuPanelViewFade::Fade));
return 0;
}
Expand Down Expand Up @@ -1844,11 +1840,13 @@ int CeFullPanelInfo::RegisterPanelView()
// gcrFadeColors[i] = pvi.crFadePalette[i];
//}
this->WorkRect = pvi.WorkRect;

// Are we active? We should, during plugin activation
const auto isFade = pvi.bFadeColors != FALSE;
const auto& palette = RefreshPalette(isFade);
TODO("Вроде WINDOW_LONG_FADE не используется нигде?");
SetWindowLong(this->hView, WINDOW_LONG_FADE, gbFadeColors ? 2 : 1);
SetWindowLong(this->hView, PANEL_VIEW_WINDOW_LONG_FADE,
static_cast<LONG>(isFade ? ConEmuPanelViewFade::Fade : ConEmuPanelViewFade::Normal));

// Подготовить детектор диалогов
_ASSERTE(gpRgnDetect!=NULL);
SMALL_RECT rcFarRect; GetFarRect(&rcFarRect);
Expand Down
9 changes: 9 additions & 0 deletions src/common/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,15 @@ typedef struct _CONSOLE_SELECTION_INFO
//#define CONEMUMSG_PNLVIEWLBTNDOWN L"ConEmuTh::LBtnDown"
#define CONEMUMSG_RESTORECHILDFOCUS L"ConEmu::RestoreChildFocus"


constexpr int PANEL_VIEW_WINDOW_LONG_FADE = static_cast<int>(16 * sizeof(DWORD));

enum class ConEmuPanelViewFade
{
Normal = 1, // normal, bright colors
Fade = 2, // fade colors, when ConEmu is out of focus and fade option is enabled
};

// Команды из плагина ConEmu и для GUI Macro
enum ConEmuTabCommand
{
Expand Down

0 comments on commit 611d621

Please sign in to comment.