as requested by Soliton,

use kotkey ctrl+l to toggle the mouse scrolling preference

renamed disable mouse scroll to prevent double-negative logic (disable(false))
This commit is contained in:
Patrick Parker 2006-06-08 01:14:52 +00:00
parent a985be021d
commit 0158294883
8 changed files with 42 additions and 6 deletions

View file

@ -249,6 +249,11 @@ default=yes
cmd=yes
[/hotkey]
[hotkey]
command=mousescroll
key=l
cmd=yes
[/hotkey]
[hotkey]
command=mute
key=m
cmd=yes
@ -434,6 +439,11 @@ default=yes
ctrl=yes
[/hotkey]
[hotkey]
command=mousescroll
key=l
ctrl=yes
[/hotkey]
[hotkey]
command=mute
key=m
ctrl=yes

View file

@ -60,6 +60,14 @@ name=editor
shift=no
[/hotkey]
[hotkey]
command="mousescroll"
key="l"
cmd=yes
alt=no
shift=no
[/hotkey]
[hotkey]
command="editsavemap"
key="s"
@ -269,6 +277,14 @@ name=editor
shift=no
[/hotkey]
[hotkey]
command="mousescroll"
key="l"
ctrl=yes
alt=no
shift=no
[/hotkey]
[hotkey]
command="editsavemap"
key="s"

View file

@ -728,6 +728,7 @@ bool map_editor::can_execute_command(hotkey::HOTKEY_COMMAND command) const {
case hotkey::HOTKEY_FULLSCREEN:
case hotkey::HOTKEY_SCREENSHOT:
case hotkey::HOTKEY_TOGGLE_GRID:
case hotkey::HOTKEY_MOUSE_SCROLL:
case hotkey::HOTKEY_PREFERENCES:
case hotkey::HOTKEY_EDIT_SAVE_MAP:
case hotkey::HOTKEY_EDIT_SAVE_AS:

View file

@ -68,6 +68,7 @@ const struct {
{ hotkey::HOTKEY_RECALL, "recall", N_("Recall"), false },
{ hotkey::HOTKEY_ENDTURN, "endturn", N_("End Turn"), false },
{ hotkey::HOTKEY_TOGGLE_GRID, "togglegrid", N_("Toggle Grid"), false },
{ hotkey::HOTKEY_MOUSE_SCROLL, "mousescroll", N_("Mouse Scrolling"), false },
{ hotkey::HOTKEY_STATUS_TABLE, "statustable", N_("Status Table"), false },
{ hotkey::HOTKEY_MUTE, "mute", N_("Mute"), false },
{ hotkey::HOTKEY_SPEAK, "speak", N_("Speak"), false },
@ -572,6 +573,9 @@ void execute_command(display& disp, HOTKEY_COMMAND command, command_executor* ex
if(executor)
executor->toggle_grid();
break;
case HOTKEY_MOUSE_SCROLL:
preferences::enable_mouse_scroll(!preferences::mouse_scroll_enabled());
break;
case HOTKEY_STATUS_TABLE:
if(executor)
executor->status_table();

View file

@ -35,7 +35,7 @@ enum HOTKEY_COMMAND {
HOTKEY_FULLSCREEN, HOTKEY_SCREENSHOT, HOTKEY_ACCELERATED,
HOTKEY_UNIT_DESCRIPTION, HOTKEY_RENAME_UNIT, HOTKEY_SAVE_GAME, HOTKEY_LOAD_GAME,
HOTKEY_RECRUIT, HOTKEY_REPEAT_RECRUIT, HOTKEY_RECALL, HOTKEY_ENDTURN,
HOTKEY_TOGGLE_GRID, HOTKEY_STATUS_TABLE, HOTKEY_MUTE,
HOTKEY_TOGGLE_GRID, HOTKEY_STATUS_TABLE, HOTKEY_MUTE, HOTKEY_MOUSE_SCROLL,
HOTKEY_SPEAK, HOTKEY_CREATE_UNIT, HOTKEY_CHANGE_UNIT_SIDE, HOTKEY_PREFERENCES,
HOTKEY_OBJECTIVES, HOTKEY_UNIT_LIST, HOTKEY_STATISTICS, HOTKEY_QUIT_GAME,
HOTKEY_LABEL_TERRAIN, HOTKEY_CLEAR_LABELS,HOTKEY_SHOW_ENEMY_MOVES, HOTKEY_BEST_ENEMY_MOVES,

View file

@ -437,6 +437,7 @@ bool play_controller::can_execute_command(hotkey::HOTKEY_COMMAND command) const
case hotkey::HOTKEY_SCREENSHOT:
case hotkey::HOTKEY_ACCELERATED:
case hotkey::HOTKEY_TOGGLE_GRID:
case hotkey::HOTKEY_MOUSE_SCROLL:
case hotkey::HOTKEY_STATUS_TABLE:
case hotkey::HOTKEY_MUTE:
case hotkey::HOTKEY_PREFERENCES:
@ -599,7 +600,7 @@ void play_controller::play_slice()
SDL_GetMouseState(&mousex,&mousey);
tooltips::process(mousex, mousey);
const int scroll_threshold = (preferences::mouse_scroll_disabled()) ? 0 : 5;
const int scroll_threshold = (preferences::mouse_scroll_enabled()) ? 5 : 0;
if(key[SDLK_UP] || mousey < scroll_threshold)
gui_->scroll(0,-preferences::scroll_speed());

View file

@ -762,12 +762,15 @@ bool show_floating_labels()
return prefs["floating_labels"] != "no";
}
bool mouse_scroll_disabled()
bool mouse_scroll_enabled()
{
//enabled by default
return prefs["mouse_scrolling"] == "no";
return prefs["mouse_scrolling"] != "no";
}
void enable_mouse_scroll(bool value)
{
prefs["mouse_scrolling"] = value ? "yes" : "no";
}
void set_show_floating_labels(bool value)
{

View file

@ -101,6 +101,8 @@ namespace preferences {
int scroll_speed();
void set_scroll_speed(int scroll);
bool mouse_scroll_enabled();
void enable_mouse_scroll(bool value);
bool turn_bell();
void set_turn_bell(bool ison);
@ -199,7 +201,6 @@ namespace preferences {
void set_chat_lines(int lines);
bool compress_saves();
bool mouse_scroll_disabled();
std::set<std::string> &encountered_units();
std::set<std::string> &encountered_terrains();