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