Ejemplo n.º 1
0
void 
init_ASWallpaper()
{
	memset( &WallpaperState, 0x00, sizeof(ASWallpaperState));
	
	create_main_window(); 
	create_backs_list();
	create_list_preview();
	
	WallpaperState.sel_apply_button = asgtk_add_button_to_box( NULL, GTK_STOCK_APPLY, NULL, G_CALLBACK(on_list_apply_clicked), WallpaperState.backs_list );
	WallpaperState.make_xml_button = asgtk_add_button_to_box( NULL, GTK_STOCK_PROPERTIES, "Make XML", G_CALLBACK(on_make_xml_clicked), WallpaperState.backs_list );
	WallpaperState.edit_xml_button = asgtk_add_button_to_box( NULL, GTK_STOCK_PROPERTIES, "Edit XML", G_CALLBACK(on_edit_xml_clicked), WallpaperState.backs_list );
	WallpaperState.make_mini_button = asgtk_add_button_to_box( NULL, GTK_STOCK_PROPERTIES, "Make mini", G_CALLBACK(on_make_mini_clicked), WallpaperState.backs_list );
	
	WallpaperState.sel_del_button = asgtk_add_button_to_box( NULL, GTK_STOCK_DELETE, NULL, G_CALLBACK(on_list_del_clicked), WallpaperState.backs_list );

	gtk_widget_hide(WallpaperState.edit_xml_button);

	asgtk_image_view_add_tool( ASGTK_IMAGE_VIEW(WallpaperState.list_preview), WallpaperState.sel_apply_button, 0 );
	asgtk_image_view_add_tool( ASGTK_IMAGE_VIEW(WallpaperState.list_preview), WallpaperState.make_mini_button, 5 );
	asgtk_image_view_add_tool( ASGTK_IMAGE_VIEW(WallpaperState.list_preview), WallpaperState.make_xml_button, 5 );
	asgtk_image_view_add_tool( ASGTK_IMAGE_VIEW(WallpaperState.list_preview), WallpaperState.edit_xml_button, 5 );
	asgtk_image_view_add_tool( ASGTK_IMAGE_VIEW(WallpaperState.list_preview), WallpaperState.sel_del_button, 5 );
	
	asgtk_image_dir_set_sel_handler( ASGTK_IMAGE_DIR(WallpaperState.backs_list), backs_list_sel_handler, WallpaperState.list_preview);

	reload_private_backs_list();

	g_signal_connect (G_OBJECT (WallpaperState.main_window), "destroy", G_CALLBACK (on_destroy), NULL);
  	gtk_widget_show (WallpaperState.main_window);
}	 
Ejemplo n.º 2
0
static void
asgtk_imview_view_size_alloc (GtkWidget * widget,
															GtkAllocation * allocation,
															gpointer user_data)
{
	ASGtkImageView *iv = ASGTK_IMAGE_VIEW (user_data);
	int view_w, view_h;
	int w = allocation->width - 4;
	int h = allocation->height - 4;

	(void) view_w;
	(void) view_h;
	view_w = GTK_WIDGET (iv->view)->requisition.width;
	view_h = GTK_WIDGET (iv->view)->requisition.height;

	LOCAL_DEBUG_OUT ("####!!! SizeAlloc for %p is %dx%d%+d%+d", widget,
									 allocation->width, allocation->height, allocation->x,
									 allocation->y);
	LOCAL_DEBUG_OUT ("####!!! recquisition was %dx%d",
									 widget->requisition.width, widget->requisition.height);
	LOCAL_DEBUG_OUT ("####!!! view size is     %dx%d", iv->view_width,
									 iv->view_height);

#if 1														/* if size changed - refresh */
	if (iv->view_width != w || iv->view_height != h) {
		iv->view_width = w;
		iv->view_height = h;
		display_image_view (iv);
	}
#endif
}
Ejemplo n.º 3
0
void 
create_list_preview()
{
	int preview_width ; 

	WallpaperState.list_preview = asgtk_image_view_new();
	preview_width = (INITIAL_PREVIEW_HEIGHT *Scr.MyDisplayWidth)/Scr.MyDisplayHeight ;
	gtk_widget_set_size_request (WallpaperState.list_preview, preview_width, INITIAL_PREVIEW_HEIGHT);
	asgtk_image_view_set_aspect (ASGTK_IMAGE_VIEW(WallpaperState.list_preview), Scr.MyDisplayWidth, Scr.MyDisplayHeight );
	asgtk_image_view_set_resize (ASGTK_IMAGE_VIEW(WallpaperState.list_preview), 
								 ASGTK_IMAGE_VIEW_SCALE_TO_VIEW|
								 ASGTK_IMAGE_VIEW_TILE_TO_ASPECT, ASGTK_IMAGE_VIEW_RESIZE_ALL );
  	gtk_box_pack_end (GTK_BOX (WallpaperState.list_hbox), WallpaperState.list_preview, TRUE, TRUE, 0);
	gtk_widget_show (WallpaperState.list_preview);

}
Ejemplo n.º 4
0
static void asgtk_image_view_dispose (GObject * object)
{
	ASGtkImageView *iv = ASGTK_IMAGE_VIEW (object);

	unref_asimage_list_entry (iv->image_entry);
	iv->image_entry = NULL;
	G_OBJECT_CLASS (parent_class)->dispose (object);
}
Ejemplo n.º 5
0
static void
filelist_sel_handler(ASGtkImageDir *id, gpointer user_data)
{
	ASFileBrowserMainFrame *data = (ASFileBrowserMainFrame *)user_data;
	if( data ) 
	{	
		ASImageListEntry *le = asgtk_image_dir_get_selection( id ); 
		if( le )
		{
			if( le->type != ASIT_XMLScript ) 
			{	
				gtk_widget_hide( data->view_xml );
				asgtk_xml_view_set_entry ( ASGTK_XML_VIEW(data->view_xml), NULL );
			}else
			{	
				gtk_widget_show( data->view_xml );
				asgtk_xml_view_set_entry ( ASGTK_XML_VIEW(data->view_xml), le );
			}

			if( le->type == ASIT_Unknown ) 
			{	
				gtk_widget_hide( data->view_image );
				asgtk_image_view_set_entry ( ASGTK_IMAGE_VIEW(data->view_image), NULL);
			}else
			{	
				gtk_widget_show( data->view_image );
				asgtk_image_view_set_entry ( ASGTK_IMAGE_VIEW(data->view_image), le);
			}
			load_asimage_list_entry_data( le, DEFAULT_MAX_TEXT_SIZE ); 
			if( !get_flags( le->buffer->flags, ASILEB_Binary)  )
			{                  /* use text view */
				gtk_widget_show( data->view_text_win );
				gtk_widget_hide( data->view_hex_win );
				gtk_text_buffer_set_text( data->text_buffer, le->buffer->data, le->buffer->size );
				gtk_text_view_set_buffer( GTK_TEXT_VIEW(data->view_text), data->text_buffer );
			}else
			{				   /* use hex view */	
				gtk_widget_show( data->view_hex_win );
				gtk_widget_hide( data->view_text_win );
				gtk_text_view_set_buffer( GTK_TEXT_VIEW(data->view_hex), data->text_buffer );
			}	 
			
			unref_asimage_list_entry( le );
		}
	}
}
Ejemplo n.º 6
0
void on_backgrounds_dir_changed( ASGtkXMLView *xv, gpointer user_data, Bool new_file)
{
	ASGtkImageDir *id = ASGTK_IMAGE_DIR(user_data);
	if( new_file ) 
		asgtk_image_dir_refresh( id );
	else
	{
		ASImageListEntry *le = asgtk_image_dir_get_selection( id );
		asgtk_image_view_set_entry ( ASGTK_IMAGE_VIEW(WallpaperState.list_preview), le);
		unref_asimage_list_entry( le );
	}	 
}	 
Ejemplo n.º 7
0
void
asgtk_image_view_scale_to_view_toggle (GtkWidget * checkbutton,
																			 gpointer data)
{
	ASGtkImageView *iv = ASGTK_IMAGE_VIEW (data);

	if (GTK_TOGGLE_BUTTON (checkbutton)->active)
		asgtk_image_view_set_resize (iv, ASGTK_IMAGE_VIEW_SCALE_TO_VIEW,
																 ASGTK_IMAGE_VIEW_SCALE_TO_VIEW);
	else
		asgtk_image_view_set_resize (iv, 0, ASGTK_IMAGE_VIEW_SCALE_TO_VIEW);
}
Ejemplo n.º 8
0
static void
asgtk_image_view_style_set (GtkWidget * widget, GtkStyle * prev_style)
{
	ASGtkImageView *iv = ASGTK_IMAGE_VIEW (widget);

	GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);

	gtk_widget_modify_bg (iv->view, GTK_STATE_NORMAL,
												&widget->style->base[GTK_STATE_NORMAL]);
	gtk_widget_modify_bg (iv->view, GTK_STATE_INSENSITIVE,
												&widget->style->base[GTK_STATE_NORMAL]);
}
Ejemplo n.º 9
0
void
asgtk_image_view_screen_aspect_toggle (GtkWidget * checkbutton,
																			 gpointer data)
{
	ASGtkImageView *iv = ASGTK_IMAGE_VIEW (data);

	if (GTK_TOGGLE_BUTTON (checkbutton)->active) {
		asgtk_image_view_set_aspect (iv, get_screen_width (NULL),
																 get_screen_height (NULL));
		asgtk_image_view_set_resize (iv, ASGTK_IMAGE_VIEW_TILE_TO_ASPECT,
																 ASGTK_IMAGE_VIEW_TILE_TO_ASPECT);
	} else {
		asgtk_image_view_set_aspect (iv, -1, -1);
		asgtk_image_view_set_resize (iv, 0, ASGTK_IMAGE_VIEW_TILE_TO_ASPECT);
	}
}
Ejemplo n.º 10
0
static void
backs_list_sel_handler(ASGtkImageDir *id, gpointer user_data)
{
	ASGtkImageView *iv = ASGTK_IMAGE_VIEW(user_data);
	ASImageListEntry *le;
	g_return_if_fail (ASGTK_IS_IMAGE_DIR (id));
	
	le = asgtk_image_dir_get_selection( id );
	asgtk_image_view_set_entry ( iv, le);

	if( le != NULL ) 
	{	
		if( WallpaperState.xml_editor && le->type == ASIT_XMLScript )
			asgtk_xml_editor_set_entry( ASGTK_XML_EDITOR( WallpaperState.xml_editor), le );
	
		if( iv ) 
		{	
			char *mini_fullname = NULL ; 
			Bool has_mini = False ; 
			if( le->type == ASIT_XMLScript ) 
			{	
				gtk_widget_show(WallpaperState.edit_xml_button);
				gtk_widget_hide(WallpaperState.make_xml_button);
			}else
			{
				gtk_widget_hide(WallpaperState.edit_xml_button);
				gtk_widget_show(WallpaperState.make_xml_button);
			}		   
			if( asgtk_image_dir_make_mini_names( id, le->name, NULL, &mini_fullname ) )
			{
				has_mini = ( CheckFile( mini_fullname ) == 0 );
				free( mini_fullname ); 				   
			}	 
			if( has_mini ) 
			{	
				gtk_button_set_label(GTK_BUTTON(WallpaperState.make_mini_button), "Update mini");
			}else
			{
				gtk_button_set_label(GTK_BUTTON(WallpaperState.make_mini_button), "Make mini");
			}		   
		}
		unref_asimage_list_entry( le );
	}
}
Ejemplo n.º 11
0
/*  public functions  */
GtkWidget * 
asgtk_gradient_new ()
{
	ASGtkGradient *ge;
    GtkWidget *main_vbox, *main_hbox;
	GtkWidget *scrolled_window ;
	GtkWidget *list_vbox ;
	GtkWidget *frame, *hbox, *vbox, *btn, *table;
	GtkWidget *label ; 

    ge = g_object_new (ASGTK_TYPE_GRADIENT, NULL);
	colorize_gtk_window( GTK_WIDGET(ge) );	
	gtk_container_set_border_width( GTK_CONTAINER (ge), 5 );
	
	main_vbox = GTK_DIALOG(ge)->vbox ; 

	main_hbox = gtk_hbox_new (FALSE, 5);
  	gtk_widget_show (main_hbox);
	gtk_box_pack_start (GTK_BOX (main_vbox), main_hbox, TRUE, TRUE, 0);
	
	list_vbox = gtk_vbox_new (FALSE, 0);
	gtk_box_pack_start (GTK_BOX (main_hbox), list_vbox, FALSE, FALSE, 0);

	frame = gtk_frame_new("Gradient direction : ");
	gtk_box_pack_start (GTK_BOX (list_vbox), frame, FALSE, FALSE, 5);
	
	table = gtk_table_new( 2, 2, FALSE );
	gtk_container_add (GTK_CONTAINER (frame), table);
	gtk_container_set_border_width (GTK_CONTAINER (table), 3);

	ge->l2r_radio = gtk_radio_button_new_with_label( NULL, "Left to Right" );
	gtk_table_attach_defaults (GTK_TABLE (table), ge->l2r_radio, 0, 1, 0, 1);
	ge->t2b_radio = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON(ge->l2r_radio), "Top to Bottom" );
	gtk_table_attach_defaults (GTK_TABLE (table), ge->t2b_radio, 0, 1, 1, 2);
	ge->tl2br_radio = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON(ge->t2b_radio), "Top-Left to Bottom-Right" );
	gtk_table_attach_defaults (GTK_TABLE (table), ge->tl2br_radio, 1, 2, 0, 1);
	ge->bl2tr_radio = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON(ge->tl2br_radio), "Bottom-Left to Top-Right" );
	gtk_table_attach_defaults (GTK_TABLE (table), ge->bl2tr_radio, 1, 2, 1, 2);
	gtk_widget_show_all (table);
	gtk_widget_show (table);
	colorize_gtk_widget( frame, get_colorschemed_style_normal() );

	g_signal_connect ((gpointer) ge->l2r_radio, "clicked", G_CALLBACK (on_direction_clicked), ge);
	g_signal_connect ((gpointer) ge->tl2br_radio, "clicked", G_CALLBACK (on_direction_clicked), ge);
	g_signal_connect ((gpointer) ge->t2b_radio, "clicked", G_CALLBACK (on_direction_clicked), ge);
	g_signal_connect ((gpointer) ge->bl2tr_radio, "clicked", G_CALLBACK (on_direction_clicked), ge);


	ge->screen_width_check = gtk_check_button_new_with_label("Use screen width");
	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(ge->screen_width_check), TRUE );
	ge->width_entry = gtk_spin_button_new_with_range( 1, 10000, 1 );
	gtk_widget_set_sensitive( ge->width_entry, FALSE );
	ge->screen_height_check = gtk_check_button_new_with_label("Use screen height");
	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(ge->screen_height_check), TRUE );
	ge->height_entry = gtk_spin_button_new_with_range( 1, 10000, 1 );
	gtk_widget_set_sensitive( ge->height_entry, FALSE );

   	g_signal_connect ((gpointer) ge->screen_width_check, "clicked", G_CALLBACK (on_size_clicked), ge);
	g_signal_connect ((gpointer) ge->screen_height_check, "clicked", G_CALLBACK (on_size_clicked), ge);


	ge->size_frame = gtk_frame_new("Rendered gradient size : ");
	gtk_box_pack_start (GTK_BOX (list_vbox), ge->size_frame, FALSE, FALSE, 5);
	colorize_gtk_tree_view_window( GTK_WIDGET(ge->size_frame) );

	table = gtk_table_new( 2, 4, FALSE );
	gtk_container_set_border_width( GTK_CONTAINER (table), 3 );
	gtk_container_add( GTK_CONTAINER(ge->size_frame), table );

	gtk_table_attach_defaults (GTK_TABLE (table), gtk_label_new("Width : "), 0, 1, 0, 1);   
	gtk_table_attach_defaults (GTK_TABLE (table), ge->width_entry, 1, 2, 0, 1);   
	gtk_table_attach_defaults (GTK_TABLE (table), gtk_label_new("Height : "), 2, 3, 0, 1);   
	gtk_table_attach_defaults (GTK_TABLE (table), ge->height_entry, 3, 4, 0, 1);  
	gtk_table_attach (GTK_TABLE (table), ge->screen_width_check, 0, 2, 1, 2, GTK_FILL, GTK_FILL, 10, 0);    
	gtk_table_attach (GTK_TABLE (table), ge->screen_height_check, 2, 4, 1, 2, GTK_FILL, GTK_FILL, 10, 0);    
	
	gtk_widget_show_all (table);
	gtk_widget_show (table);
	colorize_gtk_widget( ge->size_frame, get_colorschemed_style_normal() );

	scrolled_window = asgtk_gradient_create_color_list( ge );
	gtk_box_pack_start (GTK_BOX (list_vbox), scrolled_window, FALSE, FALSE, 0);
	
	ge->color_entry = gtk_entry_new_with_max_length(24);
	gtk_entry_set_width_chars( GTK_ENTRY(ge->color_entry), 16 );
#if 0
	ge->color_preview = gtk_color_button_new();
	g_signal_connect ((gpointer) ge->color_preview, "clicked", G_CALLBACK (on_color_preview_clicked), ge);
#else
	ge->color_preview = gtk_image_new();
	update_color_preview( ge, DEFAULT_COLOR_STR );
#endif

	ge->offset_entry = gtk_spin_button_new_with_range( 0., 1., 0.05 );


	frame = gtk_frame_new("Change point attributes : ");
	gtk_box_pack_end (GTK_BOX (list_vbox), frame, FALSE, FALSE, 5);
	colorize_gtk_tree_view_window( GTK_WIDGET(frame) );

	vbox = gtk_vbox_new( FALSE, 5 );			   
	gtk_container_add( GTK_CONTAINER(frame), vbox );
	
	table = gtk_table_new( 4, 2, FALSE );
	gtk_container_set_border_width( GTK_CONTAINER (table), 3 );


//	hbox = gtk_hbox_new( FALSE, 5 );			   
//	gtk_container_set_border_width( GTK_CONTAINER (hbox), 3 );
	gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
	label = gtk_label_new("Color : ");
	gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
    gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1);   	
	label = gtk_label_new("Offset : ");
	gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
	gtk_table_attach_defaults (GTK_TABLE (table), label, 2, 3, 0, 1);   	   
	gtk_table_attach (GTK_TABLE (table), ge->color_entry, 1, 2, 0, 1, GTK_SHRINK, GTK_SHRINK, 2, 2);   	   
	gtk_table_attach (GTK_TABLE (table), ge->offset_entry, 3, 4, 0, 1, GTK_SHRINK, GTK_SHRINK, 2, 2);

	frame = gtk_frame_new(NULL);
	colorize_gtk_tree_view_window( GTK_WIDGET(frame) );
	gtk_widget_set_size_request( frame, COLOR_PREVIEW_WIDTH, COLOR_PREVIEW_HEIGHT );
	gtk_container_set_border_width( GTK_CONTAINER (table), 0 );
	gtk_container_add( GTK_CONTAINER(frame), ge->color_preview );
	gtk_widget_show( ge->color_preview );
	
	btn = gtk_button_new();
	gtk_container_set_border_width( GTK_CONTAINER (btn), 0 );
	//btn = gtk_button_new_with_label(" Color selector ");
	colorize_gtk_widget( GTK_WIDGET(btn), get_colorschemed_style_button());
	gtk_container_add (GTK_CONTAINER (btn), frame);
	gtk_widget_show (frame);
	g_signal_connect ((gpointer) frame, "size-allocate",
                       G_CALLBACK (color_preview_size_alloc), ge);

	gtk_table_attach (GTK_TABLE (table), btn, 0, 2, 1, 2, GTK_FILL, GTK_SHRINK, 2, 2);
	g_signal_connect ((gpointer) btn, "clicked", G_CALLBACK (on_color_clicked), ge);	
	
	gtk_widget_show_all (table);
	gtk_widget_show (table);

	hbox = gtk_hbox_new( FALSE, 5 );			   
	gtk_container_set_border_width( GTK_CONTAINER (hbox), 3 );
	gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
	
	ge->delete_btn = btn = gtk_button_new_from_stock(GTK_STOCK_DELETE);
	gtk_widget_set_sensitive( ge->delete_btn, FALSE );
	colorize_gtk_widget( GTK_WIDGET(btn), get_colorschemed_style_button());
	gtk_box_pack_end (GTK_BOX (hbox), btn, FALSE, FALSE, 0);
	g_signal_connect ((gpointer) btn, "clicked", G_CALLBACK (on_delete_point_clicked), ge);	   
	
	btn = gtk_button_new_from_stock(GTK_STOCK_ADD);
	colorize_gtk_widget( GTK_WIDGET(btn), get_colorschemed_style_button());
	gtk_box_pack_end (GTK_BOX (hbox), btn, FALSE, FALSE, 0);
	g_signal_connect ((gpointer) btn, "clicked", G_CALLBACK (on_add_point_clicked), ge);	   
	
	ge->apply_btn = btn = gtk_button_new_from_stock(GTK_STOCK_APPLY);
	gtk_widget_set_sensitive( ge->apply_btn, FALSE );
	colorize_gtk_widget( GTK_WIDGET(btn), get_colorschemed_style_button());
	gtk_box_pack_end (GTK_BOX (hbox), btn, FALSE, FALSE, 0);
	g_signal_connect ((gpointer) btn, "clicked", G_CALLBACK (on_apply_point_clicked), ge);	   

	gtk_widget_show_all (hbox);
	gtk_widget_show (hbox);

	/* The preview : */
	ge->image_view = ASGTK_IMAGE_VIEW(asgtk_image_view_new());
	gtk_widget_set_size_request (GTK_WIDGET(ge->image_view), PREVIEW_WIDTH, PREVIEW_HEIGHT);
	gtk_box_pack_end (GTK_BOX (main_hbox), GTK_WIDGET(ge->image_view), TRUE, TRUE, 0);
	asgtk_image_view_set_aspect ( ge->image_view,
							   	  get_screen_width(NULL), get_screen_height(NULL) );
	asgtk_image_view_set_resize ( ge->image_view, 
								  ASGTK_IMAGE_VIEW_SCALE_TO_VIEW|
							 	  ASGTK_IMAGE_VIEW_TILE_TO_ASPECT, 
								  ASGTK_IMAGE_VIEW_RESIZE_ALL );



  	gtk_widget_show_all (list_vbox);
  	gtk_widget_show_all (main_hbox);
	gtk_widget_hide(ge->image_view->details_label);
	
	btn = gtk_check_button_new_with_label( "Use screen aspect ratio" );
	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(btn), TRUE );
	gtk_widget_show (btn);
	colorize_gtk_widget( btn, get_colorschemed_style_normal() );  
	g_signal_connect (G_OBJECT (btn), "toggled",
	              	  G_CALLBACK (asgtk_image_view_screen_aspect_toggle), (gpointer) ge->image_view);
	gtk_button_set_alignment( GTK_BUTTON(btn), 1.0, 0.5);
	asgtk_image_view_add_detail( ge->image_view, btn, 0 );

	btn = gtk_check_button_new_with_label( "Scale to fit this view" );
	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(btn), TRUE );
	gtk_widget_show (btn);
	colorize_gtk_widget( btn, get_colorschemed_style_normal() );  
	g_signal_connect (G_OBJECT (btn), "toggled",
	              	  G_CALLBACK (asgtk_image_view_scale_to_view_toggle), (gpointer) ge->image_view);
	gtk_button_set_alignment( GTK_BUTTON(btn), 1.0, 0.5);
	asgtk_image_view_add_detail( ge->image_view, btn, 0 );

	btn = asgtk_add_button_to_box( NULL, GTK_STOCK_REFRESH, NULL, G_CALLBACK(on_refresh_clicked), ge );
	asgtk_image_view_add_tool( ge->image_view, btn, 3 );


	LOCAL_DEBUG_OUT( "created image ASGtkGradient object %p", ge );	
	return GTK_WIDGET (ge);
}
Ejemplo n.º 12
0
GtkWidget *
build_main_frame(ASFileBrowserMainFrame *data)
{
	GtkWidget *h_paned ; 
	GtkWidget *v_paned ; 
	GtkWidget *view_tabs ;
	GtkWidget *view_image, *view_xml ;
	GtkWidget *view_text ;
	GtkWidget *view_hex ;
	GtkWidget *dirlist ;
	GtkWidget *filelist ;
	GtkWidget *frame = gtk_frame_new( NULL );
	
	h_paned = gtk_hpaned_new();
	gtk_container_add (GTK_CONTAINER (frame), h_paned);
	
	v_paned = gtk_vpaned_new();
	gtk_paned_add1 (GTK_PANED (h_paned), v_paned);

	view_tabs = gtk_notebook_new();
	gtk_paned_add2 (GTK_PANED (h_paned), view_tabs);
	
	view_image = asgtk_image_view_new();
	gtk_widget_set_size_request (view_image, PREVIEW_WIDTH, PREVIEW_HEIGHT);
	asgtk_image_view_set_resize ( ASGTK_IMAGE_VIEW(view_image), 0/*ASGTK_IMAGE_VIEW_SCALE_TO_VIEW*/, ASGTK_IMAGE_VIEW_RESIZE_ALL );
	gtk_notebook_append_page (GTK_NOTEBOOK (view_tabs), view_image, gtk_label_new("AS image"));
	

	view_xml = asgtk_xml_view_new();
	gtk_widget_set_size_request (view_xml, PREVIEW_WIDTH, PREVIEW_HEIGHT);
	gtk_notebook_append_page (GTK_NOTEBOOK (view_tabs), view_xml, gtk_label_new("AS XML"));

	view_text = asgtk_text_view_new(data);
	gtk_notebook_append_page (GTK_NOTEBOOK (view_tabs), view_text, gtk_label_new("AS text"));

	view_hex = asgtk_hex_view_new(data );
	gtk_notebook_append_page (GTK_NOTEBOOK (view_tabs), view_hex, gtk_label_new("AS hex"));

	gtk_widget_show_all (view_tabs);

	dirlist = asgtk_dir_tree_new();
	gtk_widget_set_size_request (dirlist, DIR_TREE_WIDTH, DIR_TREE_HEIGHT);
	gtk_paned_add1 (GTK_PANED (v_paned), dirlist);

	filelist = asgtk_image_dir_new();
	asgtk_image_dir_set_columns( ASGTK_IMAGE_DIR(filelist), 
									ASGTK_ImageDir_Col_Name|
									ASGTK_ImageDir_Col_Type|
									ASGTK_ImageDir_Col_Size|
									ASGTK_ImageDir_Col_Date );
	asgtk_image_dir_set_list_all( ASGTK_IMAGE_DIR(filelist), True );
	gtk_widget_set_size_request (filelist, FILE_LIST_WIDTH, FILE_LIST_HEIGHT);
	gtk_paned_add2 (GTK_PANED (v_paned), filelist);

	gtk_widget_show_all (v_paned);
	gtk_widget_show_all (h_paned);
	gtk_widget_show (h_paned);
	
	colorize_gtk_widget( frame, get_colorschemed_style_normal() );
	
	data->view_tabs = view_tabs ;
	data->view_image= view_image ;
	data->view_xml  = view_xml ;
	data->view_hex  = view_hex ;
	data->dirlist   = dirlist ;
	data->filelist  = filelist ;
	
	asgtk_dir_tree_set_sel_handler(ASGTK_DIR_TREE(dirlist), dir_tree_sel_handler, data);
	asgtk_image_dir_set_sel_handler( ASGTK_IMAGE_DIR(filelist), filelist_sel_handler, data);

	data->text_buffer = gtk_text_buffer_new(NULL); 
 

	return frame;
}