package editor import ( "gioui.org/unit" "pad/internal/ui" ) // State holds all application state owned by the logic goroutine. type State struct { ScreenWidth unit.Dp ScreenHeight unit.Dp Elems []ui.Element } // NewState creates a new State with initial editor layout. func NewState(screenWidth, screenHeight unit.Dp) *State { return &State{ ScreenWidth: screenWidth, ScreenHeight: screenHeight, Elems: EditorLayout(screenWidth, screenHeight), } } // EditorLayout computes regions for the editor page. // It takes screen dimensions and returns []Element. func EditorLayout(screenWidth, screenHeight unit.Dp) []ui.Element { // Compute StatusBar region // Line 1: filename (24 DP) // Line 2: icons (24 DP) statusBarHeight := unit.Dp(48) statusBarRegion := ui.Region{ X: 0, Y: 0, W: screenWidth, H: statusBarHeight, } // Compute BottomBar region (fixed height, at bottom of screen) bottomBarHeight := unit.Dp(24) bottomBarY := screenHeight - bottomBarHeight bottomBarRegion := ui.Region{ X: 0, Y: bottomBarY, W: screenWidth, H: bottomBarHeight, } // Create StatusBar with mocked filename statusBar := ui.NewStatusBar( statusBarRegion, "very_long_filename_that_does_not_fit_on_a_single_line.txt", false, // FilenameExp true, // CutCopy false, // Copy true, // Paste false, // ConflictIcon true, // Search ) // Create BottomBar with mocked data bottomBar := ui.NewBottomBar( bottomBarRegion, "Ln 47, Col 12", "1024 / 50000", true, // WordWrap ) return []ui.Element{statusBar, bottomBar} }