void ResourceConverterDialog::build_gui(Shortcuts & shortcuts)
{
    switch (resource_conversion_type) {
    case rctChapterStartsAtPatternVerseOneStartsAtChapterVerseStartsAtPattern:
    {
        build_button(image_open_file_ok, label_open_file_ok, label_open_file_short, button_open_file, _("Open"), shortcuts, G_CALLBACK(on_open_file_button_clicked), label_open_file_long);

        build_button(image_view_file_ok, label_view_file_ok, label_view_file_short, button_view_file_html, _("View"), shortcuts, G_CALLBACK(on_view_file_button_clicked), label_view_file_long);

        build_entry_combo_entry(image_chapter_pattern_ok, label_chapter_pattern_ok, label_chapter_pattern, label_chapter_pattern_1, entry_chapter_pattern_1, label_chapter_pattern_combo, combo_chapter_pattern, label_chapter_pattern_2, entry_chapter_pattern_2, G_CALLBACK(on_chapter_pattern_entry_changed), shortcuts);
        gtk_entry_set_text(GTK_ENTRY(entry_chapter_pattern_1), chapter_pattern_prefix.c_str());
        vector < ustring > chapters;
        chapters.push_back(integer_or_roman_sample(0));
        chapters.push_back(integer_or_roman_sample(1));
        combobox_set_strings(combo_chapter_pattern, chapters);
        combobox_set_index(combo_chapter_pattern, chapter_pattern_index);
        gtk_entry_set_text(GTK_ENTRY(entry_chapter_pattern_2), chapter_pattern_suffix.c_str());
        gtk_label_set_text(GTK_LABEL(label_chapter_pattern), _("Enter the text pattern to detect the chapter"));
        gtk_label_set_text(GTK_LABEL(label_chapter_pattern_1), _("Prefix"));
        gtk_label_set_text(GTK_LABEL(label_chapter_pattern_combo), _("Chapter number"));
        gtk_label_set_text(GTK_LABEL(label_chapter_pattern_2), _("Suffix"));

        build_entry_combo_entry(image_verse_pattern_ok, label_verse_pattern_ok, label_verse_pattern, label_verse_pattern_1, entry_verse_pattern_1, label_verse_pattern_combo, combo_verse_pattern, label_verse_pattern_2, entry_verse_pattern_2, G_CALLBACK(on_verse_pattern_entry_changed), shortcuts);
        gtk_entry_set_text(GTK_ENTRY(entry_verse_pattern_1), verse_pattern_prefix.c_str());
        vector < ustring > verses;
        verses.push_back(integer_or_roman_sample(0));
        verses.push_back(integer_or_roman_sample(1));
        combobox_set_strings(combo_verse_pattern, verses);
        combobox_set_index(combo_verse_pattern, verse_pattern_index);
        gtk_entry_set_text(GTK_ENTRY(entry_verse_pattern_2), verse_pattern_suffix.c_str());
        gtk_label_set_text(GTK_LABEL(label_verse_pattern), _("Enter the text pattern to detect the verse"));
        gtk_label_set_text(GTK_LABEL(label_verse_pattern_1), _("Prefix"));
        gtk_label_set_text(GTK_LABEL(label_verse_pattern_combo), _("Verse number"));
        gtk_label_set_text(GTK_LABEL(label_verse_pattern_2), _("Suffix"));

        build_button(image_write_anchors_ok, label_write_anchors_ok, label_write_anchors_short, button_write_anchors, _("Write"), shortcuts, G_CALLBACK(on_write_anchors_button_clicked), label_write_anchors_long);

        break;
    }
    case rctEnd:
    {
        break;
    }
    }
}
void ResourceConverterDialog::build_table_and_type(Shortcuts & shortcuts)
{
    // Destroy anything old.
    if (table1)
        gtk_widget_destroy(table1);

    // The table that contains the widgets.
    table1 = gtk_table_new(6, 4, FALSE);
    gtk_widget_show(table1);
    gtk_box_pack_start(GTK_BOX(dialog_vbox1), table1, TRUE, TRUE, 0);
    gtk_table_set_row_spacings(GTK_TABLE(table1), 3);
    gtk_table_set_col_spacings(GTK_TABLE(table1), 3);

    // Type of the resource.
    build_button(image_type_ok, label_type_ok, label_type_short, button_type, _("Type"), shortcuts, G_CALLBACK(on_type_button_clicked), label_type_long);
}
void MicroTheme::initialize()
{
//printf("MicroTheme::initialize 1\n");
	mwindow_icon = new VFrame(get_image("mwindow_icon.png"));
	vwindow_icon = new VFrame(get_image("mwindow_icon.png"));
	cwindow_icon = new VFrame(get_image("mwindow_icon.png"));
	awindow_icon = new VFrame(get_image("mwindow_icon.png"));
	record_icon = new VFrame(get_image("mwindow_icon.png"));
	clip_icon = new VFrame(get_image("clip_icon.png"));


	static VFrame *default_patchbay_bg = new VFrame(get_image("patchbay_bg.png"));

	BC_WindowBase::get_resources()->bg_color = WHITE;
	BC_WindowBase::get_resources()->menu_light = WHITE;
	BC_WindowBase::get_resources()->menu_highlighted = WHITE;
	BC_WindowBase::get_resources()->menu_down = LTGREY;
	BC_WindowBase::get_resources()->menu_up = WHITE;
	BC_WindowBase::get_resources()->menu_shadow = MEGREY;
	BC_WindowBase::get_resources()->medium_font = "-*-helvetica-medium-r-normal-*-10-*";
	
	static VFrame* default_listbox_bg = new VFrame(get_image("patchbay_bg.png"));
	BC_WindowBase::get_resources()->listbox_bg = default_listbox_bg;
	BC_WindowBase::get_resources()->button_light = WHITE;
	BC_WindowBase::get_resources()->button_up = WHITE;

	
	static VFrame *default_cancel_images[] = 
	{
		new VFrame(get_image("cancel_up.png")), new VFrame(get_image("cancel_hi.png")), new VFrame(get_image("cancel_dn.png"))
	};
	BC_WindowBase::get_resources()->cancel_images = default_cancel_images;

	static VFrame *default_ok_images[] = 
	{
		new VFrame(get_image("ok_up.png")), new VFrame(get_image("ok_hi.png")), new VFrame(get_image("ok_dn.png"))
	};
	BC_WindowBase::get_resources()->ok_images = default_ok_images;

	static VFrame *default_button_images[] = 
	{
		new VFrame(get_image("generic_up.png")), new VFrame(get_image("generic_hi.png")), new VFrame(get_image("generic_dn.png"))
	};
	BC_WindowBase::get_resources()->generic_button_images = default_button_images;

	static VFrame *default_tumble_images[] = 
	{
		new VFrame(get_image("tumble_up.png")), new VFrame(get_image("tumble_hi.png")), new VFrame(get_image("tumble_bottomdn.png")), new VFrame(get_image("tumble_topdn.png"))
	};
	BC_WindowBase::get_resources()->tumble_data = default_tumble_images;

	static VFrame *default_checkbox_images[] = 
	{
		new VFrame(get_image("checkbox_up.png")), new VFrame(get_image("checkbox_hi.png")), new VFrame(get_image("checkbox_checked.png")), new VFrame(get_image("checkbox_dn.png")), new VFrame(get_image("checkbox_checkedhi.png"))
	};
	BC_WindowBase::get_resources()->checkbox_images = default_checkbox_images;
	
	static VFrame *default_radial_images[] = 
	{
		new VFrame(get_image("radial_up.png")), new VFrame(get_image("radial_hi.png")), new VFrame(get_image("radial_checked.png")), new VFrame(get_image("radial_dn.png")), new VFrame(get_image("radial_checkedhi.png"))
	};
	BC_WindowBase::get_resources()->radial_images = default_radial_images;

	static VFrame* default_xmeter_data[] =
	{
		new VFrame(get_image("xmeter_normal.png")),
		new VFrame(get_image("xmeter_green.png")),
		new VFrame(get_image("xmeter_red.png")),
		new VFrame(get_image("xmeter_yellow.png")),
		new VFrame(get_image("over_horiz.png"))
	};

	static VFrame* default_ymeter_data[] =
	{
		new VFrame(get_image("ymeter_normal.png")),
		new VFrame(get_image("ymeter_green.png")),
		new VFrame(get_image("ymeter_red.png")),
		new VFrame(get_image("ymeter_yellow.png")),
		new VFrame(get_image("over_vert.png"))
	};
	BC_WindowBase::get_resources()->xmeter_images = default_xmeter_data;
	BC_WindowBase::get_resources()->ymeter_images = default_ymeter_data;
	BC_WindowBase::get_resources()->meter_font = SMALLFONT;
	BC_WindowBase::get_resources()->meter_font_color = BLACK;
	BC_WindowBase::get_resources()->meter_title_w = 25;
	BC_WindowBase::get_resources()->meter_3d = 0;

	static VFrame* default_pan_data[] = 
	{
		new VFrame(get_image("pan_up.png")), 
		new VFrame(get_image("pan_hi.png")), 
		new VFrame(get_image("pan_popup.png")), 
		new VFrame(get_image("pan_channel.png")), 
		new VFrame(get_image("pan_stick.png")), 
		new VFrame(get_image("pan_channel_small.png")), 
		new VFrame(get_image("pan_stick_small.png"))
	};
	BC_WindowBase::get_resources()->pan_data = default_pan_data;
	BC_WindowBase::get_resources()->pan_text_color = BLACK;

	static VFrame *default_hscroll_data[] = 
	{
		new VFrame(get_image("hscroll_handle_up.png")), 
		new VFrame(get_image("hscroll_handle_hi.png")), 
		new VFrame(get_image("hscroll_handle_dn.png")), 
		new VFrame(get_image("hscroll_handle_bg.png")), 
		new VFrame(get_image("hscroll_left_up.png")), 
		new VFrame(get_image("hscroll_left_hi.png")), 
		new VFrame(get_image("hscroll_left_dn.png")), 
		new VFrame(get_image("hscroll_right_up.png")), 
		new VFrame(get_image("hscroll_right_hi.png")), 
		new VFrame(get_image("hscroll_right_dn.png"))
	};
	static VFrame *default_vscroll_data[] = 
	{
		new VFrame(get_image("vscroll_handle_up.png")), 
		new VFrame(get_image("vscroll_handle_hi.png")), 
		new VFrame(get_image("vscroll_handle_dn.png")), 
		new VFrame(get_image("vscroll_handle_bg.png")), 
		new VFrame(get_image("vscroll_left_up.png")), 
		new VFrame(get_image("vscroll_left_hi.png")), 
		new VFrame(get_image("vscroll_left_dn.png")), 
		new VFrame(get_image("vscroll_right_up.png")), 
		new VFrame(get_image("vscroll_right_hi.png")), 
		new VFrame(get_image("vscroll_right_dn.png"))
	};
	BC_WindowBase::get_resources()->hscroll_data = default_hscroll_data;
	BC_WindowBase::get_resources()->vscroll_data = default_vscroll_data;

	channel_bg_data = new VFrame(get_image("channel_bg.png"));
	channel_position_data = new VFrame(get_image("channel_position.png"));
	channel_position_color = BLACK;
	recordgui_fixed_color = BLACK;
	recordgui_variable_color = RED;

	patchbay_bg = default_patchbay_bg;
	resource1024_bg_data = new VFrame(get_image("resource1024.png"));
	resource512_bg_data = new VFrame(get_image("resource512.png"));
	resource256_bg_data = new VFrame(get_image("resource256.png"));
	resource128_bg_data = new VFrame(get_image("resource128.png"));
	resource64_bg_data = new VFrame(get_image("resource64.png"));
	resource32_bg_data = new VFrame(get_image("resource32.png"));
	plugin_bg_data = new VFrame(get_image("plugin_bg.png"));
	title_bg_data = new VFrame(get_image("title_bg.png"));
	timebar_bg_data = new VFrame(get_image("timebar_bg.png"));
	vtimebar_bg_data = new VFrame(get_image("vwindow_timebar.png"));
	new_button("pane.png", "pane_up.png", "pane_hi.png", "pane_dn.png", "pane");

	keyframe_data = new VFrame(get_image("keyframe3.png"));
	camerakeyframe_data = new VFrame(get_image("camerakeyframe.png"));
	maskkeyframe_data = new VFrame(get_image("maskkeyframe.png"));
	modekeyframe_data = new VFrame(get_image("modekeyframe.png"));
	pankeyframe_data = new VFrame(get_image("pankeyframe.png"));
	projectorkeyframe_data = new VFrame(get_image("projectorkeyframe.png"));

	VFrame editpanel_up(get_image("editpanel_up.png"));
	VFrame editpanel_hi(get_image("editpanel_hi.png"));
	VFrame editpanel_dn(get_image("editpanel_dn.png"));
	VFrame editpanel_checked(get_image("editpanel_checked.png"));
	VFrame editpanel_checkedhi(get_image("editpanel_checkedhi.png"));

	static VFrame *default_inpoint[] = { new VFrame(get_image("out_up.png")), new VFrame(get_image("out_hi.png")), new VFrame(get_image("out_checked.png")), new VFrame(get_image("out_dn.png")), new VFrame(get_image("out_checkedhi.png")) };
	static VFrame *default_labeltoggle[] = { new VFrame(get_image("labeltoggle_up.png")), new VFrame(get_image("labeltoggle_uphi.png")), new VFrame(get_image("label_checked.png")), new VFrame(get_image("labeltoggle_dn.png")), new VFrame(get_image("label_checkedhi.png")) };
	static VFrame *default_outpoint[] = { new VFrame(get_image("in_up.png")), new VFrame(get_image("in_hi.png")), new VFrame(get_image("in_checked.png")), new VFrame(get_image("in_dn.png")), new VFrame(get_image("in_checkedhi.png")) };
	static VFrame *transport_bg[] = { new VFrame(get_image("transportup.png")), new VFrame(get_image("transporthi.png")), new VFrame(get_image("transportdn.png")) };
	static VFrame *patches_bg[] = { new VFrame(get_image("patches_up.png")), new VFrame(get_image("patches_hi.png")), new VFrame(get_image("patches_checked.png")), new VFrame(get_image("patches_dn.png")), new VFrame(get_image("patches_checkedhi.png")) };

	build_button(BC_WindowBase::get_resources()->filebox_updir_images, get_image("filebox_updir.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(BC_WindowBase::get_resources()->filebox_newfolder_images, get_image("filebox_newfolder.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(BC_WindowBase::get_resources()->filebox_icons_images, get_image("filebox_icons.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(BC_WindowBase::get_resources()->filebox_text_images, get_image("filebox_text.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);

	build_button(BC_WindowBase::get_resources()->listbox_button, get_image("listbox_button.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(bottom_justify, get_image("bottom_justify.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(center_justify, get_image("center_justify.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(copy_data, get_image("copy.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(cut_data, get_image("cut.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(fit_data, get_image("fit.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(in_data, get_image("outpoint.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(indelete_data, get_image("clearinpoint.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(labelbutton_data, get_image("label.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(left_justify, get_image("left_justify.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(magnify_button_data, get_image("magnify.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(middle_justify, get_image("middle_justify.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(nextlabel_data, get_image("nextlabel.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(out_data, get_image("inpoint.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(outdelete_data, get_image("clearoutpoint.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(over_button, get_image("over.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(overwrite_data, get_image("overwrite.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(paste_data, get_image("paste.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(prevlabel_data, get_image("prevlabel.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(redo_data, get_image("redo.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(right_justify, get_image("right_justify.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(splice_data, get_image("splice.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(statusbar_cancel_data, get_image("cancel_small.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(toclip_data, get_image("toclip.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(top_justify, get_image("top_justify.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(undo_data, get_image("undo.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_toggle(arrow_data, get_image("arrow.png"), &editpanel_up, &editpanel_hi, &editpanel_checked, &editpanel_dn, &editpanel_checkedhi);
	build_toggle(autokeyframe_data, get_image("autokeyframe.png"), &editpanel_up, &editpanel_hi, &editpanel_checked, &editpanel_dn, &editpanel_checkedhi);
	build_toggle(camera_data, get_image("camera.png"), &editpanel_up, &editpanel_hi, &editpanel_checked, &editpanel_dn, &editpanel_checkedhi);
	build_toggle(crop_data, get_image("crop.png"), &editpanel_up, &editpanel_hi, &editpanel_checked, &editpanel_dn, &editpanel_checkedhi);
	build_toggle(ibeam_data, get_image("ibeam.png"), &editpanel_up, &editpanel_hi, &editpanel_checked, &editpanel_dn, &editpanel_checkedhi);
	build_toggle(magnify_data, get_image("magnify.png"), &editpanel_up, &editpanel_hi, &editpanel_checked, &editpanel_dn, &editpanel_checkedhi);
	build_toggle(mask_data, get_image("mask.png"), &editpanel_up, &editpanel_hi, &editpanel_checked, &editpanel_dn, &editpanel_checkedhi);
	build_toggle(proj_data, get_image("projector.png"), &editpanel_up, &editpanel_hi, &editpanel_checked, &editpanel_dn, &editpanel_checkedhi);
	build_toggle(protect_data, get_image("protect.png"), &editpanel_up, &editpanel_hi, &editpanel_checked, &editpanel_dn, &editpanel_checkedhi);
	build_toggle(show_meters, get_image("show_meters.png"), &editpanel_up, &editpanel_hi, &editpanel_checked, &editpanel_dn, &editpanel_checkedhi);
	build_toggle(titlesafe_data, get_image("titlesafe.png"), &editpanel_up, &editpanel_hi, &editpanel_checked, &editpanel_dn, &editpanel_checkedhi);
	build_toggle(tool_data, get_image("toolwindow.png"), &editpanel_up, &editpanel_hi, &editpanel_checked, &editpanel_dn, &editpanel_checkedhi);
	build_transport(duplex_data, get_image("duplex.png"), transport_bg, 1);
	build_transport(end_data, get_image("end.png"), transport_bg, 2);
	build_transport(fastfwd_data, get_image("fastfwd.png"), transport_bg, 1);
	build_transport(fastrev_data, get_image("fastrev.png"), transport_bg, 1);
	build_transport(forward_data, get_image("play.png"), transport_bg, 1);
	build_transport(framefwd_data, get_image("framefwd.png"), transport_bg, 1);
	build_transport(framefwd_data, get_image("framefwd.png"), transport_bg, 1);
	build_transport(framerev_data, get_image("framerev.png"), transport_bg, 1);
	build_transport(rec_data, get_image("record.png"), transport_bg, 1);
	build_transport(recframe_data, get_image("singleframe.png"), transport_bg, 1);
	build_transport(reverse_data, get_image("reverse.png"), transport_bg, 1);
	build_transport(rewind_data, get_image("rewind.png"), transport_bg, 0);
	build_transport(stop_data, get_image("stop.png"), transport_bg, 1);
	build_transport(stoprec_data, get_image("stoprec.png"), transport_bg, 2);

	build_patches(playpatch_data, get_image("playpatch.png"), patches_bg, 0);
	build_patches(recordpatch_data, get_image("recordpatch.png"), patches_bg, 1);
	build_patches(gangpatch_data, get_image("gangpatch.png"), patches_bg, 1);
	build_patches(drawpatch_data, get_image("drawpatch.png"), patches_bg, 1);
	build_patches(mutepatch_data, get_image("mutepatch.png"), patches_bg, 2);

	static VFrame *default_expandpatch_data[] = 
	{
		new VFrame(get_image("expandpatch_up.png")), 
		new VFrame(get_image("expandpatch_hi.png")), 
		new VFrame(get_image("expandpatch_checked.png")), 
		new VFrame(get_image("expandpatch_dn.png")), 
		new VFrame(get_image("expandpatch_checkedhi.png"))
	};
	expandpatch_data = default_expandpatch_data;

	build_button(channel_data, get_image("channel.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	build_button(wrench_data, get_image("wrench.png"), &editpanel_up, &editpanel_hi, &editpanel_dn);
	in_point = default_inpoint;
	label_toggle = default_labeltoggle;
	out_point = default_outpoint;

	fade_h = BC_WindowBase::get_resources()->horizontal_slider_data[0]->get_h();
	mode_h = BC_WindowBase::get_resources()->generic_button_images[0]->get_h();
	meter_h = BC_WindowBase::get_resources()->xmeter_images[0]->get_h();
	pan_h = BC_WindowBase::get_resources()->pan_data[PAN_UP]->get_h();
	play_h = playpatch_data[0]->get_h();
	title_h = 18;
	pan_x = 25;

	title_font = MEDIUMFONT;
	title_color = BLACK;

	loadmode_w = 250;
	flush_images();
//printf("MicroTheme::initialize 2\n");
}