summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 93bb287)
raw | patch | inline | side by side (parent: 93bb287)
author | gustav_b <gustav_b@users.sourceforge.net> | |
Thu, 22 Nov 2007 00:14:41 +0000 (00:14 +0000) | ||
committer | gustav_b <gustav_b@users.sourceforge.net> | |
Thu, 22 Nov 2007 00:14:41 +0000 (00:14 +0000) |
* Made the current dialogs subclass the Panel class instead of the
Dialog class.
* Extended the Panel class with some functionality that the dialogs
relied on.
* Added a PanelDialog class which is a dialog container for a
single panel with the dialog behavior as a template parameter.
(* Fixed coding style for the Panel and Dialog class)
For details, see
http://www.nabble.com/Re%3A-Dockable-dialogs%2C-todo-list-p12728194.html
http://www.nabble.com/Re%3A-Inkscape-overcomes-Xara-in-Google-Trends-p13126622.html
Dialog class.
* Extended the Panel class with some functionality that the dialogs
relied on.
* Added a PanelDialog class which is a dialog container for a
single panel with the dialog behavior as a template parameter.
(* Fixed coding style for the Panel and Dialog class)
For details, see
http://www.nabble.com/Re%3A-Dockable-dialogs%2C-todo-list-p12728194.html
http://www.nabble.com/Re%3A-Inkscape-overcomes-Xara-in-Google-Trends-p13126622.html
62 files changed:
index d0b8b4a8fff87510715f38e8c9b195346085dd9d..c364147053bbce60b8dfbf937c8e7c0d4771154e 100644 (file)
IconPreviewPanel* IconPreviewPanel::instance = 0;
-IconPreviewPanel*
-IconPreviewPanel::create(Inkscape::UI::Dialog::Behavior::BehaviorFactory behavior_factory)
+IconPreviewPanel&
+IconPreviewPanel::getInstance()
{
if ( !instance ) {
- instance = new IconPreviewPanel(behavior_factory);
+ instance = new IconPreviewPanel();
}
instance->refreshPreview();
- return instance;
+ return *instance;
}
//#########################################################################
hot = which;
updateMagnify();
- get_vbox()->queue_draw();
+ _getContents()->queue_draw();
}
}
/**
* Constructor
*/
-IconPreviewPanel::IconPreviewPanel(Inkscape::UI::Dialog::Behavior::BehaviorFactory behavior_factory) :
- Inkscape::UI::Dialog::Dialog(behavior_factory, "dialogs.iconpreview", SP_VERB_VIEW_ICON_PREVIEW),
+IconPreviewPanel::IconPreviewPanel() :
+ UI::Widget::Panel("", "dialogs.iconpreview", SP_VERB_VIEW_ICON_PREVIEW),
hot(1),
refreshButton(0),
selectionButton(0)
@@ -186,7 +186,7 @@ IconPreviewPanel::IconPreviewPanel(Inkscape::UI::Dialog::Behavior::BehaviorFacto
Gtk::HButtonBox* holder = new Gtk::HButtonBox( Gtk::BUTTONBOX_END );
- get_vbox()->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 );
@@ -202,7 +202,7 @@ IconPreviewPanel::IconPreviewPanel(Inkscape::UI::Dialog::Behavior::BehaviorFacto
refreshButton->signal_clicked().connect( sigc::mem_fun(*this, &IconPreviewPanel::refreshPreview) );
- get_vbox()->pack_start(iconBox, Gtk::PACK_EXPAND_WIDGET);
+ _getContents()->pack_start(iconBox, Gtk::PACK_EXPAND_WIDGET);
show_all_children();
}
index 9cfe81b117bcf90dc8124c0e2e4ab927b49342e6..0f34dda4e156fd273f265c9fa08104601ec3629e 100644 (file)
#include <gtkmm/togglebutton.h>
#include <gtkmm/toggletoolbutton.h>
-#include "ui/dialog/dialog.h"
+#include "ui/widget/panel.h"
struct SPObject;
/**
* A panel that displays an icon preview
*/
-class IconPreviewPanel : public Inkscape::UI::Dialog::Dialog
+class IconPreviewPanel : public UI::Widget::Panel
{
public:
- IconPreviewPanel(Inkscape::UI::Dialog::Behavior::BehaviorFactory behavior_factory);
+ IconPreviewPanel();
//IconPreviewPanel(Glib::ustring const &label);
- static IconPreviewPanel *create(Inkscape::UI::Dialog::Behavior::BehaviorFactory behavior_factory);
+ static IconPreviewPanel& getInstance();
void refreshPreview();
void modeToggled();
index 34bb5101c39d3dfe9be15ba3aabb06fcd203f417..ff18c82b463d0b678357d8f7fe6c3b2735c14cb9 100644 (file)
LayersPanel* LayersPanel::instance = 0;
-LayersPanel*
-LayersPanel::create(Inkscape::UI::Dialog::Behavior::BehaviorFactory behavior_factory)
+LayersPanel&
+LayersPanel::getInstance()
{
if ( !instance ) {
- instance = new LayersPanel(behavior_factory);
+ instance = new LayersPanel();
}
- return instance;
+ return *instance;
}
enum {
/**
* Constructor
*/
-LayersPanel::LayersPanel(Inkscape::UI::Dialog::Behavior::BehaviorFactory behavior_factory) :
- Inkscape::UI::Dialog::Dialog(behavior_factory, "dialogs.layers", SP_VERB_DIALOG_LAYERS),
+LayersPanel::LayersPanel() :
+ UI::Widget::Panel("", "dialogs.layers", SP_VERB_DIALOG_LAYERS),
_maxNestDepth(20),
_mgr(0),
_desktop(0),
@@ -776,10 +776,10 @@ LayersPanel::LayersPanel(Inkscape::UI::Dialog::Behavior::BehaviorFactory behavio
_opacityBox.pack_end( _spinBtn, Gtk::PACK_SHRINK );
_watching.push_back( &_opacityBox );
- get_vbox()->pack_start( _scroller, Gtk::PACK_EXPAND_WIDGET );
+ _getContents()->pack_start( _scroller, Gtk::PACK_EXPAND_WIDGET );
- get_vbox()->pack_end(_opacityBox, Gtk::PACK_SHRINK);
- get_vbox()->pack_end(_buttonsRow, Gtk::PACK_SHRINK);
+ _getContents()->pack_end(_opacityBox, Gtk::PACK_SHRINK);
+ _getContents()->pack_end(_buttonsRow, Gtk::PACK_SHRINK);
_opacityConnection = _opacity.get_adjustment()->signal_value_changed().connect( sigc::mem_fun(*this, &LayersPanel::_opacityChanged) );
index 83c5089fc8a434726caa00a02c9dae7de4718957..981d320279346231d823c2ade5bd6957a98291c7 100644 (file)
-
#ifndef SEEN_LAYERS_PANEL_H
#define SEEN_LAYERS_PANEL_H
/*
#include <gtkmm/spinbutton.h>
//#include "ui/previewholder.h"
-#include "ui/dialog/dialog.h"
+#include "ui/widget/panel.h"
class SPObject;
/**
* A panel that displays layers.
*/
-class LayersPanel : public Inkscape::UI::Dialog::Dialog
+class LayersPanel : public UI::Widget::Panel
{
public:
- LayersPanel(Inkscape::UI::Dialog::Behavior::BehaviorFactory behavior_factory);
+ LayersPanel();
virtual ~LayersPanel();
//virtual void setOrientation( Gtk::AnchorType how );
- static LayersPanel *create(Inkscape::UI::Dialog::Behavior::BehaviorFactory behavior_factory);
+
+ static LayersPanel& getInstance();
void setDesktop( SPDesktop* desktop );
index 6607657e58f7e6ca7c95e5e24d39d98e76bd15b6..829b06cb6009a88f71c7b07eb007f76c6b4b34c2 100644 (file)
--- a/src/dialogs/swatches.cpp
+++ b/src/dialogs/swatches.cpp
}
-
/**
* Constructor
*/
SwatchesPanel::SwatchesPanel(gchar const* prefsPath) :
- Inkscape::UI::Widget::Panel( Glib::ustring(), prefsPath, true ),
+ Inkscape::UI::Widget::Panel("", prefsPath, SP_VERB_DIALOG_SWATCHES, "", true),
_holder(0)
{
Gtk::RadioMenuItem* hotItem = 0;
index 86661efe379073c06a189439260220ea5de42e72..4a60d4413d4d6a8bd19bcd891007851355dbdacb 100644 (file)
-
-
/*##########################
## Experimental
##########################*/
@@ -612,8 +610,8 @@ static void updateSelectionCallback(Inkscape::Application */*inkscape*/, Inkscap
/**
* Constructor
*/
-TileDialog::TileDialog(Behavior::BehaviorFactory behavior_factory)
- : Dialog (behavior_factory, "dialogs.gridtiler", SP_VERB_SELECTION_GRIDTILE)
+TileDialog::TileDialog()
+ : UI::Widget::Panel("", "dialogs.gridtiler", SP_VERB_SELECTION_GRIDTILE)
{
// bool used by spin button callbacks to stop loops where they change each other.
updating = false;
g_signal_connect ( G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (updateSelectionCallback), this);
}
- Gtk::VBox *mainVBox = get_vbox();
+ Gtk::Box *contents = _getContents();
#define MARGIN 2
TileBox.pack_start(SizesHBox, false, false, MARGIN);
- mainVBox->pack_start(TileBox);
+ contents->pack_start(TileBox);
double SpacingType = prefs_get_double_attribute ("dialogs.gridtiler", "SpacingType", 15);
if (SpacingType>0) {
SizesHBox.set_sensitive (ManualSpacing);
//## The OK button
- TileOkButton = add_button(Gtk::Stock::APPLY, GTK_RESPONSE_APPLY);
+ TileOkButton = addResponseButton(Gtk::Stock::APPLY, GTK_RESPONSE_APPLY);
tips.set_tip((*TileOkButton), _("Arrange selected objects"));
show_all_children();
index 5fe114d8351edf6ac3a55648cdcce652728dbbbb..a1201956ab55440f37781fe95d857adc574192d5 100644 (file)
--- a/src/dialogs/tiledialog.h
+++ b/src/dialogs/tiledialog.h
#include <gtkmm/checkbutton.h>
#include <gtkmm/radiobutton.h>
-#include "ui/dialog/dialog.h"
+#include "ui/widget/panel.h"
namespace Inkscape {
namespace UI {
/**
* A dialog that displays log messages
*/
-class TileDialog : public Dialog {
+class TileDialog : public UI::Widget::Panel {
public:
/**
* Constructor
*/
- TileDialog(Behavior::BehaviorFactory behavior_factory) ;
+ TileDialog() ;
/**
* Factory method
*/
- static TileDialog *create(Behavior::BehaviorFactory behavior_factory)
- { return new TileDialog(behavior_factory); }
+ static TileDialog& getInstance() { return *new TileDialog(); }
/**
* Destructor
index 6679e99deca0f8725a7b99cb3b91d40b893b6644..e4b3f3062dc5d37fb146928764b96c95c945bd18 100644 (file)
ui/dialog/dialog-manager.h \
ui/dialog/dialog.cpp \
ui/dialog/dialog.h \
+ ui/dialog/panel-dialog.h \
ui/dialog/behavior.h \
ui/dialog/dock-behavior.h \
ui/dialog/dock-behavior.cpp \
index 924a987907a6591dd8d664e291845dcc3c134ae8..7b616fe18fb196334a5301f3e9f319a65a31a619 100644 (file)
@@ -774,8 +774,8 @@ void on_selection_changed(Inkscape::Application *inkscape, Inkscape::Selection *
-AlignAndDistribute::AlignAndDistribute(Behavior::BehaviorFactory behavior_factory)
- : Dialog (behavior_factory, "dialogs.align", SP_VERB_DIALOG_ALIGN_DISTRIBUTE),
+AlignAndDistribute::AlignAndDistribute()
+ : UI::Widget::Panel ("", "dialogs.align", SP_VERB_DIALOG_ALIGN_DISTRIBUTE),
randomize_bbox(NR::Nothing()),
_alignFrame(_("Align")),
_distributeFrame(_("Distribute")),
@@ -923,17 +923,16 @@ AlignAndDistribute::AlignAndDistribute(Behavior::BehaviorFactory behavior_factor
_graphLayoutFrame.add(_graphLayoutTable);
_nodesFrame.add(_nodesTable);
- // Top level vbox
- Gtk::VBox *vbox = get_vbox();
- vbox->set_spacing(4);
+ Gtk::Box *contents = _getContents();
+ contents->set_spacing(4);
// Notebook for individual transformations
- vbox->pack_start(_alignFrame, true, true);
- vbox->pack_start(_distributeFrame, true, true);
- vbox->pack_start(_removeOverlapFrame, true, true);
- vbox->pack_start(_graphLayoutFrame, true, true);
- vbox->pack_start(_nodesFrame, true, true);
+ contents->pack_start(_alignFrame, true, true);
+ contents->pack_start(_distributeFrame, true, true);
+ contents->pack_start(_removeOverlapFrame, true, true);
+ contents->pack_start(_graphLayoutFrame, true, true);
+ contents->pack_start(_nodesFrame, true, true);
//Connect to the global tool change signal
g_signal_connect (G_OBJECT (INKSCAPE), "set_eventcontext", G_CALLBACK (on_tool_changed), this);
index 0559a11e92a0a6b713af85c7a0dfd6860a6d311b..a54ac781ef8752cff85c91a4b5377e5faa3c469d 100644 (file)
#include "libnr/nr-rect.h"
-#include "dialog.h"
+#include "ui/widget/panel.h"
#include "ui/widget/notebook-page.h"
using namespace Inkscape::UI::Widget;
class Action;
-class AlignAndDistribute : public Dialog {
+class AlignAndDistribute : public Widget::Panel {
public:
- AlignAndDistribute(Behavior::BehaviorFactory behavior_factory);
+ AlignAndDistribute();
virtual ~AlignAndDistribute();
- static AlignAndDistribute *create(Behavior::BehaviorFactory behavior_factory)
- { return new AlignAndDistribute(behavior_factory); }
+ static AlignAndDistribute &getInstance() { return *new AlignAndDistribute(); }
enum AlignTarget { LAST=0, FIRST, BIGGEST, SMALLEST, PAGE, DRAWING, SELECTION };
index b7455bbe50c9279b9b42ac6397374206507c78ce..4b5fe06b84005bd34280e23bdafaab964e4ee8c8 100644 (file)
--- a/src/ui/dialog/behavior.h
+++ b/src/ui/dialog/behavior.h
class Behavior;
-typedef Behavior *(*BehaviorFactory)(Dialog& dialog);
+typedef Behavior *(*BehaviorFactory)(Dialog &dialog);
template <typename T>
-Behavior *create(Dialog& dialog)
+Behavior *create(Dialog &dialog)
{
return T::create(dialog);
}
virtual void move(int x, int y) =0;
virtual void set_position(Gtk::WindowPosition) =0;
virtual void set_size_request(int width, int height) =0;
- virtual void size_request(Gtk::Requisition& requisition) =0;
- virtual void get_position(int& x, int& y) =0;
- virtual void get_size(int& width, int& height) =0;
+ virtual void size_request(Gtk::Requisition &requisition) =0;
+ virtual void get_position(int &x, int &y) =0;
+ virtual void get_size(int &width, int &height) =0;
virtual void set_title(Glib::ustring title) =0;
- virtual void set_response_sensitive(int response_id, bool setting) =0;
virtual void set_sensitive(bool sensitive) =0;
- virtual Gtk::Button *add_button(const Glib::ustring& button_text, int response_id) =0;
- virtual Gtk::Button *add_button(const Gtk::StockID& stock_id, int response_id) =0;
- virtual void set_default_response(int response_id) =0;
/** Gtk::Dialog signal proxies */
virtual Glib::SignalProxy0<void> signal_show() =0;
virtual Glib::SignalProxy0<void> signal_hide() =0;
virtual Glib::SignalProxy1<bool, GdkEventAny *> signal_delete_event() =0;
- virtual Glib::SignalProxy1<void, int> signal_response() =0;
/** Custom signal handlers */
virtual void onHideF12() =0;
virtual void onDesktopActivated(SPDesktop *desktop) =0;
protected:
- Behavior(Dialog& dialog)
+ Behavior(Dialog &dialog)
: _dialog (dialog)
{ }
private:
Behavior(); // no constructor without params
- Behavior(const Behavior&); // no copy
- Behavior& operator=(const Behavior&); // no assign
+ Behavior(const Behavior &); // no copy
+ Behavior &operator=(const Behavior &); // no assign
};
} // namespace Behavior
index e5d326efe9a87e1c051bbc5beb0ab056138ad1d0..f8c07cf535c16e4bd99c7687a8ae86e02f93f31d 100644 (file)
#include "ui/dialog/transformation.h"
#include "ui/dialog/undo-history.h"
#include "ui/dialog/xml-editor.h"
+#include "ui/dialog/panel-dialog.h"
#include "dialogs/layers-panel.h"
#include "dialogs/tiledialog.h"
namespace {
+using namespace Behavior;
+
template <typename T, typename B>
-inline Dialog *create() { return T::create(&B::create); }
+inline Dialog *create() { return PanelDialog<B>::template create<T>(); }
}
registerFactory("Memory", &create<Memory, FloatingBehavior>);
registerFactory("Messages", &create<Messages, FloatingBehavior>);
registerFactory("Script", &create<ScriptDialog, FloatingBehavior>);
+ registerFactory("Swatches", &create<SwatchesPanel, FloatingBehavior>);
registerFactory("TextProperties", &create<TextProperties, FloatingBehavior>);
registerFactory("TileDialog", &create<TileDialog, FloatingBehavior>);
registerFactory("Trace", &create<TraceDialog, FloatingBehavior>);
registerFactory("Memory", &create<Memory, DockBehavior>);
registerFactory("Messages", &create<Messages, DockBehavior>);
registerFactory("Script", &create<ScriptDialog, DockBehavior>);
+ registerFactory("Swatches", &create<SwatchesPanel, DockBehavior>);
registerFactory("TextProperties", &create<TextProperties, DockBehavior>);
registerFactory("TileDialog", &create<TileDialog, DockBehavior>);
registerFactory("Trace", &create<TraceDialog, DockBehavior>);
index 4fbc217abefb59b856b14195cf219dfc75db7d88..7d2242802ed4f07d955f8c7be03288a1c66a4a90 100644 (file)
--- a/src/ui/dialog/dialog.cpp
+++ b/src/ui/dialog/dialog.cpp
namespace Dialog {
void
-sp_retransientize (Inkscape::Application *inkscape, SPDesktop *desktop, gpointer dlgPtr)
+sp_retransientize(Inkscape::Application *inkscape, SPDesktop *desktop, gpointer dlgPtr)
{
Dialog *dlg = (Dialog *)dlgPtr;
dlg->onDesktopActivated (desktop);
}
gboolean
-sp_retransientize_again (gpointer dlgPtr)
+sp_retransientize_again(gpointer dlgPtr)
{
Dialog *dlg = (Dialog *)dlgPtr;
dlg->retransientize_suppress = false;
}
void
-sp_dialog_shutdown (GtkObject *object, gpointer dlgPtr)
+sp_dialog_shutdown(GtkObject *object, gpointer dlgPtr)
{
Dialog *dlg = (Dialog *)dlgPtr;
dlg->onShutdown();
*/
Dialog::Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_path, int verb_num,
- const char *apply_label)
+ Glib::ustring const &apply_label)
: _hiddenF12 (false),
_prefs_path (prefs_path),
_verb_num(verb_num),
@@ -125,15 +125,6 @@ Dialog::Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_pat
Glib::wrap(gobj())->signal_event().connect(sigc::mem_fun(*this, &Dialog::_onEvent));
Glib::wrap(gobj())->signal_key_press_event().connect(sigc::mem_fun(*this, &Dialog::_onKeyPress));
- if (prefs_get_int_attribute ("dialogs", "showclose", 0) || apply_label) {
- // TODO: make the order of buttons obey the global preference
- if (apply_label) {
- add_button(Glib::ustring(apply_label), Gtk::RESPONSE_APPLY);
- set_default_response(Gtk::RESPONSE_APPLY);
- }
- add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
- }
-
read_geometry();
}
}
-inline Dialog::operator Gtk::Widget&() { return *_behavior; }
+inline Dialog::operator Gtk::Widget &() { return *_behavior; }
inline GtkWidget *Dialog::gobj() { return _behavior->gobj(); }
inline void Dialog::present() { _behavior->present(); }
inline Gtk::VBox *Dialog::get_vbox() { return _behavior->get_vbox(); }
inline void Dialog::show() { _behavior->show(); }
inline void Dialog::show_all_children() { _behavior->show_all_children(); }
inline void Dialog::set_size_request(int width, int height) { _behavior->set_size_request(width, height); }
-inline void Dialog::size_request(Gtk::Requisition& requisition) { _behavior->size_request(requisition); }
-inline void Dialog::get_position(int& x, int& y) { _behavior->get_position(x, y); }
-inline void Dialog::get_size(int& width, int& height) { _behavior->get_size(width, height); }
+inline void Dialog::size_request(Gtk::Requisition &requisition) { _behavior->size_request(requisition); }
+inline void Dialog::get_position(int &x, int &y) { _behavior->get_position(x, y); }
+inline void Dialog::get_size(int &width, int &height) { _behavior->get_size(width, height); }
inline void Dialog::resize(int width, int height) { _behavior->resize(width, height); }
inline void Dialog::move(int x, int y) { _behavior->move(x, y); }
inline void Dialog::set_position(Gtk::WindowPosition position) { _behavior->set_position(position); }
inline void Dialog::set_title(Glib::ustring title) { _behavior->set_title(title); }
inline void Dialog::set_sensitive(bool sensitive) { _behavior->set_sensitive(sensitive); }
-inline void Dialog::set_response_sensitive(int response_id, bool setting)
-{ _behavior->set_response_sensitive(response_id, setting); }
-
-void Dialog::set_resizable(bool) { }
-void Dialog::set_default(Gtk::Widget&) { }
-
-inline void Dialog::set_default_response(int response_id) { _behavior->set_default_response(response_id); }
-
-Glib::SignalProxy0<void> Dialog::signal_show () { return _behavior->signal_show(); }
-Glib::SignalProxy0<void> Dialog::signal_hide () { return _behavior->signal_hide(); }
-Glib::SignalProxy1<void, int> Dialog::signal_response () { return _behavior->signal_response(); }
-
-Gtk::Button* Dialog::add_button (const Glib::ustring& button_text, int response_id)
-{ return _behavior->add_button(button_text, response_id); }
-
-Gtk::Button* Dialog::add_button (const Gtk::StockID& stock_id, int response_id)
-{ return _behavior->add_button(stock_id, response_id); }
-
+Glib::SignalProxy0<void> Dialog::signal_show() { return _behavior->signal_show(); }
+Glib::SignalProxy0<void> Dialog::signal_hide() { return _behavior->signal_hide(); }
void
Dialog::read_geometry()
}
void
-Dialog::_onResponse(int response_id)
+Dialog::_handleResponse(int response_id)
{
switch (response_id) {
- case Gtk::RESPONSE_APPLY: {
- _apply();
- break;
- }
case Gtk::RESPONSE_CLOSE: {
_close();
break;
diff --git a/src/ui/dialog/dialog.h b/src/ui/dialog/dialog.h
index 5a9e656457e3b7138231cf17dbb1d2098dae2165..a1229fb9475088b353dd6edeba99f3f50b250016 100644 (file)
--- a/src/ui/dialog/dialog.h
+++ b/src/ui/dialog/dialog.h
public:
Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_path = NULL,
- int verb_num = 0, const char *apply_label = NULL);
+ int verb_num = 0, Glib::ustring const &apply_label = "");
virtual ~Dialog();
- virtual void onDesktopActivated (SPDesktop*);
+ virtual void onDesktopActivated(SPDesktop*);
virtual void onShutdown();
/** Hide and show dialogs */
virtual void onHideF12();
virtual void onShowF12();
- virtual operator Gtk::Widget&();
+ virtual operator Gtk::Widget &();
virtual GtkWidget *gobj();
virtual void present();
virtual Gtk::VBox *get_vbox();
virtual void show();
virtual void hide();
virtual void show_all_children();
- virtual void set_resizable(bool);
- virtual void set_sensitive(bool sensitive=true);
- virtual void set_default(Gtk::Widget&);
virtual void set_size_request(int, int);
- virtual void size_request(Gtk::Requisition&);
- virtual void get_position(int& x, int& y);
- virtual void get_size(int& width, int& height);
+ virtual void size_request(Gtk::Requisition &);
+ virtual void get_position(int &x, int &y);
+ virtual void get_size(int &width, int &height);
virtual void resize(int width, int height);
virtual void move(int x, int y);
virtual void set_position(Gtk::WindowPosition position);
virtual void set_title(Glib::ustring title);
+ virtual void set_sensitive(bool sensitive=true);
- virtual void set_response_sensitive(int response_id, bool setting);
virtual Glib::SignalProxy0<void> signal_show();
virtual Glib::SignalProxy0<void> signal_hide();
- virtual Glib::SignalProxy1<void, int> signal_response();
-
- virtual Gtk::Button* add_button (const Glib::ustring& button_text, int response_id);
- virtual Gtk::Button* add_button (const Gtk::StockID& stock_id, int response_id);
-
- virtual void set_default_response(int response_id);
bool _user_hidden; // when it is closed by the user, to prevent repopping on f12
bool _hiddenF12;
const char *_prefs_path;
int _verb_num;
Glib::ustring _title;
- const char *_apply_label;
+ Glib::ustring _apply_label;
/**
* Tooltips object for all descendants to use
*/
Gtk::Tooltips tooltips;
- virtual void _onResponse(int response_id);
+ virtual void _handleResponse(int response_id);
+
virtual bool _onDeleteEvent (GdkEventAny*);
virtual bool _onEvent(GdkEvent *event);
virtual bool _onKeyPress(GdkEventKey *event);
index afa921e8530b17bc06ac458e3f91b850e8cbb3eb..13ce20abe8fcd453e330ac08327b9445b1251474 100644 (file)
namespace Behavior {
-DockBehavior::DockBehavior(Dialog& dialog) :
+DockBehavior::DockBehavior(Dialog &dialog) :
Behavior(dialog),
_dock_item(*SP_ACTIVE_DESKTOP->getDock(),
Inkscape::Verb::get(dialog._verb_num)->get_id(), dialog._title.c_str(),
{
// Connect signals
_signal_hide_connection = signal_hide().connect(sigc::mem_fun(*this, &Inkscape::UI::Dialog::Behavior::DockBehavior::_onHide));
- signal_response().connect(sigc::mem_fun(_dialog, &Inkscape::UI::Dialog::Dialog::_onResponse));
_dock_item.signal_state_changed().connect(sigc::mem_fun(*this, &Inkscape::UI::Dialog::Behavior::DockBehavior::_onStateChanged));
if (_dock_item.getState() == Widget::DockItem::FLOATING_STATE) {
Behavior *
-DockBehavior::create(Dialog& dialog)
+DockBehavior::create(Dialog &dialog)
{
return new DockBehavior(dialog);
}
-DockBehavior::operator Gtk::Widget&()
+DockBehavior::operator Gtk::Widget &()
{
return _dock_item.getWidget();
}
}
void
-DockBehavior::get_position(int& x, int& y)
+DockBehavior::get_position(int &x, int &y)
{
_dock_item.get_position(x, y);
}
void
-DockBehavior::get_size(int& width, int& height)
+DockBehavior::get_size(int &width, int &height)
{
_dock_item.get_size(width, height);
}
}
void
-DockBehavior::size_request(Gtk::Requisition& requisition)
+DockBehavior::size_request(Gtk::Requisition &requisition)
{
_dock_item.size_request(requisition);
}
_dock_item.set_title(title);
}
-void
-DockBehavior::set_response_sensitive(int response_id, bool setting)
-{
- if (_response_map[response_id])
- _response_map[response_id]->set_sensitive(setting);
-}
-
void
DockBehavior::set_sensitive(bool sensitive)
{
get_vbox()->set_sensitive();
}
-Gtk::Button *
-DockBehavior::add_button(const Glib::ustring& button_text, int response_id)
-{
- Gtk::Button *button = new Gtk::Button(button_text);
- _addButton(button, response_id);
- return button;
-}
-
-Gtk::Button *
-DockBehavior::add_button(const Gtk::StockID& stock_id, int response_id)
-{
- Gtk::Button *button = new Gtk::Button(stock_id);
- _addButton(button, response_id);
- return button;
-}
-
-void
-DockBehavior::_addButton(Gtk::Button *button, int response_id)
-{
- _dock_item.addButton(button, response_id);
-
- if (response_id != 0) {
-
- /* Pass the signal_clicked signals onto a our own signal handler that can re-emit them as
- * signal_response signals
- */
- button->signal_clicked().connect(
- sigc::bind<int>(sigc::mem_fun(*this,
- &Inkscape::UI::Dialog::Behavior::DockBehavior::_onResponse),
- response_id));
-
- _response_map[response_id] = button;
- }
-}
-
-void
-DockBehavior::set_default_response(int response_id)
-{
- ResponseMap::iterator widget_found;
- widget_found = _response_map.find(response_id);
-
- if (widget_found != _response_map.end()) {
- widget_found->second->activate();
- widget_found->second->property_can_default() = true;
- widget_found->second->grab_default();
- }
-}
-
void
DockBehavior::_onHide()
}
}
-void
-DockBehavior::_onResponse(int response_id)
-{
- g_signal_emit_by_name (_dock_item.gobj(), "signal_response", response_id);
-}
-
void
DockBehavior::onHideF12()
{
Glib::SignalProxy0<void>
DockBehavior::signal_hide() { return _dock_item.signal_hide(); }
-Glib::SignalProxy1<void, int>
-DockBehavior::signal_response() { return _dock_item.signal_response(); }
-
Glib::SignalProxy1<bool, GdkEventAny *>
DockBehavior::signal_delete_event() { return _dock_item.signal_delete_event(); }
index 01d95dd8ca9b76a242f31557d5f27033d88dbb4a..d873bfb0af522608202fd0d6d34537b0d929c0c9 100644 (file)
void get_position(int& x, int& y);
void get_size(int& width, int& height);
void set_title(Glib::ustring title);
- void set_response_sensitive(int response_id, bool setting);
void set_sensitive(bool sensitive);
- Gtk::Button *add_button(const Glib::ustring& button_text, int response_id);
- Gtk::Button *add_button(const Gtk::StockID& stock_id, int response_id);
- void set_default_response(int response_id);
/** Gtk::Dialog signal proxies */
Glib::SignalProxy0<void> signal_show();
Glib::SignalProxy1<bool, GdkEventAny *> signal_delete_event();
Glib::SignalProxy0<void> signal_drag_begin();
Glib::SignalProxy1<void, bool> signal_drag_end();
- Glib::SignalProxy1<void, int> signal_response();
/** Custom signal handlers */
void onHideF12();
DockBehavior(Dialog& dialog);
- /** A map to store which widget that emits a certain response signal */
- typedef std::map<int, Gtk::Widget *> ResponseMap;
- ResponseMap _response_map;
-
/** Internal helpers */
- void _addButton(Gtk::Button *button, int response_id);
Gtk::Paned *_getPaned(); //< gives the parent pane, if the dock item has one
void _requestHeight(int height); //< tries to resize the dock item to the requested hieght
/** Internal signal handlers */
void _onHide();
bool _onDeleteEvent(GdkEventAny *event);
- void _onResponse(int response_id);
void _onStateChanged(Widget::DockItem::State prev_state, Widget::DockItem::State new_state);
bool _onKeyPress(GdkEventKey *event);
index 22f6f64bed2d15c44846ab53f063f559875d34eb..5671e08fe5631c16bb36508a9c74faba17935165 100644 (file)
};
-DocumentMetadata*
-DocumentMetadata::create(Behavior::BehaviorFactory behavior_factory)
+DocumentMetadata &
+DocumentMetadata::getInstance()
{
- if (_instance) return _instance;
- _instance = new DocumentMetadata(behavior_factory);
+ if (_instance) return *_instance;
+ _instance = new DocumentMetadata();
_instance->init();
- return _instance;
+ return *_instance;
}
void
}
}
-DocumentMetadata::DocumentMetadata(Behavior::BehaviorFactory behavior_factory)
- : Dialog (behavior_factory, "dialogs.documentmetadata", SP_VERB_DIALOG_METADATA),
+DocumentMetadata::DocumentMetadata()
+ : UI::Widget::Panel ("", "dialogs.documentmetadata", SP_VERB_DIALOG_METADATA),
_page_metadata1(1, 1), _page_metadata2(1, 1),
_prefs_path("dialogs.documentmetadata")
{
hide();
- set_resizable (true);
_tt.enable();
- get_vbox()->set_spacing (4);
- get_vbox()->pack_start (_notebook, true, true);
+ _getContents()->set_spacing (4);
+ _getContents()->pack_start(_notebook, true, true);
_notebook.append_page(_page_metadata1, _("Metadata"));
_notebook.append_page(_page_metadata2, _("License"));
G_CALLBACK(on_deactivate_desktop), 0);
show_all_children();
- present();
}
DocumentMetadata::~DocumentMetadata()
//--------------------------------------------------------------------
-void
-DocumentMetadata::on_response (int id)
-{
- if (id == Gtk::RESPONSE_CLOSE)
- hide();
-}
/**
* Called when XML node attribute changed; updates dialog widgets.
index 3f1fb9e572118c366402c7d996a1a421130379ad..7ee2ee2167b93d3f2c5609fb4fc91a86661560b8 100644 (file)
#include <gtkmm/notebook.h>
#include <glibmm/i18n.h>
+#include "ui/widget/panel.h"
#include "ui/widget/licensor.h"
#include "ui/widget/notebook-page.h"
#include "ui/widget/registry.h"
-#include "dialog.h"
using namespace Inkscape::UI::Widget;
typedef std::list<EntityEntry*> RDElist;
-class DocumentMetadata : public Inkscape::UI::Dialog::Dialog {
+class DocumentMetadata : public Inkscape::UI::Widget::Panel {
public:
void update();
- static DocumentMetadata *create(Behavior::BehaviorFactory behavior_factory);
+
+ static DocumentMetadata &getInstance();
+
static void destroy();
sigc::connection _doc_replaced_connection;
protected:
void build_metadata();
void init();
- virtual void on_response (int);
Gtk::Tooltips _tt;
Gtk::Notebook _notebook;
Registry _wr;
private:
- DocumentMetadata(Behavior::BehaviorFactory behavior_factory);
virtual ~DocumentMetadata();
+ DocumentMetadata();
};
} // namespace Dialog
index 7e71a0e3e1db6a727fec147ee39a2813fbbc68d3..7528b463f7010e66ef94c70ed9f691a8dd7ef054 100644 (file)
};
-DocumentProperties*
-DocumentProperties::create(Behavior::BehaviorFactory behavior_factory)
+DocumentProperties &
+DocumentProperties::getInstance()
{
- if (_instance) return _instance;
- _instance = new DocumentProperties(behavior_factory);
+ if (_instance) return *_instance;
+ _instance = new DocumentProperties();
_instance->init();
- return _instance;
+ return *_instance;
}
void
}
}
-DocumentProperties::DocumentProperties(Behavior::BehaviorFactory behavior_factory)
- : Dialog (behavior_factory, "dialogs.documentoptions", SP_VERB_DIALOG_NAMEDVIEW),
+DocumentProperties::DocumentProperties()
+ : UI::Widget::Panel ("", "dialogs.documentoptions", SP_VERB_DIALOG_NAMEDVIEW),
_page_page(1, 1), _page_guides(1, 1),
_page_snap(1, 1), _page_snap_dtls(1, 1), _page_grids(1, 1),
_grids_button_new(_("_New"), _("Create new grid.")),
_grids_button_remove(_("_Remove"), _("Remove selected grid.")),
_prefs_path("dialogs.documentoptions")
{
- set_resizable (false);
_tt.enable();
- get_vbox()->set_spacing (4);
- get_vbox()->pack_start (_notebook, true, true);
+ _getContents()->set_spacing (4);
+ _getContents()->pack_start(_notebook, true, true);
_notebook.append_page(_page_page, _("Page"));
_notebook.append_page(_page_guides, _("Guides"));
G_CALLBACK(on_deactivate_desktop), 0);
show_all_children();
-
- present();
}
DocumentProperties::~DocumentProperties()
index 07382d524a492f02c6b721508e38f8405ffcffb7..b4e303325828bf3567d11d52f896a2a8be89ed01 100644 (file)
#include "ui/widget/registered-widget.h"
#include "ui/widget/registry.h"
#include "ui/widget/tolerance-slider.h"
-#include "dialog.h"
+#include "ui/widget/panel.h"
using namespace Inkscape::UI::Widget;
namespace UI {
namespace Dialog {
-class DocumentProperties : public Inkscape::UI::Dialog::Dialog {
+class DocumentProperties : public UI::Widget::Panel {
public:
void update();
- static DocumentProperties *create(Behavior::BehaviorFactory behavior_factory);
+ static DocumentProperties &getInstance();
static void destroy();
sigc::connection _doc_replaced_connection;
Registry _wr;
private:
- DocumentProperties(Behavior::BehaviorFactory behavior_factory);
+ DocumentProperties();
virtual ~DocumentProperties();
// callback methods for buttons on grids page.
index 4e4efafb5755f1a399b289db0e1595ae2a503d70..f95944c30aa89635033d0d355bc293b6052e07da 100644 (file)
--- a/src/ui/dialog/export.cpp
+++ b/src/ui/dialog/export.cpp
namespace UI {
namespace Dialog {
-Export::Export(Behavior::BehaviorFactory behavior_factory)
- : Dialog (behavior_factory, "dialogs.export", SP_VERB_FILE_EXPORT),
+Export::Export()
+ : UI::Widget::Panel("", "dialogs.export", SP_VERB_FILE_EXPORT),
_page_export(1, 1)
{
- // Top level vbox
- Gtk::VBox *vbox = get_vbox();
- vbox->set_spacing(4);
+ _getContents()->set_spacing(4);
// Notebook for individual transformations
- vbox->pack_start(_notebook, true, true);
+ _getContents()->pack_start(_notebook, true, true);
_notebook.append_page(_page_export, _("Export"));
diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h
index c47c7c8cc81d68d64d89ca2afad614cfa4b83022..5d83ae5df9cf56ac97684048eacb4ed8a0eac973 100644 (file)
--- a/src/ui/dialog/export.h
+++ b/src/ui/dialog/export.h
#include <gtkmm/notebook.h>
#include <glibmm/i18n.h>
-#include "dialog.h"
+#include "ui/widget/panel.h"
#include "ui/widget/notebook-page.h"
using namespace Inkscape::UI::Widget;
namespace UI {
namespace Dialog {
-class Export : public Dialog {
+class Export : public UI::Widget::Panel {
public:
- Export(Behavior::BehaviorFactory behavior_factory);
+ Export();
virtual ~Export();
- static Export *create(Behavior::BehaviorFactory behavior_factory)
- { return new Export(behavior_factory); }
+ static Export& getInstance() { return *new Export(); }
protected:
Gtk::Notebook _notebook;
index 3a62cb14481b317edda67427a18685b570c273f0..d26e05f0795b00f1938c467250fc8bc84b9072b2 100644 (file)
about the selected extension. A handler is set up so that when
a new extension is selected, the notebooks are changed appropriately.
*/
-ExtensionEditor::ExtensionEditor(Behavior::BehaviorFactory behavior_factory)
- : Dialog (behavior_factory, "dialogs.extensioneditor", SP_VERB_DIALOG_EXTENSIONEDITOR)
+ExtensionEditor::ExtensionEditor()
+ : UI::Widget::Panel ("", "dialogs.extensioneditor", SP_VERB_DIALOG_EXTENSIONEDITOR)
{
_notebook_info.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
_notebook_help.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
Gtk::HBox* hbox_list_page = Gtk::manage(new Gtk::HBox());
hbox_list_page->set_border_width(12);
hbox_list_page->set_spacing(12);
- this->get_vbox()->add(*hbox_list_page);
+ _getContents()->add(*hbox_list_page);
//Pagelist
gchar title[500];
sp_ui_dialog_title_string (Inkscape::Verb::get(SP_VERB_DIALOG_EXTENSIONEDITOR), title);
Glib::ustring utitle(title);
- set_title(utitle + ": " + name);
+ // set_title(utitle + ": " + name);
/* Clear the notbook pages */
_notebook_info.remove();
index 284a3651dac06c30a7eec54013ae2515dc8987f6..cfda36856b5ea11233f89f44b75759c0fb9b9caf 100644 (file)
#ifndef INKSCAPE_UI_DIALOG_EXTENSION_EDITOR_H
#define INKSCAPE_UI_DIALOG_EXTENSION_EDITOR_H
-#include "dialog.h"
+#include "ui/widget/panel.h"
#include <glibmm/i18n.h>
namespace UI {
namespace Dialog {
-class ExtensionEditor : public Dialog {
+class ExtensionEditor : public UI::Widget::Panel {
public:
- ExtensionEditor(Behavior::BehaviorFactory behavior_factory);
+ ExtensionEditor();
virtual ~ExtensionEditor();
- static ExtensionEditor *create(Behavior::BehaviorFactory behavior_factory)
- { return new ExtensionEditor(behavior_factory); }
+ static ExtensionEditor &getInstance() { return *new ExtensionEditor(); }
static void show_help (gchar const * extension_id);
index 85dc05c556226eafd9040c1f845cdcf18b5fb920..4f32d3d91df7be99afff404d479597fffba13737 100644 (file)
}
-FillAndStroke::FillAndStroke(Behavior::BehaviorFactory behavior_factory)
- : Dialog (behavior_factory, "dialogs.fillstroke", SP_VERB_DIALOG_FILL_STROKE),
+FillAndStroke::FillAndStroke()
+ : UI::Widget::Panel ("", "dialogs.fillstroke", SP_VERB_DIALOG_FILL_STROKE),
_page_fill(1, 1, true, true),
_page_stroke_paint(1, 1, true, true),
_page_stroke_style(1, 1, true, true),
_opacity_spin_button(_opacity_adjustment, 0.01, 1),
_blocked(false)
{
- Gtk::VBox *vbox = get_vbox();
- vbox->set_spacing(0);
+ Gtk::Box *contents = _getContents();
+ contents->set_spacing(0);
- vbox->pack_start(_notebook, true, true);
+ contents->pack_start(_notebook, true, true);
_notebook.append_page(_page_fill, _createPageTabLabel(_("Fill"), INKSCAPE_STOCK_PROPERTIES_FILL_PAGE));
_notebook.append_page(_page_stroke_paint, _createPageTabLabel(_("Stroke _paint"), INKSCAPE_STOCK_PROPERTIES_STROKE_PAINT_PAGE));
_layoutPageStrokeStyle();
// Filter Effects
- vbox->pack_start(_fe_vbox, false, false, 2);
+ contents->pack_start(_fe_vbox, false, false, 2);
_fe_alignment.set_padding(0, 0, 4, 0);
_fe_alignment.add(_fe_cb);
_fe_vbox.pack_start(_fe_alignment, false, false, 0);
_fe_cb.signal_blend_blur_changed().connect(sigc::mem_fun(*this, &Inkscape::UI::Dialog::FillAndStroke::_blendBlurValueChanged));
// Opacity
- vbox->pack_start(_opacity_vbox, false, false, 2);
+ contents->pack_start(_opacity_vbox, false, false, 2);
_opacity_label_box.pack_start(_opacity_label, false, false, 4);
_opacity_vbox.pack_start(_opacity_label_box, false, false, 0);
_opacity_vbox.pack_start(_opacity_hbox, false, false, 0);
index 8c27d6d0a1d835a917f895e951865b807354e664..f2313adae6124914432d7c8d500333ca30d10492 100644 (file)
#include <gtkmm/spinbutton.h>
#include <glibmm/i18n.h>
-#include "dialog.h"
+#include "ui/widget/panel.h"
#include "ui/widget/notebook-page.h"
#include "ui/widget/filter-effect-chooser.h"
namespace UI {
namespace Dialog {
-class FillAndStroke : public Dialog {
+class FillAndStroke : public UI::Widget::Panel {
public:
- FillAndStroke(Behavior::BehaviorFactory behavior_factory);
+ FillAndStroke();
virtual ~FillAndStroke();
- static FillAndStroke *create(Behavior::BehaviorFactory behavior_factory)
- { return new FillAndStroke(behavior_factory); }
+ static FillAndStroke &getInstance() { return *new FillAndStroke(); }
void selectionChanged(Inkscape::Application *inkscape,
Inkscape::Selection *selection);
Gtk::HScale _opacity_hscale;
Gtk::SpinButton _opacity_spin_button;
- Gtk::HBox& _createPageTabLabel(const Glib::ustring& label,
+ Gtk::HBox &_createPageTabLabel(const Glib::ustring &label,
const char *label_image);
SimpleFilterModifier _fe_cb;
index ecaf3a11b267d2a48530dde0d4dbc0b8b664d36e..721a9e27e792047327b94193229b650e859be584 100644 (file)
/*** FilterEffectsDialog ***/
-FilterEffectsDialog::FilterEffectsDialog(Behavior::BehaviorFactory behavior_factory)
- : Dialog (behavior_factory, "dialogs.filtereffects", SP_VERB_DIALOG_FILTER_EFFECTS),
+FilterEffectsDialog::FilterEffectsDialog()
+ : UI::Widget::Panel("", "dialogs.filtereffects", SP_VERB_DIALOG_FILTER_EFFECTS),
_filter_modifier(*this),
_primitive_list(*this),
_add_primitive_type(FPConverter),
@@ -1861,7 +1861,7 @@ FilterEffectsDialog::FilterEffectsDialog(Behavior::BehaviorFactory behavior_fact
Gtk::HBox* hb_prims = Gtk::manage(new Gtk::HBox);
Gtk::Frame* fr_settings = Gtk::manage(new Gtk::Frame(_("<b>Effect parameters</b>")));
Gtk::Alignment* al_settings = Gtk::manage(new Gtk::Alignment);
- get_vbox()->add(*hpaned);
+ _getContents()->add(*hpaned);
hpaned->pack1(_filter_modifier);
hpaned->pack2(_primitive_box);
_primitive_box.pack_start(*sw_prims);
@@ -1869,7 +1869,7 @@ FilterEffectsDialog::FilterEffectsDialog(Behavior::BehaviorFactory behavior_fact
sw_prims->add(_primitive_list);
hb_prims->pack_end(_add_primitive_type, false, false);
hb_prims->pack_end(_add_primitive, false, false);
- get_vbox()->pack_start(*fr_settings, false, false);
+ _getContents()->pack_start(*fr_settings, false, false);
fr_settings->add(*al_settings);
al_settings->add(_settings_box);
index d1a5039e3ed708a7cb8703279a7af2962e5497fe..2cbd90f5f7a08a5838373eb53f97109dab7552f0 100644 (file)
#include <gtkmm/treeview.h>
#include "attributes.h"
-#include "dialog.h"
+#include "ui/widget/panel.h"
#include "sp-filter.h"
#include "ui/widget/combo-enums.h"
#include "ui/widget/spin-slider.h"
class DualSpinButton;
class MultiSpinButton;
-class FilterEffectsDialog : public Dialog {
+class FilterEffectsDialog : public UI::Widget::Panel {
public:
- FilterEffectsDialog(Behavior::BehaviorFactory behavior_factory);
+ FilterEffectsDialog();
~FilterEffectsDialog();
- static FilterEffectsDialog *create(Behavior::BehaviorFactory behavior_factory)
- { return new FilterEffectsDialog(behavior_factory); }
+ static FilterEffectsDialog &getInstance()
+ { return *new FilterEffectsDialog(); }
void set_attrs_locked(const bool);
private:
std::auto_ptr<SignalObserver> _observer;
};
- FilterEffectsDialog();
void init_settings_widgets();
// Handlers
diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp
index 0a0538c30ab4efcf512b455bcd9af609dd2cc79c..cfc1bfeb256da45dd1e0dffa90636a656c484625 100644 (file)
--- a/src/ui/dialog/find.cpp
+++ b/src/ui/dialog/find.cpp
namespace UI {
namespace Dialog {
-Find::Find(Behavior::BehaviorFactory behavior_factory)
- : Dialog (behavior_factory, "dialogs.find", SP_VERB_DIALOG_FIND),
+Find::Find()
+ : UI::Widget::Panel("", "dialogs.find", SP_VERB_DIALOG_FIND),
_entry_text(_("_Text: "), _("Find objects by their text content (exact or partial match)")),
_entry_id(_("_ID: "), _("Find objects by the value of the id attribute (exact or partial match)")),
_entry_style(_("_Style: "), _("Find objects by the value of the style attribute (exact or partial match)")),
_button_clear(_("_Clear"), _("Clear values")),
_button_find(_("_Find"), _("Select objects matching all of the fields you filled in"))
{
- // Top level vbox
- Gtk::VBox *vbox = get_vbox();
- vbox->set_spacing(4);
+ Gtk::Box *contents = _getContents();
+ contents->set_spacing(4);
- vbox->pack_start(_entry_text, true, true);
- vbox->pack_start(_entry_id, true, true);
- vbox->pack_start(_entry_style, true, true);
- vbox->pack_start(_entry_attribute, true, true);
-
- vbox->pack_start(_check_all, true, true);
- vbox->pack_start(_check_all_shapes, true, true);
- vbox->pack_start(_check_rects, true, true);
- vbox->pack_start(_check_ellipses, true, true);
- vbox->pack_start(_check_stars, true, true);
- vbox->pack_start(_check_spirals, true, true);
- vbox->pack_start(_check_paths, true, true);
- vbox->pack_start(_check_texts, true, true);
- vbox->pack_start(_check_groups, true, true);
- vbox->pack_start(_check_clones, true, true);
- vbox->pack_start(_check_images, true, true);
- vbox->pack_start(_check_offsets, true, true);
-
- vbox->pack_start(_check_search_selection, true, true);
- vbox->pack_start(_check_search_layer, true, true);
- vbox->pack_start(_check_include_hidden, true, true);
- vbox->pack_start(_check_include_locked, true, true);
-
- vbox->pack_start(_button_clear, true, true);
- vbox->pack_start(_button_find, true, true);
+ contents->pack_start(_entry_text, true, true);
+ contents->pack_start(_entry_id, true, true);
+ contents->pack_start(_entry_style, true, true);
+ contents->pack_start(_entry_attribute, true, true);
+
+ contents->pack_start(_check_all, true, true);
+ contents->pack_start(_check_all_shapes, true, true);
+ contents->pack_start(_check_rects, true, true);
+ contents->pack_start(_check_ellipses, true, true);
+ contents->pack_start(_check_stars, true, true);
+ contents->pack_start(_check_spirals, true, true);
+ contents->pack_start(_check_paths, true, true);
+ contents->pack_start(_check_texts, true, true);
+ contents->pack_start(_check_groups, true, true);
+ contents->pack_start(_check_clones, true, true);
+ contents->pack_start(_check_images, true, true);
+ contents->pack_start(_check_offsets, true, true);
+
+ contents->pack_start(_check_search_selection, true, true);
+ contents->pack_start(_check_search_layer, true, true);
+ contents->pack_start(_check_include_hidden, true, true);
+ contents->pack_start(_check_include_locked, true, true);
+
+ contents->pack_start(_button_clear, true, true);
+ contents->pack_start(_button_find, true, true);
// set signals to handle clicks
_check_all.signal_clicked().connect(sigc::mem_fun(*this, &Find::onToggleAlltypes));
_button_find.signal_clicked().connect(sigc::mem_fun(*this, &Find::onFind));
_button_find.set_flags(Gtk::CAN_DEFAULT);
- set_default (_button_find); // activatable by Enter
+ // set_default (_button_find); // activatable by Enter
_entry_text.getEntry()->grab_focus();
show_all_children();
diff --git a/src/ui/dialog/find.h b/src/ui/dialog/find.h
index fb52b2c8e2ebc19a730af7ae1a7eff0acffb7d2b..2d79b37adae510e0f7835f7fca456509dff33999 100644 (file)
--- a/src/ui/dialog/find.h
+++ b/src/ui/dialog/find.h
#include <glibmm/i18n.h>
-#include "dialog.h"
+#include "ui/widget/panel.h"
#include "ui/widget/button.h"
#include "ui/widget/entry.h"
#include <gtkmm/separator.h>
namespace UI {
namespace Dialog {
-class Find : public Dialog {
+class Find : public UI::Widget::Panel {
public:
- Find(Behavior::BehaviorFactory behavior_factory);
+ Find();
virtual ~Find();
- static Find *create(Behavior::BehaviorFactory behavior_factory)
- { return new Find(behavior_factory); }
+ static Find &getInstance() { return *new Find(); }
protected:
// Widgets:
index 7d321b21b9e7494a7aefe6a7c154b8ef11f7f28b..7e76b521175de5baca86bd0a8e6bbf33a82d9bb5 100644 (file)
namespace Dialog {
namespace Behavior {
-FloatingBehavior::FloatingBehavior(Dialog& dialog) :
+FloatingBehavior::FloatingBehavior(Dialog &dialog) :
Behavior(dialog),
_d (new Gtk::Dialog(_dialog._title))
{
hide();
_d->set_has_separator(false);
- signal_response().connect(sigc::mem_fun(_dialog, &Inkscape::UI::Dialog::Dialog::_onResponse));
signal_delete_event().connect(sigc::mem_fun(_dialog, &Inkscape::UI::Dialog::Dialog::_onDeleteEvent));
sp_transientize(GTK_WIDGET(_d->gobj()));
}
Behavior *
-FloatingBehavior::create(Dialog& dialog)
+FloatingBehavior::create(Dialog &dialog)
{
return new FloatingBehavior(dialog);
}
-inline FloatingBehavior::operator Gtk::Widget&() { return *_d; }
+inline FloatingBehavior::operator Gtk::Widget &() { return *_d; }
inline GtkWidget *FloatingBehavior::gobj() { return GTK_WIDGET(_d->gobj()); }
inline Gtk::VBox* FloatingBehavior::get_vbox() { return _d->get_vbox(); }
inline void FloatingBehavior::present() { _d->present(); }
inline void FloatingBehavior::move(int x, int y) { _d->move(x, y); }
inline void FloatingBehavior::set_position(Gtk::WindowPosition position) { _d->set_position(position); }
inline void FloatingBehavior::set_size_request(int width, int height) { _d->set_size_request(width, height); }
-inline void FloatingBehavior::size_request(Gtk::Requisition& requisition) { _d->size_request(requisition); }
-inline void FloatingBehavior::get_position(int& x, int& y) { _d->get_position(x, y); }
-inline void FloatingBehavior::get_size(int& width, int& height) { _d->get_size(width, height); }
+inline void FloatingBehavior::size_request(Gtk::Requisition &requisition) { _d->size_request(requisition); }
+inline void FloatingBehavior::get_position(int &x, int &y) { _d->get_position(x, y); }
+inline void FloatingBehavior::get_size(int &width, int &height) { _d->get_size(width, height); }
inline void FloatingBehavior::set_title(Glib::ustring title) { _d->set_title(title); }
inline void FloatingBehavior::set_sensitive(bool sensitive) { _d->set_sensitive(sensitive); }
-void FloatingBehavior::set_response_sensitive(int response_id, bool setting)
-{ _d->set_response_sensitive(response_id, setting); }
-
-Gtk::Button *FloatingBehavior::add_button(const Glib::ustring& button_text, int response_id)
-{ return _d->add_button(button_text, response_id); }
-
-Gtk::Button *FloatingBehavior::add_button(const Gtk::StockID& stock_id, int response_id)
-{ return _d->add_button(stock_id, response_id); }
-
-inline void FloatingBehavior::set_default_response(int response_id) { _d->set_default_response(response_id); }
-
Glib::SignalProxy0<void> FloatingBehavior::signal_show() { return _d->signal_show(); }
Glib::SignalProxy0<void> FloatingBehavior::signal_hide() { return _d->signal_hide(); }
Glib::SignalProxy1<bool, GdkEventAny *> FloatingBehavior::signal_delete_event () { return _d->signal_delete_event(); }
-Glib::SignalProxy1<void, int> FloatingBehavior::signal_response () { return _d->signal_response(); }
void
index 354987dde1265732ff8c38a968c41146e299adf5..a7e6ef3a047bac0fb495c29382e1c010290a6e5d 100644 (file)
class FloatingBehavior : public Behavior {
public:
- static Behavior *create(Dialog& dialog);
+ static Behavior *create(Dialog &dialog);
~FloatingBehavior();
/** Gtk::Dialog methods */
- operator Gtk::Widget&();
+ operator Gtk::Widget &();
GtkWidget *gobj();
void present();
Gtk::VBox *get_vbox();
void move(int x, int y);
void set_position(Gtk::WindowPosition);
void set_size_request(int width, int height);
- void size_request(Gtk::Requisition& requisition);
- void get_position(int& x, int& y);
- void get_size(int& width, int& height);
+ void size_request(Gtk::Requisition &requisition);
+ void get_position(int &x, int &y);
+ void get_size(int& width, int &height);
void set_title(Glib::ustring title);
- void set_response_sensitive(int response_id, bool setting);
void set_sensitive(bool sensitive);
- Gtk::Button *add_button(const Glib::ustring& button_text, int response_id);
- Gtk::Button *add_button(const Gtk::StockID& stock_id, int response_id);
- void set_default_response(int response_id);
/** Gtk::Dialog signal proxies */
Glib::SignalProxy0<void> signal_show();
Glib::SignalProxy0<void> signal_hide();
Glib::SignalProxy1<bool, GdkEventAny *> signal_delete_event();
- Glib::SignalProxy1<void, int> signal_response();
/** Custom signal handlers */
void onHideF12();
index 5d747807ba91474bf09d88a66d2100857d567b2f..df2952f20c41d90373c7ab632ba88b2327d2e118 100644 (file)
namespace UI {
namespace Dialog {
-InkscapePreferences::InkscapePreferences(Behavior::BehaviorFactory behavior_factory)
- : Dialog (behavior_factory, "dialogs.preferences", SP_VERB_DIALOG_DISPLAY),
+InkscapePreferences::InkscapePreferences()
+ : UI::Widget::Panel ("", "dialogs.preferences", SP_VERB_DIALOG_DISPLAY),
_max_dialog_width(0),
_max_dialog_height(0),
_current_page(0)
@@ -52,19 +52,19 @@ InkscapePreferences::InkscapePreferences(Behavior::BehaviorFactory behavior_fact
//get the width of a spinbutton
Gtk::SpinButton* sb = new Gtk::SpinButton;
sb->set_width_chars(6);
- this->get_vbox()->add(*sb);
- this->show_all_children();
- Gtk:: Requisition sreq;
+ _getContents()->add(*sb);
+ show_all_children();
+ Gtk::Requisition sreq;
sb->size_request(sreq);
_sb_width = sreq.width;
- this->get_vbox()->remove(*sb);
+ _getContents()->remove(*sb);
delete sb;
//Main HBox
Gtk::HBox* hbox_list_page = Gtk::manage(new Gtk::HBox());
hbox_list_page->set_border_width(12);
hbox_list_page->set_spacing(12);
- this->get_vbox()->add(*hbox_list_page);
+ _getContents()->add(*hbox_list_page);
//Pagelist
Gtk::Frame* list_frame = Gtk::manage(new Gtk::Frame());
@@ -106,11 +106,13 @@ InkscapePreferences::InkscapePreferences(Behavior::BehaviorFactory behavior_fact
initPageCMS();
initPageMisc();
+ signalPresent().connect(sigc::mem_fun(*this, &InkscapePreferences::_presentPages));
+
//calculate the size request for this dialog
this->show_all_children();
_page_list.expand_all();
_page_list_model->foreach_iter(sigc::mem_fun(*this, &InkscapePreferences::SetMaxDialogSize));
- this->set_size_request(_max_dialog_width, _max_dialog_height);
+ _getContents()->set_size_request(_max_dialog_width, _max_dialog_height);
_page_list.collapse_all();
}
{
}
-void InkscapePreferences::present()
-{
- _page_list_model->foreach_iter(sigc::mem_fun(*this, &InkscapePreferences::PresentPage));
- Dialog::present();
-}
-
Gtk::TreeModel::iterator InkscapePreferences::AddPage(DialogPage& p, Glib::ustring title, int id)
{
return AddPage(p, title, Gtk::TreeModel::iterator() , id);
}
}
+void InkscapePreferences::_presentPages()
+{
+ _page_list_model->foreach_iter(sigc::mem_fun(*this, &InkscapePreferences::PresentPage));
+}
+
} // namespace Dialog
} // namespace UI
} // namespace Inkscape
index 12a73d017f85ff53f1f3f2ef476441a03612cefb..f5853c38ba44ee6bc55e4c7e65326de2a21cb411 100644 (file)
#include <sigc++/sigc++.h>
#include <glibmm/i18n.h>
-#include "dialog.h"
+#include "ui/widget/panel.h"
// UPDATE THIS IF YOU'RE ADDING PREFS PAGES.
// Otherwise the commands that open the dialog with the new page will fail.
namespace UI {
namespace Dialog {
-class InkscapePreferences : public Dialog {
+class InkscapePreferences : public UI::Widget::Panel {
public:
virtual ~InkscapePreferences();
- static InkscapePreferences *create(Behavior::BehaviorFactory behavior_factory)
- { return new InkscapePreferences(behavior_factory); }
-
- void present();
+ static InkscapePreferences &getInstance() { return *new InkscapePreferences(); }
protected:
Gtk::Frame _page_frame;
void initPageCMS();
void initPageMisc();
+ void _presentPages();
+
private:
- InkscapePreferences(Behavior::BehaviorFactory behavior_factory);
+ InkscapePreferences();
InkscapePreferences(InkscapePreferences const &d);
InkscapePreferences operator=(InkscapePreferences const &d);
};
index cb4b8a0b4122680e972896f07c56557f599bbeec..2b596e821446a427c603326fad324dbe7fb9ef7c 100644 (file)
namespace UI {
namespace Dialog {
-LayerEditor::LayerEditor(Behavior::BehaviorFactory behavior_factory)
- : Dialog (behavior_factory, "dialogs.layers", SP_VERB_NONE /*FIXME*/)
+
+LayerEditor::LayerEditor()
+ : UI::Widget::Panel("", "dialogs.layers", SP_VERB_NONE)
{
// TODO: Insert widgets
index 3c25c7bc081b81129930a96be7dee4d4bd2905f5..0bb98dabf4f18e2f289d0016a95bad565f7b1559 100644 (file)
#ifndef INKSCAPE_UI_DIALOG_LAYER_EDITOR_H
#define INKSCAPE_UI_DIALOG_LAYER_EDITOR_H
-#include "dialog.h"
+#include "ui/widget/panel.h"
#include <glibmm/i18n.h>
namespace UI {
namespace Dialog {
-class LayerEditor : public Dialog {
+class LayerEditor : public UI::Widget::Panel {
public:
- LayerEditor(Behavior::BehaviorFactory behavior_factory);
+ LayerEditor();
virtual ~LayerEditor();
- static LayerEditor *create(Behavior::BehaviorFactory behavior_factory)
- { return new LayerEditor(behavior_factory); }
+ static int get_verb();
+
+ static LayerEditor &getInstance() { return *new LayerEditor(); }
protected:
index ee12e652abe5b11e387c228143a7022abc2c1111..6ec078ce034ad940a313b642b1a70b838e9d7ba4 100644 (file)
@@ -62,12 +62,12 @@ static void lpeeditor_desktop_change(Inkscape::Application*, SPDesktop* desktop,
}
-
/*#######################
* LivePathEffectEditor
*/
-LivePathEffectEditor::LivePathEffectEditor(Behavior::BehaviorFactory behavior_factory)
- : Dialog (behavior_factory, "dialogs.livepatheffect", SP_VERB_DIALOG_LIVE_PATH_EFFECT),
+
+LivePathEffectEditor::LivePathEffectEditor()
+ : UI::Widget::Panel("", "dialogs.livepatheffect", SP_VERB_DIALOG_LIVE_PATH_EFFECT),
combo_effecttype(Inkscape::LivePathEffect::LPETypeConverter),
button_apply(_("_Apply"), _("Apply chosen effect to selection")),
button_remove(_("_Remove"), _("Remove effect from selection")),
effectcontrol_frame(_("Current effect")),
current_desktop(NULL)
{
- // Top level vbox
- Gtk::VBox *vbox = get_vbox();
- vbox->set_spacing(4);
+ Gtk::Box *contents = _getContents();
+ contents->set_spacing(4);
effectapplication_hbox.set_spacing(4);
effectcontrol_vbox.set_spacing(4);
effectcontrol_vbox.pack_end(button_remove, true, true);
effectcontrol_frame.add(effectcontrol_vbox);
- vbox->pack_start(effectapplication_frame, true, true);
- vbox->pack_start(effectcontrol_frame, true, true);
+ contents->pack_start(effectapplication_frame, true, true);
+ contents->pack_start(effectcontrol_frame, true, true);
// connect callback functions to buttons
button_apply.signal_clicked().connect(sigc::mem_fun(*this, &LivePathEffectEditor::onApply));
index 5a40cfd307403fd2b5e6548a9fa45e770d9720b8..2ec1f9d1474a31d34926131e0fdb09466e91efbe 100644 (file)
#ifndef INKSCAPE_UI_DIALOG_LIVE_PATH_EFFECT_H
#define INKSCAPE_UI_DIALOG_LIVE_PATH_EFFECT_H
-#include "dialog.h"
+#include "ui/widget/panel.h"
#include "ui/widget/button.h"
#include <gtkmm/label.h>
namespace UI {
namespace Dialog {
-class LivePathEffectEditor : public Dialog {
+class LivePathEffectEditor : public UI::Widget::Panel {
public:
- LivePathEffectEditor(Behavior::BehaviorFactory behavior_factory);
+ LivePathEffectEditor();
virtual ~LivePathEffectEditor();
- static LivePathEffectEditor *create(Behavior::BehaviorFactory behavior_factory)
- { return new LivePathEffectEditor(behavior_factory); }
+ static LivePathEffectEditor &getInstance() { return *new LivePathEffectEditor(); }
void onSelectionChanged(Inkscape::Selection *sel);
void setDesktop(SPDesktop *desktop);
index eb61aaf9f67ee47d7c746dae8c47d65552adc2bd..1931976d6b2c106098b459a076dd7cbe719bf537 100644 (file)
--- a/src/ui/dialog/memory.cpp
+++ b/src/ui/dialog/memory.cpp
update_task.disconnect();
}
-Memory::Memory(Behavior::BehaviorFactory behavior_factory)
- : Dialog (behavior_factory, "dialogs.memory", SP_VERB_HELP_MEMORY, _("Recalculate")),
+Memory::Memory()
+ : UI::Widget::Panel ("", "dialogs.memory", SP_VERB_HELP_MEMORY, _("Recalculate")),
_private(*(new Memory::Private()))
{
- get_vbox()->add(_private.view);
+ _getContents()->add(_private.view);
_private.update();
diff --git a/src/ui/dialog/memory.h b/src/ui/dialog/memory.h
index 0fe7f87c575da149ac5c7e2f4e4494f2844c37cc..6f832f3e1c4f64f67a7af8d84eee4cc18892a878 100644 (file)
--- a/src/ui/dialog/memory.h
+++ b/src/ui/dialog/memory.h
#ifndef SEEN_INKSCAPE_UI_DIALOG_MEMORY_H
#define SEEN_INKSCAPE_UI_DIALOG_MEMORY_H
-#include "dialog.h"
+#include "ui/widget/panel.h"
namespace Inkscape {
namespace UI {
namespace Dialog {
-class Memory : public Dialog {
+class Memory : public UI::Widget::Panel {
public:
- Memory(Behavior::BehaviorFactory behavior_factory);
+ Memory();
~Memory();
- static Memory *create(Behavior::BehaviorFactory behavior_factory)
- { return new Memory(behavior_factory); }
+ static Memory &getInstance() { return *new Memory(); }
protected:
void _apply();
index 9e78903c9ea5347ba142083faa217939bb642681..43f80ab65482fc86af6646469b32650e4390ed2a 100644 (file)
/**
* Constructor
*/
-Messages::Messages(Behavior::BehaviorFactory behavior_factory)
- : Dialog (behavior_factory, "dialogs.messages", SP_VERB_DIALOG_DEBUG)
+Messages::Messages()
+ : UI::Widget::Panel("", "dialogs.messages", SP_VERB_DIALOG_DEBUG)
{
- Gtk::VBox *mainVBox = get_vbox();
+ Gtk::Box *contents = _getContents();
//## Add a menu for clear()
menuBar.items().push_back( Gtk::Menu_Helpers::MenuElem(_("_File"), fileMenu) );
sigc::mem_fun(*this, &Messages::captureLogMessages) ) );
fileMenu.items().push_back( Gtk::Menu_Helpers::MenuElem(_("Release log messages"),
sigc::mem_fun(*this, &Messages::releaseLogMessages) ) );
- mainVBox->pack_start(menuBar, Gtk::PACK_SHRINK);
+ contents->pack_start(menuBar, Gtk::PACK_SHRINK);
//### Set up the text widget
messageText.set_editable(false);
textScroll.add(messageText);
textScroll.set_policy(Gtk::POLICY_ALWAYS, Gtk::POLICY_ALWAYS);
- mainVBox->pack_start(textScroll);
+ contents->pack_start(textScroll);
// sick of this thing shrinking too much
set_size_request(400, 300);
index 85a7c4f0ffa08b03aae49c30bd98da45b5779797..8dcb718cca1da996a8ac2100c48b1226d923404b 100644 (file)
--- a/src/ui/dialog/messages.h
+++ b/src/ui/dialog/messages.h
#define INKSCAPE_UI_DIALOG_MESSAGES_H
#include <gtkmm/box.h>
-#include <gtkmm/dialog.h>
#include <gtkmm/textview.h>
#include <gtkmm/button.h>
#include <gtkmm/menubar.h>
#include <glibmm/i18n.h>
-#include "dialog.h"
+#include "ui/widget/panel.h"
namespace Inkscape {
namespace UI {
namespace Dialog {
-class Messages : public Dialog {
+class Messages : public UI::Widget::Panel {
public:
- Messages(Behavior::BehaviorFactory behavior_factory);
+ Messages();
virtual ~Messages();
- static Messages *create(Behavior::BehaviorFactory behavior_factory)
- { return new Messages(behavior_factory); }
+ static Messages &getInstance() { return *new Messages(); }
/**
* Clear all information from the dialog
diff --git a/src/ui/dialog/panel-dialog.h b/src/ui/dialog/panel-dialog.h
--- /dev/null
@@ -0,0 +1,116 @@
+/**
+ * \brief A panel holding dialog
+ *
+ * Authors:
+ * Gustav Broberg <broberg@kth.se>
+ *
+ * Copyright (C) 2007 Authors
+ *
+ * Released under GNU GPL. Read the file 'COPYING' for more information.
+ */
+
+#ifndef INKSCAPE_PANEL_DIALOG_H
+#define INKSCAPE_PANEL_DIALOG_H
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "verbs.h"
+
+#include "dialog.h"
+#include "dialogs/swatches.h"
+#include "ui/dialog/undo-history.h"
+#include "prefs-utils.h"
+
+namespace Inkscape {
+namespace UI {
+namespace Dialog {
+
+struct PanelDialogBase {
+ virtual void present() =0;
+ virtual Panel &getPanel() =0;
+ virtual ~PanelDialogBase() {}
+};
+
+template <typename Behavior>
+class PanelDialog : public PanelDialogBase, public Inkscape::UI::Dialog::Dialog {
+
+public:
+ PanelDialog(Panel &contents, char const *prefs_path, int const verb_num,
+ Glib::ustring const &apply_label);
+
+ virtual ~PanelDialog() {}
+
+ template <typename T>
+ static PanelDialog<Behavior> *create();
+
+ virtual void present();
+
+ Panel &getPanel() { return _panel; }
+
+private:
+ Panel &_panel;
+
+ PanelDialog(); // no constructor without params
+ PanelDialog(PanelDialog<Behavior> const &d); // no copy
+ PanelDialog<Behavior>& operator=(PanelDialog<Behavior> const &d); // no assign
+};
+
+
+
+template <typename B>
+PanelDialog<B>::PanelDialog(Panel &panel, char const *prefs_path, int const verb_num, Glib::ustring const &apply_label) :
+ Dialog(&B::create, prefs_path, verb_num, apply_label),
+ _panel (panel)
+{
+ Gtk::VBox *vbox = get_vbox();
+ _panel.signalResponse().connect(sigc::mem_fun(*this, &PanelDialog::_handleResponse));
+ _panel.signalPresent().connect(sigc::mem_fun(*this, &PanelDialog::present));
+
+ vbox->pack_start(_panel, true, true, 0);
+
+ if (prefs_get_int_attribute ("dialogs", "showclose", 0) || !apply_label.empty()) {
+ // TODO: make the order of buttons obey the global preference
+ if (!apply_label.empty()) {
+ panel.addResponseButton(apply_label, Gtk::RESPONSE_APPLY);
+ panel.setDefaultResponse(Gtk::RESPONSE_APPLY);
+ }
+ panel.addResponseButton(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
+ }
+
+ show_all_children();
+}
+
+template <typename B> template <typename P>
+PanelDialog<B> *
+PanelDialog<B>::create()
+{
+ Panel &panel = P::getInstance();
+ return new PanelDialog<B>(panel, panel.getPrefsPath(),
+ panel.getVerb(), panel.getApplyLabel());
+}
+
+template <typename B>
+void
+PanelDialog<B>::present()
+{
+ Dialog::present();
+}
+
+} // namespace Dialog
+} // namespace UI
+} // namespace Inkscape
+
+#endif //INKSCAPE_PANEL_DIALOG_H
+
+/*
+ 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 :
index 304362f60b3d2b84583c3ac07de8da11a1d5b0ac..a56e74df33a1905aa3a2d055d9d124f506887dd3 100644 (file)
/**
* Constructor
*/
- ScriptDialogImpl(Behavior::BehaviorFactory behavior_factory);
+ ScriptDialogImpl();
/**
* Destructor
/**
* Constructor
*/
-ScriptDialogImpl::ScriptDialogImpl(Behavior::BehaviorFactory behavior_factory) :
- ScriptDialog(behavior_factory)
+ScriptDialogImpl::ScriptDialogImpl() :
+ ScriptDialog()
{
- Gtk::VBox *mainVBox = get_vbox();
+ Gtk::Box *contents = _getContents();
//## Add a menu for clear()
menuBar.items().push_back( Gtk::Menu_Helpers::MenuElem(_("_File"), fileMenu) );
@@ -209,7 +209,7 @@ ScriptDialogImpl::ScriptDialogImpl(Behavior::BehaviorFactory behavior_factory) :
fileMenu.items().push_back( Gtk::Menu_Helpers::MenuElem(_("_Execute Perl"),
sigc::mem_fun(*this, &ScriptDialogImpl::executePerl) ) );
#endif
- mainVBox->pack_start(menuBar, Gtk::PACK_SHRINK);
+ contents->pack_start(menuBar, Gtk::PACK_SHRINK);
//### Set up the script field
scriptText.set_editable(true);
@@ -219,7 +219,7 @@ ScriptDialogImpl::ScriptDialogImpl(Behavior::BehaviorFactory behavior_factory) :
scriptTextFrame.set_label(_("Script"));
scriptTextFrame.set_shadow_type(Gtk::SHADOW_NONE);
scriptTextFrame.add(scriptTextScroll);
- mainVBox->pack_start(scriptTextFrame);
+ contents->pack_start(scriptTextFrame);
//### Set up the output field
outputText.set_editable(true);
@@ -229,7 +229,7 @@ ScriptDialogImpl::ScriptDialogImpl(Behavior::BehaviorFactory behavior_factory) :
outputTextFrame.set_label(_("Output"));
outputTextFrame.set_shadow_type(Gtk::SHADOW_NONE);
outputTextFrame.add(outputTextScroll);
- mainVBox->pack_start(outputTextFrame);
+ contents->pack_start(outputTextFrame);
//### Set up the error field
errorText.set_editable(true);
@@ -239,7 +239,7 @@ ScriptDialogImpl::ScriptDialogImpl(Behavior::BehaviorFactory behavior_factory) :
errorTextFrame.set_label(_("Errors"));
errorTextFrame.set_shadow_type(Gtk::SHADOW_NONE);
errorTextFrame.add(errorTextScroll);
- mainVBox->pack_start(errorTextFrame);
+ contents->pack_start(errorTextFrame);
// sick of this thing shrinking too much
set_size_request(350, 400);
@@ -250,10 +250,10 @@ ScriptDialogImpl::ScriptDialogImpl(Behavior::BehaviorFactory behavior_factory) :
/**
* Factory method. Use this to create a new ScriptDialog
*/
-ScriptDialog *ScriptDialog::create(Behavior::BehaviorFactory behavior_factory)
+ScriptDialog &ScriptDialog::getInstance()
{
- ScriptDialog *dialog = new ScriptDialogImpl(behavior_factory);
- return dialog;
+ ScriptDialog *dialog = new ScriptDialogImpl();
+ return *dialog;
}
index 00680d4312330410d134e3e775c6777b35ee65c0..780d44a92500accee5f45332eed6ff0a503fe24e 100644 (file)
*/
-#include "dialog.h"
+#include "ui/widget/panel.h"
#include "verbs.h"
namespace Inkscape {
/**
* A script editor, loader, and executor
*/
-class ScriptDialog : public Dialog
+class ScriptDialog : public UI::Widget::Panel
{
public:
/**
* Constructor
*/
- ScriptDialog(Behavior::BehaviorFactory behavior_factory) :
- Dialog (behavior_factory, "dialogs.script", SP_VERB_DIALOG_SCRIPT)
+ ScriptDialog() :
+ UI::Widget::Panel("", "dialogs.script", SP_VERB_DIALOG_SCRIPT)
{}
/**
* Factory method
*/
- static ScriptDialog *create(Behavior::BehaviorFactory behavior_factory);
+ static ScriptDialog &getInstance();
/**
* Destructor
index e6194ab564fb885726ede53d12ca91ffa6a3be75..5ad08f01f9dd9a3726f667809fe6e8151aebd0e8 100644 (file)
namespace UI {
namespace Dialog {
-TextProperties::TextProperties(Behavior::BehaviorFactory behavior_factory)
- : Dialog (behavior_factory, "dialogs.textandfont", SP_VERB_DIALOG_TEXT),
+TextProperties::TextProperties()
+ : UI::Widget::Panel("", "dialogs.textandfont", SP_VERB_DIALOG_TEXT),
_page_font(1, 1),
_page_text(1, 1)
{
- // Top level vbox
- Gtk::VBox *vbox = get_vbox();
- vbox->set_spacing(4);
+ Gtk::Box *contents = _getContents();
+
+ contents->set_spacing(4);
// Notebook for individual transformations
- vbox->pack_start(_notebook, true, true);
+ contents->pack_start(_notebook, true, true);
// TODO: Insert widgets
_notebook.append_page(_page_font, _("Font"));
_notebook.append_page(_page_text, _("Text"));
- set_resizable (true);
set_size_request(450, 300);
show_all_children();
index 393ca63b2db72a3e8f52c2f28cd2bf6ecf3ea24b..f6ef0d861e97d1e3797b67dd8dbb9ddd19ebe870 100644 (file)
#include <gtkmm/notebook.h>
#include <glibmm/i18n.h>
-#include "dialog.h"
+#include "ui/widget/panel.h"
#include "ui/widget/notebook-page.h"
using namespace Inkscape::UI::Widget;
namespace UI {
namespace Dialog {
-class TextProperties : public Dialog {
+class TextProperties : public UI::Widget::Panel {
public:
- TextProperties(Behavior::BehaviorFactory behavior_factory);
+ TextProperties();
virtual ~TextProperties();
- static TextProperties *create(Behavior::BehaviorFactory behavior_factory)
- { return new TextProperties(behavior_factory); }
+ static int get_verb();
+
+ static TextProperties &getInstance() { return *new TextProperties(); }
protected:
Gtk::Notebook _notebook;
index b7602b36a4efd29af196d0797a57a3323eb40569..84d7978fb317b9d1717547265f5540a413ab9f56 100644 (file)
/**
* Constructor
*/
- TraceDialogImpl(Behavior::BehaviorFactory behavior_factory);
+ TraceDialogImpl();
/**
* Destructor
/**
* Constructor
*/
-TraceDialogImpl::TraceDialogImpl(Behavior::BehaviorFactory behavior_factory) :
- TraceDialog(behavior_factory)
+TraceDialogImpl::TraceDialogImpl() :
+ TraceDialog()
{
- Gtk::VBox *mainVBox = get_vbox();
+ Gtk::Box *contents = _getContents();
#define MARGIN 2
//#### begin left panel
@@ -664,32 +664,31 @@ TraceDialogImpl::TraceDialogImpl(Behavior::BehaviorFactory behavior_factory) :
//#### Global stuff
- mainVBox->pack_start(mainHBox);
+ contents->pack_start(mainHBox);
//## The OK button
- mainCancelButton = add_button(Gtk::Stock::STOP, GTK_RESPONSE_CANCEL);
- if (mainCancelButton)
- {
- tips.set_tip((*mainCancelButton), _("Abort a trace in progress"));
- mainCancelButton->set_sensitive(false);
- }
- mainOkButton = add_button(Gtk::Stock::OK, GTK_RESPONSE_OK);
+ mainCancelButton = addResponseButton(Gtk::Stock::STOP, GTK_RESPONSE_CANCEL);
+ if (mainCancelButton) {
+ tips.set_tip((*mainCancelButton), _("Abort a trace in progress"));
+ mainCancelButton->set_sensitive(false);
+ }
+ mainOkButton = addResponseButton(Gtk::Stock::OK, GTK_RESPONSE_OK);
tips.set_tip((*mainOkButton), _("Execute the trace"));
show_all_children();
//## Connect the signal
- signal_response().connect(
- sigc::mem_fun(*this, &TraceDialogImpl::responseCallback) );
+ signalResponse().connect(
+ sigc::mem_fun(*this, &TraceDialogImpl::responseCallback));
}
/**
* Factory method. Use this to create a new TraceDialog
*/
-TraceDialog *TraceDialog::create(Behavior::BehaviorFactory behavior_factory)
+TraceDialog &TraceDialog::getInstance()
{
- TraceDialog *dialog = new TraceDialogImpl(behavior_factory);
- return dialog;
+ TraceDialog *dialog = new TraceDialogImpl();
+ return *dialog;
}
index 0e352ce10be751a51f136af3c53265c3cf2fb537..0933aee3be52d5ebc15b095800e33844579a15d6 100644 (file)
#include "verbs.h"
-#include "dialog.h"
+#include "ui/widget/panel.h"
namespace Inkscape {
namespace UI {
/**
* A dialog that displays log messages
*/
-class TraceDialog : public Dialog
+class TraceDialog : public UI::Widget::Panel
{
public:
-
/**
* Constructor
*/
- TraceDialog(Behavior::BehaviorFactory behavior_factory) :
- Dialog (behavior_factory, "dialogs.trace", SP_VERB_SELECTION_TRACE)
- {}
+ TraceDialog() :
+ UI::Widget::Panel("", "dialogs.trace", SP_VERB_SELECTION_TRACE)
+ {}
/**
* Factory method
*/
- static TraceDialog *create(Behavior::BehaviorFactory behavior_factory);
+ static TraceDialog &getInstance();
/**
* Destructor
index 3110289d2c82dd396ff1bfe7f21983c1cd321f2b..9e6cd7f50f3dae59ceedf0cfa4569f95b89d6a1b 100644 (file)
#endif
#include <gtkmm/stock.h>
+#include <gtkmm/dialog.h>
#include "document.h"
#include "desktop-handles.h"
* we use the ScalarUnit class for this.
*
*/
-Transformation::Transformation(Behavior::BehaviorFactory behavior_factory)
- : Dialog (behavior_factory, "dialogs.transformation", SP_VERB_DIALOG_TRANSFORM),
+Transformation::Transformation()
+ : UI::Widget::Panel ("", "dialogs.transformation", SP_VERB_DIALOG_TRANSFORM),
_page_move (4, 2),
_page_scale (4, 2),
_page_rotate (4, 2),
_check_replace_matrix (_("Edit c_urrent matrix"), _("Edit the current transform= matrix; otherwise, post-multiply transform= by this matrix"))
{
- // Top level vbox
- Gtk::VBox *vbox = get_vbox();
- vbox->set_spacing(0);
+ Gtk::Box *contents = _getContents();
+
+ contents->set_spacing(0);
// Notebook for individual transformations
- vbox->pack_start(_notebook, true, true);
+ contents->pack_start(_notebook, true, true);
_notebook.append_page(_page_move, _("_Move"), true);
layoutPageMove();
_notebook.signal_switch_page().connect(sigc::mem_fun(*this, &Transformation::onSwitchPage));
// Apply separately
- vbox->pack_start(_check_apply_separately, true, true);
+ contents->pack_start(_check_apply_separately, true, true);
_check_apply_separately.set_active(prefs_get_int_attribute_limited ("dialogs.transformation", "applyseparately", 0, 0, 1));
_check_apply_separately.signal_toggled().connect(sigc::mem_fun(*this, &Transformation::onApplySeparatelyToggled));
updateSelection(PAGE_MOVE, _getSelection());
- resetButton = add_button(Gtk::Stock::CLEAR, 0);
+ resetButton = addResponseButton(Gtk::Stock::CLEAR, 0);
if (resetButton) {
- tooltips.set_tip((*resetButton), _("Reset the values on the current tab to defaults"));
+ _tooltips.set_tip((*resetButton), _("Reset the values on the current tab to defaults"));
resetButton->set_sensitive(true);
resetButton->signal_clicked().connect(sigc::mem_fun(*this, &Transformation::onClear));
}
- applyButton = add_button(Gtk::Stock::APPLY, Gtk::RESPONSE_APPLY);
+ applyButton = addResponseButton(Gtk::Stock::APPLY, Gtk::RESPONSE_APPLY);
if (applyButton) {
- tooltips.set_tip((*applyButton), _("Apply transformation to selection"));
+ _tooltips.set_tip((*applyButton), _("Apply transformation to selection"));
applyButton->set_sensitive(false);
- set_default (*applyButton); // activable by Enter in spinbuttons
}
// Connect to the global selection changed & modified signals
}
-
/*########################################################################
# U T I L I T Y
########################################################################*/
}
}
- set_response_sensitive(Gtk::RESPONSE_APPLY,
- selection && !selection->isEmpty());
+ setResponseSensitive(Gtk::RESPONSE_APPLY,
+ selection && !selection->isEmpty());
}
void
}
//Let's play with never turning this off
- //set_response_sensitive(Gtk::RESPONSE_APPLY, false);
+ //setResponseSensitive(Gtk::RESPONSE_APPLY, false);
}
void
void
Transformation::onMoveValueChanged()
{
- set_response_sensitive(Gtk::RESPONSE_APPLY, true);
+ setResponseSensitive(Gtk::RESPONSE_APPLY, true);
}
void
}
}
- set_response_sensitive(Gtk::RESPONSE_APPLY, true);
+ setResponseSensitive(Gtk::RESPONSE_APPLY, true);
}
void
return;
}
- set_response_sensitive(Gtk::RESPONSE_APPLY, true);
+ setResponseSensitive(Gtk::RESPONSE_APPLY, true);
if (_check_scale_proportional.get_active()) {
if (!_units_scale.isAbsolute()) { // percentage, just copy over
return;
}
- set_response_sensitive(Gtk::RESPONSE_APPLY, true);
+ setResponseSensitive(Gtk::RESPONSE_APPLY, true);
if (_check_scale_proportional.get_active()) {
if (!_units_scale.isAbsolute()) { // percentage, just copy over
void
Transformation::onRotateValueChanged()
{
- set_response_sensitive(Gtk::RESPONSE_APPLY, true);
+ setResponseSensitive(Gtk::RESPONSE_APPLY, true);
}
void
Transformation::onSkewValueChanged()
{
- set_response_sensitive(Gtk::RESPONSE_APPLY, true);
+ setResponseSensitive(Gtk::RESPONSE_APPLY, true);
}
void
// a, b, c, d, e ,f);
*/
- set_response_sensitive(Gtk::RESPONSE_APPLY, true);
+ setResponseSensitive(Gtk::RESPONSE_APPLY, true);
}
void
index 361b30a04c088cb8e71b37c46e371e41a81fa35a..e64353f5a1e6bde0e5fb904b8177703a7dbef503 100644 (file)
-#include "dialog.h"
+#include "ui/widget/panel.h"
#include "application/application.h"
#include "ui/widget/notebook-page.h"
#include "ui/widget/scalar-unit.h"
-class Transformation : public Dialog
+class Transformation : public UI::Widget::Panel
{
public:
/**
* Create a new transform
*/
- Transformation(Behavior::BehaviorFactory behavior_factory);
+ Transformation();
/**
* Cleanup
*/
virtual ~Transformation();
-
/**
* Factory method. Create an instance of this class/interface
*/
- static Transformation *create(Behavior::BehaviorFactory behavior_factory)
- { return new Transformation(behavior_factory); }
+ static Transformation &getInstance()
+ { return *new Transformation(); }
/**
index 344c446e09991908b4bf4fa3ee885e7e3041df1f..b808e57dee7076d7bcdba25d20f26b418eafef88 100644 (file)
static void on_activate_desktop(Inkscape::Application*, SPDesktop* desktop, void*);
static void on_deactivate_desktop(Inkscape::Application*, SPDesktop* desktop, void*);
-UndoHistory*
-UndoHistory::create(Behavior::BehaviorFactory behavior_factory)
+UndoHistory& UndoHistory::getInstance()
{
- if (_instance) return _instance;
- _instance = new UndoHistory(behavior_factory);
- return _instance;
+ if (!_instance)
+ _instance = new UndoHistory();
+
+ return *_instance;
}
void
_callback_connections[EventLog::CALLB_SELECTION_CHANGE].block(false);
}
-UndoHistory::UndoHistory(Behavior::BehaviorFactory behavior_factory)
- : Dialog (behavior_factory, "dialogs.undo-history", SP_VERB_DIALOG_UNDO_HISTORY),
+UndoHistory::UndoHistory()
+ : UI::Widget::Panel ("", "dialogs.undo-history", SP_VERB_DIALOG_UNDO_HISTORY),
_desktop (SP_ACTIVE_DESKTOP),
_document (SP_ACTIVE_DOCUMENT),
_event_log (_desktop ? _desktop->event_log : NULL),
_columns (_event_log ? &_event_log->getColumns() : NULL),
_event_list_selection (_event_list_view.get_selection())
{
- if( !_document || !_event_log || !_columns ) return;
+ if ( !_document || !_event_log || !_columns ) return;
set_size_request(300, 200);
- get_vbox()->pack_start(_scrolled_window);
+ _getContents()->pack_start(_scrolled_window);
_scrolled_window.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
_event_list_store = _event_log->getEventListStore();
index 7d7426675e436ad44dda4acad8ddc4decd0b76f9..e883ec49c546b3150496d50cbd08b19d4b3ded91 100644 (file)
* Undo History dialog
*
* \brief A dialog for presenting an event log of commited, undone and redone events. Allows the
- * user to undo and redo multiple events in a more convinient way than repateaded ctrl-z,
+ * user to undo and redo multiple events in a more convenient way than repateaded ctrl-z,
* ctrl-shift-z.
*
*
#include <sstream>
#include "desktop.h"
-#include "dialog.h"
#include "event-log.h"
+#include "ui/widget/panel.h"
#include "widgets/icon.h"
namespace Inkscape {
*
*/
-class UndoHistory : public Dialog {
+class UndoHistory : public Widget::Panel {
public:
virtual ~UndoHistory();
- static UndoHistory *create(Behavior::BehaviorFactory behavior_factory);
+ static UndoHistory &getInstance();
void setDesktop(SPDesktop* desktop);
sigc::connection _document_replaced_connection;
void _onCollapseEvent(const Gtk::TreeModel::iterator &iter, const Gtk::TreeModel::Path &path);
private:
- UndoHistory(Behavior::BehaviorFactory behavior_factory);
+ UndoHistory();
// no default constructor, noncopyable, nonassignable
UndoHistory(UndoHistory const &d);
index 53f3b4c2cc76cb12ce3e39fd0d15f13ba0c4d01b..7411bc7dced5e0c4f0eeaa680124a1830578b31b 100644 (file)
namespace UI {
namespace Dialog {
-XmlEditor::XmlEditor(Behavior::BehaviorFactory behavior_factory)
- : Dialog (behavior_factory, "dialogs.xml", SP_VERB_DIALOG_XML_EDITOR)
+XmlEditor::XmlEditor()
+ : UI::Widget::Panel("", "dialogs.xml", SP_VERB_DIALOG_XML_EDITOR)
{
// TODO: Insert widgets
index 65f25423f54de6ade15352b164601bc77b07d710..89df6fbc190ae912bf6f0c2866e17c03d7af8ba7 100644 (file)
#ifndef INKSCAPE_DIALOG_XML_EDITOR_H
#define INKSCAPE_DIALOG_XML_EDITOR_H
-#include "dialog.h"
+#include "ui/widget/panel.h"
#include <glibmm/i18n.h>
namespace UI {
namespace Dialog {
-class XmlEditor : public Dialog {
+class XmlEditor : public UI::Widget::Panel {
public:
- XmlEditor(Behavior::BehaviorFactory behavior_factory);
+ XmlEditor();
virtual ~XmlEditor();
- static XmlEditor *create(Behavior::BehaviorFactory behavior_factory)
- { return new XmlEditor(behavior_factory); }
+ static XmlEditor &getInstance() { return *new XmlEditor(); }
protected:
index f3fba93bffe925fb1113522e7786f7fd6f99e354..6390eca504ebb2cf020a72a9c40e6b3f11993c37 100644 (file)
_window (NULL),
_dock_item_action_area (NULL)
{
- /* Add a "signal_response" signal to the GdlDockItem, make sure it is
- * only done once for the class.
- */
- static guint response_signal = 0;
-
- if (response_signal == 0) {
- response_signal = g_signal_new ("signal_response",
- GDL_TYPE_DOCK_ITEM,
- G_SIGNAL_RUN_FIRST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
- }
-
GdlDockItemBehavior gdl_dock_behavior =
(prefs_get_int_attribute_limited ("options.dock", "cancenterdock", 1, 0, 1) == 0 ?
return (Placement)placement;
}
-
-void
-DockItem::addButton(Gtk::Button* button, int /*response_id*/)
-{
- // Create a button box for the response buttons if it's the first button to be added
- if (!_dock_item_action_area) {
- _dock_item_action_area = new Gtk::HButtonBox(Gtk::BUTTONBOX_END, 6);
- _dock_item_box.pack_end(*_dock_item_action_area, Gtk::PACK_SHRINK, 0);
- _dock_item_action_area->set_border_width(6);
- }
-
- _dock_item_action_area->pack_start(*button);
-}
-
void
DockItem::hide()
{
&_signal_delete_event_proxy);
}
-Glib::SignalProxy1<void, int>
-DockItem::signal_response()
-{
- return Glib::SignalProxy1<void, int>(Glib::wrap(GTK_WIDGET(_gdl_dock_item)),
- &_signal_response_proxy);
-}
-
Glib::SignalProxy0<void>
DockItem::signal_drag_begin()
{
};
-const Glib::SignalProxyInfo
-DockItem::_signal_response_proxy =
-{
- "signal_response",
- (GCallback) &_signal_response_callback,
- (GCallback) &_signal_response_callback
-};
-
const Glib::SignalProxyInfo
DockItem::_signal_drag_begin_proxy =
{
@@ -530,22 +486,6 @@ DockItem::_signal_delete_event_callback(GtkWidget *self, GdkEventAny *event, voi
return RType();
}
-void
-DockItem::_signal_response_callback(GtkWidget *self, gint response_id, void *data)
-{
- using namespace Gtk;
- typedef sigc::slot<void, int> SlotType;
-
- if (Glib::ObjectBase::_get_current_wrapper((GObject *) self)) {
- try {
- if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
- (*static_cast<SlotType *>(slot))(response_id);
- } catch(...) {
- Glib::exception_handlers_invoke();
- }
- }
-}
-
void
DockItem::_signal_drag_end_callback(GtkWidget *self, gboolean cancelled, void *data)
{
index af2f3ac7022b21e4e73b5af5c47eb0c22735d4c5..c0f52a77a6735337904a5d1e6cea289eba900e62 100644 (file)
Gtk::Window *getWindow(); //< gives the parent window, if the dock item has one (i.e. it's floating)
- void addButton(Gtk::Button *button, int response_id);
-
void hide();
void show();
void show_all();
Glib::SignalProxy0<void> signal_show();
Glib::SignalProxy0<void> signal_hide();
Glib::SignalProxy1<bool, GdkEventAny *> signal_delete_event();
- Glib::SignalProxy1<void, int> signal_response();
Glib::SignalProxy0<void> signal_drag_begin();
Glib::SignalProxy1<void, bool> signal_drag_end();
Glib::SignalProxy0<void> signal_realize();
void _onHide();
void _onHideWindow();
void _onShow();
- void _onResponse(int response_id);
void _onDragBegin();
void _onDragEnd(bool cancelled);
void _onRealize();
static const Glib::SignalProxyInfo _signal_show_proxy;
static const Glib::SignalProxyInfo _signal_hide_proxy;
static const Glib::SignalProxyInfo _signal_delete_event_proxy;
- static const Glib::SignalProxyInfo _signal_response_proxy;
+
static const Glib::SignalProxyInfo _signal_drag_begin_proxy;
static const Glib::SignalProxyInfo _signal_drag_end_proxy;
static const Glib::SignalProxyInfo _signal_realize_proxy;
static gboolean _signal_delete_event_callback(GtkWidget *self, GdkEventAny *event, void *data);
static void _signal_drag_end_callback(GtkWidget* self, gboolean p0, void* data);
- /** In order to emulate a signal_response signal like the one for Gtk::Dialog we inject a new
- * signal into GdlDockItem. This signal will be emitted when a button in the dock item added
- * through the addButton(..., response_id) method, is clicked.
- */
- static void _signal_response_callback(GtkWidget* self, gint p0, void* data);
-
sigc::signal<void, State, State> _signal_state_changed;
DockItem();
index 8be563828dadf6a84db35f15d5471ba947f7507f..1e868191d80eee02bf7070acb842048adcb45280 100644 (file)
--- a/src/ui/widget/panel.cpp
+++ b/src/ui/widget/panel.cpp
#include <glibmm/i18n.h>
+#include <gtkmm/dialog.h> // for Gtk::RESPONSE_*
+#include <gtkmm/stock.h>
+
#include "panel.h"
-#include "../../icon-size.h"
-#include "../../prefs-utils.h"
+#include "icon-size.h"
+#include "prefs-utils.h"
+#include "desktop-handles.h"
+#include "inkscape.h"
namespace Inkscape {
namespace UI {
/**
* Construct a Panel
- *
- * \param label Label.
*/
-Panel::Panel() :
- _prefs_path(NULL),
- _menuDesired(false),
- _tempArrow( Gtk::ARROW_LEFT, Gtk::SHADOW_ETCHED_OUT ),
- menu(0),
- _fillable(0)
-{
- init();
-}
-
-Panel::Panel( Glib::ustring const &label, gchar const* prefs_path, bool menuDesired ) :
+Panel::Panel(Glib::ustring const &label, gchar const *prefs_path,
+ int verb_num, Glib::ustring const &apply_label,
+ bool menu_desired) :
_prefs_path(prefs_path),
- _menuDesired(menuDesired),
- label(label),
- _tempArrow( Gtk::ARROW_LEFT, Gtk::SHADOW_ETCHED_OUT ),
- menu(0),
+ _menu_desired(menu_desired),
+ _label(label),
+ _apply_label(apply_label),
+ _verb_num(verb_num),
+ _temp_arrow(Gtk::ARROW_LEFT, Gtk::SHADOW_ETCHED_OUT),
+ _menu(0),
+ _action_area(0),
_fillable(0)
{
- init();
+ _init();
}
Panel::~Panel()
{
- delete menu;
+ delete _menu;
}
void Panel::_popper(GdkEventButton* event)
{
if ( (event->type == GDK_BUTTON_PRESS) && (event->button == 3 || event->button == 1) ) {
- if (menu) {
- menu->popup( event->button, event->time );
+ if (_menu) {
+ _menu->popup(event->button, event->time);
}
}
}
-void Panel::init()
+void Panel::_init()
{
Glib::ustring tmp("<");
_anchor = Gtk::ANCHOR_CENTER;
- tabTitle.set_label(this->label);
guint panel_size = 0;
if (_prefs_path) {
panel_wrap = prefs_get_int_attribute_limited( _prefs_path, "panel_wrap", 0, 0, 1 );
}
- menu = new Gtk::Menu();
+ _menu = new Gtk::Menu();
{
const char *things[] = {
N_("tiny"),
N_("huge")
};
Gtk::RadioMenuItem::Group groupOne;
- for ( unsigned int i = 0; i < G_N_ELEMENTS(things); i++ ) {
+ for (unsigned int i = 0; i < G_N_ELEMENTS(things); i++) {
Glib::ustring foo(gettext(things[i]));
Gtk::RadioMenuItem* single = manage(new Gtk::RadioMenuItem(groupOne, foo));
- menu->append(*single);
- if ( i == panel_size ) {
+ _menu->append(*single);
+ if (i == panel_size) {
single->set_active(true);
}
- single->signal_activate().connect( sigc::bind<int, int>( sigc::mem_fun(*this, &Panel::bounceCall), PANEL_SETTING_SIZE, i) );
+ single->signal_activate().connect(sigc::bind<int, int>(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_SIZE, i));
}
}
- menu->append( *manage(new Gtk::SeparatorMenuItem()) );
+ _menu->append(*manage(new Gtk::SeparatorMenuItem()));
Gtk::RadioMenuItem::Group group;
- Glib::ustring oneLab(_("List"));
- Glib::ustring twoLab(_("Grid"));
- Gtk::RadioMenuItem *one = manage(new Gtk::RadioMenuItem(group, oneLab));
- Gtk::RadioMenuItem *two = manage(new Gtk::RadioMenuItem(group, twoLab));
+ Glib::ustring one_label(_("List"));
+ Glib::ustring two_label(_("Grid"));
+ Gtk::RadioMenuItem *one = manage(new Gtk::RadioMenuItem(group, one_label));
+ Gtk::RadioMenuItem *two = manage(new Gtk::RadioMenuItem(group, two_label));
if (panel_mode == 0) {
one->set_active(true);
two->set_active(true);
}
- menu->append( *one );
- nonHorizontal.push_back( one );
- menu->append( *two );
- nonHorizontal.push_back( two );
- Gtk::MenuItem* sep = manage( new Gtk::SeparatorMenuItem());
- menu->append( *sep );
- nonHorizontal.push_back( sep );
- one->signal_activate().connect( sigc::bind<int, int>( sigc::mem_fun(*this, &Panel::bounceCall), PANEL_SETTING_MODE, 0) );
- two->signal_activate().connect( sigc::bind<int, int>( sigc::mem_fun(*this, &Panel::bounceCall), PANEL_SETTING_MODE, 1) );
+ _menu->append(*one);
+ _non_horizontal.push_back(one);
+ _menu->append(*two);
+ _non_horizontal.push_back(two);
+ Gtk::MenuItem* sep = manage(new Gtk::SeparatorMenuItem());
+ _menu->append(*sep);
+ _non_horizontal.push_back(sep);
+ one->signal_activate().connect(sigc::bind<int, int>(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_MODE, 0));
+ two->signal_activate().connect(sigc::bind<int, int>(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_MODE, 1));
{
- Glib::ustring wrapLab(_("Wrap"));
- Gtk::CheckMenuItem *check = manage(new Gtk::CheckMenuItem(wrapLab));
- check->set_active( panel_wrap );
- menu->append( *check );
- nonVertical.push_back(check);
+ Glib::ustring wrap_label(_("Wrap"));
+ Gtk::CheckMenuItem *check = manage(new Gtk::CheckMenuItem(wrap_label));
+ check->set_active(panel_wrap);
+ _menu->append(*check);
+ _non_vertical.push_back(check);
- check->signal_toggled().connect( sigc::bind<Gtk::CheckMenuItem*>(sigc::mem_fun(*this, &Panel::_wrapToggled), check) );
+ check->signal_toggled().connect(sigc::bind<Gtk::CheckMenuItem*>(sigc::mem_fun(*this, &Panel::_wrapToggled), check));
- sep = manage( new Gtk::SeparatorMenuItem());
- menu->append( *sep );
- nonVertical.push_back( sep );
+ sep = manage(new Gtk::SeparatorMenuItem());
+ _menu->append(*sep);
+ _non_vertical.push_back(sep);
}
- menu->show_all_children();
- for ( std::vector<Gtk::Widget*>::iterator iter = nonVertical.begin(); iter != nonVertical.end(); ++iter ) {
+ _menu->show_all_children();
+ for ( std::vector<Gtk::Widget*>::iterator iter = _non_vertical.begin(); iter != _non_vertical.end(); ++iter ) {
(*iter)->hide();
}
- //closeButton.set_label("X");
+ // _close_button.set_label("X");
- topBar.pack_start(tabTitle);
+ if (!_label.empty()) {
+ _tab_title.set_label(_label);
+ _top_bar.pack_start(_tab_title);
+ }
- //topBar.pack_end(closeButton, false, false);
+ // _top_bar.pack_end(_close_button, false, false);
- if ( _menuDesired ) {
- topBar.pack_end(menuPopper, false, false);
+ if ( _menu_desired ) {
+ _top_bar.pack_end(_menu_popper, false, false);
Gtk::Frame* outliner = manage(new Gtk::Frame());
- outliner->set_shadow_type( Gtk::SHADOW_ETCHED_IN );
- outliner->add( _tempArrow );
- menuPopper.add( *outliner );
- menuPopper.signal_button_press_event().connect_notify( sigc::mem_fun(*this, &Panel::_popper) );
+ outliner->set_shadow_type(Gtk::SHADOW_ETCHED_IN);
+ outliner->add(_temp_arrow);
+ _menu_popper.add(*outliner);
+ _menu_popper.signal_button_press_event().connect_notify(sigc::mem_fun(*this, &Panel::_popper));
}
- pack_start( topBar, false, false );
+ pack_start(_top_bar, false, false);
- Gtk::HBox* boxy = manage( new Gtk::HBox() );
+ Gtk::HBox* boxy = manage(new Gtk::HBox());
- boxy->pack_start( contents, true, true );
- boxy->pack_start( rightBar, false, true );
+ boxy->pack_start(_contents, true, true);
+ boxy->pack_start(_right_bar, false, true);
- pack_start( *boxy, true, true );
+ pack_start(*boxy, true, true);
+
+ signalResponse().connect(sigc::mem_fun(*this, &Panel::_handleResponse));
show_all_children();
- bounceCall( PANEL_SETTING_SIZE, panel_size );
- bounceCall( PANEL_SETTING_MODE, panel_mode );
- bounceCall( PANEL_SETTING_WRAP, panel_wrap );
+ _bounceCall(PANEL_SETTING_SIZE, panel_size);
+ _bounceCall(PANEL_SETTING_MODE, panel_mode);
+ _bounceCall(PANEL_SETTING_WRAP, panel_wrap);
}
void Panel::setLabel(Glib::ustring const &label)
{
- this->label = label;
- tabTitle.set_label(this->label);
+ if (_label.empty() && !label.empty())
+ _top_bar.pack_start(_tab_title);
+ else if (!_label.empty() && label.empty())
+ _top_bar.remove(_tab_title);
+
+ _label = label;
+ _tab_title.set_label(_label);
}
-void Panel::setOrientation( Gtk::AnchorType how )
+void Panel::setOrientation(Gtk::AnchorType how)
{
- if ( _anchor != how )
- {
+ if (_anchor != how) {
_anchor = how;
- switch ( _anchor )
- {
+ switch (_anchor) {
case Gtk::ANCHOR_NORTH:
case Gtk::ANCHOR_SOUTH:
{
- if ( _menuDesired ) {
- menuPopper.reference();
- topBar.remove(menuPopper);
- rightBar.pack_start(menuPopper, false, false);
- menuPopper.unreference();
+ if (_menu_desired) {
+ _menu_popper.reference();
+ _top_bar.remove(_menu_popper);
+ _right_bar.pack_start(_menu_popper, false, false);
+ _menu_popper.unreference();
- for ( std::vector<Gtk::Widget*>::iterator iter = nonHorizontal.begin(); iter != nonHorizontal.end(); ++iter ) {
+ for (std::vector<Gtk::Widget*>::iterator iter = _non_horizontal.begin(); iter != _non_horizontal.end(); ++iter) {
(*iter)->hide();
}
- for ( std::vector<Gtk::Widget*>::iterator iter = nonVertical.begin(); iter != nonVertical.end(); ++iter ) {
+ for (std::vector<Gtk::Widget*>::iterator iter = _non_vertical.begin(); iter != _non_vertical.end(); ++iter) {
(*iter)->show();
}
}
// Ensure we are not in "list" mode
- bounceCall( PANEL_SETTING_MODE, 1 );
- topBar.remove(tabTitle);
+ _bounceCall(PANEL_SETTING_MODE, 1);
+ if (!_label.empty())
+ _top_bar.remove(_tab_title);
}
break;
default:
{
- if ( _menuDesired ) {
- for ( std::vector<Gtk::Widget*>::iterator iter = nonHorizontal.begin(); iter != nonHorizontal.end(); ++iter ) {
+ if ( _menu_desired ) {
+ for (std::vector<Gtk::Widget*>::iterator iter = _non_horizontal.begin(); iter != _non_horizontal.end(); ++iter) {
(*iter)->show();
}
- for ( std::vector<Gtk::Widget*>::iterator iter = nonVertical.begin(); iter != nonVertical.end(); ++iter ) {
+ for (std::vector<Gtk::Widget*>::iterator iter = _non_vertical.begin(); iter != _non_vertical.end(); ++iter) {
(*iter)->hide();
}
}
}
}
-void Panel::_regItem( Gtk::MenuItem* item, int group, int id )
+void Panel::present()
{
- menu->append( *item );
- item->signal_activate().connect( sigc::bind<int, int>( sigc::mem_fun(*this, &Panel::bounceCall), group + PANEL_SETTING_NEXTFREE, id) );
- item->show();
+ _signal_present.emit();
}
+
void Panel::restorePanelPrefs()
{
guint panel_size = 0;
if (_prefs_path) {
- panel_size = prefs_get_int_attribute_limited (_prefs_path, "panel_size", 1, 0, 10);
+ panel_size = prefs_get_int_attribute_limited(_prefs_path, "panel_size", 1, 0, 10);
}
guint panel_mode = 0;
if (_prefs_path) {
- panel_mode = prefs_get_int_attribute_limited (_prefs_path, "panel_mode", 1, 0, 10);
+ panel_mode = prefs_get_int_attribute_limited(_prefs_path, "panel_mode", 1, 0, 10);
}
guint panel_wrap = 0;
if (_prefs_path) {
- panel_wrap = prefs_get_int_attribute_limited( _prefs_path, "panel_wrap", 0, 0, 1 );
+ panel_wrap = prefs_get_int_attribute_limited(_prefs_path, "panel_wrap", 0, 0, 1 );
}
- bounceCall( PANEL_SETTING_SIZE, panel_size );
- bounceCall( PANEL_SETTING_MODE, panel_mode );
- bounceCall( PANEL_SETTING_WRAP, panel_wrap );
+ _bounceCall(PANEL_SETTING_SIZE, panel_size);
+ _bounceCall(PANEL_SETTING_MODE, panel_mode);
+ _bounceCall(PANEL_SETTING_WRAP, panel_wrap);
+}
+
+sigc::signal<void, int> &
+Panel::signalResponse()
+{
+ return _signal_response;
+}
+
+sigc::signal<void> &
+Panel::signalPresent()
+{
+ return _signal_present;
}
-void Panel::bounceCall(int i, int j)
+void Panel::_bounceCall(int i, int j)
{
- menu->set_active(0);
- switch ( i ) {
+ _menu->set_active(0);
+ switch (i) {
case PANEL_SETTING_SIZE:
if (_prefs_path) {
- prefs_set_int_attribute( _prefs_path, "panel_size", j );
+ prefs_set_int_attribute(_prefs_path, "panel_size", j);
}
- if ( _fillable ) {
- ViewType currType = _fillable->getPreviewType();
- switch ( j ) {
+ if (_fillable) {
+ ViewType curr_type = _fillable->getPreviewType();
+ switch (j) {
case 0:
{
- _fillable->setStyle(Inkscape::ICON_SIZE_DECORATION, currType);
+ _fillable->setStyle(Inkscape::ICON_SIZE_DECORATION, curr_type);
}
break;
case 1:
{
- _fillable->setStyle(Inkscape::ICON_SIZE_MENU, currType);
+ _fillable->setStyle(Inkscape::ICON_SIZE_MENU, curr_type);
}
break;
case 2:
{
- _fillable->setStyle(Inkscape::ICON_SIZE_SMALL_TOOLBAR, currType);
+ _fillable->setStyle(Inkscape::ICON_SIZE_SMALL_TOOLBAR, curr_type);
}
break;
case 3:
{
- _fillable->setStyle(Inkscape::ICON_SIZE_BUTTON, currType);
+ _fillable->setStyle(Inkscape::ICON_SIZE_BUTTON, curr_type);
}
break;
case 4:
{
- _fillable->setStyle(Inkscape::ICON_SIZE_DIALOG, currType);
+ _fillable->setStyle(Inkscape::ICON_SIZE_DIALOG, curr_type);
}
break;
default:
if (_prefs_path) {
prefs_set_int_attribute (_prefs_path, "panel_mode", j);
}
- if ( _fillable ) {
- Inkscape::IconSize currSize = _fillable->getPreviewSize();
- switch ( j ) {
+ if (_fillable) {
+ Inkscape::IconSize curr_size = _fillable->getPreviewSize();
+ switch (j) {
case 0:
{
- _fillable->setStyle(currSize, VIEW_TYPE_LIST);
+ _fillable->setStyle(curr_size, VIEW_TYPE_LIST);
}
break;
case 1:
{
- _fillable->setStyle(currSize, VIEW_TYPE_GRID);
+ _fillable->setStyle(curr_size, VIEW_TYPE_GRID);
}
break;
default:
prefs_set_int_attribute (_prefs_path, "panel_wrap", j ? 1 : 0);
}
if ( _fillable ) {
- _fillable->setWrap( j );
+ _fillable->setWrap(j);
}
break;
default:
- _handleAction( i - PANEL_SETTING_NEXTFREE, j );
+ _handleAction(i - PANEL_SETTING_NEXTFREE, j);
}
}
void Panel::_wrapToggled(Gtk::CheckMenuItem* toggler)
{
- if ( toggler ) {
- bounceCall( PANEL_SETTING_WRAP, toggler->get_active() ? 1 : 0 );
+ if (toggler) {
+ _bounceCall(PANEL_SETTING_WRAP, toggler->get_active() ? 1 : 0);
}
}
+gchar const *Panel::getPrefsPath() const
+{
+ return _prefs_path;
+}
+Glib::ustring const &Panel::getLabel() const
+{
+ return _label;
+}
+int const &Panel::getVerb() const
+{
+ return _verb_num;
+}
-
-Glib::ustring const &Panel::getLabel() const
+Glib::ustring const &Panel::getApplyLabel() const
{
- return label;
+ return _apply_label;
}
-void Panel::_setTargetFillable( PreviewFillable *target )
+void Panel::_setTargetFillable(PreviewFillable *target)
{
_fillable = target;
}
-void Panel::_handleAction( int setId, int itemId )
+void Panel::_regItem(Gtk::MenuItem* item, int group, int id)
+{
+ _menu->append(*item);
+ item->signal_activate().connect(sigc::bind<int, int>(sigc::mem_fun(*this, &Panel::_bounceCall), group + PANEL_SETTING_NEXTFREE, id));
+ item->show();
+}
+
+void Panel::_handleAction(int set_id, int item_id)
{
// for subclasses to override
}
+void
+Panel::_apply()
+{
+ g_warning("Apply button clicked for panel [Panel::_apply()]");
+}
+
+Gtk::Button *
+Panel::addResponseButton(const Glib::ustring &button_text, int response_id)
+{
+ Gtk::Button *button = new Gtk::Button(button_text);
+ _addResponseButton(button, response_id);
+ return button;
+}
+
+Gtk::Button *
+Panel::addResponseButton(const Gtk::StockID &stock_id, int response_id)
+{
+ Gtk::Button *button = new Gtk::Button(stock_id);
+ _addResponseButton(button, response_id);
+ return button;
+}
+
+void
+Panel::_addResponseButton(Gtk::Button *button, int response_id)
+{
+ // Create a button box for the response buttons if it's the first button to be added
+ if (!_action_area) {
+ _action_area = new Gtk::HButtonBox(Gtk::BUTTONBOX_END, 6);
+ _action_area->set_border_width(4);
+ pack_end(*_action_area, Gtk::PACK_SHRINK, 0);
+ }
+
+ _action_area->pack_end(*button);
+
+ if (response_id != 0) {
+ // Re-emit clicked signals as response signals
+ button->signal_clicked().connect(sigc::bind(_signal_response.make_slot(), response_id));
+ _response_map[response_id] = button;
+ }
+}
+
+void
+Panel::setDefaultResponse(int response_id)
+{
+ ResponseMap::iterator widget_found;
+ widget_found = _response_map.find(response_id);
+
+ if (widget_found != _response_map.end()) {
+ widget_found->second->activate();
+ widget_found->second->property_can_default() = true;
+ widget_found->second->grab_default();
+ }
+}
+
+void
+Panel::setResponseSensitive(int response_id, bool setting)
+{
+ if (_response_map[response_id])
+ _response_map[response_id]->set_sensitive(setting);
+}
+
+void
+Panel::_handleResponse(int response_id)
+{
+ switch (response_id) {
+ case Gtk::RESPONSE_APPLY: {
+ _apply();
+ break;
+ }
+ }
+}
+
+Inkscape::Selection *Panel::_getSelection()
+{
+ return sp_desktop_selection(SP_ACTIVE_DESKTOP);
+}
+
} // namespace Widget
} // namespace UI
} // namespace Inkscape
diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h
index e091c82a12b65c87560207381aba6cc8127bc3ce..10f74cf2b3f571eed61c3db0916faf93740bbce5 100644 (file)
--- a/src/ui/widget/panel.h
+++ b/src/ui/widget/panel.h
#include <vector>
#include <gtkmm/arrow.h>
#include <gtkmm/box.h>
+#include <gtkmm/button.h>
+#include <gtkmm/buttonbox.h>
#include <gtkmm/eventbox.h>
#include <gtkmm/frame.h>
-#include <gtkmm/table.h>
-#include <gtkmm/button.h>
#include <gtkmm/label.h>
#include <gtkmm/menu.h>
#include <gtkmm/optionmenu.h>
-#include "../previewfillable.h"
+#include <gtkmm/table.h>
+#include <gtkmm/tooltips.h>
+
+#include "ui/previewfillable.h"
+#include "selection.h"
namespace Inkscape {
namespace UI {
namespace Widget {
-class Panel : public Gtk::VBox
-{
+class Panel : public Gtk::VBox {
+
public:
- Panel();
virtual ~Panel();
- Panel(Glib::ustring const &label, gchar const *prefs_path = 0, bool menuDesired = false );
+ Panel(Glib::ustring const &label = "", gchar const *prefs_path = 0,
+ int verb_num = 0, Glib::ustring const &apply_label = "",
+ bool menu_desired = false);
+ gchar const *getPrefsPath() const;
void setLabel(Glib::ustring const &label);
Glib::ustring const &getLabel() const;
+ int const &getVerb() const;
+ Glib::ustring const &getApplyLabel() const;
- virtual void setOrientation( Gtk::AnchorType how );
+ virtual void setOrientation(Gtk::AnchorType how);
+
+ virtual void present(); //< request to be present
- const gchar *_prefs_path;
void restorePanelPrefs();
+ /** Signal accessors */
+ virtual sigc::signal<void, int> &signalResponse();
+ virtual sigc::signal<void> &signalPresent();
+
+ /** Methods providing a Gtk::Dialog like interface for adding buttons that emit Gtk::RESPONSE
+ * signals on click. */
+ Gtk::Button* addResponseButton (const Glib::ustring &button_text, int response_id);
+ Gtk::Button* addResponseButton (const Gtk::StockID &stock_id, int response_id);
+ void setDefaultResponse(int response_id);
+ void setResponseSensitive(int response_id, bool setting);
+
protected:
- Gtk::Box* _getContents() { return &contents; }
- void _setTargetFillable( PreviewFillable *target );
- void _regItem( Gtk::MenuItem* item, int group, int id );
+ Gtk::Box *_getContents() { return &_contents; }
+ void _setTargetFillable(PreviewFillable *target);
+ void _regItem(Gtk::MenuItem* item, int group, int id);
+
+ virtual void _handleAction(int set_id, int item_id);
+ virtual void _apply();
+
+ virtual void _handleResponse(int response_id);
+
+ /** Helper methods */
+ void _addResponseButton(Gtk::Button *button, int response_id);
+ Inkscape::Selection *_getSelection();
- virtual void _handleAction( int setId, int itemId );
- bool _menuDesired;
+ /** Tooltips object for all descendants to use */
+ Gtk::Tooltips _tooltips;
+ const gchar *_prefs_path;
+
+ bool _menu_desired;
Gtk::AnchorType _anchor;
+ /** Signals */
+ sigc::signal<void, int> _signal_response;
+ sigc::signal<void> _signal_present;
+
private:
- void init();
- void bounceCall(int i, int j);
-
- void _popper(GdkEventButton* btn);
- void _wrapToggled(Gtk::CheckMenuItem* toggler);
-
- Glib::ustring label;
-
- Gtk::HBox topBar;
- Gtk::VBox rightBar;
- Gtk::VBox contents;
- Gtk::Label tabTitle;
- Gtk::Arrow _tempArrow;
- Gtk::EventBox menuPopper;
- Gtk::Button closeButton;
- Gtk::Menu* menu;
- std::vector<Gtk::Widget*> nonHorizontal;
- std::vector<Gtk::Widget*> nonVertical;
+ void _init();
+ void _bounceCall(int i, int j);
+
+ void _popper(GdkEventButton *btn);
+ void _wrapToggled(Gtk::CheckMenuItem *toggler);
+
+ Glib::ustring _label;
+ Glib::ustring _apply_label;
+ int _verb_num;
+
+ Gtk::HBox _top_bar;
+ Gtk::VBox _right_bar;
+ Gtk::VBox _contents;
+ Gtk::Label _tab_title;
+ Gtk::Arrow _temp_arrow;
+ Gtk::EventBox _menu_popper;
+ Gtk::Button _close_button;
+ Gtk::Menu *_menu;
+ Gtk::HButtonBox *_action_area; //< stores response buttons
+ std::vector<Gtk::Widget *> _non_horizontal;
+ std::vector<Gtk::Widget *> _non_vertical;
PreviewFillable *_fillable;
+
+ /** A map to store which widget that emits a certain response signal */
+ typedef std::map<int, Gtk::Widget *> ResponseMap;
+ ResponseMap _response_map;
};
} // namespace Widget
index cbba0b1e8e908b946d770ee354e8876ab0002a7f..20838ee22ba8d0d12d2ba9ece042db14363b35cc 100644 (file)
#include "sp-pattern.h"
#include "ui/dialog/dialog-manager.h"
#include "ui/dialog/fill-and-stroke.h"
+#include "ui/dialog/panel-dialog.h"
#include "xml/repr.h"
#include "document.h"
#include "widgets/widget-sizes.h"
#define ENTRIES_SIZE(n) sizeof(n)/sizeof(n[0])
static guint nui_drop_target_entries = ENTRIES_SIZE(ui_drop_target_entries);
+/* convenience function */
+static Dialog::FillAndStroke *get_fill_and_stroke_panel(SPDesktop *desktop);
SelectedStyle::SelectedStyle(bool /*layout*/)
: _desktop (NULL),
}
void SelectedStyle::on_fill_edit() {
- if (Dialog::FillAndStroke *dialog = dynamic_cast<Dialog::FillAndStroke *>(
- _desktop->_dlg_mgr->getDialog("FillAndStroke")))
- dialog->showPageFill();
+ if (Dialog::FillAndStroke *fs = get_fill_and_stroke_panel(_desktop))
+ fs->showPageFill();
}
void SelectedStyle::on_stroke_edit() {
- if (Dialog::FillAndStroke *dialog = dynamic_cast<Dialog::FillAndStroke *>(
- _desktop->_dlg_mgr->getDialog("FillAndStroke")))
- dialog->showPageStrokePaint();
+ if (Dialog::FillAndStroke *fs = get_fill_and_stroke_panel(_desktop))
+ fs->showPageStrokePaint();
}
bool
{
if (event->button == 1) { // click, open fill&stroke
- if (Dialog::FillAndStroke *dialog = dynamic_cast<Dialog::FillAndStroke *>(
- _desktop->_dlg_mgr->getDialog("FillAndStroke")))
- dialog->showPageFill();
+ if (Dialog::FillAndStroke *fs = get_fill_and_stroke_panel(_desktop))
+ fs->showPageFill();
} else if (event->button == 3) { // right-click, popup menu
_popup[SS_FILL].popup(event->button, event->time);
SelectedStyle::on_stroke_click(GdkEventButton *event)
{
if (event->button == 1) { // click, open fill&stroke
- if (Dialog::FillAndStroke *dialog = dynamic_cast<Dialog::FillAndStroke *>(
- _desktop->_dlg_mgr->getDialog("FillAndStroke")))
- dialog->showPageStrokePaint();
+ if (Dialog::FillAndStroke *fs = get_fill_and_stroke_panel(_desktop))
+ fs->showPageStrokePaint();
} else if (event->button == 3) { // right-click, popup menu
_popup[SS_STROKE].popup(event->button, event->time);
} else if (event->button == 2) { // middle click, toggle none/lastcolor
SelectedStyle::on_sw_click(GdkEventButton *event)
{
if (event->button == 1) { // click, open fill&stroke
- if (Dialog::FillAndStroke *dialog = dynamic_cast<Dialog::FillAndStroke *>(
- _desktop->_dlg_mgr->getDialog("FillAndStroke")))
- dialog->showPageStrokeStyle();
+ if (Dialog::FillAndStroke *fs = get_fill_and_stroke_panel(_desktop))
+ fs->showPageStrokeStyle();
} else if (event->button == 3) { // right-click, popup menu
_popup_sw.popup(event->button, event->time);
} else if (event->button == 2) { // middle click, toggle none/lastwidth?
startcolor_set = false;
}
+Dialog::FillAndStroke *get_fill_and_stroke_panel(SPDesktop *desktop)
+{
+ if (Dialog::PanelDialogBase *panel_dialog =
+ dynamic_cast<Dialog::PanelDialogBase *>(desktop->_dlg_mgr->getDialog("FillAndStroke"))) {
+ try {
+ Dialog::FillAndStroke &fill_and_stroke =
+ dynamic_cast<Dialog::FillAndStroke &>(panel_dialog->getPanel());
+ return &fill_and_stroke;
+ } catch (std::exception e) { }
+ }
+
+ return 0;
+}
} // namespace Widget
} // namespace UI
diff --git a/src/verbs.cpp b/src/verbs.cpp
index b893240efdc36e93f4fd249a25cdba2be655def6..a1947fb97e0a2e4be1afe60fd5781dc00de8f467 100644 (file)
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
namespace Inkscape {
-/// \todo !!!FIXME:: kill this, use DialogManager instead!!!
-
-class PanelDialog : public Inkscape::UI::Dialog::Dialog
-{
-public:
- PanelDialog(char const *prefs_path, int const verb_num) :
- Dialog(
- (prefs_get_int_attribute_limited ("options.dialogtype", "value", UI::Dialog::DOCK, 0, 1) == UI::Dialog::FLOATING ?
- &UI::Dialog::Behavior::FloatingBehavior::create :
- &UI::Dialog::Behavior::DockBehavior::create),
- prefs_path, verb_num) {}
-/*
- virtual Glib::ustring getName() const {return "foo";}
- virtual Glib::ustring getDesc() const {return "bar";}
-*/
-};
-
-/** \brief Utility function to get a panel displayed. */
-static void show_panel( Inkscape::UI::Widget::Panel &panel, char const *prefs_path, int const verb_num )
-{
- Gtk::Container *container = panel.get_toplevel();
- if ( &panel == container ) { // safe check?
- //g_message("Creating new dialog to hold it");
- PanelDialog *dia = new PanelDialog(prefs_path, verb_num);
- Gtk::VBox *mainVBox = dia->get_vbox();
- mainVBox->pack_start(panel);
- dia->show_all_children();
- dia->read_geometry();
- dia->present();
- } else {
- PanelDialog *dia = dynamic_cast<PanelDialog*>(container);
- if ( dia ) {
- //g_message("Found an existing dialog");
- dia->read_geometry();
- dia->present();
- } else {
- g_message("Failed to find an existing dialog");
- }
- }
-}
-
-
/** \brief A class to encompass all of the verbs which deal with
file operations. */
class FileVerb : public Verb {
dt->_dlg_mgr->showDialog("FillAndStroke");
break;
case SP_VERB_DIALOG_SWATCHES:
- show_panel( Inkscape::UI::Dialogs::SwatchesPanel::getInstance(), "dialogs.swatches", SP_VERB_DIALOG_SWATCHES);
- break;
+ dt->_dlg_mgr->showDialog("Swatches");
+ break;
case SP_VERB_DIALOG_TRANSFORM:
dt->_dlg_mgr->showDialog("Transformation");
break;
sp_help_about();
break;
case SP_VERB_HELP_ABOUT_EXTENSIONS: {
- Inkscape::UI::Dialogs::ExtensionsPanel *panel = new Inkscape::UI::Dialogs::ExtensionsPanel();
- panel->set_full(true);
- show_panel( *panel, "dialogs.aboutextensions", SP_VERB_HELP_ABOUT_EXTENSIONS );
+ // Inkscape::UI::Dialogs::ExtensionsPanel *panel = new Inkscape::UI::Dialogs::ExtensionsPanel();
+ // panel->set_full(true);
+ // show_panel( *panel, "dialogs.aboutextensions", SP_VERB_HELP_ABOUT_EXTENSIONS );
break;
}
index 1494d3c2401542a043fadd76921833b30df71b6a..d7b8ac1702390150476d0249a7ef0e009cc54218 100644 (file)
prefs_get_int_attribute_limited ("options.dialogtype", "value", Inkscape::UI::Dialog::FLOATING, 0, 1) ==
Inkscape::UI::Dialog::DOCK;
- if (create_dock)
- {
+ if (create_dock) {
dtw->dock = new Inkscape::UI::Widget::Dock();
Gtk::HPaned *paned = new Gtk::HPaned();