GRAPHICS: MACGUI: Add border types
BIN
devtools/create_macgui/RoundClose_act.bmp
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
devtools/create_macgui/RoundClose_inac.bmp
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
devtools/create_macgui/StandardCloseZoom_act.bmp
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
devtools/create_macgui/StandardCloseZoom_inac.bmp
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
devtools/create_macgui/StandardClose_act.bmp
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
devtools/create_macgui/StandardClose_inac.bmp
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
devtools/create_macgui/Standard_act.bmp
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
devtools/create_macgui/Standard_inac.bmp
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
devtools/create_macgui/ThickNoTitle_act.bmp
Normal file
After Width: | Height: | Size: 738 B |
BIN
devtools/create_macgui/ThickNoTitle_inac.bmp
Normal file
After Width: | Height: | Size: 738 B |
BIN
devtools/create_macgui/ThickZoom_act.bmp
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
devtools/create_macgui/ThickZoom_inac.bmp
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
devtools/create_macgui/Thick_act.bmp
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
devtools/create_macgui/Thick_inac.bmp
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
devtools/create_macgui/ThinNoTitleShadow_act.bmp
Normal file
After Width: | Height: | Size: 374 B |
BIN
devtools/create_macgui/ThinNoTitleShadow_inac.bmp
Normal file
After Width: | Height: | Size: 374 B |
BIN
devtools/create_macgui/ThinNoTitle_act.bmp
Normal file
After Width: | Height: | Size: 242 B |
BIN
devtools/create_macgui/ThinNoTitle_inac.bmp
Normal file
After Width: | Height: | Size: 242 B |
8
devtools/create_macgui/create_macgui.sh
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
printf "Creating border file...\n"
|
||||||
|
|
||||||
|
zip -r macgui.zip *.bmp
|
||||||
|
mv macgui.zip macgui.dat
|
||||||
|
|
||||||
|
echo done
|
||||||
|
|
||||||
|
ls -l macgui.dat
|
118
graphics/macgui/datafiles.cpp
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
/* ScummVM - Graphic Adventure Engine
|
||||||
|
*
|
||||||
|
* ScummVM is the legal property of its developers, whose names
|
||||||
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||||
|
* file distributed with this source distribution.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Based on MacVenture engine, based on
|
||||||
|
* WebVenture (c) 2010, Sean Kasun
|
||||||
|
* https://github.com/mrkite/webventure, http://seancode.com/webventure/
|
||||||
|
*
|
||||||
|
* Used with explicit permission from the author
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "graphics/macgui/macwindowmanager.h"
|
||||||
|
|
||||||
|
#include "common/archive.h"
|
||||||
|
#include "common/unzip.h"
|
||||||
|
|
||||||
|
namespace Graphics {
|
||||||
|
|
||||||
|
#define MACGUI_DATA_BUNDLE Common::String("macgui.dat")
|
||||||
|
|
||||||
|
struct BorderName {
|
||||||
|
byte type;
|
||||||
|
const char *name;
|
||||||
|
int lo;
|
||||||
|
int ro;
|
||||||
|
int to;
|
||||||
|
int bo;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const BorderName borders[] = {
|
||||||
|
{0x00, "StandardClose", 1, 2, 20, 2},
|
||||||
|
{0x01, "ThickNoTitle", 5, 5, 5, 5},
|
||||||
|
{0x02, "ThinNoTitle", 1, 1, 1, 1},
|
||||||
|
{0x03, "ThinNoTitleShadow", 1, 3, 1, 3},
|
||||||
|
{0x04, "StandardClose", 1, 2, 20, 2},
|
||||||
|
{0x05, "Thick", 5, 5, 20, 5},
|
||||||
|
{0x06, "ThinNoTitle", 1, 1, 1, 1},
|
||||||
|
{0x07, "ThinNoTitleShadow", 1, 3, 1, 3},
|
||||||
|
{0x08, "StandardCloseZoom", 1, 2, 20, 2},
|
||||||
|
{0x09, "ThickZoom", 5, 5, 20, 5},
|
||||||
|
{0x0A, "ThinNoTitle", 1, 1, 1, 1},
|
||||||
|
{0x0B, "ThinkNoTitleShadow", 1, 3, 1, 3},
|
||||||
|
{0x0C, "StandardCloseZoom", 1, 2, 20, 2},
|
||||||
|
{0x0D, "ThickZoom", 5, 5, 20, 5},
|
||||||
|
{0x0E, "ThinNoTitle", 1, 1, 1, 1},
|
||||||
|
{0x0F, "ThinNoTitleShadow", 1, 3, 1, 3},
|
||||||
|
{0x10, "RoundClose", 1, 1, 19, 6},
|
||||||
|
{0xFF, "No type", -1, -1, -1, -1}
|
||||||
|
};
|
||||||
|
|
||||||
|
Common::String windowTypeName(byte windowType) {
|
||||||
|
int i = 0;
|
||||||
|
while (borders[i].type != 0xFF) {
|
||||||
|
if (borders[i].type == windowType) {
|
||||||
|
return borders[i].name;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return "ThinNoTitle";
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacWindowManager::loadDataBundle() {
|
||||||
|
_dataBundle = Common::makeZipArchive(MACGUI_DATA_BUNDLE);
|
||||||
|
if (!_dataBundle) {
|
||||||
|
warning("MACGUI: Couldn't load data bundle '%s'.", MACGUI_DATA_BUNDLE.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Common::Rect MacWindowManager::getBorderOffsets(byte windowType) {
|
||||||
|
int i = 0;
|
||||||
|
while (borders[i].type != 0xFF) {
|
||||||
|
if (borders[i].type == windowType) {
|
||||||
|
Common::Rect offsets;
|
||||||
|
offsets.left = borders[i].lo;
|
||||||
|
offsets.right = borders[i].ro;
|
||||||
|
offsets.top = borders[i].to;
|
||||||
|
offsets.bottom = borders[i].bo;
|
||||||
|
return offsets;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return Common::Rect(-1, -1, -1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Common::SeekableReadStream *MacWindowManager::getBorderFile(byte windowType, bool isActive) {
|
||||||
|
if (!_dataBundle)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
Common::String filename = windowTypeName(windowType);
|
||||||
|
filename += (isActive ? "_act.bmp" : "_inac.bmp");
|
||||||
|
if (!_dataBundle->hasFile(filename)) {
|
||||||
|
warning("Missing border file '%s' in data bundle", filename.c_str());
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _dataBundle->createReadStreamForMember(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // End of namespace Graphics
|
|
@ -67,6 +67,7 @@ MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, Mac
|
||||||
|
|
||||||
_closeable = false;
|
_closeable = false;
|
||||||
|
|
||||||
|
_borderType = -1;
|
||||||
_borderWidth = kBorderWidth;
|
_borderWidth = kBorderWidth;
|
||||||
|
|
||||||
_titleVisible = true;
|
_titleVisible = true;
|
||||||
|
@ -580,4 +581,25 @@ bool MacWindow::processEvent(Common::Event &event) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacWindow::setBorderType(int borderType) {
|
||||||
|
_borderType = borderType;
|
||||||
|
if (borderType < 0) {
|
||||||
|
disableBorder();
|
||||||
|
} else {
|
||||||
|
Common::Rect offsets = _wm->getBorderOffsets(borderType);
|
||||||
|
|
||||||
|
Common::SeekableReadStream *activeFile = _wm->getBorderFile(borderType, true);
|
||||||
|
if (activeFile) {
|
||||||
|
loadBorder(*activeFile, true, offsets.left, offsets.right, offsets.top, offsets.bottom);
|
||||||
|
delete activeFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
Common::SeekableReadStream *inactiveFile = _wm->getBorderFile(borderType, false);
|
||||||
|
if (inactiveFile) {
|
||||||
|
loadBorder(*inactiveFile, false, offsets.left, offsets.right, offsets.top, offsets.bottom);
|
||||||
|
delete inactiveFile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Graphics
|
} // End of namespace Graphics
|
||||||
|
|
|
@ -293,6 +293,17 @@ public:
|
||||||
*/
|
*/
|
||||||
void setCloseable(bool closeable);
|
void setCloseable(bool closeable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mutator to change the border type.
|
||||||
|
* @param borderType Border type.
|
||||||
|
*/
|
||||||
|
void setBorderType(int borderType);
|
||||||
|
/**
|
||||||
|
* Accessor to get the border type.
|
||||||
|
* @return Border type.
|
||||||
|
*/
|
||||||
|
int getBorderType() { return _borderType; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void prepareBorderSurface(ManagedSurface *g);
|
void prepareBorderSurface(ManagedSurface *g);
|
||||||
void drawSimpleBorder(ManagedSurface *g);
|
void drawSimpleBorder(ManagedSurface *g);
|
||||||
|
@ -339,6 +350,8 @@ private:
|
||||||
|
|
||||||
Common::String _title;
|
Common::String _title;
|
||||||
bool _titleVisible;
|
bool _titleVisible;
|
||||||
|
|
||||||
|
int _borderType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,8 @@ MacWindowManager::MacWindowManager(uint32 mode, MacPatterns *patterns) {
|
||||||
CursorMan.replaceCursorPalette(palette, 0, ARRAYSIZE(palette) / 3);
|
CursorMan.replaceCursorPalette(palette, 0, ARRAYSIZE(palette) / 3);
|
||||||
CursorMan.replaceCursor(macCursorArrow, 11, 16, 1, 1, 3);
|
CursorMan.replaceCursor(macCursorArrow, 11, 16, 1, 1, 3);
|
||||||
CursorMan.showMouse(true);
|
CursorMan.showMouse(true);
|
||||||
|
|
||||||
|
loadDataBundle();
|
||||||
}
|
}
|
||||||
|
|
||||||
MacWindowManager::~MacWindowManager() {
|
MacWindowManager::~MacWindowManager() {
|
||||||
|
|
|
@ -33,6 +33,10 @@
|
||||||
|
|
||||||
#include "engines/engine.h"
|
#include "engines/engine.h"
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
|
class Archive;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
|
|
||||||
namespace MacGUIConstants {
|
namespace MacGUIConstants {
|
||||||
|
@ -283,6 +287,10 @@ public:
|
||||||
|
|
||||||
void removeMarked();
|
void removeMarked();
|
||||||
|
|
||||||
|
void loadDataBundle();
|
||||||
|
Common::Rect getBorderOffsets(byte windowType);
|
||||||
|
Common::SeekableReadStream *getBorderFile(byte windowType, bool isActive);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MacFontManager *_fontMan;
|
MacFontManager *_fontMan;
|
||||||
uint32 _mode;
|
uint32 _mode;
|
||||||
|
@ -344,6 +352,8 @@ private:
|
||||||
|
|
||||||
Common::Array<ZoomBox *> _zoomBoxes;
|
Common::Array<ZoomBox *> _zoomBoxes;
|
||||||
Common::HashMap<uint32, uint> _colorHash;
|
Common::HashMap<uint32, uint> _colorHash;
|
||||||
|
|
||||||
|
Common::Archive *_dataBundle;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End of namespace Graphics
|
} // End of namespace Graphics
|
||||||
|
|
|
@ -14,6 +14,7 @@ MODULE_OBJS := \
|
||||||
fonts/winfont.o \
|
fonts/winfont.o \
|
||||||
larryScale.o \
|
larryScale.o \
|
||||||
maccursor.o \
|
maccursor.o \
|
||||||
|
macgui/datafiles.o \
|
||||||
macgui/macbutton.o \
|
macgui/macbutton.o \
|
||||||
macgui/macfontmanager.o \
|
macgui/macfontmanager.o \
|
||||||
macgui/macmenu.o \
|
macgui/macmenu.o \
|
||||||
|
|