2012-10-30 17:00:44 +04:00
|
|
|
#ifndef client_manager_hh_INCLUDED
|
|
|
|
#define client_manager_hh_INCLUDED
|
|
|
|
|
2013-09-13 01:47:23 +04:00
|
|
|
#include "client.hh"
|
2014-04-08 00:43:55 +04:00
|
|
|
#include "completion.hh"
|
2012-10-30 17:00:44 +04:00
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
struct client_removed{};
|
|
|
|
|
2014-01-28 00:28:38 +04:00
|
|
|
struct WindowAndSelections
|
|
|
|
{
|
|
|
|
std::unique_ptr<Window> window;
|
2014-05-13 02:25:15 +04:00
|
|
|
SelectionList selections;
|
|
|
|
size_t timestamp;
|
2014-01-28 00:28:38 +04:00
|
|
|
};
|
2013-12-21 00:10:08 +04:00
|
|
|
|
2012-10-30 17:00:44 +04:00
|
|
|
class ClientManager : public Singleton<ClientManager>
|
|
|
|
{
|
|
|
|
public:
|
2013-02-07 22:25:42 +04:00
|
|
|
ClientManager();
|
|
|
|
~ClientManager();
|
|
|
|
|
2013-09-13 01:47:23 +04:00
|
|
|
Client* create_client(std::unique_ptr<UserInterface>&& ui,
|
2014-04-08 00:25:44 +04:00
|
|
|
EnvVarMap env_vars, const String& init_cmd);
|
2012-10-30 17:00:44 +04:00
|
|
|
|
|
|
|
bool empty() const { return m_clients.empty(); }
|
|
|
|
size_t count() const { return m_clients.size(); }
|
2012-10-31 17:23:44 +04:00
|
|
|
|
2012-11-07 17:02:23 +04:00
|
|
|
void ensure_no_client_uses_buffer(Buffer& buffer);
|
2012-11-05 22:15:42 +04:00
|
|
|
|
2013-12-21 00:10:08 +04:00
|
|
|
WindowAndSelections get_free_window(Buffer& buffer);
|
|
|
|
void add_free_window(std::unique_ptr<Window>&& window, SelectionList selections);
|
|
|
|
|
2012-11-05 22:58:04 +04:00
|
|
|
void redraw_clients() const;
|
2012-12-03 21:56:53 +04:00
|
|
|
|
2013-12-07 17:43:48 +04:00
|
|
|
Client* get_client_ifp(const String& name);
|
2013-09-13 01:47:23 +04:00
|
|
|
Client& get_client(const String& name);
|
2013-09-13 02:01:47 +04:00
|
|
|
bool validate_client_name(const String& name) const;
|
2013-09-13 01:47:23 +04:00
|
|
|
void remove_client(Client& client);
|
2013-04-15 16:28:21 +04:00
|
|
|
|
2014-04-18 17:02:14 +04:00
|
|
|
CandidateList complete_client_name(StringView name,
|
2014-04-08 00:43:55 +04:00
|
|
|
ByteCount cursor_pos = -1) const;
|
|
|
|
|
2012-10-30 17:00:44 +04:00
|
|
|
private:
|
2013-01-07 16:59:09 +04:00
|
|
|
String generate_name() const;
|
2012-11-20 21:54:35 +04:00
|
|
|
|
2013-09-13 01:47:23 +04:00
|
|
|
std::vector<std::unique_ptr<Client>> m_clients;
|
2013-12-21 00:10:08 +04:00
|
|
|
std::vector<WindowAndSelections> m_free_windows;
|
2012-10-30 17:00:44 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // client_manager_hh_INCLUDED
|
|
|
|
|