Browse Source

- removed more inconsistencies between fl_draw and fl_measure (STR #1408)

- made the Tooltip hide code a little bit smarter
- Added subwindow test case to Fl_Tabs

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5378 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
pull/168/head
Matthias Melcher 19 years ago
parent
commit
00ec9da8f5
  1. 2
      CHANGES
  2. 6
      src/Fl_Tooltip.cxx
  3. 8
      src/fl_draw.cxx
  4. 21
      test/tabs.fl

2
CHANGES

@ -1,5 +1,7 @@
CHANGES IN FLTK 1.1.8 CHANGES IN FLTK 1.1.8
- Fixed more inconsistencies between fl_draw
and fl_measure (STR #1408)
- Fixed fl_measure which mistook a trailing '@@' - Fixed fl_measure which mistook a trailing '@@'
for a symbol (STR #1406) for a symbol (STR #1406)
- Fixed GLUT behavior on window creation (STR #1403) - Fixed GLUT behavior on window creation (STR #1403)

6
src/Fl_Tooltip.cxx

@ -194,7 +194,7 @@ Fl_Tooltip::exit_(Fl_Widget *w) {
widget_ = 0; widget_ = 0;
Fl::remove_timeout(tooltip_timeout); Fl::remove_timeout(tooltip_timeout);
Fl::remove_timeout(recent_timeout); Fl::remove_timeout(recent_timeout);
if (window) window->hide(); if (window && window->visible()) window->hide();
if (recent_tooltip) { if (recent_tooltip) {
if (Fl::event_state() & FL_BUTTONS) recent_tooltip = 0; if (Fl::event_state() & FL_BUTTONS) recent_tooltip = 0;
else Fl::add_timeout(Fl_Tooltip::hoverdelay(), recent_timeout); else Fl::add_timeout(Fl_Tooltip::hoverdelay(), recent_timeout);
@ -233,11 +233,11 @@ Fl_Tooltip::enter_area(Fl_Widget* wid, int x,int y,int w,int h, const char* t)
#ifdef WIN32 #ifdef WIN32
// possible fix for the Windows titlebar, it seems to want the // possible fix for the Windows titlebar, it seems to want the
// window to be destroyed, moving it messes up the parenting: // window to be destroyed, moving it messes up the parenting:
if (window) window->hide(); if (window && window->visible()) window->hide();
#endif // WIN32 #endif // WIN32
tooltip_timeout(0); tooltip_timeout(0);
} else { } else {
if (window) window->hide(); if (window && window->visible()) window->hide();
Fl::add_timeout(Fl_Tooltip::delay(), tooltip_timeout); Fl::add_timeout(Fl_Tooltip::delay(), tooltip_timeout);
} }

8
src/fl_draw.cxx

@ -158,7 +158,6 @@ void fl_draw(
symtotal = symwidth[0] + symwidth[1]; symtotal = symwidth[0] + symwidth[1];
if (str) {
for (p = str, lines=0; p;) { for (p = str, lines=0; p;) {
e = expand(p, buf, w - symtotal, buflen, width, align&FL_ALIGN_WRAP, e = expand(p, buf, w - symtotal, buflen, width, align&FL_ALIGN_WRAP,
draw_symbols); draw_symbols);
@ -166,7 +165,6 @@ void fl_draw(
if (!*e || (*e == '@' && e[1] != '@' && draw_symbols)) break; if (!*e || (*e == '@' && e[1] != '@' && draw_symbols)) break;
p = e; p = e;
} }
} else lines = 0;
if ((symwidth[0] || symwidth[1]) && lines) { if ((symwidth[0] || symwidth[1]) && lines) {
if (symwidth[0]) symwidth[0] = lines * fl_height(); if (symwidth[0]) symwidth[0] = lines * fl_height();
@ -295,6 +293,7 @@ void fl_measure(const char* str, int& w, int& h, int draw_symbols) {
symbol[1][0] = '\0'; symbol[1][0] = '\0';
symwidth[1] = 0; symwidth[1] = 0;
if (draw_symbols) {
if (str && str[0] == '@' && str[1] && str[1] != '@') { if (str && str[0] == '@' && str[1] && str[1] != '@') {
// Start with a symbol... // Start with a symbol...
for (symptr = symbol[0]; for (symptr = symbol[0];
@ -302,12 +301,13 @@ void fl_measure(const char* str, int& w, int& h, int draw_symbols) {
*symptr++ = *str++); *symptr++ = *str++);
*symptr = '\0'; *symptr = '\0';
if (isspace(*str)) str++; if (isspace(*str)) str++;
symwidth[0] = h; symwidth[0] = min(w,h);
} }
if (str && (p = strrchr(str, '@')) != NULL && p > (str + 1) && p[-1]!='@') { if (str && (p = strrchr(str, '@')) != NULL && p > (str + 1) && p[-1]!='@') {
strlcpy(symbol[1], p, sizeof(symbol[1])); strlcpy(symbol[1], p, sizeof(symbol[1]));
symwidth[1] = h; symwidth[1] = min(w,h);
}
} }
symtotal = symwidth[0] + symwidth[1]; symtotal = symwidth[0] + symwidth[1];

21
test/tabs.fl

@ -1,18 +1,18 @@
# data file for the Fltk User Interface Designer (fluid) # data file for the Fltk User Interface Designer (fluid)
version 1.0107 version 1.0108
header_name {.h} header_name {.h}
code_name {.cxx} code_name {.cxx}
Function {} {open Function {} {open
} { } {
Fl_Window foo_window {open Fl_Window foo_window {open
xywh {561 88 320 331} type Double resizable visible xywh {423 205 320 331} type Double resizable visible
} { } {
Fl_Tabs {} {open Fl_Tabs {} {open
tooltip {the various index cards test different aspects of the Fl_Tabs widget} xywh {10 10 300 200} selection_color 4 labelcolor 7 resizable tooltip {the various index cards test different aspects of the Fl_Tabs widget} xywh {10 10 300 200} selection_color 4 labelcolor 7 resizable
} { } {
Fl_Group {} { Fl_Group {} {
label Label1 open label Label1 open selected
tooltip {this Tab tests correct keyboard navigation between text input fields} xywh {10 30 300 180} selection_color 1 hide resizable tooltip {this Tab tests correct keyboard navigation between text input fields} xywh {10 30 300 180} selection_color 1 resizable
} { } {
Fl_Input {} { Fl_Input {} {
label {input:} label {input:}
@ -28,8 +28,8 @@ Function {} {open
} }
} }
Fl_Group {} { Fl_Group {} {
label tab2 open selected label tab2 open
tooltip {tab2 tests among other things the cooperation of modal windows and tabs} xywh {10 30 300 180} selection_color 2 tooltip {tab2 tests among other things the cooperation of modal windows and tabs} xywh {10 30 300 180} selection_color 2 hide
} { } {
Fl_Button {} { Fl_Button {} {
label button1 label button1
@ -93,16 +93,21 @@ Function {} {open
} { } {
Fl_Button {} { Fl_Button {} {
label button2 label button2
tooltip {button2 has a different tooltp than tab5} xywh {20 80 60 80} tooltip {button2 has a different tooltp than tab5} xywh {20 45 60 80}
} }
Fl_Button {} { Fl_Button {} {
label button label button
xywh {90 90 60 80} xywh {90 45 60 80}
} }
Fl_Clock {} { Fl_Clock {} {
label {Make sure this clock does not use processor time when this tab is hidden or window is iconized} label {Make sure this clock does not use processor time when this tab is hidden or window is iconized}
xywh {160 50 100 100} box OSHADOW_BOX color 238 selection_color 0 labelfont 8 labelsize 10 align 130 xywh {160 50 100 100} box OSHADOW_BOX color 238 selection_color 0 labelfont 8 labelsize 10 align 130
} }
Fl_Group {} {
label subwindow open
xywh {20 135 130 65} box THIN_DOWN_BOX color 167 align 16
class Fl_Window
} {}
} }
} }
Fl_Input {} { Fl_Input {} {

Loading…
Cancel
Save