diff options
| -rw-r--r-- | share/icons/hicolor/scalable/actions/zoom-center-page.svg | 187 | ||||
| -rw-r--r-- | share/icons/hicolor/symbolic/actions/zoom-center-page-symbolic.svg | 141 | ||||
| -rw-r--r-- | share/keys/inkscape.xml | 3 | ||||
| -rw-r--r-- | share/ui/commands-toolbar.ui | 1 | ||||
| -rw-r--r-- | share/ui/menus.xml | 1 | ||||
| -rw-r--r-- | src/desktop.cpp | 8 | ||||
| -rw-r--r-- | src/desktop.h | 1 | ||||
| -rw-r--r-- | src/ui/toolbar/zoom-toolbar.cpp | 1 | ||||
| -rw-r--r-- | src/verbs.cpp | 5 | ||||
| -rw-r--r-- | src/verbs.h | 1 | ||||
| -rw-r--r-- | src/widgets/desktop-widget.cpp | 4 | ||||
| -rw-r--r-- | src/widgets/toolbox.cpp | 3 |
12 files changed, 355 insertions, 1 deletions
diff --git a/share/icons/hicolor/scalable/actions/zoom-center-page.svg b/share/icons/hicolor/scalable/actions/zoom-center-page.svg new file mode 100644 index 000000000..ae095a3cb --- /dev/null +++ b/share/icons/hicolor/scalable/actions/zoom-center-page.svg @@ -0,0 +1,187 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="16" + height="16" + viewBox="0 0 4.2333332 4.2333335" + version="1.1" + id="svg8" + inkscape:version="0.92.3 (2405546, 2018-03-11)" + sodipodi:docname="CentrePage.svg"> + <defs + id="defs2"> + <linearGradient + inkscape:collect="always" + id="linearGradient881"> + <stop + style="stop-color:#fefefe;stop-opacity:1;" + offset="0" + id="stop877" /> + <stop + style="stop-color:#cccccc;stop-opacity:1" + offset="1" + id="stop879" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + id="linearGradient873"> + <stop + style="stop-color:#7c7c7c;stop-opacity:1" + offset="0" + id="stop869" /> + <stop + style="stop-color:#000000;stop-opacity:1" + offset="1" + id="stop871" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient873" + id="linearGradient875" + x1="-267.14346" + y1="99.000046" + x2="-194.26711" + y2="171.87631" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.01740004,0,0,0.01740004,6.0513851,291.94311)" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient881" + id="linearGradient883" + x1="-260.81458" + y1="142.38321" + x2="-181.90111" + y2="221.29668" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.01740004,0,0,0.01740004,6.0513851,291.94311)" /> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="31.678384" + inkscape:cx="7.2355712" + inkscape:cy="5.6774657" + inkscape:document-units="mm" + inkscape:current-layer="layer1" + showgrid="false" + units="px" + inkscape:window-width="1920" + inkscape:window-height="986" + inkscape:window-x="-11" + inkscape:window-y="-11" + inkscape:window-maximized="1" /> + <metadata + id="metadata5"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-292.76665)"> + <rect + y="293.36209" + x="1.1517707" + height="3.012177" + width="1.959888" + id="rect843" + style="opacity:1;fill:url(#linearGradient883);fill-opacity:1;stroke:url(#linearGradient875);stroke-width:0.07943123;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" /> + <g + id="g849" + transform="matrix(0.01740004,0,0,0.01740004,0.3033617,291.94311)"> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.86499977;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" + id="rect845" + width="18.007357" + height="38.175594" + x="16.252975" + y="49.80357" /> + <rect + y="-54.428566" + x="49.80357" + height="38.175594" + width="18.007357" + id="rect847" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.86499977;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" + transform="rotate(90)" /> + </g> + <g + transform="matrix(0,0.01740004,-0.01740004,0,4.5418462,292.5269)" + id="g855"> + <rect + y="49.80357" + x="16.252975" + height="38.175594" + width="18.007357" + id="rect851" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.86499977;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" /> + <rect + transform="rotate(90)" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.86499977;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" + id="rect853" + width="18.007357" + height="38.175594" + x="49.80357" + y="-54.428566" /> + </g> + <g + transform="matrix(-0.01740004,0,0,-0.01740004,3.9580639,297.79994)" + id="g861"> + <rect + y="49.80357" + x="16.252975" + height="38.175594" + width="18.007357" + id="rect857" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.86499977;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" /> + <rect + transform="rotate(90)" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.86499977;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" + id="rect859" + width="18.007357" + height="38.175594" + x="49.80357" + y="-54.428566" /> + </g> + <g + id="g867" + transform="matrix(0,-0.01740004,0.01740004,0,-0.28042019,297.21615)"> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.86499977;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" + id="rect863" + width="18.007357" + height="38.175594" + x="16.252975" + y="49.80357" /> + <rect + y="-54.428566" + x="49.80357" + height="38.175594" + width="18.007357" + id="rect865" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.86499977;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" + transform="rotate(90)" /> + </g> + </g> +</svg> diff --git a/share/icons/hicolor/symbolic/actions/zoom-center-page-symbolic.svg b/share/icons/hicolor/symbolic/actions/zoom-center-page-symbolic.svg new file mode 100644 index 000000000..3ad75ee2a --- /dev/null +++ b/share/icons/hicolor/symbolic/actions/zoom-center-page-symbolic.svg @@ -0,0 +1,141 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="16" + height="16" + viewBox="0 0 4.2333332 4.2333335" + version="1.1" + id="svg8" + inkscape:version="0.92.3 (2405546, 2018-03-11)" + sodipodi:docname="CentrePage-symbolic.svg"> + <defs + id="defs2" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="31.678384" + inkscape:cx="7.2355712" + inkscape:cy="5.6774657" + inkscape:document-units="mm" + inkscape:current-layer="layer1" + showgrid="false" + units="px" + inkscape:window-width="1920" + inkscape:window-height="986" + inkscape:window-x="-11" + inkscape:window-y="-11" + inkscape:window-maximized="1" /> + <metadata + id="metadata5"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-292.76665)"> + <rect + y="293.36209" + x="1.1517707" + height="3.012177" + width="1.959888" + id="rect843" + style="opacity:1;fill:#fefefe;fill-opacity:1;stroke:#040404;stroke-width:0.07943123;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" /> + <g + id="g849" + transform="matrix(0.01740004,0,0,0.01740004,0.3033617,291.94311)"> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.86499977;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" + id="rect845" + width="18.007357" + height="38.175594" + x="16.252975" + y="49.80357" /> + <rect + y="-54.428566" + x="49.80357" + height="38.175594" + width="18.007357" + id="rect847" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.86499977;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" + transform="rotate(90)" /> + </g> + <g + transform="matrix(0,0.01740004,-0.01740004,0,4.5418462,292.5269)" + id="g855"> + <rect + y="49.80357" + x="16.252975" + height="38.175594" + width="18.007357" + id="rect851" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.86499977;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" /> + <rect + transform="rotate(90)" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.86499977;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" + id="rect853" + width="18.007357" + height="38.175594" + x="49.80357" + y="-54.428566" /> + </g> + <g + transform="matrix(-0.01740004,0,0,-0.01740004,3.9580639,297.79994)" + id="g861"> + <rect + y="49.80357" + x="16.252975" + height="38.175594" + width="18.007357" + id="rect857" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.86499977;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" /> + <rect + transform="rotate(90)" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.86499977;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" + id="rect859" + width="18.007357" + height="38.175594" + x="49.80357" + y="-54.428566" /> + </g> + <g + id="g867" + transform="matrix(0,-0.01740004,0.01740004,0,-0.28042019,297.21615)"> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.86499977;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" + id="rect863" + width="18.007357" + height="38.175594" + x="16.252975" + y="49.80357" /> + <rect + y="-54.428566" + x="49.80357" + height="38.175594" + width="18.007357" + id="rect865" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.86499977;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" + transform="rotate(90)" /> + </g> + </g> +</svg> diff --git a/share/keys/inkscape.xml b/share/keys/inkscape.xml index 7b674b04e..6a24e5bcd 100644 --- a/share/keys/inkscape.xml +++ b/share/keys/inkscape.xml @@ -226,6 +226,9 @@ override) the bindings in the main default.xml. <bind key="4" action="ZoomDrawing" display="true" /> <bind key="4" modifiers="Shift" action="ZoomDrawing" /> <bind key="KP_4" action="ZoomDrawing" /> + <bind key="4" modifiers="Primary" action="ZoomCenterPage" display="true"/> + <bind key="4" modifiers="Primary" action="ZoomCenterPage" /> + <bind key="KP_4" modifiers="Primary" action="ZoomCenterPage" /> <bind key="5" action="ZoomPage" display="true" /> <bind key="5" modifiers="Shift" action="ZoomPage" /> <bind key="KP_5" action="ZoomPage" /> diff --git a/share/ui/commands-toolbar.ui b/share/ui/commands-toolbar.ui index c2b1ed965..f060e8e9d 100644 --- a/share/ui/commands-toolbar.ui +++ b/share/ui/commands-toolbar.ui @@ -18,6 +18,7 @@ <toolitem action='ZoomSelection' /> <toolitem action='ZoomDrawing' /> <toolitem action='ZoomPage' /> + <toolitem action='ZoomCenterPage' /> <separator /> <toolitem action='EditDuplicate' /> <toolitem action='EditClone' /> diff --git a/share/ui/menus.xml b/share/ui/menus.xml index 03f3ad8f7..82cd8fe95 100644 --- a/share/ui/menus.xml +++ b/share/ui/menus.xml @@ -99,6 +99,7 @@ <verb verb-id="ZoomDrawing" /> <verb verb-id="ZoomPage" /> <verb verb-id="ZoomPageWidth" /> + <verb verb-id="ZoomCenterPage" /> <separator/> <verb verb-id="ZoomPrev" /> <verb verb-id="ZoomNext" /> diff --git a/src/desktop.cpp b/src/desktop.cpp index ff40e5934..40305cba1 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -1064,6 +1064,14 @@ SPDesktop::zoom_selection() set_display_area(*d, 10); } +/** + * Centre Page in window, without zooming + */ +void SPDesktop::zoom_center_page() +{ + zoom_absolute_center_point(Geom::Point(doc()->getWidth().value("px")/2, doc()->getHeight().value("px")/2), this->current_zoom()); +} + /** * Performs a quick zoom into what the user is working on. diff --git a/src/desktop.h b/src/desktop.h index d4babf61f..69ccd7bd9 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -342,6 +342,7 @@ public: void zoom_page_width(); void zoom_drawing(); void zoom_selection(); + void zoom_center_page(); double current_zoom() const { return _current_affine.getZoom(); } diff --git a/src/ui/toolbar/zoom-toolbar.cpp b/src/ui/toolbar/zoom-toolbar.cpp index 5cabcb03f..3b4d3d6bc 100644 --- a/src/ui/toolbar/zoom-toolbar.cpp +++ b/src/ui/toolbar/zoom-toolbar.cpp @@ -53,6 +53,7 @@ ZoomToolbar::ZoomToolbar(SPDesktop *desktop) add_toolbutton_for_verb(SP_VERB_ZOOM_DRAWING); add_toolbutton_for_verb(SP_VERB_ZOOM_PAGE); add_toolbutton_for_verb(SP_VERB_ZOOM_PAGE_WIDTH); + add_toolbutton_for_verb(SP_VERB_ZOOM_CENTER_PAGE); add_separator(); diff --git a/src/verbs.cpp b/src/verbs.cpp index deedecf75..352ed857d 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -1999,6 +1999,9 @@ void ZoomVerb::perform(SPAction *action, void *data) case SP_VERB_ZOOM_PREV: dt->prev_transform(); break; + case SP_VERB_ZOOM_CENTER_PAGE: + dt->zoom_center_page(); + break; case SP_VERB_ROTATE_CW: { gint mul = 1 + Inkscape::UI::Tools::gobble_key_events( GDK_KEY_parenleft, 0); @@ -3054,6 +3057,8 @@ Verb *Verb::_base_verbs[] = { INKSCAPE_ICON("zoom-fit-drawing")), new ZoomVerb(SP_VERB_ZOOM_SELECTION, "ZoomSelection", N_("_Selection"), N_("Zoom to fit selection in window"), INKSCAPE_ICON("zoom-fit-selection")), + new ZoomVerb(SP_VERB_ZOOM_CENTER_PAGE, "ZoomCenterPage", N_("_Center _Page"), N_("Centre page in window"), + INKSCAPE_ICON("zoom-center-page")), new ZoomVerb(SP_VERB_ROTATE_CW, "RotateClockwise", N_("Rotate Clockwise"), N_("Rotate canvas clockwise"), nullptr), new ZoomVerb(SP_VERB_ROTATE_CCW, "RotateCounterClockwise", N_("Rotate Counter-Clockwise"), diff --git a/src/verbs.h b/src/verbs.h index 595d2aacf..ead72538f 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -266,6 +266,7 @@ enum { SP_VERB_ZOOM_PAGE_WIDTH, SP_VERB_ZOOM_DRAWING, SP_VERB_ZOOM_SELECTION, + SP_VERB_ZOOM_CENTER_PAGE, /* Canvas Rotation */ SP_VERB_ROTATE_CW, diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 489582ca8..c5810177d 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1928,6 +1928,10 @@ SPDesktopWidget::zoom_populate_popup(Gtk::Menu *menu) item_selection->signal_activate().connect(sigc::mem_fun(desktop, &SPDesktop::zoom_selection)); menu->append(*item_selection); + auto item_center_page = Gtk::manage(new Gtk::MenuItem(_("Centre Page"))); + item_center_page->signal_activate().connect(sigc::mem_fun(desktop, &SPDesktop::zoom_center_page)); + menu->append(*item_center_page); + menu->show_all(); } diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 38e8df8c0..8b7576d8d 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -340,7 +340,8 @@ static Glib::RefPtr<Gtk::ActionGroup> create_or_fetch_actions( SPDesktop* deskto SP_VERB_ZOOM_PAGE, SP_VERB_ZOOM_PAGE_WIDTH, SP_VERB_ZOOM_PREV, - SP_VERB_ZOOM_SELECTION + SP_VERB_ZOOM_SELECTION, + SP_VERB_ZOOM_CENTER_PAGE }; GtkIconSize toolboxSize = ToolboxFactory::prefToSize("/toolbox/small"); |
