本文整理汇总了C++中dt_loc_get_user_config_dir函数的典型用法代码示例。如果您正苦于以下问题:C++ dt_loc_get_user_config_dir函数的具体用法?C++ dt_loc_get_user_config_dir怎么用?C++ dt_loc_get_user_config_dir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dt_loc_get_user_config_dir函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dt_lua_init
void dt_lua_init(lua_State*L,const int init_gui)
{
char tmp_path[PATH_MAX];
// init the lua environment
lua_CFunction* cur_type = init_funcs;
while(*cur_type)
{
(*cur_type)(L);
cur_type++;
}
dt_lua_push_darktable_lib(L);
// build the table containing the configuration info
lua_getglobal(L,"package");
dt_lua_goto_subtable(L,"loaded");
lua_pushstring(L,"darktable");
dt_lua_push_darktable_lib(L);
lua_settable(L,-3);
lua_pop(L,1);
lua_getglobal(L,"package");
lua_getfield(L,-1,"path");
lua_pushstring(L,";");
dt_loc_get_datadir(tmp_path, PATH_MAX);
lua_pushstring(L,tmp_path);
lua_pushstring(L,"/lua/?.lua");
lua_pushstring(L,";");
dt_loc_get_user_config_dir(tmp_path, PATH_MAX);
lua_pushstring(L,tmp_path);
lua_pushstring(L,"/lua/?.lua");
lua_concat(L,7);
lua_setfield(L,-2,"path");
lua_pop(L,1);
if(init_gui)
{
// run global init script
dt_loc_get_datadir(tmp_path, PATH_MAX);
g_strlcat(tmp_path,"/rc.lua",PATH_MAX);
dt_lua_dofile(darktable.lua_state,tmp_path);
// run user init script
dt_loc_get_user_config_dir(tmp_path, PATH_MAX);
g_strlcat(tmp_path,"/rc.lua",PATH_MAX);
dt_lua_dofile(darktable.lua_state,tmp_path);
}
}
开发者ID:MarcAntoine-Arnaud,项目名称:darktable,代码行数:50,代码来源:init.c
示例2: _handle_get_property
static GVariant *
_handle_get_property(GDBusConnection *connection,
const gchar *sender,
const gchar *object_path,
const gchar *interface_name,
const gchar *property_name,
GError **error,
gpointer user_data)
{
GVariant *ret;
ret = NULL;
if(!g_strcmp0(property_name, "DataDir"))
{
gchar datadir[PATH_MAX];
dt_loc_get_datadir(datadir, sizeof(datadir));
ret = g_variant_new_string(datadir);
}
else if(!g_strcmp0(property_name, "ConfigDir"))
{
gchar configdir[PATH_MAX];
dt_loc_get_user_config_dir(configdir, sizeof(configdir));
ret = g_variant_new_string(configdir);
}
return ret;
}
开发者ID:platoali,项目名称:darktable,代码行数:26,代码来源:dbus.c
示例3: dt_styles_create_from_image
void
dt_styles_create_from_image (const char *name,const char *description,int32_t imgid,GList *filter)
{
int id=0;
sqlite3_stmt *stmt;
/* first create the style header */
if (!dt_styles_create_style_header(name,description) ) return;
if ((id=dt_styles_get_id_by_name(name)) != 0)
{
/* create the style_items from source image history stack */
if (filter)
{
GList *list=filter;
char tmp[64];
char include[2048]= {0};
g_strlcat(include,"num in (", 2048);
do
{
if(list!=g_list_first(list))
g_strlcat(include,",", 2048);
sprintf(tmp,"%ld",(long int)list->data);
g_strlcat(include,tmp, 2048);
}
while ((list=g_list_next(list)));
g_strlcat(include,")", 2048);
char query[4096]= {0};
sprintf(query,"insert into style_items (styleid,num,module,operation,op_params,enabled,blendop_params,blendop_version,multi_priority,multi_name) select ?1, num,module,operation,op_params,enabled,blendop_params,blendop_version,multi_priority,multi_name from history where imgid=?2 and %s",include);
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), query, -1, &stmt, NULL);
}
else
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "insert into style_items (styleid,num,module,operation,op_params,enabled,blendop_params,blendop_version,multi_priority,multi_name) select ?1, num,module,operation,op_params,enabled,blendop_params,blendop_version,multi_priority,multi_name from history where imgid=?2", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, id);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, imgid);
sqlite3_step (stmt);
sqlite3_finalize (stmt);
/* backup style to disk */
char stylesdir[1024];
dt_loc_get_user_config_dir(stylesdir, 1024);
g_strlcat(stylesdir,"/styles",1024);
g_mkdir_with_parents(stylesdir,00755);
dt_styles_save_to_file(name,stylesdir,FALSE);
char tmp_accel[1024];
gchar* tmp_name = g_strdup(name); // freed by _destro_style_shortcut_callback
snprintf(tmp_accel,1024,"styles/Apply %s",name);
dt_accel_register_global( tmp_accel, 0, 0);
GClosure *closure;
closure = g_cclosure_new(
G_CALLBACK(_apply_style_shortcut_callback),
tmp_name, _destroy_style_shortcut_callback);
dt_accel_connect_global(tmp_accel, closure);
dt_control_log(_("style named '%s' successfully created"),name);
}
}
开发者ID:gthb,项目名称:darktable,代码行数:58,代码来源:styles.c
示例4: dt_lua_init
void dt_lua_init(lua_State*L,const char *lua_command)
{
/*
Note to reviewers
this is the only place where lua code is run without the lua lock.
At this point, no user script has been called,
so we are completely thread-safe. no need to lock
This is also the only place where lua code is run with the gdk lock
held, but this is not a problem because it is very brief, user calls
are delegated to a secondary job
*/
char tmp_path[PATH_MAX];
// init the lua environment
lua_CFunction* cur_type = init_funcs;
while(*cur_type)
{
(*cur_type)(L);
cur_type++;
}
// build the table containing the configuration info
lua_getglobal(L,"package");
dt_lua_goto_subtable(L,"loaded");
lua_pushstring(L,"darktable");
dt_lua_push_darktable_lib(L);
lua_settable(L,-3);
lua_pop(L,1);
lua_getglobal(L,"package");
lua_getfield(L,-1,"path");
lua_pushstring(L,";");
dt_loc_get_datadir(tmp_path, sizeof(tmp_path));
lua_pushstring(L,tmp_path);
lua_pushstring(L,"/lua/?.lua");
lua_pushstring(L,";");
dt_loc_get_user_config_dir(tmp_path, sizeof(tmp_path));
lua_pushstring(L,tmp_path);
lua_pushstring(L,"/lua/?.lua");
lua_concat(L,7);
lua_setfield(L,-2,"path");
lua_pop(L,1);
dt_job_t *job = dt_control_job_create(&run_early_script, "lua: run initial script");
dt_control_job_set_params(job, g_strdup(lua_command));
if(darktable.gui)
{
dt_control_add_job(darktable.control, DT_JOB_QUEUE_USER_BG, job);
}
else
{
run_early_script(job);
dt_control_job_dispose(job);
}
}
开发者ID:grinoscar,项目名称:darktable,代码行数:58,代码来源:init.c
示例5: refresh_watermarks
static void refresh_watermarks( dt_iop_module_t *self )
{
dt_iop_watermark_gui_data_t *g = (dt_iop_watermark_gui_data_t *)self->gui_data;
dt_iop_watermark_params_t *p = (dt_iop_watermark_params_t *)self->params;
g_signal_handlers_block_by_func (g->combobox1,watermark_callback,self);
// Clear combobox...
GtkTreeModel *model=gtk_combo_box_get_model(g->combobox1);
gtk_list_store_clear (GTK_LIST_STORE(model));
// check watermarkdir and update combo with entries...
int count=0;
const gchar *d_name = NULL;
gchar configdir[DT_MAX_PATH_LEN];
gchar datadir[DT_MAX_PATH_LEN];
gchar filename[DT_MAX_PATH_LEN];
dt_loc_get_datadir(datadir, DT_MAX_PATH_LEN);
dt_loc_get_user_config_dir(configdir, DT_MAX_PATH_LEN);
g_strlcat(datadir,"/watermarks", DT_MAX_PATH_LEN);
g_strlcat(configdir,"/watermarks", DT_MAX_PATH_LEN);
/* read watermarks from datadir */
GDir *dir = g_dir_open(datadir, 0, NULL);
if(dir)
{
while((d_name = g_dir_read_name(dir)))
{
snprintf(filename, DT_MAX_PATH_LEN, "%s/%s", datadir, d_name);
gtk_combo_box_append_text( g->combobox1, d_name );
count++;
}
g_dir_close(dir) ;
}
/* read watermarks from user config dir*/
dir = g_dir_open(configdir, 0, NULL);
if(dir)
{
while((d_name = g_dir_read_name(dir)))
{
snprintf(filename, DT_MAX_PATH_LEN, "%s/%s", configdir, d_name);
gtk_combo_box_append_text( g->combobox1, d_name );
count++;
}
g_dir_close(dir) ;
}
_combo_box_set_active_text( g->combobox1, p->filename );
g_signal_handlers_unblock_by_func (g->combobox1,watermark_callback,self);
}
开发者ID:chubinou,项目名称:darktable,代码行数:53,代码来源:watermark.c
示例6: gui_init
void gui_init(struct dt_iop_module_t *self)
{
const int force_lcms2 = dt_conf_get_bool("plugins/lighttable/export/force_lcms2");
self->gui_data = calloc(1, sizeof(dt_iop_colorout_gui_data_t));
dt_iop_colorout_gui_data_t *g = (dt_iop_colorout_gui_data_t *)self->gui_data;
char datadir[PATH_MAX] = { 0 };
char confdir[PATH_MAX] = { 0 };
dt_loc_get_datadir(datadir, sizeof(datadir));
dt_loc_get_user_config_dir(confdir, sizeof(confdir));
self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE);
// TODO:
g->output_intent = dt_bauhaus_combobox_new(self);
gtk_box_pack_start(GTK_BOX(self->widget), g->output_intent, TRUE, TRUE, 0);
dt_bauhaus_widget_set_label(g->output_intent, NULL, _("output intent"));
dt_bauhaus_combobox_add(g->output_intent, _("perceptual"));
dt_bauhaus_combobox_add(g->output_intent, _("relative colorimetric"));
dt_bauhaus_combobox_add(g->output_intent, C_("rendering intent", "saturation"));
dt_bauhaus_combobox_add(g->output_intent, _("absolute colorimetric"));
if(!force_lcms2)
{
gtk_widget_set_no_show_all(g->output_intent, TRUE);
gtk_widget_set_visible(g->output_intent, FALSE);
}
g->output_profile = dt_bauhaus_combobox_new(self);
dt_bauhaus_widget_set_label(g->output_profile, NULL, _("output profile"));
gtk_box_pack_start(GTK_BOX(self->widget), g->output_profile, TRUE, TRUE, 0);
for(GList *l = darktable.color_profiles->profiles; l; l = g_list_next(l))
{
dt_colorspaces_color_profile_t *prof = (dt_colorspaces_color_profile_t *)l->data;
if(prof->out_pos > -1) dt_bauhaus_combobox_add(g->output_profile, prof->name);
}
char tooltip[1024];
g_object_set(G_OBJECT(g->output_intent), "tooltip-text", _("rendering intent"), (char *)NULL);
snprintf(tooltip, sizeof(tooltip), _("ICC profiles in %s/color/out or %s/color/out"), confdir, datadir);
g_object_set(G_OBJECT(g->output_profile), "tooltip-text", tooltip, (char *)NULL);
g_signal_connect(G_OBJECT(g->output_intent), "value-changed", G_CALLBACK(intent_changed), (gpointer)self);
g_signal_connect(G_OBJECT(g->output_profile), "value-changed", G_CALLBACK(output_profile_changed), (gpointer)self);
// reload the profiles when the display or softproof profile changed!
dt_control_signal_connect(darktable.signals, DT_SIGNAL_CONTROL_PROFILE_CHANGED,
G_CALLBACK(_signal_profile_changed), self->dev);
// update the gui when the preferences changed (i.e. show intent when using lcms2)
dt_control_signal_connect(darktable.signals, DT_SIGNAL_PREFERENCES_CHANGE,
G_CALLBACK(_preference_changed), (gpointer)self);
}
开发者ID:dirkbr,项目名称:darktable,代码行数:53,代码来源:colorout.c
示例7: dt_lua_init
void dt_lua_init(lua_State *L, const char *lua_command)
{
char tmp_path[PATH_MAX] = { 0 };
// init the lua environment
lua_CFunction *cur_type = init_funcs;
while(*cur_type)
{
(*cur_type)(L);
cur_type++;
}
assert(lua_gettop(L)
== 0); // if you are here, you have probably added an initialisation function that is not stack clean
// build the table containing the configuration info
lua_getglobal(L, "package");
dt_lua_goto_subtable(L, "loaded");
lua_pushstring(L, "darktable");
dt_lua_push_darktable_lib(L);
lua_settable(L, -3);
lua_pop(L, 1);
lua_getglobal(L, "package");
lua_getfield(L, -1, "path");
lua_pushstring(L, ";");
dt_loc_get_datadir(tmp_path, sizeof(tmp_path));
lua_pushstring(L, tmp_path);
lua_pushstring(L, "/lua/?.lua");
lua_pushstring(L, ";");
dt_loc_get_user_config_dir(tmp_path, sizeof(tmp_path));
lua_pushstring(L, tmp_path);
lua_pushstring(L, "/lua/?.lua");
lua_concat(L, 7);
lua_setfield(L, -2, "path");
lua_pop(L, 1);
lua_pushcfunction(L,run_early_script);
lua_pushstring(L,lua_command);
if(darktable.gui)
{
dt_lua_do_chunk_later(L,1);
}
else
{
dt_lua_do_chunk_silent(L,1,0);
}
// allow other threads to wake up and do their job
dt_lua_unlock();
}
开发者ID:BloodyD,项目名称:darktable,代码行数:52,代码来源:init.c
示例8: refresh_watermarks
static void refresh_watermarks(dt_iop_module_t *self)
{
dt_iop_watermark_gui_data_t *g = (dt_iop_watermark_gui_data_t *)self->gui_data;
dt_iop_watermark_params_t *p = (dt_iop_watermark_params_t *)self->params;
g_signal_handlers_block_by_func(g->watermarks, watermark_callback, self);
// Clear combobox...
dt_bauhaus_combobox_clear(g->watermarks);
// check watermarkdir and update combo with entries...
int count = 0;
const gchar *d_name = NULL;
gchar configdir[PATH_MAX] = { 0 };
gchar datadir[PATH_MAX] = { 0 };
gchar filename[PATH_MAX] = { 0 };
dt_loc_get_datadir(datadir, sizeof(datadir));
dt_loc_get_user_config_dir(configdir, sizeof(configdir));
g_strlcat(datadir, "/watermarks", sizeof(datadir));
g_strlcat(configdir, "/watermarks", sizeof(configdir));
/* read watermarks from datadir */
GDir *dir = g_dir_open(datadir, 0, NULL);
if(dir)
{
while((d_name = g_dir_read_name(dir)))
{
snprintf(filename, sizeof(filename), "%s/%s", datadir, d_name);
dt_bauhaus_combobox_add(g->watermarks, d_name);
count++;
}
g_dir_close(dir);
}
/* read watermarks from user config dir*/
dir = g_dir_open(configdir, 0, NULL);
if(dir)
{
while((d_name = g_dir_read_name(dir)))
{
snprintf(filename, sizeof(filename), "%s/%s", configdir, d_name);
dt_bauhaus_combobox_add(g->watermarks, d_name);
count++;
}
g_dir_close(dir);
}
_combo_box_set_active_text(g->watermarks, p->filename);
g_signal_handlers_unblock_by_func(g->watermarks, watermark_callback, self);
}
开发者ID:edgomez,项目名称:darktable,代码行数:51,代码来源:watermark.c
示例9: dt_colorspaces_find_profile
int
dt_colorspaces_find_profile(char *filename, const int filename_len, const char *profile, const char *inout)
{
char datadir[DT_MAX_PATH_LEN];
dt_loc_get_user_config_dir(datadir, DT_MAX_PATH_LEN);
snprintf(filename, filename_len, "%s/color/%s/%s", datadir, inout, profile);
if(!g_file_test(filename, G_FILE_TEST_IS_REGULAR))
{
dt_loc_get_datadir(datadir, DT_MAX_PATH_LEN);
snprintf(filename, filename_len, "%s/color/%s/%s", datadir, inout, profile);
if(!g_file_test(filename, G_FILE_TEST_IS_REGULAR)) return 1;
}
return 0;
}
开发者ID:jonleighton,项目名称:darktable,代码行数:14,代码来源:colorspaces.c
示例10: run_early_script
static int run_early_script(lua_State* L)
{
char tmp_path[PATH_MAX] = { 0 };
// run global init script
dt_loc_get_datadir(tmp_path, sizeof(tmp_path));
g_strlcat(tmp_path, "/luarc", sizeof(tmp_path));
dt_lua_dofile_silent(L, tmp_path, 0, 0);
if(darktable.gui != NULL)
{
// run user init script
dt_loc_get_user_config_dir(tmp_path, sizeof(tmp_path));
g_strlcat(tmp_path, "/luarc", sizeof(tmp_path));
dt_lua_dofile_silent(L, tmp_path, 0, 0);
}
if(!lua_isnil(L,1)){
const char *lua_command = lua_tostring(L, 1);
dt_lua_dostring_silent(L, lua_command, 0, 0);
}
dt_lua_redraw_screen();
return 0;
}
开发者ID:BloodyD,项目名称:darktable,代码行数:21,代码来源:init.c
示例11: dt_lua_init_configuration
int dt_lua_init_configuration(lua_State*L){
char tmp_path[PATH_MAX];
dt_lua_push_darktable_lib(L);
dt_lua_goto_subtable(L,"configuration");
// build the table containing the configuration info
lua_pushstring(L,"tmp_dir");
dt_loc_get_tmp_dir(tmp_path, PATH_MAX);
lua_pushstring(L,tmp_path);
lua_settable(L,-3);
lua_pushstring(L,"config_dir");
dt_loc_get_user_config_dir(tmp_path, PATH_MAX);
lua_pushstring(L,tmp_path);
lua_settable(L,-3);
lua_pushstring(L,"cache_dir");
dt_loc_get_user_cache_dir(tmp_path, PATH_MAX);
lua_pushstring(L,tmp_path);
lua_settable(L,-3);
lua_pushstring(L,"version");
lua_pushstring(darktable.lua_state,PACKAGE_VERSION);
lua_settable(L,-3);
lua_pushstring(L,"verbose");
lua_pushboolean(L,darktable.unmuted & DT_DEBUG_LUA);
lua_settable(L,-3);
lua_pushstring(L,"has_gui");
lua_pushboolean(L,darktable.gui != NULL);
lua_settable(L,-3);
lua_pop(L,-1); //remove the configuration table from the stack
return 0;
}
开发者ID:bleader,项目名称:darktable,代码行数:39,代码来源:configuration.c
示例12: run_early_script
static int run_early_script(lua_State* L)
{
char basedir[PATH_MAX] = { 0 };
// run global init script
dt_loc_get_datadir(basedir, sizeof(basedir));
char *luarc = g_build_filename(basedir, "luarc", NULL);
dt_lua_check_print_error(L, luaL_dofile(L, luarc));
g_free(luarc);
if(darktable.gui != NULL)
{
// run user init script
dt_loc_get_user_config_dir(basedir, sizeof(basedir));
luarc = g_build_filename(basedir, "luarc", NULL);
dt_lua_check_print_error(L, luaL_dofile(L, luarc));
g_free(luarc);
}
if(!lua_isnil(L,1)){
const char *lua_command = lua_tostring(L, 1);
dt_lua_check_print_error(L,luaL_dostring(L,lua_command));
}
dt_lua_redraw_screen();
return 0;
}
开发者ID:AlicVB,项目名称:darktable,代码行数:23,代码来源:init.c
示例13: run_early_script
static int32_t run_early_script(dt_job_t *job)
{
char tmp_path[PATH_MAX];
lua_State *L = darktable.lua_state.state;
gboolean has_lock = dt_lua_lock();
// run global init script
dt_loc_get_datadir(tmp_path, sizeof(tmp_path));
g_strlcat(tmp_path, "/luarc", sizeof(tmp_path));
dt_lua_dofile_silent(L,tmp_path,0,0);
if(darktable.gui != NULL)
{
// run user init script
dt_loc_get_user_config_dir(tmp_path, sizeof(tmp_path));
g_strlcat(tmp_path, "/luarc", sizeof(tmp_path));
dt_lua_dofile_silent(L,tmp_path,0,0);
}
char *lua_command = dt_control_job_get_params(job);
if(lua_command)
dt_lua_dostring_silent(L, lua_command, 0, 0);
free(lua_command);
dt_lua_redraw_screen();
dt_lua_unlock(has_lock);
return 0;
}
开发者ID:grinoscar,项目名称:darktable,代码行数:24,代码来源:init.c
示例14: dt_gui_gtk_init
int
dt_gui_gtk_init(dt_gui_gtk_t *gui, int argc, char *argv[])
{
// unset gtk rc from kde:
char gtkrc[PATH_MAX], path[PATH_MAX], datadir[PATH_MAX], configdir[PATH_MAX];
dt_loc_get_datadir(datadir, PATH_MAX);
dt_loc_get_user_config_dir(configdir, PATH_MAX);
g_snprintf(gtkrc, PATH_MAX, "%s/darktable.gtkrc", configdir);
if (!g_file_test(gtkrc, G_FILE_TEST_EXISTS))
g_snprintf(gtkrc, PATH_MAX, "%s/darktable.gtkrc", datadir);
if (g_file_test(gtkrc, G_FILE_TEST_EXISTS))
(void)setenv("GTK2_RC_FILES", gtkrc, 1);
else
fprintf(stderr, "[gtk_init] could not found darktable.gtkrc");
/* lets zero mem */
memset(gui,0,sizeof(dt_gui_gtk_t));
#if GLIB_MAJOR_VERSION <= 2
#if GLIB_MINOR_VERSION < 31
if (!g_thread_supported ()) g_thread_init(NULL);
#endif
#endif
gdk_threads_init();
gdk_threads_enter();
gtk_init (&argc, &argv);
GtkWidget *widget;
gui->ui = dt_ui_initialize(argc,argv);
gui->pixmap = NULL;
gui->center_tooltip = 0;
gui->presets_popup_menu = NULL;
if(g_file_test(gtkrc, G_FILE_TEST_EXISTS))
gtk_rc_parse (gtkrc);
// Initializing the shortcut groups
darktable.control->accelerators = gtk_accel_group_new();
darktable.control->accelerator_list = NULL;
// Connecting the callback to update keyboard accels for key_pressed
g_signal_connect(G_OBJECT(gtk_accel_map_get()),
"changed",
G_CALLBACK(key_accel_changed),
NULL);
// Initializing widgets
init_widgets();
// Adding the global shortcut group to the main window
gtk_window_add_accel_group(GTK_WINDOW(dt_ui_main_window(darktable.gui->ui)),
darktable.control->accelerators);
// get the screen resolution
gui->dpi = gdk_screen_get_resolution(gtk_widget_get_screen(GTK_WIDGET(dt_ui_main_window(darktable.gui->ui))));
// set constant width from conf key
int panel_width = dt_conf_get_int("panel_width");
if(panel_width < 20 || panel_width > 500)
{
// fix for unset/insane values.
panel_width = 300;
dt_conf_set_int("panel_width", panel_width);
}
// dt_gui_background_jobs_init();
/* Have the delete event (window close) end the program */
dt_loc_get_datadir(datadir, PATH_MAX);
snprintf(path, PATH_MAX, "%s/icons", datadir);
gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), path);
widget = dt_ui_center(darktable.gui->ui);
g_signal_connect (G_OBJECT (widget), "key-press-event",
G_CALLBACK (key_pressed), NULL);
g_signal_connect (G_OBJECT (widget), "configure-event",
G_CALLBACK (configure), NULL);
g_signal_connect (G_OBJECT (widget), "expose-event",
G_CALLBACK (expose), NULL);
g_signal_connect (G_OBJECT (widget), "motion-notify-event",
G_CALLBACK (mouse_moved), NULL);
g_signal_connect (G_OBJECT (widget), "leave-notify-event",
G_CALLBACK (center_leave), NULL);
g_signal_connect (G_OBJECT (widget), "enter-notify-event",
G_CALLBACK (center_enter), NULL);
g_signal_connect (G_OBJECT (widget), "button-press-event",
G_CALLBACK (button_pressed), NULL);
g_signal_connect (G_OBJECT (widget), "button-release-event",
G_CALLBACK (button_released), NULL);
g_signal_connect (G_OBJECT (widget), "scroll-event",
G_CALLBACK (scrolled), NULL);
// TODO: left, right, top, bottom:
//leave-notify-event
//.........这里部分代码省略.........
开发者ID:sk1p,项目名称:darktable,代码行数:101,代码来源:gtk.c
示例15: dt_loc_get_datadir
static gchar *_watermark_get_svgdoc(dt_iop_module_t *self, dt_iop_watermark_data_t *data,
const dt_image_t *image)
{
gsize length;
gchar *svgdoc = NULL;
gchar configdir[PATH_MAX] = { 0 };
gchar datadir[PATH_MAX] = { 0 };
gchar *filename;
dt_loc_get_datadir(datadir, sizeof(datadir));
dt_loc_get_user_config_dir(configdir, sizeof(configdir));
g_strlcat(datadir, "/watermarks/", sizeof(datadir));
g_strlcat(configdir, "/watermarks/", sizeof(configdir));
g_strlcat(datadir, data->filename, sizeof(datadir));
g_strlcat(configdir, data->filename, sizeof(configdir));
if(g_file_test(configdir, G_FILE_TEST_EXISTS))
filename = configdir;
else if(g_file_test(datadir, G_FILE_TEST_EXISTS))
filename = datadir;
else
return NULL;
gchar *svgdata = NULL;
char datetime[200];
// EXIF datetime
struct tm tt_exif = { 0 };
if(sscanf(image->exif_datetime_taken, "%d:%d:%d %d:%d:%d", &tt_exif.tm_year, &tt_exif.tm_mon,
&tt_exif.tm_mday, &tt_exif.tm_hour, &tt_exif.tm_min, &tt_exif.tm_sec) == 6)
{
tt_exif.tm_year -= 1900;
tt_exif.tm_mon--;
}
// Current datetime
struct tm tt_cur = { 0 };
time_t t = time(NULL);
(void)localtime_r(&t, &tt_cur);
if(g_file_get_contents(filename, &svgdata, &length, NULL))
{
// File is loaded lets substitute strings if found...
// Darktable internal
svgdoc = _string_substitute(svgdata, "$(DARKTABLE.NAME)", PACKAGE_NAME);
if(svgdoc != svgdata)
{
g_free(svgdata);
svgdata = svgdoc;
}
svgdoc = _string_substitute(svgdata, "$(DARKTABLE.VERSION)", PACKAGE_VERSION);
if(svgdoc != svgdata)
{
g_free(svgdata);
svgdata = svgdoc;
}
// Simple text from watermark module
gchar buffer[1024];
if (data->font[0] && data->text[0])
{
g_snprintf(buffer, sizeof(buffer), "%s", data->text);
svgdoc = _string_substitute(svgdata, "$(WATERMARK_TEXT)", buffer);
if(svgdoc != svgdata)
{
g_free(svgdata);
svgdata = svgdoc;
}
PangoFontDescription *font = pango_font_description_from_string(data->font);
const PangoStyle font_style = pango_font_description_get_style(font);
const int font_weight = (int)pango_font_description_get_weight(font);
g_snprintf(buffer, sizeof(buffer), "%s", pango_font_description_get_family(font));
svgdoc = _string_substitute(svgdata, "$(WATERMARK_FONT_FAMILY)", buffer);
if(svgdoc != svgdata)
{
g_free(svgdata);
svgdata = svgdoc;
}
switch (font_style)
{
case PANGO_STYLE_OBLIQUE:
g_strlcpy(buffer, "oblique", sizeof(buffer));
break;
case PANGO_STYLE_ITALIC:
g_strlcpy(buffer, "italic", sizeof(buffer));
break;
default:
g_strlcpy(buffer, "normal", sizeof(buffer));
break;
}
svgdoc = _string_substitute(svgdata, "$(WATERMARK_FONT_STYLE)", buffer);
if(svgdoc != svgdata)
{
g_free(svgdata);
svgdata = svgdoc;
//.........这里部分代码省略.........
开发者ID:edgomez,项目名称:darktable,代码行数:101,代码来源:watermark.c
示例16: gui_init
void gui_init(struct dt_iop_module_t *self)
{
self->gui_data = malloc(sizeof(dt_iop_watermark_gui_data_t));
dt_iop_watermark_gui_data_t *g = (dt_iop_watermark_gui_data_t *)self->gui_data;
dt_iop_watermark_params_t *p = (dt_iop_watermark_params_t *)self->params;
int line = 0;
self->widget = gtk_grid_new();
gtk_grid_set_row_spacing(GTK_GRID(self->widget), DT_BAUHAUS_SPACE);
gtk_grid_set_column_spacing(GTK_GRID(self->widget), DT_PIXEL_APPLY_DPI(10));
gtk_grid_attach(GTK_GRID(self->widget), dt_ui_section_label_new(_("content")), 0, line++, 3, 1);
// Add the marker combobox
gchar configdir[PATH_MAX] = { 0 };
gchar datadir[PATH_MAX] = { 0 };
dt_loc_get_datadir(datadir, sizeof(datadir));
dt_loc_get_user_config_dir(configdir, sizeof(configdir));
GtkWidget *label = dtgtk_reset_label_new(_("marker"), self, &p->filename, sizeof(p->filename));
g->watermarks = dt_bauhaus_combobox_new(self);
gtk_widget_set_hexpand(GTK_WIDGET(g->watermarks), TRUE);
char *tooltip = g_strdup_printf(_("SVG watermarks in %s/watermarks or %s/watermarks"), configdir, datadir);
gtk_widget_set_tooltip_text(g->watermarks, tooltip);
g_free(tooltip);
g->refresh = dtgtk_button_new(dtgtk_cairo_paint_refresh, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
gtk_grid_attach(GTK_GRID(self->widget), label, 0, line++, 1, 1);
gtk_grid_attach_next_to(GTK_GRID(self->widget), g->watermarks, label, GTK_POS_RIGHT, 1, 1);
gtk_grid_attach_next_to(GTK_GRID(self->widget), g->refresh, g->watermarks, GTK_POS_RIGHT, 1, 1);
// Watermark color
float red = dt_conf_get_float("plugins/darkroom/watermark/color_red");
float green = dt_conf_get_float("plugins/darkroom/watermark/color_green");
float blue = dt_conf_get_float("plugins/darkroom/watermark/color_blue");
GdkRGBA color = (GdkRGBA){.red = red, .green = green, .blue = blue, .alpha = 1.0 };
label = dtgtk_reset_label_new(_("color"), self, &p->color, 3 * sizeof(float));
g->colorpick = gtk_color_button_new_with_rgba(&color);
gtk_widget_set_tooltip_text(g->colorpick, _("watermark color, tag:\n$(WATERMARK_COLOR)"));
gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(g->colorpick), FALSE);
gtk_widget_set_size_request(GTK_WIDGET(g->colorpick), DT_PIXEL_APPLY_DPI(24), DT_PIXEL_APPLY_DPI(24));
gtk_color_button_set_title(GTK_COLOR_BUTTON(g->colorpick), _("select watermark color"));
gtk_grid_attach(GTK_GRID(self->widget), label, 0, line++, 1, 1);
gtk_grid_attach_next_to(GTK_GRID(self->widget), g->colorpick, label, GTK_POS_RIGHT, 2, 1);
// Simple text
label = gtk_label_new(_("text"));
gtk_widget_set_halign(label, GTK_ALIGN_START);
g->text = gtk_entry_new();
gtk_entry_set_width_chars(GTK_ENTRY(g->text), 1);
gtk_widget_set_tooltip_text(g->text, _("text string, tag:\n$(WATERMARK_TEXT)"));
dt_gui_key_accel_block_on_focus_connect(g->text);
gtk_grid_attach(GTK_GRID(self->widget), label, 0, line++, 1, 1);
gtk_grid_attach_next_to(GTK_GRID(self->widget), g->text, label, GTK_POS_RIGHT, 2, 1);
gchar *str = dt_conf_get_string("plugins/darkroom/watermark/text");
gtk_entry_set_text(GTK_ENTRY(g->text), str);
g_free(str);
// Text font
label = dtgtk_reset_label_new(_("font"), self, &p->font, sizeof(p->font));
str = dt_conf_get_string("plugins/darkroom/watermark/font");
g->fontsel = gtk_font_button_new_with_font(str==NULL?"DejaVu Sans 10":str);
GList *childs = gtk_container_get_children(GTK_CONTAINER(gtk_bin_get_child(GTK_BIN(g->fontsel))));
gtk_label_set_ellipsize(GTK_LABEL(childs->data), PANGO_ELLIPSIZE_MIDDLE);
g_list_free(childs);
gtk_widget_set_tooltip_text(g->fontsel, _("text font, tags:\n$(WATERMARK_FONT_FAMILY)\n"
"$(WATERMARK_FONT_STYLE)\n$(WATERMARK_FONT_WEIGHT)"));
gtk_font_button_set_show_size (GTK_FONT_BUTTON(g->fontsel), FALSE);
g_free(str);
gtk_grid_attach(GTK_GRID(self->widget), label, 0, line++, 1, 1);
gtk_grid_attach_next_to(GTK_GRID(self->widget), g->fontsel, label, GTK_POS_RIGHT, 2, 1);
gtk_grid_attach(GTK_GRID(self->widget), dt_ui_section_label_new(_("properties")), 0, line++, 3, 1);
// Add opacity/scale sliders to table
g->opacity = dt_bauhaus_slider_new_with_range(self, 0.0, 100.0, 1.0, p->opacity, 0);
dt_bauhaus_slider_set_format(g->opacity, "%.f%%");
dt_bauhaus_widget_set_label(g->opacity, NULL, _("opacity"));
g->scale = dt_bauhaus_slider_new_with_range(self, 1.0, 100.0, 1.0, p->scale, 0);
dt_bauhaus_slider_enable_soft_boundaries(g->scale, 1.0, 500.0);
dt_bauhaus_slider_set_format(g->scale, "%.f%%");
dt_bauhaus_widget_set_label(g->scale, NULL, _("scale"));
g->rotate = dt_bauhaus_slider_new_with_range(self, -180.0, 180.0, 1.0, p->rotate, 2);
dt_bauhaus_slider_set_format(g->rotate, "%.02f°");
dt_bauhaus_widget_set_label(g->rotate, NULL, _("rotation"));
gtk_grid_attach(GTK_GRID(self->widget), g->opacity, 0, line++, 3, 1);
gtk_grid_attach(GTK_GRID(self->widget), g->scale, 0, line++, 3, 1);
gtk_grid_attach(GTK_GRID(self->widget), g->rotate, 0, line++, 3, 1);
g->sizeto = dt_bauhaus_combobox_new(self);
dt_bauhaus_combobox_add(g->sizeto, C_("size", "image"));
dt_bauhaus_combobox_add(g->sizeto, _("larger border"));
dt_bauhaus_combobox_add(g->sizeto, _("smaller border"));
dt_bauhaus_combobox_set(g->sizeto, p->sizeto);
dt_bauhaus_widget_set_label(g->sizeto, NULL, _("scale on"));
gtk_widget_set_tooltip_text(g->sizeto, _("size is relative to"));
gtk_grid_attach(GTK_GRID(self->widget), g->sizeto, 0, line++, 3, 1);
//.........这里部分代码省略.........
开发者ID:edgomez,项目名称:darktable,代码行数:101,代码来源:watermark.c
示例17: dt_lua_init_configuration
int dt_lua_init_configuration(lua_State *L)
{
char tmp_path[PATH_MAX] = { 0 };
dt_lua_push_darktable_lib(L);
dt_lua_goto_subtable(L, "configuration");
// build the table containing the configuration info
lua_pushstring(L, "tmp_dir");
dt_loc_get_tmp_dir(tmp_path, sizeof(tmp_path));
lua_pushstring(L, tmp_path);
lua_settable(L, -3);
lua_pushstring(L, "config_dir");
dt_loc_get_user_config_dir(tmp_path, sizeof(tmp_path));
lua_pushstring(L, tmp_path);
lua_settable(L, -3);
lua_pushstring(L, "cache_dir");
dt_loc_get_user_cache_dir(tmp_path, sizeof(tmp_path));
lua_pushstring(L, tmp_path);
lua_settable(L, -3);
lua_pushstring(L, "version");
lua_pushstring(L, darktable_package_version);
lua_settable(L, -3);
lua_pushstring(L, "verbose");
lua_pushboolean(L, darktable.unmuted & DT_DEBUG_LUA);
lua_settable(L, -3);
lua_pushstring(L, "has_gui");
lua_pushboolean(L, darktable.gui != NULL);
lua_settable(L, -3);
lua_pushstring(L, "api_version_major");
lua_pushinteger(L, LUA_API_VERSION_MAJOR);
lua_settable(L, -3);
lua_pushstring(L, "api_version_minor");
lua_pushinteger(L, LUA_API_VERSION_MINOR);
lua_settable(L, -3);
lua_pushstring(L, "api_version_patch");
lua_pushinteger(L, LUA_API_VERSION_PATCH);
lua_settable(L, -3);
lua_pushstring(L, "api_version_suffix");
lua_pushstring(L, LUA_API_VERSION_SUFFIX);
lua_settable(L, -3);
lua_pushstring(L, "api_version_string");
if(LUA_API_VERSION_SUFFIX[0] == '\0')
{
lua_pushfstring(L, "%d.%d.%d", LUA_API_VERSION_MAJOR, LUA_API_VERSION_MINOR, LUA_API_VERSION_PATCH);
}
else
{
lua_pushfstring(L, "%d.%d.%d-%s", LUA_API_VERSION_MAJOR, LUA_API_VERSION_MINOR, LUA_API_VERSION_PATCH,
LUA_API_VERSION_SUFFIX);
}
lua_settable(L, -3);
lua_pushstring(L, "check_version");
lua_pushcfunction(L, check_version);
lua_settable(L, -3);
luaA_enum(L, lua_os_type);
luaA_enum_value_name(L, lua_os_type, os_windows, "windows");
luaA_enum_value_name(L, lua_os_type, os_macos, "macos");
luaA_enum_value_name(L, lua_os_type, os_linux, "linux");
luaA_enum_value_name(L, lua_os_type, os_unix, "unix");
lua_pushstring(L, "running_os");
luaA_push(L, lua_os_type, &cur_os);
lua_settable(L, -3);
lua_pop(L, 1); // remove the configuration table from the stack
return 0;
}
开发者ID:AlicVB,项目名称:darktable,代码行数:80,代码来源:configuration.c
示例18: _watermark_get_svgdoc
static gchar * _watermark_get_svgdoc( dt_iop_module_t *self, dt_iop_watermark_data_t *data, const dt_image_t *image)
{
gsize length;
gchar *svgdoc=NULL;
gchar configdir[DT_MAX_PATH_LEN];
gchar datadir[DT_MAX_PATH_LEN];
gchar *filename;
dt_loc_get_datadir(datadir, DT_MAX_PATH_LEN);
dt_loc_get_user_config_dir(configdir, DT_MAX_PATH_LEN);
g_strlcat(datadir,"/watermarks/", DT_MAX_PATH_LEN);
g_strlcat(configdir,"/watermarks/", DT_MAX_PATH_LEN);
g_strlcat(datadir,data->filename, DT_MAX_PATH_LEN);
g_strlcat(configdir,data->filename, DT_MAX_PATH_LEN);
if (g_file_test(configdir,G_FILE_TEST_EXISTS))
filename=configdir;
else if (g_file_test(datadir,G_FILE_TEST_EXISTS))
filename=datadir;
else return NULL;
gchar *svgdata=NULL;
char datetime[200];
// EXIF datetime
struct tm tt_exif = {0};
if(sscanf(image->exif_datetime_taken,"%d:%d:%d %d:%d:%d",
&tt_exif.tm_year,
&tt_exif.tm_mon,
&tt_exif.tm_mday,
&tt_exif.tm_hour,
&tt_exif.tm_min,
&tt_exif.tm_sec
) == 6
)
{
tt_exif.tm_year-=1900;
tt_exif.tm_mon--;
}
// Current datetime
struct tm tt_cur = {0};
time_t t = time(NULL);
(void)localtime_r(&t, &tt_cur);
if( g_file_get_contents( filename, &svgdata, &length, NULL) )
{
// File is loaded lets substitute strings if found...
// Darktable internal
svgdoc = _string_substitute(svgdata,"$(DARKTABLE.NAME)",PACKAGE_NAME);
if( svgdoc != svgdata )
{
g_free(svgdata);
svgdata = svgdoc;
}
svgdoc = _string_substitute(svgdata,"$(DARKTABLE.VERSION)",PACKAGE_VERSION);
if( svgdoc != svgdata )
{
g_free(svgdata);
svgdata = svgdoc;
}
// Current image ID
gchar buffer[1024];
g_snprintf(buffer,1024,"%d",image->id);
svgdoc = _string_substitute(svgdata,"$(IMAGE.ID)",buffer);
if( svgdoc != svgdata )
{
g_free(svgdata);
svgdata = svgdoc;
}
// Current image
dt_image_print_exif(image,buffer,1024);
svgdoc = _string_substitute(svgdata,"$(IMAGE.EXIF)",buffer);
if( svgdoc != svgdata )
{
g_free(svgdata);
svgdata = svgdoc;
}
// Image exif
// EXIF date
svgdoc = _string_substitute(svgdata,"$(EXIF.DATE)",image->exif_datetime_taken);
if( svgdoc != svgdata )
{
g_free(svgdata);
svgdata = svgdoc;
}
// $(EXIF.DATE.SECOND) -- 00..60
strftime(datetime, sizeof(datetime), "%S", &tt_exif);
svgdoc = _string_substitute(svgdata,"$(EXIF.DATE.SECOND)",datetime);
if( svgdoc != svgdata )
{
g_free(svgdata);
svgdata = svgdoc;
}
// $(EXIF.DATE.MINUTE) -- 00..59
strftime(datetime, sizeof(datetime), "%M", &tt_exif);
//.........这里部分代码省略.........
开发者ID:chubinou,项目名称:darktable,代码行数:101,代码来源:watermark.c
示例19: dt_styles_update
void
dt_styles_update (const char *name, const char *newname, const char *newdescription, GList *filter, int imgid, GList *update)
{
sqlite3_stmt *stmt;
int id=0;
gchar *desc = NULL;
id = dt_styles_get_id_by_name(name);
if(id == 0) return;
desc = dt_styles_get_description (name);
if ((g_strcmp0(name, newname)) || (g_strcmp0(desc, newdescription)))
{
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "UPDATE styles SET name=?1, description=?2 WHERE id=?3", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_TEXT(stmt, 1, newname, strlen (newname), SQLITE_STATIC);
DT_DEBUG_SQLITE3_BIND_TEXT(stmt, 2, newdescription, strlen (newdescription), SQLITE_STATIC);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 3, id);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
}
if (filter)
{
GList *list=filter;
char tmp[64];
char include[2048] = {0};
g_strlcat(include,"num not in (", 2048);
do
{
if(list!=g_list_first(list))
g_strlcat(include, ",", 2048);
sprintf(tmp, "%d", GPOINTER_TO_INT(list->data));
g_strlcat(include, tmp, 2048);
}
while ((list=g_list_next(list)));
g_strlcat(include,")", 2048);
char query[4096]= {0};
sprintf(query,"delete from style_items where styleid=?1 and %s", include);
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), query, -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, id);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
}
_dt_style_update_from_image(id,imgid,filter,update);
_dt_style_cleanup_multi_instance(id);
/* backup style to dis
|
请发表评论