Skip to content

Commit

Permalink
added Feed Monitor project
Browse files Browse the repository at this point in the history
  • Loading branch information
briandunnington committed Aug 27, 2009
1 parent 575cb64 commit adf22a9
Show file tree
Hide file tree
Showing 23 changed files with 3,154 additions and 0 deletions.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

157 changes: 157 additions & 0 deletions Growl Extras/Feed Monitor/GrowlExtras.FeedMonitor/FeedListView.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GrowlExtras.FeedMonitor
{
public partial class FeedListView : ListView
{
private ToolTip tooltip = new ToolTip();

public FeedListView(IContainer container)
{
container.Add(this);

InitializeComponent();

this.SuspendLayout();

this.OwnerDraw = true;
this.DoubleBuffered = true;

// columns
ColumnHeader nameHeader = new ColumnHeader();
ColumnHeader urlHeader = new ColumnHeader();
this.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
nameHeader,
urlHeader});

this.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
//this.LargeImageList = this.imageList;
this.MultiSelect = false;
this.UseCompatibleStateImageBehavior = false;
this.View = System.Windows.Forms.View.Tile;
this.Scrollable = false;
this.ShowItemToolTips = true;
this.LabelWrap = false;

this.DrawItem += new DrawListViewItemEventHandler(FeedListView_DrawItem);

// uncomment this to use custom tool tips
//this.ShowItemToolTips = false;
this.ItemMouseHover += new ListViewItemMouseHoverEventHandler(FeedListView_ItemMouseHover);
//this.MouseLeave += new EventHandler(FeedListView_MouseLeave);

this.ResumeLayout();
}

void FeedListView_DrawItem(object sender, DrawListViewItemEventArgs e)
{
if (this.View == View.Tile)
{
Feed feed = (Feed) e.Item.Tag;

// draw the background and focus rectangle for selected and non-selected states
if ((e.State & ListViewItemStates.Selected) != 0)
{
e.Graphics.FillRectangle(System.Drawing.Brushes.LightGray, e.Bounds);
e.DrawFocusRectangle();
}
else
{
e.DrawBackground();
e.DrawFocusRectangle();
}

// draw icon
int newX = e.Bounds.Left;
/*
System.Drawing.Image img = this.imageList.Images[e.Item.ImageKey];
if (img != null)
{
int x = e.Bounds.Left;
int y = e.Bounds.Top;
e.Graphics.DrawImage(img, x, y);
newX = e.Bounds.Left + img.Width + this.Margin.Right;
img.Dispose();
}
* */

// draw main text
System.Drawing.RectangleF rect = new System.Drawing.RectangleF(newX, e.Bounds.Top, e.Bounds.Right - newX, e.Item.Font.Height);
System.Drawing.StringFormat sf = new System.Drawing.StringFormat();
sf.Trimming = System.Drawing.StringTrimming.EllipsisCharacter;
sf.FormatFlags = System.Drawing.StringFormatFlags.NoClip;
System.Drawing.SolidBrush foreBrush = new System.Drawing.SolidBrush(e.Item.ForeColor);
using (foreBrush)
{
e.Graphics.DrawString(feed.Name,
e.Item.Font,
foreBrush,
rect,
sf);
}

// draw subitems
System.Drawing.Color subColor = System.Drawing.Color.FromArgb(System.Drawing.SystemColors.GrayText.ToArgb());
System.Drawing.SolidBrush subBrush = new System.Drawing.SolidBrush(subColor);
using (subBrush)
{
for (int i = 1; i < this.Columns.Count; i++)
{
if (i < e.Item.SubItems.Count)
{
rect.Offset(0, e.Item.Font.Height);
e.Graphics.DrawString(e.Item.SubItems[i].Text,
e.Item.Font,
subBrush,
rect,
sf);
}
}
}
}
else
{
e.DrawDefault = true;
}
}

void FeedListView_ItemMouseHover(object sender, ListViewItemMouseHoverEventArgs e)
{
// update tooltip text
Feed feed = e.Item.Tag as Feed;
if (feed != null)
{
e.Item.ToolTipText = String.Format("Updates every {0} minutes", feed.PollInterval);
}

/*
Feed feed = e.Item.Tag as Feed;
if (feed != null)
{
string text = String.Format("Updates every {0} minutes", feed.PollInterval);
//System.Drawing.Point position = Cursor.Position;
System.Drawing.Point position = this.PointToClient(Cursor.Position);
position.Offset(0, Cursor.Current.Size.Height - 10);
IntPtr handle = (IntPtr)typeof(ToolTip).GetProperty("Handle", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(this.tooltip, null);
this.tooltip.Show(text, this, position, this.tooltip.AutoPopDelay);
User32DLL.SetWindowPos(handle, User32DLL.HWND_TOPMOST, 0, 0, 0, 0, User32DLL.SWP_NOACTIVATE | User32DLL.SWP_NOMOVE | User32DLL.SWP_NOSIZE);
}
* */
}

void FeedListView_MouseLeave(object sender, EventArgs e)
{
System.Drawing.Point p = PointToClient(Cursor.Position);
ListViewHitTestInfo info = this.HitTest(p);
if (info.Item == null)
this.tooltip.Hide(this);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{40C8E85D-CED7-4CB5-8584-EB7E27C516FD}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GrowlExtras.FeedMonitor</RootNamespace>
<AssemblyName>GrowlExtras.FeedMonitor</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ApplicationIcon>Resources\feed.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Growl.Connector, Version=2.0.0.0, Culture=neutral, PublicKeyToken=980c2339411be384, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Growl Connectors\NET\libraries\Growl.Connector.dll</HintPath>
</Reference>
<Reference Include="Growl.CoreLibrary, Version=2.0.0.0, Culture=neutral, PublicKeyToken=13e59d82e007b064, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Growl Connectors\NET\libraries\Growl.CoreLibrary.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.ServiceModel.Web">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FeedListView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="FeedListView.Designer.cs">
<DependentUpon>FeedListView.cs</DependentUpon>
</Compile>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="MainComponent.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="_source\Feed.cs" />
<Compile Include="_source\Rss10FeedFormatter.cs" />
<Compile Include="_source\SettingsPersister.cs" />
<Compile Include="_source\User32DLL.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\close_blue.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\close_red.png" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Resources\feed.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GrowlExtras.FeedMonitor", "GrowlExtras.FeedMonitor.csproj", "{40C8E85D-CED7-4CB5-8584-EB7E27C516FD}"
EndProject
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Feed Monitor Deployment", "..\Feed Monitor Deployment\Feed Monitor Deployment.vdproj", "{3C42B04C-8B22-4F00-BA68-57F7969404D6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{40C8E85D-CED7-4CB5-8584-EB7E27C516FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{40C8E85D-CED7-4CB5-8584-EB7E27C516FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{40C8E85D-CED7-4CB5-8584-EB7E27C516FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{40C8E85D-CED7-4CB5-8584-EB7E27C516FD}.Release|Any CPU.Build.0 = Release|Any CPU
{3C42B04C-8B22-4F00-BA68-57F7969404D6}.Debug|Any CPU.ActiveCfg = Debug
{3C42B04C-8B22-4F00-BA68-57F7969404D6}.Release|Any CPU.ActiveCfg = Release
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Loading

0 comments on commit adf22a9

Please sign in to comment.