? .depend
? .sedscr
? ChangeLog
? Makefile
? PalmCUnitRsc.h
? Plucker-sections.ld
? Plucker-sections.s
? Plucker.def
? anchorMargin.zip
? c
? cacheDif
? cc
? change
? config.cache
? config.h
? config.h.in
? config.log
? config.status
? configure
? dictLookup.zip
? document.c.sony
? e
? exactAnchor.diff
? exactAnchor2.diff
? exactAnchor3.diff
? grayfont.c.cache
? grayfont.c.f
? grayfont.c.faster
? grayfont.c.kern
? hires.c.s60
? libraryform.c.checkmark
? libraryform.c.crossedout
? log
? mainform.c.ok
? o
? optLookupDiff
? pa
? ppi
? ppi.tgz
? rotate.c.ok
? rotatebitmap.c.ba
? rotatebitmap.c.fast
? selectword.zip
? selectwordchanges
? silkSmart.zip
? stamp-h.in
? test
? test.html
? trouble
? u
? vfsfile.fix
? viewer
? viewer.diff
? viewer.diff.gz
? viewer.rcp
? viewer.rcp.s
? viewer.ro
? viewer_en.prc
? viewer_en.rcp.s
? ZLib/Makefile
? ZLib/SysZLib.h
? ZLib/zlib.h
? armlets/.depend
? armlets/Makefile
? armlets/code.stamp
? armlets/rotatebitmap
? armlets/search
? cleaner/.depend
? cleaner/.sedscr
? cleaner/Makefile
? cleaner/cleaner
? cleaner/cleaner.rcp
? cleaner/cleaner_en.prc
? fonts/Makefile
? icons/wait_x2-8bpp.bmp
? langs/.depend
? langs/Makefile
? langs/en.rcp.lint
? sony_sdk/Sony SDK Support
? sony_sdk/cliesdk50e.zip
Index: anchor.c
===================================================================
RCS file: /cvs/plucker/plucker_src/viewer/anchor.c,v
retrieving revision 1.57
diff -a -u -r1.57 anchor.c
--- anchor.c	29 Dec 2003 20:44:18 -0000	1.57
+++ anchor.c	23 Jan 2004 15:34:37 -0000
@@ -58,6 +58,8 @@
     UInt16          image;              /* The image to link to */
     Int16           paragraphOffset;    /* The offset to named anchor
                                            paragraph */
+    Int16           byteOffset;         /* The byte offset within the
+                                           paragraph */
     AnchorStateType state;
     Int16           anchorId;
     Boolean         underline;
@@ -84,7 +86,8 @@
 static Boolean AnchorInViewport(AnchorType *anchor) ANCHOR_SECTION;
 static void AnchorCreate(const TextContext *tContext,
                 const UInt16 reference, const UInt16 image,
-                const Int16 offset, const Int16 anchorId) ANCHOR_SECTION;
+                const Int16 paragraphOffset, 
+                const Int16 anchorId) ANCHOR_SECTION;
 
 
 /* initialize new list of anchors */
@@ -149,7 +152,7 @@
     const TextContext*  tContext,   /* pointer to text context */
     const UInt16        reference,  /* record reference */
     const UInt16        image,      /* image reference */
-    const Int16         offset,     /* offset to first paragraph */
+    const Int16         paragraphOffset, /* offset to first paragraph */
     const Int16         anchorId    /* unique ID for anchor */
     )
 {
@@ -166,7 +169,8 @@
     anchor->anchorId            = anchorId;
     anchor->reference           = reference;
     anchor->image               = image;
-    anchor->paragraphOffset     = offset;
+    anchor->paragraphOffset     = paragraphOffset;
+    anchor->byteOffset          = 0;
     anchor->underline           = true;
     anchor->state               = ANCHOR_LIMBO;
 
@@ -181,13 +185,31 @@
     (
     const TextContext* tContext,    /* pointer to text context */
     const UInt16 reference,         /* record reference */
-    const Int16 offset              /* offset to first paragraph */
+    const Int16 paragraphOffset     /* offset to first paragraph */
     )
 {
     if ( ! DO_ANCHORS( tContext->writeMode ) )
         return;
 
-    AnchorCreate( tContext, reference, NO_IMAGE, offset, anchorId++ );
+    AnchorCreate( tContext, reference, NO_IMAGE, paragraphOffset,
+        anchorId++ );
+}
+
+
+
+/* Set byte offset within paragraph */
+void AnchorSetByteOffset
+    (
+    UInt16  offset
+    )
+{
+    if ( anchorList != NULL ) {
+        AnchorType* lastAnchor;
+
+        lastAnchor = ListLast( anchorList );
+        
+        lastAnchor->byteOffset = offset;
+    }
 }
 
 
@@ -207,7 +229,9 @@
         lastAnchor = ListLast( anchorList );
 
         AnchorCreate( tContext, lastAnchor->reference, lastAnchor->image,
-            lastAnchor->paragraphOffset, lastAnchor->anchorId );
+            lastAnchor->paragraphOffset,
+            lastAnchor->anchorId );
+        AnchorSetByteOffset( lastAnchor->byteOffset );
     }
 }
 
@@ -248,6 +272,7 @@
 
         AnchorCreate( tContext, lastAnchor->reference, image,
             lastAnchor->paragraphOffset, lastAnchor->anchorId );
+        AnchorSetByteOffset( lastAnchor->byteOffset );
     }
 }
 
@@ -401,8 +426,8 @@
 
 
 
-/* Return the offset of a visible anchor */
-Int16 GetVisibleOffset
+/* Return the paragraph offset of a visible anchor */
+Int16 GetVisibleParagraphOffset
     (
     const Int16 index   /* index of visible anchor */
     )
@@ -416,6 +441,21 @@
 
 
 
+/* Return the character offset of a visible anchor */
+Int16 GetVisibleByteOffset
+    (
+    const Int16 index   /* index of visible anchor */
+    )
+{
+    AnchorType* anchor;
+
+    anchor = ListGet( anchorList, index );
+
+    return anchor->byteOffset;
+}
+
+
+
 /* Return the image reference for a visible anchor */
 UInt16 GetVisibleImage
     (
Index: anchor.h
===================================================================
RCS file: /cvs/plucker/plucker_src/viewer/anchor.h,v
retrieving revision 1.29
diff -a -u -r1.29 anchor.h
--- anchor.h	12 Jul 2003 14:57:02 -0000	1.29
+++ anchor.h	23 Jan 2004 15:34:37 -0000
@@ -44,8 +44,14 @@
 /* Return the image reference for a visible anchor */
 extern UInt16 GetVisibleImage(const Int16 index) ANCHOR_SECTION;
 
+/* Set byte offset within paragraph */
+void AnchorSetByteOffset( UInt16 offset ) ANCHOR_SECTION;
+
+/* Return the paragraph offset of a visible anchor */
+extern Int16 GetVisibleParagraphOffset(const Int16 index) ANCHOR_SECTION;
+
 /* Return the paragraph offset of a visible anchor */
-extern Int16 GetVisibleOffset(const Int16 index) ANCHOR_SECTION;
+extern Int16 GetVisibleByteOffset(const Int16 index) ANCHOR_SECTION;
 
 /* Return the reference of a visible anchor */
 extern UInt16 GetVisibleReference(const Int16 index) ANCHOR_SECTION;
@@ -75,7 +81,7 @@
 /* Initialize a new visible anchor */
 extern void AnchorStart(const TextContext *tContext,
                         const UInt16 reference,
-                        const Int16 offset) ANCHOR_SECTION;
+                        const Int16  paragraphOffset) ANCHOR_SECTION;
 
 /* Mark the end of a visible anchor */
 extern void AnchorStop(const TextContext *tContext,
Index: control.c
===================================================================
RCS file: /cvs/plucker/plucker_src/viewer/control.c,v
retrieving revision 1.124
diff -a -u -r1.124 control.c
--- control.c	10 Jan 2004 17:11:35 -0000	1.124
+++ control.c	23 Jan 2004 15:34:38 -0000
@@ -440,6 +440,9 @@
 
 
 /* Jump to requested record */
+/* If pOffset == NO_OFFSET, then cOffset counts from the
+   beginning of the record;  otherwise, cOffset counts from
+   the beginning of the paragraph */
 void JumpToRecord
     (
     const UInt16  recordId, /* record ID */
@@ -483,13 +486,15 @@
     if ( 0 < control ) {
         Int16   anchorIndex;
         UInt16  reference;
-        Int16   offset;
+        Int16   paragraphOffset;
+        Int16   byteOffsetInPara;
         UInt16  image;
 
         anchorIndex = control - 1;
         reference   = GetVisibleReference( anchorIndex );
-        offset      = GetVisibleOffset( anchorIndex );
-        image       = GetVisibleImage( anchorIndex );
+        paragraphOffset    = GetVisibleParagraphOffset( anchorIndex );
+        byteOffsetInPara   = GetVisibleByteOffset( anchorIndex );
+        image              = GetVisibleImage( anchorIndex );
 
         SndPlaySystemSound( sndClick );
 
@@ -524,7 +529,7 @@
                 reference = image;
             }
         }
-        JumpToRecord( reference, offset, NO_OFFSET );
+        JumpToRecord( reference, paragraphOffset, byteOffsetInPara );
 
         return;
     }
Index: document.c
===================================================================
RCS file: /cvs/plucker/plucker_src/viewer/document.c,v
retrieving revision 1.161
diff -a -u -r1.161 document.c
--- document.c	16 Jan 2004 16:08:17 -0000	1.161
+++ document.c	23 Jan 2004 15:34:39 -0000
@@ -82,6 +82,8 @@
                 Boolean recalculateHeights, Coord yPosition,
                 Boolean backwards, WriteModeType mode )
                 DOCUMENT_SECTION;
+static void NormalizeOffsets( Header* record, Int16* pOffsetPtr,
+                Int16* cOffsetPtr ) DOCUMENT_SECTION;
 static Boolean ViewPHTML( Header* record, Boolean newPage,
                 Int16 pOffset, Int16 cOffset, Coord yPosition,
                 Boolean backwards, WriteModeType mode )
@@ -799,7 +801,6 @@
     meta          = MemHandleLock( metaRecord );
     metaParagraph = GET_METAPARAGRAPH( meta, 0 );
 
-
     InitializeTextContext( &thisContext, mode );
 
     numOfParagraphs = record->paragraphs;
@@ -964,8 +965,30 @@
 
 
 
+/* Make sure that at least one of *pOffsetPtr and *cOffsetPtr is
+   is set to NO_OFFSET */
+static void NormalizeOffsets
+    (
+    Header* record,     /* pointer to record header */
+    Int16*  pOffsetPtr, /* paragraph number */
+    Int16*  cOffsetPtr  /* character offset */
+    )
+{
+    if ( *cOffsetPtr == NO_OFFSET || *pOffsetPtr == NO_OFFSET )
+        return;
+
+    *cOffsetPtr  += GET_PARAGRAPH( record, *pOffsetPtr ) - 
+                    GET_PARAGRAPH( record, 0 );
+    *pOffsetPtr   = NO_OFFSET;
+}
+
+
+
 
 /* View Plucker HTML record */
+/* If pOffset == NO_OFFSET, then cOffset counts from the
+   beginning of the record;  otherwise, cOffset counts from
+   the beginning of the paragraph */
 static Boolean ViewPHTML
     (
     Header* record,     /* pointer to record header */
@@ -994,8 +1017,7 @@
 
     prevCoordSys = PalmSetCoordinateSystem( NATIVE );
 
-    if ( cOffset != NO_OFFSET )
-        pOffset = NO_OFFSET;
+    NormalizeOffsets( record, &pOffset, &cOffset );
 
     didDraw      = false;
 
@@ -1190,6 +1212,9 @@
 
 
 /* View record */
+/* If pOffset == NO_OFFSET, then cOffset counts from the
+   beginning of the record;  otherwise, cOffset counts from
+   the beginning of the paragraph */
 Boolean ViewRecord
     (
     UInt16          recordId,   /* record ID */
@@ -1223,6 +1248,9 @@
 
 
 /* View record ( or image ) */
+/* If pOffset == NO_OFFSET, then cOffset counts from the
+   beginning of the record;  otherwise, cOffset counts from
+   the beginning of the paragraph */
 static Boolean ViewRecordAt
     (
     UInt16          recordId,   /* record ID */
Index: paragraph.c
===================================================================
RCS file: /cvs/plucker/plucker_src/viewer/paragraph.c,v
retrieving revision 1.151
diff -a -u -r1.151 paragraph.c
--- paragraph.c	16 Jan 2004 16:08:17 -0000	1.151
+++ paragraph.c	23 Jan 2004 15:34:41 -0000
@@ -188,6 +188,8 @@
                         TextContext* tContext, Int16* width ) PARAGRAPH_SECTION;
 static FunctionType DoNamedAnchor( ParagraphContext* pContext,
                         TextContext* tContext, Int16* width ) PARAGRAPH_SECTION;
+static FunctionType DoSetTargetByteOffset( ParagraphContext* pContext,
+                        TextContext* tContext, Int16* width ) PARAGRAPH_SECTION;
 static FunctionType DoAnchorEnd( ParagraphContext* pContext,
                         TextContext* tContext, Int16* width ) PARAGRAPH_SECTION;
 static FunctionType DoSetStyle( ParagraphContext* pContext,
@@ -286,7 +288,8 @@
     { 0x78, DoStrikeEnd },
     { 0x83, DoUnicode16 },
     { 0x85, DoUnicode32 },
-    { 0x92, DoTable }
+    { 0x92, DoTable },
+    { 0x9A, DoSetTargetByteOffset }
 };
 
 /* variables for link list*/
@@ -353,6 +356,7 @@
 static Coord minLeftKerning;
 static Coord maxRightOverhang;
 
+static Int16 nextTargetByteOffset;
 
 
 #ifdef SUPPORT_WORD_LOOKUP
@@ -1118,6 +1122,7 @@
             *width = FntCharsWidth( name, length );
         }
         else if ( pContext->maxPixels < wide ) {
+            nextTargetByteOffset = 0;
             DoAnchorBegin( pContext, tContext, width );
             DrawIcon(tContext->cursorX, tContext->cursorY - 20);
             *width = 30;
@@ -1182,12 +1187,32 @@
         paragraphOffset = *( functionArgs + 2 ) * 256 + *( functionArgs + 3 );
 
         AnchorStart( tContext, reference, paragraphOffset );
+        AnchorSetByteOffset( nextTargetByteOffset );
         ForceDefaultColor( tContext, true );
     }
     return ANCHOR;
 }
 
 
+/* Set the character offset of the current anchor. */
+static FunctionType DoSetTargetByteOffset
+    (
+    ParagraphContext*   pContext,
+    TextContext*        tContext,
+    Int16*              width
+    )
+{
+    if ( tContext != NULL && tContext->activeAnchor ) {
+        UInt8*  functionArgs;
+
+        functionArgs = pContext->function + 1;
+
+        nextTargetByteOffset = *functionArgs * 256 + *( functionArgs + 1 );
+    }
+    return ANCHOR;
+}
+
+
 /* Handle end of anchor data */
 static FunctionType DoAnchorEnd
     (
@@ -1201,6 +1226,7 @@
         multiline.Anchor         = false;
         AnchorStop( tContext, pContext->fontHeight );
         ForceDefaultColor( tContext, false );
+        nextTargetByteOffset = 0;
     }
     return ANCHOR;
 }
@@ -1227,7 +1253,7 @@
         GetImageMetrics( inlinedImage, width, &pContext->fontHeight );
     }
     else if ( tContext->activeAnchor ) {
-        /* if we have an active anchor the image should be "connected" to 
+        /* if we have an active anchor the image should be "connected" to
            that anchor; this will link the inlined image both to the
            referenced page and to the alternate image */
         AnchorAppendImage( tContext, pContext->fontHeight, alternateImage );
@@ -2414,6 +2440,8 @@
     measureOnly   = false;
 
     handleCaching = lineCacheState && tContext->writeMode == WRITEMODE_DRAW_CHAR;
+    
+    nextTargetByteOffset = 0;
 
 /* FIXME: to remove this we must be able to assign a meta record
    for the test version or rewrite the code... */
Index: paragraph.h
===================================================================
RCS file: /cvs/plucker/plucker_src/viewer/paragraph.h,v
retrieving revision 1.44
diff -a -u -r1.44 paragraph.h
--- paragraph.h	2 Jan 2004 15:36:16 -0000	1.44
+++ paragraph.h	23 Jan 2004 15:34:41 -0000
@@ -68,6 +68,7 @@
     10010000    0x90  Start Row (in table doc)
     10010010    0x92  Include table (record ID)
     10010111    0x97  Table cell (align, image_ref, colspan, rowspan, text len)
+    10011010    0x9A  Set offset of anchor target in target paragraph
 
     Note about attributes:
     For Paragraph objects, the attributes consist of the following bits:
Index: viewer.c
===================================================================
RCS file: /cvs/plucker/plucker_src/viewer/viewer.c,v
retrieving revision 1.124
diff -a -u -r1.124 viewer.c
--- viewer.c	11 Jan 2004 17:33:32 -0000	1.124
+++ viewer.c	23 Jan 2004 15:34:43 -0000
@@ -240,7 +240,7 @@
     FrmGotoForm( formId );
 
     EnableNotification( REGISTER );
-
+    
     return errNone;
 }
 
