Re: [fltk.development] FLTK '@' symbols question

2013-03-25 Thread Greg Ercolano
 Question:
  I want to verify that '@' symbols in labels (eg. @-) are only
  allowed at either *the very beginning* or *very end* of a string,
  or at both ends, and nothing else (ie. not in the middle of a
  string, or mixed into multiple lines).

   Another interesting thing about symbols I didn't know about
   @ symbols in labels, and I don't think is documented:

   The more lines in the string, the larger the symbol will be;
   the symbol is scaled to the size of all lines, and centered.

   Here comes some examples that use ascii art (view in a
   fixed width font!)

   If the label string is:

   @ Aaa\nBbb @

   You'll get:

   /| Aaa |\
   \| Bbb |/

   ..and if the string has more lines, e.g.

   @ Aaa\nBbb\nCcc\nDdd @

   ..then you'll get larger arrow symbols matching the height of all
   the lines:

/|   Aaa   |\
   / |   Bbb   | \
   \ |   Ccc   | /
\|   Ddd   |/

   ..instead of what I was *expecting*, which would have been:

  | Aaa
 Bbb
 Ccc
 Ddd |


   This behavior of symbols automatically centering + scaling
   should really be documented too.

   I had no idea symbols worked this way until I looked closely
   at the side effects of fl_measure's code.

___
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev


Re: [fltk.development] FLTK '@' symbols question

2013-03-25 Thread MacArthur, Ian (Selex ES, UK)

 I'm working on fixing STR #2772 (removing extraneous code in
 fl_measure()) and need to understand in detail how we support '@'
 symbols in FLTK.


Eek! That seems brave! (To me, at least!)




Selex ES Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England  Wales.  Company no. 02426132

This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.


___
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev


Re: [fltk.development] FLTK '@' symbols question

2013-03-25 Thread Roman Kantor
Somewhat related, it would be nice if fl_add_symbol() would accept not only 
drawing functions but also images, even without additional scaling and 
rotations.
In the symbol table there is an int flag field (at the moment this flag is 
used only with values 0/1 to indicate scalable and non-scalable symbols), other
value could indicate that the pointer in the internal table is an image (or 
other object), not the function and have to be interpreted differently. This 
can be
done by overloading fl_add_symbol() which would set appropriate flag.

The reason for that is that it would simplify drawing icons for instance in 
menus. At the moment I am doing this by wrapping icon-drawing in symbol-like
wrapping functions (using some templates to automate instantiation of wrapping 
functions). The problem with it is that for each image/icon you need to 
implement
separate function wrapper. Having overloaded fl_add_symbol(const char * name, 
Fl_Image *, ...) could simplify that and allow drawing image as symbol in any
label just by adding it to the table and using @ convention within labels. To 
have the symbol API more comprehensive (and for istance remove destructed
images) it would require also to add a fl_remove_symbol() function.


Alternative approach would be that for instance @ convention would accept 
something like

   @file:///my/shared/image.png My Label

in which case the shared image (with proper size) would be instantiated and 
used automatically but in such a case there is a question when/where to keep 
track
of caches (shared images and their the reference counts) as zombie caches could 
still be alive after eg label change or widget destruction.

R.




On 24/03/2013 05:22, Greg Ercolano wrote:
 I'm working on fixing STR #2772 (removing extraneous code in fl_measure()) 
 and need to understand in detail how we support '@' symbols in FLTK.
 
 Question:
  I want to verify that '@' symbols in labels (eg. @-) are only
  allowed at either *the very beginning* or *very end* of a string,
  or at both ends, and nothing else (ie. not in the middle of a
  string, or mixed into multiple lines).
 
 So in other words, these are OK:
 
 @- Back
 Next @-
 @- He went that way @-
 @- Line one\nLine two\nLine three @-
 
 .and just about all other variations are not:
 
 Something @- different.
 This @- is @- a test.
 This is @-\na test

___
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev


Re: [fltk.development] FLTK '@' symbols question [fl_add_symbol() RFE]

2013-03-25 Thread Greg Ercolano
[Changing the subject a bit to avoid a thread jack]

On 03/25/13 09:25, Roman Kantor wrote:
 Somewhat related, it would be nice if fl_add_symbol() would accept not only 
 drawing functions
 but also images, even without additional scaling and rotations.
 In the symbol table there is an int flag field (at the moment this flag is 
 used only
 with values 0/1 to indicate scalable and non-scalable symbols), other
 value could indicate that the pointer in the internal table is an image (or 
 other object),
 not the function and have to be interpreted differently. This can be
 done by overloading fl_add_symbol() which would set appropriate flag.

+1 from me -- sounds like a good approach, and I understand that
even though the symbol draw function can draw images, this won't
scale well when you have a lot of images (one func per image).

Making additional fl_add_symbol()/fl_remove_symbol() methods to accept
an image pointer and having those internally make use one of the unused
bits in the integer bit flag sounds like a good approach.

 Alternative approach would be that for instance @ convention would accept 
 something like
@file:///my/shared/image.png My Label

I prefer the image pointer approach for the reasons you mentioned,
and just it's better for modularity to have the image class handle
all the image related stuff.

___
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev


[fltk.development] FLTK '@' symbols question

2013-03-23 Thread Greg Ercolano
I'm working on fixing STR #2772 (removing extraneous code in fl_measure()) and 
need to understand in detail how we support '@' symbols in FLTK.

Question:
 I want to verify that '@' symbols in labels (eg. @-) are only
 allowed at either *the very beginning* or *very end* of a string,
 or at both ends, and nothing else (ie. not in the middle of a
 string, or mixed into multiple lines).

So in other words, these are OK:

@- Back
Next @-
@- He went that way @-
@- Line one\nLine two\nLine three @-

.and just about all other variations are not:

Something @- different.
This @- is @- a test.
This is @-\na test

I don't think these restrictions are documented, or at least not in the Labels 
and Label Types section of:
http://fltk.org/doc-1.3/common.html

So I'd like to (a) add this info to those docs, and (b) implement fixes 
accordingly to fl_measure().

Even as fl_measure() reads now (with extraneous code), I don't think it's 
correctly calculating symbol sizes.. for instance the scaling feature (e.g. 
@+9-, @-9-, which are scaled arrows).
___
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev