GLK: FROTZ: Hooked up window property reading

This commit is contained in:
Paul Gilbert 2019-01-03 14:16:34 -08:00
parent df74a209ca
commit 642efa7f6a
2 changed files with 23 additions and 27 deletions

View file

@ -178,18 +178,16 @@ void Processor::z_set_margins() {
} }
void Processor::z_move_window(void) { void Processor::z_move_window(void) {
zword win = winarg0();
flush_buffer(); flush_buffer();
zword win = winarg0();
_wp[win].setPosition(Point(zargs[2], zargs[1])); _wp[win].setPosition(Point(zargs[2], zargs[1]));
} }
void Processor::z_window_size() { void Processor::z_window_size() {
zword win = winarg0();
flush_buffer(); flush_buffer();
zword win = winarg0();
_wp[win].setSize(Point(zargs[2], zargs[1])); _wp[win].setSize(Point(zargs[2], zargs[1]));
} }
@ -220,28 +218,15 @@ void Processor::z_window_style() {
} }
void Processor::z_get_wind_prop() { void Processor::z_get_wind_prop() {
#ifdef TODO
flush_buffer(); flush_buffer();
if (zargs[1] < 16) zword win = winarg0();
store(((zword *)(wp + winarg0()))[zargs[1]]); zword prop = zargs[1];
else if (zargs[1] == 16) if (prop <= TRUE_BG_COLOR)
store(os_to_true_colour(lo(wp[winarg0()].colour))); store(_wp[win][(WindowProperty)prop]);
else if (zargs[1] == 17) {
zword bg = hi(wp[winarg0()].colour);
if (bg == TRANSPARENT_COLOUR)
store((zword)-4);
else
store(os_to_true_colour(bg));
}
else else
runtimeError(ERR_ILL_WIN_PROP); runtimeError(ERR_ILL_WIN_PROP);
#endif
} }
void Processor::z_put_wind_prop() { void Processor::z_put_wind_prop() {

View file

@ -46,7 +46,6 @@ Window &Windows::operator[](uint idx) {
Window::Window() : _windows(nullptr), _win(nullptr), _tempVal(0) {} Window::Window() : _windows(nullptr), _win(nullptr), _tempVal(0) {}
winid_t Window::getWindow() { winid_t Window::getWindow() {
if (!_win) { if (!_win) {
// Window doesn't exist, so create it // Window doesn't exist, so create it
@ -94,24 +93,36 @@ uint16 Window::getProperty(WindowProperty propType) {
switch (propType) { switch (propType) {
case Y_POS: case Y_POS:
return win->_bbox.top; return win->_bbox.top / g_conf->_monoInfo._cellH;
case X_POS: case X_POS:
return win->_bbox.left; return win->_bbox.left / g_conf->_monoInfo._cellW;
case Y_SIZE: case Y_SIZE:
return win->_bbox.height(); return win->_bbox.height() / g_conf->_monoInfo._cellH;
case X_SIZE: case X_SIZE:
return win->_bbox.width(); return win->_bbox.width() / g_conf->_monoInfo._cellW;
case Y_CURSOR: case Y_CURSOR:
return win->getCursor().y; return win->getCursor().y;
case X_CURSOR: case X_CURSOR:
return win->getCursor().x; return win->getCursor().x;
default: default:
error("Read of an unimplemented property"); error("Read of an unimplemented property");
/* /*
LEFT_MARGIN = 6, RIGHT_MARGIN = 7, NEWLINE_INTERRUPT = 8, INTERRUPT_COUNTDOWN = 9, LEFT_MARGIN = 6, RIGHT_MARGIN = 7, NEWLINE_INTERRUPT = 8, INTERRUPT_COUNTDOWN = 9,
TEXT_STYLE = 10, COLOUR_DATA = 11, FONT_NUMBER = 12, FONT_SIZE = 13, ATTRIBUTES = 14, TEXT_STYLE = 10, COLOUR_DATA = 11, FONT_NUMBER = 12, FONT_SIZE = 13, ATTRIBUTES = 14,
LINE_COUNT = 15, TRUE_FG_COLOR = 16, TRUE_BG_COLOR = 17 LINE_COUNT = 15, TRUE_FG_COLOR = 16, TRUE_BG_COLOR = 17
*/
case TRUE_FG_COLOR:
store(os_to_true_colour(lo(wp[winarg0()].colour)));
case TRUE_BG_COLOR:
zword bg = hi(wp[winarg0()].colour);
if (bg == TRANSPARENT_COLOUR)
store((zword)-4);
else
store(os_to_true_colour(bg));
*/
} }
} }