summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleo2005-12-30 21:47:52 +0000
committerleo2005-12-30 21:47:52 +0000
commit43be715ad595e58f3381439c88defb209aa06f89 (patch)
tree3e0f11561819966ec6fbe9028f9f21e50b55649a
parent49055c86feda30d3d7e4f6d5c8738c2aef5b68d9 (diff)
Show piece numbers and a few small fixes.
git-svn-id: http://svn.leocad.org/trunk@450 c7d43263-9d01-0410-8a33-9dba5d9f93d6
-rwxr-xr-xcommon/library.h4
-rw-r--r--common/project.cpp36
-rw-r--r--common/project.h3
-rwxr-xr-xcommon/system.h1
-rw-r--r--common/typedefs.h1
-rw-r--r--linux/system.cpp5
-rw-r--r--tools/convert/moved.txt580
-rw-r--r--win/LeoCAD.rc2
-rw-r--r--win/Libdlg.cpp65
-rw-r--r--win/Libdlg.h2
10 files changed, 441 insertions, 258 deletions
diff --git a/common/library.h b/common/library.h
index 41ccbdd..7e638ef 100755
--- a/common/library.h
+++ b/common/library.h
@@ -79,6 +79,9 @@ public:
bool ImportTexture(const char* Name);
bool ImportLDrawPiece(const char* Filename);
+ // Set when pieces are added/removed from the library.
+ bool m_Modified;
+
protected:
char m_LibraryPath[LC_MAXPATH]; // path to the library files
@@ -92,7 +95,6 @@ protected:
// Categories.
ObjArray<PiecesLibraryCategory> m_Categories;
- bool m_Modified;
bool m_CategoriesModified;
char m_CategoriesFile[LC_MAXPATH];
diff --git a/common/project.cpp b/common/project.cpp
index 5fc0e86..e0b6df2 100644
--- a/common/project.cpp
+++ b/common/project.cpp
@@ -546,8 +546,6 @@ void Project::LoadDefaults(bool cameras)
SetAction(0);
m_nCurColor = 0;
SystemUpdateColorList(m_nCurColor);
- m_nCurGroup = 1;
- SystemSetGroup(m_nCurGroup);
m_bAnimation = false;
m_bAddKeys = false;
SystemUpdateAnimation(m_bAnimation, m_bAddKeys);
@@ -718,7 +716,7 @@ bool Project::FileLoad(File* file, bool bUndo, bool bMerge)
file->ReadLong (&m_nSnap, 1);
file->ReadFloat (&m_fLineWidth, 1);
file->ReadLong (&m_nDetail, 1);
- file->ReadLong (&i, 1); m_nCurGroup = i;
+ file->ReadLong (&i, 1); //m_nCurGroup = i;
file->ReadLong (&i, 1); m_nCurColor = i;
file->ReadLong (&i, 1); action = i;
file->ReadLong (&i, 1); m_nCurStep = i;
@@ -1075,7 +1073,6 @@ bool Project::FileLoad(File* file, bool bUndo, bool bMerge)
SetAction(action);
SystemUpdateViewport(m_nViewportMode, 0);
SystemUpdateColorList(m_nCurColor);
- SystemSetGroup(m_nCurGroup);
SystemUpdateAnimation(m_bAnimation, m_bAddKeys);
SystemUpdateRenderingMode((m_nDetail & LC_DET_BACKGROUND) != 0, (m_nDetail & LC_DET_FAST) != 0);
SystemUpdateSnap(m_nSnap);
@@ -1111,7 +1108,8 @@ void Project::FileSave(File* file, bool bUndo)
file->WriteLong (&m_nSnap, 1);
file->WriteFloat (&m_fLineWidth, 1);
file->WriteLong (&m_nDetail, 1);
- i = m_nCurGroup; file->WriteLong (&i, 1);
+ //i = m_nCurGroup;
+ file->WriteLong (&i, 1);
i = m_nCurColor; file->WriteLong (&i, 1);
i = m_nCurAction; file->WriteLong (&i, 1);
i = m_nCurStep; file->WriteLong (&i, 1);
@@ -3685,11 +3683,6 @@ void Project::HandleNotify(LC_NOTIFY id, unsigned long param)
m_nCurColor = (unsigned char)param;
} break;
- case LC_GROUP_CHANGED:
- {
- m_nCurGroup = (unsigned char)param;
- } break;
-
case LC_CAPTURE_LOST:
{
if (m_nTracking != LC_TRACK_NONE)
@@ -4728,26 +4721,13 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
FileMem file;
FileSave(&file, true);
- // TODO: save piece IDs and reload.
-
if (SystemDoDialog(LC_DLG_LIBRARY, NULL))
{
-/*
- for (i = 0; i < pDoc->m_PartsIdx.GetSize(); i++)
- pDoc->m_PartsIdx[i].DeleteInformation();
-
- pDoc->LoadPieceLibrary();
- pDoc->m_bUndo = TRUE;
- PartFile.SeekToBegin();
- CArchive ar(&PartFile, CArchive::load);
- pDoc->Serialize(ar);
- ar.Close();
- pDoc->m_bUndo = FALSE;
- pDoc->RebuildDisplayLists(FALSE);
- pDoc->UpdateAllViews(NULL);
- m_wndPiecesBar.m_wndPiecesList.UpdateList();
- }
-*/
+ if (m_pLibrary->m_Modified)
+ {
+ DeleteContents(true);
+ FileLoad(&file, true, false);
+ }
}
} break;
diff --git a/common/project.h b/common/project.h
index 4a9c236..00c2091 100644
--- a/common/project.h
+++ b/common/project.h
@@ -78,8 +78,6 @@ public:
{ m_pCurPiece = pInfo; }
int GetCurrentColor () const
{ return m_nCurColor; }
- int GetCurrentGroup () const
- { return m_nCurGroup; }
float* GetBackgroundColor()
{ return m_fBackground; }
unsigned char GetAction() const
@@ -260,7 +258,6 @@ protected:
PieceInfo* m_pCurPiece;
unsigned char m_nCurColor;
unsigned char m_nCurAction;
- unsigned char m_nCurGroup;
bool m_bAnimation;
bool m_bAddKeys;
unsigned char m_nFPS;
diff --git a/common/system.h b/common/system.h
index b61237c..6a3adcc 100755
--- a/common/system.h
+++ b/common/system.h
@@ -107,7 +107,6 @@ bool SystemDoDialog(int nMode, void* param);
void SystemDoPopupMenu(int nMenu, int x, int y);
void SystemDoWaitCursor(int nCode);
-void SystemSetGroup(int nNew);
void SystemSetWindowCaption(char* caption);
//void SystemRedrawView();
void SystemPieceComboAdd(char* name);
diff --git a/common/typedefs.h b/common/typedefs.h
index 0d147c6..9346fe8 100644
--- a/common/typedefs.h
+++ b/common/typedefs.h
@@ -14,7 +14,6 @@ class PieceInfo;
typedef enum
{
LC_COLOR_CHANGED,
- LC_GROUP_CHANGED,
LC_CAPTURE_LOST,
LC_ACTIVATE,
LC_PIECE_MODIFIED,
diff --git a/linux/system.cpp b/linux/system.cpp
index 704519b..09e5b28 100644
--- a/linux/system.cpp
+++ b/linux/system.cpp
@@ -314,11 +314,6 @@ void SystemUpdateAction(int new_action, int old_action)
ignore_commands = false;
}
-void SystemSetGroup(int new_group)
-{
- groupsbar_set(new_group);
-}
-
void SystemUpdateColorList(int new_color)
{
colorlist_set(new_color);
diff --git a/tools/convert/moved.txt b/tools/convert/moved.txt
index 4107e4c..d43133a 100644
--- a/tools/convert/moved.txt
+++ b/tools/convert/moved.txt
@@ -1,215 +1,365 @@
-4 3193
-5 3192
-6 3464
-9 3460
-11 3579
-12 7930
-13 7026
-16 3596
-18 3626A
-19 3624
-22 3581
-25 3582
-26 3497
-28 3062B
-34 7049
-40 3046
-47 3659
-48 3049
-56 3660
-57 3045
-62 3145
-64 3359
-65 3358
-89 9244
-93 3479
-94 3865
-95 2748
-96 3831
-97 3830
-98 3685
-99 3684
-100 3665
-101 3623
-102 3644
-103 73037
-114 3848
-116 3847
-117 3846
-117P47 3846P47
-118 3849
-121 3787
-122 122C01
-123 3641
-132 3483
-134 3794
-138 3855
-140 3821
-141 3822
-142 3741
-143 3742
-144 3854
-145 3856
-146 2529
-148 3957
-149 3962
-150 3899
-157 4070
-158 3189
-159 3188
-161 4085
-163 3315
-174 4081
-175 4178
-176 4023
-177 73092
-178 4175
-179 4073
-180 4161
-195 4170
-196 4171
-197 73090
-198 4176
-199 3675
-205 32073
-206 73071
-211 6100
-212 4229
-216 3612
-217 4228
-231 4349
-234 4286
-236 73312
-238 3048
-239 4528
-240 4287
-241 4529
-246 73435
-247 73436
-247B 73435
-248 3676
-252 4599
-256 3058
-257 4476
-258 4169
-259 4168
-262 3811
-262P01 3811P01
-274 4590
-275 4460
-278 4490
-249 4495
-291 4868
-292 4869
-293 3867
-294 4447
-295 4448
-296 4740
-297 4593
-299 4589
-302 4872
-305 2335
-306 2343
-307 4735
-321 2412
-324 2458
-338 2433
-339 4474
-340 2583
-352 4095
-368 2569
-369 3187
-370 3186
-371 2920
-372 2337
-373 6019
-376 4733
-380 6016
-381 6048
-386 6020
-387 6060
-388 6070
-391 6558
-395 3587
-396 4595
-401 2516
-404 6541
-407 71076
-408 71075
-415 6217
-418 6037
-426 6043
-427 6046
-428 75535
-432 6126
-461 3688
-497 7039
-513 3144
-583 30031
-588 71137
-602 32000
-605 6152
-708 3062A
-720 3218
-808 2348A
-810 6238
-829 3433
-860 6120
-960 2620
-961 4284
-965 4089
-2348 2348B
-2358P01 80547
-2418 2418B
-2455 3755
-2561 2566
-2562 2536
-2748 3857
-2837A 2838C01
-2872 2921
-3062 3062B
-3137A 3137
-3137B 20
-3149A 313
-3149B 314
-3149C 3149
-3324A 3324
-3465 3480
-3463 3481
-3626 3626B
-3626-4T 3626B-4T
-3626P01 3626BP01
-3626P02 3626BP02
-3709 3709B
-3944 3961
-3945 3839
-3946 3963
-3949 3838
-3950 3959
-3951 3939
-3951P68 3939P68
-4203 4201
-4601 4624
-6237 601
-73590 73590B
-9326 973
-9326-4T 973S01
-9326P01 973P01
-9326P02 973P02
-9326P11 973P11
-9326P14 973P14
-9326P15 973P15
-9326P16 973P16
-9326P17 973P17
-9326P18 973P18
-9326P47 973P47
-9326P51 973P51
-9326P52 973P52
-9326P60 973P60
-9326P61 973P61
-9326P63 973P63
-9326P68 973P68
-9326T01 973P01
-9326T02 973P02
-4265 4265B
-571 6629
+4 3193
+5 3192
+6 3464
+9 3460
+11 3579
+12 7930
+13 7026
+16 3596
+18 3626A
+19 3624
+22 3581
+25 3582
+26 3497
+28 3062B
+34 7049
+40 3046
+47 3659
+48 3049
+56 3660
+57 3045
+62 3145
+64 3359
+65 3358
+89 9244
+93 3479
+94 3865
+95 2748
+96 3831
+97 3830
+98 3685
+99 3684
+100 3665
+101 3623
+102 3644
+103 73037
+114 3848
+116 3847
+117 3846
+117P47 3846P47
+118 3849
+121 3787
+122 122C01
+123 3641
+132 3483
+134 3794
+138 3855
+140 3821
+141 3822
+142 3741
+143 3742
+144 3854
+145 3856
+146 2529
+148 3957
+149 3962
+150 3899
+157 4070
+158 3189
+159 3188
+163 3315
+175 4178
+176 4023
+177 73092
+178 4175
+179 4073
+180 4161
+195 4170
+196 4171
+197 73090
+198 4176
+199 3675
+205 32073
+206 73071
+211 6100
+212 4229
+216 3612
+217 4228
+231 4349
+234 4286
+236 73312
+238 3048
+239 4528
+240 4287
+241 4529
+246 73435
+247 73436
+247B 73435
+248 3676
+252 4599
+256 3058
+257 4476
+258 4169
+259 4168
+262 3811
+262P01 3811P01
+274 4590
+275 4460
+278 4490
+249 4495
+291 4868
+292 4869
+293 3867
+294 4447
+295 4448
+296 4740
+297 4593
+299 4589
+302 4872
+305 2335
+306 2343
+307 4735
+321 2412
+324 2458
+338 2433
+339 4474
+340 2583
+352 4095
+368 2569
+369 3187
+370 3186
+371 2920
+372 2337
+373 6019
+376 4733
+380 6016
+381 6048
+386 6020
+387 6060
+388 6070
+391 6558
+395 3587
+396 4595
+401 2516
+404 6541
+407 71076
+408 71075
+415 6217
+418 6037
+426 6043
+427 6046
+428 75535
+432 6126
+461 3688
+497 7039
+513 3144
+583 30031
+588 71137
+602 32000
+605 6152
+708 3062A
+720 3218
+808 2348A
+810 6238
+829 3433
+860 6120
+960 2620
+961 4284
+965 4089
+2348 2348B
+2358P01 80547
+2418 2418B
+2455 3755
+2561 2566
+2562 2536
+2748 3857
+2837A 2838C01
+2872 2921
+3062 3062B
+3137A 3137
+3137B 20
+3149A 313
+3149B 314
+3149C 3149
+3324A 3324
+3465 3480
+3463 3481
+3626 3626B
+3626-4T 3626B-4T
+3626P01 3626BP01
+3626P02 3626BP02
+3709 3709B
+3944 3961
+3945 3839B
+3946 3963
+3949 3838
+3950 3959
+3951 3939
+3951P68 3939P68
+4203 4201
+4601 4624
+6237 601
+73590 73590B
+9326 973
+9326-4T 973S01
+9326P01 973P01
+9326P02 973P02
+9326P11 973P11
+9326P14 973P14
+9326P15 973P15
+9326P16 973P16
+9326P17 973P17
+9326P18 973P18
+9326P47 973P47
+9326P51 973P51
+9326P52 973P52
+9326P60 973P60
+9326P61 973P61
+9326P63 973P63
+9326P68 973P68
+9326T01 973P01
+9326T02 973P02
+4265 4265B
+571 6629
+973P101 973PS1
+3839 3839B
+4081 4081B
+151 32316
+3002PEYE 3003PE1
+4085 4085C
+3068P101 3068PS1
+3228 3228A
+2412 2412A
+2431P52 2431BP52
+2431P79 2431BP79
+3069P05 3069BP05
+3069P06 3069BP06
+3069P07 3069BP07
+3069P09 3069BP09
+3069P101 3069PS1
+3069P21 3069BP21
+3069P68 3069BP68
+3070DISP 3070BPC2
+3070P06 3070BP06
+6069P101 6069PS1
+788 4323
+3068P07 3068BP07
+3068P08 3068BP08
+3068P18 3068BP18
+3068P80 3068BP80
+3069P25 3069BP25
+3039P101 3039PS1
+124 3876
+133 3217
+3068P22 3068BP22
+3068P23 3068BP23
+3068P50 3068BP50
+3068P52 3068BP52
+3068P66 3068BP66
+3068P67 3068BP67
+3068P81 3068BP81
+3068P87 3068BP87
+3068PS1 3068BPS1
+3069P13 3069BP13
+4215 4215B
+4215P01 4215AP01
+4215P02 4215AP02
+4215P03 4215AP03
+4215P24 4215AP24
+4215P66 4215AP66
+4215P05 4215AP05
+4215P06 4215AP06
+4215P07 4215AP07
+4215P77 4215AP25
+4215P04 4215AP04
+2431B 2431
+2431BP52 2431P52
+2431BP79 2431P79
+174 4081B
+3069P01 3069BP01
+3070 3070A
+3846P43 3846P45
+973P15 973P1D
+161 4085C
+3068 3068A
+3069 3069A
+3962 3962B
+578 30374
+6538 6538A
+973P11 973P1A
+30389 30389A
+3942 3942B
+4285 4285B
+193 193A
+3005-1 3005PT1
+3005-1B 3005PV1
+3005-2 3005PT2
+3005-3 3005PT3
+3005-4 3005PT4
+3005-6B 3005PV6
+3005-7 3005PT7
+3005-E 3005PTE
+3005-F 3005PTF
+3005-H 3005PTH
+3005-I 3005PTI
+3005-J 3005PTJ
+3005-L 3005PTL
+3005-M 3005PTM
+3005-N 3005PTN
+3005-O 3005PTO
+3005-Q 3005PTQ
+3005-R 3005PTR
+3005-T 3005PTT
+3005-U 3005PTU
+3005-V 3005PTV
+3005-W 3005PTW
+3005-Y 3005PTY
+3005-Z 3005PTZ
+3068BP50 3068BP05
+3068P10 3068BP10
+3068P17 3068AP17
+3068P51 3068BP51
+3068P57 3068BP57
+3068P68 3068BP68
+3068PLC 3068BP16
+3068WARN 3068BP06
+4150P07 4150C07
+4345 4345B
+4688 4866
+2362 2362B
+2362P53 2362AP53
+2362P54 2362AP54
+3005-0 3005PT0
+3005-5 3005PT5
+3005-A 3005PTA
+3005-AE 3005PUA
+3005-B 3005PTB
+3005-C 3005PTC
+3005-D 3005PTD
+3005-G 3005PTG
+3005-K 3005PTK
+3005-P 3005PTP
+3005-S 3005PTS
+3005-X 3005PTX
+4864 4864B
+4864P33 4864BP10
+4864P34 4864BP11
+4864P66 4864AP02
+4864P89 4864AP03
+3040 3040B
+3475 3475B
+550 3245B
+2476 2476A
+298 4592
+298C01 4592C01
+300 44294
+30359 30359A
+4738 4738A
+480 30554
+4864P35 4864AP01
+530 41334
+552 32209
+554 42446
+6238 6238A
+770 2586
+770P4B 2586P4B
+770P4C 2586P4C
+770P4D 2586P4D
+770PH1 2586PH1
+770PS1 2586PS1
+770PW1 2586PW1
+6141 4073
+44237 2456
+30499 3684
+30039 3070B
+30002 2343 \ No newline at end of file
diff --git a/win/LeoCAD.rc b/win/LeoCAD.rc
index 736cbb6..89f65c8 100644
--- a/win/LeoCAD.rc
+++ b/win/LeoCAD.rc
@@ -1289,7 +1289,7 @@ BEGIN
PUSHBUTTON "Cancel",IDCANCEL,87,164,27,10,NOT WS_VISIBLE
CONTROL "Tree1",IDC_LIBDLG_TREE,"SysTreeView32",TVS_HASLINES |
TVS_EDITLABELS | WS_BORDER | WS_TABSTOP,7,7,89,186
- CONTROL "List1",IDC_LIBDLG_LIST,"SysListView32",LVS_LIST |
+ CONTROL "List1",IDC_LIBDLG_LIST,"SysListView32",LVS_REPORT |
LVS_SORTASCENDING | LVS_AUTOARRANGE | WS_BORDER |
WS_TABSTOP,102,7,191,186
END
diff --git a/win/Libdlg.cpp b/win/Libdlg.cpp
index 75d1223..122bdef 100644
--- a/win/Libdlg.cpp
+++ b/win/Libdlg.cpp
@@ -21,13 +21,30 @@
static char THIS_FILE[] = __FILE__;
#endif
+// Function to sort the list control.
+static int CALLBACK ListCompare(LPARAM lP1, LPARAM lP2, LPARAM lParamSort)
+{
+ int ret;
+
+ if ((lP1 < 0) || (lP2 < 0))
+ return 0;
+
+ if ((lParamSort & ~0xF0) == 0)
+ ret = strcmpi(((PieceInfo*)lP1)->m_strDescription, ((PieceInfo*)lP2)->m_strDescription);
+ else
+ ret = strcmpi(((PieceInfo*)lP1)->m_strName, ((PieceInfo*)lP2)->m_strName);
+
+ return ret;
+}
+
/////////////////////////////////////////////////////////////////////////////
// CLibraryDlg dialog
-
CLibraryDlg::CLibraryDlg(CWnd* pParent /*=NULL*/)
: CDialog(CLibraryDlg::IDD, pParent)
{
+ m_SortColumn = 0;
+
//{{AFX_DATA_INIT(CLibraryDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
@@ -50,6 +67,7 @@ void CLibraryDlg::DoDataExchange(CDataExchange* pDX)
BEGIN_MESSAGE_MAP(CLibraryDlg, CDialog)
//{{AFX_MSG_MAP(CLibraryDlg)
ON_NOTIFY(TVN_SELCHANGED, IDC_LIBDLG_TREE, OnSelChangedTree)
+ ON_NOTIFY(LVN_COLUMNCLICK, IDC_LIBDLG_LIST, OnListColumnClick)
//}}AFX_MSG_MAP
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipText)
@@ -107,6 +125,11 @@ BOOL CLibraryDlg::OnInitDialog()
m_TreeImages.Create(IDB_PARTICONS, 16, 0, RGB (0,128,128));
m_Tree.SetImageList(&m_TreeImages, TVSIL_NORMAL);
+ RECT rect;
+ m_List.GetWindowRect(&rect);
+ m_List.InsertColumn(0, "Name", LVCFMT_LEFT, rect.right - rect.left - GetSystemMetrics(SM_CXVSCROLL) - 4 - 60, 0);
+ m_List.InsertColumn(1, "Number", LVCFMT_LEFT, 60, 1);
+
UpdateList();
UpdateTree();
@@ -346,10 +369,31 @@ void CLibraryDlg::UpdateList()
lvi.iSubItem = 0;
lvi.lParam = (LPARAM)Info;
lvi.pszText = Info->m_strDescription;
- m_List.InsertItem(&lvi);
+ int idx = m_List.InsertItem(&lvi);
+
+ m_List.SetItemText(idx, 1, Info->m_strName);
}
}
+ else
+ {
+ for (int i = 0; i < Lib->GetPieceCount(); i++)
+ {
+ PieceInfo* Info = Lib->GetPieceInfo(i);
+ LVITEM lvi;
+ lvi.mask = LVIF_TEXT | LVIF_PARAM;
+ lvi.iItem = 0;
+ lvi.iSubItem = 0;
+ lvi.lParam = (LPARAM)Info;
+ lvi.pszText = Info->m_strDescription;
+ int idx = m_List.InsertItem(&lvi);
+
+ m_List.SetItemText(idx, 1, Info->m_strName);
+ }
+
+ }
+
+ m_List.SortItems((PFNLVCOMPARE)ListCompare, m_SortColumn);
m_List.SetRedraw(TRUE);
}
@@ -358,10 +402,13 @@ void CLibraryDlg::UpdateTree()
m_Tree.SetRedraw(FALSE);
m_Tree.DeleteAllItems();
+ HTREEITEM Root = m_Tree.InsertItem(TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_TEXT, "Pieces", 0, 1, 0, 0, 0, TVI_ROOT, TVI_SORT);
+
PiecesLibrary *Lib = project->GetPiecesLibrary();
for (int i = 0; i < Lib->GetNumCategories(); i++)
- m_Tree.InsertItem(TVIF_IMAGE|TVIF_CHILDREN|TVIF_PARAM|TVIF_TEXT, Lib->GetCategoryName(i), 0, 1, 0, 0, 0, TVI_ROOT, TVI_SORT);
+ m_Tree.InsertItem(TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM|TVIF_TEXT, Lib->GetCategoryName(i), 0, 1, 0, 0, 0, Root, TVI_SORT);
+ m_Tree.Expand(Root, TVE_EXPAND);
m_Tree.SetRedraw(TRUE);
m_Tree.Invalidate();
}
@@ -451,3 +498,15 @@ BOOL CLibraryDlg::OnToolTipText(UINT, NMHDR* pNMHDR, LRESULT* pResult)
return TRUE; // message was handled
}
+
+void CLibraryDlg::OnListColumnClick(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
+
+ // Save the column index.
+ m_SortColumn = pNMListView->iSubItem;
+
+ m_List.SortItems((PFNLVCOMPARE)ListCompare, m_SortColumn);
+
+ *pResult = 0;
+}
diff --git a/win/Libdlg.h b/win/Libdlg.h
index 2aefa5d..c41772c 100644
--- a/win/Libdlg.h
+++ b/win/Libdlg.h
@@ -35,6 +35,7 @@ public:
CToolBar m_wndToolBar;
CImageList m_TreeImages;
+ int m_SortColumn;
protected:
// Generated message map functions
@@ -43,6 +44,7 @@ protected:
afx_msg void OnSelChangedTree(NMHDR* pNMHDR, LRESULT* pResult);
virtual void OnCancel();
virtual void OnOK();
+ afx_msg void OnListColumnClick(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
afx_msg BOOL OnToolTipText(UINT, NMHDR* pNMHDR, LRESULT* pResult);