void DefaultTheme::draw_mwindow_bg(MWindowGUI *gui)
{
// Button bar
	gui->draw_3segmenth(mbuttons_x, 
		mbuttons_y, 
		750, 
		mbutton_left);
	gui->draw_3segmenth(mbuttons_x + 750, 
		mbuttons_y, 
		mbuttons_w - 500, 
		mbutton_right);

// Clock
	gui->draw_3segmenth(0, 
		mbuttons_y + mbutton_left->get_h(),
		get_image("patchbay_bg")->get_w(), 
		get_image("clock_bg"));

// Patchbay
	gui->draw_3segmentv(patchbay_x, 
		patchbay_y, 
		patchbay_h + 20, 
		get_image("patchbay_bg"));

// Track canvas
	gui->draw_9segment(mcanvas_x, 
		mcanvas_y, 
		mcanvas_w, 
		patchbay_h + 20, 
		tracks_bg);

// Timebar
	gui->draw_3segmenth(mtimebar_x, 
		mtimebar_y, 
		mtimebar_w, 
		get_image("timebar_bg"));

// Zoombar
	int zoombar_center = 710;
	gui->draw_3segmenth(mzoom_x, 
		mzoom_y,
		zoombar_center, 
		zoombar_left);
	if(mzoom_w > zoombar_center)
		gui->draw_3segmenth(mzoom_x + zoombar_center, 
			mzoom_y, 
			mzoom_w - zoombar_center, 
			zoombar_right);

// Status
	gui->draw_3segmenth(mstatus_x, 
		mstatus_y,
		zoombar_center, 
		statusbar_left);

	if(mstatus_w > zoombar_center)
		gui->draw_3segmenth(mstatus_x + zoombar_center, 
			mstatus_y,
			mstatus_w - zoombar_center, 
			statusbar_right);
}
surface getMinimap(int w, int h, const gamemap &map, const team *vw)
{
	const int scale = 8;

	DBG_DP << "creating minimap " << int(map.w()*scale*0.75) << "," << int(map.h()*scale) << "\n";

	const size_t map_width = map.w()*scale*3/4;
	const size_t map_height = map.h()*scale;
	if(map_width == 0 || map_height == 0) {
		return surface(NULL);
	}

	surface minimap(create_neutral_surface(map_width, map_height));
	if(minimap == NULL)
		return surface(NULL);

	typedef mini_terrain_cache_map cache_map;
	cache_map *normal_cache = &mini_terrain_cache;
	cache_map *fog_cache = &mini_fogged_terrain_cache;

	for(int y = 0; y != map.total_height(); ++y) {
		for(int x = 0; x != map.total_width(); ++x) {

			surface surf(NULL);

			const map_location loc(x,y);
			if(map.on_board(loc)) {
				const bool shrouded = vw != NULL && vw->shrouded(loc);
				// shrouded hex are not considered fogged (no need to fog a black image)
				const bool fogged = vw != NULL && !shrouded && vw->fogged(loc);
				const t_translation::t_terrain terrain = shrouded ?
					t_translation::VOID_TERRAIN : map[loc];

				bool need_fogging = false;

				cache_map* cache = fogged ? fog_cache : normal_cache;
				cache_map::iterator i = cache->find(terrain);

				if (fogged && i == cache->end()) {
					// we don't have the fogged version in cache
					// try the normal cache and ask fogging the image
					cache = normal_cache;
					i = cache->find(terrain);
					need_fogging = true;
				}

				if(i == cache->end()) {
					surface tile(get_image("terrain/" + map.get_terrain_info(terrain).minimap_image() + ".png",image::HEXED));

					if(tile == 0) {
						utils::string_map symbols;
						symbols["terrain"] = t_translation::write_terrain_code(terrain);
						const std::string msg =
							vgettext("Could not get image for terrain: $terrain.", symbols);
						VALIDATE(false, msg);
					}

					//Compose images of base and overlay if neccessary
					if(map.get_terrain_info(terrain).is_combined()) {
						surface overlay(get_image("terrain/" + map.get_terrain_info(terrain).minimap_image_overlay() + ".png", image::HEXED));
						if(overlay != 0 && overlay != tile) {
							surface combined = create_compatible_surface(tile, tile->w, tile->h);
							SDL_Rect r;
							r.x = 0;
							r.y = 0;
							SDL_BlitSurface(tile, NULL, combined, &r);
							r.x = std::max(0, (tile->w - overlay->w)/2);
							r.y = std::max(0, (tile->h - overlay->h)/2);
                            if ((overlay->flags & SDL_RLEACCEL) == 0) {
                                blit_surface(overlay, NULL, combined, &r);
                            } else {
                                WRN_DP << map.get_terrain_info(terrain).minimap_image_overlay() << ".png overlay is RLE-encoded, creating a neutral surface\n";
                                surface overlay_neutral = make_neutral_surface(overlay);
							    blit_surface(overlay_neutral, NULL, combined, &r);
                            }
							tile = combined;
						}

					}

					surf = surface(scale_surface_blended(tile,scale,scale));

					VALIDATE(surf != NULL, _("Error creating or aquiring an image."));

					i = normal_cache->insert(cache_map::value_type(terrain,surf)).first;
				}

				surf = i->second;

				if (need_fogging) {
					surf = surface(adjust_surface_colour(surf,-50,-50,-50));
					fog_cache->insert(cache_map::value_type(terrain,surf));
				}

				VALIDATE(surf != NULL, _("Error creating or aquiring an image."));

				// we need a balanced shift up and down of the hexes.
				// if not, only the bottom half-hexes are clipped
				// and it looks asymmetrical.

				// also do 1-pixel shift because the scaling
				// function seems to do it with its rounding
				SDL_Rect maprect = {x * scale*3/4 - 1,
					y*scale + scale/4 * (is_odd(x) ? 1 : -1) - 1,
					0, 0};
				SDL_BlitSurface(surf, NULL, minimap, &maprect);
			}
		}
	}

	double wratio = w*1.0 / minimap->w;
	double hratio = h*1.0 / minimap->h;
	double ratio = std::min<double>(wratio, hratio);

	minimap = scale_surface(minimap,
		static_cast<int>(minimap->w * ratio), static_cast<int>(minimap->h * ratio));

	DBG_DP << "done generating minimap\n";

	return minimap;
}
Пример #3
0
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");
}
static void
polkit_mate_authentication_dialog_constructed (GObject *object)
{
  PolkitMateAuthenticationDialog *dialog;
  GtkWidget *hbox;
  GtkWidget *main_vbox;
  GtkWidget *vbox;
  GtkWidget *table_alignment;
  GtkWidget *table;
  GtkWidget *details_expander;
  GtkWidget *details_vbox;
  GtkWidget *label;
  GtkWidget *image;
  GtkWidget *content_area;
  GtkWidget *action_area;
  gboolean have_user_combobox;
  gchar *s;
  guint rows;

  dialog = POLKIT_MATE_AUTHENTICATION_DIALOG (object);

  if (G_OBJECT_CLASS (polkit_mate_authentication_dialog_parent_class)->constructed != NULL)
    G_OBJECT_CLASS (polkit_mate_authentication_dialog_parent_class)->constructed (object);

  have_user_combobox = FALSE;

  dialog->priv->cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
                                                            GTK_STOCK_CANCEL,
                                                            GTK_RESPONSE_CANCEL);
  dialog->priv->auth_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
                                                          _("_Authenticate"),
                                                          GTK_RESPONSE_OK);
  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);

  content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
  action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));

  gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
  gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
  gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
  gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
  gtk_box_set_spacing (GTK_BOX (action_area), 6);
  gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
  gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_DIALOG_AUTHENTICATION);

  hbox = gtk_hbox_new (FALSE, 12);
  gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
  gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 0);

  image = get_image (dialog);
  gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
  gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);

  main_vbox = gtk_vbox_new (FALSE, 10);
  gtk_box_pack_start (GTK_BOX (hbox), main_vbox, TRUE, TRUE, 0);

  /* main message */
  label = gtk_label_new (NULL);
  s = g_strdup_printf ("<big><b>%s</b></big>", dialog->priv->message);
  gtk_label_set_markup (GTK_LABEL (label), s);
  g_free (s);
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
  gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
  gtk_box_pack_start (GTK_BOX (main_vbox), label, FALSE, FALSE, 0);

  /* secondary message */
  label = gtk_label_new (NULL);
  if (g_strv_length (dialog->priv->users) > 1)
    {
          gtk_label_set_markup (GTK_LABEL (label),
                                _("An application is attempting to perform an action that requires privileges. "
                                  "Authentication as one of the users below is required to perform this action."));
    }
  else
    {
      if (strcmp (g_get_user_name (), dialog->priv->users[0]) == 0)
        {
          gtk_label_set_markup (GTK_LABEL (label),
                                _("An application is attempting to perform an action that requires privileges. "
                                  "Authentication is required to perform this action."));
        }
      else
        {
          gtk_label_set_markup (GTK_LABEL (label),
                                _("An application is attempting to perform an action that requires privileges. "
                                  "Authentication as the super user is required to perform this action."));
        }
    }
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
  gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
  gtk_box_pack_start (GTK_BOX (main_vbox), label, FALSE, FALSE, 0);

  /* user combobox */
  if (g_strv_length (dialog->priv->users) > 1)
    {
      dialog->priv->user_combobox = gtk_combo_box_new ();
      gtk_box_pack_start (GTK_BOX (main_vbox), GTK_WIDGET (dialog->priv->user_combobox), FALSE, FALSE, 0);

      create_user_combobox (dialog);

      have_user_combobox = TRUE;
    }
  else
    {
      dialog->priv->selected_user = g_strdup (dialog->priv->users[0]);
    }

  /* password entry */
  vbox = gtk_vbox_new (FALSE, 0);
  gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0);

  table_alignment = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
  gtk_box_pack_start (GTK_BOX (vbox), table_alignment, FALSE, FALSE, 0);
  table = gtk_table_new (1, 2, FALSE);
  gtk_table_set_col_spacings (GTK_TABLE (table), 12);
  gtk_table_set_row_spacings (GTK_TABLE (table), 6);
  gtk_container_add (GTK_CONTAINER (table_alignment), table);
  dialog->priv->password_entry = gtk_entry_new ();
  gtk_entry_set_visibility (GTK_ENTRY (dialog->priv->password_entry), FALSE);
  dialog->priv->prompt_label = add_row (table, 0, _("_Password:"******"activate",
                            G_CALLBACK (gtk_window_activate_default),
                            dialog);

  dialog->priv->table_alignment = table_alignment;
  /* initially never show the password entry stuff; we'll toggle it on/off so it's
   * only shown when prompting for a password */
  gtk_widget_set_no_show_all (dialog->priv->table_alignment, TRUE);

  /* A label for showing PAM_TEXT_INFO and PAM_TEXT_ERROR messages */
  label = gtk_label_new (NULL);
  gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
  dialog->priv->info_label = label;

  /* Details */
  details_expander = gtk_expander_new_with_mnemonic (_("<small><b>_Details</b></small>"));
  gtk_expander_set_use_markup (GTK_EXPANDER (details_expander), TRUE);
  gtk_box_pack_start (GTK_BOX (content_area), details_expander, FALSE, FALSE, 0);

  details_vbox = gtk_vbox_new (FALSE, 10);
  gtk_container_add (GTK_CONTAINER (details_expander), details_vbox);

  table_alignment = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
  gtk_box_pack_start (GTK_BOX (details_vbox), table_alignment, FALSE, FALSE, 0);
  table = gtk_table_new (1, 3, FALSE);
  gtk_table_set_col_spacings (GTK_TABLE (table), 12);
  gtk_table_set_row_spacings (GTK_TABLE (table), 6);
  gtk_container_add (GTK_CONTAINER (table_alignment), table);

  /* TODO: sort keys? */
  rows = 0;
  if (dialog->priv->details != NULL)
    {
      guint n;
      gchar **keys;

      keys = polkit_details_get_keys (dialog->priv->details);
      for (n = 0; keys[n] != NULL; n++)
        {
          const gchar *key = keys[n];
          const gchar *value;

          value = polkit_details_lookup (dialog->priv->details, key);

          label = gtk_label_new (NULL);
          s = g_strdup_printf ("<small>%s</small>", value);
          gtk_label_set_markup (GTK_LABEL (label), s);
          g_free (s);
          gtk_misc_set_alignment (GTK_MISC (label), 0, 1.0);
          s = g_strdup_printf ("<small><b>%s:</b></small>", key);
          add_row (table, rows, s, label);
          g_free (s);

          rows++;
        }
      g_strfreev (keys);
    }

  /* --- */

  label = gtk_label_new (NULL);
  gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
  s = g_strdup_printf ("<small><a href=\"%s\">%s</a></small>",
                       dialog->priv->action_id,
                       dialog->priv->action_id);
  gtk_label_set_markup (GTK_LABEL (label), s);
  g_free (s);
  gtk_misc_set_alignment (GTK_MISC (label), 0, 1.0);
  add_row (table, rows++, _("<small><b>Action:</b></small>"), label);
  g_signal_connect (label, "activate-link", G_CALLBACK (action_id_activated), NULL);

  s = g_strdup_printf (_("Click to edit %s"), dialog->priv->action_id);
  gtk_widget_set_tooltip_markup (label, s);
  g_free (s);

  /* --- */

  label = gtk_label_new (NULL);
  gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
  s = g_strdup_printf ("<small><a href=\"%s\">%s</a></small>",
                       dialog->priv->vendor_url,
                       dialog->priv->vendor);
  gtk_label_set_markup (GTK_LABEL (label), s);
  g_free (s);
  gtk_misc_set_alignment (GTK_MISC (label), 0, 1.0);
  add_row (table, rows++, _("<small><b>Vendor:</b></small>"), label);

  s = g_strdup_printf (_("Click to open %s"), dialog->priv->vendor_url);
  gtk_widget_set_tooltip_markup (label, s);
  g_free (s);

  if (have_user_combobox)
    {
      /* ... and make the password entry and "Authenticate" button insensitive */
      gtk_widget_set_sensitive (dialog->priv->prompt_label, FALSE);
      gtk_widget_set_sensitive (dialog->priv->password_entry, FALSE);
      gtk_widget_set_sensitive (dialog->priv->auth_button, FALSE);
    }
  else
    {
    }

  gtk_widget_realize (GTK_WIDGET (dialog));

}
Пример #5
0
void SUV::draw_mwindow_bg(MWindowGUI *gui)
{
// Button bar
	gui->draw_3segmenth(mbuttons_x,
		mbuttons_y - 1,
		mwindow->session->mwindow_w,
		get_image("mbutton_bg"));

	int pdw = get_image("panel_divider")->get_w();
	int x = mbuttons_x;
	x += 9 * get_image("play")->get_w();
	x += mtransport_margin;                                       // the control buttons

	gui->draw_vframe(get_image("panel_divider"),
		x - toggle_margin / 2 - pdw / 2 + 2,
		mbuttons_y - 1);
	x += 2 * get_image("arrow")->get_w() + toggle_margin;           // the mode buttons

	gui->draw_vframe(get_image("panel_divider"),
		x - toggle_margin / 2 - pdw / 2 + 2,
		mbuttons_y - 1);
	x += 2 * get_image("autokeyframe")->get_w() + toggle_margin;    // the state toggle buttons

	gui->draw_vframe(get_image("panel_divider"),
		x - toggle_margin / 2 - pdw / 2 + 2,
		mbuttons_y - 1);

// Clock
	gui->draw_3segmenth(0,
		mbuttons_y - 1 + get_image("mbutton_bg")->get_h(),
		get_image("patchbay_bg")->get_w(),
		get_image("clock_bg"));

// Patchbay
//printf("SUV::draw_mwindow_bg %d %d %d\n", __LINE__,
//mclock_h,
//mtimebar_h);
	gui->draw_3segmentv(patchbay_x,
		patchbay_y,
		patchbay_h,
		get_image("patchbay_bg"));

// Track canvas
	gui->set_color(BLACK);
	gui->draw_box(mcanvas_x + get_image("patchbay_bg")->get_w(),
		mcanvas_y + mtimebar_h,
		mcanvas_w - BC_ScrollBar::get_span(SCROLL_VERT),
		mcanvas_h - BC_ScrollBar::get_span(SCROLL_HORIZ) - mtimebar_h);

// Timebar
	gui->draw_3segmenth(mtimebar_x,
		mtimebar_y,
		mtimebar_w,
		get_image("timebar_bg"));

// Zoombar
	gui->set_color(0x373737);
	gui->draw_box(mzoom_x,
		mzoom_y,
		mwindow->session->mwindow_w,
		25);

// Scrollbar filler
//	gui->draw_vframe(get_image("mscroll_filler"),
//		mcanvas_x + mcanvas_w - BC_ScrollBar::get_span(SCROLL_VERT),
//		mcanvas_y + mcanvas_h - BC_ScrollBar::get_span(SCROLL_HORIZ));

// Status
	gui->draw_3segmenth(mzoom_x,
		mzoom_y,
		mzoom_w,
		get_image("statusbar"));


}
Пример #6
0
void Theme::get_cwindow_sizes(CWindowGUI *gui, int cwindow_controls)
{
	czoom_w = 80;

	int edit_w = EditPanel::calculate_w(mwindow, 1, 14);
	int transport_w = PlayTransport::get_transport_width(mwindow) + toggle_margin;
	int zoom_w = ZoomPanel::calculate_w(czoom_w);
	int status_w = get_image("cwindow_active")->get_w();
// Space between buttons & status icon
	int division_w = 40;

	ctimebar_h = 16;

	if(cwindow_controls)
	{
SET_TRACE
		if(mwindow->edl->session->cwindow_meter)
		{
			cmeter_x = mwindow->session->cwindow_w - 
				MeterPanel::get_meters_width(this,
					mwindow->edl->session->audio_channels, 
					mwindow->edl->session->cwindow_meter);
		}
		else
		{
			cmeter_x = mwindow->session->cwindow_w + widget_border;
		}

		int buttons_h;
#ifdef USE_SLIDER
		cslider_x = 5;
		cslider_y = ccomposite_h + 20;
		cedit_y = cslider_y + BC_Slider::get_span(0);
#endif

		if(edit_w + 
			widget_border * 2 + 
			transport_w + widget_border + 
			zoom_w + widget_border + 
			division_w +
			status_w > cmeter_x)
		{
			buttons_h = get_image("cbuttons_left")->get_h();

			cedit_x = widget_border;
			cedit_y = mwindow->session->cwindow_h - 
				buttons_h + 
				ctimebar_h + 
				widget_border;

			ctransport_x = widget_border;
			ctransport_y = mwindow->session->cwindow_h - 
				get_image_set("autokeyframe")[0]->get_h() - 
				widget_border;

			czoom_x = ctransport_x + transport_w + widget_border;
			czoom_y = ctransport_y + widget_border;

			cstatus_x = 426;
			cstatus_y = mwindow->session->cwindow_h - 
				get_image("cwindow_active")->get_h() - 30;
		}
		else
		{
			buttons_h = ctimebar_h + 
				widget_border +
				EditPanel::calculate_h(mwindow) +
				widget_border;
			ctransport_x = widget_border;
			ctransport_y = mwindow->session->cwindow_h - 
				buttons_h + 
				ctimebar_h + 
				widget_border;
			
			cedit_x = ctransport_x + transport_w + widget_border;
			cedit_y = ctransport_y;

			czoom_x = cedit_x + edit_w + widget_border;
			czoom_y = cedit_y + widget_border;
//printf("Theme::get_cwindow_sizes %d %d %d\n", __LINE__, czoom_x, zoom_w);
			cstatus_x = czoom_x + zoom_w + division_w;
			cstatus_y = ctransport_y;
		}


		ccomposite_x = 0;
		ccomposite_y = 5;
		ccomposite_w = get_image("cpanel_bg")->get_w();
		ccomposite_h = mwindow->session->cwindow_h - buttons_h;







		ccanvas_x = ccomposite_x + ccomposite_w;
		ccanvas_y = 0;
		ccanvas_h = ccomposite_h;


		ccanvas_w = cmeter_x - ccanvas_x - widget_border;
SET_TRACE
	}
	else
// no controls
	{
void BlondTheme::initialize()
{
	BC_Resources *resources = BC_WindowBase::get_resources();


	resources->text_default = 0x000000;
	resources->text_background = 0xffffff;
	resources->text_border1 = 0x4a484a; // (top outer)
	resources->text_border2 = 0x000000; // (top inner)
	resources->text_border3 = 0xacaeac; // (bottom inner)
	resources->text_border4 = 0xffffff; // (bottom outer)
	resources->text_inactive_highlight = 0xacacac;

	resources->bg_color = BLOND;
	resources->default_text_color = 0x000000;
	resources->menu_title_text    = 0x000000;
	resources->popup_title_text   = 0x000000;
	resources->menu_item_text     = 0x000000;

	resources->generic_button_margin = 15;
	resources->pot_needle_color = resources->text_default;
	resources->pot_offset = 1;
	resources->progress_text = resources->text_default;
	resources->meter_font_color = RED;

	resources->menu_light = 0x00cacd;
	resources->menu_highlighted = 0x9c95ff;
	resources->menu_down = 0x007d7b;
	resources->menu_up = 0x009594;
	resources->menu_shadow = 0x004a4a;
	resources->popupmenu_margin = 10;          // ugly
	resources->popupmenu_triangle_margin = 15; // ugly

	resources->listbox_title_color = 0x000000;

	resources->listbox_title_margin = 0;
	resources->listbox_title_hotspot = 5;  // No. of pixels around the borders to allow dragging
	resources->listbox_border1 = 0x4a484a; // (top outer)
	resources->listbox_border2 = 0x000000; // (top inner)
	resources->listbox_border3 = 0xffe200; // (bottom inner)
	resources->listbox_border4 = 0xffffff; // (bottom outer)
	resources->listbox_highlighted = 0xeee6ee;
	resources->listbox_inactive = 0xffffffff; // (background)
	resources->listbox_bg = new_image("list_bg.png");
	resources->listbox_text = 0x000000;

	resources->dirbox_margin = 50;
	resources->filebox_margin = 101;
	resources->file_color = 0x000000;
	resources->directory_color = 0x0000ff;


	

	resources->filebox_icons_images = new_button("icons.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png");

	resources->filebox_text_images = new_button("text.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png");

	resources->filebox_newfolder_images = new_button("folder.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png");

	resources->filebox_updir_images = new_button("updir.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png");

	resources->filebox_delete_images = new_button("delete.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png");

	resources->filebox_reload_images = new_button("reload.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png");


	resources->filebox_descend_images = new_button("openfolder.png",
		"generic_up.png", 
		"generic_hi.png", 
		"generic_dn.png");

	resources->usethis_button_images = 
		resources->ok_images = new_button("ok.png",
		"generic_up.png", 
		"generic_hi.png", 
		"generic_dn.png");

	new_button("ok.png",
		"generic_up.png", 
		"generic_hi.png", 
		"generic_dn.png",
		"new_ok_images");

	resources->cancel_images = new_button("cancel.png",
		"generic_up.png", 
		"generic_hi.png", 
		"generic_dn.png");

	new_button("cancel.png",
		"generic_up.png", 
		"generic_hi.png", 
		"generic_dn.png",
		"new_cancel_images");

	resources->bar_data = new_image("bar", "bar.png");


	resources->min_menu_w = 0;
	resources->menu_popup_bg = 0;  // if (0) use menu_light, menu_up, menu_shadow
	resources->menu_item_bg = 0;   // if (0) use menu_light, menu_highlighted, menu_down, menu_shadow
	resources->menu_bar_bg = 0;    // if (0) use menu_light, menu_shadow, and height of MEDIUMFONT + 8
	resources->menu_title_bg =  0; // if (0) use menu_light, menu_highlighted, menu_down, menu_shadow


	resources->popupmenu_images = 0; // if (0) get_resources()->use generic_button_images

	resources->toggle_highlight_bg = 0; // if (0) "Draw a plain box" as per bctoggle.C

	resources->generic_button_images = new_image_set(3, 
			"generic_up.png", 
			"generic_hi.png", 
			"generic_dn.png");
	resources->horizontal_slider_data = new_image_set(6,
			"hslider_fg_up.png",
			"hslider_fg_hi.png",
			"hslider_fg_dn.png",
			"hslider_bg_up.png",
			"hslider_bg_hi.png",
			"hslider_bg_dn.png");
	resources->vertical_slider_data = new_image_set(6,
			"vertical_slider_fg_up.png",
			"vertical_slider_fg_hi.png",
			"vertical_slider_fg_dn.png",
			"vertical_slider_bg_up.png",
			"vertical_slider_bg_hi.png",
			"vertical_slider_bg_dn.png");
	resources->progress_images = new_image_set(2,
			"progress_bg.png",
			"progress_hi.png");
	resources->tumble_data = new_image_set(4,
		"tumble_up.png",
		"tumble_hi.png",
		"tumble_bottom.png",
		"tumble_top.png");
	resources->listbox_button = new_image_set(4,
		"listbox_button_up.png",
		"listbox_button_hi.png",
		"listbox_button_dn.png",
		"listbox_button_disabled.png"); // probably need to make this for the suv theme
	resources->listbox_column = new_image_set(3,
		"column_up.png",
		"column_hi.png",
		"column_dn.png");
	resources->listbox_expand = new_image_set(5,
		"listbox_expandup.png",
		"listbox_expanduphi.png",
		"listbox_expandchecked.png",
		"listbox_expanddn.png",
		"listbox_expandcheckedhi.png");
	resources->listbox_up = new_image("listbox_up.png");
	resources->listbox_dn = new_image("listbox_dn.png");
	resources->pan_data = new_image_set(7,
			"pan_up.png", 
			"pan_hi.png", 
			"pan_popup.png", 
			"pan_channel.png", 
			"pan_stick.png", 
			"pan_channel_small.png", 
			"pan_stick_small.png");
	resources->pan_text_color = WHITE;

	resources->pot_images = new_image_set(3,
		"pot_up.png",
		"pot_hi.png",
		"pot_dn.png");

	resources->checkbox_images = new_image_set(5,
		"checkbox_up.png",
		"checkbox_hi.png",
		"checkbox_checked.png",
		"checkbox_dn.png",
		"checkbox_checkedhi.png");

	resources->radial_images = new_image_set(5,
		"radial_up.png",
		"radial_hi.png",
		"radial_checked.png",
		"radial_dn.png",
		"radial_checkedhi.png");

	resources->xmeter_images = new_image_set(6, 
		"xmeter_normal.png",
		"xmeter_green.png",
		"xmeter_red.png",
		"xmeter_yellow.png",
		"xmeter_white.png",
		"xmeter_over.png");
	resources->ymeter_images = new_image_set(6, 
		"ymeter_normal.png",
		"ymeter_green.png",
		"ymeter_red.png",
		"ymeter_yellow.png",
		"ymeter_white.png",
		"ymeter_over.png");

	resources->hscroll_data = new_image_set(10,
			"hscroll_handle_up.png",
			"hscroll_handle_hi.png",
			"hscroll_handle_dn.png",
			"hscroll_handle_bg.png",
			"hscroll_left_up.png",
			"hscroll_left_hi.png",
			"hscroll_left_dn.png",
			"hscroll_right_up.png",
			"hscroll_right_hi.png",
			"hscroll_right_dn.png");

	resources->vscroll_data = new_image_set(10,
			"vscroll_handle_up.png",
			"vscroll_handle_hi.png",
			"vscroll_handle_dn.png",
			"vscroll_handle_bg.png",
			"vscroll_left_up.png",
			"vscroll_left_hi.png",
			"vscroll_left_dn.png",
			"vscroll_right_up.png",
			"vscroll_right_hi.png",
			"vscroll_right_dn.png");


	new_button("prevtip.png", "tipbutton_up.png", "tipbutton_hi.png", "tipbutton_dn.png", "prev_tip");
	new_button("nexttip.png", "tipbutton_up.png", "tipbutton_hi.png", "tipbutton_dn.png", "next_tip");
	new_button("closetip.png", "tipbutton_up.png", "tipbutton_hi.png", "tipbutton_dn.png", "close_tip");
	new_button("swap_extents.png",
		"editpanel_up.png",
		"editpanel_hi.png",
		"editpanel_dn.png",
		"swap_extents");


// Record windows
	rgui_batch = new_image("recordgui_batch.png");
	rgui_controls = new_image("recordgui_controls.png");
	rgui_list = new_image("recordgui_list.png");
	rmonitor_panel = new_image("recordmonitor_panel.png");
	rmonitor_meters = new_image("recordmonitor_meters.png");


	preferences_category_overlap = 0;
	preferencescategory_x = 5;
	preferencescategory_y = 5;
	preferencestitle_x = 5;
	preferencestitle_y = 10;
	preferencesoptions_x = 5;
	preferencesoptions_y = 0;

// MWindow
	message_normal = resources->text_default;
	audio_color = BLACK;
	mtransport_margin = 11;
	toggle_margin = 11;

	new_image("mbutton_bg", "mbutton_bg.png");
	new_image("mbutton_blue", "mbutton_blue.png");
	new_image("timebar_bg", "timebar_bg.png");
	new_image("timebar_brender", "timebar_brender.png");
	new_image("clock_bg", "mclock.png");
	new_image("patchbay_bg", "patchbay_bg.png");
	new_image("tracks_bg","tracks_bg.png");
	new_image("zoombar_left","zoombar_left.png");
	new_image("zoombar_right","zoombar_right.png");
	new_image("statusbar_left","statusbar_left.png");
	new_image("statusbar_right","statusbar_right.png");

	new_image_set("zoombar_menu", 3, "generic_up.png", "generic_hi.png", "generic_dn.png");
	new_image_set("zoombar_tumbler", 4, "tumble_up.png", "tumble_hi.png", "tumble_bottom.png", "tumble_top.png");

	new_image_set("mode_popup", 3, "generic_up.png", "generic_hi.png", "generic_dn.png");
	new_image("mode_add", "mode_add.png");
	new_image("mode_divide", "mode_divide.png");
	new_image("mode_multiply", "mode_multiply.png");
	new_image("mode_normal", "mode_normal.png");
	new_image("mode_replace", "mode_replace.png");
	new_image("mode_subtract", "mode_subtract.png");
	new_image("mode_max", "mode_max.png");

	new_toggle("plugin_on.png", 
		"pluginbutton_hi.png", 
		"pluginbutton_hi.png", 
		"pluginbutton_select.png", 
		"pluginbutton_dn.png", 
		"pluginbutton_selecthi.png", 
		"plugin_on");

	new_toggle("plugin_show.png", 
		"plugin_show.png", 
		"pluginbutton_hi.png", 
		"pluginbutton_select.png", 
		"pluginbutton_dn.png", 
		"pluginbutton_selecthi.png", 
		"plugin_show");

// CWindow
	new_image("cpanel_bg", "cpanel_bg.png");
	new_image("cbuttons_left", "cbuttons_left.png");
	new_image("cbuttons_right", "cbuttons_right.png");
	new_image("cmeter_bg", "cmeter_bg.png");

// VWindow
	new_image("vbuttons_left", "vbuttons_left.png");

	new_image("preferences_bg", "preferences_bg.png");


	new_image("new_bg", "new_bg.png");
	new_image("setformat_bg", "setformat_bg2.png");


	timebar_view_data = new_image("timebar_view.png");

	setformat_w = get_image("setformat_bg")->get_w();
	setformat_h = get_image("setformat_bg")->get_h();
	setformat_x1 = 15;
	setformat_x2 = 100;

	setformat_x3 = 315;
	setformat_x4 = 425;
	setformat_y1 = 20;
	setformat_y2 = 85;
	setformat_y3 = 125;
	setformat_margin = 30;
	setformat_channels_x = 25;
	setformat_channels_y = 242;
	setformat_channels_w = 250;
	setformat_channels_h = 250;

	loadfile_pad = 52;
	browse_pad = 20;


	new_image_set("playpatch_data", 
		5,
		"playpatch_up.png",
		"playpatch_hi.png",
		"playpatch_checked.png",
		"playpatch_dn.png",
		"playpatch_checkedhi.png");

	new_image_set("recordpatch_data", 
		5,
		"recordpatch_up.png",
		"recordpatch_hi.png",
		"recordpatch_checked.png",
		"recordpatch_dn.png",
		"recordpatch_checkedhi.png");

	new_image_set("gangpatch_data", 
		5,
		"gangpatch_up.png",
		"gangpatch_hi.png",
		"gangpatch_checked.png",
		"gangpatch_dn.png",
		"gangpatch_checkedhi.png");

	new_image_set("drawpatch_data", 
		5,
		"drawpatch_up.png",
		"drawpatch_hi.png",
		"drawpatch_checked.png",
		"drawpatch_dn.png",
		"drawpatch_checkedhi.png");


	new_image_set("mutepatch_data", 
		5,
		"mutepatch_up.png",
		"mutepatch_hi.png",
		"mutepatch_checked.png",
		"mutepatch_dn.png",
		"mutepatch_checkedhi.png");

	new_image_set("expandpatch_data", 
		5,
		"expandpatch_up.png",
		"expandpatch_hi.png",
		"expandpatch_checked.png",
		"expandpatch_dn.png",
		"expandpatch_checkedhi.png");

	build_icons();
	build_bg_data();
	build_overlays();




	out_point = new_image_set(5,
		"out_up.png", 
		"out_hi.png", 
		"out_checked.png", 
		"out_dn.png", 
		"out_checkedhi.png");
	in_point = new_image_set(5,
		"in_up.png", 
		"in_hi.png", 
		"in_checked.png", 
		"in_dn.png", 
		"in_checkedhi.png");

	label_toggle = new_image_set(5,
		"labeltoggle_up.png", 
		"labeltoggle_uphi.png", 
		"label_checked.png", 
		"labeltoggle_dn.png", 
		"label_checkedhi.png");


	statusbar_cancel_data = new_image_set(3,
		"statusbar_cancel_up.png",
		"statusbar_cancel_hi.png",
		"statusbar_cancel_dn.png");


	VFrame *editpanel_up = new_image("editpanel_up.png");
	VFrame *editpanel_hi = new_image("editpanel_hi.png");
	VFrame *editpanel_dn = new_image("editpanel_dn.png");
	VFrame *editpanel_checked = new_image("editpanel_checked.png");
	VFrame *editpanel_checkedhi = new_image("editpanel_checkedhi.png");

	new_image("panel_divider", "panel_divider.png");
	new_button("bottom_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "bottom_justify");
	new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
	new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");


	new_button("copy.png", editpanel_up, editpanel_hi, editpanel_dn, "copy");
	new_button("cut.png", editpanel_up, editpanel_hi, editpanel_dn, "cut");
	new_button("fit.png", editpanel_up, editpanel_hi, editpanel_dn, "fit");
	new_button("fitautos.png", editpanel_up, editpanel_hi, editpanel_dn, "fitautos");
	new_button("inpoint.png", editpanel_up, editpanel_hi, editpanel_dn, "inbutton");
	new_button("label.png", editpanel_up, editpanel_hi, editpanel_dn, "labelbutton");
	new_button("left_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "left_justify");
	new_button("magnify.png", editpanel_up, editpanel_hi, editpanel_dn, "magnify_button");
	new_button("middle_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "middle_justify");
	new_button("nextlabel.png", editpanel_up, editpanel_hi, editpanel_dn, "nextlabel");
	new_button("outpoint.png", editpanel_up, editpanel_hi, editpanel_dn, "outbutton");
	over_button = new_button("over.png", editpanel_up, editpanel_hi, editpanel_dn);
	overwrite_data = new_button("overwrite.png", editpanel_up, editpanel_hi, editpanel_dn);
	new_button("paste.png", editpanel_up, editpanel_hi, editpanel_dn, "paste");
	new_button("prevlabel.png", editpanel_up, editpanel_hi, editpanel_dn, "prevlabel");
	new_button("redo.png", editpanel_up, editpanel_hi, editpanel_dn, "redo");
	new_button("right_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "right_justify");
	splice_data = new_button("splice.png", editpanel_up, editpanel_hi, editpanel_dn);
	new_button("toclip.png", editpanel_up, editpanel_hi, editpanel_dn, "toclip");
	new_button("goto.png", editpanel_up, editpanel_hi, editpanel_dn, "goto");
	new_button("top_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "top_justify");
	new_button("undo.png", editpanel_up, editpanel_hi, editpanel_dn, "undo");
	new_button("wrench.png", editpanel_up, editpanel_hi, editpanel_dn, "wrench");


#define TRANSPORT_LEFT_IMAGES  "transport_left_up.png", "transport_left_hi.png", "transport_left_dn.png"
#define TRANSPORT_CENTER_IMAGES  "transport_center_up.png", "transport_center_hi.png", "transport_center_dn.png"
#define TRANSPORT_RIGHT_IMAGES  "transport_right_up.png", "transport_right_hi.png", "transport_right_dn.png"

	new_button("end.png", TRANSPORT_RIGHT_IMAGES, "end");
	new_button("fastfwd.png",TRANSPORT_CENTER_IMAGES, "fastfwd");
	new_button("fastrev.png",TRANSPORT_CENTER_IMAGES, "fastrev");
	new_button("play.png",TRANSPORT_CENTER_IMAGES, "play");
	new_button("framefwd.png", TRANSPORT_CENTER_IMAGES, "framefwd");
	new_button("framerev.png", TRANSPORT_CENTER_IMAGES, "framerev");
	new_button("pause.png", TRANSPORT_CENTER_IMAGES, "pause");
	new_button("record.png", TRANSPORT_CENTER_IMAGES, "record");
	new_button("singleframe.png", TRANSPORT_CENTER_IMAGES, "recframe");
	new_button("reverse.png", TRANSPORT_CENTER_IMAGES, "reverse");
	new_button("rewind.png", TRANSPORT_LEFT_IMAGES, "rewind");
	new_button("stop.png", TRANSPORT_CENTER_IMAGES, "stop");
	new_button("stop.png", TRANSPORT_RIGHT_IMAGES, "stoprec");



// CWindow icons
	new_image("cwindow_inactive", "cwindow_inactive.png");
	new_image("cwindow_active", "cwindow_active.png");


	new_image_set("batch_render_start",
		3,
		"batchstart_up.png",
		"batchstart_hi.png",
		"batchstart_dn.png");
	new_image_set("batch_render_stop",
		3,
		"batchstop_up.png",
		"batchstop_hi.png",
		"batchstop_dn.png");
	new_image_set("batch_render_cancel",
		3,
		"batchcancel_up.png",
		"batchcancel_hi.png",
		"batchcancel_dn.png");

	new_image_set("category_button",
		3,
		"preferencesbutton_dn.png",
		"preferencesbutton_dnhi.png",
		"preferencesbutton_dnlo.png");

	new_image_set("category_button_checked",
		3,
		"preferencesbutton_up.png",
		"preferencesbutton_uphi.png",
		"preferencesbutton_dnlo.png");






	new_toggle("arrow.png", editpanel_up, editpanel_hi, editpanel_checked, editpanel_dn, editpanel_checkedhi, "arrow");
	new_toggle("autokeyframe.png", editpanel_up, editpanel_hi, editpanel_checked, editpanel_dn, editpanel_checkedhi, "autokeyframe");
	new_toggle("ibeam.png", editpanel_up, editpanel_hi, editpanel_checked, editpanel_dn, editpanel_checkedhi, "ibeam");
	new_toggle("show_meters.png", editpanel_up, editpanel_hi, editpanel_checked, editpanel_dn, editpanel_checkedhi, "meters");

	VFrame *cpanel_up = new_image("editpanel_up.png");
	VFrame *cpanel_hi = new_image("editpanel_hi.png");
	VFrame *cpanel_dn = new_image("editpanel_dn.png");
	VFrame *cpanel_checked = new_image("editpanel_checked.png");
	VFrame *cpanel_checkedhi = new_image("editpanel_checkedhi.png");
	new_toggle("blank30x30.png", 
		   new_image("locklabels_locked.png"),
		   new_image("locklabels_lockedhi.png"),
		   new_image("locklabels_unlocked.png"),
		   new_image("locklabels_dn.png"), // can't have seperate down for each!!??
		   new_image("locklabels_unlockedhi.png"),
		   "locklabels");


	new_toggle("camera.png", cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi, "camera");
	new_toggle("crop.png", cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi, "crop");
	new_toggle("eyedrop.png", cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi, "eyedrop");
	new_toggle("magnify.png", cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi, "magnify");
	new_toggle("mask.png", cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi, "mask");
	new_toggle("projector.png", cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi, "projector");
	new_toggle("protect.png", cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi, "protect");
	new_toggle("titlesafe.png", cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi, "titlesafe");
	new_toggle("toolwindow.png", cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi, "tool");

	// toggle for tangent mode (compositor/tool window)
	new_toggle("tan_smooth.png", editpanel_up, editpanel_hi, editpanel_checked, editpanel_dn, editpanel_checkedhi, "tan_smooth");
	new_toggle("tan_linear.png", editpanel_up, editpanel_hi, editpanel_checked, editpanel_dn, editpanel_checkedhi, "tan_linear");


	flush_images();

	title_font = MEDIUMFONT_3D;
	title_color = WHITE;
	recordgui_fixed_color = YELLOW;
	recordgui_variable_color = RED;
	resources->medium_font = N_("-*-helvetica-bold-r-normal-*-14-*");

	channel_position_color = MEYELLOW;
	resources->meter_title_w = 25;

	// (asset) edit info text color
	edit_font_color = YELLOW;

	//labels
 	resources->label_images = new_image_set(5,
  		"radial_up.png", 
  		"radial_hi.png", 
  		"radial_checked.png", 
  		"radial_dn.png", 
  		"radial_checkedhi.png");

	/*	resources->type_to_icon = new_image_set(5,
            "file_folder.png",
	        "file_unknown.png",
          	"file_film.png",
	        "file_sound.png",
	        "file_column.png"); 
   */
}
Пример #8
0
void SUV::draw_setformat_bg(SetFormatWindow *gui)
{
	gui->draw_vframe(get_image("setformat_bg"), 0, 0);
}
		{
			cmeter_x = mwindow->session->cwindow_w - MeterPanel::get_meters_width(mwindow->edl->session->audio_channels, 
				mwindow->edl->session->cwindow_meter);
			ccanvas_w = cmeter_x - ccanvas_x - 5;
		}
		else
		{
			cmeter_x = mwindow->session->cwindow_w;
			ccanvas_w = cmeter_x - ccanvas_x;
		}
SET_TRACE
	}
	else
	{
SET_TRACE
		ccomposite_x = -get_image("cpanel_bg")->get_w();
		ccomposite_y = 0;
		ccomposite_w = get_image("cpanel_bg")->get_w();
		ccomposite_h = mwindow->session->cwindow_h - get_image("cbuttons_left")->get_h();

		cslider_x = 5;
		cslider_y = mwindow->session->cwindow_h;
		cedit_x = 10;
		cedit_y = cslider_y + 17;
		ctransport_x = 10;
		ctransport_y = cedit_y + 40;
		ccanvas_x = 0;
		ccanvas_y = 0;
		ccanvas_w = mwindow->session->cwindow_w;
		ccanvas_h = mwindow->session->cwindow_h;
		cmeter_x = mwindow->session->cwindow_w;
Пример #10
0
void BlondTheme::draw_new_bg(NewWindow *gui)
{
	gui->draw_vframe(get_image("new_bg"), 0, 0);
}
Пример #11
0
int main(int argc, char *argv[])
{
	const char *v4l2_device = "/dev/video0";
	const char *image_filename = "frame.jpg";
	unsigned int w = 640, h = 480;
	int secs = 0;
	int opt;

	while ((opt = getopt(argc, argv, "d:hH:o:W:l:s:")) != -1) {
		switch (opt) {
		case 'o':
			image_filename = optarg;
		break;
		case 'd':
			v4l2_device = optarg;
		break;
		case 'W':
			w = atoi(optarg);
		break;
		case 'H':
			h = atoi(optarg);
		break;
		case 's':
			secs = atoi(optarg);
		break;
		case 'l':
			gp_set_debug_level(atoi(optarg));
		break;
		case 'h':
			printf("Usage; %s opts\n", argv[0]);
			printf("-o  output image file, default is 'frame.jpg'\n"
			       "-d  v4l2 device name (default is '/dev/video0'\n"
			       "-W  output image width, default is 640\n"
			       "-H  output image height, default is 480\n"
			       "-l  sets GFXprim debug level (default is 0)\n"
			       "-s  take image every s seconds (the images are stored as frameX.jpg)\n"
			       "-h  prints this help\n");
			return 0;
		break;
		default:
			fprintf(stderr, "Invalid paramter '%c'\n", opt);
			return 1;
		}
	}

	gp_grabber *grabber = gp_grabber_v4l2_init(v4l2_device, w, h);

	if (grabber == NULL) {
		fprintf(stderr, "Failed to initalize grabber '%s': %s\n",
		        v4l2_device, strerror(errno));
		return 1;
	}

	if (secs == 0) {
		get_image(image_filename, grabber);
		gp_grabber_exit(grabber);
		return 0;
	}

	int i = 0;

	for (;;) {
		char buf[128];

		snprintf(buf, sizeof(buf), "frame%03i.jpg", i++);

		if (get_image(buf, grabber)) {
			fprintf(stderr, "Failed to get image, exitting...\n");
			return 1;
		}

		sleep(secs);
	}

	return 0;
}
Пример #12
0
void SUV::draw_mwindow_bg(MWindowGUI *gui)
{
// Button bar
	gui->draw_3segmenth(mbuttons_x, 
		mbuttons_y - 1, 
		mwindow->session->mwindow_w, 
		get_image("mbutton_bg"));

	gui->draw_vframe(get_image("panel_divider"),
		mbuttons_x + 228,
		mbuttons_y - 1);

	gui->draw_vframe(get_image("panel_divider"),
		mbuttons_x + 320,
		mbuttons_y - 1);

// Clock
	gui->draw_3segmenth(0, 
		mbuttons_y - 1 + get_image("mbutton_bg")->get_h(),
		get_image("patchbay_bg")->get_w(), 
		get_image("clock_bg"));

// Patchbay
//printf("SUV::draw_mwindow_bg %d %d %d\n", __LINE__, 
//mclock_h, 
//mtimebar_h);
	gui->draw_3segmentv(patchbay_x, 
		patchbay_y, 
		patchbay_h, 
		get_image("patchbay_bg"));

// Track canvas
	gui->set_color(BLACK);
	gui->draw_box(mcanvas_x + get_image("patchbay_bg")->get_w(), 
		mcanvas_y + mtimebar_h, 
		mcanvas_w - BC_ScrollBar::get_span(SCROLL_VERT), 
		mcanvas_h - BC_ScrollBar::get_span(SCROLL_HORIZ) - mtimebar_h);

// Timebar
	gui->draw_3segmenth(mtimebar_x, 
		mtimebar_y, 
		mtimebar_w, 
		get_image("timebar_bg"));

// Zoombar
	gui->set_color(0x373737);
	gui->draw_box(mzoom_x, 
		mzoom_y,
		mwindow->session->mwindow_w,
		25);

// Scrollbar filler
//	gui->draw_vframe(get_image("mscroll_filler"), 
//		mcanvas_x + mcanvas_w - BC_ScrollBar::get_span(SCROLL_VERT),
//		mcanvas_y + mcanvas_h - BC_ScrollBar::get_span(SCROLL_HORIZ));

// Status
	gui->draw_3segmenth(mzoom_x,
		mzoom_y,
		mzoom_w,
		get_image("statusbar"));


}
Пример #13
0
int mlt_frame_get_image( mlt_frame self, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable )
{
	mlt_properties properties = MLT_FRAME_PROPERTIES( self );
	mlt_get_image get_image = mlt_frame_pop_get_image( self );
	mlt_producer producer = mlt_properties_get_data( properties, "test_card_producer", NULL );
	mlt_image_format requested_format = *format;
	int error = 0;

	if ( get_image )
	{
		mlt_properties_set_int( properties, "image_count", mlt_properties_get_int( properties, "image_count" ) - 1 );
		error = get_image( self, buffer, format, width, height, writable );
		if ( !error && *buffer )
		{
			mlt_properties_set_int( properties, "width", *width );
			mlt_properties_set_int( properties, "height", *height );
			if ( self->convert_image && *buffer && requested_format != mlt_image_none )
				self->convert_image( self, buffer, format, requested_format );
			mlt_properties_set_int( properties, "format", *format );
		}
		else
		{
			// Cause the image to be loaded from test card or fallback (white) below.
			mlt_frame_get_image( self, buffer, format, width, height, writable );
		}
	}
	else if ( mlt_properties_get_data( properties, "image", NULL ) )
	{
		*format = mlt_properties_get_int( properties, "format" );
		*buffer = mlt_properties_get_data( properties, "image", NULL );
		*width = mlt_properties_get_int( properties, "width" );
		*height = mlt_properties_get_int( properties, "height" );
		if ( self->convert_image && *buffer && requested_format != mlt_image_none )
		{
			self->convert_image( self, buffer, format, requested_format );
			mlt_properties_set_int( properties, "format", *format );
		}
	}
	else if ( producer )
	{
		mlt_frame test_frame = NULL;
		mlt_service_get_frame( MLT_PRODUCER_SERVICE( producer ), &test_frame, 0 );
		if ( test_frame )
		{
			mlt_properties test_properties = MLT_FRAME_PROPERTIES( test_frame );
			mlt_properties_set( test_properties, "rescale.interp", mlt_properties_get( properties, "rescale.interp" ) );
			mlt_frame_get_image( test_frame, buffer, format, width, height, writable );
			mlt_properties_set_data( properties, "test_card_frame", test_frame, 0, ( mlt_destructor )mlt_frame_close, NULL );
			mlt_properties_set_double( properties, "aspect_ratio", mlt_frame_get_aspect_ratio( test_frame ) );
// 			mlt_properties_set_data( properties, "image", *buffer, *width * *height * 2, NULL, NULL );
// 			mlt_properties_set_int( properties, "width", *width );
// 			mlt_properties_set_int( properties, "height", *height );
// 			mlt_properties_set_int( properties, "format", *format );
		}
		else
		{
			mlt_properties_set_data( properties, "test_card_producer", NULL, 0, NULL, NULL );
			mlt_frame_get_image( self, buffer, format, width, height, writable );
		}
	}
	else
	{
		register uint8_t *p;
		register uint8_t *q;
		int size = 0;

		*width = *width == 0 ? 720 : *width;
		*height = *height == 0 ? 576 : *height;
		size = *width * *height;

		mlt_properties_set_int( properties, "format", *format );
		mlt_properties_set_int( properties, "width", *width );
		mlt_properties_set_int( properties, "height", *height );
		mlt_properties_set_int( properties, "aspect_ratio", 0 );

		switch( *format )
		{
			case mlt_image_none:
				size = 0;
				*buffer = NULL;
				break;
			case mlt_image_rgb24:
				size *= 3;
				size += *width * 3;
				*buffer = mlt_pool_alloc( size );
				if ( *buffer )
					memset( *buffer, 255, size );
				break;
			case mlt_image_rgb24a:
			case mlt_image_opengl:
				size *= 4;
				size += *width * 4;
				*buffer = mlt_pool_alloc( size );
				if ( *buffer )
					memset( *buffer, 255, size );
				break;
			case mlt_image_yuv422:
				size *= 2;
				size += *width * 2;
				*buffer = mlt_pool_alloc( size );
				p = *buffer;
				q = p + size;
				while ( p != NULL && p != q )
				{
					*p ++ = 235;
					*p ++ = 128;
				}
				break;
			case mlt_image_yuv420p:
				size = size * 3 / 2;
				*buffer = mlt_pool_alloc( size );
				if ( *buffer )
					memset( *buffer, 255, size );
				break;
		}

		mlt_properties_set_data( properties, "image", *buffer, size, ( mlt_destructor )mlt_pool_release, NULL );
		mlt_properties_set_int( properties, "test_image", 1 );
	}

	return error;
}
Пример #14
0
void SUV::draw_preferences_bg(PreferencesWindow *gui)
{
	gui->draw_vframe(get_image("preferences_bg"), 0, 0);
}
Пример #15
0
void BlondTheme::draw_mwindow_bg(MWindowGUI *gui)
{
// Button bar
	int mbuttons_rightedge = mbuttons_x
		+ get_image("end")->get_w() + 7 * get_image("play")->get_w() + get_image("end")->get_w()
		+ mtransport_margin
		+ 2 * get_image("arrow")->get_w()
		+ toggle_margin 
		+ 2 * get_image("autokeyframe")->get_w()
		+ toggle_margin 
		+ (14 + 1) * get_image("goto")->get_w() + 5; // I don't know why + 1!!
	gui->draw_3segmenth(mbuttons_x, 
		mbuttons_y, 
		mbuttons_rightedge, 
		mbuttons_x,
		mbuttons_rightedge,
		get_image("mbutton_bg"),
		0);

	gui->draw_3segmenth(mbuttons_x + mbuttons_rightedge, 
		mbuttons_y, 
		mwindow->session->mwindow_w, 
		get_image("mbutton_blue"));

	int pdw = get_image("panel_divider")->get_w();
	int x = mbuttons_x;
	x += get_image("end")->get_w() + 7 * get_image("play")->get_w() + get_image("end")->get_w();
	x += mtransport_margin;                                       // the control buttons

	gui->draw_vframe(get_image("panel_divider"),
		x - toggle_margin / 2 - pdw / 2 + 2,
		mbuttons_y - 1);
	x += 2 * get_image("arrow")->get_w() + toggle_margin;           // the mode buttons

	gui->draw_vframe(get_image("panel_divider"),
		x - toggle_margin / 2 - pdw / 2 + 2,
		mbuttons_y - 1);

	x += 2 * get_image("autokeyframe")->get_w() + toggle_margin;    // the state toggle buttons
	gui->draw_vframe(get_image("panel_divider"),
		x - toggle_margin / 2 - pdw / 2 + 2,
		mbuttons_y - 1);

// Clock
	gui->draw_3segmenth(0, 
		mbuttons_y + get_image("mbutton_bg")->get_h() - 1,
		get_image("patchbay_bg")->get_w(), 
		get_image("clock_bg"));

// Patchbay
	gui->draw_3segmentv(patchbay_x, 
		patchbay_y, 
		patchbay_h, 
		get_image("patchbay_bg"));

// Track canvas
	gui->draw_9segment(mcanvas_x, 
		mcanvas_y, 
		mcanvas_w, 
		mcanvas_h, 
		get_image("tracks_bg"));

// Timebar
	gui->draw_3segmenth(mtimebar_x, 
		mtimebar_y, 
		mtimebar_w, 
		get_image("timebar_bg"));

// Zoombar
#define ZOOMBAR_CENTER 888
	gui->draw_3segmenth(mzoom_x, 
		mzoom_y,
		ZOOMBAR_CENTER, 
		get_image("zoombar_left"));
	if(mzoom_w > ZOOMBAR_CENTER)
		gui->draw_3segmenth(mzoom_x + ZOOMBAR_CENTER, 
			mzoom_y, 
			mzoom_w - ZOOMBAR_CENTER, 
			get_image("zoombar_right"));


// Status
	gui->draw_3segmenth(mstatus_x, 
		mstatus_y,
		ZOOMBAR_CENTER, 
		get_image("statusbar_left"));

	if(mstatus_w > ZOOMBAR_CENTER)
	  gui->draw_3segmenth(mstatus_x + ZOOMBAR_CENTER, 
			      mstatus_y,
			      mstatus_w - ZOOMBAR_CENTER, 
			      get_image("statusbar_right"));

}
Пример #16
0
void SUV::draw_new_bg(NewWindow *gui)
{
	gui->draw_vframe(get_image("new_bg"), 0, 0);
}
Пример #17
0
static int control(uint32_t request, void *data, ...)
{
  switch (request) {
  case VOCTRL_QUERY_FORMAT:
    return query_format(*((uint32_t*)data));
  case VOCTRL_GET_IMAGE:
    return get_image(data);
  case VOCTRL_DRAW_IMAGE:
    return draw_image(data);
  case VOCTRL_SET_EQUALIZER:
    {
     va_list ap;
     short value;
     uint32_t luma,prev;

     if ( strcmp( data,"brightness" ) && strcmp( data,"contrast" ) ) return VO_FALSE;

     if (ioctl(f,MGA_VID_GET_LUMA,&prev)) {
	perror("Error in mga_vid_config ioctl()");
    mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldNotGetLumaValuesFromTheKernelModule);
	return VO_FALSE;
     }

//     printf("GET: 0x%4X 0x%4X  \n",(prev>>16),(prev&0xffff));

     va_start(ap, data);
     value = va_arg(ap, int);
     va_end(ap);

//     printf("value: %d -> ",value);
     value=((value+100)*255)/200-128; // maps -100=>-128 and +100=>127
//     printf("%d  \n",value);

     if(!strcmp(data,"contrast"))
         luma = (prev&0xFFFF0000)|(value&0xFFFF);
     else
         luma = (prev&0xFFFF)|(value<<16);

     if (ioctl(f,MGA_VID_SET_LUMA,luma)) {
	perror("Error in mga_vid_config ioctl()");
        mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldNotSetLumaValuesFromTheKernelModule);
	return VO_FALSE;
     }

     return VO_TRUE;
    }

  case VOCTRL_GET_EQUALIZER:
    {
     va_list ap;
     int * value;
     short val;
     uint32_t luma;

     if ( strcmp( data,"brightness" ) && strcmp( data,"contrast" ) ) return VO_FALSE;

     if (ioctl(f,MGA_VID_GET_LUMA,&luma)) {
	perror("Error in mga_vid_config ioctl()");
        mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldNotGetLumaValuesFromTheKernelModule);
	return VO_FALSE;
     }

     if ( !strcmp( data,"contrast" ) )
	 val=(luma & 0xFFFF);
     else
	 val=(luma >> 16);

     va_start(ap, data);
     value = va_arg(ap, int*);
     va_end(ap);

     *value = (val*200)/255;

     return VO_TRUE;
    }

#ifndef VO_XMGA
  case VOCTRL_FULLSCREEN:
    if (vo_screenwidth && vo_screenheight)
	mga_fullscreen();
    else
	mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_ScreenWidthHeightUnknown);
    return VO_TRUE;
  case VOCTRL_GET_PANSCAN:
      if ( !vo_fs ) return VO_FALSE;
      return VO_TRUE;
#endif

#if defined(VO_XMGA) && defined(CONFIG_GUI)
  case VOCTRL_GUISUPPORT:
    return VO_TRUE;
#endif

#ifdef VO_XMGA
  case VOCTRL_ONTOP:
      vo_x11_ontop();
      return VO_TRUE;
  case VOCTRL_GET_PANSCAN:
      if ( !initialized || !vo_fs ) return VO_FALSE;
      return VO_TRUE;
  case VOCTRL_FULLSCREEN:
      vo_x11_fullscreen();
      vo_panscan_amount=0;
    /* intended, fallthrough to update panscan on fullscreen/windowed switch */
#endif
  case VOCTRL_SET_PANSCAN:
      if ( vo_fs && ( vo_panscan != vo_panscan_amount ) ) // || ( !vo_fs && vo_panscan_amount ) )
       {
//        int old_y = vo_panscan_y;
	panscan_calc();
//        if ( old_y != vo_panscan_y )
	set_window();
       }
      return VO_TRUE;
  case VOCTRL_UPDATE_SCREENINFO:
#ifdef VO_XMGA
      update_xinerama_info();
#else
      aspect_save_screenres(vo_screenwidth, vo_screenheight);
#endif
      return VO_TRUE;
  }
  return VO_NOTIMPL;
}
Пример #18
0
void SUV::initialize()
{
	BC_Resources *resources = BC_WindowBase::get_resources();


	resources->text_default = 0xbfbfbf;
	resources->text_background = 0x373737;
	resources->text_border1 = 0x202020;
	resources->text_border2 = 0x373737;
	resources->text_border3 = 0x373737;
	resources->text_border4 = 0x969696;
	resources->text_inactive_highlight = 0x707070;

	resources->bg_color = 0x484848;
	resources->border_light2 = resources->bg_color;
	resources->border_shadow2 = resources->bg_color;
	resources->default_text_color = 0xbfbfbf;
	resources->menu_title_text = 0xbfbfbf;
	resources->popup_title_text = 0xbfbfbf;
	resources->menu_item_text = 0xbfbfbf;
	resources->menu_highlighted_fontcolor = WHITE;
	resources->generic_button_margin = 30;
	resources->pot_needle_color = resources->text_default;
	resources->pot_offset = 1;
	resources->progress_text = resources->text_default;
	resources->meter_font_color = resources->default_text_color;

	resources->menu_light = 0xababab;
	resources->menu_highlighted = 0x6f6f6f;
	resources->menu_down = 0x4b4b4b;
	resources->menu_up = 0x4b4b4b;
	resources->menu_shadow = 0x202020;
	resources->popupmenu_margin = 15;
	resources->popupmenu_triangle_margin = 15;

	resources->listbox_title_color = 0xbfbfbf;

	resources->listbox_title_margin = 20;
	resources->listbox_title_hotspot = 20;
	resources->listbox_border1 = 0x1a1a1a;
	resources->listbox_border2 = 0x373737;
	resources->listbox_border3 = 0x373737;
	resources->listbox_border4 = 0x646464;
	resources->listbox_highlighted = 0x505050;
	resources->listbox_inactive = 0x373737;
	resources->listbox_bg = 0;
	resources->listbox_text = 0xbfbfbf;

	resources->filebox_margin = 130;
	resources->file_color = 0xbfbfbf;
	resources->directory_color = 0xa0a0ff;


	new_toggle("loadmode_new.png",
		"loadmode_up.png",
		"loadmode_hi.png",
		"loadmode_checked.png",
		"loadmode_dn.png",
		"loadmode_checkedhi.png",
		"loadmode_new");
	new_toggle("loadmode_none.png",
		"loadmode_up.png",
		"loadmode_hi.png",
		"loadmode_checked.png",
		"loadmode_dn.png",
		"loadmode_checkedhi.png",
		"loadmode_none");
	new_toggle("loadmode_newcat.png",
		"loadmode_up.png",
		"loadmode_hi.png",
		"loadmode_checked.png",
		"loadmode_dn.png",
		"loadmode_checkedhi.png",
		"loadmode_newcat");
	new_toggle("loadmode_cat.png",
		"loadmode_up.png",
		"loadmode_hi.png",
		"loadmode_checked.png",
		"loadmode_dn.png",
		"loadmode_checkedhi.png",
		"loadmode_cat");
	new_toggle("loadmode_newtracks.png",
		"loadmode_up.png",
		"loadmode_hi.png",
		"loadmode_checked.png",
		"loadmode_dn.png",
		"loadmode_checkedhi.png",
		"loadmode_newtracks");
	new_toggle("loadmode_paste.png",
		"loadmode_up.png",
		"loadmode_hi.png",
		"loadmode_checked.png",
		"loadmode_dn.png",
		"loadmode_checkedhi.png",
		"loadmode_paste");
	new_toggle("loadmode_resource.png",
		"loadmode_up.png",
		"loadmode_hi.png",
		"loadmode_checked.png",
		"loadmode_dn.png",
		"loadmode_checkedhi.png",
		"loadmode_resource");
	new_toggle("loadmode_nested.png",
		"loadmode_up.png",
		"loadmode_hi.png",
		"loadmode_checked.png",
		"loadmode_dn.png",
		"loadmode_checkedhi.png",
		"loadmode_nested");



	resources->filebox_icons_images = new_button("icons.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png");

	resources->filebox_text_images = new_button("text.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png");

	resources->filebox_newfolder_images = new_button("folder.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png");

	resources->filebox_rename_images = new_button("rename.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png");

	resources->filebox_updir_images = new_button("updir.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png");

	resources->filebox_delete_images = new_button("delete.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png");

	resources->filebox_reload_images = new_button("reload.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png");


	resources->filebox_descend_images = new_button("openfolder.png",
		"filebox_bigbutton_up.png",
		"filebox_bigbutton_hi.png",
		"filebox_bigbutton_dn.png");

	resources->usethis_button_images =
		resources->ok_images = new_button("ok.png",
		"filebox_bigbutton_up.png",
		"filebox_bigbutton_hi.png",
		"filebox_bigbutton_dn.png");

	new_button("ok.png",
		"new_bigbutton_up.png",
		"new_bigbutton_hi.png",
		"new_bigbutton_dn.png",
		"new_ok_images");

	resources->cancel_images = new_button("cancel.png",
		"filebox_bigbutton_up.png",
		"filebox_bigbutton_hi.png",
		"filebox_bigbutton_dn.png");

	new_button("cancel.png",
		"new_bigbutton_up.png",
		"new_bigbutton_hi.png",
		"new_bigbutton_dn.png",
		"new_cancel_images");

	resources->medium_7segment = new_image_set(TOTAL_7SEGMENT,
		"0.png",
		"1.png",
		"2.png",
		"3.png",
		"4.png",
		"5.png",
		"6.png",
		"7.png",
		"8.png",
		"9.png",
		"colon.png",
		"period.png",
		"a.png",
		"b.png",
		"c.png",
		"d.png",
		"e.png",
		"f.png",
		"space.png",
		"dash.png");

	resources->bar_data = new_image("bar", "bar.png");


	resources->min_menu_w = 96;
	resources->menu_popup_bg = new_image("menu_popup_bg.png");
	resources->menu_item_bg = new_image_set(3,
		"menuitem_up.png",
		"menuitem_hi.png",
		"menuitem_dn.png");
	resources->menu_bar_bg = new_image("menubar_bg.png");
	resources->menu_title_bg = new_image_set(3,
		"menubar_up.png",
		"menubar_hi.png",
		"menubar_dn.png");


	resources->popupmenu_images = 0;
// 		new_image_set(3,
// 		"menupopup_up.png",
// 		"menupopup_hi.png",
// 		"menupopup_dn.png");

	resources->toggle_highlight_bg = new_image("toggle_highlight_bg",
		"text_highlight.png");

	resources->generic_button_images = new_image_set(3,
			"generic_up.png",
			"generic_hi.png",
			"generic_dn.png");
	resources->horizontal_slider_data = new_image_set(6,
			"hslider_fg_up.png",
			"hslider_fg_hi.png",
			"hslider_fg_dn.png",
			"hslider_bg_up.png",
			"hslider_bg_hi.png",
			"hslider_bg_dn.png");
	resources->progress_images = new_image_set(2,
			"progress_bg.png",
			"progress_hi.png");
	resources->tumble_data = new_image_set(4,
		"tumble_up.png",
		"tumble_hi.png",
		"tumble_bottom.png",
		"tumble_top.png");
	resources->listbox_button = new_button4("listbox_button.png",
		"editpanel_up.png",
		"editpanel_hi.png",
		"editpanel_dn.png",
		"editpanel_hi.png");
	resources->listbox_column = new_image_set(3,
		"column_up.png",
		"column_hi.png",
		"column_dn.png");
	resources->listbox_up = new_image("listbox_up.png");
	resources->listbox_dn = new_image("listbox_dn.png");
	resources->pan_data = new_image_set(7,
			"pan_up.png",
			"pan_hi.png",
			"pan_popup.png",
			"pan_channel.png",
			"pan_stick.png",
			"pan_channel_small.png",
			"pan_stick_small.png");
	resources->pan_text_color = WHITE;

	resources->pot_images = new_image_set(3,
		"pot_up.png",
		"pot_hi.png",
		"pot_dn.png");

	resources->checkbox_images = new_image_set(5,
		"checkbox_up.png",
		"checkbox_hi.png",
		"checkbox_checked.png",
		"checkbox_dn.png",
		"checkbox_checkedhi.png");

	resources->radial_images = new_image_set(5,
		"radial_up.png",
		"radial_hi.png",
		"radial_checked.png",
		"radial_dn.png",
		"radial_checkedhi.png");

	resources->xmeter_images = new_image_set(7,
		"xmeter_normal.png",
		"xmeter_green.png",
		"xmeter_red.png",
		"xmeter_yellow.png",
		"xmeter_white.png",
		"xmeter_over.png",
		"downmix51_2.png");
	resources->ymeter_images = new_image_set(7,
		"ymeter_normal.png",
		"ymeter_green.png",
		"ymeter_red.png",
		"ymeter_yellow.png",
		"ymeter_white.png",
		"ymeter_over.png",
		"downmix51_2.png");

	resources->hscroll_data = new_image_set(10,
			"hscroll_handle_up.png",
			"hscroll_handle_hi.png",
			"hscroll_handle_dn.png",
			"hscroll_handle_bg.png",
			"hscroll_left_up.png",
			"hscroll_left_hi.png",
			"hscroll_left_dn.png",
			"hscroll_right_up.png",
			"hscroll_right_hi.png",
			"hscroll_right_dn.png");

	resources->vscroll_data = new_image_set(10,
			"vscroll_handle_up.png",
			"vscroll_handle_hi.png",
			"vscroll_handle_dn.png",
			"vscroll_handle_bg.png",
			"vscroll_left_up.png",
			"vscroll_left_hi.png",
			"vscroll_left_dn.png",
			"vscroll_right_up.png",
			"vscroll_right_hi.png",
			"vscroll_right_dn.png");
	resources->scroll_minhandle = 20;


	new_button("prevtip.png", "tipbutton_up.png", "tipbutton_hi.png", "tipbutton_dn.png", "prev_tip");
	new_button("nexttip.png", "tipbutton_up.png", "tipbutton_hi.png", "tipbutton_dn.png", "next_tip");
	new_button("closetip.png", "tipbutton_up.png", "tipbutton_hi.png", "tipbutton_dn.png", "close_tip");
	new_button("swap_extents.png",
		"editpanel_up.png",
		"editpanel_hi.png",
		"editpanel_dn.png",
		"swap_extents");


// Record windows


	preferences_category_overlap = 0;
	preferencescategory_x = 0;
	preferencescategory_y = 5;
	preferencestitle_x = 5;
	preferencestitle_y = 10;
	preferencesoptions_x = 5;
	preferencesoptions_y = 0;

// MWindow
	message_normal = resources->text_default;
	audio_color = GREEN;
	mtransport_margin = 16;
	toggle_margin = 16;

	new_button("pane.png", "pane_up.png", "pane_hi.png", "pane_dn.png", "pane");
	new_image_set("xpane", 3, "xpane_up.png", "xpane_hi.png", "xpane_dn.png");
	new_image_set("ypane", 3, "ypane_up.png", "ypane_hi.png", "ypane_dn.png");

	new_image("mbutton_bg", "mbutton_bg.png");
	new_image("timebar_bg", "timebar_bg_flat.png");
	new_image("timebar_brender", "timebar_brender.png");
	new_image("clock_bg", "mclock_flat.png");
	new_image("patchbay_bg", "patchbay_bg.png");
	new_image("statusbar", "statusbar.png");
//	new_image("mscroll_filler", "mscroll_filler.png");

	new_image_set("zoombar_menu", 3, "zoompopup_up.png", "zoompopup_hi.png", "zoompopup_dn.png");
	new_image_set("zoombar_tumbler", 4, "zoomtumble_up.png", "zoomtumble_hi.png", "zoomtumble_bottom.png", "zoomtumble_top.png");
	new_image_set("plugin_on", 5, "plugin_on.png", "plugin_onhi.png", "plugin_onselect.png", "plugin_ondn.png", "plugin_onselecthi.png");
	new_image_set("plugin_show", 5, "plugin_show.png", "plugin_showhi.png", "plugin_showselect.png", "plugin_showdn.png", "plugin_showselecthi.png");

// CWindow
	new_image("cpanel_bg", "cpanel_bg.png");
	new_image("cbuttons_left", "cbuttons_left.png");
	new_image("cbuttons_right", "cbuttons_right.png");
	new_image("cmeter_bg", "cmeter_bg.png");

// VWindow
	new_image("vbuttons_left", "vbuttons_left.png");
	new_image("vclock", "vclock.png");

	new_image("preferences_bg", "preferences_bg.png");


	new_image("new_bg", "new_bg.png");
	new_image("setformat_bg", "setformat_bg.png");


	timebar_view_data = new_image("timebar_view.png");

	setformat_w = get_image("setformat_bg")->get_w();
	setformat_h = get_image("setformat_bg")->get_h();
	setformat_x1 = 15;
	setformat_x2 = 100;

	setformat_x3 = 315;
	setformat_x4 = 415;
	setformat_y1 = 20;
	setformat_y2 = 85;
	setformat_y3 = 125;
	setformat_margin = 30;
	setformat_channels_x = 25;
	setformat_channels_y = 242;
	setformat_channels_w = 250;
	setformat_channels_h = 250;

	loadfile_pad = get_image_set("loadmode_new")[0]->get_h() + 10;
	browse_pad = 20;


	new_toggle("playpatch.png",
		"patch_up.png",
		"patch_hi.png",
		"patch_checked.png",
		"patch_dn.png",
		"patch_checkedhi.png",
		"playpatch_data");

	new_toggle("recordpatch.png",
		"patch_up.png",
		"patch_hi.png",
		"patch_checked.png",
		"patch_dn.png",
		"patch_checkedhi.png",
		"recordpatch_data");

	new_toggle("gangpatch.png",
		"patch_up.png",
		"patch_hi.png",
		"patch_checked.png",
		"patch_dn.png",
		"patch_checkedhi.png",
		"gangpatch_data");

	new_toggle("drawpatch.png",
		"patch_up.png",
		"patch_hi.png",
		"patch_checked.png",
		"patch_dn.png",
		"patch_checkedhi.png",
		"drawpatch_data");


	new_image_set("mutepatch_data",
		5,
		"mutepatch_up.png",
		"mutepatch_hi.png",
		"mutepatch_checked.png",
		"mutepatch_dn.png",
		"mutepatch_checkedhi.png");

	new_image_set("expandpatch_data",
		5,
		"expandpatch_up.png",
		"expandpatch_hi.png",
		"expandpatch_checked.png",
		"expandpatch_dn.png",
		"expandpatch_checkedhi.png");

	build_bg_data();
	build_overlays();




	out_point = new_image_set(5,
		"out_up.png",
		"out_hi.png",
		"out_checked.png",
		"out_dn.png",
		"out_checkedhi.png");
	in_point = new_image_set(5,
		"in_up.png",
		"in_hi.png",
		"in_checked.png",
		"in_dn.png",
		"in_checkedhi.png");

	label_toggle = new_image_set(5,
		"labeltoggle_up.png",
		"labeltoggle_uphi.png",
		"label_checked.png",
		"labeltoggle_dn.png",
		"label_checkedhi.png");

	new_image_set("histogram_carrot",
		5,
		"histogram_carrot_up.png",
		"histogram_carrot_hi.png",
		"histogram_carrot_checked.png",
		"histogram_carrot_dn.png",
		"histogram_carrot_checkedhi.png");


	statusbar_cancel_data = new_image_set(3,
		"statusbar_cancel_up.png",
		"statusbar_cancel_hi.png",
		"statusbar_cancel_dn.png");


	VFrame *editpanel_up = new_image("editpanel_up.png");
	VFrame *editpanel_hi = new_image("editpanel_hi.png");
	VFrame *editpanel_dn = new_image("editpanel_dn.png");
	VFrame *editpanel_checked = new_image("editpanel_checked.png");
	VFrame *editpanel_checkedhi = new_image("editpanel_checkedhi.png");

	new_image("panel_divider", "panel_divider.png");
	new_button("bottom_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "bottom_justify");
	new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
	new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");

	new_toggle("histogram.png",
		editpanel_up,
		editpanel_hi,
		editpanel_checked,
		editpanel_dn,
		editpanel_checkedhi,
		"histogram_toggle");
	new_toggle("histogram_rgb.png",
		editpanel_up,
		editpanel_hi,
		editpanel_checked,
		editpanel_dn,
		editpanel_checkedhi,
		"histogram_rgb_toggle");
	new_toggle("waveform.png",
		editpanel_up,
		editpanel_hi,
		editpanel_checked,
		editpanel_dn,
		editpanel_checkedhi,
		"waveform_toggle");
	new_toggle("waveform_rgb.png",
		editpanel_up,
		editpanel_hi,
		editpanel_checked,
		editpanel_dn,
		editpanel_checkedhi,
		"waveform_rgb_toggle");
	new_toggle("scope.png",
		editpanel_up,
		editpanel_hi,
		editpanel_checked,
		editpanel_dn,
		editpanel_checkedhi,
		"scope_toggle");

	new_button("picture.png", editpanel_up, editpanel_hi, editpanel_dn, "picture");
	new_button("histogram.png", editpanel_up, editpanel_hi, editpanel_dn, "histogram");


	new_button("copy.png", editpanel_up, editpanel_hi, editpanel_dn, "copy");
	new_button("commercial.png", editpanel_up, editpanel_hi, editpanel_dn, "commercial");
	new_button("cut.png", editpanel_up, editpanel_hi, editpanel_dn, "cut");
	new_button("fit.png", editpanel_up, editpanel_hi, editpanel_dn, "fit");
	new_button("fitautos.png", editpanel_up, editpanel_hi, editpanel_dn, "fitautos");
	new_button("inpoint.png", editpanel_up, editpanel_hi, editpanel_dn, "inbutton");
	new_button("label.png", editpanel_up, editpanel_hi, editpanel_dn, "labelbutton");
	new_button("left_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "left_justify");
	new_button("magnify.png", editpanel_up, editpanel_hi, editpanel_dn, "magnify_button");
	new_button("middle_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "middle_justify");
	new_button("nextlabel.png", editpanel_up, editpanel_hi, editpanel_dn, "nextlabel");
	new_button("prevlabel.png", editpanel_up, editpanel_hi, editpanel_dn, "prevlabel");
	new_button("nextedit.png", editpanel_up, editpanel_hi, editpanel_dn, "nextedit");
	new_button("prevedit.png", editpanel_up, editpanel_hi, editpanel_dn, "prevedit");
	new_button("outpoint.png", editpanel_up, editpanel_hi, editpanel_dn, "outbutton");
	over_button = new_button("over.png", editpanel_up, editpanel_hi, editpanel_dn);
	overwrite_data = new_button("overwrite.png", editpanel_up, editpanel_hi, editpanel_dn);
	new_button("paste.png", editpanel_up, editpanel_hi, editpanel_dn, "paste");
	new_button("redo.png", editpanel_up, editpanel_hi, editpanel_dn, "redo");
	new_button("right_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "right_justify");
	splice_data = new_button("splice.png", editpanel_up, editpanel_hi, editpanel_dn);
	new_button("toclip.png", editpanel_up, editpanel_hi, editpanel_dn, "toclip");
	new_button("goto.png", editpanel_up, editpanel_hi, editpanel_dn, "goto");
	new_button("top_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "top_justify");
	new_button("undo.png", editpanel_up, editpanel_hi, editpanel_dn, "undo");
	new_button("wrench.png", editpanel_up, editpanel_hi, editpanel_dn, "wrench");


	VFrame *transport_up = new_image("transportup.png");
	VFrame *transport_hi = new_image("transporthi.png");
	VFrame *transport_dn = new_image("transportdn.png");

	new_button("end.png", transport_up, transport_hi, transport_dn, "end");
	new_button("fastfwd.png", transport_up, transport_hi, transport_dn, "fastfwd");
	new_button("fastrev.png", transport_up, transport_hi, transport_dn, "fastrev");
	new_button("play.png", transport_up, transport_hi, transport_dn, "play");
	new_button("framefwd.png", transport_up, transport_hi, transport_dn, "framefwd");
	new_button("framerev.png", transport_up, transport_hi, transport_dn, "framerev");
	new_button("pause.png", transport_up, transport_hi, transport_dn, "pause");
	new_button("record.png", transport_up, transport_hi, transport_dn, "record");
	new_button("singleframe.png", transport_up, transport_hi, transport_dn, "recframe");
	new_button("reverse.png", transport_up, transport_hi, transport_dn, "reverse");
	new_button("rewind.png", transport_up, transport_hi, transport_dn, "rewind");
	new_button("stop.png", transport_up, transport_hi, transport_dn, "stop");
	new_button("stop.png", transport_up, transport_hi, transport_dn, "stoprec");



// CWindow icons
	new_image("cwindow_inactive", "cwindow_inactive.png");
	new_image("cwindow_active", "cwindow_active.png");



	new_image_set("category_button",
		3,
		"preferencesbutton_dn.png",
		"preferencesbutton_dnhi.png",
		"preferencesbutton_dnlo.png");

	new_image_set("category_button_checked",
		3,
		"preferencesbutton_up.png",
		"preferencesbutton_uphi.png",
		"preferencesbutton_dnlo.png");





	new_image_set("color3way_point",
		3,
		"color3way_up.png",
		"color3way_hi.png",
		"color3way_dn.png");

	new_toggle("arrow.png", editpanel_up, editpanel_hi, editpanel_checked, editpanel_dn, editpanel_checkedhi, "arrow");
	new_toggle("autokeyframe.png", transport_up, editpanel_hi, editpanel_checked, editpanel_dn, editpanel_checkedhi, "autokeyframe");
	new_toggle("ibeam.png", editpanel_up, editpanel_hi, editpanel_checked, editpanel_dn, editpanel_checkedhi, "ibeam");
	new_toggle("show_meters.png", editpanel_up, editpanel_hi, editpanel_checked, editpanel_dn, editpanel_checkedhi, "meters");
	new_toggle("blank30x30.png",
		   new_image("locklabels_locked.png"),
		   new_image("locklabels_lockedhi.png"),
		   new_image("locklabels_unlocked.png"),
		   new_image("locklabels_dn.png"), // can't have seperate down for each!!??
		   new_image("locklabels_unlockedhi.png"),
		   "locklabels");

	VFrame *cpanel_up = new_image("cpanel_up.png");
	VFrame *cpanel_hi = new_image("cpanel_hi.png");
	VFrame *cpanel_dn = new_image("cpanel_dn.png");
	VFrame *cpanel_checked = new_image("cpanel_checked.png");
	VFrame *cpanel_checkedhi = new_image("cpanel_checkedhi.png");


	new_toggle("camera.png", cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi, "camera");
	new_toggle("crop.png", cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi, "crop");
	new_toggle("eyedrop.png", cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi, "eyedrop");
	new_toggle("magnify.png", cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi, "magnify");
	new_toggle("mask.png", cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi, "mask");
	new_toggle("ruler.png", cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi, "ruler");
	new_toggle("projector.png", cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi, "projector");
	new_toggle("protect.png", cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi, "protect");
	new_toggle("titlesafe.png", cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi, "titlesafe");
	new_toggle("toolwindow.png", cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi, "tool");

	// toggle for tangent mode (compositor/tool window)
	new_toggle("tan_smooth.png", editpanel_up, editpanel_hi, editpanel_checked, editpanel_dn, editpanel_checkedhi, "tan_smooth");
	new_toggle("tan_linear.png", editpanel_up, editpanel_hi, editpanel_checked, editpanel_dn, editpanel_checkedhi, "tan_linear");


	flush_images();

	title_font = MEDIUMFONT_3D;
	title_color = 0xbfbfbf;
	recordgui_fixed_color = YELLOW;
	recordgui_variable_color = RED;

	channel_position_color = MEYELLOW;
	resources->meter_title_w = 25;

        // (asset) edit info text color
        edit_font_color = YELLOW;
}
Пример #19
0
static void graphics_subinit (void)
{
    XSetWindowAttributes wattr;
    XClassHint classhint;
    XWMHints *hints;
    unsigned long valuemask;

    dgamode = screen_is_picasso ? currprefs.gfx_pfullscreen : currprefs.gfx_afullscreen;
    dgamode = dgamode && dgaavail;

    wattr.background_pixel = /*black.pixel*/0;
    wattr.backing_store = Always;
    wattr.backing_planes = bitdepth;
    wattr.border_pixmap = None;
    wattr.border_pixel = /*black.pixel*/0;
    wattr.colormap = cmap;
    valuemask = (CWEventMask | CWBackPixel | CWBorderPixel
		 | CWBackingStore | CWBackingPlanes | CWColormap);

    if (dgamode) {
	wattr.event_mask = DGA_EVENTMASK;
	wattr.override_redirect = 1;
	valuemask |= CWOverrideRedirect;
    } else
	wattr.event_mask = EVENTMASK;

    XSync (display, 0);

    delete_win = XInternAtom(display, "WM_DELETE_WINDOW", False);
    mywin = XCreateWindow (display, rootwin, 0, 0, current_width, current_height,
			   0, bitdepth, InputOutput, vis, valuemask, &wattr);
    XSetWMProtocols (display, mywin, &delete_win, 1);
    XSync (display, 0);
    XStoreName (display, mywin, PACKAGE_NAME);
    XSetIconName (display, mywin, PACKAGE_NAME);

    /* set class hint */
    classhint.res_name  = (char *)"UAE";
    classhint.res_class = (char *)"UAEScreen";
    XSetClassHint(display, mywin, &classhint);

    hints = XAllocWMHints();
    /* Set window group leader to self to become an application
     * that can be hidden by e.g. WindowMaker.
     * Would be more useful if we could find out what the
     * (optional) GTK+ window ID is :-/ */
    hints->window_group = mywin;
    hints->flags = WindowGroupHint;
    XSetWMHints(display, mywin, hints);

    XMapRaised (display, mywin);
    XSync (display, 0);
    mygc = XCreateGC (display, mywin, 0, 0);

    if (dgamode) {
#ifdef USE_DGA_EXTENSION
	enter_dga_mode ();
	/*setuid(getuid());*/
	picasso_vidinfo.rowbytes = fb_width * picasso_vidinfo.pixbytes;
#endif
    } else {
	get_image (current_width, current_height, &ami_dinfo);
	if (screen_is_picasso) {
	    get_image (current_width, current_height, &pic_dinfo);
	    picasso_vidinfo.rowbytes = pic_dinfo.ximg->bytes_per_line;
	}
    }

    picasso_vidinfo.extra_mem = 1;

    gfxvidinfo.flush_screen = x11_flush_screen;
    gfxvidinfo.lockscr      = x11_lock;
    gfxvidinfo.unlockscr    = x11_unlock;


    if (need_dither) {
	gfxvidinfo.maxblocklines = 0;
	gfxvidinfo.rowbytes = gfxvidinfo.pixbytes * currprefs.gfx_width_win;
	gfxvidinfo.linemem = malloc (gfxvidinfo.rowbytes);
	gfxvidinfo.flush_line  = x11_flush_line_dither;
    } else if (! dgamode) {
	gfxvidinfo.emergmem = 0;
	gfxvidinfo.linemem = 0;
	gfxvidinfo.bufmem = (uae_u8 *)ami_dinfo.image_mem;
	gfxvidinfo.rowbytes = ami_dinfo.ximg->bytes_per_line;
	if (currprefs.x11_use_low_bandwidth) {
	    write_log ("Doing low-bandwidth output.\n");
	    gfxvidinfo.maxblocklines = 0;
	    gfxvidinfo.rowbytes = ami_dinfo.ximg->bytes_per_line;
	    gfxvidinfo.linemem = malloc (gfxvidinfo.rowbytes);

	    if (shmavail && currprefs.x11_use_mitshm) {
		switch (gfxvidinfo.pixbytes) {
		    case 4  : gfxvidinfo.flush_line = x11_flush_line_lbw_32bit_mitshm; break;
		    case 2  : gfxvidinfo.flush_line = x11_flush_line_lbw_16bit_mitshm; break;
		    default : gfxvidinfo.flush_line = x11_flush_line_lbw_8bit_mitshm;  break;
		}
	    } else {
		switch (gfxvidinfo.pixbytes) {
		    case 4  : gfxvidinfo.flush_line = x11_flush_line_lbw_32bit; break;
		    case 2  : gfxvidinfo.flush_line = x11_flush_line_lbw_16bit; break;
		    default : gfxvidinfo.flush_line = x11_flush_line_lbw_8bit;	break;
		}
	    }
	} else {
	    gfxvidinfo.maxblocklines = MAXBLOCKLINES_MAX;

	    if (shmavail && currprefs.x11_use_mitshm)
		gfxvidinfo.flush_block  = x11_flush_block_mitshm;
	    else
		gfxvidinfo.flush_block  = x11_flush_block;
	}
    }

    if (visualInfo.VI_CLASS != TrueColor && ! screen_is_picasso) {
	int i;
	for (i = 0; i < 256; i++)
	    XStoreColor (display, cmap, parsed_xcolors + i);
    }

#ifdef USE_DGA_EXTENSION
    if (dgamode) {
	dga_colormap_installed = 0;
	XF86DGAInstallColormap (display, screen, cmap2);
	XF86DGAInstallColormap (display, screen, cmap);
    }
#endif

    if (! dgamode) {
	if (!currprefs.hide_cursor)
	    XDefineCursor (display, mywin, xhairCursor);
	else
	    XDefineCursor (display, mywin, blankCursor);
	cursorOn = 1;
    }

    mousehack = !dgamode;

    if (screen_is_picasso) {
	picasso_has_invalid_lines = 0;
	picasso_invalid_start = picasso_vidinfo.height + 1;
	picasso_invalid_stop = -1;
	memset (picasso_invalid_lines, 0, sizeof picasso_invalid_lines);
    } else
	reset_drawing ();

    inwindow = 0;
    inputdevice_release_all_keys ();
    reset_hotkeys ();
}
Пример #20
0
static int create_test(const char* src, const char* dst_png, const char* dst_bmp)
{
	int rc = -1;
	int ret = -1;
	int status;
	size_t bsize;
	void* buffer = NULL;
	wImage* image = NULL, *image2 = NULL, *image3 = NULL, *image4 = NULL;

	if (!PathFileExistsA(src))
	{
		fprintf(stderr, "File %s does not exist!", src);
		return -1;
	}

	image = get_image(src);

	/* Read from file using image methods. */
	if (!image)
		goto cleanup;

	/* Write different formats to tmp. */
	image->type = WINPR_IMAGE_BITMAP;
	status = winpr_image_write(image, dst_bmp);

	if (status < 0)
	{
		fprintf(stderr, "Failed to write image %s!\n", dst_bmp);
		goto cleanup;
	}

	image->type = WINPR_IMAGE_PNG;
	status = winpr_image_write(image, dst_png);

	if (status < 0)
	{
		fprintf(stderr, "Failed to write image %s!\n", dst_png);
		goto cleanup;
	}

	/* Read image from buffer, compare. */
	buffer = read_image(src, &bsize);

	if (!buffer)
	{
		fprintf(stderr, "Failed to read image %s!\n", src);
		goto cleanup;
	}

	image2 = winpr_image_new();

	if (!image2)
	{
		fprintf(stderr, "Failed to create image!\n");
		goto cleanup;
	}

	status = winpr_image_read_buffer(image2, buffer, bsize);

	if (status < 0)
	{
		fprintf(stderr, "Failed to read buffer!\n");
		goto cleanup;
	}

	rc = img_compare(image, image2, TRUE);

	if (rc)
		goto cleanup;

	image3 = get_image(dst_png);

	if (!image3)
		goto cleanup;

	rc = img_compare(image, image3, TRUE);

	if (rc)
		goto cleanup;

	image4 = get_image(dst_bmp);

	if (!image4)
		goto cleanup;

	rc = img_compare(image, image4, TRUE);

	if (rc)
		goto cleanup;

	ret = 0;
cleanup:

	if (image)
		winpr_image_free(image, TRUE);

	if (image2)
		winpr_image_free(image2, TRUE);

	if (image3)
		winpr_image_free(image3, TRUE);

	if (image4)
		winpr_image_free(image4, TRUE);

	free(buffer);
	return ret;
}
surface getMinimap(int w, int h, const gamemap &map, const team *vw)
{
	const int scale = 8;

	DBG_DP << "creating minimap " << int(map.w()*scale*0.75) << "," << int(map.h()*scale) << "\n";

	const size_t map_width = map.w()*scale*3/4;
	const size_t map_height = map.h()*scale;
	if(map_width == 0 || map_height == 0) {
		return surface(NULL);
	}

	surface minimap(create_neutral_surface(map_width, map_height));
	if(minimap == NULL)
		return surface(NULL);

	typedef mini_terrain_cache_map cache_map;
	cache_map *normal_cache = &mini_terrain_cache;
	cache_map *fog_cache = &mini_fogged_terrain_cache;

	for(int y = 0; y != map.total_height(); ++y) {
		for(int x = 0; x != map.total_width(); ++x) {

			surface surf(NULL);

			const map_location loc(x,y);
			if(map.on_board(loc)) {

				const bool shrouded = (vw != NULL && vw->shrouded(loc));
				// shrouded hex are not considered fogged (no need to fog a black image)
				const bool fogged = (vw != NULL && !shrouded && vw->fogged(loc));
				const t_translation::t_terrain terrain = shrouded ?
						t_translation::VOID_TERRAIN : map[loc];
				const terrain_type& terrain_info = map.get_terrain_info(terrain);

				bool need_fogging = false;

				cache_map* cache = fogged ? fog_cache : normal_cache;
				cache_map::iterator i = cache->find(terrain);

				if (fogged && i == cache->end()) {
					// we don't have the fogged version in cache
					// try the normal cache and ask fogging the image
					cache = normal_cache;
					i = cache->find(terrain);
					need_fogging = true;
				}

				if(i == cache->end()) {
					std::string base_file =
							"terrain/" + terrain_info.minimap_image() + ".png";
					surface tile = get_image(base_file,image::HEXED);

					//Compose images of base and overlay if necessary
					// NOTE we also skip overlay when base is missing (to avoid hiding the error)
					if(tile != NULL && map.get_terrain_info(terrain).is_combined()) {
						std::string overlay_file =
								"terrain/" + terrain_info.minimap_image_overlay() + ".png";
						surface overlay = get_image(overlay_file,image::HEXED);

						if(overlay != NULL && overlay != tile) {
							surface combined = create_compatible_surface(tile, tile->w, tile->h);
							SDL_Rect r = create_rect(0,0,0,0);
							sdl_blit(tile, NULL, combined, &r);
							r.x = std::max(0, (tile->w - overlay->w)/2);
							r.y = std::max(0, (tile->h - overlay->h)/2);
							//blit_surface needs neutral surface
							surface overlay_neutral = make_neutral_surface(overlay);
							blit_surface(overlay_neutral, NULL, combined, &r);
							tile = combined;
						}
					}

					surf = scale_surface(tile, scale, scale);

					i = normal_cache->insert(cache_map::value_type(terrain,surf)).first;
				}

				surf = i->second;

				if (need_fogging) {
					surf = adjust_surface_color(surf,-50,-50,-50);
					fog_cache->insert(cache_map::value_type(terrain,surf));
				}

				// we need a balanced shift up and down of the hexes.
				// if not, only the bottom half-hexes are clipped
				// and it looks asymmetrical.

				// also do 1-pixel shift because the scaling
				// function seems to do it with its rounding
				SDL_Rect maprect = create_rect(
						  x * scale * 3 / 4 - 1
						, y * scale + scale / 4 * (is_odd(x) ? 1 : -1) - 1
						, 0
						, 0);

				if(surf != NULL)
					sdl_blit(surf, NULL, minimap, &maprect);
			}
		}
	}

	double wratio = w*1.0 / minimap->w;
	double hratio = h*1.0 / minimap->h;
	double ratio = std::min<double>(wratio, hratio);

	minimap = scale_surface(minimap,
		static_cast<int>(minimap->w * ratio), static_cast<int>(minimap->h * ratio));

	DBG_DP << "done generating minimap\n";

	return minimap;
}