3 Part of the swftools installer (Main program).
5 Copyright (c) 2004 Matthias Kramm <kramm@quiss.org>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
28 #include "installer.h"
32 #include "../config.h" //for swftools version
33 #include "../lib/os.h" //for registry functions
35 static int config_forAllUsers = 0;
36 static int config_createLinks = 0;
37 static int config_createStartmenu = 1;
38 static int config_createDesktop = 1;
40 static char path_startmenu[MAX_PATH] = "\0";
41 static char path_desktop[MAX_PATH] = "\0";
42 static char path_programfiles[MAX_PATH] = "\0";
45 extern char*license_text;
47 static char*install_path = "c:\\swftools\\";
48 static char pathBuf[1024];
49 static int do_abort = 0;
51 static char* pdf2swf_path;
53 static HBITMAP logo = 0;
57 #define USER_SETMESSAGE 0x7f01
59 void tball(HDC hdc, double px, double py, double sx, double sy)
61 MoveToEx(hdc, 75.25*sx+px, -32.50*sy+py, 0);
62 LineTo(hdc, 74.75*sx+px, -24.80*sy+py); LineTo(hdc, 74.95*sx+px, -3.45*sy+py); LineTo(hdc, 75.25*sx+px, -32.50*sy+py);
63 LineTo(hdc, 44.85*sx+px, -104.30*sy+py); LineTo(hdc, 74.75*sx+px, -24.80*sy+py); LineTo(hdc, 17.30*sx+px, -91.80*sy+py);
64 LineTo(hdc, 29.35*sx+px, -10.10*sy+py); LineTo(hdc, 74.75*sx+px, -24.80*sy+py); LineTo(hdc, 47.60*sx+px, 63.80*sy+py);
65 LineTo(hdc, 74.75*sx+px, 51.10*sy+py); LineTo(hdc, 74.95*sx+px, -3.45*sy+py);
66 MoveToEx(hdc, 74.75*sx+px, 51.10*sy+py, 0);
67 LineTo(hdc, 29.35*sx+px, 118.75*sy+py); LineTo(hdc, -45.20*sx+px, 155.35*sy+py);
68 LineTo(hdc, -127.95*sx+px, 145.10*sy+py); LineTo(hdc, -194.85*sx+px, 104.30*sy+py);
69 LineTo(hdc, -225.25*sx+px, 32.50*sy+py); LineTo(hdc, -224.75*sx+px, -51.10*sy+py);
70 LineTo(hdc, -179.35*sx+px, -118.75*sy+py); LineTo(hdc, -104.80*sx+px, -155.35*sy+py);
71 LineTo(hdc, -22.05*sx+px, -145.10*sy+py); LineTo(hdc, 44.85*sx+px, -104.30*sy+py);
72 LineTo(hdc, 17.30*sx+px, -91.80*sy+py); LineTo(hdc, -75.00*sx+px, -122.60*sy+py);
73 LineTo(hdc, -45.20*sx+px, -43.70*sy+py); LineTo(hdc, 17.30*sx+px, -91.80*sy+py);
74 LineTo(hdc, -22.05*sx+px, -145.10*sy+py); LineTo(hdc, -75.00*sx+px, -122.60*sy+py);
75 LineTo(hdc, -104.80*sx+px, -155.35*sy+py); LineTo(hdc, -167.30*sx+px, -107.25*sy+py);
76 LineTo(hdc, -75.00*sx+px, -122.60*sy+py); LineTo(hdc, -127.95*sx+px, -63.55*sy+py);
77 LineTo(hdc, -45.20*sx+px, -43.70*sy+py); LineTo(hdc, 29.35*sx+px, -10.10*sy+py);
78 LineTo(hdc, 47.60*sx+px, 63.80*sy+py); LineTo(hdc, -25.70*sx+px, 52.45*sy+py);
79 LineTo(hdc, -25.70*sx+px, 128.45*sy+py); LineTo(hdc, 47.60*sx+px, 63.80*sy+py);
80 LineTo(hdc, 29.35*sx+px, 118.75*sy+py); LineTo(hdc, -25.70*sx+px, 128.45*sy+py);
81 LineTo(hdc, -45.20*sx+px, 155.35*sy+py); LineTo(hdc, -118.85*sx+px, 143.85*sy+py);
82 LineTo(hdc, -127.95*sx+px, 145.10*sy+py);
83 MoveToEx(hdc, -179.35*sx+px, -118.75*sy+py, 0);
84 LineTo(hdc, -167.30*sx+px, -107.25*sy+py); LineTo(hdc, -127.95*sx+px, -63.55*sy+py);
85 LineTo(hdc, -118.85*sx+px, 21.65*sy+py); LineTo(hdc, -45.20*sx+px, -43.70*sy+py);
86 LineTo(hdc, -25.70*sx+px, 52.45*sy+py); LineTo(hdc, 29.35*sx+px, -10.10*sy+py);
87 MoveToEx(hdc, -225.25*sx+px, 32.50*sy+py, 0);
88 LineTo(hdc, -194.85*sx+px, -17.85*sy+py); LineTo(hdc, -224.75*sx+px, -51.10*sy+py);
89 LineTo(hdc, -167.30*sx+px, -107.25*sy+py); LineTo(hdc, -194.85*sx+px, -17.85*sy+py);
90 LineTo(hdc, -127.95*sx+px, -63.55*sy+py);
91 MoveToEx(hdc, -175.85*sx+px, 77.60*sy+py, 0);
92 LineTo(hdc, -96.35*sx+px, 99.55*sy+py); LineTo(hdc, -118.85*sx+px, 21.65*sy+py);
93 LineTo(hdc, -175.85*sx+px, 77.60*sy+py); LineTo(hdc, -225.25*sx+px, 32.50*sy+py);
94 MoveToEx(hdc, -118.85*sx+px, 143.85*sy+py, 0);
95 LineTo(hdc, -175.85*sx+px, 77.60*sy+py); LineTo(hdc, -194.85*sx+px, 104.30*sy+py);
96 LineTo(hdc, -118.85*sx+px, 143.85*sy+py); LineTo(hdc, -96.35*sx+px, 99.55*sy+py);
97 LineTo(hdc, -25.70*sx+px, 52.45*sy+py); LineTo(hdc, -118.85*sx+px, 21.65*sy+py);
98 LineTo(hdc, -194.85*sx+px, -17.85*sy+py); LineTo(hdc, -175.85*sx+px, 77.60*sy+py);
99 MoveToEx(hdc, -96.35*sx+px, 99.55*sy+py, 0);
100 LineTo(hdc, -25.70*sx+px, 128.45*sy+py); LineTo(hdc, -118.85*sx+px, 143.85*sy+py);
103 static HWND wnd_background = 0;
104 LRESULT CALLBACK WindowFunc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
106 if(message == WM_CREATE) {
107 CREATESTRUCT*cs = ((LPCREATESTRUCT)lParam);
108 if(cs->lpCreateParams && !strcmp((char*)cs->lpCreateParams, "background")) {
109 wnd_background = hwnd;
112 if(hwnd == wnd_background && message == WM_PAINT) {
116 GetWindowRect(hwnd, &rc);
117 int width = rc.right - rc.left;
118 int height = rc.bottom - rc.top;
120 hdc = BeginPaint(hwnd, &ps);
121 SetBkMode(hdc, TRANSPARENT);
123 double s = width / 1282.0;
125 HPEN pen0 = CreatePen(PS_SOLID, 2, RGB(0, 32, 128));
126 HPEN oldPen = (HPEN)SelectObject(hdc, pen0);
127 tball(hdc, 0.7*width,0.2*height,s,s);
129 HPEN pen1 = CreatePen(PS_SOLID, 2, RGB(0, 48, 128));
130 (HPEN)SelectObject(hdc, pen1);
131 tball(hdc, 0.233*width,0.3*height,s*2,s*2);
133 HPEN pen2 = CreatePen(PS_SOLID, 2, RGB(0, 64, 128));
134 (HPEN)SelectObject(hdc, pen2);
135 tball(hdc, width, 1.2*height,s*3,-s*3);
137 SelectObject(hdc, oldPen);
143 return DefWindowProc(hwnd, message, wParam, lParam);
146 void processMessages()
149 while(PeekMessage(&msg,NULL,0,0,0))
151 GetMessage(&msg, NULL, 0, 0);
152 TranslateMessage(&msg);
153 DispatchMessage(&msg);
157 int addRegistryEntries(char*install_dir)
160 ret = setRegistryEntry("Software\\quiss.org\\swftools\\InstallPath", install_dir);
165 int CreateShortcut(char*path, char*description, char*filename, char*arguments, int iconindex, char*iconpath, char*workdir)
167 WCHAR wszFilename[MAX_PATH];
168 IShellLink *ps1 = NULL;
169 IPersistFile *pPf = NULL;
171 hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, (void*)&ps1);
172 if(FAILED(hr)) return 0;
173 hr = ps1->lpVtbl->QueryInterface(ps1, &IID_IPersistFile, (void **)&pPf);
174 if(FAILED(hr)) return 0;
175 hr = ps1->lpVtbl->SetPath(ps1, path);
176 if(FAILED(hr)) return 0;
177 hr = ps1->lpVtbl->SetDescription(ps1, description);
180 hr = ps1->lpVtbl->SetArguments(ps1, arguments);
181 if(FAILED(hr)) return 0;
184 hr = ps1->lpVtbl->SetIconLocation(ps1, iconpath, iconindex);
185 if (FAILED(hr)) return 0;
188 hr = ps1->lpVtbl->SetWorkingDirectory(ps1, workdir);
189 if (FAILED(hr)) return 0;
191 MultiByteToWideChar(CP_ACP, 0, filename, -1, wszFilename, MAX_PATH);
192 hr = pPf->lpVtbl->Save(pPf, wszFilename, TRUE);
196 pPf->lpVtbl->Release(pPf);
197 ps1->lpVtbl->Release(ps1);
201 BOOL CALLBACK PropertySheetFuncCommon(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, int buttons)
205 HWND dialog = GetParent(hwnd);
207 if(message == WM_INITDIALOG) {
209 SendDlgItemMessage(hwnd, IDC_BITMAP, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)logo);
212 GetWindowRect(dialog, &rc);
213 int width = rc.right - rc.left;
214 int height = rc.bottom - rc.top;
215 MoveWindow(dialog, (GetSystemMetrics(SM_CXSCREEN) - width)/2, (GetSystemMetrics(SM_CYSCREEN) - height)/2, width, height, FALSE);
219 if(message == WM_NOTIFY && (((LPNMHDR)lParam)->code == PSN_SETACTIVE)) {
220 PropSheet_SetWizButtons(dialog, buttons);
226 BOOL CALLBACK PropertySheetFunc1(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
227 if(message == WM_INITDIALOG) {
228 SetDlgItemText(hwnd, IDC_LICENSE, license_text);
230 return PropertySheetFuncCommon(hwnd, message, wParam, lParam, PSWIZB_NEXT);
232 BOOL CALLBACK PropertySheetFunc2(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
233 if(message == WM_INITDIALOG) {
234 SetDlgItemText(hwnd, IDC_INSTALL_PATH, install_path);
236 config_forAllUsers = 0;
237 SendDlgItemMessage(hwnd, IDC_ALLUSERS, BM_SETCHECK, config_forAllUsers, 0);
238 SendDlgItemMessage(hwnd, IDC_CURRENTUSER, BM_SETCHECK, config_forAllUsers^1, 0);
240 if(message == WM_COMMAND) {
241 if((wParam&0xffff) == IDC_BROWSE) {
243 memset(&browse, 0, sizeof(browse));
244 browse.ulFlags = BIF_EDITBOX | BIF_NEWDIALOGSTYLE | BIF_USENEWUI;// | BIF_RETURNONLYFSDIRS; //BIF_VALIDATE
245 browse.pszDisplayName = (CHAR*)malloc(MAX_PATH);
246 memset(browse.pszDisplayName, 0, MAX_PATH);
247 browse.lpszTitle = "Select installation directory";
248 printf("Start browsing %s\n", browse.pszDisplayName);
249 browse.pidlRoot = SHBrowseForFolder(&browse);
250 printf("Browsing returns %s / %08x\n", browse.pszDisplayName, browse.pidlRoot);
251 if(browse.pszDisplayName) {
252 if(SHGetPathFromIDList(browse.pidlRoot, browse.pszDisplayName)) {
253 printf("Path is %s\n", browse.pszDisplayName);
254 install_path = browse.pszDisplayName;
257 SendDlgItemMessage(hwnd, IDC_INSTALL_PATH, WM_SETTEXT, 0, (LPARAM)install_path);
261 else if((wParam&0xffff) == IDC_ALLUSERS) {
262 config_forAllUsers = 1;
263 SendDlgItemMessage(hwnd, IDC_ALLUSERS, BM_SETCHECK, config_forAllUsers, 0);
264 SendDlgItemMessage(hwnd, IDC_CURRENTUSER, BM_SETCHECK, config_forAllUsers^1, 0);
266 else if((wParam&0xffff) == IDC_CURRENTUSER) {
267 config_forAllUsers = 0;
268 SendDlgItemMessage(hwnd, IDC_ALLUSERS, BM_SETCHECK, config_forAllUsers, 0);
269 SendDlgItemMessage(hwnd, IDC_CURRENTUSER, BM_SETCHECK, config_forAllUsers^1, 0);
271 else if((wParam&0xffff) == IDC_INSTALL_PATH) {
272 SendDlgItemMessage(hwnd, IDC_INSTALL_PATH, WM_GETTEXT, sizeof(pathBuf), (LPARAM)&(pathBuf[0]));
274 install_path = pathBuf;
279 return PropertySheetFuncCommon(hwnd, message, wParam, lParam, PSWIZB_BACK|PSWIZB_NEXT);
282 static int progress_pos = 0;
283 void PropertyArchiveStatus(int type, char*text)
285 if(text && text[0]=='[') return;
286 SetDlgItemText(statuswnd, IDC_INFO, strdup(text));
288 /* There are usually 6 messages, and a range of 54 to fill, so
291 SendDlgItemMessage(statuswnd, IDC_PROGRESS, PBM_SETPOS, ++progress_pos, 0);
297 int ret = MessageBox(0, text, "Error", MB_RETRYCANCEL|MB_ICONERROR);
298 if(ret==IDRETRY) continue;
303 BOOL CALLBACK PropertySheetFunc3(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
304 HWND dialog = GetParent(hwnd);
305 if(message == WM_INITDIALOG) {
306 SetDlgItemText(hwnd, IDC_INFO, "Ready to install");
308 if(message == WM_NOTIFY && (((LPNMHDR)lParam)->code == PSN_WIZNEXT)) {
309 PropSheet_SetWizButtons(dialog, 0);
310 SendMessage(dialog, PSM_CANCELTOCLOSE, 0, 0); //makes wine display a warning
311 SetDlgItemText(hwnd, IDC_TITLE, "Installing files...");
313 SendDlgItemMessage(hwnd, IDC_PROGRESS, PBM_SETRANGE, 0, (LPARAM)MAKELONG(0,54));
315 SendDlgItemMessage(hwnd, IDC_PROGRESS, PBM_SETPOS, progress_pos, 0);
316 int success = unpack_archive(crndata, install_path, PropertyArchiveStatus);
319 return PropertySheetFuncCommon(hwnd, message, wParam, lParam, PSWIZB_BACK|PSWIZB_NEXT);
322 static HRESULT (WINAPI *f_SHGetSpecialFolderPath)(HWND hwnd, LPTSTR lpszPath, int nFolder, BOOL fCreate);
324 BOOL CALLBACK PropertySheetFunc4(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
325 if(message == WM_INITDIALOG) {
326 pdf2swf_path = concatPaths(install_path, "pdf2swf_gui.exe");
327 FILE*fi = fopen(pdf2swf_path, "rb");
329 config_createLinks = 1;
332 if(!config_createLinks) {
333 SendDlgItemMessage(hwnd, IDC_STARTMENU, SW_HIDE, 0, 0);
334 SendDlgItemMessage(hwnd, IDC_DESKTOP, SW_HIDE, 0, 0);
337 SendDlgItemMessage(hwnd, IDC_STARTMENU, BM_SETCHECK, config_createStartmenu, 0);
338 SendDlgItemMessage(hwnd, IDC_DESKTOP, BM_SETCHECK, config_createStartmenu, 0);
340 if(message == WM_COMMAND) {
341 if((wParam&0xffff) == IDC_STARTMENU) {
342 config_createStartmenu = SendDlgItemMessage(hwnd, IDC_STARTMENU, BM_GETCHECK, 0, 0);
343 config_createStartmenu^=1;
344 SendDlgItemMessage(hwnd, IDC_STARTMENU, BM_SETCHECK, config_createStartmenu, 0);
347 if((wParam&0xffff) == IDC_DESKTOP) {
348 config_createDesktop = SendDlgItemMessage(hwnd, IDC_DESKTOP, BM_GETCHECK, 0, 0);
349 config_createDesktop^=1;
350 SendDlgItemMessage(hwnd, IDC_DESKTOP, BM_SETCHECK, config_createDesktop, 0);
355 if(message == WM_NOTIFY && (((LPNMHDR)lParam)->code == PSN_WIZFINISH)) {
356 if(!addRegistryEntries(install_path)) {
357 MessageBox(0, "Couldn't create Registry Entries", "SWFTools Install", MB_OK|MB_ICONERROR);
361 char mypath[MAX_PATH];
362 path_startmenu[0] = 0;
364 if(config_forAllUsers) {
365 f_SHGetSpecialFolderPath(NULL, path_desktop, CSIDL_COMMON_DESKTOPDIRECTORY, 0);
366 f_SHGetSpecialFolderPath(NULL, path_startmenu, CSIDL_COMMON_PROGRAMS, 0);
368 /* get local program/desktop directory- this is both for forAllUsers=0 as well
369 as a fallback if the above didn't return any paths */
370 if(!path_startmenu[0]) {
371 f_SHGetSpecialFolderPath(NULL, path_startmenu, CSIDL_PROGRAMS, 0);
373 if(!path_desktop[0]) {
374 f_SHGetSpecialFolderPath(NULL, path_desktop, CSIDL_DESKTOPDIRECTORY, 0);
377 if(config_createLinks) {
378 if(config_createDesktop && path_desktop[0]) {
379 char* linkName = concatPaths(path_desktop, "pdf2swf.lnk");
380 printf("Creating desktop link %s -> %s\n", linkName, pdf2swf_path);
381 if(!CreateShortcut(pdf2swf_path, "pdf2swf", linkName, 0, 0, 0, install_path)) {
382 MessageBox(0, "Couldn't create desktop shortcut", "Install.exe", MB_OK);
386 if(config_createStartmenu && path_startmenu[0]) {
387 char* group = concatPaths(path_startmenu, "pdf2swf");
388 CreateDirectory(group, 0);
389 char* linkName = concatPaths(group, "pdf2swf.lnk");
390 printf("Creating %s -> %s\n", linkName, pdf2swf_path);
391 if(!CreateShortcut(pdf2swf_path, "pdf2swf", linkName, 0, 0, 0, install_path)) {
392 MessageBox(0, "Couldn't create start menu entry", "Install.exe", MB_OK);
397 printf("not creating desktop/startmenu links\n");
400 return PropertySheetFuncCommon(hwnd, message, wParam, lParam, PSWIZB_FINISH);
403 #ifndef PSP_HIDEHEADER
404 #define PSP_HIDEHEADER 2048
407 typedef struct _wizardpage {
412 void runPropertySheet(HWND parent)
414 PROPSHEETHEADER sheet;
416 wizardpage_t wpage[5] = {
417 {PropertySheetFunc1, IDD_LICENSE},
418 {PropertySheetFunc2, IDD_INSTALLDIR},
419 {PropertySheetFunc3, IDD_PROGRESS},
420 {PropertySheetFunc4, IDD_FINISH},
422 int num = sizeof(wpage)/sizeof(wpage[0]);
423 HPROPSHEETPAGE pages[num];
427 memset(&page, 0, sizeof(PROPSHEETPAGE));
428 page.dwSize = sizeof(PROPSHEETPAGE);
429 page.dwFlags = PSP_DEFAULT|PSP_HIDEHEADER;
431 page.pfnDlgProc = wpage[t].function;
432 page.pszTemplate = MAKEINTRESOURCE(wpage[t].resource);
433 pages[t] = CreatePropertySheetPage(&page);
436 memset(&sheet, 0, sizeof(PROPSHEETHEADER));
437 sheet.dwSize = sizeof(PROPSHEETHEADER);
438 sheet.hInstance = me;
439 sheet.hwndParent = parent;
440 sheet.phpage = pages;
441 sheet.dwFlags = PSH_WIZARD;
443 PropertySheet(&sheet);
446 int WINAPI WinMain(HINSTANCE _me,HINSTANCE hPrevInst,LPSTR lpszArgs, int nWinMode)
449 WNDCLASSEX wcl_background;
450 wcl_background.hInstance = me;
451 wcl_background.lpfnWndProc = WindowFunc;
452 wcl_background.lpszClassName= "SWFTools Install";
453 wcl_background.style = CS_HREDRAW | CS_VREDRAW;
454 wcl_background.hIcon = LoadIcon(NULL, IDI_APPLICATION);
455 wcl_background.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
456 wcl_background.hCursor = LoadCursor(NULL, IDC_ARROW);
457 wcl_background.lpszMenuName = NULL; //no menu
458 wcl_background.cbClsExtra = 0;
459 wcl_background.cbWndExtra = 0;
460 wcl_background.hbrBackground= CreateSolidBrush(RGB(0, 0, 128));
461 wcl_background.cbSize = sizeof(WNDCLASSEX);
463 HINSTANCE shell32 = LoadLibrary("shell32.dll");
465 MessageBox(0, "Could not load shell32.dll", "Install.exe", MB_OK);
468 f_SHGetSpecialFolderPath = (HRESULT (WINAPI*)(HWND,LPTSTR,int,BOOL))GetProcAddress(shell32, "SHGetSpecialFolderPathA");
469 if(!f_SHGetSpecialFolderPath) {
470 MessageBox(0, "Could not load shell32.dll", "Install.exe", MB_OK);
474 HRESULT coret = CoInitialize(NULL);
476 MessageBox(0, "Could not initialize COM interface", "Install.exe", MB_OK);
480 path_programfiles[0] = 0;
481 f_SHGetSpecialFolderPath(NULL, path_programfiles, CSIDL_PROGRAM_FILES, 0);
483 if(!RegisterClassEx(&wcl_background)) {
484 MessageBox(0, "Could not register window background class", "Install.exe", MB_OK);
488 HWND background = CreateWindow(wcl_background.lpszClassName, "Setup SWFTools",
490 GetSystemMetrics(SM_CXFULLSCREEN),
491 GetSystemMetrics(SM_CYFULLSCREEN),
493 (void*)"background");
496 MessageBox(0, "Could not create installation background window", "Install.exe", MB_OK);
500 ShowWindow(background, SW_SHOWMAXIMIZED);
501 SetForegroundWindow(background);
502 UpdateWindow(background);
504 logo = LoadBitmap(me, "SWFTOOLS");
506 install_path = getRegistryEntry("Software\\quiss.org\\swftools\\InstallPath");
507 if(!install_path || !install_path[0]) {
508 if(path_programfiles[0]) {
509 install_path = concatPaths(path_programfiles, "SWFTools");
511 install_path = "c:\\swftools\\";
516 InitCommonControls();
519 GetWindowRect(background, &r);
520 int xx = 320, yy = 200;
521 if(r.right - r.left > 320)
522 xx = r.right - r.left;
523 if(r.right - r.left > 200)
524 yy = r.bottom - r.top;
527 runPropertySheet(background);