summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1b1864e)
raw | patch | inline | side by side (parent: 1b1864e)
author | mderezynski <mderezynski@users.sourceforge.net> | |
Thu, 18 May 2006 14:56:08 +0000 (14:56 +0000) | ||
committer | mderezynski <mderezynski@users.sourceforge.net> | |
Thu, 18 May 2006 14:56:08 +0000 (14:56 +0000) |
src/verbs.cpp | patch | blob | history | |
src/verbs.h | patch | blob | history | |
src/widgets/toolbox.cpp | patch | blob | history |
diff --git a/src/verbs.cpp b/src/verbs.cpp
index a046372fc0a7fac513d4384daff24d5e6b1b500f..bec08fe559813f8c54e574efc5b35107c2668e35 100644 (file)
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
{ }
}; /* TutorialVerb class */
+/** \brief A class to encompass all of the verbs which deal with
+ text operations. */
+class TextVerb : public Verb {
+private:
+ static void perform(SPAction *action, void *mydata, void *otherdata);
+ static SPActionEventVector vector;
+protected:
+ virtual SPAction *make_action(Inkscape::UI::View::View *view);
+public:
+ /** \brief Use the Verb initializer with the same parameters. */
+ TextVerb(unsigned int const code,
+ gchar const *id,
+ gchar const *name,
+ gchar const *tip,
+ gchar const *image) :
+ Verb(code, id, name, tip, image)
+ { }
+}; //TextVerb : public Verb
Verb::VerbTable Verb::_verbs;
Verb::VerbIDTable Verb::_verb_ids;
return make_action_helper(view, &vector);
}
+/** \brief Create an action for a \c TextVerb
+ \param view Which view the action should be created for
+ \return The built action.
+
+ Calls \c make_action_helper with the \c vector.
+*/
+SPAction *
+TextVerb::make_action(Inkscape::UI::View::View *view)
+{
+ return make_action_helper(view, &vector);
+}
+
/** \brief A quick little convience function to make building actions
a little bit easier.
\param view Which view the action should be created for.
} // end of sp_verb_action_ctx_perform()
+/** \brief Decode the verb code and take appropriate action */
+void
+TextVerb::perform(SPAction *action, void *data, void *pdata)
+{
+ SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
+ if (!dt)
+ return;
+
+ SPDocument *doc = sp_desktop_document(dt);
+ Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview);
+}
+
/** \brief Decode the verb code and take appropriate action */
void
ZoomVerb::perform(SPAction *action, void *data, void *pdata)
SPActionEventVector TutorialVerb::vector =
{{NULL},TutorialVerb::perform, NULL, NULL, NULL};
+/**
+ * Action vector to define functions called if a staticly defined tutorial verb
+ * is called
+ */
+SPActionEventVector TextVerb::vector =
+ {{NULL},TextVerb::perform, NULL, NULL, NULL};
+
+
/* *********** Effect Last ********** */
/** \brief A class to represent the last effect issued */
N_("Fit the canvas to the drawing"), NULL),
new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, "FitCanvasToSelectionOrDrawing", N_("Fit Canvas to Selection or Drawing"),
N_("Fit the canvas to the current selection or the drawing if there is no selection"), NULL),
-
+
+#if 0
+ //Text
+ new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, "FitCanvasToSelectionOrDrawing", N_("Fit Canvas to Selection or Drawing"),
+ N_("Fit the canvas to the current selection or the drawing if there is no selection"), NULL),
+#endif
+
/* Footer */
new Verb(SP_VERB_LAST, " '\"invalid id", NULL, NULL, NULL)
};
diff --git a/src/verbs.h b/src/verbs.h
index 5d364c53bdf6823bcf310b3e3ad812f7cf0cfa8c..4ed1c6bc9aac622fa9d3071d75ff014104be5c1a 100644 (file)
--- a/src/verbs.h
+++ b/src/verbs.h
SP_VERB_FIT_CANVAS_TO_SELECTION,
SP_VERB_FIT_CANVAS_TO_DRAWING,
SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING,
+
+#if 0
+ /* Text */
+ SP_VERB_TEXT_BOLD,
+ SP_VERB_TEXT_ITALIC,
+ SP_VERB_TEXT_UNDERLINE,
+#endif
+
/* Footer */
SP_VERB_LAST
};
index 0a4065e805f865ef6d4ee538220ee75131f42494..cc76f080eaefc991383de8a3b217bdbeb2f3f6ec 100644 (file)
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -2788,7 +2788,6 @@ sp_text_toolbox_selection_changed (Inkscape::Selection *selection, GObject *tbl)
{
GtkWidget *cbox = GTK_WIDGET(g_object_get_data (G_OBJECT(tbl), "combo-box-family"));
Inkscape::XML::Node *repr = 0;
-// Inkscape::XML::Node *oldrepr = 0;
SPStyle *style = 0;
bool multiple = false;
const GSList *items = selection->itemList();
@@ -2824,25 +2823,10 @@ sp_text_toolbox_selection_changed (Inkscape::Selection *selection, GObject *tbl)
g_object_set_data (G_OBJECT (cbox), "block", GINT_TO_POINTER(1));
gtk_combo_box_set_active (GTK_COMBO_BOX (cbox), gtk_tree_path_get_indices (path.gobj())[0]);
-
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
SPCSSAttr *css = sp_repr_css_attr_new ();
- items = sp_desktop_selection(desktop)->itemList();
-
sp_repr_css_set_property (css, "font-family", gtk_combo_box_get_active_text (GTK_COMBO_BOX(cbox)));
sp_desktop_set_style (desktop, css, true);
-
- for (; items != NULL; items = items->next)
- {
- // apply style to the reprs of all text objects in the selection
- if (SP_IS_TEXT (items->data))
- {
- // backwards compatibility:
- SP_OBJECT_REPR(items->data)->setAttribute("sodipodi:linespacing", sp_repr_css_property (css, "line-height", NULL));
- }
- }
-
- // complete the transaction
sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP));
sp_repr_css_attr_unref (css);
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
unsigned items = 0;
- const GSList *item_list = sp_desktop_selection(desktop)->itemList();
- SPCSSAttr *css = sp_repr_css_attr_new ();
if (GPOINTER_TO_INT(g_object_get_data (G_OBJECT (cbox), "block")) != 0) return;
+ const GSList *item_list = sp_desktop_selection(desktop)->itemList();
+ SPCSSAttr *css = sp_repr_css_attr_new ();
sp_repr_css_set_property (css, "font-family", gtk_combo_box_get_active_text (cbox));
sp_desktop_set_style(desktop, css, true);
-
- for (; item_list != NULL; item_list = item_list->next) {
- // apply style to the reprs of all text objects in the selection
- if (SP_IS_TEXT (item_list->data)) {
-
- // backwards compatibility:
- SP_OBJECT_REPR(item_list->data)->setAttribute("sodipodi:linespacing",
-sp_repr_css_property (css, "line-height", NULL));
-
- ++items;
- }
- else if (SP_IS_FLOWTEXT (item_list->data))
- // no need to set sodipodi:linespacing, because Inkscape never supported it on flowtext
- ++items;
- }
-
- sp_repr_css_change (inkscape_get_repr (INKSCAPE, "tools.text"), css, "style");
-
- // complete the transaction
sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP));
sp_repr_css_attr_unref (css);
}
+#if 0
+static void cell_data_func (GtkCellLayout *cell_layout,
+ GtkCellRenderer *cell,
+ GtkTreeModel *tree_model,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ char *text;
+ gtk_tree_model_get (tree_model, iter, 0, &text, -1);
+ g_object_set (G_OBJECT (cell), "family", text, NULL);
+}
+#endif
+
static GtkWidget*
sp_text_toolbox_new (SPDesktop *desktop)
{
{
GtkWidget *cbox = gtk_combo_box_entry_new_text ();
Glib::RefPtr<Gtk::ListStore> store = Inkscape::FontLister::get_instance()->get_font_list();
+ gtk_cell_layout_clear (GTK_CELL_LAYOUT (cbox));
+ GtkCellRenderer *cell = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cbox), cell, FALSE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cbox), cell, "text", 0, NULL);
+
+#if 0
+ gtk_cell_layout_set_cell_data_func
+ (GTK_CELL_LAYOUT (cbox),
+ cell,
+ GtkCellLayoutDataFunc (cell_data_func),
+ tbl,
+ NULL);
+#endif
+
gtk_combo_box_set_model (GTK_COMBO_BOX (cbox), GTK_TREE_MODEL (Glib::unwrap(store)));
+
gtk_widget_set_size_request (cbox, 250, -1);
aux_toolbox_space (tbl, 1);
gtk_box_pack_start (GTK_BOX (tbl), cbox, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (tbl), c, FALSE, FALSE, 0);
}
- aux_toolbox_space(tbl, AUX_BETWEEN_BUTTON_GROUPS);
- //Bold
- {
+ aux_toolbox_space(tbl, AUX_BETWEEN_BUTTON_GROUPS);
+ //Bold
+ {
GtkWidget *px = gtk_image_new_from_stock(GTK_STOCK_BOLD, Inkscape::ICON_SIZE_SMALL_TOOLBAR);
GtkWidget *button = gtk_toggle_button_new ();
gtk_container_add (GTK_CONTAINER (button), px);
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_widget_set_sensitive(button, TRUE);
gtk_box_pack_start (GTK_BOX (tbl), button, FALSE, FALSE, 0);
- }
+ }
//Italic