mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 18:30:47 +00:00
Add new X secondary selection behaviour.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@26004 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fe86875d7e
commit
49399cb0c5
2 changed files with 67 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2008-01-26 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/NSTextView.m (-copySelection, -pasteSelection): Add new X
|
||||||
|
secondary selection behaviour.
|
||||||
|
See http://www.freedesktop.org/wiki/Specifications/ClipboardsWiki
|
||||||
|
|
||||||
2008-01-19 Fred Kiefer <FredKiefer@gmx.de>
|
2008-01-19 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/GSFontInfo.m:
|
* Source/GSFontInfo.m:
|
||||||
|
|
|
@ -5042,16 +5042,73 @@ configuation! */
|
||||||
special section pasteboard */
|
special section pasteboard */
|
||||||
- (void) copySelection
|
- (void) copySelection
|
||||||
{
|
{
|
||||||
[self writeSelectionToPasteboard: [NSPasteboard pasteboardWithName: @"Selection"]
|
#if 1
|
||||||
type: NSStringPboardType];
|
NSString *newSelection;
|
||||||
|
NSString *oldSelection;
|
||||||
|
NSRange range = _layoutManager->_selected_range;
|
||||||
|
|
||||||
|
if (range.location != NSNotFound && range.length != 0)
|
||||||
|
{
|
||||||
|
newSelection = [[self string] substringWithRange: range];
|
||||||
|
oldSelection = [[NSPasteboard pasteboardWithName: @"Selection"]
|
||||||
|
stringForType: NSStringPboardType];
|
||||||
|
|
||||||
|
if (oldSelection != nil &&
|
||||||
|
![newSelection isEqualToString: oldSelection])
|
||||||
|
{
|
||||||
|
NSPasteboard *secondary;
|
||||||
|
|
||||||
|
secondary = [NSPasteboard pasteboardWithName: @"Secondary"];
|
||||||
|
[secondary declareTypes: [NSArray arrayWithObject: NSStringPboardType]
|
||||||
|
owner: self];
|
||||||
|
[secondary setString: oldSelection
|
||||||
|
forType: NSStringPboardType];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
[self writeSelectionToPasteboard:
|
||||||
|
[NSPasteboard pasteboardWithName: @"Selection"]
|
||||||
|
type: NSStringPboardType];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Extension method that pastes the current selected text from the
|
/** Extension method that pastes the current selected text from the
|
||||||
special section pasteboard */
|
special section pasteboard */
|
||||||
- (void) pasteSelection
|
- (void) pasteSelection
|
||||||
{
|
{
|
||||||
[self readSelectionFromPasteboard: [NSPasteboard pasteboardWithName: @"Selection"]
|
#if 1
|
||||||
type: NSStringPboardType];
|
NSString *newSelection;
|
||||||
|
NSString *oldSelection;
|
||||||
|
NSRange range = _layoutManager->_selected_range;
|
||||||
|
|
||||||
|
if (range.location != NSNotFound && range.length != 0)
|
||||||
|
{
|
||||||
|
newSelection = [[self string] substringWithRange: range];
|
||||||
|
oldSelection = [[NSPasteboard pasteboardWithName: @"Selection"]
|
||||||
|
stringForType: NSStringPboardType];
|
||||||
|
|
||||||
|
if (oldSelection != nil &&
|
||||||
|
[newSelection isEqualToString: oldSelection])
|
||||||
|
{
|
||||||
|
[self readSelectionFromPasteboard:
|
||||||
|
[NSPasteboard pasteboardWithName: @"Secondary"]
|
||||||
|
type: NSStringPboardType];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
[self readSelectionFromPasteboard:
|
||||||
|
[NSPasteboard pasteboardWithName: @"Selection"]
|
||||||
|
type: NSStringPboardType];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue