[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14476] trunk/blender/source/blender: fix for [#7430] No way to back out of a PupStrInput() dialog

Joshua Leung aligorith at gmail.com
Sat Apr 26 13:40:32 CEST 2008


This doesn't really fix the underlying problem highlighted by this bug
report. The real problem is that UI_RETURN_OK is always returned, even on
ESCKEY or RMB. The easiest 'fix' is to remove the auto-activate for the
text-field, even though that will ultimately disable a useful feature...

On Sat, Apr 19, 2008 at 11:44 PM, Campbell Barton <ideasman42 at gmail.com>
wrote:

> Revision: 14476
>
> http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14476
> Author:   campbellbarton
> Date:     2008-04-19 13:44:09 +0200 (Sat, 19 Apr 2008)
>
> Log Message:
> -----------
> fix for [#7430] No way to back out of a PupStrInput() dialog
>
> Modified Paths:
> --------------
>    trunk/blender/source/blender/include/BIF_toolbox.h
>    trunk/blender/source/blender/src/toolbox.c
>
> Modified: trunk/blender/source/blender/include/BIF_toolbox.h
> ===================================================================
> --- trunk/blender/source/blender/include/BIF_toolbox.h  2008-04-19
> 11:26:51 UTC (rev 14475)
> +++ trunk/blender/source/blender/include/BIF_toolbox.h  2008-04-19
> 11:44:09 UTC (rev 14476)
> @@ -47,7 +47,7 @@
>
>  short button (short *var, short min, short max, char *str);
>  short fbutton (float *var, float min, float max, float a1, float a2, char
> *str);
> -short sbutton (char *var, float min, float max, char *str);    /* __NLA
> */
> +short sbutton (char *var, short min, short max, char *str);    /* __NLA
> */
>
>  int movetolayer_buts (unsigned int *lay, char *title);
>  int movetolayer_short_buts (short *lay, char *title);
>
> Modified: trunk/blender/source/blender/src/toolbox.c
> ===================================================================
> --- trunk/blender/source/blender/src/toolbox.c  2008-04-19 11:26:51 UTC
> (rev 14475)
> +++ trunk/blender/source/blender/src/toolbox.c  2008-04-19 11:44:09 UTC
> (rev 14476)
> @@ -291,13 +291,14 @@
>        return 0;
>  }
>
> -short sbutton(char *var, float min, float max, char *str)
> +short sbutton(char *var, short min, short max, char *str)
>  {
>        uiBlock *block;
>        ListBase listb={0, 0};
>        short x1,y1;
>        short mval[2], ret=0;
> -
> +       char *editvar = NULL; /* dont edit the original text, incase we
> cancel the popup */
> +
>        if(min>max) min= max;
>
>        getmouseco_sc(mval);
> @@ -313,7 +314,10 @@
>        x1=mval[0]-250;
>        y1=mval[1]-20;
>
> -       uiDefButC(block, TEX, 32766, str,       x1+5,y1+10,225,20,
> var,(float)min,(float)max, 0, 0, "");
> +       editvar = MEM_callocN(max, "sbutton");
> +       BLI_strncpy(editvar, var, max);
> +
> +       uiDefButC(block, TEX, 32766, str,       x1+5,y1+10,225,20,
> editvar,(float)min,(float)max, 0, 0, "");
>        uiDefBut(block, BUT, 32767, "OK",       x1+236,y1+10,25,20, NULL,
> 0, 0, 0, 0, "");
>
>        uiBoundsBlock(block, 5);
> @@ -321,7 +325,12 @@
>        mainqenter_ext(BUT_ACTIVATE, 32766, 0); /* note, button id '32766'
> is asking for errors some day! */
>        ret= uiDoBlocks(&listb, 0, 0);
>
> -       if(ret==UI_RETURN_OK) return 1;
> +       if(ret==UI_RETURN_OK) {
> +               BLI_strncpy(var, editvar, max);
> +               MEM_freeN(editvar);
> +               return 1;
> +       }
> +       MEM_freeN(editvar);
>        return 0;
>
>  }
>
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-committers/attachments/20080426/e7d96e6f/attachment.htm 


More information about the Bf-committers mailing list