summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2c54a50)
raw | patch | inline | side by side (parent: 2c54a50)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Thu, 15 Feb 2007 21:48:09 +0000 (21:48 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Thu, 15 Feb 2007 21:48:09 +0000 (21:48 +0000) |
index 079a987f57836eba977675a50e75cb5405568883..34cdee00bf40df11678ff115e14f1bb8bceb1469 100644 (file)
@@ -288,7 +288,7 @@ void InkscapePreferences::AddNewObjectsStyle(DialogPage& p, const std::string& p
StyleSwatch *swatch = 0;
if (tool_repr) {
SPCSSAttr *css = sp_repr_css_attr_inherited(tool_repr, "style");
- swatch = new StyleSwatch(css);
+ swatch = new StyleSwatch(css, _("This tool's style of new objects"));
hb->add(*swatch);
sp_repr_css_attr_unref(css);
}
index ef27ff390f2b8e88e1de201cdefb596cfb2bd659..705083a8f9afa2784671dc53797939722812f76e 100644 (file)
#include "xml/node-event-vector.h"
#include "widgets/widget-sizes.h"
#include "helper/units.h"
+#include "helper/action.h"
#include "inkscape.h"
enum {
namespace UI {
namespace Widget {
-StyleSwatch::StyleSwatch(SPCSSAttr *css)
+StyleSwatch::StyleSwatch(SPCSSAttr *css, gchar const *main_tip)
:
_tool_path(NULL),
_css (NULL),
_tooltips ()
{
- _label[SS_FILL].set_markup(_("F:"));
- _label[SS_STROKE].set_markup(_("S:"));
+ _label[SS_FILL].set_markup(_("Fill:"));
+ _label[SS_STROKE].set_markup(_("Stroke:"));
for (int i = SS_FILL; i <= SS_STROKE; i++) {
_label[i].set_alignment(0.0, 0.5);
_stroke_width_place.add(_stroke_width);
_stroke.pack_start(_stroke_width_place, Gtk::PACK_SHRINK);
- _table.attach(_label[SS_FILL], 0,1, 0,1, Gtk::SHRINK, Gtk::SHRINK);
- _table.attach(_label[SS_STROKE], 0,1, 1,2, Gtk::SHRINK, Gtk::SHRINK);
+ _table.attach(_label[SS_FILL], 0,1, 0,1, Gtk::FILL, Gtk::SHRINK);
+ _table.attach(_label[SS_STROKE], 0,1, 1,2, Gtk::FILL, Gtk::SHRINK);
_table.attach(_place[SS_FILL], 1,2, 0,1);
_table.attach(_stroke, 1,2, 1,2);
_opacity_place.add(_opacity_value);
_table.attach(_opacity_place, 2,3, 0,2, Gtk::SHRINK, Gtk::SHRINK);
- pack_start(_table, true, true, 0);
+ _swatch.add(_table);
+ pack_start(_swatch, true, true, 0);
set_size_request (STYLE_SWATCH_WIDTH, -1);
}
setStyle (css);
+
+ _swatch.signal_button_press_event().connect(sigc::mem_fun(*this, &StyleSwatch::on_click));
+
+ _tooltips.set_tip(_swatch, main_tip);
+}
+
+void StyleSwatch::setClickVerb(sp_verb_t verb_t) {
+ _verb_t = verb_t;
+}
+
+void StyleSwatch::setDesktop(SPDesktop *desktop) {
+ _desktop = desktop;
+}
+
+bool
+StyleSwatch::on_click(GdkEventButton *event)
+{
+ if (this->_desktop && this->_verb_t != SP_VERB_NONE) {
+ Inkscape::Verb *verb = Inkscape::Verb::get(this->_verb_t);
+ SPAction *action = verb->get_action((Inkscape::UI::View::View *) this->_desktop);
+ sp_action_perform (action, NULL);
+ return true;
+ }
+ return false;
}
StyleSwatch::~StyleSwatch()
index 1f7dd2e377e1470030e51f64c71d85b1c89aa62d..5efd561f380fd9092ffb295e9bf5abd0ec02ebf6 100644 (file)
#include <glibmm/i18n.h>
#include <desktop.h>
+#include <verbs.h>
#include "button.h"
class StyleSwatch : public Gtk::HBox
{
public:
- StyleSwatch (SPCSSAttr *attr);
+ StyleSwatch (SPCSSAttr *attr, gchar const *main_tip);
~StyleSwatch();
void setWatched (Inkscape::XML::Node *watched, Inkscape::XML::Node *secondary);
void setWatchedTool (const char *path, bool synthesize);
+ void setClickVerb(sp_verb_t verb_t);
+ void setDesktop(SPDesktop *desktop);
+ bool on_click(GdkEventButton *event);
+
char *_tool_path;
protected:
+ SPDesktop *_desktop;
+
+ sp_verb_t _verb_t;
+
SPCSSAttr *_css;
Inkscape::XML::Node *_watched;
Inkscape::XML::Node *_watched_tool;
+ Gtk::EventBox _swatch;
+
Gtk::Table _table;
Gtk::Label _label[2];
index c2de24d6f42861308801183f663a94b70b56612a..8d2f5c00afa950ffb34be2878c2001dd47008133 100644 (file)
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
gtk_box_pack_start(GTK_BOX(tbl),hb, FALSE, FALSE, AUX_SPACING);
}
- Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch(NULL);
+ Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch(NULL, _("Style of new stars"));
+ swatch->setDesktop (desktop);
+ swatch->setClickVerb (SP_VERB_CONTEXT_STAR_PREFS);
swatch->setWatchedTool ("tools.shapes.star", true);
GtkWidget *swatch_ = GTK_WIDGET(swatch->gobj());
gtk_box_pack_end(GTK_BOX(tbl), swatch_, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(tbl), hb, FALSE, FALSE, AUX_BETWEEN_BUTTON_GROUPS);
}
- Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch(NULL);
+ Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch(NULL, _("Style of new rectangles"));
+ swatch->setDesktop (desktop);
+ swatch->setClickVerb (SP_VERB_CONTEXT_RECT_PREFS);
swatch->setWatchedTool ("tools.shapes.rect", true);
GtkWidget *swatch_ = GTK_WIDGET(swatch->gobj());
gtk_box_pack_end(GTK_BOX(tbl), swatch_, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(tbl),hb, FALSE, FALSE, AUX_BETWEEN_BUTTON_GROUPS);
}
- Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch(NULL);
+ Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch(NULL, _("Style of new spirals"));
+ swatch->setDesktop (desktop);
+ swatch->setClickVerb (SP_VERB_CONTEXT_SPIRAL_PREFS);
swatch->setWatchedTool ("tools.shapes.spiral", true);
GtkWidget *swatch_ = GTK_WIDGET(swatch->gobj());
gtk_box_pack_end(GTK_BOX(tbl), swatch_, FALSE, FALSE, 0);
gtk_object_set_data(GTK_OBJECT(tbl), "dtw", desktop->canvas);
gtk_object_set_data(GTK_OBJECT(tbl), "desktop", desktop);
- Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch(NULL);
+ Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch(NULL, _("Style of new paths created by Pen"));
+ swatch->setDesktop (desktop);
+ swatch->setClickVerb (SP_VERB_CONTEXT_PEN_PREFS);
swatch->setWatchedTool ("tools.freehand.pen", true);
GtkWidget *swatch_ = GTK_WIDGET(swatch->gobj());
gtk_box_pack_end(GTK_BOX(tbl), swatch_, FALSE, FALSE, 0);
gtk_object_set_data(GTK_OBJECT(tbl), "dtw", desktop->canvas);
gtk_object_set_data(GTK_OBJECT(tbl), "desktop", desktop);
- Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch(NULL);
+ Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch(NULL, _("Style of new paths created by Pencil"));
+ swatch->setDesktop (desktop);
+ swatch->setClickVerb (SP_VERB_CONTEXT_PENCIL_PREFS);
swatch->setWatchedTool ("tools.freehand.pencil", true);
GtkWidget *swatch_ = GTK_WIDGET(swatch->gobj());
gtk_box_pack_end(GTK_BOX(tbl), swatch_, FALSE, FALSE, 0);
gtk_table_attach( GTK_TABLE(holder), toolBar, 0, 1, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0 );
- Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch(NULL);
+ Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch(NULL, _("Style of new calligraphic strokes"));
+ swatch->setDesktop (desktop);
+ swatch->setClickVerb (SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS);
swatch->setWatchedTool ("tools.calligraphic", true);
GtkWidget *swatch_ = GTK_WIDGET(swatch->gobj());
gtk_table_attach( GTK_TABLE(holder), swatch_, 1, 2, 0, 1, (GtkAttachOptions)(GTK_SHRINK | GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), AUX_BETWEEN_BUTTON_GROUPS, 0 );
}
- Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch(NULL);
+ Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch(NULL, _("Style of new calligraphic strokes"));
+ swatch->setDesktop (desktop);
+ swatch->setClickVerb (SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS);
swatch->setWatchedTool ("tools.calligraphic", true);
GtkWidget *swatch_ = GTK_WIDGET(swatch->gobj());
gtk_box_pack_end(GTK_BOX(tbl), swatch_, FALSE, FALSE, 0);
);
g_signal_connect(G_OBJECT(tbl), "destroy", G_CALLBACK(delete_connection), connection);
- Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch(NULL);
+ Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch(NULL, _("Style of new ellipses"));
+ swatch->setDesktop (desktop);
+ swatch->setClickVerb (SP_VERB_CONTEXT_ARC_PREFS);
swatch->setWatchedTool ("tools.shapes.arc", true);
GtkWidget *swatch_ = GTK_WIDGET(swatch->gobj());
gtk_box_pack_end(GTK_BOX(tbl), swatch_, FALSE, FALSE, 0);