Huw Davies : comdlg32: Give update_margin_edits the ability to update just one edit control if required .
Alexandre Julliard
julliard at winehq.org
Tue Jan 20 08:27:44 CST 2009
Module: wine
Branch: master
Commit: 11e028be8e62c5e952880bc9dc5d4b90a83ba892
URL: http://source.winehq.org/git/wine.git/?a=commit;h=11e028be8e62c5e952880bc9dc5d4b90a83ba892
Author: Huw Davies <huw at codeweavers.com>
Date: Mon Jan 19 12:50:51 2009 +0000
comdlg32: Give update_margin_edits the ability to update just one edit control if required.
---
dlls/comdlg32/printdlg.c | 35 ++++++++++++++++++++++++-----------
1 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c
index 8217d0a..41ead34 100644
--- a/dlls/comdlg32/printdlg.c
+++ b/dlls/comdlg32/printdlg.c
@@ -2864,18 +2864,31 @@ if(msg == EN_CHANGE){ \
FIXME("could not get dlgitemtexta for %x\n",id); \
}
-static void update_margin_edits(HWND hDlg, const PageSetupDataA *pda)
+static inline LONG *element_from_margin_id(RECT *rc, WORD id)
+{
+ switch(id)
+ {
+ case edt4: return &rc->left;
+ case edt5: return &rc->top;
+ case edt6: return &rc->right;
+ case edt7: return &rc->bottom;
+ }
+ return NULL;
+}
+
+static void update_margin_edits(HWND hDlg, const PageSetupDataA *pda, WORD id)
{
WCHAR str[100];
+ WORD idx;
- size2str(pda, pda->dlga->rtMargin.left, str);
- SetDlgItemTextW(hDlg, edt4, str);
- size2str(pda, pda->dlga->rtMargin.top, str);
- SetDlgItemTextW(hDlg, edt5, str);
- size2str(pda, pda->dlga->rtMargin.right, str);
- SetDlgItemTextW(hDlg, edt6, str);
- size2str(pda, pda->dlga->rtMargin.bottom, str);
- SetDlgItemTextW(hDlg, edt7, str);
+ for(idx = edt4; idx <= edt7; idx++)
+ {
+ if(id == 0 || id == idx)
+ {
+ size2str(pda, *element_from_margin_id(&pda->dlga->rtMargin, idx), str);
+ SetDlgItemTextW(hDlg, idx, str);
+ }
+ }
}
static void set_margin_groupbox_title(HWND hDlg, const PageSetupDataA *pda)
@@ -2949,7 +2962,7 @@ PRINTDLG_PS_WMCommandA(
GlobalUnlock(pda->dlga->hDevMode);
rotate_rect(&pda->dlga->rtMargin, (id == rad2));
- update_margin_edits(hDlg, pda);
+ update_margin_edits(hDlg, pda, 0);
PRINTDLG_PS_ChangePaperPrev(pda);
}
@@ -3409,7 +3422,7 @@ PRINTDLG_PageDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
pda->dlga->rtMargin.right = size;
pda->dlga->rtMargin.bottom = size;
}
- update_margin_edits(hDlg, pda);
+ update_margin_edits(hDlg, pda, 0);
subclass_margin_edits(hDlg);
set_margin_groupbox_title(hDlg, pda);
More information about the wine-cvs
mailing list