mirror of
https://github.com/fltk/fltk.git
synced 2026-05-21 22:51:41 +08:00
Implement Fl::scheme() and Fl::reload_scheme() (this includes support
for new FLTK_SCHEME environment variable, which should get added to FLTK 2.0 CVS, as well as the -scheme option...) Revert Fl_Group/Fl_Widget destructor change - it doesn't work for statically initialized widgets (like the widgets in a color chooser...) Export fl_round_up_box() and fl_round_down_box() so they can be restored in Fl::reload_scheme(). Use FL_DOWN_BOX and FL_ROUND_DOWN_BOX in menu drawing code. Use a static string for the display environment variable in Fl::display(). Updated MacOS README file... Added window tile image... git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1883 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
CHANGES IN FLTK 1.1.0b8
|
||||
|
||||
- New Fl::scheme() methods from FLTK 2.0; currently only
|
||||
the standard ("") and plastic ("plastic") methods are
|
||||
supported. Schemes can be set on the command-line
|
||||
("-scheme plastic") or using the FLTK_SCHEME
|
||||
environment variable.
|
||||
- MacOS: fixed iBook keyboard handling, moved
|
||||
remaining message handling to Carbon, added mouse
|
||||
capture support, added timer support, added overlay
|
||||
support, fixed doublebuffering side effects.
|
||||
support, fixed double-buffering side effects.
|
||||
- The configure script wasn't using the -fpermissive or
|
||||
-fno-exceptions options with GCC.
|
||||
- Fl_JPEG_Image and friends didn't set the depth if the
|
||||
@@ -18,9 +23,6 @@ CHANGES IN FLTK 1.1.0b8
|
||||
WIN32.
|
||||
- Fl_Shared_Image::get() did not check to see if the
|
||||
image could not be loaded.
|
||||
- Fixed Fl_Widget::~Fl_Widget() so that "delete widget"
|
||||
will remove the widget from the parent. Otherwise
|
||||
the Fl_Group destructor will try to access freed memory...
|
||||
- Fl_Help_View didn't clear the line array in the
|
||||
Fl_Help_Block structure; this causes erratic
|
||||
formatting for some pages.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl.H,v 1.8.2.11.2.10 2001/12/19 18:15:33 easysw Exp $"
|
||||
// "$Id: Fl.H,v 1.8.2.11.2.11 2001/12/20 14:41:44 easysw Exp $"
|
||||
//
|
||||
// Main header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
class Fl_Widget;
|
||||
class Fl_Window;
|
||||
class Fl_Image;
|
||||
struct Fl_Label;
|
||||
typedef void (Fl_Label_Draw_F)(const Fl_Label*, int,int,int,int, Fl_Align);
|
||||
typedef void (Fl_Label_Measure_F)(const Fl_Label*, int&, int&);
|
||||
@@ -67,6 +68,9 @@ public: // should be private!
|
||||
|
||||
static FL_EXPORT void (*idle)();
|
||||
|
||||
static const char* scheme_;
|
||||
static Fl_Image* scheme_bg_;
|
||||
|
||||
public:
|
||||
|
||||
// API version number
|
||||
@@ -88,6 +92,11 @@ public:
|
||||
static FL_EXPORT void background(uchar, uchar, uchar);
|
||||
static FL_EXPORT void background2(uchar, uchar, uchar);
|
||||
|
||||
// schemes:
|
||||
static int scheme(const char*);
|
||||
static const char* scheme() {return scheme_;}
|
||||
static int reload_scheme();
|
||||
|
||||
// execution:
|
||||
static FL_EXPORT int wait();
|
||||
static FL_EXPORT double wait(double time);
|
||||
@@ -234,5 +243,5 @@ public:
|
||||
#endif // !Fl_H
|
||||
|
||||
//
|
||||
// End of "$Id: Fl.H,v 1.8.2.11.2.10 2001/12/19 18:15:33 easysw Exp $".
|
||||
// End of "$Id: Fl.H,v 1.8.2.11.2.11 2001/12/20 14:41:44 easysw Exp $".
|
||||
//
|
||||
|
||||
+113
-109
@@ -1,142 +1,146 @@
|
||||
README.mac - 12/03/2001 - Building FLTK under MacOS and OS X
|
||||
------------------------------------------------------------
|
||||
README.mac - 12/20/2001 - Building FLTK under MacOS 8, 9, and X
|
||||
---------------------------------------------------------------
|
||||
|
||||
CONTENTS
|
||||
--------
|
||||
- Introduction
|
||||
- gcc (Carbon) - how to build
|
||||
- scripts
|
||||
- known MacFLTK bugs
|
||||
- test suite status
|
||||
- other stuff
|
||||
- FLTK 1.0.x for Mac
|
||||
|
||||
|
||||
|
||||
- Introduction
|
||||
- How to Build Using GCC (MacOS X)
|
||||
- Scripts
|
||||
- Known MacFLTK bugs
|
||||
- Test suite status
|
||||
- Other stuff
|
||||
- FLTK 1.0.x for Mac
|
||||
|
||||
|
||||
INTRODUCTION
|
||||
------------
|
||||
|
||||
FLTK for Mac OS X is in beta stage. Expect rapid changes to the
|
||||
source code and build environment.
|
||||
FLTK for MacOS X is in beta stage. Expect rapid changes to
|
||||
the source code and build environment.
|
||||
|
||||
FLTK currently supports the following development environment on the
|
||||
Mac OS X platform:
|
||||
FLTK currently supports the following development
|
||||
environments on the MacOS X platform:
|
||||
|
||||
- gcc (Carbon)
|
||||
- GCC
|
||||
- (Metrowerks CodeWarrior - future releases)
|
||||
- (Apple Project Builder - future releases)
|
||||
- (MPW - future releases)
|
||||
|
||||
- (Metrowerks CodeWarrior - future releases)
|
||||
|
||||
- (Apple Project Builder - future releases)
|
||||
|
||||
- (MPW - future releases)
|
||||
|
||||
FLTK for Mac is fully carbonized, i.e. all applications should run
|
||||
on Mac OS 8.1 and higher and OS X without changes.
|
||||
FLTK for Mac is fully carbonized, i.e. all applications
|
||||
should run on MacOS 8.1 and higher and OS X without
|
||||
changes. Note, however, that applications compiled using
|
||||
GCC will only run under MacOS X since they use a different
|
||||
executable format.
|
||||
|
||||
|
||||
gcc (Carbon) - how to build
|
||||
--------------------------
|
||||
HOW TO BUILD USING GCC (MacOS X)
|
||||
|
||||
Since the Max OS X command line build environment is based on BSD
|
||||
Unix, the normal Unix build procedure as described in 'README'
|
||||
applies.
|
||||
Since the MacOS X command line build environment is based on
|
||||
BSD UNIX, the normal UNIX build procedure as described in
|
||||
'README' applies.
|
||||
|
||||
A 'resource fork' will be attached to applications to make
|
||||
them visible in the Finder. Thedefault resource file is ./FL/mac.r .
|
||||
A 'resource fork' will be attached to applications to make
|
||||
them visible in the Finder. The default resource file is
|
||||
"FL/mac.r".
|
||||
|
||||
A possible way to add a resource fork is:
|
||||
> Rez -t APPL -c Fltk ../FL/mac.r -o hello
|
||||
The "fltk-config" script can be used to attach the FLTK
|
||||
resource fork to an executable using the "--post" option:
|
||||
|
||||
fltk-config --post foo
|
||||
|
||||
where "foo" is the name of the executable.
|
||||
|
||||
To attach your own resource fork to your FLTK program, run
|
||||
the "Rez" command:
|
||||
|
||||
Rez -t APPL foo.r -o foo
|
||||
|
||||
|
||||
scripts
|
||||
-------
|
||||
SCRIPTS
|
||||
|
||||
When using Finder applications on source files (i.e. FileMerge)
|
||||
I found the following script very useful. It adds resource forks to
|
||||
all text files.
|
||||
When using Finder applications on source files (e.g.
|
||||
FileMerge), I found the following script very useful. It adds
|
||||
resource forks to all text files:
|
||||
|
||||
#!/bin/tcsh
|
||||
setenv SET_MAC_TYPE "SetFile -t TEXT -c ttxt "
|
||||
setenv F1MAC_N 7
|
||||
echo "Setting Mac File Types. Please wait..."
|
||||
echo "[1/"$F1MAC_N"]"
|
||||
find . -name '*.H' -exec $SET_MAC_TYPE {} \;
|
||||
echo "[2/"$F1MAC_N"]"
|
||||
find . -name '*.h' -exec $SET_MAC_TYPE {} \;
|
||||
echo "[3/"$F1MAC_N"]"
|
||||
find . -name '*.c' -exec $SET_MAC_TYPE {} \;
|
||||
echo "[4/"$F1MAC_N"]"
|
||||
find . -name '*.cxx' -exec $SET_MAC_TYPE {} \;
|
||||
echo "[5/"$F1MAC_N"]"
|
||||
find . -name '*.fl' -exec $SET_MAC_TYPE {} \;
|
||||
echo "[6/"$F1MAC_N"]"
|
||||
find . -name 'make*' -exec $SET_MAC_TYPE {} \;
|
||||
echo "[7/"$F1MAC_N"]"
|
||||
find . -name 'Make*' -exec $SET_MAC_TYPE {} \;
|
||||
echo "done."
|
||||
#!/bin/tcsh
|
||||
setenv SET_MAC_TYPE "SetFile -t TEXT -c ttxt "
|
||||
setenv F1MAC_N 7
|
||||
echo "Setting Mac File Types. Please wait..."
|
||||
echo "[1/"$F1MAC_N"]"
|
||||
find . -name '*.H' -exec $SET_MAC_TYPE {} \;
|
||||
echo "[2/"$F1MAC_N"]"
|
||||
find . -name '*.h' -exec $SET_MAC_TYPE {} \;
|
||||
echo "[3/"$F1MAC_N"]"
|
||||
find . -name '*.c' -exec $SET_MAC_TYPE {} \;
|
||||
echo "[4/"$F1MAC_N"]"
|
||||
find . -name '*.cxx' -exec $SET_MAC_TYPE {} \;
|
||||
echo "[5/"$F1MAC_N"]"
|
||||
find . -name '*.fl' -exec $SET_MAC_TYPE {} \;
|
||||
echo "[6/"$F1MAC_N"]"
|
||||
find . -name 'make*' -exec $SET_MAC_TYPE {} \;
|
||||
echo "[7/"$F1MAC_N"]"
|
||||
find . -name 'Make*' -exec $SET_MAC_TYPE {} \;
|
||||
echo "done."
|
||||
|
||||
|
||||
known MacFLTK bugs and ToDo's
|
||||
-----------------------------
|
||||
KNOWN MacFLTK BUGS
|
||||
|
||||
- file handles not supported
|
||||
- line styles not fully implemented
|
||||
- cut, copy, paste not implemented
|
||||
- sub-sub-subwindow not tested
|
||||
- image transparency not implemented
|
||||
- 'shiny' needs work (flush/aglFlush)
|
||||
- threads not implemented
|
||||
The following FLTK things are not implemented or don't work
|
||||
at present:
|
||||
|
||||
- File handles (Fl::add_fd) are not implemented.
|
||||
- Line styles are not fully implemented.
|
||||
- Cut, copy, and paste are not implemented.
|
||||
- Sub-sub-subwindow not tested.
|
||||
- Image transparency is not implemented.
|
||||
- The 'shiny' demo needs work (flush/aglFlush).
|
||||
- Threads are not implemented.
|
||||
|
||||
|
||||
test suite status
|
||||
-----------------
|
||||
TEST SUITE STATUS
|
||||
|
||||
OS X:
|
||||
OS X:
|
||||
|
||||
CubeView(++), adjuster(++), arc(++), ask(++), bitmap(++),
|
||||
boxtype(++), browser(++), button(++), buttons(++), checkers(++),
|
||||
clock(++), colbrowser(++), color_chooser(++), cube(++), cursor(++),
|
||||
curve(++), demo(++), doublebuffer(++), editor(++), fast_slow(++),
|
||||
file_chooser(++), fonts(++), forms(++), fractals(++), fullscreen(++),
|
||||
gl_overlay(++), glpuzzle(++), hello(++), help(++), iconize(++), image(+),
|
||||
inactive(++), input(++), keyboard(++), label(++), line_style(+),
|
||||
mandelbrot(++), menubar(++), message(++), minimum(++), navigation(++),
|
||||
output(++), overlay(++), pack(++), pixmap(++), pixmap_browser(++),
|
||||
radio(++), resizebox(++), scroll(++), shape(++), shiny(-), subwindow(++),
|
||||
symbols(++), tabs(++), tile(++), tiled_image(++), valuators(++),
|
||||
fluid(++)
|
||||
CubeView(++), adjuster(++), arc(++), ask(++), bitmap(++),
|
||||
boxtype(++), browser(++), button(++), buttons(++),
|
||||
checkers(++), clock(++), colbrowser(++), color_chooser(++),
|
||||
cube(++), cursor(++), curve(++), demo(++), doublebuffer(++),
|
||||
editor(++), fast_slow(++), file_chooser(++), fonts(++),
|
||||
forms(++), fractals(++), fullscreen(++), gl_overlay(++),
|
||||
glpuzzle(++), hello(++), help(++), iconize(++), image(+),
|
||||
inactive(++), input(++), keyboard(++), label(++),
|
||||
line_style(+), mandelbrot(++), menubar(++), message(++),
|
||||
minimum(++), navigation(++), output(++), overlay(++),
|
||||
pack(++), pixmap(++), pixmap_browser(++), radio(++),
|
||||
resizebox(++), scroll(++), shape(++), shiny(-),
|
||||
subwindow(++), symbols(++), tabs(++), tile(++),
|
||||
tiled_image(++), valuators(++), fluid(++)
|
||||
|
||||
(o)=minor bugs, (+)=usable, (++)=running perfectly, (-)=major
|
||||
bugs, (--)=crashes
|
||||
(o)=minor bugs, (+)=usable, (++)=running perfectly,
|
||||
(-)=major bugs, (--)=crashes
|
||||
|
||||
|
||||
other stuff
|
||||
-----------
|
||||
OTHER STUFF
|
||||
|
||||
The following creator ID's 'FLTK', 'Fltk', 'FLID' and 'Flid' are
|
||||
officially registered with Apple Computers and can be used for
|
||||
FLTK applications ('FLTK') and fluid files ('Flid').
|
||||
The creator ID's 'FLTK', 'Fltk', 'FLID', and 'Flid' are
|
||||
officially registered with Apple Computers, Inc. and can be
|
||||
used for FLTK applications ('FLTK') and FLUID files
|
||||
('Flid').
|
||||
|
||||
All applications should be ended with exit(0); or they might
|
||||
hang until killed.
|
||||
|
||||
Under OS X, all windows are doublebuffered anyway. Using Fl_Window
|
||||
has the same effect as using Fl_Double_Window on OS X.
|
||||
|
||||
|
||||
FLTK 1.0.x for Mac
|
||||
------------------
|
||||
|
||||
FLTK 1.0.6 for Mac OS 8.x and OS 9.x is in beta stage and can be
|
||||
downloaded from http://www.matthiasm.com/fltk/mac.shtml. The
|
||||
archive contains build files for Metrowerks CodeWarrior 5 and 6.
|
||||
|
||||
FLTK 1.0.6 for Mac is not supported by the FLTK team and will not
|
||||
be further developed by the author. Instead it will be replaced
|
||||
by FLTK 1.1.x for Mac in the near future.
|
||||
|
||||
Matthias Melcher
|
||||
All applications should call exit(0) to terminate; otherwise
|
||||
they may hang until killed.
|
||||
|
||||
Under MacOS X, all windows are double-buffered. Using
|
||||
Fl_Window has the same effect as using Fl_Double_Window on
|
||||
other operating systems.
|
||||
|
||||
|
||||
FLTK 1.0.X FOR MAC
|
||||
|
||||
FLTK 1.0.6 for MacOS 8.x and OS 9.x is in beta stage and can
|
||||
be downloaded from http://www.matthiasm.com/fltk/mac.shtml.
|
||||
The archive contains build files for Metrowerks CodeWarrior
|
||||
5 and 6.
|
||||
|
||||
FLTK 1.0.6 for Mac is not supported by the FLTK team and
|
||||
will not be further developed by the author. Instead it
|
||||
will be replaced by FLTK 1.1.x for Mac in the near future.
|
||||
|
||||
+5
-4
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Group.cxx,v 1.8.2.8.2.7 2001/12/19 18:40:13 easysw Exp $"
|
||||
// "$Id: Fl_Group.cxx,v 1.8.2.8.2.8 2001/12/20 14:41:44 easysw Exp $"
|
||||
//
|
||||
// Group widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -298,7 +298,7 @@ void Fl_Group::clear() {
|
||||
int old_children = children();
|
||||
// clear everything now, in case fl_fix_focus recursively calls us:
|
||||
children_ = 0;
|
||||
// array_ = 0; dont do this, it will clobber old_array if only one child
|
||||
//array_ = 0; //dont do this, it will clobber old_array if only one child
|
||||
savedfocus_ = 0;
|
||||
resizable_ = this;
|
||||
init_sizes();
|
||||
@@ -306,7 +306,7 @@ void Fl_Group::clear() {
|
||||
Fl_Widget*const* a = old_array;
|
||||
for (int i=old_children; i--;) {
|
||||
Fl_Widget* o = *a++;
|
||||
delete o;
|
||||
if (o->parent() == this) delete o;
|
||||
}
|
||||
if (old_children > 1) free((void*)old_array);
|
||||
}
|
||||
@@ -347,6 +347,7 @@ void Fl_Group::insert(Fl_Widget &o, int index) {
|
||||
void Fl_Group::add(Fl_Widget &o) {insert(o, children_);}
|
||||
|
||||
void Fl_Group::remove(Fl_Widget &o) {
|
||||
if (!children_) return;
|
||||
int i = find(o);
|
||||
if (i >= children_) return;
|
||||
if (&o == savedfocus_) savedfocus_ = 0;
|
||||
@@ -551,5 +552,5 @@ void Fl_Group::draw_outside_label(const Fl_Widget& w) const {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Group.cxx,v 1.8.2.8.2.7 2001/12/19 18:40:13 easysw Exp $".
|
||||
// End of "$Id: Fl_Group.cxx,v 1.8.2.8.2.8 2001/12/20 14:41:44 easysw Exp $".
|
||||
//
|
||||
|
||||
+25
-21
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Menu.cxx,v 1.18.2.12.2.4 2001/10/29 03:44:32 easysw Exp $"
|
||||
// "$Id: Fl_Menu.cxx,v 1.18.2.12.2.5 2001/12/20 14:41:44 easysw Exp $"
|
||||
//
|
||||
// Menu code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <FL/Fl_Menu_Window.H>
|
||||
#include <FL/Fl_Menu_.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <stdio.h>
|
||||
|
||||
int Fl_Menu_Item::size() const {
|
||||
const Fl_Menu_Item* m = this;
|
||||
@@ -158,33 +159,36 @@ void Fl_Menu_Item::draw(int x, int y, int w, int h, const Fl_Menu_* m,
|
||||
}
|
||||
|
||||
if (flags & (FL_MENU_TOGGLE|FL_MENU_RADIO)) {
|
||||
int size = 12;
|
||||
int y1 = y + (h - size) / 2;
|
||||
int x1 = x + 2;
|
||||
int d = (h - FL_NORMAL_SIZE + 1) / 2;
|
||||
int W = h - 2 * d;
|
||||
|
||||
if (flags & FL_MENU_RADIO) {
|
||||
fl_color(FL_DARK3);
|
||||
fl_arc(x1, y1, size, size, 45.0, 225.0);
|
||||
fl_color(FL_LIGHT3);
|
||||
fl_arc(x1, y1, size, size, 225.0, 405.0);
|
||||
|
||||
fl_draw_box(FL_ROUND_DOWN_BOX, x+2, y+d+1, W, W, FL_WHITE);
|
||||
if (value()) {
|
||||
fl_color(FL_BLACK);
|
||||
fl_pie(x1 + 3, y1 + 3, size - 7, size - 7, 0.0, 360.0);
|
||||
fl_color(labelcolor_);
|
||||
int tW = W - Fl::box_dw(FL_ROUND_DOWN_BOX) - 3;
|
||||
int td = Fl::box_dx(FL_ROUND_DOWN_BOX) + 2;
|
||||
if (tW > 4) {
|
||||
fl_pie(x + td + 1, y + td, tW, tW + 1, 0.0, 360.0);
|
||||
} else {
|
||||
// Small circles don't draw well with some X servers...
|
||||
fl_rectf(x + td + 2, y + td, 2, 4);
|
||||
fl_rectf(x + td + 1, y + td + 1, 4, 2);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fl_draw_box(FL_THIN_DOWN_FRAME, x1, y1, size, size, color);
|
||||
fl_draw_box(FL_DOWN_BOX, x+2, y+d, W, W, FL_WHITE);
|
||||
if (value()) {
|
||||
fl_color(FL_BLACK);
|
||||
fl_line_style(FL_SOLID, 2);
|
||||
fl_line(x1 + size - 3, y1 + 2,
|
||||
x1 + size / 2 - 1, y1 + size - 4,
|
||||
x1 + 3, y1 + size / 2);
|
||||
fl_line_style(FL_SOLID);
|
||||
fl_color(labelcolor_);
|
||||
fl_line_style(FL_SOLID, 2);
|
||||
fl_line(x + W - 1, y + d + 3,
|
||||
x + W / 2 + 1, y + d + W - 4,
|
||||
x + 5, y + d + W / 2);
|
||||
fl_line_style(FL_SOLID);
|
||||
}
|
||||
}
|
||||
x += size + 3;
|
||||
w -= size + 3;
|
||||
x += W + 3;
|
||||
w -= W + 3;
|
||||
}
|
||||
|
||||
if (!fl_draw_shortcut) fl_draw_shortcut = 1;
|
||||
@@ -752,5 +756,5 @@ const Fl_Menu_Item* Fl_Menu_Item::test_shortcut() const {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Menu.cxx,v 1.18.2.12.2.4 2001/10/29 03:44:32 easysw Exp $".
|
||||
// End of "$Id: Fl_Menu.cxx,v 1.18.2.12.2.5 2001/12/20 14:41:44 easysw Exp $".
|
||||
//
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Widget.cxx,v 1.5.2.4.2.11 2001/12/19 18:15:34 easysw Exp $"
|
||||
// "$Id: Fl_Widget.cxx,v 1.5.2.4.2.12 2001/12/20 14:41:44 easysw Exp $"
|
||||
//
|
||||
// Base widget class for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -126,7 +126,7 @@ extern void fl_throw_focus(Fl_Widget*); // in Fl_x.cxx
|
||||
// However, it is only legal to destroy a "root" such as an Fl_Window,
|
||||
// and automatic destructors may be called.
|
||||
Fl_Widget::~Fl_Widget() {
|
||||
if (parent_) parent_->remove(this);
|
||||
if (parent_) parent_ = 0;
|
||||
fl_throw_focus(this);
|
||||
}
|
||||
|
||||
@@ -248,5 +248,5 @@ int Fl_Widget::contains(const Fl_Widget *o) const {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Widget.cxx,v 1.5.2.4.2.11 2001/12/19 18:15:34 easysw Exp $".
|
||||
// End of "$Id: Fl_Widget.cxx,v 1.5.2.4.2.12 2001/12/20 14:41:44 easysw Exp $".
|
||||
//
|
||||
|
||||
+9
-3
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Window.cxx,v 1.6.2.3.2.1 2001/11/22 15:35:01 easysw Exp $"
|
||||
// "$Id: Fl_Window.cxx,v 1.6.2.3.2.2 2001/12/20 14:41:44 easysw Exp $"
|
||||
//
|
||||
// Window widget class for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -34,7 +34,13 @@
|
||||
void Fl_Window::_Fl_Window() {
|
||||
type(FL_WINDOW);
|
||||
box(FL_FLAT_BOX);
|
||||
labeltype(FL_NO_LABEL);
|
||||
if (Fl::scheme_bg_) {
|
||||
labeltype(FL_NORMAL_LABEL);
|
||||
align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP);
|
||||
image(Fl::scheme_bg_);
|
||||
} else {
|
||||
labeltype(FL_NO_LABEL);
|
||||
}
|
||||
i = 0;
|
||||
xclass_ = 0;
|
||||
icon_ = 0;
|
||||
@@ -102,5 +108,5 @@ void Fl_Window::default_callback(Fl_Window* window, void* v) {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Window.cxx,v 1.6.2.3.2.1 2001/11/22 15:35:01 easysw Exp $".
|
||||
// End of "$Id: Fl_Window.cxx,v 1.6.2.3.2.2 2001/12/20 14:41:44 easysw Exp $".
|
||||
//
|
||||
|
||||
+17
-12
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_arg.cxx,v 1.5.2.8.2.4 2001/12/11 16:03:12 easysw Exp $"
|
||||
// "$Id: Fl_arg.cxx,v 1.5.2.8.2.5 2001/12/20 14:41:44 easysw Exp $"
|
||||
//
|
||||
// Optional argument initialization code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -87,7 +87,7 @@ int Fl::arg(int argc, char **argv, int &i) {
|
||||
Fl::visible_focus(1);
|
||||
i++;
|
||||
return 1;
|
||||
} else if (match(s, "nokbd")) {
|
||||
} else if (match(s, "nokbd", 3)) {
|
||||
Fl::visible_focus(0);
|
||||
i++;
|
||||
return 1;
|
||||
@@ -124,6 +124,9 @@ int Fl::arg(int argc, char **argv, int &i) {
|
||||
} else if (match(s, "fg") || match(s, "foreground")) {
|
||||
fl_fg = v;
|
||||
|
||||
} else if (match(s, "scheme")) {
|
||||
Fl::scheme(v);
|
||||
|
||||
} else return 0; // unrecognized
|
||||
|
||||
i += 2;
|
||||
@@ -184,7 +187,7 @@ void Fl_Window::show(int argc, char **argv) {
|
||||
|
||||
if (!beenhere) {
|
||||
beenhere = 1;
|
||||
Fl::get_system_colors(); // opens display! May call Fl::fatal()
|
||||
Fl::scheme(Fl::scheme()); // opens display! May call Fl::fatal()
|
||||
}
|
||||
|
||||
#if !defined(WIN32) && !defined(__APPLE__)
|
||||
@@ -204,15 +207,17 @@ void Fl_Window::show(int argc, char **argv) {
|
||||
|
||||
static const char * const helpmsg =
|
||||
"options are:\n"
|
||||
" -d[isplay] host:n.n\n"
|
||||
" -g[eometry] WxH+X+Y\n"
|
||||
" -t[itle] windowtitle\n"
|
||||
" -n[ame] classname\n"
|
||||
" -i[conic]\n"
|
||||
" -fg color\n"
|
||||
" -bg color\n"
|
||||
" -bg2 color\n"
|
||||
" -nokbd";
|
||||
" -bg color\n"
|
||||
" -d[isplay] host:n.n\n"
|
||||
" -fg color\n"
|
||||
" -g[eometry] WxH+X+Y\n"
|
||||
" -i[conic]\n"
|
||||
" -k[bd]\n"
|
||||
" -n[ame] classname\n"
|
||||
" -nok[bd]\n"
|
||||
" -s[cheme] scheme\n"
|
||||
" -t[itle] windowtitle";
|
||||
|
||||
const char * const Fl::help = helpmsg+13;
|
||||
|
||||
@@ -359,5 +364,5 @@ int XParseGeometry(const char* string, int* x, int* y,
|
||||
#endif // ifdef WIN32
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_arg.cxx,v 1.5.2.8.2.4 2001/12/11 16:03:12 easysw Exp $".
|
||||
// End of "$Id: Fl_arg.cxx,v 1.5.2.8.2.5 2001/12/20 14:41:44 easysw Exp $".
|
||||
//
|
||||
|
||||
+12
-6
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_display.cxx,v 1.4.2.3.2.1 2001/11/27 17:44:06 easysw Exp $"
|
||||
// "$Id: Fl_display.cxx,v 1.4.2.3.2.2 2001/12/20 14:41:44 easysw Exp $"
|
||||
//
|
||||
// Display function for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -31,17 +31,23 @@
|
||||
#include <string.h>
|
||||
|
||||
void Fl::display(const char *d) {
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__) || defined(WIN32)
|
||||
(void)d;
|
||||
#else
|
||||
char *e = new char[strlen(d)+13];
|
||||
static char e[1024];
|
||||
strcpy(e,"DISPLAY=");
|
||||
strcpy(e+8,d);
|
||||
for (char *c = e+8; *c!=':'; c++) if (!*c) {strcpy(c,":0.0"); break;}
|
||||
strncat(e,d,sizeof(e) - 1);
|
||||
e[sizeof(e) - 1] = '\0';
|
||||
for (char *c = e+8; *c!=':'; c++) {
|
||||
if (!*c) {
|
||||
strncat(e,":0.0",sizeof(e) - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
putenv(e);
|
||||
#endif // __APPLE__
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_display.cxx,v 1.4.2.3.2.1 2001/11/27 17:44:06 easysw Exp $".
|
||||
// End of "$Id: Fl_display.cxx,v 1.4.2.3.2.2 2001/12/20 14:41:44 easysw Exp $".
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.2 2001/11/27 17:44:06 easysw Exp $"
|
||||
// "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.3 2001/12/20 14:41:44 easysw Exp $"
|
||||
//
|
||||
// System color support for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -24,9 +24,15 @@
|
||||
//
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/math.h>
|
||||
#include <string.h>
|
||||
#include "flstring.h"
|
||||
#include <stdlib.h>
|
||||
#include <FL/Fl_Pixmap.H>
|
||||
#include <FL/Fl_Tiled_Image.H>
|
||||
#include "tile.xpm"
|
||||
|
||||
|
||||
void Fl::background(uchar r, uchar g, uchar b) {
|
||||
// replace the gray ramp so that FL_GRAY is this color
|
||||
@@ -117,7 +123,8 @@ void Fl::get_system_colors() {
|
||||
// MacOS X currently supports two color schemes - Blue and Graphite.
|
||||
// Since we aren't emulating the Aqua interface (even if Apple would
|
||||
// let us), we can stick with the defaults that FLTK has traditionally
|
||||
// used...
|
||||
// used... The Fl::scheme("plastic") color/box scheme provides a
|
||||
// usable Aqua-like look-n-feel...
|
||||
void Fl::get_system_colors()
|
||||
{
|
||||
fl_open_display();
|
||||
@@ -161,6 +168,108 @@ void Fl::get_system_colors()
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//// Simple implementation of 2.0 Fl::scheme() interface...
|
||||
#define D1 BORDER_WIDTH
|
||||
#define D2 (BORDER_WIDTH+BORDER_WIDTH)
|
||||
|
||||
extern void fl_up_box(int, int, int, int, Fl_Color);
|
||||
extern void fl_down_box(int, int, int, int, Fl_Color);
|
||||
extern void fl_thin_up_box(int, int, int, int, Fl_Color);
|
||||
extern void fl_thin_down_box(int, int, int, int, Fl_Color);
|
||||
extern void fl_round_up_box(int, int, int, int, Fl_Color);
|
||||
extern void fl_round_down_box(int, int, int, int, Fl_Color);
|
||||
|
||||
extern void fl_up_frame(int, int, int, int, Fl_Color);
|
||||
extern void fl_down_frame(int, int, int, int, Fl_Color);
|
||||
extern void fl_thin_up_frame(int, int, int, int, Fl_Color);
|
||||
extern void fl_thin_down_frame(int, int, int, int, Fl_Color);
|
||||
|
||||
const char *Fl::scheme_ = (const char *)0;
|
||||
Fl_Image *Fl::scheme_bg_ = (Fl_Image *)0;
|
||||
|
||||
static Fl_Pixmap tile(tile_xpm);
|
||||
|
||||
int Fl::scheme(const char *s) {
|
||||
if (!s) s = getenv("FLTK_SCHEME");
|
||||
if (s) {
|
||||
if (!strcasecmp(s, "none") || !*s) s = 0;
|
||||
else s = strdup(s);
|
||||
}
|
||||
if (scheme_) free((void*)scheme_);
|
||||
scheme_ = s;
|
||||
|
||||
// Save the new scheme in the FLTK_SCHEME env var so that child processes
|
||||
// inherit it...
|
||||
static char e[1024];
|
||||
strcpy(e,"FLTK_SCHEME=");
|
||||
if (s) {
|
||||
strncat(e,s,sizeof(e) - 1);
|
||||
e[sizeof(e) - 1] = '\0';
|
||||
}
|
||||
putenv(e);
|
||||
|
||||
// Load the scheme...
|
||||
return reload_scheme();
|
||||
}
|
||||
|
||||
int Fl::reload_scheme() {
|
||||
Fl_Window *w;
|
||||
|
||||
get_system_colors();
|
||||
|
||||
if (scheme_ && !strcasecmp(scheme_, "plastic")) {
|
||||
// Load plastic buttons, etc...
|
||||
if (!scheme_bg_) scheme_bg_ = new Fl_Tiled_Image(&tile, Fl::w(), Fl::h());
|
||||
|
||||
Fl::foreground(0, 0, 0);
|
||||
Fl::background(0xe0, 0xe0, 0xe0);
|
||||
Fl::background2(0xf0, 0xf0, 0xf0);
|
||||
set_selection_color(0x80, 0x80, 0x80);
|
||||
|
||||
Fl::set_boxtype(FL_UP_FRAME, FL_PLASTIC_UP_FRAME);
|
||||
Fl::set_boxtype(FL_DOWN_FRAME, FL_PLASTIC_DOWN_FRAME);
|
||||
Fl::set_boxtype(FL_THIN_UP_FRAME, FL_PLASTIC_UP_FRAME);
|
||||
Fl::set_boxtype(FL_THIN_DOWN_FRAME, FL_PLASTIC_DOWN_FRAME);
|
||||
|
||||
Fl::set_boxtype(FL_UP_BOX, FL_PLASTIC_UP_BOX);
|
||||
Fl::set_boxtype(FL_DOWN_BOX, FL_PLASTIC_DOWN_BOX);
|
||||
Fl::set_boxtype(FL_THIN_UP_BOX, FL_PLASTIC_UP_BOX);
|
||||
Fl::set_boxtype(FL_THIN_DOWN_BOX, FL_PLASTIC_DOWN_BOX);
|
||||
Fl::set_boxtype(_FL_ROUND_UP_BOX, FL_PLASTIC_UP_BOX);
|
||||
Fl::set_boxtype(_FL_ROUND_DOWN_BOX, FL_PLASTIC_UP_BOX);
|
||||
} else {
|
||||
// Use the standard FLTK look-n-feel...
|
||||
if (scheme_bg_) {
|
||||
delete scheme_bg_;
|
||||
scheme_bg_ = (Fl_Image *)0;
|
||||
}
|
||||
|
||||
Fl::set_boxtype(FL_UP_FRAME, fl_up_frame, D1, D1, D2, D2);
|
||||
Fl::set_boxtype(FL_DOWN_FRAME, fl_down_frame, D1, D1, D2, D2);
|
||||
Fl::set_boxtype(FL_THIN_UP_FRAME, fl_thin_up_frame, 1, 1, 2, 2);
|
||||
Fl::set_boxtype(FL_THIN_DOWN_FRAME, fl_thin_down_frame, 1, 1, 2, 2);
|
||||
|
||||
Fl::set_boxtype(FL_UP_BOX, fl_up_box, D1, D1, D2, D2);
|
||||
Fl::set_boxtype(FL_DOWN_BOX, fl_down_box, D1, D1, D2, D2);
|
||||
Fl::set_boxtype(FL_THIN_UP_BOX, fl_thin_up_box, 1, 1, 2, 2);
|
||||
Fl::set_boxtype(FL_THIN_DOWN_BOX, fl_thin_down_box, 1, 1, 2, 2);
|
||||
Fl::set_boxtype(_FL_ROUND_UP_BOX, fl_round_up_box, 3, 3, 6, 6);
|
||||
Fl::set_boxtype(_FL_ROUND_DOWN_BOX, fl_round_down_box, 3, 3, 6, 6);
|
||||
}
|
||||
|
||||
// Set (or clear) the background tile for all windows...
|
||||
for (w = first_window(); w; w = next_window(w)) {
|
||||
w->labeltype(scheme_bg_ ? FL_NORMAL_LABEL : FL_NO_LABEL);
|
||||
w->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP);
|
||||
w->image(scheme_bg_);
|
||||
w->redraw();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.2 2001/11/27 17:44:06 easysw Exp $".
|
||||
// End of "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.3 2001/12/20 14:41:44 easysw Exp $".
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: fl_round_box.cxx,v 1.6.2.3 2001/01/22 15:13:41 easysw Exp $"
|
||||
// "$Id: fl_round_box.cxx,v 1.6.2.3.2.1 2001/12/20 14:41:44 easysw Exp $"
|
||||
//
|
||||
// Round box drawing routines for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -80,7 +80,7 @@ static void draw(int which, int x,int y,int w,int h, int inset, uchar color)
|
||||
|
||||
extern uchar* fl_gray_ramp();
|
||||
|
||||
static void fl_round_down_box(int x, int y, int w, int h, Fl_Color bgcolor) {
|
||||
void fl_round_down_box(int x, int y, int w, int h, Fl_Color bgcolor) {
|
||||
uchar *g = fl_gray_ramp();
|
||||
draw(FILL, x, y, w, h, 2, bgcolor);
|
||||
draw(UPPER_LEFT, x+1, y, w-2, h, 0, g['N']);
|
||||
@@ -94,7 +94,7 @@ static void fl_round_down_box(int x, int y, int w, int h, Fl_Color bgcolor) {
|
||||
draw(CLOSED, x, y, w, h, 2, g['A']);
|
||||
}
|
||||
|
||||
static void fl_round_up_box(int x, int y, int w, int h, Fl_Color bgcolor) {
|
||||
void fl_round_up_box(int x, int y, int w, int h, Fl_Color bgcolor) {
|
||||
uchar *g = fl_gray_ramp();
|
||||
draw(FILL, x, y, w, h, 2, bgcolor);
|
||||
draw(LOWER_RIGHT, x+1, y, w-2, h, 0, g['H']);
|
||||
@@ -116,5 +116,5 @@ Fl_Boxtype define_FL_ROUND_UP_BOX() {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: fl_round_box.cxx,v 1.6.2.3 2001/01/22 15:13:41 easysw Exp $".
|
||||
// End of "$Id: fl_round_box.cxx,v 1.6.2.3.2.1 2001/12/20 14:41:44 easysw Exp $".
|
||||
//
|
||||
|
||||
+4
-1
@@ -267,7 +267,10 @@ Fl_display.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
|
||||
Fl_get_key.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/x.H
|
||||
Fl_get_key.o: ../FL/Fl_Window.H
|
||||
Fl_get_system_colors.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
|
||||
Fl_get_system_colors.o: ../FL/x.H ../FL/Fl_Window.H ../FL/math.h
|
||||
Fl_get_system_colors.o: ../FL/fl_draw.H ../FL/x.H ../FL/Fl_Window.H
|
||||
Fl_get_system_colors.o: ../FL/math.h flstring.h ../config.h ../FL/Fl_Pixmap.H
|
||||
Fl_get_system_colors.o: ../FL/Fl_Image.H ../FL/x.H ../FL/Fl_Tiled_Image.H
|
||||
Fl_get_system_colors.o: tile.xpm
|
||||
Fl_grab.o: ../config.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
|
||||
Fl_grab.o: ../FL/x.H ../FL/Fl_Window.H
|
||||
Fl_lock.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H ../config.h
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/* XPM */
|
||||
static const char * tile_xpm[] = {
|
||||
"16 16 3 1",
|
||||
"O c #F0F0F0",
|
||||
"o c #E0E0E0",
|
||||
". c #D8D8D8",
|
||||
"OOOOOOOOOOOOOOOO",
|
||||
"oooooooooooooooo",
|
||||
"................",
|
||||
"oooooooooooooooo",
|
||||
"OOOOOOOOOOOOOOOO",
|
||||
"oooooooooooooooo",
|
||||
"................",
|
||||
"oooooooooooooooo",
|
||||
"OOOOOOOOOOOOOOOO",
|
||||
"oooooooooooooooo",
|
||||
"................",
|
||||
"oooooooooooooooo",
|
||||
"OOOOOOOOOOOOOOOO",
|
||||
"oooooooooooooooo",
|
||||
"................",
|
||||
"oooooooooooooooo"};
|
||||
Reference in New Issue
Block a user