index b10f952da5848d9a9dc3e578c274eb14fd7a41fe..f9bde3c0b18bf5cabd4aa5f9fe6e26ee489f0a75 100644 (file)
using NR::X;
using NR::Y;
- NR::Maybe<NR::Rect> a = first->getBounds(sp_item_i2doc_affine(first));
- NR::Maybe<NR::Rect> b = second->getBounds(sp_item_i2doc_affine(second));
+ boost::optional<NR::Rect> a = first->getBounds(from_2geom(sp_item_i2doc_affine(first)));
+ boost::optional<NR::Rect> b = second->getBounds(from_2geom(sp_item_i2doc_affine(second)));
if ( !a || !b ) {
// FIXME?
int
sp_compare_y_position(SPItem *first, SPItem *second)
{
- NR::Maybe<NR::Rect> a = first->getBounds(sp_item_i2doc_affine(first));
- NR::Maybe<NR::Rect> b = second->getBounds(sp_item_i2doc_affine(second));
+ boost::optional<NR::Rect> a = first->getBounds(from_2geom(sp_item_i2doc_affine(first)));
+ boost::optional<NR::Rect> b = second->getBounds(from_2geom(sp_item_i2doc_affine(second)));
if ( !a || !b ) {
// FIXME?
grid_left = 99999;
grid_top = 99999;
- SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+ SPDesktop *desktop = getDesktop();
sp_document_ensure_up_to_date(sp_desktop_document(desktop));
Inkscape::Selection *selection = sp_desktop_selection (desktop);
cnt=0;
for (; items != NULL; items = items->next) {
SPItem *item = SP_ITEM(items->data);
- NR::Maybe<NR::Rect> b = item->getBounds(sp_item_i2doc_affine(item));
+ boost::optional<NR::Rect> b = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
if (!b) {
continue;
}
const GSList *sizes = sorted;
for (; sizes != NULL; sizes = sizes->next) {
SPItem *item = SP_ITEM(sizes->data);
- NR::Maybe<NR::Rect> b = item->getBounds(sp_item_i2doc_affine(item));
+ boost::optional<NR::Rect> b = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
if (b) {
width = b->dimensions()[NR::X];
height = b->dimensions()[NR::Y];
}
+ boost::optional<NR::Rect> sel_bbox = selection->bounds();
// Fit to bbox, calculate padding between rows accordingly.
- if (!SpaceManualRadioButton.get_active()){
- NR::Rect b = selection->bounds();
+ if ( sel_bbox && !SpaceManualRadioButton.get_active() ){
#ifdef DEBUG_GRID_ARRANGE
g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_height,total_col_width, b.extent(NR::X), b.extent(NR::Y));
#endif
- paddingx = (b.extent(NR::X) - total_col_width) / (NoOfCols -1);
- paddingy = (b.extent(NR::Y) - total_row_height) / (NoOfRows -1);
+ paddingx = (sel_bbox->extent(NR::X) - total_col_width) / (NoOfCols -1);
+ paddingy = (sel_bbox->extent(NR::Y) - total_row_height) / (NoOfRows -1);
}
/*
for (; current_row != NULL; current_row = current_row->next) {
SPItem *item=SP_ITEM(current_row->data);
Inkscape::XML::Node *repr = SP_OBJECT_REPR(item);
- NR::Maybe<NR::Rect> b = item->getBounds(sp_item_i2doc_affine(item));
+ boost::optional<NR::Rect> b = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
NR::Point min;
if (b) {
width = b->dimensions()[NR::X];
// signs are inverted between x and y due to y inversion
NR::Point move = NR::Point(new_x - min[NR::X], min[NR::Y] - new_y);
NR::Matrix const &affine = NR::Matrix(NR::translate(move));
- sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * affine);
+ sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(affine));
sp_item_write_transform(item, repr, item->transform, NULL);
- SP_OBJECT (current_row->data)->updateRepr(repr, SP_OBJECT_WRITE_EXT);
+ SP_OBJECT (current_row->data)->updateRepr();
cnt +=1;
}
g_slist_free (current_row);
// in turn, prevent listener from responding
updating = true;
- SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+ SPDesktop *desktop = getDesktop();
Inkscape::Selection *selection = sp_desktop_selection (desktop);
// in turn, prevent listener from responding
updating = true;
- SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+ SPDesktop *desktop = getDesktop();
Inkscape::Selection *selection = sp_desktop_selection (desktop);
GSList const *items = selection->itemList();
row_height=0;
// in turn, prevent listener from responding
updating = true;
- SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+ SPDesktop *desktop = getDesktop();
Inkscape::Selection *selection = sp_desktop_selection (desktop);
const GSList *items = selection->itemList();
int selcount = g_slist_length((GSList *)items);
-
-
/*##########################
## Experimental
##########################*/
-static void updateSelectionCallback(Inkscape::Application *inkscape, Inkscape::Selection *selection, TileDialog *dlg)
+static void updateSelectionCallback(Inkscape::Application */*inkscape*/, Inkscape::Selection */*selection*/, TileDialog *dlg)
{
TileDialog *tledlg = (TileDialog *) dlg;
tledlg->updateSelection();
@@ -613,7 +611,7 @@ static void updateSelectionCallback(Inkscape::Application *inkscape, Inkscape::S
* Constructor
*/
TileDialog::TileDialog()
- : Dialog ("dialogs.gridtiler", SP_VERB_SELECTION_GRIDTILE)
+ : UI::Widget::Panel("", "dialogs.gridtiler", SP_VERB_SELECTION_GRIDTILE)
{
// bool used by spin button callbacks to stop loops where they change each other.
updating = false;
g_signal_connect ( G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (updateSelectionCallback), this);
}
- Gtk::VBox *mainVBox = get_vbox();
+ Gtk::Box *contents = _getContents();
#define MARGIN 2
//##Set up the panel
- SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+ SPDesktop *desktop = getDesktop();
Inkscape::Selection *selection = sp_desktop_selection (desktop);
int selcount = 1;
TileBox.pack_start(SizesHBox, false, false, MARGIN);
- mainVBox->pack_start(TileBox);
+ contents->pack_start(TileBox);
double SpacingType = prefs_get_double_attribute ("dialogs.gridtiler", "SpacingType", 15);
if (SpacingType>0) {
SizesHBox.set_sensitive (ManualSpacing);
//## The OK button
- TileOkButton = add_button(Gtk::Stock::APPLY, GTK_RESPONSE_APPLY);
+ TileOkButton = addResponseButton(_("Arrange"), GTK_RESPONSE_APPLY);
tips.set_tip((*TileOkButton), _("Arrange selected objects"));
show_all_children();