Skip to content

Commit 6948216

Browse files
committed
region improvements
1 parent 9a39b06 commit 6948216

File tree

9 files changed

+199
-168
lines changed

9 files changed

+199
-168
lines changed

USAGE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ You can get skins from [Winamp Skin Museum](https://skins.webamp.org/).
153153

154154
`Show clutterbar` displays vertical list of options to the left of track time/visualization.
155155

156+
`Skin transparency` enables skin transparency (`region.txt`). Background color is black.
157+
156158
#### Known issues and quirks
157159

158160
Issues:
@@ -166,6 +168,7 @@ Quirks:
166168
- Playlist is never full. Default player keeps up to 15 songs in memory, some of those have already been played,
167169
reducing playlist size further
168170
- Some elements may look slightly off (if you look hard enough) due to upscaling (800/275 = 2.90909...).
171+
- Skin transparency is not pixel perfect (irrational upscaling ratio).
169172
- There might be small delay between clicking button and getting response (noticeable on shuffle button)
170173

171174
Improvements (compared to Winamp v2.95):

images/settings-winamp.png

4.7 KB
Loading

libs/ImageMagick

Submodule ImageMagick updated 560 files

src/config.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ namespace AppConfig {
6060
ini["winamp"]["bitmapFontInPlaylist"] = std::to_string(winamp.useBitmapFontInPlaylist);
6161
ini["winamp"]["preferTimeRemaining"] = std::to_string(winamp.preferTimeRemaining);
6262
ini["winamp"]["showClutterbar"] = std::to_string(winamp.showClutterbar);
63+
ini["winamp"]["skinTransparency"] = std::to_string(winamp.skinTransparency);
6364

6465
ini["misc"]["swapTrackButtons"] = std::to_string(misc.swapTrackButtons);
6566

@@ -151,6 +152,7 @@ namespace AppConfig {
151152
winamp.useBitmapFontInPlaylist = (bool)std::atoi(ini["winamp"]["bitmapFontInPlaylist"].c_str());
152153
winamp.preferTimeRemaining = (bool)std::atoi(ini["winamp"]["preferTimeRemaining"].c_str());
153154
winamp.showClutterbar = (bool)std::atoi(ini["winamp"]["showClutterbar"].c_str());
155+
winamp.skinTransparency = (bool)std::atoi(ini["winamp"]["skinTransparency"].c_str());
154156
cassette.randomize = (bool)std::atoi(ini["cassette"]["randomize"].c_str());
155157
// NOLINTEND
156158

src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,9 @@ int main(int, char **) {
442442

443443
ImGui::Begin("1", nullptr, window_flags);
444444

445-
// #ifndef DESKTOP
445+
#ifndef DESKTOP
446446
ImGui::GetBackgroundDrawList()->AddCallback(drawCallback, (void *)shaderProgram);
447-
// #endif
447+
#endif
448448
skin.Draw();
449449

450450
// DrawWindowRects();

src/skin.h

Lines changed: 118 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -690,147 +690,161 @@ struct Skin {
690690
ImGui::NewLine();
691691

692692
if (activeSettingsTab == WINAMP) {
693-
ImGui::PushStyleVar(ImGuiStyleVar_GrabMinSize, 40.0f);
694-
ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarSize, 40.0f);
695-
if (ImGui::BeginCombo("##", skinList->at(selectedSkinIdx).name.c_str(), ImGuiComboFlags_HeightRegular)) {
696-
for (int n = 0; n < skinList->size(); n++) {
697-
const bool is_selected = (selectedSkinIdx == n);
698-
if (ImGui::Selectable(skinList->at(n).name.c_str(), is_selected)) {
699-
selectedSkinIdx = n;
700-
}
701-
}
702-
ImGui::EndCombo();
703-
}
704-
ImGui::PopStyleVar(2);
693+
Winamp();
694+
} else if (activeSettingsTab == CASSETTE) {
695+
Cassette();
696+
} else if (activeSettingsTab == DIGITAL_CLOCK) {
697+
DigitalClock();
698+
}
699+
}
705700

706-
ImGui::SameLine();
707-
if (activeSkinVariant == WINAMP) {
708-
if (ImGui::Button("Load skin")) {
709-
loadStatusStr = "Loading " + skinList->at(selectedSkinIdx).name;
710-
winamp.changeSkin(skinList->at(selectedSkinIdx).fullPath);
711-
needLoad = true;
701+
void Winamp() {
702+
ImGui::PushStyleVar(ImGuiStyleVar_GrabMinSize, 40.0f);
703+
ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarSize, 40.0f);
704+
if (ImGui::BeginCombo("##", skinList->at(selectedSkinIdx).name.c_str(), ImGuiComboFlags_HeightRegular)) {
705+
for (int n = 0; n < skinList->size(); n++) {
706+
const bool is_selected = (selectedSkinIdx == n);
707+
if (ImGui::Selectable(skinList->at(n).name.c_str(), is_selected)) {
708+
selectedSkinIdx = n;
712709
}
713710
}
711+
ImGui::EndCombo();
712+
}
713+
ImGui::PopStyleVar(2);
714714

715-
if (!loadStatusStr.empty()) {
716-
ImGui::Text("%s", loadStatusStr.c_str());
715+
ImGui::SameLine();
716+
if (activeSkinVariant == WINAMP) {
717+
if (ImGui::Button("Load skin")) {
718+
loadStatusStr = "Loading " + skinList->at(selectedSkinIdx).name;
719+
winamp.changeSkin(skinList->at(selectedSkinIdx).fullPath);
720+
needLoad = true;
717721
}
722+
}
718723

719-
ImGui::NewLine();
724+
if (!loadStatusStr.empty()) {
725+
ImGui::Text("%s", loadStatusStr.c_str());
726+
}
720727

721-
if (ImGui::Checkbox("Use bitmap font", &config->winamp.useBitmapFont)) {
722-
config->Save();
723-
if (activeSkinVariant == WINAMP) {
724-
winamp.Format(true);
725-
}
726-
}
728+
ImGui::NewLine();
727729

728-
if (ImGui::Checkbox("Use bitmap font in playlist", &config->winamp.useBitmapFontInPlaylist)) {
729-
config->Save();
730-
if (activeSkinVariant == WINAMP) {
731-
winamp.Format(true);
732-
}
730+
if (ImGui::Checkbox("Use bitmap font", &config->winamp.useBitmapFont)) {
731+
config->Save();
732+
if (activeSkinVariant == WINAMP) {
733+
winamp.Format(true);
733734
}
735+
}
734736

735-
if (ImGui::Checkbox("Prefer time remaining", &config->winamp.preferTimeRemaining)) {
736-
config->Save();
737+
if (ImGui::Checkbox("Use bitmap font in playlist", &config->winamp.useBitmapFontInPlaylist)) {
738+
config->Save();
739+
if (activeSkinVariant == WINAMP) {
740+
winamp.Format(true);
737741
}
742+
}
738743

739-
if (ImGui::Checkbox("Show clutterbar", &config->winamp.showClutterbar)) {
740-
config->Save();
741-
}
742-
} else if (activeSettingsTab == CASSETTE) {
743-
if (ImGui::Checkbox("Randomize?", &config->cassette.randomize)) {
744-
config->Save();
745-
}
744+
if (ImGui::Checkbox("Prefer time remaining", &config->winamp.preferTimeRemaining)) {
745+
config->Save();
746+
}
746747

747-
static ImGuiTableFlags flags = ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter |
748-
ImGuiTableFlags_BordersV | ImGuiTableFlags_SizingStretchProp;
748+
if (ImGui::Checkbox("Show clutterbar", &config->winamp.showClutterbar)) {
749+
config->Save();
750+
}
749751

750-
ImVec2 outer_size = ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 7);
752+
if (ImGui::Checkbox("Skin transparency", &config->winamp.skinTransparency)) {
753+
config->Save();
754+
}
755+
}
751756

752-
ImGui::PushStyleVar(ImGuiStyleVar_GrabMinSize, 40.0f);
753-
ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarSize, 40.0f);
754-
if (ImGui::BeginTable("configTable", 3, flags, outer_size)) {
755-
ImGui::TableSetupScrollFreeze(0, 1); // Make top row always visible
756-
ImGui::TableSetupColumn("Codec", ImGuiTableColumnFlags_None);
757-
ImGui::TableSetupColumn("Tape", ImGuiTableColumnFlags_None);
758-
ImGui::TableSetupColumn("Reel", ImGuiTableColumnFlags_None);
759-
ImGui::TableHeadersRow();
760-
761-
for (auto &tt : config->cassette.data) {
762-
ImGui::TableNextRow();
763-
ImGui::TableNextColumn();
764-
ImGui::Text("%s", tt.second.name.c_str());
765-
766-
ImGui::TableNextColumn();
767-
if (ImGui::BeginCombo(("##" + tt.second.name + "tape").c_str(), tt.second.tape.c_str(), ImGuiComboFlags_HeightSmall)) {
768-
for (auto &n : *tapeList) {
769-
if (!n.valid) {
770-
continue;
771-
}
757+
void Cassette() {
758+
if (ImGui::Checkbox("Randomize?", &config->cassette.randomize)) {
759+
config->Save();
760+
}
772761

773-
if (ImGui::Selectable(n.name.c_str(), false)) {
774-
tt.second.tape = n.name;
775-
config->cassette.data.at(tt.first).tape = n.name;
776-
config->Save();
762+
static ImGuiTableFlags flags = ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter |
763+
ImGuiTableFlags_BordersV | ImGuiTableFlags_SizingStretchProp;
777764

778-
if (activeSkinVariant == CASSETTE) {
779-
cassette.UnloadUnused();
780-
cassette.LoadTape(n.name);
781-
cassette.SelectTape();
782-
}
765+
ImVec2 outer_size = ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 7);
766+
767+
ImGui::PushStyleVar(ImGuiStyleVar_GrabMinSize, 40.0f);
768+
ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarSize, 40.0f);
769+
if (ImGui::BeginTable("configTable", 3, flags, outer_size)) {
770+
ImGui::TableSetupScrollFreeze(0, 1); // Make top row always visible
771+
ImGui::TableSetupColumn("Codec", ImGuiTableColumnFlags_None);
772+
ImGui::TableSetupColumn("Tape", ImGuiTableColumnFlags_None);
773+
ImGui::TableSetupColumn("Reel", ImGuiTableColumnFlags_None);
774+
ImGui::TableHeadersRow();
775+
776+
for (auto &tt : config->cassette.data) {
777+
ImGui::TableNextRow();
778+
ImGui::TableNextColumn();
779+
ImGui::Text("%s", tt.second.name.c_str());
780+
781+
ImGui::TableNextColumn();
782+
if (ImGui::BeginCombo(("##" + tt.second.name + "tape").c_str(), tt.second.tape.c_str(), ImGuiComboFlags_HeightSmall)) {
783+
for (auto &n : *tapeList) {
784+
if (!n.valid) {
785+
continue;
786+
}
787+
788+
if (ImGui::Selectable(n.name.c_str(), false)) {
789+
tt.second.tape = n.name;
790+
config->cassette.data.at(tt.first).tape = n.name;
791+
config->Save();
792+
793+
if (activeSkinVariant == CASSETTE) {
794+
cassette.UnloadUnused();
795+
cassette.LoadTape(n.name);
796+
cassette.SelectTape();
783797
}
784798
}
785-
ImGui::EndCombo();
786799
}
800+
ImGui::EndCombo();
801+
}
787802

788-
ImGui::TableNextColumn();
789-
if (ImGui::BeginCombo(("##" + tt.second.name + "reel").c_str(), tt.second.reel.c_str(), ImGuiComboFlags_HeightSmall)) {
790-
for (auto &n : *reelList) {
791-
if (!n.valid) {
792-
continue;
793-
}
803+
ImGui::TableNextColumn();
804+
if (ImGui::BeginCombo(("##" + tt.second.name + "reel").c_str(), tt.second.reel.c_str(), ImGuiComboFlags_HeightSmall)) {
805+
for (auto &n : *reelList) {
806+
if (!n.valid) {
807+
continue;
808+
}
794809

795-
if (ImGui::Selectable(n.name.c_str(), false)) {
796-
tt.second.reel = n.name;
797-
config->cassette.data.at(tt.first).reel = n.name;
798-
config->Save();
810+
if (ImGui::Selectable(n.name.c_str(), false)) {
811+
tt.second.reel = n.name;
812+
config->cassette.data.at(tt.first).reel = n.name;
813+
config->Save();
799814

800-
if (activeSkinVariant == CASSETTE) {
801-
cassette.UnloadUnused();
802-
cassette.LoadReel(n.name);
803-
cassette.SelectTape();
804-
}
815+
if (activeSkinVariant == CASSETTE) {
816+
cassette.UnloadUnused();
817+
cassette.LoadReel(n.name);
818+
cassette.SelectTape();
805819
}
806820
}
807-
ImGui::EndCombo();
808821
}
822+
ImGui::EndCombo();
809823
}
810-
ImGui::EndTable();
811824
}
812-
ImGui::PopStyleVar(2);
825+
ImGui::EndTable();
826+
}
827+
ImGui::PopStyleVar(2);
813828

814-
if (ImGui::Button("Reset")) {
815-
DLOG("resetting cassette config\n");
816-
cassette.config->Default();
817-
config->Save();
818-
if (activeSkinVariant == CASSETTE) {
819-
cassette.SelectTape();
820-
cassette.LoadImages();
821-
cassette.UnloadUnused();
822-
}
829+
if (ImGui::Button("Reset")) {
830+
DLOG("resetting cassette config\n");
831+
cassette.config->Default();
832+
config->Save();
833+
if (activeSkinVariant == CASSETTE) {
834+
cassette.SelectTape();
835+
cassette.LoadImages();
836+
cassette.UnloadUnused();
823837
}
824-
} else if (activeSettingsTab == DIGITAL_CLOCK) {
825-
DigitalClock();
826838
}
827839
}
828840

829841
void DigitalClock() {
830842
ImGui::PushStyleVar(ImGuiStyleVar_GrabMinSize, 40.0f);
831843
ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarSize, 40.0f);
832844
if (ImGui::BeginCombo(
833-
"##digiClockColor", digitalClock.GetColorPreview(config->digitalClock.color).c_str(), ImGuiComboFlags_HeightRegular
845+
"##digiClockColor",
846+
DigitalClock::DigitalClock::GetColorPreview(config->digitalClock.color).c_str(),
847+
ImGuiComboFlags_HeightRegular
834848
)) {
835849
for (const auto &entry : DigitalClock::colorsDigitalClock) {
836850
if (ImGui::Selectable(entry.first.c_str(), false)) {

0 commit comments

Comments
 (0)