1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

remove drawstring plugins

This commit is contained in:
id
2001-01-06 18:54:15 +00:00
parent 142db0ae2a
commit 8fb5a4c7fe
15 changed files with 2 additions and 1080 deletions

View File

@@ -421,45 +421,23 @@ SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y)
char*
#ifdef DRAWSTRING_PLUGIN
ShrinkString(WMFont *font, char *string, int width, WFunction *func)
#else
ShrinkString(WMFont *font, char *string, int width)
#endif
{
int w, w1=0;
int p;
char *pos;
char *text;
int p1, p2, t;
#ifdef DRAWSTRING_PLUGIN
WPluginData *pd;
#endif
if (wPreferences.multi_byte_text)
return wstrdup(string);
p = strlen(string);
#ifdef DRAWSTRING_PLUGIN
if (func) {
pd = wPluginPackData(1, func->data);
func->proc.widthOfString[W_DSPROC_WIDTHOFSTRING](
string, strlen(string), pd, &w, NULL, NULL);
} else w = WMWidthOfString(font, string, p);
#else
w = WMWidthOfString(font, string, p);
#endif
text = wmalloc(strlen(string)+8);
strcpy(text, string);
if (w<=width)
#ifdef DRAWSTRING_PLUGIN
{
if (func) wfree(pd);
return text;
}
#else
return text;
#endif
pos = strchr(text, ' ');
if (!pos)
@@ -468,14 +446,7 @@ ShrinkString(WMFont *font, char *string, int width)
if (pos) {
*pos = 0;
p = strlen(text);
#ifdef DRAWSTRING_PLUGIN
if (func) {
func->proc.widthOfString[W_DSPROC_WIDTHOFSTRING](
text, strlen(text), pd, &w1, NULL, NULL);
} else w1 = WMWidthOfString(font, text, p);
#else
w1 = WMWidthOfString(font, text, p);
#endif
if (w1 > width) {
w1 = 0;
p = 0;
@@ -492,28 +463,13 @@ ShrinkString(WMFont *font, char *string, int width)
*text=0;
}
strcat(text, "...");
#ifdef DRAWSTRING_PLUGIN
if (func) {
func->proc.widthOfString[W_DSPROC_WIDTHOFSTRING](
"...", 3, pd, &w1, NULL, NULL);
} else w1 = WMWidthOfString(font, "...", 3);
width -= w1;
#else
width -= WMWidthOfString(font, "...", 3);
#endif
pos = string;
p1=0;
p2=p;
t = (p2-p1)/2;
while (p2>p1 && p1!=t) {
#ifdef DRAWSTRING_PLUGIN
if (func) {
func->proc.widthOfString[W_DSPROC_WIDTHOFSTRING](
&string[p-t], t, pd, &w, NULL, NULL);
} else w = WMWidthOfString(font, &string[p-t], t);
#else
w = WMWidthOfString(font, &string[p-t], t);
#endif
if (w>width) {
p2 = t;
t = p1+(p2-p1)/2;
@@ -523,9 +479,6 @@ ShrinkString(WMFont *font, char *string, int width)
} else
p2=p1=t;
}
#ifdef DRAWSTRING_PLUGIN
if (func) wfree(pd);
#endif
strcat(text, &string[p-p1]);
return text;