SCI: Rework the way SciGUIwindowMgr keeps track of windows/ports; remove the GUI heapmanager
svn-id: r44635
This commit is contained in:
parent
f242266f6d
commit
db2e5a4fb5
10 changed files with 88 additions and 586 deletions
|
@ -31,7 +31,6 @@
|
|||
#include "sci/gui/gui_screen.h"
|
||||
#include "sci/gui/gui_gfx.h"
|
||||
#include "sci/gui/gui_windowmgr.h"
|
||||
#include "sci/gui/gui_memmgr.h"
|
||||
#include "sci/gui/gui_view.h"
|
||||
|
||||
#include "sci/gfx/operations.h"
|
||||
|
@ -71,10 +70,14 @@ void SciGUI::wait(int16 ticks) {
|
|||
|
||||
void SciGUI::setPort(uint16 portPtr) {
|
||||
switch (portPtr) {
|
||||
case 0: _gfx->SetPort(_windowMgr->_wmgrPort); break;
|
||||
case 0xFFFF: _gfx->SetPort(_gfx->_menuPort); break;
|
||||
default:
|
||||
_gfx->SetPort((GUIPort *)heap2Ptr(portPtr));
|
||||
case 0:
|
||||
_gfx->SetPort(_windowMgr->_wmgrPort);
|
||||
break;
|
||||
case 0xFFFF:
|
||||
_gfx->SetPort(_gfx->_menuPort);
|
||||
break;
|
||||
default:
|
||||
_gfx->SetPort(_windowMgr->getPortById(portPtr));
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -87,7 +90,7 @@ void SciGUI::setPortPic(Common::Rect rect, int16 picTop, int16 picLeft) {
|
|||
}
|
||||
|
||||
reg_t SciGUI::getPort() {
|
||||
return make_reg(0, ptr2heap((byte *)_gfx->GetPort()));
|
||||
return make_reg(0, _gfx->GetPort()->id);
|
||||
}
|
||||
|
||||
void SciGUI::globalToLocal(int16 *x, int16 *y) {
|
||||
|
@ -112,23 +115,25 @@ reg_t SciGUI::newWindow(Common::Rect dims, Common::Rect restoreRect, uint16 styl
|
|||
wnd->penClr = colorPen;
|
||||
wnd->backClr = colorBack;
|
||||
_windowMgr->DrawWindow(wnd);
|
||||
return make_reg(0, ptr2heap((byte *)wnd));
|
||||
|
||||
return make_reg(0, wnd->id);
|
||||
}
|
||||
|
||||
void SciGUI::disposeWindow(uint16 windowPtr, int16 arg2) {
|
||||
GUIWindow *wnd = (GUIWindow *)heap2Ptr(windowPtr);
|
||||
GUIWindow *wnd = (GUIWindow *)_windowMgr->getPortById(windowPtr);
|
||||
_windowMgr->DisposeWindow(wnd, arg2);
|
||||
}
|
||||
|
||||
void SciGUI::display(const char *text, int argc, reg_t *argv) {
|
||||
int displayArg;
|
||||
GUIPort oldPort;
|
||||
int16 align = 0;
|
||||
int16 bgcolor = -1, width = -1, bRedraw = 1;
|
||||
byte bSaveUnder = false;
|
||||
Common::Rect rect, *orect = &((GUIWindow *)_gfx->GetPort())->dims;
|
||||
|
||||
memcpy(&oldPort, _gfx->GetPort(), sizeof(GUIPort));
|
||||
// Make a "backup" of the port settings
|
||||
GUIPort oldPort = *_gfx->GetPort();
|
||||
|
||||
// setting defaults
|
||||
_gfx->PenMode(0);
|
||||
_gfx->PenColor(0);
|
||||
|
@ -203,7 +208,7 @@ void SciGUI::display(const char *text, int argc, reg_t *argv) {
|
|||
GUIPort *currport = _gfx->GetPort();
|
||||
uint16 tTop = currport->curTop;
|
||||
uint16 tLeft = currport->curLeft;
|
||||
memcpy(currport, &oldPort, sizeof(GUIPort));
|
||||
*currport = oldPort;
|
||||
currport->curTop = tTop;
|
||||
currport->curLeft = tLeft;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue