4#ifndef __ZRYTHM_APP_H__
5#define __ZRYTHM_APP_H__
7#include "zrythm-config.h"
11#include "common/utils/types.h"
12#include "common/utils/ui.h"
14#include "gui/backend/gtk_widgets/gtk_wrapper.h"
15#include "gui/backend/gtk_widgets/libadwaita_wrapper.h"
17#define ZRYTHM_APP_IS_GTK_THREAD \
18 (zrythm_app && zrythm_app->gtk_thread_id_ == current_thread_id.get ())
21TYPEDEF_STRUCT_UNDERSCORED (BugReportDialogWidget);
34struct ZrythmAppUiMessage
36 ZrythmAppUiMessage (GtkMessageType type, std::string msg)
37 : type_ (type), msg_ (std::move (msg))
62 void set_font_scale (
double font_scale);
94 const std::string &primary,
95 const std::string &secondary,
96 const std::string &action_name);
108 void on_plugin_scan_finished ();
121 void on_activate ()
override;
129 const Gio::Application::type_vec_files &files,
130 const Glib::ustring &hint)
override;
150 void add_option_entries ();
153 on_handle_local_options (
const Glib::RefPtr<Glib::VariantDict> &opts)
override;
157 void print_settings ();
158 void reset_to_factory ();
166 void on_setup_main_window ();
174 void on_prompt_for_project ();
181 void on_load_project ();
200 std::unique_ptr<UiCaches> ui_caches_;
215 bool have_svg_loader_ =
false;
233 std::mutex startup_error_queue_mutex_;
243 char ** argv_ =
nullptr;
255 std::mutex queue_mutex_;
260 std::unique_ptr<ProjectInitFlowManager> project_init_flow_mgr_;
262 guint project_autosave_source_id_ = 0;
This can just be created on the stack as needed since it uses globally available information.
static void exit_response_callback(AdwDialog *dialog, gpointer user_data)
To be used to exit Zrythm using the "response" signal on a message dialog.
std::string appimage_runtime_path_
AppImage runtime path, if AppImage build.
void check_for_updates()
Handles the logic for checking for updates on startup.
MainWindowWidget * main_window_
Main window.
bool rt_priority_message_shown_
Flag used to only show the RT priority message once.
std::queue< std::string > startup_error_queue_
Messages to show when the main window is shown.
int samplerate_
Samplerate passed with –samplerate=, if any.
bool is_first_run_
True if this is the first time Zrythm is runh.
void on_open(const Gio::Application::type_vec_files &files, const Glib::ustring &hint) override
Called when a filename is passed to the command line instead of activate.
std::string output_file_
Output file passed with –output.
std::string midi_backend_
MIDI backend passed with –audio-backend=, if any.
std::string get_primary_accel_for_action(const std::string &action_name)
Get the primary accelerator for an action.
void init_recent_projects()
Initializes the array of recent projects in Zrythm app.
unsigned int gtk_thread_id_
The GTK thread where the main GUI loop runs.
void on_startup() override
First function that gets called afted CLI args are parsed and processed.
void install_action_accel(const std::string &primary, const std::string &secondary, const std::string &action_name)
Install accelerator for an action.
int prompt_for_project_func()
Unlike the init thread, this will run in the main GTK thread.
Glib::RefPtr< Gtk::Settings > default_settings_
Default settings (got from gtk_settings_get_default()).
ZrythmApp(int argc, const char **argv)
Creates the application.
bool init_finished_
Flag to set when initialization has finished.
bool pretty_print_
Whether to pretty-print.
std::queue< ZrythmAppUiMessage > project_load_message_queue_
Queue for messages to be shown when the project loads.
int buf_size_
Buffer size passed with –buf-size=, if any.
void on_shutdown() override
Called immediately after the main GTK loop terminates.
bool check_and_show_trial_limit_error()
Shows the trial limitation error message.
std::string audio_backend_
Audio backend passed with –audio-backend=, if any.
GreeterWidget * greeter_
Greeter screen.
BugReportDialogWidget * bug_report_dialog_
Currently opened bug report dialog.
Glib::RefPtr< ZrythmApp > zrythm_app
Global variable, should be available to all files.