handle bookmark hierarchy.

Thu, 20 Mar 2003 16:23:37 +0000

author
eric
date
Thu, 20 Mar 2003 16:23:37 +0000
changeset 154
5cfcac03d43f
parent 153
4a4a5b5fd6e5
child 155
cbc23650d9ca

handle bookmark hierarchy.

tumble.c file | annotate | diff | revisions
     1.1 diff -r 4a4a5b5fd6e5 -r 5cfcac03d43f tumble.c
     1.2 --- a/tumble.c	Thu Mar 20 15:26:16 2003 +0000
     1.3 +++ b/tumble.c	Thu Mar 20 16:23:37 2003 +0000
     1.4 @@ -2,7 +2,7 @@
     1.5   * tumble: build a PDF file from image files
     1.6   *
     1.7   * Main program
     1.8 - * $Id: tumble.c,v 1.40 2003/03/20 06:55:27 eric Exp $
     1.9 + * $Id: tumble.c,v 1.41 2003/03/20 08:23:37 eric Exp $
    1.10   * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
    1.11   *
    1.12   * This program is free software; you can redistribute it and/or modify
    1.13 @@ -178,6 +178,10 @@
    1.14  }
    1.15  
    1.16  
    1.17 +#define MAX_BOOKMARK_LEVEL 20
    1.18 +static pdf_bookmark_handle bookmark_vector [MAX_BOOKMARK_LEVEL + 1] = { NULL };
    1.19 +
    1.20 +
    1.21  bool process_page (int image,  /* range 1 .. n */
    1.22  		   input_attributes_t input_attributes,
    1.23  		   bookmark_t *bookmarks,
    1.24 @@ -198,8 +202,21 @@
    1.25  
    1.26    while (bookmarks)
    1.27      {
    1.28 -      /* $$$ need to handle level here */
    1.29 -      pdf_new_bookmark (NULL, bookmarks->name, 0, page);
    1.30 +      if (bookmarks->level <= MAX_BOOKMARK_LEVEL)
    1.31 +	{
    1.32 +	  pdf_bookmark_handle parent = bookmark_vector [bookmarks->level - 1];
    1.33 +	  bookmark_vector [bookmarks->level] = pdf_new_bookmark (parent,
    1.34 +								 bookmarks->name,
    1.35 +								 0,
    1.36 +								 page);
    1.37 +	}
    1.38 +      else
    1.39 +	{
    1.40 +	  (void) pdf_new_bookmark (bookmark_vector [MAX_BOOKMARK_LEVEL],
    1.41 +				   bookmarks->name,
    1.42 +				   0,
    1.43 +				   page);
    1.44 +	}
    1.45        bookmarks = bookmarks->next;
    1.46      }
    1.47