Skip to content

Commit

Permalink
pixel perfect representation
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikMennen committed Aug 4, 2024
1 parent d1ff14e commit 9688656
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace OneWare.IasCameraExtension;
public class IasCameraExtensionPackage : IFpgaExtensionPackage
{
public string Name => "IAS Camera Extension";
public string Connector => "PMOD";
public string Connector => "CruviHS";

public IFpgaExtension LoadExtension()
{
Expand Down
28 changes: 16 additions & 12 deletions src/OneWare.IasCameraExtension/Views/IasCameraExtensionView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,26 @@
xmlns:viewModels="clr-namespace:OneWare.IasCameraExtension.ViewModels"
mc:Ignorable="d"
x:Class="OneWare.IasCameraExtension.Views.IasCameraExtensionView"
x:DataType="viewModels:IasCameraExtensionViewModel" Height="444" Width="105" ClipToBounds="False">
x:DataType="viewModels:IasCameraExtensionViewModel" Height="350" Width="88" ClipToBounds="False">
<UserControl.Styles>
<StyleInclude Source="avares://OneWare.UniversalFpgaProjectSystem/Styles/Components.axaml" />
</UserControl.Styles>

<Border CornerRadius="3" BoxShadow="0 0 5 5 #77000000" Classes="CruviExtension" Background="#303030" HorizontalAlignment="Center" VerticalAlignment="Top" Height="244">
<Grid>
<TextBlock Text="VHDPlus" Margin="0, 0, 0, 20" VerticalAlignment="Center"
HorizontalAlignment="Center" />

<Rectangle Fill="#444444" Height="25" Width="100" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 30 0 0"/>
<Border CornerRadius="3" BoxShadow="0 0 5 5 #77000000" VerticalAlignment="Top" HorizontalAlignment="Center" Height="220">
<Border CornerRadius="3" Classes="CruviExtension" Background="#303030">
<Grid>
<TextBlock Text="VHDPlus" Margin="0, 0, 0, 20" VerticalAlignment="Center"
HorizontalAlignment="Center" />

<TextBlock Text="CSI Camera" VerticalAlignment="Center" Margin="0 80 0 0"
HorizontalAlignment="Center" />

<Rectangle Fill="#444444" Margin="0, -3, 0,0" Width="60" Height="30" HorizontalAlignment="Center" VerticalAlignment="Top" />
</Grid>
<Rectangle Fill="#444444" Height="25" Width="100" HorizontalAlignment="Center"
VerticalAlignment="Center" Margin="0 30 0 0" />

<TextBlock Text="CSI Camera" VerticalAlignment="Center" Margin="0 80 0 0"
HorizontalAlignment="Center" />

<Rectangle Fill="#444444" Margin="0, -3, 0,0" Width="60" Height="30" HorizontalAlignment="Center"
VerticalAlignment="Top" />
</Grid>
</Border>
</Border>
</UserControl>
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
</Setter>
</Style>

<Style Selector="Button.Connectable" x:DataType="models:FpgaPinModel" x:CompileBindings="True">
<Style Selector="Button.Connectable" x:DataType="models:FpgaPinModel">
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@

namespace OneWare.UniversalFpgaProjectSystem.ViewModels.FpgaGuiElements;

public class FpgaGuiElementCruviHsViewModel : FpgaGuiElementRectViewModel
public class FpgaGuiElementCruviHsViewModel : FpgaGuiElementViewModelBase
{
private const int DefaultWidth = 80;

private const int DefaultHeight = 20;

public FpgaInterfaceModel? InterfaceModel { get; init; }

public FpgaGuiElementCruviHsViewModel(int x, int y, int width, int height, IBrush color) : base(x, y,
width == 0 ? DefaultWidth : width, height == 0 ? DefaultHeight : height, color)
public FpgaGuiElementCruviHsViewModel(int x, int y) : base(x, y)
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@

namespace OneWare.UniversalFpgaProjectSystem.ViewModels.FpgaGuiElements;

public class FpgaGuiElementPmodViewModel : FpgaGuiElementRectViewModel
public class FpgaGuiElementPmodViewModel : FpgaGuiElementViewModelBase
{
private const int DefaultWidth = 90;

private const int DefaultHeight = 30;

public FpgaInterfaceModel? InterfaceModel { get; init; }

public FpgaGuiElementPmodViewModel(int x, int y, int width, int height, IBrush color) : base(x, y,
width == 0 ? DefaultWidth : width, height == 0 ? DefaultHeight : height, color)
public FpgaGuiElementPmodViewModel(int x, int y) : base(x, y)
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace OneWare.UniversalFpgaProjectSystem.ViewModels.FpgaGuiElements;

public class FpgaGuiElementViewModelBase : ObservableObject
public abstract class FpgaGuiElementViewModelBase : ObservableObject
{
public int X { get; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private async Task LoadGuiAsync()
element.TryGetProperty("bind", out var bindProperty);
FpgaModel.InterfaceModels.TryGetValue(bindProperty.GetString() ?? string.Empty, out var interfaceModel);

Elements.Add(new FpgaGuiElementPmodViewModel(x, y, width, height, color!)
Elements.Add(new FpgaGuiElementPmodViewModel(x, y)
{
Rotation = rotation,
InterfaceModel = interfaceModel,
Expand All @@ -159,7 +159,7 @@ private async Task LoadGuiAsync()
element.TryGetProperty("bind", out var bindProperty);
FpgaModel.InterfaceModels.TryGetValue(bindProperty.GetString() ?? string.Empty, out var interfaceModel);

Elements.Add(new FpgaGuiElementCruviHsViewModel(x, y, width, height, color!)
Elements.Add(new FpgaGuiElementCruviHsViewModel(x, y)
{
Rotation = rotation,
InterfaceModel = interfaceModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,36 @@
xmlns:converters="clr-namespace:OneWare.Essentials.Converters;assembly=OneWare.Essentials"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="OneWare.UniversalFpgaProjectSystem.Views.FpgaGuiElements.FpgaGuiElementCruviHsView"
x:DataType="fpgaGuiElements:FpgaGuiElementCruviHsViewModel"
Height="{Binding Height}"
Width="{Binding Width}">
x:DataType="fpgaGuiElements:FpgaGuiElementCruviHsViewModel" ClipToBounds="False"
Height="20"
Width="60">
<UserControl.RenderTransform>
<RotateTransform Angle="{Binding Rotation}" />
</UserControl.RenderTransform>
<Panel>
<Menu Classes="BindMenu" DragDrop.AllowDrop="True">
<MenuItem BorderThickness="0" Padding="0" Cursor="Hand" Width="{Binding Width}"
<MenuItem BorderThickness="0" Padding="0" Cursor="Hand"
Classes="RootMenuItem"
ItemsSource="{Binding InterfaceModel.InterfaceMenu, FallbackValue={x:Null}}">
<MenuItem.Header>
<Panel>
<Rectangle Fill="#202020" Height="20" Width="70" Margin="5 0 5 0" />
<Rectangle Fill="#202020" Height="10" Width="80" />
<TextBlock Text="CRUVI HS"
Height="15" TextAlignment="Center" Width="60" HorizontalAlignment="Center"/>
<Rectangle Fill="#202020" Height="20" Width="54" Margin="3 0 3 0" />
<Rectangle Fill="#202020" Height="10" Width="60" />
<TextBlock Text="CRUVI HS" Foreground="White" FontSize="10" VerticalAlignment="Center"
TextAlignment="Center" Width="60" HorizontalAlignment="Center"/>
</Panel>
</MenuItem.Header>
<MenuItem.Styles>
<Style Selector="MenuItem.RootMenuItem:pointerover /template/ Border#root">
<Setter Property="Background" Value="Transparent"/>
</Style>
</MenuItem.Styles>
</MenuItem>
</Menu>
<Border
IsVisible="{Binding InterfaceModel.ConnectionViewModel, FallbackValue={x:Null}, Converter={x:Static ObjectConverters.IsNotNull}}"
VerticalAlignment="Center" HorizontalAlignment="Center">
<ContentPresenter DataContext="{Binding InterfaceModel.ConnectionViewModel, FallbackValue={x:Null}}"
Content="{Binding}" />
<ContentPresenter Content="{Binding InterfaceModel.ConnectionViewModel, FallbackValue={x:Null}}" />
</Border>
</Panel>
</UserControl>
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,24 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="OneWare.UniversalFpgaProjectSystem.Views.FpgaGuiElements.FpgaGuiElementPmodView"
x:DataType="fpgaGuiElements:FpgaGuiElementPmodViewModel" ClipToBounds="False"
Height="{Binding Height}"
Width="{Binding Width}">
Height="20"
Width="60">
<UserControl.RenderTransform>
<RotateTransform Angle="{Binding Rotation}" />
</UserControl.RenderTransform>
<Panel>
<Button Background="#101010">
<Button.Flyout>
<MenuFlyout FlyoutPresenterClasses="BindMenu" ItemsSource="{Binding InterfaceModel.InterfaceMenu, FallbackValue={x:Null}}" />
</Button.Flyout>
<Panel>
<Rectangle Fill="#202020" Height="20" Width="60" HorizontalAlignment="Center" />
<TextBlock Text="PMOD" Foreground="White" HorizontalAlignment="Center"
VerticalAlignment="Center" Height="15" TextAlignment="Center" />
</Panel>
</Button>
<Menu Classes="BindMenu" DragDrop.AllowDrop="True">
<MenuItem BorderThickness="0" Padding="0" Cursor="Hand"
ItemsSource="{Binding InterfaceModel.InterfaceMenu, FallbackValue={x:Null}}">
<MenuItem.Header>
<Panel>
<Rectangle Fill="#202020" Height="20" Width="60" />
<TextBlock Text="PMOD" Foreground="White" HorizontalAlignment="Center" FontSize="10"
VerticalAlignment="Center" TextAlignment="Center" />
</Panel>
</MenuItem.Header>
</MenuItem>
</Menu>
<Border
IsVisible="{Binding InterfaceModel.ConnectionViewModel, FallbackValue={x:Null}, Converter={x:Static ObjectConverters.IsNotNull}}"
VerticalAlignment="Center" HorizontalAlignment="Center">
Expand Down

0 comments on commit 9688656

Please sign in to comment.