ReactOS  0.4.14-dev-41-g31d7680
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)
 
#define EDIT_NOTIFY_PARENT(es, wNotifyCode)
 

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 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 58 of file edit.c.

◆ EDIT_NOTIFY_PARENT

#define EDIT_NOTIFY_PARENT (   es,
  wNotifyCode 
)
Value:
do \
{ /* Notify parent which has created this edit control */ \
TRACE("notification " #wNotifyCode " sent to hwnd=%p\n", es->hwndParent); \
SendMessageW(es->hwndParent, WM_COMMAND, \
MAKEWPARAM(GetWindowLongPtrW((es->hwndSelf),GWLP_ID), wNotifyCode), \
(LPARAM)(es->hwndSelf)); \
} while(0)
#define MAKEWPARAM(l, h)
Definition: winuser.h:3948
#define GetWindowLongPtrW
Definition: winuser.h:4730
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_COMMAND
Definition: winuser.h:1722
#define es
Definition: i386-dis.c:431
#define GWLP_ID
Definition: winuser.h:854

Definition at line 161 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 71 of file edit.c.

◆ EF_DIALOGMODE

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

Definition at line 74 of file edit.c.

◆ EF_FOCUSED

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

Definition at line 67 of file edit.c.

◆ EF_HSCROLL_TRACK

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

Definition at line 70 of file edit.c.

◆ EF_MODIFIED

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

Definition at line 66 of file edit.c.

◆ EF_UPDATE

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

Definition at line 68 of file edit.c.

◆ EF_USE_SOFTBRK

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

Definition at line 73 of file edit.c.

◆ EF_VSCROLL_TRACK

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

Definition at line 69 of file edit.c.

◆ GROWLENGTH

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

Definition at line 59 of file edit.c.

◆ HSCROLL_FRACTION

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

Definition at line 61 of file edit.c.

◆ ID_CB_LISTBOX

#define ID_CB_LISTBOX   1000

Definition at line 76 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 158 of file edit.c.

◆ ROUND_TO_GROW

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

Definition at line 60 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 157 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 78 of file edit.c.

79 {
80  END_0 = 0, /* line ends with terminating '\0' character */
81  END_WRAP, /* line is wrapped */
82  END_HARD, /* line ends with a hard return '\r\n' */
83  END_SOFT, /* line ends with a soft return '\r\r\n' */
84  END_RICH /* line ends with a single '\n' */
85 } LINE_END;
LINE_END
Definition: edit.c:78
Definition: edit.c:83
Definition: edit.c:80
Definition: edit.c:81
Definition: edit.c:82
Definition: edit.c:84

Function Documentation

◆ EDIT_AdjustFormatRect()

static void EDIT_AdjustFormatRect ( EDITSTATE es)
static

Definition at line 2204 of file edit.c.

2205 {
2206  RECT ClientRect;
2207 
2208  es->format_rect.right = max(es->format_rect.right, es->format_rect.left + es->char_width);
2209  if (es->style & ES_MULTILINE)
2210  {
2211  INT fw, vlc, max_x_offset, max_y_offset;
2212 
2213  vlc = get_vertical_line_count(es);
2214  es->format_rect.bottom = es->format_rect.top + vlc * es->line_height;
2215 
2216  /* correct es->x_offset */
2217  fw = es->format_rect.right - es->format_rect.left;
2218  max_x_offset = es->text_width - fw;
2219  if(max_x_offset < 0) max_x_offset = 0;
2220  if(es->x_offset > max_x_offset)
2221  es->x_offset = max_x_offset;
2222 
2223  /* correct es->y_offset */
2224  max_y_offset = es->line_count - vlc;
2225  if(max_y_offset < 0) max_y_offset = 0;
2226  if(es->y_offset > max_y_offset)
2227  es->y_offset = max_y_offset;
2228 
2229  /* force scroll info update */
2231  }
2232  else
2233  /* Windows doesn't care to fix text placement for SL controls */
2234  es->format_rect.bottom = es->format_rect.top + es->line_height;
2235 
2236  /* Always stay within the client area */
2237  GetClientRect(es->hwndSelf, &ClientRect);
2238  es->format_rect.bottom = min(es->format_rect.bottom, ClientRect.bottom);
2239 
2240  if ((es->style & ES_MULTILINE) && !(es->style & ES_AUTOHSCROLL))
2242 
2243  EDIT_SetCaretPos(es, es->selection_end, es->flags & EF_AFTER_WRAP);
2244 }
#define max(a, b)
Definition: svc.c:63
static void EDIT_UpdateScrollInfo(EDITSTATE *es)
Definition: edit.c:1552
static INT get_vertical_line_count(EDITSTATE *es)
Definition: edit.c:410
#define ES_MULTILINE
Definition: pedump.c:667
static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta, HRGN hrgn)
Definition: edit.c:425
static UINT get_text_length(EDITSTATE *es)
Definition: edit.c:212
static void EDIT_SetCaretPos(EDITSTATE *es, INT pos, BOOL after_wrap)
Definition: edit.c:1715
int32_t INT
Definition: typedefs.h:56
#define EF_AFTER_WRAP
Definition: edit.c:71
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define min(a, b)
Definition: monoChain.cc:55
LONG bottom
Definition: windef.h:294
#define es
Definition: i386-dis.c:431
#define ES_AUTOHSCROLL
Definition: pedump.c:672

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 425 of file edit.c.

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

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 757 of file edit.c.

758 {
760  if (es->ssa)
761  {
762  const SIZE *size;
763  size = ScriptString_pSize(es->ssa);
764  es->text_width = size->cx;
765  }
766  else
767  es->text_width = 0;
768 }
static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData(EDITSTATE *es, HDC dc, INT line)
Definition: edit.c:368
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
const SIZE *WINAPI ScriptString_pSize(SCRIPT_STRING_ANALYSIS ssa)
Definition: usp10.c:3871
#define es
Definition: i386-dis.c:431

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 290 of file edit.c.

291 {
292  INT ret;
293 
294  if (es->word_break_proc)
295  ret = es->word_break_proc(es->text + start, index, count, action);
296  else
298 
299  return ret;
300 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
int32_t INT
Definition: typedefs.h:56
GLuint index
Definition: glext.h:6031
int ret
const WCHAR * action
Definition: action.c:7783
static INT EDIT_WordBreakProc(EDITSTATE *es, LPWSTR s, INT index, INT count, INT action)
Definition: edit.c:232
GLuint start
Definition: gl.h:1545
#define es
Definition: i386-dis.c:431

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 780 of file edit.c.

781 {
782  INT index;
783 
784  if (es->style & ES_MULTILINE) {
785  int trailing;
786  INT line = (y - es->format_rect.top) / es->line_height + es->y_offset;
787  INT line_index = 0;
788  LINEDEF *line_def = es->first_line_def;
790  while ((line > 0) && line_def->next) {
791  line_index += line_def->length;
792  line_def = line_def->next;
793  line--;
794  }
795 
796  x += es->x_offset - es->format_rect.left;
797  if (es->style & ES_RIGHT)
798  x -= (es->format_rect.right - es->format_rect.left) - line_def->width;
799  else if (es->style & ES_CENTER)
800  x -= ((es->format_rect.right - es->format_rect.left) - line_def->width) / 2;
801  if (x >= line_def->width) {
802  if (after_wrap)
803  *after_wrap = (line_def->ending == END_WRAP);
804  return line_index + line_def->net_length;
805  }
806  if (x <= 0 || !line_def->ssa) {
807  if (after_wrap)
808  *after_wrap = FALSE;
809  return line_index;
810  }
811 
812  ScriptStringXtoCP(line_def->ssa, x , &index, &trailing);
813  if (trailing) index++;
814  index += line_index;
815  if (after_wrap)
816  *after_wrap = ((index == line_index + line_def->net_length) &&
817  (line_def->ending == END_WRAP));
818  } else {
819  INT xoff = 0;
820  INT trailing;
821  if (after_wrap)
822  *after_wrap = FALSE;
823  x -= es->format_rect.left;
824  if (!x)
825  return es->x_offset;
826 
827  if (!es->x_offset)
828  {
829  INT indent = (es->format_rect.right - es->format_rect.left) - es->text_width;
830  if (es->style & ES_RIGHT)
831  x -= indent;
832  else if (es->style & ES_CENTER)
833  x -= indent / 2;
834  }
835 
837  if (es->x_offset)
838  {
839  if (es->ssa)
840  {
841  if (es->x_offset>= get_text_length(es))
842  {
843  const SIZE *size;
844  size = ScriptString_pSize(es->ssa);
845  xoff = size->cx;
846  }
847  ScriptStringCPtoX(es->ssa, es->x_offset, FALSE, &xoff);
848  }
849  else
850  xoff = 0;
851  }
852  if (x < 0)
853  {
854  if (x + xoff > 0 || !es->ssa)
855  {
856  ScriptStringXtoCP(es->ssa, x+xoff, &index, &trailing);
857  if (trailing) index++;
858  }
859  else
860  index = 0;
861  }
862  else
863  {
864  if (x)
865  {
866  const SIZE *size = NULL;
867  if (es->ssa)
868  size = ScriptString_pSize(es->ssa);
869  if (!size)
870  index = 0;
871  else if (x > size->cx)
873  else if (es->ssa)
874  {
875  ScriptStringXtoCP(es->ssa, x+xoff, &index, &trailing);
876  if (trailing) index++;
877  }
878  else
879  index = 0;
880  }
881  else
882  index = es->x_offset;
883  }
884  }
885  return index;
886 }
static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData(EDITSTATE *es, HDC dc, INT line)
Definition: edit.c:368
#define ES_CENTER
Definition: pedump.c:665
static const WCHAR indent[]
Definition: object.c:1156
#define ES_MULTILINE
Definition: pedump.c:667
HRESULT WINAPI ScriptStringXtoCP(SCRIPT_STRING_ANALYSIS ssa, int iX, int *piCh, int *piTrailing)
Definition: usp10.c:2472
Definition: edit.c:81
static UINT get_text_length(EDITSTATE *es)
Definition: edit.c:212
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int32_t INT
Definition: typedefs.h:56
#define ES_RIGHT
Definition: pedump.c:666
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
GLuint index
Definition: glext.h:6031
GLsizeiptr size
Definition: glext.h:5919
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define index(s, c)
Definition: various.h:29
const SIZE *WINAPI ScriptString_pSize(SCRIPT_STRING_ANALYSIS ssa)
Definition: usp10.c:3871
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
HRESULT WINAPI ScriptStringCPtoX(SCRIPT_STRING_ANALYSIS ssa, int icp, BOOL fTrailing, int *pX)
Definition: usp10.c:2409
#define es
Definition: i386-dis.c:431

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 3193 of file edit.c.

3194 {
3195  HWND hLBox = es->hwndListBox;
3196  HWND hCombo;
3197  BOOL bDropped;
3198  int nEUI;
3199 
3200  if (!hLBox)
3201  return FALSE;
3202 
3203  hCombo = GetParent(es->hwndSelf);
3204  bDropped = TRUE;
3205  nEUI = 0;
3206 
3207  TRACE("[%p]: handling msg %x (%x)\n", es->hwndSelf, msg, key);
3208 
3209  if (key == VK_UP || key == VK_DOWN)
3210  {
3211  if (SendMessageW(hCombo, CB_GETEXTENDEDUI, 0, 0))
3212  nEUI = 1;
3213 
3214  if (msg == WM_KEYDOWN || nEUI)
3215  bDropped = (BOOL)SendMessageW(hCombo, CB_GETDROPPEDSTATE, 0, 0);
3216  }
3217 
3218  switch (msg)
3219  {
3220  case WM_KEYDOWN:
3221  if (!bDropped && nEUI && (key == VK_UP || key == VK_DOWN))
3222  {
3223  /* make sure ComboLBox pops up */
3224  SendMessageW(hCombo, CB_SETEXTENDEDUI, FALSE, 0);
3225  key = VK_F4;
3226  nEUI = 2;
3227  }
3228 
3229  SendMessageW(hLBox, WM_KEYDOWN, key, 0);
3230  break;
3231 
3232  case WM_SYSKEYDOWN: /* Handle Alt+up/down arrows */
3233  if (nEUI)
3234  SendMessageW(hCombo, CB_SHOWDROPDOWN, !bDropped, 0);
3235  else
3236  SendMessageW(hLBox, WM_KEYDOWN, VK_F4, 0);
3237  break;
3238  }
3239 
3240  if (nEUI == 2)
3241  SendMessageW(hCombo, CB_SETEXTENDEDUI, TRUE, 0);
3242 
3243  return TRUE;
3244 }
#define TRUE
Definition: types.h:120
#define CB_GETDROPPEDSTATE
Definition: winuser.h:1927
#define VK_DOWN
Definition: winuser.h:2202
#define BOOL
Definition: nt_native.h:43
#define VK_UP
Definition: winuser.h:2200
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CB_SHOWDROPDOWN
Definition: winuser.h:1952
#define VK_F4
Definition: winuser.h:2233
#define WM_KEYDOWN
Definition: winuser.h:1697
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI GetParent(_In_ HWND)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_SETEXTENDEDUI
Definition: winuser.h:1946
#define msg(x)
Definition: auth_time.c:54
#define WM_SYSKEYDOWN
Definition: winuser.h:1701
#define CB_GETEXTENDEDUI
Definition: winuser.h:1930
#define es
Definition: i386-dis.c:431
Definition: path.c:42

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 897 of file edit.c.

898 {
899  *x = min(max(*x, es->format_rect.left), es->format_rect.right - 1);
900  *y = min(max(*y, es->format_rect.top), es->format_rect.bottom - 1);
901 }
#define max(a, b)
Definition: svc.c:63
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define min(a, b)
Definition: monoChain.cc:55
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define es
Definition: i386-dis.c:431

Referenced by EDIT_WM_LButtonDown(), and EDIT_WM_MouseMove().

◆ EDIT_ContextMenuCommand()

static void EDIT_ContextMenuCommand ( EDITSTATE es,
UINT  id 
)
static

Definition at line 3079 of file edit.c.

3080 {
3081  switch (id) {
3082  case EM_UNDO:
3083  SendMessageW(es->hwndSelf, WM_UNDO, 0, 0);
3084  break;
3085  case WM_CUT:
3086  SendMessageW(es->hwndSelf, WM_CUT, 0, 0);
3087  break;
3088  case WM_COPY:
3089  SendMessageW(es->hwndSelf, WM_COPY, 0, 0);
3090  break;
3091  case WM_PASTE:
3092  SendMessageW(es->hwndSelf, WM_PASTE, 0, 0);
3093  break;
3094  case WM_CLEAR:
3095  SendMessageW(es->hwndSelf, WM_CLEAR, 0, 0);
3096  break;
3097  case EM_SETSEL:
3098  SendMessageW(es->hwndSelf, EM_SETSEL, 0, -1);
3099  break;
3100  default:
3101  ERR("unknown menu item, please report\n");
3102  break;
3103  }
3104 }
#define WM_CUT
Definition: winuser.h:1843
#define WM_PASTE
Definition: winuser.h:1845
#define WM_CLEAR
Definition: winuser.h:1846
#define WM_COPY
Definition: winuser.h:1844
#define EM_SETSEL
Definition: winuser.h:2000
#define EM_UNDO
Definition: winuser.h:2003
#define ERR(fmt,...)
Definition: debug.h:109
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_UNDO
Definition: winuser.h:1847
#define es
Definition: i386-dis.c:431

Referenced by EDIT_WM_ContextMenu().

◆ EDIT_EM_CanUndo()

static BOOL EDIT_EM_CanUndo ( const EDITSTATE es)
inlinestatic

Definition at line 177 of file edit.c.

178 {
179  return (es->undo_insert_count || strlenW(es->undo_text));
180 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define es
Definition: i386-dis.c:431

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

◆ EDIT_EM_CharFromPos()

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

Definition at line 2299 of file edit.c.

2300 {
2301  POINT pt;
2302  RECT rc;
2303  INT index;
2304 
2305  pt.x = x;
2306  pt.y = y;
2307  GetClientRect(es->hwndSelf, &rc);
2308  if (!PtInRect(&rc, pt))
2309  return -1;
2310 
2311  index = EDIT_CharFromPos(es, x, y, NULL);
2313 }
static INT EDIT_EM_LineFromChar(EDITSTATE *es, INT index)
Definition: edit.c:909
#define pt(x, y)
Definition: drawing.c:79
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int32_t INT
Definition: typedefs.h:56
#define MAKELONG(a, b)
Definition: typedefs.h:248
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define index(s, c)
Definition: various.h:29
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static INT EDIT_CharFromPos(EDITSTATE *es, INT x, INT y, LPBOOL after_wrap)
Definition: edit.c:780
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
#define es
Definition: i386-dis.c:431

Referenced by EDIT_WindowProc().

◆ EDIT_EM_EmptyUndoBuffer()

static void EDIT_EM_EmptyUndoBuffer ( EDITSTATE es)
inlinestatic

Definition at line 188 of file edit.c.

189 {
190  es->undo_insert_count = 0;
191  *es->undo_text = '\0';
192 }
#define es
Definition: i386-dis.c:431

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

◆ EDIT_EM_FmtLines()

static BOOL EDIT_EM_FmtLines ( EDITSTATE es,
BOOL  add_eol 
)
static

Definition at line 2327 of file edit.c.

2328 {
2329  es->flags &= ~EF_USE_SOFTBRK;
2330  if (add_eol) {
2331  es->flags |= EF_USE_SOFTBRK;
2332  FIXME("soft break enabled, not implemented\n");
2333  }
2334  return add_eol;
2335 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define EF_USE_SOFTBRK
Definition: edit.c:73
#define es
Definition: i386-dis.c:431

Referenced by EDIT_WindowProc().

◆ EDIT_EM_GetHandle()

static HLOCAL EDIT_EM_GetHandle ( EDITSTATE es)
static

Definition at line 2349 of file edit.c.

2350 {
2351  if (!(es->style & ES_MULTILINE))
2352  return 0;
2353 
2355 
2356  /* The text buffer handle belongs to the app */
2357  es->hlocapp = es->hloc32W;
2358 
2359  TRACE("Returning %p, LocalSize() = %ld\n", es->hlocapp, LocalSize(es->hlocapp));
2360  return es->hlocapp;
2361 }
#define TRUE
Definition: types.h:120
#define ES_MULTILINE
Definition: pedump.c:667
SIZE_T NTAPI LocalSize(HLOCAL hMem)
Definition: heapmem.c:1777
static void EDIT_UnlockBuffer(EDITSTATE *es, BOOL force)
Definition: edit.c:1222
#define TRACE(s)
Definition: solgame.cpp:4
#define es
Definition: i386-dis.c:431

Referenced by EDIT_WindowProc().

◆ EDIT_EM_GetLine()

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

Definition at line 2369 of file edit.c.

2370 {
2371  INT line_len, dst_len;
2372  LPWSTR src;
2373  INT i;
2374 
2375  if (es->style & ES_MULTILINE)
2376  {
2377  if (line >= es->line_count)
2378  return 0;
2379  }
2380  else
2381  line = 0;
2382 
2383  i = EDIT_EM_LineIndex(es, line);
2384  src = es->text + i;
2385  line_len = EDIT_EM_LineLength(es, i);
2386  dst_len = *(WORD *)dst;
2387 
2388  if (dst_len <= line_len)
2389  {
2390  memcpy(dst, src, dst_len * sizeof(WCHAR));
2391  return dst_len;
2392  }
2393  else /* Append 0 if enough space */
2394  {
2395  memcpy(dst, src, line_len * sizeof(WCHAR));
2396  dst[line_len] = 0;
2397  return line_len;
2398  }
2399 }
#define ES_MULTILINE
Definition: pedump.c:667
int32_t INT
Definition: typedefs.h:56
static INT EDIT_EM_LineIndex(const EDITSTATE *es, INT line)
Definition: edit.c:938
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
static INT EDIT_EM_LineLength(EDITSTATE *es, INT index)
Definition: edit.c:973
Definition: parser.c:48
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned short WORD
Definition: ntddk_ex.h:93
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define es
Definition: i386-dis.c:431

Referenced by EDIT_WindowProc().

◆ EDIT_EM_GetSel()

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

Definition at line 2407 of file edit.c.

2408 {
2409  UINT s = es->selection_start;
2410  UINT e = es->selection_end;
2411 
2412  ORDER_UINT(s, e);
2413  if (start)
2414  *start = s;
2415  if (end)
2416  *end = e;
2417  return MAKELONG(s, e);
2418 }
GLuint GLuint end
Definition: gl.h:1545
#define ORDER_UINT(x, y)
Definition: edit.c:158
#define e
Definition: ke_i.h:82
#define MAKELONG(a, b)
Definition: typedefs.h:248
GLdouble s
Definition: gl.h:2039
GLuint start
Definition: gl.h:1545
unsigned int UINT
Definition: ndis.h:50
#define es
Definition: i386-dis.c:431

Referenced by EDIT_WindowProc().

◆ EDIT_EM_GetThumb()

static LRESULT EDIT_EM_GetThumb ( EDITSTATE es)
static

Definition at line 4173 of file edit.c.

4174 {
4175  return MAKELONG(EDIT_WM_VScroll(es, EM_GETTHUMB, 0),
4177 }
#define MAKELONG(a, b)
Definition: typedefs.h:248
static LRESULT EDIT_WM_HScroll(EDITSTATE *es, INT action, INT pos)
Definition: edit.c:3921
static LRESULT EDIT_WM_VScroll(EDITSTATE *es, INT action, INT pos)
Definition: edit.c:4053
#define es
Definition: i386-dis.c:431
#define EM_GETTHUMB
Definition: winuser.h:1980

Referenced by EDIT_WindowProc().

◆ EDIT_EM_LineFromChar()

static INT EDIT_EM_LineFromChar ( EDITSTATE es,
INT  index 
)
static

Definition at line 909 of file edit.c.

910 {
911  INT line;
912  LINEDEF *line_def;
913 
914  if (!(es->style & ES_MULTILINE))
915  return 0;
916  if (index > (INT)get_text_length(es))
917  return es->line_count - 1;
918  if (index == -1)
919  index = min(es->selection_start, es->selection_end);
920 
921  line = 0;
922  line_def = es->first_line_def;
923  index -= line_def->length;
924  while ((index >= 0) && line_def->next) {
925  line++;
926  line_def = line_def->next;
927  index -= line_def->length;
928  }
929  return line;
930 }
#define ES_MULTILINE
Definition: pedump.c:667
static UINT get_text_length(EDITSTATE *es)
Definition: edit.c:212
int32_t INT
Definition: typedefs.h:56
Definition: parser.c:48
GLuint index
Definition: glext.h:6031
struct tagLINEDEF * next
Definition: edit.c:94
char line[200]
Definition: main.c:97
#define min(a, b)
Definition: monoChain.cc:55
#define es
Definition: i386-dis.c:431
INT length
Definition: edit.c:88

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

◆ EDIT_EM_LineIndex()

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

Definition at line 938 of file edit.c.

939 {
940  INT line_index;
941  const LINEDEF *line_def;
942 
943  if (!(es->style & ES_MULTILINE))
944  return 0;
945  if (line >= es->line_count)
946  return -1;
947 
948  line_index = 0;
949  line_def = es->first_line_def;
950  if (line == -1) {
951  INT index = es->selection_end - line_def->length;
952  while ((index >= 0) && line_def->next) {
953  line_index += line_def->length;
954  line_def = line_def->next;
955  index -= line_def->length;
956  }
957  } else {
958  while (line > 0) {
959  line_index += line_def->length;
960  line_def = line_def->next;
961  line--;
962  }
963  }
964  return line_index;
965 }
#define ES_MULTILINE
Definition: pedump.c:667
int32_t INT
Definition: typedefs.h:56
Definition: parser.c:48
GLuint index
Definition: glext.h:6031
struct tagLINEDEF * next
Definition: edit.c:94
#define es
Definition: i386-dis.c:431
INT length
Definition: edit.c:88

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

◆ EDIT_EM_LineLength()

static INT EDIT_EM_LineLength ( EDITSTATE es,
INT  index 
)
static

Definition at line 973 of file edit.c.

974 {
975  LINEDEF *line_def;
976 
977  if (!(es->style & ES_MULTILINE))
978  return get_text_length(es);
979 
980  if (index == -1) {
981  /* get the number of remaining non-selected chars of selected lines */
982  INT32 l; /* line number */
983  INT32 li; /* index of first char in line */
984  INT32 count;
985  l = EDIT_EM_LineFromChar(es, es->selection_start);
986  /* # chars before start of selection area */
987  count = es->selection_start - EDIT_EM_LineIndex(es, l);
988  l = EDIT_EM_LineFromChar(es, es->selection_end);
989  /* # chars after end of selection */
990  li = EDIT_EM_LineIndex(es, l);
991  count += li + EDIT_EM_LineLength(es, li) - es->selection_end;
992  return count;
993  }
994  line_def = es->first_line_def;
995  index -= line_def->length;
996  while ((index >= 0) && line_def->next) {
997  line_def = line_def->next;
998  index -= line_def->length;
999  }
1000  return line_def->net_length;
1001 }
static INT EDIT_EM_LineFromChar(EDITSTATE *es, INT index)
Definition: edit.c:909
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define ES_MULTILINE
Definition: pedump.c:667
static UINT get_text_length(EDITSTATE *es)
Definition: edit.c:212
static INT EDIT_EM_LineIndex(const EDITSTATE *es, INT line)
Definition: edit.c:938
INT net_length
Definition: edit.c:89
static INT EDIT_EM_LineLength(EDITSTATE *es, INT index)
Definition: edit.c:973
GLuint index
Definition: glext.h:6031
r l[0]
Definition: byte_order.h:167
struct tagLINEDEF * next
Definition: edit.c:94
signed int INT32
#define es
Definition: i386-dis.c:431
INT length
Definition: edit.c:88

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

◆ EDIT_EM_LineScroll()

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

Definition at line 1649 of file edit.c.

1650 {
1651  if (!(es->style & ES_MULTILINE))
1652  return FALSE;
1653 
1654  dx *= es->char_width;
1655  return EDIT_EM_LineScroll_internal(es, dx, dy);
1656 }
GLint dy
Definition: linetemp.h:97
#define ES_MULTILINE
Definition: pedump.c:667
static BOOL EDIT_EM_LineScroll_internal(EDITSTATE *es, INT dx, INT dy)
Definition: edit.c:1593
GLint dx
Definition: linetemp.h:97
#define es
Definition: i386-dis.c:431

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

◆ EDIT_EM_LineScroll_internal()

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

Definition at line 1593 of file edit.c.

1594 {
1595  INT nyoff;
1596  INT x_offset_in_pixels;
1597  INT lines_per_page = (es->format_rect.bottom - es->format_rect.top) /
1598  es->line_height;
1599 
1600  if (es->style & ES_MULTILINE)
1601  {
1602  x_offset_in_pixels = es->x_offset;
1603  }
1604  else
1605  {
1606  dy = 0;
1607  x_offset_in_pixels = (short)LOWORD(EDIT_EM_PosFromChar(es, es->x_offset, FALSE));
1608  }
1609 
1610  if (-dx > x_offset_in_pixels)
1611  dx = -x_offset_in_pixels;
1612  if (dx > es->text_width - x_offset_in_pixels)
1613  dx = es->text_width - x_offset_in_pixels;
1614  nyoff = max(0, es->y_offset + dy);
1615  if (nyoff >= es->line_count - lines_per_page)
1616  nyoff = max(0, es->line_count - lines_per_page);
1617  dy = (es->y_offset - nyoff) * es->line_height;
1618  if (dx || dy) {
1619  RECT rc1;
1620  RECT rc;
1621 
1622  es->y_offset = nyoff;
1623  if(es->style & ES_MULTILINE)
1624  es->x_offset += dx;
1625  else
1626  es->x_offset += dx / es->char_width;
1627 
1628  GetClientRect(es->hwndSelf, &rc1);
1629  IntersectRect(&rc, &rc1, &es->format_rect);
1630  ScrollWindowEx(es->hwndSelf, -dx, dy,
1631  NULL, &rc, NULL, NULL, SW_INVALIDATE);
1632  /* force scroll info update */
1634  }
1635  if (dx && !(es->flags & EF_HSCROLL_TRACK))
1637  if (dy && !(es->flags & EF_VSCROLL_TRACK))
1639  return TRUE;
1640 }
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
static void EDIT_UpdateScrollInfo(EDITSTATE *es)
Definition: edit.c:1552
GLint dy
Definition: linetemp.h:97
#define ES_MULTILINE
Definition: pedump.c:667
#define EF_VSCROLL_TRACK
Definition: edit.c:69
#define EDIT_NOTIFY_PARENT(es, wNotifyCode)
Definition: edit.c:161
int32_t INT
Definition: typedefs.h:56
#define EF_HSCROLL_TRACK
Definition: edit.c:70
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
smooth NULL
Definition: ftsmooth.c:416
static LRESULT EDIT_EM_PosFromChar(EDITSTATE *es, INT index, BOOL after_wrap)
Definition: edit.c:1009
int WINAPI ScrollWindowEx(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT, _In_ UINT)
if(!(yy_init))
Definition: macro.lex.yy.c:714
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
#define EN_HSCROLL
Definition: winuser.h:2006
#define SW_INVALIDATE
Definition: winuser.h:2554
#define EN_VSCROLL
Definition: winuser.h:2011
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
GLint dx
Definition: linetemp.h:97
#define es
Definition: i386-dis.c:431
#define LOWORD(l)
Definition: pedump.c:82

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 1009 of file edit.c.

1010 {
1012  INT l;
1013  INT li;
1014  INT x = 0;
1015  INT y = 0;
1016  INT w;
1017  INT lw;
1018  LINEDEF *line_def;
1019 
1020  index = min(index, len);
1021  if (es->style & ES_MULTILINE) {
1024 
1025  y = (l - es->y_offset) * es->line_height;
1026  li = EDIT_EM_LineIndex(es, l);
1027  if (after_wrap && (li == index) && l) {
1028  INT l2 = l - 1;
1029  line_def = es->first_line_def;
1030  while (l2) {
1031  line_def = line_def->next;
1032  l2--;
1033  }
1034  if (line_def->ending == END_WRAP) {
1035  l--;
1036  y -= es->line_height;
1037  li = EDIT_EM_LineIndex(es, l);
1038  }
1039  }
1040 
1041  line_def = es->first_line_def;
1042  while (line_def->index != li)
1043  line_def = line_def->next;
1044 
1045  lw = line_def->width;
1046  w = es->format_rect.right - es->format_rect.left;
1047  if (line_def->ssa)
1048  {
1049  ScriptStringCPtoX(line_def->ssa, (index - 1) - li, TRUE, &x);
1050  x -= es->x_offset;
1051  }
1052  else
1053 #ifdef __REACTOS__ /* CORE-15780 */
1054  x = (lw > 0 ? es->x_offset : x - es->x_offset);
1055 #else
1056  x = es->x_offset;
1057 #endif
1058 
1059  if (es->style & ES_RIGHT)
1060  x = w - (lw - x);
1061  else if (es->style & ES_CENTER)
1062  x += (w - lw) / 2;
1063  } else {
1064  INT xoff = 0;
1065  INT xi = 0;
1067  if (es->x_offset)
1068  {
1069  if (es->ssa)
1070  {
1071  if (es->x_offset >= get_text_length(es))
1072  {
1073  int leftover = es->x_offset - get_text_length(es);
1074  if (es->ssa)
1075  {
1076  const SIZE *size;
1077  size = ScriptString_pSize(es->ssa);
1078  xoff = size->cx;
1079  }
1080  else
1081  xoff = 0;
1082  xoff += es->char_width * leftover;
1083  }
1084  else
1085  ScriptStringCPtoX(es->ssa, es->x_offset, FALSE, &xoff);
1086  }
1087  else
1088  xoff = 0;
1089  }
1090  if (index)
1091  {
1092  if (index >= get_text_length(es))
1093  {
1094  if (es->ssa)
1095  {
1096  const SIZE *size;
1097  size = ScriptString_pSize(es->ssa);
1098  xi = size->cx;
1099  }
1100  else
1101  xi = 0;
1102  }
1103  else if (es->ssa)
1104  ScriptStringCPtoX(es->ssa, index, FALSE, &xi);
1105  else
1106  xi = 0;
1107  }
1108  x = xi - xoff;
1109 
1110  if (index >= es->x_offset) {
1111  if (!es->x_offset && (es->style & (ES_RIGHT | ES_CENTER)))
1112  {
1113  w = es->format_rect.right - es->format_rect.left;
1114  if (w > es->text_width)
1115  {
1116  if (es->style & ES_RIGHT)
1117  x += w - es->text_width;
1118  else if (es->style & ES_CENTER)
1119  x += (w - es->text_width) / 2;
1120  }
1121  }
1122  }
1123  y = 0;
1124  }
1125  x += es->format_rect.left;
1126  y += es->format_rect.top;
1127  return MAKELONG((INT16)x, (INT16)y);
1128 }
static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData(EDITSTATE *es, HDC dc, INT line)
Definition: edit.c:368
#define ES_CENTER
Definition: pedump.c:665
static INT EDIT_EM_LineFromChar(EDITSTATE *es, INT index)
Definition: edit.c:909
#define TRUE
Definition: types.h:120
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
LINE_END ending
Definition: edit.c:90
#define ES_MULTILINE
Definition: pedump.c:667
Definition: edit.c:81
static UINT get_text_length(EDITSTATE *es)
Definition: edit.c:212
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int32_t INT
Definition: typedefs.h:56
INT width
Definition: edit.c:91
static INT EDIT_EM_LineIndex(const EDITSTATE *es, INT line)
Definition: edit.c:938
#define ES_RIGHT
Definition: pedump.c:666
#define MAKELONG(a, b)
Definition: typedefs.h:248
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
r l[0]
Definition: byte_order.h:167
GLsizeiptr size
Definition: glext.h:5919
struct tagLINEDEF * next
Definition: edit.c:94
GLenum GLsizei len
Definition: glext.h:6722
const SIZE *WINAPI ScriptString_pSize(SCRIPT_STRING_ANALYSIS ssa)
Definition: usp10.c:3871
#define min(a, b)
Definition: monoChain.cc:55
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
HRESULT WINAPI ScriptStringCPtoX(SCRIPT_STRING_ANALYSIS ssa, int icp, BOOL fTrailing, int *pX)
Definition: usp10.c:2409
#define es
Definition: i386-dis.c:431
INT index
Definition: edit.c:92
SCRIPT_STRING_ANALYSIS ssa
Definition: edit.c:93
signed short INT16

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 2428 of file edit.c.

2430 {
2431  UINT tl = get_text_length(es);
2432  UINT utl;
2433  UINT s;
2434  UINT e;
2435  UINT i;
2436  UINT size;
2437  LPWSTR p;
2438  HRGN hrgn = 0;
2439  LPWSTR buf = NULL;
2440  UINT bufl;
2441 
2442  TRACE("%s, can_undo %d, send_update %d\n",
2443  debugstr_wn(lpsz_replace, strl), can_undo, send_update);
2444 
2445  s = es->selection_start;
2446  e = es->selection_end;
2447 
2449  if ((s == e) && !strl)
2450  return;
2451 
2452  ORDER_UINT(s, e);
2453 
2454  size = tl - (e - s) + strl;
2455  if (!size)
2456  es->text_width = 0;
2457 
2458  /* Issue the EN_MAXTEXT notification and continue with replacing text
2459  * so that buffer limit is honored. */
2460  if ((honor_limit) && (size > es->buffer_limit)) {
2462  /* Buffer limit can be smaller than the actual length of text in combobox */
2463  if (es->buffer_limit < (tl - (e-s)))
2464  strl = 0;
2465  else
2466  strl = min(strl, es->buffer_limit - (tl - (e-s)));
2467  }
2468 
2469  if (!EDIT_MakeFit(es, tl - (e - s) + strl))
2470  return;
2471 
2472  if (e != s) {
2473  /* there is something to be deleted */
2474  TRACE("deleting stuff.\n");
2475  bufl = e - s;
2476  buf = heap_alloc((bufl + 1) * sizeof(WCHAR));
2477  if (!buf) return;
2478  memcpy(buf, es->text + s, bufl * sizeof(WCHAR));
2479  buf[bufl] = 0; /* ensure 0 termination */
2480  /* now delete */
2481  strcpyW(es->text + s, es->text + e);
2483  }
2484  if (strl) {
2485  /* there is an insertion */
2486  tl = get_text_length(es);
2487  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));
2488  for (p = es->text + tl ; p >= es->text + s ; p--)
2489  p[strl] = p[0];
2490  for (i = 0 , p = es->text + s ; i < strl ; i++)
2491  p[i] = lpsz_replace[i];
2492  if(es->style & ES_UPPERCASE)
2493  CharUpperBuffW(p, strl);
2494  else if(es->style & ES_LOWERCASE)
2495  CharLowerBuffW(p, strl);
2497  }
2498  if (es->style & ES_MULTILINE)
2499  {
2500  INT st = min(es->selection_start, es->selection_end);
2502 
2503  hrgn = CreateRectRgn(0, 0, 0, 0);
2504  EDIT_BuildLineDefs_ML(es, st, st + strl,
2505  strl - abs(es->selection_end - es->selection_start), hrgn);
2506  /* if text is too long undo all changes */
2507  if (honor_limit && !(es->style & ES_AUTOVSCROLL) && (es->line_count > vlc)) {
2508  if (strl)
2509  strcpyW(es->text + e, es->text + e + strl);
2510  if (e != s)
2511  for (i = 0 , p = es->text ; i < e - s ; i++)
2512  p[i + s] = buf[i];
2515  abs(es->selection_end - es->selection_start) - strl, hrgn);
2516  strl = 0;
2517  e = s;
2518  hrgn = CreateRectRgn(0, 0, 0, 0);
2520  }
2521  }
2522  else {
2523  INT fw = es->format_rect.right - es->format_rect.left;
2526  /* remove chars that don't fit */
2527  if (honor_limit && !(es->style & ES_AUTOHSCROLL) && (es->text_width > fw)) {
2528  while ((es->text_width > fw) && s + strl >= s) {
2529  strcpyW(es->text + s + strl - 1, es->text + s + strl);
2530  strl--;
2531  es->text_length = -1;
2534  }
2537  }
2538  }
2539 
2540  if (e != s) {
2541  if (can_undo) {
2542  utl = strlenW(es->undo_text);
2543  if (!es->undo_insert_count && (*es->undo_text && (s == es->undo_position))) {
2544  /* undo-buffer is extended to the right */
2545  EDIT_MakeUndoFit(es, utl + e - s);
2546  memcpy(es->undo_text + utl, buf, (e - s)*sizeof(WCHAR));
2547  (es->undo_text + utl)[e - s] = 0; /* ensure 0 termination */
2548  } else if (!es->undo_insert_count && (*es->undo_text && (e == es->undo_position))) {
2549  /* undo-buffer is extended to the left */
2550  EDIT_MakeUndoFit(es, utl + e - s);
2551  for (p = es->undo_text + utl ; p >= es->undo_text ; p--)
2552  p[e - s] = p[0];
2553  for (i = 0 , p = es->undo_text ; i < e - s ; i++)
2554  p[i] = buf[i];
2555  es->undo_position = s;
2556  } else {
2557  /* new undo-buffer */
2558  EDIT_MakeUndoFit(es, e - s);
2559  memcpy(es->undo_text, buf, (e - s)*sizeof(WCHAR));
2560  es->undo_text[e - s] = 0; /* ensure 0 termination */
2561  es->undo_position = s;
2562  }
2563  /* any deletion makes the old insertion-undo invalid */
2564  es->undo_insert_count = 0;
2565  } else
2567  }
2568  if (strl) {
2569  if (can_undo) {
2570  if ((s == es->undo_position) ||
2571  ((es->undo_insert_count) &&
2572  (s == es->undo_position + es->undo_insert_count)))
2573  /*
2574  * insertion is new and at delete position or
2575  * an extension to either left or right
2576  */
2577  es->undo_insert_count += strl;
2578  else {
2579  /* new insertion undo */
2580  es->undo_position = s;
2581  es->undo_insert_count = strl;
2582  /* new insertion makes old delete-buffer invalid */
2583  *es->undo_text = '\0';
2584  }
2585  } else
2587  }
2588 
2589  heap_free(buf);
2590 
2591  s += strl;
2592 
2593  /* If text has been deleted and we're right or center aligned then scroll rightward */
2594  if (es->style & (ES_RIGHT | ES_CENTER))
2595  {
2596  INT delta = strl - abs(es->selection_end - es->selection_start);
2597 
2598  if (delta < 0 && es->x_offset)
2599  {
2600  if (abs(delta) > es->x_offset)
2601  es->x_offset = 0;
2602  else
2603  es->x_offset += delta;
2604  }
2605  }
2606 
2607  EDIT_EM_SetSel(es, s, s, FALSE);
2608  es->flags |= EF_MODIFIED;
2609  if (send_update) es->flags |= EF_UPDATE;
2610  if (hrgn)
2611  {
2613  DeleteObject(hrgn);
2614  }
2615  else
2617 
2619 
2620  /* force scroll info update */
2622 
2623 
2624  if(send_update || (es->flags & EF_UPDATE))
2625  {
2626  es->flags &= ~EF_UPDATE;
2628  }
2630 }
static BOOL EDIT_MakeUndoFit(EDITSTATE *es, UINT size)
Definition: edit.c:1309
#define ES_CENTER
Definition: pedump.c:665
#define abs(i)
Definition: fconv.c:206
static void EDIT_UpdateText(EDITSTATE *es, const RECT *rc, BOOL bErase)
Definition: edit.c:1351
#define EF_UPDATE
Definition: edit.c:68
#define EN_MAXTEXT
Definition: winuser.h:2008
#define TRUE
Definition: types.h:120
static BOOL EDIT_EM_SetSel(EDITSTATE *es, UINT start, UINT end, BOOL after_wrap)
Definition: edit.c:1481
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
static void EDIT_EM_EmptyUndoBuffer(EDITSTATE *es)
Definition: edit.c:188
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static void EDIT_UpdateScrollInfo(EDITSTATE *es)
Definition: edit.c:1552
static INT get_vertical_line_count(EDITSTATE *es)
Definition: edit.c:410
#define ES_MULTILINE
Definition: pedump.c:667
static void EDIT_EM_ScrollCaret(EDITSTATE *es)
Definition: edit.c:1729
static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta, HRGN hrgn)
Definition: edit.c:425
static void EDIT_UpdateTextRegion(EDITSTATE *es, HRGN hrgn, BOOL bErase)
Definition: edit.c:1336
static UINT get_text_length(EDITSTATE *es)
Definition: edit.c:212
#define EDIT_NOTIFY_PARENT(es, wNotifyCode)
Definition: edit.c:161
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
int32_t INT
Definition: typedefs.h:56
#define ORDER_UINT(x, y)
Definition: edit.c:158
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
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 ES_RIGHT
Definition: pedump.c:666
#define e
Definition: ke_i.h:82
#define EF_MODIFIED
Definition: edit.c:66
#define debugstr_w
Definition: kernel32.h:32
static void EDIT_CalcLineWidth_SL(EDITSTATE *es)
Definition: edit.c:757
#define ES_UPPERCASE
Definition: pedump.c:668
smooth NULL
Definition: ftsmooth.c:416
static void EDIT_InvalidateUniscribeData(EDITSTATE *es)
Definition: edit.c:311
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
#define ES_AUTOVSCROLL
Definition: pedump.c:671
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD WINAPI CharUpperBuffW(_Inout_updates_(cchLength) LPWSTR lpsz, _In_ DWORD cchLength)
static HRGN hrgn
Definition: win.c:55
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLdouble s
Definition: gl.h:2039
#define debugstr_wn
Definition: kernel32.h:33
DWORD WINAPI CharLowerBuffW(_Inout_updates_(cchLength) LPWSTR lpsz, _In_ DWORD cchLength)
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
static void text_buffer_changed(EDITSTATE *es)
Definition: edit.c:1190
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
static BOOL EDIT_MakeFit(EDITSTATE *es, UINT size)
Definition: edit.c:1268
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define es
Definition: i386-dis.c:431
#define ES_AUTOHSCROLL
Definition: pedump.c:672
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define ES_LOWERCASE
Definition: pedump.c:669
#define EN_CHANGE
Definition: winuser.h:2004

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(), and EDIT_WM_SetText().

◆ EDIT_EM_Scroll()

static LRESULT EDIT_EM_Scroll ( EDITSTATE es,
INT  action 
)
static

Definition at line 1664 of file edit.c.

1665 {
1666  INT dy;
1667 
1668  if (!(es->style & ES_MULTILINE))
1669  return (LRESULT)FALSE;
1670 
1671  dy = 0;
1672 
1673  switch (action) {
1674  case SB_LINEUP:
1675  if (es->y_offset)
1676  dy = -1;
1677  break;
1678  case SB_LINEDOWN:
1679  if (es->y_offset < es->line_count - 1)
1680  dy = 1;
1681  break;
1682  case SB_PAGEUP:
1683  if (es->y_offset)
1684  dy = -(es->format_rect.bottom - es->format_rect.top) / es->line_height;
1685  break;
1686  case SB_PAGEDOWN:
1687  if (es->y_offset < es->line_count - 1)
1688  dy = (es->format_rect.bottom - es->format_rect.top) / es->line_height;
1689  break;
1690  default:
1691  return (LRESULT)FALSE;
1692  }
1693  if (dy) {
1695  /* check if we are going to move too far */
1696  if(es->y_offset + dy > es->line_count - vlc)
1697  dy = max(es->line_count - vlc, 0) - es->y_offset;
1698 
1699  /* Notification is done in EDIT_EM_LineScroll */
1700  if(dy) {
1701  EDIT_EM_LineScroll(es, 0, dy);
1702  return MAKELONG(dy, TRUE);
1703  }
1704 
1705  }
1706  return (LRESULT)FALSE;
1707 }
#define SB_PAGEDOWN
Definition: winuser.h:569
return
Definition: dirsup.c:529
#define SB_PAGEUP
Definition: winuser.h:568
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
static INT get_vertical_line_count(EDITSTATE *es)
Definition: edit.c:410
GLint dy
Definition: linetemp.h:97
#define ES_MULTILINE
Definition: pedump.c:667
int32_t INT
Definition: typedefs.h:56
#define MAKELONG(a, b)
Definition: typedefs.h:248
if(!(yy_init))
Definition: macro.lex.yy.c:714
const WCHAR * action
Definition: action.c:7783
static BOOL EDIT_EM_LineScroll(EDITSTATE *es, INT dx, INT dy)
Definition: edit.c:1649
#define SB_LINEDOWN
Definition: winuser.h:565
#define SB_LINEUP
Definition: winuser.h:564
LONG_PTR LRESULT
Definition: windef.h:209
#define es
Definition: i386-dis.c:431

Referenced by EDIT_WindowProc(), and EDIT_WM_VScroll().

◆ EDIT_EM_ScrollCaret()

static void EDIT_EM_ScrollCaret ( EDITSTATE es)
static

Definition at line 1729 of file edit.c.

1730 {
1731  if (es->style & ES_MULTILINE) {
1732  INT l;
1733  INT vlc;
1734  INT ww;
1735  INT cw = es->char_width;
1736  INT x;
1737  INT dy = 0;
1738  INT dx = 0;
1739 
1740  l = EDIT_EM_LineFromChar(es, es->selection_end);
1741  x = (short)LOWORD(EDIT_EM_PosFromChar(es, es->selection_end, es->flags & EF_AFTER_WRAP));
1742  vlc = get_vertical_line_count(es);
1743  if (l >= es->y_offset + vlc)
1744  dy = l - vlc + 1 - es->y_offset;
1745  if (l < es->y_offset)
1746  dy = l - es->y_offset;
1747  ww = es->format_rect.right - es->format_rect.left;
1748  if (x < es->format_rect.left)
1749  dx = x - es->format_rect.left - ww / HSCROLL_FRACTION / cw * cw;
1750  if (x > es->format_rect.right)
1751  dx = x - es->format_rect.left - (HSCROLL_FRACTION - 1) * ww / HSCROLL_FRACTION / cw * cw;
1752  if (dy || dx || (es->y_offset && (es->line_count - es->y_offset < vlc)))
1753  {
1754  /* check if we are going to move too far */
1755  if(es->x_offset + dx + ww > es->text_width)
1756  dx = es->text_width - ww - es->x_offset;
1757  if(dx || dy || (es->y_offset && (es->line_count - es->y_offset < vlc)))
1759  }
1760  } else {
1761  INT x;
1762  INT goal;
1763  INT format_width;
1764 
1765  x = (short)LOWORD(EDIT_EM_PosFromChar(es, es->selection_end, FALSE));
1766  format_width = es->format_rect.right - es->format_rect.left;
1767  if (x < es->format_rect.left) {
1768  goal = es->format_rect.left + format_width / HSCROLL_FRACTION;
1769  do {
1770  es->x_offset--;
1771  x = (short)LOWORD(EDIT_EM_PosFromChar(es, es->selection_end, FALSE));
1772  } while ((x < goal) && es->x_offset);
1773  /* FIXME: use ScrollWindow() somehow to improve performance */
1775  } else if (x > es->format_rect.right) {
1776  INT x_last;
1778  goal = es->format_rect.right - format_width / HSCROLL_FRACTION;
1779  do {
1780  es->x_offset++;
1781  x = (short)LOWORD(EDIT_EM_PosFromChar(es, es->selection_end, FALSE));
1782  x_last = (short)LOWORD(EDIT_EM_PosFromChar(es, len, FALSE));
1783  } while ((x > goal) && (x_last > es->format_rect.right));
1784  /* FIXME: use ScrollWindow() somehow to improve performance */
1786  }
1787  }
1788 
1789  if(es->flags & EF_FOCUSED)
1790  EDIT_SetCaretPos(es, es->selection_end, es->flags & EF_AFTER_WRAP);
1791 }
static void EDIT_UpdateText(EDITSTATE *es, const RECT *rc, BOOL bErase)
Definition: edit.c:1351
static INT EDIT_EM_LineFromChar(EDITSTATE *es, INT index)
Definition: edit.c:909
#define TRUE
Definition: types.h:120
static INT get_vertical_line_count(EDITSTATE *es)
Definition: edit.c:410
GLint dy
Definition: linetemp.h:97
#define ES_MULTILINE
Definition: pedump.c:667
static UINT get_text_length(EDITSTATE *es)
Definition: edit.c:212
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static void EDIT_SetCaretPos(EDITSTATE *es, INT pos, BOOL after_wrap)
Definition: edit.c:1715
int32_t INT
Definition: typedefs.h:56
static BOOL EDIT_EM_LineScroll_internal(EDITSTATE *es, INT dx, INT dy)
Definition: edit.c:1593
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
#define EF_AFTER_WRAP
Definition: edit.c:71
smooth NULL
Definition: ftsmooth.c:416
#define EF_FOCUSED
Definition: edit.c:67
static LRESULT EDIT_EM_PosFromChar(EDITSTATE *es, INT index, BOOL after_wrap)
Definition: edit.c:1009
r l[0]
Definition: byte_order.h:167
#define HSCROLL_FRACTION
Definition: edit.c:61
GLenum GLsizei len
Definition: glext.h:6722
GLint dx
Definition: linetemp.h:97
#define es
Definition: i386-dis.c:431
#define LOWORD(l)
Definition: pedump.c:82

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(), and EDIT_WM_SetText().

◆ EDIT_EM_SetHandle()

static void EDIT_EM_SetHandle ( EDITSTATE es,
HLOCAL  hloc 
)
static

Definition at line 2640 of file edit.c.

2641 {
2642  if (!(es->style & ES_MULTILINE))
2643  return;
2644 
2645  if (!hloc)
2646  return;
2647 
2649 
2650  es->hloc32W = hloc;
2651  es->buffer_size = LocalSize(es->hloc32W)/sizeof(WCHAR) - 1;
2652 
2653  /* The text buffer handle belongs to the control */
2654  es->hlocapp = NULL;
2655 
2658 
2659  es->x_offset = es->y_offset = 0;
2660  es->selection_start = es->selection_end = 0;
2662  es->flags &= ~EF_MODIFIED;
2663  es->flags &= ~EF_UPDATE;
2667  /* force scroll info update */
2669 }
static void EDIT_UpdateText(EDITSTATE *es, const RECT *rc, BOOL bErase)
Definition: edit.c:1351
#define EF_UPDATE
Definition: edit.c:68
#define TRUE
Definition: types.h:120
static void EDIT_EM_EmptyUndoBuffer(EDITSTATE *es)
Definition: edit.c:188
static void EDIT_UpdateScrollInfo(EDITSTATE *es)
Definition: edit.c:1552
#define ES_MULTILINE
Definition: pedump.c:667
static void EDIT_EM_ScrollCaret(EDITSTATE *es)
Definition: edit.c:1729
static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta, HRGN hrgn)
Definition: edit.c:425
static UINT get_text_length(EDITSTATE *es)
Definition: edit.c:212
SIZE_T NTAPI LocalSize(HLOCAL hMem)
Definition: heapmem.c:1777
static void EDIT_LockBuffer(EDITSTATE *es)
Definition: edit.c:1203
static void EDIT_UnlockBuffer(EDITSTATE *es, BOOL force)
Definition: edit.c:1222
#define EF_MODIFIED
Definition: edit.c:66
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void text_buffer_changed(EDITSTATE *es)
Definition: edit.c:1190
#define es
Definition: i386-dis.c:431

Referenced by EDIT_WindowProc().

◆ EDIT_EM_SetLimitText()

static void EDIT_EM_SetLimitText ( EDITSTATE es,
UINT  limit 
)
static

Definition at line 2679 of file edit.c.

2680 {
2681  if (!limit) limit = ~0u;
2682  if (!(es->style & ES_MULTILINE)) limit = min(limit, 0x7ffffffe);
2683  es->buffer_limit = limit;
2684 }
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
#define ES_MULTILINE
Definition: pedump.c:667
GLint limit
Definition: glext.h:10326
#define min(a, b)
Definition: monoChain.cc:55
#define es
Definition: i386-dis.c:431

Referenced by EDIT_WindowProc().

◆ EDIT_EM_SetMargins()

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

Definition at line 2715 of file edit.c.

2717 {
2718  TEXTMETRICW tm;
2719  INT default_left_margin = 0; /* in pixels */
2720  INT default_right_margin = 0; /* in pixels */
2721 
2722  /* Set the default margins depending on the font */
2723  if (es->font && (left == EC_USEFONTINFO || right == EC_USEFONTINFO)) {
2724  HDC dc = GetDC(es->hwndSelf);
2725  HFONT old_font = SelectObject(dc, es->font);
2727  RECT rc;
2728 
2729  /* The default margins are only non zero for TrueType or Vector fonts */
2730  if (tm.tmPitchAndFamily & ( TMPF_VECTOR | TMPF_TRUETYPE )) {
2731  if (!is_cjk(tm.tmCharSet)) {
2732  default_left_margin = width / 2;
2733  default_right_margin = width / 2;
2734 
2735  GetClientRect(es->hwndSelf, &rc);
2736  if (rc.right - rc.left < (width / 2 + width) * 2 &&
2737  (width >= 28 || !IsRectEmpty(&rc)) ) {
2738  default_left_margin = es->left_margin;
2739  default_right_margin = es->right_margin;
2740  }
2741  } else {
2742  /* FIXME: figure out the CJK values. They are not affected by the client rect. */
2743  default_left_margin = width / 2;
2744  default_right_margin = width / 2;
2745  }
2746  }
2747  SelectObject(dc, old_font);
2748  ReleaseDC(es->hwndSelf, dc);
2749  }
2750 
2751  if (action & EC_LEFTMARGIN) {
2752  es->format_rect.left -= es->left_margin;
2753  if (left != EC_USEFONTINFO)
2754  es->left_margin = left;
2755  else
2756  es->left_margin = default_left_margin;
2757  es->format_rect.left += es->left_margin;
2758  }
2759 
2760  if (action & EC_RIGHTMARGIN) {
2761  es->format_rect.right += es->right_margin;
2762  if (right != EC_USEFONTINFO)
2763  es->right_margin = right;
2764  else
2765  es->right_margin = default_right_margin;
2766  es->format_rect.right -= es->right_margin;
2767  }
2768 
2769  if (action & (EC_LEFTMARGIN | EC_RIGHTMARGIN)) {
2771  if (repaint) EDIT_UpdateText(es, NULL, TRUE);
2772  }
2773 
2774  TRACE("left=%d, right=%d\n", es->left_margin, es->right_margin);
2775 }
static void EDIT_UpdateText(EDITSTATE *es, const RECT *rc, BOOL bErase)
Definition: edit.c:1351
GLint GLint GLsizei width
Definition: gl.h:1546
#define EC_RIGHTMARGIN
Definition: winuser.h:2582
#define TRUE
Definition: types.h:120
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
HDC dc
Definition: cylfrac.c:34
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
int32_t INT
Definition: typedefs.h:56
long LONG
Definition: pedump.c:60
#define TMPF_TRUETYPE
Definition: wingdi.h:1312
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
#define EC_LEFTMARGIN
Definition: winuser.h:2581
smooth NULL
Definition: ftsmooth.c:416
static void EDIT_AdjustFormatRect(EDITSTATE *es)
Definition: edit.c:2204
#define TRACE(s)
Definition: solgame.cpp:4
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
Definition: time.h:76
#define TMPF_VECTOR
Definition: wingdi.h:1311
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
LONG WINAPI GdiGetCharDimensions(HDC, LPTEXTMETRICW, LONG *)
Definition: font.c:2145
const WCHAR * action
Definition: action.c:7783
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static BOOL is_cjk(UINT charset)
Definition: edit.c:2700
#define es
Definition: i386-dis.c:431
#define EC_USEFONTINFO
Definition: winuser.h:2583

Referenced by EDIT_WindowProc(), and EDIT_WM_SetFont().

◆ EDIT_EM_SetPasswordChar()

static void EDIT_EM_SetPasswordChar ( EDITSTATE es,
WCHAR  c 
)
static

Definition at line 2783 of file edit.c.

2784 {
2785  LONG style;
2786 
2787  if (es->style & ES_MULTILINE)
2788  return;
2789 
2790  if (es->password_char == c)
2791  return;
2792 
2793  style = GetWindowLongW( es->hwndSelf, GWL_STYLE );
2794  es->password_char = c;
2795  if (c) {
2796  SetWindowLongW( es->hwndSelf, GWL_STYLE, style | ES_PASSWORD );
2797  es->style |= ES_PASSWORD;
2798  } else {
2799  SetWindowLongW( es->hwndSelf, GWL_STYLE, style & ~ES_PASSWORD );
2800  es->style &= ~ES_PASSWORD;
2801  }
2804 }
static void EDIT_UpdateText(EDITSTATE *es, const RECT *rc, BOOL bErase)
Definition: edit.c:1351
#define TRUE
Definition: types.h:120
#define ES_MULTILINE
Definition: pedump.c:667
#define ES_PASSWORD
Definition: pedump.c:670
long LONG
Definition: pedump.c:60
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
smooth NULL
Definition: ftsmooth.c:416
static void EDIT_InvalidateUniscribeData(EDITSTATE *es)
Definition: edit.c:311
const GLubyte * c
Definition: glext.h:8905
#define GWL_STYLE
Definition: winuser.h:846
#define c
Definition: ke_i.h:80
#define es
Definition: i386-dis.c:431
Arabic default style
Definition: afstyles.h:93

Referenced by EDIT_WindowProc().

◆ EDIT_EM_SetSel()

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

Definition at line 1481 of file edit.c.

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

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(), and EDIT_WM_SetText().

◆ EDIT_EM_SetTabStops()

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

Definition at line 2812 of file edit.c.

2813 {
2814  if (!(es->style & ES_MULTILINE))
2815  return FALSE;
2816  heap_free(es->tabs);
2817  es->tabs_count = count;
2818  if (!count)
2819  es->tabs = NULL;
2820  else {
2821  es->tabs = heap_alloc(count * sizeof(INT));
2822  memcpy(es->tabs, tabs, count * sizeof(INT));
2823  }
2825  return TRUE;
2826 }
#define TRUE
Definition: types.h:120
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define ES_MULTILINE
Definition: pedump.c:667
int32_t INT
Definition: typedefs.h:56
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
smooth NULL
Definition: ftsmooth.c:416
static void EDIT_InvalidateUniscribeData(EDITSTATE *es)
Definition: edit.c:311
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define es
Definition: i386-dis.c:431
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by EDIT_WindowProc().

◆ EDIT_EM_SetWordBreakProc()

static void EDIT_EM_SetWordBreakProc ( EDITSTATE es,
EDITWORDBREAKPROCW  wbp 
)
static

Definition at line 2834 of file edit.c.

2835 {
2836  if (es->word_break_proc == wbp)
2837  return;
2838 
2839  es->word_break_proc = wbp;
2840 
2841  if ((es->style & ES_MULTILINE) && !(es->style & ES_AUTOHSCROLL)) {
2844  }
2845 }
static void EDIT_UpdateText(EDITSTATE *es, const RECT *rc, BOOL bErase)
Definition: edit.c:1351
#define TRUE
Definition: types.h:120
#define ES_MULTILINE
Definition: pedump.c:667
static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta, HRGN hrgn)
Definition: edit.c:425
static UINT get_text_length(EDITSTATE *es)
Definition: edit.c:212
smooth NULL
Definition: ftsmooth.c:416
#define es
Definition: i386-dis.c:431
#define ES_AUTOHSCROLL
Definition: pedump.c:672

Referenced by EDIT_WindowProc().

◆ EDIT_EM_Undo()

static BOOL EDIT_EM_Undo ( EDITSTATE es)
static

Definition at line 2853 of file edit.c.

2854 {
2855  INT ulength;
2856  LPWSTR utext;
2857 
2858  /* As per MSDN spec, for a single-line edit control,
2859  the return value is always TRUE */
2860  if( es->style & ES_READONLY )
2861  return !(es->style & ES_MULTILINE);
2862 
2863  ulength = strlenW(es->undo_text);
2864 
2865  utext = heap_alloc((ulength + 1) * sizeof(WCHAR));
2866 
2867  strcpyW(utext, es->undo_text);
2868 
2869  TRACE("before UNDO:insertion length = %d, deletion buffer = %s\n",
2870  es->undo_insert_count, debugstr_w(utext));
2871 
2872  EDIT_EM_SetSel(es, es->undo_position, es->undo_position + es->undo_insert_count, FALSE);
2874  EDIT_EM_ReplaceSel(es, TRUE, utext, ulength, TRUE, TRUE);
2875  EDIT_EM_SetSel(es, es->undo_position, es->undo_position + es->undo_insert_count, FALSE);
2876  /* send the notification after the selection start and end are set */
2879  heap_free(utext);
2880 
2881  TRACE("after UNDO:insertion length = %d, deletion buffer = %s\n",
2882  es->undo_insert_count, debugstr_w(es->undo_text));
2883  return TRUE;
2884 }
#define TRUE
Definition: types.h:120
static BOOL EDIT_EM_SetSel(EDITSTATE *es, UINT start, UINT end, BOOL after_wrap)
Definition: edit.c:1481
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
static void EDIT_EM_EmptyUndoBuffer(EDITSTATE *es)
Definition: edit.c:188
#define ES_MULTILINE
Definition: pedump.c:667
static void EDIT_EM_ScrollCaret(EDITSTATE *es)
Definition: edit.c:1729
#define EDIT_NOTIFY_PARENT(es, wNotifyCode)
Definition: edit.c:161
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:2428
#define ES_READONLY
Definition: pedump.c:675
int32_t INT
Definition: typedefs.h:56
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define es
Definition: i386-dis.c:431
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define EN_CHANGE
Definition: winuser.h:2004

Referenced by EDIT_WindowProc(), and EDIT_WM_SysKeyDown().

◆ EDIT_GetCompositionStr()

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

Definition at line 4185 of file edit.c.

4186 {
4187  LONG buflen;
4188  LPWSTR lpCompStr;
4189  LPSTR lpCompStrAttr = NULL;
4190  DWORD dwBufLenAttr;
4191 
4192  buflen = ImmGetCompositionStringW(hIMC, GCS_COMPSTR, NULL, 0);
4193 
4194  if (buflen < 0)
4195  {
4196  return;
4197  }
4198 
4199  lpCompStr = heap_alloc(buflen);
4200  if (!lpCompStr)
4201  {
4202  ERR("Unable to allocate IME CompositionString\n");
4203  return;
4204  }
4205 
4206  if (buflen)
4207  ImmGetCompositionStringW(hIMC, GCS_COMPSTR, lpCompStr, buflen);
4208 
4209  if (CompFlag & GCS_COMPATTR)
4210  {
4211  /*
4212  * We do not use the attributes yet. it would tell us what characters
4213  * are in transition and which are converted or decided upon
4214  */
4215  dwBufLenAttr = ImmGetCompositionStringW(hIMC, GCS_COMPATTR, NULL, 0);
4216  if (dwBufLenAttr)
4217  {
4218  dwBufLenAttr ++;
4219  lpCompStrAttr = heap_alloc(dwBufLenAttr + 1);
4220  if (!lpCompStrAttr)
4221  {
4222  ERR("Unable to allocate IME Attribute String\n");
4223  heap_free(lpCompStr);
4224  return;
4225  }
4226  ImmGetCompositionStringW(hIMC,GCS_COMPATTR, lpCompStrAttr,
4227  dwBufLenAttr);
4228  lpCompStrAttr[dwBufLenAttr] = 0;
4229  }
4230  }
4231 
4232  /* check for change in composition start */
4233  if (es->selection_end < es->composition_start)
4234  es->composition_start = es->selection_end;
4235 
4236  /* replace existing selection string */
4237  es->selection_start = es->composition_start;
4238 
4239  if (es->composition_len > 0)
4240  es->selection_end = es->composition_start + es->composition_len;
4241  else
4242  es->selection_end = es->selection_start;
4243 
4244  EDIT_EM_ReplaceSel(es, FALSE, lpCompStr, buflen / sizeof(WCHAR), TRUE, TRUE);
4245  es->composition_len = abs(es->composition_start - es->selection_end);
4246 
4247  es->selection_start = es->composition_start;
4248  es->selection_end = es->selection_start + es->composition_len;
4249 
4250  heap_free(lpCompStrAttr);
4251  heap_free(lpCompStr);
4252 }
#define abs(i)
Definition: fconv.c:206
#define TRUE
Definition: types.h:120
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:2428
char * LPSTR
Definition: xmlstorage.h:182
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG WINAPI ImmGetCompositionStringW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
Definition: imm.c:1469
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GCS_COMPATTR
Definition: imm.h:360
#define ERR(fmt,...)
Definition: debug.h:109
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define es
Definition: i386-dis.c:431
#define GCS_COMPSTR
Definition: imm.h:359
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by EDIT_ImeComposition().

◆ EDIT_GetLineRect()

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

Definition at line 1139 of file edit.c.

1140 {
1142  INT line_index = 0;
1143  INT pt1, pt2, pt3;
1144 
1145  if (es->style & ES_MULTILINE)
1146  {
1147  const LINEDEF *line_def = NULL;
1148  rc->top = es->format_rect.top + (line - es->y_offset) * es->line_height;
1149  if (line >= es->line_count)
1150  return;
1151 
1152  line_def = es->first_line_def;
1153  if (line == -1) {
1154  INT index = es->selection_end - line_def->length;
1155  while ((index >= 0) && line_def->next) {
1156  line_index += line_def->length;
1157  line_def = line_def->next;
1158  index -= line_def->length;
1159  }
1160  } else {
1161  while (line > 0) {
1162  line_index += line_def->length;
1163  line_def = line_def->next;
1164  line--;
1165  }
1166  }
1167  ssa = line_def->ssa;
1168  }
1169  else
1170  {
1171  line_index = 0;
1172  rc->top = es->format_rect.top;
1173  ssa = es->ssa;
1174  }
1175 
1176  rc->bottom = rc->top + es->line_height;
1177  pt1 = (scol == 0) ? es->format_rect.left : (short)LOWORD(EDIT_EM_PosFromChar(es, line_index + scol, TRUE));
1178  pt2 = (ecol == -1) ? es->format_rect.right : (short)LOWORD(EDIT_EM_PosFromChar(es, line_index + ecol, TRUE));
1179  if (ssa)
1180  {
1181  ScriptStringCPtoX(ssa, scol, FALSE, &pt3);
1182  pt3+=es->format_rect.left;
1183  }
1184  else pt3 = pt1;
1185  rc->right = max(max(pt1 , pt2),pt3);
1186  rc->left = min(min(pt1, pt2),pt3);
1187 }
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
#define ES_MULTILINE
Definition: pedump.c:667
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
int32_t INT
Definition: typedefs.h:56
smooth NULL
Definition: ftsmooth.c:416
static LRESULT EDIT_EM_PosFromChar(EDITSTATE *es, INT index, BOOL after_wrap)
Definition: edit.c:1009
Definition: parser.c:48
GLuint index
Definition: glext.h:6031
if(!(yy_init))
Definition: macro.lex.yy.c:714
struct tagLINEDEF * next
Definition: edit.c:94
#define min(a, b)
Definition: monoChain.cc:55
LONG bottom
Definition: windef.h:294
HRESULT WINAPI ScriptStringCPtoX(SCRIPT_STRING_ANALYSIS ssa, int icp, BOOL fTrailing, int *pX)
Definition: usp10.c:2409
#define es
Definition: i386-dis.c:431
#define LOWORD(l)
Definition: pedump.c:82
SCRIPT_STRING_ANALYSIS ssa
Definition: edit.c:93
INT length
Definition: edit.c:88

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 4254 of file edit.c.

4255 {
4256  LONG buflen;
4257  LPWSTR lpResultStr;
4258 
4259  buflen = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0);
4260  if (buflen <= 0)
4261  {
4262  return;
4263  }
4264 
4265  lpResultStr = heap_alloc(buflen);
4266  if (!lpResultStr)
4267  {
4268  ERR("Unable to alloc buffer for IME string\n");
4269  return;
4270  }
4271 
4272  ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, lpResultStr, buflen);
4273 
4274  /* check for change in composition start */
4275  if (es->selection_end < es->composition_start)
4276  es->composition_start = es->selection_end;
4277 
4278  es->selection_start = es->composition_start;
4279  es->selection_end = es->composition_start + es->composition_len;
4280  EDIT_EM_ReplaceSel(es, TRUE, lpResultStr, buflen / sizeof(WCHAR), TRUE, TRUE);
4281  es->composition_start = es->selection_end;
4282  es->composition_len = 0;
4283 
4284  heap_free(lpResultStr);
4285 }
#define TRUE
Definition: types.h:120
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:2428
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define GCS_RESULTSTR
Definition: imm.h:366
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG WINAPI ImmGetCompositionStringW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
Definition: imm.c:1469
#define ERR(fmt,...)
Definition: debug.h:109
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define es
Definition: i386-dis.c:431
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by EDIT_ImeComposition().

◆ EDIT_ImeComposition()

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

Definition at line 4287 of file edit.c.

4288 {
4289  HIMC hIMC;
4290  int cursor;
4291 
4292  if (es->composition_len == 0 && es->selection_start != es->selection_end)
4293  {
4295  es->composition_start = es->selection_end;
4296  }
4297 
4298  hIMC = ImmGetContext(hwnd);
4299  if (!hIMC)
4300  return;
4301 
4302  if (CompFlag & GCS_RESULTSTR)
4303  {
4304  EDIT_GetResultStr(hIMC, es);
4305  cursor = 0;
4306  }
4307  else
4308  {
4309  if (CompFlag & GCS_COMPSTR)
4310  EDIT_GetCompositionStr(hIMC, CompFlag, es);
4312  }
4313  ImmReleaseContext(hwnd, hIMC);
4314  EDIT_SetCaretPos(es, es->selection_start + cursor, es->flags & EF_AFTER_WRAP);
4315 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
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:2428
static void EDIT_SetCaretPos(EDITSTATE *es, INT pos, BOOL after_wrap)
Definition: edit.c:1715
#define GCS_CURSORPOS
Definition: imm.h:362
#define EF_AFTER_WRAP
Definition: edit.c:71
static void EDIT_GetResultStr(HIMC hIMC, EDITSTATE *es)
Definition: edit.c:4254
smooth NULL
Definition: ftsmooth.c:416
#define GCS_RESULTSTR
Definition: imm.h:366
DWORD HIMC
Definition: dimm.idl:75
static void EDIT_GetCompositionStr(HIMC hIMC, LPARAM CompFlag, EDITSTATE *es)
Definition: edit.c:4185
LONG WINAPI ImmGetCompositionStringW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
Definition: imm.c:1469
HIMC WINAPI ImmGetContext(HWND hWnd)
Definition: imm.c:1496
BOOL WINAPI ImmReleaseContext(HWND hWnd, HIMC hIMC)
Definition: imm.c:2253
const char cursor[]
Definition: icontest.c:13
#define es
Definition: i386-dis.c:431
#define GCS_COMPSTR
Definition: imm.h:359

Referenced by EDIT_WindowProc().

◆ EDIT_InvalidateText()

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

Definition at line 1451 of file edit.c.

1452 {
1453  if (end == start)
1454  return;
1455 
1456  if (end == -1)
1457  end = get_text_length(es);
1458 
1459  if (end < start) {
1460  INT tmp = start;
1461  start = end;
1462  end = tmp;
1463  }
1464 
1465  if (es->style & ES_MULTILINE)
1467  else
1469 }
#define ES_MULTILINE
Definition: pedump.c:667
static UINT get_text_length(EDITSTATE *es)
Definition: edit.c:212
GLuint GLuint end
Definition: gl.h:1545
int32_t INT
Definition: typedefs.h:56
GLuint start
Definition: gl.h:1545
static void EDIT_ML_InvalidateText(EDITSTATE *es, INT start, INT end)
Definition: edit.c:1386
static void EDIT_SL_InvalidateText(EDITSTATE *es, INT start, INT end)
Definition: edit.c:1368
#define es
Definition: i386-dis.c:431

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

◆ EDIT_InvalidateUniscribeData()

static void EDIT_InvalidateUniscribeData ( EDITSTATE es)
inlinestatic

Definition at line 311 of file edit.c.

312 {
313  LINEDEF *line_def = es->first_line_def;
314  while (line_def)
315  {
317  line_def = line_def->next;
318  }
319  if (es->ssa)
320  {
321  ScriptStringFree(&es->ssa);
322  es->ssa = NULL;
323  }
324 }
static void EDIT_InvalidateUniscribeData_linedef(LINEDEF *line_def)
Definition: edit.c:302
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI ScriptStringFree(SCRIPT_STRING_ANALYSIS *pssa)
Definition: usp10.c:2554
struct tagLINEDEF * next
Definition: edit.c:94
#define es
Definition: i386-dis.c:431

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 302 of file edit.c.

303 {
304  if (line_def->ssa)
305  {
306  ScriptStringFree(&line_def->ssa);
307  line_def->ssa = NULL;
308  }
309 }
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI ScriptStringFree(SCRIPT_STRING_ANALYSIS *pssa)
Definition: usp10.c:2554
SCRIPT_STRING_ANALYSIS ssa
Definition: edit.c:93

Referenced by EDIT_BuildLineDefs_ML(), and EDIT_InvalidateUniscribeData().

◆ EDIT_IsInsideDialog()

static BOOL EDIT_IsInsideDialog ( EDITSTATE es)
inlinestatic

Definition at line 2894 of file edit.c.

2895 {
2896  return (es->flags & EF_DIALOGMODE);
2897 }
#define EF_DIALOGMODE
Definition: edit.c:74
#define es
Definition: i386-dis.c:431

Referenced by EDIT_WM_Char(), and EDIT_WM_KeyDown().

◆ EDIT_LockBuffer()

static void EDIT_LockBuffer ( EDITSTATE es)
static

Definition at line 1203 of file edit.c.

1204 {
1205  if (!es->text)
1206  {
1207  if (!es->hloc32W)
1208  return;
1209 
1210  es->text = LocalLock(es->hloc32W);
1211  }
1212 
1213  es->lock_count++;
1214 }
LPVOID NTAPI LocalLock(HLOCAL hMem)
Definition: heapmem.c:1599
#define es
Definition: i386-dis.c:431

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

◆ EDIT_MakeFit()

static BOOL EDIT_MakeFit ( EDITSTATE es,
UINT  size 
)
static

Definition at line 1268 of file edit.c.

1269 {
1270  HLOCAL hNew32W;
1271 
1273  return TRUE;
1274 
1275  TRACE("trying to ReAlloc to %d+1 characters\n", size);
1276 
1277  /* Force edit to unlock its buffer. es->text now NULL */
1279 
1280  if (es->hloc32W) {
1281  UINT alloc_size = ROUND_TO_GROW((size + 1) * sizeof(WCHAR));
1282  if ((hNew32W = LocalReAlloc(es->hloc32W, alloc_size, LMEM_MOVEABLE | LMEM_ZEROINIT))) {
1283  TRACE("Old 32 bit handle %p, new handle %p\n", es->hloc32W, hNew32W);
1284  es->hloc32W = hNew32W;
1285  es->buffer_size = LocalSize(hNew32W)/sizeof(WCHAR) - 1;
1286  }
1287  }
1288 
1290 
1291  if (es->buffer_size < size) {
1292  WARN("FAILED ! We now have %d+1\n", es->buffer_size);
1294  return FALSE;
1295  } else {
1296  TRACE("We now have %d+1\n", es->buffer_size);
1297  return TRUE;
1298  }
1299 }
#define TRUE
Definition: types.h:120
#define ROUND_TO_GROW(size)
Definition: edit.c:60
#define WARN(fmt,...)
Definition: debug.h:111
#define EDIT_NOTIFY_PARENT(es, wNotifyCode)
Definition: edit.c:161
SIZE_T NTAPI LocalSize(HLOCAL hMem)
Definition: heapmem.c:1777
static void EDIT_LockBuffer(EDITSTATE *es)
Definition: edit.c:1203
static void EDIT_UnlockBuffer(EDITSTATE *es, BOOL force)
Definition: edit.c:1222
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
Definition: swimpl.c:927
#define EN_ERRSPACE
Definition: winuser.h:2005
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define LMEM_ZEROINIT
Definition: winbase.h:356
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define LMEM_MOVEABLE
Definition: winbase.h:350
HLOCAL NTAPI LocalReAlloc(HLOCAL hMem, SIZE_T dwBytes, UINT uFlags)
Definition: heapmem.c:1608
unsigned int UINT
Definition: ndis.h:50
#define es
Definition: i386-dis.c:431

Referenced by EDIT_EM_ReplaceSel().

◆ EDIT_MakeUndoFit()

static BOOL EDIT_MakeUndoFit ( EDITSTATE es,
UINT  size 
)
static

Definition at line 1309 of file edit.c.

1310 {
1311  UINT alloc_size;
1312 
1313  if (size <= es->undo_buffer_size)
1314  return TRUE;
1315 
1316  TRACE("trying to ReAlloc to %d+1\n", size);
1317 
1318  alloc_size = ROUND_TO_GROW((size + 1) * sizeof(WCHAR));
1319  if ((es->undo_text = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, es->undo_text, alloc_size))) {
1320  es->undo_buffer_size = alloc_size/sizeof(WCHAR) - 1;
1321  return TRUE;
1322  }
1323  else
1324  {
1325  WARN("FAILED ! We now have %d+1\n", es->undo_buffer_size);
1326  return FALSE;
1327  }
1328 }
#define TRUE
Definition: types.h:120
#define ROUND_TO_GROW(size)
Definition: edit.c:60
#define WARN(fmt,...)
Definition: debug.h:111
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define HeapReAlloc
Definition: compat.h:393
unsigned int UINT
Definition: ndis.h:50
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define es
Definition: i386-dis.c:431

Referenced by EDIT_EM_ReplaceSel().

◆ EDIT_ML_InvalidateText()

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

Definition at line 1386 of file edit.c.

1387 {
1390  INT el = EDIT_EM_LineFromChar(es, end);
1391  INT sc;
1392  INT ec;
1393  RECT rc1;
1394  RECT rcWnd;
1395  RECT rcLine;
1396  RECT rcUpdate;
1397  INT l;
1398 
1399  if ((el < es->y_offset) || (sl > es->y_offset + vlc))
1400  return;
1401 
1402  sc = start - EDIT_EM_LineIndex(es, sl);
1403  ec = end - EDIT_EM_LineIndex(es, el);
1404  if (sl < es->y_offset) {
1405  sl = es->y_offset;
1406  sc = 0;
1407  }
1408  if (el > es->y_offset + vlc) {
1409  el = es->y_offset + vlc;
1411  }
1412  GetClientRect(es->hwndSelf, &rc1);
1413  IntersectRect(&rcWnd, &rc1, &es->format_rect);
1414  if (sl == el) {
1415  EDIT_GetLineRect(es, sl, sc, ec, &rcLine);
1416  if (IntersectRect(&rcUpdate, &rcWnd, &rcLine))
1417  EDIT_UpdateText(es, &rcUpdate, TRUE);
1418  } else {
1419  EDIT_GetLineRect(es, sl, sc,
1421  EDIT_EM_LineIndex(es, sl)),
1422  &rcLine);
1423  if (IntersectRect(&rcUpdate, &rcWnd, &rcLine))
1424  EDIT_UpdateText(es, &rcUpdate, TRUE);
1425  for (l = sl + 1 ; l < el ; l++) {
1426  EDIT_GetLineRect(es, l, 0,
1428  EDIT_EM_LineIndex(es, l)),
1429  &rcLine);
1430  if (IntersectRect(&rcUpdate, &rcWnd, &rcLine))
1431  EDIT_UpdateText(es, &rcUpdate, TRUE);
1432  }
1433  EDIT_GetLineRect(es, el, 0, ec, &rcLine);
1434  if (IntersectRect(&rcUpdate, &rcWnd, &rcLine))
1435  EDIT_UpdateText(es, &rcUpdate, TRUE);
1436  }
1437 }
static void EDIT_UpdateText(EDITSTATE *es, const RECT *rc, BOOL bErase)
Definition: edit.c:1351
static INT EDIT_EM_LineFromChar(EDITSTATE *es, INT index)
Definition: edit.c:909
#define TRUE
Definition: types.h:120
static INT get_vertical_line_count(EDITSTATE *es)
Definition: edit.c:410
GLuint GLuint end
Definition: gl.h:1545
int32_t INT
Definition: typedefs.h:56
static INT EDIT_EM_LineIndex(const EDITSTATE *es, INT line)
Definition: edit.c:938
static INT EDIT_EM_LineLength(EDITSTATE *es, INT index)
Definition: edit.c:973
r l[0]
Definition: byte_order.h:167
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
GLuint start
Definition: gl.h:1545
static void EDIT_GetLineRect(EDITSTATE *es, INT line, INT scol, INT ecol, LPRECT rc)
Definition: edit.c:1139
#define es
Definition: i386-dis.c:431

Referenced by EDIT_InvalidateText().

◆ EDIT_MoveBackward()

static void EDIT_MoveBackward ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 1799 of file edit.c.

1800 {
1801  INT e = es->selection_end;
1802 
1803  if (e) {
1804  e--;
1805  if ((es->style & ES_MULTILINE) && e &&
1806  (es->text[e - 1] == '\r') && (es->text[e] == '\n')) {
1807  e--;
1808  if (e && (es->text[e - 1] == '\r'))
1809  e--;
1810  }
1811  }
1812  EDIT_EM_SetSel(es, extend ? es->selection_start : e, e, FALSE);
1814 }
static BOOL EDIT_EM_SetSel(EDITSTATE *es, UINT start, UINT end, BOOL after_wrap)
Definition: edit.c:1481
#define ES_MULTILINE
Definition: pedump.c:667
static void EDIT_EM_ScrollCaret(EDITSTATE *es)
Definition: edit.c:1729
int32_t INT
Definition: typedefs.h:56
#define e
Definition: ke_i.h:82
#define es
Definition: i386-dis.c:431

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 1826 of file edit.c.

1827 {
1828  INT s = es->selection_start;
1829  INT e = es->selection_end;
1830  BOOL after_wrap = (es->flags & EF_AFTER_WRAP);
1831  LRESULT pos = EDIT_EM_PosFromChar(es, e, after_wrap);
1832  INT x = (short)LOWORD(pos);
1833  INT y = (short)HIWORD(pos);
1834 
1835  e = EDIT_CharFromPos(es, x, y + es->line_height, &after_wrap);
1836  if (!extend)
1837  s = e;
1838  EDIT_EM_SetSel(es, s, e, after_wrap);
1840 }
static BOOL EDIT_EM_SetSel(EDITSTATE *es, UINT start, UINT end, BOOL after_wrap)
Definition: edit.c:1481
static void EDIT_EM_ScrollCaret(EDITSTATE *es)
Definition: edit.c:1729
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int32_t INT
Definition: typedefs.h:56
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EF_AFTER_WRAP
Definition: edit.c:71
#define e
Definition: ke_i.h:82
static LRESULT EDIT_EM_PosFromChar(EDITSTATE *es, INT index, BOOL after_wrap)
Definition: edit.c:1009
GLdouble s
Definition: gl.h:2039
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static INT EDIT_CharFromPos(EDITSTATE *es, INT x, INT y, LPBOOL after_wrap)
Definition: edit.c:780
#define HIWORD(l)
Definition: typedefs.h:246
LONG_PTR LRESULT
Definition: windef.h:209
#define es
Definition: i386-dis.c:431
#define LOWORD(l)
Definition: pedump.c:82

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 1848 of file edit.c.

1849 {
1850  BOOL after_wrap = FALSE;
1851  INT e;
1852 
1853  /* Pass a high value in x to make sure of receiving the end of the line */
1854  if (!ctrl && (es->style & ES_MULTILINE))
1855  e = EDIT_CharFromPos(es, 0x3fffffff,
1856  HIWORD(EDIT_EM_PosFromChar(es, es->selection_end, es->flags & EF_AFTER_WRAP)), &after_wrap);
1857  else
1858  e = get_text_length(es);
1859  EDIT_EM_SetSel(es, extend ? es->selection_start : e, e, after_wrap);
1861 }
static BOOL EDIT_EM_SetSel(EDITSTATE *es, UINT start, UINT end, BOOL after_wrap)
Definition: edit.c:1481
#define ES_MULTILINE
Definition: pedump.c:667
static void EDIT_EM_ScrollCaret(EDITSTATE *es)
Definition: edit.c:1729
static UINT get_text_length(EDITSTATE *es)
Definition: edit.c:212
int32_t INT
Definition: typedefs.h:56
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EF_AFTER_WRAP
Definition: edit.c:71
#define e
Definition: ke_i.h:82
static LRESULT EDIT_EM_PosFromChar(EDITSTATE *es, INT index, BOOL after_wrap)
Definition: edit.c:1009
#define ctrl
Definition: input.c:1669
static INT EDIT_CharFromPos(EDITSTATE *es, INT x, INT y, LPBOOL after_wrap)
Definition: edit.c:780
#define HIWORD(l)
Definition: typedefs.h:246
#define es
Definition: i386-dis.c:431

Referenced by EDIT_WM_KeyDown().

◆ EDIT_MoveForward()

static void EDIT_MoveForward ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 1869 of file edit.c.

1870 {
1871  INT e = es->selection_end;
1872 
1873  if (es->text[e]) {
1874  e++;
1875  if ((es->style & ES_MULTILINE) && (es->text[e - 1] == '\r')) {
1876  if (es->text[e] == '\n')
1877  e++;
1878  else if ((es->text[e] == '\r') && (es->text[e + 1] == '\n'))
1879  e += 2;
1880  }
1881  }
1882  EDIT_EM_SetSel(es, extend ? es->selection_start : e, e, FALSE);
1884 }
static BOOL EDIT_EM_SetSel(EDITSTATE *es, UINT start, UINT end, BOOL after_wrap)
Definition: edit.c:1481
#define ES_MULTILINE
Definition: pedump.c:667
static void EDIT_EM_ScrollCaret(EDITSTATE *es)
Definition: edit.c:1729
int32_t INT
Definition: typedefs.h:56
#define e
Definition: ke_i.h:82
#define es
Definition: i386-dis.c:431

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 1894 of file edit.c.

1895 {
1896  INT e;
1897 
1898  /* Pass the x_offset in x to make sure of receiving the first position of the line */
1899  if (!ctrl && (es->style & ES_MULTILINE))
1900  e = EDIT_CharFromPos(es, -es->x_offset,
1901  HIWORD(EDIT_EM_PosFromChar(es, es->selection_end, es->flags & EF_AFTER_WRAP)), NULL);
1902  else
1903  e = 0;
1904  EDIT_EM_SetSel(es, extend ? es->selection_start : e, e, FALSE);
1906 }
static BOOL EDIT_EM_SetSel(EDITSTATE *es, UINT start, UINT end, BOOL after_wrap)
Definition: edit.c:1481
#define ES_MULTILINE
Definition: pedump.c:667
static void EDIT_EM_ScrollCaret(EDITSTATE *es)
Definition: edit.c:1729
int32_t INT
Definition: typedefs.h:56
#define EF_AFTER_WRAP
Definition: edit.c:71
#define e
Definition: ke_i.h:82
smooth NULL
Definition: ftsmooth.c:416
static LRESULT EDIT_EM_PosFromChar(EDITSTATE *es, INT index, BOOL after_wrap)
Definition: edit.c:1009
#define ctrl
Definition: input.c:1669
static INT EDIT_CharFromPos(EDITSTATE *es, INT x, INT y, LPBOOL after_wrap)
Definition: edit.c:780
#define HIWORD(l)
Definition: typedefs.h:246
#define es
Definition: i386-dis.c:431

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 1918 of file edit.c.

1919 {
1920  INT s = es->selection_start;
1921  INT e = es->selection_end;
1922  BOOL after_wrap = (es->flags & EF_AFTER_WRAP);
1923  LRESULT pos = EDIT_EM_PosFromChar(es, e, after_wrap);
1924  INT x = (short)LOWORD(pos);
1925  INT y = (short)HIWORD(pos);
1926 
1927  e = EDIT_CharFromPos(es, x,
1928  y + (es->format_rect.bottom - es->format_rect.top),
1929  &after_wrap);
1930  if (!extend)
1931  s = e;
1932  EDIT_EM_SetSel(es, s, e, after_wrap);
1934 }
static BOOL EDIT_EM_SetSel(EDITSTATE *es, UINT start, UINT end, BOOL after_wrap)
Definition: edit.c:1481
static void EDIT_EM_ScrollCaret(EDITSTATE *es)
Definition: edit.c:1729
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int32_t INT
Definition: typedefs.h:56
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EF_AFTER_WRAP
Definition: edit.c:71
#define e
Definition: ke_i.h:82
static LRESULT EDIT_EM_PosFromChar(EDITSTATE *es, INT index, BOOL after_wrap)
Definition: edit.c:1009
GLdouble s
Definition: gl.h:2039
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static INT EDIT_CharFromPos(EDITSTATE *es, INT x, INT y, LPBOOL after_wrap)
Definition: edit.c:780
#define HIWORD(l)
Definition: typedefs.h:246
LONG_PTR LRESULT
Definition: windef.h:209
#define es
Definition: i386-dis.c:431
#define LOWORD(l)
Definition: pedump.c:82

Referenced by EDIT_WM_KeyDown().

◆ EDIT_MovePageUp_ML()

static void EDIT_MovePageUp_ML ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 1946 of file edit.c.

1947 {
1948  INT s = es->selection_start;
1949  INT e = es->selection_end;
1950  BOOL after_wrap = (es->flags & EF_AFTER_WRAP);
1951  LRESULT pos = EDIT_EM_PosFromChar(es, e, after_wrap);
1952  INT x = (short)LOWORD(pos);
1953  INT y = (short)HIWORD(pos);
1954 
1955  e = EDIT_CharFromPos(es, x,
1956  y - (es->format_rect.bottom - es->format_rect.top),
1957  &after_wrap);
1958  if (!extend)
1959  s = e;
1960  EDIT_EM_SetSel(es, s, e, after_wrap);
1962 }
static BOOL EDIT_EM_SetSel(EDITSTATE *es, UINT start, UINT end, BOOL after_wrap)
Definition: edit.c:1481
static void EDIT_EM_ScrollCaret(EDITSTATE *es)
Definition: edit.c:1729
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int32_t INT
Definition: typedefs.h:56
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EF_AFTER_WRAP
Definition: edit.c:71
#define e
Definition: ke_i.h:82
static LRESULT EDIT_EM_PosFromChar(EDITSTATE *es, INT index, BOOL after_wrap)
Definition: edit.c:1009
GLdouble s
Definition: gl.h:2039
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static INT EDIT_CharFromPos(EDITSTATE *es, INT x, INT y, LPBOOL after_wrap)
Definition: edit.c:780
#define HIWORD(l)
Definition: typedefs.h:246
LONG_PTR LRESULT
Definition: windef.h:209
#define es
Definition: i386-dis.c:431
#define LOWORD(l)
Definition: pedump.c:82

Referenced by EDIT_WM_KeyDown().

◆ EDIT_MoveUp_ML()

static void EDIT_MoveUp_ML ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 1974 of file edit.c.

1975 {
1976  INT s = es->selection_start;
1977  INT e = es->selection_end;
1978  BOOL after_wrap = (es->flags & EF_AFTER_WRAP);
1979  LRESULT pos = EDIT_EM_PosFromChar(es, e, after_wrap);
1980  INT x = (short)LOWORD(pos);
1981  INT y = (short)HIWORD(pos);
1982 
1983  e = EDIT_CharFromPos(es, x, y - es->line_height, &after_wrap);
1984  if (!extend)
1985  s = e;
1986  EDIT_EM_SetSel(es, s, e, after_wrap);
1988 }
static BOOL EDIT_EM_SetSel(EDITSTATE *es, UINT start, UINT end, BOOL after_wrap)
Definition: edit.c:1481
static void EDIT_EM_ScrollCaret(EDITSTATE *es)
Definition: edit.c:1729
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int32_t INT
Definition: typedefs.h:56
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EF_AFTER_WRAP
Definition: edit.c:71
#define e
Definition: ke_i.h:82
static LRESULT EDIT_EM_PosFromChar(EDITSTATE *es, INT index, BOOL after_wrap)
Definition: edit.c:1009
GLdouble s
Definition: gl.h:2039
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static INT EDIT_CharFromPos(EDITSTATE *es, INT x, INT y, LPBOOL after_wrap)
Definition: edit.c:780
#define HIWORD(l)
Definition: typedefs.h:246
LONG_PTR LRESULT
Definition: windef.h:209
#define es
Definition: i386-dis.c:431
#define LOWORD(l)
Definition: pedump.c:82

Referenced by EDIT_WM_KeyDown().

◆ EDIT_MoveWordBackward()

static void EDIT_MoveWordBackward ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 1996 of file edit.c.

1997 {
1998  INT s = es->selection_start;
1999  INT e = es->selection_end;
2000  INT l;
2001  INT ll;
2002  INT li;
2003 
2004  l = EDIT_EM_LineFromChar(es, e);
2005  ll = EDIT_EM_LineLength(es, e);
2006  li = EDIT_EM_LineIndex(es, l);
2007  if (e - li == 0) {
2008  if (l) {
2009  li = EDIT_EM_LineIndex(es, l - 1);
2010  e = li + EDIT_EM_LineLength(es, li);
2011  }
2012  } else {
2013  e = li + EDIT_CallWordBreakProc(es, li, e - li, ll, WB_LEFT);
2014  }
2015  if (!extend)
2016  s = e;
2017  EDIT_EM_SetSel(es, s, e, FALSE);
2019 }
static INT EDIT_EM_LineFromChar(EDITSTATE *es, INT index)
Definition: edit.c:909
static BOOL EDIT_EM_SetSel(EDITSTATE *es, UINT start, UINT end, BOOL after_wrap)
Definition: edit.c:1481
static void EDIT_EM_ScrollCaret(EDITSTATE *es)
Definition: edit.c:1729
int32_t INT
Definition: typedefs.h:56
#define WB_LEFT
Definition: winuser.h:550
static INT EDIT_CallWordBreakProc(EDITSTATE *es, INT start, INT index, INT count, INT action)
Definition: edit.c:290
static INT EDIT_EM_LineIndex(const EDITSTATE *es, INT line)
Definition: edit.c:938
#define e
Definition: ke_i.h:82
static INT EDIT_EM_LineLength(EDITSTATE *es, INT index)
Definition: edit.c:973
r l[0]
Definition: byte_order.h:167
GLdouble s
Definition: gl.h:2039
w ll
Definition: byte_order.h:166
#define es
Definition: i386-dis.c:431

Referenced by EDIT_WM_KeyDown().

◆ EDIT_MoveWordForward()

static void EDIT_MoveWordForward ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 2027 of file edit.c.

2028 {
2029  INT s = es->selection_start;
2030  INT e = es->selection_end;
2031  INT l;
2032  INT ll;
2033  INT li;
2034 
2035  l = EDIT_EM_LineFromChar(es, e);
2036  ll = EDIT_EM_LineLength(es, e);
2037  li = EDIT_EM_LineIndex(es, l);
2038  if (e - li == ll) {
2039  if ((es->style & ES_MULTILINE) && (l != es->line_count - 1))
2040  e = EDIT_EM_LineIndex(es, l + 1);
2041  } else {
2042  e = li + EDIT_CallWordBreakProc(es,
2043  li, e - li + 1, ll, WB_RIGHT);
2044  }
2045  if (!extend)
2046  s = e;
2047  EDIT_EM_SetSel(es, s, e, FALSE);
2049 }
#define WB_RIGHT
Definition: winuser.h:551
static INT EDIT_EM_LineFromChar(EDITSTATE *es, INT index)
Definition: edit.c:909
static BOOL EDIT_EM_SetSel(EDITSTATE *es, UINT start, UINT end, BOOL after_wrap)
Definition: edit.c:1481
#define ES_MULTILINE
Definition: pedump.c:667
static void EDIT_EM_ScrollCaret(EDITSTATE *es)
Definition: edit.c:1729
int32_t INT
Definition: typedefs.h:56
static INT EDIT_CallWordBreakProc(EDITSTATE *es, INT start, INT index, INT count, INT action)
Definition: edit.c:290
static INT EDIT_EM_LineIndex(const EDITSTATE *es, INT line)
Definition: edit.c:938
#define e
Definition: ke_i.h:82
static INT EDIT_EM_LineLength(EDITSTATE *es, INT index)
Definition: edit.c:973
r l[0]
Definition: byte_order.h:167
GLdouble s
Definition: gl.h:2039
w ll
Definition: byte_order.h:166
#define es
Definition: i386-dis.c:431

Referenced by EDIT_WM_KeyDown().

◆ EDIT_NotifyCtlColor()

static HBRUSH EDIT_NotifyCtlColor ( EDITSTATE es,
HDC  hdc 
)
static

Definition at line 194 of file edit.c.

195 {
196  HBRUSH hbrush;
197  UINT msg;
198 
199  if ((!es->bEnableState || (es->style & ES_READONLY)))
201  else
203 
204  /* Why do we notify to es->hwndParent, and we send this one to GetParent()? */
205  hbrush = (HBRUSH)SendMessageW(GetParent(es->hwndSelf), msg, (WPARAM)hdc, (LPARAM)es->hwndSelf);
206  if (!hbrush)
207