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
#V_knob_Light2
#V_knob_Light3
#Color_Red
#Color_Orange
#Color_Yellow
#Color_Green
#Color_Blue
#Color_Violet
#Color_White
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_knob_Light2, ?V_knob_Light2)
CatchImage(#V_knob_Light3, ?V_knob_Light3)
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(#Color_Red, ?Color_Red)
CatchImage(#Color_Orange, ?Color_Orange)
CatchImage(#Color_Yellow, ?Color_Yellow)
CatchImage(#Color_Green, ?Color_Green)
CatchImage(#Color_Blue, ?Color_Blue)
CatchImage(#Color_Violet, ?Color_Violet)
CatchImage(#Color_White, ?Color_White)
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()
Window = EventWindow()
If Event = #PB_Event_Gadget
Gadget=EventGadget()
;If Gadget>=30 And Gadget<=35
Type = EventType()
If Gadget>=30 And Gadget<=35
If Gadget>=30 And Gadget<=31
Active_ImID=ImageID(#V_knob_Light1)
ElseIf Gadget>=32 And Gadget<=33
Active_ImID=ImageID(#V_knob_Light2)
ElseIf Gadget>=34 And Gadget<=35
Active_ImID=ImageID(#V_knob_Light3)
EndIf
Type = EventType()
; Перемещение вертикального бегунка.
If Type = #PB_EventType_LeftClick Or Type = #PB_EventType_MouseWheel Or (Type = #PB_EventType_MouseMove And GetGadgetAttribute(Gadget, #PB_Canvas_Buttons) = #PB_Canvas_LeftButton)
If Type = #PB_EventType_MouseWheel
y=GetGadgetData(Gadget)-GetGadgetAttribute(Gadget, #PB_Canvas_WheelDelta)*2
Else
y=GetGadgetAttribute(Gadget, #PB_Canvas_MouseY)-12
EndIf
If y<1 : y=1 : EndIf ;********************************** y<1 : y=1 вместо y<0 : y=0
If y>87-23 : y = 87-23 : EndIf ;************************ 23 вместо 24
Draw_y(0, y, Gadget, ImageID(Gadget), Active_ImID)
SetGadgetData(Gadget, y)
Pos_y=GetGadgetData(Gadget)
Select Gadget
Case 30
Select Pos_y
;бла-бла...
EndSelect
Case 31
Select Pos_y
;бла-бла...
EndSelect
EndSelect
; Мышка или вошла в пределы регулятора или вышла из него.
ElseIf Type = #PB_EventType_MouseEnter Or Type = #PB_EventType_MouseLeave
If Type = #PB_EventType_MouseLeave ; Мышь вышла с передлов регулятора.
Active_ImID=0
EndIf
y=GetGadgetData(Gadget)
Draw_y(0, y, Gadget, ImageID(Gadget), Active_ImID)
EndIf
EndIf
If Gadget>=20 And Gadget<=29
If Gadget>=20 And Gadget<=22
Active_ImID=ImageID(#H_knob_Light1)
ElseIf Gadget>=23 And Gadget<=24
Active_ImID=ImageID(#H_knob_Light2)
ElseIf Gadget>=25 And Gadget<=28
Active_ImID=ImageID(#H_knob_Light3)
ElseIf Gadget=29
Active_ImID=ImID
EndIf
Type = EventType()
; Перемещение горизонтального бегунка.
If Type = #PB_EventType_LeftClick Or Type = #PB_EventType_MouseWheel Or (Type = #PB_EventType_MouseMove And GetGadgetAttribute(Gadget, #PB_Canvas_Buttons) = #PB_Canvas_LeftButton)
If Type = #PB_EventType_MouseWheel
x=GetGadgetData(Gadget)-GetGadgetAttribute(Gadget, #PB_Canvas_WheelDelta)*2
Else
x=GetGadgetAttribute(Gadget, #PB_Canvas_MouseX)-12
EndIf
If x<0 : x=0 : EndIf
If x>87-24 : x = 87-24 : EndIf
Debug x
Draw_x(x, 0, Gadget, ImageID(Gadget), Active_ImID)
SetGadgetData(Gadget, x)
Pos_x=GetGadgetData(Gadget)
Select Gadget
Case 29
z = Pos_x/10
Select z
Case 0
ImID = ImageID(#Color_Red)
Case 1
ImID = ImageID(#Color_Orange)
Case 2
ImID = ImageID(#Color_Yellow)
Case 3
ImID = ImageID(#Color_Green)
Case 4
ImID = ImageID(#Color_Blue)
Case 5
ImID = ImageID(#Color_Violet)
Case 6
ImID = ImageID(#Color_White)
EndSelect
EndSelect
; Мышка или вошла в пределы регулятора или вышла из него.
ElseIf Type = #PB_EventType_MouseEnter Or Type = #PB_EventType_MouseLeave
If Type = #PB_EventType_MouseLeave ; Мышь вышла с пределов регулятора.
Active_ImID=0
EndIf
x=GetGadgetData(Gadget)
Draw_x(x, 0, Gadget, ImageID(Gadget), Active_ImID)
EndIf
EndIf
EndIf
If Window = 0 And Event = #WM_MOUSEWHEEL
GetCursorPos_(@Cursor.POINT)
hWnd = WindowFromPoint_(Cursor\X|(Cursor\Y<<32))
Gadget=GetDlgCtrlID_(hWnd)
If Gadget>=20 And Gadget<=35
SendMessage_(hWnd, #WM_MOUSEWHEEL, EventwParam(), EventlParam())
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.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"
V_knob_Light2:
IncludeBinary "Files\V-knob2_Light.png"
V_knob_Light3:
IncludeBinary "Files\V-knob3_Light.png"
Color_Red:
IncludeBinary "Files\Color_Red.png"
Color_Orange:
IncludeBinary "Files\Color_Orange.png"
Color_Yellow:
IncludeBinary "Files\Color_Yellow.png"
Color_Green:
IncludeBinary "Files\Color_Green.png"
Color_Blue:
IncludeBinary "Files\Color_Blue.png"
Color_Violet:
IncludeBinary "Files\Color_Violet.png"
Color_White:
IncludeBinary "Files\Color_White.png"
Light_Button_Enable:
IncludeBinary "Files\Knob_pointer_White_Long.png"
;}
EndDataSection