IsOpened ="true" Visible="{/IsOpened}" Background="Red">
<Template>
<HorizontalStack>
- <Border Background="DimGrey" Foreground="DimGrey" CornerRadius="5">
- <GenericStack Orientation="{./Orientation}" Name="ItemsContainer"
- Margin="2"/>
+ <Border Background="DarkGrey" Foreground="Black" CornerRadius="0">
+ <GenericStack Orientation="{./Orientation}" Name="ItemsContainer" Margin="2"/>
</Border>
</HorizontalStack>
</Template>
IsPopped="{²./IsOpened}" PopWidth="{./PopWidth}" PopHeight="{./PopHeight}">
<Template>
<Border Name="border1"
- CornerRadius="2"
+ CornerRadius="0"
MouseEnter="{Foreground=vgradient|0:White|0.2:Grey|0.9:Grey|1:Black}"
MouseLeave="{Foreground=Transparent}"
MouseDown="{Foreground=vgradient|0:Black|0.05:Grey|0.85:Grey|1:White}"
Background="{./Background}">
<Label Text="{./Caption}"
Foreground="{./Foreground}"
- Margin="3" HorizontalAlignment="Left"
+ Margin="1" HorizontalAlignment="Left"
Font="{./Font}" />
</Border>
</Template>
Column = column;
VisualCharXPosition = visualX;
}
- public bool HasVisualX => Column >= 0 && VisualCharXPosition >= 0;
+ public bool HasVisualX => Column >= 0 && VisualCharXPosition >= 0;
public void ResetVisualX () => VisualCharXPosition = -1;
public static bool operator == (CharLocation a, CharLocation b)
=> a.Equals (b);
return;
currentLoc = value;
NotifyValueChanged ("CurrentLine", CurrentLine);
- NotifyValueChanged ("CurrentCollumn", CurrentColumn);
+ NotifyValueChanged ("CurrentColumn", CurrentColumn);
}
}
public int CurrentLine {
/// </summary>
/// <param name="position">Absolute character position in text.</param>
public void SetCursorPosition (int position) {
- CurrentLoc = lines.GetLocation (position);
+ CharLocation loc = lines.GetLocation (position);
+ loc.Column = Math.Min (loc.Column, lines[loc.Line].Length);
+ CurrentLoc = loc;
}
protected LineCollection lines;
bool selectionNotEmpty = false;
if (HasFocus) {
- updateLocation (gr, cb.Width, ref currentLoc);
+ if (currentLoc?.Column < 0) {
+ updateLocation (gr, cb.Width, ref currentLoc);
+ NotifyValueChanged ("CurrentColumn", CurrentColumn);
+ } else
+ updateLocation (gr, cb.Width, ref currentLoc);
if (selectionStart.HasValue) {
updateLocation (gr, cb.Width, ref selectionStart);
if (CurrentLoc.Value != selectionStart.Value)
ctx.SetFontSize (Font.Size);
ctx.FontOptions = Interface.FontRenderingOptions;
ctx.Antialias = Interface.Antialias;
- lock (linesMutex)
- updateLocation (ctx, ClientRectangle.Width, ref currentLoc);
+ lock (linesMutex) {
+ if (currentLoc?.Column < 0) {
+ updateLocation (ctx, ClientRectangle.Width, ref currentLoc);
+ NotifyValueChanged ("CurrentColumn", CurrentColumn);
+ } else
+ updateLocation (ctx, ClientRectangle.Width, ref currentLoc);
+ }
textCursor = null;
}
isVisible = value;
- RegisterForLayouting (LayoutingType.Sizing);
-
- if (!isVisible && IFace.HoverWidget != null) {
- if (IFace.HoverWidget.IsOrIsInside (this)) {
- //IFace.HoverWidget = null;
- IFace.OnMouseMove (IFace.MousePosition.X, IFace.MousePosition.Y);
- }
- }
+ if (Visible)
+ RegisterForLayouting (LayoutingType.Sizing);
+ else
+ unshownPostActions ();
NotifyValueChangedAuto (isVisible);
}
}
if (IFace.HoverWidget != null) {
if (IFace.HoverWidget.IsOrIsInside (this)) {
+ Widget w = IFace.HoverWidget;
+ MouseMoveEventArgs e = new MouseMoveEventArgs (IFace.MousePosition.X, IFace.MousePosition.Y, 0, 0);
+ while (w != this) {
+ w.onMouseLeave (this, e);
+ w = w.FocusParent;
+ }
+ this.onMouseLeave (this, e);
IFace.HoverWidget = null;
IFace.OnMouseMove (IFace.MousePosition.X, IFace.MousePosition.Y);
}
<Authors>Jean-Philippe Bruyère</Authors>
<LangVersion>7.3</LangVersion>
- <CrowVersion>0.9.3</CrowVersion>
+ <CrowVersion>0.9.4</CrowVersion>
<CrowPackageVersion>$(CrowVersion)-beta</CrowPackageVersion>
<CrowStbSharp>true</CrowStbSharp>
</PropertyGroup>
public static Picture IcoPaste = new SvgPicture ("#Icons.paste-on-document.svg");
public Command CMDNew, CMDSave, CMDSaveAs, CMDUndo, CMDRedo, CMDCut, CMDCopy, CMDPaste;
-
+ public CommandGroup ContextCommands => new CommandGroup (CMDNew, CMDSave, CMDSaveAs);
void initCommands ()
{
CMDNew = new Command (new Action (onNewFile)) { Caption = "New", Icon = "#Icons.blank-file.svg", CanExecute = true };
<Button Style="IcoButton" Command="{CMDNew}" />
<Button Style="IcoButton" Command="{CMDSave}" />
<Button Style="IcoButton" Command="{CMDSaveAs}" />
+ <Widget Width="Stretched"/>
+ <Label Text="Line:" Foreground="Grey"/>
+ <Label Text="{../../tb.CurrentLine}" Margin="2"/>
+ <Label Text="Col:" Foreground="Grey"/>
+ <Label Text="{../../tb.CurrentColumn}" Margin="2"/>
</HorizontalStack>
<HorizontalStack>
- <TextBox Name="tb" Text="{²Source}" Multiline="true" Font="consolas, 12" Focusable="true" Height="Stretched" Width="Stretched" />
+ <TextBox Name="tb" Text="{²Source}" Multiline="true" Font="consolas, 12" Focusable="true" Height="Stretched" Width="Stretched"
+ ContextCommands="{ContextCommands}"/>
<ScrollBar Value="{²../tb.ScrollY}"
LargeIncrement="{../tb.PageHeight}" SmallIncrement="1"
CursorRatio="{../tb.ChildHeightRatio}" Maximum="{../tb.MaxScrollY}" />