Add option to disable straight line preview w/Shift+Pencil tool

This commit is contained in:
David Capello 2017-09-08 16:04:18 -03:00
parent 2d51b8dfff
commit 390d954ceb
6 changed files with 28 additions and 3 deletions

View File

@ -126,6 +126,7 @@
<option id="auto_scroll" type="bool" default="true" /> <option id="auto_scroll" type="bool" default="true" />
<option id="right_click_mode" type="RightClickMode" default="RightClickMode::PAINT_BGCOLOR" migrate="Options.RightClickMode" /> <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="auto_select_layer" type="bool" default="false" migrate="Options.AutoSelectLayer" />
<option id="straight_line_preview" type="bool" default="true" />
<option id="play_once" type="bool" default="false" /> <option id="play_once" type="bool" default="false" />
<option id="play_all" type="bool" default="false" /> <option id="play_all" type="bool" default="false" />
</section> </section>

View File

@ -309,6 +309,13 @@ zoom_from_center_with_keys = Zoom from center with keys
show_scrollbars = Show scroll-bars in sprite editor show_scrollbars = Show scroll-bars in sprite editor
show_scrollbars_tooltip = Show scroll-bars in all sprite editors. show_scrollbars_tooltip = Show scroll-bars in all sprite editors.
auto_scroll = Auto-scroll on editor edges auto_scroll = Auto-scroll on editor edges
straight_line_preview = Preview straight line inmediately on Pencil tool
straight_line_preview_tooltip = <<<END
On Pencil tool you can draw straight lines
using Shift+click, with this option checked
you will see the preview inmediately when
the Shift key is pressed.
END
right_click = Right-click: right_click = Right-click:
editor_selection = Selection editor_selection = Selection
auto_opaque = Adjust opaque/transparent mode automatically auto_opaque = Adjust opaque/transparent mode automatically

View File

@ -84,6 +84,7 @@
<check text="@.zoom_from_center_with_keys" id="zoom_from_center_with_keys" /> <check text="@.zoom_from_center_with_keys" id="zoom_from_center_with_keys" />
<check text="@.show_scrollbars" id="show_scrollbars" tooltip="@.show_scrollbars_tooltip" /> <check text="@.show_scrollbars" id="show_scrollbars" tooltip="@.show_scrollbars_tooltip" />
<check text="@.auto_scroll" id="auto_scroll" /> <check text="@.auto_scroll" id="auto_scroll" />
<check text="@.straight_line_preview" id="straight_line_preview" tooltip="@.straight_line_preview_tooltip" />
<hbox> <hbox>
<label text="@.right_click" /> <label text="@.right_click" />
<combobox id="right_click_behavior" expansive="true" /> <combobox id="right_click_behavior" expansive="true" />

View File

@ -232,6 +232,9 @@ public:
if (m_pref.editor.autoScroll()) if (m_pref.editor.autoScroll())
autoScroll()->setSelected(true); autoScroll()->setSelected(true);
if (m_pref.editor.straightLinePreview())
straightLinePreview()->setSelected(true);
// Scope // Scope
bgScope()->addItem("Background for New Documents"); bgScope()->addItem("Background for New Documents");
gridScope()->addItem("Grid for New Documents"); gridScope()->addItem("Grid for New Documents");
@ -372,6 +375,7 @@ public:
m_pref.editor.zoomFromCenterWithKeys(zoomFromCenterWithKeys()->isSelected()); m_pref.editor.zoomFromCenterWithKeys(zoomFromCenterWithKeys()->isSelected());
m_pref.editor.showScrollbars(showScrollbars()->isSelected()); m_pref.editor.showScrollbars(showScrollbars()->isSelected());
m_pref.editor.autoScroll(autoScroll()->isSelected()); m_pref.editor.autoScroll(autoScroll()->isSelected());
m_pref.editor.straightLinePreview(straightLinePreview()->isSelected());
m_pref.editor.zoomWithWheel(wheelZoom()->isSelected()); m_pref.editor.zoomWithWheel(wheelZoom()->isSelected());
#if __APPLE__ #if __APPLE__
m_pref.editor.zoomWithSlide(slideZoom()->isSelected()); m_pref.editor.zoomWithSlide(slideZoom()->isSelected());

View File

@ -141,7 +141,8 @@ bool DrawingState::onMouseUp(Editor* editor, MouseMessage* msg)
// using Shift+click with the Pencil tool. When we release the mouse // using Shift+click with the Pencil tool. When we release the mouse
// button, if the Shift key is pressed, the whole ToolLoop starts // button, if the Shift key is pressed, the whole ToolLoop starts
// again. // again.
checkStartDrawingStraightLine(editor); if (Preferences::instance().editor.straightLinePreview())
checkStartDrawingStraightLine(editor);
return true; return true;
} }
@ -204,7 +205,7 @@ bool DrawingState::onKeyUp(Editor* editor, KeyMessage* msg)
// Cancel loop pressing Esc key... // Cancel loop pressing Esc key...
if (msg->scancode() == ui::kKeyEsc || if (msg->scancode() == ui::kKeyEsc ||
// Cancel "Shift on freehand" line preview when the Shift key is // Cancel "Shift on freehand" line preview when the Shift key is
// released and the user didn't press the mouse button.. // released and the user didn't press the mouse button.
(m_type == DrawingType::LineFreehand && (m_type == DrawingType::LineFreehand &&
!m_mousePressedReceived && !m_mousePressedReceived &&
!editor->startStraightLineWithFreehandTool())) { !editor->startStraightLineWithFreehandTool())) {

View File

@ -316,6 +316,16 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg)
// Start the Tool-Loop // Start the Tool-Loop
if (layer && (layer->isImage() || clickedInk->isSelection())) { if (layer && (layer->isImage() || clickedInk->isSelection())) {
// Shift+click on Pencil tool starts a line onMouseDown() when the
// preview (onKeyDown) is disabled.
if (!Preferences::instance().editor.straightLinePreview() &&
checkStartDrawingStraightLine(editor)) {
// Send first mouse down to draw the straight line and start the
// freehand mode.
editor->getState()->onMouseDown(editor, msg);
return true;
}
// Disable layer edges to avoid showing the modified cel // Disable layer edges to avoid showing the modified cel
// information by ExpandCelCanvas (i.e. the cel origin is changed // information by ExpandCelCanvas (i.e. the cel origin is changed
// to 0,0 coordinate.) // to 0,0 coordinate.)
@ -490,7 +500,8 @@ bool StandbyState::onSetCursor(Editor* editor, const gfx::Point& mouseScreenPos)
bool StandbyState::onKeyDown(Editor* editor, KeyMessage* msg) bool StandbyState::onKeyDown(Editor* editor, KeyMessage* msg)
{ {
if (checkStartDrawingStraightLine(editor)) if (Preferences::instance().editor.straightLinePreview() &&
checkStartDrawingStraightLine(editor))
return true; return true;
return false; return false;
} }