- enhancement: "Mouse scroll direction" option in Options / Editor / General
- change: Invert scroll direction in horizontal, like in vertical.
This commit is contained in:
parent
63db2e5179
commit
5003c412f7
2
NEWS.md
2
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.
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -367,6 +367,42 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Mouse Scroll Direction</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rbNaturalScroll">
|
||||
<property name="text">
|
||||
<string>Natural</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rbInvertScroll">
|
||||
<property name="text">
|
||||
<string>Invert</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_6" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
|
|
|
@ -1452,12 +1452,12 @@
|
|||
<translation>Inserir a condição de parada:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+260"/>
|
||||
<location line="+262"/>
|
||||
<source>Readonly</source>
|
||||
<translation>Apenas leitura</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="-5347"/>
|
||||
<location line="-5349"/>
|
||||
<location line="+434"/>
|
||||
<source>Error Load File</source>
|
||||
<translation type="unfinished">Erro ao carregar arquivo</translation>
|
||||
|
@ -8374,7 +8374,7 @@
|
|||
<location filename="../autolinkmanager.cpp" line="+54"/>
|
||||
<location line="+16"/>
|
||||
<location line="+19"/>
|
||||
<location filename="../settings.cpp" line="+4057"/>
|
||||
<location filename="../settings.cpp" line="+4069"/>
|
||||
<location filename="../widgets/ojproblemsetmodel.cpp" line="-401"/>
|
||||
<location line="+61"/>
|
||||
<source>Can't open file '%1' for read.</source>
|
||||
|
@ -8689,7 +8689,7 @@
|
|||
<translation>Impossível carregar configurações para autolink</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../parser/cppparser.cpp" line="+1235"/>
|
||||
<location filename="../parser/cppparser.cpp" line="+1258"/>
|
||||
<source>constructor</source>
|
||||
<translation>constructor</translation>
|
||||
</message>
|
||||
|
@ -11047,7 +11047,22 @@
|
|||
<translation>Limitar rolamento de página a apenas uma linha</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+22"/>
|
||||
<location line="+7"/>
|
||||
<source>Mouse Scroll Direction</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+6"/>
|
||||
<source>Natural</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+7"/>
|
||||
<source>Invert</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+38"/>
|
||||
<source>Mouse Wheel Scroll Speed</source>
|
||||
<translation>Velocidade de rolamento pela rodinha do mouse</translation>
|
||||
</message>
|
||||
|
|
|
@ -1714,7 +1714,7 @@ p, li { white-space: pre-wrap; }
|
|||
<translation>输入当前断点的生效条件:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+260"/>
|
||||
<location line="+262"/>
|
||||
<source>Readonly</source>
|
||||
<translation>只读</translation>
|
||||
</message>
|
||||
|
@ -9234,7 +9234,7 @@ p, li { white-space: pre-wrap; }
|
|||
<translation>生成调试信息(-g3)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings.cpp" line="+3455"/>
|
||||
<location filename="../settings.cpp" line="+3467"/>
|
||||
<source>Would you like Red Panda C++ to search for compilers in PATH?</source>
|
||||
<translation>您同意小熊猫C++在PATH路径中寻找gcc编译器吗?</translation>
|
||||
</message>
|
||||
|
@ -9828,7 +9828,7 @@ p, li { white-space: pre-wrap; }
|
|||
<translation type="vanished">无标题</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../parser/cppparser.cpp" line="+1235"/>
|
||||
<location filename="../parser/cppparser.cpp" line="+1258"/>
|
||||
<source>constructor</source>
|
||||
<translation>构造函数</translation>
|
||||
</message>
|
||||
|
@ -11950,7 +11950,22 @@ p, li { white-space: pre-wrap; }
|
|||
<translation>在滚动页时少滚动一行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+22"/>
|
||||
<location line="+7"/>
|
||||
<source>Mouse Scroll Direction</source>
|
||||
<translation>鼠标卷轴方向</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+6"/>
|
||||
<source>Natural</source>
|
||||
<translation>正常</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+7"/>
|
||||
<source>Invert</source>
|
||||
<translation>反向</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+38"/>
|
||||
<source>Mouse Wheel Scroll Speed</source>
|
||||
<translation>鼠标滚轮卷轴速度(行)</translation>
|
||||
</message>
|
||||
|
@ -11976,7 +11991,7 @@ p, li { white-space: pre-wrap; }
|
|||
<translation>右边缘颜色</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="-331"/>
|
||||
<location line="-367"/>
|
||||
<source>Caret for overwriting mode</source>
|
||||
<translation>覆写状态下的光标</translation>
|
||||
</message>
|
||||
|
|
|
@ -1297,12 +1297,12 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+260"/>
|
||||
<location line="+262"/>
|
||||
<source>Readonly</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="-5347"/>
|
||||
<location line="-5349"/>
|
||||
<location line="+434"/>
|
||||
<source>Error Load File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -8002,7 +8002,7 @@
|
|||
<location filename="../autolinkmanager.cpp" line="+54"/>
|
||||
<location line="+16"/>
|
||||
<location line="+19"/>
|
||||
<location filename="../settings.cpp" line="+4057"/>
|
||||
<location filename="../settings.cpp" line="+4069"/>
|
||||
<location filename="../widgets/ojproblemsetmodel.cpp" line="-401"/>
|
||||
<location line="+61"/>
|
||||
<source>Can't open file '%1' for read.</source>
|
||||
|
@ -8310,7 +8310,7 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../parser/cppparser.cpp" line="+1235"/>
|
||||
<location filename="../parser/cppparser.cpp" line="+1258"/>
|
||||
<source>constructor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -10275,7 +10275,22 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+22"/>
|
||||
<location line="+7"/>
|
||||
<source>Mouse Scroll Direction</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+6"/>
|
||||
<source>Natural</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+7"/>
|
||||
<source>Invert</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+38"/>
|
||||
<source>Mouse Wheel Scroll Speed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 <Tab> and <Shift><Tab> act as block indent, unindent when text is selected
|
||||
eoTabsToSpaces = 0x00040000, //Converts a tab character to a specified number of space characters
|
||||
|
|
Loading…
Reference in New Issue