-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmyForm.frm
executable file
·313 lines (271 loc) · 9.9 KB
/
myForm.frm
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} myForm
Caption = "SkanWord Edit 2.2"
ClientHeight = 2715
ClientLeft = 45
ClientTop = 435
ClientWidth = 7725
OleObjectBlob = "myForm.frx":0000
StartUpPosition = 1 'CenterOwner
End
Attribute VB_Name = "myForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim cfg As New clsConfig
Private Sub UserForm_Initialize()
CopLabel.Caption = "Copyright " & Chr(169) & _
" 2010" & Chr(10) & "Sancho," & Chr(10) & "www.cdrpro.ru"
fontName.Text = GetSetting(appName, appOpt, "Font Name", "ER_helv")
fontSize.Value = GetSetting(appName, appOpt, "Font Size", "6,5")
fontLine.Value = GetSetting(appName, appOpt, "Font Line", "100")
oWidth.Value = GetSetting(appName, appOpt, "Outline Width", "2")
cfg.Load
UpdateColor1 cfg.clrFontFill
UpdateColor2 cfg.clrObjFill
UpdateColor3 cfg.clrObjOutl
myLoadPresets
End Sub
Private Sub fontName_Change(): SaveSetting appName, appOpt, "Font Name", fontName.Text: End Sub
Private Sub fontSize_Change(): SaveSetting appName, appOpt, "Font Size", fontSize.Value: End Sub
Private Sub fontLine_Change(): SaveSetting appName, appOpt, "Font Line", fontLine.Value: End Sub
'Private Sub oRoundness_Change(): SaveSetting appName, appOpt, "Roundness", oRoundness.Value: End Sub
Private Sub oWidth_Change(): SaveSetting appName, appOpt, "Outline Width", oWidth.Value: End Sub
Private Sub cmTextColor_Click()
If cfg.clrFontFill.UserAssignEx() = False Then Exit Sub
UpdateColor1 cfg.clrFontFill
End Sub
Private Sub UpdateColor1(c As Color)
myConvertToRGB c
cmTextColor.BackColor = RGB(cRGB.RGBRed, cRGB.RGBGreen, cRGB.RGBBlue)
SaveSetting appName, appOpt, "Font Color", EncodeColor(c)
End Sub
Private Sub cm_fillColor_Click()
If cfg.clrObjFill.UserAssignEx() = False Then Exit Sub
UpdateColor2 cfg.clrObjFill
End Sub
Private Sub UpdateColor2(c As Color)
myConvertToRGB c
cm_fillColor.BackColor = RGB(cRGB.RGBRed, cRGB.RGBGreen, cRGB.RGBBlue)
SaveSetting appName, appOpt, "Fill Color", EncodeColor(c)
End Sub
Private Sub cm_oColor_Click()
If cfg.clrObjOutl.UserAssignEx() = False Then Exit Sub
UpdateColor3 cfg.clrObjOutl
End Sub
Private Sub UpdateColor3(c As Color)
myConvertToRGB c
cm_oColor.BackColor = RGB(cRGB.RGBRed, cRGB.RGBGreen, cRGB.RGBBlue)
SaveSetting appName, appOpt, "Outline Color", EncodeColor(c)
End Sub
Private Sub cm_Start_Click()
ActiveDocument.Unit = ActiveDocument.Rulers.HUnits
ActiveDocument.ReferencePoint = cdrCenter
ActiveDocument.BeginCommandGroup "SkanWorkEdit"
Optimization = True
Dim st As Shape, p As Page
For Each p In ActiveDocument.Pages
p.Activate
For Each st In p.FindShapes(, cdrTextShape)
If st.ParentGroup Is Nothing Then
If st.Text.Type = cdrArtisticText Or st.Text.Type = cdrArtisticFittedText Then Call DoEdit(st)
End If
Next
Next
Optimization = False
ActiveDocument.EndCommandGroup
Application.CorelScript.RedrawScreen
MsgBox "Ãîòîâî!", vbInformation, appName
End Sub
Private Sub DoEdit(st As Shape)
If cb_text.Value = True Then
st.Fill.UniformColor.CopyAssign cfg.clrFontFill
With st.Text.Story
.Font = fontName.Text
.Size = CSng(Replace(fontSize.Value, ".", ","))
.LineSpacing = CSng(Replace(fontLine.Value, ".", ","))
End With
'new 1 =============================
If cb_Perenos.Value = True Then
st.Text.Story.Text = Replace(st.Text.Story.Text, "*", "-" & vbCrLf, , , vbTextCompare)
End If
'new 1 =============================
End If
Dim s As Shape
Set s = ActivePage.SelectShapesAtPoint(st.PositionX, st.PositionY, False)
Dim sf As Shape
For Each sf In s.Shapes
If sf.Type = cdrRectangleShape Then
If cb_block.Value = True Then
sf.Fill.UniformColor.CopyAssign cfg.clrObjFill
sf.Outline.Width = CDbl(Replace(oWidth.Text, ".", ","))
sf.Outline.Color.CopyAssign cfg.clrObjOutl
End If
sf.Rectangle.CornerLowerLeft = CLng(cLL.Value)
sf.Rectangle.CornerLowerRight = CLng(cLR.Value)
sf.Rectangle.CornerUpperLeft = CLng(cUL.Value)
sf.Rectangle.CornerUpperRight = CLng(cUR.Value)
ActiveDocument.ClearSelection
st.CreateSelection: sf.AddToSelection
'Function AlignObjects(HorizontalAlignment As Long, VerticalAlignment As Long) As Long
Dim h&, v&
If aTL.Value Then
h = 2: v = 1
ElseIf aCL.Value Then
h = 2: v = 3
ElseIf aBL.Value Then
h = 2: v = 2
ElseIf aTC.Value Then
h = 3: v = 1
ElseIf aCC.Value Then
h = 3: v = 3
ElseIf aBC.Value Then
h = 3: v = 2
ElseIf aTR.Value Then
h = 1: v = 1
ElseIf aCR.Value Then
h = 1: v = 3
ElseIf aBR.Value Then
h = 1: v = 2
End If
CorelScript.AlignObjects h, v '1 - right/top 2 - left/bt 3 - center
'st.AlignToShape cdrAlignHCenter + cdrAlignVCenter, sf
Call sf.OrderToFront
Call st.OrderToFront
End If
Next
End Sub
' Convert color to RGB for display on the form
Private Sub myConvertToRGB(c As Color)
cRGB.CopyAssign c
cRGB.ConvertToRGB
End Sub
' Load Preset
Private Sub myLoadPresets()
Dim c&, i&, presName$
c = GetSetting(appName, appOpt, "PresetsCount", 0)
For i = 1 To c
presName = GetSetting(appName, appOpt, "Presets" & i & "Name")
If presName <> "" Then cb_presList.AddItem i & "| " & presName
Next i
End Sub
' Change Preset
Private Sub cb_presList_Change()
Dim i&, a$(), c1&, a2$()
If cb_presList.SelLength = 0 Then Exit Sub
For c1 = 0 To cb_presList.ListCount - 1 Step 1
If cb_presList.SelText = cb_presList.List(c1) Then
a2 = Split(cb_presList.SelText, "|")
i = CLng(a2(0))
Exit For
End If
Next c1
a = Split(GetSetting(appName, appOpt, "Presets" & i), "|")
Dim sAlign$
sAlign = a(0)
Select Case sAlign
Case "TL": aTL.Value = True
Case "CL": aCL.Value = True
Case "BL": aBL.Value = True
Case "TC": aTC.Value = True
Case "CC": aCC.Value = True
Case "BC": aBC.Value = True
Case "TR": aTR.Value = True
Case "CR": aCR.Value = True
Case "BR": aBR.Value = True
End Select
fontName.Text = a(1)
fontSize.Text = a(2)
DecodeColor cfg.clrFontFill, a(3)
UpdateColor1 cfg.clrFontFill
DecodeColor cfg.clrObjFill, a(4)
UpdateColor2 cfg.clrObjFill
DecodeColor cfg.clrObjOutl, a(5)
UpdateColor3 cfg.clrObjOutl
oWidth.Text = a(6)
cLL.Value = a(7)
cLR.Value = a(8)
cUL.Value = a(9)
cUR.Value = a(10)
If UBound(a) = 13 Then
cb_text.Value = a(11)
cb_block.Value = a(12)
fontLine.Text = a(13)
End If
'new 1 =============================
If UBound(a) = 14 Then
cb_text.Value = a(11)
cb_block.Value = a(12)
fontLine.Text = a(13)
cb_Perenos.Value = a(14)
End If
End Sub
' Add Preset
Private Sub cm_presAdd_Click()
Dim strPres$, strPresN$, c&
c = GetSetting(appName, appOpt, "PresetsCount", 0)
c = c + 1
strPresN = InputBox("Name for Preset", "Name...")
If strPresN = "" Then Exit Sub
Dim sAlign$
If aTL.Value Then
sAlign = "TL"
ElseIf aCL.Value Then
sAlign = "CL"
ElseIf aBL.Value Then
sAlign = "BL"
ElseIf aTC.Value Then
sAlign = "TC"
ElseIf aCC.Value Then
sAlign = "CC"
ElseIf aBC.Value Then
sAlign = "BC"
ElseIf aTR.Value Then
sAlign = "TR"
ElseIf aCR.Value Then
sAlign = "CR"
ElseIf aBR.Value Then
sAlign = "BR"
End If
strPres = sAlign & "|" & fontName.Text & "|" & fontSize.Text & "|" & EncodeColor(cfg.clrFontFill) & "|" & _
EncodeColor(cfg.clrObjFill) & "|" & EncodeColor(cfg.clrObjOutl) & "|" & oWidth.Text & "|" & _
cLL.Value & "|" & cLR.Value & "|" & cUL.Value & "|" & cUR.Value & "|" & _
cb_text.Value & "|" & cb_block.Value & "|" & fontLine.Text & "|" & cb_Perenos.Value
SaveSetting appName, appOpt, "Presets" & c, strPres
SaveSetting appName, appOpt, "Presets" & c & "Name", strPresN
cb_presList.AddItem c & "| " & strPresN
cb_presList.Text = c & "| " & strPresN
SaveSetting appName, appOpt, "PresetsCount", c
End Sub
' Delete Preset
Private Sub cm_presDel_Click()
Dim i&, c&, i2&, a$(), c1&
If cb_presList.SelLength = 0 Then Exit Sub
For c1 = 0 To cb_presList.ListCount - 1 Step 1
If cb_presList.SelText = cb_presList.List(c1) Then
a = Split(cb_presList.SelText, "|")
i = CLng(a(0))
Exit For
End If
Next c1
cb_presList.Clear
c = CLng(GetSetting(appName, appOpt, "PresetsCount", 0))
If i < c Then
For i2 = i + 1 To c Step 1
SaveSetting appName, appOpt, "Presets" & i, _
GetSetting(appName, appOpt, "Presets" & i2)
SaveSetting appName, appOpt, "Presets" & i & "Name", _
GetSetting(appName, appOpt, "Presets" & i2 & "Name")
i = i + 1
Next i2
DeleteSetting appName, appOpt, "Presets" & c
DeleteSetting appName, appOpt, "Presets" & c & "Name"
Else
DeleteSetting appName, appOpt, "Presets" & i
DeleteSetting appName, appOpt, "Presets" & i & "Name"
End If
SaveSetting appName, appOpt, "PresetsCount", c - 1
myLoadPresets
End Sub