View Single Post
Old 09-08-2012, 07:39 PM   #618
Kai771
Just a Noob
Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.Kai771 can program the VCR without an owner's manual.
 
Kai771's Avatar
 
Posts: 140
Karma: 162610
Join Date: Aug 2011
Device: Kindle 3
Hi,

I've been using KindlePDFViewr 2012.05 202b6fc (latest official release) for a couple of weeks now, and I'm really impressed. Thanks a lot to everyone who worked on this project.

However, there were a few things that I didn't like:

1. I've got a Kindle 3 wifi, and when reading pdfs I almost always use Fit to Content Width, and never Fit to Page Width because the screen is too small. Therefore, I wanted key bindings for Zoom to Fit to Content to be without Shift, and Zoom to Fit to Page to be with Shift - making frequently used features more accessible.

2. I didn't like dimming of the overlaping content when panning. I understand that it's there to help you find next line to read, but I still didn't like it.

3. When reading pdfs in Fit to Content Width mode, a page usually takes 2 screens to display. 1st screen is fully filled with content of the page, with top of the page lined up with the top of the screen, and when you press PG_FW, on the 2nd screen you get only the part of the page that wasn't shown on 1st screen and the rest is gray. I wanted 2nd screen to be also fully filled with the content of the page, with bottom of the page lined up with the bottom of the screen. This way of displaying pages is especially useful for pages with graphics and pictures.

So, here are my hacks for these "problems". There are probably more elegant solutions, but these work for me. I doubt that any of it will end up in one of the next releases because they're all rather trivial, which means that developers most likely prefered it the way it was released, but I'm publishing them in case someone finds them useful.

All of the hacks require editing of UniReader.lua file.

1. Changing key bindings for Zoom to Fit to Content etc.
--------------------------------------------------------

Spoiler:

Open the file UniReader.lua, find the quoted part (line 1965) and just switch the places of coloured lines (red switch places with each other, blue switch places with each other etc.):

Code:
self.commands:add(KEY_A,nil,"A",
	"zoom to fit page",
	function(unireader)
		unireader:setglobalzoom_mode(unireader.ZOOM_FIT_TO_PAGE)
	end)
self.commands:add(KEY_A,MOD_SHIFT,"A",
	"zoom to fit content",
	function(unireader)
		unireader:setglobalzoom_mode(unireader.ZOOM_FIT_TO_CONTENT)
	end)
self.commands:add(KEY_S,nil,"S",
	"zoom to fit page width",
	function(unireader)
		unireader:setglobalzoom_mode(unireader.ZOOM_FIT_TO_PAGE_WIDTH)
	end)
self.commands:add(KEY_S,MOD_SHIFT,"S",
	"zoom to fit content width",
	function(unireader)
		unireader:setglobalzoom_mode(unireader.ZOOM_FIT_TO_CONTENT_WIDTH)
	end)
self.commands:add(KEY_D,nil,"D",
	"zoom to fit page height",
	function(unireader)
		unireader:setglobalzoom_mode(unireader.ZOOM_FIT_TO_PAGE_HEIGHT)
	end)
self.commands:add(KEY_D,MOD_SHIFT,"D",
	"zoom to fit content height",
	function(unireader)
		unireader:setglobalzoom_mode(unireader.ZOOM_FIT_TO_CONTENT_HEIGHT)
	end)
self.commands:add(KEY_F,nil,"F",
	"zoom to fit margin 2-column mode",
	function(unireader)
		unireader:setglobalzoom_mode(unireader.ZOOM_FIT_TO_CONTENT_HALF_WIDTH_MARGIN)
	end)
self.commands:add(KEY_F,MOD_SHIFT,"F",
	"zoom to fit content 2-column mode",
	function(unireader)
		unireader:setglobalzoom_mode(unireader.ZOOM_FIT_TO_CONTENT_HALF_WIDTH)
	end)


2. Removing dimming of overlapping content
------------------------------------------
Spoiler:

Open the file UniReader.lua, find the following lines and comment the two lines shown in green below (lines 1377 and 1379):

Code:
	if self.show_overlap < 0 then
		fb.bb:dimRect(0,0, width, self.dest_y - self.show_overlap)
	elseif self.show_overlap > 0 then
		fb.bb:dimRect(0,self.dest_y + height - self.show_overlap, width, self.show_overlap)
	end



3. Always fill screen with content of the page
----------------------------------------------
Spoiler:

Open the file UniReader.lua, find the following line:

Code:
self.show_overlap = -self.pan_overlap_vertical -- top < 0
then add these 3 lines over it:
Code:
if self.offset_y < self.min_offset_y then
	self.offset_y = self.min_offset_y - 0
end
next, find this line:

Code:
self.show_overlap = self.pan_overlap_vertical -- bottom > 0
then add these 3 lines over it:
Code:
if self.offset_y > self.content_top then
	self.offset_y = self.content_top + 0
end
If you'd like a bit of a gray border to help you distinguish the top or the bottom of the page, change "- 0" to "- 30" and "+ 0" to "+ 50" in the lines above.


I attached unireader.lua file with all above stated changes (along with some comments) in case someone needs it. Just unpack it and copy it over unireader.lua on your Kindle.
Attached Files
File Type: zip unireader.zip (16.0 KB, 38 views)
Kai771 is offline   Reply With Quote