style it good
This commit is contained in:
parent
a39096014c
commit
f002cd8de4
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -17,8 +17,10 @@
|
|||
<RowDefinition Height="18" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0"
|
||||
Background="#202122">
|
||||
<Menu Background="#202122"
|
||||
Background="#141516">
|
||||
<Border BorderBrush="#444648"
|
||||
BorderThickness="0,0,0,1">
|
||||
<Menu Background="#141516"
|
||||
VerticalAlignment="Stretch"
|
||||
VerticalContentAlignment="Center"
|
||||
Height="32">
|
||||
|
|
@ -38,43 +40,66 @@
|
|||
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Grid Grid.Row="2"
|
||||
Background="#141516">
|
||||
<Border BorderBrush="#444648"
|
||||
BorderThickness="0,1,0,0">
|
||||
<Label Foreground="#80efefef"
|
||||
FontSize="10"
|
||||
Padding="2">Fun & Status</Label>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="5*" />
|
||||
<ColumnDefinition Width="*"
|
||||
MinWidth="8" />
|
||||
<ColumnDefinition Width="5*"
|
||||
MinWidth="8" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0" Background="#242526">
|
||||
<Grid Grid.Column="0" Background="#1c1d1e">
|
||||
|
||||
</Grid>
|
||||
<GridSplitter Grid.Column="0"
|
||||
ResizeDirection="Columns"
|
||||
Width="1"
|
||||
Background="#40fefefe" />
|
||||
Width="5"
|
||||
BorderBrush="#444648"
|
||||
BorderThickness="1,0,1,0"
|
||||
Margin="0,-1,0,-1"
|
||||
Background="#141516" />
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="5*" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="5*"
|
||||
MinHeight="8" />
|
||||
<RowDefinition Height="*"
|
||||
MinHeight="8" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<controls:EditorFrame />
|
||||
<controls:EditorFrame DataContext="{Binding EditorFrame}" />
|
||||
</Grid>
|
||||
<GridSplitter Grid.Row="0"
|
||||
ResizeDirection="Rows"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Bottom"
|
||||
Height="1"
|
||||
Background="#40fefefe" />
|
||||
Height="5"
|
||||
Margin="-1,0,0,0"
|
||||
BorderBrush="#444648"
|
||||
BorderThickness="0,1,0,1"
|
||||
Background="#141516" />
|
||||
<Grid Grid.Row="1" Background="#1e1f20">
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<TextBlock Background="#202122"
|
||||
Foreground="#32ef64"
|
||||
Padding="4"
|
||||
FontFamily="Consolas">$ ...</TextBlock>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid Grid.Row="2"
|
||||
Background="#141516">
|
||||
<Label Foreground="#80efefef"
|
||||
FontSize="10"
|
||||
Padding="2">Fun & Status</Label>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Window.InputBindings>
|
||||
<KeyBinding Key="F5" Command="{Binding RunCommand}" />
|
||||
<KeyBinding Key="S" Modifiers="Ctrl" Command="{Binding SaveCommand}" />
|
||||
</Window.InputBindings>
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue