Re: Save an attribute of a drop-down list item



Le Thu, Jun 10, 2004, à 11:23:10AM +0200, fenxp free fr a écrit:
When you save a Diagram with format .Dia uncompressed,
the value of a item of an drop-down list is saved as an integer.
This is an example:

<dia:attribute name="type">
   <dia:enum val="0"/>
</dia:attribute>

Is that possible to save the value of the attribute instead of the value of the
index ?

I would like to have a thing of this kind:

<dia:attribute name="type">
   <dia:string>#Normal step#</dia:string>
</dia:attribute>

you can't have that. "Normal step"  would typically be specified as a
translatable constant string (N_("Normal step")), which means that in
your locale, you'd actually save "Etape normale", and nobody but people
using a subset of LC_ALL=fr would be able to reload your diagram.

It should be possible to have dia save:
        <dia:enum val="0"><dia:enumlabel xml:lang="fr">Etape
        normale</dia:enumlabel></dia:enum>
with the dia:enumlabel being a strictly optional element we'd strongly
discourage the use (just as a little help for quick and dirty scripts);
I don't know whether it's really worth it 
(the space cost for compressed dia files would be negligible anyway).

There's another way to describe this effect: as it is right now, StdProp
strictly depends on the Standard C int-to-enum and enum-to-int implicit cast 
behaviour to operate correctly.

This means in particular that re-ordering the values of a saved enum is
a definitive no-no (unless you explicitly define the enum constants)

It should be possible to have dia save:
        <dia:enum val="0"><dia:enumlabel xml:lang="fr">Etape
        normale</dia:enumlabel></dia:enum>
with the dia:enumlabel being a strictly optional element we'd strongly
discourage the use (just as a little help for quick and dirty scripts);
I don't know whether it's really worth it (the space cost for compressed 
dia files would be negligible anyway).
                
        -- Cyrille
        
-- 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]