19#include <gdkmm/surface.h>
21#include <gtkmm/popovermenubar.h>
22#include <gtkmm/shortcutcontroller.h>
23#include <sigc++/functors/mem_fun.h>
64 , _document{
desktop->getDocument()}
69 set_name(
"InkscapeWindow");
70 set_show_menubar(
true);
98 auto connection =
_app->
gio_app()->get_dbus_connection();
100 std::string document_action_group_name =
_app->
gio_app()->get_dbus_object_path() +
"/document/" + std::to_string(get_id());
131 bool shift_icons = prefs->getInt(
"/theme/shiftIcons",
true);
133 if (
auto const menubar =
dynamic_cast<Gtk::PopoverMenuBar *
>(
child)) {
135 if (shifted) shift_icons =
false;
148 shortcuts_instance.connect_changed([
this]() {
155 shortcuts_instance.update_gui_text_recursive(
this);
160 Gtk::ApplicationWindow::on_realize();
174 std::cerr <<
"Inkscapewindow::change_document: app is nullptr!" << std::endl;
193 auto prefs = Preferences::get();
196 for (
auto const &window :
parent.get_application()->get_windows()) {
197 if (
auto dialog_window =
dynamic_cast<DialogWindow *
>(window)) {
199 dialog_window->set_transient_for(
parent);
201 dialog_window->unset_transient_for();
207Glib::RefPtr<Gdk::Toplevel const>
210 return std::dynamic_pointer_cast<Gdk::Toplevel const>(get_surface());
216 return toplevel->get_state();
265 std::cerr <<
"Inkscapewindow::on_focus_in_event: app is nullptr!" << std::endl;
294 for (
auto desktop : desktops) {
314 auto prefs = Preferences::get();
317 prefs->setBool(
"/desktop/geometry/fullscreen", full);
318 prefs->setBool(
"/desktop/geometry/maximized", maxed);
326 get_default_size(
w, h);
327 prefs->setInt(
"/desktop/geometry/width",
w);
328 prefs->setInt(
"/desktop/geometry/height", h);
334 if (
auto const surface = get_surface()) {
336 surface->get_frame_extents(rect);
337 prefs->setInt(
"/desktop/geometry/x", rect.get_x());
338 prefs->setInt(
"/desktop/geometry/y", rect.get_y());
346 for (
auto const &window :
_app->
gtk_app()->get_windows()) {
347 if (
auto dialog_window =
dynamic_cast<DialogWindow *
>(window)) {
349 dialog_window->set_inkscape_window(
this);
364 insert_action_group(
"doc", doc_action_group);
372 for (
auto const &
action_name : doc_action_group->list_actions()) {
373 add_action(doc_action_group->lookup_action(
action_name));
void add_actions_canvas_mode(InkscapeWindow *win)
void add_actions_canvas_snapping(Gio::ActionMap *map)
void add_actions_dialogs(InkscapeApplication *app)
void add_actions_edit_window(InkscapeWindow *win)
Authors: Sushant A A sushant.co19@gmail.com
void add_actions_file_window(InkscapeWindow *win)
Authors: Sushant A A sushant.co19@gmail.com
void add_actions_help_url(InkscapeWindow *win)
Authors: Sushant A A sushant.co19@gmail.com
void add_actions_layer(InkscapeWindow *win)
Authors: Sushant A A sushant.co19@gmail.com
void add_actions_node_align(InkscapeWindow *win)
void add_actions_page_tools(InkscapeWindow *win)
void add_actions_path(InkscapeApplication *app)
void add_actions_select_window(InkscapeWindow *win)
Authors: Sushant A A sushant.co19@gmail.com
void add_actions_view_mode(InkscapeWindow *win)
Authors: Sushant A A sushant.co19@gmail.com
void add_actions_view_window(InkscapeWindow *win)
Authors: Sushant A A sushant.co19@gmail.com
Cairo::RefPtr< Cairo::ImageSurface > surface
void set_active_desktop(SPDesktop *desktop)
void set_active_window(InkscapeWindow *window)
bool destroyDesktop(SPDesktop *desktop, bool keep_alive=false)
Destroy a window and close the document it contains.
void set_active_selection(Inkscape::Selection *selection)
Gio::Application * gio_app()
The Gio application instance, never NULL.
void set_active_document(SPDocument *document)
Gtk::Application * gtk_app()
The Gtk application instance, or NULL if running headless without display.
int get_number_of_windows() const
Return number of open Inkscape Windows (irrespective of number of documents)
InkscapeApplication * _app
void setActiveTab(SPDesktop *desktop)
sigc::scoped_connection _toplevel_state_connection
bool on_close_request() override
void on_size_changed()
Configure is called when the widget's size, position or stack changes.
SPDesktopWidget * _desktop_widget
void on_is_active_changed()
void on_realize() override
void add_document_actions()
Make document actions accessible from the window.
Gdk::Toplevel::State _old_toplevel_state
Glib::RefPtr< Gdk::Toplevel const > get_toplevel() const
InkscapeWindow(SPDesktop *desktop)
SPDesktopWidget * get_desktop_widget()
~InkscapeWindow() override
bool isFullscreen() const
Glib::RefPtr< Gtk::ShortcutController > _shortcut_controller
void change_document(SPDocument *document)
void on_toplevel_state_changed()
Gdk::Toplevel::State get_toplevel_state() const
static Preferences * get()
Access the singleton Preferences object.
static Shortcuts & getInstance(bool init=true)
A widget that manages DialogNotebook's and other widgets inside a horizontal DialogMultipaned contain...
DialogWindow holds DialogContainer instances for undocked dialogs.
To do: update description of desktop.
SPDocument * getDocument() const
Inkscape::Selection * getSelection() const
void onWindowStateChanged(Gdk::Toplevel::State changed, Gdk::Toplevel::State new_toplevel_state)
onWindowStateChanged
Typed SVG document implementation.
Glib::RefPtr< Gio::SimpleActionGroup > getActionGroup()
Editable view implementation.
A window for floating docks.
static char const *const parent
@ PREFS_DIALOGS_WINDOWS_NORMAL
@ PREFS_DIALOGS_WINDOWS_NONE
static void retransientize_dialogs(Gtk::Window &parent)
If "dialogs on top" is activated in the preferences, set parent as the new transient parent for all D...
Inkscape - An SVG editor.
std::vector< Gtk::Widget * > get_children(Gtk::Widget &widget)
Get a vector of the widgetʼs children, from get_first_child() through each get_next_sibling().
constexpr bool has_flag(T test, T flag)