87
87
} ui_drop_target_info;
89
//TODO: warning: deprecated conversion from string constant to ‘gchar*’
91
//Turn out to be warnings that we should probably leave in place. The
92
// pointers/types used need to be read-only. So until we correct the using
93
// code, those warnings are actually desired. They say "Hey! Fix this". We
94
// definitely don't want to hide/ignore them. --JonCruz
89
95
static GtkTargetEntry ui_drop_target_entries [] = {
90
96
{"application/x-color", 0, APP_X_COLOR}
97
103
static Dialog::FillAndStroke *get_fill_and_stroke_panel(SPDesktop *desktop);
99
105
SelectedStyle::SelectedStyle(bool /*layout*/)
107
current_stroke_width(0),
103
112
_fill_label (_("Fill:")),
104
113
_stroke_label (_("Stroke:")),
105
114
_opacity_label (_("O:")),
107
_fill_place (SS_FILL),
108
_stroke_place (SS_STROKE),
116
_fill_place(this, SS_FILL),
117
_stroke_place(this, SS_STROKE),
110
119
_fill_flag_place (),
111
120
_stroke_flag_place (),
1254
1270
diff = color_adjust(hsl, by, cc, modifier);
1257
if (modifier == 3) { // do nothing
1273
if (modifier == 3) { // Alt, do nothing
1259
1275
} else if (modifier == 2) { // saturation
1260
1276
sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
1320
1336
startcolor_set = false;
1339
/* ============================================= RotateableStrokeWidth */
1341
RotateableStrokeWidth::RotateableStrokeWidth(SelectedStyle *parent) :
1344
startvalue_set(false),
1351
RotateableStrokeWidth::~RotateableStrokeWidth() {
1355
RotateableStrokeWidth::value_adjust(double current, double by, guint /*modifier*/, bool final)
1360
// map negative 0..-1 to current..0
1361
newval = current * (1 + by);
1363
// map positive 0..1 to current..4*current
1364
newval = current * (1 + by) * (1 + by);
1367
SPCSSAttr *css = sp_repr_css_attr_new ();
1368
if (final && newval < 1e-6) {
1369
// if dragged into zero and this is the final adjust on mouse release, delete stroke;
1370
// if it's not final, leave it a chance to increase again (which is not possible with "none")
1371
sp_repr_css_set_property (css, "stroke", "none");
1373
Inkscape::CSSOStringStream os;
1375
sp_repr_css_set_property (css, "stroke-width", os.str().c_str());
1378
sp_desktop_set_style (parent->getDesktop(), css);
1379
sp_repr_css_attr_unref (css);
1380
return newval - current;
1384
RotateableStrokeWidth::do_motion(double by, guint modifier) {
1386
// if this is the first motion after a mouse grab, remember the current width
1387
if (!startvalue_set) {
1388
startvalue = parent->current_stroke_width;
1389
// if it's 0, adjusting (which uses multiplication) will not be able to change it, so we
1390
// cheat and provide a non-zero value
1391
if (startvalue == 0)
1393
startvalue_set = true;
1396
if (modifier == 3) { // Alt, do nothing
1398
double diff = value_adjust(startvalue, by, modifier, false);
1399
sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
1400
SP_VERB_DIALOG_FILL_STROKE, (_("Adjust stroke width")));
1401
parent->getDesktop()->event_context->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Adjusting <b>stroke width</b>: was %.3g, now <b>%.3g</b> (diff %.3g)"), startvalue, startvalue + diff, diff);
1406
RotateableStrokeWidth::do_release(double by, guint modifier) {
1408
if (modifier == 3) { // do nothing
1411
value_adjust(startvalue, by, modifier, true);
1412
startvalue_set = false;
1413
sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
1414
SP_VERB_DIALOG_FILL_STROKE, (_("Adjust stroke width")));
1417
if (!strcmp(undokey, "swrot1")) {
1422
parent->getDesktop()->event_context->_message_context->clear();
1323
1426
Dialog::FillAndStroke *get_fill_and_stroke_panel(SPDesktop *desktop)
1325
1428
if (Dialog::PanelDialogBase *panel_dialog =