aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/termcmd.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-08-14 12:30:55 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-08-14 12:30:55 +0000
commita684b21b577c4f7e8e638fdd5ad99e8d647c86d7 (patch)
tree3211acb23ae3bb88ea5d0ea909b3e014bd3afbfc /src/bin/termcmd.c
parentenable url fetching for backgrounds AND media popups with nice busy (diff)
downloadterminology-a684b21b577c4f7e8e638fdd5ad99e8d647c86d7.tar.gz
add some infra for cmd-mode for terminology. only 1 working cmd atm
"f" (font changes) SVN revision: 75254
Diffstat (limited to 'src/bin/termcmd.c')
-rw-r--r--src/bin/termcmd.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/bin/termcmd.c b/src/bin/termcmd.c
new file mode 100644
index 0000000..a5dbf55
--- /dev/null
+++ b/src/bin/termcmd.c
@@ -0,0 +1,88 @@
+#include "private.h"
+
+#include <Elementary.h>
+#include "main.h"
+#include "win.h"
+#include "termio.h"
+#include "config.h"
+#include "controls.h"
+#include "media.h"
+#include "utils.h"
+#include "termcmd.h"
+
+// called as u type
+Eina_Bool
+termcmd_watch(Evas_Object *obj, Evas_Object *win, Evas_Object *bg, const char *cmd)
+{
+ if (!cmd) return EINA_FALSE;
+ if ((cmd[0] == '/') || (cmd[0] == 's')) // search
+ {
+ if (cmd[1] == 0) // clear search
+ {
+ printf("search clear\n");
+ return EINA_TRUE;
+ }
+ printf("search '%s'\n", cmd + 1);
+ return EINA_TRUE;
+ }
+ return EINA_FALSE;
+ obj = win = bg = NULL;
+}
+
+// called when you hit enter
+Eina_Bool
+termcmd_do(Evas_Object *obj, Evas_Object *win, Evas_Object *bg, const char *cmd)
+{
+ if (!cmd) return EINA_FALSE;
+ if ((cmd[0] == '/') || (cmd[0] == 's')) // search
+ {
+ if (cmd[1] == 0) // clear search
+ {
+ printf("search clear\n");
+ return EINA_TRUE;
+ }
+ printf("search '%s'\n", cmd + 1);
+ return EINA_TRUE;
+ }
+ if ((cmd[0] == 'f') || (cmd[0] == 'F')) // font size
+ {
+ Config *config = termio_config_get(obj);
+
+ if (config)
+ {
+ if (cmd[1] == 0) // back to default
+ {
+ config->font.bitmap = config->font.orig_bitmap;
+ if (config->font.orig_name)
+ {
+ eina_stringshare_del(config->font.name);
+ config->font.name = eina_stringshare_add(config->font.orig_name);
+ }
+ termio_font_size_set(obj, config->font.orig_size);
+ return EINA_TRUE;
+ }
+ else if (cmd[1] == 'b') // big font size
+ {
+ if (config->font.orig_bitmap)
+ {
+ config->font.bitmap = 1;
+ eina_stringshare_del(config->font.name);
+ config->font.name = eina_stringshare_add("10x20.pcf");
+ termio_font_size_set(obj, 20);
+ }
+ }
+ else if (cmd[1] == '+') // size up
+ {
+ termio_font_size_set(obj, config->font.size + 1);
+ }
+ else if (cmd[1] == '-') // size down
+ {
+ termio_font_size_set(obj, config->font.size - 1);
+ }
+ }
+ return EINA_TRUE;
+ }
+ return EINA_FALSE;
+ obj = win = bg = NULL;
+}
+