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 @@
#include "charlist.h"
#include "windef.h"
#include "winbase.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(richedit);
extern HANDLE RICHED32_hHeap;
......@@ -23,6 +26,8 @@ void CHARLIST_Enqueue( CHARLIST* pCharList, char myChar )
CHARLISTENTRY* pNewEntry = HeapAlloc(RICHED32_hHeap, 0,sizeof(CHARLISTENTRY));
pNewEntry->pNext = NULL;
pNewEntry->myChar = myChar;
TRACE("\n");
if(pCharList->pTail == NULL)
{
......@@ -41,6 +46,8 @@ void CHARLIST_Push( CHARLIST* pCharList, char myChar)
{
CHARLISTENTRY* pNewEntry = malloc(sizeof(CHARLISTENTRY));
TRACE("\n");
pNewEntry->myChar = myChar;
if(pCharList->pHead == NULL)
......@@ -63,6 +70,8 @@ char CHARLIST_Dequeue(CHARLIST* pCharList)
CHARLISTENTRY* pCurrent;
char myChar;
TRACE("\n");
if(pCharList->nCount == 0)
return 0;
......@@ -85,10 +94,14 @@ char CHARLIST_Dequeue(CHARLIST* pCharList)
int CHARLIST_GetNbItems(CHARLIST* pCharList)
{
TRACE("\n");
return pCharList->nCount;
}
void CHARLIST_FreeList(CHARLIST* pCharList){
TRACE("\n");
while(pCharList->nCount)
CHARLIST_Dequeue(pCharList);
}
......@@ -98,6 +111,8 @@ int CHARLIST_CountChar(CHARLIST* pCharList, char myChar)
{
CHARLISTENTRY *pCurrent;
int nCount = 0;
TRACE("\n");
for(pCurrent =pCharList->pHead ;pCurrent;pCurrent=pCurrent->pNext)
if(pCurrent->myChar == myChar)
......@@ -109,6 +124,8 @@ int CHARLIST_CountChar(CHARLIST* pCharList, char myChar)
int CHARLIST_toBuffer(CHARLIST* pCharList, char* pBuffer, int nBufferSize)
{
TRACE("\n");
/* we add one to store a NULL caracter */
if(nBufferSize < pCharList->nCount + 1)
return pCharList->nCount;
......
......@@ -78,6 +78,8 @@
#include "winbase.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(richedit);
extern HANDLE RICHED32_hHeap;
/*
......@@ -211,6 +213,9 @@ int
_RTFGetChar()
{
char myChar;
TRACE("\n");
if(CHARLIST_GetNbItems(&inputCharList) == 0)
{
char buff[10];
......@@ -228,6 +233,8 @@ _RTFGetChar()
void
RTFSetEditStream(EDITSTREAM *es)
{
TRACE("\n");
editstream.dwCookie = es->dwCookie;
editstream.dwError = es->dwError;
editstream.pfnCallback = es->pfnCallback;
......@@ -248,6 +255,8 @@ RTFFont *fp;
RTFStyle *sp;
RTFStyleElt *eltList, *ep;
TRACE("\n");
if (rtfTextBuf == (char *) NULL) /* initialize the text buffers */
{
rtfTextBuf = RTFAlloc (rtfBufSiz);
......@@ -334,6 +343,8 @@ void
RTFSetInputName (name)
char *name;
{
TRACE("\n");
if ((inputName = RTFStrSave (name)) == (char *) NULL)
RTFPanic ("RTFSetInputName: out of memory");
}
......@@ -350,6 +361,8 @@ void
RTFSetOutputName (name)
char *name;
{
TRACE("\n");
if ((outputName = RTFStrSave (name)) == (char *) NULL)
RTFPanic ("RTFSetOutputName: out of memory");
}
......@@ -456,6 +469,8 @@ RTFRouteToken ()
{
RTFFuncPtr p;
TRACE("\n");
if (rtfClass < 0 || rtfClass >= rtfMaxClass) /* watchdog */
{
RTFPanic ("Unknown class %d: %s (reader malfunction)",
......@@ -488,6 +503,7 @@ void
RTFSkipGroup ()
{
int level = 1;
TRACE("\n");
while (RTFGetToken () != rtfEOF)
{
......@@ -515,6 +531,7 @@ int
RTFGetToken ()
{
RTFFuncPtr p;
TRACE("\n");
for (;;)
{
......@@ -557,6 +574,8 @@ RTFGetReadHook ()
void
RTFUngetToken ()
{
TRACE("\n");
if (pushedClass >= 0) /* there's already an ungotten token */
RTFPanic ("cannot unget two tokens");
if (rtfClass < 0)
......@@ -583,6 +602,8 @@ _RTFGetToken ()
{
RTFFont *fp;
TRACE("\n");
/* first check for pushed token from RTFUngetToken() */
if (pushedClass >= 0)
......@@ -659,6 +680,8 @@ _RTFGetToken2 ()
int sign;
int c;
TRACE("\n");
/* initialize token vars */
rtfClass = rtfUnknown;
......@@ -830,6 +853,8 @@ GetChar ()
int c;
int oldBumpLine;
TRACE("\n");
if ((c = _RTFGetChar()) != EOF)
{
rtfTextBuf[rtfTextLen++] = c;
......@@ -872,6 +897,8 @@ RTFSetToken (class, major, minor, param, text)
int class, major, minor, param;
char *text;
{
TRACE("\n");
rtfClass = class;
rtfMajor = major;
rtfMinor = minor;
......@@ -907,6 +934,8 @@ char *text;
static void
CharSetInit ()
{
TRACE("\n");
autoCharSetFlags = (rtfReadCharSet | rtfSwitchCharSet);
RTFFree (genCharSetFile);
genCharSetFile = (char *) NULL;
......@@ -929,6 +958,8 @@ RTFSetCharSetMap (name, csId)
char *name;
int csId;
{
TRACE("\n");
if ((name = RTFStrSave (name)) == (char *) NULL) /* make copy */
RTFPanic ("RTFSetCharSetMap: out of memory");
switch (csId)
......@@ -959,6 +990,8 @@ ReadCharSetMaps ()
{
char buf[rtfBufSiz];
TRACE("\n");
if (genCharSetFile != (char *) NULL)
(void) strcpy (buf, genCharSetFile);
else
......@@ -986,6 +1019,9 @@ int csId;
{
int *stdCodeArray;
int i;
TRACE("\n");
switch (csId)
{
default:
......@@ -1036,6 +1072,8 @@ char *name;
{
int i;
TRACE("\n");
for (i = 0; i < rtfSC_MaxChar; i++)
{
if (strcmp (name, stdCharName[i]) == 0)
......@@ -1073,6 +1111,8 @@ int
RTFMapChar (c)
int c;
{
TRACE("\n");
switch (curCharSet)
{
case rtfCSGeneral:
......@@ -1104,6 +1144,8 @@ void
RTFSetCharSet (csId)
int csId;
{
TRACE("\n");
switch (csId)
{
default: /* use general if csId unknown */
......@@ -1162,6 +1204,8 @@ char buf[rtfBufSiz], *bp;
int old = -1;
char *fn = "ReadFontTbl";
TRACE("\n");
for (;;)
{
(void) RTFGetToken ();
......@@ -1312,6 +1356,8 @@ RTFColor *cp;
int cnum = 0;
char *fn = "ReadColorTbl";
TRACE("\n");
for (;;)
{
(void) RTFGetToken ();
......@@ -1353,6 +1399,8 @@ RTFStyleElt *sep, *sepLast;
char buf[rtfBufSiz], *bp;
char *fn = "ReadStyleSheet";
TRACE("\n");
for (;;)
{
(void) RTFGetToken ();
......@@ -1592,6 +1640,8 @@ int n;
RTFStyle *s;
RTFStyleElt *se;
TRACE("\n");
if (n == -1 || (s = RTFGetStyle (n)) == (RTFStyle *) NULL)
return;
if (s->rtfExpanding != 0)
......@@ -2575,6 +2625,7 @@ char *s;
RTFKey *rp;
int hash;
TRACE("\n");
++s; /* skip over the leading \ character */
hash = Hash (s);
for (rp = rtfKey; rp->rtfKStr != (char *) NULL; rp++)
......
......@@ -41,6 +41,9 @@
# include "rtf.h"
# include "rtf2text.h"
# include "charlist.h"
# include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(richedit);
static void TextClass ();
static void ControlClass ();
......@@ -61,7 +64,8 @@ int RTFToBuffer(char* pBuffer, int nBufferSize)
/* check if the buffer is big enough to hold all characters */
/* we require one more for the '\0' */
TRACE("\n");
if(nBufferSize < charlist.nCount + 1) {
return charlist.nCount + CHARLIST_CountChar(&charlist, '\n') + 1;
}
......@@ -119,6 +123,8 @@ TextClass ()
{
char buf[rtfBufSiz];
TRACE("\n");
if (rtfMinor != rtfSC_nothing)
PutStdChar (rtfMinor);
else
......@@ -135,6 +141,7 @@ char buf[rtfBufSiz];
static void
ControlClass ()
{
TRACE("\n");
switch (rtfMajor)
{
case rtfDestination:
......@@ -156,6 +163,9 @@ ControlClass ()
static void
Destination ()
{
TRACE("\n");
switch (rtfMinor)
{
case rtfPict:
......@@ -185,6 +195,9 @@ Destination ()
void SpecialChar ()
{
TRACE("\n");
switch (rtfMinor)
{
case rtfPage:
......@@ -249,6 +262,8 @@ void PutStdChar (int stdCode)
/* if (stdCode == rtfSC_nothing)
RTFPanic ("Unknown character code, logic error\n");
*/
TRACE("\n");
oStr = outMap[stdCode];
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','
#define EM_GETWORDBREAKPROCEX (WM_USER + 80)
#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 * );
/* 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