Skip to content
This repository was archived by the owner on Jul 18, 2018. It is now read-only.

Window pixel size #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 31 additions & 6 deletions ConEmu/src/ConEmu/ConEmu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1223,8 +1223,8 @@ RECT CConEmuMain::GetDefaultRect()
gpConEmu->wndX = rcWnd.left;
gpConEmu->wndY = rcWnd.top;
RECT rcCon = CalcRect(CER_CONSOLE_ALL, rcWnd, CER_MAIN);
gpConEmu->wndWidth = rcCon.right;
gpConEmu->wndHeight = rcCon.bottom;
gpConEmu->wndWidth = gpSet->isPixelSize ? rcWnd.right : rcCon.right;
gpConEmu->wndHeight = gpSet->isPixelSize ? rcWnd.bottom : rcCon.bottom;

OnMoving(&rcWnd);

Expand Down Expand Up @@ -4110,7 +4110,10 @@ void CConEmuMain::StoreNormalRect(RECT* prcWnd)
// ��� ��� � TextWidth/TextHeight �� ���������
//-- gpSetCls->UpdateSize(mp_ VActive->TextWidth, mp_ VActive->TextHeight);
RECT rcAll = CVConGroup::AllTextRect();
gpSetCls->UpdateSize(rcAll.right, rcAll.bottom);
if (gpSet->isPixelSize)
gpSetCls->UpdateSize(rcNormal.right, rcNormal.bottom);
else
gpSetCls->UpdateSize(rcAll.right, rcAll.bottom);
}
}
}
Expand Down Expand Up @@ -4519,7 +4522,10 @@ bool CConEmuMain::SetWindowMode(ConEmuWindowMode inMode, BOOL abForce /*= FALSE*
}
else
{
rcNew = CalcRect(CER_MAIN, consoleSize, CER_CONSOLE_ALL);
if (gpSet->isPixelSize)
rcNew = consoleSize;
else
rcNew = CalcRect(CER_MAIN, consoleSize, CER_CONSOLE_ALL);
//int nWidth = rcNew.right-rcNew.left;
//int nHeight = rcNew.bottom-rcNew.top;
//rcNew.left+=gpConEmu->wndX; rcNew.top+=gpConEmu->wndY;
Expand Down Expand Up @@ -5162,6 +5168,12 @@ void CConEmuMain::OnConsoleResize(BOOL abPosted/*=FALSE*/)
return; // ���� �������������� - ������ �� ������
}

//update window size
if (gpSet->isPixelSize) {
RECT rcClient; GetWindowRect(ghWnd, &rcClient);
gpSetCls->UpdateSize(rcClient.right, rcClient.bottom);
}

// ���� �� �������� ��������� ��������?
BOOL lbSizingToDo = (mouse.state & MOUSE_SIZING_TODO) == MOUSE_SIZING_TODO;
bool lbIsSizing = isSizing();
Expand Down Expand Up @@ -5366,7 +5378,11 @@ LRESULT CConEmuMain::OnSizing(WPARAM wParam, LPARAM lParam)
// ���������� �������� ������ �������
//srctWindow = ConsoleSizeFromWindow(&wndSizeRect, true /* frameIncluded */);
AutoSizeFont(wndSizeRect, CER_MAIN);
srctWindow = CalcRect(CER_CONSOLE_ALL, wndSizeRect, CER_MAIN);
if (gpSet->isPixelSize)
srctWindow = wndSizeRect;
else
srctWindow = CalcRect(CER_CONSOLE_ALL, wndSizeRect, CER_MAIN);


// ���������� ���������� ������� �������
if (srctWindow.right < MIN_CON_WIDTH)
Expand Down Expand Up @@ -10946,7 +10962,16 @@ HMONITOR CConEmuMain::GetNearestMonitor(MONITORINFO* pmi /*= NULL*/, LPRECT prcW
{
_ASSERTE(gpConEmu->wndWidth>0 && gpConEmu->wndHeight>0);
COORD conSize = MakeCoord(gpConEmu->wndWidth,gpConEmu->wndHeight);
RECT rcEvalWnd = MakeRect(gpConEmu->wndX, gpConEmu->wndY, gpConEmu->wndX + conSize.X * gpSetCls->FontWidth(), gpConEmu->wndY + conSize.Y * gpSetCls->FontHeight());
int width, height;
if (gpSet->isPixelSize) {
width = gpConEmu->wndWidth;
height = gpConEmu->wndHeight;
}
else {
width = conSize.X * gpSetCls->FontWidth();
height = conSize.Y * gpSetCls->FontHeight();
}
RECT rcEvalWnd = MakeRect(gpConEmu->wndX, gpConEmu->wndY, gpConEmu->wndX + width, gpConEmu->wndY + height);

hMon = MonitorFromRect(&rcEvalWnd, MONITOR_DEFAULTTONEAREST);
}
Expand Down
27 changes: 14 additions & 13 deletions ConEmu/src/ConEmu/ConEmu.rc
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// Russian resources
// Russian (Russia) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
#ifdef _WIN32
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#pragma code_page(1251)
#endif //_WIN32

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -50,18 +48,16 @@ END

#endif // APSTUDIO_INVOKED

#endif // Russian resources
#endif // Russian (Russia) resources
/////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
// English (United States) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

/////////////////////////////////////////////////////////////////////////////
//
Expand Down Expand Up @@ -188,29 +184,30 @@ BEGIN
RTEXT "Y:",IDC_STATIC,252,65,10,8
RTEXT "Width:",stWndWidth,14,65,25,8
RTEXT "Height:",stWndHeight,90,65,29,8
GROUPBOX "Window size (cells)",IDC_STATIC,10,37,166,46
GROUPBOX "Window size",IDC_STATIC,10,37,166,46
GROUPBOX "Window position (pixels)",IDC_STATIC,185,37,130,46
GROUPBOX "Console buffer height",IDC_STATIC,10,85,166,32
CONTROL "Long console output",cbLongOutput,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,99,83,8
EDITTEXT tLongOutputHeight,122,97,39,12,ES_AUTOHSCROLL
RTEXT "16bit height:",IDC_STATIC,190,99,71,8
COMBOBOX lbNtvdmHeight,265,96,43,30,CBS_DROPDOWNLIST | WS_TABSTOP
CONTROL "Show && store current window size and position",cbUseCurrentSizePos,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,13,258,8
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,13,168,8
GROUPBOX "DOS applications (ntvdm)",IDC_STATIC,185,85,130,32
CONTROL "Center console in ConEmu workspace",cbTryToCenter,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,131,149,8
RTEXT "Pad size:",IDC_STATIC,156,131,45,8
EDITTEXT tPadSize,206,130,43,12,ES_AUTOHSCROLL
GROUPBOX "Alignment",IDC_STATIC,9,119,306,42
LTEXT "pixels",IDC_STATIC,253,131,45,8
CONTROL "Snap to desktop edges",cbSnapToDesktopEdges,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,145,141,8
CONTROL "Snap to desktop edges",cbSnapToDesktopEdges,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,145,141,8
GROUPBOX "FullScreen mode",IDC_STATIC,9,195,306,29,NOT WS_VISIBLE | WS_DISABLED
CONTROL "Hide tab && status bars",cbFullscreenNoBars,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,17,208,100,8
CONTROL "Fixed console size",cbFullscreenFixedConSize,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,123,208,83,8
EDITTEXT tFullScreenWidth,210,206,39,12,ES_AUTOHSCROLL | NOT WS_VISIBLE | WS_DISABLED
EDITTEXT tFullScreenHeight,269,206,39,12,ES_AUTOHSCROLL | NOT WS_VISIBLE | WS_DISABLED
CTEXT "x",IDC_STATIC,255,207,8,8,NOT WS_VISIBLE | WS_DISABLED
CONTROL "Use pixel window size",cbPixelSize,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,177,13,84,8
END

IDD_SPG_SHOW DIALOGEX 0, 0, 328, 235
Expand Down Expand Up @@ -980,7 +977,7 @@ BEGIN
CONTROL "Restore on Far startup",cbThumbRestoreOnStartup,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,214,134,101,10
END

IDD_MORE_CONFONT DIALOG 0, 0, 236, 156
IDD_MORE_CONFONT DIALOG 0, 0, 236, 156
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Real console font"
FONT 8, "MS Sans Serif"
Expand Down Expand Up @@ -1307,7 +1304,7 @@ END
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
GUIDELINES DESIGNINFO
BEGIN
IDD_CMDPROMPT, DIALOG
BEGIN
Expand All @@ -1325,6 +1322,10 @@ BEGIN
BOTTOMMARGIN, 181
END

IDD_SPG_WNDSIZEPOS, DIALOG
BEGIN
END

IDD_SPG_COLORS, DIALOG
BEGIN
BOTTOMMARGIN, 234
Expand Down Expand Up @@ -1422,7 +1423,7 @@ IDI_ICON1 ICON "ConEmu.ico"
IDI_ICON2 ICON "Far.ico"
IDI_ICON3 ICON "Far2.ico"
IDI_SHIELD ICON "shield.ico"
#endif // English (U.S.) resources
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////


Expand Down
9 changes: 6 additions & 3 deletions ConEmu/src/ConEmu/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ void Settings::InitSettings()
_wndX = rcWork.left; _wndY = rcWork.top;
}
wndCascade = true;
isAutoSaveSizePos = false; mb_SizePosAutoSaved = false;
isAutoSaveSizePos = false; mb_SizePosAutoSaved = false; isPixelSize = false;
isConVisible = false; //isLockRealConsolePos = false;
isUseInjects = false; // ����... Disclaimer#2

Expand Down Expand Up @@ -2536,6 +2536,7 @@ void Settings::LoadSettings(bool *rbNeedCreateVanilla)
reg->Load(L"ConWnd X", _wndX); /*if (wndX<-10) wndX = 0;*/
reg->Load(L"ConWnd Y", _wndY); /*if (wndY<-10) wndY = 0;*/
reg->Load(L"AutoSaveSizePos", isAutoSaveSizePos);
reg->Load(L"PixelSize", isPixelSize);
// ��� �� ������ �� szDefCmd. ������ ������ �������� ������ "/BufferHeight N"
// ����� ������� (�������������) ������� ������� �� "cmd" ��� "far"
reg->Load(L"Cascaded", wndCascade);
Expand All @@ -2548,8 +2549,8 @@ void Settings::LoadSettings(bool *rbNeedCreateVanilla)
gpConEmu->LogString(szInfo);
}

if (!_wndWidth) _wndWidth = 80; else if (_wndWidth>1000) _wndWidth = 1000;
if (!_wndHeight) _wndHeight = 25; else if (_wndHeight>500) _wndHeight = 500;
if (!_wndWidth) _wndWidth = gpSet->isPixelSize ? 80 * gpSetCls->FontWidth() : 80; else if (!gpSet->isPixelSize && _wndWidth>1000) _wndWidth = 1000;
if (!_wndHeight) _wndHeight = gpSet->isPixelSize ? 25 * gpSetCls->FontHeight() : 25; else if (!gpSet->isPixelSize && _wndHeight>500) _wndHeight = 500;

//TODO: ��� ��� ��������� �� �����������
reg->Load(L"16bit Height", ntvdmHeight);
Expand Down Expand Up @@ -3097,6 +3098,7 @@ void Settings::SaveSizePosOnExit()
reg->Save(L"ConWnd Y", isUseCurrentSizePos ? gpConEmu->wndY : _wndY);
reg->Save(L"16bit Height", ntvdmHeight);
reg->Save(L"AutoSaveSizePos", isAutoSaveSizePos);
reg->Save(L"PixelSize", isPixelSize);
}

if (mb_StatusSettingsWasChanged)
Expand Down Expand Up @@ -3445,6 +3447,7 @@ BOOL Settings::SaveSettings(BOOL abSilent /*= FALSE*/, const SettingsStorage* ap
reg->Save(L"ConWnd Y", isUseCurrentSizePos ? gpConEmu->wndY : _wndY);
reg->Save(L"16bit Height", ntvdmHeight);
reg->Save(L"AutoSaveSizePos", isAutoSaveSizePos);
reg->Save(L"PixelSize", isPixelSize);
mb_SizePosAutoSaved = false; // ��� ���� �������������� ������������� ���������� �������� - ������� ������
reg->Save(L"QuakeStyle", isQuakeStyle);
reg->Save(L"QuakeAnimation", nQuakeAnimation);
Expand Down
1 change: 1 addition & 0 deletions ConEmu/src/ConEmu/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,7 @@ struct Settings
bool isAutoSaveSizePos;
//reg->Load(L"UseCurrentSizePos", isUseCurrentSizePos);
bool isUseCurrentSizePos; // Show in settings dialog and save current window size/pos
bool isPixelSize; // Use pixel window size

bool isIntegralSize();

Expand Down
5 changes: 5 additions & 0 deletions ConEmu/src/ConEmu/OptionsClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1999,6 +1999,8 @@ LRESULT CSettings::OnInitDialog_WndPosSize(HWND hWnd2, bool abInitial)

checkDlgButton(hWnd2, cbUseCurrentSizePos, gpSet->isUseCurrentSizePos);

checkDlgButton(hWnd2, cbPixelSize, gpSet->isPixelSize);

if (gpSet->isQuakeStyle || !gpSet->isUseCurrentSizePos)
checkRadioButton(hWnd2, rNormal, rFullScreen, gpSet->_WindowMode);
else if (gpConEmu->isFullScreen())
Expand Down Expand Up @@ -4575,6 +4577,9 @@ LRESULT CSettings::OnButtonClicked(HWND hWnd2, WPARAM wParam, LPARAM lParam)
case cbAutoSaveSizePos:
gpSet->isAutoSaveSizePos = IsChecked(hWnd2, cbAutoSaveSizePos);
break;
case cbPixelSize:
gpSet->isPixelSize = IsChecked(hWnd2, cbPixelSize);
break;
case cbFontAuto:
gpSet->isFontAutoSize = IsChecked(hWnd2, cbFontAuto);

Expand Down
1 change: 1 addition & 0 deletions ConEmu/src/ConEmu/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@
#define cbExtendUCharMap 1722
#define cbAutoSaveSizePos 1723
#define bDosBoxSettings 1724
#define cbPixelSize 1724
#define cbShellNoZoneCheck 1725
#define bConFontCancel 1726
#define tConsoleFontFace 1727
Expand Down