Revision: 4339
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4339&view=rev
Author:   hofman
Date:     2008-08-02 23:55:43 +0000 (Sat, 02 Aug 2008)

Log Message:
-----------
Use a dictionary to translate between full tex paths and filenames used by 
synctex parser to pass filenames to the synctex parser.

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

Modified: trunk/SKPDFSynchronizer.h
===================================================================
--- trunk/SKPDFSynchronizer.h   2008-08-02 23:33:14 UTC (rev 4338)
+++ trunk/SKPDFSynchronizer.h   2008-08-02 23:55:43 UTC (rev 4339)
@@ -48,6 +48,7 @@
     NSMutableArray *pages;
     NSMutableDictionary *lines;
     
+    NSMutableDictionary *filenames;
     synctex_scanner_t scanner;
     
     id delegate;

Modified: trunk/SKPDFSynchronizer.m
===================================================================
--- trunk/SKPDFSynchronizer.m   2008-08-02 23:33:14 UTC (rev 4338)
+++ trunk/SKPDFSynchronizer.m   2008-08-02 23:55:43 UTC (rev 4339)
@@ -101,6 +101,7 @@
         pages = [[NSMutableArray alloc] init];
         lines = [[NSMutableDictionary alloc] init];
         
+        filenames = [[NSMutableDictionary alloc] init];
         scanner = NULL;
         
         NSPort *port1 = [NSPort port];
@@ -139,6 +140,7 @@
     NSZoneFree(NSDefaultMallocZone(), serverFlags);
     [pages release];
     [lines release];
+    [filenames release];
     [fileName release];
     [syncFileName release];
     [lastModDate release];
@@ -563,6 +565,15 @@
         synctex_scanner_free(scanner);
     if (scanner = synctex_scanner_new_with_output_file([theFileName 
fileSystemRepresentation])) {
         [self 
setSyncFileName:SKPathFromFileSystemRepresentation(synctex_scanner_get_synctex(scanner))];
+        [filenames removeAllObjects];
+        NSString *theFileName = [self fileName];
+        NSString *file, *filename;
+        synctex_node_t node = synctex_scanner_input(scanner);
+        do {
+            filename = 
SKPathFromFileSystemRepresentation(synctex_scanner_get_name(scanner, 
synctex_node_tag(node)));
+            file = SKTeXSourceFile(filename, [theFileName 
stringByDeletingLastPathComponent]);
+            [filenames setObject:filename forKey:file];
+        } while (node = synctex_node_next(node));
         isPdfsync = NO;
         rv = [self shouldKeepRunning];
     }
@@ -584,7 +595,10 @@
 
 - (BOOL)synctexFindPage:(unsigned int *)pageIndex location:(NSPoint *)point 
forLine:(int)line inFile:(NSString *)file {
     BOOL rv = NO;
-    if (synctex_display_query(scanner, [[file lastPathComponent] 
fileSystemRepresentation], line, 0) > 0) {
+    NSString *filename = [filenames objectForKey:file];
+    if (filename == nil)
+        filename = [file lastPathComponent];
+    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);


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