Enumeration
#Window_0
#fon
#Hide
#Light_Button_Enable
#Light_Button
#Light_Button_On
#Light_Auto
#Light_Auto_On
#Light_Help
#Light_Help_On
#Light_Down_Enable
#Light_Pause
#Light_Power
#Light_Mode
#Light_Tune
#Light_Battery
#Knob_pointer_White_Long
#text
#H_track
#V_track
#H_knob1
#H_knob2
#H_knob3
#H_knob4
#H_knob5
#H_knob6
#H_knob7
#H_knob8
#H_knob9
#H_knob10
#V_knob1
#V_knob2
#V_knob3
#V_knob4
#V_knob5
#V_knob6
#H_knob_Light1
#H_knob_Light2
#H_knob_Light3
#V_knob_Light1
EndEnumeration
UsePNGImageDecoder()
Procedure Draw_y(x, y, Gadget, ImageID, Active_ImID=0)
StartDrawing(CanvasOutput(Gadget))
DrawImage(ImageID(#V_track), 0, 0)
If Active_ImID
DrawAlphaImage(Active_ImID, 0, 4)
EndIf
DrawAlphaImage(ImageID, x, y)
StopDrawing()
EndProcedure
Procedure Draw_x(x, y, Gadget, ImageID, Active_ImID=0)
StartDrawing(CanvasOutput(Gadget))
DrawImage(ImageID(#H_track), 0, 0)
If Active_ImID
DrawAlphaImage(Active_ImID, 4, 0)
EndIf
DrawAlphaImage(ImageID, x, y)
StopDrawing()
EndProcedure
CatchImage(#H_track, ?H_track)
CatchImage(#H_knob1, ?H_knob1)
CatchImage(#H_knob2, ?H_knob2)
CatchImage(#H_knob3, ?H_knob3)
CatchImage(#H_knob4, ?H_knob4)
CatchImage(#H_knob5, ?H_knob5)
CatchImage(#H_knob6, ?H_knob6)
CatchImage(#H_knob7, ?H_knob7)
CatchImage(#H_knob8, ?H_knob8)
CatchImage(#H_knob9, ?H_knob9)
CatchImage(#H_knob10, ?H_knob10)
CatchImage(#H_knob_Light1, ?H_knob_Light1)
CatchImage(#H_knob_Light2, ?H_knob_Light2)
CatchImage(#H_knob_Light3, ?H_knob_Light3)
CatchImage(#V_knob_Light1, ?V_knob_Light1)
CatchImage(#V_track, ?V_track)
CatchImage(#V_knob1, ?V_knob1)
CatchImage(#V_knob2, ?V_knob2)
CatchImage(#V_knob3, ?V_knob3)
CatchImage(#V_knob4, ?V_knob4)
CatchImage(#V_knob5, ?V_knob5)
CatchImage(#V_knob6, ?V_knob6)
CatchImage(#Light_Button_Enable, ?Light_Button_Enable)
OpenWindow(0, 0, 0, 180, 170, "CanvasGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
;ImageGadget(12,2,2,67,67,ImageID(#Light_Button_Enable)) : DisableGadget(12, #True)
CanvasGadget(20, 2, 5, 87, 15)
Draw_x(0, 0, 20, ImageID(#H_knob1))
CanvasGadget(21, 2, 20, 87, 15)
Draw_x(0, 0, 21, ImageID(#H_knob2))
CanvasGadget(22, 2, 35, 87, 15)
Draw_x(0, 0, 22, ImageID(#H_knob3))
CanvasGadget(23, 2, 50, 87, 15)
Draw_x(0, 0, 23, ImageID(#H_knob4))
CanvasGadget(24, 2, 65, 87, 15)
Draw_x(0, 0, 24, ImageID(#H_knob5))
CanvasGadget(25, 89, 5, 87, 15)
Draw_x(0, 0, 25, ImageID(#H_knob6))
CanvasGadget(26, 89, 20, 87, 15)
Draw_x(0, 0, 26, ImageID(#H_knob7))
CanvasGadget(27, 89, 35, 87, 15)
Draw_x(0, 0, 27, ImageID(#H_knob8))
CanvasGadget(28, 89, 50, 87, 15)
Draw_x(0, 0, 28, ImageID(#H_knob9))
CanvasGadget(29, 89, 65, 87, 15)
Draw_x(0, 0, 29, ImageID(#H_knob10))
CanvasGadget(30, 20, 80, 15, 87)
Draw_y(0, 0, 30, ImageID(#V_knob1))
CanvasGadget(31, 35, 80, 15, 87)
Draw_y(0, 0, 31, ImageID(#V_knob2))
CanvasGadget(32, 50, 80, 15, 87)
Draw_y(0, 0, 32, ImageID(#V_knob3))
CanvasGadget(33, 65, 80, 15, 87)
Draw_y(0, 0, 33, ImageID(#V_knob4))
CanvasGadget(34, 80, 80, 15, 87)
Draw_y(0, 0, 34, ImageID(#V_knob5))
CanvasGadget(35, 95, 80, 15, 87)
Draw_y(0, 0, 35, ImageID(#V_knob6))
For i=20 To 35
SetGadgetAttribute(i, #PB_Canvas_Cursor, #PB_Cursor_Hand)
Next i
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
Gadget=EventGadget()
If Gadget>=30 And Gadget<=35
Type = EventType()
; Перемещение вертикального бегунка.
If Type = #PB_EventType_LeftClick Or (Type = #PB_EventType_MouseMove And GetGadgetAttribute(Gadget, #PB_Canvas_Buttons) = #PB_Canvas_LeftButton)
y=GetGadgetAttribute(Gadget, #PB_Canvas_MouseY)-12
If y<0 : y=0 : EndIf
If y>87-24 : y = 87-24 : EndIf
Draw_y(0, y, Gadget, ImageID(Gadget), ImageID(#V_knob_Light1))
SetGadgetData(Gadget, y)
; Мышка или вошла в пределы регулятора или вышла из него.
ElseIf Type = #PB_EventType_MouseEnter Or Type = #PB_EventType_MouseLeave
If Type = #PB_EventType_MouseLeave ; Мышь вышла с передлов регулятора.
Active_ImID=0
Else
Active_ImID=ImageID(#V_knob_Light1)
EndIf
y=GetGadgetData(Gadget)
Draw_y(0, y, Gadget, ImageID(Gadget), Active_ImID)
EndIf
EndIf
If Gadget>=20 And Gadget<=22
Type = EventType()
; Перемещение горизонтального бегунка.
If Type = #PB_EventType_LeftClick Or (Type = #PB_EventType_MouseMove And GetGadgetAttribute(Gadget, #PB_Canvas_Buttons) = #PB_Canvas_LeftButton)
x=GetGadgetAttribute(Gadget, #PB_Canvas_MouseX)-12
If x<0 : x=0 : EndIf
If x>87-24 : x = 87-24 : EndIf
Draw_x(x, 0, Gadget, ImageID(Gadget), ImageID(#H_knob_Light1))
SetGadgetData(Gadget, x)
; Мышка или вошла в пределы регулятора или вышла из него.
ElseIf Type = #PB_EventType_MouseEnter Or Type = #PB_EventType_MouseLeave
If Type = #PB_EventType_MouseLeave ; Мышь вышла с передлов регулятора.
Active_ImID=0
Else
Active_ImID=ImageID(#H_knob_Light1)
EndIf
x=GetGadgetData(Gadget)
Draw_x(x, 0, Gadget, ImageID(Gadget), Active_ImID)
EndIf
EndIf
If Gadget>=23 And Gadget<=24
Type = EventType()
; Перемещение горизонтального бегунка.
If Type = #PB_EventType_LeftClick Or (Type = #PB_EventType_MouseMove And GetGadgetAttribute(Gadget, #PB_Canvas_Buttons) = #PB_Canvas_LeftButton)
x=GetGadgetAttribute(Gadget, #PB_Canvas_MouseX)-12
If x<0 : x=0 : EndIf
If x>87-24 : x = 87-24 : EndIf
Draw_x(x, 0, Gadget, ImageID(Gadget), ImageID(#H_knob_Light2))
SetGadgetData(Gadget, x)
; Мышка или вошла в пределы регулятора или вышла из него.
ElseIf Type = #PB_EventType_MouseEnter Or Type = #PB_EventType_MouseLeave
If Type = #PB_EventType_MouseLeave ; Мышь вышла с передлов регулятора.
Active_ImID=0
Else
Active_ImID=ImageID(#H_knob_Light2)
EndIf
x=GetGadgetData(Gadget)
Draw_x(x, 0, Gadget, ImageID(Gadget), Active_ImID)
EndIf
EndIf
If Gadget>=25 And Gadget<=29
Type = EventType()
; Перемещение горизонтального бегунка.
If Type = #PB_EventType_LeftClick Or (Type = #PB_EventType_MouseMove And GetGadgetAttribute(Gadget, #PB_Canvas_Buttons) = #PB_Canvas_LeftButton)
x=GetGadgetAttribute(Gadget, #PB_Canvas_MouseX)-12
If x<0 : x=0 : EndIf
If x>87-24 : x = 87-24 : EndIf
Draw_x(x, 0, Gadget, ImageID(Gadget), ImageID(#H_knob_Light3))
SetGadgetData(Gadget, x)
; Мышка или вошла в пределы регулятора или вышла из него.
ElseIf Type = #PB_EventType_MouseEnter Or Type = #PB_EventType_MouseLeave
If Type = #PB_EventType_MouseLeave ; Мышь вышла с передлов регулятора.
Active_ImID=0
Else
Active_ImID=ImageID(#H_knob_Light3)
EndIf
x=GetGadgetData(Gadget)
Draw_x(x, 0, Gadget, ImageID(Gadget), Active_ImID)
EndIf
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
DataSection
;{ ресурсы
H_track:
IncludeBinary "Files\H.png"
H_knob1:
IncludeBinary "Files\H-knob1.png"
H_knob2:
IncludeBinary "Files\H-knob1.png"
H_knob3:
IncludeBinary "Files\H-knob1.png"
H_knob4:
IncludeBinary "Files\H-knob3.png"
H_knob5:
IncludeBinary "Files\H-knob3.png"
H_knob6:
IncludeBinary "Files\H-knob2.png"
H_knob7:
IncludeBinary "Files\H-knob2.png"
H_knob8:
IncludeBinary "Files\H-knob2.png"
H_knob9:
IncludeBinary "Files\H-knob2.png"
H_knob10:
IncludeBinary "Files\H-knob2.png"
V_track:
IncludeBinary "Files\V-slider.png"
V_knob1:
IncludeBinary "Files\V-knob1.png"
V_knob2:
IncludeBinary "Files\V-knob2.png"
V_knob3:
IncludeBinary "Files\V-knob3.png"
V_knob4:
IncludeBinary "Files\V-knob4.png"
V_knob5:
IncludeBinary "Files\V-knob5.png"
V_knob6:
IncludeBinary "Files\V-knob6.png"
H_knob_Light1:
IncludeBinary "Files\H-knob1_Light.png"
H_knob_Light2:
IncludeBinary "Files\H-knob3_Light.png"
H_knob_Light3:
IncludeBinary "Files\H-knob2_Light.png"
V_knob_Light1:
IncludeBinary "Files\V-knob1_Light.png"
Light_Button_Enable:
IncludeBinary "Files\Knob_pointer_White_Long.png"
;}
EndDataSection