Move native cursor preference from "Experimental" to "Cursors" section

This commit is contained in:
David Capello 2016-08-30 16:52:03 -03:00
parent 162cee2870
commit b80beb13ad
5 changed files with 23 additions and 15 deletions

View File

@ -104,10 +104,13 @@
<option id="show_scrollbars" type="bool" default="true" migrate="Options.ShowScrollbars" />
<option id="right_click_mode" type="RightClickMode" default="RightClickMode::PAINT_BGCOLOR" migrate="Options.RightClickMode" />
<option id="auto_select_layer" type="bool" default="false" migrate="Options.AutoSelectLayer" />
<option id="cursor_color" type="app::Color" default="app::Color::fromMask()" migrate="Tools.CursorColor" />
<option id="brush_preview" type="BrushPreview" default="BrushPreview::FULL" />
<option id="play_once" type="bool" default="false" />
</section>
<section id="cursor">
<option id="use_native_cursor" type="bool" default="false" migrate="experimental.use_native_cursor" />
<option id="cursor_color" type="app::Color" default="app::Color::fromMask()" migrate="editor.cursor_color" />
<option id="brush_preview" type="BrushPreview" default="BrushPreview::FULL" migrate="editor.brush_preview" />
</section>
<section id="preview" text="Preview">
<option id="play_once" type="bool" default="false" />
</section>
@ -118,7 +121,6 @@
</section>
<section id="experimental" text="Experimental">
<option id="ui_scale" type="int" default="1" />
<option id="use_native_cursor" type="bool" default="false" migrate="Options.NativeCursor" />
<option id="use_native_file_dialog" type="bool" default="false" />
<option id="flash_layer" type="bool" default="false" migrate="Options.FlashLayer" />
</section>

View File

@ -83,6 +83,9 @@
<!-- Cursors -->
<vbox id="section_cursors">
<separator text="UI Cursor" horizontal="true" />
<check id="native_cursor" text="Use native mouse cursors" />
<separator text="Painting Cursors" horizontal="true" />
<label text="Precise Cursor Color:" />
<hbox>
@ -172,7 +175,6 @@
<!-- Experimental -->
<vbox id="section_experimental">
<separator text="User Interface" horizontal="true" />
<check id="native_cursor" text="Use native mouse cursor" />
<check id="native_file_dialog" text="Use native file dialog" />
<check id="flash_layer" text="Flash layer when it is selected" />
</vbox>

View File

@ -206,7 +206,7 @@ void App::initialize(const AppOptions& options)
// Setup the GUI cursor and redraw screen
ui::set_use_native_cursors(
preferences().experimental.useNativeCursor());
preferences().cursor.useNativeCursor());
ui::set_mouse_cursor(kArrowCursor);

View File

@ -72,7 +72,7 @@ public:
, m_checked_bg_color2(new ColorButton(app::Color::fromMask(), IMAGE_RGB))
, m_pixelGridColor(new ColorButton(app::Color::fromMask(), IMAGE_RGB))
, m_gridColor(new ColorButton(app::Color::fromMask(), IMAGE_RGB))
, m_cursorColor(new ColorButton(m_pref.editor.cursorColor(), IMAGE_RGB))
, m_cursorColor(new ColorButton(m_pref.cursor.cursorColor(), IMAGE_RGB))
, m_curSection(curSection)
{
sectionListbox()->Change.connect(base::Bind<void>(&OptionsWindow::onChangeSection, this));
@ -92,7 +92,7 @@ public:
// Brush preview
brushPreview()->setSelectedItemIndex(
(int)m_pref.editor.brushPreview());
(int)m_pref.cursor.brushPreview());
// Grid color
m_gridColor->setId("grid_color");
@ -134,8 +134,13 @@ public:
if (m_pref.selection.keepSelectionAfterClear())
keepSelectionAfterClear()->setSelected(true);
if (m_pref.experimental.useNativeCursor())
#if defined(_WIN32) || defined(__APPLE__)
if (m_pref.cursor.useNativeCursor())
nativeCursor()->setSelected(true);
#else
// TODO impl this on Linux
nativeCursor()->setEnabled(false);
#endif
if (m_pref.experimental.useNativeFileDialog())
nativeFileDialog()->setSelected(true);
@ -258,8 +263,9 @@ public:
m_pref.editor.zoomWithSlide(slideZoom()->isSelected());
#endif
m_pref.editor.rightClickMode(static_cast<app::gen::RightClickMode>(rightClickBehavior()->getSelectedItemIndex()));
m_pref.editor.cursorColor(m_cursorColor->getColor());
m_pref.editor.brushPreview(static_cast<app::gen::BrushPreview>(brushPreview()->getSelectedItemIndex()));
m_pref.cursor.cursorColor(m_cursorColor->getColor());
m_pref.cursor.brushPreview(static_cast<app::gen::BrushPreview>(brushPreview()->getSelectedItemIndex()));
m_pref.cursor.useNativeCursor(nativeCursor()->isSelected());
m_pref.selection.autoOpaque(autoOpaque()->isSelected());
m_pref.selection.keepSelectionAfterClear(keepSelectionAfterClear()->isSelected());
@ -283,11 +289,9 @@ public:
m_pref.undo.allowNonlinearHistory(undoAllowNonlinearHistory()->isSelected());
// Experimental features
m_pref.experimental.useNativeCursor(nativeCursor()->isSelected());
m_pref.experimental.useNativeFileDialog(nativeFileDialog()->isSelected());
m_pref.experimental.flashLayer(flashLayer()->isSelected());
ui::set_use_native_cursors(
m_pref.experimental.useNativeCursor());
ui::set_use_native_cursors(m_pref.cursor.useNativeCursor());
bool reset_screen = false;
int newScreenScale = base::convert_to<int>(screenScale()->getValue());

View File

@ -96,7 +96,7 @@ void BrushPreview::show(const gfx::Point& screenPos)
// Get cursor color
const auto& pref = Preferences::instance();
app::Color app_cursor_color = pref.editor.cursorColor();
app::Color app_cursor_color = pref.cursor.cursorColor();
gfx::Color ui_cursor_color = color_utils::color_for_ui(app_cursor_color);
m_blackAndWhiteNegative = (app_cursor_color.getType() == app::Color::MaskType);
@ -139,7 +139,7 @@ void BrushPreview::show(const gfx::Point& screenPos)
bool usePreview = false;
auto brushPreview = pref.editor.brushPreview();
auto brushPreview = pref.cursor.brushPreview();
if (!m_editor->docPref().show.brushPreview())
brushPreview = app::gen::BrushPreview::NONE;