Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 58f3464

Browse files
TextEditor for text and expressions in PropertyGrid,
Editor for FormatString
1 parent c3120ad commit 58f3464

15 files changed

Lines changed: 500 additions & 59 deletions

File tree

src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
</Reference>
6262
<Reference Include="System.Design" />
6363
<Reference Include="System.Drawing" />
64+
<Reference Include="System.Drawing.Design" />
6465
<Reference Include="System.Windows.Forms" />
6566
<Reference Include="System.Xaml">
6667
<RequiredTargetFramework>4.0</RequiredTargetFramework>
@@ -83,6 +84,7 @@
8384
<Folder Include="src\DesignableItems" />
8485
<Folder Include="src\Factory" />
8586
<Folder Include="src\Dialogs" />
87+
<Folder Include="src\New Folder" />
8688
<Folder Include="src\Wizard" />
8789
<Folder Include="src\Toolbox" />
8890
<Folder Include="src\TypeProvider" />
@@ -124,6 +126,14 @@
124126
<Compile Include="src\Designer\SectionDesigner.cs" />
125127
<Compile Include="src\Designer\TextItemDesigner.cs" />
126128
<Compile Include="src\Dialogs\DataTypeStringConverter.cs" />
129+
<Compile Include="src\Dialogs\DefaultTextEditor.cs" />
130+
<Compile Include="src\Dialogs\EditorDialog.cs" />
131+
<Compile Include="src\Dialogs\EditorDialog.Designer.cs">
132+
<DependentUpon>EditorDialog.cs</DependentUpon>
133+
</Compile>
134+
<Compile Include="src\Dialogs\ExpressionEditor.cs" />
135+
<Compile Include="src\Dialogs\FormatStringConverter.cs" />
136+
<Compile Include="src\Dialogs\IStringBasedEditorDialog.cs" />
127137
<Compile Include="src\Factory\CreateFormSheetFromModel.cs" />
128138
<Compile Include="src\Globals\DesignerGlobals.cs" />
129139
<Compile Include="src\Globals\GlobalLists.cs" />
@@ -192,5 +202,10 @@
192202
<Name>ICSharpCode.Reporting</Name>
193203
</ProjectReference>
194204
</ItemGroup>
205+
<ItemGroup>
206+
<EmbeddedResource Include="src\Dialogs\EditorDialog.resx">
207+
<DependentUpon>EditorDialog.cs</DependentUpon>
208+
</EmbeddedResource>
209+
</ItemGroup>
195210
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
196211
</Project>

src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/BaseTextItem.cs

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System;
1010
using System.ComponentModel;
1111
using System.Drawing;
12+
using System.Drawing.Design;
1213
using ICSharpCode.Reporting.BaseClasses;
1314
using ICSharpCode.Reporting.Globals;
1415
using ICSharpCode.Reporting.Addin.Designer;
@@ -32,8 +33,7 @@ public class BaseTextItem:AbstractItem
3233
ContentAlignment contentAlignment;
3334

3435

35-
public BaseTextItem():base()
36-
{
36+
public BaseTextItem(){
3737
DefaultSize = GlobalValues.PreferedSize;
3838
Size = GlobalValues.PreferedSize;
3939
BackColor = Color.White;
@@ -42,11 +42,10 @@ public BaseTextItem():base()
4242
}
4343

4444

45-
[EditorBrowsableAttribute()]
46-
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
47-
{
45+
// [EditorBrowsableAttribute()]
46+
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e){
4847
base.OnPaint(e);
49-
this.Draw(e.Graphics);
48+
Draw(e.Graphics);
5049
}
5150

5251

@@ -74,24 +73,23 @@ public override void Draw(Graphics graphics)
7473

7574

7675

77-
// [EditorAttribute(typeof(DefaultTextEditor),
78-
// typeof(System.Drawing.Design.UITypeEditor) )]
76+
[EditorAttribute(typeof(DefaultTextEditor),
77+
typeof(UITypeEditor) )]
7978
public override string Text {
8079
get { return base.Text; }
8180
set { base.Text = value;
82-
this.Invalidate();
81+
Invalidate();
8382
}
8483
}
8584

8685

8786
#region Format and alignment
8887

89-
// [Browsable(true),
90-
// Category("Appearance"),
91-
// Description("String to format Number's Date's etc")]
92-
// [DefaultValue("entry1")]
93-
// [TypeConverter(typeof(FormatStringConverter))]
94-
88+
[Browsable(true),
89+
Category("Appearance"),
90+
Description("String to format Number's Date's etc")]
91+
[DefaultValue("entry1")]
92+
[TypeConverter(typeof(FormatStringConverter))]
9593
public string FormatString {
9694
get { return formatString; }
9795
set {
@@ -122,9 +120,9 @@ public StringTrimming StringTrimming {
122120

123121

124122

125-
// [Category("Appearance")]
126-
// [EditorAttribute(typeof(ContentAlignmentEditor),
127-
// typeof(UITypeEditor) )]
123+
[Category("Appearance")]
124+
[EditorAttribute(typeof(ContentAlignmentEditor),
125+
typeof(UITypeEditor) )]
128126
public ContentAlignment ContentAlignment {
129127
get { return contentAlignment; }
130128
set {
@@ -136,35 +134,34 @@ public ContentAlignment ContentAlignment {
136134

137135
#endregion
138136

139-
#region RighToLeft
140-
141-
[Category("Appearance")]
142-
public System.Windows.Forms.RightToLeft RTL
143-
{
144-
get { return base.RightToLeft; }
145-
set { base.RightToLeft = value; }
146-
}
147-
148-
#endregion
137+
// #region RighToLeft
138+
//
139+
// [Category("Appearance")]
140+
// public System.Windows.Forms.RightToLeft RTL
141+
// {
142+
// get { return base.RightToLeft; }
143+
// set { base.RightToLeft = value; }
144+
// }
145+
//
146+
// #endregion
149147

150148
#region DataType
151149

152150

153151
[Category("Databinding"),Description(datatypeOfTheUnderlyingColumn)]
154152
[DefaultValue("System.String")]
155153
[TypeConverter(typeof(DataTypeStringConverter))]
156-
157154
public string DataType {get;set;}
158155

159156
#endregion
160157

161158
#region Expression
162159

163-
// [Browsable(true),
164-
// Category("Expression"),
165-
// Description("Enter a valid Expression")]
166-
// [EditorAttribute(typeof(DefaultTextEditor),
167-
// typeof(System.Drawing.Design.UITypeEditor) )]
160+
[Browsable(true),
161+
Category("Expression"),
162+
Description("Enter a valid Expression")]
163+
[EditorAttribute(typeof(ExpressionEditor),
164+
typeof(UITypeEditor) )]
168165
public string Expression {get;set;}
169166

170167
#endregion

src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Designer/TextItemDesigner.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* To change this template use Tools | Options | Coding | Edit Standard Headers.
88
*/
99
using System;
10+
using System.Collections;
1011
using ICSharpCode.Reporting.Addin.TypeProvider;
1112

1213

@@ -19,8 +20,7 @@ class TextItemDesigner:AbstractDesigner
1920
{
2021

2122

22-
protected override void PostFilterProperties(System.Collections.IDictionary properties)
23-
{
23+
protected override void PostFilterProperties(IDictionary properties){
2424
TypeProviderHelper.RemoveProperties(properties);
2525
base.PostFilterProperties(properties);
2626
}

src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Dialogs/DataTypeStringConverter.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,20 @@ namespace ICSharpCode.Reporting.Addin.Dialogs
1717
/// </summary>
1818
class DataTypeStringConverter:StringConverter
1919
{
20-
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
21-
22-
{
20+
public override bool GetStandardValuesSupported(ITypeDescriptorContext context){
2321
//true means show a combobox
2422
return true;
2523
}
2624

2725

28-
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
29-
30-
{
26+
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context){
3127
//true will limit to list. false will show the list, but allow free-form entry
3228
return true;
3329
}
3430

3531

36-
public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
37-
{
32+
public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context){
3833
return new StandardValuesCollection(GlobalLists.DataTypeList());
39-
4034
}
4135
}
4236
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Created by SharpDevelop.
3+
* User: Peter Forstmeier
4+
* Date: 11.05.2014
5+
* Time: 18:06
6+
*
7+
* To change this template use Tools | Options | Coding | Edit Standard Headers.
8+
*/
9+
using System;
10+
using System.ComponentModel;
11+
using System.Drawing.Design;
12+
using System.Windows.Forms;
13+
using ICSharpCode.Reports.Core.Dialogs;
14+
15+
namespace ICSharpCode.Reporting.Addin.Dialogs
16+
{
17+
/// <summary>
18+
/// Description of DefaultTextEditor.
19+
/// </summary>
20+
public class DefaultTextEditor:UITypeEditor
21+
{
22+
const string textEditor = "TextEditor";
23+
24+
25+
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
26+
{
27+
string s = String.Empty;;
28+
29+
if (value != null) {
30+
s = value.ToString();
31+
}
32+
33+
IStringBasedEditorDialog ed = new TextEditorDialog(s, textEditor);
34+
return ed.ShowDialog() == DialogResult.OK ? ed.TextValue : s;
35+
}
36+
37+
38+
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
39+
{
40+
return UITypeEditorEditStyle.Modal;
41+
}
42+
}
43+
}

src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Dialogs/EditorDialog.Designer.cs

Lines changed: 94 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)