Develop and Download Open Source Software

Browse Subversion Repository

Contents of /old/myfilemv.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 53 - (show annotations) (download)
Mon Apr 28 10:03:00 2008 UTC (16 years, 1 month ago) by tabasa
File MIME type: text/plain
File size: 73481 byte(s)
tab_key bug fix: set focus to other list window
1
2 // filemv
3
4 #define _main
5 #include "defextern.h"
6
7
8 #ifndef STRICT
9 #define STRICT
10 #endif
11 #include <stdio.h>
12 #include <fstream.h>
13 #include <windows.h>
14 #include <windowsx.h>
15 #include <commctrl.h>
16 #include "resource.h"
17 #include "myfilemv.h"
18 #include "initial.h"
19 #include "file.h"
20 #include "batch.h"
21 #include "mode.h"
22 #include "edit.h"
23 #include "status.h"
24 #include "listview.h"
25 #include "keyboard.h"
26 #include "mainmsg.h"
27 #include "paintflag.h"
28 #include "zip.h"
29 #include "filecopy.h"
30 #include "spi.h"
31 #include "main.h"
32 #include "mciplay.h"
33 #include "tab.h"
34 #include "tabs.h"
35 #include "mousegesture.h"
36 #include "luacall.h"
37
38 #include "winpaint.h"
39
40 extern mousecommand mc;
41
42
43 typedef struct _tagFNAME{
44 char szFName[MAX_PATH];
45 char szLocalFileName[MAX_PATH];
46 char path[MAX_PATH];
47 } FNAME;
48
49 FNAME myfname;
50
51 BOOL localrename(HWND, HWND ,dirw * ,FNAME *);
52
53 void MyDown(HWND, HWND, HWND);
54 int SetMyLocalDir(HWND, dirw &, HIMAGELIST);
55 void ChangeLocalDrive(HWND, dirw &, HIMAGELIST);
56 void MyUp(HWND, HWND, HWND);
57 void MyCutUp(DWORD,DWORD);
58 void MyCutHere(DWORD,DWORD);
59 HWND MakeMyList(HWND);
60 void InsertMyColumn(HWND);
61 void MyCopyHere(HWND, dirw &, HWND);
62 BOOL MyDragCopy(char *from,dirw &Tdir);
63
64 BOOL MyFilter(HWND hWnd);
65 HWND MakeMyList(HWND hWnd,int id);
66 LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
67 LRESULT CALLBACK ListLProc(HWND, UINT, WPARAM, LPARAM);
68 LRESULT CALLBACK ListRProc(HWND, UINT, WPARAM, LPARAM);
69 LRESULT CALLBACK TabProc(HWND, UINT, WPARAM, LPARAM);
70 LRESULT CALLBACK FileEditProc(HWND, UINT, WPARAM, LPARAM);
71 LRESULT CALLBACK DirLEditProc(HWND, UINT, WPARAM, LPARAM);
72 LRESULT CALLBACK DirREditProc(HWND, UINT, WPARAM, LPARAM);
73 LRESULT CALLBACK DrvListProc(HWND, UINT, WPARAM, LPARAM);
74 LRESULT CALLBACK GetLenProc(HWND, UINT, WPARAM, LPARAM);
75 LRESULT CALLBACK GetNameProc(HWND, UINT, WPARAM, LPARAM);
76 LRESULT CALLBACK MyGetFNameProc(HWND, UINT, WPARAM, LPARAM);
77 LRESULT CALLBACK MyDriveProc(HWND, UINT, WPARAM, LPARAM);
78 LRESULT CALLBACK MyCreateDirProc(HWND, UINT, WPARAM, LPARAM);
79 LRESULT CALLBACK MyTextProc(HWND, UINT, WPARAM, LPARAM);
80
81 void setsel(HWND, char *);
82 void CompareList(HWND hList1, HWND hList2);
83 void CompareList_Size(HWND hList1, HWND hList2);
84 void CompareList_Date(HWND hList1, HWND hList2);
85 void setCTab(int tab);
86
87 void SelectReverse(HWND hList);
88 void getlnkstr(char *f, char *buf);
89 BOOL MyZip(dirw &Fdir,dirw &Tdir,HWND hList);
90 BOOL MyLzh(dirw &Fdir,dirw &Tdir,HWND hList);
91 BOOL MyUnLzh(dirw &Fdir,dirw &Tdir,HWND hList);
92
93 WNDPROC OldTabProc;
94 WNDPROC OldDirLEdit;
95 WNDPROC OldDirREdit;
96 WNDPROC OldDrvList;
97 WNDPROC OldEdit;
98 WNDPROC OldListR;
99 WNDPROC OldListL;
100
101 char FilterAll[]= "*.*";
102 char FilterAuto[]= "*.tfa";
103 char Filter[MAX_FILTER]= "*";
104 char setname[MAX_PATH];
105 char file[ListItemLen];
106 char sizestr[ListItemLen];
107
108
109 DWORD dw;
110
111 char dragfile[MAX_PATH];
112 char picfile[MAX_PATH];
113 char commandline[MAX_PATH*3];
114 BOOL commandflag;
115 DWORD start,len;
116
117
118 char markon[]="<>";
119 char markoff[]="[]";
120
121 dirw LDir(tab_l),RDir(tab_r);
122 extern tabItem *tip[100];
123
124
125 dirw *NDir =&LDir;
126 dirw *NXDir =&RDir;
127 int ind;
128 HWND NList,NXList;
129
130
131
132
133 dirw *GetNDir()
134 {
135 return NDir;
136 }
137
138 dirw *GetNXDir()
139 {
140 return NXDir;
141 }
142
143 dirw *GetLDir()
144 {
145 return &LDir;
146 }
147
148 dirw *GetRDir()
149 {
150 return &RDir;
151 }
152
153 char *GetLPath()
154 {
155 return LDir.cd();
156 }
157
158 char *GetRPath()
159 {
160 return RDir.cd();
161 }
162
163 char *GetNPath()
164 {
165 if(NDir!=NULL) return NDir->cd();
166 else return NULL;
167 }
168
169 char *GetNFile()
170 {
171 return file;
172 }
173
174 int GetNTab()
175 {
176 int i=0;
177 if(NDir!=NULL) i=NDir->getLR();
178 return i;
179 }
180
181 char *GetNXPath()
182 {
183 return NXDir->cd();
184 }
185
186 HWND getMainEdit()
187 {
188 return hEdit;
189 }
190
191 struct iset{
192 int from;
193 int to;
194 } ;
195
196 int WINAPI WinMain(HINSTANCE hCurInst, HINSTANCE hPrevInst,
197 LPSTR lpsCmdLine, int nCmdShow)
198 {
199 MSG msg;
200 HACCEL hAccel;
201
202 if (!InitApp(hCurInst))
203 return FALSE;
204 wsprintf(commandline,"%s",lpsCmdLine);
205
206 if (!InitInstance(hCurInst, nCmdShow))
207 return FALSE;
208
209
210 hAccel = LoadAccelerators (hCurInst, "ACCEL") ;
211 while (GetMessage(&msg, NULL, 0, 0)) {
212 if (!TranslateAccelerator (hmainwnd, hAccel, &msg))
213 {
214 TranslateMessage(&msg);
215 DispatchMessage(&msg);
216 }
217 }
218 /*
219 if (!InitApp(hCurInst))
220 return FALSE;
221 if (!InitInstance(hCurInst, nCmdShow))
222 return FALSE;
223 while (GetMessage(&msg, NULL, 0, 0)) {
224 TranslateMessage(&msg);
225 DispatchMessage(&msg);
226 }*/
227 return msg.wParam;
228 }
229
230 //�E�B���h�E�E�N���X���o�^
231
232 ATOM InitApp(HINSTANCE hInst)
233 {
234 WNDCLASSEX wc;
235 wc.cbSize = sizeof(WNDCLASSEX);
236 wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
237 wc.lpfnWndProc = WndProc; //�v���V�[�W����
238 wc.cbClsExtra = 0;
239 wc.cbWndExtra = 0;
240 wc.hInstance = hInst;//�C���X�^���X
241 wc.hIcon = LoadIcon(hInst, "APICON");
242 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
243 wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
244 wc.lpszMenuName = "MYMENU"; //���j���[��
245 wc.lpszClassName = (LPCSTR)szClassName;
246 wc.hIconSm = LoadIcon(hInst, "APICON");
247 return (RegisterClassEx(&wc));
248 }
249
250
251 #define WS_ME (WS_OVERLAPPED | \
252 WS_SYSMENU | \
253 WS_THICKFRAME | \
254 WS_MINIMIZEBOX | \
255 WS_MAXIMIZEBOX)
256
257 //�E�B���h�E������
258
259 BOOL InitInstance(HINSTANCE hInst, int nCmdShow)
260 {
261
262 hmainwnd = CreateWindow(szClassName,
263 appname, //�^�C�g���o�[���������O���\����������
264 WS_OVERLAPPEDWINDOW, //�E�B���h�E������
265 CW_USEDEFAULT, //�w���W
266 CW_USEDEFAULT, //�x���W
267 CW_USEDEFAULT, //��
268 CW_USEDEFAULT, //����
269 NULL, //�e�E�B���h�E���n���h���A�e������������NULL
270 NULL, //���j���[�n���h���A�N���X���j���[���g��������NULL
271 hInst, //�C���X�^���X�n���h��
272 NULL);
273 if (!hmainwnd)
274 return FALSE;
275 ShowWindow(hmainwnd, nCmdShow);
276 UpdateWindow(hmainwnd);
277 ::hInst=hInst;
278 return TRUE;
279 }
280
281
282
283 void menusetting(HWND hwnd)
284 {
285 hMenuMenu =LoadMenu(hInst, "menumenu" );
286 hPopMenuMenu =GetSubMenu(hMenuMenu,1);
287 hTestMenu =LoadMenu(hInst, "mymenu2" );
288 hMemoMenu =GetSubMenu(hTestMenu,1);
289 hMenu =GetMenu(hwnd);
290 hMainMenu =GetMenu(hwnd);
291 hFileMenu =GetSubMenu(hMenu, 0);
292 hLeftMenu =GetSubMenu(hMenu, 1);
293 hRMenu =GetSubMenu(hMenu, 3);
294 hEditMenu =GetSubMenu(hMenu, 3);
295 hRemoteMenu =GetSubMenu(hMenu, 4);
296 hBothMenu =GetSubMenu(hMenu, 6);
297 hSendtoMenu =GetSubMenu(hLeftMenu, 0);
298 hSessionMenu =GetSubMenu(hMenu, 1);
299 hFindMenu =GetSubMenu(hMenu, 2);
300 hPopDefMenu =hLeftMenu;
301 for (int n=0; n<TOPMENUNUM; n++) hSubPop[n] =GetSubMenu(hMenu, n);
302 }
303
304 HBRUSH hbrush;
305
306 HBRUSH setBrush()
307 {
308 DeleteObject(hbrush);
309 return CreateSolidBrush(listtextBkColor);
310 }
311
312 HBRUSH initBrush()
313 {
314 return CreateSolidBrush(GRAY_BRUSH);
315 }
316
317 void EditMenuInit()
318 {
319 UINT flag = geteditflag() ? MF_ENABLED : MF_GRAYED ;
320 EnableMenuItem( hEditMenu, GetMenuItemID(hEditMenu,0), flag );
321 }
322
323 void FncCommandline(char* commandline,char* pathname)
324 {
325 int i=0;
326
327 /*
328 if(commandline[i]=='/')
329 {
330 i++;
331 if(commandline[i]=='p'||commandline[i]=='P')
332 {
333 i++;
334 }
335 }
336 */
337 while(commandline[i]==' '||commandline[i]=='\t')i++;
338
339 for(int j=0;i<strlen(commandline);i++)
340 if(commandline[i]!='\"')
341 {
342 pathname[j]=commandline[i];
343 j++;
344 }
345 }
346
347 struct strsets{
348 char *title;
349 char *val;
350 } strseti;
351
352 strsets strs;
353 strsets *strsp=&strs;
354
355 BOOL GetStrDlg(char *title, char *buf, char *val=NULL)
356 {
357 strsp->title=buf;
358 strsp->val=val;
359 if(title!=NULL) strcpy(strsp->title, title);
360 /*strcpy(buf, title);*/
361 if( DialogBoxParam(hInst, "MYCREATEDIR", hmainwnd,
362 (DLGPROC)MyCreateDirProc, (LPARAM) strsp)
363 == IDCANCEL)
364 return FALSE;
365 else
366 return TRUE;
367 }
368
369
370 void memoSwitch()
371 {
372 if(MemoMode == _ON)
373 {
374 if( mode == W_MODE_EDITONLY ) {
375 setmode(W_MODE_LISTnEDIT);
376 }
377 mainMsg(IDM_NEW_MEMO);
378 }
379 else
380 {
381 SetFocus(NDir->getEdit());
382 }
383 }
384
385 void saveTemp(HWND edit)
386 {
387 if(MemoMode ==_ON)
388 {
389 }
390 else
391 {
392 saveTempo(edit);
393 }
394 }
395
396 //�e�L�X�g�t�@�C���@�����\������
397
398 LRESULT CALLBACK FileEditProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
399 {
400 DWORD key;
401 POINT pt,crpt;
402 pt.x = LOWORD(lp);
403 pt.y = HIWORD(lp);
404 key =keyfnc(wp);
405
406 if(msg == WM_COMMAND )
407 {
408 mainMsg(LOWORD(wp)); // ������������������������
409 }
410 if(msg == WM_KEYUP )
411 keylog( hWnd, wp );
412 if(msg == WM_RBUTTONDOWN )
413 {
414 if (GetKeyState(VK_CONTROL) < 0)
415 TrackPopupMenu(hFileMenu, TPM_LEFTALIGN | TPM_TOPALIGN,
416 pt.x, pt.y, 0, hWnd, NULL);
417 if (GetKeyState(VK_SHIFT) < 0)
418 TrackPopupMenu(hMemoMenu, TPM_LEFTALIGN | TPM_TOPALIGN,
419 pt.x, pt.y, 0, hWnd, NULL);
420 }
421 if(msg == WM_KILLFOCUS)
422 {
423 GetCaretPos(&crpt);
424 saveMemo(hWnd);
425 //Mes(crpt.x);
426 }
427 if(msg == WM_SETFOCUS)
428 {
429 //SetCaretPos(crpt.x, crpt.y);//10,10);//
430 }
431 if(msg == WM_KEYDOWN )
432 {
433 switch(key)
434 {
435 case VK_F12 :
436 memoSwitch();
437 return 0;
438 case 'W' +kCONTROL :
439 msgWinmode();
440 return 0;
441 case 'S' +kCONTROL :
442 mainMsg(IDM_OVERWRITE);//saveTemp(hWnd);
443 return 0;
444 case VK_ESCAPE :
445 memoSwitch();
446 //resize();
447 return 0;
448 default :
449 break;
450 }
451 }
452 return CallWindowProc(OldEdit, hWnd, msg, wp, lp);
453 }
454
455
456 void resettxt()
457 {
458 NDir->resetEditText();
459 NXDir->resetEditText();
460 }
461
462 LRESULT CALLBACK DEditProc(WNDPROC oldproc, int id, dirw &dir, HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
463 {
464 RECT rect;
465 PAINTSTRUCT ps;
466 HDC hdc;
467 //static int oid;
468 char buffer[MAX_PATH];
469 char written[MAX_PATH];
470 char bufferB[MAX_PATH];
471 if(msg == WM_PAINT) {
472 GetClientRect (hWnd, &rect) ;
473 hdc =BeginPaint(hWnd, &ps);
474 SetBkMode(hdc, OPAQUE);
475 SelectObject( hdc, hbrush ) ;
476 if(paintf) Rectangle(hdc,rect.left,rect.top,rect.right,rect.bottom);
477 EndPaint(hWnd,&ps);
478 InvalidateRect(hWnd,&rect,FALSE);
479 }
480 if(msg == WM_SETFOCUS )
481 {
482 //setCTab(dir.getTabpos());
483 //SetCurSel( hTab, dir.getTabpos());
484 selectSet( dir, hTab );
485 //if(msg == WM_LBUTTONDOWN )Mes( dir.cd());
486 //setstatus( dir.cd());
487 }
488 if(msg == WM_KILLFOCUS)
489 {
490 resettxt();
491 getnextpath(id,"","", 1);
492 }
493 if(msg == WM_KEYDOWN)
494 {
495 if( wp == VK_ESCAPE )
496 {
497 if(MemoMode == _ON) {mainMsg( IDM_NEW_MEMO );}
498 else {
499 if(mode == W_MODE_EDITONLY) {
500 listmode();
501 resize();
502 }
503 SetFocus(hMainWnd);
504 }
505 return 0;
506 }
507 if( wp == VK_RETURN )
508 {
509 if (GetKeyState(VK_SHIFT) < 0) {
510 GetWindowText(hWnd, written, BUFFER_LEN);
511 //dir.cd(written);
512 ShellExecute(NULL, "open", "explorer", written, NULL, SW_SHOW);
513 //mainMsg( IDM_OPEN_CUR );
514 }
515 else {
516 SendMessage(hMainWnd, WM_COMMAND, MAKELONG( id, BN_CLICKED ), 0);
517 }
518 }
519 if( wp == VK_TAB )
520 {
521 GetWindowText(hWnd, written, BUFFER_LEN);
522 wsprintf(buffer, "%s", dir.cd());
523 if( getnextpath(id, buffer, written) ==_DIR )
524 SetWindowText(hWnd, buffer);
525 else
526 {
527 SetWindowText(hWnd, dir.cd());
528 }
529 return 0;
530 }
531 else
532 {
533 getnextpath(id, buffer, written, 1);
534 }
535 switch (keyfnc(wp))
536 {
537 case VK_F12:
538 mainMsg( IDM_NEW_MEMO );
539 break;
540 case VK_LEFT +kCONTROL:
541 mainMsg( IDM_HIS_BackNoReload);
542 break;
543 case VK_RIGHT +kCONTROL:
544 mainMsg( IDM_HIS_ForwNoReload);
545 break;
546 }
547 }
548 return CallWindowProc( oldproc, hWnd, msg, wp, lp);
549 }
550
551 LRESULT CALLBACK DirLEditProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
552 {
553 return DEditProc( OldDirLEdit, ID_DIRL, LDir, hWnd, msg, wp, lp);
554 }
555
556 LRESULT CALLBACK DirREditProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
557 {
558 return DEditProc( OldDirREdit, ID_DIR, RDir, hWnd, msg, wp, lp);
559 }
560
561 LRESULT CALLBACK TabProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
562 {
563 return CallWindowProc( OldTabProc, hWnd, msg, wp, lp);
564 }
565
566 LRESULT CALLBACK ListRProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
567 {
568 return ListProc( RDir, OldListR, hWnd, msg, wp, lp );
569 }
570
571
572 LRESULT CALLBACK ListLProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
573 {
574 return ListProc( LDir, OldListL, hWnd, msg, wp, lp );
575 }
576
577
578 LRESULT CALLBACK DrvListProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
579 {
580 static HWND hParent;
581 switch(msg)
582 {
583 case WM_KEYDOWN :
584 if ( wp == VK_RETURN ) SendMessage(hParent, WM_COMMAND, MAKELONG( IDOK ,0 ), 0);
585 break;
586 case WM_LBUTTONDBLCLK :
587 hParent = GetParent(hWnd);
588 SendMessage(hParent, WM_COMMAND, MAKELONG( IDOK ,0 ), 0);
589 break;
590 default :
591 break;
592 }
593 return CallWindowProc(OldDrvList, hWnd, msg, wp, lp);
594 }
595
596 COLORREF getItemTextColor(HWND list, int id, COLORREF def)
597 {
598 ListView_GetItemText(list, id, pos.ext, buffer, ListItemLen);
599 if(strcmp(buffer,extpaint) == 0) return listtextSpColor;
600 else if( ! paintf ) return def;
601 else return listtextColor;
602 }
603
604
605 LRESULT CALLBACK colorchange(HWND list, LPNMHDR lpnmhdr, HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
606 {
607 LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW) lpnmhdr;
608 int id;
609 COLORREF clr;
610
611 switch ( lplvcd->nmcd.dwDrawStage ) {
612 case CDDS_PREPAINT:
613 return CDRF_NOTIFYITEMDRAW;
614 case CDDS_ITEMPREPAINT:
615 id = lplvcd->nmcd.dwItemSpec;
616 clr = getItemTextColor(list, id, lplvcd->clrText);
617 lplvcd->clrText = clr;
618 //lplvcd->clrTextBk = listtextBkColor;
619 return CDRF_NEWFONT;
620 }
621 return FORWARD_WM_NOTIFY (hWnd, msg, lpnmhdr, DefWindowProc );
622 }
623
624
625 void setpicflg(dirw *Dir)
626 {
627 picshowflg =((clickpic||CurrentPicshow) && (bmpflg || isPicflg));
628
629 if(picshowflg ) {
630 wsprintf(picfile,"%s\\%s",Dir->cd(),file);
631 win.resetOrg();
632 InvalidateRect(hmainwnd,NULL,FALSE);
633 }
634 }
635
636 BOOL isdirectory(char* buf)
637 {
638 return (strncmp(buf, dirmark,5) == 0);
639 }
640
641 void Enter(char *szDir, char *szBuf, HWND hWnd, int tab)
642 {
643 if( NDir->ishis() )
644 {
645 }
646 // folder������������
647 else if ( !isdirectory(szBuf)) {
648 NDir->cd(".");
649 if(checkbatch(szDir))
650 {
651 commandflag=TRUE;
652 SendMessage(hWnd,WM_DROPFILES,0,0);
653 }
654 else if(checkExt(szDir,"lnk"))
655 {
656 getlnkstr(szDir,commandline);
657 NDir->cd(commandline);
658 reloadtab();
659 }
660 else ShellExecute(NULL, "",szDir, "", NULL, SW_SHOW);
661 return;
662 }
663 NDir->cd(szDir);
664 reloadtab();
665 }
666
667 void setCTab(int tab)
668 {
669 if(tab==tab_l){
670 NDir =&LDir;
671 NXDir =&RDir;
672 NList =hListL;
673 NXList =hList;
674 }
675 if(tab==tab_r){
676 NDir =&RDir;
677 NXDir =&LDir;
678 NList =hList;
679 NXList =hListL;
680 }
681 // setstatus(NDir->cd());
682 }
683
684
685 int othertab(int t)
686 {
687 return (t==tab_l ? tab_r : tab_l);
688 }
689
690 LRESULT CALLBACK ListNotify(int tab, dirw *NDir, char *szDir, char *szBuf, int iIndex, HWND hWnd, WPARAM wp, LPARAM lp)
691 {
692 static LPNMHDR lpnmhdr;
693 static int sortsubno[NO_OF_SUBITEM] = {UP};
694 static int isortsubno=pos.date;//�����T�u�A�C�e�����\�[�g������������
695 SORTDATA SortData;
696 NMLISTVIEW *pNMLV;
697 char tmp[MAX_PATH];
698 lpnmhdr = (LPNMHDR)lp;
699 switch (lpnmhdr->code) {
700 case NM_DBLCLK:
701 hLastList = lpnmhdr->hwndFrom;
702 if( ( LeftTreeMode == _ON && tab == tab_l) ||
703 ( RightTreeMode == _ON && tab == tab_r) )
704 {
705 wsprintf(commandline,"%s\\%s",NDir->cd(),szDir);
706 NXDir->cd(commandline);
707 SetWindowText(NXDir->getEdit(),commandline);
708 //setCTab(othertab(tab));
709 reloadother();
710 break;
711 }
712 Enter(szDir, szBuf, hWnd, tab);
713 break;
714 case NM_RDBLCLK:
715 break;
716 case NM_CLICK:
717 hLastList = lpnmhdr->hwndFrom;
718 break;
719 case LVN_KEYDOWN:
720 ListKeyFunc(hWnd,WM_NOTIFY,wp,lp,tab, 0);
721 break;
722 case LVN_ITEMCHANGED://NM_CLICK:
723 hLastList = lpnmhdr->hwndFrom;
724 //editmode();mode != W_MODE_LIST &&
725 if (!isdirectory(szBuf))
726 {
727 if(autoedit)autooverwrite(hEdit);
728 seteditflag(TRUE);
729 setfile(hEdit,szDir,NDir->cd());
730 }
731 // folder������
732 else
733 {
734 seteditflag(FALSE);
735 SetWindowText(hEdit,"folder");
736 }
737 setstatusspace(iIndex+1,NDir->GetItemNum(),NDir->GetSpace(),NDir->GetTotal());
738 setstatusonly(szDir);
739 CurrentPicshow =FALSE;
740 bmpflg =checkExt(file, "bmp");
741 isPicflg =FALSE;
742 if( spiPath || spiCdir ) {
743 isPicflg = checkExts(file, getPicExts());
744 }
745 setpicflg(NDir);
746 if ( isPicflg || !isdirectory(szBuf)) resize();
747 resettitle();
748 break;
749 case LVN_COLUMNCLICK:
750 pNMLV = (NMLISTVIEW *)lp;
751 isortsubno = pNMLV->iSubItem;
752 if (sortsubno[isortsubno] == UP)
753 sortsubno[isortsubno] = DOWN;
754 else
755 sortsubno[isortsubno] = UP;
756 SortData.hwndList = NDir->getList();
757 SortData.isortSubItem = isortsubno;
758 SortData.iUPDOWN = sortsubno[isortsubno];
759 if(ListView_SortItems(NDir->getList(), MyCompProc, &SortData) != TRUE)
760 setstatusonly("�\�[�g���s");
761 break;
762 case NM_CUSTOMDRAW:
763 return colorchange(((LPNMHDR)lp)->hwndFrom, lpnmhdr, hWnd, WM_NOTIFY, wp, lp);
764 default:
765 return 0;//DefWindowProc(hWnd, WM_NOTIFY, wp, lp);
766 }
767 return 0;
768 }
769
770
771 void setfilter(char *str =Filter)
772 {
773 wsprintf(Filter,"%s", str);
774 savefilter(str);
775 filefilter =Filter;
776 }
777
778 void getlnkstr(char *f, char *buf)
779 {
780 char buff[2000];
781 char *p;
782 ifstream in(f,ios::binary);
783
784 int i=0;
785 while(i<2000)
786 {
787 if(!in) in.clear();
788 in.seekg(i,ios::beg);
789 in.read(buff,2000);
790 //p=strrchr(buff,':');
791 if(buff[0]=='D') {strcpy(buf,buff);}
792 i++;
793 }
794 }
795
796
797 void redraw()
798 {
799 ShowWindow( hmainwnd, SW_HIDE);
800 ShowWindow( hmainwnd, SW_SHOW);
801 }
802
803 void setselbuf(int iIndex, char *szDir, char *szBuf, HWND NList)
804 {
805 szBuf[0]=0;
806 ListView_GetItemText(NList, iIndex, pos.name, szDir, MAX_PATH);
807 ListView_GetItemText(NList, iIndex, pos.size, szBuf, MAX_PATH);
808 }
809
810 void setlistbuffers(int tab, int iIndex, char *szDir, char *szBuf, HWND NList, char *file)
811 {
812 setCTab(tab);
813 iIndex = ListView_GetNextItem(NList, -1, LVNI_SELECTED);
814 //iIndex = ListView_GetHotItem(NList);
815 setselbuf(iIndex, szDir, szBuf, NList);
816 strcpy(file,szDir);
817 strcpy(sizestr,szBuf);
818 }
819
820 int fnc()
821 {
822 static int it=0;
823 it+=3;
824 return it;
825 }
826
827 // folder�����B�s���S
828 BOOL isnotDir(char *dir)
829 {
830 if(strlen(dir)<2) return FALSE;
831 if( strncmp(dir,"http",4) ==0 ) return TRUE;
832 if( strchr(dir,'\%') !=NULL ) return TRUE;
833 if( strncmp(dir,"ftp",3) ==0 ) return TRUE;
834 if( (strchr(dir,'\\')==NULL||strchr(dir,'/')==NULL) && strchr(dir,':')==NULL ) return TRUE;
835 return FALSE;
836 }
837
838 void asknGo( dirw &Dir, char *com)
839 {
840 if( MessageBox(Dir.getEdit(),"���s���������H",cmdDirect( "", Dir.cd(), com), MB_OKCANCEL)==IDOK )
841 {
842 myexec( cmdDirect( "", Dir.cd(), com) );
843 Dir.savedir(com);
844 }
845 }
846
847 void reload( HWND hWnd, dirw &Dir, SORTDATA &SortData, int subno, int up, HIMAGELIST &hImage)
848 {
849 if(isnotDir(Dir.cd()) )
850 {
851 asknGo(Dir, Dir.cd());
852 return;
853 }
854 resetshowpic();
855 Dir.cd(".");
856 Dir.SetItemNum( SetMyLocalDir(hWnd, Dir, hImage) );
857 SortData.hwndList = Dir.getList();
858 SortData.isortSubItem = subno;
859 SortData.iUPDOWN = up;
860 ListView_SortItems( Dir.getList(), MyCompProc, &SortData);
861 filefilter=FilterAll;//reset
862 SetFocus( Dir.getList());
863 }
864
865 // reload button click�@/ �t�H���_�����G���^�[�L�[ �����������B
866 // folder���������������������������������������������R�}���h���������s�B
867
868
869 void reloadClick( char *szDir, dirw &Dir, int tab)
870 {
871 char buffer[CommandLen];
872 GetWindowText( Dir.getEdit(),szDir,MAX_PATH);
873 strcpy(commandline, szDir);
874 if(setenv(commandline))
875 {
876 mainMsg(IDM_COM_list);
877 return;
878 }
879 TransEnv(commandline, buffer);
880 if(isnotDir( buffer ) || strcmp(buffer,szDir)!=0)
881 {
882 asknGo( Dir, commandline);
883 }
884 else {
885 Dir.cd( buffer );
886 reloadtab(tab);
887 }
888 }
889
890
891 HDC mem=NULL;
892 HDC bmpmem=NULL;
893 HLOCAL hBInfo= NULL;
894 HLOCAL hBm= NULL;
895 HBITMAP hBitmap=NULL;
896 HBITMAP hBitmapOrg;
897
898 char lastPicFile[MAX_PATH]="";
899
900
901
902 void readpic(HDC &hdc, HDC &mem, int x, int y, float picrate, char *picfile)
903 {
904 if ( ! spiLoad(picfile) ) return;
905
906 int scX,scY;
907 int topX,topY;
908 BYTE *pBm;
909 BITMAPINFO *pBInfo;
910 BITMAPINFO BInfo;
911
912 scX=GetSystemMetrics(SM_CXFULLSCREEN);
913 scY=GetSystemMetrics(SM_CYFULLSCREEN);
914 loadbmp(picfile,hBInfo,hBm);
915 pBInfo = (BITMAPINFO*)LocalLock(hBInfo);
916 topX =pBInfo->bmiHeader.biWidth;
917 topY =pBInfo->bmiHeader.biHeight;
918 int btmy =max(0,topY -scY);
919 int FrX =(scX +x)/picrate;
920 int ToX =scX;
921 int FrY =(scY +btmy +y)/picrate;
922 int ToY =scY +btmy;
923 if( hBitmap ==NULL ) hBitmap = CreateCompatibleBitmap(hdc,scX,scY);
924 SelectObject(mem,hBitmap);
925 pBm = (BYTE*)LocalLock(hBm);
926 DWORD size =pBInfo->bmiHeader.biSizeImage;
927 StretchDIBits(
928 mem,
929 0,
930 0,
931 ToX,
932 ToY,
933 x /picrate,
934 y /picrate,
935 FrX,
936 FrY,
937 pBm,
938 pBInfo,
939 DIB_RGB_COLORS,
940 SRCCOPY);
941
942 LocalUnlock(hBInfo);
943 LocalUnlock(hBm);
944 FreeSpi();
945 }
946
947
948 void memmap(BOOL end=TRUE, int x=0, int y=0, float picrate=0)
949 {
950 char *pdata;
951 if(picrate<1) picrate =1; //�k������������������������
952 static BITMAP bmp;
953 HDC hdc;
954 if(end)
955 {
956 if(mem!=NULL)
957 {
958 //
959 //DeleteDC(bmpmem);
960 DeleteObject(hBm);
961 DeleteObject(hBitmap);
962 //DeleteObject(hBitmapOrg);
963 DeleteDC(mem);
964 mem =NULL;
965 hBitmap =NULL;
966 }
967 return ;
968 }
969 else
970 {
971 if(mem==NULL)
972 {
973 hdc =GetDC(hmainwnd);
974 mem = CreateCompatibleDC(hdc);
975 }
976 }
977 //if( strcmp(picfile, lastPicFile) == 0) return;
978 strcpy(lastPicFile, picfile);
979
980 if(bmpflg)
981 {
982 hBm = (HBITMAP) LoadImage(hInst, picfile, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
983 GetObject(hBm, sizeof(BITMAP), &bmp);
984 SelectObject(mem, hBm);
985 }
986 if(isPicflg || CurrentPicshow)
987 {
988 readpic( hdc, mem, x, y, picrate, picfile);
989 }
990 ReleaseDC(hmainwnd ,hdc);
991 return ;
992
993 }
994
995 void memmapReset()
996 {
997 memmap();
998 }
999
1000
1001 LRESULT CALLBACK bmppaint(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp, char *file)
1002 {
1003 HDC hdc;
1004 HBITMAP hBitmap;
1005 BITMAP *bmp;
1006 PAINTSTRUCT ps;
1007 RECT rect;
1008
1009 if (bmpflg || isPicflg || CurrentPicshow)
1010 {
1011 hdc = BeginPaint(hWnd, &ps);
1012 GetWindowRect(hWnd, &rect);
1013 memmap(FALSE, win.OrgX(), win.OrgY(), win.rate());
1014 if(paintf) ;//Rectangle(hdc,rect.left,rect.top,rect.right,rect.bottom -win.getStatush());
1015 win.BitBlt(hdc, mem);//, rect.right -rect.left, rect.bottom -rect.top);
1016 EndPaint(hWnd, &ps);
1017 return 0;
1018 }
1019 else
1020 {
1021 return (DefWindowProc(hWnd, msg, wp, lp));
1022 }
1023 }
1024
1025
1026 void AutoFind( HWND id, HWND &dir)
1027 {
1028 static char current[CommandLen];
1029 {
1030 GetWindowText( id, current,100) ;
1031 if(current[0]=='?') setsel( dir, current+1);
1032 }
1033 }
1034
1035
1036
1037 void vEnd()
1038 {
1039 MciStop() ;
1040 MciEnd() ;
1041 videoIn =FALSE;
1042 }
1043
1044
1045 void mciStart(char *fi, char *path)
1046 {
1047 int stat=MciStatus();
1048 if(mciPlaying && stat==mci_stopped )
1049 {
1050 vEnd();
1051 videoIn=FALSE;
1052 InvalidateRect(hmainwnd,0,TRUE);
1053 mciPlaying =FALSE;
1054 setstatus(".");
1055 }
1056 if(!mciPlaying)
1057 {
1058 MciOpen(fi, hmainwnd) ;
1059 MciPlay() ;
1060 mciPlaying =TRUE;
1061 // videoIn =TRUE;
1062 InvalidateRect(hmainwnd,0,TRUE);
1063 setstatus("mci Playing");
1064 }
1065 else
1066 {
1067 vEnd();
1068 videoIn=FALSE;
1069 InvalidateRect(hmainwnd,0,TRUE);
1070 mciPlaying =FALSE;
1071 setstatus(".");
1072 }
1073 }
1074
1075
1076 char *getDriveStr(WORD id)
1077 {
1078 static char dr[10]="a:\\";
1079 dr[0]+= (id -IDM_DRIVE_A);
1080 return dr;
1081 }
1082
1083
1084 dirw *GetDirFromPos( int x)
1085 {
1086 if( x <HIWORD(sizelp)/2 ) return &LDir;
1087 else return &RDir;
1088 }
1089
1090 // ���C���E�E�B���h�E�@�v���V�[�W��
1091
1092 LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
1093 {
1094 static int id, iIndex, tab;
1095 MENUITEMINFO minfo;
1096 static HINSTANCE hInst;
1097 RECT rc;
1098 static dirw *tmpdir;
1099 static RECT Max, Ini, Last;
1100 PAINTSTRUCT ps;
1101 char ext[ListItemLen];
1102 static char szDir[ListItemLen], szBuf[ListItemLen];
1103 INITCOMMONCONTROLSEX icc;
1104 static LPNMHDR lpnmhdr;
1105 static LV_KEYDOWN *lvkeydown;
1106 static int sortsubno[NO_OF_SUBITEM] = {UP};
1107 NMLISTVIEW *pNMLV;
1108 SORTDATA SortData;
1109 static HDC hdc;
1110 static int isortsubno=pos.date;//�����T�u�A�C�e�����\�[�g������������
1111 static int sb_size[] = {150, 210, 490, -1};//�I�����u
1112 int tabpo;
1113 static int nStatus_h, nStatus_w;//�X�e�[�^�X�o�[
1114 POINT pDrop;
1115 POINT pt;
1116 static WINPOS winpos = {20, 20, 600, 450};//�e�E�B���h�E�����u�A������
1117 static HIMAGELIST hImage;
1118 static int ListLWidth;
1119 static HWND lastfocus;
1120 RECT rect;
1121
1122 switch (msg) {
1123 case WM_CREATE:
1124 ListLWidth=50;
1125 PopFileInitialize (hWnd);
1126 resetshowpic();
1127 initmode();
1128 initlistcolor();
1129 filefilter=FilterAll;
1130 ascii=TRUE;
1131 //sta.init();
1132 hbrush =initBrush();//listtextbkcolor);
1133 hMainWnd=hWnd;
1134 initsessionnum();
1135 menusetting(hWnd);
1136 MyGetInitialData(&winpos);
1137 if(wide) widemode();
1138
1139 EditMenuInit();
1140 initlog(log);
1141 settitle(hWnd);
1142 if(winpos.wx>0) MoveWindow(hWnd, winpos.x, winpos.y, winpos.wx, winpos.wy, TRUE);
1143 icc.dwSize = sizeof(INITCOMMONCONTROLSEX);
1144 icc.dwICC = ICC_LISTVIEW_CLASSES | ICC_BAR_CLASSES;
1145 InitCommonControlsEx(&icc);
1146 hInst = ((LPCREATESTRUCT)lp)->hInstance;
1147 GetClientRect(hWnd, &rc);
1148 hList = MakeMyList(hWnd, ID_LIST);
1149 InsertMyColumn(hList);
1150 hListL = MakeMyList(hWnd, ID_LISTL);
1151 win.setlist( hListL, hList );
1152
1153 InsertMyColumn(hListL);
1154 //
1155 hTab = CreateWindowEx( 0 , WC_TABCONTROL , NULL ,
1156 WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE ,
1157 0 , 0 , 50 , 5 , hWnd , (HMENU)0x10 ,
1158 ((LPCREATESTRUCT)lp)->hInstance , NULL );
1159
1160 //
1161
1162 hDir = CreateWindowEx ( 0,
1163 TEXT("button"), "",
1164 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
1165 0,0,0,0, hWnd, (HMENU) ID_DIR, hInst, NULL) ;
1166 hDirL = CreateWindowEx ( 0,
1167 TEXT("button"), "",
1168 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
1169 0,0,0,0, hWnd, (HMENU) ID_DIRL, hInst, NULL) ;
1170 hUp = CreateWindowEx ( 0,
1171 TEXT("button"), ">",
1172 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
1173 0,0,0,0, hWnd, (HMENU) ID_UP, hInst, NULL) ;
1174 hDown = CreateWindowEx ( 0,
1175 TEXT("button"), "<",
1176 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
1177 0,0,0,0, hWnd, (HMENU) ID_DOWN, hInst, NULL) ;
1178 hDirEdit = CreateWindowEx(0,
1179 "edit", "",
1180 WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | WS_BORDER,
1181 0, 0, 0, 0, hWnd, (HMENU)ID_DirEdit, hInst, NULL);
1182 hDirEditL = CreateWindowEx(0,
1183 "edit", "",
1184 WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | WS_BORDER,
1185 0, 0, 0, 0, hWnd, (HMENU)ID_DirEditL, hInst, NULL);
1186 hEdit = CreateWindowEx(0,
1187 "edit", "",
1188 WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_WANTRETURN |
1189 WS_VSCROLL | WS_HSCROLL | ES_AUTOVSCROLL | ES_AUTOHSCROLL,
1190 //WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | WS_BORDER | ES_MULTILINE ,
1191 0, 0, 0, 0, hWnd, (HMENU)ID_EDIT, hInst, NULL);
1192
1193 win.set(hDir,hDirL,hDirEdit,hDirEditL,hUp,hDown,hEdit,hTab);
1194
1195 OldTabProc =(WNDPROC) SetWindowLong (hTab, GWL_WNDPROC, (LPARAM) TabProc);
1196 OldDirLEdit =(WNDPROC) SetWindowLong (hDirEditL, GWL_WNDPROC, (LPARAM) DirLEditProc);
1197 OldDirREdit =(WNDPROC) SetWindowLong (hDirEdit, GWL_WNDPROC, (LPARAM) DirREditProc);
1198 OldListL =(WNDPROC) SetWindowLong (hListL, GWL_WNDPROC, (LPARAM) ListLProc);
1199 OldListR =(WNDPROC) SetWindowLong (hList, GWL_WNDPROC, (LPARAM) ListRProc);
1200 OldEdit =(WNDPROC) SetWindowLong (hEdit, GWL_WNDPROC, (LPARAM) FileEditProc);
1201 LDir.SetHandle(hListL,hDirEditL,hImage);
1202 LDir.cd( loadlastdir(1) );
1203 AddTab(hTab, LDir.cd());
1204 LDir.setTabpos(0);
1205 //LDir.resetEditText();
1206 LDir.SetItemNum( SetMyLocalDir(hWnd, LDir, hImage) );
1207 RDir.SetHandle(hList,hDirEdit,hImage);
1208 RDir.cd( loadlastdir(2) );
1209 AddTab(hTab, RDir.cd());
1210 RDir.setTabpos(1);
1211 //RDir.resetEditText();
1212 RDir.SetItemNum( SetMyLocalDir(hWnd, RDir, hImage) );
1213 /*
1214 SortData.hwndList = hListL;
1215 SortData.isortSubItem = isortsubno;
1216 SortData.iUPDOWN = sortsubno[isortsubno];
1217 ListView_SortItems(hListL, MyCompProc, &SortData);*/
1218 hStatus = CreateStatusWindow(WS_CHILD | WS_VISIBLE, "", hWnd, ID_STATUSBAR);
1219 SendMessage(hStatus, SB_SETPARTS, (WPARAM) status_num, (LPARAM)sb_size);
1220 GetWindowRect(hStatus, &rc);
1221 nStatus_h = rc.bottom - rc.top;
1222 nStatus_w = rc.right - rc.left;
1223 //sb_size[2] =nStatus_w -sb_size[0] -sb_size[1] -sb_size[3];
1224
1225 GetWindowRect(GetDesktopWindow(), &Max);
1226 hImage = ImageList_Create(16, 16, ILC_COLOR4, 2, 0);
1227 if(iconf){
1228 ListView_SetImageList(hListL, hImage, LVSIL_SMALL);
1229 ListView_SetImageList(hList, hImage, LVSIL_SMALL);
1230 ImageList_AddIcon(hImage, LoadIcon(hInst, "MYFILE"));
1231 ImageList_AddIcon(hImage, LoadIcon(hInst, "MYFILE"));
1232 ImageList_AddIcon(hImage, LoadIcon(hInst, "MYFOLDER"));
1233 ImageList_AddIcon(hImage, LoadIcon(hInst, "MYDRIVE"));
1234 }
1235
1236 DragAcceptFiles(hWnd,TRUE);
1237 commandflag=FALSE;
1238 if(strlen(commandline)>0)
1239 {
1240 commandflag=TRUE;
1241 memset(file,0,MAX_PATH);
1242 FncCommandline(commandline,file);
1243 SendMessage(hWnd,WM_DROPFILES,0,0);
1244 }
1245 SetFocus(hListL);
1246 if(!showmenu) {SetMenu(hWnd,NULL);}
1247 break;
1248 case WM_LBUTTONDBLCLK:
1249 mainMsg(IDM_add_blank_tab);
1250 break;
1251 case WM_SIZE:
1252 if(lp ==0) lp =sizelp;
1253 win.setSizePara(lp, nStatus_h,picshowflg,tab, ListLWidth);
1254 win.mvWins();
1255
1256
1257 SendMessage(hStatus, WM_SIZE, 0,0);
1258 GetWindowRect(hStatus, &rc);
1259 nStatus_w = rc.right - rc.left;
1260 sb_size[2] =nStatus_w -possize;
1261 resettitle();
1262 //Mes(nStatus_w);
1263 SendMessage(hStatus, SB_SETPARTS, (WPARAM) status_num, (LPARAM)sb_size);
1264
1265
1266 break;
1267 case WM_DROPFILES:
1268 if(!commandflag) DragQueryFile((HDROP)wp,0,commandline,MAX_PATH);
1269 DragQueryPoint((HDROP) wp, &pDrop);
1270 tmpdir=GetDirFromPos( pDrop.x );
1271 if(checkExt(commandline, "spi"))
1272 {
1273 setSpiPath(commandline);
1274 }
1275 else if(exist(commandline))
1276 {
1277 if(MessageBox(hWnd, "�R�s�[��������?", commandline, MB_OKCANCEL)==IDOK)
1278 {
1279 if( ! MyDragCopy(commandline, *tmpdir) )
1280 break;
1281 }
1282 else
1283 tmpdir->cd(commandline);
1284 ;//break;
1285 }
1286 else tmpdir->cd(commandline);
1287 SetFocus(tmpdir->getList());
1288 reloadtab();
1289 /*
1290 else if(pDrop.x <HIWORD(sizelp)/2)
1291 {
1292 LDir.cd(commandline);
1293 reloadlocal();
1294 }
1295 else
1296 {
1297 RDir.cd(commandline);
1298 reloadremote();
1299 }
1300 */
1301
1302 //Mes(file);
1303 //setfile(hEdit,file,NDir->cd(file));
1304
1305 //SetWindowText(hDirEditL,commandline);
1306 setstatus(commandline);
1307 break;
1308 case WM_CONTEXTMENU:
1309 if(NDir->ismouse()) {
1310 hPopMenu =hPopMenuMenu;
1311 }
1312 else hPopMenu =hPopDefMenu;
1313 if( keyfnc(0)==kSHIFT ) hPopMenu = hFindMenu;
1314 if( keyfnc(0)==kALT ) hPopMenu = hSubPop[1];
1315 if( keyfnc(0)==kCONTROL ) hPopMenu = hSubPop[2];
1316 if( keyfnc(0)==kCONTROL +kSHIFT) hPopMenu = hSubPop[5];
1317 if( keyfnc(0)==kALT +kSHIFT) hPopMenu = hSubPop[6];
1318 if( keyfnc(0)==kCONTROL +kALT) hPopMenu = hSubPop[7];
1319 if( keyfnc(0)==kCONTROL +kALT +kSHIFT) hPopMenu = hSubPop[0];
1320 pt.x = LOWORD(lp);
1321 pt.y = HIWORD(lp);
1322 pt.y=100;
1323 if (wp == (WPARAM)hListL) {
1324 tab =tab_l;
1325 setCTab(tab);
1326 NDir->setfile(szDir);
1327 TrackPopupMenu(hPopMenu, TPM_LEFTALIGN | TPM_TOPALIGN,
1328 pt.x, pt.y, 0, hWnd, NULL);
1329 }
1330 if (wp == (WPARAM)hList) {
1331 tab =tab_r;
1332 setCTab(tab);
1333 TrackPopupMenu(hPopMenu, TPM_LEFTALIGN | TPM_TOPALIGN,
1334 pt.x, pt.y, 0, hWnd, NULL);
1335 }
1336 break;
1337 case WM_NOTIFY:
1338 lpnmhdr = (LPNMHDR)lp;
1339 lvkeydown =(LV_KEYDOWN*)lp;//EN_UPDATE
1340 if (lpnmhdr->hwndFrom == hTab)
1341 {
1342 switch (((NMHDR *)lp)->code) {
1343 case NM_DBLCLK:
1344 Mes("dbl");
1345 break;
1346 case TCN_SELCHANGE:
1347 tabpo =GetCurSel(hTab);
1348 if (tabpo ==LDir.getTabpos()) SetFocus(hListL);
1349 else if(tabpo ==RDir.getTabpos()) SetFocus(hList);
1350 else
1351 {
1352 NDir->cd(tip[ tabpo ]->getPath());
1353 NDir->setTabpos( tabpo );
1354 reloadtab();
1355 }
1356 break;
1357 default:
1358 break;
1359 }
1360 return 0;
1361 }
1362 //������
1363 if (lpnmhdr->hwndFrom == hListL ) {
1364 tab =tab_l;
1365 iIndex =lpnmhdr->idFrom;
1366 setlistbuffers(tab, iIndex, szDir, szBuf, hListL, file);
1367 return ListNotify(tab, &LDir, szDir, szBuf, iIndex, hWnd, wp, lp);
1368 }
1369 //����
1370 if (lpnmhdr->hwndFrom == hList ) {
1371 tab =tab_r;
1372 setlistbuffers(tab, iIndex, szDir, szBuf, hList, file);
1373 return ListNotify(tab, &RDir, szDir, szBuf, iIndex, hWnd, wp, lp);
1374 }
1375 break;
1376 case WM_COMMAND:
1377 if(LOWORD(wp)>=bothdirIDBASE && LOWORD(wp)<bothdirIDBASE+1000 )
1378 {
1379 loadbothdir( LOWORD(wp) - bothdirIDBASE+1, LDir.cd(), RDir.cd() );
1380 SetWindowText(hDirEdit, RDir.cd());
1381 SetWindowText(hDirEditL, LDir.cd());
1382 reloadbothdir();
1383 break;
1384 }
1385 if(LOWORD(wp)>=localdirIDBASE && LOWORD(wp)<localdirIDBASE+1000 )
1386 {
1387 GetMenuString(hLeftMenu, LOWORD(wp), szBuf, MAX_PATH,MF_BYCOMMAND);
1388 NDir->cd(szBuf);
1389 reloadtab();
1390 break;
1391 }
1392 if(LOWORD(wp)>=remotedirIDBASE && LOWORD(wp)<remotedirIDBASE+1000 )
1393 {
1394 GetMenuString(hRemoteMenu, LOWORD(wp), szBuf, MAX_PATH,MF_BYCOMMAND);
1395 RDir.cd(szBuf);
1396 reloadremote();
1397 break;
1398 }
1399 if(LOWORD(wp)>=sendIDBASE && LOWORD(wp)<sendIDBASE+1000 )
1400 {
1401 GetMenuString(hSendtoMenu, LOWORD(wp), szBuf, MAX_PATH,MF_BYCOMMAND);
1402 ShellExecute(NULL, NULL,
1403 szBuf,
1404 quote(GetFullName(commandline, file, NDir->cd(), MAX_PATH)),
1405 sendtoPath, SW_SHOW);
1406 break;
1407 }
1408 if(LOWORD(wp)>=findIDBASE && LOWORD(wp)<findIDBASE+1000 )
1409 {
1410 GetMenuString(hFindMenu, LOWORD(wp), szBuf, MAX_PATH,MF_BYCOMMAND);
1411 setfilter(szBuf);
1412 reloadtab();
1413 break;
1414 }
1415 if(LOWORD(wp)>IDM_CMD_BASE && LOWORD(wp)<IDM_CMD_MAX )
1416 {
1417 myexec( cmd( file, NDir->cd(), LOWORD(wp) -IDM_CMD_BASE ) );
1418 break;
1419 }
1420 if(LOWORD(wp)>=IDM_DRIVE_A && LOWORD(wp)<=IDM_DRIVE_A+'z'-'a' )
1421 {
1422 NDir->cd(getDriveStr(LOWORD(wp)));
1423 reloadtab();
1424 break;
1425 }
1426 switch (LOWORD(wp)) {
1427 case ID_DIR:
1428 switch (HIWORD (wp))
1429 {
1430 case BN_CLICKED:
1431 reloadClick( szDir, RDir, tab_r);
1432 break;
1433 default:
1434 break;
1435 }
1436 break;
1437 case ID_DIRL:
1438 switch (HIWORD (wp))
1439 {
1440 case BN_CLICKED:
1441 reloadClick( szDir, LDir, tab_l);
1442 break;
1443 default:
1444 break;
1445 }
1446 break;
1447 case ID_UP:
1448 SendMessage(hWnd, WM_COMMAND, IDM_UPLOAD, 0);
1449 break;
1450 case ID_DOWN:
1451 SendMessage(hWnd, WM_COMMAND, IDM_DOWNLOAD, 0);
1452 break;
1453 case ID_DirEditL:
1454 if( HIWORD(wp) == EN_UPDATE)
1455 AutoFind( hDirEditL, hListL );
1456 break;
1457 case ID_DirEdit:
1458 if( HIWORD(wp) == EN_UPDATE)
1459 AutoFind( hDirEdit, hList );
1460 break;
1461 case IDM_LISTR_ONLY:
1462 ListLWidth =0;
1463 SetFocus(hList);
1464 resize();
1465 break;
1466 case IDM_LISTL_ONLY:
1467 ListLWidth =100;
1468 SetFocus(hListL);
1469 resize();
1470 break;
1471 case IDM_LISTL_WIDTH_1:
1472 ListLWidth =85;
1473 resize();
1474 break;
1475 case IDM_LISTL_WIDTH_2:
1476 ListLWidth =50;
1477 resize();
1478 break;
1479 case IDM_LISTL_WIDTH_3:
1480 ListLWidth =15;
1481 resize();
1482 break;
1483 case IDM_WINMODE:
1484 nextwinmode(1);
1485 resize();
1486 break;
1487 case IDM_WINMODE_BACK:
1488 nextwinmode(-1);
1489 resize();
1490 break;
1491 case IDM_his_L:
1492 LDir.cd("his:L");
1493 reloadlocal();
1494 break;
1495 case IDM_his_R:
1496 RDir.cd("his:R");
1497 reloadremote();
1498 break;
1499 case IDM_left_tree:
1500 treemode(tab);
1501 break;
1502 case IDM_add_tab:
1503 AddTab( hTab, NDir->cd());
1504 break;
1505 case IDM_add_blank_tab:
1506 AddTab( hTab, "");
1507 break;
1508 case IDM_add_tab_this:
1509 AddTab( hTab, NDir->cd(), file);
1510 break;
1511 case IDM_del_all_tab:
1512 delAllTab(hTab);
1513 AddTab( hTab, LDir.cd());
1514 AddTab( hTab, RDir.cd());
1515 break;
1516 case IDM_del_this_tab:
1517 delTab(hTab, NDir->getTabpos());
1518 break;
1519 case IDM_HIS_BACKWARD:
1520 NDir->hisback();
1521 reloadtab();
1522 break;
1523 case IDM_HIS_BackNoReload:
1524 NDir->hisBackSee();
1525 NDir->EditTextNow();
1526 break;
1527 case IDM_HIS_ForwNoReload:
1528 NDir->hisNextSee();
1529 NDir->EditTextNow();
1530 break;
1531 case IDM_HIS_FORWARD:
1532 NDir->hisnext();
1533 reloadtab();
1534 break;
1535 case IDM_SameDir:
1536 if(tab==tab_l) LDir.cd(RDir.cd());
1537 if(tab==tab_r) RDir.cd(LDir.cd());
1538 reloadtab();
1539 break;
1540 case IDM_SSameDir:
1541 if(tab==tab_l) RDir.cd(LDir.cd());
1542 if(tab==tab_r) LDir.cd(RDir.cd());
1543 reloadother();
1544 break;
1545 case IDM_change_mode_sw:
1546 if(ascii==TRUE) SendMessage(hWnd,WM_COMMAND,IDM_changeb_mode,0);
1547 else SendMessage(hWnd,WM_COMMAND,IDM_change_mode,0);
1548 break;
1549 case IDM_UP_BUTTON:
1550 buttonSw();
1551 resize();
1552 break;
1553 case IDM_DirEDIT_SW:
1554 DirEditSw();
1555 resize();
1556 break;
1557 case IDM_LOCAL_CREATE_FILE:
1558 if(MyCreatFile(hWnd, NDir))
1559 reloadtab();
1560 break;
1561 case IDM_NEW_FILE:
1562 if(MyCreatBlankFile())
1563 reloadtab();
1564 break;
1565 case IDM_COMPARE:
1566 CompareList(NList, NXList);
1567 break;
1568 case IDM_CompareSize:
1569 CompareList_Size(NList, NXList);
1570 break;
1571 case IDM_CompareSizeDate:
1572 CompareList_Date(NList, NXList);
1573 break;
1574 case IDM_REV_SELECT:
1575 SelectReverse(NList);
1576 break;
1577 case IDM_RENAME_2:
1578 if(MyRename(*NDir)) reloadtab();
1579 break;
1580 case IDM_RENAME:
1581 iIndex = ListView_GetNextItem(NList, -1, LVNI_SELECTED);
1582 setselbuf(iIndex, szDir, szBuf, NList);
1583 if (!isdirectory(szBuf)) {
1584 if(localrename(hWnd, NList, NDir, &myfname)) {
1585 reloadtab();
1586 }
1587 else setstatus("���l�[�����s");
1588 break;
1589 }
1590 else
1591 {
1592
1593 }
1594 break;
1595 case IDM_SAVE_WINS_HOME:
1596 if( ! GetStrDlg("�z�[��������������", commandline) ) break;
1597 savehomebothdir( LDir.cd(), RDir.cd());
1598 break;
1599 case IDM_LOAD_WINS_HOME:
1600 loadhomebothdir( LDir.cd(), RDir.cd() );
1601 SetWindowText(hDirEdit, RDir.cd());
1602 SetWindowText(hDirEditL, LDir.cd());
1603 reloadbothdir();
1604 break;
1605 case IDM_SAVE_WINS:
1606 if( DialogBoxParam(hInst, "mycreatedir", hWnd, (DLGPROC)GetNameProc,(LPARAM)(setname)) == IDCANCEL) break;
1607 savebothdir(setname, LDir.cd(), RDir.cd());
1608 break;
1609 case IDM_SAVE_DIRLOCAL:
1610 savelocaldir(tab, NDir->cd());
1611 break;
1612 case IDM_LOAD_DIRLOCAL:
1613 loaddirlocal(szDir);
1614 LDir.cd(szDir);
1615 setstatus(szDir);
1616 reloadlocal();
1617 break;
1618 case IDM_OPEN_CUR:
1619 ShellExecute(NULL, "open", "explorer", NDir->cd(), NULL, SW_SHOW);
1620 break;
1621 case IDM_OPEN_INI:
1622 openinitdir();
1623 break;
1624 case IDM_mp3play:
1625 if(mp3playMain(file, NDir->cd())== -1)
1626 mainMsg(IDM_Videoplay);
1627 break;
1628 case IDM_Videoplay:
1629 mciStart(file, NDir->cd());
1630 break;
1631 case IDM_Open_MEMO_DIR:
1632 NDir->cd(memopath);
1633 reloadtab();
1634 break;
1635 case IDM_NEW_MEMO_CHANGE:
1636 if(MemoMode == _OFF) changeMemo();
1637 else changeMemo(hEdit);
1638 break;
1639 case IDM_NEW_MEMO:
1640 if(MemoMode == _OFF) {
1641 lastfocus = GetFocus();
1642 SetFocus(hEdit);
1643 }
1644 else SetFocus(lastfocus);
1645 memomode(hEdit);
1646 resize();
1647 resettitle();
1648 break;
1649 case IDM_EDIT:
1650 CurrentPicshow =FALSE;
1651 if(isMp3(file) || isWav(file)) mainMsg(IDM_mp3play);
1652 else if(isVideo(file) ) mainMsg(IDM_Videoplay);
1653 else if (checkExts(szDir,"jpg;bmp") )
1654 {
1655 CurrentPicshow =TRUE;
1656 setpicflg(NDir);
1657 resize();
1658 redraw();
1659 }
1660 else
1661 {
1662 NDir->cd(".");
1663 iIndex = ListView_GetNextItem(NList, -1, LVNI_SELECTED);
1664 setselbuf(iIndex, szDir, szBuf, NList);
1665 if (!isdirectory(szBuf)) {
1666 ShellExecute(NULL, "open",editor,szDir, NULL, SW_SHOW);
1667 break;
1668 }
1669 else
1670 {
1671 ShellExecute(NULL, "open","explorer",szDir, NULL, SW_SHOW);
1672 }
1673 }
1674 break;
1675
1676 case IDM_LOCALDRIVE:
1677 ChangeLocalDrive(hWnd, *NDir, hImage);
1678 GetCurrentDirectory(MAX_PATH,NDir->cd());
1679 reloadtab();
1680 break;
1681 case IDM_EDIT_INIT:
1682 openinit();
1683 break;
1684 case IDM_OPEN_KEY_FILE:
1685 openkeyfile();
1686 break;
1687 case IDM_FIND:
1688 if( MyFilter(hWnd) )
1689 {
1690 reloadtab();
1691 }
1692 break;
1693 case IDM_EXT_SETCOLOR:
1694 if( GetStrDlg( "�g���q", ext ) )
1695 {
1696 setExtPaint(ext);
1697 SetFocus(hWnd);
1698 }
1699 break;
1700 case IDM_Menu_go:
1701 mainMsg(atoi(sizestr));
1702 break;
1703 case IDM_MouseGesture_edit:
1704 if( GetStrDlg( file, commandline, mc.getLastStr() ) )
1705 {
1706 if(!setMouseGesture(sizestr,commandline))
1707 Mes("�W�F�X�`���������g���������� DRLU (�_�E���E���C�g�E���t�g�E�A�b�v)����");
1708 else
1709 reloadtab();
1710 }
1711 break;
1712 case IDM_EXT_SETCOLOR_THIS:
1713 setExtPaint(NList);
1714 colorrefresh(); // ������������redraw
1715 break;
1716 case IDM_FIND_MORE:
1717 if( GetStrDlg( "����?", Filter ) )
1718 {
1719 //ListFilter(hWnd);
1720 reloadtab();
1721 }
1722 break;
1723 case IDM_FIND2:
1724 if( GetStrDlg( "*����*", Filter ) )
1725 setsel(NList,Filter);
1726 break;
1727 case IDM_HomePage:
1728 myexec( cmdDirect( file, NDir->cd(), fileMVhome) );
1729 break;
1730 case IDM_END:
1731 SendMessage(hWnd, WM_CLOSE, 0, 0);
1732 break;
1733 case IDM_AUTO:
1734 if( PopFileOpenDlg(hWnd, file, NULL) ) batch(file);
1735 else setstatus("�L�����Z��");
1736 break;
1737 case IDM_AUTOFILE_EDIT:
1738 if( PopFileOpenDlg(hWnd, file, NULL) ) editbatch(file);
1739 else setstatus("�L�����Z��");
1740 break;
1741 case IDM_AUTOFILE_FILTER:
1742 filefilter=FilterAuto;
1743 reloadlocal();
1744 break;
1745 case IDM_DOWNLOAD:
1746 MyDown(hWnd, hList, hListL);
1747 reloadlocal();
1748 break;
1749 case IDM_writeDown_menulist:
1750 PrMenuList(hMainMenu,1);
1751 reloadtab();
1752 break;
1753 case IDM_UPLOAD:
1754 MyUp(hWnd, hList,hListL);
1755 reloadremote();
1756 break;
1757 case IDM_COPY_HERE:
1758 MyCopyHere(hWnd, *NDir, NList);
1759 reloadtab();
1760 break;
1761 case IDM_COPY:
1762 if(tab == tab_l) msgUp();
1763 if(tab == tab_r) msgDown();
1764 break;
1765 case IDM_UPLOAD_CUT:
1766 start=0;
1767 len=0;
1768 if(DialogBoxParam(hInst, "mycreatedir", hWnd, (DLGPROC)GetLenProc,(LPARAM)(NDir))==IDOK){
1769 MyCutUp(start,len);
1770 reloadother();
1771 }
1772 break;
1773 case IDM_HERE_CUT:
1774 start=0;
1775 len=0;
1776 if(DialogBoxParam(hInst, "mycreatedir", hWnd, (DLGPROC)GetLenProc,(LPARAM)(NDir))==IDOK){
1777 MyCutHere(start,len);
1778 reloadtab();
1779 }
1780 break;
1781 case IDM_DELFILELOCAL:
1782 if( MyDelFile(NList,*NDir) ==0 ) break;
1783 reloadtab();
1784 break;
1785 case IDM_DELFILE://DeleteFile
1786 MyDelFile(NList,*NDir);
1787 reloadremote();
1788 break;
1789 case IDM_TitleBar_SW:
1790 TitleBar(hWnd);
1791 break;
1792 case IDM_CHECK_CDIR:
1793 GetCurrentDirectory(100,commandline);
1794 // strcat(commandline,file);
1795 // strcat(commandline,szBuf);
1796 SetWindowText(hEdit,commandline);
1797 break;
1798 case IDM_ZIP:
1799 if( MyZip(*NDir, *NXDir, NList) ) {reloadother();}
1800 else ErrorMes(zipErr);
1801 break;
1802 case IDM_LZH:
1803 if( MyLzh(*NDir, *NXDir, NList) ) {reloadother();}
1804 else ErrorMes(zipErr);
1805 break;
1806 case IDM_UnLZH:
1807 if( MyUnLzh(*NDir, *NXDir, NList) ) {reloadother();}
1808 else ErrorMes(zipErr);
1809 break;
1810 case IDM_CHECK_VOL:
1811 GetVol(100,commandline);
1812 SetWindowText(hEdit,commandline);
1813 break;
1814 case IDM_COM_list:
1815 GetCommandlist(commandline);
1816 SetWindowText(hEdit,commandline);
1817 break;
1818 case IDM_EXCHANGE:
1819 Exchange(LDir, RDir);
1820 reloadbothdir();
1821 break;
1822 case IDM_LOCAL_CREATEDIR:
1823 MyCreatDir(hWnd, NDir);
1824 reloadtab();
1825 break;
1826 case IDM_REMOVEDIR_LOCAL:
1827 if( MyRemoveDir(NList) ) reloadtab();
1828 break;
1829 case IDM_CHECK_lua:
1830 wsprintf(commandline,"%s",getCdir());
1831 luacall(szDir,commandline,"lua.lua");
1832 Mes(commandline);
1833 break;
1834 case IDM_EDITSTR_lua:
1835 wsprintf(commandline,"%s",getCdir());
1836 luacall(getCurrentEditWinStr(hEdit),commandline,"lua.lua");
1837 SetWindowText(hEdit,commandline);
1838 break;
1839 case IDM_UPDIRFTP:
1840 RDir.cd( "..");
1841 reloadremote();
1842 break;
1843 case IDM_R_DIRREMOTE:
1844 reload( hWnd, RDir, SortData, isortsubno, sortsubno[isortsubno], hImage);
1845 SetTab(hTab, -1, RDir.cd());
1846 break;
1847 case IDM_R_DIRLOCAL:
1848 reload( hWnd, LDir, SortData, isortsubno, sortsubno[isortsubno], hImage);
1849 SetTab( hTab, -1, LDir.cd());
1850 break;
1851 case IDM_RELOAD_CURRENT_LIST:
1852 reload( hWnd, *NDir, SortData, isortsubno, sortsubno[isortsubno], hImage);
1853 //SetTab( hTab, -1, LDir.cd());
1854 break;
1855 case IDM_ROOTDIR:
1856 NDir->cdroot();
1857 reloadtab();
1858 break;
1859 case IDM_focus_other:
1860 SetFocus(NXDir->getList());
1861 //reloadtab();
1862 break;
1863 case IDM_UPDIRLOCAL:
1864 NDir->cd("..");
1865 resettitle();
1866 reloadtab();
1867 break;
1868 case IDM_RELOAD_BOTH:
1869 reloadlocal();
1870 reloadremote();
1871 setstatus(LDir.cd(),RDir.cd());
1872 break;
1873 case IDM_OVERWRITE:
1874 saveTemp(hEdit);
1875 break;
1876 case IDM_ENTER:
1877 Enter( szDir, szBuf, hWnd, tab);
1878 break;
1879 case IDM_WINDOW_ALL:
1880 editmode();
1881 resize();
1882 break;
1883 case IDM_WINDOW_MAX:
1884 GetWindowRect(hWnd, &Last);
1885 MoveWindow(hWnd, Max.left, Max.top, Max.right-Max.left, Max.bottom-Max.top, TRUE);
1886 break;
1887 case IDM_WINDOW_SMALLER:
1888 GetWindowRect(hWnd, &Last);
1889 MoveWindow(hWnd, Last.left +smallW, Last.top +smallH, Last.right -Last.left -2*smallW, Last.bottom -Last.top -2*smallH, TRUE);
1890 break;
1891 case IDM_WINDOW_BIGGER:
1892 GetWindowRect(hWnd, &Last);
1893 MoveWindow(hWnd, Last.left -smallW, Last.top -smallH, Last.right -Last.left +2*smallW, Last.bottom -Last.top +2*smallH, TRUE);
1894 break;
1895 case IDM_WINDOW_INI:
1896 //MoveWindow(hWnd, winpos.x, winpos.y, winpos.wx, winpos.wy, TRUE);
1897 MoveWindow(hWnd, Last.left, Last.top, Last.right-Last.left, Last.bottom-Last.top, TRUE);
1898 break;
1899 case IDM_WINDOW_LIST:
1900 listmode();
1901 resize();
1902 break;
1903 case IDM_WINDOW_EDIT:
1904 editonlymode();
1905 resize();
1906 break;
1907 case IDM_PicOrgDown:
1908 win.mvOrg(0,-10);
1909 break;
1910 case IDM_PicOrgUp:
1911 win.mvOrg(0,10);
1912 break;
1913 case IDM_PicOrgRight:
1914 win.mvOrg(10,0);
1915 break;
1916 case IDM_PicOrgLeft:
1917 win.mvOrg(-10,0);
1918 break;
1919 case IDM_PicRateUp:
1920 win.rateUp();
1921 break;
1922 case IDM_PicRateDown:
1923 win.rateDown();
1924 break;
1925 case IDM_PicRateReset:
1926 win.rateReset();
1927 break;
1928 case IDM_PicReset:
1929 memmapReset();
1930 break;
1931 case IDM_mouseG:
1932 mousegON = mousegON ? FALSE : TRUE;
1933 break;
1934 case IDM_nanameON:
1935 nanameON = nanameON ? FALSE : TRUE;
1936 break;
1937 case IDM_Set_CtrlKEY:
1938 controlkey();
1939 break;
1940 case IDM_mouseGestureStrList:
1941 NDir->cd("mouse:");
1942 reloadtab();
1943 Mes("�W�F�X�`�����W �����O���W�F�X�`�����������R�s�[��������");
1944 break;
1945 case IDM_SendTomenu_Pop:
1946 TrackPopupMenu(hSendtoMenu, TPM_LEFTALIGN | TPM_TOPALIGN,
1947 0,0, 0, hWnd, NULL);
1948 break;
1949 case IDM_Bothmenu_Pop:
1950 TrackPopupMenu(hBothMenu, TPM_LEFTALIGN | TPM_TOPALIGN,
1951 0,0, 0, hWnd, NULL);
1952 break;
1953 case IDM_Set_Mainmenu_Pop:
1954 if(hPopDefMenu !=hMainMenu) hPopDefMenu =hMainMenu;
1955 else hPopDefMenu =hLeftMenu;
1956 break;
1957 case IDM_DEL_MENU:
1958 if(showmenu)
1959 {
1960 SetMenu(hWnd,NULL);
1961 showmenu =FALSE;
1962 }
1963 else
1964 {
1965 SetMenu(hWnd,hMenu);
1966 showmenu =TRUE;
1967 }
1968 break;
1969 case IDM_SORT1:
1970 sortlist( NList, 1 );
1971 break;
1972 case IDM_SORT2:
1973 sortlist( NList, 2 );
1974 break;
1975 case IDM_SORT3:
1976 sortlist( NList, 3 );
1977 break;
1978 case IDM_SORT4:
1979 sortlist( NList, 4 );
1980 break;
1981 case IDM_SORT5:
1982 sortlist( NList, 5 );
1983 break;
1984 case IDM_COLOR_REV:
1985 colorRev(hList);
1986 setBrush();
1987 //setlistcolor(NList);
1988 paintf =TRUE;
1989 colorrefresh();
1990 break;
1991 case IDM_COM:
1992 if( GetStrDlg( "�R�}���h���s", commandline ) )
1993 myexec( cmdDirect( file, NDir->cd(), commandline) );
1994 break;
1995 case IDM_COM_NUM:
1996 if( GetStrDlg( "�R�}���h�����w��", commandline ) )
1997 myexec( cmdByNum( file, NDir->cd(), commandline) );
1998 break;
1999 }
2000 break;
2001 case WM_CTLCOLOREDIT:
2002 case WM_CTLCOLORLISTBOX:
2003 if(paintf)
2004 {
2005 HDC hDC = (HDC)wp;
2006 SetBkMode(hDC, OPAQUE); // �w�i//�����s����������
2007 SetTextColor(hDC, listtextColor); // �e�L�X�g���F
2008 SetBkColor(hDC,listtextBkColor); // �e�L�X�g���������������������w�i���F
2009 return (LRESULT) hbrush;//CreateSolidBrush(listtextbkcolor); // �e�L�X�g�����������������������w�i���F
2010 }
2011 break;
2012 case WM_PAINT:
2013 if(videoIn)
2014 {
2015 //resize();
2016 return (DefWindowProc(hWnd, msg, wp, lp));
2017 }
2018 else if( picshowflg )
2019 bmppaint(hWnd, msg, wp,lp,file);
2020 else
2021 {
2022 GetClientRect (hWnd, &rect) ;
2023 hdc =BeginPaint(hWnd, &ps);
2024 SetBkMode(hdc, OPAQUE);
2025 SelectObject( hdc, hbrush ) ;
2026 if(paintf & !videoIn) Rectangle(hdc,rect.left,rect.top,rect.right,rect.bottom);
2027
2028 EndPaint(hWnd,&ps);
2029 }
2030 return 0;
2031 case WM_SETFOCUS:
2032 if( MemoMode == _OFF ) SetFocus( NDir->getList() );
2033 else SetFocus( getMainEdit() );
2034 break;
2035 case WM_CLOSE:
2036 if(MemoMode==_ON) mainMsg( IDM_NEW_MEMO );
2037 //MemoOff(); //dame
2038 if(mp3Playing) mainMsg(IDM_mp3play);
2039 if(mciPlaying) mainMsg(IDM_Videoplay);
2040 GetWindowRect(hWnd, &rc);
2041 winpos.x = rc.left;
2042 winpos.y = rc.top;
2043 winpos.wx = rc.right - rc.left;
2044 winpos.wy = rc.bottom -rc.top;
2045 savelastdir( 1, LDir.cd());
2046 savelastdir( 2, RDir.cd());
2047 savelastTabs();
2048 MySaveInitialData( &winpos);
2049 ImageList_Destroy(hImage);
2050 DestroyWindow(hList);
2051 DestroyWindow(hListL);
2052 DestroyWindow(hDirL);
2053 DestroyWindow(hDir);
2054 DestroyWindow(hDirEdit);
2055 DestroyWindow(hDirEditL);
2056 DestroyWindow(hEdit);
2057 DestroyWindow(hUp);
2058 DestroyWindow(hDown);
2059 DeleteObject(hbrush);
2060 DestroyWindow(hWnd);
2061 FreeDll();
2062 getnextpath(1,"","", 1);
2063 break;
2064 case WM_DESTROY:
2065 PostQuitMessage(0);
2066 break;
2067 default:
2068 return (DefWindowProc(hWnd, msg, wp, lp));
2069 }
2070 return 0;
2071 }
2072
2073
2074 void setfilenameonRename(HWND hListFrom, dirw *dir, FNAME *lpfname)
2075 {
2076 int iIndex;
2077
2078 strcpy(lpfname->szFName,"");
2079 iIndex = ListView_GetNextItem(hListFrom, -1, LVNI_SELECTED);
2080 ListView_GetItemText(hListFrom, iIndex, pos.name, lpfname->szFName, MAX_PATH);
2081 dir->GetCurrentDirectory( 0,lpfname->szLocalFileName);
2082 strcpy(lpfname->path, lpfname->szLocalFileName);
2083 strcat(lpfname->szLocalFileName, "\\");
2084 strcat(lpfname->szLocalFileName, lpfname->szFName);
2085 }
2086
2087
2088 long MyDelFile(HWND hList,dirw &dir)
2089 {
2090 int iIndex;
2091 long count =0;
2092 char buffer[MAX_INFO],szMsg[MAX_INFO];
2093 int co =LGetSelectedCount( hList );
2094 wsprintf(szMsg, "%d�����t�@�C�� %s\..", co, dir.cd());
2095 if( MessageBox(hList,"�������������H",szMsg, MB_OKCANCEL)==IDCANCEL ) return 0;
2096
2097 dir.cd(".");
2098 strcpy(buffer,"");
2099 iIndex =-1;
2100 while(1)
2101 {
2102 iIndex = ListView_GetNextItem( hList, iIndex, LVNI_ALL | LVNI_SELECTED);
2103 if (iIndex == -1) break;
2104 ListView_GetItemText(hList, iIndex, pos.name, buffer, sizeof(buffer));
2105 wsprintf(szMsg,
2106 "%s\\%s�������������B%d",
2107 dir.cd(), buffer,iIndex+1);
2108 setstatus(szMsg);
2109 //Mes( szFile );
2110 if( DeleteFile(buffer) ) count++;
2111 }
2112 return count;
2113 }
2114
2115 BOOL MyRemoveDir(HWND hList)
2116 {
2117 int iIndex;
2118 char buffer[MAX_INFO];
2119
2120 strcpy(buffer,"");
2121 iIndex = ListView_GetNextItem(hList, -1, LVNI_SELECTED);
2122 ListView_GetItemText(hList, iIndex, pos.name, buffer, MAX_PATH);
2123 if( MessageBox(hList,"�t�H���_���������������H",buffer, MB_OKCANCEL)==IDCANCEL ) return FALSE;
2124 if(RemoveDirectory(buffer))
2125 {
2126 setstatus("������������");
2127 return TRUE;
2128 }
2129 else
2130 {
2131 setstatus("�����o��������������");
2132 return FALSE;
2133 }
2134 }
2135
2136
2137 BOOL localrename(HWND hWnd,HWND hList, dirw *Dir , FNAME *lpfname)
2138 {
2139 setfilenameonRename(hList, Dir, lpfname);
2140 strcpy(lpfname->szLocalFileName, lpfname->szFName);
2141 if (DialogBoxParam(hInst, "MYRENAME",
2142 hWnd, (DLGPROC)MyGetFNameProc, (LPARAM)&myfname) == IDCANCEL)
2143 return FALSE;
2144 if( rename(myfname.szFName,myfname.szLocalFileName) ==-1) return FALSE;
2145 return TRUE;
2146 }
2147
2148
2149 LRESULT CALLBACK GetFromToProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
2150 {
2151 static FNAME fname;
2152 static HWND hFName, hLocalFName, txt1, txt2;
2153 static iset *mset;
2154
2155 switch (msg) {
2156 case WM_INITDIALOG:
2157 SetWindowText(hDlg,"���O�A��������");
2158 mset = (iset*)(lp);
2159 hFName = GetDlgItem(hDlg, IDC_FNAME);
2160 hLocalFName = GetDlgItem(hDlg, IDC_LOCALFILE);
2161 txt1 = GetDlgItem(hDlg, IDC_STATIC1);
2162 txt2 = GetDlgItem(hDlg, IDC_STATIC2);
2163 Edit_SetText(txt1, "from");
2164 Edit_SetText(txt2, "to");
2165 SetFocus(hFName);
2166 break;
2167 case WM_COMMAND:
2168 switch (LOWORD(wp)) {
2169 case IDOK:
2170 Edit_GetText(hFName, fname.szFName, sizeof(fname.szFName));
2171 Edit_GetText(hLocalFName, fname.szLocalFileName,
2172 sizeof(fname.szLocalFileName));
2173 sscanf(fname.szLocalFileName,"%d",&(mset->to));
2174 sscanf(fname.szFName,"%d",&mset->from);
2175 EndDialog(hDlg, IDOK);
2176 return TRUE;
2177 case IDCANCEL:
2178 EndDialog(hDlg, IDCANCEL);
2179 return TRUE;
2180 }
2181 return FALSE;
2182 }
2183 return FALSE;
2184 }
2185
2186
2187
2188 LRESULT CALLBACK MyGetFNameProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
2189 {
2190 static FNAME *lpfname;
2191 static HWND hFName, hLocalFName, txt1, txt2;
2192
2193 switch (msg) {
2194 case WM_INITDIALOG:
2195 lpfname = (FNAME *)lp;
2196 SetWindowText(hDlg, lpfname->path );
2197 hFName = GetDlgItem(hDlg, IDC_FNAME);
2198 hLocalFName = GetDlgItem(hDlg, IDC_LOCALFILE);
2199 txt1 = GetDlgItem(hDlg, IDC_STATIC1);
2200 Edit_SetText(hFName, lpfname->szFName);
2201 Edit_SetText(hLocalFName, lpfname->szLocalFileName);
2202 //Edit_SetText(txt1, "������");
2203 SetFocus(hLocalFName);
2204 break;
2205 case WM_COMMAND:
2206 switch (LOWORD(wp)) {
2207 case IDOK:
2208 Edit_GetText(hFName, lpfname->szFName, sizeof(lpfname->szFName));
2209 Edit_GetText(hLocalFName, lpfname->szLocalFileName,
2210 sizeof(lpfname->szLocalFileName));
2211 EndDialog(hDlg, IDOK);
2212 return TRUE;
2213 case IDCANCEL:
2214 EndDialog(hDlg, IDCANCEL);
2215 return TRUE;
2216 }
2217 return FALSE;
2218 }
2219 return FALSE;
2220 }
2221
2222 void ChangeLocalDrive(HWND hWnd, dirw &dir, HIMAGELIST hImage)
2223 {
2224 HINSTANCE hInst;
2225 hInst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);
2226 DialogBoxParam(hInst, "MYDRIVE", hWnd, (DLGPROC)MyDriveProc, (LPARAM)&dir);
2227 return;
2228 }
2229
2230
2231 LRESULT CALLBACK MyDriveProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
2232 {
2233 static HWND hDrvList;
2234 static HWND hListL, hDirEditL, hParent;
2235 char szDrv[4];
2236 dirw *dir;
2237 HWNDSET *lphset;
2238
2239 switch (msg) {
2240 case WM_INITDIALOG:
2241 dir = (dirw *)lp;
2242 hListL = dir->getList();
2243 hDirEditL = dir->getEdit();
2244 hParent = GetParent(hDlg);
2245 hDrvList = GetDlgItem(hDlg, IDC_LIST1);
2246 DlgDirList(hDlg, "*.*", IDC_LIST1, 0, DDL_DRIVES);
2247 OldDrvList =(WNDPROC) SetWindowLong (hDrvList, GWL_WNDPROC, (LPARAM) DrvListProc);
2248
2249 return TRUE;
2250 case WM_COMMAND:
2251 switch (LOWORD(wp)) {
2252 case IDOK:
2253 DlgDirSelectEx(hDlg, szDrv, sizeof(szDrv), IDC_LIST1);
2254 strcat(szDrv, "\\");
2255 SetCurrentDirectory(szDrv);
2256 EndDialog(hDlg, IDOK);
2257 return TRUE;
2258 case IDCANCEL:
2259 EndDialog(hDlg, IDCANCEL);
2260 return TRUE;
2261 }
2262 return FALSE;
2263 }
2264 return FALSE;
2265 }
2266
2267 void calcpercent( char *buff, char *file, DWORD &len)
2268 {
2269 DWORD size =getfilesize(file);
2270 int percent;
2271 int n=strlen(buff);
2272 buff[n-1] =0;
2273 sscanf(buff,"%ld",&percent);
2274 if(percent>=100) len =size;
2275 else len = size * ((float)percent/100);
2276 }
2277
2278 LRESULT CALLBACK GetLenProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
2279 {
2280 static HWND hList;
2281 static HWND hListL, hDirEditL, hParent;
2282 char buff[100];
2283 HWNDSET *lphset;
2284 static dirw *dir;
2285
2286 switch (msg) {
2287 case WM_INITDIALOG:
2288 dir =(dirw*) lp;
2289 SetWindowText(hDlg, "����");
2290 //SetDlgItemText(hDlg,IDC_EDIT1, dir->cd());
2291 dir->cd(".");
2292 return TRUE;
2293 case WM_COMMAND:
2294 switch (LOWORD(wp)) {
2295 case IDOK:
2296 GetDlgItemText(hDlg,IDC_EDIT1,buff,MAX_PATH);
2297 if( strchr(buff,'%') == NULL ) sscanf(buff,"%ld",&len);
2298 else calcpercent( buff, dir->getfile() ,len );
2299 setstatusnum(len);
2300 EndDialog(hDlg, IDOK);
2301 return TRUE;
2302 case IDCANCEL:
2303 EndDialog(hDlg, IDCANCEL);
2304 return TRUE;
2305 }
2306 return FALSE;
2307 }
2308 return FALSE;
2309 }
2310
2311 LRESULT CALLBACK GetNameProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
2312 {
2313 static HWND hList;
2314 static HWND hListL, hDirEditL, hParent;
2315 HWNDSET *lphset;
2316 static char *name;
2317
2318 switch (msg) {
2319 case WM_INITDIALOG:
2320 name =(char*) lp;
2321 SetWindowText(hDlg, "���O");
2322 return TRUE;
2323 case WM_COMMAND:
2324 switch (LOWORD(wp)) {
2325 case IDOK:
2326 GetDlgItemText(hDlg,IDC_EDIT1,name,MAX_PATH);
2327 EndDialog(hDlg, IDOK);
2328 return TRUE;
2329 case IDCANCEL:
2330 EndDialog(hDlg, IDCANCEL);
2331 return TRUE;
2332 }
2333 return FALSE;
2334 }
2335 return FALSE;
2336 }
2337
2338
2339 void MyCutCopy(dirw &Fdir,dirw &Tdir,DWORD fr, DWORD len)
2340 {
2341 HWND hList =NList;
2342 int iIndex;
2343 DWORD dwSize;
2344 char szMsg[512], ToFile[MAX_PATH], FromFile[MAX_PATH], szFile[MAX_PATH], ToPath[MAX_PATH], FromPath[MAX_PATH];
2345
2346 dwSize = MAX_PATH;
2347 Tdir.GetCurrentDirectory(dwSize, ToPath);
2348 Fdir.GetCurrentDirectory(dwSize, FromPath);
2349 iIndex =-1;
2350 while(1)
2351 {
2352 iIndex = ListView_GetNextItem( hList, iIndex, LVNI_ALL | LVNI_SELECTED);
2353 if (iIndex == -1) break;
2354 ListView_GetItemText(hList, iIndex, pos.name, szFile, sizeof(szFile));
2355 GetFullName(ToFile, szFile, ToPath, MAX_PATH);
2356 GetFullName(FromFile, szFile, FromPath, MAX_PATH);
2357 wsprintf(szMsg,
2358 "%s >> %s , %d",
2359 FromFile, ToFile,len);
2360 cutcopy( FromFile, ToFile, fr, len );
2361 }
2362 savelocaldir(1, FromPath);
2363 return;
2364 }
2365
2366 int search(HWND hList, char *buf)
2367 {
2368 char buffer[1000];
2369 int i =0;
2370 int max =ListView_GetItemCount(hList);
2371 while(i<max)
2372 {
2373 ListView_GetItemText(hList, i, pos.name, buffer, 1000);
2374 if( strlen(buffer) == 0) continue;
2375 if( strcmp(buffer, buf) == 0 ) return i;
2376 i++;
2377 }
2378 return -1;
2379 }
2380
2381 #define _ONLY 0
2382 #define _SIZE 1
2383 #define _DATE 2
2384
2385 BOOL Compare(int column, HWND hList1, HWND hList2, int i, int ans)
2386 {
2387 ListView_GetItemText(hList1, i, column, buffer, 1000);
2388 ListView_GetItemText(hList2, ans, column, buffer2, 1000);
2389 return (strcmp(buffer, buffer2)==0) && buffer[0]!=0;
2390 }
2391
2392
2393
2394 void CompareList(HWND L1, HWND L2, int mode)
2395 {
2396 ListNonSelected( L1 );
2397 ListNonSelected( L2 );
2398 int i =0, ans;
2399 int max1=ListView_GetItemCount(L1);
2400 while(i<max1)
2401 {
2402 ListView_GetItemText(L1, i, pos.name, buffer, 1000);
2403 if( strlen(buffer) == 0) continue;
2404 ans =search(L2, buffer);
2405 if( ans >=0 )
2406 {
2407 if( mode ==_ONLY
2408 ||(mode ==_SIZE && !Compare( pos.size, L1, L2, i, ans) )
2409 ||(mode ==_DATE && (!Compare( pos.size, L1, L2, i, ans) || (!Compare( pos.date, L1, L2, i, ans) ) ) ))
2410 {
2411 ListSelected(L1,i);
2412 ListSelected(L2,ans);
2413 }
2414 }
2415 i++;
2416 }
2417 }
2418
2419
2420 // ���O�����O�i�T�C�Y�����b���t�����j
2421
2422 void CompareList_Date(HWND L1, HWND L2)
2423 {
2424 CompareList(L1, L2, _DATE);
2425 }
2426
2427 // ���O�����O�T�C�Y����
2428
2429 void CompareList_Size(HWND L1, HWND L2)
2430 {
2431 CompareList(L1, L2, _SIZE);
2432 }
2433
2434 // ���O����
2435
2436 void CompareList(HWND L1, HWND L2)
2437 {
2438 CompareList(L1, L2, _ONLY);
2439 }
2440
2441
2442 void SelectReverse(HWND hList)
2443 {
2444 int i =0;
2445 UINT ans;
2446 int max =ListView_GetItemCount(hList);
2447 while( i < max )
2448 {
2449 ans = ListView_GetItemState(hList,i,LVIS_SELECTED);
2450 if ( ans > 0 )
2451 {
2452 ListSelected( hList, i, FALSE);
2453 }
2454 else
2455 {
2456 ListSelected( hList, i, TRUE);
2457 }
2458 i++;
2459 }
2460 }
2461
2462
2463 void setsel(HWND hList, char *key)
2464 {
2465 if(key ==NULL) return;
2466 ListNonSelected( hList );
2467 if( strlen(key)==0 ) return;
2468 char buffer[1000];
2469 int i =0;
2470 int max=ListView_GetItemCount(hList);
2471
2472 while(i<max)
2473 {
2474 ListView_GetItemText(hList, i, pos.name, buffer, 1000);
2475 if( strstr(buffer, key) != NULL ) ListSelected(hList,i);
2476 if( strlen(buffer) == 0) break;
2477 i++;
2478 }
2479 }
2480
2481
2482 BOOL MyZip(dirw &Fdir,dirw &Tdir,HWND hList)
2483 {
2484 int iIndex;
2485 DWORD dwSize;
2486 char szMsg[512], ToFile[MAX_PATH], FromFile[MAX_PATH], szFile[MAX_PATH], ToPath[MAX_PATH], FromPath[MAX_PATH];
2487
2488 dwSize = MAX_PATH;
2489 Tdir.GetCurrentDirectory(dwSize, ToPath);
2490 Fdir.GetCurrentDirectory(dwSize, FromPath);
2491 iIndex =-1;
2492 BOOL flag=FALSE;
2493
2494 if( ! dllLoad("zip32j.dll", "Zip") ) return FALSE;
2495 while(1)
2496 {
2497 iIndex = ListView_GetNextItem( hList, iIndex, LVNI_ALL | LVNI_SELECTED);
2498 if (iIndex == -1) break;
2499 ListView_GetItemText(hList, iIndex, pos.name, szFile, sizeof(szFile));
2500 if(strlen(szFile)==0 || strcmp(szFile,".")==0 || strcmp(szFile, "..")==0) continue;
2501
2502 MyGetFullName(FromFile, szFile, FromPath, MAX_PATH);
2503 if(!flag)
2504 {
2505 flag=TRUE;
2506 MyGetFullName(ToFile, szFile, ToPath, MAX_PATH);
2507 };
2508 wsprintf(szMsg,
2509 "zip %s >> %s.zip , %d",
2510 FromFile, ToFile,iIndex);
2511 setstatus(szMsg);
2512 DoZip( hList, ToFile, FromFile);
2513 }
2514 FreeDll();
2515 savelocaldir(1, FromPath);
2516 return TRUE;
2517 }
2518
2519 BOOL MyLzh(dirw &Fdir,dirw &Tdir,HWND hList)
2520 {
2521 int iIndex;
2522 DWORD dwSize;
2523 char szMsg[512], ToFile[MAX_PATH], FromFile[MAX_PATH], szFile[MAX_PATH], ToPath[MAX_PATH], FromPath[MAX_PATH];
2524
2525 dwSize = MAX_PATH;
2526 Tdir.GetCurrentDirectory(dwSize, ToPath);
2527 Fdir.GetCurrentDirectory(dwSize, FromPath);
2528 iIndex =-1;
2529 BOOL flag=FALSE;
2530
2531 if( ! dllLoad("unlha32.dll", "Unlha") ) return FALSE;
2532 while(1)
2533 {
2534 iIndex = ListView_GetNextItem( hList, iIndex, LVNI_ALL | LVNI_SELECTED);
2535 if (iIndex == -1) break;
2536 ListView_GetItemText(hList, iIndex, pos.name, szFile, sizeof(szFile));
2537 if(strlen(szFile)==0 || strcmp(szFile,".")==0 || strcmp(szFile, "..")==0) continue;
2538
2539 MyGetFullName(FromFile, szFile, FromPath, MAX_PATH);
2540 if(!flag)
2541 {
2542 flag=TRUE;
2543 MyGetFullName(ToFile, szFile, ToPath, MAX_PATH);
2544 };
2545 wsprintf(szMsg,
2546 "lha %s >> %s.lzh , %d",
2547 FromFile, ToFile,iIndex);
2548 setstatus(szMsg);
2549 DoLzh( hList, ToFile, FromPath, szFile);
2550 }
2551 FreeDll();
2552 savelocaldir(1, FromPath);
2553 return TRUE;
2554 }
2555
2556 BOOL MyUnLzh(dirw &Fdir,dirw &Tdir,HWND hList)
2557 {
2558 int iIndex;
2559 DWORD dwSize;
2560 char szMsg[512], ToFile[MAX_PATH], FromFile[MAX_PATH], szFile[MAX_PATH], ToPath[MAX_PATH], FromPath[MAX_PATH];
2561
2562 dwSize = MAX_PATH;
2563 Tdir.GetCurrentDirectory(dwSize, ToPath);
2564 Fdir.GetCurrentDirectory(dwSize, FromPath);
2565 iIndex =-1;
2566 BOOL flag=FALSE;
2567
2568 if( ! dllLoad("unlha32.dll", "Unlha") ) return FALSE;
2569 iIndex = ListView_GetNextItem( hList, iIndex, LVNI_ALL | LVNI_SELECTED);
2570 if (iIndex == -1) return FALSE;
2571 ListView_GetItemText(hList, iIndex, pos.name, szFile, sizeof(szFile));
2572 MyGetFullName(FromFile, szFile, FromPath, MAX_PATH);
2573 wsprintf(szMsg,
2574 "unlha %s >> %s , %d",
2575 FromFile, ToPath, iIndex);
2576 setstatus(szMsg);
2577 DoUnLzh( hList, ToPath, FromFile);
2578 FreeDll();
2579 savelocaldir(1, FromPath);
2580 return TRUE;
2581 }
2582
2583 // �����t�H���_��������_1��������������
2584
2585 void MyCopyHere(HWND hWnd, dirw &Tdir,HWND hList)
2586 {
2587 int iIndex;
2588 DWORD dwSize;
2589 char szMsg[512], ToFile[MAX_PATH], FromFile[MAX_PATH], szFile[MAX_PATH], FromPath[MAX_PATH];
2590 char *ToPath =FromPath;
2591
2592 dwSize = MAX_PATH;
2593 Tdir.GetCurrentDirectory(dwSize, ToPath);
2594 iIndex =-1;
2595 while(1)
2596 {
2597 iIndex = ListView_GetNextItem( hList, iIndex, LVNI_ALL | LVNI_SELECTED);
2598 if (iIndex == -1) break;
2599 ListView_GetItemText(hList, iIndex, pos.name, szFile, sizeof(szFile));
2600 GetFullName(FromFile, szFile, ToPath, MAX_PATH);
2601 makenewfilenameEx(FromFile, ToFile);
2602 wsprintf(szMsg,
2603 "%s >> %s , %d",
2604 FromFile, ToFile,iIndex);
2605 setstatus(szMsg);
2606 //Mes( szFile );CopyFileEx()
2607 CopyFileOne( FromFile, ToFile, FALSE );
2608 colorrefresh();
2609 }
2610 savelocaldir(1, FromPath);
2611 return;
2612 }
2613
2614
2615 // �O�������h���b�O�������������R�s�[
2616
2617 BOOL MyDragCopy(char *from,dirw &Tdir)
2618 {
2619 int iIndex;
2620 DWORD dwSize;
2621 char szMsg[512], ToFile[MAX_PATH], FromFile[MAX_PATH], szFile[MAX_PATH], ToPath[MAX_PATH], FromPath[MAX_PATH];
2622
2623 dwSize = MAX_PATH;
2624 Tdir.GetCurrentDirectory(dwSize, ToPath);
2625 char *p=strrchr(from,'\\');
2626 if(p==NULL) return FALSE;
2627 p++;
2628 MyGetFullName(ToFile, p, ToPath, MAX_PATH);
2629 wsprintf(szMsg,
2630 "%s >> %s ",
2631 from, ToFile);
2632 setstatus(szMsg);
2633 //Mes( szFile );CopyFileEx()
2634 CopyFileOne( from, ToFile, FALSE );
2635 colorrefresh();
2636 return TRUE;
2637 }
2638
2639 void MyCopy(dirw &Fdir,dirw &Tdir,HWND hList)
2640 {
2641 int iIndex;
2642 DWORD dwSize;
2643 char szMsg[512], ToFile[MAX_PATH], FromFile[MAX_PATH], szFile[MAX_PATH], ToPath[MAX_PATH], FromPath[MAX_PATH];
2644
2645 dwSize = MAX_PATH;
2646 Tdir.GetCurrentDirectory(dwSize, ToPath);
2647 Fdir.GetCurrentDirectory(dwSize, FromPath);
2648 iIndex =-1;
2649 while(1)
2650 {
2651 iIndex = ListView_GetNextItem( hList, iIndex, LVNI_ALL | LVNI_SELECTED);
2652 if (iIndex == -1) break;
2653 ListView_GetItemText(hList, iIndex, pos.name, szFile, sizeof(szFile));
2654 MyGetFullName(ToFile, szFile, ToPath, MAX_PATH);
2655 MyGetFullName(FromFile, szFile, FromPath, MAX_PATH);
2656 wsprintf(szMsg,
2657 "%s >> %s , %d",
2658 FromFile, ToFile,iIndex);
2659 setstatus(szMsg);
2660 //Mes( szFile );CopyFileEx()
2661 CopyFileOne( FromFile, ToFile, FALSE );
2662 colorrefresh();
2663 }
2664 savelocaldir(1, FromPath);
2665 return;
2666 }
2667
2668 // �������AiFro����iTo�����������R�s�[
2669 void makenewnameCut(char *from, char *to, int iFr, int iTo)
2670 {
2671 if( strlen(from)<iTo ) return;
2672 int j=0;
2673 for( int i=0; i<strlen(from)+1 ; i++)
2674 {
2675 if(i<iFr || i>iTo ) {
2676 to[j] = from[i];
2677 j++;
2678 }
2679 }
2680 }
2681
2682 BOOL MyRename(dirw &dir)
2683 {
2684 iset mset;
2685 if (DialogBoxParam(hInst, "MYRENAME",
2686 hMainWnd, (DLGPROC)GetFromToProc, (LPARAM)&mset) == IDCANCEL)
2687 return FALSE;
2688 int iIndex;
2689 HWND hList =dir.getList();
2690 DWORD dwSize;
2691 char szMsg[512], ToFile[MAX_PATH], FromFile[MAX_PATH], File[MAX_PATH], FileN[MAX_PATH], FromPath[MAX_PATH];
2692
2693 dwSize = MAX_PATH;
2694 dir.GetCurrentDirectory(dwSize, FromPath);
2695 iIndex =-1;
2696 while(1)
2697 {
2698 iIndex = ListView_GetNextItem( hList, iIndex, LVNI_ALL | LVNI_SELECTED);
2699 if (iIndex == -1) break;
2700 ListView_GetItemText(hList, iIndex, pos.name, File, sizeof(File));
2701 makenewnameCut(File, FileN, mset.from-1, mset.to-1);
2702 GetFullName(ToFile, FileN, FromPath, MAX_PATH);
2703 GetFullName(FromFile, File, FromPath, MAX_PATH);
2704 wsprintf(szMsg,
2705 "rename %s > %s , %d",
2706 FromFile, ToFile,iIndex);
2707 setstatus(szMsg);
2708 //Mes( szFile );
2709 rename( FromFile, ToFile );
2710 }
2711 savelocaldir(1, FromPath);
2712 return TRUE;
2713 }
2714
2715 void MyDown(HWND hWnd,
2716 HWND hList, HWND hListL)
2717 {
2718 MyCopy(RDir,LDir,hList);
2719 }
2720
2721 void MyUp(HWND hWnd,
2722 HWND hList, HWND hListL)
2723 {
2724 MyCopy(LDir,RDir,hListL);
2725 }
2726
2727 void MyCutUp(DWORD st, DWORD len)
2728 {
2729 MyCutCopy(*NDir,*NXDir,st,len);
2730 }
2731
2732 void MyCutHere(DWORD st, DWORD len)
2733 {
2734 HWND hList =NList;
2735 int iIndex;
2736 DWORD dwSize;
2737 char szMsg[512], ToFile[MAX_PATH],Dummy[MAX_PATH], FromFile[MAX_PATH], szFile[MAX_PATH], ToPath[MAX_PATH], FromPath[MAX_PATH];
2738
2739 dwSize = MAX_PATH;
2740 NDir->GetCurrentDirectory(dwSize, ToPath);
2741 NDir->GetCurrentDirectory(dwSize, FromPath);
2742 iIndex =-1;
2743 while(1)
2744 {
2745 iIndex = ListView_GetNextItem( hList, iIndex, LVNI_ALL | LVNI_SELECTED);
2746 if (iIndex == -1) break;
2747 ListView_GetItemText(hList, iIndex, pos.name, szFile, sizeof(szFile));
2748 GetFullName(ToFile, szFile, ToPath, MAX_PATH);
2749 GetFullName(FromFile, szFile, FromPath, MAX_PATH);
2750 wsprintf(Dummy, "%s.$$$", FromFile);
2751 rename( FromFile, Dummy );
2752 wsprintf(szMsg,
2753 "cut , %d",
2754 len);
2755 cutcopy( Dummy, ToFile, st, len );
2756 }
2757 savelocaldir(1, FromPath);
2758 return;
2759 }
2760
2761
2762
2763 void MyCreatDir(HWND hWnd, dirw *dir)
2764 {
2765 char szDir[MAX_PATH];
2766 char command[MAX_PATH*2];
2767 HINSTANCE hInst;
2768 int iIndex;
2769
2770 hInst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);
2771 /*
2772 iIndex = DialogBoxParam(hInst, "MYCREATEDIR", hWnd,
2773 (DLGPROC)MyCreateDirProc, (LPARAM)szDir);
2774 */
2775 if( ! GetStrDlg("new", szDir))
2776 return;
2777 wsprintf(command,"mkdir %s",szDir);
2778 system(command);
2779 return;
2780 }
2781
2782 BOOL MyFilter(HWND hWnd)
2783 {
2784 char str[MAX_FILTER]="filter";
2785 char command[MAX_PATH*2];
2786 int iIndex;
2787
2788 if( ! GetStrDlg("filter", str))
2789 return FALSE;
2790 setfilter(str);
2791 return TRUE;
2792 }
2793
2794
2795 //�J�����g�f�B���N�g�����e�L�X�g�t�@�C�������A�������`�F�b�N����
2796
2797 BOOL MyCreatFile(HWND hWnd, dirw *)
2798 {
2799 char szDir[MAX_PATH]="�V�K�e�L�X�g����";
2800 // char command[MAX_PATH*2];
2801 HINSTANCE hInst;
2802 int iIndex;
2803
2804 hInst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);
2805
2806 if( ! GetStrDlg("new", szDir)) return FALSE;
2807 ofstream ou;
2808 if(strlen(szDir)>0)
2809 {
2810 ou.open(szDir);
2811 return TRUE;
2812 }
2813 return FALSE;
2814 }
2815
2816 //�J�����g�f�B���N�g�����������e�L�X�g�t�@�C�������A�������`�F�b�N����
2817
2818 BOOL MyCreatBlankFile()
2819 {
2820 char szDir[MAX_PATH];
2821 SYSTEMTIME st;
2822 char jikan[16];
2823 char form[]="%04d%02d%02d-%02d%02d%02d.txt";
2824
2825 GetLocalTime(&st);
2826 wsprintf(
2827 szDir,
2828 form,
2829
2830 st.wYear,
2831 st.wMonth,
2832 st.wDay,
2833
2834 st.wHour,
2835 st.wMinute,
2836 st.wSecond
2837 );
2838 ofstream ou;
2839 if(ou && strlen(szDir)>0)
2840 {
2841 ou.open(szDir);
2842 return TRUE;
2843 }
2844 return FALSE;
2845 }
2846
2847
2848
2849 LRESULT CALLBACK MyCreateDirProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
2850 {
2851 static char *lpDirName, *val;
2852 static HWND hEdit;
2853
2854 switch (msg) {
2855 case WM_INITDIALOG:
2856 lpDirName = (char *)(((strsets*)lp)->title);
2857 val = (char *)((strsets*)lp)->val;
2858 hEdit = GetDlgItem(hDlg, IDC_EDIT1);
2859 if(lpDirName[0]!=0) SetWindowText(hDlg, lpDirName);
2860 if(strcmp(lpDirName, "filter") == 0 ) SetWindowText(hEdit, Filter);
2861 if(val != NULL ) SetWindowText(hEdit, val);
2862 return TRUE;
2863 case WM_COMMAND:
2864 switch (LOWORD(wp)) {
2865 case IDOK:
2866 Edit_GetText(hEdit, lpDirName, MAX_PATH);
2867 EndDialog(hDlg, IDOK);
2868 break;
2869 case IDCANCEL:
2870 EndDialog(hDlg, IDCANCEL);
2871 break;
2872 default :
2873 return FALSE;
2874 };
2875 default :
2876 return FALSE;
2877
2878 }
2879 return TRUE;
2880 }
2881
2882
2883 HWND MakeMyList(HWND hWnd,int id)
2884 {
2885 HWND hList;
2886 DWORD dwStyle;
2887 HINSTANCE hInst;
2888 DWORD style =WS_CHILD | WS_VISIBLE | LVS_REPORT | WS_BORDER | LVS_SHOWSELALWAYS;
2889 if(!columnhead) style |= LVS_NOCOLUMNHEADER;
2890
2891 hInst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);
2892 hList = CreateWindowEx(0, WC_LISTVIEW, "",
2893 style , 0, 0, 0, 0, hWnd, (HMENU) id, hInst, NULL);
2894 dwStyle = ListView_GetExtendedListViewStyle(hList);
2895 dwStyle |= LVS_EX_FULLROWSELECT |
2896 LVS_EX_HEADERDRAGDROP;//LVS_EX_GRIDLINES |
2897 ListView_SetExtendedListViewStyle(hList, dwStyle);
2898
2899 if(paintf)
2900 {
2901 setlistcolor(hList);
2902 }
2903
2904 return hList;
2905 }

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision
svn:mime-type text/plain

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26