/**
* @file
* A simple dialog for previewing icon representation.
*/
/* Authors:
* Jon A. Cruz
* Bob Jamison
* Other dudes from The Inkscape Organization
* Abhishek Sharma
*
* 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/buttonbox.h>
#include <boost/scoped_ptr.hpp>
#include <gtkmm/alignment.h>
#include <gtkmm/checkbutton.h>
#include "desktop.h"
#include "document.h"
#include "inkscape.h"
#include "preferences.h"
#include "selection.h"
#include "sp-root.h"
#include "verbs.h"
#include "icon-preview.h"
extern "C" {
// takes doc, drawing, 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),
renderTimer(0),
pending(false),
minDelay(0.1),
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], stride, /*(GdkPixbufDestroyNotify)g_free*/NULL, NULL );
} else {
}
buttons[i]->signal_clicked().connect( sigc::bind<int>( sigc::mem_fun(*this, &IconPreviewPanel::on_button_clicked), i) );
} else {
horiz = 0;
}
}
if (!horiz) {
}
} else {
horiz = 0;
}
}
}
selectionButton = new Gtk::CheckButton(C_("Icon preview window", "Sele_ction"), true);//selectionButton = (Gtk::ToggleButton*) gtk_check_button_new_with_mnemonic(_("_Selection")); // , GTK_RESPONSE_APPLY
// Connect this up last
desktopChangeConn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &IconPreviewPanel::setDesktop) );
}
{
setDesktop(0);
if (timer) {
delete timer;
timer = 0;
}
if ( renderTimer ) {
renderTimer->stop();
delete renderTimer;
renderTimer = 0;
}
}
//#########################################################################
//## M E T H O D S
//#########################################################################
#if ICON_VERBOSE
{
ptr = 0;
return str;
}
#endif // ICON_VERBOSE
{
if ( this->desktop ) {
docReplacedConn = this->desktop->connectDocumentReplaced(sigc::hide<0>(sigc::mem_fun(this, &IconPreviewPanel::setDocument)));
if ( this->desktop->selection && Inkscape::Preferences::get()->getBool("/iconpreview/autoRefresh", true) ) {
selChangedConn = this->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();
}
}
}
{
if (!timer) {
}
#if ICON_VERBOSE
#endif //ICON_VERBOSE
// Do not refresh too quickly
queueRefresh();
} else if ( desktop ) {
#if ICON_VERBOSE
#endif // ICON_VERBOSE
{
if ( !target ) {
if ( sel ) {
//g_message("found a selection to play with");
if ( id ) {
}
}
}
}
} else {
}
if ( target ) {
}
#if ICON_VERBOSE
#endif // ICON_VERBOSE
}
}
{
bool callAgain = true;
if (!timer) {
}
#if ICON_VERBOSE
#endif // ICON_VERBOSE
callAgain = false;
#if ICON_VERBOSE
#endif // ICON_VERBOSE
pending = false;
}
return callAgain;
}
{
if (!pending) {
pending = true;
#if ICON_VERBOSE
#endif // ICON_VERBOSE
if (!timer) {
}
Glib::signal_idle().connect( sigc::mem_fun(this, &IconPreviewPanel::refreshCB), Glib::PRIORITY_DEFAULT_IDLE );
}
}
{
if ( !selectionOnly ) {
}
}
{
if ( !renderTimer ) {
}
renderTimer->reset();
#if ICON_VERBOSE
#endif // ICON_VERBOSE
/* Create drawing items and set transform */
for ( int i = 0; i < numEntries; i++ ) {
unsigned unused;
// g_message( " size %d %s", sizes[i], (px ? "worked" : "failed") );
if ( px ) {
px = 0;
} else {
}
images[i]->queue_draw();
}
renderTimer->stop();
#if ICON_VERBOSE
#endif // ICON_VERBOSE
}
{
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:fileencoding=utf-8:textwidth=99 :