Changes to correct the set name issue as well as some of the code to facilitate standalone views.:

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@17643 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2003-09-09 01:28:46 +00:00
parent 130af7186b
commit 5829d599d0
10 changed files with 328 additions and 13 deletions

View file

@ -1,3 +1,16 @@
2003-09-08 Gregory John Casamento <greg_casamento@yahoo.com>
* GormViewWindow.[hm]: Provides a holder for standalone views
in Gorm.
2003-09-08 Andy Ruder <aeruder@kse.edu>
comitted by Gregory Casamento
* GormSetName.gorm: New gorm file for setname panel.
* GormSetNameController.[hm]: Controls the actions of the panel
* Gorm.m: Modified the portion of code which calls the
panel
2003-09-07 Gregory John Casamento <greg_casamento@yahoo.com>
* GormInspectorsManager.m: Similar to the previous check. Modified

View file

@ -125,6 +125,7 @@ Gorm_RESOURCE_FILES = \
Resources/GormScrollViewAttributesInspector.gorm \
Resources/GormClassInspector.gorm \
Resources/GormFontView.gorm \
Resources/GormSetName.gorm \
Resources/Gorm.gorm
Gorm_HEADERS = \
@ -157,6 +158,7 @@ Gorm_HEADERS = \
GormHeadersPref.h \
GormClassInspector.h \
GormFontViewController.h \
GormSetNameController.h \
GormGeneralPref.h
@ -199,6 +201,7 @@ Gorm_OBJC_FILES = \
GormHeadersPref.m \
GormClassInspector.m \
GormFontViewController.m \
GormSetNameController.m \
GormGeneralPref.m

19
Gorm.m
View file

@ -26,6 +26,7 @@
#include "GormPrivate.h"
#include "GormPrefController.h"
#include "GormFontViewController.h"
#include "GormSetNameController.h"
// for templates...
#include <AppKit/NSControl.h>
@ -806,21 +807,16 @@ NSString *GormDidDeleteClassNotification = @"GormDidDeleteClassNotification";
- (void) setName: (id)sender
{
NSPanel *panel;
GormSetNameController *panel;
int returnPanel;
NSTextField *textField;
NSArray *selectionArray = [selectionOwner selection];
id obj = [selectionArray objectAtIndex: 0];
NSString *name;
panel = NSGetAlertPanel(_(@"Set Name"), _(@"Name: "), _(@"OK"), _(@"Cancel"), nil);
textField = [[NSTextField alloc] initWithFrame: NSMakeRect(60,46,240,20)];
[[panel contentView] addSubview: textField];
[panel makeFirstResponder: textField];
[panel makeKeyAndOrderFront: self];
[textField performClick: self];
returnPanel = [(id) panel runModal];
panel = [GormSetNameController new];
returnPanel = [panel runAsModal];
textField = [panel textField];
if (returnPanel == NSAlertDefaultReturn)
{
@ -830,12 +826,9 @@ NSString *GormDidDeleteClassNotification = @"GormDidDeleteClassNotification";
[[self activeDocument] setName: name forObject: obj];
}
}
[textField removeFromSuperview];
RELEASE(textField);
NSReleaseAlertPanel(panel);
RELEASE(panel);
}
- (void) guideline: (id) sender
{
[[NSNotificationCenter defaultCenter] postNotificationName: GormToggleGuidelineNotification

27
GormSetNameController.h Normal file
View file

@ -0,0 +1,27 @@
// Author: Andrew E. Ruder
// Copyright (C) 2003 by Free Software Foundation, Inc
@class GormSetNameController;
#ifndef GORM_SET_NAME_CONTROLLER_H
#define GORM_SET_NAME_CONTROLLER_H
#include <Foundation/NSObject.h>
@class NSButton, NSPanel, NSTextField;
@interface GormSetNameController : NSObject
{
NSPanel *window;
NSTextField *textField;
NSButton *okButton;
NSButton *cancelButton;
}
- (int)runAsModal;
- (NSTextField *) textField;
- (void) cancelHit: (id)sender;
- (void) okHit: (id)sender;
@end
#endif

56
GormSetNameController.m Normal file
View file

@ -0,0 +1,56 @@
// Author: Andrew E. Ruder
// Copyright (C) 2003 by Free Software Foundation, Inc
#include "GormSetNameController.h"
#include <AppKit/NSApplication.h>
#include <AppKit/NSButton.h>
#include <AppKit/NSTextField.h>
#include <AppKit/NSPanel.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSPanel.h>
@implementation GormSetNameController : NSObject
- (void)dealloc
{
RELEASE(window);
RELEASE(textField);
RELEASE(okButton);
RELEASE(cancelButton);
[super dealloc];
}
- (int)runAsModal
{
int result;
if (!window)
{
if (![NSBundle loadNibNamed: @"GormSetName" owner: self])
{
return NSAlertAlternateReturn;
}
}
[window makeKeyAndOrderFront: nil];
[window makeFirstResponder: textField];
result = [NSApp runModalForWindow: window];
return result;
}
- (NSTextField *) textField
{
return textField;
}
- (void) cancelHit: (id)sender
{
[window close];
[NSApp stopModalWithCode: NSAlertAlternateReturn];
}
- (void) okHit: (id)sender
{
[window close];
[NSApp stopModalWithCode: NSAlertDefaultReturn];
}
@end

11
GormViewWindow.h Normal file
View file

@ -0,0 +1,11 @@
#include <AppKit/NSWindow.h>
#include <AppKit/NSView.h>
@interface GormViewWindow : NSWindow
{
NSView *_view;
}
- (id) initWithView: (NSView *)view;
- (void) setView: (NSView *) view;
- (NSView *)view;
@end

52
GormViewWindow.m Normal file
View file

@ -0,0 +1,52 @@
#include "GormViewWindow.h"
#include <AppKit/NSWindow.h>
#include <AppKit/NSView.h>
#include <Foundation/NSNotification.h>
@implementation GormViewWindow
- (id) initWithView: (NSView *)view
{
// initializer yourself....
if((self = [super init]) != nil)
{
ASSIGN(_view,view);
[self setDelegate: self];
}
return self;
}
- (void) _resizeView
{
NSRect newFrame = [[self contentView] frame];
newFrame.origin.x += 10;
newFrame.origin.y += 10;
newFrame.size.height -= 10;
newFrame.size.width -= 10;
[_view setFrame: newFrame];
}
- (void) setView: (NSView *) view
{
if(_view != nil)
{
[_view removeFromSuperview];
}
ASSIGN(_view,view);
[self _resizeView];
[[self contentView] addSubview: _view];
}
- (NSView *) view
{
return _view;
}
- (void) windowDidResize: (NSNotification *)notification
{
if(_view != nil)
{
[self _resizeView];
}
}
@end

Binary file not shown.

View file

@ -0,0 +1,160 @@
{
FirstResponder = {
Actions = (
"activateContextHelpMode:",
"alignCenter:",
"alignJustified:",
"alignLeft:",
"alignRight:",
"arrangeInFront:",
"cancel:",
"capitalizeWord:",
"changeColor:",
"changeFont:",
"checkSpelling:",
"close:",
"complete:",
"copy:",
"copyFont:",
"copyRuler:",
"cut:",
"delete:",
"deleteBackward:",
"deleteForward:",
"deleteToBeginningOfLine:",
"deleteToBeginningOfParagraph:",
"deleteToEndOfLine:",
"deleteToEndOfParagraph:",
"deleteToMark:",
"deleteWordBackward:",
"deleteWordForward:",
"deminiaturize:",
"deselectAll:",
"fax:",
"hide:",
"hideOtherApplications:",
"indent:",
"loosenKerning:",
"lowerBaseline:",
"lowercaseWord:",
"makeKeyAndOrderFront:",
"miniaturize:",
"miniaturizeAll:",
"moveBackward:",
"moveBackwardAndModifySelection:",
"moveDown:",
"moveDownAndModifySelection:",
"moveForward:",
"moveForwardAndModifySelection:",
"moveLeft:",
"moveRight:",
"moveToBeginningOfDocument:",
"moveToBeginningOfLine:",
"moveToBeginningOfParagraph:",
"moveToEndOfDocument:",
"moveToEndOfLine:",
"moveToEndOfParagraph:",
"moveUp:",
"moveUpAndModifySelection:",
"moveWordBackward:",
"moveWordBackwardAndModifySelection:",
"moveWordForward:",
"moveWordForwardAndModifySelection:",
"newDocument:",
"ok:",
"openDocument:",
"orderBack:",
"orderFront:",
"orderFrontColorPanel:",
"orderFrontDataLinkPanel:",
"orderFrontFontPanel:",
"orderFrontHelpPanel:",
"orderFrontStandardAboutPanel:",
"orderFrontStandardInfoPanel:",
"orderOut:",
"pageDown:",
"pageUp:",
"paste:",
"pasteAsPlainText:",
"pasteAsRichText:",
"pasteFont:",
"pasteRuler:",
"performClose:",
"performMiniaturize:",
"performZoom:",
"print:",
"raiseBaseline:",
"revertDocumentToSaved:",
"runPageLayout:",
"runToolbarCustomizationPalette:",
"saveAllDocuments:",
"saveDocument:",
"saveDocumentAs:",
"saveDocumentTo:",
"scrollLineDown:",
"scrollLineUp:",
"scrollPageDown:",
"scrollPageUp:",
"scrollViaScroller:",
"selectAll:",
"selectLine:",
"selectNextKeyView:",
"selectParagraph:",
"selectPreviousKeyView:",
"selectText:",
"selectText:",
"selectToMark:",
"selectWord:",
"showContextHelp:",
"showGuessPanel:",
"showHelp:",
"showWindow:",
"stop:",
"subscript:",
"superscript:",
"swapWithMark:",
"takeDoubleValueFrom:",
"takeFloatValueFrom:",
"takeIntValueFrom:",
"takeObjectValueFrom:",
"takeStringValueFrom:",
"terminate:",
"tightenKerning:",
"toggle:",
"toggleContinuousSpellChecking:",
"toggleRuler:",
"toggleToolbarShown:",
"toggleTraditionalCharacterShape:",
"transpose:",
"transposeWords:",
"turnOffKerning:",
"turnOffLigatures:",
"underline:",
"unhide:",
"unhideAllApplications:",
"unscript:",
"uppercaseWord:",
"useAllLigatures:",
"useStandardKerning:",
"useStandardLigatures:",
"yank:",
"zoom:",
"okHit:",
"cancelHit:"
);
Super = NSObject;
};
GormSetNameController = {
Actions = (
"okHit:",
"cancelHit:"
);
Outlets = (
cancelButton,
okButton,
window,
textField
);
Super = NSObject;
};
}

Binary file not shown.