1#ifndef IMGUI_MANAGER_HH
2#define IMGUI_MANAGER_HH
26struct ImGuiTextBuffer;
31class ImGuiBitmapViewer;
32class ImGuiBreakPoints;
34class ImGuiCheatFinder;
38class ImGuiDiskManipulator;
51class ImGuiSpriteViewer;
81 const std::function<
void(
const TclObject&)>& ok,
82 const std::function<
void(
const std::string&)>& error);
84 const std::function<
void(
const TclObject&)>& ok = {});
98 void initializeImGui();
99 [[nodiscard]] ImFont* addFont(
zstring_view filename,
int fontSize);
105 [[nodiscard]]
zstring_view iniName()
const override {
return "manager"; }
106 void save(ImGuiTextBuffer& buf)
override;
107 void loadLine(std::string_view name,
zstring_view value)
override;
108 void loadEnd()
override;
111 bool signalEvent(
const Event& event)
override;
114 void update(
const Setting&
setting)
noexcept override;
118 void* iniReadOpen(std::string_view name);
119 void loadLine(
void* entry,
const char* line)
const;
121 void iniWriteAll(ImGuiTextBuffer& buf);
127 std::vector<ImGuiPartInterface*> parts;
128 std::vector<ImGuiPartInterface*> toBeAddedParts;
129 bool removeParts =
false;
144 std::unique_ptr<ImGuiBitmapViewer>
bitmap;
146 std::unique_ptr<ImGuiSpriteViewer>
sprite;
150 std::unique_ptr<ImGuiHelp>
help;
173 std::vector<std::function<void()>> delayedActionQueue;
174 float menuAlpha = 1.0f;
176 std::string droppedFile;
177 std::string insertedInfo;
178 std::vector<std::string> selectList;
179 std::string selectedMedia;
180 const RomInfo* romInfo =
nullptr;
182 float insertedInfoTimeout = 0.0f;
184 bool mainMenuBarUndocked =
false;
185 bool handleDropped =
false;
186 bool openInsertedInfo =
false;
187 bool guiActive =
false;
189 EmuTime prevBoardTime = EmuTime::zero();
190 float speedDrawTimeOut = 0.0f;
191 float fpsDrawTimeOut = 0.0f;
195 static constexpr auto persistentElements = std::tuple{
198 PersistentElement{
"windowPos", &ImGuiManager::windowPos},
205template<
typename InfoType>
210 "manufacturer",
"Manufacturer",
211 "code",
"Product code",
213 "release_year",
"Release year",
214 "description",
"Description",
217 std::vector<InfoType> result;
220 result.reserve(configs.size());
221 for (
const auto& config : configs) {
222 auto& info = result.emplace_back();
223 info.configName = config;
226 auto& configInfo = info.configInfo;
228 auto first = r->begin();
229 auto last = r->end();
230 while (first != last) {
231 auto desc = *first++;
232 if (first == last)
break;
233 auto value = *first++;
234 if (!value.empty()) {
235 configInfo.emplace_back(std::string(replacer(desc)),
245 auto& display = info.displayName;
246 for (
const auto topic : topics) {
248 if (!value->empty()) {
249 if (!display.empty())
strAppend(display,
' ');
254 if (display.empty()) display = config;
260 auto sameDisplayName = [](InfoType& x, InfoType& y) {
262 return cmp(x.displayName, y.displayName);
264 chunk_by(result, sameDisplayName, [](
auto first,
auto last) {
265 if (std::distance(first, last) == 1)
return;
266 for (
auto it = first; it != last; ++it) {
267 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< ImGuiWaveViewer > waveViewer
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< ImGuiSCCViewer > sccViewer
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.
Shortcuts & getShortcuts()
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:
PersistentElement(zstring_view, T C::*) -> PersistentElement< C, T >
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)