From 6b958fd1779e1882dbd91f714719cfae08752f67 Mon Sep 17 00:00:00 2001 From: Denis Declara Date: Mon, 26 Mar 2012 17:30:27 +0200 Subject: Added anchor-selection widget, it doesn't do much at the moment, next step will be to wire everything together, btw, you can see the widget in the 'rows and columns' panel (bzr r11073.1.3) --- src/ui/dialog/tile.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ui/dialog/tile.cpp') diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index 77dae056f..5ce41c716 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -796,6 +796,7 @@ TileDialog::TileDialog() SpinsHBox.pack_start(NoOfColsBox, false, false, MARGIN); TileBox.pack_start(SpinsHBox, false, false, MARGIN); + TileBox.pack_start(anchorSelector); { /*#### Radio buttons to control spacing manually or to fit selection bbox ####*/ -- cgit v1.2.3 From 3f7eff8696693c9b946fe47c2831c8706bffb68d Mon Sep 17 00:00:00 2001 From: Denis Declara Date: Wed, 28 Mar 2012 17:44:47 +0200 Subject: Integrated the newly created Anchor-Selection-Widget with the existing "Rows and Columns" panel. Code still needs documentation and cleenup however. (bzr r11073.1.5) --- src/ui/dialog/tile.cpp | 56 +++++++++++++++++--------------------------------- 1 file changed, 19 insertions(+), 37 deletions(-) (limited to 'src/ui/dialog/tile.cpp') diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index 5ce41c716..4a5e9785f 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -517,39 +517,15 @@ void TileDialog::Spacing_button_changed() } /** - * changed Radio button in Vertical Align group. + * changed Anchor selection widget. */ -void TileDialog::VertAlign_changed() +void TileDialog::Align_changed() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if (VertTopRadioButton.get_active()) { - VertAlign = 0; - prefs->setInt("/dialogs/gridtiler/VertAlign", 0); - } else if (VertCentreRadioButton.get_active()){ - VertAlign = 1; - prefs->setInt("/dialogs/gridtiler/VertAlign", 1); - } else if (VertBotRadioButton.get_active()){ - VertAlign = 2; - prefs->setInt("/dialogs/gridtiler/VertAlign", 2); - } -} - -/** - * changed Radio button in Vertical Align group. - */ -void TileDialog::HorizAlign_changed() -{ - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if (HorizLeftRadioButton.get_active()) { - HorizAlign = 0; - prefs->setInt("/dialogs/gridtiler/HorizAlign", 0); - } else if (HorizCentreRadioButton.get_active()){ - HorizAlign = 1; - prefs->setInt("/dialogs/gridtiler/HorizAlign", 1); - } else if (HorizRightRadioButton.get_active()){ - HorizAlign = 2; - prefs->setInt("/dialogs/gridtiler/HorizAlign", 2); - } + VertAlign = AlignmentSelector.getVerticalAlignment(); + prefs->setInt("/dialogs/gridtiler/VertAlign", VertAlign); + HorizAlign = AlignmentSelector.getHorizontalAlignment(); + prefs->setInt("/dialogs/gridtiler/HorizAlign", HorizAlign); } /** @@ -685,8 +661,8 @@ TileDialog::TileDialog() RowHeightButton.set_tooltip_text(_("If not set, each row has the height of the tallest object in it")); RowHeightButton.signal_toggled().connect(sigc::mem_fun(*this, &TileDialog::on_RowSize_checkbutton_changed)); - { - /*#### Radio buttons to control vertical alignment ####*/ +/* { + /*#### Radio buttons to control vertical alignment ####*//* VertAlignLabel.set_label(_("Align:")); VertAlignHBox.pack_start(VertAlignLabel, false, false, MARGIN); @@ -715,7 +691,7 @@ TileDialog::TileDialog() } VertAlignHBox.pack_start(VertAlignVBox, false, false, MARGIN); NoOfRowsBox.pack_start(VertAlignHBox, false, false, MARGIN); - } + }*/ SpinsHBox.pack_start(NoOfRowsBox, false, false, MARGIN); @@ -757,8 +733,8 @@ TileDialog::TileDialog() ColumnWidthButton.signal_toggled().connect(sigc::mem_fun(*this, &TileDialog::on_ColSize_checkbutton_changed)); - { - /*#### Radio buttons to control horizontal alignment ####*/ + /*{ + /*#### Radio buttons to control horizontal alignment ####*//* HorizAlignLabel.set_label(_("Align:")); HorizAlignVBox.pack_start(HorizAlignLabel, false, false, MARGIN); @@ -791,12 +767,18 @@ TileDialog::TileDialog() } HorizAlignVBox.pack_start(HorizAlignHBox, false, false, MARGIN); NoOfColsBox.pack_start(HorizAlignVBox, false, false, MARGIN); - } + }*/ SpinsHBox.pack_start(NoOfColsBox, false, false, MARGIN); TileBox.pack_start(SpinsHBox, false, false, MARGIN); - TileBox.pack_start(anchorSelector); + + + // Anchor selection widget + AlignLabel.set_label("Alignment:"); + AlignmentSelector.on_selectionChanged().connect(sigc::mem_fun(*this, &TileDialog::Align_changed)); + TileBox.pack_start(AlignLabel, false, false, MARGIN); + TileBox.pack_start(AlignmentSelector, true, false, MARGIN); { /*#### Radio buttons to control spacing manually or to fit selection bbox ####*/ -- cgit v1.2.3 From f31125febfcaf661ffb7227081b72da399440730 Mon Sep 17 00:00:00 2001 From: Denis Declara Date: Thu, 29 Mar 2012 18:31:07 +0200 Subject: Removed some commented code, which i replaced, and is therefore no longer used. (bzr r11073.1.7) --- src/ui/dialog/tile.cpp | 69 -------------------------------------------------- 1 file changed, 69 deletions(-) (limited to 'src/ui/dialog/tile.cpp') diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index 4a5e9785f..4c83c7be0 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -661,38 +661,6 @@ TileDialog::TileDialog() RowHeightButton.set_tooltip_text(_("If not set, each row has the height of the tallest object in it")); RowHeightButton.signal_toggled().connect(sigc::mem_fun(*this, &TileDialog::on_RowSize_checkbutton_changed)); -/* { - /*#### Radio buttons to control vertical alignment ####*//* - - VertAlignLabel.set_label(_("Align:")); - VertAlignHBox.pack_start(VertAlignLabel, false, false, MARGIN); - - VertTopRadioButton.signal_toggled().connect(sigc::mem_fun(*this, &TileDialog::VertAlign_changed)); - VertAlignGroup = VertTopRadioButton.get_group(); - VertAlignVBox.pack_start(VertTopRadioButton, false, false, 0); - - VertCentreRadioButton.set_group(VertAlignGroup); - VertCentreRadioButton.signal_toggled().connect(sigc::mem_fun(*this, &TileDialog::VertAlign_changed)); - VertAlignVBox.pack_start(VertCentreRadioButton, false, false, 0); - - VertBotRadioButton.set_group(VertAlignGroup); - VertBotRadioButton.signal_toggled().connect(sigc::mem_fun(*this, &TileDialog::VertAlign_changed)); - VertAlignVBox.pack_start(VertBotRadioButton, false, false, 0); - - VertAlign = prefs->getInt("/dialogs/gridtiler/VertAlign", 1); - if (VertAlign == 0) { - VertTopRadioButton.set_active(TRUE); - } - else if (VertAlign == 1) { - VertCentreRadioButton.set_active(TRUE); - } - else if (VertAlign == 2){ - VertBotRadioButton.set_active(TRUE); - } - VertAlignHBox.pack_start(VertAlignVBox, false, false, MARGIN); - NoOfRowsBox.pack_start(VertAlignHBox, false, false, MARGIN); - }*/ - SpinsHBox.pack_start(NoOfRowsBox, false, false, MARGIN); @@ -732,43 +700,6 @@ TileDialog::TileDialog() ColumnWidthButton.set_tooltip_text(_("If not set, each column has the width of the widest object in it")); ColumnWidthButton.signal_toggled().connect(sigc::mem_fun(*this, &TileDialog::on_ColSize_checkbutton_changed)); - - /*{ - /*#### Radio buttons to control horizontal alignment ####*//* - - HorizAlignLabel.set_label(_("Align:")); - HorizAlignVBox.pack_start(HorizAlignLabel, false, false, MARGIN); - - HorizAlignHBox.pack_start(*(new Gtk::HBox()), true, true, 0); // centering strut - - HorizLeftRadioButton.signal_toggled().connect(sigc::mem_fun(*this, &TileDialog::HorizAlign_changed)); - HorizAlignGroup = HorizLeftRadioButton.get_group(); - HorizAlignHBox.pack_start(HorizLeftRadioButton, false, false, 0); - - HorizCentreRadioButton.set_group(HorizAlignGroup); - HorizCentreRadioButton.signal_toggled().connect(sigc::mem_fun(*this, &TileDialog::HorizAlign_changed)); - HorizAlignHBox.pack_start(HorizCentreRadioButton, false, false, 0); - - HorizRightRadioButton.set_group(HorizAlignGroup); - HorizRightRadioButton.signal_toggled().connect(sigc::mem_fun(*this, &TileDialog::HorizAlign_changed)); - HorizAlignHBox.pack_start(HorizRightRadioButton, false, false, 0); - - HorizAlignHBox.pack_start(*(new Gtk::HBox()), true, true, 0); // centering strut - - HorizAlign = prefs->getInt("/dialogs/gridtiler/HorizAlign", 1); - if (HorizAlign == 0) { - HorizLeftRadioButton.set_active(TRUE); - } - else if (HorizAlign == 1) { - HorizCentreRadioButton.set_active(TRUE); - } - else if (HorizAlign == 2) { - HorizRightRadioButton.set_active(TRUE); - } - HorizAlignVBox.pack_start(HorizAlignHBox, false, false, MARGIN); - NoOfColsBox.pack_start(HorizAlignVBox, false, false, MARGIN); - }*/ - SpinsHBox.pack_start(NoOfColsBox, false, false, MARGIN); TileBox.pack_start(SpinsHBox, false, false, MARGIN); -- cgit v1.2.3 From dc6fcf4ec96d4f4345ad86b1940d4b31d6771a0f Mon Sep 17 00:00:00 2001 From: Denis Declara Date: Sat, 31 Mar 2012 15:20:19 +0200 Subject: Brought old code, "Rows and Columns" in it's own class. Added a separate class for the panel. Still some cleanup to do. (bzr r11073.1.8) --- src/ui/dialog/tile.cpp | 98 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 63 insertions(+), 35 deletions(-) (limited to 'src/ui/dialog/tile.cpp') diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index 4c83c7be0..9297b5154 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -109,6 +109,34 @@ namespace Inkscape { namespace UI { namespace Dialog { +ArrangeDialog::ArrangeDialog() + : UI::Widget::Panel("", "/dialogs/gridtiler", SP_VERB_SELECTION_GRIDTILE), + _gridArrangeTab(new GridArrangeTab(this)) +{ + Gtk::Box *contents = this->_getContents(); + + _notebook.append_page(*_gridArrangeTab, C_("Arrange dialog", "Rectangular grid")); + _arrangeBox.pack_start(_notebook); + + _arrangeButton = this->addResponseButton(C_("Arrange dialog","_Arrange"), GTK_RESPONSE_APPLY); + _arrangeButton->set_use_underline(true); + _arrangeButton->set_tooltip_text(_("Arrange selected objects")); + _arrangeBox.pack_start(*_arrangeButton); + contents->pack_start(_arrangeBox); + show_all_children(); +} + +void ArrangeDialog::_apply() +{ + switch(_notebook.get_current_page()) + { + case 0: + _gridArrangeTab->arrange(); + break; + } +} + + //######################################################################### //## E V E N T S @@ -120,7 +148,7 @@ namespace Dialog { * */ -void TileDialog::Grid_Arrange () +void GridArrangeTab::arrange() { int cnt,row_cnt,col_cnt,a,row,col; @@ -159,7 +187,7 @@ void TileDialog::Grid_Arrange () grid_left = 99999; grid_top = 99999; - SPDesktop *desktop = getDesktop(); + SPDesktop *desktop = Parent->getDesktop(); sp_desktop_document(desktop)->ensureUpToDate(); Inkscape::Selection *selection = sp_desktop_selection (desktop); @@ -356,16 +384,16 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h //######################################################################### -void TileDialog::_apply() +void GridArrangeTab::_apply() { - Grid_Arrange(); + arrange(); } /** * changed value in # of columns spinbox. */ -void TileDialog::on_row_spinbutton_changed() +void GridArrangeTab::on_row_spinbutton_changed() { // quit if run by the attr_changed listener if (updating) { @@ -374,7 +402,7 @@ void TileDialog::on_row_spinbutton_changed() // in turn, prevent listener from responding updating = true; - SPDesktop *desktop = getDesktop(); + SPDesktop *desktop = Parent->getDesktop(); Inkscape::Selection *selection = desktop ? desktop->selection : 0; g_return_if_fail( selection ); @@ -392,7 +420,7 @@ void TileDialog::on_row_spinbutton_changed() /** * changed value in # of rows spinbox. */ -void TileDialog::on_col_spinbutton_changed() +void GridArrangeTab::on_col_spinbutton_changed() { // quit if run by the attr_changed listener if (updating) { @@ -401,7 +429,7 @@ void TileDialog::on_col_spinbutton_changed() // in turn, prevent listener from responding updating = true; - SPDesktop *desktop = getDesktop(); + SPDesktop *desktop = Parent->getDesktop(); Inkscape::Selection *selection = desktop ? desktop->selection : 0; g_return_if_fail(selection); @@ -419,7 +447,7 @@ void TileDialog::on_col_spinbutton_changed() /** * changed value in x padding spinbox. */ -void TileDialog::on_xpad_spinbutton_changed() +void GridArrangeTab::on_xpad_spinbutton_changed() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble("/dialogs/gridtiler/XPad", XPadding.getValue("px")); @@ -429,7 +457,7 @@ void TileDialog::on_xpad_spinbutton_changed() /** * changed value in y padding spinbox. */ -void TileDialog::on_ypad_spinbutton_changed() +void GridArrangeTab::on_ypad_spinbutton_changed() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble("/dialogs/gridtiler/YPad", YPadding.getValue("px")); @@ -439,7 +467,7 @@ void TileDialog::on_ypad_spinbutton_changed() /** * checked/unchecked autosize Rows button. */ -void TileDialog::on_RowSize_checkbutton_changed() +void GridArrangeTab::on_RowSize_checkbutton_changed() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (RowHeightButton.get_active()) { @@ -453,7 +481,7 @@ void TileDialog::on_RowSize_checkbutton_changed() /** * checked/unchecked autosize Rows button. */ -void TileDialog::on_ColSize_checkbutton_changed() +void GridArrangeTab::on_ColSize_checkbutton_changed() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (ColumnWidthButton.get_active()) { @@ -467,7 +495,7 @@ void TileDialog::on_ColSize_checkbutton_changed() /** * changed value in columns spinbox. */ -void TileDialog::on_rowSize_spinbutton_changed() +void GridArrangeTab::on_rowSize_spinbutton_changed() { // quit if run by the attr_changed listener if (updating) { @@ -485,7 +513,7 @@ void TileDialog::on_rowSize_spinbutton_changed() /** * changed value in rows spinbox. */ -void TileDialog::on_colSize_spinbutton_changed() +void GridArrangeTab::on_colSize_spinbutton_changed() { // quit if run by the attr_changed listener if (updating) { @@ -503,7 +531,7 @@ void TileDialog::on_colSize_spinbutton_changed() /** * changed Radio button in Spacing group. */ -void TileDialog::Spacing_button_changed() +void GridArrangeTab::Spacing_button_changed() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (SpaceManualRadioButton.get_active()) { @@ -519,7 +547,7 @@ void TileDialog::Spacing_button_changed() /** * changed Anchor selection widget. */ -void TileDialog::Align_changed() +void GridArrangeTab::Align_changed() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); VertAlign = AlignmentSelector.getVerticalAlignment(); @@ -531,7 +559,7 @@ void TileDialog::Align_changed() /** * Desktop selection changed */ -void TileDialog::updateSelection() +void GridArrangeTab::updateSelection() { // quit if run by the attr_changed listener if (updating) { @@ -541,7 +569,7 @@ void TileDialog::updateSelection() Inkscape::Preferences *prefs = Inkscape::Preferences::get(); // in turn, prevent listener from responding updating = true; - SPDesktop *desktop = getDesktop(); + SPDesktop *desktop = Parent->getDesktop(); Inkscape::Selection *selection = desktop ? desktop->selection : 0; GSList const *items = selection ? selection->itemList() : 0; @@ -577,7 +605,7 @@ void TileDialog::updateSelection() ## Experimental ##########################*/ -static void updateSelectionCallback(Inkscape::Application */*inkscape*/, Inkscape::Selection */*selection*/, TileDialog *dlg) +static void updateSelectionCallback(Inkscape::Application */*inkscape*/, Inkscape::Selection */*selection*/, GridArrangeTab *dlg) { dlg->updateSelection(); } @@ -589,8 +617,8 @@ static void updateSelectionCallback(Inkscape::Application */*inkscape*/, Inkscap /** * Constructor */ -TileDialog::TileDialog() - : UI::Widget::Panel("", "/dialogs/gridtiler", SP_VERB_SELECTION_GRIDTILE), +GridArrangeTab::GridArrangeTab(ArrangeDialog *parent) + : Parent(parent), XPadding(_("X:"), _("Horizontal spacing between columns."), UNIT_TYPE_LINEAR, "", "object-columns"), YPadding(_("Y:"), _("Vertical spacing between rows."), XPadding, "", "object-rows") { @@ -608,13 +636,13 @@ TileDialog::TileDialog() g_signal_connect ( G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (updateSelectionCallback), this); } - Gtk::Box *contents = _getContents(); + Gtk::Box *contents = this; #define MARGIN 2 //##Set up the panel - SPDesktop *desktop = getDesktop(); + SPDesktop *desktop = Parent->getDesktop(); Inkscape::Selection *selection = desktop ? desktop->selection : 0; g_return_if_fail( selection ); @@ -642,7 +670,7 @@ TileDialog::TileDialog() NoOfRowsSpinner.set_increments(1, 0); NoOfRowsSpinner.set_range(1.0, 10000.0); NoOfRowsSpinner.set_value(PerCol); - NoOfRowsSpinner.signal_changed().connect(sigc::mem_fun(*this, &TileDialog::on_col_spinbutton_changed)); + NoOfRowsSpinner.signal_changed().connect(sigc::mem_fun(*this, &GridArrangeTab::on_col_spinbutton_changed)); NoOfRowsSpinner.set_tooltip_text(_("Number of rows")); NoOfRowsBox.pack_start(NoOfRowsSpinner, false, false, MARGIN); gtk_size_group_add_widget(_col1, (GtkWidget *) NoOfRowsBox.gobj()); @@ -659,7 +687,7 @@ TileDialog::TileDialog() NoOfRowsBox.pack_start(RowHeightButton, false, false, MARGIN); RowHeightButton.set_tooltip_text(_("If not set, each row has the height of the tallest object in it")); - RowHeightButton.signal_toggled().connect(sigc::mem_fun(*this, &TileDialog::on_RowSize_checkbutton_changed)); + RowHeightButton.signal_toggled().connect(sigc::mem_fun(*this, &GridArrangeTab::on_RowSize_checkbutton_changed)); SpinsHBox.pack_start(NoOfRowsBox, false, false, MARGIN); @@ -682,7 +710,7 @@ TileDialog::TileDialog() NoOfColsSpinner.set_increments(1, 0); NoOfColsSpinner.set_range(1.0, 10000.0); NoOfColsSpinner.set_value(PerRow); - NoOfColsSpinner.signal_changed().connect(sigc::mem_fun(*this, &TileDialog::on_row_spinbutton_changed)); + NoOfColsSpinner.signal_changed().connect(sigc::mem_fun(*this, &GridArrangeTab::on_row_spinbutton_changed)); NoOfColsSpinner.set_tooltip_text(_("Number of columns")); NoOfColsBox.pack_start(NoOfColsSpinner, false, false, MARGIN); gtk_size_group_add_widget(_col3, (GtkWidget *) NoOfColsBox.gobj()); @@ -698,7 +726,7 @@ TileDialog::TileDialog() NoOfColsBox.pack_start(ColumnWidthButton, false, false, MARGIN); ColumnWidthButton.set_tooltip_text(_("If not set, each column has the width of the widest object in it")); - ColumnWidthButton.signal_toggled().connect(sigc::mem_fun(*this, &TileDialog::on_ColSize_checkbutton_changed)); + ColumnWidthButton.signal_toggled().connect(sigc::mem_fun(*this, &GridArrangeTab::on_ColSize_checkbutton_changed)); SpinsHBox.pack_start(NoOfColsBox, false, false, MARGIN); @@ -707,7 +735,7 @@ TileDialog::TileDialog() // Anchor selection widget AlignLabel.set_label("Alignment:"); - AlignmentSelector.on_selectionChanged().connect(sigc::mem_fun(*this, &TileDialog::Align_changed)); + AlignmentSelector.on_selectionChanged().connect(sigc::mem_fun(*this, &GridArrangeTab::Align_changed)); TileBox.pack_start(AlignLabel, false, false, MARGIN); TileBox.pack_start(AlignmentSelector, true, false, MARGIN); @@ -715,7 +743,7 @@ TileDialog::TileDialog() /*#### Radio buttons to control spacing manually or to fit selection bbox ####*/ SpaceByBBoxRadioButton.set_label(_("_Fit into selection box")); SpaceByBBoxRadioButton.set_use_underline (true); - SpaceByBBoxRadioButton.signal_toggled().connect(sigc::mem_fun(*this, &TileDialog::Spacing_button_changed)); + SpaceByBBoxRadioButton.signal_toggled().connect(sigc::mem_fun(*this, &GridArrangeTab::Spacing_button_changed)); SpacingGroup = SpaceByBBoxRadioButton.get_group(); SpacingVBox.pack_start(SpaceByBBoxRadioButton, false, false, MARGIN); @@ -723,7 +751,7 @@ TileDialog::TileDialog() SpaceManualRadioButton.set_label(_("_Set spacing:")); SpaceManualRadioButton.set_use_underline (true); SpaceManualRadioButton.set_group(SpacingGroup); - SpaceManualRadioButton.signal_toggled().connect(sigc::mem_fun(*this, &TileDialog::Spacing_button_changed)); + SpaceManualRadioButton.signal_toggled().connect(sigc::mem_fun(*this, &GridArrangeTab::Spacing_button_changed)); SpacingVBox.pack_start(SpaceManualRadioButton, false, false, MARGIN); TileBox.pack_start(SpacingVBox, false, false, MARGIN); @@ -737,7 +765,7 @@ TileDialog::TileDialog() YPadding.setRange(-10000, 10000); double yPad = prefs->getDouble("/dialogs/gridtiler/YPad", 15); YPadding.setValue(yPad, "px"); - YPadding.signal_value_changed().connect(sigc::mem_fun(*this, &TileDialog::on_ypad_spinbutton_changed)); + YPadding.signal_value_changed().connect(sigc::mem_fun(*this, &GridArrangeTab::on_ypad_spinbutton_changed)); XPadding.setDigits(5); XPadding.setIncrements(0.2, 0); @@ -745,7 +773,7 @@ TileDialog::TileDialog() double xPad = prefs->getDouble("/dialogs/gridtiler/XPad", 15); XPadding.setValue(xPad, "px"); - XPadding.signal_value_changed().connect(sigc::mem_fun(*this, &TileDialog::on_xpad_spinbutton_changed)); + XPadding.signal_value_changed().connect(sigc::mem_fun(*this, &GridArrangeTab::on_xpad_spinbutton_changed)); } TileBox.pack_start(XPadding, false, false, MARGIN); TileBox.pack_start(YPadding, false, false, MARGIN); @@ -763,10 +791,10 @@ TileDialog::TileDialog() XPadding.set_sensitive (ManualSpacing); YPadding.set_sensitive (ManualSpacing); - //## The OK button - TileOkButton = addResponseButton(C_("Rows and columns dialog","_Arrange"), GTK_RESPONSE_APPLY); + //## The OK button FIXME + /*TileOkButton = addResponseButton(C_("Rows and columns dialog","_Arrange"), GTK_RESPONSE_APPLY); TileOkButton->set_use_underline(true); - TileOkButton->set_tooltip_text(_("Arrange selected objects")); + TileOkButton->set_tooltip_text(_("Arrange selected objects"));*/ show_all_children(); } -- cgit v1.2.3 From 13a67ac44b1120308c2fc607715ddf0cf3d516e9 Mon Sep 17 00:00:00 2001 From: Denis Declara Date: Mon, 2 Apr 2012 12:08:22 +0200 Subject: Anchor widget now reads the last alignment from the settings. Anchor selection widget is also smaller now. (bzr r11073.1.10) --- src/ui/dialog/tile.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ui/dialog/tile.cpp') diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index 9297b5154..ab3781630 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -732,9 +732,13 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent) TileBox.pack_start(SpinsHBox, false, false, MARGIN); + VertAlign = prefs->getInt("/dialogs/gridtiler/VertAlign", 1); + HorizAlign = prefs->getInt("/dialogs/gridtiler/HorizAlign", 1); // Anchor selection widget AlignLabel.set_label("Alignment:"); + AlignLabel.set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER); + AlignmentSelector.setAlignment(HorizAlign, VertAlign); AlignmentSelector.on_selectionChanged().connect(sigc::mem_fun(*this, &GridArrangeTab::Align_changed)); TileBox.pack_start(AlignLabel, false, false, MARGIN); TileBox.pack_start(AlignmentSelector, true, false, MARGIN); -- cgit v1.2.3 From 591b007232d0806995bc24c7dd93babdec283834 Mon Sep 17 00:00:00 2001 From: Denis Declara Date: Wed, 4 Apr 2012 08:42:22 +0200 Subject: Changed enum used for alignment, which hopefully will fix daily deb builds. (bzr r11073.1.11) --- src/ui/dialog/tile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/dialog/tile.cpp') diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index ab3781630..2e5e3f822 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -737,7 +737,7 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent) // Anchor selection widget AlignLabel.set_label("Alignment:"); - AlignLabel.set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER); + AlignLabel.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_CENTER); AlignmentSelector.setAlignment(HorizAlign, VertAlign); AlignmentSelector.on_selectionChanged().connect(sigc::mem_fun(*this, &GridArrangeTab::Align_changed)); TileBox.pack_start(AlignLabel, false, false, MARGIN); -- cgit v1.2.3 From d35a809b15aa11aa5ee3c0a035710683e8c76eaa Mon Sep 17 00:00:00 2001 From: Denis Declara Date: Mon, 9 Apr 2012 22:12:58 +0200 Subject: Added initial gui for polar arrangement tab (bzr r11073.1.13) --- src/ui/dialog/tile.cpp | 53 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 8 deletions(-) (limited to 'src/ui/dialog/tile.cpp') diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index 2e5e3f822..0e3b24f7c 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -111,11 +111,13 @@ namespace Dialog { ArrangeDialog::ArrangeDialog() : UI::Widget::Panel("", "/dialogs/gridtiler", SP_VERB_SELECTION_GRIDTILE), - _gridArrangeTab(new GridArrangeTab(this)) + _gridArrangeTab(new GridArrangeTab(this)), + _polarArrangeTab(new PolarArrangeTab(this)) { Gtk::Box *contents = this->_getContents(); _notebook.append_page(*_gridArrangeTab, C_("Arrange dialog", "Rectangular grid")); + _notebook.append_page(*_polarArrangeTab, C_("Arrange dialog", "Polar Coordinates")); _arrangeBox.pack_start(_notebook); _arrangeButton = this->addResponseButton(C_("Arrange dialog","_Arrange"), GTK_RESPONSE_APPLY); @@ -133,9 +135,51 @@ void ArrangeDialog::_apply() case 0: _gridArrangeTab->arrange(); break; + case 1: + _polarArrangeTab->arrange(); + break; } } +PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) + : parent(parent_) +{ + anchorPointLabel.set_text("Anchor point:"); + anchorPointLabel.set_alignment(Gtk::ALIGN_START); + pack_start(anchorPointLabel, false, false); + + anchorBoundingBoxRadio.set_label("Object's bounding box:"); + anchorBoundingBoxRadio.set_group(anchorRadioGroup); + pack_start(anchorBoundingBoxRadio, false, false); + + pack_start(anchorSelector, false, false); + + anchorObjectPivotRadio.set_label("Object's rotational center"); + anchorObjectPivotRadio.set_group(anchorRadioGroup); + pack_start(anchorObjectPivotRadio, false, false); + + arrangeOnLabel.set_text("Arrange on:"); + arrangeOnLabel.set_alignment(Gtk::ALIGN_START); + pack_start(arrangeOnLabel, false, false); + + arrangeOnCircleRadio.set_label("Last selected circle/ellipse/arc"); + anchorObjectPivotRadio.set_group(arrangeRadioGroup); + pack_start(arrangeOnCircleRadio, false, false); + + arrangeOnParametersRadio.set_label("Parameterized:"); + anchorObjectPivotRadio.set_group(arrangeRadioGroup); + pack_start(arrangeOnParametersRadio, false, false); +} + +void PolarArrangeTab::arrange() +{ + std::cout << "PolarArrangeTab::arrange()" << std::endl; +} + +void PolarArrangeTab::updateSelection() +{ + +} //######################################################################### @@ -383,13 +427,6 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h //## E V E N T S //######################################################################### - -void GridArrangeTab::_apply() -{ - arrange(); -} - - /** * changed value in # of columns spinbox. */ -- cgit v1.2.3 From ffef031f0c930b63abe89386ad7edfcff0469029 Mon Sep 17 00:00:00 2001 From: Denis Declara Date: Sun, 15 Apr 2012 14:27:18 +0200 Subject: Improved User interface. Added controls for Center, Radius and Angles. Note that none of them actually do something yet (bzr r11073.1.14) --- src/ui/dialog/tile.cpp | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'src/ui/dialog/tile.cpp') diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index 0e3b24f7c..dd49ac9eb 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -142,14 +142,21 @@ void ArrangeDialog::_apply() } PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) - : parent(parent_) + : parent(parent_), + parametersTable(3, 3, false), + centerY("", "Y coordinate of the center", UNIT_TYPE_LINEAR), + centerX("", "X coordinate of the center", centerY), + radiusY("", "Y coordinate of the radius", UNIT_TYPE_LINEAR), + radiusX("", "X coordinate of the radius", radiusY), + angleY("", "Starting angle", UNIT_TYPE_RADIAL), + angleX("", "End angle", angleY) { anchorPointLabel.set_text("Anchor point:"); anchorPointLabel.set_alignment(Gtk::ALIGN_START); pack_start(anchorPointLabel, false, false); anchorBoundingBoxRadio.set_label("Object's bounding box:"); - anchorBoundingBoxRadio.set_group(anchorRadioGroup); + anchorRadioGroup = anchorBoundingBoxRadio.get_group(); pack_start(anchorBoundingBoxRadio, false, false); pack_start(anchorSelector, false, false); @@ -163,12 +170,28 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) pack_start(arrangeOnLabel, false, false); arrangeOnCircleRadio.set_label("Last selected circle/ellipse/arc"); - anchorObjectPivotRadio.set_group(arrangeRadioGroup); + arrangeRadioGroup = arrangeOnCircleRadio.get_group(); pack_start(arrangeOnCircleRadio, false, false); arrangeOnParametersRadio.set_label("Parameterized:"); - anchorObjectPivotRadio.set_group(arrangeRadioGroup); + arrangeOnParametersRadio.set_group(arrangeRadioGroup); pack_start(arrangeOnParametersRadio, false, false); + + centerLabel.set_text("Center X/Y:"); + parametersTable.attach(centerLabel, 0, 1, 0, 1); + parametersTable.attach(centerX, 1, 2, 0, 1, Gtk::EXPAND); + parametersTable.attach(centerY, 2, 3, 0, 1, Gtk::EXPAND); + + radiusLabel.set_text("Radius X/Y:"); + parametersTable.attach(radiusLabel, 0, 1, 1, 2); + parametersTable.attach(radiusX, 1, 2, 1, 2, Gtk::EXPAND); + parametersTable.attach(radiusY, 2, 3, 1, 2, Gtk::EXPAND); + + angleLabel.set_text("Center X/Y:"); + parametersTable.attach(angleLabel, 0, 1, 2, 3); + parametersTable.attach(angleX, 1, 2, 2, 3, Gtk::EXPAND); + parametersTable.attach(angleY, 2, 3, 2, 3, Gtk::EXPAND); + pack_start(parametersTable, false, false); } void PolarArrangeTab::arrange() -- cgit v1.2.3 From 35b3c61da544c8e771078a015690d4311203bf84 Mon Sep 17 00:00:00 2001 From: Denis Declara Date: Sun, 15 Apr 2012 22:21:15 +0200 Subject: Added some POC code to move objects around (bzr r11073.1.16) --- src/ui/dialog/tile.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/ui/dialog/tile.cpp') diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index dd49ac9eb..af2319411 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -197,6 +197,18 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) void PolarArrangeTab::arrange() { std::cout << "PolarArrangeTab::arrange()" << std::endl; + Inkscape::Selection *selection = sp_desktop_selection(parent->getDesktop()); + const GSList *items = selection->itemList(); + int i = 0; + while(items) + { + SPItem *item = SP_ITEM(items->data); + Geom::Point move = Geom::Point(100 * i, -100 * i); + Geom::Affine const affine = Geom::Affine(Geom::Translate(move)); + item->set_i2d_affine(affine); + items = items->next; + ++i; + } } void PolarArrangeTab::updateSelection() -- cgit v1.2.3 From 610dc4491aefb2afc144cad45893bf5435168648 Mon Sep 17 00:00:00 2001 From: Denis Declara Date: Thu, 19 Apr 2012 16:12:26 +0200 Subject: Improved UI of PolarArrangement Tab and connected some widgets to events (now parts of the GUI disable themselves when needed) (bzr r11073.1.18) --- src/ui/dialog/tile.cpp | 78 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 72 insertions(+), 6 deletions(-) (limited to 'src/ui/dialog/tile.cpp') diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index af2319411..9e2ba71c4 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -157,12 +157,14 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) anchorBoundingBoxRadio.set_label("Object's bounding box:"); anchorRadioGroup = anchorBoundingBoxRadio.get_group(); + anchorBoundingBoxRadio.signal_toggled().connect(sigc::mem_fun(*this, &PolarArrangeTab::on_anchor_radio_changed)); pack_start(anchorBoundingBoxRadio, false, false); pack_start(anchorSelector, false, false); anchorObjectPivotRadio.set_label("Object's rotational center"); anchorObjectPivotRadio.set_group(anchorRadioGroup); + anchorObjectPivotRadio.signal_toggled().connect(sigc::mem_fun(*this, &PolarArrangeTab::on_anchor_radio_changed)); pack_start(anchorObjectPivotRadio, false, false); arrangeOnLabel.set_text("Arrange on:"); @@ -171,27 +173,71 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) arrangeOnCircleRadio.set_label("Last selected circle/ellipse/arc"); arrangeRadioGroup = arrangeOnCircleRadio.get_group(); + arrangeOnCircleRadio.signal_toggled().connect(sigc::mem_fun(*this, &PolarArrangeTab::on_arrange_radio_changed)); pack_start(arrangeOnCircleRadio, false, false); arrangeOnParametersRadio.set_label("Parameterized:"); arrangeOnParametersRadio.set_group(arrangeRadioGroup); + arrangeOnParametersRadio.signal_toggled().connect(sigc::mem_fun(*this, &PolarArrangeTab::on_arrange_radio_changed)); pack_start(arrangeOnParametersRadio, false, false); + //FIXME: Objects in grid do not line up properly! centerLabel.set_text("Center X/Y:"); parametersTable.attach(centerLabel, 0, 1, 0, 1); - parametersTable.attach(centerX, 1, 2, 0, 1, Gtk::EXPAND); - parametersTable.attach(centerY, 2, 3, 0, 1, Gtk::EXPAND); + centerX.setDigits(2); + centerX.set_size_request(60, -1); + centerX.setIncrements(0.2, 0); + centerX.setRange(-10000, 10000); + centerX.setValue(0, "px"); + centerY.setDigits(2); + centerY.set_size_request(120, -1); + centerY.setIncrements(0.2, 0); + centerY.setRange(-10000, 10000); + centerY.setValue(0, "px"); + parametersTable.attach(centerX, 1, 2, 0, 1); + parametersTable.attach(centerY, 2, 3, 0, 1); radiusLabel.set_text("Radius X/Y:"); parametersTable.attach(radiusLabel, 0, 1, 1, 2); - parametersTable.attach(radiusX, 1, 2, 1, 2, Gtk::EXPAND); - parametersTable.attach(radiusY, 2, 3, 1, 2, Gtk::EXPAND); + radiusX.setDigits(2); + radiusX.set_size_request(60, -1); + radiusX.setIncrements(0.2, 0); + radiusX.setRange(-10000, 10000); + radiusX.setValue(0, "px"); + radiusY.setDigits(2); + radiusY.set_size_request(120, -1); + radiusY.setIncrements(0.2, 0); + radiusY.setRange(-10000, 10000); + radiusY.setValue(0, "px"); + parametersTable.attach(radiusX, 1, 2, 1, 2); + parametersTable.attach(radiusY, 2, 3, 1, 2); angleLabel.set_text("Center X/Y:"); parametersTable.attach(angleLabel, 0, 1, 2, 3); - parametersTable.attach(angleX, 1, 2, 2, 3, Gtk::EXPAND); - parametersTable.attach(angleY, 2, 3, 2, 3, Gtk::EXPAND); + angleX.setDigits(2); + angleX.set_size_request(60, -1); + angleX.setIncrements(0.2, 0); + angleX.setRange(-10000, 10000); + angleX.setValue(0, "°"); + angleY.setDigits(2); + angleY.set_size_request(120, -1); + angleY.setIncrements(0.2, 0); + angleY.setRange(-10000, 10000); + angleY.setValue(0, "°"); + parametersTable.attach(angleX, 1, 2, 2, 3); + parametersTable.attach(angleY, 2, 3, 2, 3); pack_start(parametersTable, false, false); + + rotateObjectsCheckBox.set_label("Rotate objects"); + rotateObjectsCheckBox.set_active(true); + pack_start(rotateObjectsCheckBox, false, false); + + centerX.set_sensitive(false); + centerY.set_sensitive(false); + angleX.set_sensitive(false); + angleY.set_sensitive(false); + radiusX.set_sensitive(false); + radiusY.set_sensitive(false); } void PolarArrangeTab::arrange() @@ -213,7 +259,27 @@ void PolarArrangeTab::arrange() void PolarArrangeTab::updateSelection() { +} + +void PolarArrangeTab::on_arrange_radio_changed() +{ + bool arrangeParametric = !arrangeOnCircleRadio.get_active(); + + centerX.set_sensitive(arrangeParametric); + centerY.set_sensitive(arrangeParametric); + + angleX.set_sensitive(arrangeParametric); + angleY.set_sensitive(arrangeParametric); + + radiusX.set_sensitive(arrangeParametric); + radiusY.set_sensitive(arrangeParametric); +} + +void PolarArrangeTab::on_anchor_radio_changed() +{ + bool anchorBoundingBox = anchorBoundingBoxRadio.get_active(); + anchorSelector.set_sensitive(anchorBoundingBox); } -- cgit v1.2.3 From 64d1318049350136ae837f74c56bc5ad9a3c363c Mon Sep 17 00:00:00 2001 From: Denis Declara Date: Tue, 24 Apr 2012 22:24:04 +0200 Subject: Added first support for elliptical arrangements (bzr r11073.1.19) --- src/ui/dialog/tile.cpp | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'src/ui/dialog/tile.cpp') diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index 9e2ba71c4..d4c597b84 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -34,6 +34,7 @@ #include "sp-item.h" #include "widgets/icon.h" #include "desktop.h" +#include "sp-item-transform.h" /* * Sort items by their x co-ordinates, taking account of y (keeps rows intact) @@ -249,9 +250,29 @@ void PolarArrangeTab::arrange() while(items) { SPItem *item = SP_ITEM(items->data); - Geom::Point move = Geom::Point(100 * i, -100 * i); - Geom::Affine const affine = Geom::Affine(Geom::Translate(move)); - item->set_i2d_affine(affine); + + float centerx = 1000; + float centery = 2000; + + float radiusx = 1000; + float radiusy = 2000; + + float objectx = - item->documentVisualBounds()->min()[Geom::X]; + float objecty = item->documentVisualBounds()->min()[Geom::Y]; + + float angle = M_PI / 36 * i; + + float r = (radiusx * radiusy) / + sqrtf(powf(radiusy * cos(angle), 2) + powf(radiusx * sin(angle), 2)); + float calcx = cos(angle) * r; + float calcy = sin(angle) * r; + + sp_item_move_rel(item, Geom::Translate(objectx + calcx, objecty + calcy)); + sp_item_rotate_rel(item, Geom::Rotate(angle)); + + //item->set_i2d_affine(item->i2dt_affine() * toOrigin * rotation); + //item->doWriteTransform(item->getRepr(), item->transform, NULL); + items = items->next; ++i; } -- cgit v1.2.3 From 3b4367f104ffcb7e07664dc711b8a879d1122dec Mon Sep 17 00:00:00 2001 From: Denis Declara Date: Fri, 27 Apr 2012 23:43:11 +0200 Subject: Code Refactoreing. Moved parts of the code from tile.cpp tile.h to arrangetab.h, gridarrangetab(.cpp|.h), polararrangetab(.cpp|.h) Also modified the name of the verb used by the "Rows and Columns" dialog to SP_VERB_SELECTION_ARRANGE (bzr r11073.1.21) --- src/ui/dialog/tile.cpp | 914 +------------------------------------------------ 1 file changed, 5 insertions(+), 909 deletions(-) (limited to 'src/ui/dialog/tile.cpp') diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index d4c597b84..879c9182f 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -6,112 +6,28 @@ * John Cliff * Other dudes from The Inkscape Organization * Abhishek Sharma + * Declara Denis * * Copyright (C) 2004 Bob Jamison * Copyright (C) 2004 John Cliff * * Released under GNU GPL, read the file 'COPYING' for more information */ -//#define DEBUG_GRID_ARRANGE 1 -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "tile.h" -#include //for GTK_RESPONSE* types #include -#include -#include <2geom/transforms.h> +#include "tile.h" #include "verbs.h" -#include "preferences.h" -#include "inkscape.h" -#include "desktop-handles.h" -#include "selection.h" -#include "document.h" -#include "document-undo.h" -#include "sp-item.h" -#include "widgets/icon.h" -#include "desktop.h" -#include "sp-item-transform.h" - -/* - * Sort items by their x co-ordinates, taking account of y (keeps rows intact) - * - * <0 *elem1 goes before *elem2 - * 0 *elem1 == *elem2 - * >0 *elem1 goes after *elem2 - */ -int sp_compare_x_position(SPItem *first, SPItem *second) -{ - using Geom::X; - using Geom::Y; - - Geom::OptRect a = first->documentVisualBounds(); - Geom::OptRect b = second->documentVisualBounds(); - - if ( !a || !b ) { - // FIXME? - return 0; - } - - double const a_height = a->dimensions()[Y]; - double const b_height = b->dimensions()[Y]; - - bool a_in_b_vert = false; - if ((a->min()[Y] < b->min()[Y] + 0.1) && (a->min()[Y] > b->min()[Y] - b_height)) { - a_in_b_vert = true; - } else if ((b->min()[Y] < a->min()[Y] + 0.1) && (b->min()[Y] > a->min()[Y] - a_height)) { - a_in_b_vert = true; - } else if (b->min()[Y] == a->min()[Y]) { - a_in_b_vert = true; - } else { - a_in_b_vert = false; - } - - if (!a_in_b_vert) { - return -1; - } - if (a_in_b_vert && a->min()[X] > b->min()[X]) { - return 1; - } - if (a_in_b_vert && a->min()[X] < b->min()[X]) { - return -1; - } - return 0; -} - -/* - * Sort items by their y co-ordinates. - */ -int -sp_compare_y_position(SPItem *first, SPItem *second) -{ - Geom::OptRect a = first->documentVisualBounds(); - Geom::OptRect b = second->documentVisualBounds(); - - if ( !a || !b ) { - // FIXME? - return 0; - } - if (a->min()[Geom::Y] > b->min()[Geom::Y]) { - return 1; - } - if (a->min()[Geom::Y] < b->min()[Geom::Y]) { - return -1; - } - - return 0; -} +#include "ui/dialog/gridarrangetab.h" +#include "ui/dialog/polararrangetab.h" namespace Inkscape { namespace UI { namespace Dialog { ArrangeDialog::ArrangeDialog() - : UI::Widget::Panel("", "/dialogs/gridtiler", SP_VERB_SELECTION_GRIDTILE), + : UI::Widget::Panel("", "/dialogs/gridtiler", SP_VERB_SELECTION_ARRANGE), _gridArrangeTab(new GridArrangeTab(this)), _polarArrangeTab(new PolarArrangeTab(this)) { @@ -142,826 +58,6 @@ void ArrangeDialog::_apply() } } -PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) - : parent(parent_), - parametersTable(3, 3, false), - centerY("", "Y coordinate of the center", UNIT_TYPE_LINEAR), - centerX("", "X coordinate of the center", centerY), - radiusY("", "Y coordinate of the radius", UNIT_TYPE_LINEAR), - radiusX("", "X coordinate of the radius", radiusY), - angleY("", "Starting angle", UNIT_TYPE_RADIAL), - angleX("", "End angle", angleY) -{ - anchorPointLabel.set_text("Anchor point:"); - anchorPointLabel.set_alignment(Gtk::ALIGN_START); - pack_start(anchorPointLabel, false, false); - - anchorBoundingBoxRadio.set_label("Object's bounding box:"); - anchorRadioGroup = anchorBoundingBoxRadio.get_group(); - anchorBoundingBoxRadio.signal_toggled().connect(sigc::mem_fun(*this, &PolarArrangeTab::on_anchor_radio_changed)); - pack_start(anchorBoundingBoxRadio, false, false); - - pack_start(anchorSelector, false, false); - - anchorObjectPivotRadio.set_label("Object's rotational center"); - anchorObjectPivotRadio.set_group(anchorRadioGroup); - anchorObjectPivotRadio.signal_toggled().connect(sigc::mem_fun(*this, &PolarArrangeTab::on_anchor_radio_changed)); - pack_start(anchorObjectPivotRadio, false, false); - - arrangeOnLabel.set_text("Arrange on:"); - arrangeOnLabel.set_alignment(Gtk::ALIGN_START); - pack_start(arrangeOnLabel, false, false); - - arrangeOnCircleRadio.set_label("Last selected circle/ellipse/arc"); - arrangeRadioGroup = arrangeOnCircleRadio.get_group(); - arrangeOnCircleRadio.signal_toggled().connect(sigc::mem_fun(*this, &PolarArrangeTab::on_arrange_radio_changed)); - pack_start(arrangeOnCircleRadio, false, false); - - arrangeOnParametersRadio.set_label("Parameterized:"); - arrangeOnParametersRadio.set_group(arrangeRadioGroup); - arrangeOnParametersRadio.signal_toggled().connect(sigc::mem_fun(*this, &PolarArrangeTab::on_arrange_radio_changed)); - pack_start(arrangeOnParametersRadio, false, false); - - //FIXME: Objects in grid do not line up properly! - centerLabel.set_text("Center X/Y:"); - parametersTable.attach(centerLabel, 0, 1, 0, 1); - centerX.setDigits(2); - centerX.set_size_request(60, -1); - centerX.setIncrements(0.2, 0); - centerX.setRange(-10000, 10000); - centerX.setValue(0, "px"); - centerY.setDigits(2); - centerY.set_size_request(120, -1); - centerY.setIncrements(0.2, 0); - centerY.setRange(-10000, 10000); - centerY.setValue(0, "px"); - parametersTable.attach(centerX, 1, 2, 0, 1); - parametersTable.attach(centerY, 2, 3, 0, 1); - - radiusLabel.set_text("Radius X/Y:"); - parametersTable.attach(radiusLabel, 0, 1, 1, 2); - radiusX.setDigits(2); - radiusX.set_size_request(60, -1); - radiusX.setIncrements(0.2, 0); - radiusX.setRange(-10000, 10000); - radiusX.setValue(0, "px"); - radiusY.setDigits(2); - radiusY.set_size_request(120, -1); - radiusY.setIncrements(0.2, 0); - radiusY.setRange(-10000, 10000); - radiusY.setValue(0, "px"); - parametersTable.attach(radiusX, 1, 2, 1, 2); - parametersTable.attach(radiusY, 2, 3, 1, 2); - - angleLabel.set_text("Center X/Y:"); - parametersTable.attach(angleLabel, 0, 1, 2, 3); - angleX.setDigits(2); - angleX.set_size_request(60, -1); - angleX.setIncrements(0.2, 0); - angleX.setRange(-10000, 10000); - angleX.setValue(0, "°"); - angleY.setDigits(2); - angleY.set_size_request(120, -1); - angleY.setIncrements(0.2, 0); - angleY.setRange(-10000, 10000); - angleY.setValue(0, "°"); - parametersTable.attach(angleX, 1, 2, 2, 3); - parametersTable.attach(angleY, 2, 3, 2, 3); - pack_start(parametersTable, false, false); - - rotateObjectsCheckBox.set_label("Rotate objects"); - rotateObjectsCheckBox.set_active(true); - pack_start(rotateObjectsCheckBox, false, false); - - centerX.set_sensitive(false); - centerY.set_sensitive(false); - angleX.set_sensitive(false); - angleY.set_sensitive(false); - radiusX.set_sensitive(false); - radiusY.set_sensitive(false); -} - -void PolarArrangeTab::arrange() -{ - std::cout << "PolarArrangeTab::arrange()" << std::endl; - Inkscape::Selection *selection = sp_desktop_selection(parent->getDesktop()); - const GSList *items = selection->itemList(); - int i = 0; - while(items) - { - SPItem *item = SP_ITEM(items->data); - - float centerx = 1000; - float centery = 2000; - - float radiusx = 1000; - float radiusy = 2000; - - float objectx = - item->documentVisualBounds()->min()[Geom::X]; - float objecty = item->documentVisualBounds()->min()[Geom::Y]; - - float angle = M_PI / 36 * i; - - float r = (radiusx * radiusy) / - sqrtf(powf(radiusy * cos(angle), 2) + powf(radiusx * sin(angle), 2)); - float calcx = cos(angle) * r; - float calcy = sin(angle) * r; - - sp_item_move_rel(item, Geom::Translate(objectx + calcx, objecty + calcy)); - sp_item_rotate_rel(item, Geom::Rotate(angle)); - - //item->set_i2d_affine(item->i2dt_affine() * toOrigin * rotation); - //item->doWriteTransform(item->getRepr(), item->transform, NULL); - - items = items->next; - ++i; - } -} - -void PolarArrangeTab::updateSelection() -{ -} - -void PolarArrangeTab::on_arrange_radio_changed() -{ - bool arrangeParametric = !arrangeOnCircleRadio.get_active(); - - centerX.set_sensitive(arrangeParametric); - centerY.set_sensitive(arrangeParametric); - - angleX.set_sensitive(arrangeParametric); - angleY.set_sensitive(arrangeParametric); - - radiusX.set_sensitive(arrangeParametric); - radiusY.set_sensitive(arrangeParametric); -} - -void PolarArrangeTab::on_anchor_radio_changed() -{ - bool anchorBoundingBox = anchorBoundingBoxRadio.get_active(); - - anchorSelector.set_sensitive(anchorBoundingBox); -} - - -//######################################################################### -//## E V E N T S -//######################################################################### - -/* - * - * This arranges the selection in a grid pattern. - * - */ - -void GridArrangeTab::arrange() -{ - - int cnt,row_cnt,col_cnt,a,row,col; - double grid_left,grid_top,col_width,row_height,paddingx,paddingy,width, height, new_x, new_y,cx,cy; - double total_col_width,total_row_height; - col_width = 0; - row_height = 0; - total_col_width=0; - total_row_height=0; - - // check for correct numbers in the row- and col-spinners - on_col_spinbutton_changed(); - on_row_spinbutton_changed(); - - // set padding to manual values - paddingx = XPadding.getValue("px"); - paddingy = YPadding.getValue("px"); - - std::vector row_heights; - std::vector col_widths; - std::vector row_ys; - std::vector col_xs; - - int NoOfCols = NoOfColsSpinner.get_value_as_int(); - int NoOfRows = NoOfRowsSpinner.get_value_as_int(); - - width = 0; - for (a=0;agetDesktop(); - sp_desktop_document(desktop)->ensureUpToDate(); - - Inkscape::Selection *selection = sp_desktop_selection (desktop); - const GSList *items = selection ? selection->itemList() : 0; - cnt=0; - for (; items != NULL; items = items->next) { - SPItem *item = SP_ITEM(items->data); - Geom::OptRect b = item->documentVisualBounds(); - if (!b) { - continue; - } - - width = b->dimensions()[Geom::X]; - height = b->dimensions()[Geom::Y]; - - cx = b->midpoint()[Geom::X]; - cy = b->midpoint()[Geom::Y]; - - if (b->min()[Geom::X] < grid_left) { - grid_left = b->min()[Geom::X]; - } - if (b->min()[Geom::Y] < grid_top) { - grid_top = b->min()[Geom::Y]; - } - if (width > col_width) { - col_width = width; - } - if (height > row_height) { - row_height = height; - } - } - - - // require the sorting done before we can calculate row heights etc. - - g_return_if_fail(selection); - const GSList *items2 = selection->itemList(); - GSList *rev = g_slist_copy((GSList *) items2); - GSList *sorted = NULL; - rev = g_slist_sort(rev, (GCompareFunc) sp_compare_y_position); - sorted = g_slist_sort(rev, (GCompareFunc) sp_compare_x_position); - - - // Calculate individual Row and Column sizes if necessary - - - cnt=0; - const GSList *sizes = sorted; - for (; sizes != NULL; sizes = sizes->next) { - SPItem *item = SP_ITEM(sizes->data); - Geom::OptRect b = item->documentVisualBounds(); - if (b) { - width = b->dimensions()[Geom::X]; - height = b->dimensions()[Geom::Y]; - if (width > col_widths[(cnt % NoOfCols)]) { - col_widths[(cnt % NoOfCols)] = width; - } - if (height > row_heights[(cnt / NoOfCols)]) { - row_heights[(cnt / NoOfCols)] = height; - } - } - - cnt++; - } - - - /// Make sure the top and left of the grid dont move by compensating for align values. - if (RowHeightButton.get_active()){ - grid_top = grid_top - (((row_height - row_heights[0]) / 2)*(VertAlign)); - } - if (ColumnWidthButton.get_active()){ - grid_left = grid_left - (((col_width - col_widths[0]) /2)*(HorizAlign)); - } - - #ifdef DEBUG_GRID_ARRANGE - g_print("\n cx = %f cy= %f gridleft=%f",cx,cy,grid_left); - #endif - - // Calculate total widths and heights, allowing for columns and rows non uniformly sized. - - if (ColumnWidthButton.get_active()){ - total_col_width = col_width * NoOfCols; - col_widths.clear(); - for (a=0;avisualBounds(); - // Fit to bbox, calculate padding between rows accordingly. - 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(Geom::X), b.extent(Geom::Y)); -#endif - paddingx = (sel_bbox->width() - total_col_width) / (NoOfCols -1); - paddingy = (sel_bbox->height() - total_row_height) / (NoOfRows -1); - } - -/* - Horizontal align - Left = 0 - Centre = 1 - Right = 2 - - Vertical align - Top = 0 - Middle = 1 - Bottom = 2 - - X position is calculated by taking the grids left co-ord, adding the distance to the column, - then adding 1/2 the spacing multiplied by the align variable above, - Y position likewise, takes the top of the grid, adds the y to the current row then adds the padding in to align it. - -*/ - - // Calculate row and column x and y coords required to allow for columns and rows which are non uniformly sized. - - for (a=0;adata); - sorted = sorted->next; - } - - for (; current_row != NULL; current_row = current_row->next) { - SPItem *item=SP_ITEM(current_row->data); - Inkscape::XML::Node *repr = item->getRepr(); - Geom::OptRect b = item->documentVisualBounds(); - Geom::Point min; - if (b) { - width = b->dimensions()[Geom::X]; - height = b->dimensions()[Geom::Y]; - min = b->min(); - } else { - width = height = 0; - min = Geom::Point(0, 0); - } - - row = cnt / NoOfCols; - col = cnt % NoOfCols; - - new_x = grid_left + (((col_widths[col] - width)/2)*HorizAlign) + col_xs[col]; - new_y = grid_top + (((row_heights[row] - height)/2)*VertAlign) + row_ys[row]; - - // signs are inverted between x and y due to y inversion - Geom::Point move = Geom::Point(new_x - min[Geom::X], min[Geom::Y] - new_y); - Geom::Affine const affine = Geom::Affine(Geom::Translate(move)); - item->set_i2d_affine(item->i2dt_affine() * affine); - item->doWriteTransform(repr, item->transform, NULL); - SP_OBJECT (current_row->data)->updateRepr(); - cnt +=1; - } - g_slist_free (current_row); - } - - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_GRIDTILE, - _("Arrange in a grid")); - -} - - -//######################################################################### -//## E V E N T S -//######################################################################### - -/** - * changed value in # of columns spinbox. - */ -void GridArrangeTab::on_row_spinbutton_changed() -{ - // quit if run by the attr_changed listener - if (updating) { - return; - } - - // in turn, prevent listener from responding - updating = true; - SPDesktop *desktop = Parent->getDesktop(); - - Inkscape::Selection *selection = desktop ? desktop->selection : 0; - g_return_if_fail( selection ); - - GSList const *items = selection->itemList(); - int selcount = g_slist_length((GSList *)items); - - double PerCol = ceil(selcount / NoOfColsSpinner.get_value()); - NoOfRowsSpinner.set_value(PerCol); - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble("/dialogs/gridtiler/NoOfCols", NoOfColsSpinner.get_value()); - updating=false; -} - -/** - * changed value in # of rows spinbox. - */ -void GridArrangeTab::on_col_spinbutton_changed() -{ - // quit if run by the attr_changed listener - if (updating) { - return; - } - - // in turn, prevent listener from responding - updating = true; - SPDesktop *desktop = Parent->getDesktop(); - Inkscape::Selection *selection = desktop ? desktop->selection : 0; - g_return_if_fail(selection); - - GSList const *items = selection->itemList(); - int selcount = g_slist_length((GSList *)items); - - double PerRow = ceil(selcount / NoOfRowsSpinner.get_value()); - NoOfColsSpinner.set_value(PerRow); - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble("/dialogs/gridtiler/NoOfCols", PerRow); - - updating=false; -} - -/** - * changed value in x padding spinbox. - */ -void GridArrangeTab::on_xpad_spinbutton_changed() -{ - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble("/dialogs/gridtiler/XPad", XPadding.getValue("px")); - -} - -/** - * changed value in y padding spinbox. - */ -void GridArrangeTab::on_ypad_spinbutton_changed() -{ - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble("/dialogs/gridtiler/YPad", YPadding.getValue("px")); -} - - -/** - * checked/unchecked autosize Rows button. - */ -void GridArrangeTab::on_RowSize_checkbutton_changed() -{ - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if (RowHeightButton.get_active()) { - prefs->setDouble("/dialogs/gridtiler/AutoRowSize", 20); - } else { - prefs->setDouble("/dialogs/gridtiler/AutoRowSize", -20); - } - RowHeightBox.set_sensitive ( !RowHeightButton.get_active()); -} - -/** - * checked/unchecked autosize Rows button. - */ -void GridArrangeTab::on_ColSize_checkbutton_changed() -{ - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if (ColumnWidthButton.get_active()) { - prefs->setDouble("/dialogs/gridtiler/AutoColSize", 20); - } else { - prefs->setDouble("/dialogs/gridtiler/AutoColSize", -20); - } - ColumnWidthBox.set_sensitive ( !ColumnWidthButton.get_active()); -} - -/** - * changed value in columns spinbox. - */ -void GridArrangeTab::on_rowSize_spinbutton_changed() -{ - // quit if run by the attr_changed listener - if (updating) { - return; - } - - // in turn, prevent listener from responding - updating = true; - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble("/dialogs/gridtiler/RowHeight", RowHeightSpinner.get_value()); - updating=false; - -} - -/** - * changed value in rows spinbox. - */ -void GridArrangeTab::on_colSize_spinbutton_changed() -{ - // quit if run by the attr_changed listener - if (updating) { - return; - } - - // in turn, prevent listener from responding - updating = true; - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble("/dialogs/gridtiler/ColWidth", ColumnWidthSpinner.get_value()); - updating=false; - -} - -/** - * changed Radio button in Spacing group. - */ -void GridArrangeTab::Spacing_button_changed() -{ - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if (SpaceManualRadioButton.get_active()) { - prefs->setDouble("/dialogs/gridtiler/SpacingType", 20); - } else { - prefs->setDouble("/dialogs/gridtiler/SpacingType", -20); - } - - XPadding.set_sensitive ( SpaceManualRadioButton.get_active()); - YPadding.set_sensitive ( SpaceManualRadioButton.get_active()); -} - -/** - * changed Anchor selection widget. - */ -void GridArrangeTab::Align_changed() -{ - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - VertAlign = AlignmentSelector.getVerticalAlignment(); - prefs->setInt("/dialogs/gridtiler/VertAlign", VertAlign); - HorizAlign = AlignmentSelector.getHorizontalAlignment(); - prefs->setInt("/dialogs/gridtiler/HorizAlign", HorizAlign); -} - -/** - * Desktop selection changed - */ -void GridArrangeTab::updateSelection() -{ - // quit if run by the attr_changed listener - if (updating) { - return; - } - - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - // in turn, prevent listener from responding - updating = true; - SPDesktop *desktop = Parent->getDesktop(); - Inkscape::Selection *selection = desktop ? desktop->selection : 0; - GSList const *items = selection ? selection->itemList() : 0; - - if (items) { - int selcount = g_slist_length((GSList *)items); - - if (NoOfColsSpinner.get_value() > 1 && NoOfRowsSpinner.get_value() > 1){ - // Update the number of rows assuming number of columns wanted remains same. - double NoOfRows = ceil(selcount / NoOfColsSpinner.get_value()); - NoOfRowsSpinner.set_value(NoOfRows); - - // if the selection has less than the number set for one row, reduce it appropriately - if (selcount < NoOfColsSpinner.get_value()) { - double NoOfCols = ceil(selcount / NoOfRowsSpinner.get_value()); - NoOfColsSpinner.set_value(NoOfCols); - prefs->setInt("/dialogs/gridtiler/NoOfCols", NoOfCols); - } - } else { - double PerRow = ceil(sqrt(selcount)); - double PerCol = ceil(sqrt(selcount)); - NoOfRowsSpinner.set_value(PerRow); - NoOfColsSpinner.set_value(PerCol); - prefs->setInt("/dialogs/gridtiler/NoOfCols", static_cast(PerCol)); - } - } - - updating = false; -} - - - -/*########################## -## Experimental -##########################*/ - -static void updateSelectionCallback(Inkscape::Application */*inkscape*/, Inkscape::Selection */*selection*/, GridArrangeTab *dlg) -{ - dlg->updateSelection(); -} - - -//######################################################################### -//## C O N S T R U C T O R / D E S T R U C T O R -//######################################################################### -/** - * Constructor - */ -GridArrangeTab::GridArrangeTab(ArrangeDialog *parent) - : Parent(parent), - XPadding(_("X:"), _("Horizontal spacing between columns."), UNIT_TYPE_LINEAR, "", "object-columns"), - YPadding(_("Y:"), _("Vertical spacing between rows."), XPadding, "", "object-rows") -{ - // bool used by spin button callbacks to stop loops where they change each other. - updating = false; - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - - // could not do this in gtkmm - there's no Gtk::SizeGroup public constructor (!) - GtkSizeGroup *_col1 = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); - GtkSizeGroup *_col2 = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); - GtkSizeGroup *_col3 = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); - - { - // Selection Change signal - g_signal_connect ( G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (updateSelectionCallback), this); - } - - Gtk::Box *contents = this; - -#define MARGIN 2 - - //##Set up the panel - - SPDesktop *desktop = Parent->getDesktop(); - - Inkscape::Selection *selection = desktop ? desktop->selection : 0; - g_return_if_fail( selection ); - int selcount = 1; - if (!selection->isEmpty()) { - GSList const *items = selection->itemList(); - selcount = g_slist_length((GSList *)items); - } - - - /*#### Number of Rows ####*/ - - double PerRow = ceil(sqrt(selcount)); - double PerCol = ceil(sqrt(selcount)); - - #ifdef DEBUG_GRID_ARRANGE - g_print("/n PerRox = %f PerCol = %f selcount = %d",PerRow,PerCol,selcount); - #endif - - NoOfRowsLabel.set_text_with_mnemonic(_("_Rows:")); - NoOfRowsLabel.set_mnemonic_widget(NoOfRowsSpinner); - NoOfRowsBox.pack_start(NoOfRowsLabel, false, false, MARGIN); - - NoOfRowsSpinner.set_digits(0); - NoOfRowsSpinner.set_increments(1, 0); - NoOfRowsSpinner.set_range(1.0, 10000.0); - NoOfRowsSpinner.set_value(PerCol); - NoOfRowsSpinner.signal_changed().connect(sigc::mem_fun(*this, &GridArrangeTab::on_col_spinbutton_changed)); - NoOfRowsSpinner.set_tooltip_text(_("Number of rows")); - NoOfRowsBox.pack_start(NoOfRowsSpinner, false, false, MARGIN); - gtk_size_group_add_widget(_col1, (GtkWidget *) NoOfRowsBox.gobj()); - - RowHeightButton.set_label(_("Equal _height")); - RowHeightButton.set_use_underline(true); - double AutoRow = prefs->getDouble("/dialogs/gridtiler/AutoRowSize", 15); - if (AutoRow>0) - AutoRowSize=true; - else - AutoRowSize=false; - RowHeightButton.set_active(AutoRowSize); - - NoOfRowsBox.pack_start(RowHeightButton, false, false, MARGIN); - - RowHeightButton.set_tooltip_text(_("If not set, each row has the height of the tallest object in it")); - RowHeightButton.signal_toggled().connect(sigc::mem_fun(*this, &GridArrangeTab::on_RowSize_checkbutton_changed)); - - SpinsHBox.pack_start(NoOfRowsBox, false, false, MARGIN); - - - /*#### Label for X ####*/ - padXByYLabel.set_label(" "); - XByYLabelVBox.pack_start(padXByYLabel, false, false, MARGIN); - XByYLabel.set_markup(" × "); - XByYLabelVBox.pack_start(XByYLabel, false, false, MARGIN); - SpinsHBox.pack_start(XByYLabelVBox, false, false, MARGIN); - gtk_size_group_add_widget(_col2, (GtkWidget *) XByYLabelVBox.gobj()); - - /*#### Number of columns ####*/ - - NoOfColsLabel.set_text_with_mnemonic(_("_Columns:")); - NoOfColsLabel.set_mnemonic_widget(NoOfColsSpinner); - NoOfColsBox.pack_start(NoOfColsLabel, false, false, MARGIN); - - NoOfColsSpinner.set_digits(0); - NoOfColsSpinner.set_increments(1, 0); - NoOfColsSpinner.set_range(1.0, 10000.0); - NoOfColsSpinner.set_value(PerRow); - NoOfColsSpinner.signal_changed().connect(sigc::mem_fun(*this, &GridArrangeTab::on_row_spinbutton_changed)); - NoOfColsSpinner.set_tooltip_text(_("Number of columns")); - NoOfColsBox.pack_start(NoOfColsSpinner, false, false, MARGIN); - gtk_size_group_add_widget(_col3, (GtkWidget *) NoOfColsBox.gobj()); - - ColumnWidthButton.set_label(_("Equal _width")); - ColumnWidthButton.set_use_underline(true); - double AutoCol = prefs->getDouble("/dialogs/gridtiler/AutoColSize", 15); - if (AutoCol>0) - AutoColSize=true; - else - AutoColSize=false; - ColumnWidthButton.set_active(AutoColSize); - NoOfColsBox.pack_start(ColumnWidthButton, false, false, MARGIN); - - ColumnWidthButton.set_tooltip_text(_("If not set, each column has the width of the widest object in it")); - ColumnWidthButton.signal_toggled().connect(sigc::mem_fun(*this, &GridArrangeTab::on_ColSize_checkbutton_changed)); - - SpinsHBox.pack_start(NoOfColsBox, false, false, MARGIN); - - TileBox.pack_start(SpinsHBox, false, false, MARGIN); - - VertAlign = prefs->getInt("/dialogs/gridtiler/VertAlign", 1); - HorizAlign = prefs->getInt("/dialogs/gridtiler/HorizAlign", 1); - - // Anchor selection widget - AlignLabel.set_label("Alignment:"); - AlignLabel.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_CENTER); - AlignmentSelector.setAlignment(HorizAlign, VertAlign); - AlignmentSelector.on_selectionChanged().connect(sigc::mem_fun(*this, &GridArrangeTab::Align_changed)); - TileBox.pack_start(AlignLabel, false, false, MARGIN); - TileBox.pack_start(AlignmentSelector, true, false, MARGIN); - - { - /*#### Radio buttons to control spacing manually or to fit selection bbox ####*/ - SpaceByBBoxRadioButton.set_label(_("_Fit into selection box")); - SpaceByBBoxRadioButton.set_use_underline (true); - SpaceByBBoxRadioButton.signal_toggled().connect(sigc::mem_fun(*this, &GridArrangeTab::Spacing_button_changed)); - SpacingGroup = SpaceByBBoxRadioButton.get_group(); - - SpacingVBox.pack_start(SpaceByBBoxRadioButton, false, false, MARGIN); - - SpaceManualRadioButton.set_label(_("_Set spacing:")); - SpaceManualRadioButton.set_use_underline (true); - SpaceManualRadioButton.set_group(SpacingGroup); - SpaceManualRadioButton.signal_toggled().connect(sigc::mem_fun(*this, &GridArrangeTab::Spacing_button_changed)); - SpacingVBox.pack_start(SpaceManualRadioButton, false, false, MARGIN); - - TileBox.pack_start(SpacingVBox, false, false, MARGIN); - } - - { - /*#### Padding ####*/ - - YPadding.setDigits(5); - YPadding.setIncrements(0.2, 0); - YPadding.setRange(-10000, 10000); - double yPad = prefs->getDouble("/dialogs/gridtiler/YPad", 15); - YPadding.setValue(yPad, "px"); - YPadding.signal_value_changed().connect(sigc::mem_fun(*this, &GridArrangeTab::on_ypad_spinbutton_changed)); - - XPadding.setDigits(5); - XPadding.setIncrements(0.2, 0); - XPadding.setRange(-10000, 10000); - double xPad = prefs->getDouble("/dialogs/gridtiler/XPad", 15); - XPadding.setValue(xPad, "px"); - - XPadding.signal_value_changed().connect(sigc::mem_fun(*this, &GridArrangeTab::on_xpad_spinbutton_changed)); - } - TileBox.pack_start(XPadding, false, false, MARGIN); - TileBox.pack_start(YPadding, false, false, MARGIN); - - contents->pack_start(TileBox); - - double SpacingType = prefs->getDouble("/dialogs/gridtiler/SpacingType", 15); - if (SpacingType>0) { - ManualSpacing=true; - } else { - ManualSpacing=false; - } - SpaceManualRadioButton.set_active(ManualSpacing); - SpaceByBBoxRadioButton.set_active(!ManualSpacing); - XPadding.set_sensitive (ManualSpacing); - YPadding.set_sensitive (ManualSpacing); - - //## The OK button FIXME - /*TileOkButton = addResponseButton(C_("Rows and columns dialog","_Arrange"), GTK_RESPONSE_APPLY); - TileOkButton->set_use_underline(true); - TileOkButton->set_tooltip_text(_("Arrange selected objects"));*/ - - show_all_children(); -} - } //namespace Dialog } //namespace UI } //namespace Inkscape -- cgit v1.2.3 From 71d330c244fa7da51136dee09c2132814e84fdcf Mon Sep 17 00:00:00 2001 From: Denis Declara Date: Wed, 9 May 2012 16:50:16 +0200 Subject: Fixed runtime assertion about Parent beeing Null (bzr r11073.1.30) --- src/ui/dialog/tile.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/ui/dialog/tile.cpp') diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index 879c9182f..917544d3d 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -40,7 +40,6 @@ ArrangeDialog::ArrangeDialog() _arrangeButton = this->addResponseButton(C_("Arrange dialog","_Arrange"), GTK_RESPONSE_APPLY); _arrangeButton->set_use_underline(true); _arrangeButton->set_tooltip_text(_("Arrange selected objects")); - _arrangeBox.pack_start(*_arrangeButton); contents->pack_start(_arrangeBox); show_all_children(); } -- cgit v1.2.3 From 2b693f8037ad4b25b368376274811f20f5864c1b Mon Sep 17 00:00:00 2001 From: Denis Declara Date: Wed, 9 May 2012 17:03:55 +0200 Subject: Renamed files to better match coding conventions (bzr r11073.1.31) --- src/ui/dialog/tile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/dialog/tile.cpp') diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index 917544d3d..c967509f9 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -19,8 +19,8 @@ #include "tile.h" #include "verbs.h" -#include "ui/dialog/gridarrangetab.h" -#include "ui/dialog/polararrangetab.h" +#include "ui/dialog/grid-arrange-tab.h" +#include "ui/dialog/polar-arrange-tab.h" namespace Inkscape { namespace UI { -- cgit v1.2.3 From 8d97fe84d570a73ba3b48269308bd360332b8250 Mon Sep 17 00:00:00 2001 From: Denis Declara Date: Sat, 19 May 2012 18:39:38 +0200 Subject: The Polar Arrange Tab of the Arrange Dialog now hides the parametric controls until the user selects the corresponding radio button (bzr r11073.1.35) --- src/ui/dialog/tile.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/ui/dialog/tile.cpp') diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index c967509f9..1ed099120 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -41,7 +41,14 @@ ArrangeDialog::ArrangeDialog() _arrangeButton->set_use_underline(true); _arrangeButton->set_tooltip_text(_("Arrange selected objects")); contents->pack_start(_arrangeBox); - show_all_children(); + //show_all_children(); +} + + +void ArrangeDialog::on_show() +{ + UI::Widget::Panel::on_show(); + _polarArrangeTab->on_arrange_radio_changed(); } void ArrangeDialog::_apply() -- cgit v1.2.3 From 3c85270dc7bfe702a7b88dfc0361ef1ac31376f2 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Thu, 27 Mar 2014 15:22:24 -0400 Subject: Get pollar tiling working agains with trunk (bzr r11073.1.37) --- src/ui/dialog/tile.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ui/dialog/tile.cpp') diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index 1ed099120..a3cffb3d4 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -14,14 +14,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include "ui/dialog/grid-arrange-tab.h" +#include "ui/dialog/polar-arrange-tab.h" + #include #include "tile.h" #include "verbs.h" -#include "ui/dialog/grid-arrange-tab.h" -#include "ui/dialog/polar-arrange-tab.h" - namespace Inkscape { namespace UI { namespace Dialog { -- cgit v1.2.3