From b01469262bbac9cea29b1ab9bc0fc7c3890d3acb Mon Sep 17 00:00:00 2001 From: raster Date: Fri, 1 Apr 2011 13:35:39 +0000 Subject: [PATCH] more complete desktop entry mode support. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@58259 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- data/themes/default-desktop.edc | 730 ++++++++++++++++++++++++++++++++++++++++ src/lib/elm_entry.c | 35 +- 2 files changed, 749 insertions(+), 16 deletions(-) diff --git a/data/themes/default-desktop.edc b/data/themes/default-desktop.edc index c8d1feb..862ce78 100644 --- a/data/themes/default-desktop.edc +++ b/data/themes/default-desktop.edc @@ -1348,4 +1348,734 @@ collections { } } } + +//------------------------------------------------------------ + group { name: "elm/entry/base/default"; + styles + { + style { name: "entry_textblock_style"; + base: "font=Sans font_size=10 color=#000 wrap=word text_class=entry"; + tag: "br" "\n"; + tag: "ps" "ps"; + tag: "tab" "\t"; + tag: "em" "+ font=Sans:style=Oblique"; + tag: "b" "+ font=Sans:style=Bold"; + tag: "link" "+ color=#800 underline=on underline_color=#8008"; + tag: "hilight" "+ font=Sans:style=Bold"; + } + style { name: "entry_textblock_disabled_style"; + base: "font=Sans font_size=10 color=#00000080 wrap=word text_class=entry"; + tag: "br" "\n"; + tag: "ps" "ps"; + tag: "tab" "\t"; + tag: "em" "+ font=Sans:style=Oblique"; + tag: "b" "+ font=Sans:style=Bold"; + tag: "link" "+ color=#00000080 underline=on underline_color=#00000080"; + tag: "hilight" "+ font=Sans:style=Bold"; + } + } + data { +// item: context_menu_orientation "horizontal"; + } + parts { + part { name: "elm.text"; + type: TEXTBLOCK; + mouse_events: 1; + scale: 1; + entry_mode: EDITABLE; + select_mode: DEFAULT; + multiline: 1; + source: "elm/entry/selection/default"; // selection under + // source2: "X"; // selection over + // source3: "X"; // cursor under + source4: "elm/entry/cursor/default"; // cursorover + source5: "elm/entry/anchor/default"; // anchor under + // source6: "X"; // anchor over + description { state: "default" 0.0; + /* we gotta use 0 0 here, because of scrolled entries */ + fixed: 0 0; + text { + style: "entry_textblock_style"; + min: 0 1; + align: 0.0 0.0; + } + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + text { + style: "entry_textblock_disabled_style"; + min: 0 1; + } + } + } + } + programs { + program { name: "focus"; + signal: "load"; + source: ""; + action: FOCUS_SET; + target: "elm.text"; + } + program { name: "disable"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled" 0.0; + target: "elm.text"; + } + program { name: "enable"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.text"; + } + } + } + + group { name: "elm/entry/base-charwrap/default"; + styles + { + style { name: "entry_textblock_style_charwrap"; + base: "font=Sans font_size=10 color=#000 wrap=char text_class=entry"; + tag: "br" "\n"; + tag: "ps" "ps"; + tag: "tab" "\t"; + tag: "em" "+ font=Sans:style=Oblique"; + tag: "b" "+ font=Sans:style=Bold"; + tag: "link" "+ color=#800 underline=on underline_color=#8008"; + tag: "hilight" "+ font=Sans:style=Bold"; + } + style { name: "entry_textblock_disabled_style_charwrap"; + base: "font=Sans font_size=10 color=#00000080 wrap=char text_class=entry"; + tag: "br" "\n"; + tag: "ps" "ps"; + tag: "tab" "\t"; + tag: "em" "+ font=Sans:style=Oblique"; + tag: "b" "+ font=Sans:style=Bold"; + tag: "link" "+ color=#00000080 underline=on underline_color=#00000080"; + tag: "hilight" "+ font=Sans:style=Bold"; + } + } + parts { + part { name: "elm.text"; + type: TEXTBLOCK; + mouse_events: 1; + scale: 1; + entry_mode: EDITABLE; + select_mode: DEFAULT; + multiline: 1; + source: "elm/entry/selection/default"; // selection under +// source2: "X"; // selection over +// source3: "X"; // cursor under + source4: "elm/entry/cursor/default"; // cursorover + source5: "elm/entry/anchor/default"; // anchor under +// source6: "X"; // anchor over + description { state: "default" 0.0; + fixed: 1 0; + text { + style: "entry_textblock_style_charwrap"; + min: 0 1; + align: 0.0 0.0; + } + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + text { + style: "entry_textblock_disabled_style_charwrap"; + min: 0 1; + } + } + } + } + programs { + program { name: "focus"; + signal: "load"; + source: ""; + action: FOCUS_SET; + target: "elm.text"; + } + program { name: "disable"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled" 0.0; + target: "elm.text"; + } + program { name: "enable"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.text"; + } + } + } + + group { name: "elm/entry/base-nowrap/default"; + parts { + part { name: "elm.text"; + type: TEXTBLOCK; + mouse_events: 1; + scale: 1; + entry_mode: EDITABLE; + select_mode: DEFAULT; + multiline: 1; + source: "elm/entry/selection/default"; // selection under + source4: "elm/entry/cursor/default"; // cursorover + source5: "elm/entry/anchor/default"; // anchor under + description { state: "default" 0.0; + text { + style: "entry_textblock_style"; + min: 1 1; + align: 0.0 0.0; + } + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + text { + style: "entry_textblock_disabled_style"; + min: 0 1; + } + } + } +/* + part { name: "sel"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + align: 1.0 1.0; + max: 16 16; + aspect: 1.0 1.0; + color: 255 0 0 0; + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + color: 255 0 0 50; + } + } + */ + } + programs { + program { name: "focus"; + signal: "load"; + source: ""; + action: FOCUS_SET; + target: "elm.text"; + } + program { name: "disable"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled" 0.0; + target: "elm.text"; + } + program { name: "enable"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.text"; + } +/* + program { name: "selmode0"; + signal: "elm,state,select,on"; + source: "elm"; + action: STATE_SET "visible" 0.0; + target: "sel"; + } + program { name: "selmode1"; + signal: "elm,state,select,off"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "sel"; + } + */ + } + } + + group { name: "elm/entry/base-single/default"; + styles + { + style { name: "entry_single_textblock_style"; + base: "font=Sans font_size=10 color=#000 wrap=none text_class=entry"; + tag: "br" "\n"; + tag: "ps" "ps"; + tag: "tab" "\t"; + tag: "em" "+ font=Sans:style=Oblique"; + tag: "b" "+ font=Sans:style=Bold"; + tag: "link" "+ color=#800 underline=on underline_color=#8008"; + tag: "hilight" "+ font=Sans:style=Bold"; + } + style { name: "entry_single_textblock_disabled_style"; + base: "font=Sans font_size=10 color=#00000080 wrap=none text_class=entry"; + tag: "br" "\n"; + tag: "ps" "ps"; + tag: "tab" "\t"; + tag: "em" "+ font=Sans:style=Oblique"; + tag: "b" "+ font=Sans:style=Bold"; + tag: "link" "+ color=#00000080 underline=on underline_color=#00000080"; + tag: "hilight" "+ font=Sans:style=Bold"; + } + } + parts { + part { name: "elm.text"; + type: TEXTBLOCK; + mouse_events: 1; + scale: 1; + entry_mode: EDITABLE; + select_mode: DEFAULT; + multiline: 0; + source: "elm/entry/selection/default"; // selection under + source4: "elm/entry/cursor/default"; // cursorover + source5: "elm/entry/anchor/default"; // anchor under + description { state: "default" 0.0; + text { + style: "entry_single_textblock_style"; + min: 1 1; + max: 0 0; + align: 0.0 0.5; + } + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + text { + style: "entry_single_textblock_disabled_style"; + } + } + } + } + programs { + program { name: "focus"; + signal: "load"; + source: ""; + action: FOCUS_SET; + target: "elm.text"; + } + program { name: "disable"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled" 0.0; + target: "elm.text"; + } + program { name: "enable"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.text"; + } + } + } + + group { name: "elm/entry/base-single-noedit/default"; + parts { + part { name: "elm.text"; + type: TEXTBLOCK; + mouse_events: 1; + scale: 1; + entry_mode: PLAIN; + select_mode: DEFAULT; + multiline: 0; + source: "elm/entry/selection/default"; // selection under + source5: "elm/entry/anchor/default"; // anchor under + description { state: "default" 0.0; + text { + style: "entry_single_textblock_style"; + min: 1 1; + max: 0 0; + align: 0.0 0.5; + } + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + text { + style: "entry_single_textblock_disabled_style"; + } + } + } + } + programs { + program { name: "focus"; + signal: "load"; + source: ""; + action: FOCUS_SET; + target: "elm.text"; + } + program { name: "disable"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled" 0.0; + target: "elm.text"; + } + program { name: "enable"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.text"; + } + } + } + + group { name: "elm/entry/base-noedit/default"; + parts { + part { name: "elm.text"; + type: TEXTBLOCK; + mouse_events: 1; + scale: 1; + entry_mode: PLAIN; + select_mode: DEFAULT; + multiline: 1; + source: "elm/entry/selection/default"; // selection under + source5: "elm/entry/anchor/default"; // anchor under + description { state: "default" 0.0; + fixed: 1 0; + text { + style: "entry_textblock_style"; + min: 0 1; + align: 0.0 0.0; + } + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + text { + style: "entry_textblock_disabled_style"; + } + } + } + } + programs { + program { name: "focus"; + signal: "load"; + source: ""; + action: FOCUS_SET; + target: "elm.text"; + } + program { name: "disable"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled" 0.0; + target: "elm.text"; + } + program { name: "enable"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.text"; + } + } + } + + group { name: "elm/entry/base-noedit-charwrap/default"; + parts { + part { name: "elm.text"; + type: TEXTBLOCK; + mouse_events: 1; + scale: 1; + entry_mode: PLAIN; + select_mode: DEFAULT; + multiline: 1; + source: "elm/entry/selection/default"; // selection under + source5: "elm/entry/anchor/default"; // anchor under + description { state: "default" 0.0; + fixed: 1 0; + text { + style: "entry_textblock_style_charwrap"; + min: 0 1; + align: 0.0 0.0; + } + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + text { + style: "entry_textblock_disabled_style_charwrap"; + } + } + } + } + programs { + program { name: "focus"; + signal: "load"; + source: ""; + action: FOCUS_SET; + target: "elm.text"; + } + program { name: "disable"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled" 0.0; + target: "elm.text"; + } + program { name: "enable"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.text"; + } + } + } + + group { name: "elm/entry/base-nowrap-noedit/default"; + parts { + part { name: "elm.text"; + type: TEXTBLOCK; + mouse_events: 1; + scale: 1; + entry_mode: PLAIN; + select_mode: DEFAULT; + multiline: 1; + source: "elm/entry/selection/default"; // selection under + source5: "elm/entry/anchor/default"; // anchor under + description { state: "default" 0.0; + text { + style: "entry_textblock_style"; + min: 1 1; + align: 0.0 0.0; + } + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + text { + style: "entry_textblock_disabled_style"; + } + } + } + } + programs { + program { name: "focus"; + signal: "load"; + source: ""; + action: FOCUS_SET; + target: "elm.text"; + } + program { name: "disable"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled" 0.0; + target: "elm.text"; + } + program { name: "enable"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.text"; + } + } + } + + group { name: "elm/entry/base-password/default"; + parts { + part { name: "elm.text"; + type: TEXTBLOCK; + mouse_events: 1; + scale: 1; + entry_mode: PASSWORD; + select_mode: DEFAULT; + multiline: 0; + source: "elm/entry/selection/default"; // selection under + source4: "elm/entry/cursor/default"; // cursorover + source5: "elm/entry/anchor/default"; // anchor under + description { state: "default" 0.0; + text { + style: "entry_single_textblock_style"; + repch: "*"; + min: 1 1; + max: 0 0; + align: 0.0 0.5; + } + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + text { + style: "entry_single_textblock_disabled_style"; + } + } + } + } + programs { + program { name: "focus"; + signal: "load"; + source: ""; + action: FOCUS_SET; + target: "elm.text"; + } + program { name: "disable"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled" 0.0; + target: "elm.text"; + } + program { name: "enable"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.text"; + } + } + } + + group { name: "elm/entry/cursor/default"; + images { + image: "cur_box.png" COMP; + image: "cur_hi.png" COMP; + image: "cur_shad.png" COMP; + image: "cur_shine.png" COMP; + image: "cur_glow.png" COMP; + } + parts { + part { name: "clip2"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "clip"; + rel2.to: "clip"; + visible: 0; + } + description { state: "focused" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + part { name: "clip"; + type: RECT; + mouse_events: 0; + clip_to: "clip2"; + description { state: "default" 0.0; + rel1.offset: -10 0; + rel2.offset: 9 9; + } + description { state: "hidden" 0.0; + inherit: "default" 0.0; + visible: 0; + } + } + part { name: "bg"; + mouse_events: 0; + clip_to: "clip"; + description { state: "default" 0.0; + rel1.to: "base"; + rel1.offset: -2 0; + rel2.to: "base"; + rel2.offset: 1 1; + image.border: 2 2 2 2; + image.normal: "cur_shad.png"; + } + } + part { name: "base"; + mouse_events: 0; + scale: 1; + clip_to: "clip"; + description { state: "default" 0.0; + min: 2 2; + align: 0.5 1.0; + rel1.relative: 0.0 1.0; + rel1.offset: 0 -1; + rel2.relative: 1.0 1.0; + rel2.offset: -1 -1; + image.normal: "cur_box.png"; + } + } + part { name: "hi"; + mouse_events: 0; + clip_to: "clip"; + description { state: "default" 0.0; + rel1.to: "base"; + rel2.to: "base"; + rel2.relative: 1.0 0.5; + image.normal: "cur_hi.png"; + } + } + part { name: "shine"; + mouse_events: 0; + clip_to: "clip"; + clip_to: "clip2"; + description { state: "default" 0.0; + rel1.to: "base"; + rel2.to: "base"; + rel2.relative: 1.0 0.75; + image.border: 2 2 1 0; + image.normal: "cur_shine.png"; + fill.smooth: 0; + } + } + part { name: "glow"; + mouse_events: 0; + clip_to: "clip2"; + description { state: "default" 0.0; + rel1.to: "base"; + rel1.relative: 0.0 -2.0; + rel1.offset: -2 0; + rel2.to: "base"; + rel2.relative: 1.0 0.0; + rel2.offset: 1 1; + image.border: 2 2 0 4; + image.normal: "cur_glow.png"; + fill.smooth: 0; + } + description { state: "hidden" 0.0; + inherit: "default" 0.0; + color: 255 255 255 0; + } + } + } + programs { + program { name: "show"; + signal: "show"; + source: ""; + action: STATE_SET "hidden" 0.0; + in: 1.0 0.0; + transition: DECELERATE 2.0; + target: "glow"; + after: "show2"; + } + program { name: "show2"; + action: STATE_SET "hidden" 0.0; + in: 0.2 0.0; + target: "clip"; + after: "show3"; + } + program { name: "show3"; + action: STATE_SET "default" 0.0; + in: 0.5 0.0; + target: "clip"; + after: "show4"; + } + program { name: "show4"; + action: STATE_SET "default" 0.0; + in: 0.5 0.0; + transition: DECELERATE 0.5; + target: "glow"; + after: "show"; + } + program { name: "focused"; + signal: "elm,action,focus"; + source: "elm"; + action: STATE_SET "focused" 0.0; + target: "clip2"; + } + program { name: "unfocused"; + signal: "elm,action,unfocus"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "clip2"; + } + } + } + + group { name: "elm/entry/selection/default"; + parts { + part { name: "bg"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + color: 128 128 128 128; + } + } + } + } + + group { name: "elm/entry/anchor/default"; + parts { + part { name: "bg"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + color: 128 0 0 64; + } + } + } + } } diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c index 1607db1..78afec1 100644 --- a/src/lib/elm_entry.c +++ b/src/lib/elm_entry.c @@ -902,22 +902,7 @@ _menu_press(Evas_Object *obj) top = elm_widget_top_get(obj); if (top) elm_hoversel_hover_parent_set(wd->hoversel, top); evas_object_smart_callback_add(wd->hoversel, "dismissed", _dismissed, obj); - if (!wd->selmode) - { - if (!_elm_config->desktop_entry) - { - if (!wd->password) - elm_hoversel_item_add(wd->hoversel, E_("Select"), NULL, ELM_ICON_NONE, - _select, obj); - } - if (1) // need way to detect if someone has a selection - { - if (wd->editable) - elm_hoversel_item_add(wd->hoversel, E_("Paste"), NULL, ELM_ICON_NONE, - _paste, obj); - } - } - else + if (wd->have_selection) { if (!wd->password) { @@ -933,6 +918,24 @@ _menu_press(Evas_Object *obj) _cancel, obj); } } + else + { + if (!wd->selmode) + { + if (!_elm_config->desktop_entry) + { + if (!wd->password) + elm_hoversel_item_add(wd->hoversel, E_("Select"), NULL, ELM_ICON_NONE, + _select, obj); + } + if (1) // need way to detect if someone has a selection + { + if (wd->editable) + elm_hoversel_item_add(wd->hoversel, E_("Paste"), NULL, ELM_ICON_NONE, + _paste, obj); + } + } + } EINA_LIST_FOREACH(wd->items, l, it) { elm_hoversel_item_add(wd->hoversel, it->label, it->icon_file, -- 2.7.4