Fixes bug#13753: User should now be able to change the color of the guideline from the guideline preferences.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@38356 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2015-02-23 02:23:29 +00:00
parent 14b3cc8602
commit 17ec30efb2
12 changed files with 40 additions and 123 deletions

View file

@ -1,3 +1,15 @@
2015-02-22 21:21-EST Gregory John Casamento <greg.casamento@gmail.com>
* English.lproj/GormPreferences.gorm: Removed from pulldown menu
* English.lproj/GormPrefGuideline.gorm: Added colorwell and
connections.
* GormPrefs/GNUmakefile: Removed classes.
* GormPrefs/GormColorsPref.h
* GormPrefs/GormColorsPref.m: Removed.
* GormPrefs/GormGuidelinePref.h
* GormPrefs/GormGuidelinePref.m: Added color well...
* GormPrefs/GormPrefController.m: Removed view from case statement
2014-10-28 03:08-EDT Gregory John Casamento <greg.casamento@gmail.com>
* English.lproj/Gorm.gorm: Change connection to point to

View file

@ -14,9 +14,10 @@
Outlets = (
spacingSlider,
window,
_view,
"_view",
currentSpacing,
halfSpacing
halfSpacing,
colorWell
);
Super = NSObject;
};

View file

@ -38,7 +38,6 @@ GormPrefs_LIBRARIES_DEPEND_UPON += -lgnustep-gui -l$(FOUNDATION_LIBRARY_NAME)
#
GormPrefs_HEADER_FILES= \
GormColorsPref.h \
GormGeneralPref.h \
GormGuidelinePref.h \
GormHeadersPref.h \
@ -52,7 +51,6 @@ GormShelfPref.h
#
GormPrefs_OBJC_FILES= \
GormColorsPref.m \
GormGeneralPref.m \
GormGuidelinePref.m \
GormHeadersPref.m \

View file

@ -1,52 +0,0 @@
/* GormColorsPref.h
*
* Copyright (C) 2003 Free Software Foundation, Inc.
*
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
* Date: 1999, 2003
*
* 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 3 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_GormColorsPref_h
#define INCLUDED_GormColorsPref_h
#include <Foundation/NSObject.h>
#include <Foundation/NSArray.h>
#include <AppKit/NSView.h>
@class NSWindow;
@interface GormColorsPref : NSObject
{
id color;
NSWindow *window;
id _view;
}
/**
* View to be shown.
*/
- (NSView *) view;
/**
* Set the colors.
*/
- (void)ok: (id)sender;
@end
#endif

View file

@ -1,59 +0,0 @@
#include "GormColorsPref.h"
#include <GormCore/GormFunctions.h>
#include <Foundation/NSUserDefaults.h>
#include <AppKit/NSWindow.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSColorWell.h>
#include <AppKit/NSColor.h>
@implementation GormColorsPref
- (id) init
{
_view = nil;
self = [super init];
if(self != nil)
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSColor *aColor = colorFromDict([defaults objectForKey: @"GuideColor"]);
// default the color to something, if nothing is returned.
if(aColor == nil)
{
aColor = [NSColor redColor];
}
if ( ! [NSBundle loadNibNamed:@"GormPrefColors" owner:self] )
{
NSLog(@"Can not load bundle GormPrefColors");
return nil;
}
[color setColor: aColor];
_view = [[window contentView] retain];
}
return self;
}
- (void) dealloc
{
TEST_RELEASE(_view);
[super dealloc];
}
-(NSView *) view
{
return _view;
}
- (void) ok: (id)sender
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if(sender == color)
{
[defaults setObject: colorToDict([color color]) forKey: @"GuideColor"];
}
}
@end

View file

@ -38,6 +38,7 @@
id spacingSlider;
id currentSpacing;
id halfSpacing;
id colorWell;
}
/**
* View to show in prefs panel.

View file

@ -8,22 +8,32 @@
#include <AppKit/NSColor.h>
@implementation GormGuidelinePref
- (id) init
{
if((self = [super init]) != nil)
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
int spacing = [defaults integerForKey: @"GuideSpacing"];
NSColor *aColor = colorFromDict([defaults objectForKey: @"GuideColor"]);
// default the color to something, if nothing is returned.
if(aColor == nil)
{
aColor = [NSColor redColor];
}
if ( [NSBundle loadNibNamed:@"GormPrefGuideline" owner:self] == NO )
{
NSLog(@"Can not load bundle GormPrefGuideline");
return nil;
}
[colorWell setColor: aColor];
[spacingSlider setIntValue: spacing];
[currentSpacing setIntValue: spacing];
[halfSpacing setIntValue: spacing/2];
_view = [[window contentView] retain];
}
return self;
@ -35,7 +45,6 @@
[super dealloc];
}
-(NSView *) view
{
return _view;
@ -47,15 +56,27 @@
if(sender == spacingSlider)
{
int spacing = [spacingSlider intValue];
[currentSpacing setIntValue: spacing];
[halfSpacing setIntValue: spacing/2];
[defaults setInteger: spacing forKey: @"GuideSpacing"];
[defaults setInteger: spacing
forKey: @"GuideSpacing"];
}
else if(sender == colorWell)
{
NSColor *color = [colorWell color];
[defaults setObject: colorToDict(color)
forKey: @"GuideColor"];
}
}
- (void) reset: (id)sender
{
[spacingSlider setIntValue: 10];
[colorWell setColor: [NSColor redColor]];
[self ok: spacingSlider];
[self ok: colorWell];
}
@end

View file

@ -2,7 +2,6 @@
#include "GormGeneralPref.h"
#include "GormHeadersPref.h"
#include "GormShelfPref.h"
#include "GormColorsPref.h"
#include "GormPalettesPref.h"
#include "GormPluginsPref.h"
#include "GormGuidelinePref.h"
@ -32,7 +31,6 @@
_generalView = [[GormGeneralPref alloc] init];
_headersView = [[GormHeadersPref alloc] init];
_shelfView = [[GormShelfPref alloc] init];
_colorsView = [[GormColorsPref alloc] init];
_palettesView = [[GormPalettesPref alloc] init];
_pluginsView = [[GormPluginsPref alloc] init];
_guidelineView = [[GormGuidelinePref alloc] init];
@ -63,9 +61,6 @@
case 2:
[prefBox setContentView: [_shelfView view]];
break;
case 3:
[prefBox setContentView: [_colorsView view]];
break;
case 4:
[prefBox setContentView: [_palettesView view]];
break;