Add msgwin_switch_tab(), msgwin_clear_tab() functions.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1899 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2007-09-24 16:07:44 +00:00
parent 5282ddbeb2
commit 6b3b7fe55a
4 changed files with 61 additions and 35 deletions

View File

@ -3,6 +3,8 @@
* src/keybindings.c, src/editor.c, src/editor.h:
Fix bug with 'Delete lines' when cursor is at the start of a
multi-line selection.
* src/keybindings.c, src/msgwindow.c, src/msgwindow.h:
Add msgwin_switch_tab(), msgwin_clear_tab() functions.
2007-09-22 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>

View File

@ -42,10 +42,6 @@
#include "build.h"
#include "tools.h"
#include "navqueue.h"
// include vte.h on non-Win32 systems, else define fake vte_init
#ifdef HAVE_VTE
# include "vte.h"
#endif
const gboolean swap_alt_tab_order = FALSE;
@ -970,9 +966,7 @@ static void cb_func_switch_editor(G_GNUC_UNUSED guint key_id)
static void cb_func_switch_scribble(G_GNUC_UNUSED guint key_id)
{
gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_SCRATCH);
msgwin_show_hide(TRUE);
gtk_widget_grab_focus(lookup_widget(app->window, "textview_scribble"));
msgwin_switch_tab(MSG_SCRATCH, TRUE);
}
static void cb_func_switch_search_bar(G_GNUC_UNUSED guint key_id)
@ -983,15 +977,7 @@ static void cb_func_switch_search_bar(G_GNUC_UNUSED guint key_id)
static void cb_func_switch_vte(G_GNUC_UNUSED guint key_id)
{
#ifdef HAVE_VTE
if (!vte_info.have_vte)
return;
msgwin_show_hide(TRUE);
/* the msgwin must be visible before we switch to the VTE page so that
* the font settings are applied on realization */
gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_VTE);
gtk_widget_grab_focus(vc->vte);
#endif
msgwin_switch_tab(MSG_VTE, TRUE);
}
static void cb_func_switch_tableft(G_GNUC_UNUSED guint key_id)

View File

@ -40,6 +40,7 @@
#include "filetypes.h"
#include "build.h"
#include "main.h"
#include "vte.h"
#include <string.h>
#include <stdlib.h>
@ -335,24 +336,9 @@ static void
on_message_treeview_clear_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
GtkListStore *store;
gint tabnum = GPOINTER_TO_INT(user_data);
switch (GPOINTER_TO_INT(user_data))
{
case MSG_MESSAGE:
gtk_widget_set_sensitive(lookup_widget(app->window, "next_message1"), FALSE);
store = msgwindow.store_msg;
break;
case MSG_COMPILER:
gtk_widget_set_sensitive(build_get_menu_items(-1)->item_next_error, FALSE);
store = msgwindow.store_compiler;
break;
default: // MSG_STATUS
store = msgwindow.store_status;
}
gtk_list_store_clear(store);
msgwin_clear_tab(tabnum);
}
@ -885,3 +871,51 @@ static gboolean on_msgwin_button_press_event(GtkWidget *widget, GdkEventButton *
}
void msgwin_switch_tab(MessageWindowTabNum tabnum, gboolean show)
{
GtkWidget *widget = NULL; // widget to focus
switch (tabnum)
{
case MSG_SCRATCH: widget = lookup_widget(app->window, "textview_scribble"); break;
#ifdef HAVE_VTE
case MSG_VTE: widget = (vte_info.have_vte) ? vc->vte : NULL; break;
#endif
default: break;
}
/* the msgwin must be visible before we switch to the VTE page so that
* the font settings are applied on realization */
if (show)
msgwin_show_hide(TRUE);
gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), tabnum);
if (show && widget)
gtk_widget_grab_focus(widget);
}
void msgwin_clear_tab(MessageWindowTabNum tabnum)
{
GtkListStore *store = NULL;
switch (tabnum)
{
case MSG_MESSAGE:
gtk_widget_set_sensitive(lookup_widget(app->window, "next_message1"), FALSE);
store = msgwindow.store_msg;
break;
case MSG_COMPILER:
gtk_widget_set_sensitive(build_get_menu_items(-1)->item_next_error, FALSE);
store = msgwindow.store_compiler;
break;
case MSG_STATUS: store = msgwindow.store_status; break;
default: return;
}
if (store == NULL)
return;
gtk_list_store_clear(store);
}

View File

@ -34,14 +34,14 @@ enum
COLOR_BLUE
};
enum
typedef enum
{
MSG_STATUS = 0, // force it to start at 0 to keep in sync with the notebook page numbers
MSG_COMPILER,
MSG_MESSAGE,
MSG_SCRATCH,
MSG_VTE,
};
} MessageWindowTabNum;
@ -69,6 +69,10 @@ void msgwin_finalize();
void msgwin_show_hide(gboolean show);
void msgwin_switch_tab(MessageWindowTabNum tabnum, gboolean show);
void msgwin_clear_tab(MessageWindowTabNum tabnum);
void msgwin_msg_add_fmt(gint msg_color, gint line, gint idx, const gchar *format, ...) G_GNUC_PRINTF (4, 5);