rename cli/ -> cursetree/
This commit is contained in:
parent
2ad6e4e104
commit
878be07a71
12 changed files with 37 additions and 18 deletions
13
Makefile
13
Makefile
|
|
@ -8,6 +8,7 @@ BUILD := build
|
||||||
|
|
||||||
LIB := lib
|
LIB := lib
|
||||||
CLI := cli
|
CLI := cli
|
||||||
|
CT := cursetree
|
||||||
|
|
||||||
# === MACRO DEFINITIONS ===
|
# === MACRO DEFINITIONS ===
|
||||||
define objpath
|
define objpath
|
||||||
|
|
@ -18,7 +19,7 @@ endef
|
||||||
define mkobj
|
define mkobj
|
||||||
$(foreach DEP, $?,
|
$(foreach DEP, $?,
|
||||||
mkdir -p $(dir $(call objpath, $(DEP)))
|
mkdir -p $(dir $(call objpath, $(DEP)))
|
||||||
$(CC) $(CFLAGS) -o $(call objpath, $(DEP)) -c $(DEP))
|
$(CC) $(CFLAGS) $1 -o $(call objpath, $(DEP)) -c $(DEP))
|
||||||
|
|
||||||
$(LD) -r $(LDFLAGS) -o $@ $(call objpath, $?)
|
$(LD) -r $(LDFLAGS) -o $@ $(call objpath, $?)
|
||||||
endef
|
endef
|
||||||
|
|
@ -36,11 +37,11 @@ $(BUILD) $(BIN):
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
$(BUILD)/dorne.o: $(addprefix $(CLI)/, main.c)
|
$(BUILD)/dorne.o: $(addprefix $(CLI)/, main.c)
|
||||||
$(mkobj)
|
$(call mkobj,-Icursetree)
|
||||||
$(BUILD)/cursetree.o: $(addprefix $(CLI)/, tree.c curse.c)
|
$(BUILD)/cursetree.o: $(addprefix $(CT)/, cursetree.c curse.c)
|
||||||
$(mkobj)
|
$(call mkobj,)
|
||||||
$(BUILD)/epty.o: $(addprefix $(CLI)/, child.c epty.c _pty.c)
|
$(BUILD)/epty.o: $(addprefix $(CT)/, child.c epty.c _pty.c)
|
||||||
$(mkobj)
|
$(call mkobj,)
|
||||||
|
|
||||||
# === DEVELOPMENT TARGETS ===
|
# === DEVELOPMENT TARGETS ===
|
||||||
.PHONY: debug run test
|
.PHONY: debug run test
|
||||||
|
|
|
||||||
31
cli/main.c
31
cli/main.c
|
|
@ -4,12 +4,9 @@
|
||||||
|
|
||||||
#include <ncursesw/ncurses.h>
|
#include <ncursesw/ncurses.h>
|
||||||
|
|
||||||
#include "tree.h"
|
#include "cursetree.h"
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
// struct d_child child;
|
|
||||||
// spawnchild(&child);
|
|
||||||
|
|
||||||
struct crs_tree *tree;
|
struct crs_tree *tree;
|
||||||
ct_init(&tree);
|
ct_init(&tree);
|
||||||
|
|
||||||
|
|
@ -17,17 +14,33 @@ int main(int argc, char **argv) {
|
||||||
init_pair(2, COLOR_RED, COLOR_RED);
|
init_pair(2, COLOR_RED, COLOR_RED);
|
||||||
|
|
||||||
bifurcate_window_node(&tree->root, AXIS_X, FALSE, 0.5);
|
bifurcate_window_node(&tree->root, AXIS_X, FALSE, 0.5);
|
||||||
wbkgd(tree->root->child[0]->win, COLOR_PAIR(1));
|
// wbkgd(tree->root->child[0]->win, COLOR_PAIR(1));
|
||||||
wbkgd(tree->root->child[1]->win, COLOR_PAIR(2));
|
// wbkgd(tree->root->child[1]->win, COLOR_PAIR(2));
|
||||||
wrefresh(tree->root->child[0]->win);
|
// wrefresh(tree->root->child[0]->win);
|
||||||
wrefresh(tree->root->child[1]->win);
|
// wrefresh(tree->root->child[1]->win);
|
||||||
|
|
||||||
// wbkgd(tree->root->win, COLOR_PAIR(1));
|
// wbkgd(tree->root->win, COLOR_PAIR(1));
|
||||||
// wrefresh(tree->root->win);
|
// wrefresh(tree->root->win);
|
||||||
|
|
||||||
|
int i = 1;
|
||||||
while (1) {
|
while (1) {
|
||||||
|
/* TODO: UNCOMMENT START */
|
||||||
|
// wclear(tree->root->child[0]->win);
|
||||||
|
// wclear(tree->root->child[1]->win);
|
||||||
|
// wbkgd(tree->root->child[0]->win, COLOR_PAIR(i));
|
||||||
|
// wbkgd(tree->root->child[1]->win, COLOR_PAIR(3 - i));
|
||||||
|
|
||||||
|
// wnoutrefresh(tree->root->child[0]->win);
|
||||||
|
// wnoutrefresh(tree->root->child[1]->win);
|
||||||
|
// doupdate();
|
||||||
|
|
||||||
|
// wrefresh(tree->root->child[0]->win);
|
||||||
|
// wrefresh(tree->root->child[1]->win);
|
||||||
|
i = 3 - i;
|
||||||
|
/* TODO: UNCOMMENT END */
|
||||||
|
|
||||||
ct_update(tree);
|
ct_update(tree);
|
||||||
usleep(100000);
|
// usleep(100000);
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy_tree(tree);
|
destroy_tree(tree);
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include "curse.h"
|
#include "curse.h"
|
||||||
#include "ncurses.h"
|
#include "ncurses.h"
|
||||||
#include "tree.h"
|
#include "cursetree.h"
|
||||||
|
|
||||||
/* Internal allocator method for crs_node structures.
|
/* Internal allocator method for crs_node structures.
|
||||||
*/
|
*/
|
||||||
|
|
@ -272,6 +272,9 @@ void ct_update(struct crs_tree *const tree) {
|
||||||
*/
|
*/
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case -1:
|
case -1:
|
||||||
|
wclear(tree->root->child[0]->win);
|
||||||
|
mvwprintw(tree->root->child[0]->win, 0, 0, " \r-1\n");
|
||||||
|
wrefresh(tree->root->child[0]->win);
|
||||||
return;
|
return;
|
||||||
case KEY_RESIZE:
|
case KEY_RESIZE:
|
||||||
termsize(term_width, term_height);
|
termsize(term_width, term_height);
|
||||||
|
|
@ -279,9 +282,11 @@ void ct_update(struct crs_tree *const tree) {
|
||||||
resize_tree(tree, term_dims);
|
resize_tree(tree, term_dims);
|
||||||
// flush ncurses virtual screen -> physical screen
|
// flush ncurses virtual screen -> physical screen
|
||||||
doupdate();
|
doupdate();
|
||||||
/* TODO: why the fuck does this line make everything work?? */
|
break;
|
||||||
// printf("hola\n");
|
|
||||||
default:
|
default:
|
||||||
|
wclear(tree->root->child[0]->win);
|
||||||
|
mvwprintw(tree->root->child[0]->win, 0, 0, " \r%d\n", key);
|
||||||
|
wrefresh(tree->root->child[0]->win);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue