Revert "revert all the ui breakes in e - going the wrong direction in the"

This reverts commit 3ea6a3569d.
devs/bu5hm4n/econfigure2
Mike Blumenkrantz 8 years ago
parent 0ed9f93703
commit 3fc96af2dd
  1. 1
      po/POTFILES.in
  2. 2
      src/bin/Makefile.mk
  3. 14
      src/bin/e_config_dialog.c
  4. 6
      src/bin/e_desktop_editor.c
  5. 2
      src/bin/e_exec.c
  6. 8
      src/bin/e_fm_prop.c
  7. 1
      src/bin/e_includes.h
  8. 12
      src/bin/e_int_client_prop.c
  9. 6
      src/bin/e_int_client_remember.c
  10. 2
      src/bin/e_int_config_comp.c
  11. 6
      src/bin/e_int_config_comp_match.c
  12. 2
      src/bin/e_int_config_modules.c
  13. 6
      src/bin/e_int_gadcon_config.c
  14. 2
      src/bin/e_int_shelf_config.c
  15. 980
      src/bin/e_table.c
  16. 20
      src/bin/e_table.h
  17. 4
      src/bin/e_widget.c
  18. 86
      src/bin/e_widget_button.c
  19. 2
      src/bin/e_widget_config_list.c
  20. 4
      src/bin/e_widget_csel.c
  21. 1
      src/bin/e_widget_entry.c
  22. 24
      src/bin/e_widget_filepreview.c
  23. 26
      src/bin/e_widget_framelist.c
  24. 93
      src/bin/e_widget_frametable.c
  25. 4
      src/bin/e_widget_fsel.c
  26. 20
      src/bin/e_widget_label.c
  27. 6
      src/bin/e_widget_list.c
  28. 67
      src/bin/e_widget_table.c
  29. 4
      src/bin/e_widget_table.h
  30. 56
      src/bin/e_widget_textblock.c
  31. 2
      src/bin/e_widget_toolbook.c
  32. 2
      src/modules/backlight/e_mod_main.c
  33. 4
      src/modules/battery/e_mod_config.c
  34. 2
      src/modules/clock/e_mod_config.c
  35. 2
      src/modules/clock/e_mod_main.c
  36. 6
      src/modules/conf_applications/e_int_config_apps.c
  37. 2
      src/modules/conf_applications/e_int_config_apps_personal.c
  38. 4
      src/modules/conf_applications/e_int_config_defapps.c
  39. 2
      src/modules/conf_bindings/e_int_config_acpibindings.c
  40. 2
      src/modules/conf_bindings/e_int_config_edgebindings.c
  41. 2
      src/modules/conf_bindings/e_int_config_keybindings.c
  42. 2
      src/modules/conf_bindings/e_int_config_mousebindings.c
  43. 2
      src/modules/conf_bindings/e_int_config_signalbindings.c
  44. 2
      src/modules/conf_dialogs/e_int_config_profiles.c
  45. 4
      src/modules/conf_display/e_int_config_desklock.c
  46. 4
      src/modules/conf_display/e_int_config_desklock_fsel.c
  47. 6
      src/modules/conf_intl/e_int_config_imc.c
  48. 4
      src/modules/conf_intl/e_int_config_intl.c
  49. 2
      src/modules/conf_paths/e_int_config_env.c
  50. 2
      src/modules/conf_paths/e_int_config_paths.c
  51. 2
      src/modules/conf_performance/e_int_config_powermanagement.c
  52. 2
      src/modules/conf_shelves/e_int_config_shelf.c
  53. 6
      src/modules/conf_theme/e_int_config_fonts.c
  54. 2
      src/modules/conf_theme/e_int_config_scale.c
  55. 6
      src/modules/conf_theme/e_int_config_theme.c
  56. 2
      src/modules/conf_theme/e_int_config_transitions.c
  57. 12
      src/modules/conf_theme/e_int_config_wallpaper.c
  58. 4
      src/modules/everything/evry_config.c
  59. 2
      src/modules/gadman/e_mod_config.c
  60. 2
      src/modules/ibar/e_mod_config.c
  61. 34
      src/modules/lokker/lokker.c
  62. 2
      src/modules/mixer/conf_gadget.c
  63. 2
      src/modules/mixer/e_mod_main.c
  64. 2
      src/modules/packagekit/e_mod_packagekit.c
  65. 14
      src/modules/pager/e_mod_main.c
  66. 14
      src/modules/pager_plain/e_mod_main.c
  67. 12
      src/modules/quickaccess/e_mod_config.c
  68. 2
      src/modules/teamwork/e_mod_config.c
  69. 2
      src/modules/xkbswitch/e_mod_config.c

@ -90,7 +90,6 @@ src/bin/e_start_main.c
src/bin/e_startup.c
src/bin/e_sys.c
src/bin/e_sys_main.c
src/bin/e_table.c
src/bin/e_test.c
src/bin/e_theme.c
src/bin/e_theme_about.c

@ -153,7 +153,6 @@ src/bin/e_slidesel.h \
src/bin/e_spectrum.h \
src/bin/e_startup.h \
src/bin/e_sys.h \
src/bin/e_table.h \
src/bin/e_test.h \
src/bin/e_theme_about.h \
src/bin/e_theme.h \
@ -318,7 +317,6 @@ src/bin/e_slidesel.c \
src/bin/e_spectrum.c \
src/bin/e_startup.c \
src/bin/e_sys.c \
src/bin/e_table.c \
src/bin/e_test.c \
src/bin/e_theme_about.c \
src/bin/e_theme.c \

@ -172,14 +172,23 @@ _e_config_dialog_free(E_Config_Dialog *cfd)
E_FREE(cfd);
}
static void
_e_config_hints(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
int w, h;
edje_object_size_min_calc(data, &w, &h);
evas_object_size_hint_min_set(data, w, h);
}
static void
_e_config_dialog_go(E_Config_Dialog *cfd, E_Config_Dialog_CFData_Type type)
{
Evas *evas;
E_Dialog *pdia;
Evas_Object *o, *ob, *sf;
Evas_Coord mw = 0, mh = 0;
char buf[256];
int mw = -1, mh = -1;
void *cfdata;
pdia = cfd->dia;
@ -269,8 +278,9 @@ _e_config_dialog_go(E_Config_Dialog *cfd, E_Config_Dialog_CFData_Type type)
}
}
e_widget_size_min_get(o, &mw, &mh);
evas_object_event_callback_add(o, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _e_config_hints, cfd->dia->bg_object);
e_widget_on_change_hook_set(o, _e_config_dialog_cb_changed, cfd);
e_widget_size_min_get(o, &mw, &mh);
e_dialog_content_set(cfd->dia, o, mw, mh);
if (!pdia) /* dialog window was created in this function call - need to create buttons once */

@ -702,7 +702,7 @@ _e_desktop_edit_basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas
otb = e_widget_toolbook_add(evas, 48 * e_scale, 48 * e_scale);
ot = e_widget_table_add(evas, 0);
ot = e_widget_table_add(e_win_evas_win_get(evas), 0);
o = e_widget_label_add(evas, _("Name"));
e_widget_table_object_append(ot, o, 0, 0, 1, 1, 1, 1, 0, 0);
@ -750,7 +750,7 @@ _e_desktop_edit_basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas
/* e_widget_size_min_get(ol, &mw, &mh); */
ot = e_widget_table_add(evas, 0);
ot = e_widget_table_add(e_win_evas_win_get(evas), 0);
editor->img_widget = e_widget_button_add
(evas, "", NULL, _e_desktop_editor_cb_icon_select, cfdata, editor);
@ -770,7 +770,7 @@ _e_desktop_edit_basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas
e_widget_toolbook_page_append
(otb, NULL, _("Icon"), ot, 0, 0, 0, 0, 0.5, 0.5);
ot = e_widget_table_add(evas, 0);
ot = e_widget_table_add(e_win_evas_win_get(evas), 0);
o = e_widget_label_add(evas, _("Generic Name"));
e_widget_table_object_append(ot, o, 0, 0, 1, 1, 1, 1, 0, 0);

@ -1076,7 +1076,7 @@ _advanced_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_D
_fill_data(cfdata);
o = e_widget_list_add(evas, 0, 0);
ot = e_widget_table_add(evas, 0);
ot = e_widget_table_add(e_win_evas_win_get(evas), 0);
ob = e_widget_label_add(evas, cfdata->label);
e_widget_list_object_append(o, ob, 1, 1, 0.5);

@ -384,9 +384,9 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
win = cfd->dia->win;
snprintf(buf, sizeof(buf), "%s/%s",
cfdata->location, cfdata->fi->file);
o = e_widget_table_add(evas, 0);
o = e_widget_table_add(e_win_evas_win_get(evas), 0);
ot = e_widget_table_add(evas, 0);
ot = e_widget_table_add(e_win_evas_win_get(evas), 0);
ob = e_widget_label_add(evas, _("Name:"));
e_widget_table_object_append(ot, ob, 0, 0, 1, 1, 1, 0, 1, 0);
@ -480,7 +480,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
of = e_widget_frametable_add(evas, _("Preview"), 0);
ot = e_widget_table_add(evas, 0);
ot = e_widget_table_add(e_win_evas_win_get(evas), 0);
ob = e_widget_preview_add(evas, 128, 128);
cfdata->gui.preview = ob;
cfdata->gui.preview_table = ot;
@ -572,7 +572,7 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
/* generate the core widget layout for an advanced dialog */
Evas_Object *o;
o = e_widget_table_add(evas, 0);
o = e_widget_table_add(e_win_evas_win_get(evas), 0);
return o;
}

@ -30,7 +30,6 @@
#include "e_startup.h"
#include "e_signals.h"
#include "e_xinerama.h"
#include "e_table.h"
#include "e_layout.h"
#include "e_font.h"
#include "e_intl.h"

@ -444,7 +444,7 @@ _ec_icccm_create(E_Dialog *dia, void *data __UNUSED__)
evas = evas_object_evas_get(dia->win);
otb = e_widget_toolbook_add(evas, 48 * e_scale, 48 * e_scale);
o = e_widget_table_add(evas, 0);
o = e_widget_table_add(e_win_evas_win_get(evas), 0);
STR_ENTRY(_("Title"), 0, 0, icccm.title);
STR_ENTRY(_("Name"), 0, 1, icccm.name);
STR_ENTRY(_("Class"), 0, 2, icccm.class);
@ -453,14 +453,14 @@ _ec_icccm_create(E_Dialog *dia, void *data __UNUSED__)
STR_ENTRY(_("Role"), 0, 5, icccm.role);
e_widget_toolbook_page_append(otb, NULL, _("General"), o, 1, 1, 1, 1, 0.5, 0.0);
o = e_widget_table_add(evas, 0);
o = e_widget_table_add(e_win_evas_win_get(evas), 0);
STR_ENTRY(_("Minimum Size"), 0, 6, icccm.min);
STR_ENTRY(_("Maximum Size"), 0, 7, icccm.max);
STR_ENTRY(_("Base Size"), 0, 8, icccm.base);
STR_ENTRY(_("Resize Steps"), 0, 9, icccm.step);
e_widget_toolbook_page_append(otb, NULL, _("Sizing"), o, 1, 1, 1, 1, 0.5, 0.0);
o = e_widget_table_add(evas, 0);
o = e_widget_table_add(e_win_evas_win_get(evas), 0);
STR_ENTRY(_("Aspect Ratio"), 2, 0, icccm.aspect);
STR_ENTRY(_("Initial State"), 2, 1, icccm.initial_state);
STR_ENTRY(_("State"), 2, 2, icccm.state);
@ -472,7 +472,7 @@ _ec_icccm_create(E_Dialog *dia, void *data __UNUSED__)
STR_ENTRY(_("Command"), 2, 8, icccm.command);
e_widget_toolbook_page_append(otb, NULL, _("States"), o, 1, 1, 1, 1, 0.5, 0.0);
o = e_widget_table_add(evas, 0);
o = e_widget_table_add(e_win_evas_win_get(evas), 0);
CHK_ENTRY(_("Take Focus"), 0, 11, icccm.take_focus);
CHK_ENTRY(_("Accepts Focus"), 0, 12, icccm.accepts_focus);
CHK_ENTRY(_("Urgent"), 0, 13, icccm.urgent);
@ -499,13 +499,13 @@ _ec_netwm_create(E_Dialog *dia, void *data __UNUSED__)
evas = evas_object_evas_get(dia->win);
otb = e_widget_toolbook_add(evas, 48 * e_scale, 48 * e_scale);
o = e_widget_table_add(evas, 0);
o = e_widget_table_add(e_win_evas_win_get(evas), 0);
STR_ENTRY(_("Name"), 0, 1, netwm.name);
STR_ENTRY(_("Icon Name"), 0, 2, netwm.icon_name);
STR_ENTRY(_("Stacking"), 0, 3, netwm.stacking);
e_widget_toolbook_page_append(otb, NULL, _("General"), o, 1, 1, 1, 1, 0.5, 0.0);
o = e_widget_table_add(evas, 0);
o = e_widget_table_add(e_win_evas_win_get(evas), 0);
CHK_ENTRY(_("Modal"), 0, 4, netwm.modal);
CHK_ENTRY(_("Sticky"), 0, 5, netwm.sticky);
CHK_ENTRY(_("Shaded"), 0, 6, netwm.shaded);

@ -737,8 +737,7 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
}
e_widget_toolbook_page_append(o, NULL, _("Identifiers"), of, 1, 1, 1, 1, 0.5, 0.0);
of = e_widget_table_add(evas, 0);
e_widget_table_freeze(of);
of = e_widget_table_add(e_win_evas_win_get(evas), 0);
ob = e_widget_check_add(evas, _("Position"),
&(cfdata->remember.apply_pos));
e_widget_table_object_append(of, ob, 0, 0, 1, 1, 1, 0, 1, 0);
@ -795,7 +794,7 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
e_widget_table_object_append(of, ob, 0, 9, 2, 1, 1, 0, 1, 0);
e_widget_toolbook_page_append(o, NULL, _("Properties"), of, 1, 1, 1, 1, 0.5, 0.0);
of = e_widget_table_add(evas, 0);
of = e_widget_table_add(e_win_evas_win_get(evas), 0);
ob = e_widget_check_add(evas, _("Match only one window"),
&(cfdata->remember.apply_first_only));
e_widget_table_object_append(of, ob, 0, 0, 1, 1, 1, 0, 1, 0);
@ -814,7 +813,6 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
&(cfdata->remember.apply_run));
e_widget_table_object_append(of, ob, 0, 3, 1, 1, 1, 0, 1, 0);
}
e_widget_table_thaw(of);
e_widget_toolbook_page_append(o, NULL, _("Options"), of, 1, 1, 1, 1, 0.5, 0.0);
e_widget_toolbook_page_show(o, 0);

@ -544,7 +544,7 @@ _basic_create_widgets(E_Config_Dialog *cfd EINA_UNUSED,
orec0 = evas_object_rectangle_add(evas);
evas_object_name_set(orec0, "style_shadows");
tab = e_widget_table_add(evas, 0);
tab = e_widget_table_add(e_win_evas_win_get(evas), 0);
otb = e_widget_toolbook_add(evas, 48 * e_scale, 48 * e_scale);
///////////////////////////////////////////

@ -342,7 +342,7 @@ _create_edit_frame(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdat
tb = e_widget_toolbook_add(evas, 48 * e_scale, 48 * e_scale);
tab2 = e_widget_table_add(evas, 0);
tab2 = e_widget_table_add(e_win_evas_win_get(evas), 0);
if (cfdata->edit_il == cfdata->borders_il)
{
if (m->match.title) m->title = strdup(m->match.title);
@ -439,7 +439,7 @@ _create_edit_frame(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdat
m->modal = m->match.modal;
row = 0;
tab2 = e_widget_table_add(evas, 0);
tab2 = e_widget_table_add(e_win_evas_win_get(evas), 0);
lb = e_widget_label_add(evas, _("Unused"));
e_widget_table_object_append(tab2, lb, 1, row, 1, 1, 0, 0, 0, 0);
lb = e_widget_label_add(evas, _("On"));
@ -678,7 +678,7 @@ _create_match_editor(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfd
Match_Config *m;
Eina_List *l;
tab = e_widget_table_add(evas, 0);
tab = e_widget_table_add(e_win_evas_win_get(evas), 0);
il = e_widget_ilist_add(evas, 16, 16, NULL);
e_widget_size_min_set(il, 160, 100);

@ -177,7 +177,7 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
cfdata->evas = evas_object_evas_get(cfd->dia->win);
of = e_widget_table_add(evas, 0);
of = e_widget_table_add(e_win_evas_win_get(evas), 0);
cfdata->o_toolbar = e_widget_toolbar_add(evas, 32 * e_scale, 32 * e_scale);
e_widget_toolbar_scrollable_set(cfdata->o_toolbar, 1);

@ -681,7 +681,7 @@ _advanced_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
cfdata->basic.o_list = NULL;
otb = e_widget_toolbook_add(evas, 48 * e_scale, 48 * e_scale);
////////////////////////////////////////////////////////////
ot = e_widget_table_add(evas, EINA_FALSE);
ot = e_widget_table_add(e_win_evas_win_get(evas), EINA_FALSE);
cfdata->advanced.o_list =
e_widget_ilist_add(evas, (24 * e_scale), (24 * e_scale), &cfdata->sel);
@ -701,7 +701,7 @@ _advanced_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
e_widget_toolbook_page_append(otb, NULL, _("Loaded Gadgets"), ot, 1, 1, 1, 1, 0.5, 0.0);
////////////////////////////////////////////////////////////
// ot = e_widget_list_add(evas, 0, 0);
ot = e_widget_table_add(evas, EINA_FALSE);
ot = e_widget_table_add(e_win_evas_win_get(evas), EINA_FALSE);
cfdata->class_list =
e_widget_ilist_add(evas, (24 * e_scale), (24 * e_scale), NULL);
@ -736,7 +736,7 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
int mw;
cfdata->advanced.o_list = cfdata->class_list = NULL;
ot = e_widget_table_add(evas, 0);
ot = e_widget_table_add(e_win_evas_win_get(evas), 0);
cfdata->basic.o_list = e_widget_ilist_add(evas, 24, 24, NULL);
e_widget_ilist_multi_select_set(cfdata->basic.o_list, EINA_TRUE);

@ -164,7 +164,7 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
1, 0, 1, 0, 0.5, 0.0);
/* position */
ol = e_widget_table_add(evas, 1);
ol = e_widget_table_add(e_win_evas_win_get(evas), 1);
rg = e_widget_radio_group_new(&(cfdata->orient));
ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-left",
24, 24, E_GADCON_ORIENT_LEFT, rg);

@ -1,980 +0,0 @@
#include "e.h"
typedef struct _E_Smart_Data E_Smart_Data;
typedef struct _E_Table_Item E_Table_Item;
struct _E_Smart_Data
{
Evas_Coord x, y, w, h;
Evas_Object *obj;
Evas_Object *clip;
int frozen;
unsigned char changed : 1;
unsigned char homogenous : 1;
Eina_List *items;
struct
{
Evas_Coord w, h;
} min, max;
struct
{
double x, y;
} align;
struct
{
int cols, rows;
} size;
};
struct _E_Table_Item
{
E_Smart_Data *sd;
int col, row, colspan, rowspan;
unsigned char fill_w : 1;
unsigned char fill_h : 1;
unsigned char expand_w : 1;
unsigned char expand_h : 1;
struct
{
Evas_Coord w, h;
} min, max;
struct
{
double x, y;
} align;
Evas_Object *obj;
};
/* local subsystem functions */
static E_Table_Item *_e_table_smart_adopt(E_Smart_Data *sd, Evas_Object *obj);
static void _e_table_smart_disown(Evas_Object *obj);
static void _e_table_smart_item_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_table_smart_reconfigure(E_Smart_Data *sd);
static void _e_table_smart_extents_calcuate(E_Smart_Data *sd);
static void _e_table_smart_init(void);
static void _e_table_smart_add(Evas_Object *obj);
static void _e_table_smart_del(Evas_Object *obj);
static void _e_table_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
static void _e_table_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
static void _e_table_smart_show(Evas_Object *obj);
static void _e_table_smart_hide(Evas_Object *obj);
static void _e_table_smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
static void _e_table_smart_clip_set(Evas_Object *obj, Evas_Object *clip);
static void _e_table_smart_clip_unset(Evas_Object *obj);
/* local subsystem globals */
static Evas_Smart *_e_smart = NULL;
/* externally accessible functions */
EAPI Evas_Object *
e_table_add(Evas *evas)
{
_e_table_smart_init();
return evas_object_smart_add(evas, _e_smart);
}
EAPI int
e_table_freeze(Evas_Object *obj)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR(0);
sd = evas_object_smart_data_get(obj);
sd->frozen++;
return sd->frozen;
}
EAPI int
e_table_thaw(Evas_Object *obj)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR(0);
sd = evas_object_smart_data_get(obj);
sd->frozen--;
if (sd->frozen <= 0) _e_table_smart_reconfigure(sd);
return sd->frozen;
}
EAPI void
e_table_homogenous_set(Evas_Object *obj, int homogenous)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR();
sd = evas_object_smart_data_get(obj);
if (sd->homogenous == homogenous) return;
sd->homogenous = homogenous;
sd->changed = 1;
if (sd->frozen <= 0) _e_table_smart_reconfigure(sd);
}
EAPI void
e_table_pack(Evas_Object *obj, Evas_Object *child, int col, int row, int colspan, int rowspan)
{
E_Smart_Data *sd;
E_Table_Item *ti;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR();
sd = evas_object_smart_data_get(obj);
_e_table_smart_adopt(sd, child);
sd->items = eina_list_append(sd->items, child);
ti = evas_object_data_get(child, "e_table_data");
if (ti)
{
ti->col = col;
ti->row = row;
ti->colspan = colspan;
ti->rowspan = rowspan;
if (sd->size.cols < (col + colspan)) sd->size.cols = col + colspan;
if (sd->size.rows < (row + rowspan)) sd->size.rows = row + rowspan;
}
sd->changed = 1;
if (sd->frozen <= 0) _e_table_smart_reconfigure(sd);
}
EAPI void
e_table_pack_options_set(Evas_Object *obj, int fill_w, int fill_h, int expand_w, int expand_h, double align_x, double align_y, Evas_Coord min_w, Evas_Coord min_h, Evas_Coord max_w, Evas_Coord max_h)
{
E_Table_Item *ti;
ti = evas_object_data_get(obj, "e_table_data");
if (!ti) return;
ti->fill_w = fill_w;
ti->fill_h = fill_h;
ti->expand_w = expand_w;
ti->expand_h = expand_h;
ti->align.x = align_x;
ti->align.y = align_y;
ti->min.w = min_w;
ti->min.h = min_h;
ti->max.w = max_w;
ti->max.h = max_h;
ti->sd->changed = 1;
if (ti->sd->frozen <= 0) _e_table_smart_reconfigure(ti->sd);
}
EAPI void
e_table_unpack(Evas_Object *obj)
{
E_Table_Item *ti;
E_Smart_Data *sd;
ti = evas_object_data_get(obj, "e_table_data");
if (!ti) return;
sd = ti->sd;
sd->items = eina_list_remove(sd->items, obj);
_e_table_smart_disown(obj);
sd->changed = 1;
if (sd->frozen <= 0) _e_table_smart_reconfigure(sd);
}
EAPI void
e_table_col_row_size_get(Evas_Object *obj, int *cols, int *rows)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR();
sd = evas_object_smart_data_get(obj);
if (sd->changed) _e_table_smart_extents_calcuate(sd);
if (cols) *cols = sd->size.cols;
if (rows) *rows = sd->size.rows;
}
EAPI void
e_table_size_min_get(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR();
sd = evas_object_smart_data_get(obj);
if (sd->changed) _e_table_smart_extents_calcuate(sd);
if (minw) *minw = sd->min.w;
if (minh) *minh = sd->min.h;
}
EAPI void
e_table_size_max_get(Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR();
sd = evas_object_smart_data_get(obj);
if (sd->changed) _e_table_smart_extents_calcuate(sd);
if (maxw) *maxw = sd->max.w;
if (maxh) *maxh = sd->max.h;
}
EAPI void
e_table_align_get(Evas_Object *obj, double *ax, double *ay)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR();
sd = evas_object_smart_data_get(obj);
if (ax) *ax = sd->align.x;
if (ay) *ay = sd->align.y;
}
EAPI void
e_table_align_set(Evas_Object *obj, double ax, double ay)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR();
sd = evas_object_smart_data_get(obj);
if ((sd->align.x == ax) && (sd->align.y == ay)) return;
sd->align.x = ax;
sd->align.y = ay;
sd->changed = 1;
if (sd->frozen <= 0) _e_table_smart_reconfigure(sd);
}
/* local subsystem functions */
static E_Table_Item *
_e_table_smart_adopt(E_Smart_Data *sd, Evas_Object *obj)
{
E_Table_Item *ti;
ti = calloc(1, sizeof(E_Table_Item));
if (!ti) return NULL;
ti->sd = sd;
ti->obj = obj;
/* defaults */
ti->col = 0;
ti->row = 0;
ti->colspan = 1;
ti->rowspan = 1;
ti->fill_w = 0;
ti->fill_h = 0;
ti->expand_w = 0;
ti->expand_h = 0;
ti->align.x = 0.5;
ti->align.y = 0.5;
ti->min.w = 0;
ti->min.h = 0;
ti->max.w = 0;
ti->max.h = 0;
evas_object_clip_set(obj, sd->clip);
// evas_object_stack_above(obj, sd->obj);
evas_object_smart_member_add(obj, ti->sd->obj);
evas_object_data_set(obj, "e_table_data", ti);
evas_object_event_callback_add(obj, EVAS_CALLBACK_FREE,
_e_table_smart_item_del_hook, NULL);
// evas_object_stack_below(obj, sd->obj);
if ((!evas_object_visible_get(sd->clip)) &&
(evas_object_visible_get(sd->obj)))
evas_object_show(sd->clip);
return ti;
}
static void
_e_table_smart_disown(Evas_Object *obj)
{
E_Table_Item *ti;
ti = evas_object_data_get(obj, "e_table_data");
if (!ti) return;
if (!ti->sd->items)
{
if (evas_object_visible_get(ti->sd->clip))
evas_object_hide(ti->sd->clip);
}
evas_object_event_callback_del(obj,
EVAS_CALLBACK_FREE,
_e_table_smart_item_del_hook);
evas_object_smart_member_del(obj);
evas_object_data_del(obj, "e_table_data");
free(ti);
}
static void
_e_table_smart_item_del_hook(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
e_table_unpack(obj);
}
static void
_e_table_smart_reconfigure(E_Smart_Data *sd)
{
Evas_Coord x, y, w, h, xx, yy;
Eina_List *l;
Evas_Object *obj;
int minw, minh, expandw, expandh;
if (!sd->changed) return;
w = sd->w;
h = sd->h;
_e_table_smart_extents_calcuate(sd);
minw = sd->min.w;
minh = sd->min.h;
expandw = 0;
expandh = 0;
if (w < minw) w = minw;
if (h < minh) h = minh;
EINA_LIST_FOREACH(sd->items, l, obj)
{
E_Table_Item *ti;
ti = evas_object_data_get(obj, "e_table_data");
if (ti->expand_w) expandw++;
if (ti->expand_h) expandh++;
}
if (expandw == 0)
{
w = minw;
}
if (expandh == 0)
{
h = minh;
}
x = sd->x;
y = sd->y;
if (sd->homogenous)
{
EINA_LIST_FOREACH(sd->items, l, obj)
{
E_Table_Item *ti;
Evas_Coord ww, hh, ow, oh;
ti = evas_object_data_get(obj, "e_table_data");
xx = x + ((ti->col) * (w / (Evas_Coord)sd->size.cols));
yy = y + ((ti->row) * (h / (Evas_Coord)sd->size.rows));
ww = ((w / (Evas_Coord)sd->size.cols) * (ti->colspan));
hh = ((h / (Evas_Coord)sd->size.rows) * (ti->rowspan));
ow = ti->min.w;
if (ti->expand_w) ow = ww;
if ((ti->max.w >= 0) && (ti->max.w < ow)) ow = ti->max.w;
oh = ti->min.h;
if (ti->expand_h) oh = hh;
if ((ti->max.h >= 0) && (ti->max.h < oh)) oh = ti->max.h;
evas_object_move(obj,
xx + (Evas_Coord)(((double)(ww - ow)) * ti->align.x),
yy + (Evas_Coord)(((double)(hh - oh)) * ti->align.y));
evas_object_resize(obj, ow, oh);
}
}
else
{
int i, ex, tot, need, num, dif, left, nx;
EINA_LIST_FOREACH(sd->items, l, obj)
{
E_Table_Item *ti;
ti = evas_object_data_get(obj, "e_table_data");
if (sd->size.cols < (ti->col + ti->colspan))
sd->size.cols = ti->col + ti->colspan;
if (sd->size.rows < (ti->row + ti->rowspan))
sd->size.rows = ti->row + ti->rowspan;
}
if ((sd->size.cols > 0) && (sd->size.rows > 0))
{
int *cols, *rows, *colsx, *rowsx;
cols = calloc(sd->size.cols, sizeof(int));
rows = calloc(sd->size.rows, sizeof(int));
colsx = calloc(sd->size.cols, sizeof(int));
rowsx = calloc(sd->size.rows, sizeof(int));
EINA_LIST_FOREACH(sd->items, l, obj)
{
E_Table_Item *ti;
ti = evas_object_data_get(obj, "e_table_data");
for (i = ti->col; i < (ti->col + ti->colspan); i++)
colsx[i] |= ti->expand_w;
for (i = ti->row; i < (ti->row + ti->rowspan); i++)
rowsx[i] |= ti->expand_h;
}
EINA_LIST_FOREACH(sd->items, l, obj)
{
E_Table_Item *ti;
ti = evas_object_data_get(obj, "e_table_data");
/* handle horizontal */
ex = 0;
tot = 0;
num = ti->colspan;
for (i = ti->col; i < (ti->col + num); i++)
{
if (colsx[i]) ex++;
tot += cols[i];
}
need = ti->min.w;
if (tot < need)
{
dif = need - tot;
left = dif;
if (ex == 0)
{
nx = num;
for (i = ti->col; i < (ti->col + num); i++)
{
if (nx > 1)
{
cols[i] += dif / num;
left -= dif / num;
}
else
{
cols[i] += left;
left = 0;
}
nx--;
}
}
else
{
nx = ex;
for (i = ti->col; i < (ti->col + num); i++)
{
if (colsx[i])
{
if (nx > 1)
{
cols[i] += dif / ex;
left -= dif / ex;
}
else
{
cols[i] += left;
left = 0;
}
nx--;
}
}
}
}
/* handle vertical */
ex = 0;
tot = 0;
num = ti->rowspan;
for (i = ti->row; i < (ti->row + num); i++)
{
if (rowsx[i]) ex++;
tot += rows[i];
}
need = ti->min.h;
if (tot < need)
{
dif = need - tot;
left = dif;
if (ex == 0)
{
nx = num;
for (i = ti->row; i < (ti->row + num); i++)
{
if (nx > 1)
{
rows[i] += dif / num;
left -= dif / num;
}
else
{
rows[i] += left;
left = 0;
}
nx--;
}
}
else
{
nx = ex;
for (i = ti->row; i < (ti->row + num); i++)
{
if (rowsx[i])
{
if (nx > 1)
{
rows[i] += dif / ex;
left -= dif / ex;
}
else
{
rows[i] += left;
left = 0;
}
nx--;
}
}
}
}
}
ex = 0;
for (i = 0; i < sd->size.cols; i++) {
if (colsx[i])
ex++;
}
tot = 0;
for (i = 0; i < sd->size.cols; i++)
tot += cols[i];
dif = w - tot;
if ((ex > 0) && (dif > 0))
{
int exl;
left = dif;
exl = ex;
for (i = 0; i < sd->size.cols; i++)
{
if (colsx[i])
{
if (exl == 1)
{
cols[i] += left;
exl--;
left = 0;
}
else
{
cols[i] += dif / ex;
exl--;
left -= dif / ex;
}
}
}
}
ex = 0;
for (i = 0; i < sd->size.rows; i++) {
if (rowsx[i])
ex++;
}
tot = 0;
for (i = 0; i < sd->size.rows; i++)
tot += rows[i];
dif = h - tot;
if ((ex > 0) && (dif > 0))
{
int exl;
left = dif;
exl = ex;
for (i = 0; i < sd->size.rows; i++)
{
if (rowsx[i])
{
if (exl == 1)
{
rows[i] += left;
exl--;
left = 0;
}
else
{
rows[i] += dif / ex;
exl--;
left -= dif / ex;
}
}
}
}
EINA_LIST_FOREACH(sd->items, l, obj)
{
E_Table_Item *ti;
Evas_Coord ww, hh, ow, oh, idx;
ti = evas_object_data_get(obj, "e_table_data");
xx = x;
for (idx = 0; idx < ti->col; idx++)
xx += cols[idx];
ww = 0;
for (idx = ti->col; idx < (ti->col + ti->colspan); idx++)
ww += cols[idx];
yy = y;
for (idx = 0; idx < ti->row; idx++)
yy += rows[idx];
hh = 0;
for (idx = ti->row; idx < (ti->row + ti->rowspan); idx++)
hh += rows[idx];
ow = ti->min.w;
if (ti->fill_w) ow = ww;
if ((ti->max.w >= 0) && (ti->max.w < ow)) ow = ti->max.w;
oh = ti->min.h;
if (ti->fill_h) oh = hh;
if ((ti->max.h >= 0) && (ti->max.h < oh)) oh = ti->max.h;
evas_object_move(obj,
xx + (Evas_Coord)(((double)(ww - ow)) * ti->align.x),
yy + (Evas_Coord)(((double)(hh - oh)) * ti->align.y));
evas_object_resize(obj, ow, oh);
}
free(rows);
free(cols);
free(rowsx);
free(colsx);
}
}
sd->changed = 0;
}
static void
_e_table_smart_extents_calcuate(E_Smart_Data *sd)
{
Eina_List *l;
Evas_Object *obj;
int minw, minh;
sd->max.w = -1; /* max < 0 == unlimited */
sd->max.h = -1;
sd->size.cols = 0;
sd->size.rows = 0;
minw = 0;
minh = 0;
if (sd->homogenous)
{
EINA_LIST_FOREACH(sd->items, l, obj)
{
E_Table_Item *ti;
int mw, mh;
ti = evas_object_data_get(obj, "e_table_data");
if (sd->size.cols < (ti->col + ti->colspan))
sd->size.cols = ti->col + ti->colspan;
if (sd->size.rows < (ti->row + ti->rowspan))
sd->size.rows = ti->row + ti->rowspan;
mw = (ti->min.w + (ti->colspan - 1)) / ti->colspan;
mh = (ti->min.h + (ti->rowspan - 1)) / ti->rowspan;
if (minw < mw) minw = mw;
if (minh < mh) minh = mh;
}
minw *= sd->size.cols;
minh *= sd->size.rows;
}
else
{
int i, ex, tot, need, num, dif, left, nx;
EINA_LIST_FOREACH(sd->items, l, obj)
{
E_Table_Item *ti;
ti = evas_object_data_get(obj, "e_table_data");
if (sd->size.cols < (ti->col + ti->colspan))
sd->size.cols = ti->col + ti->colspan;
if (sd->size.rows < (ti->row + ti->rowspan))
sd->size.rows = ti->row + ti->rowspan;
}
if ((sd->size.cols > 0) && (sd->size.rows > 0))
{
int *cols, *rows, *colsx, *rowsx;
cols = calloc(sd->size.cols, sizeof(int));
rows = calloc(sd->size.rows, sizeof(int));
colsx = calloc(sd->size.cols, sizeof(int));
rowsx = calloc(sd->size.rows, sizeof(int));
EINA_LIST_FOREACH(sd->items, l, obj)
{
E_Table_Item *ti;
ti = evas_object_data_get(obj, "e_table_data");
for (i = ti->col; i < (ti->col + ti->colspan); i++)
colsx[i] |= ti->expand_w;
for (i = ti->row; i < (ti->row + ti->rowspan); i++)
rowsx[i] |= ti->expand_h;
}
EINA_LIST_FOREACH(sd->items, l, obj)
{
E_Table_Item *ti;
ti = evas_object_data_get(obj, "e_table_data");
/* handle horizontal */
ex = 0;
tot = 0;
num = ti->colspan;
for (i = ti->col; i < (ti->col + num); i++)
{
if (colsx[i]) ex++;
tot += cols[i];
}
need = ti->min.w;
if (tot < need)
{
dif = need - tot;
left = dif;
if (ex == 0)
{
nx = num;
for (i = ti->col; i < (ti->col + num); i++)
{
if (nx > 1)
{
cols[i] += dif / num;
left -= dif / num;
}
else
{
cols[i] += left;
left = 0;
}
nx--;
}
}
else
{
nx = ex;
for (i = ti->col; i < (ti->col + num); i++)
{
if (colsx[i])
{
if (nx > 1)
{
cols[i] += dif / ex;
left -= dif / ex;
}
else
{
cols[i] += left;
left = 0;
}
nx--;
}
}
}
}
/* handle vertical */
ex = 0;
tot = 0;
num = ti->rowspan;
for (i = ti->row; i < (ti->row + num); i++)
{
if (rowsx[i]) ex++;
tot += rows[i];
}
need = ti->min.h;
if (tot < need)
{
dif = need - tot;
left = dif;
if (ex == 0)
{
nx = num;
for (i = ti->row; i < (ti->row + num); i++)
{
if (nx > 1)
{
rows[i] += dif / num;
left -= dif / num;
}
else
{
rows[i] += left;
left = 0;
}
nx--;
}
}
else
{
nx = ex;
for (i = ti->row; i < (ti->row + num); i++)
{
if (rowsx[i])
{
if (nx > 1)
{
rows[i] += dif / ex;
left -= dif / ex;
}
else
{
rows[i] += left;
left = 0;
}
nx--;
}
}
}
}
}
for (i = 0; i < sd->size.cols; i++)
minw += cols[i];
for (i = 0; i < sd->size.rows; i++)
minh += rows[i];
free(rows);
free(cols);
free(rowsx);
free(colsx);
}
}
sd->min.w = minw;
sd->min.h = minh;
}
static void
_e_table_smart_init(void)
{
if (_e_smart) return;
{
static const Evas_Smart_Class sc =
{
"e_table",
EVAS_SMART_CLASS_VERSION,
_e_table_smart_add,
_e_table_smart_del,
_e_table_smart_move,
_e_table_smart_resize,
_e_table_smart_show,
_e_table_smart_hide,
_e_table_smart_color_set,
_e_table_smart_clip_set,
_e_table_smart_clip_unset,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
};
_e_smart = evas_smart_class_new(&sc);
}
}
static void
_e_table_smart_add(Evas_Object *obj)
{
E_Smart_Data *sd;
sd = calloc(1, sizeof(E_Smart_Data));
if (!sd) return;
sd->obj = obj;
sd->x = 0;
sd->y = 0;
sd->w = 0;
sd->h = 0;
sd->clip = evas_object_rectangle_add(evas_object_evas_get(obj));
evas_object_smart_member_add(sd->clip, obj);
evas_object_move(sd->clip, -100002, -100002);
evas_object_resize(sd->clip, 200004, 200004);
evas_object_color_set(sd->clip, 255, 255, 255, 255);
evas_object_smart_data_set(obj, sd);
}
static void
_e_table_smart_del(Evas_Object *obj)
{
E_Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
e_table_freeze(obj);
while (sd->items)
{
Evas_Obje