add justification option in koptconfig dialog

Conflicts:

	koptconfig.lua
	koptreader.lua
pull/2/merge
chrox 12 years ago committed by Qingping Hou
parent 72aeb42441
commit 5294d178a0

@ -481,9 +481,11 @@ static int reflowPage(lua_State *L) {
double line_spacing = luaL_checknumber(L, 7);
double word_spacing = luaL_checknumber(L, 8);
int text_wrap = luaL_checkint(L, 9);
double contrast = luaL_checknumber(L, 10);
int justification = luaL_checkint(L, 10);
int full_just = luaL_checkint(L, 11);
double contrast = luaL_checknumber(L, 12);
k2pdfopt_set_params(width, height, page_margin, line_spacing, word_spacing, text_wrap, contrast);
k2pdfopt_set_params(width, height, page_margin, line_spacing, word_spacing, text_wrap, justification, full_just, contrast);
k2pdfopt_djvu_reflow(page->page_ref, page->doc->context, mode, page->doc->pixelformat, dc->zoom, \
width, height, line_spacing, word_spacing);
k2pdfopt_rfbmp_size(&width, &height);

@ -474,12 +474,14 @@ static void k2pdfopt_reflow_bmp(MASTERINFO *masterinfo, WILLUSBITMAP *src) {
void k2pdfopt_set_params(int bb_width, int bb_height, double page_margin, \
double line_space, double word_space, \
int wrapping, double contrast) {
int wrapping, int justification, int full_just, double contrast) {
dst_userwidth = bb_width; // dst_width is adjusted in adjust_params_init
dst_userheight = bb_height;
vertical_line_spacing = line_space;
word_spacing = word_space;
text_wrap = wrapping;
dst_justify = justification;
dst_fulljustify = full_just;
gamma_correction = contrast; // contrast is only used by k2pdfopt_mupdf_reflow
dst_mar = page_margin;

@ -28,7 +28,7 @@
void k2pdfopt_set_params(int bb_width, int bb_height, double page_margin, \
double line_space, double word_space, \
int wrapping, double contrast);
int wrapping, int justification, int full_just, double contrast);
void k2pdfopt_mupdf_reflow(fz_document *doc, fz_page *page, fz_context *ctx, \
double zoom, double gamma, double rot_deg);
void k2pdfopt_djvu_reflow(ddjvu_page_t *page, ddjvu_context_t *ctx, \

@ -26,7 +26,7 @@ KOPTOptions = {
current_item=2,
text_dirty=true,
marker_dirty={true, true, true},
value={0.2, 0.375, 0.5}},
value={0.02, 0.375, 0.5}},
{
name="text_wrap",
option_text="Text Wrap",
@ -36,6 +36,22 @@ KOPTOptions = {
marker_dirty={true, true},
value={0, 1}},
{
name="justification",
option_text="Justification",
items_text={"default","left","center","right"},
current_item=1,
text_dirty=true,
marker_dirty={true, true, true, true},
value={-1,0,1,2}},
{
name="full_just",
option_text="Full Justification",
items_text={"default","no","yes"},
current_item=1,
text_dirty=true,
marker_dirty={true, true, true},
value={-1,0,1}},
{
name="contrast",
option_text="Contrast",
items_text={"lightest","lighter","default","darker","darkest"},
@ -47,6 +63,7 @@ KOPTOptions = {
KOPTConfig = {
-- UI constants
<<<<<<< HEAD
HEIGHT = 220, -- height
MARGIN_BOTTOM = 20, -- window bottom margin
<<<<<<< HEAD
@ -58,6 +75,11 @@ KOPTConfig = {
VALUE_SPACING_H = 10, -- values horisontal spacing
=======
MARGIN_HORISONTAL = 50, -- window horisontal margin
=======
HEIGHT = 300, -- height
MARGIN_BOTTOM = 30, -- window bottom margin
MARGIN_HORISONTAL = 35, -- window horisontal margin
>>>>>>> 83cc0ea... add justification option in koptconfig dialog
NAME_PADDING_T = 50, -- option name top padding
OPTION_SPACING_V = 35, -- options vertical spacing
NAME_ALIGN_RIGHT = 0.3, -- align name right to the window width
@ -107,7 +129,7 @@ function KOPTConfig:drawOptionItem(xpos, ypos, option_index, item_index, text, f
local text_len = sizeUtf8Text(0, G_width, font_face, text, true).x
self.text_pos = self.text_pos + text_len
if KOPTOptions[option_index].marker_dirty[item_index] then
if KOPTOptions[option_index].marker_dirty[item_index] or refresh then
--Debug("drawing option:", KOPTOptions[option_index].option_text, "marker:", text)
if item_index == KOPTOptions[option_index].current_item then
fb.bb:paintRect(xpos, ypos+5, text_len, 3,(option_index == self.current_option) and 15 or 5)

@ -521,9 +521,11 @@ static int reflowPage(lua_State *L) {
double line_spacing = luaL_checknumber(L, 7);
double word_spacing = luaL_checknumber(L, 8);
int text_wrap = luaL_checkint(L, 9);
double contrast = luaL_checknumber(L, 10);
int justification = luaL_checkint(L, 10);
int full_just = luaL_checkint(L, 11);
double contrast = luaL_checknumber(L, 12);
k2pdfopt_set_params(width, height, page_margin, line_spacing, word_spacing, text_wrap, contrast);
k2pdfopt_set_params(width, height, page_margin, line_spacing, word_spacing, text_wrap, justification, full_just, contrast);
k2pdfopt_mupdf_reflow(page->doc->xref, page->page, page->doc->context, dc->zoom, dc->gamma, 0.0);
k2pdfopt_rfbmp_size(&width, &height);
k2pdfopt_rfbmp_zoom(&dc->zoom);

Loading…
Cancel
Save