Removed mouse speed option.

Removed _setup_mouse_speed() function and dialog/options.cpp file.
All the code is in cmd_options.cpp now.
This commit is contained in:
David Capello 2010-04-25 15:52:19 -03:00
parent 5665b7dd1a
commit 3f6f1471fd
9 changed files with 52 additions and 209 deletions

View File

@ -5,21 +5,6 @@
<box vertical="true">
<box vertical="true">
<label text="Mouse Speed:" />
<box horizontal="true">
<box vertical="true" homogeneous="true">
<label text="X:" />
<label text="Y:" />
</box>
<box vertical="true" homogeneous="true" expansive="true">
<slider min="-8" max="8" name="mouse_x" />
<slider min="-8" max="8" name="mouse_y" />
</box>
</box>
<check text="Lock X/Y" name="lock_axis" />
<separator horizontal="true" />
<check text="Smooth auto-scroll" name="smooth" />
<check text="2 Click Movement" name="move_click2" />
<check text="2 Click Drawing" name="draw_click2" />

View File

@ -98,7 +98,6 @@ COMMON_SOURCES = \
src/dialogs/drawtext.cpp \
src/dialogs/filesel.cpp \
src/dialogs/maskcol.cpp \
src/dialogs/options.cpp \
src/dialogs/playfli.cpp \
src/dialogs/repo.cpp \
src/dialogs/vectmap.cpp \

View File

@ -44,7 +44,6 @@
#include "core/drop_files.h"
#include "core/file_system.h"
#include "core/modules.h"
#include "dialogs/options.h"
#include "file/file.h"
#include "intl/intl.h"
#include "modules/editors.h"
@ -268,7 +267,7 @@ int App::run()
// Run the GUI
else if (ase_mode & MODE_GUI) {
// Select language
dialogs_select_language(false);
intl_set_lang("en");
// support to drop files from Windows explorer
install_drop_files();

View File

@ -30,7 +30,6 @@
#include "core/dirs.h"
#include "gfxmode.h"
#include "intl/intl.h"
#include "dialogs/options.h"
#include "modules/gui.h"
#include "sprite_wrappers.h"
#include "modules/palettes.h"

View File

@ -18,10 +18,18 @@
#include "config.h"
#include "jinete/jbase.h"
#include <allegro.h>
#include "jinete/jinete.h"
#include "commands/command.h"
#include "dialogs/options.h"
#include "core/cfg.h"
#include "modules/editors.h"
#include "modules/gui.h"
static JWidget slider_x, slider_y, check_lockmouse;
static bool slider_mouse_hook(JWidget widget, void *data);
//////////////////////////////////////////////////////////////////////
// options
@ -45,7 +53,47 @@ OptionsCommand::OptionsCommand()
void OptionsCommand::execute(Context* context)
{
dialogs_options();
JWidget check_smooth;
JWidget button_ok;
JWidget move_click2, draw_click2, killer;
JWidget undo_size_limit;
/* load the window widget */
FramePtr window(load_widget("options.xml", "options"));
get_widgets(window,
"smooth", &check_smooth,
"move_click2", &move_click2,
"draw_click2", &draw_click2,
"undo_size_limit", &undo_size_limit,
"button_ok", &button_ok, NULL);
if (get_config_bool("Options", "MoveClick2", false))
jwidget_select(move_click2);
if (get_config_bool("Options", "DrawClick2", false))
jwidget_select(draw_click2);
if (get_config_bool("Options", "MoveSmooth", true))
jwidget_select(check_smooth);
undo_size_limit->setTextf("%d", get_config_int("Options", "UndoSizeLimit", 8));
window->open_window_fg();
killer = window->get_killer();
if (killer == button_ok) {
int undo_size_limit_value;
set_config_bool("Options", "MoveSmooth", jwidget_is_selected(check_smooth));
set_config_bool("Options", "MoveClick2", jwidget_is_selected(move_click2));
set_config_bool("Options", "DrawClick2", jwidget_is_selected(draw_click2));
undo_size_limit_value = undo_size_limit->getTextInt();
undo_size_limit_value = MID(1, undo_size_limit_value, 9999);
set_config_int("Options", "UndoSizeLimit", undo_size_limit_value);
/* save configuration */
flush_config_file();
}
}
//////////////////////////////////////////////////////////////////////

View File

@ -1,151 +0,0 @@
/* ASE - Allegro Sprite Editor
* Copyright (C) 2001-2010 David Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <allegro.h>
#include "jinete/jinete.h"
#include "core/cfg.h"
#include "dialogs/filesel.h"
#include "modules/editors.h"
#include "modules/gui.h"
#include "intl/intl.h"
void dialogs_select_language(bool force)
{
/* only english */
intl_set_lang("en");
set_config_bool("Options", "SelectLanguage", false);
}
/**********************************************************************/
/* Options */
static JWidget slider_x, slider_y, check_lockmouse;
static bool slider_mouse_hook(JWidget widget, void *data);
/* shows option dialog */
void dialogs_options()
{
JWidget check_smooth;
JWidget button_ok;
JWidget move_click2, draw_click2, killer;
JWidget undo_size_limit;
int x, y, old_x, old_y;
x = get_config_int("Options", "MouseX", 6);
y = get_config_int("Options", "MouseY", 6);
x = MID(-8, x, 8);
y = MID(-8, y, 8);
old_x = x;
old_y = y;
/* load the window widget */
FramePtr window(load_widget("options.xml", "options"));
get_widgets(window,
"mouse_x", &slider_x,
"mouse_y", &slider_y,
"lock_axis", &check_lockmouse,
"smooth", &check_smooth,
"move_click2", &move_click2,
"draw_click2", &draw_click2,
"undo_size_limit", &undo_size_limit,
"button_ok", &button_ok, NULL);
jslider_set_value(slider_x, x);
jslider_set_value(slider_y, y);
if (get_config_bool("Options", "LockMouse", true))
jwidget_select(check_lockmouse);
if (get_config_bool("Options", "MoveClick2", false))
jwidget_select(move_click2);
if (get_config_bool("Options", "DrawClick2", false))
jwidget_select(draw_click2);
if (get_config_bool("Options", "MoveSmooth", true))
jwidget_select(check_smooth);
undo_size_limit->setTextf("%d", get_config_int("Options", "UndoSizeLimit", 8));
HOOK(slider_x, JI_SIGNAL_SLIDER_CHANGE, slider_mouse_hook, NULL);
HOOK(slider_y, JI_SIGNAL_SLIDER_CHANGE, slider_mouse_hook, NULL);
window->open_window_fg();
killer = window->get_killer();
if (killer == button_ok) {
int undo_size_limit_value;
set_config_bool("Options", "LockMouse", jwidget_is_selected(check_lockmouse));
set_config_bool("Options", "MoveSmooth", jwidget_is_selected(check_smooth));
set_config_bool("Options", "MoveClick2", jwidget_is_selected(move_click2));
set_config_bool("Options", "DrawClick2", jwidget_is_selected(draw_click2));
undo_size_limit_value = undo_size_limit->getTextInt();
undo_size_limit_value = MID(1, undo_size_limit_value, 9999);
set_config_int("Options", "UndoSizeLimit", undo_size_limit_value);
/* save configuration */
flush_config_file();
}
else {
/* restore mouse speed */
set_config_int("Options", "MouseX", old_x);
set_config_int("Options", "MouseY", old_y);
set_mouse_speed(8-old_x, 8-old_y);
}
}
static bool slider_mouse_hook(JWidget widget, void *data)
{
int x, y;
if (jwidget_is_selected(check_lockmouse)) {
x = jslider_get_value(widget);
y = jslider_get_value(widget);
jslider_set_value(slider_x, x);
jslider_set_value(slider_y, y);
}
else {
x = jslider_get_value(slider_x);
y = jslider_get_value(slider_y);
}
set_mouse_speed(8-x, 8-y);
set_config_int("Options", "MouseX", x);
set_config_int("Options", "MouseY", y);
return false;
}
/**********************************************************************/
/* setup the mouse speed reading the configuration file */
void _setup_mouse_speed()
{
int x, y;
x = get_config_int("Options", "MouseX", 6);
y = get_config_int("Options", "MouseY", 6);
x = MID(-8, x, 8);
y = MID(-8, y, 8);
set_mouse_speed(8-x, 8-y);
}

View File

@ -1,28 +0,0 @@
/* ASE - Allegro Sprite Editor
* Copyright (C) 2001-2010 David Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef DIALOGS_OPTIONS_H_INCLUDED
#define DIALOGS_OPTIONS_H_INCLUDED
void dialogs_select_language(bool force);
void dialogs_options();
void _setup_mouse_speed();
#endif

View File

@ -26,7 +26,6 @@
#include "app.h"
#include "gfxmode.h"
#include "console.h"
#include "dialogs/options.h"
#include "modules/gui.h"
#include "modules/palettes.h"
#include "sprite_wrappers.h"
@ -75,9 +74,6 @@ bool GfxMode::setGfxMode() const
const CurrentSpriteReader sprite(UIContext::instance());
app_refresh_screen(sprite);
}
// Setup mouse
_setup_mouse_speed();
// Redraw top window
if (app_get_top_window()) {

View File

@ -42,7 +42,6 @@
#include "core/core.h"
#include "core/dirs.h"
#include "core/drop_files.h"
#include "dialogs/options.h"
#include "intl/msgids.h"
#include "gfxmode.h"
#include "modules/editors.h"
@ -333,9 +332,6 @@ int init_module_gui()
/* icon buttons */
icon_buttons = jlist_new();
/* setup mouse */
_setup_mouse_speed();
return 0;
}