Moved "Cursor Color" setting from "Tools Configuration" to "Options" dialog.

This commit is contained in:
David Capello 2010-04-25 23:35:05 -03:00
parent 1bc1cf2f5b
commit 8dd69cada9
4 changed files with 15 additions and 23 deletions

View File

@ -12,6 +12,10 @@
<check text="Smooth auto-scroll" name="smooth" />
<check text="2 Click Movement" name="move_click2" />
<check text="2 Click Drawing" name="draw_click2" />
<box horizontal="true">
<label text="Cursor:" />
<box name="cursor_color_box" /><!-- custom widget -->
</box>
<!-- Undo -->

View File

@ -15,8 +15,6 @@
<check text="Snap to Grid" name="snap_to_grid" />
<check text="View Grid" name="view_grid" />
<button text="Set &amp;Grid" name="set_grid" />
<separator text="Cursor:" horizontal="true" left="true" />
<box name="cursor_color_box" /><!-- custom widget -->
</box>
<separator vertical="true" />
<box vertical="true" expansive="true" childspacing="2">

View File

@ -58,7 +58,6 @@ static bool tiled_xy_check_change_hook(JWidget widget, void *data);
static bool snap_to_grid_check_change_hook(JWidget widget, void *data);
static bool view_grid_check_change_hook(JWidget widget, void *data);
static bool set_grid_button_select_hook(JWidget widget, void *data);
static bool cursor_button_change_hook(JWidget widget, void *data);
static bool onionskin_check_change_hook(JWidget widget, void *data);
// Slot for App::Exit signal
@ -141,7 +140,6 @@ void ConfigureTools::execute(Context* context)
JWidget tiled, tiled_x, tiled_y, snap_to_grid, view_grid, set_grid;
JWidget brush_size, brush_angle, opacity;
JWidget spray_width, air_speed;
JWidget cursor_color, cursor_color_box;
JWidget brush_preview_box;
JWidget brush_type_box, brush_type;
JWidget check_onionskin;
@ -171,7 +169,6 @@ void ConfigureTools::execute(Context* context)
"opacity", &opacity,
"spray_width", &spray_width,
"air_speed", &air_speed,
"cursor_color_box", &cursor_color_box,
"brush_preview_box", &brush_preview_box,
"brush_type_box", &brush_type_box,
"onionskin", &check_onionskin, NULL);
@ -182,15 +179,6 @@ void ConfigureTools::execute(Context* context)
throw;
}
/* cursor-color */
if (first_time) {
cursor_color = colorbutton_new(Editor::get_cursor_color(), IMAGE_INDEXED);
cursor_color->setName("cursor_color");
}
else {
cursor_color = jwidget_find_name(window, "cursor_color");
}
/* brush-preview */
if (first_time) {
brush_preview = new Widget(JI_WIDGET);
@ -237,7 +225,6 @@ void ConfigureTools::execute(Context* context)
if (first_time) {
// Append children
jwidget_add_child(cursor_color_box, cursor_color);
jwidget_add_child(brush_preview_box, brush_preview);
jwidget_add_child(brush_type_box, brush_type);
@ -255,7 +242,6 @@ void ConfigureTools::execute(Context* context)
HOOK(opacity, JI_SIGNAL_SLIDER_CHANGE, opacity_slider_change_hook, 0);
HOOK(air_speed, JI_SIGNAL_SLIDER_CHANGE, air_speed_slider_change_hook, 0);
HOOK(spray_width, JI_SIGNAL_SLIDER_CHANGE, spray_width_slider_change_hook, 0);
HOOK(cursor_color, SIGNAL_COLORBUTTON_CHANGE, cursor_button_change_hook, 0);
HOOK(check_onionskin, JI_SIGNAL_CHECK_CHANGE, onionskin_check_change_hook, 0);
App::instance()->Exit.connect(&on_exit_delete_this_widget);
@ -476,12 +462,6 @@ static bool set_grid_button_select_hook(JWidget widget, void *data)
return true;
}
static bool cursor_button_change_hook(JWidget widget, void *data)
{
Editor::set_cursor_color(colorbutton_get_color(widget));
return true;
}
static bool onionskin_check_change_hook(JWidget widget, void *data)
{
UIContext::instance()->getSettings()->setUseOnionskin(jwidget_is_selected(widget));

View File

@ -30,6 +30,7 @@
#include "raster/image.h"
#include "util/render.h"
#include "widgets/colbut.h"
#include "widgets/editor.h"
//////////////////////////////////////////////////////////////////////
// options
@ -61,6 +62,7 @@ OptionsCommand::OptionsCommand()
void OptionsCommand::execute(Context* context)
{
JWidget check_smooth;
JWidget cursor_color, cursor_color_box;
JWidget button_ok;
JWidget move_click2, draw_click2;
JWidget checked_bg_reset;
@ -73,6 +75,7 @@ void OptionsCommand::execute(Context* context)
"smooth", &check_smooth,
"move_click2", &move_click2,
"draw_click2", &draw_click2,
"cursor_color_box", &cursor_color_box,
"checked_bg_size", &checked_bg,
"checked_bg_zoom", &checked_bg_zoom,
"checked_bg_color1_box", &checked_bg_color1_box,
@ -81,6 +84,11 @@ void OptionsCommand::execute(Context* context)
"undo_size_limit", &undo_size_limit,
"button_ok", &button_ok, NULL);
// Cursor color
cursor_color = colorbutton_new(Editor::get_cursor_color(), IMAGE_INDEXED);
cursor_color->setName("cursor_color");
jwidget_add_child(cursor_color_box, cursor_color);
if (get_config_bool("Options", "MoveClick2", false))
jwidget_select(move_click2);
@ -119,7 +127,9 @@ void OptionsCommand::execute(Context* context)
if (window->get_killer() == button_ok) {
int undo_size_limit_value;
Editor::set_cursor_color(colorbutton_get_color(cursor_color));
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));