diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-04-15 15:18:19 +0200 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-04-15 15:18:19 +0200 |
| commit | b0ceb4f3b5f812d9577a8a1caa8e07e304c50432 (patch) | |
| tree | 4b2a4025f99605d643037a88babbab0223aba521 /Samples | |
| parent | 5b2f9d9b576f1009704d6d72a082c5b125699bcc (diff) | |
debug ObservableList, new Table widget
Diffstat (limited to 'Samples')
| -rw-r--r-- | Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs | 47 | ||||
| -rw-r--r-- | Samples/DebugLogAnalyzer/src/Program.cs | 37 | ||||
| -rw-r--r-- | Samples/DebugLogAnalyzer/ui/main.crow | 13 | ||||
| -rw-r--r-- | Samples/common/ui/Interfaces/Experimental/colorTable.crow | 12 | ||||
| -rw-r--r-- | Samples/common/ui/Interfaces/Experimental/table2.crow | 38 |
5 files changed, 84 insertions, 63 deletions
diff --git a/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs b/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs index c6920ca5..2dba0601 100644 --- a/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs +++ b/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs @@ -47,7 +47,9 @@ namespace Crow public CommandGroup LoggerCommands => new CommandGroup( new Command("Get logs", () => getLog ()), - new Command("Reset logs", () => delResetDebugger ()) + new Command("Reset logs", () => delResetDebugger ()), + new Command("Save to file", () => saveLogToDebugLogFilePath ()), + new Command("Load from file", () => loadLogFromDebugLogFilePath ()) ); public string IMLSource { get => imlSource; @@ -128,7 +130,42 @@ namespace Crow NotifyValueChangedAuto (DebugLogToFile); } } + public string DebugLogFilePath { + get => Configuration.Global.Get<string> ("DebugLogFilePath"); + set { + if (DebugLogFilePath == value) + return; + Configuration.Global.Set ("DebugLogFilePath", value); + NotifyValueChangedAuto (value); + } + } + int firstWidgetIndexToSave, lastWidgetIndexToSave; + public int FirstWidgetIndexToSave { + get => firstWidgetIndexToSave; + set { + if (firstWidgetIndexToSave == value) + return; + if (value > lastWidgetIndexToSave) + firstWidgetIndexToSave = lastWidgetIndexToSave; + else + firstWidgetIndexToSave = value; + NotifyValueChangedAuto (firstWidgetIndexToSave); + } + } + public int LastWidgetIndexToSave { + get => lastWidgetIndexToSave; + set { + if (lastWidgetIndexToSave == value) + return; + if (lastWidgetIndexToSave > widgets.Count) + lastWidgetIndexToSave = widgets.Count; + else + lastWidgetIndexToSave = value; + + NotifyValueChangedAuto (lastWidgetIndexToSave); + } + } protected override void onInitialized(object sender, EventArgs e) { @@ -373,8 +410,6 @@ namespace Crow widgets = new List<DbgWidgetRecord>(); events = new List<DbgEvent>(); miSave.Invoke(null, new object[] {dbgIFace, stream, firstWidgetIndexToGet, true}); - //debuggerType.GetMethod("Save", new Type[] {dbgIfaceType, typeof(string)}).Invoke(null, new object[] {dbgIFace, "debug.log"}); - //delSaveDebugLog(dbgIFace, "debug.log"); stream.Seek(0, SeekOrigin.Begin); DbgLogger.Load (stream, events, widgets); @@ -401,6 +436,12 @@ namespace Crow foreach (DbgEvent e in evt.Events) updateWidgetEvents (widgets, e); } + void saveLogToDebugLogFilePath () { + + } + void loadLogFromDebugLogFilePath () { + + } public virtual object GetScreenCoordinates () => ScreenCoordinates(Slot).TopLeft; } diff --git a/Samples/DebugLogAnalyzer/src/Program.cs b/Samples/DebugLogAnalyzer/src/Program.cs index a2711dda..9c2e7117 100644 --- a/Samples/DebugLogAnalyzer/src/Program.cs +++ b/Samples/DebugLogAnalyzer/src/Program.cs @@ -125,10 +125,6 @@ namespace DebugLogAnalyzer } - - - - public string CrowDbgAssemblyLocation { get => Configuration.Global.Get<string>("CrowDbgAssemblyLocation"); set { @@ -156,35 +152,6 @@ namespace DebugLogAnalyzer NotifyValueChanged (nameof (Widgets), widgets); } } - /*IEnumerable<DbgWidgetEvent> widgetEvents (DbgWidgetRecord wr, DbgEvent evt) { - if (evt is DbgWidgetEvent we && we.InstanceIndex == wr.InstanceIndex) - yield return we; - if (evt.Events != null) { - foreach (DbgEvent e in evt.Events) - foreach (DbgWidgetEvent ye in widgetEvents (wr, e)) - yield return ye; - } - } - IEnumerable<DbgWidgetEvent> currentWidgetEvents; - - public IEnumerable<DbgWidgetEvent> CurrentWidgetEvents { - get => currentWidgetEvents; - set { - currentWidgetEvents = value; - NotifyValueChanged (currentWidgetEvents); - curWidget.Events = new List<DbgEvent> (currentWidgetEvents); - } - } - IEnumerable<DbgWidgetEvent> getCurrentWidgetEvents () { - if (CurrentWidget == null) - yield return null; - else { - foreach (DbgEvent evt in Events) - foreach (DbgWidgetEvent dwe in widgetEvents (CurrentWidget, evt)) - yield return dwe; - } - }*/ - public DbgEvent CurrentEvent { get => curEvent; @@ -277,7 +244,7 @@ namespace DebugLogAnalyzer NotifyValueChanged(DebugLogToFile); } } - public string DebugLogFilePath { + /*public string DebugLogFilePath { get => Configuration.Global.Get<string> (nameof (DebugLogFilePath)); set { if (CurrentFile == value) @@ -285,7 +252,7 @@ namespace DebugLogAnalyzer Configuration.Global.Set (nameof (DebugLogFilePath), value); NotifyValueChanged (DebugLogFilePath); } - } + }*/ public bool DebugLogRecording { get => debugLogRecording; set { diff --git a/Samples/DebugLogAnalyzer/ui/main.crow b/Samples/DebugLogAnalyzer/ui/main.crow index 22d0920d..16973e11 100644 --- a/Samples/DebugLogAnalyzer/ui/main.crow +++ b/Samples/DebugLogAnalyzer/ui/main.crow @@ -1,8 +1,8 @@ <?xml version="1.0"?> <VerticalStack Background="DarkGrey"> <HorizontalStack > - <HorizontalStack Width="25%" > - <VerticalStack Width="50%" Name="Explorer" Background="Onyx"> + <TabView Width="25%" > + <VerticalStack Name="Explorer" Background="Onyx"> <HorizontalStack Height="Fit" Margin="2" > <Image Margin="2" Width="16" Height="16" Path="#Crow.Icons.level-up.svg" MouseClick="goUpDirClick" Background="Jet" MouseEnter="{Background=Grey}" MouseLeave="{Background=Jet}" /> @@ -60,8 +60,7 @@ </Template> </DirectoryView> </VerticalStack> - <Splitter/> - <VerticalStack Name="DebugLogger" Margin="5" IsVisible="true" Background="Onyx"> + <VerticalStack Name="DebugLogger" Margin="5" IsVisible="false" Background="Onyx"> <HorizontalStack Height="Fit"> <Image Width="30" Height="20" Path="#Crow.Icons.IconAlerte.svg" Visible="{../../../../dbgIfaceWidget.CrowDebuggerNOK}"/> <Label Fit="true" Text="Crow debug assembly path:"/> @@ -71,10 +70,10 @@ </HorizontalStack> <Label Background="Red" Foreground="White" Margin="5" Width="Stretched" Text="{../../../dbgIfaceWidget.CrowDebuggerErrorMessage}" IsVisible="{../../../dbgIfaceWidget.CrowDebuggerNOK}"/> - <CheckBox Name="cbFile" Caption="Record to file" IsChecked="{²DebugLogToFile}" Background="Onyx"/> + <!--<CheckBox Name="cbFile" Caption="Record to file" IsChecked="{²DebugLogToFile}" Background="Onyx"/>--> <HorizontalStack Height="Fit" Width="Stretched" IsEnabled="{../cbFile.IsChecked}" Background="Onyx" Margin="5"> <Label Text="Debug log output file:" Fit="true"/> - <TextBox Text="{²DebugLogFilePath}" /> + <TextBox Text="{²../../../../dbgIfaceWidget.DebugLogFilePath}" /> </HorizontalStack> <EnumSelector RadioButtonStyle="CheckBox2" Template="#Dbg.EnumSelector.template" Background="Grey" @@ -100,7 +99,7 @@ </Menu> </HorizontalStack> </VerticalStack> - </HorizontalStack> + </TabView> <Splitter Width="6" /> <VerticalStack> <DebugInterfaceWidget Name="dbgIfaceWidget" Height="60%" Background="Black" Focusable="true" diff --git a/Samples/common/ui/Interfaces/Experimental/colorTable.crow b/Samples/common/ui/Interfaces/Experimental/colorTable.crow new file mode 100644 index 00000000..6da2b04a --- /dev/null +++ b/Samples/common/ui/Interfaces/Experimental/colorTable.crow @@ -0,0 +1,12 @@ +<ListBox Data="{TestList}" > + <Template> + <Table Name="ItemsContainer" Columns="name,Stretched;color,100"/> + </Template> + <ItemTemplate> + <TableRow> + <Label Text="{}" Margin="5" /> + <Widget Background="{}" Width="50" Height="10"/> + </TableRow> + </ItemTemplate> + +</ListBox>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Experimental/table2.crow b/Samples/common/ui/Interfaces/Experimental/table2.crow index 5416897c..4aa3eebb 100644 --- a/Samples/common/ui/Interfaces/Experimental/table2.crow +++ b/Samples/common/ui/Interfaces/Experimental/table2.crow @@ -1,18 +1,20 @@ -<Table Foreground="White" Columns="test,Fit;test,Fit" Background="White" Width="Fit" Height="Fit" Margin="1" Spacing="1" > - <TableRow Height="Fit" Spacing="1" Margin="0" - MouseEnter="{Background=RoyalBlue}" - MouseLeave="{Background=Transparent}"> - <Label Text="col1qsf" Margin="5" Background="0.3,0.3,0.3,0.8"/> - <Label Text="col1qsf" Margin="5" Background="0.3,0.3,0.3,0.8"/> - <Label Text="col1qsf" Margin="5" Background="0.3,0.3,0.3,0.8"/> - </TableRow> - <TableRow Height="Fit" Spacing="0" Margin="0" - MouseEnter="{Background=RoyalBlue}" - MouseLeave="{Background=Transparent}"> - <Label Text="col1qsf" Margin="5" Background="0.3,0.3,0.3,0.8"/> - <Label Text="col1qsf" Margin="5" Background="0.3,0.3,0.3,0.8"/> - <Label Text="col1qsf" Margin="5" Background="0.3,0.3,0.3,0.8"/> - </TableRow> - - -</Table>
\ No newline at end of file +<List Data="{TestList}"> + <Table Foreground="White" Columns="test,Fit;test,Fit" Width="Fit" Height="Fit" + Spacing="1" ColumnSpacing="1" + VerticalLineWidth="1" Margin="0" RowsMargin="0"> + <TableRow + MouseEnter="{Background=RoyalBlue}" + MouseLeave="{Background=Transparent}"> + <Label Text="col1qsf" Margin="5" /> + <Label Text="col1qsf" Margin="5" /> + <Label Text="col1qsf" Margin="5" /> + </TableRow> + <TableRow + MouseEnter="{Background=RoyalBlue}" + MouseLeave="{Background=Transparent}"> + <Label Text="col1qsf" Margin="5"/> + <Label Text="col1qsfsdqfdqsfdqsfdqsf" Margin="5"/> + <Label Text="col1qsfdsqfdqsf" Margin="5"/> + </TableRow> + </Table> +</List>
\ No newline at end of file |