summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl_File_Chooser.cxx1
-rw-r--r--src/Fl_File_Chooser.fl2
-rw-r--r--src/Fl_Text_Buffer.cxx5
-rw-r--r--src/Fl_Text_Display.cxx20
-rw-r--r--src/Fl_Text_Editor.cxx6
-rw-r--r--src/filename_isdir.cxx33
-rw-r--r--src/fl_draw_pixmap.cxx6
-rw-r--r--src/fl_font_win32.cxx7
-rw-r--r--src/fl_labeltype.cxx15
-rwxr-xr-xsrc/fl_set_fonts_win32.cxx83
10 files changed, 119 insertions, 59 deletions
diff --git a/src/Fl_File_Chooser.cxx b/src/Fl_File_Chooser.cxx
index 51183ce6c..984b11a8c 100644
--- a/src/Fl_File_Chooser.cxx
+++ b/src/Fl_File_Chooser.cxx
@@ -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);
diff --git a/src/Fl_File_Chooser.fl b/src/Fl_File_Chooser.fl
index cfdd672da..16a19fe2c 100644
--- a/src/Fl_File_Chooser.fl
+++ b/src/Fl_File_Chooser.fl
@@ -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>}
diff --git a/src/Fl_Text_Buffer.cxx b/src/Fl_Text_Buffer.cxx
index fe03cedb8..5dd4a1f02 100644
--- a/src/Fl_Text_Buffer.cxx
+++ b/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.
@@ -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 ] = '.'; }
@@ -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 $".
//
diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx
index efa519c41..04e280d2e 100644
--- a/src/Fl_Text_Display.cxx
+++ b/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.
@@ -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);
@@ -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;
}
/*
@@ -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 $".
//
diff --git a/src/Fl_Text_Editor.cxx b/src/Fl_Text_Editor.cxx
index 2a5f52720..af4b33ebf 100644
--- a/src/Fl_Text_Editor.cxx
+++ b/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.
@@ -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:
@@ -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 $".
//
diff --git a/src/filename_isdir.cxx b/src/filename_isdir.cxx
index 1d4d4cb05..4620e29e6 100644
--- a/src/filename_isdir.cxx
+++ b/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).
//
@@ -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 $".
//
diff --git a/src/fl_draw_pixmap.cxx b/src/fl_draw_pixmap.cxx
index 65a766d3a..f2fdd5768 100644
--- a/src/fl_draw_pixmap.cxx
+++ b/src/fl_draw_pixmap.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_draw_pixmap.cxx,v 1.4.2.8.2.4 2001/11/27 17:44:08 easysw Exp $"
+// "$Id: fl_draw_pixmap.cxx,v 1.4.2.8.2.5 2001/12/03 18:29:49 easysw Exp $"
//
// Pixmap drawing code for the Fast Light Tool Kit (FLTK).
//
@@ -268,10 +268,10 @@ int fl_draw_pixmap(const char*const* di, int x, int y, Fl_Color bg) {
}
fl_draw_image(chars_per_pixel==1 ? cb1 : cb2, &d, x, y, d.w, d.h, 4);
- if (chars_per_pixel > 1) for (int i = 0; i < 256; i++) delete d.byte1[i];
+ if (chars_per_pixel > 1) for (int i = 0; i < 256; i++) delete[] d.byte1[i];
return 1;
}
//
-// End of "$Id: fl_draw_pixmap.cxx,v 1.4.2.8.2.4 2001/11/27 17:44:08 easysw Exp $".
+// End of "$Id: fl_draw_pixmap.cxx,v 1.4.2.8.2.5 2001/12/03 18:29:49 easysw Exp $".
//
diff --git a/src/fl_font_win32.cxx b/src/fl_font_win32.cxx
index 61face7ee..a72a20aa7 100644
--- a/src/fl_font_win32.cxx
+++ b/src/fl_font_win32.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_font_win32.cxx,v 1.9.2.3 2001/01/22 15:13:41 easysw Exp $"
+// "$Id: fl_font_win32.cxx,v 1.9.2.3.2.1 2001/12/03 18:29:49 easysw Exp $"
//
// WIN32 font selection routines for the Fast Light Tool Kit (FLTK).
//
@@ -164,9 +164,10 @@ double fl_width(uchar c) {
}
void fl_draw(const char* str, int n, int x, int y) {
- SetTextColor(fl_gc, fl_RGB());
+ COLORREF oldColor = SetTextColor(fl_gc, fl_RGB());
SelectObject(fl_gc, fl_fontsize->fid);
TextOut(fl_gc, x, y, str, n);
+ SetTextColor(fl_gc, oldColor);
}
void fl_draw(const char* str, int x, int y) {
@@ -174,5 +175,5 @@ void fl_draw(const char* str, int x, int y) {
}
//
-// End of "$Id: fl_font_win32.cxx,v 1.9.2.3 2001/01/22 15:13:41 easysw Exp $".
+// End of "$Id: fl_font_win32.cxx,v 1.9.2.3.2.1 2001/12/03 18:29:49 easysw Exp $".
//
diff --git a/src/fl_labeltype.cxx b/src/fl_labeltype.cxx
index 657bf40b3..6d848663c 100644
--- a/src/fl_labeltype.cxx
+++ b/src/fl_labeltype.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_labeltype.cxx,v 1.6.2.3.2.4 2001/10/29 03:44:33 easysw Exp $"
+// "$Id: fl_labeltype.cxx,v 1.6.2.3.2.5 2001/12/03 18:29:49 easysw Exp $"
//
// Label drawing routines for the Fast Light Tool Kit (FLTK).
//
@@ -41,16 +41,7 @@ fl_normal_label(const Fl_Label* o, int X, int Y, int W, int H, Fl_Align align)
{
fl_font(o->font, o->size);
fl_color((Fl_Color)o->color);
- if (o->image) {
- if (align & FL_ALIGN_TEXT_OVER_IMAGE) {
- fl_draw(o->value, X, Y, W, H, align, o->image);
- } else {
- fl_draw(o->value, X, Y, W, H, align, o->image);
- }
- }
- else {
- fl_draw(o->value, X, Y, W, H, align, o->image);
- }
+ fl_draw(o->value, X, Y, W, H, align, o->image);
}
void
@@ -136,5 +127,5 @@ void Fl_Widget::draw_label(int X, int Y, int W, int H, Fl_Align a) const {
#include <FL/Fl_Input_.H>
//
-// End of "$Id: fl_labeltype.cxx,v 1.6.2.3.2.4 2001/10/29 03:44:33 easysw Exp $".
+// End of "$Id: fl_labeltype.cxx,v 1.6.2.3.2.5 2001/12/03 18:29:49 easysw Exp $".
//
diff --git a/src/fl_set_fonts_win32.cxx b/src/fl_set_fonts_win32.cxx
index b99e00d00..d777f861c 100755
--- a/src/fl_set_fonts_win32.cxx
+++ b/src/fl_set_fonts_win32.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.1 2001/11/26 20:13:29 easysw Exp $"
+// "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.2 2001/12/03 18:29:49 easysw Exp $"
//
// WIN32 font utilities for the Fast Light Tool Kit (FLTK).
//
@@ -23,7 +23,7 @@
// Please report all bugs and problems to "fltk-bugs@fltk.org".
//
-// This function fills in the fltk font table with all the fonts that
+// This function fills in the FLTK font table with all the fonts that
// are found on the X server. It tries to place the fonts into families
// and to sort them so the first 4 in a family are normal, bold, italic,
// and bold italic.
@@ -57,19 +57,22 @@ const char* Fl::get_font_name(Fl_Font fnum, int* ap) {
static int fl_free_font = FL_FREE_FONT;
-static int CALLBACK enumcb(ENUMLOGFONT FAR *lpelf,
- NEWTEXTMETRIC FAR *lpntm, int FontType, LPARAM p) {
- if (!p && lpelf->elfLogFont.lfCharSet != ANSI_CHARSET) return 1;
- char *n = (char*)(lpelf->elfFullName);
+static int CALLBACK
+enumcb(CONST LOGFONT *lpelf,
+ CONST TEXTMETRIC *lpntm,
+ int FontType,
+ LPARAM p) {
+ if (!p && lpelf->lfCharSet != ANSI_CHARSET) return 1;
+ char *n = (char*)(lpelf->lfFaceName);
for (int i=0; i<FL_FREE_FONT; i++) // skip if one of our built-in fonts
if (!strcmp(Fl::get_font_name((Fl_Font)i),n)) return 1;
- char buffer[128];
+ char buffer[LF_FACESIZE + 1];
strcpy(buffer+1, n);
buffer[0] = ' '; Fl::set_font((Fl_Font)(fl_free_font++), strdup(buffer));
- if (lpelf->elfLogFont.lfWeight <= 400)
+ if (lpelf->lfWeight <= 400)
buffer[0] = 'B', Fl::set_font((Fl_Font)(fl_free_font++), strdup(buffer));
buffer[0] = 'I'; Fl::set_font((Fl_Font)(fl_free_font++), strdup(buffer));
- if (lpelf->elfLogFont.lfWeight <= 400)
+ if (lpelf->lfWeight <= 400)
buffer[0] = 'P', Fl::set_font((Fl_Font)(fl_free_font++), strdup(buffer));
return 1;
}
@@ -82,14 +85,62 @@ Fl_Font Fl::set_fonts(const char* xstarname) {
return (Fl_Font)fl_free_font;
}
-int Fl::get_font_sizes(Fl_Font fnum, int*& sizep) {
- // pretend all fonts are scalable (most are and I don't know how
- // to tell anyways)
- static int array[1];
- sizep = array;
- return 1;
+
+static int nbSize;
+static int cyPerInch;
+static int sizes[128];
+
+static int CALLBACK
+EnumSizeCb(CONST LOGFONT *lpelf,
+ CONST TEXTMETRIC *lpntm,
+ DWORD fontType,
+ LPARAM p) {
+ if ((fontType & RASTER_FONTTYPE) == 0) {
+ sizes[0] = 0;
+ nbSize = 1;
+
+ // Scalable font
+ return 0;
+ }
+
+ int add = lpntm->tmHeight - lpntm->tmInternalLeading;
+ add = MulDiv(add, 72, cyPerInch);
+
+ int start = 0;
+ while ((start < nbSize) && (sizes[start] < add)) {
+ start++;
+ }
+
+ if ((start < nbSize) && (sizes[start] == add)) {
+ return 1;
+ }
+
+ for (int i=nbSize; i>start; i--) sizes[i] = sizes[i - 1];
+
+ sizes[start] = add;
+ nbSize++;
+
+ // Stop enum if buffer overflow
+ return nbSize < 128;
}
+
+int
+Fl::get_font_sizes(Fl_Font fnum, int*& sizep) {
+ nbSize = 0;
+ Fl_Fontdesc *s = fl_fonts+fnum;
+ if (!s->name) s = fl_fonts; // empty slot in table, use entry 0
+
+ if (!fl_gc) fl_GetDC(0);
+ cyPerInch = GetDeviceCaps(fl_gc, LOGPIXELSY);
+ if (cyPerInch < 1) cyPerInch = 1;
+ EnumFontFamilies(fl_gc, s->name+1, EnumSizeCb, 0);
+
+ sizep = sizes;
+ return nbSize;
+}
+
+
//
-// End of "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.1 2001/11/26 20:13:29 easysw Exp $".
+// End of "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.2 2001/12/03 18:29:49 easysw Exp $".
//