Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)

2012-01-05 Thread David Lopez

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

[STR Pending]

Link: http://www.fltk.org/str.php?L2795
Version: 1.3-current
Fix Version: 1.3-current (r9217)


I tested fltree.patch in Windows with the tree-100k.cxx sample code and my
application. It worked fine.


Link: http://www.fltk.org/str.php?L2795
Version: 1.3-current
Fix Version: 1.3-current (r9217)

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


[fltk.bugs] [LOW] STR #2798: X11 coordinate clipping - label

2011-12-22 Thread David FLEURY
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2798
Version: 1.3-current


It seems that X11 use short value for drawing string (XDrawString),
for Fl_Tree_Item, it can make problem of drawing labels when x, y overflow
short max/min values.

In this sample, there is 4 labels that must not appear (out of bound).
A naive patch attached to prevent simple cases to happen.
I keep fltk gurus for a better solution.


#include 
#include 
#include 

struct MyWindow : Fl_Window {
   MyWindow() : Fl_Window( 30,50,500,300, "Label bug" )
   {}
   
   void draw() {
  fl_draw( "01", 0, 30 );
  fl_draw( "0123",   0, 40+65536 );
  fl_draw( "012345", 0, 50-65536 );  
  fl_draw( "0123", -20, 60 );

  fl_rtl_draw( "01", 2,  50, 130 );
  fl_rtl_draw( "0123",   4,  50, 140+65536 );
  fl_rtl_draw( "012345", 6,  50, 150-65536 );  
  fl_rtl_draw( "0123",   4, -20, 160 );
   }
};

int main() {
   MyWindow w;
   w.show();
   return Fl::run();
}


Link: http://www.fltk.org/str.php?L2798
Version: 1.3-currentIndex: fl_font_x.cxx
===
--- fl_font_x.cxx   (révision 9209)
+++ fl_font_x.cxx   (copie de travail)
@@ -17,6 +17,16 @@
 //
 #ifndef FL_DOXYGEN
 
+namespace {
+   const int SHRT_MAX = 32676;
+   const int SHRT_MIN = -32666;
+
+   int clip_to_short(int x, int y ) {
+return ( x < SHRT_MIN || x > SHRT_MAX || y < SHRT_MIN || y > SHRT_MAX );
+   }
+}
+
+
 Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name) {
   font = XCreateUtf8FontStruct(fl_display, name);
   if (!font) {
@@ -314,11 +324,12 @@
 font_gc = fl_gc;
 XSetFont(fl_display, fl_gc, font_descriptor()->font->fid);
   }
-  if (fl_gc) XUtf8DrawString(fl_display, fl_window, font_descriptor()->font, 
fl_gc, x, y, c, n);
+  if (fl_gc ) XUtf8DrawString(fl_display, fl_window, font_descriptor()->font, 
fl_gc, x, y, c, n);
 }
 
 void Fl_Xlib_Graphics_Driver::draw(int angle, const char *str, int n, int x, 
int y) {
   fprintf(stderr,"ROTATING TEXT NOT IMPLEMENTED\n");
+  if ( clip_to_short( x, y ) ) return;
   this->draw(str, n, (int)x, (int)y);
 }
 
@@ -327,7 +338,7 @@
 if (!font_descriptor()) this->font(FL_HELVETICA, FL_NORMAL_SIZE);
 font_gc = fl_gc;
   }
-  if (fl_gc) XUtf8DrawRtlString(fl_display, fl_window, 
font_descriptor()->font, fl_gc, x, y, c, n);
+  if (fl_gc ) XUtf8DrawRtlString(fl_display, fl_window, 
font_descriptor()->font, fl_gc, x, y, c, n);
 }
 #endif // FL_DOXYGEN
 //
___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


Re: [fltk.bugs] [LOW] STR #2797: X errors occur when XDBE disabled+ Fl_Double_Windows resized to zero on W or H

2011-12-21 Thread David FLEURY

>
> David's workaround was to do:
>
>myi->other_xid = ( w() && h() ? fl_create_offscreen(w(),h()) : 0 );
>
> instead, i.e. only create the offscreen surface for the double
> buffering of the window if the window has non-zero size. Otherwise,
> other_xid is set to NULL.
>
> It looks like *most* other places where other_xid is used, it is
> checkedfor being NULL first, so this ought to be safe.
>
> David reports good results with this workaround in his tests,
> though I was initially sceptical.
> I'm now of the opinion that this workaround is probably good,
> though we need to check there are no places where other_xid is
> actually used without
> first being checked for NULL, just to be sure!
>

I double check, and find an global variable initialize with this value.
Using nested double window using box can trigger X error. (PolySegment, and 
PolyText).

Here my full patch :
// Checking against 0 is not enough
myi->other_xid = ( w() >= 0 && h() >= 0 ? fl_create_offscreen(w(), h()) : 0 
);

and (near line 416 of Fl_Double_Window.cxx)

#else // X:
fl_window = myi->other_xid;
draw();
fl_window = myi->xid;
#endif

is replaced by


#else // X:
if ( myi->other_xid ) {
  // global init of the current X window
  fl_window = myi->other_xid;
  draw();
}
fl_window = myi->xid;
#endif


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


[fltk.bugs] Fl_Int_Input & Fl_Float_Input bugs

2011-12-18 Thread David FLEURY
Hi,
still hunting...
In demo, test/input

In Fl_Int_Input, you can enter :
 - 0x4645x1656x12312
You just have to move on the second position to add an 'x' for hexa.
 - 00x465465
(not sure it's a bug there, but the code suggest an 0[x|X]...  format only)

In Fl_Float_Input, you can enter :
 - 4653..54654.565664
too much decimal point separator.
 - 4E564+354654.54e654
too much "legal_fp_chars"

Regards,
David

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


Re: [fltk.bugs] [HIGH] STR #2761: Force break when wrapping long words

2011-12-12 Thread David

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

[STR New]

Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current


needs to work any time you want to call on fl_measure ( in addition to
fl_draw or fl_expand_text) so would need additional code to handle a new
option.  The current patch is already backwards compatible in that the app
has to set the option on for it to do anything (and doesn't require adding
additional parameters).  I think of it as more a fix than feature, only
making backwards compatible to not break things based off the one that
miscalculated wrapping.


Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current

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


Re: [fltk.bugs] [HIGH] STR #2761: Force break when wrapping long words

2011-12-12 Thread David
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current


Attached file "test_v2.cxx"...


Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current#include 
#include 
#include 
#include 

int main() {
//fl_force_wrap_breaks=1;
Fl_Window *win = new Fl_Window(410,250);
Fl_Box *box = new Fl_Box(60, 25, 340, 200);
box->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_WRAP);
box->label("The path is: 
How/about/a/long/path/that/has/no/spaces/in/it/but/you/want/to/ensure/the/full/path/shows/when/it/is/displayed/on/the/message.");
win->end();
win->show();

return(Fl::run());
}
___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


Re: [fltk.bugs] [HIGH] STR #2761: Force break when wrapping long words

2011-12-12 Thread David

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

[STR New]

Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current


I thought fl_choice had the problem too, I could have sworn it cut it off. 
I think I know why, the string had an @ in it and it was cutoff because of
that, when I applied one of the @ fixes, it must have still been limiting
width to the @ sign then not wrapping the rest.  Anyway, you can cause the
problem with the code being attached.  Uncomment the line after applying
the patch to see the fix work.


Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current

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


Re: [fltk.bugs] [HIGH] STR #2761: Force break when wrapping long words

2011-12-10 Thread David

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

[STR New]

Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current


Just use fl_choice with a long string with no white space.  

"The path is:
How/about/a/long/path/that/has/no/spaces/in/it/but/you/want/to/ensure/the/full/path/shows/when/it/is/displayed/on/the/message."


Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current

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


[fltk.bugs] [HIGH] STR #2761: Force break when wrapping long words

2011-11-03 Thread David
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current


This adds an option to force long words to break if they don't fit the
width in fl_expand_text (which is used by the various fl_draw and
fl_measure functions).  This is especially helpful in things like
fl_choice or other situations where all data must show. The option is
enabled by setting fl_force_wrap_breaks=1.  This was lightly tested
against some strings that were causing fl_choice to cut off text. Full
test probably needed, especially against non-printable data (< ' ' or 127)
that is converted to ^X format.


Link: http://www.fltk.org/str.php?L2761
Version: 1.3-currentIndex: FL/fl_draw.H
===
--- FL/fl_draw.H(revision 9166)
+++ FL/fl_draw.H(working copy)
@@ -34,7 +34,9 @@
 
 // Label flags...
 FL_EXPORT extern char fl_draw_shortcut;
+FL_EXPORT extern char fl_force_wrap_breaks; // option set by app and/or widgets
 
+
 /** \addtogroup fl_attributes
 @{
 */
Index: src/fl_draw.cxx
===
--- src/fl_draw.cxx (revision 9166)
+++ src/fl_draw.cxx (working copy)
@@ -32,9 +32,13 @@
 #include 
 #include 
 
+// GCC nor FLTK build environment set NDEBUG on release builds.
+//#include 
+
 #define MAXBUF 1024
 
 char fl_draw_shortcut; // set by fl_labeltypes.cxx
+char fl_force_wrap_breaks; // option set by app and/or widgets
 
 static char* underline_at;
 
@@ -119,11 +123,36 @@
   // test for word-wrap:
   if (word_start < p && wrap) {
double newwidth = w + fl_width(word_end, o-word_end);
-   if (word_end > buf && newwidth > maxw) { // break before this word
+// determine if line too long
+if (newwidth > maxw) {
+  // determine if prior word output that fits
+  if (word_end > buf) {
+// go back to the end of the prior word
  o = word_end;
  p = word_start;
  break;
}
+  // determine if this line has no spaces and is too long
+  else if (word_end == buf && fl_force_wrap_breaks) {
+// truncate to maxw
+while (newwidth > maxw && p > word_start) {
+  // move back to prior char
+  o--;
+  p--;
+  // handle encoded characters in output buffer
+  int tc=*p & 255;
+  if (tc < ' ' || tc == 127) {
+o--;
+  }
+  // sanity check in debugging mode
+  //assert(o >= buf);
+  // calculate new width again
+  newwidth = w + fl_width(word_end, o-word_end);
+}
+// leave the rest of this long word for the next line
+break;
+  }
+}
word_end = o;
w = newwidth;
   }
___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


[fltk.bugs] [MOD] STR #2748: fixed radio button hot key from turning it off if already on.

2011-10-26 Thread David

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

[STR New]

Link: http://www.fltk.org/str.php?L2748
Version: 1.3.0


radio buttons with hot keys (shortcuts) can get turned off if the hot key
is pressed when its already checked.  the attached fixes it.


Link: http://www.fltk.org/str.php?L2748
Version: 1.3.0
Attachment: http://www.fltk.org/strfiles/2748/Fl_Button_fix_hotkey.zip

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


[fltk.bugs] CMake BUILD_SHARED_LIBS fails on Win32

2009-01-16 Thread David Gobbi
This is identical to closed item STR #1780, except that it is for 1.1.9.  On 
Win32, BUILD_SHARED_LIBS should force the creation of a single fltkdll.dll just 
as the Visual Studio solution does.  I have fixed this issue in my own code and 
will submit a patch.
___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs