/** * @param dvi: the dvi widget to change the displayed dvi * @param filename: the path to the new dvi to be displayed by @a dvi * @return Returns no value. * @brief Change the dvi file displayed by an dvi widget * * Set the dvi displayed by @a dvi to the one found at the path @a filename. If an * edje is used, a minimum size should be specified in the edje or the code. */ int ewl_dvi_file_set(Ewl_Dvi *dvi, const char *filename) { Ewl_Widget *w; Ewl_Embed *emb; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(dvi, FALSE); DCHECK_TYPE(dvi, EWL_DVI_TYPE); w = EWL_WIDGET(dvi); emb = ewl_embed_widget_find(w); if (!filename || (filename[0] == '\0')) DRETURN_INT(FALSE, DLEVEL_STABLE); if (dvi->filename != filename) { IF_FREE(dvi->filename); } if (dvi->dvi_page) { edvi_page_delete(dvi->dvi_page); dvi->dvi_page = NULL; } if (dvi->dvi_document) { edvi_document_delete(dvi->dvi_document); dvi->dvi_document = NULL; } dvi->filename = strdup(filename); /* * Load the new dvi if widget has been realized */ dvi->dvi_document = edvi_document_new(dvi->filename, dvi->dvi_device, dvi->dvi_property); if (!dvi->dvi_document) DRETURN_INT(FALSE, DLEVEL_STABLE); dvi->dvi_page = edvi_page_new(dvi->dvi_document); if (!dvi->dvi_page) { edvi_document_delete(dvi->dvi_document); dvi->dvi_document = NULL; DRETURN_INT(FALSE, DLEVEL_STABLE); } if (REALIZED(w)) { ewl_widget_obscure(w); ewl_widget_reveal(w); } DRETURN_INT(TRUE, DLEVEL_STABLE); }
/** * @param pdf the pdf widget to change the displayed pdf * @param filename: the path to the new pdf to be displayed by @a pdf * @return 0 on failure, 1 otherwise. * @brief Change the pdf file displayed by an pdf widget * * Set the pdf displayed by @a pdf to the one found at the filename @a filename. If an * edje is used, a minimum size should be specified in the edje or the code. */ int ewl_pdf_file_set(Ewl_Pdf *pdf, const char *filename) { Ewl_Widget *w; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(pdf, FALSE); DCHECK_TYPE(pdf, EWL_PDF_TYPE); w = EWL_WIDGET(pdf); if (!filename || (filename[0] == '\0')) DRETURN_INT(FALSE, DLEVEL_STABLE); if (pdf->filename != filename) { IF_FREE(pdf->filename); } if (pdf->pdf_index) { epdf_index_delete(pdf->pdf_index); pdf->pdf_index = NULL; } if (pdf->pdf_page) { epdf_page_delete(pdf->pdf_page); pdf->pdf_page = NULL; } if (pdf->pdf_document) { epdf_document_delete(pdf->pdf_document); pdf->pdf_document = NULL; } pdf->filename = strdup(filename); pdf->search.o = NULL; pdf->search.text = NULL; pdf->search.list = NULL; pdf->search.page = -1; pdf->search.is_case_sensitive = FALSE; pdf->search.is_circular = FALSE; /* * Load the new PDF document */ pdf->pdf_document = epdf_document_new(pdf->filename); if (!pdf->pdf_document) DRETURN_INT(FALSE, DLEVEL_STABLE); pdf->pdf_page = epdf_page_new(pdf->pdf_document); if (!pdf->pdf_page) { epdf_document_delete(pdf->pdf_document); pdf->pdf_document = NULL; DRETURN_INT(FALSE, DLEVEL_STABLE); } pdf->pdf_index = epdf_index_new(pdf->pdf_document); if (REALIZED(w)) { ewl_widget_obscure(w); ewl_widget_reveal(w); } DRETURN_INT(TRUE, DLEVEL_STABLE); }