ReactOS 0.4.15-dev-7681-g776c3a3
edit.c File Reference
#include "config.h"
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "imm.h"
#include "usp10.h"
#include "commctrl.h"
#include "uxtheme.h"
#include "vsstyle.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/heap.h"
Include dependency graph for edit.c:

Go to the source code of this file.

Classes

struct  tagLINEDEF
 
struct  EDITSTATE
 

Macros

#define BUFLIMIT_INITIAL   30000 /* initial buffer size */
 
#define GROWLENGTH   32 /* buffers granularity in bytes: must be power of 2 */
 
#define ROUND_TO_GROW(size)   (((size) + (GROWLENGTH - 1)) & ~(GROWLENGTH - 1))
 
#define HSCROLL_FRACTION   3 /* scroll window by 1/3 width */
 
#define EF_MODIFIED   0x0001 /* text has been modified */
 
#define EF_FOCUSED   0x0002 /* we have input focus */
 
#define EF_UPDATE   0x0004 /* notify parent of changed state */
 
#define EF_VSCROLL_TRACK   0x0008 /* don't SetScrollPos() since we are tracking the thumb */
 
#define EF_HSCROLL_TRACK   0x0010 /* don't SetScrollPos() since we are tracking the thumb */
 
#define EF_AFTER_WRAP
 
#define EF_USE_SOFTBRK   0x0100 /* Enable soft breaks in text. */
 
#define EF_DIALOGMODE   0x0200 /* Indicates that we are inside a dialog window */
 
#define ID_CB_LISTBOX   1000
 
#define SWAP_UINT32(x, y)   do { UINT temp = (UINT)(x); (x) = (UINT)(y); (y) = temp; } while(0)
 
#define ORDER_UINT(x, y)   do { if ((UINT)(y) < (UINT)(x)) SWAP_UINT32((x),(y)); } while(0)
 

Typedefs

typedef struct tagLINEDEF LINEDEF
 

Enumerations

enum  LINE_END {
  END_0 = 0 , END_WRAP , END_HARD , END_SOFT ,
  END_RICH , END_0 = 0 , END_WRAP , END_HARD ,
  END_SOFT , END_RICH
}
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (edit)
 
static BOOL notify_parent (const EDITSTATE *es, INT code)
 
static LRESULT EDIT_EM_PosFromChar (EDITSTATE *es, INT index, BOOL after_wrap)
 
static BOOL EDIT_EM_CanUndo (const EDITSTATE *es)
 
static void EDIT_EM_EmptyUndoBuffer (EDITSTATE *es)
 
static HBRUSH EDIT_NotifyCtlColor (EDITSTATE *es, HDC hdc)
 
static UINT get_text_length (EDITSTATE *es)
 
static INT EDIT_WordBreakProc (EDITSTATE *es, LPWSTR s, INT index, INT count, INT action)
 
static INT EDIT_CallWordBreakProc (EDITSTATE *es, INT start, INT index, INT count, INT action)
 
static void EDIT_InvalidateUniscribeData_linedef (LINEDEF *line_def)
 
static void EDIT_InvalidateUniscribeData (EDITSTATE *es)
 
static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData_linedef (EDITSTATE *es, HDC dc, LINEDEF *line_def)
 
static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData (EDITSTATE *es, HDC dc, INT line)
 
static INT get_vertical_line_count (EDITSTATE *es)
 
static void EDIT_BuildLineDefs_ML (EDITSTATE *es, INT istart, INT iend, INT delta, HRGN hrgn)
 
static void EDIT_CalcLineWidth_SL (EDITSTATE *es)
 
static INT EDIT_CharFromPos (EDITSTATE *es, INT x, INT y, LPBOOL after_wrap)
 
static void EDIT_ConfinePoint (const EDITSTATE *es, LPINT x, LPINT y)
 
static INT EDIT_EM_LineFromChar (EDITSTATE *es, INT index)
 
static INT EDIT_EM_LineIndex (const EDITSTATE *es, INT line)
 
static INT EDIT_EM_LineLength (EDITSTATE *es, INT index)
 
static void EDIT_GetLineRect (EDITSTATE *es, INT line, INT scol, INT ecol, LPRECT rc)
 
static void text_buffer_changed (EDITSTATE *es)
 
static void EDIT_LockBuffer (EDITSTATE *es)
 
static void EDIT_UnlockBuffer (EDITSTATE *es, BOOL force)
 
static BOOL EDIT_MakeFit (EDITSTATE *es, UINT size)
 
static BOOL EDIT_MakeUndoFit (EDITSTATE *es, UINT size)
 
static void EDIT_UpdateTextRegion (EDITSTATE *es, HRGN hrgn, BOOL bErase)
 
static void EDIT_UpdateText (EDITSTATE *es, const RECT *rc, BOOL bErase)
 
static void EDIT_SL_InvalidateText (EDITSTATE *es, INT start, INT end)
 
static void EDIT_ML_InvalidateText (EDITSTATE *es, INT start, INT end)
 
static void EDIT_InvalidateText (EDITSTATE *es, INT start, INT end)
 
static BOOL EDIT_EM_SetSel (EDITSTATE *es, UINT start, UINT end, BOOL after_wrap)
 
static void EDIT_UpdateScrollInfo (EDITSTATE *es)
 
static BOOL EDIT_EM_LineScroll_internal (EDITSTATE *es, INT dx, INT dy)
 
static BOOL EDIT_EM_LineScroll (EDITSTATE *es, INT dx, INT dy)
 
static LRESULT EDIT_EM_Scroll (EDITSTATE *es, INT action)
 
static void EDIT_SetCaretPos (EDITSTATE *es, INT pos, BOOL after_wrap)
 
static void EDIT_EM_ScrollCaret (EDITSTATE *es)
 
static void EDIT_MoveBackward (EDITSTATE *es, BOOL extend)
 
static void EDIT_MoveDown_ML (EDITSTATE *es, BOOL extend)
 
static void EDIT_MoveEnd (EDITSTATE *es, BOOL extend, BOOL ctrl)
 
static void EDIT_MoveForward (EDITSTATE *es, BOOL extend)
 
static void EDIT_MoveHome (EDITSTATE *es, BOOL extend, BOOL ctrl)
 
static void EDIT_MovePageDown_ML (EDITSTATE *es, BOOL extend)
 
static void EDIT_MovePageUp_ML (EDITSTATE *es, BOOL extend)
 
static void EDIT_MoveUp_ML (EDITSTATE *es, BOOL extend)
 
static void EDIT_MoveWordBackward (EDITSTATE *es, BOOL extend)
 
static void EDIT_MoveWordForward (EDITSTATE *es, BOOL extend)
 
static INT EDIT_PaintText (EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col, INT count, BOOL rev)
 
static void EDIT_PaintLine (EDITSTATE *es, HDC dc, INT line, BOOL rev)
 
static void EDIT_AdjustFormatRect (EDITSTATE *es)
 
static void EDIT_SetRectNP (EDITSTATE *es, const RECT *rc)
 
static LRESULT EDIT_EM_CharFromPos (EDITSTATE *es, INT x, INT y)
 
static BOOL EDIT_EM_FmtLines (EDITSTATE *es, BOOL add_eol)
 
static HLOCAL EDIT_EM_GetHandle (EDITSTATE *es)
 
static INT EDIT_EM_GetLine (EDITSTATE *es, INT line, LPWSTR dst)
 
static LRESULT EDIT_EM_GetSel (const EDITSTATE *es, PUINT start, PUINT end)
 
static void EDIT_EM_ReplaceSel (EDITSTATE *es, BOOL can_undo, const WCHAR *lpsz_replace, UINT strl, BOOL send_update, BOOL honor_limit)
 
static void EDIT_EM_SetHandle (EDITSTATE *es, HLOCAL hloc)
 
static void EDIT_EM_SetLimitText (EDITSTATE *es, UINT limit)
 
static BOOL is_cjk (UINT charset)
 
static void EDIT_EM_SetMargins (EDITSTATE *es, INT action, WORD left, WORD right, BOOL repaint)
 
static void EDIT_EM_SetPasswordChar (EDITSTATE *es, WCHAR c)
 
static BOOL EDIT_EM_SetTabStops (EDITSTATE *es, INT count, const INT *tabs)
 
static void EDIT_EM_SetWordBreakProc (EDITSTATE *es, EDITWORDBREAKPROCW wbp)
 
static BOOL EDIT_EM_Undo (EDITSTATE *es)
 
static BOOL EDIT_IsInsideDialog (EDITSTATE *es)
 
static void EDIT_WM_Paste (EDITSTATE *es)
 
static void EDIT_WM_Copy (EDITSTATE *es)
 
static void EDIT_WM_Clear (EDITSTATE *es)
 
static void EDIT_WM_Cut (EDITSTATE *es)
 
static LRESULT EDIT_WM_Char (EDITSTATE *es, WCHAR c)
 
static void EDIT_ContextMenuCommand (EDITSTATE *es, UINT id)
 
static void EDIT_WM_ContextMenu (EDITSTATE *es, INT x, INT y)
 
static INT EDIT_WM_GetText (const EDITSTATE *es, INT count, LPWSTR dst)
 
static BOOL EDIT_CheckCombo (EDITSTATE *es, UINT msg, INT key)
 
static LRESULT EDIT_WM_KeyDown (EDITSTATE *es, INT key)
 
static LRESULT EDIT_WM_KillFocus (HTHEME theme, EDITSTATE *es)
 
static LRESULT EDIT_WM_LButtonDblClk (EDITSTATE *es)
 
static LRESULT EDIT_WM_LButtonDown (EDITSTATE *es, DWORD keys, INT x, INT y)
 
static LRESULT EDIT_WM_LButtonUp (EDITSTATE *es)
 
static LRESULT EDIT_WM_MButtonDown (EDITSTATE *es)
 
static LRESULT EDIT_WM_MouseMove (EDITSTATE *es, INT x, INT y)
 
static void EDIT_WM_Paint (EDITSTATE *es, HDC hdc)
 
static void EDIT_WM_NCPaint (HWND hwnd, HRGN region)
 
static void EDIT_WM_SetFocus (HTHEME theme, EDITSTATE *es)
 
static void EDIT_WM_SetFont (EDITSTATE *es, HFONT font, BOOL redraw)
 
static void EDIT_WM_SetText (EDITSTATE *es, LPCWSTR text)
 
static void EDIT_WM_Size (EDITSTATE *es, UINT action)
 
static LRESULT EDIT_WM_StyleChanged (EDITSTATE *es, WPARAM which, const STYLESTRUCT *style)
 
static LRESULT EDIT_WM_SysKeyDown (EDITSTATE *es, INT key, DWORD key_data)
 
static void EDIT_WM_Timer (EDITSTATE *es)
 
static LRESULT EDIT_WM_HScroll (EDITSTATE *es, INT action, INT pos)
 
static LRESULT EDIT_WM_VScroll (EDITSTATE *es, INT action, INT pos)
 
static LRESULT EDIT_EM_GetThumb (EDITSTATE *es)
 
static void EDIT_GetCompositionStr (HIMC hIMC, LPARAM CompFlag, EDITSTATE *es)
 
static void EDIT_GetResultStr (HIMC hIMC, EDITSTATE *es)
 
static void EDIT_ImeComposition (HWND hwnd, LPARAM CompFlag, EDITSTATE *es)
 
static LRESULT EDIT_WM_NCCreate (HWND hwnd, LPCREATESTRUCTW lpcs)
 
static LRESULT EDIT_WM_Create (EDITSTATE *es, const WCHAR *name)
 
static LRESULT EDIT_WM_NCDestroy (EDITSTATE *es)
 
static LRESULT CALLBACK EDIT_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
void EDIT_Register (void)
 

Macro Definition Documentation

◆ BUFLIMIT_INITIAL

#define BUFLIMIT_INITIAL   30000 /* initial buffer size */

Definition at line 62 of file edit.c.

◆ EF_AFTER_WRAP

#define EF_AFTER_WRAP
Value:
0x0080 /* the caret is displayed after the last character of a
wrapped line, instead of in front of the next character */

Definition at line 75 of file edit.c.

◆ EF_DIALOGMODE

#define EF_DIALOGMODE   0x0200 /* Indicates that we are inside a dialog window */

Definition at line 77 of file edit.c.

◆ EF_FOCUSED

#define EF_FOCUSED   0x0002 /* we have input focus */

Definition at line 71 of file edit.c.

◆ EF_HSCROLL_TRACK

#define EF_HSCROLL_TRACK   0x0010 /* don't SetScrollPos() since we are tracking the thumb */

Definition at line 74 of file edit.c.

◆ EF_MODIFIED

#define EF_MODIFIED   0x0001 /* text has been modified */

Definition at line 70 of file edit.c.

◆ EF_UPDATE

#define EF_UPDATE   0x0004 /* notify parent of changed state */

Definition at line 72 of file edit.c.

◆ EF_USE_SOFTBRK

#define EF_USE_SOFTBRK   0x0100 /* Enable soft breaks in text. */

Definition at line 76 of file edit.c.

◆ EF_VSCROLL_TRACK

#define EF_VSCROLL_TRACK   0x0008 /* don't SetScrollPos() since we are tracking the thumb */

Definition at line 73 of file edit.c.

◆ GROWLENGTH

#define GROWLENGTH   32 /* buffers granularity in bytes: must be power of 2 */

Definition at line 63 of file edit.c.

◆ HSCROLL_FRACTION

#define HSCROLL_FRACTION   3 /* scroll window by 1/3 width */

Definition at line 65 of file edit.c.

◆ ID_CB_LISTBOX

#define ID_CB_LISTBOX   1000

Definition at line 79 of file edit.c.

◆ ORDER_UINT

#define ORDER_UINT (   x,
  y 
)    do { if ((UINT)(y) < (UINT)(x)) SWAP_UINT32((x),(y)); } while(0)

Definition at line 166 of file edit.c.

◆ ROUND_TO_GROW

#define ROUND_TO_GROW (   size)    (((size) + (GROWLENGTH - 1)) & ~(GROWLENGTH - 1))

Definition at line 64 of file edit.c.

◆ SWAP_UINT32

#define SWAP_UINT32 (   x,
  y 
)    do { UINT temp = (UINT)(x); (x) = (UINT)(y); (y) = temp; } while(0)

Definition at line 165 of file edit.c.

Typedef Documentation

◆ LINEDEF

Enumeration Type Documentation

◆ LINE_END

Enumerator
END_0 
END_WRAP 
END_HARD 
END_SOFT 
END_RICH 
END_0 
END_WRAP 
END_HARD 
END_SOFT 
END_RICH 

Definition at line 81 of file edit.c.

83{
84 END_0 = 0, /* line ends with terminating '\0' character */
85 END_WRAP, /* line is wrapped */
86 END_HARD, /* line ends with a hard return '\r\n' */
87 END_SOFT, /* line ends with a soft return '\r\r\n' */
88 END_RICH /* line ends with a single '\n' */
@ END_SOFT
Definition: edit.c:86
@ END_RICH
Definition: edit.c:87
@ END_HARD
Definition: edit.c:85
@ END_0
Definition: edit.c:83
@ END_WRAP
Definition: edit.c:84

Function Documentation

◆ EDIT_AdjustFormatRect()

static void EDIT_AdjustFormatRect ( EDITSTATE es)
static

Definition at line 2261 of file edit.c.

2263{
2264 RECT ClientRect;
2265
2266 es->format_rect.right = max(es->format_rect.right, es->format_rect.left + es->char_width);
2267 if (es->style & ES_MULTILINE)
2268 {
2269 INT fw, vlc, max_x_offset, max_y_offset;
2270
2272 es->format_rect.bottom = es->format_rect.top + vlc * es->line_height;
2273
2274 /* correct es->x_offset */
2275 fw = es->format_rect.right - es->format_rect.left;
2276 max_x_offset = es->text_width - fw;
2277 if(max_x_offset < 0) max_x_offset = 0;
2278 if(es->x_offset > max_x_offset)
2279 es->x_offset = max_x_offset;
2280
2281 /* correct es->y_offset */
2282 max_y_offset = es->line_count - vlc;
2283 if(max_y_offset < 0) max_y_offset = 0;
2284 if(es->y_offset > max_y_offset)
2285 es->y_offset = max_y_offset;
2286
2287 /* force scroll info update */
2289 }
2290 else
2291 /* Windows doesn't care to fix text placement for SL controls */
2292 es->format_rect.bottom = es->format_rect.top + es->line_height;
2293
2294 /* Always stay within the client area */
2295 GetClientRect(es->hwndSelf, &ClientRect);
2296 es->format_rect.bottom = min(es->format_rect.bottom, ClientRect.bottom);
2297
2298 if ((es->style & ES_MULTILINE) && !(es->style & ES_AUTOHSCROLL))
2300
2301 EDIT_SetCaretPos(es, es->selection_end, es->flags & EF_AFTER_WRAP);
#define NULL
Definition: types.h:112
static INT get_vertical_line_count(EDITSTATE *es)
Definition: edit.c:416
#define EF_AFTER_WRAP
Definition: edit.c:75
static void EDIT_SetCaretPos(EDITSTATE *es, INT pos, BOOL after_wrap)
Definition: edit.c:1748
static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta, HRGN hrgn)
Definition: edit.c:431
static UINT get_text_length(EDITSTATE *es)
Definition: edit.c:218
static void EDIT_UpdateScrollInfo(EDITSTATE *es)
Definition: edit.c:1558
#define es
Definition: i386-dis.c:440
#define min(a, b)
Definition: monoChain.cc:55
#define ES_AUTOHSCROLL
Definition: pedump.c:672
#define ES_MULTILINE
Definition: pedump.c:667
LONG bottom
Definition: windef.h:309
#define max(a, b)
Definition: svc.c:63
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)

Referenced by EDIT_EM_SetMargins(), and EDIT_SetRectNP().

◆ EDIT_BuildLineDefs_ML()

static void EDIT_BuildLineDefs_ML ( EDITSTATE es,
INT  istart,
INT  iend,
INT  delta,
HRGN  hrgn 
)
static

Definition at line 431 of file edit.c.

433{
434 LPWSTR current_position, cp;
435 INT fw;
436 LINEDEF *current_line;
437 LINEDEF *previous_line;
438 LINEDEF *start_line;
439 INT line_index = 0, nstart_line, nstart_index;
440 INT line_count = es->line_count;
441 INT orig_net_length;
442 RECT rc;
443 INT vlc;
444
445 if (istart == iend && delta == 0)
446 return;
447
448 previous_line = NULL;
449 current_line = es->first_line_def;
450
451 /* Find starting line. istart must lie inside an existing line or
452 * at the end of buffer */
453 do {
454 if (istart < current_line->index + current_line->length ||
455 current_line->ending == END_0)
456 break;
457
458 previous_line = current_line;
459 current_line = current_line->next;
460 line_index++;
461 } while (current_line);
462
463 if (!current_line) /* Error occurred start is not inside previous buffer */
464 {
465 FIXME(" modification occurred outside buffer\n");
466 return;
467 }
468
469 /* Remember start of modifications in order to calculate update region */
470 nstart_line = line_index;
471 nstart_index = current_line->index;
472
473 /* We must start to reformat from the previous line since the modifications
474 * may have caused the line to wrap upwards. */
475 if (!(es->style & ES_AUTOHSCROLL) && line_index > 0)
476 {
477 line_index--;
478 current_line = previous_line;
479 }
480 start_line = current_line;
481
482 fw = es->format_rect.right - es->format_rect.left;
483 current_position = es->text + current_line->index;
485 do {
486 if (current_line != start_line)
487 {
488 if (!current_line || current_line->index + delta > current_position - es->text)
489 {
490 /* The buffer has been expanded, create a new line and
491 insert it into the link list */
492 LINEDEF *new_line = heap_alloc_zero(sizeof(*new_line));
493 new_line->next = previous_line->next;
494 previous_line->next = new_line;
495 current_line = new_line;
496 es->line_count++;
497 }
498 else if (current_line->index + delta < current_position - es->text)
499 {
500 /* The previous line merged with this line so we delete this extra entry */
501 previous_line->next = current_line->next;
502 heap_free(current_line);
503 current_line = previous_line->next;
504 es->line_count--;
505 continue;
506 }
507 else /* current_line->index + delta == current_position */
508 {
509 if (current_position - es->text > iend)
510 break; /* We reached end of line modifications */
511 /* else recalculate this line */
512 }
513 }
514
515 current_line->index = current_position - es->text;
516 orig_net_length = current_line->net_length;
517
518 /* Find end of line */
519 cp = current_position;
520 while (*cp) {
521 if (*cp == '\n') break;
522 if ((*cp == '\r') && (*(cp + 1) == '\n'))
523 break;
524 cp++;
525 }
526
527 /* Mark type of line termination */
528 if (!(*cp)) {
529 current_line->ending = END_0;
530 current_line->net_length = strlenW(current_position);
531 } else if ((cp > current_position) && (*(cp - 1) == '\r')) {
532 current_line->ending = END_SOFT;
533 current_line->net_length = cp - current_position - 1;
534 } else if (*cp == '\n') {
535 current_line->ending = END_RICH;
536 current_line->net_length = cp - current_position;
537 } else {
538 current_line->ending = END_HARD;
539 current_line->net_length = cp - current_position;
540 }
541
542 if (current_line->net_length)
543 {
544 const SIZE *sz;
547 if (current_line->ssa)
548 {
549 sz = ScriptString_pSize(current_line->ssa);
550 /* Calculate line width */
551 current_line->width = sz->cx;
552 }
553 else current_line->width = es->char_width * current_line->net_length;
554 }
555 else current_line->width = 0;
556
557 /* FIXME: check here for lines that are too wide even in AUTOHSCROLL (> 32767 ???) */
558
559/* Line breaks just look back from the end and find the next break and try that. */
560
561 if (!(es->style & ES_AUTOHSCROLL)) {
562 if (current_line->width > fw && fw > es->char_width) {
563
564 INT prev, next;
565 int w;
566 const SIZE *sz;
567 float d;
568
569 prev = current_line->net_length - 1;
570 w = current_line->net_length;
571 d = (float)current_line->width/(float)fw;
572 if (d > 1.2f) d -= 0.2f;
573 next = prev/d;
574 if (next >= prev) next = prev-1;
575 do {
576 prev = EDIT_CallWordBreakProc(es, current_position - es->text,
577 next, current_line->net_length, WB_LEFT);
578 current_line->net_length = prev;
581 if (current_line->ssa)
582 sz = ScriptString_pSize(current_line->ssa);
583 else sz = 0;
584 if (sz)
585 current_line->width = sz->cx;
586 else
587 prev = 0;
588 next = prev - 1;
589 } while (prev && current_line->width > fw);
590 current_line->net_length = w;
591
592 if (prev == 0) { /* Didn't find a line break so force a break */
593 INT *piDx;
594 const INT *count;
595
598
599 if (current_line->ssa)
600 {
601 count = ScriptString_pcOutChars(current_line->ssa);
602 piDx = heap_alloc(sizeof(INT) * (*count));
603 ScriptStringGetLogicalWidths(current_line->ssa,piDx);
604
605 prev = current_line->net_length-1;
606 do {
607 current_line->width -= piDx[prev];
608 prev--;
609 } while ( prev > 0 && current_line->width > fw);
610 if (prev<=0)
611 prev = 1;
612 heap_free(piDx);
613 }
614 else
615 prev = (fw / es->char_width);
616 }
617
618 /* If the first line we are calculating, wrapped before istart, we must
619 * adjust istart in order for this to be reflected in the update region. */
620 if (current_line->index == nstart_index && istart > current_line->index + prev)
621 istart = current_line->index + prev;
622 /* else if we are updating the previous line before the first line we
623 * are re-calculating and it expanded */
624 else if (current_line == start_line &&
625 current_line->index != nstart_index && orig_net_length < prev)
626 {
627 /* Line expanded due to an upwards line wrap so we must partially include
628 * previous line in update region */
629 nstart_line = line_index;
630 nstart_index = current_line->index;
631 istart = current_line->index + orig_net_length;
632 }
633
634 current_line->net_length = prev;
635 current_line->ending = END_WRAP;
636
637 if (current_line->net_length > 0)
638 {
640 if (current_line->ssa)
641 {
642 sz = ScriptString_pSize(current_line->ssa);
643 current_line->width = sz->cx;
644 }
645 else
646 current_line->width = 0;
647 }
648 else current_line->width = 0;
649 }
650 else if (current_line == start_line &&
651 current_line->index != nstart_index &&
652 orig_net_length < current_line->net_length) {
653 /* The previous line expanded but it's still not as wide as the client rect */
654 /* The expansion is due to an upwards line wrap so we must partially include
655 it in the update region */
656 nstart_line = line_index;
657 nstart_index = current_line->index;
658 istart = current_line->index + orig_net_length;
659 }
660 }
661
662
663 /* Adjust length to include line termination */
664 switch (current_line->ending) {
665 case END_SOFT:
666 current_line->length = current_line->net_length + 3;
667 break;
668 case END_RICH:
669 current_line->length = current_line->net_length + 1;
670 break;
671 case END_HARD:
672 current_line->length = current_line->net_length + 2;
673 break;
674 case END_WRAP:
675 case END_0:
676 current_line->length = current_line->net_length;
677 break;
678 }
679 es->text_width = max(es->text_width, current_line->width);
680 current_position += current_line->length;
681 previous_line = current_line;
682
683 /* Discard data for non-visible lines. It will be calculated as needed */
684 if ((line_index < es->y_offset) || (line_index > es->y_offset + vlc))
686
687 current_line = current_line->next;
688 line_index++;
689 } while (previous_line->ending != END_0);
690
691 /* Finish adjusting line indexes by delta or remove hanging lines */
692 if (previous_line->ending == END_0)
693 {
694 LINEDEF *pnext = NULL;
695
696 previous_line->next = NULL;
697 while (current_line)
698 {
699 pnext = current_line->next;
701 heap_free(current_line);
702 current_line = pnext;
703 es->line_count--;
704 }
705 }
706 else if (delta != 0)
707 {
708 while (current_line)
709 {
710 current_line->index += delta;
711 current_line = current_line->next;
712 }
713 }
714
715 /* Calculate rest of modification rectangle */
716 if (hrgn)
717 {
718 HRGN tmphrgn;
719 /*
720 * We calculate two rectangles. One for the first line which may have
721 * an indent with respect to the format rect. The other is a format-width
722 * rectangle that spans the rest of the lines that changed or moved.
723 */
724 rc.top = es->format_rect.top + nstart_line * es->line_height -
725 (es->y_offset * es->line_height); /* Adjust for vertical scrollbar */
726 rc.bottom = rc.top + es->line_height;
727 if ((es->style & ES_CENTER) || (es->style & ES_RIGHT))
728 rc.left = es->format_rect.left;
729 else
730#ifdef __REACTOS__ /* CORE-11475 */
731 rc.left = (short)LOWORD(EDIT_EM_PosFromChar(es, nstart_index, FALSE));
732#else
733 rc.left = LOWORD(EDIT_EM_PosFromChar(es, nstart_index, FALSE));
734#endif
735 rc.right = es->format_rect.right;
736 SetRectRgn(hrgn, rc.left, rc.top, rc.right, rc.bottom);
737
738 rc.top = rc.bottom;
739 rc.left = es->format_rect.left;
740 rc.right = es->format_rect.right;
741 /*
742 * If lines were added or removed we must re-paint the remainder of the
743 * lines since the remaining lines were either shifted up or down.
744 */
745 if (line_count < es->line_count) /* We added lines */
746 rc.bottom = es->line_count * es->line_height;
747 else if (line_count > es->line_count) /* We removed lines */
748 rc.bottom = line_count * es->line_height;
749 else
750 rc.bottom = line_index * es->line_height;
751 rc.bottom += es->format_rect.top;
752 rc.bottom -= (es->y_offset * es->line_height); /* Adjust for vertical scrollbar */
753 tmphrgn = CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom);
754 CombineRgn(hrgn, hrgn, tmphrgn, RGN_OR);
755 DeleteObject(tmphrgn);
756 }
static HRGN hrgn
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define FIXME(fmt,...)
Definition: debug.h:111
#define FALSE
Definition: types.h:117
static void EDIT_InvalidateUniscribeData_linedef(LINEDEF *line_def)
Definition: edit.c:308
static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData_linedef(EDITSTATE *es, HDC dc, LINEDEF *line_def)
Definition: edit.c:332
static LRESULT EDIT_EM_PosFromChar(EDITSTATE *es, INT index, BOOL after_wrap)
Definition: edit.c:1015
static INT EDIT_CallWordBreakProc(EDITSTATE *es, INT start, INT index, INT count, INT action)
Definition: edit.c:296
const WCHAR * text
Definition: package.c:1799
HRESULT WINAPI ScriptStringGetLogicalWidths(SCRIPT_STRING_ANALYSIS ssa, int *piDx)
Definition: usp10.c:3804
const SIZE *WINAPI ScriptString_pSize(SCRIPT_STRING_ANALYSIS ssa)
Definition: usp10.c:3876
const int *WINAPI ScriptString_pcOutChars(SCRIPT_STRING_ANALYSIS ssa)
Definition: usp10.c:3938
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
pKey DeleteObject()
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint index
Definition: glext.h:6031
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define d
Definition: ke_i.h:81
POINT cp
Definition: magnifier.c:59
static float(__cdecl *square_half_float)(float x
#define LOWORD(l)
Definition: pedump.c:82
#define ES_CENTER
Definition: pedump.c:665
#define ES_RIGHT
Definition: pedump.c:666
static unsigned __int64 next
Definition: rand_nt.c:6
#define strlenW(s)
Definition: unicode.h:28
LONG cx
Definition: kdterminal.h:27
INT width
Definition: edit.c:94
struct tagLINEDEF * next
Definition: edit.c:97
INT length
Definition: edit.c:91
SCRIPT_STRING_ANALYSIS ssa
Definition: edit.c:96
INT index
Definition: edit.c:95
INT net_length
Definition: edit.c:92
LINE_END ending
Definition: edit.c:93
LONG right
Definition: windef.h:308
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI CombineRgn(_In_opt_ HRGN hrgnDest, _In_opt_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ int fnCombineMode)
#define RGN_OR
Definition: wingdi.h:359
BOOL WINAPI SetRectRgn(_In_ HRGN, _In_ int, _In_ int, _In_ int, _In_ int)
#define WB_LEFT
Definition: winuser.h:550
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by EDIT_AdjustFormatRect(), EDIT_EM_ReplaceSel(), EDIT_EM_SetHandle(), EDIT_EM_SetWordBreakProc(), and EDIT_WM_SetFont().

◆ EDIT_CalcLineWidth_SL()

static void EDIT_CalcLineWidth_SL ( EDITSTATE es)
static

Definition at line 763 of file edit.c.

765{
767 if (es->ssa)
768 {
769 const SIZE *size;
770 size = ScriptString_pSize(es->ssa);
771 es->text_width = size->cx;
772 }
773 else
774 es->text_width = 0;
static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData(EDITSTATE *es, HDC dc, INT line)
Definition: edit.c:374
GLsizeiptr size
Definition: glext.h:5919

Referenced by EDIT_EM_ReplaceSel(), and EDIT_WM_SetFont().

◆ EDIT_CallWordBreakProc()

static INT EDIT_CallWordBreakProc ( EDITSTATE es,
INT  start,
INT  index,
INT  count,
INT  action 
)
static

Definition at line 296 of file edit.c.

298{
299 INT ret;
300
301 if (es->word_break_proc)
302 ret = es->word_break_proc(es->text + start, index, count, action);
303 else
305
306 return ret;
static INT EDIT_WordBreakProc(EDITSTATE *es, LPWSTR s, INT index, INT count, INT action)
Definition: edit.c:238
const WCHAR * action
Definition: action.c:7479
GLuint start
Definition: gl.h:1545
int ret

Referenced by EDIT_BuildLineDefs_ML(), EDIT_MoveWordBackward(), EDIT_MoveWordForward(), and EDIT_WM_LButtonDblClk().

◆ EDIT_CharFromPos()

static INT EDIT_CharFromPos ( EDITSTATE es,
INT  x,
INT  y,
LPBOOL  after_wrap 
)
static

Definition at line 786 of file edit.c.

788{
789 INT index;
790
791 if (es->style & ES_MULTILINE) {
792 int trailing;
793 INT line = (y - es->format_rect.top) / es->line_height + es->y_offset;
794 INT line_index = 0;
795 LINEDEF *line_def = es->first_line_def;
797 while ((line > 0) && line_def->next) {
798 line_index += line_def->length;
799 line_def = line_def->next;
800 line--;
801 }
802
803 x += es->x_offset - es->format_rect.left;
804 if (es->style & ES_RIGHT)
805 x -= (es->format_rect.right - es->format_rect.left) - line_def->width;
806 else if (es->style & ES_CENTER)
807 x -= ((es->format_rect.right - es->format_rect.left) - line_def->width) / 2;
808 if (x >= line_def->width) {
809 if (after_wrap)
810 *after_wrap = (line_def->ending == END_WRAP);
811 return line_index + line_def->net_length;
812 }
813 if (x <= 0 || !line_def->ssa) {
814 if (after_wrap)
815 *after_wrap = FALSE;
816 return line_index;
817 }
818
819 ScriptStringXtoCP(line_def->ssa, x , &index, &trailing);
820 if (trailing) index++;
821 index += line_index;
822 if (after_wrap)
823 *after_wrap = ((index == line_index + line_def->net_length) &&
824 (line_def->ending == END_WRAP));
825 } else {
826 INT xoff = 0;
827 INT trailing;
828 if (after_wrap)
829 *after_wrap = FALSE;
830 x -= es->format_rect.left;
831 if (!x)
832 return es->x_offset;
833
834 if (!es->x_offset)
835 {
836 INT indent = (es->format_rect.right - es->format_rect.left) - es->text_width;
837 if (es->style & ES_RIGHT)
838 x -= indent;
839 else if (es->style & ES_CENTER)
840 x -= indent / 2;
841 }
842
844 if (es->x_offset)
845 {
846 if (es->ssa)
847 {
848 if (es->x_offset>= get_text_length(es))
849 {
850 const SIZE *size;
851 size = ScriptString_pSize(es->ssa);
852 xoff = size->cx;
853 }
854 ScriptStringCPtoX(es->ssa, es->x_offset, FALSE, &xoff);
855 }
856 else
857 xoff = 0;
858 }
859 if (x < 0)
860 {
861 if (x + xoff > 0 || !es->ssa)
862 {
863 ScriptStringXtoCP(es->ssa, x+xoff, &index, &trailing);
864 if (trailing) index++;
865 }
866 else
867 index = 0;
868 }
869 else
870 {
871 if (x)
872 {
873 const SIZE *size = NULL;
874 if (es->ssa)
875 size = ScriptString_pSize(es->ssa);
876 if (!size)
877 index = 0;
878 else if (x > size->cx)
880 else if (es->ssa)
881 {
882 ScriptStringXtoCP(es->ssa, x+xoff, &index, &trailing);
883 if (trailing) index++;
884 }
885 else
886 index = 0;
887 }
888 else
889 index = es->x_offset;
890 }
891 }
892 return index;
#define index(s, c)
Definition: various.h:29
static const WCHAR indent[]
Definition: object.c:1156
HRESULT WINAPI ScriptStringXtoCP(SCRIPT_STRING_ANALYSIS ssa, int iX, int *piCh, int *piTrailing)
Definition: usp10.c:2474
HRESULT WINAPI ScriptStringCPtoX(SCRIPT_STRING_ANALYSIS ssa, int icp, BOOL fTrailing, int *pX)
Definition: usp10.c:2411
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
if(dx< 0)
Definition: linetemp.h:194
Definition: parser.c:49

Referenced by EDIT_EM_CharFromPos(), EDIT_MoveDown_ML(), EDIT_MoveEnd(), EDIT_MoveHome(), EDIT_MovePageDown_ML(), EDIT_MovePageUp_ML(), EDIT_MoveUp_ML(), EDIT_WM_LButtonDown(), and EDIT_WM_MouseMove().

◆ EDIT_CheckCombo()

static BOOL EDIT_CheckCombo ( EDITSTATE es,
UINT  msg,
INT  key 
)
static

Definition at line 3256 of file edit.c.

3258{
3259 HWND hLBox = es->hwndListBox;
3260 HWND hCombo;
3261 BOOL bDropped;
3262 int nEUI;
3263
3264 if (!hLBox)
3265 return FALSE;
3266
3267 hCombo = GetParent(es->hwndSelf);
3268 bDropped = TRUE;
3269 nEUI = 0;
3270
3271 TRACE("[%p]: handling msg %x (%x)\n", es->hwndSelf, msg, key);
3272
3273 if (key == VK_UP || key == VK_DOWN)
3274 {
3275 if (SendMessageW(hCombo, CB_GETEXTENDEDUI, 0, 0))
3276 nEUI = 1;
3277
3278 if (msg == WM_KEYDOWN || nEUI)
3279 bDropped = (BOOL)SendMessageW(hCombo, CB_GETDROPPEDSTATE, 0, 0);
3280 }
3281
3282 switch (msg)
3283 {
3284 case WM_KEYDOWN:
3285 if (!bDropped && nEUI && (key == VK_UP || key == VK_DOWN))
3286 {
3287 /* make sure ComboLBox pops up */
3288 SendMessageW(hCombo, CB_SETEXTENDEDUI, FALSE, 0);
3289 key = VK_F4;
3290 nEUI = 2;
3291 }
3292
3293 SendMessageW(hLBox, WM_KEYDOWN, key, 0);
3294 break;
3295
3296 case WM_SYSKEYDOWN: /* Handle Alt+up/down arrows */
3297 if (nEUI)
3298 SendMessageW(hCombo, CB_SHOWDROPDOWN, !bDropped, 0);
3299 else
3300 SendMessageW(hLBox, WM_KEYDOWN, VK_F4, 0);
3301 break;
3302 }
3303
3304 if (nEUI == 2)
3305 SendMessageW(hCombo, CB_SETEXTENDEDUI, TRUE, 0);
3306
3307 return TRUE;
#define msg(x)
Definition: auth_time.c:54
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
#define BOOL
Definition: nt_native.h:43
#define TRACE(s)
Definition: solgame.cpp:4
Definition: copy.c:22
#define CB_SHOWDROPDOWN
Definition: winuser.h:1969
#define VK_UP
Definition: winuser.h:2224
#define VK_F4
Definition: winuser.h:2257
#define CB_GETDROPPEDSTATE
Definition: winuser.h:1944
HWND WINAPI GetParent(_In_ HWND)
#define CB_GETEXTENDEDUI
Definition: winuser.h:1947
#define VK_DOWN
Definition: winuser.h:2226
#define WM_KEYDOWN
Definition: winuser.h:1714
#define CB_SETEXTENDEDUI
Definition: winuser.h:1963
#define WM_SYSKEYDOWN
Definition: winuser.h:1718
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by EDIT_WM_KeyDown(), and EDIT_WM_SysKeyDown().

◆ EDIT_ConfinePoint()

static void EDIT_ConfinePoint ( const EDITSTATE es,
LPINT  x,
LPINT  y 
)
static

Definition at line 903 of file edit.c.

905{
906 *x = min(max(*x, es->format_rect.left), es->format_rect.right - 1);
907 *y = min(max(*y, es->format_rect.top), es->format_rect.bottom - 1);

Referenced by EDIT_WM_LButtonDown(), and EDIT_WM_MouseMove().

◆ EDIT_ContextMenuCommand()

static void EDIT_ContextMenuCommand ( EDITSTATE es,
UINT  id 
)
static

Definition at line 3142 of file edit.c.

3144{
3145 switch (id) {
3146 case EM_UNDO:
3147 SendMessageW(es->hwndSelf, WM_UNDO, 0, 0);
3148 break;
3149 case WM_CUT:
3150 SendMessageW(es->hwndSelf, WM_CUT, 0, 0);
3151 break;
3152 case WM_COPY:
3153 SendMessageW(es->hwndSelf, WM_COPY, 0, 0);
3154 break;
3155 case WM_PASTE:
3156 SendMessageW(es->hwndSelf, WM_PASTE, 0, 0);
3157 break;
3158 case WM_CLEAR:
3159 SendMessageW(es->hwndSelf, WM_CLEAR, 0, 0);
3160 break;
3161 case EM_SETSEL:
3162 SendMessageW(es->hwndSelf, EM_SETSEL, 0, -1);
3163 break;
3164 default:
3165 ERR("unknown menu item, please report\n");
3166 break;
3167 }
#define ERR(fmt,...)
Definition: debug.h:110
#define WM_PASTE
Definition: winuser.h:1862
#define WM_CUT
Definition: winuser.h:1860
#define WM_UNDO
Definition: winuser.h:1864
#define EM_UNDO
Definition: winuser.h:2020
#define EM_SETSEL
Definition: winuser.h:2017
#define WM_COPY
Definition: winuser.h:1861
#define WM_CLEAR
Definition: winuser.h:1863

Referenced by EDIT_WM_ContextMenu().

◆ EDIT_EM_CanUndo()

static BOOL EDIT_EM_CanUndo ( const EDITSTATE es)
inlinestatic

Definition at line 183 of file edit.c.

185{
186 return (es->undo_insert_count || strlenW(es->undo_text));

Referenced by EDIT_WindowProc(), EDIT_WM_ContextMenu(), EDIT_WM_SysKeyDown(), and EditWndProc_common().

◆ EDIT_EM_CharFromPos()

static LRESULT EDIT_EM_CharFromPos ( EDITSTATE es,
INT  x,
INT  y 
)
static

Definition at line 2356 of file edit.c.

2358{
2359 POINT pt;
2360 RECT rc;
2361 INT index;
2362
2363 pt.x = x;
2364 pt.y = y;
2365 GetClientRect(es->hwndSelf, &rc);
2366 if (!PtInRect(&rc, pt))
2367 return -1;
2368
static INT EDIT_CharFromPos(EDITSTATE *es, INT x, INT y, LPBOOL after_wrap)
Definition: edit.c:786
static INT EDIT_EM_LineFromChar(EDITSTATE *es, INT index)
Definition: edit.c:915
#define pt(x, y)
Definition: drawing.c:79
#define MAKELONG(a, b)
Definition: typedefs.h:249
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)

Referenced by EDIT_WindowProc().

◆ EDIT_EM_EmptyUndoBuffer()

static void EDIT_EM_EmptyUndoBuffer ( EDITSTATE es)
inlinestatic

Definition at line 194 of file edit.c.

196{
197 es->undo_insert_count = 0;
198 *es->undo_text = '\0';

Referenced by EDIT_EM_ReplaceSel(), EDIT_EM_SetHandle(), EDIT_EM_Undo(), EDIT_WindowProc(), EDIT_WM_Create(), and EditWndProc_common().

◆ EDIT_EM_FmtLines()

static BOOL EDIT_EM_FmtLines ( EDITSTATE es,
BOOL  add_eol 
)
static

Definition at line 2384 of file edit.c.

2386{
2387 es->flags &= ~EF_USE_SOFTBRK;
2388 if (add_eol) {
2389 es->flags |= EF_USE_SOFTBRK;
2390 FIXME("soft break enabled, not implemented\n");
2391 }
2392 return add_eol;
#define EF_USE_SOFTBRK
Definition: edit.c:76

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_GetHandle()

static HLOCAL EDIT_EM_GetHandle ( EDITSTATE es)
static

Definition at line 2406 of file edit.c.

2408{
2409 if (!(es->style & ES_MULTILINE))
2410 return 0;
2411
2413
2414 /* The text buffer handle belongs to the app */
2415 es->hlocapp = es->hloc32W;
2416
2417 TRACE("Returning %p, LocalSize() = %ld\n", es->hlocapp, LocalSize(es->hlocapp));
2418 return es->hlocapp;
static void EDIT_UnlockBuffer(EDITSTATE *es, BOOL force)
Definition: edit.c:1228
SIZE_T NTAPI LocalSize(HLOCAL hMem)
Definition: heapmem.c:1794

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_GetLine()

static INT EDIT_EM_GetLine ( EDITSTATE es,
INT  line,
LPWSTR  dst 
)
static

Definition at line 2426 of file edit.c.

2428{
2429 INT line_len, dst_len;
2430 LPWSTR src;
2431 INT i;
2432
2433 if (es->style & ES_MULTILINE)
2434 {
2435 if (line >= es->line_count)
2436 return 0;
2437 }
2438 else
2439 line = 0;
2440
2442 src = es->text + i;
2443 line_len = EDIT_EM_LineLength(es, i);
2444 dst_len = *(WORD *)dst;
2445
2446 if (dst_len <= line_len)
2447 {
2448 memcpy(dst, src, dst_len * sizeof(WCHAR));
2449 return dst_len;
2450 }
2451 else /* Append 0 if enough space */
2452 {
2453 memcpy(dst, src, line_len * sizeof(WCHAR));
2454 dst[line_len] = 0;
2455 return line_len;
2456 }
static INT EDIT_EM_LineIndex(const EDITSTATE *es, INT line)
Definition: edit.c:944
static INT EDIT_EM_LineLength(EDITSTATE *es, INT index)
Definition: edit.c:979
unsigned short WORD
Definition: ntddk_ex.h:93
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_GetSel()

static LRESULT EDIT_EM_GetSel ( const EDITSTATE es,
PUINT  start,
PUINT  end 
)
static

Definition at line 2464 of file edit.c.

2466{
2467 UINT s = es->selection_start;
2468 UINT e = es->selection_end;
2469
2470 ORDER_UINT(s, e);
2471 if (start)
2472 *start = s;
2473 if (end)
2474 *end = e;
2475 return MAKELONG(s, e);
#define ORDER_UINT(x, y)
Definition: edit.c:166
GLdouble s
Definition: gl.h:2039
GLuint GLuint end
Definition: gl.h:1545
#define e
Definition: ke_i.h:82
unsigned int UINT
Definition: ndis.h:50

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_GetThumb()

static LRESULT EDIT_EM_GetThumb ( EDITSTATE es)
static

Definition at line 4260 of file edit.c.

4262{
static LRESULT EDIT_WM_HScroll(EDITSTATE *es, INT action, INT pos)
Definition: edit.c:4008
static LRESULT EDIT_WM_VScroll(EDITSTATE *es, INT action, INT pos)
Definition: edit.c:4140
#define EM_GETTHUMB
Definition: winuser.h:1997

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_LineFromChar()

static INT EDIT_EM_LineFromChar ( EDITSTATE es,
INT  index 
)
static

Definition at line 915 of file edit.c.

917{
918 INT line;
919 LINEDEF *line_def;
920
921 if (!(es->style & ES_MULTILINE))
922 return 0;
923 if (index > (INT)get_text_length(es))
924 return es->line_count - 1;
925 if (index == -1)
926 index = min(es->selection_start, es->selection_end);
927
928 line = 0;
929 line_def = es->first_line_def;
930 index -= line_def->length;
931 while ((index >= 0) && line_def->next) {
932 line++;
933 line_def = line_def->next;
934 index -= line_def->length;
935 }
936 return line;

Referenced by EDIT_EM_CharFromPos(), EDIT_EM_LineLength(), EDIT_EM_PosFromChar(), EDIT_EM_ScrollCaret(), EDIT_ML_InvalidateText(), EDIT_MoveWordBackward(), EDIT_MoveWordForward(), EDIT_WindowProc(), EDIT_WM_LButtonDblClk(), and EditWndProc_common().

◆ EDIT_EM_LineIndex()

static INT EDIT_EM_LineIndex ( const EDITSTATE es,
INT  line 
)
static

Definition at line 944 of file edit.c.

946{
947 INT line_index;
948 const LINEDEF *line_def;
949
950 if (!(es->style & ES_MULTILINE))
951 return 0;
952 if (line >= es->line_count)
953 return -1;
954
955 line_index = 0;
956 line_def = es->first_line_def;
957 if (line == -1) {
958 INT index = es->selection_end - line_def->length;
959 while ((index >= 0) && line_def->next) {
960 line_index += line_def->length;
961 line_def = line_def->next;
962 index -= line_def->length;
963 }
964 } else {
965 while (line > 0) {
966 line_index += line_def->length;
967 line_def = line_def->next;
968 line--;
969 }
970 }
971 return line_index;

Referenced by EDIT_EM_GetLine(), EDIT_EM_LineLength(), EDIT_EM_PosFromChar(), EDIT_ML_InvalidateText(), EDIT_MoveWordBackward(), EDIT_MoveWordForward(), EDIT_PaintLine(), EDIT_PaintText(), EDIT_WindowProc(), EDIT_WM_LButtonDblClk(), and EditWndProc_common().

◆ EDIT_EM_LineLength()

static INT EDIT_EM_LineLength ( EDITSTATE es,
INT  index 
)
static

Definition at line 979 of file edit.c.

981{
982 LINEDEF *line_def;
983
984 if (!(es->style & ES_MULTILINE))
985 return get_text_length(es);
986
987 if (index == -1) {
988 /* get the number of remaining non-selected chars of selected lines */
989 INT32 l; /* line number */
990 INT32 li; /* index of first char in line */
991 INT32 count;
992 l = EDIT_EM_LineFromChar(es, es->selection_start);
993 /* # chars before start of selection area */
994 count = es->selection_start - EDIT_EM_LineIndex(es, l);
995 l = EDIT_EM_LineFromChar(es, es->selection_end);
996 /* # chars after end of selection */
998 count += li + EDIT_EM_LineLength(es, li) - es->selection_end;
999 return count;
1000 }
1001 line_def = es->first_line_def;
1002 index -= line_def->length;
1003 while ((index >= 0) && line_def->next) {
1004 line_def = line_def->next;
1005 index -= line_def->length;
1006 }
1007 return line_def->net_length;
signed int INT32
r l[0]
Definition: byte_order.h:168
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235

Referenced by EDIT_EM_GetLine(), EDIT_EM_LineLength(), EDIT_ML_InvalidateText(), EDIT_MoveWordBackward(), EDIT_MoveWordForward(), EDIT_PaintLine(), EDIT_WindowProc(), EDIT_WM_LButtonDblClk(), and EditWndProc_common().

◆ EDIT_EM_LineScroll()

static BOOL EDIT_EM_LineScroll ( EDITSTATE es,
INT  dx,
INT  dy 
)
static

Definition at line 1655 of file edit.c.

1657{
1658 if (!(es->style & ES_MULTILINE))
1659 return FALSE;
1660
1661 dx *= es->char_width;
static BOOL EDIT_EM_LineScroll_internal(EDITSTATE *es, INT dx, INT dy)
Definition: edit.c:1599
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97

Referenced by EDIT_EM_Scroll(), EDIT_WindowProc(), EDIT_WM_VScroll(), and EditWndProc_common().

◆ EDIT_EM_LineScroll_internal()

static BOOL EDIT_EM_LineScroll_internal ( EDITSTATE es,
INT  dx,
INT  dy 
)
static

Definition at line 1599 of file edit.c.

1601{
1602 INT nyoff;
1603 INT x_offset_in_pixels;
1604 INT lines_per_page = (es->format_rect.bottom - es->format_rect.top) /
1605 es->line_height;
1606
1607 if (es->style & ES_MULTILINE)
1608 {
1609 x_offset_in_pixels = es->x_offset;
1610 }
1611 else
1612 {
1613 dy = 0;
1614 x_offset_in_pixels = (short)LOWORD(EDIT_EM_PosFromChar(es, es->x_offset, FALSE));
1615 }
1616
1617 if (-dx > x_offset_in_pixels)
1618 dx = -x_offset_in_pixels;
1619 if (dx > es->text_width - x_offset_in_pixels)
1620 dx = es->text_width - x_offset_in_pixels;
1621 nyoff = max(0, es->y_offset + dy);
1622 if (nyoff >= es->line_count - lines_per_page)
1623 nyoff = max(0, es->line_count - lines_per_page);
1624 dy = (es->y_offset - nyoff) * es->line_height;
1625 if (dx || dy) {
1626 RECT rc1;
1627 RECT rc;
1628
1629 es->y_offset = nyoff;
1630 if(es->style & ES_MULTILINE)
1631 es->x_offset += dx;
1632 else
1633 es->x_offset += dx / es->char_width;
1634
1635 GetClientRect(es->hwndSelf, &rc1);
1636 IntersectRect(&rc, &rc1, &es->format_rect);
1637 ScrollWindowEx(es->hwndSelf, -dx, dy,
1638 NULL, &rc, NULL, NULL, SW_INVALIDATE);
1639 /* force scroll info update */
1641 }
1642 if (dx && !(es->flags & EF_HSCROLL_TRACK))
1644 if (dy && !(es->flags & EF_VSCROLL_TRACK))
1646 return TRUE;
static BOOL notify_parent(const EDITSTATE *es, INT code)
Definition: edit.c:168
#define EF_HSCROLL_TRACK
Definition: edit.c:74
#define EF_VSCROLL_TRACK
Definition: edit.c:73
#define SW_INVALIDATE
Definition: winuser.h:2578
#define EN_HSCROLL
Definition: winuser.h:2023
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
#define EN_VSCROLL
Definition: winuser.h:2028
int WINAPI ScrollWindowEx(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT, _In_ UINT)

Referenced by EDIT_EM_LineScroll(), EDIT_EM_ScrollCaret(), and EDIT_WM_HScroll().

◆ EDIT_EM_PosFromChar()

static LRESULT EDIT_EM_PosFromChar ( EDITSTATE es,
INT  index,
BOOL  after_wrap 
)
static

Definition at line 1015 of file edit.c.

1017{
1019 INT l;
1020 INT li;
1021 INT x = 0;
1022 INT y = 0;
1023 INT w;
1024 INT lw;
1025 LINEDEF *line_def;
1026
1027 index = min(index, len);
1028 if (es->style & ES_MULTILINE) {
1031
1032 y = (l - es->y_offset) * es->line_height;
1034 if (after_wrap && (li == index) && l) {
1035 INT l2 = l - 1;
1036 line_def = es->first_line_def;
1037 while (l2) {
1038 line_def = line_def->next;
1039 l2--;
1040 }
1041 if (line_def->ending == END_WRAP) {
1042 l--;
1043 y -= es->line_height;
1045 }
1046 }
1047
1048 line_def = es->first_line_def;
1049 while (line_def->index != li)
1050 line_def = line_def->next;
1051
1052 lw = line_def->width;
1053 w = es->format_rect.right - es->format_rect.left;
1054 if (line_def->ssa)
1055 {
1056 ScriptStringCPtoX(line_def->ssa, (index - 1) - li, TRUE, &x);
1057 x -= es->x_offset;
1058 }
1059 else
1060#ifdef __REACTOS__ /* CORE-15780 */
1061 x = (lw > 0 ? es->x_offset : x - es->x_offset);
1062#else
1063 x = es->x_offset;
1064#endif
1065
1066 if (es->style & ES_RIGHT)
1067 x = w - (lw - x);
1068 else if (es->style & ES_CENTER)
1069 x += (w - lw) / 2;
1070 } else {
1071 INT xoff = 0;
1072 INT xi = 0;
1074 if (es->x_offset)
1075 {
1076 if (es->ssa)
1077 {
1078 if (es->x_offset >= get_text_length(es))
1079 {
1080 int leftover = es->x_offset - get_text_length(es);
1081 if (es->ssa)
1082 {
1083 const SIZE *size;
1084 size = ScriptString_pSize(es->ssa);
1085 xoff = size->cx;
1086 }
1087 else
1088 xoff = 0;
1089 xoff += es->char_width * leftover;
1090 }
1091 else
1092 ScriptStringCPtoX(es->ssa, es->x_offset, FALSE, &xoff);
1093 }
1094 else
1095 xoff = 0;
1096 }
1097 if (index)
1098 {
1099 if (index >= get_text_length(es))
1100 {
1101 if (es->ssa)
1102 {
1103 const SIZE *size;
1104 size = ScriptString_pSize(es->ssa);
1105 xi = size->cx;
1106 }
1107 else
1108 xi = 0;
1109 }
1110 else if (es->ssa)
1111 ScriptStringCPtoX(es->ssa, index, FALSE, &xi);
1112 else
1113 xi = 0;
1114 }
1115 x = xi - xoff;
1116
1117 if (index >= es->x_offset) {
1118 if (!es->x_offset && (es->style & (ES_RIGHT | ES_CENTER)))
1119 {
1120 w = es->format_rect.right - es->format_rect.left;
1121 if (w > es->text_width)
1122 {
1123 if (es->style & ES_RIGHT)
1124 x += w - es->text_width;
1125 else if (es->style & ES_CENTER)
1126 x += (w - es->text_width) / 2;
1127 }
1128 }
1129 }
1130 y = 0;
1131 }
1132 x += es->format_rect.left;
1133 y += es->format_rect.top;
1134 return MAKELONG((INT16)x, (INT16)y);
signed short INT16
GLenum GLsizei len
Definition: glext.h:6722

Referenced by EDIT_BuildLineDefs_ML(), EDIT_EM_LineScroll_internal(), EDIT_EM_ScrollCaret(), EDIT_GetLineRect(), EDIT_MoveDown_ML(), EDIT_MoveEnd(), EDIT_MoveHome(), EDIT_MovePageDown_ML(), EDIT_MovePageUp_ML(), EDIT_MoveUp_ML(), EDIT_PaintLine(), EDIT_SetCaretPos(), and EDIT_WindowProc().

◆ EDIT_EM_ReplaceSel()

static void EDIT_EM_ReplaceSel ( EDITSTATE es,
BOOL  can_undo,
const WCHAR lpsz_replace,
UINT  strl,
BOOL  send_update,
BOOL  honor_limit 
)
static

Definition at line 2485 of file edit.c.

2488{
2489 UINT tl = get_text_length(es);
2490 UINT utl;
2491 UINT s;
2492 UINT e;
2493 UINT i;
2494 UINT size;
2495 LPWSTR p;
2496 HRGN hrgn = 0;
2497 LPWSTR buf = NULL;
2498 UINT bufl;
2499
2500 TRACE("%s, can_undo %d, send_update %d\n",
2501 debugstr_wn(lpsz_replace, strl), can_undo, send_update);
2502
2503 s = es->selection_start;
2504 e = es->selection_end;
2505
2507 if ((s == e) && !strl)
2508 return;
2509
2510 ORDER_UINT(s, e);
2511
2512 size = tl - (e - s) + strl;
2513 if (!size)
2514 es->text_width = 0;
2515
2516 /* Issue the EN_MAXTEXT notification and continue with replacing text
2517 * so that buffer limit is honored. */
2518 if ((honor_limit) && (size > es->buffer_limit))
2519 {
2520 if (!notify_parent(es, EN_MAXTEXT)) return;
2521 /* Buffer limit can be smaller than the actual length of text in combobox */
2522 if (es->buffer_limit < (tl - (e-s)))
2523 strl = 0;
2524 else
2525 strl = min(strl, es->buffer_limit - (tl - (e-s)));
2526 }
2527
2528 if (!EDIT_MakeFit(es, tl - (e - s) + strl))
2529 return;
2530
2531 if (e != s) {
2532 /* there is something to be deleted */
2533 TRACE("deleting stuff.\n");
2534 bufl = e - s;
2535 buf = heap_alloc((bufl + 1) * sizeof(WCHAR));
2536 if (!buf) return;
2537 memcpy(buf, es->text + s, bufl * sizeof(WCHAR));
2538 buf[bufl] = 0; /* ensure 0 termination */
2539 /* now delete */
2540 strcpyW(es->text + s, es->text + e);
2542 }
2543 if (strl) {
2544 /* there is an insertion */
2545 tl = get_text_length(es);
2546 TRACE("inserting stuff (tl %d, strl %d, selstart %d (%s), text %s)\n", tl, strl, s, debugstr_w(es->text + s), debugstr_w(es->text));
2547 for (p = es->text + tl ; p >= es->text + s ; p--)
2548 p[strl] = p[0];
2549 for (i = 0 , p = es->text + s ; i < strl ; i++)
2550 p[i] = lpsz_replace[i];
2551 if(es->style & ES_UPPERCASE)
2552 CharUpperBuffW(p, strl);
2553 else if(es->style & ES_LOWERCASE)
2554 CharLowerBuffW(p, strl);
2556 }
2557 if (es->style & ES_MULTILINE)
2558 {
2559 INT st = min(es->selection_start, es->selection_end);
2561
2562 hrgn = CreateRectRgn(0, 0, 0, 0);
2563 EDIT_BuildLineDefs_ML(es, st, st + strl,
2564 strl - abs(es->selection_end - es->selection_start), hrgn);
2565 /* if text is too long undo all changes */
2566 if (honor_limit && !(es->style & ES_AUTOVSCROLL) && (es->line_count > vlc)) {
2567 if (strl)
2568 strcpyW(es->text + e, es->text + e + strl);
2569 if (e != s)
2570 for (i = 0 , p = es->text ; i < e - s ; i++)
2571 p[i + s] = buf[i];
2574 abs(es->selection_end - es->selection_start) - strl, hrgn);
2575 strl = 0;
2576 e = s;
2577 SetRectRgn(hrgn, 0, 0, 0, 0);
2578 if (!notify_parent(es, EN_MAXTEXT)) return;
2579 }
2580 }
2581 else {
2582 INT fw = es->format_rect.right - es->format_rect.left;
2585 /* remove chars that don't fit */
2586 if (honor_limit && !(es->style & ES_AUTOHSCROLL) && (es->text_width > fw)) {
2587 while ((es->text_width > fw) && s + strl >= s) {
2588 strcpyW(es->text + s + strl - 1, es->text + s + strl);
2589 strl--;
2590 es->text_length = -1;
2593 }
2595 if (!notify_parent(es, EN_MAXTEXT)) return;
2596 }
2597 }
2598
2599 if (e != s) {
2600 if (can_undo) {
2601 utl = strlenW(es->undo_text);
2602 if (!es->undo_insert_count && (*es->undo_text && (s == es->undo_position))) {
2603 /* undo-buffer is extended to the right */
2604 EDIT_MakeUndoFit(es, utl + e - s);
2605 memcpy(es->undo_text + utl, buf, (e - s)*sizeof(WCHAR));
2606 (es->undo_text + utl)[e - s] = 0; /* ensure 0 termination */
2607 } else if (!es->undo_insert_count && (*es->undo_text && (e == es->undo_position))) {
2608 /* undo-buffer is extended to the left */
2609 EDIT_MakeUndoFit(es, utl + e - s);
2610 for (p = es->undo_text + utl ; p >= es->undo_text ; p--)
2611 p[e - s] = p[0];
2612 for (i = 0 , p = es->undo_text ; i < e - s ; i++)
2613 p[i] = buf[i];
2614 es->undo_position = s;
2615 } else {
2616 /* new undo-buffer */
2617 EDIT_MakeUndoFit(es, e - s);
2618 memcpy(es->undo_text, buf, (e - s)*sizeof(WCHAR));
2619 es->undo_text[e - s] = 0; /* ensure 0 termination */
2620 es->undo_position = s;
2621 }
2622 /* any deletion makes the old insertion-undo invalid */
2623 es->undo_insert_count = 0;
2624 } else
2626 }
2627 if (strl) {
2628 if (can_undo) {
2629 if ((s == es->undo_position) ||
2630 ((es->undo_insert_count) &&
2631 (s == es->undo_position + es->undo_insert_count)))
2632 /*
2633 * insertion is new and at delete position or
2634 * an extension to either left or right
2635 */
2636 es->undo_insert_count += strl;
2637 else {
2638 /* new insertion undo */
2639 es->undo_position = s;
2640 es->undo_insert_count = strl;
2641 /* new insertion makes old delete-buffer invalid */
2642 *es->undo_text = '\0';
2643 }
2644 } else
2646 }
2647
2648 heap_free(buf);
2649
2650 s += strl;
2651
2652 /* If text has been deleted and we're right or center aligned then scroll rightward */
2653 if (es->style & (ES_RIGHT | ES_CENTER))
2654 {
2655 INT delta = strl - abs(es->selection_end - es->selection_start);
2656
2657 if (delta < 0 && es->x_offset)
2658 {
2659 if (abs(delta) > es->x_offset)
2660 es->x_offset = 0;
2661 else
2662 es->x_offset += delta;
2663 }
2664 }
2665
2667 es->flags |= EF_MODIFIED;
2668 if (send_update) es->flags |= EF_UPDATE;
2669 if (hrgn)
2670 {
2673 }
2674 else
2676
2678
2679 /* force scroll info update */
2681
2682
2683 if(send_update || (es->flags & EF_UPDATE))
2684 {
2685 es->flags &= ~EF_UPDATE;
2686 if (!notify_parent(es, EN_CHANGE)) return;
2687 }
#define EF_MODIFIED
Definition: edit.c:70
static void EDIT_CalcLineWidth_SL(EDITSTATE *es)
Definition: edit.c:763
static void EDIT_EM_ScrollCaret(EDITSTATE *es)
Definition: edit.c:1778
#define EF_UPDATE
Definition: edit.c:72
static void EDIT_InvalidateUniscribeData(EDITSTATE *es)
Definition: edit.c:317
static void EDIT_EM_EmptyUndoBuffer(EDITSTATE *es)
Definition: edit.c:194
static void text_buffer_changed(EDITSTATE *es)
Definition: edit.c:1196
static BOOL EDIT_MakeFit(EDITSTATE *es, UINT size)
Definition: edit.c:1274
static BOOL EDIT_MakeUndoFit(EDITSTATE *es, UINT size)
Definition: edit.c:1315
static void EDIT_UpdateTextRegion(EDITSTATE *es, HRGN hrgn, BOOL bErase)
Definition: edit.c:1342
static void EDIT_UpdateText(EDITSTATE *es, const RECT *rc, BOOL bErase)
Definition: edit.c:1357
static BOOL EDIT_EM_SetSel(EDITSTATE *es, UINT start, UINT end, BOOL after_wrap)
Definition: edit.c:1487
#define abs(i)
Definition: fconv.c:206
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLfloat GLfloat p
Definition: glext.h:8902
#define debugstr_wn
Definition: kernel32.h:33
#define debugstr_w
Definition: kernel32.h:32
#define ES_LOWERCASE
Definition: pedump.c:669
#define ES_AUTOVSCROLL
Definition: pedump.c:671
#define ES_UPPERCASE
Definition: pedump.c:668
#define strcpyW(d, s)
Definition: unicode.h:29
#define EN_MAXTEXT
Definition: winuser.h:2025
DWORD WINAPI CharUpperBuffW(_Inout_updates_(cchLength) LPWSTR lpsz, _In_ DWORD cchLength)
#define EN_CHANGE
Definition: winuser.h:2021
DWORD WINAPI CharLowerBuffW(_Inout_updates_(cchLength) LPWSTR lpsz, _In_ DWORD cchLength)

Referenced by EDIT_EM_Undo(), EDIT_GetCompositionStr(), EDIT_GetResultStr(), EDIT_ImeComposition(), EDIT_WindowProc(), EDIT_WM_Char(), EDIT_WM_Clear(), EDIT_WM_Create(), EDIT_WM_Paste(), EDIT_WM_SetText(), and EditWndProc_common().

◆ EDIT_EM_Scroll()

static LRESULT EDIT_EM_Scroll ( EDITSTATE es,
INT  action 
)
static

Definition at line 1670 of file edit.c.

1672{
1673 INT dy;
1674
1675 if (!(es->style & ES_MULTILINE))
1676 return (LRESULT)FALSE;
1677
1678 dy = 0;
1679
1680 switch (action) {
1681 case SB_LINEUP:
1682 if (es->y_offset)
1683 dy = -1;
1684 break;
1685 case SB_LINEDOWN:
1686 if (es->y_offset < es->line_count - 1)
1687 dy = 1;
1688 break;
1689 case SB_PAGEUP:
1690 if (es->y_offset)
1691 dy = -(es->format_rect.bottom - es->format_rect.top) / es->line_height;
1692 break;
1693 case SB_PAGEDOWN:
1694 if (es->y_offset < es->line_count - 1)
1695 dy = (es->format_rect.bottom - es->format_rect.top) / es->line_height;
1696 break;
1697 default:
1699 }
1700 if (dy) {
1702 /* check if we are going to move too far */
1703 if(es->y_offset + dy > es->line_count - vlc)
1704 dy = max(es->line_count - vlc, 0) - es->y_offset;
1705
1706 /* Notification is done in EDIT_EM_LineScroll */
1707 if(dy) {
1709 return MAKELONG(dy, TRUE);
1710 }
1711
1712 }
1713 return (LRESULT)FALSE;
return
Definition: dirsup.c:529
static BOOL EDIT_EM_LineScroll(EDITSTATE *es, INT dx, INT dy)
Definition: edit.c:1655
LONG_PTR LRESULT
Definition: windef.h:209
#define SB_LINEUP
Definition: winuser.h:564
#define SB_PAGEDOWN
Definition: winuser.h:569
#define SB_LINEDOWN
Definition: winuser.h:565
#define SB_PAGEUP
Definition: winuser.h:568

Referenced by EDIT_WindowProc(), EDIT_WM_VScroll(), and EditWndProc_common().

◆ EDIT_EM_ScrollCaret()

static void EDIT_EM_ScrollCaret ( EDITSTATE es)
static

Definition at line 1778 of file edit.c.

1780{
1781 if (es->style & ES_MULTILINE) {
1782 INT l;
1783 INT vlc;
1784 INT ww;
1785 INT cw = es->char_width;
1786 INT x;
1787 INT dy = 0;
1788 INT dx = 0;
1789
1790 l = EDIT_EM_LineFromChar(es, es->selection_end);
1791 x = (short)LOWORD(EDIT_EM_PosFromChar(es, es->selection_end, es->flags & EF_AFTER_WRAP));
1793 if (l >= es->y_offset + vlc)
1794 dy = l - vlc + 1 - es->y_offset;
1795 if (l < es->y_offset)
1796 dy = l - es->y_offset;
1797 ww = es->format_rect.right - es->format_rect.left;
1798 if (x < es->format_rect.left)
1799 dx = x - es->format_rect.left - ww / HSCROLL_FRACTION / cw * cw;
1800 if (x > es->format_rect.right)
1801 dx = x - es->format_rect.left - (HSCROLL_FRACTION - 1) * ww / HSCROLL_FRACTION / cw * cw;
1802 if (dy || dx || (es->y_offset && (es->line_count - es->y_offset < vlc)))
1803 {
1804 /* check if we are going to move too far */
1805 if(es->x_offset + dx + ww > es->text_width)
1806 dx = es->text_width - ww - es->x_offset;
1807 if(dx || dy || (es->y_offset && (es->line_count - es->y_offset < vlc)))
1809 }
1810 } else {
1811 INT x;
1812 INT goal;
1813 INT format_width;
1814
1815 x = (short)LOWORD(EDIT_EM_PosFromChar(es, es->selection_end, FALSE));
1816 format_width = es->format_rect.right - es->format_rect.left;
1817 if (x < es->format_rect.left) {
1818 goal = es->format_rect.left + format_width / HSCROLL_FRACTION;
1819 do {
1820 es->x_offset--;
1821 x = (short)LOWORD(EDIT_EM_PosFromChar(es, es->selection_end, FALSE));
1822 } while ((x < goal) && es->x_offset);
1823 /* FIXME: use ScrollWindow() somehow to improve performance */
1825 } else if (x > es->format_rect.right) {
1826 INT x_last;
1828 goal = es->format_rect.right - format_width / HSCROLL_FRACTION;
1829 do {
1830 es->x_offset++;
1831 x = (short)LOWORD(EDIT_EM_PosFromChar(es, es->selection_end, FALSE));
1833 } while ((x > goal) && (x_last > es->format_rect.right));
1834 /* FIXME: use ScrollWindow() somehow to improve performance */
1836 }
1837 }
1838
1839 if(es->flags & EF_FOCUSED)
1840 EDIT_SetCaretPos(es, es->selection_end, es->flags & EF_AFTER_WRAP);
#define EF_FOCUSED
Definition: edit.c:71
#define HSCROLL_FRACTION
Definition: edit.c:65

Referenced by EDIT_EM_ReplaceSel(), EDIT_EM_SetHandle(), EDIT_EM_Undo(), EDIT_MoveBackward(), EDIT_MoveDown_ML(), EDIT_MoveEnd(), EDIT_MoveForward(), EDIT_MoveHome(), EDIT_MovePageDown_ML(), EDIT_MovePageUp_ML(), EDIT_MoveUp_ML(), EDIT_MoveWordBackward(), EDIT_MoveWordForward(), EDIT_WindowProc(), EDIT_WM_Create(), EDIT_WM_LButtonDblClk(), EDIT_WM_LButtonDown(), EDIT_WM_SetText(), and EditWndProc_common().

◆ EDIT_EM_SetHandle()

static void EDIT_EM_SetHandle ( EDITSTATE es,
HLOCAL  hloc 
)
static

Definition at line 2698 of file edit.c.

2700{
2701 if (!(es->style & ES_MULTILINE))
2702 return;
2703
2704 if (!hloc)
2705 return;
2706
2708
2709 es->hloc32W = hloc;
2710 es->buffer_size = LocalSize(es->hloc32W)/sizeof(WCHAR) - 1;
2711
2712 /* The text buffer handle belongs to the control */
2713 es->hlocapp = NULL;
2714
2717
2718 es->x_offset = es->y_offset = 0;
2719 es->selection_start = es->selection_end = 0;
2721 es->flags &= ~EF_MODIFIED;
2722 es->flags &= ~EF_UPDATE;
2726 /* force scroll info update */
static void EDIT_LockBuffer(EDITSTATE *es)
Definition: edit.c:1209

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_SetLimitText()

static void EDIT_EM_SetLimitText ( EDITSTATE es,
UINT  limit 
)
static

Definition at line 2737 of file edit.c.

2739{
2740 if (!limit) limit = ~0u;
2741 if (!(es->style & ES_MULTILINE)) limit = min(limit, 0x7ffffffe);
2742 es->buffer_limit = limit;
GLint limit
Definition: glext.h:10326
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_SetMargins()

static void EDIT_EM_SetMargins ( EDITSTATE es,
INT  action,
WORD  left,
WORD  right,
BOOL  repaint 
)
static

Definition at line 2773 of file edit.c.

2776{
2778 INT default_left_margin = 0; /* in pixels */
2779 INT default_right_margin = 0; /* in pixels */
2780
2781 /* Set the default margins depending on the font */
2782 if (es->font && (left == EC_USEFONTINFO || right == EC_USEFONTINFO)) {
2783 HDC dc = GetDC(es->hwndSelf);
2784 HFONT old_font = SelectObject(dc, es->font);
2786 RECT rc;
2787
2788 /* The default margins are only non zero for TrueType or Vector fonts */
2789 if (tm.tmPitchAndFamily & ( TMPF_VECTOR | TMPF_TRUETYPE )) {
2790 if (!is_cjk(tm.tmCharSet)) {
2791 default_left_margin = width / 2;
2792 default_right_margin = width / 2;
2793
2794 GetClientRect(es->hwndSelf, &rc);
2795 if (rc.right - rc.left < (width / 2 + width) * 2 &&
2796 (width >= 28 || !IsRectEmpty(&rc)) ) {
2797 default_left_margin = es->left_margin;
2798 default_right_margin = es->right_margin;
2799 }
2800 } else {
2801 /* FIXME: figure out the CJK values. They are not affected by the client rect. */
2802 default_left_margin = width / 2;
2803 default_right_margin = width / 2;
2804 }
2805 }
2806 SelectObject(dc, old_font);
2807 ReleaseDC(es->hwndSelf, dc);
2808 }
2809
2810 if (action & EC_LEFTMARGIN) {
2811 es->format_rect.left -= es->left_margin;
2812 if (left != EC_USEFONTINFO)
2813 es->left_margin = left;
2814 else
2815 es->left_margin = default_left_margin;
2816 es->format_rect.left += es->left_margin;
2817 }
2818
2819 if (action & EC_RIGHTMARGIN) {
2820 es->format_rect.right += es->right_margin;
2821 if (right != EC_USEFONTINFO)
2822 es->right_margin = right;
2823 else
2824 es->right_margin = default_right_margin;
2825 es->format_rect.right -= es->right_margin;
2826 }
2827
2830 if (repaint) EDIT_UpdateText(es, NULL, TRUE);
2831 }
2832
2833 TRACE("left=%d, right=%d\n", es->left_margin, es->right_margin);
static void EDIT_AdjustFormatRect(EDITSTATE *es)
Definition: edit.c:2261
GLint GLint GLsizei width
Definition: gl.h:1546
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
static const WCHAR dc[]
static HDC
Definition: imagelist.c:92
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static BOOL is_cjk(void)
Definition: dde.c:46
long LONG
Definition: pedump.c:60
Definition: time.h:68
LONG WINAPI GdiGetCharDimensions(HDC, LPTEXTMETRICW, LONG *)
Definition: font.c:2145
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define TMPF_TRUETYPE
Definition: wingdi.h:1313
#define TMPF_VECTOR
Definition: wingdi.h:1312
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define EC_RIGHTMARGIN
Definition: winuser.h:2606
#define EC_USEFONTINFO
Definition: winuser.h:2607
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
HDC WINAPI GetDC(_In_opt_ HWND)
#define EC_LEFTMARGIN
Definition: winuser.h:2605

Referenced by EDIT_WindowProc(), and EDIT_WM_SetFont().

◆ EDIT_EM_SetPasswordChar()

static void EDIT_EM_SetPasswordChar ( EDITSTATE es,
WCHAR  c 
)
static

Definition at line 2841 of file edit.c.

2843{
2844 LONG style;
2845
2846 if (es->style & ES_MULTILINE)
2847 return;
2848
2849 if (es->password_char == c)
2850 return;
2851
2852 style = GetWindowLongW( es->hwndSelf, GWL_STYLE );
2853 es->password_char = c;
2854 if (c) {
2855 SetWindowLongW( es->hwndSelf, GWL_STYLE, style | ES_PASSWORD );
2856 es->style |= ES_PASSWORD;
2857 } else {
2858 SetWindowLongW( es->hwndSelf, GWL_STYLE, style & ~ES_PASSWORD );
2859 es->style &= ~ES_PASSWORD;
2860 }
Arabic default style
Definition: afstyles.h:94
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
#define ES_PASSWORD
Definition: pedump.c:670
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define GWL_STYLE
Definition: winuser.h:851

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_SetSel()

static BOOL EDIT_EM_SetSel ( EDITSTATE es,
UINT  start,
UINT  end,
BOOL  after_wrap 
)
static

Definition at line 1487 of file edit.c.

1489{
1490 UINT old_start = es->selection_start;
1491 UINT old_end = es->selection_end;
1493
1494 if (start == old_start && end == old_end)
1495 return FALSE;
1496
1497 if (start == (UINT)-1) {
1498 start = es->selection_end;
1499 end = es->selection_end;
1500 } else {
1501 start = min(start, len);
1502 end = min(end, len);
1503 }
1504 es->selection_start = start;
1505 es->selection_end = end;
1506 if (after_wrap)
1507 es->flags |= EF_AFTER_WRAP;
1508 else
1509 es->flags &= ~EF_AFTER_WRAP;
1510 /* Compute the necessary invalidation region. */
1511 /* Note that we don't need to invalidate regions which have
1512 * "never" been selected, or those which are "still" selected.
1513 * In fact, every time we hit a selection boundary, we can
1514 * *toggle* whether we need to invalidate. Thus we can optimize by
1515 * *sorting* the interval endpoints. Let's assume that we sort them
1516 * in this order:
1517 * start <= end <= old_start <= old_end
1518 * Knuth 5.3.1 (p 183) assures us that this can be done optimally
1519 * in 5 comparisons; i.e. it is impossible to do better than the
1520 * following: */
1521 ORDER_UINT(end, old_end);
1522 ORDER_UINT(start, old_start);
1523 ORDER_UINT(old_start, old_end);
1525 /* Note that at this point 'end' and 'old_start' are not in order, but
1526 * start is definitely the min. and old_end is definitely the max. */
1527 if (end != old_start)
1528 {
1529/*
1530 * One can also do
1531 * ORDER_UINT32(end, old_start);
1532 * EDIT_InvalidateText(es, start, end);
1533 * EDIT_InvalidateText(es, old_start, old_end);
1534 * in place of the following if statement.
1535 * (That would complete the optimal five-comparison four-element sort.)
1536 */
1537 if (old_start > end )
1538 {
1540 EDIT_InvalidateText(es, old_start, old_end);
1541 }
1542 else
1543 {
1544 EDIT_InvalidateText(es, start, old_start);
1545 EDIT_InvalidateText(es, end, old_end);
1546 }
1547 }
1548 else EDIT_InvalidateText(es, start, old_end);
1549
1550 return TRUE;
static void EDIT_InvalidateText(EDITSTATE *es, INT start, INT end)
Definition: edit.c:1457

Referenced by EDIT_EM_ReplaceSel(), EDIT_EM_Undo(), EDIT_MoveBackward(), EDIT_MoveDown_ML(), EDIT_MoveEnd(), EDIT_MoveForward(), EDIT_MoveHome(), EDIT_MovePageDown_ML(), EDIT_MovePageUp_ML(), EDIT_MoveUp_ML(), EDIT_MoveWordBackward(), EDIT_MoveWordForward(), EDIT_WindowProc(), EDIT_WM_Char(), EDIT_WM_KeyDown(), EDIT_WM_LButtonDblClk(), EDIT_WM_LButtonDown(), EDIT_WM_MouseMove(), EDIT_WM_SetText(), and EditWndProc_common().

◆ EDIT_EM_SetTabStops()

static BOOL EDIT_EM_SetTabStops ( EDITSTATE es,
INT  count,
const INT tabs 
)
static

Definition at line 2870 of file edit.c.

2872{
2873 if (!(es->style & ES_MULTILINE))
2874 return FALSE;
2875 heap_free(es->tabs);
2876 es->tabs_count = count;
2877 if (!count)
2878 es->tabs = NULL;
2879 else {
2880 es->tabs = heap_alloc(count * sizeof(INT));
2881 memcpy(es->tabs, tabs, count * sizeof(INT));
2882 }
2884 return TRUE;

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_SetWordBreakProc()

static void EDIT_EM_SetWordBreakProc ( EDITSTATE es,
EDITWORDBREAKPROCW  wbp 
)
static

Definition at line 2892 of file edit.c.

2894{
2895 if (es->word_break_proc == wbp)
2896 return;
2897
2898 es->word_break_proc = wbp;
2899
2900 if ((es->style & ES_MULTILINE) && !(es->style & ES_AUTOHSCROLL)) {
2903 }

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_Undo()

static BOOL EDIT_EM_Undo ( EDITSTATE es)
static

Definition at line 2911 of file edit.c.

2913{
2914 INT ulength;
2915 LPWSTR utext;
2916
2917 /* As per MSDN spec, for a single-line edit control,
2918 the return value is always TRUE */
2919 if( es->style & ES_READONLY )
2920 return !(es->style & ES_MULTILINE);
2921
2922 ulength = strlenW(es->undo_text);
2923
2924 utext = heap_alloc((ulength + 1) * sizeof(WCHAR));
2925
2926 strcpyW(utext, es->undo_text);
2927
2928 TRACE("before UNDO:insertion length = %d, deletion buffer = %s\n",
2929 es->undo_insert_count, debugstr_w(utext));
2930
2931 EDIT_EM_SetSel(es, es->undo_position, es->undo_position + es->undo_insert_count, FALSE);
2933 EDIT_EM_ReplaceSel(es, TRUE, utext, ulength, TRUE, TRUE);
2934 EDIT_EM_SetSel(es, es->undo_position, es->undo_position + es->undo_insert_count, FALSE);
2935 /* send the notification after the selection start and end are set */
2936 if (!notify_parent(es, EN_CHANGE)) return TRUE;
2938 heap_free(utext);
2939
2940 TRACE("after UNDO:insertion length = %d, deletion buffer = %s\n",
2941 es->undo_insert_count, debugstr_w(es->undo_text));
2942 return TRUE;
static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, const WCHAR *lpsz_replace, UINT strl, BOOL send_update, BOOL honor_limit)
Definition: edit.c:2485
#define ES_READONLY
Definition: pedump.c:675

Referenced by EDIT_WindowProc(), EDIT_WM_SysKeyDown(), and EditWndProc_common().

◆ EDIT_GetCompositionStr()

static void EDIT_GetCompositionStr ( HIMC  hIMC,
LPARAM  CompFlag,
EDITSTATE es 
)
static

Definition at line 4272 of file edit.c.

4274{
4275 LONG buflen;
4276 LPWSTR lpCompStr;
4277 LPSTR lpCompStrAttr = NULL;
4278 DWORD dwBufLenAttr;
4279
4280 buflen = ImmGetCompositionStringW(hIMC, GCS_COMPSTR, NULL, 0);
4281
4282 if (buflen < 0)
4283 {
4284 return;
4285 }
4286
4287 lpCompStr = heap_alloc(buflen);
4288 if (!lpCompStr)
4289 {
4290 ERR("Unable to allocate IME CompositionString\n");
4291 return;
4292 }
4293
4294 if (buflen)
4295 ImmGetCompositionStringW(hIMC, GCS_COMPSTR, lpCompStr, buflen);
4296
4297 if (CompFlag & GCS_COMPATTR)
4298 {
4299 /*
4300 * We do not use the attributes yet. it would tell us what characters
4301 * are in transition and which are converted or decided upon
4302 */
4303 dwBufLenAttr = ImmGetCompositionStringW(hIMC, GCS_COMPATTR, NULL, 0);
4304 if (dwBufLenAttr)
4305 {
4306 dwBufLenAttr ++;
4307 lpCompStrAttr = heap_alloc(dwBufLenAttr + 1);
4308 if (!lpCompStrAttr)
4309 {
4310 ERR("Unable to allocate IME Attribute String\n");
4311 heap_free(lpCompStr);
4312 return;
4313 }
4314 ImmGetCompositionStringW(hIMC,GCS_COMPATTR, lpCompStrAttr,
4315 dwBufLenAttr);
4316 lpCompStrAttr[dwBufLenAttr] = 0;
4317 }
4318 }
4319
4320#ifndef __REACTOS__ /* We don't use internal composition string. Rely on the composition window */
4321 /* check for change in composition start */
4322 if (es->selection_end < es->composition_start)
4323 es->composition_start = es->selection_end;
4324
4325 /* replace existing selection string */
4326 es->selection_start = es->composition_start;
4327
4328 if (es->composition_len > 0)
4329 es->selection_end = es->composition_start + es->composition_len;
4330 else
4331 es->selection_end = es->selection_start;
4332
4333 EDIT_EM_ReplaceSel(es, FALSE, lpCompStr, buflen / sizeof(WCHAR), TRUE, TRUE);
4334 es->composition_len = abs(es->composition_start - es->selection_end);
4335
4336 es->selection_start = es->composition_start;
4337 es->selection_end = es->selection_start + es->composition_len;
4338#endif
4339
4340 heap_free(lpCompStrAttr);
4341 heap_free(lpCompStr);
LONG WINAPI ImmGetCompositionStringW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
Definition: compstr.c:899
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GCS_COMPATTR
Definition: imm.h:228
#define GCS_COMPSTR
Definition: imm.h:227
char * LPSTR
Definition: xmlstorage.h:182

Referenced by EDIT_ImeComposition().

◆ EDIT_GetLineRect()

static void EDIT_GetLineRect ( EDITSTATE es,
INT  line,
INT  scol,
INT  ecol,
LPRECT  rc 
)
static

Definition at line 1145 of file edit.c.

1147{
1149 INT line_index = 0;
1150 INT pt1, pt2, pt3;
1151
1152 if (es->style & ES_MULTILINE)
1153 {
1154 const LINEDEF *line_def = NULL;
1155 rc->top = es->format_rect.top + (line - es->y_offset) * es->line_height;
1156 if (line >= es->line_count)
1157 return;
1158
1159 line_def = es->first_line_def;
1160 if (line == -1) {
1161 INT index = es->selection_end - line_def->length;
1162 while ((index >= 0) && line_def->next) {
1163 line_index += line_def->length;
1164 line_def = line_def->next;
1165 index -= line_def->length;
1166 }
1167 } else {
1168 while (line > 0) {
1169 line_index += line_def->length;
1170 line_def = line_def->next;
1171 line--;
1172 }
1173 }
1174 ssa = line_def->ssa;
1175 }
1176 else
1177 {
1178 line_index = 0;
1179 rc->top = es->format_rect.top;
1180 ssa = es->ssa;
1181 }
1182
1183 rc->bottom = rc->top + es->line_height;
1184 pt1 = (scol == 0) ? es->format_rect.left : (short)LOWORD(EDIT_EM_PosFromChar(es, line_index + scol, TRUE));
1185 pt2 = (ecol == -1) ? es->format_rect.right : (short)LOWORD(EDIT_EM_PosFromChar(es, line_index + ecol, TRUE));
1186 if (ssa)
1187 {
1188 ScriptStringCPtoX(ssa, scol, FALSE, &pt3);
1189 pt3+=es->format_rect.left;
1190 }
1191 else pt3 = pt1;
1192 rc->right = max(max(pt1 , pt2),pt3);
1193 rc->left = min(min(pt1, pt2),pt3);

Referenced by EDIT_ML_InvalidateText(), EDIT_SL_InvalidateText(), and EDIT_WM_Paint().

◆ EDIT_GetResultStr()

static void EDIT_GetResultStr ( HIMC  hIMC,
EDITSTATE es 
)
static

Definition at line 4343 of file edit.c.

4345{
4346 LONG buflen;
4347 LPWSTR lpResultStr;
4348
4349 buflen = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0);
4350 if (buflen <= 0)
4351 {
4352 return;
4353 }
4354
4355 lpResultStr = heap_alloc(buflen);
4356 if (!lpResultStr)
4357 {
4358 ERR("Unable to alloc buffer for IME string\n");
4359 return;
4360 }
4361
4362 ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, lpResultStr, buflen);
4363
4364#ifndef __REACTOS__
4365 /* check for change in composition start */
4366 if (es->selection_end < es->composition_start)
4367 es->composition_start = es->selection_end;
4368
4369 es->selection_start = es->composition_start;
4370 es->selection_end = es->composition_start + es->composition_len;
4371 EDIT_EM_ReplaceSel(es, TRUE, lpResultStr, buflen / sizeof(WCHAR), TRUE, TRUE);
4372 es->composition_start = es->selection_end;
4373 es->composition_len = 0;
4374#endif
4375
4376 heap_free(lpResultStr);
#define GCS_RESULTSTR
Definition: imm.h:234

Referenced by EDIT_ImeComposition().

◆ EDIT_ImeComposition()

static void EDIT_ImeComposition ( HWND  hwnd,
LPARAM  CompFlag,
EDITSTATE es 
)
static

Definition at line 4378 of file edit.c.

4380{
4381 HIMC hIMC;
4382 int cursor;
4383
4384#ifdef __REACTOS__
4385 if (es->selection_start != es->selection_end)
4387#else
4388 if (es->composition_len == 0 && es->selection_start != es->selection_end)
4389 {
4391 es->composition_start = es->selection_end;
4392 }
4393#endif
4394
4395 hIMC = ImmGetContext(hwnd);
4396 if (!hIMC)
4397 return;
4398
4399 if (CompFlag & GCS_RESULTSTR)
4400 {
4401 EDIT_GetResultStr(hIMC, es);
4402 cursor = 0;
4403 }
4404 else
4405 {
4406 if (CompFlag & GCS_COMPSTR)
4407 EDIT_GetCompositionStr(hIMC, CompFlag, es);
4408#ifdef __REACTOS__
4409 cursor = 0;
4410#else
4412#endif
4413 }
4414 ImmReleaseContext(hwnd, hIMC);
4415 EDIT_SetCaretPos(es, es->selection_start + cursor, es->flags & EF_AFTER_WRAP);
DWORD HIMC
Definition: dimm.idl:75
static void EDIT_GetResultStr(HIMC hIMC, EDITSTATE *es)
Definition: edit.c:4343
static void EDIT_GetCompositionStr(HIMC hIMC, LPARAM CompFlag, EDITSTATE *es)
Definition: edit.c:4272
HIMC WINAPI ImmGetContext(HWND hWnd)
Definition: imm.c:1044
BOOL WINAPI ImmReleaseContext(HWND hWnd, HIMC hIMC)
Definition: imm.c:1085
const char cursor[]
Definition: icontest.c:13
#define GCS_CURSORPOS
Definition: imm.h:230
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by EDIT_WindowProc().

◆ EDIT_InvalidateText()

static void EDIT_InvalidateText ( EDITSTATE es,
INT  start,
INT  end 
)
static

Definition at line 1457 of file edit.c.

1459{
1460 if (end == start)
1461 return;
1462
1463 if (end == -1)
1465
1466 if (end < start) {
1467 INT tmp = start;
1468 start = end;
1469 end = tmp;
1470 }
1471
1472 if (es->style & ES_MULTILINE)
1474 else
static void EDIT_ML_InvalidateText(EDITSTATE *es, INT start, INT end)
Definition: edit.c:1392
static void EDIT_SL_InvalidateText(EDITSTATE *es, INT start, INT end)
Definition: edit.c:1374

Referenced by EDIT_EM_SetSel(), EDIT_WM_KillFocus(), and EDIT_WM_SetFocus().

◆ EDIT_InvalidateUniscribeData()

static void EDIT_InvalidateUniscribeData ( EDITSTATE es)
inlinestatic

Definition at line 317 of file edit.c.

319{
320 LINEDEF *line_def = es->first_line_def;
321 while (line_def)
322 {
324 line_def = line_def->next;
325 }
326 if (es->ssa)
327 {
328 ScriptStringFree(&es->ssa);
329 es->ssa = NULL;
330 }
HRESULT WINAPI ScriptStringFree(SCRIPT_STRING_ANALYSIS *pssa)
Definition: usp10.c:2556

Referenced by EDIT_EM_ReplaceSel(), EDIT_EM_SetPasswordChar(), EDIT_EM_SetTabStops(), EDIT_WM_NCCreate(), EDIT_WM_NCDestroy(), EDIT_WM_Paint(), EDIT_WM_SetFont(), EDIT_WM_SetText(), and text_buffer_changed().

◆ EDIT_InvalidateUniscribeData_linedef()

static void EDIT_InvalidateUniscribeData_linedef ( LINEDEF line_def)
inlinestatic

Definition at line 308 of file edit.c.

310{
311 if (line_def->ssa)
312 {
313 ScriptStringFree(&line_def->ssa);
314 line_def->ssa = NULL;
315 }

Referenced by EDIT_BuildLineDefs_ML(), and EDIT_InvalidateUniscribeData().

◆ EDIT_IsInsideDialog()

static BOOL EDIT_IsInsideDialog ( EDITSTATE es)
inlinestatic

Definition at line 2952 of file edit.c.

2954{
2955 return (es->flags & EF_DIALOGMODE);
#define EF_DIALOGMODE
Definition: edit.c:77

Referenced by EDIT_WM_Char(), and EDIT_WM_KeyDown().

◆ EDIT_LockBuffer()

static void EDIT_LockBuffer ( EDITSTATE es)
static

Definition at line 1209 of file edit.c.

1211{
1212 if (!es->text)
1213 {
1214 if (!es->hloc32W)
1215 return;
1216
1217 es->text = LocalLock(es->hloc32W);
1218 }
1219
1220 es->lock_count++;
LPVOID NTAPI LocalLock(HLOCAL hMem)
Definition: heapmem.c:1616

Referenced by EDIT_EM_SetHandle(), EDIT_MakeFit(), EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_MakeFit()

static BOOL EDIT_MakeFit ( EDITSTATE es,
UINT  size 
)
static

Definition at line 1274 of file edit.c.

1276{
1277 HLOCAL hNew32W;
1278
1279 if (size <= es->buffer_size)
1280 return TRUE;
1281
1282 TRACE("trying to ReAlloc to %d+1 characters\n", size);
1283
1284 /* Force edit to unlock its buffer. es->text now NULL */
1286
1287 if (es->hloc32W) {
1288 UINT alloc_size = ROUND_TO_GROW((size + 1) * sizeof(WCHAR));
1289 if ((hNew32W = LocalReAlloc(es->hloc32W, alloc_size, LMEM_MOVEABLE | LMEM_ZEROINIT))) {
1290 TRACE("Old 32 bit handle %p, new handle %p\n", es->hloc32W, hNew32W);
1291 es->hloc32W = hNew32W;
1292 es->buffer_size = LocalSize(hNew32W)/sizeof(WCHAR) - 1;
1293 }
1294 }
1295
1297
1298 if (es->buffer_size < size) {
1299 WARN("FAILED ! We now have %d+1\n", es->buffer_size);
1301 return FALSE;
1302 } else {
1303 TRACE("We now have %d+1\n", es->buffer_size);
1304 return TRUE;
1305 }
#define WARN(fmt,...)
Definition: debug.h:112
#define ROUND_TO_GROW(size)
Definition: edit.c:64
HLOCAL NTAPI LocalReAlloc(HLOCAL hMem, SIZE_T dwBytes, UINT uFlags)
Definition: heapmem.c:1625
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
Definition: swimpl.c:888
#define LMEM_MOVEABLE
Definition: winbase.h:369
#define LMEM_ZEROINIT
Definition: winbase.h:375
#define EN_ERRSPACE
Definition: winuser.h:2022

Referenced by EDIT_EM_ReplaceSel().

◆ EDIT_MakeUndoFit()

static BOOL EDIT_MakeUndoFit ( EDITSTATE es,
UINT  size 
)
static

Definition at line 1315 of file edit.c.

1317{
1318 UINT alloc_size;
1319
1320 if (size <= es->undo_buffer_size)
1321 return TRUE;
1322
1323 TRACE("trying to ReAlloc to %d+1\n", size);
1324
1325 alloc_size = ROUND_TO_GROW((size + 1) * sizeof(WCHAR));
1326 if ((es->undo_text = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, es->undo_text, alloc_size))) {
1327 es->undo_buffer_size = alloc_size/sizeof(WCHAR) - 1;
1328 return TRUE;
1329 }
1330 else
1331 {
1332 WARN("FAILED ! We now have %d+1\n", es->undo_buffer_size);
1333 return FALSE;
1334 }
#define GetProcessHeap()
Definition: compat.h:736
#define HeapReAlloc
Definition: compat.h:734
#define HEAP_ZERO_MEMORY
Definition: compat.h:134

Referenced by EDIT_EM_ReplaceSel().

◆ EDIT_ML_InvalidateText()

static void EDIT_ML_InvalidateText ( EDITSTATE es,
INT  start,
INT  end 
)
static

Definition at line 1392 of file edit.c.

1394{
1398 INT sc;
1399 INT ec;
1400 RECT rc1;
1401 RECT rcWnd;
1402 RECT rcLine;
1403 RECT rcUpdate;
1404 INT l;
1405
1406 if ((el < es->y_offset) || (sl > es->y_offset + vlc))
1407 return;
1408
1409 sc = start - EDIT_EM_LineIndex(es, sl);
1410 ec = end - EDIT_EM_LineIndex(es, el);
1411 if (sl < es->y_offset) {
1412 sl = es->y_offset;
1413 sc = 0;
1414 }
1415 if (el > es->y_offset + vlc) {
1416 el = es->y_offset + vlc;
1418 }
1419 GetClientRect(es->hwndSelf, &rc1);
1420 IntersectRect(&rcWnd, &rc1, &es->format_rect);
1421 if (sl == el) {
1422 EDIT_GetLineRect(es, sl, sc, ec, &rcLine);
1423 if (IntersectRect(&rcUpdate, &rcWnd, &rcLine))
1424 EDIT_UpdateText(es, &rcUpdate, TRUE);
1425 } else {
1426 EDIT_GetLineRect(es, sl, sc,
1428 EDIT_EM_LineIndex(es, sl)),
1429 &rcLine);
1430 if (IntersectRect(&rcUpdate, &rcWnd, &rcLine))
1431 EDIT_UpdateText(es, &rcUpdate, TRUE);
1432 for (l = sl + 1 ; l < el ; l++) {
1433 EDIT_GetLineRect(es, l, 0,
1436 &rcLine);
1437 if (IntersectRect(&rcUpdate, &rcWnd, &rcLine))
1438 EDIT_UpdateText(es, &rcUpdate, TRUE);
1439 }
1440 EDIT_GetLineRect(es, el, 0, ec, &rcLine);
1441 if (IntersectRect(&rcUpdate, &rcWnd, &rcLine))
1442 EDIT_UpdateText(es, &rcUpdate, TRUE);
1443 }
static void EDIT_GetLineRect(EDITSTATE *es, INT line, INT scol, INT ecol, LPRECT rc)
Definition: edit.c:1145

Referenced by EDIT_InvalidateText().

◆ EDIT_MoveBackward()

static void EDIT_MoveBackward ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 1848 of file edit.c.

1850{
1851 INT e = es->selection_end;
1852
1853 if (e) {
1854 e--;
1855 if ((es->style & ES_MULTILINE) && e &&
1856 (es->text[e - 1] == '\r') && (es->text[e] == '\n')) {
1857 e--;
1858 if (e && (es->text[e - 1] == '\r'))
1859 e--;
1860 }
1861 }
1862 EDIT_EM_SetSel(es, extend ? es->selection_start : e, e, FALSE);

Referenced by EDIT_WM_Char(), EDIT_WM_KeyDown(), and EDIT_WM_Timer().

◆ EDIT_MoveDown_ML()

static void EDIT_MoveDown_ML ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 1875 of file edit.c.

1877{
1878 INT s = es->selection_start;
1879 INT e = es->selection_end;
1880 BOOL after_wrap = (es->flags & EF_AFTER_WRAP);
1881 LRESULT pos = EDIT_EM_PosFromChar(es, e, after_wrap);
1882 INT x = (short)LOWORD(pos);
1883 INT y = (short)HIWORD(pos);
1884
1885 e = EDIT_CharFromPos(es, x, y + es->line_height, &after_wrap);
1886 if (!extend)
1887 s = e;
1888 EDIT_EM_SetSel(es, s, e, after_wrap);
#define HIWORD(l)
Definition: typedefs.h:247

Referenced by EDIT_WM_Char(), and EDIT_WM_KeyDown().

◆ EDIT_MoveEnd()

static void EDIT_MoveEnd ( EDITSTATE es,
BOOL  extend,
BOOL  ctrl 
)
static

Definition at line 1897 of file edit.c.

1899{
1900 BOOL after_wrap = FALSE;
1901 INT e;
1902
1903 /* Pass a high value in x to make sure of receiving the end of the line */
1904 if (!ctrl && (es->style & ES_MULTILINE))
1905 e = EDIT_CharFromPos(es, 0x3fffffff,
1906 HIWORD(EDIT_EM_PosFromChar(es, es->selection_end, es->flags & EF_AFTER_WRAP)), &after_wrap);
1907 else
1908 e = get_text_length(es);
1909 EDIT_EM_SetSel(es, extend ? es->selection_start : e, e, after_wrap);
#define ctrl
Definition: input.c:1756

Referenced by EDIT_WM_KeyDown().

◆ EDIT_MoveForward()

static void EDIT_MoveForward ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 1918 of file edit.c.

1920{
1921 INT e = es->selection_end;
1922
1923 if (es->text[e]) {
1924 e++;
1925 if ((es->style & ES_MULTILINE) && (es->text[e - 1] == '\r')) {
1926 if (es->text[e] == '\n')
1927 e++;
1928 else if ((es->text[e] == '\r') && (es->text[e + 1] == '\n'))
1929 e += 2;
1930 }
1931 }
1932 EDIT_EM_SetSel(es, extend ? es->selection_start : e, e, FALSE);

Referenced by EDIT_WM_KeyDown(), and EDIT_WM_Timer().

◆ EDIT_MoveHome()

static void EDIT_MoveHome ( EDITSTATE es,
BOOL  extend,
BOOL  ctrl 
)
static

Definition at line 1943 of file edit.c.

1945{
1946 INT e;
1947
1948 /* Pass the x_offset in x to make sure of receiving the first position of the line */
1949 if (!ctrl && (es->style & ES_MULTILINE))
1950 e = EDIT_CharFromPos(es, -es->x_offset,
1951 HIWORD(EDIT_EM_PosFromChar(es, es->selection_end, es->flags & EF_AFTER_WRAP)), NULL);
1952 else
1953 e = 0;
1954 EDIT_EM_SetSel(es, extend ? es->selection_start : e, e, FALSE);

Referenced by EDIT_WM_Char(), and EDIT_WM_KeyDown().

◆ EDIT_MovePageDown_ML()

static void EDIT_MovePageDown_ML ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 1967 of file edit.c.

1969{
1970 INT s = es->selection_start;
1971 INT e = es->selection_end;
1972 BOOL after_wrap = (es->flags & EF_AFTER_WRAP);
1973 LRESULT pos = EDIT_EM_PosFromChar(es, e, after_wrap);
1974 INT x = (short)LOWORD(pos);
1975 INT y = (short)HIWORD(pos);
1976
1978 y + (es->format_rect.bottom - es->format_rect.top),
1979 &after_wrap);
1980 if (!extend)
1981 s = e;
1982 EDIT_EM_SetSel(es, s, e, after_wrap);

Referenced by EDIT_WM_KeyDown().

◆ EDIT_MovePageUp_ML()

static void EDIT_MovePageUp_ML ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 1995 of file edit.c.

1997{
1998 INT s = es->selection_start;
1999 INT e = es->selection_end;
2000 BOOL after_wrap = (es->flags & EF_AFTER_WRAP);
2001 LRESULT pos = EDIT_EM_PosFromChar(es, e, after_wrap);
2002 INT x = (short)LOWORD(pos);
2003 INT y = (short)HIWORD(pos);
2004
2006 y - (es->format_rect.bottom - es->format_rect.top),
2007 &after_wrap);
2008 if (!extend)
2009 s = e;
2010 EDIT_EM_SetSel(es, s, e, after_wrap);

Referenced by EDIT_WM_KeyDown().

◆ EDIT_MoveUp_ML()

static void EDIT_MoveUp_ML ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 2023 of file edit.c.

2025{
2026 INT s = es->selection_start;
2027 INT e = es->selection_end;
2028 BOOL after_wrap = (es->flags & EF_AFTER_WRAP);
2029 LRESULT pos = EDIT_EM_PosFromChar(es, e, after_wrap);
2030 INT x = (short)LOWORD(pos);
2031 INT y = (short)HIWORD(pos);
2032
2033 e = EDIT_CharFromPos(es, x, y - es->line_height, &after_wrap);
2034 if (!extend)
2035 s = e;
2036 EDIT_EM_SetSel(es, s, e, after_wrap);

Referenced by EDIT_WM_KeyDown().

◆ EDIT_MoveWordBackward()

static void EDIT_MoveWordBackward ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 2045 of file edit.c.

2047{
2048 INT s = es->selection_start;
2049 INT e = es->selection_end;
2050 INT l;
2051 INT ll;
2052 INT li;
2053
2057 if (e - li == 0) {
2058 if (l) {
2059 li = EDIT_EM_LineIndex(es, l - 1);
2060 e = li + EDIT_EM_LineLength(es, li);
2061 }
2062 } else {
2064 }
2065 if (!extend)
2066 s = e;
w ll
Definition: byte_order.h:167

Referenced by EDIT_WM_KeyDown().

◆ EDIT_MoveWordForward()

static void EDIT_MoveWordForward ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 2076 of file edit.c.

2078{
2079 INT s = es->selection_start;
2080 INT e = es->selection_end;
2081 INT l;
2082 INT ll;
2083 INT li;
2084
2088 if (e - li == ll) {
2089 if ((es->style & ES_MULTILINE) && (l != es->line_count - 1))
2090 e = EDIT_EM_LineIndex(es, l + 1);
2091 } else {
2093 li, e - li + 1, ll, WB_RIGHT);
2094 }
2095 if (!extend)
2096 s = e;
#define WB_RIGHT
Definition: winuser.h:551

Referenced by EDIT_WM_KeyDown().

◆ EDIT_NotifyCtlColor()

static HBRUSH EDIT_NotifyCtlColor ( EDITSTATE es,
HDC  hdc 
)
static

Definition at line 200 of file edit.c.

202{
203 HBRUSH hbrush;
204 UINT msg;
205
206 if ((!es->bEnableState || (es->style & ES_READONLY)))
208 else
210
211 /* Why do we notify to es->hwndParent, and we send this one to GetParent()? */
212 hbrush = (HBRUSH)SendMessageW(GetParent(es->hwndSelf), msg, (WPARAM)hdc, (LPARAM)es->hwndSelf);
213 if (!hbrush)
214 hbrush = (HBRUSH)DefWindowProcW(GetParent(es->hwndSelf), msg, (WPARAM)hdc, (LPARAM)es->hwndSelf);
215 return hbrush;
static HBRUSH hbrush
HDC hdc
Definition: main.c:9
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1771
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_CTLCOLOREDIT
Definition: winuser.h:1766

Referenced by EDIT_WM_Paint().

◆ EDIT_PaintLine()

static void EDIT_PaintLine ( EDITSTATE es,
HDC  dc,
INT  line,
BOOL  rev 
)
static

Definition at line 2180 of file edit.c.

2182{
2183 INT s = 0;
2184 INT e = 0;
2185 INT li = 0;
2186 INT ll = 0;
2187 INT x;
2188 INT y;
2189 LRESULT pos;
2191
2192 if (es->style & ES_MULTILINE) {
2194
2195 if ((line < es->y_offset) || (line > es->y_offset + vlc) || (line >= es->line_count))
2196 return;
2197 } else if (line)
2198 return;
2199
2200 TRACE("line=%d\n", line);
2201
2204 x = (short)LOWORD(pos);
2205 y = (short)HIWORD(pos);
2206
2207 if (es->style & ES_MULTILINE)
2208 {
2209 int line_idx = line;
2210 x = -es->x_offset;
2211 if (es->style & ES_RIGHT || es->style & ES_CENTER)
2212 {
2213 LINEDEF *line_def = es->first_line_def;
2214 int w, lw;
2215
2216 while (line_def && line_idx)
2217 {
2218 line_def = line_def->next;
2219 line_idx--;
2220 }
2221 w = es->format_rect.right - es->format_rect.left;
2222 lw = line_def->width;
2223
2224 if (es->style & ES_RIGHT)
2225 x = w - (lw - x);
2226 else if (es->style & ES_CENTER)
2227 x += (w - lw) / 2;
2228 }
2229 x += es->format_rect.left;
2230 }
2231
2232 if (rev)
2233 {
2236 s = min(es->selection_start, es->selection_end);
2237 e = max(es->selection_start, es->selection_end);
2238 s = min(li + ll, max(li, s));
2239 e = min(li + ll, max(li, e));
2240 }
2241
2242 if (ssa)
2243 ScriptStringOut(ssa, x, y, 0, &es->format_rect, s - li, e - li, FALSE);
2244 else if (rev && (s != e) &&
2245 ((es->flags & EF_FOCUSED) || (es->style & ES_NOHIDESEL))) {
2246 x += EDIT_PaintText(es, dc, x, y, line, 0, s - li, FALSE);
2247 x += EDIT_PaintText(es, dc, x, y, line, s - li, e - s, TRUE);
2248 x += EDIT_PaintText(es, dc, x, y, line, e - li, li + ll - e, FALSE);
2249 } else
2250 x += EDIT_PaintText(es, dc, x, y, line, 0, ll, FALSE);
int rev
Definition: sort.c:17
static INT EDIT_PaintText(EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col, INT count, BOOL rev)
Definition: edit.c:2106
HRESULT WINAPI ScriptStringOut(SCRIPT_STRING_ANALYSIS ssa, int iX, int iY, UINT uOptions, const RECT *prc, int iMinSel, int iMaxSel, BOOL fDisabled)
Definition: usp10.c:2366
#define ES_NOHIDESEL
Definition: pedump.c:673

Referenced by EDIT_WM_Paint().

◆ EDIT_PaintText()

static INT EDIT_PaintText ( EDITSTATE es,
HDC  dc,
INT  x,
INT  y,
INT  line,
INT  col,
INT  count,
BOOL  rev 
)
static

Definition at line 2106 of file edit.c.

2108{
2109 COLORREF BkColor;
2110 COLORREF TextColor;
2111 LOGFONTW underline_font;
2112 HFONT hUnderline = 0;
2113 HFONT old_font = 0;
2114 INT ret;
2115 INT li;
2116 INT BkMode;
2117 SIZE size;
2118
2119 if (!count)
2120 return 0;
2121 BkMode = GetBkMode(dc);
2122 BkColor = GetBkColor(dc);
2123 TextColor = GetTextColor(dc);
2124 if (rev) {
2125#ifdef __REACTOS__
2126 if (TRUE)
2127#else
2128 if (es->composition_len == 0)
2129#endif
2130 {
2133 SetBkMode( dc, OPAQUE);
2134 }
2135 else
2136 {
2138 GetObjectW(current,sizeof(LOGFONTW),&underline_font);
2139 underline_font.lfUnderline = TRUE;
2140 hUnderline = CreateFontIndirectW(&underline_font);
2141 old_font = SelectObject(dc,hUnderline);
2142 }
2143 }
2145 if (es->style & ES_MULTILINE) {
2146 ret = (INT)LOWORD(TabbedTextOutW(dc, x, y, es->text + li + col, count,
2147 es->tabs_count, es->tabs, es->format_rect.left - es->x_offset));
2148 } else {
2149 TextOutW(dc, x, y, es->text + li + col, count);
2150 GetTextExtentPoint32W(dc, es->text + li + col, count, &size);
2151 ret = size.cx;
2152 }
2153 if (rev) {
2154#ifdef __REACTOS__
2155 if (TRUE)
2156#else
2157 if (es->composition_len == 0)
2158#endif
2159 {
2160 SetBkColor(dc, BkColor);
2161 SetTextColor(dc, TextColor);
2162 SetBkMode( dc, BkMode);
2163 }
2164 else
2165 {
2166 if (old_font)
2167 SelectObject(dc,old_font);
2168 if (hUnderline)
2169 DeleteObject(hUnderline);
2170 }
2171 }
2172 return ret;
struct task_struct * current
Definition: linux.c:32
#define OBJ_FONT
Definition: objidl.idl:1414
#define INT
Definition: polytest.cpp:20
BYTE lfUnderline
Definition: dimm.idl:65
DWORD COLORREF
Definition: windef.h:300
int WINAPI GetBkMode(_In_ HDC)
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
COLORREF WINAPI GetTextColor(_In_ HDC)
Definition: text.c:861
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
Definition: dc.c:428
COLORREF WINAPI GetBkColor(_In_ HDC)
Definition: dc.c:978
#define OPAQUE
Definition: wingdi.h:949
BOOL WINAPI TextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(c) LPCWSTR lpString, _In_ int c)
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
DWORD WINAPI GetSysColor(_In_ int)
#define COLOR_HIGHLIGHT
Definition: winuser.h:925
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:926
LONG WINAPI TabbedTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(chCount) LPCWSTR lpString, _In_ int chCount, _In_ int nTabPositions, _In_reads_opt_(nTabPositions) CONST INT *lpnTabStopPositions, _In_ int nTabOrigin)

Referenced by EDIT_PaintLine().

◆ EDIT_Register()

void EDIT_Register ( void  )

Definition at line 5175 of file edit.c.

5177{
5178 WNDCLASSW wndClass;
5179
5180 memset(&wndClass, 0, sizeof(wndClass));
5182 wndClass.lpfnWndProc = EDIT_WindowProc;
5183 wndClass.cbClsExtra = 0;
5184#ifdef __i386__
5185 wndClass.cbWndExtra = sizeof(EDITSTATE *) + sizeof(WORD);
5186#else
5187 wndClass.cbWndExtra = sizeof(EDITSTATE *);
5188#endif
5189 wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_IBEAM);
5190 wndClass.hbrBackground = NULL;
5191 wndClass.lpszClassName = WC_EDITW;
5192 RegisterClassW(&wndClass);
static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:4621
#define WC_EDITW
Definition: commctrl.h:4687
#define memset(x, y, z)
Definition: compat.h:39
LPCWSTR lpszClassName
Definition: winuser.h:3184
HBRUSH hbrBackground
Definition: winuser.h:3182
int cbClsExtra
Definition: winuser.h:3177
UINT style
Definition: winuser.h:3175
WNDPROC lpfnWndProc
Definition: winuser.h:3176
int cbWndExtra
Definition: winuser.h:3178
HCURSOR hCursor
Definition: winuser.h:3181
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define CS_DBLCLKS
Definition: winuser.h:651
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2088
#define IDC_IBEAM
Definition: winuser.h:688
#define CS_GLOBALCLASS
Definition: winuser.h:652
#define CS_PARENTDC
Definition: winuser.h:656

Referenced by DllMain().

◆ EDIT_SetCaretPos()

static void EDIT_SetCaretPos ( EDITSTATE es,
INT  pos,
BOOL  after_wrap 
)
static

Definition at line 1748 of file edit.c.

1751{
1752 LRESULT res = EDIT_EM_PosFromChar(es, pos, after_wrap);
1753#ifdef __REACTOS__
1754 HKL hKL = GetKeyboardLayout(0);
1755 POINT pt = { (short)LOWORD(res), (short)HIWORD(res) };
1756
1757 /* Don't set caret if not focused */
1758 if ((es->flags & EF_FOCUSED) == 0)
1759 return;
1760
1761 SetCaretPos(pt.x, pt.y);
1762
1763 if (!ImmIsIME(hKL))
1764 return;
1765
1766 EDIT_ImmSetCompositionWindow(es, pt);
1767#else
1768 TRACE("%d - %dx%d\n", pos, (short)LOWORD(res), (short)HIWORD(res));
1769 SetCaretPos((short)LOWORD(res), (short)HIWORD(res));
1770#endif
BOOL WINAPI ImmIsIME(HKL hKL)
Definition: ime.c:880
GLuint res
Definition: glext.h:9613
UINT_PTR HKL
Definition: msctf.idl:143
HKL WINAPI GetKeyboardLayout(_In_ DWORD)
BOOL WINAPI SetCaretPos(_In_ int, _In_ int)

Referenced by EDIT_AdjustFormatRect(), EDIT_EM_ScrollCaret(), EDIT_ImeComposition(), EDIT_WM_MouseMove(), EDIT_WM_SetFocus(), and EDIT_WM_SetFont().

◆ EDIT_SetRectNP()

static void EDIT_SetRectNP ( EDITSTATE es,
const RECT rc 
)
static

Definition at line 2312 of file edit.c.

2314{
2316 INT bw, bh;
2318
2319 CopyRect(&es->format_rect, rc);
2320
2321 if (ExStyle & WS_EX_CLIENTEDGE) {
2322 es->format_rect.left++;
2323 es->format_rect.right--;
2324
2325 if (es->format_rect.bottom - es->format_rect.top
2326 >= es->line_height + 2)
2327 {
2328 es->format_rect.top++;
2329 es->format_rect.bottom--;
2330 }
2331 }
2332 else if (es->style & WS_BORDER) {
2334 bh = GetSystemMetrics(SM_CYBORDER) + 1;
2335 InflateRect(&es->format_rect, -bw, 0);
2336 if (es->format_rect.bottom - es->format_rect.top >= es->line_height + 2 * bh)
2337 InflateRect(&es->format_rect, 0, -bh);
2338 }
2339
2340 es->format_rect.left += es->left_margin;
2341 es->format_rect.right -= es->right_margin;
static int bw
Definition: maze.c:120
const DWORD ExStyle
Definition: appswitch.c:72
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WS_BORDER
Definition: pedump.c:625
BOOL WINAPI CopyRect(_Out_ LPRECT, _In_ LPCRECT)
#define GetWindowLongPtrW
Definition: winuser.h:4828
#define SM_CYBORDER
Definition: winuser.h:964
#define SM_CXBORDER
Definition: winuser.h:963
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
int WINAPI GetSystemMetrics(_In_ int)
#define GWL_EXSTYLE
Definition: winuser.h:850

Referenced by EDIT_WindowProc(), EDIT_WM_Create(), EDIT_WM_SetFont(), EDIT_WM_Size(), and EditWndProc_common().

◆ EDIT_SL_InvalidateText()

static void EDIT_SL_InvalidateText ( EDITSTATE es,
INT  start,
INT  end 
)
static

Definition at line 1374 of file edit.c.

1376{
1377 RECT line_rect;
1378 RECT rc;
1379
1380 EDIT_GetLineRect(es, 0, start, end, &line_rect);
1381 if (IntersectRect(&rc, &line_rect, &es->format_rect))
1382 EDIT_UpdateText(es, &rc, TRUE);

Referenced by EDIT_InvalidateText().

◆ EDIT_UnlockBuffer()

static void EDIT_UnlockBuffer ( EDITSTATE es,
BOOL  force 
)
static

Definition at line 1228 of file edit.c.

1230{
1231 /* Edit window might be already destroyed */
1232 if (!IsWindow(es->hwndSelf))
1233 {
1234 WARN("edit hwnd %p already destroyed\n", es->hwndSelf);
1235 return;
1236 }
1237
1238 if (!es->lock_count)
1239 {
1240 ERR("lock_count == 0 ... please report\n");
1241 return;
1242 }
1243
1244 if (!es->text)
1245 {
1246 ERR("es->text == 0 ... please report\n");
1247 return;
1248 }
1249
1250 if (force || (es->lock_count == 1))
1251 {
1252 if (es->hloc32W)
1253 {
1254 LocalUnlock(es->hloc32W);
1255 es->text = NULL;
1256 }
1257 else
1258 {
1259 ERR("no buffer ... please report\n");
1260 return;
1261 }
1262
1263 }
1264
1265 es->lock_count--;
BOOL NTAPI LocalUnlock(HLOCAL hMem)
Definition: heapmem.c:1805
BOOL WINAPI IsWindow(_In_opt_ HWND)

Referenced by EDIT_EM_GetHandle(), EDIT_EM_SetHandle(), and EDIT_MakeFit().

◆ EDIT_UpdateScrollInfo()

static void EDIT_UpdateScrollInfo ( EDITSTATE es)
static

Definition at line 1558 of file edit.c.

1560{
1561 if ((es->style & WS_VSCROLL) && !(es->flags & EF_VSCROLL_TRACK))
1562 {
1563 SCROLLINFO si;
1564 si.cbSize = sizeof(SCROLLINFO);
1566 si.nMin = 0;
1567 si.nMax = es->line_count - 1;
1568 si.nPage = (es->format_rect.bottom - es->format_rect.top) / es->line_height;
1569 si.nPos = es->y_offset;
1570 TRACE("SB_VERT, nMin=%d, nMax=%d, nPage=%d, nPos=%d\n",
1571 si.nMin, si.nMax, si.nPage, si.nPos);
1572 SetScrollInfo(es->hwndSelf, SB_VERT, &si, TRUE);
1573 }
1574
1575 if ((es->style & WS_HSCROLL) && !(es->flags & EF_HSCROLL_TRACK))
1576 {
1577 SCROLLINFO si;
1578 si.cbSize = sizeof(SCROLLINFO);
1580 si.nMin = 0;
1581 si.nMax = es->text_width - 1;
1582 si.nPage = es->format_rect.right - es->format_rect.left;
1583 si.nPos = es->x_offset;
1584 TRACE("SB_HORZ, nMin=%d, nMax=%d, nPage=%d, nPos=%d\n",
1585 si.nMin, si.nMax, si.nPage, si.nPos);
1586 SetScrollInfo(es->hwndSelf, SB_HORZ, &si, TRUE);
1587 }
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_HSCROLL
Definition: pedump.c:628
struct tagSCROLLINFO SCROLLINFO
#define SIF_RANGE
Definition: winuser.h:1234
#define SB_VERT
Definition: winuser.h:553
#define SIF_PAGE
Definition: winuser.h:1232
#define SIF_DISABLENOSCROLL
Definition: winuser.h:1235
#define SIF_POS
Definition: winuser.h:1233
int WINAPI SetScrollInfo(_In_ HWND, _In_ int, _In_ LPCSCROLLINFO, _In_ BOOL)
#define SB_HORZ
Definition: winuser.h:552

Referenced by EDIT_AdjustFormatRect(), EDIT_EM_LineScroll_internal(), EDIT_EM_ReplaceSel(), EDIT_EM_SetHandle(), EDIT_WM_Create(), EDIT_WM_HScroll(), EDIT_WM_SetText(), and EDIT_WM_VScroll().

◆ EDIT_UpdateText()

static void EDIT_UpdateText ( EDITSTATE es,
const RECT rc,
BOOL  bErase 
)
static

Definition at line 1357 of file edit.c.

1359{
1360 if (es->flags & EF_UPDATE) {
1361 es->flags &= ~EF_UPDATE;
1362 if (!notify_parent(es, EN_UPDATE)) return;
1363 }
1364 InvalidateRect(es->hwndSelf, rc, bErase);
#define EN_UPDATE
Definition: winuser.h:2027
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)

Referenced by EDIT_EM_ReplaceSel(), EDIT_EM_ScrollCaret(), EDIT_EM_SetHandle(), EDIT_EM_SetMargins(), EDIT_EM_SetPasswordChar(), EDIT_EM_SetWordBreakProc(), EDIT_ML_InvalidateText(), EDIT_SL_InvalidateText(), EDIT_WindowProc(), EDIT_WM_SetFont(), EDIT_WM_Size(), and EditWndProc_common().

◆ EDIT_UpdateTextRegion()

static void EDIT_UpdateTextRegion ( EDITSTATE es,
HRGN  hrgn,
BOOL  bErase 
)
static

Definition at line 1342 of file edit.c.

1344{
1345 if (es->flags & EF_UPDATE) {
1346 es->flags &= ~EF_UPDATE;
1347 if (!notify_parent(es, EN_UPDATE)) return;
1348 }
1349 InvalidateRgn(es->hwndSelf, hrgn, bErase);
BOOL WINAPI InvalidateRgn(_In_ HWND, _In_opt_ HRGN, _In_ BOOL)

Referenced by EDIT_EM_ReplaceSel().

◆ EDIT_UpdateUniscribeData()

static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData ( EDITSTATE es,
HDC  dc,
INT  line 
)
static

Definition at line 374 of file edit.c.

376{
377 LINEDEF *line_def;
378
379 if (!(es->style & ES_MULTILINE))
380 {
381 if (!es->ssa)
382 {
384 HFONT old_font = NULL;
385 HDC udc = dc;
386
387 if (!udc)
388 udc = GetDC(es->hwndSelf);
389 if (es->font)
390 old_font = SelectObject(udc, es->font);
391
392 if (es->style & ES_PASSWORD)
393 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);
394 else
395 ScriptStringAnalyse(udc, es->text, length, (1.5*length+16), -1, SSA_LINK|SSA_FALLBACK|SSA_GLYPHS, -1, NULL, NULL, NULL, NULL, NULL, &es->ssa);
396
397 if (es->font)
398 SelectObject(udc, old_font);
399 if (udc != dc)
400 ReleaseDC(es->hwndSelf, udc);
401 }
402 return es->ssa;
403 }
404 else
405 {
406 line_def = es->first_line_def;
407 while (line_def && line)
408 {
409 line_def = line_def->next;
410 line--;
411 }
412
413 return EDIT_UpdateUniscribeData_linedef(es,dc,line_def);
414 }
HRESULT WINAPI ScriptStringAnalyse(HDC hdc, const void *pString, int cString, int cGlyphs, int iCharset, DWORD dwFlags, int iReqWidth, SCRIPT_CONTROL *psControl, SCRIPT_STATE *psState, const int *piDx, SCRIPT_TABDEF *pTabdef, const BYTE *pbInClass, SCRIPT_STRING_ANALYSIS *pssa)
Definition: usp10.c:1985
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define SSA_FALLBACK
Definition: usp10.h:38
#define SSA_LINK
Definition: usp10.h:45
#define SSA_PASSWORD
Definition: usp10.h:33
#define SSA_GLYPHS
Definition: usp10.h:40

Referenced by EDIT_CalcLineWidth_SL(), EDIT_CharFromPos(), EDIT_EM_PosFromChar(), EDIT_PaintLine(), and EDIT_WM_Paint().

◆ EDIT_UpdateUniscribeData_linedef()

static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData_linedef ( EDITSTATE es,
HDC  dc,
LINEDEF line_def 
)
static

Definition at line 332 of file edit.c.

334{
335 if (!line_def)
336 return NULL;
337
338 if (line_def->net_length && !line_def->ssa)
339 {
340 int index = line_def->index;
341 HFONT old_font = NULL;
342 HDC udc = dc;
343 SCRIPT_TABDEF tabdef;
344 HRESULT hr;
345
346 if (!udc)
347 udc = GetDC(es->hwndSelf);
348 if (es->font)
349 old_font = SelectObject(udc, es->font);
350
351 tabdef.cTabStops = es->tabs_count;
352 tabdef.iScale = GdiGetCharDimensions(udc, NULL, NULL);
353 tabdef.pTabStops = es->tabs;
354 tabdef.iTabOrigin = 0;
355
356 hr = ScriptStringAnalyse(udc, &es->text[index], line_def->net_length,
357 (1.5*line_def->net_length+16), -1,
359 NULL, NULL, NULL, &tabdef, NULL, &line_def->ssa);
360 if (FAILED(hr))
361 {
362 WARN("ScriptStringAnalyse failed (%x)\n",hr);
363 line_def->ssa = NULL;
364 }
365
366 if (es->font)
367 SelectObject(udc, old_font);
368 if (udc != dc)
369 ReleaseDC(es->hwndSelf, udc);
370 }
371
372 return line_def->ssa;
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hr
Definition: shlfolder.c:183
int * pTabStops
Definition: usp10.h:173
#define SSA_TAB
Definition: usp10.h:34

Referenced by EDIT_BuildLineDefs_ML(), and EDIT_UpdateUniscribeData().

◆ EDIT_WindowProc()

static LRESULT CALLBACK EDIT_WindowProc ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 4621 of file edit.c.

4623{
4625 HTHEME theme = GetWindowTheme(hwnd);
4626 LRESULT result = 0;
4627 RECT *rect;
4628
4629 TRACE("hwnd=%p msg=%#x wparam=%lx lparam=%lx\n", hwnd, msg, wParam, lParam);
4630
4631 if (!es && msg != WM_NCCREATE)
4632 return DefWindowProcW(hwnd, msg, wParam, lParam);
4633
4634 if (es && (msg != WM_NCDESTROY))
4636
4637 switch (msg)
4638 {
4639 case EM_GETSEL:
4641 break;
4642
4643 case EM_SETSEL:
4646 result = 1;
4647 break;
4648
4649 case EM_GETRECT:
4650 rect = (RECT *)lParam;
4651 if (rect)
4652 *rect = es->format_rect;
4653 break;
4654
4655 case EM_SETRECT:
4656 if ((es->style & ES_MULTILINE) && lParam)
4657 {
4660 }
4661 break;
4662
4663 case EM_SETRECTNP:
4664 if ((es->style & ES_MULTILINE) && lParam)
4666 break;
4667
4668 case EM_SCROLL:
4670 break;
4671
4672 case EM_LINESCROLL:
4674 break;
4675
4676 case EM_SCROLLCARET:
4678 result = 1;
4679 break;
4680
4681 case EM_GETMODIFY:
4682 result = ((es->flags & EF_MODIFIED) != 0);
4683 break;
4684
4685 case EM_SETMODIFY:
4686 if (wParam)
4687 es->flags |= EF_MODIFIED;
4688 else
4689 es->flags &= ~(EF_MODIFIED | EF_UPDATE); /* reset pending updates */
4690 break;
4691
4692 case EM_GETLINECOUNT:
4693 result = (es->style & ES_MULTILINE) ? es->line_count : 1;
4694 break;
4695
4696 case EM_LINEINDEX:
4698 break;
4699
4700 case EM_SETHANDLE:
4702 break;
4703
4704 case EM_GETHANDLE:
4706 break;
4707
4708 case EM_GETTHUMB:
4710 break;
4711
4712 /* these messages missing from specs */
4713 case 0x00bf:
4714 case 0x00c0:
4715 case 0x00c3:
4716 case 0x00ca:
4717 FIXME("undocumented message 0x%x, please report\n", msg);
4719 break;
4720
4721 case EM_LINELENGTH:
4723 break;
4724
4725 case EM_REPLACESEL:
4726 {
4727 const WCHAR *textW = (const WCHAR *)lParam;
4728
4730 result = 1;
4731 break;
4732 }
4733
4734 case EM_GETLINE:
4736 break;
4737
4738 case EM_SETLIMITTEXT:
4740 break;
4741
4742 case EM_CANUNDO:
4744 break;
4745
4746 case EM_UNDO:
4747 case WM_UNDO:
4749 break;
4750
4751 case EM_FMTLINES:
4753 break;
4754
4755 case EM_LINEFROMCHAR:
4757 break;
4758
4759 case EM_SETTABSTOPS:
4761 break;
4762
4763 case EM_SETPASSWORDCHAR:
4765 break;
4766
4767 case EM_EMPTYUNDOBUFFER:
4769 break;
4770
4772 result = (es->style & ES_MULTILINE) ? es->y_offset : es->x_offset;
4773 break;
4774
4775 case EM_SETREADONLY:
4776 {
4777 DWORD old_style = es->style;
4778
4779 if (wParam)
4780 {
4782 es->style |= ES_READONLY;
4783 }
4784 else
4785 {
4787 es->style &= ~ES_READONLY;
4788 }
4789
4790 if (old_style ^ es->style)
4791 InvalidateRect(es->hwndSelf, NULL, TRUE);
4792
4793 result = 1;
4794 break;
4795 }
4796
4799 result = 1;
4800 break;
4801
4803 result = (LRESULT)es->word_break_proc;
4804 break;
4805
4806 case EM_GETPASSWORDCHAR:
4807 result = es->password_char;
4808 break;
4809
4810 case EM_SETMARGINS:
4812 break;
4813
4814 case EM_GETMARGINS:
4815 result = MAKELONG(es->left_margin, es->right_margin);
4816 break;
4817
4818 case EM_GETLIMITTEXT:
4819 result = es->buffer_limit;
4820 break;
4821
4822 case EM_POSFROMCHAR:
4823 if ((INT)wParam >= get_text_length(es)) result = -1;
4825 break;
4826
4827 case EM_CHARFROMPOS:
4828 result = EDIT_EM_CharFromPos(es, (short)LOWORD(lParam), (short)HIWORD(lParam));
4829 break;
4830
4831 /* End of the EM_ messages which were in numerical order; what order
4832 * are these in? vaguely alphabetical?
4833 */
4834
4835 case WM_NCCREATE:
4837 break;
4838
4839 case WM_NCDESTROY:
4841 es = NULL;
4842 break;
4843
4844 case WM_GETDLGCODE:
4846
4847 if (es->style & ES_MULTILINE)
4849
4850 if (lParam)
4851 {
4852 MSG *msg = (MSG *)lParam;
4853 es->flags |= EF_DIALOGMODE;
4854
4855 if (msg->message == WM_KEYDOWN)
4856 {
4857 int vk = (int)msg->wParam;
4858
4859 if (es->hwndListBox)
4860 {
4861 if (vk == VK_RETURN || vk == VK_ESCAPE)
4864 }
4865 }
4866 }
4867 break;
4868
4869 case WM_IME_CHAR:
4870#ifdef __REACTOS__
4872 break;
4873#endif
4874 case WM_CHAR:
4875 {
4876 WCHAR charW = wParam;
4877
4878 if (es->hwndListBox)
4879 {
4880 if (charW == VK_RETURN || charW == VK_ESCAPE)
4881 {
4884 break;
4885 }
4886 }