Revision: 4590
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4590&view=rev
Author:   hofman
Date:     2008-09-09 09:49:51 +0000 (Tue, 09 Sep 2008)

Log Message:
-----------
Define TeX line accessors in NSObject category, so it's available for all 
objects.

Modified Paths:
--------------
    trunk/SKApplicationController.h
    trunk/SKApplicationController.m
    trunk/SKLine.h
    trunk/SKLine.m
    trunk/SKPDFDocument.h
    trunk/SKPDFDocument.m
    trunk/Skim.sdef

Modified: trunk/SKApplicationController.h
===================================================================
--- trunk/SKApplicationController.h     2008-09-09 09:29:53 UTC (rev 4589)
+++ trunk/SKApplicationController.h     2008-09-09 09:49:51 UTC (rev 4590)
@@ -89,7 +89,5 @@
 - (void)setDefaultEndLineStyle:(FourCharCode)style;
 - (FourCharCode)defaultIconType;
 - (void)setDefaultIconType:(FourCharCode)type;
-- (unsigned int)countOfLines;
-- (SKLine *)objectInLinesAtIndex:(unsigned int)index;
 
 @end

Modified: trunk/SKApplicationController.m
===================================================================
--- trunk/SKApplicationController.m     2008-09-09 09:29:53 UTC (rev 4589)
+++ trunk/SKApplicationController.m     2008-09-09 09:49:51 UTC (rev 4590)
@@ -483,7 +483,7 @@
     static NSSet *applicationScriptingKeys = nil;
     if (applicationScriptingKeys == nil)
         applicationScriptingKeys = [[NSSet alloc] 
initWithObjects:@"defaultPdfViewSettings", @"defaultFullScreenPdfViewSettings", 
@"backgroundColor", @"fullScreenBackgroundColor", 
-            @"defaultNoteColors", @"defaultLineWidths", @"defaultLineStyles", 
@"defaultDashPatterns", @"defaultStartLineStyle", @"defaultEndLineStyle", 
@"defaultIconType", @"lines", nil];
+            @"defaultNoteColors", @"defaultLineWidths", @"defaultLineStyles", 
@"defaultDashPatterns", @"defaultStartLineStyle", @"defaultEndLineStyle", 
@"defaultIconType", nil];
        return [applicationScriptingKeys containsObject:key];
 }
 
@@ -666,12 +666,4 @@
     return [[NSUserDefaults standardUserDefaults] 
setInteger:SKIconTypeFromScriptingIconType(type) 
forKey:SKAnchoredNoteIconTypeKey];
 }
 
-- (unsigned int)countOfLines {
-    return UINT_MAX;
-}
-
-- (SKLine *)objectInLinesAtIndex:(unsigned int)anIndex {
-    return [[[SKLine alloc] initWithLine:anIndex] autorelease];
-}
-
 @end

Modified: trunk/SKLine.h
===================================================================
--- trunk/SKLine.h      2008-09-09 09:29:53 UTC (rev 4589)
+++ trunk/SKLine.h      2008-09-09 09:49:51 UTC (rev 4590)
@@ -40,9 +40,15 @@
 
 
 @interface SKLine : NSObject {
-    int line;
+    int index;
 }
-- (id)initWithLine:(int)aLine;
-- (int)line;
+- (id)initWithIndex:(int)anIndex;
 - (int)index;
+- (int)scriptingIndex;
 @end
+
+
[EMAIL PROTECTED] NSObject (SKLine)
+- (unsigned int)countOfLines;
+- (SKLine *)objectInLinesAtIndex:(unsigned int)index;
[EMAIL PROTECTED]

Modified: trunk/SKLine.m
===================================================================
--- trunk/SKLine.m      2008-09-09 09:29:53 UTC (rev 4589)
+++ trunk/SKLine.m      2008-09-09 09:49:51 UTC (rev 4590)
@@ -41,24 +41,37 @@
 
 @implementation SKLine
 
-- (id)initWithLine:(int)aLine {
+- (id)initWithIndex:(int)anIndex {
     if (self = [super init]) {
-        line = aLine;
+        index = anIndex;
     }
     return self;
 }
 
 - (NSScriptObjectSpecifier *)objectSpecifier {
     NSScriptClassDescription *containerClassDescription = 
(NSScriptClassDescription *)[NSClassDescription classDescriptionForClass:[NSApp 
class]];
-    return [[[NSIndexSpecifier allocWithZone:[self zone]] 
initWithContainerClassDescription:containerClassDescription 
containerSpecifier:nil key:@"lines" index:line] autorelease];
+    return [[[NSIndexSpecifier allocWithZone:[self zone]] 
initWithContainerClassDescription:containerClassDescription 
containerSpecifier:nil key:@"lines" index:index] autorelease];
 }
 
-- (int)line {
-    return line;
+- (int)index {
+    return index;
 }
 
-- (int)index {
-    return line + 1;
+- (int)scriptingIndex {
+    return index + 1;
 }
 
 @end
+
+
[EMAIL PROTECTED] NSObject (SKLine)
+
+- (unsigned int)countOfLines {
+    return UINT_MAX;
+}
+
+- (SKLine *)objectInLinesAtIndex:(unsigned int)anIndex {
+    return [[[SKLine alloc] initWithIndex:anIndex] autorelease];
+}
+
[EMAIL PROTECTED]

Modified: trunk/SKPDFDocument.h
===================================================================
--- trunk/SKPDFDocument.h       2008-09-09 09:29:53 UTC (rev 4589)
+++ trunk/SKPDFDocument.h       2008-09-09 09:49:51 UTC (rev 4590)
@@ -129,8 +129,6 @@
 - (void)insertInNotes:(PDFAnnotation *)newNote;
 - (void)insertObject:(PDFAnnotation *)newNote inNotesAtIndex:(unsigned 
int)anIndex;
 - (void)removeObjectFromNotesAtIndex:(unsigned int)anIndex;
-- (unsigned int)countOfLines;
-- (SKLine *)objectInLinesAtIndex:(unsigned int)anIndex;
 - (PDFPage *)currentPage;
 - (void)setCurrentPage:(PDFPage *)page;
 - (id)activeNote;

Modified: trunk/SKPDFDocument.m
===================================================================
--- trunk/SKPDFDocument.m       2008-09-09 09:29:53 UTC (rev 4589)
+++ trunk/SKPDFDocument.m       2008-09-09 09:49:51 UTC (rev 4590)
@@ -1767,14 +1767,6 @@
     [[self undoManager] setActionName:NSLocalizedString(@"Remove Note", @"Undo 
action name")];
 }
 
-- (unsigned int)countOfLines {
-    return UINT_MAX;
-}
-
-- (SKLine *)objectInLinesAtIndex:(unsigned int)anIndex {
-    return [[[SKLine alloc] initWithLine:anIndex] autorelease];
-}
-
 - (PDFPage *)currentPage {
     return [[self pdfView] currentPage];
 }
@@ -1948,7 +1940,7 @@
             source = [NSURL fileURLWithPath:source];
         if ([source isKindOfClass:[NSURL class]] == NO)
             source = [self fileURL];
-        [[self synchronizer] findPageAndLocationForLine:[location line] 
inFile:[[source path] stringByReplacingPathExtension:@"tex"]];
+        [[self synchronizer] findPageAndLocationForLine:[location index] 
inFile:[[source path] stringByReplacingPathExtension:@"tex"]];
     } else {
         PDFSelection *selection = [PDFSelection 
selectionWithSpecifier:location];
         if ([[selection pages] count]) {

Modified: trunk/Skim.sdef
===================================================================
--- trunk/Skim.sdef     2008-09-09 09:29:53 UTC (rev 4589)
+++ trunk/Skim.sdef     2008-09-09 09:49:51 UTC (rev 4590)
@@ -187,6 +187,10 @@
         <class name="window" code="cwin"
             description="A window.">
             <cocoa class="NSWindow"/>
+            <element type="TeX line" access="r" hidden="yes"
+                description="Lines in a TeX source file.">
+                <cocoa key="lines"/>
+            </element>
             <property name="name" code="pnam" type="text" access="r"
                 description="The full title of the window.">
                 <cocoa key="title"/>
@@ -609,6 +613,10 @@
                 description="Notes in the page">
                 <cocoa key="notes"/>
             </element>
+            <element type="TeX line" access="r" hidden="yes"
+                description="Lines in a TeX source file.">
+                <cocoa key="lines"/>
+            </element>
             <contents name="text" code="ctxt" type="rich text" access="r"
                 description="The text of the page.">
                 <cocoa key="richText"/>
@@ -654,6 +662,10 @@
         <class name="note" plural="notes" code="Note"
             description="A note.">
             <cocoa class="PDFAnnotation"/>
+            <element type="TeX line" access="r" hidden="yes"
+                description="Lines in a TeX source file.">
+                <cocoa key="lines"/>
+            </element>
             <property name="type" code="NTyp" type="note type" access="r"
                 description="The type of note.">
                 <cocoa key="scriptingNoteType"/>
@@ -751,7 +763,7 @@
             <cocoa class="SKLine"/>
             <property name="index" code="pidx" type="integer" access="r"
                 description="the line number.">
-                <cocoa key="index"/>
+                <cocoa key="scriptingIndex"/>
             </property>
         </class>
 


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