30#include <glibmm/i18n.h>
31#include <gtkmm/adjustment.h>
32#include <gtkmm/togglebutton.h>
64 _vp_x_state_btn.set_active(prefs->getBool(
"/tools/shapes/3dbox/vp_x_state",
true));
68 _vp_y_state_btn.set_active(prefs->getBool(
"/tools/shapes/3dbox/vp_y_state",
true));
72 _vp_z_state_btn.set_active(prefs->getBool(
"/tools/shapes/3dbox/vp_z_state",
true));
147 auto const path =
"/tools/shapes/3dbox/" +
name;
150 auto adj = btn.get_adjustment();
153 adj->signal_value_changed().connect(
172 if (sel_persps.empty()) {
176 auto const persp = sel_persps.front();
178 persp->perspective_impl->tmat.set_infinite_direction(axis, adj->get_value());
182 DocumentUndo::maybeDone(document,
"perspangle", _(
"3D Box: Change perspective (angle of infinite axis)"), INKSCAPE_ICON(
"draw-cuboid"));
189 if (sel_persps.empty()) {
193 auto const persp = sel_persps.front();
195 bool set_infinite =
false;
226 auto box = cast<SPBox3D>(selection->
singleItem());
232 auto persp = box->get_perspective();
234 g_warning(
"Box has no perspective set!");
252 toggle_btn.set_active(is_infinite);
253 spin_btn.set_sensitive(is_infinite);
283 _tick_callback = add_tick_callback([
this] (Glib::RefPtr<Gdk::FrameClock>
const &) {
static Angle from_degrees(Coord d)
Create an angle from its measure in degrees.
static void maybeDone(SPDocument *document, const gchar *keyconst, Glib::ustring const &event_description, Glib::ustring const &undo_icon, unsigned int object_modified_tag=0)
SPDocument * document()
Returns the document the selection is bound to.
SPItem * singleItem()
Returns a single selected item.
std::list< Persp3D * > const perspList()
Returns a list of all perspectives which have a 3D box in the current selection.
double getDouble(Glib::ustring const &pref_path, double def=0.0, Glib::ustring const &unit="")
Retrieve a floating point value.
static Preferences * get()
Access the singleton Preferences object.
void setString(Glib::ustring const &pref_path, Glib::ustring const &value)
Set an UTF-8 string value.
The set of selected SPObjects for a given document and layer model.
sigc::connection connectChanged(sigc::slot< void(Selection *)> slot)
Connects a slot to be notified of selection changes.
Interface for refcounted XML nodes.
virtual char const * attribute(char const *key) const =0
Get the string representation of a node's attribute.
virtual void addObserver(NodeObserver &observer)=0
Add an object that will be notified of the changes to this node.
virtual void removeObserver(NodeObserver &observer)=0
Remove an object from the list of observers.
double get_infinite_angle(Proj::Axis axis) const
std::unique_ptr< Persp3DImpl > perspective_impl
static bool VP_is_finite(Persp3DImpl *persp_impl, Proj::Axis axis)
To do: update description of desktop.
SPDocument * getDocument() const
Inkscape::Selection * getSelection() const
void setCurrentPersp3D(Persp3D *const persp)
Editable view implementation.
TODO: insert short description here.
constexpr Coord infinity()
Get a value representing infinity.
Macro for icon names used in Inkscape.
static R & anchor(R &r)
Increments the reference count of a anchored object.
static R & release(R &r)
Decrements the reference count of a anchored object.
W & get_widget(const Glib::RefPtr< Gtk::Builder > &builder, const char *id)
W & get_derived_widget(const Glib::RefPtr< Gtk::Builder > &builder, const char *id, Args &&... args)
Glib::RefPtr< Gtk::Builder > create_builder(const char *filename)
Glib::RefPtr< Gtk::Builder > builder