From: Sungtaek Hong Date: Mon, 17 Oct 2016 07:39:04 +0000 (+0900) Subject: [Theme] update color_class(colorselector, entry, label) X-Git-Tag: submit/trunk/20170823.075128~110^2~247^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f7502d5ade29a9d54bc3b8eb45a6651017ed44f7;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [Theme] update color_class(colorselector, entry, label) Change-Id: I28ef858fd0c2171c758da5e6a0c16aaad9337198 --- diff --git a/src/ElmSharp/theme/mobile/HD-inc.edc b/src/ElmSharp/theme/mobile/HD-inc.edc index c252b92..f98fff3 100644 --- a/src/ElmSharp/theme/mobile/HD-inc.edc +++ b/src/ElmSharp/theme/mobile/HD-inc.edc @@ -47,5 +47,25 @@ #define COLORSELECTOR_PALETTE_COLORPLANE_WIDTH_INC 678 #define COLORSELECTOR_PORTRAIT_HOR_PAD_COLORPLANE_INC "8" #define COLORSELECTOR_PORTRAIT_VER_PAD_COLORPLANE_INC "8" -#define COLORSELECTOR_PALETTE_COLORBG_MIN_COLORPLANE_INC 90 90 #define COLORSELECTOR_TOPBOTTOM_PAD_COLORPLANE_INC 24 + +//****************************************************************************// +// Entry +//****************************************************************************// +#define ENTRY_PREEDIT_BACKGROUND_COLOR_INC "#000000" +#define ENTRY_PREEDIT_HIGHLIGHT_BACKGROUND_COLOR_INC "#8bd8ff99" +#define ENTRY_PREEDIT_TEXT_COLOR_INC "#FAFAFA" +#define ENTRY_PREEDIT_UNDERLINE_COLOR_INC "#000000" +#define ENTRY_PREEDIT_SUB1_COLOR_INC "#2EA8E1" +#define ENTRY_PREEDIT_SUB2_COLOR_INC "#9962C3" +#define ENTRY_PREEDIT_SUB3_COLOR_INC "#76DE37" +#define ENTRY_PREEDIT_SUB4_COLOR_INC "#999999" +#define ENTRY_LEFT_RIGHT_MARGIN_INC 5 +#define ENTRY_FONT_SIZE_INC 40 +#define ENTRY_CURSOR_SIZE_INC 3 0 + +//****************************************************************************// +// Label +//****************************************************************************// +#define LABEL_FONT_SIZE_INC 24 + diff --git a/src/ElmSharp/theme/mobile/color_classes.edc b/src/ElmSharp/theme/mobile/color_classes.edc index 7f458f5..726b914 100644 --- a/src/ElmSharp/theme/mobile/color_classes.edc +++ b/src/ElmSharp/theme/mobile/color_classes.edc @@ -1,6 +1,60 @@ color_classes { + /* + * Colorselector + */ color_class { - name: "elm/widget/colorselector/default/bg-default"; + name: "colorselector/default/bg"; color: 250 250 250 255; } + /* + * Entry + */ + color_class { "entry/default/text_edit"; + color: 0 0 0 255; + } + color_class { "entry/default/text_edit_focused"; + color: 0 0 0 255; + } + color_class { "entry/default/text_edit_disabled"; + color: 0 0 0 110; + } + color_class { "entry/default/text_guide"; + color: 0 0 0 145; + } + color_class { "entry/default/text_guide_focused"; + color: 0 0 0 145; + } + color_class { "entry/default/text_guide_disabled"; + color: 0 0 0 110; + } + color_class { + name: "entry/default/bg"; + color: 0 0 0 0; + } + color_class { "entry/default/cursor"; + color: 0 184 230 110; + } + /* + * Label + */ + color_class { + name: "label/default/bg"; + color: 0 0 0 0; + } + color_class { + name: "label/slide_long/bg"; + color: 0 0 0 0; + } + color_class { + name: "label/slide_short/bg"; + color: 0 0 0 0; + } + color_class { + name: "label/slide_roll/bg"; + color: 0 0 0 0; + } + color_class { + name: "label/slide_bounce/bg"; + color: 0 0 0 0; + } } diff --git a/src/ElmSharp/theme/mobile/elm-sharp-theme-mobile.edc b/src/ElmSharp/theme/mobile/elm-sharp-theme-mobile.edc index 82c7c94..c0b7a34 100644 --- a/src/ElmSharp/theme/mobile/elm-sharp-theme-mobile.edc +++ b/src/ElmSharp/theme/mobile/elm-sharp-theme-mobile.edc @@ -51,10 +51,41 @@ data.item: "version" "110"; collections { base_scale: BASE_SCALE_INC; + plugins { + plugin { + name: "touch_sound"; + source: "feedback"; + param: "FEEDBACK_TYPE_SOUND FEEDBACK_PATTERN_TAP"; // FEEDBACK_TYPE_SOUND, FEEDBACK_PATTERN_TOUCH_TAP + + /* 2014.06.11 updated from libsvi(feedback) + Above plugin will run below external function: + int feedback_play_type(feedback_type_e type, feedback_pattern_e pattern); + + param1: feedback_type_e + FEEDBACK_TYPE_NONE = 0, + FEEDBACK_TYPE_SOUND = 1, + FEEDBACK_TYPE_VIBRATION, + FEEDBACK_TYPE_LED, + FEEDBACK_TYPE_END + + * param2 enumeration: + FEEDBACK_PATTERN_TAP = 0, + FEEDBACK_PATTERN_SIP, + FEEDBACK_PATTERN_SIP_BACKSPACE, + FEEDBACK_PATTERN_SIP_FUNCTION, + FEEDBACK_PATTERN_SIP_FJKEY, + ... + + * For more information please refer libsvi. + */ + } + } #include "color_classes.edc" #include "widgets/colorselector.edc" +#include "widgets/entry.edc" +#include "widgets/label.edc" } diff --git a/src/ElmSharp/theme/mobile/widgets/colorselector.edc b/src/ElmSharp/theme/mobile/widgets/colorselector.edc index 8e18487..4ac5725 100644 --- a/src/ElmSharp/theme/mobile/widgets/colorselector.edc +++ b/src/ElmSharp/theme/mobile/widgets/colorselector.edc @@ -24,34 +24,29 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -group { - name: "elm/colorselector/palette/colorplane"; +group { "elm/colorselector/palette/colorplane"; alias: "elm/colorselector/palette/default"; data.item: "horizontal_pad" COLORSELECTOR_PORTRAIT_HOR_PAD_COLORPLANE_INC; data.item: "vertical_pad" COLORSELECTOR_PORTRAIT_VER_PAD_COLORPLANE_INC; parts { - part { name: "base"; - type: SPACER; - scale: 1; - description { state: "default" 0.0; + spacer { "base"; + scale; + desc { "default"; min: COLORSELECTOR_PALETTE_COLORPLANE_WIDTH_INC COLORSELECTOR_PALETTE_COLORPLANE_HEIGHT_INC; max: -1 -1; } } - part { name: "bg"; - type: RECT; - scale: 1; - description { state: "default" 0.0; - rel1.to: "base"; - rel2.to: "base"; - color_class: "elm/widget/colorselector/default/bg-default"; /// for C# + rect { "bg"; + nomouse; + desc { "default"; + rel.to: "base"; + color_class: "colorselector/default/bg"; } } - part { name: "top_padding"; - type: SPACER; - scale: 1; - description { state: "default" 0.0; + spacer { "padding_top"; + scale; + desc { "default"; min: 0 COLORSELECTOR_TOPBOTTOM_PAD_COLORPLANE_INC; fixed: 0 1; rel1 { @@ -65,23 +60,22 @@ group { align: 0.0 0.0; } } - part { name: "palette"; - type: SWALLOW; - scale: 1; - description { state: "default" 0.0; + swallow { "palette"; + scale; + mouse; + desc { state: "default"; align: 0.5 0.0; fixed: 0 1; rel1 { relative: 0.0 1.0; - to_y: "top_padding"; + to_y: "padding_top"; } - rel2.to_y: "top_padding"; + rel2.to_y: "padding_top"; } } - part{ name: "palette_bottom_padding"; - type: SPACER; - scale: 1; - description { state: "default" 0.0; + spacer { "padding_palette"; + scale; + desc { "default"; min: 0 COLORSELECTOR_TOPBOTTOM_PAD_COLORPLANE_INC; fixed: 0 1; rel1 { @@ -94,3 +88,4 @@ group { } } } + diff --git a/src/ElmSharp/theme/mobile/widgets/entry.edc b/src/ElmSharp/theme/mobile/widgets/entry.edc new file mode 100644 index 0000000..41f240f --- /dev/null +++ b/src/ElmSharp/theme/mobile/widgets/entry.edc @@ -0,0 +1,1077 @@ +/* + * Copyright (c) 2010 Samsung Electronics Co., Ltd All Rights Reserved + * + * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#define ENTRY_DEFAULT_TAGS \ + tag: "em" "+ font_style=Oblique"; \ + tag: "b" "+ font_weight=Bold"; \ + tag: "link" "+ color=#800 underline=on underline_color=#8008"; \ + tag: "hilight" "+ font_weight=Bold"; + +#define ENTRY_SINGLELINE_TAGS \ + tag: "br" ""; \ + tag: "em" "+ font_style=Oblique"; \ + tag: "b" "+ font_weight=Bold"; \ + tag: "link" "+ color=#800 underline=on underline_color=#8008"; \ + tag: "hilight" "+ font_weight=Bold"; + +#define ENTRY_PREEDIT_TAGS \ + tag: "preedit" "+ underline=on underline_color="ENTRY_PREEDIT_UNDERLINE_COLOR_INC; \ + tag: "preedit_sel" "+ backing=on backing_color="ENTRY_PREEDIT_BACKGROUND_COLOR_INC" color="ENTRY_PREEDIT_TEXT_COLOR_INC" underline=on underline_color="ENTRY_PREEDIT_TEXT_COLOR_INC; \ + tag: "preedit_highlight" "+ backing=on backing_color="ENTRY_PREEDIT_HIGHLIGHT_BACKGROUND_COLOR_INC" underline=on underline_color="ENTRY_PREEDIT_TEXT_COLOR_INC; \ + tag: "preedit_sub1" "+ backing=on backing_color="ENTRY_PREEDIT_SUB1_COLOR_INC" underline=on underline_color="ENTRY_PREEDIT_UNDERLINE_COLOR_INC; \ + tag: "preedit_sub2" "+ backing=on backing_color="ENTRY_PREEDIT_SUB2_COLOR_INC" underline=on underline_color="ENTRY_PREEDIT_UNDERLINE_COLOR_INC; \ + tag: "preedit_sub3" "+ backing=on backing_color="ENTRY_PREEDIT_SUB3_COLOR_INC" underline=on underline_color="ENTRY_PREEDIT_UNDERLINE_COLOR_INC; \ + tag: "preedit_sub4" "+ backing=on backing_color="ENTRY_PREEDIT_SUB4_COLOR_INC" underline=on underline_color="ENTRY_PREEDIT_UNDERLINE_COLOR_INC; + +styles { + style { "entry_textblock_style"; + base: "font=Tizen:weight=Light font_size="ENTRY_FONT_SIZE_INC" color=#fff left_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" right_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" wrap=mixed text_class=entry color_class=entry/default/text_edit"; + ENTRY_DEFAULT_TAGS + ENTRY_PREEDIT_TAGS + } + style { "entry_textblock_focused_style"; + base: "font=Tizen:weight=Light font_size="ENTRY_FONT_SIZE_INC" color=#fff left_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" right_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" wrap=mixed text_class=entry color_class=entry/default/text_edit_focused"; + ENTRY_DEFAULT_TAGS + ENTRY_PREEDIT_TAGS + } + style { "entry_textblock_disabled_style"; + base: "font=Tizen:weight=Light font_size="ENTRY_FONT_SIZE_INC" color=#fff left_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" right_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" wrap=mixed text_class=entry color_class=entry/default/text_edit_disabled"; + ENTRY_DEFAULT_TAGS + ENTRY_PREEDIT_TAGS + } + style { "entry_textblock_guide_style"; + base: "font=Tizen:weight=Light font_size="ENTRY_FONT_SIZE_INC" color=#fff left_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" right_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" wrap=mixed text_class=entry color_class=entry/default/text_guide"; + ENTRY_DEFAULT_TAGS + } + style { "entry_textblock_guide_focused_style"; + base: "font=Tizen:weight=Light font_size="ENTRY_FONT_SIZE_INC" color=#fff left_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" right_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" wrap=mixed text_class=entry color_class=entry/default/text_guide_focused"; + ENTRY_DEFAULT_TAGS + } + style { "entry_textblock_guide_disabled_style"; + base: "font=Tizen:weight=Light font_size="ENTRY_FONT_SIZE_INC" color=#fff left_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" right_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" wrap=mixed text_class=entry color_class=entry/default/text_guide_disabled"; + ENTRY_DEFAULT_TAGS + } + style { "entry_textblock_char_wrap_style"; + base: "font=Tizen:weight=Light font_size="ENTRY_FONT_SIZE_INC" color=#fff left_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" right_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" wrap=char text_class=entry color_class=entry/default/text_edit"; + ENTRY_DEFAULT_TAGS + ENTRY_PREEDIT_TAGS + } + style { "entry_textblock_char_wrap_focused_style"; + base: "font=Tizen:weight=Light font_size="ENTRY_FONT_SIZE_INC" color=#fff left_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" right_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" wrap=char text_class=entry color_class=entry/default/text_edit_focused"; + ENTRY_DEFAULT_TAGS + ENTRY_PREEDIT_TAGS + } + style { "entry_textblock_char_wrap_disabled_style"; + base: "font=Tizen:weight=Light font_size="ENTRY_FONT_SIZE_INC" color=#fff left_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" right_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" wrap=char text_class=entry color_class=entry/default/text_edit_disabled"; + ENTRY_DEFAULT_TAGS + ENTRY_PREEDIT_TAGS + } + style { "entry_textblock_char_wrap_guide_style"; + base: "font=Tizen:weight=Light font_size="ENTRY_FONT_SIZE_INC" color=#fff left_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" right_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" wrap=char text_class=entry color_class=entry/default/text_guide"; + ENTRY_DEFAULT_TAGS + } + style { "entry_textblock_char_wrap_guide_focused_style"; + base: "font=Tizen:weight=Light font_size="ENTRY_FONT_SIZE_INC" color=#fff left_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" right_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" wrap=char text_class=entry color_class=entry/default/text_guide_focused"; + ENTRY_DEFAULT_TAGS + } + style { "entry_textblock_char_wrap_guide_disabled_style"; + base: "font=Tizen:weight=Light font_size="ENTRY_FONT_SIZE_INC" color=#fff left_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" right_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" wrap=char text_class=entry color_class=entry/default/text_guide_disabled"; + ENTRY_DEFAULT_TAGS + } + style { "entry_single_textblock_style"; + base: "font=Tizen:weight=Light font_size="ENTRY_FONT_SIZE_INC" color=#fff left_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" right_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" wrap=none text_class=entry color_class=entry/default/text_edit"; + ENTRY_SINGLELINE_TAGS + ENTRY_PREEDIT_TAGS + } + style { "entry_single_textblock_focused_style"; + base: "font=Tizen:weight=Light font_size="ENTRY_FONT_SIZE_INC" color=#fff left_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" right_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" wrap=none text_class=entry color_class=entry/default/text_edit_focused"; + ENTRY_SINGLELINE_TAGS + ENTRY_PREEDIT_TAGS + } + style { "entry_single_textblock_disabled_style"; + base: "font=Tizen:weight=Light font_size="ENTRY_FONT_SIZE_INC" color=#fff left_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" right_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" wrap=none text_class=entry color_class=entry/default/text_edit_disabled"; + ENTRY_SINGLELINE_TAGS + ENTRY_PREEDIT_TAGS + } + style { "entry_single_textblock_guide_style"; + base: "font=Tizen:weight=Light font_size="ENTRY_FONT_SIZE_INC" color=#fff left_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" right_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" wrap=none text_class=entry color_class=entry/default/text_guide"; + ENTRY_SINGLELINE_TAGS + } + style { "entry_single_textblock_guide_focused_style"; + base: "font=Tizen:weight=Light font_size="ENTRY_FONT_SIZE_INC" color=#fff left_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" right_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" wrap=none text_class=entry color_class=entry/default/text_guide_focused"; + ENTRY_SINGLELINE_TAGS + } + style { "entry_single_textblock_guide_disabled_style"; + base: "font=Tizen:weight=Light font_size="ENTRY_FONT_SIZE_INC" color=#fff left_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" right_margin="ENTRY_LEFT_RIGHT_MARGIN_INC" wrap=none text_class=entry color_class=entry/default/text_guide_disabled"; + ENTRY_SINGLELINE_TAGS + } +} + +group { "elm/entry/event/default"; + inherit_only: 1; + parts { + rect { "event"; + mouse; + repeat; + desc { "default"; + color: 0 0 0 0; + } + desc { "disabled"; + inherit: "default"; + hid; + } + } + } + programs { + program { "clicked"; + signal: "mouse,clicked,1"; + source: "event"; + after: "on_clicked"; + } + program { "load"; + signal: "load"; + source: ""; + after: "on_load"; + } + program { "disabled"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled"; + target: "event"; + after: "on_disabled"; + } + program { "enabled"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "default"; + target: "event"; + after: "on_enabled"; + } + program { "focus"; + signal: "elm,action,focus"; + source: "elm"; + after: "on_focus"; + } + program { "unfocus"; + signal: "elm,action,unfocus"; + source: "elm"; + after: "on_unfocus"; + } + program { "disabled_guide"; + signal: "elm,guide,disabled"; + source: "elm"; + after: "on_disabled_guide"; + } + program { "enabled_guide"; + signal: "elm,guide,enabled"; + source: "elm"; + after: "on_enabled_guide"; + } + } +} + +group { "elm/entry/base/template"; + inherit_only: 1; + data.item: "default_font_size" ENTRY_FONT_SIZE_INC; + data.item: "focus_highlight" "on"; + data.item: context_menu_orientation "horizontal"; + parts { + rect { "bg"; + nomouse; + desc { "default"; + color_class: "entry/default/bg"; + } + } + textblock { "elm.guide"; + nomouse; + scale; + desc { "default"; + rel.to: "elm.text"; + text.style: "entry_textblock_guide_style"; + } + desc { "focused"; + inherit: "default"; + text.style: "entry_textblock_guide_focused_style"; + } + desc { "disabled"; + inherit: "default"; + text.style: "entry_textblock_guide_disabled_style"; + } + desc { "hidden"; + inherit: "default"; + hid; + } + } + textblock { "elm.text"; + mouse; + scale; + entry_mode: EDITABLE; + select_mode: EXPLICIT; + cursor_mode: BEFORE; + multiline: 1; + source: "elm/entry/selection/default"; // selection under + source4: "elm/entry/cursor/default"; // cursorover + source5: "elm/entry/anchor/default"; // anchor under + desc { "default"; + text.style: "entry_textblock_style"; + } + desc { "focused"; + inherit: "default"; + text.style: "entry_textblock_focused_style"; + } + desc { "disabled"; + inherit: "default"; + text.style: "entry_textblock_disabled_style"; + } + } + } + inherit: "elm/entry/event/default"; + script { + public focused = 0; + public disabled = 0; + public guide_disabled = 0; + } + programs { + program { "on_load"; + action: FOCUS_SET; + target: "elm.text"; + } + program { "on_clicked"; + action: RUN_PLUGIN "touch_sound"; + } + program { "on_focus"; + script { + set_int(focused, 1); + if (get_int(disabled) == 0) { + set_state(PART:"elm.text", "focused", 0.0); + if (get_int(guide_disabled) == 0) + set_state(PART:"elm.guide", "focused", 0.0); + } + } + } + program { "on_unfocus"; + script { + set_int(focused, 0); + if (get_int(disabled) == 0) { + set_state(PART:"elm.text", "default", 0.0); + if (get_int(guide_disabled) == 0) + set_state(PART:"elm.guide", "default", 0.0); + } + } + } + program { "on_disabled"; + script { + set_int(disabled, 1); + set_state(PART:"elm.text", "disabled", 0.0); + if (get_int(guide_disabled) == 0) + set_state(PART:"elm.guide", "disabled", 0.0); + } + } + program { "on_enabled"; + script { + set_int(disabled, 0); + if (get_int(focused)) + set_state(PART:"elm.text", "focused", 0.0); + else + set_state(PART:"elm.text", "default", 0.0); + if (get_int(guide_disabled) == 0) { + if (get_int(focused)) + set_state(PART:"elm.guide", "focused", 0.0); + else + set_state(PART:"elm.guide", "default", 0.0); + } + } + } + program { "on_disabled_guide"; + script { + set_int(guide_disabled, 1); + set_state(PART:"elm.guide", "hidden", 0.0); + } + } + program { "on_enabled_guide"; + script { + set_int(guide_disabled, 0); + if (get_int(disabled)) + set_state(PART:"elm.guide", "disabled", 0.0); + else if (get_int(focused)) + set_state(PART:"elm.guide", "focused", 0.0); + else + set_state(PART:"elm.guide", "default", 0.0); + } + } + } +} + +group { "elm/entry/cursor/event/default"; + inherit_only: 1; + programs { + program { "selection_start"; + signal: "selection,start"; + source: "elm.text"; + after: "on_selection_start"; + } + program { "selection_cleared"; + signal: "selection,cleared"; + source: "elm.text"; + after: "on_selection_cleared"; + } + program { "focus"; + signal: "elm,action,focus"; + source: "elm"; + after: "on_focus"; + } + program { "unfocus"; + signal: "elm,action,unfocus"; + source: "elm"; + after: "on_unfocus"; + } + program { "show_cursor"; + signal: "elm,action,show,cursor"; + source: "elm"; + after: "on_show_cursor"; + } + } +} + +group { "elm/entry/cursor/template"; + inherit: "elm/entry/cursor/event/default"; + inherit_only: 1; + parts { + rect { "cursor"; + clip: "clipper"; + desc { "default"; + hid; + } + desc { "visible"; + inherit: "default"; + vis; + } + } + rect { "clipper"; + desc { "default"; + } + desc { "hidden"; + inherit: "default"; + hid; + } + } + } + programs { + program { "on_selection_start"; + action: STATE_SET "hidden"; + target: "clipper"; + } + program { "on_selection_cleared"; + action: STATE_SET "default"; + target: "clipper"; + } + program { "on_focus"; + action: ACTION_STOP; + target: "cursor_visible"; + target: "cursor_hidden"; + target: "cursor_visible_timer"; + target: "cursor_hidden_timer"; + after: "cursor_visible"; + } + program { "on_unfocus"; + action: ACTION_STOP; + target: "cursor_visible"; + target: "cursor_hidden"; + target: "cursor_visible_timer"; + target: "cursor_hidden_timer"; + after: "cursor_hidden_stop"; + } + program { "on_show_cursor"; + action: ACTION_STOP; + target: "cursor_visible"; + target: "cursor_hidden"; + target: "cursor_visible_timer"; + target: "cursor_hidden_timer"; + after: "cursor_visible"; + } + program { "cursor_hidden_stop"; + action: STATE_SET "default"; + target: "cursor"; + } + program { "cursor_visible"; + action: STATE_SET "visible"; + target: "cursor"; + after: "cursor_visible_timer"; + } + program { "cursor_hidden"; + action: STATE_SET "default"; + target: "cursor"; + after: "cursor_hidden_timer"; + } + program { "cursor_visible_timer"; + in: 0.6 0.0; + after: "cursor_hidden"; + } + program { "cursor_hidden_timer"; + in: 0.6 0.0; + after: "cursor_visible"; + } + } +} + +group { "elm/entry/cursor/default"; + inherit: "elm/entry/cursor/template"; + parts { + rect { "cursor"; + nomouse; + scale; + clip: "clipper"; + desc { "default"; + min: ENTRY_CURSOR_SIZE_INC; + color_class: "entry/default/cursor"; + hid; + } + desc { "visible"; + inherit: "default"; + vis; + } + } + rect { "clipper"; + desc { "default"; + rel.to: "cursor"; + fixed: 1 1; + } + desc { "hidden"; + inherit: "default"; + hid; + } + } + } +} + +group { "elm/entry/base/default"; + inherit: "elm/entry/base/template"; + alias: "elm/entry/base-mixedwrap/default"; + parts { + textblock { "elm.guide"; + nomouse; + scale; + desc { "default"; + rel.to: "elm.text"; + text { + style: "entry_textblock_guide_style"; + min: 0 1; + align: 0.0 0.0; + } + } + desc { "focused"; + inherit: "default"; + text.style: "entry_textblock_guide_focused_style"; + } + desc { "disabled"; + inherit: "default"; + text.style: "entry_textblock_guide_disabled_style"; + } + desc { "hidden"; + inherit: "default"; + hid; + } + } + textblock { "elm.text"; + mouse; + scale; + entry_mode: EDITABLE; + select_mode: EXPLICIT; + cursor_mode: BEFORE; + multiline: 1; + source: "elm/entry/selection/default"; // selection under + source4: "elm/entry/cursor/default"; // cursorover + source5: "elm/entry/anchor/default"; // anchor under + desc { "default"; + fixed: 1 0; + text { + style: "entry_textblock_style"; + min: 0 1; + align: 0.0 0.0; + } + } + desc { "focused"; + inherit: "default"; + text { + style: "entry_textblock_focused_style"; + min: 0 1; + } + } + desc { "disabled"; + inherit: "default"; + text { + style: "entry_textblock_disabled_style"; + min: 0 1; + } + } + } + } +} + +group { "elm/entry/base-charwrap/default"; + alias: "elm/entry/base/char_wrap"; + inherit: "elm/entry/base/template"; + parts { + textblock { "elm.guide"; + nomouse; + scale; + desc { "default"; + rel.to: "elm.text"; + text { + style: "entry_textblock_char_wrap_guide_style"; + min: 0 1; + align: 0.0 0.0; + } + } + desc { "focused"; + inherit: "default"; + text.style: "entry_textblock_char_wrap_guide_focused_style"; + } + desc { "disabled"; + inherit: "default"; + text.style: "entry_textblock_char_wrap_guide_disabled_style"; + } + desc { "hidden"; + inherit: "default"; + hid; + } + } + textblock { "elm.text"; + mouse; + scale; + entry_mode: EDITABLE; + select_mode: EXPLICIT; + cursor_mode: BEFORE; + multiline: 1; + source: "elm/entry/selection/default"; // selection under + source4: "elm/entry/cursor/default"; // cursorover + source5: "elm/entry/anchor/default"; // anchor under + desc { "default"; + fixed: 1 0; + text { + style: "entry_textblock_char_wrap_style"; + min: 0 1; + align: 0.0 0.0; + } + } + desc { "focused"; + inherit: "default"; + text { + style: "entry_textblock_char_wrap_focused_style"; + min: 0 1; + } + } + desc { "disabled"; + inherit: "default"; + text { + style: "entry_textblock_char_wrap_disabled_style"; + min: 0 1; + } + } + } + } +} + +group { "elm/entry/base-nowrap/default"; + inherit: "elm/entry/base/template"; + parts { + textblock { "elm.guide"; + nomouse; + scale; + desc { "default"; + rel.to: "elm.text"; + text { + style: "entry_textblock_guide_style"; + min: 0 1; + align: 0.0 0.0; + } + } + desc { "focused"; + inherit: "default"; + text.style: "entry_textblock_guide_focused_style"; + } + desc { "disabled"; + inherit: "default"; + text.style: "entry_textblock_guide_disabled_style"; + } + desc { "hidden"; + inherit: "default"; + hid; + } + } + textblock { "elm.text"; + mouse; + scale; + entry_mode: EDITABLE; + select_mode: EXPLICIT; + cursor_mode: BEFORE; + multiline: 1; + source: "elm/entry/selection/default"; // selection under + source4: "elm/entry/cursor/default"; // cursorover + source5: "elm/entry/anchor/default"; // anchor under + desc { "default"; + text { + style: "entry_textblock_style"; + min: 1 1; + align: 0.0 0.0; + } + } + desc { "focused"; + inherit: "default"; + text { + style: "entry_textblock_focused_style"; + min: 1 1; + } + } + desc { "disabled"; + inherit: "default"; + text { + style: "entry_textblock_disabled_style"; + min: 0 1; + } + } + } + } +} + +group { "elm/entry/base-single/default"; + inherit: "elm/entry/base/template"; + parts { + textblock { "elm.guide"; + nomouse; + scale; + desc { "default"; + fixed: 1 1; + rel.to: "elm.text"; + text { + style: "entry_single_textblock_guide_style"; + min: 0 1; + max: 0 0; + align: 0.0 0.5; + } + } + desc { "focused"; + inherit: "default"; + text.style: "entry_single_textblock_guide_focused_style"; + } + desc { "disabled"; + inherit: "default"; + text.style: "entry_single_textblock_guide_disabled_style"; + } + desc { "hidden"; + inherit: "default"; + hid; + } + } + textblock { "elm.text"; + mouse; + scale; + entry_mode: EDITABLE; + select_mode: EXPLICIT; + cursor_mode: BEFORE; + multiline: 0; + source: "elm/entry/selection/default"; // selection under + source4: "elm/entry/cursor/default"; // cursorover + source5: "elm/entry/anchor/default"; // anchor under + desc { "default"; + text { + style: "entry_single_textblock_style"; + min: 1 1; + max: 0 0; + align: 0.0 0.5; + } + } + desc { "focused"; + inherit: "default"; + text.style: "entry_single_textblock_focused_style"; + } + desc { "disabled"; + inherit: "default"; + text.style: "entry_single_textblock_disabled_style"; + } + } + } +} + +group { "elm/entry/base-single-noedit/default"; + inherit: "elm/entry/base/template"; + alias: "elm/entry/base-single-noedit/vcenter_align"; + parts { + textblock { "elm.guide"; + nomouse; + scale; + desc { "default"; + fixed: 1 1; + rel.to: "elm.text"; + text { + style: "entry_single_textblock_guide_style"; + min: 0 1; + max: 0 1; + } + } + desc { "focused"; + inherit: "default"; + text.style: "entry_single_textblock_guide_focused_style"; + } + desc { "disabled"; + inherit: "default"; + text.style: "entry_single_textblock_guide_disabled_style"; + } + desc { "hidden"; + inherit: "default"; + hid; + } + } + textblock { "elm.text"; + mouse; + scale; + entry_mode: PLAIN; + select_mode: EXPLICIT; + cursor_mode: BEFORE; + multiline: 0; + source: "elm/entry/selection/default"; // selection under + source5: "elm/entry/anchor/default"; // anchor under + desc { "default"; + text { + style: "entry_single_textblock_style"; + min: 1 1; + max: 0 1; + } + } + desc { "focused"; + inherit: "default"; + text.style: "entry_single_textblock_focused_style"; + } + desc { "disabled"; + inherit: "default"; + text.style: "entry_single_textblock_disabled_style"; + } + } + } +} + +group { "elm/entry/base-noedit/default"; + inherit: "elm/entry/base/template"; + parts { + textblock { "elm.guide"; + nomouse; + scale; + desc { "default"; + rel.to: "elm.text"; + text { + style: "entry_textblock_guide_style"; + min: 0 1; + align: 0.0 0.0; + } + } + desc { "focused"; + inherit: "default"; + text.style: "entry_textblock_guide_focused_style"; + } + desc { "disabled"; + inherit: "default"; + text.style: "entry_textblock_guide_disabled_style"; + } + desc { "hidden"; + inherit: "default"; + hid; + } + } + textblock { "elm.text"; + mouse; + scale; + entry_mode: PLAIN; + select_mode: EXPLICIT; + cursor_mode: BEFORE; + multiline: 1; + source: "elm/entry/selection/default"; // selection under + source5: "elm/entry/anchor/default"; // anchor under + desc { "default"; + fixed: 1 0; + text { + style: "entry_textblock_style"; + min: 0 1; + align: 0.0 0.0; + } + } + desc { "focused"; + inherit: "default"; + text.style: "entry_textblock_focused_style"; + } + desc { "disabled"; + inherit: "default"; + text.style: "entry_textblock_disabled_style"; + } + } + } +} + +group { "elm/entry/base-noedit-charwrap/default"; + inherit: "elm/entry/base/template"; + parts { + textblock { "elm.guide"; + nomouse; + scale; + desc { "default"; + rel.to: "elm.text"; + text { + style: "entry_textblock_char_wrap_guide_style"; + min: 0 1; + align: 0.0 0.0; + } + } + desc { "focused"; + inherit: "default"; + text.style: "entry_textblock_char_wrap_guide_focused_style"; + } + desc { "disabled"; + inherit: "default"; + text.style: "entry_textblock_char_wrap_guide_disabled_style"; + } + desc { "hidden"; + inherit: "default"; + hid; + } + } + textblock { "elm.text"; + mouse; + scale; + entry_mode: PLAIN; + select_mode: EXPLICIT; + cursor_mode: BEFORE; + multiline: 1; + source: "elm/entry/selection/default"; // selection under + source5: "elm/entry/anchor/default"; // anchor under + desc { "default"; + fixed: 1 0; + text { + style: "entry_textblock_char_wrap_style"; + min: 0 1; + align: 0.0 0.0; + } + } + desc { "focused"; + inherit: "default"; + text.style: "entry_textblock_char_wrap_focused_style"; + } + desc { "disabled"; + inherit: "default"; + text.style: "entry_textblock_char_wrap_disabled_style"; + } + } + } +} + +group { "elm/entry/base-noedit-mixedwrap/default"; + inherit: "elm/entry/base/template"; + parts { + part { "elm.guide"; + type: TEXTBLOCK; + nomouse; + scale; + desc { "default"; + rel.to: "elm.text"; + text { + style: "entry_textblock_guide_style"; + min: 0 1; + align: 0.0 0.0; + } + } + desc { "focused"; + inherit: "default"; + text.style: "entry_textblock_guide_focused_style"; + } + desc { "disabled"; + inherit: "default"; + text.style: "entry_textblock_guide_disabled_style"; + } + desc { "hidden"; + inherit: "default"; + hid; + } + } + textblock { "elm.text"; + mouse; + scale; + entry_mode: PLAIN; + select_mode: EXPLICIT; + cursor_mode: BEFORE; + multiline: 1; + source: "elm/entry/selection/default"; // selection under + source5: "elm/entry/anchor/default"; // anchor under + desc { "default"; + fixed: 1 0; + text { + style: "entry_textblock_style"; + min: 0 1; + align: 0.0 0.0; + } + } + desc { "focused"; + inherit: "default"; + text.style: "entry_textblock_focused_style"; + } + desc { "disabled"; + inherit: "default"; + text.style: "entry_textblock_disabled_style"; + } + } + } +} + +group { "elm/entry/base-nowrap-noedit/default"; + inherit: "elm/entry/base/template"; + parts { + textblock { "elm.guide"; + type: TEXTBLOCK; + nomouse; + scale; + desc { "default"; + rel.to: "elm.text"; + text { + style: "entry_textblock_guide_style"; + min: 0 1; + align: 0.0 0.0; + } + } + desc { "focused"; + inherit: "default"; + text.style: "entry_textblock_guide_focused_style"; + } + desc { "disabled"; + inherit: "default"; + text.style: "entry_textblock_guide_disabled_style"; + } + desc { "hidden"; + inherit: "default"; + hid; + } + } + textblock { "elm.text"; + mouse; + scale; + entry_mode: PLAIN; + select_mode: EXPLICIT; + cursor_mode: BEFORE; + multiline: 1; + source: "elm/entry/selection/default"; // selection under + source5: "elm/entry/anchor/default"; // anchor under + desc { "default"; + text { + style: "entry_textblock_style"; + min: 1 1; + align: 0.0 0.0; + } + } + desc { "focused"; + inherit: "default"; + text.style: "entry_textblock_focused_style"; + } + desc { "disabled"; + inherit: "default"; + text.style: "entry_textblock_disabled_style"; + } + } + } +} + +group { "elm/entry/base-password/default"; + inherit: "elm/entry/base/template"; + parts { + textblock { "elm.guide"; + nomouse; + scale; + desc { "default"; + fixed: 1 1; + rel.to: "elm.text"; + text { + style: "entry_single_textblock_guide_style"; + min: 0 1; + max: 0 1; + } + } + desc { "focused"; + inherit: "default"; + text.style: "entry_single_textblock_guide_focused_style"; + } + desc { "disabled"; + inherit: "default"; + text.style: "entry_single_textblock_guide_disabled_style"; + } + desc { "hidden"; + inherit: "default"; + hid; + } + } + textblock { "elm.text"; + mouse; + scale; + entry_mode: PASSWORD; + select_mode: EXPLICIT; + cursor_mode: BEFORE; + multiline: 0; + source: "elm/entry/selection/default"; // selection under + source4: "elm/entry/cursor/default"; // cursorover + source5: "elm/entry/anchor/default"; // anchor under + desc { "default"; + text { + style: "entry_single_textblock_style"; + repch: "•"; + min: 1 1; + max: 0 1; + } + } + desc { "focused"; + inherit: "default"; + text.style: "entry_single_textblock_focused_style"; + } + desc { "disabled"; + inherit: "default"; + text.style: "entry_single_textblock_disabled_style"; + } + } + } +} + +group { "elm/entry/selection/default"; + parts { + rect { "bg"; + scale; + nomouse; + desc { "default"; + color: 0 221 255 153; + } + } + } +} + +group { "elm/entry/anchor/default"; + parts { + spacer { "bg"; + desc { "default"; } + } + } +} diff --git a/src/ElmSharp/theme/mobile/widgets/label.edc b/src/ElmSharp/theme/mobile/widgets/label.edc new file mode 100644 index 0000000..5b11efd --- /dev/null +++ b/src/ElmSharp/theme/mobile/widgets/label.edc @@ -0,0 +1,722 @@ +/* + * Copyright (c) 2010 Samsung Electronics Co., Ltd All Rights Reserved + * + * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#define SLIDE_SPEED_WEIGHT 0.5 +#define SLIDE_TEXT_GAP 60 +#define SLIDE_TEXT_CHAR_GAP " " //60 (6 spaces) +#define SLIDE_TEXT_MAX_LENGTH (2*(1024+6)) + +styles { + style { "textblock_style"; + base: "font=Tizen:weight=Normal font_size="LABEL_FONT_SIZE_INC" color=#FFF color_class=label/default/text text_class=label"; + tag: "br" "\n"; + tag: "ps" "ps"; + tag: "hilight" "+ font_weight=Bold"; + tag: "b" "+ font_weight=Bold"; + tag: "tab" "\t"; + } + style { "textblock_charwrap_style"; + base: "font=Tizen:weight=Normal font_size="LABEL_FONT_SIZE_INC" color=#FFF color_class=label/default/text text_class=label"; + tag: "br" "\n"; + tag: "ps" "ps"; + tag: "hilight" "+ font_weight=Bold"; + tag: "b" "+ font_weight=Bold"; + tag: "tab" "\t"; + } + style { "textblock_style_marker"; + base: "font=Tizen:weight=Bold font_size=14 align=center color=#FFF wrap=word color_class=label/default/text text_class=tizen"; + tag: "br" "\n"; + tag: "ps" "ps"; + tag: "hilight" "+ font_weight=Bold"; + tag: "b" "+ font_weight=Bold"; + tag: "tab" "\t"; + } +} + +group { "elm/label/event/default"; + inherit_only: 1; + programs { + program { "start_slide"; + source: "elm"; + signal: "elm,state,slide,start"; + after: "on_start_slide"; + } + program { "stop_slide"; + source: "elm"; + signal: "elm,state,slide,stop"; + after: "on_stop_slide"; + } + } +} + +group { "elm/label/base/template"; + inherit: "elm/label/event/default"; + inherit_only: 1; + parts { + rect { "bg"; + desc { "default"; + color_class: "label/default/bg"; + } + } + rect { "clipper"; + desc { "default"; + } + } + textblock { "elm.text"; + scale; + clip: "clipper"; + desc { "default"; + text.style: "textblock_style"; + } + } + } + programs { + program { "on_start_slide"; + } + program { "on_stop_slide"; + } + } +} + +group { "elm/label/base/default"; + inherit: "elm/label/base/template"; + parts { + textblock { "elm.text"; + scale; + clip: "clipper"; + desc { "default"; + text { + style: "textblock_style"; + min: 0 1; + align: 0.0 0.0; + } + } + } + } +} + +/* default label doesn't use it */ +group { "elm/label/base_wrap/default"; + inherit: "elm/label/base/template"; + parts { + textblock { "elm.text"; + scale; + multiline: 1; + desc { "default"; + text { + style: "textblock_style"; + min: 0 1; + align: 0.0 0.0; + } + } + desc { "charwrap_mode"; + text { + style: "textblock_charwrap_style"; + min: 0 1; + align: 0.0 0.0; + } + } + } + } + programs { + program { "default"; + signal: "elm,state,default"; + source: "elm"; + action: STATE_SET "default"; + target: "elm.text"; + } + program { "charwrap"; + signal: "elm,state,charwrap"; + source: "elm"; + action: STATE_SET "charwrap_mode"; + target: "elm.text"; + } + } +} + +/* default label doesn't use it */ +group { "elm/label/base_wrap_ellipsis/default"; + inherit: "elm/label/base/template"; + parts { + textblock { "elm.text"; + scale; + multiline: 1; + desc { "default"; + fixed: 0 1; + text { + style: "textblock_style"; + min: 0 1; + align: 0.0 0.0; + } + } + desc { "charwrap_mode"; + fixed: 0 1; + text { + style: "textblock_charwrap_style"; + min: 0 1; + align: 0.0 0.0; + } + } + } + } + programs { + program { "default"; + signal: "elm,state,default"; + source: "elm"; + action: STATE_SET "default"; + target: "elm.text"; + } + program { "charwrap"; + signal: "elm,state,charwrap"; + source: "elm"; + action: STATE_SET "charwrap_mode"; + target: "elm.text"; + } + } +} + +group { "elm/label/base/slide_long"; + inherit: "elm/label/base/template"; + script { + public g_duration = 0, g_stopslide, g_timer_id, g_anim_id; + + public message(Msg_Type:type, id, ...) { + if (type == MSG_FLOAT_SET) { + new Float:duration; + duration = getfarg(2); + if (id == 0) + set_float(g_duration, duration); + else + set_float(g_duration, duration / LABEL_FONT_SIZE_INC * SLIDE_SPEED_WEIGHT); + } + } + public slide_to_end_anim(val, Float:pos) { + new stopflag; + new id; + stopflag = get_int(g_stopslide); + if (stopflag == 1) return; + set_tween_state(PART:"elm.text", pos, "slide_begin", 0.0, "slide_end", 0.0); + if (pos >= 1.0) { + id = timer(0.5, "slide_to_begin", 1); + set_int(g_timer_id, id); + } + } + public slide_to_end() { + new stopflag; + new id; + new Float:duration; + stopflag = get_int(g_stopslide); + if (stopflag == 1) return; + duration = get_float(g_duration); + id = anim(duration, "slide_to_end_anim", 1); + set_int(g_anim_id, id); + } + public slide_to_begin() { + new stopflag; + new id; + stopflag = get_int(g_stopslide); + if (stopflag == 1) return; + set_state(PART:"elm.text", "slide_begin", 0.0); + id = timer(0.5, "slide_to_end", 1); + set_int(g_timer_id, id); + } + public start_slide() { + set_int(g_stopslide, 0); + set_state(PART:"elm.text", "slide_begin", 0.0); + slide_to_end(); + } + public stop_slide() { + new id; + set_int(g_stopslide, 1); + id = get_int(g_anim_id); + cancel_anim(id); + id = get_int(g_timer_id); + cancel_timer(id); + set_state(PART:"elm.text", "default", 0.0); + } + } + parts { + rect { "bg"; + desc { "default"; + color_class: "label/slide_long/bg"; + } + } + textblock { "elm.text"; + scale; + clip: "clipper"; + desc { "default"; + align: 0.0 0.0; + text { + style: "textblock_style"; + min: 0 1; + align: 0.0 0.0; + } + } + desc { "slide_end"; + inherit: "default"; + rel2.relative: 0.0 1.0; + align: 1.0 0.0; + text { + style: "textblock_style"; + min: 1 1; + align: 0.0 0.0; + } + } + desc { "slide_begin"; + inherit: "default"; + rel1.relative: 1.0 0.0; + text { + style: "textblock_style"; + min: 1 1; + align: 0.0 0.0; + } + } + } + } + programs { + program { "on_start_slide"; + script { + start_slide(); + } + } + program { "on_stop_slide"; + script { + stop_slide(); + } + } + } +} + +group { "elm/label/base/slide_roll"; + inherit: "elm/label/base/template"; + script { + public g_duration = 0; + public g_stopslide = 0; + public g_timer_id = 0; + public g_anim_id = 0; + public g_tb_w = 0; + public g_tb_h = LABEL_FONT_SIZE_INC; + public org_text = 0; + public message(Msg_Type:type, id, ...) { + if (type == MSG_FLOAT_SET) { + new Float:duration; + duration = getfarg(2); + if (id == 0) + set_float(g_duration, duration); + else + set_float(g_duration, duration / get_int(g_tb_h) * SLIDE_SPEED_WEIGHT); + } + } + public get_tb_width() { + new x, y, w, h; + set_state(PART:"elm.text", "no_ellipsis", 0.0); + get_geometry(PART:"elm.text", x, y, w, h); + set_int(g_tb_w, w); + set_int(g_tb_h, h); + set_state(PART:"clipper_elm.text", "default", 0.0); + get_geometry(PART:"clipper_elm.text", x, y, w, h); + set_int(org_text, w); + } + public slide_to_end_anim(val, Float:pos) { + if (get_int(g_stopslide)) return; + set_tween_state(PART:"elm.text.slide", pos*0.5, "slide_begin", 0.0, "slide_end", 0.0); + if (pos >= 1.0) { + set_int(g_timer_id, timer(1.5, "start_slide", 0)); + } + } + public slide_to_end() { + if (get_int(g_stopslide)) return; + set_int(g_anim_id, anim(get_float(g_duration), "slide_to_end_anim", 0)); + } + public start_slide(val) { + new Float:len; + set_int(g_stopslide, 0); + get_tb_width(); + if (!get_float(g_duration)) { + len = get_int(g_tb_w); + set_float(g_duration, len / get_int(g_tb_h) * SLIDE_SPEED_WEIGHT); + } + if(get_int(g_tb_w) > get_int(org_text)) { + run_program(PROGRAM:"slide_text_set"); + set_state(PART:"elm.text.slide", "slide_begin", 0.0); + set_state(PART:"clipper_elm.text", "hide", 0.0); + set_state(PART:"clipper_elm.text.slide", "show", 0.0); + slide_to_end(); + } + } + public stop_slide() { + new slide_start_timer; + new slide_anim_id; + set_int(g_stopslide, 1); + set_float(g_duration, 0); + slide_start_timer = get_int(g_timer_id); + if (slide_start_timer) { + cancel_timer(slide_start_timer); + set_int(g_timer_id, 0); + } + slide_anim_id = get_int(g_anim_id); + if (slide_anim_id) { + cancel_anim(slide_anim_id); + set_int(g_anim_id, 0); + } + set_text(PART:"elm.text.slide", ""); + set_state(PART:"elm.text", "default", 0.0); + set_state(PART:"elm.text.slide", "default", 0.0); + set_state(PART:"clipper_elm.text", "default", 0.0); + set_state(PART:"clipper_elm.text.slide", "default", 0.0); + } + } + parts { + rect { "bg"; + desc { "default"; + color_class: "label/slide_roll/bg"; + } + } + rect { "clipper_elm.text"; + nomouse; + clip: "clipper"; + desc { "default"; + } + desc { "hide"; + inherit: "default"; + hid; + } + } + textblock { "elm.text"; + scale; + clip: "clipper_elm.text"; + desc { "default"; + align: 0.0 0.5; + text { + style: "textblock_style"; + min: 0 1; + } + } + desc { "no_ellipsis"; + inherit: "default"; + text.min: 1 1; + } + } + rect { "clipper_elm.text.slide"; + nomouse; + clip: "clipper"; + desc { "default"; + hid; + } + desc { "show"; + inherit: "default"; + vis; + } + } + spacer { "slide_text_gap"; + scale; + desc { "default"; + fixed: 1 0; + min: SLIDE_TEXT_GAP 0; + max: SLIDE_TEXT_GAP -1; + align: 1.0 0.5; + rel2.relative: 0.0 1.0; + } + } + textblock { "elm.text.slide"; + scale; + clip: "clipper_elm.text.slide"; + desc { "default"; + align: 0.0 0.5; + text { + style: "textblock_style"; + min: 0 1; + } + } + desc { "slide_begin"; + inherit: "default"; + text.min: 1 1; + rel2.relative: 0.0 1.0; + } + desc { "slide_end"; + inherit: "default"; + align: 1.0 0.5; + text.min: 1 1; + text.align: 1.0 0.5; + rel.to: "slide_text_gap"; + } + } + } + programs { + program { "slide_text_set"; + script { + new buf[1024]; + new buffer[SLIDE_TEXT_MAX_LENGTH]; + get_text(PART:"elm.text", buf, 1024); + snprintf(buffer, SLIDE_TEXT_MAX_LENGTH, "%s", buf); + strcat(buffer, SLIDE_TEXT_CHAR_GAP); + strcat(buffer, buf); + strcat(buffer, SLIDE_TEXT_CHAR_GAP); + set_text(PART:"elm.text.slide", buffer); + } + } + program { "on_start_slide"; + script { + run_program(PROGRAM:"stop_slide"); + set_int(g_timer_id, timer(1.5, "start_slide", 0)); + } + } + program { "on_stop_slide"; + script { + stop_slide(); + } + } + } +} + +group { "elm/label/base/slide_short"; + inherit: "elm/label/base/template"; + script { + public g_duration = 0, g_stopslide, g_timer_id, g_anim_id; + + public message(Msg_Type:type, id, ...) { + if (type == MSG_FLOAT_SET) { + new Float:duration; + duration = getfarg(2); + if (id == 0) + set_float(g_duration, duration); + else + set_float(g_duration, duration / LABEL_FONT_SIZE_INC * SLIDE_SPEED_WEIGHT); + } + } + public slide_to_end_anim(val, Float:pos) { + new stopflag; + new id; + stopflag = get_int(g_stopslide); + if (stopflag == 1) return; + set_tween_state(PART:"elm.text", pos, "slide_begin", 0.0, "slide_end", 0.0); + if (pos >= 1.0) { + id = timer(0.5, "slide_to_begin", 1); + set_int(g_timer_id, id); + } + } + public slide_to_end() { + new stopflag; + new id; + new Float:duration; + stopflag = get_int(g_stopslide); + if (stopflag == 1) return; + duration = get_float(g_duration); + id = anim(duration, "slide_to_end_anim", 1); + set_int(g_anim_id, id); + } + public slide_to_begin() { + new stopflag; + new id; + stopflag = get_int(g_stopslide); + if (stopflag == 1) return; + set_state(PART:"elm.text", "slide_begin", 0.0); + id = timer(0.5, "slide_to_end", 1); + set_int(g_timer_id, id); + } + public start_slide() { + set_int(g_stopslide, 0); + set_state(PART:"elm.text", "slide_begin", 0.0); + slide_to_end(); + } + public stop_slide() { + new id; + set_int(g_stopslide, 1); + id = get_int(g_anim_id); + cancel_anim(id); + id = get_int(g_timer_id); + cancel_timer(id); + set_state(PART:"elm.text", "default", 0.0); + } + } + parts { + rect { "bg"; + desc { "default"; + color_class: "label/slide_short/bg"; + } + } + textblock { "elm.text"; + scale; + clip: "clipper"; + desc { "default"; + align: 0.0 0.0; + text { + style: "textblock_style"; + min: 0 1; + align: 0.0 0.0; + } + } + desc { "slide_end"; + inherit: "default"; + rel1.relative: 1.0 0.0; + align: 1.0 0.0; + text { + style: "textblock_style"; + min: 1 1; + align: 0.0 0.0; + } + } + desc { "slide_begin"; + inherit: "default"; + rel2.relative: 0.0 1.0; + align: 0.0 0.0; + text { + style: "textblock_style"; + min: 1 1; + align: 0.0 0.0; + } + } + } + } + programs { + program { "on_start_slide"; + script { + start_slide(); + } + } + program { "on_stop_slide"; + script { + stop_slide(); + } + } + } +} + +group { "elm/label/base/slide_bounce"; + inherit: "elm/label/base/template"; + script { + public g_duration = 0, g_stopslide, g_timer_id, g_anim_id; + + public message(Msg_Type:type, id, ...) { + if (type == MSG_FLOAT_SET) { + new Float:duration; + duration = getfarg(2); + if (id == 0) + set_float(g_duration, duration); + else + set_float(g_duration, duration / LABEL_FONT_SIZE_INC * SLIDE_SPEED_WEIGHT); + } + } + public slide_to_end_anim(val, Float:pos) { + new stopflag; + new id; + stopflag = get_int(g_stopslide); + if (stopflag == 1) return; + set_tween_state(PART:"elm.text", pos, "slide_begin", 0.0, "slide_end", 0.0); + if (pos >= 1.0) { + id = timer(0.5, "slide_to_begin", 1); + set_int(g_timer_id, id); + } + } + public slide_to_end() { + new stopflag; + new id; + new Float:duration; + stopflag = get_int(g_stopslide); + if (stopflag == 1) return; + duration = get_float(g_duration); + id = anim(duration, "slide_to_end_anim", 1); + set_int(g_anim_id, id); + } + public slide_to_begin_anim(val, Float:pos) { + new stopflag; + new id; + stopflag = get_int(g_stopslide); + if (stopflag == 1) return; + set_tween_state(PART:"elm.text", pos, "slide_end", 0.0, "slide_begin", 0.0); + if (pos >= 1.0) { + id = timer(0.5, "slide_to_end", 1); + set_int(g_timer_id, id); + } + } + public slide_to_begin() { + new stopflag; + new id; + new Float:duration; + stopflag = get_int(g_stopslide); + if (stopflag == 1) return; + duration = get_float(g_duration); + id = anim(duration, "slide_to_begin_anim", 1); + set_int(g_anim_id, id); + } + public start_slide() { + set_int(g_stopslide, 0); + set_state(PART:"elm.text", "slide_begin", 0.0); + slide_to_end(); + } + public stop_slide() { + new id; + set_int(g_stopslide, 1); + id = get_int(g_anim_id); + cancel_anim(id); + id = get_int(g_timer_id); + cancel_timer(id); + set_state(PART:"elm.text", "default", 0.0); + } + } + parts { + rect { "bg"; + desc { "default"; + color_class: "label/slide_bounce/bg"; + } + } + textblock { "elm.text"; + scale; + clip: "clipper"; + desc { "default"; + align: 0.0 0.0; + text { + style: "textblock_style"; + min: 0 1; + align: 0.0 0.0; + } + } + desc { "slide_end"; + inherit: "default"; + rel1.relative: 1.0 0.0; + align: 1.0 0.0; + text.min: 1 1; + } + desc { "slide_begin"; + inherit: "default"; + rel2.relative: 0.0 1.0; + text.min: 1 1; + } + } + } + programs { + program { "on_start_slide"; + script { + start_slide(); + } + } + program { "on_stop_slide"; + script { + stop_slide(); + } + } + } +}