Don't display the commandline text (A trace still gives it).

Set a few fonts to avoid using the horrible system font on native
Windows.
This commit is contained in:
Hannu Valtonen 2004-06-28 23:51:55 +00:00 committed by Alexandre Julliard
parent ec596c06e9
commit 9b386b7347
1 changed files with 11 additions and 18 deletions

View File

@ -2,6 +2,7 @@
* Q&D Uninstaller (main.c) * Q&D Uninstaller (main.c)
* *
* Copyright 2000 Andreas Mohr <andi@lisas.de> * Copyright 2000 Andreas Mohr <andi@lisas.de>
* Copyright 2004 Hannu Valtonen <Hannu.Valtonen@hut.fi>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -318,11 +319,12 @@ void UninstallProgram(void)
LRESULT WINAPI MainProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) LRESULT WINAPI MainProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
HFONT static_font, listbox_font;
HDC hdc; HDC hdc;
PAINTSTRUCT ps; PAINTSTRUCT ps;
TEXTMETRIC tm; TEXTMETRIC tm;
int cxChar, cyChar, i, y, bx, maxx, maxy, wx, wy; int cxChar, cyChar, i, y, bx, maxx, maxy, wx, wy;
static HWND hwndList = 0, hwndEdit = 0; static HWND hwndList = 0, static_text = 0;
DWORD style; DWORD style;
RECT rect; RECT rect;
@ -331,6 +333,8 @@ LRESULT WINAPI MainProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
hdc = GetDC(hWnd); hdc = GetDC(hWnd);
GetTextMetrics(hdc, &tm); GetTextMetrics(hdc, &tm);
static_font = CreateFont(tm.tmHeight + tm.tmExternalLeading, 0, 0, 0, 600, FALSE, 0, 0, 0, 0, 0, 0, 0, "Times New Roman");
listbox_font = CreateFont(tm.tmHeight + tm.tmExternalLeading, 0, 0, 0, 0, TRUE, 0, 0, 0, 0, 0, 0, 0, "Times New Roman");
cxChar = tm.tmAveCharWidth; cxChar = tm.tmAveCharWidth;
cyChar = tm.tmHeight + tm.tmExternalLeading; cyChar = tm.tmHeight + tm.tmExternalLeading;
ReleaseDC(hWnd, hdc); ReleaseDC(hWnd, hdc);
@ -339,14 +343,15 @@ LRESULT WINAPI MainProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
#ifdef USE_MULTIPLESEL #ifdef USE_MULTIPLESEL
style |= LBS_MULTIPLESEL; style |= LBS_MULTIPLESEL;
#endif #endif
bx = maxx = cxChar * 5; bx = maxx = cxChar * 3;
y = maxy = cyChar * 1; y = maxy = cyChar * 1;
CreateWindow("static", program_description, static_text = CreateWindow("static", program_description,
WS_CHILD|WS_VISIBLE|SS_LEFT, WS_CHILD|WS_VISIBLE|SS_LEFT,
maxx, maxy, maxx, maxy,
cxChar * sizeof(program_description), cyChar * 1, cxChar * sizeof(program_description), cyChar * 1,
hWnd, (HMENU)1, hWnd, (HMENU)1,
((LPCREATESTRUCT)lParam)->hInstance, NULL); ((LPCREATESTRUCT)lParam)->hInstance, NULL);
SendMessage(static_text, WM_SETFONT, (WPARAM)static_font, MAKELPARAM(FALSE, 0));
maxy += cyChar * 2; /*static text + distance */ maxy += cyChar * 2; /*static text + distance */
hwndList = CreateWindow("listbox", NULL, hwndList = CreateWindow("listbox", NULL,
style, style,
@ -354,6 +359,7 @@ LRESULT WINAPI MainProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
cxChar * 50 + GetSystemMetrics(SM_CXVSCROLL), cyChar * 10, cxChar * 50 + GetSystemMetrics(SM_CXVSCROLL), cyChar * 10,
hWnd, (HMENU) 1, hWnd, (HMENU) 1,
(HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE), NULL); (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE), NULL);
SendMessage(hwndList, WM_SETFONT, (WPARAM)listbox_font, MAKELPARAM(FALSE, 0));
GetWindowRect(hwndList, &rect); GetWindowRect(hwndList, &rect);
maxx += (rect.right - rect.left)*1.1; maxx += (rect.right - rect.left)*1.1;
maxy += (rect.bottom - rect.top)*1.1; maxy += (rect.bottom - rect.top)*1.1;
@ -372,20 +378,8 @@ LRESULT WINAPI MainProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
PostQuitMessage(0); PostQuitMessage(0);
y += 2*cyChar; y += 2*cyChar;
} }
maxx += wx + cxChar * 5; maxx += wx + cxChar * 4;
CreateWindow("static", "Command line to be executed:", maxy += cyChar * 2; /* window border */
WS_CHILD|WS_VISIBLE|SS_LEFT,
bx, maxy,
cxChar * 50, cyChar,
hWnd, (HMENU)1,
((LPCREATESTRUCT)lParam)->hInstance, NULL);
maxy += cyChar;
hwndEdit = CreateWindow("edit", NULL,
WS_CHILD|WS_VISIBLE|WS_BORDER|ES_LEFT|ES_MULTILINE|ES_READONLY,
bx, maxy, maxx-(2*bx), (cyChar*2)+4,
hWnd, (HMENU)1,
((LPCREATESTRUCT)lParam)->hInstance, NULL);
maxy += (cyChar*2)+4 + cyChar * 3; /* edit ctrl + bottom border */
SetWindowPos( hWnd, 0, SetWindowPos( hWnd, 0,
0, 0, maxx, maxy, 0, 0, maxx, maxy,
SWP_NOMOVE); SWP_NOMOVE);
@ -443,7 +437,6 @@ LRESULT WINAPI MainProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
entries[sel].active ^= 1; /* toggle */ entries[sel].active ^= 1; /* toggle */
WINE_TRACE("toggling %d %s\n", entries[sel].active, WINE_TRACE("toggling %d %s\n", entries[sel].active,
wine_dbgstr_w(entries[oldsel].descr)); wine_dbgstr_w(entries[oldsel].descr));
SendMessage(hwndEdit, WM_SETTEXT, 0, (LPARAM)entries[sel].command);
oldsel = sel; oldsel = sel;
} }
} }