Added new macros: @pad{FAN}{T}
This commit is contained in:
parent
c4dfe7c502
commit
f97fff8524
@ -10,6 +10,15 @@ ______________________________________________________________________
|
|||||||
Notes for GoldED+ 1.1.5, /snapshot/
|
Notes for GoldED+ 1.1.5, /snapshot/
|
||||||
______________________________________________________________________
|
______________________________________________________________________
|
||||||
|
|
||||||
|
+ Added new macros: @pad{FAN}{T}
|
||||||
|
|
||||||
|
Where: F - a fill char, that will be used when length(T) < N
|
||||||
|
A - type of text alignment (C - center, L - left, R - right)
|
||||||
|
N - size of pad area (N >= 0)
|
||||||
|
T - any text and/or macroses without parameters
|
||||||
|
|
||||||
|
Example: @pad{=C79}{ @OEcho (@ODesc) }
|
||||||
|
|
||||||
- Pick string windows will be resized to title length also.
|
- Pick string windows will be resized to title length also.
|
||||||
|
|
||||||
+ Added @daddr to built-in template for netmail areas.
|
+ Added @daddr to built-in template for netmail areas.
|
||||||
|
@ -420,6 +420,54 @@ char* TokenXlat(int mode, char* input, GMsg* msg, GMsg* oldmsg, int __origarea)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *ptr1, *ptr2;
|
||||||
|
if (strnieql(dst, "@pad{", 5) &&
|
||||||
|
((ptr1 = strstr(dst+5, "}{")) != NULL) &&
|
||||||
|
((ptr1-dst-5) > 2) &&
|
||||||
|
((ptr2 = strchr(ptr1+2, '}')) != NULL)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
char buff[1024];
|
||||||
|
char token[1024];
|
||||||
|
char fill = dst[5];
|
||||||
|
char align = toupper(dst[6]);
|
||||||
|
int size = atoi(dst+7);
|
||||||
|
|
||||||
|
if (strchr("CLR", align))
|
||||||
|
{
|
||||||
|
memcpy(token, dst, ptr2-dst+1);
|
||||||
|
memcpy(buff, ptr1+2, ptr2-ptr1-2);
|
||||||
|
token[ptr2-dst+1] = buff[ptr2-ptr1-2] = 0;
|
||||||
|
|
||||||
|
TokenXlat(mode, buff, msg, oldmsg, __origarea);
|
||||||
|
buff[size] = 0;
|
||||||
|
|
||||||
|
size_t length = strlen(buff);
|
||||||
|
if (length != size)
|
||||||
|
{
|
||||||
|
size_t diff = size - length;
|
||||||
|
switch (align)
|
||||||
|
{
|
||||||
|
case 'C':
|
||||||
|
memmove(&buff[diff/2], buff, length);
|
||||||
|
memset(buff, fill, diff/2);
|
||||||
|
memset(&buff[diff/2+length], fill, diff-diff/2);
|
||||||
|
break;
|
||||||
|
case 'L':
|
||||||
|
memset(&buff[length], fill, diff);
|
||||||
|
break;
|
||||||
|
case 'R':
|
||||||
|
memmove(&buff[diff], buff, length);
|
||||||
|
memset(buff, fill, diff);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tokenxchg(dst, token, buff))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dst++;
|
dst++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user