diff --git a/HACKING.md b/HACKING.md index e58adc4d9a..34a1708df3 100644 --- a/HACKING.md +++ b/HACKING.md @@ -102,6 +102,7 @@ to obtain file group * `DN_DROPDOWNOPENED` - Param2 = 1 - open, 0 - closed. Note that all true-color capable messages extend but don't replace 'base' 16 palette colors. This is done intentionally as far2l may run in terminal that doesn't support true color palette, and in such case 24bit colors will be ignored and base palette attributes will be used instead. +Size of colors array is `DLG_ITEM_MAX_CUST_COLORS` which is currently 5. ### Added new flags: * Flags to **manage markers** in **panel** from plugins API diff --git a/NetRocks/src/UI/Activities/ComplexOperationProgress.cpp b/NetRocks/src/UI/Activities/ComplexOperationProgress.cpp index 38c3a3fc8c..b44bb505b4 100644 --- a/NetRocks/src/UI/Activities/ComplexOperationProgress.cpp +++ b/NetRocks/src/UI/Activities/ComplexOperationProgress.cpp @@ -147,7 +147,7 @@ void ComplexOperationProgress::OnIdle() bool path, file, all, count, errors; } changed = {}; bool paused; - uint64_t Colors[4]; + uint64_t Colors[DLG_ITEM_MAX_CUST_COLORS]; { std::lock_guard locker(_state.mtx); if (_last_path != _state.path) { @@ -339,4 +339,3 @@ RemoveProgress::RemoveProgress(const std::string &site_dir, ProgressState &state : ComplexOperationProgress(site_dir, state, wea_state, MRemoveTitle, false, false) { } - diff --git a/NetRocks/src/UI/Activities/SimpleOperationProgress.cpp b/NetRocks/src/UI/Activities/SimpleOperationProgress.cpp index 3f301d4055..8a4673af75 100644 --- a/NetRocks/src/UI/Activities/SimpleOperationProgress.cpp +++ b/NetRocks/src/UI/Activities/SimpleOperationProgress.cpp @@ -53,7 +53,7 @@ void SimpleOperationProgress::Show() LONG_PTR SimpleOperationProgress::DlgProc(int msg, int param1, LONG_PTR param2) { - uint64_t Colors[4]; + uint64_t Colors[DLG_ITEM_MAX_CUST_COLORS]; //fprintf(stderr, "%x %x\n", msg, param1); if (msg == DN_ENTERIDLE) { diff --git a/far2l/far2sdk/farplug-mb.h b/far2l/far2sdk/farplug-mb.h index 7ad1f7fed2..de880b7bf6 100644 --- a/far2l/far2sdk/farplug-mb.h +++ b/far2l/far2sdk/farplug-mb.h @@ -14,6 +14,7 @@ namespace oldfar #endif #endif const int NM = MAX_PATH; + const size_t DLG_ITEM_MAX_CUST_COLORS = 5; enum FARMESSAGEFLAGS { diff --git a/far2l/far2sdk/farplug-wide.h b/far2l/far2sdk/farplug-wide.h index a1196b83a6..ac362b863e 100644 --- a/far2l/far2sdk/farplug-wide.h +++ b/far2l/far2sdk/farplug-wide.h @@ -151,6 +151,9 @@ typedef struct _CHAR_INFO CHAR_INFO; typedef uint32_t FARMESSAGEFLAGS; typedef GUID UUID; +FAR_INLINE_CONSTANT size_t + DLG_ITEM_MAX_CUST_COLORS = 5; + FAR_INLINE_CONSTANT FARMESSAGEFLAGS FMSG_WARNING = 0x00000001, FMSG_ERRORTYPE = 0x00000002, @@ -355,11 +358,11 @@ enum FarMessagesProc // DM_GETCOLOR, // DM_SETCOLOR, - DM_GETDEFAULTCOLOR, // Param1 - Item ID, Param2 - uint64_t * -> uint64_t ItemColors[4] + DM_GETDEFAULTCOLOR, // Param1 - Item ID, Param2 - uint64_t * -> uint64_t ItemColors[DLG_ITEM_MAX_CUST_COLORS] - DM_GETTRUECOLOR, // Param1 - Item ID, Param2 - uint64_t * -> uint64_t ItemColors[4] + DM_GETTRUECOLOR, // Param1 - Item ID, Param2 - uint64_t * -> uint64_t ItemColors[DLG_ITEM_MAX_CUST_COLORS] DM_GETCOLOR = DM_GETTRUECOLOR, - DM_SETTRUECOLOR, // Param1 - Item ID, Param2 - uint64_t * -> uint64_t ItemColors[4] + DM_SETTRUECOLOR, // Param1 - Item ID, Param2 - uint64_t * -> uint64_t ItemColors[DLG_ITEM_MAX_CUST_COLORS] DM_SETCOLOR = DM_SETTRUECOLOR, DM_SETTEXTPTRSILENT, diff --git a/far2l/src/dialog.cpp b/far2l/src/dialog.cpp index 297fe3f07c..7ba40d1ef3 100644 --- a/far2l/src/dialog.cpp +++ b/far2l/src/dialog.cpp @@ -6361,7 +6361,7 @@ LONG_PTR SendDlgMessageSynched(HANDLE hDlg, int Msg, int Param1, LONG_PTR Param2 ///case DM_GETCOLOR:/// case DM_GETTRUECOLOR: { if (Param2) - memcpy((uint64_t *)Param2, CurItem->customItemColor, sizeof(uint64_t) * 4); + memcpy((uint64_t *)Param2, CurItem->customItemColor, sizeof(uint64_t) * DLG_ITEM_MAX_CUST_COLORS); // if (!CurItem->TrueColors) { // memset((uint64_t *)Param2, 0, sizeof(DialogItemTrueColors)); // } else { @@ -6375,7 +6375,7 @@ LONG_PTR SendDlgMessageSynched(HANDLE hDlg, int Msg, int Param1, LONG_PTR Param2 ///case DM_SETCOLOR:/// case DM_SETTRUECOLOR: { if (Param2) - memcpy(CurItem->customItemColor, (uint64_t *)Param2, sizeof(uint64_t) * 4); + memcpy(CurItem->customItemColor, (uint64_t *)Param2, sizeof(uint64_t) * DLG_ITEM_MAX_CUST_COLORS); // if (!CurItem->TrueColors) { // CurItem->TrueColors.reset(new DialogItemTrueColors); diff --git a/far2l/src/dialog.hpp b/far2l/src/dialog.hpp index b4e2b843af..49df2d3a3e 100644 --- a/far2l/src/dialog.hpp +++ b/far2l/src/dialog.hpp @@ -47,8 +47,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "CriticalSections.hpp" class History; - -constexpr size_t DLG_ITEM_MAX_CUST_COLORS = 5; // Флаги текущего режима диалога enum DIALOG_MODES {