4 changed files with 162 additions and 1 deletions
@ -0,0 +1,52 @@
@@ -0,0 +1,52 @@
|
||||
<gui:OptionPanel x:Class="ICSharpCode.FormsDesigner.Gui.OptionPanels.GridOptionsPanelXAML" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:sd="http://icsharpcode.net/sharpdevelop/core" |
||||
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"> |
||||
|
||||
<StackPanel> |
||||
|
||||
<GroupBox Margin="0,10,0,0" |
||||
Header="{sd:Localize ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.SnapModeGroupBox}"> |
||||
<widgets:StackPanelWithSpacing SpaceBetweenItems="15"> |
||||
<RadioButton x:Name="snapToGridRadioButton" |
||||
Checked="SnapToGridRadioButton_Checked" |
||||
|
||||
Content="{sd:Localize ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.SnapToGridRadioButton}"></RadioButton> |
||||
<RadioButton x:Name="snapLinesRadioButton" |
||||
Checked="SnapLinesRadioButton_Checked" |
||||
Content="{sd:Localize ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.SnapLinesRadioButton}"></RadioButton> |
||||
</widgets:StackPanelWithSpacing> |
||||
</GroupBox> |
||||
|
||||
<GroupBox Header="{sd:Localize ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.GridPropertiesGroupBox}"> |
||||
<widgets:StackPanelWithSpacing SpaceBetweenItems="15"> |
||||
<Grid Margin="40,5,30,0"> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition></RowDefinition> |
||||
<RowDefinition></RowDefinition> |
||||
</Grid.RowDefinitions> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition></ColumnDefinition> |
||||
<ColumnDefinition></ColumnDefinition> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<TextBlock Text="{sd:Localize ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.WidthLabel}"></TextBlock> |
||||
<TextBox x:Name="widthTextBox" Margin="0,0,0,30" IsEnabled="False" Grid.Column="1" ></TextBox> |
||||
|
||||
<TextBlock Grid.Row="1" |
||||
Text="{sd:Localize ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.HeightLabel}"></TextBlock> |
||||
|
||||
<TextBox x:Name="heightTextBox" Margin="0,0,0,30" |
||||
IsEnabled="False" Grid.Row="1" Grid.Column="1" ></TextBox> |
||||
</Grid> |
||||
|
||||
<CheckBox IsEnabled="False" x:Name="showGridCheckBox" |
||||
Content="{sd:Localize ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.ShowGridComboBox}"></CheckBox> |
||||
<CheckBox IsEnabled="False" x:Name="snapToGridCheckBox" |
||||
Content="{sd:Localize ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.SnapToGridRadioButton}"></CheckBox> |
||||
</widgets:StackPanelWithSpacing> |
||||
</GroupBox> |
||||
</StackPanel> |
||||
</gui:OptionPanel> |
@ -0,0 +1,98 @@
@@ -0,0 +1,98 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 29.02.2012 |
||||
* Time: 20:20 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Text; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Data; |
||||
using System.Windows.Documents; |
||||
using System.Windows.Input; |
||||
using System.Windows.Media; |
||||
using System.ComponentModel.Design.Serialization; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
|
||||
namespace ICSharpCode.FormsDesigner.Gui.OptionPanels |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for GridOptrionsXAML.xaml
|
||||
/// </summary>
|
||||
public partial class GridOptionsPanelXAML : OptionPanel |
||||
{ |
||||
public GridOptionsPanelXAML() |
||||
{ |
||||
InitializeComponent(); |
||||
bool snapToGridOn = PropertyService.Get("FormsDesigner.DesignerOptions.SnapToGridMode", false); |
||||
|
||||
this.snapToGridRadioButton.IsChecked = snapToGridOn; |
||||
this.snapLinesRadioButton.IsChecked = !snapToGridOn; |
||||
|
||||
this.widthTextBox.Text = PropertyService.Get("FormsDesigner.DesignerOptions.GridSizeWidth", 8).ToString(); |
||||
this.heightTextBox.Text = PropertyService.Get("FormsDesigner.DesignerOptions.GridSizeHeight", 8).ToString(); |
||||
|
||||
|
||||
this.showGridCheckBox.IsChecked = PropertyService.Get("FormsDesigner.DesignerOptions.ShowGrid", true); |
||||
this.snapToGridCheckBox.IsChecked = PropertyService.Get("FormsDesigner.DesignerOptions.SnapToGrid", true); |
||||
EnableGridOptions(snapToGridOn); |
||||
} |
||||
|
||||
|
||||
public override bool SaveOptions() |
||||
{ |
||||
|
||||
PropertyService.Set("FormsDesigner.DesignerOptions.SnapToGridMode", this.snapToGridCheckBox.IsChecked); |
||||
PropertyService.Set("FormsDesigner.DesignerOptions.UseSnapLines", this.snapLinesRadioButton.IsChecked); |
||||
PropertyService.Set("FormsDesigner.DesignerOptions.ShowGrid", this.showGridCheckBox.IsChecked); |
||||
PropertyService.Set("FormsDesigner.DesignerOptions.SnapToGrid", this.snapToGridRadioButton.IsChecked); |
||||
|
||||
int width; |
||||
|
||||
bool result = Int32.TryParse(this.widthTextBox.Text, out width); |
||||
|
||||
if (result) { |
||||
PropertyService.Set("FormsDesigner.DesignerOptions.GridSizeWidth", width); |
||||
} else { |
||||
MessageService.ShowError("Forms Designer grid width is invalid"); |
||||
return false; |
||||
} |
||||
|
||||
int height = 0; |
||||
result = Int32.TryParse(this.heightTextBox.Text, out height); |
||||
if (result) { |
||||
PropertyService.Set("FormsDesigner.DesignerOptions.GridSizeHeight", height); |
||||
}else { |
||||
MessageService.ShowError("Forms Designer grid height is invalid"); |
||||
return false; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
|
||||
void EnableGridOptions (bool enable) |
||||
{ |
||||
this.widthTextBox.IsEnabled = enable; |
||||
this.heightTextBox.IsEnabled = enable; |
||||
this.showGridCheckBox.IsEnabled = enable; |
||||
this.snapToGridCheckBox.IsEnabled = enable; |
||||
} |
||||
|
||||
|
||||
void SnapToGridRadioButton_Checked(object sender, RoutedEventArgs e) |
||||
{ |
||||
EnableGridOptions(true); |
||||
} |
||||
|
||||
void SnapLinesRadioButton_Checked(object sender, RoutedEventArgs e) |
||||
{ |
||||
EnableGridOptions(false); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue