Enlightenment CVS committal
Author : doursse
Project : e17
Module : proto/epdf
Dir : e17/proto/epdf/src/lib
Modified Files:
Epdf.h etk_pdf.c etk_pdf.h ewl_pdf.c ewl_pdf.h
Log Message:
* src/bin/epdf_esmart_test.c: (main):
error from copy paste
* src/lib/Epdf.h:
* src/lib/etk_pdf.c: (_etk_pdf_destructor):
* src/lib/etk_pdf.h:
* src/lib/ewl_pdf.c: (ewl_pdf_file_set), (ewl_pdf_page_set),
(ewl_pdf_pdf_size_get), (ewl_pdf_page_previous),
(ewl_pdf_pdf_document_get), (ewl_pdf_pdf_page_get),
(ewl_pdf_pdf_index_get):
* src/lib/ewl_pdf.h:
more checks
documentation
formatting
===================================================================
RCS file: /cvs/e/e17/proto/epdf/src/lib/Epdf.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- Epdf.h 21 May 2008 13:07:08 -0000 1.6
+++ Epdf.h 22 May 2008 06:53:05 -0000 1.7
@@ -75,6 +75,7 @@
* epdf_page_render (page, o);
* evas_object_show (o);
*
+ * evas_object_del (o);
* epdf_page_delete (page);
* epdf_document_delete (document);
* @endcode
===================================================================
RCS file: /cvs/e/e17/proto/epdf/src/lib/etk_pdf.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- etk_pdf.c 21 May 2008 13:07:08 -0000 1.13
+++ etk_pdf.c 22 May 2008 06:53:05 -0000 1.14
@@ -484,7 +484,7 @@
if (!pdf)
return;
- free(pdf->filename);
+ if (pdf->filename) free(pdf->filename);
epdf_document_delete (pdf->pdf_document);
epdf_page_delete (pdf->pdf_page);
epdf_index_delete (pdf->pdf_index);
===================================================================
RCS file: /cvs/e/e17/proto/epdf/src/lib/etk_pdf.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- etk_pdf.h 21 May 2008 13:07:08 -0000 1.8
+++ etk_pdf.h 22 May 2008 06:53:05 -0000 1.9
@@ -13,7 +13,7 @@
* @brief A PDF display Widget for the Etk toolkit
*
* Provides a widget for displaying PDF files in an Etk widget.
- * To use an Etk_Dwi widget, create it with etk_pdf_new(), and
+ * To use an Etk_Pdf widget, create it with etk_pdf_new(), and
* set the file with etk_pdf_file_set(). For example:
*
* @code
===================================================================
RCS file: /cvs/e/e17/proto/epdf/src/lib/ewl_pdf.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- ewl_pdf.c 22 May 2008 04:43:14 -0000 1.17
+++ ewl_pdf.c 22 May 2008 06:53:05 -0000 1.18
@@ -105,46 +105,62 @@
/**
* @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 Returns no value.
+ * @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.
*/
-void
+int
ewl_pdf_file_set(Ewl_Pdf *pdf, const char *filename)
{
Ewl_Widget *w;
- Ewl_Embed *emb;
DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(pdf);
+ DCHECK_PARAM_PTR_RET(pdf, FALSE);
DCHECK_TYPE(pdf, EWL_PDF_TYPE);
w = EWL_WIDGET(pdf);
- emb = ewl_embed_widget_find(w);
if (pdf->filename != filename) {
IF_FREE(pdf->filename);
}
- if (!filename || (filename[0] == 0))
- DRETURN(DLEVEL_STABLE);
+ if (!filename || (filename[0] == '\0'))
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
pdf->filename = strdup(filename);
if (pdf->pdf_document) {
- if (pdf->pdf_page)
+ if (pdf->pdf_page) {
epdf_page_delete(pdf->pdf_page);
- if (pdf->pdf_index)
+ pdf->pdf_page = NULL;
+ }
+ if (pdf->pdf_index) {
epdf_index_delete(pdf->pdf_index);
+ pdf->pdf_index = NULL;
+ }
epdf_document_delete(pdf->pdf_document);
+ pdf->pdf_document = NULL;
}
pdf->pdf_document = epdf_document_new(filename);
if (!pdf->pdf_document)
- DRETURN(DLEVEL_STABLE);
+ 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 (!pdf->pdf_index) {
+ epdf_page_delete(pdf->pdf_page);
+ pdf->pdf_page = NULL;
+ epdf_document_delete (pdf->pdf_document);
+ pdf->pdf_document = NULL;
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
pdf->dirty = 1;
@@ -160,7 +176,7 @@
*/
ewl_widget_configure(w);
- DLEAVE_FUNCTION(DLEVEL_STABLE);
+ DRETURN_INT(TRUE, DLEVEL_STABLE);
}
/**
@@ -186,7 +202,8 @@
*
* Sets the page of the document @p pdf to @p page
*/
-void ewl_pdf_page_set(Ewl_Pdf *pdf, int page)
+void
+ewl_pdf_page_set(Ewl_Pdf *pdf, int page)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(pdf);
@@ -231,14 +248,18 @@
* @brief get the size of the pdf @p pdf. If @p pdf is NULL,
* return a width equal to 0 and a height equal to 0
*/
-void ewl_pdf_pdf_size_get(Ewl_Pdf *pdf, int *width, int *height)
+void
+ewl_pdf_pdf_size_get(Ewl_Pdf *pdf, int *width, int *height)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(pdf);
DCHECK_TYPE(pdf, EWL_PDF_TYPE);
- if (!pdf->pdf_page)
+ if (!pdf->pdf_page) {
+ if (width) *width = 0;
+ if (height) *height = 0;
DRETURN(DLEVEL_STABLE);
+ }
epdf_page_size_get(pdf->pdf_page, width, height);
@@ -389,6 +410,9 @@
DCHECK_PARAM_PTR(pdf);
DCHECK_TYPE(pdf, EWL_PDF_TYPE);
+ if (!pdf->pdf_page)
+ DRETURN(DLEVEL_STABLE);
+
page = epdf_page_page_get(pdf->pdf_page);
if (page > 0)
page--;
@@ -567,7 +591,8 @@
* @return Returns the document of the pdf (NULL on failure)
* @brief get the document of the pdf
*/
-Epdf_Document *ewl_pdf_pdf_document_get(Ewl_Pdf *pdf)
+Epdf_Document *
+ewl_pdf_pdf_document_get(Ewl_Pdf *pdf)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR_RET(pdf, NULL);
@@ -581,7 +606,8 @@
* @return Returns the current page of the pdf (NULL on failure)
* @brief get the current page of the pdf
*/
-Epdf_Page *ewl_pdf_pdf_page_get(Ewl_Pdf *pdf)
+Epdf_Page *
+ewl_pdf_pdf_page_get(Ewl_Pdf *pdf)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR_RET(pdf, NULL);
@@ -595,7 +621,8 @@
* @return Returns the poppler index of the pdf (NULL on failure)
* @brief get the poppler index of the pdf
*/
-Ecore_List *ewl_pdf_pdf_index_get(Ewl_Pdf *pdf)
+Ecore_List *
+ewl_pdf_pdf_index_get(Ewl_Pdf *pdf)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR_RET(pdf, NULL);
===================================================================
RCS file: /cvs/e/e17/proto/epdf/src/lib/ewl_pdf.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- ewl_pdf.h 22 May 2008 04:43:14 -0000 1.11
+++ ewl_pdf.h 22 May 2008 06:53:05 -0000 1.12
@@ -12,7 +12,7 @@
* @brief A PDF display Widget for the Ewl toolkit
*
* Provides a widget for displaying PDF files in an Ewl widget.
- * To use an Ewl_Dwi widget, create it with ewl_pdf_new(), and
+ * To use an Ewl_Pdf widget, create it with ewl_pdf_new(), and
* set the file with ewl_pdf_file_set(). For example:
*
* @code
@@ -89,7 +89,7 @@
Ewl_Widget *ewl_pdf_new(void);
int ewl_pdf_init(Ewl_Pdf *pdf);
-void ewl_pdf_file_set(Ewl_Pdf *pdf, const char *filename);
+int ewl_pdf_file_set(Ewl_Pdf *pdf, const char *filename);
const char *ewl_pdf_file_get(Ewl_Pdf *pdf);
void ewl_pdf_page_set(Ewl_Pdf *pdf, int page);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs