Example #1
0
#!/usr/bin/env python

import os
import util2
import gen_settingsstructs
import trans_langs

"""
TODO:
 * for gen_langs_html, show languages that don't have enough translations
   in a separate table
"""

g_version = util2.get_sumatrapdf_version()

html_tmpl = """\
<!doctype html>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Customizing SumatraPDF</title>
<style type=text/css>
body {
    font-size: 90%;
    background-color: #f5f5f5;
}

.desc {
    padding: 0px 10px 0px 10px;
}
		"tree (which can be quite large) (internal)",
		doc="data required to determine which parts of the table of contents have been expanded"),
	# NOTE: fields below UseDefaultState aren't serialized if UseDefaultState is true!
	Field("Thumbnail", Type(None, "RenderedBitmap *"), "NULL",
		"thumbnails are saved as PNG files in sumatrapdfcache directory",
		internal=True),
	Field("Index", Type(None, "size_t"), "0",
		"temporary value needed for FileHistory::cmpOpenCount",
		internal=True),
]

# list of fields which aren't serialized when UseDefaultState is set
rememberedDisplayState = ["DisplayMode", "ScrollPos", "PageNo", "Zoom", "Rotation", "WindowState", "WindowPos", "ShowToc", "SidebarDx", "DisplayR2L", "ReparseIdx", "TocState"]

GlobalPrefs = [
	Comment("For documentation, see http://blog.kowalczyk.info/software/sumatrapdf/settings%s.html" % util2.get_sumatrapdf_version()),
	EmptyLine(),

	Field("MainWindowBackground", Color, RGB(0xFF, 0xF2, 0x00, a=0x80),
		"background color of the non-document windows, traditionally yellow",
		expert=True),
	Field("EscToExit", Bool, False,
		"if true, Esc key closes SumatraPDF",
		expert=True),
	Field("ReuseInstance", Bool, False,
		"if true, we'll always open files using existing SumatraPDF process",
		expert=True),
	Field("UseSysColors", Bool, False,
		"if true, we use Windows system colors for background/text color. Over-rides other settings",
		expert=True),
	EmptyLine(),
SessionData = [
	Array("TabStates", TabState,
		"a subset of FileState required for restoring the state of a single tab " +
		"(required for handling documents being opened twice)",
		doc="data required for restoring the view state of a single tab"),
	Field("TabIndex", Int, 1, "index of the currently selected tab (1-based)"),
	Field("WindowState", Int, 0,
		"same as FileState -> WindowState"),
	CompactStruct("WindowPos", WindowPos,
		"default position (can be on any monitor)", structName="RectI"),
	Field("SidebarDx", Int, 0,
		"width of favorites/bookmarks sidebar (if shown)"),
]

GlobalPrefs = [
	Comment("For documentation, see http://www.sumatrapdfreader.org/settings%s.html" % util2.get_sumatrapdf_version()),
	EmptyLine(),

	Field("MainWindowBackground", Color, RGB(0xFF, 0xF2, 0x00, a=0x80),
		"background color of the non-document windows, traditionally yellow",
		expert=True),
	Field("EscToExit", Bool, False,
		"if true, Esc key closes SumatraPDF",
		expert=True),
	Field("ReuseInstance", Bool, False,
		"if true, we'll always open files using existing SumatraPDF process",
		expert=True),
	Field("UseSysColors", Bool, False,
		"if true, we use Windows system colors for background/text color. Over-rides other settings",
		expert=True),
	Field("RestoreSession", Utf8String, "auto",
#!/usr/bin/env python

import os
import util2
import gen_settingsstructs
import trans_langs

"""
TODO:
 * for gen_langs_html, show languages that don't have enough translations
   in a separate table
"""

g_version = util2.get_sumatrapdf_version()

html_tmpl = """\
<!doctype html>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Customizing SumatraPDF %VER%</title>
<style type=text/css>
body {
    font-size: 90%;
    background-color: #f5f5f5;
}

.desc {
    padding: 0px 10px 0px 10px;
}
	Field("Index", Type(None, "size_t"), "0",
		"temporary value needed for FileHistory::cmpOpenCount",
		internal=True),
]

WindowTabsInfo = [
	CompactStruct("Pos", WindowPos, "position of the window (can be on any monitor)", structName="RectI"),
	CompactArray("Files", String, None, "list of files (tabs) opened in this window"),
	Field("Index", Int, 1, "index of the currently selected tab (1-based)"),
]

# list of fields which aren't serialized when UseDefaultState is set
rememberedDisplayState = ["DisplayMode", "ScrollPos", "PageNo", "Zoom", "Rotation", "WindowState", "WindowPos", "ShowToc", "SidebarDx", "DisplayR2L", "ReparseIdx", "TocState"]

GlobalPrefs = [
	Comment("For documentation, see http://blog.kowalczyk.info/software/sumatrapdf/settings%s.html" % util2.get_sumatrapdf_version()),
	EmptyLine(),

	Field("MainWindowBackground", Color, RGB(0xFF, 0xF2, 0x00, a=0x80),
		"background color of the non-document windows, traditionally yellow",
		expert=True),
	Field("EscToExit", Bool, False,
		"if true, Esc key closes SumatraPDF",
		expert=True),
	Field("ReuseInstance", Bool, False,
		"if true, we'll always open files using existing SumatraPDF process",
		expert=True),
	Field("UseSysColors", Bool, False,
		"if true, we use Windows system colors for background/text color. Over-rides other settings",
		expert=True),
	EmptyLine(),
SessionData = [
	Array("TabStates", TabState,
		"a subset of FileState required for restoring the state of a single tab " +
		"(required for handling documents being opened twice)",
		doc="data required for restoring the view state of a single tab"),
	Field("TabIndex", Int, 1, "index of the currently selected tab (1-based)"),
	Field("WindowState", Int, 0,
		"same as FileState -> WindowState"),
	CompactStruct("WindowPos", WindowPos,
		"default position (can be on any monitor)", structName="RectI"),
	Field("SidebarDx", Int, 0,
		"width of favorites/bookmarks sidebar (if shown)"),
]

GlobalPrefs = [
	Comment("For documentation, see http://www.sumatrapdfreader.org/settings%s.html" % util2.get_sumatrapdf_version()),
	EmptyLine(),

	Field("MainWindowBackground", Color, RGB(0xFF, 0xF2, 0x00, a=0x80),
		"background color of the non-document windows, traditionally yellow",
		expert=True),
	Field("EscToExit", Bool, False,
		"if true, Esc key closes SumatraPDF",
		expert=True),
	Field("ReuseInstance", Bool, False,
		"if true, we'll always open files using existing SumatraPDF process",
		expert=True),
	Field("UseSysColors", Bool, False,
		"if true, we use Windows system colors for background/text color. Over-rides other settings",
		expert=True),
	Field("RestoreSession", Bool, True,
def GenerateSettingsHtml():
	from gen_settings_html import html_tmpl, gen_struct, gen_settingsstructs
	s = html_tmpl.replace("%INSIDE%", gen_struct(gen_settingsstructs.GlobalPrefs, prerelease=True))
	ver = util2.get_sumatrapdf_version()
	return s.replace("%VER%", str(ver))