; ***************************************************************************
; copyright   : (C) 2026 by Martin Preuss
; email       : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome".                              *
; * Please see toplevel file COPYING of that project for license details.   *
; ***************************************************************************

#ifndef AQH_AVR_DEVICE_C03_WIN_CLIMATE_ASM
#define AQH_AVR_DEVICE_C03_WIN_CLIMATE_ASM


; ***************************************************************************
; data

.dseg


winClimate_ramdata:
  .byte WIDGET_SD_SIZE

winClimateHeader_ramdata:
  .byte WIDGET_SD_SIZE

winClimateBody_ramdata:
  .byte WIDGET_SD_SIZE

winClimateSensor1_ramdata:
  .byte SENSORWATCH_SD_SIZE

winClimateSensor1Title_ramdata:
  .byte WIDGET_SD_SIZE

winClimateSensor1Image_ramdata:
  .byte IMGVIEW_SD_SIZE

winClimateSensor1Value_ramdata:
  .byte VLABEL_SD_SIZE

winClimateSensor2_ramdata:
  .byte SENSORWATCH_SD_SIZE

winClimateSensor2Title_ramdata:
  .byte WIDGET_SD_SIZE

winClimateSensor2Image_ramdata:
  .byte IMGVIEW_SD_SIZE

winClimateSensor2Value_ramdata:
  .byte VLABEL_SD_SIZE


winClimateSensor3_ramdata:
  .byte SENSORWATCH_SD_SIZE

winClimateSensor3Title_ramdata:
  .byte WIDGET_SD_SIZE

winClimateSensor3Image_ramdata:
  .byte IMGVIEW_SD_SIZE

winClimateSensor3Value_ramdata:
  .byte VLABEL_SD_SIZE

buttonClimateNetwork_ramdata:
  .byte IMGVIEW_SD_SIZE



; ***************************************************************************
; code

.cseg


winClimate:
  ; OBJECT
  .db 0x55, 0xaa                ; magic
  .dw winNetwork*2              ; next
  .dw winRoot*2                 ; parent
  .dw winClimateHeader*2        ; first child
  .dw 0                         ; target
  .dw 0                         ; selector (ony lower 8 bits used)
  .dw winClimate_signalmap*2    ; signal map
  ; WIDGET
  .db 0, 0                      ; opts lo, hi
  .dw 0                         ; X
  .dw 0                         ; Y
  .dw DISPLAY_WIDTH             ; W
  .dw DISPLAY_HEIGHT            ; H
  .dw STYLE_WIN_FOREGROUND      ; front color
  .dw STYLE_WIN_BACKGROUND      ; back color
  .dw STYLE_WIN_FONT*2          ; font
  .dw winClimate_ramdata           ; ptr to SDRAM

winClimate_signalmap:
  .db 0, OBJECT_SIGNAL_CREATE, LOW(Widget_OnCreate),  HIGH(Widget_OnCreate)
  .db 0, WIDGET_SIGNAL_DRAW,   LOW(Widget_OnDrawNop), HIGH(Widget_OnDrawNop)
  .db 0, 0, 0, 0  ; end of table



  winClimateHeader:
    ; OBJECT
    .db 0x55, 0xaa                 ; magic
    .dw winClimateBody*2           ; next
    .dw winClimate*2               ; parent
    .dw 0                          ; first child
    .dw 0                          ; target
    .dw 0                          ; selector (ony lower 8 bits used)
    .dw Label_DefaultSignalmap*2   ; signal map
    ; WIDGET
    .db 0, 0                       ; opts lo, hi
    .dw 0                          ; X
    .dw 0                          ; Y
    .dw DISPLAY_WIDTH              ; W
    .dw STYLE_WIN_TITLE_HEIGHT     ; H
    .dw STYLE_WIN_TITLE_FOREGROUND ; front color
    .dw STYLE_WIN_TITLE_BACKGROUND ; back color
    .dw STYLE_WIN_FONT*2           ; font
    .dw winClimateHeader_ramdata   ; ptr to SDRAM
    ; LABEL
    .dw winClimateHeader_text*2    ; text
  
  winClimateHeader_text:
    .db "Raumklima", 0



    winClimateBody:
      ; OBJECT
      .db 0x55, 0xaa                            ; magic
      .dw 0                                     ; next
      .dw winClimate*2                          ; parent
      .dw winClimateSensor1*2                     ; first child
      .dw 0                                     ; target
      .dw 0                                     ; selector (ony lower 8 bits used)
      .dw winClimateBody_signalmap*2               ; signal map
      ; WIDGET
      .db 0, 0                                  ; opts lo, hi
      .dw 0                                     ; X
      .dw STYLE_WIN_TITLE_HEIGHT                ; Y
      .dw DISPLAY_WIDTH                         ; W
      .dw DISPLAY_HEIGHT-STYLE_WIN_TITLE_HEIGHT ; H
      .dw STYLE_WIN_FOREGROUND                  ; front color
    ;  .dw DISPLAY_COLOR_YELLOW
      .dw STYLE_WIN_BACKGROUND                  ; back color
      .dw STYLE_WIN_FONT*2                      ; font
      .dw winClimateBody_ramdata                   ; ptr to SDRAM
    
    winClimateBody_signalmap:
      .db 0, OBJECT_SIGNAL_CREATE, LOW(Widget_OnCreate), HIGH(Widget_OnCreate)
      .db 0, WIDGET_SIGNAL_DRAW,   LOW(Widget_OnDraw),    HIGH(Widget_OnDraw)
      .db 0, 0, 0, 0  ; end of table
    
    
    
      winClimateSensor1:
        ; OBJECT
        .db 0x55, 0xaa                            ; magic
        .dw winClimateSensor2*2                     ; next
        .dw winClimateBody*2                      ; parent
        .dw winClimateSensor1Title*2                ; first child
        .dw 0                                     ; target
        .dw 0                                     ; selector (ony lower 8 bits used)
        .dw SensorWatch_DefaultSignalmap*2        ; signal map
        ; WIDGET
        .db (1<<WIDGET_OPTSLO_MSGRECV_BIT), 0     ; opts lo, hi
        .dw 4                                     ; X
        .dw 4                                     ; Y
        .dw 100                                   ; W   (image=96, 2 px borders)
        .dw 100                                   ; H
        .dw STYLE_WIN_FOREGROUND                  ; front color
        .dw STYLE_WIN_BACKGROUND                  ; back color
        .dw STYLE_WIN_FONT*2                      ; font
        .dw winClimateSensor1_ramdata             ; ptr to SDRAM
        ; SENSORWATCH
        .db 0, 0                                  ; baseValueId, eepromId
      
      
        winClimateSensor1Title:
          ; OBJECT
          .db 0x55, 0xaa               ; magic
          .dw winClimateSensor1Image*2     ; next
          .dw winClimateSensor1*2          ; parent
          .dw 0                          ; first child
          .dw 0                          ; target
          .dw 0                          ; selector (ony lower 8 bits used)
          .dw Label_DefaultSignalmap*2               ; signal map
          ; WIDGET
          .db 0, (1<<WIDGET_OPTSHI_HALIGNCENTER_BIT) ; opts lo, hi
          .dw 2                                      ; X
          .dw 1                                      ; Y
          .dw 96                                     ; W
          .dw STYLE_WIN_FONT_HEIGHT+2                ; H
          .dw STYLE_WIN_FOREGROUND                   ; front color
          .dw STYLE_WIN_BACKGROUND                   ; back color
          .dw STYLE_WIN_FONT*2                       ; font
          .dw winClimateSensor1Title_ramdata           ; ptr to SDRAM
          ; LABEL
          .dw winClimateSensor1Title_text*2            ; text
        
        winClimateSensor1Title_text:
          .db "CO2", 0
        
        
        
        winClimateSensor1Image:
          ; OBJECT
          .db 0x55, 0xaa                            ; magic
          .dw winClimateSensor1Value*2                ; next
          .dw winClimateSensor1*2                     ; parent
          .dw 0                                     ; first child
          .dw 0                                     ; target
          .dw 0                                     ; selector (ony lower 8 bits used)
          .dw ImageView_DefaultSignalmap*2          ; signal map
          ; WIDGET
          .db 0, 0                                  ; opts lo, hi
          .dw 2                                     ; X
          .dw STYLE_WIN_FONT_HEIGHT+2               ; Y
          .dw 96                                    ; W
          .dw 96                                    ; H
          .dw STYLE_WIN_FOREGROUND                  ; front color
          .dw STYLE_WIN_BACKGROUND                  ; back color
          .dw STYLE_WIN_FONT*2                      ; font
          .dw winClimateSensor1Image_ramdata          ; ptr to SDRAM
          ; IMGVIEW
          .dw RESSSOURCE_IMG_CLOUD96                ; ressource id
        
        
        
        winClimateSensor1Value:
          ; OBJECT
          .db 0x55, 0xaa                             ; magic
          .dw 0                                      ; next
          .dw winClimateSensor1*2                      ; parent
          .dw 0                                      ; first child
          .dw 0                                      ; target
          .dw 0                                      ; selector (ony lower 8 bits used)
          .dw ValueLabel_DefaultSignalmap*2          ; signal map
          ; WIDGET
          .db 0, (1<<WIDGET_OPTSHI_HALIGNCENTER_BIT) ; opts lo, hi
          .dw 2                                      ; X
          .dw STYLE_WIN_FONT_HEIGHT+2+96+2           ; Y
          .dw 96                                     ; W
          .dw STYLE_WIN_FONT_HEIGHT+4                ; H
          .dw STYLE_WIN_FOREGROUND                   ; front color
          .dw STYLE_WIN_BACKGROUND                   ; back color
          .dw STYLE_WIN_FONT*2                       ; font
          .dw winClimateSensor1Value_ramdata           ; ptr to SDRAM
          ; VALUELABEL
          .db 0, 0                                   ; num of post-komma digits
      
      
      
      winClimateSensor2:
        ; OBJECT
        .db 0x55, 0xaa                            ; magic
        .dw winClimateSensor3*2                     ; next
        .dw winClimateBody*2               ; parent
        .dw winClimateSensor2Title*2                ; first child
        .dw 0                                     ; target
        .dw 0                                     ; selector (ony lower 8 bits used)
        .dw SensorWatch_DefaultSignalmap*2        ; signal map
        ; WIDGET
        .db (1<<WIDGET_OPTSLO_MSGRECV_BIT), 0     ; opts lo, hi
        .dw 108                                   ; X
        .dw 4                                     ; Y
        .dw 100                                   ; W   (image=96, 2 px borders)
        .dw 100                                   ; H
        .dw STYLE_WIN_FOREGROUND                  ; front color
        .dw STYLE_WIN_BACKGROUND                  ; back color
        .dw STYLE_WIN_FONT*2                      ; font
        .dw winClimateSensor2_ramdata               ; ptr to SDRAM
        ; SENSORWATCH
        .db 0, 0                                  ; baseValueId, eepromId
      
      
      
        winClimateSensor2Title:
          ; OBJECT
          .db 0x55, 0xaa               ; magic
          .dw winClimateSensor2Image*2     ; next
          .dw winClimateSensor2*2          ; parent
          .dw 0                          ; first child
          .dw 0                          ; target
          .dw 0                          ; selector (ony lower 8 bits used)
          .dw Label_DefaultSignalmap*2               ; signal map
          ; WIDGET
          .db 0, (1<<WIDGET_OPTSHI_HALIGNCENTER_BIT) ; opts lo, hi
          .dw 2                                      ; X
          .dw 1                                      ; Y
          .dw 96                                     ; W
          .dw STYLE_WIN_FONT_HEIGHT+2                ; H
          .dw STYLE_WIN_FOREGROUND                   ; front color
          .dw STYLE_WIN_BACKGROUND                   ; back color
          .dw STYLE_WIN_FONT*2                       ; font
          .dw winClimateSensor2Title_ramdata           ; ptr to SDRAM
          ; LABEL
          .dw winClimateSensor2Title_text*2            ; text
        
        winClimateSensor2Title_text:
          .db "Temp", 0, 0
        
        
        
        winClimateSensor2Image:
          ; OBJECT
          .db 0x55, 0xaa                            ; magic
          .dw winClimateSensor2Value*2                ; next
          .dw winClimateSensor2*2                     ; parent
          .dw 0                                     ; first child
          .dw 0                                     ; target
          .dw 0                                     ; selector (ony lower 8 bits used)
          .dw ImageView_DefaultSignalmap*2          ; signal map
          ; WIDGET
          .db 0, 0                                  ; opts lo, hi
          .dw 2                                     ; X
          .dw STYLE_WIN_FONT_HEIGHT+2               ; Y
          .dw 96                                    ; W
          .dw 96                                    ; H
          .dw STYLE_WIN_FOREGROUND                  ; front color
          .dw STYLE_WIN_BACKGROUND                  ; back color
          .dw STYLE_WIN_FONT*2                      ; font
          .dw winClimateSensor2Image_ramdata          ; ptr to SDRAM
          ; IMGVIEW
          .dw RESSSOURCE_IMG_TEMP96                ; ressource id
        
        
        
        winClimateSensor2Value:
          ; OBJECT
          .db 0x55, 0xaa                             ; magic
          .dw 0                                      ; next
          .dw winClimateSensor2*2                      ; parent
          .dw 0                                      ; first child
          .dw 0                                      ; target
          .dw 0                                      ; selector (ony lower 8 bits used)
          .dw ValueLabel_DefaultSignalmap*2          ; signal map
          ; WIDGET
          .db 0, (1<<WIDGET_OPTSHI_HALIGNCENTER_BIT) ; opts lo, hi
          .dw 2                                      ; X
          .dw STYLE_WIN_FONT_HEIGHT+2+96+2           ; Y
          .dw 96                                     ; W
          .dw STYLE_WIN_FONT_HEIGHT+4                ; H
          .dw STYLE_WIN_FOREGROUND                   ; front color
          .dw STYLE_WIN_BACKGROUND                   ; back color
          .dw STYLE_WIN_FONT*2                       ; font
          .dw winClimateSensor2Value_ramdata           ; ptr to SDRAM
          ; VALUELABEL
          .db 2, 0                                   ; num of post-komma digits
      
      
      
      winClimateSensor3:
        ; OBJECT
        .db 0x55, 0xaa                            ; magic
        .dw buttonClimateNetwork*2                ; next
        .dw winClimateBody*2                      ; parent
        .dw winClimateSensor3Title*2                ; first child
        .dw 0                                     ; target
        .dw 0                                     ; selector (ony lower 8 bits used)
        .dw SensorWatch_DefaultSignalmap*2        ; signal map
        ; WIDGET
        .db (1<<WIDGET_OPTSLO_MSGRECV_BIT), 0     ; opts lo, hi
        .dw 212                                   ; X
        .dw 4                                     ; Y
        .dw 100                                   ; W   (image=96, 2 px borders)
        .dw 100                                   ; H
        .dw STYLE_WIN_FOREGROUND                  ; front color
        .dw STYLE_WIN_BACKGROUND                  ; back color
        .dw STYLE_WIN_FONT*2                      ; font
        .dw winClimateSensor3_ramdata             ; ptr to SDRAM
        ; SENSORWATCH
        .db 0, 0                                  ; baseValueId, eepromId
      
      
      
        winClimateSensor3Title:
          ; OBJECT
          .db 0x55, 0xaa                             ; magic
          .dw winClimateSensor3Image*2                 ; next
          .dw winClimateSensor3*2                      ; parent
          .dw 0                                      ; first child
          .dw 0                                      ; target
          .dw 0                                      ; selector (ony lower 8 bits used)
          .dw Label_DefaultSignalmap*2               ; signal map
          ; WIDGET
          .db 0, (1<<WIDGET_OPTSHI_HALIGNCENTER_BIT) ; opts lo, hi
          .dw 2                                      ; X
          .dw 1                                      ; Y
          .dw 96                                     ; W
          .dw STYLE_WIN_FONT_HEIGHT+2                ; H
          .dw STYLE_WIN_FOREGROUND                   ; front color
          .dw STYLE_WIN_BACKGROUND                   ; back color
          .dw STYLE_WIN_FONT*2                       ; font
          .dw winClimateSensor3Title_ramdata           ; ptr to SDRAM
          ; LABEL
          .dw winClimateSensor3Title_text*2            ; text
        
        winClimateSensor3Title_text:
          .db "Hum", 0
        
        
        
        winClimateSensor3Image:
          ; OBJECT
          .db 0x55, 0xaa                            ; magic
          .dw winClimateSensor3Value*2                ; next
          .dw winClimateSensor3*2                     ; parent
          .dw 0                                     ; first child
          .dw 0                                     ; target
          .dw 0                                     ; selector (ony lower 8 bits used)
          .dw ImageView_DefaultSignalmap*2          ; signal map
          ; WIDGET
          .db 0, 0                                  ; opts lo, hi
          .dw 2                                     ; X
          .dw STYLE_WIN_FONT_HEIGHT+2               ; Y
          .dw 96                                    ; W
          .dw 96                                    ; H
          .dw STYLE_WIN_FOREGROUND                  ; front color
          .dw STYLE_WIN_BACKGROUND                  ; back color
          .dw STYLE_WIN_FONT*2                      ; font
          .dw winClimateSensor3Image_ramdata          ; ptr to SDRAM
          ; IMGVIEW
          .dw RESSSOURCE_IMG_HUMIDITY96             ; ressource id
        
        
        
        winClimateSensor3Value:
          ; OBJECT
          .db 0x55, 0xaa                             ; magic
          .dw 0                                      ; next
          .dw winClimateSensor3*2                      ; parent
          .dw 0                                      ; first child
          .dw 0                                      ; target
          .dw 0                                      ; selector (ony lower 8 bits used)
          .dw ValueLabel_DefaultSignalmap*2          ; signal map
          ; WIDGET
          .db 0, (1<<WIDGET_OPTSHI_HALIGNCENTER_BIT) ; opts lo, hi
          .dw 2                                      ; X
          .dw STYLE_WIN_FONT_HEIGHT+2+96+2           ; Y
          .dw 96                                     ; W
          .dw STYLE_WIN_FONT_HEIGHT+4                ; H
          .dw STYLE_WIN_FOREGROUND                   ; front color
          .dw STYLE_WIN_BACKGROUND                   ; back color
          .dw STYLE_WIN_FONT*2                       ; font
          .dw winClimateSensor3Value_ramdata           ; ptr to SDRAM
          ; VALUELABEL
          .db 0, 0                                   ; num of post-komma digits
        
        
        
      buttonClimateNetwork:
        ; OBJECT
        .db 0x55, 0xaa                             ; magic
        .dw 0                                      ; next
        .dw winClimateBody*2                       ; parent
        .dw 0                                      ; first child
        .dw appC03*2                               ; target
        .dw APPC03_SEL_BUTTON_NETWORK              ; selector (ony lower 8 bits used)
        .dw buttonNetwork_signalmap*2              ; signal map
        ; WIDGET
        .db (1<<WIDGET_OPTSLO_INPUT_BIT) | (1<<WIDGET_OPTSLO_BORDER_BIT), 0 ; opts lo, hi
        .dw DISPLAY_WIDTH-56                         ; X
        .dw DISPLAY_HEIGHT-STYLE_WIN_TITLE_HEIGHT-56 ; Y
        .dw 52                                     ; W
        .dw 52                                     ; H
        .dw STYLE_BUTTON_COL_FG_NORM               ; front color
        .dw STYLE_BUTTON_COL_BG_NORM               ; back color
        .dw STYLE_WIN_FONT*2                       ; font
        .dw buttonClimateNetwork_ramdata           ; ptr to SDRAM
        ; IMGVIEW
        .dw RESSSOURCE_IMG_NETWORK                 ; ressource id
      
      buttonNetwork_signalmap:
        .db 0, WIDGET_SIGNAL_TOUCH,     LOW(Button_OnTouch),       HIGH(Button_OnTouch)
        .db 0, WIDGET_SIGNAL_DRAW,      LOW(ImageView_OnDraw),     HIGH(ImageView_OnDraw)
        .db 0, IMGVIEW_SIGNAL_SETBGCOL, LOW(ImageView_OnSetBgCol), HIGH(ImageView_OnSetBgCol)
        .db 0, OBJECT_SIGNAL_CREATE,    LOW(ImageView_OnCreate),   HIGH(ImageView_OnCreate)
        .db 0, 0, 0, 0  ; end of table


#endif
