1. fix list theme adapting - simply never got callbac ks to handle iot,

that's why!
2. make cmd-line tool to set scale, theme, finger size (more later) - used
this to test this and fix it.
3. cmd-line tool... also uses elm - and... as a result... also has a dialog
sayint its doing something - and... it can get a gui config later too!



SVN revision: 45175
This commit is contained in:
Carsten Haitzler 2010-01-15 09:32:43 +00:00
parent 40d8583a4d
commit d574bf68f7
7 changed files with 243 additions and 4 deletions

View File

@ -21,7 +21,7 @@ if ELEMENTARY_WINDOWS_BUILD
AM_CPPFLAGS += -DELEMENTARY_BUILD
endif
bin_PROGRAMS = elementary_test
bin_PROGRAMS = elementary_test elementary_config
if BUILD_QUICKLAUNCH
bin_PROGRAMS += elementary_quicklaunch elementary_run elementary_testql
endif
@ -75,6 +75,12 @@ test_conform.c
elementary_test_LDADD = $(top_builddir)/src/lib/libelementary.la @ELEMENTARY_EWEATHER_LIBS@
elementary_test_LDFLAGS =
elementary_config_SOURCES = \
config.c
elementary_config_LDADD = $(top_builddir)/src/lib/libelementary.la @ELEMENTARY_EWEATHER_LIBS@
elementary_config_LDFLAGS =
if BUILD_QUICKLAUNCH
elementary_quicklaunch_SOURCES = quicklaunch.c
elementary_quicklaunch_LDADD = $(top_builddir)/src/lib/libelementary.la @ELEMENTARY_EWEATHER_LIBS@

View File

@ -0,0 +1,156 @@
#include <Elementary.h>
#ifndef ELM_LIB_QUICKLAUNCH
static int quiet = 0;
static int interactive = 1;
static const char *theme_set = NULL;
static const char *finger_size_set = NULL;
static const char *scale_set = NULL;
static void
my_win_del(void *data, Evas_Object *obj, void *event_info)
{
/* called when my_win_main is requested to be deleted */
elm_exit(); /* exit the program's main loop that runs in elm_run() */
}
static void
status_win(void)
{
Evas_Object *win, *bg, *bx0;
win = elm_win_add(NULL, "main", ELM_WIN_BASIC);
elm_win_title_set(win, "Elementary Config");
evas_object_smart_callback_add(win, "delete,request", my_win_del, NULL);
bg = elm_bg_add(win);
evas_object_size_hint_weight_set(bg, 0.0, 0.0);
elm_win_resize_object_add(win, bg);
evas_object_show(bg);
bx0 = elm_box_add(win);
evas_object_size_hint_weight_set(bx0, 0.0, 0.0);
elm_win_resize_object_add(win, bx0);
evas_object_show(bx0);
if (!interactive)
{
Evas_Object *lb, *fr;
fr = elm_frame_add(win);
elm_frame_label_set(fr, "Information");
elm_box_pack_end(bx0, fr);
evas_object_show(fr);
lb = elm_label_add(win);
elm_label_label_set(lb,
"Applying configuration change"
);
elm_frame_content_set(fr, lb);
evas_object_show(lb);
}
else
{
Evas_Object *lb, *fr;
fr = elm_frame_add(win);
elm_frame_label_set(fr, "Fill me in");
elm_box_pack_end(bx0, fr);
evas_object_show(fr);
lb = elm_label_add(win);
elm_label_label_set(lb,
"Not done yet"
);
elm_frame_content_set(fr, lb);
evas_object_show(lb);
}
evas_object_show(win);
}
static int
_exit_timer(void *data)
{
elm_exit();
}
/* this is your elementary main function - it MUSt be called IMMEDIATELY
* after elm_init() and MUSt be passed argc and argv, and MUST be called
* elm_main and not be static - must be a visible symbol with EAPI infront */
EAPI int
elm_main(int argc, char **argv)
{
int i;
for (i = 1; i < argc; i++)
{
if (!strcmp(argv[i], "-h"))
{
printf("Usage:\n"
" -h This help\n"
" -q Quiet mode (dont show window)\n"
" -t THEME Set theme to THEME (ELM_THEME spec)\n"
" -f SIZE Set finger size to SIZE pixels\n"
" -s SCALE Set scale factor to SCALE\n"
);
}
else if (!strcmp(argv[i], "-q"))
{
quiet = 1;
interactive = 0;
}
else if ((!strcmp(argv[i], "-t")) && (i < argc - 1))
{
i++;
theme_set = argv[i];
interactive = 0;
}
else if ((!strcmp(argv[i], "-f")) && (i < argc - 1))
{
i++;
finger_size_set = argv[i];
interactive = 0;
}
else if ((!strcmp(argv[i], "-s")) && (i < argc - 1))
{
i++;
scale_set = argv[i];
interactive = 0;
}
}
/* put ere any init specific to this app like parsing args etc. */
if (!quiet)
{
status_win(); /* create main window */
ecore_timer_add(2.0, _exit_timer, NULL);
}
if (!interactive)
{
if (theme_set)
{
elm_theme_all_set(theme_set);
}
if (finger_size_set)
{
elm_finger_size_all_set(atoi(finger_size_set));
}
if (scale_set)
{
elm_scale_all_set(atof(scale_set));
}
if (quiet)
{
elm_exit();
}
}
elm_run(); /* and run the program now and handle all events etc. */
/* if the mainloop that elm_run() runs exist - we exit the app */
elm_shutdown(); /* clean up and shut down */
/* exit code */
return 0;
}
#endif
/* all emeentary apps should use this. but it right after elm_main() */
ELM_MAIN()

View File

@ -222,9 +222,11 @@ extern "C" {
EAPI double elm_scale_get(void);
EAPI void elm_scale_set(double scale);
EAPI void elm_scale_all_set(double scale);
EAPI Evas_Coord elm_finger_size_get(void);
EAPI void elm_finger_size_set(Evas_Coord size);
EAPI void elm_finger_size_all_set(Evas_Coord size);
EAPI void elm_object_focus(Evas_Object *obj);
EAPI void elm_object_unfocus(Evas_Object *obj);
EAPI void elm_object_focus_allow_set(Evas_Object *obj, Eina_Bool enable);
@ -242,7 +244,8 @@ extern "C" {
EAPI void elm_theme_extension_add(const char *item);
EAPI void elm_theme_extension_del(const char *item);
EAPI void elm_theme_flush(void);
EAPI void elm_theme_all_set(const char *theme);
EAPI Evas_Object *elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type);
EAPI void elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj);
EAPI void elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj);

View File

@ -163,7 +163,7 @@ elm_button_add(Evas_Object *parent)
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_disable_hook_set(obj, _disable_hook);
elm_widget_can_focus_set( obj, 1 );
elm_widget_can_focus_set(obj, 1 );
wd->btn = edje_object_add(e);
_elm_theme_set(wd->btn, "button", "base", "default");

View File

@ -39,6 +39,7 @@ struct _Elm_List_Item
};
static void _del_hook(Evas_Object *obj);
static void _theme_hook(Evas_Object *obj);
static void _sizing_eval(Evas_Object *obj);
static void _on_focus_hook(void *data, Evas_Object *obj);
static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
@ -191,6 +192,23 @@ _sizing_eval(Evas_Object *obj)
evas_object_size_hint_max_set(obj, maxw, maxh);
}
static void
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
Elm_List_Item *it;
Eina_List *n;
elm_smart_scroller_theme_set(wd->scr, "scroller", "base", elm_widget_style_get(obj));
edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
EINA_LIST_FOREACH(wd->items, n, it)
{
it->fixed = 0;
}
_fix_items(obj);
_sizing_eval(obj);
}
static void
_on_focus_hook(void *data, Evas_Object *obj)
{
@ -670,6 +688,7 @@ elm_list_add(Evas_Object *parent)
elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
elm_widget_data_set(obj, wd);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, 1);
wd->scr = elm_scroller_add(parent);

View File

@ -1319,6 +1319,27 @@ elm_scale_set(double scale)
_elm_rescale();
}
/**
* Set the global scaling factor for all applications on the display
*
* This sets the globally configured scaling factor that is applied to all
* objects for all applications.
* @param scale The scaling factor to set
* @ingroup Scaling
*/
EAPI void
elm_scale_all_set(double scale)
{
#ifdef HAVE_ELEMENTARY_X
static Ecore_X_Atom atom = 0;
int scale_i = (int)(scale * 1000.0);
if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_SCALE");
ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
atom, &scale_i, 1);
#endif
}
/**
* @defgroup Fingers Fingers
*
@ -1357,6 +1378,28 @@ elm_finger_size_set(Evas_Coord size)
_elm_rescale();
}
/**
* Set the configured finger size for all applications on the display
*
* This sets the globally configured finger size in pixels for all applications
* on the display
*
* @param size The finger size
* @ingroup Fingers
*/
EAPI void
elm_finger_size_all_set(Evas_Coord size)
{
#ifdef HAVE_ELEMENTARY_X
static Ecore_X_Atom atom = 0;
int size_i = (int)size;
if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FINGER_SIZE");
ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
atom, &size_i, 1);
#endif
}
/**
* Adjust size of an element for finger usage
*

View File

@ -140,6 +140,18 @@ elm_theme_flush(void)
_elm_win_rescale();
}
EAPI void
elm_theme_all_set(const char *theme)
{
#ifdef HAVE_ELEMENTARY_X
static Ecore_X_Atom atom = 0;
if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THEME");
ecore_x_window_prop_string_set(ecore_x_window_root_first_get(),
atom, theme);
#endif
}
int
_elm_theme_set(Evas_Object *o, const char *clas, const char *group, const char *style)
{