/* LineQueryPanel.m Implementation of the LineQueryPanel class for the ProjectManager application. Copyright (C) 2005 Saso Kiselkov 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #import "LineQueryPanel.h" #import #import #import #import #import #import #import @implementation LineQueryPanel static LineQueryPanel * shared = nil; + shared { if (shared == nil) { shared = [self new]; } return shared; } - init { if ([super init]) { [NSBundle loadNibNamed: @"LineQueryPanel" owner: self]; return self; } else { return nil; } } - (void) awakeFromNib { [icon setImage: [NSApp applicationIconImage]]; } - (int) runModal { int code; [panel selectKeyViewFollowingView: okButton]; code = [NSApp runModalForWindow: panel]; [panel close]; return code; } - (unsigned int) unsignedIntValue { return (unsigned int) [textField intValue]; } - (void) ok: sender { int value; value = [textField intValue]; if (value > 0) { [NSApp stopModalWithCode: NSOKButton]; } else { NSRunAlertPanel(_(@"Invalid line"), _(@"You must specify a positive integer."), nil, nil, nil); } } - (void) cancel: sender { [NSApp stopModalWithCode: NSCancelButton]; } @end