Example #1
0
void ColorPicker::_notification(int p_what) {

	switch (p_what) {
		case NOTIFICATION_THEME_CHANGED: {

			btn_pick->set_icon(get_icon("screen_picker", "ColorPicker"));
			bt_add_preset->set_icon(get_icon("add_preset"));

			_update_controls();
		} break;
		case NOTIFICATION_ENTER_TREE: {

			btn_pick->set_icon(get_icon("screen_picker", "ColorPicker"));
			bt_add_preset->set_icon(get_icon("add_preset"));

			_update_color();

#ifdef TOOLS_ENABLED
			if (Engine::get_singleton()->is_editor_hint()) {
				PoolColorArray saved_presets = EditorSettings::get_singleton()->get_project_metadata("color_picker", "presets", PoolColorArray());

				for (int i = 0; i < saved_presets.size(); i++) {
					add_preset(saved_presets[i]);
				}
			}
#endif
		} break;
		case NOTIFICATION_PARENTED: {

			for (int i = 0; i < 4; i++)
				set_margin((Margin)i, get_constant("margin"));
		} break;
		case NOTIFICATION_VISIBILITY_CHANGED: {

			Popup *p = Object::cast_to<Popup>(get_parent());
			if (p)
				p->set_size(Size2(get_combined_minimum_size().width + get_constant("margin") * 2, get_combined_minimum_size().height + get_constant("margin") * 2));
		} break;
		case MainLoop::NOTIFICATION_WM_QUIT_REQUEST: {

			if (screen != NULL) {
				if (screen->is_visible()) {
					screen->hide();
				}
			}
		} break;
	}
}
Example #2
0
void ColorPicker::_add_preset_pressed() {
	add_preset(color);
	emit_signal("preset_added", color);
}
Example #3
0
static int
build_tables( void )
{
	int i;
	int regno;
	int npic;
	einfo_t *ep;
	int n;
	int npresets;
	npic = cpc_getnpic( cpuver );
	nctrs = 0;
	for ( regno = 0; regno < npic; ++regno ) {
		cpc_walk_names( cpuver, regno, 0, action );
	}
	SUBDBG( "%d counters\n", nctrs );
	if ( ( ctrs = papi_malloc( nctrs * sizeof ( struct ctr_info ) ) ) == 0 ) {
		return PAPI_ENOMEM;
	}
	nctrs = 0;
	for ( regno = 0; regno < npic; ++regno ) {
		cpc_walk_names( cpuver, regno, ( void * ) 1, action );
	}
	SUBDBG( "%d counters\n", nctrs );
#if DEBUG
	if ( ISLEVEL( DEBUG_SUBSTRATE ) ) {
		for ( i = 0; i < nctrs; ++i ) {
			SUBDBG( "%s: bits (%x,%x) pics %x\n", ctrs[i].name, ctrs[i].bits[0],
					ctrs[i].bits[1], ctrs[i].bitmask );
		}
	}
#endif
	/* Build the native event table */
	if ( ( native_table =
		   papi_malloc( nctrs * sizeof ( native_info_t ) ) ) == 0 ) {
		papi_free( ctrs );
		return PAPI_ENOMEM;
	}
	for ( i = 0; i < nctrs; ++i ) {
		native_table[i].name[39] = 0;
		strncpy( native_table[i].name, ctrs[i].name, 39 );
		if ( ctrs[i].bitmask & 1 )
			native_table[i].encoding[0] = ctrs[i].bits[0];
		else
			native_table[i].encoding[0] = -1;
		if ( ctrs[i].bitmask & 2 )
			native_table[i].encoding[1] = ctrs[i].bits[1];
		else
			native_table[i].encoding[1] = -1;
	}
	papi_free( ctrs );

	/* Build the preset table */
	if ( cpuver <= CPC_ULTRA2 ) {
		n = sizeof ( us2info ) / sizeof ( einfo_t );
		ep = us2info;
	} else if ( cpuver <= LASTULTRA3 ) {
		n = sizeof ( us3info ) / sizeof ( einfo_t );
		ep = us3info;
	} else
		return PAPI_ESBSTR;
	preset_table = papi_malloc( ( n + 1 ) * sizeof ( hwi_search_t ) );
	npresets = 0;
	for ( i = 0; i < n; ++i ) {
		add_preset( preset_table, &npresets, ep[i] );
	}
	memset( &preset_table[npresets], 0, sizeof ( hwi_search_t ) );

#ifdef DEBUG
	if ( ISLEVEL( DEBUG_SUBSTRATE ) ) {
		SUBDBG( "Native table: %d\n", nctrs );
		for ( i = 0; i < nctrs; ++i ) {
			SUBDBG( "%40s: %8x %8x\n", native_table[i].name,
					native_table[i].encoding[0], native_table[i].encoding[1] );
		}
		SUBDBG( "\nPreset table: %d\n", npresets );
		for ( i = 0; preset_table[i].event_code != 0; ++i ) {
			SUBDBG( "%8x: op %2d e0 %8x e1 %8x\n",
					preset_table[i].event_code,
					preset_table[i].data.derived,
					preset_table[i].data.native[0],
					preset_table[i].data.native[1] );
		}
	}
#endif

	_solaris_vector.cmp_info.num_native_events = nctrs;

	return PAPI_OK;
}
Example #4
0
void format_t::init_presets()
{
	static bool inited = false;
	
	if( !inited)
	{
		// make a small list of presets inline.
		add_preset( preset_type( "PAL Square: 768 x 576"		, format_t( 768, 576, 1.0f)));
		add_preset( preset_type( "PAL D1: 720 x 576 x 1.067"	, format_t( 720, 576, 1.067f)));
		add_preset( preset_type( "PAL 16:9: 720 x 576 x 1.422"	, format_t( 720, 576, 1.422f)));
		
		add_preset( preset_type( "NTSC Square: 640 x 486"		, format_t( 640, 486, 1.0f)));
		add_preset( preset_type( "NTSC D1: 720 x 486 x 0.9"		, format_t( 720, 486, 0.9f)));
		add_preset( preset_type( "NTSC 16:9: 720 x 486 x 1.21"	, format_t( 720, 486, 1.21f)));

		add_preset( preset_type( "HD 720: 1280 x 720"	, format_t( 1280, 720, 1.0f)));
		add_preset( preset_type( "HD 1080: 1440 x 1080"	, format_t( 1440, 1080, 1.33f)));
		add_preset( preset_type( "HD 1080: 1920 x 1080"	, format_t( 1920, 1080, 1.0f)));
	
		add_preset( preset_type( "2K Super35: 2048 x 1556"			, format_t( 2048, 1556, 1.0f)));
		add_preset( preset_type( "2K Cinemascope: 1828 x 1556 x 2.0", format_t( 1828, 1556, 2.0f)));
			
		add_preset( preset_type( "4K Super35: 4096 x 3112"			, format_t( 4096, 3112, 1.0f)));
		add_preset( preset_type( "4K Cinemascope: 3656 x 3112 x 2.0", format_t( 3656, 3112, 2.0f)));
			
		add_preset( preset_type( "Cineon Full: 3656 x 2664"	, format_t( 3656, 2664, 1.0f)));
		inited = true;
	}
}
Example #5
0
void ColorPicker::_add_preset_pressed() {
	add_preset(color);
}