Browse Source

Added Alex Knip's patch to fix SD2-553 - Cannot Show Form Designer Grid.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1231 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 20 years ago
parent
commit
d80ad0eb28
  1. BIN
      data/resources/StringResources.cz.resources
  2. BIN
      data/resources/StringResources.de.resources
  3. BIN
      data/resources/StringResources.es-mx.resources
  4. BIN
      data/resources/StringResources.hu.resources
  5. BIN
      data/resources/StringResources.it.resources
  6. BIN
      data/resources/StringResources.nl.resources
  7. BIN
      data/resources/StringResources.ro.resources
  8. BIN
      data/resources/StringResources.se.resources
  9. 3
      src/AddIns/DisplayBindings/FormsDesigner/Project/FormsDesigner.addin
  10. 2
      src/AddIns/DisplayBindings/FormsDesigner/Project/FormsDesigner.csproj
  11. 68
      src/AddIns/DisplayBindings/FormsDesigner/Project/Resources/WindowsFormsGeneralOptions.xfrm
  12. 87
      src/AddIns/DisplayBindings/FormsDesigner/Project/Resources/WindowsFormsGridOptions.xfrm
  13. 2
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs
  14. 46
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/OptionPanels/GeneralOptions.cs
  15. 39
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/OptionPanels/GridOptions.cs
  16. 149
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/DesignerOptionService.cs
  17. BIN
      src/Main/StartUp/Project/Resources/StringResources.resources

BIN
data/resources/StringResources.cz.resources

Binary file not shown.

BIN
data/resources/StringResources.de.resources

Binary file not shown.

BIN
data/resources/StringResources.es-mx.resources

Binary file not shown.

BIN
data/resources/StringResources.hu.resources

Binary file not shown.

BIN
data/resources/StringResources.it.resources

Binary file not shown.

BIN
data/resources/StringResources.nl.resources

Binary file not shown.

BIN
data/resources/StringResources.ro.resources

Binary file not shown.

BIN
data/resources/StringResources.se.resources

Binary file not shown.

3
src/AddIns/DisplayBindings/FormsDesigner/Project/FormsDesigner.addin

@ -303,6 +303,9 @@
insertafter = "ToolsOptions" insertafter = "ToolsOptions"
label = "${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.PanelName}"> label = "${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.PanelName}">
<DialogPanel id = "GeneralOptions"
label = "${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GeneralOptionsPanel.PanelName}"
class = "ICSharpCode.FormsDesigner.Gui.OptionPanels.GeneralOptionsPanel"/>
<DialogPanel id = "GridOptions" <DialogPanel id = "GridOptions"
label = "${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.PanelName}" label = "${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.PanelName}"
class = "ICSharpCode.FormsDesigner.Gui.OptionPanels.GridOptionsPanel"/> class = "ICSharpCode.FormsDesigner.Gui.OptionPanels.GridOptionsPanel"/>

2
src/AddIns/DisplayBindings/FormsDesigner/Project/FormsDesigner.csproj

@ -99,6 +99,8 @@
<Compile Include="Src\DesignerGenerator\AbstractDesignerGenerator.cs" /> <Compile Include="Src\DesignerGenerator\AbstractDesignerGenerator.cs" />
<Compile Include="Src\Services\TypeDiscoveryService.cs" /> <Compile Include="Src\Services\TypeDiscoveryService.cs" />
<Compile Include="Src\UndoRedo\UndoEngine.cs" /> <Compile Include="Src\UndoRedo\UndoEngine.cs" />
<Compile Include="Src\Gui\OptionPanels\GeneralOptions.cs" />
<EmbeddedResource Include="Resources\WindowsFormsGeneralOptions.xfrm" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj"> <ProjectReference Include="..\..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj">

68
src/AddIns/DisplayBindings/FormsDesigner/Project/Resources/WindowsFormsGeneralOptions.xfrm

@ -0,0 +1,68 @@
<Components version="1.0">
<System.Windows.Forms.UserControl>
<Name value="WindowsFormsGeneralOptions" />
<ClientSize value="{Width=391, Height=300}" />
<Controls>
<System.Windows.Forms.GroupBox>
<Name value="propertyPadOptionsGroupBox" />
<Location value="{X=9,Y=168}" />
<Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.PropertyGridGroupBox}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=372, Height=56}" />
<TabIndex value="1" />
<Controls>
<System.Windows.Forms.CheckBox>
<Name value="sortAlphabeticalCheckBox" />
<Location value="{X=6,Y=24}" />
<Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.PropertyGridSortCheckBox}" />
<TabIndex value="0" />
<Size value="{Width=366, Height=24}" />
<UseVisualStyleBackColor value="True" />
</System.Windows.Forms.CheckBox>
</Controls>
</System.Windows.Forms.GroupBox>
<System.Windows.Forms.GroupBox>
<Name value="generalOptionsGroupBox" />
<Location value="{X=8,Y=8}" />
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.General.GeneralOptionsGroupBox}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=373, Height=145}" />
<TabIndex value="0" />
<Controls>
<System.Windows.Forms.CheckBox>
<Name value="optimizedCodeGenerationCheckBox" />
<Location value="{X=6,Y=110}" />
<Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.OptimizedCodeGenerationCheckBox}" />
<TabIndex value="3" />
<Size value="{Width=367, Height=24}" />
<UseVisualStyleBackColor value="True" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.CheckBox>
<Name value="smartTagAutoShowCheckBox" />
<Location value="{X=6,Y=80}" />
<Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.SmartTagAutoShowCheckBox}" />
<TabIndex value="2" />
<Size value="{Width=367, Height=24}" />
<UseVisualStyleBackColor value="True" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.CheckBox>
<Name value="inPlaceEditCheckBox" />
<Location value="{X=6,Y=50}" />
<Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.InPlaceEditCheckBox}" />
<TabIndex value="1" />
<Size value="{Width=367, Height=24}" />
<UseVisualStyleBackColor value="True" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.CheckBox>
<Name value="useSmartTagsCheckBox" />
<Location value="{X=6,Y=20}" />
<Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.SmartTagsCheckBox}" />
<TabIndex value="0" />
<Size value="{Width=367, Height=24}" />
<UseVisualStyleBackColor value="True" />
</System.Windows.Forms.CheckBox>
</Controls>
</System.Windows.Forms.GroupBox>
</Controls>
</System.Windows.Forms.UserControl>
</Components>

87
src/AddIns/DisplayBindings/FormsDesigner/Project/Resources/WindowsFormsGridOptions.xfrm

@ -1,83 +1,84 @@
<Components version="1.0"> <Components version="1.0">
<System.Windows.Forms.UserControl> <System.Windows.Forms.UserControl>
<Name value="CreatedUserControl" /> <Name value="CreatedUserControl" />
<DockPadding value="" /> <ClientSize value="{Width=375, Height=357}" />
<ClientSize value="{Width=224, Height=224}" />
<Controls> <Controls>
<System.Windows.Forms.GroupBox> <System.Windows.Forms.GroupBox>
<Name value="groupBox2" /> <Name value="groupBox2" />
<TabIndex value="1" /> <Location value="{X=8,Y=111}" />
<Location value="{X=8,Y=144}" />
<Anchor value="Top, Left, Right" />
<ClientSize value="{Width=208, Height=64}" />
<Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.PropertyGridGroupBox}" />
<Controls>
<System.Windows.Forms.CheckBox>
<Name value="sortAlphabeticalCheckBox" />
<Location value="{X=8,Y=24}" />
<ClientSize value="{Width=192, Height=24}" />
<Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.PropertyGridSortCheckBox}" />
<Anchor value="Top, Left, Right" />
<TabIndex value="4" />
</System.Windows.Forms.CheckBox>
</Controls>
</System.Windows.Forms.GroupBox>
<System.Windows.Forms.GroupBox>
<Name value="groupBox" />
<TabIndex value="0" />
<Location value="{X=8,Y=8}" />
<Anchor value="Top, Left, Right" />
<ClientSize value="{Width=208, Height=128}" />
<Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.GridPropertiesGroupBox}" /> <Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.GridPropertiesGroupBox}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=367, Height=144}" />
<TabIndex value="1" />
<Controls> <Controls>
<System.Windows.Forms.CheckBox> <System.Windows.Forms.CheckBox>
<Name value="snapToGridCheckBox" /> <Name value="snapToGridCheckBox" />
<Location value="{X=8,Y=96}" /> <Location value="{X=8,Y=111}" />
<ClientSize value="{Width=192, Height=24}" />
<Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.SnapToGridComboBox}" /> <Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.SnapToGridComboBox}" />
<Anchor value="Bottom, Left, Right" />
<TabIndex value="5" /> <TabIndex value="5" />
<Size value="{Width=343, Height=24}" />
</System.Windows.Forms.CheckBox> </System.Windows.Forms.CheckBox>
<System.Windows.Forms.CheckBox> <System.Windows.Forms.CheckBox>
<Name value="showGridCheckBox" /> <Name value="showGridCheckBox" />
<Location value="{X=8,Y=72}" /> <Location value="{X=8,Y=84}" />
<ClientSize value="{Width=192, Height=24}" />
<Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.ShowGridComboBox}" /> <Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.ShowGridComboBox}" />
<Anchor value="Bottom, Left, Right" />
<TabIndex value="4" /> <TabIndex value="4" />
<Size value="{Width=343, Height=24}" />
</System.Windows.Forms.CheckBox> </System.Windows.Forms.CheckBox>
<System.Windows.Forms.TextBox> <System.Windows.Forms.TextBox>
<Name value="heightTextBox" /> <Name value="heightTextBox" />
<TabIndex value="3" /> <TabIndex value="3" />
<Location value="{X=104,Y=40}" /> <Size value="{Width=53, Height=21}" />
<ClientSize value="{Width=68, Height=17}" /> <Location value="{X=133,Y=51}" />
<Text value="" />
</System.Windows.Forms.TextBox> </System.Windows.Forms.TextBox>
<System.Windows.Forms.Label> <System.Windows.Forms.Label>
<Name value="label" /> <Name value="gridHeightLabel" />
<Location value="{X=8,Y=51}" />
<Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.HeightLabel}" /> <Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.HeightLabel}" />
<TextAlign value="MiddleRight" /> <TextAlign value="MiddleRight" />
<Size value="{Width=121, Height=23}" />
<TabIndex value="2" /> <TabIndex value="2" />
<ClientSize value="{Width=88, Height=23}" />
<Location value="{X=8,Y=40}" />
</System.Windows.Forms.Label> </System.Windows.Forms.Label>
<System.Windows.Forms.TextBox> <System.Windows.Forms.TextBox>
<Name value="widthTextBox" /> <Name value="widthTextBox" />
<TabIndex value="1" /> <TabIndex value="1" />
<Location value="{X=104,Y=16}" /> <Size value="{Width=53, Height=21}" />
<ClientSize value="{Width=68, Height=17}" /> <Location value="{X=133,Y=20}" />
<Text value="" />
</System.Windows.Forms.TextBox> </System.Windows.Forms.TextBox>
<System.Windows.Forms.Label> <System.Windows.Forms.Label>
<Name value="label" /> <Name value="gridWidthLabel" />
<Location value="{X=6,Y=20}" />
<Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.WidthLabel}" /> <Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.WidthLabel}" />
<TextAlign value="MiddleRight" /> <TextAlign value="MiddleRight" />
<Size value="{Width=121, Height=23}" />
<TabIndex value="0" /> <TabIndex value="0" />
<ClientSize value="{Width=88, Height=23}" />
<Location value="{X=8,Y=16}" />
</System.Windows.Forms.Label> </System.Windows.Forms.Label>
</Controls> </Controls>
</System.Windows.Forms.GroupBox> </System.Windows.Forms.GroupBox>
<System.Windows.Forms.GroupBox>
<Name value="groupBox1" />
<Location value="{X=8,Y=8}" />
<Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.SnapModeGroupBox}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=367, Height=87}" />
<TabIndex value="0" />
<Controls>
<System.Windows.Forms.RadioButton>
<Name value="snapToGridRadioButton" />
<Location value="{X=8,Y=20}" />
<Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.SnapToGridRadioButton}" />
<Size value="{Width=353, Height=24}" />
<TabIndex value="0" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.RadioButton>
<Name value="snapLinesRadioButton" />
<Location value="{X=8,Y=50}" />
<Text value="${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.SnapLinesRadioButton}" />
<Size value="{Width=353, Height=24}" />
<TabIndex value="1" />
</System.Windows.Forms.RadioButton>
</Controls>
</System.Windows.Forms.GroupBox>
</Controls> </Controls>
</System.Windows.Forms.UserControl> </System.Windows.Forms.UserControl>
</Components> </Components>

2
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs

@ -140,7 +140,7 @@ namespace ICSharpCode.FormsDesigner
serviceContainer.AddService(typeof(AmbientProperties), ambientProperties); serviceContainer.AddService(typeof(AmbientProperties), ambientProperties);
serviceContainer.AddService(typeof(ITypeResolutionService), new TypeResolutionService(viewContent.FileName)); serviceContainer.AddService(typeof(ITypeResolutionService), new TypeResolutionService(viewContent.FileName));
serviceContainer.AddService(typeof(System.ComponentModel.Design.IDesignerEventService), new DesignerEventService()); serviceContainer.AddService(typeof(System.ComponentModel.Design.IDesignerEventService), new DesignerEventService());
serviceContainer.AddService(typeof(System.ComponentModel.Design.DesignerOptionService), new ICSharpCode.FormsDesigner.Services.DesignerOptionService()); serviceContainer.AddService(typeof(DesignerOptionService), new SharpDevelopDesignerOptionService());
serviceContainer.AddService(typeof(ITypeDiscoveryService), new TypeDiscoveryService()); serviceContainer.AddService(typeof(ITypeDiscoveryService), new TypeDiscoveryService());
serviceContainer.AddService(typeof(MemberRelationshipService), new DefaultMemberRelationshipService()); serviceContainer.AddService(typeof(MemberRelationshipService), new DefaultMemberRelationshipService());

46
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/OptionPanels/GeneralOptions.cs

@ -0,0 +1,46 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.FormsDesigner.Gui.OptionPanels
{
public class GeneralOptionsPanel : AbstractOptionPanel
{
public override void LoadPanelContents()
{
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ICSharpCode.FormsDesigner.Resources.WindowsFormsGeneralOptions.xfrm"));
((CheckBox)ControlDictionary["sortAlphabeticalCheckBox"]).Checked = PropertyService.Get("FormsDesigner.DesignerOptions.PropertyGridSortAlphabetical", false);
((CheckBox)ControlDictionary["optimizedCodeGenerationCheckBox"]).Checked = PropertyService.Get("FormsDesigner.DesignerOptions.UseOptimizedCodeGeneration", true);
((CheckBox)ControlDictionary["smartTagAutoShowCheckBox"]).Checked = PropertyService.Get("FormsDesigner.DesignerOptions.ObjectBoundSmartTagAutoShow", true);
((CheckBox)ControlDictionary["inPlaceEditCheckBox"]).Checked = PropertyService.Get("FormsDesigner.DesignerOptions.EnableInSituEditing", true);
((CheckBox)ControlDictionary["useSmartTagsCheckBox"]).Checked = PropertyService.Get("FormsDesigner.DesignerOptions.UseSmartTags", true);
}
public override bool StorePanelContents()
{
PropertyService.Set("FormsDesigner.DesignerOptions.PropertyGridSortAlphabetical", ((CheckBox)ControlDictionary["sortAlphabeticalCheckBox"]).Checked);
PropertyService.Set("FormsDesigner.DesignerOptions.UseOptimizedCodeGeneration", ((CheckBox)ControlDictionary["optimizedCodeGenerationCheckBox"]).Checked);
PropertyService.Set("FormsDesigner.DesignerOptions.ObjectBoundSmartTagAutoShow", ((CheckBox)ControlDictionary["smartTagAutoShowCheckBox"]).Checked);
PropertyService.Set("FormsDesigner.DesignerOptions.EnableInSituEditing", ((CheckBox)ControlDictionary["inPlaceEditCheckBox"]).Checked);
PropertyService.Set("FormsDesigner.DesignerOptions.UseSmartTags", ((CheckBox)ControlDictionary["useSmartTagsCheckBox"]).Checked);
return true;
}
}
}

39
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/OptionPanels/GridOptions.cs

@ -16,7 +16,6 @@ using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project; using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Gui; using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.FormsDesigner.Gui.OptionPanels namespace ICSharpCode.FormsDesigner.Gui.OptionPanels
{ {
public class GridOptionsPanel : AbstractOptionPanel public class GridOptionsPanel : AbstractOptionPanel
@ -25,11 +24,17 @@ namespace ICSharpCode.FormsDesigner.Gui.OptionPanels
{ {
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ICSharpCode.FormsDesigner.Resources.WindowsFormsGridOptions.xfrm")); SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ICSharpCode.FormsDesigner.Resources.WindowsFormsGridOptions.xfrm"));
ControlDictionary["widthTextBox"].Text = PropertyService.Get("FormsDesigner.DesignerOptions.GridSizeWidth", 8).ToString(); bool snapToGridOn = PropertyService.Get("FormsDesigner.DesignerOptions.SnapToGridMode", false);
ControlDictionary["heightTextBox"].Text = PropertyService.Get("FormsDesigner.DesignerOptions.GridSizeHeight", 8).ToString();
((CheckBox)ControlDictionary["showGridCheckBox"]).Checked = PropertyService.Get("FormsDesigner.DesignerOptions.ShowGrid", true); ((RadioButton)ControlDictionary["snapToGridRadioButton"]).Checked = snapToGridOn;
((CheckBox)ControlDictionary["snapToGridCheckBox"]).Checked = PropertyService.Get("FormsDesigner.DesignerOptions.SnapToGrid", true); ((RadioButton)ControlDictionary["snapLinesRadioButton"]).Checked = !snapToGridOn;
((CheckBox)ControlDictionary["sortAlphabeticalCheckBox"]).Checked = PropertyService.Get("FormsDesigner.DesignerOptions.PropertyGridSortAlphabetical", false); ControlDictionary["widthTextBox"].Text = PropertyService.Get("FormsDesigner.DesignerOptions.GridSizeWidth", 8).ToString();
ControlDictionary["heightTextBox"].Text = PropertyService.Get("FormsDesigner.DesignerOptions.GridSizeHeight", 8).ToString();
((CheckBox)ControlDictionary["showGridCheckBox"]).Checked = PropertyService.Get("FormsDesigner.DesignerOptions.ShowGrid", true);
((CheckBox)ControlDictionary["snapToGridCheckBox"]).Checked = PropertyService.Get("FormsDesigner.DesignerOptions.SnapToGrid", true);
((RadioButton)ControlDictionary["snapToGridRadioButton"]).CheckedChanged += SnapToGridChanged;
EnableGridOptions(snapToGridOn);
} }
public override bool StorePanelContents() public override bool StorePanelContents()
@ -38,7 +43,7 @@ namespace ICSharpCode.FormsDesigner.Gui.OptionPanels
try { try {
width = Int32.Parse(ControlDictionary["widthTextBox"].Text); width = Int32.Parse(ControlDictionary["widthTextBox"].Text);
} catch { } catch {
MessageService.ShowError("Forms Designer grid with is invalid"); MessageService.ShowError("Forms Designer grid width is invalid");
return false; return false;
} }
@ -46,17 +51,31 @@ namespace ICSharpCode.FormsDesigner.Gui.OptionPanels
try { try {
height = Int32.Parse(ControlDictionary["heightTextBox"].Text); height = Int32.Parse(ControlDictionary["heightTextBox"].Text);
} catch { } catch {
MessageService.ShowError("Forms Designer height with is invalid"); MessageService.ShowError("Forms Designer grid height is invalid");
return false; return false;
} }
PropertyService.Set("FormsDesigner.DesignerOptions.SnapToGridMode", ((RadioButton)ControlDictionary["snapToGridRadioButton"]).Checked);
PropertyService.Set("FormsDesigner.DesignerOptions.GridSizeWidth", width); PropertyService.Set("FormsDesigner.DesignerOptions.GridSizeWidth", width);
PropertyService.Set("FormsDesigner.DesignerOptions.GridSizeHeight", height); PropertyService.Set("FormsDesigner.DesignerOptions.GridSizeHeight", height);
PropertyService.Set("FormsDesigner.DesignerOptions.UseSnapLines", ((RadioButton)ControlDictionary["snapLinesRadioButton"]).Checked);
PropertyService.Set("FormsDesigner.DesignerOptions.ShowGrid", ((CheckBox)ControlDictionary["showGridCheckBox"]).Checked); PropertyService.Set("FormsDesigner.DesignerOptions.ShowGrid", ((CheckBox)ControlDictionary["showGridCheckBox"]).Checked);
PropertyService.Set("FormsDesigner.DesignerOptions.SnapToGrid", ((CheckBox)ControlDictionary["snapToGridCheckBox"]).Checked); PropertyService.Set("FormsDesigner.DesignerOptions.SnapToGrid", ((CheckBox)ControlDictionary["snapToGridCheckBox"]).Checked);
PropertyService.Set("FormsDesigner.DesignerOptions.PropertyGridSortAlphabetical", ((CheckBox)ControlDictionary["sortAlphabeticalCheckBox"]).Checked);
return true; return true;
} }
void EnableGridOptions(bool snapToGridOn)
{
ControlDictionary["widthTextBox"].Enabled = snapToGridOn;
ControlDictionary["heightTextBox"].Enabled = snapToGridOn;
((CheckBox)ControlDictionary["showGridCheckBox"]).Enabled = snapToGridOn;
((CheckBox)ControlDictionary["snapToGridCheckBox"]).Enabled = snapToGridOn;
}
void SnapToGridChanged(object source, EventArgs e)
{
EnableGridOptions(((RadioButton)ControlDictionary["snapToGridRadioButton"]).Checked);
}
} }
} }

149
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/DesignerOptionService.cs

@ -16,61 +16,116 @@ namespace ICSharpCode.FormsDesigner.Services
{ {
public class SharpDevelopDesignerOptions : DesignerOptions public class SharpDevelopDesignerOptions : DesignerOptions
{ {
bool enableInSituEditing;
bool objectBoundSmartTagAutoShow;
bool useOptimizedCodeGeneration;
Size gridSize = Size.Empty;
bool showGrid;
bool snapToGrid;
bool useSnapLines;
bool useSmartTags;
public SharpDevelopDesignerOptions() public SharpDevelopDesignerOptions()
{ {
UseSmartTags = true; int w = PropertyService.Get("FormsDesigner.DesignerOptions.GridSizeWidth", 8);
UseSnapLines = true; int h = PropertyService.Get("FormsDesigner.DesignerOptions.GridSizeHeight", 8);
this.gridSize = new Size(w, h);
this.showGrid = PropertyService.Get("FormsDesigner.DesignerOptions.ShowGrid", true);
this.snapToGrid = PropertyService.Get("FormsDesigner.DesignerOptions.SnapToGrid", true);
this.useSmartTags = PropertyService.Get("FormsDesigner.DesignerOptions.UseSmartTags", false);
this.useSnapLines = PropertyService.Get("FormsDesigner.DesignerOptions.UseSnapLines", true);
this.enableInSituEditing = PropertyService.Get("FormsDesigner.DesignerOptions.EnableInSituEditing", true);
this.objectBoundSmartTagAutoShow = PropertyService.Get("FormsDesigner.DesignerOptions.ObjectBoundSmartTagAutoShow", true);
this.useOptimizedCodeGeneration = PropertyService.Get("FormsDesigner.DesignerOptions.UseOptimizedCodeGeneration", true);
}
// Obtains and shows the size of the standard design-mode grid square.
public override Size GridSize {
get {
return gridSize;
}
}
// Obtains and shows whether the design mode surface grid is enabled.
public override bool ShowGrid {
get {
return showGrid;
}
}
// Obtains and shows whether components should be aligned with the surface grid.
public override bool SnapToGrid {
get {
return snapToGrid;
}
} }
// public override Size GridSize { // Gets or sets a value that enables or disables smart tags in the designer.
// get { public override bool UseSmartTags {
// return new Size(PropertyService.Get("FormsDesigner.DesignerOptions.GridSizeWidth", 8), get {
// PropertyService.Get("FormsDesigner.DesignerOptions.GridSizeHeight", 8)); return useSmartTags;
// } }
// set { }
// LoggingService.Debug("GridSize set");
// PropertyService.Set("FormsDesigner.DesignerOptions.GridSizeWidth", value.Width); // Gets or sets a value that enables or disables snaplines in the designer.
// PropertyService.Set("FormsDesigner.DesignerOptions.GridSizeHeight", value.Height); public override bool UseSnapLines {
// } get {
// } return useSnapLines;
// }
// public override bool ShowGrid { }
// get {
// LoggingService.Debug("ShowGrid get"); // Gets or sets a value that enables or disables in-place editing for ToolStrip controls.
// return PropertyService.Get("FormsDesigner.DesignerOptions.ShowGrid", true); public override bool EnableInSituEditing {
// } get {
// set { return enableInSituEditing;
// LoggingService.Debug("ShowGrid set"); }
// PropertyService.Set("FormsDesigner.DesignerOptions.ShowGrid", value); }
// }
// } // Obtains and shows whether smart tags are automatically opened.
// public override bool ObjectBoundSmartTagAutoShow {
// public override bool SnapToGrid { get {
// get { return objectBoundSmartTagAutoShow;
// LoggingService.Debug("SnapToGrid get"); }
// return PropertyService.Get("FormsDesigner.DesignerOptions.SnapToGrid", true); }
// }
// set { // The component cache is a performance enhancement that is incompatible with certain designers.
// LoggingService.Debug("SnapToGrid set"); // You can disable it with this property
// } public override bool UseOptimizedCodeGeneration {
// } get {
return useOptimizedCodeGeneration;
}
}
} }
public class DesignerOptionService : WindowsFormsDesignerOptionService public class SharpDevelopDesignerOptionService : WindowsFormsDesignerOptionService
{ {
DesignerOptions options; public SharpDevelopDesignerOptionService()
public DesignerOptionService()
{ {
ApplySharpDevelopSettings();
} }
public override DesignerOptions CompatibilityOptions { void ApplySharpDevelopSettings()
get { {
if (options == null) { SharpDevelopDesignerOptions options = new SharpDevelopDesignerOptions();
options = new SharpDevelopDesignerOptions();
} this.Options.Properties.Find("GridSize", true).SetValue(this, options.GridSize);
return options; this.Options.Properties.Find("EnableInSituEditing", true).SetValue(this, options.EnableInSituEditing);
} this.Options.Properties.Find("ObjectBoundSmartTagAutoShow", true).SetValue(this, options.ObjectBoundSmartTagAutoShow);
this.Options.Properties.Find("UseOptimizedCodeGeneration", true).SetValue(this, options.UseOptimizedCodeGeneration);
this.Options.Properties.Find("UseSmartTags", true).SetValue(this, options.UseSmartTags);
this.Options.Properties.Find("UseSnapLines", true).SetValue(this, options.UseSnapLines);
if (options.UseSnapLines) {
this.Options.Properties.Find("ShowGrid", true).SetValue(this, false);
this.Options.Properties.Find("SnapToGrid", true).SetValue(this, false);
} else {
this.Options.Properties.Find("ShowGrid", true).SetValue(this, options.ShowGrid);
this.Options.Properties.Find("SnapToGrid", true).SetValue(this, options.SnapToGrid);
}
} }
} }
} }

BIN
src/Main/StartUp/Project/Resources/StringResources.resources

Binary file not shown.
Loading…
Cancel
Save