From 39396a2660150770c3fd14aac8b4be0dcbae8497 Mon Sep 17 00:00:00 2001 From: Jonas Suhr Christensen Date: Sat, 10 Mar 2012 14:56:34 +0100 Subject: Added new task hierarchy based protocol. Drag and drop works somehow - maybe some weirdness in html5 drag and drop. --- src/task_proto.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/task_proto.cc') diff --git a/src/task_proto.cc b/src/task_proto.cc index 4bcc3a8..717ca3e 100644 --- a/src/task_proto.cc +++ b/src/task_proto.cc @@ -184,9 +184,11 @@ int callback_lws_task(struct libwebsocket_context * context, case cmd::add: { printf("Handling add cmd\n"); +// task_t t = create_task(m.add.title, m.add.desc, +// m.add.x, m.add.y); task_t t = create_task(m.add.title, m.add.desc, - m.add.x, m.add.y); - tasklist.push_back(t); + m.add.parent_id); + tasklist.push_back(t); // buf_len = sprintf(buf, "add %d %s %s %d %d;", // t.id, t.title.c_str(), t.desc.c_str(), // t.x, t.y); @@ -202,6 +204,7 @@ int callback_lws_task(struct libwebsocket_context * context, printf("Delete\n"); printf("Deleting task with id %d\n", m.del.id); + // todo: delete all children recursively task_t del_task; bool id_found = false; TaskList::iterator it; @@ -228,21 +231,22 @@ int callback_lws_task(struct libwebsocket_context * context, case cmd::move: { printf("Move\n"); - printf("Moving task with id %d to (%d,%d)\n", m.move.id, m.move.x, m.move.y); + printf("Moving task with id %d to %d\n", m.move.id, m.move.parent_id); bool id_found = false; TaskList::iterator it; - int x = m.move.x / 300 * 300; +// int x = m.move.x / 300 * 300; task_t moved_task; for(it = tasklist.begin(); it != tasklist.end(); it++) { task_t &t = *it; if(t.id == m.move.id) { id_found = true; - t.x = x; - t.y = m.move.y; - moved_task = t; +// t.x = x; +// t.y = m.move.y; + t.parent_id = m.move.parent_id; + moved_task = t; break; } } -- cgit v1.2.3