/* This file is part of icoformat, a Windows Icon (ICO) File Format plugin for Adobe Photoshop Copyright (C) 2002-2010 Toby Thain, toby@telegraphics.com.au This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Win32 user interface routines for cross-platform plugin */ #include "world.h" #include "PIAbout.h" #include "PIFormat.h" #include #include "ui.h" #include "version.h" BOOL CALLBACK dlgproc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam); extern HANDLE hDllInstance; void DoAbout(AboutRecordPtr pb){ MessageBox((HWND)((PlatformData*)pb->platformData)->hwnd, "ICO (Windows Icon) Format, version " VERSION_STR "\n\ Copyright 2002-2010 Toby Thain .\n\ Latest version available from http://www.telegraphics.com.au/\n\n\ If you use this program and like it, please use www.paypal.com to send the author \ what you think it is worth (US$5 suggested).\n\ Please contact the author with any bug reports, suggestions or comments.", "About ICO (Windows Icon) Format", MB_APPLMODAL|MB_ICONINFORMATION|MB_OK); } Boolean warntype(FormatRecordPtr pb, StringPtr name, int t){ char s[0x200]; sprintf(s, "%s may not be an icon file (idType=%d).\n\nContinue?", INPLACEP2CSTR(name), t); return MessageBox((HWND)((PlatformData*)pb->platformData)->hwnd, s, "Warning", MB_APPLMODAL|MB_ICONWARNING|MB_OKCANCEL) == IDOK; } Boolean warnformat(FormatRecordPtr pb, StringPtr name, char *type){ char s[0x200]; sprintf(s, "%s looks like a %s file that has been improperly renamed to ICO. \ Try renaming with the correct file extension.\n\nContinue?", INPLACEP2CSTR(name), type); return MessageBox((HWND)((PlatformData*)pb->platformData)->hwnd, s, "Warning", MB_APPLMODAL|MB_ICONWARNING|MB_OKCANCEL) == IDOK; } INT_PTR CALLBACK pickicondlgproc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam){ int item, cmd; switch(wMsg){ case WM_INITDIALOG: centre_window(hDlg); // an equivalent function can be found in PS6 SDK, WinUtilities.cpp pickiconinit(hDlg); break; case WM_COMMAND: item = LOWORD(wParam); cmd = HIWORD(wParam); if(cmd == BN_CLICKED && !pickiconitem(hDlg, item)) EndDialog(hDlg, item); break; default: return false; } return true; } Boolean pickicondialog(FormatRecordPtr pb){ return DialogBoxParam(hDllInstance, MAKEINTRESOURCE(ID_PICKICONDLG), (HWND)((PlatformData*)pb->platformData)->hwnd, pickicondlgproc, 0) == IDOK; } INT_PTR CALLBACK formatdlgproc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam){ int item, cmd; switch(wMsg){ case WM_INITDIALOG: centre_window(hDlg); // an equivalent function can be found in PS6 SDK, WinUtilities.cpp formatinit(hDlg); break; case WM_COMMAND: item = LOWORD(wParam); cmd = HIWORD(wParam); if(cmd == BN_CLICKED && !formatitem(hDlg,item)) EndDialog(hDlg,item); break; default: return false; } return true; } Boolean formatdialog(FormatRecordPtr pb){ return DialogBoxParam(hDllInstance, MAKEINTRESOURCE(ID_FORMATDLG), (HWND)((PlatformData*)pb->platformData)->hwnd, formatdlgproc, 0) == IDOK; }