openMSX
ImGuiTools.hh
Go to the documentation of this file.
1#ifndef IMGUI_TOOLS_HH
2#define IMGUI_TOOLS_HH
3
4#include "ImGuiPart.hh"
5
6#include "TclObject.hh"
7
8namespace openmsx {
9
10class ImGuiTools final : public ImGuiPart
11{
12public:
14
15 [[nodiscard]] zstring_view iniName() const override { return "tools"; }
16 void save(ImGuiTextBuffer& buf) override;
17 void loadStart() override;
18 void loadLine(std::string_view name, zstring_view value) override;
19 void showMenu(MSXMotherBoard* motherBoard) override;
20 void paint(MSXMotherBoard* motherBoard) override;
21
22private:
23 struct Note {
24 std::string text;
25 bool show = false;
26 };
27
28private:
29 void paintScreenshot();
30 void paintRecord();
31 void paintNotes();
32
33 [[nodiscard]] bool screenshotNameExists() const;
34 void generateScreenshotName();
35 void nextScreenshotName();
36
37 [[nodiscard]] std::string getRecordFilename() const;
38
39private:
40 bool showScreenshot = false;
41 bool showRecord = false;
42
43 std::string screenshotName;
44 enum class SsType : int { RENDERED, MSX, NUM };
45 int screenshotType = static_cast<int>(SsType::RENDERED);
46 enum class SsSize : int { S_320, S_640, NUM };
47 int screenshotSize = static_cast<int>(SsSize::S_320);
48 bool screenshotWithOsd = false;
49 bool screenshotHideSprites = false;
50
51 std::string recordName;
52 enum class Source : int { AUDIO, VIDEO, BOTH, NUM };
53 int recordSource = static_cast<int>(Source::BOTH);
54 enum class Audio : int { MONO, STEREO, AUTO, NUM };
55 int recordAudio = static_cast<int>(Audio::AUTO);
56 enum class VideoSize : int { V_320, V_640, V_960, NUM };
57 int recordVideoSize = static_cast<int>(VideoSize::V_320);
58
59 TclObject confirmCmd;
60 std::string confirmText;
61 bool openConfirmPopup = false;
62
63 std::vector<Note> notes;
64
65 static constexpr auto persistentElements = std::tuple{
66 PersistentElement{"showScreenshot", &ImGuiTools::showScreenshot},
67 PersistentElement{"showRecord", &ImGuiTools::showRecord},
68 PersistentElementMax{"screenshotType", &ImGuiTools::screenshotType, static_cast<int>(SsType::NUM)},
69 PersistentElementMax{"screenshotSize", &ImGuiTools::screenshotSize, static_cast<int>(SsSize::NUM)},
70 PersistentElement{"screenshotWithOsd", &ImGuiTools::screenshotWithOsd},
71 PersistentElementMax{"recordSource", &ImGuiTools::recordSource, static_cast<int>(Source::NUM)},
72 PersistentElementMax{"recordAudio", &ImGuiTools::recordAudio, static_cast<int>(Audio::NUM)},
73 PersistentElementMax{"recordVideoSize", &ImGuiTools::recordVideoSize, static_cast<int>(VideoSize::NUM)}
74 };
75};
76
77} // namespace openmsx
78
79#endif
ImGuiPart(ImGuiManager &manager_)
Definition ImGuiPart.hh:12
void loadLine(std::string_view name, zstring_view value) override
Definition ImGuiTools.cc:49
void loadStart() override
Definition ImGuiTools.cc:44
zstring_view iniName() const override
Definition ImGuiTools.hh:15
void showMenu(MSXMotherBoard *motherBoard) override
Definition ImGuiTools.cc:85
void paint(MSXMotherBoard *motherBoard) override
void save(ImGuiTextBuffer &buf) override
Definition ImGuiTools.cc:34
Like std::string_view, but with the extra guarantee that it refers to a zero-terminated string.
constexpr unsigned NUM
Definition CacheLine.hh:8
This file implemented 3 utility functions:
Definition Autofire.cc:11
PersistentElement(zstring_view, T C::*) -> PersistentElement< C, T >