/*
* Selector aux toolbar
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Jon A. Cruz <jon@joncruz.org>
* Abhishek Sharma
*
* Copyright (C) 2003-2005 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "ui/widget/spinbutton.h"
#include "select-toolbar.h"
#include "desktop.h"
#include "display/sp-canvas.h"
#include "document-undo.h"
#include "document.h"
#include "widgets/ege-adjustment-action.h"
#include "helper/action-context.h"
#include "widgets/ink-action.h"
#include "inkscape.h"
#include "message-stack.h"
#include "preferences.h"
#include "selection-chemistry.h"
#include "selection.h"
#include "sp-item-transform.h"
#include "sp-namedview.h"
#include "toolbox.h"
#include "ui/icon-names.h"
#include "ui/widget/unit-tracker.h"
#include "verbs.h"
#include "widgets/sp-widget.h"
#include "widgets/spw-utilities.h"
#include "widgets/widget-sizes.h"
using Inkscape::DocumentUndo;
static void
{
return;
}
using Geom::X;
using Geom::Y;
if ( bbox ) {
};
for (unsigned i = 0; i < G_N_ELEMENTS(keyval); ++i) {
}
} else {
for (unsigned i = 0; i < G_N_ELEMENTS(keyval); ++i) {
}
}
}
}
}
static void
sp_selection_layout_widget_modify_selection(SPWidget *spw, Inkscape::Selection *selection, guint flags, gpointer data)
{
&& (flags & (SP_OBJECT_MODIFIED_FLAG |
{
}
}
static void
sp_selection_layout_widget_change_selection(SPWidget *spw, Inkscape::Selection *selection, gpointer data)
{
std::vector<GtkAction*> *contextActions = reinterpret_cast<std::vector<GtkAction*> *>(g_object_get_data(G_OBJECT(spw), "contextActions"));
if ( contextActions ) {
}
}
}
}
}
static void
{
return;
}
/*
* When only units are being changed, don't treat changes
* to adjuster values as object changes.
*/
return;
}
document->ensureUpToDate ();
if ( !bbox_user ) {
return;
}
xrel = Quantity::convert(gtk_adjustment_get_value(a_w), unit, "px") / bbox_user->dimensions()[Geom::X];
yrel = Quantity::convert(gtk_adjustment_get_value(a_h), unit, "px") / bbox_user->dimensions()[Geom::Y];
} else {
}
// Keep proportions if lock is on
if ( gtk_toggle_action_get_active(lock) ) {
}
}
// scales and moves, in px
// unless the unit is %, convert the scales and moves to the unit
}
// digit in the spinbox (currently spinboxes have 3 fractional digits, so that makes 0.0005). If
// the value was changed by the user, the difference will be at least that much; otherwise it's
// just rounding difference between the spinbox value and actual value, so no action is
// performed
// FIXME: fix for GTK breakage, see comment in SelectedStyle::on_opacity_changed
scaler = get_scale_transform_for_variable_stroke (*bbox_vis, *bbox_geom, transform_stroke, preserve, x0, y0, x1, y1);
} else {
// 1) We could have use the newer get_scale_transform_for_variable_stroke() here, but to avoid regressions
// we'll just use the old get_scale_transform_for_uniform_stroke() for now.
// 2) get_scale_transform_for_uniform_stroke() is intended for visual bounding boxes, not geometrical ones!
// we'll trick it into using a geometric bounding box though, by setting the stroke width to zero
}
_("Transform by toolbar"));
// resume interruptibility
}
}
// toggle button callbacks and updaters
{
if ( active ) {
desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>stroke width</b> is <b>scaled</b> when objects are scaled."));
} else {
desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>stroke width</b> is <b>not scaled</b> when objects are scaled."));
}
}
{
if ( active ) {
desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>rounded rectangle corners</b> are <b>scaled</b> when rectangles are scaled."));
} else {
desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>rounded rectangle corners</b> are <b>not scaled</b> when rectangles are scaled."));
}
}
{
if ( active ) {
desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>gradients</b> are <b>transformed</b> along with their objects when those are transformed (moved, scaled, rotated, or skewed)."));
} else {
desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>gradients</b> remain <b>fixed</b> when objects are transformed (moved, scaled, rotated, or skewed)."));
}
}
{
if ( active ) {
desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>patterns</b> are <b>transformed</b> along with their objects when those are transformed (moved, scaled, rotated, or skewed)."));
} else {
desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>patterns</b> remain <b>fixed</b> when objects are transformed (moved, scaled, rotated, or skewed)."));
}
}
if ( active ) {
} else {
}
}
{
if ( tracker ) {
delete tracker;
}
}
{
if ( targetAction ) {
}
}
static GtkAction* create_action_for_verb( Inkscape::Verb* verb, Inkscape::UI::View::View* view, Inkscape::IconSize size )
{
InkAction* inky = ink_action_new( verb->get_id(), verb->get_name(), verb->get_tip(), verb->get_image(), size );
return act;
}
{
Inkscape::IconSize secondarySize = Inkscape::UI::ToolboxFactory::prefToSize("/toolbox/secondary", 1);
act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS), view, secondarySize );
act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_ROTATE_90_CCW), view, secondarySize );
act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_ROTATE_90_CW), view, secondarySize );
act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_FLIP_HORIZONTAL), view, secondarySize );
act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_FLIP_VERTICAL), view, secondarySize );
act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_TO_BACK), view, secondarySize );
act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_TO_FRONT), view, secondarySize );
// Create the parent widget for x y w h tracker.
// Remember the desktop's canvas widget, to be used for defocusing.
// The vb frame holds all other widgets and is used to set sensitivity depending on selection state.
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
// Create the units menu.
// four spinbuttons
"XAction", /* name */
0.0, /* def(default) */
0, 0, 0, /* descrLabels, descrValues, descrCount */
sp_object_layout_any_value_changed, /* callback */
tracker, /* unit_tracker */
"YAction", /* name */
0.0, /* def(default) */
0, 0, 0, /* descrLabels, descrValues, descrCount */
sp_object_layout_any_value_changed, /* callback */
tracker, /* unit_tracker */
"WidthAction", /* name */
0.0, /* def(default) */
0, 0, 0, /* descrLabels, descrValues, descrCount */
sp_object_layout_any_value_changed, /* callback */
tracker, /* unit_tracker */
// lock toggle
{
_("Lock width and height"),
_("When locked, change both width and height by the same proportion"),
INKSCAPE_ICON("object-unlocked"),
}
"HeightAction", /* name */
0.0, /* def(default) */
0, 0, 0, /* descrLabels, descrValues, descrCount */
sp_object_layout_any_value_changed, /* callback */
tracker, /* unit_tracker */
// Add the units menu.
// Force update when selection changes.
g_signal_connect(G_OBJECT(spw), "modify_selection", G_CALLBACK(sp_selection_layout_widget_modify_selection), desktop);
g_signal_connect(G_OBJECT(spw), "change_selection", G_CALLBACK(sp_selection_layout_widget_change_selection), desktop);
// Update now.
sp_selection_layout_widget_update(SP_WIDGET(spw), SP_ACTIVE_DESKTOP ? SP_ACTIVE_DESKTOP->getSelection() : NULL);
if ( gtk_action_is_sensitive(*iter) ) {
}
}
// Insert spw into the toolbar.
if ( GTK_IS_BOX(holder) ) {
} else if ( GTK_IS_TOOLBAR(holder) ) {
} else {
g_warning("Unexpected holder type");
}
// "Transform with object" buttons
{
_("Scale stroke width"),
_("When scaling objects, scale the stroke width by the same proportion"),
INKSCAPE_ICON("transform-affect-stroke"),
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs->getBool("/options/transform/stroke", true) );
}
{
_("Scale rounded corners"),
_("When scaling rectangles, scale the radii of rounded corners"),
INKSCAPE_ICON("transform-affect-rounded-corners"),
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs->getBool("/options/transform/rectcorners", true) );
}
{
_("Move gradients"),
_("Move gradients (in fill or stroke) along with the objects"),
INKSCAPE_ICON("transform-affect-gradient"),
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs->getBool("/options/transform/gradient", true) );
}
{
_("Move patterns"),
_("Move patterns (in fill or stroke) along with the objects"),
INKSCAPE_ICON("transform-affect-pattern"),
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs->getBool("/options/transform/pattern", true) );
}
}
/*
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 :