Esempio n. 1
0
void
ide_highlighter_load (IdeHighlighter *self)
{
  g_return_if_fail (IDE_IS_HIGHLIGHTER (self));

  if (IDE_HIGHLIGHTER_GET_IFACE (self)->load)
    IDE_HIGHLIGHTER_GET_IFACE (self)->load (self);
}
static void
ide_xml_highlighter_set_buffer (IdeXmlHighlighter *highlighter,
                                IdeBuffer         *buffer)
{
  IdeXmlHighlighter *self = (IdeXmlHighlighter *)highlighter;

  g_assert (IDE_IS_HIGHLIGHTER (self));
  g_assert (!buffer || IDE_IS_BUFFER (buffer));

  egg_signal_group_set_target (self->signal_group, buffer);
}
Esempio n. 3
0
/**
 * ide_highlighter_update:
 * @self: A #IdeHighlighter.
 * @callback: (scope call): A callback to apply a given style.
 * @range_begin: The beginning of the range to update.
 * @range_end: The end of the range to update.
 * @location: (out): How far the highlighter got in the update.
 *
 * Incrementally processes more of the buffer for highlighting.  If @callback
 * returns %IDE_HIGHLIGHT_STOP, then this vfunc should stop processing and
 * return, having set @location to the current position of processing.
 *
 * If processing the entire range was successful, then @location should be set
 * to @range_end.
 */
void
ide_highlighter_update (IdeHighlighter       *self,
                        IdeHighlightCallback  callback,
                        const GtkTextIter    *range_begin,
                        const GtkTextIter    *range_end,
                        GtkTextIter          *location)
{
  g_return_if_fail (IDE_IS_HIGHLIGHTER (self));
  g_return_if_fail (range_begin);
  g_return_if_fail (range_end);

  if (IDE_HIGHLIGHTER_GET_CLASS (self)->update)
    IDE_HIGHLIGHTER_GET_CLASS (self)->update (self, callback, range_begin, range_end, location);
}
Esempio n. 4
0
/**
 * ide_highlighter_update:
 * @self: A #IdeHighlighter.
 * @callback: (scope call): A callback to apply a given style.
 * @range_begin: The beginning of the range to update.
 * @range_end: The end of the range to update.
 * @location: (out): How far the highlighter got in the update.
 *
 * Incrementally processes more of the buffer for highlighting.  If @callback
 * returns %IDE_HIGHLIGHT_STOP, then this vfunc should stop processing and
 * return, having set @location to the current position of processing.
 *
 * If processing the entire range was successful, then @location should be set
 * to @range_end.
 */
void
ide_highlighter_update (IdeHighlighter       *self,
                        IdeHighlightCallback  callback,
                        const GtkTextIter    *range_begin,
                        const GtkTextIter    *range_end,
                        GtkTextIter          *location)
{
  g_return_if_fail (IDE_IS_HIGHLIGHTER (self));
  g_return_if_fail (callback != NULL);
  g_return_if_fail (range_begin != NULL);
  g_return_if_fail (range_end != NULL);
  g_return_if_fail (location != NULL);

  IDE_HIGHLIGHTER_GET_IFACE (self)->update (self, callback, range_begin, range_end, location);
}
static void
ide_highlight_engine_set_highlighter (IdeHighlightEngine *self,
                                      IdeHighlighter     *highlighter)
{
    g_return_if_fail (IDE_IS_HIGHLIGHT_ENGINE (self));
    g_return_if_fail (!highlighter || IDE_IS_HIGHLIGHTER (highlighter));

    if (g_set_object (&self->highlighter, highlighter))
    {
        if (highlighter != NULL)
            IDE_HIGHLIGHTER_GET_IFACE (highlighter)->set_engine (highlighter, self);
        ide_highlight_engine_reload (self);
        g_object_notify_by_pspec (G_OBJECT (self), gParamSpecs [PROP_HIGHLIGHTER]);
    }
}
static void
ide_xml_highlighter_cursor_moved_cb (GtkTextBuffer     *buffer,
                                     GtkTextIter       *iter,
                                     IdeXmlHighlighter *self)
{
  g_assert (IDE_IS_HIGHLIGHTER (self));
  g_assert (GTK_IS_TEXT_BUFFER (buffer) && self->buffer == buffer);

  if (self->highlight_timeout != 0)
    g_source_remove (self->highlight_timeout);

  gtk_text_buffer_move_mark (buffer, self->iter_mark, iter);
  self->highlight_timeout = g_timeout_add (HIGHLIGH_TIMEOUT_MSEC,
                                           ide_xml_highlighter_highlight_timeout_handler,
                                           self);
}