[Scummvm-git-logs] scummvm master -> 9c9b553d7a62568c50048192793f39796173c1c2
sev-
sev at scummvm.org
Sun Apr 25 00:24:40 UTC 2021
This automated email contains information about 39 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
803cd6d715 GRAPHICS: MACGUI: bring kWMModeNoDesktop flag useful again
a98097e8d2 GRAPHICS: MACGUI: set fgcolor as default color, fix the behaviour for appendText when _str is empty
47f4912083 GRAPHICS: MACGUI: add new flag kWMModeWin95 for macwindowmanager
954b66bd44 PINK: add Win95 mode flag to pink engine
7ef3b88a94 GRAPHICS: MACGUI: save background color for mactextwindow, add new behaviour for win95 mode
ee8d9dea03 GRAPHICS: MACGUI: set fgcolor as default format color when we are in win95 mode
22606080eb PINK: change the order in when we drawing the macwindow and the sprites
70592cfa12 PINK: add intersection check of mactext and dirty rect
0a9ffd5f06 GRAPHICS: MACGUI: remove unnecessary codes
9a139c4797 PINK: clear the area before drawing the actionText
e459e5acf8 GRAPHICS: MACGUI: add win95 mode for menu padding
5d2a73fe01 GRAPHICS: MACGUI: add win95 mode for menu behaviour, currently in win95 mode, it will exit the menu only when you click
1d3cf51b7b GRAPHICS: MACGUI: fix the bug when closing the menu, the highlight part was not correctly set
ba4513c10b GRAPHICS: MACGUI: organize the code
f81ea96421 GRAPHICS: MACGUI: clean the code, modify the behaviour of win95 menu
7c5c66a8c8 PINK: add win95 mode border for pink
855583e2e4 GRAPHICS: MACGUI: add win95 mode for scrollbar
fa4aaa7608 GRAPHICS: MACGUI: modify the offset when drawing the mactext to suit for pink
90b2c02f27 GRAPHICS: MACGUI: init the scrollSize and scrollPos at constructor
b993ab021d GRAPHICS: MACGUI: fix the algorithm when we calc the coordinate of scrollbar, modify the offsets
15d46a55f8 GRAPHICS: MACGUI: add the feature that you can close the window when using the menu
d437b22b6b GRAPHICS: MACGUI: fix the behaviour of scrollbar of win95 mode
a2f48f5343 WAGE: fix the code which may occur bug
27986beebc GRAPHICS: MACGUI: add comment for enableScrollbar
55f61f2c69 PINK: fix the bug when we disable the border, the text may not render correctly.
82a55fd8d8 GRAPHICS: MACGUI: add getTextMaxWidth for mactext
013925a3ad PINK: implement alignment for center manually for action text
fc702ea9fe GRAPHICS: MACGUI: re-organize the code for drawing scrollbar for macwindow
c1c7631148 PINK: set the offsets for new logic of macgui
587772625e WAGE: set the offsets for new logic of macgui
df895359cc PINK: modify the logic when we creating the mactextwindow
c317ca1900 GRAPHICS: MACGUI: load win95scrollbar border as default when enable win95 mode
cd462ba7c7 PINK: delete loading border in pink, it will load in macgui automatically
98cb026f70 GRAPHICS: MACGUI: fix the behaviour when we enable win95 mode when drawing scrollbar
549511c4b5 GRAPHICS: MACGUI: add rgb parameter for appendText, which makes mactext draws text with color, fix the logic when append
fb7ed6f845 GRAPHICS: MACGUI: add textRGB for mactextwindow to suit new logic of mactext when drawing the text with color. add windo
7da28dfc15 PINK: modify action_text to suit for new macgui, move dynamic scrollbar to macgui
ac9e312895 GRAPHICS: MACGUI: remove pink border, add Win95BorderScrollbar to macgui.dat
9c9b553d7a GRAPHICS: MACGUI: fix the logic when calc the coordinate of scrollbar
Commit: 803cd6d715b93abe7e1e2b1926f3cde07bc4d2db
https://github.com/scummvm/scummvm/commit/803cd6d715b93abe7e1e2b1926f3cde07bc4d2db
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: bring kWMModeNoDesktop flag useful again
Changed paths:
graphics/macgui/macwindowmanager.cpp
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 48116b02e6..d6566d0970 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -546,21 +546,22 @@ void MacWindowManager::draw() {
Common::Rect bounds = getScreenBounds();
if (_fullRefresh) {
- Common::Rect screen = getScreenBounds();
- if (_desktop->w != screen.width() || _desktop->h != screen.height()) {
- _desktop->free();
- _desktop->create(screen.width(), screen.height(), _pixelformat);
- drawDesktop();
- }
+ if (!(_mode & kWMModeNoDesktop)) {
+ Common::Rect screen = getScreenBounds();
+ if (_desktop->w != screen.width() || _desktop->h != screen.height()) {
+ _desktop->free();
+ _desktop->create(screen.width(), screen.height(), _pixelformat);
+ drawDesktop();
+ }
- if (_screen) {
- _screen->blitFrom(*_desktop, Common::Point(0, 0));
- g_system->copyRectToScreen(_screen->getPixels(), _screen->pitch, 0, 0, _screen->w, _screen->h);
- } else {
- _screenCopyPauseToken = new PauseToken(pauseEngine());
- g_system->copyRectToScreen(_desktop->getPixels(), _desktop->pitch, 0, 0, _desktop->w, _desktop->h);
+ if (_screen) {
+ _screen->blitFrom(*_desktop, Common::Point(0, 0));
+ g_system->copyRectToScreen(_screen->getPixels(), _screen->pitch, 0, 0, _screen->w, _screen->h);
+ } else {
+ _screenCopyPauseToken = new PauseToken(pauseEngine());
+ g_system->copyRectToScreen(_desktop->getPixels(), _desktop->pitch, 0, 0, _desktop->w, _desktop->h);
+ }
}
-
if (_redrawEngineCallback != nullptr)
_redrawEngineCallback(_engineR);
}
Commit: a98097e8d205594171471b77bf0eb89c429c17ba
https://github.com/scummvm/scummvm/commit/a98097e8d205594171471b77bf0eb89c429c17ba
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: set fgcolor as default color, fix the behaviour for appendText when _str is empty
Changed paths:
graphics/macgui/mactext.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index e03bffd811..9d949bbb97 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -204,6 +204,8 @@ MacText::MacText(const Common::String &s, MacWindowManager *wm, const MacFont *m
if (macFont) {
_defaultFormatting = MacFontRun(_wm, macFont->getId(), macFont->getSlant(), macFont->getSize(), 0, 0, 0);
_defaultFormatting.font = wm->_fontMan->getFont(*macFont);
+ // try to set fgcolor as default color in chunks
+ _defaultFormatting.fgcolor = _fgcolor;
} else {
_defaultFormatting.font = NULL;
}
@@ -864,6 +866,15 @@ void MacText::appendText(const Common::U32String &str, int fontId, int fontSize,
_currentFormatting = fontRun;
+ // we check _str here, if _str is empty but _textLines is not empty, and they are not the end of paragraph
+ // then we remove those empty lines
+ // too many special check may cause some strange problem in the future
+ if (_str.empty()) {
+ while (!_textLines.empty() && !_textLines.back().paragraphEnd) {
+ removeLastLine();
+ }
+ }
+
if (!skipAdd) {
_str += fontRun.toString();
_str += str;
Commit: 47f4912083ed770410537db71fbaa43e7b99fd50
https://github.com/scummvm/scummvm/commit/47f4912083ed770410537db71fbaa43e7b99fd50
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: add new flag kWMModeWin95 for macwindowmanager
Changed paths:
graphics/macgui/macwindowmanager.h
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index d0b2149053..acc23a802d 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -85,7 +85,8 @@ enum {
kWMModeFullscreen = (1 << 6),
kWMModeButtonDialogStyle= (1 << 7),
kWMMode32bpp = (1 << 8),
- kWMNoScummVMWallpaper = (1 << 9)
+ kWMNoScummVMWallpaper = (1 << 9),
+ kWMModeWin95 = (1 << 10)
};
}
Commit: 954b66bd44cf9207437acf86d72ff025528fd978
https://github.com/scummvm/scummvm/commit/954b66bd44cf9207437acf86d72ff025528fd978
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
PINK: add Win95 mode flag to pink engine
Changed paths:
engines/pink/director.cpp
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index a018cd2a56..5f581df823 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -92,7 +92,7 @@ Director::Director()
: _surface(640, 480), _textRendered(false) {
_wm = new Graphics::MacWindowManager(Graphics::kWMModeNoDesktop | Graphics::kWMModeAutohideMenu
| Graphics::kWMModalMenuMode | Graphics::kWMModeForceBuiltinFonts
- | Graphics::kWMModeUnicode);
+ | Graphics::kWMModeUnicode | Graphics::kWMModeWin95);
_wm->setScreen(&_surface);
_wm->setMenuHotzone(Common::Rect(0, 0, 640, 23));
Commit: 7ef3b88a944fdf2b9f2c3c7e2771b548120f4865
https://github.com/scummvm/scummvm/commit/7ef3b88a944fdf2b9f2c3c7e2771b548120f4865
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: save background color for mactextwindow, add new behaviour for win95 mode
Changed paths:
graphics/macgui/mactextwindow.cpp
graphics/macgui/mactextwindow.h
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index e496c5f203..405d220048 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -52,6 +52,8 @@ MacTextWindow::MacTextWindow(MacWindowManager *wm, const MacFont *font, int fgco
_fontRef = wm->_fontMan->getFont(*font);
+ _bgcolor = bgcolor;
+
_inputTextHeight = 0;
_maxWidth = maxWidth;
@@ -146,7 +148,11 @@ bool MacTextWindow::draw(bool forceRedraw) {
if (_borderIsDirty || forceRedraw) {
drawBorder();
- _composeSurface->clear(_wm->_colorWhite);
+ if (_wm->_mode & kWMModeWin95) {
+ _composeSurface->clear(_bgcolor);
+ } else {
+ _composeSurface->clear(_wm->_colorWhite);
+ }
}
if (_inputIsDirty || forceRedraw) {
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
index 2df7e5f6d4..4efa3f735f 100644
--- a/graphics/macgui/mactextwindow.h
+++ b/graphics/macgui/mactextwindow.h
@@ -105,6 +105,8 @@ private:
bool _inputIsDirty;
MacMenu *_menu;
+
+ int _bgcolor;
};
} // End of namespace Graphics
Commit: ee8d9dea03c6ec0be3b3be99680dbbd40f286a9e
https://github.com/scummvm/scummvm/commit/ee8d9dea03c6ec0be3b3be99680dbbd40f286a9e
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: set fgcolor as default format color when we are in win95 mode
Changed paths:
graphics/macgui/mactext.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 9d949bbb97..758ee130d6 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -204,8 +204,6 @@ MacText::MacText(const Common::String &s, MacWindowManager *wm, const MacFont *m
if (macFont) {
_defaultFormatting = MacFontRun(_wm, macFont->getId(), macFont->getSlant(), macFont->getSize(), 0, 0, 0);
_defaultFormatting.font = wm->_fontMan->getFont(*macFont);
- // try to set fgcolor as default color in chunks
- _defaultFormatting.fgcolor = _fgcolor;
} else {
_defaultFormatting.font = NULL;
}
@@ -215,6 +213,10 @@ MacText::MacText(const Common::String &s, MacWindowManager *wm, const MacFont *m
void MacText::init() {
_defaultFormatting.wm = _wm;
+ // try to set fgcolor as default color in chunks
+ if (_wm->_mode & kWMModeWin95) {
+ _defaultFormatting.fgcolor = _fgcolor;
+ }
_currentFormatting = _defaultFormatting;
_composeSurface->clear(_bgcolor);
@@ -952,7 +954,7 @@ void MacText::draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int
render();
if (x + w < _surface->w || y + h < _surface->h)
- g->fillRect(Common::Rect(x, y, x + w, y + w), _bgcolor);
+ g->fillRect(Common::Rect(x, y, x + w, y + h), _bgcolor);
g->blitFrom(*_surface, Common::Rect(MIN<int>(_surface->w, x), MIN<int>(_surface->h, y), MIN<int>(_surface->w, x + w), MIN<int>(_surface->h, y + h)), Common::Point(xoff, yoff));
Commit: 22606080eba5d7902d227743234a65655fdaeecb
https://github.com/scummvm/scummvm/commit/22606080eba5d7902d227743234a65655fdaeecb
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
PINK: change the order in when we drawing the macwindow and the sprites
Changed paths:
engines/pink/director.cpp
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index 5f581df823..5f4d4b4fa2 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -120,9 +120,9 @@ void Director::update() {
_sprites[i]->update();
}
- _wm->draw();
-
draw();
+
+ _wm->draw();
}
bool Director::processEvent(Common::Event &event) {
Commit: 70592cfa122816ba8d05183430e1a7d9233551e8
https://github.com/scummvm/scummvm/commit/70592cfa122816ba8d05183430e1a7d9233551e8
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
PINK: add intersection check of mactext and dirty rect
Changed paths:
engines/pink/director.cpp
engines/pink/director.h
engines/pink/objects/actions/action_text.cpp
engines/pink/objects/actions/action_text.h
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index 5f4d4b4fa2..3fde192093 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -149,6 +149,19 @@ void Director::removeTextAction(ActionText *action) {
}
}
+void Director::addTextWindow(Graphics::MacTextWindow *window) {
+ _textWindows.push_back(window);
+}
+
+void Director::removeTextWindow(Graphics::MacTextWindow *window) {
+ for (uint i = 0; i < _textWindows.size(); i++) {
+ if (_textWindows[i] == window) {
+ _textWindows.remove_at(i);
+ break;
+ }
+ }
+}
+
void Director::addSprite(ActionCEL *sprite) {
_sprites.push_back(sprite);
int i;
@@ -292,6 +305,24 @@ void Director::drawRect(const Common::Rect &rect) {
srcRect.translate(-spriteRect.left, -spriteRect.top);
_surface.transBlitFrom(*_sprites[i]->getDecoder()->getCurrentFrame(), srcRect, interRect, _sprites[i]->getDecoder()->getTransparentColourIndex());
}
+
+ // check the intersection with action text
+ for (uint i = 0; i < _textActions.size(); i++) {
+ const Common::Rect &textActionRect = _textActions[i]->getBound();
+ Common::Rect interRect = rect.findIntersectingRect(textActionRect);
+ if (interRect.isEmpty())
+ continue;
+ _textActions[i]->draw(&_surface);
+ }
+
+ // check the intersection with mactextwindow
+ for (uint i = 0; i < _textWindows.size(); i++) {
+ const Common::Rect &textWindowRect = _textWindows[i]->getDimensions();
+ Common::Rect interRect = rect.findIntersectingRect(textWindowRect);
+ if (interRect.isEmpty())
+ continue;
+ _textWindows[i]->draw(_wm->_screen, true);
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/director.h b/engines/pink/director.h
index c8e6bae9f0..a1652d2cc7 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -63,6 +63,9 @@ public:
void addSound(ActionSound *sound) { _sounds.push_back(sound); };
void removeSound(ActionSound *sound);
+ void addTextWindow(Graphics::MacTextWindow *window);
+ void removeTextWindow(Graphics::MacTextWindow *window);
+
void clear();
void pause(bool pause);
@@ -88,6 +91,7 @@ private:
Common::Array<ActionCEL *> _savedSprites;
Common::Array<ActionSound *> _sounds;
Common::Array<ActionText *> _textActions;
+ Common::Array<Graphics::MacTextWindow *> _textWindows;
bool _textRendered;
};
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index 3e1d43f0c8..35d558cec5 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -119,16 +119,22 @@ void ActionText::start() {
_txtWnd->setSelectable(false);
_txtWnd->appendText(_text, font);
+ director->addTextWindow(_txtWnd);
} else {
director->addTextAction(this);
}
}
+Common::Rect ActionText::getBound() {
+ return Common::Rect(_xLeft, _yTop, _xRight, _yBottom);
+}
+
void ActionText::end() {
Director *director = _actor->getPage()->getGame()->getDirector();
if (_scrollBar && _txtWnd) {
director->getWndManager().removeWindow(_txtWnd);
+ director->removeTextWindow(_txtWnd);
_txtWnd = nullptr;
} else {
director->removeTextAction(this);
diff --git a/engines/pink/objects/actions/action_text.h b/engines/pink/objects/actions/action_text.h
index f2ac984d95..f9a26f76e2 100644
--- a/engines/pink/objects/actions/action_text.h
+++ b/engines/pink/objects/actions/action_text.h
@@ -46,6 +46,8 @@ public:
void draw(Graphics::ManagedSurface *surface); // only for non-scrollable text
+ Common::Rect getBound();
+
private:
void findColorsInPalette();
Commit: 0a9ffd5f069b29906ba1d77995a146f34e63e9c7
https://github.com/scummvm/scummvm/commit/0a9ffd5f069b29906ba1d77995a146f34e63e9c7
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: remove unnecessary codes
Changed paths:
graphics/macgui/mactext.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 758ee130d6..a0e8d85f52 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -111,7 +111,6 @@ MacText::MacText(MacWidget *parent, int x, int y, int w, int h, MacWindowManager
_textAlignment = textAlignment;
_interLinear = interlinear;
_textShadow = textShadow;
- _maxWidth = maxWidth;
if (macFont) {
_defaultFormatting = MacFontRun(_wm, macFont->getId(), macFont->getSlant(), macFont->getSize(), 0, 0, 0);
@@ -140,7 +139,6 @@ MacText::MacText(MacWidget *parent, int x, int y, int w, int h, MacWindowManager
_textAlignment = textAlignment;
_interLinear = interlinear;
_textShadow = textShadow;
- _maxWidth = maxWidth;
if (macFont) {
_defaultFormatting = MacFontRun(_wm, macFont->getId(), macFont->getSlant(), macFont->getSize(), 0, 0, 0);
@@ -169,7 +167,6 @@ MacText::MacText(const Common::U32String &s, MacWindowManager *wm, const MacFont
_surface = nullptr;
_textAlignment = textAlignment;
_interLinear = interlinear;
- _maxWidth = maxWidth;
_textShadow = 0;
if (macFont) {
@@ -198,7 +195,6 @@ MacText::MacText(const Common::String &s, MacWindowManager *wm, const MacFont *m
_surface = nullptr;
_textAlignment = textAlignment;
_interLinear = interlinear;
- _maxWidth = maxWidth;
_textShadow = 0;
if (macFont) {
Commit: 9a139c47979383a2f139bf53ad73d7bf867d10f0
https://github.com/scummvm/scummvm/commit/9a139c47979383a2f139bf53ad73d7bf867d10f0
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
PINK: clear the area before drawing the actionText
Changed paths:
engines/pink/objects/actions/action_text.cpp
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index 35d558cec5..78567db894 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -150,6 +150,8 @@ void ActionText::draw(Graphics::ManagedSurface *surface) {
Graphics::MacFont *font = new Graphics::MacFont();
Director *director = _actor->getPage()->getGame()->getDirector();
Graphics::MacText text(_text, &director->getWndManager(), font, _textColorIndex, _backgroundColorIndex, _xRight - _xLeft, alignment);
+ // we need to first fill this area with backgroundColor, in order to wash away the previous text
+ surface->fillRect(Common::Rect(_xLeft, _yTop, _xRight, _yBottom), _backgroundColorIndex);
text.drawToPoint(surface, Common::Rect(0, 0, _xRight - _xLeft, _yBottom - _yTop), Common::Point(_xLeft, _yTop));
}
Commit: e459e5acf83fc0e90a47f2debc3249d6341add25
https://github.com/scummvm/scummvm/commit/e459e5acf83fc0e90a47f2debc3249d6341add25
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: add win95 mode for menu padding
Changed paths:
graphics/macgui/macmenu.cpp
graphics/macgui/macmenu.h
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index d508359c6d..fbadb296f0 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -43,7 +43,10 @@ enum {
kMenuPadding = 16,
kMenuDropdownPadding = 14,
kMenuDropdownItemHeight = 16,
- kMenuItemHeight = 20
+ kMenuItemHeight = 20,
+ kMenuWin95LeftDropdownPadding = 34,
+ kMenuWin95RightDropdownPadding = 53,
+ kMenuWin95DropdownItemHeight = 20
};
enum {
@@ -70,7 +73,7 @@ struct MacMenuSubMenu {
~MacMenuSubMenu();
- int ytoItem(int y) { return MIN<int>((y - bbox.top) / kMenuDropdownItemHeight, items.size() - 1); }
+ int ytoItem(int y, int itemHeight) { return MIN<int>((y - bbox.top) / itemHeight, items.size() - 1); }
};
struct MacMenuItem {
@@ -119,6 +122,12 @@ MacMenu::MacMenu(int id, const Common::Rect &bounds, MacWindowManager *wm)
_dimensionsDirty = true;
+ if (_wm->_mode & kWMModeWin95) {
+ _menuDropdownItemHeight = kMenuWin95DropdownItemHeight;
+ } else {
+ _menuDropdownItemHeight = kMenuDropdownItemHeight;
+ }
+
if (_wm->_mode & kWMModeAutohideMenu)
_isVisible = false;
else
@@ -713,7 +722,10 @@ void MacMenu::calcSubMenuBounds(MacMenuSubMenu *submenu, int x, int y) {
int x1 = x;
int y1 = y;
int x2 = x1 + maxWidth + kMenuDropdownPadding * 2 - 4;
- int y2 = y1 + submenu->items.size() * kMenuDropdownItemHeight + 2;
+ if (_wm->_mode & kWMModeWin95) {
+ x2 = x1 + maxWidth + kMenuWin95LeftDropdownPadding + kMenuWin95RightDropdownPadding;
+ }
+ int y2 = y1 + submenu->items.size() * _menuDropdownItemHeight + 2;
submenu->bbox.left = x1;
submenu->bbox.top = y1;
@@ -729,7 +741,7 @@ void MacMenu::calcSubMenuBounds(MacMenuSubMenu *submenu, int x, int y) {
MacMenuSubMenu *menu = submenu->items[i]->submenu;
if (menu != nullptr)
- calcSubMenuBounds(menu, x2 - 4, y1 + i * kMenuDropdownItemHeight + 1);
+ calcSubMenuBounds(menu, x2 - 4, y1 + i * _menuDropdownItemHeight + 1);
}
}
@@ -856,6 +868,9 @@ void MacMenu::renderSubmenu(MacMenuSubMenu *menu, bool recursive) {
int y = r->top + 1;
int x = _align == kTextAlignRight ? -kMenuDropdownPadding : kMenuDropdownPadding;
+ if (_wm->_mode & kWMModeWin95) {
+ x = _align == kTextAlignRight ? -kMenuWin95LeftDropdownPadding: kMenuWin95LeftDropdownPadding;
+ }
x += r->left;
for (uint i = 0; i < menu->items.size(); i++) {
@@ -930,14 +945,14 @@ void MacMenu::renderSubmenu(MacMenuSubMenu *menu, bool recursive) {
}
} else { // Delimiter
bool flip = r->left & 2;
- byte *ptr = (byte *)_screen.getBasePtr(r->left + 1, y + kMenuDropdownItemHeight / 2);
+ byte *ptr = (byte *)_screen.getBasePtr(r->left + 1, y + _menuDropdownItemHeight / 2);
for (int xx = r->left + 1; xx <= r->right - 1; xx++, ptr++) {
*ptr = flip ? _wm->_colorBlack : _wm->_colorWhite;
flip = !flip;
}
}
- y += kMenuDropdownItemHeight;
+ y += _menuDropdownItemHeight;
}
if (recursive && menu->highlight != -1 && menu->items[menu->highlight]->submenu != nullptr)
@@ -1049,7 +1064,7 @@ bool MacMenu::mouseClick(int x, int y) {
if (_menustack.size() > 0 && _menustack.back()->bbox.contains(x, y)) {
MacMenuSubMenu *menu = _menustack.back();
- int numSubItem = menu->ytoItem(y);
+ int numSubItem = menu->ytoItem(y, _menuDropdownItemHeight);
if (numSubItem != _activeSubItem) {
if (_wm->_mode & kWMModalMenuMode) {
@@ -1101,7 +1116,7 @@ bool MacMenu::mouseClick(int x, int y) {
MacMenuSubMenu *menu = _menustack.back();
- _activeSubItem = menu->highlight = menu->ytoItem(y);
+ _activeSubItem = menu->highlight = menu->ytoItem(y, _menuDropdownItemHeight);
_contentIsDirty = true;
_wm->setFullRefresh(true);
diff --git a/graphics/macgui/macmenu.h b/graphics/macgui/macmenu.h
index dbf6144fe7..b87bd5525d 100644
--- a/graphics/macgui/macmenu.h
+++ b/graphics/macgui/macmenu.h
@@ -99,6 +99,7 @@ private:
ManagedSurface _screen;
ManagedSurface _tempSurface;
TextAlign _align;
+ int _menuDropdownItemHeight;
private:
bool checkCallback(bool unicode = false);
Commit: 5d2a73fe01c71e59caabacdd12f59e1f9de49713
https://github.com/scummvm/scummvm/commit/5d2a73fe01c71e59caabacdd12f59e1f9de49713
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: add win95 mode for menu behaviour, currently in win95 mode, it will exit the menu only when you click something useful(trigger some event)
Changed paths:
graphics/macgui/macmenu.cpp
graphics/macgui/macmenu.h
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index fbadb296f0..5df342336b 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -1169,35 +1169,60 @@ bool MacMenu::checkCallback(bool unicode) {
return true;
}
-bool MacMenu::mouseRelease(int x, int y) {
- if (_active) {
- setActive(false);
- if (_wm->_mode & kWMModeAutohideMenu)
- _isVisible = false;
+void MacMenu::closeMenu() {
+ setActive(false);
+ if (_wm->_mode & kWMModeAutohideMenu)
+ _isVisible = false;
- if (_wm->_mode & kWMModalMenuMode) {
- _wm->disableScreenCopy();
- }
+ if (_wm->_mode & kWMModalMenuMode) {
+ _wm->disableScreenCopy();
+ }
+ _activeItem = -1;
+ _activeSubItem = -1;
+ _menustack.clear();
- if (_activeItem != -1 && _activeSubItem != -1 && _menustack.back()->items[_activeSubItem]->enabled) {
- if (_menustack.back()->items[_activeSubItem]->unicode) {
- if (checkCallback(true))
- (*_unicodeccallback)(_menustack.back()->items[_activeSubItem]->action,
- _menustack.back()->items[_activeSubItem]->unicodeText, _cdata);
- } else {
- if (checkCallback())
- (*_ccallback)(_menustack.back()->items[_activeSubItem]->action,
- _menustack.back()->items[_activeSubItem]->text, _cdata);
+ _wm->setFullRefresh(true);
+}
+
+bool MacMenu::mouseRelease(int x, int y) {
+ if (!(_wm->_mode & kWMModeWin95)) {
+ if (_active) {
+ if (_activeItem != -1 && _activeSubItem != -1 && _menustack.back()->items[_activeSubItem]->enabled) {
+ if (_menustack.back()->items[_activeSubItem]->unicode) {
+ if (checkCallback(true))
+ (*_unicodeccallback)(_menustack.back()->items[_activeSubItem]->action,
+ _menustack.back()->items[_activeSubItem]->unicodeText, _cdata);
+ } else {
+ if (checkCallback())
+ (*_ccallback)(_menustack.back()->items[_activeSubItem]->action,
+ _menustack.back()->items[_activeSubItem]->text, _cdata);
+ }
}
- }
- _activeItem = -1;
- _activeSubItem = -1;
- _menustack.clear();
+ closeMenu();
+ return true;
+ }
+ } else {
+ if (_active) {
- _wm->setFullRefresh(true);
+ if (_activeItem != -1 && _activeSubItem != -1 && _menustack.back()->items[_activeSubItem]->enabled) {
+ if (_menustack.back()->items[_activeSubItem]->unicode) {
+ if (checkCallback(true)) {
+ (*_unicodeccallback)(_menustack.back()->items[_activeSubItem]->action,
+ _menustack.back()->items[_activeSubItem]->unicodeText, _cdata);
+ closeMenu();
+ }
+ } else {
+ if (checkCallback()) {
+ (*_ccallback)(_menustack.back()->items[_activeSubItem]->action,
+ _menustack.back()->items[_activeSubItem]->text, _cdata);
+ closeMenu();
+ }
+ }
+ }
- return true;
+ return true;
+ }
}
return false;
diff --git a/graphics/macgui/macmenu.h b/graphics/macgui/macmenu.h
index b87bd5525d..f611930ae2 100644
--- a/graphics/macgui/macmenu.h
+++ b/graphics/macgui/macmenu.h
@@ -93,6 +93,8 @@ public:
void printMenu(int level = 0, MacMenuSubMenu *submenu = nullptr);
+ void closeMenu();
+
Common::Rect _bbox;
private:
Commit: 1d3cf51b7b5c4de2a980a4f1ae780fe46a23639e
https://github.com/scummvm/scummvm/commit/1d3cf51b7b5c4de2a980a4f1ae780fe46a23639e
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: fix the bug when closing the menu, the highlight part was not correctly set
Changed paths:
graphics/macgui/macmenu.cpp
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index 5df342336b..9fb645ed5f 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -1177,6 +1177,11 @@ void MacMenu::closeMenu() {
if (_wm->_mode & kWMModalMenuMode) {
_wm->disableScreenCopy();
}
+
+ for (uint i = 0; i < _menustack.size(); i++) {
+ _menustack[i]->highlight = -1;
+ }
+
_activeItem = -1;
_activeSubItem = -1;
_menustack.clear();
Commit: ba4513c10b5d1d83589e25653b465b479d5a2193
https://github.com/scummvm/scummvm/commit/ba4513c10b5d1d83589e25653b465b479d5a2193
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: organize the code
Changed paths:
graphics/macgui/macmenu.cpp
graphics/macgui/macmenu.h
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index 9fb645ed5f..bf6bff0bbf 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -45,7 +45,7 @@ enum {
kMenuDropdownItemHeight = 16,
kMenuItemHeight = 20,
kMenuWin95LeftDropdownPadding = 34,
- kMenuWin95RightDropdownPadding = 53,
+ kMenuWin95RightDropdownPadding = 57,
kMenuWin95DropdownItemHeight = 20
};
@@ -124,8 +124,12 @@ MacMenu::MacMenu(int id, const Common::Rect &bounds, MacWindowManager *wm)
if (_wm->_mode & kWMModeWin95) {
_menuDropdownItemHeight = kMenuWin95DropdownItemHeight;
+ _menuLeftDropdownPadding = kMenuWin95LeftDropdownPadding;
+ _menuRightDropdownPadding = kMenuWin95RightDropdownPadding;
} else {
_menuDropdownItemHeight = kMenuDropdownItemHeight;
+ _menuLeftDropdownPadding = kMenuDropdownPadding;
+ _menuRightDropdownPadding = kMenuDropdownPadding;
}
if (_wm->_mode & kWMModeAutohideMenu)
@@ -721,10 +725,8 @@ void MacMenu::calcSubMenuBounds(MacMenuSubMenu *submenu, int x, int y) {
int maxWidth = calcSubMenuWidth(submenu);
int x1 = x;
int y1 = y;
- int x2 = x1 + maxWidth + kMenuDropdownPadding * 2 - 4;
- if (_wm->_mode & kWMModeWin95) {
- x2 = x1 + maxWidth + kMenuWin95LeftDropdownPadding + kMenuWin95RightDropdownPadding;
- }
+ int x2 = x1 + maxWidth + _menuLeftDropdownPadding + _menuRightDropdownPadding - 4;
+
int y2 = y1 + submenu->items.size() * _menuDropdownItemHeight + 2;
submenu->bbox.left = x1;
@@ -867,10 +869,7 @@ void MacMenu::renderSubmenu(MacMenuSubMenu *menu, bool recursive) {
_screen.hLine(r->left + 3, r->bottom + 1, r->right + 1, _wm->_colorBlack);
int y = r->top + 1;
- int x = _align == kTextAlignRight ? -kMenuDropdownPadding : kMenuDropdownPadding;
- if (_wm->_mode & kWMModeWin95) {
- x = _align == kTextAlignRight ? -kMenuWin95LeftDropdownPadding: kMenuWin95LeftDropdownPadding;
- }
+ int x = _align == kTextAlignRight ? -kMenuWin95LeftDropdownPadding: kMenuWin95LeftDropdownPadding;
x += r->left;
for (uint i = 0; i < menu->items.size(); i++) {
diff --git a/graphics/macgui/macmenu.h b/graphics/macgui/macmenu.h
index f611930ae2..9216ebce82 100644
--- a/graphics/macgui/macmenu.h
+++ b/graphics/macgui/macmenu.h
@@ -102,6 +102,8 @@ private:
ManagedSurface _tempSurface;
TextAlign _align;
int _menuDropdownItemHeight;
+ int _menuLeftDropdownPadding;
+ int _menuRightDropdownPadding;
private:
bool checkCallback(bool unicode = false);
Commit: f81ea96421667dcdcf076e40076d9e32f0513882
https://github.com/scummvm/scummvm/commit/f81ea96421667dcdcf076e40076d9e32f0513882
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: clean the code, modify the behaviour of win95 menu
Changed paths:
graphics/macgui/macmenu.cpp
graphics/macgui/macmenu.h
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index bf6bff0bbf..74834f3f0b 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -1138,6 +1138,19 @@ bool MacMenu::mouseClick(int x, int y) {
return false;
}
+bool MacMenu::contains(int x, int y) {
+ if (_bbox.contains(x, y))
+ return true;
+ for (uint i = 0; i < _menustack.size(); i++) {
+ if (_menustack[i]->bbox.contains(x, y))
+ return true;
+ }
+ if (_activeSubItem != -1 && _menustack.back()->items[_activeSubItem]->submenu != nullptr)
+ if (_menustack.back()->items[_activeSubItem]->submenu->bbox.contains(x, y))
+ return true;
+ return false;
+}
+
bool MacMenu::mouseMove(int x, int y) {
if (_active) {
if (mouseClick(x, y))
@@ -1189,47 +1202,30 @@ void MacMenu::closeMenu() {
}
bool MacMenu::mouseRelease(int x, int y) {
- if (!(_wm->_mode & kWMModeWin95)) {
- if (_active) {
- if (_activeItem != -1 && _activeSubItem != -1 && _menustack.back()->items[_activeSubItem]->enabled) {
- if (_menustack.back()->items[_activeSubItem]->unicode) {
- if (checkCallback(true))
- (*_unicodeccallback)(_menustack.back()->items[_activeSubItem]->action,
- _menustack.back()->items[_activeSubItem]->unicodeText, _cdata);
- } else {
- if (checkCallback())
- (*_ccallback)(_menustack.back()->items[_activeSubItem]->action,
- _menustack.back()->items[_activeSubItem]->text, _cdata);
- }
- }
-
- closeMenu();
- return true;
- }
- } else {
- if (_active) {
+ if (!_active)
+ return false;
- if (_activeItem != -1 && _activeSubItem != -1 && _menustack.back()->items[_activeSubItem]->enabled) {
- if (_menustack.back()->items[_activeSubItem]->unicode) {
- if (checkCallback(true)) {
- (*_unicodeccallback)(_menustack.back()->items[_activeSubItem]->action,
- _menustack.back()->items[_activeSubItem]->unicodeText, _cdata);
- closeMenu();
- }
- } else {
- if (checkCallback()) {
- (*_ccallback)(_menustack.back()->items[_activeSubItem]->action,
- _menustack.back()->items[_activeSubItem]->text, _cdata);
- closeMenu();
- }
- }
+ bool haveCallBack = false;
+ if (_activeItem != -1 && _activeSubItem != -1 && _menustack.back()->items[_activeSubItem]->enabled) {
+ if (_menustack.back()->items[_activeSubItem]->unicode) {
+ if (checkCallback(true)) {
+ (*_unicodeccallback)(_menustack.back()->items[_activeSubItem]->action,
+ _menustack.back()->items[_activeSubItem]->unicodeText, _cdata);
+ haveCallBack = true;
+ }
+ } else {
+ if (checkCallback()) {
+ (*_ccallback)(_menustack.back()->items[_activeSubItem]->action,
+ _menustack.back()->items[_activeSubItem]->text, _cdata);
+ haveCallBack = true;
}
-
- return true;
}
}
- return false;
+ // if the mode is not win95, or the click position is outside of the menu, then we close it
+ if (!(_wm->_mode & kWMModeWin95) || !contains(x, y) || haveCallBack)
+ closeMenu();
+ return true;
}
bool MacMenu::processMenuShortCut(byte flags, uint16 ascii) {
diff --git a/graphics/macgui/macmenu.h b/graphics/macgui/macmenu.h
index 9216ebce82..997c00dca4 100644
--- a/graphics/macgui/macmenu.h
+++ b/graphics/macgui/macmenu.h
@@ -124,6 +124,7 @@ private:
bool processMenuShortCut(byte flags, uint16 ascii);
void drawSubMenuArrow(ManagedSurface *dst, int x, int y, int color);
+ bool contains(int x, int y);
void eventLoop();
Commit: 7c5c66a8c8a03148604c3d4106fde93ace72052e
https://github.com/scummvm/scummvm/commit/7c5c66a8c8a03148604c3d4106fde93ace72052e
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
PINK: add win95 mode border for pink
Changed paths:
A devtools/create_pink/pink_border.bmp
engines/pink/objects/actions/action_text.cpp
engines/pink/objects/actions/action_text.h
diff --git a/devtools/create_pink/pink_border.bmp b/devtools/create_pink/pink_border.bmp
new file mode 100644
index 0000000000..d2826e27f1
Binary files /dev/null and b/devtools/create_pink/pink_border.bmp differ
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index 78567db894..4626576b5e 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -112,7 +112,9 @@ void ActionText::start() {
Graphics::MacFont *font = new Graphics::MacFont;
_txtWnd = director->getWndManager().addTextWindow(font, _textColorIndex, _backgroundColorIndex,
_xRight - _xLeft, align, nullptr, false);
- _txtWnd->disableBorder();
+ loadBorder(_txtWnd, "pink_border.bmp", Graphics::kWindowBorderScrollbar | Graphics::kWindowBorderActive);
+ loadBorder(_txtWnd, "pink_border.bmp", Graphics::kWindowBorderScrollbar);
+ _txtWnd->enableScrollbar(true);
_txtWnd->move(_xLeft, _yTop);
_txtWnd->resize(_xRight - _xLeft, _yBottom - _yTop);
_txtWnd->setEditable(false);
@@ -141,6 +143,25 @@ void ActionText::end() {
}
}
+void ActionText::loadBorder(Graphics::MacWindow *target, Common::String filename, uint32 flags) {
+ Common::File borderfile;
+
+ if (!borderfile.open(filename)) {
+ debug(1, "Cannot open border file");
+ return;
+ }
+
+ Common::SeekableReadStream *stream = borderfile.readStream(borderfile.size());
+ if (stream) {
+ // we don't have to pass border offsets here, because 9-patch will automatically calc it
+ target->loadBorder(*stream, flags);
+
+ borderfile.close();
+
+ delete stream;
+ }
+}
+
void ActionText::draw(Graphics::ManagedSurface *surface) {
// not working
Graphics::TextAlign alignment = _centered ? Graphics::kTextAlignCenter : Graphics::kTextAlignLeft;
diff --git a/engines/pink/objects/actions/action_text.h b/engines/pink/objects/actions/action_text.h
index f9a26f76e2..0638bb01cd 100644
--- a/engines/pink/objects/actions/action_text.h
+++ b/engines/pink/objects/actions/action_text.h
@@ -51,6 +51,7 @@ public:
private:
void findColorsInPalette();
+ void loadBorder(Graphics::MacWindow *target, Common::String filename, uint32 flags);
private:
Common::String _fileName;
Commit: 855583e2e495bb037edd7538e797af619ca99fb2
https://github.com/scummvm/scummvm/commit/855583e2e495bb037edd7538e797af619ca99fb2
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: add win95 mode for scrollbar
Changed paths:
graphics/macgui/macwindowborder.cpp
diff --git a/graphics/macgui/macwindowborder.cpp b/graphics/macgui/macwindowborder.cpp
index 8250aeaa12..a48b5a62b7 100644
--- a/graphics/macgui/macwindowborder.cpp
+++ b/graphics/macgui/macwindowborder.cpp
@@ -161,7 +161,9 @@ void MacWindowBorder::drawScrollBar(ManagedSurface *g, MacWindowManager *wm) {
Graphics::drawFilledRect(rr, wm->_colorWhite, wm->getDrawInvertPixel(), &pd);
// after drawing, we set the _scrollSize negative, to indicate no more drawing is needed
- _scrollSize = -1;
+ // if win95 mode is enabled, then we keep on drawing the scrollbar
+ if (!(wm->_mode & kWMModeWin95))
+ _scrollSize = -1;
}
void MacWindowBorder::drawTitle(ManagedSurface *g, MacWindowManager *wm, int titleOffset) {
Commit: fa4aaa76089a3401a61ca8b5f1071d8a33bcf808
https://github.com/scummvm/scummvm/commit/fa4aaa76089a3401a61ca8b5f1071d8a33bcf808
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: modify the offset when drawing the mactext to suit for pink
Changed paths:
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 405d220048..16a8a32db6 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -164,7 +164,7 @@ bool MacTextWindow::draw(bool forceRedraw) {
_cursorDirty = false;
// Compose
- _mactext->draw(_composeSurface, 0, _scrollPos, _composeSurface->w - 2, _scrollPos + _composeSurface->h - 2, 1, 1);
+ _mactext->draw(_composeSurface, 0, _scrollPos, _composeSurface->w, _scrollPos + _composeSurface->h, 1, 1);
if (_cursorState)
_composeSurface->blitFrom(*_cursorSurface, *_cursorRect, Common::Point(_cursorX + 1, _cursorY + 1));
Commit: 90b2c02f271b2fd0a6022d07b28724760c6866b8
https://github.com/scummvm/scummvm/commit/90b2c02f271b2fd0a6022d07b28724760c6866b8
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: init the scrollSize and scrollPos at constructor
Changed paths:
graphics/macgui/macwindowborder.cpp
diff --git a/graphics/macgui/macwindowborder.cpp b/graphics/macgui/macwindowborder.cpp
index a48b5a62b7..486776d755 100644
--- a/graphics/macgui/macwindowborder.cpp
+++ b/graphics/macgui/macwindowborder.cpp
@@ -52,6 +52,9 @@ MacWindowBorder::MacWindowBorder() {
_borderOffsets.titleTop = -1;
_borderOffsets.titleBottom = -1;
_borderOffsets.dark = false;
+
+ _scrollSize = -1;
+ _scrollPos = 0;
}
MacWindowBorder::~MacWindowBorder() {
Commit: b993ab021dd420044c6a7ce7ebb69e501c386658
https://github.com/scummvm/scummvm/commit/b993ab021dd420044c6a7ce7ebb69e501c386658
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: fix the algorithm when we calc the coordinate of scrollbar, modify the offsets
Changed paths:
graphics/macgui/mactextwindow.cpp
graphics/macgui/macwindowborder.cpp
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 16a8a32db6..9ad3c276f1 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -306,10 +306,24 @@ Common::U32String MacTextWindow::cutSelection() {
}
void MacTextWindow::calcScrollBar() {
- int maxText = _mactext->getTextHeight() + getInnerDimensions().height();
- int drawableHeight = getInnerDimensions().height();
- float scrollSize = (float)drawableHeight * drawableHeight / (float)maxText;
- float scrollPos = (float)_scrollPos * drawableHeight / (float)maxText;
+ int maxText = 0, maxScrollbar = 0, displayHeight = 0;
+
+ displayHeight = getInnerDimensions().height();
+
+ if (_wm->_mode & kWMModeWin95) {
+ // because in win95 mode, the height of where we draw the text and scrollbar is not the same
+ maxScrollbar = getDimensions().height() - 32;
+ } else {
+ maxScrollbar = getInnerDimensions().height();
+ }
+
+ if (_editable)
+ maxText = _mactext->getTextHeight() + getInnerDimensions().height();
+ else
+ maxText = MAX<int>(_mactext->getTextHeight(), displayHeight);
+
+ float scrollSize = (float)maxScrollbar * (float)displayHeight / (float)maxText;
+ float scrollPos = (float)_scrollPos * (float)maxScrollbar / (float)maxText;
setScroll(scrollPos, scrollSize);
}
@@ -359,15 +373,15 @@ bool MacTextWindow::processEvent(Common::Event &event) {
if (event.type == Common::EVENT_WHEELUP) {
setHighlight(kBorderScrollUp);
- calcScrollBar();
scroll(-2);
+ calcScrollBar();
return true;
}
if (event.type == Common::EVENT_WHEELDOWN) {
setHighlight(kBorderScrollDown);
- calcScrollBar();
scroll(2);
+ calcScrollBar();
return true;
}
diff --git a/graphics/macgui/macwindowborder.cpp b/graphics/macgui/macwindowborder.cpp
index 486776d755..0ce235f65d 100644
--- a/graphics/macgui/macwindowborder.cpp
+++ b/graphics/macgui/macwindowborder.cpp
@@ -153,10 +153,11 @@ void MacWindowBorder::drawScrollBar(ManagedSurface *g, MacWindowManager *wm) {
// here, we first check the _scrollSize, and if it is negative, then we don't draw the scrollBar
if (_scrollSize < 0)
return;
+ // currently, we are assuming that the width and height of the "border arrow" have the same size
int size = kBorderWidth;
- int rx1 = 0 + g->w - size + 2;
- int ry1 = 0 + size + _scrollPos + 1;
- int rx2 = rx1 + size - 6;
+ int rx1 = g->w - size + 2;
+ int ry1 = size + _scrollPos;
+ int rx2 = rx1 + size - 5;
int ry2 = ry1 + _scrollSize ;
Common::Rect rr(rx1, ry1, rx2, ry2);
Commit: 15d46a55f8da5ef154ac613a13bbee000fc1c8bf
https://github.com/scummvm/scummvm/commit/15d46a55f8da5ef154ac613a13bbee000fc1c8bf
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: add the feature that you can close the window when using the menu
Changed paths:
graphics/macgui/macmenu.cpp
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index 74834f3f0b..f935e6f506 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -980,6 +980,9 @@ bool MacMenu::processEvent(Common::Event &event) {
return false;
switch (event.type) {
+ case Common::EVENT_QUIT:
+ closeMenu();
+ return false;
case Common::EVENT_KEYDOWN:
return keyEvent(event);
case Common::EVENT_LBUTTONDOWN:
Commit: d437b22b6badc5b00fbc2ad86a759019e05f8d26
https://github.com/scummvm/scummvm/commit/d437b22b6badc5b00fbc2ad86a759019e05f8d26
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: fix the behaviour of scrollbar of win95 mode
Changed paths:
engines/pink/objects/actions/action_text.cpp
graphics/macgui/mactextwindow.cpp
graphics/macgui/mactextwindow.h
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index 4626576b5e..d40c5987fb 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -121,6 +121,13 @@ void ActionText::start() {
_txtWnd->setSelectable(false);
_txtWnd->appendText(_text, font);
+ // if the textHeight is smaller than the area we display the text, then we disable the scrollbar
+ if (_txtWnd->getTextHeight() < _txtWnd->getInnerDimensions().height()) {
+ _txtWnd->disableBorder();
+ _txtWnd->enableScrollbar(false);
+ _txtWnd->resize(_xRight - _xLeft, _yBottom - _yTop);
+ _txtWnd->draw(true);
+ }
director->addTextWindow(_txtWnd);
} else {
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 9ad3c276f1..3a821f2a0d 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -106,6 +106,9 @@ void MacTextWindow::appendText(const Common::U32String &str, const MacFont *macF
updateCursorPos();
}
+
+ if (_wm->_mode & kWMModeWin95)
+ calcScrollBar();
}
void MacTextWindow::appendText(const Common::String &str, const MacFont *macFont, bool skipAdd) {
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
index 4efa3f735f..74fb724d5d 100644
--- a/graphics/macgui/mactextwindow.h
+++ b/graphics/macgui/mactextwindow.h
@@ -62,6 +62,7 @@ public:
void clearSelection();
Common::U32String cutSelection();
const SelectedText *getSelectedText() { return &_selectedText; }
+ int getTextHeight() { return _mactext->getTextHeight(); }
private:
bool isCutAllowed();
Commit: a2f48f534384db9137e653158a4fbcbbc76ca852
https://github.com/scummvm/scummvm/commit/a2f48f534384db9137e653158a4fbcbbc76ca852
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
WAGE: fix the code which may occur bug
Changed paths:
engines/wage/gui.cpp
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index c922526f28..1b753fee23 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -314,11 +314,11 @@ void Gui::executeMenuCommand(int action, Common::String &text) {
}
void Gui::loadBorders() {
+ _consoleWindow->enableScrollbar(true);
loadBorder(_sceneWindow, "wage_border_inact-title.bmp", Graphics::kWindowBorderTitle, 22);
loadBorder(_sceneWindow, "wage_border_act-noscrollbar-title.bmp", Graphics::kWindowBorderActive|Graphics::kWindowBorderTitle, 22);
loadBorder(_consoleWindow, "wage_border_inact.bmp", Graphics::kWindowBorderScrollbar, 0);
loadBorder(_consoleWindow, "wage_border_act.bmp", Graphics::kWindowBorderScrollbar|Graphics::kWindowBorderActive, 0);
- _consoleWindow->enableScrollbar(true);
}
void Gui::loadBorder(Graphics::MacWindow *target, Common::String filename, uint32 flags, int titlePos) {
Commit: 27986beebc3fb268c3320868a7dd91e6ad176f48
https://github.com/scummvm/scummvm/commit/27986beebc3fb268c3320868a7dd91e6ad176f48
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: add comment for enableScrollbar
Changed paths:
graphics/macgui/macwindow.h
diff --git a/graphics/macgui/macwindow.h b/graphics/macgui/macwindow.h
index 36342f3afe..0937862c46 100644
--- a/graphics/macgui/macwindow.h
+++ b/graphics/macgui/macwindow.h
@@ -287,7 +287,6 @@ public:
/**
* See BaseMacWindow.
*/
- void enableScrollbar(bool active) { _hasScrollBar = active; }
virtual bool processEvent(Common::Event &event) override;
virtual bool hasAllFocus() override { return _beingDragged || _beingResized; }
@@ -305,6 +304,11 @@ public:
void loadBorder(Common::SeekableReadStream &file, uint32 flags, int lo = -1, int ro = -1, int to = -1, int bo = -1);
void loadBorder(Common::SeekableReadStream &file, uint32 flags, BorderOffsets offsets);
void disableBorder();
+ /**
+ * we better set this before we load the border
+ * @param scrollbar state
+ */
+ void enableScrollbar(bool active) { _hasScrollBar = active; }
/**
* Indicate whether the window can be closed (false by default).
Commit: 55f61f2c699710bbc7f191de2b6d71df87b0cd40
https://github.com/scummvm/scummvm/commit/55f61f2c699710bbc7f191de2b6d71df87b0cd40
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
PINK: fix the bug when we disable the border, the text may not render correctly.
Changed paths:
engines/pink/objects/actions/action_text.cpp
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index d40c5987fb..0cd89feb38 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -112,9 +112,9 @@ void ActionText::start() {
Graphics::MacFont *font = new Graphics::MacFont;
_txtWnd = director->getWndManager().addTextWindow(font, _textColorIndex, _backgroundColorIndex,
_xRight - _xLeft, align, nullptr, false);
+ _txtWnd->enableScrollbar(true);
loadBorder(_txtWnd, "pink_border.bmp", Graphics::kWindowBorderScrollbar | Graphics::kWindowBorderActive);
loadBorder(_txtWnd, "pink_border.bmp", Graphics::kWindowBorderScrollbar);
- _txtWnd->enableScrollbar(true);
_txtWnd->move(_xLeft, _yTop);
_txtWnd->resize(_xRight - _xLeft, _yBottom - _yTop);
_txtWnd->setEditable(false);
@@ -123,10 +123,15 @@ void ActionText::start() {
_txtWnd->appendText(_text, font);
// if the textHeight is smaller than the area we display the text, then we disable the scrollbar
if (_txtWnd->getTextHeight() < _txtWnd->getInnerDimensions().height()) {
+ delete _txtWnd;
+ _txtWnd = director->getWndManager().addTextWindow(font, _textColorIndex, _backgroundColorIndex,
+ _xRight - _xLeft, align, nullptr, false);
_txtWnd->disableBorder();
- _txtWnd->enableScrollbar(false);
+ _txtWnd->move(_xLeft, _yTop);
_txtWnd->resize(_xRight - _xLeft, _yBottom - _yTop);
- _txtWnd->draw(true);
+ _txtWnd->setEditable(false);
+ _txtWnd->setSelectable(false);
+ _txtWnd->appendText(_text, font);
}
director->addTextWindow(_txtWnd);
Commit: 82a55fd8d83c9665a52e50d5b40d7633de6daff2
https://github.com/scummvm/scummvm/commit/82a55fd8d83c9665a52e50d5b40d7633de6daff2
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: add getTextMaxWidth for mactext
Changed paths:
graphics/macgui/mactext.h
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index cf1bc1db7f..36c0c03cd6 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -184,6 +184,7 @@ public:
int getLastLineWidth();
int getTextHeight() { return _textMaxHeight; }
int getLineHeight(int line);
+ int getTextMaxWidth() { return _textMaxWidth; }
void deletePreviousChar(int *row, int *col);
void addNewLine(int *row, int *col);
Commit: 013925a3ad45ce520e4eb11f31a7810d361890ae
https://github.com/scummvm/scummvm/commit/013925a3ad45ce520e4eb11f31a7810d361890ae
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
PINK: implement alignment for center manually for action text
Changed paths:
engines/pink/objects/actions/action_text.cpp
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index 0cd89feb38..6358ae841a 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -175,17 +175,28 @@ void ActionText::loadBorder(Graphics::MacWindow *target, Common::String filename
}
void ActionText::draw(Graphics::ManagedSurface *surface) {
- // not working
+ // alignment not working, thus we implement alignment for center manually
Graphics::TextAlign alignment = _centered ? Graphics::kTextAlignCenter : Graphics::kTextAlignLeft;
if (!_centered && _actor->getPage()->getGame()->getLanguage() == Common::HE_ISR) {
alignment = Graphics::kTextAlignRight;
}
- Graphics::MacFont *font = new Graphics::MacFont();
+ int xOffset = 0, yOffset = 0;
+ Graphics::MacFont *font = nullptr;
+ if (_centered) {
+ font = new Graphics::MacFont(Graphics::kMacFontChicago, 12, Graphics::kMacFontBold);
+ } else {
+ font = new Graphics::MacFont();
+ }
Director *director = _actor->getPage()->getGame()->getDirector();
Graphics::MacText text(_text, &director->getWndManager(), font, _textColorIndex, _backgroundColorIndex, _xRight - _xLeft, alignment);
// we need to first fill this area with backgroundColor, in order to wash away the previous text
surface->fillRect(Common::Rect(_xLeft, _yTop, _xRight, _yBottom), _backgroundColorIndex);
- text.drawToPoint(surface, Common::Rect(0, 0, _xRight - _xLeft, _yBottom - _yTop), Common::Point(_xLeft, _yTop));
+
+ if (_centered) {
+ xOffset = (_xRight - _xLeft) / 2 - text.getTextMaxWidth() / 2;
+ yOffset = (_yBottom - _yTop) / 2 - text.getTextHeight() / 2;
+ }
+ text.drawToPoint(surface, Common::Rect(0, 0, _xRight - _xLeft, _yBottom - _yTop), Common::Point(_xLeft + xOffset, _yTop + yOffset));
}
#define BLUE(rgb) ((rgb) & 0xFF)
Commit: fc702ea9fe2ce860393315378d32d995277361cb
https://github.com/scummvm/scummvm/commit/fc702ea9fe2ce860393315378d32d995277361cb
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: re-organize the code for drawing scrollbar for macwindow
Changed paths:
graphics/macgui/datafiles.cpp
graphics/macgui/mactextwindow.cpp
graphics/macgui/macwindow.h
graphics/macgui/macwindowborder.cpp
graphics/macgui/macwindowborder.h
diff --git a/graphics/macgui/datafiles.cpp b/graphics/macgui/datafiles.cpp
index a0f7fdffdc..2add870a47 100644
--- a/graphics/macgui/datafiles.cpp
+++ b/graphics/macgui/datafiles.cpp
@@ -44,24 +44,24 @@ struct BorderName {
};
static const BorderName borders[] = {
- {0x00, "StandardClose", { 1, 2, 19, 2, 2, 2, false, 25}},
- {0x01, "ThickNoTitle", { 5, 5, 5, 5, -1, -1, false, 0}},
- {0x02, "ThinNoTitle", { 1, 1, 1, 1, -1, -1, false, 0}},
- {0x03, "ThinNoTitleShadow", { 1, 3, 1, 3, -1, -1, false, 0}},
- {0x04, "StandardClose", { 1, 2, 19, 2, 2, 2, false, 25}},
- {0x05, "Thick", { 5, 5, 20, 5, 2, 3, false, 13}},
- {0x06, "ThinNoTitle", { 1, 1, 1, 1, -1, -1, false, 0}},
- {0x07, "ThinNoTitleShadow", { 1, 3, 1, 3, -1, -1, false, 0}},
- {0x08, "StandardCloseZoom", { 1, 2, 19, 2, 2, 2, false, 25}},
- {0x09, "ThickZoom", { 5, 5, 20, 5, 2, 3, false, 13}},
- {0x0A, "ThinNoTitle", { 1, 1, 1, 1, -1, -1, false, 0}},
- {0x0B, "ThinNoTitleShadow", { 1, 3, 1, 3, -1, -1, false, 0}},
- {0x0C, "StandardCloseZoom", { 1, 2, 19, 2, 2, 2, false, 25}},
- {0x0D, "ThickZoom", { 5, 5, 20, 5, 2, 3, false, 13}},
- {0x0E, "ThinNoTitle", { 1, 1, 1, 1, -1, -1, false, 0}},
- {0x0F, "ThinNoTitleShadow", { 1, 3, 1, 3, -1, -1, false, 0}},
- {0x10, "RoundClose", { 1, 1, 19, 6, 1, 1, true, 25}},
- {0xFF, "No type", {-1, -1, -1, -1, -1, -1, false, 0}}
+ {0x00, "StandardClose", { 1, 2, 19, 2, 2, 2, false, 25, 0, 0}},
+ {0x01, "ThickNoTitle", { 5, 5, 5, 5, -1, -1, false, 0, 0, 0}},
+ {0x02, "ThinNoTitle", { 1, 1, 1, 1, -1, -1, false, 0, 0, 0}},
+ {0x03, "ThinNoTitleShadow", { 1, 3, 1, 3, -1, -1, false, 0, 0, 0}},
+ {0x04, "StandardClose", { 1, 2, 19, 2, 2, 2, false, 25, 0, 0}},
+ {0x05, "Thick", { 5, 5, 20, 5, 2, 3, false, 13, 0, 0}},
+ {0x06, "ThinNoTitle", { 1, 1, 1, 1, -1, -1, false, 0, 0, 0}},
+ {0x07, "ThinNoTitleShadow", { 1, 3, 1, 3, -1, -1, false, 0, 0, 0}},
+ {0x08, "StandardCloseZoom", { 1, 2, 19, 2, 2, 2, false, 25, 0, 0}},
+ {0x09, "ThickZoom", { 5, 5, 20, 5, 2, 3, false, 13, 0, 0}},
+ {0x0A, "ThinNoTitle", { 1, 1, 1, 1, -1, -1, false, 0, 0, 0}},
+ {0x0B, "ThinNoTitleShadow", { 1, 3, 1, 3, -1, -1, false, 0, 0, 0}},
+ {0x0C, "StandardCloseZoom", { 1, 2, 19, 2, 2, 2, false, 25, 0, 0}},
+ {0x0D, "ThickZoom", { 5, 5, 20, 5, 2, 3, false, 13, 0, 0}},
+ {0x0E, "ThinNoTitle", { 1, 1, 1, 1, -1, -1, false, 0, 0, 0}},
+ {0x0F, "ThinNoTitleShadow", { 1, 3, 1, 3, -1, -1, false, 0, 0, 0}},
+ {0x10, "RoundClose", { 1, 1, 19, 6, 1, 1, true, 25, 0, 0}},
+ {0xFF, "No type", {-1, -1, -1, -1, -1, -1, false, 0, 0, 0}}
};
Common::String windowTypeName(byte windowType) {
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 3a821f2a0d..a1aca69ced 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -309,16 +309,16 @@ Common::U32String MacTextWindow::cutSelection() {
}
void MacTextWindow::calcScrollBar() {
+ // since this function only able for the window which has scroll bar
+ // thus, if it doesn't has scrollbar, then we don't have to calc it
+ if (!_hasScrollBar)
+ return;
+
int maxText = 0, maxScrollbar = 0, displayHeight = 0;
displayHeight = getInnerDimensions().height();
- if (_wm->_mode & kWMModeWin95) {
- // because in win95 mode, the height of where we draw the text and scrollbar is not the same
- maxScrollbar = getDimensions().height() - 32;
- } else {
- maxScrollbar = getInnerDimensions().height();
- }
+ maxScrollbar = getDimensions().height() - getBorderOffsets().upperScrollHeight - getBorderOffsets().lowerScrollHeight;
if (_editable)
maxText = _mactext->getTextHeight() + getInnerDimensions().height();
diff --git a/graphics/macgui/macwindow.h b/graphics/macgui/macwindow.h
index 0937862c46..18b772533d 100644
--- a/graphics/macgui/macwindow.h
+++ b/graphics/macgui/macwindow.h
@@ -359,6 +359,7 @@ private:
protected:
void drawBorder();
WindowClick isInBorder(int x, int y);
+ BorderOffsets getBorderOffsets() { return _macBorder.getOffset(); }
protected:
ManagedSurface _borderSurface;
@@ -367,6 +368,7 @@ protected:
Common::Rect _innerDims;
Common::List<Common::Rect> _dirtyRects;
+ bool _hasScrollBar;
private:
MacWindowBorder _macBorder;
@@ -388,7 +390,6 @@ private:
Common::String _title;
- bool _hasScrollBar;
int _borderType;
};
diff --git a/graphics/macgui/macwindowborder.cpp b/graphics/macgui/macwindowborder.cpp
index 0ce235f65d..d91b3099a4 100644
--- a/graphics/macgui/macwindowborder.cpp
+++ b/graphics/macgui/macwindowborder.cpp
@@ -153,11 +153,11 @@ void MacWindowBorder::drawScrollBar(ManagedSurface *g, MacWindowManager *wm) {
// here, we first check the _scrollSize, and if it is negative, then we don't draw the scrollBar
if (_scrollSize < 0)
return;
- // currently, we are assuming that the width and height of the "border arrow" have the same size
- int size = kBorderWidth;
- int rx1 = g->w - size + 2;
- int ry1 = size + _scrollPos;
- int rx2 = rx1 + size - 5;
+ int width = _borderOffsets.right;
+ int height = _borderOffsets.upperScrollHeight;
+ int rx1 = g->w - width + 2;
+ int ry1 = height + _scrollPos;
+ int rx2 = rx1 + width - 5;
int ry2 = ry1 + _scrollSize ;
Common::Rect rr(rx1, ry1, rx2, ry2);
diff --git a/graphics/macgui/macwindowborder.h b/graphics/macgui/macwindowborder.h
index b43575378a..4dc8e1058e 100644
--- a/graphics/macgui/macwindowborder.h
+++ b/graphics/macgui/macwindowborder.h
@@ -55,6 +55,8 @@ struct BorderOffsets {
int titleBottom;
bool dark;
int titlePos;
+ int upperScrollHeight;
+ int lowerScrollHeight;
};
/**
Commit: c1c76311481280b04a2f03c7b609ea805cc54bbc
https://github.com/scummvm/scummvm/commit/c1c76311481280b04a2f03c7b609ea805cc54bbc
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
PINK: set the offsets for new logic of macgui
Changed paths:
engines/pink/objects/actions/action_text.cpp
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index 6358ae841a..baaff2a95e 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -165,8 +165,15 @@ void ActionText::loadBorder(Graphics::MacWindow *target, Common::String filename
Common::SeekableReadStream *stream = borderfile.readStream(borderfile.size());
if (stream) {
- // we don't have to pass border offsets here, because 9-patch will automatically calc it
- target->loadBorder(*stream, flags);
+ Graphics::BorderOffsets offsets;
+ offsets.top = 1;
+ offsets.bottom = 1;
+ offsets.left = 1;
+ offsets.right = 17;
+ offsets.lowerScrollHeight = 15;
+ offsets.upperScrollHeight = 17;
+ offsets.titlePos = 0;
+ target->loadBorder(*stream, flags, offsets);
borderfile.close();
Commit: 587772625ea84f27dc55d4a2720052853ec66ecb
https://github.com/scummvm/scummvm/commit/587772625ea84f27dc55d4a2720052853ec66ecb
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
WAGE: set the offsets for new logic of macgui
Changed paths:
engines/wage/gui.cpp
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 1b753fee23..8754eefc1b 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -332,22 +332,18 @@ void Gui::loadBorder(Graphics::MacWindow *target, Common::String filename, uint3
Common::SeekableReadStream *stream = borderfile.readStream(borderfile.size());
if (stream) {
- // if titlePos != 0, then we will draw title for that window
- // here, we draw title for scene window
- if (titlePos != 0) {
- Graphics::BorderOffsets offsets;
- offsets.left = 16;
- offsets.right = 16;
- offsets.top = 16;
- offsets.bottom = 16;
- offsets.titleTop = 0;
- offsets.titleBottom = 0;
- offsets.dark = false;
- offsets.titlePos = titlePos;
- target->loadBorder(*stream, flags, offsets);
- } else {
- target->loadBorder(*stream, flags);
- }
+ Graphics::BorderOffsets offsets;
+ offsets.left = 16;
+ offsets.right = 16;
+ offsets.top = 16;
+ offsets.bottom = 16;
+ offsets.titleTop = 0;
+ offsets.titleBottom = 0;
+ offsets.dark = false;
+ offsets.upperScrollHeight = 16;
+ offsets.lowerScrollHeight = 16;
+ offsets.titlePos = titlePos;
+ target->loadBorder(*stream, flags, offsets);
borderfile.close();
Commit: df895359cc6cdf2c8cda18e957de421fc8e988c7
https://github.com/scummvm/scummvm/commit/df895359cc6cdf2c8cda18e957de421fc8e988c7
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
PINK: modify the logic when we creating the mactextwindow
Changed paths:
engines/pink/objects/actions/action_text.cpp
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index baaff2a95e..5552e4ef4b 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -123,14 +123,11 @@ void ActionText::start() {
_txtWnd->appendText(_text, font);
// if the textHeight is smaller than the area we display the text, then we disable the scrollbar
if (_txtWnd->getTextHeight() < _txtWnd->getInnerDimensions().height()) {
- delete _txtWnd;
- _txtWnd = director->getWndManager().addTextWindow(font, _textColorIndex, _backgroundColorIndex,
- _xRight - _xLeft, align, nullptr, false);
+ _txtWnd->clearText();
+ _txtWnd->enableScrollbar(false);
_txtWnd->disableBorder();
_txtWnd->move(_xLeft, _yTop);
_txtWnd->resize(_xRight - _xLeft, _yBottom - _yTop);
- _txtWnd->setEditable(false);
- _txtWnd->setSelectable(false);
_txtWnd->appendText(_text, font);
}
director->addTextWindow(_txtWnd);
Commit: c317ca1900b9c30c930fa507745fc2f53faf2307
https://github.com/scummvm/scummvm/commit/c317ca1900b9c30c930fa507745fc2f53faf2307
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: load win95scrollbar border as default when enable win95 mode
Changed paths:
graphics/macgui/mactextwindow.cpp
graphics/macgui/macwindow.cpp
graphics/macgui/macwindow.h
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index a1aca69ced..18822952d0 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -78,6 +78,13 @@ MacTextWindow::MacTextWindow(MacWindowManager *wm, const MacFont *font, int fgco
if (cursorHandler)
g_system->getTimerManager()->installTimerProc(&cursorTimerHandler, 200000, this, "textWindowCursor");
+
+ if (_wm->_mode & kWMModeWin95) {
+ // in win95 mode, we set scrollbar as default
+ _hasScrollBar = true;
+ loadWin95Border("Win95BorderScrollbar.bmp", kWindowBorderScrollbar | kWindowBorderActive);
+ loadWin95Border("Win95BorderScrollbar.bmp",kWindowBorderScrollbar);
+ }
}
void MacTextWindow::resize(int w, int h, bool inner) {
diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp
index 41eb43c6b2..c970d804cc 100644
--- a/graphics/macgui/macwindow.cpp
+++ b/graphics/macgui/macwindow.cpp
@@ -514,6 +514,22 @@ void MacWindow::setBorderType(int borderType) {
}
}
+void MacWindow::loadWin95Border(const Common::String &filename, uint32 flags) {
+ Common::SeekableReadStream *stream = _wm->getFile(filename);
+ if (stream) {
+ Graphics::BorderOffsets offsets;
+ offsets.top = 1;
+ offsets.bottom = 1;
+ offsets.left = 1;
+ offsets.right = 17;
+ offsets.lowerScrollHeight = 15;
+ offsets.upperScrollHeight = 17;
+ offsets.titlePos = 0;
+ loadBorder(*stream, flags, offsets);
+ delete stream;
+ }
+}
+
void MacWindow::addDirtyRect(const Common::Rect &r) {
if (!r.isValidRect())
return;
diff --git a/graphics/macgui/macwindow.h b/graphics/macgui/macwindow.h
index 18b772533d..2b35abfc4e 100644
--- a/graphics/macgui/macwindow.h
+++ b/graphics/macgui/macwindow.h
@@ -304,6 +304,7 @@ public:
void loadBorder(Common::SeekableReadStream &file, uint32 flags, int lo = -1, int ro = -1, int to = -1, int bo = -1);
void loadBorder(Common::SeekableReadStream &file, uint32 flags, BorderOffsets offsets);
void disableBorder();
+ void loadWin95Border(const Common::String &filename, uint32 flags);
/**
* we better set this before we load the border
* @param scrollbar state
Commit: cd462ba7c7208bae563fb8afbe774949fce90bed
https://github.com/scummvm/scummvm/commit/cd462ba7c7208bae563fb8afbe774949fce90bed
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
PINK: delete loading border in pink, it will load in macgui automatically
Changed paths:
engines/pink/objects/actions/action_text.cpp
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index 5552e4ef4b..5cb0eec951 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -113,8 +113,6 @@ void ActionText::start() {
_txtWnd = director->getWndManager().addTextWindow(font, _textColorIndex, _backgroundColorIndex,
_xRight - _xLeft, align, nullptr, false);
_txtWnd->enableScrollbar(true);
- loadBorder(_txtWnd, "pink_border.bmp", Graphics::kWindowBorderScrollbar | Graphics::kWindowBorderActive);
- loadBorder(_txtWnd, "pink_border.bmp", Graphics::kWindowBorderScrollbar);
_txtWnd->move(_xLeft, _yTop);
_txtWnd->resize(_xRight - _xLeft, _yBottom - _yTop);
_txtWnd->setEditable(false);
@@ -152,32 +150,6 @@ void ActionText::end() {
}
}
-void ActionText::loadBorder(Graphics::MacWindow *target, Common::String filename, uint32 flags) {
- Common::File borderfile;
-
- if (!borderfile.open(filename)) {
- debug(1, "Cannot open border file");
- return;
- }
-
- Common::SeekableReadStream *stream = borderfile.readStream(borderfile.size());
- if (stream) {
- Graphics::BorderOffsets offsets;
- offsets.top = 1;
- offsets.bottom = 1;
- offsets.left = 1;
- offsets.right = 17;
- offsets.lowerScrollHeight = 15;
- offsets.upperScrollHeight = 17;
- offsets.titlePos = 0;
- target->loadBorder(*stream, flags, offsets);
-
- borderfile.close();
-
- delete stream;
- }
-}
-
void ActionText::draw(Graphics::ManagedSurface *surface) {
// alignment not working, thus we implement alignment for center manually
Graphics::TextAlign alignment = _centered ? Graphics::kTextAlignCenter : Graphics::kTextAlignLeft;
Commit: 98cb026f70d14955db6ad6df19a59c9dae6f8ff2
https://github.com/scummvm/scummvm/commit/98cb026f70d14955db6ad6df19a59c9dae6f8ff2
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: fix the behaviour when we enable win95 mode when drawing scrollbar
Changed paths:
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 18822952d0..3f3595d772 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -327,6 +327,10 @@ void MacTextWindow::calcScrollBar() {
maxScrollbar = getDimensions().height() - getBorderOffsets().upperScrollHeight - getBorderOffsets().lowerScrollHeight;
+ // if we enable the win95 mode but the text height is smaller than window height, then we don't draw the scrollbar
+ if (_wm->_mode & kWMModeWin95 && displayHeight > _mactext->getTextHeight())
+ return;
+
if (_editable)
maxText = _mactext->getTextHeight() + getInnerDimensions().height();
else
Commit: 549511c4b5b28ae4667c74ebc10fad666134e6fe
https://github.com/scummvm/scummvm/commit/549511c4b5b28ae4667c74ebc10fad666134e6fe
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: add rgb parameter for appendText, which makes mactext draws text with color, fix the logic when appending text
Changed paths:
graphics/macgui/mactext.cpp
graphics/macgui/mactext.h
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index a0e8d85f52..1c606f20e9 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -858,9 +858,13 @@ void MacText::resize(int w, int h) {
}
void MacText::appendText(const Common::U32String &str, int fontId, int fontSize, int fontSlant, bool skipAdd) {
+ appendText(str, fontId, fontSize, fontSlant, 0, 0, 0, skipAdd);
+}
+
+void MacText::appendText(const Common::U32String &str, int fontId, int fontSize, int fontSlant, uint16 r, uint16 g, uint16 b, bool skipAdd) {
uint oldLen = _textLines.size();
- MacFontRun fontRun = MacFontRun(_wm, fontId, fontSlant, fontSize, 0, 0, 0);
+ MacFontRun fontRun = MacFontRun(_wm, fontId, fontSlant, fontSize, r, g, b);
_currentFormatting = fontRun;
@@ -873,12 +877,14 @@ void MacText::appendText(const Common::U32String &str, int fontId, int fontSize,
}
}
+ // we need to split the string with the font, in order to get the correct font
+ Common::U32String strWithFont = Common::U32String(fontRun.toString()) + str;
+
if (!skipAdd) {
- _str += fontRun.toString();
- _str += str;
+ _str += strWithFont;
}
- splitString(str);
+ splitString(strWithFont);
recalcDims();
render(oldLen - 1, _textLines.size());
@@ -903,12 +909,12 @@ void MacText::appendTextDefault(const Common::U32String &str, bool skipAdd) {
uint oldLen = _textLines.size();
_currentFormatting = _defaultFormatting;
+ Common::U32String strWithFont = Common::U32String(_defaultFormatting.toString()) + str;
if (!skipAdd) {
- _str += _defaultFormatting.toString();
- _str += str;
+ _str += strWithFont;
}
- splitString(str);
+ splitString(strWithFont);
recalcDims();
render(oldLen - 1, _textLines.size());
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index 36c0c03cd6..6097e0c167 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -175,6 +175,7 @@ public:
void appendText(const Common::U32String &str, int fontId = kMacFontChicago, int fontSize = 12, int fontSlant = kMacFontRegular, bool skipAdd = false);
void appendText(const Common::String &str, int fontId = kMacFontChicago, int fontSize = 12, int fontSlant = kMacFontRegular, bool skipAdd = false);
+ void appendText(const Common::U32String &str, int fontId = kMacFontChicago, int fontSize = 12, int fontSlant = kMacFontRegular, uint16 r = 0, uint16 g = 0, uint16 b = 0, bool skipAdd = false);
void appendTextDefault(const Common::U32String &str, bool skipAdd = false);
void appendTextDefault(const Common::String &str, bool skipAdd = false);
void clearText();
@@ -202,6 +203,7 @@ public:
void setSelection(int pos, bool start);
Common::U32String getEditedString();
+ Common::U32String getText() { return _str; }
private:
void init();
Commit: fb7ed6f84533c604d9448cc217c61ad061a58656
https://github.com/scummvm/scummvm/commit/fb7ed6f84533c604d9448cc217c61ad061a58656
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: add textRGB for mactextwindow to suit new logic of mactext when drawing the text with color. add window feature DynamicScrollbar
Changed paths:
graphics/macgui/mactextwindow.cpp
graphics/macgui/mactextwindow.h
graphics/macgui/macwindow.cpp
graphics/macgui/macwindow.h
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 3f3595d772..dd6d52ef10 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -76,6 +76,8 @@ MacTextWindow::MacTextWindow(MacWindowManager *wm, const MacFont *font, int fgco
_cursorSurface = new ManagedSurface(1, kCursorHeight);
_cursorSurface->fillRect(*_cursorRect, _wm->_colorBlack);
+ _textColorRGB = 0;
+
if (cursorHandler)
g_system->getTimerManager()->installTimerProc(&cursorTimerHandler, 200000, this, "textWindowCursor");
@@ -103,7 +105,11 @@ void MacTextWindow::appendText(const Common::U32String &str, const MacFont *macF
// the reason we put undrawInput here before appendText, is we don't want the appended text affect our input
// thus, we first delete all of out input, and we append new text, and we redraw the input
undrawInput();
- _mactext->appendText(str, macFont->getId(), macFont->getSize(), macFont->getSlant(), skipAdd);
+ // we calc the rgb though fgcolor
+ uint16 red = (_textColorRGB >> 16) & 0xFF;
+ uint16 green = (_textColorRGB >> 8) & 0xFF;
+ uint16 blue = (_textColorRGB) & 0xFF;
+ _mactext->appendText(str, macFont->getId(), macFont->getSize(), macFont->getSlant(), red, green, blue, skipAdd);
_contentIsDirty = true;
_inputIsDirty = true; //force it to redraw input
@@ -116,6 +122,25 @@ void MacTextWindow::appendText(const Common::U32String &str, const MacFont *macF
if (_wm->_mode & kWMModeWin95)
calcScrollBar();
+ // if we enable the dynamic scrollbar, and the text height is smaller than window height, then we disable the border
+ // if the window is editable, then we don't disable the border, because in editable window, the area you scroll is always bigger
+ // than the window
+ if (!_editable && (_mode & kWindowModeDynamicScrollbar) && _mactext->getTextHeight() < getInnerDimensions().height()) {
+ int w = getDimensions().width();
+ int h = getDimensions().height();
+ enableScrollbar(false);
+ disableBorder();
+ resize(w, h);
+ _mactext->_fullRefresh = true;
+ }
+ // if the text height is bigger than the window, then we enable the scrollbar again
+ if (!_editable && (_mode & kWindowModeDynamicScrollbar) && _mactext->getTextHeight() > getInnerDimensions().height()) {
+ enableScrollbar(true);
+ int w = getDimensions().width();
+ int h = getDimensions().height();
+ resize(w, h);
+ _mactext->_fullRefresh = true;
+ }
}
void MacTextWindow::appendText(const Common::String &str, const MacFont *macFont, bool skipAdd) {
@@ -515,6 +540,9 @@ void MacTextWindow::undrawInput() {
}
void MacTextWindow::drawInput() {
+ if (!_editable)
+ return;
+
int oldLen = _mactext->getLineCount() - _inputTextHeight;
// add new input line to the text
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
index 74fb724d5d..d90e593d89 100644
--- a/graphics/macgui/mactextwindow.h
+++ b/graphics/macgui/mactextwindow.h
@@ -64,6 +64,12 @@ public:
const SelectedText *getSelectedText() { return &_selectedText; }
int getTextHeight() { return _mactext->getTextHeight(); }
+ /**
+ * if we want to draw the text which color is not black, then we need to set _textColorRGB
+ * @param rgb text color you want to draw
+ */
+ void setTextColorRGB (uint32 rgb) { _textColorRGB = rgb; }
+
private:
bool isCutAllowed();
@@ -108,6 +114,7 @@ private:
MacMenu *_menu;
int _bgcolor;
+ int _textColorRGB;
};
} // End of namespace Graphics
diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp
index c970d804cc..5138353f0b 100644
--- a/graphics/macgui/macwindow.cpp
+++ b/graphics/macgui/macwindow.cpp
@@ -71,6 +71,8 @@ MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, Mac
_macBorder.setWindow(this);
_hasScrollBar = false;
+
+ _mode = 0;
}
void MacWindow::disableBorder() {
diff --git a/graphics/macgui/macwindow.h b/graphics/macgui/macwindow.h
index 2b35abfc4e..f5f0393765 100644
--- a/graphics/macgui/macwindow.h
+++ b/graphics/macgui/macwindow.h
@@ -62,6 +62,10 @@ enum WindowClick {
kBorderBorder,
kBorderResizeButton
};
+
+enum {
+ kWindowModeDynamicScrollbar = 1 << 0
+};
}
using namespace MacWindowConstants;
@@ -344,6 +348,8 @@ public:
void setBorderDirty(bool dirty) { _borderIsDirty = true; }
void resizeBorderSurface();
+ void setMode(uint32 mode) { _mode = mode; }
+
private:
void drawBorderFromSurface(ManagedSurface *g, uint32 flags);
void drawPattern();
@@ -371,6 +377,7 @@ protected:
Common::List<Common::Rect> _dirtyRects;
bool _hasScrollBar;
+ uint32 _mode;
private:
MacWindowBorder _macBorder;
Commit: 7da28dfc150a294b19d1b0f0d131bd24d9756dfa
https://github.com/scummvm/scummvm/commit/7da28dfc150a294b19d1b0f0d131bd24d9756dfa
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
PINK: modify action_text to suit for new macgui, move dynamic scrollbar to macgui
Changed paths:
engines/pink/objects/actions/action_text.cpp
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index 5cb0eec951..f5bc9d5f6d 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -112,22 +112,16 @@ void ActionText::start() {
Graphics::MacFont *font = new Graphics::MacFont;
_txtWnd = director->getWndManager().addTextWindow(font, _textColorIndex, _backgroundColorIndex,
_xRight - _xLeft, align, nullptr, false);
+ _txtWnd->setTextColorRGB(_textRGB);
_txtWnd->enableScrollbar(true);
+ // it will hide the scrollbar when the text height is smaller than the window height
+ _txtWnd->setMode(Graphics::kWindowModeDynamicScrollbar);
_txtWnd->move(_xLeft, _yTop);
_txtWnd->resize(_xRight - _xLeft, _yBottom - _yTop);
_txtWnd->setEditable(false);
_txtWnd->setSelectable(false);
_txtWnd->appendText(_text, font);
- // if the textHeight is smaller than the area we display the text, then we disable the scrollbar
- if (_txtWnd->getTextHeight() < _txtWnd->getInnerDimensions().height()) {
- _txtWnd->clearText();
- _txtWnd->enableScrollbar(false);
- _txtWnd->disableBorder();
- _txtWnd->move(_xLeft, _yTop);
- _txtWnd->resize(_xRight - _xLeft, _yBottom - _yTop);
- _txtWnd->appendText(_text, font);
- }
director->addTextWindow(_txtWnd);
} else {
Commit: ac9e312895905f0ed7b107abcd1444b82964b0cf
https://github.com/scummvm/scummvm/commit/ac9e312895905f0ed7b107abcd1444b82964b0cf
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: remove pink border, add Win95BorderScrollbar to macgui.dat
Changed paths:
R devtools/create_pink/pink_border.bmp
dists/engine-data/macgui.dat
diff --git a/devtools/create_pink/pink_border.bmp b/devtools/create_pink/pink_border.bmp
deleted file mode 100644
index d2826e27f1..0000000000
Binary files a/devtools/create_pink/pink_border.bmp and /dev/null differ
diff --git a/dists/engine-data/macgui.dat b/dists/engine-data/macgui.dat
index 24872936ff..b923ed8235 100644
Binary files a/dists/engine-data/macgui.dat and b/dists/engine-data/macgui.dat differ
Commit: 9c9b553d7a62568c50048192793f39796173c1c2
https://github.com/scummvm/scummvm/commit/9c9b553d7a62568c50048192793f39796173c1c2
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-25T02:24:15+02:00
Commit Message:
GRAPHICS: MACGUI: fix the logic when calc the coordinate of scrollbar
Changed paths:
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index dd6d52ef10..80557d7fdf 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -353,7 +353,7 @@ void MacTextWindow::calcScrollBar() {
maxScrollbar = getDimensions().height() - getBorderOffsets().upperScrollHeight - getBorderOffsets().lowerScrollHeight;
// if we enable the win95 mode but the text height is smaller than window height, then we don't draw the scrollbar
- if (_wm->_mode & kWMModeWin95 && displayHeight > _mactext->getTextHeight())
+ if (_wm->_mode & kWMModeWin95 && displayHeight > _mactext->getTextHeight() && !_editable)
return;
if (_editable)
More information about the Scummvm-git-logs
mailing list