clouseau: split properties list code to a different file.
SVN revision: 62803
This commit is contained in:
parent
c03fe66107
commit
645914b482
3
TODO
3
TODO
|
@ -1,11 +1,10 @@
|
|||
* Make it an elm module (or setting an env var without a module?) so I'll be able to remotely connect to elm apps.
|
||||
* Split UI and actual program code (better to do the previous bullet first on the bullet above).
|
||||
* Split UI and actual program code (better to do the previous bullet first).
|
||||
* Add "grab screenshot" button.
|
||||
* Add a clipping range rectangle.
|
||||
* Add special per object info, for example edje part names?
|
||||
* When items are coloured, show the exact colour using a rect?
|
||||
* Handle map/proxy
|
||||
* Add an option to filter out invisible/clippers
|
||||
* add a way to filter object with some regexp on the name and also finding a specific object according to name.
|
||||
|
||||
* Things to show per-object
|
||||
|
|
|
@ -8,12 +8,16 @@ AM_CPPFLAGS = \
|
|||
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
|
||||
@EFL_CFLAGS@
|
||||
|
||||
EXTRA_DIST =
|
||||
EXTRA_DIST = \
|
||||
libclouseau.h \
|
||||
ui/obj_information.h
|
||||
|
||||
pkgdir = $(libdir)/clouseau
|
||||
pkg_LTLIBRARIES = libclouseau.la
|
||||
|
||||
libclouseau_la_SOURCES = libclouseau.c
|
||||
libclouseau_la_SOURCES = \
|
||||
libclouseau.c \
|
||||
ui/obj_information.c
|
||||
|
||||
libclouseau_la_LDFLAGS = -module -avoid-version -rdynamic
|
||||
libclouseau_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "libclouseau.h"
|
||||
#include "ui/obj_information.h"
|
||||
|
||||
#ifdef HAVE___ATTRIBUTE__
|
||||
# define __UNUSED__ __attribute__((unused))
|
||||
#else
|
||||
|
@ -26,23 +29,11 @@
|
|||
static Elm_Genlist_Item_Class itc, itc_ee;
|
||||
static Eina_Bool _lib_init = EINA_FALSE;
|
||||
static Eina_List *tree = NULL;
|
||||
static Evas_Object *prop_list;
|
||||
static Eina_Bool list_show_clippers = EINA_TRUE, list_show_hidden = EINA_TRUE;
|
||||
|
||||
static void libclouseau_highlight(Evas_Object *addr);
|
||||
static Eina_Bool libclouseau_highlight_fade(void *rv);
|
||||
|
||||
typedef struct _Tree_Item Tree_Item;
|
||||
struct _Tree_Item
|
||||
{
|
||||
Tree_Item *parent;
|
||||
Eina_List *children;
|
||||
union {
|
||||
Ecore_Evas *ee;
|
||||
Evas_Object *obj;
|
||||
} data;
|
||||
};
|
||||
|
||||
static void
|
||||
_item_tree_item_free(Tree_Item *parent)
|
||||
{
|
||||
|
@ -173,91 +164,17 @@ static void
|
|||
_gl_selected(void *data __UNUSED__, Evas_Object *pobj __UNUSED__,
|
||||
void *event_info)
|
||||
{
|
||||
elm_list_clear(prop_list);
|
||||
|
||||
clouseau_obj_information_list_clear();
|
||||
/* If not an object, return. */
|
||||
if (!elm_genlist_item_parent_get(event_info))
|
||||
return;
|
||||
|
||||
Tree_Item *treeit = elm_genlist_item_data_get(event_info);
|
||||
|
||||
Evas_Object *obj = treeit->data.obj;
|
||||
libclouseau_highlight(obj);
|
||||
/* Populate properties list */
|
||||
{
|
||||
char buf[1024];
|
||||
Eina_Bool visibility;
|
||||
Evas_Coord x, y, w, h;
|
||||
double dx, dy;
|
||||
|
||||
visibility = evas_object_visible_get(obj);
|
||||
snprintf(buf, sizeof(buf), "Visibility: %d", (int) visibility);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
|
||||
if (evas_object_name_get(obj))
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "Name: %s",
|
||||
evas_object_name_get(obj));
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "Layer: %hd",
|
||||
evas_object_layer_get(obj));
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
|
||||
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
||||
snprintf(buf, sizeof(buf), "Position: %d %d", x, y);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
snprintf(buf, sizeof(buf), "Size: %d %d", w, h);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
|
||||
#if 0
|
||||
if (evas_object_clip_get(obj))
|
||||
{
|
||||
evas_object_geometry_get(
|
||||
evas_object_clip_get(obj), &x, &y, &w, &h);
|
||||
snprintf(buf, sizeof(buf), "Clipper position: %d %d", x, y);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
snprintf(buf, sizeof(buf), "Clipper size: %d %d", w, h);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
evas_object_size_hint_min_get(obj, &w, &h);
|
||||
snprintf(buf, sizeof(buf), "Min size: %d %d", w, h);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
|
||||
evas_object_size_hint_max_get(obj, &w, &h);
|
||||
snprintf(buf, sizeof(buf), "Max size: %d %d", w, h);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
|
||||
evas_object_size_hint_request_get(obj, &w, &h);
|
||||
snprintf(buf, sizeof(buf), "Request size: %d %d", w, h);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
|
||||
evas_object_size_hint_align_get(obj, &dx, &dy);
|
||||
snprintf(buf, sizeof(buf), "Align: %.6lg %.6lg", dx, dy);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
|
||||
evas_object_size_hint_weight_get(obj, &dx, &dy);
|
||||
snprintf(buf, sizeof(buf), "Weight: %.6lg %.6lg", dx, dy);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
|
||||
/* Handle color */
|
||||
{
|
||||
int r, g, b, a;
|
||||
evas_object_color_get(obj, &r, &g, &b, &a);
|
||||
snprintf(buf, sizeof(buf), "Color: %d %d %d %d", r, g, b, a);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
if (evas_object_clipees_get(obj))
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "Has clipees");
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
elm_list_go(prop_list);
|
||||
}
|
||||
clouseau_obj_information_list_populate(treeit);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -328,7 +245,7 @@ _load_list(Evas_Object *gl)
|
|||
Eina_List *ees, *eeitr;
|
||||
Ecore_Evas *ee, *this_ee;
|
||||
|
||||
elm_list_clear(prop_list);
|
||||
clouseau_obj_information_list_clear();
|
||||
elm_genlist_clear(gl);
|
||||
_item_tree_free();
|
||||
|
||||
|
@ -491,7 +408,8 @@ libclouseau_init(void)
|
|||
|
||||
/* Properties list */
|
||||
{
|
||||
prop_list = elm_list_add(panes);
|
||||
Evas_Object *prop_list = NULL;
|
||||
prop_list = clouseau_obj_information_list_add(panes);
|
||||
evas_object_size_hint_align_set(prop_list, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_size_hint_weight_set(prop_list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef _LIBCLOUSEAU_H
|
||||
#define _LIBCLOUSEAU_H
|
||||
#include <Eina.h>
|
||||
#include <Evas.h>
|
||||
#include <Ecore_Evas.h>
|
||||
#include <Elementary.h>
|
||||
|
||||
typedef struct _Tree_Item Tree_Item;
|
||||
struct _Tree_Item
|
||||
{
|
||||
Tree_Item *parent;
|
||||
Eina_List *children;
|
||||
union {
|
||||
Ecore_Evas *ee;
|
||||
Evas_Object *obj;
|
||||
} data;
|
||||
};
|
||||
#endif
|
|
@ -0,0 +1,103 @@
|
|||
#include "obj_information.h"
|
||||
|
||||
static Evas_Object *prop_list = NULL;
|
||||
|
||||
Evas_Object *
|
||||
clouseau_obj_information_list_add(Evas_Object *parent)
|
||||
{
|
||||
return prop_list = elm_list_add(parent);
|
||||
}
|
||||
|
||||
void
|
||||
clouseau_obj_information_list_populate(Tree_Item *treeit)
|
||||
{
|
||||
elm_list_clear(prop_list);
|
||||
|
||||
if (!treeit->parent)
|
||||
return;
|
||||
|
||||
Evas_Object *obj = treeit->data.obj;
|
||||
|
||||
/* Populate properties list */
|
||||
{
|
||||
char buf[1024];
|
||||
Eina_Bool visibility;
|
||||
Evas_Coord x, y, w, h;
|
||||
double dx, dy;
|
||||
|
||||
visibility = evas_object_visible_get(obj);
|
||||
snprintf(buf, sizeof(buf), "Visibility: %d", (int) visibility);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
|
||||
if (evas_object_name_get(obj))
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "Name: %s",
|
||||
evas_object_name_get(obj));
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "Layer: %hd",
|
||||
evas_object_layer_get(obj));
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
|
||||
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
||||
snprintf(buf, sizeof(buf), "Position: %d %d", x, y);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
snprintf(buf, sizeof(buf), "Size: %d %d", w, h);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
|
||||
#if 0
|
||||
if (evas_object_clip_get(obj))
|
||||
{
|
||||
evas_object_geometry_get(
|
||||
evas_object_clip_get(obj), &x, &y, &w, &h);
|
||||
snprintf(buf, sizeof(buf), "Clipper position: %d %d", x, y);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
snprintf(buf, sizeof(buf), "Clipper size: %d %d", w, h);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
evas_object_size_hint_min_get(obj, &w, &h);
|
||||
snprintf(buf, sizeof(buf), "Min size: %d %d", w, h);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
|
||||
evas_object_size_hint_max_get(obj, &w, &h);
|
||||
snprintf(buf, sizeof(buf), "Max size: %d %d", w, h);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
|
||||
evas_object_size_hint_request_get(obj, &w, &h);
|
||||
snprintf(buf, sizeof(buf), "Request size: %d %d", w, h);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
|
||||
evas_object_size_hint_align_get(obj, &dx, &dy);
|
||||
snprintf(buf, sizeof(buf), "Align: %.6lg %.6lg", dx, dy);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
|
||||
evas_object_size_hint_weight_get(obj, &dx, &dy);
|
||||
snprintf(buf, sizeof(buf), "Weight: %.6lg %.6lg", dx, dy);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
|
||||
/* Handle color */
|
||||
{
|
||||
int r, g, b, a;
|
||||
evas_object_color_get(obj, &r, &g, &b, &a);
|
||||
snprintf(buf, sizeof(buf), "Color: %d %d %d %d", r, g, b, a);
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
if (evas_object_clipees_get(obj))
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "Has clipees");
|
||||
elm_list_item_append(prop_list, buf, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
elm_list_go(prop_list);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
clouseau_obj_information_list_clear()
|
||||
{
|
||||
elm_list_clear(prop_list);
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef _OBJ_INFORMATION_H
|
||||
#define _OBJ_INFORMATION_H
|
||||
|
||||
#include "libclouseau.h"
|
||||
|
||||
Evas_Object *clouseau_obj_information_list_add(Evas_Object *parent);
|
||||
void clouseau_obj_information_list_populate(Tree_Item *treeit);
|
||||
void clouseau_obj_information_list_clear();
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue