From: HOSOKAWA Kenchi Date: Sat, 20 Mar 2010 05:16:36 +0000 (+0900) Subject: 32 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=5941ac86334f02204b7470b022f69f6cb382850d;p=psychlops%2Fsilverlight.git 32 --- diff --git a/dev3/PsychlopsSilverlight3.csproj b/dev3/PsychlopsSilverlight3.csproj index 001db3b..81480c4 100644 --- a/dev3/PsychlopsSilverlight3.csproj +++ b/dev3/PsychlopsSilverlight3.csproj @@ -51,6 +51,7 @@ + diff --git a/dev3/psychlops/core/app/app.cs b/dev3/psychlops/core/app/app.cs new file mode 100644 index 0000000..827da65 --- /dev/null +++ b/dev3/psychlops/core/app/app.cs @@ -0,0 +1,28 @@ +namespace Psychlops +{ + + public static class AppState + { + + public static string statusBar + { + set { setStatusBar(value); } + } + internal static void setStatusBar(string str) + { + Internal.Main.statusBar.Dispatcher.BeginInvoke(setStatusBar_, str); + } + internal static void setStatusBar__(string str) + { + Internal.Main.statusBar.Text = str; + } + internal delegate void StringDelegate(string str); + internal static StringDelegate setStatusBar_; + + static AppState() + { + setStatusBar_ = new StringDelegate(setStatusBar__); + } + } + +} diff --git a/dev3/psychlops/core/app/misc.cs b/dev3/psychlops/core/app/misc.cs index 25e7956..545e5cb 100644 --- a/dev3/psychlops/core/app/misc.cs +++ b/dev3/psychlops/core/app/misc.cs @@ -14,6 +14,8 @@ { public static System.Threading.Thread routine; public static System.Threading.AutoResetEvent canvas_flag; + public static System.Windows.Controls.TextBlock statusBar; + public static System.Windows.Controls.StackPanel widgetStack; static Main() { diff --git a/dev3/psychlops/core/graphic/canvas.cs b/dev3/psychlops/core/graphic/canvas.cs index d9e0d37..297499e 100644 --- a/dev3/psychlops/core/graphic/canvas.cs +++ b/dev3/psychlops/core/graphic/canvas.cs @@ -7,6 +7,7 @@ using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Shapes; +using System.Windows.Browser; @@ -140,6 +141,12 @@ namespace Psychlops api_canvas.MouseWheel += Mouse.Canvas_MouseWheel; panel.KeyDown += Keyboard.Canvas_KeyDown; panel.KeyUp += Keyboard.Canvas_KeyUp; + + HtmlElement htmlHost = HtmlPage.Document.GetElementById("silverlightControlHost"); + //if (htmlHost != null) HtmlPage.Window.Alert("silverlightControlHost is null"); + htmlHost.SetStyleAttribute("width", (200+wid).ToString()+"px"); + htmlHost.SetStyleAttribute("height", (20+hei).ToString() + "px"); + htmlHost.SetStyleAttribute("margin", "2em auto auto auto"); } #endregion diff --git a/dev3/psychlops/extention/standard/widget.cs b/dev3/psychlops/extention/standard/widget.cs index 21229f4..d0a74c9 100644 --- a/dev3/psychlops/extention/standard/widget.cs +++ b/dev3/psychlops/extention/standard/widget.cs @@ -13,5 +13,23 @@ using System.Windows.Shapes; namespace Psychlops { + namespace Widgets + { + + class Slider + { + } + + + + + internal class Connector + { + internal void stackSlider() + { + } + } + + } } \ No newline at end of file diff --git a/test3/MainPage.xaml b/test3/MainPage.xaml index 1aef993..b7dd27b 100644 --- a/test3/MainPage.xaml +++ b/test3/MainPage.xaml @@ -3,8 +3,16 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"> - - - - + + + + + + + + + + + Status OK + diff --git a/test3/MainPage.xaml.cs b/test3/MainPage.xaml.cs index 8bb50a0..e1f3496 100644 --- a/test3/MainPage.xaml.cs +++ b/test3/MainPage.xaml.cs @@ -14,7 +14,7 @@ namespace PsychlopsSilverlight3test { InitializeComponent(); // Show fps counter - //Canvas.default_buffer_frame = main_buffer; + Canvas.default_api_canvas = LayoutRoot; Canvas.default_panel = this; this.IsTabStop = true; @@ -29,14 +29,13 @@ namespace PsychlopsSilverlight3test //main_routine.RunWorkerAsync(); main = new PsychlopsMain(); - //main.initialize(); Psychlops.Internal.Main.routine = new System.Threading.Thread(main.psychlops_main); Psychlops.Internal.Main.routine.Start(); + //main.initialize(); //main_routine = main.psychlops_main(); -#if DEBUG - DebugConsole = new System.Windows.Controls.TextBlock(); - TotalRoot.Children.Add(DebugConsole); -#endif + + Psychlops.Internal.Main.statusBar = AppStatusBar; + Psychlops.Internal.Main.widgetStack = Controller; } protected void getFocusMouseEnter(object sender, System.Windows.Input.MouseEventArgs e) { this.Focus(); diff --git a/test3/PsychlopsMain.cs b/test3/PsychlopsMain.cs index 6f74ea3..1991b9d 100644 --- a/test3/PsychlopsMain.cs +++ b/test3/PsychlopsMain.cs @@ -41,7 +41,7 @@ namespace PsychlopsSilverlight3test //Figures.drawGabor(ref img, 20, 100, 1, 0, frames * 2.0 * Math.PI / tfreq / 60); //Figures.drawGaussian(ref img, 20, 1); - Figures.drawGrating(ref img, 200, 200, 20, 1, 2, frames * 2.0 * Math.PI / tfreq / 60); + Figures.drawGrating(ref img, 100, 100, 20, 1, 2, frames * 2.0 * Math.PI / tfreq / 60); img.centering(Mouse.position); img.draw(); @@ -53,6 +53,7 @@ namespace PsychlopsSilverlight3test fixation.shift(100,100); fixation.draw(new Stroke(Color.blue, 3)); + AppState.statusBar = "dhdyr"; cnvs.flip(); }