Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
6024ddbf
Kaydet (Commit)
6024ddbf
authored
Haz 23, 2014
tarafından
Andrzej Hunt
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
LOK Docview: add set_zoom
Change-Id: I902f3a134b4a7dcc721eff3f67376014a4276885
üst
3545b787
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
11 deletions
+40
-11
LibreOfficeKitGtk.h
include/LibreOfficeKit/LibreOfficeKitGtk.h
+5
-0
lokdocview.c
libreofficekit/source/gtk/lokdocview.c
+35
-11
No files found.
include/LibreOfficeKit/LibreOfficeKitGtk.h
Dosyayı görüntüle @
6024ddbf
...
...
@@ -37,6 +37,8 @@ struct _LOKDocView
GtkWidget
*
pCanvas
;
GdkPixbuf
*
pPixBuf
;
float
fZoom
;
LibreOfficeKit
*
pOffice
;
LibreOfficeKitDocument
*
pDocument
;
};
...
...
@@ -52,6 +54,9 @@ guint lok_docview_get_type (void);
GtkWidget
*
lok_docview_new
(
LibreOfficeKit
*
pOffice
);
gboolean
lok_docview_open_document
(
LOKDocView
*
pDocView
,
char
*
pPath
);
void
lok_docview_set_zoom
(
LOKDocView
*
pDocView
,
float
fZoom
);
float
lok_docview_get_zoom
(
LOKDocView
*
pDocView
);
#ifdef __cplusplus
}
...
...
libreofficekit/source/gtk/lokdocview.c
Dosyayı görüntüle @
6024ddbf
...
...
@@ -68,6 +68,8 @@ static void lok_docview_init( LOKDocView* pDocView )
// TODO: figure out a clever view of getting paths set up.
pDocView
->
pOffice
=
0
;
pDocView
->
pDocument
=
0
;
pDocView
->
fZoom
=
1
;
}
SAL_DLLPUBLIC_EXPORT
GtkWidget
*
lok_docview_new
(
LibreOfficeKit
*
pOffice
)
...
...
@@ -77,16 +79,10 @@ SAL_DLLPUBLIC_EXPORT GtkWidget* lok_docview_new( LibreOfficeKit* pOffice )
return
GTK_WIDGET
(
pDocView
);
}
SAL_DLLPUBLIC_EXPORT
gboolean
lok_docview_open_document
(
LOKDocView
*
pDocView
,
char
*
pPath
)
void
renderDocument
(
LOKDocView
*
pDocView
)
{
if
(
pDocView
->
pDocument
)
{
pDocView
->
pDocument
->
pClass
->
destroy
(
pDocView
->
pDocument
);
pDocView
->
pDocument
=
0
;
}
g_assert
(
pDocView
->
pDocument
);
pDocView
->
pDocument
=
pDocView
->
pOffice
->
pClass
->
documentLoad
(
pDocView
->
pOffice
,
pPath
);
if
(
pDocView
->
pPixBuf
)
{
g_object_unref
(
G_OBJECT
(
pDocView
->
pPixBuf
)
);
...
...
@@ -96,15 +92,17 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_docview_open_document( LOKDocView* pDocView, c
pDocView
->
pDocument
->
pClass
->
getDocumentSize
(
pDocView
->
pDocument
,
&
nWidth
,
&
nHeight
);
// Draw the whole document at once (for now)
int
nRenderWidth
=
nWidth
/
10
;
int
nRenderHeight
=
nHeight
/
10
;
// TODO: we really should scale by screen DPI here -- 10 seems to be a vaguely
// correct factor for my screen at least.
int
nRenderWidth
=
nWidth
*
pDocView
->
fZoom
/
10
;
int
nRenderHeight
=
nHeight
*
pDocView
->
fZoom
/
10
;
pDocView
->
pPixBuf
=
gdk_pixbuf_new
(
GDK_COLORSPACE_RGB
,
TRUE
,
8
,
nRenderWidth
,
nRenderHeight
);
// TODO: move the rendering into it's own function etc.
unsigned
char
*
pBuffer
=
gdk_pixbuf_get_pixels
(
pDocView
->
pPixBuf
);
int
nRowStride
;
pDocView
->
pDocument
->
pClass
->
paintTile
(
pDocView
->
pDocument
,
...
...
@@ -119,8 +117,34 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_docview_open_document( LOKDocView* pDocView, c
(
void
)
nRowStride
;
gtk_image_set_from_pixbuf
(
GTK_IMAGE
(
pDocView
->
pCanvas
),
pDocView
->
pPixBuf
);
}
SAL_DLLPUBLIC_EXPORT
gboolean
lok_docview_open_document
(
LOKDocView
*
pDocView
,
char
*
pPath
)
{
if
(
pDocView
->
pDocument
)
{
pDocView
->
pDocument
->
pClass
->
destroy
(
pDocView
->
pDocument
);
pDocView
->
pDocument
=
0
;
}
pDocView
->
pDocument
=
pDocView
->
pOffice
->
pClass
->
documentLoad
(
pDocView
->
pOffice
,
pPath
);
renderDocument
(
pDocView
);
return
FALSE
;
}
SAL_DLLPUBLIC_EXPORT
void
lok_docview_set_zoom
(
LOKDocView
*
pDocView
,
float
fZoom
)
{
pDocView
->
fZoom
=
fZoom
;
renderDocument
(
pDocView
);
// TODO: maybe remember and reset positiong?
}
SAL_DLLPUBLIC_EXPORT
float
lok_docview_get_zoom
(
LOKDocView
*
pDocView
)
{
return
pDocView
->
fZoom
;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment