Add preference to change tabs on scroll

Also revert e52905f50c
This commit is contained in:
TingPing 2013-10-08 18:16:10 -04:00
parent e52905f50c
commit 0c3220c469
8 changed files with 29 additions and 22 deletions

View File

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

View File

@ -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;

View File

@ -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;
}

View File

@ -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

View File

@ -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"

View File

@ -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" />

View File

@ -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">

View File

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