2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
2019-09-23 00:24:10 -07:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2020-09-12 10:55:46 -07:00
|
|
|
#include <glass/MainMenuBar.h>
|
|
|
|
|
#include <glass/WindowManager.h>
|
|
|
|
|
#include <glass/networktables/NetworkTablesProvider.h>
|
2019-09-23 00:24:10 -07:00
|
|
|
|
2022-02-07 03:39:45 -05:00
|
|
|
#include <functional>
|
[glass] Use JSON files for storage instead of imgui ini
Storage is now nested.
Separate "roots" can be configured which save to separate files.
In particular, this is used to save wpigui and ImGui window position
to a -window.json file.
ImGui's ini (for window position) is mapped to JSON.
You can optionally specify a directory to load from on the command line.
If one isn't provided, it uses the global system directory.
Any changes made are automatically saved here.
Workspace | Open: select directory, the current layout is replaced with that
workspace, and future auto-saves also switch to that location. The main
window size/location is not changed, only the contents.
Workspace | Save As: select directory, the current layout is saved there,
and future auto-saves also switch to that location.
Workspace | Reset: window locations are preserved, but all other settings
are reset to default (including e.g. removing plot windows). This will also
end up clearing the current save file. as with load, the main window
size/location is not changed.
Workspace | Save As Global: "save as" to the global system location
Notably, the main window size/location is only loaded at startup, but is
auto-saved as part of the current workspace.
2021-11-25 00:51:00 -08:00
|
|
|
#include <memory>
|
|
|
|
|
|
2020-09-12 10:55:46 -07:00
|
|
|
#include "HALProvider.h"
|
2019-09-23 00:24:10 -07:00
|
|
|
|
|
|
|
|
namespace halsimgui {
|
|
|
|
|
|
|
|
|
|
class HALSimGui {
|
|
|
|
|
public:
|
2020-08-26 00:35:44 -07:00
|
|
|
static void GlobalInit();
|
2019-09-23 00:24:10 -07:00
|
|
|
|
2020-09-12 10:55:46 -07:00
|
|
|
static glass::MainMenuBar mainMenu;
|
[glass] Use JSON files for storage instead of imgui ini
Storage is now nested.
Separate "roots" can be configured which save to separate files.
In particular, this is used to save wpigui and ImGui window position
to a -window.json file.
ImGui's ini (for window position) is mapped to JSON.
You can optionally specify a directory to load from on the command line.
If one isn't provided, it uses the global system directory.
Any changes made are automatically saved here.
Workspace | Open: select directory, the current layout is replaced with that
workspace, and future auto-saves also switch to that location. The main
window size/location is not changed, only the contents.
Workspace | Save As: select directory, the current layout is saved there,
and future auto-saves also switch to that location.
Workspace | Reset: window locations are preserved, but all other settings
are reset to default (including e.g. removing plot windows). This will also
end up clearing the current save file. as with load, the main window
size/location is not changed.
Workspace | Save As Global: "save as" to the global system location
Notably, the main window size/location is only loaded at startup, but is
auto-saved as part of the current workspace.
2021-11-25 00:51:00 -08:00
|
|
|
static std::unique_ptr<glass::WindowManager> manager;
|
2019-09-23 00:24:10 -07:00
|
|
|
|
[glass] Use JSON files for storage instead of imgui ini
Storage is now nested.
Separate "roots" can be configured which save to separate files.
In particular, this is used to save wpigui and ImGui window position
to a -window.json file.
ImGui's ini (for window position) is mapped to JSON.
You can optionally specify a directory to load from on the command line.
If one isn't provided, it uses the global system directory.
Any changes made are automatically saved here.
Workspace | Open: select directory, the current layout is replaced with that
workspace, and future auto-saves also switch to that location. The main
window size/location is not changed, only the contents.
Workspace | Save As: select directory, the current layout is saved there,
and future auto-saves also switch to that location.
Workspace | Reset: window locations are preserved, but all other settings
are reset to default (including e.g. removing plot windows). This will also
end up clearing the current save file. as with load, the main window
size/location is not changed.
Workspace | Save As Global: "save as" to the global system location
Notably, the main window size/location is only loaded at startup, but is
auto-saved as part of the current workspace.
2021-11-25 00:51:00 -08:00
|
|
|
static std::unique_ptr<HALProvider> halProvider;
|
|
|
|
|
static std::unique_ptr<glass::NetworkTablesProvider> ntProvider;
|
2019-09-23 00:24:10 -07:00
|
|
|
};
|
|
|
|
|
|
2022-02-07 03:39:45 -05:00
|
|
|
void AddGuiInit(std::function<void()> initialize);
|
|
|
|
|
void AddGuiLateExecute(std::function<void()> execute);
|
|
|
|
|
void AddGuiEarlyExecute(std::function<void()> execute);
|
|
|
|
|
void GuiExit();
|
|
|
|
|
|
2019-09-23 00:24:10 -07:00
|
|
|
} // namespace halsimgui
|