/** * @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); }
/** * @param win: the window to change the border flag on * @param border: the borderless flag to set, either TRUe or FALSE * @return Returns no value. * @brief Changes the border from the specified window * * Changes the border from the specified window */ void ewl_window_borderless_set(Ewl_Window *win, unsigned int border) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR(win); DCHECK_TYPE(win, EWL_WINDOW_TYPE); border = !!border; /* do nothing if already set */ if (border == ewl_window_borderless_get(win)) DRETURN(DLEVEL_STABLE); if (border) win->flags |= EWL_WINDOW_BORDERLESS; else win->flags &= ~EWL_WINDOW_BORDERLESS; ewl_engine_window_borderless_set(win); ewl_widget_unrealize(EWL_WIDGET(win)); ewl_widget_realize(EWL_WIDGET(win)); DLEAVE_FUNCTION(DLEVEL_STABLE); }