1#ifndef IMGUI_MANAGER_HH
2#define IMGUI_MANAGER_HH
26struct ImGuiTextBuffer;
31class ImGuiBreakPoints;
32class ImGuiCheatFinder;
36class ImGuiDiskManipulator;
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 = {});
97 void initializeImGui();
98 [[nodiscard]] ImFont* addFont(
zstring_view filename,
int fontSize);
104 [[nodiscard]]
zstring_view iniName()
const override {
return "manager"; }
105 void save(ImGuiTextBuffer& buf)
override;
106 void loadLine(std::string_view name,
zstring_view value)
override;
107 void loadEnd()
override;
110 bool signalEvent(
const Event& event)
override;
113 void update(
const Setting&
setting)
noexcept override;
117 void* iniReadOpen(std::string_view name);
118 void loadLine(
void* entry,
const char* line)
const;
120 void iniWriteAll(ImGuiTextBuffer& buf);
126 std::vector<ImGuiPartInterface*> parts;
127 std::vector<ImGuiPartInterface*> toBeAddedParts;
128 bool removeParts =
false;
146 std::unique_ptr<ImGuiHelp>
help;
176 std::vector<std::function<void()>> delayedActionQueue;
177 float menuAlpha = 1.0f;
179 std::string droppedFile;
180 std::string insertedInfo;
181 std::vector<std::string> selectList;
182 std::string selectedMedia;
183 const RomInfo* romInfo =
nullptr;
185 float insertedInfoTimeout = 0.0f;
187 bool mainMenuBarUndocked =
false;
188 bool handleDropped =
false;
189 bool openInsertedInfo =
false;
190 bool guiActive =
false;
192 EmuTime prevBoardTime = EmuTime::zero();
193 float speedDrawTimeOut = 0.0f;
194 float fpsDrawTimeOut = 0.0f;
198 static constexpr auto persistentElements = std::tuple{
201 PersistentElement{
"windowPos", &ImGuiManager::windowPos},
214template<
typename InfoType>
219 "manufacturer",
"Manufacturer",
220 "code",
"Product code",
222 "release_year",
"Release year",
223 "description",
"Description",
226 std::vector<InfoType> result;
229 result.reserve(configs.size());
230 for (
const auto& config : configs) {
231 auto& info = result.emplace_back();
232 info.configName = config;
235 auto& configInfo = info.configInfo;
237 auto first = r->begin();
238 auto last = r->end();
239 while (first != last) {
240 auto desc = *first++;
241 if (first == last)
break;
242 auto value = *first++;
243 if (!value.empty()) {
244 configInfo.emplace_back(std::string(replacer(desc)),
254 auto& display = info.displayName;
255 for (
const auto topic : topics) {
257 if (!value->empty()) {
258 if (!display.empty())
strAppend(display,
' ');
263 if (display.empty()) display = config;
269 auto sameDisplayName = [](InfoType& x, InfoType& y) {
271 return cmp(x.displayName, y.displayName);
273 chunk_by(result, sameDisplayName, [](
auto first,
auto last) {
274 if (std::distance(first, last) == 1)
return;
275 for (
auto it = first; it != last; ++it) {
276 strAppend(it->displayName,
" (", it->configName,
')');
ImGuiManager & operator=(const ImGuiManager &)=delete
std::unique_ptr< ImGuiMachine > machine
void registerPart(ImGuiPartInterface *part)
std::unique_ptr< ImGuiBreakPoints > breakPoints
bool statusBarItemVisibilityMachine
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
bool statusBarItemVisibilityScreenModeInfo
std::unique_ptr< ImGuiHelp > help
IntegerSetting fontPropSize
bool statusBarItemVisibilityRunningSoftware
Interpreter & getInterpreter()
void storeWindowPosition(gl::ivec2 pos)
ImGuiManager(const ImGuiManager &)=delete
ImGuiManager(ImGuiManager &&)=delete
void configStatusBarVisibilityItems()
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
bool statusBarItemVisibilityActualSpeed
std::unique_ptr< ImGuiSettings > settings
std::unique_ptr< ImGuiDebugger > debugger
bool statusBarItemVisibilityFps
std::unique_ptr< ImGuiSCCViewer > sccViewer
void unregisterPart(ImGuiPartInterface *part)
bool statusBarItemVisibilityTime
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)