Hello, All!

Some improvements on efm_path module:
    1. fixed "Location:" label sizing,
    2. added button to clear path entry,
    3. added button to go to the path specified in entry,
    4. added image files for modified module theme.

What need to do:
    1. Make path entry history in efm2 user configuration file.
    2. Make combobox for path entry. (We have'nt combobox in "e" now?
       In etk and ewl combos are exists, but not in e...)
    3. Make path autocompletion in entry (from history and real path).

 Makefile.am           |    2
 e-module-efm_path.edc |  295 ++++++++++++++++++++++++++++++++++++++++++++++++--
 src/e_mod_main.c      |   56 ++++++---
 3 files changed, 326 insertions(+), 27 deletions(-)

Index: E-MODULES-EXTRA/efm_path/e-module-efm_path.edc
===================================================================
--- E-MODULES-EXTRA/efm_path/e-module-efm_path.edc      (revision 40597)
+++ E-MODULES-EXTRA/efm_path/e-module-efm_path.edc      (working copy)
@@ -1,6 +1,12 @@
 images
 {
    image: "entry.png" COMP;
+   image: "bt_base1.png" COMP;
+   image: "bt_base2.png" COMP;
+   image: "clear.png" COMP;
+   image: "go.png" COMP;
+   image: "bt_hilight.png" COMP;
+   image: "bt_shine.png" COMP;
 }

 collections
@@ -41,22 +47,139 @@
                       color: 255 255 255 0;
                    }
               }
-            part
+
+            // Clear button
+            part
               {
-                 name: "e.swallow.location";
-                 type: SWALLOW;
-                 description
+                 name: "bg_clear";
+                 type: IMAGE;
+                 mouse_events: 1;
+                 repeat_events: 1;
+                 description
+                   {
+                      state: "default" 0.0;
+                      align: 0.0 0.5;
+                      rel1.to: "base";
+                      rel2
+                        {
+                           relative: 0.0 1.0;
+                           to: "base";
+                        }
+                      max: 28 28;
+                      aspect: 1.0 1.0;
+                      aspect_preference: VERTICAL;
+                      image
+                        {
+                           normal: "bt_base2.png";
+                           border: 7 7 7 7;
+                        }
+                   }
+                 description
+                   {
+                      state: "down" 0.0;
+                      inherit: "default" 0.0;
+                      image.normal: "bt_base1.png";
+                   }
+              }
+            part
+              {
+                 name: "img_clear";
+                 type: IMAGE;
+                 mouse_events: 0;
+                 description
                    {
                       state: "default" 0.0;
-                      align: 0.0 0.5;
-                      rel1.to: "base";
+                      max: 18 18;
+                      rel1
+                        {
+                           offset: 7 7;
+                           to: "bg_clear";
+                        }
+                      rel2
+                        {
+                           offset: -8 -8;
+                           to: "bg_clear";
+                        }
+                      image.normal: "clear.png";
+                   }
+              }
+            part
+              {
+                 name: "fg1_clear";
+                 type: IMAGE;
+                 mouse_events: 1;
+                 repeat_events: 1;
+                 description
+                   {
+                      state: "default" 0.0;
+                      rel1.to: "bg_clear";
                       rel2
+                        {
+                           relative: 1.0 0.5;
+                           to: "bg_clear";
+                        }
+                      image
                         {
-                           relative: 0.2 1.0;
-                           to: "base";
+                           normal: "bt_hilight.png";
+                           border: 7 7 7 0;
                         }
                    }
               }
+            part
+              {
+                 name: "fg2_clear";
+                 type: IMAGE;
+                 mouse_events: 1;
+                 repeat_events: 1;
+                 description
+                   {
+                      state: "default" 0.0;
+                      rel1.to: "bg_clear";
+                      rel2.to: "bg_clear";
+                      image
+                        {
+                           normal: "bt_shine.png";
+                           border: 7 7 7 7;
+                        }
+                   }
+              }
+
+            // Location text label
+            part
+              {
+                 name: "e.text.title";
+                 type: TEXT;
+                 mouse_events: 0;
+                 scale: 1;
+                 description
+                   {
+                      state: "default" 0.0;
+                      visible: 1;
+                      align: 0.0 0.5;
+                      rel1
+                        {
+                           relative: 1.0 0.0;
+                           to_x: "bg_clear";
+                           to_y: "base";
+                        }
+                      rel2
+                        {
+                           relative: 0.0 1.0;
+                           to_x: "e.swallow.entry";
+                           to_y: "base";
+                        }
+                      color: 0 0 0 255;
+                      text
+                        {
+                           font: "Sans";
+                           size: 10;
+                           min: 1 1;
+                           max: 1 1;
+                           align: 0.0 0.5;
+                        }
+                   }
+              }
+            // Path entry
             part
               {
                  name: "e.swallow.entry";
@@ -67,11 +190,163 @@
                       rel1
                         {
                            relative: 1.0 0.0;
-                           to_x: "e.swallow.location";
+                           to_x: "e.text.title";
+                           to_y: "base";
                         }
-                      rel2.to: "base";
+                      rel2
+                        {
+                           relative: 0.0 1.0;
+                           to_x: "bg_go";
+                           to_y: "base";
+                        }
                    }
               }
+
+            // Go button
+            part
+              {
+                 name: "bg_go";
+                 type: IMAGE;
+                 mouse_events: 1;
+                 repeat_events: 1;
+                 description
+                   {
+                      state: "default" 0.0;
+                      align: 1.0 0.5;
+                      rel1
+                        {
+                          relative: 1.0 0.0;
+                          to: "base";
+                        }
+                      rel2.to: "base";
+                      max: 28 28;
+                      aspect: 1.0 1.0;
+                      aspect_preference: VERTICAL;
+                      image
+                        {
+                           normal: "bt_base2.png";
+                           border: 7 7 7 7;
+                        }
+                   }
+                 description
+                   {
+                      state: "down" 0.0;
+                      inherit: "default" 0.0;
+                      image.normal: "bt_base1.png";
+                   }
+              }
+            part
+              {
+                 name: "img_go";
+                 type: IMAGE;
+                 mouse_events: 0;
+                 description
+                   {
+                      state: "default" 0.0;
+                      max: 18 18;
+                      rel1
+                        {
+                           offset: 7 7;
+                           to: "bg_go";
+                        }
+                      rel2
+                        {
+                           offset: -8 -8;
+                           to: "bg_go";
+                        }
+                      image.normal: "go.png";
+                   }
+              }
+            part
+              {
+                 name: "fg1_go";
+                 type: IMAGE;
+                 mouse_events: 1;
+                 repeat_events: 1;
+                 description
+                   {
+                      state: "default" 0.0;
+                      rel1.to: "bg_go";
+                      rel2
+                        {
+                           relative: 1.0 0.5;
+                           to: "bg_go";
+                        }
+                      image
+                        {
+                           normal: "bt_hilight.png";
+                           border: 7 7 7 0;
+                        }
+                   }
+              }
+            part
+              {
+                 name: "fg2_go";
+                 type: IMAGE;
+                 mouse_events: 1;
+                 repeat_events: 1;
+                 description
+                   {
+                      state: "default" 0.0;
+                      rel1.to: "bg_go";
+                      rel2.to: "bg_go";
+                      image
+                        {
+                           normal: "bt_shine.png";
+                           border: 7 7 7 7;
+                        }
+                   }
+              }
          }
+
+       programs
+         {
+            program
+              {
+                 name: "clear_down";
+                 signal: "mouse,down,1";
+                 source: "bg_clear";
+                 action: STATE_SET "down" 0.0;
+                 target: "bg_clear";
+              }
+            program
+              {
+                 name: "clear_up";
+                 signal: "mouse,up,1";
+                 source: "bg_clear";
+                 action: STATE_SET "default" 0.0;
+                 target: "bg_clear";
+              }
+            program
+              {
+                 name: "clear_click";
+                 signal: "mouse,clicked,1";
+                 source: "bg_clear";
+                 action: SIGNAL_EMIT "e,clear,click" "";
+              }
+            program
+              {
+                 name: "go_down";
+                 signal: "mouse,down,1";
+                 source: "bg_go";
+                 action: STATE_SET "down" 0.0;
+                 target: "bg_go";
+              }
+            program
+              {
+                 name: "go_up";
+                 signal: "mouse,up,1";
+                 source: "bg_go";
+                 action: STATE_SET "default" 0.0;
+                 target: "bg_go";
+              }
+            program
+              {
+                 name: "go_click";
+                 signal: "mouse,clicked,1";
+                 source: "bg_go";
+                 action: SIGNAL_EMIT "e,go,click" "";
+              }
+         }
      }
 }
Index: E-MODULES-EXTRA/efm_path/src/e_mod_main.c
===================================================================
--- E-MODULES-EXTRA/efm_path/src/e_mod_main.c   (revision 40597)
+++ E-MODULES-EXTRA/efm_path/src/e_mod_main.c   (working copy)
@@ -5,7 +5,7 @@
 struct _Instance
 {
    E_Gadcon_Client *gcc;
-   Evas_Object *o_entry, *o_base, *o_loc, *o_event;
+   Evas_Object *o_entry, *o_base, *o_event;
    E_Toolbar *tbar;
    char *path;
 };
@@ -34,6 +34,10 @@
                                           void *event_info);
 static void             _cb_mouse_down    (void *data, Evas *e,
                                           Evas_Object *obj, void *event_info);
+static void             _cb_clear_click   (void *data, Evas_Object *obj,
+                                           const char *emission,
const char *source);
+static void             _cb_go_click      (void *data, Evas_Object *obj,
+                                           const char *emission,
const char *source);

 static Eina_List *instances = NULL;
 static E_Module *path_mod = NULL;
@@ -65,14 +69,17 @@
                                  _cb_mouse_down, inst);
    evas_object_show(inst->o_base);

-   inst->o_loc = e_widget_label_add(gc->evas, D_("Location:"));
-   edje_object_part_swallow(inst->o_base, "e.swallow.location", inst->o_loc);
-   evas_object_show(inst->o_loc);
+   edje_object_part_text_set(inst->o_base, "e.text.title", D_("Location:"));

    inst->o_entry = e_widget_entry_add(gc->evas, &(inst->path), NULL,
NULL, NULL);
    edje_object_part_swallow(inst->o_base, "e.swallow.entry", inst->o_entry);
    evas_object_show(inst->o_entry);

+   edje_object_signal_callback_add(inst->o_base, "e,clear,click", "",
+                                   _cb_clear_click, inst);
+   edje_object_signal_callback_add(inst->o_base, "e,go,click", "",
+                                   _cb_go_click, inst);
+
    /* add hook to know when user changes entry */
    evas_object_smart_callback_add(inst->o_entry, "key_down",
                                  _cb_key_down, inst);
@@ -118,7 +125,6 @@
    evas_object_event_callback_del(inst->o_base,
EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down);

    if (inst->o_event) evas_object_del(inst->o_event);
-   if (inst->o_loc) evas_object_del(inst->o_loc);
    if (inst->o_entry) evas_object_del(inst->o_entry);
    if (inst->o_base) evas_object_del(inst->o_base);
    if (inst->path) free(inst->path);
@@ -301,19 +307,10 @@
 _cb_key_down(void *data, Evas_Object *obj, void *event_info)
 {
    Evas_Event_Key_Down *ev;
-   Instance *inst;
-   Evas_Object *o_fm;
-   const char *p;

    ev = event_info;
-   if (strcmp(ev->keyname, "Return")) return;
-
-   inst = data;
-   if ((!inst) || (!inst->tbar)) return;
-   p = e_widget_entry_text_get(inst->o_entry);
-   o_fm = e_toolbar_fm2_get(inst->tbar);
-   if (!o_fm) return;
-   e_fm2_path_set(o_fm, p, "/");
+   if (!strcmp(ev->keyname, "Return"))
+      _cb_go_click(data, obj, NULL, NULL);
 }

 static void
@@ -335,3 +332,30 @@
    e_menu_activate_mouse(mn, zone, x, y, 1, 1,
                         E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
 }
+
+static void
+_cb_clear_click(void *data, Evas_Object *obj, const char *emission,
const char *source)
+{
+   Instance *inst;
+
+   inst = data;
+   if (!inst) return;
+
+   e_widget_entry_clear(inst->o_entry);
+}
+
+static void
+_cb_go_click(void *data, Evas_Object *obj, const char *emission,
const char *source)
+{
+   Instance *inst;
+   Evas_Object *o_fm;
+   const char *p;
+
+   inst = data;
+   if (!inst || !inst->tbar) return;
+   o_fm = e_toolbar_fm2_get(inst->tbar);
+   if (!o_fm) return;
+
+   p = e_widget_entry_text_get(inst->o_entry);
+   e_fm2_path_set(o_fm, p, "/");
+}
Index: E-MODULES-EXTRA/efm_path/Makefile.am
===================================================================
--- E-MODULES-EXTRA/efm_path/Makefile.am        (revision 40597)
+++ E-MODULES-EXTRA/efm_path/Makefile.am        (working copy)
@@ -6,7 +6,7 @@
 SUBDIRS = src po

 EDJE_FLAGS = -v \
-          -id $(top_srcdir)
+          -id $(top_srcdir)/images

 filesdir = $(datadir)
 files_DATA = \


WBR, Sergey.
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to