changed to new tags syntax
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 7 Oct 2021 04:14:40 +0000 (23:14 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 7 Oct 2021 04:14:40 +0000 (23:14 -0500)
src/app/editor.onyx
src/app/settings.onyx
src/features/hex_editor/feature.onyx
src/features/hex_editor/hex_viewer.onyx
src/ui/window.onyx

index 5f6985da4d57e4910270ff720fd9a175c16afedf..34dbebd6fe270da72b6f51a1d263e2a86436d9d4 100644 (file)
@@ -13,11 +13,11 @@ Slider_Float  :: struct { min, max: f32; }
 Ignore_Option :: struct { option: str; }
 
 modify_window_draw :: (obj: any, win: ^app.Application_Window, site := #callsite) {
-    __counter = 0;
-
     rect := win.window_state->get_internal_rectangle(); 
 
     hash := ui.get_site_hash(site);
+    __counter = hash;
+    
     handle := ui.scrollable_region_start(rect, increment=hash, .{
         minimum_x = 0, maximum_x = 0,
         minimum_y = 0, maximum_y = 100000.0f,
@@ -26,7 +26,6 @@ modify_window_draw :: (obj: any, win: ^app.Application_Window, site := #callsite
 
     win_rect := handle->get_visible_rectangle();
 
-    // rect = ui.Flow.padding(rect, left=8, right=8);
     rect.y1 = 1000000.0f;
 
     {
@@ -81,13 +80,16 @@ modify_window_draw :: (obj: any, win: ^app.Application_Window, site := #callsite
             }
 
             {
+                line_buffer: [256] u8;
+
                 // Draw the name of the variable, handling a "Rename" tag.
                 name := member.name;
                 if rename := array.first(member.tags, (x) => x.type == Rename); rename != null {
                     name = (cast(^Rename) rename.data).name;
                 }
 
-                if row_visible do ui.draw_text(name_rect, name, theme=^heading_theme);
+                line := conv.str_format(line_buffer, "{} [{}]", name, member.type);
+                if row_visible do ui.draw_text(name_rect, line, theme=^heading_theme);
             }
 
             switch member_type.kind {
@@ -177,3 +179,8 @@ modify_window_draw :: (obj: any, win: ^app.Application_Window, site := #callsite
     }
 }
 
+#private_file gfx :: package immediate_mode
+#tag gfx.Color4.r, Slider_Float.{ 0, 1 }
+#tag gfx.Color4.g, Slider_Float.{ 0, 1 }
+#tag gfx.Color4.b, Slider_Float.{ 0, 1 }
+#tag gfx.Color4.a, Slider_Float.{ 0, 1 }
index 15bdd3d4ca9e0a8a4fde2de4bec4d97ac52014d9..765ade4e9369db979b0fb670a9fd630ccb0c4358 100644 (file)
@@ -14,8 +14,8 @@ package app
 }
 
 Application_Settings :: struct {
-    #tag(editor.Ignore_Option.{ "Undefined" })
-    #tag(editor.Rename.{ "Color scheme" })
+    [editor.Ignore_Option.{ "Undefined" }]
+    [editor.Rename.{ "Color scheme" }]
     colorscheme := Colorscheme.Undefined;
 }
 
@@ -90,3 +90,4 @@ settings_window_draw :: (_, win) => {
         close_window(window_id);
     }
 }
+
index ea974e6abf6679296059bdacfcc5026205ad05e0..71d265ad5ab02734b00fc9a172dfdcfc3ac54413 100644 (file)
@@ -4,10 +4,7 @@ package feature.hex_viewer
 
 use package feature { Feature }
 
-_ :: struct #tag(Feature.{ "Hex Viewer" }) {
+#tag WF, Feature.{ "Hex Viewer" }
+WF :: struct {
     setup := setup;
 }
-
-
-
-
index fe2f4c6c5a2d8617c76337eaececee9eee71d933..2931707a354a05f33c26fa0b6106010969016d2d 100644 (file)
@@ -16,10 +16,10 @@ window_name :: "Hex Viewer"
 Hex_Viewer_State :: struct {
     scrollable_region := ui.Scrollable_Region_State.{};
 
-    #tag(editor.Slider_Int.{ -1, 40 })
+    [editor.Slider_Int.{ -1, 40 }]
     highlighted_line   := -1;
 
-    #tag(editor.Slider_Int.{ -1, 16 })
+    [editor.Slider_Int.{ -1, 16 }]
     highlighted_column := -1;
 }
 
index b114bafffbc21437e81c6954c5975aaad1aad49d..789f9dad485055b8c09a89afb8121102bff427ac 100644 (file)
@@ -14,12 +14,12 @@ Window_State :: struct {
 
     title := "(undefined)";
 
-    #tag(editor.Slider_Float.{ 0, 64 })
+    [editor.Slider_Float.{ 0, 64 }]
     border_width := 10.0f;
     border_color := gfx.Color4.{ 1, 0, 0 };
     background_color := gfx.Color4.{ 0.2, 0.2, 0.2 };
 
-    #tag(editor.Slider_Float.{ 0, 64 })
+    [editor.Slider_Float.{ 0, 64 }]
     bar_height := 28.0f;
 
     draggable := true;