mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-01-30 19:19:03 +01:00
massive UI overhaul:
- user interface can now be toggled between - **split view**: classic ChanSort UI with new/ordered and old/full list side-by-side - **single-table**: simplified and more intuitive UI, but not quite as powerful When you choose to "Modify current list", the single-table view is used by default, otherwise the split view. But you can always toggle between them. - added option to select a color theme. The UI now uses the "Office 2019 Colorful" theme by default, the old theme was "Office 2016 Blue". - improved many keyboard shortcuts (open the drop-down menus to see the shortcuts) - improved some icons to work better with dark themes
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace ChanSort.Api
|
||||
@@ -96,15 +95,28 @@ namespace ChanSort.Api
|
||||
{
|
||||
if (channels.Count == 0)
|
||||
return;
|
||||
|
||||
if (up && channels[0].GetPosition(this.SubListIndex) <= this.ChannelList.FirstProgramNumber)
|
||||
return;
|
||||
if (channels.Any(ch => ch.NewProgramNr < 0))
|
||||
return;
|
||||
|
||||
int maxNr = this.ChannelList.Channels.Count == 0 ? 0 : this.ChannelList.Channels.Max(c => c.GetPosition(this.SubListIndex));
|
||||
int delta = (up ? -1 : +1);
|
||||
foreach (var channel in (up ? channels : channels.Reverse()))
|
||||
{
|
||||
int newProgramNr = channel.GetPosition(this.SubListIndex) + delta;
|
||||
ChannelInfo channelAtNewPos =
|
||||
this.ChannelList.Channels.FirstOrDefault(ch => ch.GetPosition(this.SubListIndex) == newProgramNr);
|
||||
if (newProgramNr < 0) // can't move a channel up when it's not in the list
|
||||
continue;
|
||||
if (newProgramNr == 0) // "+" should work like "add at the end" when the channel is not in the list yet
|
||||
{
|
||||
newProgramNr = ++maxNr;
|
||||
channel.SetPosition(this.SubListIndex, newProgramNr);
|
||||
continue;
|
||||
}
|
||||
|
||||
maxNr = Math.Max(maxNr, newProgramNr);
|
||||
ChannelInfo channelAtNewPos = this.ChannelList.Channels.FirstOrDefault(ch => ch.GetPosition(this.SubListIndex) == newProgramNr);
|
||||
if (channelAtNewPos != null)
|
||||
channelAtNewPos.ChangePosition(this.SubListIndex, -delta);
|
||||
channel.ChangePosition(this.SubListIndex, delta);
|
||||
|
||||
Reference in New Issue
Block a user