Skip to content

Commit

Permalink
improve assets1m
Browse files Browse the repository at this point in the history
  • Loading branch information
xianjimli committed Dec 4, 2023
1 parent 67704d6 commit b6f20e8
Show file tree
Hide file tree
Showing 23 changed files with 101 additions and 1,067 deletions.
192 changes: 94 additions & 98 deletions demos/assets-1m.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
#include "../res/assets/default/inc/strings/en_US.data"
#include "../res/assets/default/inc/styles/dialog_toast.data"
#include "../res/assets/default/inc/styles/uiex.data"
#include "../res/assets/default/inc/styles/uiex_dialog_confirm.data"
#include "../res/assets/default/inc/styles/uiex_dialog_info.data"
#include "../res/assets/default/inc/styles/uiex_dialog_warn.data"
#include "../res/assets/default/inc/styles/uiex_dialog.data"
#include "../res/assets/default/inc/styles/uiex_keyboard.data"
#include "../res/assets/default/inc/ui/uiex/dlg_center_scale.data"
#include "../res/assets/default/inc/ui/uiex/dlg_fade.data"
Expand Down Expand Up @@ -120,104 +118,102 @@ ret_t assets_init_default(void) {
assets_manager_preload(am, ASSET_TYPE_FONT, "default");
assets_manager_preload(am, ASSET_TYPE_STYLE, "default");
#else
assets_manager_add(am, strings_en_US);
assets_manager_add(am, style_dialog_toast);
assets_manager_add(am, style_uiex);
assets_manager_add(am, style_uiex_dialog_confirm);
assets_manager_add(am, style_uiex_dialog_info);
assets_manager_add(am, style_uiex_dialog_warn);
assets_manager_add(am, style_uiex_keyboard);
assets_manager_add(am, ui_uiex_dlg_center_scale);
assets_manager_add(am, ui_uiex_dlg_fade);
assets_manager_add(am, ui_uiex_dlg_popdown);
assets_manager_add(am, ui_uiex_dlg_popup);
assets_manager_add(am, ui_uiex_htranslate);
assets_manager_add(am, ui_uiex_kb_ascii);
assets_manager_add(am, ui_uiex_kb_default);
assets_manager_add(am, ui_uiex_kb_foo);
assets_manager_add(am, ui_uiex_kb_uint);
assets_manager_add(am, ui_uiex_menu_bar);
assets_manager_add(am, ui_uiex_menu_landscape);
assets_manager_add(am, ui_uiex_overlay);
assets_manager_add(am, ui_uiex_page_animate);
assets_manager_add(am, ui_uiex_page_button);
assets_manager_add(am, ui_uiex_page_chart);
assets_manager_add(am, ui_uiex_page_checkbox);
assets_manager_add(am, ui_uiex_page_color);
assets_manager_add(am, ui_uiex_page_date_time);
assets_manager_add(am, ui_uiex_page_edit);
assets_manager_add(am, ui_uiex_page_label);
assets_manager_add(am, ui_uiex_page_layout);
assets_manager_add(am, ui_uiex_page_mledit);
assets_manager_add(am, ui_uiex_page_progress);
assets_manager_add(am, ui_uiex_page_selector);
assets_manager_add(am, ui_uiex_page_slider);
assets_manager_add(am, ui_uiex_page_tab_ctrl);
assets_manager_add(am, ui_uiex_page_window);
assets_manager_add(am, ui_uiex_popup);
assets_manager_add(am, ui_uiex_preload);
assets_manager_add(am, ui_uiex_sysbar_landscape);
assets_manager_add(am, ui_uiex_sysbar_portrait);
assets_manager_add(am, ui_uiex_vtranslate);
assets_manager_add(am, image_uiex_arrow_down_n);
assets_manager_add(am, image_uiex_arrow_down_p);
assets_manager_add(am, image_uiex_arrow_up_n);
assets_manager_add(am, image_uiex_arrow_up_p);
assets_manager_add(am, image_uiex_Boot_loading);
assets_manager_add(am, image_uiex_button_Empty);
assets_manager_add(am, image_uiex_button_Export);
assets_manager_add(am, image_uiex_button_Import);
assets_manager_add(am, image_uiex_button_search);
assets_manager_add(am, image_uiex_button_time);
assets_manager_add(am, image_uiex_check);
assets_manager_add(am, image_uiex_check_checked_d);
assets_manager_add(am, image_uiex_check_checked_n);
assets_manager_add(am, image_uiex_check_checked_p);
assets_manager_add(am, image_uiex_check_d);
assets_manager_add(am, image_uiex_check_n);
assets_manager_add(am, image_uiex_check_p);
assets_manager_add(am, image_uiex_close_n);
assets_manager_add(am, image_uiex_close_p);
assets_manager_add(am, image_uiex_combobox_btn_d);
assets_manager_add(am, image_uiex_combobox_btn_n);
assets_manager_add(am, image_uiex_combobox_btn_p);
assets_manager_add(am, image_uiex_Coverwindow);
assets_manager_add(am, image_uiex_editor_bgcolor);
assets_manager_add(am, image_uiex_editor_Importpictures);
assets_manager_add(am, image_uiex_editor_TextAlignBoth);
assets_manager_add(am, image_uiex_editor_TextAlignleft);
assets_manager_add(am, image_uiex_editor_TextAlignright);
assets_manager_add(am, image_uiex_editor_TextBold);
assets_manager_add(am, image_uiex_editor_TextCenteralignment);
assets_manager_add(am, image_uiex_editor_Textcolor);
assets_manager_add(am, image_uiex_editor_TextItalic);
assets_manager_add(am, image_uiex_editor_TextLinespacing);
assets_manager_add(am, image_uiex_editor_TextUnderscore);
assets_manager_add(am, image_uiex_keyboard_backspace_n);
assets_manager_add(am, image_uiex_keyboard_backspace_p);
assets_manager_add(am, image_uiex_loading_repeat_bg);
assets_manager_add(am, image_uiex_logo);
assets_manager_add(am, image_uiex_Portraitmenu_n);
assets_manager_add(am, image_uiex_Portraitmenu_p);
assets_manager_add(am, image_uiex_radio_checked_d);
assets_manager_add(am, image_uiex_radio_checked_n);
assets_manager_add(am, image_uiex_radio_checked_p);
assets_manager_add(am, image_uiex_radio_d);
assets_manager_add(am, image_uiex_radio_n);
assets_manager_add(am, image_uiex_radio_p);
assets_manager_add(am, image_uiex_shift);
assets_manager_add(am, image_uiex_shifton);
assets_manager_add(am, image_uiex_Sliding_dot);
assets_manager_add(am, image_uiex_Sliding_Square);
assets_manager_add(am, image_uiex_switch);
assets_manager_add(am, image_uiex_texteditorhide);
assets_manager_add(am, image_uiex_texteditor_show);
assets_manager_add(am, image_uiex_Windowclosed_n);
assets_manager_add(am, image_uiex_Windowclosed_p);
assets_manager_add(am, strings_en_US_default);
assets_manager_add(am, style_dialog_toast_default);
assets_manager_add(am, style_uiex_default);
assets_manager_add(am, style_uiex_dialog_default);
assets_manager_add(am, style_uiex_keyboard_default);
assets_manager_add(am, ui_dlg_center_scale_default_uiex);
assets_manager_add(am, ui_dlg_fade_default_uiex);
assets_manager_add(am, ui_dlg_popdown_default_uiex);
assets_manager_add(am, ui_dlg_popup_default_uiex);
assets_manager_add(am, ui_htranslate_default_uiex);
assets_manager_add(am, ui_kb_ascii_default_uiex);
assets_manager_add(am, ui_kb_default_default_uiex);
assets_manager_add(am, ui_kb_foo_default_uiex);
assets_manager_add(am, ui_kb_uint_default_uiex);
assets_manager_add(am, ui_menu_bar_default_uiex);
assets_manager_add(am, ui_menu_landscape_default_uiex);
assets_manager_add(am, ui_overlay_default_uiex);
assets_manager_add(am, ui_page_animate_default_uiex);
assets_manager_add(am, ui_page_button_default_uiex);
assets_manager_add(am, ui_page_chart_default_uiex);
assets_manager_add(am, ui_page_checkbox_default_uiex);
assets_manager_add(am, ui_page_color_default_uiex);
assets_manager_add(am, ui_page_date_time_default_uiex);
assets_manager_add(am, ui_page_edit_default_uiex);
assets_manager_add(am, ui_page_label_default_uiex);
assets_manager_add(am, ui_page_layout_default_uiex);
assets_manager_add(am, ui_page_mledit_default_uiex);
assets_manager_add(am, ui_page_progress_default_uiex);
assets_manager_add(am, ui_page_selector_default_uiex);
assets_manager_add(am, ui_page_slider_default_uiex);
assets_manager_add(am, ui_page_tab_ctrl_default_uiex);
assets_manager_add(am, ui_page_window_default_uiex);
assets_manager_add(am, ui_popup_default_uiex);
assets_manager_add(am, ui_preload_default_uiex);
assets_manager_add(am, ui_sysbar_landscape_default_uiex);
assets_manager_add(am, ui_sysbar_portrait_default_uiex);
assets_manager_add(am, ui_vtranslate_default_uiex);
assets_manager_add(am, image_uiex_arrow_down_n_default);
assets_manager_add(am, image_uiex_arrow_down_p_default);
assets_manager_add(am, image_uiex_arrow_up_n_default);
assets_manager_add(am, image_uiex_arrow_up_p_default);
assets_manager_add(am, image_uiex_Boot_loading_default);
assets_manager_add(am, image_uiex_button_Empty_default);
assets_manager_add(am, image_uiex_button_Export_default);
assets_manager_add(am, image_uiex_button_Import_default);
assets_manager_add(am, image_uiex_button_search_default);
assets_manager_add(am, image_uiex_button_time_default);
assets_manager_add(am, image_uiex_check_default);
assets_manager_add(am, image_uiex_check_checked_d_default);
assets_manager_add(am, image_uiex_check_checked_n_default);
assets_manager_add(am, image_uiex_check_checked_p_default);
assets_manager_add(am, image_uiex_check_d_default);
assets_manager_add(am, image_uiex_check_n_default);
assets_manager_add(am, image_uiex_check_p_default);
assets_manager_add(am, image_uiex_close_n_default);
assets_manager_add(am, image_uiex_close_p_default);
assets_manager_add(am, image_uiex_combobox_btn_d_default);
assets_manager_add(am, image_uiex_combobox_btn_n_default);
assets_manager_add(am, image_uiex_combobox_btn_p_default);
assets_manager_add(am, image_uiex_Coverwindow_default);
assets_manager_add(am, image_uiex_editor_bgcolor_default);
assets_manager_add(am, image_uiex_editor_Importpictures_default);
assets_manager_add(am, image_uiex_editor_TextAlignBoth_default);
assets_manager_add(am, image_uiex_editor_TextAlignleft_default);
assets_manager_add(am, image_uiex_editor_TextAlignright_default);
assets_manager_add(am, image_uiex_editor_TextBold_default);
assets_manager_add(am, image_uiex_editor_TextCenteralignment_default);
assets_manager_add(am, image_uiex_editor_Textcolor_default);
assets_manager_add(am, image_uiex_editor_TextItalic_default);
assets_manager_add(am, image_uiex_editor_TextLinespacing_default);
assets_manager_add(am, image_uiex_editor_TextUnderscore_default);
assets_manager_add(am, image_uiex_keyboard_backspace_n_default);
assets_manager_add(am, image_uiex_keyboard_backspace_p_default);
assets_manager_add(am, image_uiex_loading_repeat_bg_default);
assets_manager_add(am, image_uiex_logo_default);
assets_manager_add(am, image_uiex_Portraitmenu_n_default);
assets_manager_add(am, image_uiex_Portraitmenu_p_default);
assets_manager_add(am, image_uiex_radio_checked_d_default);
assets_manager_add(am, image_uiex_radio_checked_n_default);
assets_manager_add(am, image_uiex_radio_checked_p_default);
assets_manager_add(am, image_uiex_radio_d_default);
assets_manager_add(am, image_uiex_radio_n_default);
assets_manager_add(am, image_uiex_radio_p_default);
assets_manager_add(am, image_uiex_shift_default);
assets_manager_add(am, image_uiex_shifton_default);
assets_manager_add(am, image_uiex_Sliding_dot_default);
assets_manager_add(am, image_uiex_Sliding_Square_default);
assets_manager_add(am, image_uiex_switch_default);
assets_manager_add(am, image_uiex_texteditorhide_default);
assets_manager_add(am, image_uiex_texteditor_show_default);
assets_manager_add(am, image_uiex_Windowclosed_n_default);
assets_manager_add(am, image_uiex_Windowclosed_p_default);
#ifdef WITH_VGCANVAS
#endif /*WITH_VGCANVAS*/
#ifdef WITH_TRUETYPE_FONT
assets_manager_add(am, font_default);
assets_manager_add(am, font_default_default);
#else /*WITH_TRUETYPE_FONT*/
#endif /*WITH_TRUETYPE_FONT*/
#endif
Expand Down
12 changes: 5 additions & 7 deletions demos/demo_ui_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ static ret_t on_change_theme(void* ctx, event_t* e) {
return change_theme(value_bool(&(evt->new_value)));
}

#define DIALOG_INFO_THEME THEME_NAME_PREFIX "dialog_info"
#define DIALOG_WARN_THEME THEME_NAME_PREFIX "dialog_warn"
#define DIALOG_CONFIRM_THEME THEME_NAME_PREFIX "dialog_confirm"
#define DIALOG_THEME THEME_NAME_PREFIX "dialog"
extern ret_t dialog_simple_show(const char* stitle, const char* scontent, const char* theme,
bool_t has_ok, bool_t has_cancel);

Expand Down Expand Up @@ -132,7 +130,7 @@ static widget_t* window_open_with_prefix(const char* name) {
}

static ret_t on_quit(void* ctx, event_t* e) {
ret_t ret = dialog_simple_show("Confirm", "Do you really want to exit?", DIALOG_CONFIRM_THEME,
ret_t ret = dialog_simple_show("Confirm", "Do you really want to exit?", DIALOG_THEME,
TRUE, TRUE);
if (RET_OK == ret) {
return tk_quit();
Expand Down Expand Up @@ -167,11 +165,11 @@ static ret_t on_open_window(void* ctx, event_t* e) {
if (tk_str_eq(name, "toast")) {
dialog_toast("Hello! AWTK.", 2000);
} else if (tk_str_eq(name, "info")) {
dialog_simple_show("info", "Hello! AWTK.", DIALOG_INFO_THEME, TRUE, FALSE);
dialog_simple_show("info", "Hello! AWTK.", DIALOG_THEME, TRUE, FALSE);
} else if (tk_str_eq(name, "warn")) {
dialog_simple_show("Warning", "Not sufficient funds!", DIALOG_WARN_THEME, TRUE, FALSE);
dialog_simple_show("Warning", "Not sufficient funds!", DIALOG_THEME, TRUE, FALSE);
} else if (tk_str_eq(name, "confirm")) {
dialog_simple_show("Confirm", "Are you ready?", DIALOG_CONFIRM_THEME, TRUE, TRUE);
dialog_simple_show("Confirm", "Are you ready?", DIALOG_THEME, TRUE, TRUE);
} else {
widget_t* target = widget_lookup(window_manager(), name, TRUE);

Expand Down
47 changes: 0 additions & 47 deletions design/dark/styles/uiex_dialog_info.xml
Original file line number Diff line number Diff line change
@@ -1,47 +0,0 @@
<label>
<style name="default" font_size="22">
<normal text_color="#ffffff" text_align_h="meddle"/>
</style>
</label>

<dialog>
<style name="default">
<normal bg_color="#262626" border_color="#00000000"/>
</style>
</dialog>

<dialog_client>
<style name="default">
<normal bg_color="#262626" border="left|right|bottom" border_color="#709918"/>
</style>
</dialog_client>

<dialog_title>
<style name="default">
<normal bg_color="#F5F5F5" border="left|right|top" border_color="#709918" font_size="22" margin_left="10" text_align_h="left" text_color="#000000"/>
</style>
</dialog_title>

<button>
<style name="default" bg_color="#404040" border_color="#707070" round_radius="4" text_color="#FFFFFF">
<normal/>
<disable bg_color="#40404066" border_color="#70707066" text_color="#FFFFFF66"/>
<focused/>
<over/>
<pressed bg_color="#709918" border_color="#00000000" x_offset="1" y_offset="1"/>
</style>
<style name="cancel" bg_color="#404040" border_color="#707070" round_radius="4" text_color="#FFFFFF">
<normal/>
<disable bg_color="#40404066" border_color="#70707066" text_color="#FFFFFF66"/>
<focused/>
<over/>
<pressed bg_color="#709918" border_color="#00000000" x_offset="1" y_offset="1"/>
</style>
<style name="ok" bg_color="#709918" border_color="#00000000" round_radius="4" text_color="#ffffff">
<normal/>
<disable bg_color="#70991866" text_color="#ffffff66"/>
<focused/>
<over/>
<pressed bg_color="#678c16" x_offset="1" y_offset="1"/>
</style>
</button>
47 changes: 0 additions & 47 deletions design/dark/styles/uiex_dialog_warn.xml
Original file line number Diff line number Diff line change
@@ -1,47 +0,0 @@
<label>
<style name="default" font_size="22">
<normal text_color="#ffffff" text_align_h="meddle"/>
</style>
</label>

<dialog>
<style name="default">
<normal bg_color="#262626" border_color="#00000000"/>
</style>
</dialog>

<dialog_client>
<style name="default">
<normal bg_color="#262626" border="left|right|bottom" border_color="#709918"/>
</style>
</dialog_client>

<dialog_title>
<style name="default">
<normal bg_color="#F5F5F5" border="left|right|top" border_color="#709918" font_size="22" margin_left="10" text_align_h="left" text_color="#000000"/>
</style>
</dialog_title>

<button>
<style name="default" bg_color="#404040" border_color="#707070" round_radius="4" text_color="#FFFFFF">
<normal/>
<disable bg_color="#40404066" border_color="#70707066" text_color="#FFFFFF66"/>
<focused/>
<over/>
<pressed bg_color="#709918" border_color="#00000000" x_offset="1" y_offset="1"/>
</style>
<style name="cancel" bg_color="#404040" border_color="#707070" round_radius="4" text_color="#FFFFFF">
<normal/>
<disable bg_color="#40404066" border_color="#70707066" text_color="#FFFFFF66"/>
<focused/>
<over/>
<pressed bg_color="#709918" border_color="#00000000" x_offset="1" y_offset="1"/>
</style>
<style name="ok" bg_color="#709918" border_color="#00000000" round_radius="4" text_color="#ffffff">
<normal/>
<disable bg_color="#70991866" text_color="#ffffff66"/>
<focused/>
<over/>
<pressed bg_color="#678c16" x_offset="1" y_offset="1"/>
</style>
</button>
47 changes: 0 additions & 47 deletions design/default/styles/uiex_dialog_info.xml
Original file line number Diff line number Diff line change
@@ -1,47 +0,0 @@
<label>
<style name="default" font_size="22">
<normal text_color="#333333" text_align_h="meddle"/>
</style>
</label>

<dialog>
<style name="default">
<normal bg_color="#f7f7f7" border_color="#00000000"/>
</style>
</dialog>

<dialog_client>
<style name="default">
<normal bg_color="#F7F7F7" border="left|right|bottom" border_color="#709918"/>
</style>
</dialog_client>

<dialog_title>
<style name="default">
<normal bg_color="#FFFFFF" border="left|right|top" border_color="#709918" font_size="22" margin_left="10" text_align_h="left" text_color="black"/>
</style>
</dialog_title>

<button>
<style name="default" bg_color="#ebebeb" border_color="#c2c2c2" font_size="22" round_radius="4" text_color="#000000">
<normal/>
<disable bg_color="#ebebeb66" border_color="#c2c2c266" text_color="#00000066"/>
<focused/>
<over/>
<pressed bg_color="#709918" border_color="#00000000" text_color="#FFFFFF" x_offset="1" y_offset="1"/>
</style>
<style name="cancel" bg_color="#ebebeb" border_color="#c2c2c2" font_size="22" round_radius="4" text_color="#000000">
<normal/>
<disable bg_color="#ebebeb66" border_color="#c2c2c266" text_color="#00000066"/>
<focused/>
<over/>
<pressed bg_color="#709918" border_color="#00000000" text_color="#FFFFFF" x_offset="1" y_offset="1"/>
</style>
<style name="ok" bg_color="#709918" border_color="#00000000" round_radius="4" text_color="#FFFFFF">
<normal/>
<disable bg_color="#70991866" text_color="#FFFFFF66"/>
<focused/>
<over/>
<pressed bg_color="#678C16" x_offset="1" y_offset="1"/>
</style>
</button>
Loading

0 comments on commit b6f20e8

Please sign in to comment.