summaryrefslogtreecommitdiff
path: root/wizards/source/schedule/DlgControl.xba
blob: 275e507fa241393638396547f31f10f1d2bd0ee7 (plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="DlgControl" script:language="StarBasic">Option Explicit

Dim CalBitmap As Object
Public bSelectByMouseMove as Boolean
Public fHeightCorrFactor as Double
Public fWidthCorrFactor as Double



Sub Main()
	Call CalAutopilotTable()
End Sub


Sub CalcmdDeleteSelect()
Dim MsgBoxResult as Integer
Dim bDoEnable as Boolean
Dim iSel as Integer
Dim MaxIndex as Integer
	If Ubound(DlgCalModel.lstOwnData.SelectedItems()) &gt; -1 Then
		MsgBoxResult = MsgBox(cCalSubcmdDeleteSelect_DeleteSelEntry$, 4+32, cCalSubcmdDeleteSelect_DeleteSelEntryTitle$)
		If MsgBoxResult = 6 Then
			iSel = DlgCalModel.lstOwnData.SelectedItems(0)
			DlgCalModel.lstOwnData.StringItemList() = RemoveSelected(DlgCalModel.lstOwnData)
			&apos; Flag to store the new data
			bCalOwnDataChanged = True
			bDoEnable = Ubound(DlgCalModel.lstOwnData.StringItemList()) &gt; -1
			DlgCalModel.cmdDelete.Enabled = bDoEnable
			If bDoEnable Then
				MaxIndex = Ubound(DlgCalModel.lstOwnData.StringItemList()) 
				If iSel &gt; MaxIndex Then
					iSel = MaxIndex
				End If
				DlgCalendar.GetControl(&quot;lstOwnData&quot;).SelectItemPos(iSel, True)
				CalUpdateNewEventFrame()
			Else
				Call CalClearInputMask()
			End If
		End If
	End If
End Sub


Sub CalSaveOwnEventControls()
	With DlgCalModel
		.txtOwnEventDay.Tag = .txtOwnEventDay.Value
		.txtOwnEventMonth.Tag = .txtOwnEventMonth.Text
	End With
End Sub


Sub CalMouseMoved(aEvent as object)
Dim ListIndex as Integer
	Select Case sCurLangLocale
		Case  cLANGUAGE_GERMAN
			If bSelectByMouseMove Then
&apos;				oStatusLine.SetText(&quot;Position: &quot; &amp; aEvent.X &amp; &quot; ; &quot; &amp; aEvent.Y)
				ListIndex = CalGetGermanLandAtMousePos(CInt(aEvent.X/fWidthCorrFactor), CInt(aEvent.Y/fHeightCorrFactor), Land$)
				DlgCalendar.GetControl(&quot;lstHolidays&quot;).SelectItemPos(ListIndex, True)
			End If
	End Select	
End Sub


Sub SelectState(aEvent as Object)
Dim ListIndex as Integer
	Select Case sCurLangLocale
		Case  cLANGUAGE_GERMAN
			If aEvent.ClickCount &gt;= 1 Then
				ListIndex = CalGetGermanLandAtMousePos(CInt(aEvent.X/fWidthCorrFactor), CInt(aEvent.Y/fHeightCorrFactor), Land$)
			DlgCalendar.GetControl(&quot;lstHolidays&quot;).SelectItemPos(ListIndex, True)
			bSelectByMouseMove = False
		End If
	End Select
End Sub


Sub MouseLeavesImage
	bSelectbyMouseMove = True
End Sub


Sub CalClearInputMask()
Dim NullList() as String
	With DlgCalModel
		.txtEvent.Text = &quot;&quot;
		.txtOwnEventDay.SetPropertyToDefault(&quot;Value&quot;)
		.cmdInsert.Enabled = False
	End With
	If Ubound(DlgCalModel.lstOwnData.StringItemList()) &gt; -1 Then
		If Ubound(DlgCalModel.lstOwnData.SelectedItems()) = -1 Then
			DlgCalendar.GetControl(&quot;lstOwnData&quot;).SelectItemPos(0,True)
			CalUpdateNewEventFrame()
		End If
	End If
End Sub


Sub CalmdSwitchOwnDataOrGeneral()
	If DlgCalModel.Step = 1 Then
		DlgCalModel.Step = 2
		DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_Back$
		DlgCalModel.cmdInsert.Enabled = DlgCalModel.txtEvent.Text &lt;&gt; &quot;&quot;
&apos;		ToggleYearBox()
	Else
		dim bla as boolean
		DlgCalModel.Step = 1
		DlgCalendar.GetControl(&quot;lblHolidays&quot;).Visible = sCurLangLocale  = cLANGUAGE_GERMAN
		DlgCalendar.GetControl(&quot;lstHolidays&quot;).Visible = sCurLangLocale  = cLANGUAGE_GERMAN
		DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_OwnData$
	End If
End Sub


Sub ToggleInsertButton()
	DlgCalModel.cmdInsert.Enabled = LTrim(DlgCalModel.txtEvent.Text) &lt;&gt; &quot;&quot;	
End Sub


Sub CalUpdateNewEventFrame()
Dim bDoEnable as Boolean
Dim sSelectedItem
Dim ListIndex as Integer
Dim MaxSelIndex as Integer
Dim CurEvMonth as Integer
Dim CurEvDay as Integer
Dim DateStr as String
	bDoEnable = False
	With DlgCalModel
		MaxSelIndex = Ubound(DlgCalModel.lstOwnData.SelectedItems())
		If MaxSelIndex &gt; -1 Then
			ListIndex = .lstOwnData.SelectedItems(MaxSelIndex)
			.txtEvent.Text = CalGetNameofEvent(ListIndex)
			If GetSelectedDateUnits(CurEvDay, CurEvMonth, ListIndex) &lt;&gt; SBDATEUNDEFINED Then
				.txtOwnEventDay.Value = CurEvDay
				DlgCalendar.GetControl(&quot;lstOwnEventMonth&quot;).SelectItemPos(CurEvMonth-1, True)
				.cmdDelete.Enabled = True
				.cmdInsert.Enabled = True
			Else
				Call CalClearInputMask()
				.cmdDelete.Enabled = True
			End If
		End If
	End With
End Sub</script:module>