Commit 700f5abe authored by Daniel Walker's avatar Daniel Walker Committed by Alexandre Julliard

- Added debugging.

- Transfer all relevant messages to the underlying edit control.
parent 4a29e1f1
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
#include "charlist.h" #include "charlist.h"
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(richedit);
extern HANDLE RICHED32_hHeap; extern HANDLE RICHED32_hHeap;
...@@ -23,6 +26,8 @@ void CHARLIST_Enqueue( CHARLIST* pCharList, char myChar ) ...@@ -23,6 +26,8 @@ void CHARLIST_Enqueue( CHARLIST* pCharList, char myChar )
CHARLISTENTRY* pNewEntry = HeapAlloc(RICHED32_hHeap, 0,sizeof(CHARLISTENTRY)); CHARLISTENTRY* pNewEntry = HeapAlloc(RICHED32_hHeap, 0,sizeof(CHARLISTENTRY));
pNewEntry->pNext = NULL; pNewEntry->pNext = NULL;
pNewEntry->myChar = myChar; pNewEntry->myChar = myChar;
TRACE("\n");
if(pCharList->pTail == NULL) if(pCharList->pTail == NULL)
{ {
...@@ -41,6 +46,8 @@ void CHARLIST_Push( CHARLIST* pCharList, char myChar) ...@@ -41,6 +46,8 @@ void CHARLIST_Push( CHARLIST* pCharList, char myChar)
{ {
CHARLISTENTRY* pNewEntry = malloc(sizeof(CHARLISTENTRY)); CHARLISTENTRY* pNewEntry = malloc(sizeof(CHARLISTENTRY));
TRACE("\n");
pNewEntry->myChar = myChar; pNewEntry->myChar = myChar;
if(pCharList->pHead == NULL) if(pCharList->pHead == NULL)
...@@ -63,6 +70,8 @@ char CHARLIST_Dequeue(CHARLIST* pCharList) ...@@ -63,6 +70,8 @@ char CHARLIST_Dequeue(CHARLIST* pCharList)
CHARLISTENTRY* pCurrent; CHARLISTENTRY* pCurrent;
char myChar; char myChar;
TRACE("\n");
if(pCharList->nCount == 0) if(pCharList->nCount == 0)
return 0; return 0;
...@@ -85,10 +94,14 @@ char CHARLIST_Dequeue(CHARLIST* pCharList) ...@@ -85,10 +94,14 @@ char CHARLIST_Dequeue(CHARLIST* pCharList)
int CHARLIST_GetNbItems(CHARLIST* pCharList) int CHARLIST_GetNbItems(CHARLIST* pCharList)
{ {
TRACE("\n");
return pCharList->nCount; return pCharList->nCount;
} }
void CHARLIST_FreeList(CHARLIST* pCharList){ void CHARLIST_FreeList(CHARLIST* pCharList){
TRACE("\n");
while(pCharList->nCount) while(pCharList->nCount)
CHARLIST_Dequeue(pCharList); CHARLIST_Dequeue(pCharList);
} }
...@@ -98,6 +111,8 @@ int CHARLIST_CountChar(CHARLIST* pCharList, char myChar) ...@@ -98,6 +111,8 @@ int CHARLIST_CountChar(CHARLIST* pCharList, char myChar)
{ {
CHARLISTENTRY *pCurrent; CHARLISTENTRY *pCurrent;
int nCount = 0; int nCount = 0;
TRACE("\n");
for(pCurrent =pCharList->pHead ;pCurrent;pCurrent=pCurrent->pNext) for(pCurrent =pCharList->pHead ;pCurrent;pCurrent=pCurrent->pNext)
if(pCurrent->myChar == myChar) if(pCurrent->myChar == myChar)
...@@ -109,6 +124,8 @@ int CHARLIST_CountChar(CHARLIST* pCharList, char myChar) ...@@ -109,6 +124,8 @@ int CHARLIST_CountChar(CHARLIST* pCharList, char myChar)
int CHARLIST_toBuffer(CHARLIST* pCharList, char* pBuffer, int nBufferSize) int CHARLIST_toBuffer(CHARLIST* pCharList, char* pBuffer, int nBufferSize)
{ {
TRACE("\n");
/* we add one to store a NULL caracter */ /* we add one to store a NULL caracter */
if(nBufferSize < pCharList->nCount + 1) if(nBufferSize < pCharList->nCount + 1)
return pCharList->nCount; return pCharList->nCount;
......
...@@ -78,6 +78,8 @@ ...@@ -78,6 +78,8 @@
#include "winbase.h" #include "winbase.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(richedit);
extern HANDLE RICHED32_hHeap; extern HANDLE RICHED32_hHeap;
/* /*
...@@ -211,6 +213,9 @@ int ...@@ -211,6 +213,9 @@ int
_RTFGetChar() _RTFGetChar()
{ {
char myChar; char myChar;
TRACE("\n");
if(CHARLIST_GetNbItems(&inputCharList) == 0) if(CHARLIST_GetNbItems(&inputCharList) == 0)
{ {
char buff[10]; char buff[10];
...@@ -228,6 +233,8 @@ _RTFGetChar() ...@@ -228,6 +233,8 @@ _RTFGetChar()
void void
RTFSetEditStream(EDITSTREAM *es) RTFSetEditStream(EDITSTREAM *es)
{ {
TRACE("\n");
editstream.dwCookie = es->dwCookie; editstream.dwCookie = es->dwCookie;
editstream.dwError = es->dwError; editstream.dwError = es->dwError;
editstream.pfnCallback = es->pfnCallback; editstream.pfnCallback = es->pfnCallback;
...@@ -248,6 +255,8 @@ RTFFont *fp; ...@@ -248,6 +255,8 @@ RTFFont *fp;
RTFStyle *sp; RTFStyle *sp;
RTFStyleElt *eltList, *ep; RTFStyleElt *eltList, *ep;
TRACE("\n");
if (rtfTextBuf == (char *) NULL) /* initialize the text buffers */ if (rtfTextBuf == (char *) NULL) /* initialize the text buffers */
{ {
rtfTextBuf = RTFAlloc (rtfBufSiz); rtfTextBuf = RTFAlloc (rtfBufSiz);
...@@ -334,6 +343,8 @@ void ...@@ -334,6 +343,8 @@ void
RTFSetInputName (name) RTFSetInputName (name)
char *name; char *name;
{ {
TRACE("\n");
if ((inputName = RTFStrSave (name)) == (char *) NULL) if ((inputName = RTFStrSave (name)) == (char *) NULL)
RTFPanic ("RTFSetInputName: out of memory"); RTFPanic ("RTFSetInputName: out of memory");
} }
...@@ -350,6 +361,8 @@ void ...@@ -350,6 +361,8 @@ void
RTFSetOutputName (name) RTFSetOutputName (name)
char *name; char *name;
{ {
TRACE("\n");
if ((outputName = RTFStrSave (name)) == (char *) NULL) if ((outputName = RTFStrSave (name)) == (char *) NULL)
RTFPanic ("RTFSetOutputName: out of memory"); RTFPanic ("RTFSetOutputName: out of memory");
} }
...@@ -456,6 +469,8 @@ RTFRouteToken () ...@@ -456,6 +469,8 @@ RTFRouteToken ()
{ {
RTFFuncPtr p; RTFFuncPtr p;
TRACE("\n");
if (rtfClass < 0 || rtfClass >= rtfMaxClass) /* watchdog */ if (rtfClass < 0 || rtfClass >= rtfMaxClass) /* watchdog */
{ {
RTFPanic ("Unknown class %d: %s (reader malfunction)", RTFPanic ("Unknown class %d: %s (reader malfunction)",
...@@ -488,6 +503,7 @@ void ...@@ -488,6 +503,7 @@ void
RTFSkipGroup () RTFSkipGroup ()
{ {
int level = 1; int level = 1;
TRACE("\n");
while (RTFGetToken () != rtfEOF) while (RTFGetToken () != rtfEOF)
{ {
...@@ -515,6 +531,7 @@ int ...@@ -515,6 +531,7 @@ int
RTFGetToken () RTFGetToken ()
{ {
RTFFuncPtr p; RTFFuncPtr p;
TRACE("\n");
for (;;) for (;;)
{ {
...@@ -557,6 +574,8 @@ RTFGetReadHook () ...@@ -557,6 +574,8 @@ RTFGetReadHook ()
void void
RTFUngetToken () RTFUngetToken ()
{ {
TRACE("\n");
if (pushedClass >= 0) /* there's already an ungotten token */ if (pushedClass >= 0) /* there's already an ungotten token */
RTFPanic ("cannot unget two tokens"); RTFPanic ("cannot unget two tokens");
if (rtfClass < 0) if (rtfClass < 0)
...@@ -583,6 +602,8 @@ _RTFGetToken () ...@@ -583,6 +602,8 @@ _RTFGetToken ()
{ {
RTFFont *fp; RTFFont *fp;
TRACE("\n");
/* first check for pushed token from RTFUngetToken() */ /* first check for pushed token from RTFUngetToken() */
if (pushedClass >= 0) if (pushedClass >= 0)
...@@ -659,6 +680,8 @@ _RTFGetToken2 () ...@@ -659,6 +680,8 @@ _RTFGetToken2 ()
int sign; int sign;
int c; int c;
TRACE("\n");
/* initialize token vars */ /* initialize token vars */
rtfClass = rtfUnknown; rtfClass = rtfUnknown;
...@@ -830,6 +853,8 @@ GetChar () ...@@ -830,6 +853,8 @@ GetChar ()
int c; int c;
int oldBumpLine; int oldBumpLine;
TRACE("\n");
if ((c = _RTFGetChar()) != EOF) if ((c = _RTFGetChar()) != EOF)
{ {
rtfTextBuf[rtfTextLen++] = c; rtfTextBuf[rtfTextLen++] = c;
...@@ -872,6 +897,8 @@ RTFSetToken (class, major, minor, param, text) ...@@ -872,6 +897,8 @@ RTFSetToken (class, major, minor, param, text)
int class, major, minor, param; int class, major, minor, param;
char *text; char *text;
{ {
TRACE("\n");
rtfClass = class; rtfClass = class;
rtfMajor = major; rtfMajor = major;
rtfMinor = minor; rtfMinor = minor;
...@@ -907,6 +934,8 @@ char *text; ...@@ -907,6 +934,8 @@ char *text;
static void static void
CharSetInit () CharSetInit ()
{ {
TRACE("\n");
autoCharSetFlags = (rtfReadCharSet | rtfSwitchCharSet); autoCharSetFlags = (rtfReadCharSet | rtfSwitchCharSet);
RTFFree (genCharSetFile); RTFFree (genCharSetFile);
genCharSetFile = (char *) NULL; genCharSetFile = (char *) NULL;
...@@ -929,6 +958,8 @@ RTFSetCharSetMap (name, csId) ...@@ -929,6 +958,8 @@ RTFSetCharSetMap (name, csId)
char *name; char *name;
int csId; int csId;
{ {
TRACE("\n");
if ((name = RTFStrSave (name)) == (char *) NULL) /* make copy */ if ((name = RTFStrSave (name)) == (char *) NULL) /* make copy */
RTFPanic ("RTFSetCharSetMap: out of memory"); RTFPanic ("RTFSetCharSetMap: out of memory");
switch (csId) switch (csId)
...@@ -959,6 +990,8 @@ ReadCharSetMaps () ...@@ -959,6 +990,8 @@ ReadCharSetMaps ()
{ {
char buf[rtfBufSiz]; char buf[rtfBufSiz];
TRACE("\n");
if (genCharSetFile != (char *) NULL) if (genCharSetFile != (char *) NULL)
(void) strcpy (buf, genCharSetFile); (void) strcpy (buf, genCharSetFile);
else else
...@@ -986,6 +1019,9 @@ int csId; ...@@ -986,6 +1019,9 @@ int csId;
{ {
int *stdCodeArray; int *stdCodeArray;
int i; int i;
TRACE("\n");
switch (csId) switch (csId)
{ {
default: default:
...@@ -1036,6 +1072,8 @@ char *name; ...@@ -1036,6 +1072,8 @@ char *name;
{ {
int i; int i;
TRACE("\n");
for (i = 0; i < rtfSC_MaxChar; i++) for (i = 0; i < rtfSC_MaxChar; i++)
{ {
if (strcmp (name, stdCharName[i]) == 0) if (strcmp (name, stdCharName[i]) == 0)
...@@ -1073,6 +1111,8 @@ int ...@@ -1073,6 +1111,8 @@ int
RTFMapChar (c) RTFMapChar (c)
int c; int c;
{ {
TRACE("\n");
switch (curCharSet) switch (curCharSet)
{ {
case rtfCSGeneral: case rtfCSGeneral:
...@@ -1104,6 +1144,8 @@ void ...@@ -1104,6 +1144,8 @@ void
RTFSetCharSet (csId) RTFSetCharSet (csId)
int csId; int csId;
{ {
TRACE("\n");
switch (csId) switch (csId)
{ {
default: /* use general if csId unknown */ default: /* use general if csId unknown */
...@@ -1162,6 +1204,8 @@ char buf[rtfBufSiz], *bp; ...@@ -1162,6 +1204,8 @@ char buf[rtfBufSiz], *bp;
int old = -1; int old = -1;
char *fn = "ReadFontTbl"; char *fn = "ReadFontTbl";
TRACE("\n");
for (;;) for (;;)
{ {
(void) RTFGetToken (); (void) RTFGetToken ();
...@@ -1312,6 +1356,8 @@ RTFColor *cp; ...@@ -1312,6 +1356,8 @@ RTFColor *cp;
int cnum = 0; int cnum = 0;
char *fn = "ReadColorTbl"; char *fn = "ReadColorTbl";
TRACE("\n");
for (;;) for (;;)
{ {
(void) RTFGetToken (); (void) RTFGetToken ();
...@@ -1353,6 +1399,8 @@ RTFStyleElt *sep, *sepLast; ...@@ -1353,6 +1399,8 @@ RTFStyleElt *sep, *sepLast;
char buf[rtfBufSiz], *bp; char buf[rtfBufSiz], *bp;
char *fn = "ReadStyleSheet"; char *fn = "ReadStyleSheet";
TRACE("\n");
for (;;) for (;;)
{ {
(void) RTFGetToken (); (void) RTFGetToken ();
...@@ -1592,6 +1640,8 @@ int n; ...@@ -1592,6 +1640,8 @@ int n;
RTFStyle *s; RTFStyle *s;
RTFStyleElt *se; RTFStyleElt *se;
TRACE("\n");
if (n == -1 || (s = RTFGetStyle (n)) == (RTFStyle *) NULL) if (n == -1 || (s = RTFGetStyle (n)) == (RTFStyle *) NULL)
return; return;
if (s->rtfExpanding != 0) if (s->rtfExpanding != 0)
...@@ -2575,6 +2625,7 @@ char *s; ...@@ -2575,6 +2625,7 @@ char *s;
RTFKey *rp; RTFKey *rp;
int hash; int hash;
TRACE("\n");
++s; /* skip over the leading \ character */ ++s; /* skip over the leading \ character */
hash = Hash (s); hash = Hash (s);
for (rp = rtfKey; rp->rtfKStr != (char *) NULL; rp++) for (rp = rtfKey; rp->rtfKStr != (char *) NULL; rp++)
......
...@@ -41,6 +41,9 @@ ...@@ -41,6 +41,9 @@
# include "rtf.h" # include "rtf.h"
# include "rtf2text.h" # include "rtf2text.h"
# include "charlist.h" # include "charlist.h"
# include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(richedit);
static void TextClass (); static void TextClass ();
static void ControlClass (); static void ControlClass ();
...@@ -61,7 +64,8 @@ int RTFToBuffer(char* pBuffer, int nBufferSize) ...@@ -61,7 +64,8 @@ int RTFToBuffer(char* pBuffer, int nBufferSize)
/* check if the buffer is big enough to hold all characters */ /* check if the buffer is big enough to hold all characters */
/* we require one more for the '\0' */ /* we require one more for the '\0' */
TRACE("\n");
if(nBufferSize < charlist.nCount + 1) { if(nBufferSize < charlist.nCount + 1) {
return charlist.nCount + CHARLIST_CountChar(&charlist, '\n') + 1; return charlist.nCount + CHARLIST_CountChar(&charlist, '\n') + 1;
} }
...@@ -119,6 +123,8 @@ TextClass () ...@@ -119,6 +123,8 @@ TextClass ()
{ {
char buf[rtfBufSiz]; char buf[rtfBufSiz];
TRACE("\n");
if (rtfMinor != rtfSC_nothing) if (rtfMinor != rtfSC_nothing)
PutStdChar (rtfMinor); PutStdChar (rtfMinor);
else else
...@@ -135,6 +141,7 @@ char buf[rtfBufSiz]; ...@@ -135,6 +141,7 @@ char buf[rtfBufSiz];
static void static void
ControlClass () ControlClass ()
{ {
TRACE("\n");
switch (rtfMajor) switch (rtfMajor)
{ {
case rtfDestination: case rtfDestination:
...@@ -156,6 +163,9 @@ ControlClass () ...@@ -156,6 +163,9 @@ ControlClass ()
static void static void
Destination () Destination ()
{ {
TRACE("\n");
switch (rtfMinor) switch (rtfMinor)
{ {
case rtfPict: case rtfPict:
...@@ -185,6 +195,9 @@ Destination () ...@@ -185,6 +195,9 @@ Destination ()
void SpecialChar () void SpecialChar ()
{ {
TRACE("\n");
switch (rtfMinor) switch (rtfMinor)
{ {
case rtfPage: case rtfPage:
...@@ -249,6 +262,8 @@ void PutStdChar (int stdCode) ...@@ -249,6 +262,8 @@ void PutStdChar (int stdCode)
/* if (stdCode == rtfSC_nothing) /* if (stdCode == rtfSC_nothing)
RTFPanic ("Unknown character code, logic error\n"); RTFPanic ("Unknown character code, logic error\n");
*/ */
TRACE("\n");
oStr = outMap[stdCode]; oStr = outMap[stdCode];
if (oStr == (char *) NULL) /* no output sequence in map */ if (oStr == (char *) NULL) /* no output sequence in map */
{ {
......
...@@ -57,6 +57,85 @@ static const WCHAR RICHEDIT_CLASS20W[] = { 'R','i','c','h','E','d','i','t','2',' ...@@ -57,6 +57,85 @@ static const WCHAR RICHEDIT_CLASS20W[] = { 'R','i','c','h','E','d','i','t','2','
#define EM_GETWORDBREAKPROCEX (WM_USER + 80) #define EM_GETWORDBREAKPROCEX (WM_USER + 80)
#define EM_SETWORDBREAKPROCEX (WM_USER + 81) #define EM_SETWORDBREAKPROCEX (WM_USER + 81)
#define EM_SETUNDOLIMIT (WM_USER + 82)
#define EM_REDO (WM_USER + 84)
#define EM_CANREDO (WM_USER + 85)
#define EM_GETUNDONAME (WM_USER + 86)
#define EM_GETREDONAME (WM_USER + 87)
#define EM_STOPGROUPTYPING (WM_USER + 88)
#define EM_SETTEXTMODE (WM_USER + 89)
#define EM_GETTEXTMODE (WM_USER + 90)
#define EM_AUTOURLDETECT (WM_USER + 91)
#define EM_GETAUTOURLDETECT (WM_USER + 92)
#define EM_SETPALETTE (WM_USER + 93)
#define EM_GETTEXTEX (WM_USER + 94)
#define EM_GETTEXTLENGTHEX (WM_USER + 95)
#define EM_SHOWSCROLLBAR (WM_USER + 96)
#define EM_SETTEXTEX (WM_USER + 97)
#define EM_SETPUNCTUATION (WM_USER + 100)
#define EM_GETPUNCTUATION (WM_USER + 101)
#define EM_SETWORDWRAPMODE (WM_USER + 102)
#define EM_GETWORDWRAPMODE (WM_USER + 103)
#define EM_SETIMECOLOR (WM_USER + 104)
#define EM_GETIMECOLOR (WM_USER + 105)
#define EM_SETIMEOPTIONS (WM_USER + 106)
#define EM_GETIMEOPTIONS (WM_USER + 107)
#define EM_CONVPOSITION (WM_USER + 108)
#define EM_SETLANGOPTIONS (WM_USER + 120)
#define EM_GETLANGOPTIONS (WM_USER + 121)
#define EM_GETIMECOMPMODE (WM_USER + 122)
#define EM_SETLANGOPTIONS (WM_USER + 120)
#define EM_GETLANGOPTIONS (WM_USER + 121)
#define EM_GETIMECOMPMODE (WM_USER + 122)
#define EM_FINDTEXTW (WM_USER + 123)
#define EM_FINDTEXTEXW (WM_USER + 124)
#define EM_RECONVERSION (WM_USER + 125)
#define EM_SETIMEMODEBIAS (WM_USER + 126)
#define EM_GETIMEMODEBIAS (WM_USER + 127)
#define EM_SETBIDIOPTIONS (WM_USER + 200)
#define EM_GETBIDIOPTIONS (WM_USER + 201)
#define EM_SETTYPOGRAPHYOPTIONS (WM_USER + 202)
#define EM_GETTYPOGRAPHYOPTIONS (WM_USER + 203)
#define EM_SETEDITSTYLE (WM_USER + 204)
#define EM_GETEDITSTYLE (WM_USER + 205)
#define EM_OUTLINE (WM_USER + 220)
#define EM_GETSCROLLPOS (WM_USER + 221)
#define EM_SETSCROLLPOS (WM_USER + 222)
#define EM_SETFONTSIZE (WM_USER + 223)
#define EM_GETZOOM (WM_USER + 224)
#define EM_SETZOOM (WM_USER + 225)
/* New notifications */
#define EN_MSGFILTER 0x0700
#define EN_REQUESTRESIZE 0x0701
#define EN_SELCHANGE 0x0702
#define EN_DROPFILES 0x0703
#define EN_PROTECTED 0x0704
#define EN_CORRECTTEXT 0x0705
#define EN_STOPNOUNDO 0x0706
#define EN_IMECHANGE 0x0707
#define EN_SAVECLIPBOARD 0x0708
#define EN_OLEOPFAILED 0x0709
#define EN_OBJECTPOSITIONS 0x070a
#define EN_LINK 0x070b
#define EN_DRAGDROPDONE 0x070c
#define EN_PARAGRAPHEXPANDED 0x070d
#define EN_ALIGNLTR 0x0710
#define EN_ALIGNRTL 0x0711
typedef DWORD CALLBACK(* EDITSTREAMCALLBACK)( DWORD, LPBYTE, LONG, LONG * ); typedef DWORD CALLBACK(* EDITSTREAMCALLBACK)( DWORD, LPBYTE, LONG, LONG * );
/* Rich edit control styles */ /* Rich edit control styles */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment