index b3ea55df333085e363c3080482b1912d58027878..3994ba454e6f098c0fcf96b9797ea996624539c3 100644 (file)
#include <gtk/gtk.h>
+#include <glib/gmem.h>
#include <gtk/gtkdialog.h> //for GTK_RESPONSE* types
#include <glibmm/i18n.h>
#include <gtkmm/buttonbox.h>
namespace Dialogs {
-IconPreviewPanel* IconPreviewPanel::instance = 0;
-
-
-IconPreviewPanel& IconPreviewPanel::getInstance()
+IconPreviewPanel&
+IconPreviewPanel::getInstance()
{
- if ( !instance ) {
- instance = new IconPreviewPanel();
- }
+ IconPreviewPanel &instance = *new IconPreviewPanel();
- instance->refreshPreview();
+ instance.refreshPreview();
- return *instance;
+ return instance;
}
//#########################################################################
hot = which;
updateMagnify();
- queue_draw();
+ _getContents()->queue_draw();
}
}
* Constructor
*/
IconPreviewPanel::IconPreviewPanel() :
- Panel(),
+ UI::Widget::Panel("", "dialogs.iconpreview", SP_VERB_VIEW_ICON_PREVIEW),
hot(1),
refreshButton(0),
selectionButton(0)
sizes[1] = 24;
sizes[2] = 32;
sizes[3] = 48;
- sizes[5] = 128;
+ sizes[4] = 128;
}
pixMem = new guchar*[numEntries];
pixMem[i] = new guchar[4 * sizes[i] * sizes[i]];
memset( pixMem[i], 0x00, 4 * sizes[i] * sizes[i] );
- GdkPixbuf *pb = gdk_pixbuf_new_from_data( pixMem[i], GDK_COLORSPACE_RGB, TRUE, 8, sizes[i], sizes[i], sizes[i] * 4, /*(GdkPixbufDestroyNotify)nr_free*/NULL, NULL );
+ GdkPixbuf *pb = gdk_pixbuf_new_from_data( pixMem[i], GDK_COLORSPACE_RGB, TRUE, 8, sizes[i], sizes[i], sizes[i] * 4, /*(GdkPixbufDestroyNotify)g_free*/NULL, NULL );
GtkImage* img = GTK_IMAGE( gtk_image_new_from_pixbuf( pb ) );
images[i] = Glib::wrap(img);
Glib::ustring label(*labels[i]);
Gtk::HButtonBox* holder = new Gtk::HButtonBox( Gtk::BUTTONBOX_END );
- pack_end( *holder, false, false );
+ _getContents()->pack_end(*holder, false, false);
selectionButton = new Gtk::ToggleButton(_("Selection")); // , GTK_RESPONSE_APPLY
holder->pack_start( *selectionButton, false, false );
refreshButton->signal_clicked().connect( sigc::mem_fun(*this, &IconPreviewPanel::refreshPreview) );
- pack_start(iconBox, Gtk::PACK_EXPAND_WIDGET);
+ _getContents()->pack_start(iconBox, Gtk::PACK_EXPAND_WIDGET);
show_all_children();
}
void IconPreviewPanel::refreshPreview()
{
- SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+ SPDesktop *desktop = getDesktop();
if ( desktop ) {
if ( selectionButton && selectionButton->get_active() )
{
- Inkscape::Selection * sel = SP_DT_SELECTION(desktop);
+ Inkscape::Selection * sel = sp_desktop_selection(desktop);
if ( sel ) {
//g_message("found a selection to play with");