GRAPHICS: MACGUI: Add no-border scrollbar, Win95 Border Refactored

Win95 scrollbar loading is refactored to use existing `borders` array
in `datafiles.cpp`, Added no-border scrollbar for MacOS, Win95.

This is to support scrollable text cast members in Director, which
will be used by `totaldistortion-win` game.
--start-movie="ATD\HD\bbTWRFL2.DXR@392" totaldistortion-win
This commit is contained in:
Harishankar Kumar 2023-07-21 22:16:52 +05:30 committed by Eugene Sandulenko
parent 51a8c3bc14
commit f3a6c27df6
11 changed files with 32 additions and 36 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

View File

@ -43,24 +43,27 @@ struct BorderName {
};
static const BorderName borders[] = {
{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}}
{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}},
{0x7F, "Win95BorderScrollbar", { 1, 17, 1, 1, 1, 1, true, 25, 15, 17}},
{0x80, "Win95NoBorderScrollbar",{ 1, 17, 1, 1, 1, 1, true, 25, 15, 17}},
{0x81, "MacOSNoBorderScrollbar",{ 1, 17, 1, 1, 1, 1, true, 25, 17, 17}},
{0xFF, "No type", {-1, -1, -1, -1, -1, -1, false, 0, 0, 0}}
};
Common::String windowTypeName(byte windowType) {

View File

@ -94,8 +94,8 @@ void MacTextWindow::init(bool cursorHandler) {
if (_wm->_mode & kWMModeWin95) {
// in win95 mode, we set scrollbar as default
_hasScrollBar = true;
loadWin95Border("Win95BorderScrollbar.bmp", kWindowBorderScrollbar | kWindowBorderActive);
loadWin95Border("Win95BorderScrollbar.bmp",kWindowBorderScrollbar);
setBorderType(kWinBorderWin95Scrollbar);
loadInternalBorder(kWindowBorderScrollbar | kWindowBorderActive);
}
}

View File

@ -569,21 +569,8 @@ 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;
offsets.titleTop = 0;
loadBorder(*stream, flags, offsets);
delete stream;
}
void MacWindow::loadInternalBorder(uint32 flags) {
_macBorder.loadInternalBorder(flags);
}
void MacWindow::addDirtyRect(const Common::Rect &r) {

View File

@ -334,7 +334,7 @@ public:
void loadBorder(Common::SeekableReadStream &file, uint32 flags, BorderOffsets offsets);
void setBorder(Graphics::TransparentSurface *surface, uint32 flags, BorderOffsets offsets);
void disableBorder();
void loadWin95Border(const Common::String &filename, uint32 flags);
void loadInternalBorder(uint32 flags);
/**
* we better set this before we load the border
* @param scrollbar state

View File

@ -45,6 +45,12 @@ enum {
kWindowBorderMaxFlag = 1 << 3
};
enum {
kWinBorderWin95Scrollbar = 0x7F,
kWindowBorderWin95NoBorderScrollbar,
kWindowBorderMacOSNoBorderScrollbar
};
struct BorderOffsets {
int left;
int right;