Skip to content

Commit

Permalink
Add new palette to Gorm
Browse files Browse the repository at this point in the history
  • Loading branch information
gcasa committed Jan 29, 2025
1 parent f39a264 commit 3202fde
Show file tree
Hide file tree
Showing 21 changed files with 221 additions and 16 deletions.
1 change: 1 addition & 0 deletions Applications/Gorm/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Gorm_RESOURCE_FILES = \
Palettes/2Controls/2Controls.palette \
Palettes/3Containers/3Containers.palette \
Palettes/4Data/4Data.palette \
Palettes/5Boxes/5Boxes.palette \
Images/FileIcon_gmodel.tiff \
Images/GormEHCoil.tiff \
Images/GormEHLine.tiff \
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
16 changes: 16 additions & 0 deletions Applications/Gorm/Palettes/5Boxes/BoxesPalette.gorm/data.classes
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
BoxesPalette = {
Actions = (
);
Outlets = (
vview,
hview,
tview,
vimage,
himage,
timage
);
Super = IBPalette;
};
}
Binary file not shown.
Binary file not shown.
15 changes: 15 additions & 0 deletions Applications/Gorm/Palettes/5Boxes/BoxesPalette.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* All Rights reserved */

#include <AppKit/AppKit.h>
#include <InterfaceBuilder/InterfaceBuilder.h>

@interface BoxesPalette : IBPalette
{
id vview;
id hview;
id tview;
id vimage;
id himage;
id timage;
}
@end
50 changes: 50 additions & 0 deletions Applications/Gorm/Palettes/5Boxes/BoxesPalette.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* All Rights reserved */

#include <AppKit/AppKit.h>
#include <GNUstepGUI/GSTable.h>
#include "BoxesPalette.h"

@interface GSTable (GormDrawingExtension)
- (void) drawRect: (NSRect)rect;
@end

@implementation GSTable (GormDrawingExtension)
- (void) drawRect: (NSRect)aRect
{
// draw whatever the parent view contains.
[super drawRect: aRect];

if([(id<IB>)NSApp isTestingInterface] == NO)
{
CGFloat dot_dash[] = {1.0, 1.0};
NSGraphicsContext *ctxt = GSCurrentContext();

// Draw a green box;
[[NSColor blueColor] set];
DPSsetlinewidth(ctxt, 1.0);
DPSsetdash(ctxt, dot_dash, 4, 0.0);
DPSrectstroke(ctxt, NSMinX(aRect) + 0.5, NSMinY(aRect) + 0.5,
NSWidth(aRect) - 1.0, NSHeight(aRect) - 1.0);
}
}
@end

@implementation BoxesPalette

- (void)finishInstantiate
{
// make the associations...
[self associateObject: tview
type: IBViewPboardType
with: timage];

[self associateObject: hview
type: IBViewPboardType
with: himage];

[self associateObject: vview
type: IBViewPboardType
with: vimage];
}

@end
Binary file not shown.
49 changes: 49 additions & 0 deletions Applications/Gorm/Palettes/5Boxes/GNUmakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# GNUmakefile
#
# Copyright (C) 1999 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., 675 Mass Ave, Cambridge, MA 02139, USA.

include $(GNUSTEP_MAKEFILES)/common.make

PALETTE_NAME = 5Boxes
5Boxes_PALETTE_ICON = BoxesPalette
5Boxes_OBJC_FILES = \
BoxesPalette.m \
GSTableInspector.m

5Boxes_PRINCIPAL_CLASS = BoxesPalette

5Boxes_RESOURCE_FILES = \
BoxesPalette.tiff \
BoxesPalette.gorm \
GSTableInspector.gorm \
palette.table

5Boxes_STANDARD_INSTALL = no

-include GNUmakefile.preamble

-include GNUmakefile.local

include $(GNUSTEP_MAKEFILES)/palette.make

-include GNUmakefile.postamble

2 changes: 2 additions & 0 deletions Applications/Gorm/Palettes/5Boxes/GNUmakefile.preamble
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS += -I../../
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
GSTableInspector = {
Actions = (
);
Outlets = (
matrix
);
Super = IBInspector;
};
}
Binary file not shown.
Binary file not shown.
10 changes: 10 additions & 0 deletions Applications/Gorm/Palettes/5Boxes/GSTableInspector.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* All Rights reserved */

#include <AppKit/AppKit.h>
#include <InterfaceBuilder/InterfaceBuilder.h>

@interface GSTableInspector : IBInspector
{
id matrix;
}
@end
49 changes: 49 additions & 0 deletions Applications/Gorm/Palettes/5Boxes/GSTableInspector.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* All Rights reserved */

#include <AppKit/AppKit.h>
#include "GSTableInspector.h"
#include <GNUstepGUI/GSTable.h>

@implementation GSTable (IBObjectAdditions)
- (NSString *)inspectorClassName
{
return @"GSTableInspector";
}
@end

@implementation GSTableInspector

- (id) init
{
if ([super init] == nil)
return nil;

if ([NSBundle loadNibNamed: @"GSTableInspector" owner: self] == NO)
{
NSLog(@"Could not load GSTableInspector");
return nil;
}
return self;
}

- (void) ok: (id)sender
{
[super ok: sender];
NSLog(@"Testing...");

if(sender == matrix)
{
[object setXBorder: [[sender cellAtIndex: 0] intValue]];
[object setYBorder: [[sender cellAtIndex: 1] intValue]];
[object setMinXBorder: [[sender cellAtIndex: 2] intValue]];
[object setMaxXBorder: [[sender cellAtIndex: 3] intValue]];
[object setMinYBorder: [[sender cellAtIndex: 4] intValue]];
[object setMaxYBorder: [[sender cellAtIndex: 5] intValue]];
}
}

- (void) setObject: (id)anobject
{
[super setObject: anobject];
}
@end
6 changes: 6 additions & 0 deletions Applications/Gorm/Palettes/5Boxes/palette.table
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
NibFile = "BoxesPalette";
Class = "BoxesPalette";
Icon = "BoxesPalette";
ExportClasses = ("GSTable","GSVbox","GSHbox");
}
3 changes: 2 additions & 1 deletion Applications/Gorm/Palettes/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ SUBPROJECTS = \
1Windows \
2Controls \
3Containers \
4Data
4Data \
5Boxes

-include GNUmakefile.preamble

Expand Down
3 changes: 2 additions & 1 deletion Applications/Gorm/Resources/Defaults.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
1Windows.palette,
2Controls.palette,
3Containers.palette,
4Data.palette
4Data.palette,
5Boxes.palette
);
BuiltinPlugins = (
Gorm.plugin,
Expand Down
22 changes: 8 additions & 14 deletions GormCore/GormPalettesManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,6 @@ @interface GormPalettePanel : NSPanel
@end

@implementation GormPalettePanel
/*
- (BOOL) canBecomeKeyWindow
{
return NO;
}
- (BOOL) canBecomeMainWindow
{
return YES;
}
*/
@end

@interface GormPaletteView : NSView
Expand Down Expand Up @@ -363,13 +353,16 @@ - (id) init
inDirectory: nil];
if ([array count] > 0)
{
unsigned index;

NSEnumerator *en = nil;
NSString *paletteName = nil;

array = [array sortedArrayUsingSelector: @selector(compare:)];
en = [array objectEnumerator];

for (index = 0; index < [array count]; index++)
while ((paletteName = [en nextObject]) != nil)
{
[self loadPalette: [array objectAtIndex: index]];
NSLog(@"Built in palette... %@", paletteName);
[self loadPalette: paletteName];
}
}

Expand All @@ -380,6 +373,7 @@ - (id) init
id paletteName = nil;
while((paletteName = [en nextObject]) != nil)
{
NSLog(@"User Palettes Loading... %@", paletteName);
[self loadPalette: paletteName];
}
}
Expand Down

0 comments on commit 3202fde

Please sign in to comment.