Skip to content

Commit

Permalink
Bug fixes and doco updates care of Sebastian.
Browse files Browse the repository at this point in the history
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1799 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
michaelrsweet committed Dec 3, 2001
1 parent d7f311e commit 3a0fe79
Show file tree
Hide file tree
Showing 15 changed files with 204 additions and 93 deletions.
18 changes: 18 additions & 0 deletions CHANGES
Expand Up @@ -21,6 +21,24 @@ CHANGES IN FLTK 1.1.0b7
when compiled for debugging under WIN32.
- Added plastic box types to forms demo.
- Added mousewheel to keyboard demo.
- The Fl_Text_Editor widget caused an infinite loop
when it received keyboard focus.
- filename_isdir() didn't properly handle drive letters
properly; WIN32 needs a trailing slash for drive
letters by themselves, but cannot have a trailing
slash for directory names, go figure...
- The Fl_Text_Buffer and Fl_Text_Display classes did not
initialize all of their members.
- fl_normal_label() had a totally redundant set of
if/else tests, which the new code handles all from
fl_draw().
- The Fl_File_Chooser dialog contained two hotspots.
- The fl_draw_pixmap() function didn't free the 2-byte
color lookup table properly (delete instead of
delete[]).
- fl_draw() reset the text color under WIN32, causing
bitmaps to draw incorrectly.
- Fl::get_font_sizes() is now implemented under WIN32.


CHANGES IN FLTK 1.1.0b6
Expand Down
6 changes: 2 additions & 4 deletions FL/Fl_Text_Display.H
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Text_Display.H,v 1.4.2.3 2001/10/29 03:44:31 easysw Exp $"
// "$Id: Fl_Text_Display.H,v 1.4.2.4 2001/12/03 18:29:49 easysw Exp $"
//
// Header file for Fl_Text_Display class.
//
Expand Down Expand Up @@ -191,8 +191,6 @@ class Fl_Text_Display: public Fl_Group {
int mTopLineNumHint; /* Line number of top displayed line
of file (first line of file is 1) */
int mHorizOffsetHint; /* Horizontal scroll pos. in pixels */
int mVisibility; /* Window visibility (see XVisibility
event) */
int mNStyles; /* Number of entries in styleTable */
Style_Table_Entry *mStyleTable; /* Table of fonts and colors for
coloring/syntax-highlighting */
Expand Down Expand Up @@ -225,5 +223,5 @@ class Fl_Text_Display: public Fl_Group {
#endif

//
// End of "$Id: Fl_Text_Display.H,v 1.4.2.3 2001/10/29 03:44:31 easysw Exp $".
// End of "$Id: Fl_Text_Display.H,v 1.4.2.4 2001/12/03 18:29:49 easysw Exp $".
//
68 changes: 53 additions & 15 deletions documentation/Fl_Shared_Image.html
Expand Up @@ -3,49 +3,87 @@

<!-- NEW PAGE -->

<H2><A name=Fl_Bitmap>class Fl_Bitmap</A></H2>
<H2><A name="Fl_Shared_Image">class Fl_Shared_Image</A></H2>
<HR>

<H3>Class Hierarchy</H3>

<UL><PRE>
<A href="Fl_Image.html">Fl_Image</A>
|
+----<B>Fl_Bitmap</B>
|
+----<A href="Fl_XBM_Image.html">Fl_XBM_Image</A>
+----<B>Fl_Shared_Image</B>
</PRE></UL>

<H3>Include Files</H3>

<UL><PRE>
#include &lt;FL/Fl_Bitmap.H&gt;
#include &lt;FL/Fl_Shared_Image.H&gt;
</PRE></UL>

<H3>Description</H3>

<P>The <TT>Fl_Bitmap</TT> class supports caching and drawing of mono-color
(bitmap) images. Images are drawn using the current color.</P>
<P>The <TT>Fl_Shared_Image</TT> class supports caching, loading, and
drawing of image files. </P>

<H3>Methods</H3>

<UL>

<LI><A href="#Fl_Bitmap.Fl_Bitmap">Fl_Bitmap</A></LI>
<LI><A href="#Fl_Shared_Image.Fl_Shared_Image">Fl_Shared_Image</A></LI>

<LI><A href="#Fl_Bitmap.~Fl_Bitmap">~Fl_Bitmap</A></LI>
<LI><A href="#Fl_Shared_Image.~Fl_Shared_Image">~Fl_Shared_Image</A></LI>

<LI><A href="#Fl_Shared_Image.find">find</A></LI>

<LI><A href="#Fl_Shared_Image.get">get</A></LI>

<LI><A href="#Fl_Shared_Image.images">images</A></LI>

<LI><A href="#Fl_Shared_Image.name">name</A></LI>

<LI><A href="#Fl_Shared_Image.num_images">num_images</A></LI>

<LI><A href="#Fl_Shared_Image.refcount">refcount</A></LI>

<LI><A href="#Fl_Shared_Image.release">release</A></LI>

<LI><A href="#Fl_Shared_Image.reload">reload</A></LI>

</UL>

<H4><A name="Fl_Bitmap.Fl_Bitmap">Fl_Bitmap::Fl_Bitmap(const char *array, int W, int H);<BR>
Fl_Bitmap::Fl_Bitmap(const unsigned char *array, int W, int H);</A></H4>
<H4><A name="Fl_Shared_Image.Fl_Shared_Image">protected Fl_Shared_Image::Fl_Shared_Image();<BR>
protected Fl_Shared_Image::Fl_Shared_Image(const char *name, Fl_Image *img);</A></H4>

<P>The constructors create a new shared image record in the
image cache.

<P>The constructors are protected and cannot be used directly
from a program. Use the <A
HREF="#Fl_Shared_Image.get"><TT>get()</TT></A> method instead.

<H4><A name="Fl_Shared_Image.~Fl_Shared_Image">protected Fl_Shared_Image::~Fl_Shared_Image();</A></H4>

<P>The destructor free all memory and server resources that are
used by the image. The destructor is protected and cannot be
used directly from a program. Use the <A
HREF="#Fl_Shared_Image.release"><TT>release()</TT></A> method
instead.

<H4><A NAME="Fl_Shared_Image.find">static Fl_Shared_Image *find(const char *n, int W = 0, int H = 0);</A></H4>

<H4><A NAME="Fl_Shared_Image.get">static Fl_Shared_Image *get(const char *n, int W = 0, int H = 0);</A></H4>

<H4><A NAME="Fl_Shared_Image.images">static Fl_Shared_Image **images();</A></H4>

<H4><A NAME="Fl_Shared_Image.name">const char *name();</A></H4>

<H4><A NAME="Fl_Shared_Image.num_images">static int num_images();</A></H4>

<P>The constructors create a new bitmap from the specified bitmap data.</P>
<H4><A NAME="Fl_Shared_Image.refcount">int refcount();</A></H4>

<H4><A name="Fl_Bitmap.~Fl_Bitmap">Fl_Bitmap::~Fl_Bitmap();</A></H4>
<H4><A NAME="Fl_Shared_Image.release">void release();</A></H4>

<P>The destructor free all memory and server resources that are used by
the bitmap.</P>
<H4><A NAME="Fl_Shared_Image.reload">void reload();</A></H4>

</BODY>
</HTML>
2 changes: 1 addition & 1 deletion documentation/Fl_Text_Display.html
Expand Up @@ -3,7 +3,7 @@

<!-- NEW PAGE -->

<H2><A name=Fl_Input>class Fl_Input</A></H2>
<H2><A name="Fl_Text_Display">class Fl_Text_Display</A></H2>

<HR>

Expand Down
25 changes: 11 additions & 14 deletions documentation/Fl_Tiled_Image.html
Expand Up @@ -3,49 +3,46 @@

<!-- NEW PAGE -->

<H2><A name=Fl_Bitmap>class Fl_Bitmap</A></H2>
<H2><A name=Fl_Tiled_Image>class Fl_Tiled_Image</A></H2>
<HR>

<H3>Class Hierarchy</H3>

<UL><PRE>
<A href="Fl_Image.html">Fl_Image</A>
|
+----<B>Fl_Bitmap</B>
|
+----<A href="Fl_XBM_Image.html">Fl_XBM_Image</A>
+----<B>Fl_Tiled_Image</B>
</PRE></UL>

<H3>Include Files</H3>

<UL><PRE>
#include &lt;FL/Fl_Bitmap.H&gt;
#include &lt;FL/Fl_Tiled_Image.H&gt;
</PRE></UL>

<H3>Description</H3>

<P>The <TT>Fl_Bitmap</TT> class supports caching and drawing of mono-color
(bitmap) images. Images are drawn using the current color.</P>
<P>The <TT>Fl_Tiled_Image</TT> class supports tiling of images over a
specified area.</P>

<H3>Methods</H3>

<UL>

<LI><A href="#Fl_Bitmap.Fl_Bitmap">Fl_Bitmap</A></LI>
<LI><A href="#Fl_Tiled_Image.Fl_Tiled_Image">Fl_Tiled_Image</A></LI>

<LI><A href="#Fl_Bitmap.~Fl_Bitmap">~Fl_Bitmap</A></LI>
<LI><A href="#Fl_Tiled_Image.~Fl_Tiled_Image">~Fl_Tiled_Image</A></LI>

</UL>

<H4><A name="Fl_Bitmap.Fl_Bitmap">Fl_Bitmap::Fl_Bitmap(const char *array, int W, int H);<BR>
Fl_Bitmap::Fl_Bitmap(const unsigned char *array, int W, int H);</A></H4>
<H4><A name="Fl_Tiled_Image.Fl_Tiled_Image">Fl_Tiled_Image::Fl_Tiled_Image(Fl_Image *img, int W, int H);</A></H4>

<P>The constructors create a new bitmap from the specified bitmap data.</P>
<P>The constructors create a new tiled image containing the specified image.</P>

<H4><A name="Fl_Bitmap.~Fl_Bitmap">Fl_Bitmap::~Fl_Bitmap();</A></H4>
<H4><A name="Fl_Tiled_Image.~Fl_Tiled_Image">Fl_Tiled_Image::~Fl_Tiled_Image();</A></H4>

<P>The destructor free all memory and server resources that are used by
the bitmap.</P>
the tiled image.</P>

</BODY>
</HTML>
1 change: 0 additions & 1 deletion src/Fl_File_Chooser.cxx
Expand Up @@ -105,7 +105,6 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char
{ Fl_Window* o = window = new Fl_Window(375, 315, "Pick a File");
w = o;
o->callback((Fl_Callback*)cb_window, (void*)(this));
w->hotspot(o);
{ Fl_File_Browser* o = fileList = new Fl_File_Browser(10, 45, 355, 180);
o->type(2);
o->callback((Fl_Callback*)cb_fileList);
Expand Down
2 changes: 1 addition & 1 deletion src/Fl_File_Chooser.fl
Expand Up @@ -16,7 +16,7 @@ class Fl_File_Chooser {open
callback {fileList->deselect();
fileName->value("");
window->hide();} open
private xywh {99 225 375 315} resizable hotspot
private xywh {99 225 375 315} resizable
code0 {if (title) window->label(title);}
code1 {\#include <stdio.h>}
code2 {\#include <stdlib.h>}
Expand Down
5 changes: 3 additions & 2 deletions src/Fl_Text_Buffer.cxx
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Text_Buffer.cxx,v 1.9.2.1 2001/08/04 12:21:33 easysw Exp $"
// "$Id: Fl_Text_Buffer.cxx,v 1.9.2.2 2001/12/03 18:29:49 easysw Exp $"
//
// Copyright Mark Edel. Permission to distribute under the LGPL for
// the FLTK library granted by Mark Edel.
Expand Down Expand Up @@ -92,6 +92,7 @@ Fl_Text_Buffer::Fl_Text_Buffer( int requestedSize ) {
mNodifyProcs = NULL;
mCbArgs = NULL;
mNModifyProcs = 0;
mCursorPosHint = 0;
mNullSubsChar = '\0';
#ifdef PURIFY
{ int i; for (i = mGapStart; i < mGapEnd; i++) mBuf[ i ] = '.'; }
Expand Down Expand Up @@ -2283,5 +2284,5 @@ Fl_Text_Buffer::outputfile(const char *file, int start, int end, int buflen) {


//
// End of "$Id: Fl_Text_Buffer.cxx,v 1.9.2.1 2001/08/04 12:21:33 easysw Exp $".
// End of "$Id: Fl_Text_Buffer.cxx,v 1.9.2.2 2001/12/03 18:29:49 easysw Exp $".
//
20 changes: 13 additions & 7 deletions src/Fl_Text_Display.cxx
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Text_Display.cxx,v 1.12.2.3 2001/10/29 03:44:32 easysw Exp $"
// "$Id: Fl_Text_Display.cxx,v 1.12.2.4 2001/12/03 18:29:49 easysw Exp $"
//
// Copyright Mark Edel. Permission to distribute under the LGPL for
// the FLTK library granted by Mark Edel.
Expand Down Expand Up @@ -76,16 +76,18 @@ Fl_Text_Display::Fl_Text_Display(int X, int Y, int W, int H, const char* l)
textcolor(FL_BLACK);
textfont(FL_HELVETICA);

Fl_Group* current = Fl_Group::current();
Fl_Group::current(this);
text_area.x = 0;
text_area.y = 0;
text_area.w = 0;
text_area.h = 0;

mVScrollBar = new Fl_Scrollbar(0,0,0,0);
mVScrollBar = new Fl_Scrollbar(0,0,1,1);
mVScrollBar->callback((Fl_Callback*)v_scrollbar_cb, this);
mHScrollBar = new Fl_Scrollbar(0,0,0,0);
mHScrollBar = new Fl_Scrollbar(0,0,1,1);
mHScrollBar->callback((Fl_Callback*)h_scrollbar_cb, this);
mHScrollBar->type(FL_HORIZONTAL);

Fl_Group::current(current);
end();

scrollbar_width(16);
scrollbar_align(FL_ALIGN_BOTTOM_RIGHT);
Expand All @@ -112,6 +114,10 @@ Fl_Text_Display::Fl_Text_Display(int X, int Y, int W, int H, const char* l)
mNVisibleLines = 1;
mLineStarts = new int[mNVisibleLines];
mLineStarts[0] = 0;

mUnfinishedStyle = 0;
mUnfinishedHighlightCB = 0;
mHighlightCBArg = 0;
}

/*
Expand Down Expand Up @@ -1950,5 +1956,5 @@ int Fl_Text_Display::handle(int event) {


//
// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.3 2001/10/29 03:44:32 easysw Exp $".
// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.4 2001/12/03 18:29:49 easysw Exp $".
//
6 changes: 3 additions & 3 deletions src/Fl_Text_Editor.cxx
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Text_Editor.cxx,v 1.9.2.2 2001/11/27 17:44:06 easysw Exp $"
// "$Id: Fl_Text_Editor.cxx,v 1.9.2.3 2001/12/03 18:29:49 easysw Exp $"
//
// Copyright Mark Edel. Permission to distribute under the LGPL for
// the FLTK library granted by Mark Edel.
Expand Down Expand Up @@ -409,7 +409,7 @@ int Fl_Text_Editor::handle(int event) {
switch (event) {
case FL_FOCUS:
show_cursor(mCursorOn); // redraws the cursor
take_focus();
Fl::focus(this);
return 1;

case FL_UNFOCUS:
Expand Down Expand Up @@ -438,5 +438,5 @@ int Fl_Text_Editor::handle(int event) {
}

//
// End of "$Id: Fl_Text_Editor.cxx,v 1.9.2.2 2001/11/27 17:44:06 easysw Exp $".
// End of "$Id: Fl_Text_Editor.cxx,v 1.9.2.3 2001/12/03 18:29:49 easysw Exp $".
//
33 changes: 22 additions & 11 deletions src/filename_isdir.cxx
@@ -1,5 +1,5 @@
//
// "$Id: filename_isdir.cxx,v 1.4.2.5 2001/01/22 15:13:40 easysw Exp $"
// "$Id: filename_isdir.cxx,v 1.4.2.5.2.1 2001/12/03 18:29:49 easysw Exp $"
//
// Directory detection routines for the Fast Light Tool Kit (FLTK).
//
Expand All @@ -25,28 +25,39 @@

// Used by fl_file_chooser

#include <config.h>
#include <FL/filename.H>
#include "flstring.h"
#include <sys/stat.h>
#include <string.h>
#include <ctype.h>
#include <FL/filename.H>


int filename_isdir(const char* n) {
struct stat s;

#ifdef WIN32
char fn[1024];
int length;
// This workaround brought to you by the fine folks at Microsoft!
// (read lots of sarcasm in that...)
strncpy(fn, n, sizeof(fn) - 1);
fn[sizeof(fn) - 1] = '\0';
length = strlen(fn);
if (length > 0 && (fn[length - 1] == '/' || fn[length - 1] == '\\'))
fn[length - 1] = '\0'; // Strip trailing slash...
n = fn;
length = strlen(n);
if (length < (int)(sizeof(fn) - 1)) {
if (length < 4 && isletter(n[0]) && n[1] == ':') {
// Always use D:/ for drive letters
fn[0] = n[0];
strcpy(fn + 1, ":/");
n = fn;
} else if (length > 0 && (n[length - 1] == '/' || n[length - 1] == '\\')) {
// Strip trailing slash from name...
strncpy(fn, n, sizeof(fn) - 1);
fn[length - 1] = '\0';
n = fn;
}
}
#endif

return !stat(n, &s) && (s.st_mode&0170000)==0040000;
}

//
// End of "$Id: filename_isdir.cxx,v 1.4.2.5 2001/01/22 15:13:40 easysw Exp $".
// End of "$Id: filename_isdir.cxx,v 1.4.2.5.2.1 2001/12/03 18:29:49 easysw Exp $".
//

0 comments on commit 3a0fe79

Please sign in to comment.