draw: Stop using a_tokenize
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
f61dca7068
commit
56fd77139e
24
draw.c
24
draw.c
|
@ -32,7 +32,6 @@
|
||||||
#include "globalconf.h"
|
#include "globalconf.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
|
||||||
#include "common/tokenize.h"
|
|
||||||
#include "common/xutil.h"
|
#include "common/xutil.h"
|
||||||
|
|
||||||
/** Convert text from any charset to UTF-8 using iconv.
|
/** Convert text from any charset to UTF-8 using iconv.
|
||||||
|
@ -366,21 +365,22 @@ draw_text_extents(draw_text_context_t *data)
|
||||||
/** Transform a string to a alignment_t type.
|
/** Transform a string to a alignment_t type.
|
||||||
* Recognized string are flex, fixed, left, center, middle or right.
|
* Recognized string are flex, fixed, left, center, middle or right.
|
||||||
* \param align A string with align text.
|
* \param align A string with align text.
|
||||||
* \param len The string length.
|
|
||||||
* \return An alignment_t type.
|
* \return An alignment_t type.
|
||||||
*/
|
*/
|
||||||
alignment_t
|
alignment_t
|
||||||
draw_align_fromstr(const char *align, ssize_t len)
|
draw_align_fromstr(const char *align)
|
||||||
{
|
{
|
||||||
switch(a_tokenize(align, len))
|
if(a_strcmp(align, "center") == 0)
|
||||||
{
|
return AlignCenter;
|
||||||
case A_TK_CENTER: return AlignCenter;
|
if(a_strcmp(align, "right") == 0)
|
||||||
case A_TK_RIGHT: return AlignRight;
|
return AlignRight;
|
||||||
case A_TK_TOP: return AlignTop;
|
if(a_strcmp(align, "top") == 0)
|
||||||
case A_TK_BOTTOM: return AlignBottom;
|
return AlignTop;
|
||||||
case A_TK_MIDDLE: return AlignMiddle;
|
if(a_strcmp(align, "bottom") == 0)
|
||||||
default: return AlignLeft;
|
return AlignBottom;
|
||||||
}
|
if(a_strcmp(align, "middle") == 0)
|
||||||
|
return AlignMiddle;
|
||||||
|
return AlignLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Transform an alignment to a string.
|
/** Transform an alignment to a string.
|
||||||
|
|
2
draw.h
2
draw.h
|
@ -130,7 +130,7 @@ void draw_rectangle(draw_context_t *, area_t, float, bool, const color_t *);
|
||||||
void draw_image(draw_context_t *, int, int, double, image_t *);
|
void draw_image(draw_context_t *, int, int, double, image_t *);
|
||||||
void draw_rotate(draw_context_t *, xcb_drawable_t, xcb_drawable_t, int, int, int, int, double, int, int);
|
void draw_rotate(draw_context_t *, xcb_drawable_t, xcb_drawable_t, int, int, int, int, double, int, int);
|
||||||
area_t draw_text_extents(draw_text_context_t *);
|
area_t draw_text_extents(draw_text_context_t *);
|
||||||
alignment_t draw_align_fromstr(const char *, ssize_t);
|
alignment_t draw_align_fromstr(const char *);
|
||||||
const char *draw_align_tostr(alignment_t);
|
const char *draw_align_tostr(alignment_t);
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
|
|
@ -332,8 +332,8 @@ luaA_textbox_newindex(lua_State *L, const char *prop)
|
||||||
|
|
||||||
if(a_strcmp(prop, "bg_align") == 0)
|
if(a_strcmp(prop, "bg_align") == 0)
|
||||||
{
|
{
|
||||||
buf = luaL_checklstring(L, 3, &len);
|
buf = luaL_checkstring(L, 3);
|
||||||
d->bg_align = draw_align_fromstr(buf, len);
|
d->bg_align = draw_align_fromstr(buf);
|
||||||
}
|
}
|
||||||
else if(a_strcmp(prop, "bg_resize") == 0)
|
else if(a_strcmp(prop, "bg_resize") == 0)
|
||||||
d->bg_resize = luaA_checkboolean(L, 3);
|
d->bg_resize = luaA_checkboolean(L, 3);
|
||||||
|
@ -352,13 +352,13 @@ luaA_textbox_newindex(lua_State *L, const char *prop)
|
||||||
}
|
}
|
||||||
else if(a_strcmp(prop, "align") == 0)
|
else if(a_strcmp(prop, "align") == 0)
|
||||||
{
|
{
|
||||||
if((buf = luaL_checklstring(L, 3, &len)))
|
if((buf = luaL_checkstring(L, 3)))
|
||||||
d->align = draw_align_fromstr(buf, len);
|
d->align = draw_align_fromstr(buf);
|
||||||
}
|
}
|
||||||
else if(a_strcmp(prop, "valign") == 0)
|
else if(a_strcmp(prop, "valign") == 0)
|
||||||
{
|
{
|
||||||
if((buf = luaL_checklstring(L, 3, &len)))
|
if((buf = luaL_checkstring(L, 3)))
|
||||||
d->valign = draw_align_fromstr(buf, len);
|
d->valign = draw_align_fromstr(buf);
|
||||||
}
|
}
|
||||||
else if(a_strcmp(prop, "border_color") == 0)
|
else if(a_strcmp(prop, "border_color") == 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue