本文整理汇总了C++中C_函数的典型用法代码示例。如果您正苦于以下问题:C++ C_函数的具体用法?C++ C_怎么用?C++ C_使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了C_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: gimp_channel_select_by_index
void
gimp_channel_select_by_index (GimpChannel *channel,
GimpDrawable *drawable,
gint index,
GimpChannelOps op,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
GeglBuffer *add_on;
gint add_on_x = 0;
gint add_on_y = 0;
g_return_if_fail (GIMP_IS_CHANNEL (channel));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)));
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (gimp_drawable_is_indexed (drawable));
add_on = gegl_buffer_new (GEGL_RECTANGLE (0, 0,
gimp_item_get_width (GIMP_ITEM (drawable)),
gimp_item_get_height (GIMP_ITEM (drawable))),
babl_format ("Y float"));
gimp_gegl_index_to_mask (gimp_drawable_get_buffer (drawable), NULL,
gimp_drawable_get_format_without_alpha (drawable),
add_on, NULL,
index);
gimp_item_get_offset (GIMP_ITEM (drawable), &add_on_x, &add_on_y);
gimp_channel_select_buffer (channel, C_("undo-type", "Select by Indexed Color"),
add_on, add_on_x, add_on_y,
op,
feather,
feather_radius_x,
feather_radius_y);
g_object_unref (add_on);
}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:38,代码来源:gimpchannel-select.c
示例2: get_ap_security_string
static gchar *
get_ap_security_string (NMAccessPoint *ap)
{
NM80211ApSecurityFlags wpa_flags, rsn_flags;
NM80211ApFlags flags;
GString *str;
flags = nm_access_point_get_flags (ap);
wpa_flags = nm_access_point_get_wpa_flags (ap);
rsn_flags = nm_access_point_get_rsn_flags (ap);
str = g_string_new ("");
if ((flags & NM_802_11_AP_FLAGS_PRIVACY) &&
(wpa_flags == NM_802_11_AP_SEC_NONE) &&
(rsn_flags == NM_802_11_AP_SEC_NONE)) {
/* TRANSLATORS: this WEP WiFi security */
g_string_append_printf (str, "%s, ", _("WEP"));
}
if (wpa_flags != NM_802_11_AP_SEC_NONE) {
/* TRANSLATORS: this WPA WiFi security */
g_string_append_printf (str, "%s, ", _("WPA"));
}
if (rsn_flags != NM_802_11_AP_SEC_NONE) {
/* TRANSLATORS: this WPA WiFi security */
g_string_append_printf (str, "%s, ", _("WPA2"));
}
if ((wpa_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X) ||
(rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X)) {
/* TRANSLATORS: this Enterprise WiFi security */
g_string_append_printf (str, "%s, ", _("Enterprise"));
}
if (str->len > 0)
g_string_set_size (str, str->len - 2);
else {
g_string_append (str, C_("Wifi security", "None"));
}
return g_string_free (str, FALSE);
}
开发者ID:1dot75cm,项目名称:gnome-control-center,代码行数:38,代码来源:ce-page-details.c
示例3: gimp_image_item_list_rotate
void
gimp_image_item_list_rotate (GimpImage *image,
GList *list,
GimpContext *context,
GimpRotationType rotate_type,
gdouble center_x,
gdouble center_y,
gboolean clip_result)
{
g_return_if_fail (GIMP_IS_IMAGE (image));
g_return_if_fail (GIMP_IS_CONTEXT (context));
if (list)
{
GList *l;
if (list->next)
{
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TRANSFORM,
C_("undo-type", "Rotate Items"));
for (l = list; l; l = g_list_next (l))
gimp_item_start_transform (GIMP_ITEM (l->data), TRUE);
}
for (l = list; l; l = g_list_next (l))
gimp_item_rotate (GIMP_ITEM (l->data), context,
rotate_type, center_x, center_y, clip_result);
if (list->next)
{
for (l = list; l; l = g_list_next (l))
gimp_item_end_transform (GIMP_ITEM (l->data), TRUE);
gimp_image_undo_group_end (image);
}
}
}
开发者ID:jiapei100,项目名称:gimp,代码行数:38,代码来源:gimpimage-item-list.c
示例4: gimp_image_add_vguide
GimpGuide *
gimp_image_add_vguide (GimpImage *image,
gint position,
gboolean push_undo)
{
GimpGuide *guide;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (position >= 0 &&
position <= gimp_image_get_width (image), NULL);
guide = gimp_guide_new (GIMP_ORIENTATION_VERTICAL,
image->gimp->next_guide_ID++);
if (push_undo)
gimp_image_undo_push_guide (image,
C_("undo-type", "Add Vertical Guide"), guide);
gimp_image_add_guide (image, guide, position);
g_object_unref (guide);
return guide;
}
开发者ID:jiapei100,项目名称:gimp,代码行数:23,代码来源:gimpimage-guides.c
示例5: gimp_image_add_hguide
GimpGuide *
gimp_image_add_hguide (GimpImage *image,
gint position,
gboolean push_undo)
{
GimpGuide *guide;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (position >= 0 &&
position <= gimp_image_get_height (image), NULL);
guide = gimp_guide_new (GIMP_ORIENTATION_HORIZONTAL,
image->gimp->next_guide_ID++);
if (push_undo)
gimp_image_undo_push_guide (image,
C_("undo-type", "Add Horizontal Guide"), guide);
gimp_image_add_guide (image, guide, position);
g_object_unref (G_OBJECT (guide));
return guide;
}
开发者ID:jiapei100,项目名称:gimp,代码行数:23,代码来源:gimpimage-guides.c
示例6: totem_string_to_time
gint64
totem_string_to_time (const char *time_string)
{
int sec, min, hour, args;
args =
sscanf (time_string, C_ ("long time format", "%d:%02d:%02d"), &hour, &min,
&sec);
if (args == 3) {
/* Parsed all three arguments successfully */
return (hour * (60 * 60) + min * 60 + sec) * 1000;
} else if (args == 2) {
/* Only parsed the first two arguments; treat hour and min as min and sec, respectively */
return (hour * 60 + min) * 1000;
} else if (args == 1) {
/* Only parsed the first argument; treat hour as sec */
return hour * 1000;
} else {
/* Error! */
return -1;
}
}
开发者ID:kleopatra999,项目名称:chronojump,代码行数:23,代码来源:video-utils.c
示例7: add_access_point_other
static void
add_access_point_other (GisNetworkPage *page)
{
GisNetworkPagePrivate *priv = page->priv;
GtkTreeIter iter;
gtk_list_store_append (priv->ap_list, &iter);
gtk_list_store_set (priv->ap_list, &iter,
PANEL_WIRELESS_COLUMN_ID, "ap-other...",
/* TRANSLATORS: this is when the access point is not listed
* * in the dropdown (or hidden) and the user has to select
* * another entry manually */
PANEL_WIRELESS_COLUMN_TITLE, C_("Wireless access point", "Other..."),
/* always last */
PANEL_WIRELESS_COLUMN_STRENGTH, 0,
PANEL_WIRELESS_COLUMN_MODE, NM_802_11_MODE_UNKNOWN,
PANEL_WIRELESS_COLUMN_SECURITY, NM_AP_SEC_UNKNOWN,
PANEL_WIRELESS_COLUMN_ACTIVATING, FALSE,
PANEL_WIRELESS_COLUMN_ACTIVE, FALSE,
PANEL_WIRELESS_COLUMN_PULSE, priv->pulse,
-1);
}
开发者ID:rzr,项目名称:gnome-initial-setup,代码行数:23,代码来源:gis-network-page.c
示例8: connect_styles_key_accels
void connect_styles_key_accels()
{
GList *result = dt_styles_get_list("");
if (result)
{
do
{
GClosure *closure;
dt_style_t *style = (dt_style_t *)result->data;
closure = g_cclosure_new(
G_CALLBACK(_apply_style_shortcut_callback),
style->name, _destroy_style_shortcut_callback);
char tmp_accel[1024];
snprintf(tmp_accel,1024,C_("accel", "styles/apply %s"),style->name);
dt_accel_connect_global(tmp_accel, closure);
//g_free(style->name); freed at closure destruction
g_free(style->description);
g_free(style);
}
while ((result=g_list_next(result))!=NULL);
}
}
开发者ID:hauva69,项目名称:darktable,代码行数:23,代码来源:styles.c
示例9: gimp_drawable_tree_view_drop_viewable
static void
gimp_drawable_tree_view_drop_viewable (GimpContainerTreeView *view,
GimpViewable *src_viewable,
GimpViewable *dest_viewable,
GtkTreeViewDropPosition drop_pos)
{
if (dest_viewable && GIMP_IS_PATTERN (src_viewable))
{
gimp_edit_fill_full (gimp_item_get_image (GIMP_ITEM (dest_viewable)),
GIMP_DRAWABLE (dest_viewable),
NULL, GIMP_PATTERN (src_viewable),
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE,
C_("undo-type", "Drop pattern to layer"));
gimp_image_flush (gimp_item_get_image (GIMP_ITEM (dest_viewable)));
return;
}
GIMP_CONTAINER_TREE_VIEW_CLASS (parent_class)->drop_viewable (view,
src_viewable,
dest_viewable,
drop_pos);
}
开发者ID:Distrotech,项目名称:gimp,代码行数:23,代码来源:gimpdrawabletreeview.c
示例10: gweather_timezone_model_new
static GtkTreeModel *
gweather_timezone_model_new (GWeatherLocation *top)
{
GtkTreeStore *store;
GtkTreeModel *model;
GtkTreeIter iter;
char *unknown;
GWeatherTimezone *utc;
store = gtk_tree_store_new (2, G_TYPE_STRING, GWEATHER_TYPE_TIMEZONE);
model = GTK_TREE_MODEL (store);
unknown = g_markup_printf_escaped ("<i>%s</i>", C_("timezone", "Unknown"));
gtk_tree_store_append (store, &iter, NULL);
gtk_tree_store_set (store, &iter,
GWEATHER_TIMEZONE_MENU_NAME, unknown,
GWEATHER_TIMEZONE_MENU_ZONE, NULL,
-1);
utc = gweather_timezone_get_utc ();
if (utc) {
insert_location (store, utc, NULL, NULL);
gweather_timezone_unref (utc);
}
gtk_tree_store_append (store, &iter, NULL);
g_free (unknown);
if (!top)
top = gweather_location_get_world ();
insert_locations (store, top);
return model;
}
开发者ID:Distrotech,项目名称:libgweather,代码行数:37,代码来源:gweather-timezone-menu.c
示例11: image_scale_dialog_new
GtkWidget *
image_scale_dialog_new (GimpImage *image,
GimpContext *context,
GtkWidget *parent,
GimpUnit unit,
GimpInterpolationType interpolation,
GimpScaleCallback callback,
gpointer user_data)
{
ImageScaleDialog *dialog;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (callback != NULL, NULL);
dialog = g_slice_new0 (ImageScaleDialog);
dialog->image = image;
dialog->dialog = scale_dialog_new (GIMP_VIEWABLE (image), context,
C_("dialog-title", "Scale Image"),
"gimp-image-scale",
parent,
gimp_standard_help_func,
GIMP_HELP_IMAGE_SCALE,
unit,
interpolation,
image_scale_callback,
dialog);
g_object_weak_ref (G_OBJECT (dialog->dialog),
(GWeakNotify) image_scale_dialog_free, dialog);
dialog->callback = callback;
dialog->user_data = user_data;
return dialog->dialog;
}
开发者ID:jdburton,项目名称:gimp-osx,代码行数:37,代码来源:image-scale-dialog.c
示例12: format_mdraid_level
static const gchar *
format_mdraid_level (const gchar *level)
{
const gchar *ret = NULL;
if (g_strcmp0 (level, "raid0") == 0)
ret = C_("mdraid-desc", "RAID-0 Array");
else if (g_strcmp0 (level, "raid1") == 0)
ret = C_("mdraid-desc", "RAID-1 Array");
else if (g_strcmp0 (level, "raid4") == 0)
ret = C_("mdraid-desc", "RAID-4 Array");
else if (g_strcmp0 (level, "raid5") == 0)
ret = C_("mdraid-desc", "RAID-5 Array");
else if (g_strcmp0 (level, "raid6") == 0)
ret = C_("mdraid-desc", "RAID-6 Array");
else if (g_strcmp0 (level, "raid10") == 0)
ret = C_("mdraid-desc", "RAID-10 Array");
else
ret = C_("mdraid-desc", "RAID Array");
return ret;
}
开发者ID:GinoM,项目名称:eudisk,代码行数:22,代码来源:udisksobjectinfo.c
示例13: update_scale_marks
static void
update_scale_marks (GvcBalanceBar *bar)
{
gchar *str_lower = NULL,
*str_upper = NULL;
gdouble lower,
upper;
gtk_scale_clear_marks (GTK_SCALE (bar->priv->scale));
switch (bar->priv->btype) {
case BALANCE_TYPE_RL:
str_lower = g_strdup_printf ("<small>%s</small>", C_("balance", "Left"));
str_upper = g_strdup_printf ("<small>%s</small>", C_("balance", "Right"));
break;
case BALANCE_TYPE_FR:
str_lower = g_strdup_printf ("<small>%s</small>", C_("balance", "Rear"));
str_upper = g_strdup_printf ("<small>%s</small>", C_("balance", "Front"));
break;
case BALANCE_TYPE_LFE:
str_lower = g_strdup_printf ("<small>%s</small>", C_("balance", "Minimum"));
str_upper = g_strdup_printf ("<small>%s</small>", C_("balance", "Maximum"));
break;
}
lower = gtk_adjustment_get_lower (bar->priv->adjustment);
gtk_scale_add_mark (GTK_SCALE (bar->priv->scale),
lower,
GTK_POS_BOTTOM,
str_lower);
upper = gtk_adjustment_get_upper (bar->priv->adjustment);
gtk_scale_add_mark (GTK_SCALE (bar->priv->scale),
upper,
GTK_POS_BOTTOM,
str_upper);
g_free (str_lower);
g_free (str_upper);
if (bar->priv->btype != BALANCE_TYPE_LFE)
gtk_scale_add_mark (GTK_SCALE (bar->priv->scale),
(upper - lower) / 2 + lower,
GTK_POS_BOTTOM,
NULL);
}
开发者ID:City-busz,项目名称:mate-media,代码行数:44,代码来源:gvc-balance-bar.c
示例14: dt_styles_delete_by_name
void
dt_styles_delete_by_name(const char *name)
{
int id=0;
if ((id=dt_styles_get_id_by_name(name)) != 0)
{
/* delete the style */
sqlite3_stmt *stmt;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "DELETE FROM styles WHERE id = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, id);
sqlite3_step (stmt);
sqlite3_finalize (stmt);
/* delete style_items belonging to style */
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "delete from style_items where styleid = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, id);
sqlite3_step (stmt);
sqlite3_finalize (stmt);
char tmp_accel[1024];
snprintf(tmp_accel,1024,C_("accel", "styles/apply %s"),name);
dt_accel_deregister_global(tmp_accel);
}
}
开发者ID:hauva69,项目名称:darktable,代码行数:24,代码来源:styles.c
示例15: gimp_foreground_select_tool_apply
static void
gimp_foreground_select_tool_apply (GimpForegroundSelectTool *fg_select,
GimpDisplay *display)
{
GimpTool *tool = GIMP_TOOL (fg_select);
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (fg_select);
GimpImage *image = gimp_display_get_image (display);
g_return_if_fail (fg_select->mask != NULL);
gimp_channel_select_buffer (gimp_image_get_mask (image),
C_("command", "Foreground Select"),
fg_select->mask,
0, /* x offset */
0, /* y offset */
options->operation,
options->feather,
options->feather_radius,
options->feather_radius);
gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, display);
gimp_image_flush (image);
}
开发者ID:ChristianBusch,项目名称:gimp,代码行数:24,代码来源:gimpforegroundselecttool.c
示例16: gnt_check_box_draw
static void
gnt_check_box_draw(GntWidget *widget)
{
GntCheckBox *cb = GNT_CHECK_BOX(widget);
GntColorType type;
gboolean focus = gnt_widget_has_focus(widget);
if (focus)
type = GNT_COLOR_HIGHLIGHT;
else
type = GNT_COLOR_NORMAL;
wbkgdset(widget->window, '\0' | gnt_color_pair(type));
mvwaddch(widget->window, 0, 0, '[');
mvwaddch(widget->window, 0, 1, (cb->checked ? 'X' : ' ') | (focus ? A_UNDERLINE : A_NORMAL));
mvwaddch(widget->window, 0, 2, ']');
wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_NORMAL));
mvwaddstr(widget->window, 0, 4, C_(GNT_BUTTON(cb)->priv->text));
(void)wmove(widget->window, 0, 1);
GNTDEBUG;
}
开发者ID:CkNoSFeRaTU,项目名称:pidgin,代码行数:24,代码来源:gntcheckbox.c
示例17: throw
void
ExifData::set_metering_mode(const Glib::ustring & metering_mode)
throw()
{
if (meteringModeAverage_ == metering_mode)
{
meteringMode_ = C_("Metering mode", "Average");
}
else if (meteringModeCenterWeightedAverage_ == metering_mode)
{
meteringMode_ = C_("Metering mode",
"Center Weighted Average");
}
else if (meteringModeSpot_ == metering_mode)
{
meteringMode_ = C_("Metering mode", "Spot");
}
else if (meteringModeMultiSpot_ == metering_mode)
{
meteringMode_ = C_("Metering mode", "Multi-spot");
}
else if (meteringModePattern_ == metering_mode)
{
meteringMode_ = C_("Metering mode", "Pattern");
}
else if (meteringModePartial_ == metering_mode)
{
meteringMode_ = C_("Metering mode", "Partial");
}
else
{
meteringMode_ = "";
}
meteringModeEnum_ = metering_mode;
}
开发者ID:GNOME,项目名称:solang,代码行数:36,代码来源:exif-data.cpp
示例18: gimp_drawable_blend
void
gimp_drawable_blend (GimpDrawable *drawable,
GimpContext *context,
GimpBlendMode blend_mode,
GimpLayerModeEffects paint_mode,
GimpGradientType gradient_type,
gdouble opacity,
gdouble offset,
GimpRepeatMode repeat,
gboolean reverse,
gboolean supersample,
gint max_depth,
gdouble threshold,
gboolean dither,
gdouble startx,
gdouble starty,
gdouble endx,
gdouble endy,
GimpProgress *progress)
{
GimpImage *image;
GeglBuffer *buffer;
gint x, y, width, height;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
g_return_if_fail (GIMP_IS_CONTEXT (context));
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
image = gimp_item_get_image (GIMP_ITEM (drawable));
if (! gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
return;
gimp_set_busy (image->gimp);
/* Always create an alpha temp buf (for generality) */
buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0, width, height),
gimp_drawable_get_format_with_alpha (drawable));
gradient_fill_region (image, drawable, context,
buffer, GEGL_RECTANGLE (0, 0, width, height),
blend_mode, gradient_type, offset, repeat, reverse,
supersample, max_depth, threshold, dither,
(startx - x), (starty - y),
(endx - x), (endy - y),
progress);
gimp_drawable_apply_buffer (drawable, buffer,
GEGL_RECTANGLE (0, 0, width, height),
TRUE, C_("undo-type", "Blend"),
opacity, paint_mode,
NULL, x, y);
/* update the image */
gimp_drawable_update (drawable, x, y, width, height);
/* free the temporary buffer */
g_object_unref (buffer);
gimp_unset_busy (image->gimp);
}
开发者ID:ChristianBusch,项目名称:gimp,代码行数:62,代码来源:gimpdrawable-blend.c
示例19: dt_styles_create_from_image
gboolean
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 FALSE;
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,"%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,"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);
_dt_style_cleanup_multi_instance(id);
/* 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 _destroy_style_shortcut_callback
snprintf(tmp_accel,1024,C_("accel", "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);
return TRUE;
}
return FALSE;
}
开发者ID:hauva69,项目名称:darktable,代码行数:61,代码来源:styles.c
示例20: 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 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(newname,stylesdir,TRUE);
/* delete old accelerator and create a new one */
//TODO: should better use dt_accel_rename_global() to keep the old accel_key untouched, but it seems to be buggy
if (g_strcmp0(name, newname))
{
char tmp_accel[1024];
snprintf(tmp_accel, 1024, C_("accel", "styles/apply %s"), name);
dt_accel_deregister_global(tmp_accel);
gchar* tmp_name = g_strdup(newname); // freed by _destroy_style_shortcut_callback
snprintf(tmp_accel, 1024, C_("accel", "styles/apply %s"), newname);
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);
}
g_free(desc);
}
开发者ID:hauva69,项目名称:darktable,代码行数:78,代码来源:styles.c
注:本文中的C_函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论