/* This file is part of PSPFormat, 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 "PSPChooseLayerController.h" #include "../pspformat.h" #include "../ui.h" #include "../ui_defs.h" @implementation PSPChooseLayerController - (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:@"PSPChooseLayer" owner:self]) NSLog(@"failed to load PSPChooseLayer xib"); return self; } - (int) showWindow { int i; extern int layercnt; extern PSP_layer_info_chunk *layers; [layersPopup removeAllItems]; for(i = 0; i < layercnt; ++i) [layersPopup addItemWithTitle:[NSString stringWithCString:layers[i].name]]; [layersPopup selectItemAtIndex:0]; int b = [[NSApplication sharedApplication] runModalForWindow:chooseLayerWindow]; [chooseLayerWindow orderOut:self]; return b; } - (IBAction)pickLayer:(id)sender { extern int chosenlayer; chosenlayer = [layersPopup indexOfSelectedItem]; } - (IBAction)okAction:(id)sender { [[NSApplication sharedApplication] stopModalWithCode:1]; } - (IBAction)cancelAction:(id)sender { [[NSApplication sharedApplication] stopModalWithCode:0]; } @end static PSPChooseLayerController *gController = NULL; Boolean layerdlg(){ if(!gController) gController = [[PSPChooseLayerController alloc] init]; return [gController showWindow]; } #endif