Skip to content

Commit

Permalink
show refreshing screen in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
chrxh committed Oct 9, 2024
1 parent 27326d0 commit 243877c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 11 deletions.
38 changes: 32 additions & 6 deletions source/Gui/BrowserWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,22 @@ void _BrowserWindow::processIntern()
{
processToolbar();

processWorkspace();
auto startPos = ImGui::GetCursorScreenPos();

ImGui::SameLine();
processMovableSeparator();
if (ImGui::BeginChild("##workspaceAndUserList", {0, -scale(5.0f)}, 0, ImGuiWindowFlags_NoScrollbar)) {
processWorkspace();

ImGui::SameLine();
processUserList();
ImGui::SameLine();
processMovableSeparator();

ImGui::SameLine();
processUserList();

processStatus();
}
ImGui::EndChild();

processStatus();
processRefreshingScreen({startPos.x, startPos.y});

processEmojiWindow();

Expand Down Expand Up @@ -570,6 +577,7 @@ void _BrowserWindow::processSimulationList()
//process treeTOs
auto& workspace = _workspaces.at(_currentWorkspace);
auto scheduleRecreateTreeTOs = false;

ImGuiListClipper clipper;
clipper.Begin(workspace.treeTOs.size());
while (clipper.Step())
Expand Down Expand Up @@ -1160,6 +1168,24 @@ bool _BrowserWindow::processDetailButton()
return detailClicked;
}

void _BrowserWindow::processRefreshingScreen(RealVector2D const& startPos)
{
if (!_pendingRefreshRequestIds.empty()) {
auto color = ImColor(ImGui::GetStyleColorVec4(ImGuiCol_WindowBg));
color.Value.w = 0.8f;
auto size = ImGui::GetItemRectSize();
auto afterTablePos = ImGui::GetCursorScreenPos();

ImGui::SetCursorScreenPos({startPos.x, startPos.y});
if (ImGui::BeginChild("##overlay", {size.x, size.y}, 0, ImGuiWindowFlags_NoScrollbar)) {
ImDrawList* drawList = ImGui::GetWindowDrawList();
drawList->AddRectFilled({startPos.x, startPos.y}, {startPos.x + size.x, startPos.y + size.y}, color);
}
ImGui::EndChild();
ImGui::SetCursorScreenPos(afterTablePos);
}
}

void _BrowserWindow::processActivated()
{
onRefresh();
Expand Down
2 changes: 2 additions & 0 deletions source/Gui/BrowserWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ class _BrowserWindow : public _AlienWindow
bool processActionButton(std::string const& text);
bool processDetailButton();

void processRefreshingScreen(RealVector2D const& startPos);

void processActivated() override;

void processPendingRequestIds();
Expand Down
8 changes: 4 additions & 4 deletions source/Gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ _MainWindow::_MainWindow(SimulationController const& simController, PersisterCon
IMGUI_CHECKVERSION();

log(Priority::Important, "initialize GLFW and OpenGL");
auto glfwVersion = initGlfw();
auto glfwVersion = initGlfwAndReturnGlslVersion();
WindowController::init();
auto windowData = WindowController::getWindowData();
glfwSetFramebufferSizeCallback(windowData.window, framebuffer_size_callback);
Expand Down Expand Up @@ -249,7 +249,7 @@ void _MainWindow::shutdown()
NetworkService::shutdown();
}

char const* _MainWindow::initGlfw()
char const* _MainWindow::initGlfwAndReturnGlslVersion()
{
glfwSetErrorCallback(glfwErrorCallback);

Expand All @@ -273,14 +273,14 @@ char const* _MainWindow::initGlfw()
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // Required on Mac
#else
// GL 3.0 + GLSL 130
const char* glsl_version = "#version 130";
const char* glslVersion = "#version 130";
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
//glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only
//glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // 3.0+ only
#endif

return glsl_version;
return glslVersion;
}

void _MainWindow::processLoadingScreen()
Expand Down
2 changes: 1 addition & 1 deletion source/Gui/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class _MainWindow
void shutdown();

private:
char const* initGlfw(); //return glsl version
char const* initGlfwAndReturnGlslVersion();

void processLoadingScreen();
void processFadeoutLoadingScreen();
Expand Down

0 comments on commit 243877c

Please sign in to comment.