[Scummvm-cvs-logs] SF.net SVN: scummvm:[39690] scummvm/trunk/engines/sci/gfx
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Wed Mar 25 18:51:27 CET 2009
Revision: 39690
http://scummvm.svn.sourceforge.net/scummvm/?rev=39690&view=rev
Author: thebluegr
Date: 2009-03-25 17:51:22 +0000 (Wed, 25 Mar 2009)
Log Message:
-----------
Changed the font flag defines to an enumeration
Modified Paths:
--------------
scummvm/trunk/engines/sci/gfx/font.cpp
scummvm/trunk/engines/sci/gfx/font.h
scummvm/trunk/engines/sci/gfx/gfx_gui.cpp
scummvm/trunk/engines/sci/gfx/operations.cpp
Modified: scummvm/trunk/engines/sci/gfx/font.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/font.cpp 2009-03-25 16:37:50 UTC (rev 39689)
+++ scummvm/trunk/engines/sci/gfx/font.cpp 2009-03-25 17:51:22 UTC (rev 39690)
@@ -82,7 +82,7 @@
}
}
- if (((foo == '\n') || (foo == 0x0d)) && !(flags & GFXR_FONT_FLAG_NO_NEWLINES)) {
+ if (((foo == '\n') || (foo == 0x0d)) && !(flags & kFontNoNewlines)) {
fragments[current_fragment-1].length = text - 1 - fragments[current_fragment-1].offset;
if (*text)
@@ -133,7 +133,7 @@
fragments = (text_fragment_t*)sci_realloc(fragments, sizeof(text_fragment_t *) * (fragments_nr <<= 1));
localmaxwidth = localmaxwidth - last_breakpoint;
- if (!(flags & GFXR_FONT_FLAG_COUNT_WHITESPACE))
+ if (!(flags & kFontCountWhitespace))
localmaxwidth -= last_break_width;
last_breakpoint = localmaxwidth = 0;
Modified: scummvm/trunk/engines/sci/gfx/font.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/font.h 2009-03-25 16:37:50 UTC (rev 39689)
+++ scummvm/trunk/engines/sci/gfx/font.h 2009-03-25 17:51:22 UTC (rev 39690)
@@ -65,18 +65,14 @@
/*******************/
/* SCI0, SCI01 and SCI1 all use the same font format. */
+enum fontFlags {
+ kFontCountWhitespace = 1 << 0, // In SQ3, whitespace is included in text size
+ kFontNoNewlines = 1 << 1, // Don't treat newline characters
+ kFontIgnoreLF = 1 << 2 // Interpret CR LF sequences as a single newline, rather than two
+};
-/* SQ3 uses a somewhat different scheme for calculating text sizes: it counts
-** whitespace while calculating the text size. */
-#define GFXR_FONT_FLAG_COUNT_WHITESPACE (1<<0)
-/* Don't give newline characters special semantics */
-#define GFXR_FONT_FLAG_NO_NEWLINES (1<<1)
-/* Interpret CR LF sequences as a single newline, rather than two of them */
-#define GFXR_FONT_FLAG_EAT_TRAILING_LF (1<<2)
-
-
gfx_bitmap_font_t *gfxr_read_font(int id, byte *resource, int size);
-/* Geneartes a bitmap font data structure from a resource
+/* Generates a bitmap font data structure from a resource
** Parameters: (int) id: Resource ID of the resulting font
** (byte *) resource: Pointer to the resource data
** (int) size: Size of the resource block
Modified: scummvm/trunk/engines/sci/gfx/gfx_gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_gui.cpp 2009-03-25 16:37:50 UTC (rev 39689)
+++ scummvm/trunk/engines/sci/gfx/gfx_gui.cpp 2009-03-25 17:51:22 UTC (rev 39690)
@@ -96,7 +96,7 @@
if (!text.empty()) {
gfxw_text_t *textw = gfxw_new_text(state, gfx_rect(0, 0, status_bar->bounds.width, status_bar->bounds.height),
status_bar->font_nr, text.c_str(), ALIGN_LEFT, ALIGN_CENTER,
- fg, fg, bg, GFXR_FONT_FLAG_NO_NEWLINES);
+ fg, fg, bg, kFontNoNewlines);
list = make_titlebar_list(s, status_bar->bounds, status_bar);
@@ -211,7 +211,7 @@
decorations->add((gfxw_container_t *)decorations, (gfxw_widget_t *)
gfxw_new_text(state, title_rect, title_font, title, ALIGN_CENTER, ALIGN_CENTER, title_color, title_color,
- title_bgcolor, GFXR_FONT_FLAG_NO_NEWLINES));
+ title_bgcolor, kFontNoNewlines));
}
if (!(flags & kWindowNoFrame)) {
@@ -309,21 +309,19 @@
zone.x = 0;
zone.y = 0;
- if (inverse)
- list->add(GFXWC(list), GFXW(gfxw_new_box(NULL, gfx_rect(zone.x, zone.y, zone.width + 1, zone.height + 1),
- port->color, port->color, GFX_BOX_SHADE_FLAT)));
-
if (!inverse) {
list = _sciw_add_text_to_list(list, port, gfx_rect(zone.x + 1, zone.y + 2, zone.width - 1, zone.height),
- text, font, ALIGN_CENTER, 0, inverse, GFXR_FONT_FLAG_EAT_TRAILING_LF, grayed_out);
+ text, font, ALIGN_CENTER, 0, inverse, kFontIgnoreLF, grayed_out);
list->add(GFXWC(list),
GFXW(gfxw_new_rect(zone, *frame_col, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL)));
- }
+ } else {
+ list->add(GFXWC(list), GFXW(gfxw_new_box(NULL, gfx_rect(zone.x, zone.y, zone.width + 1, zone.height + 1),
+ port->color, port->color, GFX_BOX_SHADE_FLAT)));
- if (inverse)
list = _sciw_add_text_to_list(list, port, gfx_rect(zone.x + 1, zone.y + 2, zone.width - 1, zone.height),
- text, font, ALIGN_CENTER, 0, inverse, GFXR_FONT_FLAG_EAT_TRAILING_LF, grayed_out);
+ text, font, ALIGN_CENTER, 0, inverse, kFontIgnoreLF, grayed_out);
+ }
if (selected)
list->add(GFXWC(list),
@@ -364,7 +362,7 @@
if ((g_system->getMillis() % 1000) < 500) {
text_handle = gfxw_new_text(port->visual->gfx_state, zone, font, text, ALIGN_LEFT, ALIGN_TOP,
- port->color, port->color, port->bgcolor, GFXR_FONT_FLAG_NO_NEWLINES);
+ port->color, port->color, port->bgcolor, kFontNoNewlines);
list->add(GFXWC(list), GFXW(text_handle));
} else {
@@ -377,7 +375,7 @@
if (cursor > 0) {
text_handle = gfxw_new_text(port->visual->gfx_state, zone, font, textdup, ALIGN_LEFT, ALIGN_TOP,
- port->color, port->color, port->bgcolor, GFXR_FONT_FLAG_NO_NEWLINES);
+ port->color, port->color, port->bgcolor, kFontNoNewlines);
list->add(GFXWC(list), GFXW(text_handle));
zone.x += text_handle->width;
@@ -387,14 +385,14 @@
textdup[0] = text[cursor];
textdup[1] = 0;
text_handle = gfxw_new_text(port->visual->gfx_state, zone, font, textdup, ALIGN_LEFT, ALIGN_TOP,
- port->bgcolor, port->bgcolor, port->color, GFXR_FONT_FLAG_NO_NEWLINES);
+ port->bgcolor, port->bgcolor, port->color, kFontNoNewlines);
list->add(GFXWC(list), GFXW(text_handle));
zone.x += text_handle->width;
};
if (cursor + 1 < strlen(text)) {
text_handle = gfxw_new_text(port->visual->gfx_state, zone, font, text + cursor + 1, ALIGN_LEFT, ALIGN_TOP,
- port->color, port->color, port->bgcolor, GFXR_FONT_FLAG_NO_NEWLINES);
+ port->color, port->color, port->bgcolor, kFontNoNewlines);
list->add(GFXWC(list), GFXW(text_handle));
zone.x += text_handle->width;
};
@@ -485,13 +483,13 @@
list->add(GFXWC(list),
GFXW(gfxw_new_text(port->visual->gfx_state, gfx_rect(zone.x, zone.y, zone.width - 2, font_height),
font_nr, entries_list[i], ALIGN_LEFT, ALIGN_TOP,
- port->color, port->color, port->bgcolor, GFXR_FONT_FLAG_NO_NEWLINES)));
+ port->color, port->color, port->bgcolor, kFontNoNewlines)));
else {
list->add(GFXWC(list), GFXW(gfxw_new_box(port->visual->gfx_state, gfx_rect(zone.x, zone.y, zone.width - 1, font_height),
port->color, port->color, GFX_BOX_SHADE_FLAT)));
list->add(GFXWC(list), GFXW(gfxw_new_text(port->visual->gfx_state, gfx_rect(zone.x, zone.y, zone.width - 2, font_height),
font_nr, entries_list[i], ALIGN_LEFT, ALIGN_TOP,
- port->bgcolor, port->bgcolor, port->color, GFXR_FONT_FLAG_NO_NEWLINES)));
+ port->bgcolor, port->bgcolor, port->color, kFontNoNewlines)));
}
zone.y += font_height;
@@ -544,11 +542,11 @@
status_bar->color, status_bar->color, GFX_BOX_SHADE_FLAT)));
list->add(GFXWC(list), GFXW(gfxw_new_text(s->gfx_state, gfx_rect(offset, 0, width, MENU_BAR_HEIGHT),
status_bar->font_nr, menu->_title.c_str(), ALIGN_CENTER, ALIGN_CENTER,
- status_bar->bgcolor, status_bar->bgcolor, status_bar->color, GFXR_FONT_FLAG_NO_NEWLINES)));
+ status_bar->bgcolor, status_bar->bgcolor, status_bar->color, kFontNoNewlines)));
} else
list->add(GFXWC(list), GFXW(gfxw_new_text(s->gfx_state, gfx_rect(offset, 0, width, MENU_BAR_HEIGHT),
status_bar->font_nr, menu->_title.c_str(), ALIGN_CENTER, ALIGN_CENTER,
- status_bar->color, status_bar->color, status_bar->bgcolor, GFXR_FONT_FLAG_NO_NEWLINES)));
+ status_bar->color, status_bar->color, status_bar->bgcolor, kFontNoNewlines)));
offset += width;
}
@@ -609,12 +607,12 @@
list->add(GFXWC(list), GFXW(gfxw_new_box(port->visual->gfx_state, area, bgcolor, bgcolor, GFX_BOX_SHADE_FLAT)));
list->add(GFXWC(list), GFXW(gfxw_new_text(port->visual->gfx_state, area, port->font_nr, item->_text.c_str(), ALIGN_LEFT, ALIGN_CENTER,
- color, xcolor, bgcolor, GFXR_FONT_FLAG_NO_NEWLINES)));
+ color, xcolor, bgcolor, kFontNoNewlines)));
if (!item->_keytext.empty()) {
area.width -= MENU_BOX_RIGHT_PADDING;
list->add(GFXWC(list), GFXW(gfxw_new_text(port->visual->gfx_state, area, port->font_nr, item->_keytext.c_str(), ALIGN_RIGHT, ALIGN_CENTER,
- color, xcolor, bgcolor, GFXR_FONT_FLAG_NO_NEWLINES)));
+ color, xcolor, bgcolor, kFontNoNewlines)));
}
return GFXW(list);
Modified: scummvm/trunk/engines/sci/gfx/operations.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/operations.cpp 2009-03-25 16:37:50 UTC (rev 39689)
+++ scummvm/trunk/engines/sci/gfx/operations.cpp 2009-03-25 17:51:22 UTC (rev 39690)
@@ -1943,7 +1943,7 @@
handle->lines = gfxr_font_calculate_size(font, maxwidth, handle->text, &(handle->width), &(handle->height), &(handle->lines_nr),
NULL, NULL, ((state->options->workarounds & GFX_WORKAROUND_WHITESPACE_COUNT) ?
- GFXR_FONT_FLAG_COUNT_WHITESPACE : 0) | flags);
+ kFontCountWhitespace : 0) | flags);
if (!handle->lines) {
free(handle->text);
@@ -1952,7 +1952,7 @@
return NULL;
}
- if (flags & GFXR_FONT_FLAG_NO_NEWLINES) {
+ if (flags & kFontNoNewlines) {
handle->lines_nr = 1;
handle->lines->length = strlen(text);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list