Exemplo n.º 1
0
void size_callb (gpointer data,GtkWidget *wdg) {
	// Sets size when creating a new HF
	gint hf_size;
	static gchar area_label[12];
	omenu_struct_type *opt_menu;
	hf_wrapper_struct *hfw;
	hf_options_struct *hfo;
	opt_menu = (omenu_struct_type *) data;
//	printf("DATA in SIZE_CALLB: %d;\n",data);
	hfo = (hf_options_struct *) opt_menu->data;
//	printf("HFO in SIZE_CALLB: %d;\n",hfo);
	if (!hfo)
		return;

	hfw = (hf_wrapper_struct *) * (hf_wrapper_struct **)  hfo->hfw_ptr_ptr;

	hf_size = opt_menu->list[opt_menu->current_index].num;
	if (!hfw)
		return;
	if (!hfw->hf_struct)
		return;
	if (hf_size == hfw->hf_struct->max_x)
		//	No change!
		return;

	sprintf(area_label, "%d x %d", hf_size, hf_size);
	gtk_frame_set_label(GTK_FRAME(hfw->draw_area_frame), area_label);

	hf_free(hfw->hf_struct);
	hfw->hf_options->hf_size = hf_size;
	hfw->hf_struct = (hf_struct_type *) hf_new(hf_size);
	hfw->display_scale = get_display_scale(hf_size);
	hfw->hf_buf8 = (unsigned char *) x_malloc((RIGHT_SHIFT(hf_size, hfw->display_scale)) * (RIGHT_SHIFT(hf_size,hfw->display_scale))*sizeof(unsigned char), "unsigned char (hfw->buf8 in size_callb)");
	hfw->if_rgb = FALSE;
	hfw->area_size = RIGHT_SHIFT(hf_size,hfw->display_scale);
	set_current_button (hfw->sbs, hfw->display_scale);
	hfw->size_change_request = TRUE;
	
	gtk_widget_set_size_request (hfw->draw_area_frame, hfw->area_size+SCALE_PAD, hfw->area_size+SCALE_PAD);

//	printf("SIZE_CALLB: HFW: %d; HF_SIZE: %d; DISPLAY_SCALE: %d; AREA_SIZE: %d\n", hfw, hf_size, hfw->display_scale, hfw->area_size);
	
	init_render_struct(hfw->hf_options->render_str, 
		hfw->dirname, 
		hfw->filename, 
		&hfw->creation_mode,
		hfw->if_modified,
		hfw->gl_preview,
		hfw->hf_struct->hf_buf,
		hfw->hf_struct->max_x,
		hfw->hf_struct->max_y);

	gl_set_input_grid (hfw->gl_preview, hfw->hf_struct->hf_buf, hfw->hf_struct->max_x, hfw->hf_struct->max_y, HF_TYPE_ID);
	gl_update_details_display (hfw->gl_preview);
	gtk_drawing_area_size(GTK_DRAWING_AREA(hfw->area), 
		hfw->area_size, hfw->area_size);
}
Exemplo n.º 2
0
/* substitutive functions */
void HFObjectDestroy(hf_voptr vself)
{
    hf_free(vself);
}