Merged post 1.0 branch. Gorm 1.0 development will continue on a new gorm_1_0 branch.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@21614 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2005-08-06 17:59:08 +00:00
parent 4b9b7ec20b
commit a2bd3f3fda
113 changed files with 5970 additions and 3089 deletions

361
ChangeLog
View file

@ -1,3 +1,364 @@
2005-08-06 11:33 Gregory John Casamento <greg_casamento@yahoo.com>
* Merge from post 1.0 branch.
2005-08-03 07:57 Gregory John Casamento <greg_casamento@yahoo.com>
* Palettes/2Controls/GormStepperAttributesInspector.m: Removed call
to setNeedsDisplay in ok: method.
2005-08-03 07:11 Gregory John Casamento <greg_casamento@yahoo.com>
* Palettes/4Data/inspectors.m: Removed local declaration of
GormViewSizeInspector, added include of new header, added
copyright header.
2005-08-03 06:20 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GNUmakefile: Added new GormViewSizeInspector.h file, split
out from the GormViewSizeInspector.h file.
* GormCore/GormViewSizeInspector.m: Removed interface, put into .h
* GormCore/GormViewSizeInspector.h: Moved interface here.
* Palettes/1Windows/GormNSWindowSizeInspector.gorm: Corrected position
and sizing of elements in size inspector.
* Palettes/1Windows/GormWindowAttributesInspector.m: Corrected comment,
added copyright header.
* Palettes/1Windows/GormWindowSizeInspector.m: Corrected comment,
added copyright header.
* Palettes/1Windows/main.m: Added category for NSPanel to add
allocSubstitute. Same as change on HEAD.
* Palettes/2Controls/GormBoxAttributesInspector.[hm]: Added copyright
header.
* Palettes/2Controls/GormCellAttributesInspector.[hm]: Added copyright
header.
* Palettes/2Controls/GormColorWellAttributesInspector.[hm]: Added
copyright header.
* Palettes/2Controls/GormFormAttributesInspector.m:
Added copyright header.
* Palettes/2Controls/GormMatrixAttributesInspector.m: Corrected
comment.
* Palettes/2Controls/GormPopUpButtonAttributesInspector.m: Corrected
comment.
* Palettes/2Controls/GormProgressIndicatorAttributesInspector.m:
Corrected comment.
* Palettes/2Controls/GormSliderAttributesInspector.m: Corrected
comment.
* Palettes/2Controls/GormStepperAttributesInspector.m: Corrected
comment.
* Palettes/2Controls/GormTextFieldAttributesInspector.m: Corrected
comment.
* Palettes/3Containers/GNUmakefile: Added table size inspector files.
* Palettes/3Containers/GormBrowserAttributesInspector.m: Corrected
comment.
* Palettes/3Containers/GormNSOutlineView.[hm]: Added copyright header.
* Palettes/3Containers/GormTableColumnAttributesInspector.[hm]: Added
copyright header. Corrected comment.
* Palettes/3Containers/GormTableColumnSizeInspector.m: Corrected
comment.
* Palettes/3Containers/GormTableViewAttributesInspector.m: Corrected
comment.
* Palettes/3Containers/GormTableViewSizeInspector.[hm]: Re-added this
as it was previously removed.
* Palettes/3Containers/GormTabViewAttributesInspector.m: Corrected
comment.
* Palettes/3Containers/inspectors.m: Moved all categories from
containers to here.
* Palettes/4Data/GormImageViewAttributesInspector.m: Corrected
comment.
* Palettes/4Data/GormNSComboBoxAttributesInspector.m: Corrected
comment.
* Palettes/4Data/GormTextViewAttributesInspector.m: Corrected
comment.
2005-08-02 Fabien VALLON <fabien@sonappart.net>
* Palettes/2Controls/GormBoxAttributesInspector.m : split file
use ok: revert:, clean up and comments. Add NSBox IBObjectAdditions
category
* Palettes/2Controls/GormBoxAttributesInspector.h : split file
clean up and comments
* Palettes/2Controls/GormCellAttributesInspector.m: split file
use ok: revert: , clean up and comments. Add NSCell IBObjectAdditions
category
* Palettes/2Controls/GormCellAttributesInspector.h: split file
clean up and comments.
* Palettes/2Controls/GormFormAttributesInspector.m: split file
use ok: revert:, replace optionMatrix by cellPositionSwitch,
editableSwitch,selectableSwitch, and scrollableSwitch.
clean up and comments.
Add NSForm IBObjectAdditions category
* Palettes/2Controls/GormFormAttributesInspector.h: split file
replace optionMatrix by cellPositionSwitch,editableSwitch,
selectableSwitch, and scrollableSwitch. clean up and comments.
* Palettes/2Controls/GormNSFormInspector.gorm:
replace optionMatrix by cellPositionSwitch,editableSwitch,
selectableSwitch, and scrollableSwitch. setNextKeyView
* Palettes/2Controls/GormMatrixdAttributesInspector.m: split file
use ok: revert:. clean up and comments. Add NSMatrix IBObjectAdditions
category
* Palettes/2Controls/GormMatrixdAttributesInspector.h: split file
clean up and comments
* Palettes/2Controls/GormPopUpButtonAttributesInspector.m: split file
use ok: revert:, clean up and comments. Add NSPopUpButton
IBObjectAdditions category
* Palettes/2Controls/GormPopUpButtonAttributesInspector.h : split file
clean up and comments
* Palettes/2Controls/GormSliderAttributesInspector.m: split file
use ok: revert:, clean up and comments. Add NSSlider IBObjectAdditions
category. Remove : altForm, knobField, numberOfTicks,snapToTicks,
tickPosition
Rename : valueForm into valuesForm. clean up & comments.
* Palettes/2Controls/GormSliderAttributesInspector.h: split file
clean up and comments
* Palettes/2Controls/GormNSSliderInspector.gorm :
Remove : altForm, knobField, numberOfTicks,snapToTicks,tickPosition
Rename : valueForm into valuesForm.
Remove : ok: target for NSForms ( use delegate )
* Palettes/2Controls/GormStepperAttributesInspector.m: split file
use ok: revert: clean up and comments. Add NSStepper IBObjectAdditions
category
* Palettes/2Controls/GormStepperAttributesInspector.h: split file
Clean up and comments
* Palettes/2Controls/GormTextFieldAttributesInspector.m: split file
use ok: revert. replace optionsMatrix by editableSwitch,
selectableSwitch,scrollableSwitch. clean up and comments.
Add NSTextField IBObjectAdditions category.
* Palettes/2Controls/GormTextFieldAttributesInspector.h: split file
replace optionsMatrix by editableSwitch, selectableSwitch,
scrollableSwitch. clean up and comments.
* Palettes/2Controls/GormNSTextFieldInspector.gorm:
replace optionsMatrix by editableSwitch, selectableSwitch
andscrollableSwitch. set NextKeyView:
* Palettes/2Controls/GormColorWellAttributesInspector.m: split file
renamed bordered in borderedSwitch, initialColor in initialColorWell,
disabled in disabledSwitch, tagValue in tagField.
remove initialColorSelected:, disabledSelected:, borderedSelected:.
use ok: revert: clean up and comments.
* Palettes/2Controls/GormColorWellAttributesInspector.h: split file
renamed bordered in borderedSwitch, initialColor in initialColorWell,
disabled in disabledSwitch, tagValue in tagField.
remove initialColorSelected:, disabledSelected:, borderedSelected:.
Clean up and comments.
* Palettes/2Controls/GormColorWellInspector.gorm:
renamed bordered in borderedSwitch, initialColor in initialColorWell,
disabled in disabledSwitch, tagValue in tagField.
remove initialColorSelected:, disabledSelected:, borderedSelected:.
tagField remove ok: target ( use delegate )
* Palettes/2Controls/GormProgressIndicatorAttributesInspector.m :
split file emove doubleValue; borderMatrix. use ok: revert:
Clean up and comments
* Palettes/2Controls/GormProgressIndicatorAttributesInspector.h :
split file remove doubleValue; borderMatrix. Clean up and comments
* Palettes/2Controls/GormNSProgressIndicatorInspector.gorm:
remove doubleValue; borderMatrix
* Palettes/3Containers/GormBrowserAttributesInspector.m : split file
use ok: revert: , use multipleSelectionSwitch, emptySelectionSwitch,
branchSelectionSwitch,separateColumnsSwitch,horizontalScrollerSwitch,
and displayTitlesSwitch instead of optionMatrix.clean up and comments
Add NSBrowser category ( IBObjectAdditions )
* Palettes/3Containers/GormBrowserAttributesInspector.h : split file
use multipleSelectionSwitch, emptySelectionSwitch,
branchSelectionSwitch,separateColumnsSwitch,horizontalScrollerSwitch,
and displayTitlesSwitch instead of optionMatrix. clean up and comments
* Palettes/3Containers/GormNSBrowserInspector.gorm:
use multipleSelectionSwitch, emptySelectionSwitch,
branchSelectionSwitch,separateColumnsSwitch,horizontalScrollerSwitch,
and displayTitlesSwitch instead of optionMatrix. set nextKeyView:
* Palettes/3Containers/GormTableViewAttributesInspector.m: split file
use ok: revert:, replace selectionMatrix by multipleSelectionSwitch,
emptySelectionSwith and columnSelectionSwitch,
replace optionMatrix by drawgridSwitch, resizingSwitch and
reorderingSwitch.clean up and comments.
Add NSTableView category ( IBObjectAdditions )
* Palettes/3Containers/GormTableViewAttributesInspector.h: split file
replace selectionMatrix by multipleSelectionSwitch,emptySelectionSwith
and columnSelectionSwitch.
replace optionMatrix by drawgridSwitch, resizingSwitch
and reorderingSwitch.clean up and comments.
* Palettes/3Containers/GormNSTableViewInspector.gorm :
replace selectionMatrix
by multipleSelectionSwitch,emptySelectionSwith and
columnSelectionSwitch. replace optionMatrix by drawgridSwitch,
resizingSwitch and reorderingSwitch.set nextKeyView:
* Palettes/3Containers/GormTableColumnAttributesInspector.m : split file
clean up, comments and warnings ( TODO )
Add NSTableColumn category ( IBObjectAdditions )
* Palettes/3Containers/GormTableColumnAttributesInspector.h : split file
clean up and comments
* Palettes/3Containers/GormTableColumnSizeInspector.m: split file
use controlTextDidChange: for the form, clean up and comments.
Add IBObjectAdditionsSize category
* Palettes/3Containers/GormTableColumnSizeInspector.h: split file
clean up and comments.
* Palettes/3Containers/
GormNSTableColumnSizeInspector.gorm: remove
ok: taget ( use delegate )
* Palettes/3Containers/GNUmakefile : add
GormBrowserAttributesInspector.m
GormTabViewAttributesInspector.m, GormTableColumnAttributesInspector.m
GormTableColumnSizeInspector.m and GormTableViewAttributesInspector.
* Palettes/3Containers/inspector.m : remove
GormBrowserAttributesInspector
GormTabViewAttributesInspector, GormTableColumnAttributesInspector
GormTableColumnSizeInspector and GormTableViewAttributesInspector
* Palettes/4Data/GormComboBoxAttributesInspector.m: split file
* Palettes/4Data/GormImageViewAttributesInspector.m: split file
use ok:, revert:, clean up and comments
* Palettes/4Data/GormImageViewAttributesInspector.h: split file
clean up
* Palettes/4Data/GormTextViewAttributesInspector.m: split file
replace optionsMatrix by selectableButton, editableButton,
multipleFontsButtonand graphicsButton, clean up and comments.
Add NSTextView IBObjectAdditions category
* Palettes/4Data/GormTextViewAttributesInspector.h: split file
replace optionsMatrix by selectableButton, editableButton,
multipleFontsButton and graphicsButton, clean up and comments
* Palettes/4Data/GormNSTextViewInspector.gorm: replace optionsMatrix
by selectableButton, editableButton, multipleFontsButton and
graphicsButton
2005-08-01 20:30 Gregory John Casamento <greg_casamento@yahoo.com>
* English.lproj/GormPreferences.gorm: Add keyboard equivalents
to dropdown for preference panels.
2005-08-01 07:59 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormClassInspector.m: Return an autoreleased copy of the
class name from _currentClass.
2005-08-01 05:45 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormClassInspector.m: Remove dopy code from _currentClass.
* GormCore/GormPrivate.m: Use ASSIGNCOPY in initWithClassName:
* Palettes/1Windows/main.m: Removed FIXME, since Gorm shouldn't
show the window decoration changes directly.
2005-07-31 19:14 Gregory John Casamento <greg_casamento@yahoo.com>
* Palettes/1Windows/main.m: Addition of allocSubstitute method for
NSPanel in the category GormPrivate.
2005-07-31 18:56 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormDocument.m: Correction for bug#13990.
* GormCore/GormInspectorsManager.m: Removed uneeded GormISelectionView
class.
2005-07-31 10:57 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormInspectorsManager.m: [GormConnectionsInspector ok:]
Removed code which blanks out the connector. This allows the user
to select connections repeatedly. Suggested by Matt Rice.
2005-07-31 08:43 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormPrivate.m: Reverted previous change in init.
2005-07-30 15:57 Gregory John Casamento <greg_casamento@yahoo.com>
* English.lproj/GormPreferences.gorm: Changed class hierarchy. Also
added panel outlet.
* GormCore/GormClassInspector.m: -[GormClassInspector _currentClass]
copy the className.
* GormCore/GormPrivate.m: -[GormClassProxy init] copy the className.
* Gorm.m: Changed to initialize preferences panel using init.
* GormPrefs/GormPrefController.[hm]: Added panel method, changed
derivation to a subclass of NSObject, instead of NSWindowController.
2005-07-30 09:30 Gregory John Casamento <greg_casamento@yahoo.com>
* Documentation/Makefile.postamble: Generate documentation from
headers only.
* GormPrefs/GormColorsPref.h
* GormPrefs/GormGeneralPref.h
* GormPrefs/GormGeneralPref.m
* GormPrefs/GormGuidelinePref.h
* GormPrefs/GormHeadersPref.h
* GormPrefs/GormPalettesPref.h
* GormPrefs/GormPrefController.h
* GormPrefs/GormShelfPref.h: Added documentation.
2005-07-30 04:29 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormFilePrefsManager.h: Added documentation.
2005-07-30 04:16 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormDocument.m: use versionOfClass: in
_replaceObjectsWithTemplates: method.
* GormCore/GormFilePrefsManager.[hm]: Added versionOfClass:.
2005-07-30 Fabien VALLON <fabien@sonappart.net>
* Palettes/1Window/GormWindowAttributesInspector.[mh] : split files.
use ok: revert: methods, remove controls & options Matrix,
& replace it by a set of switch buttons. Clean up & comments
* Palettes/1Window/GormWindowSizeInspector.{m,h} :split files.
use ok: revert: methods. Clean up & comments
* Palettes/1Window/main.m : remove GormWindowSizeInspector,
GormWindowAttributesInspector classes and move IBObjectAdditions
categories into GormWindowAttributesInspector and GormSizeInspector.
* Palettes/1Window/GormNSWindowInspector.gorm: remove controls and
options matrix, & replace it by a set of switch buttons.
* Palettes/0Menus/GormMenuAttributesInspector.{m,h} : split files.
use ok: revert: methods, replace menuType matrix by a matrix of Radio
buttons.Clean up and comments.
* Palettes/0Menus/GormMenuItemAttributesInspector.m: split files.
use ok: revert: methods, Clean up and comments.
* Palettes/0Menus/MenuInspectors.m : removed
* Palettes/0Menus/GormMenuAttributesInspector.gorm : improve ui,
use a matrix of radioButtonCell for menu type
* Palettes/0Menus/GormMenuEditor.m : rename IBObjectAdditions category
2005-07-28 00:04 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormImage.h: Added documentation.
* GormCore/GormImage.m: Properly implemented IBObjectAdditions.
* GormCore/GormPrivate.h: Remove illegalClassSubstitution method.
* GormCore/GormPrivate.m: Remove illegalClassSubstitution method.
* GormCore/GormSound.h: Added documentation.
* GormCore/GormSound.m: Properly implemented IBObjectAdditions.
* Gorm.m: Removed methods which check for user bundles.
2005-07-27 02:10 Gregory John Casamento <greg_casamento@yahoo.com>
* GormPrefs/GormGeneralPref.m: Removed extra calls to synchronize.
* GormPrefs/GormHeadersPref.m: ditto
2005-07-27 01:47 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormDocument.h: Added documentation.
* GormCore/GormDocument.m: Removed commented code. Corrected
problem in [GormDocument instantiateClass:] when switching to
the objects view.
* GormCore/GormWindowEditor.h: Added documentation.
2005-07-26 22:56 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GNUmakefile: Added new GormWindowEditor.h file.
* GormCore/GormWindowEditor.m: Reorganized methods, extracted .h
* GormCore/GormWindowEditor.h: New file.
* GormCore/NSCell+GormAdditions.h
* GormCore/NSColorWell+GormExtensions.h
* GormCore/NSColorWell+GormExtensions.m
* GormCore/NSFontManager+GormExtensions.h
* GormCore/NSFontManager+GormExtensions.m
* GormCore/NSView+GormExtensions.h: Added documentation.
2005-07-26 21:02 Gregory John Casamento <greg_casamento@yahoo.com>
* Palettes/2Controls/GormNSTextFieldInspector.gorm: Correct
resize attributes.
2005-07-25 23:26 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormClassEditor.m: [GormClassEditor selectClass:editClass:]
add exception handling.
* GormCore/GormDocument.m: [GormDocument pasteObjects:type
fromPasteboard:] added check for specific pb types.
2005-08-06 08:30 Gregory John Casamento <greg_casamento@yahoo.com>
* Version 0.11.0

View file

@ -78,6 +78,7 @@ GormCore_HEADER_FILES = \
GormViewEditor.h \
GormViewKnobs.h \
GormViewResourceManager.h \
GormViewSizeInspector.h \
GormViewWindow.h \
GormViewWithContentViewEditor.h \
GormViewWithSubviewsEditor.h \

View file

@ -81,6 +81,16 @@ static NSImage *horizontalImage;
return image;
}
- (NSString*) sizeInspectorClassName
{
return @"GormViewSizeInspector";
}
- (NSString*) customClassInspector
{
return @"GormCustomClassInspector";
}
@end

View file

@ -123,12 +123,43 @@ static NSMapTable *docMap = 0;
- (void) pasteInSelection
{
// not implemented
NSPasteboard *pb = [NSPasteboard generalPasteboard];
NSString *type = [[(GormDocument *)document allManagedPboardTypes] firstObjectCommonWithArray: [pb types]];
if(type != nil)
{
// paste the object in.
[document pasteType: type
fromPasteboard: pb
parent: nil];
}
}
- (void) copySelection
{
// not implemented
NSArray *sel = [self selection];
if([sel count] > 0)
{
NSString *type = nil;
id obj = [sel objectAtIndex: 0];
if([obj isKindOfClass: [NSWindow class]])
{
type = IBWindowPboardType;
}
if([obj isKindOfClass: [NSView class]])
{
type = IBViewPboardType;
}
else
{
type = IBObjectPboardType;
}
[document copyObject: sel
type: type
toPasteboard: [NSPasteboard generalPasteboard]];
}
}
- (void) deleteSelection

View file

@ -0,0 +1,47 @@
/* GormViewSizeInspector.m
*
* Copyright (C) 1999 Free Software Foundation, Inc.
*
* Author: Richard Frith-Macdonald <richard@brainstrom.co.uk>
* Date: 1999
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
* Separated out into header.
* Date: 2005
*
* This file is part of GNUstep.
*
* 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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
#ifndef INCLUDED_GormViewSizeInspector_h
#define INCLUDED_GormViewSizeInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSButton, NSForm;
@interface GormViewSizeInspector : IBInspector
{
NSButton *top;
NSButton *bottom;
NSButton *left;
NSButton *right;
NSButton *width;
NSButton *height;
NSForm *sizeForm;
}
@end
#endif

View file

@ -24,30 +24,7 @@
#include "GormPrivate.h"
#include "GormViewKnobs.h"
@implementation NSView (GormInspectors)
- (NSString*) sizeInspectorClassName
{
return @"GormViewSizeInspector";
}
- (NSString*) customClassInspector
{
return @"GormCustomClassInspector";
}
@end
@interface GormViewSizeInspector : IBInspector
{
NSButton *top;
NSButton *bottom;
NSButton *left;
NSButton *right;
NSButton *width;
NSButton *height;
NSForm *sizeForm;
}
@end
#include "GormViewSizeInspector.h"
@implementation GormViewSizeInspector

View file

@ -25,13 +25,15 @@ include $(GNUSTEP_MAKEFILES)/common.make
PALETTE_NAME = 0Menus
0Menus_PALETTE_ICON = MenusPalette
0Menus_PRINCIPAL_CLASS = MenusPalette
0Menus_OBJC_FILES = \
GormMenuEditor.m \
GormMenuInspectors.m \
GormNSMenu.m \
GormMenuItemAttributesInspector.m\
GormMenuAttributesInspector.m\
main.m
0Menus_PRINCIPAL_CLASS = MenusPalette
0Menus_RESOURCE_FILES = MenusPalette.tiff \
GormMenuDrag.tiff \
GormMenuAttributesInspector.gorm \

View file

@ -3,17 +3,13 @@
FirstResponder = {
Actions = (
"orderFrontFontPanel:",
"setObject:",
"updateMenuType:",
"updateAutoenable:"
"setObject:"
);
Super = NSObject;
};
GormMenuAttributesInspector = {
Actions = (
"setObject:",
"updateMenuType:",
"updateAutoenable:"
"setObject:"
);
Outlets = (
titleText,

View file

@ -0,0 +1,50 @@
/*
GormMenuAttributesInspector.m
Copyright (C) 1999-2005 Free Software Foundation, Inc.
Author: Richard frith-Macdonald (richard@brainstorm.co.uk>
Date: 1999
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormMenuAttributesInspector_h_
#define INCLUDED_GormMenuAttributesInspector_h_
#include <InterfaceBuilder/IBInspector.h>
@class NSButton;
@class NSMatrix;
@class NSTextField;
@interface GormMenuAttributesInspector : IBInspector
{
NSTextField *titleText;
NSMatrix *menuType;
NSButton *autoenable;
}
@end
#endif /* INCLUDED_GormMenuAttributesInspector_h_ */

View file

@ -0,0 +1,156 @@
/*
GormMenuAttributesInspector.m
Copyright (C) 1999-2005 Free Software Foundation, Inc.
Author: Richard frith-Macdonald (richard@brainstorm.co.uk>
Date: 1999
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormMenuAttributesInspector.h"
#include <Foundation/NSNotification.h>
#include <GormCore/GormDocument.h>
#include <AppKit/NSButton.h>
#include <AppKit/NSMatrix.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSTextField.h>
#define WINDOWSMENUTAG 0
#define SERVICESMENUTAG 1
#define NORMALMENUTAG 2
@implementation NSMenu (IBObjectAdditions)
- (NSString*) inspectorClassName
{
return @"GormMenuAttributesInspector";
}
@end
@implementation GormMenuAttributesInspector
- (id) init
{
if ([super init] == nil)
return nil;
if ([NSBundle loadNibNamed: @"GormMenuAttributesInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormMenuAttributesInspector");
return nil;
}
return self;
}
-(void) ok:(id) sender
{
if ( sender == titleText )
{
[object setTitle:[titleText stringValue]];
}
if ( sender == autoenable )
{
BOOL flag;
// look at the values passed back in the matrix.
flag = ([autoenable state] == NSOnState) ? YES : NO;
[object setAutoenablesItems: flag];
}
else if ( sender == menuType )
{
BOOL flag;
GormDocument *doc = (GormDocument *)[(id<IB>)NSApp activeDocument];
int tag = [[menuType selectedCell] tag];
switch ( tag )
{
case WINDOWSMENUTAG:
[doc setWindowsMenu:object];
if ( [doc servicesMenu] == object )
[doc setServicesMenu: nil];
break;
case SERVICESMENUTAG:
[doc setServicesMenu: object];
if ( [doc windowsMenu] == object )
[doc setWindowsMenu: nil];
break;
case NORMALMENUTAG:
if ( [doc windowsMenu] == object )
[doc setWindowsMenu: nil];
if ( [doc servicesMenu] == object )
[doc setServicesMenu: nil];
break;
}
}
[super ok:sender];
}
- (void) revert: (id)sender
{
GormDocument *doc;
if ( object == nil )
return;
doc = (GormDocument *)[(id<IB>)NSApp activeDocument];
[titleText setStringValue: [object title]];
[autoenable setState: ([object autoenablesItems]?NSOnState:NSOffState)];
// set up the menu type matrix...
if([doc windowsMenu] == object)
{
[menuType selectCellAtRow:WINDOWSMENUTAG column: 0];
}
else if([doc servicesMenu] == object)
{
[menuType selectCellAtRow:SERVICESMENUTAG column: 0];
}
else
{
[menuType selectCellAtRow:NORMALMENUTAG column: 0];
}
}
/* delegate method used for menu title */
- (void)controlTextDidChange:(NSNotification *)aNotification
{
[object setTitle: [titleText stringValue]];
}
@end

View file

@ -26,7 +26,7 @@
#include <InterfaceBuilder/InterfaceBuilder.h>
#include <GormCore/GormFunctions.h>
@implementation NSMenu (IBObjectAdditions)
@implementation NSMenu (IBObjectAdditionsEditor)
- (NSString*) editorClassName
{
return @"GormMenuEditor";

View file

@ -0,0 +1,49 @@
/*
GormMenuItemAttributesInspector.h
Copyright (C) 1999-2005 Free Software Foundation, Inc.
Author: Richard frith-Macdonald (richard@brainstorm.co.uk>
Date: 1999
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormMenuItemAttributesInspector_h_
#define INCLUDED_GormMenuItemAttributesInspector_h_
#include <InterfaceBuilder/IBInspector.h>
@class NSTextField;
@interface GormMenuItemAttributesInspector : IBInspector
{
NSTextField *titleText;
NSTextField *shortCut;
NSTextField *tagText;
}
@end
#endif

View file

@ -0,0 +1,101 @@
/*
GormMenuItemAttributesInspector.m
Copyright (C) 1999-2005 Free Software Foundation, Inc.
Author: Richard frith-Macdonald (richard@brainstorm.co.uk>
Date: 1999
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormMenuItemAttributesInspector.h"
#include <Foundation/NSNotification.h>
#include <AppKit/NSMenuItem.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSTextField.h>
@implementation NSMenuItem (IBObjectAdditions)
- (NSString*) inspectorClassName
{
return @"GormMenuItemAttributesInspector";
}
@end
@implementation GormMenuItemAttributesInspector
- (id) init
{
if ([super init] == nil)
return nil;
if ([NSBundle loadNibNamed: @"GormMenuItemAttributesInspector" owner: self]
== NO)
{
NSLog(@"Could not gorm GormMenuItemAttributesInspector");
return nil;
}
return self;
}
- (void) revert : (id)sender
{
if ( object == nil )
return;
[titleText setStringValue: [object title]];
[shortCut setStringValue: [object keyEquivalent]];
[tagText setIntValue: [object tag]];
}
-(void) ok: (id) sender
{
if (sender == titleText)
{
[object setTitle: [titleText stringValue]];
}
if (sender == shortCut)
{
[object setKeyEquivalent:[[shortCut stringValue]stringByTrimmingSpaces]];
}
if (sender == tagText)
{
[object setTag: [tagText intValue]];
}
[super ok:sender];
}
- (void)controlTextDidChange:(NSNotification *)aNotification
{
[self ok: [aNotification object]];
}
@end

View file

@ -1,6 +1,6 @@
# GNUmakefile
#
# Copyright (C) 1999 Free Software Foundation, Inc.
# Copyright (C) 1999-2005 Free Software Foundation, Inc.
#
# Author: Richard Frith-Macdonald <richard@brainstorm.co.uk>
# Date: 1999
@ -25,15 +25,25 @@ include $(GNUSTEP_MAKEFILES)/common.make
PALETTE_NAME = 1Windows
1Windows_PALETTE_ICON = WindowsPalette
1Windows_OBJC_FILES = main.m GormNSWindow.m GormNSPanel.m
1Windows_HEADER_FILES = GormNSWindow.h GormNSPanel.h
1Windows_OBJC_FILES = main.m \
GormNSWindow.m\
GormNSPanel.m\
GormWindowAttributesInspector.m\
GormWindowSizeInspector.m
1Windows_HEADER_FILES = GormNSWindow.h \
GormWindowAttributesInspector.h\
GormWindowSizeInspector.h\
GormNSPanel.h
1Windows_PRINCIPAL_CLASS = WindowsPalette
1Windows_RESOURCE_FILES = \
WindowsPalette.tiff \
WindowDrag.tiff \
GormNSWindowSizeInspector.gorm \
GormNSWindowInspector.gorm \
palette.table
1Windows_RESOURCE_FILES = WindowsPalette.tiff \
WindowDrag.tiff \
GormNSWindowSizeInspector.gorm \
GormNSWindowInspector.gorm \
palette.table
1Windows_STANDARD_INSTALL = no

View file

@ -1,16 +1,23 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
GormWindowInspector = {
GormWindowAttributesInspector = {
Actions = (
);
Outlets = (
backingMatrix,
controlMatrix,
optionMatrix,
titleForm,
iconNameForm,
clearButton,
colorWell
colorWell,
releaseButton,
hideButton,
visibleButton,
deferredButton,
oneShotButton,
dynamicDepthButton,
miniaturizeButton,
closeButton,
resizeBarButton
);
Super = IBInspector;
};

View file

@ -1,14 +1,7 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"setAutoposition:"
);
Super = NSObject;
};
GormWindowSizeInspector = {
Actions = (
"setAutoposition:"
);
Outlets = (
minForm,

View file

@ -0,0 +1,72 @@
/*
GormWindowAttributesInspector.h
Copyright (C) 1999-2005 Free Software Foundation, Inc.
Author: Richard frith-Macdonald (richard@brainstorm.co.uk>
Date: 1999
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: 2002,2003,2004,2005
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormWindowAttributesInspector_h
#define INCLUDED_GormWindowAttributesInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSButton;
@class NSColorWell;
@class NSForm;
@class NSMatrix;
@interface GormWindowAttributesInspector : IBInspector
{
NSForm *titleForm;
NSMatrix *backingMatrix;
/* Controls: Masks */
NSButton *miniaturizeButton;
NSButton *closeButton;
NSButton *resizeBarButton;
/* Options */
NSButton *releaseButton;
NSButton *hideButton;
NSButton *visibleButton;
NSButton *deferredButton;
NSButton *oneShotButton;
NSButton *dynamicDepthButton;
/*Background Color */
NSColorWell *colorWell;
/* Miniaturized Window Icon */
NSForm *iconNameForm;
NSButton *clearButton;
}
@end
#endif

View file

@ -0,0 +1,252 @@
/*
GormWindowAttributesInspector.m
Copyright (C) 1999-2005 Free Software Foundation, Inc.
Author: Richard frith-Macdonald (richard@brainstorm.co.uk>
Date: 1999
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: 2002,2003,2004,2005
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Split inspector classes into separate files.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormWindowAttributesInspector.h"
#include "GormNSWindow.h"
#include <GormCore/GormDocument.h>
#include <GormCore/NSColorWell+GormExtensions.h>
#include <AppKit/NSNibLoading.h>
/*
IBObjectAdditions category for NSPanel
*/
@implementation NSPanel (IBObjectAdditions)
- (NSString*) inspectorClassName
{
return @"GormWindowAttributesInspector";
}
@end
/*
IBObjectAdditions category for NSWindow
*/
@implementation NSWindow (IBObjectAdditions)
- (NSString*) inspectorClassName
{
return @"GormWindowAttributesInspector";
}
@end
@implementation GormWindowAttributesInspector
- (id) init
{
if ([super init] == nil)
return nil;
if ([NSBundle loadNibNamed: @"GormNSWindowInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormNSWindowInspector");
return nil;
}
return self;
}
/* Commit changes that the user makes in the Attributes Inspector */
- (void) ok: (id)sender
{
/* title */
if (sender == titleForm)
{
[object setTitle: [[sender cellAtIndex: 0] stringValue] ];
}
/* backing Type */
else if (sender == backingMatrix)
{
[object setBackingType: [[sender selectedCell] tag] ];
}
/* Masks */
else if ( ( sender == miniaturizeButton ) ||
( sender == closeButton ) ||
( sender == resizeBarButton ) )
{
unsigned int newStyleMask;
if ( [miniaturizeButton state] == NSOnState )
newStyleMask |= NSMiniaturizableWindowMask;
else
newStyleMask &= ~NSMiniaturizableWindowMask;
if ( [closeButton state] == NSOnState )
newStyleMask |= NSClosableWindowMask;
else
newStyleMask &= ~NSClosableWindowMask;
if ( [resizeBarButton state] == NSOnState )
newStyleMask |= NSResizableWindowMask;
else
newStyleMask &= ~NSResizableWindowMask;
[object _setStyleMask: newStyleMask];
#warning FIXME
// FIXME: This doesn't refresh the window decoration. How to do that?
// (currently needs manual hide/unhide to update decorations)
[object display];
}
/* backgroundColor */
else if (sender == colorWell)
{
[object setBackgroundColor: [colorWell color]];
}
/* release When Closed */
else if ( sender == releaseButton )
{
[object _setReleasedWhenClosed:[releaseButton state]];
}
/* hide On Desactivate */
else if ( sender == hideButton )
{
[object setHidesOnDeactivate:[hideButton state]];
}
/* visible at launch time */
else if ( sender == visibleButton )
{
GormDocument *doc = (GormDocument*)[(id<IB>)NSApp activeDocument];
[doc setObject: object isVisibleAtLaunch: [visibleButton state]];
}
/* deferred */
else if ( sender == deferredButton )
{
GormDocument *doc = (GormDocument*)[(id<IB>)NSApp activeDocument];
[doc setObject: object isDeferred: [deferredButton state]];
}
/* One shot */
else if ( sender == oneShotButton )
{
[object setOneShot:[oneShotButton state]];
}
/* Dynamic depth */
else if ( sender == dynamicDepthButton )
{
[object setDynamicDepthLimit: [dynamicDepthButton state]];
}
/* icon name */
else if (sender == iconNameForm)
{
NSString *string = [[sender cellAtIndex: 0] stringValue];
NSImage *image;
/* the clearButton is disabled if the form is empty, enabled otherwise */
#warning probably not enough ( space ... )
if ([string length] > 0)
{
image = [NSImage imageNamed: string];
[object setMiniwindowImage: image];
[clearButton setEnabled:YES];
}
else
{
// use the default, if the string is empty.
[object setMiniwindowImage: nil];
[clearButton setEnabled:NO];
}
}
/* clear the iconNameForm from clearButton */
else if (sender == clearButton)
{
[[iconNameForm cellAtIndex: 0] setStringValue: nil];
[object setMiniwindowImage: nil];
[clearButton setEnabled:NO];
}
[super ok: sender];
}
/* Sync from object ( NSWindow ) changes to the inspector */
- (void) revert:(id) sender
{
GormDocument *doc;
if ( object == nil )
return;
doc = (GormDocument*)[(id<IB>)NSApp activeDocument];
/* Title */
[[titleForm cellAtIndex: 0] setStringValue: [object title] ];
/* Backing */
[backingMatrix selectCellWithTag: [object backingType] ];
/* Controls / Masks */
[miniaturizeButton setState: ([object _styleMask]
& NSMiniaturizableWindowMask)];
[closeButton setState:([object _styleMask] & NSClosableWindowMask)];
[resizeBarButton setState:([object _styleMask] & NSResizableWindowMask)];
/* Options */
[releaseButton setState:[object _isReleasedWhenClosed]];
[hideButton setState:[object hidesOnDeactivate]];
[visibleButton setState:[doc objectIsVisibleAtLaunch: object]];
[deferredButton setState:[doc objectIsDeferred: object]];
[oneShotButton setState:[object isOneShot]];
[dynamicDepthButton setState:[object hasDynamicDepthLimit]];
/* Icon Name */
[[iconNameForm cellAtIndex: 0] setStringValue:
[[object miniwindowImage] name]];
/* the clearButton is disabled if the form is empty, enabled otherwise */
if ( [[object miniwindowImage] name] == nil )
[clearButton setEnabled:NO];
else
[clearButton setEnabled:YES];
/* background color*/
[colorWell setColorWithoutAction: [object backgroundColor]];
[super revert:sender];
}
/* delegate method for changing the Window title */
- (void)controlTextDidChange:(NSNotification *)aNotification
{
[self ok:[aNotification object]];
}
@end

View file

@ -0,0 +1,58 @@
/*
GormWindowSizeInspector.h
Copyright (C) 1999-2005 Free Software Foundation, Inc.
Author: Richard frith-Macdonald (richard@brainstorm.co.uk>
Date: 1999
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: 2005
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormWindowSizeInspector_h
#define INCLUDED_GormWindowSizeInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSButton;
@class NSForm;
@interface GormWindowSizeInspector : IBInspector
{
NSForm *sizeForm;
NSForm *minForm;
NSForm *maxForm;
/* AutoPosition */
NSButton *top;
NSButton *bottom;
NSButton *left;
NSButton *right;
}
@end
#endif

View file

@ -0,0 +1,218 @@
/*
GormWindowSizeInspector.m
Copyright (C) 1999-2005 Free Software Foundation, Inc.
Author: Richard frith-Macdonald (richard@brainstorm.co.uk>
Date: 1999
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: 2005
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Split inspector classes into separate files.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormWindowSizeInspector.h"
#include <Foundation/NSNotification.h>
#include <GNUstepGUI/GSNibTemplates.h>
#include <AppKit/NSButton.h>
#include <AppKit/NSForm.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSPanel.h>
#include <AppKit/NSWindow.h>
/*
IBObjectAdditions category for NSPanel
*/
@implementation NSPanel (IBObjectAdditionsSize)
- (NSString*) sizeInspectorClassName
{
return @"GormWindowSizeInspector";
}
@end
/*
IBObjectAdditions category for NSWindow
*/
@implementation NSWindow (IBObjectAdditionsSize)
- (NSString*) sizeInspectorClassName
{
return @"GormWindowSizeInspector";
}
@end
@implementation GormWindowSizeInspector
- (id) init
{
if ([super init] == nil)
return nil;
if ([NSBundle loadNibNamed: @"GormNSWindowSizeInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormNSWindowSizeInspector");
return nil;
}
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(windowChangeNotification:)
name: NSWindowDidMoveNotification
object: object];
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(windowChangeNotification:)
name: NSWindowDidResizeNotification
object: object];
#warning why not in setObject: ?
// set up tags...
[top setTag: GSWindowMaxYMargin];
[bottom setTag: GSWindowMinYMargin];
[left setTag: GSWindowMinXMargin];
[right setTag: GSWindowMaxXMargin];
return self;
}
/* Commit changes that the user makes in the Window Size Inspector */
- (void) ok: (id)sender
{
/* Size */
if (sender == sizeForm)
{
NSRect rect;
rect = NSMakeRect([[sender cellAtIndex: 0] floatValue],
[[sender cellAtIndex: 1] floatValue],
[[sender cellAtIndex: 2] floatValue],
[[sender cellAtIndex: 3] floatValue]);
[object setFrame: rect display: YES];
}
/* Min Size */
else if (sender == minForm)
{
NSSize size;
size = NSMakeSize([[minForm cellAtIndex: 0] floatValue],
[[minForm cellAtIndex: 1] floatValue]);
[object setMinSize: size];
}
/* Max Size */
else if (sender == maxForm)
{
NSSize size;
size = NSMakeSize([[maxForm cellAtIndex: 0] floatValue],
[[maxForm cellAtIndex: 1] floatValue]);
[object setMaxSize: size];
}
/* AutoPosition */
#warning Maybye set condition for each button ( more readeable ? )
else if ( [sender isKindOfClass:[NSButton class]] )
{
unsigned mask = [sender tag];
if ([sender state] == NSOnState)
{
mask = [object autoPositionMask] | mask;
}
else
{
mask = [object autoPositionMask] & ~mask;
}
[object setAutoPositionMask: mask];
}
[super ok: sender];
}
/* Sync from object ( NSWindow ) changes to the inspector */
- (void) revert:(id)sender
{
NSRect frame;
NSSize size;
unsigned int mask;
if ( object == nil )
return;
mask = [object autoPositionMask];
frame = [object frame];
[[sizeForm cellAtIndex: 0] setFloatValue: NSMinX(frame)];
[[sizeForm cellAtIndex: 1] setFloatValue: NSMinY(frame)];
[[sizeForm cellAtIndex: 2] setFloatValue: NSWidth(frame)];
[[sizeForm cellAtIndex: 3] setFloatValue: NSHeight(frame)];
size = [object minSize];
[[minForm cellAtIndex: 0] setFloatValue: size.width];
[[minForm cellAtIndex: 1] setFloatValue: size.height];
size = [object maxSize];
[[maxForm cellAtIndex: 0] setFloatValue: size.width];
[[maxForm cellAtIndex: 1] setFloatValue: size.height];
if (mask & GSWindowMaxYMargin)
[top setState: NSOnState];
else
[top setState: NSOffState];
if (mask & GSWindowMinYMargin)
[bottom setState: NSOnState];
else
[bottom setState: NSOffState];
if (mask & GSWindowMaxXMargin)
[right setState: NSOnState];
else
[right setState: NSOffState];
if (mask & GSWindowMinXMargin)
[left setState: NSOnState];
else
[left setState: NSOffState];
[super revert:object];
}
#warning what about delegate ? or revert: ??
- (void) windowChangeNotification: (NSNotification*)aNotification
{
[self ok: [aNotification object]];
}
/* Delegate for textFields / Forms */
- (void)controlTextDidChange:(NSNotification *)aNotification
{
[self ok:[aNotification object]];
}
@end

View file

@ -1,6 +1,7 @@
/* main.m
/*
main.m
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999-2005 Free Software Foundation, Inc.
Author: Richard frith-Macdonald (richard@brainstorm.co.uk>
Date: 1999
@ -21,16 +22,18 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
*/
#include <Foundation/Foundation.h>
#include <AppKit/AppKit.h>
#include <GNUstepGUI/GSNibTemplates.h>
#include <InterfaceBuilder/IBPalette.h>
#include <InterfaceBuilder/IBInspector.h>
#include <InterfaceBuilder/IBApplicationAdditions.h>
#include <InterfaceBuilder/IBInspector.h>
#include <InterfaceBuilder/IBPalette.h>
#include <GormCore/GormDocument.h>
#include <GormCore/NSColorWell+GormExtensions.h>
#include "GormNSWindow.h"
#include <GNUstepGUI/GSNibTemplates.h>
#include "GormNSPanel.h"
#include "GormNSWindow.h"
#include "GormWindowSizeInspector.h"
@interface GormWindowMaker : NSObject <NSCoding>
{
@ -44,19 +47,19 @@
- (id) initWithCoder: (NSCoder*)aCoder
{
id w;
unsigned style = NSTitledWindowMask | NSClosableWindowMask
| NSResizableWindowMask | NSMiniaturizableWindowMask;
id w;
unsigned style = ( NSTitledWindowMask | NSClosableWindowMask
| NSResizableWindowMask | NSMiniaturizableWindowMask);
NSRect screenRect = [[NSScreen mainScreen] frame];
float
x = (screenRect.size.width - 500)/2,
y = (screenRect.size.height - 300)/2;
float x = (screenRect.size.width - 500)/2;
float y = (screenRect.size.height - 300)/2;
NSRect windowRect = NSMakeRect(x,y,500,300);
w = [[GormNSWindow alloc] initWithContentRect: windowRect
styleMask: style
backing: NSBackingStoreRetained
defer: NO];
[w setFrame: windowRect display: YES];
[w setTitle: @"Window"];
[w orderFront: self];
@ -115,9 +118,9 @@
RELEASE(originalWindow);
originalWindow= [[NSWindow alloc] initWithContentRect:
NSMakeRect(0, 0, 272, 192)
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreRetained
defer: NO];
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreRetained
defer: NO];
contents = [originalWindow contentView];
w = [[GormWindowMaker alloc] init];
@ -128,8 +131,8 @@
[v setTitle: @"Window"];
[contents addSubview: v];
[self associateObject: w
type: IBWindowPboardType
with: v];
type: IBWindowPboardType
with: v];
RELEASE(v);
RELEASE(w);
@ -141,8 +144,8 @@
[v setTitle: @"Panel"];
[contents addSubview: v];
[self associateObject: w
type: IBWindowPboardType
with: v];
type: IBWindowPboardType
with: v];
RELEASE(v);
RELEASE(w);
@ -150,9 +153,6 @@
}
@end
/*---------------------------------------------------------
// NSWindow inspector
---------------------------------------------------------*/
@implementation NSWindow (GormPrivate)
+ (id) allocSubstitute
{
@ -167,420 +167,3 @@
}
@end
// the normal classes...
@implementation NSWindow (IBInspectorClassNames)
- (NSString*) inspectorClassName
{
return @"GormWindowAttributesInspector";
}
- (NSString*) sizeInspectorClassName
{
return @"GormWindowSizeInspector";
}
@end
@implementation NSPanel (IBInspectorClassNames)
- (NSString*) inspectorClassName
{
return @"GormWindowAttributesInspector";
}
- (NSString*) sizeInspectorClassName
{
return @"GormWindowSizeInspector";
}
@end
// special subclasses...
@implementation GormNSWindow (IBInspectorClassNames)
- (NSString*) inspectorClassName
{
return @"GormWindowAttributesInspector";
}
- (NSString*) sizeInspectorClassName
{
return @"GormWindowSizeInspector";
}
@end
@implementation GormNSPanel (IBInspectorClassNames)
- (NSString*) inspectorClassName
{
return @"GormWindowAttributesInspector";
}
- (NSString*) sizeInspectorClassName
{
return @"GormWindowSizeInspector";
}
@end
@interface GormWindowAttributesInspector : IBInspector
{
id titleForm;
id backingMatrix;
id optionMatrix;
id controlMatrix;
id iconNameForm;
id clearButton;
id colorWell;
}
@end
@implementation GormWindowAttributesInspector
/* delegate method for changing the Window title */
- (void)controlTextDidChange:(NSNotification *)aNotification
{
[self ok:[aNotification object]];
}
- (void) _setValuesFromControl: control
{
if (control == titleForm)
{
[object setTitle: [[control cellAtIndex: 0] stringValue] ];
}
else if (control == iconNameForm)
{
NSString *string = [[control cellAtIndex: 0] stringValue];
NSImage *image;
if ([string length] > 0)
{
image = [NSImage imageNamed: string];
[object setMiniwindowImage: image];
}
else
{
// use the default, if the string is empty.
[object setMiniwindowImage: nil];
}
}
else if (control == clearButton)
{
[[iconNameForm cellAtIndex: 0] setStringValue: nil];
[object setMiniwindowImage: nil];
}
else if (control == backingMatrix)
{
[object setBackingType: [[control selectedCell] tag] ];
}
else if (control == controlMatrix)
{
unsigned int newStyleMask;
int rows,cols,i;
[control getNumberOfRows:&rows columns:&cols];
newStyleMask = [object _styleMask];
for (i=0;i<rows;i++) {
if ([[control cellAtRow: i column: 0] state] == NSOnState)
newStyleMask |= [[control cellAtRow: i column: 0] tag];
else
newStyleMask &= ~[[control cellAtRow: i column: 0] tag];
}
[object _setStyleMask: newStyleMask];
[object display];
}
else if (control == colorWell)
{
[object setBackgroundColor: [colorWell color]];
}
else if (control == optionMatrix)
{
BOOL flag;
GormDocument *doc = (GormDocument*)[(id<IB>)NSApp activeDocument];
// Release When Closed
flag = ([[control cellAtRow: 0 column: 0] state] == NSOnState) ? YES : NO;
[object _setReleasedWhenClosed: flag];
// Hide on deactivate
flag = ([[control cellAtRow: 1 column: 0] state] == NSOnState) ? YES : NO;
[object setHidesOnDeactivate: flag];
// Visible at launch time. (not an object property. Stored in a Gorm dictionary)
flag = ([[control cellAtRow: 2 column: 0] state] == NSOnState) ? YES : NO;
[doc setObject: object isVisibleAtLaunch: flag];
// Deferred
flag = ([[control cellAtRow: 3 column: 0] state] == NSOnState) ? YES : NO;
[doc setObject: object isDeferred: flag];
// One shot
flag = ([[control cellAtRow: 4 column: 0] state] == NSOnState) ? YES : NO;
[object setOneShot: flag];
// Dynamic depth limit
flag = ([[control cellAtRow: 5 column: 0] state] == NSOnState) ? YES : NO;
[object setDynamicDepthLimit: flag];
// wants to be color
// FIXME: probably means window depth > 2 bits per pixel but don't know
// exactly what NSWindow method to use to enforce that.
flag = ([[control cellAtRow: 6 column: 0] state] == NSOnState) ? YES : NO;
}
}
- (void) _getValuesFromObject: anObject
{
GormDocument *doc = (GormDocument*)[(id<IB>)NSApp activeDocument];
if (anObject != object)
return;
[[titleForm cellAtIndex: 0] setStringValue: [anObject title] ];
[backingMatrix selectCellWithTag: [anObject backingType] ];
[controlMatrix deselectAllCells];
if ([anObject _styleMask] & NSMiniaturizableWindowMask)
[controlMatrix selectCellAtRow: 0 column: 0];
if ([anObject _styleMask] & NSClosableWindowMask)
[controlMatrix selectCellAtRow: 1 column: 0];
if ([anObject _styleMask] & NSResizableWindowMask)
[controlMatrix selectCellAtRow: 2 column: 0];
[optionMatrix deselectAllCells];
if ([anObject _isReleasedWhenClosed])
[optionMatrix selectCellAtRow: 0 column: 0];
if ([anObject hidesOnDeactivate])
[optionMatrix selectCellAtRow: 1 column: 0];
// visible at launch time.
if ([doc objectIsVisibleAtLaunch: anObject])
{
[optionMatrix selectCellAtRow: 2 column: 0];
}
// defer comes here.
if ([doc objectIsDeferred: anObject])
{
[optionMatrix selectCellAtRow: 3 column: 0];
}
if ([anObject isOneShot])
[optionMatrix selectCellAtRow: 4 column: 0];
if ([anObject hasDynamicDepthLimit])
[optionMatrix selectCellAtRow: 5 column: 0];
// icon name
[[iconNameForm cellAtIndex: 0] setStringValue: [[object miniwindowImage] name]];
// background color
[colorWell setColorWithoutAction: [object backgroundColor]];
}
- (void) _validate: (id)anObject
{
id cell = [controlMatrix cellAtRow: 0 column: 0];
// Assumed to be the "miniaturize" cell.
// panels should not be allowed to miniaturize the app.
if([anObject isKindOfClass: [NSPanel class]])
{
[cell setEnabled: NO];
}
else
{
[cell setEnabled: YES];
}
}
- (id) init
{
if ([super init] == nil)
return nil;
if ([NSBundle loadNibNamed: @"GormNSWindowInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormNSWindowInspector");
return nil;
}
return self;
}
- (void) ok: (id)sender
{
[super ok: sender];
[self _setValuesFromControl: sender];
}
- (void) setObject: (id)anObject
{
// Need to do something here to disable certain portions of
// the inspector if the object being edited is an NSPanel.
[super setObject: anObject];
// [self _validate: anObject];
[self _getValuesFromObject: anObject];
}
@end
@interface GormWindowSizeInspector : IBInspector
{
NSForm *sizeForm;
NSForm *minForm;
NSForm *maxForm;
id top;
id bottom;
id left;
id right;
}
- (void) setAutoposition: (id)sender;
@end
@implementation GormWindowSizeInspector
- (void)controlTextDidChange:(NSNotification *)aNotification
{
[self ok:[aNotification object]];
}
- (void) _setValuesFromControl: control
{
if (control == sizeForm)
{
NSRect rect;
rect = NSMakeRect([[control cellAtIndex: 0] floatValue],
[[control cellAtIndex: 1] floatValue],
[[control cellAtIndex: 2] floatValue],
[[control cellAtIndex: 3] floatValue]);
[object setFrame: rect display: YES];
}
else if (control == minForm)
{
NSSize size;
size = NSMakeSize([[minForm cellAtIndex: 0] floatValue],
[[minForm cellAtIndex: 1] floatValue]);
[object setMinSize: size];
}
else if (control == maxForm)
{
NSSize size;
size = NSMakeSize([[maxForm cellAtIndex: 0] floatValue],
[[maxForm cellAtIndex: 1] floatValue]);
[object setMaxSize: size];
}
}
- (void) _getValuesFromObject: anObject
{
NSRect frame;
NSSize size;
unsigned int mask = [object autoPositionMask];
if (anObject != object)
return;
frame = [anObject frame];
[[sizeForm cellAtIndex: 0] setFloatValue: NSMinX(frame)];
[[sizeForm cellAtIndex: 1] setFloatValue: NSMinY(frame)];
[[sizeForm cellAtIndex: 2] setFloatValue: NSWidth(frame)];
[[sizeForm cellAtIndex: 3] setFloatValue: NSHeight(frame)];
size = [anObject minSize];
[[minForm cellAtIndex: 0] setFloatValue: size.width];
[[minForm cellAtIndex: 1] setFloatValue: size.height];
size = [anObject maxSize];
[[maxForm cellAtIndex: 0] setFloatValue: size.width];
[[maxForm cellAtIndex: 1] setFloatValue: size.height];
if (mask & GSWindowMaxYMargin)
[top setState: NSOnState];
else
[top setState: NSOffState];
if (mask & GSWindowMinYMargin)
[bottom setState: NSOnState];
else
[bottom setState: NSOffState];
if (mask & GSWindowMaxXMargin)
[right setState: NSOnState];
else
[right setState: NSOffState];
if (mask & GSWindowMinXMargin)
[left setState: NSOnState];
else
[left setState: NSOffState];
}
- (void) windowChangeNotification: (NSNotification*)aNotification
{
id notifier = [aNotification object];
[self _getValuesFromObject: notifier];
}
- (id) init
{
if ([super init] == nil)
return nil;
if ([NSBundle loadNibNamed: @"GormNSWindowSizeInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormNSWindowSizeInspector");
return nil;
}
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(windowChangeNotification:)
name: NSWindowDidMoveNotification
object: object];
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(windowChangeNotification:)
name: NSWindowDidResizeNotification
object: object];
// set up tags...
[top setTag: GSWindowMaxYMargin];
[bottom setTag: GSWindowMinYMargin];
[left setTag: GSWindowMinXMargin];
[right setTag: GSWindowMaxXMargin];
return self;
}
- (void) ok: (id)sender
{
[super ok: sender];
[self _setValuesFromControl: sizeForm];
[self _setValuesFromControl: minForm];
[self _setValuesFromControl: maxForm];
}
- (void) setObject: (id)anObject
{
[super setObject: anObject];
[self _getValuesFromObject: anObject];
}
- (void) setAutoposition: (id)sender
{
unsigned mask = [sender tag];
[super ok: sender];
if ([sender state] == NSOnState)
{
mask = [object autoPositionMask] | mask;
}
else
{
mask = [object autoPositionMask] & ~mask;
}
[object setAutoPositionMask: mask];
}
@end

View file

@ -25,11 +25,22 @@ include $(GNUSTEP_MAKEFILES)/common.make
PALETTE_NAME = 2Controls
2Controls_PALETTE_ICON = ControlsPalette
2Controls_OBJC_FILES = \
main.m \
inspectors.m \
GormPopUpButtonEditor.m \
GormButtonEditor.m
2Controls_OBJC_FILES = GormBoxAttributesInspector.m\
GormCellAttributesInspector.m\
GormColorWellAttributesInspector.m\
GormFormAttributesInspector.m\
GormPopUpButtonAttributesInspector.m\
GormSliderAttributesInspector.m\
GormStepperAttributesInspector.m\
GormProgressIndicatorAttributesInspector.m\
GormTextFieldAttributesInspector.m\
GormMatrixAttributesInspector.m\
main.m \
GormPopUpButtonEditor.m \
GormButtonEditor.m\
inspectors.m
# GormButtonAttributesInspector.m\
2Controls_PRINCIPAL_CLASS = ControlsPalette

View file

@ -0,0 +1,61 @@
/*
GormBoxAttributesInspector.h
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: 2003, 2004, 2005
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormBoxAttributesInspector_h
#define INCLUDED_GormBoxAttributesInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSButton;
@class NSColorWell;
@class NSForm;
@class NSMatrix;
@class NSSlider;
@interface GormBoxAttributesInspector:IBInspector
{
NSMatrix *positionMatrix;
NSMatrix *borderMatrix;
NSForm *titleForm;
NSSlider *horizontalSlider;
NSSlider *verticalSlider;
NSColorWell *colorWell;
NSButton *backgroundSwitch;
}
@end
#endif /* INCLUDED_GormBoxAttributesInspector_h */

View file

@ -0,0 +1,174 @@
/*
GormBoxAttributesInspector.m
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: 2003, 2004, 2005
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Split inspector classes into separate files.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormBoxAttributesInspector.h"
#warning NSColorWell bug ?
#include <GormCore/NSColorWell+GormExtensions.h>
#include <Foundation/NSNotification.h>
#include <AppKit/NSButton.h>
#include <AppKit/NSBox.h>
#include <AppKit/NSForm.h>
#include <AppKit/NSMatrix.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSSlider.h>
#include <AppKit/NSTextFieldCell.h>
/* This macro makes sure that the string contains a value, even if @"" */
#define VSTR(str) ({id _str = str; (_str) ? _str : @"";})
/*
IBObjectAdditions category
*/
@implementation NSBox (IBObjectAdditions)
- (NSString*) inspectorClassName
{
return @"GormBoxAttributesInspector";
}
@end
@implementation GormBoxAttributesInspector
- (id) init
{
if ([super init] == nil)
return nil;
if ([NSBundle loadNibNamed: @"GormNSBoxInspector" owner: self] == NO)
{
NSLog(@"Could not load GormBoxInspector");
return nil;
}
return self;
}
/* Commit changes that the user makes in the Attributes Inspector */
- (void) ok: (id) sender
{
/* Position */
if (sender == positionMatrix)
{
[object setTitlePosition: [[sender selectedCell] tag]];
}
/* border type */
else if (sender == borderMatrix)
{
[object setBorderType: [[sender selectedCell] tag]];
}
/* title */
else if (sender == titleForm)
{
[object setTitle: [[sender cellAtIndex: 0] stringValue]];
}
/* content view margins */
else if (sender == horizontalSlider)
{
[object setContentViewMargins:
NSMakeSize([sender floatValue], [verticalSlider floatValue])];
}
else if (sender == verticalSlider)
{
[object setContentViewMargins:
NSMakeSize([horizontalSlider floatValue], [sender floatValue])];
}
/* title cell : background color */
#warning seems to not work
else if(sender == colorWell)
{
NSTextFieldCell *titleCell = (NSTextFieldCell *)[object titleCell];
if([titleCell isKindOfClass: [NSTextFieldCell class]])
{
[titleCell setBackgroundColor: [colorWell color]];
[object display];
}
}
#warning NSBox is borken ?
else if(sender == backgroundSwitch)
{
NSTextFieldCell *titleCell = (NSTextFieldCell *)[object titleCell];
if([titleCell isKindOfClass: [NSTextFieldCell class]])
{
BOOL state = ([backgroundSwitch state] == NSOnState)?YES:NO;
[titleCell setDrawsBackground: state];
}
}
[super ok:sender];
}
/* Sync from object ( NSBox ) changes to the inspector */
- (void) revert: (id) sender
{
NSTextFieldCell *titleCell;
if ( object == nil )
return;
/* Position */
[positionMatrix selectCellWithTag: [object titlePosition]];
/* Border Type */
[borderMatrix selectCellWithTag: [object borderType]];
/* title */
[[titleForm cellAtIndex: 0] setStringValue: VSTR([object title])];
/* content view margins */
[horizontalSlider setFloatValue: [object contentViewMargins].width];
[verticalSlider setFloatValue: [object contentViewMargins].height];
/* title cell: background color */
titleCell = (NSTextFieldCell *)[object titleCell];
if([titleCell isKindOfClass: [NSTextFieldCell class]])
{
[colorWell setColorWithoutAction: [titleCell backgroundColor]];
[backgroundSwitch setState: ([titleCell drawsBackground]?
NSOnState:NSOffState)];
}
[super revert:sender];
}
/* delegate method for titleForm */
- (void)controlTextDidChange:(NSNotification *)aNotification
{
[self ok:[aNotification object]];
}
@end

View file

@ -0,0 +1,59 @@
/*
GormButtonAttributesInspector.h
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormButtonAttributesInspector_h
#define INCLUDED_GormButtonAttributesInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSForm;
@class NSMatrix;
@class NSPopUpButton;
@interface GormButtonAttributesInspector: IBInspector
{
NSMatrix *alignMatrix;
NSMatrix *iconMatrix;
NSForm *keyField;
NSMatrix *optionMatrix;
NSForm *tagForm;
NSMatrix *titleForm;
NSPopUpButton *typePopUpButton;
NSPopUpButton *keyEquivPopUpButton;
}
@end
#endif /* INCLUDED_GormButtonAttributesInspector_h */

View file

@ -0,0 +1,188 @@
#include "GormButtonAttributesInspector.h"
/* This macro makes sure that the string contains a value, even if @"" */
#define VSTR(str) ({id _str = str; (_str) ? _str : @"";})
@implementation GormButtonAttributesInspector
- (id) init
{
if ([super init] == nil)
return nil;
if ([NSBundle loadNibNamed: @"GormNSButtonInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormButtonInspector");
return nil;
}
#warning Why ?
/* Need to set up popup button */
[typeButton removeAllItems];
[typeButton addItemWithTitle: @"Momentary Push"];
[[typeButton lastItem] setTag: 0];
[typeButton addItemWithTitle: @"Push On/Off"];
[[typeButton lastItem] setTag: 1];
[typeButton addItemWithTitle: @"Toggle"];
[[typeButton lastItem] setTag: 2];
[typeButton addItemWithTitle: @"Momentary Change"];
[[typeButton lastItem] setTag: 5];
[typeButton addItemWithTitle: @"On/Off"];
[[typeButton lastItem] setTag: 6];
[typeButton addItemWithTitle: @"Momentary Light"];
[[typeButton lastItem] setTag: 7];
/* Doesn't work yet? */
// [typeButton setAction: @selector(setButtonTypeFrom:)];
// [typeButton setTarget: self];
return self;
}
- (void) ok: (id) sender
{
if (sender == alignMatrix)
{
[object setAlignment: (NSTextAlignment)[[sender selectedCell] tag]];
}
else if (sender == iconMatrix)
{
[object setImagePosition:
(NSCellImagePosition)[[sender selectedCell] tag]];
}
else if (sender == keyField)
{
[keyEquiv selectItem: nil]; // if the user does his own thing, select the default...
[object setKeyEquivalent: [[sender cellAtIndex: 0] stringValue]];
}
else if (sender == optionMatrix)
{
BOOL flag;
flag = ([[sender cellAtRow: 0 column: 0] state] == NSOnState) ? YES : NO;
[object setBordered: flag]; flag = ([[sender cellAtRow: 1 column: 0] state] == NSOnState) ? YES : NO;
[object setContinuous: flag];
flag = ([[sender cellAtRow: 2 column: 0] state] == NSOnState) ? YES : NO;
[object setEnabled: flag];
[object setState: [[sender cellAtRow: 3 column: 0] state]];
flag = ([[sender cellAtRow: 4 column: 0] state] == NSOnState) ? YES : NO;
[object setTransparent: flag];
}
else if (sender == tagField)
{
[object setTag: [[sender cellAtIndex: 0] intValue]];
}
else if (sender == titleForm)
{
NSString *string;
NSImage *image;
[object setTitle: [[sender cellAtIndex: 0] stringValue]];
[object setAlternateTitle: [[sender cellAtIndex: 1] stringValue]];
string = [[sender cellAtIndex: 2] stringValue];
if ([string length] > 0)
{
image = [NSImage imageNamed: string];
[object setImage: image];
}
string = [[sender cellAtIndex: 3] stringValue];
if ([string length] > 0)
{
image = [NSImage imageNamed: string];
[object setAlternateImage: image];
}
}
else if (sender == typeButton)
{
[self setButtonType: [[sender selectedItem] tag] forObject: object];
}
else if ([sender isKindOfClass: [NSMenuItem class]] )
{
/*
* In old NSPopUpButton implementation we do receive
* the selected menu item here. Not the PopUpbutton 'typeButton'
* FIXME: Ideally we should also test if the menu item belongs
* to the 'type button' control. How to do that?
*/
[self setButtonType: [sender tag] forObject: object];
}
}
-(void) revert:(id) anObject
{
NSImage *image;
NSString *key = VSTR([anObject keyEquivalent]);
if (anObject != object)
{
return;
}
[alignMatrix selectCellWithTag: [anObject alignment]];
[iconMatrix selectCellWithTag: [anObject imagePosition]];
[[keyField cellAtIndex: 0] setStringValue: VSTR([anObject keyEquivalent])];
if([key isEqualToString: @"\n"])
{
[keyEquiv selectItemAtIndex: 1];
}
else if([key isEqualToString: @"\b"])
{
[keyEquiv selectItemAtIndex: 2];
}
else if([key isEqualToString: @"\E"])
{
[keyEquiv selectItemAtIndex: 3];
}
else if([key isEqualToString: @"\t"])
{
[keyEquiv selectItemAtIndex: 4];
}
else
{
[keyEquiv selectItem: nil];
}
[optionMatrix deselectAllCells];
if ([anObject isBordered])
[optionMatrix selectCellAtRow: 0 column: 0];
if ([anObject isContinuous])
[optionMatrix selectCellAtRow: 1 column: 0];
if ([anObject isEnabled])
[optionMatrix selectCellAtRow: 2 column: 0];
if ([anObject state] == NSOnState)
[optionMatrix selectCellAtRow: 3 column: 0];
if ([anObject isTransparent])
[optionMatrix selectCellAtRow: 4 column: 0];
[[tagField cellAtIndex: 0] setIntValue: [anObject tag]];
[[titleForm cellAtIndex: 0] setStringValue: VSTR([anObject title])];
[[titleForm cellAtIndex: 1] setStringValue: VSTR([anObject alternateTitle])];
image = [anObject image];
if (image != nil)
{
[[titleForm cellAtIndex: 2] setStringValue: VSTR([image name])];
}
else
{
[[titleForm cellAtIndex: 2] setStringValue: @""];
}
image = [anObject alternateImage];
if (image != nil)
{
[[titleForm cellAtIndex: 3] setStringValue: VSTR([image name])];
}
else
{
[[titleForm cellAtIndex: 3] setStringValue: @""];
}
[typeButton selectItemAtIndex:
[typeButton indexOfItemWithTag: [self buttonTypeForObject: anObject]]];
}

View file

@ -0,0 +1,52 @@
/*
GormCellAttributesInspector.h
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: 2003,2004,2005
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormCellAttributesInspector_h
#define INCLUDED_GormCellAttributesInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSButton;
@class NSForm;
@interface GormCellAttributesInspector: IBInspector
{
NSButton *disabledSwitch;
NSForm *tagForm;
}
@end
#endif /* INCLUDED_GormCellAttributesInspector_h */

View file

@ -0,0 +1,108 @@
/*
GormCellAttributesInspector.m
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: 2003,2004,2005
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Split inspector classes into separate files.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormCellAttributesInspector.h"
#include <Foundation/NSNotification.h>
#include <AppKit/NSButton.h>
#include <AppKit/NSCell.h>
#include <AppKit/NSForm.h>
#include <AppKit/NSNibLoading.h>
/*
IBObjectAdditions category
*/
@implementation NSCell (IBObjectAdditions)
- (NSString*) inspectorClassName
{
return @"GormCellAttributesInspector";
}
@end
@implementation GormCellAttributesInspector
- (id) init
{
if ([super init] == nil)
{
return nil;
}
if ([NSBundle loadNibNamed: @"GormNSCellInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormCellInspector");
return nil;
}
return self;
}
/* Commit changes that the user makes in the Attributes Inspector */
- (void) ok:(id) sender
{
if (sender == disabledSwitch)
{
[object setEnabled: [disabledSwitch state]];
}
else if (sender == tagForm)
{
[object setTag: [[sender cellAtIndex: 0] intValue]];
}
[super ok: sender];
}
/* Sync from object ( NSCell ) changes to the inspector */
- (void) revert:(id) sender
{
if ( object == nil)
return;
[disabledSwitch setState: [object isEnabled]];
[[tagForm cellAtRow: 0 column: 0] setIntValue: [object tag]];
[super revert:sender];
}
/* delegate method for tagForm */
- (void)controlTextDidChange:(NSNotification *)aNotification
{
[self ok:[aNotification object]];
}
@end

View file

@ -0,0 +1,54 @@
/*
GormColorWellAttributesInspector.h
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: 2003,2004,2005
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormColorWellAttributesInspector_h
#define INCLUDED_GormColorWelldAttributesInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSButton;
@class NSColorWell;
@class NSTextField;
@interface GormColorWellAttributesInspector:IBInspector
{
NSColorWell *initialColorWell;
NSButton *disabledSwitch;
NSButton *borderedSwitch;
NSTextField *tagField;
}
@end
#endif /* INCLUDED_GormColorWelldAttributesInspector_h */

View file

@ -0,0 +1,128 @@
/*
GormColorWellAttributesInspector.m
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: 2003,2004,2005
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Split inspector classes into separate files.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormColorWellAttributesInspector.h"
#warning GNUstep bug ?
#include <GormCore/NSColorWell+GormExtensions.h>
#include <Foundation/NSNotification.h>
#include <AppKit/NSButton.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSTextField.h>
/*
IBObjectAdditions category
*/
@implementation NSColorWell (IBObjectAdditions)
- (NSString *) inspectorClassName
{
return @"GormColorWellAttributesInspector";
}
@end
@implementation GormColorWellAttributesInspector
-(id) init
{
if ( ( self = [super init] ) == nil )
{
return nil;
}
if ([NSBundle loadNibNamed: @"GormNSColorWellInspector"
owner: self] == NO)
{
NSLog(@"Could not open gorm GormNSColorWellInspector");
return nil;
}
return self;
}
/* Commit changes that the user makes in the Attributes Inspector */
- (void) ok: (id) sender
{
if ( sender == initialColorWell )
{
[object setColor: [initialColorWell color]];
}
else if ( sender == disabledSwitch )
{
[object setEnabled: [disabledSwitch state]];
}
else if ( sender == borderedSwitch )
{
[object setBordered: [borderedSwitch state]];
}
else if ( sender == tagField )
{
[object setTag: [tagField intValue]];
}
[super ok:sender];
}
/* Sync from object ( NSColorWell ) changes to the inspector */
- (void) revert:(id) sender
{
if ( object == nil )
return;
[disabledSwitch setState: [object isEnabled]];
[borderedSwitch setState: [object isBordered]];
[initialColorWell setColorWithoutAction: [object color]];
[tagField setIntValue: [object tag]];
[super revert:sender];
}
/* delegate method for tag Field */
- (void)controlTextDidChange:(NSNotification *)aNotification
{
[self ok: [aNotification object]];
}
@end

View file

@ -0,0 +1,61 @@
/*
GormFormAttributesInspector.h
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: 2003,2004,2005
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormFormAttributesInspector_h
#define INCLUDED_GormFormAttributesInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSButton;
@class NSColorWell;
@class NSForm;
@class NSMatrix;
@interface GormFormAttributesInspector: IBInspector
{
NSButton *cellPositionSwitch;
NSButton *editableSwitch;
NSButton *selectableSwitch;
NSButton *scrollableSwitch;
id backgroundColorWell;
id drawsBackgroundSwitch;
id tagForm;
id textMatrix;
id titleMatrix;
}
@end
#endif /* INCLUDED_GormFormAttributesInspector_h */

View file

@ -0,0 +1,265 @@
/*
GormFormAttributesInspector.m
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: 2003,2004,2005
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Split inspector classes into separate files.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormFormAttributesInspector.h"
#warning GNUstep bug ?
#include <GormCore/NSColorWell+GormExtensions.h>
#include <Foundation/NSNotification.h>
#include <AppKit/NSButton.h>
#include <AppKit/NSForm.h>
#include <AppKit/NSMatrix.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSFormCell.h>
/*
IBObjectAdditions category
*/
@implementation NSForm (IBObjectAdditions)
- (NSString*) inspectorClassName
{
return @"GormFormAttributesInspector";
}
@end
@implementation GormFormAttributesInspector
- (id) init
{
if ([super init] == nil)
{
return nil;
}
if ([NSBundle loadNibNamed: @"GormNSFormInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormFormInspector");
return nil;
}
return self;
}
/* Commit changes that the user makes in the Attributes Inspector */
- (void) ok:(id) sender
{
int rows;
int cols;
int i;
[object getNumberOfRows: &rows columns: &cols];
/* background color */
if (sender == backgroundColorWell)
{
[object setBackgroundColor: [sender color]];
}
else if (sender == drawsBackgroundSwitch)
{
[object setDrawsBackground: ([sender state] == NSOnState)];
}
/* options */
else if (sender == cellPositionSwitch)
{
BOOL flag;
flag = ([cellPositionSwitch state] == NSOnState) ? YES : NO;
if (flag == YES)
{
for (i = 0; i < rows; i++)
{
[[object cellAtIndex: i] setTag: i];
}
}
}
else if ( sender == editableSwitch )
{
BOOL flag = ([editableSwitch state] == NSOnState) ? YES : NO;
for (i = 0; i < rows; i++)
{
[[object cellAtIndex: i] setEditable: flag];
}
}
else if ( sender == selectableSwitch )
{
BOOL flag = ([selectableSwitch state] == NSOnState) ? YES : NO;
for (i = 0; i < rows; i++)
{
[[object cellAtIndex: i] setSelectable: flag];
}
}
else if ( sender == scrollableSwitch )
{
BOOL flag = ([scrollableSwitch state] == NSOnState) ? YES : NO;
for (i = 0; i < rows; i++)
{
[[object cellAtIndex: i] setScrollable: flag];
}
}
/* text alignment */
else if (sender == textMatrix)
{
[object setTextAlignment: (NSTextAlignment)[[sender selectedCell] tag]];
}
/* title alignment */
else if (sender == titleMatrix)
{
[object setTitleAlignment: (NSTextAlignment)[[sender selectedCell] tag]];
}
/* tag */
else if (sender == tagForm)
{
[object setTag: [[sender cellAtIndex: 0] intValue]];
}
[super ok:sender];
}
/* Sync from object ( NSForm ) changes to the inspector */
- (void) revert: (id) sender
{
if ( object == nil )
return;
/* background color */
[backgroundColorWell setColorWithoutAction: [object backgroundColor]];
[drawsBackgroundSwitch setState:
([object drawsBackground]) ? NSOnState : NSOffState];
/* alignments */
[textMatrix selectCellWithTag: [[object cellAtIndex: 0] alignment]];
[titleMatrix selectCellWithTag: [[object cellAtIndex: 0] titleAlignment]];
/* options */
[editableSwitch setState:[[object cellAtIndex: 0] isEditable]];
[selectableSwitch setState:[[object cellAtIndex: 0] isSelectable]];
[scrollableSwitch setState:[[object cellAtIndex: 0] isScrollable]];
// Cells tags = position is not directly stored in the Form so guess it.
{
int rows;
int cols;
int i;
BOOL flag;
[object getNumberOfRows: &rows columns: &cols];
i = 0;
do
{
flag = ([[object cellAtIndex: i] tag] == i);
}
while (flag && (++i < rows));
if (flag)
{
[cellPositionSwitch setState:NSOnState];
}
}
/* tag */
[[tagForm cellAtRow: 0 column: 0] setIntValue: [object tag]];
[super revert:sender];
}
/* delegate method for tagForm */
-(void) controlTextDidChange:(NSNotification*) aNotification
{
[self ok:[aNotification object]];
}
/* The button type isn't stored in the button, so reverse-engineer it */
- (NSButtonType) buttonTypeForObject: button
{
NSButtonCell *cell;
NSButtonType type;
int highlight, stateby;
/* We could be passed the button or the cell */
cell = ([button isKindOfClass: [NSButton class]]) ? [button cell] : button;
highlight = [cell highlightsBy];
stateby = [cell showsStateBy];
NSDebugLog(@"highlight = %d, stateby = %d",
[cell highlightsBy],[cell showsStateBy]);
type = NSMomentaryPushButton;
if (highlight == NSChangeBackgroundCellMask)
{
if (stateby == NSNoCellMask)
type = NSMomentaryLight;
else
type = NSOnOffButton;
}
else if (highlight == (NSPushInCellMask | NSChangeGrayCellMask))
{
if (stateby == NSNoCellMask)
type = NSMomentaryPushButton;
else
type = NSPushOnPushOffButton;
}
else if (highlight == (NSPushInCellMask | NSContentsCellMask))
{
type = NSToggleButton;
}
else if (highlight == NSContentsCellMask)
{
if (stateby == NSNoCellMask)
type = NSMomentaryChangeButton;
else
type = NSToggleButton; /* Really switch or radio. What should it be? */
}
else
{
NSDebugLog(@"Ack! no button type");
}
return type;
}
/* We may need to reset some parameters based on the previous type */
- (void) setButtonType: (NSButtonType)type forObject: (id)button
{
[object setButtonType: type];
}
@end

View file

@ -0,0 +1,58 @@
/*
GormMatrixdAttributesInspector.h
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormMatrixAttributesInspector_h
#define INCLUDED_GormMatrixAttributesInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSButton;
@class NSColorWell;
@class NSForm;
@class NSMatrix;
@interface GormMatrixAttributesInspector:IBInspector
{
NSButton *autosizeSwitch;
NSButton *autotagSwitch;
NSColorWell *backgroundColorWell;
NSButton *drawsBackgroundSwitch;
NSMatrix *modeMatrix;
NSButton *propagateSwitch;
NSMatrix *prototypeMatrix;
NSButton *selRectSwitch;
NSForm *tagForm;
}
@end
#endif /* INCLUDED_GormMatrixAttributesInspector_h */

View file

@ -0,0 +1,187 @@
/*
GormMatrixdAttributesInspector.m
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Split inspector classes into separate files.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormMatrixAttributesInspector.h"
#warning GNUstep bug ?
#include <GormCore/NSColorWell+GormExtensions.h>
#include <Foundation/NSNotification.h>
#include <AppKit/NSButton.h>
#include <AppKit/NSForm.h>
#include <AppKit/NSMatrix.h>
#include <AppKit/NSNibLoading.h>
@implementation NSMatrix (IBObjectAdditions)
- (NSString*) inspectorClassName
{
return @"GormMatrixAttributesInspector";
}
@end
@implementation GormMatrixAttributesInspector
- (id) init
{
if ([super init] == nil)
{
return nil;
}
if ([NSBundle loadNibNamed: @"GormNSMatrixInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormMatrixInspector");
return nil;
}
return self;
}
/* Commit changes that the user makes in the Attributes Inspector */
- (void) ok: (id) sender
{
if (sender == autosizeSwitch)
{
[object setAutosizesCells: ([sender state] == NSOnState)];
}
else if (sender == autotagSwitch)
{
int rows;
int cols;
int i;
[object getNumberOfRows: &rows columns: &cols];
if ((rows == 1) && (cols > 1))
{
for (i = 0; i < cols; i++)
{
[[object cellAtRow:0 column:i] setTag: i];
}
}
else if ((rows > 1) && (cols ==1))
{
for (i = 0; i < rows; i++)
{
[[object cellAtRow:i column:0] setTag: i];
}
}
}
else if (sender == backgroundColorWell)
{
[object setBackgroundColor: [sender color]];
}
else if (sender == drawsBackgroundSwitch)
{
[object setDrawsBackground: ([sender state] == NSOnState)];
}
else if (sender == modeMatrix)
{
[(NSMatrix *)object setMode: [[sender selectedCell] tag]];
}
else if (sender == propagateSwitch)
{
//Nothing for the moment - must implement Prototype
// item in the pull down menu
}
else if (sender == selRectSwitch)
{
[object setSelectionByRect: ([sender state] == NSOnState)];
}
else if (sender == tagForm)
{
[object setTag: [[sender cellAtIndex: 0] intValue]];
}
/*
* prototypeMatrix
* If prototype cell is set show it else show a matrix cell
*/
if ([object prototype] == nil)
{
[prototypeMatrix putCell: [object cellAtRow:0 column:0] atRow:0 column:0];
}
else
{
[prototypeMatrix putCell: [object prototype] atRow:0 column:0];
}
[super ok:sender];
}
/* Sync from object ( NSMatrix ) changes to the inspector */
- (void) revert:(id)sender
{
if (object == nil)
return;
[autosizeSwitch setState:
([object autosizesCells]) ? NSOnState : NSOffState];
{
int rows;
int cols;
[object getNumberOfRows: &rows columns: &cols];
if ((rows == 1 && cols > 1) || (cols == 1 && rows > 1))
[autotagSwitch setEnabled: YES];
else
[autotagSwitch setEnabled: NO];
}
[backgroundColorWell setColorWithoutAction: [object backgroundColor]];
[drawsBackgroundSwitch setState:
([object drawsBackground]) ? NSOnState : NSOffState];
[modeMatrix selectCellWithTag: [(NSMatrix *)object mode]];
[selRectSwitch setState:
([object isSelectionByRect]) ? NSOnState : NSOffState];
[[tagForm cellAtIndex: 0] setIntValue: [object tag]];
[super revert:sender];
}
/* delegate method for tag Form */
-(void) controlTextDidChange:(NSNotification*) aNotification
{
[self ok:[aNotification object]];
}
@end

View file

@ -1,15 +1,13 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
GormBoxInspector = {
GormBoxAttributesInspector = {
Actions = (
);
Outlets = (
borderMatrix,
horizontalSlider,
positionMatrix,
tagField,
tagForm,
titleField,
titleForm,
verticalSlider,
colorWell,
backgroundSwitch

View file

@ -13,9 +13,9 @@
Outlets = (
alignMatrix,
iconMatrix,
keyField,
keyForm,
optionMatrix,
tagField,
tagForm,
titleForm,
typeButton,
keyEquiv

View file

@ -2,26 +2,18 @@
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"orderFrontFontPanel:",
"tagSelected:",
"borderedSelected:",
"disabledSelected:",
"initialColorSelected:"
"orderFrontFontPanel:"
);
Super = NSObject;
};
GormColorWellInspector = {
Actions = (
"tagSelected:",
"borderedSelected:",
"disabledSelected:",
"initialColorSelected:"
);
Outlets = (
bordered,
disabled,
initialColor,
tagValue
borderedSwitch,
disabledSwitch,
initialColorWell,
tagField
);
Super = IBInspector;
};

View file

@ -6,10 +6,13 @@
Outlets = (
backgroundColorWell,
drawsBackgroundSwitch,
optionMatrix,
tagForm,
textMatrix,
titleMatrix
titleMatrix,
cellPositionSwitch,
editableSwitch,
scrollableSwitch,
selectableSwitch
);
Super = IBInspector;
};

View file

@ -2,32 +2,28 @@
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"orderFrontFontPanel:",
"borderSelected:",
"verticalSelected:",
"indeterminateSelected:",
"maxValueSelected:",
"minValueSelected:",
"inderterminateSelected:"
"revert:",
"orderFrontFontPanel:"
);
Super = NSObject;
};
GormProgressIndicatorInspector = {
Actions = (
"borderSelected:",
"verticalSelected:",
"inderterminateSelected:",
"maxValueSelected:",
"minValueSelected:"
);
Outlets = (
vertical,
maxValue,
minValue,
indeterminate,
borderMatrix,
doubleValue
indeterminate
);
Super = IBInspector;
};
NSBox = {
Actions = (
"revert:",
"ok:"
);
Super = NSView;
};
}

View file

@ -4,17 +4,12 @@
Actions = (
);
Outlets = (
altForm,
altIncrementForm,
knobField,
knobThicknessForm,
numberOfTicks,
optionMatrix,
snapToTicks,
tagForm,
tickPosition,
unitForm,
valueForm
valuesForm,
continuousSwitch,
enabledSwitch
);
Super = IBInspector;
};

View file

@ -8,10 +8,11 @@
backgroundColor,
borderMatrix,
drawsBackground,
optionMatrix,
tagField,
tagForm,
textColor
textColor,
editableSwitch,
scrollableSwitch,
selectabelSwitch
);
Super = IBInspector;
};

View file

@ -0,0 +1,56 @@
/*
GormPopUpButtonAttributesInspector.h
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormPopUpButtonAttributesInspector_h
#define INCLUDED_GormPopUpButtonAttributesInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSButton;
@class NSForm;
@class NSMatrix;
@interface GormPopUpButtonAttributesInspector:IBInspector
{
NSMatrix *typeMatrix;
NSButton *autoenableSwitch;
NSButton *enableSwitch;
NSForm *tagForm;
NSForm *defaultItemForm;
}
@end
#endif /* INCLUDED_GormPopUpButtonAttributesInspector_h */

View file

@ -0,0 +1,127 @@
/*
GormPopUpButtonAttributesInspector.m
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Split inspector classes into separate files.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormPopUpButtonAttributesInspector.h"
#include <AppKit/NSButton.h>
#include <AppKit/NSForm.h>
#include <AppKit/NSMatrix.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSPopUpButton.h>
/*
IBObjectAdditions category
*/
@implementation NSPopUpButton (IBObjectAdditions)
- (NSString*) inspectorClassName
{
return @"GormPopUpButtonAttributesInspector";
}
@end
@implementation GormPopUpButtonAttributesInspector
- (id) init
{
if ([super init] == nil)
return nil;
if ([NSBundle loadNibNamed: @"GormNSPopUpButtonInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormPopUpButtonInspector");
return nil;
}
return self;
}
/* Commit changes that the user makes in the Attributes Inspector */
- (void) ok: (id) sender
{
if (sender == typeMatrix)
{
id selectedItem;
[object setPullsDown: [[sender selectedCell] tag]];
selectedItem = [object selectedItem];
[object selectItem: nil];
[object selectItem: selectedItem];
}
else if (sender == autoenableSwitch)
{
[object setAutoenablesItems: ([sender state] == NSOnState)];
}
else if (sender == enableSwitch)
{
[object setEnabled: ([sender state] == NSOnState)];
}
else if (sender == tagForm)
{
[object setTag: [[sender cellAtIndex: 0] intValue]];
}
else if (sender == defaultItemForm)
{
int index = [[sender cellAtIndex: 0] intValue];
int num = [object numberOfItems];
// if the user enters more than the number, select the last item.
index = (index < num && index >= 0) ? index : num;
[object selectItemAtIndex: index];
}
[super ok: sender];
}
/* Sync from object ( NSPopUpButton ) changes to the inspector */
- (void) revert: (id)sender
{
if ( object == nil)
return;
[typeMatrix selectCellWithTag: [object pullsDown]];
[autoenableSwitch setState: [object autoenablesItems]];
[enableSwitch setState: [object isEnabled]];
[[tagForm cellAtRow: 0 column: 0] setIntValue: [object tag]];
[[defaultItemForm cellAtRow: 0 column: 0] setIntValue: [object indexOfSelectedItem]];
[super revert:sender];
}
/* delegate method for tagForm and defaultItemForm */
-(void) controlTextDidChange:(NSNotification*) aNotification
{
[self ok:[aNotification object]];
}
@end

View file

@ -0,0 +1,53 @@
/*
GormProgressIndicatorAttributesInspector.h
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormProgressIndicatorAttributesInspector_h
#define INCLUDED_GormProgressIndicatorAttributesInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSButton;
@class NSTextField;
@interface GormProgressIndicatorAttributesInspector: IBInspector
{
NSButton *indeterminate;
NSButton *vertical;
NSTextField *minValue;
NSTextField *maxValue;
}
@end
#endif /* INCLUDED_GormProgressIndicatorAttributesInspector_h */

View file

@ -0,0 +1,116 @@
/*
GormProgressIndicatorAttributesInspector.m
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Split inspector classes into separate files.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormProgressIndicatorAttributesInspector.h"
#include <Foundation/NSNotification.h>
#include <AppKit/NSButton.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSProgressIndicator.h>
#include <AppKit/NSTextField.h>
/*
IBObjectAdditions category
*/
@implementation NSProgressIndicator (IBObjectAdditions)
- (NSString *) inspectorClassName
{
return @"GormProgressIndicatorAttributesInspector";
}
@end
@implementation GormProgressIndicatorAttributesInspector
-(id) init
{
if ( ( self = [super init] ) == nil)
return nil;
if ( [NSBundle loadNibNamed: @"GormNSProgressIndicatorInspector"
owner: self] == NO )
{
NSLog(@"Could not open gorm GormNSProgressIndicatorInspector");
return nil;
}
return self;
}
/* Commit changes that the user makes in the Attributes Inspector */
-(void) ok: (id) sender
{
if ( sender == indeterminate )
{
[object setIndeterminate: ([indeterminate state] == NSOnState)];
}
else if (sender == vertical )
{
[object setVertical: ([vertical state] == NSOnState)];
}
else if ( sender == minValue )
{
[object setMinValue: [minValue doubleValue]];
}
else if ( sender == maxValue )
{
[object setMaxValue: [maxValue doubleValue]];
}
[super ok: sender];
}
/* Sync from object (ProgressIndicator ) changes to the inspector */
- (void) revert:(id) sender
{
if ( object == nil )
return;
[indeterminate setState: [object isIndeterminate]?NSOnState:NSOffState];
[vertical setState: [object isVertical] ? NSOnState:NSOffState];
[minValue setIntValue: [object minValue]];
[maxValue setIntValue: [object maxValue]];
[super revert:sender];
}
/* delegate method for titleForm */
- (void)controlTextDidChange:(NSNotification *)aNotification
{
[self ok: [aNotification object]];
}
@end

View file

@ -0,0 +1,55 @@
/*
GormSliderAttributesInspector.h
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormSliderAttributesInspector_h
#define INCLUDED_GormSliderAttributesInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSButton;
@class NSForm;
@interface GormSliderAttributesInspector: IBInspector
{
NSForm *valuesForm;
NSForm *altIncrementForm;
NSButton *continuousSwitch;
NSButton *enabledSwitch;
NSForm *knobThicknessForm;
NSForm *tagForm;
}
@end
#endif /* INCLUDED_GormSliderAttributesInspector_h */

View file

@ -0,0 +1,134 @@
/*
GormSliderAttributesInspector.m
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Split inspector classes into separate files.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormSliderAttributesInspector.h"
#include <Foundation/NSNotification.h>
#include <AppKit/NSButton.h>
#include <AppKit/NSForm.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSSlider.h>
/*
IBObjectAdditions category
*/
@implementation NSSlider (IBObjectAdditions)
- (NSString*) inspectorClassName
{
return @"GormSliderAttributesInspector";
}
@end
@implementation GormSliderAttributesInspector
- (id) init
{
if ([super init] == nil)
{
return nil;
}
if ([NSBundle loadNibNamed: @"GormNSSliderInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormSliderInspector");
return nil;
}
return self;
}
/* Commit changes that the user makes in the Attributes Inspector */
- (void) ok:(id) sender
{
if (sender == valuesForm)
{
[object setMinValue: [[sender cellAtIndex: 0] doubleValue]];
[object setDoubleValue: [[sender cellAtIndex: 1] doubleValue]];
[object setMaxValue: [[sender cellAtIndex: 2] doubleValue]];
}
else if ( sender == continuousSwitch )
{
[object setContinuous: [continuousSwitch state]];
}
else if ( sender == enabledSwitch )
{
[object setEnabled: [enabledSwitch state]];
}
else if (sender == altIncrementForm)
{
[[object cell] setAltIncrementValue:
[[sender cellAtIndex: 0] doubleValue]];
}
else if (sender == knobThicknessForm)
{
[[object cell] setKnobThickness:
[[sender cellAtIndex: 0] floatValue]];
}
else if (sender == tagForm)
{
[[object cell] setTag: [[sender cellAtIndex: 0] intValue]];
}
}
/* Sync from object ( NSSlider ) changes to the inspector */
- (void) revert:(id) sender
{
if ( object == nil)
return;
[[valuesForm cellAtIndex: 0] setDoubleValue: [object minValue]];
[[valuesForm cellAtIndex: 1] setDoubleValue: [object doubleValue]];
[[valuesForm cellAtIndex: 2] setDoubleValue: [object maxValue]];
[continuousSwitch setState:[object isContinuous]];
[enabledSwitch setState:[object isEnabled]];
[[altIncrementForm cellAtIndex: 0] setDoubleValue:
[[object cell] altIncrementValue]];
[[knobThicknessForm cellAtIndex: 0] setFloatValue:
[[object cell] knobThickness]];
[[tagForm cellAtIndex: 0] setIntValue: [[object cell] tag]];
[super revert:sender];
}
/* delegate methods for all Forms */
-(void) controlTextDidChange:(NSNotification *)aNotification
{
[self ok:[aNotification object]];
}
@end

View file

@ -0,0 +1,54 @@
/*
GormStepperAttributesInspector.h
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormStepperAttributesInspector_h
#define INCLUDED_GormStepperAttributesInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSButton;
@class NSTextField;
@interface GormStepperAttributesInspector : IBInspector
{
NSTextField *valueField;
NSTextField *minimumValueField;
NSTextField *maximumValueField;
NSTextField *incrementValueField;
NSButton *autorepeatButton;
NSButton *valueWrapsButton;
}
@end
#endif

View file

@ -0,0 +1,149 @@
/*
GormStepperAttributesInspector.m
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Split inspector classes into separate files.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormStepperAttributesInspector.h"
#include <Foundation/NSNotification.h>
#include <AppKit/NSButton.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSStepper.h>
#include <AppKit/NSTextField.h>
@implementation NSStepper (IBObjectAdditions)
- (NSString*) inspectorClassName
{
return @"GormStepperAttributesInspector";
}
@end
@implementation GormStepperAttributesInspector
- (id) init
{
if ([super init] == nil)
{
return nil;
}
if ([NSBundle loadNibNamed: @"GormNSStepperInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormStepperAttributesInspector");
return nil;
}
return self;
}
/* Commit changes that the user makes in the Attributes Inspector */
- (void) ok: (id) sender
{
if (sender == valueField)
{
[object setDoubleValue:[sender doubleValue]];
}
else if (sender == minimumValueField)
{
[object setMinValue:[sender doubleValue]];
}
else if (sender == maximumValueField)
{
[object setMaxValue:[sender doubleValue]];
}
else if (sender == incrementValueField)
{
[object setIncrement:[sender doubleValue]];
}
else if (sender == autorepeatButton)
{
switch ([sender state])
{
case 0:
[object setAutorepeat: NO];
break;
case 1:
[object setAutorepeat: YES];
break;
}
}
else if (sender == valueWrapsButton)
{
switch ([sender state])
{
case 0:
[object setValueWraps: NO];
break;
case 1:
[object setValueWraps: YES];
break;
}
}
[super ok:(id) sender];
}
/* Sync from object ( NSStepper ) changes to the inspector */
- (void) revert:(id) sender
{
if (object == nil)
return;
[valueField setDoubleValue: [object doubleValue]];
[minimumValueField setDoubleValue: [object minValue]];
[maximumValueField setDoubleValue: [object maxValue]];
[incrementValueField setDoubleValue: [object increment]];
if ([object autorepeat])
[autorepeatButton setState: 1];
else
[autorepeatButton setState: 0];
if ([object valueWraps])
[valueWrapsButton setState: 1];
else
[valueWrapsButton setState: 0];
[super revert:sender];
}
/* delegate methods for NSForms */
-(void) controlTextDidChange:(NSNotification *)aNotification
{
[self ok:[aNotification object]];
}
@end

View file

@ -0,0 +1,61 @@
/*
GormTextFieldAttributesInspector.h
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormTextFieldAttributesInspector_h
#define INCLUDED_GormTextFieldAttributesInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSButton;
@class NSColorWell;
@class NSForm;
@class NSMatrix;
@interface GormTextFieldAttributesInspector: IBInspector
{
NSMatrix *alignMatrix;
NSColorWell *backgroundColor;
NSButton *drawsBackground;
NSColorWell *textColor;
NSMatrix *borderMatrix;
NSButton *editableSwitch;
NSButton *selectableSwitch;
NSButton *scrollableSwitch;
NSForm *tagForm;
}
@end
#endif

View file

@ -0,0 +1,182 @@
/*
GormTextFieldAttributesInspector.m
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Split inspector classes into separate files.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormTextFieldAttributesInspector.h"
#warning GNUstep bug ?
#include <GormCore/NSColorWell+GormExtensions.h>
#include <Foundation/NSNotification.h>
#include <AppKit/NSButton.h>
#include <AppKit/NSForm.h>
#include <AppKit/NSMatrix.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSTextField.h>
/*
IBObjectAdditions category
*/
@implementation NSTextField (IBObjectAdditions)
- (NSString*) inspectorClassName
{
return @"GormTextFieldAttributesInspector";
}
@end
@implementation GormTextFieldAttributesInspector
- (id) init
{
if ([super init] == nil)
return nil;
if ([NSBundle loadNibNamed: @"GormNSTextFieldInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormTextFieldInspector");
return nil;
}
return self;
}
/* Commit changes that the user makes in the Attributes Inspector */
- (void) ok: (id) sender
{
if (sender == alignMatrix)
{
[object setAlignment: (NSTextAlignment)[[sender selectedCell] tag]];
}
else if (sender == backgroundColor)
{
[object setBackgroundColor: [sender color]];
}
else if (sender == drawsBackground)
{
[object setDrawsBackground: [drawsBackground state]];
}
else if (sender == textColor)
{
[object setTextColor: [sender color]];
}
else if ( sender == editableSwitch )
{
NSLog(@"setEditable ");
[object setEditable:[selectableSwitch state]];
}
else if ( sender == selectableSwitch )
{
NSLog(@"setSelectable ");
[object setSelectable:[selectableSwitch state]];
}
else if ( sender == scrollableSwitch )
{
[[object cell] setScrollable:[scrollableSwitch state]];
}
else if (sender == borderMatrix)
{
BOOL bordered, bezeled;
if ([[sender cellAtRow: 0 column: 0] state] == NSOnState)
{
bordered = bezeled = NO;
}
else if ([[sender cellAtRow: 0 column: 1] state] == NSOnState)
{
bordered = YES;
bezeled = NO;
}
else if ([[sender cellAtRow: 0 column: 2] state] == NSOnState)
{
bordered = NO; bezeled = YES;
}
[object setBordered: bordered];
[object setBezeled: bezeled];
}
else if (sender == tagForm)
{
[object setTag: [[sender cellAtIndex: 0] intValue]];
}
[super ok:sender];
}
/* Sync from object ( NSTextField ) changes to the inspector */
- (void) revert:(id) sender
{
if (object == nil)
return;
[alignMatrix selectCellWithTag: [object alignment]];
[backgroundColor setColorWithoutAction: [object backgroundColor]];
[textColor setColorWithoutAction: [object textColor]];
[drawsBackground setState:
([object drawsBackground]) ? NSOnState : NSOffState];
[editableSwitch setState:[object isEditable]];
[selectableSwitch setState:[object isSelectable]];
[scrollableSwitch setState:[[object cell] isScrollable]];
if ([object isBordered] == YES)
{
[borderMatrix selectCellAtRow: 0 column: 1];
}
else
{
if ([object isBezeled] == YES)
[borderMatrix selectCellAtRow: 0 column: 2];
else
[borderMatrix selectCellAtRow: 0 column: 0];
}
[[tagForm cellAtIndex: 0] setIntValue: [object tag]];
[super revert:sender];
}
/* delegate method for tagForm */
-(void) controlTextDidChange:(NSNotification *)aNotification
{
[self ok:[aNotification object]];
}
@end

File diff suppressed because it is too large Load diff

View file

@ -25,6 +25,9 @@ include $(GNUSTEP_MAKEFILES)/common.make
PALETTE_NAME = 3Containers
3Containers_PALETTE_ICON = ContainersPalette
3Containers_PRINCIPAL_CLASS = ContainersPalette
3Containers_OBJC_FILES = \
main.m \
inspectors.m \
@ -32,16 +35,14 @@ PALETTE_NAME = 3Containers
GormNSTableView.m \
GormTableViewEditor.m \
GormTabViewEditor.m \
GormNSOutlineView.m
GormNSOutlineView.m \
GormBrowserAttributesInspector.m \
GormTabViewAttributesInspector.m \
GormTableColumnAttributesInspector.m \
GormTableColumnSizeInspector.m \
GormTableViewAttributesInspector.m \
GormTableViewSizeInspector.m
3Containers_HEADER_FILES = \
GormNSBrowser.h \
GormNSTableView.h \
GormTableViewEditor.h \
GormTabViewEditor.h \
GormNSOutlineView.h
3Containers_PRINCIPAL_CLASS = ContainersPalette
3Containers_RESOURCE_FILES = \
ContainersPalette.tiff \
GormNSBrowserInspector.gorm \

View file

@ -0,0 +1,59 @@
/*
GormBrowserAttributesInspector.h
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormBrowserAttributesInspector_h
#define INCLUDED_GormBrowserAttributesInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSButton;
@class NSForm;
@class NSTextField;
@interface GormBrowserAttributesInspector : IBInspector
{
/* options */
NSButton *branchSelectionSwitch;
NSButton *displayTitlesSwitch;
NSButton *emptySelectionSwitch;
NSButton *multipleSelectionSwitch;
NSButton *horizontalScrollerSwitch;
NSButton *separateColumnsSwitch;
NSForm *tagForm;
NSTextField *minColumnWidthField;
}
@end
#endif /* INCLUDED_GormBrowserAttributesInspector_h */

View file

@ -0,0 +1,134 @@
/*
GormBrowserAttributesInspector.m
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Gregory John Casamento <greg_casamento@yahoo.com>
Date: Aug 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Split inspector classes into separate files.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormBrowserAttributesInspector.h"
#include <Foundation/NSNotification.h>
#include <AppKit/NSBrowser.h>
#include <AppKit/NSButton.h>
#include <AppKit/NSForm.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSTextField.h>
@implementation GormBrowserAttributesInspector
- (id) init
{
if ([super init] == nil)
{
return nil;
}
if ([NSBundle loadNibNamed: @"GormNSBrowserInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormBrowserInspector");
return nil;
}
return self;
}
/* Commit changes that the user makes in the Attributes Inspector */
- (void) ok: (id)sender
{
/* options */
if ( sender == multipleSelectionSwitch )
{
[object setAllowsMultipleSelection: [multipleSelectionSwitch state]];
}
else if ( sender == emptySelectionSwitch )
{
[object setAllowsEmptySelection: [emptySelectionSwitch state]];
}
else if ( sender == branchSelectionSwitch )
{
[object setAllowsBranchSelection: [branchSelectionSwitch state]];
}
else if ( sender == separateColumnsSwitch )
{
[object setSeparatesColumns: [separateColumnsSwitch state]];
}
else if ( sender == horizontalScrollerSwitch )
{
[object setHasHorizontalScroller: [horizontalScrollerSwitch state]];
}
else if ( sender == displayTitlesSwitch )
{
[object setTitled: [displayTitlesSwitch state]];
}
/* minimum column width */
else if ( sender == minColumnWidthField )
{
#warning TODO use stepper
[object setMinColumnWidth:[minColumnWidthField intValue]];
}
/* tag */
else if(sender == tagForm)
{
[object setTag:[[tagForm cellAtIndex:0] intValue]];
}
[super ok:sender];
}
/* Sync from object ( NSBrowser ) changes to the inspector */
- (void) revert: (id) sender
{
if (object == nil)
return;
[multipleSelectionSwitch setState: [object allowsMultipleSelection]];
[emptySelectionSwitch setState: [object allowsEmptySelection]];
[branchSelectionSwitch setState:[object allowsBranchSelection]];
[separateColumnsSwitch setState:[object separatesColumns]];
[displayTitlesSwitch setState:[object isTitled]];
[horizontalScrollerSwitch setState:[object hasHorizontalScroller]];
#warning chek where is the bug ? !!!
[[tagForm cellAtIndex:0] setIntValue:[object tag]];
[minColumnWidthField setStringValue:[NSString stringWithFormat:@"%i",[object minColumnWidth]]];
[super revert:sender];
}
/* delegate method for tagForm and minColumnWidthField */
-(void) controlTextDidChange:(NSNotification *)aNotification
{
[self ok:[aNotification object]];
}
@end

View file

@ -1,12 +1,17 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
GormBrowserInspector = {
GormBrowserAttributesInspector = {
Actions = (
);
Outlets = (
optionMatrix,
maxNumField,
minColumnWidth
minColumnWidthField,
tagForm,
branchSelectionSwitch,
displayTitlesSwitch,
emptySelectionSwitch,
multipleSelectionSwitch,
horizontalScrollerSwitch,
separateColumnsSwitch
);
Super = IBInspector;
};

View file

@ -2,7 +2,7 @@
Copyright (C) 2002 Free Software Foundation, Inc.
Author: Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: 2002
This file is part of GNUstep.

View file

@ -2,7 +2,7 @@
Copyright (C) 2002 Free Software Foundation, Inc.
Author: Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: 2002
This file is part of GNUstep.

View file

@ -8,9 +8,15 @@
horizontalScrollerSwitch,
optionMatrix,
rowsHeightForm,
selectionMatrix,
verticalScrollerSwitch,
backgroundColor
backgroundColor,
tagForm,
multipleSelectionSwitch,
emptySelectionSwith,
columnSelectionSwitch,
drawgridSwitch,
resizingSwitch,
reorderingSwitch
);
Super = IBInspector;
};

View file

@ -0,0 +1,57 @@
/*
GormTabViewAttributesInspector.h
Copyright (C) 2001 Free Software Foundation, Inc.
Author: Laurent Julliard <laurent@julliard-online.org>
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: Aug 2001. 2003, 2004
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormTabViewAttributesInspector_h
#define INCLUDED_GormTabViewAttributesInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSButton;
@class NSForm;
@class NSMatrix;
@class NSStepper;
@class NSTextField;
@interface GormTabViewAttributesInspector : IBInspector
{
NSMatrix *typeMatrix;
int numberOfDisplayItem;
NSButton *allowtruncate;
NSTextField *numberOfItemsField;
NSStepper *itemStepper;
NSTextField *itemLabel;
NSForm *itemIdentifier;
}
@end
#endif /* INCLUDED_GormTabViewAttributesInspector_h */

View file

@ -0,0 +1,162 @@
/*
GormTabViewAttributesInspector.m
Copyright (C) 2001 Free Software Foundation, Inc.
Author: Laurent Julliard <laurent@julliard-online.org>
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: Aug 2001. 2003, 2004
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Split inspector classes into separate files.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormTabViewAttributesInspector.h"
#include <Foundation/NSNotification.h>
#include <AppKit/NSButton.h>
#include <AppKit/NSForm.h>
#include <AppKit/NSMatrix.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSStepper.h>
#include <AppKit/NSTabView.h>
#include <AppKit/NSTabViewItem.h>
#include <AppKit/NSTextField.h>
static NSString *ITEM=@"item";
@implementation GormTabViewAttributesInspector
- (id) init
{
if ([super init] == nil)
{
return nil;
}
if ([NSBundle loadNibNamed: @"GormTabViewInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormTabViewInspector");
return nil;
}
return self;
}
- (void) ok: (id)sender
{
if (sender == typeMatrix)
[object setTabViewType:[[sender selectedCell] tag]];
else if (sender == allowtruncate)
{
BOOL flag;
flag = ([allowtruncate state] == NSOnState) ? YES : NO;
[object setAllowsTruncatedLabels:flag];
}
else if (sender == itemStepper )
{
int number = [itemStepper intValue];
[itemLabel setStringValue:[[object tabViewItemAtIndex:number] label]];
[itemIdentifier setStringValue:[[object tabViewItemAtIndex:number] identifier]];
[object selectTabViewItemAtIndex:number];
}
else if (sender == numberOfItemsField)
{
int newNumber = [[numberOfItemsField stringValue] intValue];
//Can we allow stupid numbers like 66666666 ????????
if (newNumber <= 0)
{
[numberOfItemsField setStringValue:[NSString stringWithFormat:@"%i",[object numberOfTabViewItems]]];
return;
}
if ( newNumber > [object numberOfTabViewItems] )
{
int i;
NSTabViewItem *newTabItem;
for (i=([object numberOfTabViewItems]+1);i<=newNumber;i++)
{
NSString *identif = [NSString stringWithFormat:@"%i",i];
newTabItem = [(NSTabViewItem *)[NSTabViewItem alloc] initWithIdentifier: (id)identif];
[newTabItem setLabel:[ITEM stringByAppendingString:identif]];
[newTabItem setView:[[NSView alloc] init]];
[object addTabViewItem:newTabItem];
}
}
else
{
int i;
for (i=([object numberOfTabViewItems]-1);i>=newNumber;i--)
{
[object removeTabViewItem:[object tabViewItemAtIndex:i]];
}
}
[itemStepper setMaxValue:(newNumber - 1)];
}
else if ( sender == itemLabel )
{
if ( ! [[itemLabel stringValue] isEqualToString:@""] )
[[object selectedTabViewItem] setLabel:[itemLabel stringValue]];
}
else if ( sender == itemIdentifier )
{
if ( ! [[itemIdentifier stringValue] isEqualToString:@""] )
[[object selectedTabViewItem] setIdentifier:[itemIdentifier stringValue]];
}
#warning needed ?
[object display];
[super ok: sender];
}
- (void) revert :(id) sender
{
unsigned int numberOfTabViewItems;
if ( object == nil )
return;
numberOfTabViewItems=[object numberOfTabViewItems];
[numberOfItemsField setStringValue:[NSString stringWithFormat:@"%i",numberOfTabViewItems]];
[itemStepper setMaxValue:(numberOfTabViewItems -1)];
[itemLabel setStringValue:[[object selectedTabViewItem] label]];
[itemIdentifier setStringValue:[[object selectedTabViewItem] identifier]];
}
-(void) controlTextDidChange:(NSNotification *)aNotification
{
[self ok:[aNotification object]];
}
@end

View file

@ -0,0 +1,59 @@
/*
GormTableColumnAttributesInspector.h
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormTableColumnAttributesInspector_h
#define INCLUDED_GormTableColumnAttributesInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSButton;
@class NSMatrix;
@class NSTextField;
@class NSTableView;
@interface GormTableColumnAttributesInspector : IBInspector
{
NSMatrix *titleAlignmentMatrix;
NSMatrix *contentsAlignmentMatrix;
NSTextField *identifierTextField;
NSButton *resizableSwitch;
NSButton *editableSwitch;
NSButton *setButton;
NSButton *defaultButton;
NSTableView *cellTable;
}
@end
#endif /* INCLUDED_GormTableColumnAttributesInspector_h */

View file

@ -0,0 +1,323 @@
/*
GormTableColumnAttributesInspector.m
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
Author: Gregory Casamento <greg_casamento@yahoo.com>
Added custom class handling for table column.
Date: 2004
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Split inspector classes into separate files.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormTableColumnAttributesInspector.h"
#include <GormCore/GormPrivate.h>
#include <AppKit/NSButton.h>
#include <AppKit/NSMatrix.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSTextField.h>
#include <AppKit/NSTableView.h>
#include <AppKit/NSTableColumn.h>
/*
IBObjectAdditions category
*/
@implementation GormTableColumnAttributesInspector
- (id) init
{
if ([super init] == nil)
{
return nil;
}
if ([NSBundle loadNibNamed: @"GormNSTableColumnInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormTableColumnInspector");
return nil;
}
return self;
}
- (void) awakeFromNib
{
[cellTable setDoubleAction: @selector(ok:)];
}
#warning set private ?
- (NSString *)_getCellClassName
{
id cell = [[self object] dataCell];
NSString *customClassName = [[(id<Gorm>)NSApp classManager] customClassForObject: cell];
NSString *result = nil;
if(customClassName == nil)
{
result = NSStringFromClass([cell class]);
}
else
{
result = customClassName;
}
return result;
}
/* Commit changes that the user makes in the Attributes Inspector */
- (void) ok: (id) sender
{
/* title Alignment */
if (sender == titleAlignmentMatrix)
{
if ([[sender cellAtRow: 0 column: 0] state] == NSOnState)
{
[[object headerCell] setAlignment: NSLeftTextAlignment];
}
else if ([[sender cellAtRow: 0 column: 1] state] == NSOnState)
{
[[object headerCell] setAlignment: NSCenterTextAlignment];
}
else if ([[sender cellAtRow: 0 column: 2] state] == NSOnState)
{
[[object headerCell] setAlignment: NSRightTextAlignment];
}
#warning TODO use tags
// [[object headerCell] setAlignment: [[titleAlignmentMatrix selectedRow] tag]];
if ([[object tableView] headerView] != nil)
{
[[[object tableView] headerView] setNeedsDisplay: YES];
}
}
/* contents Alignment */
else if (sender == contentsAlignmentMatrix)
{
#warning TODO use tags
if ([[sender cellAtRow: 0 column: 0] state] == NSOnState)
{
[[object dataCell] setAlignment: NSLeftTextAlignment];
}
else if ([[sender cellAtRow: 0 column: 1] state] == NSOnState)
{
[[object dataCell] setAlignment: NSCenterTextAlignment];
}
else if ([[sender cellAtRow: 0 column: 2] state] == NSOnState)
{
[[object dataCell] setAlignment: NSRightTextAlignment];
}
[[object tableView] setNeedsDisplay: YES];
}
/* Identifier */
else if (sender == identifierTextField)
{
[object setIdentifier:
[identifierTextField stringValue]];
}
/* Options */
else if (sender == editableSwitch)
{
[object setEditable:
([editableSwitch state] == NSOnState)];
}
else if (sender == resizableSwitch)
{
[object setResizable:
([resizableSwitch state] == NSOnState)];
}
/* set Button */
else if (sender == setButton || sender == cellTable)
{
id classManager = [(id<Gorm>)NSApp classManager];
id<IBDocuments> doc = [(id<IB>)NSApp activeDocument];
id cell = nil;
int i = [cellTable selectedRow];
NSArray *list = [classManager allSubclassesOf: @"NSCell"];
NSString *className = [list objectAtIndex: i];
BOOL isCustom = [classManager isCustomClass: className];
Class cls = nil;
if(isCustom)
{
NSString *superClass = [classManager nonCustomSuperClassOf: className];
cls = NSClassFromString(superClass);
NSLog(@"Setting custom cell..");
}
else
{
cls = NSClassFromString(className);
}
// initialize
cell = [[cls alloc] init];
[object setDataCell: cell];
[[object tableView] setNeedsDisplay: YES];
// add it to the document, since it needs a custom class...
if(isCustom)
{
NSString *name = nil;
// An object needs to be a "named object" to have a custom class
// assigned to it. Add it to the document and get the name.
[doc attachObject: cell toParent: object];
if((name = [doc nameForObject: cell]) != nil)
{
[classManager setCustomClass: className forName: name];
}
}
RELEASE(cell);
}
/* default button */
else if (sender == defaultButton)
{
[object setDataCell: [[NSTextFieldCell alloc] init]];
[[object tableView] setNeedsDisplay: YES];
[self setObject: [self object]]; // reset...
}
[super ok:sender];
}
/* Sync from object ( NSTableColumn ) changes to the inspector */
- (void) revert:(id) sender
{
NSArray *list;
NSString *cellClassName;
int index;
if ( object == nil )
return;
list = [[(id<Gorm>)NSApp classManager] allSubclassesOf: @"NSCell"];
cellClassName = [self _getCellClassName];
index = [list indexOfObject: cellClassName];
if(index != NSNotFound && index != -1)
{
[cellTable selectRow: index byExtendingSelection: NO];
[cellTable scrollRowToVisible: index];
}
/* title Alignment */
#warning TODO use tags
switch ([[object headerCell] alignment])
{
case NSLeftTextAlignment:
[titleAlignmentMatrix selectCellAtRow: 0 column: 0];
break;
case NSCenterTextAlignment:
[titleAlignmentMatrix selectCellAtRow: 0 column: 1];
break;
case NSRightTextAlignment:
[titleAlignmentMatrix selectCellAtRow: 0 column: 2];
break;
default:
NSLog(@"Unhandled alignment value...");
break;
}
/* contents Alignment */
#warning TODO use tags
switch ([[object dataCell] alignment])
{
case NSLeftTextAlignment:
[contentsAlignmentMatrix selectCellAtRow: 0 column: 0];
break;
case NSCenterTextAlignment:
[contentsAlignmentMatrix selectCellAtRow: 0 column: 1];
break;
case NSRightTextAlignment:
[contentsAlignmentMatrix selectCellAtRow: 0 column: 2];
break;
default:
NSLog(@"Unhandled alignment value...");
break;
}
[identifierTextField setStringValue: [(NSTableColumn *)object identifier]];
/* options */
if ([object isResizable])
[resizableSwitch setState: NSOnState];
else
[resizableSwitch setState: NSOffState];
if ([object isEditable])
[editableSwitch setState: NSOnState];
else
[editableSwitch setState: NSOffState];
[super revert:sender];
}
// Data Source
#warning replace by an NSBrowser ?
- (int) numberOfRowsInTableView: (NSTableView *)tv
{
NSArray *list = [[(id<Gorm>)NSApp classManager] allSubclassesOf: @"NSCell"];
return [list count];
}
- (id) tableView: (NSTableView *)tv
objectValueForTableColumn: (NSTableColumn *)tc
row: (int)rowIndex
{
NSArray *list = [[(id<Gorm>)NSApp classManager] allSubclassesOf: @"NSCell"];
id value = nil;
if([list count] > 0)
{
value = [list objectAtIndex: rowIndex];
}
return value;
}
// delegate
- (BOOL) tableView: (NSTableView *)tableView
shouldEditTableColumn: (NSTableColumn *)aTableColumn
row: (int)rowIndex
{
return NO;
}
- (BOOL) tableView: (NSTableView *)tv
shouldSelectRow: (int)rowIndex
{
return YES;
}
/* delegate method for identifier */
-(void) controlTextDidChange:(NSNotification *)aNotification
{
[self ok:[aNotification object]];
}
@end

View file

@ -0,0 +1,50 @@
/*
GormTableColumnSizeInspector.h
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormTableColumnnSizeInspector_h
#define INCLUDED_GormTableColumnnSizeInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSForm;
@interface GormTableColumnSizeInspector : IBInspector
{
NSForm *widthForm;
}
@end
#endif /* INCLUDED_GormTableColumnnSizeInspector_h */

View file

@ -0,0 +1,100 @@
/*
GormTableColumnSizeInspector.m
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Split inspector classes into separate files.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormTableColumnSizeInspector.h"
#include <Foundation/NSNotification.h>
#include <AppKit/NSForm.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSTableColumn.h>
#define MINIMUMINDEX 0
#define CURRENTINDEX 1
#define MAXIMUMINDEX 2
@implementation GormTableColumnSizeInspector
- (id) init
{
if ([super init] == nil)
{
return nil;
}
if ([NSBundle loadNibNamed: @"GormNSTableColumnSizeInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormTableColumnSizeInspector");
return nil;
}
return self;
}
/* Commit changes that the user makes in the Attributes Inspector */
- (void) ok: (id)sender
{
[object setMinWidth:
[[widthForm cellAtRow:MINIMUMINDEX column: 0] floatValue]];
[object setWidth:
[[widthForm cellAtRow:CURRENTINDEX column: 0] floatValue]];
[object setMaxWidth:
[[widthForm cellAtRow:MAXIMUMINDEX column: 0] floatValue]];
[super ok:sender];
}
/* Sync from object ( NSTableColumn size ) changes to the inspector */
- (void) revert: (id) sender
{
if (object == nil)
return;
[[widthForm cellAtRow:MINIMUMINDEX column: 0] setFloatValue:
[object minWidth]];
[[widthForm cellAtRow:CURRENTINDEX column: 0] setFloatValue:
[object width]];
[[widthForm cellAtRow:MAXIMUMINDEX column: 0] setFloatValue:
[object maxWidth]];
[super revert:sender];
}
/* delegate method for the form */
-(void) controlTextDidChange:(NSNotification *)aNotification
{
[self ok:[aNotification object]];
}
@end

View file

@ -0,0 +1,66 @@
/*
GormTableViewAttributesInspector.h
Copyright (C) 2001 Free Software Foundation, Inc.
Author: Laurent Julliard <laurent@julliard-online.org>
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: Aug 2001. 2003, 2004
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormTableViewAttributesInspector_h
#define INCLUDED_GormTableViewAttributesInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSButton;
@class NSColorWell;
@class NSForm;
@class NSMatrix;
@interface GormTableViewAttributesInspector: IBInspector
{
/* selection */
NSButton *multipleSelectionSwitch;
NSButton *emptySelectionSwith;
NSButton *columnSelectionSwitch;
/* scrollers */
NSButton *verticalScrollerSwitch;
NSButton *horizontalScrollerSwitch;
NSMatrix *borderMatrix;
NSForm *rowsHeightForm;
/* options */
NSButton *drawgridSwitch;
NSButton *resizingSwitch;
NSButton *reorderingSwitch;
NSForm *tagForm;
NSColorWell *backgroundColor;
}
@end
#endif /* INCLUDED_GormTableViewAttributesInspector_h */

View file

@ -0,0 +1,245 @@
/*
GormTableViewAttributesInspector.m
Copyright (C) 2001 Free Software Foundation, Inc.
Author: Laurent Julliard <laurent@julliard-online.org>
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: Aug 2001. 2003, 2004
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Split inspector classes into separate files.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormTableViewAttributesInspector.h"
#include "GormNSTableView.h"
#include <GormCore/NSColorWell+GormExtensions.h>
#include <GormCore/GormPrivate.h>
#include <Foundation/NSNotification.h>
#include <AppKit/NSButton.h>
#include <AppKit/NSColorWell.h>
#include <AppKit/NSForm.h>
#include <AppKit/NSMatrix.h>
#include <AppKit/NSNibLoading.h>
@implementation GormTableViewAttributesInspector
- (id) init
{
if ([super init] == nil)
{
return nil;
}
if ([NSBundle loadNibNamed: @"GormNSTableViewInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormTableViewInspector");
return nil;
}
return self;
}
/* Commit changes that the user makes in the Attributes Inspector */
- (void) ok: (id)sender
{
BOOL flag;
BOOL isScrollView;
id scrollView;
scrollView = [[object superview] superview];
isScrollView = [ scrollView isKindOfClass: [NSScrollView class]];
/* Selection */
if ( sender == multipleSelectionSwitch )
{
[object setGormAllowsMultipleSelection:[multipleSelectionSwitch state]];
}
else if ( sender == emptySelectionSwith )
{
[object setGormAllowsEmptySelection: [emptySelectionSwith state]];
}
else if ( sender == columnSelectionSwitch )
{
[object setGormAllowsColumnSelection: [columnSelectionSwitch state]];
}
/* scrollers */
else if ( (sender == verticalScrollerSwitch) && isScrollView)
{
flag = ([sender state] == NSOnState) ? YES : NO;
[scrollView setHasVerticalScroller: flag];
}
else if ( (sender == horizontalScrollerSwitch) && isScrollView)
{
flag = ([sender state] == NSOnState) ? YES : NO;
[scrollView setHasHorizontalScroller: flag];
}
/* border */
else if ( (sender == borderMatrix) && isScrollView)
{
[scrollView setBorderType: [[sender selectedCell] tag]];
}
/* dimension */
else if (sender == rowsHeightForm)
{
int numCols = [object numberOfColumns];
int newNumCols = [[sender cellAtIndex: 1] intValue];
// add/delete columns based on number in #columns field...
[object setRowHeight: [[sender cellAtIndex: 0] intValue] ];
if(newNumCols > 0)
{
if(numCols < newNumCols)
{
int colsToAdd = newNumCols - numCols;
int i = 0;
// Add columns from the last to the target number...
for(i = 0; i < colsToAdd; i++)
{
NSString *identifier = [NSString stringWithFormat: @"column%d",(numCols + i + 1)];
NSTableColumn *tc = AUTORELEASE([(NSTableColumn *)[NSTableColumn alloc] initWithIdentifier: (id)identifier]);
[tc setWidth: 50];
[tc setMinWidth: 20];
[tc setResizable: YES];
[tc setEditable: YES];
[object addTableColumn: tc];
}
}
else if(numCols > newNumCols)
{
int colsToDelete = numCols - newNumCols;
int i = 0;
NSArray *columns = [object tableColumns];
// remove columns...
for(i = 0; i < colsToDelete; i++)
{
NSTableColumn *tc = [columns objectAtIndex: (i + newNumCols)];
[object removeTableColumn: tc];
}
}
}
// recompute column sizes..
[object sizeToFit];
[object tile];
}
/* Options */
else if ( sender == drawgridSwitch )
{
[object setDrawsGrid:[drawgridSwitch state]];
}
else if ( sender == resizingSwitch )
{
[object setGormAllowsColumnResizing: [resizingSwitch state]];
}
else if ( sender == reorderingSwitch )
{
[object setGormAllowsColumnReordering:[reorderingSwitch state]];
}
/* tag */
else if( sender == tagForm )
{
[object setTag:[[tagForm cellAtIndex:0] intValue]];
}
/* background color */
else if( sender == backgroundColor )
{
[object setBackgroundColor: [backgroundColor color]];
}
#warning always needed ?
[scrollView setNeedsDisplay: YES];
[super ok:sender];
}
/* Sync from object ( NSTableView and its scollView ) changes to the inspector */
- (void) revert: (id) sender
{
BOOL isScrollView;
id scrollView;
if ( object == nil )
return;
scrollView = [object enclosingScrollView];
isScrollView = [ scrollView isKindOfClass: [NSScrollView class]];
/* selection */
[multipleSelectionSwitch setState: [object gormAllowsMultipleSelection]];
[emptySelectionSwith setState:[object gormAllowsEmptySelection]];
[columnSelectionSwitch setState:[object gormAllowsColumnSelection]];
if (isScrollView)
{
/* scrollers */
[verticalScrollerSwitch setEnabled: YES];
[verticalScrollerSwitch setState:
([scrollView hasVerticalScroller]) ? NSOnState : NSOffState];
[horizontalScrollerSwitch setEnabled: YES];
[horizontalScrollerSwitch setState:
([scrollView hasHorizontalScroller]) ? NSOnState : NSOffState];
/* border */
[borderMatrix setEnabled: YES];
[borderMatrix selectCellWithTag: [scrollView borderType]];
}
else
{
[verticalScrollerSwitch setEnabled: NO];
[horizontalScrollerSwitch setEnabled: NO];
[borderMatrix setEnabled: NO];
}
/* dimension */
[[rowsHeightForm cellAtIndex: 0] setIntValue: [object rowHeight] ];
[[rowsHeightForm cellAtIndex: 1] setIntValue: [object numberOfColumns]];
/* options */
[drawgridSwitch setState:[object drawsGrid]];
[resizingSwitch setState:[object gormAllowsColumnResizing]];
[reorderingSwitch setState:[object gormAllowsColumnReordering]];
/* tag */
[[tagForm cellAtIndex:0] setIntValue:[object tag]];
/* background color */
[backgroundColor setColorWithoutAction: [object backgroundColor]];
[super revert:sender];
}
/* delegate for tag and Forms */
-(void) controlTextDidChange:(NSNotification *)aNotification
{
[self ok:[aNotification object]];
}
@end

View file

@ -0,0 +1,33 @@
/* GormTableViewSizeInspector -- size inspector for table and table subclasses.
Copyright (C) 2001 Free Software Foundation, Inc.
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: 2005
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
#ifndef INCLUDED_GormTableViewSizeInspector_h
#define INCLUDED_GormTableViewSizeInspector_h
#include <GormCore/GormViewSizeInspector.h>
@interface GormTableViewSizeInspector : GormViewSizeInspector
@end
#endif

View file

@ -0,0 +1,36 @@
/* GormTableViewSizeInspector -- size inspector for table and table subclasses.
Copyright (C) 2001 Free Software Foundation, Inc.
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: 2005
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
#include <AppKit/NSTableView.h>
#include "GormTableViewSizeInspector.h"
@implementation GormTableViewSizeInspector
- (void) setObject: (id)anObject
{
id scrollView;
scrollView = [anObject enclosingScrollView];
[super setObject: scrollView];
}
@end

View file

@ -24,744 +24,28 @@
*/
#include <Foundation/Foundation.h>
#include <AppKit/NSTableColumn.h>
#include <AppKit/NSBrowser.h>
#include <InterfaceBuilder/IBInspector.h>
#include <GormCore/GormPrivate.h>
#include <GormCore/NSColorWell+GormExtensions.h>
#include "GormNSTableView.h"
#include <AppKit/AppKit.h>
#include <InterfaceBuilder/InterfaceBuilder.h>
/* This macro makes sure that the string contains a value, even if @"" */
#define VSTR(str) ({id _str = str; (_str) ? _str : @"";})
/*----------------------------------------------------------------------------
* NSBrowser
/**
* IBObjectAdditions categories.
*/
@implementation NSBrowser (IBObjectAdditions)
@implementation NSBrowser (IBObjectAdditions)
- (NSString*) inspectorClassName
{
return @"GormBrowserAttributesInspector";
}
@end
@interface GormBrowserAttributesInspector : IBInspector
{
id optionMatrix;
id tagField;
id minColumnWidth;
}
- (void) _getValuesFromObject: (id)anObject;
@end
@implementation GormBrowserAttributesInspector
-(void) controlTextDidChange:(NSNotification *)aNotification
{
[self ok:[aNotification object]];
}
- (void) _setValuesFromControl: (id)control
{
if (control == optionMatrix)
{
BOOL flag;
flag = ([[control cellAtRow: 0 column: 0] state] == NSOnState) ? YES : NO;
[object setAllowsMultipleSelection: flag];
flag = ([[control cellAtRow: 1 column: 0] state] == NSOnState) ? YES : NO;
[object setAllowsEmptySelection: flag];
flag = ([[control cellAtRow: 2 column: 0] state] == NSOnState) ? YES : NO;
[object setAllowsBranchSelection: flag];
flag = ([[control cellAtRow: 3 column: 0] state] == NSOnState) ? YES : NO;
[object setSeparatesColumns: flag];
flag = ([[control cellAtRow: 4 column: 0] state] == NSOnState) ? YES : NO;
[object setTitled: flag];
flag = ([[control cellAtRow: 5 column: 0] state] == NSOnState) ? YES : NO;
[object setHasHorizontalScroller: flag];
}
else if(control == tagField)
{
[object setTag:[[tagField cellAtIndex:0] intValue]];
}
else if ( control == minColumnWidth )
{
[object setMinColumnWidth:[minColumnWidth intValue]];
}
}
- (void) _getValuesFromObject: anObject
{
if (anObject != object)
{
return;
}
[optionMatrix deselectAllCells];
if ([anObject allowsMultipleSelection])
[optionMatrix selectCellAtRow: 0 column: 0];
if ([anObject allowsEmptySelection])
[optionMatrix selectCellAtRow: 1 column: 0];
if ([anObject allowsBranchSelection])
[optionMatrix selectCellAtRow: 2 column: 0];
if ([anObject separatesColumns])
[optionMatrix selectCellAtRow: 3 column: 0];
if ([anObject isTitled])
[optionMatrix selectCellAtRow: 4 column: 0];
if ([anObject hasHorizontalScroller])
[optionMatrix selectCellAtRow: 5 column: 0];
[[tagField cellAtIndex:0] setIntValue:[anObject tag]];
[minColumnWidth setStringValue:[NSString stringWithFormat:@"%i",[anObject minColumnWidth]]];
}
- (id) init
{
if ([super init] == nil)
{
return nil;
}
if ([NSBundle loadNibNamed: @"GormNSBrowserInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormBrowserInspector");
return nil;
}
return self;
}
- (void) ok: (id)sender
{
[super ok: sender];
[self _setValuesFromControl: sender];
}
- (void) setObject: (id)anObject
{
[super setObject: anObject];
[self _getValuesFromObject: anObject];
}
@end
@interface GormViewSizeInspector : IBInspector
{
NSButton *top;
NSButton *bottom;
NSButton *left;
NSButton *right;
NSButton *width;
NSButton *height;
NSForm *sizeForm;
}
@end
@interface GormTableViewSizeInspector : GormViewSizeInspector
@end
@implementation GormTableViewSizeInspector
- (void) setObject: (id)anObject
{
id scrollView;
scrollView = [anObject enclosingScrollView];
[super setObject: scrollView];
}
@end
/*----------------------------------------------------------------------------
* NSTableColumn
*/
@implementation NSTableColumn (IBObjectAdditions)
- (NSString *) inspectorClassName
{
return @"GormTableColumnAttributesInspector";
}
- (NSString*) sizeInspectorClassName
{
return @"GormTableColumnSizeInspector";
}
@end
@interface GormTableColumnAttributesInspector : IBInspector
{
id titleAlignmentMatrix;
id contentsAlignmentMatrix;
id identifierTextField;
id resizableSwitch;
id editableSwitch;
id setButton;
id defaultButton;
id cellTable;
}
- (void) _getValuesFromObject: (id)anObject;
- (void) _setValuesFromControl: (id)anObject;
@end
@implementation GormTableColumnAttributesInspector
-(void) controlTextDidChange:(NSNotification *)aNotification
{
[self ok:[aNotification object]];
}
- (id) init
{
if ([super init] == nil)
{
return nil;
}
if ([NSBundle loadNibNamed: @"GormNSTableColumnInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormTableColumnInspector");
return nil;
}
return self;
}
- (void) awakeFromNib
{
[cellTable setDoubleAction: @selector(ok:)];
}
- (void) ok: (id)sender
{
[super ok: sender];
[self _setValuesFromControl: sender];
}
- (void) setObject: (id)anObject
{
[super setObject: anObject];
[self _getValuesFromObject: anObject];
}
- (NSString *)_getCellClassName
{
id cell = [[self object] dataCell];
NSString *customClassName = [[(id<Gorm>)NSApp classManager] customClassForObject: cell];
NSString *result = nil;
if(customClassName == nil)
{
result = NSStringFromClass([cell class]);
}
else
{
result = customClassName;
}
return result;
}
- (void) _getValuesFromObject: anObject
{
NSArray *list = [[(id<Gorm>)NSApp classManager] allSubclassesOf: @"NSCell"];
NSString *cellClassName = [self _getCellClassName];
int index = [list indexOfObject: cellClassName];
if(index != NSNotFound && index != -1)
{
[cellTable selectRow: index byExtendingSelection: NO];
[cellTable scrollRowToVisible: index];
}
switch ([[anObject headerCell] alignment])
{
case NSLeftTextAlignment:
[titleAlignmentMatrix selectCellAtRow: 0 column: 0];
break;
case NSCenterTextAlignment:
[titleAlignmentMatrix selectCellAtRow: 0 column: 1];
break;
case NSRightTextAlignment:
[titleAlignmentMatrix selectCellAtRow: 0 column: 2];
break;
default:
NSLog(@"Unhandled alignment value...");
break;
}
switch ([[anObject dataCell] alignment])
{
case NSLeftTextAlignment:
[contentsAlignmentMatrix selectCellAtRow: 0 column: 0];
break;
case NSCenterTextAlignment:
[contentsAlignmentMatrix selectCellAtRow: 0 column: 1];
break;
case NSRightTextAlignment:
[contentsAlignmentMatrix selectCellAtRow: 0 column: 2];
break;
default:
NSLog(@"Unhandled alignment value...");
break;
}
[identifierTextField setStringValue: [(NSTableColumn *)anObject identifier]];
if ([anObject isResizable])
[resizableSwitch setState: NSOnState];
else
[resizableSwitch setState: NSOffState];
if ([anObject isEditable])
[editableSwitch setState: NSOnState];
else
[editableSwitch setState: NSOffState];
}
- (void) _setValuesFromControl: (id) control
{
if (control == titleAlignmentMatrix)
{
if ([[control cellAtRow: 0 column: 0] state] == NSOnState)
{
[[object headerCell] setAlignment: NSLeftTextAlignment];
}
else if ([[control cellAtRow: 0 column: 1] state] == NSOnState)
{
[[object headerCell] setAlignment: NSCenterTextAlignment];
}
else if ([[control cellAtRow: 0 column: 2] state] == NSOnState)
{
[[object headerCell] setAlignment: NSRightTextAlignment];
}
if ([[object tableView] headerView] != nil)
{
[[[object tableView] headerView] setNeedsDisplay: YES];
}
}
else if (control == contentsAlignmentMatrix)
{
if ([[control cellAtRow: 0 column: 0] state] == NSOnState)
{
[[object dataCell] setAlignment: NSLeftTextAlignment];
}
else if ([[control cellAtRow: 0 column: 1] state] == NSOnState)
{
[[object dataCell] setAlignment: NSCenterTextAlignment];
}
else if ([[control cellAtRow: 0 column: 2] state] == NSOnState)
{
[[object dataCell] setAlignment: NSRightTextAlignment];
}
[[object tableView] setNeedsDisplay: YES];
}
else if (control == identifierTextField)
{
[object setIdentifier:
[identifierTextField stringValue]];
}
else if (control == editableSwitch)
{
[object setEditable:
([editableSwitch state] == NSOnState)];
}
else if (control == resizableSwitch)
{
[object setResizable:
([resizableSwitch state] == NSOnState)];
}
else if (control == setButton || control == cellTable)
{
id classManager = [(id<Gorm>)NSApp classManager];
id<IBDocuments> doc = [(id<IB>)NSApp activeDocument];
id cell = nil;
int i = [cellTable selectedRow];
NSArray *list = [classManager allSubclassesOf: @"NSCell"];
NSString *className = [list objectAtIndex: i];
BOOL isCustom = [classManager isCustomClass: className];
Class cls = nil;
if(isCustom)
{
NSString *superClass = [classManager nonCustomSuperClassOf: className];
cls = NSClassFromString(superClass);
NSLog(@"Setting custom cell..");
}
else
{
cls = NSClassFromString(className);
}
// initialize
cell = [[cls alloc] init];
[object setDataCell: cell];
[[object tableView] setNeedsDisplay: YES];
// add it to the document, since it needs a custom class...
if(isCustom)
{
NSString *name = nil;
// An object needs to be a "named object" to have a custom class
// assigned to it. Add it to the document and get the name.
[doc attachObject: cell toParent: object];
if((name = [doc nameForObject: cell]) != nil)
{
[classManager setCustomClass: className forName: name];
}
}
RELEASE(cell);
}
else if (control == defaultButton)
{
[object setDataCell: [[NSTextFieldCell alloc] init]];
[[object tableView] setNeedsDisplay: YES];
[self setObject: [self object]]; // reset...
}
}
// data source
- (int) numberOfRowsInTableView: (NSTableView *)tv
{
NSArray *list = [[(id<Gorm>)NSApp classManager] allSubclassesOf: @"NSCell"];
return [list count];
}
- (id) tableView: (NSTableView *)tv
objectValueForTableColumn: (NSTableColumn *)tc
row: (int)rowIndex
{
NSArray *list = [[(id<Gorm>)NSApp classManager] allSubclassesOf: @"NSCell"];
id value = nil;
if([list count] > 0)
{
value = [list objectAtIndex: rowIndex];
}
return value;
}
// delegate
- (BOOL) tableView: (NSTableView *)tableView
shouldEditTableColumn: (NSTableColumn *)aTableColumn
row: (int)rowIndex
{
return NO;
}
- (BOOL) tableView: (NSTableView *)tv
shouldSelectRow: (int)rowIndex
{
return YES;
}
@end
@interface GormTableColumnSizeInspector : IBInspector
{
id widthForm;
}
- (void) _getValuesFromObject: (id)anObject;
- (void) _setValuesFromControl: (id)anObject;
@end
@implementation GormTableColumnSizeInspector
- (id) init
{
if ([super init] == nil)
{
return nil;
}
if ([NSBundle loadNibNamed: @"GormNSTableColumnSizeInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormTableColumnSizeInspector");
return nil;
}
return self;
}
- (void) ok: (id)sender
{
[super ok: sender];
[self _setValuesFromControl: sender];
}
- (void) setObject: (id)anObject
{
[super setObject: anObject];
[self _getValuesFromObject: anObject];
}
- (void) _getValuesFromObject: anObject
{
[[widthForm cellAtRow: 0 column: 0] setFloatValue:
[anObject minWidth]];
[[widthForm cellAtRow: 1 column: 0] setFloatValue:
[anObject width]];
[[widthForm cellAtRow: 2 column: 0] setFloatValue:
[anObject maxWidth]];
}
- (void) _setValuesFromControl: (id) control
{
[object setMinWidth:
[[widthForm cellAtRow: 0 column: 0] floatValue]];
[object setWidth:
[[widthForm cellAtRow: 1 column: 0] floatValue]];
[object setMaxWidth:
[[widthForm cellAtRow: 2 column: 0] floatValue]];
[self _getValuesFromObject: object];
}
@end
/*----------------------------------------------------------------------------
* NSTableView (possibly embedded in a Scroll view)
*/
@implementation NSTableView (IBObjectAdditions)
- (NSString*) inspectorClassName
{
return @"GormTableViewAttributesInspector";
}
- (NSString*) sizeInspectorClassName
{
return @"GormTableViewSizeInspector";
}
@end
@interface GormTableViewAttributesInspector : IBInspector
{
id selectionMatrix;
id verticalScrollerSwitch;
id horizontalScrollerSwitch;
id borderMatrix;
id rowsHeightForm;
id optionMatrix;
id tagField;
id backgroundColor;
}
- (void) _getValuesFromObject: (id)anObject;
- (void) _setValuesFromControl: (id)anObject;
@end
@implementation GormTableViewAttributesInspector
-(void) controlTextDidChange:(NSNotification *)aNotification
{
[self ok:[aNotification object]];
}
- (void) _setValuesFromControl: (id)control
{
BOOL flag;
BOOL isScrollView;
id scrollView;
scrollView = [[object superview] superview];
isScrollView = [ scrollView isKindOfClass: [NSScrollView class]];
if (control == selectionMatrix)
{
flag = ([[control cellAtRow: 0 column: 0] state] == NSOnState) ? YES : NO;
[object setGormAllowsMultipleSelection: flag];
flag = ([[control cellAtRow: 1 column: 0] state] == NSOnState) ? YES : NO;
[object setGormAllowsEmptySelection: flag];
flag = ([[control cellAtRow: 2 column: 0] state] == NSOnState) ? YES : NO;
[object setGormAllowsColumnSelection: flag];
}
else if ( (control == verticalScrollerSwitch) && isScrollView)
{
flag = ([control state] == NSOnState) ? YES : NO;
[scrollView setHasVerticalScroller: flag];
}
else if ( (control == horizontalScrollerSwitch) && isScrollView)
{
flag = ([control state] == NSOnState) ? YES : NO;
[scrollView setHasHorizontalScroller: flag];
}
else if ( (control == borderMatrix) && isScrollView)
{
[scrollView setBorderType: [[control selectedCell] tag]];
}
else if (control == rowsHeightForm)
{
int numCols = [object numberOfColumns];
int newNumCols = [[control cellAtIndex: 1] intValue];
// add/delete columns based on number in #columns field...
[object setRowHeight: [[control cellAtIndex: 0] intValue] ];
if(newNumCols > 0)
{
if(numCols < newNumCols)
{
int colsToAdd = newNumCols - numCols;
int i = 0;
// Add columns from the last to the target number...
for(i = 0; i < colsToAdd; i++)
{
NSString *identifier = [NSString stringWithFormat: @"column%d",(numCols + i + 1)];
NSTableColumn *tc = AUTORELEASE([(NSTableColumn *)[NSTableColumn alloc] initWithIdentifier: (id)identifier]);
[tc setWidth: 50];
[tc setMinWidth: 20];
[tc setResizable: YES];
[tc setEditable: YES];
[object addTableColumn: tc];
}
}
else if(numCols > newNumCols)
{
int colsToDelete = numCols - newNumCols;
int i = 0;
NSArray *columns = [object tableColumns];
// remove columns...
for(i = 0; i < colsToDelete; i++)
{
NSTableColumn *tc = [columns objectAtIndex: (i + newNumCols)];
[object removeTableColumn: tc];
}
}
}
// recompute column sizes..
[object sizeToFit];
[object tile];
}
else if (control == optionMatrix)
{
flag = ([[control cellAtRow: 0 column: 0] state] == NSOnState) ? YES : NO;
[object setDrawsGrid: flag];
flag = ([[control cellAtRow: 1 column: 0] state] == NSOnState) ? YES : NO;
[object setGormAllowsColumnResizing: flag];
flag = ([[control cellAtRow: 2 column: 0] state] == NSOnState) ? YES : NO;
[object setGormAllowsColumnReordering: flag];
}
else if( control == tagField )
{
[object setTag:[[tagField cellAtIndex:0] intValue]];
}
else if( control == backgroundColor )
{
[object setBackgroundColor: [backgroundColor color]];
}
[scrollView setNeedsDisplay: YES];
}
- (void) _getValuesFromObject: anObject
{
BOOL isScrollView;
id scrollView;
scrollView = [object enclosingScrollView];
isScrollView = [ scrollView isKindOfClass: [NSScrollView class]];
if (anObject != object)
{
return;
}
[selectionMatrix deselectAllCells];
if ([anObject gormAllowsMultipleSelection])
[selectionMatrix selectCellAtRow: 0 column: 0];
if ([anObject gormAllowsEmptySelection])
[selectionMatrix selectCellAtRow: 1 column: 0];
if ([anObject gormAllowsColumnSelection])
[selectionMatrix selectCellAtRow: 2 column: 0];
if (isScrollView)
{
[verticalScrollerSwitch setEnabled: YES];
[verticalScrollerSwitch setState:
([scrollView hasVerticalScroller]) ? NSOnState : NSOffState];
[horizontalScrollerSwitch setEnabled: YES];
[horizontalScrollerSwitch setState:
([scrollView hasHorizontalScroller]) ? NSOnState : NSOffState];
[borderMatrix setEnabled: YES];
[borderMatrix selectCellWithTag: [scrollView borderType]];
}
else
{
[verticalScrollerSwitch setEnabled: NO];
[horizontalScrollerSwitch setEnabled: NO];
[borderMatrix setEnabled: NO];
}
[[rowsHeightForm cellAtIndex: 0] setIntValue: [anObject rowHeight] ];
[[rowsHeightForm cellAtIndex: 1] setIntValue: [anObject numberOfColumns]];
[optionMatrix deselectAllCells];
if ([anObject drawsGrid])
[optionMatrix selectCellAtRow: 0 column: 0];
if ([anObject gormAllowsColumnResizing])
[optionMatrix selectCellAtRow: 1 column: 0];
if ([anObject gormAllowsColumnReordering])
[optionMatrix selectCellAtRow: 2 column: 0];
[[tagField cellAtIndex:0] setIntValue:[anObject tag]];
// set the background color into the inspector...
[backgroundColor setColorWithoutAction: [anObject backgroundColor]];
}
- (id) init
{
if ([super init] == nil)
{
return nil;
}
if ([NSBundle loadNibNamed: @"GormNSTableViewInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormTableViewInspector");
return nil;
}
return self;
}
- (void) ok: (id)sender
{
[super ok: sender];
[self _setValuesFromControl: sender];
}
- (void) setObject: (id)anObject
{
[super setObject: anObject];
[self _getValuesFromObject: anObject];
}
@end
/*----------------------------------------------------------------------------
* NSTabView (possibly embedded in a Scroll view)
*/
static NSString *ITEM=@"item";
@implementation NSTabView (IBObjectAdditions)
- (NSString*) inspectorClassName
{
return @"GormTabViewInspector";
return @"GormTabViewAttributesInspector";
}
- (NSString*) editorClassName
@ -771,137 +55,21 @@ static NSString *ITEM=@"item";
@end
@interface GormTabViewInspector : IBInspector
@implementation NSTableColumn (IBObjectAdditions)
- (NSString *) inspectorClassName
{
id typeMatrix;
int numberOfDisplayItem;
id allowtruncate;
id numberOfItemsField;
id itemStepper;
id itemLabel;
id itemIdentifier;
return @"GormTableColumnAttributesInspector";
}
- (void) _getValuesFromObject: (id)anObject;
- (void) _setValuesFromControl: (id)anObject;
@end
@implementation GormTabViewInspector
-(void) controlTextDidChange:(NSNotification *)aNotification
@implementation NSTableView (IBObjectAdditions)
- (NSString*) inspectorClassName
{
[self ok:[aNotification object]];
return @"GormTableViewAttributesInspector";
}
- (void) _setValuesFromControl: (id)control
- (NSString*) sizeInspectorClassName
{
if (control == typeMatrix)
[object setTabViewType:[[control selectedCell] tag]];
else if (control == allowtruncate)
{
BOOL flag;
flag = ([allowtruncate state] == NSOnState) ? YES : NO;
[object setAllowsTruncatedLabels:flag];
}
else if (control == itemStepper )
{
int number = [itemStepper intValue];
[itemLabel setStringValue:[[object tabViewItemAtIndex:number] label]];
[itemIdentifier setStringValue:[[object tabViewItemAtIndex:number] identifier]];
[object selectTabViewItemAtIndex:number];
}
else if (control == numberOfItemsField)
{
int newNumber = [[numberOfItemsField stringValue] intValue];
//Can we allow stupid numbers like 66666666 ????????
if (newNumber <= 0)
{
[numberOfItemsField setStringValue:[NSString stringWithFormat:@"%i",[object numberOfTabViewItems]]];
return;
}
if ( newNumber > [object numberOfTabViewItems] )
{
int i;
NSTabViewItem *newTabItem;
for (i=([object numberOfTabViewItems]+1);i<=newNumber;i++)
{
NSString *identif = [NSString stringWithFormat:@"%i",i];
newTabItem = [(NSTabViewItem *)[NSTabViewItem alloc] initWithIdentifier: (id)identif];
[newTabItem setLabel:[ITEM stringByAppendingString:identif]];
[newTabItem setView:[[NSView alloc] init]];
[object addTabViewItem:newTabItem];
}
}
else
{
int i;
for (i=([object numberOfTabViewItems]-1);i>=newNumber;i--)
{
[object removeTabViewItem:[object tabViewItemAtIndex:i]];
}
}
[itemStepper setMaxValue:(newNumber - 1)];
}
else if ( control == itemLabel )
{
if ( ! [[itemLabel stringValue] isEqualToString:@""] )
[[object selectedTabViewItem] setLabel:[itemLabel stringValue]];
}
else if ( control == itemIdentifier )
{
if ( ! [[itemIdentifier stringValue] isEqualToString:@""] )
[[object selectedTabViewItem] setIdentifier:[itemIdentifier stringValue]];
}
[object display];
return @"GormTableViewSizeInspector";
}
- (void) _getValuesFromObject: anObject
{
unsigned int numberOfTabViewItems;
numberOfTabViewItems=[anObject numberOfTabViewItems];
[numberOfItemsField setStringValue:[NSString stringWithFormat:@"%i",numberOfTabViewItems]];
[itemStepper setMaxValue:(numberOfTabViewItems -1)];
[itemLabel setStringValue:[[anObject selectedTabViewItem] label]];
[itemIdentifier setStringValue:[[anObject selectedTabViewItem] identifier]];
}
- (id) init
{
if ([super init] == nil)
{
return nil;
}
if ([NSBundle loadNibNamed: @"GormTabViewInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormTabViewInspector");
return nil;
}
return self;
}
- (void) ok: (id)sender
{
[super ok: sender];
[self _setValuesFromControl: sender];
}
- (void) setObject: (id)anObject
{
[super setObject: anObject];
[self _getValuesFromObject: anObject];
}
@end

View file

@ -25,8 +25,15 @@ include $(GNUSTEP_MAKEFILES)/common.make
PALETTE_NAME = 4Data
4Data_PALETTE_ICON = DataPalette
4Data_OBJC_FILES = main.m inspectors.m
4Data_PRINCIPAL_CLASS = DataPalette
4Data_OBJC_FILES = GormNSComboBoxAttributesInspector.m\
GormImageViewAttributesInspector.m\
GormTextViewAttributesInspector.m\
inspectors.m\
main.m
4Data_RESOURCE_FILES = DataPalette.tiff \
GormNSImageViewInspector.gorm \
GormNSTextViewInspector.gorm \
@ -43,5 +50,5 @@ PALETTE_NAME = 4Data
include $(GNUSTEP_MAKEFILES)/palette.make
-include GNUmakefile.postamble
#-include GNUmakefile.postamble

View file

@ -0,0 +1,52 @@
/*
GormImageViewAttributesInspector.h
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Laurent Julliard <laurent@julliard-online.org>
Date: Nov 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormImageViewAttributesInspector_h
#define INCLUDED_GormImageViewAttributesInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSButton;
@class NSMatrix;
@class NSTextField;
@interface GormImageViewAttributesInspector : IBInspector
{
NSTextField *iconField;
NSMatrix *borderMatrix;
NSMatrix *alignmentMatrix;
NSMatrix *scalingMatrix;
NSButton *editableSwitch;
}
@end
#endif /* INCLUDED_GormImageViewAttributesInspector_h */

View file

@ -0,0 +1,155 @@
/*
GormImageViewAttributesInspector.m
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Laurent Julliard <laurent@julliard-online.org>
Date: Nov 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Split inspector classes into separate files.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormImageViewAttributesInspector.h"
#include <Foundation/NSNotification.h>
#include <AppKit/NSButton.h>
#include <AppKit/NSImage.h>
#include <AppKit/NSImageView.h>
#include <AppKit/NSMatrix.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSTextField.h>
/* This macro makes sure that the string contains a value, even if @"" */
#define VSTR(str) ({id _str = str; (_str) ? _str : @"";})
/*
IBObjectAdditions category
*/
@implementation NSImageView (IBObjectAdditions)
- (NSString*) inspectorClassName
{
return @"GormNSImageViewAttributesInspector";
}
@end
@implementation GormImageViewAttributesInspector
- (id) init
{
if ([super init] == nil)
return nil;
if ([NSBundle loadNibNamed: @"GormNSImageViewInspector" owner: self] == NO)
{
NSLog(@"Could not gorm GormImageViewInspector");
return nil;
}
return self;
}
/* Commit changes that the user makes in the Attributes Inspector */
- (void) ok: (id) sender
{
/* icon name */
if (sender == iconField)
{
NSString *name = [sender stringValue];
NSImage *image;
if (name == nil || [name isEqual: @""])
{
[object setImage: nil];
return;
}
image = [NSImage imageNamed: name];
if (image == nil)
{
image = [[NSImage alloc] initByReferencingFile: name];
if (image)
[image setName: name];
}
#warning Not Sure
if ( image != nil )
[object setImage: image ];
// if (image == nil)
// {
// NSRunAlertPanel(@"Gorm ImageView", @"Cannot find image",
// @"OK", NULL, NULL);
// return;
// }
}
/* border */
else if (sender == borderMatrix)
{
[object setImageFrameStyle: [[sender selectedCell] tag]];
}
/* alignment */
else if (sender == alignmentMatrix)
{
[object setImageAlignment: [[sender selectedCell] tag]];
}
/* scaling */
else if (sender == scalingMatrix)
{
[object setImageScaling: [[sender selectedCell] tag]];
}
/* editable */
else if (sender == editableSwitch)
{
[object setEditable: ([sender state] == NSOnState)];
}
[super ok:sender];
}
/* Sync from object ( ImageView ) changes to the inspector */
-(void) revert:(id) sender
{
if ( object == nil)
return;
if ( [ [[object image] name] isEqualToString: @"Sunday_seurat.tiff"] )
[object setImage: nil];
[iconField setStringValue: VSTR([[object image] name])];
[borderMatrix selectCellWithTag: [object imageFrameStyle]];
[alignmentMatrix selectCellWithTag: [object imageAlignment]];
[scalingMatrix selectCellWithTag: [object imageScaling]];
[editableSwitch setState: [object isEditable]];
[super revert:sender];
}
/* delegate method for changing the ImageView Name */
- (void)controlTextDidChange:(NSNotification *)aNotification
{
[self ok:[aNotification object]];
}
@end

View file

@ -0,0 +1,64 @@
/*
GormNSComboBoxAttributesInspector.h
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Laurent Julliard <laurent@julliard-online.org>
Date: Nov 2001
This file is part of GNUstep.
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 Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormNSComboBoxAttributesInspector_h
#define INCLUDED_GormNSComboBoxAttributesInspector_h
#include <InterfaceBuilder/IBInspector.h>
@class NSMutableArray;
@class NSButton;
@class NSColorWell;
@class NSForm;
@class NSMatrix;
@class NSTableView;
@class NSTextField;
@interface GormNSComboBoxAttributesInspector: IBInspector
{
NSMatrix *alignmentMatrix;
NSColorWell *backgroundColorWell;
NSForm *itemField;
NSMatrix *optionMatrix;
NSColorWell *textColorWell;
NSForm *visibleItemsForm;
NSTableView *itemTableView;
NSTextField *itemTxt;
NSButton *addButton;
NSButton *removeButton;
#warning should be private
NSMutableArray *itemsArray;
}
@end
#endif

Some files were not shown because too many files have changed in this diff Show more