Revision: 4390
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4390&view=rev
Author:   hofman
Date:     2008-08-12 17:43:21 +0000 (Tue, 12 Aug 2008)

Log Message:
-----------
Assume 1-based line numbers for pdfsync/synctex support. At least some editors 
expect this.

Modified Paths:
--------------
    trunk/SKPDFSyncRecord.m
    trunk/SKPDFSynchronizer.m

Modified: trunk/SKPDFSyncRecord.m
===================================================================
--- trunk/SKPDFSyncRecord.m     2008-08-12 16:25:42 UTC (rev 4389)
+++ trunk/SKPDFSyncRecord.m     2008-08-12 17:43:21 UTC (rev 4390)
@@ -47,7 +47,7 @@
         pageIndex = NSNotFound;
         point = NSZeroPoint;
         file = nil;
-        line = -1;
+        line = 0;
     }
     return self;
 }

Modified: trunk/SKPDFSynchronizer.m
===================================================================
--- trunk/SKPDFSynchronizer.m   2008-08-12 16:25:42 UTC (rev 4389)
+++ trunk/SKPDFSynchronizer.m   2008-08-12 17:43:21 UTC (rev 4390)
@@ -389,7 +389,7 @@
                             [sc scanInt:NULL];
                             record = [records recordForIndex:recordIndex];
                             [record setFile:file];
-                            [record setLine:line];
+                            [record setLine:line + 1];
                             [[lines objectForKey:file] addObject:record];
                         }
                     } else if (ch == 'p') {
@@ -464,7 +464,7 @@
         NSEnumerator *recordEnum = [[pages objectAtIndex:pageIndex] 
objectEnumerator];
         
         while (record = [recordEnum nextObject]) {
-            if ([record line] == -1)
+            if ([record line] == 0)
                 continue;
             NSPoint p = [record point];
             if (p.y > NSMaxY(rect)) {
@@ -597,7 +597,7 @@
     if (synctex_edit_query(scanner, (int)pageIndex + 1, point.x, 
NSMaxY(bounds) - point.y) > 0) {
         synctex_node_t node = synctex_next_result(scanner);
         if (node) {
-            *line = synctex_node_line(node) - 1;
+            *line = synctex_node_line(node);
             *file = SKTeXSourceFile([(NSString 
*)CFStringCreateWithFileSystemRepresentation(NULL, 
synctex_scanner_get_name(scanner, synctex_node_tag(node))) autorelease], [[self 
syncFileName] stringByDeletingLastPathComponent]);
             rv = YES;
         }
@@ -608,7 +608,7 @@
 - (BOOL)synctexFindPage:(unsigned int *)pageIndex location:(NSPoint *)point 
forLine:(int)line inFile:(NSString *)file {
     BOOL rv = NO;
     NSString *filename = [filenames objectForKey:file] ?: [file 
lastPathComponent];
-    if (synctex_display_query(scanner, [filename fileSystemRepresentation], 
line + 1, 0) > 0) {
+    if (synctex_display_query(scanner, [filename fileSystemRepresentation], 
line, 0) > 0) {
         synctex_node_t node = synctex_next_result(scanner);
         if (node) {
             unsigned int page = synctex_node_page(node);
@@ -653,7 +653,7 @@
 
 - (oneway void)serverFindFileAndLineForLocation:(NSPoint)point 
inRect:(NSRect)rect pageBounds:(NSRect)bounds atPageIndex:(unsigned 
int)pageIndex {
     if ([self shouldKeepRunning] && [self parseSyncFileIfNeeded]) {
-        int foundLine = -1;
+        int foundLine = 0;
         NSString *foundFile = nil;
         BOOL success = NO;
         


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

Reply via email to