[Bf-committers] uiDefBut(...BIT...) proposal

Ton Roosendaal bf-committers@blender.org
Thu, 8 Jan 2004 14:24:33 +0100


Hi,

Go ahead! :)

-Ton-


On Thursday, Jan 8, 2004, at 06:10 Europe/Amsterdam, Daniel Dunbar  
wrote:

> One thing that has always annoyed me is that uiDefBut with
> a type of BIT takes the bit index, not the bit value. This means
> that you can't use the normal #define and so normally just a raw
> integer gets stuck there. This is a maintainance nightmare; for
> example, just searching for the ME_SUBSURF flag will not show you
> that it is toggled by a button.
>
> Simple proposal to fix this problem:
> For typed button definer functions (uiDefBut? uiDefIconBut?  
> uiDefIconTextBut?)
> add Bit variants, for example:
> uiBut *uiDefButS(uiBlock *block, int type, ...);
> uiBut *uiDefButBitS(uiBlock *block, int type, int bit, ...);
> where bit is the actual flag value.
>
> Then code can look like:
> uiDefButBitS(block, TOG, ME_SUBSURF, B_MAKEDISP, "SubSurf", ...);
> instead of:
> uiDefButS(block, TOG|BIT|7, B_MAKEDISP, "SubSurf", ...);
>
> Its a minor change, and I will probably not make all button definers  
> use the
> new functions (old still will work of course), but will make code more  
> readable,
> and easier to work with. Any detractors?
>
>
>
> =====
> daniel dunbar
> daniel@zuster.org
> _______________________________________________
> Bf-committers mailing list
> Bf-committers@blender.org
> http://www.blender.org/mailman/listinfo/bf-committers
>
>
------------------------------------------------------------------------ 
--
Ton Roosendaal  Blender Foundation ton@blender.org  
http://www.blender.org