2019-10-09 22:50:34 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2019 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
*
|
|
|
|
* This program 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 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __gtk2_ardour_startup_fsm_h__
|
|
|
|
#define __gtk2_ardour_startup_fsm_h__
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <sigc++/trackable.h>
|
|
|
|
|
|
|
|
#include "ardour/types.h"
|
|
|
|
|
2024-10-19 09:54:24 -04:00
|
|
|
namespace Gtk
|
|
|
|
{
|
|
|
|
class Window;
|
|
|
|
} // namespace Gtk
|
|
|
|
|
2019-10-24 23:14:00 -04:00
|
|
|
class ArdourDialog;
|
2019-10-09 22:50:34 -04:00
|
|
|
class NewUserWizard;
|
|
|
|
class EngineControl;
|
|
|
|
class SessionDialog;
|
2019-10-24 23:14:00 -04:00
|
|
|
class PluginScanDialog;
|
2019-10-09 22:50:34 -04:00
|
|
|
|
|
|
|
class StartupFSM : public sigc::trackable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum DialogID {
|
2019-10-10 23:24:52 -04:00
|
|
|
PreReleaseDialog,
|
2019-10-09 22:50:34 -04:00
|
|
|
NewUserDialog,
|
|
|
|
NewSessionDialog,
|
2019-10-24 23:14:00 -04:00
|
|
|
AudioMIDISetup,
|
2020-03-06 17:53:31 -05:00
|
|
|
PluginDialog,
|
|
|
|
ApplicationPseudoDialog,
|
2019-10-09 22:50:34 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum Result {
|
|
|
|
LoadSession,
|
2024-02-14 18:33:34 -05:00
|
|
|
LoadedSession,
|
2019-10-09 22:50:34 -04:00
|
|
|
ExitProgram,
|
2022-11-28 12:18:43 -05:00
|
|
|
QuitProgram,
|
2019-10-09 22:50:34 -04:00
|
|
|
};
|
|
|
|
|
2019-10-24 23:14:00 -04:00
|
|
|
enum MainState {
|
2023-09-18 18:26:41 -04:00
|
|
|
NotWaiting,
|
2019-10-24 23:14:00 -04:00
|
|
|
WaitingForPreRelease,
|
|
|
|
WaitingForNewUser,
|
|
|
|
WaitingForSessionPath,
|
|
|
|
WaitingForEngineParams,
|
|
|
|
WaitingForPlugins
|
|
|
|
};
|
|
|
|
|
2019-10-09 22:50:34 -04:00
|
|
|
StartupFSM (EngineControl&);
|
|
|
|
~StartupFSM ();
|
|
|
|
|
|
|
|
void start ();
|
2019-10-24 23:14:00 -04:00
|
|
|
void reset ();
|
2019-10-09 22:50:34 -04:00
|
|
|
|
2023-09-14 13:36:10 -04:00
|
|
|
std::string session_path;
|
|
|
|
std::string session_name;
|
|
|
|
std::string session_template;
|
|
|
|
Temporal::TimeDomain session_domain;
|
|
|
|
int session_existing_sample_rate;
|
|
|
|
XMLNode session_engine_hints;
|
|
|
|
bool session_is_new;
|
|
|
|
bool session_name_edited;
|
2024-02-14 18:33:34 -05:00
|
|
|
bool session_loaded;
|
2020-03-24 12:38:24 -04:00
|
|
|
|
2019-10-09 22:50:34 -04:00
|
|
|
ARDOUR::BusProfile bus_profile;
|
|
|
|
|
|
|
|
/* It's not a dialog but we provide this to make it behave like a (non-modal)
|
|
|
|
* dialog
|
|
|
|
*/
|
|
|
|
|
|
|
|
sigc::signal1<void,Result>& signal_response() { return _signal_response; }
|
|
|
|
|
|
|
|
bool brand_new_user() const { return new_user; }
|
2020-03-01 23:35:44 -05:00
|
|
|
void handle_path (std::string const & path);
|
|
|
|
|
2023-09-18 18:26:41 -04:00
|
|
|
bool complete() const { return _state == NotWaiting; }
|
2023-11-14 13:02:08 -05:00
|
|
|
void set_complete ();
|
2023-09-18 18:26:41 -04:00
|
|
|
|
2019-10-09 22:50:34 -04:00
|
|
|
private:
|
|
|
|
bool new_user;
|
2019-10-24 23:14:00 -04:00
|
|
|
bool new_session_required;
|
2019-10-09 22:50:34 -04:00
|
|
|
|
|
|
|
MainState _state;
|
|
|
|
|
2019-10-24 23:14:00 -04:00
|
|
|
void set_state (MainState);
|
2019-10-09 22:50:34 -04:00
|
|
|
void dialog_response_handler (int response, DialogID);
|
2019-10-24 23:14:00 -04:00
|
|
|
template<typename T> void end_dialog (T**);
|
|
|
|
template<typename T> void end_dialog (T&);
|
2019-10-09 22:50:34 -04:00
|
|
|
|
2019-10-24 23:14:00 -04:00
|
|
|
void show_new_user_dialog ();
|
2019-10-10 23:24:52 -04:00
|
|
|
void show_session_dialog (bool new_session_required);
|
2019-10-09 22:50:34 -04:00
|
|
|
void show_audiomidi_dialog ();
|
2019-10-10 23:24:52 -04:00
|
|
|
void show_pre_release_dialog ();
|
2019-10-24 23:14:00 -04:00
|
|
|
void show_plugin_scan_dialog ();
|
2019-10-10 23:24:52 -04:00
|
|
|
|
2019-10-09 22:50:34 -04:00
|
|
|
void copy_demo_sessions ();
|
|
|
|
bool get_session_parameters_from_command_line (bool new_session_required);
|
|
|
|
bool get_session_parameters_from_path (std::string const & path, std::string const & template_name, bool new_session_required);
|
|
|
|
void queue_finish ();
|
|
|
|
bool ask_about_loading_existing_session (const std::string& session_path);
|
|
|
|
int check_session_parameters (bool must_be_new);
|
2019-10-12 14:10:10 -04:00
|
|
|
void start_audio_midi_setup ();
|
2019-10-24 23:14:00 -04:00
|
|
|
void engine_running ();
|
2019-12-12 15:32:42 -05:00
|
|
|
void handle_waiting_for_session_path ();
|
2019-10-24 23:14:00 -04:00
|
|
|
|
|
|
|
/* the Audio/MIDI dialog needs to be persistent and is thus owned by
|
|
|
|
* ARDOUR_UI and we use it by reference. All other dialogs can be
|
|
|
|
* created and destroyed within the scope of startup.
|
|
|
|
*/
|
2019-10-09 22:50:34 -04:00
|
|
|
|
|
|
|
EngineControl& audiomidi_dialog;
|
2019-10-24 23:14:00 -04:00
|
|
|
NewUserWizard* new_user_dialog;
|
2019-10-09 22:50:34 -04:00
|
|
|
SessionDialog* session_dialog;
|
2019-10-10 23:24:52 -04:00
|
|
|
ArdourDialog* pre_release_dialog;
|
2019-10-24 23:14:00 -04:00
|
|
|
PluginScanDialog* plugin_scan_dialog;
|
|
|
|
|
2019-10-09 22:50:34 -04:00
|
|
|
sigc::connection current_dialog_connection;
|
2023-10-09 11:19:17 -04:00
|
|
|
sigc::connection app_quit_connection;
|
2023-11-14 13:01:39 -05:00
|
|
|
sigc::connection hide_quit_connection;
|
2019-10-09 22:50:34 -04:00
|
|
|
|
|
|
|
sigc::signal1<void,Result> _signal_response;
|
2019-11-06 18:32:46 -05:00
|
|
|
|
|
|
|
void dialog_hidden (Gtk::Window*);
|
2019-10-09 22:50:34 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __gtk2_ardour_startup_fsm_h__ */
|