Re: [fltk.general] default fonts
On 14 Oct 2011, at 22:54, David wrote: > Doesn't look like there is a way to set a global default font, size, etc. Actually, there is a global font setting, it is set to size 14 in Fl_Widget.cxx , but is in global scope so can be over ridden at runtime... Do something like... extern Fl_Fontsize FL_NORMAL_SIZE; : : FL_NORMAL_SIZE = And yes, FL_NORMAL_SIZE does not look like a variable name, but actually it is... Similarly, all widgets are assigned the face FL_HELVETICA by default, but you can, if you so wish, simply change the font that is associated with that name, before you create your widgets, and they will "acquire" the desired face. Or you can explicitly set the size/face per widget, of course, if you want to go that way. > If that's true, I can change that so that either Fl or Fl_Widget has some > static variables holding app wide defaults and use those in Fl_Widgets > constructor. Otherwise, every time someone needs a different font type/style > than the default (which I have a need for), every single widget has to have > it set(lots of extra unneeded code). What is it that you are trying to do? You've posted a fair number of queries and suggestions recently, many proposing changes that appear to be "already solved" in other ways, so I'm wondering what it is that you are trying to achieve that requires so much change? ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] default fonts
On 10/14/11 14:54, David wrote: > Doesn't look like there is a way to set a global default font, size, etc. I think you can set the default font size with this rather odd looking code that looks like it's setting a macro: int main() { FL_NORMAL_SIZE = 20; ..create widgets.. Not sure about the font though -- I think that's a hard default to FL_HELVETICA, and I think the only way to change it is to set it on a per widget basis. ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] default fonts
> > On 14 Oct 2011, at 22:54, David wrote: > > > Doesn't look like there is a way to set a global default font, size, = > etc. =20 > > > Actually, there is a global font setting, it is set to size 14 in = > Fl_Widget.cxx , but is in global scope so can be over ridden at = > runtime... > > Do something like... > > extern Fl_Fontsize FL_NORMAL_SIZE; > > : > : > =09 > FL_NORMAL_SIZE =3D > > > > And yes, FL_NORMAL_SIZE does not look like a variable name, but actually = > it is...=20 > > Similarly, all widgets are assigned the face FL_HELVETICA by default, = > but you can, if you so wish, simply change the font that is associated = > with that name, before you create your widgets, and they will "acquire" = > the desired face.=20 > > Or you can explicitly set the size/face per widget, of course, if you = > want to go that way. > > > > If that's true, I can change that so that either Fl or Fl_Widget has = > some static variables holding app wide defaults and use those in = > Fl_Widgets constructor. Otherwise, every time someone needs a different = > font type/style than the default (which I have a need for), every single = > widget has to have it set(lots of extra unneeded code). > > > What is it that you are trying to do? You've posted a fair number of = > queries and suggestions recently, many proposing changes that appear to = > be "already solved" in other ways, so I'm wondering what it is that you = > are trying to achieve that requires so much change? > > Okay, I see that's actually a variable and not a #define, ALL_CAPS threw me, so that takes care of that. What I'm after is to reduce duplication and ease use of the frame work by apps while having widgets function in an intuitive way. The changes I made fixed the way check list boxes work (or browsers for fltk) and supported all existing features of the list boxes. It also fixed the input widgets to handle limiting input with a simple paramter setting (part was already there but needed to be expanded to other controls and fix so users setting values are also limited and combo boxes selections from being too long). ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] default fonts
On 15 Oct 2011, at 04:44, David wrote: > Okay, I see that's actually a variable and not a #define, ALL_CAPS threw me, > so that takes care of that. Yup - throws me too, every time. And I assume everyone else... I guess it is historical - maybe it really was a define once upon a time. I think it would be easy enough to make it lowercase now, but keep an uppercase #define around that referred to the "new" lowercase name for backwards compatability. Or something... Though just having that floating around in global scope seems a little untidy - maybe a method could be added to FL (or maybe to Fl_Widget?) to set the "global" size in a more managed way. > What I'm after is to reduce duplication and ease use of the frame work by > apps while having widgets function in an intuitive way. The changes I made > fixed the way check list boxes work (or browsers for fltk) and supported all > existing features of the list boxes. OK > It also fixed the input widgets to handle limiting input with a simple > paramter setting (part was already there but needed to be expanded to other > controls and fix so users setting values are also limited and combo boxes > selections from being too long). Hmm, yes, But I think the way it is at present is (more or less) by design - it is intended that users set their own widget handling explicitly. And if you need to make a lot of widgets that all have the same handling, it is trivial to make a subclass that does that. ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] default fonts
On 10/15/11 08:19, Ian MacArthur wrote: > > On 15 Oct 2011, at 04:44, David wrote: >> I see that's actually a variable and not a #define, ALL_CAPS threw me > > Yup - throws me too, every time. And I assume everyone else... > I guess it is historical - maybe it really was a define once upon a time. We should provide a better way. eg. Fl::default_font() and Fl::default_fontsize() and change the hardcoded FL_HELVETICA in Fl_Widget. ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] default fonts
On 15 Oct 2011, at 17:32, Greg Ercolano wrote: > On 10/15/11 08:19, Ian MacArthur wrote: >> >> On 15 Oct 2011, at 04:44, David wrote: >>> I see that's actually a variable and not a #define, ALL_CAPS threw me >> >> Yup - throws me too, every time. And I assume everyone else... >> I guess it is historical - maybe it really was a define once upon a time. > > We should provide a better way. > eg. Fl::default_font() and Fl::default_fontsize() > and change the hardcoded FL_HELVETICA in Fl_Widget. Yup - that'll be one for fltk3. Will break some of my code, mind you! Meh! Backwards compatibility is over-rated anyway. Just ask Apple... ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] default fonts
On 10/15/11 09:37, Ian MacArthur wrote: > > On 15 Oct 2011, at 17:32, Greg Ercolano wrote: >> We should provide a better way. >> eg. Fl::default_font() and Fl::default_fontsize() >> and change the hardcoded FL_HELVETICA in Fl_Widget. > > Yup - that'll be one for fltk3. > > Will break some of my code, mind you! > > Meh! Backwards compatibility is over-rated anyway. Just ask Apple... Actually, I don't think it'd have to break anything. Leave the old global variable in place and create methods to access it the 'new' way so that it can be documented. If there's any docs for the old technique, mark it deprecated in favor of the new methods. It's a win-win! Could be 1.3.x I think. ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] default fonts
> > > It also fixed the input widgets to handle limiting input with a = > simple paramter setting (part was already there but needed to be = > expanded to other controls and fix so users setting values are also = > limited and combo boxes selections from being too long). > > Hmm, yes, But I think the way it is at present is (more or less) by = > design - it is intended that users set their own widget handling = > explicitly. > And if you need to make a lot of widgets that all have the same = > handling, it is trivial to make a subclass that does that. > Not that easy when new to a framework. Saying, let the max input size be 32 (and it's always that, for keyboard input or setting a value, or in the combo box even if the list box item is too large) is much easier than having to study how to write a handler. The amount of code was so small and offers a common desired result that I would argue that it should be added. ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] default fonts
> On 10/15/11 09:37, Ian MacArthur wrote: > > > > On 15 Oct 2011, at 17:32, Greg Ercolano wrote: > >>We should provide a better way. > >>eg. Fl::default_font() and Fl::default_fontsize() > >>and change the hardcoded FL_HELVETICA in Fl_Widget. > > > > Yup - that'll be one for fltk3. > > > > Will break some of my code, mind you! > > > > Meh! Backwards compatibility is over-rated anyway. Just ask Apple... > > Actually, I don't think it'd have to break anything. > > Leave the old global variable in place and create methods > to access it the 'new' way so that it can be documented. > > If there's any docs for the old technique, mark it deprecated > in favor of the new methods. > > It's a win-win! Could be 1.3.x I think. I want to also add an application level global flag for the framework settings in general. I'd put it in Fl, but haven't looked if it already has one, if it didn't, add it, if it did, just add the new flag that I think would be very useful, a setting that says to always copy labels. This would add hardly any code size to the frame work (just a change in Fl_Widget). ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk