예제 #1
0
파일: screen.c 프로젝트: Hoffa/nFrotz
static void set_window (zword win)
{

    flush_buffer ();

    cwin = win; cwp = wp + win;

    update_attributes ();

    if (h_version == V6) {

        os_set_colour (lo (cwp->colour), hi (cwp->colour));

        if (os_font_data (cwp->font, &font_height, &font_width))
            os_set_font (cwp->font);

        os_set_text_style (cwp->style);

    } else refresh_text_style ();

    if (h_version != V6 && win != 0) {
        wp[win].y_cursor = 1;
        wp[win].x_cursor = 1;
    }

    update_cursor ();

}/* set_window */
예제 #2
0
파일: events.c 프로젝트: Torture/MegaTunix
EXPORT gboolean create_new_gauge(GtkWidget * widget, gpointer data)
{
	GtkWidget *tmp = NULL;
	GladeXML *xml = glade_get_widget_tree(widget);
	GtkWidget *parent = glade_xml_get_widget(xml,"gauge_frame");
	gauge = mtx_gauge_face_new();
	gtk_widget_set_events(gauge,GDK_POINTER_MOTION_HINT_MASK
			| GDK_POINTER_MOTION_MASK
			| GDK_BUTTON_PRESS_MASK
			| GDK_BUTTON_RELEASE_MASK);
	g_signal_connect(GTK_WIDGET(gauge),"motion_notify_event",G_CALLBACK(gauge_motion),NULL);
	g_signal_connect(GTK_WIDGET(gauge),"button_press_event",G_CALLBACK(gauge_button),NULL);
	gtk_container_add(GTK_CONTAINER(parent),gauge);
	gtk_widget_show_all(parent);
	mtx_gauge_face_redraw_canvas(MTX_GAUGE_FACE(gauge));
	gauge_loaded = TRUE;

	gtk_widget_set_sensitive(glade_xml_get_widget(xml,"tab_notebook"),TRUE);
	gtk_widget_set_sensitive(glade_xml_get_widget(xml,"animate_frame"),TRUE);

	gtk_widget_set_sensitive(glade_xml_get_widget(xml,"new_gauge_menuitem"),FALSE);

	gtk_widget_set_sensitive(glade_xml_get_widget(xml,"close_gauge_menuitem"),TRUE);

	gtk_widget_set_sensitive(glade_xml_get_widget(xml,"load_gauge_menuitem"),FALSE);

	gtk_widget_set_sensitive(glade_xml_get_widget(xml,"save_gauge_menuitem"),TRUE);

	gtk_widget_set_sensitive(glade_xml_get_widget(xml,"save_as_menuitem"),TRUE);

	update_attributes();
	return (TRUE);
}
예제 #3
0
파일: screen.c 프로젝트: Hoffa/nFrotz
void z_window_style (void)
{
    zword win = winarg0 ();
    zword flags = zargs[1];

    flush_buffer ();

    /* Supply default arguments */

    if (zargc < 3)
        zargs[2] = 0;

    /* Set window style */

    switch (zargs[2]) {
        case 0: wp[win].attribute = flags; break;
        case 1: wp[win].attribute |= flags; break;
        case 2: wp[win].attribute &= ~flags; break;
        case 3: wp[win].attribute ^= flags; break;
    }

    if (cwin == win)
        update_attributes ();

}/* z_window_style */
예제 #4
0
G_MODULE_EXPORT gboolean generic_spin_button_handler(GtkWidget *widget, gpointer data)
{
	gfloat tmpf = 0.0;
	MtxGaugeFace *g = NULL;
	gint handler = 0;

	tmpf = (gfloat)gtk_spin_button_get_value((GtkSpinButton *)widget);
	if (!OBJ_GET((widget),"handler"))
	{
		printf("control %s has no handler\n",(gchar *)gtk_widget_get_name(widget));
		return FALSE;
	}
	handler = (GINT)OBJ_GET((widget),"handler");

	if (GTK_IS_WIDGET(gauge))
		g = MTX_GAUGE_FACE(gauge);
	else
		return FALSE;

	if (hold_handlers)
		return TRUE;
	changed = TRUE;
	mtx_gauge_face_set_attribute(g,handler,tmpf);
	if ((handler == UBOUND) || (handler == LBOUND))
		update_attributes();
	return TRUE;
}
예제 #5
0
파일: color_scheme.c 프로젝트: KryDos/vifm
int
load_primary_color_scheme(const char name[])
{
	col_scheme_t prev_cs;
	char full[PATH_MAX];

	if(!color_scheme_exists(name))
	{
		show_error_msgf("Color Scheme", "Invalid color scheme name: \"%s\"", name);
		return 0;
	}

	prev_cs = cfg.cs;
	curr_stats.cs_base = DCOLOR_BASE;
	curr_stats.cs = &cfg.cs;
	cfg.cs.state = CSS_LOADING;

	snprintf(full, sizeof(full), "%s/colors/%s", cfg.config_dir, name);
	if(source_file(full) != 0)
	{
		restore_primary_color_scheme(&prev_cs);
		show_error_msgf("Color Scheme Sourcing",
				"Errors loading colors cheme: \"%s\"", name);
		cfg.cs.state = CSS_NORMAL;
		return 0;
	}
	copy_str(cfg.cs.name, sizeof(cfg.cs.name), name);
	check_color_scheme(&cfg.cs);

	update_attributes();

	if(curr_stats.load_stage >= 2 && cfg.cs.state == CSS_DEFAULTED)
	{
		restore_primary_color_scheme(&prev_cs);
		show_error_msg("Color Scheme Error", "Not supported by the terminal");
		return 0;
	}

	cfg.cs.state = CSS_NORMAL;
	return 0;
}
예제 #6
0
int
load_primary_color_scheme(const char name[])
{
	col_scheme_t prev_cs = {};

	if(!color_scheme_exists(name))
	{
		show_error_msgf("Color Scheme", "Invalid color scheme name: \"%s\"", name);
		return 0;
	}

	assign_color_scheme(&prev_cs, &cfg.cs);
	curr_stats.cs = &cfg.cs;
	cfg.cs.state = CSS_LOADING;

	if(source_cs(name) != 0)
	{
		restore_primary_color_scheme(&prev_cs);
		show_error_msgf("Color Scheme Sourcing",
				"An error occurred on loading color scheme: \"%s\"", name);
		cfg.cs.state = CSS_NORMAL;
		return 0;
	}
	copy_str(cfg.cs.name, sizeof(cfg.cs.name), name);
	check_color_scheme(&cfg.cs);

	update_attributes();

	if(cfg.cs.state == CSS_DEFAULTED)
	{
		restore_primary_color_scheme(&prev_cs);
		show_error_msgf("Color Scheme Error",
				"\"%s\" color scheme is not supported by the terminal, restored \"%s\"",
				name, prev_cs.name);
		return 0;
	}

	free_color_scheme_highlights(&prev_cs);
	cfg.cs.state = CSS_NORMAL;
	return 0;
}
예제 #7
0
int GrowWindow::set_source( char *source, char *new_owner)
{
    int clip_removed = 0;

    if ( ctx->gdraw->clip_level( &ctx->mw)) {
        // Remove any clip
        ctx->gdraw->reset_clip_rectangle( &ctx->mw);
        clip_removed = 1;
    }

    strcpy( input_file_name, source);
    if ( new_owner)
        strncpy( owner, new_owner, sizeof(owner));
    update_attributes();
    draw();

    if ( clip_removed)
        // Set a clip to match the previous reset
        ctx->gdraw->set_clip_rectangle( &ctx->mw, 0, 0, ctx->mw.window_width, ctx->mw.window_height);

    return 1;
}
예제 #8
0
파일: screen.c 프로젝트: BAM-X/frotz
/*
 * z_buffer_mode, turn text buffering on/off.
 *
 *	zargs[0] = new text buffering flag (0 or 1)
 *
 */
void z_buffer_mode (void)
{
    /* Infocom's V6 games rarely use the buffer_mode opcode. If they do
       then only to print text immediately, without any delay. This was
       used to give the player some sign of life while the game was
       spending much time on parsing a complicated input line. (To turn
       off word wrapping, V6 games use the window_style opcode instead.)
       Today we can afford to ignore buffer_mode in V6. */

    if (h_version != V6) {

	flush_buffer ();

	wp[0].attribute &= ~8;

	if (zargs[0] != 0)
	    wp[0].attribute |= 8;

	update_attributes ();

    }

}/* z_buffer_mode */