Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
control.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2009-2021 darktable developers.
4
5 darktable is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 darktable is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with darktable. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#pragma once
20
21#include "common/darktable.h"
22#include "common/dtpthread.h"
23
24#include "control/settings.h"
25
26#include <gtk/gtk.h>
27#include <inttypes.h>
28#ifdef _OPENMP
29#include <omp.h>
30#endif
31
32#include "control/jobs.h"
33#include "control/progress.h"
34#include "libs/lib.h"
35#include <gtk/gtk.h>
36
37#ifdef _WIN32
38#include <shobjidl.h>
39#endif
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
46
47typedef GdkCursorType dt_cursor_t;
48
49// called from gui
50void *dt_control_expose(void *voidptr);
51void dt_control_button_pressed(double x, double y, double pressure, int which, int type, uint32_t state);
52void dt_control_button_released(double x, double y, int which, uint32_t state);
53void dt_control_mouse_moved(double x, double y, double pressure, int which);
54void dt_control_key_pressed(GdkEventKey *event);
57gboolean dt_control_configure(GtkWidget *da, GdkEventConfigure *event, gpointer user_data);
58void dt_control_log(const char *msg, ...) __attribute__((format(printf, 1, 2)));
59void dt_toast_log(const char *msg, ...) __attribute__((format(printf, 1, 2)));
60void dt_toast_markup_log(const char *msg, ...) __attribute__((format(printf, 1, 2)));
65void dt_control_draw_busy_msg(cairo_t *cr, int width, int height);
66// disable the possibility to change the cursor shape with dt_control_change_cursor
68// enable the possibility to change the cursor shape with dt_control_change_cursor
73
80
86
92
97
102
107
108void dt_ctl_switch_mode_to(const char *mode);
110void dt_ctl_reload_view(const char *mode);
111
112struct dt_control_t;
113
115void dt_control_hinter_message(const struct dt_control_t *s, const char *message);
116
117#define DT_CTL_LOG_SIZE 10
118#define DT_CTL_LOG_MSG_SIZE 1000
119#define DT_CTL_LOG_TIMEOUT 8000
120#define DT_CTL_TOAST_SIZE 10
121#define DT_CTL_TOAST_MSG_SIZE 300
122#define DT_CTL_TOAST_TIMEOUT 5000
128typedef struct dt_control_t
129{
130 // gui related stuff
131 double tabborder;
132 int32_t width, height;
133 pthread_t gui_thread;
140
141 // message log
146 dt_pthread_mutex_t log_mutex;
147
148 // toast log
153 dt_pthread_mutex_t toast_mutex;
154
155 // gui settings
156 dt_pthread_mutex_t global_mutex, image_mutex;
158
159 // job management
160 int32_t running;
162 dt_pthread_mutex_t queue_mutex, cond_mutex, run_mutex;
163 pthread_cond_t cond;
164 int32_t num_threads;
167
170
171 dt_pthread_mutex_t res_mutex;
175
176 struct
177 {
178 GList *list;
182 dt_pthread_mutex_t mutex;
183
184#ifdef _WIN32
185 ITaskbarList3 *taskbarlist;
186#endif
187
188 // these proxy functions should ONLY be used by control/process.c!
189 struct
190 {
191 dt_lib_module_t *module;
192 void *(*added)(dt_lib_module_t *self, gboolean has_progress_bar, const gchar *message);
195 dt_progress_t *progress);
196 void (*updated)(dt_lib_module_t *self, struct dt_lib_backgroundjob_element_t *instance, double value);
198 const char *message);
200
202
203 /* proxy */
204 // TODO: this is unused now, but deleting it makes free(darktable.control)
205 // segfault on double free or corruption. Find out why.
206 struct
207 {
208
209 struct
210 {
211 dt_lib_module_t *module;
212 void (*set_message)(dt_lib_module_t *self, const gchar *message);
214
216
218
220
221// join all worker threads.
224
225// call this to quit dt
226void dt_control_quit();
227
230
231// thread-safe interface between core and gui.
232// is the locking really needed?
234void dt_control_set_mouse_over_id(int32_t value);
235
237void dt_control_set_keyboard_over_id(int32_t value);
238
239#ifdef __cplusplus
240}
241#endif
242
243// clang-format off
244// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
245// vim: shiftwidth=2 expandtab tabstop=2 cindent
246// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
247// clang-format on
int width
Definition bilateral.h:1
int height
Definition bilateral.h:1
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
int type
Definition common/metadata.c:42
void dt_ctl_switch_mode_to(const char *mode)
Definition control.c:316
void dt_control_key_pressed(GdkEventKey *event)
Definition control.c:278
void dt_control_init(dt_control_t *s)
Definition control.c:46
int32_t dt_control_get_mouse_over_id()
Definition control.c:559
void dt_control_draw_busy_msg(cairo_t *cr, int width, int height)
Definition control.c:181
void dt_control_button_pressed(double x, double y, double pressure, int which, int type, uint32_t state)
Definition control.c:365
void * dt_control_expose(void *voidptr)
Definition control.c:210
void dt_ctl_switch_mode_to_by_view(const dt_view_t *view)
Definition control.c:329
void dt_control_set_mouse_over_id(int32_t value)
Definition control.c:567
#define DT_CTL_TOAST_SIZE
Definition control.h:120
void dt_control_forbid_change_cursor()
Definition control.c:80
#define DT_CTL_TOAST_MSG_SIZE
Definition control.h:121
void dt_control_change_cursor(dt_cursor_t cursor)
Definition control.c:90
void dt_control_queue_redraw_center()
request redraw of center window. This redraws the center view within a gdk critical section to preven...
Definition control.c:520
void dt_control_write_sidecar_files()
Definition control_jobs.c:260
void dt_control_quit()
Definition control.c:111
void dt_control_mouse_leave()
Definition control.c:263
void dt_control_toast_busy_enter()
Definition control.c:491
void dt_control_shutdown(dt_control_t *s)
Definition control.c:124
void dt_control_log_busy_leave()
Definition control.c:499
gboolean dt_control_configure(GtkWidget *da, GdkEventConfigure *event, gpointer user_data)
Definition control.c:166
void void dt_toast_log(const char *msg,...) __attribute__((format(printf
void dt_control_cleanup(dt_control_t *s)
Definition control.c:146
void dt_control_button_released(double x, double y, int which, uint32_t state)
Definition control.c:283
void dt_control_allow_change_cursor()
Definition control.c:85
int dt_control_running()
Definition control.c:101
void dt_control_mouse_moved(double x, double y, double pressure, int which)
Definition control.c:273
#define DT_CTL_LOG_SIZE
Definition control.h:117
void void void void dt_control_log_busy_enter()
Definition control.c:483
void dt_control_log(const char *msg,...) __attribute__((format(printf
#define DT_CTL_LOG_MSG_SIZE
Definition control.h:118
void dt_control_delete_images()
Definition control_jobs.c:1588
void dt_ctl_reload_view(const char *mode)
Definition control.c:335
void dt_control_queue_redraw_widget(GtkWidget *widget)
threadsafe request of redraw of specific widget. Use this function if you need to redraw a specific w...
Definition control.c:546
void dt_control_hinter_message(const struct dt_control_t *s, const char *message)
Definition control.c:554
int32_t dt_control_get_keyboard_over_id()
Definition control.c:585
void dt_control_toast_redraw()
request redraw of the toast widget. This redraws the message label.
Definition control.c:535
void dt_control_mouse_enter()
Definition control.c:268
void dt_control_log_redraw()
request redraw of the log widget. This redraws the message label.
Definition control.c:530
void dt_control_navigation_redraw()
request redraw of the navigation widget. This redraws the wiget of the navigation module.
Definition control.c:525
void void void dt_toast_markup_log(const char *msg,...) __attribute__((format(printf
void dt_control_toast_busy_leave()
Definition control.c:507
GdkCursorType dt_cursor_t
Definition control.h:47
void dt_control_queue_redraw()
request redraw of the workspace. This redraws the whole workspace within a gdk critical section to pr...
Definition control.c:515
void dt_control_set_keyboard_over_id(int32_t value)
Definition control.c:593
uint32_t view(const dt_view_t *self)
Definition darkroom.c:122
@ DT_JOB_QUEUE_MAX
Definition jobs.h:49
#define DT_CTL_WORKER_RESERVED
Definition jobs.h:27
Definition jobs.c:46
Definition progress.c:42
Definition control.h:129
double tabborder
Definition control.h:131
gboolean lock_cursor_shape
Definition control.h:139
pthread_t * thread
Definition control.h:165
dt_pthread_mutex_t mutex
Definition control.h:182
dt_pthread_mutex_t run_mutex
Definition control.h:162
double last_expose_time
Definition control.h:157
int32_t height
Definition control.h:132
int32_t num_threads
Definition control.h:164
int32_t running
Definition control.h:160
int log_ack
Definition control.h:142
struct dt_control_t::@12::@14 proxy
int button_down_which
Definition control.h:134
dt_pthread_mutex_t image_mutex
Definition control.h:156
dt_lib_module_t *void(* set_message)(dt_lib_module_t *self, const gchar *message)
Definition control.h:212
void(* destroyed)(dt_lib_module_t *self, struct dt_lib_backgroundjob_element_t *instance)
Definition control.h:193
double button_y
Definition control.h:135
GList * queues[DT_JOB_QUEUE_MAX]
Definition control.h:168
struct dt_control_t::@13::@15 hinter
int button_type
Definition control.h:134
int toast_ack
Definition control.h:149
char toast_message[10][300]
Definition control.h:150
gboolean export_scheduled
Definition control.h:161
int history_start
Definition control.h:136
int log_pos
Definition control.h:142
GList * list
Definition control.h:178
void(* message_updated)(dt_lib_module_t *self, struct dt_lib_backgroundjob_element_t *instance, const char *message)
Definition control.h:197
int toast_busy
Definition control.h:152
pthread_t thread_res[DT_CTL_WORKER_RESERVED]
Definition control.h:174
dt_pthread_mutex_t log_mutex
Definition control.h:146
int32_t width
Definition control.h:132
void(* updated)(dt_lib_module_t *self, struct dt_lib_backgroundjob_element_t *instance, double value)
Definition control.h:196
pthread_cond_t cond
Definition control.h:163
guint log_message_timeout_id
Definition control.h:144
guint toast_message_timeout_id
Definition control.h:151
size_t list_length
Definition control.h:179
dt_pthread_mutex_t res_mutex
Definition control.h:171
double global_progress
Definition control.h:181
int toast_pos
Definition control.h:149
pthread_t kick_on_workers_thread
Definition control.h:165
int32_t mouse_over_id
Definition control.h:137
dt_pthread_mutex_t queue_mutex
Definition control.h:162
uint8_t new_res[DT_CTL_WORKER_RESERVED]
Definition control.h:173
dt_job_t * job_res[DT_CTL_WORKER_RESERVED]
Definition control.h:172
dt_pthread_mutex_t toast_mutex
Definition control.h:153
struct dt_control_t::@12 progress_system
int log_busy
Definition control.h:145
int32_t keyboard_over_id
Definition control.h:138
char log_message[10][1000]
Definition control.h:143
double button_x
Definition control.h:135
dt_pthread_mutex_t cond_mutex
Definition control.h:162
dt_pthread_mutex_t global_mutex
Definition control.h:156
void(* cancellable)(dt_lib_module_t *self, struct dt_lib_backgroundjob_element_t *instance, dt_progress_t *progress)
Definition control.h:194
size_t queue_length[DT_JOB_QUEUE_MAX]
Definition control.h:169
dt_job_t ** job
Definition control.h:166
pthread_t gui_thread
Definition control.h:133
size_t n_progress_bar
Definition control.h:180
int button_down
Definition control.h:134
Definition backgroundjobs.c:35
GtkWidget * widget
Definition backgroundjobs.c:36
Definition libs/lib.h:75
Definition views/view.h:95
static float __attribute__((__unused__))
Definition thinplate.c:39