|
|
@ -40,7 +40,7 @@ using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
namespace NLMISC {
|
|
|
|
namespace NLMISC {
|
|
|
|
|
|
|
|
|
|
|
|
static CHARFORMAT2 CharFormat;
|
|
|
|
static CHARFORMAT2A CharFormat;
|
|
|
|
|
|
|
|
|
|
|
|
CWinDisplayer::CWinDisplayer(const char *displayerName) : CWindowDisplayer(displayerName), Exit(false)
|
|
|
|
CWinDisplayer::CWinDisplayer(const char *displayerName) : CWindowDisplayer(displayerName), Exit(false)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -221,7 +221,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
ucs.fromUtf8(cwd->_History[cwd->_PosInHistory]);
|
|
|
|
ucs.fromUtf8(cwd->_History[cwd->_PosInHistory]);
|
|
|
|
// set the text as unicode string
|
|
|
|
// set the text as unicode string
|
|
|
|
SetWindowTextW(cwd->_HInputEdit, (LPCWSTR)ucs.c_str());
|
|
|
|
SetWindowTextW(cwd->_HInputEdit, (LPCWSTR)ucs.c_str());
|
|
|
|
SendMessage (cwd->_HInputEdit, EM_SETSEL, (WPARAM)ucs.size(), (LPARAM)ucs.size());
|
|
|
|
SendMessageA (cwd->_HInputEdit, EM_SETSEL, (WPARAM)ucs.size(), (LPARAM)ucs.size());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (pmf->wParam == VK_DOWN)
|
|
|
|
else if (pmf->wParam == VK_DOWN)
|
|
|
@ -238,7 +238,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
ucs.fromUtf8(cwd->_History[cwd->_PosInHistory]);
|
|
|
|
ucs.fromUtf8(cwd->_History[cwd->_PosInHistory]);
|
|
|
|
// set the text as unicode string
|
|
|
|
// set the text as unicode string
|
|
|
|
SetWindowTextW(cwd->_HInputEdit, (LPCWSTR)ucs.c_str());
|
|
|
|
SetWindowTextW(cwd->_HInputEdit, (LPCWSTR)ucs.c_str());
|
|
|
|
SendMessage (cwd->_HInputEdit, EM_SETSEL, (WPARAM)ucs.size(), (LPARAM)ucs.size());
|
|
|
|
SendMessageA (cwd->_HInputEdit, EM_SETSEL, (WPARAM)ucs.size(), (LPARAM)ucs.size());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -268,7 +268,7 @@ void CWinDisplayer::updateLabels ()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
access.value()[i].Hwnd = CreateWindowW (L"STATIC", L"", WS_CHILD | WS_VISIBLE | SS_SIMPLE, 0, 0, 0, 0, _HWnd, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL);
|
|
|
|
access.value()[i].Hwnd = CreateWindowW (L"STATIC", L"", WS_CHILD | WS_VISIBLE | SS_SIMPLE, 0, 0, 0, 0, _HWnd, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SendMessage ((HWND)access.value()[i].Hwnd, WM_SETFONT, (WPARAM)_HFont, TRUE);
|
|
|
|
SendMessageA ((HWND)access.value()[i].Hwnd, WM_SETFONT, (WPARAM)_HFont, TRUE);
|
|
|
|
needResize = true;
|
|
|
|
needResize = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -427,14 +427,14 @@ void CWinDisplayer::open (string titleBar, bool iconified, sint x, sint y, sint
|
|
|
|
dwStyle |= WS_HSCROLL;
|
|
|
|
dwStyle |= WS_HSCROLL;
|
|
|
|
|
|
|
|
|
|
|
|
_HEdit = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW, RICHEDIT_CLASSW, L"", dwStyle, 0, _ToolBarHeight, w, h-_ToolBarHeight-_InputEditHeight, _HWnd, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL);
|
|
|
|
_HEdit = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW, RICHEDIT_CLASSW, L"", dwStyle, 0, _ToolBarHeight, w, h-_ToolBarHeight-_InputEditHeight, _HWnd, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL);
|
|
|
|
SendMessage (_HEdit, WM_SETFONT, (WPARAM)_HFont, TRUE);
|
|
|
|
SendMessageA (_HEdit, WM_SETFONT, (WPARAM)_HFont, TRUE);
|
|
|
|
|
|
|
|
|
|
|
|
// set the edit text limit to lot of :)
|
|
|
|
// set the edit text limit to lot of :)
|
|
|
|
SendMessage (_HEdit, EM_LIMITTEXT, -1, 0);
|
|
|
|
SendMessageA (_HEdit, EM_LIMITTEXT, -1, 0);
|
|
|
|
|
|
|
|
|
|
|
|
CharFormat.cbSize = sizeof(CharFormat);
|
|
|
|
CharFormat.cbSize = sizeof(CharFormat);
|
|
|
|
CharFormat.dwMask = CFM_COLOR;
|
|
|
|
CharFormat.dwMask = CFM_COLOR;
|
|
|
|
SendMessage(_HEdit,EM_GETCHARFORMAT,(WPARAM)0,(LPARAM)&CharFormat);
|
|
|
|
SendMessageA(_HEdit,EM_GETCHARFORMAT,(WPARAM)0,(LPARAM)&CharFormat);
|
|
|
|
CharFormat.dwEffects &= ~CFE_AUTOCOLOR;
|
|
|
|
CharFormat.dwEffects &= ~CFE_AUTOCOLOR;
|
|
|
|
|
|
|
|
|
|
|
|
// create the input edit control
|
|
|
|
// create the input edit control
|
|
|
@ -445,7 +445,7 @@ void CWinDisplayer::open (string titleBar, bool iconified, sint x, sint y, sint
|
|
|
|
|
|
|
|
|
|
|
|
LRESULT dwEvent = SendMessageW(_HInputEdit, EM_GETEVENTMASK, (WPARAM)0, (LPARAM)0);
|
|
|
|
LRESULT dwEvent = SendMessageW(_HInputEdit, EM_GETEVENTMASK, (WPARAM)0, (LPARAM)0);
|
|
|
|
dwEvent |= ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE;
|
|
|
|
dwEvent |= ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE;
|
|
|
|
SendMessage(_HInputEdit, EM_SETEVENTMASK, (WPARAM)0, (LPARAM)dwEvent);
|
|
|
|
SendMessageA(_HInputEdit, EM_SETEVENTMASK, (WPARAM)0, (LPARAM)dwEvent);
|
|
|
|
|
|
|
|
|
|
|
|
// resize the window
|
|
|
|
// resize the window
|
|
|
|
RECT rc;
|
|
|
|
RECT rc;
|
|
|
@ -477,8 +477,8 @@ void CWinDisplayer::clear ()
|
|
|
|
bool focus = (GetFocus() == _HEdit);
|
|
|
|
bool focus = (GetFocus() == _HEdit);
|
|
|
|
if (focus)
|
|
|
|
if (focus)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SendMessage(_HEdit,EM_SETOPTIONS,ECOOP_AND,(LPARAM)~ECO_AUTOVSCROLL);
|
|
|
|
SendMessageA(_HEdit,EM_SETOPTIONS,ECOOP_AND,(LPARAM)~ECO_AUTOVSCROLL);
|
|
|
|
SendMessage(_HEdit,EM_SETOPTIONS,ECOOP_AND,(LPARAM)~ECO_AUTOHSCROLL);
|
|
|
|
SendMessageA(_HEdit,EM_SETOPTIONS,ECOOP_AND,(LPARAM)~ECO_AUTOHSCROLL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// get number of line
|
|
|
|
// get number of line
|
|
|
@ -534,13 +534,13 @@ void CWinDisplayer::display_main ()
|
|
|
|
bool focus = (GetFocus() == _HEdit);
|
|
|
|
bool focus = (GetFocus() == _HEdit);
|
|
|
|
if (focus)
|
|
|
|
if (focus)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SendMessage(_HEdit,EM_SETOPTIONS,ECOOP_AND,(LPARAM)~ECO_AUTOVSCROLL);
|
|
|
|
SendMessageA(_HEdit,EM_SETOPTIONS,ECOOP_AND,(LPARAM)~ECO_AUTOVSCROLL);
|
|
|
|
SendMessage(_HEdit,EM_SETOPTIONS,ECOOP_AND,(LPARAM)~ECO_AUTOHSCROLL);
|
|
|
|
SendMessageA(_HEdit,EM_SETOPTIONS,ECOOP_AND,(LPARAM)~ECO_AUTOHSCROLL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// store old selection
|
|
|
|
// store old selection
|
|
|
|
DWORD startSel, endSel;
|
|
|
|
DWORD startSel, endSel;
|
|
|
|
SendMessage (_HEdit, EM_GETSEL, (WPARAM)&startSel, (LPARAM)&endSel);
|
|
|
|
SendMessageA (_HEdit, EM_GETSEL, (WPARAM)&startSel, (LPARAM)&endSel);
|
|
|
|
|
|
|
|
|
|
|
|
// find how many lines we have to remove in the current output to add new lines
|
|
|
|
// find how many lines we have to remove in the current output to add new lines
|
|
|
|
|
|
|
|
|
|
|
@ -554,7 +554,7 @@ void CWinDisplayer::display_main ()
|
|
|
|
|
|
|
|
|
|
|
|
if (nblineremove == _HistorySize)
|
|
|
|
if (nblineremove == _HistorySize)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SendMessage (_HEdit, WM_SETTEXT, 0, (LPARAM) "");
|
|
|
|
SendMessageA (_HEdit, WM_SETTEXT, 0, (LPARAM) "");
|
|
|
|
startSel = endSel = -1;
|
|
|
|
startSel = endSel = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -594,13 +594,13 @@ void CWinDisplayer::display_main ()
|
|
|
|
str += ucstring::makeFromUtf8((*it).second);
|
|
|
|
str += ucstring::makeFromUtf8((*it).second);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SendMessage (_HEdit, EM_SETSEL, -1, -1);
|
|
|
|
SendMessageA(_HEdit, EM_SETSEL, -1, -1);
|
|
|
|
|
|
|
|
|
|
|
|
if ((col>>24) == 0)
|
|
|
|
if ((col>>24) == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// there s a specific color
|
|
|
|
// there s a specific color
|
|
|
|
CharFormat.crTextColor = RGB ((col>>16)&0xFF, (col>>8)&0xFF, col&0xFF);
|
|
|
|
CharFormat.crTextColor = RGB ((col>>16)&0xFF, (col>>8)&0xFF, col&0xFF);
|
|
|
|
SendMessage((HWND) _HEdit, EM_SETCHARFORMAT, (WPARAM) SCF_SELECTION, (LPARAM) &CharFormat);
|
|
|
|
SendMessageA(_HEdit, EM_SETCHARFORMAT, (WPARAM) SCF_SELECTION, (LPARAM) &CharFormat);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// add the string to the edit control
|
|
|
|
// add the string to the edit control
|
|
|
@ -608,17 +608,17 @@ void CWinDisplayer::display_main ()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// restore old selection
|
|
|
|
// restore old selection
|
|
|
|
SendMessage (_HEdit, EM_SETSEL, startSel, endSel);
|
|
|
|
SendMessageA(_HEdit, EM_SETSEL, startSel, endSel);
|
|
|
|
|
|
|
|
|
|
|
|
SendMessage(_HEdit,EM_SETMODIFY,(WPARAM)TRUE,(LPARAM)0);
|
|
|
|
SendMessageA(_HEdit,EM_SETMODIFY,(WPARAM)TRUE,(LPARAM)0);
|
|
|
|
|
|
|
|
|
|
|
|
if (bottom)
|
|
|
|
if (bottom)
|
|
|
|
SendMessage(_HEdit,WM_VSCROLL,(WPARAM)SB_BOTTOM,(LPARAM)0L);
|
|
|
|
SendMessageA(_HEdit,WM_VSCROLL,(WPARAM)SB_BOTTOM,(LPARAM)0L);
|
|
|
|
|
|
|
|
|
|
|
|
if (focus)
|
|
|
|
if (focus)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SendMessage(_HEdit,EM_SETOPTIONS,ECOOP_OR,(LPARAM)ECO_AUTOVSCROLL);
|
|
|
|
SendMessageA(_HEdit,EM_SETOPTIONS,ECOOP_OR,(LPARAM)ECO_AUTOVSCROLL);
|
|
|
|
SendMessage(_HEdit,EM_SETOPTIONS,ECOOP_OR,(LPARAM)ECO_AUTOHSCROLL);
|
|
|
|
SendMessageA(_HEdit,EM_SETOPTIONS,ECOOP_OR,(LPARAM)ECO_AUTOHSCROLL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|