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

2011-12-11 Thread Greg Ercolano
On 12/10/11 23:24, David wrote:
> 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."

BTW, I'd suggest the OP derive their own widget to achieve the
requirements of your app, eg. one that uses Fl_Text_Display to
display the text (so that scrollbars appear if the text is too long).
This would also allow copy/paste from the text field.

This has been suggested for fl_choice(), but I forget why it
was rejected.

fl_choice() and friends are for very simple situations, and should
probably instead be superseded by a class based widget that allows
options for using more modern text display methods
eg. (Fl_Box/Fl_Multiline_Output/Fl_Text_Display/Fl_Help_View..)
and has more flexible features such as being able to set the
min/max width + height for the dialog, and so that a ^C
(or on macs, Meta-C) can 'copy' the entire text of the dialog,
even if the underlying widget isn't selectable. (Surprisingly,
something that works with eg. simple Windows error dialogs)
___
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-11 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?L2761
Version: 1.3-current


Attached file "test.cxx"...


Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current#include 
#include 
int main() {
fl_choice("The path is: 
How/about/a/long/path/that/has/no/spaces/in/it/but/you/want/to/ensure/the/full/"
  
"xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/"
  
"xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/"
  
"xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/"
  "path/shows/when/it/is/displayed/on/the/message.","Cancel", "OK", 
NULL);
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-11 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?L2761
Version: 1.3-current


Can't replicate with OP's text; try test.cxx attached.


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] [LOW] STR #2791: Minmum size for tiles in an Fl_Tile

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

[STR New]

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


Attached file "tiletest.cxx"...


Link: http://www.fltk.org/str.php?L2791
Version: 1.3-feature//
// "$Id: tiletest.cxx 2011-12-10 23:18:18Z r_strickland $"
//
//  Adapted from: 
// "$Id: tile.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Tile test program for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2010 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
//

#include 
#include 
#include 
#include 

//#define TEST_INACTIVE

/**
  Fl_TileM inherits from Fl_Tile. It functions similarly, but it
  enforces a minimum tile size

  TODO: the minimum sizes do not cascade. If you drag a separator
  into a tile that is already minimal in size, dragging ceases. It
  might be better if it were to push the minimal tile along until
  it reaches the edge.
*/
class Fl_TileM:public Fl_Tile {
protected:
  Fl_Cursor cursors[4];
  Fl_Cursor cursor;
  int thresh; // minimum window width or height in pixels
public:
  Fl_TileM(int x, int y, int w, int h, const char*l=0, int t=0)
  : Fl_Tile(x, y, w, h, l) {
thresh = t;
cursors[0] = FL_CURSOR_DEFAULT;
cursors[1] = FL_CURSOR_WE;
cursors[2] = FL_CURSOR_NS;
cursors[3] = FL_CURSOR_MOVE;
  };
  void position(int oix, int oiy, int newx, int newy); // override
  int handle(int event); // override. See note below.
  void set_thresh(int t) { thresh = t; };
protected:
  void set_cursor(Fl_Cursor c) {
if (cursor == c || !window()) return;
cursor = c;
#ifdef __sgi
window()->cursor(c,FL_RED,FL_WHITE);
#else
window()->cursor(c);
#endif
  };
};

/**
  Drag the edges that were initially (that is, when constructed) at
  oix,oiy to newx,newy.

  Pass zero as oix or oiy to disable drag in that direction.
  This redraws all the necessary children.
*/
void Fl_TileM::position(int oix, int oiy, int newx, int newy) {
  int nchild = children();
  //
  // pass == 0: calculate new sizes but return if resizing would 
  //make an undersized child
  // pass == 1: do the resizing
  //
  for (int pass = 0; pass < 2; pass++) {
Fl_Widget*const* a = array();
int *p = sizes();
p += 8; // skip group & resizable's saved size
for (int i = 0; i < nchild; i++, p += 4) {
  Fl_Widget* o = *a++;
  if (o == resizable()) continue;
  int L = o->x();
  int R = L+o->w();
  bool damage = false;
  if (oix) {
int t = p[0];
if (t==oix || (t>oix && Lnewx)) {
  L = newx;
  damage = true;
}
t = p[1];
if (t==oix || (t>oix && Rnewx)) {
  R = newx;
  damage = true;
}
if (damage && !pass && R-L < thresh) return;
  }
  int T = o->y();
  int B = T+o->h();
  if (oiy) {
int t = p[2];
if (t==oiy || (t>oiy && Tnewy)) {
  T = newy;
  damage = true;
}
t = p[3];
if (t==oiy || (t>oiy && Bnewy)) {
  B = newy;
  damage = true;
}
if (damage && !pass && B-T < thresh) return;
  }
  if (pass && damage) o->damage_resize(L,T,R-L,B-T);
}
  }
}

//
// Note: The changes to Fl_Tile::handle() have nothing to do
// with the minimum size threshold. They are to encapsulate the
// formerly static set_cursor() and associated cursor data.
// These prevented Fl_Tile::handle from being overridden.
//
int Fl_TileM::handle(int event) {
  static int sdrag;
  static int sdx, sdy;
  static int sx, sy;
#define DRAGH 1
#define DRAGV 2
#define GRABAREA 4

  int mx = Fl::event_x();
  int my = Fl::event_y();

  switch (event) {

  case FL_MOVE:
  case FL_ENTER:
  case FL_PUSH:
// don't potentially change the mouse cursor if inactive:
if (!active()) break; // will cascade inherited handle()
{
int mindx = 100;
int mindy = 100;
int oix = 0;
int oiy = 0;
Fl_Widget*const* a = array();
int *q = sizes();
int *p = q+8;
for (int i=children(); i--; p += 4) {
  Fl_Widget* o = *a++;
  if (o == resizable()) continue;
  if (p[1]y()<=my+GRABAREA && o->y()+o->h()>=my-GRABAREA) {
 

Re: [fltk.bugs] [LOW] STR #2791: Minmum size for tiles in an Fl_Tile

2011-12-11 Thread Robert Strickland

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

[STR New]

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


File tiletest.cxx is a test of Fl_TileM, inherited from Fl_Tile that sets a
minimum threshold for the size of a child tile. This has the effect of
displaying a double border along the

Fl_TileM also encapsulates set_cursor() and associated cursor data that
were static in the parent Fl_Tile class.

--Robert Strickland


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

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