/* This file is part of WebPFormat, a 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 */ // Loosely based on Dissolve sample plugin, CS5 SDK #ifdef __x86_64__ #import "WebPEncodeQualityController.h" #include "../webpformat.h" #include "../ui.h" @implementation WebPEncodeQualityController - (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:@"WebPEncodeQuality" owner:self]) NSLog(@"failed to load WebPEncodeQuality nib"); return self; } - (int) showWindowQuality:(unsigned)q profile:(unsigned)p denoising:(unsigned)d sharpness:(unsigned)s { [qualitySlider setIntValue:q]; [qualityPct setIntValue:q]; [profileSelector selectCellWithTag:p]; [denoisingSlider setIntValue:d]; [sharpnessSlider setIntValue:s]; //[pickFormatWindow makeKeyAndOrderFront:nil]; int b = [[NSApplication sharedApplication] runModalForWindow:encodeQualityWindow]; [encodeQualityWindow orderOut:self]; return b; } - (unsigned) getQuality { return [qualityPct intValue]; } - (unsigned) getProfile { return [[profileSelector selectedCell] tag]; } - (unsigned) getDenoising { return [denoisingSlider intValue]; } - (unsigned) getSharpness { return [sharpnessSlider intValue]; } - (IBAction) okAction:(id)sender { // Take from text field, because user might have entered text // without triggering the action that updates the slider. [[NSApplication sharedApplication] stopModalWithCode:1]; } - (IBAction) cancelAction:(id)sender { [[NSApplication sharedApplication] stopModalWithCode:0]; } @end static WebPEncodeQualityController *gController = NULL; Boolean encode_options_dlg(FormatRecordPtr pb, intptr_t *data){ unsigned res; if(!gController) gController = [[WebPEncodeQualityController alloc] init]; res = [gController showWindowQuality:G(encode_quality) profile:G(profile) denoising:G(denoising) sharpness:G(sharpness) ]; if(res){ G(encode_quality) = [gController getQuality]; G(profile) = [gController getProfile]; G(denoising) = [gController getDenoising]; G(sharpness) = [gController getSharpness]; } return res; } #endif