Commit 68106e4a authored by Cedric Roux's avatar Cedric Roux

start working on the event selector window

parent bd50539f
...@@ -5,6 +5,7 @@ local: ...@@ -5,6 +5,7 @@ local:
remote: remote:
make -f Makefile.remote make -f Makefile.remote
make -f Makefile.remote textlog
clean: clean:
make -f Makefile.local clean make -f Makefile.local clean
......
...@@ -12,7 +12,7 @@ $(PROG): gui/gui.a $(OBJS) ...@@ -12,7 +12,7 @@ $(PROG): gui/gui.a $(OBJS)
$(CC) $(CFLAGS) -o $(PROG) $(OBJS) gui/gui.a $(LIBS) $(CC) $(CFLAGS) -o $(PROG) $(OBJS) gui/gui.a $(LIBS)
textlog: utils.o remote.o database.o event.o handler.o textlog.o \ textlog: utils.o remote.o database.o event.o handler.o textlog.o \
view/view.a gui/gui.a event_selector.o view/view.a gui/gui.a
$(CC) $(CFLAGS) -o textlog $^ $(LIBS) $(CC) $(CFLAGS) -o textlog $^ $(LIBS)
.PHONY: gui/gui.a view/view.a .PHONY: gui/gui.a view/view.a
......
#include "event_selector.h"
#include "gui/gui.h"
void setup_event_selector(gui *g, void *database, int socket, int *is_on)
{
widget *win;
widget *main_container;
widget *container;
widget *left, *right;
widget *events, *groups;
win = new_toplevel_window(g, 610, 800, "event selector");
main_container = new_container(g, VERTICAL);
widget_add_child(g, win, main_container, -1);
container = new_container(g, HORIZONTAL);
widget_add_child(g, main_container, container, -1);
container_set_child_growable(g, main_container, container, 1);
widget_add_child(g, main_container,
new_label(g, "mouse scroll to scroll - "
"left click to activate - "
"right click to deactivate"), -1);
left = new_container(g, VERTICAL);
right = new_container(g, VERTICAL);
widget_add_child(g, container, left, -1);
widget_add_child(g, container, right, -1);
container_set_child_growable(g, container, left, 1);
container_set_child_growable(g, container, right, 1);
widget_add_child(g, left, new_label(g, "Events"), -1);
widget_add_child(g, right, new_label(g, "Groups"), -1);
events = new_text_list(g, 300, 10, new_color(g, "#ccccff"));
groups = new_text_list(g, 300, 10, new_color(g, "#ccffee"));
widget_add_child(g, left, events, -1);
widget_add_child(g, right, groups, -1);
container_set_child_growable(g, left, events, 1);
container_set_child_growable(g, right, groups, 1);
}
#ifndef _EVENT_SELECTOR_H_
#define _EVENT_SELECTOR_H_
#include "gui/gui.h"
void setup_event_selector(gui *g, void *database, int socket, int *is_on);
#endif /* _EVENT_SELECTOR_H_ */
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "gui/gui.h" #include "gui/gui.h"
#include "utils.h" #include "utils.h"
#include "../T_defs.h" #include "../T_defs.h"
#include "event_selector.h"
#define DEFAULT_REMOTE_PORT 2021 #define DEFAULT_REMOTE_PORT 2021
...@@ -115,6 +116,7 @@ int main(int n, char **v) ...@@ -115,6 +116,7 @@ int main(int n, char **v)
int l; int l;
event_handler *h; event_handler *h;
textlog *textlog; textlog *textlog;
gui *g;
int gui_mode = 0; int gui_mode = 0;
on_off_name = malloc(n * sizeof(char *)); if (on_off_name == NULL) abort(); on_off_name = malloc(n * sizeof(char *)); if (on_off_name == NULL) abort();
...@@ -155,17 +157,18 @@ int main(int n, char **v) ...@@ -155,17 +157,18 @@ int main(int n, char **v)
"ENB_UL_CHANNEL_ESTIMATE", "ENB_UL_CHANNEL_ESTIMATE",
"ev: {} eNB_id [eNB_ID] frame [frame] subframe [subframe]"); "ev: {} eNB_id [eNB_ID] frame [frame] subframe [subframe]");
g = gui_init();
new_thread(gui_thread, g);
if (gui_mode) { if (gui_mode) {
view *tout; view *tout;
gui *g;
widget *w, *win; widget *w, *win;
g = gui_init(); // w = new_text_list(g, 600, 20, 0);
w = new_text_list(g, 600, 20, 0); w = new_text_list(g, 600, 20, new_color(g, "#ffabab"));
win = new_toplevel_window(g, 600, 20*12, "textlog"); win = new_toplevel_window(g, 600, 20*12, "textlog");
widget_add_child(g, win, w, -1); widget_add_child(g, win, w, -1);
//tout = new_textlist(1000, 10, g, w); tout = new_textlist(1000, 10, g, w);
tout = new_textlist(7, 4, g, w); //tout = new_textlist(7, 4, g, w);
new_thread(gui_thread, g);
textlog_add_view(textlog, tout); textlog_add_view(textlog, tout);
} else { } else {
view *sout = new_stdout(); view *sout = new_stdout();
...@@ -175,7 +178,7 @@ int main(int n, char **v) ...@@ -175,7 +178,7 @@ int main(int n, char **v)
for (i = 0; i < on_off_n; i++) for (i = 0; i < on_off_n; i++)
on_off(database, on_off_name[i], is_on, on_off_action[i]); on_off(database, on_off_name[i], is_on, on_off_action[i]);
s = get_connection("127.0.0.1", port); s = get_connection("0.0.0.0", port);
/* send the first message - activate selected traces */ /* send the first message - activate selected traces */
t = 0; t = 0;
...@@ -187,6 +190,8 @@ int main(int n, char **v) ...@@ -187,6 +190,8 @@ int main(int n, char **v)
if (is_on[l]) if (is_on[l])
if (write(s, &l, sizeof(int)) != sizeof(int)) abort(); if (write(s, &l, sizeof(int)) != sizeof(int)) abort();
setup_event_selector(g, database, s, is_on);
/* read messages */ /* read messages */
while (1) { while (1) {
char v[T_BUFFER_MAX]; char v[T_BUFFER_MAX];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment