summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefano Facchini <stefano.facchini@gmail.com>2017-10-21 18:44:02 +0000
committerTavmjong Bah <tavmjong@free.fr>2018-01-17 08:37:02 +0000
commitb75e52c16bfaccf56621883ac0a9f27bf99c8661 (patch)
tree4b31e71c4067c664f5ad3e07f3b789b47c7bc085 /src
parentPull a copy of desktop-gtk3 (diff)
downloadinkscape-b75e52c16bfaccf56621883ac0a9f27bf99c8661.tar.gz
inkscape-b75e52c16bfaccf56621883ac0a9f27bf99c8661.zip
Move code related to SwatchesPanel where it belongs
panel.cpp contains a lot of code which is actually used to build the SwatchesPanel. Move it to swatches.cpp. This is mostly just a cut-n-paste, plus some includes cleanup.
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp1
-rw-r--r--src/ui/dialog/glyphs.cpp6
-rw-r--r--src/ui/dialog/glyphs.h2
-rw-r--r--src/ui/dialog/input.cpp1
-rw-r--r--src/ui/dialog/layers.h5
-rw-r--r--src/ui/dialog/swatches.cpp438
-rw-r--r--src/ui/dialog/swatches.h31
-rw-r--r--src/ui/dialog/tags.h3
-rw-r--r--src/ui/dialog/xml-tree.cpp2
-rw-r--r--src/ui/dialog/xml-tree.h1
-rw-r--r--src/ui/widget/panel.cpp454
-rw-r--r--src/ui/widget/panel.h34
12 files changed, 478 insertions, 500 deletions
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index c72216873..41797b1e7 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -66,6 +66,7 @@
#include <gtkmm/colorbutton.h>
#include <gdkmm/general.h>
#include <gtkmm/checkbutton.h>
+#include <gtkmm/eventbox.h>
using namespace Inkscape::Filters;
diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp
index e5d83dacb..c600d8e94 100644
--- a/src/ui/dialog/glyphs.cpp
+++ b/src/ui/dialog/glyphs.cpp
@@ -317,8 +317,8 @@ GlyphColumns *GlyphsPanel::getColumns()
/**
* Constructor
*/
-GlyphsPanel::GlyphsPanel(gchar const *prefsPath) :
- Inkscape::UI::Widget::Panel(prefsPath, SP_VERB_DIALOG_GLYPHS),
+GlyphsPanel::GlyphsPanel() :
+ Inkscape::UI::Widget::Panel("/dialogs/glyphs", SP_VERB_DIALOG_GLYPHS),
store(Gtk::ListStore::create(*getColumns())),
iconView(0),
entry(0),
@@ -456,8 +456,6 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) :
show_all_children();
- restorePanelPrefs();
-
// Connect this up last
conn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &GlyphsPanel::setTargetDesktop) );
instanceConns.push_back(conn);
diff --git a/src/ui/dialog/glyphs.h b/src/ui/dialog/glyphs.h
index 00c3ffa07..66db421e9 100644
--- a/src/ui/dialog/glyphs.h
+++ b/src/ui/dialog/glyphs.h
@@ -37,7 +37,7 @@ class GlyphColumns;
class GlyphsPanel : public Inkscape::UI::Widget::Panel
{
public:
- GlyphsPanel(gchar const *prefsPath = "/dialogs/glyphs");
+ GlyphsPanel();
virtual ~GlyphsPanel();
static GlyphsPanel& getInstance();
diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp
index 5a27056f3..3fdd2a6cf 100644
--- a/src/ui/dialog/input.cpp
+++ b/src/ui/dialog/input.cpp
@@ -29,6 +29,7 @@
#include <gtkmm/progressbar.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/treestore.h>
+#include <gtkmm/eventbox.h>
#include "device-manager.h"
#include "preferences.h"
diff --git a/src/ui/dialog/layers.h b/src/ui/dialog/layers.h
index 893b31557..3a580caf9 100644
--- a/src/ui/dialog/layers.h
+++ b/src/ui/dialog/layers.h
@@ -45,15 +45,10 @@ public:
LayersPanel();
virtual ~LayersPanel();
- //virtual void setOrientation( Gtk::AnchorType how );
-
static LayersPanel& getInstance();
void setDesktop( SPDesktop* desktop );
-protected:
- //virtual void _handleAction( int setId, int itemId );
-
private:
class ModelColumns;
class InternalUIBounce;
diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp
index 684074150..c6ab06507 100644
--- a/src/ui/dialog/swatches.cpp
+++ b/src/ui/dialog/swatches.cpp
@@ -21,6 +21,11 @@
#include "swatches.h"
#include <gtkmm/radiomenuitem.h>
+#include <gtkmm/menu.h>
+#include <gtkmm/checkmenuitem.h>
+#include <gtkmm/radiomenuitem.h>
+#include <gtkmm/separatormenuitem.h>
+
#include <glibmm/i18n.h>
#include <glibmm/main.h>
#include <glibmm/timer.h>
@@ -51,6 +56,14 @@
#include "gradient-chemistry.h"
#include "helper/action.h"
+static const int PANEL_SETTING_SIZE = 0;
+static const int PANEL_SETTING_MODE = 1;
+static const int PANEL_SETTING_SHAPE = 2;
+static const int PANEL_SETTING_WRAP = 3;
+static const int PANEL_SETTING_BORDER = 4;
+static const int PANEL_SETTING_NEXTFREE = 5;
+
+
namespace Inkscape {
namespace UI {
namespace Dialogs {
@@ -547,7 +560,10 @@ SwatchesPanel& SwatchesPanel::getInstance()
* Constructor
*/
SwatchesPanel::SwatchesPanel(gchar const* prefsPath) :
- Inkscape::UI::Widget::Panel(prefsPath, SP_VERB_DIALOG_SWATCHES, true),
+ Inkscape::UI::Widget::Panel(prefsPath, SP_VERB_DIALOG_SWATCHES),
+ _temp_arrow(),
+ _menu(0),
+ _fillable(0),
_holder(0),
_clear(0),
_remove(0),
@@ -555,6 +571,8 @@ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) :
_currentDesktop(0),
_currentDocument(0)
{
+ init();
+
set_name( "SwatchesPanel" );
Gtk::RadioMenuItem* hotItem = 0;
_holder = new PreviewHolder();
@@ -627,7 +645,7 @@ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) :
}
}
- _getContents()->pack_start(*_holder, Gtk::PACK_EXPAND_WIDGET);
+ _boxy.pack_start(*_holder, Gtk::PACK_EXPAND_WIDGET);
_setTargetFillable(_holder);
show_all_children();
@@ -654,13 +672,256 @@ SwatchesPanel::~SwatchesPanel()
if ( _holder ) {
delete _holder;
}
+
+ delete _menu;
+}
+
+void SwatchesPanel::_popper(GdkEventButton* event)
+{
+ if ( (event->type == GDK_BUTTON_PRESS) && (event->button == 3 || event->button == 1) ) {
+ if (_menu) {
+#if GTKMM_CHECK_VERSION(3,22,0)
+ _menu->popup_at_pointer(reinterpret_cast<GdkEvent *>(event));
+#else
+ _menu->popup(event->button, event->time);
+#endif
+ }
+ }
+}
+
+void SwatchesPanel::init()
+{
+ _anchor = SP_ANCHOR_CENTER;
+
+ guint panel_size = 0, panel_mode = 0, panel_ratio = 100, panel_border = 0;
+ bool panel_wrap = 0;
+ if (!_prefs_path.empty()) {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ panel_wrap = prefs->getBool(_prefs_path + "/panel_wrap");
+ panel_size = prefs->getIntLimited(_prefs_path + "/panel_size", 1, 0, PREVIEW_SIZE_HUGE);
+ panel_mode = prefs->getIntLimited(_prefs_path + "/panel_mode", 1, 0, 10);
+ panel_ratio = prefs->getIntLimited(_prefs_path + "/panel_ratio", 100, 0, 500 );
+ panel_border = prefs->getIntLimited(_prefs_path + "/panel_border", BORDER_NONE, 0, 2 );
+ }
+
+ _menu = new Gtk::Menu();
+
+ {
+ Gtk::RadioMenuItem::Group group;
+ Glib::ustring one_label(_("List"));
+ Glib::ustring two_label(_("Grid"));
+ Gtk::RadioMenuItem *one = Gtk::manage(new Gtk::RadioMenuItem(group, one_label));
+ Gtk::RadioMenuItem *two = Gtk::manage(new Gtk::RadioMenuItem(group, two_label));
+
+ if (panel_mode == 0) {
+ one->set_active(true);
+ } else if (panel_mode == 1) {
+ two->set_active(true);
+ }
+
+ _menu->append(*one);
+ _non_horizontal.push_back(one);
+ _menu->append(*two);
+ _non_horizontal.push_back(two);
+ Gtk::MenuItem* sep = Gtk::manage(new Gtk::SeparatorMenuItem());
+ _menu->append(*sep);
+ _non_horizontal.push_back(sep);
+ one->signal_activate().connect(sigc::bind<int, int>(sigc::mem_fun(*this, &SwatchesPanel::_bounceCall), PANEL_SETTING_MODE, 0));
+ two->signal_activate().connect(sigc::bind<int, int>(sigc::mem_fun(*this, &SwatchesPanel::_bounceCall), PANEL_SETTING_MODE, 1));
+ }
+
+ {
+ Glib::ustring heightItemLabel(C_("Swatches", "Size"));
+
+ //TRANSLATORS: Indicates size of colour swatches
+ const gchar *heightLabels[] = {
+ NC_("Swatches height", "Tiny"),
+ NC_("Swatches height", "Small"),
+ NC_("Swatches height", "Medium"),
+ NC_("Swatches height", "Large"),
+ NC_("Swatches height", "Huge")
+ };
+
+ Gtk::MenuItem *sizeItem = Gtk::manage(new Gtk::MenuItem(heightItemLabel));
+ Gtk::Menu *sizeMenu = Gtk::manage(new Gtk::Menu());
+ sizeItem->set_submenu(*sizeMenu);
+
+ Gtk::RadioMenuItem::Group heightGroup;
+ for (unsigned int i = 0; i < G_N_ELEMENTS(heightLabels); i++) {
+ Glib::ustring _label(g_dpgettext2(NULL, "Swatches height", heightLabels[i]));
+ Gtk::RadioMenuItem* _item = Gtk::manage(new Gtk::RadioMenuItem(heightGroup, _label));
+ sizeMenu->append(*_item);
+ if (i == panel_size) {
+ _item->set_active(true);
+ }
+ _item->signal_activate().connect(sigc::bind<int, int>(sigc::mem_fun(*this, &SwatchesPanel::_bounceCall), PANEL_SETTING_SIZE, i));
+ }
+
+ _menu->append(*sizeItem);
+ }
+
+ {
+ Glib::ustring widthItemLabel(C_("Swatches", "Width"));
+
+ //TRANSLATORS: Indicates width of colour swatches
+ const gchar *widthLabels[] = {
+ NC_("Swatches width", "Narrower"),
+ NC_("Swatches width", "Narrow"),
+ NC_("Swatches width", "Medium"),
+ NC_("Swatches width", "Wide"),
+ NC_("Swatches width", "Wider")
+ };
+
+ Gtk::MenuItem *item = Gtk::manage( new Gtk::MenuItem(widthItemLabel));
+ Gtk::Menu *type_menu = Gtk::manage(new Gtk::Menu());
+ item->set_submenu(*type_menu);
+ _menu->append(*item);
+
+ Gtk::RadioMenuItem::Group widthGroup;
+
+ guint values[] = {0, 25, 50, 100, 200, 400};
+ guint hot_index = 3;
+ for ( guint i = 0; i < G_N_ELEMENTS(widthLabels); ++i ) {
+ // Assume all values are in increasing order
+ if ( values[i] <= panel_ratio ) {
+ hot_index = i;
+ }
+ }
+ for ( guint i = 0; i < G_N_ELEMENTS(widthLabels); ++i ) {
+ Glib::ustring _label(g_dpgettext2(NULL, "Swatches width", widthLabels[i]));
+ Gtk::RadioMenuItem *_item = Gtk::manage(new Gtk::RadioMenuItem(widthGroup, _label));
+ type_menu->append(*_item);
+ if ( i <= hot_index ) {
+ _item->set_active(true);
+ }
+ _item->signal_activate().connect(sigc::bind<int, int>(sigc::mem_fun(*this, &SwatchesPanel::_bounceCall), PANEL_SETTING_SHAPE, values[i]));
+ }
+ }
+
+ {
+ Glib::ustring widthItemLabel(C_("Swatches", "Border"));
+
+ //TRANSLATORS: Indicates border of colour swatches
+ const gchar *widthLabels[] = {
+ NC_("Swatches border", "None"),
+ NC_("Swatches border", "Solid"),
+ NC_("Swatches border", "Wide"),
+ };
+
+ Gtk::MenuItem *item = Gtk::manage( new Gtk::MenuItem(widthItemLabel));
+ Gtk::Menu *type_menu = Gtk::manage(new Gtk::Menu());
+ item->set_submenu(*type_menu);
+ _menu->append(*item);
+
+ Gtk::RadioMenuItem::Group widthGroup;
+
+ guint values[] = {0, 1, 2};
+ guint hot_index = 0;
+ for ( guint i = 0; i < G_N_ELEMENTS(widthLabels); ++i ) {
+ // Assume all values are in increasing order
+ if ( values[i] <= panel_border ) {
+ hot_index = i;
+ }
+ }
+ for ( guint i = 0; i < G_N_ELEMENTS(widthLabels); ++i ) {
+ Glib::ustring _label(g_dpgettext2(NULL, "Swatches border", widthLabels[i]));
+ Gtk::RadioMenuItem *_item = Gtk::manage(new Gtk::RadioMenuItem(widthGroup, _label));
+ type_menu->append(*_item);
+ if ( i <= hot_index ) {
+ _item->set_active(true);
+ }
+ _item->signal_activate().connect(sigc::bind<int, int>(sigc::mem_fun(*this, &SwatchesPanel::_bounceCall), PANEL_SETTING_BORDER, values[i]));
+ }
+ }
+
+ {
+ //TRANSLATORS: "Wrap" indicates how colour swatches are displayed
+ Glib::ustring wrap_label(C_("Swatches","Wrap"));
+ Gtk::CheckMenuItem *check = Gtk::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, &SwatchesPanel::_wrapToggled), check));
+ }
+
+ Gtk::SeparatorMenuItem *sep;
+ sep = Gtk::manage(new Gtk::SeparatorMenuItem());
+ _menu->append(*sep);
+
+ _menu->show_all_children();
+ for ( std::vector<Gtk::Widget*>::iterator iter = _non_vertical.begin(); iter != _non_vertical.end(); ++iter ) {
+ (*iter)->hide();
+ }
+
+ if (true) {
+ _top_bar.pack_end(_menu_popper, false, false);
+ gint width = 0;
+ gint height = 0;
+ gtk_image_set_from_icon_name(_temp_arrow.gobj(),
+ "pan-start-symbolic",
+ GTK_ICON_SIZE_SMALL_TOOLBAR);
+ _menu_popper.add(_temp_arrow);
+ _menu_popper.signal_button_press_event().connect_notify(sigc::mem_fun(*this, &SwatchesPanel::_popper));
+ }
+
+
+ _boxy.set_name( "PanelBoxY" );
+ _getContents()->set_name( "PanelContents" );
+ _right_bar.set_name( "PanelRightBar" );
+ _top_bar.set_name( "PanelTopBar" );
+ _boxy.pack_end(_right_bar, false, true);
+
+ _getContents()->pack_start(_top_bar, false, false);
+ _getContents()->pack_start(_boxy, true, true);
+
+
+ _bounceCall(PANEL_SETTING_SIZE, panel_size);
+ _bounceCall(PANEL_SETTING_MODE, panel_mode);
+ _bounceCall(PANEL_SETTING_SHAPE, panel_ratio);
+ _bounceCall(PANEL_SETTING_WRAP, panel_wrap);
+ _bounceCall(PANEL_SETTING_BORDER, panel_border);
}
void SwatchesPanel::setOrientation(SPAnchorType how)
{
- // Must call the parent class or bad things might happen
- Inkscape::UI::Widget::Panel::setOrientation( how );
+ if (_anchor != how) {
+ _anchor = how;
+ switch (_anchor) {
+ case SP_ANCHOR_NORTH:
+ case SP_ANCHOR_SOUTH:
+ {
+ if (true) {
+ _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 = _non_horizontal.begin(); iter != _non_horizontal.end(); ++iter) {
+ (*iter)->hide();
+ }
+ 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);
+ }
+ break;
+ default:
+ {
+ if (true) {
+ for (std::vector<Gtk::Widget*>::iterator iter = _non_horizontal.begin(); iter != _non_horizontal.end(); ++iter) {
+ (*iter)->show();
+ }
+ for (std::vector<Gtk::Widget*>::iterator iter = _non_vertical.begin(); iter != _non_vertical.end(); ++iter) {
+ (*iter)->hide();
+ }
+ }
+ }
+ }
+ }
if ( _holder )
{
_holder->setOrientation(SP_ANCHOR_SOUTH);
@@ -700,6 +961,175 @@ void SwatchesPanel::setDesktop( SPDesktop* desktop )
}
+void SwatchesPanel::restorePanelPrefs()
+{
+ guint panel_size = 0, panel_mode = 0, panel_ratio = 100, panel_border = 0;
+ bool panel_wrap = 0;
+ if (!_prefs_path.empty()) {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ panel_wrap = prefs->getBool(_prefs_path + "/panel_wrap");
+ panel_size = prefs->getIntLimited(_prefs_path + "/panel_size", 1, 0, PREVIEW_SIZE_HUGE);
+ panel_mode = prefs->getIntLimited(_prefs_path + "/panel_mode", 1, 0, 10);
+ panel_ratio = prefs->getIntLimited(_prefs_path + "/panel_ratio", 000, 0, 500 );
+ panel_border = prefs->getIntLimited(_prefs_path + "/panel_border", BORDER_NONE, 0, 2 );
+ }
+ _bounceCall(PANEL_SETTING_SIZE, panel_size);
+ _bounceCall(PANEL_SETTING_MODE, panel_mode);
+ _bounceCall(PANEL_SETTING_SHAPE, panel_ratio);
+ _bounceCall(PANEL_SETTING_WRAP, panel_wrap);
+ _bounceCall(PANEL_SETTING_BORDER, panel_border);
+}
+
+void SwatchesPanel::_bounceCall(int i, int j)
+{
+ _menu->set_active(0);
+ switch (i) {
+ case PANEL_SETTING_SIZE:
+ if (!_prefs_path.empty()) {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->setInt(_prefs_path + "/panel_size", j);
+ }
+ if (_fillable) {
+ ViewType curr_type = _fillable->getPreviewType();
+ guint curr_ratio = _fillable->getPreviewRatio();
+ ::BorderStyle curr_border = _fillable->getPreviewBorder();
+
+ switch (j) {
+ case 0:
+ {
+ _fillable->setStyle(::PREVIEW_SIZE_TINY, curr_type, curr_ratio, curr_border);
+ }
+ break;
+ case 1:
+ {
+ _fillable->setStyle(::PREVIEW_SIZE_SMALL, curr_type, curr_ratio, curr_border);
+ }
+ break;
+ case 2:
+ {
+ _fillable->setStyle(::PREVIEW_SIZE_MEDIUM, curr_type, curr_ratio, curr_border);
+ }
+ break;
+ case 3:
+ {
+ _fillable->setStyle(::PREVIEW_SIZE_BIG, curr_type, curr_ratio, curr_border);
+ }
+ break;
+ case 4:
+ {
+ _fillable->setStyle(::PREVIEW_SIZE_HUGE, curr_type, curr_ratio, curr_border);
+ }
+ break;
+ default:
+ ;
+ }
+ }
+ break;
+ case PANEL_SETTING_MODE:
+ if (!_prefs_path.empty()) {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->setInt(_prefs_path + "/panel_mode", j);
+ }
+ if (_fillable) {
+ ::PreviewSize curr_size = _fillable->getPreviewSize();
+ guint curr_ratio = _fillable->getPreviewRatio();
+ ::BorderStyle curr_border = _fillable->getPreviewBorder();
+ switch (j) {
+ case 0:
+ {
+ _fillable->setStyle(curr_size, VIEW_TYPE_LIST, curr_ratio, curr_border);
+ }
+ break;
+ case 1:
+ {
+ _fillable->setStyle(curr_size, VIEW_TYPE_GRID, curr_ratio, curr_border);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ case PANEL_SETTING_SHAPE:
+ if (!_prefs_path.empty()) {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->setInt(_prefs_path + "/panel_ratio", j);
+ }
+ if ( _fillable ) {
+ ViewType curr_type = _fillable->getPreviewType();
+ ::PreviewSize curr_size = _fillable->getPreviewSize();
+ ::BorderStyle curr_border = _fillable->getPreviewBorder();
+
+ _fillable->setStyle(curr_size, curr_type, j, curr_border);
+ }
+ break;
+ case PANEL_SETTING_BORDER:
+ if (!_prefs_path.empty()) {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->setInt(_prefs_path + "/panel_border", j);
+ }
+ if ( _fillable ) {
+ ::PreviewSize curr_size = _fillable->getPreviewSize();
+ ViewType curr_type = _fillable->getPreviewType();
+ guint curr_ratio = _fillable->getPreviewRatio();
+
+ switch (j) {
+ case 0:
+ {
+ _fillable->setStyle(curr_size, curr_type, curr_ratio, BORDER_NONE);
+ }
+ break;
+ case 1:
+ {
+ _fillable->setStyle(curr_size, curr_type, curr_ratio, BORDER_SOLID);
+ }
+ break;
+ case 2:
+ {
+ _fillable->setStyle(curr_size, curr_type, curr_ratio, BORDER_WIDE);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ case PANEL_SETTING_WRAP:
+ if (!_prefs_path.empty()) {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->setBool(_prefs_path + "/panel_wrap", j);
+ }
+ if ( _fillable ) {
+ _fillable->setWrap(j);
+ }
+ break;
+ default:
+ _handleAction(i - PANEL_SETTING_NEXTFREE, j);
+ }
+}
+
+
+void SwatchesPanel::_wrapToggled(Gtk::CheckMenuItem* toggler)
+{
+ if (toggler) {
+ _bounceCall(PANEL_SETTING_WRAP, toggler->get_active() ? 1 : 0);
+ }
+}
+
+void SwatchesPanel::_setTargetFillable(PreviewFillable *target)
+{
+ _fillable = target;
+}
+
+void SwatchesPanel::_regItem(Gtk::MenuItem* item, int group, int id)
+{
+ _menu->append(*item);
+ item->signal_activate().connect(sigc::bind<int, int>(sigc::mem_fun(*this, &SwatchesPanel::_bounceCall), group + PANEL_SETTING_NEXTFREE, id));
+ item->show();
+
+}
+
+
class DocTrack
{
public:
diff --git a/src/ui/dialog/swatches.h b/src/ui/dialog/swatches.h
index ca4c1687d..33715cde3 100644
--- a/src/ui/dialog/swatches.h
+++ b/src/ui/dialog/swatches.h
@@ -10,12 +10,17 @@
#ifndef SEEN_DIALOGS_SWATCHES_H
#define SEEN_DIALOGS_SWATCHES_H
+#include <gtkmm/eventbox.h>
+#include <gtkmm/image.h>
+#include <gtkmm/menu.h>
+
#include "ui/widget/panel.h"
#include "enums.h"
namespace Inkscape {
namespace UI {
+class PreviewFillable;
class PreviewHolder;
namespace Dialogs {
@@ -46,7 +51,6 @@ protected:
static void handleGradientsChange(SPDocument *document);
virtual void _updateFromSelection();
- virtual void _handleAction( int setId, int itemId );
virtual void _setDocument( SPDocument *document );
virtual void _rebuild();
@@ -56,6 +60,9 @@ private:
SwatchesPanel(SwatchesPanel const &); // no copy
SwatchesPanel &operator=(SwatchesPanel const &); // no assign
+ void init();
+ void restorePanelPrefs();
+
static void _trackDocument( SwatchesPanel *panel, SPDocument *document );
static void handleDefsModified(SPDocument *document);
@@ -66,6 +73,28 @@ private:
SPDesktop* _currentDesktop;
SPDocument* _currentDocument;
+
+ void _setTargetFillable(PreviewFillable *target);
+ void _regItem(Gtk::MenuItem* item, int group, int id);
+
+ void _handleAction(int set_id, int item_id);
+ void _bounceCall(int i, int j);
+
+ void _popper(GdkEventButton *btn);
+
+ SPAnchorType _anchor;
+ void _wrapToggled(Gtk::CheckMenuItem *toggler);
+
+ Gtk::HBox _boxy;
+ Gtk::Image _temp_arrow;
+ Gtk::HBox _top_bar;
+ Gtk::VBox _right_bar;
+ Gtk::EventBox _menu_popper;
+ Gtk::Menu *_menu;
+ std::vector<Gtk::Widget *> _non_horizontal;
+ std::vector<Gtk::Widget *> _non_vertical;
+ PreviewFillable *_fillable;
+
sigc::connection _documentConnection;
sigc::connection _selChanged;
diff --git a/src/ui/dialog/tags.h b/src/ui/dialog/tags.h
index cc791b927..84b67c422 100644
--- a/src/ui/dialog/tags.h
+++ b/src/ui/dialog/tags.h
@@ -43,15 +43,12 @@ public:
TagsPanel();
virtual ~TagsPanel();
- //virtual void setOrientation( Gtk::AnchorType how );
-
static TagsPanel& getInstance();
void setDesktop( SPDesktop* desktop );
void setDocument( SPDesktop* desktop, SPDocument* document);
protected:
- //virtual void _handleAction( int setId, int itemId );
friend void sp_highlight_picker_color_mod(SPColorSelector *csel, GObject *cp);
private:
class ModelColumns;
diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp
index f90dc6fe1..11691deb4 100644
--- a/src/ui/dialog/xml-tree.cpp
+++ b/src/ui/dialog/xml-tree.cpp
@@ -45,7 +45,7 @@ namespace Inkscape {
namespace UI {
namespace Dialog {
-XmlTree::XmlTree (void) :
+XmlTree::XmlTree() :
UI::Widget::Panel("/dialogs/xml/", SP_VERB_DIALOG_XML_EDITOR),
blocked (0),
_message_stack (NULL),
diff --git a/src/ui/dialog/xml-tree.h b/src/ui/dialog/xml-tree.h
index cc28b5e5a..7a4709dd4 100644
--- a/src/ui/dialog/xml-tree.h
+++ b/src/ui/dialog/xml-tree.h
@@ -24,6 +24,7 @@
#include <gtkmm/separatortoolitem.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/paned.h>
+#include <gtkmm/button.h>
#include "ui/dialog/desktop-tracker.h"
#include "message.h"
diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp
index c97543371..7ace6bf9e 100644
--- a/src/ui/widget/panel.cpp
+++ b/src/ui/widget/panel.cpp
@@ -16,33 +16,19 @@
#endif
#include <gtkmm/dialog.h> // for Gtk::RESPONSE_*
-#include <gtkmm/menu.h>
-#include <gtkmm/checkmenuitem.h>
-#include <gtkmm/radiomenuitem.h>
-#include <gtkmm/separatormenuitem.h>
#include <glibmm/i18n.h>
#include "panel.h"
-#include "preferences.h"
#include "desktop.h"
#include "inkscape.h"
#include "widgets/eek-preview.h"
-#include "ui/previewfillable.h"
namespace Inkscape {
namespace UI {
namespace Widget {
-static const int PANEL_SETTING_SIZE = 0;
-static const int PANEL_SETTING_MODE = 1;
-static const int PANEL_SETTING_SHAPE = 2;
-static const int PANEL_SETTING_WRAP = 3;
-static const int PANEL_SETTING_BORDER = 4;
-static const int PANEL_SETTING_NEXTFREE = 5;
-
-
void Panel::prep() {
GtkIconSize sizes[] = {
GTK_ICON_SIZE_MENU,
@@ -55,281 +41,25 @@ void Panel::prep() {
eek_preview_set_size_mappings( G_N_ELEMENTS(sizes), sizes );
}
-Panel::Panel(gchar const *prefs_path,
- int verb_num,
- bool menu_desired) :
+Panel::Panel(gchar const *prefs_path, int verb_num) :
_prefs_path(prefs_path),
- _menu_desired(menu_desired),
_desktop(SP_ACTIVE_DESKTOP),
_verb_num(verb_num),
- _temp_arrow(),
- _menu(0),
- _action_area(0),
- _fillable(0)
+ _action_area(0)
{
set_name( "InkscapePanel" );
set_orientation( Gtk::ORIENTATION_VERTICAL );
- _init();
-}
-
-Panel::~Panel()
-{
- delete _menu;
-}
-
-void Panel::_popper(GdkEventButton* event)
-{
- if ( (event->type == GDK_BUTTON_PRESS) && (event->button == 3 || event->button == 1) ) {
- if (_menu) {
-#if GTKMM_CHECK_VERSION(3,22,0)
- _menu->popup_at_pointer(reinterpret_cast<GdkEvent *>(event));
-#else
- _menu->popup(event->button, event->time);
-#endif
- }
- }
-}
-
-void Panel::_init()
-{
- _anchor = SP_ANCHOR_CENTER;
-
- guint panel_size = 0, panel_mode = 0, panel_ratio = 100, panel_border = 0;
- bool panel_wrap = 0;
- if (!_prefs_path.empty()) {
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- panel_wrap = prefs->getBool(_prefs_path + "/panel_wrap");
- panel_size = prefs->getIntLimited(_prefs_path + "/panel_size", 1, 0, PREVIEW_SIZE_HUGE);
- panel_mode = prefs->getIntLimited(_prefs_path + "/panel_mode", 1, 0, 10);
- panel_ratio = prefs->getIntLimited(_prefs_path + "/panel_ratio", 100, 0, 500 );
- panel_border = prefs->getIntLimited(_prefs_path + "/panel_border", BORDER_NONE, 0, 2 );
- }
-
- _menu = new Gtk::Menu();
-
- {
- Gtk::RadioMenuItem::Group group;
- Glib::ustring one_label(_("List"));
- Glib::ustring two_label(_("Grid"));
- Gtk::RadioMenuItem *one = Gtk::manage(new Gtk::RadioMenuItem(group, one_label));
- Gtk::RadioMenuItem *two = Gtk::manage(new Gtk::RadioMenuItem(group, two_label));
-
- if (panel_mode == 0) {
- one->set_active(true);
- } else if (panel_mode == 1) {
- two->set_active(true);
- }
-
- _menu->append(*one);
- _non_horizontal.push_back(one);
- _menu->append(*two);
- _non_horizontal.push_back(two);
- Gtk::MenuItem* sep = Gtk::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 heightItemLabel(C_("Swatches", "Size"));
-
- //TRANSLATORS: Indicates size of colour swatches
- const gchar *heightLabels[] = {
- NC_("Swatches height", "Tiny"),
- NC_("Swatches height", "Small"),
- NC_("Swatches height", "Medium"),
- NC_("Swatches height", "Large"),
- NC_("Swatches height", "Huge")
- };
-
- Gtk::MenuItem *sizeItem = Gtk::manage(new Gtk::MenuItem(heightItemLabel));
- Gtk::Menu *sizeMenu = Gtk::manage(new Gtk::Menu());
- sizeItem->set_submenu(*sizeMenu);
-
- Gtk::RadioMenuItem::Group heightGroup;
- for (unsigned int i = 0; i < G_N_ELEMENTS(heightLabels); i++) {
- Glib::ustring _label(g_dpgettext2(NULL, "Swatches height", heightLabels[i]));
- Gtk::RadioMenuItem* _item = Gtk::manage(new Gtk::RadioMenuItem(heightGroup, _label));
- sizeMenu->append(*_item);
- if (i == panel_size) {
- _item->set_active(true);
- }
- _item->signal_activate().connect(sigc::bind<int, int>(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_SIZE, i));
- }
-
- _menu->append(*sizeItem);
- }
-
- {
- Glib::ustring widthItemLabel(C_("Swatches", "Width"));
-
- //TRANSLATORS: Indicates width of colour swatches
- const gchar *widthLabels[] = {
- NC_("Swatches width", "Narrower"),
- NC_("Swatches width", "Narrow"),
- NC_("Swatches width", "Medium"),
- NC_("Swatches width", "Wide"),
- NC_("Swatches width", "Wider")
- };
-
- Gtk::MenuItem *item = Gtk::manage( new Gtk::MenuItem(widthItemLabel));
- Gtk::Menu *type_menu = Gtk::manage(new Gtk::Menu());
- item->set_submenu(*type_menu);
- _menu->append(*item);
-
- Gtk::RadioMenuItem::Group widthGroup;
-
- guint values[] = {0, 25, 50, 100, 200, 400};
- guint hot_index = 3;
- for ( guint i = 0; i < G_N_ELEMENTS(widthLabels); ++i ) {
- // Assume all values are in increasing order
- if ( values[i] <= panel_ratio ) {
- hot_index = i;
- }
- }
- for ( guint i = 0; i < G_N_ELEMENTS(widthLabels); ++i ) {
- Glib::ustring _label(g_dpgettext2(NULL, "Swatches width", widthLabels[i]));
- Gtk::RadioMenuItem *_item = Gtk::manage(new Gtk::RadioMenuItem(widthGroup, _label));
- type_menu->append(*_item);
- if ( i <= hot_index ) {
- _item->set_active(true);
- }
- _item->signal_activate().connect(sigc::bind<int, int>(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_SHAPE, values[i]));
- }
- }
-
- {
- Glib::ustring widthItemLabel(C_("Swatches", "Border"));
-
- //TRANSLATORS: Indicates border of colour swatches
- const gchar *widthLabels[] = {
- NC_("Swatches border", "None"),
- NC_("Swatches border", "Solid"),
- NC_("Swatches border", "Wide"),
- };
-
- Gtk::MenuItem *item = Gtk::manage( new Gtk::MenuItem(widthItemLabel));
- Gtk::Menu *type_menu = Gtk::manage(new Gtk::Menu());
- item->set_submenu(*type_menu);
- _menu->append(*item);
-
- Gtk::RadioMenuItem::Group widthGroup;
-
- guint values[] = {0, 1, 2};
- guint hot_index = 0;
- for ( guint i = 0; i < G_N_ELEMENTS(widthLabels); ++i ) {
- // Assume all values are in increasing order
- if ( values[i] <= panel_border ) {
- hot_index = i;
- }
- }
- for ( guint i = 0; i < G_N_ELEMENTS(widthLabels); ++i ) {
- Glib::ustring _label(g_dpgettext2(NULL, "Swatches border", widthLabels[i]));
- Gtk::RadioMenuItem *_item = Gtk::manage(new Gtk::RadioMenuItem(widthGroup, _label));
- type_menu->append(*_item);
- if ( i <= hot_index ) {
- _item->set_active(true);
- }
- _item->signal_activate().connect(sigc::bind<int, int>(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_BORDER, values[i]));
- }
- }
-
- {
- //TRANSLATORS: "Wrap" indicates how colour swatches are displayed
- Glib::ustring wrap_label(C_("Swatches","Wrap"));
- Gtk::CheckMenuItem *check = Gtk::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));
- }
-
- Gtk::SeparatorMenuItem *sep;
- sep = Gtk::manage(new Gtk::SeparatorMenuItem());
- _menu->append(*sep);
-
- _menu->show_all_children();
- for ( std::vector<Gtk::Widget*>::iterator iter = _non_vertical.begin(); iter != _non_vertical.end(); ++iter ) {
- (*iter)->hide();
- }
-
- if ( _menu_desired ) {
- _top_bar.pack_end(_menu_popper, false, false);
- gint width = 0;
- gint height = 0;
- gtk_image_set_from_icon_name(_temp_arrow.gobj(),
- "pan-start-symbolic",
- GTK_ICON_SIZE_SMALL_TOOLBAR);
- _menu_popper.add(_temp_arrow);
- _menu_popper.signal_button_press_event().connect_notify(sigc::mem_fun(*this, &Panel::_popper));
- }
-
- pack_start(_top_bar, false, false);
-
- Gtk::HBox* boxy = Gtk::manage(new Gtk::HBox());
- boxy->set_name( "PanelBoxY" );
- _contents.set_name( "PanelContents" );
- _right_bar.set_name( "PanelRightBar" );
- _top_bar.set_name( "PanelTopBar" );
- boxy->pack_start(_contents, true, true);
- boxy->pack_start(_right_bar, false, true);
-
- pack_start(*boxy, true, true);
signalResponse().connect(sigc::mem_fun(*this, &Panel::_handleResponse));
-
signalActivateDesktop().connect(sigc::mem_fun(*this, &Panel::setDesktop));
- show_all_children();
+ pack_start(_contents, true, true);
- _bounceCall(PANEL_SETTING_SIZE, panel_size);
- _bounceCall(PANEL_SETTING_MODE, panel_mode);
- _bounceCall(PANEL_SETTING_SHAPE, panel_ratio);
- _bounceCall(PANEL_SETTING_WRAP, panel_wrap);
- _bounceCall(PANEL_SETTING_BORDER, panel_border);
+ show_all_children();
}
-void Panel::setOrientation(SPAnchorType how)
+Panel::~Panel()
{
- if (_anchor != how) {
- _anchor = how;
- switch (_anchor) {
- case SP_ANCHOR_NORTH:
- case SP_ANCHOR_SOUTH:
- {
- 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 = _non_horizontal.begin(); iter != _non_horizontal.end(); ++iter) {
- (*iter)->hide();
- }
- 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);
- }
- break;
-
- default:
- {
- 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 = _non_vertical.begin(); iter != _non_vertical.end(); ++iter) {
- (*iter)->hide();
- }
- }
- }
- }
- }
}
void Panel::present()
@@ -337,26 +67,6 @@ void Panel::present()
_signal_present.emit();
}
-
-void Panel::restorePanelPrefs()
-{
- guint panel_size = 0, panel_mode = 0, panel_ratio = 100, panel_border = 0;
- bool panel_wrap = 0;
- if (!_prefs_path.empty()) {
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- panel_wrap = prefs->getBool(_prefs_path + "/panel_wrap");
- panel_size = prefs->getIntLimited(_prefs_path + "/panel_size", 1, 0, PREVIEW_SIZE_HUGE);
- panel_mode = prefs->getIntLimited(_prefs_path + "/panel_mode", 1, 0, 10);
- panel_ratio = prefs->getIntLimited(_prefs_path + "/panel_ratio", 000, 0, 500 );
- panel_border = prefs->getIntLimited(_prefs_path + "/panel_border", BORDER_NONE, 0, 2 );
- }
- _bounceCall(PANEL_SETTING_SIZE, panel_size);
- _bounceCall(PANEL_SETTING_MODE, panel_mode);
- _bounceCall(PANEL_SETTING_SHAPE, panel_ratio);
- _bounceCall(PANEL_SETTING_WRAP, panel_wrap);
- _bounceCall(PANEL_SETTING_BORDER, panel_border);
-}
-
sigc::signal<void, int> &Panel::signalResponse()
{
return _signal_response;
@@ -367,142 +77,6 @@ sigc::signal<void> &Panel::signalPresent()
return _signal_present;
}
-void Panel::_bounceCall(int i, int j)
-{
- _menu->set_active(0);
- switch (i) {
- case PANEL_SETTING_SIZE:
- if (!_prefs_path.empty()) {
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setInt(_prefs_path + "/panel_size", j);
- }
- if (_fillable) {
- ViewType curr_type = _fillable->getPreviewType();
- guint curr_ratio = _fillable->getPreviewRatio();
- ::BorderStyle curr_border = _fillable->getPreviewBorder();
-
- switch (j) {
- case 0:
- {
- _fillable->setStyle(::PREVIEW_SIZE_TINY, curr_type, curr_ratio, curr_border);
- }
- break;
- case 1:
- {
- _fillable->setStyle(::PREVIEW_SIZE_SMALL, curr_type, curr_ratio, curr_border);
- }
- break;
- case 2:
- {
- _fillable->setStyle(::PREVIEW_SIZE_MEDIUM, curr_type, curr_ratio, curr_border);
- }
- break;
- case 3:
- {
- _fillable->setStyle(::PREVIEW_SIZE_BIG, curr_type, curr_ratio, curr_border);
- }
- break;
- case 4:
- {
- _fillable->setStyle(::PREVIEW_SIZE_HUGE, curr_type, curr_ratio, curr_border);
- }
- break;
- default:
- ;
- }
- }
- break;
- case PANEL_SETTING_MODE:
- if (!_prefs_path.empty()) {
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setInt(_prefs_path + "/panel_mode", j);
- }
- if (_fillable) {
- ::PreviewSize curr_size = _fillable->getPreviewSize();
- guint curr_ratio = _fillable->getPreviewRatio();
- ::BorderStyle curr_border = _fillable->getPreviewBorder();
- switch (j) {
- case 0:
- {
- _fillable->setStyle(curr_size, VIEW_TYPE_LIST, curr_ratio, curr_border);
- }
- break;
- case 1:
- {
- _fillable->setStyle(curr_size, VIEW_TYPE_GRID, curr_ratio, curr_border);
- }
- break;
- default:
- break;
- }
- }
- break;
- case PANEL_SETTING_SHAPE:
- if (!_prefs_path.empty()) {
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setInt(_prefs_path + "/panel_ratio", j);
- }
- if ( _fillable ) {
- ViewType curr_type = _fillable->getPreviewType();
- ::PreviewSize curr_size = _fillable->getPreviewSize();
- ::BorderStyle curr_border = _fillable->getPreviewBorder();
-
- _fillable->setStyle(curr_size, curr_type, j, curr_border);
- }
- break;
- case PANEL_SETTING_BORDER:
- if (!_prefs_path.empty()) {
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setInt(_prefs_path + "/panel_border", j);
- }
- if ( _fillable ) {
- ::PreviewSize curr_size = _fillable->getPreviewSize();
- ViewType curr_type = _fillable->getPreviewType();
- guint curr_ratio = _fillable->getPreviewRatio();
-
- switch (j) {
- case 0:
- {
- _fillable->setStyle(curr_size, curr_type, curr_ratio, BORDER_NONE);
- }
- break;
- case 1:
- {
- _fillable->setStyle(curr_size, curr_type, curr_ratio, BORDER_SOLID);
- }
- break;
- case 2:
- {
- _fillable->setStyle(curr_size, curr_type, curr_ratio, BORDER_WIDE);
- }
- break;
- default:
- break;
- }
- }
- break;
- case PANEL_SETTING_WRAP:
- if (!_prefs_path.empty()) {
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setBool(_prefs_path + "/panel_wrap", j);
- }
- if ( _fillable ) {
- _fillable->setWrap(j);
- }
- break;
- default:
- _handleAction(i - PANEL_SETTING_NEXTFREE, j);
- }
-}
-
-
-void Panel::_wrapToggled(Gtk::CheckMenuItem* toggler)
-{
- if (toggler) {
- _bounceCall(PANEL_SETTING_WRAP, toggler->get_active() ? 1 : 0);
- }
-}
-
gchar const *Panel::getPrefsPath() const
{
return _prefs_path.data();
@@ -518,24 +92,6 @@ void Panel::setDesktop(SPDesktop *desktop)
_desktop = desktop;
}
-void Panel::_setTargetFillable(PreviewFillable *target)
-{
- _fillable = target;
-}
-
-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()]");
diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h
index 7b4de124b..764ff1db1 100644
--- a/src/ui/widget/panel.h
+++ b/src/ui/widget/panel.h
@@ -18,12 +18,7 @@
#endif
#include <gtkmm/box.h>
-#include <gtkmm/button.h>
-#include <gtkmm/eventbox.h>
-#include <gtkmm/image.h>
-#include <gtkmm/label.h>
#include "enums.h"
-#include <vector>
#include <map>
class SPDesktop;
@@ -31,6 +26,7 @@ class SPDocument;
namespace Gtk {
class CheckMenuItem;
+ class Button;
class ButtonBox;
class MenuItem;
}
@@ -43,8 +39,6 @@ class Selection;
namespace UI {
-class PreviewFillable;
-
namespace Widget {
/**
@@ -68,16 +62,13 @@ public:
* @param prefs_path characteristic path to load/save dialog position.
* @param verb_num the dialog verb.
*/
- Panel(gchar const *prefs_path = 0, int verb_num = 0, bool menu_desired = false);
-
+ Panel(gchar const *prefs_path = 0, int verb_num = 0);
virtual ~Panel();
gchar const *getPrefsPath() const;
int const &getVerb() const;
- virtual void setOrientation(SPAnchorType how);
-
virtual void present(); //< request to be present
void restorePanelPrefs();
@@ -105,10 +96,6 @@ protected:
* Returns a pointer to a Gtk::Box containing the child widgets.
*/
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);
@@ -121,8 +108,6 @@ protected:
* Stores characteristic path for loading/saving the dialog position.
*/
Glib::ustring const _prefs_path;
- bool _menu_desired;
- SPAnchorType _anchor;
/* Signals */
sigc::signal<void, int> _signal_response;
@@ -132,28 +117,13 @@ protected:
sigc::signal<void, SPDesktop *> _signal_deactive_desktop;
private:
- void _init();
- void _bounceCall(int i, int j);
-
- void _popper(GdkEventButton *btn);
- void _wrapToggled(Gtk::CheckMenuItem *toggler);
-
SPDesktop *_desktop;
int _verb_num;
- Gtk::HBox _top_bar;
- Gtk::VBox _right_bar;
Gtk::VBox _contents;
- Gtk::Image _temp_arrow;
- Gtk::EventBox _menu_popper;
- Gtk::Menu *_menu;
Gtk::ButtonBox *_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;