• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GTK_SOURCE_BUFFER函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GTK_SOURCE_BUFFER函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_SOURCE_BUFFER函数的具体用法?C++ GTK_SOURCE_BUFFER怎么用?C++ GTK_SOURCE_BUFFER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GTK_SOURCE_BUFFER函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: pls_lang_active

static void pls_lang_active(GtkAction* action, GtkSourceLanguage* lang) {
	gint page_num;
	GtkTextBuffer* buf;

	page_num = gtk_notebook_get_current_page(puss_get_doc_panel(g_self->app));
	if( page_num < 0 )
		return;

	buf = g_self->app->doc_get_buffer_from_page_num(page_num);

#if GTK_MAJOR_VERSION==2
	if( !buf || !GTK_IS_SOURCE_BUFFER(buf) )
		return;
#else
	if( !buf || !GTK_SOURCE_IS_BUFFER(buf) )
		return;
#endif

	if( lang ) {
		gtk_source_buffer_set_language(GTK_SOURCE_BUFFER(buf), lang);
		add_fill_favory_language(lang);

	} else {
		gtk_source_buffer_set_language(GTK_SOURCE_BUFFER(buf), g_self->last_favory_lang);
	}
}
开发者ID:chan18,项目名称:ljedit,代码行数:26,代码来源:module.c


示例2: gb_vim_command_syntax

static gboolean
gb_vim_command_syntax (GtkWidget      *active_widget,
                       const gchar    *command,
                       const gchar    *options,
                       GError        **error)
{
  g_assert (GTK_IS_WIDGET (active_widget));

  if (IDE_IS_EDITOR_PAGE (active_widget))
    {
      IdeBuffer *buffer = ide_editor_page_get_buffer (IDE_EDITOR_PAGE (active_widget));

      if (g_str_equal (options, "enable") || g_str_equal (options, "on"))
        gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (buffer), TRUE);
      else if (g_str_equal (options, "off"))
        gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (buffer), FALSE);
      else
        {
          g_set_error (error,
                       GB_VIM_ERROR,
                       GB_VIM_ERROR_UNKNOWN_OPTION,
                       _("Invalid :syntax subcommand: %s"),
                       options);
          return FALSE;
        }

      return TRUE;
    }
  else
    return gb_vim_set_source_view_error (error);
}
开发者ID:GNOME,项目名称:gnome-builder,代码行数:31,代码来源:gb-vim.c


示例3: set_language

static void
set_language (GeditDocument     *doc,
              GtkSourceLanguage *lang,
              gboolean           set_by_user)
{
	GeditDocumentPrivate *priv;
	GtkSourceLanguage *old_lang;

	gedit_debug (DEBUG_DOCUMENT);

	priv = gedit_document_get_instance_private (doc);

	old_lang = gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (doc));

	if (old_lang == lang)
	{
		return;
	}

	gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (doc), lang);

	if (set_by_user)
	{
		const gchar *language = get_language_string (doc);

		gedit_document_set_metadata (doc,
					     GEDIT_METADATA_ATTRIBUTE_LANGUAGE, language,
					     NULL);
	}

	priv->language_set_by_user = set_by_user;
}
开发者ID:hacker97,项目名称:gedit,代码行数:32,代码来源:gedit-document.c


示例4: set_buffer

void set_buffer(){
	    gtk_source_buffer_begin_not_undoable_action(GTK_SOURCE_BUFFER(mBuff));
		gtk_text_buffer_set_text(GTK_TEXT_BUFFER(mBuff),content,-1);
	    g_free(content);
        gtk_source_buffer_end_not_undoable_action(GTK_SOURCE_BUFFER(mBuff));
        gtk_text_buffer_set_modified(GTK_TEXT_BUFFER(mBuff),FALSE);
        GtkTextIter iter;
        gtk_text_buffer_get_start_iter(GTK_TEXT_BUFFER(mBuff),&iter);
        gtk_text_buffer_place_cursor(GTK_TEXT_BUFFER(mBuff),&iter);
}
开发者ID:gnaservicesinc,项目名称:tpad,代码行数:10,代码来源:tpad_buff.c


示例5: new_file

void new_file(){
	//unsigned int u_id
	//GtkSourceBuffer  *tBuff=(GtkSourceBuffer *)tpad_buff_get_buff(u_id);
    if(save_modified()) {
        gtk_source_buffer_begin_not_undoable_action(GTK_SOURCE_BUFFER(mBuff));
        gtk_text_buffer_set_text(GTK_TEXT_BUFFER(mBuff),"",-1);
        gtk_source_buffer_end_not_undoable_action(GTK_SOURCE_BUFFER(mBuff));
        gtk_text_buffer_set_modified(GTK_TEXT_BUFFER(mBuff),FALSE);
        gtk_window_set_title(GTK_WINDOW(window),_FALLBACK_SAVE_FILE_NAME);
	save_locked=FALSE;
    }

}
开发者ID:gnaservicesinc,项目名称:tpad,代码行数:13,代码来源:tpad_new_file.c


示例6: peacock_file_load_async_close_cb

static void
peacock_file_load_async_close_cb (GnomeVFSAsyncHandle *handle,
				  GnomeVFSResult result,
				  gpointer user_data)
{
	gboolean success = TRUE;
	PeacockFile *file = PEACOCK_FILE (user_data);

#ifdef PEACOCK_FILE_DEBUG
	g_warning ("peacock_file_load_async_close_cb (): Closed GnomeVFS handle - %s\n", gnome_vfs_result_to_string (result));
#endif

	/*
	 * File read ok. Emit the PeacockFile::loaded signal.
	 * The handler should load it up in the MDI (besides other things it
	 * might want to do). Else destroy the PeacockFile object.
	 */
	if (result == GNOME_VFS_OK) {
		gtk_text_buffer_set_modified (GTK_TEXT_BUFFER (file), FALSE);
		gtk_source_buffer_end_not_undoable_action (GTK_SOURCE_BUFFER (file));
	} else {
		g_object_unref (file);
		success = FALSE;
	}

	g_signal_emit (G_OBJECT (file), peacock_file_signals[LOADED],
		       0, success);
}
开发者ID:archit,项目名称:peacock,代码行数:28,代码来源:peacock-file.c


示例7: peacock_file_load_async_open_cb

static void
peacock_file_load_async_open_cb (GnomeVFSAsyncHandle *handle,
				 GnomeVFSResult result,
				 gpointer data)
{
	PeacockFile *file = PEACOCK_FILE (data);

#ifdef PEACOCK_FILE_DEBUG
	g_warning ("peacock_file_load_async_open_cb(): Error opening file to read: %s.\n", gnome_vfs_result_to_string (result));
#endif

	if (result != GNOME_VFS_OK) {
		/*
		 * Display UI error dialog.
		 */
		gchar *err_msg = g_strdup_printf (_("Error opening file to load.\nReason - %s.\n"), gnome_vfs_result_to_string (result));

		peacock_file_util_show_ui_error (err_msg);
		g_free (err_msg);

		/*
		 * Cleanup. Destructor peacock_file_finalize handles
		 * PeacockFile related memory.
		 */
		g_object_unref (file);
		return;
	} else {
	        gchar *buffer = g_malloc (PEACOCK_FILE_READ_WRITE_BUF_SIZE);
		gtk_source_buffer_begin_not_undoable_action (GTK_SOURCE_BUFFER (file));
		gnome_vfs_async_read (handle, buffer,
				      PEACOCK_FILE_READ_WRITE_BUF_SIZE,
				      peacock_file_load_async_read_cb, data);
	}
}
开发者ID:archit,项目名称:peacock,代码行数:34,代码来源:peacock-file.c


示例8: ide_editor_view__extension_added

static void
ide_editor_view__extension_added (PeasExtensionSet *set,
                                  PeasPluginInfo   *info,
                                  PeasExtension    *exten,
                                  gpointer          user_data)
{
  IdeEditorView *self = user_data;
  IdeEditorViewAddin *addin = (IdeEditorViewAddin *)exten;

  g_assert (PEAS_IS_EXTENSION_SET (set));
  g_assert (info != NULL);
  g_assert (IDE_IS_EDITOR_VIEW_ADDIN (addin));
  g_assert (IDE_IS_EDITOR_VIEW (self));

  ide_editor_view_addin_load (addin, self);

  if (self->document != NULL)
    {
      GtkSourceLanguage *language;

      language = gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (self->document));

      if (language != NULL)
        {
          const gchar *language_id;

          language_id = gtk_source_language_get_id (language);
          ide_editor_view_addin_language_changed (addin, language_id);
        }
    }
}
开发者ID:chhavi1996,项目名称:gnome-builder,代码行数:31,代码来源:ide-editor-view.c


示例9: on_delete_range

static void
on_delete_range (GtkTextBuffer *buffer,
	     	 GtkTextIter   *start,
	     	 GtkTextIter   *end,
	     	 gpointer       user_data)
{
	GtkTextIter iter;
	GSList *marks;
	GSList *item;

	iter = *start;

	/* move to start of line */
	gtk_text_iter_set_line_offset (&iter, 0);

	/* remove any bookmarks that are collapsed on each other due to this */
	marks = gtk_source_buffer_get_source_marks_at_iter (GTK_SOURCE_BUFFER (buffer),
							    &iter,
							    BOOKMARK_CATEGORY);

	if (marks == NULL)
		return;

	/* remove all but the first mark */
	for (item = marks->next; item; item = item->next)
		gtk_text_buffer_delete_mark (buffer, GTK_TEXT_MARK (item->data));

	g_slist_free (marks);
}
开发者ID:danmcgoo,项目名称:pluma-plugins,代码行数:29,代码来源:pluma-bookmarks-plugin.c


示例10: gutter_renderer_query_tooltip

static gboolean
gutter_renderer_query_tooltip (GtkSourceGutterRenderer *renderer,
                               GtkTextIter             *iter,
                               GdkRectangle            *area,
                               gint                     x,
                               gint                     y,
                               GtkTooltip              *tooltip)
{
	GSList *marks;
	GtkSourceView *view;
	GtkSourceBuffer *buffer;

	view = GTK_SOURCE_VIEW (gtk_source_gutter_renderer_get_view (renderer));
	buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));

	marks = gtk_source_buffer_get_source_marks_at_iter (buffer,
	                                                    iter,
	                                                    NULL);

	if (marks != NULL)
	{
		marks = g_slist_sort_with_data (marks,
		                                sort_marks_by_priority,
		                                view);

		marks = g_slist_reverse (marks);

		return set_tooltip_widget_from_marks (view, tooltip, marks);
	}

	return FALSE;
}
开发者ID:Istarnion,项目名称:gtksourceview,代码行数:32,代码来源:gtksourcegutterrenderermarks.c


示例11: gb_editor_tab_apply_settings

static void
gb_editor_tab_apply_settings (GbEditorTab *tab)
{
   GbEditorTabPrivate *priv;
   GtkSourceLanguage *lang;
   const gchar *name;
   gchar *path;

   g_return_if_fail (GB_IS_EDITOR_TAB (tab));

   priv = tab->priv;

   g_clear_object (&priv->settings);

   lang = gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (priv->document));

   if (lang) {
      name = gtk_source_language_get_id (lang);
   } else {
      name = "plaintext";
   }

   path = g_strdup_printf ("/org/gnome/builder/preferences/editor/language/%s/", name);
   priv->settings = g_settings_new_with_path ("org.gnome.builder.preferences.editor.language", path);
   g_free (path);

   g_settings_bind (priv->settings, "highlight-matching-brackets", priv->document, "highlight-matching-brackets", G_SETTINGS_BIND_GET);
   g_settings_bind (priv->settings, "highlight-current-line", priv->text_view, "highlight-current-line", G_SETTINGS_BIND_GET);
   g_settings_bind (priv->settings, "insert-spaces-instead-of-tabs", priv->text_view, "insert-spaces-instead-of-tabs", G_SETTINGS_BIND_GET);
   g_settings_bind (priv->settings, "right-margin-position", priv->text_view, "right-margin-position", G_SETTINGS_BIND_GET);
   g_settings_bind (priv->settings, "show-line-marks", priv->text_view, "show-line-marks", G_SETTINGS_BIND_GET);
   g_settings_bind (priv->settings, "show-line-numbers", priv->text_view, "show-line-numbers", G_SETTINGS_BIND_GET);
   g_settings_bind (priv->settings, "show-right-margin", priv->text_view, "show-right-margin", G_SETTINGS_BIND_GET);
   g_settings_bind (priv->settings, "tab-width", priv->text_view, "tab-width", G_SETTINGS_BIND_GET);
}
开发者ID:aroman,项目名称:gnome-builder,代码行数:35,代码来源:gb-editor-tab.c


示例12: pluma_prefs_manager_undo_changed

static void
pluma_prefs_manager_undo_changed (GSettings *settings,
                                  gchar       *key,
                                  gpointer     user_data)
{
    pluma_debug (DEBUG_PREFS);

    if (strcmp (key, GPM_UNDO_ACTIONS_LIMIT) == 0)
    {
        gint ul;
        GList *docs;
        GList *l;

        ul = g_settings_get_int (settings, key);

        ul = CLAMP (ul, -1, 250);

        docs = pluma_app_get_documents (pluma_app_get_default ());
        l = docs;

        while (l != NULL)
        {
            gtk_source_buffer_set_max_undo_levels (GTK_SOURCE_BUFFER (l->data),
                                                   ul);

            l = l->next;
        }

        g_list_free (docs);
    }
}
开发者ID:mate-desktop,项目名称:pluma,代码行数:31,代码来源:pluma-prefs-manager-app.c


示例13: pluma_prefs_manager_bracket_matching_changed

static void
pluma_prefs_manager_bracket_matching_changed (GSettings *settings,
        gchar       *key,
        gpointer     user_data)
{
    pluma_debug (DEBUG_PREFS);

    if (strcmp (key, GPM_BRACKET_MATCHING) == 0)
    {
        gboolean enable;
        GList *docs;
        GList *l;

        enable = g_settings_get_boolean (settings, key);

        docs = pluma_app_get_documents (pluma_app_get_default ());
        l = docs;

        while (l != NULL)
        {
            gtk_source_buffer_set_highlight_matching_brackets (GTK_SOURCE_BUFFER (l->data),
                    enable);

            l = l->next;
        }

        g_list_free (docs);
    }
}
开发者ID:mate-desktop,项目名称:pluma,代码行数:29,代码来源:pluma-prefs-manager-app.c


示例14: on_toggle_bookmark_activate

static void
on_toggle_bookmark_activate (GtkAction   *action,
			     PlumaWindow *window)
{
	GtkSourceBuffer *buffer = GTK_SOURCE_BUFFER (pluma_window_get_active_document (window));
	toggle_bookmark (buffer, NULL);
}
开发者ID:danmcgoo,项目名称:pluma-plugins,代码行数:7,代码来源:pluma-bookmarks-plugin.c


示例15: gedit_document_get_language

/**
 * gedit_document_get_language:
 * @doc:
 *
 * Return value: (transfer none):
 */
GtkSourceLanguage *
gedit_document_get_language (GeditDocument *doc)
{
	g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), NULL);

	return gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (doc));
}
开发者ID:hacker97,项目名称:gedit,代码行数:13,代码来源:gedit-document.c


示例16: gutter_renderer_query_data

static void
gutter_renderer_query_data (GtkSourceGutterRenderer      *renderer,
			    GtkTextIter                  *start,
			    GtkTextIter                  *end,
			    GtkSourceGutterRendererState  state)
{
	GSList *marks;
	GdkPixbuf *pixbuf = NULL;
	gint size = 0;
	GtkSourceView *view;
	GtkSourceBuffer *buffer;

	view = GTK_SOURCE_VIEW (gtk_source_gutter_renderer_get_view (renderer));
	buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));

	marks = gtk_source_buffer_get_source_marks_at_iter (buffer,
	                                                    start,
	                                                    NULL);

	if (marks != NULL)
	{
		size = measure_line_height (view);
		pixbuf = composite_marks (view, marks, size);

		g_slist_free (marks);
	}

	g_object_set (G_OBJECT (renderer),
	              "pixbuf", pixbuf,
	              "xpad", 2,
	              "yalign", 0.5,
	              "xalign", 0.5,
	              "alignment-mode", GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_FIRST,
	              NULL);
}
开发者ID:Istarnion,项目名称:gtksourceview,代码行数:35,代码来源:gtksourcegutterrenderermarks.c


示例17: disable_bookmarks

static void
disable_bookmarks (PlumaView *view)
{
	GtkTextIter start;
	GtkTextIter end;
	GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
	gpointer data;

	gtk_source_view_set_show_line_marks (GTK_SOURCE_VIEW (view), FALSE);

	gtk_text_buffer_get_bounds (buffer, &start, &end);
	gtk_source_buffer_remove_source_marks (GTK_SOURCE_BUFFER (buffer),
					       &start,
					       &end,
					       BOOKMARK_CATEGORY);

	g_signal_handlers_disconnect_by_func (buffer, on_style_scheme_notify, view);
	g_signal_handlers_disconnect_by_func (buffer, on_delete_range, NULL);

	data = g_object_get_data (G_OBJECT (buffer), INSERT_DATA_KEY);

	g_signal_handlers_disconnect_by_func (buffer, on_insert_text_before, data);
	g_signal_handlers_disconnect_by_func (buffer, on_begin_user_action, data);
	g_signal_handlers_disconnect_by_func (buffer, on_end_user_action, data);

	g_object_set_data (G_OBJECT (buffer), INSERT_DATA_KEY, NULL);
}
开发者ID:danmcgoo,项目名称:pluma-plugins,代码行数:27,代码来源:pluma-bookmarks-plugin.c


示例18: looks_like_makefile

static gboolean
looks_like_makefile (IdeBuffer *buffer)
{
  GtkSourceLanguage *language;
  const gchar *path;
  IdeFile *file;

  g_assert (IDE_IS_BUFFER (buffer));

  file = ide_buffer_get_file (buffer);
  path = ide_file_get_path (file);

  if (path != NULL)
    {
      if (g_str_has_suffix (path, "Makefile.am") || g_str_has_suffix (path, ".mk"))
        return TRUE;
    }

  language = gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (buffer));

  if (language != NULL)
    {
      const gchar *lang_id;

      lang_id = gtk_source_language_get_id (language);

      if (ide_str_equal0 (lang_id, "automake") || ide_str_equal0 (lang_id, "makefile"))
        return TRUE;
    }

  return FALSE;
}
开发者ID:badwolfie,项目名称:gnome-builder,代码行数:32,代码来源:ide-autotools-build-system.c


示例19: mape_edit_view_apply_preferences

void mape_edit_view_apply_preferences(MapeEditView* edit_view,
                                      MapePreferences* preferences)
{
	GtkSourceView* view;
	GtkSourceBuffer* buffer;
	GtkWrapMode wrap_mode;
	
	view = GTK_SOURCE_VIEW(edit_view->view);
	buffer = GTK_SOURCE_BUFFER(
		gtk_text_view_get_buffer(GTK_TEXT_VIEW(view))
	);

	gtk_source_view_set_tab_width(
		view,
		preferences->tab_width
	);

	gtk_source_view_set_insert_spaces_instead_of_tabs(
		view,
		preferences->tab_to_spaces
	);

	gtk_source_view_set_auto_indent(
		view,
		preferences->auto_indentation
	);

	wrap_mode = GTK_WRAP_CHAR;
	if(preferences->text_wrapping == FALSE)
		wrap_mode = GTK_WRAP_NONE;
	gtk_text_view_set_wrap_mode(
		GTK_TEXT_VIEW(view),
		wrap_mode
	);
	
	gtk_source_view_set_show_line_numbers(
		view,
		preferences->line_numbers
	);

	gtk_source_view_set_highlight_current_line(
		view,
		preferences->highlight_line
	);
	
	gtk_source_buffer_set_highlight_matching_brackets(
		buffer,
		preferences->bracket_matching
	);

	edit_view->fixed_seed = preferences->fixed_seed;
	edit_view->random_seed = preferences->random_seed;
	edit_view->map_width = preferences->map_width;
	edit_view->map_height = preferences->map_height;
	edit_view->map_zoom = preferences->map_zoom;

	/* Rerender with new random settings */
	mape_edit_view_reload(edit_view);
}
开发者ID:Fulgen301,项目名称:openclonk,代码行数:59,代码来源:editview.c


示例20: mape_edit_view_redo

void mape_edit_view_redo(MapeEditView* edit_view)
{
	gtk_source_buffer_redo(
		GTK_SOURCE_BUFFER(
			gtk_text_view_get_buffer(GTK_TEXT_VIEW(edit_view->view))
		)
	);
}
开发者ID:Fulgen301,项目名称:openclonk,代码行数:8,代码来源:editview.c



注:本文中的GTK_SOURCE_BUFFER函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GTK_SOURCE_VIEW函数代码示例发布时间:2022-05-30
下一篇:
C++ GTK_SOCKET函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap