本文整理汇总了C++中GTK_TEXT_BUFFER函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_TEXT_BUFFER函数的具体用法?C++ GTK_TEXT_BUFFER怎么用?C++ GTK_TEXT_BUFFER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_TEXT_BUFFER函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: saved_query_info_cb
static void
saved_query_info_cb (GFile *location,
GAsyncResult *result,
GeditDocument *doc)
{
GeditDocumentPrivate *priv;
GFileInfo *info;
const gchar *content_type = NULL;
GError *error = NULL;
priv = gedit_document_get_instance_private (doc);
info = g_file_query_info_finish (location, result, &error);
if (error != NULL)
{
g_warning ("Document saving: query info error: %s", error->message);
g_error_free (error);
error = NULL;
}
if (info != NULL &&
g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE))
{
content_type = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE);
}
set_content_type (doc, content_type);
if (info != NULL)
{
/* content_type (owned by info) is no longer needed. */
g_object_unref (info);
}
g_get_current_time (&priv->time_of_last_save_or_load);
priv->create = FALSE;
gtk_text_buffer_set_modified (GTK_TEXT_BUFFER (doc), FALSE);
save_encoding_metadata (doc);
/* Async operation finished. */
g_object_unref (doc);
}
开发者ID:hacker97,项目名称:gedit,代码行数:46,代码来源:gedit-document.c
示例17: _gedit_document_needs_saving
/*
* Deletion and external modification is only checked for local files.
*/
gboolean
_gedit_document_needs_saving (GeditDocument *doc)
{
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
if (gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc)))
{
return TRUE;
}
if (gedit_document_is_local (doc))
{
check_file_on_disk (doc);
}
return (doc->priv->externally_modified || doc->priv->deleted) && !doc->priv->create;
}
开发者ID:alexandre-mbm,项目名称:gedit,代码行数:20,代码来源:gedit-document.c
示例18: create_tag_from_style
static GtkTextTag *
create_tag_from_style (IdeHighlightEngine *self,
const gchar *style_name)
{
GtkSourceStyleScheme *style_scheme;
GtkTextTag *tag;
g_assert (IDE_IS_HIGHLIGHT_ENGINE (self));
g_assert (IDE_IS_BUFFER (self->buffer));
g_assert (style_name != NULL);
tag = gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (self->buffer), style_name, NULL);
style_scheme = gtk_source_buffer_get_style_scheme (GTK_SOURCE_BUFFER (self->buffer));
sync_tag_style (style_scheme, tag);
return tag;
}
开发者ID:sramkrishna,项目名称:gnome-builder,代码行数:17,代码来源:ide-highlight-engine.c
示例19: Operation
Gobby::OperationSave::OperationSave(Operations& operations,
TextSessionView& view,
const Glib::RefPtr<Gio::File>& file,
const std::string& encoding,
DocumentInfoStorage::EolStyle eol_style):
Operation(operations), m_file(file), m_view(&view),
m_start_time(std::time(NULL)), m_current_line_index(0),
m_encoding(encoding), m_eol_style(eol_style),
m_storage_key(view.get_info_storage_key()),
m_iconv(encoding.c_str(), "UTF-8"),
m_buffer_size(0), m_buffer_index(0)
{
const Folder& folder = get_folder_manager().get_text_folder();
folder.signal_document_removed().connect(
sigc::mem_fun(*this, &OperationSave::on_document_removed));
// Load content so that the session can go on while saving
GtkTextBuffer* buffer = GTK_TEXT_BUFFER(view.get_text_buffer());
GtkTextIter prev;
GtkTextIter pos;
GtkTextIter old_pos;
gtk_text_buffer_get_start_iter(buffer, &prev);
pos = prev;
if(!gtk_text_iter_ends_line(&pos))
gtk_text_iter_forward_to_line_end(&pos);
do
{
Line line;
line.first =
gtk_text_buffer_get_text(buffer, &prev, &pos, TRUE);
line.second = gtk_text_iter_get_line_index(&pos);
m_lines.push_back(line);
//if(gtk_text_iter_is_end(&prev))
// break;
old_pos = pos;
gtk_text_iter_forward_line(&prev);
gtk_text_iter_forward_to_line_end(&pos);
} while(!gtk_text_iter_equal(&pos, &old_pos));
m_current_line = m_lines.begin();
}
开发者ID:Kaligule,项目名称:gobby,代码行数:46,代码来源:operation-save.cpp
示例20: buffer_to_pdf
void buffer_to_pdf (Ebook * ebook)
{
GtkTextBuffer * buffer;
GtkTextIter start, end;
Pqueue queue;
gchar * size, *editor_font;
/* A4 initial */
queue.ebook = ebook;
queue.pos = 0;
queue.page_count = 1;
queue.width = 8.3 * POINTS;
queue.height = 11.7 * POINTS;
queue.page_height = 40.0;
g_return_if_fail (ebook);
g_return_if_fail (ebook->filename);
size = gconf_client_get_string (ebook->client, ebook->paper_size.key, NULL);
buffer = GTK_TEXT_BUFFER(gtk_builder_get_object (ebook->builder, "textbuffer1"));
queue.progressbar = GTK_PROGRESS_BAR(gtk_builder_get_object (ebook->builder, "progressbar"));
queue.statusbar = GTK_STATUSBAR(gtk_builder_get_object (ebook->builder, "statusbar"));
gtk_text_buffer_get_bounds (buffer, &start, &end);
queue.text = g_strdup(gtk_text_buffer_get_text (buffer, &start, &end, TRUE));
editor_font = gconf_client_get_string(ebook->client, ebook->editor_font.key, NULL);
if (0 == g_strcmp0 (size, "A5"))
{
queue.width = a5_width * POINTS;
queue.height = a5_height * POINTS;
}
if (0 == g_strcmp0 (size, "B5"))
{
queue.width = b5_width * POINTS;
queue.height = b5_height * POINTS;
}
queue.surface = cairo_pdf_surface_create (ebook->filename, queue.width, queue.height);
queue.cr = cairo_create (queue.surface);
queue.context = pango_cairo_create_context (queue.cr);
/* pango_cairo_create_layout is wasteful with a lot of text. */
queue.desc = pango_font_description_from_string (editor_font);
queue.layout = make_new_page (queue.context, queue.desc, queue.height, queue.width);
pango_layout_set_text (queue.layout, queue.text, -1);
cairo_move_to (queue.cr, SIDE_MARGIN / 2, EDGE_MARGIN / 2);
gtk_progress_bar_set_fraction (queue.progressbar, 0.0);
queue.lines_per_page = pango_layout_get_line_count (queue.layout);
queue.iter = pango_layout_get_iter (queue.layout);
create_pages (&queue);
}
开发者ID:Debian,项目名称:gpdftext,代码行数:46,代码来源:pdf.c
注:本文中的GTK_TEXT_BUFFER函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论