[Roam-commit] SF.net SVN: roam: [112] Trunk/Source
Status: Alpha
Brought to you by:
jonfroehlich
|
From: <jon...@us...> - 2008-02-08 03:11:14
|
Revision: 112
http://roam.svn.sourceforge.net/roam/?rev=112&view=rev
Author: jonfroehlich
Date: 2008-02-07 19:11:13 -0800 (Thu, 07 Feb 2008)
Log Message:
-----------
1. fixed issue with KeyUtils mapping 12-key keypads to characters when a character was not found. it's not 100% fixed but i added characters for the common cases
2. updated ScrollableLabel with two new methods: ScrollToTop and ScrollToBottom and added the property RequiresScrolling
Modified Paths:
--------------
Trunk/Source/Roam.Common/Utils/ColorUtils.cs
Trunk/Source/Roam.Common/Utils/KeyUtils.cs
Trunk/Source/Roam.Test/Roam.Test.csproj
Trunk/Source/Roam.UI/Controls/ScrollableLabel.cs
Trunk/Source/Roam.suo
Modified: Trunk/Source/Roam.Common/Utils/ColorUtils.cs
===================================================================
--- Trunk/Source/Roam.Common/Utils/ColorUtils.cs 2008-01-07 17:05:10 UTC (rev 111)
+++ Trunk/Source/Roam.Common/Utils/ColorUtils.cs 2008-02-08 03:11:13 UTC (rev 112)
@@ -19,6 +19,7 @@
using System.Drawing;
using System.Collections.Generic;
using System.Reflection;
+using System.Globalization;
namespace Roam.Common.Utils
{
@@ -60,6 +61,12 @@
return color.ToArgb().ToString("X").Substring(2);
}
+ public static Color FromHexadecimalRgb(string rbgString)
+ {
+ int rgbValue = int.Parse(rbgString, NumberStyles.HexNumber);
+ return Color.FromArgb(rgbValue);
+ }
+
public static string ToString(Color color)
{
return string.Format("[{0}, {1}, {2}, {3}]", color.R, color.G, color.B, color.A);
Modified: Trunk/Source/Roam.Common/Utils/KeyUtils.cs
===================================================================
--- Trunk/Source/Roam.Common/Utils/KeyUtils.cs 2008-01-07 17:05:10 UTC (rev 111)
+++ Trunk/Source/Roam.Common/Utils/KeyUtils.cs 2008-02-08 03:11:13 UTC (rev 112)
@@ -186,6 +186,21 @@
case 'z':
return '9';
case '*':
+ case '(':
+ case ')':
+ case '%':
+ case '<':
+ case '>':
+ case '{':
+ case '}':
+ case '[':
+ case ']':
+ case '|':
+ case '^':
+ case '$':
+ case '=':
+ case '~':
+ case '`':
return '*';
case ' ':
case '#':
@@ -199,6 +214,10 @@
{
switch (c)
{
+ case '#':
+ return new char[] { ' ', '#' };
+ case '*':
+ return new char[] { '*', '(', ')', '%', '<', '>', '{', '}', '[', ']', '|', '^', '$', '=', '~', '`' };
case '0':
return new char[] { '0' };
case '1':
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2008-01-07 17:05:10 UTC (rev 111)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2008-02-08 03:11:13 UTC (rev 112)
@@ -83,6 +83,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Media\MediaCapturedTest.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Media\MediaCapturedTest.Designer.cs">
+ <DependentUpon>MediaCapturedTest.cs</DependentUpon>
+ </Compile>
<Compile Include="Media\SoundLoopPlayerTest.cs">
<SubType>Form</SubType>
</Compile>
@@ -132,6 +138,10 @@
<DependentUpon>MainForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
+ <EmbeddedResource Include="Media\MediaCapturedTest.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>MediaCapturedTest.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="Media\SoundLoopPlayerTest.resx">
<SubType>Designer</SubType>
<DependentUpon>SoundLoopPlayerTest.cs</DependentUpon>
Modified: Trunk/Source/Roam.UI/Controls/ScrollableLabel.cs
===================================================================
--- Trunk/Source/Roam.UI/Controls/ScrollableLabel.cs 2008-01-07 17:05:10 UTC (rev 111)
+++ Trunk/Source/Roam.UI/Controls/ScrollableLabel.cs 2008-02-08 03:11:13 UTC (rev 112)
@@ -45,6 +45,7 @@
private bool _useScrollLock = false;
private bool _showScrollBar = true;
private bool _beginUpdate = false;
+ private bool _requiresScrolling = false;
private Bitmap _bmpOffScreen = new Bitmap(1, 1);
private Keys _keyDown = Keys.None;
private int _keyDownCount = 0;
@@ -58,6 +59,8 @@
private Fill _backFill = new FillSimpleLinearGradient(new SimpleLinearGradient(Color.FromArgb(206, 223, 239), Color.White, SimpleLinearGradient.FillDirection.TopToBottom));
private Insets _textInsets = new Insets(1, 1, 1, 1);
#endregion Private Fields
+
+ #region Constructors
public ScrollableLabel()
: this(String.Empty)
{
@@ -83,9 +86,9 @@
OnResize(EventArgs.Empty);
Text = text;
}
+ #endregion Constructors
#region Properties
-
public Insets TextInsets
{
get { return _textInsets; }
@@ -238,6 +241,14 @@
}
}
+ /// <summary>
+ /// Returns true if the amount of text in the label is enough to warrant scrolling.
+ /// </summary>
+ public bool RequiresScrolling
+ {
+ get { return _requiresScrolling; }
+ }
+
public int PreferredHeight
{
get
@@ -278,6 +289,18 @@
#endregion Properties
#region Public Methods
+ public void ScrollToTop()
+ {
+ this.VScrollBar.Value = this.VScrollBar.Minimum;
+ this.Invalidate();
+ }
+
+ public void ScrollToBottom()
+ {
+ this.VScrollBar.Value = this.VScrollBar.Maximum;
+ this.Invalidate();
+ }
+
public void BeginUpdate()
{
_beginUpdate = true;
@@ -405,6 +428,12 @@
drawableArea.Width - _textInsets.TotalHorizontalInset);
float textHeightWithInsets = _textBounds.Height + _textInsets.TotalVerticalInset;
+ //the minus 5 is just so we don't get scrolling when it's really not needed
+ if (textHeightWithInsets - 5 > drawableArea.Height)
+ {
+ _requiresScrolling = true;
+ }
+
//set the scroll bar parameters based on text bounds
if (textHeightWithInsets > drawableArea.Height && _showScrollBar)
{
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|