Skip to content

Commit 414aad5

Browse files
created plugins interface
1 parent 411c01d commit 414aad5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+642
-109
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
FlipnoteDesktop/bin/
44
FlipnoteDesktop/obj/
55
FlipnoteDesktop/Properties/VersionCounter.cs
6-
FlipnoteDesktop/FlipnoteDesktop.csproj.user
6+
FlipnoteDesktop/FlipnoteDesktop.csproj.user
7+
G_TypeConsole/bin/
8+
G_TypeConsole/obj/

FlipnoteDesktop.sln

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ VisualStudioVersion = 15.0.28307.1169
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlipnoteDesktop", "FlipnoteDesktop\FlipnoteDesktop.csproj", "{9E15DC82-CCDE-447D-91F9-988E917147EA}"
77
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{668EC33D-F7E1-4F5C-8614-EFB8FE82553F}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "G_TypeConsole", "G_TypeConsole\G_TypeConsole.csproj", "{6C6B6EBE-0CE4-4EBE-9FF6-12631A5BC0BF}"
11+
EndProject
812
Global
913
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1014
Debug|Any CPU = Debug|Any CPU
@@ -15,10 +19,17 @@ Global
1519
{9E15DC82-CCDE-447D-91F9-988E917147EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
1620
{9E15DC82-CCDE-447D-91F9-988E917147EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
1721
{9E15DC82-CCDE-447D-91F9-988E917147EA}.Release|Any CPU.Build.0 = Release|Any CPU
22+
{6C6B6EBE-0CE4-4EBE-9FF6-12631A5BC0BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+
{6C6B6EBE-0CE4-4EBE-9FF6-12631A5BC0BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+
{6C6B6EBE-0CE4-4EBE-9FF6-12631A5BC0BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
25+
{6C6B6EBE-0CE4-4EBE-9FF6-12631A5BC0BF}.Release|Any CPU.Build.0 = Release|Any CPU
1826
EndGlobalSection
1927
GlobalSection(SolutionProperties) = preSolution
2028
HideSolutionNode = FALSE
2129
EndGlobalSection
30+
GlobalSection(NestedProjects) = preSolution
31+
{6C6B6EBE-0CE4-4EBE-9FF6-12631A5BC0BF} = {668EC33D-F7E1-4F5C-8614-EFB8FE82553F}
32+
EndGlobalSection
2233
GlobalSection(ExtensibilityGlobals) = postSolution
2334
SolutionGuid = {3D063199-4222-4D97-9059-BCE39666CE39}
2435
EndGlobalSection

FlipnoteDesktop/App.xaml.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using System.IO;
1212
using System.Diagnostics;
1313
using System.Security.Cryptography;
14+
using System.Reflection;
1415

1516
namespace FlipnoteDesktop
1617
{
@@ -73,7 +74,14 @@ private void Application_Startup(object sender, StartupEventArgs e)
7374
{
7475

7576
}
76-
77-
}
77+
}
78+
79+
public static void ImportPlugin(string dllpath)
80+
{
81+
Assembly myassembly = Assembly.LoadFrom(dllpath);
82+
Type type = myassembly.GetType("FDHeader.Metadata");
83+
string plugin_name = type.GetField("PluginName").GetValue(null) as string;
84+
///
85+
}
7886
}
7987
}

FlipnoteDesktop/Controls/BrushPatternSelector.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
xmlns:local="clr-namespace:FlipnoteDesktop.Controls"
77
xmlns:drawable="clr-namespace:FlipnoteDesktop.Drawable"
88
mc:Ignorable="d"
9+
x:ClassModifier="internal"
910
d:DesignHeight="30" d:DesignWidth="50">
1011
<UserControl.Resources>
1112
<ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">

FlipnoteDesktop/Controls/BrushPatternSelector.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ namespace FlipnoteDesktop.Controls
2020
/// <summary>
2121
/// Interaction logic for BrushPatternSelector.xaml
2222
/// </summary>
23-
public partial class BrushPatternSelector : UserControl
23+
internal partial class BrushPatternSelector : UserControl
2424
{
2525
public BrushPatternSelector()
2626
{
2727
InitializeComponent();
2828
ComboBox.ItemsSource = BrushPatterns.NamesList();
2929
}
3030

31-
public static DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(Pattern), typeof(BrushPatternSelector),
31+
internal static DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(Pattern), typeof(BrushPatternSelector),
3232
new FrameworkPropertyMetadata(BrushPatterns.Mono, new PropertyChangedCallback(ValuePropertyChanged)));
3333

3434
private static void ValuePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
@@ -37,7 +37,7 @@ private static void ValuePropertyChanged(DependencyObject d, DependencyPropertyC
3737
o.ValueChanged?.Invoke(o);
3838
}
3939

40-
public Pattern Value
40+
internal Pattern Value
4141
{
4242
get => GetValue(ValueProperty) as Pattern;
4343
set

FlipnoteDesktop/Controls/FrameCanvasEditor.xaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6-
xmlns:local="clr-namespace:FlipnoteDesktop.Controls"
6+
xmlns:local="clr-namespace:FlipnoteDesktop.Controls"
7+
xmlns:drawable="clr-namespace:FlipnoteDesktop.Drawable"
78
mc:Ignorable="d"
89
d:DesignHeight="450" d:DesignWidth="800" Background="Gray"
910
PreviewMouseWheel="UserControl_PreviewMouseWheel"
@@ -26,7 +27,16 @@
2627
<CheckBox Name="PaperColorSelector" Height="30" Style="{DynamicResource PaperColorSelector}" Margin="3 2 3 2"
2728
Checked="PaperColorSelector_Checked" Unchecked="PaperColorSelector_Unchecked"
2829
ToolTip="Paper background"/>
29-
<StackPanel Margin="3 2 3 2" Name="ToolOptions" Orientation="Horizontal" Height="30"/>
30+
<StackPanel Margin="3 2 0 2" Name="ToolOptions" Orientation="Horizontal" Height="30"/>
31+
<!--Separator line:-->
32+
<StackPanel Width="1" Height="30" Background="#F97300" Margin="7 0"/>
33+
<Button Style="{DynamicResource ResourceKey=SimpleButton}" Width="18" Height="18" BorderThickness="0"
34+
Name="PlayFlipnoteButton"
35+
ToolTip="Compile and Play flipnote">
36+
<Button.Content>
37+
<drawable:RightPointingTriangle/>
38+
</Button.Content>
39+
</Button>
3040
</WrapPanel>
3141
<ScrollViewer Name="ScrollViewer" Grid.Row="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" FocusVisualStyle="{x:Null}"
3242
PreviewMouseMove="ScrollViewer_PreviewMouseMove">
@@ -66,7 +76,8 @@
6676
<Canvas Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ClipToBounds="True">
6777
<local:ToolsPanel x:Name="ToolBox" Canvas.Top="30" Canvas.Left="10" Width="50" Height="170"/>
6878
</Canvas>
69-
<StackPanel Grid.Row="1" IsHitTestVisible="False" HorizontalAlignment="Left" VerticalAlignment="Top">
79+
<StackPanel Grid.Row="1" IsHitTestVisible="False" HorizontalAlignment="Left" VerticalAlignment="Top"
80+
Visibility="Collapsed">
7081
<TextBlock>Mouse position = <Run Name="DbgCanvasPos">(X,Y)</Run></TextBlock>
7182
</StackPanel>
7283
</Grid>

FlipnoteDesktop/Controls/PenPatternSelector.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
xmlns:local="clr-namespace:FlipnoteDesktop.Controls"
77
xmlns:drawable="clr-namespace:FlipnoteDesktop.Drawable"
88
mc:Ignorable="d"
9+
x:ClassModifier="internal"
910
d:DesignHeight="30" d:DesignWidth="50">
1011
<UserControl.Resources>
1112
<ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
@@ -114,8 +115,8 @@
114115
<Border Name="Border" CornerRadius="2" SnapsToDevicePixels="true" Margin="3" Background="{TemplateBinding Background}"
115116
BorderBrush="Transparent"
116117
BorderThickness="2"
117-
Width="24" Height="24">
118-
<drawable:PenPatternSample PatternName="{TemplateBinding Content}" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
118+
Width="32" Height="32">
119+
<drawable:PenPatternSample PatternName="{TemplateBinding Content}" RenderOptions.BitmapScalingMode="Linear"/>
119120
</Border>
120121

121122
<ControlTemplate.Triggers>

FlipnoteDesktop/Controls/PenPatternSelector.xaml.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ namespace FlipnoteDesktop.Controls
2020
/// <summary>
2121
/// Interaction logic for PenPatternSelector.xaml
2222
/// </summary>
23-
public partial class PenPatternSelector : UserControl
23+
internal partial class PenPatternSelector : UserControl
2424
{
2525
public PenPatternSelector()
2626
{
2727
InitializeComponent();
2828
ComboBox.ItemsSource = PenPatterns.NamesList();
2929
}
3030

31-
public static DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(Pattern), typeof(PenPatternSelector),
31+
internal static DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(Pattern), typeof(PenPatternSelector),
3232
new FrameworkPropertyMetadata(PenPatterns.Mono, new PropertyChangedCallback(ValuePropertyChanged)));
3333

3434
private static void ValuePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
@@ -37,7 +37,7 @@ private static void ValuePropertyChanged(DependencyObject d, DependencyPropertyC
3737
o.ValueChanged?.Invoke(o);
3838
}
3939

40-
public Pattern Value
40+
internal Pattern Value
4141
{
4242
get => GetValue(ValueProperty) as Pattern;
4343
set
@@ -54,8 +54,9 @@ private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs
5454
DataContext = new PenPatternSample
5555
{
5656
PatternName = (string)ComboBox.SelectedItem,
57-
Padding = new Thickness(3)
57+
Padding = new Thickness(1),
5858
};
59+
RenderOptions.SetBitmapScalingMode((DataContext as PenPatternSample), BitmapScalingMode.Linear);
5960
Value = (DataContext as PenPatternSample).Pattern;
6061
}
6162
}

FlipnoteDesktop/Drawable/BrushPatternSample.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
66
xmlns:local="clr-namespace:FlipnoteDesktop.Drawable"
77
mc:Ignorable="d"
8+
x:ClassModifier="internal"
89
d:DesignHeight="450" d:DesignWidth="800">
910
<Viewbox Stretch="Uniform">
1011
<Canvas Width="12" Height="12" Background="White">

FlipnoteDesktop/Drawable/BrushPatternSample.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace FlipnoteDesktop.Drawable
1919
/// <summary>
2020
/// Interaction logic for BrushPatternSample.xaml
2121
/// </summary>
22-
public partial class BrushPatternSample : UserControl
22+
internal partial class BrushPatternSample : UserControl
2323
{
2424
public BrushPatternSample()
2525
{
@@ -30,7 +30,7 @@ public BrushPatternSample()
3030

3131
public bool IsPen;
3232

33-
public static DependencyProperty PatternNameProperty = DependencyProperty.Register("PatternName", typeof(string), typeof(BrushPatternSample),
33+
internal static DependencyProperty PatternNameProperty = DependencyProperty.Register("PatternName", typeof(string), typeof(BrushPatternSample),
3434
new PropertyMetadata("Default", new PropertyChangedCallback(PatternNamePropertyChanged)));
3535

3636
public string PatternName
@@ -39,7 +39,7 @@ public string PatternName
3939
set => SetValue(PatternNameProperty, value);
4040
}
4141

42-
public Pattern Pattern
42+
internal Pattern Pattern
4343
{
4444
get => typeof(BrushPatterns).GetField(PatternName).GetValue(null) as Pattern;
4545
}

0 commit comments

Comments
 (0)