mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:10:48 +00:00
In [NSApplication showHelp:] added a check for the existence of
the help file. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@10657 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c6b9b319d3
commit
dbcd941040
1 changed files with 25 additions and 8 deletions
|
@ -27,15 +27,15 @@
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gnustep/gui/config.h>
|
|
||||||
#include <AppKit/NSHelpManager.h>
|
|
||||||
#include <Foundation/NSNotification.h>
|
#include <Foundation/NSNotification.h>
|
||||||
|
|
||||||
#include <Foundation/NSFileManager.h>
|
#include <Foundation/NSFileManager.h>
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
#include <Foundation/NSBundle.h>
|
#include <Foundation/NSBundle.h>
|
||||||
#include <AppKit/NSAttributedString.h>
|
#include <AppKit/NSAttributedString.h>
|
||||||
|
#include <AppKit/NSApplication.h>
|
||||||
#include <AppKit/NSWorkspace.h>
|
#include <AppKit/NSWorkspace.h>
|
||||||
|
#include <AppKit/NSHelpManager.h>
|
||||||
|
|
||||||
#include <AppKit/GSHelpManagerPanel.h>
|
#include <AppKit/GSHelpManagerPanel.h>
|
||||||
|
|
||||||
@implementation NSBundle (NSHelpManager)
|
@implementation NSBundle (NSHelpManager)
|
||||||
|
@ -86,9 +86,19 @@
|
||||||
{
|
{
|
||||||
help = [info objectForKey: @"NSExecutable"];
|
help = [info objectForKey: @"NSExecutable"];
|
||||||
// If there's no specification, we look for a file named "appname.rtf"
|
// If there's no specification, we look for a file named "appname.rtf"
|
||||||
[[NSWorkspace sharedWorkspace]
|
|
||||||
openFile: [mb pathForResource: help ofType: @"rtf"]];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (help)
|
||||||
|
{
|
||||||
|
NSString *file = [mb pathForResource: help ofType: @"rtf"];
|
||||||
|
|
||||||
|
if (file)
|
||||||
|
{
|
||||||
|
[[NSWorkspace sharedWorkspace] openFile: file];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NSBeep();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) activateContextHelpMode: (id)sender
|
- (void) activateContextHelpMode: (id)sender
|
||||||
|
@ -199,13 +209,20 @@ static BOOL _gnu_contextHelpActive = NO;
|
||||||
- (BOOL) showContextHelpForObject: (id)object locationHint: (NSPoint) point
|
- (BOOL) showContextHelpForObject: (id)object locationHint: (NSPoint) point
|
||||||
{
|
{
|
||||||
id contextHelp = [self contextHelpForObject: object];
|
id contextHelp = [self contextHelpForObject: object];
|
||||||
|
|
||||||
if (contextHelp)
|
if (contextHelp)
|
||||||
{
|
{
|
||||||
[[GSHelpManagerPanel sharedHelpManagerPanel] setHelpText: contextHelp];
|
GSHelpManagerPanel *helpPanel = [GSHelpManagerPanel sharedHelpManagerPanel];
|
||||||
[NSApp runModalForWindow: [GSHelpManagerPanel sharedHelpManagerPanel]];
|
|
||||||
|
// FIXME: We should position the window at point!
|
||||||
|
// runModalForWindow will centre the window.
|
||||||
|
[helpPanel setHelpText: contextHelp];
|
||||||
|
[NSApp runModalForWindow: helpPanel];
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
else return NO;
|
else
|
||||||
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue