/* This file is part of Patchage. * Copyright 2007-2020 David Robillard * * Patchage is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) * any later version. * * Patchage is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. * * You should have received a copy of the GNU General Public License * along with Patchage. If not, see . */ #ifndef PATCHAGE_PATCHAGE_HPP #define PATCHAGE_PATCHAGE_HPP #include #include #include #include #include #include #include "ClientType.hpp" #include "Configuration.hpp" #include "Connector.hpp" #include "Event.hpp" #include "Metadata.hpp" #include "Options.hpp" #include "PortType.hpp" #include "TextViewLog.hpp" #include "Widget.hpp" #include #include #include #include #include namespace Glib { class ustring; } // namespace Glib namespace Gtk { class AboutDialog; class Alignment; class Builder; class ComboBox; class ImageMenuItem; class Label; class Main; class MenuBar; class MenuItem; class Paned; class ScrolledWindow; class TextTag; class TextView; class ToolButton; class Toolbar; class VBox; class Window; } // namespace Gtk namespace patchage { class AudioDriver; class Canvas; class Driver; class ILog; class Legend; /// Main application class class Patchage { public: explicit Patchage(Options options); ~Patchage(); Patchage(const Patchage&) = delete; Patchage& operator=(const Patchage&) = delete; Patchage(Patchage&&) = delete; Patchage& operator=(Patchage&&) = delete; const std::unique_ptr& canvas() const { return _canvas; } void attach(); void refresh(); void save(); void quit(); void driver_attached(ClientType type); void driver_detached(ClientType type); void store_window_location(); bool show_human_names() const { return _menu_view_human_names->get_active(); } bool sort_ports() const { return _menu_view_sort_ports->get_active(); } Gtk::Window* window() { return _main_win.get(); } ILog& log() { return _log; } Metadata& metadata() { return _metadata; } const Configuration& conf() const { return _conf; } Configuration& conf() { return _conf; } protected: class BufferSizeColumns : public Gtk::TreeModel::ColumnRecord { public: BufferSizeColumns() { add(label); } Gtk::TreeModelColumn label; }; void on_driver_event(const Event& event); void process_events(); void on_arrange(); void on_sprung_layout_toggled(); void on_help_about(); void on_quit(); void on_export_image(); void on_view_messages(); void on_view_toolbar(); void on_store_positions(); void on_view_human_names(); void on_view_sort_ports(); void on_zoom_in(); void on_zoom_out(); void on_zoom_normal(); void on_zoom_full(); void on_increase_font_size(); void on_decrease_font_size(); void on_normal_font_size(); void on_legend_color_change(PortType id, const std::string& label, uint32_t rgba); void on_messages_resized(Gtk::Allocation& alloc); bool on_scroll(GdkEventScroll* ev); bool idle_callback(); void clear_load(); bool update_load(); void update_toolbar(); void buffer_size_changed(); Glib::RefPtr _xml; std::mutex _events_mutex; std::queue _driver_events; std::unique_ptr _alsa_driver; std::unique_ptr _canvas; std::unique_ptr _jack_driver; Configuration _conf; Gtk::Main* _gtk_main; BufferSizeColumns _buf_size_columns; Widget _about_win; Widget _main_scrolledwin; Widget _main_win; Widget _main_vbox; Widget _menubar; Widget _menu_alsa_connect; Widget _menu_alsa_disconnect; Widget _menu_file_quit; Widget _menu_export_image; Widget _menu_help_about; Widget _menu_jack_connect; Widget _menu_jack_disconnect; Widget _menu_view_arrange; Widget _menu_view_sprung_layout; Widget _menu_view_messages; Widget _menu_view_toolbar; Widget _menu_view_refresh; Widget _menu_view_human_names; Widget _menu_view_sort_ports; Widget _menu_zoom_in; Widget _menu_zoom_out; Widget _menu_zoom_normal; Widget _menu_zoom_full; Widget _menu_increase_font_size; Widget _menu_decrease_font_size; Widget _menu_normal_font_size; Widget _toolbar; Widget _clear_load_but; Widget _dropouts_label; Widget _buf_size_combo; Widget _latency_label; Widget _legend_alignment; Widget _main_paned; Widget _log_scrolledwindow; Widget _status_text; Legend* _legend; TextViewLog _log; Connector _connector; Metadata _metadata; Glib::RefPtr _error_tag; Glib::RefPtr _warning_tag; Options _options; bool _pane_initialized; bool _attach; }; } // namespace patchage #endif // PATCHAGE_PATCHAGE_HPP