make tyls more.. colorful. :)

SVN revision: 83896
This commit is contained in:
Carsten Haitzler 2013-02-14 15:53:29 +00:00
parent 6f6b57d141
commit 104e1b51cb
1 changed files with 462 additions and 134 deletions

View File

@ -10,6 +10,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fnmatch.h>
// this code sucks. just letting you know... in advance... in case you
// might be tempted to think otherwise... :)
@ -75,22 +76,462 @@ is_fmt(const char *f, const char **extn)
}
static void
size_print(char *buf, int bufsz, unsigned long long size)
size_print(char *buf, int bufsz, char *sz, unsigned long long size)
{
if (size < 1024LL)
snprintf(buf, bufsz, " %4lld", size);
{
snprintf(buf, bufsz, "%4lld", size);
*sz = ' ';
}
else if (size < (1024LL * 1024LL))
snprintf(buf, bufsz, "%4lldK", size / (1024LL));
{
snprintf(buf, bufsz, "%4lld", size / (1024LL));
*sz = 'K';
}
else if (size < (1024LL * 1024LL * 1024LL))
snprintf(buf, bufsz, "%4lldM", size / (1024LL * 1024LL));
{
snprintf(buf, bufsz, "%4lld", size / (1024LL * 1024LL));
*sz = 'M';
}
else if (size < (1024LL * 1024LL * 1024LL * 1024LL))
snprintf(buf, bufsz, "%4lldG", size / (1024LL * 1024 * 1024LL));
{
snprintf(buf, bufsz, "%4lld", size / (1024LL * 1024 * 1024LL));
*sz = 'G';
}
else if (size < (1024LL * 1024LL * 1024LL * 1024LL * 1024LL))
snprintf(buf, bufsz, "%4lldT", size / (1024LL * 1024LL * 1024LL * 1024LL));
{
snprintf(buf, bufsz, "%4lld", size / (1024LL * 1024LL * 1024LL * 1024LL));
*sz = 'T';
}
else if (size < (1024LL * 1024LL * 1024LL * 1024LL * 1024LL * 1024LL))
snprintf(buf, bufsz, "%4lldP", size / (1024LL * 1024LL * 1024LL * 1024LL * 1024LL));
{
snprintf(buf, bufsz, "%4lld", size / (1024LL * 1024LL * 1024LL * 1024LL * 1024LL));
*sz = 'P';
}
else
snprintf(buf, bufsz, "%4lldE", size / (1024LL * 1024LL * 1024LL * 1024LL * 1024LL * 1024LL));
{
snprintf(buf, bufsz, "%4lld", size / (1024LL * 1024LL * 1024LL * 1024LL * 1024LL * 1024LL));
*sz = 'E';
}
}
#define RESET 0
#define CORE 1
#define CUBE 2
#define GRAY 3
#define BG 0
#define FG 1
#define BLACK 0
#define RED 1
#define GREEN 2
#define YELLOW 3
#define BLUE 4
#define PURPLE 5
#define CYAN 6
#define WHITE 7
#define BRIGHT 8
// #3399ff
// 51 153 355
// as 6x6x6
// 1.0 3.0 5.0
static void
colorprint(int mode, int fgbg, int r, int g, int b)
{
if (mode == RESET)
{
printf("%c[0m", 0x1b);
}
else if (mode == CORE) // 8 bg and 8 fg colors
{
int v = 0;
if (r & BRIGHT) printf("%c[01m", 0x1b);
else printf("%c[0m", 0x1b);
if (fgbg == FG) v = 30 + (r & 0x7);
else v = 40 + (r & 0x7);
printf("%c[%im", 0x1b, v);
}
else if (mode == CUBE) // 6x6x6 cube
{
int v = 0, c = 0;
if (fgbg == FG) v = 38;
else v = 48;
c = 16 + ((r * 6 * 6) + (g * 6) + b);
printf("%c[%i;5;%im", 0x1b, v, c);
}
else if (mode == GRAY) // 26 levels of grey
{
}
}
static void
sizeprint(char *sz, char szch)
{
colorprint(CUBE, FG, 1, 3, 5);
printf("%s", sz);
if (szch == 'K')
colorprint(CUBE, FG, 3, 4, 5);
else if (szch == 'M')
colorprint(CUBE, FG, 5, 5, 5);
else if (szch == 'G')
colorprint(CUBE, FG, 5, 3, 0);
else if (szch == 'T')
colorprint(CUBE, FG, 5, 1, 1);
else if (szch == 'P')
colorprint(CUBE, FG, 5, 0, 0);
else if (szch == 'E')
colorprint(CUBE, FG, 5, 5, 0);
printf("%c", szch);
colorprint(RESET, 0, 0, 0, 0);
}
typedef struct _Cmatch
{
short fr, fg, fb;
short br, bg, bb;
const char *match;
} Cmatch;
// for regular files
const Cmatch fmatch[] =
{
{ 5, 5, 5, 9, 9, 9, "*.jpg"},
{ 5, 5, 5, 9, 9, 9, "*.JPG"},
{ 5, 5,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, 5, 9, 9, 9, "*.docx"},
{ 3, 1, 5, 9, 9, 9, "*.DOCX"},
{ 3, 1, 5, 9, 9, 9, "*.html"},
{ 3, 1, 5, 9, 9, 9, "*.HTML"},
{ 3, 1, 5, 9, 9, 9, "*.htm"},
{ 3, 1, 5, 9, 9, 9, "*.HTM"},
{ 0, 0, 0, 0, 0, 0, NULL}
};
// for directories
const Cmatch dmatch[] =
{
{ 5, 3, 0, 9, 9, 9, "Desktop"},
{ 5, 3, 0, 9, 9, 9, "Desktop-*"},
{ 4, 1, 5, 9, 9, 9, "public_html"},
{ 0, 0, 0, 0, 0, 0, NULL}
};
// for exectuable files
const Cmatch xmatch[] =
{
{ 0, 0, 0, 0, 0, 0, NULL}
};
static Eina_Bool
printmatch(const char *name, const Cmatch *m)
{
int i;
for (i = 0; m[i].match; i++)
{
if (!fnmatch(m[i].match, name, 0))
{
if (m[i].fr <= 5) colorprint(CUBE, FG, m[i].fr, m[i].fg, m[i].fb);
if (m[i].br <= 5) colorprint(CUBE, BG, m[i].br, m[i].bg, m[i].bb);
printf("%s", name);
return EINA_TRUE;
}
}
return EINA_FALSE;
}
static void
fileprint(char *path, char *name, Eina_Bool type)
{
Eina_Bool isdir = EINA_FALSE;
Eina_Bool islink = EINA_FALSE;
if (name || type)
{
char *ts;
if (ecore_file_is_dir(path)) isdir = EINA_TRUE;
ts = ecore_file_readlink(path);
if (ts)
{
islink = EINA_TRUE;
free(ts);
}
}
if (name)
{
if (isdir)
{
if (!printmatch(name, dmatch))
{
colorprint(CUBE, FG, 1, 3, 5);
printf("%s", name);
}
}
else
{
if (!printmatch(name, fmatch))
{
printf("%s", name);
}
}
}
if (type)
{
if (islink)
{
colorprint(CUBE, FG, 3, 1, 5);
printf("@");
}
else if (isdir)
{
colorprint(CUBE, FG, 3, 4, 5);
printf("/");
}
else
printf(" ");
}
colorprint(RESET, 0, 0, 0, 0);
}
static void
@ -133,6 +574,7 @@ list_dir(const char *dir, int mode)
maxlen--;
stuff--;
}
if (cols > num) cols = num;
rows = ((num + (cols - 1)) / cols);
for (i = 0; i < rows; i++)
{
@ -140,7 +582,7 @@ list_dir(const char *dir, int mode)
{
for (c = 0; c < cols; c++)
{
char buf[4096], sz[6];
char buf[4096], sz[6], szch = ' ';
long long size;
s = names[(c * rows) + i];
@ -149,29 +591,15 @@ list_dir(const char *dir, int mode)
int len = eina_unicode_utf8_get_len(s);
cw = tw / cols;
size = ecore_file_size(buf);
size_print(sz, sizeof(sz), size);
size_print(sz, sizeof(sz), &szch, 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
{
char *ts;
ts = ecore_file_readlink(buf);
if (ts)
{
printf("@");
free(ts);
}
else
{
printf(" ");
}
}
sizeprint(sz, szch);
printf(" ");
fileprint(buf, s, EINA_TRUE);
for (j = 0; j < (cw - len); j++) printf(" ");
}
printf("\n");
@ -193,7 +621,7 @@ list_dir(const char *dir, int mode)
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);
fileprint(buf, s, EINA_FALSE);
if (c < (cols - 1))
{
for (j = 0; j < (cw - len); j++) printf(" ");
@ -202,7 +630,7 @@ list_dir(const char *dir, int mode)
printf("\n");
for (c = 0; c < cols; c++)
{
char buf[4096], sz[6];
char buf[4096], sz[6], szch = ' ';
long long size;
int len;
@ -211,29 +639,15 @@ list_dir(const char *dir, int mode)
snprintf(buf, sizeof(buf), "%s/%s", dir, s);
cw = tw / cols;
size = ecore_file_size(buf);
size_print(sz, sizeof(sz), size);
size_print(sz, sizeof(sz), &szch, size);
len = eina_unicode_utf8_get_len(sz) + 2 + 4;
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(" ");
}
}
sizeprint(sz, szch);
printf(" ");
fileprint(buf, NULL, EINA_TRUE);
if (c < (cols - 1))
{
for (j = 0; j < (cw - len); j++) printf(" ");
@ -246,93 +660,6 @@ list_dir(const char *dir, int mode)
free(names);
EINA_LIST_FREE(files, s) free(s);
}
/*
if ((is_fmt(rp, extn_img)) ||
(is_fmt(rp, extn_scale)) ||
(is_fmt(rp, extn_mov)))
{
o = evas_object_image_add(evas);
evas_object_image_file_set(o, rp, NULL);
evas_object_image_size_get(o, &w, &h);
if ((w >= 0) && (h > 0))
{
scaleterm(w, h, &iw, &ih);
prnt(rp, iw, ih, mode);
goto done;
}
evas_object_del(o);
o = NULL;
}
if (is_fmt(rp, extn_edj))
{
Eina_Bool ok = EINA_TRUE;
evas_object_del(o);
o = edje_object_add(evas);
if (!edje_object_file_set
(o, rp, "terminology/backgroud"))
{
if (!edje_object_file_set
(o, rp, "e/desktop/background"))
ok = EINA_FALSE;
}
if (ok)
{
Evas_Coord mw = 0, mh = 0;
edje_object_size_min_get(o, &mw, &mh);
if ((mw <= 0) || (mh <= 0))
edje_object_size_min_calc(o, &mw, &mh);
if ((mw <= 0) || (mh <= 0))
{
mw = (tw) * cw;
mh = (th - 1) * ch;
}
scaleterm(mw, mh, &iw, &ih);
prnt(rp, iw, ih, mode);
goto done;
}
evas_object_del(o);
o = NULL;
}
if ((is_fmt(rp, extn_aud)) ||
(is_fmt(rp, extn_mov)))
{
Eina_Bool ok = EINA_TRUE;
o = emotion_object_add(evas);
ok = emotion_object_init(o, NULL);
if (ok)
{
if (emotion_object_file_set(o, rp))
{
emotion_object_audio_mute_set(o, EINA_TRUE);
if (emotion_object_video_handled_get(o))
{
emotion_object_size_get(o, &w, &h);
if ((w >= 0) && (h > 0))
{
scaleterm(w, h, &iw, &ih);
prnt(rp, iw, ih, mode);
}
}
else
prnt(rp, tw, 3, NOIMG);
goto done;
}
}
evas_object_del(o);
o = NULL;
}
done:
if (o) evas_object_del(o);
o = NULL;
free(rp);
}
evas_norender(evas);
*/
int
main(int argc, char **argv)
@ -424,6 +751,7 @@ main(int argc, char **argv)
free(rp);
}
}
fflush(stdout);
exit(0);
// ecore_main_loop_begin();
ecore_evas_free(ee);