2004-06-11 00:57:20 +04:00
|
|
|
/*
|
2006-12-04 01:34:26 +03:00
|
|
|
* Copyright 2006 James Bursa <bursa@users.sourceforge.net>
|
2010-04-10 03:22:30 +04:00
|
|
|
* Copyright 2010 Michael Drake <tlsa@netsurf-browser.org>
|
2007-08-08 20:16:03 +04:00
|
|
|
*
|
|
|
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
|
|
|
*
|
|
|
|
* NetSurf 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; version 2 of the License.
|
|
|
|
*
|
|
|
|
* NetSurf 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, see <http://www.gnu.org/licenses/>.
|
2004-06-11 00:57:20 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
* Debug display window (implementation).
|
|
|
|
*/
|
|
|
|
|
2004-08-08 15:39:31 +04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2004-06-11 00:57:20 +04:00
|
|
|
#include "oslib/wimp.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "content/content.h"
|
2010-04-10 03:22:30 +04:00
|
|
|
#include "desktop/plotters.h"
|
|
|
|
#include "desktop/knockout.h"
|
|
|
|
#include "render/font.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "riscos/dialog.h"
|
|
|
|
#include "riscos/wimp_event.h"
|
|
|
|
#include "utils/log.h"
|
|
|
|
#include "utils/talloc.h"
|
|
|
|
#include "utils/utils.h"
|
2004-06-11 00:57:20 +04:00
|
|
|
|
2010-04-06 02:17:03 +04:00
|
|
|
/* Define to enable debug window */
|
|
|
|
#undef ENABLE_DEBUGWIN
|
|
|
|
|
2004-06-21 19:09:59 +04:00
|
|
|
/** Update interval / cs. */
|
|
|
|
#define DEBUGWIN_UPDATE 500
|
2004-06-11 00:57:20 +04:00
|
|
|
|
2010-04-06 02:17:03 +04:00
|
|
|
#ifdef ENABLE_DEBUGWIN
|
2004-06-11 00:57:20 +04:00
|
|
|
static void ro_gui_debugwin_resize(void);
|
|
|
|
static void ro_gui_debugwin_update(void *p);
|
2005-12-31 07:40:49 +03:00
|
|
|
static void ro_gui_debugwin_close(wimp_w w);
|
|
|
|
static void ro_gui_debugwin_redraw(wimp_draw *redraw);
|
2010-04-10 03:22:30 +04:00
|
|
|
|
|
|
|
|
|
|
|
/* Non RISC OS specific stuff */
|
|
|
|
#define DEBUGWIN_TEXT_HEIGHT 16
|
|
|
|
#define DEBUGWIN_CELL_PADDING 3
|
|
|
|
#define DEBUGWIN_WINDOW_WIDTH 880
|
|
|
|
|
|
|
|
enum align {
|
|
|
|
DEBUGWIN_LEFT,
|
|
|
|
DEBUGWIN_CENTRE,
|
|
|
|
DEBUGWIN_RIGHT
|
|
|
|
};
|
|
|
|
|
|
|
|
static plot_font_style_t fstyle;
|
|
|
|
static plot_style_t style;
|
|
|
|
|
|
|
|
static void debugwin_redraw(int clip_x0, int clip_y0, int clip_x1, int clip_y1);
|
|
|
|
static void debugwin_get_size(int *width, int *height);
|
|
|
|
static bool debugwin_render_cell(int x, int y, int width, int height,
|
|
|
|
const char *text, enum align align, int clip_x0, int clip_y0,
|
|
|
|
int clip_x1, int clip_y1);
|
2010-04-06 02:17:03 +04:00
|
|
|
#endif
|
2004-06-11 00:57:20 +04:00
|
|
|
|
2010-04-10 03:22:30 +04:00
|
|
|
|
2004-06-11 00:57:20 +04:00
|
|
|
void ro_gui_debugwin_open(void)
|
|
|
|
{
|
2010-04-06 02:17:03 +04:00
|
|
|
#ifdef ENABLE_DEBUGWIN
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_wimp_event_register_close_window(dialog_debug,
|
|
|
|
ro_gui_debugwin_close);
|
|
|
|
ro_gui_wimp_event_register_redraw_window(dialog_debug,
|
|
|
|
ro_gui_debugwin_redraw);
|
2004-06-11 00:57:20 +04:00
|
|
|
ro_gui_debugwin_resize();
|
|
|
|
ro_gui_dialog_open(dialog_debug);
|
2004-06-25 03:29:46 +04:00
|
|
|
schedule_remove(ro_gui_debugwin_update, 0);
|
2004-06-21 19:09:59 +04:00
|
|
|
schedule(DEBUGWIN_UPDATE, ro_gui_debugwin_update, 0);
|
2010-04-06 02:17:03 +04:00
|
|
|
#endif
|
2004-06-11 00:57:20 +04:00
|
|
|
}
|
|
|
|
|
2010-04-10 03:22:30 +04:00
|
|
|
|
2010-04-06 02:17:03 +04:00
|
|
|
#ifdef ENABLE_DEBUGWIN
|
2004-06-11 00:57:20 +04:00
|
|
|
void ro_gui_debugwin_resize(void)
|
|
|
|
{
|
2010-04-10 03:22:30 +04:00
|
|
|
int width, height;
|
2004-06-11 00:57:20 +04:00
|
|
|
os_box box;
|
|
|
|
os_error *error;
|
|
|
|
|
2010-04-10 03:22:30 +04:00
|
|
|
/* Ask the core for the debug window size */
|
|
|
|
debugwin_get_size(&width, &height);
|
2004-06-11 00:57:20 +04:00
|
|
|
|
|
|
|
box.x0 = 0;
|
2010-04-10 03:22:30 +04:00
|
|
|
box.y0 = height * -2;
|
|
|
|
box.x1 = width * 2;
|
2004-06-11 00:57:20 +04:00
|
|
|
box.y1 = 0;
|
|
|
|
error = xwimp_set_extent(dialog_debug, &box);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_set_extent: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ro_gui_debugwin_update(void *p)
|
|
|
|
{
|
|
|
|
os_error *error;
|
|
|
|
ro_gui_debugwin_resize();
|
|
|
|
error = xwimp_force_redraw(dialog_debug, 0, -10000, 10000, 0);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_force_redraw: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
}
|
2004-06-21 19:09:59 +04:00
|
|
|
schedule(DEBUGWIN_UPDATE, ro_gui_debugwin_update, 0);
|
2004-06-11 00:57:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
void ro_gui_debugwin_close(wimp_w w)
|
2004-06-11 00:57:20 +04:00
|
|
|
{
|
|
|
|
os_error *error;
|
|
|
|
error = xwimp_close_window(dialog_debug);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_close_window: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
}
|
|
|
|
schedule_remove(ro_gui_debugwin_update, 0);
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_wimp_event_finalise(dialog_debug);
|
2004-06-11 00:57:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ro_gui_debugwin_redraw(wimp_draw *redraw)
|
|
|
|
{
|
|
|
|
osbool more;
|
|
|
|
os_error *error;
|
|
|
|
|
2010-04-10 03:22:30 +04:00
|
|
|
/* Select RISC OS plotters */
|
|
|
|
plot = ro_plotters;
|
|
|
|
ro_plot_set_scale(1.0);
|
|
|
|
|
2004-06-11 00:57:20 +04:00
|
|
|
error = xwimp_redraw_window(redraw, &more);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_redraw_window: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
while (more) {
|
2010-04-10 03:22:30 +04:00
|
|
|
int clip_x0, clip_y0, clip_x1, clip_y1;
|
|
|
|
|
|
|
|
/* Sep plot origin */
|
|
|
|
ro_plot_origin_x = redraw->box.x0 - redraw->xscroll;
|
|
|
|
ro_plot_origin_y = redraw->box.y1 - redraw->yscroll;
|
|
|
|
|
|
|
|
/* Set clip rectangle */
|
|
|
|
clip_x0 = (redraw->clip.x0 - ro_plot_origin_x) / 2; /* left */
|
|
|
|
clip_y0 = (ro_plot_origin_y - redraw->clip.y1) / 2; /* top */
|
|
|
|
clip_x1 = (redraw->clip.x1 - ro_plot_origin_x) / 2; /* right */
|
|
|
|
clip_y1 = (ro_plot_origin_y - redraw->clip.y0) / 2; /* bottom */
|
|
|
|
plot.clip(clip_x0, clip_y0, clip_x1, clip_y1);
|
|
|
|
|
|
|
|
/* Render the content debug table */
|
|
|
|
debugwin_redraw(clip_x0, clip_y0, clip_x1, clip_y1);
|
|
|
|
|
2004-06-11 00:57:20 +04:00
|
|
|
error = xwimp_get_rectangle(redraw, &more);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_get_rectangle: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-10 03:22:30 +04:00
|
|
|
void debugwin_redraw(int clip_x0, int clip_y0, int clip_x1, int clip_y1)
|
2004-06-11 00:57:20 +04:00
|
|
|
{
|
2006-12-04 01:34:26 +03:00
|
|
|
char s[40];
|
2010-04-10 03:22:30 +04:00
|
|
|
int y, x, w;
|
2004-06-21 19:09:59 +04:00
|
|
|
unsigned int users;
|
2006-12-04 01:34:26 +03:00
|
|
|
unsigned int talloc_size;
|
2004-06-21 19:09:59 +04:00
|
|
|
unsigned int size = 0;
|
2004-06-11 00:57:20 +04:00
|
|
|
struct content *content;
|
2004-06-21 19:09:59 +04:00
|
|
|
struct content_user *user;
|
2010-04-10 03:22:30 +04:00
|
|
|
// bool want_knockout;
|
|
|
|
|
|
|
|
/* Set up font style for headings */
|
|
|
|
fstyle.family = PLOT_FONT_FAMILY_SANS_SERIF;
|
|
|
|
fstyle.size = 12 * FONT_SIZE_SCALE;
|
|
|
|
fstyle.weight = 900;
|
|
|
|
fstyle.flags = 0;
|
|
|
|
fstyle.background = 0xff4400;
|
|
|
|
fstyle.foreground = 0xffffff;
|
|
|
|
|
|
|
|
/* Set up plot style for heading cell backgrounds */
|
|
|
|
style.stroke_type = PLOT_OP_TYPE_NONE;
|
|
|
|
style.stroke_width = 0;
|
|
|
|
style.stroke_colour = 0x000000;
|
|
|
|
style.fill_type = PLOT_OP_TYPE_SOLID;
|
|
|
|
style.fill_colour = 0xff4400;
|
|
|
|
|
|
|
|
/* Column widths */
|
|
|
|
int w_type = 50;
|
|
|
|
int w_fresh = 40;
|
|
|
|
int w_mime_type = 80;
|
|
|
|
int w_users = 40;
|
|
|
|
int w_status = 60;
|
|
|
|
int w_size = 200;
|
|
|
|
int w_url = DEBUGWIN_WINDOW_WIDTH - w_size - 1 - w_status - 1 -
|
|
|
|
w_users - 1 - w_mime_type - 1 - w_fresh - 1 -
|
|
|
|
w_type - 1;
|
|
|
|
|
|
|
|
// want_knockout = plot.option_knockout;
|
|
|
|
// if (want_knockout)
|
|
|
|
// knockout_plot_start(&plot);
|
|
|
|
|
|
|
|
/* Render column heading cells */
|
|
|
|
y = 0;
|
|
|
|
x = 0;
|
|
|
|
w = w_url;
|
|
|
|
debugwin_render_cell(x, y, w, DEBUGWIN_TEXT_HEIGHT,
|
|
|
|
"url", DEBUGWIN_CENTRE, clip_x0, clip_y0,
|
|
|
|
clip_x1, clip_y1);
|
|
|
|
x += w + 1;
|
|
|
|
w = w_type;
|
|
|
|
debugwin_render_cell(x, y, w, DEBUGWIN_TEXT_HEIGHT,
|
|
|
|
"type", DEBUGWIN_CENTRE, clip_x0, clip_y0,
|
|
|
|
clip_x1, clip_y1);
|
|
|
|
x += w + 1;
|
|
|
|
w = w_fresh;
|
|
|
|
debugwin_render_cell(x, y, w, DEBUGWIN_TEXT_HEIGHT,
|
|
|
|
"fresh", DEBUGWIN_CENTRE, clip_x0, clip_y0,
|
|
|
|
clip_x1, clip_y1);
|
|
|
|
x += w + 1;
|
|
|
|
w = w_mime_type;
|
|
|
|
debugwin_render_cell(x, y, w, DEBUGWIN_TEXT_HEIGHT,
|
|
|
|
"mime-type", DEBUGWIN_CENTRE, clip_x0, clip_y0,
|
|
|
|
clip_x1, clip_y1);
|
|
|
|
x += w + 1;
|
|
|
|
w = w_users;
|
|
|
|
debugwin_render_cell(x, y, w, DEBUGWIN_TEXT_HEIGHT,
|
|
|
|
"users", DEBUGWIN_CENTRE, clip_x0, clip_y0,
|
|
|
|
clip_x1, clip_y1);
|
|
|
|
x += w + 1;
|
|
|
|
w = w_status;
|
|
|
|
debugwin_render_cell(x, y, w, DEBUGWIN_TEXT_HEIGHT,
|
|
|
|
"status", DEBUGWIN_CENTRE, clip_x0, clip_y0,
|
|
|
|
clip_x1, clip_y1);
|
|
|
|
x += w + 1;
|
|
|
|
w = w_size;
|
|
|
|
debugwin_render_cell(x, y, w, DEBUGWIN_TEXT_HEIGHT,
|
|
|
|
"size", DEBUGWIN_CENTRE, clip_x0, clip_y0,
|
|
|
|
clip_x1, clip_y1);
|
2004-06-11 00:57:20 +04:00
|
|
|
|
2010-04-10 03:22:30 +04:00
|
|
|
/* Move down to next row */
|
|
|
|
y += DEBUGWIN_TEXT_HEIGHT + 2 * DEBUGWIN_CELL_PADDING + 1;
|
|
|
|
|
|
|
|
/* Change style for non-heading cells */
|
|
|
|
fstyle.weight = 400;
|
|
|
|
fstyle.background = 0xffaa88;
|
|
|
|
fstyle.foreground = 0x000000;
|
|
|
|
style.fill_colour = 0xffaa88;
|
|
|
|
|
|
|
|
/* Create a row in the table for each content */
|
|
|
|
for (content = content_list; content; content = content->next) {
|
|
|
|
/* Create URL cell */
|
|
|
|
x = 0;
|
|
|
|
w = w_url;
|
|
|
|
debugwin_render_cell(x, y, w, DEBUGWIN_TEXT_HEIGHT,
|
|
|
|
content->url, DEBUGWIN_RIGHT, clip_x0, clip_y0,
|
|
|
|
clip_x1, clip_y1);
|
|
|
|
/* Create Type cell */
|
|
|
|
x += w + 1;
|
|
|
|
w = w_type;
|
|
|
|
debugwin_render_cell(x, y, w, DEBUGWIN_TEXT_HEIGHT,
|
|
|
|
content_type_name[content->type], DEBUGWIN_LEFT,
|
|
|
|
clip_x0, clip_y0, clip_x1, clip_y1);
|
|
|
|
/* Create cell for showing wheher content is fresh */
|
|
|
|
x += w + 1;
|
|
|
|
w = w_fresh;
|
|
|
|
debugwin_render_cell(x, y, w, DEBUGWIN_TEXT_HEIGHT,
|
|
|
|
content->fresh ? "yes" : "no", DEBUGWIN_LEFT,
|
|
|
|
clip_x0, clip_y0, clip_x1, clip_y1);
|
|
|
|
/* Create Mime-type cell */
|
|
|
|
x += w + 1;
|
|
|
|
w = w_mime_type;
|
|
|
|
debugwin_render_cell(x, y, w, DEBUGWIN_TEXT_HEIGHT,
|
|
|
|
content->mime_type, DEBUGWIN_LEFT,
|
|
|
|
clip_x0, clip_y0, clip_x1, clip_y1);
|
|
|
|
/* Create Users cell */
|
2004-06-21 19:09:59 +04:00
|
|
|
users = 0;
|
2010-04-10 03:22:30 +04:00
|
|
|
/* Count content users */
|
2004-06-21 19:09:59 +04:00
|
|
|
for (user = content->user_list->next; user; user = user->next)
|
|
|
|
users++;
|
|
|
|
snprintf(s, sizeof s, "%u", users);
|
2010-04-10 03:22:30 +04:00
|
|
|
x += w + 1;
|
|
|
|
w = w_users;
|
|
|
|
debugwin_render_cell(x, y, w, DEBUGWIN_TEXT_HEIGHT,
|
|
|
|
s, DEBUGWIN_RIGHT, clip_x0, clip_y0,
|
|
|
|
clip_x1, clip_y1);
|
|
|
|
/* Create Status cell */
|
|
|
|
x += w + 1;
|
|
|
|
w = w_status;
|
|
|
|
debugwin_render_cell(x, y, w, DEBUGWIN_TEXT_HEIGHT,
|
|
|
|
content_status_name[content->status],
|
|
|
|
DEBUGWIN_LEFT, clip_x0, clip_y0,
|
|
|
|
clip_x1, clip_y1);
|
|
|
|
/* Create Size cell */
|
2006-12-04 01:34:26 +03:00
|
|
|
talloc_size = talloc_total_size(content);
|
2010-04-10 03:22:30 +04:00
|
|
|
snprintf(s, sizeof s, "%u+%u= %u", content->size, talloc_size,
|
2006-12-04 01:34:26 +03:00
|
|
|
content->size + talloc_size);
|
2010-04-10 03:22:30 +04:00
|
|
|
x += w + 1;
|
|
|
|
w = w_size;
|
|
|
|
debugwin_render_cell(x, y, w, DEBUGWIN_TEXT_HEIGHT,
|
|
|
|
s, DEBUGWIN_RIGHT, clip_x0, clip_y0,
|
|
|
|
clip_x1, clip_y1);
|
|
|
|
|
|
|
|
/* Keep running total of size used */
|
2006-12-04 01:34:26 +03:00
|
|
|
size += content->size + talloc_size;
|
2010-04-10 03:22:30 +04:00
|
|
|
|
|
|
|
/* Move down for next row */
|
|
|
|
y += DEBUGWIN_TEXT_HEIGHT + 2 * DEBUGWIN_CELL_PADDING + 1;
|
2004-06-11 00:57:20 +04:00
|
|
|
}
|
2004-06-21 19:09:59 +04:00
|
|
|
snprintf(s, sizeof s, "%u", size);
|
2010-04-10 03:22:30 +04:00
|
|
|
|
|
|
|
/* Show total size */
|
|
|
|
debugwin_render_cell(DEBUGWIN_WINDOW_WIDTH - w_size, y,
|
|
|
|
w_size, DEBUGWIN_TEXT_HEIGHT, s, DEBUGWIN_RIGHT,
|
|
|
|
clip_x0, clip_y0, clip_x1, clip_y1);
|
|
|
|
|
|
|
|
/* Heading cell for total size */
|
|
|
|
fstyle.weight = 900;
|
|
|
|
fstyle.background = 0xff4400;
|
|
|
|
fstyle.foreground = 0xffffff;
|
|
|
|
style.fill_colour = 0xff4400;
|
|
|
|
debugwin_render_cell(0, y,
|
|
|
|
DEBUGWIN_WINDOW_WIDTH - w_size - 1,
|
|
|
|
DEBUGWIN_TEXT_HEIGHT, "total size:", DEBUGWIN_RIGHT,
|
|
|
|
clip_x0, clip_y0, clip_x1, clip_y1);
|
|
|
|
|
|
|
|
// if (want_knockout)
|
|
|
|
// knockout_plot_end();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void debugwin_get_size(int *width, int *height)
|
|
|
|
{
|
|
|
|
int count = 2; /* Heading row + total size row */
|
|
|
|
struct content *content;
|
|
|
|
|
|
|
|
/* Count data rows */
|
|
|
|
for (content = content_list; content; content = content->next)
|
|
|
|
count++;
|
|
|
|
|
|
|
|
/* Pass back width */
|
|
|
|
*width = DEBUGWIN_WINDOW_WIDTH;
|
|
|
|
|
|
|
|
/* Pass total height */
|
|
|
|
*height = (1 + DEBUGWIN_TEXT_HEIGHT + 2 * DEBUGWIN_CELL_PADDING);
|
|
|
|
*height *= count;
|
|
|
|
*height -= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool debugwin_render_cell(int x, int y, int width, int height,
|
|
|
|
const char *text, enum align align, int clip_x0, int clip_y0,
|
|
|
|
int clip_x1, int clip_y1)
|
|
|
|
{
|
|
|
|
int text_width;
|
|
|
|
size_t length;
|
|
|
|
|
|
|
|
height += 2 * DEBUGWIN_CELL_PADDING;
|
|
|
|
|
|
|
|
/* Return if the rectangle is completely outside the clip rectangle */
|
|
|
|
if (clip_y1 < y || y + height < clip_y0 ||
|
|
|
|
clip_x1 < x || x + width < clip_x0)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
/* Clip to intersection of clip rectangle and cell */
|
|
|
|
if (!plot.clip( (x < clip_x0) ? clip_x0 : x,
|
|
|
|
(y < clip_y0) ? clip_y0 : y,
|
|
|
|
(clip_x1 < x + width) ? clip_x1 : x + width,
|
|
|
|
(clip_y1 < y + height) ? clip_y1 : y + height))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
/* Plot cell background */
|
|
|
|
if (!plot.rectangle(x, y, x + width, y + height, &style))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
/* If there's no text, we're finished */
|
|
|
|
if (text == NULL)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
/* Plot x-coordinate depends on requested alignment */
|
|
|
|
length = strlen(text);
|
|
|
|
switch (align) {
|
|
|
|
case DEBUGWIN_RIGHT:
|
|
|
|
/* Text is right aligned, need to know text width */
|
|
|
|
if (!nsfont.font_width(&fstyle, text, length, &text_width))
|
|
|
|
return false;
|
|
|
|
x = x - text_width + width - DEBUGWIN_CELL_PADDING;
|
|
|
|
break;
|
|
|
|
case DEBUGWIN_LEFT:
|
|
|
|
/* Text is left aligned */
|
|
|
|
x += DEBUGWIN_CELL_PADDING;
|
|
|
|
break;
|
|
|
|
case DEBUGWIN_CENTRE:
|
|
|
|
/* Text is right aligned, need to know text width */
|
|
|
|
if (!nsfont.font_width(&fstyle, text, length, &text_width))
|
|
|
|
return false;
|
|
|
|
x = x + (width - text_width) / 2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Plot the text */
|
|
|
|
if (!plot.text(x, y + height * 0.75, text, length, &fstyle))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
/* Restore previous clip rectangle */
|
|
|
|
if (!plot.clip(clip_x0, clip_y0, clip_x1, clip_y1))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
2004-06-11 00:57:20 +04:00
|
|
|
}
|
2010-04-06 02:17:03 +04:00
|
|
|
#endif
|