From 63d204364a5855df15570ab5d6e25951790141d6 Mon Sep 17 00:00:00 2001 From: Peter Slattery Date: Sat, 6 Feb 2021 14:25:43 -0800 Subject: [PATCH] clean up after debugging lights --- src/app/editor/panels/foldhaus_panel_hierarchy.h | 12 ++++++++++-- src/app/engine/uart/foldhaus_uart.cpp | 8 ++------ src/app/interface.h | 16 ++++++++++++++++ 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/app/editor/panels/foldhaus_panel_hierarchy.h b/src/app/editor/panels/foldhaus_panel_hierarchy.h index e19cbb0..13d45fe 100644 --- a/src/app/editor/panels/foldhaus_panel_hierarchy.h +++ b/src/app/editor/panels/foldhaus_panel_hierarchy.h @@ -43,9 +43,14 @@ HierarchyView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* Ren ui_PushLayout(&State->Interface, PanelBounds, LayoutDirection_TopDown, MakeString("Hierarchy Layout")); ui_BeginList(&State->Interface, MakeString("Hierarchy List"), 10, State->Assemblies.Count + 1); { - ui_BeginRow(&State->Interface, 2); + ui_column_spec Cols[2] = { + ui_column_spec{ UIColumnSize_Fill, 0 }, + ui_column_spec{ UIColumnSize_MaxWidth, 128 } + }; for (u32 i = 0; i < State->Assemblies.Count; i++) { + ui_BeginRow(&State->Interface, 2, &Cols[0]); + assembly Assembly = State->Assemblies.Values[i]; PrintF(&TempString, "%S", Assembly.Name); @@ -54,8 +59,12 @@ HierarchyView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* Ren { UnloadAssembly(i, State, Context); } + + ui_EndRow(&State->Interface); } + + ui_BeginRow(&State->Interface, 2, &Cols[0]); ui_Label(&State->Interface, MakeString(" ")); if (ui_Button(&State->Interface, MakeString("+ Add Assembly"))) { @@ -63,7 +72,6 @@ HierarchyView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* Ren FileView_SetMode(FileBrowser, FileViewMode_Save); Panel_PushModalOverride(Panel, FileBrowser, LoadAssemblyCallback); } - ui_EndRow(&State->Interface); } ui_EndList(&State->Interface); diff --git a/src/app/engine/uart/foldhaus_uart.cpp b/src/app/engine/uart/foldhaus_uart.cpp index 64157fa..94cded0 100644 --- a/src/app/engine/uart/foldhaus_uart.cpp +++ b/src/app/engine/uart/foldhaus_uart.cpp @@ -6,7 +6,7 @@ #ifndef FOLDHAUS_UART_CPP -internal uart_header* +internal void UART_SetChannelBuffer_Create(gs_memory_cursor* WriteCursor, uart_channel ChannelSettings, v2_strip Strip, led_buffer LedBuffer) { // NOTE(pjs): This is just here because the information is duplicated and I want to be sure @@ -48,8 +48,6 @@ UART_SetChannelBuffer_Create(gs_memory_cursor* WriteCursor, uart_channel Channel uart_footer* Footer = PushStructOnCursor(WriteCursor, uart_footer); UART_FillFooter(Footer, (u8*)Header); - - return Header; } internal void @@ -167,9 +165,7 @@ UART_BuildOutputData(addressed_data_buffer_list* Output, assembly_array Assembli v2_strip StripAt = Assembly.Strips[StripIdx]; ChannelSettings.PixelsCount = StripAt.LedCount; - uart_header* Header = UART_SetChannelBuffer_Create(&WriteCursor, ChannelSettings, StripAt, *LedBuffer); - - //At->Header[i] = Header; + UART_SetChannelBuffer_Create(&WriteCursor, ChannelSettings, StripAt, *LedBuffer); } UART_DrawAll_Create(&WriteCursor); diff --git a/src/app/interface.h b/src/app/interface.h index 34cf505..60c640a 100644 --- a/src/app/interface.h +++ b/src/app/interface.h @@ -847,6 +847,7 @@ enum ui_column_size_rule UIColumnSize_Fixed, UIColumnSize_Percent, UIColumnSize_Fill, + UIColumnSize_MaxWidth, }; struct ui_column_spec @@ -893,6 +894,20 @@ ui_BeginRow(ui_interface* Interface, u32 ColumnsMax, ui_column_spec* ColumnRules { FillColumnsCount += 1; }break; + + case UIColumnSize_MaxWidth: + { + if (RemainingSpace >= Spec.Width) + { + Column->XMax = Spec.Width; + } + else + { + Column->XMax = RemainingSpace; + } + RemainingSpace -= Column->XMax; + }break; + InvalidDefaultCase; } } @@ -911,6 +926,7 @@ ui_BeginRow(ui_interface* Interface, u32 ColumnsMax, ui_column_spec* ColumnRules { case UIColumnSize_Fixed: case UIColumnSize_Percent: + case UIColumnSize_MaxWidth: { ColumnWidth = Column->XMax; }break;