First attempt at consistently using Fl_Font as a type for the font index and Fl_Font_Size as a type to measure font height (or rather size).

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6113 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2008-04-23 19:09:28 +00:00
parent 88c0d727aa
commit 7c8f5cc888
46 changed files with 203 additions and 189 deletions

View File

@ -287,30 +287,33 @@ enum Fl_Align { // align() values
FL_ALIGN_NOWRAP = 0 // for back compatability
};
enum Fl_Font { // standard fonts
FL_HELVETICA = 0,
FL_HELVETICA_BOLD,
FL_HELVETICA_ITALIC,
FL_HELVETICA_BOLD_ITALIC,
FL_COURIER,
FL_COURIER_BOLD,
FL_COURIER_ITALIC,
FL_COURIER_BOLD_ITALIC,
FL_TIMES,
FL_TIMES_BOLD,
FL_TIMES_ITALIC,
FL_TIMES_BOLD_ITALIC,
FL_SYMBOL,
FL_SCREEN,
FL_SCREEN_BOLD,
FL_ZAPF_DINGBATS,
typedef unsigned int Fl_Font;
typedef unsigned int Fl_Font_Size;
FL_FREE_FONT = 16, // first one to allocate
FL_BOLD = 1, // add this to helvetica, courier, or times
FL_ITALIC = 2 // add this to helvetica, courier, or times
};
// standard fonts
const Fl_Font FL_HELVETICA = 0;
const Fl_Font FL_HELVETICA_BOLD = 1;
const Fl_Font FL_HELVETICA_ITALIC = 2;
const Fl_Font FL_HELVETICA_BOLD_ITALIC = 3;
const Fl_Font FL_COURIER = 4;
const Fl_Font FL_COURIER_BOLD = 5;
const Fl_Font FL_COURIER_ITALIC = 6;
const Fl_Font FL_COURIER_BOLD_ITALIC = 7;
const Fl_Font FL_TIMES = 8;
const Fl_Font FL_TIMES_BOLD = 9;
const Fl_Font FL_TIMES_ITALIC = 10;
const Fl_Font FL_TIMES_BOLD_ITALIC = 11;
const Fl_Font FL_SYMBOL = 12;
const Fl_Font FL_SCREEN = 13;
const Fl_Font FL_SCREEN_BOLD = 14;
const Fl_Font FL_ZAPF_DINGBATS = 15;
const Fl_Font FL_FREE_FONT = 16; // first one to allocate
const Fl_Font FL_BOLD = 1; // add this to helvetica, courier, or times
const Fl_Font FL_ITALIC = 2; // add this to helvetica, courier, or times
extern FL_EXPORT Fl_Font_Size FL_NORMAL_SIZE;
extern FL_EXPORT int FL_NORMAL_SIZE;
enum Fl_Color { // standard colors
// These are used as default colors in widgets and altered as necessary

View File

@ -53,7 +53,8 @@ class FL_EXPORT Fl_Browser_ : public Fl_Group {
int offset_; // how far down top_ item the real_position is
int max_width; // widest object seen so far
uchar has_scrollbar_; // which scrollbars are enabled
uchar textfont_, textsize_;
Fl_Font textfont_;
Fl_Font_Size textsize_;
unsigned textcolor_;
void* top_; // which item scrolling position is in
void* selection_; // which is selected (except for FL_MULTI_BROWSER)
@ -131,10 +132,10 @@ public:
BOTH_ALWAYS = 7
};
Fl_Font textfont() const {return (Fl_Font)textfont_;}
void textfont(uchar s) {textfont_ = s;}
uchar textsize() const {return textsize_;}
void textsize(uchar s) {textsize_ = s;}
Fl_Font textfont() const {return textfont_;}
void textfont(Fl_Font s) {textfont_ = s;}
Fl_Font_Size textsize() const {return textsize_;}
void textsize(Fl_Font_Size s) {textsize_ = s;}
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
void textcolor(unsigned n) {textcolor_ = n;}

View File

@ -59,7 +59,8 @@ class FL_EXPORT Fl_Chart : public Fl_Widget {
FL_CHART_ENTRY *entries;
double min,max;
uchar autosize_;
uchar textfont_,textsize_;
Fl_Font textfont_;
Fl_Font_Size textsize_;
unsigned textcolor_;
protected:
void draw();
@ -76,10 +77,10 @@ public:
void size(int W, int H) { Fl_Widget::size(W, H); }
int maxsize() const {return maxnumb;}
void maxsize(int);
Fl_Font textfont() const {return (Fl_Font)textfont_;}
void textfont(uchar s) {textfont_ = s;}
uchar textsize() const {return textsize_;}
void textsize(uchar s) {textsize_ = s;}
Fl_Font textfont() const {return textfont_;}
void textfont(Fl_Font s) {textfont_ = s;}
Fl_Font_Size textsize() const {return textsize_;}
void textsize(Fl_Font_Size s) {textsize_ = s;}
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
void textcolor(unsigned n) {textcolor_ = n;}
uchar autosize() const {return autosize_;}

View File

@ -40,7 +40,8 @@
class FL_EXPORT Fl_Counter : public Fl_Valuator {
uchar textfont_, textsize_;
Fl_Font textfont_;
Fl_Font_Size textsize_;
unsigned textcolor_;
double lstep_;
uchar mouseobj;
@ -60,10 +61,10 @@ public:
void lstep(double a) {lstep_ = a;}
void step(double a,double b) {Fl_Valuator::step(a); lstep_ = b;}
void step(double a) {Fl_Valuator::step(a);}
Fl_Font textfont() const {return (Fl_Font)textfont_;}
void textfont(uchar s) {textfont_ = s;}
uchar textsize() const {return textsize_;}
void textsize(uchar s) {textsize_ = s;}
Fl_Font textfont() const {return textfont_;}
void textfont(Fl_Font s) {textfont_ = s;}
Fl_Font_Size textsize() const {return textsize_;}
void textsize(Fl_Font_Size s) {textsize_ = s;}
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
void textcolor(unsigned s) {textcolor_ = s;}

View File

@ -67,8 +67,8 @@ public:
int load(const char *directory, Fl_File_Sort_F *sort = fl_numericsort);
uchar textsize() const { return (Fl_Browser::textsize()); };
void textsize(uchar s) { Fl_Browser::textsize(s); iconsize_ = (uchar)(3 * s / 2); };
Fl_Font_Size textsize() const { return Fl_Browser::textsize(); };
void textsize(Fl_Font_Size s) { Fl_Browser::textsize(s); iconsize_ = (uchar)(3 * s / 2); };
int filetype() const { return (filetype_); };
void filetype(int t) { filetype_ = t; };

View File

@ -150,10 +150,10 @@ public:
int shown();
void textcolor(Fl_Color c);
Fl_Color textcolor();
void textfont(uchar f);
uchar textfont();
void textsize(uchar s);
uchar textsize();
void textfont(Fl_Font f);
Fl_Font textfont();
void textsize(Fl_Font_Size s);
Fl_Font_Size textsize();
void type(int t);
int type();
void * user_data() const;

View File

@ -74,8 +74,8 @@ public:
void resize(int xx, int yy, int ww, int hh);
void show();
void show(int argc, char **argv);
void textsize(uchar s);
uchar textsize();
void textsize(Fl_Font_Size s);
Fl_Font_Size textsize();
void topline(const char *n);
void topline(int n);
void value(const char *f);

View File

@ -103,8 +103,8 @@ class FL_EXPORT Fl_Help_View : public Fl_Group //// Help viewer widget
bgcolor_, // Background color
textcolor_, // Text color
linkcolor_; // Link color
uchar textfont_, // Default font for text
textsize_; // Default font size
Fl_Font textfont_; // Default font for text
Fl_Font_Size textsize_; // Default font size
const char *value_; // HTML text value
int nblocks_, // Number of blocks/paragraphs
@ -112,7 +112,8 @@ class FL_EXPORT Fl_Help_View : public Fl_Group //// Help viewer widget
Fl_Help_Block *blocks_; // Blocks
int nfonts_; // Number of fonts in stack
uchar fonts_[100][2]; // Font stack
Fl_Font fonts_[100]; // Font stack
Fl_Font_Size font_sizes_[100]; // Font Size stack
Fl_Help_Func *link_; // Link transform function
@ -164,15 +165,15 @@ class FL_EXPORT Fl_Help_View : public Fl_Group //// Help viewer widget
int get_length(const char *l);
int handle(int);
void initfont(uchar &f, uchar &s) { nfonts_ = 0;
fl_font(f = fonts_[0][0] = textfont_,
s = fonts_[0][1] = textsize_); }
void pushfont(uchar f, uchar s) { if (nfonts_ < 99) nfonts_ ++;
fl_font(fonts_[nfonts_][0] = f,
fonts_[nfonts_][1] = s); }
void popfont(uchar &f, uchar &s) { if (nfonts_ > 0) nfonts_ --;
fl_font(f = fonts_[nfonts_][0],
s = fonts_[nfonts_][1]); }
void initfont(Fl_Font &f, Fl_Font_Size &s) { nfonts_ = 0;
fl_font(f = fonts_[0] = textfont_,
s = font_sizes_[0] = textsize_); }
void pushfont(Fl_Font f, Fl_Font_Size s) { if (nfonts_ < 99) nfonts_ ++;
fl_font(fonts_[nfonts_] = f,
font_sizes_[nfonts_] = s); }
void popfont(Fl_Font &f, Fl_Font_Size &s) { if (nfonts_ > 0) nfonts_ --;
fl_font(f = fonts_[nfonts_],
s = font_sizes_[nfonts_]); }
void hv_draw(const char *t, int x, int y);
char begin_selection();
@ -198,10 +199,10 @@ public:
void size(int W, int H) { Fl_Widget::size(W, H); }
void textcolor(Fl_Color c) { if (textcolor_ == defcolor_) textcolor_ = c; defcolor_ = c; }
Fl_Color textcolor() const { return (defcolor_); }
void textfont(uchar f) { textfont_ = f; format(); }
uchar textfont() const { return (textfont_); }
void textsize(uchar s) { textsize_ = s; format(); }
uchar textsize() const { return (textsize_); }
void textfont(Fl_Font f) { textfont_ = f; format(); }
Fl_Font textfont() const { return (textfont_); }
void textsize(Fl_Font_Size s) { textsize_ = s; format(); }
Fl_Font_Size textsize() const { return (textsize_); }
const char *title() { return (title_); }
void topline(const char *n);
void topline(int);

View File

@ -61,8 +61,8 @@ class FL_EXPORT Fl_Input_ : public Fl_Widget {
int shortcut_;
uchar erase_cursor_only;
uchar textfont_;
uchar textsize_;
Fl_Font textfont_;
Fl_Font_Size textsize_;
unsigned textcolor_;
unsigned cursor_color_;
@ -123,10 +123,10 @@ public:
int shortcut() const {return shortcut_;}
void shortcut(int s) {shortcut_ = s;}
Fl_Font textfont() const {return (Fl_Font)textfont_;}
void textfont(uchar s) {textfont_ = s;}
uchar textsize() const {return textsize_;}
void textsize(uchar s) {textsize_ = s;}
Fl_Font textfont() const {return textfont_;}
void textfont(Fl_Font s) {textfont_ = s;}
Fl_Font_Size textsize() const {return textsize_;}
void textsize(Fl_Font_Size s) {textsize_ = s;}
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
void textcolor(unsigned n) {textcolor_ = n;}
Fl_Color cursor_color() const {return (Fl_Color)cursor_color_;}

View File

@ -166,16 +166,16 @@ public:
void textcolor(Fl_Color c) {
inp_->textcolor(c);
}
uchar textfont() const {
Fl_Font textfont() const {
return (inp_->textfont());
}
void textfont(uchar f) {
void textfont(Fl_Font f) {
inp_->textfont(f);
}
uchar textsize() const {
Fl_Font_Size textsize() const {
return (inp_->textsize());
}
void textsize(uchar s) {
void textsize(Fl_Font_Size s) {
inp_->textsize(s);
}
const char* value() const {

View File

@ -42,8 +42,8 @@ protected:
uchar alloc;
uchar down_box_;
uchar textfont_;
uchar textsize_;
Fl_Font textfont_;
Fl_Font_Size textsize_;
unsigned textcolor_;
public:
@ -80,10 +80,10 @@ public:
const char *text() const {return value_ ? value_->text : 0;}
const char *text(int i) const {return menu_[i].text;}
Fl_Font textfont() const {return (Fl_Font)textfont_;}
void textfont(uchar c) {textfont_=c;}
uchar textsize() const {return textsize_;}
void textsize(uchar c) {textsize_=c;}
Fl_Font textfont() const {return textfont_;}
void textfont(Fl_Font c) {textfont_=c;}
Fl_Font_Size textsize() const {return textsize_;}
void textsize(Fl_Font_Size c) {textsize_=c;}
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
void textcolor(unsigned c) {textcolor_=c;}

View File

@ -58,8 +58,8 @@ struct FL_EXPORT Fl_Menu_Item {
void *user_data_;
int flags;
uchar labeltype_;
uchar labelfont_;
uchar labelsize_;
Fl_Font labelfont_;
Fl_Font_Size labelsize_;
unsigned labelcolor_;
// advance N items, skipping submenus:
@ -77,10 +77,10 @@ struct FL_EXPORT Fl_Menu_Item {
void labeltype(Fl_Labeltype a) {labeltype_ = a;}
Fl_Color labelcolor() const {return (Fl_Color)labelcolor_;}
void labelcolor(unsigned a) {labelcolor_ = a;}
Fl_Font labelfont() const {return (Fl_Font)labelfont_;}
void labelfont(uchar a) {labelfont_ = a;}
uchar labelsize() const {return labelsize_;}
void labelsize(uchar a) {labelsize_ = a;}
Fl_Font labelfont() const {return labelfont_;}
void labelfont(Fl_Font a) {labelfont_ = a;}
Fl_Font_Size labelsize() const {return labelsize_;}
void labelsize(Fl_Font_Size a) {labelsize_ = a;}
Fl_Callback_p callback() const {return callback_;}
void callback(Fl_Callback* c, void* p) {callback_=c; user_data_=p;}
void callback(Fl_Callback* c) {callback_=c;}

View File

@ -192,16 +192,16 @@ class Fl_Spinner : public Fl_Group
void textcolor(Fl_Color c) {
input_.textcolor(c);
}
uchar textfont() const {
Fl_Font textfont() const {
return (input_.textfont());
}
void textfont(uchar f) {
void textfont(Fl_Font f) {
input_.textfont(f);
}
uchar textsize() const {
Fl_Font_Size textsize() const {
return (input_.textsize());
}
void textsize(uchar s) {
void textsize(Fl_Font_Size s) {
input_.textsize(s);
}
uchar type() const { return (input_.type()); }

View File

@ -122,10 +122,10 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
int shortcut() const {return shortcut_;}
void shortcut(int s) {shortcut_ = s;}
Fl_Font textfont() const {return (Fl_Font)textfont_;}
void textfont(uchar s) {textfont_ = s;}
uchar textsize() const {return textsize_;}
void textsize(uchar s) {textsize_ = s;}
Fl_Font textfont() const {return textfont_;}
void textfont(Fl_Font s) {textfont_ = s;}
Fl_Font_Size textsize() const {return textsize_;}
void textsize(Fl_Font_Size s) {textsize_ = s;}
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
void textcolor(unsigned n) {textcolor_ = n;}
@ -285,8 +285,8 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
int shortcut_;
uchar textfont_;
uchar textsize_;
Fl_Font textfont_;
Fl_Font_Size textsize_;
unsigned textcolor_;
// The following are not presently used from the original NEdit code,

View File

@ -46,10 +46,10 @@ public:
static Fl_Widget* current() {return widget_;}
static void current(Fl_Widget*);
static int font() { return font_; }
static int size() { return size_; }
static void font(int i) { font_ = i; }
static void size(int s) { size_ = s; }
static Fl_Font font() { return font_; }
static Fl_Font_Size size() { return size_; }
static void font(Fl_Font i) { font_ = i; }
static void size(Fl_Font_Size s) { size_ = s; }
static void color(unsigned c) { color_ = c; }
static Fl_Color color() { return (Fl_Color)color_; }
static void textcolor(unsigned c) { textcolor_ = c; }
@ -65,8 +65,8 @@ private:
static int enabled_;
static unsigned color_;
static unsigned textcolor_;
static int font_;
static int size_;
static Fl_Font font_;
static Fl_Font_Size size_;
static Fl_Widget* widget_;
};

View File

@ -51,9 +51,9 @@ public:
void shortcut(int s) {input.shortcut(s);}
Fl_Font textfont() const {return input.textfont();}
void textfont(uchar s) {input.textfont(s);}
uchar textsize() const {return input.textsize();}
void textsize(uchar s) {input.textsize(s);}
void textfont(Fl_Font s) {input.textfont(s);}
Fl_Font_Size textsize() const {return input.textsize();}
void textsize(Fl_Font_Size s) {input.textsize(s);}
Fl_Color textcolor() const {return input.textcolor();}
void textcolor(unsigned n) {input.textcolor(n);}
Fl_Color cursor_color() const {return input.cursor_color();}

View File

@ -33,7 +33,9 @@
#endif
class FL_EXPORT Fl_Value_Output : public Fl_Valuator {
uchar textfont_, textsize_, soft_;
Fl_Font textfont_;
Fl_Font_Size textsize_;
uchar soft_;
unsigned textcolor_;
public:
int handle(int);
@ -43,10 +45,10 @@ public:
void soft(uchar s) {soft_ = s;}
uchar soft() const {return soft_;}
Fl_Font textfont() const {return (Fl_Font)textfont_;}
void textfont(uchar s) {textfont_ = s;}
uchar textsize() const {return textsize_;}
void textsize(uchar s) {textsize_ = s;}
Fl_Font textfont() const {return textfont_;}
void textfont(Fl_Font s) {textfont_ = s;}
Fl_Font_Size textsize() const {return textsize_;}
void textsize(Fl_Font_Size s) {textsize_ = s;}
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
void textcolor(unsigned s) {textcolor_ = s;}
};

View File

@ -31,16 +31,17 @@
#include "Fl_Slider.H"
class FL_EXPORT Fl_Value_Slider : public Fl_Slider {
uchar textfont_, textsize_;
Fl_Font textfont_;
Fl_Font_Size textsize_;
unsigned textcolor_;
public:
void draw();
int handle(int);
Fl_Value_Slider(int x,int y,int w,int h, const char *l = 0);
Fl_Font textfont() const {return (Fl_Font)textfont_;}
void textfont(uchar s) {textfont_ = s;}
uchar textsize() const {return textsize_;}
void textsize(uchar s) {textsize_ = s;}
Fl_Font textfont() const {return textfont_;}
void textfont(Fl_Font s) {textfont_ = s;}
Fl_Font_Size textsize() const {return textsize_;}
void textsize(Fl_Font_Size s) {textsize_ = s;}
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
void textcolor(unsigned s) {textcolor_ = s;}
};

View File

@ -45,8 +45,8 @@ struct FL_EXPORT Fl_Label {
Fl_Image* image;
Fl_Image* deimage;
uchar type;
uchar font;
uchar size;
Fl_Font font;
Fl_Font_Size size;
unsigned color;
void draw(int,int,int,int, Fl_Align) const ;
void measure(int&, int&) const ;
@ -136,10 +136,10 @@ public:
void labeltype(Fl_Labeltype a) {label_.type = a;}
Fl_Color labelcolor() const {return (Fl_Color)label_.color;}
void labelcolor(unsigned a) {label_.color=a;}
Fl_Font labelfont() const {return (Fl_Font)label_.font;}
void labelfont(uchar a) {label_.font=a;}
uchar labelsize() const {return label_.size;}
void labelsize(uchar a) {label_.size=a;}
Fl_Font labelfont() const {return label_.font;}
void labelfont(Fl_Font a) {label_.font=a;}
Fl_Font_Size labelsize() const {return label_.size;}
void labelsize(Fl_Font_Size a) {label_.size=a;}
Fl_Image* image() {return label_.image;}
void image(Fl_Image* a) {label_.image=a;}
void image(Fl_Image& a) {label_.image=&a;}

View File

@ -63,9 +63,9 @@ FL_EXPORT const char *fl_password(const char *label, const char *deflt = 0, ...)
FL_EXPORT Fl_Widget *fl_message_icon();
extern FL_EXPORT Fl_Font fl_message_font_;
extern FL_EXPORT unsigned char fl_message_size_;
inline void fl_message_font(unsigned char f,unsigned char s) {
fl_message_font_ = (Fl_Font)f; fl_message_size_ = s;}
extern FL_EXPORT Fl_Font_Size fl_message_size_;
inline void fl_message_font(Fl_Font f, Fl_Font_Size s) {
fl_message_font_ = f; fl_message_size_ = s;}
// pointers you can use to change FLTK to a foreign language:
extern FL_EXPORT const char* fl_no;

View File

@ -136,11 +136,11 @@ FL_EXPORT double fl_transform_dy(double x, double y);
FL_EXPORT void fl_transformed_vertex(double x, double y);
// current font:
FL_EXPORT void fl_font(int face, int size);
extern FL_EXPORT int fl_font_;
inline int fl_font() {return fl_font_;}
extern FL_EXPORT int fl_size_;
inline int fl_size() {return fl_size_;}
FL_EXPORT void fl_font(Fl_Font face, Fl_Font_Size size);
extern FL_EXPORT Fl_Font fl_font_;
inline Fl_Font fl_font() {return fl_font_;}
extern FL_EXPORT Fl_Font_Size fl_size_;
inline Fl_Font_Size fl_size() {return fl_size_;}
// information you can get about the current font:
FL_EXPORT int fl_height(); // using "size" should work ok

View File

@ -209,7 +209,7 @@ inline void fl_reset_focus_object(Fl_Widget* o) {Fl::focus(o);}
inline void fl_set_object_boxtype(Fl_Widget* o, Fl_Boxtype a) {o->box(a);}
inline void fl_set_object_lsize(Fl_Widget* o,int s) {o->labelsize(s);}
inline void fl_set_object_lstyle(Fl_Widget* o,int a) {
o->labelfont((uchar)a); o->labeltype((Fl_Labeltype)(a>>8));}
o->labelfont((Fl_Font)a); o->labeltype((Fl_Labeltype)(a>>8));}
inline void fl_set_object_lcol(Fl_Widget* o, unsigned a) {o->labelcolor(a);}
#define fl_set_object_lcolor fl_set_object_lcol
inline void fl_set_object_lalign(Fl_Widget* o, Fl_Align a) {o->align(a);}

View File

@ -521,7 +521,7 @@ void widget_size_cb(Fl_Widget *, long size) {
}
Fl_Widget *w = ((Fl_Widget_Type *)o)->o;
w->labelsize((uchar)size);
w->labelsize((Fl_Font)size);
Fl_Font f;
int s = (int)size;
Fl_Color c;

View File

@ -803,7 +803,7 @@ Fl_Browser_::Fl_Browser_(int X, int Y, int W, int H, const char* l)
hscrollbar.callback(hscrollbar_callback);
hscrollbar.type(FL_HORIZONTAL);
textfont_ = FL_HELVETICA;
textsize_ = (uchar)FL_NORMAL_SIZE;
textsize_ = FL_NORMAL_SIZE;
textcolor_ = FL_FOREGROUND_COLOR;
has_scrollbar_ = BOTH;
max_width = 0;

View File

@ -91,7 +91,7 @@ void Fl_Choice::draw() {
l.image = 0;
l.deimage = 0;
l.type = m.labeltype_;
l.font = m.labelsize_ || m.labelfont_ ? m.labelfont_ : uchar(textfont());
l.font = m.labelsize_ || m.labelfont_ ? m.labelfont_ : textfont();
l.size = m.labelsize_ ? m.labelsize_ : textsize();
l.color= m.labelcolor_ ? m.labelcolor_ : textcolor();
if (!m.active()) l.color = fl_inactive((Fl_Color)l.color);

View File

@ -188,7 +188,7 @@ Fl_Counter::Fl_Counter(int X, int Y, int W, int H, const char* l)
lstep_ = 1.0;
mouseobj = 0;
textfont_ = FL_HELVETICA;
textsize_ = (uchar)FL_NORMAL_SIZE;
textsize_ = FL_NORMAL_SIZE;
textcolor_ = FL_FOREGROUND_COLOR;
}

View File

@ -391,19 +391,19 @@ Fl_Color Fl_File_Chooser::textcolor() {
return (fileList->textcolor());
}
void Fl_File_Chooser::textfont(uchar f) {
void Fl_File_Chooser::textfont(Fl_Font f) {
fileList->textfont(f);
}
uchar Fl_File_Chooser::textfont() {
Fl_Font Fl_File_Chooser::textfont() {
return (fileList->textfont());
}
void Fl_File_Chooser::textsize(uchar s) {
void Fl_File_Chooser::textsize(Fl_Font_Size s) {
fileList->textsize(s);
}
uchar Fl_File_Chooser::textsize() {
Fl_Font_Size Fl_File_Chooser::textsize() {
return (fileList->textsize());
}

View File

@ -1067,7 +1067,7 @@ Fl_File_Chooser::update_preview()
previewBox->label(preview_text_);
previewBox->align((Fl_Align)(FL_ALIGN_CLIP | FL_ALIGN_INSIDE |
FL_ALIGN_LEFT | FL_ALIGN_TOP));
previewBox->labelsize((uchar)size);
previewBox->labelsize(size);
previewBox->labelfont(FL_COURIER);
}
} else {

View File

@ -51,15 +51,15 @@ public:
HFONT fid;
int width[256];
TEXTMETRIC metr;
FL_EXPORT Fl_FontSize(const char* fontname, int size);
FL_EXPORT Fl_FontSize(const char* fontname, Fl_Font_Size size);
# elif defined(__APPLE_QD__)
FL_EXPORT Fl_FontSize(const char* fontname, int size);
FL_EXPORT Fl_FontSize(const char* fontname, Fl_Font_Size size);
short font, face, size;
short ascent, descent;
short width[256];
bool knowMetrics;
# elif defined(__APPLE_QUARTZ__)
FL_EXPORT Fl_FontSize(const char* fontname, int size);
FL_EXPORT Fl_FontSize(const char* fontname, Fl_Font_Size size);
ATSUTextLayout layout;
ATSUStyle style;
short ascent, descent, q_width;

View File

@ -244,7 +244,7 @@ void Fl_Help_Dialog::show(int argc, char **argv) {
window_->show(argc, argv);
}
void Fl_Help_Dialog::textsize(uchar s) {
void Fl_Help_Dialog::textsize(Fl_Font_Size s) {
view_->textsize(s);
if (s <= 8)
@ -258,7 +258,7 @@ else
larger_->activate();
}
uchar Fl_Help_Dialog::textsize() {
Fl_Font_Size Fl_Help_Dialog::textsize() {
return (view_->textsize());
}

View File

@ -204,7 +204,7 @@ window_->label(view_->title());} {}
} {
code {window_->show(argc, argv);} {}
}
Function {textsize(uchar s)} {return_type void
Function {textsize(Fl_Font_Size s)} {return_type void
} {
code {view_->textsize(s);
@ -218,7 +218,7 @@ if (s >= 18)
else
larger_->activate();} {}
}
Function {textsize()} {return_type uchar
Function {textsize()} {return_type Fl_Font_Size
} {
code {return (view_->textsize());} {}
}

View File

@ -465,7 +465,8 @@ Fl_Help_View::draw()
attr[1024]; // Attribute buffer
int xx, yy, ww, hh; // Current positions and sizes
int line; // Current line
unsigned char font, fsize; // Current font and size
Fl_Font font;
Fl_Font_Size fsize; // Current font and size
int head, pre, // Flags for text
needspace; // Do we need whitespace?
Fl_Boxtype b = box() ? box() : FL_DOWN_BOX;
@ -700,11 +701,11 @@ Fl_Help_View::draw()
if (tolower(buf[0]) == 'h')
{
font = FL_HELVETICA_BOLD;
fsize = (uchar)(textsize_ + '7' - buf[1]);
fsize = textsize_ + '7' - buf[1];
}
else if (strcasecmp(buf, "DT") == 0)
{
font = (uchar)(textfont_ | FL_ITALIC);
font = textfont_ | FL_ITALIC;
fsize = textsize_;
}
else if (strcasecmp(buf, "PRE") == 0)
@ -1082,7 +1083,8 @@ Fl_Help_View::format()
int xx, yy, ww, hh; // Size of current text fragment
int line; // Current line in block
int links; // Links for current line
unsigned char font, fsize; // Current font and size
Fl_Font font;
Fl_Font_Size fsize; // Current font and size
unsigned char border; // Draw border?
int talign, // Current alignment
newalign, // New alignment
@ -1387,11 +1389,11 @@ Fl_Help_View::format()
if (tolower(buf[0]) == 'h' && isdigit(buf[1]))
{
font = FL_HELVETICA_BOLD;
fsize = (uchar)(textsize_ + '7' - buf[1]);
fsize = textsize_ + '7' - buf[1];
}
else if (strcasecmp(buf, "DT") == 0)
{
font = (uchar)(textfont_ | FL_ITALIC);
font = textfont_ | FL_ITALIC;
fsize = textsize_;
}
else if (strcasecmp(buf, "PRE") == 0)
@ -1575,7 +1577,7 @@ Fl_Help_View::format()
block->h += hh;
if (strcasecmp(buf, "TH") == 0)
font = (uchar)(textfont_ | FL_BOLD);
font = textfont_ | FL_BOLD;
else
font = textfont_;
@ -1894,7 +1896,8 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
*attrs, // Pointer to attributes
*start; // Start of element
int minwidths[MAX_COLUMNS]; // Minimum widths for each column
unsigned char font, fsize; // Current font and size
Fl_Font font;
Fl_Font_Size fsize; // Current font and size
// Clear widths...
@ -1910,8 +1913,8 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
max_width = 0;
pre = 0;
needspace = 0;
font = fonts_[nfonts_][0];
fsize = fonts_[nfonts_][1];
font = fonts_[nfonts_];
fsize = font_sizes_[nfonts_];
// Scan the table...
for (ptr = table, column = -1, width = 0, s = buf, incell = 0; *ptr;)
@ -1988,11 +1991,11 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
if (tolower(buf[0]) == 'h' && isdigit(buf[1]))
{
font = FL_HELVETICA_BOLD;
fsize = (uchar)(textsize_ + '7' - buf[1]);
fsize = textsize_ + '7' - buf[1];
}
else if (strcasecmp(buf, "DT") == 0)
{
font = (uchar)(textfont_ | FL_ITALIC);
font = textfont_ | FL_ITALIC;
fsize = textsize_;
}
else if (strcasecmp(buf, "PRE") == 0)
@ -2102,7 +2105,7 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
incell = 1;
if (strcasecmp(buf, "TH") == 0)
font = (uchar)(textfont_ | FL_BOLD);
font = textfont_ | FL_BOLD;
else
font = textfont_;

View File

@ -807,7 +807,7 @@ Fl_Input_::Fl_Input_(int X, int Y, int W, int H, const char* l)
box(FL_DOWN_BOX);
color(FL_BACKGROUND2_COLOR, FL_SELECTION_COLOR);
align(FL_ALIGN_LEFT);
textsize_ = (uchar)FL_NORMAL_SIZE;
textsize_ = FL_NORMAL_SIZE;
textfont_ = FL_HELVETICA;
textcolor_ = FL_FOREGROUND_COLOR;
cursor_color_ = FL_FOREGROUND_COLOR; // was FL_BLUE

View File

@ -125,8 +125,8 @@ int Fl_Menu_Item::measure(int* hp, const Fl_Menu_* m) const {
l.image = 0;
l.deimage = 0;
l.type = labeltype_;
l.font = labelsize_ || labelfont_ ? labelfont_ : uchar(m ? m->textfont() : FL_HELVETICA);
l.size = labelsize_ ? labelsize_ : m ? m->textsize() : (uchar)FL_NORMAL_SIZE;
l.font = labelsize_ || labelfont_ ? labelfont_ : (m ? m->textfont() : FL_HELVETICA);
l.size = labelsize_ ? labelsize_ : m ? m->textsize() : FL_NORMAL_SIZE;
l.color = FL_FOREGROUND_COLOR; // this makes no difference?
fl_draw_shortcut = 1;
int w = 0; int h = 0;
@ -143,8 +143,8 @@ void Fl_Menu_Item::draw(int x, int y, int w, int h, const Fl_Menu_* m,
l.image = 0;
l.deimage = 0;
l.type = labeltype_;
l.font = labelsize_ || labelfont_ ? labelfont_ : uchar(m ? m->textfont() : FL_HELVETICA);
l.size = labelsize_ ? labelsize_ : m ? m->textsize() : (uchar)FL_NORMAL_SIZE;
l.font = labelsize_ || labelfont_ ? labelfont_ : (m ? m->textfont() : FL_HELVETICA);
l.size = labelsize_ ? labelsize_ : m ? m->textsize() : FL_NORMAL_SIZE;
l.color = labelcolor_ ? labelcolor_ : m ? m->textcolor() : int(FL_FOREGROUND_COLOR);
if (!active()) l.color = fl_inactive((Fl_Color)l.color);
Fl_Color color = m ? m->color() : FL_GRAY;

View File

@ -175,7 +175,7 @@ Fl_Menu_::Fl_Menu_(int X,int Y,int W,int H,const char* l)
alloc = 0;
selection_color(FL_SELECTION_COLOR);
textfont(FL_HELVETICA);
textsize((uchar)FL_NORMAL_SIZE);
textsize(FL_NORMAL_SIZE);
textcolor(FL_FOREGROUND_COLOR);
down_box(FL_NO_BOX);
}

View File

@ -38,7 +38,7 @@ void Fl_Menu_Button::draw() {
draw_label();
if (Fl::focus() == this) draw_focus();
if (box() == FL_FLAT_BOX) return; // for XForms compatability
int H = (labelsize()-3)&-2;
int H = (int(labelsize()-3))&-2;
int X = x()+w()-H*2;
int Y = y()+(h()-H)/2;
fl_color(active_r() ? FL_DARK3 : fl_inactive(FL_DARK3));

View File

@ -89,7 +89,7 @@ Fl_Text_Display::Fl_Text_Display(int X, int Y, int W, int H, const char* l)
color(FL_BACKGROUND2_COLOR, FL_SELECTION_COLOR);
box(FL_DOWN_FRAME);
textsize((uchar)FL_NORMAL_SIZE);
textsize(FL_NORMAL_SIZE);
textcolor(FL_FOREGROUND_COLOR);
textfont(FL_HELVETICA);
set_flag(SHORTCUT_LABEL);

View File

@ -38,8 +38,8 @@ unsigned Fl_Tooltip::color_ = fl_color_cube(FL_NUM_RED - 1,
FL_NUM_GREEN - 1,
FL_NUM_BLUE - 2);
unsigned Fl_Tooltip::textcolor_ = FL_BLACK;
int Fl_Tooltip::font_ = FL_HELVETICA;
int Fl_Tooltip::size_ = FL_NORMAL_SIZE;
Fl_Font Fl_Tooltip::font_ = FL_HELVETICA;
Fl_Font_Size Fl_Tooltip::size_ = FL_NORMAL_SIZE;
#define MAX_WIDTH 400

View File

@ -93,7 +93,7 @@ Fl_Value_Output::Fl_Value_Output(int X, int Y, int W, int H,const char *l)
box(FL_NO_BOX);
align(FL_ALIGN_LEFT);
textfont_ = FL_HELVETICA;
textsize_ = (uchar)FL_NORMAL_SIZE;
textsize_ = FL_NORMAL_SIZE;
textcolor_ = FL_FOREGROUND_COLOR;
soft_ = 0;
}

View File

@ -76,7 +76,7 @@ int Fl_Widget::handle(int) {
return 0;
}
int FL_NORMAL_SIZE = 14;
Fl_Font_Size FL_NORMAL_SIZE = 14;
Fl_Widget::Fl_Widget(int X, int Y, int W, int H, const char* L) {
@ -87,7 +87,7 @@ Fl_Widget::Fl_Widget(int X, int Y, int W, int H, const char* L) {
label_.deimage = 0;
label_.type = FL_NORMAL_LABEL;
label_.font = FL_HELVETICA;
label_.size = (uchar)FL_NORMAL_SIZE;
label_.size = FL_NORMAL_SIZE;
label_.color = FL_FOREGROUND_COLOR;
tooltip_ = 0;
callback_ = default_callback;

View File

@ -150,6 +150,7 @@ void Fl_Window::copy_label(const char *a) {
void Fl_Window::iconlabel(const char *iname) {
// FIXME: 'flags' is 32 bit large!
uchar saveflags = flags();
label(label(), iname);
set_flag(saveflags);

View File

@ -54,7 +54,7 @@ static Fl_Button *button[3];
static Fl_Input *input;
static const char *iconlabel = "?";
Fl_Font fl_message_font_ = FL_HELVETICA;
uchar fl_message_size_ = 14;
Fl_Font_Size fl_message_size_ = 14;
static Fl_Window *makeform() {
if (message_form) {
@ -156,7 +156,7 @@ void resizeform() {
message->resize(20 + icon_size, 10, message_w, message_h);
icon->resize(10, 10, icon_size, icon_size);
icon->labelsize((uchar)(icon_size - 10));
icon->labelsize(icon_size - 10);
input->resize(20 + icon_size, 10 + message_h, message_w, 25);
for (x = w, i = 0; i < 3; i ++)

View File

@ -27,7 +27,7 @@
#include <config.h>
Fl_FontSize::Fl_FontSize(const char* name, int Size) {
Fl_FontSize::Fl_FontSize(const char* name, Fl_Font_Size Size) {
next = 0;
# if HAVE_GL
listbase = 0;
@ -83,7 +83,7 @@ Fl_FontSize::Fl_FontSize(const char* name, int Size) {
// now set the actual font, size and attributes. We also set the font matrix to
// render our font up-side-down, so when rendered through our inverted CGContext,
// text will appear normal again.
Fixed fsize = IntToFixed(Size);
Fixed fsize = FloatToFixed(Size);
ATSUFontID fontID = FMGetFontFromATSFontRef(font);
static CGAffineTransform font_mx = { 1, 0, 0, -1, 0, 0 };
ATSUAttributeTag sTag[] = { kATSUFontTag, kATSUSizeTag, kATSUFontMatrixTag };
@ -245,7 +245,7 @@ void fl_font(Fl_FontSize* s) {
#endif
}
static Fl_FontSize* find(int fnum, int size) {
static Fl_FontSize* find(Fl_Font fnum, Fl_Font_Size size) {
Fl_Fontdesc* s = fl_fonts+fnum;
if (!s->name) s = fl_fonts; // use 0 if fnum undefined
Fl_FontSize* f;
@ -260,10 +260,10 @@ static Fl_FontSize* find(int fnum, int size) {
////////////////////////////////////////////////////////////////
// Public interface:
int fl_font_ = 0;
int fl_size_ = 0;
Fl_Font fl_font_ = 0;
Fl_Font_Size fl_size_ = 0;
void fl_font(int fnum, int size) {
void fl_font(Fl_Font fnum, Fl_Font_Size size) {
if (fnum==-1) {
fl_font_ = 0;
fl_size_ = 0;

View File

@ -25,7 +25,7 @@
// http://www.fltk.org/str.php
//
Fl_FontSize::Fl_FontSize(const char* name, int size) {
Fl_FontSize::Fl_FontSize(const char* name, Fl_Font_Size size) {
int weight = FW_NORMAL;
int italic = 0;
switch (*name++) {
@ -106,7 +106,7 @@ static Fl_Fontdesc built_in_table[] = {
Fl_Fontdesc* fl_fonts = built_in_table;
static Fl_FontSize* find(int fnum, int size) {
static Fl_FontSize* find(Fl_Font fnum, Fl_Font_Size size) {
Fl_Fontdesc* s = fl_fonts+fnum;
if (!s->name) s = fl_fonts; // use 0 if fnum undefined
Fl_FontSize* f;
@ -121,11 +121,11 @@ static Fl_FontSize* find(int fnum, int size) {
////////////////////////////////////////////////////////////////
// Public interface:
int fl_font_ = 0;
int fl_size_ = 0;
Fl_Font fl_font_ = 0;
Fl_Font_Size fl_size_ = 0;
//static HDC font_gc;
void fl_font(int fnum, int size) {
void fl_font(Fl_Font fnum, Fl_Font_Size size) {
if (fnum==-1) { // just make sure that we will load a new font next time
fl_font_ = 0; fl_size_ = 0;
return;

View File

@ -113,7 +113,7 @@ int fl_correct_encoding(const char* name) {
}
// locate or create an Fl_FontSize for a given Fl_Fontdesc and size:
static Fl_FontSize* find(int fnum, int size) {
static Fl_FontSize* find(Fl_Font fnum, Fl_Font_Size size) {
Fl_Fontdesc* s = fl_fonts+fnum;
if (!s->name) s = fl_fonts; // use font 0 if still undefined
Fl_FontSize* f;
@ -193,13 +193,13 @@ static Fl_FontSize* find(int fnum, int size) {
////////////////////////////////////////////////////////////////
// Public interface:
int fl_font_ = 0;
int fl_size_ = 0;
Fl_Font fl_font_ = 0;
Fl_Font_Size fl_size_ = 0;
XFontStruct* fl_xfont = 0;
void *fl_xftfont = 0;
static GC font_gc;
void fl_font(int fnum, int size) {
void fl_font(Fl_Font fnum, Fl_Font_Size size) {
if (fnum==-1) {
fl_font_ = 0; fl_size_ = 0;
return;

View File

@ -88,14 +88,14 @@ Fl_Fontdesc* fl_fonts = built_in_table;
#define current_font (fl_fontsize->font)
int fl_font_ = 0;
int fl_size_ = 0;
Fl_Font fl_font_ = 0;
Fl_Font_Size fl_size_ = 0;
XFontStruct* fl_xfont = 0;
void *fl_xftfont = 0;
const char* fl_encoding_ = "iso8859-1";
Fl_FontSize* fl_fontsize = 0;
void fl_font(int fnum, int size) {
void fl_font(Fl_Font fnum, Fl_Font_Size size) {
if (fnum==-1) { // special case to stop font caching
fl_font_ = 0; fl_size_ = 0;
return;