[ Return to Articles | Show Comments | Submit Comment ]
Article #1355: FLTK2.0 - patch
Created at 14:46 Mar 08, 2014 by ggarra13
Index: OpenGL/gl_draw.cxx
===================================================================
--- OpenGL/gl_draw.cxx (revision 10116)
+++ OpenGL/gl_draw.cxx (working copy)
@@ -91,16 +91,27 @@
int base = current_xfont->min_char_or_byte2;
int last = current_xfont->max_char_or_byte2;
if (last > 255) last = 255;
- int size = last-base+1;
- glXUseXFont(current_xfont->fid, base, size, listbase+base);
+ int len = last-base+1;
+ glXUseXFont(current_xfont->fid, base, len, listbase+base);
#elif defined(_WIN32)
int base = textmetric()->tmFirstChar;
int last = textmetric()->tmLastChar;
if (last > 255) last = 255;
- int size = last-base+1;
- HDC hdc = GetDC(0);
+ int len = last-base+1;
+ HDC hdc = fltk::getDC();
HFONT oldFid = (HFONT)SelectObject(hdc, xfont());
- wglUseFontBitmaps(hdc, base, size, listbase+base);
+
+ bool succeed = false;
+ int MAX_TRIES = 5;
+ for ( int i = 0; i < MAX_TRIES && !succeed; ++i )
+ {
+ succeed = wglUseFontBitmaps(hdc, base, len, listbase+base) == TRUE;
+ }
+ if ( !succeed )
+ {
+ fprintf( stderr, "wglUseFontBitmaps error\n" );
+ }
+
SelectObject(hdc, oldFid);
#elif defined(__APPLE__)
int attrib; const char* name = font->name(&attrib);
@@ -167,7 +178,7 @@
glDisable(GL_LIGHTING);
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// This is useful for making the letters transparent in 3D, but I'll
// let the caller choose to enable this and to set the cutoff:
// glEnable(GL_ALPHA_TEST);
@@ -456,8 +467,8 @@
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_INTENSITY8, width, height, 0,
- GL_LUMINANCE, GL_UNSIGNED_BYTE, data);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA8, width, height, 0,
+ GL_ALPHA, GL_UNSIGNED_BYTE, data);
delete[] data;
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
Index: test/CubeViewUI.h
===================================================================
--- test/CubeViewUI.h (revision 10116)
+++ test/CubeViewUI.h (working copy)
@@ -1,4 +1,4 @@
-// generated by Fast Light User Interface Designer (fluid) version 2.0100
+// generated by Fast Light User Interface Designer (fluid) version 2.1000
#ifndef CubeViewUI_h
#define CubeViewUI_h
Index: test/radio.cxx
===================================================================
--- test/radio.cxx (revision 10116)
+++ test/radio.cxx (working copy)
@@ -1,9 +1,9 @@
-// generated by Fast Light User Interface Designer (fluid) version 2.0100
+// generated by Fast Light User Interface Designer (fluid) version 2.1000
#include "radio.h"
using namespace fltk;
-fltk::LightButton* ttlb;
+fltk::LightButton *ttlb=(fltk::LightButton *)0;
static void cb_ttlb(fltk::LightButton*, void*) {
Tooltip::enable(ttlb->value() ? true : false);
@@ -16,6 +16,7 @@
fltk::Window* w;
{fltk::Window* o = new fltk::Window(380, 274, "Radio buttons and Tooltips");
w = o;
+ o->shortcut(0xff1b);
o->tooltip("This is a window");
o->begin();
{fltk::Button* o = new fltk::Button(20, 10, 160, 25, "Button");
Index: test/radio.h
===================================================================
--- test/radio.h (revision 10116)
+++ test/radio.h (working copy)
@@ -1,4 +1,4 @@
-// generated by Fast Light User Interface Designer (fluid) version 2.0100
+// generated by Fast Light User Interface Designer (fluid) version 2.1000
#ifndef radio_h
#define radio_h
[ Listing ]
[ Submit Comment ]From greg.ercolano, 05:07 May 03, 2014 (score=4)
Great, though better to supply patches via the STR form, so you can attach the patch against the fltk version. e.g.
http://www.fltk.org/str.php?U
I'll make one on your behalf and reference this article.
[ Reply ] |