Skip to content

Commit

Permalink
Numerous bug fixes, misc stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben2776 committed Sep 1, 2019
1 parent 98657b0 commit 8e4a9d4
Show file tree
Hide file tree
Showing 40 changed files with 1,430 additions and 977 deletions.
18 changes: 9 additions & 9 deletions PicView/App.config
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="PicView.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="PicView.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<userSettings>
<PicView.Properties.Settings>
Expand Down Expand Up @@ -138,16 +138,16 @@
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
189 changes: 155 additions & 34 deletions PicView/Configs/Configs.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,165 @@
using System.Windows;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using static PicView.Fields;
using static PicView.FileLists;
using static PicView.Navigation;
using static PicView.Scroll;
using static PicView.Tooltip;

namespace PicView
{
internal static class Configs
{

internal static void ChangeSorting(short sorting)
{
if (Properties.Settings.Default.SortPreference == sorting)
return;

Properties.Settings.Default.SortPreference = sorting;
var tmp = Pics[FolderIndex];
if (!string.IsNullOrWhiteSpace(tmp))
{
Pics = FileList(Path.GetDirectoryName(tmp));
PreloadCount = 4;
Pic(Pics.IndexOf(tmp));
}
var sortcm = cm.Items[5] as MenuItem;

var sort0 = sortcm.Items[0] as MenuItem;
var sort0Header = sort0.Header as RadioButton;

var sort1 = sortcm.Items[1] as MenuItem;
var sort1Header = sort1.Header as RadioButton;

var sort2 = sortcm.Items[2] as MenuItem;
var sort2Header = sort2.Header as RadioButton;

var sort3 = sortcm.Items[3] as MenuItem;
var sort3Header = sort3.Header as RadioButton;

var sort4 = sortcm.Items[4] as MenuItem;
var sort4Header = sort4.Header as RadioButton;

var sort5 = sortcm.Items[5] as MenuItem;
var sort5Header = sort5.Header as RadioButton;

var sort6 = sortcm.Items[6] as MenuItem;
var sort6Header = sort6.Header as RadioButton;

switch (sorting)
{
case 0:
sort0Header.IsChecked = true;
sort1Header.IsChecked = false;
sort2Header.IsChecked = false;
sort3Header.IsChecked = false;
sort4Header.IsChecked = false;
sort5Header.IsChecked = false;
sort6Header.IsChecked = false;
break;
case 1:
sort0Header.IsChecked = false;
sort1Header.IsChecked = true;
sort2Header.IsChecked = false;
sort3Header.IsChecked = false;
sort4Header.IsChecked = false;
sort5Header.IsChecked = false;
sort6Header.IsChecked = false;
break;
case 2:
sort0Header.IsChecked = false;
sort1Header.IsChecked = false;
sort2Header.IsChecked = true;
sort3Header.IsChecked = false;
sort4Header.IsChecked = false;
sort5Header.IsChecked = false;
sort6Header.IsChecked = false;
break;
case 3:
sort0Header.IsChecked = false;
sort1Header.IsChecked = false;
sort2Header.IsChecked = false;
sort3Header.IsChecked = true;
sort4Header.IsChecked = false;
sort5Header.IsChecked = false;
sort6Header.IsChecked = false;
break;
case 4:
sort0Header.IsChecked = false;
sort1Header.IsChecked = false;
sort2Header.IsChecked = false;
sort3Header.IsChecked = false;
sort4Header.IsChecked = true;
sort5Header.IsChecked = false;
sort6Header.IsChecked = false;
break;
case 5:
sort0Header.IsChecked = false;
sort1Header.IsChecked = false;
sort2Header.IsChecked = false;
sort3Header.IsChecked = false;
sort4Header.IsChecked = false;
sort5Header.IsChecked = true;
sort6Header.IsChecked = false;
break;
case 6:
sort0Header.IsChecked = false;
sort1Header.IsChecked = false;
sort2Header.IsChecked = false;
sort3Header.IsChecked = false;
sort4Header.IsChecked = false;
sort5Header.IsChecked = false;
sort6Header.IsChecked = true;
break;
}
}


internal static void SetScrolling(object sender, RoutedEventArgs e)
{
var settingscm = cm.Items[6] as MenuItem;
var scrollcm = settingscm.Items[1] as MenuItem;
var scrollcmHeader = scrollcm.Header as CheckBox;

if (Properties.Settings.Default.ScrollEnabled)
{
IsScrollEnabled = false;
scrollcmHeader.IsChecked = false;
}
else
{
IsScrollEnabled = true;
scrollcmHeader.IsChecked = true;
}
}

internal static void SetLooping(object sender, RoutedEventArgs e)
{
var settingscm = cm.Items[6] as MenuItem;
var loopcm = settingscm.Items[0] as MenuItem;
var loopcmHeader = loopcm.Header as CheckBox;

if (Properties.Settings.Default.Looping)
{
Properties.Settings.Default.Looping = false;
loopcmHeader.IsChecked = false;
ToolTipStyle("Looping disabled");
}
else
{
Properties.Settings.Default.Looping = true;
loopcmHeader.IsChecked = true;
ToolTipStyle("Looping enabled");
}
}

internal static void SetBgColorEnabled(object sender, RoutedEventArgs e)
{
Properties.Settings.Default.WindowBorderColorEnabled = Properties.Settings.Default.WindowBorderColorEnabled ? false : true;
}

internal static void SetSlidetimer()
{
switch (Properties.Settings.Default.Slidetimeren.ToString("0"))
Expand Down Expand Up @@ -71,38 +225,5 @@ internal static void SetSlidetimer()
break;
}
}


internal static void SetScrolling(object sender, RoutedEventArgs e)
{
if (Properties.Settings.Default.ScrollEnabled)
{
Properties.Settings.Default.ScrollEnabled = false;

IsScrollEnabled = false;
}
else
{
Properties.Settings.Default.ScrollEnabled = true;
IsScrollEnabled = true;
}
}

internal static void SetLooping(object sender, RoutedEventArgs e)
{
if (Properties.Settings.Default.Looping)
{
Properties.Settings.Default.Looping = false;
}
else
{
Properties.Settings.Default.Looping = true;
}
}

internal static void SetBgColorEnabled(object sender, RoutedEventArgs e)
{
Properties.Settings.Default.WindowBorderColorEnabled = Properties.Settings.Default.WindowBorderColorEnabled ? false : true;
}
}
}
15 changes: 10 additions & 5 deletions PicView/Misc/Fields.cs → PicView/Fields.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ internal static class Fields

internal static MainWindow mainWindow = ((MainWindow)Application.Current.MainWindow);

/// <summary>
/// File path of current image
/// </summary>
internal static string PicPath { get; set; }
///// <summary>
///// File path of current image
///// </summary>
//internal static string Pics[FolderIndex] { get; set; }

/// <summary>
/// Backup of PicPath
/// Backup of Previous file, if changed folder etc.
/// </summary>
internal static string xPicPath;

Expand All @@ -66,6 +66,11 @@ internal static class Fields
/// </summary>
internal static string TempZipPath { get; set; }

/// <summary>
/// File path for the extracted zip file
/// </summary>
internal static string TempZipFile { get; set; }

/// <summary>
/// Returns zoom percentage. if 100%, return empty string
/// </summary>
Expand Down
Loading

0 comments on commit 8e4a9d4

Please sign in to comment.