Windows: fix truncated license text in installer wizard.

This commit is contained in:
Mounir IDRASSI 2017-07-20 21:27:49 +02:00
parent 1ab09916f6
commit 0fb2befe3a
No known key found for this signature in database
GPG Key ID: DD0C382D5FCFB8FC
2 changed files with 13 additions and 5 deletions

View File

@ -120,7 +120,7 @@ IDD_INTRO_PAGE_DLG DIALOGEX 0, 0, 346, 152
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
CONTROL "",IDC_LICENSE_TEXT,"RichEdit20A",ES_MULTILINE | ES_READONLY | ES_NUMBER | WS_BORDER | WS_VSCROLL | WS_TABSTOP,0,23,345,108 CONTROL "",IDC_LICENSE_TEXT,"RichEdit20W",ES_MULTILINE | ES_READONLY | ES_NUMBER | WS_BORDER | WS_VSCROLL | WS_TABSTOP,0,23,345,108
CONTROL "",IDC_AGREE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,2,137,126,10 CONTROL "",IDC_AGREE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,2,137,126,10
LTEXT "",IDC_BOX_HELP,0,0,346,22 LTEXT "",IDC_BOX_HELP,0,0,346,22
END END

View File

@ -13,6 +13,7 @@
#include "Tcdefs.h" #include "Tcdefs.h"
#include <Shlobj.h> #include <Shlobj.h>
#include <Richedit.h>
#include <io.h> #include <io.h>
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
@ -222,10 +223,20 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{ {
char *licenseText = NULL; char *licenseText = NULL;
// increase size limit of rich edit control
SendMessage (GetDlgItem (hwndDlg, IDC_LICENSE_TEXT), EM_EXLIMITTEXT, 0, -1);
// Left margin for license text
SendMessage (GetDlgItem (hwndDlg, IDC_LICENSE_TEXT), EM_SETMARGINS, (WPARAM) EC_LEFTMARGIN, (LPARAM) CompensateXDPI (4));
licenseText = GetLegalNotices (); licenseText = GetLegalNotices ();
if (licenseText != NULL) if (licenseText != NULL)
{ {
SetWindowTextA (GetDlgItem (hwndDlg, IDC_LICENSE_TEXT), licenseText); SETTEXTEX TextInfo = {0};
TextInfo.flags = ST_SELECTION;
TextInfo.codepage = CP_ACP;
SendMessage(GetDlgItem (hwndDlg, IDC_LICENSE_TEXT), EM_SETTEXTEX, (WPARAM)&TextInfo, (LPARAM)licenseText);
free (licenseText); free (licenseText);
} }
else else
@ -258,9 +269,6 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), bLicenseAccepted); EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), bLicenseAccepted);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), FALSE); EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), FALSE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDHELP), bLicenseAccepted); EnableWindow (GetDlgItem (GetParent (hwndDlg), IDHELP), bLicenseAccepted);
// Left margin for license text
SendMessage (GetDlgItem (hwndDlg, IDC_LICENSE_TEXT), EM_SETMARGINS, (WPARAM) EC_LEFTMARGIN, (LPARAM) CompensateXDPI (4));
} }
return 1; return 1;