From 0c3220c4697598badbf222b7b6209326ec863942 Mon Sep 17 00:00:00 2001 From: TingPing Date: Tue, 8 Oct 2013 18:16:10 -0400 Subject: Add preference to change tabs on scroll Also revert e52905f50c7ff5d123a58ba016dcbb9de2b13f4f --- src/common/cfgfiles.c | 1 + src/common/hexchat.h | 1 + src/fe-gtk/chanview-tabs.c | 20 +++++++++++++++----- src/fe-gtk/chanview-tree.c | 16 +++++++--------- src/fe-gtk/chanview.c | 4 ++++ src/fe-gtk/fe-gtk.vcxproj | 2 -- src/fe-gtk/fe-gtk.vcxproj.filters | 6 ------ src/fe-gtk/setup.c | 1 + 8 files changed, 29 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index 63745869..f0784ff5 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -451,6 +451,7 @@ const struct prefs vars[] = {"gui_tab_layout", P_OFFINT (hex_gui_tab_layout), TYPE_INT}, {"gui_tab_newtofront", P_OFFINT (hex_gui_tab_newtofront), TYPE_INT}, {"gui_tab_pos", P_OFFINT (hex_gui_tab_pos), TYPE_INT}, + {"gui_tab_scrollchans", P_OFFINT (hex_gui_tab_scrollchans), TYPE_BOOL}, {"gui_tab_server", P_OFFINT (hex_gui_tab_server), TYPE_BOOL}, {"gui_tab_small", P_OFFINT (hex_gui_tab_small), TYPE_INT}, {"gui_tab_sort", P_OFFINT (hex_gui_tab_sort), TYPE_BOOL}, diff --git a/src/common/hexchat.h b/src/common/hexchat.h index e1e402c2..5825d217 100644 --- a/src/common/hexchat.h +++ b/src/common/hexchat.h @@ -166,6 +166,7 @@ struct hexchatprefs unsigned int hex_gui_tab_dialogs; unsigned int hex_gui_tab_dots; unsigned int hex_gui_tab_icons; + unsigned int hex_gui_tab_scrollchans; unsigned int hex_gui_tab_server; unsigned int hex_gui_tab_sort; unsigned int hex_gui_tab_utils; diff --git a/src/fe-gtk/chanview-tabs.c b/src/fe-gtk/chanview-tabs.c index e2e421da..dd1d16b7 100644 --- a/src/fe-gtk/chanview-tabs.c +++ b/src/fe-gtk/chanview-tabs.c @@ -233,11 +233,21 @@ tab_scroll_right_down_clicked (GtkWidget *widget, chanview *cv) static gboolean tab_scroll_cb (GtkWidget *widget, GdkEventScroll *event, gpointer cv) { - /* mouse wheel scrolling */ - if (event->direction == GDK_SCROLL_UP) - tab_scroll_left_up_clicked (widget, cv); - else if (event->direction == GDK_SCROLL_DOWN) - tab_scroll_right_down_clicked (widget, cv); + if (prefs.hex_gui_tab_scrollchans) + { + if (event->direction == GDK_SCROLL_DOWN) + mg_switch_page (1, 1); + else if (event->direction == GDK_SCROLL_UP) + mg_switch_page (1, -1); + } + else + { + /* mouse wheel scrolling */ + if (event->direction == GDK_SCROLL_UP) + tab_scroll_left_up_clicked (widget, cv); + else if (event->direction == GDK_SCROLL_DOWN) + tab_scroll_right_down_clicked (widget, cv); + } return FALSE; } diff --git a/src/fe-gtk/chanview-tree.c b/src/fe-gtk/chanview-tree.c index e1e53dcf..ca70214e 100644 --- a/src/fe-gtk/chanview-tree.c +++ b/src/fe-gtk/chanview-tree.c @@ -25,11 +25,6 @@ typedef struct GtkWidget *scrollw; /* scrolledWindow */ } treeview; -#include "../common/hexchat.h" -#include "../common/hexchatc.h" -#include "fe-gtk.h" -#include "maingui.h" - #include static void /* row-activated, when a row is double clicked */ @@ -91,10 +86,13 @@ cv_tree_click_cb (GtkTreeView *tree, GdkEventButton *event, chanview *cv) static void cv_tree_scroll_event_cb (GtkWidget *widget, GdkEventScroll *event) { - if (event->direction == GDK_SCROLL_DOWN) - mg_switch_page (1, 1); - else if (event->direction == GDK_SCROLL_UP) - mg_switch_page (1, -1); + if (prefs.hex_gui_tab_scrollchans) + { + if (event->direction == GDK_SCROLL_DOWN) + mg_switch_page (1, 1); + else if (event->direction == GDK_SCROLL_UP) + mg_switch_page (1, -1); + } } static void diff --git a/src/fe-gtk/chanview.c b/src/fe-gtk/chanview.c index 500ed1e5..4c50d922 100644 --- a/src/fe-gtk/chanview.c +++ b/src/fe-gtk/chanview.c @@ -22,6 +22,10 @@ #include #include +#include "../common/hexchat.h" +#include "../common/hexchatc.h" +#include "fe-gtk.h" +#include "maingui.h" #include "gtkutil.h" #include "chanview.h" diff --git a/src/fe-gtk/fe-gtk.vcxproj b/src/fe-gtk/fe-gtk.vcxproj index 1143dac7..73526766 100644 --- a/src/fe-gtk/fe-gtk.vcxproj +++ b/src/fe-gtk/fe-gtk.vcxproj @@ -134,8 +134,6 @@ - - diff --git a/src/fe-gtk/fe-gtk.vcxproj.filters b/src/fe-gtk/fe-gtk.vcxproj.filters index e70cde9f..eb6e2281 100644 --- a/src/fe-gtk/fe-gtk.vcxproj.filters +++ b/src/fe-gtk/fe-gtk.vcxproj.filters @@ -188,12 +188,6 @@ Source Files - - Source Files - - - Source Files - diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index 72c3bb35..7c45971f 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -318,6 +318,7 @@ static const setting tabs_settings[] = {ST_TOGGLE, N_("Sort tabs in alphabetical order"), P_OFFINTNL(hex_gui_tab_sort), 0, 0, 0}, {ST_TOGGLE, N_("Show icons in the channel tree"), P_OFFINTNL(hex_gui_tab_icons), 0, 0, 0}, {ST_TOGGLE, N_("Show dotted lines in the channel tree"), P_OFFINTNL(hex_gui_tab_dots), 0, 0, 0}, + {ST_TOGGLE, N_("Scroll mouse-wheel to change tabs"), P_OFFINTNL (hex_gui_tab_scrollchans), 0, 0, 0}, {ST_TOGGLE, N_("Smaller text"), P_OFFINTNL(hex_gui_tab_small), 0, 0, 0}, {ST_MENU, N_("Focus new tabs:"), P_OFFINTNL(hex_gui_tab_newtofront), 0, focusnewtabsmenu, 0}, {ST_MENU, N_("Placement of notices:"), P_OFFINTNL(hex_irc_notice_pos), 0, noticeposmenu, 0}, -- cgit 1.4.1