Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove TextEditor.HideScrollBar() and expose {Horizontal,Vertical}Scr…

…ollBarVisibility properties instead.

Made some improvements to WatchInputBox.
  • Loading branch information...
commit 4ef89926d0e11fb03a4480b4cddc5e1e9de3cbe9 1 parent a351d20
@dgrunwald dgrunwald authored
View
48 src/AddIns/Debugger/Debugger.AddIn/Pads/WatchInputBox.xaml
@@ -1,41 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<src:BaseWatchBox
- x:Class="Debugger.AddIn.Pads.WatchInputBox" xmlns:src="clr-namespace:ICSharpCode.SharpDevelop.Gui.Pads;assembly=ICSharpCode.SharpDevelop" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- ShowInTaskbar="False"
+ x:Class="Debugger.AddIn.Pads.WatchInputBox" xmlns:src="clr-namespace:ICSharpCode.SharpDevelop.Gui.Pads;assembly=ICSharpCode.SharpDevelop" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:core="http://icsharpcode.net/sharpdevelop/core" xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"
+ Style="{x:Static core:GlobalStyles.DialogWindowStyle}"
WindowStartupLocation="CenterScreen"
WindowState="Normal"
WindowStyle="ToolWindow"
- Height="75"
- Width="271"
- ResizeMode="NoResize"
- Background="LightGray">
- <Grid
- Height="50"
- VerticalAlignment="Top">
- <Grid.RowDefinitions>
- <RowDefinition
- Height="23" />
- <RowDefinition
- Height="24" />
- </Grid.RowDefinitions>
- <DockPanel
- VerticalAlignment="Top"
- Name="ConsolePanel" />
- <DockPanel
- VerticalAlignment="Bottom"
+ Width="300"
+ SizeToContent="Height"
+ ResizeMode="NoResize">
+ <DockPanel Margin="4">
+ <widgets:UniformGridWithSpacing
+ Columns="2"
+ DockPanel.Dock="Bottom"
+ Margin="0,8"
Grid.Row="1"
HorizontalAlignment="Center">
<Button
Name="AcceptButton"
- Width="100"
- Content="Accept"
+ Style="{x:Static core:GlobalStyles.ButtonStyle}"
+ Content="{core:Localize Global.OKButtonText}"
Click="AcceptButton_Click"
IsDefault="True" />
<Button
Name="CancelButton"
- Width="100"
- Content="Cancel"
- Click="CancelButton_Click" />
- </DockPanel>
- </Grid>
+ Style="{x:Static core:GlobalStyles.ButtonStyle}"
+ Content="{core:Localize Global.CancelButtonText}"
+ Click="CancelButton_Click"
+ IsCancel="True" />
+ </widgets:UniformGridWithSpacing>
+ <ContentPresenter
+ MaxHeight="75"
+ Name="ConsolePanel" />
+ </DockPanel>
</src:BaseWatchBox>
View
4 src/AddIns/Debugger/Debugger.AddIn/Pads/WatchInputBox.xaml.cs
@@ -28,9 +28,7 @@ public WatchInputBox(string text, string caption) : base()
// UI
text = StringParser.Parse(text);
this.Title = StringParser.Parse(caption);
- AcceptButton.Content = StringParser.Parse("${res:Global.OKButtonText}");
- CancelButton.Content = StringParser.Parse("${res:Global.CancelButtonText}");
- this.ConsolePanel.Children.Add(console);
+ this.ConsolePanel.Content = console;
// FIXME: for testing only
var language = LanguageProperties.CSharp;
View
2  src/AddIns/Debugger/Debugger.AddIn/Pads/WatchPadCommands.cs
@@ -27,7 +27,7 @@ public override void Run()
var inputWindow = new WatchInputBox(StringParser.Parse("${res:MainWindow.Windows.Debug.Watch.AddWatch}"),
StringParser.Parse("${res:MainWindow.Windows.Debug.Watch.EnterExpression}"));
-
+ inputWindow.Owner = ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainWindow;
var result = inputWindow.ShowDialog();
if (!result.HasValue || !result.Value)
return;
View
4 src/AddIns/DisplayBindings/AvalonEdit.AddIn/themes/generic.xaml
@@ -14,8 +14,8 @@
Name="PART_ScrollViewer"
MouseWheelZoom="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Options.MouseWheelZoom}"
CanContentScroll="True"
- VerticalScrollBarVisibility="Visible"
- HorizontalScrollBarVisibility="Visible"
+ VerticalScrollBarVisibility="{TemplateBinding VerticalScrollBarVisibility}"
+ HorizontalScrollBarVisibility="{TemplateBinding HorizontalScrollBarVisibility}"
Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TextArea}"
VerticalContentAlignment="Top"
HorizontalContentAlignment="Left"
View
41 src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.cs
@@ -355,6 +355,10 @@ protected virtual IVisualLineTransformer CreateColorizer(IHighlightingDefinition
/// <summary>
/// Specifies whether the text editor uses word wrapping.
/// </summary>
+ /// <remarks>
+ /// Setting WordWrap=true has the same effect as setting HorizontalScrollBarVisibility=Disabled and will override the
+ /// HorizontalScrollBarVisibility setting.
+ /// </remarks>
public bool WordWrap {
get { return (bool)GetValue(WordWrapProperty); }
set { SetValue(WordWrapProperty, Boxes.Box(value)); }
@@ -997,6 +1001,34 @@ public void Save(string fileName)
}
#endregion
+ #region ScrollBarVisibility
+ /// <summary>
+ /// Dependency property for <see cref="HorizontalScrollBarVisibility"/>
+ /// </summary>
+ public static readonly DependencyProperty HorizontalScrollBarVisibilityProperty = ScrollViewer.HorizontalScrollBarVisibilityProperty.AddOwner(typeof(TextEditor), new FrameworkPropertyMetadata(ScrollBarVisibility.Visible));
+
+ /// <summary>
+ /// Gets/Sets the horizontal scroll bar visibility.
+ /// </summary>
+ public ScrollBarVisibility HorizontalScrollBarVisibility {
+ get { return (ScrollBarVisibility)GetValue(HorizontalScrollBarVisibilityProperty); }
+ set { SetValue(HorizontalScrollBarVisibilityProperty, value); }
+ }
+
+ /// <summary>
+ /// Dependency property for <see cref="VerticalScrollBarVisibility"/>
+ /// </summary>
+ public static readonly DependencyProperty VerticalScrollBarVisibilityProperty = ScrollViewer.VerticalScrollBarVisibilityProperty.AddOwner(typeof(TextEditor), new FrameworkPropertyMetadata(ScrollBarVisibility.Visible));
+
+ /// <summary>
+ /// Gets/Sets the vertical scroll bar visibility.
+ /// </summary>
+ public ScrollBarVisibility VerticalScrollBarVisibility {
+ get { return (ScrollBarVisibility)GetValue(VerticalScrollBarVisibilityProperty); }
+ set { SetValue(VerticalScrollBarVisibilityProperty, value); }
+ }
+ #endregion
+
object IServiceProvider.GetService(Type serviceType)
{
return textArea.GetService(serviceType);
@@ -1051,14 +1083,5 @@ public void ScrollTo(int line, int column)
}
}
}
-
- /// <summary>
- /// Hides the scroll viewer.
- /// </summary>
- public void HideScrollBar()
- {
- scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
- scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
- }
}
}
View
4 src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.xaml
@@ -13,8 +13,8 @@
Focusable="False"
Name="PART_ScrollViewer"
CanContentScroll="True"
- VerticalScrollBarVisibility="Visible"
- HorizontalScrollBarVisibility="Visible"
+ VerticalScrollBarVisibility="{TemplateBinding VerticalScrollBarVisibility}"
+ HorizontalScrollBarVisibility="{TemplateBinding HorizontalScrollBarVisibility}"
Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TextArea}"
VerticalContentAlignment="Top"
HorizontalContentAlignment="Left"
View
7 src/Main/Base/Project/Src/Gui/Pads/BaseWatchBox.cs
@@ -3,6 +3,7 @@
using System;
using System.Windows;
+using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using ICSharpCode.AvalonEdit;
@@ -35,9 +36,9 @@ public BaseWatchBox()
};
// hide scroll bar
- this.console.editor.ApplyTemplate();
- this.console.editor.HideScrollBar();
- this.console.editor.TextArea.Focus();
+ this.console.editor.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
+ this.console.editor.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
+ this.Loaded += delegate { this.console.editor.TextArea.Focus(); };
}
protected virtual void AbstractConsolePadTextEntered(object sender, TextCompositionEventArgs e)
Please sign in to comment.
Something went wrong with that request. Please try again.