Ejemplo n.º 1
0
Archivo: ewl_dvi.c Proyecto: Limsik/e17
/**
 * @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);
}
Ejemplo n.º 2
0
Archivo: ewl_ps.c Proyecto: Limsik/e17
/**
 * @param ps: the ps widget to change the displayed ps
 * @param filename: the path to the new postscript file to be displayed by @a ps
 * @return 0 on failure, 1 otherwise.
 * @brief Change the postscript file displayed by a ps widget
 *
 * Set the postscript file displayed by @a ps to the one found at the path
 * @a filename.
 */
int
ewl_ps_file_set(Ewl_Ps *ps, const char *filename)
{
        Ewl_Widget *w;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(ps, FALSE);
        DCHECK_TYPE(ps, EWL_PS_TYPE);

        w = EWL_WIDGET(ps);

        if (ps->filename != filename) {
                IF_FREE(ps->filename);
        }
        if (!filename || (filename[0] == '\0'))
                DRETURN_INT(FALSE, DLEVEL_STABLE);

        if (ps->ps_page) {
                eps_page_delete(ps->ps_page);
                ps->ps_page = NULL;
        }

        if (ps->ps_document) {
                eps_document_delete(ps->ps_document);
                ps->ps_document = NULL;
        }

        ps->filename = strdup(filename);

        /*
         * Load the new Postscript document
         */

        ps->ps_document = eps_document_new(filename);
        if (!ps->ps_document)
                DRETURN_INT(FALSE, DLEVEL_STABLE);

        ps->ps_page = eps_page_new(ps->ps_document);
        if (!ps->ps_page) {
                eps_document_delete(ps->ps_document);
                ps->ps_document = NULL;
                DRETURN_INT(FALSE, DLEVEL_STABLE);
        }

        if (REALIZED(w)) {
                ewl_widget_unrealize(w);
                ewl_widget_reveal(w);
        }

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}
Ejemplo n.º 3
0
/**
 * @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);
}