Compare commits

...

8 Commits

Author SHA1 Message Date
eb4ef3f092 Delete '.gitlab-ci.yml' 2022-02-09 19:23:29 +00:00
a358e557c3 Update 'README.md' 2022-02-09 19:18:58 +00:00
Adrian Schlett
3919c185a8 Update README.md 2022-01-21 21:09:47 +00:00
Adrian Schlett
cd84ba89ce Update README.md 2022-01-21 20:59:37 +00:00
adroslice
18a2d7154f Improved Drag+Drop & Dark Mode testing
- Drag+Drop now shows a black line where the item is going to be dropped as an additional visual cue to make it more intuitive
- Avalonia's dark default style is lacking two things:
-- Highlights on ListBoxItem are too bright (easy fix)
-- The window decoration remains white (could be disabled and replaced with custom title bar)
2019-12-03 20:12:00 +01:00
adroslice
e107be13c4 Fixed #12 2019-12-01 20:16:46 +01:00
adroslice
4119cb9eac Added pre-sorting
- Pre-sorting uses ascending natural sorting
- Previously, the files would initially be displayed in the order the operating system returned
2019-12-01 20:10:47 +01:00
adroslice
10153a9bd2 Attempt to fix File Path handling
- Now uses unix standard frontslashes for directories internally
- Converts the backslashes windows returns to frontslashes
- Changed default paths
2019-12-01 17:05:00 +01:00
5 changed files with 68 additions and 41 deletions

View File

@ -1,8 +0,0 @@
image: ilyasemenov/gitlab-ci-git-push
stages:
- deploy
deploy to production:
stage: deploy
script: git-push git@github.com:adroslice/bfr.git

View File

@ -114,6 +114,7 @@
<Setter Property="Margin" Value="4,4,4,-5"/>
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="IsEnabled" Value="False"/>
</Style>
<Style Selector="Grid.StyleBorders > Border">
<Setter Property="Margin" Value="4"/>
@ -124,6 +125,18 @@
<Style Selector="Border.ConnectUp">
<Setter Property="Margin" Value="4,-5,4,4"/>
</Style>
<!-- Drag + Drop -->
<Style Selector="ListBoxItem.BlackBottom">
<Setter Property="BorderThickness" Value="0,0,0,2"/>
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="Margin" Value="0,0,0,-2"/>
</Style>
<Style Selector="ListBoxItem.BlackTop">
<Setter Property="BorderThickness" Value="0,2,0,0"/>
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="Margin" Value="0,-2,0,0"/>
</Style>
<!-- Expander Fix -->
<Style Selector="Expander /template/ ToggleButton#PART_toggle /template/ Border">
@ -159,7 +172,7 @@
</Grid>
</Button.Content>
</Button>
<Grid Grid.Column="3" Background="Transparent" Cursor="SizeAll" IsVisible="{Binding $parent.IsPointerOver}" ToolTip.Tip="Click and drag to move this operation." PointerPressed="StartMoveOperation" PointerReleased="EndMoveOperation">
<Grid Grid.Column="3" Background="Transparent" Cursor="SizeAll" IsVisible="{Binding $parent.IsPointerOver}" ToolTip.Tip="Click and drag to move this operation." PointerPressed="StartMoveOperation" PointerReleased="EndMoveOperation" PointerMoved="MoveOperation">
<Path Data="M0,0 L12,0 M0,4 L12,4 M0,8 L12,8" Height="8" VerticalAlignment="Center" Margin="4" Stroke="Black" StrokeThickness="2"/>
</Grid>
<ContentPresenter Grid.ColumnSpan="4" Grid.Row="1" Content="{TemplateBinding Content}" IsVisible="{Binding #OperationExpander.IsExpanded}"/>

View File

@ -6,15 +6,16 @@ using System.Collections.Generic;
using System.Text.RegularExpressions;
using Avalonia;
using Avalonia.Input;
using Avalonia.Controls;
using Avalonia.VisualTree;
using Avalonia.Markup.Xaml;
using Avalonia.LogicalTree;
using BFR.Helpers;
using BFR.DataModels;
using Avalonia.Interactivity;
using Avalonia.Input;
using Avalonia.LogicalTree;
using Avalonia.VisualTree;
using BFR.Operations;
using Avalonia.Markup.Xaml.Styling;
namespace BFR
{
@ -26,8 +27,9 @@ namespace BFR
public async Task OpenDirectoryButtonClick() => OpenDirectory(await new OpenFolderDialog() { Directory = WorkingDirectory }.ShowAsync(this));
public void OpenDirectory(string directory)
{
WorkingDirectory = directory;
AllFiles.ReplaceAll(Directory.GetFiles(WorkingDirectory).Select(x => new FileModel(x)));
WorkingDirectory = directory.Replace('\\', '/');
AllFiles.ReplaceAll(Directory.GetFiles(WorkingDirectory).Select(x => new FileModel(x.Replace('\\', '/'))));
new Sort() { Mode = SortMode.Natural }.ApplyTo(AllFiles);
Filter();
}
@ -94,21 +96,39 @@ namespace BFR
Preview();
}
public void StartMoveOperation(object sender, PointerPressedEventArgs e) =>
private void ClearDropStyling()
{
foreach (ListBoxItem item in OperationsListBox.GetLogicalChildren())
item.Classes.RemoveAll(new[] { "BlackTop", "BlackBottom" });
}
public void StartMoveOperation(object sender, PointerPressedEventArgs e) =>
DragItem = OperationsListBox.GetLogicalChildren().Cast<ListBoxItem>().Single(x => x.IsPointerOver);
public void MoveOperation(object sender, PointerEventArgs e)
{
if (DragItem == null) return;
var hoveredItem = (ListBoxItem)OperationsListBox.GetLogicalChildren().FirstOrDefault(x => this.GetVisualsAt(e.GetPosition(this)).Contains(((IVisual)x).GetVisualChildren().First()));
var dragItemIndex = OperationsListBox.GetLogicalChildren().ToList().IndexOf(DragItem);
var hoveredItemIndex = OperationsListBox.GetLogicalChildren().ToList().IndexOf(hoveredItem);
ClearDropStyling();
if (hoveredItem != DragItem) hoveredItem?.Classes.Add(dragItemIndex > hoveredItemIndex ? "BlackTop" : "BlackBottom");
}
public void EndMoveOperation(object sender, PointerReleasedEventArgs e)
{
var hoveredItem = (ListBoxItem)OperationsListBox.GetLogicalChildren().FirstOrDefault(x => this.GetVisualsAt(e.GetPosition(this)).Contains(((IVisual)x).GetVisualChildren().First()));
if (DragItem == null ||
hoveredItem == null ||
DragItem == hoveredItem)
return;
Operations.Move(
OperationsListBox.GetLogicalChildren().ToList().IndexOf(DragItem),
OperationsListBox.GetLogicalChildren().ToList().IndexOf(hoveredItem));
if (DragItem != null && hoveredItem != null && DragItem != hoveredItem)
{
Operations.Move(
OperationsListBox.GetLogicalChildren().ToList().IndexOf(DragItem),
OperationsListBox.GetLogicalChildren().ToList().IndexOf(hoveredItem));
Preview();
}
ClearDropStyling();
DragItem = null;
Preview();
}
public void Commit()
@ -137,9 +157,15 @@ namespace BFR
{
AvaloniaXamlLoader.Load(this);
DataContext = this;
OpenDirectory(Environment.OSVersion.Platform == PlatformID.Win32NT ? @"C:\Users" : @"\home");
OpenDirectory(Environment.OSVersion.Platform == PlatformID.Win32NT ? @"C:/Users/" : @"/home/");
HandleEvents = true;
OperationsListBox = this.Find<ListBox>("OperationsListBox");
/*var dark = new StyleInclude(new Uri("resm:Styles?assembly=ControlCatalog"))
{
Source = new Uri("resm:Avalonia.Themes.Default.Accents.BaseDark.xaml?assembly=Avalonia.Themes.Default")
};
Styles[0] = dark;/**/
}
}
}

View File

@ -27,8 +27,8 @@
get => $"{Directory}{FullName}";
set
{
FullName = value.Substring(value.LastIndexOf('\\') + 1);
Directory = value.Substring(0, value.LastIndexOf('\\') + 1);
FullName = value.Substring(value.LastIndexOf('/') + 1);
Directory = value.Substring(0, value.LastIndexOf('/') + 1);
}
}

View File

@ -1,28 +1,24 @@
# BFR - A Modular Bulk File Renaming Utility
Inspired by [this project](https://git.lastassault.de/speatzle/BulkFileRenamer) by speatzle_.
Everyone is welcome to contribute!
## Features
- Mordern scalable UI (Avalonia)
- Extremely flexible
- Stack-based undo
- Fast and automatic preview
- Cross-Platform and portable
- Indefinite undo
- Fast automatic preview
- Crossplatform and portable
- Supports RegEx
### Operations
- Add, Remove, Replace, Overwrite, Number, Sort
### Upcoming Features
- [Case Conversion](../issues/1)
- [Save-/Loadable Profiles](../issues/3)
- [Operations based on file Metadata](../issues//4)
- [Optional Subdirectory Scanning](../issues/5)
- [Option to disable automatic previewing](../issues/7)
- [Improved Add-/Remove-Buttons](../issues/6)
- Anything good that gets [requested](../issues)!
### Planned Features
- Case Conversion #1
- Save-/Loadable Profiles #3
- Operations based on file Metadata #4
- Optional Subdirectory Scanning #5
- Anything good that gets [requested](https://git.ulra.eu/adrian/bfr/issues)!
## [Releases](../-/releases)
## [Releases](https://git.ulra.eu/adrian/bfr/releases)
## Screenshot
![](https://i.imgur.com/qHRTmJH.png)