diff options
author | Nao Pross <naopross@thearcway.org> | 2017-08-07 19:27:05 +0200 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2017-08-07 19:27:05 +0200 |
commit | d0801b36b47d8f3da610597160fde92059fd7e62 (patch) | |
tree | f9f0e348145c3548433e60adbf459e784b909f96 /sw/linux/src/ui.c | |
parent | filesystem structure intro and docs (diff) | |
download | z80uPC-d0801b36b47d8f3da610597160fde92059fd7e62.tar.gz z80uPC-d0801b36b47d8f3da610597160fde92059fd7e62.zip |
implementation for avr programmer
the programmer will receive the binary in blocks of defined size
by a program under sw/programmer/linux (moved from sw/linux).
Diffstat (limited to 'sw/linux/src/ui.c')
-rw-r--r-- | sw/linux/src/ui.c | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/sw/linux/src/ui.c b/sw/linux/src/ui.c deleted file mode 100644 index b33aa04..0000000 --- a/sw/linux/src/ui.c +++ /dev/null @@ -1,90 +0,0 @@ -#include "ui.h" - -static bool ui_connected, ui_fileset; -static GtkTextBuffer *ui_logbuf; -static GtkBuilder *ui_builder; - -void ui_init(int *argc, char **argv[]) -{ - GtkWindow *window; - GtkTextView *logview; - GtkFileChooserButton *filechoosebtn; - GtkButton *connectbtn, *flashbtn; - - /* set ui global variables */ - ui_connected = ui_fileset = false; - - /* start gtk */ - gtk_init(argc, argv); - - /* load glade gtk ui */ - ui_builder = gtk_builder_new(); - gtk_builder_add_from_file(ui_builder, "gbprog.ui", NULL); - - /* connect logger buffer (extern variable) */ - ui_logbuf = gtk_text_buffer_new(NULL); - logview = GTK_TEXT_VIEW(gtk_builder_get_object(ui_builder, "logview")); - - gtk_text_view_set_buffer(logview, ui_logbuf); - - /* connect objects to function calls */ - // window - window = GTK_WINDOW(gtk_builder_get_object(ui_builder, "window")); - g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL); - - // connectbtn - connectbtn = GTK_BUTTON(gtk_builder_get_object(ui_builder, "flashbtn")); - g_signal_connect(connectbtn, "clicked", - G_CALLBACK(ui_connect_clicked), NULL); - - // flashbtn - flashbtn = GTK_BUTTON(gtk_builder_get_object(ui_builder, "flashbtn")); - g_signal_connect(flashbtn, "clicked", G_CALLBACK(ui_flash_clicked), NULL); - - // file chooser - filechoosebtn = GTK_FILE_CHOOSER_BUTTON( - gtk_builder_get_object(ui_builder, "filechoosebtn")); - g_signal_connect(filechoosebtn, "file-set", G_CALLBACK(ui_file_set), NULL); - - /* start gtk window */ - gtk_main(); -} - -void ui_log(const char *msg, char type) -{ - GtkTextIter end; - gchar typech[4] = "[ ] "; - - switch (type) { - case 'm': typech[1] = '@'; break; // message - case 'w': typech[1] = '#'; break; // warning - case 'e': typech[1] = '!'; break; // error - } - - gtk_text_buffer_get_end_iter(ui_logbuf, &end); - gtk_text_buffer_insert(ui_logbuf, &end, typech, 4); - gtk_text_buffer_get_end_iter(ui_logbuf, &end); - gtk_text_buffer_insert(ui_logbuf, &end, (const gchar *) msg, strlen(msg)); -} - -void ui_file_set(GtkFileChooserButton *btn, gpointer user_data) -{ - GtkEntry *filepath = - GTK_ENTRY(gtk_builder_get_object(ui_builder, "filepath")); - - gtk_entry_set_text(filepath, - gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(btn))); - - ui_log("File set\n", 'm'); - ui_fileset = true; -} - -void ui_connect_clicked(void) -{ - -} - -void ui_flash_clicked(void) -{ - -} |