Пример #1
0
// Main wnd by loading glade xml file or by executing glade generated code
gint display_main_wnd(void)
{
	GladeXML *xml;
	gchar *title;

	xml = glade_xml_new
		(tilp_paths_build_glade("calc-2.glade"), "calc_wnd",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed !\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	main_wnd = glade_xml_get_widget(xml, "calc_wnd");
	area = glade_xml_get_widget(xml, "drawingarea1");

	gtk_window_move(GTK_WINDOW(main_wnd), options3.calc.rect.x, options3.calc.rect.y);

	gtk_widget_realize(main_wnd);	// set drawing area valid

	// set window title (useful for TIGCC-IDE for instance)
	// Note: lpWindowName is "TiEmu (%s)" and lpClassName is "gdkWindowToplevel"
	title = g_strdup_printf("TiEmu (%s)", ti68k_calctype_to_string(tihw.calc_type));
	gtk_window_set_title(GTK_WINDOW(main_wnd), title);
	g_free(title);

	return 0;
}
Пример #2
0
/*
	Display registers window
*/
GtkWidget* dbgheap_create_window(void)
{
	GtkWidget *dbox;
    GtkWidget *data;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_heap-2.glade"), "dbgheap_window",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed !\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "dbgheap_window");
	gtk_window_set_transient_for(GTK_WINDOW(dbox), GTK_WINDOW(main_wnd));

	data = glade_xml_get_widget(xml, "treeview1");
    store = clist_create(data);
	clist_populate(store);

	gtk_tree_view_expand_all(GTK_TREE_VIEW(data));

	already_open = !0;

	return wnd = dbox;
}
Пример #3
0
/*
	Display registers window
*/
GtkWidget* dbgregs_create_window(void)
{
	GladeXML *xml = NULL;
	GtkWidget *dbox;
    GtkWidget *data;	
	
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_regs-2.glade"), "dbgregs_window",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed !\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "dbgregs_window");
	if(options3.transient)
		gtk_window_set_transient_for(GTK_WINDOW(dbox), GTK_WINDOW(main_wnd));

	data = glade_xml_get_widget(xml, "treeview1");
    store = ctree_create(data);
	ctree_populate(store);

	gtk_tree_view_expand_all(GTK_TREE_VIEW(data));

	return dbox;
}
Пример #4
0
/*
	Display registers window
*/
GtkWidget* display_dbgpclog_window(void)
{
	GladeXML *xml;
	GtkWidget *dbox;
    GtkWidget *data;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_pclog-2.glade"), "dbgpclog_window",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed !\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "dbgpclog_window");

	data = glade_xml_get_widget(xml, "treeview1");
    store = clist_create(data);
	clist_populate(store);

	gtk_tree_view_expand_all(GTK_TREE_VIEW(data));
	gtk_widget_show(data);

	gtk_window_resize(GTK_WINDOW(dbox), options3.pclog.w, options3.pclog.h);
	gtk_window_move(GTK_WINDOW(dbox), options3.pclog.x, options3.pclog.y);
    gtk_widget_show(GTK_WIDGET(dbox));

	already_open = !0;

	return dbox;
}
Пример #5
0
GtkWidget* dbgdock_create_window(void)
{
	GladeXML  *xml;
	GtkWidget *dbox;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_dock-2.glade"), "dbgdock_window",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed!\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);

	dbox = glade_xml_get_widget(xml, "dbgdock_window");
	if(options3.transient)
		gtk_window_set_transient_for(GTK_WINDOW(dbox), GTK_WINDOW(main_wnd));

	dbghb.stack = glade_xml_get_widget(xml, "frame1");
	dbghb.regs  = glade_xml_get_widget(xml, "frame2");
	dbghb.bkpts = glade_xml_get_widget(xml, "frame3");
	dbghb.code  = glade_xml_get_widget(xml, "frame4");
	dbghb.mem   = glade_xml_get_widget(xml, "frame5");
	dbghb.heap  = glade_xml_get_widget(xml, "frame6");

	// re-attach window childs to dock and destroy parent window
	gtk_widget_reparent_(dbghb.stack, dbgw.stack);
	gtk_widget_reparent_(dbghb.regs,  dbgw.regs);
	gtk_widget_reparent_(dbghb.bkpts, dbgw.bkpts);
	gtk_widget_reparent_(dbghb.code,  dbgw.code);
	gtk_widget_reparent_(dbghb.mem,   dbgw.mem);
	gtk_widget_reparent_(dbghb.heap,  dbgw.heap);

	// set them as 'open'
	options3.stack.closed = 0;
	options3.regs.closed = 0;
	options3.bkpts.closed = 0;
	options3.code.closed = 0;
	options3.mem.closed = 0;
	options3.heap.closed = 0;

	gtk_widget_destroy(dbgw.stack);
	dbgw.stack = NULL;
	gtk_widget_destroy(dbgw.regs);
	dbgw.regs = NULL;
	gtk_widget_destroy(dbgw.bkpts);
	dbgw.bkpts = NULL;
	gtk_widget_destroy(dbgw.mem);
	dbgw.mem = NULL;
	gtk_widget_destroy(dbgw.heap);
	dbgw.heap = NULL;
#if 0	// has to be fixed...
	gtk_widget_destroy(dbgw.code);
	dbgw.code = NULL;
#endif

	return dbox;
}
Пример #6
0
/*
	Display popup menu (right click)
*/
static GtkWidget* display_popup_menu(void)
{
	GladeXML *xml;
	GtkWidget *menu;

	xml = glade_xml_new
	    (tilp_paths_build_glade("dbg_regs-2.glade"), "dbgregs_popup",
	     PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed !\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);

	menu = glade_xml_get_widget(xml, "dbgregs_popup");
	return menu;
}
Пример #7
0
gint display_quicksend_dbox()
{
	GladeXML *xml;
	GtkWidget *dbox;
	GtkWidget *data;
	gint result;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("quicksend-2.glade"), 
		 "quicksend_dbox",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed!\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);

	dbox = glade_xml_get_widget(xml, "quicksend_dbox");

	tmp_enabled = options.qs_enabled;
	tmp_file = g_strdup(options.qs_file);

	fcb = glade_xml_get_widget(xml, "filechooserbutton1");
	gtk_widget_set_sensitive(fcb, tmp_enabled && tmp_file);
	if(tmp_file && strlen(tmp_file))
		gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(fcb), tmp_file);
	// filter wildcards to set
	//"*.89?;*.92?;*.9x?;*.9X?;*.v2?;*.V2?;*.tig"

	data = glade_xml_get_widget(xml, "checkbutton1");
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), tmp_enabled);
	
	result = gtk_dialog_run(GTK_DIALOG(dbox));
	switch (result) 
	{
	case GTK_RESPONSE_OK:
		options.qs_enabled = tmp_enabled;

		g_free(options.qs_file);
		options.qs_file = tmp_file;
		break;
	default:
		break;
	}

	gtk_widget_destroy(dbox);

	return 0;
}
Пример #8
0
gint dbgsr_display_dbox(void)
{
	GladeXML *xml;
	GtkWidget *dbox;
	gint result;
    gint i;
    gint ret = -1;

    // load GUI
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_regs-2.glade"), "dbgsr_window",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed !\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "dbgsr_window");

    // set initial states
    ti68k_register_get_sr(&tmp_sr);
    for(i = 0; i < 16; i++)
    {
        gchar *str = g_strdup_printf("checkbutton%i", i+1);
        btns[i] = glade_xml_get_widget(xml, str);
        g_free(str);

        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(btns[i]), 
                tmp_sr & (1 << i) ? TRUE : FALSE);
    }

	// run dialog
	result = gtk_dialog_run(GTK_DIALOG(dbox));
	switch (result) {
	case GTK_RESPONSE_OK:
        ti68k_register_set_sr(tmp_sr);
        ret = 0;
		break;
	default:
		break;
	}

	gtk_widget_destroy(dbox);

	return ret;
}
Пример #9
0
/* Create a window with 1 progress bar */
void create_pbar_type1(const gchar * title)
{
	GladeXML *xml;

	reset_counters();

	xml = glade_xml_new(tilp_paths_build_glade("pbars-2.glade"), "pbar1_dbox", PACKAGE);
	if (!xml)
		g_error("GUI loading failed !\n");
	glade_xml_signal_autoconnect(xml);

	window = glade_xml_get_widget(xml, "pbar1_dbox");
	gtk_window_set_title(GTK_WINDOW(window), title);

	pbar_wnd.pbar1 = glade_xml_get_widget(xml, "progressbar10");
	pbar_wnd.label_rate = glade_xml_get_widget(xml, "label11");

	gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_TYPE);
	gtk_widget_show_all(window);
}
Пример #10
0
/* Create a window with 1 label */
void create_pbar_type2(const gchar *title)
{
	GladeXML *xml;

	reset_counters();

	xml = glade_xml_new
	    (tilp_paths_build_glade("pbars-2.glade"), "pbar2_dbox",
	     PACKAGE);
	if (!xml)
		g_error("GUI loading failed !\n");
	glade_xml_signal_autoconnect(xml);

	pbar_window = glade_xml_get_widget(xml, "pbar2_dbox");
	gtk_window_set_title(GTK_WINDOW(pbar_window), title);

	p_win.label = glade_xml_get_widget(xml, "label20");

	gtk_widget_show_all(pbar_window);
}
Пример #11
0
/*
	Type address in a box.
*/
gint display_dbgmem_address(uint32_t *addr)
{
	GladeXML *xml;
	GtkWidget *dbox;
	GtkWidget *entry;
	gint result;
	gchar *str;
	gint ret = -1;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_mem-2.glade"), "dbgmem_address", PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed!\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	entry = glade_xml_get_widget(xml, "entry1");
	str = g_strdup_printf("0x%06x", *addr);
	gtk_entry_set_text(GTK_ENTRY(entry), str);
	g_free(str);

	gtk_editable_select_region(GTK_EDITABLE(entry), 0, -1);
	
	dbox = glade_xml_get_widget(xml, "dbgmem_address");	
	gtk_dialog_set_alternative_button_order(GTK_DIALOG(dbox), GTK_RESPONSE_OK,
	                                        GTK_RESPONSE_CANCEL,-1);
	result = gtk_dialog_run(GTK_DIALOG(dbox));
	
	switch (result) 
	{
	case GTK_RESPONSE_OK:
		str = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
		sscanf(str, "%x", addr);
		ret = 0;
		break;
	default:
		break;
	}

	gtk_widget_destroy(dbox);
	return ret;
}
Пример #12
0
/*
	Display source code window
*/
GtkWidget* display_dbgcode_window(void)
{
	GladeXML *xml;
	GtkWidget *dbox;
    GtkWidget *data;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_code-2.glade"), "dbgcode_window",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed !\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "dbgcode_window");

	tb.b1 = glade_xml_get_widget(xml, "button1");
	tb.b2 = glade_xml_get_widget(xml, "button2");
	tb.b3 = glade_xml_get_widget(xml, "button3");
	tb.b4 = glade_xml_get_widget(xml, "button4");
	tb.b5 = glade_xml_get_widget(xml, "button5");
	tb.b6 = glade_xml_get_widget(xml, "button6");
    list = glade_xml_get_widget(xml, "treeview1");

	data = glade_xml_get_widget(xml, "treeview1");
    store = clist_create(data);
	clist_populate(store, ti68k_debug_get_pc());

	gtk_tree_view_expand_all(GTK_TREE_VIEW(data));
	gtk_widget_show(data);

	gtk_window_resize(GTK_WINDOW(dbox), options3.code.w, options3.code.h);
	gtk_window_move(GTK_WINDOW(dbox), options3.code.x, options3.code.y);
    gtk_widget_show(GTK_WIDGET(dbox));

	already_open = !0;

	return dbox;
}
Пример #13
0
/*
	Display memory window
*/
GtkWidget* dbgmem_create_window(void)
{
	GladeXML *xml = NULL;
	GtkWidget *dbox;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_mem-2.glade"), "dbgmem_window",
		 PACKAGE);
	if (!xml)
		g_error("GUI loading failed !\n");
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "dbgmem_window");
	if(options3.transient)
		gtk_window_set_transient_for(GTK_WINDOW(dbox), GTK_WINDOW(main_wnd));

    notebook = glade_xml_get_widget(xml, "notebook1");
    gtk_notebook_popup_enable(GTK_NOTEBOOK(notebook));
    
	notebook_add_page(notebook, "0x000000");

	return dbox;
}
Пример #14
0
gint dbgentry_display_dbox(void)
{
	GladeXML *xml;
	GtkWidget *dbox;
	GtkWidget *data;
	gint result;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_entry-2.glade"), "dbgentry_dbox",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed!\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "dbgentry_dbox");
	//gtk_window_resize(GTK_WINDOW(dbox), 320, 240);
		
	data = glade_xml_get_widget(xml, "treeview1");
    ctree_create(data);
	ctree_populate(data);	
	
	result = gtk_dialog_run(GTK_DIALOG(dbox));
	switch (result) 
	{
	case GTK_RESPONSE_OK:
		ctree_get_selection();
		dbgbkpts_refresh_window();
		break;
	default:
		break;
	}

	gtk_widget_destroy(dbox);

	return 0;
}
Пример #15
0
gint display_dbgmem_search(uint32_t addr)
{
	GladeXML *xml;
	GtkWidget *dbox;
	GtkWidget *entry, *check1, *check2;
	gint result;
	gchar *str;
	gint ret = -1;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_mem-2.glade"), "dbgmem_search", PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed!\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
    if(old_str == NULL)
         old_str = g_strdup("");

	entry = glade_xml_get_widget(xml, "entry1");
	gtk_entry_set_text(GTK_ENTRY(entry), old_str);

    check1 = glade_xml_get_widget(xml, "checkbutton1");    
    check2 = glade_xml_get_widget(xml, "checkbutton2");
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check2), TRUE);

	dbox = glade_xml_get_widget(xml, "dbgmem_search");
	/* Find, Find Next, Cancel */
	gtk_dialog_set_alternative_button_order(GTK_DIALOG(dbox), GTK_RESPONSE_OK,
	                                        GTK_RESPONSE_APPLY, GTK_RESPONSE_CANCEL,-1);
	
    
    for(result = 0;;)
    {
        result = gtk_dialog_run(GTK_DIALOG(dbox));

        if((result == GTK_RESPONSE_CANCEL) || 
            (result == GTK_RESPONSE_DELETE_EVENT))
            break;

        if(result == GTK_RESPONSE_OK)
        {
            blk_adr = addr;	//0x000000;
            blk_len = 0;
        }

        //printf("searching at $%x\n", blk_adr);

        // find first/next
	    str = (gchar *)gtk_entry_get_text(GTK_ENTRY(entry));

        g_free(old_str);
        old_str = g_strdup(str);

        ascii = GTK_TOGGLE_BUTTON(check1)->active;
        casse = GTK_TOGGLE_BUTTON(check2)->active;

        gtk_widget_set_sensitive(entry, FALSE);
        while(gtk_events_pending()) gtk_main_iteration();

	    if(search_engine(old_str, ascii, casse, &blk_adr, &blk_len))
        {
            search_highlight(blk_adr, blk_adr + blk_len, !0);
            while(gtk_events_pending()) gtk_main_iteration();
        }

        gtk_widget_set_sensitive(entry, TRUE);
        while(gtk_events_pending()) gtk_main_iteration();

        blk_adr += blk_len;
        blk_adr &= 0xffffff;
	}

	gtk_widget_destroy(dbox);
	return ret;
}
Пример #16
0
gint display_release_dbox()
{
	GladeXML *xml;
	GtkWidget *dbox;
	GtkTextBuffer *txtbuf;
	GtkWidget *text;
	FILE *fd;
	gchar *filename;
	gchar buffer[65536];
	gint len = 0;
	struct stat stbuf;
	gint result;
	PangoFontDescription *font_desc;

#ifdef _MSC_VER /* MSVC builds. MinGW builds use Linux file structures. */
	filename = g_strconcat(inst_paths.base_dir, "Release.txt", NULL);

#else				/*  */
	filename = g_strconcat(inst_paths.base_dir, "RELEASE", NULL);
#endif				/*  */

	if (access(filename, F_OK) == 0) 
	{
		if (stat(filename, &stbuf) != -1) 
		{
			len = stbuf.st_size;
		}
		if ((fd = fopen(filename, "r")) != NULL) 
		{
			memset(buffer, 0, sizeof(buffer));
			len = fread(buffer, 1, len, fd);
			fclose(fd);
		}
	}

	xml = glade_xml_new(tilp_paths_build_glade("release-2.glade"), "release_dbox",
	     PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed!\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);

	dbox = glade_xml_get_widget(xml, "release_dbox");
	text = glade_xml_get_widget(xml, "textview1");

	// Change font
	font_desc = pango_font_description_from_string ("Courier");
	gtk_widget_modify_font (text, font_desc);
	pango_font_description_free (font_desc);

	// Set text
	txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
	gtk_text_buffer_set_text(txtbuf, buffer, len);

	result = gtk_dialog_run(GTK_DIALOG(dbox));
	switch (result) 
	{
	case GTK_RESPONSE_OK:
		break;
	default:
		break;
	}

	gtk_widget_destroy(dbox);
	return 0;
}
Пример #17
0
gint display_comm_dbox()
{
	GladeXML *xml;
	GtkWidget *dbox;
	GtkWidget *data;
	gint result;
	int err;

	init = !0;

	xml = glade_xml_new
	    (tilp_paths_build_glade("comm-2.glade"), "comm_dbox", PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed !\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);

	dbox = glade_xml_get_widget(xml, "comm_dbox");
	ad = 0; //options.auto_detect;

	// Auto-detect
	button = glade_xml_get_widget(xml, "checkbutton_calc_auto");
	if (ad)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),
					     TRUE);
	else
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),
					     FALSE);

	// Cable  
	data = glade_xml_get_widget(xml, "optionmenu_comm_cable");
	switch (link_cable.link_type) {
	case LINK_TGL:
		gtk_option_menu_set_history(GTK_OPTION_MENU(data), 0);
		break;
		
	case LINK_SER:
		gtk_option_menu_set_history(GTK_OPTION_MENU(data), 1);
		break;

	case LINK_SLV:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 2);
	  break;

	case LINK_PAR:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 3);
	  break;

	case LINK_VTI:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 4);
	  break;

    case LINK_TIE:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 5);
	  break;
	
	case LINK_VTL:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 6);
	  break;

    case LINK_NUL:
      gtk_option_menu_set_history(GTK_OPTION_MENU(data), 7);
	  break;

	default:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 7);
	  break;
	}

	// Port
	port = data = glade_xml_get_widget(xml, "optionmenu_comm_port");
	switch (link_cable.port) {
	case PARALLEL_PORT_1:
	case SERIAL_PORT_1:
	case USB_PORT_1:
	case VIRTUAL_PORT_1:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 1);
	  break;
	 
	case PARALLEL_PORT_2:
	case SERIAL_PORT_2:
	case USB_PORT_2:
	case VIRTUAL_PORT_2:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 2);
	  break;

	case PARALLEL_PORT_3:
	case SERIAL_PORT_3:
	case USB_PORT_3:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 3);
	  break;

	case SERIAL_PORT_4:
	case USB_PORT_4:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 4);
	  break;

    case NULL_PORT:
      gtk_option_menu_set_history(GTK_OPTION_MENU(data), 5);
	  break;
	  
	case USER_PORT:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 0);
	  break;

	default:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 0);
	  break;
	}

	// Calc
	data = glade_xml_get_widget(xml, "optionmenu_comm_calc");

	switch(tihw.calc_type) 
	{
    case TI92:  link_cable.calc_type = CALC_TI92;  break;
    case TI89:  link_cable.calc_type = CALC_TI89;  break;
    case TI92p: link_cable.calc_type = CALC_TI92P; break;
	case V200:	link_cable.calc_type = CALC_V200;  break;
    default: break;
    }

	switch (link_cable.calc_type) {
	case CALC_TI73:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 0);
	  break;
	  
	case CALC_TI82:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 1);
	  break;

	case CALC_TI83:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 2);
	  break;
	  
	case CALC_TI83P:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 3);
	  break;

	case CALC_TI84P:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 4);
	  break;
	  
	case CALC_TI85:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 5);
	  break;
	  
	case CALC_TI86:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 6);
	  break;
	  
	case CALC_TI89:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 7);
	  break;

	case CALC_TI89T:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 8);
	  break;
	  
	case CALC_TI92:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 9);
	  break;
	  
	case CALC_TI92P:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 10);
	  break;
	  
	case CALC_V200:
	  gtk_option_menu_set_history(GTK_OPTION_MENU(data), 11);
	  break;
	}

	// Timeout
	tmo = data = glade_xml_get_widget(xml, "spinbutton_comm_timeout");
	if(link_cable.link_type != LINK_NUL)	
		gtk_spin_button_set_value(GTK_SPIN_BUTTON(data), link_cable.timeout);
	else
		gtk_spin_button_set_value(GTK_SPIN_BUTTON(data), params.timeout);
	
	// Delay
	data = glade_xml_get_widget(xml, "spinbutton_comm_delay");
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(data), link_cable.delay);

	// Avoid early callbacks
	memcpy(&tmp_lp, &link_cable, sizeof(TicableLinkParam));
	
	// Loop
	init = 0;
 
	result = gtk_dialog_run(GTK_DIALOG(dbox));
	switch (result) {
	case GTK_RESPONSE_OK:
		tmp_lp.timeout = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(tmo));

        memcpy(&link_cable, &tmp_lp, sizeof(TicableLinkParam));
		if(link_cable.link_type == LINK_NUL)
			params.timeout = tmp_lp.timeout;
        err = ti68k_linkport_reconfigure();
		handle_error();
		break;
	case GTK_RESPONSE_HELP:
		break;
	default:
		break;
	}

	gtk_widget_destroy(dbox);

	return 0;
}
Пример #18
0
gint display_manpage_dbox()
{
	GladeXML *xml;
	GtkWidget *dbox;
	GtkTextBuffer *txtbuf;
	GtkWidget *text;
	FILE *fd;
	gchar *filename;
	gchar buffer[32768];
	gint len = 0;
	struct stat stbuf;
	gint result;
	PangoFontDescription *font_desc;

	filename =
	    g_strconcat(inst_paths.manpage_dir, "Manpage.txt", NULL);
	if (access(filename, F_OK) == 0) {
		if (stat(filename, &stbuf) != -1) {
			len = stbuf.st_size;
			len -= 2;
		}
		if ((fd = fopen(filename, "r")) != NULL) {
			memset(buffer, 0, sizeof(buffer));
			len = fread(buffer, 1, len, fd);
			fclose(fd);
		}
	}

	xml = glade_xml_new
	    (tilp_paths_build_glade("manpage-2.glade"), "manpage_dbox",
	     PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed!\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);

	dbox = glade_xml_get_widget(xml, "manpage_dbox");
	text = glade_xml_get_widget(xml, "textview1");

	// Change font
	font_desc = pango_font_description_from_string ("Courier");
	gtk_widget_modify_font (text, font_desc);
	pango_font_description_free (font_desc);

	// Set text
	txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
	gtk_text_buffer_set_text(txtbuf, buffer, len);

	while (gtk_events_pending())
		gtk_main_iteration();

	result = gtk_dialog_run(GTK_DIALOG(dbox));
	switch (result) {
	case GTK_RESPONSE_OK:
		break;
	default:
		break;
	}

	gtk_widget_destroy(dbox);

	return 0;
}
Пример #19
0
gint display_manpage_dbox()
{
	GladeXML *xml;
	GtkWidget *dbox;
	GtkTextBuffer *txtbuf;
	GtkWidget *text;
	FILE *fd;
	gchar *filename;
	gchar buffer[32768];
	gint len = 0;
	struct stat stbuf;
	gint result;
#if 0
	GtkTextIter start, end;
#endif

	filename =
	    g_strconcat(inst_paths.manpage_dir, "Manpage.txt", NULL);
	if (access(filename, F_OK) == 0) {
		if (stat(filename, &stbuf) != -1) {
			len = stbuf.st_size;
			len -= 2;
		}
		if ((fd = fopen(filename, "r")) != NULL) {
			memset(buffer, 0, sizeof(buffer));
			len = fread(buffer, 1, len, fd);
			fclose(fd);
		}
	}

	xml = glade_xml_new
	    (tilp_paths_build_glade("manpage-2.glade"), "manpage_dbox",
	     PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed !\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);

	dbox = glade_xml_get_widget(xml, "manpage_dbox");
	text = glade_xml_get_widget(xml, "textview1");
	txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
#if 0
	gtk_text_buffer_get_bounds(txtbuf, &start, &end);
	gtk_text_buffer_delete(txtbuf, &start, &end);
	gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text), 15);
#endif
	gtk_text_buffer_set_text(txtbuf, buffer, len);
	gtk_widget_realize(dbox);
	gtk_widget_show(dbox);
	//gtk_window_resize(GTK_WINDOW(dbox), 640, 480);

	while (gtk_events_pending())
		gtk_main_iteration();

	result = gtk_dialog_run(GTK_DIALOG(dbox));
	switch (result) {
	case GTK_RESPONSE_OK:
		break;
	default:
		break;
	}

	gtk_widget_destroy(dbox);

	return 0;
}
Пример #20
0
gint display_infos_dbox()
{
	GladeXML *xml;
	GtkWidget *dbox;
	GtkWidget *label;
	gint result;
	gchar *str;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("infos-2.glade"), "infos_dbox",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed!\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "infos_dbox");

	label = glade_xml_get_widget(xml, "label20");
	switch(skin_infos.type)
	{
	case SKIN_TYPE_TIEMU:	str = g_strdup_printf("%s", "TiEmu v2.00"); break;
	case SKIN_TYPE_VTI:		str = g_strdup_printf("%s", "VTi 2.5"); break;
	case SKIN_TYPE_OLD_VTI:	str = g_strdup_printf("%s", "VTi 2.1"); break;
	default:				str = g_strdup_printf("%s", _("unknown")); break;
	}	
	gtk_label_set_text(GTK_LABEL(label), str);
	g_free(str);
	
	label = glade_xml_get_widget(xml, "label21");
	str = g_strdup_printf("%s", skin_infos.name);
	gtk_label_set_text(GTK_LABEL(label), str);
	g_free(str);
	
	label = glade_xml_get_widget(xml, "label22");
	if(skin_infos.author)
	    str = g_strdup_printf("%s", skin_infos.author);
	else
	    str = g_strdup("");
	gtk_label_set_text(GTK_LABEL(label), str);
	g_free(str);
	
	label = glade_xml_get_widget(xml, "label23");
	str = g_strdup_printf("%s", ti68k_calctype_to_string(tihw.calc_type));
	gtk_label_set_text(GTK_LABEL(label), str);
	g_free(str);
	
	label = glade_xml_get_widget(xml, "label24");
	str = g_strdup_printf("%s", tihw.rom_version);
	gtk_label_set_text(GTK_LABEL(label), str);
	g_free(str);
	
	label = glade_xml_get_widget(xml, "label25");
	str = g_strdup_printf("%i KB", tihw.ram_size >> 10);
	gtk_label_set_text(GTK_LABEL(label), str);
	g_free(str);
	
	label = glade_xml_get_widget(xml, "label26");
	str = g_strdup_printf("%i KB", tihw.rom_size >> 10);
	gtk_label_set_text(GTK_LABEL(label), str);
	g_free(str);
	
	label = glade_xml_get_widget(xml, "label27");
	str = g_strdup_printf("%s", ti68k_romtype_to_string(tihw.rom_flash));
	gtk_label_set_text(GTK_LABEL(label), str);
	g_free(str);

	label = glade_xml_get_widget(xml, "label28");
	str = g_strdup_printf("%s", ti68k_hwtype_to_string(tihw.hw_type));
	gtk_label_set_text(GTK_LABEL(label), str);
	g_free(str);
	
	result = gtk_dialog_run(GTK_DIALOG(dbox));
	switch (result) {
	case GTK_RESPONSE_OK:
		break;
	default:
		break;
	}

	gtk_widget_destroy(dbox);

	return 0;
}
Пример #21
0
gint dbgcause1_display_dbox()
{
	GladeXML *xml;
	GtkWidget *dbox;
	GtkWidget *label;
	gint result;
	gchar *str;
	gint type, id, mode;
	uint32_t value, min, max;

    // get context
	ti68k_bkpt_get_cause(&type, &mode, &id);
    if(!type && !mode)
        return 0;
	
    // load GUI
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_cause-2.glade"), "dbgcause1_dbox",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed !\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "dbgcause1_dbox");

	// set PC
	label = glade_xml_get_widget(xml, "label21");
	ti68k_register_get_pc(&value);
	str = g_strdup_printf("0x%06x", value);
	gtk_label_set_text(GTK_LABEL(label), str);
	g_free(str);

	// set type
	label = glade_xml_get_widget(xml, "label22");
	str = g_strdup_printf("%s", ti68k_bkpt_type_to_string(type));
	gtk_label_set_text(GTK_LABEL(label), str);
	g_free(str);

	// set mode
	label = glade_xml_get_widget(xml, "label23");
	str = g_strdup_printf("%s", ti68k_bkpt_mode_to_string(type, mode));
	gtk_label_set_text(GTK_LABEL(label), str);
	g_free(str);

	// set id
	label = glade_xml_get_widget(xml, "label24");
	str = g_strdup_printf("%i", id);
	gtk_label_set_text(GTK_LABEL(label), str);
	g_free(str);

	// set target
	label = glade_xml_get_widget(xml, "label25");
	switch(type)
	{
	case BK_TYPE_ACCESS:
		ti68k_bkpt_get_access(id, &min, mode);
		str = g_strdup_printf("0x%06x", min);
		break;
	case BK_TYPE_RANGE:
		ti68k_bkpt_get_range(id, &min, &max, mode);
		str = g_strdup_printf("0x%06x-0x%06x", min, max);
		break;
	default:
		str = g_strdup("n/a");
		break;
	}
	gtk_label_set_text(GTK_LABEL(label), str);
	g_free(str);
	
	result = gtk_dialog_run(GTK_DIALOG(dbox));
	switch (result) {
	case GTK_RESPONSE_OK:
		break;
	default:
		break;
	}

	gtk_widget_destroy(dbox);

	return 0;
}
Пример #22
0
gint dbgcause2_display_dbox()
{
	GladeXML *xml;
	GtkWidget *dbox;
	GtkWidget *label;
	gint result;
	gchar *str;
	gint type, id, mode;
	uint32_t sp;
	uint32_t pc;
	uint32_t sr;

    // get context
	ti68k_bkpt_get_cause(&type, &mode, &id);
    if(!type && !mode && !id)
        return 0;
	
    // load GUI
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_cause-2.glade"), "dbgcause2_dbox",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed !\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "dbgcause2_dbox");

	// set exception type
	label = glade_xml_get_widget(xml, "label41");
	gtk_label_set_text(GTK_LABEL(label), ti68k_exception_to_string(mode));

	// set id
	label = glade_xml_get_widget(xml, "label42");
	str = g_strdup_printf("%i", id);
	gtk_label_set_text(GTK_LABEL(label), str);
	g_free(str);

	// set pushed PC
	ti68k_register_get_sp(&sp);
	sr = mem_rd_long(sp);
	str = g_strdup_printf("%04x", sr);
	label = glade_xml_get_widget(xml, "label43");
	gtk_label_set_text(GTK_LABEL(label), str);
	g_free(str);

	// set pushed SR
	ti68k_register_get_sp(&sp);
	pc = mem_rd_long(sp+2);
	str = g_strdup_printf("%06x", pc);
	label = glade_xml_get_widget(xml, "label44");
	gtk_label_set_text(GTK_LABEL(label), str);
	g_free(str);
	
	result = gtk_dialog_run(GTK_DIALOG(dbox));
	switch (result) {
	case GTK_RESPONSE_OK:
		break;
	default:
		break;
	}

	gtk_widget_destroy(dbox);

	return 0;
}
Пример #23
0
gint display_scroptions_dbox()
{
	GladeXML *xml;
	GtkWidget *dbox;
	GtkWidget *data;
	gint result;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("scroptions-2.glade"), 
		 "scroptions_dbox",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed!\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "scroptions_dbox");
	gtk_dialog_set_alternative_button_order(GTK_DIALOG(dbox), GTK_RESPONSE_OK,
	                                        GTK_RESPONSE_CANCEL,-1);
	memcpy(&tmp_options, &options2, sizeof(ScrOptions));
    tmp_options.file = g_strdup(options2.file);
	tmp_options.folder = g_strdup(options2.folder);

	frame = glade_xml_get_widget(xml, "frame5");
	gtk_widget_set_sensitive(frame, tmp_options.size == IMG_LCD);

	switch (tmp_options.format)
	{
	case IMG_JPG: 
		data = glade_xml_get_widget(xml, "radiobutton30");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	case IMG_PNG: 
		data = glade_xml_get_widget(xml, "radiobutton31");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	case IMG_ICO: 
		data = glade_xml_get_widget(xml, "radiobutton32");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break; 
	case IMG_EPS:
		data = glade_xml_get_widget(xml, "radiobutton33");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	case IMG_PDF:
		data = glade_xml_get_widget(xml, "radiobutton34");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	case IMG_BMP:
		data = glade_xml_get_widget(xml, "radiobutton35");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	}

	switch (tmp_options.type)
	{
	case IMG_BW:
		data = glade_xml_get_widget(xml, "radiobutton10");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	case IMG_COL:
		data = glade_xml_get_widget(xml, "radiobutton11");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	}

	switch (tmp_options.size)
	{
	case IMG_LCD:
		data = glade_xml_get_widget(xml, "radiobutton20");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	case IMG_SKIN:
		data = glade_xml_get_widget(xml, "radiobutton21");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	}

	data = glade_xml_get_widget(xml, "spinbutton1");
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(data), tmp_options.shots);

	data = glade_xml_get_widget(xml, "spinbutton2");
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(data), tmp_options.skips);

	label = glade_xml_get_widget(xml, "label10");
	refresh_label();
		
	data = glade_xml_get_widget(xml, "entry10");
	gtk_entry_set_text(GTK_ENTRY(data), tmp_options.file);

	data = glade_xml_get_widget(xml, "filechooserbutton1");
	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (data), tmp_options.folder);
	
	result = gtk_dialog_run(GTK_DIALOG(dbox));
	switch (result) {
	case GTK_RESPONSE_OK:
        g_free(options2.file);
		g_free(options2.folder);

		memcpy(&options2, &tmp_options, sizeof(ScrOptions));

		options2.file = g_strdup(tmp_options.file);
        g_free(tmp_options.file);

		options2.folder = g_strdup(tmp_options.folder);
		g_free(tmp_options.folder);
		break;
	default:
		break;
	}

	frame = label = NULL;
	gtk_widget_destroy(dbox);

	return 0;
}
Пример #24
0
gint dbgdata_display_dbox(gint *mode, gint *type, uint32_t *start, uint32_t *stop)
{
	GtkWidget *dbox;
	GtkWidget *data;
	gint result;

	G_CONST_RETURN gchar *sc_start, *sc_stop;
	gchar *s_start, *s_stop;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_data-2.glade"), "dbgdata_dbox",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed!\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "dbgdata_dbox");
	gtk_dialog_set_alternative_button_order(GTK_DIALOG(dbox), GTK_RESPONSE_OK,
	                                        GTK_RESPONSE_CANCEL,-1);

	data = glade_xml_get_widget(xml, "radiobutton20");
	g_signal_emit_by_name(G_OBJECT(data), "toggled");

	// set type
	if(*type == -1)
	{
		// skip box preset step
	}
	else 
	{
		data = glade_xml_get_widget(xml, "radiobutton10");
		if(*mode & BK_READ)
			gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);

		data = glade_xml_get_widget(xml, "radiobutton11");
		if(*mode & BK_WRITE)
			gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);

		data = glade_xml_get_widget(xml, "radiobutton12");
		if((*mode & BK_READ) && (*mode & BK_WRITE))
			gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);

		if(*type == BK_TYPE_ACCESS)
		{
			data = glade_xml_get_widget(xml, "radiobutton20");
			gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);

			data = glade_xml_get_widget(xml, "comboboxentry1");
			if(*mode & BK_BYTE)
				gtk_combo_box_set_active(GTK_COMBO_BOX(data), 0);
			else if(*mode & BK_WORD)
				gtk_combo_box_set_active(GTK_COMBO_BOX(data), 1);
			else if(*mode & BK_LONG)
				gtk_combo_box_set_active(GTK_COMBO_BOX(data), 2);

			data = glade_xml_get_widget(xml, "entry3");
			s_start = g_strdup_printf("0x%06x", *start);
			gtk_entry_set_text(GTK_ENTRY(data), s_start);
			g_free(s_start);
		}
		else if(*type == BK_TYPE_RANGE)
		{
			data = glade_xml_get_widget(xml, "radiobutton21");
			gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);

			data = glade_xml_get_widget(xml, "entry1");
			s_start = g_strdup_printf("0x%06x", *start);
			gtk_entry_set_text(GTK_ENTRY(data), s_start);
			g_free(s_start);

			data = glade_xml_get_widget(xml, "entry2");
			s_stop = g_strdup_printf("0x%06x", *stop);
			gtk_entry_set_text(GTK_ENTRY(data), s_stop);
			g_free(s_stop);
		}
	}

loop:
	result = gtk_dialog_run(GTK_DIALOG(dbox));
	switch (result) {
	case GTK_RESPONSE_OK:
		sc_start = sc_stop = "";

		// Retrieve settings from fields
		data = glade_xml_get_widget(xml, "radiobutton10");
		if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data)))
			*mode = BK_READ;
		data = glade_xml_get_widget(xml, "radiobutton11");
		if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data)))
			*mode = BK_WRITE;
		data = glade_xml_get_widget(xml, "radiobutton12");
		if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data)))
			*mode = BK_READ | BK_WRITE;

		data = glade_xml_get_widget(xml, "radiobutton20");
		if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data)))
			*type = BK_TYPE_ACCESS;

		data = glade_xml_get_widget(xml, "radiobutton21");
		if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data)))
			*type = BK_TYPE_RANGE;
	
		if(*type == BK_TYPE_ACCESS)
		{
			data = glade_xml_get_widget(xml, "comboboxentry1");
			switch(gtk_combo_box_get_active(GTK_COMBO_BOX(data)))
			{
			case 0: *mode |= BK_BYTE; break;
			case 1: *mode |= BK_WORD; break;
			case 2: *mode |= BK_LONG; break;
			}

			data = glade_xml_get_widget(xml, "entry3");
			sc_start = sc_stop = gtk_entry_get_text(GTK_ENTRY(data));
		} 
		else if(*type == BK_TYPE_RANGE)
		{
			data = glade_xml_get_widget(xml, "entry1");
			sc_start = gtk_entry_get_text(GTK_ENTRY(data));

			data = glade_xml_get_widget(xml, "entry2");
			sc_stop = gtk_entry_get_text(GTK_ENTRY(data));			
		}

		// Convert values and check
		result = sscanf(sc_start, "%x", start);
		if(result < 1)
			goto loop;

		result = sscanf(sc_stop, "%x", stop);
		if((result < 1) && (*type == 2))
			goto loop;

		if((*start > *stop) && (*type == 2))
			goto loop;

		gtk_widget_destroy(dbox);
		return 0;
	default:
		gtk_widget_destroy(dbox);
		return -1;
	}	

	return 0;
}
Пример #25
0
gint display_device_dbox()
{
	GladeXML *xml;
	GtkWidget *dbox;
	GtkWidget *data;
	gint result;
	int err;

	xml = glade_xml_new(tilp_paths_build_glade("device-2.glade"), "device_dbox", PACKAGE);
	if (!xml)
		g_error(_("comm.c: GUI loading failed !\n"));
	glade_xml_signal_autoconnect(xml);

	dbox = glade_xml_get_widget(xml, "device_dbox");
	gtk_dialog_set_alternative_button_order(GTK_DIALOG(dbox), GTK_RESPONSE_OK,
	                                        GTK_RESPONSE_CANCEL,-1);

	lbl = glade_xml_get_widget(xml, "label7");

	// Cable  
	data = comm_cable = glade_xml_get_widget(xml, "combobox1");
	switch (linkp.cable_model) 
	{
	case CABLE_NUL:
		gtk_combo_box_set_active(GTK_COMBO_BOX(data), 0);
	break;

	case CABLE_GRY:
		gtk_combo_box_set_active(GTK_COMBO_BOX(data), 1);
	break;
		
	case CABLE_BLK:
		gtk_combo_box_set_active(GTK_COMBO_BOX(data), 2);
	break;

	case CABLE_PAR:
		gtk_combo_box_set_active(GTK_COMBO_BOX(data), 3);
	break;

	case CABLE_SLV:
		gtk_combo_box_set_active(GTK_COMBO_BOX(data), 4);
	break;	

	case CABLE_USB:
		gtk_combo_box_set_active(GTK_COMBO_BOX(data), 5);
	break;	

	case CABLE_VTI:
		gtk_combo_box_set_active(GTK_COMBO_BOX(data), 6);
	break;

    case CABLE_TIE:
		gtk_combo_box_set_active(GTK_COMBO_BOX(data), 7);
	break;
	
	case CABLE_ILP:
		gtk_combo_box_set_active(GTK_COMBO_BOX(data), 8);
	break;

	default:
		gtk_combo_box_set_active(GTK_COMBO_BOX(data), 0);
	break;
	}

	// Port
	data = comm_port = glade_xml_get_widget(xml, "combobox2");
	switch (linkp.cable_port) 
	{
	case PORT_0:
		gtk_combo_box_set_active(GTK_COMBO_BOX(data), 0);
	break;
	case PORT_1:
		gtk_combo_box_set_active(GTK_COMBO_BOX(data), 1);
	break;
	case PORT_2:
		gtk_combo_box_set_active(GTK_COMBO_BOX(data), 2);
	break;
	case PORT_3:
		gtk_combo_box_set_active(GTK_COMBO_BOX(data), 3);
	break;
	case PORT_4:
		gtk_combo_box_set_active(GTK_COMBO_BOX(data), 4);
	break;
	}

	// Timeout
	data = glade_xml_get_widget(xml, "spinbutton_comm_timeout");
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(data), linkp.cable_timeout);
	
	// Delay
	data = glade_xml_get_widget(xml, "spinbutton_comm_delay");
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(data), linkp.cable_delay);

	// Data exchange
	memcpy(&tmp, &linkp, sizeof(DeviceOptions));
	memcpy(&old, &linkp, sizeof(DeviceOptions));
	
	// Loop
	result = gtk_dialog_run(GTK_DIALOG(dbox));
	switch (result) 
	{
	case GTK_RESPONSE_CANCEL:
		break;
	case GTK_RESPONSE_OK:
		ti68k_linkport_unconfigure();

		data = glade_xml_get_widget(xml, "spinbutton_comm_delay");
		tmp.cable_delay = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(data));

		data = glade_xml_get_widget(xml, "spinbutton_comm_timeout");
		tmp.cable_timeout =	gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(data));

		memcpy(&linkp, &tmp, sizeof(DeviceOptions));
		tmp.calc_model = ti68k_calc_to_libti_calc();

        err = ti68k_linkport_reconfigure();
		if(err)
		{
			// if reconfiguring fails, fallback to null cable & port
			ti68k_linkport_unconfigure();

			memcpy(&linkp, &old, sizeof(DeviceOptions));
			tmp.calc_model = ti68k_calc_to_libti_calc();

			ti68k_linkport_reconfigure();
		}
		break;
	case GTK_RESPONSE_HELP:
		break;
	default:
		break;
	}
	gtk_widget_destroy(dbox);
	return 0;
}
Пример #26
0
gint display_romversion_dbox(gboolean file_only)
{
    GladeXML *xml;
	GtkWidget *data;
    gint result;
    GtkListStore *store;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("romversion-2.glade"), "romversion_dbox",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed!\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);

    // display list box
	dbox = glade_xml_get_widget(xml, "romversion_dbox");
	gtk_dialog_set_alternative_button_order(GTK_DIALOG(dbox), GTK_RESPONSE_OK,
	                                        GTK_RESPONSE_CANCEL,-1);
    
    data = glade_xml_get_widget(xml, "clist1");
    store = clist_create(data);
	clist_populate(store);
    
	// run main box
	gtk_dialog_set_response_sensitive(GTK_DIALOG(dbox), GTK_RESPONSE_OK, FALSE);
	result = gtk_dialog_run(GTK_DIALOG(dbox));
	gtk_widget_destroy(dbox);

	switch (result) 
	{
		case GTK_RESPONSE_OK:
            if(chosen_file == NULL)
                break;

			if(!ti68k_is_a_img_file(chosen_file))
				break;

            // Remove previous tib file
            g_free(params.tib_file);
			params.tib_file = g_strconcat("", NULL);

            // Set new image
			g_free(params.rom_file);
			params.rom_file = g_strconcat(inst_paths.img_dir, chosen_file, NULL);
			g_free(chosen_file);
            chosen_file = NULL;

            if(file_only) return 0;

            // Restart engine by exiting the GTK loop
			g_free(params.sav_file);
			params.sav_file = g_strdup("");

			while(gtk_events_pending()) gtk_main_iteration();
			gtk_main_quit();	
		break;
		
		default:
            if(file_only) return -1;
		break;
	}

	return 0;
}
Пример #27
0
gint display_scroptions_dbox()
{
	GladeXML *xml;
	GtkWidget *dbox;
	GtkWidget *data;
	gint result;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("scroptions-2.glade"), 
		 "scroptions_dbox",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed !\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "scroptions_dbox");
	memcpy(&tmp_options, &options2, sizeof(ScrOptions));
    tmp_options.file = g_strdup(options2.file);
	
	switch (tmp_options.format)
	{
	case IMG_JPG: 
		data = glade_xml_get_widget(xml, "radiobutton30");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	case IMG_PNG: 
		data = glade_xml_get_widget(xml, "radiobutton31");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	case IMG_ICO: 
		data = glade_xml_get_widget(xml, "radiobutton32");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break; 
	case IMG_EPS:
		data = glade_xml_get_widget(xml, "radiobutton33");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	case IMG_PDF:
		data = glade_xml_get_widget(xml, "radiobutton34");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	}

	switch (tmp_options.type)
	{
	case IMG_BW:
		data = glade_xml_get_widget(xml, "radiobutton10");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	case IMG_COL:
		data = glade_xml_get_widget(xml, "radiobutton11");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	}

	switch (tmp_options.size)
	{
	case IMG_LCD:
		data = glade_xml_get_widget(xml, "radiobutton20");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	case IMG_SKIN:
		data = glade_xml_get_widget(xml, "radiobutton21");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	}

	label = glade_xml_get_widget(xml, "label10");
	refresh_label();
		
	data = glade_xml_get_widget(xml, "entry10");
	gtk_entry_set_text(GTK_ENTRY(data), tmp_options.file);
	
	result = gtk_dialog_run(GTK_DIALOG(dbox));
	switch (result) {
	case GTK_RESPONSE_OK:
        g_free(options2.file);
		memcpy(&options2, &tmp_options, sizeof(ScrOptions));
		options2.file = g_strdup(tmp_options.file);
        g_free(tmp_options.file);
		break;
	default:
		break;
	}

	gtk_widget_destroy(dbox);

	return 0;
}
Пример #28
0
gint display_loglink_dbox()
{
    GladeXML *xml;
    GtkWidget *dbox;
    GtkWidget *text;
    gpointer data, data2;
    int i, j;

    xml = glade_xml_new
          (tilp_paths_build_glade("log_link-2.glade"), "linklog_dbox", PACKAGE);
    if (!xml)
        g_error(_("%s: GUI loading failed!\n"), __FILE__);
    glade_xml_signal_autoconnect(xml);

    text = glade_xml_get_widget(xml, "textview1");
    txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));

    data = glade_xml_get_widget(xml, "spinbutton1");
    gtk_spin_button_set_value(GTK_SPIN_BUTTON(data), logger.link_size >> 10);

    data = glade_xml_get_widget(xml, "checkbutton1");
    gtk_toggle_button_set_active(data, logger.link_mask & 1);

    data = glade_xml_get_widget(xml, "checkbutton2");
    gtk_toggle_button_set_active(data, logger.link_mask & 2);

    data = glade_xml_get_widget(xml, "button10");
    data2 = glade_xml_get_widget(xml, "spinbutton1");
    udpate_widgets(data, data2);

    if(logger.link_buf)
    {
        int old_flags;
        char *str;
        char *tmp;
        int meaningful_length;
        int offset;

        if (logger.link_ptr <= logger.link_size)
        {
            // No data of the circular buffer was overwritten.
            meaningful_length = logger.link_ptr;
            offset = 0;
        }
        else
        {
            // Some data of the circular buffer was overwritten:
            // * show only the meaningful part of it;
            // * prevent reading past the bounds of logger.link_buf.
            meaningful_length = logger.link_size;
            offset = logger.link_ptr % logger.link_size;
        }

        old_flags = MSB((logger.link_buf)[offset]);

        if((logger.link_buf)[offset] & (1 << 8))
            str = g_strdup("S: ");
        else
            str = g_strdup("R: ");


        for(i = j = 0; i < meaningful_length; i++)
        {
            uint16_t word = (logger.link_buf)[(i + offset) % logger.link_size];
            uint8_t byte = LSB(word);
            uint8_t flags = MSB(word);
            int s = flags & 1;
            int r = flags & 2;

            if(flags != old_flags)
            {
                old_flags = flags;

                tmp = g_strdup_printf("(%i bytes)\n", j);
                str = g_strconcat(str, tmp, NULL);
                g_free(tmp);
                gtk_text_buffer_insert_at_cursor(txtbuf, str, strlen(str));

                j = 0;
                g_free(str);
                str = g_strdup_printf("%c: ", s ? 'S' : 'R');

            }

            // Wrap every 16 characters.
            if((i != 0) && !(i & 15))
            {
                tmp = g_strdup("\n");
                str = g_strconcat(str, tmp, NULL);
                gtk_text_buffer_insert_at_cursor(txtbuf, str, strlen(str));
                g_free(str);
                str = g_strdup("   ");
            }

            tmp = g_strdup_printf("%02X ", byte);
            str = g_strconcat(str, tmp, NULL);
            g_free(tmp);
            j++;
        }

        tmp = g_strdup_printf("(%i bytes)\n", j);
        str = g_strconcat(str, tmp, NULL);
        gtk_text_buffer_insert_at_cursor(txtbuf, str, strlen(str));

        g_free(str);
    }

    dbox = glade_xml_get_widget(xml, "linklog_dbox");
    gtk_widget_show(dbox);

    return 0;
}