diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2014-11-13 02:36:13 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2014-11-13 02:36:13 +0000 |
commit | 485f2afb6fa7355731467a99711644e8c7dcfd8c (patch) | |
tree | b603e4b85d221ee27092af2c49a60299400be563 /src | |
parent | e8a401ac2a1008644992c7728b7d66d0c156e71d (diff) |
added command line option '--dpi dpinum'.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3443 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r-- | src/gtkutils.c | 17 | ||||
-rw-r--r-- | src/gtkutils.h | 1 | ||||
-rw-r--r-- | src/main.c | 10 |
3 files changed, 24 insertions, 4 deletions
diff --git a/src/gtkutils.c b/src/gtkutils.c index de014305..ec8cd8a2 100644 --- a/src/gtkutils.c +++ b/src/gtkutils.c @@ -144,19 +144,23 @@ gboolean gtkut_font_can_load(const gchar *str) #endif } +static gdouble system_dpi = 0.0; + gdouble gtkut_get_dpi(void) { - gdouble dpi; gdouble dp, di; + if (system_dpi > 0.0) + return system_dpi; + //dpi = gdk_screen_get_resolution(gdk_screen_get_default()); dp = gdk_screen_get_height(gdk_screen_get_default()); di = gdk_screen_get_height_mm(gdk_screen_get_default()) / 25.4; - dpi = dp / di; + system_dpi = dp / di; - debug_print("gtkut_get_dpi: dpi: %f\n", dpi); - return dpi; + debug_print("gtkut_get_dpi: dpi: %f\n", system_dpi); + return system_dpi; } gdouble gtkut_get_dpi_multiplier(void) @@ -177,6 +181,11 @@ gdouble gtkut_get_dpi_multiplier(void) return mul; } +void gtkut_set_dpi(gdouble dpi) +{ + system_dpi = dpi; +} + void gtkut_convert_int_to_gdk_color(gint rgbvalue, GdkColor *color) { g_return_if_fail(color != NULL); diff --git a/src/gtkutils.h b/src/gtkutils.h index 3d51132d..1872e672 100644 --- a/src/gtkutils.h +++ b/src/gtkutils.h @@ -98,6 +98,7 @@ gboolean gtkut_font_can_load (const gchar *str); gdouble gtkut_get_dpi (void); gdouble gtkut_get_dpi_multiplier (void); +void gtkut_set_dpi (gdouble dpi); void gtkut_convert_int_to_gdk_color (gint rgbvalue, GdkColor *color); @@ -662,6 +662,15 @@ static void parse_cmd_opt(int argc, char *argv[]) } } else if (!strncmp(argv[i], "--safe-mode", 11)) { cmd.safe_mode = TRUE; + } else if (!strncmp(argv[i], "--dpi", 5)) { + if (argv[i + 1]) { + gdouble dpi; + + dpi = strtod(argv[i + 1], NULL); + if (dpi > 0.0) + gtkut_set_dpi(dpi); + i++; + } } else if (!strncmp(argv[i], "--exit", 6)) { cmd.exit = TRUE; } else if (!strncmp(argv[i], "--help", 6)) { @@ -686,6 +695,7 @@ static void parse_cmd_opt(int argc, char *argv[]) #ifdef G_OS_WIN32 g_print("%s\n", _(" --ipcport portnum specify port for IPC remote commands")); #endif + g_print("%s\n", _(" --dpi dpinum force DPI")); g_print("%s\n", _(" --exit exit Sylpheed")); g_print("%s\n", _(" --debug debug mode")); g_print("%s\n", _(" --safe-mode safe mode")); |