summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: caa1067)
raw | patch | inline | side by side (parent: caa1067)
author | rwst <rwst@users.sourceforge.net> | |
Tue, 17 Jan 2006 09:51:29 +0000 (09:51 +0000) | ||
committer | rwst <rwst@users.sourceforge.net> | |
Tue, 17 Jan 2006 09:51:29 +0000 (09:51 +0000) |
index 832676b609c4a38317bc0cf4d9858b048a118a03..952c2b502df360a7fb9786b814f59735b58e7890 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
Juarez Rudsatz
Xavier Conde Rueda
Christian Schaller
+Marco Scholten
Tom von Schwerdtner
Shivaken
Boštjan Špetič
diff --git a/ChangeLog b/ChangeLog
index 57233d47381c500aa29987eff1e412e8a9d752db..bc0b8a9ee375a3e26ab06dfdfa879327c0d00b84 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2006-01-15 Marco Scholten <mscholtn@xs4all.nl>
+
+ * /src/ui/dialog/inkscape-preferences.cpp
+ Added style swatches,
+ Changed Gtk::Requisition Gtk::Widget::size_request() to
+ void Gtk::Widget::size_request(const Requisition& requisition)
+ * /src/ui/dialog/preferences-widget.cpp & .h
+ Added DialogPage::set_tip()
+
2006-01-17 Michael Wybrow <mjwybrow@users.sourceforge.net>
* packaging/osx-app.sh, packaging/macosx/Resources/etc/fonts/fonts.conf:
index addbcf39fe1cc0e19b1efaf5f72fa94778906f12..c22e1a4b64a57eeb98922ad6c8c62d5b50de029c 100644 (file)
#include <gtkmm/frame.h>
#include <gtkmm/scrolledwindow.h>
+#include <gtkmm/alignment.h>
#include "prefs-utils.h"
#include "inkscape-preferences.h"
#include "selection.h"
#include "selection-chemistry.h"
#include "xml/repr.h"
+#include "ui/widget/style-swatch.h"
namespace Inkscape {
namespace UI {
sb->set_width_chars(6);
this->get_vbox()->add(*sb);
this->show_all_children();
- _sb_width = sb->size_request().width;
+ Gtk:: Requisition sreq;
+ sb->size_request(sreq);
+ _sb_width = sreq.width;
this->get_vbox()->remove(*sb);
delete sb;
@@ -203,28 +207,7 @@ void InkscapePreferences::AddGradientCheckbox(DialogPage& p, const std::string&
p.add_line( false, "", *cb, "", _("Whether selected objects display gradient editing controls"));
}
-void InkscapePreferences::AddNewObjectsStyle(DialogPage& p, const std::string& prefs_path)
-{
- PrefRadioButton* current = Gtk::manage( new PrefRadioButton);
- PrefRadioButton* own = Gtk::manage( new PrefRadioButton);
- Gtk::Button* button = Gtk::manage( new Gtk::Button(_("Take from selection"),true));
-
- own->changed_signal.connect( sigc::mem_fun(*button, &Gtk::Button::set_sensitive) );
- button->signal_clicked().connect(sigc::bind( sigc::ptr_fun(InkscapePreferences::StyleFromSelectionToTool), prefs_path.c_str() ) );
-
- current->init ( _("Last used style"), prefs_path, "usecurrent", 1, true, 0);
- own->init ( _("This tool's own style:"), prefs_path, "usecurrent", 0, false, current);
-
- p.add_group_header( _("Create new objects with:"));
- p.add_line( true, "", *current, "",
- _("Apply the style you last set on an object"));
- p.add_line( true, "", *own, "",
- _("Each tool may store its own style to apply to the newly created objects. Use the button below to set it."));
- p.add_line( true, "", *button, "",
- _("Remember the style of the (first) selected object as this tool's style"));
-}
-
-void InkscapePreferences::StyleFromSelectionToTool(gchar const *prefs_path)
+void StyleFromSelectionToTool(gchar const *prefs_path, StyleSwatch *swatch)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
if (desktop == NULL)
sp_repr_css_change (inkscape_get_repr (INKSCAPE, prefs_path), css, "style");
sp_repr_css_attr_unref (css);
+
+ // update the swatch
+ if (swatch) {
+ Inkscape::XML::Node *tool_repr = inkscape_get_repr(INKSCAPE, prefs_path);
+ if (tool_repr) {
+ SPCSSAttr *css = sp_repr_css_attr_inherited(tool_repr, "style");
+ swatch->setStyle (css);
+ sp_repr_css_attr_unref(css);
+ }
+ }
+}
+
+void InkscapePreferences::AddNewObjectsStyle(DialogPage& p, const std::string& prefs_path)
+{
+
+
+ p.add_group_header( _("Create new objects with:"));
+ PrefRadioButton* current = Gtk::manage( new PrefRadioButton);
+ current->init ( _("Last used style"), prefs_path, "usecurrent", 1, true, 0);
+ p.add_line( true, "", *current, "",
+ _("Apply the style you last set on an object"));
+
+ PrefRadioButton* own = Gtk::manage( new PrefRadioButton);
+ Gtk::HBox* hb = Gtk::manage( new Gtk::HBox);
+ Gtk::Alignment* align = Gtk::manage( new Gtk::Alignment);
+ own->init ( _("This tool's own style:"), prefs_path, "usecurrent", 0, false, current);
+ align->set(0,0,0,0);
+ align->add(*own);
+ hb->add(*align);
+ p.set_tip( *own, _("Each tool may store its own style to apply to the newly created objects. Use the button below to set it."));
+ p.add_line( true, "", *hb, "", "");
+
+ // style swatch
+ Inkscape::XML::Node *tool_repr = inkscape_get_repr(INKSCAPE, prefs_path.c_str());
+ Gtk::Button* button = Gtk::manage( new Gtk::Button(_("Take from selection"),true));
+ StyleSwatch *swatch = 0;
+ if (tool_repr) {
+ SPCSSAttr *css = sp_repr_css_attr_inherited(tool_repr, "style");
+ swatch = new StyleSwatch(css);
+ hb->add(*swatch);
+ sp_repr_css_attr_unref(css);
+ }
+
+ button->signal_clicked().connect( sigc::bind( sigc::ptr_fun(StyleFromSelectionToTool), prefs_path.c_str(), swatch) );
+ own->changed_signal.connect( sigc::mem_fun(*button, &Gtk::Button::set_sensitive) );
+ p.add_line( true, "", *button, "",
+ _("Remember the style of the (first) selected object as this tool's style"));
}
void InkscapePreferences::initPageTools()
@@ -486,8 +516,10 @@ bool InkscapePreferences::SetMaxDialogSize(const Gtk::TreeModel::iterator& iter)
DialogPage* page = row[_page_list_columns._col_page];
_page_frame.add(*page);
this->show_all_children();
- _max_dialog_width=std::max(_max_dialog_width, this->size_request().width);
- _max_dialog_height=std::max(_max_dialog_height, this->size_request().height);
+ Gtk:: Requisition sreq;
+ this->size_request(sreq);
+ _max_dialog_width=std::max(_max_dialog_width, sreq.width);
+ _max_dialog_height=std::max(_max_dialog_height, sreq.height);
_page_frame.remove();
return false;
}
index 269bce7f03ddac29fce44c1a7cb8ea8ed4acc31f..fe87583bad3676f8c71694fc03f324c597205616 100644 (file)
static void AddSelcueCheckbox(DialogPage& p, const std::string& prefs_path, bool def_value);
static void AddGradientCheckbox(DialogPage& p, const std::string& prefs_path, bool def_value);
static void AddNewObjectsStyle(DialogPage& p, const std::string& prefs_path);
- static void StyleFromSelectionToTool(gchar const *prefs_path);
void on_pagelist_selection_changed();
void initPageMouse();
index b53db0512930a522baf9fc22e769bdfa0a77c98a..c45952c839aea9762f5406fbd67cfdd978867790 100644 (file)
}
}
+void DialogPage::set_tip(Gtk::Widget& widget, const Glib::ustring& tip)
+{
+ _tooltips.set_tip (widget, tip);
+}
+
void PrefCheckButton::init(const Glib::ustring& label, const std::string& prefs_path, const std::string& attr,
bool default_value)
{
index a5a59411405daba5fb4cbdb94caf9d11065915ab..361d737a854a6eded84f6b034ec27e6b8779267c 100644 (file)
DialogPage();
void add_line(bool indent, const Glib::ustring label, Gtk::Widget& widget, const Glib::ustring suffix, const Glib::ustring& tip, bool expand = true);
void add_group_header(Glib::ustring name);
+ void set_tip(Gtk::Widget& widget, const Glib::ustring& tip);
protected:
Gtk::Tooltips _tooltips;
};