/* This file is part of "scramble", a filter plugin for Adobe Photoshop Copyright (C) 2006-2013 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 */ // Loosely based on Dissolve sample plugin, CS5 SDK #ifdef __x86_64__ #import "ScrambleSettingsController.h" #include "../scramble.h" #include "../ui.h" @implementation ScrambleSettingsController - (id) init { self = [super init]; // initialize NSApplication, using an entry point that is specific to // bundles this is a no-op for Cocoa apps, but is required by Carbon apps //NSApplicationLoad(); if (![NSBundle loadNibNamed:@"ScrambleSettings" owner:self]) NSLog(@"failed to load ScrambleSettings xib"); return self; } - (int) showWindowTileWidth:(int)tilew tileHeight:(int)tileh { //[settingsWindow makeKeyAndOrderFront:nil]; [tileWidth setIntValue:tilew]; [tileHeight setIntValue:tileh]; int confirmed = [[NSApplication sharedApplication] runModalForWindow:settingsWindow]; [settingsWindow orderOut:self]; return confirmed; } - (IBAction)okAction:(id)sender { [[NSApplication sharedApplication] stopModalWithCode:1]; } - (IBAction)cancelAction:(id)sender { [[NSApplication sharedApplication] stopModalWithCode:0]; } - (int)getTileWidth { return [tileWidth intValue]; } - (int)getTileHeight { return [tileHeight intValue]; } @end static ScrambleSettingsController *gController = NULL; Boolean tile_dialog(FilterRecordPtr pb, struct params *p){ if(!gController) gController = [[ScrambleSettingsController alloc] init]; int confirmed = [gController showWindowTileWidth:p->tilew tileHeight:p->tileh]; if(confirmed){ p->tilew = [gController getTileWidth]; p->tileh = [gController getTileHeight]; } return confirmed; } #endif