Make the typebuf work nicely
This commit is contained in:
parent
7c662dae4d
commit
d334031953
@ -4,6 +4,7 @@ group {
|
||||
part {
|
||||
name: "background";
|
||||
mouse_events: 0;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
min: 255 255;
|
||||
@ -28,6 +29,7 @@ group {
|
||||
part {
|
||||
name: "filelist_container";
|
||||
type: IMAGE;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
min: 245 245;
|
||||
@ -56,10 +58,10 @@ group {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
part {
|
||||
name: "filelist";
|
||||
type: SWALLOW;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
|
||||
@ -75,6 +77,76 @@ group {
|
||||
}
|
||||
}
|
||||
|
||||
part {
|
||||
name: "filelist_overlay";
|
||||
type: IMAGE;
|
||||
mouse_events: 1;
|
||||
repeat_events: 1;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
color: 255 255 255 0;
|
||||
|
||||
rel1 {
|
||||
to: "filelist";
|
||||
}
|
||||
|
||||
rel2 {
|
||||
to: "filelist";
|
||||
}
|
||||
|
||||
image {
|
||||
normal: "text_overlay.png";
|
||||
border: 7 7 7 7;
|
||||
}
|
||||
}
|
||||
|
||||
description {
|
||||
state: "active" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
color: 255 255 255 100;
|
||||
}
|
||||
}
|
||||
|
||||
part {
|
||||
name: "filelist_overlay_text";
|
||||
type: TEXT;
|
||||
effect: NONE;
|
||||
mouse_events: 1;
|
||||
repeat_events: 1;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
align: 0.5 0.5;
|
||||
color: 255 255 255 0;
|
||||
|
||||
rel1 {
|
||||
to: "filelist_overlay";
|
||||
relative: 0.0 0.0;
|
||||
}
|
||||
|
||||
rel2 {
|
||||
to: "filelist_overlay";
|
||||
relative: 1.0 1.0;
|
||||
}
|
||||
|
||||
text {
|
||||
text: "";
|
||||
font: "ecdb/default";
|
||||
size: 24;
|
||||
min: 1 1;
|
||||
align: 0.5 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
description {
|
||||
state: "active" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
color: 255 255 255 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
programs {
|
||||
program {
|
||||
name: "filelist,focus,in";
|
||||
@ -93,6 +165,25 @@ group {
|
||||
target: "filelist_container";
|
||||
transition: LINEAR 0.5;
|
||||
}
|
||||
|
||||
program {
|
||||
name: "filelist_overlay,activate";
|
||||
action: STATE_SET "active" 0.0;
|
||||
signal: "ecdb,filelist_overlay,activate";
|
||||
source: "ecdb";
|
||||
target: "filelist_overlay";
|
||||
target: "filelist_overlay_text";
|
||||
transition: DECELERATE 0.5;
|
||||
}
|
||||
|
||||
program {
|
||||
name: "filelist_overlay,deactivate";
|
||||
action: STATE_SET "default" 0.0;
|
||||
signal: "ecdb,filelist_overlay,deactivate";
|
||||
source: "ecdb";
|
||||
target: "filelist_overlay";
|
||||
target: "filelist_overlay_text";
|
||||
transition: DECELERATE 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
images {
|
||||
image: "background.png" COMP;
|
||||
image: "focus.png" COMP;
|
||||
image: "text_overlay.png" COMP;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <Ecore_Data.h>
|
||||
#include <Ecore_File.h>
|
||||
#include <Ecore_Evas.h>
|
||||
#include <Ecore_Str.h>
|
||||
#include <Efreet_Mime.h>
|
||||
#include <Efreet.h>
|
||||
#include <Ewl.h>
|
||||
|
@ -33,7 +33,6 @@ _cb_filelist_mouse_in(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
|
||||
{
|
||||
Evas_Object *gui = data;
|
||||
edje_object_signal_emit(gui, "ecdb,filelist,in", "ecdb");
|
||||
printf("Emitting signal\n");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -42,22 +41,125 @@ _cb_filelist_mouse_out(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
|
||||
{
|
||||
Evas_Object *gui = data;
|
||||
edje_object_signal_emit(gui, "ecdb,filelist,out", "ecdb");
|
||||
printf("Emitting signal\n");
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_filelist_mouse_down(void *data __UNUSED__, Evas *e __UNUSED__,
|
||||
Evas_Object *eo, void *ev_data __UNUSED__)
|
||||
_cb_filelist_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *eo,
|
||||
void *ev_data __UNUSED__)
|
||||
{
|
||||
Evas_Object *gui = data;
|
||||
evas_object_focus_set(eo, TRUE);
|
||||
|
||||
edje_object_signal_emit(gui, "ecdb,filelist_overlay,deactivate",
|
||||
"ecdb");
|
||||
edje_object_part_text_set(gui, "filelist_overlay_text", "");
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_filelist_key_down(void *data, Evas *e, Evas_Object *eo, void *ev_data)
|
||||
_cb_filelist_key_down(void *data, Evas *e __UNUSED__,
|
||||
Evas_Object *eo __UNUSED__, void *ev_data)
|
||||
{
|
||||
Evas_Event_Key_Down *ek = ev_data;
|
||||
Evas_Object *gui = data;
|
||||
|
||||
printf("key pressed: %s\n", ek->key);
|
||||
if (!strcmp(ek->key, "Escape"))
|
||||
{
|
||||
edje_object_signal_emit(gui,
|
||||
"ecdb,filelist_overlay,deactivate", "ecdb");
|
||||
edje_object_part_text_set(gui, "filelist_overlay_text", "");
|
||||
}
|
||||
|
||||
else if (!strcmp(ek->key, "Return"))
|
||||
{
|
||||
Ewl_Widget *fl;
|
||||
Ewl_Filelist_Filter *filter;
|
||||
const char *ext;
|
||||
|
||||
if (!(ext = edje_object_part_text_get(gui,
|
||||
"filelist_overlay_text")))
|
||||
return;
|
||||
|
||||
fl = ewl_widget_name_find("main_filelist");
|
||||
filter = ewl_filelist_filter_get(EWL_FILELIST(fl));
|
||||
if (!filter)
|
||||
filter = calloc(sizeof(Ewl_Filelist_Filter), 1);
|
||||
|
||||
if (filter->extension)
|
||||
{
|
||||
if (strcmp(filter->extension, ext))
|
||||
{
|
||||
FREE(filter->extension);
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
filter->extension = strdup(ext);
|
||||
ewl_filelist_filter_set(EWL_FILELIST(fl), filter);
|
||||
ewl_filelist_refresh(EWL_FILELIST(fl));
|
||||
|
||||
edje_object_signal_emit(gui,
|
||||
"ecdb,filelist_overlay,deactivate", "ecdb");
|
||||
edje_object_part_text_set(gui, "filelist_overlay_text", "");
|
||||
}
|
||||
|
||||
else if (!strcmp(ek->key, "BackSpace"))
|
||||
{
|
||||
int len;
|
||||
const char *t;
|
||||
char *text;
|
||||
|
||||
t = edje_object_part_text_get(gui, "filelist_overlay_text");
|
||||
text = (t) ? (strdup(t)) : NULL;
|
||||
|
||||
if ((!text) || (!*text)) return;
|
||||
|
||||
len = strlen(text);
|
||||
text = realloc(text, len);
|
||||
text[len - 1] = '\0';
|
||||
|
||||
if (len == 1)
|
||||
edje_object_signal_emit(gui,
|
||||
"ecdb,filelist_overlay,deactivate",
|
||||
"ecdb");
|
||||
edje_object_part_text_set(gui, "filelist_overlay_text", text);
|
||||
FREE(text);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
int len;
|
||||
const char *t, *append;
|
||||
char *text;
|
||||
|
||||
t = edje_object_part_text_get(gui, "filelist_overlay_text");
|
||||
text = (t) ? (strdup(t)) : NULL;
|
||||
|
||||
if ((ek->string) && (*ek->string) && (!ek->string[1]))
|
||||
append = ek->string;
|
||||
else if ((ek->keyname) && (*ek->keyname) && (!ek->key[1]))
|
||||
append = ek->keyname;
|
||||
else
|
||||
return;
|
||||
|
||||
if (!text)
|
||||
text = strdup(append);
|
||||
else
|
||||
{
|
||||
len = strlen(text) + 2;
|
||||
text = realloc(text, len);
|
||||
ecore_strlcat(text, append, len);
|
||||
}
|
||||
|
||||
edje_object_signal_emit(gui, "ecdb,filelist_overlay,activate",
|
||||
"ecdb");
|
||||
edje_object_part_text_set(gui, "filelist_overlay_text", text);
|
||||
|
||||
free(text);
|
||||
}
|
||||
|
||||
/* And timer! */
|
||||
}
|
||||
|
||||
int
|
||||
@ -108,6 +210,7 @@ ecdb_create_main_gui(void)
|
||||
ewl_widget_show(embed);
|
||||
|
||||
filelist = ewl_filelist_new();
|
||||
ewl_widget_name_set(EWL_WIDGET(filelist), "main_filelist");
|
||||
ewl_container_child_append(EWL_CONTAINER(embed), filelist);
|
||||
ewl_filelist_directory_set(EWL_FILELIST(filelist), getenv("HOME"));
|
||||
ewl_callback_append(filelist, EWL_CALLBACK_MOUSE_IN,
|
||||
@ -160,6 +263,8 @@ ecdb_set_main_theme(const char *theme_name, const char *group)
|
||||
PACKAGE_DATA_DIR"/themes/default/edj");
|
||||
return;
|
||||
}
|
||||
evas_font_path_append(ecore_evas_get(em->main_win_ee),
|
||||
PACKAGE_DATA_DIR"/font");
|
||||
}
|
||||
|
||||
else if (!edje_object_file_set(gui, theme_name, group))
|
||||
|
Loading…
Reference in New Issue
Block a user