Beispiel #1
0
static gboolean on_query_tooltip(G_GNUC_UNUSED GtkWidget *widget, gint x, gint y,
	gboolean keyboard_mode, GtkTooltip *tooltip, GeanyEditor *editor)
{
	gint pos = keyboard_mode ? sci_get_current_position(editor->sci) :
		scintilla_send_message(editor->sci, SCI_POSITIONFROMPOINT, x, y);

	if (pos >= 0)
	{
		if (pos == last_pos)
		{
			gtk_tooltip_set_text(tooltip, output);
			return show;
		}
		else if (pos != peek_pos)
		{
			if (query_id)
				g_source_remove(query_id);
			else
				scid_gen++;

			peek_pos = pos;
			query_id = plugin_timeout_add(geany_plugin, pref_tooltips_send_delay * 10,
				tooltip_launch, editor);
		}
	}

	return FALSE;
}
Beispiel #2
0
static gboolean need_delay(void)
{
    static gint64 time_prev = 0; /* time in microseconds */
    gint64 time_now;
    GTimeVal t;
    const gint timeout = 500; /* delay in milliseconds */
    g_get_current_time(&t);

    time_now = ((gint64) t.tv_sec * G_USEC_PER_SEC) + t.tv_usec;

    /* delay keypresses for 0.5 seconds */
    if (time_now < (time_prev + (timeout * 1000)))
        return TRUE;

    if (check_line_data.check_while_typing_idle_source_id == 0)
    {
        check_line_data.check_while_typing_idle_source_id =
            plugin_timeout_add(geany_plugin, timeout, check_lines, NULL);
    }

    /* set current time for the next key press */
    time_prev = time_now;

    return FALSE;
}
Beispiel #3
0
void plugin_blink(void)
{
	if (pref_visual_beep_length)
	{
		if (blink_id)
			g_source_remove(blink_id);
		else
			gtk_widget_set_state(debug_statusbar, GTK_STATE_SELECTED);

		blink_id = plugin_timeout_add(geany_plugin, pref_visual_beep_length * 10,
			plugin_unblink, NULL);
	}
}
void plugin_init(GeanyData* data)
{
	completion_framework = geanycc::create_lang_completion_framework();

	plugin_timeout_add(geany_plugin, 20, loop_check_ready, NULL);
	suggestWindow = new geanycc::SuggestionWindow();
	completion_framework->set_suggestion_window(suggestWindow);
	completion_framework->load_preferences();

	init_keybindings();

	edit_tracker.valid = false;
}