Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
usermanual_url.c
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2018, 2020 rawfiner.
4 Copyright (C) 2020-2021 Aldric Renaudin.
5 Copyright (C) 2020-2021 Pascal Obry.
6 Copyright (C) 2021 Chris Elston.
7 Copyright (C) 2021 Hubert Kowalski.
8 Copyright (C) 2021 Jim Robinson.
9 Copyright (C) 2022-2023 Aurélien PIERRE.
10 Copyright (C) 2022 Diederik Ter Rahe.
11 Copyright (C) 2022 Martin Bařinka.
12
13 darktable is free software: you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 darktable is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with darktable. If not, see <http://www.gnu.org/licenses/>.
25*/
26
27#include "system/mem_alloc.h"
28#include "common/l10n.h"
29
30
31// The base_url is: ansel.photos/
32// The full format for the documentation pages is:
33// <base-url>/<lang>/doc[/path/to/page]
34// Where:
35// <lang> = en / fr ... (default = en)
36
37const char *base_url = "https://ansel.photos/";
38const char *doc_url = "doc/";
39
40
41const char *get_lang()
42{
43 char *lang = "en";
44
45 // array of languages the usermanual supports.
46 // NULL MUST remain the last element of the array
47 const char *supported_languages[] =
48 { "en", "fr", NULL };
49
50 int lang_index = 0;
51 gboolean is_language_supported = FALSE;
52
54 {
55 dt_l10n_language_t *language = NULL;
56
57 if(dt_l10n_get_global()->selected != -1)
58 language = (dt_l10n_language_t *)g_list_nth(dt_l10n_get_global()->languages, dt_l10n_get_global()->selected)->data;
59
60 if (!IS_NULL_PTR(language))
61 lang = language->code;
62
63 while(supported_languages[lang_index])
64 {
65 gchar *nlang = g_strdup(lang);
66 is_language_supported = !g_ascii_strcasecmp(nlang, supported_languages[lang_index]);
67
68 if(!is_language_supported)
69 {
70 // keep only first part up to _
71 for(gchar *p = nlang; *p; p++)
72 if(*p == '_') *p = '\0';
73
74 if(!g_ascii_strcasecmp(nlang, supported_languages[lang_index]))
75 {
76 is_language_supported = TRUE;
77 }
78 }
79
80 dt_free(nlang);
81 if(is_language_supported) break;
82
83 lang_index++;
84 }
85 }
86
87 // language not found, default to EN
88 if(!is_language_supported) lang_index = 0;
89
90 return supported_languages[lang_index];
91}
92
93typedef struct _help_url
94{
95 char *name;
96 char *url;
98
100{
101 {"ratings", "views/lighttable/digital-asset-management/star-color/#star-ratings"},
102 {"layout_filemanager", "views/lighttable/lighttable-modes/filemanager/"},
103 {"layout_zoomable", "views/lighttable/lighttable-modes/zoomable-lighttable/"},
104 {"layout_preview", "views/lighttable/lighttable-modes/full-preview/"},
105 {"filter", NULL},
106 {"colorlabels", "views/lighttable/digital-asset-management/star-color/#color-labels"},
107 {"import", "modules/utility-modules/lighttable/import/"},
108 {"select", "modules/utility-modules/lighttable/select/"},
109 {"image", "modules/utility-modules/lighttable/selected-image/"},
110 {"copy_history", "modules/utility-modules/lighttable/history-stack/"},
111 {"styles", "modules/utility-modules/lighttable/styles/#module-controls"},
112 {"metadata", "modules/utility-modules/shared/metadata-editor/"},
113 {"tagging", "modules/utility-modules/shared/tagging/"},
114 {"geotagging", "modules/utility-modules/shared/geotagging/"},
115 {"collect", "modules/utility-modules/shared/collections/"},
116 {"recentcollect", "modules/utility-modules/shared/recent-collections/"},
117 {"metadata_view", "modules/utility-modules/shared/image-information/"},
118 {"export", "modules/utility-modules/shared/export/"},
119 {"histogram", "modules/utility-modules/shared/histogram/"},
120 {"navigation", "modules/utility-modules/darkroom/navigation/"},
121 {"snapshots", "modules/utility-modules/darkroom/snapshots/"},
122 {"modulegroups", "modules/utility-modules/darkroom/manage-module-layouts/"},
123 {"history", "modules/utility-modules/darkroom/history-stack/"},
124 {"colorpicker", "modules/utility-modules/darkroom/global-color-picker/"},
125 {"shape_manager", "modules/utility-modules/darkroom/mask-manager/"},
126 {"masks_drawn", "views/darkroom/masking-and-blending/masks/drawn/"},
127 {"masks_parametric", "views/darkroom/masking-and-blending/masks/parametric/"},
128 {"masks_raster", "views/darkroom/masking-and-blending/masks/raster/"},
129 {"masks_blending_op", "views/darkroom/masking-and-blending/masks/drawn-and-parametric/"},
130 {"masks_blending", "views/darkroom/masking-and-blending/overview/"},
131 {"masks_combined", "views/darkroom/masking-and-blending/masks/drawn-and-parametric/"},
132 {"masks_refinement", "views/darkroom/masking-and-blending/masks/refinement-controls/"},
133 {"duplicate", "modules/utility-modules/darkroom/duplicate-manager/"},
134 {"location", "modules/utility-modules/map/find-location/"},
135 {"map_settings", "modules/utility-modules/map/map-settings/"},
136 {"print_settings", "modules/utility-modules/print/print-settings/"},
137 {"print_settings_printer" "modules/utility-modules/print/print-settings/#printer"},
138 {"print_settings_page" "modules/utility-modules/print/print-settings/#page"},
139 {"print_settings_button" "modules/utility-modules/print/print-settings/#print-button"},
140 {"print_overview", "print/overview/"},
141 {"camera", "modules/utility-modules/tethering/camera-settings/"},
142 {"import_camera", "overview/workflow/import-rate-tag/"},
143 {"import_fr", "overview/workflow/import-rate-tag/"},
144 {"global_toolbox", "overview/user-interface/top-panel/#on-the-right-hand-side"},
145 {"views/lighttable_mode", "views/lighttable/overview/"},
146 {"views/lighttable_filemanager", "views/lighttable/lighttable-modes/filemanager/"},
147 {"views/lighttable_zoomable", "views/lighttable/lighttable-modes/zoomable-lighttable/"},
148 {"views/darkroom_bottom_panel", "views/darkroom/darkroom-view-layout/#bottom-panel"},
149 {"module_header", "views/darkroom/processing-modules/module-header/"},
150 {"session", "modules/utility-modules/tethering/session/"},
151 {"live_view", "modules/utility-modules/tethering/live-view/"},
152 {"module_toolbox", NULL},
153 {"view_toolbox", NULL},
154 {"backgroundjobs", NULL},
155 {"hinter", NULL},
156 {"filter", NULL},
157 {"filmstrip", "overview/user-interface/filmstrip/"},
158 {"viewswitcher", "overview/user-interface/views/"},
159 {"favorite_presets", "views/darkroom/darkroom-view-layout/#bottom-panel"},
160 {"bottom_panel_styles", "views/darkroom/darkroom-view-layout/#bottom-panel"},
161 {"rawoverexposed", "modules/utility-modules/darkroom/raw-overexposed/"},
162 {"overexposed", "modules/utility-modules/darkroom/clipping/"},
163 {"softproof", "modules/utility-modules/darkroom/soft-proof/"},
164 {"gamut", "modules/utility-modules/darkroom/gamut/"},
165 {"focuspeaking", "modules/utility-modules/shared/focus-peaking/"},
166
167 // iop links
168 {"ashift", "modules/processing-modules/rotate-perspective/"},
169 {"atrous", "modules/processing-modules/contrast-equalizer/"},
170 {"basecurve", "modules/processing-modules/base-curve/"},
171 {"bilateral", "modules/processing-modules/surface-blur/"},
172 {"bilat", "modules/processing-modules/local-contrast/"},
173 {"bloom", "modules/processing-modules/bloom/"},
174 {"borders", "modules/processing-modules/framing/"},
175 {"cacorrect", "modules/processing-modules/raw-chromatic-aberrations/"},
176 {"cacorrectrgb", "modules/processing-modules/chromatic-aberrations/"},
177 {"censorize", "modules/processing-modules/censorize/"},
178 {"channelmixer", "modules/processing-modules/channel-mixer/"},
179 {"channelmixerrgb", "modules/processing-modules/color-calibration/"},
180 {"clipping", "modules/processing-modules/crop-rotate/"},
181 {"colisa", "modules/processing-modules/contrast-brightness-saturation/"},
182 {"colorbalance", "modules/processing-modules/color-balance/"},
183 {"colorbalancergb", "modules/processing-modules/color-balance-rgb/"},
184 {"colorchecker", "modules/processing-modules/color-look-up-table/"},
185 {"colorcontrast", "modules/processing-modules/color-contrast/"},
186 {"colorcorrection", "modules/processing-modules/color-correction/"},
187 {"colorin", "modules/processing-modules/input-color-profile/"},
188 {"colorize", "modules/processing-modules/colorize/"},
189 {"colormapping", "modules/processing-modules/color-mapping/"},
190 {"colorout", "modules/processing-modules/output-color-profile/"},
191 {"colorreconstruct", "modules/processing-modules/color-reconstruction/"},
192 {"colorzones", "modules/processing-modules/color-zones/"},
193 {"crop", "modules/processing-modules/crop/"},
194 {"defringe", "modules/processing-modules/defringe/"},
195 {"demosaic", "modules/processing-modules/demosaic/"},
196 {"denoiseprofile", "modules/processing-modules/denoise-profiled/"},
197 {"dither", "modules/processing-modules/dithering/"},
198 {"exposure", "modules/processing-modules/exposure/"},
199 {"filmic", "modules/processing-modules/filmic-rgb/"},
200 {"filmicrgb", "modules/processing-modules/filmic-rgb/"},
201 {"flip", "modules/processing-modules/orientation/"},
202 {"globaltonemap", "modules/processing-modules/global-tonemap/"},
203 {"graduatednd", "modules/processing-modules/graduated-density/"},
204 {"grain", "modules/processing-modules/grain/"},
205 {"hazeremoval", "modules/processing-modules/haze-removal/"},
206 {"highlights", "modules/processing-modules/highlight-reconstruction/"},
207 {"highpass", "modules/processing-modules/highpass/"},
208 {"hotpixels", "modules/processing-modules/hot-pixels/"},
209 {"invert", "modules/processing-modules/invert/"},
210 {"lens", "modules/processing-modules/lens-correction/"},
211 {"levels", "modules/processing-modules/levels/"},
212 {"liquify", "modules/processing-modules/liquify/"},
213 {"lowlight", "modules/processing-modules/lowlight-vision/"},
214 {"lowpass", "modules/processing-modules/lowpass/"},
215 {"lut3d", "modules/processing-modules/lut-3d/"},
216 {"monochrome", "modules/processing-modules/monochrome/"},
217 {"negadoctor", "modules/processing-modules/negadoctor/"},
218 {"nlmeans", "modules/processing-modules/astrophoto-denoise/"},
219 {"profile_gamma", "modules/processing-modules/unbreak-input-profile/"},
220 {"rawdenoise", "modules/processing-modules/raw-denoise/"},
221 {"rawprepare", "modules/processing-modules/raw-black-white-point/"},
222 {"relight", "modules/processing-modules/fill-light/"},
223 {"retouch", "modules/processing-modules/retouch/"},
224 {"rgbcurve", "modules/processing-modules/rgb-curve/"},
225 {"rgblevels", "modules/processing-modules/rgb-levels/"},
226 {"rotatepixels", "modules/processing-modules/rotate-pixels/"},
227 {"scalepixels", "modules/processing-modules/scale-pixels/"},
228 {"shadhi", "modules/processing-modules/shadows-and-highlights/"},
229 {"sharpen", "modules/processing-modules/sharpen/"},
230 {"soften", "modules/processing-modules/soften/"},
231 {"splittoning", "modules/processing-modules/split-toning/"},
232 {"spots", "modules/processing-modules/spot-removal/"},
233 {"temperature", "modules/processing-modules/white-balance/"},
234 {"tonecurve", "modules/processing-modules/tone-curve/"},
235 {"toneequal", "modules/processing-modules/tone-equalizer/"},
236 {"tonemap", "modules/processing-modules/tone-mapping/"},
237 {"velvia", "modules/processing-modules/velvia/"},
238 {"vibrance", "modules/processing-modules/vibrance/"},
239 {"vignette", "modules/processing-modules/vignetting/"},
240 {"watermark", "modules/processing-modules/watermark/"},
241 {"zonesystem", "modules/processing-modules/zone-system/"},
242};
243
245{
246 if(IS_NULL_PTR(name)) return NULL;
247
248 for(int k=0; k< sizeof(urls_db)/2/sizeof(char *); k++)
249 if(!strcmp(urls_db[k].name, name))
250 return g_build_path("/", base_url, get_lang(), doc_url, urls_db[k].url, NULL);
251
252 return NULL;
253}
254// clang-format off
255// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
256// vim: shiftwidth=2 expandtab tabstop=2 cindent
257// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
258// clang-format on
#define TRUE
Definition ashift_lsd.c:162
#define FALSE
Definition ashift_lsd.c:158
GHashTable * selected
set of checked row labels, mirrored to conf on every change
struct dt_l10n_t * dt_l10n_get_global(void)
Definition darktable.c:636
float *const restrict const size_t k
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
Definition macros.h:96
#define dt_free(ptr)
g_free() ptr and set it to NULL, skipping both if it is already NULL.
Definition mem_alloc.h:171
const char * name
Definition pdf.h:90
char * code
Definition l10n.h:30
int selected
Definition l10n.h:38
GList * languages
Definition l10n.h:37
const char * get_lang()
const char * base_url
const char * doc_url
struct _help_url dt_help_url
char * dt_get_help_url(char *name)
dt_help_url urls_db[]