Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2003-10-20 19:40:20 +0400
committerTon Roosendaal <ton@blender.org>2003-10-20 19:40:20 +0400
commit7f5d06d638ff24444da942cf91c130d5393818cb (patch)
tree2b21f227adfb1d7f2004087e60b05c3af230d5ee /source/blender/ftfont/intern/FTF_TTFont.cpp
parent628b0025836183436ab5b83120497ebe060f89b7 (diff)
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for AA fonts as for default fonts. Now it's identical. Setting color for fonts can just be done with OpenGL, for both font types. Removed: BIF_DrawStringRGB() - added theme color options for Buttons - recoded DefButton, so it automatically chooses the right color. - had to remove a 1000 uiBlockSetCol() calls for that reason... - uiBlockSetCol() still works, to override automatic color - removed entirely the silly old color system (BIFColorID). All color calls can now be done with a BIF_ThemeColor() call, including fonts and buttons and opengl stuff - all buttons in button header have headercolor by default - recoded drawing icons, it was a really bad & old loop doing manually colorshading and blending... which was per pixel a load of code! Now it uses a single OpenGL call to blend or colorize. Quite faster! - (as test, for review) icons don't colorize anymore with button color, but have a different alpha to blend in (when not active) - recoded the entire interface_draw.c file...: - drawing buttons is separated in three parts: 1. main drawing function for text and icons 2. free definable callback for button itself 3. free definable callback for slider - removed a load of redundant code for this! - coded a minimal theme, and adjusted Matt's buttons to match new callback system - adding new drawing themes is piece of cake now - for coders, default 'themes' to be aware of: UI_EMBOSS : the themable drawing style UI_EMBOSSP: the pulldown menu system (apart from color not themable) UI_EMBOSSN: draw nothing, only text and/or icon UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call. TODO: make UI API call for button alignment (plus removed another series of warnings from code...) Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
Diffstat (limited to 'source/blender/ftfont/intern/FTF_TTFont.cpp')
-rw-r--r--source/blender/ftfont/intern/FTF_TTFont.cpp41
1 files changed, 8 insertions, 33 deletions
diff --git a/source/blender/ftfont/intern/FTF_TTFont.cpp b/source/blender/ftfont/intern/FTF_TTFont.cpp
index 6f50c2e0841..3233082cca7 100644
--- a/source/blender/ftfont/intern/FTF_TTFont.cpp
+++ b/source/blender/ftfont/intern/FTF_TTFont.cpp
@@ -225,12 +225,12 @@ int FTF_TTFont::GetSize(void)
int FTF_TTFont::Ascender(void)
{
- return font->Ascender();
+ return (int)font->Ascender();
}
int FTF_TTFont::Descender(void)
{
- return font->Descender();
+ return (int)font->Descender();
}
@@ -240,8 +240,9 @@ int FTF_TTFont::TransConvString(char* str, char* ustr, unsigned int flag)
}
-float FTF_TTFont::DrawString(char* str, unsigned int flag, int select)
+float FTF_TTFont::DrawString(char* str, unsigned int flag)
{
+ float color[4];
wchar_t wstr[FTF_MAX_STR_SIZE-1]={'\0'};
int len=0;
@@ -250,37 +251,11 @@ float FTF_TTFont::DrawString(char* str, unsigned int flag, int select)
else
len=utf8towchar(wstr,str);
- if(!select) {
- glPixelTransferf(GL_RED_SCALE, 0.0);
- glPixelTransferf(GL_GREEN_SCALE, 0.0);
- glPixelTransferf(GL_BLUE_SCALE, 0.0);
- }
+ glGetFloatv(GL_CURRENT_COLOR, color);
- font->Render(wstr);
-
- if(!select) {
- glPixelTransferf(GL_RED_SCALE, 1.0);
- glPixelTransferf(GL_GREEN_SCALE, 1.0);
- glPixelTransferf(GL_BLUE_SCALE, 1.0);
- }
-
- return font->Advance(wstr);
-}
-
-
-float FTF_TTFont::DrawStringRGB(char* str, unsigned int flag, float r, float g, float b)
-{
- wchar_t wstr[FTF_MAX_STR_SIZE-1]={'\0'};
- int len=0;
-
- if (FTF_USE_GETTEXT & flag)
- len=utf8towchar(wstr,gettext(str));
- else
- len=utf8towchar(wstr,str);
-
- glPixelTransferf(GL_RED_SCALE, r);
- glPixelTransferf(GL_GREEN_SCALE, g);
- glPixelTransferf(GL_BLUE_SCALE, b);
+ glPixelTransferf(GL_RED_SCALE, color[0]);
+ glPixelTransferf(GL_GREEN_SCALE, color[1]);
+ glPixelTransferf(GL_BLUE_SCALE, color[2]);
font->Render(wstr);