summaryrefslogtreecommitdiffstats
path: root/src/inkscape-window.cpp
blob: 7227993cf112de578a7f7cdf815a6de97a8ca84f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// SPDX-License-Identifier: GPL-2.0-or-later
/**
 * @file
 * Inkscape - An SVG editor.
 */
/*
 * Authors:
 *   Tavmjong Bah
 *
 * Copyright (C) 2018 Authors
 *
 * The contents of this file may be used under the GNU General Public License Version 2 or later.
 * Read the file 'COPYING' for more information.
 *
 */


#include "inkscape-window.h"
#include "inkscape.h"   // SP_ACTIVE_DESKTOP
#include "shortcuts.h"

#include "widgets/desktop-widget.h"

InkscapeWindow::InkscapeWindow(SPDocument* document)
    : _document(document)
{
    set_resizable(true);

    // Callbacks
    signal_key_press_event().connect(sigc::mem_fun(*this, &InkscapeWindow::key_press));

    // Actions
}

// TEMP: We should be creating the desktop widget and desktop in constructor.
void
InkscapeWindow::set_desktop_widget(SPDesktopWidget* desktop_widget)
{
    gtk_container_add(GTK_CONTAINER(gobj()), GTK_WIDGET(desktop_widget));
    gtk_widget_show(GTK_WIDGET(desktop_widget));
    _desktop = desktop_widget->desktop;
}

bool
InkscapeWindow::key_press(GdkEventKey* event)
{
    unsigned shortcut = sp_shortcut_get_for_event(event);
    return sp_shortcut_invoke (shortcut, _desktop);
}

/*
  Local Variables:
  mode:c++
  c-file-style:"stroustrup"
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  indent-tabs-mode:nil
  fill-column:99
  End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :