[Bf-blender-cvs] [57e8c58] master: Text3d: setting upper/lower case now uses the selection
Campbell Barton
noreply at git.blender.org
Sun Dec 29 11:06:44 CET 2013
Commit: 57e8c5870aa2657db5c2b69f35112a91d95843f1
Author: Campbell Barton
Date: Sun Dec 29 21:05:39 2013 +1100
https://developer.blender.org/rB57e8c5870aa2657db5c2b69f35112a91d95843f1
Text3d: setting upper/lower case now uses the selection
===================================================================
M source/blender/editors/curve/editfont.c
===================================================================
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index c89f79b..440ded6 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -1480,29 +1480,32 @@ static int set_case(bContext *C, int ccase)
EditFont *ef = cu->editfont;
wchar_t *str;
int len;
+ int selstart, selend;
- len = wcslen(ef->textbuf);
- str = ef->textbuf;
- while (len) {
- if (*str >= 'a' && *str <= 'z')
- *str -= 32;
- len--;
- str++;
- }
-
- if (ccase == CASE_LOWER) {
- len = wcslen(ef->textbuf);
- str = ef->textbuf;
+ if (BKE_vfont_select_get(obedit, &selstart, &selend)) {
+ len = (selend - selstart) + 1;
+ str = &ef->textbuf[selstart];
while (len) {
- if (*str >= 'A' && *str <= 'Z') {
- *str += 32;
- }
+ if (*str >= 'a' && *str <= 'z')
+ *str -= 32;
len--;
str++;
}
- }
- text_update_edited(C, scene, obedit, 1, FO_EDIT);
+ if (ccase == CASE_LOWER) {
+ len = (selend - selstart) + 1;
+ str = &ef->textbuf[selstart];
+ while (len) {
+ if (*str >= 'A' && *str <= 'Z') {
+ *str += 32;
+ }
+ len--;
+ str++;
+ }
+ }
+
+ text_update_edited(C, scene, obedit, 1, FO_EDIT);
+ }
return OPERATOR_FINISHED;
}
More information about the Bf-blender-cvs
mailing list