Skip to content

Commit

Permalink
Closes #117, Closes #118, Closes #119
Browse files Browse the repository at this point in the history
  • Loading branch information
alexzhornyak committed Jul 25, 2024
1 parent e6bc8f7 commit ae846db
Show file tree
Hide file tree
Showing 17 changed files with 456 additions and 162 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

**[Video overview - v.2.2](https://youtu.be/30dyXAs-m1A)**

# Scxml Editor 2.5.4
# Scxml Editor 2.5.5
Powerful tool for creating, editing and debugging SCXML charts.

![MainExample](Images/Inheritance_TV_example.gif)
Expand All @@ -24,6 +24,7 @@ Powerful tool for creating, editing and debugging SCXML charts.
[![Discord](Images/Discord.svg)](https://discord.gg/5XWDsbEXzn)

### Changelog
**2.5.5:** Chart design panel view presets <br>
**2.5.4:** Nested initial state indication <br>
**2.5.3:** Chart Draw Constraints, Select Chart Elements <br>
**2.5.1:** [Fast Triggers](Doc/DebugScxmlStateCharts.md#transition-triggers) <br>
Expand Down Expand Up @@ -52,7 +53,7 @@ Powerful tool for creating, editing and debugging SCXML charts.
## Installation
You can find portable version as attached Zip in ScxmlEditor Github Release page

Latest version: **[2.5.4.1769]**
Latest version: **[2.5.5.1755]**

### Windows Installation
#### First Install
Expand Down
7 changes: 7 additions & 0 deletions Src/CommonConsts.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#define WM_SCXML_DELETE_TREE_SHAPE WM_USER+106
#define WM_SCXML_ADD_OR_OPEN_EXISTING_UNIT WM_USER+107
#define WM_SCXML_UPDATE_DBG_MSG_QUEUE WM_USER+108
#define WM_SCXML_EDIT_TREE_SHAPE WM_USER+109

#include <map>

Expand Down Expand Up @@ -94,4 +95,10 @@ struct INTERPROCESS_COPYDATA
wchar_t wchArg3[SCXML_INTERPROCESS_BUFFER_SIZE];
};


#define SET_PROPERTY_MIN(X, TYPE, MIN) void __fastcall Set##X(TYPE val) { if (val>=MIN) F##X=val;}
#define SET_PROPERTY_MAX(X, TYPE, MAX) void __fastcall Set##X(TYPE val) { if (val<=MAX) F##X=val;}
#define SET_PROPERTY_RANGE(X, TYPE, MIN, MAX) void __fastcall Set##X(TYPE val) { if (val>=MIN && val<=MAX) F##X=val;}


#endif
4 changes: 2 additions & 2 deletions Src/ScxmlEditor.cbproj
Original file line number Diff line number Diff line change
Expand Up @@ -1015,13 +1015,13 @@
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName">alexander.zhornyak@gmail.com</VersionInfoKeys>
<VersionInfoKeys Name="FileDescription">Scxml State Charts Editor</VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">2.5.4.1769</VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">2.5.5.1755</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"/>
<VersionInfoKeys Name="LegalCopyright">alexander.zhornyak@gmail.com</VersionInfoKeys>
<VersionInfoKeys Name="LegalTrademarks"/>
<VersionInfoKeys Name="OriginalFilename"/>
<VersionInfoKeys Name="ProductName">ScxmlEditor</VersionInfoKeys>
<VersionInfoKeys Name="ProductVersion">2.5.4.0</VersionInfoKeys>
<VersionInfoKeys Name="ProductVersion">2.5.5</VersionInfoKeys>
<VersionInfoKeys Name="Comments"/>
</VersionInfoKeys>
<Parameters>
Expand Down
Binary file modified Src/ScxmlEditor.res
Binary file not shown.
66 changes: 33 additions & 33 deletions Src/ScxmlEditor_resources.rc
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
PngFinalize RCData "Images\\finalize_16_16.png"
PngForeach RCData "Images\\foreach_16_16.png"
CompleteBasic RCData "complete_basic.lua"
PngDatamodel RCData "Images\\datamodel_16_16.png"
PngVirtualFolder RCData "Images\\virtual_folder_16_16.png"
PngIf RCData "Images\\if_16_16.png"
CompleteCPP RCData "complete_all_CPP.txt"
PngLog RCData "Images\\log_16_16.png"
PngError RCData "Images\\error_16.png"
PngWatch RCData "Images\\watch_16_16.png"
PngData RCData "Images\\data_16_16.png"
PngAssign RCData "Images\\assign_16_16.png"
PngParam RCData "Images\\param_16_16.png"
PngSessionState RCData "Images\\statemachine_16_16.png"
PngProtocol RCData "Images\\protocol_16_16.png"
PngTransitionXML RCData "Images\\XMLText_Transition_16.png"
CompletePython RCData "complete_all_python.txt"
CompleteDebug RCData "complete_debug.lua"
PngTrigger RCData "Images\\trigger_16_16.png"
ResLogProperties RCData "ScxmlEditor.properties"
PngScript RCData "Images\\script_16_16.png"
PngCancel RCData "Images\\cancel_16_16.png"
CompleteString RCData "complete_string.lua"
PngProtocolWeak RCData "Images\\protocol_weak_16_16.png"
PngSend RCData "Images\\send_16_16.png"
PngVirtualFolder RCData "Images\\virtual_folder_16_16.png"
PngComment RCData "Images\\comment_16_16.png"
PngRaise RCData "Images\\raise_16_16.png"
PngExtraContent RCData "Images\\extracontent_16_16.png"
CompleteTable RCData "complete_table.lua"
CompleteBasic RCData "complete_basic.lua"
PngDatamodel RCData "Images\\datamodel_16_16.png"
CompleteEcmascript RCData "complete_all_js.txt"
CompleteUtf8 RCData "complete_utf8.lua"
PngOnExit RCData "Images\\onexit_16_16.png"
PngDoneData RCData "Images\\donedata_16_16.png"
CompleteOs RCData "complete_os.lua"
PngInvoke RCData "Images\\invoke_16_16.png"
PngSetValue RCData "Images\\setvalue_16_16.png"
PngExtraContent RCData "Images\\extracontent_16_16.png"
CompleteTable RCData "complete_table.lua"
PngForeach RCData "Images\\foreach_16_16.png"
PngFinalize RCData "Images\\finalize_16_16.png"
PngOnEntry RCData "Images\\onenter_16_16.png"
PngContent RCData "Images\\content_16_16.png"
ResCurPan Cursor "Images\\PanningCursor.cur"
PngSetValue RCData "Images\\setvalue_16_16.png"
PngInvoke RCData "Images\\invoke_16_16.png"
CompleteMath RCData "complete_math.lua"
PngData RCData "Images\\data_16_16.png"
PngAssign RCData "Images\\assign_16_16.png"
PngProtocol RCData "Images\\protocol_16_16.png"
PngParam RCData "Images\\param_16_16.png"
PngSessionState RCData "Images\\statemachine_16_16.png"
CompleteCPP RCData "complete_all_CPP.txt"
PngIf RCData "Images\\if_16_16.png"
PngError RCData "Images\\error_16.png"
PngWatch RCData "Images\\watch_16_16.png"
PngLog RCData "Images\\log_16_16.png"
CompleteString RCData "complete_string.lua"
PngCancel RCData "Images\\cancel_16_16.png"
PngProtocolWeak RCData "Images\\protocol_weak_16_16.png"
ResLogProperties RCData "ScxmlEditor.properties"
PngScript RCData "Images\\script_16_16.png"
PngTrigger RCData "Images\\trigger_16_16.png"
PngTransitionXML RCData "Images\\XMLText_Transition_16.png"
CompleteDebug RCData "complete_debug.lua"
CompletePython RCData "complete_all_python.txt"
ResCurPan Cursor "Images\\PanningCursor.cur"
PngContent RCData "Images\\content_16_16.png"
PngDoneData RCData "Images\\donedata_16_16.png"
CompleteOs RCData "complete_os.lua"
PngOnExit RCData "Images\\onexit_16_16.png"
100 changes: 49 additions & 51 deletions Src/TreeEditor/TreeEditorEx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1261,8 +1261,6 @@ void __fastcall TTreeEditorEx::TheTreeKeyDown(System::TObject* Sender, System::W
// ñòèðàåì âðåìåííûé ïðÿìîóãîëüíèê
ForceResetTemporarySelected();

bool bNeedToDeleteFullScreenForm = false;

switch(Key) {
case VK_BACK: {
if (Shift == Classes::TShiftState() << ssCtrl) {
Expand Down Expand Up @@ -1480,33 +1478,53 @@ void __fastcall TTreeEditorEx::TheTreeKeyDown(System::TObject* Sender, System::W
}
}break;
case VK_F12: {
if (!FFullScreenForm) {
FFullScreenForm = new TForm(this->Owner);
FFullScreenForm->BorderStyle = bsNone;
FFullScreenForm->WindowState = wsMaximized;
this->TheTree->Parent = FFullScreenForm;

FFullScreenForm->OnCloseQuery = OnFullScreenFormCloseQuery;
FFullScreenForm->Show();
}
else {
bNeedToDeleteFullScreenForm = true;
}
ToggleFullScreenMode();
}break;
case VK_ESCAPE: {
bNeedToDeleteFullScreenForm = true;
ExitFullScreenMode();
}break;
}
}

// ---------------------------------------------------------------------------
void __fastcall TTreeEditorEx::EnterFullScreenMode(void) {
if (!FFullScreenForm) {
FFullScreenForm = new TForm(this->Owner);
FFullScreenForm->BorderStyle = bsNone;
FFullScreenForm->WindowState = wsMaximized;
this->TheTree->Parent = FFullScreenForm;

FFullScreenForm->OnCloseQuery = OnFullScreenFormCloseQuery;
FFullScreenForm->Show();
}
}

if (bNeedToDeleteFullScreenForm) {
if (FFullScreenForm) {
// ---------------------------------------------------------------------------
void __fastcall TTreeEditorEx::ExitFullScreenMode(void) {
if (FFullScreenForm) {
try {
this->TheTree->Parent = PanelTree;
delete FFullScreenForm;
FFullScreenForm = NULL;

this->TheTree->SetFocus();
}
catch(Exception * E) {
LOG_ERROR(LOG_ERROR_MSG);
}
}
}

// ---------------------------------------------------------------------------
void __fastcall TTreeEditorEx::ToggleFullScreenMode(void) {
if (!FFullScreenForm) {
EnterFullScreenMode();
}
else {
ExitFullScreenMode();
}
}

// ---------------------------------------------------------------------------
void __fastcall TTreeEditorEx::NodeTreeKeyDown(System::TObject* Sender, System::Word &Key, Classes::TShiftState Shift) {
try {
Expand Down Expand Up @@ -1634,6 +1652,9 @@ void __fastcall TTreeEditorEx::NodeTreeKeyDown(System::TObject* Sender, System::

// ---------------------------------------------------------------------------
void __fastcall TTreeEditorEx::TheTreeKeyUp(System::TObject* Sender, System::Word &Key, Classes::TShiftState Shift) {
#if 0
WLOG_DEBUG(L"TheTreeKeyUp: Key:%d Shift:%d", Key, Shift.ToInt());
#endif

switch(Key) {
case VK_DOWN: {
Expand Down Expand Up @@ -1888,25 +1909,15 @@ void __fastcall TTreeEditorEx::TheTreeMouseUp(System::TObject* Sender, Controls:

// ---------------------------------------------------------------------------
void __fastcall TTreeEditorEx::OnConnectionReconnected(TTreeConnection *AConnection) {

// XXX:
}

// ---------------------------------------------------------------------------
void MoveShapeWithMovingLayout(Teetree::TTreeNodeShape* Sender, const int DeltaX, const int DeltaY,
std::set<TTreeConnection*> &AConnections) {
std::set<TTreeConnection*> &AConnections, bool bIsPrimary) {
if (Sender && Sender->Parent) {

/* This callback is called for every shape in the selection, so we should handle only the first one */
int iSelIndex = -1;
int iShapeSelIndex = -1;

for (int i = 0; i < Sender->Parent->Children->Count; i++) {
TTreeNodeShape *AChildShape = Sender->Parent->Children->Items[i];

if (AChildShape->Selected) {
iSelIndex++;
}

if (AChildShape != Sender) {
if (DeltaY > 0) {
if (AChildShape->Y0 > Sender->Y1 - DeltaY) {
Expand Down Expand Up @@ -1936,12 +1947,9 @@ void MoveShapeWithMovingLayout(Teetree::TTreeNodeShape* Sender, const int DeltaX
AConnections.insert(AChildShape->Connections->Items[k]);
}
}
else {
iShapeSelIndex = iSelIndex;
}
}

if (iShapeSelIndex == 0) {
if (bIsPrimary) {
if (DeltaX < 0) {
const int iNewX = Sender->Parent->X0 + DeltaX;
if (iNewX > 0) {
Expand All @@ -1965,7 +1973,7 @@ void MoveShapeWithMovingLayout(Teetree::TTreeNodeShape* Sender, const int DeltaX
AConnections.insert(Sender->Parent->Connections->Items[k]);
}

MoveShapeWithMovingLayout(Sender->Parent, DeltaX, DeltaY, AConnections);
MoveShapeWithMovingLayout(Sender->Parent, DeltaX, DeltaY, AConnections, bIsPrimary);
}
}
}
Expand All @@ -1979,7 +1987,8 @@ void __fastcall TTreeEditorEx::TheTreeMovingShape(Teetree::TTreeNodeShape* Sende

if (IsShiftPressed() && !IsAltPressed() && !IsControlPressed()) {
std::set<TTreeConnection*>AConnections;
MoveShapeWithMovingLayout(Sender, DeltaX, DeltaY, AConnections);
const bool bIsPrimary = GetSafeTreeListFirst(TheTree->Selected->Shapes) == Sender;
MoveShapeWithMovingLayout(Sender, DeltaX, DeltaY, AConnections, bIsPrimary);
for (std::set<TTreeConnection*>::iterator it = AConnections.begin(); it != AConnections.end(); ++it) {
Editorutils::AdjustSidesConnection(*it);
}
Expand All @@ -1988,20 +1997,11 @@ void __fastcall TTreeEditorEx::TheTreeMovingShape(Teetree::TTreeNodeShape* Sende

// ---------------------------------------------------------------------------
void ResizeShapeWithMovingLayout(Teetree::TTreeNodeShape* Sender, const int DeltaX, const int DeltaY,
std::set<TTreeConnection*> &AConnections) {
std::set<TTreeConnection*> &AConnections, bool bIsPrimary) {
if (Sender && Sender->Parent) {

/* This callback is called for every shape in the selection, so we should handle only the first one */
int iSelIndex = -1;
int iShapeSelIndex = -1;

for (int i = 0; i < Sender->Parent->Children->Count; i++) {
TTreeNodeShape *AChildShape = Sender->Parent->Children->Items[i];

if (AChildShape->Selected) {
iSelIndex++;
}

if (AChildShape != Sender) {
if (DeltaY != 0) {
if (AChildShape->Y0 > Sender->Y1 - DeltaY /* êðàé íà ìîìåíò ñäâèãà */ ) {
Expand All @@ -2019,20 +2019,17 @@ void ResizeShapeWithMovingLayout(Teetree::TTreeNodeShape* Sender, const int Delt
AConnections.insert(AChildShape->Connections->Items[k]);
}
}
else {
iShapeSelIndex = iSelIndex;
}
}

if (iShapeSelIndex == 0) {
if (bIsPrimary) {
Sender->Parent->X1 = Sender->Parent->X1 + DeltaX;
Sender->Parent->Y1 = Sender->Parent->Y1 + DeltaY;

for (int k = 0; k < Sender->Parent->Connections->Count; k++) {
AConnections.insert(Sender->Parent->Connections->Items[k]);
}

ResizeShapeWithMovingLayout(Sender->Parent, DeltaX, DeltaY, AConnections);
ResizeShapeWithMovingLayout(Sender->Parent, DeltaX, DeltaY, AConnections, bIsPrimary);
}
}
}
Expand All @@ -2049,7 +2046,8 @@ void __fastcall TTreeEditorEx::TheTreeResizingShape(Teetree::TTreeNodeShape* Sen

if (IsShiftPressed() && !IsAltPressed()) {
std::set<TTreeConnection*>AConnections;
ResizeShapeWithMovingLayout(Sender, DeltaX, DeltaY, AConnections);
const bool bIsPrimary = GetSafeTreeListFirst(TheTree->Selected->Shapes) == Sender;
ResizeShapeWithMovingLayout(Sender, DeltaX, DeltaY, AConnections, bIsPrimary);
for (std::set<TTreeConnection*>::iterator it = AConnections.begin(); it != AConnections.end(); ++it) {
Editorutils::AdjustSidesConnection(*it);
}
Expand Down
4 changes: 4 additions & 0 deletions Src/TreeEditor/TreeEditorEx.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,10 @@ class TTreeEditorEx : public TTreeEditorNew
void __fastcall InvalidateTheTreeWithTemp(void);
void __fastcall RefreshTheTreeWithTemp(void);

void __fastcall EnterFullScreenMode(void);
void __fastcall ExitFullScreenMode(void);
void __fastcall ToggleFullScreenMode(void);

__property TTreeEditWindows HideWindowsStatus = {read=GetHideWindowsStatus};

__published:
Expand Down
Loading

0 comments on commit ae846db

Please sign in to comment.