@@ -12,64 +12,8 @@ function DJVUReader:init()
12
12
end
13
13
14
14
-- open a DJVU file and its settings store
15
+ -- DJVU does not support password yet
15
16
function DJVUReader :open (filename )
16
17
self .doc = djvu .openDocument (filename )
17
- if self .doc ~= nil then
18
- self .settings = DocSettings :open (filename )
19
- local gamma = self .settings :readsetting (" gamma" )
20
- if gamma then
21
- self .globalgamma = gamma
22
- end
23
- return true
24
- end
25
- return false
26
- end
27
-
28
- -- set viewer state according to zoom state
29
- function DJVUReader :setzoom (page )
30
- local dc = self .newDC ()
31
- local pwidth , pheight = page :getSize (self .nulldc )
32
-
33
- if self .globalzoommode == self .ZOOM_FIT_TO_PAGE then
34
- self .globalzoom = width / pwidth
35
- self .offset_x = 0
36
- self .offset_y = (height - (self .globalzoom * pheight )) / 2
37
- if height / pheight < self .globalzoom then
38
- self .globalzoom = height / pheight
39
- print (width , (self .globalzoom * pwidth ))
40
- self .offset_x = (width - (self .globalzoom * pwidth )) / 2
41
- self .offset_y = 0
42
- end
43
- elseif self .globalzoommode == self .ZOOM_FIT_TO_PAGE_WIDTH then
44
- self .globalzoom = width / pwidth
45
- self .offset_x = 0
46
- self .offset_y = (height - (self .globalzoom * pheight )) / 2
47
- elseif self .globalzoommode == self .ZOOM_FIT_TO_PAGE_HEIGHT then
48
- self .globalzoom = height / pheight
49
- self .offset_x = (width - (self .globalzoom * pwidth )) / 2
50
- self .offset_y = 0
51
- end
52
-
53
- dc :setZoom (self .globalzoom )
54
- -- record globalzoom for manual zoom in/out
55
- self .globalzoom_orig = self .globalzoom
56
-
57
- dc :setRotate (self .globalrotate );
58
- dc :setOffset (self .offset_x , self .offset_y )
59
- self .fullwidth , self .fullheight = page :getSize (dc )
60
- self .min_offset_x = fb .bb :getWidth () - self .fullwidth
61
- self .min_offset_y = fb .bb :getHeight () - self .fullheight
62
- if (self .min_offset_x > 0 ) then
63
- self .min_offset_x = 0
64
- end
65
- if (self .min_offset_y > 0 ) then
66
- self .min_offset_y = 0
67
- end
68
-
69
- -- set gamma here, we don't have any other good place for this right now:
70
- if self .globalgamma ~= self .GAMMA_NO_GAMMA then
71
- print (" gamma correction: " .. self .globalgamma )
72
- dc :setGamma (self .globalgamma )
73
- end
74
- return dc
18
+ return self :loadSettings (filename )
75
19
end
0 commit comments