Skip to content

Commit

Permalink
Apply dv_gui_opengl changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dvsku committed May 3, 2024
1 parent 9a3fc6e commit b58fa1d
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 55 deletions.
10 changes: 2 additions & 8 deletions source/src/dt_app.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#include "dt_app.hpp"

#include <imgui\imgui.h>
#include <imgui\imgui_internal.h>
#include <dv_gui_opengl\fonts\dv_font_average_mono.hpp>
#include <dv_gui_opengl\fonts\dv_font_fontawesome_solid.hpp>
#include <imgui/imgui.h>
#include <imgui/imgui_internal.h>

using namespace dvsku_toolkit;
using namespace dvsku;
Expand All @@ -25,10 +23,6 @@ dt_gui_mngr& dt_app::get_gui() {
return m_gui;
}

void dt_app::close() {
dv_window::close();
}

///////////////////////////////////////////////////////////////////////////////
// PRIVATE

Expand Down
15 changes: 4 additions & 11 deletions source/src/dt_app.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#pragma once

#include "systems\dt_system_mngr.hpp"
#include "gui\dt_gui_mngr.hpp"
#include "systems/dt_system_mngr.hpp"
#include "gui/dt_gui_mngr.hpp"

#include <dv_gui_opengl/dv_window.hpp>
#include <dv_gui_opengl/models/dv_texture.hpp>
#include <dv_gui_opengl/dv_gui_opengl.hpp>

namespace dvsku_toolkit {
class dt_app : public dvsku::dv_window {
Expand All @@ -20,18 +19,12 @@ namespace dvsku_toolkit {

public:
dt_system_mngr& get_systems();
dt_gui_mngr& get_gui();

void close();
dt_gui_mngr& get_gui();

private:
dt_system_mngr m_systems;
dt_gui_mngr m_gui;

friend dt_comp_root;
friend dt_comp_pack;
friend dt_comp_unpack;

private:
bool prepare() override final;
void release() override final;
Expand Down
2 changes: 1 addition & 1 deletion source/src/dvsku_toolkit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine,
settings.enable_multi_viewport = true;

dt_app app(settings);
app.run();
app.show();
}
catch (...) {
return -1;
Expand Down
19 changes: 5 additions & 14 deletions source/src/gui/dt_comp_pack.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include "gui/dt_comp_pack.hpp"
#include "dt_app.hpp"

#include <dv_gui_opengl/utilities/dv_util_dialog.hpp>

using namespace dvsku_toolkit;

///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -32,17 +30,16 @@ dt_comp_pack::dt_comp_pack(dt_app& app)
m_app.set_taskbar_progress(0U);

if (result.status == libevp::evp_result_status::ok) {
m_app.play_sound(dvsku::dv_sound_type::success);
dvsku::dv_util_sound::success();
}
else if (result.status == libevp::evp_result_status::error) {
m_app.play_sound(dvsku::dv_sound_type::warning);
dvsku::dv_util_sound::warning();

if (!result.message.empty()) {
m_app.get_systems().core.has_errors = true;
m_app.get_systems().core.errors = result.message;
}
}

}
};
m_context.update_callback = [this](float progress) {
std::lock_guard<std::mutex> guard(m_app.get_systems().core.mutex);
Expand All @@ -68,10 +65,7 @@ void dt_comp_pack::render() {

ImGui::SameLine(0.0f, 5.0f);
if (ImGui::Button("Select##Input", { 125.0f, 21.0f })) {
auto result = dvsku::dv_util_dialog::select_dir("Input dir", m_input);

if (!result.empty())
m_input = result;
m_input = dvsku::dv_util_dialog::select_dir("Input dir", m_input);
}

ImGui::Indent(3.0f);
Expand All @@ -83,10 +77,7 @@ void dt_comp_pack::render() {

ImGui::SameLine(0.0f, 5.0f);
if (ImGui::Button("Select##Output", { 125.0f, 21.0f })) {
auto result = dvsku::dv_util_dialog::save_file("Output evp", m_output, true, { "EVP (*.evp)", "*.evp" });

if (!result.empty())
m_output = result;
m_output = dvsku::dv_util_dialog::save_file("Output evp", m_output, true, { "EVP (*.evp)", "*.evp" });
}

ImGui::Dummy({ 0.0f, 3.0f });
Expand Down
6 changes: 2 additions & 4 deletions source/src/gui/dt_comp_root.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
#include "dvsku_toolkit.hpp"
#include "dt_app.hpp"

#include <dv_gui_opengl\fonts\dv_font_fontawesome_solid.hpp>

using namespace dvsku_toolkit;

///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -65,7 +63,7 @@ void dt_comp_root::render() {
ImGui::SetCursorPosY(min.y);

if (ImGui::Button(ICON_FA_MINUS"##Minimize", { 30.0f, 25.0f })) {
m_app.minimize();
m_app.iconify();
}

ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, { 6.0f, 6.0f });
Expand Down Expand Up @@ -94,7 +92,7 @@ void dt_comp_root::render() {
}
ImGui::EndChild();

m_app.m_is_title_bar = ImGui::IsMouseHoveringRect(rectangle.Min, rectangle.Max);
m_app.get_title_bar().mouseover_title_bar = ImGui::IsMouseHoveringRect(rectangle.Min, rectangle.Max);

///////////////////////////////////////////////////////////////////////////
// CONTENT
Expand Down
16 changes: 4 additions & 12 deletions source/src/gui/dt_comp_unpack.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include "gui/dt_comp_unpack.hpp"
#include "dt_app.hpp"

#include <dv_gui_opengl/utilities/dv_util_dialog.hpp>

using namespace dvsku_toolkit;

///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -32,10 +30,10 @@ dt_comp_unpack::dt_comp_unpack(dt_app& app)
m_app.set_taskbar_progress(0U);

if (result.status == libevp::evp_result_status::ok) {
m_app.play_sound(dvsku::dv_sound_type::success);
dvsku::dv_util_sound::success();
}
else if (result.status == libevp::evp_result_status::error) {
m_app.play_sound(dvsku::dv_sound_type::warning);
dvsku::dv_util_sound::warning();

if (!result.message.empty()) {
m_app.get_systems().core.has_errors = true;
Expand Down Expand Up @@ -67,10 +65,7 @@ void dt_comp_unpack::render() {

ImGui::SameLine(0.0f, 5.0f);
if (ImGui::Button("Select##Input", { 125.0f, 21.0f })) {
auto result = dvsku::dv_util_dialog::open_file("Input evp", m_input, { "EVP (*.evp)", "*.evp" });

if (!result.empty())
m_input = result[0];
m_input = dvsku::dv_util_dialog::open_file("Input evp", m_input, { "EVP (*.evp)", "*.evp" });
}

ImGui::Indent(3.0f);
Expand All @@ -82,10 +77,7 @@ void dt_comp_unpack::render() {

ImGui::SameLine(0.0f, 5.0f);
if (ImGui::Button("Select##Output", { 125.0f, 21.0f })) {
auto result = dvsku::dv_util_dialog::select_dir("Output dir", m_output);

if (!result.empty())
m_output = result;
m_output = dvsku::dv_util_dialog::select_dir("Output dir", m_output);
}

ImGui::Dummy({ 0.0f, 10.0f });
Expand Down
2 changes: 0 additions & 2 deletions source/src/gui/dt_modal_errors.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include "gui/dt_modal_errors.hpp"
#include "dt_app.hpp"

#include <dv_gui_opengl\fonts\dv_font_fontawesome_solid.hpp>

using namespace dvsku_toolkit;
using namespace dvsku;

Expand Down
2 changes: 1 addition & 1 deletion source/src/gui/dt_modal_errors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "gui/dt_gui_base.hpp"

#include <dv_gui_opengl/models/dv_command.hpp>
#include <dv_gui_opengl/dv_gui_opengl.hpp>

namespace dvsku_toolkit {
class dt_modal_errors : public dt_gui_base {
Expand Down
2 changes: 1 addition & 1 deletion source/src/systems/dt_sys_command.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "systems/dt_system_base.hpp"

#include <dv_gui_opengl/systems/dv_sys_command.hpp>
#include <dv_gui_opengl/dv_gui_opengl.hpp>

namespace dvsku_toolkit {
class dt_app;
Expand Down
2 changes: 1 addition & 1 deletion source/src/systems/dt_sys_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "systems/dt_system_base.hpp"

#include <dv_gui_opengl/models/dv_version.hpp>
#include <dv_gui_opengl/dv_gui_opengl.hpp>
#include <mutex>

namespace dvsku_toolkit {
Expand Down

0 comments on commit b58fa1d

Please sign in to comment.