29 #include "../../idlib/precompiled.h"
32 #include "../../sys/win32/win_local.h"
33 #include "../../sys/win32/rc/common_resource.h"
85 INITCOMMONCONTROLSEX ex;
86 ex.dwICC = ICC_USEREX_CLASSES | ICC_LISTVIEW_CLASSES;
87 ex.dwSize =
sizeof(INITCOMMONCONTROLSEX);
89 InitCommonControlsEx ( &ex );
108 SendMessage (
mWndLookin, CB_RESETCONTENT, 0, 0 );
111 ZeroMemory ( &item,
sizeof(item) );
112 item.mask = CBEIF_TEXT | CBEIF_INDENT | CBEIF_IMAGE | CBEIF_SELECTEDIMAGE;
115 item.pszText = (LPSTR)
"base";
124 int slash = path.
Find (
"/" );
129 file = path.
Left ( slash );
139 item.pszText = (LPSTR)file.
c_str();
141 item.iItem = item.iIndent;
146 SendMessage (
mWndLookin, CB_SETCURSEL, item.iIndent, 0 );
159 const char *basepath =
mLookin;
165 ListView_DeleteAllItems ( list );
171 if ( files->
GetFile( i )[0] ==
'.' )
177 item.mask = LVIF_TEXT;
178 item.iItem = ListView_GetItemCount ( list );
179 item.pszText = (LPSTR)files->
GetFile( i );
181 ListView_InsertItem ( list, &item );
187 for ( filter = 0; filter <
mFilters.
Num(); filter ++ )
192 if ( files->
GetFile( i )[0] ==
'.' )
198 item.mask = LVIF_TEXT|LVIF_IMAGE;
200 item.iItem = ListView_GetItemCount( list );
201 item.pszText = (LPSTR)files->
GetFile( i );
203 ListView_InsertItem ( list, &item );
223 int sel = ListView_GetNextItem (
mWndFileList, -1, LVNI_SELECTED );
237 item.mask = LVIF_IMAGE|LVIF_TEXT;
241 item.cchTextMax = 256;
247 if ( item.iImage == 0 )
259 else if ( item.iImage == 2 )
275 MessageBox (
mWnd,
va(
"%s\nFile not found.\nPlease verify the correct file name was given",
mFilename.
c_str() ),
"Open", MB_ICONERROR|MB_OK );
281 EndDialog (
mWnd, 1 );
353 sel = SendMessage (
mWndLookin, CB_GETCURSEL, 0, 0 );
361 for ( i = 2; i <= sel; i ++ )
389 while ( filters.
Length ( ) )
391 int semi = filters.
Find (
';' );
394 filter = filters.
Left ( semi );
395 filters = filters.
Right ( filters.
Length ( ) - semi );
422 SetWindowLong ( wnd, GWL_USERDATA, lparam );
429 NMHDR* nm = (NMHDR*) lparam;
430 switch ( nm->idFrom )
435 case LVN_ITEMCHANGED:
437 NMLISTVIEW* nmlv = (NMLISTVIEW*)nm;
438 if ( nmlv->uNewState & LVIS_SELECTED )
443 item.mask = LVIF_IMAGE|LVIF_TEXT;
446 item.cchTextMax =
sizeof(temp)-1;
447 item.iItem = nmlv->iItem;
450 if ( item.iImage == 2 )
468 switch ( LOWORD ( wparam ) )
477 EndDialog ( wnd, 0 );
482 int sel = SendMessage ( GetDlgItem ( wnd,
IDC_TOOLS_LOOKIN ), CB_GETCURSEL, 0, 0 );
494 if ( HIWORD ( wparam ) == CBN_SELCHANGE )
virtual idFile * OpenFileRead(const char *relativePath, bool allowCopyFiles=true, const char *gamedir=NULL)=0
static int snPrintf(char *dest, int size, const char *fmt,...) id_attribute((format(printf
virtual idFileList * ListFiles(const char *relativePath, const char *extension, bool sort=false, bool fullRelativePath=false, const char *gamedir=NULL)=0
void HandleInitDialog(void)
CONST PIXELFORMATDESCRIPTOR UINT
static char mLookin[MAX_OSPATH]
int GetNumFiles(void) const
idFileSystem * fileSystem
void HandleCommandOK(void)
const char * Left(int len, idStr &result) const
#define IDC_TOOLS_FILELIST
void ExtractFileName(idStr &dest) const
const char * GetFile(int index) const
static void Copynz(char *dest, const char *src, int destsize)
const char * Right(int len, idStr &result) const
int Find(const char c, int start=0, int end=-1) const
virtual void FreeFileList(idFileList *fileList)=0
int Append(const type &obj)
void HandleLookInChange(void)
void Append(const char a)
static INT_PTR CALLBACK DlgProc(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam)
const char * c_str(void) const
#define IDC_TOOLS_FILENAME
void UpdateFileList(void)
char * va(const char *fmt,...)
void ExtractFileExtension(idStr &dest) const
virtual void CloseFile(idFile *f)=0
bool DoModal(HWND parent)
idStr & StripFilename(void)
void SetFilter(const char *filter)