Re: [fltk.bugs] [HIGH] STR #2634: fl_help_view bug fixes and new features

2011-12-08 Thread Mark Mcvittie

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

[STR New]

Link: http://www.fltk.org/str.php?L2634
Version: 1.4-feature


Hi mingodad, thanks for the row background color bug fix ie.  didn't work. Just to confirm that this code does the job:

  get_attr(attrptr, "BGCOLOR", attr, sizeof(attr));

  block->bgcolor = get_color(attr, rclr);

Re: doesn't break the words properly. If you could post a working example
that would be great as I've not noticed this.

Also, thanks for your email and re: nested table width problem. Yes I knew
there were some problems there, it will take me a while to look into it but
I'll get back to you about that.


Link: http://www.fltk.org/str.php?L2634
Version: 1.4-feature

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


Re: [fltk.bugs] [HIGH] STR #2634: fl_help_view bug fixes and new features

2011-05-17 Thread Mark Mcvittie

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

[STR New]

Link: http://www.fltk.org/str.php?L2634
Version: 1.4-feature


Greg, thanks for the help, I got the make working in Linux, I have ubuntu
9.10, I didn't have libxext-dev installed.

Ian, ok I will post my questions to fltk.general then. Thanks for the
advice.


Link: http://www.fltk.org/str.php?L2634
Version: 1.4-feature

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


Re: [fltk.bugs] [HIGH] STR #2634: fl_help_view bug fixes and new features

2011-05-17 Thread Mark Mcvittie

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

[STR New]

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


Here is my worklog for fl_help_view

rev 27
- fixed compiler errors to get it building with fltk-1.3.x make
- fixed seemingly random fonts appearing on Mac, required changes to
header
- fixed font list not being read properly on PPC Mac
- fixed no spaces between words on PPC Mac

rev 26
- changed scope of handle() to public
- added css functions: load_css(), parse_css(), get_css_value(),
get_font_size()
- added css properties: background-color, font-family/weight/style/size
- added recognition system for css shorthand properties: font, background
- fixed table without /tr breaking next row alignment
- fixed table without tr not being drawn
- added nearest font match to font_face()

rev 25
- removed getcwd for init with relative path, need to init with full path.
- fixed format_table crash if td colspan width too thin.
- added page topline position history, required changes to header/fltkgui.
- added javascript:history.back/forward/go support, required changes to
fltkgui.
- added openurl support for user navigation style, required changes to
fltkgui.

rev 24
- fixed some more misc bugs.
- added new function: setstyle, required changes to header and fltkgui.
- added default user navigation style.
- added print error page instead of null link.
- added getcwd for initializing with a relative path.

rev 23
- fixed a few misc bugs.
- removed font_find function, not necessary, required changes to header.
- fixed build_faces and font_face functions to work with anti-aliased
fonts.

rev 22
- fixed  sometimes not working bug, style spilling into next .
- added new methods: filepath and fileislink, for link targets fix.
- fixed link targets not stored in link history, required changes to
header and fltkgui.

rev 21
- removed support for drawing new char refs via Symbol font, not
compatible with FLTK 1.3.

rev 20
- added new method reformat, for calls to format.
- replaced add_block, format_table functions with extended argument
versions.
- added d-pointer by hijacking Fl_Help_Target, required changes to header.
- replaced compare_targets function with cmp_targets, due to d-pointer.
- replaced textfont_ and textsize_ with global statics.
- moved local statics to d-pointer struct.
- fixed links with target values not setting position on new page.

rev 19
- changed vertical scroll size, now moves double the amount.
- added new methods sansfont, monofont.
- added new function font_find, used for new default fonts.
- added new functions build_faces, font_face and font_style.
- added full support for font face attribute, required changes to header.
- fixed bold/italic not working with many fonts.
- removed inconsistent resizing tweak in format.

rev 18
- fixed nested table overwriting cell heights.
- fixed nested table drawn below row height.
- improved format speed to 30% less time, required changes to header.
- fixed cell width not reset before/after nested table.
- fixed nested table popping cell margin.
- fixed pre text in tables not increasing cell width.
- improved pre tabs width, miscalculated in tables.
- added CHR() and MIL() macros.
- fixed tables not popping last font.
- fixed divide by zero error if table cells empty.
- renamed variables and reordered functions alphabetically.

rev 17
- fixed mouse over horizontal scrollbar showing active link/hand icon.
- fixed last line in  misaligned, caused by new block per line system.
- fixed empty  on end of row affecting next row y position.
- fixed wrong line gaps before and after a table.
- fixed nested tables overwriting  and  'bgcolor'.
- improved color lookup, no hash needed for hex value.

rev 16
- improved block system, every line is now in it's own block.
- removed line[32] field to drop memory usage to about 30%, required
changes to header.
- tidied up code comments.

rev 15
- improved  and  line spacing.
- fixed font size not updating line y positions, required changes to
header.
- fixed nested tables overwriting subsequent  and  cell data,
required changes to header.

rev 14
- added skipping of 

Re: [fltk.bugs] [HIGH] STR #2634: fl_help_view bug fixes and new features

2011-05-17 Thread Mark Mcvittie

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

[STR New]

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


See above for header, my mistake I thought you could only post one file per
topic.


Link: http://www.fltk.org/str.php?L2634
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 #2634: fl_help_view bug fixes and new features

2011-05-17 Thread Mark Mcvittie
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

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


Attached file "Fl_Help_View.H"...


Link: http://www.fltk.org/str.php?L2634
Version: 1.3-current//
// "$Id: Fl_Help_View.H 5991 2007-12-15 16:08:23Z mike $"
//
// Help Viewer widget definitions.
//
// Copyright 1997-2005 by Easy Software Products.
// Image support donated by Matthias Melcher, Copyright 2000.
//
// 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
//
// Inline:
//
//   Fl_Help_View::directory()  - Get the directory string.
//   Fl_Help_View::filename()   - Get the filename string.
//   Fl_Help_View::link()   - Set the link callback.
//   Fl_Help_View::size()   - Get the total document length.
//   Fl_Help_View::size()   - Set the document width and height.
//   Fl_Help_View::textcolor()  - Set the default text color.
//   Fl_Help_View::textcolor()  - Get the default text color.
//   Fl_Help_View::textsize()   - Set the default font size.
//   Fl_Help_View::textsize()   - Get the default font size.
//   Fl_Help_View::title()  - Get the title string.
//   Fl_Help_View::topline()- Get the top line in document.
//   Fl_Help_View::leftline()   - Get the left line position.
//   Fl_Help_View::value()  - Get the HTML text value.
//   Fl_Help_View::monofont()   - Set the default mono font.
//   Fl_Help_View::monofont()   - Get the default mono font.
//   Fl_Help_View::reformat()   - Format the help text.
//   Fl_Help_View::sansfont()   - Set the default sans font.
//   Fl_Help_View::sansfont()   - Get the default sans font.
//   Fl_Help_View::serifont()   - Set the default serif font.
//   Fl_Help_View::serifont()   - Get the default serif font.
//

#ifndef Fl_Help_View_H
#  define Fl_Help_View_H

//
// Include necessary header files...
//

#  include 
#  include "Fl.H"
#  include "Fl_Group.H"
#  include "Fl_Scrollbar.H"
#  include "fl_draw.H"
#  include "Fl_Shared_Image.H"


//
// Fl_Help_Func type - link callback function for files...
//

typedef const char *(Fl_Help_Func)(Fl_Widget *, const char *);

//
// Fl_Help_Block structure
//

// note: we can change private structs accessed by pointers
struct Fl_Help_Block
{
  const char *start, // Start of text
*end; // End of text
  unsigned char border; // Draw border?
  Fl_Color bgcolor; // Background color
  int x, // Indentation/starting X coordinate
y, // Starting Y coordinate
w, // Width
h; // Height
  // new fields, removed int line[32];
  unsigned char fsize; // current font size
  int font, // current font
maxh, // max image height
imgy, // image y position
pre, // pre text flag
type, // blockquote/ol/ul/li type parameter
tag, // tag/element fourcc int
line, // Left starting position for each line
cbi; // current block index
};

//
// Fl_Help_Link structure
//

struct Fl_Help_Link
{
  char filename[192], // Link reference filename
name[32]; // Link target name, blank if none
  int x, // X offset of link text
y, // Y offset of link text
w, // Width of link text
h; // Height of link text
};

//
// Fl_Help_Target structure
//

// note: hijacking this lets us add new data members via the d-pointer
struct Fl_Help_Target
{
  // new fields, removed char name[32]; int y;
  Fl_Help_Link *targets, // Targets
*linkp; // Currently clicked link
  unsigned char ispush, // link is pushed
islink, // link clicked
resized, // window resized
ispath, // is path used
nstyle, // navigation style flag
isnew, // is new page
pad7, // 
pad8; // 
  int top, // current topline
ltop, // last topline
isnav, // is nav link
rwidth, // resize width
cssurllen, // css url length
csswordlen, // css word length
*cssword; // css word value
  long rtime, // resize time
rsec, // resize seconds
rmil, // resize millisecs
csstextlen; // css text length
  char *csstext, // css text value
*cssurl, // css url value
path[1024], // current file path
lpath[1024]; // last file path
  int nfonts, // number of fonts in stack
fonts[100][2]; // font stack
};

//
// Fl_Help_View class...
//

class FL_EXPORT Fl

[fltk.bugs] [HIGH] STR #2634: fl_help_view bug fixes and new features

2011-05-17 Thread Mark Mcvittie

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

[STR New]

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


Hi, this is a major update to fl_help_view.cxx, see attached and post below
for header. You can also get the 2 files here
http://blitzmirror.ueuo.com/fl_help_view.zip

I have been working on this since July 2008 and have been meaning to
release it for the last 6 months but I got worn out by it so it got
delayed. I have been developing it through the BlitzMax language but I got
stuck trying to get it working with the fltk library again. I had problems
with the make in Linux on my Dell Inspiron 1525 laptop, fluid won't link.
I would be very grateful for a fix for this btw, see below for error. I
finally got it working on my Macbook recently, that is with
fl_help_dialog.cxx tested via test/help. I haven't tried Windows at all
because I'm still confused by the install methods, any help?

Also I found a bug in Mac (not sure if it happens in Linux/Windows) with
getcwd() is always 'Users/username' so I had to put the documentation
folder in Users to get test/help working.

I do intend to keep working on this project so feel free to post bug
reports here.

This is the fluid error on Linux...

mark@mark-laptop:~/fltk-1.3.x-r7677$ make
=== making jpeg ===
=== making png ===
=== making src ===
Compiling Fl_Help_View.cxx...
/usr/bin/ar cr ../lib/libfltk.a ...
=== making fluid ===
Linking fluid...
../lib/libfltk.a(Fl_Double_Window.o): In function
`Fl_Double_Window::resize(int, int, int, int)':
Fl_Double_Window.cxx:(.text+0x118): undefined reference to
`XdbeDeallocateBackBufferName'
../lib/libfltk.a(Fl_Double_Window.o): In function `can_xdbe()':
Fl_Double_Window.cxx:(.text+0x186): undefined reference to
`XdbeQueryExtension'
Fl_Double_Window.cxx:(.text+0x1bd): undefined reference to
`XdbeGetVisualInfo'
Fl_Double_Window.cxx:(.text+0x1fa): undefined reference to
`XdbeFreeVisualInfo'
../lib/libfltk.a(Fl_Double_Window.o): In function
`Fl_Double_Window::flush(int)':
Fl_Double_Window.cxx:(.text+0x346): undefined reference to
`XdbeAllocateBackBufferName'
Fl_Double_Window.cxx:(.text+0x432): undefined reference to
`XdbeSwapBuffers'
../lib/libfltk.a(Fl_visual.o): In function `test_visual(XVisualInfo&,
int)':
Fl_visual.cxx:(.text+0x7f): undefined reference to `XdbeQueryExtension'
Fl_visual.cxx:(.text+0xb6): undefined reference to `XdbeGetVisualInfo'
collect2: ld returned 1 exit status
make[1]: *** [fluid] Error 1
make: *** [all] Error 1


Link: http://www.fltk.org/str.php?L2634
Version: 1.3-current
Attachment: http://www.fltk.org/strfiles/2634/Fl_Help_View.cxx

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


Re: [fltk.bugs] [HIGH] STR #2270: Fl::get_system_colors() failing on Linux distros

2009-11-23 Thread Mark Mcvittie

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

[STR New]

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


BTW it's not anything to do with urxvt (just a wild stab in the dark
there).

I've managed to autostart xrdb at login in ubuntu now. First I created a
script in the /home/username folder.
$ gedit initxrdb.sh

Then added the text.
#!/bin/sh
xrdb -merge /home/.Xdefaults

Saved it and gave it execute permissions.
$ sudo chmod +x initxrdb.sh

Then to get it to autostart I opened System > Preferences > Startup
Applications. Clicked the Add button, set the Name as initxrdb (it can be
anything) and the Command as ./initxrdb.sh then clicked Add and then
Close.


Link: http://www.fltk.org/str.php?L2270
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 #2270: Fl::get_system_colors() failing on Linux distros

2009-11-23 Thread Mark Mcvittie

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

[STR New]

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


Maybe but this affects any app that uses xrdb like eMacs for example, so I
think it's the distro's job to fix this.

Also, I found the selection color keyname today so just for the record I'm
using this in my Jaunty .Xdefaults now.

*background: #EFEBE7
*foreground: #101010
*selectBackground: #FFA443


Link: http://www.fltk.org/str.php?L2270
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 #2270: Fl::get_system_colors() failing on Linux distros

2009-11-22 Thread Mark Mcvittie

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

[STR New]

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


Slight correction, the file isn't gone in ubuntu 9.04 (64bit) as it seems
to be a custom file, it's gone in the X resources database though.

On top of this there is a bug in Jaunty where .Xdefaults is no longer read
on login.

https://bugs.launchpad.net/ubuntu/+source/xinit/+bug/320886

I checked openSUSE 11 (32bit) and it also doesn't have a /home/.Xdefaults
file but when I type "$ xrdb -query" the background/foreground colors are
there (but not there in ubuntu).

The only solution I could find in ubuntu was to manually enter "$ xrdb
-merge /home/.Xdefaults" on every login. I'm not sure if this has been
fixed in Karmic.

Also, here's a good article on X resources.

http://www.linuxjournal.com/article/1154


Link: http://www.fltk.org/str.php?L2270
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 #2270: Fl::get_system_colors() failing on Linux distros

2009-11-22 Thread Mark Mcvittie

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

[STR New]

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


Ok, so it seems the problem is the file $HOME/.Xdefaults is read by FLTK
and this file is gone in ubuntu 9.04 hence why it breaks. 

If I create a new file and fill it with this.
*background: #0055FF
*foreground: #FF5500

Followed by this, to update the database.
xrdb -merge .Xdefaults

I can "fix" it. Using a file named .Xresources also works.

I think this "bug" may be due to a change made in the urxvt package,
rather than from ubuntu. So not really FLTK's fault then.


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

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


[fltk.bugs] [HIGH] STR #2270: Fl::get_system_colors() failing on Linux distros

2009-10-09 Thread Mark Mcvittie

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

[STR New]

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


Hi, this was mentioned before here* but it was probably posted in the wrong
place so I'm reposting it to the bugs list.

http://www.fltk.org/newsgroups.php?s6593+gfltk.bugs+v6603+T0 *

> Fl::get_system_colors() doesn't appear able to retrieve the correct
> window manager theme colors on Ubuntu 9.04, resorting instead to the
> standard FLTK battle-ship grey and blue.  The exact same compiled
> binaries are able to retrieve colors on Ubuntu 8.10 set-ups.
> Has anyone else noticed this behaviour (FLTK 1.3)?

I get the same lack of system colors in Ubuntu 9.04 plus Mandriva 2009 and
Fedora 11 but it still works in openSUSE 11 and Ubuntu before 9  (all GTK
versions). It's like these distros have changed the location of the
database file.


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

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


[fltk.bugs] Fl::get_system_colors() not working with Ubuntu 9.04

2009-07-13 Thread Mark Mcvittie
Fl::get_system_colors() doesn't appear able to retrieve the correct window 
manager theme colors on Ubuntu 9.04, resorting instead to the standard FLTK 
battle-ship grey and blue.  The exact same compiled binaries are able to 
retrieve colors on Ubuntu 8.10 set-ups.

Has anyone else noticed this behaviour (FLTK 1.3)?
___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


[fltk.bugs] [HIGH] STR #2207: Shortcut keys with Ctrl key break when Caps Lock on

2009-06-22 Thread Mark Mcvittie

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

[STR New]

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


This is a report on behalf of SebHoll who has trouble signing up. 

Shortcut keys which use the Ctrl key (left or right) stop responding when
Caps Lock is on. This doesn't happen with Alt, Sys or Shift keys for some
reason. It only happens on Linux (probably due to its case-sensitive
nature), it has been tested in Windows and ubuntu.
For a quick example run test/editor and try the menu shortcuts.


Link: http://www.fltk.org/str.php?L2207
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 #2006: Fix for XTranslateCoordinates in fl_read_image.cxx

2008-12-11 Thread Mark Mcvittie

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

[STR New]

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


Hi Fabien, Seb writes:

I should have mentioned that that patch is now obselete after matt
committed the more water-tight error handling patch here:
http://www.fltk.org/str.php?L2021


Link: http://www.fltk.org/str.php?L2006
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 #2005: Fix for free(lineStr) in Fl_Text_Display.cxx

2008-09-03 Thread Mark Mcvittie

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

[STR New]

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


Oh you're right, the check should never happen if TMPFONTWIDTH is always 6.
I don't know then, I just post these on behalf of Seb as he had a problem
signing up to the forum. I'll point it out to him.


Link: http://www.fltk.org/str.php?L2005
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 #2005: Fix for free(lineStr) in Fl_Text_Display.cxx

2008-09-03 Thread Mark Mcvittie

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

[STR New]

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


Ah, mfontstruct is an XFontStruct.


Link: http://www.fltk.org/str.php?L2005
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 #2005: Fix for free(lineStr) in Fl_Text_Display.cxx

2008-09-03 Thread Mark Mcvittie

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

[STR New]

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


Hi fabien, the way I see it there is no need to check stdCharWidth any more
because the original line read:
stdCharWidth = mFontStruct->max_bounds.width;

But note that neither Seb or simon changes anything to do with mFontStruct
or TMPFONTWIDTH, this was already there in the original 1.1.9 file.

It appears that the mFontStruct was causing problems and replaced by
TMPFONTWIDTH but according to the person who fixed it (CET?) it is only a
temp fix to avoid crashes. I don't know what this mFontStruct is so can't
say any more.


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

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


[fltk.bugs] [HIGH] STR #2021: Fix for XGetImage error in fl_read_image.cxx

2008-08-12 Thread Mark Mcvittie
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2021
Version: 1.1.9


A fix added to fl_read_image.cxx not by me but by Sebastian Hollington. It
fixes a crash that happened sometimes when an image was clicked on. It is
tested in Ubuntu and is probably Linux-specific.

The error report was:
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 73 (X_GetImage)

The fix is shown below and the modified fl_read_image.cxx is attached.
The file also includes a previous fix by Seb reported here:
http://www.fltk.org/str.php?L2006

// Line 80 before fl_read_image()

// Used to catch (and ignore) any exceptions when calling XGetImage

static int xgetimageerrhandler(Display *display, XErrorEvent *error)

{return 0;}

// Line 138 in fl_read_image()

 // screen dimensions

 Fl::screen_xywh(sx, sy, sw, sh, fl_screen);

 if (ww < sw) sw = --ww;

 if (wh < sh) sh = --wh;

}

 if (!win || (dx >= sx && dy >= sy && dx + w <= sw && dy + h <= sh)) {

 // the image is fully contained in the window, so we can try the
traditional method,

 // however, if the window is obscured etc. the function will still fail.
Make sure we

 // catch the error and continue, otherwise an exception will be thrown.

 XErrorHandler old_handler = XSetErrorHandler(xgetimageerrhandler);

 image = XGetImage(fl_display, fl_window, X, Y, w, h, AllPlanes, ZPixmap);

 XSetErrorHandler(old_handler);

}

 if (!image){

 // image is crossing borders, determine visible region


Link: http://www.fltk.org/str.php?L2021
Version: 1.1.9//
// "$Id: fl_read_image.cxx 6065 2008-03-09 17:58:10Z matt $"
//
// X11 image reading routines for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 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 "flstring.h"

#ifdef DEBUG
#  include 
#endif // DEBUG

#ifdef WIN32
#  include "fl_read_image_win32.cxx"
#elif defined(__APPLE__)
#  include "fl_read_image_mac.cxx"
#else
#  include 
#  ifdef __sgi
#include 
#  else
#include 
#  endif // __sgi

// Defined in fl_color.cxx
extern uchar fl_redmask, fl_greenmask, fl_bluemask;
extern int fl_redshift, fl_greenshift, fl_blueshift, fl_extrashift;

//
// 'fl_subimage_offsets()' - Calculate subimage offsets for an axis
static inline int
fl_subimage_offsets(int a, int aw, int b, int bw, int &obw)
{
  int off;
  int ob;

  if (b >= a) {
ob = b;
off = 0;
  } else {
ob = a;
off = a - b;
  }

  bw -= off;

  if (ob + bw <= a + aw) {
obw = bw;
  } else {
obw = (a + aw) - ob;
  }

  return off;
}

// Used to catch (and ignore) any exceptions when calling XGetImage
static int xgetimageerrhandler(Display *display, XErrorEvent *error)
{return 0;}

//
// 'fl_read_image()' - Read an image from the current window.
//

uchar * // O - Pixel buffer or NULL if failed
fl_read_image(uchar *p, // I - Pixel buffer or NULL to allocate
  int   X,  // I - Left position
  int   Y,  // I - Top position
  int   w,  // I - Width of area to read
  int   h,  // I - Height of area to read
  int   alpha) {// I - Alpha value for image (0 for none)
  XImage*image; // Captured image
  int   i, maxindex;// Looping vars
  int   x, y;   // Current X & Y in image
  int   d;  // Depth of image
  unsigned char *line,  // Array to hold image row
*line_ptr;  // Pointer to current line image
  unsigned char *pixel; // Current color value
  XColorcolors[4096];   // Colors from the colormap...
  unsigned char cvals[4096][3]; // Color values from the colormap...
  unsigned  index_mask,
index_shift,
red_mask,
red_shift,
green_mask,
green_shift,
blue_mask,
blue_shift;


  //
  // Under X11 we have the option of the XGetImage() interface or SGI's
  // ReadDisplay extension which does all o

[fltk.bugs] [MOD] STR #2017: Fix for clip_children in Fl_Group.H

2008-08-03 Thread Mark Mcvittie
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2017
Version: 1.1.9


A fix added to Fl_Group.H not by me but by Sebastian Hollington. It makes
the two clip_children functions public instead of protected to remove a
compile error.

The relevant lines are shown below and the modified Fl_Group.H is
attached.

// Line 53 in Fl_Group class
  void clip_children(int c) { if (c) set_flag(CLIP_CHILDREN); else
clear_flag(CLIP_CHILDREN); }
  int clip_children() { return (flags() & CLIP_CHILDREN) != 0; }

I have tested this fix with the following code in Ubuntu 8.04 but it
should apply to all OS's.

// "clip_children.cxx"

#include 
#include 
#include 
#include 

class Application : public Fl_Double_Window
{
Fl_Box *bx; // Child box widget

public:
 Application(int w, int h, const char *l, int argc, char *argv[]);
};

Application::Application(int w, int h, const char *l, int argc, char
*argv[])
: Fl_Double_Window(w, h, l)
{

  box(FL_DOWN_BOX); // Add 2 pixels border
  color(FL_WHITE);

  begin();
  bx = new Fl_Box(0,0,100, 400);
  bx->box(FL_FLAT_BOX);
  bx->color((Fl_Color) FL_RED);
  end();

  resizable(this);
  show(argc, argv);
}

int main (int argc, char ** argv)
{
  Application myApp(500, 300, "My App", argc, argv);

  // Fl_Group.H:53: error: ‘void Fl_Group::clip_children(int)’ is
protected
  myApp.clip_children(true);

  return(Fl::run());
}


Link: http://www.fltk.org/str.php?L2017
Version: 1.1.9//
// "$Id: Fl_Group.H 5993 2007-12-15 16:42:00Z mike $"
//
// Group header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 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
//

#ifndef Fl_Group_H
#define Fl_Group_H

#ifndef Fl_Widget_H
#include "Fl_Widget.H"
#endif

class FL_EXPORT Fl_Group : public Fl_Widget {

  Fl_Widget** array_;
  Fl_Widget* savedfocus_;
  Fl_Widget* resizable_;
  int children_;
  short *sizes_; // remembered initial sizes of children

  int navigation(int);
  static Fl_Group *current_;
 
  // unimplemented copy ctor and assignment operator
  Fl_Group(const Fl_Group&);
  Fl_Group& operator=(const Fl_Group&);

protected:
  enum { CLIP_CHILDREN = 2048 };

  void draw();
  void draw_child(Fl_Widget&) const;
  void draw_children();
  void draw_outside_label(const Fl_Widget&) const ;
  void update_child(Fl_Widget&) const;
  short* sizes();

public:

  // Seb - clip_children functions moved from protected to public
  void clip_children(int c) { if (c) set_flag(CLIP_CHILDREN); else 
clear_flag(CLIP_CHILDREN); }
  int clip_children() { return (flags() & CLIP_CHILDREN) != 0; }

  int handle(int);
  void begin();
  void end();
  static Fl_Group *current();
  static void current(Fl_Group *g);

  int children() const {return children_;}
  Fl_Widget* child(int n) const {return array()[n];}
  int find(const Fl_Widget*) const;
  int find(const Fl_Widget& o) const {return find(&o);}
  Fl_Widget* const* array() const;

  void resize(int,int,int,int);
  Fl_Group(int,int,int,int, const char * = 0);
  virtual ~Fl_Group();
  void add(Fl_Widget&);
  void add(Fl_Widget* o) {add(*o);}
  void insert(Fl_Widget&, int i);
  void insert(Fl_Widget& o, Fl_Widget* before) {insert(o,find(before));}
  void remove(Fl_Widget&);
  void remove(Fl_Widget* o) {remove(*o);}
  void clear();

  void resizable(Fl_Widget& o) {resizable_ = &o;}
  void resizable(Fl_Widget* o) {resizable_ = o;}
  Fl_Widget* resizable() const {return resizable_;}
  void add_resizable(Fl_Widget& o) {resizable_ = &o; add(o);}
  void init_sizes();

  // back compatability function:
  void focus(Fl_Widget* o) {o->take_focus();}
  Fl_Widget* & _ddfdesign_kludge() {return resizable_;}
  void forms_end();
};

// dummy class used to end child groups in constructors for complex
// subclasses of Fl_Group:
class FL_EXPORT Fl_End {
public:
  Fl_End() {Fl_Group::current()->end();}
};

#endif

//
// End of "$Id: Fl_Group.H 5993 2007-12-15 16:42:00Z mike $".
//
___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


[fltk.bugs] [HIGH] STR #2006: Fix for XTranslateCoordinates in fl_read_image.cxx

2008-07-16 Thread Mark Mcvittie
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2006
Version: 1.1.9


A check added to fl_read_image.cxx not by me but by Sebastian Hollington.
It is a window-bounding check added on top of the screen-bounding check
for images read from the screen which fixed an X-server crash. It is
tested in Ubuntu and is probably Linux-specific.

The fix is shown below and the modified fl_read_image.cxx is attached.

// Line 125 in fl_read_image

if (!image) {
  // fetch absolute coordinates
  int dx, dy, sx, sy, sw, sh, ww, wh;   //Seb was here
  Window child_win;
  Fl_Window *win = fl_find(fl_window);
  if (win) {
//Seb was here
XTranslateCoordinates(fl_display, fl_window, RootWindow(fl_display,
fl_screen), win->w(), win->h(), &ww, &wh, &child_win);
//Seb gone
XTranslateCoordinates(fl_display, fl_window, RootWindow(fl_display,
fl_screen), X, Y, &dx, &dy, &child_win);
// screen dimensions
Fl::screen_xywh(sx, sy, sw, sh, fl_screen);
if (ww < sw) sw = ww;
if (wh < sh) sh = wh;
}


Link: http://www.fltk.org/str.php?L2006
Version: 1.1.9//
// "$Id: fl_read_image.cxx 6065 2008-03-09 17:58:10Z matt $"
//
// X11 image reading routines for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 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 "flstring.h"

#ifdef DEBUG
#  include 
#endif // DEBUG

#ifdef WIN32
#  include "fl_read_image_win32.cxx"
#elif defined(__APPLE__)
#  include "fl_read_image_mac.cxx"
#else
#  include 
#  ifdef __sgi
#include 
#  else
#include 
#  endif // __sgi

// Defined in fl_color.cxx
extern uchar fl_redmask, fl_greenmask, fl_bluemask;
extern int fl_redshift, fl_greenshift, fl_blueshift, fl_extrashift;

//
// 'fl_subimage_offsets()' - Calculate subimage offsets for an axis
static inline int
fl_subimage_offsets(int a, int aw, int b, int bw, int &obw)
{
  int off;
  int ob;

  if (b >= a) {
ob = b;
off = 0;
  } else {
ob = a;
off = a - b;
  }

  bw -= off;

  if (ob + bw <= a + aw) {
obw = bw;
  } else {
obw = (a + aw) - ob;
  }

  return off;
}


//
// 'fl_read_image()' - Read an image from the current window.
//

uchar * // O - Pixel buffer or NULL if failed
fl_read_image(uchar *p, // I - Pixel buffer or NULL to allocate
  int   X,  // I - Left position
  int   Y,  // I - Top position
  int   w,  // I - Width of area to read
  int   h,  // I - Height of area to read
  int   alpha) {// I - Alpha value for image (0 for none)
  XImage*image; // Captured image
  int   i, maxindex;// Looping vars
  int   x, y;   // Current X & Y in image
  int   d;  // Depth of image
  unsigned char *line,  // Array to hold image row
*line_ptr;  // Pointer to current line image
  unsigned char *pixel; // Current color value
  XColorcolors[4096];   // Colors from the colormap...
  unsigned char cvals[4096][3]; // Color values from the colormap...
  unsigned  index_mask,
index_shift,
red_mask,
red_shift,
green_mask,
green_shift,
blue_mask,
blue_shift;


  //
  // Under X11 we have the option of the XGetImage() interface or SGI's
  // ReadDisplay extension which does all of the really hard work for
  // us...
  //

#  ifdef __sgi
  if (XReadDisplayQueryExtension(fl_display, &i, &i)) {
image = XReadDisplay(fl_display, fl_window, X, Y, w, h, 0, NULL);
  } else
#  else
  image = 0;
#  endif // __sgi

  if (!image) {
// fetch absolute coordinates
int dx, dy, sx, sy, sw, sh, ww, wh; //Seb was here
Window child_win;
Fl_Window *win = fl_find(fl_window);
if (win) {
  //Seb was here
  XTranslateCoordinates(fl_display, fl_window, RootWindow(fl_display, 
fl_screen), win->w(), win->h(), &ww, &wh, &child_win);
  //Seb gone
  XTranslateCoordinates(fl

[fltk.bugs] [HIGH] STR #2005: Fix for free(lineStr) in Fl_Text_Display.cxx

2008-07-16 Thread Mark Mcvittie

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

[STR New]

Link: http://www.fltk.org/str.php?L2005
Version: 1.1.9


A check added to Fl_Text_Display.cxx not by me but by Sebastian Hollington.
It is an if() check to avoid freeing lineStr if it's not there, which was
causing random crashes. It is tested in Ubuntu but probably applies to all
OS.

The fix is shown below and the modified Fl_Text_Display.cxx is attached.

// Line 1480 in Fl_Text_Display::draw_vline

stdCharWidth = TMPFONTWIDTH;   //mFontStruct->max_bounds.width;
if ( stdCharWidth <= 0 ) {
  Fl::error("Fl_Text_Display::draw_vline(): bad font measurement");
  if(lineStr) free((void *)lineStr); //Seb was here - added if() check
  return;
}


Link: http://www.fltk.org/str.php?L2005
Version: 1.1.9
Attachment: http://www.fltk.org/strfiles/2005/Fl_Text_Display.cxx

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


Re: [fltk.bugs] [LOW] STR #2003: 2 broken_image checks in Fl_Help_View.cxx

2008-07-16 Thread Mark Mcvittie

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

[STR New]

Link: http://www.fltk.org/str.php?L2003
Version: 1.1.9


This has been reposted because of a few mistakes.

The new post is here.
http://www.fltk.org/str.php?L2004


Link: http://www.fltk.org/str.php?L2003
Version: 1.1.9

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