Beispiel #1
0
int init_colors() /* {{{ */
{
	/* initialize curses colors */
	int ret;
	use_colors = false;

	/* attempt to start colors */
	ret = start_color();
	if (ret == ERR)
		return 1;

	/* apply default colors */
	ret = use_default_colors();
	if (ret == ERR)
		return 2;

	/* check if terminal has color capabilities */
	use_colors = has_colors();
	colors_initialized = true;
	if (use_colors)
	{
		/* allocate pairs_used */
		pairs_used = calloc(COLOR_PAIRS, sizeof(bool));
		pairs_used[0] = true;

		return set_default_colors();
	}
	else
		return 3;
} /* }}} */
Beispiel #2
0
void themes_switch_theme (const char *file)
{
	if (has_colors()) {
		reset_colors_table ();
		if (!load_color_theme(file, 0)) {
			interface_error ("Error loading theme!");
			reset_colors_table ();
		}

		set_default_colors ();
	}
}
Beispiel #3
0
void theme_init (bool has_xterm)
{
	reset_colors_table ();

	if (has_colors()) {
		if (options_get_str("ForceTheme"))
			load_color_theme (options_get_str("ForceTheme"), 1);
		else if (has_xterm && options_get_str("XTermTheme"))
			load_color_theme (options_get_str("XTermTheme"), 1);
		else if (options_get_str("Theme"))
			load_color_theme (options_get_str("Theme"), 1);

		set_default_colors ();
	}
	else
		set_bw_colors ();
}
Beispiel #4
0
void test_colors(Raster *r)
/*****************************************************************************
 *
 ****************************************************************************/
{
Rastlib 	*rlib = r->lib;
short		counter;
Vsyncfunc_t wait_vsync;
Colorfunc_t set_colors;
UBYTE		cmap[COLORS][CHANNELS];
int 		i,j;

	wait_vsync = rlib->wait_vsync;
	set_colors = rlib->set_colors;

	log_progress("Testing wait_vsync()...\n");
	counter = 30;
	while (--counter)
		wait_vsync(r);
	log_progress("...wait_vsync() testing complete.\n\n");

	log_start("Testing set_colors()...\n");

	for (j=0; j<CHANNELS; j++)
		{
		ramp_cmap(cmap, j);
		for (i=0; i<COLORS; i+=2)
			{
			wait_vsync(r);
			set_colors(r, 0, COLORS, cmap);
			cycle_cmap(cmap);
			}
		}

	log_end("...testing of set_colors() complete.\n\n");

	set_default_colors(r);

}
Beispiel #5
0
void
NodeView::on_property(machina::URIInt key, const Atom& value)
{
	static const uint32_t active_color        = 0x408040FF;
	static const uint32_t active_border_color = 0x00FF00FF;

	if (key == URIs::instance().machina_selector) {
		if (value.get<int32_t>()) {
			set_dash_length(4.0);
		} else {
			set_dash_length(0.0);
		}
	} else if (key == URIs::instance().machina_initial) {
		set_border_width(value.get<int32_t>() ? 4.0 : 1.0);
		set_is_source(value.get<int32_t>());
	} else if (key == URIs::instance().machina_active) {
		if (value.get<int32_t>()) {
			if (get_fill_color() != active_color) {
				set_fill_color(active_color);
				set_border_color(active_border_color);
			}
		} else if (get_fill_color() == active_color) {
			set_default_colors();
		}
	} else if (key == URIs::instance().machina_enter_action) {
		const uint64_t action_id = value.get<int32_t>();
		MachinaCanvas* canvas    = dynamic_cast<MachinaCanvas*>(this->canvas());
		_enter_action_connection.disconnect();
		_enter_action = canvas->app()->client_model()->find(action_id);
		if (_enter_action) {
			_enter_action_connection = _enter_action->signal_property.connect(
				sigc::mem_fun(this, &NodeView::on_action_property));
			for (auto i : _enter_action->properties()) {
				on_action_property(i.first, i.second);
			}
		}
	}
}