+build/
imgui.ini
stmdspgui
stmdspgui.exe
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
-add_compile_options(-O0 -ggdb -g3 -Wall -Wextra -pedantic)
+add_compile_options(-O0 -ggdb -g3)
file(GLOB SRC_IMGUI_BACKENDS "${CMAKE_SOURCE_DIR}/source/imgui/backends/*.cpp")
file(GLOB SRC_IMGUI "${CMAKE_SOURCE_DIR}/source/imgui/*.cpp")
file(GLOB SRC_STMDSP "${CMAKE_SOURCE_DIR}/source/stmdsp/*.cpp")
file(GLOB SRC_STMDSPGUI "${CMAKE_SOURCE_DIR}/source/*.cpp")
+set_property(SOURCE ${SRC_STMDSPGUI} PROPERTY COMPILE_FLAGS "-Wall -Wextra -Wpedantic")
+
add_executable(stmdspgui
source/serial/src/serial.cc
source/serial/src/impl/unix.cc
ImGui::SameLine();
ImGui::SetNextItemWidth(100);
if (ImGui::BeginCombo("", sampleRatePreview)) {
- for (int i = 0; i < sampleRateList.size(); ++i) {
+ for (unsigned int i = 0; i < sampleRateList.size(); ++i) {
if (ImGui::Selectable(sampleRateList[i])) {
sampleRatePreview = sampleRateList[i];
if (m_device != nullptr && !m_device->is_running()) {
}
}
+void openNewFile()
+{
+ fileCurrentPath.clear();
+ editor.SetText(stmdsp::file_content);
+}
+
void fileScanTemplates()
{
auto path = std::filesystem::current_path() / "templates";
if (ImGui::BeginMenu("File")) {
if (ImGui::MenuItem("New")) {
// TODO modified?
- fileCurrentPath.clear();
- editor.SetText(stmdsp::file_content);
+ openNewFile();
log("Ready.");
}
if (ImGuiFileDialog::Instance()->IsOk()) {
std::string filePathName = ImGuiFileDialog::Instance()->GetFilePathName();
- switch (fileAction) {
- case FileAction::None:
- break;
- case FileAction::Open:
+ if (fileAction == FileAction::Open) {
fileCurrentPath = filePathName;
openCurrentFile();
log("Ready.");
- break;
- case FileAction::SaveAs:
+ } else if (fileAction == FileAction::SaveAs) {
fileCurrentPath = filePathName;
saveCurrentFile();
- break;
}
}
ImGui_ImplSDL2_InitForOpenGL(window, gl_context);
ImGui_ImplOpenGL2_Init();
+ ImGuiStyle& style = ImGui::GetStyle();
+ style.WindowRounding = 5;
+ style.FrameRounding = 3;
+ style.ScrollbarRounding = 1;
+
return true;
}
void guiHandleEvents(bool& done)
{
- SDL_Event event;
for (SDL_Event event; SDL_PollEvent(&event);) {
ImGui_ImplSDL2_ProcessEvent(&event);
if (event.type == SDL_QUIT)
extern void fileRenderMenu();
extern void fileRenderDialog();
extern void fileScanTemplates();
+extern void openNewFile();
extern void codeEditorInit();
extern void codeRenderMenu();
fileScanTemplates();
codeEditorInit();
+ openNewFile();
while (!done) {
auto endTime = std::chrono::steady_clock::now() +