本文整理汇总了C++中dt_image_synch_xmp函数的典型用法代码示例。如果您正苦于以下问题:C++ dt_image_synch_xmp函数的具体用法?C++ dt_image_synch_xmp怎么用?C++ dt_image_synch_xmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dt_image_synch_xmp函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: entry_activated
static void
entry_activated (GtkButton *button, gpointer user_data)
{
dt_lib_module_t *self = (dt_lib_module_t *)user_data;
dt_lib_tagging_t *d = (dt_lib_tagging_t *)self->data;
const gchar *tag = gtk_entry_get_text(d->entry);
if(!tag || tag[0] == '\0') return;
/** attach tag to selected images */
dt_tag_attach_string_list(tag, -1);
dt_image_synch_xmp(-1);
update(self, 1);
update(self, 0);
gtk_entry_set_text(d->entry, "");
dt_control_signal_raise(darktable.signals, DT_SIGNAL_TAG_CHANGED);
}
开发者ID:drinkcat,项目名称:darktable,代码行数:18,代码来源:tagging.c
示例2: new_button_clicked
static void new_button_clicked(GtkButton *button, gpointer user_data)
{
dt_lib_module_t *self = (dt_lib_module_t *)user_data;
dt_lib_tagging_t *d = (dt_lib_tagging_t *)self->data;
const gchar *tag = gtk_entry_get_text(d->entry);
/** attach tag to selected images */
dt_tag_attach_string_list(tag, -1);
dt_image_synch_xmp(-1);
update(self, 1);
update(self, 0);
/** clear input box */
gtk_entry_set_text(d->entry, "");
dt_control_signal_raise(darktable.signals, DT_SIGNAL_TAG_CHANGED);
}
开发者ID:AdamMajer,项目名称:darktable,代码行数:18,代码来源:tagging.c
示例3: set_params
// WARNING: also change src/libs/import.c when changing this!
int set_params(dt_lib_module_t *self, const void *params, int size)
{
if(!params) return 1;
char *buf = (char *)params;
const char *title = buf;
if(!title) return 1;
const int title_len = strlen(title) + 1;
buf += title_len;
const char *description = buf;
if(!description) return 1;
const int description_len = strlen(description) + 1;
buf += description_len;
const char *rights = buf;
if(!rights) return 1;
const int rights_len = strlen(rights) + 1;
buf += rights_len;
const char *creator = buf;
if(!creator) return 1;
const int creator_len = strlen(creator) + 1;
buf += creator_len;
const char *publisher = buf;
if(!publisher) return 1;
const int publisher_len = strlen(publisher) + 1;
if(size != title_len + description_len + rights_len + creator_len + publisher_len)
return 1;
if(title != NULL && title[0] != '\0') dt_metadata_set(-1, "Xmp.dc.title", title);
if(description != NULL && description[0] != '\0') dt_metadata_set(-1, "Xmp.dc.description", description);
if(rights != NULL && rights[0] != '\0') dt_metadata_set(-1, "Xmp.dc.rights", rights);
if(creator != NULL && creator[0] != '\0') dt_metadata_set(-1, "Xmp.dc.creator", creator);
if(publisher != NULL && publisher[0] != '\0') dt_metadata_set(-1, "Xmp.dc.publisher", publisher);
dt_image_synch_xmp(-1);
update(self, FALSE);
return 0;
}
开发者ID:dtorop,项目名称:darktable,代码行数:44,代码来源:metadata.c
示例4: entry_activated
static void
entry_activated (GtkButton *button, gpointer user_data)
{
dt_lib_module_t *self = (dt_lib_module_t *)user_data;
dt_lib_tagging_t *d = (dt_lib_tagging_t *)self->data;
const gchar *tag = gtk_entry_get_text(d->entry);
if(!tag || tag[0] == '\0') return;
/* create new tag */
guint tid=0;
dt_tag_new(tag, &tid);
/** attach tag to selected images */
dt_tag_attach(tid,-1);
dt_image_synch_xmp(-1);
update(self, 1);
update(self, 0);
gtk_entry_set_text(d->entry, "");
}
开发者ID:itarozzi,项目名称:darktable,代码行数:20,代码来源:tagging.c
示例5: detach_selected_tag
static void detach_selected_tag(dt_lib_module_t *self, dt_lib_tagging_t *d)
{
GtkTreeIter iter;
GtkTreeModel *model = NULL;
GtkTreeView *view = d->current;
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
if(!gtk_tree_selection_get_selected(selection, &model, &iter)) return;
guint tagid;
gtk_tree_model_get(model, &iter, DT_LIB_TAGGING_COL_ID, &tagid, -1);
int imgsel = -1;
if(tagid <= 0) return;
imgsel = dt_view_get_image_to_act_on();
dt_tag_detach(tagid, imgsel);
dt_image_synch_xmp(imgsel);
dt_control_signal_raise(darktable.signals, DT_SIGNAL_TAG_CHANGED);
}
开发者ID:AdamMajer,项目名称:darktable,代码行数:20,代码来源:tagging.c
示例6: write_metadata
static void write_metadata(dt_lib_module_t *self)
{
dt_lib_metadata_t *d = (dt_lib_metadata_t *)self->data;
int32_t mouse_over_id;
d->editing = FALSE;
mouse_over_id = d->imgsel;
gchar *title = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(d->title));
gchar *description = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(d->description));
gchar *rights = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(d->rights));
gchar *creator = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(d->creator));
gchar *publisher = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(d->publisher));
if(title != NULL && (d->multi_title == FALSE || gtk_combo_box_get_active(GTK_COMBO_BOX(d->title)) != 0))
dt_metadata_set(mouse_over_id, "Xmp.dc.title", title);
if(description != NULL && (d->multi_description == FALSE || gtk_combo_box_get_active(GTK_COMBO_BOX(d->description)) != 0))
dt_metadata_set(mouse_over_id, "Xmp.dc.description", description);
if(rights != NULL && (d->multi_rights == FALSE || gtk_combo_box_get_active(GTK_COMBO_BOX(d->rights)) != 0))
dt_metadata_set(mouse_over_id, "Xmp.dc.rights", rights);
if(creator != NULL && (d->multi_creator == FALSE || gtk_combo_box_get_active(GTK_COMBO_BOX(d->creator)) != 0))
dt_metadata_set(mouse_over_id, "Xmp.dc.creator", creator);
if(publisher != NULL && (d->multi_publisher == FALSE || gtk_combo_box_get_active(GTK_COMBO_BOX(d->publisher)) != 0))
dt_metadata_set(mouse_over_id, "Xmp.dc.publisher", publisher);
if(title != NULL)
g_free(title);
if(description != NULL)
g_free(description);
if(rights != NULL)
g_free(rights);
if(creator != NULL)
g_free(creator);
if(publisher != NULL)
g_free(publisher);
dt_image_synch_xmp(mouse_over_id);
update(self, FALSE);
}
开发者ID:ilbolzan,项目名称:darktable,代码行数:41,代码来源:metadata.c
示例7: detach_selected_tag
static void
detach_selected_tag(dt_lib_module_t *self, dt_lib_tagging_t *d)
{
GtkTreeIter iter;
GtkTreeModel *model = NULL;
GtkTreeView *view = d->current;
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
if(!gtk_tree_selection_get_selected(selection, &model, &iter)) return;
guint tagid;
gtk_tree_model_get (model, &iter,
DT_LIB_TAGGING_COL_ID, &tagid,
-1);
int imgsel = -1;
if(tagid <= 0) return;
DT_CTL_GET_GLOBAL(imgsel, lib_image_mouse_over_id);
dt_tag_detach(tagid,imgsel);
dt_image_synch_xmp(imgsel);
}
开发者ID:itarozzi,项目名称:darktable,代码行数:21,代码来源:tagging.c
示例8: rights_member
static int rights_member(lua_State *L)
{
if(lua_gettop(L) != 3)
{
const dt_image_t *my_image = checkreadimage(L, 1);
GList *res = dt_metadata_get(my_image->id, "Xmp.dc.rights", NULL);
if(res)
lua_pushstring(L, (char *)res->data);
else
lua_pushstring(L, "");
releasereadimage(L, my_image);
g_list_free_full(res, g_free);
return 1;
}
else
{
dt_image_t *my_image = checkwriteimage(L, 1);
dt_metadata_set(my_image->id, "Xmp.dc.rights", luaL_checkstring(L, 3));
dt_image_synch_xmp(my_image->id);
releasewriteimage(L, my_image);
return 0;
}
}
开发者ID:CarVac,项目名称:darktable,代码行数:23,代码来源:image.c
示例9: attach_selected_tag
static void
attach_selected_tag(dt_lib_module_t *self, dt_lib_tagging_t *d)
{
GtkTreeIter iter;
GtkTreeModel *model = NULL;
GtkTreeView *view = d->related;
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
if(!gtk_tree_selection_get_selected(selection, &model, &iter) &&
!gtk_tree_model_get_iter_first(model, &iter)) return;
guint tagid;
gtk_tree_model_get (model, &iter,
DT_LIB_TAGGING_COL_ID, &tagid,
-1);
int imgsel = -1;
if(tagid <= 0) return;
imgsel = dt_view_get_image_to_act_on();
dt_tag_attach(tagid,imgsel);
dt_image_synch_xmp(imgsel);
dt_collection_hint_message(darktable.collection);
}
开发者ID:MarcAntoine-Arnaud,项目名称:darktable,代码行数:24,代码来源:tagging.c
示例10: dt_styles_apply_to_image
void
dt_styles_apply_to_image(const char *name,gboolean duplicate, int32_t imgid)
{
int id=0;
sqlite3_stmt *stmt;
if ((id=dt_styles_get_id_by_name(name)) != 0)
{
/* check if we should make a duplicate before applying style */
if (duplicate)
imgid = dt_image_duplicate (imgid);
/* if merge onto history stack, lets find history offest in destination image */
int32_t offs = 0;
#if 1
{
/* apply on top of history stack */
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "select count(num) from history where imgid = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
if (sqlite3_step (stmt) == SQLITE_ROW) offs = sqlite3_column_int (stmt, 0);
}
#else
{
/* replace history stack */
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "delete from history where imgid = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
sqlite3_step (stmt);
}
#endif
sqlite3_finalize (stmt);
/* copy history items from styles onto image */
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "insert into history (imgid,num,module,operation,op_params,enabled,blendop_params,blendop_version,multi_priority,multi_name) select ?1, num+?2,module,operation,op_params,enabled,blendop_params,blendop_version,multi_priority,multi_name from style_items where styleid=?3", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, offs);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 3, id);
sqlite3_step (stmt);
sqlite3_finalize (stmt);
/* add tag */
guint tagid=0;
gchar ntag[512]= {0};
g_snprintf(ntag,512,"darktable|style|%s",name);
if (dt_tag_new(ntag,&tagid))
dt_tag_attach(tagid,imgid);
/* if current image in develop reload history */
if (dt_dev_is_current_image(darktable.develop, imgid))
{
dt_dev_reload_history_items (darktable.develop);
dt_dev_modulegroups_set(darktable.develop, dt_dev_modulegroups_get(darktable.develop));
}
/* update xmp file */
dt_image_synch_xmp(imgid);
/* remove old obsolete thumbnails */
dt_mipmap_cache_remove(darktable.mipmap_cache, imgid);
/* redraw center view to update visible mipmaps */
dt_control_queue_redraw_center();
}
}
开发者ID:gthb,项目名称:darktable,代码行数:63,代码来源:styles.c
示例11: dt_lightroom_import
//.........这里部分代码省略.........
ptc.tonecurve[ch_L][1].y += ptc.tonecurve[ch_L][1].y * ((float)ptc_value[0] / 100.0);
ptc.tonecurve[ch_L][2].y += ptc.tonecurve[ch_L][1].y * ((float)ptc_value[1] / 100.0);
ptc.tonecurve[ch_L][3].y += ptc.tonecurve[ch_L][1].y * ((float)ptc_value[2] / 100.0);
ptc.tonecurve[ch_L][4].y += ptc.tonecurve[ch_L][1].y * ((float)ptc_value[3] / 100.0);
if(ptc.tonecurve[ch_L][1].y > ptc.tonecurve[ch_L][2].y)
ptc.tonecurve[ch_L][1].y = ptc.tonecurve[ch_L][2].y;
if(ptc.tonecurve[ch_L][3].y > ptc.tonecurve[ch_L][4].y)
ptc.tonecurve[ch_L][4].y = ptc.tonecurve[ch_L][3].y;
}
dt_add_hist(imgid, "tonecurve", (dt_iop_params_t *)&ptc, sizeof(dt_iop_tonecurve_params_t), imported,
sizeof(imported), LRDT_TONECURVE_VERSION, &n_import);
refresh_needed = TRUE;
}
if(dev != NULL && has_colorzones)
{
pcz.channel = DT_IOP_COLORZONES_h;
for(int i = 0; i < 3; i++)
for(int k = 0; k < 8; k++) pcz.equalizer_x[i][k] = k / (DT_IOP_COLORZONES_BANDS - 1.0);
dt_add_hist(imgid, "colorzones", (dt_iop_params_t *)&pcz, sizeof(dt_iop_colorzones_params_t), imported,
sizeof(imported), LRDT_COLORZONES_VERSION, &n_import);
refresh_needed = TRUE;
}
if(dev != NULL && has_splittoning)
{
pst.compress = 50.0;
dt_add_hist(imgid, "splittoning", (dt_iop_params_t *)&pst, sizeof(dt_iop_splittoning_params_t), imported,
sizeof(imported), LRDT_SPLITTONING_VERSION, &n_import);
refresh_needed = TRUE;
}
if(dev != NULL && has_bilat)
{
pbl.sigma_r = 100.0;
pbl.sigma_s = 100.0;
dt_add_hist(imgid, "bilat", (dt_iop_params_t *)&pbl, sizeof(dt_iop_bilat_params_t), imported,
sizeof(imported), LRDT_BILAT_VERSION, &n_import);
refresh_needed = TRUE;
}
if(has_tags)
{
if(imported[0]) g_strlcat(imported, ", ", sizeof(imported));
g_strlcat(imported, _("tags"), sizeof(imported));
n_import++;
}
if(dev == NULL && has_rating)
{
dt_ratings_apply_to_image(imgid, rating);
if(imported[0]) g_strlcat(imported, ", ", sizeof(imported));
g_strlcat(imported, _("rating"), sizeof(imported));
n_import++;
}
if(dev == NULL && has_gps)
{
dt_image_set_location(imgid, lon, lat);
if(imported[0]) g_strlcat(imported, ", ", sizeof(imported));
g_strlcat(imported, _("geotagging"), sizeof(imported));
n_import++;
}
if(dev == NULL && has_colorlabel)
{
dt_colorlabels_set_label(imgid, color);
if(imported[0]) g_strlcat(imported, ", ", sizeof(imported));
g_strlcat(imported, _("color label"), sizeof(imported));
n_import++;
}
if(dev != NULL && refresh_needed && dev->gui_attached)
{
char message[512];
g_snprintf(message, sizeof(message), ngettext("%s has been imported", "%s have been imported", n_import),
imported);
dt_control_log(message);
if(!iauto)
{
/* signal history changed */
dt_dev_reload_history_items(dev);
dt_dev_modulegroups_set(darktable.develop, dt_dev_modulegroups_get(darktable.develop));
/* update xmp file */
dt_image_synch_xmp(imgid);
dt_control_signal_raise(darktable.signals, DT_SIGNAL_DEVELOP_HISTORY_CHANGE);
}
}
}
开发者ID:CaptainSifff,项目名称:darktable,代码行数:101,代码来源:lightroom.c
示例12: delete_button_clicked
static void
delete_button_clicked (GtkButton *button, gpointer user_data)
{
dt_lib_module_t *self = (dt_lib_module_t *)user_data;
dt_lib_tagging_t *d = (dt_lib_tagging_t *)self->data;
int res = GTK_RESPONSE_YES;
guint tagid;
GtkTreeIter iter;
GtkTreeModel *model = NULL;
GtkTreeView *view = d->related;
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
if(!gtk_tree_selection_get_selected(selection, &model, &iter)) return;
gtk_tree_model_get (model, &iter,
DT_LIB_TAGGING_COL_ID, &tagid,
-1);
// First check how many images are affected by the remove
int count = dt_tag_remove(tagid,FALSE);
if( count > 0 && dt_conf_get_bool("plugins/lighttable/tagging/ask_before_delete_tag") )
{
GtkWidget *dialog;
GtkWidget *win = dt_ui_main_window(darktable.gui->ui);
gchar *tagname=dt_tag_get_name(tagid);
dialog = gtk_message_dialog_new(GTK_WINDOW(win),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO,
ngettext("do you really want to delete the tag `%s'?\n%d image is assigned this tag!",
"do you really want to delete the tag `%s'?\n%d images are assigned this tag!", count),
tagname,count);
gtk_window_set_title(GTK_WINDOW(dialog), _("delete tag?"));
res = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
free(tagname);
}
if(res != GTK_RESPONSE_YES) return;
GList *tagged_images = NULL;
sqlite3_stmt *stmt;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "select imgid from tagged_images where tagid=?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, tagid);
while(sqlite3_step(stmt) == SQLITE_ROW)
{
tagged_images = g_list_append(tagged_images, GINT_TO_POINTER(sqlite3_column_int(stmt, 0)));
}
sqlite3_finalize(stmt);
dt_tag_remove(tagid,TRUE);
GList *list_iter;
if((list_iter = g_list_first(tagged_images)) != NULL)
{
do
{
dt_image_synch_xmp(GPOINTER_TO_INT(list_iter->data));
}
while((list_iter=g_list_next(list_iter)) != NULL);
}
g_list_free(g_list_first(tagged_images));
update(self, 0);
update(self, 1);
dt_control_signal_raise(darktable.signals, DT_SIGNAL_TAG_CHANGED);
}
开发者ID:drinkcat,项目名称:darktable,代码行数:67,代码来源:tagging.c
示例13: dt_history_copy_and_paste_on_image
int
dt_history_copy_and_paste_on_image (int32_t imgid, int32_t dest_imgid, gboolean merge, GList *ops)
{
sqlite3_stmt *stmt;
if(imgid==dest_imgid) return 1;
if(imgid==-1)
{
dt_control_log(_("you need to copy history from an image before you paste it onto another"));
return 1;
}
/* if merge onto history stack, lets find history offest in destination image */
int32_t offs = 0;
if (merge)
{
/* apply on top of history stack */
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "SELECT MAX(num)+1 FROM history WHERE imgid = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, dest_imgid);
if (sqlite3_step (stmt) == SQLITE_ROW) offs = sqlite3_column_int (stmt, 0);
}
else
{
/* replace history stack */
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "delete from history where imgid = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, dest_imgid);
sqlite3_step (stmt);
}
sqlite3_finalize (stmt);
// prepare SQL request
char req[2048];
strcpy (req, "insert into history (imgid, num, module, operation, op_params, enabled, blendop_params, blendop_version, multi_name, multi_priority) select ?1, num+?2, module, operation, op_params, enabled, blendop_params, blendop_version, multi_name, multi_priority from history where imgid = ?3");
// Add ops selection if any format: ... and num in (val1, val2)
if (ops)
{
GList *l = ops;
int first = 1;
strcat (req, " and num in (");
while (l)
{
unsigned int value = GPOINTER_TO_UINT(l->data);
char v[30];
if (!first) strcat (req, ",");
snprintf (v, 30, "%u", value);
strcat (req, v);
first=0;
l = g_list_next(l);
}
strcat (req, ")");
}
/* add the history items to stack offest */
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), req, -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, dest_imgid);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, offs);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 3, imgid);
sqlite3_step (stmt);
sqlite3_finalize (stmt);
if (merge && ops)
_dt_history_cleanup_multi_instance(dest_imgid, offs);
//we have to copy masks too
//what to do with existing masks ?
if (merge)
{
//there's very little chance that we will have same shapes id.
//but we may want to handle this case anyway
//and it's not trivial at all !
}
else
{
//let's remove all existing shapes
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "delete from mask where imgid = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, dest_imgid);
sqlite3_step (stmt);
sqlite3_finalize (stmt);
}
//let's copy now
strcpy (req, "insert into mask (imgid, formid, form, name, version, points, points_count, source) select ?1, formid, form, name, version, points, points_count, source from mask where imgid = ?2");
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), req, -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, dest_imgid);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, imgid);
sqlite3_step (stmt);
sqlite3_finalize (stmt);
/* if current image in develop reload history */
if (dt_dev_is_current_image(darktable.develop, dest_imgid))
{
dt_dev_reload_history_items (darktable.develop);
dt_dev_modulegroups_set(darktable.develop, dt_dev_modulegroups_get(darktable.develop));
}
/* update xmp file */
dt_image_synch_xmp(dest_imgid);
//.........这里部分代码省略.........
开发者ID:yama1968,项目名称:darktable,代码行数:101,代码来源:history.c
示例14: dt_history_copy_and_paste_on_image
//.........这里部分代码省略.........
char req[2048];
g_strlcpy(req, "INSERT INTO memory.style_items (num, module, operation, op_params, enabled, blendop_params, "
"blendop_version, multi_name, multi_priority) SELECT num, module, operation, "
"op_params, enabled, blendop_params, blendop_version, multi_name, multi_priority FROM "
"main.history WHERE imgid = ?1",
sizeof(req));
// Add ops selection if any format: ... and num in (val1, val2)
if(ops)
{
GList *l = ops;
int first = 1;
g_strlcat(req, " AND num IN (", sizeof(req));
while(l)
{
unsigned int value = GPOINTER_TO_UINT(l->data);
char v[30];
if(!first) g_strlcat(req, ",", sizeof(req));
snprintf(v, sizeof(v), "%u", value);
g_strlcat(req, v, sizeof(req));
first = 0;
l = g_list_next(l);
}
g_strlcat(req, ")", sizeof(req));
}
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), req, -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
/* copy the history items into the history of the dest image */
/* note: rowid starts at 1 while num has to start at 0! */
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"INSERT INTO main.history "
"(imgid,num,module,operation,op_params,enabled,blendop_params,blendop_"
"version,multi_priority,multi_name) SELECT "
"?1,?2+rowid-1,module,operation,op_params,enabled,blendop_params,blendop_"
"version,multi_priority,multi_name FROM memory.style_items",
-1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, dest_imgid);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, offs);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
if(merge && ops) _dt_history_cleanup_multi_instance(dest_imgid, offs);
// we have to copy masks too
// what to do with existing masks ?
if(merge)
{
// there's very little chance that we will have same shapes id.
// but we may want to handle this case anyway
// and it's not trivial at all !
}
else
{
// let's remove all existing shapes
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "DELETE FROM main.mask WHERE imgid = ?1", -1, &stmt,
NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, dest_imgid);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
}
// let's copy now
g_strlcpy(req, "INSERT INTO main.mask (imgid, formid, form, name, version, points, points_count, source) SELECT "
"?1, formid, form, name, version, points, points_count, source FROM main.mask WHERE imgid = ?2",
sizeof(req));
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), req, -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, dest_imgid);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, imgid);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
// always make the whole stack active
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"UPDATE main.images SET history_end = (SELECT MAX(num) + 1 FROM main.history "
"WHERE imgid = ?1) WHERE id = ?1",
-1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, dest_imgid);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
/* if current image in develop reload history */
if(dt_dev_is_current_image(darktable.develop, dest_imgid))
{
dt_dev_reload_history_items(darktable.develop);
dt_dev_modulegroups_set(darktable.develop, dt_dev_modulegroups_get(darktable.develop));
}
/* update xmp file */
dt_image_synch_xmp(dest_imgid);
dt_mipmap_cache_remove(darktable.mipmap_cache, dest_imgid);
return 0;
}
开发者ID:CChiappa,项目名称:darktable,代码行数:101,代码来源:history.c
示例15: clear_button_clicked
static void clear_button_clicked(GtkButton *button, gpointer user_data)
{
dt_metadata_clear(-1);
dt_image_synch_xmp(-1);
update(user_data, FALSE);
}
开发者ID:dtorop,项目名称:darktable,代码行数:6,代码来源:metadata.c
示例16: dt_styles_apply_to_image
void
dt_styles_apply_to_image(const char *name,gboolean duplicate, int32_t imgid)
{
int id=0;
sqlite3_stmt *stmt;
int32_t newimgid;
if ((id=dt_styles_get_id_by_name(name)) != 0)
{
/* check if we should make a duplicate before applying style */
if (duplicate)
{
newimgid = dt_image_duplicate (imgid);
if(newimgid != -1) dt_history_copy_and_paste_on_image(imgid, newimgid, FALSE, NULL);
}
else
newimgid = imgid;
/* merge onto history stack, let's find history offest in destination image */
int32_t offs = 0;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "SELECT MAX(num)+1 FROM history WHERE imgid = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, newimgid);
if (sqlite3_step (stmt) == SQLITE_ROW) offs = sqlite3_column_int (stmt, 0);
sqlite3_finalize (stmt);
/* delete all items from the temp styles_items, this table is used only to get a ROWNUM of the results */
DT_DEBUG_SQLITE3_EXEC(dt_database_get(darktable.db), "DELETE FROM memory.style_items",NULL,NULL,NULL);
/* copy history items from styles onto temp table */
DT_DEBUG_SQLITE3_PREPARE_V2
(dt_database_get(darktable.db),
"INSERT INTO MEMORY.style_items SELECT * FROM style_items WHERE styleid=?1 ORDER BY multi_priority DESC;", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, id);
sqlite3_step (stmt);
sqlite3_finalize (stmt);
/* copy the style items into the history */
DT_DEBUG_SQLITE3_PREPARE_V2
(dt_database_get(darktable.db),
"INSERT INTO history (imgid,num,module,operation,op_params,enabled,blendop_params,blendop_version,multi_priority,multi_name) SELECT ?1,?2+rowid,module,operation,op_params,enabled,blendop_params,blendop_version,multi_priority,multi_name FROM MEMORY.style_items", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, newimgid);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, offs);
sqlite3_step (stmt);
sqlite3_finalize (stmt);
/* add tag */
guint tagid=0;
gchar ntag[512]= {0};
g_snprintf(ntag,512,"darktable|style|%s",name);
if (dt_tag_new(ntag,&tagid))
dt_tag_attach(tagid,newimgid);
/* if current image in develop reload history */
if (dt_dev_is_current_image(darktable.develop, newimgid))
{
dt_dev_reload_history_items (darktable.develop);
dt_dev_modulegroups_set(darktable.develop, dt_dev_modulegroups_get(darktable.develop));
}
/* update xmp file */
dt_image_synch_xmp(newimgid);
/* remove old obsolete thumbnails */
dt_mipmap_cache_remove(darktable.mipmap_cache, newimgid);
/* if we have created a duplicate, reset collected images */
if (duplicate)
dt_control_signal_raise(darktable.signals, DT_SIGNAL_COLLECTION_CHANGED);
/* redraw center view to update visible mipmaps */
dt_control_queue_redraw_center();
}
}
开发者ID:hauva69,项目名称:darktable,代码行数:73,代码来源:styles.c
示例17: image_newindex
static int image_newindex(lua_State *L)
{
const char* membername = lua_tostring(L, -2);
dt_image_t * my_image=checkwriteimage(L,-3);
if(luaA_struct_has_member_name(L,dt_image_t,membername))
{
if(luaA_type_has_to_func(luaA_struct_typeof_member_name(L,dt_image_t,membername)))
{
luaA_struct_to_member_name(L, dt_image_t, my_image, membername,-1);
}
else
{
releasewriteimage(L,my_image);
luaL_error(L,"%s is read only",membername);
}
releasewriteimage(L,my_image);
return 0;
}
switch(luaL_checkoption(L,-2,NULL,image_fields_name))
{
case RATING:
{
int my_score = luaL_checkinteger(L,-1);
if(my_score > 5)
{
releasewriteimage(L,my_image);
return luaL_error(L,"rating too high : %d",my_score);
}
if(my_score == -1) my_score = 6;
if(my_score < -1)
{
releasewriteimage(L,my_image);
return luaL_error(L,"rating too low : %d",my_score);
}
my_image->flags &= ~0x7;
my_image->flags |= my_score;
break;
}
case CREATOR:
dt_metadata_set(my_image->id,"Xmp.dc.creator",luaL_checkstring(L,-1));
dt_image_synch_xmp(my_image->id);
break;
case PUBLISHER:
dt_metadata_set(my_image->id,"Xmp.dc.publisher",luaL_checkstring(L,-1));
dt_image_synch_xmp(my_image->id);
break;
case TITLE:
dt_metadata_set(my_image->id,"Xmp.dc.title",luaL_checkstring(L,-1));
dt_image_synch_xmp(my_image->id);
break;
case DESCRIPTION:
dt_metadata_set(my_image->id,"Xmp.dc.description",luaL_checkstring(L,-1));
dt_image_synch_xmp(my_image->id);
break;
case RIGHTS:
dt_metadata_set(my_image->id,"Xmp.dc.title",luaL_checkstring(L,-1));
dt_image_synch_xmp(my_image->id);
break;
case LOCAL_COPY:
{
int imgid = my_image->id;
luaL_checktype(L,-1,LUA_TBOOLEAN);
// we need to release write image for the other functions to use it
releasewriteimage(L,my_image);
if(lua_toboolean(L,-1)) {
dt_image_local_copy_set(imgid);
} else {
dt_image_local_copy_reset(imgid);
}
return 0;
}
default:
releasewriteimage(L,my_image);
return luaL_error(L,"unknown index for image : ",lua_tostring(L,-2));
}
releasewriteimage(L,my_image);
return 0;
}
开发者ID:cherrot,项目名称:darktable,代码行数:80,代码来源:image.c
注:本文中的dt_image_synch_xmp函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论