msg = WM_CTLCOLOREDIT;
/* why do we notify to es->hwndParent, and we send this one to GetParent()? */
- hbrush = GetControlBrush(es->hwndSelf, hdc, msg); // reactos r54259
+#ifdef __REACTOS__
+ /* ReactOS r54259 */
+ hbrush = GetControlBrush(es->hwndSelf, hdc, msg);
+#else
+ hbrush = (HBRUSH)SendMessageW(GetParent(es->hwndSelf), msg, (WPARAM)hdc, (LPARAM)es->hwndSelf);
+ if (!hbrush)
+ hbrush = (HBRUSH)DefWindowProcW(GetParent(es->hwndSelf), msg, (WPARAM)hdc, (LPARAM)es->hwndSelf);
+#endif
return hbrush;
}
* EDIT_WordBreakProc
*
* Find the beginning of words.
- * Note: unlike the specs for a WordBreakProc, this function only
- * allows to be called without linebreaks between s[0] up to
+ * Note: unlike the specs for a WordBreakProc, this function can
+ * only be called without linebreaks between s[0] up to
* s[count - 1]. Remember it is only called
* internally, so we can decide this for ourselves.
- * Additional we will always be breaking the full string.
+ * Additionally we will always be breaking the full string.
*
*/
static INT EDIT_WordBreakProc(EDITSTATE *es, LPWSTR s, INT index, INT count, INT action)
countA = WideCharToMultiByte(CP_ACP, 0, es->text + start, count, NULL, 0, NULL, NULL);
textA = HeapAlloc(GetProcessHeap(), 0, countA);
- if (textA == NULL) return 0; // reactos r33503
+#ifdef __REACTOS__
+ /* ReactOS r33503 */
+ if (textA == NULL) return 0;
+#endif
WideCharToMultiByte(CP_ACP, 0, es->text + start, count, textA, countA, NULL, NULL);
TRACE_(relay)("(ANSI wordbrk=%p,str=%s,idx=%d,cnt=%d,act=%d)\n",
es->word_break_proc, debugstr_an(textA, countA), index, countA, action);
tabdef.iScale = 0;
tabdef.pTabStops = es->tabs;
tabdef.iTabOrigin = 0;
- //// ReactOS r57679
+
hr = ScriptStringAnalyse(udc, &es->text[index], line_def->net_length,
- (3*line_def->net_length/2+16), -1,
- SSA_LINK|SSA_FALLBACK|SSA_GLYPHS|SSA_TAB, -1,
- NULL, NULL, NULL, &tabdef, NULL, &line_def->ssa);
- ////
+#ifdef __REACTOS__
+ /* ReactOS r57679 */
+ (3*line_def->net_length/2+16), -1,
+#else
+ (1.5*line_def->net_length+16), -1,
+#endif
+ SSA_LINK|SSA_FALLBACK|SSA_GLYPHS|SSA_TAB, -1,
+ NULL, NULL, NULL, &tabdef, NULL, &line_def->ssa);
if (FAILED(hr))
{
- WARN("ScriptStringAnalyse failed (%x)\n",hr);
- line_def->ssa = NULL;
- }
-
- if (es->font)
+ WARN("ScriptStringAnalyse failed (%x)\n",hr);
+ line_def->ssa = NULL;
+ }
+
+ if (es->font)
SelectObject(udc, old_font);
if (udc != dc)
ReleaseDC(es->hwndSelf, udc);
return line_def->ssa;
}
-static inline INT get_vertical_line_count(EDITSTATE *es)
-{
- INT vlc = (es->format_rect.bottom - es->format_rect.top) / es->line_height;
- return max(1,vlc);
-}
-
static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData(EDITSTATE *es, HDC dc, INT line)
{
LINEDEF *line_def;
udc = GetDC(es->hwndSelf);
if (es->font)
old_font = SelectObject(udc, es->font);
- //// ReactOS r57677
+
if (es->style & ES_PASSWORD)
+#ifdef __REACTOS__
+ /* ReactOS r57677 */
ScriptStringAnalyse(udc, &es->password_char, length, (3*length/2+16), -1, SSA_LINK|SSA_FALLBACK|SSA_GLYPHS|SSA_PASSWORD, -1, NULL, NULL, NULL, NULL, NULL, &es->ssa);
+#else
+ ScriptStringAnalyse(udc, &es->password_char, length, (1.5*length+16), -1, SSA_LINK|SSA_FALLBACK|SSA_GLYPHS|SSA_PASSWORD, -1, NULL, NULL, NULL, NULL, NULL, &es->ssa);
+#endif
else
+#ifdef __REACTOS__
+ /* ReactOS r57677 */
ScriptStringAnalyse(udc, es->text, length, (3*length/2+16), -1, SSA_LINK|SSA_FALLBACK|SSA_GLYPHS, -1, NULL, NULL, NULL, NULL, NULL, &es->ssa);
- ////
+#else
+ ScriptStringAnalyse(udc, es->text, length, (1.5*length+16), -1, SSA_LINK|SSA_FALLBACK|SSA_GLYPHS, -1, NULL, NULL, NULL, NULL, NULL, &es->ssa);
+#endif
+
if (es->font)
SelectObject(udc, old_font);
if (udc != dc)
}
}
+static inline INT get_vertical_line_count(EDITSTATE *es)
+{
+ INT vlc = (es->format_rect.bottom - es->format_rect.top) / es->line_height;
+ return max(1,vlc);
+}
+
/*********************************************************************
*
* EDIT_BuildLineDefs_ML
/* The buffer has been expanded, create a new line and
insert it into the link list */
LINEDEF *new_line = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LINEDEF));
- if (new_line == NULL) // reactos r33509
- break; // reactos r33509
+#ifdef __REACTOS__
+ /* ReactOS r33509 */
+ if (new_line == NULL)
+ break;
+#endif
new_line->next = previous_line->next;
previous_line->next = new_line;
current_line = new_line;
while (*cp) {
if (*cp == '\n') break;
if ((*cp == '\r') && (*(cp + 1) == '\n'))
- break;
+ break;
cp++;
}
EDIT_InvalidateUniscribeData_linedef(current_line);
EDIT_UpdateUniscribeData_linedef(es, NULL, current_line);
if (current_line->ssa)
- {
- sz = ScriptString_pSize(current_line->ssa);
- /* Calculate line width */
- current_line->width = sz->cx;
- }
- else current_line->width = es->char_width * current_line->net_length;
+ {
+ sz = ScriptString_pSize(current_line->ssa);
+ /* Calculate line width */
+ current_line->width = sz->cx;
+ }
+ else current_line->width = es->char_width * current_line->net_length;
}
else current_line->width = 0;
prev = current_line->net_length - 1;
w = current_line->net_length;
d = (float)current_line->width/(float)fw;
- if (d > 1.2) d -= 0.2;
+ if (d > 1.2f) d -= 0.2f;
next = prev/d;
if (next >= prev) next = prev-1;
do {
EDIT_InvalidateUniscribeData_linedef(current_line);
EDIT_UpdateUniscribeData_linedef(es, NULL, current_line);
- if (current_line->ssa)
- {
- count = ScriptString_pcOutChars(current_line->ssa);
- piDx = HeapAlloc(GetProcessHeap(),0,sizeof(INT) * (*count));
- ScriptStringGetLogicalWidths(current_line->ssa,piDx);
-
- prev = current_line->net_length-1;
- do {
- current_line->width -= piDx[prev];
- prev--;
- } while ( prev > 0 && current_line->width > fw);
- if (prev<=0)
- prev = 1;
- HeapFree(GetProcessHeap(),0,piDx);
- }
- else
- prev = (fw / es->char_width);
+ if (current_line->ssa)
+ {
+ count = ScriptString_pcOutChars(current_line->ssa);
+ piDx = HeapAlloc(GetProcessHeap(),0,sizeof(INT) * (*count));
+ ScriptStringGetLogicalWidths(current_line->ssa,piDx);
+
+ prev = current_line->net_length-1;
+ do {
+ current_line->width -= piDx[prev];
+ prev--;
+ } while ( prev > 0 && current_line->width > fw);
+ if (prev<=0)
+ prev = 1;
+ HeapFree(GetProcessHeap(),0,piDx);
+ }
+ else
+ prev = (fw / es->char_width);
}
/* If the first line we are calculating, wrapped before istart, we must
if ((es->style & ES_CENTER) || (es->style & ES_RIGHT))
rc.left = es->format_rect.left;
else
- rc.left = LOWORD(EDIT_EM_PosFromChar(es, nstart_index, FALSE));
+ rc.left = LOWORD(EDIT_EM_PosFromChar(es, nstart_index, FALSE));
rc.right = es->format_rect.right;
SetRectRgn(hrgn, rc.left, rc.top, rc.right, rc.bottom);
if (!es->text) {
+#ifdef __REACTOS__
+/* FIXME: What is this ? */
CHAR *textA = NULL; // ReactOS Hacked! r45670
//UINT countA = 0;
if (textA) //// ReactOS
{
+#else
+ if(!es->hloc32W) return;
+
+ if(es->hloc32A)
+ {
+ CHAR *textA = LocalLock(es->hloc32A);
+#endif
HLOCAL hloc32W_new;
UINT countW_new = MultiByteToWideChar(CP_ACP, 0, textA, -1, NULL, 0);
if(countW_new > es->buffer_size + 1)
*/
static void EDIT_UnlockBuffer(EDITSTATE *es, BOOL force)
{
+ if (es->hlocapp) return;
/* Edit window might be already destroyed */
if(!IsWindow(es->hwndSelf))
TRACE("trying to ReAlloc to %d+1 characters\n", size);
- /* Force edit to unlock it's buffer. es->text now NULL */
+ /* Force edit to unlock its buffer. es->text now NULL */
EDIT_UnlockBuffer(es, TRUE);
if (es->hloc32W) {
es->text_width = 0;
/* Issue the EN_MAXTEXT notification and continue with replacing text
- * such that buffer limit is honored. */
+ * so that buffer limit is honored. */
if ((honor_limit) && (size > es->buffer_limit)) {
EDIT_NOTIFY_PARENT(es, EN_MAXTEXT);
/* Buffer limit can be smaller than the actual length of text in combobox */
es->buffer_size = LocalSize(es->hloc32W)/sizeof(WCHAR) - 1;
- /* The text buffer handle belongs to the control */
+ /* The text buffer handle belongs to the control */
es->hlocapp = NULL;
EDIT_LockBuffer(es);
- text_buffer_changed(es);
+ text_buffer_changed(es);
es->x_offset = es->y_offset = 0;
es->selection_start = es->selection_end = 0;
default_right_margin = tm.tmAveCharWidth / 2;
min_size = calc_min_set_margin_size(dc, default_left_margin, default_right_margin);
GetClientRect(es->hwndSelf, &rc);
- if(rc.right - rc.left < min_size) {
+ if (!IsRectEmpty(&rc) && (rc.right - rc.left < min_size)) {
default_left_margin = es->left_margin;
default_right_margin = es->right_margin;
}
es->tabs = NULL;
else {
es->tabs = HeapAlloc(GetProcessHeap(), 0, count * sizeof(INT));
- if (es->tabs == NULL) // reactos r33503
+#ifdef __REACTOS__
+ /* ReactOS r33503 */
+ if (es->tabs == NULL)
{
es->tabs_count = 0;
return FALSE;
- } // reactos r33503
+ }
+#endif
memcpy(es->tabs, tabs, count * sizeof(INT));
}
EDIT_InvalidateUniscribeData(es);
ulength = strlenW(es->undo_text);
utext = HeapAlloc(GetProcessHeap(), 0, (ulength + 1) * sizeof(WCHAR));
- if (utext == NULL) // reactos r33503
- return FALSE; // reactos r33503
+#ifdef __REACTOS__
+ /* ReactOS r33503 */
+ if (utext == NULL)
+ return FALSE;
+#endif
strcpyW(utext, es->undo_text);
return 1;
}
-#if 0 // Removed see Revision 43925 comments.
+
/*********************************************************************
*
- * WM_COMMAND
+ * EDIT_ContextMenuCommand
*
*/
-static void EDIT_WM_Command(EDITSTATE *es, INT code, INT id, HWND control)
+static void EDIT_ContextMenuCommand(EDITSTATE *es, UINT id)
{
- if (code || control)
- return;
-
switch (id) {
case EM_UNDO:
SendMessageW(es->hwndSelf, WM_UNDO, 0, 0);
SendMessageW(es->hwndSelf, WM_CLEAR, 0, 0);
break;
case EM_SETSEL:
- EDIT_EM_SetSel(es, 0, (UINT)-1, FALSE);
- EDIT_EM_ScrollCaret(es);
+ SendMessageW(es->hwndSelf, EM_SETSEL, 0, -1);
break;
default:
ERR("unknown menu item, please report\n");
break;
}
}
-#endif
/*********************************************************************
HMENU popup = GetSubMenu(menu, 0);
UINT start = es->selection_start;
UINT end = es->selection_end;
+ UINT cmd;
- BOOL selectedItem; // reactos r40667
ORDER_UINT(start, end);
/* undo */
{
RECT rc;
/* Windows places the menu at the edit's center in this case */
- // reactos r55202
+#ifdef __REACTOS__
+ /* ReactOS r55202 */
GetClientRect(es->hwndSelf, &rc);
MapWindowPoints(es->hwndSelf, 0, (POINT *)&rc, 2);
- //WIN_GetRectangles( es->hwndSelf, COORDS_SCREEN, NULL, &rc );
+#else
+ WIN_GetRectangles( es->hwndSelf, COORDS_SCREEN, NULL, &rc );
+#endif
x = rc.left + (rc.right - rc.left) / 2;
y = rc.top + (rc.bottom - rc.top) / 2;
}
if (!(es->flags & EF_FOCUSED))
SetFocus(es->hwndSelf);
-#ifdef __REACTOS__ // r40667
- selectedItem = TrackPopupMenu(popup, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, x, y, 0, es->hwndSelf, NULL);
- // Added see Revision 43925 comments.
- switch (selectedItem) {
- case EM_UNDO:
- SendMessageW(es->hwndSelf, WM_UNDO, 0, 0);
- break;
- case WM_CUT:
- SendMessageW(es->hwndSelf, WM_CUT, 0, 0);
- break;
- case WM_COPY:
- SendMessageW(es->hwndSelf, WM_COPY, 0, 0);
- break;
- case WM_PASTE:
- SendMessageW(es->hwndSelf, WM_PASTE, 0, 0);
- break;
- case WM_CLEAR:
- SendMessageW(es->hwndSelf, WM_CLEAR, 0, 0);
- break;
- case EM_SETSEL:
- EDIT_EM_SetSel(es, 0, (UINT)-1, FALSE);
- EDIT_EM_ScrollCaret(es);
- break;
- default:
- ERR("unknown menu item, please report\n");
- break;
- }
-#endif
+ cmd = TrackPopupMenu(popup, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_NONOTIFY,
+ x, y, 0, es->hwndSelf, NULL);
+
+ if (cmd)
+ EDIT_ContextMenuCommand(es, cmd);
+
DestroyMenu(menu);
}
case WM_SYSKEYDOWN: /* Handle Alt+up/down arrows */
if (nEUI)
- SendMessageW(hCombo, CB_SHOWDROPDOWN, bDropped ? FALSE : TRUE, 0);
+ SendMessageW(hCombo, CB_SHOWDROPDOWN, !bDropped, 0);
else
SendMessageW(hLBox, WM_KEYDOWN, VK_F4, 0);
break;
if ((es->style & ES_MULTILINE) && EDIT_IsInsideDialog(es))
SendMessageW(es->hwndParent, WM_NEXTDLGCTL, shift, 0);
break;
+#ifdef __REACTOS__
+ /* ReactOS CORE-1419 */
case VK_BACK:
if (control)
{
- FIXME("Ctrl+Backspace\n"); // See bug 1419.
+ FIXME("Ctrl+Backspace\n");
}
break;
+#endif
}
return TRUE;
}
if(!(es->style & ES_NOHIDESEL))
EDIT_InvalidateText(es, es->selection_start, es->selection_end);
EDIT_NOTIFY_PARENT(es, EN_KILLFOCUS);
- /* throw away left over scroll when we lose focus */
- es->wheelDeltaRemainder = 0;
+ /* throw away left over scroll when we lose focus */
+ es->wheelDeltaRemainder = 0;
return 0;
}
EDIT_InvalidateText(es, es->selection_start, es->selection_end);
/* single line edit updates itself */
- if (!(es->style & ES_MULTILINE))
+ if (IsWindowVisible(es->hwndSelf) && !(es->style & ES_MULTILINE))
{
HDC hdc = GetDC(es->hwndSelf);
EDIT_WM_Paint(es, hdc);
return;
if (CompFlag & GCS_RESULTSTR)
+ {
EDIT_GetResultStr(hIMC, es);
- if (CompFlag & GCS_COMPSTR)
- EDIT_GetCompositionStr(hIMC, CompFlag, es);
- cursor = ImmGetCompositionStringW(hIMC, GCS_CURSORPOS, 0, 0);
+ cursor = 0;
+ }
+ else
+ {
+ if (CompFlag & GCS_COMPSTR)
+ EDIT_GetCompositionStr(hIMC, CompFlag, es);
+ cursor = ImmGetCompositionStringW(hIMC, GCS_CURSORPOS, 0, 0);
+ }
ImmReleaseContext(hwnd, hIMC);
EDIT_SetCaretPos(es, es->selection_start + cursor, es->flags & EF_AFTER_WRAP);
}
/* The app can own the text buffer handle */
if (es->hloc32W && (es->hloc32W != es->hlocapp)) {
- LocalFree(es->hloc32W);
- }
+ LocalFree(es->hloc32W);
+ }
if (es->hloc32A && (es->hloc32A != es->hlocapp)) {
- LocalFree(es->hloc32A);
- }
- EDIT_InvalidateUniscribeData(es);
+ LocalFree(es->hloc32A);
+ }
+ EDIT_InvalidateUniscribeData(es);
pc = es->first_line_def;
while (pc)
{
{
EDITSTATE *es = (EDITSTATE *)GetWindowLongPtrW( hwnd, 0 );
LRESULT result = 0;
-#ifdef __REACTOS__ // r50219
- PWND pWnd;
+#ifdef __REACTOS__
+ /* ReactOS r50219 */
+ PWND pWnd;
- pWnd = ValidateHwnd(hwnd);
- if (pWnd)
+ pWnd = ValidateHwnd(hwnd);
+ if (pWnd)
+ {
+ if (!pWnd->fnid)
+ {
+ NtUserSetWindowFNID(hwnd, FNID_EDIT);
+ }
+ else
{
- if (!pWnd->fnid)
- {
- NtUserSetWindowFNID(hwnd, FNID_EDIT);
- }
- else
- {
- if (pWnd->fnid != FNID_EDIT)
- {
- ERR("Wrong window class for Edit! fnId 0x%x\n",pWnd->fnid);
- return 0;
- }
- }
+ if (pWnd->fnid != FNID_EDIT)
+ {
+ ERR("Wrong window class for Edit! fnId 0x%x\n",pWnd->fnid);
+ return 0;
+ }
}
+ }
#endif
TRACE("hwnd=%p msg=%x (%s) wparam=%lx lparam=%lx\n", hwnd, msg, SPY_GetMsgName(msg, hwnd), wParam, lParam);
case WM_NCDESTROY:
result = EDIT_WM_NCDestroy(es);
-// es = NULL; reactos
#ifdef __REACTOS__
NtUserSetWindowFNID(hwnd, FNID_DESTROY);
+#else
+ es = NULL;
#endif
break;
if (SendMessageW(GetParent(hwnd), CB_GETDROPPEDSTATE, 0, 0))
result |= DLGC_WANTMESSAGE;
}
- }
+ }
}
break;
case WM_CLEAR:
EDIT_WM_Clear(es);
break;
-#if 0 // Removed see Revision 43925 comments.
- case WM_COMMAND:
- EDIT_WM_Command(es, HIWORD(wParam), LOWORD(wParam), (HWND)lParam);
- break;
-#endif
+
case WM_CONTEXTMENU:
EDIT_WM_ContextMenu(es, (short)LOWORD(lParam), (short)HIWORD(lParam));
break;
}
break;
-
default:
result = DefWindowProcT(hwnd, msg, wParam, lParam, unicode);
break;
}
- /* reactos: check GetWindowLong in case es has been destroyed during processing */
+#ifdef __REACTOS__
+ /* ReactOS: check GetWindowLong in case es has been destroyed during processing */
if (IsWindow(hwnd) && es && GetWindowLongPtrW(hwnd, 0))
EDIT_UnlockBuffer(es, FALSE);
+#else
+ if (IsWindow(hwnd) && es) EDIT_UnlockBuffer(es, FALSE);
+#endif
TRACE("hwnd=%p msg=%x (%s) -- 0x%08lx\n", hwnd, msg, SPY_GetMsgName(msg, hwnd), result);
return result;
}
-// reactos
+#ifdef __REACTOS__
+
/*********************************************************************
*
* EditWndProc (USER32.@)
return EditWndProc_common(hWnd, uMsg, wParam, lParam, TRUE);
}
+#endif /* __REACTOS__ */
+
/*********************************************************************
* edit class descriptor
*/
{
editW, /* name */
CS_DBLCLKS | CS_PARENTDC, /* style */
- // reactos
+#ifdef __REACTOS__
EditWndProcA, /* procA */
EditWndProcW, /* procW */
+#else
+ WINPROC_EDIT, /* proc */
+#endif
#ifndef _WIN64
sizeof(EDITSTATE *) + sizeof(WORD), /* extra */
#else