forked from gphilippot/purebasic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GotoWindow.pb
58 lines (39 loc) · 1.4 KB
/
GotoWindow.pb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
;--------------------------------------------------------------------------------------------
; Copyright (c) Fantaisie Software. All rights reserved.
; Dual licensed under the GPL and Fantaisie Software licenses.
; See LICENSE and LICENSE-FANTAISIE in the project root for license information.
;--------------------------------------------------------------------------------------------
Procedure OpenGotoWindow()
If *ActiveSource <> *ProjectInfo
GotoWindowDialog = OpenDialog(?Dialog_Goto, WindowID(#WINDOW_Main))
EnsureWindowOnDesktop(#WINDOW_Goto)
SetActiveGadget(#GADGET_Goto_Line)
EndIf
EndProcedure
Procedure GotoWindowEvents(EventID)
If EventID = #PB_Event_Menu ; Little wrapper to map the shortcut events (identified as menu)
EventID = #PB_Event_Gadget ; to normal gadget events...
GadgetID = EventMenu()
Else
GadgetID = EventGadget()
EndIf
Select EventID
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select GadgetID
Case #GADGET_Goto_Ok
Quit = 1 : ChangeLine = 1
Case #GADGET_Goto_Cancel
Quit = 1
EndSelect
EndSelect
If ChangeLine
If *ActiveSource <> *ProjectInfo
ChangeActiveLine(Val(GetGadgetText(#GADGET_Goto_Line)), -5)
EndIf
EndIf
If Quit
GotoWindowDialog\Close()
EndIf
EndProcedure