From be646eb146fdfd2fa1027ce913c91e387d1122e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wies=C5=82aw=20=C5=A0olt=C3=A9s?= Date: Sun, 19 Feb 2017 17:38:11 +0100 Subject: [PATCH] Added insert before and after functions --- src/configuration/FormatsList.h | 12 ++++++++++++ src/configuration/ItemsList.h | 12 ++++++++++++ src/configuration/LanguagesList.h | 12 ++++++++++++ src/configuration/PresetsList.h | 12 ++++++++++++ 4 files changed, 48 insertions(+) diff --git a/src/configuration/FormatsList.h b/src/configuration/FormatsList.h index c43f08f0..0058c8a2 100644 --- a/src/configuration/FormatsList.h +++ b/src/configuration/FormatsList.h @@ -63,6 +63,18 @@ public: { m_Formats.AddTail(format); } + void InsertBefore(CFormat &format, int nIndex) + { + POSITION pos = m_Formats.FindIndex(nIndex); + if (pos != NULL) + m_Formats.InsertBefore(pos, format); + } + void InsertAfter(CFormat &format, int nIndex) + { + POSITION pos = m_Formats.FindIndex(nIndex); + if (pos != NULL) + m_Formats.InsertAfter(pos, format); + } public: void RemoveNode(int pstn = -1) { diff --git a/src/configuration/ItemsList.h b/src/configuration/ItemsList.h index 3f075ebd..83f2466f 100644 --- a/src/configuration/ItemsList.h +++ b/src/configuration/ItemsList.h @@ -62,6 +62,18 @@ public: { m_Items.AddTail(item); } + void InsertBefore(CItem& item, int nIndex) + { + POSITION pos = m_Items.FindIndex(nIndex); + if (pos != NULL) + m_Items.InsertBefore(pos, item); + } + void InsertAfter(CItem& item, int nIndex) + { + POSITION pos = m_Items.FindIndex(nIndex); + if (pos != NULL) + m_Items.InsertAfter(pos, item); + } public: void RemoveNode(int pstn = -1) { diff --git a/src/configuration/LanguagesList.h b/src/configuration/LanguagesList.h index f2208b8e..672645e6 100644 --- a/src/configuration/LanguagesList.h +++ b/src/configuration/LanguagesList.h @@ -63,6 +63,18 @@ public: { m_Languages.AddTail(language); } + void InsertBefore(CLanguage &language, int nIndex) + { + POSITION pos = m_Languages.FindIndex(nIndex); + if (pos != NULL) + m_Languages.InsertBefore(pos, language); + } + void InsertAfter(CLanguage &language, int nIndex) + { + POSITION pos = m_Languages.FindIndex(nIndex); + if (pos != NULL) + m_Languages.InsertAfter(pos, language); + } public: void RemoveNode(int pstn = -1) { diff --git a/src/configuration/PresetsList.h b/src/configuration/PresetsList.h index 6d193d91..ec57908f 100644 --- a/src/configuration/PresetsList.h +++ b/src/configuration/PresetsList.h @@ -63,6 +63,18 @@ public: { m_Presets.AddTail(preset); } + void InsertBefore(CPreset &preset, int nIndex) + { + POSITION pos = m_Presets.FindIndex(nIndex); + if (pos != NULL) + m_Presets.InsertBefore(pos, preset); + } + void InsertAfter(CPreset &preset, int nIndex) + { + POSITION pos = m_Presets.FindIndex(nIndex); + if (pos != NULL) + m_Presets.InsertAfter(pos, preset); + } void InsertNode(CString szName) { CPreset preset;