summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOle Loots <ole@monochrom.net>2013-12-22 04:52:18 +0100
committerOle Loots <ole@monochrom.net>2013-12-22 04:52:18 +0100
commit289cd3a7975125d133f42ceb314db1332ff13032 (patch)
treea9a4d831f9c7ca3c4982d0c96289403aca6043b6
parentfeef0562b50162987ddf8e2ec3aa2d877e7657fe (diff)
downloadnetsurf-289cd3a7975125d133f42ceb314db1332ff13032.tar.gz
netsurf-289cd3a7975125d133f42ceb314db1332ff13032.tar.bz2
Added scale property to gui_window and use it.
-rw-r--r--atari/deskmenu.c24
-rw-r--r--atari/gui.c19
-rwxr-xr-xatari/gui.h1
-rwxr-xr-xatari/rootwin.c6
4 files changed, 29 insertions, 21 deletions
diff --git a/atari/deskmenu.c b/atari/deskmenu.c
index 45b9d15ca..82de7d6cd 100644
--- a/atari/deskmenu.c
+++ b/atari/deskmenu.c
@@ -379,35 +379,19 @@ static void __CDECL menu_reload(short item, short title, void *data)
static void __CDECL menu_inc_scale(short item, short title, void *data)
{
- int width = 0, heigth = 0;
-
if(input_window == NULL)
return;
- float now = plot_get_scale();
- plot_set_scale(now+0.25);
- LOG(("%s, scale: %f", __FUNCTION__, plot_get_scale()));
- browser_window_reload(input_window->browser->bw, false);
- gui_window_get_dimensions(input_window, &width, &heigth, true);
- browser_window_reformat(input_window->browser->bw, false, width, heigth);
+ gui_window_set_scale(input_window, gui_window_get_scale(input_window)+0.25);
}
static void __CDECL menu_dec_scale(short item, short title, void *data)
{
- int width = 0, heigth = 0;
-
if(input_window == NULL)
- return;
- float now = plot_get_scale();
- if (now > 0.5) {
- plot_set_scale(now-0.25);
- }
- LOG(("%s, scale: %f", __FUNCTION__, plot_get_scale()));
-
- browser_window_reload(input_window->browser->bw, false);
- gui_window_get_dimensions(input_window, &width, &heigth, true);
- browser_window_reformat(input_window->browser->bw, false, width, heigth);
+ return;
+
+ gui_window_set_scale(input_window, gui_window_get_scale(input_window)-0.25);
}
diff --git a/atari/gui.c b/atari/gui.c
index 42f684486..ace0f9848 100644
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -207,6 +207,7 @@ gui_create_browser_window(struct browser_window *bw,
option_window_x, option_window_y,
option_window_width, option_window_height
};
+ gui_window_set_scale(gw, 1.0);
gui_window_set_url(gw, "");
gui_window_set_pointer(gw, BROWSER_POINTER_DEFAULT);
gui_set_input_gui_window(gw);
@@ -345,6 +346,24 @@ void gui_window_set_status(struct gui_window *w, const char *text)
window_set_stauts(w->root, (char*)text);
}
+float gui_window_get_scale(struct gui_window *gw)
+{
+ return(gw->scale);
+}
+
+void gui_window_set_scale(struct gui_window *gw, float scale)
+{
+ int width = 0, heigth = 0;
+
+ LOG(("scale: %f", scale));
+
+ gw->scale = MAX(scale, 0.25);
+
+ browser_window_reload(gw->browser->bw, false);
+ gui_window_get_dimensions(gw, &width, &heigth, true);
+ browser_window_reformat(gw->browser->bw, false, width, heigth);
+}
+
void gui_window_redraw_window(struct gui_window *gw)
{
CMP_BROWSER b;
diff --git a/atari/gui.h b/atari/gui.h
index a1135e2e9..a1519f375 100755
--- a/atari/gui.h
+++ b/atari/gui.h
@@ -149,6 +149,7 @@ struct gui_window {
char * title;
char * url;
struct bitmap * icon;
+ float scale;
struct s_caret caret;
struct s_search_form_session *search;
struct gui_window *next, *prev;
diff --git a/atari/rootwin.c b/atari/rootwin.c
index fddd7d068..4b8c3bc7f 100755
--- a/atari/rootwin.c
+++ b/atari/rootwin.c
@@ -835,13 +835,14 @@ static void window_redraw_content(ROOTWIN *rootwin, GRECT *content_area,
struct rect redraw_area;
GRECT content_area_rel;
+ float oldscale = 1.0;
//dbg_grect("browser redraw, content area", content_area);
//dbg_grect("browser redraw, content clip", clip);
plot_set_dimensions(content_area->g_x, content_area->g_y,
content_area->g_w, content_area->g_h);
-
+ oldscale = plot_set_scale(gui_window_get_scale(rootwin->active_gui_window));
/* first, we make the coords relative to the content area: */
content_area_rel.g_x = clip->g_x - content_area->g_x;
@@ -872,6 +873,8 @@ static void window_redraw_content(ROOTWIN *rootwin, GRECT *content_area,
browser_window_redraw( bw, -(slid->x_pos*slid->x_unit_px),
-(slid->y_pos*slid->y_unit_px), &redraw_area, &rootwin_rdrw_ctx);
+
+ plot_set_scale(oldscale);
}
@@ -1398,6 +1401,7 @@ static void on_redraw(ROOTWIN *rootwin, short msg[8])
//dbg_grect("on_redraw", &clip);
if(gemtk_wm_get_state(rootwin->win) & GEMTK_WM_STATUS_ICONIFIED) {
+ // TODO: remove asignment:
GRECT clip = {msg[4], msg[5], msg[6], msg[7]};
window_redraw_favicon(rootwin, NULL);
} else {