Browse Source

Fixed SD2-652: Code completion for form component with modifier set to public

Fixed SD2-659: No code completion for newly added components to a partial form class

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1045 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
3255344aba
  1. 6
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs
  2. 50
      src/Main/Base/Project/Src/Project/ConfigurationGuiHelper.cs

6
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs

@ -196,10 +196,11 @@ namespace ICSharpCode.FormsDesigner @@ -196,10 +196,11 @@ namespace ICSharpCode.FormsDesigner
removedFields.Add(field.Name);
}
}
// removing fields is done in two steps because
// removing fields is done in two steps because
// we must not modify the c.Fields collection while it is enumerated
removedFields.ForEach(RemoveField);
ParserService.EnqueueForParsing(designerFile, document.TextContent);
}
/// <summary>
@ -240,6 +241,7 @@ namespace ICSharpCode.FormsDesigner @@ -240,6 +241,7 @@ namespace ICSharpCode.FormsDesigner
IDocument document;
string saveDocumentToFile; // only set when InitializeComponent was loaded from code-behind file that was not opened
string designerFile; // file that contains InitializeComponents
void SaveDocument()
{
@ -265,7 +267,7 @@ namespace ICSharpCode.FormsDesigner @@ -265,7 +267,7 @@ namespace ICSharpCode.FormsDesigner
if (FormsDesignerSecondaryDisplayBinding.BaseClassIsFormOrControl(c)) {
initializeComponents = FormsDesignerSecondaryDisplayBinding.GetInitializeComponents(c);
if (initializeComponents != null) {
string designerFile = initializeComponents.DeclaringType.CompilationUnit.FileName;
designerFile = initializeComponents.DeclaringType.CompilationUnit.FileName;
string designerContent;
if (FileUtility.IsEqualFileName(viewContent.TextEditorControl.FileName, designerFile)) {
designerContent = content;

50
src/Main/Base/Project/Src/Project/ConfigurationGuiHelper.cs

@ -248,6 +248,56 @@ namespace ICSharpCode.SharpDevelop.Project @@ -248,6 +248,56 @@ namespace ICSharpCode.SharpDevelop.Project
}
#endregion
#region Bind int to NumericUpDown
public ConfigurationGuiBinding BindInt(string control, string property, int defaultValue)
{
return BindInt(controlDictionary[control], property, defaultValue);
}
public ConfigurationGuiBinding BindInt(Control control, string property, int defaultValue)
{
if (control is NumericUpDown) {
SimpleIntBinding binding = new SimpleIntBinding((NumericUpDown)control, defaultValue);
AddBinding(property, binding);
control.TextChanged += ControlValueChanged;
return binding;
} else {
throw new ApplicationException("Cannot bind " + control.GetType().Name + " to int property.");
}
}
class SimpleIntBinding : ConfigurationGuiBinding
{
NumericUpDown control;
int defaultValue;
public SimpleIntBinding(NumericUpDown control, int defaultValue)
{
this.control = control;
this.defaultValue = defaultValue;
}
public override void Load()
{
int val;
if (!int.TryParse(Get(defaultValue.ToString(NumberFormatInfo.InvariantInfo)), NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out val)) {
val = defaultValue;
}
control.Text = val.ToString();
}
public override bool Save()
{
string txt = control.Text.Trim();
NumberStyles style = NumberStyles.Integer;
int val;
val = int.Parse(txt, style, NumberFormatInfo.InvariantInfo);
Set(val.ToString(NumberFormatInfo.InvariantInfo));
return true;
}
}
#endregion
#region Bind hex number to TextBox
public ConfigurationGuiBinding BindHexadecimal(TextBoxBase textBox, string property, int defaultValue)
{

Loading…
Cancel
Save