diff --git a/CHANGES b/CHANGES index ffb500fa5..4b8a5350e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,8 @@ CHANGES IN FLTK 1.1.0 + - MacOS: Pixmap draw fix, gl_font implemented + FL_FOCUS fix, window type fix for modal and nonmodal + windows, glut uninitialised 'display' proc fix - Now support FLTK_1_0_COMPAT symbol to define compatibility macros for the old FLTK 1.0.x function names to the 1.1.x names. diff --git a/README.mac b/README.mac index b49975a42..b92abe968 100644 --- a/README.mac +++ b/README.mac @@ -90,12 +90,11 @@ KNOWN MacFLTK BUGS - File handles (Fl::add_fd) are not implemented. - Line styles are not fully implemented. - Sub-sub-subwindow not tested. - - Image transparency is not implemented. + - Image transparency is implemented as "screen-door" only - The 'shiny' demo needs work (flush/aglFlush). - Threads are not implemented. - OpenGL subwindow during window resize changes position - - OpenGL text and font support - - fl_measure returns wrong width (about 10% short) + - fl_measure returns wrong width (wrong current font?) TEST SUITE STATUS diff --git a/src/Fl_Pixmap.cxx b/src/Fl_Pixmap.cxx index 4444d5ae3..176d5293e 100644 --- a/src/Fl_Pixmap.cxx +++ b/src/Fl_Pixmap.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.17 2002/04/26 11:32:37 easysw Exp $" +// "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.18 2002/06/27 04:29:39 matthiaswm Exp $" // // Pixmap drawing code for the Fast Light Tool Kit (FLTK). // @@ -107,10 +107,10 @@ void Fl_Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) { #elif defined(__APPLE__) if (mask) { Rect src, dst; - src.left = 0; src.right = w(); - src.top = 0; src.bottom = h(); - dst.left = X; dst.right = X+w(); - dst.top = Y; dst.bottom = Y+h(); + src.left = cx; src.right = cx+W; + src.top = cy; src.bottom = cy+H; + dst.left = X; dst.right = X+W; + dst.top = Y; dst.bottom = Y+H; RGBColor rgb; rgb.red = 0xffff; rgb.green = 0xffff; rgb.blue = 0xffff; RGBBackColor(&rgb); @@ -465,5 +465,5 @@ void Fl_Pixmap::desaturate() { } // -// End of "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.17 2002/04/26 11:32:37 easysw Exp $". +// End of "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.18 2002/06/27 04:29:39 matthiaswm Exp $". // diff --git a/src/Fl_mac.cxx b/src/Fl_mac.cxx index 7c8f4812c..3101d908b 100644 --- a/src/Fl_mac.cxx +++ b/src/Fl_mac.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_mac.cxx,v 1.1.2.26 2002/06/11 18:44:07 easysw Exp $" +// "$Id: Fl_mac.cxx,v 1.1.2.27 2002/06/27 04:29:39 matthiaswm Exp $" // // MacOS specific code for the Fast Light Tool Kit (FLTK). // @@ -409,7 +409,15 @@ static pascal OSStatus carbonWindowHandler( EventHandlerCallRef nextHandler, Eve } break; } case kEventWindowShown: - if ( !window->parent() ) Fl::handle( FL_SHOW, window); + if ( !window->parent() ) + { + GetWindowClass( fl_xid( window ), &winClass ); + if ( winClass != kHelpWindowClass ) { // help windows can't get the focus! + Fl::handle( FL_FOCUS, window); + activeWindow = window; + } + Fl::handle( FL_SHOW, window); + } break; case kEventWindowHidden: if ( !window->parent() ) Fl::handle( FL_HIDE, window); @@ -547,7 +555,7 @@ static pascal OSStatus carbonMouseHandler( EventHandlerCallRef nextHandler, Even // fall through case kEventMouseDragged: if ( !sendEvent ) { - sendEvent = FL_DRAG; + sendEvent = FL_MOVE; // Fl::handle will convert into FL_DRAG if (abs(pos.h-px)>5 || abs(pos.v-py)>5) Fl::e_is_click = 0; } @@ -1087,16 +1095,13 @@ void Fl_X::make(Fl_Window* w) Fl_Group::current(0); fl_open_display(); int winclass = kDocumentWindowClass; - int winattr = kWindowCloseBoxAttribute - | kWindowCollapseBoxAttribute - | kWindowStandardHandlerAttribute - ; + int winattr = kWindowStandardHandlerAttribute | kWindowCloseBoxAttribute | kWindowCollapseBoxAttribute; int xp = w->x(); int yp = w->y(); int wp = w->w(); int hp = w->h(); if (w->size_range_set) { - winattr |= kWindowFullZoomAttribute | kWindowResizableAttribute; + winattr |= kWindowFullZoomAttribute | kWindowResizableAttribute | kWindowLiveResizeAttribute; } else { if (w->resizable()) { Fl_Widget *o = w->resizable(); @@ -1111,16 +1116,14 @@ void Fl_X::make(Fl_Window* w) int xwm = xp, ywm = yp, bt, bx, by; if (!fake_X_wm(w, xwm, ywm, bt, bx, by)) { winclass = kHelpWindowClass; winattr = 0; } // menu windows and tooltips - else if (w->modal()) - winclass = kFloatingWindowClass; // basically fine, but not modal! The modal window however does not show - else if (w->non_modal()) - winclass = kFloatingWindowClass; // we need to call 'InitFloatingWindows for OS 8, 9 + else if (w->modal()) + winclass = kMovableModalWindowClass; if (by+bt) { wp += 2*bx; hp += 2*by+bt; } if (!(w->flags() & Fl_Window::FL_FORCE_POSITION)) { - w->x(xyPos+Fl::x()); w->y(xyPos+Fl::y()); // \todo use the Carbon function for default window positioning + w->x(xyPos+Fl::x()); w->y(xyPos+Fl::y()); // use the Carbon functions below for default window positioning xyPos += 25; if (xyPos>200) xyPos = 25; } else { @@ -1135,7 +1138,7 @@ void Fl_X::make(Fl_Window* w) if (w->non_modal() && Fl_X::first && !fl_disable_transient_for) { // find some other window to be "transient for": Fl_Window* w = Fl_X::first->w; - while (w->parent()) w = w->window(); + while (w->parent()) w = w->window(); // todo: this code does not make any sense! (w!=w??) } Rect wRect; @@ -1156,8 +1159,23 @@ void Fl_X::make(Fl_Window* w) x->cursor = fl_default_cursor; x->xidChildren = 0; x->xidNext = 0; + + winattr &= GetAvailableWindowAttributes( winclass ); // make sure that the window will open CreateNewWindow( winclass, winattr, &wRect, &(x->xid) ); SetWTitle(x->xid, pTitle); + MoveWindow(x->xid, wRect.left, wRect.top, 1); // avoid Carbon Bug on old OS + if (w->non_modal() && !w->modal()) + SetWindowClass(x->xid, kFloatingWindowClass ); // Major kludge: this is to have the regular look, but stay above the document windows + if (!(w->flags() & Fl_Window::FL_FORCE_POSITION)) + { + WindowRef pw = Fl_X::first ? Fl_X::first->xid : 0 ; + if ( w->modal() ) + RepositionWindow( x->xid, pw, kWindowAlertPositionOnParentWindowScreen ); + else if ( w->non_modal() ) + RepositionWindow( x->xid, pw, kWindowCenterOnParentWindowScreen ); + else + RepositionWindow( x->xid, pw, kWindowCascadeOnParentWindowScreen ); + } x->w = w; w->i = x; x->wait_for_expose = 1; x->next = Fl_X::first; @@ -1329,7 +1347,7 @@ void Fl_Window::make_current() fl_window = i->xid; current_ = this; - SetPort( GetWindowPort(i->xid) ); // \todo check for the handling of doublebuffered winows + SetPort( GetWindowPort(i->xid) ); // \todo check for the handling of doublebuffered windows int xp = 0, yp = 0; Fl_Window *win = this; @@ -1432,6 +1450,6 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) { // -// End of "$Id: Fl_mac.cxx,v 1.1.2.26 2002/06/11 18:44:07 easysw Exp $". +// End of "$Id: Fl_mac.cxx,v 1.1.2.27 2002/06/27 04:29:39 matthiaswm Exp $". // diff --git a/src/fl_draw_image_mac.cxx b/src/fl_draw_image_mac.cxx index eaaf9bd74..867367dac 100644 --- a/src/fl_draw_image_mac.cxx +++ b/src/fl_draw_image_mac.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_draw_image_mac.cxx,v 1.1.2.3 2002/01/03 08:08:21 matthiaswm Exp $" +// "$Id: fl_draw_image_mac.cxx,v 1.1.2.4 2002/06/27 04:29:39 matthiaswm Exp $" // // MacOS image drawing code for the Fast Light Tool Kit (FLTK). // @@ -45,7 +45,7 @@ * buf: pointer to first byte in image source * x, y: position in buffer * w: width (in bytes?) - * dst: destinaation buffer + * dst: destination buffer * userdata: ? */ static void innards(const uchar *buf, int X, int Y, int W, int H, @@ -122,6 +122,7 @@ static void innards(const uchar *buf, int X, int Y, int W, int H, DisposeGWorld( gw ); } + // great. We were able to write the pixels directly into memory, so we can return now. if ( direct ) return; @@ -274,5 +275,5 @@ void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) { } // -// End of "$Id: fl_draw_image_mac.cxx,v 1.1.2.3 2002/01/03 08:08:21 matthiaswm Exp $". +// End of "$Id: fl_draw_image_mac.cxx,v 1.1.2.4 2002/06/27 04:29:39 matthiaswm Exp $". // diff --git a/src/fl_font_mac.cxx b/src/fl_font_mac.cxx index 8188e6ec5..87a397d81 100644 --- a/src/fl_font_mac.cxx +++ b/src/fl_font_mac.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_font_mac.cxx,v 1.1.2.8 2002/06/08 15:37:11 easysw Exp $" +// "$Id: fl_font_mac.cxx,v 1.1.2.9 2002/06/27 04:29:39 matthiaswm Exp $" // // MacOS font selection routines for the Fast Light Tool Kit (FLTK). // @@ -56,6 +56,7 @@ Fl_FontSize* fl_fontsize = 0L; Fl_FontSize::~Fl_FontSize() { /* #if HAVE_GL + // ++ todo: remove OpenGL font alocations // Delete list created by gl_draw(). This is not done by this code // as it will link in GL unnecessarily. There should be some kind // of "free" routine pointer, or a subclass? @@ -147,6 +148,7 @@ double fl_width(const char* c, int n) { return (double)TextWidth( c, 0, n ); } +// todo : fl_width returns wrong results for OS X double fl_width(uchar c) { return (double)TextWidth( &c, 0, 1 ); } @@ -157,5 +159,5 @@ void fl_draw(const char* str, int n, int x, int y) { } // -// End of "$Id: fl_font_mac.cxx,v 1.1.2.8 2002/06/08 15:37:11 easysw Exp $". +// End of "$Id: fl_font_mac.cxx,v 1.1.2.9 2002/06/27 04:29:39 matthiaswm Exp $". // diff --git a/src/gl_draw.cxx b/src/gl_draw.cxx index e7ca43080..5d8fa6d5c 100644 --- a/src/gl_draw.cxx +++ b/src/gl_draw.cxx @@ -1,5 +1,5 @@ // -// "$Id: gl_draw.cxx,v 1.7.2.5.2.7 2002/05/25 13:38:25 easysw Exp $" +// "$Id: gl_draw.cxx,v 1.7.2.5.2.8 2002/06/27 04:29:39 matthiaswm Exp $" // // OpenGL drawing support routines for the Fast Light Tool Kit (FLTK). // @@ -53,8 +53,10 @@ void gl_font(int fontid, int size) { wglUseFontBitmaps(fl_gc, base, size, fl_fontsize->listbase+base); SelectObject(fl_gc, oldFid); #elif defined(__APPLE__) - // \todo Mac : Insert MacOS/AGL font handling here (aglUseFont) - // aglUseFont( context, fontID/GetFNum(), Style[norma, bold, italic], size, first, count, base ); + // undefined characters automatically receive an empty GL LIst in aglUseFont + fl_fontsize->listbase = glGenLists(256); + aglUseFont(aglGetCurrentContext(), fl_fontsize->font, fl_fontsize->face, + fl_fontsize->size, 0, 256, fl_fontsize->listbase); #else int base = fl_xfont->min_char_or_byte2; int size = fl_xfont->max_char_or_byte2-base+1; @@ -157,5 +159,5 @@ void gl_draw_image(const uchar* b, int x, int y, int w, int h, int d, int ld) { #endif // -// End of "$Id: gl_draw.cxx,v 1.7.2.5.2.7 2002/05/25 13:38:25 easysw Exp $". +// End of "$Id: gl_draw.cxx,v 1.7.2.5.2.8 2002/06/27 04:29:39 matthiaswm Exp $". // diff --git a/test/help.cxx b/test/help.cxx index 96254f77b..dc3fca907 100644 --- a/test/help.cxx +++ b/test/help.cxx @@ -1,5 +1,5 @@ // -// "$Id: help.cxx,v 1.1.2.4 2002/01/01 15:11:33 easysw Exp $" +// "$Id: help.cxx,v 1.1.2.5 2002/06/27 04:29:39 matthiaswm Exp $" // // Fl_Help_Dialog test program. // @@ -48,7 +48,7 @@ main(int argc, // I - Number of command-line arguments help = new Fl_Help_Dialog; if (argc < 2) - help->load("../documentation/index.html"); + help->load("../../documentation/index.html"); else help->load(argv[1]); @@ -63,5 +63,5 @@ main(int argc, // I - Number of command-line arguments // -// End of "$Id: help.cxx,v 1.1.2.4 2002/01/01 15:11:33 easysw Exp $". +// End of "$Id: help.cxx,v 1.1.2.5 2002/06/27 04:29:39 matthiaswm Exp $". // diff --git a/test/preferences.fl b/test/preferences.fl index 58d0b9932..443684c2c 100644 --- a/test/preferences.fl +++ b/test/preferences.fl @@ -1,10 +1,7 @@ # data file for the Fltk User Interface Designer (fluid) version 1.0100 header_name {.h} -code_name {.cxx} -gridx 5 -gridy 5 -snap 3 +code_name {.cxx} decl {\#include } {public } @@ -13,8 +10,7 @@ decl {\#include } {public decl {\#include } {} -decl {\#include } {selected -} +decl {\#include } {} decl {void readPrefs();} {public } @@ -175,7 +171,7 @@ Function {} {open return_type int xywh {175 185 70 20} type Horizontal align 8 minimum 2 maximum 6 value 3.1 } Fl_Input wPaper { - label {Newspaper:} + label {Newspaper:} selected xywh {165 225 105 20} align 5 } }