Blame synfig-studio/src/gui/workspacehandler.h

Rodolfo Ribeiro Gomes 4d2447
/* === S Y N F I G ========================================================= */
Rodolfo Ribeiro Gomes 4d2447
/*!	\file workspacehandler.h
Rodolfo Ribeiro Gomes 4d2447
**	\brief Handle with custom workspaces
Rodolfo Ribeiro Gomes 4d2447
**
Rodolfo Ribeiro Gomes 4d2447
**	$Id$
Rodolfo Ribeiro Gomes 4d2447
**
Rodolfo Ribeiro Gomes 4d2447
**	\legal
Rodolfo Ribeiro Gomes 4d2447
**	Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
Rodolfo Ribeiro Gomes 4d2447
**	Copyright (c) 2019 Rodolfo R Gomes
Rodolfo Ribeiro Gomes 4d2447
**
Rodolfo Ribeiro Gomes 4d2447
**	This package is free software; you can redistribute it and/or
Rodolfo Ribeiro Gomes 4d2447
**	modify it under the terms of the GNU General Public License as
Rodolfo Ribeiro Gomes 4d2447
**	published by the Free Software Foundation; either version 2 of
Rodolfo Ribeiro Gomes 4d2447
**	the License, or (at your option) any later version.
Rodolfo Ribeiro Gomes 4d2447
**
Rodolfo Ribeiro Gomes 4d2447
**	This package is distributed in the hope that it will be useful,
Rodolfo Ribeiro Gomes 4d2447
**	but WITHOUT ANY WARRANTY; without even the implied warranty of
Rodolfo Ribeiro Gomes 4d2447
**	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Rodolfo Ribeiro Gomes 4d2447
**	General Public License for more details.
Rodolfo Ribeiro Gomes 4d2447
**	\endlegal
Rodolfo Ribeiro Gomes 4d2447
*/
Rodolfo Ribeiro Gomes 4d2447
/* ========================================================================= */
Rodolfo Ribeiro Gomes 4d2447
Rodolfo Ribeiro Gomes 4d2447
#ifndef SYNFIG_STUDIO_WORKSPACEHANDLER_H
Rodolfo Ribeiro Gomes 4d2447
#define SYNFIG_STUDIO_WORKSPACEHANDLER_H
Rodolfo Ribeiro Gomes 4d2447
Rodolfo Ribeiro Gomes 4d2447
#include <iostream></iostream>
Rodolfo Ribeiro Gomes 4d2447
#include <string></string>
Rodolfo Ribeiro Gomes 4d2447
#include <map></map>
Rodolfo Ribeiro Gomes 4d2447
#include <vector></vector>
Rodolfo Ribeiro Gomes fa2e08
#include <sigc++ signal.h=""></sigc++>
Rodolfo Ribeiro Gomes 4d2447
Rodolfo Ribeiro Gomes 4d2447
namespace studio {
Rodolfo Ribeiro Gomes 4d2447
Rodolfo Ribeiro Gomes 4d2447
/// Deal with custom workspaces
Rodolfo Ribeiro Gomes 4d2447
class WorkspaceHandler
Rodolfo Ribeiro Gomes 4d2447
{
Rodolfo Ribeiro Gomes 4d2447
public:
Rodolfo Ribeiro Gomes 66fd47
	WorkspaceHandler();
Rodolfo Ribeiro Gomes 4d2447
Rodolfo Ribeiro Gomes 4d2447
	static bool is_valid_name(const std::string &name);
Rodolfo Ribeiro Gomes 4d2447
Rodolfo Ribeiro Gomes 4d2447
	bool has_workspace(const std::string &name) const;
Rodolfo Ribeiro Gomes 4d2447
	/// \param[in] tpl workspace template string
Rodolfo Ribeiro Gomes 4d2447
	bool add_workspace(const std::string &name, const std::string &tpl);
Rodolfo Ribeiro Gomes 4d2447
	void remove_workspace(const std::string &name);
Rodolfo Ribeiro Gomes 66fd47
	/// remove all workspaces layout
Rodolfo Ribeiro Gomes 66fd47
	void clear();
Rodolfo Ribeiro Gomes 4d2447
Rodolfo Ribeiro Gomes 4d2447
	/// \param[in] tpl workspace template string
Rodolfo Ribeiro Gomes 4d2447
	bool set_workspace(const std::string &name, const std::string &tpl);
Rodolfo Ribeiro Gomes 4d2447
	/// \param[out] tpl workspace template string
Rodolfo Ribeiro Gomes 4d2447
	bool get_workspace(const std::string &name, std::string &tpl) const;
Rodolfo Ribeiro Gomes 4d2447
Rodolfo Ribeiro Gomes 0ddc90
	/// \param[out] list List of workspace names
Rodolfo Ribeiro Gomes 4d2447
	void get_name_list(std::vector<std::string>& list);</std::string>
Rodolfo Ribeiro Gomes 4d2447
Rodolfo Ribeiro Gomes 66fd47
	/// load custom workspace layouts from a config file
Rodolfo Ribeiro Gomes 66fd47
	void load(const std::string& filename);
Rodolfo Ribeiro Gomes 0ddc90
	/// stores custom workspace layouts in a config file
Rodolfo Ribeiro Gomes 66fd47
	bool save(const std::string& filename);
Rodolfo Ribeiro Gomes 4d2447
Rodolfo Ribeiro Gomes fa2e08
	sigc::signal<void> & signal_list_changed();</void>
Rodolfo Ribeiro Gomes fa2e08
Rodolfo Ribeiro Gomes cbe448
	static void	trim_string(std::string &text);
Rodolfo Ribeiro Gomes cbe448
Rodolfo Ribeiro Gomes 4d2447
private:
Rodolfo Ribeiro Gomes 4d2447
	std::map<std::string, std::string=""> workspaces;</std::string,>
Rodolfo Ribeiro Gomes 4d2447
Rodolfo Ribeiro Gomes fa2e08
	sigc::signal<void> signal_list_changed_;</void>
Rodolfo Ribeiro Gomes 4d2447
};
Rodolfo Ribeiro Gomes 4d2447
Rodolfo Ribeiro Gomes 4d2447
}
Rodolfo Ribeiro Gomes 4d2447
Rodolfo Ribeiro Gomes 4d2447
#endif // SYNFIG_STUDIO_WORKSPACEHANDLER_H