~engelmarkus/inkscape/cppify

« back to all changes in this revision

Viewing changes to src/widgets/rect-toolbar.cpp

  • Committer: Markus Engel
  • Date: 2013-09-24 22:17:24 UTC
  • mfrom: (11608.7.303 inkscape)
  • Revision ID: markus.engel@tum.de-20130924221724-mts1vaw7r25jqana
Merged from trunk (r12588).

Show diffs side-by-side

added added

removed removed

Lines of Context:
114
114
    for (GSList const *items = selection->itemList(); items != NULL; items = items->next) {
115
115
        if (SP_IS_RECT(items->data)) {
116
116
            if (gtk_adjustment_get_value(adj) != 0) {
117
 
                (SP_RECT(items->data)->*setter)(Quantity::convert(gtk_adjustment_get_value(adj), unit, "px"));
 
117
                (SP_RECT(items->data)->*setter)(Quantity::convert(gtk_adjustment_get_value(adj), unit, *sp_desktop_namedview(desktop)->doc_units));
118
118
            } else {
119
119
                SP_OBJECT(items->data)->getRepr()->setAttribute(value_name, NULL);
120
120
            }
186
186
 
187
187
    UnitTracker* tracker = reinterpret_cast<UnitTracker*>( g_object_get_data( tbl, "tracker" ) );
188
188
    Unit const unit = tracker->getActiveUnit();
 
189
    Unit const doc_unit = *sp_desktop_namedview(SP_ACTIVE_DESKTOP)->doc_units;
189
190
 
190
191
    gpointer item = g_object_get_data( tbl, "item" );
191
192
    if (item && SP_IS_RECT(item)) {
193
194
            GtkAdjustment *adj = GTK_ADJUSTMENT( g_object_get_data( tbl, "rx" ) );
194
195
 
195
196
            gdouble rx = SP_RECT(item)->getVisibleRx();
196
 
            gtk_adjustment_set_value(adj, Quantity::convert(rx, "px", unit));
 
197
            gtk_adjustment_set_value(adj, Quantity::convert(rx, doc_unit, unit));
197
198
        }
198
199
 
199
200
        {
200
201
            GtkAdjustment *adj = GTK_ADJUSTMENT( g_object_get_data( tbl, "ry" ) );
201
202
 
202
203
            gdouble ry = SP_RECT(item)->getVisibleRy();
203
 
            gtk_adjustment_set_value(adj, Quantity::convert(ry, "px", unit));
 
204
            gtk_adjustment_set_value(adj, Quantity::convert(ry, doc_unit, unit));
204
205
        }
205
206
 
206
207
        {
207
208
            GtkAdjustment *adj = GTK_ADJUSTMENT( g_object_get_data( tbl, "width" ) );
208
209
 
209
210
            gdouble width = SP_RECT(item)->getVisibleWidth();
210
 
            gtk_adjustment_set_value(adj, Quantity::convert(width, "px", unit));
 
211
            gtk_adjustment_set_value(adj, Quantity::convert(width, doc_unit, unit));
211
212
        }
212
213
 
213
214
        {
214
215
            GtkAdjustment *adj = GTK_ADJUSTMENT( g_object_get_data( tbl, "height" ) );
215
216
 
216
217
            gdouble height = SP_RECT(item)->getVisibleHeight();
217
 
            gtk_adjustment_set_value(adj, Quantity::convert(height, "px", unit));
 
218
            gtk_adjustment_set_value(adj, Quantity::convert(height, doc_unit, unit));
218
219
        }
219
220
    }
220
221
 
322
323
                                         GTK_WIDGET(desktop->canvas), holder, TRUE, "altx-rect",
323
324
                                         0, 1e6, SPIN_STEP, SPIN_PAGE_STEP,
324
325
                                         labels, values, G_N_ELEMENTS(labels),
325
 
                                         sp_rtb_width_value_changed );
 
326
                                         sp_rtb_width_value_changed, tracker);
326
327
        tracker->addAdjustment( ege_adjustment_action_get_adjustment(eact) );
327
328
        g_object_set_data( holder, "width_action", eact );
328
329
        gtk_action_set_sensitive( GTK_ACTION(eact), FALSE );
339
340
                                         GTK_WIDGET(desktop->canvas), holder, FALSE, NULL,
340
341
                                         0, 1e6, SPIN_STEP, SPIN_PAGE_STEP,
341
342
                                         labels, values, G_N_ELEMENTS(labels),
342
 
                                         sp_rtb_height_value_changed );
 
343
                                         sp_rtb_height_value_changed, tracker);
343
344
        tracker->addAdjustment( ege_adjustment_action_get_adjustment(eact) );
344
345
        g_object_set_data( holder, "height_action", eact );
345
346
        gtk_action_set_sensitive( GTK_ACTION(eact), FALSE );
356
357
                                         GTK_WIDGET(desktop->canvas), holder, FALSE, NULL,
357
358
                                         0, 1e6, SPIN_STEP, SPIN_PAGE_STEP,
358
359
                                         labels, values, G_N_ELEMENTS(labels),
359
 
                                         sp_rtb_rx_value_changed);
 
360
                                         sp_rtb_rx_value_changed, tracker);
360
361
        tracker->addAdjustment( ege_adjustment_action_get_adjustment(eact) );
361
362
        gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
362
363
    }
371
372
                                         GTK_WIDGET(desktop->canvas), holder, FALSE, NULL,
372
373
                                         0, 1e6, SPIN_STEP, SPIN_PAGE_STEP,
373
374
                                         labels, values, G_N_ELEMENTS(labels),
374
 
                                         sp_rtb_ry_value_changed);
 
375
                                         sp_rtb_ry_value_changed, tracker);
375
376
        tracker->addAdjustment( ege_adjustment_action_get_adjustment(eact) );
376
377
        gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
377
378
    }