3 weeks ago
add UIIMAGE type
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | * |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | * Copyright 2024 Olaf Wintermann. All rights reserved. |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | * |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | * |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | * |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | #include "image.h" |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | #include "container.h" |
389
d15eca5fd8b3
implement image viewer context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
381
diff
changeset
|
32 | #include "menu.h" |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | #include "../common/context.h" |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | #include "../common/object.h" |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
36 | static void imageviewer_destroy(UiImageViewer *iv) { |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
37 | if(iv->pixbuf) { |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
38 | g_object_unref(iv->pixbuf); |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
39 | } |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
40 | free(iv); |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
41 | } |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
42 | |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
43 | #if GTK_MAJOR_VERSION >= 4 |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
44 | |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
45 | static void imageviewer_draw( |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
46 | GtkDrawingArea *drawingarea, |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
47 | cairo_t *cr, |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
48 | int width, |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
49 | int height, |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
50 | gpointer userdata) |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
51 | { |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
52 | ui_cairo_draw_image(userdata, cr, width, height); |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
53 | } |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
54 | |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
55 | #else |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
56 | |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
57 | static gboolean imageviewer_draw(GtkWidget *widget, cairo_t *cr, gpointer userdata) { |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
58 | int width = gtk_widget_get_allocated_width(widget); |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
59 | int height = gtk_widget_get_allocated_height(widget); |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
60 | ui_cairo_draw_image(userdata, cr, width, height); |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
61 | return FALSE; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
62 | } |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
63 | |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
64 | #endif |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | UIWIDGET ui_imageviewer_create(UiObject *obj, UiImageViewerArgs args) { |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | UiObject *current = uic_current_obj(obj); |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
69 | GtkWidget *drawingarea = gtk_drawing_area_new(); |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
70 | GtkWidget *toplevel; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
71 | GtkWidget *widget = drawingarea; |
530
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
72 | |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
73 | gtk_widget_set_size_request(drawingarea, 100, 100); |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
74 | |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
75 | #if GTK_MAJOR_VERSION < 4 |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
76 | GtkWidget *eventbox = gtk_event_box_new(); |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
77 | gtk_container_add(GTK_CONTAINER(eventbox), drawingarea); |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
78 | widget = eventbox; |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
79 | #endif |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
80 | |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
81 | if(args.scrollarea) { |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
82 | toplevel = SCROLLEDWINDOW_NEW(); |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
83 | SCROLLEDWINDOW_SET_CHILD(toplevel, widget); |
532
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
84 | args.adjustwidgetsize = TRUE; |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
85 | } else { |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
86 | toplevel = widget; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
87 | } |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
88 | |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
89 | UiImageViewer *imgviewer = malloc(sizeof(UiImageViewer)); |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
90 | memset(imgviewer, 0, sizeof(UiImageViewer)); |
547
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
91 | imgviewer->obj = obj; |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
92 | imgviewer->onbuttonpress = args.onbuttonpress; |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
93 | imgviewer->onbuttonpressdata = args.onbuttonpressdata; |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
94 | imgviewer->onbuttonrelease = args.onbuttonrelease; |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
95 | imgviewer->onbuttonreleasedata = args.onbuttonreleasedata; |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
96 | if(args.image_padding > 0) { |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
97 | imgviewer->padding_left = args.image_padding; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
98 | imgviewer->padding_right = args.image_padding; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
99 | imgviewer->padding_top = args.image_padding; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
100 | imgviewer->padding_bottom = args.image_padding; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
101 | } else { |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
102 | imgviewer->padding_left = args.image_padding_left; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
103 | imgviewer->padding_right = args.image_padding_right; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
104 | imgviewer->padding_top = args.image_padding_top; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
105 | imgviewer->padding_bottom = args.image_padding_bottom; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
106 | } |
532
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
107 | imgviewer->adjustwidgetsize = args.adjustwidgetsize; |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
108 | imgviewer->autoscale = args.autoscale; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
109 | imgviewer->useradjustable = args.useradjustable; |
530
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
110 | imgviewer->zoom_scale = 20; |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
111 | |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
112 | g_object_set_data_full(G_OBJECT(drawingarea), "uiimageviewer", imgviewer, (GDestroyNotify)imageviewer_destroy); |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
113 | |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
114 | UiVar *var = uic_widget_var(obj->ctx, current->ctx, args.value, args.varname, UI_VAR_GENERIC); |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
115 | imgviewer->var = var; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
116 | imgviewer->widget = drawingarea; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
117 | |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
118 | if(var) { |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
119 | UiGeneric *value = var->value; |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
120 | value->get = ui_imageviewer_get; |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
121 | value->get_type = ui_imageviewer_get_type; |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
122 | value->set = ui_imageviewer_set; |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
123 | value->obj = imgviewer; |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
124 | if(value->value && value->type && !strcmp(value->type, UI_IMAGE_OBJECT_TYPE)) { |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
125 | GdkPixbuf *pixbuf = value->value; |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
126 | value->value = NULL; |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
127 | ui_imageviewer_set(value, pixbuf, UI_IMAGE_OBJECT_TYPE); |
548
198756ab2845
add UIIMAGE type
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
547
diff
changeset
|
128 | g_object_unref(pixbuf); |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
129 | } |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
130 | } |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
131 | |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
132 | #if GTK_MAJOR_VERSION >= 4 |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
133 | gtk_drawing_area_set_draw_func( |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
134 | GTK_DRAWING_AREA(drawingarea), |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
135 | imageviewer_draw, |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
136 | imgviewer, |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
137 | NULL); |
530
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
138 | |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
139 | if(args.useradjustable) { |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
140 | gtk_widget_set_focusable(drawingarea, TRUE); |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
141 | } |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
142 | |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
143 | GtkEventController *scrollcontroller = gtk_event_controller_scroll_new(GTK_EVENT_CONTROLLER_SCROLL_VERTICAL); |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
144 | g_signal_connect(scrollcontroller, "scroll", G_CALLBACK(ui_imageviewer_scroll), imgviewer); |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
145 | gtk_widget_add_controller(GTK_WIDGET(drawingarea), GTK_EVENT_CONTROLLER(scrollcontroller)); |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
146 | |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
147 | GtkGesture *drag = gtk_gesture_drag_new(); |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
148 | g_signal_connect(drag, "drag-begin", G_CALLBACK(ui_imageviewer_drag_begin_cb), imgviewer); |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
149 | g_signal_connect(drag, "drag-end", G_CALLBACK(ui_imageviewer_drag_end_cb), imgviewer); |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
150 | g_signal_connect(drag, "drag-update", G_CALLBACK(ui_imageviewer_drag_update_cb), imgviewer); |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
151 | gtk_widget_add_controller(GTK_WIDGET(drawingarea), GTK_EVENT_CONTROLLER(drag)); |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
152 | |
547
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
153 | GtkGesture *click = gtk_gesture_click_new(); |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
154 | g_signal_connect(click, "pressed", G_CALLBACK(ui_imageviewer_pressed_cb), imgviewer); |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
155 | g_signal_connect(click, "released", G_CALLBACK(ui_imageviewer_released_cb), imgviewer); |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
156 | gtk_widget_add_controller(GTK_WIDGET(drawingarea), GTK_EVENT_CONTROLLER(click)); |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
157 | |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
158 | #elif GTK_MAJOR_VERSION == 3 |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
159 | g_signal_connect( |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
160 | drawingarea, |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
161 | "draw", |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
162 | G_CALLBACK(imageviewer_draw), |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
163 | imgviewer); |
530
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
164 | |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
165 | gtk_widget_add_events(eventbox, GDK_SCROLL_MASK); |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
166 | |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
167 | g_signal_connect( |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
168 | eventbox, |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
169 | "scroll-event", |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
170 | G_CALLBACK(ui_imageviewer_scroll_event), |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
171 | imgviewer); |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
172 | g_signal_connect( |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
173 | eventbox, |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
174 | "button-press-event", |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
175 | G_CALLBACK(ui_imageviewer_button_press_event), |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
176 | imgviewer); |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
177 | g_signal_connect( |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
178 | eventbox, |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
179 | "button-release-event", |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
180 | G_CALLBACK(ui_imageviewer_button_release_event), |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
181 | imgviewer); |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
182 | |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
183 | #endif |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
184 | |
389
d15eca5fd8b3
implement image viewer context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
381
diff
changeset
|
185 | if(args.contextmenu) { |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
186 | UIMENU menu = ui_contextmenu_create(args.contextmenu, obj, widget); |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
187 | ui_widget_set_contextmenu(widget, menu); |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
188 | } |
530
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
189 | |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
190 | UI_APPLY_LAYOUT1(current, args); |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
191 | current->container->add(current->container, toplevel, TRUE); |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
192 | |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
193 | return toplevel; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
194 | } |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
195 | |
532
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
196 | static void imageviewer_reset(UiImageViewer *imgviewer) { |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
197 | imgviewer->isautoscaled = FALSE; |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
198 | imgviewer->transx = 0; |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
199 | imgviewer->transy; |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
200 | imgviewer->begin_transx = 0; |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
201 | imgviewer->begin_transy = 0; |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
202 | imgviewer->scale = 1; |
533
951b92ce3708
replace imageviewer integer zoom with fp userscale setting
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
532
diff
changeset
|
203 | imgviewer->user_scale = 1; |
532
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
204 | } |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
205 | |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
206 | UIWIDGET ui_imageviewer_reset(UIWIDGET w) { |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
207 | UiImageViewer *imgviewer = g_object_get_data(G_OBJECT(w), "uiimageviewer"); |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
208 | if(imgviewer) { |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
209 | imageviewer_reset(imgviewer); |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
210 | gtk_widget_queue_draw(w); |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
211 | } |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
212 | } |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
213 | |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
214 | UIWIDGET ui_imageviewer_set_autoscale(UIWIDGET w, UiBool set) { |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
215 | UiImageViewer *imgviewer = g_object_get_data(G_OBJECT(w), "uiimageviewer"); |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
216 | if(imgviewer) { |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
217 | imgviewer->autoscale = set; |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
218 | } |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
219 | } |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
220 | |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
221 | UIWIDGET ui_imageviewer_set_adjustwidgetsize(UIWIDGET w, UiBool set) { |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
222 | UiImageViewer *imgviewer = g_object_get_data(G_OBJECT(w), "uiimageviewer"); |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
223 | if(imgviewer) { |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
224 | imgviewer->adjustwidgetsize = set; |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
225 | } |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
226 | } |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
227 | |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
228 | UIWIDGET ui_imageviewer_set_useradjustable(UIWIDGET w, UiBool set) { |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
229 | UiImageViewer *imgviewer = g_object_get_data(G_OBJECT(w), "uiimageviewer"); |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
230 | if(imgviewer) { |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
231 | imgviewer->useradjustable = set; |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
232 | } |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
233 | } |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
234 | |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
235 | void ui_cairo_draw_image(UiImageViewer *imgviewer, cairo_t *cr, int width, int height) { |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
236 | if(!imgviewer->pixbuf) { |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
237 | return; |
389
d15eca5fd8b3
implement image viewer context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
381
diff
changeset
|
238 | } |
d15eca5fd8b3
implement image viewer context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
381
diff
changeset
|
239 | |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
240 | GdkPixbuf *pixbuf = imgviewer->pixbuf; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
241 | double dpixwidth = (double)gdk_pixbuf_get_width(pixbuf); |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
242 | double dpixheight = (double)gdk_pixbuf_get_height(pixbuf); |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
243 | |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
244 | double dwidth = width; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
245 | double dheight = height; |
530
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
246 | double scale = 1; |
532
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
247 | // if autoscale is enabled, scale the image to fill available space |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
248 | // if useradjustable is also enabled, the autoscaling is only done once |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
249 | if(imgviewer->autoscale && imgviewer->scale != 0) { |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
250 | if(!imgviewer->isautoscaled) { |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
251 | scale = dwidth / dpixwidth; |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
252 | if(dpixheight * scale > dheight) { |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
253 | scale = dheight / dpixheight; |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
254 | } |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
255 | |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
256 | if(imgviewer->useradjustable) { |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
257 | imgviewer->isautoscaled = TRUE; |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
258 | } |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
259 | |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
260 | imgviewer->scale = scale; |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
261 | } else { |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
262 | scale = imgviewer->scale; |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
263 | } |
533
951b92ce3708
replace imageviewer integer zoom with fp userscale setting
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
532
diff
changeset
|
264 | |
951b92ce3708
replace imageviewer integer zoom with fp userscale setting
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
532
diff
changeset
|
265 | imgviewer->user_scale = scale; |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
266 | } else { |
532
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
267 | // user-adjusted scaling |
533
951b92ce3708
replace imageviewer integer zoom with fp userscale setting
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
532
diff
changeset
|
268 | //scale = 1 + ((double)imgviewer->zoom / (double)imgviewer->zoom_scale); |
951b92ce3708
replace imageviewer integer zoom with fp userscale setting
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
532
diff
changeset
|
269 | scale = imgviewer->user_scale; |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
270 | } |
530
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
271 | |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
272 | dpixwidth *= scale; |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
273 | dpixheight *= scale; |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
274 | double x = (dwidth - dpixwidth) / 2; |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
275 | double y = (dheight - dpixheight) / 2; |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
276 | |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
277 | x += imgviewer->transx; |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
278 | y += imgviewer->transy; |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
279 | |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
280 | cairo_translate(cr, x, y); |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
281 | cairo_scale(cr, scale, scale); |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
282 | |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
283 | gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0); |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
284 | cairo_paint(cr); |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
285 | } |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
286 | |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
287 | void* ui_imageviewer_get(UiGeneric *g) { |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
288 | UiImageViewer *imgviewer = g->obj; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
289 | g->value = imgviewer->pixbuf; |
340
2dd42bd4fe5d
add imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
339
diff
changeset
|
290 | return g->value; |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
291 | } |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
292 | |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
293 | const char* ui_imageviewer_get_type(UiGeneric *g) { |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
294 | return UI_IMAGE_OBJECT_TYPE; |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
295 | } |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
296 | |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
297 | int ui_imageviewer_set(UiGeneric *g, void *value, const char *type) { |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
298 | if(!type || strcmp(type, UI_IMAGE_OBJECT_TYPE)) { |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
299 | return 1; |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
300 | } |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
301 | |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
302 | GdkPixbuf *pixbuf = value; |
548
198756ab2845
add UIIMAGE type
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
547
diff
changeset
|
303 | g_object_ref(pixbuf); |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
304 | |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
305 | UiImageViewer *imgviewer = g->obj; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
306 | g->value = pixbuf; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
307 | |
532
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
308 | imageviewer_reset(imgviewer); |
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
309 | |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
310 | if(imgviewer->pixbuf) { |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
311 | g_object_unref(imgviewer->pixbuf); |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
312 | } |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
313 | imgviewer->pixbuf = pixbuf; |
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
314 | |
532
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
315 | if(imgviewer->adjustwidgetsize && !imgviewer->autoscale) { |
381
b47bda6666ce
fix gtk3 image loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
316 | int width = gdk_pixbuf_get_width(pixbuf); |
b47bda6666ce
fix gtk3 image loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
317 | int height = gdk_pixbuf_get_height(pixbuf); |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
318 | gtk_widget_set_size_request(imgviewer->widget, width, height); |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
319 | } |
529
0a4a6b0d1c82
add new imageviewer implementation (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
320 | gtk_widget_queue_draw(imgviewer->widget); |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
321 | |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
322 | return 0; |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
323 | } |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
324 | |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
325 | |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
326 | |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
327 | int ui_image_load_file(UiGeneric *obj, const char *path) { |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
328 | GError *error = NULL; |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
329 | GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(path, &error); |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
330 | if(!pixbuf) { |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
331 | return 1; |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
332 | } |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
333 | |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
334 | if(obj->set) { |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
335 | obj->set(obj, pixbuf, UI_IMAGE_OBJECT_TYPE); |
548
198756ab2845
add UIIMAGE type
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
547
diff
changeset
|
336 | g_object_unref(pixbuf); |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
337 | } else { |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
338 | obj->value = pixbuf; |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
339 | } |
548
198756ab2845
add UIIMAGE type
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
547
diff
changeset
|
340 | |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
341 | return 0; |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
342 | } |
530
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
343 | |
548
198756ab2845
add UIIMAGE type
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
547
diff
changeset
|
344 | void ui_image_ref(UIIMAGE img) { |
198756ab2845
add UIIMAGE type
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
547
diff
changeset
|
345 | g_object_ref(img); |
198756ab2845
add UIIMAGE type
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
547
diff
changeset
|
346 | } |
198756ab2845
add UIIMAGE type
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
547
diff
changeset
|
347 | |
198756ab2845
add UIIMAGE type
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
547
diff
changeset
|
348 | void ui_image_unref(UIIMAGE img) { |
198756ab2845
add UIIMAGE type
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
547
diff
changeset
|
349 | g_object_unref(img); |
198756ab2845
add UIIMAGE type
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
547
diff
changeset
|
350 | } |
198756ab2845
add UIIMAGE type
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
547
diff
changeset
|
351 | |
530
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
352 | #if GTK_MAJOR_VERSION >= 4 |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
353 | |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
354 | gboolean ui_imageviewer_scroll( |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
355 | GtkEventControllerScroll *widget, |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
356 | gdouble dx, |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
357 | gdouble dy, |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
358 | gpointer userdata) |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
359 | { |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
360 | UiImageViewer *imgviewer = userdata; |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
361 | if(imgviewer->useradjustable) { |
533
951b92ce3708
replace imageviewer integer zoom with fp userscale setting
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
532
diff
changeset
|
362 | double step = dy / imgviewer->zoom_scale; |
951b92ce3708
replace imageviewer integer zoom with fp userscale setting
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
532
diff
changeset
|
363 | if(imgviewer->user_scale - step > 0) { |
951b92ce3708
replace imageviewer integer zoom with fp userscale setting
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
532
diff
changeset
|
364 | imgviewer->user_scale -= step; |
530
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
365 | } |
533
951b92ce3708
replace imageviewer integer zoom with fp userscale setting
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
532
diff
changeset
|
366 | |
532
80a6d8923d75
allow autoscale + useradjustable in imageviewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
530
diff
changeset
|
367 | imgviewer->scale = 0; // disable autoscale |
530
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
368 | gtk_widget_queue_draw(imgviewer->widget); |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
369 | return TRUE; |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
370 | } |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
371 | return FALSE; |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
372 | } |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
373 | |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
374 | void ui_imageviewer_drag_begin_cb( |
547
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
375 | GtkGestureDrag *self, |
530
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
376 | gdouble start_x, |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
377 | gdouble start_y, |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
378 | gpointer userdata) |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
379 | { |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
380 | UiImageViewer *imgviewer = userdata; |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
381 | imgviewer->begin_transx = imgviewer->transx; |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
382 | imgviewer->begin_transy = imgviewer->transy; |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
383 | } |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
384 | |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
385 | void ui_imageviewer_drag_end_cb( |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
386 | GtkGestureDrag* self, |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
387 | gdouble x, |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
388 | gdouble y, |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
389 | gpointer userdata) |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
390 | { |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
391 | |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
392 | } |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
393 | |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
394 | void ui_imageviewer_drag_update_cb( |
547
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
395 | GtkGestureDrag *self, |
530
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
396 | gdouble x, |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
397 | gdouble y, |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
398 | gpointer userdata) |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
399 | { |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
400 | UiImageViewer *imgviewer = userdata; |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
401 | if(imgviewer->useradjustable) { |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
402 | imgviewer->transx = imgviewer->begin_transx + x; |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
403 | imgviewer->transy = imgviewer->begin_transy + y; |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
404 | gtk_widget_queue_draw(imgviewer->widget); |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
405 | } |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
406 | } |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
407 | |
547
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
408 | static void imgviewer_button_event( |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
409 | GtkGestureClick *gesture, |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
410 | UiImageViewer *imgviewer, |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
411 | ui_callback callback, |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
412 | void *userdata) |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
413 | { |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
414 | UiEvent event; |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
415 | event.obj = imgviewer->obj; |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
416 | event.window = event.obj->window; |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
417 | event.document = event.obj->ctx->document; |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
418 | event.eventdata = NULL; |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
419 | event.intval = gtk_gesture_single_get_current_button(GTK_GESTURE_SINGLE(gesture)); |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
420 | event.set = 0; |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
421 | callback(&event, userdata); |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
422 | } |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
423 | |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
424 | void ui_imageviewer_pressed_cb( |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
425 | GtkGestureClick *self, |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
426 | gint n_press, |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
427 | gdouble x, |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
428 | gdouble y, |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
429 | gpointer userdata) |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
430 | { |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
431 | UiImageViewer *imgviewer = userdata; |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
432 | if(imgviewer->onbuttonpress) { |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
433 | imgviewer_button_event(self, imgviewer, imgviewer->onbuttonpress, imgviewer->onbuttonpressdata); |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
434 | } |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
435 | } |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
436 | |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
437 | void ui_imageviewer_released_cb( |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
438 | GtkGestureClick *self, |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
439 | gint n_press, |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
440 | gdouble x, |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
441 | gdouble y, |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
442 | gpointer userdata) |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
443 | { |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
444 | UiImageViewer *imgviewer = userdata; |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
445 | if(imgviewer->onbuttonrelease) { |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
446 | imgviewer_button_event(self, imgviewer, imgviewer->onbuttonrelease, imgviewer->onbuttonreleasedata); |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
447 | } |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
448 | } |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
449 | |
530
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
450 | #else |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
451 | |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
452 | gboolean ui_imageviewer_scroll_event( |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
453 | GtkWidget *widget, |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
454 | GdkEventScroll event, |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
455 | gpointer userdata) |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
456 | { |
547
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
457 | // TODO |
530
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
458 | return FALSE; |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
459 | } |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
460 | |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
461 | gboolean ui_imageviewer_button_press_event( |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
462 | GtkWidget *widget, |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
463 | GdkEventButton event, |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
464 | gpointer userdata) |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
465 | { |
547
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
466 | // TODO |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
467 | return FALSE; |
530
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
468 | } |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
469 | |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
470 | gboolean ui_imageviewer_button_release_event( |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
471 | GtkWidget *widget, |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
472 | GdkEventButton event, |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
473 | gpointer userdata) |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
474 | { |
547
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
475 | // TODO |
631162b266d1
add imgviewer button press/release callbacks (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
533
diff
changeset
|
476 | return FALSE; |
530
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
477 | } |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
478 | |
7992a44fe719
implement imageviewer useradjustable setting in gtk4 implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
529
diff
changeset
|
479 | #endif |