Esempio n. 1
0
static int console_update_callback (void *p)
{
    ExecState *state = (ExecState *) p;

#if CDEBUG
    fprintf(stderr, "*** console_update_callback\n");
#endif

    if (console_text == NULL) {
	return 1;
    } else {
	update_console(state, console_text); 
	return 0;
    }
}
Esempio n. 2
0
/*---------------------------------------------------------------------*/
void console( void )
{
    while( !init_cons ) {};

    get_timer( &l_time );

    draw_widget( &cons, true );

    s32 _i = 'Z';
    for( ; _i < 'c'/*_DEBUG_FONT_TBL_SIZE*/; ++_i ) {
        putc_console( _i );
        putc_console(' ');
        putn_console( _i );
        putc_console('\n');
    }

    for(;;) {
        update_console();
        draw_console();
    }
}
Esempio n. 3
0
void
update_ui(ui_t *ui, double dt)
{
    if (ui->console)
        update_console(ui->console, dt);
}
Esempio n. 4
0
void gretl_console (void)
{
    char cbuf[MAXLINE];
    windata_t *vwin;
    GtkTextBuffer *buf;
    GtkTextIter iter;
    ExecState *state;
    const gchar *intro = 
	N_("gretl console: type 'help' for a list of commands");

    if (console_main != NULL) {
	gtk_window_present(GTK_WINDOW(console_main));
	return;
    }

    state = gretl_console_init(cbuf);
    if (state == NULL) {
	return;
    }

    console_state = state;

    vwin = console_window(78, 400);

    console_text = vwin->text;
    console_main = vwin->main;

    g_signal_connect(G_OBJECT(vwin->text), "paste-clipboard",
		     G_CALLBACK(console_paste_handler), NULL);
    g_signal_connect(G_OBJECT(vwin->text), "button-press-event",
		     G_CALLBACK(console_click_handler), NULL);
    g_signal_connect(G_OBJECT(vwin->text), "button-release-event",
		     G_CALLBACK(console_mouse_handler), NULL);
    g_signal_connect(G_OBJECT(vwin->text), "key-press-event",
		     G_CALLBACK(console_key_handler), NULL);
    g_signal_connect(G_OBJECT(vwin->main), "destroy",
		     G_CALLBACK(console_quit), state);
    g_signal_connect(G_OBJECT(vwin->main), "destroy",
		     G_CALLBACK(gtk_widget_destroyed), 
		     &console_main);
    g_signal_connect(G_OBJECT(vwin->main), "destroy",
		     G_CALLBACK(gtk_widget_destroyed), 
		     &console_text);

    g_object_set_data(G_OBJECT(vwin->text), "ExecState", state);

    buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(vwin->text));
    gtk_text_buffer_get_start_iter(buf, &iter);  

    /* insert intro string and first prompt */
    gtk_text_buffer_insert(buf, &iter, _(intro), -1);
    console_insert_prompt(buf, &iter, "\n? ");

    gtk_widget_grab_focus(vwin->text);

    set_debug_read_func(console_get_line);
    set_debug_output_func(console_update_callback);

    /* console command loop */
    while (state->cmd->ci != QUIT) {
	console_get_line(state);
	if (state->cmd->ci != QUIT) {
	    update_console(state, vwin->text);
	}
    }

    if (console_main != NULL) {
	/* the user actually typed quit/exit */
	gtk_widget_destroy(vwin->main);
    }

    command_history_destroy();
    gretl_print_destroy(state->prn);
    free(state);  

    set_debug_read_func(NULL);
    set_debug_output_func(NULL);
    reset_console_globals();

#if CDEBUG
    fprintf(stderr, "gretl_console: returning\n");
#endif
}