mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 13:01:55 +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
e8748d7d4e
commit
d1f8c59d87
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>
|
2008-09-08 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSSavePanel.m (-browser:createRowsForColumn:inMatrix:):
|
* Source/NSSavePanel.m (-browser:createRowsForColumn:inMatrix:):
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include <Foundation/NSBundle.h>
|
#include <Foundation/NSBundle.h>
|
||||||
#include <Foundation/NSDictionary.h>
|
#include <Foundation/NSDictionary.h>
|
||||||
|
#include <Foundation/NSEnumerator.h>
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
#include <Foundation/NSProcessInfo.h>
|
#include <Foundation/NSProcessInfo.h>
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@
|
||||||
#include "AppKit/NSFont.h"
|
#include "AppKit/NSFont.h"
|
||||||
#include "AppKit/NSImage.h"
|
#include "AppKit/NSImage.h"
|
||||||
#include "AppKit/NSImageView.h"
|
#include "AppKit/NSImageView.h"
|
||||||
|
#include "AppKit/NSPasteboard.h"
|
||||||
#include "AppKit/NSTextField.h"
|
#include "AppKit/NSTextField.h"
|
||||||
#include "GNUstepGUI/GSInfoPanel.h"
|
#include "GNUstepGUI/GSInfoPanel.h"
|
||||||
#include "GNUstepGUI/GSTheme.h"
|
#include "GNUstepGUI/GSTheme.h"
|
||||||
|
@ -656,4 +658,50 @@ new_label (NSString *value)
|
||||||
return self;
|
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
|
@end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue