Skip to content

Commit

Permalink
Add read-only section in status bar
Browse files Browse the repository at this point in the history
  • Loading branch information
nim-ka committed Nov 26, 2024
1 parent d65ba44 commit cd4cb7f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
10 changes: 0 additions & 10 deletions view/gui/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,15 +733,6 @@ void on_movie_loop_changed(std::any data)
SendMessage(g_main_hwnd, WM_INITMENU, 0, 0);
}

void on_readonly_changed(std::any data)
{
auto value = std::any_cast<bool>(data);
Statusbar::post(value
? "Read-only"
: "Read/write");
SendMessage(g_main_hwnd, WM_INITMENU, 0, 0);
}

void on_fullscreen_changed(std::any data)
{
auto value = std::any_cast<bool>(data);
Expand Down Expand Up @@ -1987,7 +1978,6 @@ int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
Messenger::subscribe(Messenger::Message::EmuPausedChanged, on_emu_paused_changed);
Messenger::subscribe(Messenger::Message::CapturingChanged, on_capturing_changed);
Messenger::subscribe(Messenger::Message::MovieLoopChanged, on_movie_loop_changed);
Messenger::subscribe(Messenger::Message::ReadonlyChanged, on_readonly_changed);
Messenger::subscribe(Messenger::Message::TaskChanged, on_task_changed);
Messenger::subscribe(Messenger::Message::ScriptStarted, on_script_started);
Messenger::subscribe(Messenger::Message::SpeedModifierChanged, on_speed_modifier_changed);
Expand Down
12 changes: 10 additions & 2 deletions view/gui/features/Statusbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace Statusbar
{
const std::vector emu_parts = {200, 200, 77, 77, 77, 77, 77, -1};
const std::vector emu_parts = {150, 150, 75, 75, 75, 75, 75, 75, -1};
const std::vector idle_parts = {400, -1};

HWND statusbar_hwnd;
Expand Down Expand Up @@ -48,7 +48,7 @@ namespace Statusbar
{
scale = max(scale, 1.0f);
}

if (!g_config.statusbar_scale_up)
{
scale = min(scale, 1.0f);
Expand Down Expand Up @@ -124,6 +124,12 @@ namespace Statusbar
}
}

void on_readonly_changed(std::any data)
{
auto value = std::any_cast<bool>(data);
post(value ? "Read-only" : "Read/write", Section::Readonly);
}

void on_rerecords_changed(std::any data)
{
auto value = std::any_cast<uint64_t>(data);
Expand Down Expand Up @@ -158,6 +164,8 @@ namespace Statusbar
emu_launched_changed);
Messenger::subscribe(Messenger::Message::StatusbarVisibilityChanged,
statusbar_visibility_changed);
Messenger::subscribe(Messenger::Message::ReadonlyChanged,
on_readonly_changed);
Messenger::subscribe(Messenger::Message::TaskChanged,
on_task_changed);
Messenger::subscribe(Messenger::Message::RerecordsChanged,
Expand Down
1 change: 1 addition & 0 deletions view/gui/features/Statusbar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace Statusbar
{
Notification,
VCR,
Readonly,
Input,
Rerecords,
FPS,
Expand Down

0 comments on commit cd4cb7f

Please sign in to comment.