prefdialog.cpp revision 3fbc4e85ba5509840d49e33bae9e9fa94f887ab8
/*
* Authors:
* Ted Gould <ted@gould.cx>
*
* Copyright (C) 2005-2007 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <gtkmm/checkbutton.h>
#include <gtkmm/separator.h>
#include "../dialogs/dialog-events.h"
// Used to get SP_ACTIVE_DESKTOP
#include "inkscape.h"
#include "desktop.h"
#include "preferences.h"
#include "effect.h"
#include "prefdialog.h"
namespace Inkscape {
namespace Extension {
/** \brief Creates a new preference dialog for extension preferences
\param name Name of the Extension who's dialog this is
\param help The help string for the extension (NULL if none)
\param controls The extension specific widgets in the dialog
This function initializes the dialog with the name of the extension
in the title. It adds a few buttons and sets up handlers for
them. It also places the passed in widgets into the dialog.
*/
PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * controls, ExecutionEnv * exEnv, Effect * effect, sigc::signal<void> * changeSignal) :
_createdExEnv(false),
{
/*
Gtk::Button * help_button = add_button(Gtk::Stock::HELP, Gtk::RESPONSE_HELP);
if (_help == NULL)
help_button->set_sensitive(false);
*/
_button_cancel->set_use_stock(true);
_button_ok->set_use_stock(true);
_button_ok->grab_focus();
// If we're working with an effect that can be live and
// the dialog can be pinned, put those options in too
if (_param_preview == NULL) {
}
if (_param_pinned == NULL) {
}
_button_preview->show();
_button_pinned->show();
}
_effect->set_pref_dialog(this);
}
return;
}
PrefDialog::~PrefDialog ( )
{
}
if (_param_preview != NULL) {
delete _param_preview;
}
if (_param_pinned != NULL) {
delete _param_pinned;
}
return;
}
/** \brief Runs the dialog
\return The response to the dialog
This function overrides the run function in the GTKmm dialog
class, but basically it only calls it. This function only
handles the \c Gtk::RESPONSE_HELP return, and in that case it
brings up the help window. All other return values are returned
to the calling function.
*/
int
PrefDialog::run (void) {
/*
if (_helpDialog == NULL) {
_helpDialog = new HelpDialog(_help);
}
*/
}
}
return resp;
}
void
(void)state;
}
void
PrefDialog::preview_toggle (void) {
_exEnv->livePreview(true);
} else {
_exEnv->livePreview(false);
}
}
void
PrefDialog::pinned_toggle (void) {
_button_preview->set_sensitive(false);
set_modal(false);
}
} else {
_button_preview->set_sensitive(true);
set_modal(true);
_createdExEnv = true;
}
}
}
void
if (!_exEnv) {
// apparantly this effect does not use the new ExecutionEnv stuff.
// _param_pinned and _effect will be null, and the code below will crash: return here!
return;
}
//printf("Got signal %d\n", signal);
// Not my job if we're not pinned (either not pinned, or not even a pinned checkbox)
// It's the execution environment's job
return;
}
} else {
this->hide();
delete _signal_param_change; // This is not in the destructor because
// it is the only situation that we need
// to delete it in
delete this;
}
return;
}
#include "internal/clear-n_.h"
const char * PrefDialog::pinned_param_xml = "<param name=\"__pinned__\" type=\"boolean\" gui-text=\"" N_("Pin Dialog") "\" gui-description=\"" N_("Toggles whether the dialog stays for multiple executions or disappears after one") "\" scope=\"user\">false</param>";
const char * PrefDialog::live_param_xml = "<param name=\"__live_effect__\" type=\"boolean\" gui-text=\"" N_("Live Preview") "\" gui-description=\"" N_("Controls whether the effect settings are rendered live on canvas") "\" scope=\"user\">false</param>";
}; }; /* namespace Inkscape, Extension */
/*
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 :