Skip to content

Commit 50a18be

Browse files
committed
Change FILE list based on CATEGORY choice
1 parent 537e21e commit 50a18be

File tree

5 files changed

+78
-15
lines changed

5 files changed

+78
-15
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include "CollectionInterfaceClass.h"
2+
3+
CollectionInterface::CollectionInterface(void) {
4+
vwsUDLFiles.push_back(L"udl1.xml");
5+
vwsUDLFiles.push_back(L"udl2.xml");
6+
vwsUDLFiles.push_back(L"udl3.xml");
7+
vwsACFiles.push_back(L"ac1.xml");
8+
vwsACFiles.push_back(L"ac2.xml");
9+
vwsFLFiles.push_back(L"fl1.xml");
10+
vwsFLFiles.push_back(L"fl2.xml");
11+
vwsThemeFiles.push_back(L"themeA");
12+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#pragma once
2+
#include <string>
3+
#include <vector>
4+
5+
class CollectionInterface {
6+
public:
7+
// Grabs the UDL List and Themes list from the collections, and populates the vector<wstring> lists
8+
CollectionInterface(void);
9+
10+
// lists of files
11+
std::vector<std::wstring> vwsUDLFiles;
12+
std::vector<std::wstring> vwsACFiles;
13+
std::vector<std::wstring> vwsFLFiles;
14+
std::vector<std::wstring> vwsThemeFiles;
15+
};

src/Dialogs/CollectionInterfaceDialog.cpp

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
#include "resource.h"
2323
#include "Version.h"
2424
#include "CollectionInterfaceDialog.h"
25+
#include "CollectionInterfaceClass.h"
26+
#include <string>
27+
#include <vector>
28+
29+
CollectionInterface* pobjCI;
30+
void _populate_file_cbx(HWND hwndDlg, std::vector<std::wstring>& vwsList);
2531

2632
#pragma warning(push)
2733
#pragma warning(disable: 4100)
@@ -56,6 +62,8 @@ INT_PTR CALLBACK ciDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
5662
::SendDlgItemMessage(hwndDlg, IDC_CI_COMBO_CATEGORY, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Theme"));
5763
const int index2Begin = 0; // start with UDL selected
5864
::SendDlgItemMessage(hwndDlg, IDC_CI_COMBO_CATEGORY, CB_SETCURSEL, index2Begin, 0);
65+
66+
pobjCI = new CollectionInterface;
5967
}
6068

6169
return true;
@@ -68,18 +76,24 @@ INT_PTR CALLBACK ciDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
6876
case IDC_CI_BTN_RESTART:
6977
EndDialog(hwndDlg, 0);
7078
DestroyWindow(hwndDlg);
79+
delete pobjCI;
80+
pobjCI = NULL;
7181
return true;
7282
case IDC_CI_COMBO_CATEGORY:
7383
if(HIWORD(wParam) == CBN_SELCHANGE) {
74-
LRESULT selectedIndex = ::SendMessage(reinterpret_cast<HWND>(lParam), CB_GETCURSEL, 0, 0);
84+
LRESULT selectedIndex = ::SendDlgItemMessage(hwndDlg, IDC_CI_COMBO_CATEGORY, CB_GETCURSEL, 0, 0);
7585
if (selectedIndex != CB_ERR) {
76-
wchar_t buffer[256];
77-
LRESULT needLen = ::SendMessage(reinterpret_cast<HWND>(lParam), CB_GETLBTEXTLEN, selectedIndex, 0);
78-
if (needLen < 256) {
79-
::SendMessage(reinterpret_cast<HWND>(lParam), CB_GETLBTEXT, selectedIndex, reinterpret_cast<LPARAM>(buffer));
80-
buffer[255] = '\0';
81-
::MessageBox(NULL, buffer, L"Which Category:", MB_OK);
82-
}
86+
LRESULT needLen = ::SendDlgItemMessage(hwndDlg, IDC_CI_COMBO_CATEGORY, CB_GETLBTEXTLEN, selectedIndex, 0);
87+
std::wstring wsCategory(needLen,0);
88+
::SendDlgItemMessage(hwndDlg, IDC_CI_COMBO_CATEGORY, CB_GETLBTEXT, selectedIndex, reinterpret_cast<LPARAM>(wsCategory.c_str()));
89+
if (wsCategory == L"UDL")
90+
_populate_file_cbx(hwndDlg, pobjCI->vwsUDLFiles);
91+
else if (wsCategory == L"AutoCompletion")
92+
_populate_file_cbx(hwndDlg, pobjCI->vwsACFiles);
93+
else if (wsCategory == L"FunctionList")
94+
_populate_file_cbx(hwndDlg, pobjCI->vwsFLFiles);
95+
else if (wsCategory == L"Theme")
96+
_populate_file_cbx(hwndDlg, pobjCI->vwsThemeFiles);
8397
}
8498
}
8599
return true;
@@ -107,3 +121,14 @@ INT_PTR CALLBACK ciDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
107121
return false;
108122
}
109123
#pragma warning(pop)
124+
125+
void _populate_file_cbx(HWND hwndDlg, std::vector<std::wstring>& vwsList)
126+
{
127+
::SendDlgItemMessage(hwndDlg, IDC_CI_COMBO_FILE, CB_RESETCONTENT, 0, 0);
128+
::SendDlgItemMessage(hwndDlg, IDC_CI_COMBO_FILE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"<Pick File>"));
129+
for (auto& str : vwsList) {
130+
::SendDlgItemMessage(hwndDlg, IDC_CI_COMBO_FILE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(str.c_str()));
131+
}
132+
::SendDlgItemMessage(hwndDlg, IDC_CI_COMBO_FILE, CB_SETCURSEL, 0, 0);
133+
return;
134+
}

vs.proj/CollectionInterface.vcxproj

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
</ProjectConfiguration>
2828
</ItemGroup>
2929
<ItemGroup>
30+
<ClInclude Include="..\src\Classes\CollectionInterfaceClass.h" />
3031
<ClInclude Include="..\src\Dialogs\AboutDialog.h" />
3132
<ClInclude Include="..\src\Dialogs\CollectionInterfaceDialog.h" />
3233
<ClInclude Include="..\src\Dialogs\resource.h" />
@@ -47,6 +48,7 @@
4748
<ClInclude Include="..\src\Sci_Position.h" />
4849
</ItemGroup>
4950
<ItemGroup>
51+
<ClCompile Include="..\src\Classes\CollectionInterfaceClass.cpp" />
5052
<ClCompile Include="..\src\Dialogs\AboutDialog.cpp" />
5153
<ClCompile Include="..\src\Dialogs\CollectionInterfaceDialog.cpp" />
5254
<ClCompile Include="..\src\DockingFeature\GoToLineDlg.cpp" />
@@ -167,7 +169,7 @@
167169
<WarningLevel>Level4</WarningLevel>
168170
<Optimization>Disabled</Optimization>
169171
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;COLLECTIONINTERFACE_EXPORTS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NON_CONFORMING_SWPRINTFS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
170-
<AdditionalIncludeDirectories>$(ProjectDir)..\src\Dialogs;$(ProjectDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
172+
<AdditionalIncludeDirectories>$(ProjectDir)..\src\Dialogs;$(ProjectDir)..\src\Classes;$(ProjectDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
171173
<TreatWarningAsError>true</TreatWarningAsError>
172174
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
173175
</ClCompile>
@@ -185,7 +187,7 @@
185187
<TreatWarningAsError>true</TreatWarningAsError>
186188
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
187189
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
188-
<AdditionalIncludeDirectories>$(ProjectDir)..\src\Dialogs;$(ProjectDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
190+
<AdditionalIncludeDirectories>$(ProjectDir)..\src\Dialogs;$(ProjectDir)..\src\Classes;$(ProjectDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
189191
</ClCompile>
190192
<Link>
191193
<SubSystem>Windows</SubSystem>
@@ -204,7 +206,7 @@
204206
<TreatWarningAsError>true</TreatWarningAsError>
205207
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
206208
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
207-
<AdditionalIncludeDirectories>$(ProjectDir)..\src\Dialogs;$(ProjectDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
209+
<AdditionalIncludeDirectories>$(ProjectDir)..\src\Dialogs;$(ProjectDir)..\src\Classes;$(ProjectDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
208210
</ClCompile>
209211
<Link>
210212
<SubSystem>Windows</SubSystem>
@@ -219,7 +221,7 @@
219221
<FunctionLevelLinking>true</FunctionLevelLinking>
220222
<IntrinsicFunctions>true</IntrinsicFunctions>
221223
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;COLLECTIONINTERFACE_EXPORTS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NON_CONFORMING_SWPRINTFS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
222-
<AdditionalIncludeDirectories>$(ProjectDir)..\src\Dialogs;$(ProjectDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
224+
<AdditionalIncludeDirectories>$(ProjectDir)..\src\Dialogs;$(ProjectDir)..\src\Classes;$(ProjectDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
223225
<TreatWarningAsError>true</TreatWarningAsError>
224226
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
225227
</ClCompile>
@@ -245,7 +247,7 @@ copy ..\README.md ..\bin\README.md</Command>
245247
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;COLLECTIONINTERFACE_EXPORTS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NON_CONFORMING_SWPRINTFS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
246248
<TreatWarningAsError>true</TreatWarningAsError>
247249
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
248-
<AdditionalIncludeDirectories>$(ProjectDir)..\src\Dialogs;$(ProjectDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
250+
<AdditionalIncludeDirectories>$(ProjectDir)..\src\Dialogs;$(ProjectDir)..\src\Classes;$(ProjectDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
249251
</ClCompile>
250252
<Link>
251253
<SubSystem>Windows</SubSystem>
@@ -269,7 +271,7 @@ copy ..\README.md ..\bin64\README.md</Command>
269271
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;COLLECTIONINTERFACE_EXPORTS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NON_CONFORMING_SWPRINTFS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
270272
<TreatWarningAsError>true</TreatWarningAsError>
271273
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
272-
<AdditionalIncludeDirectories>$(ProjectDir)..\src\Dialogs;$(ProjectDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
274+
<AdditionalIncludeDirectories>$(ProjectDir)..\src\Dialogs;$(ProjectDir)..\src\Classes;$(ProjectDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
273275
</ClCompile>
274276
<Link>
275277
<SubSystem>Windows</SubSystem>
@@ -287,4 +289,4 @@ copy ..\README.md ..\arm64\README.md</Command>
287289
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
288290
<ImportGroup Label="ExtensionTargets">
289291
</ImportGroup>
290-
</Project>
292+
</Project>

vs.proj/CollectionInterface.vcxproj.filters

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
<ClCompile Include="..\src\Dialogs\CollectionInterfaceDialog.cpp">
1313
<Filter>Dialogs</Filter>
1414
</ClCompile>
15+
<ClCompile Include="..\src\Classes\CollectionInterfaceClass.cpp">
16+
<Filter>Classes</Filter>
17+
</ClCompile>
1518
</ItemGroup>
1619
<ItemGroup>
1720
<ClInclude Include="..\src\DockingFeature\Docking.h" />
@@ -40,6 +43,9 @@
4043
<ClInclude Include="..\src\Dialogs\CollectionInterfaceDialog.h">
4144
<Filter>Dialogs</Filter>
4245
</ClInclude>
46+
<ClInclude Include="..\src\Classes\CollectionInterfaceClass.h">
47+
<Filter>Classes</Filter>
48+
</ClInclude>
4349
</ItemGroup>
4450
<ItemGroup>
4551
<ResourceCompile Include="..\src\DockingFeature\goLine.rc" />
@@ -55,5 +61,8 @@
5561
<Filter Include="Dialogs">
5662
<UniqueIdentifier>{7093fbe7-6903-4f76-aba8-518019b09f16}</UniqueIdentifier>
5763
</Filter>
64+
<Filter Include="Classes">
65+
<UniqueIdentifier>{8ebe3960-be3e-4cdd-92b3-097addd051c9}</UniqueIdentifier>
66+
</Filter>
5867
</ItemGroup>
5968
</Project>

0 commit comments

Comments
 (0)