mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-30 02:58:26 +08:00
edit support bidi
This commit is contained in:
parent
e255484468
commit
8002d6db23
@ -114,6 +114,15 @@
|
||||
</button>
|
||||
|
||||
<edit selected_fg_color="#020202" selected_text_color="#010101" selected_bg_color="#b5d7fd">
|
||||
<style name="bidi" border_color="#a0a0a0" text_color="black" text_align_h="left" font_name="trado">
|
||||
<normal bg_color="#f0f0f0" />
|
||||
<focused bg_color="#f0f0f0" border_color="black"/>
|
||||
<disable bg_color="gray" text_color="#d0d0d0" />
|
||||
<changed bg_color="#f0f0f0" text_color="#ee0000" />
|
||||
<error bg_color="#f0f0f0" text_color="red" />
|
||||
<empty bg_color="#f0f0f0" text_color="#a0a0a0" />
|
||||
<empty_focus bg_color="#f0f0f0" text_color="#a0a0a0" border_color="black"/>
|
||||
</style>
|
||||
<style name="default" border_color="#a0a0a0" text_color="black" text_align_h="left">
|
||||
<normal bg_color="#f0f0f0" />
|
||||
<focused bg_color="#f0f0f0" border_color="black"/>
|
||||
|
@ -94,6 +94,10 @@
|
||||
<spin_box w="70%" right_margin="16" tips="uint(0-150) auto_fix" input_type="uint" min="0" max="150" step="1" auto_fix="true" style="number" />
|
||||
</list_item>
|
||||
|
||||
<list_item style="empty" children_layout="default(r=1,c=0,ym=1)">
|
||||
<label w="30%" text="الصين" style.font_name="trado"/>
|
||||
<edit w="70%" style="line" tips="bidi" text="الصين" action_text="done" style="bidi"/>
|
||||
</list_item>
|
||||
</scroll_view>
|
||||
<scroll_bar_d name="bar" x="right" y="0" w="12" h="100%" value="0"/>
|
||||
</list_view>
|
||||
|
@ -7,6 +7,7 @@
|
||||
* object\_array 添加事件触发,用于mvvm更新界面,并且在 set\_prop 和 get\_prop 函数中增加路径处理,向下查找一层,以便 mvvm 列表渲染逐层访问属性(感谢雨欣提供补丁)
|
||||
* 增加WITHOUT_FSCRIPT,方便低端平台禁用fscript(感谢智明提供补丁)
|
||||
* object\_array/object\_default增加exec/can\_exec(感谢雨欣提供补丁)
|
||||
* edit显示支持bidi。
|
||||
|
||||
2021/09/09
|
||||
* fscript增加json\_save\_to\_string(感谢雨欣提供补丁)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
TK_CONST_DATA_ALIGN(const unsigned char ui_edit[]) = {
|
||||
0x04,0x00,0x01,0x01,0x99,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x65,0x64,0x69,0x74,0x00,0x00,0x00,0x00,
|
||||
0x04,0x00,0x01,0x01,0xfe,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x65,0x64,0x69,0x74,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x12,0x12,0x22,0x11,0x77,0x69,0x6e,0x64,0x6f,0x77,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
@ -393,16 +393,34 @@ TK_CONST_DATA_ALIGN(const unsigned char ui_edit[]) = {
|
||||
0x00,0x75,0x69,0x6e,0x74,0x28,0x30,0x2d,0x31,0x35,0x30,0x29,0x20,0x61,0x75,0x74,0x6f,0x5f,0x66,0x69,
|
||||
0x78,0x00,0x6d,0x69,0x6e,0x00,0x30,0x00,0x6d,0x61,0x78,0x00,0x31,0x35,0x30,0x00,0x73,0x74,0x65,0x70,
|
||||
0x00,0x31,0x00,0x61,0x75,0x74,0x6f,0x5f,0x66,0x69,0x78,0x00,0x74,0x72,0x75,0x65,0x00,0x73,0x74,0x79,
|
||||
0x6c,0x65,0x00,0x6e,0x75,0x6d,0x62,0x65,0x72,0x00,0x00,0x00,0x00,0x00,0x73,0x63,0x72,0x6f,0x6c,0x6c,
|
||||
0x5f,0x62,0x61,0x72,0x5f,0x64,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x64,0x00,
|
||||
0x00,0x00,0x73,0x65,0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,
|
||||
0x74,0x28,0x78,0x3d,0x72,0x69,0x67,0x68,0x74,0x2c,0x79,0x3d,0x30,0x2c,0x77,0x3d,0x31,0x32,0x2c,0x68,
|
||||
0x3d,0x31,0x30,0x30,0x25,0x29,0x00,0x6e,0x61,0x6d,0x65,0x00,0x62,0x61,0x72,0x00,0x76,0x61,0x6c,0x75,
|
||||
0x65,0x00,0x30,0x00,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x6c,0x65,0x00,0x6e,0x75,0x6d,0x62,0x65,0x72,0x00,0x00,0x00,0x00,0x6c,0x69,0x73,0x74,0x5f,0x69,0x74,
|
||||
0x65,0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x73,0x65,0x6c,0x66,0x5f,
|
||||
0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x63,0x65,0x6e,
|
||||
0x74,0x65,0x72,0x2c,0x79,0x3d,0x62,0x6f,0x74,0x74,0x6f,0x6d,0x3a,0x31,0x30,0x2c,0x77,0x3d,0x32,0x35,
|
||||
0x25,0x2c,0x68,0x3d,0x33,0x30,0x29,0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x6c,0x6f,0x73,0x65,0x00,0x74,
|
||||
0x65,0x78,0x74,0x00,0x43,0x6c,0x6f,0x73,0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*8137*/
|
||||
0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x65,0x6d,0x70,0x74,0x79,0x00,0x63,0x68,0x69,0x6c,0x64,0x72,0x65,
|
||||
0x6e,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x72,0x3d,0x31,
|
||||
0x2c,0x63,0x3d,0x30,0x2c,0x79,0x6d,0x3d,0x31,0x29,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x73,0x65,0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,
|
||||
0x77,0x3d,0x33,0x30,0x25,0x29,0x00,0x74,0x65,0x78,0x74,0x00,0xd8,0xa7,0xd9,0x84,0xd8,0xb5,0xd9,0x8a,
|
||||
0xd9,0x86,0x00,0x73,0x74,0x79,0x6c,0x65,0x2e,0x66,0x6f,0x6e,0x74,0x5f,0x6e,0x61,0x6d,0x65,0x00,0x74,
|
||||
0x72,0x61,0x64,0x6f,0x00,0x00,0x00,0x65,0x64,0x69,0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x65,0x6c,0x66,0x5f,
|
||||
0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x77,0x3d,0x37,0x30,0x25,
|
||||
0x29,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x6c,0x69,0x6e,0x65,0x00,0x74,0x69,0x70,0x73,0x00,0x62,0x69,
|
||||
0x64,0x69,0x00,0x74,0x65,0x78,0x74,0x00,0xd8,0xa7,0xd9,0x84,0xd8,0xb5,0xd9,0x8a,0xd9,0x86,0x00,0x61,
|
||||
0x63,0x74,0x69,0x6f,0x6e,0x5f,0x74,0x65,0x78,0x74,0x00,0x64,0x6f,0x6e,0x65,0x00,0x73,0x74,0x79,0x6c,
|
||||
0x65,0x00,0x62,0x69,0x64,0x69,0x00,0x00,0x00,0x00,0x00,0x73,0x63,0x72,0x6f,0x6c,0x6c,0x5f,0x62,0x61,
|
||||
0x72,0x5f,0x64,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x73,
|
||||
0x65,0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,
|
||||
0x3d,0x72,0x69,0x67,0x68,0x74,0x2c,0x79,0x3d,0x30,0x2c,0x77,0x3d,0x31,0x32,0x2c,0x68,0x3d,0x31,0x30,
|
||||
0x30,0x25,0x29,0x00,0x6e,0x61,0x6d,0x65,0x00,0x62,0x61,0x72,0x00,0x76,0x61,0x6c,0x75,0x65,0x00,0x30,
|
||||
0x00,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x73,0x65,0x6c,0x66,0x5f,0x6c,0x61,0x79,
|
||||
0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x63,0x65,0x6e,0x74,0x65,0x72,
|
||||
0x2c,0x79,0x3d,0x62,0x6f,0x74,0x74,0x6f,0x6d,0x3a,0x31,0x30,0x2c,0x77,0x3d,0x32,0x35,0x25,0x2c,0x68,
|
||||
0x3d,0x33,0x30,0x29,0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x6c,0x6f,0x73,0x65,0x00,0x74,0x65,0x78,0x74,
|
||||
0x00,0x43,0x6c,0x6f,0x73,0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*8494*/
|
||||
|
Binary file not shown.
Binary file not shown.
@ -25,6 +25,7 @@
|
||||
#include "tkc/utf8.h"
|
||||
#include "tkc/utils.h"
|
||||
#include "tkc/darray.h"
|
||||
#include "base/bidi.h"
|
||||
#include "base/line_parser.h"
|
||||
#include "base/events.h"
|
||||
#include "base/text_edit.h"
|
||||
@ -642,10 +643,11 @@ static int32_t text_edit_calc_x(text_edit_t* text_edit, line_info_t* iter) {
|
||||
|
||||
static ret_t text_edit_paint_line(text_edit_t* text_edit, canvas_t* c, line_info_t* iter,
|
||||
uint32_t y) {
|
||||
bidi_t b;
|
||||
uint32_t x = 0;
|
||||
uint32_t k = 0;
|
||||
widget_t* widget = text_edit->widget;
|
||||
|
||||
const char* bidi_type = widget_get_bidi(widget);
|
||||
DECL_IMPL(text_edit);
|
||||
wstr_t* text = &(widget->text);
|
||||
style_t* style = widget->astyle;
|
||||
@ -666,9 +668,12 @@ static ret_t text_edit_paint_line(text_edit_t* text_edit, canvas_t* c, line_info
|
||||
x = layout_info->margin_l;
|
||||
}
|
||||
|
||||
bidi_init(&b, FALSE, FALSE, bidi_type_from_name(bidi_type));
|
||||
ENSURE(bidi_log2vis(&b, text->str + iter->offset, iter->length) == RET_OK);
|
||||
|
||||
for (k = 0; k < iter->length; k++) {
|
||||
uint32_t offset = iter->offset + k;
|
||||
wchar_t chr = impl->mask ? impl->mask_char : text->str[offset];
|
||||
wchar_t chr = impl->mask ? impl->mask_char : b.vis_str[k];
|
||||
uint32_t char_w = canvas_measure_text(c, &chr, 1);
|
||||
|
||||
if ((x + char_w) < view_left) {
|
||||
@ -713,6 +718,7 @@ static ret_t text_edit_paint_line(text_edit_t* text_edit, canvas_t* c, line_info
|
||||
x += char_w + CHAR_SPACING;
|
||||
}
|
||||
}
|
||||
bidi_deinit(&b);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user