这篇教程C++ C_函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中C_函数的典型用法代码示例。如果您正苦于以下问题:C++ C_函数的具体用法?C++ C_怎么用?C++ C_使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了C_函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: gimp_channel_select_by_indexvoidgimp_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,
示例2: get_ap_security_stringstatic 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,
示例3: gimp_image_item_list_rotatevoidgimp_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,
示例4: gimp_image_add_vguideGimpGuide *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,
示例5: gimp_image_add_hguideGimpGuide *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,
示例6: totem_string_to_timegint64totem_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,
示例7: add_access_point_otherstatic voidadd_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,
示例8: connect_styles_key_accelsvoid 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,
示例9: gimp_drawable_tree_view_drop_viewablestatic voidgimp_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,
示例10: gweather_timezone_model_newstatic 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,
示例11: image_scale_dialog_newGtkWidget *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,
示例12: format_mdraid_levelstatic 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,
示例13: update_scale_marksstatic voidupdate_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,
示例14: dt_styles_delete_by_namevoiddt_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,
示例15: gimp_foreground_select_tool_applystatic voidgimp_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,
示例16: gnt_check_box_drawstatic voidgnt_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,
示例17: throwvoidExifData::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,
示例18: gimp_drawable_blendvoidgimp_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,
示例19: dt_styles_create_from_imagegbooleandt_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,
示例20: dt_styles_updatevoiddt_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,
示例21: accel_set_funcstatic voidaccel_set_func (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, gpointer data){ CsdWacomTabletButton *button; CsdWacomActionType type; GtkDirectionType dir; char *str; guint keyval; guint mask; gtk_tree_model_get (model, iter, MAPPING_BUTTON_COLUMN, &button, MAPPING_BUTTON_DIRECTION, &dir, -1); if (button == NULL) { g_object_set (cell, "visible", FALSE, NULL); return; } if (button->type == WACOM_TABLET_BUTTON_TYPE_HARDCODED) { /* FIXME this should list the name of the button, * Switch Modes Touchring #1 for example */ g_object_set (cell, "visible", TRUE, "editable", FALSE, "accel-key", 0, "accel-mods", 0, "style", PANGO_STYLE_NORMAL, "text", "", NULL); return; } if (button->settings == NULL) { g_warning ("Button '%s' does not have an associated GSettings", button->id); return; } type = g_settings_get_enum (button->settings, ACTION_TYPE_KEY); if (type != CSD_WACOM_ACTION_TYPE_CUSTOM) { g_object_set (cell, "visible", TRUE, "editable", TRUE, "accel-key", 0, "accel-mods", 0, "style", PANGO_STYLE_NORMAL, "text", "", NULL); return; } if (button->type == WACOM_TABLET_BUTTON_TYPE_STRIP || button->type == WACOM_TABLET_BUTTON_TYPE_RING) str = get_elevator_shortcut_string (button->settings, dir); else str = g_settings_get_string (button->settings, CUSTOM_ACTION_KEY); if (str == NULL || *str == '/0') { g_object_set (cell, "visible", TRUE, "editable", TRUE, "accel-key", 0, "accel-mods", 0, "style", PANGO_STYLE_NORMAL, "text", C_("Wacom action-type", "None"), NULL); g_free (str); return; } gtk_accelerator_parse (str, &keyval, &mask); g_free (str); g_object_set (cell, "visible", TRUE, "editable", TRUE, "accel-key", keyval, "accel-mods", mask, "style", PANGO_STYLE_NORMAL, NULL);}
开发者ID:chitwanix,项目名称:sagarmatha-control-center,代码行数:87,
示例22: dt_styles_create_from_stylevoid dt_styles_create_from_style(const char *name, const char *newname, const char *description, GList *filter, int imgid, GList *update){ sqlite3_stmt *stmt; int id = 0; int oldid = 0; oldid = dt_styles_get_id_by_name(name); if(oldid == 0) return; /* create the style header */ if(!dt_styles_create_style_header(newname, description)) return; if((id = dt_styles_get_id_by_name(newname)) != 0) { if(filter) { GList *list = filter; char tmp[64]; char include[2048] = { 0 }; g_strlcat(include, "num in (", sizeof(include)); do { if(list != g_list_first(list)) g_strlcat(include, ",", sizeof(include)); snprintf(tmp, sizeof(tmp), "%d", GPOINTER_TO_INT(list->data)); g_strlcat(include, tmp, sizeof(include)); } while((list = g_list_next(list))); g_strlcat(include, ")", sizeof(include)); char query[4096] = { 0 }; snprintf(query, sizeof(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 style_items where styleid=?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 style_items where styleid=?2", -1, &stmt, NULL); DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, id); DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, oldid); sqlite3_step(stmt); sqlite3_finalize(stmt); /* insert items from imgid if defined */ _dt_style_update_from_image(id, imgid, filter, update); _dt_style_cleanup_multi_instance(id); /* backup style to disk */ char stylesdir[PATH_MAX] = { 0 }; dt_loc_get_user_config_dir(stylesdir, sizeof(stylesdir)); g_strlcat(stylesdir, "/styles", sizeof(stylesdir)); g_mkdir_with_parents(stylesdir, 00755); dt_styles_save_to_file(newname, stylesdir, FALSE); char tmp_accel[1024]; gchar *tmp_name = g_strdup(newname); // freed by _destroy_style_shortcut_callback snprintf(tmp_accel, sizeof(tmp_accel), 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); dt_control_log(_("style named '%s' successfully created"), newname); dt_control_signal_raise(darktable.signals, DT_SIGNAL_STYLE_CHANGED); }}
开发者ID:kael-shipman,项目名称:darktable,代码行数:77,
示例23: save_dialogstatic gbooleansave_dialog (void){ GtkWidget *dlg; GtkWidget *main_vbox; GtkWidget *entry; GtkWidget *table; GtkWidget *scrolled_window; GtkWidget *text_view; GtkTextBuffer *text_buffer; gchar *gump_from; gint row = 0; gboolean run; gimp_ui_init (PLUG_IN_BINARY, FALSE); /* check gimprc for a preferred "From:" address */ gump_from = gimp_gimprc_query ("gump-from"); if (gump_from) { g_strlcpy (mail_info.from, gump_from, BUFFER_SIZE); g_free (gump_from); } dlg = gimp_dialog_new (_("Send by Email"), PLUG_IN_ROLE, NULL, 0, gimp_standard_help_func, PLUG_IN_PROC, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("_Send"), GTK_RESPONSE_OK, NULL); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dlg), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); gimp_window_set_transient (GTK_WINDOW (dlg)); main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), main_vbox, TRUE, TRUE, 0); gtk_widget_show (main_vbox); /* table */ table = gtk_table_new (5, 2, FALSE); gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0); gtk_widget_show (table); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_table_set_row_spacing (GTK_TABLE (table), 0, 12); gtk_table_set_col_spacings (GTK_TABLE (table), 6); /* Filename entry */ entry = gtk_entry_new (); gtk_widget_set_size_request (entry, 200, -1); gtk_entry_set_max_length (GTK_ENTRY (entry), BUFFER_SIZE - 1); gtk_entry_set_text (GTK_ENTRY (entry), mail_info.filename); gimp_table_attach_aligned (GTK_TABLE (table), 0, row++, _("_Filename:"), 0.0, 0.5, entry, 1, FALSE); g_signal_connect (entry, "changed", G_CALLBACK (mail_entry_callback), mail_info.filename); /* To entry */ entry = gtk_entry_new (); gtk_widget_set_size_request (entry, 200, -1); gtk_entry_set_max_length (GTK_ENTRY (entry), BUFFER_SIZE - 1); gtk_entry_set_text (GTK_ENTRY (entry), mail_info.receipt); gimp_table_attach_aligned (GTK_TABLE (table), 0, row++, C_("email-address", "_To:"), 0.0, 0.5, entry, 1, FALSE); g_signal_connect (entry, "changed", G_CALLBACK (mail_entry_callback), mail_info.receipt); gtk_widget_grab_focus (entry); /* From entry */ entry = gtk_entry_new (); gtk_widget_set_size_request (entry, 200, -1); gtk_entry_set_max_length (GTK_ENTRY (entry), BUFFER_SIZE - 1); gtk_entry_set_text (GTK_ENTRY (entry), mail_info.from); gimp_table_attach_aligned (GTK_TABLE (table), 0, row++, C_("email-address", "_From:"), 0.0, 0.5, entry, 1, FALSE); g_signal_connect (entry, "changed", G_CALLBACK (mail_entry_callback), mail_info.from); /* Subject entry */ entry = gtk_entry_new (); gtk_widget_set_size_request (entry, 200, -1); gtk_entry_set_max_length (GTK_ENTRY (entry), BUFFER_SIZE - 1); gtk_entry_set_text (GTK_ENTRY (entry), mail_info.subject); gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,//.........这里部分代码省略.........
开发者ID:Bootz,项目名称:shiny-robot,代码行数:101,
示例24: gui_initvoid gui_init(struct dt_iop_module_t *self){ self->gui_data = malloc(sizeof(dt_iop_colorout_gui_data_t)); memset(self->gui_data,0,sizeof(dt_iop_colorout_gui_data_t)); dt_iop_colorout_gui_data_t *g = (dt_iop_colorout_gui_data_t *)self->gui_data; g->profiles = NULL; dt_iop_color_profile_t *prof = (dt_iop_color_profile_t *)g_malloc0(sizeof(dt_iop_color_profile_t)); g_strlcpy(prof->filename, "sRGB", sizeof(prof->filename)); g_strlcpy(prof->name, "sRGB", sizeof(prof->name)); int pos; int display_pos; prof->pos = 0; prof->display_pos = 0; g->profiles = g_list_append(g->profiles, prof); prof = (dt_iop_color_profile_t *)g_malloc0(sizeof(dt_iop_color_profile_t)); g_strlcpy(prof->filename, "adobergb", sizeof(prof->filename)); g_strlcpy(prof->name, "adobergb", sizeof(prof->name)); prof->pos = 1; prof->display_pos = 1; g->profiles = g_list_append(g->profiles, prof); prof = (dt_iop_color_profile_t *)g_malloc0(sizeof(dt_iop_color_profile_t)); g_strlcpy(prof->filename, "X profile", sizeof(prof->filename)); g_strlcpy(prof->name, "X profile", sizeof(prof->name)); prof->pos = -1; prof->display_pos = 2; g->profiles = g_list_append(g->profiles, prof); prof = (dt_iop_color_profile_t *)g_malloc0(sizeof(dt_iop_color_profile_t)); g_strlcpy(prof->filename, "linear_rgb", sizeof(prof->filename)); g_strlcpy(prof->name, "linear_rgb", sizeof(prof->name)); pos = prof->pos = 2; display_pos = prof->display_pos = 3; g->profiles = g_list_append(g->profiles, prof); // read {conf,data}dir/color/out/*.icc char datadir[DT_MAX_PATH_LEN]; char confdir[DT_MAX_PATH_LEN]; char dirname[DT_MAX_PATH_LEN]; char filename[DT_MAX_PATH_LEN]; dt_loc_get_user_config_dir(confdir, DT_MAX_PATH_LEN); dt_loc_get_datadir(datadir, DT_MAX_PATH_LEN); snprintf(dirname, DT_MAX_PATH_LEN, "%s/color/out", confdir); if(!g_file_test(dirname, G_FILE_TEST_IS_DIR)) snprintf(dirname, DT_MAX_PATH_LEN, "%s/color/out", datadir); cmsHPROFILE tmpprof; const gchar *d_name; GDir *dir = g_dir_open(dirname, 0, NULL); if(dir) { while((d_name = g_dir_read_name(dir))) { snprintf(filename, DT_MAX_PATH_LEN, "%s/%s", dirname, d_name); tmpprof = cmsOpenProfileFromFile(filename, "r"); if(tmpprof) { char *lang = getenv("LANG"); if (!lang) lang = "en_US"; dt_iop_color_profile_t *prof = (dt_iop_color_profile_t *)g_malloc0(sizeof(dt_iop_color_profile_t)); char name[1024]; cmsGetProfileInfoASCII(tmpprof, cmsInfoDescription, lang, lang+3, name, 1024); g_strlcpy(prof->name, name, sizeof(prof->name)); g_strlcpy(prof->filename, d_name, sizeof(prof->filename)); prof->pos = ++pos; prof->display_pos = ++display_pos; cmsCloseProfile(tmpprof); g->profiles = g_list_append(g->profiles, prof); } } g_dir_close(dir); } self->widget = gtk_vbox_new(TRUE, DT_BAUHAUS_SPACE); // TODO: g->cbox1 = dt_bauhaus_combobox_new(self); gtk_box_pack_start(GTK_BOX(self->widget), g->cbox1, TRUE, TRUE, 0); dt_bauhaus_widget_set_label(g->cbox1, _("output intent")); dt_bauhaus_combobox_add(g->cbox1, _("perceptual")); dt_bauhaus_combobox_add(g->cbox1, _("relative colorimetric")); dt_bauhaus_combobox_add(g->cbox1, C_("rendering intent", "saturation")); dt_bauhaus_combobox_add(g->cbox1, _("absolute colorimetric")); g->cbox4 = dt_bauhaus_combobox_new(self); dt_bauhaus_widget_set_label(g->cbox4, _("display intent")); gtk_box_pack_start(GTK_BOX(self->widget), g->cbox4, TRUE, TRUE, 0); dt_bauhaus_combobox_add(g->cbox4, _("perceptual")); dt_bauhaus_combobox_add(g->cbox4, _("relative colorimetric")); dt_bauhaus_combobox_add(g->cbox4, C_("rendering intent", "saturation")); dt_bauhaus_combobox_add(g->cbox4, _("absolute colorimetric")); g->cbox2 = dt_bauhaus_combobox_new(self); g->cbox3 = dt_bauhaus_combobox_new(self); g->cbox5 = dt_bauhaus_combobox_new(self); dt_bauhaus_widget_set_label(g->cbox2, _("output profile")); dt_bauhaus_widget_set_label(g->cbox5, _("softproof profile")); dt_bauhaus_widget_set_label(g->cbox3, _("display profile")); gtk_box_pack_start(GTK_BOX(self->widget), g->cbox2, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(self->widget), g->cbox5, TRUE, TRUE, 0);//.........这里部分代码省略.........
开发者ID:jimmy1977,项目名称:darktable,代码行数:101,
示例25: C_const char *name(){ return C_("sharpen", "sharpen");}
开发者ID:AntonSh,项目名称:darktable,代码行数:4,
示例26: mbox_get_previewstatic GtkWidget *mbox_get_preview (EImport *ei, EImportTarget *target, EImportImporter *im){ GtkWidget *preview = NULL; EImportTargetURI *s = (EImportTargetURI *) target; gchar *filename; gint fd; CamelMimeParser *mp; GtkListStore *store = NULL; GtkTreeIter iter; GtkWidget *preview_widget = NULL; gboolean any_read = FALSE; if (!create_preview_func || !fill_preview_func) return NULL; filename = g_filename_from_uri (s->uri_src, NULL, NULL); if (!filename) { g_message (G_STRLOC ": Couldn't get filename from URI '%s'", s->uri_src); return NULL; } fd = g_open (filename, O_RDONLY | O_BINARY, 0); if (fd == -1) { g_warning ( "Cannot find source file to import '%s': %s", filename, g_strerror (errno)); g_free (filename); return NULL; } mp = camel_mime_parser_new (); camel_mime_parser_scan_from (mp, TRUE); if (camel_mime_parser_init_with_fd (mp, fd) == -1) { goto cleanup; } while (camel_mime_parser_step (mp, NULL, NULL) == CAMEL_MIME_PARSER_STATE_FROM) { CamelMimeMessage *msg; any_read = TRUE; msg = camel_mime_message_new (); if (!camel_mime_part_construct_from_parser_sync ( (CamelMimePart *) msg, mp, NULL, NULL)) { g_object_unref (msg); break; } mbox_preview_add_message (msg, &store); g_object_unref (msg); camel_mime_parser_step (mp, NULL, NULL); } if (!any_read) { CamelStream *stream; stream = camel_stream_fs_new_with_name (filename, O_RDONLY, 0, NULL); if (stream) { CamelMimeMessage *msg; msg = camel_mime_message_new (); if (camel_data_wrapper_construct_from_stream_sync ((CamelDataWrapper *) msg, stream, NULL, NULL)) mbox_preview_add_message (msg, &store); g_object_unref (msg); g_object_unref (stream); } } if (store) { GtkTreeView *tree_view; GtkTreeSelection *selection; preview = e_web_view_preview_new (); gtk_widget_show (preview); tree_view = e_web_view_preview_get_tree_view ( E_WEB_VIEW_PREVIEW (preview)); if (!tree_view) { g_warn_if_reached (); gtk_widget_destroy (preview); preview = NULL; goto cleanup; } gtk_tree_view_set_model (tree_view, GTK_TREE_MODEL (store)); g_object_unref (store); /* Translators: Column header for a message subject */ gtk_tree_view_insert_column_with_attributes ( tree_view, -1, C_("mboxImp", "Subject"), gtk_cell_renderer_text_new (), "text", 0, NULL); /* Translators: Column header for a message From address *///.........这里部分代码省略.........
开发者ID:alexanderhmw,项目名称:evolution,代码行数:101,
示例27: x_Matrix RateModel::dfGet(unsigned int i) const { if (i != 0) return Matrix();#ifdef USE_RATE_SYSTEM_MODEL const double qw = x_(QUATERNION_W); const double qx = x_(QUATERNION_X); const double qy = x_(QUATERNION_Y); const double qz = x_(QUATERNION_Z); // C_(1,QUATERNION_W) = 2.0*qw * x_(RATE_X) + 2.0*qz * x_(RATE_Y) - 2.0*qy * x_(RATE_Z); // C_(1,QUATERNION_X) = 2.0*qx * x_(RATE_X) + 2.0*qy * x_(RATE_Y) + 2.0*qz * x_(RATE_Z); // C_(1,QUATERNION_Y) = -2.0*qy * x_(RATE_X) + 2.0*qx * x_(RATE_Y) - 2.0*qw * x_(RATE_Z); // C_(1,QUATERNION_Z) = -2.0*qz * x_(RATE_X) + 2.0*qw * x_(RATE_Y) + 2.0*qx * x_(RATE_Z); // C_(2,QUATERNION_W) = -2.0*qz * x_(RATE_X) + 2.0*qw * x_(RATE_Y) + 2.0*qx * x_(RATE_Z); // C_(2,QUATERNION_X) = 2.0*qy * x_(RATE_X) - 2.0*qx * x_(RATE_Y) + 2.0*qw * x_(RATE_Z); // C_(2,QUATERNION_Y) = 2.0*qx * x_(RATE_X) + 2.0*qy * x_(RATE_Y) + 2.0*qz * x_(RATE_Z); // C_(2,QUATERNION_Z) = -2.0*qw * x_(RATE_X) - 2.0*qz * x_(RATE_Y) + 2.0*qy * x_(RATE_Z); // C_(3,QUATERNION_W) = 2.0*qy * x_(RATE_X) - 2.0*qx * x_(RATE_Y) + 2.0*qw * x_(RATE_Z); // C_(3,QUATERNION_X) = 2.0*qz * x_(RATE_X) - 2.0*qw * x_(RATE_Y) - 2.0*qx * x_(RATE_Z); // C_(3,QUATERNION_Y) = 2.0*qw * x_(RATE_X) + 2.0*qz * x_(RATE_Y) - 2.0*qy * x_(RATE_Z); // C_(3,QUATERNION_Z) = 2.0*qx * x_(RATE_X) + 2.0*qy * x_(RATE_Y) + 2.0*qz * x_(RATE_Z); C_(1,RATE_X) = (qw*qw+qx*qx-qy*qy-qz*qz); C_(1,RATE_Y) = (2.0*qx*qy+2.0*qw*qz); C_(1,RATE_Z) = (2.0*qx*qz-2.0*qw*qy); C_(2,RATE_X) = (2.0*qx*qy-2.0*qw*qz); C_(2,RATE_Y) = (qw*qw-qx*qx+qy*qy-qz*qz); C_(2,RATE_Z) = (2.0*qy*qz+2.0*qw*qx); C_(3,RATE_X) = (2.0*qx*qz+2.0*qw*qy); C_(3,RATE_Y) = (2.0*qy*qz-2.0*qw*qx); C_(3,RATE_Z) = (qw*qw-qx*qx-qy*qy+qz*qz); C_(1,BIAS_GYRO_X) = 1.0; C_(2,BIAS_GYRO_Y) = 1.0; C_(3,BIAS_GYRO_Z) = 1.0;#endif // USE_RATE_SYSTEM_MODEL return C_;}
开发者ID:FalkorSystems,项目名称:hector_localization,代码行数:39,
注:本文中的C_函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ C_ADD函数代码示例 C++ CY_SET_XTND_REG8函数代码示例 |