CMDOptions_SelectDebugLogDirectory = new ActionCommand ("...", () =>
{
FileDialog dlg = App.LoadIMLFragment<FileDialog> (@"
- <FileDialog Caption='Select Logs directory ' CurrentDirectory='{²DebugLogFileDirectory}'
- ShowFiles='false' ShowHidden='false' />");
+ <FileDialog Caption='Select Logs directory '
+ CurrentDirectory='{²DebugLogFileDirectory}'
+ SelectedFile='{²DebugLogFileName}'
+ ShowFiles='true' ShowHidden='false' />");
dlg.DataSource = this;
});
#region DesignInterface callbacks
//those methods are called by designed interface
+ public void ForceMousePosition() {
+ //todo: looks like having no effect
+ App.ForceMousePosition();
+ }
public void UpdateRootWidget(Type widgetType, object instance) {
GraphicTree = new List<ForeignWidgetContainer>([new ForeignWidgetContainer(widgetType, instance)]);
}
- void getMouseScreenCoordinates (out int x, out int y) {
- x = mouseScreenPos.X;
- y = mouseScreenPos.Y;
- }
IEnumerable<object> getStyling () {
if (App.CurrentProject is CERoslynPlugin.SolutionProject sol) {
if (sol.StartupProject is CERoslynPlugin.MSBuildProject csprj) {
if (CurrentState == Status.Running) {
try
{
- mouseScreenPos = _mouseScreenPos;//absolute on screen position.
+ mouseScreenPos = _mouseScreenPos;
//e.Handled = delMouseMove ((int)(e.X / ZoomFactor), (int)(e.Y / ZoomFactor));//DebugInterface local coordinate for mouse.
e.Handled = delMouseMove (e.X, e.Y);//DebugInterface local coordinate for mouse.
}
public object LogMutex = new object ();
IList<DbgEvent> events;
IList<DbgWidgetRecord> widgets;
- IList<DbgEvtType> recordedEvents = new ObservableList<DbgEvtType>(new DbgEvtType[] { DbgEvtType.Widget } );
+ IList<DbgEvtType> recordedEvents = new ObservableList<DbgEvtType>(new DbgEvtType[] { DbgEvtType.Widget, DbgEvtType.IFace } );
DbgEvtType evtTypeToAddForRecording = DbgEvtType.None, currentRecordedEvent = DbgEvtType.None;
public bool DebugLogIsEnabled {
get => debugLogIsEnabled;
NotifyValueChanged (value);
}
}
+ public string DebugLogFileName {
+ get => Configuration.Global.Get<string> ("DebugLogFileName", "crow.log");
+ set {
+ if (DebugLogFileName == value)
+ return;
+ Configuration.Global.Set ("DebugLogFileName", value);
+ NotifyValueChanged (value);
+ }
+ }
public bool DebugLogToFile {
get => Configuration.Global.Get<bool> (nameof(DebugLogToFile));
set {
DbgLogger.ConsoleOutput = !value;
}
}
+ public bool ManualDebugLogFileName {
+ get => Configuration.Global.Get<bool> (nameof(ManualDebugLogFileName));
+ set {
+ if (ManualDebugLogFileName == value)
+ return;
+ Configuration.Global.Set (nameof(ManualDebugLogFileName), value);
+ NotifyValueChanged(ManualDebugLogFileName);
+ }
+ }
public IList<DbgEvent> Events {
get => events;
return;
Recording = false;
if (DebugLogToFile) {
- string logfilepath = Path.Combine(DebugLogFileDirectory, $"crow-{DateTime.Now:yyyy-MM-dd_hh-mm}.log");
- using (FileStream stream = new FileStream(logfilepath, FileMode.CreateNew, FileAccess.Write)) {
+ string logfilepath = Path.Combine(DebugLogFileDirectory,
+ ManualDebugLogFileName ? DebugLogFileName : $"crow-{DateTime.Now:yyyy-MM-dd_hh-mm}.log");
+ using (FileStream stream = new FileStream(logfilepath, FileMode.Create, FileAccess.Write)) {
writeLog(stream);
+ //todo: should be notified in crowedit logs
MessageBox.ShowModal(App, MessageBox.Type.Information, $"Debug log saved to: {logfilepath}");
}
} else {
Action<Exception> delCrowServiceSetCurrentException;
Action<Type,object> delCrowServiceUpdateRootWidget;
Action<string> delCrowServiceSetCurrentDesignId, delCrowServiceSetHoverDesignId;
-
+ Action delCrowServiceForceMousePosition;
delegate void GetScreenCoordinateDelegateType(out int x, out int y);
- GetScreenCoordinateDelegateType delCrowServiceGetScreenCoordinate;
+ //GetScreenCoordinateDelegateType delCrowServiceGetScreenCoordinate;
Func<IEnumerable<object>> delCrowServiceGetStyling;
Func<string, Stream> delCrowServiceGetStreamFromPath;
FieldInfo fiWidget_design_id, fiPrivateContainer_child;
public void RegisterDebugInterfaceCallback (object crowService){
Type t = crowService.GetType();
- //delRegisterForRepaint = (Action)Delegate.CreateDelegate(typeof(Action), w, t.GetMethod("RegisterForRepaint"));
+ delCrowServiceForceMousePosition = (Action)Delegate.CreateDelegate(typeof(Action), crowService,
+ t.GetMethod("ForceMousePosition"));
delCrowServiceSetCurrentException = (Action<Exception>)Delegate.CreateDelegate(typeof(Action<Exception>), crowService,
t.GetProperty("CurrentException").GetSetMethod(true));
delCrowServiceSetCurrentDesignId = (Action<string>)Delegate.CreateDelegate(typeof(Action<string>), crowService,
delCrowServiceUpdateRootWidget = (Action<Type,object>)Delegate.CreateDelegate(typeof(Action<Type,object>), crowService,
t.GetMethod("UpdateRootWidget"));
- delCrowServiceGetScreenCoordinate = (GetScreenCoordinateDelegateType)Delegate.CreateDelegate(typeof(GetScreenCoordinateDelegateType), crowService,
- t.GetMethod("getMouseScreenCoordinates", BindingFlags.Instance | BindingFlags.NonPublic));
+ /*delCrowServiceGetScreenCoordinate = (GetScreenCoordinateDelegateType)Delegate.CreateDelegate(typeof(GetScreenCoordinateDelegateType), crowService,
+ t.GetMethod("getMouseScreenCoordinates", BindingFlags.Instance | BindingFlags.NonPublic));*/
delCrowServiceGetStyling = (Func<IEnumerable<object>>)Delegate.CreateDelegate (typeof (Func<IEnumerable<object>>), crowService,
t.GetMethod ("getStyling", BindingFlags.Instance | BindingFlags.NonPublic));
delCrowServiceGetStreamFromPath = (Func<string, Stream>)Delegate.CreateDelegate (typeof (Func<string, Stream>), crowService,
}
public override bool OnMouseMove(int x, int y)
{
- int deltaX = x - base.MousePosition.X;
- int deltaY = y - base.MousePosition.Y;
-
- MousePosition = new Point(x,y);
- MouseMoveEventArgs e = new MouseMoveEventArgs (x, y, deltaX, deltaY);
-
if (Edition) {
+ int deltaX = x - base.MousePosition.X;
+ int deltaY = y - base.MousePosition.Y;
+
+ MousePosition = new Point(x,y);
+ MouseMoveEventArgs e = new MouseMoveEventArgs (x, y, deltaX, deltaY);
+
if (editHoverWidget != null) {
//check topmost graphicobject first
Widget topContainer = editHoverWidget;
}
editHoverWidget = null;
return false;
- } else
- return base.OnMouseMove(x, y);
+ }
+ return base.OnMouseMove(x, y);
}
public override bool OnMouseButtonDown(MouseButton button)
{
public override void ForceMousePosition()
{
- delCrowServiceGetScreenCoordinate(out int x, out int y);
- Glfw.Glfw3.SetCursorPosition (WindowHandle, x, y);
+ //delCrowServiceGetScreenCoordinate(out int x, out int y);
+ //Debug.WriteLine($"force mouse position: {x},{y}");
+ //Glfw.Glfw3.SetCursorPosition (WindowHandle, x, y);
+ delCrowServiceForceMousePosition();
}
public bool OnKeyDown (Glfw.Key key, int scancode, Glfw.Modifier modifiers) {
public void LockRenderMutex() => Monitor.Enter(this.UpdateMutex);
public void UnlockRenderMutex() => Monitor.Exit(this.UpdateMutex);
+
+
+ /*protected override void processDrawing(IContext ctx)
+ {
+ base.processDrawing(ctx);
+
+ ctx.Arc(MousePosition, 2, 0, Math.PI * 2.0);
+ ctx.SetSource(Colors.DarkRed);
+ ctx.Fill();
+ }*/
}
}
\ No newline at end of file
public override void onKeyDown(object sender, KeyEventArgs e) => crowIFaceService?.onKeyDown(e);
public override void onKeyUp(object sender, KeyEventArgs e) => crowIFaceService?.onKeyUp(e);
public override void onKeyPress(object sender, KeyPressEventArgs e) => crowIFaceService?.onKeyPress(e);
+ Point localMousePos;
public override void onMouseMove(object sender, MouseMoveEventArgs e) {
Point m = ScreenPointToLocal (e.Position);
- crowIFaceService?.onMouseMove(e.Position, new MouseMoveEventArgs(m.X,m.Y, e.XDelta, e.YDelta));
+ localMousePos = m;
+ //Debug.WriteLine($"local mouse position: {m}");
+ crowIFaceService?.onMouseMove(e.Position, new MouseMoveEventArgs (m.X, m.Y, e.XDelta, e.YDelta));
}
public override void onMouseDown(object sender, MouseButtonEventArgs e) => crowIFaceService?.onMouseDown(e);
public override void onMouseUp(object sender, MouseButtonEventArgs e) => crowIFaceService?.onMouseUp(e);
if (crowIFaceService != null && crowIFaceService.IsRunning && bmp != null) {
//crowIFaceService.LockRenderMutex();
paintCache (ctx, Slot + Parent.ClientRectangle.Position);
+
if (crowIFaceService.EditMode) {
if (hoverWidget != null && hoverWidget != currentWidget) {
//currentWidget.
// ctx.Stroke();
//ctx.SetDash([0]);
}
+ /*ctx.LineWidth = 1;
+ ctx.Arc(localMousePos, 3, 0, Math.PI * 2.0);
+ ctx.SetSource(Colors.Yellow);
+ ctx.Stroke();*/
}
+
//crowIFaceService.UnlockRenderMutex();
crowIFaceService.ResetDirtyState ();
}
}
}
+ public override MouseCursor MouseCursor {
+ get => base.MouseCursor;
+ set {
+ Console.WriteLine("set mouse cursor");
+ }
+ }
protected override void Dispose(bool disposing)
{
CMDRefresh?.Dispose ();
<?xml version="1.0"?>
-<DockWindow Caption="Crow Preview Configuration" Width="400" Height="400">
+<DockWindow Caption="Crow Preview Configuration" Width="800" Height="800">
<VerticalStack RootDataLevel="true" Margin="5">
- <HorizontalStack Height="Fit" Margin="5">
- <Label Text="Crow Service" Width="Stretched"/>
- <ListBox Data="{Commands}" Fit="true">
- <Template>
- <HorizontalStack Name="ItemsContainer" />
- </Template>
- <ItemTemplate Path="#ui.IconCommand.itmp"/>
- </ListBox>
- </HorizontalStack>
- <GroupBox Caption="In design Crow Assembly" Height="Fit">
- <VerticalStack>
- <HorizontalStack Height="Fit" Spacing="5">
- <Label Fit="true" Text="Assembly Path:"/>
- <TextBox Height="Fit" Text="{²CrowDbgAssemblyLocation}" Margin="2"/>
- <Image Width="30" Height="20" Path="#Crow.Icons.IconAlerte.svg" Visible="{ServiceIsInError}"/>
- <Button Command="{CMDOptions_SelectCrowAssemblyLocation}" MinimumSize="0,0"/>
- </HorizontalStack>
- <HorizontalStack Height="Fit" Spacing="5">
- <Label Fit="true" Text="Assembly Name:"/>
- <Label Fit="true" Text="{CrowAssemblyName}"/>
- </HorizontalStack>
- <HorizontalStack Height="Fit" Spacing="5">
- <CheckBox Style="StateBox" Caption="Design mode is enabled" IsChecked="{DesignModeEnabled}"/>
- <CheckBox Style="StateBox" Caption="Debug logger is enabled" IsChecked="{DebugLogIsEnabled}"/>
- </HorizontalStack>
- </VerticalStack>
- </GroupBox>
- <Label Background="Red" Foreground="White" Margin="5" Width="Stretched" Text="{ServiceErrorMessage}"
- IsVisible="{ServiceIsInError}"/>
- <ListBox Style="ScrollingListBox" Data="{CrowAssemblies}" MinimumSize="100,200" SelectedItem="{²SelectedCrowAssembly}"/>
- <HorizontalStack Height="Fit" Width="Fit" HorizontalAlignment="Right">
- <Button Command="{CMDOptions_AddCrowAssembly}"/>
- <Button Command="{CMDOptions_RemoveCrowAssembly}"/>
- </HorizontalStack>
- <Spinner Caption="Zoom Factor" Value="{²ZoomFactor}" Minimum="0.2" Maximum="4.0" SmallIncrement="0.1" LargeIncrement="0.2"/>
- <Spinner Caption="Refresh Rate (ms)" Value="{²RefreshRate}" Maximum="1000"/>
- <Spinner Caption="Max Layout Try" Value="{²MaxLayoutingTries}" Maximum="1000"/>
- <Spinner Caption="Max Layout Discard" Value="{²MaxDiscardCount}" Maximum="1000"/>
+ <!--<Expandable Caption="Crow Service Configuration" Width="Stretched">-->
+ <HorizontalStack Height="Fit" Margin="5">
+ <Label Text="Crow Service" Width="Stretched"/>
+ <ListBox Data="{Commands}" Fit="true">
+ <Template>
+ <HorizontalStack Name="ItemsContainer" />
+ </Template>
+ <ItemTemplate Path="#ui.IconCommand.itmp"/>
+ </ListBox>
+ </HorizontalStack>
+ <GroupBox Caption="In design Crow Assembly" Height="Fit">
+ <VerticalStack>
+ <HorizontalStack Height="Fit" Spacing="5">
+ <Label Fit="true" Text="Assembly Path:"/>
+ <TextBox Height="Fit" Text="{²CrowDbgAssemblyLocation}" Margin="2"/>
+ <Image Width="30" Height="20" Path="#Crow.Icons.IconAlerte.svg" Visible="{ServiceIsInError}"/>
+ <Button Command="{CMDOptions_SelectCrowAssemblyLocation}" MinimumSize="0,0"/>
+ </HorizontalStack>
+ <HorizontalStack Height="Fit" Spacing="5">
+ <Label Fit="true" Text="Assembly Name:"/>
+ <Label Fit="true" Text="{CrowAssemblyName}"/>
+ </HorizontalStack>
+ <HorizontalStack Height="Fit" Spacing="5">
+ <CheckBox Style="StateBox" Caption="Design mode is enabled" IsChecked="{DesignModeEnabled}"/>
+ <CheckBox Style="StateBox" Caption="Debug logger is enabled" IsChecked="{DebugLogIsEnabled}"/>
+ </HorizontalStack>
+ </VerticalStack>
+ </GroupBox>
+ <Label Background="Red" Foreground="White" Margin="5" Width="Stretched" Text="{ServiceErrorMessage}"
+ IsVisible="{ServiceIsInError}"/>
+ <ListBox Style="ScrollingListBox" Data="{CrowAssemblies}" MinimumSize="100,200" SelectedItem="{²SelectedCrowAssembly}" Height="100"/>
+ <HorizontalStack Height="Fit" Width="Fit" HorizontalAlignment="Right">
+ <Button Command="{CMDOptions_AddCrowAssembly}"/>
+ <Button Command="{CMDOptions_RemoveCrowAssembly}"/>
+ </HorizontalStack>
+ <!--</Expandable>
+ <Expandable Caption="Debug Interface Options" Width="Stretched">-->
+ <Spinner Caption="Zoom Factor" Value="{²ZoomFactor}" Minimum="0.2" Maximum="4.0" SmallIncrement="0.1" LargeIncrement="0.2"/>
+ <Spinner Caption="Refresh Rate (ms)" Value="{²RefreshRate}" Maximum="1000"/>
+ <Spinner Caption="Max Layout Try" Value="{²MaxLayoutingTries}" Maximum="1000"/>
+ <Spinner Caption="Max Layout Discard" Value="{²MaxDiscardCount}" Maximum="1000"/>
+ <!--</Expandable>-->
<GroupBox Caption="Debug Logger" IsEnabled="{DebugLogIsEnabled}" Height="40%">
<HorizontalStack Margin="4">
<ListBox Data="{RecordedEvents}" SelectedItem="{²CurrentRecordedEvent}"/>
<TextBox Text="{²DebugLogFileDirectory}" />
<Button Command="{CMDOptions_SelectDebugLogDirectory}" MinimumSize="0,0"/>
</HorizontalStack>
+ <CheckBox Name="cbFileName" Caption="Fixed Log Name" IsChecked="{²ManualDebugLogFileName}" Background="Onyx"/>
+ <HorizontalStack Height="Fit" Width="Stretched" IsEnabled="{../cbFileName.IsChecked}" Background="Onyx" Margin="5">
+ <Label Text="Debug log file name:" Fit="true"/>
+ <TextBox Text="{²DebugLogFileName}" />
+ </HorizontalStack>
<Label Text="{CurrentRecordedEvent}"/>
<EnumSelector RadioButtonStyle="CheckBoxEvtType" Template="#CECrowPlugin.ui.EnumSelector.template" Width="Stretched"
Caption="Event Type to add for recording:" EnumValue="{²EvtTypeToAddForRecording}" />