- fix: Reformat code when select contents in column mode will mess up the document.
- enhancement: Add "save as" icon to the toolbar. - enhancement: Use key sequences as shortcut to actions in the options dialog's environment->shortcut page. - change: Use ctrl+shift+S as the shortcut for "save as". - change: Use ctrl+K,ctrl+S as the shortcut for "save all".
This commit is contained in:
parent
9cfc892e3f
commit
7a8a239dfc
5
NEWS.md
5
NEWS.md
|
@ -9,6 +9,11 @@ Red Panda C++ Version 2.19
|
|||
- enhancement: Open Containing folder will auto select the file in windows file explore.
|
||||
- fix: Class constructor & destructor is not correctly handled.
|
||||
- fix: Remove multiple files in the project panel is not correctly handled.
|
||||
- fix: Reformat code when select contents in column mode will mess up the document.
|
||||
- enhancement: Add "save as" icon to the toolbar.
|
||||
- enhancement: Use key sequences as shortcut to actions in the options dialog's environment->shortcut page.
|
||||
- change: Use ctrl+shift+S as the shortcut for "save as".
|
||||
- change: Use ctrl+K,ctrl+S as the shortcut for "save all".
|
||||
|
||||
Red Panda C++ Version 2.18
|
||||
|
||||
|
|
|
@ -379,6 +379,7 @@
|
|||
<addaction name="actionNew"/>
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="actionSave"/>
|
||||
<addaction name="actionSaveAs"/>
|
||||
<addaction name="actionSaveAll"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolbarCode">
|
||||
|
@ -2114,6 +2115,9 @@
|
|||
<property name="toolTip">
|
||||
<string>Save As</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Shift+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveAll">
|
||||
<property name="icon">
|
||||
|
@ -2125,7 +2129,7 @@
|
|||
<string>Save All</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Shift+S</string>
|
||||
<string>Ctrl+K, Ctrl+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOptions">
|
||||
|
|
|
@ -46,6 +46,15 @@ void ToolsManager::load()
|
|||
item->parameters = "<EXENAME>";
|
||||
item->pauseAfterExit = false;
|
||||
mTools.append(item);
|
||||
//#ifdef Q_OS_WIN
|
||||
// item = std::make_shared<ToolItem>();
|
||||
// item->title = tr("Open compiled in explorer");
|
||||
// item->program = "explorer.exe";
|
||||
// item->workingDirectory = "<SOURCEPATH>";
|
||||
// item->parameters = " /n, /select, <EXENAME>";
|
||||
// item->pauseAfterExit = false;
|
||||
// mTools.append(item);
|
||||
//#endif
|
||||
return;
|
||||
}
|
||||
//read config file
|
||||
|
|
|
@ -5199,6 +5199,10 @@
|
|||
<source>It will be closed.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+K, Ctrl+S</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MemoryModel</name>
|
||||
|
@ -7818,6 +7822,10 @@
|
|||
<source>Write to tools config file '%1' failed.</source>
|
||||
<translation>Falha ao gravar o arquivo de configurações '%1'.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open compiled in explorer</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WatchModel</name>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4932,6 +4932,10 @@
|
|||
<source>It will be closed.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+K, Ctrl+S</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MemoryModel</name>
|
||||
|
@ -7154,6 +7158,10 @@
|
|||
<source>Write to tools config file '%1' failed.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open compiled in explorer</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WatchModel</name>
|
||||
|
|
|
@ -31,6 +31,7 @@ ShortcutInputEdit::ShortcutInputEdit(QWidget* parent):QLineEdit(parent)
|
|||
|
||||
void ShortcutInputEdit::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
QString lastKeys=text();
|
||||
if (event->key()==Qt::Key_Delete && event->modifiers()==Qt::NoModifier) {
|
||||
setText("");
|
||||
} else if (event->key()==Qt::Key_Backspace && event->modifiers()==Qt::NoModifier) {
|
||||
|
@ -66,11 +67,13 @@ void ShortcutInputEdit::keyPressEvent(QKeyEvent *event)
|
|||
&& event->text().at(0).unicode()<127) {
|
||||
s = s.mid(0,s.lastIndexOf('+')+1) + event->text().at(0);
|
||||
}
|
||||
if (!lastKeys.isEmpty())
|
||||
s=lastKeys+","+s;
|
||||
setText(s);
|
||||
if (key!=Qt::Key_Tab
|
||||
&& key!=Qt::Key_Enter
|
||||
&& key!=Qt::Key_Return)
|
||||
emit inputFinished(this);
|
||||
// if (key!=Qt::Key_Tab
|
||||
// && key!=Qt::Key_Enter
|
||||
// && key!=Qt::Key_Return)
|
||||
// emit inputFinished(this);
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
|
@ -78,7 +81,10 @@ void ShortcutInputEdit::keyPressEvent(QKeyEvent *event)
|
|||
bool ShortcutInputEdit::event(QEvent *event)
|
||||
{
|
||||
if (event->type()==QEvent::ShortcutOverride) {
|
||||
keyPressEvent((QKeyEvent*)event);
|
||||
QKeyEvent* keyEvent = static_cast<QKeyEvent *>(event);
|
||||
if (keyEvent->key()==Qt::Key_Tab)
|
||||
keyPressEvent((QKeyEvent*)event);
|
||||
|
||||
event->accept();
|
||||
return true;
|
||||
} else if (event->type()==QEvent::KeyPress) {
|
||||
|
|
|
@ -33,6 +33,7 @@ protected:
|
|||
// QObject interface
|
||||
public:
|
||||
bool event(QEvent *event) override;
|
||||
|
||||
};
|
||||
|
||||
#endif // SHORTCUTINPUTEDIT_H
|
||||
|
|
|
@ -1194,6 +1194,7 @@ void QSynEdit::setCaretAndSelection(const BufferCoord &ptCaret, const BufferCoor
|
|||
{
|
||||
incPaintLock();
|
||||
internalSetCaretXY(ptCaret);
|
||||
setActiveSelectionMode(SelectionMode::Normal);
|
||||
setBlockBegin(ptSelBegin);
|
||||
setBlockEnd(ptSelEnd);
|
||||
decPaintLock();
|
||||
|
@ -2730,11 +2731,11 @@ void QSynEdit::doBlockUnindent()
|
|||
endEditing();
|
||||
}
|
||||
|
||||
void QSynEdit::doAddChar(QChar AChar)
|
||||
void QSynEdit::doAddChar(const QChar& ch)
|
||||
{
|
||||
if (mReadOnly)
|
||||
return;
|
||||
if (!AChar.isPrint() && AChar!='\t')
|
||||
if (!ch.isPrint() && ch!='\t')
|
||||
return;
|
||||
//DoOnPaintTransient(ttBefore);
|
||||
//mCaretX will change after setSelLength;
|
||||
|
@ -2759,12 +2760,31 @@ void QSynEdit::doAddChar(QChar AChar)
|
|||
}
|
||||
}
|
||||
|
||||
if (isIdentChar(AChar)) {
|
||||
doSetSelText(AChar);
|
||||
} else if (AChar.isSpace()) {
|
||||
QChar lastCh{0};
|
||||
if (!selAvail()) {
|
||||
PUndoItem undoItem = mUndoList->peekItem();
|
||||
if (undoItem && undoItem->changeReason()==ChangeReason::Insert
|
||||
&& undoItem->changeEndPos().line == mCaretY
|
||||
&& undoItem->changeEndPos().ch == mCaretX
|
||||
&& undoItem->changeStartPos().line == mCaretY
|
||||
&& undoItem->changeStartPos().ch == mCaretX-1) {
|
||||
QString s = mDocument->getLine(mCaretY-1);
|
||||
int i=mCaretX-2;
|
||||
if (i>=0 && i<s.length())
|
||||
lastCh=s[i];
|
||||
}
|
||||
}
|
||||
if (isIdentChar(ch)) {
|
||||
if (!isIdentChar(lastCh)) {
|
||||
mUndoList->addGroupBreak();
|
||||
}
|
||||
doSetSelText(ch);
|
||||
} else if (ch.isSpace()) {
|
||||
// break group undo chain
|
||||
mUndoList->addGroupBreak();
|
||||
doSetSelText(AChar);
|
||||
if (!lastCh.isSpace()) {
|
||||
mUndoList->addGroupBreak();
|
||||
}
|
||||
doSetSelText(ch);
|
||||
// break group undo chain
|
||||
// if (mActiveSelectionMode!=SynSelectionMode::smColumn)
|
||||
// mUndoList->AddChange(SynChangeReason::crNothing,
|
||||
|
@ -2772,8 +2792,11 @@ void QSynEdit::doAddChar(QChar AChar)
|
|||
// BufferCoord{0, 0},
|
||||
// "", SynSelectionMode::smNormal);
|
||||
} else {
|
||||
if (lastCh.isSpace() || isIdentChar(lastCh)) {
|
||||
mUndoList->addGroupBreak();
|
||||
}
|
||||
beginEditing();
|
||||
doSetSelText(AChar);
|
||||
doSetSelText(ch);
|
||||
int oldCaretX=mCaretX-1;
|
||||
int oldCaretY=mCaretY;
|
||||
// auto
|
||||
|
@ -2784,7 +2807,7 @@ void QSynEdit::doAddChar(QChar AChar)
|
|||
&& (oldCaretY<=mDocument->count()) ) {
|
||||
|
||||
//unindent if ':' at end of the line
|
||||
if (AChar == ':') {
|
||||
if (ch == ':') {
|
||||
QString line = mDocument->getLine(oldCaretY-1);
|
||||
if (line.length() <= oldCaretX) {
|
||||
int indentSpaces = calcIndentSpaces(oldCaretY,line+":", true);
|
||||
|
@ -2810,7 +2833,7 @@ void QSynEdit::doAddChar(QChar AChar)
|
|||
);
|
||||
}
|
||||
}
|
||||
} else if (AChar == '*') {
|
||||
} else if (ch == '*') {
|
||||
QString line = mDocument->getLine(oldCaretY-1);
|
||||
if (line.length() <= oldCaretX) {
|
||||
int indentSpaces = calcIndentSpaces(oldCaretY,line+"*", true);
|
||||
|
@ -2836,12 +2859,12 @@ void QSynEdit::doAddChar(QChar AChar)
|
|||
);
|
||||
}
|
||||
}
|
||||
} else if (AChar == '{' || AChar == '}' || AChar == '#') {
|
||||
} else if (ch == '{' || ch == '}' || ch == '#') {
|
||||
//Reindent line when add '{' '}' and '#' at the beginning
|
||||
QString left = mDocument->getLine(oldCaretY-1).mid(0,oldCaretX-1);
|
||||
// and the first nonblank char is this new {
|
||||
if (left.trimmed().isEmpty()) {
|
||||
int indentSpaces = calcIndentSpaces(oldCaretY,AChar, true);
|
||||
int indentSpaces = calcIndentSpaces(oldCaretY,ch, true);
|
||||
if (indentSpaces != leftSpaces(left)) {
|
||||
QString right = mDocument->getLine(oldCaretY-1).mid(oldCaretX-1);
|
||||
QString newLeft = GetLeftSpacing(indentSpaces,true);
|
||||
|
@ -6674,7 +6697,6 @@ void QSynEdit::clearSelection()
|
|||
|
||||
void QSynEdit::setBlockEnd(BufferCoord value)
|
||||
{
|
||||
//setActiveSelectionMode(mSelectionMode);
|
||||
value.line = minMax(value.line, 1, mDocument->count());
|
||||
if (mActiveSelectionMode == SelectionMode::Normal) {
|
||||
if (value.line >= 1 && value.line <= mDocument->count())
|
||||
|
@ -6782,7 +6804,6 @@ void QSynEdit::setBlockBegin(BufferCoord value)
|
|||
{
|
||||
int nInval1, nInval2;
|
||||
bool SelChanged;
|
||||
//setActiveSelectionMode(mSelectionMode);
|
||||
value.line = minMax(value.line, 1, mDocument->count());
|
||||
if (mActiveSelectionMode == SelectionMode::Normal) {
|
||||
if (value.line >= 1 && value.line <= mDocument->count())
|
||||
|
|
|
@ -600,7 +600,7 @@ private:
|
|||
void doShiftTabKey();
|
||||
void doBlockIndent();
|
||||
void doBlockUnindent();
|
||||
void doAddChar(QChar AChar);
|
||||
void doAddChar(const QChar& ch);
|
||||
void doCutToClipboard();
|
||||
void doCopyToClipboard();
|
||||
void internalDoCopyToClipboard(const QString& s);
|
||||
|
|
Loading…
Reference in New Issue