1#ifndef IMGUI_MANAGER_HH
2#define IMGUI_MANAGER_HH
25struct ImGuiTextBuffer;
30class ImGuiBitmapViewer;
31class ImGuiBreakPoints;
33class ImGuiCheatFinder;
37class ImGuiDiskManipulator;
49class ImGuiSpriteViewer;
78 const std::function<
void(
const TclObject&)>& ok,
79 const std::function<
void(
const std::string&)>& error);
81 const std::function<
void(
const TclObject&)>& ok = {});
95 void initializeImGui();
96 [[nodiscard]] ImFont* addFont(
zstring_view filename,
int fontSize);
101 [[nodiscard]]
zstring_view iniName()
const override {
return "manager"; }
102 void save(ImGuiTextBuffer& buf)
override;
103 void loadLine(std::string_view name,
zstring_view value)
override;
104 void loadEnd()
override;
107 int signalEvent(
const Event& event)
override;
110 void update(
const Setting&
setting)
noexcept override;
114 void* iniReadOpen(std::string_view name);
115 void loadLine(
void* entry,
const char* line)
const;
117 void iniWriteAll(ImGuiTextBuffer& buf);
123 std::vector<ImGuiPartInterface*> parts;
124 std::vector<ImGuiPartInterface*> toBeAddedParts;
125 bool removeParts =
false;
141 std::unique_ptr<ImGuiBitmapViewer>
bitmap;
143 std::unique_ptr<ImGuiSpriteViewer>
sprite;
147 std::unique_ptr<ImGuiHelp>
help;
167 std::vector<std::function<void()>> delayedActionQueue;
168 float menuAlpha = 1.0f;
170 std::string droppedFile;
171 std::string insertedInfo;
172 std::vector<std::string> selectList;
173 std::string selectedMedia;
174 const RomInfo* romInfo =
nullptr;
176 float insertedInfoTimeout = 0.0f;
178 bool mainMenuBarUndocked =
false;
179 bool handleDropped =
false;
180 bool openInsertedInfo =
false;
181 bool guiActive =
false;
183 static constexpr auto persistentElements = std::tuple{
192template<
typename InfoType>
197 "manufacturer",
"Manufacturer",
198 "code",
"Product code",
200 "release_year",
"Release year",
201 "description",
"Description",
204 std::vector<InfoType> result;
207 result.reserve(configs.size());
208 for (
const auto& config : configs) {
209 auto& info = result.emplace_back();
210 info.configName = config;
213 auto& configInfo = info.configInfo;
215 auto first = r->begin();
216 auto last = r->end();
217 while (first != last) {
218 auto desc = *first++;
219 if (first == last)
break;
220 auto value = *first++;
221 if (!value.empty()) {
222 configInfo.emplace_back(std::string(replacer(desc)),
232 auto& display = info.displayName;
233 for (
const auto topic : topics) {
235 if (!value->empty()) {
236 if (!display.empty())
strAppend(display,
' ');
241 if (display.empty()) display = config;
247 auto sameDisplayName = [](InfoType& x, InfoType& y) {
249 return cmp(x.displayName, y.displayName);
251 chunk_by(result, sameDisplayName, [](
auto first,
auto last) {
252 if (std::distance(first, last) == 1)
return;
253 for (
auto it = first; it != last; ++it) {
254 strAppend(it->displayName,
" (", it->configName,
')');
ImGuiManager & operator=(const ImGuiManager &)=delete
std::unique_ptr< ImGuiMachine > machine
void registerPart(ImGuiPartInterface *part)
std::unique_ptr< ImGuiBreakPoints > breakPoints
void printError(std::string_view message)
std::unique_ptr< ImGuiVdpRegs > vdpRegs
std::unique_ptr< ImGuiCheatFinder > cheatFinder
std::unique_ptr< ImGuiTrainer > trainer
std::unique_ptr< ImGuiDiskManipulator > diskManipulator
IntegerSetting fontMonoSize
std::unique_ptr< ImGuiWatchExpr > watchExpr
std::unique_ptr< ImGuiPalette > palette
std::unique_ptr< ImGuiConnector > connector
std::optional< TclObject > execute(TclObject command)
std::unique_ptr< ImGuiKeyboard > keyboard
std::unique_ptr< ImGuiHelp > help
IntegerSetting fontPropSize
std::unique_ptr< ImGuiSpriteViewer > sprite
Interpreter & getInterpreter()
void storeWindowPosition(gl::ivec2 pos)
ImGuiManager(const ImGuiManager &)=delete
ImGuiManager(ImGuiManager &&)=delete
ImGuiManager & operator=(ImGuiManager &&)=delete
Shortcuts & getShortcuts()
std::unique_ptr< ImGuiConsole > console
std::unique_ptr< ImGuiSoundChip > soundChip
std::unique_ptr< ImGuiReverseBar > reverseBar
std::unique_ptr< ImGuiMedia > media
gl::ivec2 retrieveWindowPosition() const
std::unique_ptr< ImGuiMessages > messages
std::unique_ptr< ImGuiOpenFile > openFile
std::unique_ptr< ImGuiOsdIcons > osdIcons
FilenameSetting fontPropFilename
std::unique_ptr< ImGuiBitmapViewer > bitmap
std::unique_ptr< ImGuiSettings > settings
std::unique_ptr< ImGuiDebugger > debugger
std::unique_ptr< ImGuiCharacter > character
void unregisterPart(ImGuiPartInterface *part)
std::unique_ptr< ImGuiTools > tools
void executeDelayed(std::function< void()> action)
FilenameSetting fontMonoFilename
void printError(Ts &&... ts)
std::unique_ptr< ImGuiSymbols > symbols
A Setting with an integer value.
Generic Gang-of-Four Observer class, templatized edition.
Contains the main loop of openMSX.
static std::vector< std::string > getHwConfigs(std::string_view type)
Like std::string_view, but with the extra guarantee that it refers to a zero-terminated string.
constexpr auto create(Args ...args)
This file implemented 3 utility functions:
const std::string * getOptionalDictValue(const std::vector< std::pair< std::string, std::string > > &info, std::string_view key)
std::vector< InfoType > parseAllConfigFiles(ImGuiManager &manager, std::string_view type, std::initializer_list< std::string_view > topics)
std::variant< KeyUpEvent, KeyDownEvent, MouseMotionEvent, MouseButtonUpEvent, MouseButtonDownEvent, MouseWheelEvent, JoystickAxisMotionEvent, JoystickHatEvent, JoystickButtonUpEvent, JoystickButtonDownEvent, OsdControlReleaseEvent, OsdControlPressEvent, WindowEvent, TextEvent, FileDropEvent, QuitEvent, FinishFrameEvent, CliCommandEvent, GroupEvent, BootEvent, FrameDrawnEvent, BreakEvent, SwitchRendererEvent, TakeReverseSnapshotEvent, AfterTimedEvent, MachineLoadedEvent, MachineActivatedEvent, MachineDeactivatedEvent, MidiInReaderEvent, MidiInWindowsEvent, MidiInCoreMidiEvent, MidiInCoreMidiVirtualEvent, MidiInALSAEvent, Rs232TesterEvent, Rs232NetEvent, ImGuiDelayedActionEvent, ImGuiActiveEvent > Event
TclObject makeTclList(Args &&... args)
constexpr void sort(RandomAccessRange &&range)
TemporaryString tmpStrCat(Ts &&... ts)
void strAppend(std::string &result, Ts &&...ts)