diff --git a/Qrakhen.Qamp.Editor/App.xaml.cs b/Qrakhen.Qamp.Editor/App.xaml.cs
index bf015ce..3d58005 100644
--- a/Qrakhen.Qamp.Editor/App.xaml.cs
+++ b/Qrakhen.Qamp.Editor/App.xaml.cs
@@ -1,4 +1,5 @@
-using System.Configuration;
+using Qrakhen.Qamp.Editor.ViewModel;
+using System.Configuration;
using System.Data;
using System.Windows;
@@ -11,7 +12,7 @@ public partial class App : Application
protected override void OnStartup(StartupEventArgs e)
{
MainWindow window = new MainWindow() {
- DataContext = new ViewModel.EditorFrameViewModel()
+ DataContext = new MainViewModel()
};
window.Show();
diff --git a/Qrakhen.Qamp.Editor/Controls/EditorFrame.xaml.cs b/Qrakhen.Qamp.Editor/Controls/EditorFrame.xaml.cs
index b63c086..d6fb7bf 100644
--- a/Qrakhen.Qamp.Editor/Controls/EditorFrame.xaml.cs
+++ b/Qrakhen.Qamp.Editor/Controls/EditorFrame.xaml.cs
@@ -36,7 +36,10 @@ public partial class EditorFrame : UserControl
if (DataContext is EditorFrameViewModel vm) {
vm.MoveCaretCommand.Execute(
new MoveCaretOptions(
- CalculateCursorPosition(e.GetPosition(this), 0, 0),
+ CalculateCursorPosition(
+ e.GetPosition(LineList),
+ ScrollView.VerticalOffset,
+ ScrollView.HorizontalOffset),
false,
false));
}
@@ -95,13 +98,13 @@ public partial class EditorFrame : UserControl
private BufferPosition CalculateCursorPosition(Point point, double scrollY, double scrollX)
{
var ft = TextHelper.GetText(new string('_', 1), 14, null, VisualTreeHelper.GetDpi(this).PixelsPerDip);
- return new BufferPosition((int)(point.Y / TextHelper.LineHeight), (int)((point.X - 2) / ft.Width));
+ return new BufferPosition((int)(point.Y / TextHelper.LineHeight), (int)((point.X - 5) / ft.Width));
}
private Point CalculateCaretPosition(int line, int index, double scrollY, double scrollX)
{
var ft = TextHelper.GetText(new string('_', index), 14, null, VisualTreeHelper.GetDpi(this).PixelsPerDip);
- return new Point(ft.Width + 2, line * TextHelper.LineHeight);
+ return new Point(ft.Width + 5, line * TextHelper.LineHeight);
}
private void MoveCaret(Point point)
diff --git a/Qrakhen.Qamp.Editor/MainWindow.xaml b/Qrakhen.Qamp.Editor/MainWindow.xaml
index fcd76fc..5802b54 100644
--- a/Qrakhen.Qamp.Editor/MainWindow.xaml
+++ b/Qrakhen.Qamp.Editor/MainWindow.xaml
@@ -17,64 +17,89 @@
-
+
+
+
+
+
+
-
-
+
+
-
+
+ Width="5"
+ BorderBrush="#444648"
+ BorderThickness="1,0,1,0"
+ Margin="0,-1,0,-1"
+ Background="#141516" />
-
-
+
+
-
+
+ Height="5"
+ Margin="-1,0,0,0"
+ BorderBrush="#444648"
+ BorderThickness="0,1,0,1"
+ Background="#141516" />
-
+
+ $ ...
+
-
-
-
-
+
+
+
+
+
diff --git a/Qrakhen.Qamp.Editor/ViewModel/MainViewModel.cs b/Qrakhen.Qamp.Editor/ViewModel/MainViewModel.cs
index 6b6c993..77c1cfb 100644
--- a/Qrakhen.Qamp.Editor/ViewModel/MainViewModel.cs
+++ b/Qrakhen.Qamp.Editor/ViewModel/MainViewModel.cs
@@ -1,10 +1,35 @@
-using System;
+using Qrakhen.Qamp.Editor.Commands;
+using System;
using System.Collections.Generic;
using System.Text;
+using System.Windows.Input;
namespace Qrakhen.Qamp.Editor.ViewModel;
public class MainViewModel
{
+ public EditorFrameViewModel EditorFrame { get; set; }
+ public ICommand RunCommand { get; set; }
+ public ICommand SaveCommand { get; set; }
+ public ICommand LoadCommand { get; set; }
+
+ public MainViewModel()
+ {
+ EditorFrame = new EditorFrameViewModel();
+
+ RunCommand = new RelayCommand(ExecuteRun, CanRun);
+ SaveCommand = null;
+ LoadCommand = null;
+ }
+
+ private void ExecuteRun()
+ {
+
+ }
+
+ private bool CanRun()
+ {
+ return true;
+ }
}