Skip to content

Commit

Permalink
Animated gif files auto-play by default. Configurable in the preferen…
Browse files Browse the repository at this point in the history
…ces.
  • Loading branch information
bluescan committed Feb 23, 2020
1 parent 7d76f4d commit 330d2ad
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Src/Dialogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ void TexView::ShowPropertyEditorWindow(bool* popen)
)
{
CurrImage->PartPlayRev = true;
CurrImage->PartPlaying = !CurrImage->PartPlaying;
if (CurrImage->PartPlaying) CurrImage->Stop(); else CurrImage->Play();
}
ImGui::SameLine();

Expand All @@ -394,7 +394,7 @@ void TexView::ShowPropertyEditorWindow(bool* popen)
)
{
CurrImage->PartPlayRev = false;
CurrImage->PartPlaying = !CurrImage->PartPlaying;
if (CurrImage->PartPlaying) CurrImage->Stop(); else CurrImage->Play();
}
ImGui::SameLine();

Expand Down Expand Up @@ -492,6 +492,8 @@ void TexView::ShowPreferencesWindow(bool* popen)
ImGui::Checkbox("Confirm Deletes", &Config.ConfirmDeletes);
ImGui::Checkbox("Confirm File Overwrites", &Config.ConfirmFileOverwrites);
ImGui::Checkbox("Auto Propery Window", &Config.AutoPropertyWindow);
ImGui::Checkbox("Auto Play GIFs", &Config.AutoPlayAnimatedGIFs);

ImGui::Unindent();
ImGui::Separator();
if (ImGui::Button("Reset UI Settings"))
Expand Down
3 changes: 3 additions & 0 deletions Src/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ void TexView::Settings::ResetBehaviourSettings()
MaxImageMemMB = 1024;
MaxCacheFiles = 7000;
AutoPropertyWindow = true;
AutoPlayAnimatedGIFs = true;
MonitorGamma = tMath::DefaultGamma;
}

Expand Down Expand Up @@ -114,6 +115,7 @@ void TexView::Settings::Load(const tString& filename, int screenW, int screenH)
ReadItem(MaxImageMemMB);
ReadItem(MaxCacheFiles);
ReadItem(AutoPropertyWindow);
ReadItem(AutoPlayAnimatedGIFs);
ReadItem(MonitorGamma);
}
}
Expand Down Expand Up @@ -169,6 +171,7 @@ bool TexView::Settings::Save(const tString& filename)
WriteItem(MaxImageMemMB);
WriteItem(MaxCacheFiles);
WriteItem(AutoPropertyWindow);
WriteItem(AutoPlayAnimatedGIFs);
WriteItem(MonitorGamma);

return true;
Expand Down
1 change: 1 addition & 0 deletions Src/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ namespace TexView
int MaxImageMemMB; // Max image mem before unloading images.
int MaxCacheFiles; // Max number of cache files before removing oldest.
bool AutoPropertyWindow; // Auto display property editor window for supported file types.
bool AutoPlayAnimatedGIFs; // Automatically play animated gifs.
float MonitorGamma; // Used when displaying HDR formats to do gamma correction.

void Load(const tString& filename, int screenWidth, int screenHeight);
Expand Down
7 changes: 7 additions & 0 deletions Src/TacitTexView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,13 @@ void TexView::LoadCurrImage()
if (Config.AutoPropertyWindow)
PropEditorWindow = (CurrImage->TypeSupportsProperties() || (CurrImage->GetNumParts() > 1));

if (Config.AutoPlayAnimatedGIFs && (CurrImage->Filetype == tFileType::GIF) && (CurrImage->GetNumParts() > 1))
{
CurrImage->PartPlayLooping = true;
CurrImage->PartPlayRev = false;
CurrImage->Play();
}

SetWindowTitle();
ResetPan();

Expand Down

0 comments on commit 330d2ad

Please sign in to comment.