├── .gitignore ├── LICENSE ├── Portable ├── LEDMatrixStudio_10_10.zip ├── LEDMatrixStudio_20_27.zip └── readme.txt ├── README.md ├── Source ├── ActionObject.h ├── ActionObjectBrush.h ├── ApplicationSettings.h ├── AutomationConstants.h ├── CalcUtility.cpp ├── CalcUtility.h ├── ColourUtility.cpp ├── ColourUtility.h ├── Colours.h ├── Convert.cpp ├── Convert.h ├── DataDisplay.h ├── DataOut.h ├── DateUtility.cpp ├── DateUtility.h ├── DrawingData.h ├── Examples │ ├── Example_Cpp.h │ ├── Example_FastLED.h │ ├── Example_Microchip.h │ ├── Example_Picaxe.h │ └── Example_Python.h ├── ExportGIFSettings.h ├── ExportMonoBi.cpp ├── ExportMonoBi.h ├── ExportOptions.h ├── ExportOutputBinary.cpp ├── ExportOutputBinary.h ├── ExportRGB.cpp ├── ExportRGB.h ├── ExportRGB3pp.cpp ├── ExportRGB3pp.h ├── ExportUtility.cpp ├── ExportUtility.h ├── FileConstants.h ├── FileUtility.cpp ├── FileUtility.h ├── Font.cpp ├── Font.h ├── FontHandler.cpp ├── FontHandler.h ├── Formatting.cpp ├── Formatting.h ├── Forms │ ├── FormAbout.cpp │ ├── FormAbout.dfm │ ├── FormAbout.h │ ├── FormAddLayer.cpp │ ├── FormAddLayer.dfm │ ├── FormAddLayer.h │ ├── FormAutomate.cpp │ ├── FormAutomate.dfm │ ├── FormAutomate.h │ ├── FormCheckVersion.cpp │ ├── FormCheckVersion.dfm │ ├── FormCheckVersion.h │ ├── FormColourChange.cpp │ ├── FormColourChange.dfm │ ├── FormColourChange.h │ ├── FormCopyMultiple.cpp │ ├── FormCopyMultiple.dfm │ ├── FormCopyMultiple.h │ ├── FormDeleteMultiple.cpp │ ├── FormDeleteMultiple.dfm │ ├── FormDeleteMultiple.h │ ├── FormExport.cpp │ ├── FormExport.dfm │ ├── FormExport.h │ ├── FormExportCode.cpp │ ├── FormExportCode.dfm │ ├── FormExportCode.h │ ├── FormExportGIF.cpp │ ├── FormExportGIF.dfm │ ├── FormExportGIF.h │ ├── FormFontViewer.cpp │ ├── FormFontViewer.dfm │ ├── FormFontViewer.h │ ├── FormImportBitmap.cpp │ ├── FormImportBitmap.dfm │ ├── FormImportBitmap.h │ ├── FormMerge.cpp │ ├── FormMerge.dfm │ ├── FormMerge.h │ ├── FormNewBrush.cpp │ ├── FormNewBrush.dfm │ ├── FormNewBrush.h │ ├── FormNewProject.cpp │ ├── FormNewProject.dfm │ ├── FormNewProject.h │ ├── FormOptimise.cpp │ ├── FormOptimise.dfm │ ├── FormOptimise.h │ ├── FormPlaybackSpeed.cpp │ ├── FormPlaybackSpeed.dfm │ ├── FormPlaybackSpeed.h │ ├── FormPreferences.cpp │ ├── FormPreferences.dfm │ ├── FormPreferences.h │ ├── FormPreviewPopout.cpp │ ├── FormPreviewPopout.dfm │ ├── FormPreviewPopout.h │ ├── FormSaveRange.cpp │ ├── FormSaveRange.dfm │ ├── FormSaveRange.h │ ├── FormSetIgnoredPixels.cpp │ ├── FormSetIgnoredPixels.dfm │ ├── FormSetIgnoredPixels.h │ ├── FormToggleLockStatus.cpp │ ├── FormToggleLockStatus.dfm │ └── FormToggleLockStatus.h ├── Frames │ ├── FrameFontPanel.cpp │ ├── FrameFontPanel.dfm │ ├── FrameFontPanel.h │ ├── FrameGradientPanel.cpp │ ├── FrameGradientPanel.dfm │ ├── FrameGradientPanel.h │ ├── FrameLayerPanel.cpp │ ├── FrameLayerPanel.dfm │ ├── FrameLayerPanel.h │ ├── FramePalettePanel.cpp │ ├── FramePalettePanel.dfm │ ├── FramePalettePanel.h │ ├── FrameQuickData.cpp │ ├── FrameQuickData.dfm │ ├── FrameQuickData.h │ ├── FrameUndoPanel.cpp │ ├── FrameUndoPanel.dfm │ └── FrameUndoPanel.h ├── Gradient.cpp ├── Gradient.h ├── ImportData.h ├── LEDMatrixStudio.cbproj ├── LEDMatrixStudio.cbproj.local ├── LEDMatrixStudio.cpp ├── LEDMatrixStudioPCH1.h ├── LEDMatrixStudio_Icon.ico ├── LanguageConstants.h ├── LanguageHandler.cpp ├── LanguageHandler.h ├── Layer.h ├── Matrix.cpp ├── Matrix.h ├── MatrixConstants.cpp ├── MatrixConstants.h ├── MatrixDead.cpp ├── MatrixDead.h ├── MatrixIgnored.cpp ├── MatrixIgnored.h ├── Optimisation.cpp ├── Optimisation.h ├── PresetHandler.cpp ├── PresetHandler.h ├── PreviewSettings.cpp ├── PreviewSettings.h ├── ProfileHandler.cpp ├── ProfileHandler.h ├── ProjectSettings.h ├── RGBPaletteColours.h ├── Registry.cpp ├── Registry.h ├── SystemConstants.h ├── SystemSettings.cpp ├── SystemSettings.h ├── TheMatrix.cpp ├── TheMatrix.h ├── Toolbars.h ├── Utility.cpp ├── Utility.h ├── main.cpp ├── main.dfm ├── main.h ├── matrixconstants.h └── readme.txt └── SourceDelphiLegacy ├── LEDMatrixStudio.dpr ├── LEDMatrixStudio.dproj ├── code ├── classes │ ├── colours.pas │ ├── drawingdata.pas │ ├── examples │ │ ├── example_CPP.pas │ │ ├── example_Microchip.pas │ │ ├── example_PICAXE.pas │ │ ├── example_PYTHON.pas │ │ └── example_fastLED.pas │ ├── exportoptions_monobi.pas │ ├── exportoptions_rgb.pas │ ├── exportoptions_rgb_3bpp.pas │ ├── exportutility.pas │ ├── fonthandler.pas │ ├── languagehandler.pas │ ├── layer.pas │ ├── matrix.pas │ ├── matrixdead.pas │ ├── presethandler.pas │ ├── profilehandler.pas │ ├── systemsettings.pas │ └── thematrix.pas ├── forms │ ├── formAbout.dfm │ ├── formAbout.pas │ ├── formAddFrame.dfm │ ├── formAddLayer.dfm │ ├── formAddLayer.pas │ ├── formAutomate.dfm │ ├── formAutomate.pas │ ├── formCheckUpdateSplash.dfm │ ├── formCheckVersion.dfm │ ├── formCheckVersion.pas │ ├── formColourChange.dfm │ ├── formColourChange.pas │ ├── formCopyMultiple.dfm │ ├── formCopyMultiple.pas │ ├── formDeleteMultipl.dfm │ ├── formDeleteMultipl.pas │ ├── formExport.dfm │ ├── formExport.pas │ ├── formExportBinary.dfm │ ├── formExportCode.dfm │ ├── formExportCode.pas │ ├── formExportGIF.dfm │ ├── formExportGIF.pas │ ├── formFontViewer.dfm │ ├── formFontViewer.pas │ ├── formImportBitmap.dfm │ ├── formImportBitmap.pas │ ├── formMerge.dfm │ ├── formMerge.pas │ ├── formNewBrush.dfm │ ├── formNewBrush.pas │ ├── formNewProject.dfm │ ├── formNewProject.pas │ ├── formOptimise.dfm │ ├── formOptimise.pas │ ├── formPlaybackSpeed.dfm │ ├── formPlaybackSpeed.pas │ ├── formPreferences.dfm │ ├── formPreferences.pas │ ├── formPreviewPopout.dfm │ ├── formPreviewPopout.pas │ ├── formSaveRange.dfm │ ├── formSaveRange.pas │ ├── formSetIgnoredPixels.dfm │ ├── formSetIgnoredPixels.pas │ ├── formToggleLockStatus.dfm │ ├── formToggleLockStatus.pas │ ├── main.dfm │ └── main.pas ├── frames │ ├── frameFontPanel.dfm │ ├── frameFontPanel.pas │ ├── frameGradientPanel.dfm │ ├── frameGradientPanel.pas │ ├── frameLayerPanel.dfm │ ├── frameLayerPanel.pas │ ├── framePalettePanel.dfm │ ├── framePalettePanel.pas │ ├── frameQuickData.dfm │ ├── frameQuickData.pas │ ├── frameUndoPanel.dfm │ └── frameUndoPanel.pas ├── other │ └── Vcl.Imaging.GIFImg.pas ├── readme.txt └── units │ ├── actionobject.pas │ ├── appsettings.pas │ ├── datadisplay.pas │ ├── exportoptions.pas │ ├── exportoutputbinary.pas │ ├── fileconstants.pas │ ├── importdata.pas │ ├── languageconstants.pas │ ├── matrixconstants.pas │ ├── optimisation.pas │ ├── previewsettings.pas │ ├── projectsettings.pas │ ├── toolbars.pas │ ├── utility.pas │ └── xglobal.pas ├── led.ico └── readme.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # Uncomment these types if you want even more clean repository. But be careful. 2 | # It can make harm to an existing project source. Read explanations below. 3 | # 4 | # Resource files are binaries containing manifest, project icon and version info. 5 | # They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files. 6 | #*.res 7 | # 8 | # Type library file (binary). In old Delphi versions it should be stored. 9 | # Since Delphi 2009 it is produced from .ridl file and can safely be ignored. 10 | #*.tlb 11 | # 12 | # Diagram Portfolio file. Used by the diagram editor up to Delphi 7. 13 | # Uncomment this if you are not using diagrams or use newer Delphi version. 14 | #*.ddp 15 | # 16 | # Visual LiveBindings file. Added in Delphi XE2. 17 | # Uncomment this if you are not using LiveBindings Designer. 18 | #*.vlb 19 | # 20 | # Deployment Manager configuration file for your project. Added in Delphi XE2. 21 | # Uncomment this if it is not mobile development and you do not use remote debug feature. 22 | #*.deployproj 23 | # 24 | # C++ object files produced when C/C++ Output file generation is configured. 25 | # Uncomment this if you are not using external objects (zlib library for example). 26 | #*.obj 27 | # 28 | 29 | # Delphi compiler-generated binaries (safe to delete) 30 | *.exe 31 | *.dll 32 | *.bpl 33 | *.bpi 34 | *.dcp 35 | *.so 36 | *.apk 37 | *.drc 38 | *.map 39 | *.dres 40 | *.rsm 41 | *.tds 42 | *.dcu 43 | *.lib 44 | *.a 45 | *.o 46 | *.ocx 47 | 48 | # Delphi autogenerated files (duplicated info) 49 | *.cfg 50 | *.hpp 51 | *Resource.rc 52 | 53 | # Delphi local files (user-specific info) 54 | *.local 55 | *.identcache 56 | *.projdata 57 | *.tvsconfig 58 | *.dsk 59 | 60 | # Delphi history and backups 61 | __history/ 62 | __recovery/ 63 | *.~* 64 | 65 | # Castalia statistics file (since XE7 Castalia is distributed with Delphi) 66 | *.stat 67 | 68 | # Boss dependency manager vendor folder https://github.com/HashLoad/boss 69 | modules/ 70 | -------------------------------------------------------------------------------- /Portable/LEDMatrixStudio_10_10.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaximumOctopus/LEDMatrixStudio/058b1db5ffedfc29454a7f7819999dda52982cbb/Portable/LEDMatrixStudio_10_10.zip -------------------------------------------------------------------------------- /Portable/LEDMatrixStudio_20_27.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaximumOctopus/LEDMatrixStudio/058b1db5ffedfc29454a7f7819999dda52982cbb/Portable/LEDMatrixStudio_20_27.zip -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Version 0.20.27 (October 20th 2024) is the latest official stable releasee of the new C++ rewrite, and is available in the \portable folder. If you find a bug or any odd behaviour then please send me an email. 2 | 3 | https://maximumoctopus.hashnode.dev/ 4 | 5 | \Portable\ contains the application in "portable" format 6 | 7 | \Source\ contains the C++ rewrite (C++ Builder 11.3) and the current version being developed 8 | 9 | \SourceDelphiLegacy\ contains the full Delphi 10.3 (Community Edition) source code 10 | -------------------------------------------------------------------------------- /Source/ActionObject.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include 17 | 18 | #include "ActionObjectBrush.h" 19 | 20 | 21 | enum class AutomateSource { kFirstFrame = 0, kEachFrame, kEachFrameInc }; 22 | enum class CyclingDirection { kForwards = 0, kBackwards }; 23 | 24 | static const int actionTypeRevealLeftRight = 30; 25 | static const int actionTypeRevealRightLeft = 31; 26 | static const int actionTypeRevealTopBottom = 32; 27 | static const int actionTypeRevealBottomTop = 33; 28 | static const int actionTypeRevealCentreOut = 34; 29 | static const int actionTypeRevealCentreIn = 35; 30 | 31 | 32 | class ActionObject 33 | { 34 | 35 | public: 36 | 37 | std::wstring LastFileName = L""; 38 | 39 | int ProcesingStage = 0; 40 | 41 | int FrameStart = 0; 42 | int FrameEnd = 0; 43 | 44 | int Layer = 0; 45 | 46 | AutomateSource Source = AutomateSource::kFirstFrame; 47 | 48 | bool EraseBehind = false; 49 | 50 | std::vector ActionList; 51 | std::vector PostProcessList; 52 | 53 | int Parameter1 = 0; 54 | int Parameter2 = 0; 55 | int ParameterReveal = 0; 56 | int ParameterRevealColour = 0; 57 | 58 | std::vector SourceColours; 59 | std::vector TargetColours; 60 | int TargetSkip = 0; 61 | int TargetSkipIndex = 0; 62 | 63 | int CCSourceIndex = 0; 64 | int CCTargetIndex = 0; 65 | CyclingDirection CCDirection; 66 | 67 | ActionObjectBrush Brushes[2]; 68 | 69 | ActionObject() 70 | { 71 | } 72 | 73 | void Clear() 74 | { 75 | Parameter1 = 0; 76 | Parameter2 = 0; 77 | } 78 | 79 | void SetParameterReveal(int Width, int Height) 80 | { 81 | for (int t = 0; t < ActionList.size(); t++) 82 | { 83 | int source = ActionList[t]; 84 | 85 | switch (source) 86 | { 87 | case actionTypeRevealLeftRight: 88 | ParameterReveal = 0; 89 | break; 90 | case actionTypeRevealRightLeft: 91 | ParameterReveal = Width; 92 | break; 93 | case actionTypeRevealTopBottom: 94 | ParameterReveal = 0; 95 | break; 96 | case actionTypeRevealBottomTop: 97 | ParameterReveal = Height; 98 | break; 99 | case actionTypeRevealCentreOut: 100 | ParameterReveal = 0; // to do 101 | break; 102 | case actionTypeRevealCentreIn: 103 | ParameterReveal = 0; 104 | break; 105 | } 106 | } 107 | } 108 | }; 109 | -------------------------------------------------------------------------------- /Source/ActionObjectBrush.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include 17 | #include 18 | 19 | 20 | struct ActionObjectBrush 21 | { 22 | std::vector BrushData; 23 | 24 | bool Transparent = false; 25 | int TransparentColour = 0; 26 | }; 27 | -------------------------------------------------------------------------------- /Source/CalcUtility.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include "CalcUtility.h" 15 | 16 | 17 | double CalcUtility::DegToRadians(double degrees) 18 | { 19 | return degrees * (3.14159265358979323846 / 180); 20 | } 21 | 22 | 23 | void CalcUtility::IncWithRollOver(int &value, const int max) 24 | { 25 | if (max == value) 26 | { 27 | value = 0; 28 | 29 | return; 30 | } 31 | 32 | value++; 33 | } 34 | -------------------------------------------------------------------------------- /Source/CalcUtility.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | 17 | namespace CalcUtility 18 | { 19 | double DegToRadians(double degrees); 20 | 21 | void IncWithRollOver(int &, const int); 22 | } -------------------------------------------------------------------------------- /Source/ColourUtility.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include 17 | 18 | #include "MatrixConstants.h" 19 | 20 | 21 | namespace ColourUtility 22 | { 23 | static const std::wstring BiColoursLSBLeft[] = { L"00", L"01", L"10", L"11" }; 24 | static const std::wstring BiColoursLSBRight[] = { L"00", L"10", L"01", L"11" }; 25 | 26 | std::wstring RGBPlusInteger(int, int); 27 | std::wstring RGBColourNumberFormat(NumberFormat, int, unsigned int); 28 | int RGBConvertTo16(int, RGBMode, LeastSignificantBit, ColourSpace, int); 29 | int RGBConvertTo32(int, RGBMode, LeastSignificantBit, int); 30 | 31 | std::wstring RGBConvertToSplit(int, BinaryOptions&, const std::wstring, const std::wstring); 32 | std::wstring RGBConvertToSplit(int, CodeOptions&, const std::wstring, const std::wstring); 33 | std::wstring RGBConvertToSplit(int, RGBMode, int, NumberFormat, const std::wstring, const std::wstring, ColourSpace); 34 | 35 | std::wstring RGB3BPPFormatOutput(unsigned int, CodeOptions&, const std::wstring, const std::wstring, int); 36 | 37 | int HexToInt(const std::wstring); 38 | int DarkenRGB(int); 39 | 40 | int RandomColour(int, int); 41 | } 42 | -------------------------------------------------------------------------------- /Source/Colours.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | 17 | struct ProjectColours 18 | { 19 | bool HasData = false; 20 | 21 | int DrawColours[4] = { 0, 0, 0, 0 }; // index 0 isn't used, but added to ensure LMB, MMB and RMB align to indicies 1,2,3 respectively... 22 | int CustomColours[16]; 23 | 24 | int PaletteHistory[28]; 25 | }; 26 | -------------------------------------------------------------------------------- /Source/Convert.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include 15 | 16 | #include "Convert.h" 17 | #include "MatrixConstants.h" 18 | 19 | 20 | namespace Convert 21 | { 22 | unsigned __int64 BinToInt(const std::wstring s) 23 | { 24 | unsigned __int64 value = 0; 25 | 26 | int i = 0; 27 | 28 | for (int t = s.length() - 1; t >= 0; t--) 29 | { 30 | if (s[t] == L'1') 31 | { 32 | value += powers[i]; 33 | } 34 | 35 | i++; 36 | } 37 | 38 | return value; 39 | } 40 | 41 | 42 | __int64 HexToInt(const std::wstring s) 43 | { 44 | int total = 0; 45 | int digit = 0; 46 | 47 | for (int i = 0; i < s.length(); i++) 48 | { 49 | if (isdigit(s[i])) 50 | { 51 | digit = s[i] - 48; 52 | } 53 | else if (s[i] >= 65 && s[i] <= 70) // A..F 54 | { 55 | digit = s[i] - 55; 56 | } 57 | 58 | total += digit * powers16[s.length() - i - 1]; 59 | } 60 | 61 | return total; 62 | } 63 | 64 | 65 | char HexToByte(const std::wstring s) 66 | { 67 | int total = 0; 68 | int digit = 0; 69 | int multiplier = 1; 70 | 71 | for (int i = s.length() - 1; i >= 0; i--) 72 | { 73 | int c = (unsigned char)s[i]; 74 | 75 | if (isdigit(s[i])) 76 | { 77 | digit = c - 48; 78 | } 79 | else if (c >= 65 && c <= 70) // A..F 80 | { 81 | digit = c - 55; 82 | } 83 | 84 | total += digit * multiplier; 85 | 86 | multiplier *= 16; 87 | } 88 | 89 | return total & 0xff; 90 | } 91 | 92 | 93 | std::wstring IntegerToBinary(int ns, __int64 number) 94 | { 95 | std::wstring s = L""; 96 | 97 | for (int i = 0; i <= ns; i++) 98 | { 99 | s += L'0'; 100 | } 101 | 102 | for (int i = 0; i <= ns; i++) 103 | { 104 | if ((number & powers[i]) == powers[i]) 105 | { 106 | s[ns - i] = L'1'; 107 | } 108 | } 109 | 110 | return s; 111 | } 112 | } -------------------------------------------------------------------------------- /Source/Convert.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | 17 | namespace Convert 18 | { 19 | unsigned __int64 BinToInt(const std::wstring s); 20 | 21 | __int64 HexToInt(const std::wstring); 22 | char HexToByte(const std::wstring); 23 | 24 | std::wstring IntegerToBinary(int, __int64); 25 | } 26 | -------------------------------------------------------------------------------- /Source/DataDisplay.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include "matrixconstants.h" 17 | 18 | 19 | struct DataDisplay 20 | { 21 | HexFormat FormatHex; 22 | HexPrefix PrefixHex; 23 | 24 | BinaryPrefix PrefixBinary; 25 | 26 | PadFormat Pad; 27 | BracketStyle Brackets; 28 | }; 29 | -------------------------------------------------------------------------------- /Source/DateUtility.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include "LanguageConstants.h" 15 | #include "LanguageHandler.h" 16 | #include "DateUtility.h" 17 | 18 | extern LanguageHandler *GLanguageHandler; 19 | 20 | 21 | namespace DateUtility 22 | { 23 | std::wstring CreatedDate() 24 | { 25 | return GLanguageHandler->Text[kDate] + L" : " + GetDate(); 26 | } 27 | 28 | 29 | std::wstring GetTime() 30 | { 31 | struct tm newtime; 32 | time_t now = time(0); 33 | localtime_s(&newtime, &now); 34 | 35 | std::wstring hour = std::to_wstring(newtime.tm_hour); 36 | std::wstring min = std::to_wstring(newtime.tm_min); 37 | std::wstring sec = std::to_wstring(newtime.tm_sec); 38 | 39 | if (newtime.tm_hour < 10) 40 | { 41 | hour = L"0" + hour; 42 | } 43 | 44 | if (newtime.tm_min < 10) 45 | { 46 | min = L"0" + min; 47 | } 48 | 49 | if (newtime.tm_sec < 10) 50 | { 51 | sec = L"0" + sec; 52 | } 53 | 54 | return hour + L":" + min + L"." + sec; 55 | } 56 | 57 | 58 | std::wstring GetDate() 59 | { 60 | struct tm newtime; 61 | time_t now = time(0); 62 | localtime_s(&newtime, &now); 63 | 64 | std::wstring year = std::to_wstring(newtime.tm_year + 1900); 65 | std::wstring month = std::to_wstring(newtime.tm_mon + 1); 66 | std::wstring day = std::to_wstring(newtime.tm_mday); 67 | 68 | if (newtime.tm_mon + 1 < 10) 69 | { 70 | month = L"0" + month; 71 | } 72 | 73 | if (newtime.tm_mday < 10) 74 | { 75 | day = L"0" + day; 76 | } 77 | 78 | return year + L"/" + month + L"/" + day; 79 | } 80 | } -------------------------------------------------------------------------------- /Source/DateUtility.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | 17 | namespace DateUtility 18 | { 19 | std::wstring CreatedDate(); 20 | 21 | std::wstring GetDate(); 22 | std::wstring GetTime(); 23 | } 24 | -------------------------------------------------------------------------------- /Source/Examples/Example_Cpp.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | 17 | namespace ExampleCPP 18 | { 19 | std::wstring Get() 20 | { 21 | return L""; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Source/Examples/Example_FastLED.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | 17 | namespace ExampleFastLED 18 | { 19 | std::wstring Get(int start, int end, int pixelsperframe) 20 | { 21 | std::wstring s = L""; 22 | 23 | s += L"const int __NUM_LEDS = ' + IntToStr(aPixelsPerFrame) + '; // per frame\n"; 24 | s += L"const unsigned long __DELAY_MS = 225;\n"; 25 | s += L"\n"; 26 | s += L"void loop() {\n"; 27 | s += L"\n"; 28 | 29 | for (int t = start; t <= end; t++) 30 | { 31 | s += L" FastLED.clear();\n"; 32 | s += L" for(int i = 0; i < __NUM_LEDS; i++)\n"; 33 | s += L" {\n"; 34 | s += L" leds[i] = pgm_read_dword(&(ledarray' + IntToStr(t - 1) + '[i]));\n"; 35 | s += L" }\n"; 36 | s += L" FastLED.show();\n"; 37 | s += L" delay(__DELAY_MS);\n"; 38 | s += L"\n"; 39 | } 40 | 41 | return s += L"}\n"; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Source/Examples/Example_Microchip.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | 17 | namespace ExampleMicrochip 18 | { 19 | std::wstring Get() 20 | { 21 | return L""; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Source/Examples/Example_Picaxe.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | 17 | namespace ExamplePICAXE 18 | { 19 | std::wstring Get() 20 | { 21 | return L""; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Source/Examples/Example_Python.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | 17 | namespace ExamplePython 18 | { 19 | std::wstring Get() 20 | { 21 | return L""; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Source/ExportGIFSettings.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | 17 | struct ExportGIFSettings 18 | { 19 | bool Process = false; 20 | std::wstring FileName = L""; 21 | int PixelSize = 1; 22 | int PixelShape = 0; 23 | int Background = 0x00000000; 24 | int AnimationSpeed = 100; // percent of "normal" - 50 = half speed, 100 = normal, 1000 = 10x speed 25 | }; -------------------------------------------------------------------------------- /Source/ExportMonoBi.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include 17 | #include 18 | 19 | #include "DataOut.h" 20 | #include "ExportOptions.h" 21 | #include "TheMatrix.h" 22 | 23 | 24 | namespace ExportMonoBi 25 | { 26 | bool CreateExportAnimation(TheMatrix *matrix, ExportOptions, std::vector &, int&, std::vector &); 27 | 28 | DataOut ExportColumnData(TheMatrix *matrix, ExportOptions, int, int, const std::wstring); 29 | DataOut ExportRowData(TheMatrix *matrix, ExportOptions, int, int, const std::wstring); 30 | 31 | // used only for quick GUI-based output 32 | DataOutDisplay SimpleExportMono(TheMatrix *matrix, int, int, int, int, bool, bool, bool); 33 | DataOutDisplay SimpleExportBiSequential(TheMatrix *matrix, int, int, int, int, bool, bool); 34 | DataOutDisplay SimpleExportBiBitplanes(TheMatrix *matrix, int, int, int, int, bool, bool); 35 | } 36 | -------------------------------------------------------------------------------- /Source/ExportOutputBinary.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include 17 | #include 18 | 19 | #include "DataOut.h" 20 | #include "ExportOptions.h" 21 | #include "TheMatrix.h" 22 | 23 | 24 | namespace ExportOutputBinary 25 | { 26 | bool BinaryCreateExportAnimation(TheMatrix *matrix, ExportOptions, std::vector &, int&, std::vector &); 27 | bool BinaryCreateExportAnimationRGB(TheMatrix *matrix, ExportOptions, std::vector &, int&, std::vector &); 28 | bool BinaryCreateExportAnimationRGB3bpp(TheMatrix *matrix, ExportOptions, std::vector &, int &); 29 | 30 | DataOut BinaryExportRowData(TheMatrix *matrix, ExportOptions, int, int); 31 | DataOut BinaryExportRowDataRGB(TheMatrix *matrix, ExportOptions, int, int); 32 | DataOut BinaryExportFrameDataByRowRGB3bpp(TheMatrix *matrix, ExportOptions, int); 33 | 34 | DataOut BinaryExportColumnData(TheMatrix *matrix, ExportOptions, int, int); 35 | DataOut BinaryExportColumnDataRGB(TheMatrix *matrix, ExportOptions, int, int); 36 | DataOut BinaryExportFrameDataByColumnRGB3bpp(TheMatrix *matrix, ExportOptions, int); 37 | 38 | std::wstring BinaryGetRowData(Matrix *matrix, bool, int, int, int); 39 | std::wstring BinaryGetColumnData(Matrix *matrix, bool, int, int, int); 40 | 41 | void BinaryAddContentByFrame(ExportOptions, const std::wstring, int, std::vector &); 42 | } 43 | -------------------------------------------------------------------------------- /Source/ExportRGB.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include 17 | 18 | #include "DataOut.h" 19 | #include "ExportOptions.h" 20 | #include "TheMatrix.h" 21 | 22 | 23 | namespace ExportRGB 24 | { 25 | bool CreateExportAnimationRGB(TheMatrix *matrix, ExportOptions, std::vector &, int&, std::vector &); 26 | 27 | DataOut ExportColumnDataRGB(TheMatrix *matrix, const std::wstring, ExportOptions, int, int, const std::wstring); 28 | DataOut ExportRowDataRGB(TheMatrix *matrix, const std::wstring, ExportOptions, int, int, const std::wstring); 29 | } 30 | -------------------------------------------------------------------------------- /Source/ExportRGB3pp.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | // 3 bits per pixel mode 15 | // the following 8 colours are set to the following bit values 16 | // 000 black 17 | // 001 blue 18 | // 010 green 19 | // 011 cyan 20 | // 100 red 21 | // 101 magenta 22 | // 110 yellow 23 | // 111 white 24 | 25 | #pragma once 26 | 27 | #include 28 | 29 | #include "DataOut.h" 30 | #include "TheMatrix.h" 31 | 32 | 33 | namespace ExportRGB3BPP 34 | { 35 | bool CreateExportAnimationRGB3BPP(TheMatrix *matrix, ExportOptions, std::vector &, int&, std::vector &); 36 | 37 | DataOut ExportColumnDataRGB3BPP(TheMatrix *matrix, const std::wstring, ExportOptions, int, int, const std::wstring, int); 38 | DataOut ExportRowDataRGB3BPP(TheMatrix *matrix, const std::wstring, ExportOptions, int, int, const std::wstring, int); 39 | } 40 | -------------------------------------------------------------------------------- /Source/ExportUtility.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include 17 | 18 | #include "ExportOptions.h" 19 | 20 | 21 | namespace ExportUtility 22 | { 23 | void AddContentByFrame(ExportOptions, const std::wstring, int, std::vector &); 24 | void AddRowColContent(ExportOptions, const std::wstring, std::vector &); 25 | 26 | std::wstring GetRowData(int *, int, int, bool, int, int, int); 27 | std::wstring GetColumnData(int *, int, bool, int, int, int); 28 | 29 | std::wstring GetCommentCharacter(ExportLanguage); 30 | std::wstring GetLanguage(ExportLanguage, bool); 31 | std::wstring GetLineContent(ExportOptions, bool); 32 | std::wstring GetLSB(ExportOptions, bool); 33 | std::wstring GetNumberFormat(ExportLanguage, NumberFormat); 34 | std::wstring GetNumberSize(ExportLanguage, NumberSize, bool); 35 | std::wstring GetOrientation(ExportOptions, bool); 36 | void GetPreamble(ExportOptions, std::vector &, bool, const std::wstring); 37 | std::wstring GetExampleCodeDisclaimer(ExportOptions teo); 38 | std::wstring GetRGBMode(ExportOptions, bool); 39 | std::wstring GetRGBBrightness(ExportOptions, bool); 40 | std::wstring GetColourSpace(ExportOptions, bool); 41 | std::wstring GetScanDirection(ExportOptions, bool); 42 | std::wstring GetSource(ExportLanguage, ReadSource); 43 | void GetSpacerLine(ExportLanguage, std::vector &); 44 | std::wstring GetSingleVariableStatement(ExportLanguage, NumberSize); 45 | std::wstring GetVariableID(ExportLanguage); 46 | std::wstring GetVariableIDFrameIn(ExportLanguage, int); 47 | std::wstring GetVariableIDFrameOut(ExportLanguage); 48 | std::wstring GetVariableType(ExportLanguage, NumberSize); 49 | 50 | void AddEnding(std::vector &, ExportOptions &); 51 | 52 | std::wstring GetPadding(ExportLanguage, int); 53 | 54 | std::wstring FormatDataAs(const unsigned __int64, NumberFormat, int, int); 55 | 56 | std::wstring TitleWithComments(const std::wstring, ExportLanguage, bool); 57 | 58 | ScanDirection UpdateDirectionColumn(ScanDirection, InputOrientation, int, int); 59 | ScanDirection UpdateDirectionRow(ScanDirection, InputOrientation, int, int); 60 | } 61 | -------------------------------------------------------------------------------- /Source/FileUtility.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include 17 | 18 | #include "MatrixConstants.h" 19 | 20 | 21 | namespace FileUtility 22 | { 23 | // =========================================================================== 24 | // LED Matrix Studio files 25 | // =========================================================================== 26 | 27 | LoadData LoadDataParameterType(const std::wstring, bool, bool, bool, bool, bool); 28 | 29 | // =========================================================================== 30 | 31 | MatrixMode GetMatrixModeFromFileChunk(const wchar_t); 32 | 33 | bool SaveVector(const std::wstring, const std::vector&); 34 | } 35 | -------------------------------------------------------------------------------- /Source/Font.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include "MatrixConstants.h" 17 | 18 | 19 | class Font 20 | { 21 | 22 | public: 23 | 24 | MatrixMode Mode = MatrixMode::kNone; 25 | 26 | std::wstring Name = L""; 27 | 28 | int *Data = nullptr; 29 | int Start[96]; 30 | int End[96]; 31 | 32 | Font(); 33 | ~Font(); 34 | 35 | void Clear(); 36 | 37 | bool Load(const std::wstring, const std::wstring); 38 | }; 39 | -------------------------------------------------------------------------------- /Source/FontHandler.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include 15 | #include 16 | 17 | #include "FontHandler.h" 18 | #include "Utility.h" 19 | 20 | FontHandler *GFontHandler; 21 | 22 | 23 | FontHandler::FontHandler(const std::wstring path) 24 | { 25 | PopulateFontList(path); 26 | } 27 | 28 | 29 | void FontHandler::PopulateFontList(const std::wstring path) 30 | { 31 | Fonts.clear(); 32 | 33 | std::wstring tmp = path + L"*"; 34 | 35 | WIN32_FIND_DATAW file; 36 | 37 | HANDLE search_handle = FindFirstFileW(tmp.c_str(), &file); 38 | 39 | if (search_handle != INVALID_HANDLE_VALUE) 40 | { 41 | do 42 | { 43 | if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) 44 | { 45 | } 46 | else 47 | { 48 | std::wstring s = file.cFileName; 49 | 50 | Fonts.push_back(Utility::RemoveExtension(s)); 51 | } 52 | 53 | } while (FindNextFileW(search_handle, &file)); 54 | 55 | FindClose(search_handle); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Source/FontHandler.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include 17 | 18 | 19 | class FontHandler 20 | { 21 | 22 | public: 23 | 24 | std::vector Fonts; 25 | 26 | FontHandler(const std::wstring); 27 | 28 | void PopulateFontList(const std::wstring); 29 | }; 30 | -------------------------------------------------------------------------------- /Source/Formatting.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include 15 | #include 16 | 17 | #include "Formatting.h" 18 | 19 | 20 | namespace Formatting 21 | { 22 | std::wstring AddLeadingSpace(std::wstring input, int length) 23 | { 24 | if (input.length() == length) 25 | { 26 | return input; 27 | } 28 | else if (input.length() < length) 29 | { 30 | for (auto t = input.length(); t < length; t++) 31 | { 32 | input.insert(input.begin(), L' '); 33 | } 34 | 35 | return input; 36 | } 37 | 38 | return input; 39 | } 40 | 41 | 42 | std::wstring AddTrailingSpace(std::wstring input, int length) 43 | { 44 | if (input.length() == length) 45 | { 46 | return input; 47 | } 48 | else if (input.length() < length) 49 | { 50 | for (auto t = input.length(); t < length; t++) 51 | { 52 | input += L' '; 53 | } 54 | 55 | return input; 56 | } 57 | 58 | return input; 59 | } 60 | 61 | 62 | std::wstring PadString(wchar_t character, int count) 63 | { 64 | std::wstring s = L""; 65 | 66 | for (int i = 0; i < count; i++) 67 | { 68 | s += character; 69 | } 70 | 71 | return s; 72 | } 73 | 74 | 75 | std::wstring PadToLength(const std::wstring input, int count) 76 | { 77 | std::wstring s = input; 78 | 79 | while (input.length() < count) 80 | { 81 | s += L' '; 82 | } 83 | 84 | return s; 85 | } 86 | 87 | 88 | std::wstring PadZeroes(const std::wstring input, int count) 89 | { 90 | std::wstring s = input; 91 | 92 | while (s.length() < count) 93 | { 94 | s = L'0' + s; 95 | } 96 | 97 | return s; 98 | } 99 | 100 | 101 | std::wstring VectorToString(const std::vector &input) 102 | { 103 | if (input.size() != 0) 104 | { 105 | std::wstring s = L""; 106 | 107 | for (int i = 0; i < input.size(); i++) 108 | { 109 | s += input[i] + L"\x0d\x0a"; // adds a linefeed that TMemo recognises to add a new line per each line in our vector 110 | } 111 | 112 | return s; 113 | } 114 | 115 | return L""; 116 | } 117 | 118 | 119 | // utf8 output magic 120 | std::string to_utf8(const std::wstring& str) 121 | { 122 | return to_utf8(str.c_str(), (int)str.size()); 123 | } 124 | 125 | 126 | std::string to_utf8(const wchar_t* buffer, int len) 127 | { 128 | int nChars = ::WideCharToMultiByte( 129 | CP_UTF8, 130 | 0, 131 | buffer, 132 | len, 133 | NULL, 134 | 0, 135 | NULL, 136 | NULL); 137 | if (nChars == 0) return ""; 138 | 139 | std::string newbuffer; 140 | 141 | newbuffer.resize(nChars); 142 | ::WideCharToMultiByte( 143 | CP_UTF8, 144 | 0, 145 | buffer, 146 | len, 147 | const_cast(newbuffer.c_str()), 148 | nChars, 149 | NULL, 150 | NULL); 151 | 152 | return newbuffer; 153 | } 154 | } -------------------------------------------------------------------------------- /Source/Formatting.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | 17 | #include 18 | #include 19 | 20 | 21 | namespace Formatting 22 | { 23 | [[nodiscard]] std::wstring AddLeadingSpace(std::wstring, int); 24 | [[nodiscard]] std::wstring AddTrailingSpace(std::wstring, int); 25 | 26 | std::wstring PadString(wchar_t, int); 27 | std::wstring PadToLength(const std::wstring, int); 28 | std::wstring PadZeroes(const std::wstring, int); 29 | 30 | std::wstring VectorToString(const std::vector &); 31 | 32 | std::string to_utf8(const std::wstring& str); 33 | std::string to_utf8(const wchar_t* buffer, int len); 34 | } -------------------------------------------------------------------------------- /Source/Forms/FormAbout.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include 15 | #pragma hdrstop 16 | 17 | #include "FormAbout.h" 18 | #include "Utility.h" 19 | 20 | //--------------------------------------------------------------------------- 21 | #pragma package(smart_init) 22 | #pragma resource "*.dfm" 23 | TfrmAbout *frmAbout; 24 | //--------------------------------------------------------------------------- 25 | 26 | __fastcall TfrmAbout::TfrmAbout(TComponent* Owner) 27 | : TForm(Owner) 28 | { 29 | } 30 | 31 | 32 | void __fastcall TfrmAbout::lEmailClick(TObject *Sender) 33 | { 34 | Utility::ExecuteFile(L"mailto:paul@freshney.org"); 35 | } 36 | 37 | 38 | void __fastcall TfrmAbout::lWebsiteClick(TObject *Sender) 39 | { 40 | Utility::ExecuteFile(L"https://github.com/MaximumOctopus/LEDMatrixStudio"); 41 | } 42 | -------------------------------------------------------------------------------- /Source/Forms/FormAbout.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FormAboutH 15 | #define FormAboutH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | //--------------------------------------------------------------------------- 24 | class TfrmAbout : public TForm 25 | { 26 | __published: // IDE-managed Components 27 | TImage *Image1; 28 | TLabel *lWebsite; 29 | TLabel *lEmail; 30 | TLabel *Label3; 31 | TLabel *lVersion; 32 | TShape *Shape1; 33 | void __fastcall lEmailClick(TObject *Sender); 34 | void __fastcall lWebsiteClick(TObject *Sender); 35 | private: // User declarations 36 | public: // User declarations 37 | __fastcall TfrmAbout(TComponent* Owner); 38 | }; 39 | //--------------------------------------------------------------------------- 40 | extern PACKAGE TfrmAbout *frmAbout; 41 | //--------------------------------------------------------------------------- 42 | #endif 43 | -------------------------------------------------------------------------------- /Source/Forms/FormAddLayer.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include 15 | #pragma hdrstop 16 | 17 | #include "FormAddLayer.h" 18 | 19 | #pragma package(smart_init) 20 | #pragma resource "*.dfm" 21 | TForm3 *Form3; 22 | 23 | //--------------------------------------------------------------------------- 24 | //--------------------------------------------------------------------------- 25 | 26 | AddObject OpenAddLayer(const std::vector &layers) 27 | { 28 | TForm3 *Form3 = new TForm3(Application); 29 | 30 | AddObject ao; 31 | 32 | std::wstring s = GLanguageHandler->Text[kLayer] + L" " + std::to_wstring(layers.size()); 33 | 34 | Form3->eName->Text = s.c_str(); 35 | 36 | for (int t = 0; t < layers.size(); t++) 37 | Form3->cbSourceLayer->Items->Add(layers[t].c_str()); 38 | 39 | Form3->cbSourceLayer->ItemIndex = 0; 40 | 41 | if (Form3->ShowModal() == mrOk) 42 | { 43 | ao.Process = true; 44 | ao.Name = Form3->eName->Text.c_str(); 45 | ao.CopyFrom = Form3->cbCopyFrom->Checked; 46 | ao.CopyLayer = Form3->cbSourceLayer->ItemIndex; 47 | } 48 | 49 | delete Form3; 50 | 51 | return ao; 52 | } 53 | 54 | 55 | __fastcall TForm3::TForm3(TComponent* Owner) 56 | : TForm(Owner) 57 | { 58 | SetGuiLanguageText(); 59 | } 60 | 61 | 62 | void TForm3::SetGuiLanguageText() 63 | { 64 | Caption = GLanguageHandler->Text[kAddNewLayer].c_str(); 65 | Label1->Caption = GLanguageHandler->Text[kName].c_str(); 66 | cbCopyFrom->Caption = GLanguageHandler->Text[kCopyFrom].c_str(); 67 | Label6->Caption = GLanguageHandler->Text[kExtraLayersIncreaseApplicationMemoryUsage].c_str(); 68 | 69 | bOK->Caption = GLanguageHandler->Text[kOK].c_str(); 70 | bCancel->Caption = GLanguageHandler->Text[kCancel].c_str(); 71 | } 72 | 73 | 74 | void __fastcall TForm3::cbCopyFromClick(TObject *Sender) 75 | { 76 | cbSourceLayer->Enabled = cbCopyFrom->Checked; 77 | } 78 | -------------------------------------------------------------------------------- /Source/Forms/FormAddLayer.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FormAddLayerH 15 | #define FormAddLayerH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include "LanguageConstants.h" 26 | #include "LanguageHandler.h" 27 | 28 | extern LanguageHandler *GLanguageHandler; 29 | 30 | //--------------------------------------------------------------------------- 31 | class TForm3 : public TForm 32 | { 33 | __published: // IDE-managed Components 34 | TBevel *Bevel1; 35 | TImage *Image1; 36 | TLabel *Label2; 37 | TBitBtn *bOK; 38 | TBitBtn *bCancel; 39 | TGroupBox *GroupBox1; 40 | TLabel *Label1; 41 | TLabel *Label6; 42 | TEdit *eName; 43 | TComboBox *cbSourceLayer; 44 | TCheckBox *cbCopyFrom; 45 | void __fastcall cbCopyFromClick(TObject *Sender); 46 | private: 47 | void SetGuiLanguageText(); 48 | public: // User declarations 49 | __fastcall TForm3(TComponent* Owner); 50 | }; 51 | 52 | 53 | struct AddObject 54 | { 55 | bool Process = false; 56 | std::wstring Name = L""; 57 | bool CopyFrom = false; 58 | int CopyLayer = 0; 59 | }; 60 | 61 | 62 | AddObject OpenAddLayer(const std::vector &layers); 63 | 64 | 65 | //--------------------------------------------------------------------------- 66 | extern PACKAGE TForm3 *Form3; 67 | //--------------------------------------------------------------------------- 68 | #endif 69 | -------------------------------------------------------------------------------- /Source/Forms/FormCheckVersion.h: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------- 2 | 3 | #ifndef FormCheckVersionH 4 | #define FormCheckVersionH 5 | //--------------------------------------------------------------------------- 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | //--------------------------------------------------------------------------- 18 | class TfrmCheckVersion : public TForm 19 | { 20 | __published: // IDE-managed Components 21 | TShape *Shape1; 22 | TLabel *Label5; 23 | TBitBtn *bClose; 24 | TBitBtn *bHistory; 25 | TMemo *mHistory; 26 | TBitBtn *bWebsite; 27 | TGroupBox *gbInstalledVersion; 28 | TLabel *Label6; 29 | TLabel *Label7; 30 | TLabel *lIVDate; 31 | TLabel *lIVVersion; 32 | TGroupBox *gbLatestVersion; 33 | TLabel *Label10; 34 | TLabel *Label11; 35 | TLabel *lLADate; 36 | TLabel *lLAVersion; 37 | TGroupBox *GroupBox1; 38 | TLabel *lWhat; 39 | TIdHTTP *httpMain; 40 | void __fastcall bWebsiteClick(TObject *Sender); 41 | void __fastcall bHistoryClick(TObject *Sender); 42 | void __fastcall FormShow(TObject *Sender); 43 | private: 44 | 45 | void SetGuiLanguageText(); 46 | 47 | public: 48 | __fastcall TfrmCheckVersion(TComponent* Owner); 49 | 50 | bool AutoClose = false; 51 | }; 52 | 53 | void OpenCheckForNewVersion(std::wstring, std::wstring, bool); 54 | 55 | //--------------------------------------------------------------------------- 56 | extern PACKAGE TfrmCheckVersion *frmCheckVersion; 57 | //--------------------------------------------------------------------------- 58 | #endif 59 | -------------------------------------------------------------------------------- /Source/Forms/FormColourChange.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include 15 | #pragma hdrstop 16 | 17 | #include "FormColourChange.h" 18 | #include "ColourUtility.h" 19 | #include "LanguageConstants.h" 20 | #include "LanguageHandler.h" 21 | 22 | extern LanguageHandler *GLanguageHandler; 23 | 24 | //--------------------------------------------------------------------------- 25 | #pragma package(smart_init) 26 | #pragma resource "*.dfm" 27 | TfrmColourChange *frmColourChange; 28 | 29 | //--------------------------------------------------------------------------- 30 | 31 | ColourChange OpenColourChange(std::vector &colours) 32 | { 33 | TfrmColourChange *frmColourChange = new TfrmColourChange(Application); 34 | 35 | ColourChange cco; 36 | 37 | for (int t = 0; t < colours.size(); t++) 38 | { 39 | TObject *colour = (TObject*)colours[t]; 40 | 41 | frmColourChange->clbUserFrom->AddItem(ColourUtility::RGBPlusInteger(colours[t], 100).c_str(), colour); 42 | frmColourChange->clbUserTo->AddItem(ColourUtility::RGBPlusInteger(colours[t], 100).c_str(), colour); 43 | } 44 | 45 | if (frmColourChange->ShowModal() == mrOk) 46 | { 47 | cco.Process = true; 48 | cco.ColourFrom = frmColourChange->sFrom->Brush->Color; 49 | cco.ColourTo = frmColourChange->sTo->Brush->Color; 50 | } 51 | 52 | delete frmColourChange; 53 | 54 | return cco; 55 | } 56 | 57 | 58 | __fastcall TfrmColourChange::TfrmColourChange(TComponent* Owner) 59 | : TForm(Owner) 60 | { 61 | SetGuiLanguageText(); 62 | } 63 | 64 | 65 | void TfrmColourChange::SetGuiLanguageText() 66 | { 67 | Caption = GLanguageHandler->Text[kColourChanger].c_str(); 68 | Label1->Caption = GLanguageHandler->Text[kFrom].c_str(); 69 | Label2->Caption = GLanguageHandler->Text[kToC].c_str(); 70 | Label4->Caption = GLanguageHandler->Text[kWarningThisActionCannotBeUndone].c_str(); 71 | Label3->Caption = GLanguageHandler->Text[kFirstThirtyTwoColoursFromTheCurrentAnimation].c_str(); 72 | 73 | bOK->Caption = GLanguageHandler->Text[kOK].c_str(); 74 | bCancel->Caption = GLanguageHandler->Text[kCancel].c_str(); 75 | } 76 | 77 | 78 | void __fastcall TfrmColourChange::clbUserFromDblClick(TObject *Sender) 79 | { 80 | TColorListBox *clb = (TColorListBox*)Sender; 81 | 82 | if (clb->ItemIndex != -1) 83 | { 84 | if (clb->Tag == 0) 85 | { 86 | int colour = (int)clbUserFrom->Items->Objects[clbUserFrom->ItemIndex]; 87 | 88 | sFrom->Brush->Color = TColor(colour); 89 | } 90 | else 91 | { 92 | int colour = (int)clbUserTo->Items->Objects[clbUserTo->ItemIndex]; 93 | 94 | sTo->Brush->Color = TColor(colour); 95 | } 96 | } 97 | } 98 | 99 | 100 | void __fastcall TfrmColourChange::sFromMouseDown(TObject *Sender, TMouseButton Button, 101 | TShiftState Shift, int X, int Y) 102 | { 103 | if (cdChanger->Execute()) 104 | { 105 | TShape *shape = (TShape*)Sender; 106 | 107 | shape->Brush->Color = cdChanger->Color; 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /Source/Forms/FormColourChange.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FormColourChangeH 15 | #define FormColourChangeH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include 27 | 28 | //--------------------------------------------------------------------------- 29 | class TfrmColourChange : public TForm 30 | { 31 | __published: // IDE-managed Components 32 | TBevel *Bevel1; 33 | TLabel *Label3; 34 | TImage *Image1; 35 | TBitBtn *bOK; 36 | TBitBtn *bCancel; 37 | TGroupBox *GroupBox1; 38 | TLabel *Label1; 39 | TLabel *Label2; 40 | TShape *sFrom; 41 | TShape *sTo; 42 | TLabel *Label4; 43 | TColorListBox *clbUserFrom; 44 | TColorListBox *clbUserTo; 45 | TColorDialog *cdChanger; 46 | void __fastcall clbUserFromDblClick(TObject *Sender); 47 | void __fastcall sFromMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, 48 | int X, int Y); 49 | private: 50 | 51 | void SetGuiLanguageText(); 52 | 53 | public: 54 | __fastcall TfrmColourChange(TComponent* Owner); 55 | }; 56 | 57 | 58 | struct ColourChange 59 | { 60 | bool Process = false; 61 | int ColourFrom = 0; 62 | int ColourTo = 0; 63 | }; 64 | 65 | 66 | ColourChange OpenColourChange(std::vector &); 67 | 68 | //--------------------------------------------------------------------------- 69 | extern PACKAGE TfrmColourChange *frmColourChange; 70 | //--------------------------------------------------------------------------- 71 | #endif 72 | -------------------------------------------------------------------------------- /Source/Forms/FormCopyMultiple.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FormCopyMultipleH 15 | #define FormCopyMultipleH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | 27 | //--------------------------------------------------------------------------- 28 | class TfrmCopyMultiple : public TForm 29 | { 30 | __published: // IDE-managed Components 31 | TBevel *Bevel1; 32 | TLabel *Label4; 33 | TImage *Image1; 34 | TBitBtn *bOK; 35 | TBitBtn *bCancel; 36 | TGroupBox *GroupBox1; 37 | TLabel *Label1; 38 | TLabel *Label2; 39 | TLabel *Label3; 40 | TLabel *Label5; 41 | TLabel *Label6; 42 | TLabel *Label7; 43 | TLabel *Label8; 44 | TLabel *lWarningMessage; 45 | TEdit *eStartFrame; 46 | TEdit *eEndFrame; 47 | TEdit *eCopyTo; 48 | TComboBox *cbSourceLayer; 49 | TComboBox *cbDestinationLayer; 50 | TCheckBox *cbAllLayers; 51 | void __fastcall FormShow(TObject *Sender); 52 | void __fastcall cbAllLayersClick(TObject *Sender); 53 | void __fastcall eStartFrameChange(TObject *Sender); 54 | private: 55 | 56 | bool ValidateInputs(); 57 | void SetGuiLanguageText(); 58 | 59 | public: // User declarations 60 | __fastcall TfrmCopyMultiple(TComponent* Owner); 61 | 62 | int FrameCount = 0; 63 | }; 64 | 65 | struct CopyMultipleObject 66 | { 67 | bool Process = false; 68 | int StartFrame = 0; 69 | int EndFrame = 0; 70 | int CopyTo = 0; 71 | int Source = 0; 72 | int Destination = 0; 73 | bool AllLayers = false; 74 | }; 75 | 76 | CopyMultipleObject OpenCopyMultiple(int, std::vector &); 77 | 78 | //--------------------------------------------------------------------------- 79 | extern PACKAGE TfrmCopyMultiple *frmCopyMultiple; 80 | //--------------------------------------------------------------------------- 81 | #endif 82 | -------------------------------------------------------------------------------- /Source/Forms/FormDeleteMultiple.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include 15 | #pragma hdrstop 16 | 17 | #include "FormDeleteMultiple.h" 18 | #include "LanguageConstants.h" 19 | #include "LanguageHandler.h" 20 | 21 | #pragma package(smart_init) 22 | #pragma resource "*.dfm" 23 | TfrmDeleteMultiple *frmDeleteMultiple; 24 | 25 | extern LanguageHandler *GLanguageHandler; 26 | 27 | //--------------------------------------------------------------------------- 28 | //--------------------------------------------------------------------------- 29 | 30 | DeleteMultipleObject OpenDeleteMultiple(int maxframecount) 31 | { 32 | TfrmDeleteMultiple *frmDeleteMultiple = new TfrmDeleteMultiple(Application); 33 | 34 | frmDeleteMultiple->FrameCount = maxframecount; 35 | 36 | DeleteMultipleObject dmo; 37 | 38 | if (frmDeleteMultiple->ShowModal() == mrOk) 39 | { 40 | dmo.Process = true; 41 | dmo.StartFrame = frmDeleteMultiple->eStartFrame->Text.ToIntDef(0) - 1; 42 | dmo.EndFrame = frmDeleteMultiple->eEndFrame->Text.ToIntDef(0) - 1; 43 | } 44 | 45 | delete frmDeleteMultiple; 46 | 47 | return dmo; 48 | } 49 | 50 | //--------------------------------------------------------------------------- 51 | //--------------------------------------------------------------------------- 52 | 53 | 54 | __fastcall TfrmDeleteMultiple::TfrmDeleteMultiple(TComponent* Owner) 55 | : TForm(Owner) 56 | { 57 | SetGuiLanguageText(); 58 | } 59 | 60 | 61 | void __fastcall TfrmDeleteMultiple::eStartFrameChange(TObject *Sender) 62 | { 63 | bOk->Enabled = ValidateInputs(); 64 | } 65 | 66 | 67 | void TfrmDeleteMultiple::SetGuiLanguageText() 68 | { 69 | Caption = GLanguageHandler->Text[kDeleteMultipleFramesC].c_str(); 70 | 71 | lFrom->Caption = GLanguageHandler->Text[kFrom].c_str(); 72 | lTo->Caption = GLanguageHandler->Text[kToC].c_str(); 73 | lWarning->Caption = GLanguageHandler->Text[kWarningThisActionCannotBeUndone].c_str(); 74 | 75 | bOk->Caption = GLanguageHandler->Text[kOK].c_str(); 76 | bCancel->Caption = GLanguageHandler->Text[kCancel].c_str(); 77 | } 78 | 79 | 80 | bool TfrmDeleteMultiple::ValidateInputs() 81 | { 82 | int sf = eStartFrame->Text.ToIntDef(-1); 83 | int ef = eEndFrame->Text.ToIntDef(-1); 84 | 85 | return (sf != -1 && ef != -1 && sf <= ef && sf >=1 && ef >=1 && ef <= FrameCount); 86 | } 87 | -------------------------------------------------------------------------------- /Source/Forms/FormDeleteMultiple.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FormDeleteMultipleH 15 | #define FormDeleteMultipleH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | //--------------------------------------------------------------------------- 25 | class TfrmDeleteMultiple : public TForm 26 | { 27 | __published: // IDE-managed Components 28 | TBevel *Bevel1; 29 | TLabel *lWarning; 30 | TImage *Image1; 31 | TBitBtn *bOk; 32 | TBitBtn *bCancel; 33 | TGroupBox *GroupBox1; 34 | TLabel *lFrom; 35 | TLabel *lTo; 36 | TEdit *eStartFrame; 37 | TEdit *eEndFrame; 38 | void __fastcall eStartFrameChange(TObject *Sender); 39 | private: // User declarations 40 | 41 | void SetGuiLanguageText(); 42 | bool ValidateInputs(); 43 | 44 | public: // User declarations 45 | __fastcall TfrmDeleteMultiple(TComponent* Owner); 46 | 47 | int FrameCount = 0; 48 | }; 49 | 50 | struct DeleteMultipleObject 51 | { 52 | bool Process = false; 53 | int StartFrame = 0; 54 | int EndFrame = 0; 55 | }; 56 | 57 | //--------------------------------------------------------------------------- 58 | 59 | DeleteMultipleObject OpenDeleteMultiple(int); 60 | 61 | //--------------------------------------------------------------------------- 62 | extern PACKAGE TfrmDeleteMultiple *frmDeleteMultiple; 63 | //--------------------------------------------------------------------------- 64 | #endif 65 | -------------------------------------------------------------------------------- /Source/Forms/FormExportCode.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FormExportCodeH 15 | #define FormExportCodeH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include "MatrixConstants.h" 27 | #include "TheMatrix.h" 28 | 29 | //--------------------------------------------------------------------------- 30 | class TfrmExportCode : public TForm 31 | { 32 | __published: // IDE-managed Components 33 | TPanel *Panel2; 34 | TGroupBox *gbPlatforms; 35 | TComboBox *cbPlatforms; 36 | TGroupBox *gbCodeTemplates; 37 | TLabel *lDescription; 38 | TComboBox *cbCode; 39 | TGroupBox *gbSettings; 40 | TLabel *Label1; 41 | TLabel *lSource; 42 | TLabel *Label3; 43 | TLabel *lLSB; 44 | TLabel *Label5; 45 | TLabel *lFormat; 46 | TLabel *lNumbers; 47 | TLabel *Label8; 48 | TLabel *lGrouping; 49 | TLabel *Label10; 50 | TLabel *lOutput; 51 | TLabel *Label12; 52 | TLabel *lRGB; 53 | TLabel *Label14; 54 | TLabel *Label2; 55 | TLabel *Label4; 56 | TLabel *lDirection; 57 | TLabel *lScan; 58 | TLabel *Label6; 59 | TLabel *Label7; 60 | TLabel *Label9; 61 | TLabel *Label11; 62 | TLabel *lMinWidth; 63 | TLabel *lMaxWidth; 64 | TLabel *lMinHeight; 65 | TLabel *lMaxHeight; 66 | TImage *iMiW; 67 | TImage *iMaW; 68 | TImage *iMiH; 69 | TImage *iMaH; 70 | TBitBtn *sbSave; 71 | TBitBtn *sbCopyToClipboard; 72 | TBitBtn *bClose; 73 | TMemo *Memo1; 74 | TSaveDialog *sdExportCode; 75 | void __fastcall cbPlatformsChange(TObject *Sender); 76 | void __fastcall cbCodeChange(TObject *Sender); 77 | void __fastcall sbSaveClick(TObject *Sender); 78 | void __fastcall sbCopyToClipboardClick(TObject *Sender); 79 | void __fastcall FormConstrainedResize(TObject *Sender, int &MinWidth, int &MinHeight, 80 | int &MaxWidth, int &MaxHeight); 81 | void __fastcall FormClose(TObject *Sender, TCloseAction &Action); 82 | private: 83 | 84 | ExportOptions eeo; 85 | 86 | void SetGuiLanguageText(); 87 | void UpdatePlatformList(); 88 | void UpdateCodeList(); 89 | void LoadCode(); 90 | std::wstring GetDimensionConstraint(TLabel*, int, int, int, TImage*); 91 | void UpdateSettingsDisplay(); 92 | 93 | public: // User declarations 94 | __fastcall TfrmExportCode(TComponent* Owner); 95 | 96 | TheMatrix *matrix = nullptr; 97 | }; 98 | 99 | //--------------------------------------------------------------------------- 100 | 101 | int OpenExportCode(TheMatrix*); 102 | 103 | //--------------------------------------------------------------------------- 104 | extern PACKAGE TfrmExportCode *frmExportCode; 105 | //--------------------------------------------------------------------------- 106 | #endif 107 | -------------------------------------------------------------------------------- /Source/Forms/FormExportGIF.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FormExportGIFH 15 | #define FormExportGIFH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | //--------------------------------------------------------------------------- 28 | class TfrmExportGIF : public TForm 29 | { 30 | __published: // IDE-managed Components 31 | TImage *Image1; 32 | TBevel *Bevel1; 33 | TBitBtn *bOk; 34 | TBitBtn *bCancel; 35 | TGroupBox *GroupBox1; 36 | TLabel *Label1; 37 | TSpeedButton *bSave; 38 | TLabel *Label2; 39 | TLabel *Label3; 40 | TLabel *Label4; 41 | TLabel *Label5; 42 | TShape *ShapeNorfolkDigital; 43 | TLabel *lAnimationSpeed; 44 | TLabel *lAnimationSpeedHelp; 45 | TEdit *eFileName; 46 | TEdit *ePixelSize; 47 | TRadioButton *rbSquare; 48 | TRadioButton *rbCircle; 49 | TSpinEdit *seAnimationSpeed; 50 | TRadioButton *rbRoundRect; 51 | TSaveDialog *sdExportGIF; 52 | TColorDialog *cdExportGIF; 53 | 54 | void __fastcall ShapeNorfolkDigitalMouseDown(TObject *Sender, TMouseButton Button, 55 | TShiftState Shift, int X, int Y); 56 | void __fastcall eFileNameChange(TObject *Sender); 57 | void __fastcall bSaveClick(TObject *Sender); 58 | private: 59 | 60 | void SetGuiLanguageText(); 61 | 62 | public: 63 | __fastcall TfrmExportGIF(TComponent* Owner); 64 | }; 65 | 66 | //--------------------------------------------------------------------------- 67 | 68 | ExportGIFSettings OpenExportGIF(ExportGIFSettings); 69 | 70 | //--------------------------------------------------------------------------- 71 | extern PACKAGE TfrmExportGIF *frmExportGIF; 72 | //--------------------------------------------------------------------------- 73 | #endif 74 | -------------------------------------------------------------------------------- /Source/Forms/FormFontViewer.dfm: -------------------------------------------------------------------------------- 1 | object frmFontViewer: TfrmFontViewer 2 | Left = 0 3 | Top = 0 4 | BorderStyle = bsDialog 5 | ClientHeight = 344 6 | ClientWidth = 483 7 | Color = clBtnFace 8 | DoubleBuffered = True 9 | Font.Charset = DEFAULT_CHARSET 10 | Font.Color = clWindowText 11 | Font.Height = -12 12 | Font.Name = 'Segoe UI' 13 | Font.Style = [] 14 | Position = poMainFormCenter 15 | OnDestroy = FormDestroy 16 | OnShow = FormShow 17 | TextHeight = 15 18 | object Panel1: TPanel 19 | Left = 0 20 | Top = 0 21 | Width = 145 22 | Height = 292 23 | Align = alLeft 24 | Color = clWhite 25 | ParentBackground = False 26 | TabOrder = 0 27 | ExplicitHeight = 286 28 | object bSelectFont: TLabel 29 | Left = 8 30 | Top = 15 31 | Width = 3 32 | Height = 15 33 | Caption = '.' 34 | end 35 | object cbFonts: TComboBox 36 | Left = 8 37 | Top = 32 38 | Width = 121 39 | Height = 23 40 | Style = csDropDownList 41 | TabOrder = 0 42 | OnChange = cbFontsChange 43 | end 44 | object cbRGBMode: TCheckBox 45 | Left = 14 46 | Top = 72 47 | Width = 113 48 | Height = 17 49 | Caption = '.' 50 | TabOrder = 1 51 | OnClick = cbRGBModeClick 52 | end 53 | end 54 | object Panel2: TPanel 55 | Left = 0 56 | Top = 292 57 | Width = 483 58 | Height = 52 59 | Align = alBottom 60 | Color = clWhite 61 | ParentBackground = False 62 | TabOrder = 1 63 | ExplicitTop = 286 64 | ExplicitWidth = 477 65 | object lCharacterValue: TLabel 66 | Left = 8 67 | Top = 9 68 | Width = 3 69 | Height = 15 70 | Caption = '.' 71 | end 72 | object Label3: TLabel 73 | Left = 14 74 | Top = 25 75 | Width = 36 76 | Height = 15 77 | Caption = '(ASCII)' 78 | end 79 | object lCharacter: TLabel 80 | Left = 393 81 | Top = 9 82 | Width = 15 83 | Height = 19 84 | Caption = '...' 85 | Font.Charset = DEFAULT_CHARSET 86 | Font.Color = clWindowText 87 | Font.Height = -16 88 | Font.Name = 'Tahoma' 89 | Font.Style = [] 90 | ParentFont = False 91 | end 92 | object tbFont: TTrackBar 93 | Left = 62 94 | Top = 6 95 | Width = 325 96 | Height = 35 97 | Max = 127 98 | Min = 32 99 | Position = 32 100 | PositionToolTip = ptTop 101 | TabOrder = 0 102 | TickStyle = tsNone 103 | OnChange = tbFontChange 104 | end 105 | end 106 | object pFont: TPanel 107 | Left = 145 108 | Top = 0 109 | Width = 338 110 | Height = 292 111 | Align = alClient 112 | TabOrder = 2 113 | ExplicitWidth = 332 114 | ExplicitHeight = 286 115 | end 116 | end 117 | -------------------------------------------------------------------------------- /Source/Forms/FormFontViewer.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FormFontViewerH 15 | #define FormFontViewerH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include "TheMatrix.h" 25 | 26 | //--------------------------------------------------------------------------- 27 | class TfrmFontViewer : public TForm 28 | { 29 | __published: // IDE-managed Components 30 | TPanel *Panel1; 31 | TLabel *bSelectFont; 32 | TComboBox *cbFonts; 33 | TCheckBox *cbRGBMode; 34 | TPanel *Panel2; 35 | TLabel *lCharacterValue; 36 | TLabel *Label3; 37 | TLabel *lCharacter; 38 | TTrackBar *tbFont; 39 | TPanel *pFont; 40 | void __fastcall FormShow(TObject *Sender); 41 | void __fastcall tbFontChange(TObject *Sender); 42 | void __fastcall cbFontsChange(TObject *Sender); 43 | void __fastcall cbRGBModeClick(TObject *Sender); 44 | void __fastcall FormDestroy(TObject *Sender); 45 | private: 46 | 47 | void BuildFontList(); 48 | void SetGuiLanguageText(); 49 | void SetLabel(); 50 | 51 | TheMatrix *FontMatrix; 52 | 53 | int LastFrame = -1; 54 | 55 | public: 56 | __fastcall TfrmFontViewer(TComponent* Owner); 57 | }; 58 | 59 | void OpenFontViewer(); 60 | 61 | //--------------------------------------------------------------------------- 62 | extern PACKAGE TfrmFontViewer *frmFontViewer; 63 | //--------------------------------------------------------------------------- 64 | #endif 65 | -------------------------------------------------------------------------------- /Source/Forms/FormImportBitmap.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FormImportBitmapH 15 | #define FormImportBitmapH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | //--------------------------------------------------------------------------- 27 | 28 | #include "MatrixConstants.h" 29 | 30 | class TfrmImportBitmap : public TForm 31 | { 32 | __published: // IDE-managed Components 33 | TBevel *Bevel1; 34 | TLabel *lHelpText; 35 | TBitBtn *bOK; 36 | TBitBtn *bCancel; 37 | TGroupBox *gbSettings; 38 | TLabel *Label2; 39 | TLabel *Label3; 40 | TLabel *Label4; 41 | TLabel *lWidth; 42 | TLabel *lHeight; 43 | TLabel *lImageHeight; 44 | TLabel *lImageWidth; 45 | TBevel *Bevel2; 46 | TComboBox *cbWidth; 47 | TComboBox *cbHeight; 48 | TEdit *eFrames; 49 | TBitBtn *bAuto; 50 | TCheckBox *cbCreateNew; 51 | TPageControl *pcImportMethod; 52 | TTabSheet *tsSingleImage; 53 | TShape *Shape1; 54 | TImage *iImport; 55 | TLabel *lFileName; 56 | TBitBtn *bSelect; 57 | TTabSheet *tsMultipleImages; 58 | TImage *iMultipleImages; 59 | TLabel *Label5; 60 | TLabel *Label7; 61 | TSpeedButton *sbMISelectFirstImage; 62 | TLabel *Label8; 63 | TLabel *Label9; 64 | TLabel *Label10; 65 | TLabel *lImageLengthExample; 66 | TEdit *eMIFirstImage; 67 | TEdit *eMIPattern; 68 | TEdit *eMIFirstFrame; 69 | TEdit *eMIPadLength; 70 | TOpenPictureDialog *opdMain; 71 | TComboBox *cbImportColourMode; 72 | void __fastcall sbMISelectFirstImageClick(TObject *Sender); 73 | void __fastcall bOKClick(TObject *Sender); 74 | void __fastcall bCancelClick(TObject *Sender); 75 | void __fastcall bSelectClick(TObject *Sender); 76 | void __fastcall bAutoClick(TObject *Sender); 77 | void __fastcall cbImportColourModeChange(TObject *Sender); 78 | private: 79 | 80 | void SetGuiLanguageText(); 81 | void SetMultipleImageDetails(); 82 | 83 | public: // User declarations 84 | __fastcall TfrmImportBitmap(TComponent* Owner); 85 | 86 | ImportMode Import = ImportMode::kInvalid; 87 | 88 | ImportColourMode ImportMode = ImportColourMode::kMono; 89 | bool CreateNew = false; 90 | std::wstring ImageFilename = L""; 91 | int FrameCount = -1; 92 | int FrameWidth = -1; 93 | int FrameHeight = -1; 94 | 95 | int FirstFrame = -1; 96 | int PadLength = -1; 97 | std::wstring Pattern = L""; 98 | 99 | }; 100 | //--------------------------------------------------------------------------- 101 | extern PACKAGE TfrmImportBitmap *frmImportBitmap; 102 | //--------------------------------------------------------------------------- 103 | #endif 104 | -------------------------------------------------------------------------------- /Source/Forms/FormMerge.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include 15 | #pragma hdrstop 16 | 17 | #include "FormMerge.h" 18 | #include "LanguageConstants.h" 19 | #include "LanguageHandler.h" 20 | 21 | //--------------------------------------------------------------------------- 22 | #pragma package(smart_init) 23 | #pragma resource "*.dfm" 24 | TfrmMerge *frmMerge; 25 | 26 | extern LanguageHandler *GLanguageHandler; 27 | 28 | //--------------------------------------------------------------------------- 29 | //--------------------------------------------------------------------------- 30 | 31 | MergeObject OpenMerge() 32 | { 33 | TfrmMerge *frmMerge = new TfrmMerge(Application); 34 | 35 | MergeObject mo; 36 | 37 | if (frmMerge->ShowModal() == mrOk) 38 | { 39 | mo.Process = true; 40 | 41 | mo.FileName = frmMerge->eFileName->Text; 42 | mo.StartFrame = frmMerge->eStartFrame->Text.ToIntDef(1); 43 | 44 | if (frmMerge->rbMergeBottom->Checked) 45 | { 46 | mo.Mode = MergeMode::kAnimationBottom; 47 | } 48 | else if (frmMerge->rbMergeTop->Checked) 49 | { 50 | mo.Mode = MergeMode::kAnimationTop; 51 | } 52 | else if (frmMerge->rbMergeNewLayer->Checked) 53 | { 54 | mo.Mode = MergeMode::kNewLayer; 55 | } 56 | else 57 | { 58 | mo.Mode = MergeMode::kCurrentFrame; 59 | } 60 | } 61 | 62 | delete frmMerge; 63 | 64 | return mo; 65 | } 66 | 67 | //--------------------------------------------------------------------------- 68 | //--------------------------------------------------------------------------- 69 | 70 | __fastcall TfrmMerge::TfrmMerge(TComponent* Owner) 71 | : TForm(Owner) 72 | { 73 | SetGuiLanguageText(); 74 | } 75 | 76 | 77 | void __fastcall TfrmMerge::eFileNameChange(TObject *Sender) 78 | { 79 | if (eFileName->Text != L"") 80 | { 81 | bOk->Enabled = true; 82 | } 83 | else 84 | { 85 | bOk->Enabled = false; 86 | } 87 | } 88 | 89 | 90 | void __fastcall TfrmMerge::eStartFrameChange(TObject *Sender) 91 | { 92 | if (eStartFrame->Text.ToIntDef(-1) == -1) 93 | { 94 | bOk->Enabled = false; 95 | } 96 | else 97 | { 98 | bOk->Enabled = true; 99 | } 100 | } 101 | 102 | 103 | void __fastcall TfrmMerge::miMergeClick(TObject *Sender) 104 | { 105 | if (odMain->Execute()) 106 | { 107 | eFileName->Text = odMain->FileName; 108 | 109 | bOk->Enabled = true; 110 | } 111 | } 112 | 113 | 114 | void TfrmMerge::SetGuiLanguageText() 115 | { 116 | Caption = GLanguageHandler->Text[kMerge].c_str(); 117 | Label1->Caption = GLanguageHandler->Text[kFileName].c_str(); 118 | miMerge->Caption = GLanguageHandler->Text[kOpen].c_str(); 119 | 120 | rbMergeBottom->Caption = GLanguageHandler->Text[kMergeInToAnimationBottomHasPriority].c_str(); 121 | rbMergeTop->Caption = GLanguageHandler->Text[kMergeInToAnimationTopHasPriority].c_str(); 122 | rbMergeNewLayer->Caption = GLanguageHandler->Text[kMergeInToNewLayer].c_str(); 123 | rbMergeCurrentLayer->Caption = GLanguageHandler->Text[kMergeInToCurrentLayer].c_str(); 124 | 125 | lStartFrame->Caption = GLanguageHandler->Text[kStartFrame].c_str(); 126 | 127 | bOk->Caption = GLanguageHandler->Text[kOK].c_str(); 128 | bCancel->Caption = GLanguageHandler->Text[kCancel].c_str(); 129 | } 130 | -------------------------------------------------------------------------------- /Source/Forms/FormMerge.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FormMergeH 15 | #define FormMergeH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | //--------------------------------------------------------------------------- 26 | class TfrmMerge : public TForm 27 | { 28 | __published: // IDE-managed Components 29 | TBevel *Bevel1; 30 | TImage *Image1; 31 | TBitBtn *bOk; 32 | TBitBtn *bCancel; 33 | TGroupBox *GroupBox1; 34 | TLabel *Label1; 35 | TSpeedButton *miMerge; 36 | TLabel *lStartFrame; 37 | TRadioButton *rbMergeBottom; 38 | TRadioButton *rbMergeTop; 39 | TRadioButton *rbMergeNewLayer; 40 | TRadioButton *rbMergeCurrentLayer; 41 | TEdit *eFileName; 42 | TEdit *eStartFrame; 43 | TOpenDialog *odMain; 44 | void __fastcall eFileNameChange(TObject *Sender); 45 | void __fastcall eStartFrameChange(TObject *Sender); 46 | void __fastcall miMergeClick(TObject *Sender); 47 | private: 48 | 49 | void SetGuiLanguageText(); 50 | 51 | public: 52 | __fastcall TfrmMerge(TComponent* Owner); 53 | }; 54 | 55 | //--------------------------------------------------------------------------- 56 | 57 | enum class MergeMode { kAnimationBottom = 0, kAnimationTop, kNewLayer, kCurrentFrame }; 58 | 59 | struct MergeObject 60 | { 61 | bool Process = false; 62 | std::wstring FileName = L""; 63 | MergeMode Mode; 64 | int StartFrame; 65 | }; 66 | 67 | MergeObject OpenMerge(); 68 | 69 | //--------------------------------------------------------------------------- 70 | extern PACKAGE TfrmMerge *frmMerge; 71 | //--------------------------------------------------------------------------- 72 | #endif 73 | -------------------------------------------------------------------------------- /Source/Forms/FormOptimise.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FormOptimiseH 15 | #define FormOptimiseH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | 26 | #include "MatrixConstants.h" 27 | #include "TheMatrix.h" 28 | 29 | //--------------------------------------------------------------------------- 30 | class TfrmOptimise : public TForm 31 | { 32 | __published: // IDE-managed Components 33 | TBevel *Bevel1; 34 | TSpeedButton *sbOptimise; 35 | TSpeedButton *sbCopyOutput; 36 | TMemo *mMemo; 37 | TMemo *mData; 38 | TPanel *Panel1; 39 | TGroupBox *gbOutputOptions; 40 | TLabel *Label4; 41 | TLabel *Label5; 42 | TLabel *Label7; 43 | TLabel *Label6; 44 | TComboBox *cbDataSize; 45 | TComboBox *cbLanguageFormat; 46 | TComboBox *cbPerRow; 47 | void __fastcall sbCopyOutputClick(TObject *Sender); 48 | void __fastcall sbOptimiseClick(TObject *Sender); 49 | private: 50 | 51 | int MaxFrames = 0; 52 | bool HexFormat = false; 53 | int ColumnsLSB = 0; 54 | int RowsLSB = 0; 55 | int ExportFormat = 0; 56 | int ColumnsDirection = 0; 57 | int XType = 0; 58 | int beforeData = 0; 59 | int afterData = 0; 60 | 61 | std::vector MatrixData; 62 | 63 | NumberSize GetDataSize(); 64 | 65 | void PopulateMatrixData(); 66 | 67 | void SetGuiLanguageText(); 68 | 69 | public: // User declarations 70 | __fastcall TfrmOptimise(TComponent* Owner); 71 | 72 | TheMatrix *thematrix = nullptr; 73 | }; 74 | 75 | void OpenOptimise(TheMatrix *thematrix); 76 | 77 | //--------------------------------------------------------------------------- 78 | extern PACKAGE TfrmOptimise *frmOptimise; 79 | //--------------------------------------------------------------------------- 80 | #endif 81 | -------------------------------------------------------------------------------- /Source/Forms/FormPlaybackSpeed.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include 15 | #pragma hdrstop 16 | 17 | #include "FormPlaybackSpeed.h" 18 | #include "LanguageConstants.h" 19 | #include "LanguageHandler.h" 20 | 21 | #pragma package(smart_init) 22 | #pragma resource "*.dfm" 23 | TfrmPlaybackSpeed *frmPlaybackSpeed; 24 | 25 | extern LanguageHandler *GLanguageHandler; 26 | 27 | 28 | //--------------------------------------------------------------------------- 29 | //--------------------------------------------------------------------------- 30 | 31 | int OpenCustomPlaybackSpeed(int oldspeed) 32 | { 33 | TfrmPlaybackSpeed *frmPlaybackSpeed = new TfrmPlaybackSpeed(Application); 34 | 35 | int speed = oldspeed; 36 | 37 | frmPlaybackSpeed->eSpeed->Text = speed; 38 | 39 | if (frmPlaybackSpeed->ShowModal() == mrOk) 40 | { 41 | speed = frmPlaybackSpeed->eSpeed->Text.ToIntDef(0); 42 | } 43 | 44 | delete frmPlaybackSpeed; 45 | 46 | return speed; 47 | } 48 | 49 | //--------------------------------------------------------------------------- 50 | //--------------------------------------------------------------------------- 51 | 52 | 53 | __fastcall TfrmPlaybackSpeed::TfrmPlaybackSpeed(TComponent* Owner) 54 | : TForm(Owner) 55 | { 56 | SetGuiLanguageText(); 57 | } 58 | 59 | 60 | void __fastcall TfrmPlaybackSpeed::bOKClick(TObject *Sender) 61 | { 62 | int speed = eSpeed->Text.ToIntDef(0); 63 | 64 | if (speed > 0) 65 | { 66 | ModalResult = mrOk; 67 | } 68 | } 69 | 70 | 71 | void TfrmPlaybackSpeed::SetGuiLanguageText() 72 | { 73 | Caption = GLanguageHandler->Text[kCustomPlaybackSpeed].c_str(); 74 | lEquality->Caption = GLanguageHandler->Text[k1000ms1Second].c_str(); 75 | 76 | bOK->Caption = GLanguageHandler->Text[kOK].c_str(); 77 | bCancel->Caption = GLanguageHandler->Text[kCancel].c_str(); 78 | } 79 | -------------------------------------------------------------------------------- /Source/Forms/FormPlaybackSpeed.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FormPlaybackSpeedH 15 | #define FormPlaybackSpeedH 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | class TfrmPlaybackSpeed : public TForm 26 | { 27 | __published: // IDE-managed Components 28 | TImage *Image1; 29 | TBevel *Bevel1; 30 | TGroupBox *GroupBox1; 31 | TLabel *Label1; 32 | TLabel *lEquality; 33 | TEdit *eSpeed; 34 | TBitBtn *bOK; 35 | TBitBtn *bCancel; 36 | void __fastcall bOKClick(TObject *Sender); 37 | private: 38 | 39 | void SetGuiLanguageText(); 40 | 41 | public: // User declarations 42 | __fastcall TfrmPlaybackSpeed(TComponent* Owner); 43 | }; 44 | 45 | //--------------------------------------------------------------------------- 46 | 47 | int OpenCustomPlaybackSpeed(int oldspeed); 48 | 49 | 50 | extern PACKAGE TfrmPlaybackSpeed *frmPlaybackSpeed; 51 | //--------------------------------------------------------------------------- 52 | #endif 53 | -------------------------------------------------------------------------------- /Source/Forms/FormPreferences.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FormPreferencesH 15 | #define FormPreferencesH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | //--------------------------------------------------------------------------- 26 | class TfrmPreferences : public TForm 27 | { 28 | __published: // IDE-managed Components 29 | TBevel *Bevel1; 30 | TImage *Image1; 31 | TSpeedButton *bResetToDefaults; 32 | TBitBtn *bOK; 33 | TBitBtn *bCancel; 34 | TGroupBox *gbColours; 35 | TLabel *lShapeOn1; 36 | TShape *sMono2; 37 | TLabel *lShapeOff; 38 | TShape *sMono1; 39 | TLabel *Label2; 40 | TLabel *Label1; 41 | TShape *sBi2; 42 | TLabel *Label5; 43 | TShape *sBi1; 44 | TLabel *Label8; 45 | TLabel *Label9; 46 | TShape *sBi4; 47 | TLabel *Label10; 48 | TShape *sBi3; 49 | TLabel *Label11; 50 | TLabel *Label12; 51 | TLabel *Label13; 52 | TLabel *Label14; 53 | TLabel *lSelector; 54 | TShape *ShapeSelection; 55 | TLabel *lLightBox; 56 | TShape *ShapeLightBox; 57 | TLabel *Label3; 58 | TLabel *Label4; 59 | TGroupBox *gbMisc; 60 | TSpeedButton *sbClearRecentFileList; 61 | TLabel *lHexFormat; 62 | TComboBox *cbHexFormat; 63 | TGroupBox *gbLimiter; 64 | TLabel *Label15; 65 | TLabel *Label17; 66 | TLabel *Label18; 67 | TEdit *eMaxPixels; 68 | TEdit *eExportPreview; 69 | TColorDialog *colorDialogPrefs; 70 | TGroupBox *GroupBox1; 71 | TCheckBox *cbDisableWarnings; 72 | void __fastcall sMono1MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, 73 | int X, int Y); 74 | void __fastcall sbClearRecentFileListClick(TObject *Sender); 75 | void __fastcall bResetToDefaultsClick(TObject *Sender); 76 | private: 77 | 78 | void SetGUILanguageText(); 79 | 80 | public: // User declarations 81 | __fastcall TfrmPreferences(TComponent* Owner); 82 | }; 83 | 84 | //--------------------------------------------------------------------------- 85 | 86 | struct PrefsMatrixColours 87 | { 88 | int Mono[2] = { 0, 0 }; 89 | int Bi[4] = { 0, 0, 0, 0 }; 90 | int Selection = 0; 91 | int LightBox = 0; 92 | }; 93 | 94 | bool OpenPreferences(PrefsMatrixColours &); 95 | 96 | //--------------------------------------------------------------------------- 97 | extern PACKAGE TfrmPreferences *frmPreferences; 98 | //--------------------------------------------------------------------------- 99 | #endif 100 | -------------------------------------------------------------------------------- /Source/Forms/FormPreviewPopout.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include 15 | #pragma hdrstop 16 | 17 | #include "FormPreviewPopout.h" 18 | #include "LanguageConstants.h" 19 | #include "LanguageHandler.h" 20 | 21 | extern LanguageHandler *GLanguageHandler; 22 | 23 | //--------------------------------------------------------------------------- 24 | #pragma package(smart_init) 25 | #pragma resource "*.dfm" 26 | TfrmPreviewPopout *frmPreviewPopout; 27 | 28 | 29 | __fastcall TfrmPreviewPopout::TfrmPreviewPopout(TComponent* Owner) 30 | : TForm(Owner) 31 | { 32 | SetGuiLanguageText(); 33 | } 34 | 35 | 36 | void TfrmPreviewPopout::SetGuiLanguageText() 37 | { 38 | Caption = GLanguageHandler->Text[kPreview].c_str(); 39 | } 40 | 41 | 42 | void __fastcall TfrmPreviewPopout::bPlayAnimationClick(TObject *Sender) 43 | { 44 | if (OnCommand) 45 | { 46 | TBitBtn *bb = (TBitBtn*)Sender; 47 | 48 | OnCommand(bb->Tag); 49 | } 50 | } 51 | 52 | 53 | void TfrmPreviewPopout::SetForPlaybackStart() 54 | { 55 | bPlayAnimation->Enabled = false; 56 | bStartFrame->Enabled = false; 57 | bEndFrame->Enabled = false; 58 | bNextFrame->Enabled = false; 59 | bPreviousFrame->Enabled = false; 60 | bStopAnimation->Enabled = true; 61 | } 62 | 63 | 64 | void TfrmPreviewPopout::SetForPlaybackStop() 65 | { 66 | bPlayAnimation->Enabled = true; 67 | bStartFrame->Enabled = true; 68 | bEndFrame->Enabled = true; 69 | bNextFrame->Enabled = true; 70 | bPreviousFrame->Enabled = true; 71 | bStopAnimation->Enabled = false; 72 | } 73 | 74 | 75 | void __fastcall TfrmPreviewPopout::tbFramesTracking(TObject *Sender) 76 | { 77 | if (OnNewFrame) 78 | { 79 | OnNewFrame(tbFrames->Position - 1); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Source/Forms/FormPreviewPopout.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FormPreviewPopoutH 15 | #define FormPreviewPopoutH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | typedef void __fastcall (__closure *PreviewWindowEvent)(int); 28 | 29 | 30 | class TfrmPreviewPopout : public TForm 31 | { 32 | __published: // IDE-managed Components 33 | TPanel *Panel1; 34 | TPanel *pAnimationToolbar; 35 | TLabel *lFrame; 36 | TBevel *Bevel5; 37 | TBevel *Bevel7; 38 | TBitBtn *bPlayAnimation; 39 | TBitBtn *bStopAnimation; 40 | TBitBtn *bPreviousFrame; 41 | TBitBtn *bNextFrame; 42 | TTrackBar *tbFrames; 43 | TBitBtn *bStartFrame; 44 | TBitBtn *bEndFrame; 45 | TImageList *ImageList1; 46 | void __fastcall bPlayAnimationClick(TObject *Sender); 47 | void __fastcall tbFramesTracking(TObject *Sender); 48 | private: 49 | 50 | void SetGuiLanguageText(); 51 | 52 | public: // User declarations 53 | __fastcall TfrmPreviewPopout(TComponent* Owner); 54 | 55 | void SetForPlaybackStart(); 56 | void SetForPlaybackStop(); 57 | 58 | std::function OnCommand; 59 | std::function OnNewFrame; 60 | }; 61 | 62 | extern PACKAGE TfrmPreviewPopout *frmPreviewPopout; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /Source/Forms/FormSaveRange.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include 15 | #pragma hdrstop 16 | 17 | #include "FormSaveRange.h" 18 | #include "LanguageConstants.h" 19 | #include "LanguageHandler.h" 20 | 21 | #pragma package(smart_init) 22 | #pragma resource "*.dfm" 23 | TfrmSaveRange *frmSaveRange; 24 | 25 | extern LanguageHandler *GLanguageHandler; 26 | 27 | //--------------------------------------------------------------------------- 28 | //--------------------------------------------------------------------------- 29 | 30 | SaveFrameRangeObject OpenFrameRange(int frame_count) 31 | { 32 | TfrmSaveRange *frmSaveRange = new TfrmSaveRange(Application); 33 | 34 | SaveFrameRangeObject sfto; 35 | 36 | frmSaveRange->MatrixFrameCount = frame_count; 37 | 38 | if (frmSaveRange->ShowModal() == mrOk) 39 | { 40 | sfto.Process = true; 41 | sfto.StartFrame = frmSaveRange->eStartFrame->Text.ToInt() - 1; 42 | sfto.EndFrame = frmSaveRange->eEndFrame->Text.ToInt() - 1; 43 | } 44 | 45 | delete frmSaveRange; 46 | 47 | return sfto; 48 | } 49 | 50 | //--------------------------------------------------------------------------- 51 | //--------------------------------------------------------------------------- 52 | 53 | 54 | __fastcall TfrmSaveRange::TfrmSaveRange(TComponent* Owner) 55 | : TForm(Owner) 56 | { 57 | SetGuiLanguageText(); 58 | } 59 | 60 | 61 | void __fastcall TfrmSaveRange::eStartFrameChange(TObject *Sender) 62 | { 63 | bOK->Enabled = ValidateInputs(); 64 | } 65 | 66 | 67 | void TfrmSaveRange::SetGuiLanguageText() 68 | { 69 | Caption = GLanguageHandler->Text[kSaveARangeOfFrames].c_str(); 70 | 71 | lStart->Caption = GLanguageHandler->Text[kStart].c_str(); 72 | lEnd->Caption = GLanguageHandler->Text[kEnd].c_str(); 73 | 74 | bOK->Caption = GLanguageHandler->Text[kOK].c_str(); 75 | bCancel->Caption = GLanguageHandler->Text[kCancel].c_str(); 76 | } 77 | 78 | 79 | bool TfrmSaveRange::ValidateInputs() 80 | { 81 | int sf = eStartFrame->Text.ToIntDef(-1); 82 | int ef = eEndFrame->Text.ToIntDef(-1); 83 | 84 | return (sf >= 1 && ef >= 1 && sf <= ef && sf <= MatrixFrameCount && ef <= MatrixFrameCount); 85 | } 86 | -------------------------------------------------------------------------------- /Source/Forms/FormSaveRange.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FormSaveRangeH 15 | #define FormSaveRangeH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | 26 | struct SaveFrameRangeObject 27 | { 28 | bool Process = false; 29 | int StartFrame = 0; 30 | int EndFrame = 0; 31 | }; 32 | 33 | class TfrmSaveRange : public TForm 34 | { 35 | __published: // IDE-managed Components 36 | TBevel *Bevel1; 37 | TImage *Image1; 38 | TBitBtn *bOK; 39 | TBitBtn *bCancel; 40 | TGroupBox *GroupBox1; 41 | TLabel *lStart; 42 | TLabel *lEnd; 43 | TEdit *eStartFrame; 44 | TEdit *eEndFrame; 45 | void __fastcall eStartFrameChange(TObject *Sender); 46 | private: // User declarations 47 | 48 | void SetGuiLanguageText(); 49 | bool ValidateInputs(); 50 | 51 | public: // User declarations 52 | __fastcall TfrmSaveRange(TComponent* Owner); 53 | 54 | int MatrixFrameCount = 0; 55 | }; 56 | 57 | //--------------------------------------------------------------------------- 58 | 59 | SaveFrameRangeObject OpenFrameRange(int frame_count); 60 | 61 | 62 | extern PACKAGE TfrmSaveRange *frmSaveRange; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /Source/Forms/FormSetIgnoredPixels.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include 15 | #pragma hdrstop 16 | 17 | #include 18 | 19 | #include "FormSetIgnoredPixels.h" 20 | #include "LanguageConstants.h" 21 | #include "LanguageHandler.h" 22 | 23 | extern LanguageHandler *GLanguageHandler; 24 | 25 | //--------------------------------------------------------------------------- 26 | #pragma package(smart_init) 27 | #pragma resource "*.dfm" 28 | TfrmSetIgnoredPixels *frmSetIgnoredPixels; 29 | 30 | //--------------------------------------------------------------------------- 31 | 32 | SetIgnoredPixels OpenIgnoredPixels(int matrix_width, int matrix_height) 33 | { 34 | TfrmSetIgnoredPixels *frmSetIgnoredPixels = new TfrmSetIgnoredPixels(Application); 35 | 36 | SetIgnoredPixels sip; 37 | 38 | frmSetIgnoredPixels->MatrixWidth = matrix_width; 39 | frmSetIgnoredPixels->MatrixHeight = matrix_height; 40 | 41 | if (frmSetIgnoredPixels->ShowModal() == mrOk) 42 | { 43 | sip.Process = true; 44 | sip.SetShapeFromInt(frmSetIgnoredPixels->cbCustomShape->ItemIndex); 45 | sip.Parameter = frmSetIgnoredPixels->cbCustomShapeParam->ItemIndex; 46 | } 47 | 48 | delete frmSetIgnoredPixels; 49 | 50 | return sip; 51 | } 52 | 53 | //--------------------------------------------------------------------------- 54 | __fastcall TfrmSetIgnoredPixels::TfrmSetIgnoredPixels(TComponent* Owner) 55 | : TForm(Owner) 56 | { 57 | SetGuiLanguageText(); 58 | } 59 | 60 | 61 | void __fastcall TfrmSetIgnoredPixels::cbCustomShapeChange(TObject *Sender) 62 | { 63 | cbCustomShapeParam->Clear(); 64 | 65 | switch (cbCustomShape->ItemIndex) 66 | { 67 | case customShapeNone: 68 | case customShapeCircle: 69 | cbCustomShapeParam->Items->Add(GLanguageHandler->Text[kNA].c_str()); 70 | break; 71 | case customShapeJustBorders: 72 | int c = std::floor(std::min(MatrixWidth, MatrixHeight) / 2); 73 | 74 | for (int t = 1; t <= c; t++) 75 | { 76 | cbCustomShapeParam->Items->Add(IntToStr(t)); 77 | } 78 | break; 79 | } 80 | 81 | cbCustomShapeParam->ItemIndex = 0; 82 | } 83 | 84 | 85 | void TfrmSetIgnoredPixels::SetGuiLanguageText() 86 | { 87 | Caption = GLanguageHandler->Text[kSetIgnoredPixelsFromPattern].c_str(); 88 | 89 | Label1->Caption = GLanguageHandler->Text[kUseCustomShape].c_str(); 90 | Label11->Caption = GLanguageHandler->Text[kBorder].c_str(); 91 | Label2->Caption = GLanguageHandler->Text[kPixels].c_str(); 92 | 93 | cbCustomShape->Items->Add(GLanguageHandler->Text[kNoCustomShape].c_str()); 94 | cbCustomShape->Items->Add(GLanguageHandler->Text[kCircle].c_str()); 95 | cbCustomShape->Items->Add(GLanguageHandler->Text[kFrameBorderNoCentre].c_str()); 96 | cbCustomShape->ItemIndex = 0; 97 | 98 | bOK->Caption = GLanguageHandler->Text[kOK].c_str(); 99 | bCancel->Caption = GLanguageHandler->Text[kCancel].c_str(); 100 | } 101 | -------------------------------------------------------------------------------- /Source/Forms/FormSetIgnoredPixels.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FormSetIgnoredPixelsH 15 | #define FormSetIgnoredPixelsH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include "MatrixConstants.h" 26 | 27 | //--------------------------------------------------------------------------- 28 | class TfrmSetIgnoredPixels : public TForm 29 | { 30 | __published: // IDE-managed Components 31 | TImage *Image1; 32 | TBevel *Bevel1; 33 | TGroupBox *GroupBox1; 34 | TLabel *Label11; 35 | TLabel *Label1; 36 | TLabel *Label2; 37 | TComboBox *cbCustomShape; 38 | TComboBox *cbCustomShapeParam; 39 | TBitBtn *bOK; 40 | TBitBtn *bCancel; 41 | void __fastcall cbCustomShapeChange(TObject *Sender); 42 | private: 43 | 44 | void SetGuiLanguageText(); 45 | 46 | public: 47 | __fastcall TfrmSetIgnoredPixels(TComponent* Owner); 48 | 49 | int MatrixWidth = 0; 50 | int MatrixHeight = 0; 51 | }; 52 | 53 | struct SetIgnoredPixels 54 | { 55 | bool Process = false; 56 | CustomShape Shape = CustomShape::kNone; 57 | int Parameter = 0; 58 | 59 | void SetShapeFromInt(int i) 60 | { 61 | switch (i) 62 | { 63 | case 0: 64 | Shape = CustomShape::kNone; 65 | break; 66 | case 1: 67 | Shape = CustomShape::kCircle; 68 | break; 69 | case 2: 70 | Shape = CustomShape::kBorders; 71 | break; 72 | case 3: 73 | Shape = CustomShape::kTriangle; 74 | break; 75 | 76 | default: 77 | Shape = CustomShape::kNone; 78 | } 79 | } 80 | }; 81 | 82 | SetIgnoredPixels OpenIgnoredPixels(int, int); 83 | 84 | //--------------------------------------------------------------------------- 85 | extern PACKAGE TfrmSetIgnoredPixels *frmSetIgnoredPixels; 86 | //--------------------------------------------------------------------------- 87 | #endif 88 | -------------------------------------------------------------------------------- /Source/Forms/FormToggleLockStatus.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include 15 | #pragma hdrstop 16 | 17 | #include "FormToggleLockStatus.h" 18 | #include "LanguageConstants.h" 19 | #include "LanguageHandler.h" 20 | 21 | #pragma package(smart_init) 22 | #pragma resource "*.dfm" 23 | TfrmToggleLockStatus *frmToggleLockStatus; 24 | 25 | extern LanguageHandler *GLanguageHandler; 26 | 27 | //--------------------------------------------------------------------------- 28 | //--------------------------------------------------------------------------- 29 | 30 | ToggleLockFrameRange OpenToggleLockStatus() 31 | { 32 | TfrmToggleLockStatus *frmToggleLockStatus = new TfrmToggleLockStatus(Application); 33 | 34 | ToggleLockFrameRange tlfr; 35 | 36 | if (frmToggleLockStatus->ShowModal() == mrOk) 37 | { 38 | tlfr.Process = true; 39 | tlfr.LockStatus = frmToggleLockStatus->cbLockStatus->Checked; 40 | tlfr.StartFrame = frmToggleLockStatus->eStartFrame->Text.ToIntDef(1); 41 | tlfr.EndFrame = frmToggleLockStatus->eEndFrame->Text.ToIntDef(1); 42 | } 43 | 44 | delete frmToggleLockStatus; 45 | 46 | return tlfr; 47 | } 48 | 49 | //--------------------------------------------------------------------------- 50 | //--------------------------------------------------------------------------- 51 | 52 | 53 | __fastcall TfrmToggleLockStatus::TfrmToggleLockStatus(TComponent* Owner) 54 | : TForm(Owner) 55 | { 56 | SetGuiLanguageText(); 57 | } 58 | 59 | 60 | void __fastcall TfrmToggleLockStatus::eStartFrameChange(TObject *Sender) 61 | { 62 | bOk->Enabled = ValidateInputs; 63 | } 64 | 65 | 66 | bool TfrmToggleLockStatus::ValidateInputs() 67 | { 68 | int sf = eStartFrame->Text.ToIntDef(-1); 69 | int ef = eEndFrame->Text.ToIntDef(-1); 70 | 71 | return (sf != -1 && ef != -1 && sf <= ef); 72 | } 73 | 74 | 75 | void TfrmToggleLockStatus::SetGuiLanguageText() 76 | { 77 | Caption = GLanguageHandler->Text[kToggleFrameLockStatus].c_str(); 78 | Label1->Caption = GLanguageHandler->Text[kStart].c_str(); 79 | Label2->Caption = GLanguageHandler->Text[kEnd].c_str(); 80 | cbLockStatus->Caption = GLanguageHandler->Text[kLock].c_str(); 81 | 82 | bOk->Caption = GLanguageHandler->Text[kOK].c_str(); 83 | bCancel->Caption = GLanguageHandler->Text[kCancel].c_str(); 84 | } 85 | -------------------------------------------------------------------------------- /Source/Forms/FormToggleLockStatus.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FormToggleLockStatusH 15 | #define FormToggleLockStatusH 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | 26 | class TfrmToggleLockStatus : public TForm 27 | { 28 | __published: // IDE-managed Components 29 | TBevel *Bevel1; 30 | TImage *Image1; 31 | TBitBtn *bOk; 32 | TBitBtn *bCancel; 33 | TGroupBox *GroupBox1; 34 | TLabel *Label1; 35 | TLabel *Label2; 36 | TEdit *eStartFrame; 37 | TEdit *eEndFrame; 38 | TCheckBox *cbLockStatus; 39 | void __fastcall eStartFrameChange(TObject *Sender); 40 | private: 41 | 42 | bool ValidateInputs(); 43 | void SetGuiLanguageText(); 44 | 45 | public: // User declarations 46 | __fastcall TfrmToggleLockStatus(TComponent* Owner); 47 | }; 48 | 49 | 50 | struct ToggleLockFrameRange 51 | { 52 | bool Process = false; 53 | bool LockStatus = false; 54 | int StartFrame = 0; 55 | int EndFrame = 0; 56 | }; 57 | 58 | ToggleLockFrameRange OpenToggleLockStatus(); 59 | 60 | //--------------------------------------------------------------------------- 61 | extern PACKAGE TfrmToggleLockStatus *frmToggleLockStatus; 62 | //--------------------------------------------------------------------------- 63 | #endif 64 | -------------------------------------------------------------------------------- /Source/Frames/FrameFontPanel.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include 15 | #pragma hdrstop 16 | 17 | #include "FrameFontPanel.h" 18 | //--------------------------------------------------------------------------- 19 | #pragma package(smart_init) 20 | #pragma resource "*.dfm" 21 | TframeFont *frameFont; 22 | 23 | __fastcall TframeFont::TframeFont(TComponent* Owner) 24 | : TFrame(Owner) 25 | { 26 | } 27 | 28 | 29 | void __fastcall TframeFont::lFontClick(TObject *Sender) 30 | { 31 | if (fdMain->Execute()) 32 | { 33 | lFont->Font = fdMain->Font; 34 | 35 | sbChangeFont->Caption = fdMain->Font->Name; 36 | } 37 | } 38 | 39 | 40 | void TframeFont::SetFontAscii(int ascii) 41 | { 42 | FontAscii = ascii; 43 | 44 | lFont->Caption = Char(ascii); 45 | } 46 | -------------------------------------------------------------------------------- /Source/Frames/FrameFontPanel.dfm: -------------------------------------------------------------------------------- 1 | object frameFont: TframeFont 2 | Left = 0 3 | Top = 0 4 | Width = 99 5 | Height = 480 6 | TabOrder = 0 7 | object sbChangeFont: TSpeedButton 8 | Left = 1 9 | Top = 2 10 | Width = 98 11 | Height = 22 12 | Caption = 'Courier New' 13 | end 14 | object lFont: TLabel 15 | Left = 0 16 | Top = 0 17 | Width = 99 18 | Height = 480 19 | Align = alClient 20 | Alignment = taCenter 21 | Caption = 'A' 22 | Font.Charset = DEFAULT_CHARSET 23 | Font.Color = clWindowText 24 | Font.Height = -120 25 | Font.Name = 'Courier New' 26 | Font.Style = [] 27 | ParentFont = False 28 | Layout = tlCenter 29 | OnClick = lFontClick 30 | ExplicitWidth = 72 31 | ExplicitHeight = 129 32 | end 33 | object fdMain: TFontDialog 34 | Font.Charset = DEFAULT_CHARSET 35 | Font.Color = clWindowText 36 | Font.Height = -11 37 | Font.Name = 'Tahoma' 38 | Font.Style = [] 39 | Left = 71 40 | Top = 48 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /Source/Frames/FrameFontPanel.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FrameFontPanelH 15 | #define FrameFontPanelH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | //--------------------------------------------------------------------------- 24 | class TframeFont : public TFrame 25 | { 26 | __published: // IDE-managed Components 27 | TSpeedButton *sbChangeFont; 28 | TLabel *lFont; 29 | TFontDialog *fdMain; 30 | void __fastcall lFontClick(TObject *Sender); 31 | private: 32 | 33 | int FontAscii = 0; 34 | 35 | public: // User declarations 36 | __fastcall TframeFont(TComponent* Owner); 37 | 38 | void SetFontAscii(int); 39 | }; 40 | //--------------------------------------------------------------------------- 41 | extern PACKAGE TframeFont *frameFont; 42 | //--------------------------------------------------------------------------- 43 | #endif 44 | -------------------------------------------------------------------------------- /Source/Frames/FrameGradientPanel.h: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------- 2 | 3 | #ifndef FrameGradientPanelH 4 | #define FrameGradientPanelH 5 | //--------------------------------------------------------------------------- 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | //--------------------------------------------------------------------------- 15 | class TframeGradient : public TFrame 16 | { 17 | __published: // IDE-managed Components 18 | TSpeedButton *sbOpenGradient; 19 | TSpeedButton *sbSaveGradient; 20 | TSpeedButton *sbClearGradient; 21 | TShape *sRGBPaletteColour; 22 | TLabel *lPaletteColourText; 23 | TSpeedButton *sbAddColour; 24 | TSpeedButton *sbRemoveColour; 25 | TSpeedButton *bFromCustom; 26 | TSpeedButton *bFromShades; 27 | TSpeedButton *sbCopyToBrush; 28 | TColorListBox *clbGradient; 29 | TTrackBar *tbRed; 30 | TEdit *eRed; 31 | TEdit *eGreen; 32 | TTrackBar *tbGreen; 33 | TTrackBar *tbBlue; 34 | TEdit *eBlue; 35 | TColorDialog *cdGradient; 36 | TOpenDialog *odGradient; 37 | TSaveDialog *sdGradient; 38 | void __fastcall eRedKeyPress(TObject *Sender, System::WideChar &Key); 39 | void __fastcall clbGradientClick(TObject *Sender); 40 | void __fastcall sbOpenGradientClick(TObject *Sender); 41 | void __fastcall sbSaveGradientClick(TObject *Sender); 42 | void __fastcall sbCopyToBrushClick(TObject *Sender); 43 | void __fastcall sbAddColourClick(TObject *Sender); 44 | void __fastcall sbRemoveColourClick(TObject *Sender); 45 | void __fastcall sRGBPaletteColourMouseDown(TObject *Sender, TMouseButton Button, 46 | TShiftState Shift, int X, int Y); 47 | void __fastcall tbRedChange(TObject *Sender); 48 | void __fastcall bFromShadesClick(TObject *Sender); 49 | void __fastcall bFromCustomClick(TObject *Sender); 50 | void __fastcall sbClearGradientClick(TObject *Sender); 51 | private: 52 | 53 | static const int CRed = 0; 54 | static const int CGreen = 1; 55 | static const int CBlue = 2; 56 | 57 | enum class LoadGradient { kUnknown = 0, kLoadBegin, kLoadEnd, kLoadData }; 58 | 59 | bool LoadGradient(const std::wstring); 60 | bool SaveGradient(const std::wstring); 61 | void SetSlidersFromColour(int); 62 | 63 | public: 64 | __fastcall TframeGradient(TComponent* Owner); 65 | 66 | void SetGuiLanguageText(); 67 | 68 | int GetColour(int); 69 | void AddColour(int); 70 | int GetColourCount(); 71 | 72 | // callbacks 73 | std::function OnCopy; 74 | std::function OnFromCustom; 75 | std::function OnFromShades; 76 | }; 77 | 78 | 79 | //--------------------------------------------------------------------------- 80 | extern PACKAGE TframeGradient *frameGradient; 81 | //--------------------------------------------------------------------------- 82 | #endif 83 | -------------------------------------------------------------------------------- /Source/Frames/FrameLayerPanel.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FrameLayerPanelH 15 | #define FrameLayerPanelH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include "TheMatrix.h" 27 | 28 | //--------------------------------------------------------------------------- 29 | class TframeLayers : public TFrame 30 | { 31 | __published: // IDE-managed Components 32 | TPanel *Panel1; 33 | TSpeedButton *sbLayersRename; 34 | TSpeedButton *sbDeleteLayer; 35 | TSpeedButton *sbAddNewLayer; 36 | TSpeedButton *sbLayerPanelClose; 37 | TSpeedButton *sbLayerUp; 38 | TSpeedButton *sbLayerDown; 39 | TCheckBox *cbSyncAllLayers; 40 | TStringGrid *sgLayers; 41 | TPopupMenu *puLayerTable; 42 | TMenuItem *Clearselectedlayer1; 43 | void __fastcall sbLayerUpClick(TObject *Sender); 44 | void __fastcall sbLayersRenameClick(TObject *Sender); 45 | void __fastcall sbLayerPanelCloseClick(TObject *Sender); 46 | void __fastcall sbLayerDownClick(TObject *Sender); 47 | void __fastcall sbDeleteLayerClick(TObject *Sender); 48 | void __fastcall sbAddNewLayerClick(TObject *Sender); 49 | void __fastcall sgLayersSelectCell(TObject *Sender, int ACol, int ARow, bool &CanSelect); 50 | void __fastcall sgLayersClick(TObject *Sender); 51 | void __fastcall Clearselectedlayer1Click(TObject *Sender); 52 | 53 | private: 54 | 55 | static const int CCellVisible = 0; 56 | static const int CCellLocked = 1; 57 | static const int CCellName = 2; 58 | 59 | public: 60 | __fastcall TframeLayers(TComponent* Owner); 61 | 62 | TheMatrix *ParentMatrix; 63 | 64 | void SetGuiLanguageText(); 65 | void UpdateLayerTable(); 66 | 67 | void UpdateExisting(); 68 | 69 | void SetSyncAll(bool); 70 | bool GetSyncAll(); 71 | 72 | // callbacks 73 | std::function OnClose; 74 | std::function OnMenu; 75 | }; 76 | //--------------------------------------------------------------------------- 77 | extern PACKAGE TframeLayers *frameLayers; 78 | //--------------------------------------------------------------------------- 79 | #endif 80 | -------------------------------------------------------------------------------- /Source/Frames/FramePalettePanel.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FramePalettePanelH 15 | #define FramePalettePanelH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | //--------------------------------------------------------------------------- 25 | class TframePalette : public TFrame 26 | { 27 | __published: // IDE-managed Components 28 | TLabel *lPaletteColourHex; 29 | TShape *sRGBPaletteColour; 30 | TShape *sRGBP7; 31 | TShape *sRGBP6; 32 | TShape *sRGBP5; 33 | TShape *sRGBP4; 34 | TShape *sRGBP3; 35 | TShape *sRGBP2; 36 | TShape *sRGBP1; 37 | TShape *sRGBP8; 38 | TShape *sRGBP9; 39 | TShape *sRGBP15; 40 | TShape *sRGBP16; 41 | TShape *sRGBP23; 42 | TShape *sRGBP22; 43 | TShape *sRGBP24; 44 | TShape *sRGBP17; 45 | TShape *sRGBP10; 46 | TShape *sRGBP11; 47 | TShape *sRGBP18; 48 | TShape *sRGBP25; 49 | TShape *sRGBP26; 50 | TShape *sRGBP19; 51 | TShape *sRGBP12; 52 | TShape *sRGBP13; 53 | TShape *sRGBP20; 54 | TShape *sRGBP27; 55 | TShape *sRGBP28; 56 | TShape *sRGBP21; 57 | TShape *sRGBP14; 58 | TLabel *lPaletteColourInteger; 59 | TTrackBar *tbRed; 60 | TEdit *eRed; 61 | TTrackBar *tbGreen; 62 | TEdit *eGreen; 63 | TEdit *eBlue; 64 | TTrackBar *tbBlue; 65 | TShape *sRGBP30; 66 | TShape *sRGBP29; 67 | TShape *sRGBP31; 68 | TShape *sRGBP32; 69 | TShape *sRGBP33; 70 | TShape *sRGBP34; 71 | TShape *sRGBP35; 72 | TSpeedButton *bClear; 73 | void __fastcall eRedKeyPress(TObject *Sender, System::WideChar &Key); 74 | void __fastcall sRGBP1MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, 75 | int X, int Y); 76 | void __fastcall sRGBP1MouseMove(TObject *Sender, TShiftState Shift, int X, int Y); 77 | void __fastcall tbRedChange(TObject *Sender); 78 | void __fastcall bClearClick(TObject *Sender); 79 | 80 | private: 81 | 82 | static const int CRed = 0; 83 | static const int CGreen = 1; 84 | static const int CBlue = 2; 85 | 86 | static const int kPalletCount = 35; 87 | 88 | int RGBPaletteHistoryIndex = 0; 89 | 90 | void SetUIToColour(int); 91 | 92 | bool LoadPaletteHistory(); 93 | bool SavePaletteHistory(); 94 | 95 | public: 96 | __fastcall TframePalette(TComponent* Owner); 97 | 98 | TShape *RGBPaletteHistory[kPalletCount]; 99 | 100 | void Init(); 101 | void DeInit(); 102 | 103 | void AddToHistory(int); 104 | 105 | std::function OnColourClick; 106 | std::function OnColourMove; 107 | }; 108 | //--------------------------------------------------------------------------- 109 | extern PACKAGE TframePalette *framePalette; 110 | //--------------------------------------------------------------------------- 111 | #endif 112 | -------------------------------------------------------------------------------- /Source/Frames/FrameQuickData.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FrameQuickDataH 15 | #define FrameQuickDataH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | //--------------------------------------------------------------------------- 25 | class TframeSimpleExport : public TFrame 26 | { 27 | __published: // IDE-managed Components 28 | TPanel *Panel1; 29 | TLabel *Label2; 30 | TLabel *lHexPrefix; 31 | TComboBox *cbSource; 32 | TBitBtn *bCopySourceData; 33 | TComboBox *cbSourceDirection; 34 | TComboBox *cbSourceLSB; 35 | TCheckBox *cbCombineNybbles; 36 | TPanel *Panel2; 37 | TMemo *mData; 38 | TPopupMenu *PopupMenu1; 39 | TMenuItem *miHexNone; 40 | TMenuItem *N0xx1; 41 | TMenuItem *N1; 42 | void __fastcall miHexNoneClick(TObject *Sender); 43 | void __fastcall bCopySourceDataClick(TObject *Sender); 44 | void __fastcall cbSourceChange(TObject *Sender); 45 | void __fastcall cbSourceDirectionChange(TObject *Sender); 46 | private: 47 | public: 48 | __fastcall TframeSimpleExport(TComponent* Owner); 49 | 50 | bool GetCombineNybbles(); 51 | int GetDirection(); 52 | bool GetHex(); 53 | int GetLSB(); 54 | int GetSource(); 55 | void SetText(const std::wstring); 56 | void SetGuiLanguageText(); 57 | 58 | std::function OnChange; 59 | }; 60 | 61 | 62 | //--------------------------------------------------------------------------- 63 | extern PACKAGE TframeSimpleExport *frameSimpleExport; 64 | //--------------------------------------------------------------------------- 65 | #endif 66 | -------------------------------------------------------------------------------- /Source/Frames/FrameUndoPanel.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include 15 | #pragma hdrstop 16 | 17 | #include "FrameUndoPanel.h" 18 | #include "Utility.h" 19 | 20 | #pragma package(smart_init) 21 | #pragma resource "*.dfm" 22 | TframeUndos *frameUndos; 23 | 24 | __fastcall TframeUndos::TframeUndos(TComponent* Owner) 25 | : TFrame(Owner) 26 | { 27 | } 28 | 29 | 30 | void __fastcall TframeUndos::lbUndosClick(TObject *Sender) 31 | { 32 | if (OnUndoSelected) OnUndoSelected(lbUndos->ItemIndex); 33 | } 34 | 35 | 36 | void TframeUndos::SetUndos(int count) 37 | { 38 | lbUndos->Clear(); 39 | 40 | for (int t = 0; t < count; t++) 41 | { 42 | lbUndos->Items->Add(Utility::WS2US(L"Undo " + std::to_wstring(t))); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Source/Frames/FrameUndoPanel.dfm: -------------------------------------------------------------------------------- 1 | object frameUndos: TframeUndos 2 | Left = 0 3 | Top = 0 4 | Width = 161 5 | Height = 480 6 | TabOrder = 0 7 | object lbUndos: TListBox 8 | Left = 0 9 | Top = 0 10 | Width = 161 11 | Height = 480 12 | Align = alClient 13 | ItemHeight = 15 14 | TabOrder = 0 15 | OnClick = lbUndosClick 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /Source/Frames/FrameUndoPanel.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #ifndef FrameUndoPanelH 15 | #define FrameUndoPanelH 16 | //--------------------------------------------------------------------------- 17 | #include 18 | #include 19 | #include 20 | #include 21 | //--------------------------------------------------------------------------- 22 | class TframeUndos : public TFrame 23 | { 24 | __published: // IDE-managed Components 25 | TListBox *lbUndos; 26 | void __fastcall lbUndosClick(TObject *Sender); 27 | private: 28 | 29 | public: 30 | __fastcall TframeUndos(TComponent* Owner); 31 | 32 | void SetUndos(int); 33 | 34 | // callbacks 35 | std::function OnUndoSelected; 36 | }; 37 | 38 | //--------------------------------------------------------------------------- 39 | extern PACKAGE TframeUndos *frameUndos; 40 | //--------------------------------------------------------------------------- 41 | #endif 42 | -------------------------------------------------------------------------------- /Source/Gradient.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include 15 | 16 | #include "FileConstants.h" 17 | #include "Formatting.h" 18 | #include "Gradient.h" 19 | 20 | 21 | bool MatrixGradient::Load(const std::wstring file_name) 22 | { 23 | std::wifstream file(file_name); 24 | 25 | if (file) 26 | { 27 | std::wstring s(L""); 28 | 29 | while (std::getline(file, s)) 30 | { 31 | if (s != L"") 32 | { 33 | if (s[0] == L'/' || s[0] == L'#') 34 | { 35 | // comment, do nothing 36 | } 37 | else 38 | { 39 | if (s[0] == kGradientColour[0]) 40 | { 41 | std::wstring v = s.substr(2); 42 | 43 | int idx = 0; 44 | std::wstring colour = L""; 45 | 46 | for (int t = 0; t < v.length(); t++) 47 | { 48 | if (v[t] == L' ') 49 | { 50 | if (Option == GradientOption::kVertical) 51 | { 52 | IY[idx] = stoi(colour); 53 | } 54 | else 55 | { 56 | IX[idx] = stoi(colour); 57 | } 58 | 59 | colour = L""; 60 | 61 | idx++; 62 | } 63 | else 64 | { 65 | colour += v[t]; 66 | } 67 | } 68 | } 69 | } 70 | } 71 | } 72 | 73 | file.close(); 74 | 75 | return true; 76 | } 77 | 78 | return false; 79 | } 80 | 81 | 82 | bool MatrixGradient::Save(const std::wstring file_name) 83 | { 84 | std::ofstream file(file_name); 85 | 86 | if (file) 87 | { 88 | file << Formatting::to_utf8(L"{" + kGradientFileHeader + L"\n"); 89 | 90 | std::wstring g = L""; 91 | 92 | for (int t = 0; t < Height; t++) 93 | { 94 | g += std::to_wstring(IY[t]) + L" "; 95 | } 96 | 97 | file << Formatting::to_utf8(kGradientColour + L":" + g + L"\n"); 98 | file << Formatting::to_utf8(kDataBlockEndS + L"\n"); 99 | 100 | file.close(); 101 | 102 | return true; 103 | } 104 | 105 | return false; 106 | } 107 | 108 | 109 | void MatrixGradient::Clear(int colour) 110 | { 111 | for (int t = 0; t < Width; t++) 112 | { 113 | IX[t] = colour; 114 | } 115 | 116 | for (int t = 0; t < Height; t++) 117 | { 118 | IY[t] = colour; 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /Source/Gradient.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include "MatrixConstants.h" 17 | 18 | 19 | class MatrixGradient 20 | { 21 | 22 | public: 23 | 24 | GradientOption Option = GradientOption::kOff; 25 | 26 | int IY[__MaxHeight]; // gradient in y axis 27 | int IX[__MaxWidth]; // gradient in x axis 28 | 29 | int Width = 0; 30 | int Height = 0; 31 | 32 | bool Load(const std::wstring); 33 | bool Save(const std::wstring); 34 | 35 | void Clear(int colour); 36 | }; 37 | -------------------------------------------------------------------------------- /Source/LEDMatrixStudio.cpp: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------- 2 | 3 | #include 4 | #pragma hdrstop 5 | #include 6 | //--------------------------------------------------------------------------- 7 | #include 8 | #include 9 | USEFORM("Frames\FrameQuickData.cpp", Frame5); /* TFrame: File Type */ 10 | USEFORM("Frames\FrameUndoPanel.cpp", frameUndos); /* TFrame: File Type */ 11 | USEFORM("main.cpp", frmMain); 12 | USEFORM("Frames\FramePalettePanel.cpp", framePalette); /* TFrame: File Type */ 13 | USEFORM("Forms\FormOptimise.cpp", frmOptimise); 14 | USEFORM("Forms\FormPlaybackSpeed.cpp", frmPlaybackSpeed); 15 | USEFORM("Forms\FormPreferences.cpp", frmPreferences); 16 | USEFORM("Forms\FormMerge.cpp", frmMerge); 17 | USEFORM("Forms\FormNewBrush.cpp", frmNewBrush); 18 | USEFORM("Forms\FormNewProject.cpp", frmNewProject); 19 | USEFORM("Forms\FormPreviewPopout.cpp", frmPreviewPopout); 20 | USEFORM("Frames\FrameFontPanel.cpp", frameFont); /* TFrame: File Type */ 21 | USEFORM("Frames\FrameGradientPanel.cpp", frameGradient); /* TFrame: File Type */ 22 | USEFORM("Frames\FrameLayerPanel.cpp", frameLayers); /* TFrame: File Type */ 23 | USEFORM("Forms\FormSaveRange.cpp", frmSaveRange); 24 | USEFORM("Forms\FormSetIgnoredPixels.cpp", frmSetIgnoredPixels); 25 | USEFORM("Forms\FormToggleLockStatus.cpp", frmToggleLockStatus); 26 | USEFORM("Forms\FormAutomate.cpp", frmAutomate); 27 | USEFORM("Forms\FormCheckVersion.cpp", frmCheckVersion); 28 | USEFORM("Forms\FormColourChange.cpp", frmColourChange); 29 | USEFORM("Forms\FormAbout.cpp", frmAbout); 30 | USEFORM("Forms\FormAddLayer.cpp", Form3); 31 | USEFORM("Forms\FormCopyMultiple.cpp", frmCopyMultiple); 32 | USEFORM("Forms\FormExportGIF.cpp", frmExportGIF); 33 | USEFORM("Forms\FormFontViewer.cpp", frmFontViewer); 34 | USEFORM("Forms\FormImportBitmap.cpp", frmImportBitmap); 35 | USEFORM("Forms\FormDeleteMultiple.cpp", frmDeleteMultiple); 36 | USEFORM("Forms\FormExport.cpp", frmExport); 37 | USEFORM("Forms\FormExportCode.cpp", frmExportCode); 38 | //--------------------------------------------------------------------------- 39 | #include "LanguageHandler.h" 40 | #include "SystemSettings.h" 41 | 42 | extern LanguageHandler *GLanguageHandler; 43 | extern SystemSettings *GSystemSettings; 44 | 45 | //--------------------------------------------------------------------------- 46 | int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int) 47 | { 48 | try 49 | { 50 | GSystemSettings = new SystemSettings(); 51 | 52 | GLanguageHandler = new LanguageHandler(GSystemSettings->App.Language); 53 | 54 | Application->Initialize(); 55 | Application->MainFormOnTaskBar = true; 56 | TStyleManager::TrySetStyle("Carbon"); 57 | Application->CreateForm(__classid(TfrmMain), &frmMain); 58 | Application->CreateForm(__classid(TfrmAbout), &frmAbout); 59 | Application->CreateForm(__classid(TfrmPreviewPopout), &frmPreviewPopout); 60 | Application->CreateForm(__classid(TfrmImportBitmap), &frmImportBitmap); 61 | Application->Run(); 62 | } 63 | catch (Exception &exception) 64 | { 65 | Application->ShowException(&exception); 66 | } 67 | catch (...) 68 | { 69 | try 70 | { 71 | throw Exception(""); 72 | } 73 | catch (Exception &exception) 74 | { 75 | Application->ShowException(&exception); 76 | } 77 | } 78 | return 0; 79 | } 80 | //--------------------------------------------------------------------------- 81 | -------------------------------------------------------------------------------- /Source/LEDMatrixStudioPCH1.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | -------------------------------------------------------------------------------- /Source/LEDMatrixStudio_Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaximumOctopus/LEDMatrixStudio/058b1db5ffedfc29454a7f7819999dda52982cbb/Source/LEDMatrixStudio_Icon.ico -------------------------------------------------------------------------------- /Source/LanguageHandler.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include 15 | 16 | #include "LanguageConstants.h" 17 | #include "LanguageHandler.h" 18 | 19 | 20 | LanguageHandler *GLanguageHandler; 21 | 22 | 23 | LanguageHandler::LanguageHandler(const std::wstring LanguageId) 24 | { 25 | LoadSuccess = LoadLanguage(LanguageId); 26 | } 27 | 28 | 29 | bool LanguageHandler::IsLoaded() 30 | { 31 | return LoadSuccess; 32 | } 33 | 34 | 35 | bool LanguageHandler::LoadLanguage(const std::wstring LanguageId) 36 | { 37 | std::wstring path = ExtractFilePath(Application->ExeName).c_str(); 38 | 39 | std::wifstream file(path + L"language\\" + LanguageId + L".txt"); 40 | 41 | if (file) 42 | { 43 | std::wstring s(L""); 44 | 45 | while (std::getline(file, s)) 46 | { 47 | if (s != L"") 48 | { 49 | Text.push_back(s); 50 | } 51 | } 52 | 53 | if (Text.size() != kLanguageConstantCount) 54 | { 55 | LastError = L"Check your language files are up-to-date. They appear to have an incorrect number of entries!"; 56 | 57 | for (int t = Text.size(); t < kLanguageConstantCount + 1; t++) 58 | { 59 | Text.push_back(L"missing #" + std::to_wstring(Text.size())); 60 | } 61 | } 62 | 63 | return true; 64 | } 65 | 66 | for (int t = 0; t < kLanguageConstantCount; t++) 67 | { 68 | Text.push_back(L"# " + std::to_wstring(t)); 69 | } 70 | 71 | LastError = L"Erorr loading language file!"; 72 | 73 | return false; 74 | } 75 | -------------------------------------------------------------------------------- /Source/LanguageHandler.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include 17 | #include 18 | 19 | 20 | class LanguageHandler 21 | { 22 | bool LoadSuccess = false; 23 | 24 | bool LoadLanguage(const std::wstring); 25 | 26 | public: 27 | 28 | std::wstring LastError = L""; 29 | 30 | std::vector Text; 31 | 32 | LanguageHandler(const std::wstring); 33 | 34 | bool IsLoaded(); 35 | }; 36 | -------------------------------------------------------------------------------- /Source/Layer.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include 17 | 18 | #include "matrix.h" 19 | 20 | 21 | class Layer 22 | { 23 | private: 24 | 25 | public: 26 | 27 | std::vector Cells; 28 | 29 | std::wstring Name = L""; 30 | bool Locked = false; 31 | bool Visible = true; 32 | 33 | Layer(std::wstring name) 34 | { 35 | Name = name; 36 | } 37 | }; 38 | -------------------------------------------------------------------------------- /Source/Matrix.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include 17 | 18 | #include "MatrixConstants.h" 19 | 20 | 21 | class Matrix; 22 | 23 | 24 | class MatrixHistory 25 | { 26 | public: 27 | 28 | int *Grid = nullptr; 29 | 30 | MatrixHistory(int *OwnerGrid, int Width, int Height) 31 | { 32 | Grid = new int[Width * Height]; 33 | 34 | for (int i = 0; i < Width * Height; i++) 35 | { 36 | Grid[i] = OwnerGrid[i]; 37 | } 38 | } 39 | 40 | ~MatrixHistory() 41 | { 42 | if (Grid != nullptr) 43 | { 44 | delete[] Grid; 45 | } 46 | } 47 | }; 48 | 49 | 50 | 51 | class Matrix 52 | { 53 | 54 | public: 55 | 56 | int *Grid = nullptr; 57 | 58 | int Width = 0; 59 | int Height = 0; 60 | 61 | bool Locked = false; 62 | 63 | int HistoryOffset = 0; 64 | 65 | std::vector History; 66 | 67 | Matrix(int, int, MatrixMode, int); 68 | 69 | ~Matrix(); 70 | 71 | 72 | void Clear(MatrixMode, int); 73 | void ClearColour(int); 74 | 75 | void ChangePixels(int, int); 76 | 77 | void SafePlot(int, int, int); 78 | 79 | void AddToHistory(); 80 | void AddToHistory(Matrix&); 81 | void AddToHistory(Matrix *m); 82 | 83 | void Undo(); 84 | void Redo(); 85 | 86 | void SetFromUndo(int); 87 | }; 88 | -------------------------------------------------------------------------------- /Source/MatrixDead.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include 17 | 18 | #include "FileConstants.h" 19 | #include "MatrixConstants.h" 20 | 21 | 22 | static const int PixelAlive = 0; 23 | static const int PixelDead = 1; 24 | 25 | 26 | class MatrixDead 27 | { 28 | 29 | private: 30 | 31 | enum class DataParameter { kUnknown = 0, kDeadPixelBegin, kDeadPixelEnd, kRowData }; 32 | 33 | DataParameter LoadDataParameterType(std::wstring, bool); 34 | 35 | void SimpleLine(int, int, int, int); 36 | 37 | public: 38 | 39 | int Width; 40 | int Height; 41 | 42 | int *Grid; 43 | 44 | MatrixDead(int, int); 45 | ~MatrixDead(); 46 | 47 | bool Load(const std::wstring); 48 | bool Save(const std::wstring, int, int); 49 | 50 | void SetFromCustomShape(int, int, CustomShape, int); 51 | void SetAllPixels(int); 52 | }; 53 | -------------------------------------------------------------------------------- /Source/MatrixIgnored.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include 17 | 18 | #include "FileConstants.h" 19 | #include "MatrixConstants.h" 20 | 21 | 22 | static const int PixelAlive = 0; 23 | static const int PixelIgnored = 1; 24 | 25 | 26 | class MatrixIgnored 27 | { 28 | 29 | private: 30 | 31 | enum class DataParameter { kUnknown = 0, kIgnoredPixelBegin, kIgnoredPixelEnd, kRowData }; 32 | 33 | DataParameter LoadDataParameterType(std::wstring, bool); 34 | 35 | void SimpleLine(int, int, int, int); 36 | 37 | public: 38 | 39 | int Width; 40 | int Height; 41 | 42 | int *Grid; 43 | 44 | MatrixIgnored(int, int); 45 | ~MatrixIgnored(); 46 | 47 | bool Load(const std::wstring); 48 | bool Save(const std::wstring, int, int); 49 | 50 | void SetFromCustomShape(int, int, CustomShape, int); 51 | void SetAllPixels(int); 52 | }; 53 | -------------------------------------------------------------------------------- /Source/Optimisation.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include 17 | 18 | #include "ExportOptions.h" 19 | #include "TheMatrix.h" 20 | 21 | 22 | namespace Optimiser 23 | { 24 | bool OptimiseData(TheMatrix *thematrix, ExportOptions teo, std::vector &data); 25 | bool OptimiseDataSimple(TheMatrix *thematrix, ExportOptions teo, std::vector &data, std::vector &output); 26 | 27 | void ProcessUnique(std::vector &data, std::vector &unique_items); 28 | } 29 | -------------------------------------------------------------------------------- /Source/PresetHandler.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include 17 | 18 | #include "FileConstants.h" 19 | #include "MatrixConstants.h" 20 | #include "Utility.h" 21 | 22 | 23 | struct MatrixPreset 24 | { 25 | bool Configured = false; 26 | 27 | int Width = 0; 28 | int Height = 0; 29 | int PixelSize = 0; 30 | int PixelShape = 0; 31 | 32 | MatrixMode Mode = MatrixMode::kNone; 33 | std::wstring MatrixModeText = L""; 34 | int MatrixModeTag = 0; 35 | 36 | void SetMatrixModeFromInt(int mm) 37 | { 38 | MatrixModeTag = mm; 39 | 40 | Mode = ConstantsHelper::MatrixModeFromInt(mm); 41 | 42 | MatrixModeText = ConstantsHelper::MatrixModeAsString(Mode); 43 | } 44 | }; 45 | 46 | 47 | class PresetHandler 48 | { 49 | 50 | private: 51 | 52 | enum class MatrixPresetParameter { kUnknown = 0, kStructBegin, kStructEnd, kProjectWidth, kProjectHeight, 53 | kSource, kSourceLSB, kSourceDirection, kUnused, kPixelSize, kMatrixType }; 54 | 55 | MatrixPresetParameter GetMatrixPresetParameterType(const std::wstring); 56 | 57 | public: 58 | 59 | std::vector Presets; 60 | 61 | PresetHandler(const std::wstring); 62 | 63 | void PopulateList(const std::wstring); 64 | 65 | MatrixPreset Load(const std::wstring); 66 | 67 | bool Save(std::wstring, MatrixPreset&); 68 | }; 69 | -------------------------------------------------------------------------------- /Source/PreviewSettings.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include "PreviewSettings.h" 15 | 16 | 17 | ViewShape PreviewOptionsHelper::IntToViewShape(int v) 18 | { 19 | switch (v) 20 | { 21 | case 0: 22 | return ViewShape::kSquare; 23 | case 1: 24 | return ViewShape::kRadial; 25 | case 2: 26 | return ViewShape::kRadial3Q; 27 | case 3: 28 | return ViewShape::kSemiCircle; 29 | case 4: 30 | return ViewShape::kSemiCircleInverted; 31 | } 32 | 33 | return ViewShape::kSquare; 34 | } 35 | 36 | 37 | int PreviewOptionsHelper::ViewShapeToInt(ViewShape vs) 38 | { 39 | switch (vs) 40 | { 41 | case ViewShape::kSquare: 42 | return 0; 43 | case ViewShape::kRadial: 44 | return 1; 45 | case ViewShape::kRadial3Q: 46 | return 2; 47 | case ViewShape::kSemiCircle: 48 | return 3; 49 | case ViewShape::kSemiCircleInverted: 50 | return 4; 51 | } 52 | 53 | return 0; 54 | } 55 | -------------------------------------------------------------------------------- /Source/PreviewSettings.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include "MatrixConstants.h" 17 | 18 | 19 | struct PreviewOptions 20 | { 21 | bool Active = false; 22 | bool CanDraw = false; // can the user draw directly to the preview canvas 23 | 24 | int Size = 1; 25 | ViewShape View = ViewShape::kSquare; 26 | 27 | PixelShape Shape = PixelShape::kSquare; // selected by user 28 | PixelShape DisplayShape = PixelShape::kSquare; // used to render preview (may change from above depending on pixel size) 29 | 30 | int Void = 15; 31 | int Offset = 0; 32 | int Direction = 0; 33 | 34 | int RPixel = 1; // size of pixel in radial mode 35 | int ROffset = 15; // size of the inner void (pixels, radius) for radial/semi-circle 36 | 37 | int OldSize = 0; 38 | bool IncrementRadially = false; 39 | 40 | bool Popout = false; 41 | 42 | void ViewShapeFromInt(int i) 43 | { 44 | switch (i) 45 | { 46 | case 0: 47 | View = ViewShape::kSquare; 48 | break; 49 | case 1: 50 | View = ViewShape::kRadial; 51 | break; 52 | case 2: 53 | View = ViewShape::kRadial3Q; 54 | break; 55 | case 3: 56 | View = ViewShape::kSemiCircle; 57 | break; 58 | case 4: 59 | View = ViewShape::kSemiCircleInverted; 60 | break; 61 | } 62 | } 63 | }; 64 | 65 | 66 | namespace PreviewOptionsHelper 67 | { 68 | ViewShape IntToViewShape(int v); 69 | int ViewShapeToInt(ViewShape); 70 | } 71 | -------------------------------------------------------------------------------- /Source/ProfileHandler.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include 17 | 18 | #include "ExportOptions.h" 19 | 20 | 21 | class ProfileHandler 22 | { 23 | enum class LoadProfile { kUnknown = 0, kDataBegin, kDataEnd, 24 | kSource, kOrientation, kLSB, kLanguage, kNumberFormat, kNumberSize, kScanDirection, 25 | kLineContent, kLineCount, 26 | kRGBMode, kRGBChangePixels, kRGBChangeColour, kRGBBrightness, 27 | kMinWidth, kMaxWidth, kMinHeight, kMaxHeight, 28 | kInformation, 29 | kBinarySource, kBinaryOrientation, kBinaryLSB, kBinaryScanDirection, 30 | kBinaryRGBMode, kBinaryRGBChangePixels, kBinaryRGBChangeColour, kBinaryRGBBrightness, 31 | kBinaryFileContents }; 32 | 33 | std::wstring Path = L""; 34 | 35 | bool PopulateList(std::vector&, const std::wstring); 36 | 37 | LoadProfile GetParameterType(const std::wstring); 38 | 39 | public: 40 | 41 | std::vector Profiles; 42 | std::vector ProfilesRGB; 43 | std::vector ProfilesRGB3BPP; 44 | 45 | ProfileHandler(const std::wstring); 46 | 47 | ExportOptions Load(const std::wstring); 48 | bool Save(const std::wstring, bool, ExportOptions&); 49 | 50 | bool DeleteExportProfile(const std::wstring); 51 | 52 | void UpdateAll(); 53 | }; 54 | -------------------------------------------------------------------------------- /Source/ProjectSettings.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include "matrixconstants.h" 17 | 18 | 19 | struct ProjectSettings 20 | { 21 | bool Valid; 22 | 23 | MatrixMode Mode = MatrixMode::kMono; 24 | int Width = 0; 25 | int Height = 0; 26 | bool Clear = false; 27 | int Special = 0; 28 | bool SizeType = false; 29 | int PixelSize = 20; 30 | PixelShape Shape = PixelShape::kSquare; 31 | 32 | CustomShape ShapeCustom = CustomShape::kNone; 33 | int CustomShapeParam = 0; 34 | 35 | int Background = 0; 36 | 37 | void CustomShapeFromInt(int i) 38 | { 39 | switch (i) 40 | { 41 | case 0: 42 | ShapeCustom = CustomShape::kNone; 43 | break; 44 | case 1: 45 | ShapeCustom = CustomShape::kCircle; 46 | break; 47 | case 2: 48 | ShapeCustom = CustomShape::kBorders; 49 | break; 50 | case 3: 51 | ShapeCustom = CustomShape::kTriangle; 52 | break; 53 | } 54 | } 55 | 56 | void MatrixModeFromInt(int i) 57 | { 58 | switch (i) 59 | { 60 | case 0: 61 | Mode = MatrixMode::kNone; 62 | break; 63 | case 1: 64 | Mode = MatrixMode::kMono; 65 | break; 66 | case 2: 67 | Mode = MatrixMode::kBiSequential; 68 | break; 69 | case 3: 70 | Mode = MatrixMode::kBiBitplanes; 71 | break; 72 | case 4: 73 | Mode = MatrixMode::kRGB; 74 | break; 75 | case 5: 76 | Mode = MatrixMode::kRGB3BPP; 77 | break; 78 | 79 | default: 80 | Mode = MatrixMode::kNone; 81 | } 82 | } 83 | 84 | void PixelShapeFromInt(int i) 85 | { 86 | switch (i) 87 | { 88 | case 0: 89 | Shape = PixelShape::kSquare; 90 | break; 91 | case 1: 92 | Shape = PixelShape::kCircle; 93 | break; 94 | case 2: 95 | Shape = PixelShape::kRoundRect; 96 | break; 97 | } 98 | } 99 | 100 | int MatrixModeToInt() 101 | { 102 | switch (Mode) 103 | { 104 | case MatrixMode::kNone: 105 | return 0; 106 | case MatrixMode::kMono: 107 | return 1; 108 | case MatrixMode::kBiSequential: 109 | return 2; 110 | case MatrixMode::kBiBitplanes: 111 | return 3; 112 | case MatrixMode::kRGB: 113 | return 4; 114 | case MatrixMode::kRGB3BPP: 115 | return 5; 116 | } 117 | 118 | return 0; 119 | } 120 | 121 | int PixelShapeToInt() 122 | { 123 | switch (Shape) 124 | { 125 | case PixelShape::kSquare: 126 | return 0; 127 | case PixelShape::kCircle: 128 | return 1; 129 | case PixelShape::kRoundRect: 130 | return 2; 131 | } 132 | 133 | return 0; 134 | } 135 | }; 136 | -------------------------------------------------------------------------------- /Source/RGBPaletteColours.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | 17 | struct RGBPaletteColours 18 | { 19 | int Left = 0; 20 | int Middle = 0; 21 | int Right = 0; 22 | 23 | int History[28]; 24 | }; 25 | -------------------------------------------------------------------------------- /Source/Registry.cpp: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #include "Registry.h" 20 | 21 | 22 | std::wstring Registry::ReadString(HKEY hKey, const std::wstring key_name, const std::wstring aDefaultValue) 23 | { 24 | const DWORD SIZE = 1024; 25 | wchar_t szValue[SIZE]; 26 | DWORD dwValue = SIZE; 27 | DWORD dwType = 0; 28 | 29 | long dwRet = RegQueryValueEx(hKey, 30 | key_name.c_str(), 31 | NULL, 32 | &dwType, 33 | (LPBYTE)&szValue, 34 | &dwValue); 35 | 36 | if ((dwRet != ERROR_SUCCESS) || (dwType != REG_SZ)) 37 | { 38 | return aDefaultValue; 39 | } 40 | 41 | return szValue; 42 | } 43 | 44 | 45 | int Registry::ReadInteger(HKEY hKey, const std::wstring key_name, int default_value) 46 | { 47 | DWORD dwBufferSize(sizeof(DWORD)); 48 | DWORD nResult(0); 49 | DWORD dwType = 0; 50 | 51 | long dwRet = RegQueryValueEx(hKey, 52 | key_name.c_str(), 53 | NULL, 54 | &dwType, 55 | reinterpret_cast(&nResult), 56 | &dwBufferSize); 57 | 58 | if (dwRet != ERROR_SUCCESS) 59 | { 60 | return default_value; 61 | } 62 | 63 | return nResult; 64 | } 65 | 66 | 67 | bool Registry::ReadBool(HKEY hKey, const std::wstring key_name, bool default_value) 68 | { 69 | DWORD val = 0; 70 | DWORD valSize = sizeof(DWORD); 71 | DWORD valType = REG_NONE; 72 | 73 | long ret = RegQueryValueEx(hKey, 74 | key_name.c_str(), 75 | NULL, 76 | &valType, 77 | (PBYTE)&val, &valSize); 78 | 79 | if ((ERROR_SUCCESS == ret) && (REG_DWORD == valType)) 80 | { 81 | return (0 != val); 82 | } 83 | 84 | return default_value; 85 | } 86 | 87 | 88 | bool Registry::WriteString(HKEY hKey, const std::wstring& key_name, const std::wstring& value) 89 | { 90 | return (RegSetValueExW(hKey, 91 | key_name.c_str(), 92 | 0, 93 | REG_SZ, 94 | (LPBYTE)(value.c_str()), 95 | (value.size() + 1) * sizeof(wchar_t)) == ERROR_SUCCESS); 96 | } 97 | 98 | 99 | bool Registry::WriteInteger(HKEY hKey, const std::wstring& key_name, const int &value) 100 | { 101 | return (RegSetValueExW(hKey, 102 | key_name.c_str(), 103 | 0, 104 | REG_DWORD, 105 | (const byte*)&value, 106 | sizeof(value)) == ERROR_SUCCESS); 107 | } 108 | 109 | 110 | bool Registry::Delete(HKEY hKey, const std::wstring& key_name) 111 | { 112 | return (RegDeleteValue(hKey, key_name.c_str()) == ERROR_SUCCESS); 113 | } -------------------------------------------------------------------------------- /Source/Registry.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | 17 | #include 18 | #include 19 | 20 | 21 | namespace Registry 22 | { 23 | [[nodiscard]] std::wstring ReadString(HKEY, const std::wstring, std::wstring); 24 | 25 | [[nodiscard]] int ReadInteger(HKEY, const std::wstring, int); 26 | 27 | [[nodiscard]] bool ReadBool(HKEY, const std::wstring, bool); 28 | 29 | bool WriteString(HKEY, const std::wstring&, const std::wstring&); 30 | bool WriteInteger(HKEY, const std::wstring&, const int &); 31 | 32 | [[nodiscard]] bool Delete(HKEY, const std::wstring&); 33 | } -------------------------------------------------------------------------------- /Source/SystemConstants.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | 17 | static const std::wstring __LEDStudioDate = L"October 20th 2024"; 18 | 19 | #if _WIN64 20 | static const std::wstring __LEDStudioVersion = L"0.20.27 (x64)"; 21 | #else 22 | static const std::wstring __LEDStudioVersion = L"0.20.27 (x32)"; 23 | #endif 24 | 25 | static const std::wstring __SimpleTextFull = L"(c) Paul Alan Freshney :: " + __LEDStudioDate + L" :: www.MaximumOctopus.com"; 26 | 27 | static const std::wstring __Caption = __LEDStudioVersion + L" :: " + __LEDStudioDate; 28 | 29 | // used by checkversion 30 | static const UnicodeString __ApplicationVersionFileUrl = L"http://www.maximumoctopus.com/versions/dled2.html"; 31 | static const UnicodeString __ApplicationHistoryFileUrl = L"http://www.maximumoctopus.com/versions/hled2.html"; 32 | -------------------------------------------------------------------------------- /Source/SystemSettings.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include 17 | 18 | #include "ApplicationSettings.h" 19 | #include "ExportGIFSettings.h" 20 | #include "PreviewSettings.h" 21 | #include "ProjectSettings.h" 22 | #include "Toolbars.h" 23 | 24 | 25 | enum class RowColumnData { kOff = 0, kData, kIndex }; 26 | enum class PixelSize { kSizeAuto = 0, kSize10, kSize15, kSize20, kSize25, kSize30, kSize40, kSize50 }; 27 | 28 | 29 | static const int CPixelSizeAuto = 0; 30 | static const int CPixelSize10 = 10; 31 | static const int CPixelSize15 = 15; 32 | static const int CPixelSize20 = 20; 33 | static const int CPixelSize25 = 25; 34 | static const int CPixelSize30 = 30; 35 | static const int CPixelSize40 = 40; 36 | static const int CPixelSize50 = 50; 37 | 38 | 39 | class SystemSettings 40 | { 41 | 42 | private: 43 | 44 | static constexpr int defaultRGBPalatte[] = { 0x000000, 0xFFFFFF, 0x0000FF, 0x0088FF, 0x0044FF, 0x00FFFF, 0x88FFFF, 0x44FFFF, 45 | 0x00FF00, 0x88FF88, 0x44FF44, 0xFF0000, 0xFF8800, 0xFF00FF, 0xFF44FF, 0xFF88FF }; 46 | 47 | HKEY hKey; 48 | 49 | public: 50 | 51 | AppSettings App; 52 | ProjectSettings Project; 53 | 54 | int LEDColoursSingle[6] = { clBlack, clWhite, clBlack, clBlack, clBlue, 0x00AAAAAA }; 55 | int LEDColoursBi[6] = { clBlack, clRed, clGreen, clYellow, clBlue, 0x00AAAAAA }; 56 | int RGBBackground = clBlack; 57 | int LEDRGBColours[6] = { clRed, clBlue, clYellow, clBlack, clBlack, clBlack }; 58 | int SelectionColours[3] = { 2, 1, 0 }; 59 | Toolbars Bars; 60 | RowColumnData RowColumn = RowColumnData::kOff; 61 | bool UseFormatData = false; 62 | PreviewOptions Preview; 63 | int RGBPalette[16] = { 0x000000, 0xFFFFFF, 0x0000FF, 0x0088FF, 0x0044FF, 0x00FFFF, 0x88FFFF, 0x44FFFF, 64 | 0x00FF00, 0x88FF88, 0x44FF44, 0xFF0000, 0xFF8800, 0xFF00FF, 0xFF44FF, 0xFF88FF }; 65 | 66 | ExportGIFSettings ExportGIF; 67 | 68 | std::vector FileHistory; 69 | 70 | std::vector Gradients; 71 | std::vector Languages; 72 | 73 | SystemSettings(); 74 | 75 | bool LoadSettings(); 76 | bool SaveSettings(); 77 | 78 | void BuildLanguageList(const std::wstring); 79 | void BuildGradientList(const std::wstring); 80 | 81 | void RecalculatePadding(MatrixMode, int, int); 82 | }; 83 | -------------------------------------------------------------------------------- /Source/Toolbars.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | 17 | struct Toolbars 18 | { 19 | bool ColumnRow = true; 20 | bool RGBPalette = true; 21 | bool Pattern = true; 22 | bool Animation = true; 23 | }; 24 | -------------------------------------------------------------------------------- /Source/Utility.h: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2024 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // https://maximumoctopus.hashnode.dev/ 9 | // 10 | // C++ Rewrite October 11th 2023 11 | // 12 | // =================================================================== 13 | 14 | #pragma once 15 | 16 | #include 17 | 18 | #include "MatrixConstants.h" 19 | 20 | 21 | namespace Utility 22 | { 23 | bool ValidateNumber(const std::wstring, int); 24 | 25 | std::wstring GetAutoSaveName(); 26 | 27 | bool IsAlphaNumeric(const wchar_t); 28 | 29 | std::wstring RemoveExtension(const std::wstring); 30 | std::wstring GetFilePrefix(const std::wstring); 31 | std::wstring GetFileNameNoExt(const std::wstring); 32 | 33 | void ExecuteFile(const std::wstring); 34 | 35 | bool IsAlphaNumeric(const std::wstring, int); 36 | 37 | std::wstring ReplaceString(const std::wstring, const std::wstring&, const std::wstring&); 38 | 39 | System::UnicodeString WS2US(const std::wstring); 40 | } 41 | -------------------------------------------------------------------------------- /Source/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaximumOctopus/LEDMatrixStudio/058b1db5ffedfc29454a7f7819999dda52982cbb/Source/main.cpp -------------------------------------------------------------------------------- /Source/readme.txt: -------------------------------------------------------------------------------- 1 | C++ source code for the 2023/4 rewrite. 2 | 3 | Written with C++ Builder 12 Community Edition 4 | 5 | https://www.embarcadero.com/products/cbuilder/starter 6 | 7 | Everything is fully functional, though there maybe the occasional bug! Please let me know if you find a bug or other problem. 8 | 9 | You will have to copy the LEDMatrixStudio folder structure (from the latest public beta build) to your build environment, otherwise some parts (like language selection) won't work or will cause errors. 10 | 11 | Paul, October 5th 2024 12 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/classes/colours.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | unit colours; 13 | 14 | 15 | interface 16 | 17 | 18 | type 19 | TColours = record 20 | HasData : boolean; 21 | 22 | DrawColours : array[1..3] of integer; // left, middle, right 23 | CustomColours : array[0..15] of integer; 24 | 25 | PaletteHistory : array[0..27] of integer; 26 | end; 27 | 28 | 29 | implementation 30 | 31 | 32 | end. 33 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/classes/drawingdata.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | unit drawingdata; 13 | 14 | 15 | interface 16 | 17 | 18 | uses System.Types; 19 | 20 | 21 | type 22 | TDrawMode = (dmNone, 23 | dmFilledBox, dmEmptyBox, 24 | dmLine, dmFont, 25 | dmEmptyCircle, dmFilledCircle, 26 | dmRandom, dmMulti, dmPicker, 27 | dmCopy, dmPaste, 28 | dmGradientBrush, 29 | dmFloodFill, 30 | dmSpiral, dmRing, dmSplitRing, dmPetals, dmGrid, dmPyramid, dmLeftTriangle, dmRightTriangle); 31 | 32 | TDrawPoint = (dpNone, dpFirst, dpLast); 33 | 34 | 35 | TDrawData = record 36 | Mode : TDrawMode; 37 | Point : integer; 38 | Colour : integer; 39 | Coords : array[0..1] of TPoint; 40 | Special : integer; 41 | 42 | CopyPos : TPoint; 43 | 44 | ParameterMin : integer; 45 | ParameterMax : integer; 46 | Parameter : integer; 47 | 48 | SinglePoint : boolean; // this draw mode only requires a single click to render 49 | end; 50 | 51 | 52 | const 53 | CDrawPointNone = 0; 54 | CDrawPointFirst = 1; 55 | CDrawPointLast = 2; 56 | 57 | 58 | implementation 59 | 60 | 61 | end. 62 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/classes/examples/example_CPP.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://sourceforge.net/projects/led-matrix-studio/ 7 | // 8 | // Please do not redistribute the source code! 9 | // 10 | // Started: October 13th 2021 11 | // Modified: October 13th 2021 12 | // 13 | // =================================================================== 14 | 15 | 16 | unit example_CPP; 17 | 18 | 19 | interface 20 | 21 | 22 | uses SysUtils; 23 | 24 | 25 | type 26 | TExampleCPP = class 27 | class function GetExample: string; 28 | end; 29 | 30 | 31 | implementation 32 | 33 | 34 | class function TExampleCPP.GetExample: string; 35 | begin 36 | Result := ''; 37 | end; 38 | 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/classes/examples/example_Microchip.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://sourceforge.net/projects/led-matrix-studio/ 7 | // 8 | // Please do not redistribute the source code! 9 | // 10 | // Started: October 13th 2021 11 | // Modified: October 13th 2021 12 | // 13 | // =================================================================== 14 | 15 | 16 | unit example_Microchip; 17 | 18 | 19 | interface 20 | 21 | 22 | uses SysUtils; 23 | 24 | 25 | type 26 | TExampleMicrochip = class 27 | class function GetExample: string; 28 | end; 29 | 30 | 31 | implementation 32 | 33 | 34 | class function TExampleMicrochip.GetExample: string; 35 | begin 36 | Result := ''; 37 | end; 38 | 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/classes/examples/example_PICAXE.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://sourceforge.net/projects/led-matrix-studio/ 7 | // 8 | // Please do not redistribute the source code! 9 | // 10 | // Started: October 13th 2021 11 | // Modified: October 13th 2021 12 | // 13 | // =================================================================== 14 | 15 | 16 | unit example_PICAXE; 17 | 18 | 19 | interface 20 | 21 | 22 | uses SysUtils; 23 | 24 | 25 | type 26 | TExamplePICAXE = class 27 | class function GetExample: string; 28 | end; 29 | 30 | 31 | implementation 32 | 33 | 34 | class function TExamplePICAXE.GetExample: string; 35 | begin 36 | Result := ''; 37 | end; 38 | 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/classes/examples/example_PYTHON.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://sourceforge.net/projects/led-matrix-studio/ 7 | // 8 | // Please do not redistribute the source code! 9 | // 10 | // Started: October 13th 2021 11 | // Modified: October 13th 2021 12 | // 13 | // =================================================================== 14 | 15 | 16 | unit example_PYTHON; 17 | 18 | 19 | interface 20 | 21 | 22 | uses SysUtils; 23 | 24 | 25 | type 26 | TExamplePYTHON = class 27 | class function GetExample: string; 28 | end; 29 | 30 | 31 | implementation 32 | 33 | 34 | class function TExamplePYTHON.GetExample: string; 35 | begin 36 | Result := ''; 37 | end; 38 | 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/classes/examples/example_fastLED.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://sourceforge.net/projects/led-matrix-studio/ 7 | // 8 | // Please do not redistribute the source code! 9 | // 10 | // Started: October 13th 2021 11 | // Modified: October 13th 2021 12 | // 13 | // =================================================================== 14 | 15 | 16 | unit example_fastLED; 17 | 18 | 19 | interface 20 | 21 | 22 | uses SysUtils; 23 | 24 | 25 | type 26 | TExampleFastLED = class 27 | class function GetExample(aFrameStart, aFrameEnd, aPixelsPerFrame : integer): string; 28 | end; 29 | 30 | 31 | 32 | implementation 33 | 34 | 35 | class function TExampleFastLED.GetExample(aFrameStart, aFrameEnd, aPixelsPerFrame : integer): string; 36 | var 37 | t : integer; 38 | 39 | begin 40 | Result := ''; 41 | 42 | Result := Result + 'const int __NUM_LEDS = ' + IntToStr(aPixelsPerFrame) + '; // per frame' + #13#10; 43 | Result := Result + 'const unsigned long __DELAY_MS = 225;' + #13#10; 44 | Result := Result + #13#10; 45 | Result := Result + 'void loop() {' + #13#10; 46 | Result := Result + #13#10; 47 | 48 | for t := aFrameStart to aFrameEnd do begin 49 | Result := Result + ' FastLED.clear();' + #13#10; 50 | Result := Result + ' for(int i = 0; i < __NUM_LEDS; i++)' + #13#10; 51 | Result := Result + ' {' + #13#10; 52 | Result := Result + ' leds[i] = pgm_read_dword(&(ledarray' + IntToStr(t - 1) + '[i]));' + #13#10; 53 | Result := Result + ' }' + #13#10; 54 | Result := Result + ' FastLED.show();' + #13#10; 55 | Result := Result + ' delay(__DELAY_MS);' + #13#10; 56 | Result := Result + '' + #13#10; 57 | end; 58 | 59 | Result := Result + '}' + #13#10; 60 | end; 61 | 62 | 63 | end. 64 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/classes/fonthandler.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | 13 | unit fonthandler; 14 | 15 | 16 | interface 17 | 18 | 19 | uses SysUtils, Vcl.StdCtrls, 20 | 21 | utility; 22 | 23 | 24 | type 25 | TFontHandler = class 26 | class function GetFontList(aPath : string; aFontList : TComboBox): boolean; 27 | end; 28 | 29 | 30 | implementation 31 | 32 | 33 | class function TFontHandler.GetFontList(aPath : string; aFontList : TComboBox): boolean; 34 | var 35 | lSearchResult : TSearchRec; 36 | 37 | begin 38 | Result := True; 39 | 40 | if FindFirst(aPath, faAnyFile, lSearchResult) = 0 then begin 41 | aFontList.Clear; 42 | 43 | repeat 44 | aFontList.Items.Add(TUtility.RemoveExtension(lSearchResult.Name)); 45 | until FindNext(lSearchResult) <> 0; 46 | 47 | FindClose(lSearchResult); 48 | end 49 | else 50 | Result := False; // no fonts found 51 | end; 52 | 53 | 54 | end. 55 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/classes/layer.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | unit layer; 13 | 14 | 15 | interface 16 | 17 | 18 | uses System.Generics.Collections, 19 | 20 | matrix; 21 | 22 | 23 | type 24 | TLayer = class 25 | constructor Create(aName : string); 26 | destructor Destory; 27 | private 28 | FName : string; 29 | FVisible : boolean; 30 | FLocked : boolean; 31 | public 32 | Frames : TObjectList; 33 | 34 | property Locked : boolean read FLocked write FLocked; 35 | property Name : string read FName write FName; 36 | property Visible : boolean read FVisible write FVisible; 37 | end; 38 | 39 | 40 | implementation 41 | 42 | 43 | constructor TLayer.Create(aName : string); 44 | begin 45 | FName := aName; 46 | FVisible := True; 47 | 48 | Frames := TObjectList.Create; 49 | end; 50 | 51 | 52 | destructor TLayer.Destory; 53 | begin 54 | Frames.Free; 55 | end; 56 | 57 | 58 | end. 59 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/forms/formAbout.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | unit formAbout; 13 | 14 | interface 15 | 16 | uses 17 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 18 | Buttons, StdCtrls, ExtCtrls, Vcl.Imaging.pngimage; 19 | 20 | type 21 | TfrmAbout = class(TForm) 22 | Label3: TLabel; 23 | lVersion: TLabel; 24 | Label12: TLabel; 25 | Label13: TLabel; 26 | lDate: TLabel; 27 | Label5: TLabel; 28 | lUndos: TLabel; 29 | Image1: TImage; 30 | Shape1: TShape; 31 | procedure FormCreate(Sender: TObject); 32 | procedure Label13Click(Sender: TObject); 33 | procedure Image1Click(Sender: TObject); 34 | procedure Label5Click(Sender: TObject); 35 | procedure FormShow(Sender: TObject); 36 | private 37 | { Private declarations } 38 | public 39 | { Public declarations } 40 | end; 41 | 42 | var 43 | frmAbout: TfrmAbout; 44 | 45 | 46 | implementation 47 | 48 | 49 | {$R *.DFM} 50 | 51 | 52 | uses utility; 53 | 54 | 55 | procedure TfrmAbout.FormCreate(Sender: TObject); 56 | begin 57 | lDate.Caption := LEDStudioDate; 58 | lVersion.Caption := 'LED Matrix Studio'; 59 | end; 60 | 61 | 62 | procedure TfrmAbout.FormShow(Sender: TObject); 63 | begin 64 | lUndos.Caption := IntToStr(MatrixMain.GetTotalUndos) + ' undos'; 65 | end; 66 | 67 | 68 | procedure TfrmAbout.Image1Click(Sender: TObject); 69 | begin 70 | Close; 71 | end; 72 | 73 | 74 | procedure TfrmAbout.Label13Click(Sender: TObject); 75 | begin 76 | TUtility.ExecuteFile(0, LowerCase((Sender As TLabel).Caption), '', ''); 77 | end; 78 | 79 | 80 | procedure TfrmAbout.Label5Click(Sender: TObject); 81 | begin 82 | case TLabel(Sender).Tag of 83 | 0 : TUtility.ExecuteFile(0, 'https://github.com/MaximumOctopus/LEDMatrixStudio', '', ''); 84 | 1 : TUtility.ExecuteFile(0, 'http://twitter.com/maximumoctopus', '', ''); 85 | 2 : TUtility.ExecuteFIle(0, 'mailto:freeware@freshney.org', '', ''); 86 | end; 87 | end; 88 | 89 | 90 | end. 91 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/forms/formAddLayer.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | 13 | unit formAddLayer; 14 | 15 | interface 16 | 17 | uses 18 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 19 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, Vcl.ExtCtrls, 20 | 21 | languagehandler; 22 | 23 | type 24 | TfrmAddLayer = class(TForm) 25 | Bevel1: TBevel; 26 | Image1: TImage; 27 | bOK: TBitBtn; 28 | bCancel: TBitBtn; 29 | GroupBox1: TGroupBox; 30 | Label1: TLabel; 31 | Label6: TLabel; 32 | eName: TEdit; 33 | cbSourceLayer: TComboBox; 34 | cbCopyFrom: TCheckBox; 35 | Label2: TLabel; 36 | procedure cbCopyFromClick(Sender: TObject); 37 | procedure FormCreate(Sender: TObject); 38 | private 39 | procedure SetGUILanguageText; 40 | public 41 | { Public declarations } 42 | end; 43 | 44 | 45 | TAddObject = record 46 | Process : boolean; 47 | Name : string; 48 | CopyFrom : boolean; 49 | CopyLayer : integer; 50 | end; 51 | 52 | 53 | function DoAddLayer(var aLayers : TStringList): TAddObject; 54 | 55 | 56 | var 57 | frmAddLayer: TfrmAddLayer; 58 | 59 | 60 | implementation 61 | 62 | 63 | {$R *.dfm} 64 | 65 | 66 | function DoAddLayer(var aLayers : TStringList): TAddObject; 67 | var 68 | t : integer; 69 | 70 | begin 71 | with TfrmAddLayer.Create(Application) do 72 | try 73 | Result.Process := False; 74 | 75 | eName.Text := GLanguageHandler.Text[kLayer] + ' ' + IntToStr(aLayers.Count + 1); 76 | 77 | for t := 0 to aLayers.Count - 1 do 78 | cbSourceLayer.Items.Add(aLayers[t]); 79 | 80 | cbSourceLayer.ItemIndex := 0; 81 | 82 | // ======================================================================= 83 | 84 | ShowModal; 85 | 86 | // ======================================================================= 87 | 88 | if ModalResult = mrOK then begin 89 | Result.Process := True; 90 | 91 | Result.Name := eName.Text; 92 | Result.CopyFrom := cbCopyFrom.Checked; 93 | Result.CopyLayer := cbSourceLayer.ItemIndex; 94 | end; 95 | 96 | finally 97 | Free; 98 | end 99 | end; 100 | 101 | 102 | procedure TfrmAddLayer.FormCreate(Sender: TObject); 103 | begin 104 | SetGUILanguageText; 105 | end; 106 | 107 | 108 | procedure TfrmAddLayer.SetGUILanguageText; 109 | begin 110 | Caption := GLanguageHandler.Text[kAddNewLayer]; 111 | Label1.Caption := GLanguageHandler.Text[kName]; 112 | cbCopyFrom.Caption := GLanguageHandler.Text[kCopyFrom]; 113 | Label6.Caption := GLanguageHandler.Text[kExtraLayersIncreaseApplicationMemoryUsage]; 114 | 115 | bOK.Caption := GLanguageHandler.Text[kOK]; 116 | bCancel.Caption := GLanguageHandler.Text[kCancel]; 117 | end; 118 | 119 | 120 | procedure TfrmAddLayer.cbCopyFromClick(Sender: TObject); 121 | begin 122 | cbSourceLayer.Enabled := cbCopyFrom.Checked; 123 | end; 124 | 125 | 126 | end. 127 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/forms/formCheckUpdateSplash.dfm: -------------------------------------------------------------------------------- 1 | object frmUpdateSplash: TfrmUpdateSplash 2 | Left = 705 3 | Top = 450 4 | BorderStyle = bsNone 5 | ClientHeight = 75 6 | ClientWidth = 516 7 | Color = clWhite 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'MS Sans Serif' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | Position = poScreenCenter 15 | PixelsPerInch = 96 16 | TextHeight = 13 17 | object Shape1: TShape 18 | Left = 0 19 | Top = 0 20 | Width = 516 21 | Height = 75 22 | Align = alClient 23 | ExplicitWidth = 385 24 | end 25 | object Label1: TLabel 26 | Left = 8 27 | Top = 0 28 | Width = 498 29 | Height = 65 30 | Caption = 'LED Matrix Builder' 31 | Font.Charset = DEFAULT_CHARSET 32 | Font.Color = 15132390 33 | Font.Height = -53 34 | Font.Name = 'Verdana' 35 | Font.Style = [] 36 | ParentFont = False 37 | Transparent = True 38 | end 39 | object Label2: TLabel 40 | Left = 336 41 | Top = 43 42 | Width = 194 43 | Height = 24 44 | Caption = 'looking for updates...' 45 | Font.Charset = DEFAULT_CHARSET 46 | Font.Color = clWindowText 47 | Font.Height = -21 48 | Font.Name = 'Arial' 49 | Font.Style = [] 50 | ParentFont = False 51 | Transparent = True 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/forms/formDeleteMultipl.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | unit formDeleteMultipl; 13 | 14 | interface 15 | 16 | uses 17 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 18 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, Vcl.ExtCtrls, 19 | 20 | languagehandler; 21 | 22 | 23 | type 24 | TfrmDeleteMultiple = class(TForm) 25 | Bevel1: TBevel; 26 | bOK: TBitBtn; 27 | bCancel: TBitBtn; 28 | lWarning: TLabel; 29 | Image1: TImage; 30 | GroupBox1: TGroupBox; 31 | lFrom: TLabel; 32 | lTO: TLabel; 33 | eStartFrame: TEdit; 34 | eEndFrame: TEdit; 35 | procedure eStartFrameChange(Sender: TObject); 36 | procedure FormCreate(Sender: TObject); 37 | private 38 | procedure SetGUILanguageText; 39 | 40 | function ValidateInputs: boolean; 41 | public 42 | end; 43 | 44 | TDeleteMultipleObject = record 45 | Process : boolean; 46 | StartFrame, EndFrame : integer; 47 | end; 48 | 49 | 50 | function DoDeleteMultiple: TDeleteMultipleObject; 51 | 52 | 53 | var 54 | frmDeleteMultiple: TfrmDeleteMultiple; 55 | 56 | 57 | implementation 58 | 59 | 60 | {$R *.dfm} 61 | 62 | 63 | function DoDeleteMultiple: TDeleteMultipleObject; 64 | begin 65 | with TfrmDeleteMultiple.Create(Application) do 66 | try 67 | Result.Process := False; 68 | 69 | ShowModal; 70 | 71 | if ModalResult = mrOK then begin 72 | Result.Process := True; 73 | Result.StartFrame := StrToInt(eStartFrame.Text); 74 | Result.EndFrame := StrToInt(eEndFrame.Text); 75 | end; 76 | 77 | finally 78 | Free; 79 | end; 80 | end; 81 | 82 | 83 | procedure TfrmDeleteMultiple.FormCreate(Sender: TObject); 84 | begin 85 | SetGUILanguageText; 86 | end; 87 | 88 | 89 | procedure TfrmDeleteMultiple.SetGUILanguageText; 90 | begin 91 | Caption := GLanguageHandler.Text[kDeleteMultipleFramesC]; 92 | 93 | lFrom.Caption := GLanguageHandler.Text[kFrom]; 94 | lTo.Caption := GLanguageHandler.Text[kToC]; 95 | lWarning.Caption := GLanguageHandler.Text[kWarningThisActionCannotBeUndone]; 96 | 97 | bOK.Caption := GLanguageHandler.Text[kOK]; 98 | bCancel.Caption := GLanguageHandler.Text[kCancel]; 99 | end; 100 | 101 | 102 | procedure TfrmDeleteMultiple.eStartFrameChange(Sender: TObject); 103 | begin 104 | bOk.Enabled := ValidateInputs; 105 | end; 106 | 107 | 108 | function TfrmDeleteMultiple.ValidateInputs: boolean; 109 | var 110 | sf, ef : integer; 111 | 112 | begin 113 | sf := StrToIntDef(eStartFrame.Text, -1); 114 | ef := StrToIntDef(eEndFrame.Text, -1); 115 | 116 | 117 | Result := (sf <> -1) and (ef <> -1) and (sf <= ef); 118 | end; 119 | 120 | 121 | end. 122 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/forms/formFontViewer.dfm: -------------------------------------------------------------------------------- 1 | object frmFontViewer: TfrmFontViewer 2 | Left = 0 3 | Top = 0 4 | BorderStyle = bsDialog 5 | Caption = 'Font Viewer' 6 | ClientHeight = 289 7 | ClientWidth = 803 8 | Color = clBtnFace 9 | Font.Charset = DEFAULT_CHARSET 10 | Font.Color = clWindowText 11 | Font.Height = -11 12 | Font.Name = 'Tahoma' 13 | Font.Style = [] 14 | FormStyle = fsStayOnTop 15 | OldCreateOrder = False 16 | Position = poOwnerFormCenter 17 | OnClose = FormClose 18 | OnCreate = FormCreate 19 | OnShow = FormShow 20 | PixelsPerInch = 96 21 | TextHeight = 13 22 | object Panel1: TPanel 23 | Left = 0 24 | Top = 0 25 | Width = 145 26 | Height = 237 27 | Align = alLeft 28 | Color = clWhite 29 | ParentBackground = False 30 | TabOrder = 0 31 | object bSelectFont: TLabel 32 | Left = 8 33 | Top = 15 34 | Width = 4 35 | Height = 13 36 | Caption = '.' 37 | end 38 | object cbFonts: TComboBox 39 | Left = 8 40 | Top = 32 41 | Width = 121 42 | Height = 21 43 | Style = csDropDownList 44 | TabOrder = 0 45 | OnChange = cbFontsChange 46 | end 47 | object cbRGBMode: TCheckBox 48 | Left = 14 49 | Top = 72 50 | Width = 113 51 | Height = 17 52 | Caption = '.' 53 | TabOrder = 1 54 | OnClick = cbRGBModeClick 55 | end 56 | end 57 | object Panel2: TPanel 58 | Left = 0 59 | Top = 237 60 | Width = 803 61 | Height = 52 62 | Align = alBottom 63 | Color = clWhite 64 | ParentBackground = False 65 | TabOrder = 1 66 | object lCharacterValue: TLabel 67 | Left = 8 68 | Top = 9 69 | Width = 4 70 | Height = 13 71 | Caption = '.' 72 | end 73 | object Label3: TLabel 74 | Left = 14 75 | Top = 25 76 | Width = 36 77 | Height = 13 78 | Caption = '(ASCII)' 79 | end 80 | object lCharacter: TLabel 81 | Left = 393 82 | Top = 9 83 | Width = 15 84 | Height = 19 85 | Caption = '...' 86 | Font.Charset = DEFAULT_CHARSET 87 | Font.Color = clWindowText 88 | Font.Height = -16 89 | Font.Name = 'Tahoma' 90 | Font.Style = [] 91 | ParentFont = False 92 | end 93 | object tbFont: TTrackBar 94 | Left = 62 95 | Top = 6 96 | Width = 325 97 | Height = 35 98 | Max = 127 99 | Min = 32 100 | Position = 32 101 | PositionToolTip = ptTop 102 | TabOrder = 0 103 | TickStyle = tsNone 104 | OnChange = tbFontChange 105 | end 106 | end 107 | end 108 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/forms/formPlaybackSpeed.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | unit formPlaybackSpeed; 13 | 14 | interface 15 | 16 | uses 17 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 18 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, Vcl.ExtCtrls, 19 | 20 | languagehandler; 21 | 22 | type 23 | TfrmCustomPlayback = class(TForm) 24 | GroupBox1: TGroupBox; 25 | bOK: TBitBtn; 26 | bCancel: TBitBtn; 27 | eSpeed: TEdit; 28 | Label1: TLabel; 29 | Image1: TImage; 30 | Bevel1: TBevel; 31 | lEquality: TLabel; 32 | procedure bOKClick(Sender: TObject); 33 | procedure FormCreate(Sender: TObject); 34 | private 35 | procedure SetGUILanguageText; 36 | public 37 | end; 38 | 39 | 40 | var 41 | frmCustomPlayback: TfrmCustomPlayback; 42 | 43 | 44 | function DoCustomPlaybackSpeed(aOldCustom : integer): integer; 45 | 46 | 47 | implementation 48 | 49 | 50 | {$R *.dfm} 51 | 52 | 53 | function DoCustomPlaybackSpeed(aOldCustom : integer): integer; 54 | begin 55 | with TfrmCustomPlayback.Create(Application) do 56 | try 57 | eSpeed.Text := IntToStr(aOldCustom); 58 | 59 | ShowModal; 60 | 61 | if ModalResult = mrOK then 62 | Result := StrToIntDef(eSpeed.Text, 0) 63 | else 64 | Result := 0; 65 | finally 66 | Free; 67 | end; 68 | end; 69 | 70 | 71 | procedure TfrmCustomPlayback.FormCreate(Sender: TObject); 72 | begin 73 | SetGUILanguageText; 74 | end; 75 | 76 | 77 | procedure TfrmCustomPlayback.SetGUILanguageText; 78 | begin 79 | Caption := GLanguageHandler.Text[kCustomPlaybackSpeed]; 80 | lEquality.Caption := GLanguageHandler.Text[k1000ms1Second]; 81 | 82 | bOK.Caption := GLanguageHandler.Text[kOK]; 83 | bCancel.Caption := GLanguageHandler.Text[kCancel]; 84 | end; 85 | 86 | 87 | procedure TfrmCustomPlayback.bOKClick(Sender: TObject); 88 | var 89 | lSpeed : integer; 90 | 91 | begin 92 | lSpeed := StrToIntDef(eSpeed.Text, 0); 93 | 94 | if (lSpeed > 0) then 95 | ModalResult := mrOK; 96 | end; 97 | 98 | 99 | end. 100 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/forms/formPreviewPopout.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | 13 | unit formPreviewPopout; 14 | 15 | 16 | interface 17 | 18 | 19 | uses 20 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 21 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.ComCtrls, 22 | Vcl.StdCtrls, Vcl.Buttons, 23 | 24 | languagehandler; 25 | 26 | 27 | type 28 | TCommand = procedure(aValue : integer) of object; 29 | 30 | TfrmPreviewPopout = class(TForm) 31 | Panel1: TPanel; 32 | pAnimationToolbar: TPanel; 33 | lFrame: TLabel; 34 | Bevel5: TBevel; 35 | Bevel7: TBevel; 36 | bPlayAnimation: TBitBtn; 37 | bStopAnimation: TBitBtn; 38 | bPreviousFrame: TBitBtn; 39 | bNextFrame: TBitBtn; 40 | tbFrames: TTrackBar; 41 | bStartFrame: TBitBtn; 42 | bEndFrame: TBitBtn; 43 | procedure bPlayAnimationClick(Sender: TObject); 44 | procedure tbFramesChange(Sender: TObject); 45 | procedure FormCreate(Sender: TObject); 46 | private 47 | FOnCommand : TCommand; 48 | FOnNewFrame : TCommand; 49 | 50 | procedure SetGUILanguageText; 51 | 52 | public 53 | property OnCommand : TCommand read FOnCommand write FOnCommand; 54 | property OnNewFrame : TCommand read FOnNewFrame write FOnNewFrame; 55 | end; 56 | 57 | 58 | var 59 | frmPreviewPopout: TfrmPreviewPopout; 60 | 61 | 62 | implementation 63 | 64 | 65 | {$R *.dfm} 66 | 67 | 68 | procedure TfrmPreviewPopout.FormCreate(Sender: TObject); 69 | begin 70 | SetGUILanguageText; 71 | end; 72 | 73 | 74 | procedure TfrmPreviewPopout.SetGUILanguageText; 75 | begin 76 | Caption := GLanguageHandler.Text[kPreview]; 77 | end; 78 | 79 | 80 | procedure TfrmPreviewPopout.bPlayAnimationClick(Sender: TObject); 81 | begin 82 | if Assigned(FOnCommand) then 83 | FOnCommand(TBitBtn(Sender).Tag); 84 | end; 85 | 86 | 87 | procedure TfrmPreviewPopout.tbFramesChange(Sender: TObject); 88 | begin 89 | if Assigned(FOnNewFrame) then 90 | FOnNewFrame(tbFrames.Position); 91 | end; 92 | 93 | 94 | end. 95 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/forms/formSaveRange.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | 13 | unit formSaveRange; 14 | 15 | 16 | interface 17 | 18 | 19 | uses 20 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 21 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, Vcl.ExtCtrls, 22 | 23 | languagehandler; 24 | 25 | 26 | type 27 | TfrmSaveRange = class(TForm) 28 | Bevel1: TBevel; 29 | bOK: TBitBtn; 30 | bCancel: TBitBtn; 31 | Image1: TImage; 32 | GroupBox1: TGroupBox; 33 | lStart: TLabel; 34 | lEnd: TLabel; 35 | eStartFrame: TEdit; 36 | eEndFrame: TEdit; 37 | procedure eStartFrameChange(Sender: TObject); 38 | procedure FormCreate(Sender: TObject); 39 | private 40 | FFrameCount : integer; 41 | 42 | procedure SetGUILanguageText; 43 | 44 | function ValidateInputs: boolean; 45 | end; 46 | 47 | 48 | TSaveFrameRangeObject = record 49 | Process : boolean; 50 | StartFrame, EndFrame : integer; 51 | end; 52 | 53 | 54 | var 55 | frmSaveRange: TfrmSaveRange; 56 | 57 | 58 | function DoSaveFrameRange(aFrameCount : integer): TSaveFrameRangeObject; 59 | 60 | 61 | implementation 62 | 63 | 64 | {$R *.dfm} 65 | 66 | 67 | function DoSaveFrameRange(aFrameCount : integer): TSaveFrameRangeObject; 68 | begin 69 | with TfrmSaveRange.Create(Application) do 70 | try 71 | FFrameCount := aFrameCount; 72 | 73 | Result.Process := False; 74 | 75 | ShowModal; 76 | 77 | if ModalResult = mrOK then begin 78 | Result.Process := True; 79 | Result.StartFrame := StrToInt(eStartFrame.Text); 80 | Result.EndFrame := StrToInt(eEndFrame.Text); 81 | end; 82 | 83 | finally 84 | Free; 85 | end; 86 | end; 87 | 88 | 89 | procedure TfrmSaveRange.FormCreate(Sender: TObject); 90 | begin 91 | SetGUILanguageText; 92 | end; 93 | 94 | 95 | procedure TfrmSaveRange.SetGUILanguageText; 96 | begin 97 | Caption := GLanguageHandler.Text[kSaveARangeOfFrames]; 98 | 99 | lStart.Caption := GLanguageHandler.Text[kStart]; 100 | lEnd.Caption := GLanguageHandler.Text[kEnd]; 101 | 102 | bOK.Caption := GLanguageHandler.Text[kOK]; 103 | bCancel.Caption := GLanguageHandler.Text[kCancel]; 104 | end; 105 | 106 | 107 | procedure TfrmSaveRange.eStartFrameChange(Sender: TObject); 108 | begin 109 | bOk.Enabled := ValidateInputs; 110 | end; 111 | 112 | 113 | function TfrmSaveRange.ValidateInputs: boolean; 114 | var 115 | sf, ef : integer; 116 | 117 | begin 118 | sf := StrToIntDef(eStartFrame.Text, -1); 119 | ef := StrToIntDef(eEndFrame.Text, -1); 120 | 121 | Result := (sf <> -1) and (ef <> -1) and (sf <= ef); 122 | end; 123 | 124 | 125 | end. 126 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/forms/formToggleLockStatus.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | 13 | unit formToggleLockStatus; 14 | 15 | 16 | interface 17 | 18 | 19 | uses 20 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 21 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, Vcl.ExtCtrls, 22 | 23 | languagehandler; 24 | 25 | 26 | type 27 | TfrmToggleLockStatus = class(TForm) 28 | Bevel1: TBevel; 29 | bOK: TBitBtn; 30 | bCancel: TBitBtn; 31 | Image1: TImage; 32 | GroupBox1: TGroupBox; 33 | Label1: TLabel; 34 | Label2: TLabel; 35 | eStartFrame: TEdit; 36 | eEndFrame: TEdit; 37 | cbLockStatus: TCheckBox; 38 | procedure eStartFrameChange(Sender: TObject); 39 | procedure FormCreate(Sender: TObject); 40 | private 41 | FFrameCount : integer; 42 | 43 | procedure SetGUILanguageText; 44 | 45 | function ValidateInputs: boolean; 46 | end; 47 | 48 | 49 | TToggleLockFrameRangeObject = record 50 | Process : boolean; 51 | LockStatus : boolean; 52 | StartFrame, EndFrame : integer; 53 | end; 54 | 55 | 56 | var 57 | frmToggleLockStatus: TfrmToggleLockStatus; 58 | 59 | 60 | function DoToggleLockFrameRange(aFrameCount : integer): TToggleLockFrameRangeObject; 61 | 62 | 63 | implementation 64 | 65 | 66 | {$R *.dfm} 67 | 68 | 69 | function DoToggleLockFrameRange(aFrameCount : integer): TToggleLockFrameRangeObject; 70 | begin 71 | with TfrmToggleLockStatus.Create(Application) do 72 | try 73 | FFrameCount := aFrameCount; 74 | 75 | Result.Process := False; 76 | 77 | ShowModal; 78 | 79 | if ModalResult = mrOK then begin 80 | Result.Process := True; 81 | Result.LockStatus := cbLockStatus.Checked; 82 | Result.StartFrame := StrToInt(eStartFrame.Text); 83 | Result.EndFrame := StrToInt(eEndFrame.Text); 84 | end; 85 | 86 | finally 87 | Free; 88 | end; 89 | end; 90 | 91 | 92 | procedure TfrmToggleLockStatus.FormCreate(Sender: TObject); 93 | begin 94 | SetGUILanguageText; 95 | end; 96 | 97 | 98 | procedure TfrmToggleLockStatus.SetGUILanguageText; 99 | begin 100 | Caption := GLanguageHandler.Text[kToggleFrameLockStatus]; 101 | Label1.Caption := GLanguageHandler.Text[kStart]; 102 | Label2.Caption := GLanguageHandler.Text[kEnd]; 103 | cbLockStatus.Caption := GLanguageHandler.Text[kLock]; 104 | 105 | bOK.Caption := GLanguageHandler.Text[kOK]; 106 | bCancel.Caption := GLanguageHandler.Text[kCancel]; 107 | end; 108 | 109 | 110 | procedure TfrmToggleLockStatus.eStartFrameChange(Sender: TObject); 111 | begin 112 | bOk.Enabled := ValidateInputs; 113 | end; 114 | 115 | 116 | function TfrmToggleLockStatus.ValidateInputs: boolean; 117 | var 118 | sf, ef : integer; 119 | 120 | begin 121 | sf := StrToIntDef(eStartFrame.Text, -1); 122 | ef := StrToIntDef(eEndFrame.Text, -1); 123 | 124 | Result := (sf <> -1) and (ef <> -1) and (sf <= ef); 125 | end; 126 | 127 | 128 | end. 129 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/forms/main.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaximumOctopus/LEDMatrixStudio/058b1db5ffedfc29454a7f7819999dda52982cbb/SourceDelphiLegacy/code/forms/main.pas -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/frames/frameFontPanel.dfm: -------------------------------------------------------------------------------- 1 | object frameFont: TframeFont 2 | Left = 0 3 | Top = 0 4 | Width = 99 5 | Height = 391 6 | TabOrder = 0 7 | object sbChangeFont: TSpeedButton 8 | Left = 1 9 | Top = 2 10 | Width = 98 11 | Height = 22 12 | Caption = 'Courier New' 13 | end 14 | object lFont: TLabel 15 | Left = 0 16 | Top = 0 17 | Width = 99 18 | Height = 391 19 | Align = alClient 20 | Alignment = taCenter 21 | Caption = 'A' 22 | Font.Charset = DEFAULT_CHARSET 23 | Font.Color = clWindowText 24 | Font.Height = -120 25 | Font.Name = 'Courier New' 26 | Font.Style = [] 27 | ParentFont = False 28 | Layout = tlCenter 29 | OnClick = lFontClick 30 | ExplicitWidth = 72 31 | ExplicitHeight = 129 32 | end 33 | object fdMain: TFontDialog 34 | Font.Charset = DEFAULT_CHARSET 35 | Font.Color = clWindowText 36 | Font.Height = -11 37 | Font.Name = 'Tahoma' 38 | Font.Style = [] 39 | Left = 71 40 | Top = 48 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/frames/frameFontPanel.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | unit frameFontPanel; 13 | 14 | 15 | interface 16 | 17 | 18 | uses 19 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, 20 | Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons; 21 | 22 | 23 | type 24 | TframeFont = class(TFrame) 25 | sbChangeFont: TSpeedButton; 26 | lFont: TLabel; 27 | fdMain: TFontDialog; 28 | procedure lFontClick(Sender: TObject); 29 | private 30 | FFontAscii : integer; 31 | public 32 | procedure SetFont(aNewAscii : integer); 33 | end; 34 | 35 | 36 | implementation 37 | 38 | 39 | {$R *.dfm} 40 | 41 | 42 | procedure TframeFont.lFontClick(Sender: TObject); 43 | begin 44 | if fdMain.Execute then begin 45 | lFont.Font := fdMain.Font; 46 | 47 | sbChangeFont.Caption := fdMain.Font.Name; 48 | end; 49 | end; 50 | 51 | 52 | procedure TframeFont.SetFont(aNewAscii : integer); 53 | begin 54 | FFontAscii := aNewAscii; 55 | 56 | lFont.Caption := Char(aNewAscii); 57 | end; 58 | 59 | 60 | end. 61 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/frames/frameUndoPanel.dfm: -------------------------------------------------------------------------------- 1 | object frameUndos: TframeUndos 2 | Left = 0 3 | Top = 0 4 | Width = 161 5 | Height = 532 6 | TabOrder = 0 7 | object lbUndos: TListBox 8 | Left = 0 9 | Top = 0 10 | Width = 161 11 | Height = 532 12 | Align = alClient 13 | ItemHeight = 13 14 | TabOrder = 0 15 | OnClick = lbUndosClick 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/frames/frameUndoPanel.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | unit frameUndoPanel; 13 | 14 | 15 | interface 16 | 17 | 18 | uses 19 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, 20 | Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; 21 | 22 | 23 | type 24 | TUndoSelected = procedure(aUndo : integer) of object; 25 | 26 | TframeUndos = class(TFrame) 27 | lbUndos: TListBox; 28 | procedure lbUndosClick(Sender: TObject); 29 | private 30 | FUndoSelected : TUndoSelected; 31 | public 32 | procedure SetUndos(aCount : integer); 33 | 34 | property OnUndoSelected : TUndoSelected read FUndoSelected write FUndoSelected; 35 | end; 36 | 37 | 38 | implementation 39 | 40 | 41 | {$R *.dfm} 42 | 43 | 44 | procedure TframeUndos.lbUndosClick(Sender: TObject); 45 | begin 46 | if Assigned(FUndoSelected) then 47 | FUndoSelected(lbUndos.ItemIndex); 48 | end; 49 | 50 | 51 | procedure TframeUndos.SetUndos(aCount : integer); 52 | var 53 | t : integer; 54 | 55 | begin 56 | lbUndos.Clear; 57 | 58 | for t := 1 to aCount do 59 | lbUndos.Items.Add('Undo ' + IntToStr(t)); 60 | end; 61 | 62 | 63 | end. 64 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/readme.txt: -------------------------------------------------------------------------------- 1 | LED Matrix Studio has been developed with Delphi Community Edition 10.3. 2 | The source code can be found at the link at the top of this document. 3 | 4 | If you wish to compile the product, or make your own changes, then download 5 | Delphi from here: 6 | 7 | https://www.embarcadero.com/products/delphi/starter -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/units/appsettings.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | 13 | unit appsettings; 14 | 15 | 16 | interface 17 | 18 | 19 | uses exportoptions, matrixconstants; 20 | 21 | 22 | type 23 | TAppSettings = record 24 | DataFilename : string; 25 | ASCIIIndex : integer; 26 | PadMode : TPadFormat; 27 | PadModeHexCol : integer; 28 | PadModeHexRow : integer; 29 | PadModeDecCol : integer; 30 | PadModeDecRow : integer; 31 | HexPrefix : string; 32 | BinaryPrefix : string; 33 | OpenBracket : string; 34 | CloseBracket : string; 35 | LastExport : TExportOptions; 36 | 37 | LastSaveLocation : string; 38 | LastLoadLocation : string; 39 | LastAutomationFileName : string; 40 | 41 | CustomSpeed : integer; 42 | 43 | BackgroundColour : integer; 44 | 45 | ExportUpdateMaxPixels : integer; 46 | ExportPreviewSize : integer; 47 | 48 | Language : string; 49 | end; 50 | 51 | 52 | implementation 53 | 54 | 55 | end. 56 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/units/datadisplay.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | 13 | unit datadisplay; 14 | 15 | 16 | interface 17 | 18 | 19 | uses matrixconstants; 20 | 21 | 22 | type 23 | TDataDisplay = record 24 | HexFormat : THexFormat; 25 | HexPrefix : THexPrefix; 26 | BinaryPrefix : TBinaryPrefix; 27 | PadFormat : TPadFormat; 28 | Brackets : TBracketStyle; 29 | end; 30 | 31 | 32 | implementation 33 | 34 | 35 | end. 36 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/units/importdata.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | unit importdata; 13 | 14 | 15 | interface 16 | 17 | 18 | uses colours, matrixconstants; 19 | 20 | 21 | type 22 | TImportDataPreview = record 23 | Enabled : boolean; 24 | 25 | Size : integer; 26 | View : TViewShape; 27 | Void : integer; 28 | 29 | IncrementRadially : boolean; 30 | 31 | Popout : boolean; 32 | 33 | Offset : integer; 34 | OffsetDirection : boolean; 35 | end; 36 | 37 | 38 | TImportData = record 39 | ImportOk : boolean; 40 | ErrorString : string; 41 | 42 | Source : integer; 43 | SourceLSB : integer; 44 | SourceDirection : integer; 45 | PadMode : TPadFormat; 46 | HexFormat : THexFormat; 47 | HexOutput : THexPrefix; 48 | Brackets : TBracketStyle; 49 | MatrixMode : TMatrixMode; 50 | NewWidth : integer; 51 | NewHeight : integer; 52 | NewFrames : integer; 53 | MaxFrames : integer; 54 | ASCIIIndex : integer; 55 | FontMode : boolean; 56 | 57 | RGBImport : boolean; 58 | BackgroundColour : integer; 59 | 60 | RGBBrightness : integer; 61 | 62 | StartFrame : integer; 63 | EndFrame : integer; 64 | 65 | Preview : TImportDataPreview; 66 | 67 | AutomationFileName : string; 68 | 69 | Colours : TColours; 70 | end; 71 | 72 | 73 | implementation 74 | 75 | 76 | end. 77 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/units/languageconstants.pas: -------------------------------------------------------------------------------- 1 | 2 | unit languageconstants; 3 | 4 | 5 | interface 6 | 7 | 8 | implementation 9 | 10 | 11 | end. 12 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/units/previewsettings.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | unit previewsettings; 13 | 14 | 15 | interface 16 | 17 | 18 | uses matrixconstants; 19 | 20 | 21 | type 22 | TPreviewOptions = record 23 | Enabled : boolean; 24 | Size : integer; 25 | View : TViewShape; 26 | Void : integer; 27 | Offset : integer; 28 | Direction : boolean; 29 | Popout : boolean; 30 | end; 31 | 32 | 33 | implementation 34 | 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/units/projectsettings.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | unit projectsettings; 13 | 14 | 15 | interface 16 | 17 | 18 | uses matrixconstants; 19 | 20 | 21 | type 22 | TProjectSettings = record 23 | Valid : boolean; 24 | 25 | MatrixMode : TMatrixMode; 26 | Width : integer; 27 | Height : integer; 28 | Clear : boolean; 29 | Special : integer; 30 | SizeType : boolean; 31 | Pixel : TPixelShape; 32 | CustomShape : TCustomShape; 33 | CustomShapeParam : integer; 34 | 35 | Background : integer; 36 | end; 37 | 38 | 39 | implementation 40 | 41 | 42 | end. 43 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/units/toolbars.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | unit toolbars; 13 | 14 | 15 | interface 16 | 17 | 18 | type 19 | TToolbars = record 20 | ColumnRow : boolean; 21 | RGBPalette : boolean; 22 | Pattern : boolean; 23 | Animation : boolean; 24 | end; 25 | 26 | 27 | implementation 28 | 29 | 30 | end. 31 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/code/units/xglobal.pas: -------------------------------------------------------------------------------- 1 | // =================================================================== 2 | // 3 | // (c) Paul Alan Freshney 2012-2023 4 | // www.freshney.org :: paul@freshney.org :: maximumoctopus.com 5 | // 6 | // https://github.com/MaximumOctopus/LEDMatrixStudio 7 | // 8 | // Please do not modifiy this comment section 9 | // 10 | // =================================================================== 11 | 12 | unit xglobal; 13 | 14 | 15 | interface 16 | 17 | 18 | const 19 | lsbLeft = 0; 20 | lsbRight = 1; 21 | 22 | scanColTopToBottom = 0; 23 | scanColBottomToTop = 1; 24 | scanColAltDownUp = 2; 25 | scanColAltUpDown = 3; 26 | 27 | scanRowLeftToRight = 0; 28 | scanRowRightToLeft = 1; 29 | scanRowAltLeftRight = 2; 30 | scanRowAltRightLeft = 3; 31 | 32 | 33 | powers : array[0..63] of int64 = (1,2,4,8,16,32,64,128, 34 | 256,512,1024,2048,4096,8192,16384,32768, 35 | 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 36 | 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 37 | 4294967296, 8589934592, 17179869184, 34359738368, 68719476736, 137438953472, 274877906944, 549755813888, 38 | 1099511627776, 2199023255552, 4398046511104, 8796093022208, 17592186044416, 35184372088832, 70368744177664, 140737488355328, 39 | 281474976710656, 562949953421312, 1125899906842624, 2251799813685248, 4503599627370496, 9007199254740992, 18014398509481984, 36028797018963968, 40 | 72057594037927936, 144115188075855872, 288230376151711744, 576460752303423488, 1152921504606846976, 2305843009213693952, 4611686018427387904, 9223372036854775808); 41 | 42 | powers16 : array[0..15] of int64 = (1, 16, 256, 4096, 65536, 1048576, 16777216, 268435456, 43 | 4294967296, 68719476736, 1099511627776, 17592186044416, 44 | 281474976710656, 4503599627370496, 72057594037927936, 1152921504606846976); 45 | 46 | // black, grey, green, purple, red, white, dark grey, 47 | backgroundColours : array[0..6] of integer = ($000000, $AAAAAA, $006600, $770077, $002288, $ffffff, $333333); 48 | 49 | previewSizes : array[0..14] of integer = (1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 25, 30, 40, 50); 50 | 51 | previewVoids : array[0..6] of integer = (10, 15, 20, 25, 30, 40, 50); 52 | 53 | // =========================================================================== 54 | 55 | 56 | implementation 57 | 58 | 59 | end. 60 | -------------------------------------------------------------------------------- /SourceDelphiLegacy/led.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaximumOctopus/LEDMatrixStudio/058b1db5ffedfc29454a7f7819999dda52982cbb/SourceDelphiLegacy/led.ico --------------------------------------------------------------------------------