mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Add support for a recent documents menu in gorm documents.
Add a recent documents menu to the file menu and undo and redo commands to the edit menu in Gorm's palette. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@30465 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1aa1b64dc4
commit
b8cc207f46
7 changed files with 88 additions and 3 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2010-05-28 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* GormCore/GormDocument.h:
|
||||
* GormCore/GormDocument.m:
|
||||
* Palettes/0Menus/GormMenuAttributesInspector.m:
|
||||
* Palettes/0Menus/GormMenuAttributesInspector.gorm:
|
||||
Add support for a recent documents menu in gorm documents.
|
||||
|
||||
* Palettes/0Menus/MenusPalette.m:
|
||||
Add a recent documents menu to the palette's file menu.
|
||||
Add undo and redo commands to the palette's edit menu.
|
||||
|
||||
2010-05-22 02:23-EDT Gregory John Casamento <greg.casamento@gmail.com>
|
||||
|
||||
* English.lproj/GormPreferences.gorm: Correct issue with pop up
|
||||
|
|
|
@ -291,6 +291,16 @@
|
|||
*/
|
||||
- (NSMenu *) windowsMenu;
|
||||
|
||||
/**
|
||||
* Sets the recent documents menu.
|
||||
*/
|
||||
- (void) setRecentDocumentsMenu: (NSMenu *)menu;
|
||||
|
||||
/**
|
||||
* Returns the menu which will be the recent documents menu for the document.
|
||||
*/
|
||||
- (NSMenu *) recentDocumentsMenu;
|
||||
|
||||
/*** first responder/font manager ***/
|
||||
|
||||
/**
|
||||
|
|
|
@ -711,6 +711,10 @@ static NSImage *fileImage = nil;
|
|||
{
|
||||
[self setWindowsMenu: menu];
|
||||
}
|
||||
else if([[menu title] isEqual: @"Open Recent"] && [self recentDocumentsMenu] == nil)
|
||||
{
|
||||
[self setRecentDocumentsMenu: menu];
|
||||
}
|
||||
}
|
||||
|
||||
// add all of the items in the menu.
|
||||
|
@ -1340,6 +1344,10 @@ static NSImage *fileImage = nil;
|
|||
{
|
||||
[self setServicesMenu: nil];
|
||||
}
|
||||
else if([self recentDocumentsMenu] == anObject)
|
||||
{
|
||||
[self setRecentDocumentsMenu: nil];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2296,6 +2304,29 @@ static void _real_close(GormDocument *self,
|
|||
return [nameTable objectForKey: @"NSServicesMenu"];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the menu that will be the recent documents menu in the app.
|
||||
*/
|
||||
- (void) setRecentDocumentsMenu: (NSMenu *)anObject
|
||||
{
|
||||
if(anObject != nil)
|
||||
{
|
||||
[nameTable setObject: anObject forKey: @"NSRecentDocumentsMenu"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[nameTable removeObjectForKey: @"NSRecentDocumentsMenu"];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the object that will be the receent documents menu.
|
||||
*/
|
||||
- (NSMenu *) recentDocumentsMenu
|
||||
{
|
||||
return [nameTable objectForKey: @"NSRecentDocumentsMenu"];
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks this document as the currently active document. The active document is
|
||||
* the one being edited by the user.
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -44,9 +44,10 @@
|
|||
#include <AppKit/NSTextField.h>
|
||||
|
||||
|
||||
#define WINDOWSMENUTAG 0
|
||||
#define SERVICESMENUTAG 1
|
||||
#define NORMALMENUTAG 2
|
||||
#define WINDOWSMENUTAG 0
|
||||
#define SERVICESMENUTAG 1
|
||||
#define RECENTDOCUMENTSMENUTAG 2
|
||||
#define NORMALMENUTAG 3
|
||||
|
||||
@implementation GormMenuAttributesInspector
|
||||
|
||||
|
@ -89,12 +90,16 @@
|
|||
[doc setWindowsMenu:object];
|
||||
if ( [doc servicesMenu] == object )
|
||||
[doc setServicesMenu: nil];
|
||||
else if ( [doc recentDocumentsMenu] == object )
|
||||
[doc setRecentDocumentsMenu: nil];
|
||||
break;
|
||||
|
||||
case SERVICESMENUTAG:
|
||||
[doc setServicesMenu: object];
|
||||
if ( [doc windowsMenu] == object )
|
||||
[doc setWindowsMenu: nil];
|
||||
else if ( [doc recentDocumentsMenu] == object )
|
||||
[doc setRecentDocumentsMenu: nil];
|
||||
break;
|
||||
|
||||
case NORMALMENUTAG:
|
||||
|
@ -103,6 +108,14 @@
|
|||
if ( [doc servicesMenu] == object )
|
||||
[doc setServicesMenu: nil];
|
||||
break;
|
||||
|
||||
case RECENTDOCUMENTSMENUTAG:
|
||||
[doc setRecentDocumentsMenu:object];
|
||||
if ( [doc servicesMenu] == object )
|
||||
[doc setServicesMenu: nil];
|
||||
else if ( [doc windowsMenu] == object )
|
||||
[doc setWindowsMenu: nil];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,6 +145,10 @@
|
|||
{
|
||||
[menuType selectCellAtRow:SERVICESMENUTAG column: 0];
|
||||
}
|
||||
else if([doc recentDocumentsMenu] == object)
|
||||
{
|
||||
[menuType selectCellAtRow:RECENTDOCUMENTSMENUTAG column: 0];
|
||||
}
|
||||
else
|
||||
{
|
||||
[menuType selectCellAtRow:NORMALMENUTAG column: 0];
|
||||
|
|
|
@ -168,6 +168,15 @@
|
|||
[m addItemWithTitle: @"Open..."
|
||||
action: @selector(openDocument:)
|
||||
keyEquivalent: @"o"];
|
||||
i = (NSMenuItem *)[m addItemWithTitle: @"Open Recent"
|
||||
action: NULL
|
||||
keyEquivalent: @""];
|
||||
s = [[GormNSMenu alloc] init];
|
||||
[s addItemWithTitle: @"Clear List"
|
||||
action: @selector(clearRecentDocuments:)
|
||||
keyEquivalent: @""];
|
||||
[s setTitle: @"Open Recent"];
|
||||
[i setSubmenu: s];
|
||||
[m addItemWithTitle: @"New"
|
||||
action: @selector(newDocument:)
|
||||
keyEquivalent: @"n"];
|
||||
|
@ -255,6 +264,12 @@
|
|||
* The Edit menu
|
||||
*/
|
||||
m = [[GormNSMenu alloc] init];
|
||||
[m addItemWithTitle: @"Undo"
|
||||
action: @selector(undo:)
|
||||
keyEquivalent: @"z"];
|
||||
[m addItemWithTitle: @"Redo"
|
||||
action: @selector(redo:)
|
||||
keyEquivalent: @"Z"];
|
||||
[m addItemWithTitle: @"Cut"
|
||||
action: @selector(cut:)
|
||||
keyEquivalent: @"x"];
|
||||
|
|
Loading…
Reference in a new issue