inline thumb mode uses ethumb now... :)
SVN revision: 83566
This commit is contained in:
parent
800383bb0b
commit
156b168979
|
@ -32,7 +32,8 @@ requirements="\
|
||||||
ecore-imf >= 1.7.0 \
|
ecore-imf >= 1.7.0 \
|
||||||
ecore-imf-evas >= 1.7.0 \
|
ecore-imf-evas >= 1.7.0 \
|
||||||
ecore-ipc >= 1.7.0 \
|
ecore-ipc >= 1.7.0 \
|
||||||
efreet >= 1.7.0
|
efreet >= 1.7.0 \
|
||||||
|
ethumb_client >= 1.7.0 \
|
||||||
"
|
"
|
||||||
|
|
||||||
PKG_CHECK_MODULES([TERMINOLOGY], [${requirements}])
|
PKG_CHECK_MODULES([TERMINOLOGY], [${requirements}])
|
||||||
|
|
180
src/bin/media.c
180
src/bin/media.c
|
@ -1,6 +1,7 @@
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
|
#include <Ethumb_Client.h>
|
||||||
#include <Emotion.h>
|
#include <Emotion.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -19,6 +20,7 @@ struct _Media
|
||||||
Ecore_Job *restart_job;
|
Ecore_Job *restart_job;
|
||||||
Ecore_Con_Url *url;
|
Ecore_Con_Url *url;
|
||||||
Ecore_Event_Handler *url_prog_hand, *url_compl_hand;
|
Ecore_Event_Handler *url_prog_hand, *url_compl_hand;
|
||||||
|
Ethumb_Client_Async *et_req;
|
||||||
const char *src;
|
const char *src;
|
||||||
const char *ext;
|
const char *ext;
|
||||||
const char *realf;
|
const char *realf;
|
||||||
|
@ -55,6 +57,140 @@ _is_fmt(const char *f, const char **extn)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////// thumb
|
||||||
|
|
||||||
|
static Ethumb_Client *et_client = NULL;
|
||||||
|
static Eina_Bool et_connected = EINA_FALSE;
|
||||||
|
|
||||||
|
static void _et_init(void);
|
||||||
|
|
||||||
|
static void
|
||||||
|
_et_disconnect(void *data __UNUSED__, Ethumb_Client *c)
|
||||||
|
{
|
||||||
|
if (c != et_client) return;
|
||||||
|
ethumb_client_disconnect(et_client);
|
||||||
|
et_connected = EINA_FALSE;
|
||||||
|
et_client = NULL;
|
||||||
|
_et_init();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_et_connect(void *data __UNUSED__, Ethumb_Client *c, Eina_Bool ok)
|
||||||
|
{
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
et_connected = EINA_TRUE;
|
||||||
|
ethumb_client_on_server_die_callback_set(c, _et_disconnect,
|
||||||
|
NULL, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
et_client = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_et_init(void)
|
||||||
|
{
|
||||||
|
if (et_client) return;
|
||||||
|
|
||||||
|
ethumb_client_init();
|
||||||
|
et_client = ethumb_client_connect(_et_connect, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_type_thumb_calc(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
|
||||||
|
{
|
||||||
|
Media *sd = evas_object_smart_data_get(obj);
|
||||||
|
if (!sd) return;
|
||||||
|
|
||||||
|
if ((w <= 0) || (h <= 0) || (sd->iw <= 0) || (sd->ih <= 0))
|
||||||
|
{
|
||||||
|
w = 1;
|
||||||
|
h = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int iw = 1, ih = 1;
|
||||||
|
|
||||||
|
iw = w;
|
||||||
|
ih = (sd->ih * w) / sd->iw;
|
||||||
|
if (ih > h)
|
||||||
|
{
|
||||||
|
ih = h;
|
||||||
|
iw = (sd->iw * h) / sd->ih;
|
||||||
|
if (iw > w) iw = w;
|
||||||
|
}
|
||||||
|
if ((iw > sd->iw) || (ih > sd->ih))
|
||||||
|
{
|
||||||
|
iw = sd->iw;
|
||||||
|
ih = sd->ih;
|
||||||
|
}
|
||||||
|
x += ((w - iw) / 2);
|
||||||
|
y += ((h - ih) / 2);
|
||||||
|
w = iw;
|
||||||
|
h = ih;
|
||||||
|
}
|
||||||
|
evas_object_move(sd->o_img, x, y);
|
||||||
|
evas_object_resize(sd->o_img, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_thumb_preloaded(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
||||||
|
{
|
||||||
|
Media *sd = evas_object_smart_data_get(data);
|
||||||
|
Evas_Coord ox, oy, ow, oh;
|
||||||
|
if (!sd) return;
|
||||||
|
|
||||||
|
evas_object_geometry_get(data, &ox, &oy, &ow, &oh);
|
||||||
|
_type_thumb_calc(data, ox, oy, ow, oh);
|
||||||
|
evas_object_show(sd->o_img);
|
||||||
|
evas_object_show(sd->clip);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_et_done(Ethumb_Client *c, const char *file, const char *key, void *data)
|
||||||
|
{
|
||||||
|
Evas_Object *obj = data;
|
||||||
|
Media *sd = evas_object_smart_data_get(obj);
|
||||||
|
if (!sd) return;
|
||||||
|
|
||||||
|
if (c != et_client) return;
|
||||||
|
sd->et_req = NULL;
|
||||||
|
evas_object_event_callback_add(sd->o_img, EVAS_CALLBACK_IMAGE_PRELOADED,
|
||||||
|
_cb_thumb_preloaded, obj);
|
||||||
|
evas_object_image_file_set(sd->o_img, file, key);
|
||||||
|
evas_object_image_size_get(sd->o_img, &(sd->iw), &(sd->ih));
|
||||||
|
evas_object_image_preload(sd->o_img, EINA_FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_et_error(Ethumb_Client *c, void *data)
|
||||||
|
{
|
||||||
|
Evas_Object *obj = data;
|
||||||
|
Media *sd = evas_object_smart_data_get(obj);
|
||||||
|
if (!sd) return;
|
||||||
|
|
||||||
|
if (c != et_client) return;
|
||||||
|
sd->et_req = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_type_thumb_init(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Evas_Object *o;
|
||||||
|
Media *sd = evas_object_smart_data_get(obj);
|
||||||
|
if (!sd) return;
|
||||||
|
sd->type = TYPE_THUMB;
|
||||||
|
_et_init();
|
||||||
|
o = sd->o_img = evas_object_image_filled_add(evas_object_evas_get(obj));
|
||||||
|
evas_object_smart_member_add(o, obj);
|
||||||
|
evas_object_clip_set(o, sd->clip);
|
||||||
|
sd->iw = 64;
|
||||||
|
sd->ih = 64;
|
||||||
|
ethumb_client_file_set(et_client, sd->realf, NULL);
|
||||||
|
sd->et_req = ethumb_client_thumb_async_get(et_client, _et_done,
|
||||||
|
_et_error, obj);
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////// img
|
//////////////////////// img
|
||||||
static void
|
static void
|
||||||
_cb_img_preloaded(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
_cb_img_preloaded(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
||||||
|
@ -639,6 +775,9 @@ _smart_del(Evas_Object *obj)
|
||||||
if (sd->anim) ecore_timer_del(sd->anim);
|
if (sd->anim) ecore_timer_del(sd->anim);
|
||||||
if (sd->smooth_timer) sd->smooth_timer = ecore_timer_del(sd->smooth_timer);
|
if (sd->smooth_timer) sd->smooth_timer = ecore_timer_del(sd->smooth_timer);
|
||||||
if (sd->restart_job) ecore_job_del(sd->restart_job);
|
if (sd->restart_job) ecore_job_del(sd->restart_job);
|
||||||
|
if ((et_client) && (sd->et_req))
|
||||||
|
ethumb_client_thumb_async_cancel(et_client, sd->et_req);
|
||||||
|
sd->et_req = NULL;
|
||||||
|
|
||||||
_parent_sc.del(obj);
|
_parent_sc.del(obj);
|
||||||
}
|
}
|
||||||
|
@ -732,6 +871,7 @@ _smart_calculate(Evas_Object *obj)
|
||||||
else if (sd->type == TYPE_SCALE) _type_scale_calc(obj, ox, oy, ow, oh);
|
else if (sd->type == TYPE_SCALE) _type_scale_calc(obj, ox, oy, ow, oh);
|
||||||
else if (sd->type == TYPE_EDJE) _type_edje_calc(obj, ox, oy, ow, oh);
|
else if (sd->type == TYPE_EDJE) _type_edje_calc(obj, ox, oy, ow, oh);
|
||||||
else if (sd->type == TYPE_MOV) _type_mov_calc(obj, ox, oy, ow, oh);
|
else if (sd->type == TYPE_MOV) _type_mov_calc(obj, ox, oy, ow, oh);
|
||||||
|
else if (sd->type == TYPE_THUMB) _type_thumb_calc(obj, ox, oy, ow, oh);
|
||||||
evas_object_move(sd->clip, ox, oy);
|
evas_object_move(sd->clip, ox, oy);
|
||||||
evas_object_resize(sd->clip, ow, oh);
|
evas_object_resize(sd->clip, ow, oh);
|
||||||
if (sd->o_busy)
|
if (sd->o_busy)
|
||||||
|
@ -930,23 +1070,31 @@ media_add(Evas_Object *parent, const char *src, const Config *config, int mode,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!sd->url) sd->realf = eina_stringshare_add(sd->src);
|
if (!sd->url) sd->realf = eina_stringshare_add(sd->src);
|
||||||
|
|
||||||
switch (t)
|
if ((mode & MEDIA_SIZE_MASK) == MEDIA_THUMB)
|
||||||
{
|
{
|
||||||
case TYPE_IMG:
|
// XXX: handle sd->url being true?
|
||||||
if (!sd->url) _type_img_init(obj);
|
_type_thumb_init(obj);
|
||||||
break;
|
}
|
||||||
case TYPE_SCALE:
|
else
|
||||||
if (!sd->url) _type_scale_init(obj);
|
{
|
||||||
break;
|
switch (t)
|
||||||
case TYPE_EDJE:
|
{
|
||||||
if (!sd->url) _type_edje_init(obj);
|
case TYPE_IMG:
|
||||||
break;
|
if (!sd->url) _type_img_init(obj);
|
||||||
case TYPE_MOV:
|
break;
|
||||||
if (!sd->url) _type_mov_init(obj);
|
case TYPE_SCALE:
|
||||||
break;
|
if (!sd->url) _type_scale_init(obj);
|
||||||
default:
|
break;
|
||||||
break;
|
case TYPE_EDJE:
|
||||||
|
if (!sd->url) _type_edje_init(obj);
|
||||||
|
break;
|
||||||
|
case TYPE_MOV:
|
||||||
|
if (!sd->url) _type_mov_init(obj);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (type) *type = t;
|
if (type) *type = t;
|
||||||
return obj;
|
return obj;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#define MEDIA_BG 0x0000
|
#define MEDIA_BG 0x0000
|
||||||
#define MEDIA_POP 0x0001
|
#define MEDIA_POP 0x0001
|
||||||
#define MEDIA_STRETCH 0x0002
|
#define MEDIA_STRETCH 0x0002
|
||||||
|
#define MEDIA_THUMB 0x0003
|
||||||
// bitmask for options - on or off
|
// bitmask for options - on or off
|
||||||
#define MEDIA_RECOVER 0x0010
|
#define MEDIA_RECOVER 0x0010
|
||||||
#define MEDIA_SAVE 0x0020
|
#define MEDIA_SAVE 0x0020
|
||||||
|
@ -16,6 +17,7 @@
|
||||||
#define TYPE_SCALE 1
|
#define TYPE_SCALE 1
|
||||||
#define TYPE_EDJE 2
|
#define TYPE_EDJE 2
|
||||||
#define TYPE_MOV 3
|
#define TYPE_MOV 3
|
||||||
|
#define TYPE_THUMB 4
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
|
@ -481,6 +481,9 @@ _smart_apply(Evas_Object *obj)
|
||||||
media = MEDIA_POP;
|
media = MEDIA_POP;
|
||||||
else if (blk->scale_fill)
|
else if (blk->scale_fill)
|
||||||
media = MEDIA_BG;
|
media = MEDIA_BG;
|
||||||
|
else if (blk->thumb)
|
||||||
|
media = MEDIA_THUMB;
|
||||||
|
// media = MEDIA_POP;
|
||||||
if (!blk->was_active_before)
|
if (!blk->was_active_before)
|
||||||
media |= MEDIA_SAVE;
|
media |= MEDIA_SAVE;
|
||||||
else
|
else
|
||||||
|
@ -2619,7 +2622,8 @@ _smart_pty_command(void *data)
|
||||||
{
|
{
|
||||||
if ((sd->pty->cur_cmd[1] == 's') ||
|
if ((sd->pty->cur_cmd[1] == 's') ||
|
||||||
(sd->pty->cur_cmd[1] == 'c') ||
|
(sd->pty->cur_cmd[1] == 'c') ||
|
||||||
(sd->pty->cur_cmd[1] == 'f'))
|
(sd->pty->cur_cmd[1] == 'f') ||
|
||||||
|
(sd->pty->cur_cmd[1] == 't'))
|
||||||
{
|
{
|
||||||
const char *p, *p0, *path;
|
const char *p, *p0, *path;
|
||||||
int ww = 0, hh = 0, repch;
|
int ww = 0, hh = 0, repch;
|
||||||
|
@ -2661,6 +2665,8 @@ _smart_pty_command(void *data)
|
||||||
blk->scale_center = EINA_TRUE;
|
blk->scale_center = EINA_TRUE;
|
||||||
else if (sd->pty->cur_cmd[1] == 'f')
|
else if (sd->pty->cur_cmd[1] == 'f')
|
||||||
blk->scale_fill = EINA_TRUE;
|
blk->scale_fill = EINA_TRUE;
|
||||||
|
else if (sd->pty->cur_cmd[1] == 't')
|
||||||
|
blk->thumb = EINA_TRUE;
|
||||||
termpty_block_insert(sd->pty, repch, blk);
|
termpty_block_insert(sd->pty, repch, blk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,6 +149,7 @@ struct _Termblock
|
||||||
Eina_Bool scale_stretch : 1;
|
Eina_Bool scale_stretch : 1;
|
||||||
Eina_Bool scale_center : 1;
|
Eina_Bool scale_center : 1;
|
||||||
Eina_Bool scale_fill : 1;
|
Eina_Bool scale_fill : 1;
|
||||||
|
Eina_Bool thumb : 1;
|
||||||
|
|
||||||
Eina_Bool active : 1;
|
Eina_Bool active : 1;
|
||||||
Eina_Bool was_active : 1;
|
Eina_Bool was_active : 1;
|
||||||
|
|
192
src/bin/tyls.c
192
src/bin/tyls.c
|
@ -11,6 +11,9 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
// this code sucks. just letting you know... in advance... in case you
|
||||||
|
// might be tempted to think otherwise... :)
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
SMALL,
|
SMALL,
|
||||||
MEDIUM,
|
MEDIUM,
|
||||||
|
@ -72,34 +75,22 @@ is_fmt(const char *f, const char **extn)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
prnt(const char *path, int w, int h, int mode)
|
size_print(char *buf, int bufsz, unsigned long long size)
|
||||||
{
|
{
|
||||||
int x, y, i;
|
if (size < 1024LL)
|
||||||
char *line, buf[4096];
|
snprintf(buf, bufsz, " %4lld", size);
|
||||||
|
else if (size < (1024LL * 1024LL))
|
||||||
if ((w >= 512) || (h >= 512)) return;
|
snprintf(buf, bufsz, "%4lldK", size / (1024LL));
|
||||||
line = malloc(w + 100);
|
else if (size < (1024LL * 1024LL * 1024LL))
|
||||||
if (!line) return;
|
snprintf(buf, bufsz, "%4lldM", size / (1024LL * 1024LL));
|
||||||
snprintf(buf, sizeof(buf), "%c}ic#%i;%i;%s", 0x1b, w, h, path);
|
else if (size < (1024LL * 1024LL * 1024LL * 1024LL))
|
||||||
if (write(0, buf, strlen(buf) + 1) < 0) perror("write");
|
snprintf(buf, bufsz, "%4lldG", size / (1024LL * 1024 * 1024LL));
|
||||||
i = 0;
|
else if (size < (1024LL * 1024LL * 1024LL * 1024LL * 1024LL))
|
||||||
line[i++] = 0x1b;
|
snprintf(buf, bufsz, "%4lldT", size / (1024LL * 1024LL * 1024LL * 1024LL));
|
||||||
line[i++] = '}';
|
else if (size < (1024LL * 1024LL * 1024LL * 1024LL * 1024LL * 1024LL))
|
||||||
line[i++] = 'i';
|
snprintf(buf, bufsz, "%4lldP", size / (1024LL * 1024LL * 1024LL * 1024LL * 1024LL));
|
||||||
line[i++] = 'b';
|
else
|
||||||
line[i++] = 0;
|
snprintf(buf, bufsz, "%4lldE", size / (1024LL * 1024LL * 1024LL * 1024LL * 1024LL * 1024LL));
|
||||||
for (x = 0; x < w; x++) line[i++] = '#';
|
|
||||||
line[i++] = 0x1b;
|
|
||||||
line[i++] = '}';
|
|
||||||
line[i++] = 'i';
|
|
||||||
line[i++] = 'e';
|
|
||||||
line[i++] = 0;
|
|
||||||
line[i++] = '\n';
|
|
||||||
for (y = 0; y < h; y++)
|
|
||||||
{
|
|
||||||
if (write(0, line, i) < 0) perror("write");
|
|
||||||
}
|
|
||||||
free(line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -107,11 +98,11 @@ list_dir(const char *dir, int mode)
|
||||||
{
|
{
|
||||||
Eina_List *files, *l;
|
Eina_List *files, *l;
|
||||||
char *s, **names;
|
char *s, **names;
|
||||||
int maxlen = 0, cols, c, i, j, num, cw, stuff;
|
int maxlen = 0, cols, c, rows, i, j, k, num, cw, stuff;
|
||||||
|
|
||||||
files = ecore_file_ls(dir);
|
files = ecore_file_ls(dir);
|
||||||
if (!files) return;
|
if (!files) return;
|
||||||
names = calloc(eina_list_count(files), sizeof(char *));
|
names = calloc(eina_list_count(files) * 2, sizeof(char *));
|
||||||
if (!names) return;
|
if (!names) return;
|
||||||
i = 0;
|
i = 0;
|
||||||
EINA_LIST_FOREACH(files, l, s)
|
EINA_LIST_FOREACH(files, l, s)
|
||||||
|
@ -126,8 +117,10 @@ list_dir(const char *dir, int mode)
|
||||||
num = i;
|
num = i;
|
||||||
stuff = 0;
|
stuff = 0;
|
||||||
if (mode == SMALL) stuff += 2;
|
if (mode == SMALL) stuff += 2;
|
||||||
stuff += 1; // spacer at start
|
else if (mode == MEDIUM) stuff += 4;
|
||||||
stuff += 5; // xxxx[ /K/M/G/T/P...]
|
stuff += 5; // xxxx[ /K/M/G/T/P...]
|
||||||
|
stuff += 1; // spacer at start
|
||||||
|
// name
|
||||||
stuff += 1; // type [@/*/|/=...]
|
stuff += 1; // type [@/*/|/=...]
|
||||||
stuff += 1; // spacer
|
stuff += 1; // spacer
|
||||||
maxlen += stuff;
|
maxlen += stuff;
|
||||||
|
@ -135,56 +128,113 @@ list_dir(const char *dir, int mode)
|
||||||
{
|
{
|
||||||
cols = tw / maxlen;
|
cols = tw / maxlen;
|
||||||
if (cols < 1) cols = 1;
|
if (cols < 1) cols = 1;
|
||||||
for (i = 0; i < ((num + (cols - 1)) / cols); i++)
|
if (cols == 1)
|
||||||
{
|
{
|
||||||
for (c = 0; c < cols; c++)
|
maxlen--;
|
||||||
|
stuff--;
|
||||||
|
}
|
||||||
|
rows = ((num + (cols - 1)) / cols);
|
||||||
|
for (i = 0; i < rows; i++)
|
||||||
|
{
|
||||||
|
if (mode == SMALL)
|
||||||
{
|
{
|
||||||
char buf[4096], sz[6];
|
for (c = 0; c < cols; c++)
|
||||||
long long size;
|
|
||||||
|
|
||||||
s = names[((c * (num + (cols - 1))) / cols) + i];
|
|
||||||
if (!s) continue;
|
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", dir, s);
|
|
||||||
int len = eina_unicode_utf8_get_len(s);
|
|
||||||
cw = tw / cols;
|
|
||||||
size = ecore_file_size(buf);
|
|
||||||
if (size < 1024)
|
|
||||||
snprintf(sz, sizeof(sz), " %4lld", size);
|
|
||||||
else if (size < (1024 * 1024))
|
|
||||||
snprintf(sz, sizeof(sz), "%4lldK", size / (1024));
|
|
||||||
else if (size < (1024 * 1024 * 1024))
|
|
||||||
snprintf(sz, sizeof(sz), "%4lldM", size / (1024 * 1024));
|
|
||||||
else if (size < (1024 * 1024 * 1024 * 1024LL))
|
|
||||||
snprintf(sz, sizeof(sz), "%4lldG", size / (1024 * 1024 * 1024LL));
|
|
||||||
else if (size < (1024 * 1024 * 1024 * 1024LL * 1024LL))
|
|
||||||
snprintf(sz, sizeof(sz), "%4lldT", size / (1024 * 1024 * 1024 * 1024LL));
|
|
||||||
else if (size < (1024 * 1024 * 1024 * 1024LL * 1024LL * 1024LL))
|
|
||||||
snprintf(sz, sizeof(sz), "%4lldP", size / (1024 * 1024 * 1024 * 1024LL * 1024LL));
|
|
||||||
len += stuff;
|
|
||||||
printf("%c}ic#%i;%i;%s%c", 0x1b, 2, 1, buf, 0);
|
|
||||||
printf("%c}ib%c", 0x1b, 0);
|
|
||||||
printf("##");
|
|
||||||
printf("%c}ie%c", 0x1b, 0);
|
|
||||||
printf(" %s %s", sz, s);
|
|
||||||
if (ecore_file_is_dir(buf)) printf("/");
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
char *ts;
|
char buf[4096], sz[6];
|
||||||
|
long long size;
|
||||||
|
|
||||||
ts = ecore_file_readlink(buf);
|
s = names[(c * rows) + i];
|
||||||
if (ts)
|
if (!s) continue;
|
||||||
{
|
snprintf(buf, sizeof(buf), "%s/%s", dir, s);
|
||||||
printf("@");
|
int len = eina_unicode_utf8_get_len(s);
|
||||||
free(ts);
|
cw = tw / cols;
|
||||||
}
|
size = ecore_file_size(buf);
|
||||||
|
size_print(sz, sizeof(sz), size);
|
||||||
|
len += stuff;
|
||||||
|
printf("%c}it#%i;%i;%s%c", 0x1b, 2, 1, buf, 0);
|
||||||
|
printf("%c}ib%c", 0x1b, 0);
|
||||||
|
printf("##");
|
||||||
|
printf("%c}ie%c", 0x1b, 0);
|
||||||
|
printf("%s %s", sz, s);
|
||||||
|
if (ecore_file_is_dir(buf)) printf("/");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf(" ");
|
char *ts;
|
||||||
|
|
||||||
|
ts = ecore_file_readlink(buf);
|
||||||
|
if (ts)
|
||||||
|
{
|
||||||
|
printf("@");
|
||||||
|
free(ts);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf(" ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
for (j = 0; j < (cw - len); j++) printf(" ");
|
||||||
}
|
}
|
||||||
for (j = 0; j < (cw - len); j++) printf(" ");
|
printf("\n");
|
||||||
|
}
|
||||||
|
else if (mode == MEDIUM)
|
||||||
|
{
|
||||||
|
for (c = 0; c < cols; c++)
|
||||||
|
{
|
||||||
|
char buf[4096];
|
||||||
|
|
||||||
|
s = names[(c * rows) + i];
|
||||||
|
if (!s) continue;
|
||||||
|
int len = eina_unicode_utf8_get_len(s);
|
||||||
|
snprintf(buf, sizeof(buf), "%s/%s", dir, s);
|
||||||
|
cw = tw / cols;
|
||||||
|
len += 4;
|
||||||
|
if (cols > 1) len += 1;
|
||||||
|
printf("%c}it%c%i;%i;%s%c", 0x1b, 33 + c, 4, 2, buf, 0);
|
||||||
|
printf("%c}ib%c", 0x1b, 0);
|
||||||
|
printf("%c%c%c%c", 33 + c, 33 + c, 33 + c, 33 + c);
|
||||||
|
printf("%c}ie%c", 0x1b, 0);
|
||||||
|
printf("%s", s);
|
||||||
|
for (j = 0; j < (cw - len); j++) printf(" ");
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
for (c = 0; c < cols; c++)
|
||||||
|
{
|
||||||
|
char buf[4096], sz[6];
|
||||||
|
long long size;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
s = names[(c * rows) + i];
|
||||||
|
if (!s) continue;
|
||||||
|
snprintf(buf, sizeof(buf), "%s/%s", dir, s);
|
||||||
|
cw = tw / cols;
|
||||||
|
size = ecore_file_size(buf);
|
||||||
|
size_print(sz, sizeof(sz), size);
|
||||||
|
len = eina_unicode_utf8_get_len(sz) + 2;
|
||||||
|
if (cols > 1) len += 1;
|
||||||
|
printf("%c}ib%c", 0x1b, 0);
|
||||||
|
printf("%c%c%c%c", 33 + c, 33 + c, 33 + c, 33 + c);
|
||||||
|
printf("%c}ie%c", 0x1b, 0);
|
||||||
|
printf("%s ", sz);
|
||||||
|
if (ecore_file_is_dir(buf)) printf("/");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *ts;
|
||||||
|
|
||||||
|
ts = ecore_file_readlink(buf);
|
||||||
|
if (ts)
|
||||||
|
{
|
||||||
|
printf("@");
|
||||||
|
free(ts);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (j = 0; j < (cw - len); j++) printf(" ");
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(names);
|
free(names);
|
||||||
|
|
Loading…
Reference in New Issue