/* ** Copyright (C) 2003 Nullsoft, Inc. ** ** This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held ** liable for any damages arising from the use of this software. ** ** Permission is granted to anyone to use this software for any purpose, including commercial applications, and to ** alter it and redistribute it freely, subject to the following restrictions: ** ** 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. ** If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. ** ** 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. ** ** 3. This notice may not be removed or altered from any source distribution. ** */ #include //#include //#include #include "../winamp/ml.h" #include "resource.h" #include "../winamp/listview.h" #include "../winamp/w_char-char.h" #include #include #include "../winamp/childwnd.h" #include "../winamp/wa_dlg.h" #include "../winamp/itemlist.h" #include "../winamp/ipc_pe.h" #include "../winamp/WINAMPCMD.h" //#include #include "hashclass.cpp" //#include //#include //MEMORY LEAK DETECTING/ONYL FOR DEBUG #ifdef DEBUGIT #define _CRTDBG_MAP_ALLOC #define _CRTDBG_CHECK_ALWAYS_DF #include #include #endif //----------------------------- // configuration section in winamp.ini #define CONFIG_SEC L"ml_ex" // makes a NULL char * an empty string #define MAKESAFE(x) ((x)?(x):"") //imagelist HIMAGELIST himl=ImageList_Create(32, 32, ILC_COLOR32, 5, 5); static ChildWndResizeItem resize_rlist[]={ // 0xLTRB //0000: no resize,no move //0101: move vertically //0011: resize v&h //0010: resize h //0001: resize v //0111: move v, resize h //1010: move h //1011: move h resize v //1111: move v&h {IDC_QUICKSEARCH,0x1010}, {IDC_LIST,0x0011}, {IDC_LIST2,0x0000}, {IDC_BUTTON_CONFIG,0x0101}, {IDC_STATUS,0x0111}, {IDC_STATIC2,0x1010}, {IDC_STATIC9,0x1010}, {IDC_QUICKSEARCH2,0x0010}, {IDC_QUICKSEARCH3,0x0010}, {IDC_BUTTON5,0x1111}, {IDC_BUTTON6,0x1111}, {IDC_BUTTON7,0x1111}, {IDC_BUTTON8,0x1111}, }; static ChildWndResizeItem resize_rlist2[]={ {IDC_QUICKSEARCH,0x0010}, {IDC_COMBO1,0x0001}, {IDC_COMBO2,0x0001}, {IDC_SYSLINK1,0x0101}, {IDC_SYSLINK2,0x1111}, }; static ChildWndResizeItem resize_rlist3[]={ {IDC_STATIC4,0x0101}, {IDC_STATIC5,0x0101}, {IDC_BUTTON1,0x0101}, {IDC_BUTTON2,0x0101}, {IDC_GPB3,0x0101}, {IDC_EDIT1,0x0101}, {IDC_EDIT2,0x0101}, {IDC_EDIT3,0x0101}, {IDC_EDIT4,0x0101}, {IDC_STATIC6,0x0101}, {IDC_STATIC7,0x0101}, {IDC_STATIC8,0x0101}, {IDC_BUTTON3,0x0101}, {IDC_STATIC10,0x0111} }; int g_WAversion ; DWORD WINAPI ThreadProc(LPVOID lpParameter); DWORD WINAPI lt2(LPVOID lpParameter); DWORD WINAPI VILL( LPVOID lpParameter); HWND configHWND=NULL; HWND editorHWND=NULL; HWND mapeditorHWND=NULL; void closedown(HWND hwndDlg); int (*wad_getColor)(int idx); int (*wad_handleDialogMsgs)(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); void (*wad_DrawChildWindowBorders)(HWND hwndDlg, int *tab, int tabsize); void (*cr_init)(HWND hwndDlg, ChildWndResizeItem *list, int num); void (*cr_resize)(HWND hwndDlg, ChildWndResizeItem *list, int num); void (*cr_resizelist)(HWND hwndDlg, ChildWndResizeItem *list, int num, RECT *rectin); //void childresize_resize_from_rectlist(HWND hwndDlg, ChildWndResizeItem *list, int num, RECT *rectin); static void configaddmap(HWND parent,TCHAR* path); static BOOL CALLBACK editor_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam); static BOOL CALLBACK mapeditor_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam); static BOOL CALLBACK optproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam); DWORD WINAPI WFL(LPVOID lpParameter); // yes, we could easily use an itemRecord / itemRecordList here instead of 'Song's, but the point of this example // is to show how to integrate with some other native structure bool sortpl=false; typedef struct SongStat{ int playcount; int rating; int playlength; FILETIME lastplayed; FILETIME firstplayed; }; struct Song{ int songlen; TCHAR *filetitle;//file name or title TCHAR *filepath; TCHAR *sortname;//name for sorting TCHAR *title;//only for positions int size; int bitrate; int type;//0-upper folder,1-folder,2-file,3-song,4-video,5-audiocdtrack,6-playlist,7-found playlist item,8-not found pl item FILETIME created; int iconindex; int def_iconindex; int listpos; TCHAR *album; TCHAR *genre; int number; int year; //------ int from; Song* parent; //------ SongStat* stats; }; struct ffblk { char ff_reserved[21]; /* reserved by DOS */ char ff_attrib; /* attribute found */ int ff_ftime; /* file time */ int ff_fdate; /* file date */ long ff_fsize; /* file size */ char ff_name[13]; /* found file name */ }; #define SKIP_THE_AND_WHITESPACE(x) { /*while (!iswalnum(*x) && *x) x++;*/ if (!wcsnicmp(x,L"the ",4)) x+=4; while (*x == L' ') x++; } extern winampMediaLibraryPlugin plugin; static C_ItemList m_songs[2], *m_songs_sorted[2]; static W_ListView m_list[2]; int multiple=1;//0,1,2 int capturefrom=0; bool showtitle=true; bool showposit=true; bool showplaying=true; TCHAR *playingpath=new TCHAR[MAX_PATH]; int playing; int dca=0;//0:play 1:enq 2:e&p int current[2]; int posicon=0; static HWND m_hwnd; static HMENU m_context_menus; static int m_skinlistview_handle[2]; static void updateList(int win); static void writestatus(int win); void initicons(); void initmenus(); int pclicked=-1; void config(HWND parent); void sortResults(int win); void loadSongList(int win); void getcurrent(); int init(); int droppedto,draggedto; void inittree(bool drivechanged); TCHAR wdev[40]; TCHAR* toadd=NULL; #include #include using namespace std; int prevscroll=0; //SCROLLINFO ScrollInfo; bool donothook=false; //------ DRIVE LIST --- int numofdevices=0; int mainParam;// param of our parent tree item int myParamDrive[32]; // param of our drives tree item int myParamMapped[32]; // param of our mapped tree item int myParam(int i){ if (i==-1) return mainParam; if (i pathsfordrives; struct drivelist{ TCHAR path[20]; TCHAR name[20]; int type; int treeID; int found;//0:not found, 1: found 2: new }dnames[32]; drivelist* isInDriveList(TCHAR* path){ for (int i=0;i=toadd;i--){ dnames[i+1]=dnames[i]; myParamDrive[i+1]=myParamDrive[i]; } dnames[toadd].found=2; dnames[toadd].type=type; wcscpy(dnames[toadd].name,name); wcscpy(dnames[toadd].path,path); numofdevices++; } void delDrive(int ezt){ for (int i=ezt;i pts; Song* addingsong=NULL; int getfrom(TCHAR* title){ int i; int j; TCHAR st[3]; st[0]=0; int db=swscanf_s(title, L"%d:%02d - %1s",&i,&j,&st,2); if (db==3) return i*60+j; return -1; } //---------------- int listcount[2];//current list id int tooo[2];//dragging to int fromb;//dragging from browser number bool isexcluded(TCHAR* name){ TCHAR* nam=_wcsdup(name); nam[1]='\0'; TCHAR* ex=_wcsdup(exclude); TCHAR* test=wcstok(ex, L";, "); while (test!=NULL){ if (wcsicmp(nam,test)==0){ delete[] nam; return true;} test=wcstok(NULL, L";, "); } delete[] nam; return false; } //----- LOAD DRIVES --------- void loaddrivelist(bool clearall){ if (clearall) numofdevices=0; for (int i=0;ifound=1; }else{ TCHAR tmppath[20],tmpname[20]; wcscpy(tmppath,&szTemp[iii]); //TCHAR buff[16]; wcscpy(buff,L""); //TCHAR buff2[4]; GetVolumeInformation(&szTemp[iii],buff,16,0,0,0,NULL,20); if (!shownames){ wcscpy(tmpname,&szTemp[iii]); }else{ if (wcscmp(buff,L"")==0){ wcscpy(tmpname,&szTemp[iii]); wcscat(tmpname,buff); }else { wcscpy(tmpname,buff); wcscat(tmpname,L" ("); wcsncpy(buff2,&szTemp[iii],2); buff2[2]=L')'; buff2[3]=L'\0'; wcscat(tmpname,buff2); } } if (type==5&&wcscmp(buff,L"Audio CD")==0) type=7; addDrive(type,tmppath,tmpname); } } } } iii=iii+4; } } //void loaddrivelist(){ // numofdevices=0; // TCHAR szTemp[512]; // szTemp[0] = L'\0'; // db=GetLogicalDriveStrings(511, szTemp); // iii=0; // SetErrorMode(SEM_FAILCRITICALERRORS); // TCHAR buff[16]; // TCHAR buff2[4]; // while (iii= 0x5011) { //--------- cdd=(char*)SendMessage(plugin.hwndWinampParent,WM_WA_IPC,0,IPC_GETPLUGINDIRECTORY); strcat(cdd,"\\ml_umlp_options.ini"); conf_file=new TCHAR[MAX_PATH]; wcscpy(conf_file,ctow(cdd)); } g_sortdir=GetPrivateProfileInt(CONFIG_SEC,L"sortdir",0,conf_file); g_sortcol=GetPrivateProfileInt(CONFIG_SEC,L"sortcol",0,conf_file); shownames=GetPrivateProfileInt(CONFIG_SEC,L"shownames",1,conf_file); showhd=GetPrivateProfileInt(CONFIG_SEC,L"showhd",1,conf_file); showd=GetPrivateProfileInt(CONFIG_SEC,L"showd",1,conf_file); showrd=GetPrivateProfileInt(CONFIG_SEC,L"showrd",1,conf_file); shownd=GetPrivateProfileInt(CONFIG_SEC,L"shownd",1,conf_file); showod=GetPrivateProfileInt(CONFIG_SEC,L"showod",1,conf_file); showmp=GetPrivateProfileInt(CONFIG_SEC,L"showmp",1,conf_file); showsize=GetPrivateProfileInt(CONFIG_SEC,L"showsize",1,conf_file); showlength=GetPrivateProfileInt(CONFIG_SEC,L"showlength",0,conf_file); showcreated=GetPrivateProfileInt(CONFIG_SEC,L"showcreated",1,conf_file); showlength=GetPrivateProfileInt(CONFIG_SEC,L"showlength",0,conf_file); shownumber=GetPrivateProfileInt(CONFIG_SEC,L"shownumber",0,conf_file); showalbum=GetPrivateProfileInt(CONFIG_SEC,L"showalbum",0,conf_file); showyear=GetPrivateProfileInt(CONFIG_SEC,L"showyear",0,conf_file); showgenre=GetPrivateProfileInt(CONFIG_SEC,L"showgenre",0,conf_file); showfirstp=GetPrivateProfileInt(CONFIG_SEC,L"showfirstp",0,conf_file); showlastp=GetPrivateProfileInt(CONFIG_SEC,L"showlastp",0,conf_file); showpcount=GetPrivateProfileInt(CONFIG_SEC,L"showpcount",0,conf_file); showplength=GetPrivateProfileInt(CONFIG_SEC,L"showplength",0,conf_file); showe=GetPrivateProfileInt(CONFIG_SEC,L"showe",1,conf_file); showposit=GetPrivateProfileInt(CONFIG_SEC,L"showposit",1,conf_file); showplaying=GetPrivateProfileInt(CONFIG_SEC,L"showplaying",1,conf_file); posicon=GetPrivateProfileInt(CONFIG_SEC,L"posicon",0,conf_file); showsongs=GetPrivateProfileInt(CONFIG_SEC,L"showsongs",1,conf_file); showall=GetPrivateProfileInt(CONFIG_SEC,L"showall",0,conf_file); showvids=GetPrivateProfileInt(CONFIG_SEC,L"showvids",0,conf_file); showplaylists=GetPrivateProfileInt(CONFIG_SEC,L"showplaylists",1,conf_file); showtitle=GetPrivateProfileInt(CONFIG_SEC,L"showtitle",0,conf_file); showbitrate=GetPrivateProfileInt(CONFIG_SEC,L"showbitrate",0,conf_file); cwids[0]=GetPrivateProfileInt(CONFIG_SEC,L"cwids0",300,conf_file); cwids[1]=GetPrivateProfileInt(CONFIG_SEC,L"cwids1",60,conf_file); cwids[2]=GetPrivateProfileInt(CONFIG_SEC,L"cwids2",120,conf_file); cwids[3]=GetPrivateProfileInt(CONFIG_SEC,L"cwids3",120,conf_file); cwids[4]=GetPrivateProfileInt(CONFIG_SEC,L"cwids4",120,conf_file); cwids[5]=GetPrivateProfileInt(CONFIG_SEC,L"cwids5",100,conf_file); cwids[6]=GetPrivateProfileInt(CONFIG_SEC,L"cwids6",100,conf_file); cwids[7]=GetPrivateProfileInt(CONFIG_SEC,L"cwids7",100,conf_file); cwids[8]=GetPrivateProfileInt(CONFIG_SEC,L"cwids8",100,conf_file); cwids[9]=GetPrivateProfileInt(CONFIG_SEC,L"cwids9",100,conf_file); cwids[10]=GetPrivateProfileInt(CONFIG_SEC,L"cwids10",100,conf_file); cwids[11]=GetPrivateProfileInt(CONFIG_SEC,L"cwids11",100,conf_file); cwids[12]=GetPrivateProfileInt(CONFIG_SEC,L"cwids12",100,conf_file); cwids[13]=GetPrivateProfileInt(CONFIG_SEC,L"cwids13",100,conf_file); cwids[14]=GetPrivateProfileInt(CONFIG_SEC,L"cwids14",100,conf_file); multiple=GetPrivateProfileInt(CONFIG_SEC,L"multiple",0,conf_file); dca=GetPrivateProfileInt(CONFIG_SEC,L"dca",0,conf_file); GetPrivateProfileString(CONFIG_SEC,L"exclude",L"",exclude,49,conf_file); //------------- numofm=GetPrivateProfileInt(CONFIG_SEC,L"numofm",0,conf_file); TCHAR savename[25]; for (int i=0;ikulcs,parts_file); //------------ wsprintf(savename,L"song%dparts",i); WritePrivateProfileString(CONFIG_SEC,savename,pts[i]->ertek,parts_file); //------------ } } } //--------END OPTIONS---------- TCHAR *pt; Song *songs; static void clearSongList(int win) { #ifdef DEBUGIT _ASSERTE( _CrtCheckMemory( ) ); #endif int i=m_songs[win].GetSize(); while (i>0) { try{ songs=(Song *)m_songs[win].Get(--i); if (songs->title) delete[] songs->title; delete[] songs->filetitle; delete[] songs->filepath; delete[] songs->sortname; if (songs->album) delete[] songs->album; if (songs->genre) delete[] songs->genre; if (songs->stats) delete[] songs->stats; delete songs; m_songs[win].Del(i); }catch(...){} } ListView_SetItemCount(m_list[win].getwnd(),0); #ifdef DEBUGIT _ASSERTE( _CrtCheckMemory( ) ); #endif } TCHAR* makedoublenull(TCHAR* source){ TCHAR* uj=new TCHAR[wcslen(source)+2]; uj[0]=0; uj=wcscat(uj,source); uj[wcslen(source)+1]=L'\0'; delete[] source; return uj; } Song* songdup(Song* ss){ Song* uj=new Song; uj->bitrate=ss->bitrate; uj->filepath=_wcsdup(ss->filepath); uj->filetitle=_wcsdup(ss->filetitle); uj->sortname=_wcsdup(ss->sortname); uj->title=_wcsdup(ss->title); uj->album=_wcsdup(ss->album); uj->genre=_wcsdup(ss->genre); uj->created=ss->created; uj->from=ss->from; uj->iconindex=ss->iconindex; uj->listpos=ss->listpos; uj->size=ss->size; uj->songlen=ss->songlen; uj->type=ss->type; uj->stats=NULL; return uj; } void delsong(Song* ss){ //delete[] ss->bitrate; delete[] ss->filepath; delete[] ss->filetitle; delete[] ss->sortname; delete[] ss->title; if (ss->album) delete[] ss->album; if (ss->genre) delete[] ss->genre; if (ss->stats) delete[] ss->stats; delete ss; } static void playFiles(int todo, int all,int win){ int enqu=!(todo==0); C_ItemList *list=(C_ItemList *)m_songs_sorted[win]; if (!list) { list=&m_songs[win]; all=1; } int x,l=list->GetSize(); int num=0; for (x = 0 ; x < l; x ++){ if (all||(!all&&m_list[win].GetSelected(x))&&x!=tooo[win]){ Song *s=(Song *)list->Get(x); if (s->type!=2){ if (s->from==-1){ s->filepath=makedoublenull(s->filepath); mlSendToWinampStruct sss={ ML_TYPE_FILENAMESW, s->filepath, enqu }; donothook=true; SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&sss,ML_IPC_SENDTOWINAMP); num++; if (enqu==0) enqu=1; }else{ origitemRecordListW il={0,}; allocorigRecordList(&il,il.Size+1,256); memset(&il.Items[il.Size],0,sizeof(origitemRecordW)); TCHAR uj[MAX_PATH]; uj[0]=0; wcscat(uj,s->filetitle); wcscat(uj,L" - "); wcscat(uj,s->title); il.Items[il.Size].length=s->songlen; il.Items[il.Size].title=uj; il.Items[il.Size].filename=s->filepath; il.Size++; mlSendToWinampStruct ss={ ML_TYPE_ITEMRECORDLISTW, &il, enqu }; SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&ss,ML_IPC_SENDTOWINAMP); num++; if (enqu==0) enqu=1; } } } } if (num&&todo==2){ int length = SendMessage(plugin.hwndWinampParent,WM_WA_IPC,0,IPC_GETLISTLENGTH); SendMessage(plugin.hwndWinampParent,WM_WA_IPC,length,IPC_SETPLAYLISTPOS); SendMessage(plugin.hwndWinampParent,WM_COMMAND,MAKEWPARAM(WINAMP_BUTTON2,0),0); } } BOOL IsDots(const TCHAR* str) { if(_tcscmp(str,L".") && _tcscmp(str,L"..")) return FALSE; return TRUE; } static void delFiles(int win)//or folders { if (!m_songs_sorted) return; if (!m_hwnd && 1) return; SHFILEOPSTRUCT fos; memset(&fos, 0, sizeof(fos)); fos.wFunc = FO_DELETE; fos.fFlags = FOF_ALLOWUNDO|FOF_NOCONFIRMATION ; C_ItemList *list=(C_ItemList *)m_songs_sorted[win]; if (!list) { list=&m_songs[win]; } int x,l=list->GetSize(); for (x = 0 ; x < l; x ++){ if (m_list[win].GetSelected(x)){ Song *s=(Song *)list->Get(x); s->filepath=makedoublenull(s->filepath); fos.pFrom=s->filepath; SHFileOperation(&fos); pts.torol(s->filepath+3); partschanged=true; } } SetTimer(m_hwnd,499,1,NULL); } //--autoname------- struct thewin{ int win; C_ItemList* list; }; DWORD WINAPI AUTON(LPVOID lpParameter){ thewin* tw=(thewin*)lpParameter; int win=tw->win; int listid=listcount[win]; C_ItemList *list=tw->list; if (!m_songs_sorted) return 0; if (!m_hwnd && 1) return 0; SHFILEOPSTRUCT fos; memset(&fos, 0, sizeof(fos)); fos.hwnd=m_hwnd; fos.wFunc = FO_RENAME; fos.fFlags = FOF_ALLOWUNDO ; int x,l=list->GetSize(); for (x = 0 ; x < l; x ++){ Song *s=(Song *)list->Get(x); if (s->type==3){//audio s->filepath=makedoublenull(s->filepath); fos.pFrom=s->filepath; TCHAR buf[MAX_PATH]; buf[0]=L'\0'; wcsncat(buf, s->filepath,(wcsrchr(s->filepath,L'\\')-s->filepath)+1); //---getname basicFileInfoStructW val; wchar_t valuee[150]; val.length=0; val.quickCheck=0; val.filename=s->filepath; val.title=valuee; val.titlelen=150; donothook=true; SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)&val,IPC_GET_BASIC_FILE_INFOW); //--------- while (wcsrchr(val.title,L'?')!=0) wcsrchr(val.title,L'?')[0]=L' '; while (wcsrchr(val.title,L'"')!=0) wcsrchr(val.title,L'"')[0]=L' '; while (wcsrchr(val.title,L':')!=0) wcsrchr(val.title,L':')[0]=L' '; while (wcsrchr(val.title,L'/')!=0) wcsrchr(val.title,L'/')[0]=L' '; while (wcsrchr(val.title,L'\\')!=0) wcsrchr(val.title,L'\\')[0]=L' '; while (wcsrchr(val.title,L'*')!=0) wcsrchr(val.title,L'*')[0]=L' '; while (wcsrchr(val.title,L'<')!=0) wcsrchr(val.title,L'<')[0]=L' '; while (wcsrchr(val.title,L'|')!=0) wcsrchr(val.title,L'|')[0]=L' '; while (wcsrchr(val.title,L'>')!=0) wcsrchr(val.title,L'>')[0]=L' '; wcscat(buf,val.title); //-------- wcscat(buf,_wcslwr(_wcsdup(wcsrchr(s->filepath,L'.')))); buf[wcslen(buf)+1]='\0'; fos.pTo=buf; if (wcscmp(fos.pFrom,fos.pTo)!=0){ bool playingmoved=(!wcscmp(s->filepath,playingpath)); int from=0; if (playingmoved){ from=SendMessage(plugin.hwndWinampParent,WM_WA_IPC,0,IPC_GETOUTPUTTIME); SendMessage(plugin.hwndWinampParent,WM_COMMAND,MAKEWPARAM(WINAMP_BUTTON4,0),0); } if (SHFileOperation(&fos)==0&&!fos.fAnyOperationsAborted){//successfull if (MYTOP) { MYTOP->filechange((TCHAR*)fos.pFrom,(TCHAR*)fos.pTo,-5);} if (playingmoved){ TCHAR* uj=new TCHAR[MAX_PATH];uj[0]=0; wcscat(uj,fos.pTo); donothook=true; SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)uj,IPC_CHANGECURRENTFILEW); if (playing) SendMessage(plugin.hwndWinampParent,WM_COMMAND,MAKEWPARAM(WINAMP_BUTTON2,0),0); if (playing) {int er; do{er=SendMessage(plugin.hwndWinampParent,WM_WA_IPC,from+500,IPC_JUMPTOTIME);}while(er==-1);} } hashvalue* hv=pts.hashkeres((TCHAR*)fos.pFrom+3); if (hv){ pts.uj((TCHAR*)fos.pTo+3,hv->ertek); pts.torol((TCHAR*)fos.pFrom+3); partschanged=true; } wcscat(val.title,_wcslwr(wcsrchr(s->filepath,L'.'))); if (listid==listcount[win]){ Song* listsong=(Song*)(m_songs_sorted[win]->Get(s->listpos)); if (!showtitle){delete[] listsong->filetitle; listsong->filetitle=_wcsdup(val.title);} delete[] listsong->filepath; delete[] listsong->sortname; listsong->filepath=_wcsdup(buf); listsong->sortname=_wcsdup(val.title); ListView_Update(m_list[win].m_hwnd, s->listpos); } } } } delsong(s); } delete tw->list; delete tw; if (multiple) SetTimer(m_hwnd,499,1,NULL); return 0; } static void renameFiles(int win){ thewin* tw=new thewin; tw->win=win; //-------- if (!m_songs_sorted) return; if (!m_hwnd && 1) return; C_ItemList *newlist=new C_ItemList; C_ItemList *list=(C_ItemList *)m_songs_sorted[win]; if (!list) { list=&m_songs[win];} int x,l=list->GetSize(); for (x = 0 ; x < l; x ++){ if (m_list[win].GetSelected(x)&&x!=tooo[win]){ Song* s=(Song*)(list->Get(x)); if (s->type==0||s->from!=-1) m_list[win].SetSelected(x,false); else newlist->Add(songdup(s)); } } tw->list=newlist; //-------- DWORD dwThread; CreateThread(0,0,AUTON,(void*)tw,0,&dwThread); } //--moveorcopy---- struct pars{ bool copy; int win; SHFILEOPSTRUCT fos; TCHAR* to; C_ItemList* list; }; DWORD WINAPI MORC(LPVOID lpParameter){ pars* pp=(pars*)lpParameter; int i=0; int win=pp->win; int listid=listcount[win]; if (!pp->copy||multiple){ if (!multiple) SetDlgItemTextA(m_hwnd,IDC_STATUS,"Moving file(s)..."); else{ SetDlgItemTextA(m_hwnd,IDC_STATUS0,"Moving file(s)..."); SetDlgItemTextA(m_hwnd,IDC_STATUS1,"Moving file(s)..."); } } C_ItemList *list=pp->list; int x,l=list->GetSize(); for (x = 0 ; x < l; x ++){ Song *s=(Song *)list->Get(x); s->filepath=makedoublenull(s->filepath); pp->fos.pFrom=s->filepath; bool playingmoved=(!pp->copy&&!wcscmp(s->filepath,playingpath)); int from=0; UINT func; if (playingmoved){ from=SendMessage(plugin.hwndWinampParent,WM_WA_IPC,0,IPC_GETOUTPUTTIME); //SendMessage(plugin.hwndWinampParent,WM_COMMAND,MAKEWPARAM(WINAMP_BUTTON4,0),0); func=pp->fos.wFunc; pp->fos.wFunc = FO_COPY; } if (!SHFileOperation(&pp->fos)&&!pp->fos.fAnyOperationsAborted){ if (MYTOP&&!pp->copy) { MYTOP->filechange((TCHAR*)pp->fos.pFrom,(TCHAR*)pp->fos.pTo,s->type);} hashvalue* hv=pts.hashkeres(s->filepath+3); if (hv){ TCHAR* uj=new TCHAR[MAX_PATH]; uj[0]=0; wcscat(uj,pp->to); wcscat(uj,wcsrchr(s->filepath,L'\\')); pts.uj(uj+3,wcsdup(hv->ertek)); if (!pp->copy) pts.torol(s->filepath+3); } if (playingmoved){ TCHAR* uj=new TCHAR[MAX_PATH];uj[0]=0; wcscat(uj,pp->to);int l=wcslen(uj); uj[l]=L'\\';uj[l+1]=0; wcscat(uj,s->filetitle); l=wcslen(uj);uj[l+1]=L'\0'; donothook=true; SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)uj,IPC_CHANGECURRENTFILEW); if (playing) SendMessage(plugin.hwndWinampParent,WM_COMMAND,MAKEWPARAM(WINAMP_BUTTON2,0),0); if (playing) {int er; do{er=SendMessage(plugin.hwndWinampParent,WM_WA_IPC,from+500,IPC_JUMPTOTIME);}while(er==-1);} //deleting FILEOP_FLAGS fl=pp->fos.fFlags; pp->fos.wFunc = FO_DELETE; pp->fos.fFlags = FOF_ALLOWUNDO|FOF_NOCONFIRMATION ; SHFileOperation(&pp->fos); pp->fos.fFlags=fl; pp->fos.wFunc=func; delete[] uj; } delsong(s); } } if (!multiple){ if ((!pp->copy&&listid==listcount[win])) SetTimer(m_hwnd,499,1,NULL); }else{ SetTimer(m_hwnd,499,1,NULL); } delete pp->list; delete pp; #ifdef DEBUGIT _ASSERTE( _CrtCheckMemory( ) ); #endif return 0; } void moveorcopy(TCHAR* to,bool copy,int win){ pars* pp=new pars; pp->to=_wcsdup(to); pp->copy=copy; pp->win=win; //----- if (!m_songs_sorted) return; if (!m_hwnd && 1) return; C_ItemList *newlist=new C_ItemList; C_ItemList *list=(C_ItemList *)m_songs_sorted[win]; if (!list) { list=&m_songs[win];} int x,l=list->GetSize(); for (x = 0 ; x < l; x ++){ if (m_list[win].GetSelected(x)&&x!=tooo[win]){ Song* s=(Song*)(list->Get(x)); if (s->type==0||s->from!=-1) m_list[win].SetSelected(x,false); else newlist->Add(songdup(s)); } } pp->list=newlist; //------- memset(&pp->fos, 0, sizeof(pp->fos)); if (copy) pp->fos.wFunc = FO_COPY; else pp->fos.wFunc = FO_MOVE; pp->to=makedoublenull(pp->to); if (pp->to[wcslen(pp->to)-1]==L'\\') pp->to[wcslen(pp->to)-1]=L'\0'; pp->fos.pTo=pp->to; pp->fos.fFlags = FOF_ALLOWUNDO ; DWORD dwThread; CreateThread(0,0,MORC,(void*)pp,0,&dwThread); } //----------------- bool isrealfolder(TCHAR* buf){ TCHAR* buff=_wcsdup(buf); int len=wcslen(buff); buff[len-1]=0;//L'\0'; WIN32_FIND_DATA FindFileData; HANDLE hFind=NULL; hFind = FindFirstFile(buff, &FindFileData); free(buff); if (hFind&&hFind!=INVALID_HANDLE_VALUE){ if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) return true; } return false; } bool isrealplaylist(TCHAR* buf){ TCHAR* last=wcsrchr(buf,L'.'); if (!last) return false; if (wcsicmp(last,L".m3u")==0||wcsicmp(last,L".m3u8")==0/*||wcsicmp(last,L".pls")==0*/){ TCHAR* buff=_wcsdup(buf); int len=wcslen(buff); //buff[len-1]=0;//L'\0'; WIN32_FIND_DATA FindFileData; HANDLE hFind=NULL; hFind = FindFirstFile(buff, &FindFileData); free(buff); if (hFind&&hFind!=INVALID_HANDLE_VALUE){ return true; } return false; }else return false; } TCHAR* path[2]; //---drive watcher bool firstcheck=true; DWORD WINAPI DRIVEWATCHER( LPVOID lpParameter){ TCHAR oldt[512]; TCHAR newt[512]; TCHAR buff[16]; short db,i; while (1){ i=0; db=GetLogicalDriveStrings(511, newt); while (iversion != DSP_HDRVER)*/){ FreeLibrary(hNewDSP); return 0; } return 1; } //---- HCURSOR cur1; HCURSOR cur2; HCURSOR cur3; bool defaulticons=false; void loaddeficons(){ hsl=ImageList_Create(16,16,ILC_COLOR32|ILC_MASK,5,5); HICON ic2; switch (posicon){ case 0:{ic2=LoadIcon(plugin.hDllInstance,MAKEINTRESOURCE(IDI_ICON6));}break; case 1:{ic2=LoadIcon(plugin.hDllInstance,MAKEINTRESOURCE(IDI_ICON7));}break; case 2:{ic2=LoadIcon(plugin.hDllInstance,MAKEINTRESOURCE(IDI_ICON16));}break; } ImageList_AddIcon(hsl, ic2); ic2=LoadIcon(plugin.hDllInstance,MAKEINTRESOURCE(IDI_ICON11)); ImageList_AddIcon(hsl, ic2); HICON ic3=LoadIcon(plugin.hDllInstance,MAKEINTRESOURCE(IDI_ICON9));//folder ImageList_AddIcon(hsl, ic3); HICON ic4=LoadIcon(plugin.hDllInstance,MAKEINTRESOURCE(IDI_ICON8));//file ImageList_AddIcon(hsl, ic4); HICON ic5=LoadIcon(plugin.hDllInstance,MAKEINTRESOURCE(IDI_ICON10));//song ImageList_AddIcon(hsl, ic5); } void initicons(){ SHFILEINFO ssfi; ssfi.iIcon=0; CoInitializeEx(0,0x2); try{ sim = (HIMAGELIST)SHGetFileInfo(L".",0,&ssfi,sizeof(SHFILEINFO),SHGFI_SYSICONINDEX | SHGFI_SMALLICON); hsl=sim; }catch(...){ ssfi.iIcon=0; } //hsl=ImageList_Duplicate(sim); if (!hsl){ defaulticons=true; loaddeficons(); } else{ ujicon=ImageList_GetImageCount(hsl); HICON ic2; switch (posicon){ case 0:{ic2=LoadIcon(plugin.hDllInstance,MAKEINTRESOURCE(IDI_ICON6));}break; case 1:{ic2=LoadIcon(plugin.hDllInstance,MAKEINTRESOURCE(IDI_ICON7));}break; case 2:{ic2=LoadIcon(plugin.hDllInstance,MAKEINTRESOURCE(IDI_ICON16));}break; } // MLTREEIMAGE im9 = {plugin.hDllInstance, IDB_BMP_PL, -1, FILTER_DEFAULT1, 0, 0}; /*(int)(INT_PTR)SendMessage(plugin.hwndLibraryParent, WM_ML_IPC, (WPARAM) &im9, ML_IPC_TREEIMAGE_ADD); ICONINFO ic={true,0,0,0,(HBITMAP)uj}; ic2=CreateIconIndirect(&ic);*/ ImageList_AddIcon(hsl, ic2); ic2=LoadIcon(plugin.hDllInstance,MAKEINTRESOURCE(IDI_ICON11)); ImageList_AddIcon(hsl, ic2); } } void initmenus(){ SetMenuDefaultItem(GetSubMenu(m_context_menus,2), 0, TRUE); SetMenuDefaultItem(GetSubMenu(m_context_menus,3), 0, TRUE); SetMenuDefaultItem(GetSubMenu(m_context_menus,5), 0, TRUE); SetMenuDefaultItem(GetSubMenu(m_context_menus,8), 0, TRUE); if (dca==0){ SetMenuDefaultItem(GetSubMenu(m_context_menus,1), 0, TRUE); SetMenuDefaultItem(GetSubMenu(m_context_menus,4), 0, TRUE); SetMenuDefaultItem(GetSubMenu(m_context_menus,7), 0, TRUE); SetMenuDefaultItem(GetSubMenu(m_context_menus,9), 0, TRUE); SetMenuDefaultItem(GetSubMenu(m_context_menus,10), 0, TRUE); SetMenuDefaultItem(GetSubMenu(m_context_menus,11), 0, TRUE); }else{ SetMenuDefaultItem(GetSubMenu(m_context_menus,1), 1, TRUE); SetMenuDefaultItem(GetSubMenu(m_context_menus,4), 1, TRUE); SetMenuDefaultItem(GetSubMenu(m_context_menus,7), 1, TRUE); SetMenuDefaultItem(GetSubMenu(m_context_menus,9), 1, TRUE); SetMenuDefaultItem(GetSubMenu(m_context_menus,10), 1, TRUE); SetMenuDefaultItem(GetSubMenu(m_context_menus,11), 1, TRUE); } MENUITEMINFO menuItemInfoNew; menuItemInfoNew.cbSize=sizeof(MENUITEMINFO); menuItemInfoNew.fMask = MIIM_STRING; if (dca==2){ menuItemInfoNew.dwTypeData=L"Enqueue&&play"; } else { menuItemInfoNew.dwTypeData=L"Enqueue"; } SetMenuItemInfo(GetSubMenu(m_context_menus,1), 1,TRUE,&menuItemInfoNew); SetMenuItemInfo(GetSubMenu(m_context_menus,4), 1,TRUE,&menuItemInfoNew); SetMenuItemInfo(GetSubMenu(m_context_menus,7), 1,TRUE,&menuItemInfoNew); SetMenuItemInfo(GetSubMenu(m_context_menus,9), 1,TRUE,&menuItemInfoNew); SetMenuItemInfo(GetSubMenu(m_context_menus,10), 1,TRUE,&menuItemInfoNew); SetMenuItemInfo(GetSubMenu(m_context_menus,11), 1,TRUE,&menuItemInfoNew); } int init() { //IPC_GETM3UDIRECTORYW //TCHAR* dir=(TCHAR*)SendMessage(plugin.hwndWinampParent,WM_WA_IPC,0,IPC_GETM3UDIRECTORYW); LoadPlugin(); numofdevices=0; current[0]=-1; current[1]=-1; tooo[0]=-1; tooo[1]=-1; listcount[0]=0; listcount[1]=0; path[0]=new TCHAR[MAX_PATH]; path[1]=new TCHAR[MAX_PATH]; wcscpy(path[1],L""); g_WAversion = SendMessage(plugin.hwndWinampParent,WM_WA_IPC,0,IPC_GETVERSION); if (g_WAversion >= 0x5030) { MLTREEIMAGE img1 = {plugin.hDllInstance, IDB_BMP_FOLDER, -1, FILTER_DEFAULT1, 0, 0}; MLTREEIMAGE img2 = {plugin.hDllInstance, IDB_BMP_CD, -1, FILTER_DEFAULT1, 0, 0}; MLTREEIMAGE img3 = {plugin.hDllInstance, IDB_BMP_ACD, -1, FILTER_DEFAULT1, 0, 0}; MLTREEIMAGE img4 = {plugin.hDllInstance, IDB_BMP_DRIVE, -1, FILTER_DEFAULT1, 0, 0}; MLTREEIMAGE img6 = {plugin.hDllInstance, IDB_BMP_NDRIVE, -1, FILTER_DEFAULT1, 0, 0}; MLTREEIMAGE img7 = {plugin.hDllInstance, IDB_BMP_USB, -1, FILTER_DEFAULT1, 0, 0}; MLTREEIMAGE img8 = {plugin.hDllInstance, IDB_BMP_OT, -1, FILTER_DEFAULT1, 0, 0}; MLTREEIMAGE img9 = {plugin.hDllInstance, IDB_BMP_PL, -1, FILTER_DEFAULT1, 0, 0}; imgfolder = (int)(INT_PTR)SendMessage(plugin.hwndLibraryParent, WM_ML_IPC, (WPARAM) &img1, ML_IPC_TREEIMAGE_ADD); imgplaylist = (int)(INT_PTR)SendMessage(plugin.hwndLibraryParent, WM_ML_IPC, (WPARAM) &img9, ML_IPC_TREEIMAGE_ADD); imgcd = (int)(INT_PTR)SendMessage(plugin.hwndLibraryParent, WM_ML_IPC, (WPARAM) &img2, ML_IPC_TREEIMAGE_ADD); imgacd = (int)(INT_PTR)SendMessage(plugin.hwndLibraryParent, WM_ML_IPC, (WPARAM) &img3, ML_IPC_TREEIMAGE_ADD); imgdrive = (int)(INT_PTR)SendMessage(plugin.hwndLibraryParent, WM_ML_IPC, (WPARAM) &img4, ML_IPC_TREEIMAGE_ADD); imgndrive = (int)(INT_PTR)SendMessage(plugin.hwndLibraryParent, WM_ML_IPC, (WPARAM) &img6, ML_IPC_TREEIMAGE_ADD); imgot = (int)(INT_PTR)SendMessage(plugin.hwndLibraryParent, WM_ML_IPC, (WPARAM) &img8, ML_IPC_TREEIMAGE_ADD); imgusb = (int)(INT_PTR)SendMessage(plugin.hwndLibraryParent, WM_ML_IPC, (WPARAM) &img7, ML_IPC_TREEIMAGE_ADD); } loadoptions(); initicons(); SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&mla,ML_IPC_ADDTREEITEM); mainParam=mla.this_id; inittree(0); m_context_menus=LoadMenu(plugin.hDllInstance,MAKEINTRESOURCE(IDR_CONTEXTMENUS)); DWORD dwThread; hThread2 = CreateThread(0,0,DRIVEWATCHER,0,0,&dwThread); DWORD dwThread2; CreateThread(0,0,VILL,0,0,&dwThread2); lpWndProcOld = (WNDPROC)SetWindowLong(plugin.hwndWinampParent, GWL_WNDPROC, (LONG)MWndProc); //---- initmenus(); cur1=LoadCursor(plugin.hDllInstance,MAKEINTRESOURCE(IDC_CURSOR1)); cur2=LoadCursor(plugin.hDllInstance,MAKEINTRESOURCE(IDC_CURSOR2)); cur3=LoadCursor(plugin.hDllInstance,MAKEINTRESOURCE(IDC_CURSOR3)); return 0; } //int insertreeitem(TCHAR * name, int type, int insertAfterId){ // MLTREEITEMW newTree; // newTree.size = sizeof(MLTREEITEMW); // newTree.parentId = mla.this_id; // newTree.title = name; // newTree.hasChildren = FALSE; // switch (type){ // case 2: newTree.imageIndex = imgusb; break; // case 3: newTree.imageIndex = imgdrive; break; // case 4: newTree.imageIndex = imgndrive; break; // case 5: newTree.imageIndex = imgcd; break; // case 7: newTree.imageIndex = imgacd; break; // default: newTree.imageIndex = imgot; break; // } // newTree.id=insertAfterId; // SendMessage(plugin.hwndLibraryParent, WM_ML_IPC, (WPARAM) &newTree, ML_IPC_TREEITEM_INSERTW); // //myParam[i+1]=newTree.id; // return newTree.id; //} //void removetreeitem(int id){ // SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)id,ML_IPC_DELTREEITEM); //} void inittree(bool drivechanged){ if (!drivechanged){//delete all for (int i = 0;i 0x5030) { while (i0) newTree.id=dnames[i-1].treeID; SendMessage(plugin.hwndLibraryParent, WM_ML_IPC, (WPARAM) &newTree, ML_IPC_TREEITEM_INSERTW); myParamDrive[i]=newTree.id; dnames[i].treeID=newTree.id; } i++; } if (showmp&&!drivechanged){ int m=0; int ms=0; for (int j=0;j 0x5030) { // while (i iconindexes; int GetIconIndex(TCHAR* csFileName,bool isfolder){ if (!csFileName) return 0; if (!wcsrchr(csFileName,L'.')){ if (isfolder) goto els; else return 0; } int ic; if (wcscmp(L".exe",wcsrchr(csFileName,L'.'))!=0){ ic=iconindexes.keres(wcsrchr(csFileName,L'.')); if (!ic){ //OleInitialize(0); CoInitializeEx(0,0x2); SHFILEINFO sfi; sfi.iIcon=0; try{ sim = (HIMAGELIST)SHGetFileInfo(csFileName, 0,&sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON ); ic=sfi.iIcon; }catch(...){} iconindexes.uj(wcsrchr(csFileName,L'.'),ic); } return ic; }else{ els: SHFILEINFO sfi; CoInitializeEx(0,0x2); sfi.iIcon=0; sim = (HIMAGELIST)SHGetFileInfo(csFileName, 0,&sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON ); ic=sfi.iIcon; return ic; } } int att; HANDLE loaderhandle0=NULL; HANDLE loaderhandle1=NULL; void loadSongList(int win){ DWORD dwThread; if (win==0){ //if (loaderhandle0&&!filelistloaded0) return; TerminateThread(loaderhandle0,0); current[0]=-1; if (!multiple) SetDlgItemText(m_hwnd,IDC_STATUS,L"Loading folder contents..."); else SetDlgItemText(m_hwnd,IDC_STATUS0,L"Loading folder contents..."); clearSongList(0); loaderhandle0=CreateThread(0,0,lt2,(void*)0,0,&dwThread); }else if (win==1){ //if (loaderhandle1&&!filelistloaded1) return; TerminateThread(loaderhandle1,0); current[1]=-1; SetDlgItemText(m_hwnd,IDC_STATUS1,L"Loading folder contents..."); clearSongList(1); loaderhandle1=CreateThread(0,0,lt2,(void*)1,0,&dwThread); } } bool iscda(TCHAR* name){ TCHAR* last=wcsrchr(name,L'.'); if (!last) return false; if (wcsicmp(last,L".cda")==0) return true; else return false; } bool isgeneral(TCHAR* name){ TCHAR* last=wcsrchr(name,L'.'); if (!last) return false; if (wcsicmp(last,L".exe")==0||wcsicmp(last,L".dll")==0||wcsicmp(last,L".jpg")==0||wcsicmp(last,L".rar")==0||wcsicmp(last,L".zip")==0||wcsicmp(last,L".bmp")==0||wcsicmp(last,L".gif")==0||wcsicmp(last,L".lnk")==0||wcsicmp(last,L".doc")==0||wcsicmp(last,L".txt")==0||wcsicmp(last,L".pdf")==0) return true; else return false; } bool isaudio(TCHAR* name){ TCHAR* last=wcsrchr(name,L'.'); if (!last) return false; if (wcsicmp(last,L".mp3")==0||wcsicmp(last,L".wav")==0||wcsicmp(last,L".ape")==0||wcsicmp(last,L".flac")==0||wcsicmp(last,L".aac")==0||wcsicmp(last,L".wma")==0||wcsicmp(last,L".cda")==0||wcsicmp(last,L".mpc")==0) return true; else return false; } bool isvideo(TCHAR* name){ TCHAR* last=wcsrchr(name,L'.'); if (!last) return false; if (wcsicmp(last,L".avi")==0||wcsicmp(last,L".mov")==0||wcsicmp(last,L".mpg")==0||wcsicmp(last,L".mpeg")==0||wcsicmp(last,L".rm")==0||wcsicmp(last,L".flv")==0||wcsicmp(last,L".rmvb")==0||wcsicmp(last,L".wmv")==0) return true; else return false; } bool isplaylist(TCHAR* name){ TCHAR* last=wcsrchr(name,L'.'); if (!last) return false; if (wcsicmp(last,L".m3u")==0||wcsicmp(last,L".m3u8")==0/*||wcsicmp(last,L".pls")==0*/) return true; else return false; } DWORD WINAPI lt2(LPVOID lpParameter){ int win=(int)lpParameter; listcount[win]++; listcount[win]=-1*listcount[win]; int mylc=listcount[win]; totallen[win]=0; totalsize[win]=0; folders[win]=0; files[win]=0; CoInitializeEx(0,0x2); SetDlgItemText(m_hwnd,IDC_STATUS23,path[win]); TCHAR szDir[MAX_PATH]; HANDLE hFind = INVALID_HANDLE_VALUE; WIN32_FIND_DATA ffd; bool PL=isplaylist(path[win]); wcscpy(szDir, path[win]); if (!PL){ wcscat(szDir, L"\\*"); //upper folder if (wcsrchr(path[win],L'\\')!=path[win]+2){ Song *p=new Song; p->filetitle=_wcsdup(L".."); p->sortname=_wcsdup(L".."); p->filepath=_wcsdup(L".."); p->stats=NULL; p->album=NULL; p->genre=NULL; p->size=0; p->songlen=0; p->type=0; p->iconindex=1; p->from=-1; p->parent=NULL; p->title=NULL; if (defaulticons) p->iconindex=2; m_songs[win].Add((void*)p); } } //---- bool next; FILE* plfile=NULL; TCHAR extline[MAX_PATH];extline[0]=0; TCHAR line[MAX_PATH]; TCHAR file[MAX_PATH]; int pldb=0; if (PL){ LV_SKIN_SHOWSORT ls; ls.listView=(int)m_list[win].getwnd(); ls.showSort=false; SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&ls,ML_IPC_LISTVIEW_SHOWSORT); sortpl=true; TCHAR *last=wcsrchr(szDir,L'\\'); last[1]=0; plfile=_wfopen(path[win],L"r"); if (!plfile) return 0; goto pl; }else{ sortpl=false; hFind = FindFirstFile(szDir, &ffd); } do{ if (mylc!=listcount[win]) return 0; TCHAR* fname; Song *p; if (!PL){ //NORMAL FILE fname=new TCHAR[wcslen(path[win])+wcslen(ffd.cFileName)+2]; wcscpy(fname,path[win]); wcscat(fname,ffd.cFileName); att=ffd.dwFileAttributes;//16:folder 32:normal 1:cd file if (!(att&FILE_ATTRIBUTE_HIDDEN)&&!(att&FILE_ATTRIBUTE_SYSTEM)&&!IsDots(ffd.cFileName)){ p=(Song *)calloc(sizeof(Song),1); p->filetitle = wcsdup(ffd.cFileName); p->sortname = wcsdup(ffd.cFileName); p->filepath = fname; p->size=ffd.nFileSizeLow/1024; p->songlen=0; p->created=ffd.ftCreationTime; p->type=0; p->from=-1; p->bitrate=-1; if(att&FILE_ATTRIBUTE_DIRECTORY){ p->type=1; if (!defaulticons){ p->iconindex=GetIconIndex(fname,true); if (p->iconindex<0) p->iconindex=1; } else p->iconindex=2; }else{ p->type=2; if (!defaulticons) p->iconindex=GetIconIndex(fname,false); if (p->iconindex<0||defaulticons) p->iconindex=3; } }else goto next; }else{ //PLAYLIST ITEM pldb++; p=(Song *)calloc(sizeof(Song),1); fname=new TCHAR[MAX_PATH];fname[0]=0; wcscat(fname,file); p->filepath = fname; p->from=-1; p->number=pldb; p->songlen=-1; p->filetitle=0; p->sortname=0; if (!defaulticons) p->iconindex=GetIconIndex(fname,false); if (p->iconindex<0||defaulticons) p->iconindex=4; if (wcslen(extline)>0){ TCHAR* ves=wcschr(extline,L','); if (ves){ if (showtitle&&wcslen(ves)>1){ p->filetitle = _wcsdup(ves+1); p->sortname = _wcsdup(ves+1); }; ves[0]=0; swscanf(extline+8,L"%d",&(p->songlen)); } } if (hFind){ p->type=7; p->size=ffd.nFileSizeLow/1024; p->created=ffd.ftCreationTime; if (!showtitle) p->filetitle = _wcsdup(ffd.cFileName); if (!showtitle) p->sortname = _wcsdup(ffd.cFileName); }else{ p->type=8; p->size=-1; p->filetitle = _wcsdup(wcsrchr(fname,L'\\')+1); p->sortname = _wcsdup(wcsrchr(fname,L'\\')+1); } p->stats=NULL; p->bitrate=-1; p->year=-1; p->album=NULL; p->genre=NULL; p->parent=NULL; p->title=NULL; if (wcslen(extline)==0||p->sortname==0) goto geti; else goto getii; } //----RESETTING--------- p->stats=NULL; p->title=NULL; p->bitrate=-1; p->year=-1; p->number=-1; p->album=NULL; p->genre=NULL; p->parent=NULL; //------------------------------ if (mylc!=listcount[win]) return 0; extendedFileInfoStructW efs; efs.filename=fname; if (p->type==2){//getting type and def. icon if (!isgeneral(p->filetitle)){ if (isaudio(p->filetitle)){ p->type=3; if (iscda(p->filetitle)) p->type=5; if (p->iconindex<0||defaulticons) p->iconindex=4; }else if (isvideo(p->filetitle)){ p->type=4; if (p->iconindex<0||defaulticons) p->iconindex=4; }else if (isplaylist(p->filetitle)){ p->type=6; if (p->iconindex<0||defaulticons) p->iconindex=4; }else{ TCHAR* value=new TCHAR[50]; value[0]='\0'; value[1]='\0'; efs.metadata=L"type"; efs.ret=value; efs.retlen=2; SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)&efs,IPC_GET_EXTENDED_FILE_INFOW); if (!wcscmp(efs.ret,L"0")){ p->type=3;//audio if (p->iconindex<0||defaulticons) p->iconindex=4; }else if (!wcscmp(efs.ret,L"1")){ p->type=4;//video if (p->iconindex<0||defaulticons) p->iconindex=4; }else if (isplaylist(p->filetitle)){ p->type=3;//playlist if (p->iconindex<0||defaulticons) p->iconindex=4; } } } //--------------------------- geti: basicFileInfoStructW val; if (g_sortcol==COL_LENGTH||(g_sortcol==COL_FILENAME&&showtitle)&&(p->type==3||p->type==4)||p->type==5||p->type==7){ TCHAR* valuee=new TCHAR[121]; val.length=0; val.quickCheck=0; val.filename=p->filepath; val.title=valuee; val.titlelen=120; donothook=true; SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)&val,IPC_GET_BASIC_FILE_INFOW); p->songlen=val.length; if (p->type==5||showtitle){ p->filetitle=_wcsdup(val.title); p->sortname=_wcsdup(val.title); }else delete[] valuee; } if (showtitle&&p->songlen==0&&p->type==3){//filename minus extension equals song title (if auto-named) TCHAR* pont=wcsrchr(p->filetitle,L'.'); if (pont) pont[0]=0; } //--------------------------------------- if (g_sortcol==COL_NUMBER&&(p->type==3||p->type==5||p->type==4)){ efs.filename=p->filepath; wchar_t br[10]; efs.retlen=8; efs.ret=br; efs.metadata=L"track"; SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)&efs,IPC_GET_EXTENDED_FILE_INFOW); if (wcslen(br)>0) p->number=_wtoi(br); } getii: if (g_sortcol==COL_RATING&&MYTOP&&(p->type==3||p->type==5||p->type==4||p->type==7)){ SongStat* st=new SongStat; if (!(MYTOP->getdata(p->filepath,st))){ delete st; } else { p->stats=st; p->stats->firstplayed=p->created; } } if (g_sortcol==COL_YEAR&&(p->type==3||p->type==5||p->type==4||p->type==7)){ efs.filename=p->filepath; wchar_t br[10]; efs.retlen=8; efs.ret=br; efs.metadata=L"year"; SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)&efs,IPC_GET_EXTENDED_FILE_INFOW); if (wcslen(br)>0) p->year=_wtoi(br); } //--------------------------------------- if (mylc!=listcount[win]) return 0; if (p->type==3){ //----parts if (showposit){ TCHAR* partv=_wcsdup(pts.keres(p->filepath+3)); if (partv!=NULL){ if (p->songlen==0){ TCHAR valuee[50]; val.length=0; val.quickCheck=0; val.filename=p->filepath; val.title=valuee; val.titlelen=50; donothook=true; SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)&val,IPC_GET_BASIC_FILE_INFOW); p->songlen=val.length; } TCHAR *token; token = wcstok(partv, L"|" ); // C4996 while( token != NULL ){ int from=_ttoi(token); token = wcstok(NULL, L"|" ); Song *pp=(Song *)calloc(sizeof(Song),1); TCHAR* fn=new TCHAR[MAX_PATH]; fn[0]=0; wsprintf(fn,L"%02d:%02d - %s",from/60,from%60,token); pp->filetitle = fn; pp->sortname = _wcsdup(p->sortname); pp->filepath = _wcsdup(p->filepath); pp->title=_wcsdup(val.title); pp->type=3; pp->from=from; pp->iconindex=ujicon; pp->def_iconindex=ujicon; pp->stats=NULL; pp->parent=p; if (showall||showsongs)m_songs[win].Add((void*)pp); //----- token = wcstok(NULL, L"|" ); } } } } } p->def_iconindex=p->iconindex; if (PL){ if (p->type==7) m_songs[win].Add((void*)p); else if (p->type==8) m_songs[win].Add((void*)p); }else{ if (!showall){ if (p->type==1) m_songs[win].Add((void*)p); else if (showsongs&&(p->type==3||p->type==5)) m_songs[win].Add((void*)p); else if (showvids&&p->type==4) m_songs[win].Add((void*)p); else if (showplaylists&&p->type==6) m_songs[win].Add((void*)p); }else if (p->type){ m_songs[win].Add((void*)p); } } next: //NEXT FILE if (!PL) next=FindNextFile(hFind, &ffd); else{ extline[0]=0; pl: file[0]=0; fgetws(line, MAX_PATH,plfile); if (line[0]==L'#'||line[3]==L'#'){ if (line[4]==L'I') wcscpy(extline,line); goto pl; } if(line[1]==L':'){//absolute line[wcslen(line)-1]=0; wcscat(file,line); }else{//relative if (line[0]==L'\\'){//upper folder TCHAR* tempd=_wcsdup(szDir); kov: TCHAR *last=wcsrchr(tempd,L'\\'); last[0]=0; last=wcsrchr(tempd,L'\\'); last[1]=0; wcscpy(line,line+1); if (line[0]==L'\\') goto kov; wcscat(file,tempd); }else wcscat(file,szDir); line[wcslen(line)-1]=0; wcscat(file,line); } hFind = FindFirstFile(file, &ffd); if (hFind==INVALID_HANDLE_VALUE) hFind=0; next=true; if (feof(plfile)){ next=false; fclose(plfile);} } } while (next); if (mylc!=listcount[win]) return 0; listcount[win]=-1*listcount[win]; mylc=listcount[win]; getcurrent(); updateList(win); //----------------------------ADDITIONAL COLUMNS------------------------------------------------ //-----lengths C_ItemList *list=(C_ItemList *)&m_songs[win]; int x,l=list->GetSize(); basicFileInfoStructW val; extendedFileInfoStructW efs; for (x = 0 ; x < l; x ++){ if (mylc!=listcount[win]) return 0; Song* s=(Song*)(list->Get(x)); if (!s) break; if ((showlength||showtitle)&&g_sortcol!=COL_LENGTH&&!(showtitle&&g_sortcol==COL_FILENAME)&&(s->type==3||s->type==4||s->type==7)&&s->songlen==0&&s->type!=5&&s->from==-1){ TCHAR* valuee=new TCHAR[121]; val.length=0; val.quickCheck=0; val.filename=s->filepath; val.title=valuee; val.titlelen=120; donothook=true; SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)&val,IPC_GET_BASIC_FILE_INFOW); s->songlen=val.length; totallen[win]+=val.length; if (s->type==5||showtitle){ s->filetitle=_wcsdup(val.title); s->sortname=_wcsdup(val.title); } else delete[] valuee; } if (g_sortcol!=COL_NUMBER&&shownumber&&(s->type==3||s->type==5||s->type==4)&&s->from==-1){ efs.filename=s->filepath; wchar_t br[10]; efs.retlen=8; efs.ret=br; efs.metadata=L"track"; SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)&efs,IPC_GET_EXTENDED_FILE_INFOW); if (wcslen(br)>0) s->number=_wtoi(br); } if (g_sortcol!=COL_YEAR&&showyear&&(s->type==3||s->type==5||s->type==4||s->type==7)&&s->from==-1){ efs.filename=s->filepath; wchar_t br[10]; efs.retlen=8; efs.ret=br; efs.metadata=L"year"; SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)&efs,IPC_GET_EXTENDED_FILE_INFOW); if (wcslen(br)>0) s->year=_wtoi(br); } if (showbitrate&&(s->type==3||s->type==5||s->type==4||s->type==7)&&s->from==-1){ efs.filename=s->filepath; wchar_t br[10]; efs.retlen=5; efs.ret=br; efs.metadata=L"bitrate"; SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)&efs,IPC_GET_EXTENDED_FILE_INFOW); if (wcslen(br)>0) s->bitrate=_wtoi(br); } if (showalbum&&(s->type==3||s->type==5||s->type==4||s->type==7)&&s->from==-1){ efs.filename=s->filepath; wchar_t br[50]; efs.retlen=50; efs.ret=br; efs.metadata=L"album"; SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)&efs,IPC_GET_EXTENDED_FILE_INFOW); s->album=_wcsdup(br); } if (showgenre&&(s->type==3||s->type==5||s->type==4||s->type==7)&&s->from==-1){ efs.filename=s->filepath; wchar_t br[50]; efs.retlen=50; efs.ret=br; efs.metadata=L"genre"; SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)&efs,IPC_GET_EXTENDED_FILE_INFOW); s->genre=_wcsdup(br); } if (g_sortcol!=COL_RATING&&MYTOP&&(showfirstp||showlastp||showpcount||showplength)&&(s->type==3||s->type==5||s->type==4||s->type==7)&&s->from==-1){ SongStat* st=new SongStat; if (!(MYTOP->getdata(s->filepath,st))){ delete[] st; } else { s->stats=st; s->stats->firstplayed=s->created; } } if (m_songs[win].Get(x)) ListView_Update(m_list[win].m_hwnd,((Song*)m_songs[win].Get(x))->listpos); } if (mylc!=listcount[win]) return 0; writestatus(win); if (win==0) loaderhandle0=NULL; else loaderhandle1=NULL; #ifdef DEBUGIT _ASSERTE( _CrtCheckMemory( ) ); #endif return 0; } //-----search,sort------ static void parsequicksearch(TCHAR *out, TCHAR *in) // parses a list into a list of terms that we are searching for { int inquotes=0, neednull=0; while (*in) { TCHAR c=*in++; if (c != L' ' && c != L'\t' && c != L'\"') { neednull=1; *out++=c; } else if (c == L'\"') { inquotes=!inquotes; if (!inquotes) { *out++=0; neednull=0; } } else { if (inquotes) *out++=c; else if (neednull) { *out++=0; neednull=0; } } } *out++=0; *out++=0; } static int in_string(TCHAR *string, TCHAR *substring) { if (!string) return 0; if (!*substring) return 1; int l=wcslen(substring); while (string[0]) if (!wcsnicmp(string++,substring,l)) return 1; return 0; } static void updateList(int win){ if(!m_hwnd) return; if (win==0) SetDlgItemText(m_hwnd,IDC_QUICKSEARCH2,path[win]); else SetDlgItemText(m_hwnd,IDC_QUICKSEARCH3,path[win]); closedown(m_hwnd); TCHAR filterstr[256],filteritems[300]; if (win==0) GetDlgItemText(m_hwnd,IDC_QUICKSEARCH,filterstr,sizeof(filterstr)-1); else GetDlgItemText(m_hwnd,IDC_QUICKSEARCH4,filterstr,sizeof(filterstr)-1); parsequicksearch(filteritems,filterstr); delete m_songs_sorted[win]; m_songs_sorted[win]=new C_ItemList; totallen[win]=0; totalsize[win]=0; folders[win]=0; files[win]=0; int filterlen=0,filterval=0,filtersize=0; bool playlist=false; //--------- for(int i=0;itype==7||s->type==8) playlist=true; TCHAR year[32]=L""; //if (s->year < 5000 && s->year > 0) wsprintf(year,L"%d",s->year); TCHAR *p=filteritems; bool count=true; if (*p){ while (*p){ // search for 'p' in the song if (!in_string(s->sortname,p)){ /*&& !in_string(s->artist,p) && !in_string(s->title,p) && !in_string(s->genre,p) && !in_string(year,p)*/ break;count=false;} p+=wcslen(p)+1; } if (*p) continue; } if (count){ if (s->from==-1) filterval++; if (s->from==-1) totallen[win]+=s->songlen; if (s->from==-1) totalsize[win]+=s->size; if (s->type==1) folders[win]++; if (s->type!=1&&s->type!=0&&s->from==-1) files[win]++; } m_songs_sorted[win]->Add((void *)s); } sortResults(win); writestatus(win); if (playlist){ SetWindowPos(GetDlgItem(m_hwnd, IDC_BUTTON5),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); //SetWindowPos(GetDlgItem(m_hwnd, IDC_BUTTON6),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(m_hwnd, IDC_BUTTON7),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(m_hwnd, IDC_BUTTON8),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); }else{ SetWindowPos(GetDlgItem(m_hwnd, IDC_BUTTON5),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); //SetWindowPos(GetDlgItem(m_hwnd, IDC_BUTTON6),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); SetWindowPos(GetDlgItem(m_hwnd, IDC_BUTTON7),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); SetWindowPos(GetDlgItem(m_hwnd, IDC_BUTTON8),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); } if (prevscroll>0){ /*ScrollInfo.fMask=SIF_PAGE|SIF_POS; int num=SetScrollInfo(m_list[0].m_hwnd,SB_VERT,&ScrollInfo,true);*/ ListView_Scroll(m_list[0].m_hwnd,0,(prevscroll+3)*20); prevscroll=0; } } static void writestatus(int win){ char tmp[512]; double ts=totalsize[win]/1000.0; sprintf(tmp,""); if (m_songs[win].GetSize() != m_songs_sorted[win]->GetSize()) sprintf(tmp,"Found: ",tmp); if (folders[win]>0) if (folders[win]==1) sprintf(tmp,"%s%d folder, ",tmp,folders[win]); else sprintf(tmp,"%s%d folders, ",tmp,folders[win]); sprintf(tmp,"%s%d",tmp,files[win]); if (showsongs&&showvids){ sprintf(tmp,"%s audio/video",tmp); }else{ if (showsongs) sprintf(tmp,"%s audio",tmp); if (showvids) sprintf(tmp,"%s video",tmp); } if (files[win]==1) sprintf(tmp,"%s file ",tmp,files[win]); else sprintf(tmp,"%s files ",tmp,files[win]); if (files[win]>0) sprintf(tmp,"%s(%.1lf MB)",tmp,ts); if (showlength&&files[win]>0&&totallen[win]>0) sprintf(tmp,"%s [%d:%02d:%02d]",tmp,totallen[win]/3600,(totallen[win]/60)%60,totallen[win]%60); if (!multiple) SetDlgItemTextA(m_hwnd,IDC_STATUS,tmp); else{ if (win==0) SetDlgItemTextA(m_hwnd,IDC_STATUS0,tmp); else SetDlgItemTextA(m_hwnd,IDC_STATUS1,tmp); } } TCHAR *temp; TCHAR *tempb; static int STRCMP_NULLOK(TCHAR *pa, TCHAR *pb) { if (!pa) pa=L""; else SKIP_THE_AND_WHITESPACE(pa) if (!pb) pb=L""; else SKIP_THE_AND_WHITESPACE(pb) temp=pa; tempb=pb; if (pa[0]==L'~'&&pb[0]!=L'~'){ return -1; } if (pa[0]!=L'~'&&pb[0]==L'~'){ return 1; } return wcsicmp(pa,pb); } static int sortFunc(const void *elem1, const void *elem2) { Song *a=(Song *)*(void **)elem1; Song *b=(Song *)*(void **)elem2; int use_by=g_sortcol; int use_dir=g_sortdir; //Return if not equal: #define RETIFNZ(v) if ((v)<0) return use_dir?1:-1; if ((v)>0) return use_dir?-1:1; #define RETIFNZNOSORTTYPE(v) if ((v)<0) return -1; if ((v)>0) return 1; int x; //Positions if (wcscmp(a->sortname,b->sortname)==0){ if (a->from!=-1&&b->from!=-1) return (a->from)-(b->from); if (a->from==-1&&b->from!=-1) return -1; if (a->from!=-1&&b->from==-1) return 1; } if (sortpl){//playlist items first time if (a->numbernumber) return -1; else return 1; } if (a->from!=-1) a=a->parent; if (b->from!=-1) b=b->parent; //not positions for (x = 0; x < 3; x ++){ if (use_by >-1) { int v1=a->type; int v2=b->type; if (v1<0)v1=0; if (v2<0)v2=0; if (g_sortcol==COL_RATING){ RETIFNZNOSORTTYPE(v1-v2) }else RETIFNZ(v1-v2) use_by=use_by-15; } else if (use_by == COL_FILENAME-15){//COL_NAME int v=STRCMP_NULLOK(a->sortname,b->sortname); RETIFNZ(v) } else if (use_by == COL_LENGTH-15){//COL_LENGTH int v1=a->songlen; int v2=b->songlen; if (v1<0)v1=0; if (v2<0)v2=0; RETIFNZ(v1-v2) }else if (use_by == COL_SIZE-15){//COL_SIZE int v1=a->size; int v2=b->size; if (v1<0) v1=0; if (v2<0) v2=0; RETIFNZ(v1-v2) }else if (use_by == COL_RATING-15){//COL_RATING int v1,v2; if (a->stats) v1=a->stats->rating; else{ v1=-1; if (a->from!=-1&&a->parent->stats) v1=a->parent->stats->rating; } if (b->stats) v2=b->stats->rating; else { v2=-1; if (b->from!=-1&&b->parent->stats) v2=b->parent->stats->rating; } RETIFNZ(v1-v2) use_by = COL_CREATED-15; }else if (use_by == COL_NUMBER-15){//COL_NUMBER int v1=a->number; int v2=b->number; if (v1<0) return use_dir?-1:1; if (v2<0) return use_dir?1:-1; RETIFNZ(v1-v2) use_by = COL_CREATED-15; }else if (use_by == COL_YEAR-15){//COL_YEAR int v1=a->year; int v2=b->year; if (v1<0) return use_dir?-1:1; if (v2<0) return use_dir?1:-1; RETIFNZ(v1-v2) use_by = COL_CREATED-15; }else if (use_by == COL_CREATED-15){//COL_CREATED int v=CompareFileTime(&a->created, &b->created); RETIFNZ(v); } else break; // no sort order } #undef RETIFNZ #undef RETIFNZNOSORTTYPE return 0; } TCHAR* toselect=NULL;//select file after loading bool donotload=false;//don't load after tree clicked void sortResults(int win){ if (!m_songs_sorted[win]) return; qsort(m_songs_sorted[win]->GetAll(),m_songs_sorted[win]->GetSize(),sizeof(void*),sortFunc); for(int i=0;iGetSize();i++){//list positions Song *s=(Song *)(m_songs_sorted[win]->Get(i)); s->listpos=i; } ListView_SetItemCount(m_list[win].getwnd(),0); ListView_SetItemCount(m_list[win].getwnd(),m_songs_sorted[win]->GetSize()); ListView_RedrawItems(m_list[win].getwnd(),0,m_songs_sorted[win]->GetSize()-1); if (toselect!=NULL){ for(int i=0;iGetSize();i++){ Song *s=(Song *)(m_songs_sorted[win]->Get(i)); if (wcscmp(toselect,s->filepath)==0&&s->from==-1){ m_list[win].SetSelected(i,true); break; } } } ListView_RedrawItems(m_list[win].getwnd(),0,m_songs_sorted[win]->GetSize()-1); toselect=NULL; } bool notchanging[2];//for quickserach //-------- void openpath(TCHAR* ph,int win){//opens files path and selects file TCHAR* pth=_wcsdup(ph); int l=-1;; for (int i=0;i0&&win==0){ if (pclicked<=numofdevices){ pathsfordrives.uj(dnames[pclicked-1].path,_wcsdup(path[win])); }else{ pathsfordrives.uj(realmaps[pclicked-1-numofdevices].path,_wcsdup(path[win])); } } toselect=pth; notchanging[win]=true; DWORD dwThread; CreateThread(0,0,WFL,(void*)win,0,&dwThread); } DWORD WINAPI WFL(LPVOID lpParameter){ int i=0; while (!m_hwnd&&i<20){ Sleep(100); i++; } SetDlgItemText(m_hwnd,IDC_QUICKSEARCH,L""); loadSongList((int)lpParameter); return 0; } //-------- int alsocsik=0; int alsonum=0; void closedown(HWND hwndDlg){ if (alsocsik!=0){ alsocsik=0; if (multiple==0)SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST),NULL,0,0,wwidth,wheight-45,SWP_NOMOVE); else if (multiple==1) { SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST),NULL,0,0,wwidth/2-1,wheight-35,SWP_NOMOVE); SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST2),NULL,0,0,wwidth/2,wheight-35,SWP_NOMOVE); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC10),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); } else if (multiple==2) { SetWindowPos(GetDlgItem(hwndDlg,IDC_LIST2),HWND_TOP,0,wheight/2+20,wwidth,wheight/2-40,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_STATUS1),HWND_TOP,2,wheight-15,wwidth-40,12,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC10),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); } SetWindowPos(GetDlgItem(hwndDlg, IDC_GPB3),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC4),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC5),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_BUTTON1),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_BUTTON2),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_BUTTON3),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_EDIT1),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC6),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC7),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC8),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_EDIT2),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_EDIT3),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_EDIT4),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); } } //-------- TCHAR tmpbuf[128]; static BOOL CALLBACK dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) { if (wad_handleDialogMsgs) { BOOL a=wad_handleDialogMsgs(hwndDlg,uMsg,wParam,lParam); if (a) return a; } LPNMHDR lk; switch (uMsg){ case WM_DISPLAYCHANGE: ListView_SetTextColor(m_list[0].getwnd(),wad_getColor?wad_getColor(WADLG_ITEMFG):RGB(0xff,0xff,0xff)); ListView_SetBkColor(m_list[0].getwnd(),wad_getColor?wad_getColor(WADLG_ITEMBG):RGB(0x00,0x00,0x00)); ListView_SetTextBkColor(m_list[0].getwnd(),wad_getColor?wad_getColor(WADLG_ITEMBG):RGB(0x00,0x00,0x00)); m_list[0].refreshFont(); if (multiple){ ListView_SetTextColor(m_list[1].getwnd(),wad_getColor?wad_getColor(WADLG_ITEMFG):RGB(0xff,0xff,0xff)); ListView_SetBkColor(m_list[1].getwnd(),wad_getColor?wad_getColor(WADLG_ITEMBG):RGB(0x00,0x00,0x00)); ListView_SetTextBkColor(m_list[1].getwnd(),wad_getColor?wad_getColor(WADLG_ITEMBG):RGB(0x00,0x00,0x00)); m_list[1].refreshFont(); } return 0; case WM_INITDIALOG:{ m_hwnd=hwndDlg; *(void **)&wad_getColor=(void*)SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,1,ML_IPC_SKIN_WADLG_GETFUNC); *(void **)&wad_handleDialogMsgs=(void*)SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,2,ML_IPC_SKIN_WADLG_GETFUNC); *(void **)&wad_DrawChildWindowBorders=(void*)SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,3,ML_IPC_SKIN_WADLG_GETFUNC); *(void **)&cr_init=(void*)SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,32,ML_IPC_SKIN_WADLG_GETFUNC); *(void **)&cr_resize=(void*)SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,33,ML_IPC_SKIN_WADLG_GETFUNC); if (cr_init) cr_init(hwndDlg,resize_rlist,sizeof(resize_rlist)/sizeof(resize_rlist[0])); if (cr_init) cr_init(hwndDlg,resize_rlist3,sizeof(resize_rlist3)/sizeof(resize_rlist3[0])); m_list[0].setLibraryParentWnd(plugin.hwndLibraryParent); m_list[0].setwnd(GetDlgItem(hwndDlg,IDC_LIST)); if (multiple){ m_list[1].setLibraryParentWnd(plugin.hwndLibraryParent); m_list[1].setwnd(GetDlgItem(hwndDlg,IDC_LIST2)); } //icons //SHFILEINFO ssfi; //hsl = (HIMAGELIST)SHGetFileInfo(L"C:\\",0,&ssfi,sizeof(SHFILEINFO),SHGFI_SYSICONINDEX | SHGFI_SMALLICON); // initicons(); //int ic=ImageList_GetImageCount(hsl); //if (ic<4){initicons();} if (hsl){ ListView_SetImageList(m_list[0].getwnd(), hsl, LVSIL_NORMAL); ListView_SetImageList(m_list[0].getwnd(), hsl, LVSIL_SMALL); } m_list[0].refreshFont(); ListView_SetTextColor(m_list[0].getwnd(),wad_getColor?wad_getColor(WADLG_ITEMFG):RGB(0xff,0xff,0xff)); ListView_SetBkColor(m_list[0].getwnd(),wad_getColor?wad_getColor(WADLG_ITEMBG):RGB(0x00,0x00,0x00)); ListView_SetTextBkColor(m_list[0].getwnd(),wad_getColor?wad_getColor(WADLG_ITEMBG):RGB(0x00,0x00,0x00)); m_skinlistview_handle[0]=SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(int)m_list[0].getwnd(),ML_IPC_SKIN_LISTVIEW); LV_SKIN_SHOWSORT ls; ls.listView=(int)m_list[0].getwnd(); ls.showSort=true; SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&ls,ML_IPC_LISTVIEW_SHOWSORT); if (showtitle) m_list[0].AddCol(getcname(0),cwids[0]); else m_list[0].AddCol(getcname(0),cwids[0]); if (g_sortcol==COL_FILENAME) SetColIcon(m_list[0].m_hwnd,0,g_sortdir); int colnum=1; if (shownumber){ m_list[0].AddCol(getcname(colnum),cwids[colnum]);colnum++;if (g_sortcol==COL_NUMBER)SetColIcon(m_list[0].m_hwnd,colnum-1,g_sortdir);} if (showsize){ m_list[0].AddCol(getcname(colnum),cwids[colnum]);colnum++;if (g_sortcol==COL_SIZE)SetColIcon(m_list[0].m_hwnd,colnum-1,g_sortdir);} if (showlength){ m_list[0].AddCol(getcname(colnum),cwids[colnum]);colnum++;if (g_sortcol==COL_LENGTH)SetColIcon(m_list[0].m_hwnd,colnum-1,g_sortdir);} if (showbitrate){ m_list[0].AddCol(getcname(colnum),cwids[colnum]);colnum++;} if (showalbum){ m_list[0].AddCol(getcname(colnum),cwids[colnum]);colnum++;} if (showyear){ m_list[0].AddCol(getcname(colnum),cwids[colnum]);colnum++;if (g_sortcol==COL_YEAR)SetColIcon(m_list[0].m_hwnd,colnum-1,g_sortdir);} if (showgenre){ m_list[0].AddCol(getcname(colnum),cwids[colnum]);colnum++;} if (showcreated){ m_list[0].AddCol(getcname(colnum),cwids[colnum]);colnum++;if (g_sortcol==COL_CREATED)SetColIcon(m_list[0].m_hwnd,colnum-1,g_sortdir);} if (MYTOP&&showpcount){ m_list[0].AddCol(getcname(colnum),cwids[colnum]);colnum++;} if (MYTOP&&showplength){ m_list[0].AddCol(getcname(colnum),cwids[colnum]);colnum++;} if (MYTOP&&showlastp){ m_list[0].AddCol(getcname(colnum),cwids[colnum]);colnum++;} if (MYTOP&&showfirstp){ m_list[0].AddCol(getcname(colnum),cwids[colnum]);colnum++;} if (multiple){ colnum=1; ListView_SetImageList(m_list[1].getwnd(), hsl, LVSIL_NORMAL); ListView_SetImageList(m_list[1].getwnd(), hsl, LVSIL_SMALL); m_list[1].refreshFont(); ListView_SetTextColor(m_list[1].getwnd(),wad_getColor?wad_getColor(WADLG_ITEMFG):RGB(0xff,0xff,0xff)); ListView_SetBkColor(m_list[1].getwnd(),wad_getColor?wad_getColor(WADLG_ITEMBG):RGB(0x00,0x00,0x00)); ListView_SetTextBkColor(m_list[1].getwnd(),wad_getColor?wad_getColor(WADLG_ITEMBG):RGB(0x00,0x00,0x00)); m_skinlistview_handle[1]=SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(int)m_list[1].getwnd(),ML_IPC_SKIN_LISTVIEW); LV_SKIN_SHOWSORT ls; ls.listView=(int)m_list[0].getwnd(); ls.showSort=true; SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&ls,ML_IPC_LISTVIEW_SHOWSORT); if (showtitle) m_list[1].AddCol(getcname(0),cwids[0]); else m_list[1].AddCol(getcname(0),cwids[0]); if (g_sortcol==COL_FILENAME) SetColIcon(m_list[1].m_hwnd,0,g_sortdir); int colnum=1; if (shownumber){ m_list[1].AddCol(getcname(colnum),cwids[colnum]);colnum++;if (g_sortcol==COL_NUMBER)SetColIcon(m_list[1].m_hwnd,colnum-1,g_sortdir);} if (showsize){ m_list[1].AddCol(getcname(colnum),cwids[colnum]);colnum++;if (g_sortcol==COL_SIZE)SetColIcon(m_list[1].m_hwnd,colnum-1,g_sortdir);} if (showlength){ m_list[1].AddCol(getcname(colnum),cwids[colnum]);colnum++;if (g_sortcol==COL_LENGTH)SetColIcon(m_list[1].m_hwnd,colnum-1,g_sortdir);} if (showbitrate){ m_list[1].AddCol(getcname(colnum),cwids[colnum]);colnum++;} if (showalbum){ m_list[1].AddCol(getcname(colnum),cwids[colnum]);colnum++;} if (showyear){ m_list[1].AddCol(getcname(colnum),cwids[colnum]);colnum++;if (g_sortcol==COL_YEAR)SetColIcon(m_list[1].m_hwnd,colnum-1,g_sortdir);} if (showgenre){ m_list[1].AddCol(getcname(colnum),cwids[colnum]);colnum++;} if (showcreated){ m_list[1].AddCol(getcname(colnum),cwids[colnum]);colnum++;if (g_sortcol==COL_CREATED)SetColIcon(m_list[1].m_hwnd,colnum-1,g_sortdir);} if (MYTOP&&showpcount){ m_list[1].AddCol(getcname(colnum),cwids[colnum]);colnum++;} if (MYTOP&&showplength){ m_list[1].AddCol(getcname(colnum),cwids[colnum]);colnum++;} if (MYTOP&&showlastp){ m_list[1].AddCol(getcname(colnum),cwids[colnum]);colnum++;} if (MYTOP&&showfirstp){ m_list[1].AddCol(getcname(colnum),cwids[colnum]);colnum++;} } SetTimer(hwndDlg,32,5,NULL); return 0;} case WM_NOTIFY: { LPNMHDR l=(LPNMHDR)lParam; if (l->idFrom==IDC_LIST||l->idFrom==IDC_LIST2) { int win=0; if (l->idFrom==IDC_LIST2) win=1; switch (l->code){ case LVN_GETDISPINFO: { NMLVDISPINFO *lpdi = (NMLVDISPINFO*) lParam; int item=lpdi->item.iItem; if (item < 0 || item >= m_songs_sorted[win]->GetSize()) return 0; Song *thissong = (Song *)m_songs_sorted[win]->Get(item); if (lpdi->item.mask & (LVIF_NORECOMPUTE)) return 0; if (lpdi->item.mask==1) return 0; if (lpdi->item.mask & (LVIF_IMAGE)) // we can always do images too :) { lpdi->item.iImage=thissong->iconindex; } if (lpdi->item.mask & (LVIF_TEXT)) // we can always do images too :) { //TCHAR tmpbuf[128]; tmpbuf[0]=L'\0'; TCHAR *nameptr=0; switch (cids[lpdi->item.iSubItem]){ case COL_LENGTH: if (thissong->songlen>0&&thissong->from==-1){ wsprintf(tmpbuf,L"%d:%02d",thissong->songlen/60,(thissong->songlen)%60); nameptr=tmpbuf; }else{nameptr=_wcsdup(L"");} break; case COL_FILENAME: nameptr=thissong->filetitle; break; case COL_GENRE: nameptr=thissong->genre; break; case COL_ALBUM: nameptr=thissong->album; break; case COL_NUMBER: if ((thissong->type==3||thissong->type==4||thissong->type==7||thissong->type==8)&&thissong->number!=-1&&thissong->from==-1){ wsprintf(tmpbuf,L"%d",thissong->number); nameptr=tmpbuf; }else{nameptr=_wcsdup(L"");} break; case COL_YEAR: if ((thissong->type==3||thissong->type==4||thissong->type==7)&&thissong->year!=-1&&thissong->from==-1){ wsprintf(tmpbuf,L"%d",thissong->year); nameptr=tmpbuf; }else{nameptr=_wcsdup(L"");} break; case COL_BITRATE: if ((thissong->type==3||thissong->type==4||thissong->type==7)&&thissong->bitrate!=-1&&thissong->from==-1){ wsprintf(tmpbuf,L"%d",thissong->bitrate); nameptr=tmpbuf; }else{nameptr=_wcsdup(L"");} break; case COL_SIZE: if ((thissong->type==2||thissong->type==3||thissong->type==4||thissong->type==7)&&thissong->from==-1){ wsprintf(tmpbuf,L"%d",thissong->size); nameptr=tmpbuf; }else{nameptr=_wcsdup(L"");} break; case COL_CREATED: if (thissong->type!=0&&thissong->from==-1&&thissong->type!=8){ _SYSTEMTIME* stime=new _SYSTEMTIME; try { FileTimeToSystemTime(&thissong->created,stime); nameptr=(TCHAR *)malloc(sizeof(TCHAR)*128); wsprintf(nameptr,L"%02d/%02d/%d %02d:%02d",stime->wMonth, stime->wDay, stime->wYear,stime->wHour, stime->wMinute); delete stime; }catch(...){} }else nameptr=_wcsdup(L""); break; case COL_PCOUNT: if (MYTOP&&thissong->stats&&(thissong->type==3||thissong->type==4||thissong->type==7||thissong->type==8)){ wsprintf(tmpbuf,L"%d",thissong->stats->playcount); nameptr=tmpbuf; }else{nameptr=_wcsdup(L"");} break; case COL_PLENGTH: if (MYTOP&&thissong->stats&&(thissong->type==3||thissong->type==4||thissong->type==7||thissong->type==8)){ wsprintf(tmpbuf,L"%d:%02d",thissong->stats->playlength/60,(thissong->stats->playlength)%60); nameptr=tmpbuf; }else{nameptr=_wcsdup(L"");} break; case COL_FPLAYED: if (MYTOP&&thissong->stats&&(thissong->type==2||thissong->type==3||thissong->type==4||thissong->type==7||thissong->type==8)){ _SYSTEMTIME* stime=(_SYSTEMTIME*)malloc(sizeof(_SYSTEMTIME)); try { FileTimeToSystemTime(&thissong->stats->firstplayed,stime); nameptr=(TCHAR *)malloc(sizeof(TCHAR)*128); wsprintf(nameptr,L"%02d/%02d/%d %02d:%02d",stime->wMonth, stime->wDay, stime->wYear,stime->wHour, stime->wMinute); }catch(...) {}free(stime); }else nameptr=_wcsdup(L""); break; case COL_LPLAYED: if (MYTOP&&thissong->stats&&(thissong->type==2||thissong->type==3||thissong->type==4||thissong->type==7||thissong->type==8)){ _SYSTEMTIME* stime=(_SYSTEMTIME*)malloc(sizeof(_SYSTEMTIME)); try { FileTimeToSystemTime(&thissong->stats->lastplayed,stime); nameptr=(TCHAR *)malloc(sizeof(TCHAR)*128); wsprintf(nameptr,L"%02d/%02d/%d %02d:%02d",stime->wMonth, stime->wDay, stime->wYear,stime->wHour, stime->wMinute); }catch(...) {}free(stime); }else nameptr=_wcsdup(L""); break; } if (nameptr) lstrcpyn(lpdi->item.pszText,nameptr,lpdi->item.cchTextMax); else lpdi->item.pszText[0]=0; } return 0; } break; case LVN_KEYDOWN:{//KEY PRESSED short control=GetAsyncKeyState(VK_CONTROL); LPNMLVKEYDOWN pnkd = (LPNMLVKEYDOWN) lParam; if (pnkd->wVKey==0x41&&(control&0x8000)){//ctrl+a C_ItemList *list=(C_ItemList *)(m_songs_sorted[win]); if (!list) { list=&(m_songs[win]); } int l=list->GetSize(); for (int x = 0 ; x < l; x ++){ Song* ss=(Song*)list->Get(x); if (ss->type!=0&&ss->from==-1) m_list[win].SetSelected(x,true); else m_list[win].SetSelected(x,false); } } }break; case NM_DBLCLK://DOUBLE CLICK { C_ItemList *list=(C_ItemList *)(m_songs_sorted[win]); if (!list) { list=&(m_songs[win]); } int x,l=list->GetSize(); Song *s=NULL; for (x = 0 ; x < l; x ++) { if (m_list[win].GetSelected(x)) s=(Song *)list->Get(x); } if (!s) return 0; switch (s->type){ case 2:{ ShellExecute(NULL, NULL, s->filepath, NULL, NULL, SW_SHOW); }break; case 7: case 8: case 5: case 4: case 3:{ playFiles(dca,0,win); }break; case 1: //folder //path[win]=new TCHAR[wcslen(s->filepath)+2]; path[win][0]=0; wcscat(path[win],s->filepath); wcscat(path[win],L"\\"); #ifdef DEBUGIT _ASSERTE( _CrtCheckMemory( ) ); #endif if (pclicked>0&&win==0){ if (pclicked<=numofdevices){ pathsfordrives.uj(dnames[pclicked-1].path,_wcsdup(path[win])); }else{ pathsfordrives.uj(realmaps[pclicked-1-numofdevices].path,_wcsdup(path[win])); } } notchanging[win]=true; if (win==0) SetDlgItemText(hwndDlg,IDC_QUICKSEARCH,L""); else SetDlgItemText(hwndDlg,IDC_QUICKSEARCH4,L""); loadSongList(win); break; case 0:{ //upper folder TCHAR *last=wcsrchr(path[win],L'\\'); short alen=wcslen(path[win]); short llen=wcslen(last); if (alen>3){ TCHAR uj[MAX_PATH]; wcsncpy(uj,path[win],wcslen(path[win])-wcslen(last)); last=wcsrchr(uj,L'\\'); int i=0; while (1){ if ((uj+i)>last){ *(uj+i)=0; break; } i++; } path[win][0]=0; wcscpy(path[win],uj); } if (pclicked>0&&win==0){ if (pclicked<=numofdevices){ pathsfordrives.uj(dnames[pclicked-1].path,_wcsdup(path[win])); }else{ pathsfordrives.uj(realmaps[pclicked-1-numofdevices].path,_wcsdup(path[win])); } } notchanging[win]=true; SetDlgItemText(hwndDlg,IDC_QUICKSEARCH,L""); loadSongList(win); }break; case 6:{ //playlist //path[win]=new TCHAR[wcslen(s->filepath)+2]; path[win][0]=0; wcscat(path[win],s->filepath); //wcscat(path[win],L"\\"); #ifdef DEBUGIT _ASSERTE( _CrtCheckMemory( ) ); #endif if (pclicked>0&&win==0){ if (pclicked<=numofdevices){ pathsfordrives.uj(dnames[pclicked-1].path,_wcsdup(path[win])); }else{ pathsfordrives.uj(realmaps[pclicked-1-numofdevices].path,_wcsdup(path[win])); } } notchanging[win]=true; if (win==0) SetDlgItemText(hwndDlg,IDC_QUICKSEARCH,L""); else SetDlgItemText(hwndDlg,IDC_QUICKSEARCH4,L""); loadSongList(win); break; }break; } } break; case NM_CLICK://left clcik { }break; case NM_RCLICK://right click { POINT p; int r; GetCursorPos(&p); C_ItemList *list=(C_ItemList *)m_songs_sorted[win]; if (!list) {list=&m_songs[win];} int x,l=list->GetSize(); int dab=0; for (x = 0 ; x < l; x ++){ if (m_list[win].GetSelected(x)) dab++; } if (dab==0){//none selected if (isplaylist(path[win])) return 0; r=TrackPopupMenu(GetSubMenu(m_context_menus,6),TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON|TPM_NONOTIFY,p.x,p.y,0,m_hwnd,NULL); switch (r){ case ID_TC_NEWFOLDER:{ closedown(hwndDlg); SetDlgItemText(hwndDlg,IDC_EDIT1,L""); SetDlgItemText(hwndDlg,IDC_STATIC4,L"New Folder"); if (multiple==0) SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST),NULL,0,0,wwidth,wheight-95,SWP_NOMOVE); else if (multiple==1){ SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST),NULL,0,0,wwidth/2-1,wheight-95,SWP_NOMOVE); SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST2),NULL,0,0,wwidth/2,wheight-95,SWP_NOMOVE); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC10),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); }else if (multiple==2){ SetWindowPos(GetDlgItem(hwndDlg,IDC_LIST2),HWND_TOP,0,wheight/2+20,wwidth,wheight/2-105,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_STATUS1),HWND_TOP,2,wheight-85,wwidth-60,12,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC10),HWND_TOP,0,wheight-71,wwidth,2,SWP_NOZORDER|SWP_SHOWWINDOW); } SetWindowPos(GetDlgItem(hwndDlg, IDC_GPB3),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC4),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC5),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_BUTTON1),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_BUTTON2),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_EDIT1),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); if (!multiple) SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST),NULL,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); if (multiple){ SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST),NULL,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST2),NULL,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); } alsocsik=1; alsonum=win; }break; } return 0; } Song** songs=(Song **)malloc(dab*sizeof(Song*)); dab=0; for (x = 0 ; x < l; x ++) { if (m_list[win].GetSelected(x)){ songs[dab]=(Song *)list->Get(x); dab++; } } if (dab==1){//if 1 is selected if (songs[0]->type==0) break; else if (songs[0]->type==1) r=TrackPopupMenu(GetSubMenu(m_context_menus,2),TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON|TPM_NONOTIFY,p.x,p.y,0,m_hwnd,NULL); else if (songs[0]->type==2) r=TrackPopupMenu(GetSubMenu(m_context_menus,5),TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON|TPM_NONOTIFY,p.x,p.y,0,m_hwnd,NULL); else if (songs[0]->type==3||songs[0]->type==4||songs[0]->type==5){ if (songs[0]->from==-1){ r=TrackPopupMenu(GetSubMenu(m_context_menus,4),TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON|TPM_NONOTIFY,p.x,p.y,0,m_hwnd,NULL); }else r=TrackPopupMenu(GetSubMenu(m_context_menus,7),TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON|TPM_NONOTIFY,p.x,p.y,0,m_hwnd,NULL); } else if (songs[0]->type==6) r=TrackPopupMenu(GetSubMenu(m_context_menus,8),TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON|TPM_NONOTIFY,p.x,p.y,0,m_hwnd,NULL); else if (songs[0]->type==7) r=TrackPopupMenu(GetSubMenu(m_context_menus,10),TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON|TPM_NONOTIFY,p.x,p.y,0,m_hwnd,NULL); else if (songs[0]->type==8) r=TrackPopupMenu(GetSubMenu(m_context_menus,11),TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON|TPM_NONOTIFY,p.x,p.y,0,m_hwnd,NULL); }else{ if (songs[0]->type==7||songs[0]->type==8) r=TrackPopupMenu(GetSubMenu(m_context_menus,9),TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON|TPM_NONOTIFY,p.x,p.y,0,m_hwnd,NULL); else r=TrackPopupMenu(GetSubMenu(m_context_menus,1),TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON|TPM_NONOTIFY,p.x,p.y,0,m_hwnd,NULL); } switch (r){ case ID_PLAY:{ playFiles(0,0,win); }break; case ID_ENQUEUE:{ if (dca==2) playFiles(2,0,win); else playFiles(1,0,win); }break; case ID_DELETE: /*ScrollInfo.cbSize=sizeof(SCROLLINFO); ScrollInfo.fMask=SIF_PAGE|SIF_POS|SIF_RANGE|SIF_TRACKPOS; GetScrollInfo(m_list[0].m_hwnd,SB_VERT,&ScrollInfo);*/ prevscroll=GetScrollPos(m_list[0].m_hwnd,SB_VERT); delFiles(win); break; case ID_MAP: case ID_TREEITEMCONTEXT_MAPPLAYLIST: toadd=new TCHAR[wcslen(songs[0]->filepath)+1]; wcscpy(toadd,songs[0]->filepath); if (!mapeditorHWND) ShowWindow((mapeditorHWND=CreateDialog(plugin.hDllInstance,MAKEINTRESOURCE(IDD_MAPDIALOG),hwndDlg,mapeditor_dlgproc)),SW_SHOW); else{ ShowWindow(mapeditorHWND,SW_RESTORE);SetActiveWindow(mapeditorHWND); mapeditor_dlgproc(mapeditorHWND,WM_INITDIALOG,0,0); } break; break; case ID_INFO:{ infoBoxParamW* vv=new infoBoxParamW; vv->parent=plugin.hwndWinampParent; vv->filename=songs[0]->filepath; SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)vv,IPC_INFOBOXW); free(vv); }break; case ID_OPEN:{ ShellExecute(NULL, NULL, songs[0]->filepath, NULL, NULL, SW_SHOW); }break; case ID_RENAME:{ prevscroll=GetScrollPos(m_list[0].m_hwnd,SB_VERT); renameFiles(win); }break; case ID_RENAMEF:{ closedown(hwndDlg); SetDlgItemText(hwndDlg,IDC_EDIT1,wcsrchr(songs[0]->filepath+1,L'\\')+1); SetDlgItemText(hwndDlg,IDC_STATIC4,L"Rename file"); if (multiple==0) SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST),NULL,0,0,wwidth,wheight-95,SWP_NOMOVE); else if (multiple==1){ SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST),NULL,0,0,wwidth/2-1,wheight-95,SWP_NOMOVE); SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST2),NULL,0,0,wwidth/2,wheight-95,SWP_NOMOVE); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC10),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); }else if (multiple==2){ SetWindowPos(GetDlgItem(hwndDlg,IDC_LIST2),HWND_TOP,0,wheight/2+20,wwidth,wheight/2-105,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_STATUS1),HWND_TOP,2,wheight-85,wwidth-60,12,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC10),HWND_TOP,0,wheight-71,wwidth,2,SWP_NOZORDER|SWP_SHOWWINDOW); } SetWindowPos(GetDlgItem(hwndDlg, IDC_GPB3),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC4),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC5),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_BUTTON1),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_BUTTON2),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_EDIT1),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); if (!multiple) SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST),NULL,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); if (multiple){ SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST),NULL,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST2),NULL,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); } alsocsik=2; alsonum=win; }break; case ID_TREEITEMCONTEXT_ADDPOSITION:{ closedown(hwndDlg); SetDlgItemText(hwndDlg,IDC_STATIC4,L"Add new position"); SetDlgItemText(hwndDlg,IDC_EDIT2,L"0"); SetDlgItemText(hwndDlg,IDC_EDIT3,L"00"); SetDlgItemText(hwndDlg,IDC_EDIT4,L"Name"); if (multiple==0) SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST),NULL,0,0,wwidth,wheight-95,SWP_NOMOVE); else if (multiple==1){ SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST),NULL,0,0,wwidth/2-1,wheight-95,SWP_NOMOVE); SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST2),NULL,0,0,wwidth/2,wheight-95,SWP_NOMOVE); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC10),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); }else if (multiple==2){ SetWindowPos(GetDlgItem(hwndDlg,IDC_LIST2),HWND_TOP,0,wheight/2+20,wwidth,wheight/2-105,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_STATUS1),HWND_TOP,2,wheight-85,wwidth-60,12,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC10),HWND_TOP,0,wheight-71,wwidth,2,SWP_NOZORDER|SWP_SHOWWINDOW); } SetWindowPos(GetDlgItem(hwndDlg, IDC_GPB3),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC4),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC6),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC7),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC8),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_BUTTON1),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_BUTTON2),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_BUTTON3),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_EDIT2),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_EDIT3),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_EDIT4),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); if (!multiple) SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST),NULL,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); if (multiple){ SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST),NULL,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST2),NULL,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); } alsocsik=3; alsonum=win; addingsong=songs[0]; //extendedFileInfoStructW efs; // TCHAR* value=new TCHAR[50]; // value[0]='\0'; // value=_wcsdup(L"mycomment :)"); // efs.filename=songs[0]->filepath; // efs.metadata=L"comment"; // efs.ret=value; // efs.retlen=50; // SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)&efs,IPC_SET_EXTENDED_FILE_INFOW); // SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)&efs,IPC_SET_EXTENDED_FILE_INFOW); // value[0]='\0'; // SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)&efs,IPC_GET_EXTENDED_FILE_INFOW); // value[0]='\0'; }break; case ID_TREEITEMCONTEXT_DELETEPOSITION:{ hashvalue* hv=pts.hashkeres(songs[0]->filepath+3); if (hv!=NULL){ TCHAR* uj=new TCHAR[400]; uj[0]=0; TCHAR *token; token = wcstok(hv->ertek, L"|" ); // C4996 while( token != NULL ){ int cf=_ttoi(token); token = wcstok(NULL, L"|" ); if (cf!=(songs[0]->from)){ if (wcslen(uj)) wcscat(uj,L"|"); wsprintf(uj,L"%s%d|%s",uj,cf,token); } token = wcstok(NULL, L"|" ); } delete[] hv->ertek; pts.torol(songs[0]->filepath+3); partschanged=true; if (wcslen(uj)>0) pts.uj(songs[0]->filepath+3,uj); } loadSongList(0); if (multiple) loadSongList(1); }break; case ID_TREEITEMCONTEXT_OPENPL:{ //path[win]=new TCHAR[wcslen(songs[0]->filepath)+2]; path[win][0]=0; wcscat(path[win],songs[0]->filepath); //wcscat(path[win],L"\\"); #ifdef DEBUGIT _ASSERTE( _CrtCheckMemory( ) ); #endif if (pclicked>0&&win==0){ if (pclicked<=numofdevices){ pathsfordrives.uj(dnames[pclicked-1].path,_wcsdup(path[win])); }else{ pathsfordrives.uj(realmaps[pclicked-1-numofdevices].path,_wcsdup(path[win])); } } notchanging[win]=true; if (win==0) SetDlgItemText(hwndDlg,IDC_QUICKSEARCH,L""); else SetDlgItemText(hwndDlg,IDC_QUICKSEARCH4,L""); loadSongList(win); break; }break; case ID_CLFROMLIST:{ }break; case ID_TREEITEMCONTEXT_OPENCONTAININGFOLDER:{ openpath(songs[0]->filepath,win); }break; } }break; case LVN_BEGINDRAG: case LVN_BEGINRDRAG: { SetCapture(hwndDlg); capturefrom=win; tooo[0]==-1; tooo[1]==-1; if (multiple){ for (int i=0;icode == LVN_ODFINDITEM) // yay we find an item (for kb shortcuts) //{ // NMLVFINDITEM *t = (NMLVFINDITEM *)lParam; // int i=t->iStart; // if (i >= m_songs_sorted[win]->GetSize()) i=0; // int cnt=m_songs_sorted[win]->GetSize()-i; // if (t->lvfi.flags & LVFI_WRAP) cnt+=i; // while (cnt-->0) // { // Song *thissong = (Song *)m_songs_sorted[win]->Get(i); // TCHAR tmp[128]; // TCHAR *name=0; // switch (cids[g_sortcol]) // { // case COL_LENGTH: // wsprintf(tmp,L"%d:%02d",thissong->songlen/60,(thissong->songlen)%60); name=tmp; // break; // case COL_FILENAME: name=thissong->filetitle; break; // } // if (!name) name=L""; // else SKIP_THE_AND_WHITESPACE(name) // if (t->lvfi.flags & (4|LVFI_PARTIAL)) // { // if (!wcsnicmp(name,t->lvfi.psz,wcslen(t->lvfi.psz))){ // SetWindowLong(hwndDlg,DWL_MSGRESULT,i); // return 1;} // } // else if (t->lvfi.flags & LVFI_STRING){ // if (!wcsicmp(name,t->lvfi.psz)){ // SetWindowLong(hwndDlg,DWL_MSGRESULT,i); // return 1;} // }else{ // SetWindowLong(hwndDlg,DWL_MSGRESULT,-1); // return 1; // } // if (++i == m_songs_sorted[win]->GetSize()) i=0; // } // SetWindowLong(hwndDlg,DWL_MSGRESULT,-1); // return 1; //} case LVN_COLUMNCLICK: { sortpl=false; NMLISTVIEW *p=(NMLISTVIEW*)lParam; if (cids[p->iSubItem]==COL_FILENAME||cids[p->iSubItem]==COL_SIZE||cids[p->iSubItem]==COL_LENGTH||cids[p->iSubItem]==COL_YEAR||cids[p->iSubItem]==COL_NUMBER||cids[p->iSubItem]==COL_CREATED){ if (cids[p->iSubItem] == g_sortcol) { g_sortdir=!g_sortdir; SetColIcon(m_list[0].m_hwnd,p->iSubItem,g_sortdir); if (multiple) SetColIcon(m_list[1].m_hwnd,p->iSubItem,g_sortdir); }else{ int voltgs=getcolnumber(g_sortcol); g_sortcol=cids[p->iSubItem]; SetColIcon(m_list[win].m_hwnd,voltgs,0); SetColIcon(m_list[0].m_hwnd,p->iSubItem,g_sortdir); if (multiple) SetColIcon(m_list[1].m_hwnd,p->iSubItem,g_sortdir); } sortResults(0); if (multiple) sortResults(1); }else{ //int ret=GetScrollPos(m_list[0].m_hwnd,SB_VERT); ListView_SetItemText( m_list[0].m_hwnd, 1, 1, L"HEY" ); ListView_Update( m_list[0].m_hwnd, 1 ); } }break; case 4294967289:{//COLUMN RESIZE HWND lvw=m_list[win].getwnd(); for (int k=0;k<14;k++){ int width=ListView_GetColumnWidth(lvw, k); if (width>0&&cwids[k]!=width){ cwids[k]=width; cwidschanged=true;} } }break; case HDN_DIVIDERDBLCLICKA: case HDN_DIVIDERDBLCLICKW:{ //HWND lvw=m_list[win].getwnd(); }break; } } } break; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_BUTTON_CONFIG:{ config(0); break;} case IDC_BUTTON5:{//close TCHAR *last=wcsrchr(path[0],L'\\'); last[1]=0; if (pclicked>0){ if (pclicked<=numofdevices){ pathsfordrives.uj(dnames[pclicked-1].path,_wcsdup(path[0])); }else{ pathsfordrives.uj(realmaps[pclicked-1-numofdevices].path,_wcsdup(path[0])); } } notchanging[0]=true; SetDlgItemText(hwndDlg,IDC_QUICKSEARCH,L""); loadSongList(0); break;} case IDC_BUTTON6:{ break;} case IDC_BUTTON7:{ playFiles(0,1,0); break;} case IDC_BUTTON8:{ playFiles(1,1,0); break;} case IDC_STATIC9:{ KillTimer(hwndDlg,499); SetTimer(hwndDlg,499,1,NULL); break;} case IDC_QUICKSEARCH: if (HIWORD(wParam) == EN_CHANGE) { if (!notchanging[0]){ KillTimer(hwndDlg,500); SetTimer(hwndDlg,500,1,NULL); } else notchanging[0]=false; } break; case IDC_QUICKSEARCH4: if (HIWORD(wParam) == EN_CHANGE) { if (!notchanging[1]){ KillTimer(hwndDlg,501); SetTimer(hwndDlg,501,1,NULL); } else notchanging[1]=false; } break; case IDC_QUICKSEARCH2:{ TCHAR buf[256]; GetDlgItemText(hwndDlg,IDC_QUICKSEARCH2,buf,254); int len=wcslen(buf); if (wcscmp(buf,path[0])!=0&&buf[len-1]==L'\\'){ if (isrealfolder(buf)){ buf[len]=0; path[0]=wcscpy(path[0],buf); //path[0]=wcscat(path[0],L"\\"); loadSongList(0); } } break;} case IDC_QUICKSEARCH3:{ TCHAR buf[256]; GetDlgItemText(hwndDlg,IDC_QUICKSEARCH3,buf,254); int len=wcslen(buf); if (wcscmp(buf,path[1])!=0&&buf[len-1]==L'\\'){ if (isrealfolder(buf)){ buf[len]=0; path[1]=wcscpy(path[1],buf); //path[0]=wcscat(path[0],L"\\"); loadSongList(1); } } break;} case IDC_BUTTON1:{ if (alsocsik==1){ TCHAR buf[50]; GetDlgItemText(hwndDlg,IDC_EDIT1,buf,49); if (wcslen(buf)>0){ TCHAR* pp=new TCHAR[MAX_PATH]; pp[0]=0; wcscat(pp,path[alsonum]); wcscat(pp,buf); pp[wcslen(pp)+1]='\0'; pp[wcslen(pp)+2]='\0'; CreateDirectory(pp,NULL); prevscroll=GetScrollPos(m_list[0].m_hwnd,SB_VERT); loadSongList(0); if (multiple) loadSongList(1); } }else if (alsocsik==2){ TCHAR buf[256]; GetDlgItemText(hwndDlg,IDC_EDIT1,buf,254); if (wcslen(buf)>0){ TCHAR* to=new TCHAR[MAX_PATH]; to[0]='\0'; wcscat(to,path[alsonum]); wcscat(to,buf); SHFILEOPSTRUCT fos; memset(&fos, 0, sizeof(fos)); fos.wFunc = FO_MOVE; to[wcslen(to)+1]=L'\0'; fos.pTo=to; fos.fFlags = FOF_ALLOWUNDO ; C_ItemList *list=(C_ItemList *)m_songs_sorted[alsonum]; if (!list) { list=&m_songs[alsonum];} int x,l=list->GetSize(); for (x = 0 ; x < l; x ++){ if (m_list[alsonum].GetSelected(x)){ Song *s=(Song *)list->Get(x); s->filepath=makedoublenull(s->filepath); fos.pFrom=s->filepath; bool playingmoved=(!wcscmp(s->filepath,playingpath)); int from=0; if (playingmoved){ from=SendMessage(plugin.hwndWinampParent,WM_WA_IPC,0,IPC_GETOUTPUTTIME); SendMessage(plugin.hwndWinampParent,WM_COMMAND,MAKEWPARAM(WINAMP_BUTTON4,0),0); } if (SHFileOperation(&fos)==0&&!fos.fAnyOperationsAborted){//successfull if (MYTOP) { MYTOP->filechange((TCHAR*)fos.pFrom,(TCHAR*)fos.pTo,s->type==1?-6:-5); } if (playingmoved){ TCHAR* uj=new TCHAR[MAX_PATH];uj[0]=0; wcscat(uj,fos.pTo); donothook=true; SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)uj,IPC_CHANGECURRENTFILEW); if (playing) SendMessage(plugin.hwndWinampParent,WM_COMMAND,MAKEWPARAM(WINAMP_BUTTON2,0),0); if (playing) {int er; do{er=SendMessage(plugin.hwndWinampParent,WM_WA_IPC,from+500,IPC_JUMPTOTIME);}while(er==-1);} } hashvalue* hv=pts.hashkeres(s->filepath+3); if (hv){ TCHAR* uj=new TCHAR[MAX_PATH]; uj[0]=0; wcscat(uj,to); pts.uj(uj+3,wcsdup(hv->ertek)); pts.torol(s->filepath+3); partschanged=true; } } } } loadSongList(0); if (multiple) loadSongList(1); } }else if (alsocsik==3){ TCHAR buf[256]; GetDlgItemText(hwndDlg,IDC_EDIT2,buf,sizeof(buf)); int from=_ttoi(buf)*60; GetDlgItemText(hwndDlg,IDC_EDIT3,buf,sizeof(buf)); from=from+_ttoi(buf); GetDlgItemText(hwndDlg,IDC_EDIT4,buf,sizeof(buf)); hashvalue* hv=pts.hashkeres(addingsong->filepath+3); partschanged=true; if (hv!=NULL){ wsprintf(hv->ertek,L"%s|%d|%s",hv->ertek,from,buf); }else{ TCHAR* uj=new TCHAR[1000]; wsprintf(uj,L"%d|%s",from,buf); pts.uj(addingsong->filepath+3,uj); } loadSongList(0); if (multiple) loadSongList(1); } } case IDC_BUTTON2:{ closedown(hwndDlg); break;} case IDC_BUTTON3:{ int now=SendMessage(plugin.hwndWinampParent,WM_WA_IPC,0,IPC_GETOUTPUTTIME)/1000; if (now<0) now=0; TCHAR* tszam=new TCHAR[5]; tszam[0]=0; wsprintf(tszam,L"%d",now/60); SetDlgItemText(hwndDlg,IDC_EDIT2,tszam); wsprintf(tszam,L"%02d",now%60); SetDlgItemText(hwndDlg,IDC_EDIT3,tszam); break;} } case WM_TIMER: if (wParam == 500){ KillTimer(hwndDlg,500); //TCHAR buf[256]; //GetDlgItemText(hwndDlg,IDC_QUICKSEARCH,buf,sizeof(buf)); //buf[255]=0; updateList(0); } if (wParam == 501){ KillTimer(hwndDlg,501); //TCHAR buf[256]; //GetDlgItemText(hwndDlg,IDC_QUICKSEARCH,buf,sizeof(buf)); //buf[255]=0; updateList(1); } if (wParam == 499){ KillTimer(hwndDlg,499); loadSongList(0); if (multiple) loadSongList(1); } else if (wParam == 32)//TREE CLICKED { KillTimer(hwndDlg,32); if (donotload) {donotload=false; break;} #ifdef DEBUGIT _ASSERTE( _CrtCheckMemory( ) ); #endif if (pclicked>0){ if (!dlch){ if (pclicked<=numofdevices){ TCHAR* existingp=pathsfordrives.keres(dnames[pclicked-1].path); if (existingp) wcscpy(path[0],existingp); else wcscpy(path[0],dnames[pclicked-1].path); wcscpy(wdev,path[0]); }else{ TCHAR* existingp=pathsfordrives.keres(realmaps[pclicked-1-numofdevices].path); #ifdef DEBUGIT _ASSERTE( _CrtCheckMemory( ) ); #endif if (existingp) wcscpy(path[0],existingp); else wcscpy(path[0],realmaps[pclicked-1-numofdevices].path); wcscpy(wdev,realmaps[pclicked-1-numofdevices].name); #ifdef DEBUGIT _ASSERTE( _CrtCheckMemory( ) ); #endif } } else dlch=false; #ifdef DEBUGIT _ASSERTE( _CrtCheckMemory( ) ); #endif notchanging[0]=true; notchanging[1]=true; SetDlgItemText(hwndDlg,IDC_QUICKSEARCH,L"");// automatically updates the list via EN_CHANGE loadSongList(0); if (multiple){ m_songs[1].GetSize(); SetDlgItemText(hwndDlg,IDC_QUICKSEARCH4,L""); if (!wcscmp(path[1],L"")){ wcscpy(path[1],path[0]); loadSongList(1); }else updateList(1); } #ifdef DEBUGIT _ASSERTE( _CrtCheckMemory( ) ); #endif }else{ initoptions(); } } break; case WM_SIZE: if (wParam != SIZE_MINIMIZED) { wwidth=LOWORD(lParam); wheight=HIWORD(lParam); if (cr_resize) cr_resize(hwndDlg,resize_rlist3,sizeof(resize_rlist3)/sizeof(resize_rlist3[0])); if (!multiple){ if (cr_resize) cr_resize(hwndDlg,resize_rlist,sizeof(resize_rlist)/sizeof(resize_rlist[0])); if (alsocsik){ SetWindowPos(GetDlgItem(hwndDlg, IDC_LIST),NULL,0,0,wwidth,wheight-95,SWP_NOMOVE); //RedrawWindow(GetDlgItem(hwndDlg, IDC_GPB3),NULL,NULL,RDW_UPDATENOW|RDW_NOCHILDREN); //RedrawWindow(GetDlgItem(hwndDlg, IDC_GPB3),NULL,NULL,RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN); } }else if (multiple==1){ int width=wwidth; int height=wheight; if (alsocsik){ SetWindowPos(GetDlgItem(hwndDlg,IDC_LIST2),HWND_TOP,width/2,18,width/2,height-95,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_LIST),HWND_TOP,0,18,width/2-2,height-95,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_STATIC11),HWND_TOP,width/2-2,17,2,height-94,SWP_NOZORDER); }else{ SetWindowPos(GetDlgItem(hwndDlg,IDC_LIST2),HWND_TOP,width/2,18,width/2,height-35,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_LIST),HWND_TOP,0,18,width/2-2,height-35,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_STATIC11),HWND_TOP,width/2-2,17,2,height-32,SWP_NOZORDER); } SetWindowPos(GetDlgItem(hwndDlg,IDC_QUICKSEARCH4),HWND_TOP,width-45,0,45,18,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_QUICKSEARCH3),HWND_TOP,width/2+2,3,width/2-47,14,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_QUICKSEARCH),HWND_TOP,width/2-45,0,45,18,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_QUICKSEARCH2),HWND_TOP,0,3,width/2-45,14,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_BUTTON_CONFIG),HWND_TOP,width/2-17,height-16,36,15,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_STATIC9),HWND_TOP,width/2-35,height-16,16,16,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_STATUS0),HWND_TOP,0,height-15,width/2-37,14,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_STATUS1),HWND_TOP,width/2+22,height-15,width/2-18,14,SWP_NOZORDER); }else if (multiple==2){ int width=LOWORD(lParam); int height=HIWORD(lParam); if (alsocsik){ SetWindowPos(GetDlgItem(hwndDlg, IDC_STATIC10),HWND_TOP,0,wheight-71,wwidth,2,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_LIST2),HWND_TOP,0,height/2+20,width,height/2-105,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_STATUS1),HWND_TOP,2,height-85,width-60,12,SWP_NOZORDER); }else{ SetWindowPos(GetDlgItem(hwndDlg,IDC_LIST2),HWND_TOP,0,height/2+20,width,height/2-40,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_STATUS1),HWND_TOP,2,height-15,width-40,12,SWP_NOZORDER); } SetWindowPos(GetDlgItem(hwndDlg,IDC_STATIC2),HWND_TOP,0,height/2-2,width,2,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_QUICKSEARCH4),HWND_TOP,width-45,height/2,45,18,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_STATIC9),HWND_TOP,width-63,height/2,16,16,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_QUICKSEARCH3),HWND_TOP,2,height/2+3,width-68,14,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_LIST),HWND_TOP,0,18,width,height/2-37,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_QUICKSEARCH),HWND_TOP,width-45,0,45,18,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_QUICKSEARCH2),HWND_TOP,0,3,width-45,14,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_BUTTON_CONFIG),HWND_TOP,width-40,height-16,40,15,SWP_NOZORDER); SetWindowPos(GetDlgItem(hwndDlg,IDC_STATUS0),HWND_TOP,0,height/2-17,width,12,SWP_NOZORDER); } }break; case WM_PAINT: { //int tab[] = { IDC_QUICKSEARCH|DCW_SUNKENBORDER, IDC_LIST|DCW_SUNKENBORDER}; //if (wad_DrawChildWindowBorders) wad_DrawChildWindowBorders(hwndDlg,tab,2); } return 0; case WM_DESTROY: /* if (dlch){ //dlch=false; }else{*/ clearSongList(0); //clearSongList(1); pclicked=-1; //m_hwnd=NULL; //SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,m_skinlistview_handle[0],ML_IPC_UNSKIN_LISTVIEW); //} return 0; case WM_ML_CHILDIPC: if (lParam == ML_CHILDIPC_DROPITEM && wParam) { mlDropItemStruct *t=(mlDropItemStruct*)wParam; if (t->type == ML_TYPE_ITEMRECORDLISTW) t->result=1; if (t->data) { if (t->type == ML_TYPE_ITEMRECORDLISTW) // we got a drag&drop to our window, hot! { //addItemListToSongs((itemRecordList*)t->data); updateList(0); } } } return 0; case WM_MBUTTONUP:{ }break; case WM_LBUTTONUP:{ if (GetCapture() == hwndDlg){ HCURSOR cur=GetCursor(); ReleaseCapture(); POINT p; p.x=GET_X_LPARAM(lParam); p.y=GET_Y_LPARAM(lParam); ClientToScreen(hwndDlg,&p); HWND h=WindowFromPoint(p); int brow=0; if (multiple){ brow=-1; if(h==m_list[1].m_hwnd) brow=1; if(h==m_list[0].m_hwnd) brow=0; } if (h && h != hwndDlg && !IsChild(hwndDlg,h)){ mlDropItemStruct m={ML_TYPE_ITEMRECORDLISTW,NULL,0}; m.p=p; m.flags=ML_HANDLEDRAG_FLAG_NOCURSOR; SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&m,ML_IPC_HANDLEDRAG); if (m.result>0){ int j; int dto=-1; for (j=0;j<=(numofdevices+numofm);j++) if (droppedto == myParam(j-1)) dto=j; if (dto>0){ //dropped to playlist: if (dto>numofdevices){if (isrealplaylist(realmaps[dto-numofdevices-1].path)){SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&m,ML_IPC_HANDLEDROP);return true;}} //dropped to drive or mapped folder TCHAR topath[MAX_PATH]; if (dto<=numofdevices){ wcscpy(topath,dnames[dto-1].path); }else{ wcscpy(topath,realmaps[dto-numofdevices-1].path); } moveorcopy(topath,false,capturefrom); }else if (dto==-1){ playFiles(1,0,0); } } SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&m,ML_IPC_HANDLEDROP); }else{//drop to list //ScreenToClient(m_list[0].m_hwnd,&p); //int too=m_list[0].FindItemByPoint(10,p.y); if (brow!=-1&&tooo[brow]>-1){ C_ItemList *list=(C_ItemList *)m_songs_sorted[brow]; if (!list)list=&m_songs[brow]; Song* s=(Song*)list->Get(tooo[brow]); if (s->type==1||s->type==0){ TCHAR topath[MAX_PATH]; if (s->type==1)wcscpy(topath,s->filepath); else{ TCHAR *last=wcsrchr(path[brow],L'\\'); short alen=wcslen(path[brow]); short llen=wcslen(last); if (alen>3){ TCHAR uj[MAX_PATH]; wcsncpy(uj,path[brow],wcslen(path[brow])-wcslen(last)); last=wcsrchr(uj,L'\\'); int i=0; while (1){ if ((uj+i)>last){ *(uj+i)=0; break; } i++; } wcscpy(topath,uj); } } if (!multiple||wcscmp(topath,path[brow==0?1:0])!=0) moveorcopy(topath,false,capturefrom); m_list[capturefrom].SetSelected(-1,false); //prevscroll=GetScrollPos(m_list[capturefrom].m_hwnd,SB_VERT)-3; //loadSongList(0); } }else if(brow!=-1&&brow!=capturefrom){ TCHAR topath[MAX_PATH]; wcscpy(topath,path[brow]); if (wcscmp(topath,path[brow==0?1:0])!=0) moveorcopy(topath,false,capturefrom); tooo[brow]=-1; } } } tooo[0]=-1; tooo[1]=-1; break;} case WM_RBUTTONUP:{ if (GetCapture() == hwndDlg){ ReleaseCapture(); POINT p; p.x=GET_X_LPARAM(lParam); p.y=GET_Y_LPARAM(lParam); ClientToScreen(hwndDlg,&p); HWND h=WindowFromPoint(p); int brow=0; if (multiple){ brow=-1; if(h==m_list[1].m_hwnd) brow=1; if(h==m_list[0].m_hwnd) brow=0; } //drop to tree if (h != hwndDlg && !IsChild(hwndDlg,h)){ mlDropItemStruct m={ML_TYPE_ITEMRECORDLISTW,NULL,0}; m.p=p; m.flags=ML_HANDLEDRAG_FLAG_NOCURSOR; SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&m,ML_IPC_HANDLEDRAG); if (m.result>0){ int j; int dto=-1; for (j=0;j<=(numofdevices+numofm);j++) if (droppedto == myParam(j-1)) dto=j; if (dto>0){ //dropped to playlist: if (dto>numofdevices){if (isrealplaylist(realmaps[dto-numofdevices-1].path)){SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&m,ML_IPC_HANDLEDROP); return true;}} //dropped to drive or mapped folder int r=TrackPopupMenu(GetSubMenu(m_context_menus,3),TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON|TPM_NONOTIFY,p.x,p.y,0,m_hwnd,NULL); switch (r){ case ID_COPY:{ TCHAR topath[MAX_PATH]; if (dto<=numofdevices){ wcscpy(topath,dnames[dto-1].path); }else{ wcscpy(topath,realmaps[dto-numofdevices-1].path);} moveorcopy(topath,true,capturefrom); break;} case ID_MOVE:{ TCHAR topath[MAX_PATH]; if (dto<=numofdevices){ wcscpy(topath,dnames[dto-1].path); }else{ wcscpy(topath,realmaps[dto-numofdevices-1].path);} moveorcopy(topath,false,capturefrom); //loadSongList(0); break;} } }else if (dto==-1){ playFiles(1,0,0); } SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&m,ML_IPC_HANDLEDROP); } }else{//drop to list //ScreenToClient(m_list[0].m_hwnd,&p); //int too=m_list[0].FindItemByPoint(10,p.y); if (brow!=-1&&tooo[brow]>-1){ C_ItemList *list=(C_ItemList *)m_songs_sorted[brow]; if (!list)list=&m_songs[brow]; Song* s=(Song*)list->Get(tooo[brow]); if (s->type==1||s->type==0){ int r=TrackPopupMenu(GetSubMenu(m_context_menus,3),TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON|TPM_NONOTIFY,p.x,p.y,0,m_hwnd,NULL); switch (r){ case ID_COPY:{ TCHAR topath[MAX_PATH]; if (s->type==1) wcscpy(topath,s->filepath); else{ TCHAR *last=wcsrchr(path[brow],L'\\'); short alen=wcslen(path[brow]); short llen=wcslen(last); if (alen>3){ TCHAR uj[MAX_PATH]; wcsncpy(uj,path[brow],wcslen(path[brow])-wcslen(last)); last=wcsrchr(uj,L'\\'); int i=0; while (1){ if ((uj+i)>last){ *(uj+i)=0; break; } i++; } wcscpy(topath,uj); } } moveorcopy(topath,true,capturefrom); m_list[capturefrom].SetSelected(-1,false); break;} case ID_MOVE:{ TCHAR topath[MAX_PATH]; if (s->type==1)wcscpy(topath,s->filepath); else{ TCHAR *last=wcsrchr(path[brow],L'\\'); short alen=wcslen(path[brow]); short llen=wcslen(last); if (alen>3){ TCHAR uj[MAX_PATH]; wcsncpy(uj,path[brow],wcslen(path[brow])-wcslen(last)); last=wcsrchr(uj,L'\\'); int i=0; while (1){ if ((uj+i)>last){ *(uj+i)=0; break; } i++; } wcscpy(topath,uj); } } moveorcopy(topath,false,capturefrom); m_list[capturefrom].SetSelected(-1,false); //prevscroll=GetScrollPos(m_list[capturefrom].m_hwnd,SB_VERT)-3; //loadSongList(0); break;} } if (tooo[brow]>-1) m_list[0].SetSelected(tooo[brow],false); tooo[brow]=-1; } }else if(brow!=-1&&brow!=capturefrom){ int r=TrackPopupMenu(GetSubMenu(m_context_menus,3),TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON|TPM_NONOTIFY,p.x,p.y,0,m_hwnd,NULL); switch (r){ case ID_COPY:{ TCHAR topath[MAX_PATH]; wcscpy(topath,path[brow]); if (wcscmp(topath,path[brow==0?1:0])!=0) moveorcopy(topath,true,capturefrom); break;} case ID_MOVE:{ TCHAR topath[MAX_PATH]; wcscpy(topath,path[brow]); if (wcscmp(topath,path[brow==0?1:0])!=0) moveorcopy(topath,false,capturefrom); break;} } tooo[brow]=-1; } } tooo[0]=-1; tooo[1]=-1; } break;} //--- MOUSE MOVE ------------------------------- case WM_MOUSEMOVE:{ if (GetCapture()==hwndDlg){ POINT p; p.x=GET_X_LPARAM(lParam); p.y=GET_Y_LPARAM(lParam); ClientToScreen(hwndDlg,&p); mlDropItemStruct all={ML_TYPE_ITEMRECORDLISTW,m_songs_sorted[0],1,p}; HWND h=WindowFromPoint(p); droppedto=-1; int db=0; int brow=0; if (multiple){ brow=-1; if(h==m_list[1].m_hwnd) brow=1; if(h==m_list[0].m_hwnd) brow=0; } for (int i=0;iGet(i); if (s->type==0||s->from!=-1) m_list[capturefrom].SetSelected(i,false); else db++; } } if (db>0){ if (!h){ if (tooo[0]>-1) m_list[0].SetSelected(tooo[0],false); tooo[0]=-1; if (multiple){ if (tooo[1]>-1) m_list[1].SetSelected(tooo[1],false); tooo[1]=-1; } SetCursor(LoadCursor(NULL,IDC_NO)); }else if (h!= hwndDlg&&!IsChild(hwndDlg,h)){//dropped to tree int dto=-1; for (int j=0;j<=(numofdevices+numofm);j++){ if (draggedto == myParam(j-1)) dto=j;} // if (dto==0){//parent, "browser" tree item SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&all,ML_IPC_HANDLEDRAG); SetCursor(LoadCursor(NULL,IDC_NO)); return true; } if (dto>0&&dto>numofdevices){//dragginf to playlist if (isrealplaylist(realmaps[dto-numofdevices-1].path)){ SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&all,ML_IPC_HANDLEDRAG); SetCursor(LoadCursor(NULL,IDC_NO)); return true; } } SetCursor(cur1); if (tooo[0]>-1) m_list[0].SetSelected(tooo[0],false); tooo[0]=-1; if (multiple){ if (tooo[1]>-1) m_list[1].SetSelected(tooo[1],false); tooo[1]=-1; } SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&all,ML_IPC_HANDLEDRAG); }else if (brow!=-1){ if (multiple){ if (tooo[brow==0?1:0]>-1) m_list[brow==0?1:0].SetSelected(tooo[brow==0?1:0],false); tooo[brow==0?1:0]=-1; } ScreenToClient(m_list[brow].m_hwnd,&p); int too=m_list[brow].FindItemByPoint(10,p.y); if (too==-1){ if (tooo[brow]!=-1) m_list[brow].SetSelected(tooo[brow],false); tooo[brow]=-1; if (brow!=capturefrom) SetCursor(cur1); else SetCursor(LoadCursor(NULL,IDC_NO)); } else if (too>-1&&tooo[brow]!=too){ if (m_list[brow].GetSelected(too)){ if (tooo[brow]>-1) m_list[brow].SetSelected(tooo[brow],false); tooo[brow]=-1; SetCursor(LoadCursor(NULL,IDC_NO)); }else{ if (tooo[brow]>-1) m_list[brow].SetSelected(tooo[brow],false); tooo[brow]=too; if (tooo[brow]>-1){ C_ItemList *list=(C_ItemList *)m_songs_sorted[brow]; if (!list) { list=&m_songs[brow];} Song* s=(Song*)list->Get(tooo[brow]); if (s->type==1||s->type==0){ SetCursor(cur1); m_list[brow].SetSelected(tooo[brow],true); }else{ SetCursor(LoadCursor(NULL,IDC_NO)); } }else{ SetCursor(LoadCursor(NULL,IDC_NO)); } } } } else SetCursor(LoadCursor(NULL,IDC_NO)); }else{ SetCursor(LoadCursor(NULL,IDC_NO));} } break;} } cout << "sf"; return 0; } static BOOL CALLBACK optproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam){ if (wad_handleDialogMsgs) { BOOL a=wad_handleDialogMsgs(hwndDlg,uMsg,wParam,lParam); if (a) return a; } switch (uMsg){ case WM_DISPLAYCHANGE: return 0; case WM_INITDIALOG:{ m_hwnd=hwndDlg; CheckDlgButton(m_hwnd,IDC_CHECK1,showhd); CheckDlgButton(m_hwnd,IDC_CHECK2,showd); CheckDlgButton(m_hwnd,IDC_CHECK3,showrd); CheckDlgButton(m_hwnd,IDC_CHECK4,shownd); CheckDlgButton(m_hwnd,IDC_CHECK5,showod); CheckDlgButton(m_hwnd,IDC_CHECK6,showsize); CheckDlgButton(m_hwnd,IDC_CHECK7,showlength); CheckDlgButton(m_hwnd,IDC_CHECK8,showcreated); CheckDlgButton(m_hwnd,IDC_CHECK14,showbitrate); CheckDlgButton(m_hwnd,IDC_CHECK18,shownumber); CheckDlgButton(m_hwnd,IDC_CHECK19,showalbum); CheckDlgButton(m_hwnd,IDC_CHECK20,showyear); CheckDlgButton(m_hwnd,IDC_CHECK21,showgenre); CheckDlgButton(m_hwnd,IDC_CHECK22,showfirstp); CheckDlgButton(m_hwnd,IDC_CHECK23,showpcount); CheckDlgButton(m_hwnd,IDC_CHECK24,showplength); CheckDlgButton(m_hwnd,IDC_CHECK25,showlastp); CheckDlgButton(m_hwnd,IDC_CHECK9,shownames); CheckDlgButton(m_hwnd,IDC_CHECK10,showe); CheckDlgButton(m_hwnd,IDC_CHECK11,showmp); CheckDlgButton(m_hwnd,IDC_CHECK12,showsongs); CheckDlgButton(m_hwnd,IDC_CHECK17,showvids); CheckDlgButton(m_hwnd,IDC_CHECK26,showplaylists); CheckDlgButton(m_hwnd,IDC_CHECK27,showall); CheckDlgButton(m_hwnd,IDC_CHECK13,showtitle); CheckDlgButton(m_hwnd,IDC_CHECK15,showposit); CheckDlgButton(m_hwnd,IDC_CHECK16,showplaying); if (MYTOP) SetDlgItemText(hwndDlg,IDC_STATIC55,L"MyTop detected"); else{ SetDlgItemText(hwndDlg,IDC_STATIC55,L"MyTop not found"); EnableWindow(GetDlgItem(hwndDlg, IDC_CHECK22), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHECK23), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHECK24), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHECK25), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_RADIO27), FALSE); if (g_sortcol==COL_RATING) g_sortcol=COL_FILENAME; } switch(g_sortcol){ case COL_FILENAME:CheckRadioButton(m_hwnd,IDC_RADIO21,IDC_RADIO27,IDC_RADIO21+0);break; case COL_SIZE: CheckRadioButton(m_hwnd,IDC_RADIO21,IDC_RADIO27,IDC_RADIO21+1); break; case COL_LENGTH:CheckRadioButton(m_hwnd,IDC_RADIO21,IDC_RADIO27,IDC_RADIO21+2); break; case COL_CREATED: CheckRadioButton(m_hwnd,IDC_RADIO21,IDC_RADIO27,IDC_RADIO21+3); break; case COL_NUMBER: CheckRadioButton(m_hwnd,IDC_RADIO21,IDC_RADIO27,IDC_RADIO21+4); break; case COL_YEAR: CheckRadioButton(m_hwnd,IDC_RADIO21,IDC_RADIO27,IDC_RADIO21+5); break; case COL_RATING: CheckRadioButton(m_hwnd,IDC_RADIO21,IDC_RADIO27,IDC_RADIO21+6); break; } CheckRadioButton(m_hwnd,IDC_RADIO3,IDC_RADIO4,IDC_RADIO3+g_sortdir); CheckRadioButton(m_hwnd,IDC_RADIO5,IDC_RADIO7,IDC_RADIO5+multiple); if (posicon<2) CheckRadioButton(m_hwnd,IDC_RADIO8,IDC_RADIO9,IDC_RADIO8+posicon); if (posicon==2) CheckRadioButton(m_hwnd,IDC_RADIO10,IDC_RADIO10,IDC_RADIO10); CheckRadioButton(m_hwnd,IDC_RADIO15,IDC_RADIO17,IDC_RADIO15+dca); SetWindowText(GetDlgItem(m_hwnd, IDC_EDIT1),exclude); //-------skin-------- *(void **)&wad_getColor=(void*)SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,1,ML_IPC_SKIN_WADLG_GETFUNC); *(void **)&wad_handleDialogMsgs=(void*)SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,2,ML_IPC_SKIN_WADLG_GETFUNC); *(void **)&cr_init=(void*)SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,32,ML_IPC_SKIN_WADLG_GETFUNC); *(void **)&cr_resize=(void*)SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,33,ML_IPC_SKIN_WADLG_GETFUNC); *(void **)&cr_resizelist=(void*)SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,35,ML_IPC_SKIN_WADLG_GETFUNC); if (cr_init) cr_init(hwndDlg,resize_rlist2,sizeof(resize_rlist2)/sizeof(resize_rlist2[0])); break;} case WM_NOTIFY: switch(LOWORD(wParam)){ case IDC_SYSLINK1:{ LPNMHDR l=(LPNMHDR)lParam; if (l->code == NM_CLICK) ShellExecuteA(NULL, "open", "http://mlplugin.try.hu", NULL, NULL, SW_SHOWMAXIMIZED); }break; case IDC_SYSLINK2:{ LPNMHDR l=(LPNMHDR)lParam; if (l->code == NM_CLICK) ShellExecuteA(NULL, "open", "http://www.winamp.com", NULL, NULL, SW_SHOWMAXIMIZED); }break; }break; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_CHECK1: showhd=IsDlgButtonChecked(hwndDlg,IDC_CHECK1); inittree(0); break; case IDC_CHECK2: showd=IsDlgButtonChecked(hwndDlg,IDC_CHECK2); inittree(0); break; case IDC_CHECK3: showrd=IsDlgButtonChecked(hwndDlg,IDC_CHECK3); inittree(0); break; case IDC_CHECK4: shownd=IsDlgButtonChecked(hwndDlg,IDC_CHECK4); inittree(0); break; case IDC_CHECK5: showod=IsDlgButtonChecked(hwndDlg,IDC_CHECK5); inittree(0); break; case IDC_CHECK6: showsize=IsDlgButtonChecked(hwndDlg,IDC_CHECK6);makeclist();calccws(); break; case IDC_CHECK7: showlength=IsDlgButtonChecked(hwndDlg,IDC_CHECK7);makeclist();calccws();break; case IDC_CHECK14: showbitrate=IsDlgButtonChecked(hwndDlg,IDC_CHECK14);makeclist();calccws(); break; case IDC_CHECK8: showcreated=IsDlgButtonChecked(hwndDlg,IDC_CHECK8);makeclist();calccws(); break; case IDC_CHECK18: shownumber=IsDlgButtonChecked(hwndDlg,IDC_CHECK18);makeclist();calccws(); break; case IDC_CHECK19: showalbum=IsDlgButtonChecked(hwndDlg,IDC_CHECK19);makeclist();calccws(); break; case IDC_CHECK20: showyear=IsDlgButtonChecked(hwndDlg,IDC_CHECK20);makeclist();calccws(); break; case IDC_CHECK21: showgenre=IsDlgButtonChecked(hwndDlg,IDC_CHECK21);makeclist();calccws(); break; case IDC_CHECK22: showfirstp=IsDlgButtonChecked(hwndDlg,IDC_CHECK22);makeclist();calccws(); break; case IDC_CHECK23: showpcount=IsDlgButtonChecked(hwndDlg,IDC_CHECK23);makeclist();calccws(); break; case IDC_CHECK24: showplength=IsDlgButtonChecked(hwndDlg,IDC_CHECK24);makeclist();calccws(); break; case IDC_CHECK25: showlastp=IsDlgButtonChecked(hwndDlg,IDC_CHECK25);makeclist();calccws(); break; case IDC_CHECK9: shownames=IsDlgButtonChecked(hwndDlg,IDC_CHECK9);inittree(0);break; case IDC_CHECK10: showe=IsDlgButtonChecked(hwndDlg,IDC_CHECK10);inittree(0);break; case IDC_CHECK11: showmp=IsDlgButtonChecked(hwndDlg,IDC_CHECK11);inittree(0);break; case IDC_CHECK12: showsongs=IsDlgButtonChecked(hwndDlg,IDC_CHECK12);break; case IDC_CHECK13: showtitle=IsDlgButtonChecked(hwndDlg,IDC_CHECK13);break; case IDC_CHECK15: showposit=IsDlgButtonChecked(hwndDlg,IDC_CHECK15);break; case IDC_CHECK16: showplaying=IsDlgButtonChecked(hwndDlg,IDC_CHECK16);break; case IDC_CHECK17: showvids=IsDlgButtonChecked(hwndDlg,IDC_CHECK17);break; case IDC_CHECK26: showplaylists=IsDlgButtonChecked(hwndDlg,IDC_CHECK26);break; case IDC_CHECK27: showall=IsDlgButtonChecked(hwndDlg,IDC_CHECK27); break; case IDC_RADIO3: g_sortdir=0; break; case IDC_RADIO4: g_sortdir=1; break; case IDC_RADIO21: g_sortcol=COL_FILENAME; break; case IDC_RADIO22: g_sortcol=COL_SIZE; break; case IDC_RADIO23: g_sortcol=COL_LENGTH; break; case IDC_RADIO24: g_sortcol=COL_CREATED; break; case IDC_RADIO25: g_sortcol=COL_NUMBER; break; case IDC_RADIO26: g_sortcol=COL_YEAR; break; case IDC_RADIO27: g_sortcol=COL_RATING; break; case IDC_RADIO5: multiple=0;calccws(); break; case IDC_RADIO6: multiple=1;calccws(); break; case IDC_RADIO7: multiple=2;calccws(); break; case IDC_RADIO8: posicon=0; initicons(); break; case IDC_RADIO9: posicon=1; initicons(); break; case IDC_RADIO10: posicon=2; initicons(); break; case IDC_RADIO15: dca=0; initmenus(); break; case IDC_RADIO16: dca=1; initmenus(); break; case IDC_RADIO17: dca=2; initmenus(); break; case IDC_BUTTON3: if (!editorHWND) ShowWindow((editorHWND=CreateDialog(plugin.hDllInstance,MAKEINTRESOURCE(IDD_POSEDITOR),hwndDlg,editor_dlgproc)),SW_SHOW); else{ShowWindow(editorHWND,SW_RESTORE);SetActiveWindow(editorHWND); } break; case IDC_BUTTON6: if (!mapeditorHWND) ShowWindow((mapeditorHWND=CreateDialog(plugin.hDllInstance,MAKEINTRESOURCE(IDD_MAPDIALOG),hwndDlg,mapeditor_dlgproc)),SW_SHOW); else{ShowWindow(mapeditorHWND,SW_RESTORE);SetActiveWindow(mapeditorHWND); } break; case IDC_EDIT1:{ TCHAR* prev=_wcsdup(exclude); GetWindowText(GetDlgItem(hwndDlg, IDC_EDIT1),exclude,49); if (wcscmp(exclude,prev)!=0) inittree(0); delete prev; }break; }break; case WM_DRAWITEM: break; case WM_SIZE: if (wParam != SIZE_MINIMIZED) { if (cr_resize) cr_resize(hwndDlg,resize_rlist2,sizeof(resize_rlist2)/sizeof(resize_rlist2[0])); } break; case WM_TIMER: break; case WM_PAINT: break; case WM_ML_CHILDIPC: break; } return 0; } static BOOL CALLBACK config_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) { switch (uMsg){ case WM_INITDIALOG:{ configHWND=hwndDlg; #ifdef DEBUGIT _CrtCheckMemory( ); #endif return 0;} case WM_NOTIFY:{ switch(LOWORD(wParam)){ case IDC_SYSLINK3:{ LPNMHDR l=(LPNMHDR)lParam; if (l->code == NM_CLICK) ShellExecuteA(NULL, "open", "http://mlplugin.try.hu", NULL, NULL, SW_SHOWMAXIMIZED); } } }break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: // save combo box case IDCANCEL: configHWND=NULL; EndDialog(hwndDlg,LOWORD(wParam) == IDOK); break; } return 0; } return 0; } static BOOL CALLBACK editor_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) { switch (uMsg){ case WM_INITDIALOG:{ editorHWND=hwndDlg; int max=100; for (int i=pts.darab()-1;i>=0;i--){ int len=wcslen(pts[i]->kulcs); if (len>max) max=len; ListBox_InsertString(GetDlgItem(hwndDlg, IDC_LIST1),0,pts[i]->kulcs); } ListBox_SetHorizontalExtent(GetDlgItem(hwndDlg, IDC_LIST1),max*6); return 0;}break; case WM_NOTIFY:{ switch(LOWORD(wParam)){ case IDC_SYSLINK3:{ LPNMHDR l=(LPNMHDR)lParam; if (l->code == NM_CLICK) ShellExecuteA(NULL, "open", "http://mlplugin.try.hu", NULL, NULL, SW_SHOWMAXIMIZED); } } }break; case WM_COMMAND: switch (LOWORD(wParam)){ case IDC_LIST1:{ if (HIWORD(wParam)==LBN_SELCHANGE) { int num=ListBox_GetCurSel(GetDlgItem(hwndDlg, IDC_LIST1)); if (num>-1){ Edit_SetText(GetDlgItem(hwndDlg, IDC_EDIT1),pts[num]->ertek); Edit_SetText(GetDlgItem(hwndDlg, IDC_EDIT5),pts[num]->kulcs); EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON1),false); EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON4),true); } } }break; case IDC_EDIT5: if (HIWORD(wParam)==EN_CHANGE) EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON1),true); break; case IDC_EDIT1: if (HIWORD(wParam)==EN_CHANGE) EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON1),true); break; case IDC_BUTTON1:{ TCHAR* lpch=new TCHAR[MAX_PATH]; TCHAR lpch2[400]; Edit_GetText(GetDlgItem(hwndDlg, IDC_EDIT1),lpch,400); Edit_GetText(GetDlgItem(hwndDlg, IDC_EDIT5),lpch2,MAX_PATH); int num=ListBox_GetCurSel(GetDlgItem(hwndDlg, IDC_LIST1)); if (num>-1){ delete[] pts[num]->ertek; pts.torol(pts[num]->kulcs); ListBox_DeleteString(GetDlgItem(hwndDlg, IDC_LIST1),num); } pts.uj(lpch2,lpch); partschanged=true; ListBox_InsertString(GetDlgItem(hwndDlg, IDC_LIST1),0,lpch2); EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON1),false); ListBox_SetCurSel(GetDlgItem(hwndDlg, IDC_LIST1),0); }break; case IDC_BUTTON4:{ int num=ListBox_GetCurSel(GetDlgItem(hwndDlg, IDC_LIST1)); if (num>-1){ ListBox_DeleteString(GetDlgItem(hwndDlg, IDC_LIST1),num); pts.torol(pts[num]->kulcs); partschanged=true; Edit_SetText(GetDlgItem(hwndDlg, IDC_EDIT1),L""); EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON4),false); EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON1),false); } }break; case IDC_BUTTON2:{ OPENFILENAME ofn; TCHAR szFileName[MAX_PATH] = L""; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hwndDlg; ofn.lpstrFilter = L"Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0"; ofn.lpstrFile = szFileName; ofn.nMaxFile = MAX_PATH; ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; ofn.lpstrDefExt = L"txt"; if(GetOpenFileName(&ofn)){ FILE* file=_wfopen(ofn.lpstrFile, L"r"); if (!file) return 0; int sec; TCHAR nev[MAX_PATH]; TCHAR adat[400]; while (fgetws(nev, MAX_PATH,file)){ if (fgetws(adat, 400,file)){ TCHAR *p;//removing endline from the end if ((p = wcschr(nev, '\n')) != NULL) *p = L'\0'; if ((p = wcschr(adat, '\n')) != NULL) *p = L'\0'; pts.uj(nev,_wcsdup(adat)); } } partschanged=true; fclose(file); ListBox_ResetContent(GetDlgItem(hwndDlg, IDC_LIST1)); editor_dlgproc(hwndDlg, WM_INITDIALOG,0,0); } }break; case IDC_BUTTON5:{ pts.clear(); partschanged=true; ListBox_ResetContent(GetDlgItem(hwndDlg, IDC_LIST1)); Edit_SetText(GetDlgItem(hwndDlg, IDC_EDIT1),L""); EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON4),false); EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON1),false); }break; case IDC_BUTTON3:{ OPENFILENAME ofn; TCHAR szFileName[MAX_PATH] = L""; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hwndDlg; ofn.lpstrFilter = L"Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0"; ofn.lpstrFile = szFileName; ofn.nMaxFile = MAX_PATH; ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; ofn.lpstrDefExt = L"txt"; if(GetSaveFileName(&ofn)){ FILE* file=_wfopen(ofn.lpstrFile, L"w"); if (file){ for (int i=pts.darab()-1;i>=0;i--){ fwprintf(file,L"%s\n",pts[i]->kulcs); fwprintf(file,L"%s\n",pts[i]->ertek); } fclose(file); } } }break; case IDCANCEL: EndDialog(hwndDlg,LOWORD(wParam) == IDOK); editorHWND=NULL; break; } return 0; } #ifdef DEBUGIT _ASSERTE( _CrtCheckMemory( ) ); #endif return 0; } static BOOL CALLBACK mapeditor_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam){ switch (uMsg){ case WM_INITDIALOG: mapeditorHWND=hwndDlg; ComboBox_ResetContent(GetDlgItem(hwndDlg, IDC_COMBO1)) ; ComboBox_ResetContent(GetDlgItem(hwndDlg, IDC_COMBO2)) ; for (int i=numofm-1;i>=0;i--){ ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_COMBO1),0,maps[i].name); ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_COMBO2),0,maps[i].path); } if (toadd){ toadd=makedoublenull(toadd); if (!isplaylist(toadd)) wcscat(toadd,L"\\"); SetWindowText(GetDlgItem(hwndDlg, IDC_COMBO2),toadd); toadd=NULL;} return 0; break; case WM_COMMAND: switch (LOWORD(wParam)){ case IDC_BUTTON1: { if (ComboBox_GetCount(GetDlgItem(hwndDlg, IDC_COMBO1))<32){ TCHAR lpch[41]; TCHAR lpch2[257]; GetWindowText(GetDlgItem(hwndDlg, IDC_COMBO1),lpch,40); GetWindowText(GetDlgItem(hwndDlg, IDC_COMBO2),lpch2,256); if (lpch&&lpch2) if (wcscmp(lpch,L"")!=0&&wcscmp(lpch2,L"")!=0){ int lplen=wcslen(lpch2); if (lpch2[lplen-1]!=L'\\'&&isplaylist(lpch2)==false){ lpch2[lplen]=L'\\'; lpch2[lplen+1]=L'\0'; } ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_COMBO1),numofm,lpch); ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_COMBO2),numofm,lpch2); wcscpy(maps[numofm].path,lpch2); wcscpy(maps[numofm].name,lpch); mapschanged=true; numofm++; inittree(0); } } break;} case IDC_BUTTON2: ComboBox_DeleteString(GetDlgItem(hwndDlg, IDC_COMBO1),ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_COMBO1))); ComboBox_DeleteString(GetDlgItem(hwndDlg, IDC_COMBO2),ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_COMBO2))); for (int i=0;i0){ ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_COMBO1),selected-1,maps[selected].name); ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_COMBO2),selected-1,maps[selected].path); ComboBox_DeleteString(GetDlgItem(hwndDlg, IDC_COMBO1),selected+1); ComboBox_DeleteString(GetDlgItem(hwndDlg, IDC_COMBO2),selected+1); for (int i=0;i0){ if (!dlch){ if (pclicked<=numofdevices){ wcscpy(path[1],dnames[pclicked-1].path); wcscpy(wdev,path[1]); }else{ wcscpy(path[1],realmaps[pclicked-1-numofdevices].path); wcscpy(wdev,realmaps[pclicked-1-numofdevices].name); } } else dlch=false; SetDlgItemText(m_hwnd,IDC_QUICKSEARCH4,L""); loadSongList(1); }else{ POINT p; GetCursorPos(&p); int r; if (pclicked>=numofdevices) r=TrackPopupMenu(GetSubMenu(m_context_menus,12),TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON|TPM_NONOTIFY,p.x,p.y,0,hwndParent,NULL); else r=TrackPopupMenu(GetSubMenu(m_context_menus,0),TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON|TPM_NONOTIFY,p.x,p.y,0,hwndParent,NULL); switch (r) { case ID_TREEITEMCONTEXT_UNMAP:{ int toremove=realmaps[pclicked-1-numofdevices].mapsid; if (mapeditorHWND){ ComboBox_DeleteString(GetDlgItem(mapeditorHWND, IDC_COMBO1),toremove); ComboBox_DeleteString(GetDlgItem(mapeditorHWND, IDC_COMBO2),toremove); } for (int i=toremove;i0){ if (!dlch){ if (pclicked<=numofdevices){ wcscpy(path[0],dnames[pclicked-1].path); pathsfordrives.uj(dnames[pclicked-1].path,_wcsdup(path[0])); wcscpy(wdev,path[0]); }else{ wcscpy(path[0],realmaps[pclicked-1-numofdevices].path); pathsfordrives.uj(realmaps[pclicked-1-numofdevices].path,_wcsdup(path[0])); wcscpy(wdev,realmaps[pclicked-1-numofdevices].name); } } else dlch=false; loadSongList(0); // SetDlgItemText(plugin.hwndLibraryParent,IDC_QUICKSEARCH,L"");// automatically updates the list via EN_CHANGE } } int pclickedtmp; int PluginMessageProc(int message_type, int param1, int param2, int param3) { // check for any global messages here if (message_type >= ML_MSG_TREE_BEGIN && message_type <= ML_MSG_TREE_END) { int j; pclickedtmp=pclicked; pclicked=-1; for (j=0;j<=(numofdevices+numofm);j++){ if (param1 == myParam(j-1)) pclicked=j; } if (pclicked==-1){return 0;} switch (message_type) { case ML_MSG_TREE_ONCREATEVIEW: if (pclicked==0){ return (int)CreateDialog(plugin.hDllInstance,MAKEINTRESOURCE(IDD_INDEX),(HWND)param2,optproc); }else{ if (multiple==0) return (int)CreateDialog(plugin.hDllInstance,MAKEINTRESOURCE(IDD_VIEW_EX),(HWND)param2,dlgproc); else if (multiple==1) return (int)CreateDialog(plugin.hDllInstance,MAKEINTRESOURCE(IDD_VIEW_EX1),(HWND)param2,dlgproc); else return (int)CreateDialog(plugin.hDllInstance,MAKEINTRESOURCE(IDD_VIEW_EX2),(HWND)param2,dlgproc); } case ML_MSG_TREE_ONCLICK: if (pclickedtmp==pclicked&¶m2!=ML_ACTION_RCLICK){sameclicked(); return 0;} if (multiple&&pclickedtmp<1&¶m2==ML_ACTION_RCLICK){ pclicked=0; return 0;}; return onTreeItemClick(param1,param2,(HWND)param3); case ML_MSG_TREE_ONDROPTARGET: droppedto=param1; draggedto=param1; return onTreeItemDropTarget(param1,param2,(void*)param3); case ML_MSG_TREE_ONDRAG: draggedto=param1; return onTreeItemDrag(param1,*(POINT*)param2,(int*)param3); case ML_MSG_TREE_ONDROP: return onTreeItemDrop(param1,*(POINT*)param2); } } else if (message_type == ML_MSG_ONSENDTOBUILD) { if (param1 == ML_TYPE_ITEMRECORDLIST) { mlAddToSendToStruct s; s.context=param2; s.desc="ItemCacheEx"; s.user32=(int)PluginMessageProc; SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&s,ML_IPC_ADDTOSENDTO); } }else if (message_type == ML_MSG_CONFIG){ if (!configHWND) ShowWindow((configHWND=CreateDialog(plugin.hDllInstance,MAKEINTRESOURCE(IDD_DIALOG2),plugin.hwndLibraryParent,config_dlgproc)),SW_SHOW); else{ ShowWindow(configHWND,SW_RESTORE); SetActiveWindow(configHWND); } return true; } return 0; } winampMediaLibraryPlugin plugin ={ MLHDR_VER, "Ultimate ML plugin 1.17", init, quit, PluginMessageProc, }; typedef struct ump { void (*openpath)(TCHAR* filepath, int win); // 0 on success, creates window, etc (if needed) }; ump umpst={ openpath }; extern "C" { __declspec( dllexport ) winampMediaLibraryPlugin * winampGetMediaLibraryPlugin() { return &plugin; } __declspec( dllexport ) ump* return_umlp() { return &umpst; } }; //------------------------------- TCHAR* cc; TCHAR* cplayingt=new TCHAR[MAX_PATH]; int gethash(TCHAR* str){ int h=0; int i=0; while (str[i]){ h=h+str[i]; i++; } return h; } //playing a song: void getcurrent(){ C_ItemList *list=(C_ItemList *)&m_songs[0]; if (!list) return; int x,l=list->GetSize(); for (x = 0 ; x < l; x ++){ Song* s=(Song*)(list->Get(x)); if (wcscmp(playingpath,s->filepath)==0&&s->from==-1){ if (m_songs[0].Get(current[0])){ ((Song*)m_songs[0].Get(current[0]))->iconindex=((Song*)m_songs[0].Get(current[0]))->def_iconindex; ListView_Update(m_list[0].m_hwnd,((Song*)m_songs[0].Get(current[0]))->listpos); } current[0]=x; goto next; } } current[0]=-1; next: if (multiple){ list=(C_ItemList *)&m_songs[1]; if (!list) return; l=list->GetSize(); for (x = 0 ; x < l; x ++){ Song* s=(Song*)(list->Get(x)); if (wcscmp(playingpath,s->filepath)==0&&s->from==-1){ if (m_songs[1].Get(current[1])){ ((Song*)m_songs[1].Get(current[1]))->iconindex=((Song*)m_songs[1].Get(current[1]))->def_iconindex; ListView_Update(m_list[1].m_hwnd,((Song*)m_songs[1].Get(current[1]))->listpos); } current[1]=x; return; } } current[1]=-1; } } LRESULT CALLBACK MWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){ if (message == WM_WA_IPC){ if (lParam==IPC_PLAYING_FILEW) {//started playing #ifdef DEBUGIT _ASSERTE(_CrtCheckMemory( )); _ASSERTE(HeapValidate(GetProcessHeap(),NULL,NULL)); #endif int from=getfrom((TCHAR*)SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)cc,IPC_GET_PLAYING_TITLE)); if (from!=-1){ int er; do{ er=SendMessage(plugin.hwndWinampParent,WM_WA_IPC,from*1000,IPC_JUMPTOTIME); }while(er==-1); } playing=true; playingpath=(TCHAR*)SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)cc,IPC_GET_PLAYING_FILENAME); getcurrent(); if (MYTOP&&(showpcount||showlastp||showfirstp||showplength)){ Song* curs=(Song*)m_songs[0].Get(current[0]); //get time SYSTEMTIME lt; GetLocalTime(<); FILETIME ft; SystemTimeToFileTime(<,&ft); //-------- if (curs){ if (curs->stats){ curs->stats->playcount++; curs->stats->lastplayed=ft; }else{ curs->stats=new SongStat; curs->stats->playcount=1; curs->stats->lastplayed=ft; curs->stats->firstplayed=ft; curs->stats->rating=0; curs->stats->playlength=0; } ListView_Update(m_list[0].m_hwnd,curs->listpos); } if (multiple){ Song* curs=(Song*)m_songs[1].Get(current[1]); if (curs){ if (curs->stats){ curs->stats->playcount++; curs->stats->lastplayed=ft; }else{ curs->stats=new SongStat; curs->stats->playcount=1; curs->stats->firstplayed=ft; curs->stats->lastplayed=ft; curs->stats->rating=0; curs->stats->playlength=0; } ListView_Update(m_list[1].m_hwnd,curs->listpos); } } } } if(lParam==IPC_HOOK_TITLESW){ if (!donothook){ waHookTitleStructW *ht = (waHookTitleStructW *) wParam; int playing=SendMessage(plugin.hwndWinampParent,WM_WA_IPC,0,IPC_ISPLAYING); if (!playing){ cc=new TCHAR[MAX_PATH]; cc[0]=0; cc=(TCHAR*)SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)cc,IPC_GET_PLAYING_FILENAME); if (wcscmp(cc,ht->filename)==0){ cc=(TCHAR*)SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)cc,IPC_GET_PLAYING_TITLE); if (getfrom(cc)!=-1){ lstrcpyn(ht->title,cc,MAX_PATH); return TRUE; } } }else if (getfrom(ht->title)!=-1) return TRUE; }else donothook=false; } } return CallWindowProc(lpWndProcOld,hwnd,message,wParam,lParam); } //blinking: DWORD WINAPI VILL( LPVOID lpParameter){ int count=0; int state=1; int oldpl=0; while (1){ oldpl=playing; playing=SendMessage(plugin.hwndWinampParent,WM_WA_IPC,0,IPC_ISPLAYING); if (playing==1){ TCHAR* tmpbuf=new TCHAR[128]; tmpbuf[0]=0; if (current[0]!=-1){ Song* curs=(Song*)m_songs[0].Get(current[0]); if (curs){ if (!showplaying||state==1) (curs)->iconindex=curs->def_iconindex; else curs->iconindex=ujicon+1; if (MYTOP&&curs->stats){ curs->stats->playlength++; curs->stats->rating++; } ListView_Update(m_list[0].m_hwnd,curs->listpos); } } if (multiple&¤t[1]!=-1){ Song* curs=(Song*)m_songs[1].Get(current[1]); if (curs){ if (!showplaying||state==1) curs->iconindex=curs->def_iconindex; else curs->iconindex=ujicon+1; if (MYTOP&&curs->stats){ curs->stats->playlength++; curs->stats->rating++; } ListView_Update(m_list[1].m_hwnd,curs->listpos); } } } else if (oldpl==1&&showplaying){ Song* curs=NULL; if (current[0]!=-1){ curs=(Song*)m_songs[0].Get(current[0]); if (curs){ curs->iconindex=curs->def_iconindex; ListView_Update(m_list[0].m_hwnd,curs->listpos); } } if (multiple&¤t[1]!=-1){ curs=(Song*)m_songs[1].Get(current[1]); if (curs){ curs->iconindex=curs->def_iconindex; ListView_Update(m_list[1].m_hwnd,curs->listpos); } } } state=state*-1; Sleep(1000); } }