mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Added functionality to copy the text content of the info panel
to the pasteboard. Fixes #23831. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@26838 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
31293f108c
commit
829457697a
2 changed files with 54 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
2008-09-08 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/GSInfoPanel.m (-keyDown:, -copy:): Added functionality to
|
||||
copy the text content of the info panel to the pasteboard.
|
||||
Fixes #23831.
|
||||
|
||||
2008-09-08 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSSavePanel.m (-browser:createRowsForColumn:inMatrix:):
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <Foundation/NSBundle.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSEnumerator.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSProcessInfo.h>
|
||||
|
||||
|
@ -37,6 +38,7 @@
|
|||
#include "AppKit/NSFont.h"
|
||||
#include "AppKit/NSImage.h"
|
||||
#include "AppKit/NSImageView.h"
|
||||
#include "AppKit/NSPasteboard.h"
|
||||
#include "AppKit/NSTextField.h"
|
||||
#include "GNUstepGUI/GSInfoPanel.h"
|
||||
#include "GNUstepGUI/GSTheme.h"
|
||||
|
@ -656,4 +658,50 @@ new_label (NSString *value)
|
|||
return self;
|
||||
}
|
||||
|
||||
- (void) copy: (id)sender
|
||||
{
|
||||
NSArray *types = [NSArray arrayWithObject: NSStringPboardType];
|
||||
NSPasteboard *pboard = [NSPasteboard generalPasteboard];
|
||||
NSMutableString *text = [[NSMutableString alloc] init];
|
||||
NSView *cv = [self contentView];
|
||||
NSEnumerator *enumerator = [[cv subviews] objectEnumerator];
|
||||
NSView *subview;
|
||||
|
||||
// Loop over all the text subviews and collect the information
|
||||
while ((subview = [enumerator nextObject]) != nil)
|
||||
{
|
||||
if ([subview isKindOfClass: [NSTextField class]])
|
||||
{
|
||||
[text appendString: [(NSTextField*)subview stringValue]];
|
||||
[text appendString: @"\n"];
|
||||
}
|
||||
}
|
||||
|
||||
[pboard declareTypes: types owner: self];
|
||||
[pboard setString: text
|
||||
forType: NSStringPboardType];
|
||||
RELEASE(text);
|
||||
}
|
||||
|
||||
- (void) keyDown: (NSEvent*)theEvent
|
||||
{
|
||||
NSString *characters = [theEvent characters];
|
||||
unichar character = 0;
|
||||
|
||||
if ([characters length] > 0)
|
||||
{
|
||||
character = [characters characterAtIndex: 0];
|
||||
}
|
||||
|
||||
// FIXME: Hard coded
|
||||
if (character == 'c' &&
|
||||
[theEvent modifierFlags] & NSCommandKeyMask)
|
||||
{
|
||||
[self copy: nil];
|
||||
return;
|
||||
}
|
||||
|
||||
[super keyDown: theEvent];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue