[Bf-committers] Restored Text Undo.

Ton Roosendaal ton at blender.org
Wed Nov 10 10:59:40 CET 2004


Hi,

A better description of the problem/solution would be;

With a mouse pointer in Text Window, pressing hotkeys for global undo  
should call regular text window undo.

The comment in the code;

>> /*text does it's undo automatically, so we don't need any undo  
>> pushes*/

Is incorrect too. It is more like: /* use local textwindow undo instead  
*/

Futher it is better to go to the source of the problem, which is in the  
global hotkey handling, in toets.c. Saves coding, and much cleaner; see  
patch below:
(BTW: there already textwindow and scriptwindow exceptions exist, this  
way also a running scriptwindow will not do a global undo, which is OK  
for now)

-Ton-


--- toets.c     29 Oct 2004 15:00:11 -0000      1.44
+++ toets.c     10 Nov 2004 09:57:11 -0000
@@ -987,16 +987,20 @@
                 }
                 break;
         case YKEY:      // redo alternative
-               if(G.qual==LR_CTRLKEY) {
-                       BIF_redo();
-                       return 0;
+               if(textspace==0) {
+                       if(G.qual==LR_CTRLKEY) {
+                               BIF_redo();
+                               return 0;
+                       }
                 }
                 break;
         case ZKEY:      // undo
-               if(G.qual & (LR_CTRLKEY|LR_COMMANDKEY)) { // all combos  
with ctrl/commandkey are accepted
-                       if ELEM(G.qual, LR_CTRLKEY, LR_COMMANDKEY)  
BIF_undo();
-                       else BIF_redo(); // all combos with ctrl is redo
-                       return 0;
+               if(textspace==0) {
+                       if(G.qual & (LR_CTRLKEY|LR_COMMANDKEY)) { //  
all combos with ctrl/commandkey are accepted
+                               if ELEM(G.qual, LR_CTRLKEY,  
LR_COMMANDKEY) BIF_undo();
+                               else BIF_redo(); // all combos with  
ctrl is redo
+                               return 0;
+                       }
                 }
                 break;
         }
 >






On 10 Nov, 2004, at 1:45, joeedh wrote:

> Sortof.  Text undo is executed while the mouse is inside the text  
> window, but theres still the problem with global undo messing up the  
> text buffers if the cursor is outside the text window.
>
> joeedh
>
> Index: blender/source/blender/src/space.c
> ===================================================================
> RCS file: /cvsroot/bf-blender/blender/source/blender/src/space.c,v
> retrieving revision 1.201
> diff -r1.201 space.c
> 73a74
>> #include "DNA_text_types.h"
> 82a84,85
>> #include "BKE_sca.h"
>> #include "BKE_text.h"
> 630,645c633,651
> < 	if(G.obedit) {
> < 		if(G.obedit->type==OB_MESH)
> < 			undo_push_mesh(str);
> < 		else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
> < 			undo_push_curve(str);
> < 		else if (G.obedit->type==OB_FONT)
> < 			undo_push_font(str);
> < 		else if (G.obedit->type==OB_MBALL)
> < 			undo_push_mball(str);
> < 		else if (G.obedit->type==OB_LATTICE)
> < 			undo_push_lattice(str);
> < 	}
> < 	else {
> < 		if(U.uiflag & USER_GLOBALUNDO)
> < 			BKE_write_undo(str);
> < 	}
> ---
>>     /*text does it's undo automatically, so we don't need any undo  
>> pushes*/
>>     if (curarea->spacetype != SPACE_TEXT) {
>> 		if(G.obedit) {
>> 			if(G.obedit->type==OB_MESH)
>> 				undo_push_mesh(str);
>> 			else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
>> 				undo_push_curve(str);
>> 			else if (G.obedit->type==OB_FONT)
>> 				undo_push_font(str);
>> 			else if (G.obedit->type==OB_MBALL)
>> 				undo_push_mball(str);
>> 			else if (G.obedit->type==OB_LATTICE)
>> 				undo_push_lattice(str);
>> 		}
>> 		else {
>> 			if(U.uiflag & USER_GLOBALUNDO)
>> 				BKE_write_undo(str);
>> 		}
>> 	}		
> 650,658c656,660
> < 	if(G.obedit) {
> < 		if ELEM6(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF,  
> OB_MBALL, OB_LATTICE)
> < 			undo_editmode_step(1);
> < 	}
> < 	else {
> < 		if(G.f & G_WEIGHTPAINT)
> < 			wpaint_undo();
> < 		else if(G.f & G_VERTEXPAINT)
> < 			vpaint_undo();
> ---
>>     if (curarea->spacetype != SPACE_TEXT) {
>> 		if(G.obedit) {
>> 			if ELEM6(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF,  
>> OB_MBALL, OB_LATTICE)
>> 				undo_editmode_step(1);
>> 		}
> 660,661c662,669
> < 			/* now also in faceselect mode */
> < 			if(U.uiflag & USER_GLOBALUNDO) BKE_undo_step(1);
> ---
>> 			if(G.f & G_WEIGHTPAINT)
>> 				wpaint_undo();
>> 			else if(G.f & G_VERTEXPAINT)
>> 				vpaint_undo();
>> 			else {
>> 				/* now also in faceselect mode */
>> 				if(U.uiflag & USER_GLOBALUNDO) BKE_undo_step(1);
>> 			}
> 663c671,676
> < 	}
> ---
>> 	} else {
>> 	    SpaceText *st= curarea->spacedata.first;
>> 		Text *text= st->text;
>> 		txt_do_undo(text);
>> 		allqueue(REDRAWTEXT, 1);
>> 	}
> 668,676c681,685
> < 	if(G.obedit) {
> < 		if ELEM6(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF,  
> OB_MBALL, OB_LATTICE)
> < 			undo_editmode_step(-1);
> < 	}
> < 	else {
> < 		if(G.f & G_WEIGHTPAINT)
> < 			wpaint_undo();
> < 		else if(G.f & G_VERTEXPAINT)
> < 			vpaint_undo();
> ---
>>     if (curarea->spacetype != SPACE_TEXT) {
>> 		if(G.obedit) {
>> 			if ELEM6(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF,  
>> OB_MBALL, OB_LATTICE)
>> 				undo_editmode_step(-1);
>> 		}
> 678,679c687,694
> < 			/* includes faceselect now */
> < 			if(U.uiflag & USER_GLOBALUNDO) BKE_undo_step(-1);
> ---
>> 			if(G.f & G_WEIGHTPAINT)
>> 				wpaint_undo();
>> 			else if(G.f & G_VERTEXPAINT)
>> 				vpaint_undo();
>> 			else {
>> 				/* includes faceselect now */
>> 				if(U.uiflag & USER_GLOBALUNDO) BKE_undo_step(-1);
>> 			}
> 681c696,701
> < 	}
> ---
>> 	} else {
>> 		SpaceText *st= curarea->spacedata.first;
>> 		Text *text= st->text;
>> 		txt_do_redo(text);
>> 		allqueue(REDRAWTEXT, 1);
>>  	}    		
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
>
------------------------------------------------------------------------ 
--
Ton Roosendaal  Blender Foundation ton at blender.org  
http://www.blender.org



More information about the Bf-committers mailing list