/* 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 */ #include #include #include #include "world.h" // must come before Photoshop include #include "str.h" #include "ui.h" void DoAbout(AboutRecordPtr prec){ ModalFilterUPP FilterProc_UPP = NewModalFilterUPP(aboutfilter); Alert(ID_ABOUTDLG, FilterProc_UPP); DisposeModalFilterUPP(FilterProc_UPP); } Boolean warndlg(char *s){ ModalFilterUPP FilterProc_UPP = NewModalFilterUPP(standardfilter); int res; ParamText(myc2pstr(s), NULL, NULL, NULL); res = CautionAlert(ID_WARNTYPEDLG, FilterProc_UPP) == ok; DisposeModalFilterUPP(FilterProc_UPP); return res; } Boolean warntype(FormatRecordPtr pb, StringPtr name, int t){ char s[0x100]; sprintf(s, "%s may not be an icon file (idType=%d).", INPLACEP2CSTR(name), t); return warndlg(s); } Boolean warnformat(FormatRecordPtr pb, StringPtr name, char *type){ char s[0x100]; sprintf(s, "%s looks like a %s file that has been improperly renamed to ICO. \ Try renaming with the correct file extension.", INPLACEP2CSTR(name), type); return warndlg(s); } Boolean pickicondialog(FormatRecordPtr pb){ ModalFilterUPP FilterProc_UPP = NewModalFilterUPP(standardfilter); short item; DIALOGREF dp; dp = GetNewDialog(ID_PICKICONDLG, NULL, (WindowPtr) -1); pickiconinit(dp); SetDialogDefaultItem(dp,ok); InitCursor(); do{ ModalDialog(FilterProc_UPP, &item); }while(pickiconitem(dp, item)); DisposeDialog(dp); DisposeModalFilterUPP(FilterProc_UPP); return item == ok; } Boolean formatdialog(FormatRecordPtr pb){ ModalFilterUPP FilterProc_UPP = NewModalFilterUPP(standardfilter); short item; DIALOGREF dp; dp = GetNewDialog(ID_FORMATDLG, NULL, (WindowPtr) -1); formatinit(dp); SetDialogDefaultItem(dp,ok); InitCursor(); do{ ModalDialog(FilterProc_UPP, &item); }while(formatitem(dp, item)); DisposeDialog(dp); DisposeModalFilterUPP(FilterProc_UPP); return item == ok; }