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.
This commit is contained in:
@@ -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; i<slen; i++) {
|
||||
for (i= 0; i<slen; i++) {
|
||||
cha = (unsigned long) mem[i];
|
||||
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;
|
||||
}
|
||||
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; (i<slen) && (outta==0); i++) {
|
||||
ascii = mem[i];
|
||||
info = &(cu->strinfo[i]);
|
||||
outta = 0;
|
||||
for (i= 0; (i<slen) && (outta==0); i++) {
|
||||
ascii = mem[i];
|
||||
info = &(cu->strinfo[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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
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; }
|
||||
if ( !found ) { return NULL; }
|
||||
|
||||
// now, select the charmap for the face object
|
||||
err = FT_Set_Charmap( face, found );
|
||||
if ( err ) { 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -353,7 +353,6 @@ unicodect uctabname[125] = {
|
||||
|
||||
{"Supp. Priv. A", "Supplementary Private Use Area-A", 0xf0000, 0xffffd},
|
||||
{"Supp. Priv. B", "Supplementary Private Use Area-B", 0x100000, 0x10fffd}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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 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 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 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 XKEY:
|
||||
if (G.qual & LR_CTRLKEY) {
|
||||
copyselection();
|
||||
killselection(0);
|
||||
doit= 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case CKEY:
|
||||
if (G.qual & LR_CTRLKEY) {
|
||||
copyselection();
|
||||
}
|
||||
break;
|
||||
case CKEY:
|
||||
if (G.qual & LR_CTRLKEY) {
|
||||
copyselection();
|
||||
}
|
||||
break;
|
||||
|
||||
case VKEY:
|
||||
if (G.qual & LR_CTRLKEY) {
|
||||
pasteselection();
|
||||
doit= 1;
|
||||
}
|
||||
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+filelen<MAXTEXT) {
|
||||
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;
|
||||
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,9 +1126,11 @@ 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);
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user