Huw Davies : riched20: Pass paragraph ptrs to the para marking function.

Alexandre Julliard julliard at winehq.org
Wed Nov 4 15:20:31 CST 2020


Module: wine
Branch: master
Commit: eb6b188a94054dbe5aaacde35d175c6ef26653cb
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=eb6b188a94054dbe5aaacde35d175c6ef26653cb

Author: Huw Davies <huw at codeweavers.com>
Date:   Wed Nov  4 06:56:26 2020 +0000

riched20: Pass paragraph ptrs to the para marking function.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/riched20/editor.c |  4 ++--
 dlls/riched20/editor.h |  2 +-
 dlls/riched20/paint.c  |  2 +-
 dlls/riched20/para.c   | 16 ++++++++--------
 dlls/riched20/style.c  |  2 +-
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 41906d28e4c..b27bab48738 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -4126,7 +4126,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
     ME_SetDefaultCharFormat(editor, &fmt);
 
     ME_CommitUndo(editor);
-    ME_MarkAllForWrapping(editor);
+    editor_mark_rewrap_all( editor );
     ME_WrapMarkedParagraphs(editor);
     ME_UpdateScrollBar(editor);
     if (bRepaint)
@@ -4771,7 +4771,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
       ME_SetDefaultFormatRect(editor);
       editor->bDefaultFormatRect = TRUE;
     }
-    ME_MarkAllForWrapping(editor);
+    editor_mark_rewrap_all( editor );
     ME_WrapMarkedParagraphs(editor);
     ME_UpdateScrollBar(editor);
     if (msg != EM_SETRECTNP)
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index 05a6a7ee37f..24e750be1de 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -204,13 +204,13 @@ void ME_SendRequestResize(ME_TextEditor *editor, BOOL force) DECLSPEC_HIDDEN;
 /* para.c */
 void editor_get_selection_paras(ME_TextEditor *editor, ME_Paragraph **para, ME_Paragraph **para_end ) DECLSPEC_HIDDEN;
 void editor_get_selection_para_fmt( ME_TextEditor *editor, PARAFORMAT2 *fmt ) DECLSPEC_HIDDEN;
+void editor_mark_rewrap_all( ME_TextEditor *editor ) DECLSPEC_HIDDEN;
 void editor_set_default_para_fmt(ME_TextEditor *editor, PARAFORMAT2 *pFmt) DECLSPEC_HIDDEN;
 BOOL editor_set_selection_para_fmt( ME_TextEditor *editor, const PARAFORMAT2 *fmt ) DECLSPEC_HIDDEN;
 ME_DisplayItem *ME_GetParagraph(ME_DisplayItem *run) DECLSPEC_HIDDEN;
 void ME_MakeFirstParagraph(ME_TextEditor *editor) DECLSPEC_HIDDEN;
 void ME_DumpParaStyle(ME_Paragraph *s) DECLSPEC_HIDDEN;
 void ME_DumpParaStyleToBuf(const PARAFORMAT2 *pFmt, char buf[2048]) DECLSPEC_HIDDEN;
-void ME_MarkAllForWrapping(ME_TextEditor *editor) DECLSPEC_HIDDEN;
 int get_total_width(ME_TextEditor *editor) DECLSPEC_HIDDEN;
 ME_Cell *para_cell( ME_Paragraph *para ) DECLSPEC_HIDDEN;
 void para_destroy( ME_TextEditor *editor, ME_Paragraph *item ) DECLSPEC_HIDDEN;
diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index d15c47b72aa..6228c760295 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -138,7 +138,7 @@ ME_RewrapRepaint(ME_TextEditor *editor)
   /* RewrapRepaint should be called whenever the control has changed in
    * looks, but not content. Like resizing. */
   
-  ME_MarkAllForWrapping(editor);
+  editor_mark_rewrap_all( editor );
   ME_WrapMarkedParagraphs(editor);
   ME_UpdateScrollBar(editor);
   ME_Repaint(editor);
diff --git a/dlls/riched20/para.c b/dlls/riched20/para.c
index 4348530bbdb..e7c3c6934b9 100644
--- a/dlls/riched20/para.c
+++ b/dlls/riched20/para.c
@@ -225,18 +225,18 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
   ME_DestroyContext(&c);
 }
 
-static void ME_MarkForWrapping(ME_TextEditor *editor, ME_DisplayItem *first, const ME_DisplayItem *last)
+static void para_mark_rewrap_paras( ME_TextEditor *editor, ME_Paragraph *first, const ME_Paragraph *end )
 {
-  while(first != last)
-  {
-    para_mark_rewrap( editor, &first->member.para );
-    first = first->member.para.next_para;
-  }
+    while (first != end)
+    {
+        para_mark_rewrap( editor, first );
+        first = para_next( first );
+    }
 }
 
-void ME_MarkAllForWrapping(ME_TextEditor *editor)
+void editor_mark_rewrap_all( ME_TextEditor *editor )
 {
-  ME_MarkForWrapping(editor, editor->pBuffer->pFirst->member.para.next_para, editor->pBuffer->pLast);
+    para_mark_rewrap_paras( editor, editor_first_para( editor ), editor_end_para( editor ) );
 }
 
 static void table_update_flags( ME_Paragraph *para )
diff --git a/dlls/riched20/style.c b/dlls/riched20/style.c
index fbbe29dce14..95d3d3b6b29 100644
--- a/dlls/riched20/style.c
+++ b/dlls/riched20/style.c
@@ -536,5 +536,5 @@ void ME_SetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *mod)
     }
     ScriptFreeCache( &def->script_cache );
     ME_ReleaseStyle( style );
-    ME_MarkAllForWrapping( editor );
+    editor_mark_rewrap_all( editor );
 }




More information about the wine-cvs mailing list