1#define IMGUI_DEFINE_MATH_OPERATORS
5#include "absl/strings/str_format.h"
9#include "imgui/imgui.h"
10#include "imgui/imgui_internal.h"
22 return absl::OkStatus();
30 return absl::OkStatus();
38 return absl::OkStatus();
44 std::string ini_name = absl::StrFormat(
"yaze_workspace_%s.ini", name.c_str());
45 ImGui::SaveIniSettingsToDisk(ini_name.c_str());
55 std::ostringstream ss;
60 }
catch (
const std::exception& e) {
74 std::string ini_name = absl::StrFormat(
"yaze_workspace_%s.ini", name.c_str());
75 ImGui::LoadIniSettingsFromDisk(ini_name.c_str());
85 std::vector<std::string> new_presets;
87 if (config_dir.ok()) {
88 std::string presets_path =
89 (*config_dir /
"workspace_presets.txt").
string();
92 std::istringstream ss(data);
94 while (std::getline(ss, name)) {
95 name.erase(0, name.find_first_not_of(
" \t\r\n"));
96 name.erase(name.find_last_not_of(
" \t\r\n") + 1);
97 if (!name.empty() && name.length() < 256) {
98 new_presets.emplace_back(std::move(name));
105 }
catch (
const std::exception& e) {
153 ImGuiWindow* window = ImGui::GetCurrentWindowRead();
154 if (window && window->DockNode) {
155 ImGuiID central_node_id =
156 ImGui::DockBuilderGetCentralNode(ImGui::GetID(
"MainDockSpace"))->ID;
157 ImGui::DockBuilderDockWindow(window->Name, central_node_id);
166 ImGuiContext* ctx = ImGui::GetCurrentContext();
168 for (ImGuiWindow* window : ctx->Windows) {
169 if (window && !window->Collapsed) {
170 ImGui::SetWindowSize(window->Name, ImVec2(0, 0));
181 ImGuiContext* ctx = ImGui::GetCurrentContext();
183 for (ImGuiWindow* window : ctx->Windows) {
184 if (window && !window->DockNode && !window->Collapsed) {
185 window->Hidden =
true;
200 if (session.rom && session.rom->is_loaded()) {
212 if (session.filepath == filepath && session.rom &&
213 session.rom->is_loaded()) {
222 ImGuiContext* ctx = ImGui::GetCurrentContext();
223 if (ctx && ctx->NavWindow) {
224 ImGui::FocusWindow(ImGui::FindWindowByName(ctx->NavWindow->Name));
234 ImGuiWindow* window = ImGui::GetCurrentWindowRead();
235 if (window && window->DockNode) {
236 ImGuiID node_id = window->DockNode->ID;
237 ImGuiID out_id_at_dir = 0;
238 ImGuiID out_id_at_opposite_dir = 0;
239 ImGui::DockBuilderSplitNode(node_id, ImGuiDir_Down, 0.5f, &out_id_at_dir,
240 &out_id_at_opposite_dir);
245 ImGuiWindow* window = ImGui::GetCurrentWindowRead();
246 if (window && window->DockNode) {
247 ImGuiID node_id = window->DockNode->ID;
248 ImGuiID out_id_at_dir = 0;
249 ImGuiID out_id_at_opposite_dir = 0;
250 ImGui::DockBuilderSplitNode(node_id, ImGuiDir_Right, 0.5f, &out_id_at_dir,
251 &out_id_at_opposite_dir);
256 ImGuiWindow* window = ImGui::GetCurrentWindowRead();
258 window->Hidden =
true;
265 if (command_id ==
"w.s") {
267 }
else if (command_id ==
"w.h") {
269 }
else if (command_id ==
"w.m") {
271 }
else if (command_id ==
"w.r") {
273 }
else if (command_id ==
"w.c") {
275 }
else if (command_id ==
"w.f") {
277 }
else if (command_id ==
"w.v") {
279 }
else if (command_id ==
"w.H") {
284 else if (command_id ==
"l.s") {
286 }
else if (command_id ==
"l.l") {
288 }
else if (command_id ==
"l.r") {
290 }
else if (command_id ==
"l.d") {
292 }
else if (command_id ==
"l.g") {
294 }
else if (command_id ==
"l.m") {
void HideAll(size_t session_id)
void ShowAll(size_t session_id)
void Show(const std::string &message, ToastType type=ToastType::kInfo, float ttl_seconds=3.0f)
absl::Status ResetWorkspaceLayout()
std::string last_workspace_preset_
void SaveWorkspacePreset(const std::string &name)
PanelManager * panel_manager_
bool HasDuplicateSession(const std::string &filepath) const
bool workspace_presets_loaded_
void FocusPreviousWindow()
void SplitWindowVertical()
void MaximizeCurrentWindow()
std::vector< std::string > workspace_presets_
size_t GetActiveSessionCount() const
void LoadDeveloperLayout()
std::deque< SessionInfo > * sessions_
void LoadWorkspacePreset(const std::string &name)
absl::Status SaveWorkspaceLayout(const std::string &name="")
void CloseAllFloatingWindows()
void SplitWindowHorizontal()
void LoadDesignerLayout()
void CloseCurrentWindow()
absl::Status LoadWorkspaceLayout(const std::string &name="")
ToastManager * toast_manager_
void ExecuteWorkspaceCommand(const std::string &command_id)
void SaveFile(const std::string &filename, const std::string &contents)
std::string LoadFile(const std::string &filename)
Loads the entire contents of a file into a string.