guides.cpp revision 78c4de54589e2eb180c5d05ee781b2337ac1df6c
/** @file
* @brief Simple guideline dialog
*/
/* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Andrius R. <knutux@gmail.com>
* Johan Engelen
* Abhishek Sharma
*
* 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 "guides.h"
#include "display/guideline.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 "dialogs/dialog-events.h"
#include "message-context.h"
namespace Inkscape {
namespace UI {
namespace Dialogs {
_relative_toggle(_("Rela_tive change"), _("Move and/or rotate the guide relative to current settings")),
{
}
bool GuidelinePropertiesDialog::_relative_toggle_status = false; // initialize relative checkbox status for when this dialog is opened for first time
Glib::ustring GuidelinePropertiesDialog::_angle_unit_status = "deg"; // initialize angle unit status
// save current status
}
}
{
//TODO: why 257? verify this!
sp_guide_set_color(*_guide, r, g, b, true);
}
{
if (!_mode) {
// relative
_spin_angle.setValue(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
// _layout_table.attach(*manage(new Gtk::Label(" ")),
// 0, 1, 2, 3, Gtk::FILL, Gtk::FILL, 10);
// unitmenus
/* fixme: We should allow percents here too, as percents of the canvas size */
}
// position spinbuttons
// angle spinbutton
// mode radio button
_relative_toggle.signal_toggled().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_modeChanged));
// don't know what this exactly does, but it results in that the dialog closes when entering a value and pressing enter (see LP bug 484187)
// dialog
// initialize dialog
if (_guide->isVertical()) {
_oldangle = 90;
} else if (_guide->isHorizontal()) {
_oldangle = 0;
} else {
_oldangle = Geom::rad_to_deg( std::atan2( - _guide->normal_to_line[Geom::X], _guide->normal_to_line[Geom::Y] ) );
}
{
}
{
}
// init name entry
c.set_rgb_p(((_guide->color>>24)&0xff) / 255.0, ((_guide->color>>16)&0xff) / 255.0, ((_guide->color>>8)&0xff) / 255.0);
_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:fileencoding=utf-8:textwidth=99 :