Ejemplo 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);
}
Ejemplo n.º 2
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]);
    }
}