summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2013-10-08 18:16:10 -0400
committerTingPing <tingping@tingping.se>2013-10-08 18:16:10 -0400
commit0c3220c4697598badbf222b7b6209326ec863942 (patch)
treeda98c52bf70596e83488a241d5d9b120dcd98869
parente52905f50c7ff5d123a58ba016dcbb9de2b13f4f (diff)
Add preference to change tabs on scroll
Also revert e52905f50c7ff5d123a58ba016dcbb9de2b13f4f
-rw-r--r--src/common/cfgfiles.c1
-rw-r--r--src/common/hexchat.h1
-rw-r--r--src/fe-gtk/chanview-tabs.c20
-rw-r--r--src/fe-gtk/chanview-tree.c16
-rw-r--r--src/fe-gtk/chanview.c4
-rw-r--r--src/fe-gtk/fe-gtk.vcxproj2
-rw-r--r--src/fe-gtk/fe-gtk.vcxproj.filters6
-rw-r--r--src/fe-gtk/setup.c1
8 files changed, 29 insertions, 22 deletions
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 <gdk/gdk.h>
 
 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 <stdlib.h>
 #include <string.h>
 
+#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 @@
     <ClCompile Include="ascii.c" />

     <ClCompile Include="banlist.c" />

     <ClCompile Include="chanlist.c" />

-    <ClCompile Include="chanview-tabs.c" />

-    <ClCompile Include="chanview-tree.c" />

     <ClCompile Include="chanview.c" />

     <ClCompile Include="custom-list.c" />

     <ClCompile Include="dccgui.c" />

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 @@
     <ClCompile Include="resources.c">

       <Filter>Source Files</Filter>

     </ClCompile>

-    <ClCompile Include="chanview-tabs.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="chanview-tree.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

   </ItemGroup>

   <ItemGroup>

     <Manifest Include="hexchat.exe.manifest">

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},