当前位置: 首页>>代码示例>>C++>>正文


C++ GTK_SOURCE_BUFFER函数代码示例

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


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


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