Updated docs and added key dropdown for menu.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@25578 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2007-11-11 02:47:42 +00:00
parent 5c7a847ec5
commit 6ecd3e5341
9 changed files with 247 additions and 21 deletions

View file

@ -1,3 +1,13 @@
2007-11-10 21:46-EST Gregory John Casamento <greg_casamento@yahoo.com>
* Documentation/news.texi
* Documentation/readme.texi: Update of documentation.
* Palettes/0Menus/GormMenuItemAttributesInspector.gorm
* Palettes/0Menus/GormMenuItemAttributesInspector.h
* Palettes/0Menus/GormMenuItemAttributesInspector.m
* Palettes/2Controls/GormButtonAttributesInspector.m: Add
key equivalent drop down for special keys for menu items.
2007-11-05 18:43-EST Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormBoxEditor.h

View file

@ -4,19 +4,31 @@
@include version.texi
@end ifset
@section Noteworthy changes in version @samp{1.2.0}
@section Noteworthy changes in version @samp{1.2.2}
@itemize @bullet
@item Corrections to some editors to not change seslection if connection is in progress.
@item Force menu style to NSNextStepInterfaceStyle for editing purposes.
@item Correction for memory issue when closing document.
@item Minor bug fixes.
@item Moved to GPLv3
@item Added text field to NSTableColumn inspector to allow editing of table column title.
@item Corrected issue with selection.
@item Added button modifiers for special keys to button inspectors.
@item Corrected issue with loading of older gorm files.
@item Fix to allow Gorm's menus to be Mac-style, but not the one being edited.
@item Other miscellaneous bug corrections.
@end itemize
@ifclear ANNOUNCE-ONLY
@c ====================================================================
@c Keep the next line just below the list of changes in most recent version.
@section Noteworthy changes in version @samp{1.2.0}
@itemize @bullet
@item Corrections to some editors to not change selection if connection is in progress.
@item Force menu style to NSNextStepInterfaceStyle for editing purposes.
@item Correction for memory issue when closing document.
@item Minor bug fixes.
@end itemize
@section Noteworthy changes in version @samp{1.1.0}
@itemize @bullet

View file

@ -19,9 +19,7 @@ Foundation.
Gorm is released under the GPL - see the file `COPYING' for details.
Little documentation exists. There is a nice basic tutorial
at @url{http://www.sophos.ca/~ludovic/article/article.html}.
Documentation for Gorm is located in the Documentation directory. It's also available on the wiki at http://wiki.gnustep.org/index.php/Gorm_Manual.
@section Status
@ -31,7 +29,8 @@ major functionality is now implemented. Please report bugs to bug-gnustep@@gnu.
Known problems (things to do) -
@enumerate
@item Documentation - only a tiny start has been made on this!
@item Support for IB 3.0 functionality.
@item More palettes.
@end enumerate
@section Acknowledgements

View file

@ -12,7 +12,12 @@
Outlets = (
tagText,
shortCut,
titleText
titleText,
altBtn,
ctrlBtn,
shiftBtn,
cmdBtn,
keyPopup
);
Super = IBInspector;
};

View file

@ -36,13 +36,18 @@
#include <InterfaceBuilder/IBInspector.h>
@class NSTextField;
@class NSTextField, NSPopUpButton;
@interface GormMenuItemAttributesInspector : IBInspector
{
NSTextField *titleText;
NSTextField *shortCut;
NSTextField *tagText;
NSPopUpButton *keyPopup;
id altBtn;
id ctrlBtn;
id shiftBtn;
id cmdBtn;
}
@end

View file

@ -30,14 +30,21 @@
Author : Fabien Vallon <fabien@sonappart.net>
*/
#include "GormMenuItemAttributesInspector.h"
#include <Foundation/Foundation.h>
#include <AppKit/AppKit.h>
#include <Foundation/NSNotification.h>
const unichar up[]={NSUpArrowFunctionKey};
const unichar dn[]={NSDownArrowFunctionKey};
const unichar lt[]={NSLeftArrowFunctionKey};
const unichar rt[]={NSRightArrowFunctionKey};
#include <AppKit/NSMenuItem.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSTextField.h>
NSString *upString = nil;
NSString *dnString = nil;
NSString *ltString = nil;
NSString *rtString = nil;
#define VSTR(str) ({NSString *_str = (NSString *)str; ((NSString *)_str) ? (NSString *)_str : (NSString *)@"";})
@implementation GormMenuItemAttributesInspector
@ -52,18 +59,96 @@
NSLog(@"Could not gorm GormMenuItemAttributesInspector");
return nil;
}
// initialize the strings.
upString = RETAIN([NSString stringWithCharacters: up length: 1]);
dnString = RETAIN([NSString stringWithCharacters: dn length: 1]);
ltString = RETAIN([NSString stringWithCharacters: lt length: 1]);
rtString = RETAIN([NSString stringWithCharacters: rt length: 1]);
return self;
}
- (void) dealloc
{
RELEASE(upString);
RELEASE(dnString);
RELEASE(ltString);
RELEASE(rtString);
[super dealloc];
}
- (void) revert : (id)sender
{
unsigned int flags = [object keyEquivalentModifierMask];
NSString *key = VSTR([object keyEquivalent]);
if ( object == nil )
return;
[titleText setStringValue: [object title]];
[shortCut setStringValue: [object keyEquivalent]];
[titleText setStringValue: VSTR([object title])];
[shortCut setStringValue: key];
[tagText setIntValue: [object tag]];
if([key isEqualToString: @"\n"])
{
[keyPopup selectItemAtIndex: 1];
}
else if([key isEqualToString: @"\b"])
{
[keyPopup selectItemAtIndex: 2];
}
else if([key isEqualToString: @"\E"])
{
[keyPopup selectItemAtIndex: 3];
}
else if([key isEqualToString: @"\t"])
{
[keyPopup selectItemAtIndex: 4];
}
else if([key isEqualToString: upString])
{
[keyPopup selectItemAtIndex: 5];
}
else if([key isEqualToString: dnString])
{
[keyPopup selectItemAtIndex: 6];
}
else if([key isEqualToString: ltString])
{
[keyPopup selectItemAtIndex: 7];
}
else if([key isEqualToString: rtString])
{
[keyPopup selectItemAtIndex: 8];
}
else
{
[keyPopup selectItem: nil];
}
// key modifier mask...
[altBtn setState: NSOffState];
[ctrlBtn setState: NSOffState];
[shiftBtn setState: NSOffState];
[cmdBtn setState: NSOffState];
if(flags & NSAlternateKeyMask)
{
[altBtn setState: NSOnState];
}
if(flags & NSControlKeyMask)
{
[ctrlBtn setState: NSOnState];
}
if(flags & NSShiftKeyMask)
{
[shiftBtn setState: NSOnState];
}
if(flags & NSCommandKeyMask)
{
[cmdBtn setState: NSOnState];
}
}
-(void) ok: (id) sender
@ -74,12 +159,122 @@
}
if (sender == shortCut)
{
[object setKeyEquivalent:[[shortCut stringValue]stringByTrimmingSpaces]];
[object setKeyEquivalent:[[shortCut stringValue] stringByTrimmingSpaces]];
}
if (sender == tagText)
{
[object setTag: [tagText intValue]];
}
else if (sender == keyPopup)
{
unsigned int tag = [[keyPopup selectedItem] tag];
switch(tag)
{
case 0: // none
{
[object setKeyEquivalent: nil];
}
break;
case 1: // return
{
[object setKeyEquivalent: @"\n"];
}
break;
case 2: // delete
{
[object setKeyEquivalent: @"\b"];
}
break;
case 3: // escape
{
[object setKeyEquivalent: @"\E"];
}
break;
case 4: // tab
{
[object setKeyEquivalent: @"\t"];
}
break;
case 5: // up
{
[object setKeyEquivalent: upString];
}
break;
case 6: // down
{
[object setKeyEquivalent: dnString];
}
break;
case 7: // left
{
[object setKeyEquivalent: ltString];
}
break;
case 8: // right
{
[object setKeyEquivalent: rtString];
}
break;
default: // should never happen..
{
[object setKeyEquivalent: nil];
NSLog(@"This shouldn't happen.");
}
break;
}
}
else if (sender == altBtn)
{
if([altBtn state] == NSOnState)
{
[object setKeyEquivalentModifierMask:
[object keyEquivalentModifierMask] | NSAlternateKeyMask];
}
else
{
[object setKeyEquivalentModifierMask:
[object keyEquivalentModifierMask] & ~NSAlternateKeyMask];
}
}
else if (sender == ctrlBtn)
{
if([ctrlBtn state] == NSOnState)
{
[object setKeyEquivalentModifierMask:
[object keyEquivalentModifierMask] | NSControlKeyMask];
}
else
{
[object setKeyEquivalentModifierMask:
[object keyEquivalentModifierMask] & ~NSControlKeyMask];
}
}
else if (sender == shiftBtn)
{
if([shiftBtn state] == NSOnState)
{
[object setKeyEquivalentModifierMask:
[object keyEquivalentModifierMask] | NSShiftKeyMask];
}
else
{
[object setKeyEquivalentModifierMask:
[object keyEquivalentModifierMask] & ~NSShiftKeyMask];
}
}
else if (sender == cmdBtn)
{
if([cmdBtn state] == NSOnState)
{
[object setKeyEquivalentModifierMask:
[object keyEquivalentModifierMask] | NSCommandKeyMask];
}
else
{
[object setKeyEquivalentModifierMask:
[object keyEquivalentModifierMask] & ~NSCommandKeyMask];
}
}
[super ok:sender];
}

View file

@ -32,7 +32,7 @@
#include "GormButtonAttributesInspector.h"
/* This macro makes sure that the string contains a value, even if @"" */
#define VSTR(str) ({id _str = str; (_str) ? _str : @"";})
#define VSTR(str) ({NSString *_str = (NSString *)str; ((NSString *)_str) ? (NSString *)_str : (NSString *)@"";})
const unichar up[]={NSUpArrowFunctionKey};
const unichar dn[]={NSDownArrowFunctionKey};
@ -318,7 +318,7 @@ NSString *rtString = nil;
[alignMatrix selectCellWithTag: [object alignment]];
[iconMatrix selectCellWithTag: [object imagePosition]];
[[keyForm cellAtIndex: 0] setStringValue: VSTR([object keyEquivalent])];
[[keyForm cellAtIndex: 0] setStringValue: key];
if([key isEqualToString: @"\n"])
{