Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Develop

See merge request devel/studio!283
  • Loading branch information
rgoltermann committed May 3, 2019
2 parents b43f704 + 25509d1 commit 3e849bb
Show file tree
Hide file tree
Showing 22 changed files with 878 additions and 424 deletions.
16 changes: 5 additions & 11 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
Version 0.11.1
Version 0.11.2
========================

## General
- improved picking of default editor font on macOS and Linux
- forced light application theme on macOS
- fixed possible crash related to About GAMS dialog
- performance improvements when writing log to disk

## Editor
- performance improvements for syntax highlighting
- fixed search in files with non-default codec
- several minor bugfixes related to the search
# General
- **added Drag and Drop in GDX Table View**
- fixed performance issue with very long lines (see #1008)
- fixed shortcut ctrl+shift+home not working as expected (see #1009)
15 changes: 12 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Contributing to GAMS Studio
# How to submit your own improvements

We highly appreciate contributions to the GAMS Studio project! To submit your improvements please use GitHub to collaborate.
Your contributions to the GAMS Studio project are highly appreciated! Depending on
your type of improvement you may want to [create an issue](https://help.github.com/en/articles/creating-an-issue)
or [fork GAMS Studio](https://guides.github.com/activities/forking/), to make a pull
request when your changes are ready.

t.b.d.
## Requirements

To get started with the development you need a system which provides the following.

* A C++14-standard-compliant compiler
* [Qt](https://www.qt.io/) 5.12.x LTS
* The latest [GAMS](https://www.gams.com/download/) release
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ GAMS Studio is the official development environment of the General Algebraic Mod

GAMS Studio uses [Qt](https://www.qt.io/) which is licensed under [LGPL](https://www.gnu.org/licenses/lgpl-3.0.en.html).

# Contribute

Contributions to the GAMS Studio project are highly appreciated! For futher information please check our [CONTRIBUTING.md](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md).

# How to build

## 1. Download and install Qt ##

The recommended way to get Qt is via its official [Qt online installer](https://www.qt.io/). If you are interested in the Qt sources you can download them through the installer and build Qt from scratch by following the [Qt documentation](https://doc.qt.io/qt-5/build-sources.html). Alternatively, you can get and build Qt from the official [Qt GitHub mirror](https://github.com/qt/qt5). Please note the the current version of GAMS Studio requires Qt 5.10.0 or later.
The recommended way to get Qt is via its official [Qt online installer](https://www.qt.io/).
If you are interested in the Qt sources you can download them through the
installer or build Qt from scratch by following the [Qt documentation](https://doc.qt.io/qt-5/build-sources.html).
Alternatively, you can get and build Qt from the official [Qt GitHub mirror](https://github.com/qt/qt5).
Please check the [CONTRIBUTING.md](CONTRIBUTING.md) for the GAMS Studio C++ and Qt requirements.

## 2. Download and install GAMS ##

Expand Down
4 changes: 2 additions & 2 deletions jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ pipeline {
cd "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\VC\\Auxiliary\\Build"
call vcvars32.bat
cd %WORKSPACE%\\tmp\\studio
signtool sign /v /f %WIN_CERT_FILE% /p %WIN_CERT_PASSWD% /tr http://timestamp.comodoca.com/rfc3161 studio.exe
signtool sign /v /f %WIN_CERT_FILE% /p %WIN_CERT_PASSWD% /tr http://timestamp.comodoca.com studio.exe
'''
}
script {
Expand All @@ -227,7 +227,7 @@ pipeline {
cd "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build"
call vcvars64.bat
cd %WORKSPACE%\\tmp\\studio
signtool sign /v /f %WIN_CERT_FILE% /p %WIN_CERT_PASSWD% /tr http://timestamp.comodoca.com/rfc3161 studio.exe
signtool sign /v /f %WIN_CERT_FILE% /p %WIN_CERT_PASSWD% /tr http://timestamp.comodoca.com studio.exe
'''
}
script {
Expand Down
12 changes: 6 additions & 6 deletions src/editors/abstractedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ void AbstractEdit::extraSelMarks(QList<QTextEdit::ExtraSelection> &selections)
QTextEdit::ExtraSelection selection;
selection.cursor = textCursor();
if (m->blockStart() < 0) continue;
int start = m->size() < 0 ? ( m->blockStart() < m->size() ? 0 : m->blockEnd() )
: m->blockStart();
int siz = m->size() ? (m->size() < 0 ? block.length() : m->size()+1) : m->size();
int start = m->blockStart();
int end = m->size() ? (m->size() < 0 ? block.length() : m->blockEnd()+1) : 0;
selection.cursor.setPosition(block.position() + start);
selection.cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, siz);
selection.cursor.setPosition(block.position() + end, QTextCursor::KeepAnchor);
if (m->type() == TextMark::error || m->refType() == TextMark::error) {
if (m->refType() == TextMark::error)
selection.format.setForeground(m->color());
selection.format.setUnderlineColor(Qt::red);
if (m->size() == 1) selection.format.setBackground(QColor(255,220,200));
selection.format.setUnderlineStyle(QTextCharFormat::WaveUnderline);
selection.format.setAnchorName(QString::number(m->line()));
} else if (m->type() == TextMark::link) {
Expand Down Expand Up @@ -189,7 +189,7 @@ void AbstractEdit::showToolTip(const QList<TextMark*> marks)
if (marks.size() > 0) {
QTextCursor cursor(document()->findBlockByNumber(marks.first()->line()));
//(marks.first()->textCursor());
cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, marks.first()->column());
cursor.setPosition(cursor.position() + marks.first()->column(), QTextCursor::MoveAnchor);
QPoint pos = cursorRect(cursor).bottomLeft();
if (pos.x() < 10) pos.setX(10);
QStringList tips;
Expand Down Expand Up @@ -339,7 +339,7 @@ void AbstractEdit::jumpTo(int line, int column)
if (document()->blockCount()-1 < line) return;
cursor = QTextCursor(document()->findBlockByNumber(line));
cursor.clearSelection();
cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, column);
cursor.setPosition(cursor.position() + column);
jumpTo(cursor);
}

Expand Down
27 changes: 15 additions & 12 deletions src/editors/codeedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ void CodeEdit::keyPressEvent(QKeyEvent* e)
setTextCursor(cur);
e->accept();
return;
} else if (e->key() == Qt::Key_Home && (!e->modifiers() || e->modifiers() & Qt::ShiftModifier)) {
} else if (e->key() == Qt::Key_Home && (!e->modifiers() || e->modifiers() & Qt::ShiftModifier || e->modifiers() & Qt::ControlModifier)) {
QTextCursor tc = textCursor();
QTextBlock block = tc.block();
QTextCursor::MoveMode moveMode = QTextCursor::MoveAnchor;
Expand All @@ -357,10 +357,13 @@ void CodeEdit::keyPressEvent(QKeyEvent* e)
QRegularExpression leadingSpaces("^(\\s*)");
QRegularExpressionMatch lsMatch = leadingSpaces.match(block.text());

if (lsMatch.capturedLength(1) < tc.positionInBlock())
tc.setPosition(block.position() + lsMatch.capturedLength(1), moveMode);
else
tc.setPosition(block.position(), moveMode);
if (e->modifiers() & Qt::ControlModifier) {
tc.setPosition(0, moveMode);
} else {
if (lsMatch.capturedLength(1) < tc.positionInBlock())
tc.setPosition(block.position() + lsMatch.capturedLength(1), moveMode);
else tc.setPosition(block.position(), moveMode);
}

setTextCursor(tc);
e->accept();
Expand Down Expand Up @@ -530,7 +533,7 @@ void CodeEdit::adjustIndent(QTextCursor cursor)
if (pMatch.capturedLength(2) < 1)
break;
QString spaces = pMatch.captured(2);
cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, match.capturedLength(1));
cursor.setPosition(cursor.position() + match.capturedLength(1), QTextCursor::KeepAnchor);
cursor.removeSelectedText();
cursor.insertText(spaces);
setTextCursor(cursor);
Expand All @@ -552,7 +555,7 @@ void CodeEdit::truncate(QTextBlock block)
if (match.hasMatch()) {
QTextCursor cursor(block);
cursor.movePosition(QTextCursor::EndOfBlock);
cursor.movePosition(QTextCursor::Left, QTextCursor::KeepAnchor, match.capturedLength(2));
cursor.setPosition(cursor.position() - match.capturedLength(2), QTextCursor::KeepAnchor);
cursor.removeSelectedText();
}
}
Expand Down Expand Up @@ -914,14 +917,14 @@ int CodeEdit::indent(int size, int fromLine, int toLine)
editCursor.setPosition(block.position());
if (size < 0) {
if (insertPos - charCount < block.length()) {
editCursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, insertPos - charCount);
editCursor.setPosition(block.position() + insertPos - charCount);
int tempCount = qMin(charCount, block.length() - (insertPos - charCount));
editCursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, tempCount);
editCursor.setPosition(editCursor.position() + tempCount, QTextCursor::KeepAnchor);
editCursor.removeSelectedText();
}
} else {
if (insertPos < block.length()) {
editCursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, insertPos);
editCursor.setPosition(block.position() + insertPos);
editCursor.insertText(insText);
}
}
Expand Down Expand Up @@ -1348,7 +1351,7 @@ void CodeEdit::extraSelMatches(QList<QTextEdit::ExtraSelection> &selections)
QTextEdit::ExtraSelection selection;
selection.cursor = textCursor();
selection.cursor.setPosition(block.position() + r.colNr());
selection.cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, r.length());
selection.cursor.setPosition(block.position() + r.colNr() + r.length(), QTextCursor::KeepAnchor);
selection.format.setBackground(mSettings->colorScheme().value("Edit.matchesBg", QColor(Qt::green).lighter(160)));
selections << selection;
}
Expand Down Expand Up @@ -1772,7 +1775,7 @@ void CodeEdit::BlockEdit::replaceBlockText(QStringList texts)
int rmSize = block.position()+qMin(block.length()-1, toCol) - pos;
cursor.setPosition(pos);
if (rmSize) {
cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, rmSize);
cursor.setPosition(cursor.position()+rmSize, QTextCursor::KeepAnchor);
cursor.removeSelectedText();
}
} else {
Expand Down
18 changes: 7 additions & 11 deletions src/file/filemeta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,9 @@ void FileMeta::setEditPositions(QVector<QPoint> edPositions)
AbstractEdit* edit = ViewHelper::toAbstractEdit(widget);
if (edit) {
QPoint pos = (i < edPositions.size()) ? edPositions.at(i) : QPoint(0, 0);
QTextCursor cursor(document());
if (cursor.blockNumber() < pos.y())
cursor.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor, qMin(edit->blockCount()-1, pos.y()));
QTextCursor cursor(document()->findBlockByNumber(qMin(pos.y(), document()->blockCount()-1)));
if (cursor.positionInBlock() < pos.x())
cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, qMin(cursor.block().length()-1, pos.x()));
cursor.setPosition(cursor.position() + qMin(cursor.block().length()-1, pos.x()));
edit->setTextCursor(cursor);
}
i++;
Expand Down Expand Up @@ -253,17 +251,15 @@ void FileMeta::contentsChange(int from, int charsRemoved, int charsAdded)
cursor.setPosition(from);
int column = cursor.positionInBlock();
int fromLine = cursor.blockNumber();
bool atEnd = (cursor.block().length() == column+1);
cursor.setPosition(from+charsAdded);
int toLine = cursor.blockNumber();
int removedLines = mLineCount-mDocument->lineCount() + toLine-fromLine;
mChangedLine = toLine;
if (charsAdded) --mChangedLine;
if (!column) --mChangedLine;
mChangedLine = fromLine;
// if (charsAdded) --mChangedLine;
// if (!column) --mChangedLine;
if (removedLines > 0)
mFileRepo->textMarkRepo()->removeMarks(id(), edit->groupId(), QSet<TextMark::Type>()
, fromLine, fromLine+removedLines);
if (atEnd) ++fromLine;
for (int i = fromLine; i <= toLine; ++i) {
QList<TextMark*> marks = mFileRepo->textMarkRepo()->marks(id(), i, edit->groupId());
for (TextMark *mark: marks) {
Expand All @@ -276,7 +272,7 @@ void FileMeta::contentsChange(int from, int charsRemoved, int charsAdded)
void FileMeta::blockCountChanged(int newBlockCount)
{
if (mLineCount != newBlockCount) {
mFileRepo->textMarkRepo()->shiftMarks(id(), mChangedLine+1, newBlockCount-mLineCount);
mFileRepo->textMarkRepo()->shiftMarks(id(), mChangedLine, newBlockCount-mLineCount);
mLineCount = newBlockCount;
}
}
Expand Down Expand Up @@ -525,7 +521,7 @@ void FileMeta::jumpTo(NodeId groupId, bool focus, int line, int column)
if (edit && line < edit->document()->blockCount()) {
QTextBlock block = edit->document()->findBlockByNumber(line);
QTextCursor tc = QTextCursor(block);
tc.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, qMin(column, block.length()-1));
tc.setPosition(block.position()+qMin(column, block.length()-1));
edit->setTextCursor(tc);
// center line vertically
qreal lines = qreal(edit->rect().height()) / edit->cursorRect().height();
Expand Down
3 changes: 2 additions & 1 deletion src/file/projectlognode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,8 @@ QString ProjectLogNode::extractLinks(const QString &line, ProjectFileNode::Extra
result = capture(line, posA, posB, 0, '[').toString();
fName = QDir::fromNativeSeparators(capture(line, posA, posB, 6, '"').toString());
lineNr = capture(line, posA, posB, 2, ',').toInt()-1;
size = capture(line, posA, posB, 1, ']').toInt()-1;
colStart = capture(line, posA, posB, 1, ']').toInt()-1;
size = 1;
posB++;
if (mRepaintCount < 0) mRepaintCount = 0;
}
Expand Down
1 change: 1 addition & 0 deletions src/gdxviewer/columnfilterframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ void ColumnFilterFrame::apply()
mSymbol->setFilterActive(filterActive);
mSymbol->filterRows();
static_cast<QMenu*>(this->parent())->close();
mSymbol->setFilterHasChanged(true);
}

void ColumnFilterFrame::selectAll()
Expand Down
Loading

0 comments on commit 3e849bb

Please sign in to comment.