diff options
author | Jose Diez <jose.manuel.diez@gmail.com> | 2015-11-11 16:18:00 +0000 |
---|---|---|
committer | Jose Diez <jose.manuel.diez@gmail.com> | 2015-11-11 16:18:00 +0000 |
commit | 587a51cf8b3a90063b8618b6e17b2aded01431c7 (patch) | |
tree | 0322dfc3684162d0770975d159ba61fd178d551c /src | |
parent | c53ca5a9c59626a90551e2eaa00ad3e4247b3734 (diff) | |
download | imv-587a51cf8b3a90063b8618b6e17b2aded01431c7.tar.gz |
viewport_reset -> viewport_scale_to_window, add viewport_scale_to_actual
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 5 | ||||
-rw-r--r-- | src/viewport.c | 6 | ||||
-rw-r--r-- | src/viewport.h | 1 |
3 files changed, 7 insertions, 5 deletions
@@ -188,7 +188,8 @@ int main(int argc, char** argv) case SDLK_MINUS: case SDLK_o: case SDLK_DOWN: imv_viewport_zoom(&view, -1); break; - case SDLK_r: imv_viewport_reset(&view); break; + case SDLK_a: imv_viewport_scale_to_actual(&view, &img);break; + case SDLK_r: imv_viewport_scale_to_window(&view, &img);break; case SDLK_c: imv_viewport_center(&view, &img); break; case SDLK_j: imv_viewport_move(&view, 0, -50); break; case SDLK_k: imv_viewport_move(&view, 0, 50); break; @@ -238,7 +239,7 @@ int main(int argc, char** argv) nav.cur_path + 1, nav.num_paths, img.width, img.height, current_path); imv_viewport_set_title(&view, title); - imv_viewport_reset(&view); + imv_viewport_scale_to_window(&view, &img); } if(g_options.center) { imv_viewport_center(&view, &img); diff --git a/src/viewport.c b/src/viewport.c index 46c6ae7..d97d97b 100644 --- a/src/viewport.c +++ b/src/viewport.c @@ -55,12 +55,12 @@ void imv_viewport_toggle_playing(struct imv_viewport *view, struct imv_image *im } } -void imv_viewport_reset(struct imv_viewport *view) +void imv_viewport_scale_to_actual(struct imv_viewport *view, const struct imv_image *img) { view->scale = 1; - view->x = view->y = 0; view->redraw = 1; - view->locked = 0; + view->locked = 1; + imv_viewport_center(view, img); } void imv_viewport_move(struct imv_viewport *view, int x, int y) diff --git a/src/viewport.h b/src/viewport.h index 5fb763a..8538e33 100644 --- a/src/viewport.h +++ b/src/viewport.h @@ -42,6 +42,7 @@ void imv_viewport_reset(struct imv_viewport*); void imv_viewport_move(struct imv_viewport*, int, int); void imv_viewport_zoom(struct imv_viewport*, int); void imv_viewport_center(struct imv_viewport*, const struct imv_image*); +void imv_viewport_scale_to_actual(struct imv_viewport*, const struct imv_image*); void imv_viewport_scale_to_window(struct imv_viewport*, const struct imv_image*); void imv_viewport_set_redraw(struct imv_viewport*); void imv_viewport_set_title(struct imv_viewport*, char*); |