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 loadLine(std::string_view name, zstring_view value) override;
18 void showMenu(MSXMotherBoard* motherBoard) override;
19 void paint(MSXMotherBoard* motherBoard) override;
20
21private:
22 void paintScreenshot();
23 void paintRecord();
24
25 [[nodiscard]] bool screenshotNameExists() const;
26 void generateScreenshotName();
27 void nextScreenshotName();
28
29 [[nodiscard]] std::string getRecordFilename() const;
30
31private:
32 bool showScreenshot = false;
33 bool showRecord = false;
34
35 std::string screenshotName;
36 enum class SsType : int { RENDERED, MSX, NUM };
37 int screenshotType = static_cast<int>(SsType::RENDERED);
38 enum class SsSize : int { S_320, S_640, NUM };
39 int screenshotSize = static_cast<int>(SsSize::S_320);
40 bool screenshotWithOsd = false;
41 bool screenshotHideSprites = false;
42
43 std::string recordName;
44 enum class Source : int { AUDIO, VIDEO, BOTH, NUM };
45 int recordSource = static_cast<int>(Source::BOTH);
46 enum class Audio : int { MONO, STEREO, AUTO, NUM };
47 int recordAudio = static_cast<int>(Audio::AUTO);
48 enum class VideoSize : int { V_320, V_640, V_960, NUM };
49 int recordVideoSize = static_cast<int>(VideoSize::V_320);
50
51 TclObject confirmCmd;
52 std::string confirmText;
53 bool openConfirmPopup = false;
54
55 static constexpr auto persistentElements = std::tuple{
56 PersistentElement{"showScreenshot", &ImGuiTools::showScreenshot},
57 PersistentElement{"showRecord", &ImGuiTools::showRecord},
58 PersistentElementMax{"screenshotType", &ImGuiTools::screenshotType, static_cast<int>(SsType::NUM)},
59 PersistentElementMax{"screenshotSize", &ImGuiTools::screenshotSize, static_cast<int>(SsSize::NUM)},
60 PersistentElement{"screenshotWithOsd", &ImGuiTools::screenshotWithOsd},
61 PersistentElementMax{"recordSource", &ImGuiTools::recordSource, static_cast<int>(Source::NUM)},
62 PersistentElementMax{"recordAudio", &ImGuiTools::recordAudio, static_cast<int>(Audio::NUM)},
63 PersistentElementMax{"recordVideoSize", &ImGuiTools::recordVideoSize, static_cast<int>(VideoSize::NUM)}
64 };
65};
66
67} // namespace openmsx
68
69#endif
ImGuiPart(ImGuiManager &manager_)
Definition ImGuiPart.hh:12
void loadLine(std::string_view name, zstring_view value) override
Definition ImGuiTools.cc:35
zstring_view iniName() const override
Definition ImGuiTools.hh:15
void showMenu(MSXMotherBoard *motherBoard) override
Definition ImGuiTools.cc:62
void paint(MSXMotherBoard *motherBoard) override
void save(ImGuiTextBuffer &buf) override
Definition ImGuiTools.cc:30
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 >