Re: [fltk.bugs] [MOD] STR #2939: Fl_Tabs not honoring when(FL_WHEN_NOT_CHANGED)

2013-03-28 Thread Greg Ercolano
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2939
Version: 1.3.2


Attaching a test program, when.cxx, to test the when() behavior
of tabs vs. radio buttons vs. hold + multi browser.

Also, used this program to generate this table of when() behavior
which will be useful for perhaps fixing not only Fl_Tabs, but bugs
in existing widgets:
http://seriss.com/people/erco/fltk/when-behavior-03-26-2013.html

This test should probably be integrated into the unittests
to check the when() behavior of all widgets. (Instead of using
the tty, the unittest could probably pop open an Fl_Text_Display
widget on first callback, and scroll realtime callback msgs in that)


Link: http://www.fltk.org/str.php?L2939
Version: 1.3.2#include FL/Fl.H
#include FL/Fl_Window.H
#include FL/Fl_Tabs.H
#include FL/Fl_Group.H
#include FL/Fl_Button.H
#include FL/Fl_Radio_Button.H
#include FL/Fl_Choice.H
#include FL/Fl_Box.H
#include FL/Fl_Browser.H

Fl_Tabs   *G_tabs = 0;
Fl_Radio_Button *G_radio1 = 0;
Fl_Radio_Button *G_radio2 = 0;
Fl_Radio_Button *G_radio3 = 0;
Fl_Choice   *G_choice = 0;
Fl_Browser  *G_brow_hold = 0;
Fl_Browser  *G_brow_mult = 0;

void Widget_CB(Fl_Widget*w,void*v) {
const char *msg = (const char*)v;
if (strcmp(msg,MULTI BROWSER)==0|| strcmp(msg,HOLD BROWSER)==0) {
Fl_Browser *b = (Fl_Browser*)w;
printf(%s Callback, changed()=%d value()=%d text()='%s'\n, msg, 
w-changed(),b-value(),b-text(b-value()));
} else {
printf(%s Callback, changed()=%d\n, msg, w-changed());
}
}

void When_CB(Fl_Widget*w,void*) {
int when = 0;
const char *s = G_choice-text();
if ( strcmp(s,NEVER  )==0) when = FL_WHEN_NEVER;
if ( strcmp(s,CHANGED)==0) when = FL_WHEN_CHANGED;
if ( strcmp(s,NOT_CHANGED)==0) when = FL_WHEN_NOT_CHANGED;
if ( strcmp(s,RELEASE)==0) when = FL_WHEN_RELEASE;
if ( strcmp(s,CHANGED+NOT_CHANGED)==0) when = 
FL_WHEN_CHANGED|FL_WHEN_NOT_CHANGED;
if ( strcmp(s,RELEASE+CHANGED)==0) when = 
FL_WHEN_RELEASE|FL_WHEN_CHANGED;
if ( strcmp(s,RELEASE+NOT_CHANGED)==0) when = 
FL_WHEN_RELEASE|FL_WHEN_NOT_CHANGED;
if ( strcmp(s,RELEASE+CHANGED+NOT_CHANGED)==0) when = 
FL_WHEN_RELEASE|FL_WHEN_CHANGED|FL_WHEN_NOT_CHANGED;
// Apply new when value to radio button and tabs widget..
G_radio1-when(when);
G_radio2-when(when);
G_radio3-when(when);
G_tabs-when(when);
G_brow_hold-when(when);
G_brow_mult-when(when);
printf(\n*** WHEN IS NOW %d (%s)\n, when, s);
}

int main(int argc, char *argv[]) {
Fl_Window *win = new Fl_Window(720,240,Tabs Example);
{
G_tabs = new Fl_Tabs(10,10,500-20-110,200-20);
{
// Aaa tab
Fl_Group *aaa = new Fl_Group(10,35,500-20-110,200-45,Aaa);
{
new Fl_Box(50,40,aaa-w()-100,20,These buttons do nothing);
Fl_Button *b1 = new Fl_Button(50, 60,90,25,Button A1); 
b1-color(88+1);
Fl_Button *b2 = new Fl_Button(50, 90,90,25,Button A2); 
b2-color(88+2);
Fl_Button *b3 = new Fl_Button(50,120,90,25,Button A3); 
b3-color(88+3);
}
aaa-end();
// Bbb tab
Fl_Group *bbb = new Fl_Group(10,35,500-10,200-35,Bbb);
{
new Fl_Box(50,40,aaa-w()-100,20,These buttons do nothing);
Fl_Button *b1 = new Fl_Button( 50,60,90,25,Button B1); 
b1-color(88+1);
Fl_Button *b2 = new Fl_Button(150,60,90,25,Button B2); 
b2-color(88+3);
Fl_Button *b3 = new Fl_Button(250,60,90,25,Button B3); 
b3-color(88+5);
Fl_Button *b4 = new Fl_Button( 50,90,90,25,Button B4); 
b4-color(88+2);
Fl_Button *b5 = new Fl_Button(150,90,90,25,Button B5); 
b5-color(88+4);
Fl_Button *b6 = new Fl_Button(250,90,90,25,Button B6); 
b6-color(88+6);
}
bbb-end();
}
G_tabs-end();
G_tabs-callback(Widget_CB, (void*)TABS);

G_choice = new Fl_Choice(500-100-10,30,100,25,when());
G_choice-align(FL_ALIGN_TOP);
G_choice-add(NEVER);
G_choice-add(CHANGED);
G_choice-add(NOT_CHANGED);
G_choice-add(RELEASE);
G_choice-add(CHANGED+NOT_CHANGED);
G_choice-add(RELEASE+CHANGED);
G_choice-add(RELEASE+NOT_CHANGED);
G_choice-add(RELEASE+CHANGED+NOT_CHANGED);
G_choice-callback(When_CB);
G_choice-textsize(9);

Fl_Group *rg = new Fl_Group(G_choice-x(), G_choice-y()+35, 100,100);
rg-color(50);
rg-begin();
G_radio1 = new Fl_Radio_Button(rg-x(),rg-y()+00,rg-w(),25,Radio 
1);
G_radio1-callback(Widget_CB,(void*)RADIO1);
G_radio2 = new Fl_Radio_Button(rg-x(),rg-y()+30,rg-w(),25,Radio 
2);
G_radio2-callback(Widget_CB,(void*)RADIO2);
G_radio3 = new 

Re: [fltk.bugs] [MOD] STR #2939: Fl_Tabs not honoring when(FL_WHEN_NOT_CHANGED)

2013-03-28 Thread Greg Ercolano

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2939
Version: 1.3.2


Meh, forgot to rename the test program;
uploaded as tabs.cxx instead of when.cxx.


Link: http://www.fltk.org/str.php?L2939
Version: 1.3.2

___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


[fltk.commit] [Library] r9853 - in branches/branch-1.3: FL src

2013-03-28 Thread fltk-dev
Author: greg.ercolano
Date: 2013-03-28 20:37:04 -0700 (Thu, 28 Mar 2013)
New Revision: 9853
Log:
Documenting the public methods Fl_Tabs::push()



Modified:
   branches/branch-1.3/FL/Fl_Tabs.H
   branches/branch-1.3/src/Fl_Tabs.cxx

Modified: branches/branch-1.3/FL/Fl_Tabs.H
===
--- branches/branch-1.3/FL/Fl_Tabs.H2013-03-27 19:21:22 UTC (rev 9852)
+++ branches/branch-1.3/FL/Fl_Tabs.H2013-03-29 03:37:04 UTC (rev 9853)
@@ -69,7 +69,14 @@
   Fl_Widget *value();
   int value(Fl_Widget *);
   /**
-  \todo This public method needs to be documented
+Returns the tab group for the tab the user has currently down-clicked on
+and remains over until FL_RELEASE. Otherwise, returns NULL.
+
+While the user is down-clicked on a tab, the return value is the tab group
+for that tab. But as soon as the user releases, or drags off the tab with
+the button still down, the return value will be NULL.
+
+\see push(Fl_Widget*).
   */
   Fl_Widget *push() const {return push_;}
   int push(Fl_Widget *);

Modified: branches/branch-1.3/src/Fl_Tabs.cxx
===
--- branches/branch-1.3/src/Fl_Tabs.cxx 2013-03-27 19:21:22 UTC (rev 9852)
+++ branches/branch-1.3/src/Fl_Tabs.cxx 2013-03-29 03:37:04 UTC (rev 9853)
@@ -263,7 +263,15 @@
 }
 
 /**
-  \todo This public method needs to be documented
+  This is called by the tab widget's handle() method to set the
+  tab group widget the user last FL_PUSH'ed on. Set back to zero
+  on FL_RELEASE.
+
+  As of this writing, the value is mainly used by draw_tab()
+  to determine whether or not to draw a 'down' box for the tab
+  when it's clicked, and to turn it off if the user drags off it.
+
+  \see push().
 */
 int Fl_Tabs::push(Fl_Widget *o) {
   if (push_ == o) return 0;

___
fltk-commit mailing list
fltk-commit@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-commit


[fltk.commit] [Library] r9854 - branches/branch-1.3/src

2013-03-28 Thread fltk-dev
Author: greg.ercolano
Date: 2013-03-28 21:36:51 -0700 (Thu, 28 Mar 2013)
New Revision: 9854
Log:
Document Fl_Tabs::value()'s integer return value.


Modified:
   branches/branch-1.3/src/Fl_Tabs.cxx

Modified: branches/branch-1.3/src/Fl_Tabs.cxx
===
--- branches/branch-1.3/src/Fl_Tabs.cxx 2013-03-29 03:37:04 UTC (rev 9853)
+++ branches/branch-1.3/src/Fl_Tabs.cxx 2013-03-29 04:36:51 UTC (rev 9854)
@@ -304,6 +304,8 @@
   Sets the widget to become the current visible widget/tab.
   Setting the value hides all other children, and makes this one
   visible, if it is really a child.
+  \returns 1 if there was a change (new value different from previous),BR
+   0 if there was no change (new value already set)
 */
 int Fl_Tabs::value(Fl_Widget *newvalue) {
   Fl_Widget*const* a = array();

___
fltk-commit mailing list
fltk-commit@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-commit


Re: [fltk.development] RFC: Adding when() support in Fl_Tabs

2013-03-28 Thread Greg Ercolano
 So here's a big table comparing the when() behavior of radio and
 browser, comparing mouse clicks and keyboard nav clicks:
 http://seriss.com/people/erco/fltk/when-behavior-03-26-2013.html

Fixed that table up a bit to make it easier to read.
Hit Reload to see the changes.

During testing I noticed some inconsistencies with changed()'s value,
so started adding that to the table too.

___
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev


Re: [fltk.development] [RFE] STR #2941: RFE: fl_text_extents(): support multiple lines

2013-03-28 Thread Ian MacArthur

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2941
Version: 1.3-feature


This may be possible, but I didn't do it (thinking about it was making my
head hurt...)

I guess the idea is to use the typographical height of the folded
string, which will take into account the vertical leading between rows of
text and so forth; but tailor that to take account of the inked height
of the first and last rows... Or something...

In any case, I think we'd maybe want to make that a distinct function from
fl_text_extents() if we did that ?

I also wonder about (somehow) handling fltk @ symbol expansion and so
forth in the improved mechanism. If we go that way...


Link: http://www.fltk.org/str.php?L2941
Version: 1.3-feature

___
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev


Re: [fltk.development] [RFE] STR #2941: RFE: fl_text_extents(): support multiple lines

2013-03-28 Thread Greg Ercolano

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2941
Version: 1.3-feature


Based on fl_measure(), I'd say symbol support isn't hard.

The symbols simply scale to the current string height, whatever it is.

So if it's a single line, it's exactly fl_height().

If it's multiple lines, it scales to the fl_height() x #lines.

The new code I intend to replace fl_measure()'s with will probably
be good reference for that. Perhaps I should make it a function that
returns the (potentially two) symbol sizes.

The symbol size calculations in fl_measure() appear to assume
symbols are square, which makes computation easy.

Apparently symbol scaling (e.g. @+9- and @-9-) doesn't affect
fl_measure() calculations, so I guess it just over-draws or under-draws
when the user supplies that in a string.


Link: http://www.fltk.org/str.php?L2941
Version: 1.3-feature

___
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev


Re: [fltk.development] [RFE] STR #2941: RFE: fl_text_extents(): support multiple lines

2013-03-28 Thread Greg Ercolano

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2941
Version: 1.3-feature


 symbols simply scale to the current string height, whatever it is.

I should add fltk's @ symbols are not really like characters,
they're more like graphics that fill the left and right margins.

See this screenshot, esp. see the last example for the behavior
of @ symbols in a multiline string:
http://www.fltk.org/strfiles/2940/symbol-examples.png

I never knew it worked that way; want to add that to the docs,
which is what STR# 2940 covers.


Link: http://www.fltk.org/str.php?L2941
Version: 1.3-feature

___
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev


Re: [fltk.general] fltk2.0.x-alpha-r9296 missing

2013-03-28 Thread Greg Ercolano
On 03/26/13 16:48, Gonzalo Garramuno wrote:
 fltk-2 is, as you know, deprecated, and no one is available to maintain nor=
  fix it, so we can't really go on distributing it, until it gets fixed...
 
 Sure you can distribute it.  It is there in the main page, what version to 
 download.

I don't know anything about 2.x, but indeed it looks like
the tar balls are no longer in the download section.. don't know why.

You should be able to still access 2.x from SVN;
see the instructions under Subversion Access on the downloads page, 
eg:

svn co http://svn.easysw.com/public/fltk/fltk/trunk fltk-2.0

I just checked it out; the last commit was on Mar 2012.
Seems to build OK for me, on centos 5.6 at least.

You mentioned the trunk doesn't build.. try a fresh checkout.
If that doesn't work, what platform and what errors?
Not sure I or anyone can advise, all I know is all active
alpha dev on 2.x has been redirected to 3.x

___
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk