Enlightenment CVS committal

Author  : handyande
Project : misc
Module  : engage

Dir     : misc/engage/src


Modified Files:
        config.c window.c 


Log Message:
add zoom boolean
add (optional) ewl context menu - developing still, but needed to get the quit button 
in at least ;)
the right click listener is in an #if 1 so it can be removed if neccessary - need to 
talk to atmos about the mouse handlers
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/config.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- config.c    8 May 2004 15:55:33 -0000       1.14
+++ config.c    8 May 2004 17:45:57 -0000       1.15
@@ -4,8 +4,24 @@
 #include "dmalloc.h"
 #endif
 
+#ifdef HAVE_EWL
+#include <Ewl.h>
+Ewl_Widget     *menu, *menu_win;
+Evas_Object    *embed;
+int             init;
+#endif
+
 OD_Options      options;
 
+/* listeners */
+
+int
+zoom_listener(const char *key, const Ecore_Config_Type type, const int tag,
+              void *data)
+{
+  options.zoom = ecore_config_int_get(key);
+}
+
 int
 od_config_init(int argc, char **argv)
 {
@@ -37,7 +53,10 @@
                           "Size of icons in default state");
   ecore_config_int_create("engage.options.spacing", 4, 'S', "spacing",
                           "Space in pixels between each icon");
-  ecore_config_float_create("engage.options.zoom_factor", 2.0, 'z', "zoom",
+  ecore_config_int_create("engage.options.zoom", 1, 'z', "zoom",
+                          "Should we zoom icons?");
+  ecore_config_float_create("engage.options.zoom_factor", 2.0, 'Z',
+                            "zoom-factor",
                             "Zoom factor of the icons - 1.0 == 100% == nozoom");
   ecore_config_int_create("engage.options.arrow_size", 6, 'a', "arrow-size",
                           "Size (in pixels) of the status arrows");
@@ -45,10 +64,10 @@
                             "zoom-time",
                             "Time taken (in seconds) for icons to zoom");
 
-  options.tt_txt_color = 0xffffffff;
-  options.tt_shd_color = 0xbf000000;
-  options.bg_fore = 0xffffffff;
-  options.bg_back = 0x3fffffff;
+  options.tt_txt_color = 0x00000000;
+  options.tt_shd_color = 0x7f000000;
+  options.bg_fore = 0x7f000000;
+  options.bg_back = 0x7fffffff;
   ecore_config_string_create("engage.options.tt_fa", "Vera", 'f', "font",
                              "The font to use for application titles etc.");
   ecore_config_int_create("engage.options.tt_fs", 8, 'F', "font-size",
@@ -72,6 +91,8 @@
 
   options.size = ecore_config_int_get("engage.options.size");
   options.spacing = ecore_config_int_get("engage.options.spacing");
+  options.zoom = ecore_config_int_get("engage.options.zoom");
+  ecore_config_listen("zoom", "options.zoom", zoom_listener, 0, NULL);
   options.zoomfactor = ecore_config_float_get("engage.options.zoom_factor");
   options.arrow_size = ecore_config_int_get("engage.options.arrow_size");
   options.dock_zoom_duration =
@@ -84,3 +105,86 @@
 
   return ret;
 }
+
+#ifdef HAVE_EWL
+
+void
+od_config_menu_move_cb(Ewl_Widget * w, void *ev_data, void *user_data)
+{
+  ewl_object_request_position(EWL_OBJECT(user_data), CURRENT_X(menu_win),
+                              CURRENT_Y(menu_win));
+}
+
+void
+od_config_menu_out_cb(Ewl_Widget * w, void *ev_data, void *user_data)
+{
+  ewl_widget_hide(EWL_MENU_BASE(menu)->popup);
+}
+
+void
+od_config_menu_zoom_cb(Ewl_Widget * w, void *ev_data, void *user_data)
+{
+  ecore_config_int_set("options.zoom", options.zoom?0:1);
+  ewl_widget_hide(EWL_MENU_BASE(menu)->popup);
+}
+
+void
+od_config_menu_quit_cb(Ewl_Widget * w, void *ev_data, void *user_data)
+{
+  ewl_widget_hide(EWL_MENU_BASE(menu)->popup);
+  ecore_main_loop_quit();
+}
+
+void
+od_config_menu_init(void)
+{
+  Ewl_Widget     *menu_box, *item;
+
+  if (init)
+    return;
+  init = 1;
+
+  menu_win = ewl_embed_new();
+  ewl_object_set_fill_policy((Ewl_Object *) menu_win, EWL_FLAG_FILL_FILL);
+
+  embed =
+    ewl_embed_set_evas(EWL_EMBED(menu_win), evas,
+                       ecore_evas_software_x11_window_get(ee));
+  evas_object_layer_set(embed, 999);
+  evas_object_resize(embed, 100, 40);
+  evas_object_show(embed);
+  ewl_widget_show(menu_win);
+
+  menu_box = ewl_vbox_new();
+  ewl_object_set_fill_policy(EWL_OBJECT(menu_box), EWL_FLAG_FILL_FILL);
+  ewl_container_append_child(EWL_CONTAINER(menu_win), menu_box);
+  ewl_widget_show(menu_box);
+
+  menu = ewl_imenu_new(NULL, "config menu");
+  ewl_callback_append(EWL_WIDGET(menu_win), EWL_CALLBACK_CONFIGURE,
+                      od_config_menu_move_cb, EWL_MENU_BASE(menu)->popup);
+  ewl_callback_append(EWL_MENU_BASE(menu)->popup, EWL_CALLBACK_FOCUS_OUT,
+                      od_config_menu_out_cb, NULL);
+  ewl_container_append_child(EWL_CONTAINER(menu_box), menu);
+  /* *don't* show the menu, we only want the popup */
+
+  item = ewl_menu_item_new(NULL, "Icon Zooming");
+  ewl_container_append_child(EWL_CONTAINER(menu), item);
+  ewl_callback_append(item, EWL_CALLBACK_SELECT, od_config_menu_zoom_cb, NULL);
+  ewl_widget_show(item);
+
+  item = ewl_menu_item_new(NULL, "Quit");
+  ewl_container_append_child(EWL_CONTAINER(menu), item);
+  ewl_callback_append(item, EWL_CALLBACK_SELECT, od_config_menu_quit_cb, NULL);
+  ewl_widget_show(item);
+}
+
+void
+od_config_menu_draw(Evas_Coord x, Evas_Coord y)
+{
+  od_config_menu_init();
+  evas_object_move(embed, x - 5, y - 5);
+  ewl_callback_call(menu, EWL_CALLBACK_SELECT);
+}
+
+#endif
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/window.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- window.c    8 May 2004 15:55:33 -0000       1.15
+++ window.c    8 May 2004 17:45:57 -0000       1.16
@@ -25,6 +25,8 @@
                                   void *event);
 static void     handle_mouse_move(void *data, Evas * e, Evas_Object * obj,
                                   void *event);
+static void     handle_menu_draw(void *data, Evas * e, Evas_Object * obj,
+                                 void *event);
 
 int
 od_window_hide_timer_cb(void *data)
@@ -174,9 +176,9 @@
   evas_object_layer_set(eventer, 9999);
   evas_object_repeat_events_set(eventer, 1);
   evas_object_show(eventer);
-#if 0
+#if 1
   evas_object_event_callback_add(eventer, EVAS_CALLBACK_MOUSE_DOWN,
-                                 handle_mouse_down, NULL);
+                                 handle_menu_draw, NULL);
 #endif
   evas_object_event_callback_add(eventer, EVAS_CALLBACK_MOUSE_MOVE,
                                  handle_mouse_move, NULL);
@@ -294,3 +296,15 @@
   } else if (dock.state == zoomed || dock.state == zooming)
     od_dock_zoom_out();
 }
+
+static void
+handle_menu_draw(void *data, Evas * e, Evas_Object * obj, void *event)
+{
+  Evas_Event_Mouse_Down *ev = (Evas_Event_Mouse_Down *) event;
+
+#ifdef HAVE_EWL
+  if (ev->button == 3)
+    od_config_menu_draw(ev->canvas.x, ev->canvas.y);
+#endif
+}
+




-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to 
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to