guides.cpp revision a02211fee45e7402a822d3f81bc0ed49233718e5
/** @file
* @brief Simple guideline dialog
*/
/* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Andrius R. <knutux@gmail.com>
* Johan Engelen
*
* Copyright (C) 1999-2007 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "display/guideline.h"
#include "helper/unit-menu.h"
#include "desktop.h"
#include "document.h"
#include "sp-guide.h"
#include "sp-namedview.h"
#include "desktop-handles.h"
#include "event-context.h"
#include "widgets/desktop-widget.h"
#include "sp-metrics.h"
#include "dialogs/dialog-events.h"
#include "message-context.h"
#include "guides.h"
namespace Inkscape {
namespace UI {
namespace Dialogs {
_label_units(_("Unit:")),
_label_X(_("X:")),
_label_Y(_("Y:")),
_label_degrees(_("Angle (degrees):")),
_relative_toggle(_("Rela_tive change"), _("Move and/or rotate the guide relative to current settings")),
{
}
}
}
{
if (!_mode) {
// relative
_spin_angle.set_value(0);
} else {
// absolute
}
}
void GuidelinePropertiesDialog::_onApply()
{
if (!_mode)
} else {
}
if (!_mode)
_("Set guide properties"));
}
void GuidelinePropertiesDialog::_onOK()
{
_onApply();
}
void GuidelinePropertiesDialog::_onDelete()
{
_("Delete guide"));
}
{
switch (response) {
case Gtk::RESPONSE_OK:
_onOK();
break;
case -12:
_onDelete();
break;
case Gtk::RESPONSE_CANCEL:
break;
case Gtk::RESPONSE_DELETE_EVENT:
break;
/* case GTK_RESPONSE_APPLY:
_onApply();
break;
*/
default:
}
}
void GuidelinePropertiesDialog::_setup() {
set_title(_("Guideline"));
// indent
// mode radio button
_relative_toggle.signal_toggled().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_modeChanged));
// unitmenu
/* fixme: We should allow percents here too, as percents of the canvas size */
// position spinbuttons
sp_unit_selector_add_adjustment(SP_UNIT_SELECTOR(unit_selector), GTK_ADJUSTMENT(_adjustment_x.gobj()));
sp_unit_selector_add_adjustment(SP_UNIT_SELECTOR(unit_selector), GTK_ADJUSTMENT(_adjustment_y.gobj()));
gobj());
// angle spinbutton
_spin_angle.show();
// dialog
// initialize dialog
if (_guide->is_vertical()) {
_oldangle = 90;
} else if (_guide->is_horizontal()) {
_oldangle = 0;
} else {
_oldangle = Geom::rad_to_deg( std::atan2( - _guide->normal_to_line[Geom::X], _guide->normal_to_line[Geom::Y] ) );
}
{
}
{
}
_modeChanged(); // sets values of spinboxes.
} else {
}
set_modal(true);
property_destroy_with_parent() = 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:encoding=utf-8:textwidth=99 :