mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 15:31:56 +00:00
Add a new character picker panel. It's accessible
via a button in the font panel. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33470 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
bc9bebe77c
commit
85c8422ca8
9 changed files with 654 additions and 0 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
||||||
|
2011-07-06 Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
|
||||||
|
* configure:
|
||||||
|
* Source/NSFontPanel.m:
|
||||||
|
* Source/GNUmakefile:
|
||||||
|
* Source/GSCharacterPanel.m:
|
||||||
|
* configure.ac:
|
||||||
|
* Headers/Additions/GNUstepGUI/GSCharacterPanel.h:
|
||||||
|
* Headers/Additions/GNUstepGUI/config.h.in:
|
||||||
|
* ChangeLog:
|
||||||
|
* config:
|
||||||
|
* config/icu.m4:
|
||||||
|
Add a new character picker panel. It's accessible
|
||||||
|
via a button in the font panel.
|
||||||
|
|
||||||
2011-07-03 Eric Wasylishen <ewasylishen@gmail.com>
|
2011-07-03 Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
|
||||||
* Source/GSDisplayServer.m:
|
* Source/GSDisplayServer.m:
|
||||||
|
|
53
Headers/Additions/GNUstepGUI/GSCharacterPanel.h
Normal file
53
Headers/Additions/GNUstepGUI/GSCharacterPanel.h
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
GSCharacterPanel.h
|
||||||
|
|
||||||
|
Ghostscript image representation.
|
||||||
|
|
||||||
|
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Written by: Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
Date: June 2011
|
||||||
|
|
||||||
|
This file is part of the GNUstep GUI Library.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library 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
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; see the file COPYING.LIB.
|
||||||
|
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||||
|
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _GNUstep_H_GSCharacterPanel
|
||||||
|
#define _GNUstep_H_GSCharacterPanel
|
||||||
|
|
||||||
|
#import <AppKit/NSPanel.h>
|
||||||
|
|
||||||
|
@class NSTableView;
|
||||||
|
@class NSSearchField;
|
||||||
|
@class NSIndexSet;
|
||||||
|
|
||||||
|
@interface GSCharacterPanel : NSPanel
|
||||||
|
{
|
||||||
|
NSTableView *table;
|
||||||
|
NSSearchField *searchfield;
|
||||||
|
|
||||||
|
NSIndexSet *assignedCodepoints;
|
||||||
|
NSIndexSet *visibleCodepoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (GSCharacterPanel *) sharedCharacterPanel;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif // _GNUstep_H_GSCharacterPanel
|
||||||
|
|
|
@ -99,6 +99,12 @@
|
||||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||||
#undef HAVE_SYS_TYPES_H
|
#undef HAVE_SYS_TYPES_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <unicode/uchar.h> header file. */
|
||||||
|
#undef HAVE_UNICODE_UCHAR_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <unicode/ustring.h> header file. */
|
||||||
|
#undef HAVE_UNICODE_USTRING_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <unistd.h> header file. */
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
#undef HAVE_UNISTD_H
|
#undef HAVE_UNISTD_H
|
||||||
|
|
||||||
|
|
|
@ -201,6 +201,7 @@ GSServicesManager.m \
|
||||||
tiff.m \
|
tiff.m \
|
||||||
externs.m \
|
externs.m \
|
||||||
linking.m \
|
linking.m \
|
||||||
|
GSCharacterPanel.m \
|
||||||
GSDragView.m \
|
GSDragView.m \
|
||||||
GSFontInfo.m \
|
GSFontInfo.m \
|
||||||
GSTable.m \
|
GSTable.m \
|
||||||
|
|
352
Source/GSCharacterPanel.m
Normal file
352
Source/GSCharacterPanel.m
Normal file
|
@ -0,0 +1,352 @@
|
||||||
|
/** <title>GSCharacterPanel</title>
|
||||||
|
|
||||||
|
<abstract>Character Panel.</abstract>
|
||||||
|
|
||||||
|
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Author: Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
Date: July 2011
|
||||||
|
|
||||||
|
This file is part of the GNUstep Application Kit Library.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library 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
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; see the file COPYING.LIB.
|
||||||
|
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||||
|
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import "config.h"
|
||||||
|
|
||||||
|
#import <Foundation/NSIndexSet.h>
|
||||||
|
#import <Foundation/NSBundle.h>
|
||||||
|
#import <Foundation/NSAutoreleasePool.h>
|
||||||
|
#import "AppKit/NSStringDrawing.h"
|
||||||
|
#import "AppKit/NSPasteboard.h"
|
||||||
|
#import "AppKit/NSTableView.h"
|
||||||
|
#import "AppKit/NSTableColumn.h"
|
||||||
|
#import "AppKit/NSTextFieldCell.h"
|
||||||
|
#import "AppKit/NSScrollView.h"
|
||||||
|
#import "AppKit/NSSearchField.h"
|
||||||
|
#import "GNUstepGUI/GSCharacterPanel.h"
|
||||||
|
|
||||||
|
#if defined(HAVE_UNICODE_UCHAR_H) && defined(HAVE_UNICODE_USTRING_H)
|
||||||
|
|
||||||
|
#include <unicode/uchar.h>
|
||||||
|
#include <unicode/ustring.h>
|
||||||
|
|
||||||
|
@interface GSVerticallyCenteredTextFieldCell : NSTextFieldCell
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation GSVerticallyCenteredTextFieldCell
|
||||||
|
|
||||||
|
- (NSRect) titleRectForBounds: (NSRect)aRect
|
||||||
|
{
|
||||||
|
NSRect titleRect = [super titleRectForBounds: aRect];
|
||||||
|
NSSize titleSize = [[self attributedStringValue] size];
|
||||||
|
titleRect.origin.y = aRect.origin.y + (aRect.size.height - titleSize.height) / 2.0;
|
||||||
|
titleRect.size.height = titleSize.height;
|
||||||
|
return titleRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
// Enumerating assigned codepoints
|
||||||
|
|
||||||
|
static UBool enumCharNamesFn(void *context, UChar32 code, UCharNameChoice nameChoice, const char *name, int32_t length)
|
||||||
|
{
|
||||||
|
[(NSMutableIndexSet*)context addIndex: (NSUInteger)code];
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static NSIndexSet *AssignedCodepoints()
|
||||||
|
{
|
||||||
|
UErrorCode err = U_ZERO_ERROR;
|
||||||
|
NSMutableIndexSet *set = [NSMutableIndexSet indexSet];
|
||||||
|
u_enumCharNames(UCHAR_MIN_VALUE, UCHAR_MAX_VALUE + 1, enumCharNamesFn, set, U_UNICODE_CHAR_NAME, &err);
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Searching for codepoints
|
||||||
|
|
||||||
|
struct searchContext {
|
||||||
|
const char *searchString;
|
||||||
|
NSMutableIndexSet *set;
|
||||||
|
};
|
||||||
|
|
||||||
|
static UBool searchCharNamesFn(void *context, UChar32 code, UCharNameChoice nameChoice, const char *name, int32_t length)
|
||||||
|
{
|
||||||
|
struct searchContext *ctx = (struct searchContext *)context;
|
||||||
|
if (strstr(name, ctx->searchString) != NULL)
|
||||||
|
{
|
||||||
|
[ctx->set addIndex: (NSUInteger)code];
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static NSIndexSet *CodepointsWithNameContainingSubstring(NSString *str)
|
||||||
|
{
|
||||||
|
UErrorCode err = U_ZERO_ERROR;
|
||||||
|
struct searchContext ctx;
|
||||||
|
|
||||||
|
ctx.set = [NSMutableIndexSet indexSet];
|
||||||
|
ctx.searchString = [[str uppercaseString] UTF8String];
|
||||||
|
|
||||||
|
u_enumCharNames(UCHAR_MIN_VALUE, UCHAR_MAX_VALUE + 1, searchCharNamesFn, &ctx, U_UNICODE_CHAR_NAME, &err);
|
||||||
|
|
||||||
|
return ctx.set;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@implementation GSCharacterPanel
|
||||||
|
|
||||||
|
- (void)setVisibleCodepoints: (NSIndexSet*)set
|
||||||
|
{
|
||||||
|
ASSIGN(visibleCodepoints, set);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
+ (GSCharacterPanel *) sharedCharacterPanel
|
||||||
|
{
|
||||||
|
static GSCharacterPanel *shared = nil;
|
||||||
|
if (nil == shared)
|
||||||
|
{
|
||||||
|
shared = [[self alloc] init];
|
||||||
|
}
|
||||||
|
return shared;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) init
|
||||||
|
{
|
||||||
|
const NSRect contentRect = NSMakeRect(100, 100, 276, 420);
|
||||||
|
self = [super initWithContentRect: contentRect
|
||||||
|
styleMask: NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask | NSUtilityWindowMask
|
||||||
|
backing: NSBackingStoreBuffered
|
||||||
|
defer: YES];
|
||||||
|
if (nil != self)
|
||||||
|
{
|
||||||
|
// Setup assignedCodepoints and visibleCodepointsArray
|
||||||
|
assignedCodepoints = [AssignedCodepoints() retain];
|
||||||
|
[self setVisibleCodepoints: assignedCodepoints];
|
||||||
|
|
||||||
|
[self setTitle: _(@"Character Panel")];
|
||||||
|
|
||||||
|
// Set up the table view
|
||||||
|
table = [[[NSTableView alloc] initWithFrame: NSMakeRect(0, 0, contentRect.size.width - 18, contentRect.size.height - 52)] autorelease];
|
||||||
|
|
||||||
|
// Set up table columns
|
||||||
|
{
|
||||||
|
NSTableColumn *col = [[[NSTableColumn alloc] initWithIdentifier: @"char"] autorelease];
|
||||||
|
[col setDataCell: [[[GSVerticallyCenteredTextFieldCell alloc] init] autorelease]];
|
||||||
|
[[col dataCell] setFont:[NSFont systemFontOfSize: 24]];
|
||||||
|
[[col dataCell] setAlignment: NSCenterTextAlignment];
|
||||||
|
[col setMinWidth: 40];
|
||||||
|
[col setWidth: 40];
|
||||||
|
[table addTableColumn: col];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
NSTableColumn *col = [[[NSTableColumn alloc] initWithIdentifier: @"name"] autorelease];
|
||||||
|
[col setDataCell: [[[GSVerticallyCenteredTextFieldCell alloc] init] autorelease]];
|
||||||
|
[[col dataCell] setFont:[NSFont systemFontOfSize: 10]];
|
||||||
|
[[col headerCell] setStringValue: _(@"Name")];
|
||||||
|
[col setWidth: 195];
|
||||||
|
[table addTableColumn: col];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
NSTableColumn *col = [[[NSTableColumn alloc] initWithIdentifier: @"code"] autorelease];
|
||||||
|
[col setDataCell: [[[GSVerticallyCenteredTextFieldCell alloc] init] autorelease]];
|
||||||
|
[[col dataCell] setFont:[NSFont systemFontOfSize: 10]];
|
||||||
|
[[col dataCell] setAlignment: NSCenterTextAlignment];
|
||||||
|
[[col headerCell] setStringValue: _(@"Code Point")];
|
||||||
|
[col setMinWidth: 80];
|
||||||
|
[col setWidth: 80];
|
||||||
|
[table addTableColumn: col];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
NSTableColumn *col = [[[NSTableColumn alloc] initWithIdentifier: @"block"] autorelease];
|
||||||
|
[col setDataCell: [[[GSVerticallyCenteredTextFieldCell alloc] init] autorelease]];
|
||||||
|
[[col dataCell] setFont:[NSFont systemFontOfSize: 10]];
|
||||||
|
[[col headerCell] setStringValue: _(@"Unicode Block")];
|
||||||
|
[col setMinWidth: 140];
|
||||||
|
[table addTableColumn: col];
|
||||||
|
}
|
||||||
|
|
||||||
|
[table setRowHeight: 32];
|
||||||
|
[table setDataSource: self];
|
||||||
|
[table setDelegate: self];
|
||||||
|
|
||||||
|
// Allow dragging out of the application
|
||||||
|
[table setDraggingSourceOperationMask:NSDragOperationCopy forLocal:NO];
|
||||||
|
|
||||||
|
// Set up scroll view
|
||||||
|
{
|
||||||
|
NSScrollView *scrollView = [[NSScrollView alloc] initWithFrame: NSMakeRect(9, 41, contentRect.size.width - 18, contentRect.size.height - 52)];
|
||||||
|
[scrollView setDocumentView: table];
|
||||||
|
[scrollView setHasHorizontalScroller: YES];
|
||||||
|
[scrollView setHasVerticalScroller: YES];
|
||||||
|
[scrollView setBorderType: NSBezelBorder];
|
||||||
|
[scrollView setAutoresizingMask: (NSViewWidthSizable | NSViewHeightSizable)];
|
||||||
|
[[self contentView] addSubview: scrollView];
|
||||||
|
[scrollView release];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set up search field
|
||||||
|
{
|
||||||
|
searchfield = [[NSSearchField alloc] initWithFrame: NSMakeRect(9,9,186,22)];
|
||||||
|
[searchfield setTarget: self];
|
||||||
|
[searchfield setAction: @selector(search:)];
|
||||||
|
[[self contentView] addSubview: searchfield];
|
||||||
|
[searchfield release];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)dealloc
|
||||||
|
{
|
||||||
|
[assignedCodepoints release];
|
||||||
|
[visibleCodepoints release];
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)search: (id)sender
|
||||||
|
{
|
||||||
|
NSString *str = [searchfield stringValue];
|
||||||
|
|
||||||
|
if ([str length] == 0)
|
||||||
|
{
|
||||||
|
[self setVisibleCodepoints: assignedCodepoints];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NSIndexSet *set = CodepointsWithNameContainingSubstring(str);
|
||||||
|
[self setVisibleCodepoints: set];
|
||||||
|
}
|
||||||
|
|
||||||
|
[table reloadData];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSUInteger) codepointAtVisibleRow:(NSUInteger)row
|
||||||
|
{
|
||||||
|
//FIXME: Use a binary search
|
||||||
|
NSUInteger curr = 0;
|
||||||
|
NSUInteger currValue = [visibleCodepoints firstIndex];
|
||||||
|
|
||||||
|
while (currValue != NSNotFound)
|
||||||
|
{
|
||||||
|
if (curr == row)
|
||||||
|
{
|
||||||
|
return currValue;
|
||||||
|
}
|
||||||
|
currValue = [visibleCodepoints indexGreaterThanIndex: currValue];
|
||||||
|
curr++;
|
||||||
|
}
|
||||||
|
return NSNotFound;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)characterForRow: (NSInteger)row
|
||||||
|
{
|
||||||
|
if (row > 0 && row < [visibleCodepoints count])
|
||||||
|
{
|
||||||
|
UChar32 utf32 = [self codepointAtVisibleRow: row];
|
||||||
|
UChar utf16buf[2];
|
||||||
|
int32_t utf16bufLength = 0;
|
||||||
|
UErrorCode error = U_ZERO_ERROR;
|
||||||
|
u_strFromUTF32(utf16buf, 2, &utf16bufLength, &utf32, 1, &error);
|
||||||
|
|
||||||
|
return [[[NSString alloc] initWithCharacters: utf16buf
|
||||||
|
length: utf16bufLength] autorelease];
|
||||||
|
}
|
||||||
|
return @"";
|
||||||
|
}
|
||||||
|
|
||||||
|
// NSTableViewDataSource protocol
|
||||||
|
|
||||||
|
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
|
||||||
|
{
|
||||||
|
return [visibleCodepoints count];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
|
||||||
|
{
|
||||||
|
UChar32 utf32 = [self codepointAtVisibleRow: row];
|
||||||
|
|
||||||
|
if ([[tableColumn identifier] isEqualToString: @"char"])
|
||||||
|
{
|
||||||
|
return [self characterForRow: row];
|
||||||
|
}
|
||||||
|
else if ([[tableColumn identifier] isEqualToString: @"name"])
|
||||||
|
{
|
||||||
|
UErrorCode error = U_ZERO_ERROR;
|
||||||
|
int32_t size = u_charName(utf32, U_UNICODE_CHAR_NAME, NULL, 0, &error);
|
||||||
|
|
||||||
|
if (size > 0)
|
||||||
|
{
|
||||||
|
char name[512];
|
||||||
|
error = U_ZERO_ERROR;
|
||||||
|
u_charName(utf32, U_UNICODE_CHAR_NAME, name, 512, &error);
|
||||||
|
|
||||||
|
NSString *nameObj = [[[NSString alloc] initWithBytes: name
|
||||||
|
length: size
|
||||||
|
encoding: NSASCIIStringEncoding] autorelease];
|
||||||
|
return [[nameObj lowercaseString] capitalizedString];
|
||||||
|
}
|
||||||
|
return @"";
|
||||||
|
}
|
||||||
|
else if ([[tableColumn identifier] isEqualToString: @"code"])
|
||||||
|
{
|
||||||
|
return [NSString stringWithFormat:@"U+%04X", (int)utf32];
|
||||||
|
}
|
||||||
|
else if ([[tableColumn identifier] isEqualToString: @"block"])
|
||||||
|
{
|
||||||
|
int32_t val = u_getIntPropertyValue(utf32, UCHAR_BLOCK);
|
||||||
|
const char *name = u_getPropertyValueName(UCHAR_BLOCK, val, U_LONG_PROPERTY_NAME);
|
||||||
|
if (name != NULL)
|
||||||
|
{
|
||||||
|
return [[[[NSString alloc] initWithBytes: name
|
||||||
|
length: strlen(name)
|
||||||
|
encoding: NSASCIIStringEncoding] autorelease] stringByReplacingOccurrencesOfString: @"_" withString: @" "];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard
|
||||||
|
{
|
||||||
|
NSString *str = [self characterForRow: [rowIndexes firstIndex]];
|
||||||
|
|
||||||
|
[pboard declareTypes: [NSArray arrayWithObject: NSStringPboardType]
|
||||||
|
owner: nil];
|
||||||
|
[pboard setString: str
|
||||||
|
forType: NSStringPboardType];
|
||||||
|
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#else // !(defined(HAVE_UNICODE_UCHAR_H) && defined(HAVE_UNICODE_USTRING_H))
|
||||||
|
|
||||||
|
@implementation GSCharacterPanel
|
||||||
|
|
||||||
|
+ (GSCharacterPanel *) sharedCharacterPanel
|
||||||
|
{
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif
|
|
@ -47,6 +47,7 @@
|
||||||
#import "AppKit/NSPanel.h"
|
#import "AppKit/NSPanel.h"
|
||||||
#import "AppKit/NSButton.h"
|
#import "AppKit/NSButton.h"
|
||||||
#import "AppKit/NSBox.h"
|
#import "AppKit/NSBox.h"
|
||||||
|
#import "GNUstepGUI/GSCharacterPanel.h"
|
||||||
|
|
||||||
#import "GSGuiPrivate.h"
|
#import "GSGuiPrivate.h"
|
||||||
|
|
||||||
|
@ -516,6 +517,7 @@ static float sizes[] = {4.0, 6.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
|
||||||
NSRect revertButtonRect = {{83, 8}, {71, 24}};
|
NSRect revertButtonRect = {{83, 8}, {71, 24}};
|
||||||
NSRect previewButtonRect = {{162, 8}, {71, 24}};
|
NSRect previewButtonRect = {{162, 8}, {71, 24}};
|
||||||
NSRect setButtonRect = {{241, 8}, {71, 24}};
|
NSRect setButtonRect = {{241, 8}, {71, 24}};
|
||||||
|
NSRect characterPanelButtonRect = {{8, 8}, {24, 24}};
|
||||||
NSView *v;
|
NSView *v;
|
||||||
NSView *topArea;
|
NSView *topArea;
|
||||||
NSView *bottomArea;
|
NSView *bottomArea;
|
||||||
|
@ -531,6 +533,7 @@ static float sizes[] = {4.0, 6.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
|
||||||
NSButton *revertButton;
|
NSButton *revertButton;
|
||||||
NSButton *previewButton;
|
NSButton *previewButton;
|
||||||
NSButton *setButton;
|
NSButton *setButton;
|
||||||
|
NSButton *characterPanelButton;
|
||||||
NSBox *slash;
|
NSBox *slash;
|
||||||
|
|
||||||
unsigned int style = NSTitledWindowMask | NSClosableWindowMask
|
unsigned int style = NSTitledWindowMask | NSClosableWindowMask
|
||||||
|
@ -718,6 +721,21 @@ static float sizes[] = {4.0, 6.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
|
||||||
[self setDefaultButtonCell: [setButton cell]];
|
[self setDefaultButtonCell: [setButton cell]];
|
||||||
RELEASE(setButton);
|
RELEASE(setButton);
|
||||||
|
|
||||||
|
// Character Panel button
|
||||||
|
{
|
||||||
|
NSString *label;
|
||||||
|
unichar labelchars[2] = {0x03b1, 0x03b2}; // alpha, beta
|
||||||
|
label = [[[NSString alloc] initWithCharacters: labelchars
|
||||||
|
length: 2] autorelease];
|
||||||
|
|
||||||
|
characterPanelButton = [[NSButton alloc] initWithFrame: characterPanelButtonRect];
|
||||||
|
[characterPanelButton setTitle: label];
|
||||||
|
[characterPanelButton setAction: @selector(characterPanel:)];
|
||||||
|
[characterPanelButton setTarget: self];
|
||||||
|
[bottomArea addSubview: characterPanelButton];
|
||||||
|
RELEASE(characterPanelButton);
|
||||||
|
}
|
||||||
|
|
||||||
// set up the next key view chain
|
// set up the next key view chain
|
||||||
[familyBrowser setNextKeyView: faceBrowser];
|
[familyBrowser setNextKeyView: faceBrowser];
|
||||||
[faceBrowser setNextKeyView: sizeField];
|
[faceBrowser setNextKeyView: sizeField];
|
||||||
|
@ -822,6 +840,11 @@ static float sizes[] = {4.0, 6.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
|
||||||
isMultiple: _multiple];
|
isMultiple: _multiple];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) characterPanel: (id)sender
|
||||||
|
{
|
||||||
|
[[GSCharacterPanel sharedCharacterPanel] orderFront: nil];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSFont *) _fontForSelection: (NSFont *)fontObject
|
- (NSFont *) _fontForSelection: (NSFont *)fontObject
|
||||||
{
|
{
|
||||||
float size;
|
float size;
|
||||||
|
|
41
config/icu.m4
Normal file
41
config/icu.m4
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
AC_DEFUN([AC_CHECK_ICU], [
|
||||||
|
ok=no
|
||||||
|
|
||||||
|
if test -z "$ICU_CONFIG"; then
|
||||||
|
AC_PATH_PROG(ICU_CONFIG, icu-config, no)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$ICU_CONFIG" = "no" ; then
|
||||||
|
echo "Could not find the icu-config script."
|
||||||
|
echo "Please ensure that it is in your path."
|
||||||
|
echo "See http://site.icu-project.org/ for help."
|
||||||
|
else
|
||||||
|
ICU_VERSION=`$ICU_CONFIG --version`
|
||||||
|
AC_MSG_CHECKING(for ICU >= $1)
|
||||||
|
found=`expr $ICU_VERSION \>= $1`
|
||||||
|
if test "$found" = "1" ; then
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
ok=yes
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(ICU_LIBS)
|
||||||
|
ICU_LIBS=`$ICU_CONFIG --ldflags-libsonly`
|
||||||
|
AC_MSG_RESULT($ICU_LIBS)
|
||||||
|
AC_MSG_CHECKING(ICU_LDFLAGS)
|
||||||
|
ICU_LDFLAGS=`$ICU_CONFIG --ldflags-searchpath`
|
||||||
|
AC_MSG_RESULT($ICU_LDFLAGS)
|
||||||
|
else
|
||||||
|
ICU_LIBS=""
|
||||||
|
ICU_LDFLAGS=""
|
||||||
|
## Either perform custom action or print error message
|
||||||
|
ifelse([$3], ,echo "can't find ICU >= $1 (got $ICU_VERSION)",)
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_SUBST(ICU_LIBS)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test $ok = yes; then
|
||||||
|
ifelse([$2], , :, [$2])
|
||||||
|
else
|
||||||
|
ifelse([$3], , AC_MSG_ERROR([Library requirements (ICU) not met.]), [$3])
|
||||||
|
fi
|
||||||
|
])
|
135
configure
vendored
135
configure
vendored
|
@ -609,6 +609,9 @@ GSCUPS_CFLAGS
|
||||||
have_cups
|
have_cups
|
||||||
BUILD_SPEECH
|
BUILD_SPEECH
|
||||||
BUILD_SOUND
|
BUILD_SOUND
|
||||||
|
HAVE_ICU
|
||||||
|
ICU_LIBS
|
||||||
|
ICU_CONFIG
|
||||||
IMAGEMAGICK_LIBS
|
IMAGEMAGICK_LIBS
|
||||||
IMAGEMAGICK_CFLAGS
|
IMAGEMAGICK_CFLAGS
|
||||||
PKG_CONFIG_LIBDIR
|
PKG_CONFIG_LIBDIR
|
||||||
|
@ -691,6 +694,7 @@ enable_png
|
||||||
enable_ungif
|
enable_ungif
|
||||||
enable_libgif
|
enable_libgif
|
||||||
enable_imagemagick
|
enable_imagemagick
|
||||||
|
enable_icu
|
||||||
enable_aspell
|
enable_aspell
|
||||||
enable_sound
|
enable_sound
|
||||||
enable_speech
|
enable_speech
|
||||||
|
@ -1334,6 +1338,7 @@ Optional Features:
|
||||||
--disable-ungif Disable libungif-based GIF support
|
--disable-ungif Disable libungif-based GIF support
|
||||||
--enable-libgif Enable libgif-based GIF support
|
--enable-libgif Enable libgif-based GIF support
|
||||||
--disable-imagemagick Disable ImageMagick support
|
--disable-imagemagick Disable ImageMagick support
|
||||||
|
--disable-icu Disable International Components for Unicode
|
||||||
--disable-aspell Disable aspell for spellchecker
|
--disable-aspell Disable aspell for spellchecker
|
||||||
--disable-sound Disable sound
|
--disable-sound Disable sound
|
||||||
--disable-speech Disable speech server
|
--disable-speech Disable speech server
|
||||||
|
@ -5630,6 +5635,136 @@ fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Check for International Components for Unicode
|
||||||
|
# See DEPENDENCIES POLICY at the start of thsi file.
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
HAVE_ICU=0
|
||||||
|
# Check whether --enable-icu was given.
|
||||||
|
if test "${enable_icu+set}" = set; then :
|
||||||
|
enableval=$enable_icu;
|
||||||
|
else
|
||||||
|
enable_icu=yes
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if test $enable_icu = yes; then
|
||||||
|
|
||||||
|
ok=no
|
||||||
|
|
||||||
|
if test -z "$ICU_CONFIG"; then
|
||||||
|
# Extract the first word of "icu-config", so it can be a program name with args.
|
||||||
|
set dummy icu-config; ac_word=$2
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||||
|
$as_echo_n "checking for $ac_word... " >&6; }
|
||||||
|
if test "${ac_cv_path_ICU_CONFIG+set}" = set; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
case $ICU_CONFIG in
|
||||||
|
[\\/]* | ?:[\\/]*)
|
||||||
|
ac_cv_path_ICU_CONFIG="$ICU_CONFIG" # Let the user override the test with a path.
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||||
|
for as_dir in $PATH
|
||||||
|
do
|
||||||
|
IFS=$as_save_IFS
|
||||||
|
test -z "$as_dir" && as_dir=.
|
||||||
|
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||||
|
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||||
|
ac_cv_path_ICU_CONFIG="$as_dir/$ac_word$ac_exec_ext"
|
||||||
|
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||||
|
break 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
IFS=$as_save_IFS
|
||||||
|
|
||||||
|
test -z "$ac_cv_path_ICU_CONFIG" && ac_cv_path_ICU_CONFIG="no"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
ICU_CONFIG=$ac_cv_path_ICU_CONFIG
|
||||||
|
if test -n "$ICU_CONFIG"; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ICU_CONFIG" >&5
|
||||||
|
$as_echo "$ICU_CONFIG" >&6; }
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||||
|
$as_echo "no" >&6; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$ICU_CONFIG" = "no" ; then
|
||||||
|
echo "Could not find the icu-config script."
|
||||||
|
echo "Please ensure that it is in your path."
|
||||||
|
echo "See http://site.icu-project.org/ for help."
|
||||||
|
else
|
||||||
|
ICU_VERSION=`$ICU_CONFIG --version`
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ICU >= 4.0" >&5
|
||||||
|
$as_echo_n "checking for ICU >= 4.0... " >&6; }
|
||||||
|
found=`expr $ICU_VERSION \>= 4.0`
|
||||||
|
if test "$found" = "1" ; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||||
|
$as_echo "yes" >&6; }
|
||||||
|
ok=yes
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking ICU_LIBS" >&5
|
||||||
|
$as_echo_n "checking ICU_LIBS... " >&6; }
|
||||||
|
ICU_LIBS=`$ICU_CONFIG --ldflags-libsonly`
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ICU_LIBS" >&5
|
||||||
|
$as_echo "$ICU_LIBS" >&6; }
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking ICU_LDFLAGS" >&5
|
||||||
|
$as_echo_n "checking ICU_LDFLAGS... " >&6; }
|
||||||
|
ICU_LDFLAGS=`$ICU_CONFIG --ldflags-searchpath`
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ICU_LDFLAGS" >&5
|
||||||
|
$as_echo "$ICU_LDFLAGS" >&6; }
|
||||||
|
else
|
||||||
|
ICU_LIBS=""
|
||||||
|
ICU_LDFLAGS=""
|
||||||
|
## Either perform custom action or print error message
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test $ok = yes; then
|
||||||
|
have_icu=yes
|
||||||
|
else
|
||||||
|
have_icu=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$have_icu" = "yes"; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||||
|
$as_echo "yes" >&6; }
|
||||||
|
for ac_header in unicode/uchar.h unicode/ustring.h
|
||||||
|
do :
|
||||||
|
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||||
|
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
||||||
|
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
LIBS="$LIBS $ICU_LIBS"
|
||||||
|
LDFLAGS="$LDFLAGS $ICU_LDFLAGS"
|
||||||
|
LDIR_FLAGS="$LDIR_FLAGS $ICU_LDFLAGS"
|
||||||
|
HAVE_ICU=1
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||||
|
$as_echo "no" >&6; }
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The International Components for Unicode (ICU) development headers and libraries do not appear to be available on this system." >&5
|
||||||
|
$as_echo "$as_me: WARNING: The International Components for Unicode (ICU) development headers and libraries do not appear to be available on this system." >&2;}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Check for the spelling lib, for the built-in spell checker...
|
# Check for the spelling lib, for the built-in spell checker...
|
||||||
# Note: you might want to disable aspell on MacOSX, as it linkes in
|
# Note: you might want to disable aspell on MacOSX, as it linkes in
|
||||||
|
|
28
configure.ac
28
configure.ac
|
@ -23,6 +23,9 @@
|
||||||
# Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
# Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||||
# Boston, MA 02110-1301, USA.
|
# Boston, MA 02110-1301, USA.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
builtin(include, config/icu.m4)dnl
|
||||||
|
|
||||||
AC_INIT
|
AC_INIT
|
||||||
AC_CONFIG_SRCDIR([Source/NSApplication.m])
|
AC_CONFIG_SRCDIR([Source/NSApplication.m])
|
||||||
|
|
||||||
|
@ -368,6 +371,31 @@ AS_IF([test "$enable_imagemagick" = "yes"], [
|
||||||
[AC_DEFINE([HAVE_IMAGEMAGICK], [0], [Don't have ImageMagick])])
|
[AC_DEFINE([HAVE_IMAGEMAGICK], [0], [Don't have ImageMagick])])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Check for International Components for Unicode
|
||||||
|
# See DEPENDENCIES POLICY at the start of thsi file.
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
HAVE_ICU=0
|
||||||
|
AC_ARG_ENABLE(icu,
|
||||||
|
[ --disable-icu Disable International Components for Unicode],,
|
||||||
|
enable_icu=yes)
|
||||||
|
|
||||||
|
if test $enable_icu = yes; then
|
||||||
|
AC_CHECK_ICU(4.0, have_icu=yes, have_icu=no)
|
||||||
|
if test "$have_icu" = "yes"; then
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_CHECK_HEADERS(unicode/uchar.h unicode/ustring.h)
|
||||||
|
LIBS="$LIBS $ICU_LIBS"
|
||||||
|
LDFLAGS="$LDFLAGS $ICU_LDFLAGS"
|
||||||
|
LDIR_FLAGS="$LDIR_FLAGS $ICU_LDFLAGS"
|
||||||
|
HAVE_ICU=1
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
AC_MSG_WARN([The International Components for Unicode (ICU) development headers and libraries do not appear to be available on this system.])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
AC_SUBST(HAVE_ICU)
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Check for the spelling lib, for the built-in spell checker...
|
# Check for the spelling lib, for the built-in spell checker...
|
||||||
# Note: you might want to disable aspell on MacOSX, as it linkes in
|
# Note: you might want to disable aspell on MacOSX, as it linkes in
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue