1#define IMGUI_DEFINE_MATH_OPERATORS
7#include "absl/strings/str_format.h"
10#include "imgui/imgui.h"
11#include "imgui/imgui_internal.h"
21 return absl::OkStatus();
29 return absl::OkStatus();
37 return absl::OkStatus();
41 if (name.empty())
return;
42 std::string ini_name = absl::StrFormat(
"yaze_workspace_%s.ini", name.c_str());
43 ImGui::SaveIniSettingsToDisk(ini_name.c_str());
53 std::ostringstream ss;
58 }
catch (
const std::exception& e) {
70 if (name.empty())
return;
71 std::string ini_name = absl::StrFormat(
"yaze_workspace_%s.ini", name.c_str());
72 ImGui::LoadIniSettingsFromDisk(ini_name.c_str());
82 std::vector<std::string> new_presets;
84 if (config_dir.ok()) {
85 std::string presets_path = (*config_dir /
"workspace_presets.txt").
string();
88 std::istringstream ss(data);
90 while (std::getline(ss, name)) {
91 name.erase(0, name.find_first_not_of(
" \t\r\n"));
92 name.erase(name.find_last_not_of(
" \t\r\n") + 1);
93 if (!name.empty() && name.length() < 256) {
94 new_presets.emplace_back(std::move(name));
101 }
catch (
const std::exception& e) {
149 ImGuiWindow* window = ImGui::GetCurrentWindowRead();
150 if (window && window->DockNode) {
151 ImGuiID central_node_id = ImGui::DockBuilderGetCentralNode(
152 ImGui::GetID(
"MainDockSpace"))->ID;
153 ImGui::DockBuilderDockWindow(window->Name, central_node_id);
162 ImGuiContext* ctx = ImGui::GetCurrentContext();
164 for (ImGuiWindow* window : ctx->Windows) {
165 if (window && !window->Collapsed) {
166 ImGui::SetWindowSize(window->Name, ImVec2(0, 0));
177 ImGuiContext* ctx = ImGui::GetCurrentContext();
179 for (ImGuiWindow* window : ctx->Windows) {
180 if (window && !window->DockNode && !window->Collapsed) {
181 window->Hidden =
true;
195 if (session.rom && session.rom->is_loaded()) {
206 if (session.filepath == filepath && session.rom && session.rom->is_loaded()) {
215 ImGuiContext* ctx = ImGui::GetCurrentContext();
216 if (ctx && ctx->NavWindow) {
217 ImGui::FocusWindow(ImGui::FindWindowByName(ctx->NavWindow->Name));
227 ImGuiWindow* window = ImGui::GetCurrentWindowRead();
228 if (window && window->DockNode) {
229 ImGuiID node_id = window->DockNode->ID;
230 ImGuiID out_id_at_dir = 0;
231 ImGuiID out_id_at_opposite_dir = 0;
232 ImGui::DockBuilderSplitNode(node_id, ImGuiDir_Down, 0.5f,
233 &out_id_at_dir, &out_id_at_opposite_dir);
238 ImGuiWindow* window = ImGui::GetCurrentWindowRead();
239 if (window && window->DockNode) {
240 ImGuiID node_id = window->DockNode->ID;
241 ImGuiID out_id_at_dir = 0;
242 ImGuiID out_id_at_opposite_dir = 0;
243 ImGui::DockBuilderSplitNode(node_id, ImGuiDir_Right, 0.5f,
244 &out_id_at_dir, &out_id_at_opposite_dir);
249 ImGuiWindow* window = ImGui::GetCurrentWindowRead();
251 window->Hidden =
true;
void ShowAll(size_t session_id)
void HideAll(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)
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_
EditorCardRegistry * card_registry_
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.
Main namespace for the application.