OXYGENHUB
◆ main openmsx / src / imgui / ImGuiTools.hh
2.4 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
#ifndef IMGUI_TOOLS_HH
2
#define IMGUI_TOOLS_HH
3
4
#include "ImGuiPart.hh"
5
#include "ImGuiUtils.hh"
6
7
namespace openmsx {
8
9
class ImGuiTools final : public ImGuiPart
10
{
11
public:
12
	explicit ImGuiTools(ImGuiManager& manager);
13
14
	[[nodiscard]] zstring_view iniName() const override { return "tools"; }
15
	void save(ImGuiTextBuffer& buf) override;
16
	void loadStart() override;
17
	void loadLine(std::string_view name, zstring_view value) override;
18
	void showMenu(MSXMotherBoard* motherBoard) override;
19
	void paint(MSXMotherBoard* motherBoard) override;
20
21
private:
22
	struct Note {
23
		std::string text;
24
		bool show = false;
25
	};
26
27
private:
28
	void paintScreenshot();
29
	void paintRecord();
30
	void paintNotes();
31
32
	[[nodiscard]] bool screenshotNameExists() const;
33
	void generateScreenshotName();
34
	void nextScreenshotName();
35
36
	[[nodiscard]] std::string getRecordFilename() const;
37
38
private:
39
	bool showScreenshot = false;
40
	bool showRecord = false;
41
42
	std::string screenshotName;
43
	enum class SsType : int { RENDERED, MSX, NUM };
44
	int screenshotType = static_cast<int>(SsType::RENDERED);
45
	enum class SsSize : int { S_320, S_640, AUTO, NUM }; // keep order for bw compat of persisted element
46
	int screenshotSize = static_cast<int>(SsSize::AUTO);
47
	bool screenshotWithOsd = false;
48
	bool screenshotHideSprites = false;
49
50
	std::string recordName;
51
	enum class Source : int { AUDIO, VIDEO, BOTH, NUM };
52
	int recordSource = static_cast<int>(Source::BOTH);
53
	enum class Audio : int { MONO, STEREO, AUTO, NUM };
54
	int recordAudio = static_cast<int>(Audio::AUTO);
55
	enum class VideoSize : int { V_320, V_640, V_960, NUM };
56
	int recordVideoSize = static_cast<int>(VideoSize::V_320);
57
58
	ConfirmDialogTclCommand confirmDialog;
59
60
	std::vector<Note> notes;
61
62
	static constexpr auto persistentElements = std::tuple{
63
		PersistentElement{"showScreenshot",  &ImGuiTools::showScreenshot},
64
		PersistentElement{"showRecord", &ImGuiTools::showRecord},
65
		PersistentElementMax{"screenshotType", &ImGuiTools::screenshotType, static_cast<int>(SsType::NUM)},
66
		PersistentElementMax{"screenshotSize", &ImGuiTools::screenshotSize, static_cast<int>(SsSize::NUM)},
67
		PersistentElement{"screenshotWithOsd", &ImGuiTools::screenshotWithOsd},
68
		PersistentElementMax{"recordSource", &ImGuiTools::recordSource, static_cast<int>(Source::NUM)},
69
		PersistentElementMax{"recordAudio", &ImGuiTools::recordAudio, static_cast<int>(Audio::NUM)},
70
		PersistentElementMax{"recordVideoSize", &ImGuiTools::recordVideoSize, static_cast<int>(VideoSize::NUM)}
71
	};
72
};
73
74
} // namespace openmsx
75
76
#endif