Add clipboard functionality for find and go to line widgets

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@484 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2006-06-25 19:57:07 +00:00
parent 3606119da8
commit d4405d5856
3 changed files with 29 additions and 7 deletions

View File

@ -17,6 +17,8 @@
Add notebook_new_tab and update document_create_new_sci to use it;
also remove on_tab_close_clicked.
* src/notebook.c: Fix close tab button bug introduced in last commit.
* src/callbacks.c, src/utils.c:
Add clipboard functionality for find and go to line widgets.
2006-06-24 Enrico Troeger <enrico.troeger@uvena.de>

View File

@ -376,8 +376,12 @@ on_cut1_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
gint idx = document_get_cur_idx();
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(app->window));
if (idx >= 0)
if (GTK_IS_EDITABLE(focusw))
gtk_editable_cut_clipboard(GTK_EDITABLE(focusw));
else
if (IS_SCINTILLA(focusw) && idx >= 0)
sci_cut(doc_list[idx].sci);
}
@ -387,8 +391,12 @@ on_copy1_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
gint idx = document_get_cur_idx();
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(app->window));
if (idx >= 0)
if (GTK_IS_EDITABLE(focusw))
gtk_editable_copy_clipboard(GTK_EDITABLE(focusw));
else
if (IS_SCINTILLA(focusw) && idx >= 0)
sci_copy(doc_list[idx].sci);
}
@ -398,8 +406,12 @@ on_paste1_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
gint idx = document_get_cur_idx();
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(app->window));
if (idx >= 0)
if (GTK_IS_EDITABLE(focusw))
gtk_editable_paste_clipboard(GTK_EDITABLE(focusw));
else
if (IS_SCINTILLA(focusw) && idx >= 0)
sci_paste(doc_list[idx].sci);
}
@ -409,8 +421,12 @@ on_delete1_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
gint idx = document_get_cur_idx();
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(app->window));
if (idx >= 0)
if (GTK_IS_EDITABLE(focusw))
gtk_editable_delete_selection(GTK_EDITABLE(focusw));
else
if (IS_SCINTILLA(focusw) && idx >= 0)
sci_clear(doc_list[idx].sci);
}

View File

@ -172,11 +172,15 @@ void utils_update_popup_copy_items(gint index)
void utils_update_menu_copy_items(gint idx)
{
gboolean enable;
gboolean enable = FALSE;
guint i;
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(app->window));
if (idx == -1) enable = FALSE;
else enable = sci_can_copy(doc_list[idx].sci);
if (IS_SCINTILLA(focusw))
enable = (idx == -1) ? FALSE : sci_can_copy(doc_list[idx].sci);
else
if (GTK_IS_EDITABLE(focusw))
enable = gtk_editable_get_selection_bounds(GTK_EDITABLE(focusw), NULL, NULL);
for(i = 0; i < (sizeof(app->menu_copy_items)/sizeof(GtkWidget*)); i++)
gtk_widget_set_sensitive(app->menu_copy_items[i], enable);