[Scummvm-git-logs] scummvm master -> 1acc434bf570ad4cb4c31617cfe8de971631af8b
sev-
noreply at scummvm.org
Sun Feb 11 15:35:56 UTC 2024
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
2f552e423c GUI: Add feature to copy text from console
cc214d0f4d GUI: Implement auto scrolling when drag-selecting text
1acc434bf5 GUI: Improve algorithm of drag-selection process in gui/console.cpp
Commit: 2f552e423cc5a6032128ea6a8e340076adf46e02
https://github.com/scummvm/scummvm/commit/2f552e423cc5a6032128ea6a8e340076adf46e02
Author: Darkhood148 (ujjwal.sharma9999999 at gmail.com)
Date: 2024-02-11T16:35:52+01:00
Commit Message:
GUI: Add feature to copy text from console
Changed paths:
gui/ThemeEngine.cpp
gui/ThemeEngine.h
gui/console.cpp
gui/console.h
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 0a836a9006e..4000e906c10 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1455,7 +1455,7 @@ void ThemeEngine::drawText(const Common::Rect &r, const Common::U32String &str,
drawDDText(textId, colorId, r, str, restore, useEllipsis, align, kTextAlignVCenter, deltax, drawableTextArea);
}
-void ThemeEngine::drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, FontColor color) {
+void ThemeEngine::drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, FontColor color, bool highlight) {
if (!ready())
return;
@@ -1467,6 +1467,8 @@ void ThemeEngine::drawChar(const Common::Rect &r, byte ch, const Graphics::Font
// TODO: Handle clipping when drawing chars
restoreBackground(charArea);
+ if (highlight)
+ _screen.fillRect(r, _screen.format.RGBToColor(0, 255, 0));
font->drawChar(&_screen, ch, charArea.left, charArea.top, rgbColor);
addDirtyRect(charArea);
}
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 54c081fe1b4..3fc09cd397b 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -500,7 +500,7 @@ public:
FontStyle font = kFontStyleBold, FontColor color = kFontColorNormal, bool restore = true,
const Common::Rect &drawableTextArea = Common::Rect(0, 0, 0, 0));
- void drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, FontColor color = kFontColorNormal);
+ void drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, FontColor color = kFontColorNormal, bool highlight = false);
void drawFoldIndicator(const Common::Rect &r, bool expanded);
diff --git a/gui/console.cpp b/gui/console.cpp
index b9f61018d95..e4403ba675c 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -122,6 +122,11 @@ void ConsoleDialog::init() {
_linesPerPage = (_h - 2 - _topPadding - _bottomPadding) / kConsoleLineHeight;
_linesInBuffer = kBufferSize / kCharsPerLine;
+ _isDragging = false;
+
+ _selBegin = -1;
+ _selEnd = -1;
+
resetPrompt();
}
@@ -214,9 +219,13 @@ void ConsoleDialog::drawLine(int line) {
int l = (start + line) % _linesInBuffer;
byte c = buffer(l * kCharsPerLine + column);
#else
- byte c = buffer((start + line) * kCharsPerLine + column);
+ int idx = (start + line) * kCharsPerLine + column;
+ byte c = buffer(idx);
#endif
- g_gui.theme()->drawChar(Common::Rect(x, y, x+kConsoleCharWidth, y+kConsoleLineHeight), c, _font);
+ if (idx >= MIN(_selBegin, _selEnd) && idx < MAX(_selBegin, _selEnd))
+ g_gui.theme()->drawChar(Common::Rect(x, y, x + kConsoleCharWidth, y + kConsoleLineHeight), c, _font, ThemeEngine::kFontColorNormal, true);
+ else
+ g_gui.theme()->drawChar(Common::Rect(x, y, x + kConsoleCharWidth, y + kConsoleLineHeight), c, _font);
x += kConsoleCharWidth;
}
}
@@ -537,23 +546,44 @@ void ConsoleDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
void ConsoleDialog::handleOtherEvent(const Common::Event &evt) {
if (evt.type == Common::EVENT_CUSTOM_ENGINE_ACTION_START) {
switch (evt.customType) {
- case kActionCopy:
- {
- Common::String userInput = getUserInput();
- if (!userInput.empty())
- g_system->setTextInClipboard(userInput);
- }
- break;
- case kActionPaste:
- if (g_system->hasTextInClipboard()) {
- Common::U32String text = g_system->getTextFromClipboard();
- insertIntoPrompt(text.encode().c_str());
- scrollToCurrent();
- drawLine(pos2line(_currentPos));
+ case kActionCopy: {
+ if (_selBegin == -1 && _selEnd == -1) {
+ Common::String userInput = getUserInput();
+ if (!userInput.empty())
+ g_system->setTextInClipboard(userInput);
+ } else {
+ Common::String str = "";
+ Common::String whitespaces = ""; // for dealing with trailing whitespaces
+ for (int i = MIN(_selBegin, _selEnd); i < MAX(_selBegin, _selEnd); i++) {
+ if (i % kCharsPerLine != kCharsPerLine - 1) {
+ if (buffer(i) == ' ') {
+ whitespaces += buffer(i);
+ } else {
+ str += whitespaces;
+ str += buffer(i);
+ whitespaces = "";
+ }
+ } else {
+ whitespaces = "";
+ str += "\n";
+ }
}
- break;
- default:
- break;
+ g_system->setTextInClipboard(str);
+ _selBegin = -1;
+ _selEnd = -1;
+ drawDialog(kDrawLayerForeground);
+ }
+ } break;
+ case kActionPaste:
+ if (g_system->hasTextInClipboard()) {
+ Common::U32String text = g_system->getTextFromClipboard();
+ insertIntoPrompt(text.encode().c_str());
+ scrollToCurrent();
+ drawLine(pos2line(_currentPos));
+ }
+ break;
+ default:
+ break;
}
}
}
@@ -846,4 +876,57 @@ void ConsoleDialog::scrollToCurrent() {
}
}
+void ConsoleDialog::handleMouseDown(int x, int y, int button, int clickCount) {
+ Widget *w;
+
+ w = findWidget(x, y);
+
+ if (w) {
+ if (!(w->getFlags() & WIDGET_IGNORE_DRAG))
+ _dragWidget = w;
+
+ if (w != _focusedWidget && w->wantsFocus()) {
+ setFocusWidget(w);
+ }
+
+ w->handleMouseDown(x - (w->getAbsX() - _x), y - (w->getAbsY() - _y), button, clickCount);
+ } else if (_selBegin == -1 && _selEnd == -1) {
+ int check = (y - _topPadding) / (kConsoleLineHeight / 2);
+ if (check % 2) {
+ int lineNumber = (check - 1) / 2;
+ int ind = (x - _leftPadding) / kConsoleCharWidth;
+ _selBegin = (_scrollLine - _linesPerPage + 1 + lineNumber) * kCharsPerLine + ind;
+ _selEnd = _selBegin;
+ _isDragging = true;
+ }
+ } else {
+ _selBegin = -1;
+ _selEnd = -1;
+ drawDialog(kDrawLayerForeground);
+ }
+}
+
+void ConsoleDialog::handleMouseMoved(int x, int y, int button) {
+ if (!_isDragging)
+ Dialog::handleMouseMoved(x, y, button);
+ else {
+ int check = (y - _topPadding) / (kConsoleLineHeight / 2);
+ if (check % 2) {
+ int lineNumber = (check - 1) / 2;
+ int col = (x - _leftPadding) / kConsoleCharWidth;
+ _selEnd = (_scrollLine - _linesPerPage + 1 + lineNumber) * kCharsPerLine + col;
+ drawDialog(kDrawLayerForeground);
+ }
+ }
+}
+
+void ConsoleDialog::handleMouseUp(int x, int y, int button, int clickCount) {
+ Dialog::handleMouseUp(x, y, button, clickCount);
+ _isDragging = false;
+ if (_selBegin == _selEnd) {
+ _selBegin = -1;
+ _selEnd = -1;
+ }
+}
+
} // End of namespace GUI
diff --git a/gui/console.h b/gui/console.h
index e94a1a8a47b..6b38d8f9ab4 100644
--- a/gui/console.h
+++ b/gui/console.h
@@ -131,6 +131,11 @@ protected:
Common::String _prompt;
+ bool _isDragging;
+
+ int _selBegin;
+ int _selEnd;
+
public:
ConsoleDialog(float widthPercent, float heightPercent);
virtual ~ConsoleDialog();
@@ -145,6 +150,9 @@ public:
void handleKeyDown(Common::KeyState state) override;
void handleCommand(CommandSender *sender, uint32 cmd, uint32 data) override;
void handleOtherEvent(const Common::Event &evt) override;
+ void handleMouseDown(int x, int y, int button, int clickCount) override;
+ void handleMouseMoved(int x, int y, int button) override;
+ void handleMouseUp(int x, int y, int button, int clickCount) override;
int printFormat(int dummy, MSVC_PRINTF const char *format, ...) GCC_PRINTF(3, 4);
int vprintFormat(int dummy, const char *format, va_list argptr);
Commit: cc214d0f4d11bdf707f8f928274813662de98854
https://github.com/scummvm/scummvm/commit/cc214d0f4d11bdf707f8f928274813662de98854
Author: Darkhood148 (ujjwal.sharma9999999 at gmail.com)
Date: 2024-02-11T16:35:52+01:00
Commit Message:
GUI: Implement auto scrolling when drag-selecting text
Changed paths:
gui/ThemeEngine.cpp
gui/ThemeEngine.h
gui/console.cpp
gui/console.h
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 4000e906c10..5d00c2d9944 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1455,7 +1455,7 @@ void ThemeEngine::drawText(const Common::Rect &r, const Common::U32String &str,
drawDDText(textId, colorId, r, str, restore, useEllipsis, align, kTextAlignVCenter, deltax, drawableTextArea);
}
-void ThemeEngine::drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, FontColor color, bool highlight) {
+void ThemeEngine::drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, FontColor color, TextInversionState inverted) {
if (!ready())
return;
@@ -1467,8 +1467,18 @@ void ThemeEngine::drawChar(const Common::Rect &r, byte ch, const Graphics::Font
// TODO: Handle clipping when drawing chars
restoreBackground(charArea);
- if (highlight)
- _screen.fillRect(r, _screen.format.RGBToColor(0, 255, 0));
+ switch (inverted) {
+ case kTextInversion:
+ drawDD(kDDTextSelectionBackground, r);
+ break;
+
+ case kTextInversionFocus:
+ drawDD(kDDTextSelectionFocusBackground, r);
+ break;
+
+ default:
+ break;
+ }
font->drawChar(&_screen, ch, charArea.left, charArea.top, rgbColor);
addDirtyRect(charArea);
}
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 3fc09cd397b..436699db2b3 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -500,7 +500,7 @@ public:
FontStyle font = kFontStyleBold, FontColor color = kFontColorNormal, bool restore = true,
const Common::Rect &drawableTextArea = Common::Rect(0, 0, 0, 0));
- void drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, FontColor color = kFontColorNormal, bool highlight = false);
+ void drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, FontColor color = kFontColorNormal, TextInversionState inverted = ThemeEngine::kTextInversionNone);
void drawFoldIndicator(const Common::Rect &r, bool expanded);
diff --git a/gui/console.cpp b/gui/console.cpp
index e4403ba675c..790484a9b10 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -71,6 +71,7 @@ ConsoleDialog::ConsoleDialog(float widthPercent, float heightPercent)
_caretVisible = false;
_caretTime = 0;
+ _selectionTime = 0;
_slideMode = kNoSlideMode;
_slideTime = 0;
@@ -223,7 +224,7 @@ void ConsoleDialog::drawLine(int line) {
byte c = buffer(idx);
#endif
if (idx >= MIN(_selBegin, _selEnd) && idx < MAX(_selBegin, _selEnd))
- g_gui.theme()->drawChar(Common::Rect(x, y, x + kConsoleCharWidth, y + kConsoleLineHeight), c, _font, ThemeEngine::kFontColorNormal, true);
+ g_gui.theme()->drawChar(Common::Rect(x, y, x + kConsoleCharWidth, y + kConsoleLineHeight), c, _font, ThemeEngine::kFontColorNormal, ThemeEngine::kTextInversionFocus);
else
g_gui.theme()->drawChar(Common::Rect(x, y, x + kConsoleCharWidth, y + kConsoleLineHeight), c, _font);
x += kConsoleCharWidth;
@@ -248,7 +249,17 @@ void ConsoleDialog::handleTickle() {
_caretTime = time + kCaretBlinkTime;
drawCaret(_caretVisible);
}
-
+ if (_selectionTime < time) {
+ _selectionTime += kDraggingTime;
+ if (_isScrollingDown) {
+ _scrollBar->handleMouseWheel(0, 0, 1);
+ _selEnd += kCharsPerLine;
+ }
+ if (_isScrollingUp) {
+ _scrollBar->handleMouseWheel(0, 0, -1);
+ _selEnd -= kCharsPerLine;
+ }
+ }
// Perform the "slide animation".
if (_slideMode != kNoSlideMode) {
const float tmp = (float)(g_system->getMillis() - _slideTime) / kConsoleSlideDownDuration;
@@ -509,6 +520,10 @@ void ConsoleDialog::defaultKeyDownHandler(Common::KeyState &state) {
if (state.hasFlags(Common::KBD_CTRL)) {
specialKeys(state.keycode);
} else if ((state.ascii >= 32 && state.ascii <= 127) || (state.ascii >= 160 && state.ascii <= 255)) {
+ _selBegin = -1;
+ _selEnd = -1;
+ drawDialog(kDrawLayerForeground);
+
for (int i = _promptEndPos - 1; i >= _currentPos; i--)
buffer(i + 1) = buffer(i);
_promptEndPos++;
@@ -552,26 +567,23 @@ void ConsoleDialog::handleOtherEvent(const Common::Event &evt) {
if (!userInput.empty())
g_system->setTextInClipboard(userInput);
} else {
- Common::String str = "";
- Common::String whitespaces = ""; // for dealing with trailing whitespaces
+ Common::String str;
+ Common::String whitespaces; // for dealing with trailing whitespaces
for (int i = MIN(_selBegin, _selEnd); i < MAX(_selBegin, _selEnd); i++) {
if (i % kCharsPerLine != kCharsPerLine - 1) {
if (buffer(i) == ' ') {
- whitespaces += buffer(i);
+ whitespaces += buffer(i); //to deal with trailing whitespaces
} else {
str += whitespaces;
str += buffer(i);
- whitespaces = "";
+ whitespaces.clear();
}
} else {
- whitespaces = "";
+ whitespaces.clear();
str += "\n";
}
}
g_system->setTextInClipboard(str);
- _selBegin = -1;
- _selEnd = -1;
- drawDialog(kDrawLayerForeground);
}
} break;
case kActionPaste:
@@ -580,6 +592,10 @@ void ConsoleDialog::handleOtherEvent(const Common::Event &evt) {
insertIntoPrompt(text.encode().c_str());
scrollToCurrent();
drawLine(pos2line(_currentPos));
+
+ _selBegin = -1;
+ _selEnd = -1;
+ drawDialog(kDrawLayerForeground);
}
break;
default:
@@ -891,14 +907,11 @@ void ConsoleDialog::handleMouseDown(int x, int y, int button, int clickCount) {
w->handleMouseDown(x - (w->getAbsX() - _x), y - (w->getAbsY() - _y), button, clickCount);
} else if (_selBegin == -1 && _selEnd == -1) {
- int check = (y - _topPadding) / (kConsoleLineHeight / 2);
- if (check % 2) {
- int lineNumber = (check - 1) / 2;
- int ind = (x - _leftPadding) / kConsoleCharWidth;
- _selBegin = (_scrollLine - _linesPerPage + 1 + lineNumber) * kCharsPerLine + ind;
- _selEnd = _selBegin;
- _isDragging = true;
- }
+ int lineNumber = (y - _topPadding) / kConsoleLineHeight;
+ int ind = (x - _leftPadding) / kConsoleCharWidth;
+ _selBegin = (_scrollLine - _linesPerPage + 1 + lineNumber) * kCharsPerLine + ind;
+ _selEnd = _selBegin;
+ _isDragging = true;
} else {
_selBegin = -1;
_selEnd = -1;
@@ -910,14 +923,20 @@ void ConsoleDialog::handleMouseMoved(int x, int y, int button) {
if (!_isDragging)
Dialog::handleMouseMoved(x, y, button);
else {
- int check = (y - _topPadding) / (kConsoleLineHeight / 2);
- if (check % 2) {
- int lineNumber = (check - 1) / 2;
- int col = (x - _leftPadding) / kConsoleCharWidth;
- _selEnd = (_scrollLine - _linesPerPage + 1 + lineNumber) * kCharsPerLine + col;
- drawDialog(kDrawLayerForeground);
- }
+ int lineNumber = (y - _topPadding) / kConsoleLineHeight;
+ int col = (x - _leftPadding) / kConsoleCharWidth;
+ _selEnd = (_scrollLine - _linesPerPage + 1 + lineNumber) * kCharsPerLine + col;
+ if ((y - _topPadding) / (kConsoleLineHeight / 2) > 2 * _linesPerPage - 1)
+ _isScrollingDown = true;
+ else
+ _isScrollingDown = false;
+ if ((y - _topPadding) / (kConsoleLineHeight / 2) < 1)
+ _isScrollingUp = true;
+ else
+ _isScrollingUp = false;
+ drawDialog(kDrawLayerForeground);
}
+ drawDialog(kDrawLayerForeground);
}
void ConsoleDialog::handleMouseUp(int x, int y, int button, int clickCount) {
@@ -927,6 +946,8 @@ void ConsoleDialog::handleMouseUp(int x, int y, int button, int clickCount) {
_selBegin = -1;
_selEnd = -1;
}
+ _isScrollingUp = false;
+ _isScrollingDown = false;
}
} // End of namespace GUI
diff --git a/gui/console.h b/gui/console.h
index 6b38d8f9ab4..7dc7f93b974 100644
--- a/gui/console.h
+++ b/gui/console.h
@@ -71,7 +71,8 @@ protected:
kCharsPerLine = 128,
kBufferSize = kCharsPerLine * 1024,
- kHistorySize = 20
+ kHistorySize = 20,
+ kDraggingTime = 200
};
const Graphics::Font *_font;
@@ -91,6 +92,7 @@ protected:
bool _caretVisible;
uint32 _caretTime;
+ uint32 _selectionTime;
enum SlideMode {
kNoSlideMode,
@@ -136,6 +138,9 @@ protected:
int _selBegin;
int _selEnd;
+ bool _isScrollingUp;
+ bool _isScrollingDown;
+
public:
ConsoleDialog(float widthPercent, float heightPercent);
virtual ~ConsoleDialog();
Commit: 1acc434bf570ad4cb4c31617cfe8de971631af8b
https://github.com/scummvm/scummvm/commit/1acc434bf570ad4cb4c31617cfe8de971631af8b
Author: Darkhood148 (ujjwal.sharma9999999 at gmail.com)
Date: 2024-02-11T16:35:52+01:00
Commit Message:
GUI: Improve algorithm of drag-selection process in gui/console.cpp
Redrawing only the affected lines instead of the whole dialog box
Changed paths:
gui/console.cpp
gui/console.h
diff --git a/gui/console.cpp b/gui/console.cpp
index 790484a9b10..fa8b592c371 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -128,6 +128,8 @@ void ConsoleDialog::init() {
_selBegin = -1;
_selEnd = -1;
+ _scrollDirection = 0;
+
resetPrompt();
}
@@ -251,13 +253,9 @@ void ConsoleDialog::handleTickle() {
}
if (_selectionTime < time) {
_selectionTime += kDraggingTime;
- if (_isScrollingDown) {
- _scrollBar->handleMouseWheel(0, 0, 1);
- _selEnd += kCharsPerLine;
- }
- if (_isScrollingUp) {
- _scrollBar->handleMouseWheel(0, 0, -1);
- _selEnd -= kCharsPerLine;
+ if (_isDragging && _scrollDirection != 0) {
+ _scrollBar->handleMouseWheel(0, 0, -_scrollDirection);
+ _selEnd -= kCharsPerLine * _scrollDirection;
}
}
// Perform the "slide animation".
@@ -562,7 +560,7 @@ void ConsoleDialog::handleOtherEvent(const Common::Event &evt) {
if (evt.type == Common::EVENT_CUSTOM_ENGINE_ACTION_START) {
switch (evt.customType) {
case kActionCopy: {
- if (_selBegin == -1 && _selEnd == -1) {
+ if (_selBegin == -1 || _selEnd == -1) {
Common::String userInput = getUserInput();
if (!userInput.empty())
g_system->setTextInClipboard(userInput);
@@ -572,7 +570,7 @@ void ConsoleDialog::handleOtherEvent(const Common::Event &evt) {
for (int i = MIN(_selBegin, _selEnd); i < MAX(_selBegin, _selEnd); i++) {
if (i % kCharsPerLine != kCharsPerLine - 1) {
if (buffer(i) == ' ') {
- whitespaces += buffer(i); //to deal with trailing whitespaces
+ whitespaces += buffer(i); // to deal with trailing whitespaces
} else {
str += whitespaces;
str += buffer(i);
@@ -906,7 +904,10 @@ void ConsoleDialog::handleMouseDown(int x, int y, int button, int clickCount) {
}
w->handleMouseDown(x - (w->getAbsX() - _x), y - (w->getAbsY() - _y), button, clickCount);
- } else if (_selBegin == -1 && _selEnd == -1) {
+ } else if (_selBegin == -1 || _selEnd == -1) {
+ if (y > _h)
+ return;
+
int lineNumber = (y - _topPadding) / kConsoleLineHeight;
int ind = (x - _leftPadding) / kConsoleCharWidth;
_selBegin = (_scrollLine - _linesPerPage + 1 + lineNumber) * kCharsPerLine + ind;
@@ -923,20 +924,25 @@ void ConsoleDialog::handleMouseMoved(int x, int y, int button) {
if (!_isDragging)
Dialog::handleMouseMoved(x, y, button);
else {
+ int selEndPreviousMove = _selEnd;
int lineNumber = (y - _topPadding) / kConsoleLineHeight;
+ lineNumber = MIN(lineNumber, _linesPerPage - 1);
int col = (x - _leftPadding) / kConsoleCharWidth;
_selEnd = (_scrollLine - _linesPerPage + 1 + lineNumber) * kCharsPerLine + col;
- if ((y - _topPadding) / (kConsoleLineHeight / 2) > 2 * _linesPerPage - 1)
- _isScrollingDown = true;
- else
- _isScrollingDown = false;
- if ((y - _topPadding) / (kConsoleLineHeight / 2) < 1)
- _isScrollingUp = true;
+
+ if (_selEnd == selEndPreviousMove)
+ return;
+
+ if (lineNumber > _linesPerPage - 2)
+ _scrollDirection = -1;
+ else if (lineNumber < 1)
+ _scrollDirection = 1;
else
- _isScrollingUp = false;
- drawDialog(kDrawLayerForeground);
+ _scrollDirection = 0;
+
+ for (int i = MIN(_selEnd / kCharsPerLine, selEndPreviousMove / kCharsPerLine); i <= MAX(_selEnd / kCharsPerLine, selEndPreviousMove / kCharsPerLine); i++)
+ drawLine(i - _scrollBar->_currentPos / _scrollBar->_singleStep);
}
- drawDialog(kDrawLayerForeground);
}
void ConsoleDialog::handleMouseUp(int x, int y, int button, int clickCount) {
@@ -946,8 +952,7 @@ void ConsoleDialog::handleMouseUp(int x, int y, int button, int clickCount) {
_selBegin = -1;
_selEnd = -1;
}
- _isScrollingUp = false;
- _isScrollingDown = false;
+ _scrollDirection = 0;
}
} // End of namespace GUI
diff --git a/gui/console.h b/gui/console.h
index 7dc7f93b974..6b1a38ad541 100644
--- a/gui/console.h
+++ b/gui/console.h
@@ -72,7 +72,7 @@ protected:
kBufferSize = kCharsPerLine * 1024,
kHistorySize = 20,
- kDraggingTime = 200
+ kDraggingTime = 10
};
const Graphics::Font *_font;
@@ -138,8 +138,7 @@ protected:
int _selBegin;
int _selEnd;
- bool _isScrollingUp;
- bool _isScrollingDown;
+ int _scrollDirection;
public:
ConsoleDialog(float widthPercent, float heightPercent);
More information about the Scummvm-git-logs
mailing list