Revision: 4728
http://skim-app.svn.sourceforge.net/skim-app/?rev=4728&view=rev
Author: hofman
Date: 2008-10-03 09:38:32 +0000 (Fri, 03 Oct 2008)
Log Message:
-----------
Edit note in table when possible from contextual menu in note table
Modified Paths:
--------------
trunk/SKMainWindowController_UI.m
Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m 2008-10-02 16:17:07 UTC (rev 4727)
+++ trunk/SKMainWindowController_UI.m 2008-10-03 09:38:32 UTC (rev 4728)
@@ -823,6 +823,17 @@
[self outlineView:noteOutlineView copyItems:[sender representedObject]];
}
+- (void)editNoteFromTable:(id)sender {
+ PDFAnnotation *annotation = [sender representedObject];
+ int row = [noteOutlineView rowForItem:annotation];
+ [noteOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:row]
byExtendingSelection:NO];
+ [noteOutlineView editColumn:0 row:row withEvent:nil select:YES];
+}
+
+- (void)deselectNote:(id)sender {
+ [pdfView setActiveAnnotation:nil];
+}
+
- (void)selectNote:(id)sender {
PDFAnnotation *annotation = [sender representedObject];
[pdfView scrollAnnotationToVisible:annotation];
@@ -834,10 +845,6 @@
[pdfView scrollAnnotationToVisible:annotation];
}
-- (void)deselectNote:(id)sender {
- [pdfView setActiveAnnotation:nil];
-}
-
- (void)autoSizeNoteRows:(id)sender {
float rowHeight = [noteOutlineView rowHeight];
NSTableColumn *tableColumn = [noteOutlineView
tableColumnWithIdentifier:SKMainWindowNoteColumnIdentifer];
@@ -900,22 +907,22 @@
menuItem = [menu addItemWithTitle:NSLocalizedString(@"Copy",
@"Menu item title") action:@selector(copyNotes:) target:self];
[menuItem setRepresentedObject:items];
}
- if ([pdfView hideNotes] == NO) {
- NSArray *noteItems = [self noteItems:items];
- if ([noteItems count] == 1) {
- PDFAnnotation *annotation = [noteItems lastObject];
- if ([annotation isEditable]) {
+ if ([pdfView hideNotes] == NO && [items count] == 1) {
+ PDFAnnotation *annotation = [[self noteItems:items] lastObject];
+ if ([annotation isEditable]) {
+ if ([[items lastObject] type])
+ menuItem = [menu
addItemWithTitle:NSLocalizedString(@"Edit", @"Menu item title")
action:@selector(editNoteFromTable:) target:self];
+ else
menuItem = [menu
addItemWithTitle:NSLocalizedString(@"Edit", @"Menu item title")
action:@selector(editThisAnnotation:) target:pdfView];
- [menuItem setRepresentedObject:annotation];
- }
- if ([pdfView activeAnnotation] == annotation)
- menuItem = [menu
addItemWithTitle:NSLocalizedString(@"Deselect", @"Menu item title")
action:@selector(deselectNote:) target:self];
- else
- menuItem = [menu
addItemWithTitle:NSLocalizedString(@"Select", @"Menu item title")
action:@selector(selectNote:) target:self];
[menuItem setRepresentedObject:annotation];
- menuItem = [menu addItemWithTitle:NSLocalizedString(@"Show",
@"Menu item title") action:@selector(revealNote:) target:self];
- [menuItem setRepresentedObject:annotation];
}
+ if ([pdfView activeAnnotation] == annotation)
+ menuItem = [menu
addItemWithTitle:NSLocalizedString(@"Deselect", @"Menu item title")
action:@selector(deselectNote:) target:self];
+ else
+ menuItem = [menu addItemWithTitle:NSLocalizedString(@"Select",
@"Menu item title") action:@selector(selectNote:) target:self];
+ [menuItem setRepresentedObject:annotation];
+ menuItem = [menu addItemWithTitle:NSLocalizedString(@"Show",
@"Menu item title") action:@selector(revealNote:) target:self];
+ [menuItem setRepresentedObject:annotation];
}
if ([menu numberOfItems] > 0)
[menu addItem:[NSMenuItem separatorItem]];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit