Add option to disable use of ctrl+alt for changing brush size.

For #2864.
This commit is contained in:
Martin van Zijl 2020-02-12 20:34:30 +13:00
parent b566e1f9d5
commit a10e2f0af9
6 changed files with 15 additions and 3 deletions

View file

@ -333,6 +333,9 @@ public:
int getLevelBasedToolsDisplay() const {
return getIntValue(levelBasedToolsDisplay);
}
bool useCtrlAltToResizeBrushEnabled() const {
return getBoolValue(useCtrlAltToResizeBrush);
}
// Xsheet tab
QString getXsheetLayoutPreference() const {

View file

@ -104,6 +104,7 @@ enum PreferencesItemId {
cursorBrushStyle,
cursorOutlineEnabled,
levelBasedToolsDisplay,
useCtrlAltToResizeBrush,
//----------
// Xsheet
@ -198,4 +199,4 @@ enum PreferencesItemId {
PreferencesItemCount
};
#endif
#endif

View file

@ -1788,7 +1788,9 @@ void ToonzRasterBrushTool::mouseMove(const TPointD &pos, const TMouseEvent &e) {
TPointD halfThick(thickness * 0.5, thickness * 0.5);
TRectD invalidateRect(m_brushPos - halfThick, m_brushPos + halfThick);
if (e.isCtrlPressed() && e.isAltPressed() && !e.isShiftPressed()) {
if (e.isCtrlPressed() && e.isAltPressed() && !e.isShiftPressed() &&
Preferences::instance()->useCtrlAltToResizeBrushEnabled()) {
// Resize the brush if CTRL+ALT is pressed and the preference is enabled.
const TPointD &diff = pos - m_mousePos;
double max = diff.x / 2;
double min = diff.y / 2;

View file

@ -1281,7 +1281,9 @@ void ToonzVectorBrushTool::mouseMove(const TPointD &pos, const TMouseEvent &e) {
TPointD halfThick(m_maxThick * 0.5, m_maxThick * 0.5);
TRectD invalidateRect(m_brushPos - halfThick, m_brushPos + halfThick);
if (e.isCtrlPressed() && e.isAltPressed() && !e.isShiftPressed()) {
if (e.isCtrlPressed() && e.isAltPressed() && !e.isShiftPressed() &&
Preferences::instance()->useCtrlAltToResizeBrushEnabled()) {
// Resize the brush if CTRL+ALT is pressed and the preference is enabled.
const TPointD &diff = pos - m_mousePos;
double max = diff.x / 2;
double min = diff.y / 2;

View file

@ -1032,6 +1032,7 @@ QString PreferencesPopup::getUIString(PreferencesItemId id) {
{cursorBrushStyle, tr("Cursor Style:")},
{cursorOutlineEnabled, tr("Show Cursor Size Outlines")},
{levelBasedToolsDisplay, tr("Toolbar Display Behaviour:")},
{useCtrlAltToResizeBrush, tr("Use Ctrl+Alt to Resize Brush")},
// Xsheet
{xsheetLayoutPreference, tr("Column Header Layout*:")},
@ -1649,6 +1650,7 @@ QWidget* PreferencesPopup::createToolsPage() {
}
insertUI(levelBasedToolsDisplay, lay,
getComboItemList(levelBasedToolsDisplay));
insertUI(useCtrlAltToResizeBrush, lay);
lay->setRowStretch(lay->rowCount(), 1);
widget->setLayout(lay);

View file

@ -490,6 +490,8 @@ void Preferences::definePreferenceItems() {
define(cursorOutlineEnabled, "cursorOutlineEnabled", QMetaType::Bool, true);
define(levelBasedToolsDisplay, "levelBasedToolsDisplay", QMetaType::Int,
0); // Default
define(useCtrlAltToResizeBrush, "useCtrlAltToResizeBrush",
QMetaType::Bool, true);
// Xsheet
define(xsheetLayoutPreference, "xsheetLayoutPreference", QMetaType::QString,