Dylan Smith : wordpad: Cache text length.

Alexandre Julliard julliard at winehq.org
Mon Feb 22 08:46:52 CST 2010


Module: wine
Branch: master
Commit: 8f19111325bc49bd17f2e5e78f75c9d105f7898a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8f19111325bc49bd17f2e5e78f75c9d105f7898a

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Mon Feb 22 03:18:23 2010 -0500

wordpad: Cache text length.

---

 programs/wordpad/print.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/programs/wordpad/print.c b/programs/wordpad/print.c
index 0dfce24..868f992 100644
--- a/programs/wordpad/print.c
+++ b/programs/wordpad/print.c
@@ -30,6 +30,7 @@ typedef struct _previewinfo
     int pages;
     int pages_shown;
     int *pageEnds, pageCapacity;
+    int textlength;
     HDC hdc;
     HDC hdc2;
     HDC hdcSized;
@@ -638,10 +639,12 @@ LRESULT CALLBACK preview_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
             preview.bmSize.cx = twips_to_pixels(preview.rcPage.right, GetDeviceCaps(hdc, LOGPIXELSX));
             preview.bmSize.cy = twips_to_pixels(preview.rcPage.bottom, GetDeviceCaps(hdc, LOGPIXELSY));
 
+            preview.textlength = SendMessageW(hEditorWnd, EM_GETTEXTLENGTHEX, (WPARAM)&gt, 0);
+
             fr.hdc = CreateCompatibleDC(hdc);
             fr.hdcTarget = hdcTarget;
             fr.chrg.cpMin = 0;
-            fr.chrg.cpMax = SendMessageW(hEditorWnd, EM_GETTEXTLENGTHEX, (WPARAM)&gt, 0);
+            fr.chrg.cpMax = preview.textlength;
             preview.pages = get_num_pages(hEditorWnd, fr);
             DeleteDC(fr.hdc);
             DeleteDC(hdcTarget);
@@ -1031,7 +1034,6 @@ LRESULT print_preview(HWND hwndPreview)
 /* Update for page changes. */
 static void update_preview(HWND hMainWnd)
 {
-    GETTEXTLENGTHEX gt;
     RECT paper;
     HWND hEditorWnd = GetDlgItem(hMainWnd, IDC_EDITOR);
     HWND hwndPreview = GetDlgItem(hMainWnd, IDC_PREVIEW);
@@ -1046,10 +1048,8 @@ static void update_preview(HWND hMainWnd)
     fr.rc.bottom -= margins.bottom;
     fr.rc.right -= margins.right;
 
-    gt.flags = GTL_DEFAULT;
-    gt.codepage = 1200;
     fr.chrg.cpMin = 0;
-    fr.chrg.cpMax = SendMessageW(hEditorWnd, EM_GETTEXTLENGTHEX, (WPARAM)&gt, 0);
+    fr.chrg.cpMax = preview.textlength;
 
     paper.left = 0;
     paper.right = preview.bmSize.cx;




More information about the wine-cvs mailing list