Add samples
This commit is contained in:
Родитель
bee21c4a42
Коммит
4255b59b8a
|
@ -0,0 +1,52 @@
|
|||
//
|
||||
// AssemblyInfo.cs
|
||||
//
|
||||
// Author:
|
||||
// Lluis Sanchez <lluis@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2011 Xamarin Inc
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("GtkTest")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("Xamarin Inc")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>10.0.0</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{0AF50CE4-E455-4A9D-92AD-711CBD068A55}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>GtkTest</RootNamespace>
|
||||
<AssemblyName>GtkTest</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Externalconsole>true</Externalconsole>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Samples\Samples.csproj">
|
||||
<Project>{88C04B85-B69B-47B4-AB9F-64F6DD4E0897}</Project>
|
||||
<Name>Samples</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Xwt\Xwt.csproj">
|
||||
<Project>{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}</Project>
|
||||
<Name>Xwt</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Xwt.Gtk\Xwt.Gtk.csproj">
|
||||
<Project>{C3887A93-B2BD-4097-8E2F-3A063EFF32FD}</Project>
|
||||
<Name>Xwt.Gtk</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,38 @@
|
|||
//
|
||||
// Main.cs
|
||||
//
|
||||
// Author:
|
||||
// Lluis Sanchez <lluis@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2011 Xamarin Inc
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
using Samples;
|
||||
|
||||
namespace GtkTest
|
||||
{
|
||||
class MainClass
|
||||
{
|
||||
public static void Main (string[] args)
|
||||
{
|
||||
App.Run ("Xwt.GtkBackend.GtkEngine, Xwt.Gtk, Version=1.0.0.0");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.yourcompany.MacTest</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>MacTest</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.6</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,70 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>10.0.0</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{2B7FF081-FE53-42F7-9D5D-D4B38E548F94}</ProjectGuid>
|
||||
<ProjectTypeGuids>{948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>MacTest</RootNamespace>
|
||||
<AssemblyName>MacTest</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="MonoMac">
|
||||
<HintPath>..\..\..\nowork\monomac\src\MonoMac.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Main.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Mono\MonoMac\v0.0\Mono.MonoMac.targets" />
|
||||
<ItemGroup>
|
||||
<None Include="Info.plist" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Xwt\Xwt.csproj">
|
||||
<Project>{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}</Project>
|
||||
<Name>Xwt</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Xwt.Mac\Xwt.Mac.csproj">
|
||||
<Project>{B7C1673E-5124-4BE5-8D21-EC8B12F85B6B}</Project>
|
||||
<Name>Xwt.Mac</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Samples\Samples.csproj">
|
||||
<Project>{88C04B85-B69B-47B4-AB9F-64F6DD4E0897}</Project>
|
||||
<Name>Samples</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<MonoDevelop>
|
||||
<Properties>
|
||||
<Policies>
|
||||
<DotNetNamingPolicy DirectoryNamespaceAssociation="None" ResourceNamePolicy="FileName" />
|
||||
</Policies>
|
||||
</Properties>
|
||||
</MonoDevelop>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
using Xwt;
|
||||
using Xwt.Drawing;
|
||||
using MonoDevelop.Components.Chart;
|
||||
using Samples;
|
||||
|
||||
namespace MacTest
|
||||
{
|
||||
class MainClass
|
||||
{
|
||||
static void Main (string [] args)
|
||||
{
|
||||
App.Run ("Xwt.Mac.MacEngine, Xwt.Mac, Version=1.0.0.0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using Xwt;
|
||||
using Xwt.Drawing;
|
||||
using MonoDevelop.Components.Chart;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
public class App
|
||||
{
|
||||
public static void Run (string engineType)
|
||||
{
|
||||
Application.Initialize (engineType);
|
||||
|
||||
MainWindow w = new MainWindow ();
|
||||
w.Title = "Xwt Demo Application";
|
||||
w.Width = 500;
|
||||
w.Height = 400;
|
||||
w.Show ();
|
||||
|
||||
Application.Run ();
|
||||
|
||||
w.Dispose ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
using System;
|
||||
using Xwt;
|
||||
using Xwt.Drawing;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
public class MainWindow: Window
|
||||
{
|
||||
TreeView samplesTree;
|
||||
TreeStore store;
|
||||
Image icon;
|
||||
VBox sampleBox;
|
||||
Label title;
|
||||
Widget currentSample;
|
||||
|
||||
DataField<string> nameCol = new DataField<string> ();
|
||||
DataField<Widget> widgetCol = new DataField<Widget> ();
|
||||
DataField<Image> iconCol = new DataField<Image> ();
|
||||
|
||||
public MainWindow ()
|
||||
{
|
||||
Menu menu = new Menu ();
|
||||
|
||||
var file = new MenuItem ("File");
|
||||
file.SubMenu = new Menu ();
|
||||
file.SubMenu.Items.Add (new MenuItem ("Open"));
|
||||
file.SubMenu.Items.Add (new MenuItem ("New"));
|
||||
file.SubMenu.Items.Add (new MenuItem ("Close"));
|
||||
menu.Items.Add (file);
|
||||
|
||||
var edit = new MenuItem ("Edit");
|
||||
edit.SubMenu = new Menu ();
|
||||
edit.SubMenu.Items.Add (new MenuItem ("Copy"));
|
||||
edit.SubMenu.Items.Add (new MenuItem ("Cut"));
|
||||
edit.SubMenu.Items.Add (new MenuItem ("Paste"));
|
||||
menu.Items.Add (edit);
|
||||
|
||||
MainMenu = menu;
|
||||
|
||||
|
||||
HBox box = new HBox ();
|
||||
|
||||
icon = Image.FromResource (typeof(App), "class.png");
|
||||
|
||||
store = new TreeStore (nameCol, iconCol, widgetCol);
|
||||
samplesTree = new TreeView ();
|
||||
samplesTree.Columns.Add ("Name", iconCol, nameCol);
|
||||
|
||||
var n = AddSample (null, "Drawing", null);
|
||||
AddSample (n, "Chart", new ChartSample ());
|
||||
AddSample (null, "Notebook", new NotebookSample ());
|
||||
AddSample (null, "Boxes", new Boxes ());
|
||||
AddSample (null, "List View", new ListView1 ());
|
||||
AddSample (null, "Drag & Drop", new DragDrop ());
|
||||
|
||||
samplesTree.DataSource = store;
|
||||
|
||||
box.PackStart (samplesTree);
|
||||
|
||||
sampleBox = new VBox ();
|
||||
title = new Label ("Sample:");
|
||||
sampleBox.PackStart (title, BoxMode.None);
|
||||
|
||||
box.PackStart (sampleBox, BoxMode.FillAndExpand);
|
||||
|
||||
Add (box);
|
||||
|
||||
samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged;
|
||||
}
|
||||
|
||||
void HandleSamplesTreeSelectionChanged (object sender, EventArgs e)
|
||||
{
|
||||
if (samplesTree.SelectedItem != null) {
|
||||
if (currentSample != null)
|
||||
sampleBox.Remove (currentSample);
|
||||
Widget w = store.GetNavigatorAt (samplesTree.SelectedItem).GetValue (widgetCol);
|
||||
if (w != null)
|
||||
sampleBox.PackStart (w, BoxMode.FillAndExpand);
|
||||
string txt = System.Xaml.XamlServices.Save (w);
|
||||
currentSample = w;
|
||||
}
|
||||
}
|
||||
|
||||
TreePosition AddSample (TreePosition pos, string name, Widget page)
|
||||
{
|
||||
//if (page != null)
|
||||
// page.Margin.SetAll (5);
|
||||
return store.AddNode (pos).SetValue (nameCol, name).SetValue (iconCol, icon).SetValue (widgetCol, page).CurrentPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
//
|
||||
// Axis.cs
|
||||
//
|
||||
// Author:
|
||||
// Lluis Sanchez Gual
|
||||
//
|
||||
// Copyright (C) 2005 Xamarin, Inc (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace MonoDevelop.Components.Chart
|
||||
{
|
||||
public abstract class Axis
|
||||
{
|
||||
int tickSize = 6;
|
||||
internal BasicChart Owner;
|
||||
AxisPosition position;
|
||||
AxisDimension dim;
|
||||
bool showLabels = true;
|
||||
|
||||
public Axis ()
|
||||
{
|
||||
}
|
||||
|
||||
public Axis (bool showLabels)
|
||||
{
|
||||
this.showLabels = showLabels;
|
||||
}
|
||||
|
||||
public int TickSize {
|
||||
get { return tickSize; }
|
||||
set {
|
||||
tickSize = value;
|
||||
if (Owner != null) Owner.QueueDraw ();
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowLabels {
|
||||
get { return showLabels; }
|
||||
set {
|
||||
showLabels = value;
|
||||
if (Owner != null) Owner.OnLayoutChanged ();
|
||||
}
|
||||
}
|
||||
|
||||
internal AxisPosition Position {
|
||||
get { return position; }
|
||||
set {
|
||||
position = value;
|
||||
if (position == AxisPosition.Top || position == AxisPosition.Bottom)
|
||||
dim = AxisDimension.X;
|
||||
else
|
||||
dim = AxisDimension.Y;
|
||||
}
|
||||
}
|
||||
|
||||
internal AxisDimension Dimension {
|
||||
get { return dim; }
|
||||
}
|
||||
|
||||
public TickEnumerator GetTickEnumerator (double minTickStep)
|
||||
{
|
||||
TickEnumerator e = CreateTickEnumerator (minTickStep);
|
||||
e.axis = this;
|
||||
return e;
|
||||
}
|
||||
|
||||
protected abstract TickEnumerator CreateTickEnumerator (double minTickStep);
|
||||
|
||||
public virtual string GetValueLabel (double value)
|
||||
{
|
||||
return value.ToString ();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
//
|
||||
// AxisDimension.cs
|
||||
//
|
||||
// Author:
|
||||
// Lluis Sanchez Gual
|
||||
//
|
||||
// Copyright (C) 2005 Xamarin, Inc (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
namespace MonoDevelop.Components.Chart
|
||||
{
|
||||
public enum AxisDimension
|
||||
{
|
||||
X, Y
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
//
|
||||
// AxisPosition.cs
|
||||
//
|
||||
// Author:
|
||||
// Lluis Sanchez Gual
|
||||
//
|
||||
// Copyright (C) 2005 Xamarin, Inc (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace MonoDevelop.Components.Chart
|
||||
{
|
||||
public enum AxisPosition
|
||||
{
|
||||
Left,
|
||||
Top,
|
||||
Right,
|
||||
Bottom
|
||||
}
|
||||
}
|
|
@ -0,0 +1,935 @@
|
|||
//
|
||||
// BasicChart.cs
|
||||
//
|
||||
// Author:
|
||||
// Lluis Sanchez Gual
|
||||
//
|
||||
// Copyright (C) 2005 Xamarin, Inc (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Xwt;
|
||||
using Xwt.Drawing;
|
||||
|
||||
namespace MonoDevelop.Components.Chart
|
||||
{
|
||||
public class BasicChart: Canvas
|
||||
{
|
||||
double startX, endX;
|
||||
double startY, endY;
|
||||
double left, top, width, height;
|
||||
int minTickStep = 5;
|
||||
bool xrangeChanged = true;
|
||||
bool yrangeChanged = true;
|
||||
|
||||
bool autoStartX, autoStartY;
|
||||
bool autoEndX, autoEndY;
|
||||
|
||||
double originX;
|
||||
double originY;
|
||||
bool reverseXAxis;
|
||||
bool reverseYAxis;
|
||||
|
||||
double AreaBorderWidth = 1;
|
||||
int AutoScaleMargin = 3;
|
||||
int MinLabelGapX = 3;
|
||||
int MinLabelGapY = 1;
|
||||
BackgroundDisplay backgroundDisplay = BackgroundDisplay.Gradient;
|
||||
Color backroundColor = new Color (0.9, 0.9, 1);
|
||||
|
||||
ArrayList series = new ArrayList ();
|
||||
ArrayList axis = new ArrayList ();
|
||||
ArrayList cursors = new ArrayList ();
|
||||
|
||||
bool enableSelection;
|
||||
bool draggingCursor;
|
||||
ChartCursor activeCursor;
|
||||
|
||||
ChartCursor selectionStart;
|
||||
ChartCursor selectionEnd;
|
||||
|
||||
Font chartFont = Font.FromName ("Tahoma", 8);
|
||||
|
||||
|
||||
public BasicChart ()
|
||||
{
|
||||
selectionStart = new ChartCursor ();
|
||||
selectionStart.Visible = false;
|
||||
selectionEnd = new ChartCursor ();
|
||||
selectionEnd.Visible = false;
|
||||
AddCursor (selectionStart, AxisDimension.X);
|
||||
AddCursor (selectionEnd, AxisDimension.X);
|
||||
selectionStart.ValueChanged += new EventHandler (OnSelectionCursorChanged);
|
||||
selectionEnd.ValueChanged += new EventHandler (OnSelectionCursorChanged);
|
||||
}
|
||||
|
||||
public event EventHandler SelectionChanged;
|
||||
|
||||
public bool AllowSelection {
|
||||
get {
|
||||
return enableSelection;
|
||||
}
|
||||
set {
|
||||
enableSelection = value;
|
||||
if (!enableSelection) {
|
||||
selectionStart.Visible = false;
|
||||
selectionEnd.Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ChartCursor SelectionStart {
|
||||
get { return selectionStart; }
|
||||
}
|
||||
|
||||
public ChartCursor SelectionEnd {
|
||||
get { return selectionEnd; }
|
||||
}
|
||||
|
||||
public ChartCursor ActiveCursor {
|
||||
get { return activeCursor; }
|
||||
}
|
||||
|
||||
public bool ReverseXAxis {
|
||||
get { return reverseXAxis; }
|
||||
set { reverseXAxis = value; QueueDraw (); }
|
||||
}
|
||||
|
||||
public bool ReverseYAxis {
|
||||
get { return reverseYAxis; }
|
||||
set { reverseYAxis = value; QueueDraw (); }
|
||||
}
|
||||
|
||||
public double OriginX {
|
||||
get { return originX; }
|
||||
set {
|
||||
xrangeChanged = true;
|
||||
originX = value;
|
||||
OnSerieChanged ();
|
||||
}
|
||||
}
|
||||
|
||||
public double OriginY {
|
||||
get { return originY; }
|
||||
set {
|
||||
yrangeChanged = true;
|
||||
originY = value;
|
||||
OnSerieChanged ();
|
||||
}
|
||||
}
|
||||
|
||||
public double StartX {
|
||||
get { return startX; }
|
||||
set {
|
||||
xrangeChanged = true;
|
||||
startX = value;
|
||||
if (startX > endX)
|
||||
endX = startX;
|
||||
OriginX = value;
|
||||
UpdateCursors ();
|
||||
OnSerieChanged ();
|
||||
}
|
||||
}
|
||||
|
||||
public double EndX {
|
||||
get { return endX; }
|
||||
set {
|
||||
xrangeChanged = true;
|
||||
endX = value;
|
||||
if (endX < startX)
|
||||
startX = endX;
|
||||
UpdateCursors ();
|
||||
OnSerieChanged ();
|
||||
}
|
||||
}
|
||||
|
||||
public double StartY {
|
||||
get { return startY; }
|
||||
set {
|
||||
yrangeChanged = true;
|
||||
startY = value;
|
||||
if (startY > endY)
|
||||
endY = startY;
|
||||
OriginY = value;
|
||||
UpdateCursors ();
|
||||
OnSerieChanged ();
|
||||
}
|
||||
}
|
||||
|
||||
public double EndY {
|
||||
get { return endY; }
|
||||
set {
|
||||
yrangeChanged = true;
|
||||
endY = value;
|
||||
if (endY < startY)
|
||||
startY = endY;
|
||||
UpdateCursors ();
|
||||
OnSerieChanged ();
|
||||
}
|
||||
}
|
||||
|
||||
void FixOrigins ()
|
||||
{
|
||||
if (originX < startX)
|
||||
originX = startX;
|
||||
else if (originX > endX)
|
||||
originX = endX;
|
||||
if (originY < startY)
|
||||
originY = startY;
|
||||
else if (originY > endY)
|
||||
originY = endY;
|
||||
}
|
||||
|
||||
public void Reset ()
|
||||
{
|
||||
ArrayList list = (ArrayList) series.Clone ();
|
||||
foreach (Serie s in list)
|
||||
RemoveSerie (s);
|
||||
|
||||
axis.Clear ();
|
||||
}
|
||||
|
||||
public void AddAxis (Axis ax, AxisPosition position)
|
||||
{
|
||||
ax.Owner = this;
|
||||
ax.Position = position;
|
||||
axis.Add (ax);
|
||||
QueueDraw ();
|
||||
}
|
||||
|
||||
public void AddSerie (Serie serie)
|
||||
{
|
||||
serie.Owner = this;
|
||||
series.Add (serie);
|
||||
OnSerieChanged ();
|
||||
}
|
||||
|
||||
public void RemoveSerie (Serie serie)
|
||||
{
|
||||
series.Remove (serie);
|
||||
serie.Owner = null;
|
||||
OnSerieChanged ();
|
||||
}
|
||||
|
||||
public void AddCursor (ChartCursor cursor, AxisDimension dimension)
|
||||
{
|
||||
cursor.Dimension = dimension;
|
||||
cursor.ValueChanged += new EventHandler (OnCursorChanged);
|
||||
cursor.LayoutChanged += new EventHandler (OnCursorChanged);
|
||||
cursors.Add (cursor);
|
||||
xrangeChanged = yrangeChanged = true;
|
||||
QueueDraw ();
|
||||
}
|
||||
|
||||
public void RemoveCursor (ChartCursor cursor)
|
||||
{
|
||||
cursor.ValueChanged -= new EventHandler (OnCursorChanged);
|
||||
cursor.LayoutChanged -= new EventHandler (OnCursorChanged);
|
||||
cursors.Remove (cursor);
|
||||
QueueDraw ();
|
||||
}
|
||||
|
||||
public void SetAutoScale (AxisDimension ad, bool autoStart, bool autoEnd)
|
||||
{
|
||||
if (ad == AxisDimension.X) {
|
||||
autoStartX = autoStart;
|
||||
autoEndX = autoEnd;
|
||||
} else {
|
||||
autoStartY = autoStart;
|
||||
autoEndY = autoEnd;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateCursors ()
|
||||
{
|
||||
foreach (ChartCursor c in cursors) {
|
||||
if (c.Value < GetStart (c.Dimension)) c.Value = GetStart (c.Dimension);
|
||||
else if (c.Value > GetEnd (c.Dimension)) c.Value = GetEnd (c.Dimension);
|
||||
}
|
||||
}
|
||||
|
||||
void OnCursorChanged (object sender, EventArgs args)
|
||||
{
|
||||
ChartCursor c = (ChartCursor) sender;
|
||||
if (c.Value < GetStart (c.Dimension)) c.Value = GetStart (c.Dimension);
|
||||
else if (c.Value > GetEnd (c.Dimension)) c.Value = GetEnd (c.Dimension);
|
||||
QueueDraw ();
|
||||
}
|
||||
|
||||
internal void OnSerieChanged ()
|
||||
{
|
||||
xrangeChanged = true;
|
||||
yrangeChanged = true;
|
||||
QueueDraw ();
|
||||
}
|
||||
|
||||
public void Clear ()
|
||||
{
|
||||
foreach (Serie s in series)
|
||||
s.Clear ();
|
||||
OnSerieChanged ();
|
||||
}
|
||||
|
||||
double GetOrigin (AxisDimension ad)
|
||||
{
|
||||
if (ad == AxisDimension.X)
|
||||
return OriginX;
|
||||
else
|
||||
return OriginY;
|
||||
}
|
||||
|
||||
double GetStart (AxisDimension ad)
|
||||
{
|
||||
if (ad == AxisDimension.X)
|
||||
return startX;
|
||||
else
|
||||
return startY;
|
||||
}
|
||||
|
||||
double GetEnd (AxisDimension ad)
|
||||
{
|
||||
if (ad == AxisDimension.X)
|
||||
return endX;
|
||||
else
|
||||
return endY;
|
||||
}
|
||||
|
||||
double GetAreaSize (AxisDimension ad)
|
||||
{
|
||||
if (ad == AxisDimension.X)
|
||||
return width;
|
||||
else
|
||||
return height;
|
||||
}
|
||||
|
||||
double GetMinTickStep (AxisDimension ad)
|
||||
{
|
||||
return (((double) minTickStep) * (GetEnd (ad) - GetStart (ad))) / (double) GetAreaSize (ad);
|
||||
}
|
||||
|
||||
protected override void OnDraw (Context ctx)
|
||||
{
|
||||
double rwidth = Bounds.Width, rheight = Bounds.Height;
|
||||
|
||||
if (autoStartY || autoEndY) {
|
||||
double nstartY = double.MaxValue;
|
||||
double nendY = double.MinValue;
|
||||
GetValueRange (AxisDimension.Y, out nstartY, out nendY);
|
||||
|
||||
if (!autoStartY) nstartY = startY;
|
||||
if (!autoEndY) nendY = endY;
|
||||
if (nendY < nstartY) nendY = nstartY;
|
||||
|
||||
if (nstartY != startY || nendY != endY) {
|
||||
yrangeChanged = true;
|
||||
startY = nstartY;
|
||||
endY = nendY;
|
||||
}
|
||||
}
|
||||
|
||||
if (autoStartX || autoEndX) {
|
||||
double nstartX = double.MaxValue;
|
||||
double nendX = double.MinValue;
|
||||
GetValueRange (AxisDimension.X, out nstartX, out nendX);
|
||||
|
||||
if (!autoStartX) nstartX = startX;
|
||||
if (!autoEndX) nendX = endX;
|
||||
if (nendX < nstartX) nendX = nstartX;
|
||||
|
||||
if (nstartX != startX || nendX != endX) {
|
||||
xrangeChanged = true;
|
||||
startX = nstartX;
|
||||
endX = nendX;
|
||||
}
|
||||
}
|
||||
|
||||
if (yrangeChanged) {
|
||||
FixOrigins ();
|
||||
double right = rwidth - 2 - AreaBorderWidth;
|
||||
left = AreaBorderWidth;
|
||||
left += MeasureAxisSize (ctx, AxisPosition.Left) + 1;
|
||||
right -= MeasureAxisSize (ctx, AxisPosition.Right) + 1;
|
||||
yrangeChanged = false;
|
||||
width = right - left + 1;
|
||||
if (width <= 0) width = 1;
|
||||
}
|
||||
|
||||
if (xrangeChanged) {
|
||||
FixOrigins ();
|
||||
double bottom = rheight - 2 - AreaBorderWidth;
|
||||
top = AreaBorderWidth;
|
||||
bottom -= MeasureAxisSize (ctx, AxisPosition.Bottom);
|
||||
top += MeasureAxisSize (ctx, AxisPosition.Top);
|
||||
|
||||
// Make room for cursor handles
|
||||
foreach (ChartCursor cursor in cursors) {
|
||||
if (cursor.Dimension == AxisDimension.X && top - AreaBorderWidth < cursor.HandleSize)
|
||||
top = cursor.HandleSize + AreaBorderWidth;
|
||||
}
|
||||
|
||||
xrangeChanged = false;
|
||||
height = bottom - top + 1;
|
||||
if (height <= 0) height = 1;
|
||||
}
|
||||
|
||||
if (AutoScaleMargin != 0 && height > 0) {
|
||||
double margin = (double)AutoScaleMargin * (endY - startY) / (double) height;
|
||||
if (autoStartY) startY -= margin;
|
||||
if (autoEndY) endY += margin;
|
||||
}
|
||||
|
||||
// Console.WriteLine ("L:" + left + " T:" + top + " W:" + width + " H:" + height);
|
||||
|
||||
// Draw the background
|
||||
|
||||
if (backgroundDisplay == BackgroundDisplay.Gradient) {
|
||||
ctx.Rectangle (left - 1, top - 1, width + 2, height + 2);
|
||||
Gradient pat = new LinearGradient (left - 1, top - 1, left - 1, height + 2);
|
||||
pat.AddColorStop (0, backroundColor);
|
||||
Color endc = new Color (1,1,1);
|
||||
pat.AddColorStop (1, endc);
|
||||
ctx.Pattern = pat;
|
||||
ctx.Fill ();
|
||||
} else {
|
||||
ctx.Rectangle (left - 1, top - 1, width + 2, height + 2);
|
||||
ctx.SetColor (backroundColor);
|
||||
ctx.Fill ();
|
||||
}
|
||||
// win.DrawRectangle (Style.WhiteGC, true, left - 1, top - 1, width + 2, height + 2);
|
||||
ctx.SetColor (Color.Black);
|
||||
ctx.Rectangle (left - AreaBorderWidth, top - AreaBorderWidth, width + AreaBorderWidth*2, height + AreaBorderWidth*2);
|
||||
ctx.Stroke ();
|
||||
|
||||
// Draw selected area
|
||||
|
||||
if (enableSelection) {
|
||||
int sx, sy, ex, ey;
|
||||
GetPoint (selectionStart.Value, selectionStart.Value, out sx, out sy);
|
||||
GetPoint (selectionEnd.Value, selectionEnd.Value, out ex, out ey);
|
||||
if (sx > ex) {
|
||||
int tmp = sx; sx = ex; ex = tmp;
|
||||
}
|
||||
ctx.SetColor (new Color (225d/255d, 225d/255d, 225d/255d));
|
||||
ctx.Rectangle (sx, top, ex - sx, height + 1);
|
||||
ctx.Fill ();
|
||||
}
|
||||
|
||||
// Draw axes
|
||||
|
||||
foreach (Axis ax in axis)
|
||||
DrawAxis (ctx, ax);
|
||||
|
||||
// Draw values
|
||||
foreach (Serie serie in series)
|
||||
if (serie.Visible)
|
||||
DrawSerie (ctx, serie);
|
||||
|
||||
// Draw cursors
|
||||
foreach (ChartCursor cursor in cursors)
|
||||
DrawCursor (ctx, cursor);
|
||||
|
||||
// Draw cursor labels
|
||||
foreach (ChartCursor cursor in cursors)
|
||||
if (cursor.ShowValueLabel)
|
||||
DrawCursorLabel (ctx, cursor);
|
||||
|
||||
((IDisposable)ctx).Dispose ();
|
||||
}
|
||||
|
||||
void GetValueRange (AxisDimension ad, out double min, out double max)
|
||||
{
|
||||
min = double.MaxValue;
|
||||
max = double.MinValue;
|
||||
|
||||
foreach (Serie serie in series) {
|
||||
if (!serie.HasData || !serie.Visible)
|
||||
continue;
|
||||
|
||||
double lmin, lmax;
|
||||
serie.GetRange (ad, out lmin, out lmax);
|
||||
if (lmin < min) min = lmin;
|
||||
if (lmax > max) max = lmax;
|
||||
}
|
||||
}
|
||||
|
||||
void DrawAxis (Context ctx, Axis ax)
|
||||
{
|
||||
ctx.SetLineWidth (1);
|
||||
double minStep = GetMinTickStep (ax.Dimension);
|
||||
|
||||
TickEnumerator enumSmall = ax.GetTickEnumerator (minStep);
|
||||
if (enumSmall == null)
|
||||
return;
|
||||
|
||||
TickEnumerator enumBig = ax.GetTickEnumerator (minStep * 2);
|
||||
|
||||
if (enumBig == null) {
|
||||
DrawTicks (ctx, enumSmall, ax.Position, ax.Dimension, ax.TickSize, ax.ShowLabels);
|
||||
} else {
|
||||
DrawTicks (ctx, enumSmall, ax.Position, ax.Dimension, ax.TickSize / 2, false);
|
||||
DrawTicks (ctx, enumBig, ax.Position, ax.Dimension, ax.TickSize, ax.ShowLabels);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawTicks (Context ctx, TickEnumerator e, AxisPosition pos, AxisDimension ad, int tickSize, bool showLabels)
|
||||
{
|
||||
double rheight = Bounds.Height;
|
||||
|
||||
TextLayout layout = null;
|
||||
|
||||
if (showLabels) {
|
||||
layout = new TextLayout (ctx);
|
||||
layout.Font = chartFont;
|
||||
}
|
||||
|
||||
bool isX = pos == AxisPosition.Top || pos == AxisPosition.Bottom;
|
||||
bool isTop = pos == AxisPosition.Top || pos == AxisPosition.Right;
|
||||
|
||||
double start = GetStart (ad);
|
||||
double end = GetEnd (ad);
|
||||
|
||||
e.Init (GetOrigin (ad));
|
||||
|
||||
while (e.CurrentValue > start)
|
||||
e.MovePrevious ();
|
||||
|
||||
double lastPosLabel;
|
||||
double lastPos;
|
||||
double lastTw = 0;
|
||||
|
||||
if (isX) {
|
||||
lastPosLabel = reverseXAxis ? left + width + MinLabelGapX : left - MinLabelGapX;
|
||||
lastPos = left - minTickStep*2;
|
||||
}
|
||||
else {
|
||||
lastPosLabel = reverseYAxis ? top - MinLabelGapY : rheight + MinLabelGapY;
|
||||
lastPos = top + height + minTickStep*2;
|
||||
}
|
||||
|
||||
for ( ; e.CurrentValue <= end; e.MoveNext ())
|
||||
{
|
||||
double px, py;
|
||||
double tw = 0, th = 0;
|
||||
int tick = tickSize;
|
||||
|
||||
GetPoint (e.CurrentValue, e.CurrentValue, out px, out py);
|
||||
|
||||
if (showLabels) {
|
||||
layout.Text = e.CurrentLabel;
|
||||
var ts = layout.GetSize ();
|
||||
tw = ts.Width;
|
||||
th = ts.Height;
|
||||
}
|
||||
|
||||
if (isX) {
|
||||
if (Math.Abs ((long)px - (long)lastPos) < minTickStep || px < left || px > left + width)
|
||||
continue;
|
||||
lastPos = px;
|
||||
|
||||
bool labelFits = false;
|
||||
if ((Math.Abs (px - lastPosLabel) - (tw/2) - (lastTw/2)) >= MinLabelGapX) {
|
||||
lastPosLabel = px;
|
||||
lastTw = tw;
|
||||
labelFits = true;
|
||||
}
|
||||
|
||||
if (isTop) {
|
||||
if (showLabels) {
|
||||
if (labelFits)
|
||||
ctx.DrawTextLayout (layout, px - (tw/2), top - AreaBorderWidth - th);
|
||||
else
|
||||
tick = tick / 2;
|
||||
}
|
||||
ctx.MoveTo (px, top);
|
||||
ctx.LineTo (px, top + tick);
|
||||
ctx.Stroke ();
|
||||
}
|
||||
else {
|
||||
if (showLabels) {
|
||||
if (labelFits)
|
||||
ctx.DrawTextLayout (layout, px - (tw/2), top + height + AreaBorderWidth);
|
||||
else
|
||||
tick = tick / 2;
|
||||
}
|
||||
ctx.MoveTo (px, top + height);
|
||||
ctx.LineTo (px, top + height - tick);
|
||||
ctx.Stroke ();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (Math.Abs ((long)lastPos - (long)py) < minTickStep || py < top || py > top + height)
|
||||
continue;
|
||||
lastPos = py;
|
||||
|
||||
bool labelFits = false;
|
||||
if ((Math.Abs (py - lastPosLabel) - (th/2) - (lastTw/2)) >= MinLabelGapY) {
|
||||
lastPosLabel = py;
|
||||
lastTw = th;
|
||||
labelFits = true;
|
||||
}
|
||||
|
||||
if (isTop) {
|
||||
if (showLabels) {
|
||||
if (labelFits)
|
||||
ctx.DrawTextLayout (layout, left + width + AreaBorderWidth + 1, py - (th/2));
|
||||
else
|
||||
tick = tick / 2;
|
||||
}
|
||||
ctx.MoveTo (left + width, py);
|
||||
ctx.LineTo (left + width - tick, py);
|
||||
ctx.Stroke ();
|
||||
}
|
||||
else {
|
||||
if (showLabels) {
|
||||
if (labelFits)
|
||||
ctx.DrawTextLayout (layout, left - AreaBorderWidth - tw - 1, py - (th/2));
|
||||
else
|
||||
tick = tick / 2;
|
||||
}
|
||||
ctx.MoveTo (left, py);
|
||||
ctx.LineTo (left + tick, py);
|
||||
ctx.Stroke ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double MeasureAxisSize (Context ctx, AxisPosition pos)
|
||||
{
|
||||
double max = 0;
|
||||
foreach (Axis ax in axis)
|
||||
if (ax.Position == pos && ax.ShowLabels) {
|
||||
double nmax = MeasureAxisSize (ctx, ax);
|
||||
if (nmax > max) max = nmax;
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
double MeasureAxisSize (Context ctx, Axis ax)
|
||||
{
|
||||
double minStep = GetMinTickStep (ax.Dimension);
|
||||
|
||||
TickEnumerator enumSmall = ax.GetTickEnumerator (minStep);
|
||||
if (enumSmall == null)
|
||||
return 0;
|
||||
|
||||
TickEnumerator enumBig = ax.GetTickEnumerator (minStep * 2);
|
||||
|
||||
if (enumBig == null)
|
||||
return MeasureTicksSize (ctx, enumSmall, ax.Dimension);
|
||||
else
|
||||
return MeasureTicksSize (ctx, enumBig, ax.Dimension);
|
||||
}
|
||||
|
||||
double MeasureTicksSize (Context ctx, TickEnumerator e, AxisDimension ad)
|
||||
{
|
||||
double max = 0;
|
||||
TextLayout layout = new TextLayout (ctx);
|
||||
layout.Font = chartFont;
|
||||
|
||||
double start = GetStart (ad);
|
||||
double end = GetEnd (ad);
|
||||
|
||||
e.Init (GetOrigin (ad));
|
||||
|
||||
while (e.CurrentValue > start)
|
||||
e.MovePrevious ();
|
||||
|
||||
for ( ; e.CurrentValue <= end; e.MoveNext ())
|
||||
{
|
||||
layout.Text = e.CurrentLabel;
|
||||
Size ts = layout.GetSize ();
|
||||
|
||||
if (ad == AxisDimension.X) {
|
||||
if (ts.Height > max)
|
||||
max = ts.Height;
|
||||
} else {
|
||||
if (ts.Width > max)
|
||||
max = ts.Width;
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
void DrawSerie (Context ctx, Serie serie)
|
||||
{
|
||||
ctx.NewPath ();
|
||||
ctx.Rectangle (left, top, width + 1, height + 1);
|
||||
ctx.Clip ();
|
||||
|
||||
ctx.NewPath ();
|
||||
ctx.SetColor (serie.Color);
|
||||
ctx.SetLineWidth (serie.LineWidth);
|
||||
|
||||
bool first = true;
|
||||
bool blockMode = serie.DisplayMode == DisplayMode.BlockLine;
|
||||
|
||||
double lastY = 0;
|
||||
|
||||
foreach (Data d in serie.GetData (startX, endX)) {
|
||||
double x, y;
|
||||
GetPoint (d.X, d.Y, out x, out y);
|
||||
if (first) {
|
||||
ctx.MoveTo (x, y);
|
||||
lastY = y;
|
||||
first = false;
|
||||
} else {
|
||||
if (blockMode) {
|
||||
if (lastY != y)
|
||||
ctx.LineTo (x, lastY);
|
||||
ctx.LineTo (x, y);
|
||||
} else
|
||||
ctx.LineTo (x, y);
|
||||
}
|
||||
lastY = y;
|
||||
}
|
||||
|
||||
ctx.Stroke ();
|
||||
}
|
||||
|
||||
void DrawCursor (Context ctx, ChartCursor cursor)
|
||||
{
|
||||
ctx.SetColor (cursor.Color);
|
||||
|
||||
double x, y;
|
||||
GetPoint (cursor.Value, cursor.Value, out x, out y);
|
||||
|
||||
if (cursor.Dimension == AxisDimension.X) {
|
||||
double cy = top - AreaBorderWidth - 1;
|
||||
ctx.MoveTo (x, cy);
|
||||
ctx.LineTo (x + (cursor.HandleSize/2), cy - cursor.HandleSize + 1);
|
||||
ctx.LineTo (x - (cursor.HandleSize/2), cy - cursor.HandleSize + 1);
|
||||
ctx.ClosePath ();
|
||||
if (activeCursor == cursor)
|
||||
ctx.FillPreserve ();
|
||||
ctx.Stroke ();
|
||||
ctx.MoveTo (x, top);
|
||||
ctx.RelLineTo (0, height);
|
||||
ctx.Stroke ();
|
||||
} else {
|
||||
throw new NotSupportedException ();
|
||||
}
|
||||
}
|
||||
|
||||
void DrawCursorLabel (Context ctx, ChartCursor cursor)
|
||||
{
|
||||
ctx.SetColor (cursor.Color);
|
||||
|
||||
int x, y;
|
||||
GetPoint (cursor.Value, cursor.Value, out x, out y);
|
||||
|
||||
if (cursor.Dimension == AxisDimension.X) {
|
||||
|
||||
string text;
|
||||
|
||||
if (cursor.LabelAxis != null) {
|
||||
double minStep = GetMinTickStep (cursor.Dimension);
|
||||
TickEnumerator tenum = cursor.LabelAxis.GetTickEnumerator (minStep);
|
||||
tenum.Init (cursor.Value);
|
||||
text = tenum.CurrentLabel;
|
||||
} else {
|
||||
text = GetValueLabel (cursor.Dimension, cursor.Value);
|
||||
}
|
||||
|
||||
if (text != null && text.Length > 0) {
|
||||
TextLayout layout = new TextLayout (ctx);
|
||||
layout.Font = chartFont;
|
||||
layout.Text = text;
|
||||
|
||||
Size ts = layout.GetSize ();
|
||||
double tl = x - ts.Width/2;
|
||||
double tt = top + 4;
|
||||
if (tl + ts.Width + 2 >= left + width) tl = left + width - ts.Width - 1;
|
||||
if (tl < left + 1) tl = left + 1;
|
||||
ctx.SetColor (Color.White);
|
||||
ctx.Rectangle (tl - 1, tt - 1, ts.Width + 2, ts.Height + 2);
|
||||
ctx.Fill ();
|
||||
ctx.Rectangle (tl - 2, tt - 2, ts.Width + 3, ts.Height + 3);
|
||||
ctx.SetColor (Color.Black);
|
||||
ctx.DrawTextLayout (layout, tl, tt);
|
||||
}
|
||||
} else {
|
||||
throw new NotSupportedException ();
|
||||
}
|
||||
}
|
||||
|
||||
void GetPoint (double wx, double wy, out int x, out int y)
|
||||
{
|
||||
double dx, dy;
|
||||
GetPoint (wx, wy, out dx, out dy);
|
||||
x = (int) dx;
|
||||
y = (int) dy;
|
||||
}
|
||||
|
||||
void GetPoint (double wx, double wy, out double x, out double y)
|
||||
{
|
||||
unchecked {
|
||||
if (reverseXAxis)
|
||||
x = left + width - (((wx - startX) * ((double) width)) / (endX - startX));
|
||||
else
|
||||
x = left + (((wx - startX) * ((double) width)) / (endX - startX));
|
||||
|
||||
if (reverseYAxis)
|
||||
y = top + ((wy - startY) * ((double) height) / (endY - startY));
|
||||
else
|
||||
y = top + height - ((wy - startY) * ((double) height) / (endY - startY));
|
||||
}
|
||||
}
|
||||
|
||||
void GetValue (int x, int y, out double wx, out double wy)
|
||||
{
|
||||
unchecked {
|
||||
if (reverseXAxis)
|
||||
wx = startX + ((double) (left + width - 1 - x)) * (endX - startX) / (double) width;
|
||||
else
|
||||
wx = startX + ((double) (x - left)) * (endX - startX) / (double) width;
|
||||
|
||||
if (reverseYAxis)
|
||||
wy = startY + ((double) (top + y)) * (endY - startY) / (double) height;
|
||||
else
|
||||
wy = startY + ((double) (top + height - y - 1)) * (endY - startY) / (double) height;
|
||||
}
|
||||
}
|
||||
|
||||
string GetValueLabel (AxisDimension ad, double value)
|
||||
{
|
||||
foreach (Axis ax in axis)
|
||||
if (ax.Dimension == ad)
|
||||
return ax.GetValueLabel (value);
|
||||
return null;
|
||||
}
|
||||
|
||||
internal void OnLayoutChanged ()
|
||||
{
|
||||
xrangeChanged = true;
|
||||
yrangeChanged = true;
|
||||
QueueDraw ();
|
||||
}
|
||||
|
||||
void OnSelectionCursorChanged (object sender, EventArgs args)
|
||||
{
|
||||
if (enableSelection) {
|
||||
if (selectionStart.Value > selectionEnd.Value) {
|
||||
ChartCursor tmp = selectionStart;
|
||||
selectionStart = selectionEnd;
|
||||
selectionEnd = tmp;
|
||||
}
|
||||
OnSelectionChanged ();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnButtonPressed (ButtonEventArgs ev)
|
||||
{
|
||||
if (ev.Button == 1) {
|
||||
foreach (ChartCursor cursor in cursors) {
|
||||
int cx, cy;
|
||||
GetPoint (cursor.Value, cursor.Value, out cx, out cy);
|
||||
if (cursor.Dimension == AxisDimension.X) {
|
||||
if (Math.Abs (ev.X - cx) <= 2 || (ev.Y < top && (Math.Abs (ev.X - cx) <= cursor.HandleSize/2))) {
|
||||
activeCursor = cursor;
|
||||
draggingCursor = true;
|
||||
activeCursor.ShowValueLabel = true;
|
||||
QueueDraw ();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// Implement
|
||||
}
|
||||
}
|
||||
|
||||
if (enableSelection && !draggingCursor) {
|
||||
selectionStart.Visible = true;
|
||||
selectionEnd.Visible = true;
|
||||
|
||||
double x, y;
|
||||
GetValue ((int)ev.X, (int)ev.Y, out x, out y);
|
||||
// avoid cursor swaping
|
||||
ChartCursor c1 = selectionStart;
|
||||
ChartCursor c2 = selectionEnd;
|
||||
c1.Value = x;
|
||||
c2.Value = x;
|
||||
activeCursor = selectionEnd;
|
||||
activeCursor.ShowValueLabel = true;
|
||||
draggingCursor = true;
|
||||
QueueDraw ();
|
||||
}
|
||||
|
||||
if (draggingCursor)
|
||||
return;
|
||||
}
|
||||
base.OnButtonPressed (ev);
|
||||
return;
|
||||
}
|
||||
|
||||
protected override void OnButtonReleased (ButtonEventArgs e)
|
||||
{
|
||||
if (draggingCursor) {
|
||||
draggingCursor = false;
|
||||
activeCursor.ShowValueLabel = false;
|
||||
}
|
||||
base.OnButtonReleased (e);
|
||||
}
|
||||
|
||||
|
||||
protected override void OnMouseMoved (MouseMovedEventArgs e)
|
||||
{
|
||||
if (draggingCursor) {
|
||||
double x, y;
|
||||
GetValue ((int)e.X, (int)e.Y, out x, out y);
|
||||
|
||||
if (activeCursor.Dimension == AxisDimension.X) {
|
||||
if (x < startX) x = startX;
|
||||
else if (x > endX) x = endX;
|
||||
activeCursor.Value = x;
|
||||
}
|
||||
else {
|
||||
if (y < startY) y = startY;
|
||||
else if (y > endY) y = endY;
|
||||
activeCursor.Value = y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
base.OnMouseMoved (e);
|
||||
}
|
||||
|
||||
protected override void OnBoundsChanged ()
|
||||
{
|
||||
xrangeChanged = true;
|
||||
yrangeChanged = true;
|
||||
base.OnBoundsChanged ();
|
||||
}
|
||||
|
||||
protected virtual void OnSelectionChanged ()
|
||||
{
|
||||
if (SelectionChanged != null)
|
||||
SelectionChanged (this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public enum BackgroundDisplay
|
||||
{
|
||||
Solid,
|
||||
Gradient
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
//
|
||||
// ChartCursor.cs
|
||||
//
|
||||
// Author:
|
||||
// Lluis Sanchez Gual
|
||||
//
|
||||
// Copyright (C) 2005 Xamarin, Inc (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using Xwt;
|
||||
using Xwt.Drawing;
|
||||
|
||||
|
||||
namespace MonoDevelop.Components.Chart
|
||||
{
|
||||
public class ChartCursor
|
||||
{
|
||||
double val;
|
||||
internal AxisDimension Dimension;
|
||||
Color color = Color.Black;
|
||||
int handleSize = 6;
|
||||
bool visible = true;
|
||||
bool showValueLabel;
|
||||
Axis labelAxis;
|
||||
|
||||
public double Value {
|
||||
get { return val; }
|
||||
set { val = value; OnValueChanged (); }
|
||||
}
|
||||
|
||||
public bool Visible {
|
||||
get { return visible; }
|
||||
set { visible = value; OnLayoutChanged (); }
|
||||
}
|
||||
|
||||
public Color Color {
|
||||
get { return color; }
|
||||
set { color = value; OnLayoutChanged (); }
|
||||
}
|
||||
|
||||
public int HandleSize {
|
||||
get { return handleSize; }
|
||||
set { handleSize = value; OnLayoutChanged (); }
|
||||
}
|
||||
|
||||
public bool ShowValueLabel {
|
||||
get { return showValueLabel; }
|
||||
set { showValueLabel = value; OnLayoutChanged (); }
|
||||
}
|
||||
|
||||
public Axis LabelAxis {
|
||||
get { return labelAxis; }
|
||||
set { labelAxis = value; OnLayoutChanged (); }
|
||||
}
|
||||
|
||||
public virtual void OnValueChanged ()
|
||||
{
|
||||
if (ValueChanged != null)
|
||||
ValueChanged (this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public virtual void OnLayoutChanged ()
|
||||
{
|
||||
if (LayoutChanged != null)
|
||||
LayoutChanged (this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public EventHandler ValueChanged;
|
||||
public EventHandler LayoutChanged;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
//
|
||||
// DateTimeAxis.cs
|
||||
//
|
||||
// Author:
|
||||
// Lluis Sanchez Gual
|
||||
//
|
||||
// Copyright (C) 2005 Xamarin, Inc (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace MonoDevelop.Components.Chart
|
||||
{
|
||||
public class DateTimeAxis: Axis
|
||||
{
|
||||
public DateTimeAxis ()
|
||||
{
|
||||
}
|
||||
|
||||
public DateTimeAxis (bool showLabels): base (showLabels)
|
||||
{
|
||||
}
|
||||
|
||||
protected override TickEnumerator CreateTickEnumerator (double minTickStep)
|
||||
{
|
||||
long val = (long) minTickStep;
|
||||
int scale;
|
||||
|
||||
if (val > TimeSpan.TicksPerDay * 30 * 365)
|
||||
return null;
|
||||
else if (val > TimeSpan.TicksPerDay * 30)
|
||||
scale = 7;
|
||||
else if (val > TimeSpan.TicksPerDay)
|
||||
scale = 6;
|
||||
else if (val > TimeSpan.TicksPerHour)
|
||||
scale = 5;
|
||||
else if (val > TimeSpan.TicksPerMinute * 15)
|
||||
scale = 4;
|
||||
else if (val > TimeSpan.TicksPerMinute)
|
||||
scale = 3;
|
||||
else if (val > TimeSpan.TicksPerSecond * 15)
|
||||
scale = 2;
|
||||
else if (val > TimeSpan.TicksPerSecond)
|
||||
scale = 1;
|
||||
else
|
||||
scale = 0;
|
||||
|
||||
return new DateTimeTickEnumerator (scale);
|
||||
}
|
||||
}
|
||||
|
||||
internal class DateTimeTickEnumerator: TickEnumerator
|
||||
{
|
||||
int scale;
|
||||
DateTime current;
|
||||
|
||||
public DateTimeTickEnumerator (int scale)
|
||||
{
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
public override void Init (double startValue)
|
||||
{
|
||||
DateTime t = new DateTime ((long)startValue);
|
||||
DateTime nt;
|
||||
switch (scale) {
|
||||
case 0: nt = new DateTime (t.Year, t.Month, t.Day, t.Hour, t.Minute, t.Second); break;
|
||||
case 1: nt = new DateTime (t.Year, t.Month, t.Day, t.Hour, t.Minute, (t.Second / 15) * 15); break;
|
||||
case 2: nt = new DateTime (t.Year, t.Month, t.Day, t.Hour, t.Minute, 0); break;
|
||||
case 3: nt = new DateTime (t.Year, t.Month, t.Day, t.Hour, (t.Minute / 15) * 15, 0); break;
|
||||
case 4: nt = new DateTime (t.Year, t.Month, t.Day, t.Hour, 0, 0); break;
|
||||
case 5: nt = new DateTime (t.Year, t.Month, t.Day); break;
|
||||
case 6: nt = new DateTime (t.Year, t.Month, 1); break;
|
||||
default: nt = new DateTime (t.Year, 1, 1); break;
|
||||
}
|
||||
current = nt;
|
||||
}
|
||||
|
||||
public override void MoveNext ()
|
||||
{
|
||||
switch (scale) {
|
||||
case 0: current = current.AddSeconds (1); break;
|
||||
case 1: current = current.AddSeconds (15); break;
|
||||
case 2: current = current.AddMinutes (1); break;
|
||||
case 3: current = current.AddMinutes (15); break;
|
||||
case 4: current = current.AddHours (1); break;
|
||||
case 5: current = current.AddDays (1); break;
|
||||
case 6: current = current.AddMonths (1); break;
|
||||
case 7: current = current.AddYears (1); break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void MovePrevious ()
|
||||
{
|
||||
switch (scale) {
|
||||
case 0: current = current.AddSeconds (-1); break;
|
||||
case 1: current = current.AddSeconds (-15); break;
|
||||
case 2: current = current.AddMinutes (-1); break;
|
||||
case 3: current = current.AddMinutes (-15); break;
|
||||
case 4: current = current.AddHours (-1); break;
|
||||
case 5: current = current.AddDays (-1); break;
|
||||
case 6: current = current.AddMonths (-1); break;
|
||||
case 7: current = current.AddYears (-1); break;
|
||||
}
|
||||
}
|
||||
|
||||
public override double CurrentValue {
|
||||
get { return (double) current.Ticks; }
|
||||
}
|
||||
|
||||
public override string CurrentLabel {
|
||||
get {
|
||||
switch (scale) {
|
||||
case 0: case 1: return string.Format ("{0}:{1:00}:{2:00}", current.Hour, current.Minute, current.Second);
|
||||
case 2: case 3: return string.Format ("{0}:{1:00}", current.Hour, current.Minute);
|
||||
case 4: return string.Format ("{0}:00", current.Hour);
|
||||
case 5: return current.ToShortDateString ();
|
||||
case 6: return string.Format ("{0}/{1}", current.Month, current.Year);
|
||||
default: return string.Format ("{0}", current.Year);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
//
|
||||
// IntegerAxis.cs
|
||||
//
|
||||
// Author:
|
||||
// Lluis Sanchez Gual
|
||||
//
|
||||
// Copyright (C) 2005 Xamarin, Inc (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace MonoDevelop.Components.Chart
|
||||
{
|
||||
public class IntegerAxis: Axis
|
||||
{
|
||||
public IntegerAxis ()
|
||||
{
|
||||
}
|
||||
|
||||
public IntegerAxis (bool showLabels): base (showLabels)
|
||||
{
|
||||
}
|
||||
|
||||
protected override TickEnumerator CreateTickEnumerator (double minTickStep)
|
||||
{
|
||||
long val;
|
||||
unchecked {
|
||||
val = (long) minTickStep;
|
||||
long red = 10;
|
||||
while (val > red)
|
||||
red = red * 10;
|
||||
|
||||
long scale;
|
||||
|
||||
if (val <= 1)
|
||||
scale = 1;
|
||||
else if (val > red / 2)
|
||||
scale = red;
|
||||
else if (val > red / 4)
|
||||
scale = red / 2;
|
||||
else
|
||||
scale = red / 4;
|
||||
return new IntegerTickEnumerator (scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class IntegerTickEnumerator: TickEnumerator
|
||||
{
|
||||
long scale;
|
||||
long current;
|
||||
|
||||
public IntegerTickEnumerator (long scale)
|
||||
{
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
public override void Init (double startValue)
|
||||
{
|
||||
current = (((long)startValue) / scale) * scale;
|
||||
}
|
||||
|
||||
public override void MoveNext ()
|
||||
{
|
||||
current += scale;
|
||||
}
|
||||
|
||||
public override void MovePrevious ()
|
||||
{
|
||||
current -= scale;
|
||||
}
|
||||
|
||||
public override double CurrentValue {
|
||||
get { return (double) current; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,200 @@
|
|||
//
|
||||
// Serie.cs
|
||||
//
|
||||
// Author:
|
||||
// Lluis Sanchez Gual
|
||||
//
|
||||
// Copyright (C) 2005 Xamarin, Inc (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Xwt;
|
||||
using Xwt.Drawing;
|
||||
|
||||
|
||||
namespace MonoDevelop.Components.Chart
|
||||
{
|
||||
public class Serie
|
||||
{
|
||||
string title;
|
||||
List<Data> dataArray = new List<Data> ();
|
||||
bool visible = true;
|
||||
internal BasicChart Owner;
|
||||
Color color;
|
||||
bool extendBoundingValues;
|
||||
DisplayMode mode;
|
||||
double initialValue;
|
||||
bool averageData;
|
||||
double averageSpan;
|
||||
double averageOrigin;
|
||||
int lineWidth = 2;
|
||||
|
||||
public Serie ()
|
||||
{
|
||||
}
|
||||
|
||||
public Serie (string title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public void AddData (double x, double y)
|
||||
{
|
||||
dataArray.Add (new Data (x, y));
|
||||
OnSerieChanged ();
|
||||
}
|
||||
|
||||
public void Clear ()
|
||||
{
|
||||
dataArray.Clear ();
|
||||
OnSerieChanged ();
|
||||
}
|
||||
|
||||
public string Title {
|
||||
get { return title; }
|
||||
set { title = value; OnSerieChanged (); }
|
||||
}
|
||||
|
||||
public bool Visible {
|
||||
get { return visible; }
|
||||
set { visible = value; OnSerieChanged (); }
|
||||
}
|
||||
|
||||
public bool ExtendBoundingValues {
|
||||
get { return extendBoundingValues; }
|
||||
set { extendBoundingValues = value; OnSerieChanged (); }
|
||||
}
|
||||
|
||||
// Initial value to use when ExtendBoundingValues is set to true
|
||||
public double InitialValue {
|
||||
get { return initialValue; }
|
||||
set { initialValue = value; OnSerieChanged (); }
|
||||
}
|
||||
|
||||
public DisplayMode DisplayMode {
|
||||
get { return mode; }
|
||||
set { mode = value; OnSerieChanged (); }
|
||||
}
|
||||
|
||||
public bool AverageData {
|
||||
get { return this.averageData; }
|
||||
set { this.averageData = value; OnSerieChanged ();}
|
||||
}
|
||||
|
||||
public double AverageSpan {
|
||||
get { return this.averageSpan; }
|
||||
set { this.averageSpan = value; OnSerieChanged ();}
|
||||
}
|
||||
|
||||
public double AverageOrigin {
|
||||
get { return this.averageOrigin; }
|
||||
set { this.averageOrigin = value; OnSerieChanged (); }
|
||||
}
|
||||
|
||||
public int LineWidth {
|
||||
get { return this.lineWidth; }
|
||||
set { this.lineWidth = value; }
|
||||
}
|
||||
|
||||
public bool HasData {
|
||||
get { return dataArray.Count > 0; }
|
||||
}
|
||||
|
||||
public virtual void OnSerieChanged ()
|
||||
{
|
||||
if (Owner != null)
|
||||
Owner.OnSerieChanged ();
|
||||
}
|
||||
|
||||
public Color Color {
|
||||
get { return color; }
|
||||
set { color = value; OnSerieChanged (); }
|
||||
}
|
||||
|
||||
public void GetRange (AxisDimension axis, out double min, out double max)
|
||||
{
|
||||
min = double.MaxValue;
|
||||
max = double.MinValue;
|
||||
foreach (Data d in dataArray) {
|
||||
double v = d.GetValue (axis);
|
||||
if (v > max) max = v;
|
||||
if (v < min) min = v;
|
||||
}
|
||||
}
|
||||
|
||||
internal IEnumerable<Data> GetData (double startX, double endX)
|
||||
{
|
||||
if (dataArray.Count == 0)
|
||||
yield break;
|
||||
|
||||
if (extendBoundingValues) {
|
||||
Data dfirst = dataArray [0];
|
||||
if (dfirst.X > startX)
|
||||
yield return new Data (startX, initialValue);
|
||||
}
|
||||
|
||||
foreach (Data d in dataArray)
|
||||
yield return d;
|
||||
|
||||
if (extendBoundingValues) {
|
||||
Data dlast = dataArray [dataArray.Count - 1];
|
||||
if (dlast.X < endX)
|
||||
yield return new Data (endX, dlast.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum DisplayMode
|
||||
{
|
||||
Line,
|
||||
BlockLine,
|
||||
Bar
|
||||
}
|
||||
|
||||
internal class Data
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
|
||||
internal Data (double x, double y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public double X {
|
||||
get { return x; }
|
||||
set { x = value; }
|
||||
}
|
||||
|
||||
public double Y {
|
||||
get { return y; }
|
||||
set { y = value; }
|
||||
}
|
||||
|
||||
public double GetValue (AxisDimension a) {
|
||||
if (a == AxisDimension.X) return x;
|
||||
else return y;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
//
|
||||
// TickEnumerator.cs
|
||||
//
|
||||
// Author:
|
||||
// Lluis Sanchez Gual
|
||||
//
|
||||
// Copyright (C) 2005 Xamarin, Inc (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace MonoDevelop.Components.Chart
|
||||
{
|
||||
public abstract class TickEnumerator
|
||||
{
|
||||
internal Axis axis;
|
||||
|
||||
public abstract void Init (double startValue);
|
||||
public abstract void MoveNext ();
|
||||
public abstract void MovePrevious ();
|
||||
public abstract double CurrentValue { get; }
|
||||
|
||||
public virtual string CurrentLabel {
|
||||
get { return axis.GetValueLabel (CurrentValue); }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>10.0.0</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{88C04B85-B69B-47B4-AB9F-64F6DD4E0897}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Samples</RootNamespace>
|
||||
<AssemblyName>Samples</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xaml">
|
||||
<HintPath>..\Xwt\System.Xaml.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Samples\ChartSample.cs" />
|
||||
<Compile Include="Samples\NotebookSample.cs" />
|
||||
<Compile Include="Samples\Boxes.cs" />
|
||||
<Compile Include="Samples\ListView1.cs" />
|
||||
<Compile Include="Samples\DragDrop.cs" />
|
||||
<Compile Include="MainWindow.cs" />
|
||||
<Compile Include="App.cs" />
|
||||
<Compile Include="MonoDevelop.Components.Chart\Axis.cs" />
|
||||
<Compile Include="MonoDevelop.Components.Chart\AxisDimension.cs" />
|
||||
<Compile Include="MonoDevelop.Components.Chart\AxisPosition.cs" />
|
||||
<Compile Include="MonoDevelop.Components.Chart\BasicChart.cs" />
|
||||
<Compile Include="MonoDevelop.Components.Chart\ChartCursor.cs" />
|
||||
<Compile Include="MonoDevelop.Components.Chart\DateTimeAxis.cs" />
|
||||
<Compile Include="MonoDevelop.Components.Chart\IntegerAxis.cs" />
|
||||
<Compile Include="MonoDevelop.Components.Chart\Serie.cs" />
|
||||
<Compile Include="MonoDevelop.Components.Chart\TickEnumerator.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Xwt\Xwt.csproj">
|
||||
<Project>{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}</Project>
|
||||
<Name>Xwt</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="class.png">
|
||||
<LogicalName>class.png</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="package.png">
|
||||
<LogicalName>package.png</LogicalName>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<MonoDevelop>
|
||||
<Properties>
|
||||
<Policies>
|
||||
<DotNetNamingPolicy DirectoryNamespaceAssociation="None" ResourceNamePolicy="FileName" />
|
||||
</Policies>
|
||||
</Properties>
|
||||
</MonoDevelop>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using Xwt;
|
||||
using Xwt.Drawing;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
public class Boxes: VBox
|
||||
{
|
||||
public Boxes ()
|
||||
{
|
||||
HBox box1 = new HBox ();
|
||||
|
||||
VBox box2 = new VBox ();
|
||||
box2.PackStart (new SimpleBox (30), BoxMode.None);
|
||||
box2.PackStart (new SimpleBox (30), BoxMode.None);
|
||||
box2.PackStart (new SimpleBox (30), BoxMode.FillAndExpand);
|
||||
|
||||
box1.PackStart (box2,BoxMode.FillAndExpand);
|
||||
box1.PackStart (new SimpleBox (30),BoxMode.None);
|
||||
box1.PackStart (new SimpleBox (30),BoxMode.Expand);
|
||||
PackStart (box1, BoxMode.None);
|
||||
}
|
||||
}
|
||||
|
||||
class SimpleBox: Canvas
|
||||
{
|
||||
double coreSize;
|
||||
double margin = 1;
|
||||
|
||||
public SimpleBox (double coreSize)
|
||||
{
|
||||
this.coreSize = coreSize;
|
||||
MinSize = new Size (coreSize + margin*2, coreSize + margin*2);
|
||||
}
|
||||
|
||||
protected override void OnDraw (Context ctx)
|
||||
{
|
||||
ctx.SetColor (new Color (0.5, 0.5, 0.5));
|
||||
ctx.Rectangle (Bounds);
|
||||
ctx.Fill ();
|
||||
ctx.SetColor (new Color (0.8, 0.8, 0.8));
|
||||
ctx.Rectangle (Rectangle.Inflate (Bounds,-margin, -margin));
|
||||
ctx.Fill ();
|
||||
ctx.SetColor (new Color (0.5, 0.5, 1));
|
||||
ctx.Rectangle (Bounds.Width/2 - coreSize/2, Bounds.Height/2 - coreSize/2, coreSize, coreSize);
|
||||
ctx.Fill ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using Xwt;
|
||||
using MonoDevelop.Components.Chart;
|
||||
using Xwt.Drawing;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
public class ChartSample: Xwt.VBox
|
||||
{
|
||||
public ChartSample ()
|
||||
{
|
||||
BasicChart chart = new BasicChart ();
|
||||
chart.AllowSelection = true;
|
||||
chart.AddAxis (new IntegerAxis (true), AxisPosition.Left);
|
||||
chart.AddAxis (new IntegerAxis (true), AxisPosition.Bottom);
|
||||
|
||||
Serie s = new Serie ("Some Data");
|
||||
s.Color = new Color (0,1,0);
|
||||
s.AddData (10, 10);
|
||||
s.AddData (20, 11);
|
||||
s.AddData (30, 15);
|
||||
s.AddData (40, 9);
|
||||
chart.AddSerie (s);
|
||||
s = new Serie ("Other Data");
|
||||
s.Color = new Color (0,0,1);
|
||||
s.AddData (10, 20);
|
||||
s.AddData (20, 19);
|
||||
s.AddData (30, 25);
|
||||
s.AddData (40, 26);
|
||||
chart.AddSerie (s);
|
||||
chart.SetAutoScale (AxisDimension.X, true, true);
|
||||
chart.SetAutoScale (AxisDimension.Y, true, true);
|
||||
|
||||
PackStart (chart, BoxMode.FillAndExpand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using Xwt;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
public class DragDrop: VBox
|
||||
{
|
||||
public DragDrop ()
|
||||
{
|
||||
HBox box = new HBox ();
|
||||
|
||||
SimpleBox b1 = new SimpleBox (30);
|
||||
box.PackStart (b1, BoxMode.None);
|
||||
|
||||
Button b2 = new Button ("Drop here");
|
||||
box.PackEnd (b2, BoxMode.None);
|
||||
|
||||
b1.ButtonPressed += delegate {
|
||||
var d = b1.CreateDragOperation ();
|
||||
d.Data.AddValue ("Hola");
|
||||
d.Start ();
|
||||
};
|
||||
|
||||
b2.SetDragDropTarget (TransferDataType.Text, TransferDataType.Uri);
|
||||
PackStart (box);
|
||||
|
||||
b2.DragDrop += HandleB2DragDrop;
|
||||
// b2.DragOver += HandleB2DragOver;
|
||||
}
|
||||
|
||||
void HandleB2DragOver (object sender, DragOverEventArgs e)
|
||||
{
|
||||
Console.WriteLine ("Drag over");
|
||||
e.AllowedAction = DragDropAction.Copy | DragDropAction.Move | DragDropAction.Link;
|
||||
}
|
||||
|
||||
void HandleB2DragDrop (object sender, DragEventArgs e)
|
||||
{
|
||||
Console.WriteLine ("Dropped!");
|
||||
Console.WriteLine ("Text: " + e.Data.GetValue (TransferDataType.Text));
|
||||
Console.WriteLine ("Uris:");
|
||||
foreach (var u in e.Data.Uris)
|
||||
Console.WriteLine ("u:" + u);
|
||||
e.Success = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using Xwt;
|
||||
using Xwt.Drawing;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
public class ListView1: VBox
|
||||
{
|
||||
DataField<string> name = new DataField<string> ();
|
||||
DataField<Image> icon = new DataField<Image> ();
|
||||
DataField<string> text = new DataField<string> ();
|
||||
DataField<Image> icon2 = new DataField<Image> ();
|
||||
|
||||
public ListView1 ()
|
||||
{
|
||||
ListView list = new ListView ();
|
||||
ListStore store = new ListStore (name, icon, text, icon2);
|
||||
list.DataSource = store;
|
||||
list.Columns.Add ("Name", icon, name);
|
||||
list.Columns.Add ("Text", icon2, text);
|
||||
|
||||
var png = Image.FromResource (typeof(App), "class.png");
|
||||
|
||||
for (int n=0; n<10; n++) {
|
||||
var r = store.AddRow ();
|
||||
store.SetValue (r, icon, png);
|
||||
store.SetValue (r, name, "Value " + n);
|
||||
store.SetValue (r, icon2, png);
|
||||
store.SetValue (r, text, "Text " + n);
|
||||
}
|
||||
PackStart (list, BoxMode.FillAndExpand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using Xwt;
|
||||
using Xwt.Drawing;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
public class NotebookSample: VBox
|
||||
{
|
||||
public NotebookSample ()
|
||||
{
|
||||
Notebook nb = new Notebook ();
|
||||
nb.Add (new Label ("First tab content"), "First Tab");
|
||||
nb.Add (new MyWidget (), "Second Tab");
|
||||
PackStart (nb, BoxMode.FillAndExpand);
|
||||
}
|
||||
}
|
||||
|
||||
class MyWidget: Canvas
|
||||
{
|
||||
protected override void OnDraw (Context ctx)
|
||||
{
|
||||
ctx.SetLineWidth (5);
|
||||
ctx.SetColor (new Color (1.0f, 0f, 0.5f));
|
||||
ctx.Rectangle (5, 5, 200, 100);
|
||||
ctx.FillPreserve ();
|
||||
ctx.SetColor (new Color (0f, 0f, 1f));
|
||||
ctx.Stroke ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 830 B |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 1.4 KiB |
20
Xwt.sln
20
Xwt.sln
|
@ -7,12 +7,30 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xwt.Gtk", "Xwt.Gtk\Xwt.Gtk.
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xwt.Mac", "Xwt.Mac\Xwt.Mac.csproj", "{B7C1673E-5124-4BE5-8D21-EC8B12F85B6B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MacTest", "MacTest\MacTest.csproj", "{2B7FF081-FE53-42F7-9D5D-D4B38E548F94}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples", "Samples\Samples.csproj", "{88C04B85-B69B-47B4-AB9F-64F6DD4E0897}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GtkTest", "GtkTest\GtkTest.csproj", "{0AF50CE4-E455-4A9D-92AD-711CBD068A55}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0AF50CE4-E455-4A9D-92AD-711CBD068A55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0AF50CE4-E455-4A9D-92AD-711CBD068A55}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0AF50CE4-E455-4A9D-92AD-711CBD068A55}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0AF50CE4-E455-4A9D-92AD-711CBD068A55}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2B7FF081-FE53-42F7-9D5D-D4B38E548F94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2B7FF081-FE53-42F7-9D5D-D4B38E548F94}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2B7FF081-FE53-42F7-9D5D-D4B38E548F94}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2B7FF081-FE53-42F7-9D5D-D4B38E548F94}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{88C04B85-B69B-47B4-AB9F-64F6DD4E0897}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{88C04B85-B69B-47B4-AB9F-64F6DD4E0897}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{88C04B85-B69B-47B4-AB9F-64F6DD4E0897}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{88C04B85-B69B-47B4-AB9F-64F6DD4E0897}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
@ -27,7 +45,7 @@ Global
|
|||
{C3887A93-B2BD-4097-8E2F-3A063EFF32FD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = Xwt\Xwt.csproj
|
||||
StartupItem = MacTest\MacTest.csproj
|
||||
Policies = $0
|
||||
$0.DotNetNamingPolicy = $1
|
||||
$1.DirectoryNamespaceAssociation = None
|
||||
|
|
Загрузка…
Ссылка в новой задаче