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


C++ GTK_TEXT_BUFFER函数代码示例

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


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

示例1: peacock_file_select_all

void
peacock_file_select_all (PeacockFile *file)
{
	GtkTextIter start;
	GtkTextIter end;

	g_return_if_fail (file != NULL);
	g_return_if_fail (PEACOCK_IS_FILE (file));

	/* Get start and end iters */
	gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (file), &start, &end);

	/* Select all the text. */
	peacock_file_set_selection (PEACOCK_FILE (file), &start, &end);
}
开发者ID:archit,项目名称:peacock,代码行数:15,代码来源:peacock-file.c

示例2: on_save_operation_finished

	void on_save_operation_finished(bool success)
	{
		GtkTextBuffer* buffer =
			GTK_TEXT_BUFFER(m_view.get_text_buffer());

		if(success)
			m_sync_time = m_save_op->get_start_time();

		m_save_op = NULL;

		// Schedule the next save operation in case the buffer has
		// been modified since the save operation was started.
		if(gtk_text_buffer_get_modified(buffer))
			schedule();
	}
开发者ID:FluffyStuff,项目名称:gobby,代码行数:15,代码来源:autosave-commands.cpp

示例3: remove_tag_to_word

static void
remove_tag_to_word (PlumaAutomaticSpellChecker *spell, const gchar *word)
{
	GtkTextIter iter;
	GtkTextIter match_start, match_end;

	gboolean found;

	gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (spell->doc), &iter, 0);
	
	found = TRUE;

	while (found)
	{
		found = gtk_text_iter_forward_search (&iter, 
				word, 
				GTK_TEXT_SEARCH_VISIBLE_ONLY | GTK_TEXT_SEARCH_TEXT_ONLY,
				&match_start, 
				&match_end,
				NULL);	

		if (found)
		{
			if (gtk_text_iter_starts_word (&match_start) &&
			    gtk_text_iter_ends_word (&match_end))
			{
				gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (spell->doc),
						spell->tag_highlight,
						&match_start, 
						&match_end);
			}

			iter = match_end;
		}
	}
}
开发者ID:mate-desktop,项目名称:pluma,代码行数:36,代码来源:pluma-automatic-spell-checker.c

示例4: g_return_if_fail

static void
text_open_callback	(GnomeVFSAsyncHandle *handle,
			GnomeVFSResult result,
			gpointer cdata)
{
	gchar *buffer;
	
	g_return_if_fail (GTK_IS_TEXT_BUFFER (cdata));
	
	if (result != GNOME_VFS_OK) {
		gchar *message;

		message = g_strdup_printf ("Error: %s", gnome_vfs_result_to_string (result));
		g_return_if_fail (message != NULL);
		gtk_text_buffer_set_text (GTK_TEXT_BUFFER(cdata), message, -1);
		g_free (message);
	}

	buffer = g_new (gchar, TEXT_BUFFER_SIZE);
	g_return_if_fail (buffer != NULL);

	gtk_text_buffer_create_tag (GTK_TEXT_BUFFER(cdata), "default-tag", "font", "terminal 10", NULL);
	gnome_vfs_async_read (handle, buffer, TEXT_BUFFER_SIZE, text_read_callback, cdata);
}
开发者ID:bajtos,项目名称:gnome-file-manager,代码行数:24,代码来源:lister.c

示例5: GTK_TEXT_BUFFER

void Gobby::StatusBar::on_document_removed(SessionView& view)
{
	if(m_current_view == &view)
	{
		GtkTextBuffer* buffer = GTK_TEXT_BUFFER(
			m_current_view->get_text_buffer());

		g_signal_handler_disconnect(buffer, m_mark_set_handler);
		g_signal_handler_disconnect(buffer, m_changed_handler);
		g_signal_handler_disconnect(m_current_view->get_text_view(),
		                            m_toverwrite_handler);

		m_current_view = NULL;
	}
}
开发者ID:Kaligule,项目名称:gobby,代码行数:15,代码来源:statusbar.cpp

示例6: gb_color_picker_document_monitor_set_color_tag_at_cursor

void
gb_color_picker_document_monitor_set_color_tag_at_cursor (GbColorPickerDocumentMonitor *self,
                                                          GstyleColor                  *color)
{
  GtkTextMark *insert;
  GtkTextIter cursor;

  g_return_if_fail (GB_IS_COLOR_PICKER_DOCUMENT_MONITOR (self));
  g_return_if_fail (GSTYLE_IS_COLOR (color));
  g_return_if_fail (self->buffer != NULL);

  insert = gtk_text_buffer_get_insert (GTK_TEXT_BUFFER(self->buffer));
  gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER(self->buffer), &cursor, insert);

  if (!self->is_in_user_action)
    {
      gtk_text_buffer_begin_user_action (GTK_TEXT_BUFFER (self->buffer));
      self->is_in_user_action = TRUE;
    }

  block_signals (self, self->buffer);
  gb_color_picker_helper_set_color_tag_at_iter (&cursor, color, TRUE);
  unblock_signals (self, self->buffer);
}
开发者ID:GNOME,项目名称:gnome-builder,代码行数:24,代码来源:gb-color-picker-document-monitor.c

示例7: ide_xml_highlighter_bind_buffer_cb

static void
ide_xml_highlighter_bind_buffer_cb (IdeXmlHighlighter  *self,
                                    IdeBuffer          *buffer,
                                    EggSignalGroup     *group)
{
  GtkTextIter begin;

  g_assert (IDE_IS_XML_HIGHLIGHTER (self));
  g_assert (IDE_IS_BUFFER (buffer));
  g_assert (EGG_IS_SIGNAL_GROUP (group));

  ide_set_weak_pointer (&self->buffer, GTK_TEXT_BUFFER (buffer));

  gtk_text_buffer_get_start_iter (self->buffer, &begin);
  self->iter_mark = gtk_text_buffer_create_mark (self->buffer, NULL, &begin, TRUE);
}
开发者ID:badwolfie,项目名称:gnome-builder,代码行数:16,代码来源:ide-xml-highlighter.c

示例8: on_menu_edit_activate

G_MODULE_EXPORT
void on_menu_edit_activate(GtkWidget *widget, void *user)
{
  if (g_active_editor == NULL)
    return;

  if (gtk_text_buffer_get_has_selection
      (GTK_TEXT_BUFFER(g_active_editor->buffer))) {
    gtk_widget_set_sensitive(GTK_WIDGET(gui->menugui->menu_cut), TRUE);
    gtk_widget_set_sensitive(GTK_WIDGET(gui->menugui->menu_copy), TRUE);
    return;
  }

  gtk_widget_set_sensitive(GTK_WIDGET(gui->menugui->menu_cut), FALSE);
  gtk_widget_set_sensitive(GTK_WIDGET(gui->menugui->menu_copy), FALSE);
}
开发者ID:aitjcize,项目名称:Gummi,代码行数:16,代码来源:gui-menu.c

示例9: text_buffer_undo_delete_text

static void
text_buffer_undo_delete_text (GObject *object,
                              gint position_start,
                              gint position_end)
{
	GtkTextBuffer *text_buffer;
	GtkTextIter start_iter, end_iter;

	g_return_if_fail (GTK_IS_TEXT_BUFFER (object));

	text_buffer = GTK_TEXT_BUFFER (object);

	gtk_text_buffer_get_iter_at_offset (text_buffer, &start_iter, position_start);
	gtk_text_buffer_get_iter_at_offset (text_buffer, &end_iter, position_end);
	gtk_text_buffer_delete (text_buffer, &start_iter, &end_iter);
}
开发者ID:UIKit0,项目名称:evolution,代码行数:16,代码来源:e-widget-undo.c

示例10: gimp_text_style_editor_color_changed

static void
gimp_text_style_editor_color_changed (GimpColorButton     *button,
                                      GimpTextStyleEditor *editor)
{
  GtkTextBuffer *buffer = GTK_TEXT_BUFFER (editor->buffer);
  GtkTextIter    start, end;
  GimpRGB        color;

  if (! gtk_text_buffer_get_selection_bounds (buffer, &start, &end))
    {
      return;
    }

  gimp_color_button_get_color (button, &color);
  gimp_text_buffer_set_color (editor->buffer, &start, &end, &color);
}
开发者ID:DevMaggio,项目名称:gimp,代码行数:16,代码来源:gimptextstyleeditor.c

示例11: gimp_text_style_editor_font_changed

static void
gimp_text_style_editor_font_changed (GimpContext         *context,
                                     GimpFont            *font,
                                     GimpTextStyleEditor *editor)
{
  GtkTextBuffer *buffer = GTK_TEXT_BUFFER (editor->buffer);
  GtkTextIter    start, end;

  if (! gtk_text_buffer_get_selection_bounds (buffer, &start, &end))
    {
      return;
    }

  gimp_text_buffer_set_font (editor->buffer, &start, &end,
                             gimp_context_get_font_name (context));
}
开发者ID:DevMaggio,项目名称:gimp,代码行数:16,代码来源:gimptextstyleeditor.c

示例12: widget_undo_place_cursor_at

static void
widget_undo_place_cursor_at (GObject *object,
                             gint char_pos)
{
	if (GTK_IS_EDITABLE (object))
		gtk_editable_set_position (GTK_EDITABLE (object), char_pos);
	else if (GTK_IS_TEXT_BUFFER (object)) {
		GtkTextBuffer *buffer;
		GtkTextIter pos;

		buffer = GTK_TEXT_BUFFER (object);

		gtk_text_buffer_get_iter_at_offset (buffer, &pos, char_pos);
		gtk_text_buffer_place_cursor (buffer, &pos);
	}
}
开发者ID:UIKit0,项目名称:evolution,代码行数:16,代码来源:e-widget-undo.c

示例13: g_assert

bool Gobby::FindDialog::replace_all()
{
	// TODO: Add helper function to get textsessionview? Maybe even add
	// to Folder?
	SessionView* view = m_folder->get_current_document();
	TextSessionView* text_view = dynamic_cast<TextSessionView*>(view);
	g_assert(text_view != NULL);

	GtkTextIter begin;
	GtkTextBuffer* buffer = GTK_TEXT_BUFFER(text_view->get_text_buffer());
	gtk_text_buffer_get_start_iter(buffer, &begin);

	unsigned int replace_count = 0;
	GtkTextIter match_start, match_end;
	while(find_range(&begin, NULL, SEARCH_FORWARD,
	                 &match_start, &match_end))
	{
		Glib::ustring replace_text = get_replace_text();
		gtk_text_buffer_delete(buffer, &match_start, &match_end);
		gtk_text_buffer_insert(buffer, &match_start,
		                       replace_text.c_str(),
		                       replace_text.bytes());

		++ replace_count;
		begin = match_start;
	}

	Glib::ustring message;
	bool result;

	if(replace_count == 0)
	{
		message = _("No occurrence has been replaced");
		result = false;
	}
	else
	{
		message = Glib::ustring::compose(
			ngettext("%1 occurrence has been replaced",
			         "%1 occurrences have been replaced",
			         replace_count), replace_count);
		result = true;
	}

	m_status_bar->add_info_message(message, 5);
	return result;
}
开发者ID:Kaligule,项目名称:gobby,代码行数:47,代码来源:find-dialog.cpp

示例14: gimp_text_tool_editor_button_press

void
gimp_text_tool_editor_button_press (GimpTextTool        *text_tool,
                                    gdouble              x,
                                    gdouble              y,
                                    GimpButtonPressType  press_type)
{
  GtkTextBuffer *buffer = GTK_TEXT_BUFFER (text_tool->buffer);
  GtkTextIter    cursor;
  GtkTextIter    selection;

  gimp_text_tool_xy_to_iter (text_tool, x, y, &cursor);

  selection = cursor;

  text_tool->select_start_iter = cursor;
  text_tool->select_words      = FALSE;
  text_tool->select_lines      = FALSE;

  switch (press_type)
    {
    case GIMP_BUTTON_PRESS_NORMAL:
      gtk_text_buffer_place_cursor (buffer, &cursor);
      break;

    case GIMP_BUTTON_PRESS_DOUBLE:
      text_tool->select_words = TRUE;

      if (! gtk_text_iter_starts_word (&cursor))
        gtk_text_iter_backward_visible_word_starts (&cursor, 1);

      if (! gtk_text_iter_ends_word (&selection) &&
          ! gtk_text_iter_forward_visible_word_ends (&selection, 1))
        gtk_text_iter_forward_to_line_end (&selection);

      gtk_text_buffer_select_range (buffer, &cursor, &selection);
      break;

    case GIMP_BUTTON_PRESS_TRIPLE:
      text_tool->select_lines = TRUE;

      gtk_text_iter_set_line_offset (&cursor, 0);
      gtk_text_iter_forward_to_line_end (&selection);

      gtk_text_buffer_select_range (buffer, &cursor, &selection);
      break;
    }
}
开发者ID:DevMaggio,项目名称:gimp,代码行数:47,代码来源:gimptexttool-editor.c

示例15: mk_page_main

static GtkWidget* mk_page_main (t_tea_project *p)
{
    GtkWidget *page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);

    gtk_widget_show (page);
    ent_project_name = tea_text_entry (GTK_WIDGET(page), _("Project name"), p->project_name);
    ent_dir_makefile = tea_dir_selector (page, _("Makefile directory"), p->dir_makefile);
    ent_dir_source = tea_dir_selector (page, _("Source directory"), p->dir_source);
    ent_file_executable = tea_text_entry (page, _("Target executable"), p->file_executable);

    gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), "\n\n", -1);
    gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), "\nfile_executable=", -1);
    gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), p->file_executable, -1);
    gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), "\nproject_name=", -1);
    gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), p->project_name, -1);
    gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), "\ndir_makefile=", -1);
    gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), p->dir_makefile, -1);
    gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), "\ndir_source=", -1);
    gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(buffer_projet), p->dir_source, -1);

    return page;
}
开发者ID:RobinWeng,项目名称:griffon-IDE,代码行数:22,代码来源:griffon_proj.c


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