本文整理汇总了C++中dt_image_synch_xmp函数的典型用法代码示例。如果您正苦于以下问题:C++ dt_image_synch_xmp函数的具体用法?C++ dt_image_synch_xmp怎么用?C++ dt_image_synch_xmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dt_image_synch_xmp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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;
}
示例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, "");
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
}
示例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);
}
示例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();
}
}
示例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);
}
}
}
示例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);
}
示例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);
//.........这里部分代码省略.........
示例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;
}
示例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);
}