14#include <glibmm/i18n.h>
38 show_output(
"window_open(): failed to find document!");
45 if (
auto desktop = window->get_desktop()) {
51 show_output(
"this action needs active window, probably you need to add --active-window / -q");
58 Glib::Variant<Glib::ustring> s = Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::ustring> >(value);
60 std::vector<Glib::ustring> tokens = Glib::Regex::split_simple(
",", s.get());
61 if (tokens.size() != 4) {
62 show_output(
"action:set geometry: requires 'x, y, width, height'");
66 if (
auto desktop = window->get_desktop()) {
70 int w = std::stoi(tokens[2]);
71 int h = std::stoi(tokens[3]);
75 show_output(
"this action needs active window, probably you need to add --active-window / -q");
88 {
"app.window-set-geometry", N_(
"Enter comma-separated string for x, y, width, height") }
92const Glib::ustring
SECTION = NC_(
"Action Section",
"Window");
97 {
"app.window-open", N_(
"Window Open"),
SECTION, N_(
"Open a window for the active document; GUI only") },
98 {
"app.window-close", N_(
"Window Close"),
SECTION, N_(
"Close the active window, does not check for data loss") },
99 {
"app.window-query-geometry", N_(
"Window Query Geometry"),
SECTION, N_(
"Query the active window's location and size") },
100 {
"app.window-set-geometry", N_(
"Window Set Geometry"),
SECTION, N_(
"Set the active window's location and size (x, y, width, height)") },
101 {
"app.window-crash", N_(
"Force Crash"),
SECTION, N_(
"Force Inkscape to crash, useful for testing.") },
109 Glib::VariantType String(Glib::VARIANT_TYPE_STRING);
111 gapp->add_action(
"window-open", sigc::bind(sigc::ptr_fun(&
window_open), app));
112 gapp->add_action(
"window-close", sigc::bind(sigc::ptr_fun(&
window_close), app));
114 gapp->add_action_with_parameter(
"window-set-geometry", String, sigc::bind(sigc::ptr_fun(&
window_set_geometry), app));
115 gapp->add_action(
"window-crash", [=](){
void show_output(Glib::ustring const &data, bool const is_cerr)
void window_query_geometry(InkscapeApplication *app)
std::vector< std::vector< Glib::ustring > > hint_data_window
const Glib::ustring SECTION
void window_open(InkscapeApplication *app)
void add_actions_window(InkscapeApplication *app)
void window_set_geometry(const Glib::VariantBase &value, InkscapeApplication *app)
void window_close(InkscapeApplication *app)
std::vector< std::vector< Glib::ustring > > raw_data_window
void add_data(std::vector< std::vector< Glib::ustring > > &raw_data)
void desktopCloseActive()
InkActionExtraData & get_action_extra_data()
InkscapeWindow * get_active_window()
bool document_swap(SPDesktop *desktop, SPDocument *document)
Swap out one document for another in a tab.
Gio::Application * gio_app()
The Gio application instance, never NULL.
SPDesktop * get_active_desktop()
SPDocument * get_active_document()
SPDesktop * desktopOpen(SPDocument *document)
InkActionHintData & get_action_hint_data()
SPDocument * getDocument() const
InkscapeWindow const * getInkscapeWindow() const
void setWindowSize(Geom::IntPoint const &size)
Geom::IntPoint getWindowSize() const
bool is_maximized() const
Editable view implementation.
Inkscape - An SVG editor.
Glib::ustring format_classic(T const &... args)