mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2025-12-31 06:30:52 +00:00
fix utf8 handling
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@792 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -303,7 +303,7 @@ int MwTextWidth(MwWidget handle, const char* text) {
|
||||
(void)handle;
|
||||
|
||||
#endif
|
||||
return strlen(text) * FontWidth;
|
||||
return MwUTF8Length(text) * FontWidth;
|
||||
}
|
||||
|
||||
int MwTextHeight(MwWidget handle, const char* text) {
|
||||
|
||||
@@ -88,12 +88,12 @@ static void draw(MwWidget handle) {
|
||||
rt.height = rt.width;
|
||||
|
||||
rt.y = r.y;
|
||||
if(MwGetInteger(handle, MwNshowArrows)){
|
||||
if(MwGetInteger(handle, MwNshowArrows)) {
|
||||
MwDrawTriangle(handle, &rt, base, (handle->pressed && scr->point.y <= uy) ? 1 : 0, MwNORTH);
|
||||
if(handle->pressed && scr->point.y <= uy) {
|
||||
add_value(handle, -1);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
rt.height = 0;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ static void draw(MwWidget handle) {
|
||||
rbar.y = r.y + rt.height + calc_position(handle);
|
||||
|
||||
rt.y = r.y + r.height - rt.height;
|
||||
if(MwGetInteger(handle, MwNshowArrows)){
|
||||
if(MwGetInteger(handle, MwNshowArrows)) {
|
||||
MwDrawTriangle(handle, &rt, base, (handle->pressed && scr->point.y >= dy) ? 1 : 0, MwSOUTH);
|
||||
if(handle->pressed && scr->point.y >= dy) {
|
||||
add_value(handle, 1);
|
||||
@@ -113,12 +113,12 @@ static void draw(MwWidget handle) {
|
||||
rt.width = rt.height;
|
||||
|
||||
rt.x = r.x;
|
||||
if(MwGetInteger(handle, MwNshowArrows)){
|
||||
if(MwGetInteger(handle, MwNshowArrows)) {
|
||||
MwDrawTriangle(handle, &rt, base, (handle->pressed && scr->point.x <= ux) ? 1 : 0, MwWEST);
|
||||
if(handle->pressed && scr->point.x <= ux) {
|
||||
add_value(handle, -1);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
rt.width = 0;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ static void draw(MwWidget handle) {
|
||||
rbar.y = r.y;
|
||||
|
||||
rt.x = r.x + r.width - rt.width;
|
||||
if(MwGetInteger(handle, MwNshowArrows)){
|
||||
if(MwGetInteger(handle, MwNshowArrows)) {
|
||||
MwDrawTriangle(handle, &rt, base, (handle->pressed && scr->point.x >= dx) ? 1 : 0, MwEAST);
|
||||
if(handle->pressed && scr->point.x >= dx) {
|
||||
add_value(handle, 1);
|
||||
@@ -230,7 +230,7 @@ static void prop_change(MwWidget handle, const char* key) {
|
||||
if(MwGetInteger(handle, MwNvalue) > MwGetInteger(handle, MwNmaxValue)) MwSetInteger(handle, MwNvalue, MwGetInteger(handle, MwNmaxValue));
|
||||
MwForceRender(handle);
|
||||
}
|
||||
if(strcmp(key, MwNshowArrows) == 0 || strcmp(key, MwNareaShown) == 0){
|
||||
if(strcmp(key, MwNshowArrows) == 0 || strcmp(key, MwNareaShown) == 0) {
|
||||
MwForceRender(handle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,8 +373,8 @@ static void free_all(MwTreeViewEntry** tree) {
|
||||
|
||||
static void mwTreeViewDeleteImpl(MwWidget handle, void* item) {
|
||||
MwTreeView tv = handle->internal;
|
||||
MwTreeViewEntry* e = item;
|
||||
MwTreeViewEntry* p = e->parent;
|
||||
MwTreeViewEntry* e = item;
|
||||
MwTreeViewEntry* p = e->parent;
|
||||
|
||||
(void)handle;
|
||||
|
||||
@@ -402,7 +402,7 @@ static const char* mwTreeViewGetImpl(MwWidget handle, void* item) {
|
||||
|
||||
static void mwTreeViewSetLabelImpl(MwWidget handle, void* item, const char* label) {
|
||||
MwTreeView tv = handle->internal;
|
||||
MwTreeViewEntry* e = item;
|
||||
MwTreeViewEntry* e = item;
|
||||
|
||||
free(e->label);
|
||||
e->label = MwStringDuplicate(label);
|
||||
@@ -415,7 +415,7 @@ static void mwTreeViewSetLabelImpl(MwWidget handle, void* item, const char* labe
|
||||
|
||||
static void mwTreeViewSetPixmapImpl(MwWidget handle, void* item, MwLLPixmap pixmap) {
|
||||
MwTreeView tv = handle->internal;
|
||||
MwTreeViewEntry* e = item;
|
||||
MwTreeViewEntry* e = item;
|
||||
|
||||
e->pixmap = pixmap;
|
||||
|
||||
@@ -427,7 +427,7 @@ static void mwTreeViewSetPixmapImpl(MwWidget handle, void* item, MwLLPixmap pixm
|
||||
|
||||
static void mwTreeViewSetOpenedImpl(MwWidget handle, void* item, int opened) {
|
||||
MwTreeView tv = handle->internal;
|
||||
MwTreeViewEntry* e = item;
|
||||
MwTreeViewEntry* e = item;
|
||||
|
||||
e->opened = opened;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user