diff --git a/src/HexManiac.WPF/Controls/TabView.xaml b/src/HexManiac.WPF/Controls/TabView.xaml
new file mode 100644
index 00000000..52de87f0
--- /dev/null
+++ b/src/HexManiac.WPF/Controls/TabView.xaml
@@ -0,0 +1,194 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Anchor Editor
+ Anchors can have a name and a format.
+
+ Named anchors persist between sessions.
+ You can also use names in pointers and with Goto (Ctrl+G).
+
+ Formats change how the data is displayed and edited.
+ For example, "" formats data as text.
+ To learn more about formats, visit the Wiki.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/HexManiac.WPF/Controls/TabView.xaml.cs b/src/HexManiac.WPF/Controls/TabView.xaml.cs
new file mode 100644
index 00000000..fabc94a8
--- /dev/null
+++ b/src/HexManiac.WPF/Controls/TabView.xaml.cs
@@ -0,0 +1,42 @@
+using HavenSoft.HexManiac.Core.Models;
+using HavenSoft.HexManiac.Core.ViewModels;
+using HavenSoft.HexManiac.Core.ViewModels.Tools;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Input;
+
+namespace HavenSoft.HexManiac.WPF.Controls {
+ public partial class TabView {
+ public IFileSystem FileSystem => (IFileSystem)Application.Current.MainWindow.Resources["FileSystem"];
+ public TabView() => InitializeComponent();
+
+ private void StringToolContentSelectionChanged(object sender, RoutedEventArgs e) {
+ var textbox = (TextBox)sender;
+ var tools = textbox.DataContext as ToolTray;
+ if (tools == null || tools.StringTool == null) return;
+ tools.StringTool.ContentIndex = textbox.SelectionStart;
+ tools.StringTool.ContentSelectionLength = textbox.SelectionLength;
+ }
+
+ private void HeaderMouseDown(object sender, MouseButtonEventArgs e) {
+ HexContent.RaiseEvent(e);
+ }
+
+ private readonly Popup contextMenu = new Popup();
+ private void AddressShowMenu(object sender, MouseButtonEventArgs e) {
+ var element = (FrameworkElement)sender;
+ var viewModel = element.DataContext as ViewPort;
+ if (viewModel == null) return;
+ contextMenu.Child = new Button {
+ Content = "Copy Address"
+ }.SetEvent(Button.ClickEvent, (sender2, e2) => {
+ viewModel.CopyAddress.Execute(FileSystem);
+ contextMenu.IsOpen = false;
+ });
+ contextMenu.PlacementTarget = element;
+ contextMenu.StaysOpen = false;
+ contextMenu.IsOpen = true;
+ }
+ }
+}
diff --git a/src/HexManiac.WPF/HexManiac.WPF.csproj b/src/HexManiac.WPF/HexManiac.WPF.csproj
index 226404b7..b556002b 100644
--- a/src/HexManiac.WPF/HexManiac.WPF.csproj
+++ b/src/HexManiac.WPF/HexManiac.WPF.csproj
@@ -59,6 +59,9 @@
Swatch.xaml
+
+ TabView.xaml
+
ThemeSelector.xaml
@@ -70,6 +73,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/src/HexManiac.WPF/Windows/MainWindow.xaml b/src/HexManiac.WPF/Windows/MainWindow.xaml
index 33617543..758416e8 100644
--- a/src/HexManiac.WPF/Windows/MainWindow.xaml
+++ b/src/HexManiac.WPF/Windows/MainWindow.xaml
@@ -1,19 +1,14 @@
-
-
-
@@ -253,189 +248,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Anchor Editor
- Anchors can have a name and a format.
-
- Named anchors persist between sessions.
- You can also use names in pointers and with Goto (Ctrl+G).
-
- Formats change how the data is displayed and edited.
- For example, "" formats data as text.
- To learn more about formats, visit the Wiki.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/HexManiac.WPF/Windows/MainWindow.xaml.cs b/src/HexManiac.WPF/Windows/MainWindow.xaml.cs
index 0d966270..0e7232b8 100644
--- a/src/HexManiac.WPF/Windows/MainWindow.xaml.cs
+++ b/src/HexManiac.WPF/Windows/MainWindow.xaml.cs
@@ -61,7 +61,7 @@ namespace HavenSoft.HexManiac.WPF.Windows {
}
}
- private static FrameworkElement GetChild(DependencyObject depObj, string name, object dataContext) {
+ public static FrameworkElement GetChild(DependencyObject depObj, string name, object dataContext) {
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++) {
var child = VisualTreeHelper.GetChild(depObj, i);
var childContext = child.GetValue(DataContextProperty);
@@ -119,11 +119,6 @@ namespace HavenSoft.HexManiac.WPF.Windows {
#endregion
- private void HeaderMouseDown(object sender, MouseButtonEventArgs e) {
- var selectedElement = (HexContent)GetChild(Tabs, "HexContent", ViewModel[ViewModel.SelectedIndex]);
- selectedElement.RaiseEvent(e);
- }
-
private void ExitClicked(object sender, EventArgs e) {
ViewModel.CloseAll.Execute();
if (ViewModel.Count == 0) Close();
@@ -166,14 +161,6 @@ namespace HavenSoft.HexManiac.WPF.Windows {
foreach (var action in copy) action();
}
- private void StringToolContentSelectionChanged(object sender, RoutedEventArgs e) {
- var textbox = (TextBox)sender;
- var tools = textbox.DataContext as ToolTray;
- if (tools == null || tools.StringTool == null) return;
- tools.StringTool.ContentIndex = textbox.SelectionStart;
- tools.StringTool.ContentSelectionLength = textbox.SelectionLength;
- }
-
private void AnimateFocusToCorner(object sender, DependencyPropertyChangedEventArgs e) {
var element = (FrameworkElement)sender;
if (element.Visibility != Visibility.Visible) return;
@@ -194,21 +181,5 @@ namespace HavenSoft.HexManiac.WPF.Windows {
themeWindow.Show();
}
}
-
- private readonly Popup contextMenu = new Popup();
- private void AddressShowMenu(object sender, MouseButtonEventArgs e) {
- var element = (FrameworkElement)sender;
- var viewModel = element.DataContext as ViewPort;
- if (viewModel == null) return;
- contextMenu.Child = new Button {
- Content = "Copy Address"
- }.SetEvent(Button.ClickEvent, (sender2, e2) => {
- viewModel.CopyAddress.Execute(FileSystem);
- contextMenu.IsOpen = false;
- });
- contextMenu.PlacementTarget = element;
- contextMenu.StaysOpen = false;
- contextMenu.IsOpen = true;
- }
}
}
diff --git a/src/HexManiac.WPF/Windows/ThemeSelector.xaml b/src/HexManiac.WPF/Windows/ThemeSelector.xaml
index 6a939e1c..aef7c607 100644
--- a/src/HexManiac.WPF/Windows/ThemeSelector.xaml
+++ b/src/HexManiac.WPF/Windows/ThemeSelector.xaml
@@ -29,8 +29,8 @@
-
-
+
+