winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
January 2008
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
3 participants
699 discussions
Start a n
N
ew thread
Eric Pouech : richedit: Don't force repaint while the redraw flag is off.
by Alexandre Julliard
02 Jan '08
02 Jan '08
Module: wine Branch: master Commit: d5478118a1fb4c468ddaf7bccd94b70e855ea7dc URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d5478118a1fb4c468ddaf7bcc…
Author: Eric Pouech <eric.pouech(a)orange.fr> Date: Tue Jan 1 22:05:40 2008 +0100 richedit: Don't force repaint while the redraw flag is off. --- dlls/riched20/editor.c | 3 ++- dlls/riched20/paint.c | 13 ++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 518f86b..bbc5622 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -2660,7 +2660,8 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, ME_SendRequestResize(editor, TRUE); return 0; case WM_SETREDRAW: - editor->bRedraw = wParam; + if ((editor->bRedraw = wParam)) + ME_RewrapRepaint(editor); return 0; case WM_SIZE: { diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c index 216ef0f..91e283a 100644 --- a/dlls/riched20/paint.c +++ b/dlls/riched20/paint.c @@ -109,7 +109,8 @@ void ME_UpdateRepaint(ME_TextEditor *editor) { /* Should be called whenever the contents of the control have changed */ ME_Cursor *pCursor; - + + if (!editor->bRedraw) return; if (ME_WrapMarkedParagraphs(editor)) ME_UpdateScrollBar(editor); @@ -135,10 +136,12 @@ ME_RewrapRepaint(ME_TextEditor *editor) * looks, but not content. Like resizing. */ ME_MarkAllForWrapping(editor); - ME_WrapMarkedParagraphs(editor); - ME_UpdateScrollBar(editor); - - ME_Repaint(editor); + if (editor->bRedraw) + { + ME_WrapMarkedParagraphs(editor); + ME_UpdateScrollBar(editor); + ME_Repaint(editor); + } } int ME_twips2pointsX(ME_Context *c, int x)
1
0
0
0
Eric Pouech : richedit: Optimizations for the style selection.
by Alexandre Julliard
02 Jan '08
02 Jan '08
Module: wine Branch: master Commit: f43570cbf0cc8b631287313718eeffdf76a29c6f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f43570cbf0cc8b63128731371…
Author: Eric Pouech <eric.pouech(a)orange.fr> Date: Tue Jan 1 22:05:33 2008 +0100 richedit: Optimizations for the style selection. Use a ME_Context for style selection/unselection. Store the (x,y) dpi information for a given DC in the corresponding ME_Context structure. --- dlls/riched20/context.c | 2 + dlls/riched20/editor.h | 9 +++--- dlls/riched20/editstr.h | 1 + dlls/riched20/paint.c | 46 ++++++++++++++++++-------------- dlls/riched20/run.c | 68 +++++++++++++++++++++------------------------- dlls/riched20/style.c | 38 ++++++++++---------------- dlls/riched20/wrap.c | 14 ++++----- 7 files changed, 86 insertions(+), 92 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=f43570cbf0cc8b6312873…
1
0
0
0
Eric Pouech : richedit: Don't recreate the DC all the time, but use uniformely a ME_Context structure where needed.
by Alexandre Julliard
02 Jan '08
02 Jan '08
Module: wine Branch: master Commit: 475b45d8abdab2017553d92d491513e19b17406a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=475b45d8abdab2017553d92d4…
Author: Eric Pouech <eric.pouech(a)orange.fr> Date: Tue Jan 1 22:05:28 2008 +0100 richedit: Don't recreate the DC all the time, but use uniformely a ME_Context structure where needed. --- dlls/riched20/editor.h | 2 +- dlls/riched20/run.c | 20 +++++++++----------- dlls/riched20/wrap.c | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index c9baf98..4e16155 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -150,7 +150,7 @@ ME_DisplayItem *ME_InsertRunAtCursor(ME_TextEditor *editor, ME_Cursor *cursor, void ME_CheckCharOffsets(ME_TextEditor *editor); void ME_PropagateCharOffset(ME_DisplayItem *p, int shift); void ME_GetGraphicsSize(ME_TextEditor *editor, ME_Run *run, SIZE *pSize); -int ME_CharFromPoint(ME_TextEditor *editor, int cx, ME_Run *run); +int ME_CharFromPoint(ME_Context *c, int cx, ME_Run *run); /* this one accounts for 1/2 char tolerance */ int ME_CharFromPointCursor(ME_TextEditor *editor, int cx, ME_Run *run); int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset); diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c index 759ea29..a56f8a8 100644 --- a/dlls/riched20/run.c +++ b/dlls/riched20/run.c @@ -487,11 +487,10 @@ void ME_GetGraphicsSize(ME_TextEditor *editor, ME_Run *run, SIZE *pSize) * pixel horizontal position. This version rounds left (ie. if the second * character is at pixel position 8, then for cx=0..7 it returns 0). */ -int ME_CharFromPoint(ME_TextEditor *editor, int cx, ME_Run *run) +int ME_CharFromPoint(ME_Context *c, int cx, ME_Run *run) { int fit = 0; HGDIOBJ hOldFont; - HDC hDC; SIZE sz; if (!run->strText->nLen) return 0; @@ -505,29 +504,28 @@ int ME_CharFromPoint(ME_TextEditor *editor, int cx, ME_Run *run) if (run->nFlags & MERF_GRAPHICS) { SIZE sz; - ME_GetGraphicsSize(editor, run, &sz); + ME_GetGraphicsSize(c->editor, run, &sz); if (cx < sz.cx) return 0; return 1; } - hDC = GetDC(editor->hWnd); - hOldFont = ME_SelectStyleFont(editor, hDC, run->style); + hOldFont = ME_SelectStyleFont(c->editor, c->hDC, run->style); - if (editor->cPasswordMask) + if (c->editor->cPasswordMask) { - ME_String *strMasked = ME_MakeStringR(editor->cPasswordMask,ME_StrVLen(run->strText)); - GetTextExtentExPointW(hDC, strMasked->szData, run->strText->nLen, + ME_String *strMasked = ME_MakeStringR(c->editor->cPasswordMask,ME_StrVLen(run->strText)); + GetTextExtentExPointW(c->hDC, strMasked->szData, run->strText->nLen, cx, &fit, NULL, &sz); ME_DestroyString(strMasked); } else { - GetTextExtentExPointW(hDC, run->strText->szData, run->strText->nLen, + GetTextExtentExPointW(c->hDC, run->strText->szData, run->strText->nLen, cx, &fit, NULL, &sz); } - ME_UnselectStyleFont(editor, hDC, run->style, hOldFont); - ReleaseDC(editor->hWnd, hDC); + ME_UnselectStyleFont(c->editor, c->hDC, run->style, hOldFont); + return fit; } diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c index f49c7ab..b5f10f7 100644 --- a/dlls/riched20/wrap.c +++ b/dlls/riched20/wrap.c @@ -168,7 +168,7 @@ static ME_DisplayItem *ME_SplitByBacktracking(ME_WrapContext *wc, ME_DisplayItem int i, idesp, len; ME_Run *run = &p->member.run; - idesp = i = ME_CharFromPoint(wc->context->editor, loc, run); + idesp = i = ME_CharFromPoint(wc->context, loc, run); len = ME_StrVLen(run->strText); assert(len>0); assert(i<len);
1
0
0
0
Eric Pouech : richedit: Move init code after some sanity checks to avoid unneeded computations.
by Alexandre Julliard
02 Jan '08
02 Jan '08
Module: wine Branch: master Commit: 4cecb5dc706d75f89410cd55cd84455adc3ce6c8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4cecb5dc706d75f89410cd55c…
Author: Eric Pouech <eric.pouech(a)orange.fr> Date: Tue Jan 1 22:05:22 2008 +0100 richedit: Move init code after some sanity checks to avoid unneeded computations. --- dlls/riched20/paint.c | 3 ++- dlls/riched20/run.c | 3 ++- dlls/riched20/wrap.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c index 3d43496..f9fb4ec 100644 --- a/dlls/riched20/paint.c +++ b/dlls/riched20/paint.c @@ -267,7 +267,7 @@ static void ME_DrawGraphics(ME_Context *c, int x, int y, ME_Run *run, static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Paragraph *para) { ME_Run *run = &rundi->member.run; - ME_DisplayItem *start = ME_FindItemBack(rundi, diStartRow); + ME_DisplayItem *start; int runofs = run->nCharOfs+para->nCharOfs; int nSelFrom, nSelTo; const WCHAR wszSpace[] = {' ', 0}; @@ -275,6 +275,7 @@ static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Pa if (run->nFlags & MERF_HIDDEN) return; + start = ME_FindItemBack(rundi, diStartRow); ME_GetSelection(c->editor, &nSelFrom, &nSelTo); /* Draw selected end-of-paragraph mark */ diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c index 71354fe..759ea29 100644 --- a/dlls/riched20/run.c +++ b/dlls/riched20/run.c @@ -606,7 +606,7 @@ int ME_CharFromPointCursor(ME_TextEditor *editor, int cx, ME_Run *run) int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset) { SIZE size; - HDC hDC = GetDC(editor->hWnd); + HDC hDC; HGDIOBJ hOldFont; ME_String *strRunText; /* This could point to either the run's real text, or it's masked form in a password control */ @@ -623,6 +623,7 @@ int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset) else strRunText = pRun->strText; + hDC = GetDC(editor->hWnd); hOldFont = ME_SelectStyleFont(editor, hDC, pRun->style); GetTextExtentPoint32W(hDC, strRunText->szData, nOffset, &size); ME_UnselectStyleFont(editor, hDC, pRun->style, hOldFont); diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c index e72983e..f49c7ab 100644 --- a/dlls/riched20/wrap.c +++ b/dlls/riched20/wrap.c @@ -341,7 +341,7 @@ static void ME_PrepareParagraphForWrapping(ME_Context *c, ME_DisplayItem *tp); static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp, DWORD beginofs) { ME_DisplayItem *p; ME_WrapContext wc; - int dpi = GetDeviceCaps(c->hDC, LOGPIXELSX); + int dpi; int border = 0; int linespace = 0; @@ -351,6 +351,7 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp, DWORD begino } ME_PrepareParagraphForWrapping(c, tp); + dpi = GetDeviceCaps(c->hDC, LOGPIXELSX); wc.context = c; /* wc.para_style = tp->member.para.style; */ wc.style = NULL;
1
0
0
0
Eric Pouech : richedit: Small optimisation in ME_GetSelectionInsertStyle.
by Alexandre Julliard
02 Jan '08
02 Jan '08
Module: wine Branch: master Commit: d48905cf21853f6d117e669cf69061a1d3ff4173 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d48905cf21853f6d117e669cf…
Author: Eric Pouech <eric.pouech(a)orange.fr> Date: Tue Jan 1 22:05:16 2008 +0100 richedit: Small optimisation in ME_GetSelectionInsertStyle. --- dlls/riched20/caret.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index 2ca076d..2337107 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -1244,11 +1244,11 @@ ME_Style *ME_GetSelectionInsertStyle(ME_TextEditor *editor) { ME_Style *style; int from, to; - ME_Cursor c; - + ME_GetSelection(editor, &from, &to); - ME_CursorFromCharOfs(editor, from, &c); if (from != to) { + ME_Cursor c; + ME_CursorFromCharOfs(editor, from, &c); style = c.pRun->member.run.style; ME_AddRefStyle(style); /* ME_GetInsertStyle has already done that */ }
1
0
0
0
Eric Pouech : richedit: Rewrote FindPixelPos so that it always return something.
by Alexandre Julliard
02 Jan '08
02 Jan '08
Module: wine Branch: master Commit: e9be142d783e3644da69ffc831189069d8d581f9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e9be142d783e3644da69ffc83…
Author: Eric Pouech <eric.pouech(a)orange.fr> Date: Tue Jan 1 22:05:05 2008 +0100 richedit: Rewrote FindPixelPos so that it always return something. Made the function static as well. --- dlls/riched20/caret.c | 131 ++++++++++++++++++++--------------------------- dlls/riched20/editor.h | 1 - dlls/riched20/wrap.c | 4 +- 3 files changed, 58 insertions(+), 78 deletions(-) diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index 46ab7c9..2ca076d 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -704,102 +704,83 @@ int ME_GetCursorOfs(ME_TextEditor *editor, int nCursor) + pCursor->pRun->member.run.nCharOfs + pCursor->nOffset; } -int ME_FindPixelPos(ME_TextEditor *editor, int x, int y, ME_Cursor *result, BOOL *is_eol) +static void ME_FindPixelPos(ME_TextEditor *editor, int x, int y, ME_Cursor *result, BOOL *is_eol) { ME_DisplayItem *p = editor->pBuffer->pFirst->member.para.next_para; + ME_DisplayItem *last = NULL; int rx = 0; - + if (is_eol) *is_eol = 0; - while(p != editor->pBuffer->pLast) + /* find paragraph */ + for (; p != editor->pBuffer->pLast; p = p->member.para.next_para) { - if (p->type == diParagraph) + assert(p->type == diParagraph); + if (y < p->member.para.nYPos + p->member.para.nHeight) { - int ry = y - p->member.para.nYPos; - if (ry < 0) - { - result->pRun = ME_FindItemFwd(p, diRun); - result->nOffset = 0; - return 0; - } - if (ry >= p->member.para.nHeight) - { - p = p->member.para.next_para; - continue; - } + y -= p->member.para.nYPos; p = ME_FindItemFwd(p, diStartRow); - y = ry; - continue; + break; } - if (p->type == diStartRow) + } + /* find row */ + for (; p != editor->pBuffer->pLast; ) + { + ME_DisplayItem *pp; + assert(p->type == diStartRow); + if (y < p->member.row.nYPos + p->member.row.nHeight) { - int ry = y - p->member.row.nYPos; - if (ry < 0) - return 0; - if (ry >= p->member.row.nHeight) - { - p = ME_FindItemFwd(p, diStartRowOrParagraphOrEnd); - if (p->type != diStartRow) - return 0; - continue; - } - p = ME_FindItemFwd(p, diRun); - continue; + p = ME_FindItemFwd(p, diRun); + break; + } + pp = ME_FindItemFwd(p, diStartRowOrParagraphOrEnd); + if (pp->type != diStartRow) + { + p = ME_FindItemFwd(p, diRun); + break; } - if (p->type == diRun) + p = pp; + } + for (; p != editor->pBuffer->pLast; p = p->next) + { + switch (p->type) { - ME_DisplayItem *pp; + case diRun: rx = x - p->member.run.pt.x; - if (rx < 0) - rx = 0; - if (rx >= p->member.run.nWidth) /* not this run yet... find next item */ - { - pp = p; - do { - p = p->next; - if (p->type == diRun) - { - rx = x - p->member.run.pt.x; - goto continue_search; - } - if (p->type == diStartRow) - { - p = ME_FindItemFwd(p, diRun); - if (is_eol) - *is_eol = 1; - rx = 0; /* FIXME not sure */ - goto found_here; - } - if (p->type == diParagraph || p->type == diTextEnd) - { - rx = 0; /* FIXME not sure */ - p = pp; - goto found_here; - } - } while(1); - continue; - } - found_here: - if (p->member.run.nFlags & MERF_ENDPARA) - rx = 0; - result->pRun = p; - result->nOffset = ME_CharFromPointCursor(editor, rx, &p->member.run); - if (editor->pCursors[0].nOffset == p->member.run.strText->nLen && rx) + if (rx < p->member.run.nWidth) { - result->pRun = ME_FindItemFwd(editor->pCursors[0].pRun, diRun); - result->nOffset = 0; + found_here: + assert(p->type == diRun); + if ((p->member.run.nFlags & MERF_ENDPARA) || rx < 0) + rx = 0; + result->pRun = p; + result->nOffset = ME_CharFromPointCursor(editor, rx, &p->member.run); + if (editor->pCursors[0].nOffset == p->member.run.strText->nLen && rx) + { + result->pRun = ME_FindItemFwd(editor->pCursors[0].pRun, diRun); + result->nOffset = 0; + } + return; } - return 1; + break; + case diStartRow: + p = ME_FindItemFwd(p, diRun); + if (is_eol) *is_eol = 1; + rx = 0; /* FIXME not sure */ + goto found_here; + case diParagraph: + case diTextEnd: + rx = 0; /* FIXME not sure */ + p = last; + goto found_here; + default: assert(0); } - assert(0); - continue_search: - ; + last = p; } result->pRun = ME_FindItemBack(p, diRun); result->nOffset = 0; assert(result->pRun->member.run.nFlags & MERF_ENDPARA); - return 0; } diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index 0223b30..c9baf98 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -181,7 +181,6 @@ void ME_SelectWord(ME_TextEditor *editor); void ME_HideCaret(ME_TextEditor *ed); void ME_ShowCaret(ME_TextEditor *ed); void ME_MoveCaret(ME_TextEditor *ed); -int ME_FindPixelPos(ME_TextEditor *editor, int x, int y, ME_Cursor *result, BOOL *is_eol); int ME_CharFromPos(ME_TextEditor *editor, int x, int y); void ME_LButtonDown(ME_TextEditor *editor, int x, int y); void ME_MouseMove(ME_TextEditor *editor, int x, int y); diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c index f0b2c49..e72983e 100644 --- a/dlls/riched20/wrap.c +++ b/dlls/riched20/wrap.c @@ -354,8 +354,8 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp, DWORD begino wc.context = c; /* wc.para_style = tp->member.para.style; */ wc.style = NULL; - wc.nFirstMargin = ME_twips2points(c, tp->member.para.pFmt->dxStartIndent, dpi) + beginofs - wc.nLeftMargin = wc.nFirstMargin + ME_twips2points(c, tp->member.para.pFmt->dxOffset, dpi) + beginofs + wc.nFirstMargin = ME_twips2points(c, tp->member.para.pFmt->dxStartIndent, dpi) + beginofs; + wc.nLeftMargin = wc.nFirstMargin + ME_twips2points(c, tp->member.para.pFmt->dxOffset, dpi) + beginofs; wc.nRightMargin = ME_twips2points(c, tp->member.para.pFmt->dxRightIndent, dpi); wc.nRow = 0; wc.pt.x = 0;
1
0
0
0
Eric Pouech : richedit: Added support for intra-paragraph line space.
by Alexandre Julliard
02 Jan '08
02 Jan '08
Module: wine Branch: master Commit: d319033a9755e11f6ac9730776f3c1f9b7b3492a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d319033a9755e11f6ac973077…
Author: Eric Pouech <eric.pouech(a)orange.fr> Date: Tue Jan 1 22:04:58 2008 +0100 richedit: Added support for intra-paragraph line space. --- dlls/riched20/editor.h | 1 + dlls/riched20/paint.c | 23 +++++++++++++++++++++++ dlls/riched20/wrap.c | 8 ++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index f67b9e7..0223b30 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -256,6 +256,7 @@ BOOL ME_GetYScrollVisible(ME_TextEditor *editor); /* other functions in paint.c */ int ME_GetParaBorderWidth(ME_TextEditor *editor, int); +int ME_GetParaLineSpace(ME_TextEditor *editor, ME_Paragraph*, int); /* richole.c */ extern LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *); diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c index 72c03f1..3d43496 100644 --- a/dlls/riched20/paint.c +++ b/dlls/riched20/paint.c @@ -365,6 +365,29 @@ int ME_GetParaBorderWidth(ME_TextEditor* editor, int flags) return width; } +int ME_GetParaLineSpace(ME_TextEditor* editor, ME_Paragraph* para, int dpi) +{ + int sp = 0, ls = 0; + if (!(para->pFmt->dwMask & PFM_LINESPACING)) return 0; + + /* FIXME: how to compute simply the line space in ls ??? */ + /* FIXME: does line spacing include the line itself ??? */ + switch (para->pFmt->bLineSpacingRule) + { + case 0: sp = ls; break; + case 1: sp = (3 * ls) / 2; break; + case 2: sp = 2 * ls; break; + case 3: sp = para->pFmt->dyLineSpacing * dpi / 1440; if (sp < ls) sp = ls; break; + case 4: sp = para->pFmt->dyLineSpacing * dpi / 1440; break; + case 5: sp = para->pFmt->dyLineSpacing / 20; break; + default: FIXME("Unsupported spacing rule value %d\n", para->pFmt->bLineSpacingRule); + } + if (editor->nZoomNumerator == 0) + return sp; + else + return sp * editor->nZoomNumerator / editor->nZoomDenominator; +} + static int ME_DrawParaDecoration(ME_Context* c, ME_Paragraph* para, int y, int dpi) { int idx, border_width; diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c index d1f6203..f0b2c49 100644 --- a/dlls/riched20/wrap.c +++ b/dlls/riched20/wrap.c @@ -343,6 +343,7 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp, DWORD begino ME_WrapContext wc; int dpi = GetDeviceCaps(c->hDC, LOGPIXELSX); int border = 0; + int linespace = 0; assert(tp->type == diParagraph); if (!(tp->member.para.nFlags & MEPF_REWRAP)) { @@ -378,14 +379,17 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp, DWORD begino wc.nAvailWidth = wc.nTotalWidth - wc.nFirstMargin - wc.nRightMargin; wc.pRowStart = NULL; + linespace = ME_GetParaLineSpace(c->editor, &tp->member.para, dpi); + ME_BeginRow(&wc); for (p = tp->next; p!=tp->member.para.next_para; ) { assert(p->type != diStartRow); if (p->type == diRun) { p = ME_WrapHandleRun(&wc, p); - continue; } - p = p->next; + else p = p->next; + if (wc.nRow && p == wc.pRowStart) + wc.pt.y += linespace; } ME_WrapEndParagraph(&wc, p); if ((tp->member.para.pFmt->dwMask & PFM_BORDER) && (tp->member.para.pFmt->wBorders & 8))
1
0
0
0
Eric Pouech : richedit: Added support for spaces above & below paragraphs.
by Alexandre Julliard
02 Jan '08
02 Jan '08
Module: wine Branch: master Commit: f1b029ef6a096eeef4b5234124314fb238cd295c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f1b029ef6a096eeef4b523412…
Author: Eric Pouech <eric.pouech(a)orange.fr> Date: Tue Jan 1 22:04:52 2008 +0100 richedit: Added support for spaces above & below paragraphs. --- dlls/riched20/paint.c | 136 ++++++++++++++++++++++++++++++------------------- dlls/riched20/wrap.c | 4 ++ 2 files changed, 88 insertions(+), 52 deletions(-) diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c index b5211e2..72c03f1 100644 --- a/dlls/riched20/paint.c +++ b/dlls/riched20/paint.c @@ -365,70 +365,102 @@ int ME_GetParaBorderWidth(ME_TextEditor* editor, int flags) return width; } -static int ME_DrawParaDecoration(ME_Context* c, ME_Paragraph* para, int y) +static int ME_DrawParaDecoration(ME_Context* c, ME_Paragraph* para, int y, int dpi) { - HPEN pen, oldpen; - POINT pt; - int idx, pen_width, border_width; - COLORREF pencr; + int idx, border_width; + int ybefore, yafter; + RECT rc; - if (!(para->pFmt->dwMask & PFM_BORDER)) return 0; + if (!(para->pFmt->dwMask & (PFM_BORDER | PFM_SPACEBEFORE | PFM_SPACEAFTER))) return 0; - if (para->pFmt->wBorders & 0x00B0) - FIXME("Unsupported border flags %x\n", para->pFmt->wBorders); - border_width = ME_GetParaBorderWidth(c->editor, para->pFmt->wBorders); - if (border_width == 0 || !(para->pFmt->wBorders & 0xF)) return 0; + if (para->pFmt->dwMask & PFM_SPACEBEFORE) + { + rc.left = c->rcView.left; + rc.right = c->rcView.right; + rc.top = y; + ybefore = ME_twips2points(c, para->pFmt->dySpaceBefore, dpi); + rc.bottom = y + ybefore; + FillRect(c->hDC, &rc, c->editor->hbrBackground); + } + else ybefore = 0; + if (para->pFmt->dwMask & PFM_SPACEAFTER) + { + rc.left = c->rcView.left; + rc.right = c->rcView.right; + rc.bottom = y + para->nHeight; + yafter = ME_twips2points(c, para->pFmt->dySpaceAfter, dpi); + rc.top = rc.bottom - yafter; + FillRect(c->hDC, &rc, c->editor->hbrBackground); + } + else yafter = 0; + + border_width = 0; idx = (para->pFmt->wBorders >> 8) & 0xF; + if ((para->pFmt->dwMask & PFM_BORDER) && idx != 0 && (para->pFmt->wBorders & 0xF)) { + int pen_width; + COLORREF pencr; + HPEN pen = NULL, oldpen = NULL; + POINT pt; + + if (para->pFmt->wBorders & 0x00B0) + FIXME("Unsupported border flags %x\n", para->pFmt->wBorders); + border_width = ME_GetParaBorderWidth(c->editor, para->pFmt->wBorders); - if (para->pFmt->wBorders & 64) /* autocolor */ + if (para->pFmt->wBorders & 64) /* autocolor */ pencr = GetSysColor(COLOR_WINDOWTEXT); - else + else pencr = pen_colors[(para->pFmt->wBorders >> 12) & 0xF]; - pen_width = ME_GetBorderPenWidth(c->editor, idx); - pen = CreatePen(border_details[idx].pen_style, pen_width, pencr); - oldpen = SelectObject(c->hDC, pen); - MoveToEx(c->hDC, 0, 0, &pt); - if (para->pFmt->wBorders & 1) - { - MoveToEx(c->hDC, c->rcView.left, y, NULL); - LineTo(c->hDC, c->rcView.left, y + para->nHeight); - if (border_details[idx].dble) { - MoveToEx(c->hDC, c->rcView.left + pen_width + 1, y + pen_width + 1, NULL); - LineTo(c->hDC, c->rcView.left + pen_width + 1, y + para->nHeight - pen_width - 1); + pen_width = ME_GetBorderPenWidth(c->editor, idx); + pen = CreatePen(border_details[idx].pen_style, pen_width, pencr); + oldpen = SelectObject(c->hDC, pen); + MoveToEx(c->hDC, 0, 0, &pt); + + /* before & after spaces are not included in border */ + if (para->pFmt->wBorders & 1) + { + MoveToEx(c->hDC, c->rcView.left, y + ybefore, NULL); + LineTo(c->hDC, c->rcView.left, y + para->nHeight - yafter); + if (border_details[idx].dble) { + MoveToEx(c->hDC, c->rcView.left + pen_width + 1, y + ybefore + pen_width + 1, NULL); + LineTo(c->hDC, c->rcView.left + pen_width + 1, y + para->nHeight - yafter - pen_width - 1); + } } - } - if (para->pFmt->wBorders & 2) - { - MoveToEx(c->hDC, c->rcView.right, y, NULL); - LineTo(c->hDC, c->rcView.right, y + para->nHeight); - if (border_details[idx].dble) { - MoveToEx(c->hDC, c->rcView.right - pen_width - 1, y + pen_width + 1, NULL); - LineTo(c->hDC, c->rcView.right - pen_width - 1, y + para->nHeight - pen_width - 1); + if (para->pFmt->wBorders & 2) + { + MoveToEx(c->hDC, c->rcView.right, y + ybefore, NULL); + LineTo(c->hDC, c->rcView.right, y + para->nHeight - yafter); + if (border_details[idx].dble) { + MoveToEx(c->hDC, c->rcView.right - pen_width - 1, y + ybefore + pen_width + 1, NULL); + LineTo(c->hDC, c->rcView.right - pen_width - 1, y + para->nHeight - yafter - pen_width - 1); + } } - } - if (para->pFmt->wBorders & 4) - { - MoveToEx(c->hDC, c->rcView.left, y, NULL); - LineTo(c->hDC, c->rcView.right, y); - if (border_details[idx].dble) { - MoveToEx(c->hDC, c->rcView.left + pen_width + 1, y + pen_width + 1, NULL); - LineTo(c->hDC, c->rcView.right - pen_width - 1, y + pen_width + 1); + if (para->pFmt->wBorders & 4) + { + MoveToEx(c->hDC, c->rcView.left, y + ybefore, NULL); + LineTo(c->hDC, c->rcView.right, y + ybefore); + if (border_details[idx].dble) { + MoveToEx(c->hDC, c->rcView.left + pen_width + 1, y + ybefore + pen_width + 1, NULL); + LineTo(c->hDC, c->rcView.right - pen_width - 1, y + ybefore + pen_width + 1); + } } - } - if (para->pFmt->wBorders & 8) - { - MoveToEx(c->hDC, c->rcView.left, y + para->nHeight - 1, NULL); - LineTo(c->hDC, c->rcView.right, y + para->nHeight - 1); - if (border_details[idx].dble) { - MoveToEx(c->hDC, c->rcView.left + pen_width + 1, y + para->nHeight - 1 - pen_width - 1, NULL); - LineTo(c->hDC, c->rcView.right - pen_width - 1, y + para->nHeight - 1 - pen_width - 1); + if (para->pFmt->wBorders & 8) + { + MoveToEx(c->hDC, c->rcView.left, y + para->nHeight - yafter - 1, NULL); + LineTo(c->hDC, c->rcView.right, y + para->nHeight - yafter - 1); + if (border_details[idx].dble) { + MoveToEx(c->hDC, c->rcView.left + pen_width + 1, y + para->nHeight - yafter - 1 - pen_width - 1, NULL); + LineTo(c->hDC, c->rcView.right - pen_width - 1, y + para->nHeight - yafter - 1 - pen_width - 1); + } } + + MoveToEx(c->hDC, pt.x, pt.y, NULL); + SelectObject(c->hDC, oldpen); + DeleteObject(pen); } - MoveToEx(c->hDC, pt.x, pt.y, NULL); - SelectObject(c->hDC, oldpen); - DeleteObject(pen); - return (para->pFmt->wBorders & 4) ? border_width : 0; + return ybefore + + ((para->pFmt->dwMask & PFM_BORDER) && (para->pFmt->wBorders & 4) ? + border_width : 0); } void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) { @@ -457,7 +489,7 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) { nMargWidth += ME_twips2points(c, para->pFmt->dxOffset, dpi); xs = c->rcView.left+nMargWidth; xe = c->rcView.right - ME_twips2points(c, para->pFmt->dxRightIndent, dpi); - y += ME_DrawParaDecoration(c, para, y); + y += ME_DrawParaDecoration(c, para, y, dpi); break; case diStartRow: y += height; diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c index 2069261..d1f6203 100644 --- a/dlls/riched20/wrap.c +++ b/dlls/riched20/wrap.c @@ -359,6 +359,8 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp, DWORD begino wc.nRow = 0; wc.pt.x = 0; wc.pt.y = 0; + if (tp->member.para.pFmt->dwMask & PFM_SPACEBEFORE) + wc.pt.y += ME_twips2points(c, tp->member.para.pFmt->dySpaceBefore, dpi); if (tp->member.para.pFmt->dwMask & PFM_BORDER) { border = ME_GetParaBorderWidth(c->editor, tp->member.para.pFmt->wBorders); @@ -388,6 +390,8 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp, DWORD begino ME_WrapEndParagraph(&wc, p); if ((tp->member.para.pFmt->dwMask & PFM_BORDER) && (tp->member.para.pFmt->wBorders & 8)) wc.pt.y += border; + if (tp->member.para.pFmt->dwMask & PFM_SPACEAFTER) + wc.pt.y += ME_twips2points(c, tp->member.para.pFmt->dySpaceAfter, dpi); tp->member.para.nFlags &= ~MEPF_REWRAP; tp->member.para.nHeight = wc.pt.y;
1
0
0
0
Eric Pouech : richedit: Now drawing the paragraph borders (if any) from paraformat2.
by Alexandre Julliard
02 Jan '08
02 Jan '08
Module: wine Branch: master Commit: caa37c749a87ab5d0604a574bc65e616baa839ec URL:
http://source.winehq.org/git/wine.git/?a=commit;h=caa37c749a87ab5d0604a574b…
Author: Eric Pouech <eric.pouech(a)orange.fr> Date: Tue Jan 1 22:04:46 2008 +0100 richedit: Now drawing the paragraph borders (if any) from paraformat2. --- dlls/riched20/editor.h | 3 + dlls/riched20/paint.c | 128 +++++++++++++++++++++++++++++++++++++++++++++++- dlls/riched20/wrap.c | 17 ++++++ 3 files changed, 147 insertions(+), 1 deletions(-) diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index 93789d6..f67b9e7 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -254,6 +254,9 @@ void ME_UpdateScrollBar(ME_TextEditor *editor); int ME_GetYScrollPos(ME_TextEditor *editor); BOOL ME_GetYScrollVisible(ME_TextEditor *editor); +/* other functions in paint.c */ +int ME_GetParaBorderWidth(ME_TextEditor *editor, int); + /* richole.c */ extern LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *); diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c index 8f71fa5..b5211e2 100644 --- a/dlls/riched20/paint.c +++ b/dlls/riched20/paint.c @@ -306,6 +306,131 @@ static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Pa } } +static struct {unsigned width_num : 4, width_den : 4, pen_style : 4, dble : 1;} border_details[] = { + /* none */ {0, 0, PS_SOLID, FALSE}, + /* 3/4 */ {3, 4, PS_SOLID, FALSE}, + /* 1 1/2 */ {3, 2, PS_SOLID, FALSE}, + /* 2 1/4 */ {9, 4, PS_SOLID, FALSE}, + /* 3 */ {3, 1, PS_SOLID, FALSE}, + /* 4 1/2 */ {9, 2, PS_SOLID, FALSE}, + /* 6 */ {6, 1, PS_SOLID, FALSE}, + /* 3/4 double */ {3, 4, PS_SOLID, TRUE}, + /* 1 1/2 double */ {3, 2, PS_SOLID, TRUE}, + /* 2 1/4 double */ {9, 4, PS_SOLID, TRUE}, + /* 3/4 gray */ {3, 4, PS_DOT /* FIXME */, FALSE}, + /* 1 1/2 dashed */ {3, 2, PS_DASH, FALSE}, +}; + +static COLORREF pen_colors[16] = { + /* Black */ RGB(0x00, 0x00, 0x00), /* Blue */ RGB(0x00, 0x00, 0xFF), + /* Cyan */ RGB(0x00, 0xFF, 0xFF), /* Green */ RGB(0x00, 0xFF, 0x00), + /* Magenta */ RGB(0xFF, 0x00, 0xFF), /* Red */ RGB(0xFF, 0x00, 0x00), + /* Yellow */ RGB(0xFF, 0xFF, 0x00), /* White */ RGB(0xFF, 0xFF, 0xFF), + /* Dark blue */ RGB(0x00, 0x00, 0x80), /* Dark cyan */ RGB(0x00, 0x80, 0x80), + /* Dark green */ RGB(0x00, 0x80, 0x80), /* Dark magenta */ RGB(0x80, 0x00, 0x80), + /* Dark red */ RGB(0x80, 0x00, 0x00), /* Dark yellow */ RGB(0x80, 0x80, 0x00), + /* Dark gray */ RGB(0x80, 0x80, 0x80), /* Light gray */ RGB(0xc0, 0xc0, 0xc0), +}; + +static int ME_GetBorderPenWidth(ME_TextEditor* editor, int idx) +{ + int width; + + if (editor->nZoomNumerator == 0) + { + width = border_details[idx].width_num + border_details[idx].width_den / 2; + width /= border_details[idx].width_den; + } + else + { + width = border_details[idx].width_num * editor->nZoomNumerator; + width += border_details[idx].width_den * editor->nZoomNumerator / 2; + width /= border_details[idx].width_den * editor->nZoomDenominator; + } + return width; +} + +int ME_GetParaBorderWidth(ME_TextEditor* editor, int flags) +{ + int idx = (flags >> 8) & 0xF; + int width; + + if (idx >= sizeof(border_details) / sizeof(border_details[0])) + { + FIXME("Unsupported border value %d\n", idx); + return 0; + } + width = ME_GetBorderPenWidth(editor, idx); + if (border_details[idx].dble) width = width * 2 + 1; + return width; +} + +static int ME_DrawParaDecoration(ME_Context* c, ME_Paragraph* para, int y) +{ + HPEN pen, oldpen; + POINT pt; + int idx, pen_width, border_width; + COLORREF pencr; + + if (!(para->pFmt->dwMask & PFM_BORDER)) return 0; + + if (para->pFmt->wBorders & 0x00B0) + FIXME("Unsupported border flags %x\n", para->pFmt->wBorders); + border_width = ME_GetParaBorderWidth(c->editor, para->pFmt->wBorders); + if (border_width == 0 || !(para->pFmt->wBorders & 0xF)) return 0; + idx = (para->pFmt->wBorders >> 8) & 0xF; + + if (para->pFmt->wBorders & 64) /* autocolor */ + pencr = GetSysColor(COLOR_WINDOWTEXT); + else + pencr = pen_colors[(para->pFmt->wBorders >> 12) & 0xF]; + + pen_width = ME_GetBorderPenWidth(c->editor, idx); + pen = CreatePen(border_details[idx].pen_style, pen_width, pencr); + oldpen = SelectObject(c->hDC, pen); + MoveToEx(c->hDC, 0, 0, &pt); + if (para->pFmt->wBorders & 1) + { + MoveToEx(c->hDC, c->rcView.left, y, NULL); + LineTo(c->hDC, c->rcView.left, y + para->nHeight); + if (border_details[idx].dble) { + MoveToEx(c->hDC, c->rcView.left + pen_width + 1, y + pen_width + 1, NULL); + LineTo(c->hDC, c->rcView.left + pen_width + 1, y + para->nHeight - pen_width - 1); + } + } + if (para->pFmt->wBorders & 2) + { + MoveToEx(c->hDC, c->rcView.right, y, NULL); + LineTo(c->hDC, c->rcView.right, y + para->nHeight); + if (border_details[idx].dble) { + MoveToEx(c->hDC, c->rcView.right - pen_width - 1, y + pen_width + 1, NULL); + LineTo(c->hDC, c->rcView.right - pen_width - 1, y + para->nHeight - pen_width - 1); + } + } + if (para->pFmt->wBorders & 4) + { + MoveToEx(c->hDC, c->rcView.left, y, NULL); + LineTo(c->hDC, c->rcView.right, y); + if (border_details[idx].dble) { + MoveToEx(c->hDC, c->rcView.left + pen_width + 1, y + pen_width + 1, NULL); + LineTo(c->hDC, c->rcView.right - pen_width - 1, y + pen_width + 1); + } + } + if (para->pFmt->wBorders & 8) + { + MoveToEx(c->hDC, c->rcView.left, y + para->nHeight - 1, NULL); + LineTo(c->hDC, c->rcView.right, y + para->nHeight - 1); + if (border_details[idx].dble) { + MoveToEx(c->hDC, c->rcView.left + pen_width + 1, y + para->nHeight - 1 - pen_width - 1, NULL); + LineTo(c->hDC, c->rcView.right - pen_width - 1, y + para->nHeight - 1 - pen_width - 1); + } + } + MoveToEx(c->hDC, pt.x, pt.y, NULL); + SelectObject(c->hDC, oldpen); + DeleteObject(pen); + return (para->pFmt->wBorders & 4) ? border_width : 0; +} + void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) { int align = SetTextAlign(c->hDC, TA_BASELINE); int dpi = GetDeviceCaps(c->hDC, LOGPIXELSX); @@ -318,7 +443,7 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) { int xs = 0, xe = 0; BOOL visible = FALSE; int nMargWidth = 0; - + c->pt.x = c->rcView.left; rcPara.left = c->rcView.left; rcPara.right = c->rcView.right; @@ -332,6 +457,7 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) { nMargWidth += ME_twips2points(c, para->pFmt->dxOffset, dpi); xs = c->rcView.left+nMargWidth; xe = c->rcView.right - ME_twips2points(c, para->pFmt->dxRightIndent, dpi); + y += ME_DrawParaDecoration(c, para, y); break; case diStartRow: y += height; diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c index 310aad7..2069261 100644 --- a/dlls/riched20/wrap.c +++ b/dlls/riched20/wrap.c @@ -342,6 +342,7 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp, DWORD begino ME_DisplayItem *p; ME_WrapContext wc; int dpi = GetDeviceCaps(c->hDC, LOGPIXELSX); + int border = 0; assert(tp->type == diParagraph); if (!(tp->member.para.nFlags & MEPF_REWRAP)) { @@ -358,6 +359,19 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp, DWORD begino wc.nRow = 0; wc.pt.x = 0; wc.pt.y = 0; + if (tp->member.para.pFmt->dwMask & PFM_BORDER) + { + border = ME_GetParaBorderWidth(c->editor, tp->member.para.pFmt->wBorders); + if (tp->member.para.pFmt->wBorders & 1) { + wc.nFirstMargin += border; + wc.nLeftMargin += border; + } + if (tp->member.para.pFmt->wBorders & 2) + wc.nRightMargin -= border; + if (tp->member.para.pFmt->wBorders & 4) + wc.pt.y += border; + } + wc.nTotalWidth = c->rcView.right - c->rcView.left; wc.nAvailWidth = wc.nTotalWidth - wc.nFirstMargin - wc.nRightMargin; wc.pRowStart = NULL; @@ -372,6 +386,9 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp, DWORD begino p = p->next; } ME_WrapEndParagraph(&wc, p); + if ((tp->member.para.pFmt->dwMask & PFM_BORDER) && (tp->member.para.pFmt->wBorders & 8)) + wc.pt.y += border; + tp->member.para.nFlags &= ~MEPF_REWRAP; tp->member.para.nHeight = wc.pt.y; tp->member.para.nRows = wc.nRow;
1
0
0
0
Eric Pouech : richedit: Fix the para computation when zoom is used.
by Alexandre Julliard
02 Jan '08
02 Jan '08
Module: wine Branch: master Commit: 28cc0f9e690a675aa00b0ccc02b442fcf8a819ea URL:
http://source.winehq.org/git/wine.git/?a=commit;h=28cc0f9e690a675aa00b0ccc0…
Author: Eric Pouech <eric.pouech(a)orange.fr> Date: Tue Jan 1 22:04:40 2008 +0100 richedit: Fix the para computation when zoom is used. --- dlls/riched20/editor.h | 1 + dlls/riched20/paint.c | 26 ++++++++++++-------------- dlls/riched20/wrap.c | 6 +++--- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index 5cb9b7e..93789d6 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -214,6 +214,7 @@ BOOL ME_UpdateSelection(ME_TextEditor *editor, const ME_Cursor *pTempCursor); BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor); void ME_InvalidateMarkedParagraphs(ME_TextEditor *editor); void ME_SendRequestResize(ME_TextEditor *editor, BOOL force); +int ME_twips2points(ME_Context *c, int x, int dpi); /* para.c */ ME_DisplayItem *ME_GetParagraph(ME_DisplayItem *run); diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c index 1107105..8f71fa5 100644 --- a/dlls/riched20/paint.c +++ b/dlls/riched20/paint.c @@ -141,6 +141,13 @@ ME_RewrapRepaint(ME_TextEditor *editor) ME_Repaint(editor); } +int ME_twips2points(ME_Context *c, int x, int dpi) +{ + if (c->editor->nZoomNumerator == 0) + return x * dpi / 1440; + else + return x * dpi * c->editor->nZoomNumerator / 1440 / c->editor->nZoomDenominator; +} static void ME_DrawTextWithStyle(ME_Context *c, int x, int y, LPCWSTR szText, int nChars, ME_Style *s, int *width, int nSelFrom, int nSelTo, int ymin, int cy) { @@ -167,17 +174,8 @@ static void ME_DrawTextWithStyle(ME_Context *c, int x, int y, LPCWSTR szText, in if (s->fmt.dwEffects & CFE_SUBSCRIPT) yTwipsOffset = -s->fmt.yHeight/12; } if (yTwipsOffset) - { - int numerator = 1; - int denominator = 1; - - if (c->editor->nZoomNumerator) - { - numerator = c->editor->nZoomNumerator; - denominator = c->editor->nZoomDenominator; - } - yOffset = yTwipsOffset * GetDeviceCaps(hDC, LOGPIXELSY) * numerator / denominator / 1440; - } + yOffset = ME_twips2points(c, yTwipsOffset, GetDeviceCaps(hDC, LOGPIXELSY)); + ExtTextOutW(hDC, x, y-yOffset, 0, NULL, szText, nChars, NULL); GetTextExtentPoint32W(hDC, szText, nChars, &sz); if (width) *width = sz.cx; @@ -329,11 +327,11 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) { case diParagraph: para = &p->member.para; assert(para); - nMargWidth = para->pFmt->dxStartIndent*dpi/1440; + nMargWidth = ME_twips2points(c, para->pFmt->dxStartIndent, dpi); if (pno != 0) - nMargWidth += para->pFmt->dxOffset*dpi/1440; + nMargWidth += ME_twips2points(c, para->pFmt->dxOffset, dpi); xs = c->rcView.left+nMargWidth; - xe = c->rcView.right-(para->pFmt->dxRightIndent*dpi/1440); + xe = c->rcView.right - ME_twips2points(c, para->pFmt->dxRightIndent, dpi); break; case diStartRow: y += height; diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c index ae399fb..310aad7 100644 --- a/dlls/riched20/wrap.c +++ b/dlls/riched20/wrap.c @@ -352,9 +352,9 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp, DWORD begino wc.context = c; /* wc.para_style = tp->member.para.style; */ wc.style = NULL; - wc.nFirstMargin = tp->member.para.pFmt->dxStartIndent*dpi/1440 + beginofs; - wc.nLeftMargin = wc.nFirstMargin + tp->member.para.pFmt->dxOffset*dpi/1440 + beginofs; - wc.nRightMargin = tp->member.para.pFmt->dxRightIndent*dpi/1440; + wc.nFirstMargin = ME_twips2points(c, tp->member.para.pFmt->dxStartIndent, dpi) + beginofs + wc.nLeftMargin = wc.nFirstMargin + ME_twips2points(c, tp->member.para.pFmt->dxOffset, dpi) + beginofs + wc.nRightMargin = ME_twips2points(c, tp->member.para.pFmt->dxRightIndent, dpi); wc.nRow = 0; wc.pt.x = 0; wc.pt.y = 0;
1
0
0
0
← Newer
1
...
63
64
65
66
67
68
69
70
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Results per page:
10
25
50
100
200