static void
_tree_fill (Etk_Pdf *pdf, Etk_Tree *tree, Etk_Tree_Col *col, Etk_Tree_Row *row, Ecore_List *items)
{
  Etk_Tree_Row   *prow;
  Epdf_Index_Item *item;

  if (!items)
    return;

  ecore_list_first_goto (items);
  while ((item = ecore_list_next (items))) {
    char       *buf;
    Ecore_List *c;
    int        *num;

    buf = strdup (epdf_index_item_title_get (item));
    prow = etk_tree_row_append (tree, row, col, buf, NULL);

    num = (int *)malloc (sizeof (int));
    *num = epdf_index_item_page_get (etk_pdf_pdf_document_get (pdf), item);
    etk_tree_row_data_set_full (prow, num, free);
    free (buf);
    c = epdf_index_item_children_get (item);
    if (c) {
      _tree_fill (pdf, tree, col, prow, c);
    }
  }
}
Beispiel #2
0
static void display_index (Epdf_Document *document, Eina_List *children, int n)
{
  Epdf_Index_Item *item;
  Eina_List       *l;

  if (!children)
    return;

  EINA_LIST_FOREACH(children, l, item) {
    char *buf;
    char  buf2[64];
    int page;
    Eina_List *c;

    buf = (char *)malloc (sizeof (char) * 2 * n + 1);
    memset (buf, ' ', 2 * n);
    buf[2 * n] = '\0';
    page = epdf_index_item_page_get (document, item);
    if (page == -1)
      snprintf (buf2, 64, "no dest. page");
    else
      snprintf (buf2, 64, "page %d", page);
    printf ("%s%s (%s)\n", buf, epdf_index_item_title_get (item), buf2);
    free (buf);
    c = epdf_index_item_children_get (item);
    if (c)
      display_index (document, c, n + 1);
  }
Beispiel #3
0
void toc_choicehandler(Evas *e, Evas_Object *parent,int choice, bool lp)
{
    Ecore_List *list=(Ecore_List *)choicebox_get_userdata(e,parent);
    Epdf_Index_Item *curitem=(Epdf_Index_Item *)ecore_list_index_goto(list,choice);
    Ecore_List *childlist=epdf_index_item_children_get (curitem);
    if(!childlist)
    {
        Evas_Object *curcb=parent;
        Evas_Object *nextcb;
        while((nextcb=choicebox_get_parent(e,curcb)))
        {
            fini_choicebox(e,curcb,false);   
            curcb=nextcb;
        }
        evas_object_focus_set(curcb,1);
        goto_page(epdf_index_item_page_get(get_document(),curitem));
    }
    else
    {
        TOCDialog(e,parent,childlist);    
        
    }
}