Skip to content

Commit 92c14a3

Browse files
committed
Closes #105, Closes #106, Closes #107 and Fixes #108
1 parent b36d280 commit 92c14a3

File tree

8 files changed

+100
-72
lines changed

8 files changed

+100
-72
lines changed

Src/ScxmlEditor.res

0 Bytes
Binary file not shown.

Src/TreeEditor/UnitTreeEditorUtils.cpp

Lines changed: 47 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
/***********************************************************************************
2-
BSD 3-Clause License
2+
BSD 3-Clause License
33
4-
Copyright (c) 2018, https://github.com/alexzhornyak
5-
All rights reserved.
4+
Copyright (c) 2018, https://github.com/alexzhornyak
5+
All rights reserved.
66
7-
Redistribution and use in source and binary forms, with or without
8-
modification, are permitted provided that the following conditions are met:
7+
Redistribution and use in source and binary forms, with or without
8+
modification, are permitted provided that the following conditions are met:
99
10-
* Redistributions of source code must retain the above copyright notice, this
11-
list of conditions and the following disclaimer.
10+
* Redistributions of source code must retain the above copyright notice, this
11+
list of conditions and the following disclaimer.
1212
13-
* Redistributions in binary form must reproduce the above copyright notice,
14-
this list of conditions and the following disclaimer in the documentation
15-
and/or other materials provided with the distribution.
13+
* Redistributions in binary form must reproduce the above copyright notice,
14+
this list of conditions and the following disclaimer in the documentation
15+
and/or other materials provided with the distribution.
1616
17-
* Neither the name of the copyright holder nor the names of its
18-
contributors may be used to endorse or promote products derived from
19-
this software without specific prior written permission.
17+
* Neither the name of the copyright holder nor the names of its
18+
contributors may be used to endorse or promote products derived from
19+
this software without specific prior written permission.
2020
21-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31-
***************************************************************************************/
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
***************************************************************************************/
3232

3333
#include <vcl.h>
3434
#pragma hdrstop
@@ -310,8 +310,7 @@ namespace Editorutils {
310310

311311
const bool bAreNotNested = RectInsideRect(AFromShape->Bounds(), AToShape->Bounds()) == false;
312312

313-
if ((AConnection->Style == csSides || AConnection->Style == csInvertedSides) && bAreBrothers && bAreDifferent && bAreNotNested)
314-
{
313+
if ((AConnection->Style == csSides || AConnection->Style == csInvertedSides) && bAreBrothers && bAreDifferent) {
315314

316315
for (int k = 1; k < AConnection->Points->Count(); k++) {
317316
TPoint AFixed1(AConnection->Points->Item[k - 1].X, AConnection->Points->Item[k - 1].Y);
@@ -408,27 +407,31 @@ namespace Editorutils {
408407

409408
/* ÀÍÀËÈÇÈÐÓÅÌ ÏÎËÓ×ÅÍÍÛÅ ÏÅÐÅÑÅ×ÅÍÈß */
410409

411-
if (IsTypes.Contains(isFromPrev)) {
412-
switch(AConnection->Style) {
413-
case csSides:
414-
AConnection->Points->Move(k - 1, 0, -ClipArray[isFromPrev].y1clip + ClipArray[isFromPrev].y0clip);
415-
break;
416-
case csInvertedSides:
417-
AConnection->Points->Move(k - 1, ClipArray[isFromPrev].x1clip - ClipArray[isFromPrev].x0clip, 0);
418-
break;
419-
}
410+
// fix: https://github.com/alexzhornyak/ScxmlEditor-Tutorial/issues/107
411+
if (bAreNotNested || k - 1 != 0) {
412+
if (IsTypes.Contains(isFromPrev)) {
413+
switch(AConnection->Style) {
414+
case csSides:
415+
AConnection->Points->Move(k - 1, 0, -ClipArray[isFromPrev].y1clip + ClipArray[isFromPrev].y0clip);
416+
break;
417+
case csInvertedSides:
418+
AConnection->Points->Move(k - 1, ClipArray[isFromPrev].x1clip - ClipArray[isFromPrev].x0clip, 0);
419+
break;
420+
}
420421

421-
}
422-
if (IsTypes.Contains(isFromCur)) {
423-
switch(AConnection->Style) {
424-
case csSides:
425-
AConnection->Points->Move(k - 1, ClipArray[isFromCur].x1clip - ClipArray[isFromCur].x0clip, 0);
426-
break;
427-
case csInvertedSides:
428-
AConnection->Points->Move(k - 1, 0, -ClipArray[isFromCur].y1clip + ClipArray[isFromCur].y0clip);
429-
break;
422+
}
423+
if (IsTypes.Contains(isFromCur)) {
424+
switch(AConnection->Style) {
425+
case csSides:
426+
AConnection->Points->Move(k - 1, ClipArray[isFromCur].x1clip - ClipArray[isFromCur].x0clip, 0);
427+
break;
428+
case csInvertedSides:
429+
AConnection->Points->Move(k - 1, 0, -ClipArray[isFromCur].y1clip + ClipArray[isFromCur].y0clip);
430+
break;
431+
}
430432
}
431433
}
434+
432435
if (IsTypes.Contains(isToPrev)) {
433436
switch(AConnection->Style) {
434437
case csSides:

Src/UnitSettings.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ __fastcall TSettingsData::TSettingsData(TComponent* Owner) : TSettingsBase(Owner
128128
FWarningOnBindingsNotFound = true;
129129

130130
FUseVectorImages = false;
131+
FCompletionTimeoutEnabled = true;
132+
FCompletionTimeoutMsec = 50;
131133

132134
FValidateInPredicate = false;
133135
FValidateChildren = true;
@@ -261,6 +263,8 @@ void __fastcall TSettingsData::Assign(TPersistent* Source) {
261263
FWarningOnInheritanceMismatch = ASettingsData->FWarningOnInheritanceMismatch;
262264
FWarningOnBindingsNotFound = ASettingsData->FWarningOnBindingsNotFound;
263265
FUseVectorImages = ASettingsData->FUseVectorImages;
266+
FCompletionTimeoutEnabled = ASettingsData->FCompletionTimeoutEnabled;
267+
FCompletionTimeoutMsec = ASettingsData->FCompletionTimeoutMsec;
264268
FValidateInPredicate = ASettingsData->FValidateInPredicate;
265269
FValidateChildren = ASettingsData->FValidateChildren;
266270
FValidateXMLText = ASettingsData->FValidateXMLText;
@@ -480,6 +484,8 @@ void __fastcall TSettingsData::PropSettingsRegisterCategories(TLMDPropertyInspec
480484
APropSettingsInspector->RegisterPropCategory(L"Scxml editor", L"WarningOnInheritanceMismatch");
481485
APropSettingsInspector->RegisterPropCategory(L"Scxml editor", L"WarningOnBindingsNotFound");
482486
APropSettingsInspector->RegisterPropCategory(L"Scxml editor", L"UseVectorImages");
487+
APropSettingsInspector->RegisterPropCategory(L"Scxml editor", L"CompletionTimeoutEnabled");
488+
// APropSettingsInspector->RegisterPropCategory(L"Scxml editor", L"CompletionTimeoutMsec");
483489

484490
APropSettingsInspector->RegisterPropCategory(L"Visual", L"ChartFocusEnabled");
485491
APropSettingsInspector->RegisterPropCategory(L"Visual", L"ChartFocusLineWidth");

Src/UnitSettings.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ class TSettingsData: public TSettingsBase
176176
bool FWarningOnBindingsNotFound;
177177

178178
bool FUseVectorImages;
179+
bool FCompletionTimeoutEnabled;
180+
int FCompletionTimeoutMsec;
179181

180182
bool FValidateInPredicate;
181183
bool FValidateChildren;
@@ -387,6 +389,10 @@ class TSettingsData: public TSettingsBase
387389
__property TAutoCompleteItems * AutoCompleteItems = {read=FAutoCompleteItems, write=SetAutoCompleteItems };
388390
__property UnicodeString ActiveSyntaxScheme = {read=GetActiveSyntaxScheme};
389391
__property UnicodeString WordSeparators = {read=GetWordSeparators};
392+
__property bool CompletionTimeoutEnabled = {read=FCompletionTimeoutEnabled, write=FCompletionTimeoutEnabled, default=true};
393+
394+
// bug in LMD: Completion Timeout is not exposed properly
395+
// __property int CompletionTimeoutMsec = {read=FCompletionTimeoutMsec, write=FCompletionTimeoutMsec, default=50};
390396

391397

392398
// extern editor

Src/UnitStateMachineConnection.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,7 @@ void __fastcall TStateMachineConnection::AssignStateMachineConnection(TStateMach
868868
FEvent = AStateMachineConnection->FEvent;
869869
FCondition = AStateMachineConnection->FCondition;
870870
FConditionBack = AStateMachineConnection->FConditionBack;
871+
FType = AStateMachineConnection->FType;
871872
FAdjustableSides = AStateMachineConnection->FAdjustableSides;
872873
FContentTrigger->Assign(AStateMachineConnection->FContentTrigger);
873874
FParams->Assign(AStateMachineConnection->FParams);

Src/UnitStateMachineUnit.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,16 @@ void __fastcall TStateMachineEditorUnit::DoLoad(const Lmdtypes::TLMDString AFile
536536

537537
// ---------------------------------------------------------------------------
538538
void __fastcall TStateMachineEditorUnit::DoSave(const Lmdtypes::TLMDString AFilePath) {
539-
SaveAssociatedFile("code", AFilePath, FilePath);
539+
try {
540+
SaveAssociatedFile("code", AFilePath, FilePath);
541+
}
542+
catch(Exception * E) {
543+
// Fix: https://github.com/alexzhornyak/ScxmlEditor-Tutorial/issues/105
544+
if (StateMachineDockPanel) {
545+
StateMachineDockPanel->MarkModified(0, L"", false);
546+
}
547+
throw E;
548+
}
540549

541550
const UnicodeString sFileName = ExtractFileName(AFilePath);
542551

Src/UnitSyntaxEditor.cpp

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
/***********************************************************************************
2-
BSD 3-Clause License
2+
BSD 3-Clause License
33
4-
Copyright (c) 2018, https://github.com/alexzhornyak
5-
All rights reserved.
4+
Copyright (c) 2018, https://github.com/alexzhornyak
5+
All rights reserved.
66
7-
Redistribution and use in source and binary forms, with or without
8-
modification, are permitted provided that the following conditions are met:
7+
Redistribution and use in source and binary forms, with or without
8+
modification, are permitted provided that the following conditions are met:
99
10-
* Redistributions of source code must retain the above copyright notice, this
11-
list of conditions and the following disclaimer.
10+
* Redistributions of source code must retain the above copyright notice, this
11+
list of conditions and the following disclaimer.
1212
13-
* Redistributions in binary form must reproduce the above copyright notice,
14-
this list of conditions and the following disclaimer in the documentation
15-
and/or other materials provided with the distribution.
13+
* Redistributions in binary form must reproduce the above copyright notice,
14+
this list of conditions and the following disclaimer in the documentation
15+
and/or other materials provided with the distribution.
1616
17-
* Neither the name of the copyright holder nor the names of its
18-
contributors may be used to endorse or promote products derived from
19-
this software without specific prior written permission.
17+
* Neither the name of the copyright holder nor the names of its
18+
contributors may be used to endorse or promote products derived from
19+
this software without specific prior written permission.
2020
21-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31-
***************************************************************************************/
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
***************************************************************************************/
3232

3333
#include <vcl.h>
3434
#pragma hdrstop
@@ -89,6 +89,10 @@ __fastcall TFrameSyntaxEditor::TFrameSyntaxEditor(TComponent* Owner) : TFrame(Ow
8989
break;
9090
}
9191
}
92+
93+
EditView->CompletionSettings->ShowCompletionOnTimeout = SettingsData->CompletionTimeoutEnabled;
94+
// bug in LMD: Completion Timeout is not exposed properly
95+
// EditView->CompletionSettings->ShowTimeout = SettingsData->CompletionTimeoutMsec;
9296
}
9397
}
9498

Src/UnitSyntaxEditor.dfm

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ object FrameSyntaxEditor: TFrameSyntaxEditor
4545
Top = 0
4646
Width = 853
4747
Height = 29
48-
ButtonHeight = 0
49-
ButtonWidth = 0
48+
ButtonWidth = 70
5049
Caption = 'ToolBar1'
5150
Images = ImageList1
5251
List = True
@@ -58,7 +57,7 @@ object FrameSyntaxEditor: TFrameSyntaxEditor
5857
Left = 304
5958
Top = 248
6059
Bitmap = {
61-
494C01011C00A000380110001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
60+
494C01011C00A0003C0110001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
6261
0000000000003600000028000000400000008000000001002000000000000080
6362
0000000000000000000000000000000000000000000000000000000000000000
6463
0000000000000000000000000000000000000000000000000000000000000000

0 commit comments

Comments
 (0)