diff --git a/Src/ScxmlEditor.res b/Src/ScxmlEditor.res index 3922b27..7bb067f 100644 Binary files a/Src/ScxmlEditor.res and b/Src/ScxmlEditor.res differ diff --git a/Src/TreeEditor/UnitTreeEditorUtils.cpp b/Src/TreeEditor/UnitTreeEditorUtils.cpp index 9476312..c487e95 100644 --- a/Src/TreeEditor/UnitTreeEditorUtils.cpp +++ b/Src/TreeEditor/UnitTreeEditorUtils.cpp @@ -1,34 +1,34 @@ /*********************************************************************************** - BSD 3-Clause License +BSD 3-Clause License - Copyright (c) 2018, https://github.com/alexzhornyak - All rights reserved. +Copyright (c) 2018, https://github.com/alexzhornyak +All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. + * Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. + * Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. - * Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. + * Neither the name of the copyright holder nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***************************************************************************************/ +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************/ #include #pragma hdrstop @@ -310,8 +310,7 @@ namespace Editorutils { const bool bAreNotNested = RectInsideRect(AFromShape->Bounds(), AToShape->Bounds()) == false; - if ((AConnection->Style == csSides || AConnection->Style == csInvertedSides) && bAreBrothers && bAreDifferent && bAreNotNested) - { + if ((AConnection->Style == csSides || AConnection->Style == csInvertedSides) && bAreBrothers && bAreDifferent) { for (int k = 1; k < AConnection->Points->Count(); k++) { TPoint AFixed1(AConnection->Points->Item[k - 1].X, AConnection->Points->Item[k - 1].Y); @@ -408,27 +407,31 @@ namespace Editorutils { /* ÀÍÀËÈÇÈÐÓÅÌ ÏÎËÓ×ÅÍÍÛÅ ÏÅÐÅÑÅ×ÅÍÈß */ - if (IsTypes.Contains(isFromPrev)) { - switch(AConnection->Style) { - case csSides: - AConnection->Points->Move(k - 1, 0, -ClipArray[isFromPrev].y1clip + ClipArray[isFromPrev].y0clip); - break; - case csInvertedSides: - AConnection->Points->Move(k - 1, ClipArray[isFromPrev].x1clip - ClipArray[isFromPrev].x0clip, 0); - break; - } + // fix: https://github.com/alexzhornyak/ScxmlEditor-Tutorial/issues/107 + if (bAreNotNested || k - 1 != 0) { + if (IsTypes.Contains(isFromPrev)) { + switch(AConnection->Style) { + case csSides: + AConnection->Points->Move(k - 1, 0, -ClipArray[isFromPrev].y1clip + ClipArray[isFromPrev].y0clip); + break; + case csInvertedSides: + AConnection->Points->Move(k - 1, ClipArray[isFromPrev].x1clip - ClipArray[isFromPrev].x0clip, 0); + break; + } - } - if (IsTypes.Contains(isFromCur)) { - switch(AConnection->Style) { - case csSides: - AConnection->Points->Move(k - 1, ClipArray[isFromCur].x1clip - ClipArray[isFromCur].x0clip, 0); - break; - case csInvertedSides: - AConnection->Points->Move(k - 1, 0, -ClipArray[isFromCur].y1clip + ClipArray[isFromCur].y0clip); - break; + } + if (IsTypes.Contains(isFromCur)) { + switch(AConnection->Style) { + case csSides: + AConnection->Points->Move(k - 1, ClipArray[isFromCur].x1clip - ClipArray[isFromCur].x0clip, 0); + break; + case csInvertedSides: + AConnection->Points->Move(k - 1, 0, -ClipArray[isFromCur].y1clip + ClipArray[isFromCur].y0clip); + break; + } } } + if (IsTypes.Contains(isToPrev)) { switch(AConnection->Style) { case csSides: diff --git a/Src/UnitSettings.cpp b/Src/UnitSettings.cpp index acd50bd..329ddab 100644 --- a/Src/UnitSettings.cpp +++ b/Src/UnitSettings.cpp @@ -128,6 +128,8 @@ __fastcall TSettingsData::TSettingsData(TComponent* Owner) : TSettingsBase(Owner FWarningOnBindingsNotFound = true; FUseVectorImages = false; + FCompletionTimeoutEnabled = true; + FCompletionTimeoutMsec = 50; FValidateInPredicate = false; FValidateChildren = true; @@ -261,6 +263,8 @@ void __fastcall TSettingsData::Assign(TPersistent* Source) { FWarningOnInheritanceMismatch = ASettingsData->FWarningOnInheritanceMismatch; FWarningOnBindingsNotFound = ASettingsData->FWarningOnBindingsNotFound; FUseVectorImages = ASettingsData->FUseVectorImages; + FCompletionTimeoutEnabled = ASettingsData->FCompletionTimeoutEnabled; + FCompletionTimeoutMsec = ASettingsData->FCompletionTimeoutMsec; FValidateInPredicate = ASettingsData->FValidateInPredicate; FValidateChildren = ASettingsData->FValidateChildren; FValidateXMLText = ASettingsData->FValidateXMLText; @@ -480,6 +484,8 @@ void __fastcall TSettingsData::PropSettingsRegisterCategories(TLMDPropertyInspec APropSettingsInspector->RegisterPropCategory(L"Scxml editor", L"WarningOnInheritanceMismatch"); APropSettingsInspector->RegisterPropCategory(L"Scxml editor", L"WarningOnBindingsNotFound"); APropSettingsInspector->RegisterPropCategory(L"Scxml editor", L"UseVectorImages"); + APropSettingsInspector->RegisterPropCategory(L"Scxml editor", L"CompletionTimeoutEnabled"); + // APropSettingsInspector->RegisterPropCategory(L"Scxml editor", L"CompletionTimeoutMsec"); APropSettingsInspector->RegisterPropCategory(L"Visual", L"ChartFocusEnabled"); APropSettingsInspector->RegisterPropCategory(L"Visual", L"ChartFocusLineWidth"); diff --git a/Src/UnitSettings.h b/Src/UnitSettings.h index d3e0325..b4266f7 100644 --- a/Src/UnitSettings.h +++ b/Src/UnitSettings.h @@ -176,6 +176,8 @@ class TSettingsData: public TSettingsBase bool FWarningOnBindingsNotFound; bool FUseVectorImages; + bool FCompletionTimeoutEnabled; + int FCompletionTimeoutMsec; bool FValidateInPredicate; bool FValidateChildren; @@ -387,6 +389,10 @@ class TSettingsData: public TSettingsBase __property TAutoCompleteItems * AutoCompleteItems = {read=FAutoCompleteItems, write=SetAutoCompleteItems }; __property UnicodeString ActiveSyntaxScheme = {read=GetActiveSyntaxScheme}; __property UnicodeString WordSeparators = {read=GetWordSeparators}; + __property bool CompletionTimeoutEnabled = {read=FCompletionTimeoutEnabled, write=FCompletionTimeoutEnabled, default=true}; + + // bug in LMD: Completion Timeout is not exposed properly + // __property int CompletionTimeoutMsec = {read=FCompletionTimeoutMsec, write=FCompletionTimeoutMsec, default=50}; // extern editor diff --git a/Src/UnitStateMachineConnection.cpp b/Src/UnitStateMachineConnection.cpp index 7c5ded4..6651a41 100644 --- a/Src/UnitStateMachineConnection.cpp +++ b/Src/UnitStateMachineConnection.cpp @@ -868,6 +868,7 @@ void __fastcall TStateMachineConnection::AssignStateMachineConnection(TStateMach FEvent = AStateMachineConnection->FEvent; FCondition = AStateMachineConnection->FCondition; FConditionBack = AStateMachineConnection->FConditionBack; + FType = AStateMachineConnection->FType; FAdjustableSides = AStateMachineConnection->FAdjustableSides; FContentTrigger->Assign(AStateMachineConnection->FContentTrigger); FParams->Assign(AStateMachineConnection->FParams); diff --git a/Src/UnitStateMachineUnit.cpp b/Src/UnitStateMachineUnit.cpp index dcc08e1..d2d3456 100644 --- a/Src/UnitStateMachineUnit.cpp +++ b/Src/UnitStateMachineUnit.cpp @@ -536,7 +536,16 @@ void __fastcall TStateMachineEditorUnit::DoLoad(const Lmdtypes::TLMDString AFile // --------------------------------------------------------------------------- void __fastcall TStateMachineEditorUnit::DoSave(const Lmdtypes::TLMDString AFilePath) { - SaveAssociatedFile("code", AFilePath, FilePath); + try { + SaveAssociatedFile("code", AFilePath, FilePath); + } + catch(Exception * E) { + // Fix: https://github.com/alexzhornyak/ScxmlEditor-Tutorial/issues/105 + if (StateMachineDockPanel) { + StateMachineDockPanel->MarkModified(0, L"", false); + } + throw E; + } const UnicodeString sFileName = ExtractFileName(AFilePath); diff --git a/Src/UnitSyntaxEditor.cpp b/Src/UnitSyntaxEditor.cpp index d50a112..6ea56c6 100644 --- a/Src/UnitSyntaxEditor.cpp +++ b/Src/UnitSyntaxEditor.cpp @@ -1,34 +1,34 @@ /*********************************************************************************** - BSD 3-Clause License +BSD 3-Clause License - Copyright (c) 2018, https://github.com/alexzhornyak - All rights reserved. +Copyright (c) 2018, https://github.com/alexzhornyak +All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. + * Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. + * Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. - * Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. + * Neither the name of the copyright holder nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -***************************************************************************************/ +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************/ #include #pragma hdrstop @@ -89,6 +89,10 @@ __fastcall TFrameSyntaxEditor::TFrameSyntaxEditor(TComponent* Owner) : TFrame(Ow break; } } + + EditView->CompletionSettings->ShowCompletionOnTimeout = SettingsData->CompletionTimeoutEnabled; + // bug in LMD: Completion Timeout is not exposed properly + // EditView->CompletionSettings->ShowTimeout = SettingsData->CompletionTimeoutMsec; } } diff --git a/Src/UnitSyntaxEditor.dfm b/Src/UnitSyntaxEditor.dfm index 9e7df92..1b817b0 100644 --- a/Src/UnitSyntaxEditor.dfm +++ b/Src/UnitSyntaxEditor.dfm @@ -45,8 +45,7 @@ object FrameSyntaxEditor: TFrameSyntaxEditor Top = 0 Width = 853 Height = 29 - ButtonHeight = 0 - ButtonWidth = 0 + ButtonWidth = 70 Caption = 'ToolBar1' Images = ImageList1 List = True @@ -58,7 +57,7 @@ object FrameSyntaxEditor: TFrameSyntaxEditor Left = 304 Top = 248 Bitmap = { - 494C01011C00A000380110001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 + 494C01011C00A0003C0110001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 0000000000003600000028000000400000008000000001002000000000000080 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000