diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2018-11-12 20:22:44 +0000 |
|---|---|---|
| committer | Alexander Valavanis <valavanisalex@gmail.com> | 2018-11-18 12:39:15 +0000 |
| commit | 408cb49b5559a81ea803df64bf58457a5dd4bf16 (patch) | |
| tree | ce3eac6a8bf8f641ba1c71b72f228080d201bb6d /src/inkscape-application.h | |
| parent | Fix stream class locations (diff) | |
| download | inkscape-408cb49b5559a81ea803df64bf58457a5dd4bf16.tar.gz inkscape-408cb49b5559a81ea803df64bf58457a5dd4bf16.zip | |
Rewrite of main.cpp using InkscapeApplication (Gtk::Application)
Use Gio::File for accessing files.
Use Gio options to handle command line arguments.
Use Gio::Actions for some command line arguments.
Move file export code to src/io/file-export-cmd.h/.cpp. Make into class.
Diffstat (limited to 'src/inkscape-application.h')
| -rw-r--r-- | src/inkscape-application.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/inkscape-application.h b/src/inkscape-application.h new file mode 100644 index 000000000..b176c2921 --- /dev/null +++ b/src/inkscape-application.h @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * The main Inkscape application. + * + * Copyright (C) 2018 Tavmjong Bah + * + * The contents of this file may be used under the GNU General Public License Version 2 or later. + * + */ + +#ifndef INKSCAPE_APPLICATION_H +#define INKSCAPE_APPLICATION_H + +/* + * The main Inkscape application. + * + * Copyright (C) 2018 Tavmjong Bah + * + * The contents of this file may be used under the GNU General Public License Version 2 or later. + * + */ + +#include <gtkmm.h> + +#include "document.h" +#include "helper/action.h" +#include "io/file-export-cmd.h" // File export (non-verb) + +class InkscapeApplication : public Gtk::Application +{ +protected: + InkscapeApplication(); + +public: + static Glib::RefPtr<InkscapeApplication> create(); + + SPDocument* get_active_document(); + +protected: + void on_startup() override; + void on_startup2(); + void on_activate() override; + void on_open(const Gio::Application::type_vec_files& files, const Glib::ustring& hint) override; + +private: + void create_window(const Glib::RefPtr<Gio::File>& file = Glib::RefPtr<Gio::File>()); + +private: + // Callbacks + int on_handle_local_options(const Glib::RefPtr<Glib::VariantDict>& options); + + // Actions + void on_new(); + void on_quit(); + void on_about(); + + Glib::RefPtr<Gtk::Builder> _builder; + + bool _with_gui; + InkFileExportCmd _file_export; + + // Documents are owned by the application which is responsible for opening/saving/exporting. WIP + std::vector<SPDocument*> _documents; + + // Actions from the command line or file. + std::vector<std::pair<std::string, Glib::VariantBase> > _command_line_actions; +}; + +#endif // INKSCAPE_APPLICATION_H + +/* + 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 : |
