This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository efm2.
View the commit online.
commit e2ff35af7f08fc7b1f67adf9be3ef717f301290d
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
AuthorDate: Mon Jul 8 10:05:51 2024 +0100
add vertical icon and vertical custom icon layout
---
TODO.md | 5 +----
src/efm/bitmap.c | 31 ++++++++++++++++++++++++++++++
src/efm/bitmap.h | 8 ++++++--
src/efm/efm.c | 51 +++++++++++++++++++++++++++++++++++++++-----------
src/efm/efm.h | 2 ++
src/efm/efm_back_end.c | 12 ++++++++++--
src/efm/efm_custom.c | 17 ++++++++++++-----
src/efm/efm_dnd.c | 3 ++-
src/efm/efm_util.c | 6 ++++--
src/efm/main.c | 30 +++++++++++++++++++++++++++++
10 files changed, 138 insertions(+), 27 deletions(-)
diff --git a/TODO.md b/TODO.md
index b790e72..8e84c2f 100644
--- a/TODO.md
+++ b/TODO.md
@@ -4,9 +4,7 @@
## Now
-* Handle open command crashing (stiore null exe and don't send cmds when null)
* View
- * Vertical icon view
* Free x/y cleanup/grid align
* Icon with no labels
* Icons with flush view (like rage video browser view)
@@ -18,8 +16,7 @@
* mv
* cp
* rm
- * "Job" tracking + management (cancel pending ones)
-* Trashcan impl
+ * trash (mv to trash dir)
* Progress feedback from file ops
* Display dir usage (# files, size)
* Display dir + subdir usage
diff --git a/src/efm/bitmap.c b/src/efm/bitmap.c
index 28a9925..cd09dbb 100644
--- a/src/efm/bitmap.c
+++ b/src/efm/bitmap.c
@@ -216,6 +216,37 @@ done:
*h = inh;
}
+void
+_bitmap_find_tl_to_br_v(unsigned int *bitmap, int maxh, int szw, int szh, int inw,
+ int inh, int *x, int *y, int *w, int *h)
+{
+ int xx, yy, ww, hh;
+
+ // XXX: work on this!!!
+ if (maxh < inh) maxh = inh;
+ for (xx = 0; xx < szw; xx++)
+ {
+ ww = inw;
+ if ((xx + inw) > szw) ww = szw - xx;
+ hh = maxh - inh;
+ if (hh <= 0) hh = 1;
+ for (yy = 0; yy < hh; yy++)
+ {
+ if (_bitmap_is_clear(bitmap, szw, szh, xx, yy, ww, inh))
+ {
+ *x = xx;
+ *y = yy;
+ goto done;
+ }
+ }
+ }
+ *y = 0;
+ *x = szw;
+done:
+ *w = inw;
+ *h = inh;
+}
+
/*
static void
_bitmap_row_dump(unsigned int *row, int w)
diff --git a/src/efm/bitmap.h b/src/efm/bitmap.h
index c2aba39..4d6adfd 100644
--- a/src/efm/bitmap.h
+++ b/src/efm/bitmap.h
@@ -1,13 +1,17 @@
#ifndef BITMAP_H
#define BITMAP_H 1
+#include <Eina.h>
+
void _bitmap_free(unsigned int *bitmap);
void _bitmap_clear(unsigned int *bitmap, int szw, int szh);
unsigned int *_bitmap_resize(unsigned int *bitmap, int szw, int szh, int nszw,
int nszh);
-void _bitmap_fill(unsigned int *bitmap, int szw, int szh EINA_UNUSED, int x,
- int y, int w, int h);
+void _bitmap_fill(unsigned int *bitmap, int szw, int szh EINA_UNUSED, int x,
+ int y, int w, int h);
void _bitmap_find_tl_to_br(unsigned int *bitmap, int maxw, int szw, int szh,
int inw, int inh, int *x, int *y, int *w, int *h);
+void _bitmap_find_tl_to_br_v(unsigned int *bitmap, int maxh, int szw, int szh,
+ int inw, int inh, int *x, int *y, int *w, int *h);
#endif
diff --git a/src/efm/efm.c b/src/efm/efm.c
index a39f59d..3a0c173 100644
--- a/src/efm/efm.c
+++ b/src/efm/efm.c
@@ -1065,22 +1065,31 @@ static void
_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
{ // efm veiw object resized
Eina_Bool width_change = EINA_FALSE;
+ Eina_Bool height_change = EINA_FALSE;
ENTRY;
if ((sd->geom.w == w) && (sd->geom.h == h)) return;
if (w != sd->geom.w) width_change = EINA_TRUE;
+ if (h != sd->geom.h) height_change = EINA_TRUE;
sd->geom.w = w;
sd->geom.h = h;
evas_object_smart_changed(obj);
evas_object_resize(sd->o_clip, w, h);
// if width changed we have to re-flow (relayout) icons - unless it's custom
// layout where we have fixed geom per icon
- if ((width_change) && (sd->config.view_mode != EFM_VIEW_MODE_ICONS_CUSTOM))
+ if ((width_change)
+ && ((sd->config.view_mode == EFM_VIEW_MODE_ICONS)
+ || (sd->config.view_mode == EFM_VIEW_MODE_LIST)
+ || (sd->config.view_mode == EFM_VIEW_MODE_LIST_DETAILED)))
+ sd->relayout = EINA_TRUE;
+ if ((height_change)
+ && ((sd->config.view_mode == EFM_VIEW_MODE_ICONS_VERTICAL)
+ || (sd->config.view_mode == EFM_VIEW_MODE_ICONS_CUSTOM_VERTICAL)))
sd->relayout = EINA_TRUE;
if (width_change)
{
evas_object_resize(sd->o_list_detailed_dummy, w, sd->list_detailed_min_h);
- printf("RSZ: %p %i\n", sd->o_list_detailed_dummy, w);
+ printf("RSZW: %p %i\n", sd->o_list_detailed_dummy, w);
}
}
@@ -1122,11 +1131,23 @@ _relayout_icons(Smart_Data *sd)
icon->geom.y = y;
icon->geom.w = sd->icon_min_w;
icon->geom.h = sd->icon_min_h;
- x += icon->geom.w;
- if ((x + icon->geom.w) > sd->geom.w)
- { // if next icon over end of row, start a new row
- x = 0;
+ if (sd->config.view_mode == EFM_VIEW_MODE_ICONS)
+ {
+ x += icon->geom.w;
+ if ((x + icon->geom.w) > sd->geom.w)
+ { // if next icon over end of row, start a new row
+ x = 0;
+ y += icon->geom.h;
+ }
+ }
+ else if (sd->config.view_mode == EFM_VIEW_MODE_ICONS_VERTICAL)
+ {
y += icon->geom.h;
+ if ((y + icon->geom.h) > sd->geom.h)
+ { // if next icon over end of row, start a new row
+ y = 0;
+ x += icon->geom.w;
+ }
}
if (block->icons == il) // first icon in block
block->bounds = icon->geom;
@@ -1140,7 +1161,10 @@ _relayout_icons(Smart_Data *sd)
minh = block->bounds.y + block->bounds.h;
}
// set min size for scroller to know content size
- evas_object_size_hint_min_set(sd->o_smart, sd->icon_min_w, minh);
+ if (sd->config.view_mode == EFM_VIEW_MODE_ICONS)
+ evas_object_size_hint_min_set(sd->o_smart, sd->icon_min_w, minh);
+ else if (sd->config.view_mode == EFM_VIEW_MODE_ICONS_VERTICAL)
+ evas_object_size_hint_min_set(sd->o_smart, minw, sd->icon_min_h);
}
static void
@@ -1233,7 +1257,8 @@ _listing_do(Smart_Data *sd)
{
printf("XXX: LISTING DO -----------------------------------------\n");
sd->listing_done = EINA_FALSE;
- if (sd->config.view_mode == EFM_VIEW_MODE_ICONS_CUSTOM)
+ if ((sd->config.view_mode == EFM_VIEW_MODE_ICONS_CUSTOM)
+ || (sd->config.view_mode == EFM_VIEW_MODE_ICONS_CUSTOM_VERTICAL))
{
_icon_custom_data_bitmap_clear(sd);
}
@@ -1244,7 +1269,8 @@ _listing_done(Smart_Data *sd)
{
printf("XXX: LISTING DONE -----------------------------------------\n");
sd->listing_done = EINA_TRUE;
- if (sd->config.view_mode == EFM_VIEW_MODE_ICONS_CUSTOM)
+ if ((sd->config.view_mode == EFM_VIEW_MODE_ICONS_CUSTOM)
+ || (sd->config.view_mode == EFM_VIEW_MODE_ICONS_CUSTOM_VERTICAL))
{
if (sd->reblock_job) sd->listing_done_reblock = EINA_TRUE;
else
@@ -1350,8 +1376,11 @@ _relayout(Smart_Data *sd)
// XXX: fixed position per icon layout (just calc block bounds)
// XXX: column layout (top-left down then next col along)
// XXX: list layout
- if (sd->config.view_mode == EFM_VIEW_MODE_ICONS) _relayout_icons(sd);
- else if (sd->config.view_mode == EFM_VIEW_MODE_ICONS_CUSTOM)
+ if ((sd->config.view_mode == EFM_VIEW_MODE_ICONS) ||
+ (sd->config.view_mode == EFM_VIEW_MODE_ICONS_VERTICAL))
+ _relayout_icons(sd);
+ else if ((sd->config.view_mode == EFM_VIEW_MODE_ICONS_CUSTOM) ||
+ (sd->config.view_mode == EFM_VIEW_MODE_ICONS_CUSTOM_VERTICAL))
_relayout_icons_custom(sd);
else if (sd->config.view_mode == EFM_VIEW_MODE_LIST) _relayout_list(sd);
else if (sd->config.view_mode == EFM_VIEW_MODE_LIST_DETAILED)
diff --git a/src/efm/efm.h b/src/efm/efm.h
index 53b238a..2d34906 100644
--- a/src/efm/efm.h
+++ b/src/efm/efm.h
@@ -8,7 +8,9 @@
typedef enum
{
EFM_VIEW_MODE_ICONS,
+ EFM_VIEW_MODE_ICONS_VERTICAL,
EFM_VIEW_MODE_ICONS_CUSTOM,
+ EFM_VIEW_MODE_ICONS_CUSTOM_VERTICAL,
EFM_VIEW_MODE_LIST,
EFM_VIEW_MODE_LIST_DETAILED
} Efm_View_Mode;
diff --git a/src/efm/efm_back_end.c b/src/efm/efm_back_end.c
index 6956b32..99f6437 100644
--- a/src/efm/efm_back_end.c
+++ b/src/efm/efm_back_end.c
@@ -188,6 +188,8 @@ _cb_exe_del(void *data, int ev_type EINA_UNUSED, void *event)
if (ev->exe == sd->exe_open)
{ // this process exiting is the back-end open process for active view
printf("ERROR: back-end open process died unexpectedly\n");
+ sd->exe_open = NULL;
+ _reset(sd); // XXX: handle repeated open crashing - in future
return ECORE_CALLBACK_DONE;
}
return ECORE_CALLBACK_PASS_ON;
@@ -508,10 +510,16 @@ _cb_thread_notify(void *data, Ecore_Thread *th EINA_UNUSED, void *msg)
{
Efm_View_Mode view_mode = sd->config.view_mode;
- if (!strcmp(mode, "icons")) view_mode = EFM_VIEW_MODE_ICONS;
+ if (!strcmp(mode, "icons"))
+ view_mode = EFM_VIEW_MODE_ICONS;
+ else if (!strcmp(mode, "icons_vertical"))
+ view_mode = EFM_VIEW_MODE_ICONS_VERTICAL;
else if (!strcmp(mode, "icons_custom"))
view_mode = EFM_VIEW_MODE_ICONS_CUSTOM;
- else if (!strcmp(mode, "list")) view_mode = EFM_VIEW_MODE_LIST;
+ else if (!strcmp(mode, "icons_custom_vertical"))
+ view_mode = EFM_VIEW_MODE_ICONS_CUSTOM_VERTICAL;
+ else if (!strcmp(mode, "list"))
+ view_mode = EFM_VIEW_MODE_LIST;
else if (!strcmp(mode, "list_detailed"))
view_mode = EFM_VIEW_MODE_LIST_DETAILED;
if (view_mode != sd->config.view_mode)
diff --git a/src/efm/efm_custom.c b/src/efm/efm_custom.c
index b477273..082f056 100644
--- a/src/efm/efm_custom.c
+++ b/src/efm/efm_custom.c
@@ -80,7 +80,7 @@ _icon_custom_data_region_clip(Custom_Data *cd, int *x, int *y, int *w, int *h)
static void
_icon_custom_data_resize(Smart_Data *sd, int w, int h)
-{ // resize bitmap and retaun set bits in bitmap, with new empty bits being 0
+{ // resize bitmap and return set bits in bitmap, with new empty bits being 0
Custom_Data *cd = sd->custom_data;
int tw, th, alloc_w, alloc_h;
@@ -177,7 +177,7 @@ _icon_custom_data_all_icons_fill(Smart_Data *sd)
}
static void
-_icon_custom_data_tl_to_br_find(Smart_Data *sd, int *x, int *y, int *w, int *h)
+_icon_custom_data_tl_to_br_find(Smart_Data *sd, int *x, int *y, int *w, int *h, Eina_Bool vert)
{
Custom_Data *cd;
@@ -189,9 +189,12 @@ _icon_custom_data_tl_to_br_find(Smart_Data *sd, int *x, int *y, int *w, int *h)
*y = 0;
*w = (*w + cd->tw - 1) / cd->tw;
*h = (*h + cd->th - 1) / cd->th;
- if (cd->bitmap)
+ if (!vert)
_bitmap_find_tl_to_br(cd->bitmap, sd->geom.w / cd->tw, cd->alloc_w,
cd->alloc_h, *w, *h, x, y, w, h);
+ else
+ _bitmap_find_tl_to_br_v(cd->bitmap, sd->geom.h / cd->th, cd->alloc_w,
+ cd->alloc_h, *w, *h, x, y, w, h);
*x *= cd->tw;
*y *= cd->th;
*w *= cd->tw;
@@ -209,8 +212,12 @@ _icon_custom_position_find(Icon *icon)
geom.y = 0;
_icon_custom_data_resize(icon->block->sd, icon->block->sd->geom.w,
icon->block->sd->geom.h);
- _icon_custom_data_tl_to_br_find(icon->block->sd, &geom.x, &geom.y, &geom.w,
- &geom.h);
+ if (icon->sd->config.view_mode == EFM_VIEW_MODE_ICONS_CUSTOM)
+ _icon_custom_data_tl_to_br_find(icon->block->sd, &geom.x, &geom.y, &geom.w,
+ &geom.h, EINA_FALSE);
+ else if (icon->sd->config.view_mode == EFM_VIEW_MODE_ICONS_CUSTOM_VERTICAL)
+ _icon_custom_data_tl_to_br_find(icon->block->sd, &geom.x, &geom.y, &geom.w,
+ &geom.h, EINA_TRUE);
_icon_custom_data_bitmap_fill(icon->block->sd, geom.x, geom.y, geom.w,
geom.h);
icon->geom = geom;
diff --git a/src/efm/efm_dnd.c b/src/efm/efm_dnd.c
index f67a6e9..a563f5d 100644
--- a/src/efm/efm_dnd.c
+++ b/src/efm/efm_dnd.c
@@ -212,7 +212,8 @@ _cb_drop(void *data, Evas_Object *o EINA_UNUSED, Elm_Selection_Data *ev)
esc = _escape_parse(*p);
if (!esc) continue;
printf("XXX: DROP FILE: [%s]\n", esc);
- if (sd->config.view_mode == EFM_VIEW_MODE_ICONS_CUSTOM)
+ if ((sd->config.view_mode == EFM_VIEW_MODE_ICONS_CUSTOM) ||
+ (sd->config.view_mode == EFM_VIEW_MODE_ICONS_CUSTOM_VERTICAL))
{
Eina_Bool found = EINA_FALSE;
char str[128];
diff --git a/src/efm/efm_util.c b/src/efm/efm_util.c
index 71b60ef..a5d6a9e 100644
--- a/src/efm/efm_util.c
+++ b/src/efm/efm_util.c
@@ -1939,9 +1939,11 @@ _icon_object_add(Icon *icon, Smart_Data *sd, Evas *e,
// about to realize if it hasn't been
// XXX: have a cache for base and icon objects to avoid re-creating them
icon->o_base = o = edje_object_add(e);
- if (sd->config.view_mode == EFM_VIEW_MODE_ICONS)
+ if ((sd->config.view_mode == EFM_VIEW_MODE_ICONS) ||
+ (sd->config.view_mode == EFM_VIEW_MODE_ICONS_VERTICAL))
edje_object_file_set(o, theme_edj_file, "e/fileman/default/icon/fixed");
- else if (sd->config.view_mode == EFM_VIEW_MODE_ICONS_CUSTOM)
+ else if ((sd->config.view_mode == EFM_VIEW_MODE_ICONS_CUSTOM) ||
+ (sd->config.view_mode == EFM_VIEW_MODE_ICONS_CUSTOM_VERTICAL))
edje_object_file_set(o, theme_edj_file, "e/fileman/desktop/icon/fixed");
else if (sd->config.view_mode == EFM_VIEW_MODE_LIST)
{ // odd/even coloring with different group
diff --git a/src/efm/main.c b/src/efm/main.c
index d4b1965..3a6bc4b 100644
--- a/src/efm/main.c
+++ b/src/efm/main.c
@@ -20,6 +20,13 @@ _cb_icons(void *data, Evas_Object *obj EINA_UNUSED,
efm_path_view_mode_set(data, EFM_VIEW_MODE_ICONS);
}
+static void
+_cb_icons_v(void *data, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ efm_path_view_mode_set(data, EFM_VIEW_MODE_ICONS_VERTICAL);
+}
+
static void
_cb_icons_custom(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
@@ -27,6 +34,13 @@ _cb_icons_custom(void *data, Evas_Object *obj EINA_UNUSED,
efm_path_view_mode_set(data, EFM_VIEW_MODE_ICONS_CUSTOM);
}
+static void
+_cb_icons_custom_v(void *data, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ efm_path_view_mode_set(data, EFM_VIEW_MODE_ICONS_CUSTOM_VERTICAL);
+}
+
static void
_cb_list(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
@@ -174,6 +188,14 @@ elm_main(int argc, char **argv)
elm_box_pack_end(bx2, o);
evas_object_show(o);
+ o = elm_button_add(win);
+ evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, 0);
+ evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
+ elm_object_text_set(o, "Icons V");
+ evas_object_smart_callback_add(o, "clicked", _cb_icons_v, efm);
+ elm_box_pack_end(bx2, o);
+ evas_object_show(o);
+
o = elm_button_add(win);
evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, 0);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
@@ -198,6 +220,14 @@ elm_main(int argc, char **argv)
elm_box_pack_end(bx2, o);
evas_object_show(o);
+ o = elm_button_add(win);
+ evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, 0);
+ evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
+ elm_object_text_set(o, "Custom V");
+ evas_object_smart_callback_add(o, "clicked", _cb_icons_custom_v, efm);
+ elm_box_pack_end(bx2, o);
+ evas_object_show(o);
+
evas_object_resize(win, ELM_SCALE_SIZE(700), ELM_SCALE_SIZE(300));
evas_object_show(win);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.