mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
Forge: New -- a preferences panel. Doesn't do anything yet, but that's
only because I haven't created the main prefs view class yet. Trust me, it's going to work. I think. :) Anyway, what code there is works, and is linked into the menu -- just hit Info -> Preferences... to see it.
This commit is contained in:
parent
35ae176c4a
commit
9f1f89f8f1
16 changed files with 612 additions and 22 deletions
|
@ -1,8 +1,43 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
/*
|
||||
Controller.h
|
||||
|
||||
Application controller class
|
||||
|
||||
Copyright (C) 2001 Dusk to Dawn Computing, Inc.
|
||||
|
||||
Author: Jeff Teunissen <deek@d2dc.net>
|
||||
Date: 5 Nov 2001
|
||||
|
||||
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:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "Config.h"
|
||||
#endif
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSNotification.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <AppKit/NSApplication.h>
|
||||
|
||||
@interface Controller: NSObject
|
||||
{
|
||||
@public
|
||||
}
|
||||
|
||||
// App delegate methods
|
||||
|
@ -25,5 +60,6 @@
|
|||
- (void) open: (id) sender;
|
||||
- (void) openProject: (id) sender;
|
||||
- (void) saveAll: (id) sender;
|
||||
- (void) showPreferencesPanel: (id) sender;
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
/*
|
||||
Controller.m
|
||||
Controller.h
|
||||
|
||||
Controller class for Forge
|
||||
Application controller class
|
||||
|
||||
Copyright (C) 2001 Jeff Teunissen <deek@quakeforge.net>
|
||||
Copyright (C) 2001 Dusk to Dawn Computing, Inc.
|
||||
|
||||
Author: Jeff Teunissen <deek@d2dc.net>
|
||||
Date: 5 Nov 2001
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
|
@ -22,17 +25,24 @@
|
|||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "Config.h"
|
||||
#endif
|
||||
|
||||
#import <AppKit/NSApplication.h>
|
||||
#import <AppKit/NSMenu.h>
|
||||
#import "Controller.h"
|
||||
#import "Preferences.h"
|
||||
#import "PrefsController.h"
|
||||
|
||||
@implementation Controller
|
||||
|
||||
static PrefsController *prefsController = nil;
|
||||
|
||||
- (BOOL) application: (NSApplication *) app openFile: (NSString *) filename;
|
||||
{
|
||||
return NO;
|
||||
|
@ -96,6 +106,18 @@
|
|||
NSLog (@"This _would_ save, but it doesn't.");
|
||||
}
|
||||
|
||||
- (void) showPreferencesPanel: (id) sender;
|
||||
{
|
||||
NSDebugLog (@"Showing Preferences panel...");
|
||||
|
||||
if (!prefsController)
|
||||
prefsController = [[PrefsController alloc] init];
|
||||
|
||||
[prefsController orderFrontPreferencesPanel: self];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
Notifications
|
||||
*/
|
||||
|
@ -148,7 +170,7 @@
|
|||
action: @selector (orderFrontStandardAboutPanel:)
|
||||
keyEquivalent: @""];
|
||||
[info addItemWithTitle: _(@"Preferences...")
|
||||
action: @selector (orderFrontPreferencesPanel:)
|
||||
action: @selector (showPreferencesPanel:)
|
||||
keyEquivalent: @""];
|
||||
[info addItemWithTitle: _(@"Help")
|
||||
action: @selector (orderFrontHelpPanel:)
|
||||
|
@ -246,7 +268,7 @@
|
|||
brush = [[[NSMenu alloc] init] autorelease];
|
||||
[menu setSubmenu: brush forItem: [menu itemWithTitle: _(@"Brush")]];
|
||||
|
||||
[brush addItemWithTitle: _(@"none") action: @selector(nothing:) keyEquivalent: @""];
|
||||
[brush addItemWithTitle: _(@"None") action: @selector(nothing:) keyEquivalent: @""];
|
||||
|
||||
/*
|
||||
Windows
|
||||
|
|
33
tools/Forge/Documentation/Template.h
Normal file
33
tools/Forge/Documentation/Template.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
Template.h
|
||||
|
||||
class name, if any -- otherwise what it's for
|
||||
|
||||
Copyright (C) 2001 Dusk to Dawn Computing, Inc.
|
||||
Additional copyrights here
|
||||
|
||||
Author: Your Name <your@email.address>
|
||||
Date: today
|
||||
|
||||
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:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "Config.h"
|
||||
#endif
|
37
tools/Forge/Documentation/Template.m
Normal file
37
tools/Forge/Documentation/Template.m
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
Template.m
|
||||
|
||||
class name, if any -- otherwise what it's for
|
||||
|
||||
Copyright (C) 2001 Dusk to Dawn Computing, Inc.
|
||||
Additional copyrights here
|
||||
|
||||
Author: Your Name <your@email.address>
|
||||
Date: today
|
||||
|
||||
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:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "Config.h"
|
||||
#endif
|
||||
|
||||
#import "Template.h"
|
|
@ -34,3 +34,11 @@
|
|||
"Hide" = "Hide";
|
||||
|
||||
"Quit" = "Quit";
|
||||
|
||||
/* Preferences Window buttons */
|
||||
|
||||
"Preferences" = "Preferences";
|
||||
|
||||
"OK" = "OK";
|
||||
"Cancel" = "Cancel";
|
||||
"Apply" = "Apply";
|
||||
|
|
|
@ -77,6 +77,13 @@
|
|||
);
|
||||
Super = NSResponder;
|
||||
};
|
||||
NewClass = {
|
||||
Actions = (
|
||||
);
|
||||
Outlets = (
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
Preferences = {
|
||||
Actions = (
|
||||
ok:,
|
||||
|
@ -95,4 +102,11 @@
|
|||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
PrefsWindowController = {
|
||||
Actions = (
|
||||
);
|
||||
Outlets = (
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
}
|
Binary file not shown.
|
@ -3,9 +3,11 @@
|
|||
ApplicationIcon = "Forge.tiff";
|
||||
ApplicationName = Forge;
|
||||
ApplicationRelease = "0.1.0 (Development)";
|
||||
Authors = ("Jeff Teunissen <deek@quakeforge.net>", "Bill Currie <taniwha@quakeforge.net>");
|
||||
Copyright = "Copyright (C) 2002 Dusk To Dawn Computing";
|
||||
ApplicationURL = "http://www.quakeforge.net/Forge/";
|
||||
Authors = (
|
||||
"Jeff Teunissen <deek@d2dc.net>",
|
||||
);
|
||||
Copyright = "Copyright (C) 2001 Dusk To Dawn Computing";
|
||||
CopyrightDescription = "This program is released under the GNU General Public License";
|
||||
FullVersionID = "0.1.0 (Development)";
|
||||
URL = "http://www.quakeforge.net/Forge/";
|
||||
}
|
||||
|
|
|
@ -65,7 +65,9 @@ Forge_LANGUAGES= \
|
|||
#
|
||||
Forge_HEADERS= \
|
||||
Controller.h \
|
||||
Preferences.h
|
||||
Preferences.h \
|
||||
PrefsPanel.h \
|
||||
PrefsController.h
|
||||
|
||||
#
|
||||
# Class files
|
||||
|
@ -73,6 +75,8 @@ Forge_HEADERS= \
|
|||
Forge_OBJC_FILES= \
|
||||
Controller.m \
|
||||
Preferences.m \
|
||||
PrefsPanel.m \
|
||||
PrefsController.m \
|
||||
main.m
|
||||
|
||||
#
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
/*
|
||||
Preferences.h
|
||||
|
||||
Preferences class definition for Forge
|
||||
Preferences class
|
||||
|
||||
Copyright (C) 2001 Jeff Teunissen <deek@d2dc.net>
|
||||
Copyright (C) 2001 Dusk to Dawn Computing, Inc.
|
||||
|
||||
Author: Jeff Teunissen <deek@d2dc.net>
|
||||
Date: 9 Feb 2001
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
|
@ -22,14 +25,14 @@
|
|||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "Config.h"
|
||||
#endif
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
/*
|
||||
Preferences.m
|
||||
|
||||
Preferences class for Forge
|
||||
Preferences class
|
||||
|
||||
Copyright (C) 2001 Jeff Teunissen <deek@quakeforge.net>
|
||||
Copyright (C) 2001 Dusk to Dawn Computing, Inc.
|
||||
|
||||
Author: Jeff Teunissen <deek@d2dc.net>
|
||||
Date: 9 Feb 2001
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
|
@ -22,10 +25,15 @@
|
|||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "Config.h"
|
||||
#endif
|
||||
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSNotification.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSUserDefaults.h>
|
||||
|
|
58
tools/Forge/PrefsController.h
Normal file
58
tools/Forge/PrefsController.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
PrefsWindowController.h
|
||||
|
||||
Preferences window controller class
|
||||
|
||||
Copyright (C) 2001 Dusk to Dawn Computing, Inc.
|
||||
|
||||
Author: Jeff Teunissen <deek@d2dc.net>
|
||||
Date: 11 Nov 2001
|
||||
|
||||
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:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "Config.h"
|
||||
#endif
|
||||
|
||||
#import <AppKit/NSWindowController.h>
|
||||
|
||||
@interface PrefsController: NSWindowController
|
||||
{
|
||||
NSMutableArray *prefsViews;
|
||||
}
|
||||
|
||||
- (id) init;
|
||||
- (void) dealloc;
|
||||
|
||||
/*
|
||||
Notification methods
|
||||
*/
|
||||
- (void) windowWillClose: (NSNotification *) aNotification;
|
||||
|
||||
/***
|
||||
Stuff we do in our subclass
|
||||
***/
|
||||
- (void) orderFrontPreferencesPanel: (id) sender;
|
||||
- (void) addPrefsView: (id) aPrefsView;
|
||||
|
||||
- (void) savePreferences: (id) sender;
|
||||
- (void) savePreferencesAndCloseWindow: (id) sender;
|
||||
|
||||
@end
|
119
tools/Forge/PrefsController.m
Normal file
119
tools/Forge/PrefsController.m
Normal file
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
PrefsController.m
|
||||
|
||||
Preferences window controller class
|
||||
|
||||
Copyright (C) 2001 Dusk to Dawn Computing, Inc.
|
||||
|
||||
Author: Jeff Teunissen <deek@d2dc.net>
|
||||
Date: 11 Nov 2001
|
||||
|
||||
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:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "Config.h"
|
||||
#endif
|
||||
|
||||
#import <AppKit/NSApplication.h>
|
||||
|
||||
#import "PrefsController.h"
|
||||
#import "PrefsPanel.h"
|
||||
|
||||
@implementation PrefsController
|
||||
|
||||
- (id) init
|
||||
{
|
||||
PrefsPanel *prefsPanel;
|
||||
|
||||
prefsViews = [[NSMutableArray alloc] initWithCapacity: 5];
|
||||
|
||||
prefsPanel = [[PrefsPanel alloc]
|
||||
initWithContentRect: NSMakeRect (250, 250, 516, 386)
|
||||
styleMask: NSTitledWindowMask
|
||||
| NSMiniaturizableWindowMask
|
||||
| NSClosableWindowMask
|
||||
backing: NSBackingStoreRetained
|
||||
defer: NO
|
||||
];
|
||||
[prefsPanel setTitle: _(@"Preferences")];
|
||||
|
||||
[super initWithWindow: prefsPanel];
|
||||
[prefsPanel initUI];
|
||||
[prefsPanel setDelegate: self];
|
||||
[prefsPanel release];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
NSDebugLog (@"PrefsController -dealloc");
|
||||
|
||||
[prefsViews release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) windowWillClose: (NSNotification *) aNotification
|
||||
{
|
||||
}
|
||||
|
||||
- (void) orderFrontPreferencesPanel: (id) sender
|
||||
{
|
||||
[[self window] makeKeyAndOrderFront: self];
|
||||
return;
|
||||
}
|
||||
|
||||
- (void) savePreferencesAndCloseWindow: (id) sender
|
||||
{
|
||||
[self savePreferences: self];
|
||||
[[self window] close];
|
||||
}
|
||||
|
||||
- (void) savePreferences: (id) sender
|
||||
{
|
||||
NSEnumerator *enumerator = [prefsViews objectEnumerator];
|
||||
id current;
|
||||
|
||||
NSDebugLog (@"Saving all preferences...");
|
||||
while ((current = [enumerator nextObject])) {
|
||||
[current savePrefs: self];
|
||||
}
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
- (void) addPrefsView: (id) aPrefsView;
|
||||
{
|
||||
PrefsPanel *prefsPanel;
|
||||
|
||||
prefsPanel = (PrefsPanel *) [self window];
|
||||
|
||||
if (! [prefsViews containsObject: aPrefsView]) {
|
||||
[prefsViews addObject: aPrefsView];
|
||||
[aPrefsView autorelease];
|
||||
}
|
||||
|
||||
[[prefsPanel prefsViewBox] setContentView: aPrefsView];
|
||||
[[prefsPanel prefsViewBox] display];
|
||||
}
|
||||
|
||||
@end
|
56
tools/Forge/PrefsPanel.h
Normal file
56
tools/Forge/PrefsPanel.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
PrefsWindow.h
|
||||
|
||||
Preferences window class
|
||||
|
||||
Copyright (C) 2001 Dusk to Dawn Computing, Inc.
|
||||
|
||||
Author: Jeff Teunissen <deek@d2dc.net>
|
||||
Date: 11 Nov 2001
|
||||
|
||||
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:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "Config.h"
|
||||
#endif
|
||||
|
||||
#import <AppKit/NSBox.h>
|
||||
#import <AppKit/NSMatrix.h>
|
||||
#import <AppKit/NSPanel.h>
|
||||
|
||||
@interface PrefsPanel: NSPanel
|
||||
{
|
||||
@private
|
||||
int _topTag;
|
||||
|
||||
@public
|
||||
NSBox *prefsViewBox;
|
||||
NSMatrix *prefsViewList;
|
||||
}
|
||||
|
||||
- (void) initUI;
|
||||
- (void) dealloc;
|
||||
|
||||
- (void) addPrefsViewButtonWithDescription: (NSString *) desc andImage: (NSImage *) img;
|
||||
|
||||
- (NSBox *) prefsViewBox;
|
||||
- (NSMatrix *) prefsViewList;
|
||||
|
||||
@end
|
152
tools/Forge/PrefsPanel.m
Normal file
152
tools/Forge/PrefsPanel.m
Normal file
|
@ -0,0 +1,152 @@
|
|||
/*
|
||||
PrefsWindow.m
|
||||
|
||||
Preferences window class
|
||||
|
||||
Copyright (C) 2001 Dusk to Dawn Computing, Inc.
|
||||
|
||||
Author: Jeff Teunissen <deek@d2dc.net>
|
||||
Date: 11 Nov 2001
|
||||
|
||||
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:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "Config.h"
|
||||
#endif
|
||||
|
||||
#import <AppKit/NSButton.h>
|
||||
#import <AppKit/NSButtonCell.h>
|
||||
#import <AppKit/NSFont.h>
|
||||
#import <AppKit/NSMatrix.h>
|
||||
#import <AppKit/NSScrollView.h>
|
||||
|
||||
#import "PrefsPanel.h"
|
||||
|
||||
@implementation PrefsPanel
|
||||
|
||||
- (void) initUI
|
||||
{
|
||||
NSButton *ok, *apply, *cancel;
|
||||
NSButtonCell *prototype;
|
||||
NSScrollView *iconScrollView;
|
||||
|
||||
_topTag = 0; // This is for the matrix
|
||||
|
||||
/*
|
||||
Window dimensions:
|
||||
|
||||
8-pixel space on all sides
|
||||
Box is 242 pixels high, 500 wide
|
||||
Scroll area is 86 pixels tall, 500 wide
|
||||
content view size: (520, 414)
|
||||
*/
|
||||
|
||||
prefsViewBox = [[NSBox alloc] initWithFrame: NSMakeRect (8, 40, 500, 242)];
|
||||
[prefsViewBox setTitlePosition: NSNoTitle];
|
||||
[prefsViewBox setBorderType: NSGrooveBorder];
|
||||
|
||||
[[self contentView] addSubview: prefsViewBox];
|
||||
|
||||
/* Prototype button for the matrix */
|
||||
prototype = [[[NSButtonCell alloc] init] autorelease];
|
||||
[prototype setButtonType: NSPushOnPushOffButton];
|
||||
[prototype setImagePosition: NSImageOverlaps];
|
||||
|
||||
/* The matrix itself -- horizontal */
|
||||
prefsViewList = [[NSMatrix alloc] initWithFrame: NSMakeRect (8, 290, 500, 86)];
|
||||
[prefsViewList setCellSize: NSMakeSize (64, 64)];
|
||||
[prefsViewList setMode: NSRadioModeMatrix];
|
||||
[prefsViewList setPrototype: prototype];
|
||||
[prefsViewList setTarget: [self windowController]];
|
||||
[prefsViewList setAction: @selector(cellWasClicked:)];
|
||||
[prefsViewList addRow]; // No columns yet, they'll get added as views do
|
||||
|
||||
iconScrollView = [[NSScrollView alloc] initWithFrame: NSMakeRect (8, 290, 500, 86)];
|
||||
[iconScrollView autorelease];
|
||||
[iconScrollView setHasHorizontalScroller: YES];
|
||||
[iconScrollView setHasVerticalScroller: NO];
|
||||
[iconScrollView setDocumentView: prefsViewList];
|
||||
[[self contentView] addSubview: iconScrollView];
|
||||
|
||||
/* Create the buttons */
|
||||
// OK
|
||||
ok = [[NSButton alloc] initWithFrame: NSMakeRect (312, 8, 60, 24)];
|
||||
[ok autorelease];
|
||||
|
||||
[ok setTitle: _(@"OK")];
|
||||
[ok setTarget: [self windowController]];
|
||||
[ok setAction: @selector(savePreferencesAndCloseWindow:)];
|
||||
[[self contentView] addSubview: ok];
|
||||
|
||||
// cancel
|
||||
cancel = [[NSButton alloc] initWithFrame: NSMakeRect (380, 8, 60, 24)];
|
||||
[cancel autorelease];
|
||||
|
||||
[cancel setTitle: _(@"Cancel")];
|
||||
[cancel setTarget: self];
|
||||
[cancel setAction: @selector(close)];
|
||||
[[self contentView] addSubview: cancel];
|
||||
|
||||
// apply
|
||||
apply = [[NSButton alloc] initWithFrame: NSMakeRect (448, 8, 60, 24)];
|
||||
[apply autorelease];
|
||||
|
||||
[apply setTitle: _(@"Apply")];
|
||||
[apply setTarget: [self windowController]];
|
||||
[apply setAction: @selector(savePreferences:)];
|
||||
[[self contentView] addSubview: apply];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
NSDebugLog (@"PrefsWindow -dealloc");
|
||||
[prefsViewBox release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) addPrefsViewButtonWithDescription: (NSString *) desc andImage: (NSImage *) img
|
||||
{
|
||||
NSButtonCell *button = [[NSButtonCell alloc] init];
|
||||
|
||||
[button setTag: _topTag++];
|
||||
[button setTitle: desc];
|
||||
[button setFont: [NSFont systemFontOfSize: 8]];
|
||||
[button setImage: img];
|
||||
[button setImagePosition: NSImageAbove];
|
||||
[prefsViewList addColumnWithCells: [NSArray arrayWithObject: button]];
|
||||
[prefsViewList sizeToCells];
|
||||
[prefsViewList setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
- (NSBox *) prefsViewBox
|
||||
{
|
||||
return prefsViewBox;
|
||||
}
|
||||
|
||||
- (NSMatrix *) prefsViewList
|
||||
{
|
||||
return prefsViewList;
|
||||
}
|
||||
|
||||
@end
|
38
tools/Forge/PrefsView.h
Normal file
38
tools/Forge/PrefsView.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
PrefsView.h
|
||||
|
||||
Definition for all PrefsView implementations
|
||||
|
||||
Copyright (C) 2001 Dusk to Dawn Computing, Inc.
|
||||
|
||||
Author: Jeff Teunissen <deek@d2dc.net>
|
||||
Date: 11 Nov 2001
|
||||
|
||||
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:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "Config.h"
|
||||
#endif
|
||||
|
||||
#import <AppKit/NSView.h>
|
||||
|
||||
@interface PrefsView: NSView
|
||||
{
|
||||
}
|
Loading…
Reference in a new issue