icon-preview.cpp revision 3463fa75dbfce17489b430657fecdaea2e746dd3
/** @file
* @brief A simple dialog for previewing icon representation.
*/
/* Authors:
* Jon A. Cruz
* Bob Jamison
* Other dudes from The Inkscape Organization
*
* Copyright (C) 2004 Bob Jamison
* Copyright (C) 2005,2010 Jon A. Cruz
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtkmm/alignment.h>
#include <gtkmm/buttonbox.h>
#include "desktop.h"
#include "desktop-handles.h"
#include "display/nr-arena.h"
#include "document.h"
#include "inkscape.h"
#include "preferences.h"
#include "selection.h"
#include "sp-root.h"
#include "icon-preview.h"
extern "C" {
// takes doc, root, icon, and icon name to produce pixels
guchar *
}
namespace Inkscape {
namespace UI {
namespace Dialog {
{
return *instance;
}
//#########################################################################
//## E V E N T S
//#########################################################################
{
_getContents()->queue_draw();
}
}
//#########################################################################
//## C O N S T R U C T O R / D E S T R U C T O R
//#########################################################################
/**
* Constructor
*/
deskTrack(),
desktop(0),
document(0),
timer(0),
pending(false),
targetId(),
hot(1),
selectionButton(0),
docModConn(),
{
numEntries = 0;
if (sizeVal > 0) {
}
}
}
sizes = new int[numEntries];
int i = 0;
}
}
if ( numEntries < 1 )
{
numEntries = 5;
sizes = new int[numEntries];
sizes[0] = 16;
}
for ( int i = 0; i < numEntries; i++ ) {
pixMem[i] = 0;
images[i] = 0;
}
int previous = 0;
int avail = 0;
for ( int i = numEntries - 1; i >= 0; --i ) {
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 );
} else {
}
buttons[i]->signal_clicked().connect( sigc::bind<int>( sigc::mem_fun(*this, &IconPreviewPanel::on_button_clicked), i) );
int pad = 12;
} else {
horiz = 0;
}
}
if (!horiz) {
}
} else {
horiz = 0;
}
}
}
// Connect this up last
desktopChangeConn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &IconPreviewPanel::setDesktop) );
}
{
setDesktop(0);
if (timer) {
delete timer;
timer = 0;
}
}
//#########################################################################
//## M E T H O D S
//#########################################################################
{
if ( this->desktop ) {
docReplacedConn = this->desktop->connectDocumentReplaced(sigc::hide<0>(sigc::mem_fun(this, &IconPreviewPanel::setDocument)));
selChangedConn = desktop->selection->connectChanged(sigc::hide(sigc::mem_fun(this, &IconPreviewPanel::queueRefresh)));
}
}
}
}
{
if (this->document) {
docModConn = this->document->connectModified(sigc::hide(sigc::mem_fun(this, &IconPreviewPanel::queueRefresh)));
queueRefresh();
}
}
}
void IconPreviewPanel::refreshPreview()
{
if (!timer) {
}
// Do not refresh too quickly
queueRefresh();
} else if ( desktop ) {
{
SPObject *target = (hold && !targetId.empty()) ? desktop->doc()->getObjectById( targetId.c_str() ) : 0;
if ( !target ) {
if ( sel ) {
//g_message("found a selection to play with");
if ( id ) {
}
}
}
}
if ( target ) {
}
} else {
if ( target ) {
}
}
}
}
bool IconPreviewPanel::refreshCB()
{
bool callAgain = true;
if (!timer) {
}
callAgain = false;
pending = false;
}
return callAgain;
}
void IconPreviewPanel::queueRefresh()
{
if (!pending) {
pending = true;
if (!timer) {
}
Glib::signal_idle().connect( sigc::mem_fun(this, &IconPreviewPanel::refreshCB), Glib::PRIORITY_DEFAULT_IDLE );
}
}
void IconPreviewPanel::modeToggled()
{
if ( !selectionOnly ) {
}
}
{
// g_message(" setting up to render '%s' as the icon", id );
/* Create new arena */
/* Create ArenaItem and set transform */
for ( int i = 0; i < numEntries; i++ ) {
// g_message( " size %d %s", sizes[i], (px ? "worked" : "failed") );
if ( px ) {
px = 0;
} else {
}
images[i]->queue_draw();
}
}
void IconPreviewPanel::updateMagnify()
{
Glib::RefPtr<Gdk::Pixbuf> buf = images[hot]->get_pixbuf()->scale_simple( 128, 128, Gdk::INTERP_NEAREST );
}
} //namespace Dialogs
} //namespace UI
} //namespace Inkscape
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :