From f210e88263aa73a27c105fef4d2afb2bfeab5234 Mon Sep 17 00:00:00 2001 From: Mika Saari Date: Mon, 19 Sep 2005 17:58:51 +0000 Subject: Coding style from spaces to tabs in files related to Unicode Font Object. Function strlen changed to wcslen in editfont.c in ALT-U (undo) functionality. --- source/blender/blenkernel/intern/font.c | 215 +++++++++++++-------------- source/blender/blenlib/BLI_vfontdata.h | 2 +- source/blender/blenlib/intern/freetypefont.c | 36 ++--- source/blender/include/butspace.h | 10 +- source/blender/src/buttons_editing.c | 123 ++++++++------- source/blender/src/editfont.c | 146 +++++++++--------- source/blender/src/interface.c | 78 +++++----- source/blender/src/usiblender.c | 20 +-- 8 files changed, 315 insertions(+), 315 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index eadf42c6612..7169fbbca01 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -171,41 +171,40 @@ utf8slen(char *src) int utf8towchar_(wchar_t *w, char *c) { - int len=0; - if(w==NULL || c==NULL) return(0); - //printf("%s\n",c); - while(*c) - { - if(*c & 0x80) - { - if(*c & 0x40) - { - if(*c & 0x20) - { - if(*c & 0x10) - { - *w=(c[0] & 0x0f)<<18 | (c[1]&0x1f)<<12 | (c[2]&0x3f)<<6 | (c[3]&0x7f); - c++; - } - else - *w=(c[0] & 0x1f)<<12 | (c[1]&0x3f)<<6 | (c[2]&0x7f); - c++; - } - else - *w=(((c[0] &0x3f)<<6) | (c[1]&0x7f)); - c++; - } - else - *w=(c[0] & 0x7f); - } - else - *w=(c[0] & 0x7f); - - c++; - w++; - len++; - } - return len; + int len=0; + if(w==NULL || c==NULL) return(0); + //printf("%s\n",c); + while(*c) + { + if(*c & 0x80) + { + if(*c & 0x40) + { + if(*c & 0x20) + { + if(*c & 0x10) + { + *w=(c[0] & 0x0f)<<18 | (c[1]&0x1f)<<12 | (c[2]&0x3f)<<6 | (c[3]&0x7f); + c++; + } + else + *w=(c[0] & 0x1f)<<12 | (c[1]&0x3f)<<6 | (c[2]&0x7f); + c++; + } + else + *w=(((c[0] &0x3f)<<6) | (c[1]&0x7f)); + c++; + } + else + *w=(c[0] & 0x7f); + } + else + *w=(c[0] & 0x7f); + c++; + w++; + len++; + } + return len; } /* The vfont code */ @@ -408,16 +407,16 @@ VFont *load_vfont(char *name) static VFont *which_vfont(Curve *cu, CharInfo *info) { - switch(info->flag & CU_STYLE) { - case CU_BOLD: - return(cu->vfontb); - case CU_ITALIC: - return(cu->vfonti); - case (CU_BOLD|CU_ITALIC): - return(cu->vfontbi); - default: - return(cu->vfont); - } + switch(info->flag & CU_STYLE) { + case CU_BOLD: + return(cu->vfontb); + case CU_ITALIC: + return(cu->vfonti); + case (CU_BOLD|CU_ITALIC): + return(cu->vfontbi); + default: + return(cu->vfont); + } } static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, int charidx, short mat_nr) @@ -727,12 +726,12 @@ struct chartrans *text_to_curve(Object *ob, int mode) #endif - if (vfont==0) goto errcse; - if (vfont != oldvfont) { - vfd= vfont_get_data(vfont); - oldvfont = vfont; - } - if (!vfd) goto errcse; + if (vfont==0) goto errcse; + if (vfont != oldvfont) { + vfd= vfont_get_data(vfont); + oldvfont = vfont; + } + if (!vfd) goto errcse; // The character wasn't found, propably ascii = 0, then the width shall be 0 as well if(!che) @@ -745,10 +744,10 @@ struct chartrans *text_to_curve(Object *ob, int mode) } // Calculate positions - if((tb->w != 0.0) && (ct->dobreak==0) && ((xof-(tb->x/cu->fsize)+twidth)*cu->fsize) > tb->w) { -// fprintf(stderr, "linewidth exceeded: %c%c%c...\n", mem[i], mem[i+1], mem[i+2]); - for (j=i; j && (mem[j] != '\n') && (mem[j] != '\r') && (chartransdata[j].dobreak==0); j--) { - if (mem[j]==' ' || mem[j]=='-') { + if((tb->w != 0.0) && (ct->dobreak==0) && ((xof-(tb->x/cu->fsize)+twidth)*cu->fsize) > tb->w) { +// fprintf(stderr, "linewidth exceeded: %c%c%c...\n", mem[i], mem[i+1], mem[i+2]); + for (j=i; j && (mem[j] != '\n') && (mem[j] != '\r') && (chartransdata[j].dobreak==0); j--) { + if (mem[j]==' ' || mem[j]=='-') { ct -= (i-(j-1)); cnr -= (i-(j-1)); if (mem[j] == ' ') wsnr--; @@ -758,19 +757,19 @@ struct chartrans *text_to_curve(Object *ob, int mode) ct[1].dobreak = 1; cu->strinfo[i+1].flag |= CU_WRAP; goto makebreak; - } - if (chartransdata[j].dobreak) { -// fprintf(stderr, "word too long: %c%c%c...\n", mem[j], mem[j+1], mem[j+2]); - ct->dobreak= 1; - cu->strinfo[i+1].flag |= CU_WRAP; - ct -= 1; - cnr -= 1; - i--; - xof = ct->xof; - goto makebreak; - } - } - } + } + if (chartransdata[j].dobreak) { +// fprintf(stderr, "word too long: %c%c%c...\n", mem[j], mem[j+1], mem[j+2]); + ct->dobreak= 1; + cu->strinfo[i+1].flag |= CU_WRAP; + ct -= 1; + cnr -= 1; + i--; + xof = ct->xof; + goto makebreak; + } + } + } if(ascii== '\n' || ascii== '\r' || ascii==0 || ct->dobreak) { ct->xof= xof; ct->yof= yof; @@ -820,12 +819,12 @@ struct chartrans *text_to_curve(Object *ob, int mode) ct->linenr= lnr; ct->charnr= cnr++; - if (selboxes && (i>=selstart) && (i<=selend)) { - sb = &(selboxes[i-selstart]); - sb->y = yof*cu->fsize-linedist*cu->fsize*0.1; - sb->h = linedist*cu->fsize; - sb->w = xof*cu->fsize; - } + if (selboxes && (i>=selstart) && (i<=selend)) { + sb = &(selboxes[i-selstart]); + sb->y = yof*cu->fsize-linedist*cu->fsize*0.1; + sb->h = linedist*cu->fsize; + sb->w = xof*cu->fsize; + } if (ascii==32) { wsfac = cu->wordspace; @@ -1089,26 +1088,26 @@ struct chartrans *text_to_curve(Object *ob, int mode) ct= chartransdata; if (cu->sepchar==0) { - for (i= 0; istrinfo[i]); - if (info->mat_nr > (ob->totcol)) { - printf("Error: Illegal material index (%d) in text object, setting to 0\n", info->mat_nr); - info->mat_nr = 0; - } + info = &(cu->strinfo[i]); + if (info->mat_nr > (ob->totcol)) { + printf("Error: Illegal material index (%d) in text object, setting to 0\n", info->mat_nr); + info->mat_nr = 0; + } // We do not want to see any character for \n or \r if(cha != '\n' && cha != '\r') - buildchar(cu, cha, info, ct->xof, ct->yof, ct->rot, i); - if ((info->flag & CU_UNDERLINE) && (cu->textoncurve == NULL) && (cha != '\n') && (cha != '\r')) { - uloverlap = 0; - if ( (i<(slen-1)) && (mem[i+1] != '\n') && (mem[i+1] != '\r') && - ((mem[i+1] != ' ') || (cu->strinfo[i+1].flag & CU_UNDERLINE)) && ((cu->strinfo[i+1].flag & CU_WRAP)==0) - ) { - uloverlap = xtrax + 0.1; - } - // Find the character, the characters has to be in the memory already - // since character checking has been done earlier already. - che = vfd->characters.first; + buildchar(cu, cha, info, ct->xof, ct->yof, ct->rot, i); + if ((info->flag & CU_UNDERLINE) && (cu->textoncurve == NULL) && (cha != '\n') && (cha != '\r')) { + uloverlap = 0; + if ( (i<(slen-1)) && (mem[i+1] != '\n') && (mem[i+1] != '\r') && + ((mem[i+1] != ' ') || (cu->strinfo[i+1].flag & CU_UNDERLINE)) && ((cu->strinfo[i+1].flag & CU_WRAP)==0) + ) { + uloverlap = xtrax + 0.1; + } + // Find the character, the characters has to be in the memory already + // since character checking has been done earlier already. + che = vfd->characters.first; while(che) { if(che->index == cha) @@ -1117,20 +1116,20 @@ struct chartrans *text_to_curve(Object *ob, int mode) } if(!che) twidth =0; else twidth=che->width; - ulwidth = cu->fsize * ((twidth* (1.0+(info->kern/40.0)))+uloverlap); - build_underline(cu, ct->xof*cu->fsize, ct->yof*cu->fsize + (cu->ulpos-0.05)*cu->fsize, - ct->xof*cu->fsize + ulwidth, - ct->yof*cu->fsize + (cu->ulpos-0.05)*cu->fsize - cu->ulheight*cu->fsize, - i, info->mat_nr); - } - ct++; - } + ulwidth = cu->fsize * ((twidth* (1.0+(info->kern/40.0)))+uloverlap); + build_underline(cu, ct->xof*cu->fsize, ct->yof*cu->fsize + (cu->ulpos-0.05)*cu->fsize, + ct->xof*cu->fsize + ulwidth, + ct->yof*cu->fsize + (cu->ulpos-0.05)*cu->fsize - cu->ulheight*cu->fsize, + i, info->mat_nr); + } + ct++; + } } else { - outta = 0; - for (i= 0; (istrinfo[i]); + outta = 0; + for (i= 0; (istrinfo[i]); if (cu->sepchar == (i+1)) { mem[0] = ascii; mem[1] = 0; @@ -1142,12 +1141,12 @@ struct chartrans *text_to_curve(Object *ob, int mode) vecyo[2] = 0; Mat4MulVecfl(ob->obmat, vecyo); VECCOPY(ob->loc, vecyo); - outta = 1; - cu->sepchar = 0; + outta = 1; + cu->sepchar = 0; } - ct++; - } - } + ct++; + } + } } if(mode==FO_DUPLI) { diff --git a/source/blender/blenlib/BLI_vfontdata.h b/source/blender/blenlib/BLI_vfontdata.h index 1ebcd80b22b..ce800111afb 100644 --- a/source/blender/blenlib/BLI_vfontdata.h +++ b/source/blender/blenlib/BLI_vfontdata.h @@ -97,7 +97,7 @@ BLI_vfontdata_from_freetypefont( int BLI_vfontchar_from_freetypefont( - struct VFont *vfont, unsigned long character); + struct VFont *vfont, unsigned long character); #endif diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index 577309a5474..308f567005a 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -329,7 +329,7 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf) VFontData *vfd; /* - FT_CharMap found = 0; + FT_CharMap found = 0; FT_CharMap charmap; FT_UShort my_platform_id = TT_PLATFORM_MICROSOFT; FT_UShort my_encoding_id = TT_MS_ID_UNICODE_CS; @@ -345,22 +345,22 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf) if(err) return NULL; /* - for ( n = 0; n < face->num_charmaps; n++ ) - { - charmap = face->charmaps[n]; - if ( charmap->platform_id == my_platform_id && - charmap->encoding_id == my_encoding_id ) - { - found = charmap; - break; - } - } - - if ( !found ) { return NULL; } - - // now, select the charmap for the face object - err = FT_Set_Charmap( face, found ); - if ( err ) { return NULL; } + for ( n = 0; n < face->num_charmaps; n++ ) + { + charmap = face->charmaps[n]; + if ( charmap->platform_id == my_platform_id && + charmap->encoding_id == my_encoding_id ) + { + found = charmap; + break; + } + } + + if ( !found ) { return NULL; } + + // now, select the charmap for the face object + err = FT_Set_Charmap( face, found ); + if ( err ) { return NULL; } */ // allocate blender font @@ -487,7 +487,7 @@ VFontData *BLI_vfontdata_from_freetypefont(PackedFile *pf) //init Freetype err = FT_Init_FreeType( &library); if(err) { - error("Failed to load the Freetype font library"); + error("Failed to load the Freetype font library"); return 0; } diff --git a/source/blender/include/butspace.h b/source/blender/include/butspace.h index 96080e187b1..db22433c273 100644 --- a/source/blender/include/butspace.h +++ b/source/blender/include/butspace.h @@ -412,11 +412,11 @@ enum { #define B_STYLETOSELU 2213 #define B_STYLETOSELI 2214 -#define B_SETCHAR 2215 -#define B_SETUPCHAR 2216 -#define B_SETDOWNCHAR 2217 -#define B_SETCAT 2218 -#define B_SETUNITEXT 2219 +#define B_SETCHAR 2215 +#define B_SETUPCHAR 2216 +#define B_SETDOWNCHAR 2217 +#define B_SETCAT 2218 +#define B_SETUNITEXT 2219 /* *********************** */ #define B_ARMBUTS 2400 diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 00971c379a9..95e18152920 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -165,142 +165,142 @@ unicodect uctabname[125] = { {"All", "All", 0x0000, 0xffff}, {"Basic Latin", "Basic Latin", 0x0000, 0x007f}, {"Latin 1 Supp", "Latin-1 Supplement", 0x0080, 0x00ff}, - + {"Latin Ext. A.", "Latin Extended-A", 0x0100, 0x017F}, {"Latin Ext. B.", "Latin Extended-B", 0x0180,0x024F}, {"Latin Ext. Add.", "Latin Extended Additional", 0x1e00, 0x1eff}, - + {"IPA Ext", "IPA Extensions", 0x0250, 0x02AF}, {"Spacing Mod.", "Spacing Modifier Letters", 0x02b0, 0x02ff}, - + {"Comb. Dia.", "Combining Diacritical Marks", 0x0300, 0x036F}, {"Greek, Coptic", "Greek and Coptic", 0x0370, 0x03ff}, {"Greek Ext.", "Greek Extended", 0x1f00, 0x1fff}, - + {"Cyrillic", "Cyrillic", 0x0400, 0x04ff}, {"Cyrillic Supp.", "Cyrillic Supplementary", 0x0500, 0x052f}, - + {"Armenian", "Armenian", 0x0530, 0x058f}, {"Hebrew", "Hebrew", 0x0590, 0x05ff}, - + {"Arabic", "Arabic", 0x0600, 0x06ff}, {"Syriac", "Syriac", 0x0700, 0x074f}, - + {"Thaana", "Thaana", 0x0780, 0x07bf}, {"Devanagari", "Devanagari", 0x0900, 0x097f}, - + {"Bengali", "Bengali", 0x0980, 0x09ff}, {"Gurmukhi", "Gurmukhi", 0x0a00, 0x0a7f}, - + {"Gujarati", "Gujarati", 0x0a80, 0x0aff}, {"Oriya", "Oriya", 0x0b00, 0x0b7f}, - + {"Tamil", "Tamil", 0x0b80, 0x0bff}, {"Tegulu", "Tegulu", 0x0c00, 0x0c7f}, - + {"Kannada", "Kannada", 0x0c80, 0x0cff}, {"Malayalam", "Malayalam", 0x0d00, 0x0d7f}, - + {"Sinhala", "Sinhala", 0x0d80, 0x0dff}, {"Thai", "Thai", 0x0e00, 0x0e7f}, - + {"Lao", "Lao", 0x0e80, 0x0eff}, {"Tibetan", "Tibetan", 0x0f00, 0x0fff}, - + {"Myanmar", "Myanmar", 0x1000, 0x109f}, {"Georgian", "Georgian", 0x10a0, 0x10ff}, - + {"Ethiopic", "Ethiopic", 0x1200, 0x137f}, - + {"Cherokee", "Cherokee", 0x13a0, 0x13ff}, {"Unif. Canadian", "Unified Canadian Aboriginal Syllabics", 0x1400, 0x167f}, - + {"Ogham", "Ogham", 0x1680, 0x169f}, {"Runic", "Runic", 0x16a0, 0x16ff}, - + {"Tagalog", "Tagalog", 0x1700, 0x171f}, {"Hanunoo", "Hanunoo", 0x1720, 0x173f}, - + {"Buhid", "Buhid", 0x1740, 0x175f}, {"Tagbanwa", "Tagbanwa", 0x1760, 0x177f}, - + {"Khmer", "Khmer", 0x1780, 0x17ff}, {"Khmer Symb", "Khmer Symbols", 0x19e0, 0x19ff}, {"Mongolian", "Mongolian", 0x1800, 0x18af}, - + {"Limbu", "Limbu", 0x1900, 0x194f}, {"Tai Le", "Tai Le", 0x1950, 0x197f}, - + {"Phon. Ext.", "Phonetic Extensions", 0x1d00, 0x1d7f}, - - + + {"Gen. Punct.", "General Punctutation", 0x2000, 0x206f}, {"Super, Sub", "Superscripts and Subscripts", 0x2070, 0x209f}, - + {"Curr. Symb.", "Currency Symbols", 0x20a0, 0x20cf}, {"Comb. Diacrit.", "Combining Diacritical Marks for Symbols", 0x20d0, 0x20ff}, - + {"Letter Symb", "Letterlike Symbols", 0x2100, 0x214f}, {"Numb. Forms", "Number Forms", 0x2150, 0x218f}, - + {"Arrows", "Arrows", 0x2190, 0x21ff}, {"Math Oper.", "Mathematical Operators", 0x2200, 0x22ff}, - + {"Misc. Tech.", "Miscellaneous Technical", 0x2300, 0x23ff}, {"Ctrl. Pict.", "Control Pictures", 0x2400, 0x243f}, - + {"OCR", "Optical Character Recognition", 0x2440, 0x245f}, {"Enc. Alpha", "Enclosed Alphanumerics", 0x2460, 0x24ff}, - + {"Bow Drawing", "Box Drawing", 0x2500, 0x257f}, {"BLock Elem.", "Block Elements", 0x2580, 0x259f}, - + {"Geom. Shapes", "Geometric Shapes", 0x25a0, 0x25ff}, {"Misc. Symb.", "Miscellaneous Symbols", 0x2600, 0x26ff}, - + {"Dingbats", "Dingbats", 0x2700, 0x27bf}, {"Misc. Math A", "Miscellaneous Mathematical Symbols-A", 0x27c0, 0x27ef}, - + {"Supp. Arrows-A", "Supplemental Arrows-A", 0x27f0, 0x27ff}, {"Braille Pat.", "Braille Patterns", 0x2800, 0x28ff}, - + {"Supp. Arrows-B", "Supplemental Arrows-B", 0x2900, 0x297f}, {"Misc. Math B", "Miscellaneous Mathematical Symbols-B", 0x2980, 0x29ff}, - + {"Supp. Math Op.", "Supplemental Mathematical Operators", 0x2a00, 0x2aff}, {"Misc. Symb.", "Miscellaneous Symbols and Arrows", 0x2b00, 0x2bff}, - + {"Kangxi Rad.", "Kangxi Radicals", 0x2f00, 0x2fdf}, - + {"Ideographic", "Ideographic Description Characters", 0x2ff0, 0x2fff}, - + {"Hiragana", "Hiragana", 0x3040, 0x309f}, {"Katakana", "Katakana", 0x30a0, 0x30ff}, {"Katakana Ext.", "Katakana Phonetic Extensions", 0x31f0, 0x31ff}, - + {"Bopomofo", "Bopomofo", 0x3100, 0x312f}, {"Bopomofo Ext.", "Bopomofo Extended", 0x31a0, 0x31bf}, {"Hangul", "Hangul Jamo", 0x1100, 0x11ff}, {"Hangul Comp.", "Hangul Compatibility Jamo", 0x3130, 0x318f}, {"Hangul Syll.", "Hangul Syllables", 0xac00, 0xd7af}, - + {"Kanbun", "Kanbun", 0x3190, 0x319f}, - - - + + + {"Yijing Hex.", "Yijing Hexagram Symbols", 0x4dc0, 0x4dff}, - + {"Yi Syllables", "Yi Syllables", 0xa000, 0xa48f}, {"Yi Radicals", "Yi Radicals", 0xa490, 0xa4cf}, - + {"High Surr.", "High Surrogate Area", 0xd800, 0xdbff}, - + {"Low Surr.", "Low Surrogates", 0xdc00, 0xdfff}, {"Priv. Use Area", "Private Use Area", 0xe000, 0xf8ff}, - + {"CJK Rad. Supp.", "CJK Radicals Supplement", 0x2e80, 0x2eff}, {"CJK Ideographs", "CJK Unified Ideographs", 0x4e00, 0x9faf}, {"CJK Ideog. Ext. A", "CJK Unified Ideographs Extension A", 0x3400, 0x4dbf}, @@ -313,47 +313,46 @@ unicodect uctabname[125] = { {"CJK Comp. Supp.", "CJK Compatibility Ideographs Supplement", 0x2f800, 0x2fa1f}, {"Alpha. Pres. Forms", "Alphabetic Presentation Forms", 0xfb00, 0xfb4f}, - + {"Arabic Pres. A", "Arabic Presentation Forms-A", 0xfb50, 0xfdff}, {"Arabic Pres. B", "Arabic Presentation Forms-B", 0xfe70, 0xfeff}, {"Var. Sel.", "Variation Selectors", 0xfe00, 0xfe0f}, - + {"Comb. Half", "Combining Half Marks", 0xfe20, 0xfe2f}, - + {"Sml. From Var.", "Small Form Variants", 0xfe50, 0xfe6f}, - + {"Half, Full Forms", "Halfwidth and Fullwidth Forms", 0xff00, 0xffef}, {"Specials", "Specials", 0xfff0, 0xffff}, - + {"Lin. B Syllab.", "Linear B Syllabary", 0x10000, 0x1007f}, {"Lin. B Idog.", "Linear B Ideograms", 0x10080, 0x100ff}, - + {"Aegean Num.", "Aegean Numbers", 0x10100, 0x1013f}, {"Old Italic", "Old Italic", 0x10300, 0x1032f}, - + {"Gothic", "Gothic", 0x10330, 0x1034f}, {"Ugaritic", "Ugaritic", 0x10380, 0x1039f}, - + {"Deseret", "Deseret", 0x10400, 0x1044f}, {"Shavian", "Shavian", 0x10450, 0x1047f}, - + {"Osmanya", "Osmanya", 0x10480, 0x104af}, {"Cypriot Syll", "Cypriot Syllabary", 0x10800, 0x1083f}, - + {"Bysantine Mus.", "Bysantine Musical Symbols", 0x1d000, 0x1d0ff}, {"Music Symb.", "Musical Symbols", 0x1d100, 0x1d1ff}, - + {"Tai Xuan Symb", "Tai Xuan Jing Symbols", 0x1d300, 0x1d35f}, {"Math. Alpha Symb.", "Mathematical Alpanumeric Symbols", 0x1d400, 0x1d7ff}, - - + + {"Tags", "Tags", 0xe0000, 0xe007f}, {"Var. Supp", "Variation Selectors Supplement", 0xe0100, 0xe01ef}, - + {"Supp. Priv. A", "Supplementary Private Use Area-A", 0xf0000, 0xffffd}, {"Supp. Priv. B", "Supplementary Private Use Area-B", 0x100000, 0x10fffd} - }; diff --git a/source/blender/src/editfont.c b/source/blender/src/editfont.c index 50ea124886a..8d1aa5818fd 100644 --- a/source/blender/src/editfont.c +++ b/source/blender/src/editfont.c @@ -433,7 +433,7 @@ void txt_export_to_objects(struct Text *text) curline = text->lines.first; while(curline){ - /*skip lines with no text, but still make space for them*/ + /*skip lines with no text, but still make space for them*/ if(curline->line[0] == '\0'){ linenum++; curline = curline->next; @@ -739,13 +739,13 @@ void do_textedit(unsigned short event, short val, unsigned long _ascii) cu->pos= next_word(cu); cursmove= FO_CURS; } - else if (G.qual & LR_ALTKEY) { - kern = textbufinfo[cu->pos-1].kern; - kern += 1; - if (kern>20) kern = 20; - textbufinfo[cu->pos-1].kern = kern; - doit = 1; - } + else if (G.qual & LR_ALTKEY) { + kern = textbufinfo[cu->pos-1].kern; + kern += 1; + if (kern>20) kern = 20; + textbufinfo[cu->pos-1].kern = kern; + doit = 1; + } else { cu->pos++; cursmove= FO_CURS; @@ -759,13 +759,13 @@ void do_textedit(unsigned short event, short val, unsigned long _ascii) cu->pos= prev_word(cu); cursmove= FO_CURS; } - else if (G.qual & LR_ALTKEY) { - kern = textbufinfo[cu->pos-1].kern; - kern -= 1; - if (kern<-20) kern = -20; - textbufinfo[cu->pos-1].kern = kern; - doit = 1; - } + else if (G.qual & LR_ALTKEY) { + kern = textbufinfo[cu->pos-1].kern; + kern -= 1; + if (kern<-20) kern = -20; + textbufinfo[cu->pos-1].kern = kern; + doit = 1; + } else { cu->pos--; cursmove=FO_CURS; @@ -841,52 +841,52 @@ void do_textedit(unsigned short event, short val, unsigned long _ascii) } break; - case IKEY: - if (G.qual & LR_CTRLKEY) { - cu->curinfo.flag ^= CU_ITALIC; - if (style_to_sel(CU_ITALIC, cu->curinfo.flag & CU_ITALIC)) doit= 1; - allqueue(REDRAWBUTSEDIT, 0); - } - break; - - case BKEY: - if (G.qual & LR_CTRLKEY) { - cu->curinfo.flag ^= CU_BOLD; - if (style_to_sel(CU_BOLD, cu->curinfo.flag & CU_BOLD)) doit= 1; - allqueue(REDRAWBUTSEDIT, 0); - } - break; - - case UKEY: - if (G.qual & LR_CTRLKEY) { - cu->curinfo.flag ^= CU_UNDERLINE; - if (style_to_sel(CU_UNDERLINE, cu->curinfo.flag & CU_UNDERLINE)) doit= 1; - allqueue(REDRAWBUTSEDIT, 0); - } - break; - - case XKEY: - if (G.qual & LR_CTRLKEY) { - copyselection(); - killselection(0); - doit= 1; - } - break; - - case CKEY: - if (G.qual & LR_CTRLKEY) { - copyselection(); - } - break; - - case VKEY: - if (G.qual & LR_CTRLKEY) { - pasteselection(); - doit= 1; - } - break; - - } + case IKEY: + if (G.qual & LR_CTRLKEY) { + cu->curinfo.flag ^= CU_ITALIC; + if (style_to_sel(CU_ITALIC, cu->curinfo.flag & CU_ITALIC)) doit= 1; + allqueue(REDRAWBUTSEDIT, 0); + } + break; + + case BKEY: + if (G.qual & LR_CTRLKEY) { + cu->curinfo.flag ^= CU_BOLD; + if (style_to_sel(CU_BOLD, cu->curinfo.flag & CU_BOLD)) doit= 1; + allqueue(REDRAWBUTSEDIT, 0); + } + break; + + case UKEY: + if (G.qual & LR_CTRLKEY) { + cu->curinfo.flag ^= CU_UNDERLINE; + if (style_to_sel(CU_UNDERLINE, cu->curinfo.flag & CU_UNDERLINE)) doit= 1; + allqueue(REDRAWBUTSEDIT, 0); + } + break; + + case XKEY: + if (G.qual & LR_CTRLKEY) { + copyselection(); + killselection(0); + doit= 1; + } + break; + + case CKEY: + if (G.qual & LR_CTRLKEY) { + copyselection(); + } + break; + + case VKEY: + if (G.qual & LR_CTRLKEY) { + pasteselection(); + doit= 1; + } + break; + + } if(cursmove) { if ((G.qual & LR_SHIFTKEY)==0) { @@ -981,7 +981,7 @@ void paste_editText(void) Curve *cu; int filelen, doit= 0; char *strp; - FILE *fp = NULL; + FILE *fp = NULL; #ifdef WIN32 fp= fopen("C:\\windows\\temp\\cutbuf.txt", "r"); @@ -1020,13 +1020,13 @@ void paste_editText(void) strp[filelen]= 0; if(cu->len+filelenlen += tmplen; - cu->pos= cu->len; + int tmplen; + wchar_t *mem = MEM_callocN((sizeof(wchar_t) * filelen) + (4 * sizeof(wchar_t)), "temporary"); + tmplen = utf8towchar_(mem, strp); + wcscat(textbuf, mem); + MEM_freeN(mem); + cu->len += tmplen; + cu->pos= cu->len; } MEM_freeN(strp); doit = 1; @@ -1052,8 +1052,8 @@ void make_editText(void) if(copybufinfo==NULL) copybufinfo= MEM_callocN((MAXTEXT+4)*sizeof(CharInfo), "texteditcopybufinfo"); if(oldstr==NULL) oldstr= MEM_callocN((MAXTEXT+4)*sizeof(wchar_t), "oldstrbuf"); - // Convert the original text to wchar_t - utf8towchar_(textbuf, cu->str); + // Convert the original text to wchar_t + utf8towchar_(textbuf, cu->str); wcscpy(oldstr, textbuf); cu->len= wcslen(textbuf); @@ -1126,8 +1126,10 @@ void remake_editText(void) // Set the object length and position cu= G.obedit->data; - cu->len= strlen(textbuf); + cu->len= wcslen(textbuf); if(cu->pos>cu->len) cu->pos= cu->len; + + update_string(cu); DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); allqueue(REDRAWVIEW3D, 0); diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index c0bd38eb71f..7327398c099 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -2662,12 +2662,12 @@ static int ui_do_but_HSVCUBE(uiBut *but) // hsv_to_rgb(x, y, v, col, col+1, col+2); } else if(but->a1==2) { - but->hsv[2]= x; - but->hsv[1]= y; + but->hsv[2]= x; + but->hsv[1]= y; // hsv_to_rgb(h, y, x, col, col+1, col+2); } else { - but->hsv[0]= x; + but->hsv[0]= x; // hsv_to_rgb(x, s, v, col, col+1, col+2); } @@ -2693,48 +2693,48 @@ static int ui_do_but_HSVCUBE(uiBut *but) static int ui_do_but_CHARTAB(uiBut *but) { - /* Variables */ - short mval[2]; - float sx, sy, ex, ey; - float width, height; - float butw, buth; - int x, y; - unsigned long cs; - unsigned long che; + /* Variables */ + short mval[2]; + float sx, sy, ex, ey; + float width, height; + float butw, buth; + int x, y; + unsigned long cs; + unsigned long che; - /* Check the position */ - uiGetMouse(mywinget(), mval); + /* Check the position */ + uiGetMouse(mywinget(), mval); - /* Calculate the size of the button */ - width = abs(but->x2 - but->x1); - height = abs(but->y2 - but->y1); + /* Calculate the size of the button */ + width = abs(but->x2 - but->x1); + height = abs(but->y2 - but->y1); - butw = floor(width / 12); - buth = floor(height / 6); + butw = floor(width / 12); + buth = floor(height / 6); - /* Initialize variables */ - sx = but->x1; - ex = but->x1 + butw; - sy = but->y1 + height - buth; - ey = but->y1 + height; + /* Initialize variables */ + sx = but->x1; + ex = but->x1 + butw; + sy = but->y1 + height - buth; + ey = but->y1 + height; - cs = G.charstart; + cs = G.charstart; - /* And the character is */ - x = (int) ((mval[0] / butw) - 0.5); - y = (int) (6 - ((mval[1] / buth) - 0.5)); + /* And the character is */ + x = (int) ((mval[0] / butw) - 0.5); + y = (int) (6 - ((mval[1] / buth) - 0.5)); - che = cs + (y*12) + x; + che = cs + (y*12) + x; - if(che > G.charmax) - che = 0; + if(che > G.charmax) + che = 0; - if(G.obedit) - { - do_textedit(0,0,che); - } + if(G.obedit) + { + do_textedit(0,0,che); + } - return but->retval; + return but->retval; } #endif @@ -3666,12 +3666,12 @@ static uiOverDraw *ui_draw_but_tip(uiBut *but) y1= but->y1-(ury+FTF_GetSize())-12; y2= but->y1-12; } } else { - x1= (but->x1+but->x2)/2; x2= 10+x1+ but->aspect*BMF_GetStringWidth(but->font, but->tip); - y1= but->y1-30; y2= but->y1-12; + x1= (but->x1+but->x2)/2; x2= 10+x1+ but->aspect*BMF_GetStringWidth(but->font, but->tip); + y1= but->y1-30; y2= but->y1-12; } #else - x1= (but->x1+but->x2)/2; x2= 10+x1+ but->aspect*BMF_GetStringWidth(but->font, but->tip); - y1= but->y1-30; y2= but->y1-12; + x1= (but->x1+but->x2)/2; x2= 10+x1+ but->aspect*BMF_GetStringWidth(but->font, but->tip); + y1= but->y1-30; y2= but->y1-12; #endif /* for pulldown menus it doesnt work */ diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c index d5b35bdff60..af0e1bd79a0 100644 --- a/source/blender/src/usiblender.c +++ b/source/blender/src/usiblender.c @@ -645,16 +645,16 @@ extern ListBase editelems; void exit_usiblender(void) { - struct TmpFont *tf; - tf= G.ttfdata.first; - while(tf) - { - freePackedFile(tf->pf); - tf->pf= NULL; - tf->vfont= NULL; - tf= tf->next; - } - BLI_freelistN(&G.ttfdata); + struct TmpFont *tf; + tf= G.ttfdata.first; + while(tf) + { + freePackedFile(tf->pf); + tf->pf= NULL; + tf->vfont= NULL; + tf= tf->next; + } + BLI_freelistN(&G.ttfdata); freeAllRad(); BKE_freecubetable(); -- cgit v1.2.3