mirror of https://github.com/fltk/fltk
Add missing Fl_Check_Browser file.
Add makesrcdist script. Updated changelog. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1576 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
00ef77c267
commit
286ebf903f
21
CHANGES
21
CHANGES
|
@ -1,4 +1,12 @@
|
|||
CHANGES IN FLTK 1.1.0
|
||||
TODO - FLUID now provides on-line help.
|
||||
|
||||
TODO - FLUID now supports image labels in addition to text
|
||||
labels + text over image alignment.
|
||||
|
||||
TODO - Documentation updates.
|
||||
|
||||
|
||||
CHANGES IN FLTK 1.1.0b1
|
||||
|
||||
- Added new image() and deimage() methods to support
|
||||
image + text labels more easily.
|
||||
|
@ -31,22 +39,11 @@ CHANGES IN FLTK 1.1.0
|
|||
dependencies on OpenGL when no OpenGL functionality is
|
||||
used/required.
|
||||
|
||||
TODO - Colors are now 32 bits in FLTK, allowing the use and
|
||||
selection of 24-bit RGB values or 8-bit FLTK indexed
|
||||
colors.
|
||||
|
||||
- FLUID now supports the new Fl_CheckBrowser,
|
||||
Fl_FileBrowser, Fl_FileIcon, Fl_HelpView,
|
||||
Fl_Text_Display, Fl_Text_Editor, and Fl_Wizard
|
||||
widgets.
|
||||
|
||||
TODO - FLUID now provides on-line help.
|
||||
|
||||
TODO - FLUID now supports image labels in addition to text
|
||||
labels + text over image alignment.
|
||||
|
||||
TODO - Documentation updates.
|
||||
|
||||
- Updated configure stuff to support shared libraries
|
||||
under AIX (link to -lfltk_s)
|
||||
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# makedist - make a distribution of FLTK.
|
||||
#
|
||||
|
||||
echo "Getting distribution..."
|
||||
|
||||
CVS_RSH=ssh1; export CVS_RSH
|
||||
MAINTAINER=easysw
|
||||
|
||||
cd /tmp
|
||||
cvs -d$MAINTAINER@cvs.fltk.sourceforge.net:/cvsroot/fltk get -r v1_1 fltk >& /dev/null
|
||||
|
||||
if ($#argv == 0) then
|
||||
echo -n "Version number for distribution? "
|
||||
set version = $<
|
||||
else
|
||||
set version = $1
|
||||
endif
|
||||
|
||||
rm -rf fltk-$version
|
||||
mv fltk fltk-$version
|
||||
cd fltk-$version
|
||||
|
||||
if ("$version" != "snapshot") then
|
||||
echo "Tagging release..."
|
||||
|
||||
set tag = `echo v$version | tr '.' '_'`
|
||||
|
||||
cvs tag -F $tag
|
||||
endif
|
||||
|
||||
echo "Making configuration script..."
|
||||
|
||||
autoconf
|
||||
|
||||
echo "Removing CVS directories..."
|
||||
|
||||
rm -rf CVS */CVS */*/CVS
|
||||
rm makesrcdist
|
||||
|
||||
echo "Generating .cxx and .h files for fluid demos..."
|
||||
|
||||
cd test
|
||||
cp demo.menu demod.menu
|
||||
|
||||
foreach file (*.fl)
|
||||
echo $file
|
||||
fluid -c $file
|
||||
if ($status != 0) then
|
||||
echo Error executing fluid: $status
|
||||
exit 1
|
||||
endif
|
||||
end
|
||||
cd ..
|
||||
|
||||
echo "Making UNIX distribution..."
|
||||
|
||||
cd ..
|
||||
gtar czf fltk-$version-source.tar.gz fltk-$version
|
||||
|
||||
echo "Making BZ2 distribution..."
|
||||
gunzip -c fltk-$version-source.tar.gz | bzip2 -v9 >fltk-$version-source.tar.bz2
|
||||
|
||||
echo "Making Windows distribution..."
|
||||
|
||||
rm -f fltk-$version-source.zip
|
||||
zip -r9 fltk-$version-source.zip fltk-$version
|
||||
|
||||
echo "Removing distribution directory..."
|
||||
|
||||
rm -rf fltk-$version
|
||||
|
||||
echo "Done\!"
|
|
@ -0,0 +1,263 @@
|
|||
//
|
||||
// "$Id: Fl_Check_Browser.cxx,v 1.1.2.1 2001/08/18 23:42:36 easysw Exp $"
|
||||
//
|
||||
// Fl_Check_Browser header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2001 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 to "fltk-bugs@fltk.org".
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/Fl_Check_Browser.H>
|
||||
|
||||
/* This uses a cache for faster access when you're scanning the list
|
||||
either forwards or backwards. */
|
||||
|
||||
Fl_Check_Browser::cb_item *Fl_Check_Browser::find_item(int n) const {
|
||||
int i = n;
|
||||
cb_item *p = first;
|
||||
|
||||
if (n <= 0 || n > nitems_ || p == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (n == cached_item) {
|
||||
p = cache;
|
||||
n = 1;
|
||||
} else if (n == cached_item + 1) {
|
||||
p = cache->next;
|
||||
n = 1;
|
||||
} else if (n == cached_item - 1) {
|
||||
p = cache->prev;
|
||||
n = 1;
|
||||
}
|
||||
|
||||
while (--n) {
|
||||
p = p->next;
|
||||
}
|
||||
|
||||
/* Cast to not const and cache it. */
|
||||
|
||||
((Fl_Check_Browser *)this)->cache = p;
|
||||
((Fl_Check_Browser *)this)->cached_item = i;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
int Fl_Check_Browser::lineno(cb_item *p0) const {
|
||||
cb_item *p = first;
|
||||
|
||||
if (p == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int i = 1;
|
||||
while (p) {
|
||||
if (p == p0) {
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
p = p->next;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Fl_Check_Browser::Fl_Check_Browser(int x, int y, int w, int h, const char *l)
|
||||
: Fl_Browser_(x, y, w, h, l) {
|
||||
type(FL_SELECT_BROWSER);
|
||||
when(FL_WHEN_NEVER);
|
||||
first = last = 0;
|
||||
nitems_ = nchecked_ = 0;
|
||||
cached_item = -1;
|
||||
}
|
||||
|
||||
void *Fl_Check_Browser::item_first() const {
|
||||
return first;
|
||||
}
|
||||
|
||||
void *Fl_Check_Browser::item_next(void *l) const {
|
||||
return ((cb_item *)l)->next;
|
||||
}
|
||||
|
||||
void *Fl_Check_Browser::item_prev(void *l) const {
|
||||
return ((cb_item *)l)->prev;
|
||||
}
|
||||
|
||||
int Fl_Check_Browser::item_height(void *) const {
|
||||
return textsize() + 2;
|
||||
}
|
||||
|
||||
#define CHECK_SIZE 8
|
||||
|
||||
int Fl_Check_Browser::item_width(void *v) const {
|
||||
fl_font(textfont(), textsize());
|
||||
return int(fl_width(((cb_item *)v)->text)) + CHECK_SIZE + 8;
|
||||
}
|
||||
|
||||
void Fl_Check_Browser::item_draw(void *v, int x, int y, int, int) const {
|
||||
cb_item *i = (cb_item *)v;
|
||||
char *s = i->text;
|
||||
int size = textsize();
|
||||
Fl_Color col = textcolor();
|
||||
int cy = y + (size + 1 - CHECK_SIZE) / 2;
|
||||
x += 2;
|
||||
|
||||
fl_color(FL_BLACK);
|
||||
fl_loop(x, cy, x, cy + CHECK_SIZE,
|
||||
x + CHECK_SIZE, cy + CHECK_SIZE, x + CHECK_SIZE, cy);
|
||||
if (i->checked) {
|
||||
fl_line(x, cy, x + CHECK_SIZE, cy + CHECK_SIZE);
|
||||
fl_line(x, cy + CHECK_SIZE, x + CHECK_SIZE, cy);
|
||||
}
|
||||
fl_font(textfont(), size);
|
||||
if (i->selected) {
|
||||
col = contrast(col, selection_color());
|
||||
}
|
||||
fl_color(col);
|
||||
fl_draw(s, x + CHECK_SIZE + 8, y + size - 1);
|
||||
}
|
||||
|
||||
void Fl_Check_Browser::item_select(void *v, int state) {
|
||||
cb_item *i = (cb_item *)v;
|
||||
|
||||
if (state) {
|
||||
if (i->checked) {
|
||||
i->checked = 0;
|
||||
nchecked_--;
|
||||
} else {
|
||||
i->checked = 1;
|
||||
nchecked_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Fl_Check_Browser::item_selected(void *v) const {
|
||||
cb_item *i = (cb_item *)v;
|
||||
return i->selected;
|
||||
}
|
||||
|
||||
int Fl_Check_Browser::add(char *s) {
|
||||
return (add(s, 0));
|
||||
}
|
||||
|
||||
int Fl_Check_Browser::add(char *s, int b) {
|
||||
cb_item *p = (cb_item *)malloc(sizeof(cb_item));
|
||||
p->next = 0;
|
||||
p->prev = 0;
|
||||
p->checked = b;
|
||||
p->selected = 0;
|
||||
p->text = strdup(s);
|
||||
|
||||
if (b) {
|
||||
nchecked_++;
|
||||
}
|
||||
|
||||
if (last == 0) {
|
||||
first = last = p;
|
||||
} else {
|
||||
last->next = p;
|
||||
p->prev = last;
|
||||
last = p;
|
||||
}
|
||||
nitems_++;
|
||||
|
||||
return (nitems_);
|
||||
}
|
||||
|
||||
void Fl_Check_Browser::clear() {
|
||||
cb_item *p = first;
|
||||
cb_item *next;
|
||||
|
||||
if (p == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
new_list();
|
||||
do {
|
||||
next = p->next;
|
||||
free(p->text);
|
||||
free(p);
|
||||
p = next;
|
||||
} while (p);
|
||||
|
||||
first = last = 0;
|
||||
nitems_ = nchecked_ = 0;
|
||||
cached_item = -1;
|
||||
}
|
||||
|
||||
int Fl_Check_Browser::checked(int i) const {
|
||||
cb_item *p = find_item(i);
|
||||
|
||||
if (p) return p->checked;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Fl_Check_Browser::checked(int i, int b) {
|
||||
cb_item *p = find_item(i);
|
||||
|
||||
if (p && (p->checked ^ b)) {
|
||||
p->checked = b;
|
||||
if (b) {
|
||||
nchecked_++;
|
||||
} else {
|
||||
nchecked_--;
|
||||
}
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
|
||||
int Fl_Check_Browser::value() const {
|
||||
return lineno((cb_item *)selection());
|
||||
}
|
||||
|
||||
char *Fl_Check_Browser::text(int i) const {
|
||||
cb_item *p = find_item(i);
|
||||
|
||||
if (p) return p->text;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Fl_Check_Browser::check_all() {
|
||||
cb_item *p;
|
||||
|
||||
nchecked_ = nitems_;
|
||||
for (p = first; p; p = p->next) {
|
||||
p->checked = 1;
|
||||
}
|
||||
redraw();
|
||||
}
|
||||
|
||||
void Fl_Check_Browser::check_none() {
|
||||
cb_item *p;
|
||||
|
||||
nchecked_ = 0;
|
||||
for (p = first; p; p = p->next) {
|
||||
p->checked = 0;
|
||||
}
|
||||
redraw();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Check_Browser.cxx,v 1.1.2.1 2001/08/18 23:42:36 easysw Exp $".
|
||||
//
|
Loading…
Reference in New Issue