Integrated the text finder into the menu structure and cleaned up some parts

of the code related to menus.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@12398 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Philippe C.D. Robert 2002-02-03 16:31:24 +00:00
parent c325a04f64
commit 6f74df7b63
5 changed files with 44 additions and 16 deletions

View file

@ -34,6 +34,9 @@
- (void)showInspector:(id)sender;
- (void)showBuildPanel:(id)sender;
- (void)showFindPanel:(id)sender;
- (void)findNext:(id)sender;
- (void)findPrevious:(id)sender;
- (void)openProject:(id)sender;
- (void)newProject:(id)sender;

View file

@ -28,7 +28,9 @@
#import "PCMenuController.h"
#import "PCPrefController.h"
#import "PCInfoController.h"
#import <ProjectCenter/PCProjectManager.h>
#import <ProjectCenter/PCTextFinder.h>
@implementation PCAppController (MenuHandling)
@ -47,11 +49,26 @@
[projectManager showInspectorForProject:[projectManager activeProject]];
}
- (void)showBuildPanel:(id)sender;
- (void)showBuildPanel:(id)sender
{
[[projectManager activeProject] showBuildView:self];
}
- (void)showFindPanel:(id)sender
{
[[PCTextFinder sharedFinder] showFindPanel:self];
}
- (void)findNext:(id)sender
{
[[PCTextFinder sharedFinder] findNext:self];
}
- (void)findPrevious:(id)sender
{
[[PCTextFinder sharedFinder] findPrevious:self];
}
- (void)openProject:(id)sender
{
[menuController openProject:sender];

View file

@ -231,7 +231,7 @@
if( [poq isEqualToString:@"YES"] )
{
if (NSRunAlertPanel(@"Quit!",
@"Do you really want to quit?",
@"Do you really want to quit ProjectCenter?",
@"No", @"Yes", nil)) {
return NO;
}

View file

@ -332,6 +332,16 @@
if ([[menuItem title] isEqualToString:@"Rename"]) return NO;
}
if ([[menuItem title] isEqualToString:@"Find Next"])
{
if( ![[[PCTextFinder sharedFinder] findPanel] isVisible] ) return NO;
}
if ([[menuItem title] isEqualToString:@"Find Previous"])
{
if( ![[[PCTextFinder sharedFinder] findPanel] isVisible] ) return NO;
}
return YES;
}

View file

@ -54,9 +54,9 @@ void createMenu()
NSMenu *project;
NSMenu *file;
NSMenu *edit;
NSMenu *format;
NSMenu *fontmenu;
NSMenu *tools;
NSMenu *find;
NSMenu *services;
NSMenu *windows;
@ -72,7 +72,6 @@ void createMenu()
[menu addItemWithTitle:@"Project" action:action keyEquivalent:@""];
[menu addItemWithTitle:@"File" action:action keyEquivalent:@""];
[menu addItemWithTitle:@"Edit" action:action keyEquivalent:@""];
[menu addItemWithTitle:@"Format" action:action keyEquivalent:@""];
[menu addItemWithTitle:@"Tools" action:action keyEquivalent:@""];
[menu addItemWithTitle:@"Windows" action:action keyEquivalent:@""];
[menu addItemWithTitle:@"Services" action:action keyEquivalent:@""];
@ -145,17 +144,6 @@ void createMenu()
action: @selector(selectAll:)
keyEquivalent: @"a"];
/*
* Format submenu
*/
format = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu:format forItem:[menu itemWithTitle:@"Format"]];
[format addItemWithTitle:@"Fonts" action:NULL keyEquivalent:@""];
fontmenu = [[[NSMenu alloc] init] autorelease];
[format setSubmenu:[[NSFontManager sharedFontManager] fontMenu: YES] forItem:[format itemWithTitle:@"Fonts"]];
/*
* Tools submenu
*/
@ -163,8 +151,18 @@ void createMenu()
tools = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu:tools forItem:[menu itemWithTitle:@"Tools"]];
[tools addItemWithTitle:@"Build Panel" action:@selector(showBuildPanel:) keyEquivalent:@""];
[tools addItemWithTitle:@"Find Panel" action:@selector(showFindPanel:) keyEquivalent:@"F"];
[tools addItemWithTitle:@"Inspector Panel" action:@selector(showInspector:) keyEquivalent:@""];
[tools addItemWithTitle:@"Find" action:action keyEquivalent:@""];
/*
* Find submenu
*/
find = [[[NSMenu alloc] init] autorelease];
[tools setSubmenu:find forItem:[tools itemWithTitle:@"Find"]];
[find addItemWithTitle:@"Find Panel..." action:@selector(showFindPanel:) keyEquivalent:@"f"];
[find addItemWithTitle:@"Find Next" action:@selector(findNext:) keyEquivalent:@"g"];
[find addItemWithTitle:@"Find Previous" action:@selector(findPrevious:) keyEquivalent:@"d"];
/*
* Windows submenu