diff --git a/NEWS.md b/NEWS.md
index 029c35d8..bc641fcd 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -58,6 +58,8 @@ Red Panda C++ Version 2.27
- enhancement: Folding button scales with editor font.
- fix: Should show header completion popup in #include line comments.
- fix: Custom compile options not correctly parsed.
+ - enhancement: "Mouse scroll direction" option in Options / Editor / General
+ - change: Invert scroll direction in horizontal, like in vertical.
Red Panda C++ Version 2.26
- enhancement: Code suggestion for embedded std::vectors.
diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp
index 2a659298..63b3f989 100644
--- a/RedPandaIDE/editor.cpp
+++ b/RedPandaIDE/editor.cpp
@@ -5253,6 +5253,8 @@ void Editor::applySettings()
options.setFlag(QSynedit::eoScrollByOneLess,pSettings->editor().scrollByOneLess());
options.setFlag(QSynedit::eoHalfPageScroll,pSettings->editor().halfPageScroll());
options.setFlag(QSynedit::eoHalfPageScroll,pSettings->editor().halfPageScroll());
+ options.setFlag(QSynedit::eoInvertMouseScroll, pSettings->editor().invertMouseScroll());
+
options.setFlag(QSynedit::eoShowRainbowColor,
pSettings->editor().rainbowParenthesis()
&& syntaxer()->supportBraceLevel());
diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp
index 2d54cdf0..aab8d3a7 100644
--- a/RedPandaIDE/settings.cpp
+++ b/RedPandaIDE/settings.cpp
@@ -825,6 +825,16 @@ void Settings::Editor::setForceFixedFontWidth(bool newForceFixedWidth)
mForceFixedFontWidth = newForceFixedWidth;
}
+bool Settings::Editor::invertMouseScroll() const
+{
+ return mInvertMouseScroll;
+}
+
+void Settings::Editor::setInvertMouseScroll(bool newInvertMouseScroll)
+{
+ mInvertMouseScroll = newInvertMouseScroll;
+}
+
bool Settings::Editor::showTrailingSpaces() const
{
return mShowTrailingSpaces;
@@ -1342,6 +1352,7 @@ void Settings::Editor::doSave()
saveValue("half_page_scroll", mHalfPageScroll);
saveValue("mouse_wheel_scroll_speed", mMouseWheelScrollSpeed);
saveValue("mouse_selection_scroll_speed",mMouseSelectionScrollSpeed);
+ saveValue("invert_mouse_scroll",mInvertMouseScroll);
//right edge
saveValue("show_right_edge_line",mShowRightEdgeLine);
@@ -1474,6 +1485,7 @@ void Settings::Editor::doLoad()
mHalfPageScroll = boolValue("half_page_scroll",false);
mMouseWheelScrollSpeed = intValue("mouse_wheel_scroll_speed", 3);
mMouseSelectionScrollSpeed = intValue("mouse_selection_scroll_speed",1);
+ mInvertMouseScroll = boolValue("invert_mouse_scroll", false);
//right edge
diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h
index 9f351748..bdd49ee0 100644
--- a/RedPandaIDE/settings.h
+++ b/RedPandaIDE/settings.h
@@ -410,6 +410,9 @@ public:
bool forceFixedFontWidth() const;
void setForceFixedFontWidth(bool newForceFixedWidth);
+ bool invertMouseScroll() const;
+ void setInvertMouseScroll(bool newInvertMouseScroll);
+
private:
//General
// indents
@@ -441,6 +444,7 @@ public:
bool mHalfPageScroll;
int mMouseWheelScrollSpeed;
int mMouseSelectionScrollSpeed;
+ bool mInvertMouseScroll;
//right margin
bool mShowRightEdgeLine;
diff --git a/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp b/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp
index bc3eb11b..36d04c72 100644
--- a/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp
+++ b/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp
@@ -79,6 +79,7 @@ void EditorGeneralWidget::doLoad()
ui->chkScrollByOneLess->setChecked(pSettings->editor().scrollByOneLess());
ui->spinMouseWheelScrollSpeed->setValue(pSettings->editor().mouseWheelScrollSpeed());
ui->spinMouseSelectionScrollSpeed->setValue(pSettings->editor().mouseSelectionScrollSpeed());
+ ui->rbInvertScroll->setChecked(pSettings->editor().invertMouseScroll());
//right margin line;
ui->grpRightEdge->setChecked(pSettings->editor().showRightEdgeLine());
@@ -116,7 +117,7 @@ void EditorGeneralWidget::doSave()
pSettings->editor().setHalfPageScroll(ui->chkScrollHalfPage->isChecked());
pSettings->editor().setMouseWheelScrollSpeed(ui->spinMouseWheelScrollSpeed->value());
pSettings->editor().setMouseSelectionScrollSpeed(ui->spinMouseSelectionScrollSpeed->value());
-
+ pSettings->editor().setInvertMouseScroll(ui->rbInvertScroll->isChecked());
//right margin line;
pSettings->editor().setShowRightEdgeLine(ui->grpRightEdge->isChecked());
pSettings->editor().setRightEdgeWidth(ui->spRightEdge->value());
diff --git a/RedPandaIDE/settingsdialog/editorgeneralwidget.ui b/RedPandaIDE/settingsdialog/editorgeneralwidget.ui
index a9d00844..d6c135ef 100644
--- a/RedPandaIDE/settingsdialog/editorgeneralwidget.ui
+++ b/RedPandaIDE/settingsdialog/editorgeneralwidget.ui
@@ -367,6 +367,42 @@
+ -
+
+
+ Mouse Scroll Direction
+
+
+
-
+
+
+ Natural
+
+
+
+ -
+
+
+ Invert
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
-
diff --git a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts
index 617ea439..c7771f10 100644
--- a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts
+++ b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts
@@ -1452,12 +1452,12 @@
Inserir a condição de parada:
-
+
Apenas leitura
-
+
Erro ao carregar arquivo
@@ -8374,7 +8374,7 @@
-
+
@@ -8689,7 +8689,7 @@
Impossível carregar configurações para autolink
-
+
constructor
@@ -11047,7 +11047,22 @@
Limitar rolamento de página a apenas uma linha
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Velocidade de rolamento pela rodinha do mouse
diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts
index f91cbdcc..94db2c18 100644
--- a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts
+++ b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts
@@ -1714,7 +1714,7 @@ p, li { white-space: pre-wrap; }
输入当前断点的生效条件:
-
+
只读
@@ -9234,7 +9234,7 @@ p, li { white-space: pre-wrap; }
生成调试信息(-g3)
-
+
您同意小熊猫C++在PATH路径中寻找gcc编译器吗?
@@ -9828,7 +9828,7 @@ p, li { white-space: pre-wrap; }
无标题
-
+
构造函数
@@ -11950,7 +11950,22 @@ p, li { white-space: pre-wrap; }
在滚动页时少滚动一行
-
+
+
+ 鼠标卷轴方向
+
+
+
+
+ 正常
+
+
+
+
+ 反向
+
+
+
鼠标滚轮卷轴速度(行)
@@ -11976,7 +11991,7 @@ p, li { white-space: pre-wrap; }
右边缘颜色
-
+
覆写状态下的光标
diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts
index d6841231..64b0aaf5 100644
--- a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts
+++ b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts
@@ -1297,12 +1297,12 @@
-
+
-
+
@@ -8002,7 +8002,7 @@
-
+
@@ -8310,7 +8310,7 @@
-
+
@@ -10275,7 +10275,22 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libs/qsynedit/qsynedit/qsynedit.cpp b/libs/qsynedit/qsynedit/qsynedit.cpp
index b5e9bbec..7436dcc5 100644
--- a/libs/qsynedit/qsynedit/qsynedit.cpp
+++ b/libs/qsynedit/qsynedit/qsynedit.cpp
@@ -6256,6 +6256,7 @@ void QSynEdit::leaveEvent(QEvent *)
void QSynEdit::wheelEvent(QWheelEvent *event)
{
+ int sign = mOptions.testFlag(EditorOption::eoInvertMouseScroll)?+1:-1;
if (event->modifiers() == Qt::ShiftModifier) {
if ( (mWheelAccumulatedDeltaX>0 &&event->angleDelta().y()<0)
|| (mWheelAccumulatedDeltaX<0 &&event->angleDelta().y()>0))
@@ -6263,11 +6264,11 @@ void QSynEdit::wheelEvent(QWheelEvent *event)
mWheelAccumulatedDeltaX+=event->angleDelta().y();
while (mWheelAccumulatedDeltaX>=120) {
mWheelAccumulatedDeltaX-=120;
- horizontalScrollBar()->setValue(horizontalScrollBar()->value()+mMouseWheelScrollSpeed);
+ horizontalScrollBar()->setValue(horizontalScrollBar()->value()+sign*mMouseWheelScrollSpeed*mCharWidth);
}
while (mWheelAccumulatedDeltaX<=-120) {
mWheelAccumulatedDeltaX+=120;
- horizontalScrollBar()->setValue(horizontalScrollBar()->value()-mMouseWheelScrollSpeed);
+ horizontalScrollBar()->setValue(horizontalScrollBar()->value()-sign*mMouseWheelScrollSpeed*mCharWidth);
}
} else {
if ( (mWheelAccumulatedDeltaY>0 &&event->angleDelta().y()<0)
@@ -6276,11 +6277,11 @@ void QSynEdit::wheelEvent(QWheelEvent *event)
mWheelAccumulatedDeltaY+=event->angleDelta().y();
while (mWheelAccumulatedDeltaY>=120) {
mWheelAccumulatedDeltaY-=120;
- verticalScrollBar()->setValue(verticalScrollBar()->value()-mMouseWheelScrollSpeed);
+ verticalScrollBar()->setValue(verticalScrollBar()->value()+sign*mMouseWheelScrollSpeed);
}
while (mWheelAccumulatedDeltaY<=-120) {
mWheelAccumulatedDeltaY+=120;
- verticalScrollBar()->setValue(verticalScrollBar()->value()+mMouseWheelScrollSpeed);
+ verticalScrollBar()->setValue(verticalScrollBar()->value()-sign*mMouseWheelScrollSpeed);
}
if ( (mWheelAccumulatedDeltaX>0 &&event->angleDelta().x()<0)
@@ -6289,11 +6290,11 @@ void QSynEdit::wheelEvent(QWheelEvent *event)
mWheelAccumulatedDeltaX+=event->angleDelta().x();
while (mWheelAccumulatedDeltaX>=120) {
mWheelAccumulatedDeltaX-=120;
- horizontalScrollBar()->setValue(horizontalScrollBar()->value()+mMouseWheelScrollSpeed);
+ horizontalScrollBar()->setValue(horizontalScrollBar()->value()+sign*mMouseWheelScrollSpeed*mCharWidth);
}
while (mWheelAccumulatedDeltaX<=-120) {
mWheelAccumulatedDeltaX+=120;
- horizontalScrollBar()->setValue(horizontalScrollBar()->value()-mMouseWheelScrollSpeed);
+ horizontalScrollBar()->setValue(horizontalScrollBar()->value()-sign*mMouseWheelScrollSpeed*mCharWidth);
}
}
event->accept();
diff --git a/libs/qsynedit/qsynedit/qsynedit.h b/libs/qsynedit/qsynedit/qsynedit.h
index 5f047dcf..ee9469cc 100644
--- a/libs/qsynedit/qsynedit/qsynedit.h
+++ b/libs/qsynedit/qsynedit/qsynedit.h
@@ -93,7 +93,7 @@ enum EditorOption {
eoScrollByOneLess = 0x00001000, //Forces scrolling to be one less
eoScrollPastEof = 0x00002000, //Allows the cursor to go past the end of file marker
eoScrollPastEol = 0x00004000, //Allows the cursor to go past the last character into the white space at the end of a line
-// eoShowSpecialChars = 0x00008000, //Shows the special Characters
+ eoInvertMouseScroll = 0x00008000, //Shows the special Characters
// eoSpecialLineDefaultFg = 0x00010000, //disables the foreground text color override when using the OnSpecialLineColor event
eoTabIndent = 0x00020000, //When active and act as block indent, unindent when text is selected
eoTabsToSpaces = 0x00040000, //Converts a tab character to a specified number of space characters