File: FM_rc.cpp

package info (click to toggle)
p7zip-rar 16.02-1
  • links: PTS, VCS
  • area: non-free
  • in suites: stretch
  • size: 14,120 kB
  • ctags: 24,239
  • sloc: cpp: 171,237; ansic: 14,992; python: 1,911; asm: 1,688; sh: 959; makefile: 676
file content (1170 lines) | stat: -rw-r--r-- 35,844 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
#include "StdAfx.h"

// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"

#ifdef __BORLANDC__
#pragma hdrstop
#endif

#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif

#include "wx/mimetype.h"
#include "wx/artprov.h"
#include "wx/imaglist.h"

#undef _WIN32
 
#include "resource.h"

#include "PropertyNameRes.h"

#include "App.h"

#include "Windows/Window.h" // FIXME
#include "Windows/Control/DialogImpl.h"
#include "Windows/Control/ListView.h"
#include "Windows/Control/Window2.h"

#define static const
#include "../GUI/p7zip_32.xpm"
#undef static

extern HWND g_HWND;

#define BASE_ID_PANEL_1 (1000 + 100 * 0)
#define BASE_ID_PANEL_2 (1000 + 100 * 1)

////////////////////////////////////// Tool bar images
#include "res/AddPNG.h"
#include "res/Add2PNG.h"
#include "res/ExtractPNG.h"
#include "res/Extract2PNG.h"
#include "res/TestPNG.h"
#include "res/Test2PNG.h"
#include "res/CopyPNG.h"
#include "res/Copy2PNG.h"
#include "res/MovePNG.h"
#include "res/Move2PNG.h"
#include "res/DeletePNG.h"
#include "res/Delete2PNG.h"
#include "res/InfoPNG.h"
#include "res/Info2PNG.h"

#include "LangUtils.h"

#include <wx/mstream.h>
#define wxGetBitmapFromMemory(name) _wxGetBitmapFromMemory(name ## _png, sizeof(name ## _png))

static inline wxBitmap _wxGetBitmapFromMemory(const unsigned char *data, int length) {
	wxMemoryInputStream is(data, length);
	return wxBitmap(wxImage(is, wxBITMAP_TYPE_ANY, -1), -1);
}

///////////////////////////////////// SevenZipPanel.h /////////////////////

#include <wx/listctrl.h>

typedef wxListCtrl CExplorerListCtrl;

class MyFrame;
class myToolBar;

class SevenZipPanel : public wxPanel
{
	static int count;
	
	MyFrame *m_frame;
	
	CExplorerListCtrl *m_pListCtrlExplorer;
	NWindows::NControl::CWindow2 *_wList;
	

	wxBitmapButton *m_pBmpButtonParentFolder;
	wxComboBox *m_pComboBoxPath;
	wxStatusBar *m_pStatusBar;

	wxImageList imgList;

	int _panelIndex;

	// wxString m_currentDirectory;

	// int m_nbDirs;

	// wxString m_prompt;

public:
	SevenZipPanel(MyFrame *frame, wxWindow *parent,int id,int panelIndex);

	void registerWindow2(NWindows::NControl::CWindow2 *w)
	{
		_wList = w;
		_wList->OnMessage(WM_CREATE,0,0);
	}
		
	void OnAnyButton( wxCommandEvent &event );
	void OnSelected(wxListEvent& event);
	void OnDeselected(wxListEvent& event);
	void OnActivated(wxListEvent& event);
	void OnFocused(wxListEvent& event);
	void OnLeftDownBeginDrag(wxListEvent& event);
	void OnRightClick(wxListEvent& event);
	void OnColumnClick(wxListEvent& event);

	void OnLeftDown(wxMouseEvent &event );
	void OnRightDown(wxMouseEvent &event );
	
	void OnTextEnter(wxCommandEvent& event);
	
        void WriteText(const wxString& text) {
		printf("DEBUG : %ls",(const wchar_t *)text);
        }

	/* Don't work ...
	void OnCloseWindow(wxCloseEvent& WXUNUSED(event)) {
		_wList->OnDestroy();
	}
	*/

	void evt_destroy() {
		_wList->OnDestroy();
	}


private:
		DECLARE_EVENT_TABLE()
};



///////////////////////////////////// SevenZipPanel.h /////////////////////



class MyFrame: public wxFrame
{
public:
    // ctor
 MyFrame(void (*fct)(HWND),wxFrame *frame, const wxString& title, int x, int y, int w, int h);
    // virtual ~MyFrame();

	void registerWindow2(int baseID,NWindows::NControl::CWindow2 *w)
	{
		printf("MyFrame::registerWindow2(%d,%p)\n",baseID,w);
		switch (baseID)
		{
			case BASE_ID_PANEL_1: _panel1->registerWindow2(w); break;
			case BASE_ID_PANEL_2: _panel2->registerWindow2(w); break;
			default: printf("FIXME - MyFrame::registerWindow2\n");
		}
	}

	void PopulateToolbar(wxToolBar* toolBar);
	void RecreateToolbar();


protected:
	// callbacks
	void OnWorkerEvent(wxCommandEvent& event);
	void OnAnyMenu(wxCommandEvent& event)
	{
		extern bool OnMenuCommand(HWND hWnd, int id);
		extern void ExecuteCommand(UINT commandID);

		int wmId = event.GetId();

		if (wmId >= kMenuCmdID_Toolbar_Start && wmId < kMenuCmdID_Toolbar_End)
		{
			ExecuteCommand(wmId);
			return ; // 0;
		}
		OnMenuCommand(this, wmId);
	}
	void OnCloseWindow(wxCloseEvent& WXUNUSED(event))
	{
		if (_panel1) _panel1->evt_destroy();
		if (_panel2) _panel2->evt_destroy();

		extern void main_WM_DESTROY();
		main_WM_DESTROY();
		Destroy();
	}
private:
	SevenZipPanel * _panel1;
	SevenZipPanel * _panel2;
	myToolBar     * m_toolBar;
    DECLARE_EVENT_TABLE()
};

BEGIN_EVENT_TABLE(MyFrame, wxFrame)
	EVT_MENU(WORKER_EVENT, MyFrame::OnWorkerEvent)
	EVT_MENU(wxID_ANY, MyFrame::OnAnyMenu)
	EVT_CLOSE(MyFrame::OnCloseWindow)
END_EVENT_TABLE()


static bool TEST_create(HWND hWnd) // FIXME
{
extern HWND g_HWND;
	 CMyListView _listView;
	
	int _baseID = 1000;
	
	HWND w = NWindows::GetDlgItem(g_HWND, _baseID + 1);
	if (w == 0) 
	{
		printf("Can't find id=%d\n",_baseID + 1);
		return false;
	}
	printf("CPanel::OnCreate : _listView.Attach(%p)\n",w);
	_listView.Attach(w);
	
	_listView.SetRedraw(false);
	
	_listView.DeleteAllItems();
	
	_listView.DeleteColumn(1);
		
	_listView.InsertColumn(0, L"toto", 100);
	
//	_listView.SetItemCount(1);

	_listView.InsertItem(0, L"item 1");


	_listView.SetRedraw(true);	
	
	return true;
}

// My frame constructor
MyFrame::MyFrame(void (*wm_create)(HWND),wxFrame *frame, const wxString& title,
                 int x, int y, int w, int h)
       : wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h))
{
printf("===MyFrame::MyFrame===BEGIN===\n");

	m_toolBar = 0;

	this->SetIcon(wxICON(p7zip_32));
	
	g_HWND = this; // FIXME
	
	SetMinSize(wxSize(800,700));
	
	wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );

	_panel1 = new SevenZipPanel(this,this,BASE_ID_PANEL_1,0);  // FIXME panelIndex = 0
	_panel2 = 0;
	topsizer->Add(
		_panel1,
		1,            // make vertically stretchable
		wxEXPAND |    // make horizontally stretchable
		wxALL,        //   and make border all around
		0 );         // set border width to 10

	// Create the toolbar
	// FIXME RecreateToolbar();
printf("===MyFrame::MyFrame===WM_CREATE===\n");
	wm_create(this);
// FIXME	TEST_create(this);
	
	
       // Create the toolbar // FIXME
	RecreateToolbar();


printf("===MyFrame::MyFrame===SIZER===\n");

	SetSizer( topsizer );      // use the sizer for layout

	topsizer->SetSizeHints( this );   // set size hints to honour minimum size
printf("===MyFrame::MyFrame===END===\n");
}

void myCreateHandle(int n);
void MyFrame::OnWorkerEvent(wxCommandEvent& event)
{
	int n = event.GetInt();
// printf(" MyFrame::OnWorkerEvent(n=%d)\n",n);
	myCreateHandle(n);
}

wxWindow * g_window=0;
HWND myCreateAndShowMainWindow(LPCTSTR title,void (*fct)(HWND))
{
   MyFrame *frame = new MyFrame(fct,(wxFrame *)NULL, title, 40, 40, 800, 600);

   g_window = frame; 
  
   // Don't Show the frame !
   frame->Show(true); // FIXME

   // FIXME : SetTopWindow(g_HWND);

   return frame;
}


class myToolBar
{
	wxToolBar * m_toolbar;

	bool m_bShowText;

public:
	myToolBar(wxToolBar * toolbar,bool bShowText ) : m_toolbar(toolbar), m_bShowText(bShowText)  { }

	myToolBar* AddTool(int toolId, const wxString& label, const wxBitmap& bitmap1, const wxString& shortHelpString = _T(""), wxItemKind kind = wxITEM_NORMAL)
	{
		wxString text = wxEmptyString;
		if (m_bShowText) text = label;

		wxSize tb_size = m_toolbar->GetToolBitmapSize();
		int tb_witdh = tb_size.GetWidth();
		int tb_height = tb_size.GetHeight();

		if ((bitmap1.GetWidth() > tb_witdh) || ( bitmap1.GetHeight()> tb_height))
		{
			wxBitmap bmp(bitmap1.ConvertToImage().Scale(tb_witdh, tb_height));
			m_toolbar->AddTool(toolId,text,bmp,shortHelpString,kind);
		}
		else
		{
			m_toolbar->AddTool(toolId,text,bitmap1,shortHelpString,kind);
		}

		return this;
	}

	void SetToolBitmapSize(const wxSize& size)
	{
		m_toolbar->SetToolBitmapSize(size);
	}

	bool Realize()
	{
		return m_toolbar->Realize();
	}

	void AddSeparator() { m_toolbar->AddSeparator(); }
};

void MyFrame::PopulateToolbar(wxToolBar* p_toolBar)
{/*
 toolBar->AddTool(wxID_NEW, _T("New"),toolBarBitmaps[Tool_new], wxNullBitmap, wxITEM_NORMAL,
 _T("New file"), _T("This is help for new file tool"));
 */
   m_toolBar = new myToolBar(p_toolBar,true);

   const int kWidth  = 24;
   const int kHeight = 24;

	
   UString msg;

   // FIXME toolBar->SetToolBitmapSize(wxSize(24,24));
   m_toolBar->SetToolBitmapSize(wxSize(kWidth,kHeight));

    msg = LangString(IDS_ADD); //  kMenuCmdID_Toolbar_Add,     IDB_ADD,     IDB_ADD2,     IDS_ADD },
    if (msg == L"") msg = L"Add";
	m_toolBar->AddTool(kMenuCmdID_Toolbar_Add, (const wchar_t *)msg, wxGetBitmapFromMemory(ADD2));
	
    msg = LangString(IDS_EXTRACT); // { kMenuCmdID_Toolbar_Extract, IDB_EXTRACT, IDB_EXTRACT2, IDS_EXTRACT },
    if (msg == L"") msg = L"Extract";	
	m_toolBar->AddTool(kMenuCmdID_Toolbar_Extract,(const wchar_t *)msg, wxGetBitmapFromMemory(EXTRACT2));
	
    msg = LangString(IDS_TEST); // { kMenuCmdID_Toolbar_Test,    IDB_TEST,    IDB_TEST2,    IDS_TEST }
    if (msg == L"") msg = L"Test";	
   m_toolBar->AddTool(kMenuCmdID_Toolbar_Test,(const wchar_t *)msg, wxGetBitmapFromMemory(TEST2));
	
   m_toolBar->AddSeparator();

    msg = LangString(IDS_BUTTON_COPY); // { IDM_COPY_TO,    IDB_COPY,   IDB_COPY2,   IDS_BUTTON_COPY },
    if (msg == L"") msg = L"Copy";		
    m_toolBar->AddTool(IDS_BUTTON_COPY, (const wchar_t *)msg, wxGetBitmapFromMemory(COPY2));
	
    msg = LangString(IDS_BUTTON_MOVE); // { IDM_MOVE_TO,    IDB_MOVE,   IDB_MOVE2,   IDS_BUTTON_MOVE }
    if (msg == L"") msg = L"Move";		
    m_toolBar->AddTool(IDM_MOVE_TO, (const wchar_t *)msg, wxGetBitmapFromMemory(MOVE2));
	
    msg = LangString(IDS_BUTTON_DELETE); // { IDM_DELETE,     IDB_DELETE, IDB_DELETE2, IDS_BUTTON_DELETE } ,
    if (msg == L"") msg = L"Delete";	
    m_toolBar->AddTool(IDM_DELETE, (const wchar_t *)msg, wxGetBitmapFromMemory(DELETE2));
	
    msg = LangString(IDS_BUTTON_INFO); // { IDM_PROPERTIES, IDB_INFO,   IDB_INFO2,   IDS_BUTTON_INFO }
    if (msg == L"") msg = L"Info";	
    m_toolBar->AddTool(IDM_PROPERTIES, (const wchar_t *)msg, wxGetBitmapFromMemory(INFO2));

#if 0
	////////////////////////////////////////////////////////

	/* FIXME
	if (g_mimeDatabase)
	{
		toolBar.AddSeparator();

		TryMime(&toolBar, _T("txt"));
		TryMime(&toolBar, _T("rar"));
		TryMime(&toolBar, _T("7z"));
	}

	toolBar.AddSeparator();

	wxIcon i_plus = wxArtProvider::GetIcon(wxART_ADD_BOOKMARK    , wxART_TOOLBAR  , wxSize(kWidth,kHeight));
	m_toolBar->AddTool(wxID_ANY, wxT("Add Bookmark"), i_plus);

	wxIcon i_go_up_dir = wxArtProvider::GetIcon(wxART_GO_DIR_UP   , wxART_TOOLBAR  , wxSize(kWidth,kHeight));
	m_toolBar->AddTool(wxID_ANY, wxT("Go up dir"), i_go_up_dir);

	wxIcon i_folder = wxArtProvider::GetIcon(wxART_FOLDER   , wxART_TOOLBAR  , wxSize(kWidth,kHeight));
	m_toolBar->AddTool(wxID_ANY, wxT("Folder"), i_folder);

	wxIcon i_missing_image = wxArtProvider::GetIcon(wxART_MISSING_IMAGE   , wxART_TOOLBAR  , wxSize(kWidth,kHeight));
	m_toolBar->AddTool(wxID_ANY, wxT("missing image"), i_missing_image);
	*/

	///////////////////////////////////////////////////////

#endif
	m_toolBar->Realize();

	// toolBar->SetRows(!(toolBar->IsVertical()) ? m_rows : 10 / m_rows);
}
void MyFrame::RecreateToolbar()
{
	// delete and recreate the toolbar
	wxToolBar *toolBar = GetToolBar();
	// long style = toolBar ? toolBar->GetWindowStyle() : TOOLBAR_STYLE;

	SetToolBar(NULL);

	delete toolBar;
	/*
	style &= ~(wxTB_HORIZONTAL | wxTB_VERTICAL | wxTB_BOTTOM | wxTB_RIGHT | wxTB_HORZ_LAYOUT);
	switch( m_toolbarPosition )
	{
	case TOOLBAR_LEFT:style |= wxTB_LEFT; break;
	case TOOLBAR_TOP: style |= wxTB_TOP;break;
	case TOOLBAR_RIGHT:style |= wxTB_RIGHT;break;
	case TOOLBAR_BOTTOM:style |= wxTB_BOTTOM;break;
	}
	*/
	long style = wxTB_FLAT | wxTB_NODIVIDER | wxTB_TEXT; // TOOLBAR_STYLE | wxTB_TOP;
	/*
	if ( m_showTooltips ) style &= ~wxTB_NO_TOOLTIPS;
	else                  style |= wxTB_NO_TOOLTIPS;

	if ( style & wxTB_TEXT && !(style & wxTB_NOICONS) && m_horzText ) style |= wxTB_HORZ_LAYOUT;
	*/
	toolBar = CreateToolBar(style, wxID_ANY);

	PopulateToolbar(toolBar);
}

void registerWindow2(int baseID,NWindows::NControl::CWindow2 *w)
{
	MyFrame * f = (MyFrame *) g_HWND;
	f->registerWindow2(baseID,w);
	
}


/////////////////////////////////////////////////////////
#include "LangUtils.h"

static const UINT kOpenBookmarkMenuID = 730;  // FIXME / duplicate
static const UINT kSetBookmarkMenuID = 740;


void rc_MyLoadMenu(HWND hWnd)
{
	wxFrame *hwnd = (wxFrame *)hWnd;
	wxMenu *m;
	wxMenu *m_file = m = new wxMenu;
	{
		m->Append(IDM_OPEN, _T("&Open"));  // FIXME "&Open\tEnter" - don't use Enter to support combobox enter ...
		m->Append(IDM_OPEN_INSIDE,_T("Open &Inside\tCtrl+PgDn"));
		m->Append(IDM_OPEN_INSIDE_ONE,_T("Open Inside *"));
		m->Append(IDM_OPEN_INSIDE_PARSER,_T("Open Inside #"));
		m->Append(IDM_OPEN_OUTSIDE,_T("Open O&utside\tShift+Enter"));
		m->Append(IDM_FILE_VIEW,_T("&View\tF3"));
		m->Append(IDM_FILE_EDIT,_T("&Edit\tF4"));
		m->AppendSeparator();
		m->Append(IDM_RENAME,_T("Rena&me\tF2"));
		m->Append(IDM_COPY_TO,_T("&Copy To...\tF5"));
		m->Append(IDM_MOVE_TO,_T("&Move To...\tF6"));
		m->Append(IDM_DELETE,_T("&Delete\tDel"));
		m->AppendSeparator();
		m->Append(IDM_SPLIT,_T("&Split file..."));
		m->Append(IDM_COMBINE,_T("Com&bine files..."));
		m->AppendSeparator();
		m->Append(IDM_PROPERTIES,_T("P&roperties\tAlt+Enter"));
		m->Append(IDM_COMMENT,_T("Comme&nt\tCtrl+Z"));

		wxMenu * subMenuCRC = new wxMenu;
		subMenuCRC->Append(IDM_CRC32   ,_T("CRC-32"));
		subMenuCRC->Append(IDM_CRC64   ,_T("CRC-64"));
		subMenuCRC->Append(IDM_SHA1    ,_T("SHA-1"));
		subMenuCRC->Append(IDM_SHA256  ,_T("SHA-256"));
		subMenuCRC->Append(IDM_HASH_ALL,_T("*"));
		m->AppendSubMenu(subMenuCRC,_T("CRC"));

		m->Append(IDM_DIFF,_T("Di&ff"));
		m->AppendSeparator();
		m->Append(IDM_CREATE_FOLDER,_T("Create Folder\tF7"));
		m->Append(IDM_CREATE_FILE,_T("Create File\tCtrl+N"));
		m->AppendSeparator();
		m->Append(IDEXIT,_T("E&xit\tAlt+F4"));   
	}
	wxMenu *m_edit = m = new wxMenu;
	{
		// m->Append(IDM_EDIT_CUT, _T("Cu&t\tCtrl+X"))->Enable(true);              // GRAYED
		// m->Append(IDM_EDIT_COPY, _T("&Copy\tCtrl+C"))->Enable(true);            // GRAYED
		// m->Append(IDM_EDIT_PASTE, _T("&Paste\tCtrl+V"))->Enable(true);          // GRAYED
		// m->AppendSeparator();
		m->Append(IDM_SELECT_ALL, _T("Select &All\tShift+[Grey +]")); 
		m->Append(IDM_DESELECT_ALL, _T("Deselect All\tShift+[Grey -]")); 
		m->Append(IDM_INVERT_SELECTION, _T("&Invert Selection\tGrey *"));   
		m->Append(IDM_SELECT, _T("Select...\tGrey +"));           
		m->Append(IDM_DESELECT, _T("Deselect...\tGrey -"));        
// FIXME		m->Append(IDM_SELECT_BY_TYPE, _T("Select by Type\tAlt+[Grey+]")); 
// FIXME		m->Append(IDM_DESELECT_BY_TYPE, _T("Deselect by Type\tAlt+[Grey -]")); 
	}
	wxMenu *m_view = m = new wxMenu;
	{
/*
		m->AppendRadioItem(IDM_VIEW_LARGE_ICONS, _T("Lar&ge Icons\tCtrl+1"));        
		m->AppendRadioItem(IDM_VIEW_SMALL_ICONS, _T("S&mall Icons\tCtrl+2"));      
		m->AppendRadioItem(IDM_VIEW_LIST, _T("&List\tCtrl+3"));             
		m->AppendRadioItem(IDM_VIEW_DETAILS, _T("&Details\tCtrl+4"))->Check(true);  // CHECKED
		m->AppendSeparator();
		m->Append(IDM_VIEW_ARANGE_BY_NAME, _T("Name\tCtrl+F3"));               
		m->Append(IDM_VIEW_ARANGE_BY_TYPE, _T("Type\tCtrl+F4"));             
		m->Append(IDM_VIEW_ARANGE_BY_DATE, _T("Date\tCtrl+F5"));             
		m->Append(IDM_VIEW_ARANGE_BY_SIZE, _T("Size\tCtrl+F6"));               
		m->Append(IDM_VIEW_ARANGE_NO_SORT, _T("Unsorted\tCtrl+F7"));           
		m->AppendSeparator();
		m->AppendCheckItem(IDM_VIEW_FLAT_VIEW, _T("Flat View"));                   
		m->AppendCheckItem(IDM_VIEW_TWO_PANELS, _T("&2 Panels\tF9")); 

		{
			wxMenu* subMenu = new wxMenu;
			subMenu->AppendCheckItem(IDM_VIEW_ARCHIVE_TOOLBAR, _T("Archive Toolbar"));            
			subMenu->AppendCheckItem(IDM_VIEW_STANDARD_TOOLBAR, _T("Standard Toolbar"));            
			subMenu->AppendSeparator();
			subMenu->AppendCheckItem(IDM_VIEW_TOOLBARS_LARGE_BUTTONS, _T("Large Buttons"));               
			subMenu->AppendCheckItem(IDM_VIEW_TOOLBARS_SHOW_BUTTONS_TEXT, _T("Show Buttons Text"));           
			m->Append(12112, _T("Toolbars"), subMenu); // FIXME ID ?
		}
		m->AppendSeparator();
*/
		// NO "/" is used on Unix Path ... m->Append(IDM_OPEN_ROOT_FOLDER, _T("Open Root Folder\t" STRING_PATH_SEPARATOR));        
		m->Append(IDM_OPEN_ROOT_FOLDER, _T("Open Root Folder\t" "\\"));        

		m->Append(IDM_OPEN_PARENT_FOLDER, _T("Up One Level\tBackspace"));
		m->Append(IDM_FOLDERS_HISTORY, _T("Folders History...\tAlt+F12"));
		m->AppendSeparator();
		m->Append(IDM_VIEW_REFRESH, _T("&Refresh\tCtrl+R"));
	}
	wxMenu *m_favorites = m = new wxMenu;
	{
		{
			wxMenu* subMenu = new wxMenu;
			for (int i = 0; i < 10; i++)
			{
				UString s = LangString(IDS_BOOKMARK);
				s += L" ";
				wchar_t c = (wchar_t)(L'0' + i);
				s += c;
				s += L"\tAlt+Shift+";
				s += c;
				subMenu->Append( kSetBookmarkMenuID + i, wxString(s));
			}

			m->Append(12111, _T("&Add folder to Favorites as"), subMenu); // FIXME ID ?
		}
		m->AppendSeparator();
		for (int i = 0; i < 10; i++)
		{
      UString s = g_App.AppState.FastFolders.GetString(i);
      const int kMaxSize = 100;
      const int kFirstPartSize = kMaxSize / 2;
      if (s.Len() > kMaxSize)
      {
        s.Delete(kFirstPartSize, s.Len() - kMaxSize);
        s.Insert(kFirstPartSize, L" ... ");
      }
      if (s.IsEmpty())
        s = L'-';
      s += L"\tAlt+";
      s += (wchar_t)(L'0' + i);
			// menu.AppendItem(MF_STRING, kOpenBookmarkMenuID + i, s);
			m->Append( kOpenBookmarkMenuID + i, wxString(s));
		}
		
	}
	wxMenu *m_tools = m = new wxMenu;
	{
//		m->Append(IDM_OPTIONS, _T("&Options..."));
		m->Append(IDM_BENCHMARK, _T("&Benchmark"));
	}
	wxMenu *m_help = m = new wxMenu;
	{
		m->Append(IDM_HELP_CONTENTS, _T("&Contents...\tF1"));
		m->AppendSeparator();
		m->Append(IDM_ABOUT, _T("&About 7-Zip..."));
	}

	wxMenuBar *menuBar = new wxMenuBar;

	menuBar->Append(m_file, _T("&File"));
	menuBar->Append(m_edit, _T("&Edit"));
	menuBar->Append(m_view, _T("&View"));
	menuBar->Append(m_favorites, _T("F&avorites"));
	menuBar->Append(m_tools, _T("&Tools"));
	menuBar->Append(m_help, _T("&Help"));
	hwnd->SetMenuBar(menuBar);
}

//////////////////////////////////////////////////////////////////


static CStringTable g_stringTable[] =
{
  /* resource.rc */	  
  /***************/
  { IDS_BOOKMARK   ,L"Bookmark" },

  { IDS_OPTIONS    ,L"Options" },

  { IDS_N_SELECTED_ITEMS  ,L"{0} object(s) selected" },

  { IDS_FILE_EXIST  ,L"File {0} is already exist" },
  { IDS_WANT_UPDATE_MODIFIED_FILE  ,L"File '{0}' was modified.\nDo you want to update it in the archive?" },
  { IDS_CANNOT_UPDATE_FILE   ,L"Can not update file\n'{0}'" },
  { IDS_CANNOT_START_EDITOR  ,L"Cannot start editor." },
  { IDS_VIRUS                ,L"The file looks like a virus (the file name contains long spaces in name)." },
  { IDS_MESSAGE_UNSUPPORTED_OPERATION_FOR_LONG_PATH_FOLDER ,L"The operation cannot be called from a folder that has a long path." },
  { IDS_SELECT_ONE_FILE      ,L"You must select one file" },
  { IDS_SELECT_FILES         ,L"You must select one or more files" },
  { IDS_TOO_MANY_ITEMS       ,L"Too many items" },

  { IDS_COPY      ,L"Copy" },
  { IDS_MOVE      ,L"Move" },
  { IDS_COPY_TO   ,L"Copy to:" },
  { IDS_MOVE_TO   ,L"Move to:" },
  { IDS_COPYING   ,L"Copying..." },
  { IDS_MOVING    ,L"Moving..." },
  { IDS_RENAMING  ,L"Renaming..." },

  { IDS_OPERATION_IS_NOT_SUPPORTED  ,L"Operation is not supported." },
  { IDS_ERROR_RENAMING  ,L"Error Renaming File or Folder" },
  { IDS_CONFIRM_FILE_COPY   ,L"Confirm File Copy" },
  { IDS_WANT_TO_COPY_FILES  ,L"Are you sure you want to copy files to archive" },

  { IDS_CONFIRM_FILE_DELETE   ,L"Confirm File Delete" },
  { IDS_CONFIRM_FOLDER_DELETE ,L"Confirm Folder Delete" },
  { IDS_CONFIRM_ITEMS_DELETE  ,L"Confirm Multiple File Delete" },
  { IDS_WANT_TO_DELETE_FILE   ,L"Are you sure you want to delete '{0}'?" },
  { IDS_WANT_TO_DELETE_FOLDER ,L"Are you sure you want to delete the folder '{0}' and all its contents?" },
  { IDS_WANT_TO_DELETE_ITEMS  ,L"Are you sure you want to delete these {0} items?" },
  { IDS_DELETING              ,L"Deleting..." },
  { IDS_ERROR_DELETING        ,L"Error Deleting File or Folder" },
  { IDS_ERROR_LONG_PATH_TO_RECYCLE  ,L"The system cannot move a file with long path to the Recycle Bin" },
  
  { IDS_CREATE_FOLDER       ,L"Create Folder" },
  { IDS_CREATE_FILE         ,L"Create File" },
  { IDS_CREATE_FOLDER_NAME  ,L"Folder name:" },
  { IDS_CREATE_FILE_NAME    ,L"File Name:" },
  { IDS_CREATE_FOLDER_DEFAULT_NAME  ,L"New Folder" },
  { IDS_CREATE_FILE_DEFAULT_NAME    ,L"New File" },
  { IDS_CREATE_FOLDER_ERROR ,L"Error Creating Folder" },
  { IDS_CREATE_FILE_ERROR   ,L"Error Creating File" },

  { IDS_COMMENT      ,L"Comment" },
  { IDS_COMMENT2     ,L"&Comment:" },
  { IDS_SELECT       ,L"Select" },
  { IDS_DESELECT     ,L"Deselect" },
  { IDS_SELECT_MASK  ,L"Mask:" },

  { IDS_PROPERTIES   ,L"Properties" },
  { IDS_FOLDERS_HISTORY  ,L"Folders History" },

  { IDS_COMPUTER   ,L"Computer" },
  { IDS_NETWORK    ,L"Network" },
  { IDS_DOCUMENTS  ,L"Documents" },
  { IDS_SYSTEM     ,L"System" },

  { IDS_ADD            ,L"Add" },
  { IDS_EXTRACT        ,L"Extract" },
  { IDS_TEST           ,L"Test" },
  { IDS_BUTTON_COPY    ,L"Copy" },
  { IDS_BUTTON_MOVE    ,L"Move" },
  { IDS_BUTTON_DELETE  ,L"Delete" },
  { IDS_BUTTON_INFO    ,L"Info" },

  { IDS_SPLITTING            ,L"Splitting..." },
  { IDS_SPLIT_CONFIRM_TITLE  ,L"Confirm Splitting" },
  { IDS_SPLIT_CONFIRM_MESSAGE  ,L"Are you sure you want to split file into {0} volumes?" },
  { IDS_SPLIT_VOL_MUST_BE_SMALLER ,L"Volume size must be smaller than size of original file" },

  { IDS_COMBINE     ,L"Combine Files" },
  { IDS_COMBINE_TO  ,L"&Combine to:" },
  { IDS_COMBINING   ,L"Combining..." },
  { IDS_COMBINE_SELECT_ONE_FILE  ,L"Select only first part of split file" },
  { IDS_COMBINE_CANT_DETECT_SPLIT_FILE  ,L"Can not detect file as split file" },
  { IDS_COMBINE_CANT_FIND_MORE_THAN_ONE_PART  ,L"Can not find more than one part of split file" },



  /* PropertyName.rc */	  
  /*******************/
  { IDS_PROP_PATH         ,L"Path" },
  { IDS_PROP_NAME         ,L"Name" },
  { IDS_PROP_EXTENSION    ,L"Extension" },
  { IDS_PROP_IS_FOLDER    ,L"Folder" },
  { IDS_PROP_SIZE         ,L"Size" },
  { IDS_PROP_PACKED_SIZE  ,L"Packed Size" },
  { IDS_PROP_ATTRIBUTES   ,L"Attributes" },
  { IDS_PROP_CTIME        ,L"Created" },
  { IDS_PROP_ATIME        ,L"Accessed" },
  { IDS_PROP_MTIME        ,L"Modified" },
  { IDS_PROP_SOLID        ,L"Solid" },
  { IDS_PROP_C0MMENTED    ,L"Commented" },
  { IDS_PROP_ENCRYPTED    ,L"Encrypted" },
  { IDS_PROP_SPLIT_BEFORE ,L"Split Before" },
  { IDS_PROP_SPLIT_AFTER  ,L"Split After" },
  { IDS_PROP_DICTIONARY_SIZE ,L"Dictionary" },
  { IDS_PROP_CRC          ,L"CRC" },
  { IDS_PROP_FILE_TYPE    ,L"Type" },
  { IDS_PROP_ANTI         ,L"Anti" },
  { IDS_PROP_METHOD       ,L"Method" },
  { IDS_PROP_HOST_OS      ,L"Host OS" },
  { IDS_PROP_FILE_SYSTEM  ,L"File System" },
  { IDS_PROP_USER         ,L"User" },
  { IDS_PROP_GROUP        ,L"Group" },
  { IDS_PROP_BLOCK        ,L"Block" },
  { IDS_PROP_COMMENT      ,L"Comment" },
  { IDS_PROP_POSITION     ,L"Position" },
  { IDS_PROP_PREFIX       ,L"Path Prefix" },
  { IDS_PROP_FOLDERS      ,L"Folders" },
  { IDS_PROP_FILES        ,L"Files" },
  { IDS_PROP_VERSION      ,L"Version" },
  { IDS_PROP_VOLUME       ,L"Volume" },
  { IDS_PROP_IS_VOLUME    ,L"Multivolume" },
  { IDS_PROP_OFFSET       ,L"Offset" },
  { IDS_PROP_LINKS        ,L"Links" },
  { IDS_PROP_NUM_BLOCKS   ,L"Blocks" },
  { IDS_PROP_NUM_VOLUMES  ,L"Volumes" },

  { IDS_PROP_BIT64        ,L"64-bit" },
  { IDS_PROP_BIG_ENDIAN   ,L"Big-endian" },
  { IDS_PROP_CPU          ,L"CPU" },
  { IDS_PROP_PHY_SIZE     ,L"Physical Size" },
  { IDS_PROP_HEADERS_SIZE ,L"Headers Size" },
  { IDS_PROP_CHECKSUM     ,L"Checksum" },
  { IDS_PROP_CHARACTS     ,L"Characteristics" },
  { IDS_PROP_VA           ,L"Virtual Address" },
  { IDS_PROP_ID           ,L"ID" },
  { IDS_PROP_SHORT_NAME   ,L"Short Name" },
  { IDS_PROP_CREATOR_APP  ,L"Creator Application" },
  { IDS_PROP_SECTOR_SIZE  ,L"Sector Size" },
  { IDS_PROP_POSIX_ATTRIB ,L"Mode" },
  { IDS_PROP_SYM_LINK     ,L"Symbolic Link" },
  { IDS_PROP_ERROR        ,L"Error" },
  { IDS_PROP_TOTAL_SIZE   ,L"Total Size" },
  { IDS_PROP_FREE_SPACE   ,L"Free Space" },
  { IDS_PROP_CLUSTER_SIZE ,L"Cluster Size" },
  { IDS_PROP_VOLUME_NAME  ,L"Label" },
  { IDS_PROP_LOCAL_NAME   ,L"Local Name" },
  { IDS_PROP_PROVIDER     ,L"Provider" },
  { IDS_PROP_NT_SECURITY  ,L"NT Security" },
  { IDS_PROP_ALT_STREAM   ,L"Alternate Stream" },
  { IDS_PROP_AUX          ,L"Aux" },
  { IDS_PROP_DELETED      ,L"Deleted" },
  { IDS_PROP_IS_TREE      ,L"Is Tree" },
  { IDS_PROP_SHA1         ,L"SHA-1" },
  { IDS_PROP_SHA256       ,L"SHA-256" },
  { IDS_PROP_ERROR_TYPE   ,L"Error Type" },
  { IDS_PROP_NUM_ERRORS   ,L"Errors" },
  { IDS_PROP_ERROR_FLAGS  ,L"Errors" },
  { IDS_PROP_WARNING_FLAGS ,L"Warnings" },
  { IDS_PROP_WARNING      ,L"Warning" },
  { IDS_PROP_NUM_STREAMS  ,L"Streams" },
  { IDS_PROP_NUM_ALT_STREAMS ,L"Alternate Streams" },
  { IDS_PROP_ALT_STREAMS_SIZE ,L"Alternate Streams Size" },
  { IDS_PROP_VIRTUAL_SIZE ,L"Virtual Size" },
  { IDS_PROP_UNPACK_SIZE  ,L"Unpack Size" },
  { IDS_PROP_TOTAL_PHY_SIZE ,L"Total Physical Size" },
  { IDS_PROP_VOLUME_INDEX ,L"Volume Index" },
  { IDS_PROP_SUBTYPE      ,L"SubType" },
  { IDS_PROP_SHORT_COMMENT ,L"Short Comment" },
  { IDS_PROP_CODE_PAGE    ,L"Code Page" },
  { IDS_PROP_IS_NOT_ARC_TYPE  ,L"Is not archive type" },
  { IDS_PROP_PHY_SIZE_CANT_BE_DETECTED ,L"Physical Size can't be detected" },
  { IDS_PROP_ZEROS_TAIL_IS_ALLOWED ,L"Zeros Tail Is Allowed" },
  { IDS_PROP_TAIL_SIZE ,L"Tail Size" },
  { IDS_PROP_EMB_STUB_SIZE ,L"Embedded Stub Size" },
  { IDS_PROP_NT_REPARSE   ,L"Link" },
  { IDS_PROP_HARD_LINK    ,L"Hard Link" },
  { IDS_PROP_INODE        ,L"iNode" },
  { IDS_PROP_STREAM_ID    ,L"Stream ID" },
 
	{ 0 , 0 }
};

REGISTER_STRINGTABLE(g_stringTable)

/////////////////////////////////////////////////////

#include "res/ParentFolder.h"

	SevenZipPanel::SevenZipPanel(MyFrame *frame, wxWindow *parent,int id,int panelIndex) :
	       	wxPanel(parent,id) , m_frame(frame), _wList(0)
	{
		_panelIndex = panelIndex;

		int _baseID = id; // FIXME
		int _listID = _baseID + 1;
		int _comboBoxID = _baseID + 3;
		int _statusBarID = _comboBoxID + 1;
		int kParentFolderID = 100; // FIXME Panel.h


		///Sizer for adding the controls created by users
		wxBoxSizer* pMainSizer = new wxBoxSizer(wxVERTICAL);
		int sizes[] = {150, 250, 350, -1};
		wxArrayString pathArray;
		wxBoxSizer *pPathSizer = new wxBoxSizer(wxHORIZONTAL);
		m_pBmpButtonParentFolder = new wxBitmapButton(this, kParentFolderID, wxGetBitmapFromMemory(PARENT_FOLDER), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW);
		m_pComboBoxPath = new wxComboBox(this, _comboBoxID, wxEmptyString, wxDefaultPosition, wxSize(300,-1), pathArray, wxCB_DROPDOWN | wxCB_SORT );
		pPathSizer->Add(m_pBmpButtonParentFolder, 0, wxALL|wxEXPAND, 0);
		pPathSizer->Add(m_pComboBoxPath, 1, wxALL|wxEXPAND, 5);

		m_pListCtrlExplorer = new CExplorerListCtrl(this,_listID,wxDefaultPosition, wxSize(300,300),
			wxLC_REPORT | // wxLC_EDIT_LABELS |   FIXME
			wxSUNKEN_BORDER);

		printf("DEBUG : new CExplorerListCtrl(id=%d) => %p\n",_listID,m_pListCtrlExplorer);

		m_pStatusBar = new wxStatusBar(this, _statusBarID);
		m_pStatusBar->SetFieldsCount(4, sizes);
		pMainSizer->Add(pPathSizer, 0, wxALL|wxEXPAND, 0);
		pMainSizer->Add(m_pListCtrlExplorer, 1, wxALL|wxEXPAND, 0);
		pMainSizer->Add(m_pStatusBar, 0, wxALL|wxEXPAND, 0);
		SetSizer(pMainSizer);
		SetAutoLayout (true);
		SetMinSize(wxSize(800,400));
		Layout();

		
		// m_pListCtrlExplorer->SetDropTarget(new DnDFile(this));

	}

	void SevenZipPanel::OnAnyButton( wxCommandEvent &event )
	{
		count++;

		int id = event.GetId();

		wxString msg = wxString::Format(_T("P %d : button %d \n"), count,id);

		WriteText(msg);

		_wList->OnMessage(WM_COMMAND , id , 0);
	}

	void SevenZipPanel::OnSelected(wxListEvent& event)
	{
		const wxListItem & item = event.GetItem();
		count++;

		wxString msg = wxString::Format(_T("P %d : OnSelected %d \n"), count,event.GetId());

		WriteText(msg);

		NMLISTVIEW info;
		info.hdr.hwndFrom = m_pListCtrlExplorer;
		info.hdr.code     = LVN_ITEMCHANGED;
		info.uOldState    = 0;
		info.uNewState    = LVIS_SELECTED;
		info.lParam       = item.GetData(); // event.GetIndex(); // FIXME ? event.GetData();
		_wList->OnMessage(WM_NOTIFY , event.GetId() , (LPARAM)&info);
		/*
		if ( GetWindowStyle() & wxLC_REPORT )
		{
		wxListItem info;
		info.m_itemId = event.m_itemIndex;
		info.m_col = 1;
		info.m_mask = wxLIST_MASK_TEXT;
		if ( GetItem(info) )
		{
		wxLogMessage(wxT("Value of the 2nd field of the selected item: %s"),
		info.m_text.c_str());
		}
		else
		{
		wxFAIL_MSG(wxT("wxListCtrl::GetItem() failed"));
		}
		}
		*/
	}

	

	void SevenZipPanel::OnDeselected(wxListEvent& event)
	{
		const wxListItem & item = event.GetItem();
		count++;
		wxString msg = wxString::Format(_T("P %d : OnDeselected %d \n"), count,event.GetId());
		WriteText(msg);

		NMLISTVIEW info;
		info.hdr.hwndFrom = m_pListCtrlExplorer;
		info.hdr.code     = LVN_ITEMCHANGED;
		info.uOldState    = LVIS_SELECTED;
		info.uNewState    = 0;
		info.lParam       = item.GetData(); // event.GetIndex(); // FIXME ? event.GetData();
		_wList->OnMessage(WM_NOTIFY , event.GetId() , (LPARAM)&info);
	}

	void SevenZipPanel::OnColumnClick(wxListEvent& event)
	{
		count++;
		wxString msg = wxString::Format(_T("P %d : OnColumnClick %d col=%d\n"), count,event.GetId(),event.GetColumn());
		WriteText(msg);

		NMLISTVIEW info;
		info.hdr.hwndFrom = m_pListCtrlExplorer;
		info.hdr.code     = LVN_COLUMNCLICK;
		info.iSubItem     = event.GetColumn();
		_wList->OnMessage(WM_NOTIFY , event.GetId() , (LPARAM)&info);

	}


	void SevenZipPanel::OnActivated(wxListEvent& event)
	{
		count++;

		int ind = event.GetIndex();

		NMHDR info;
		info.hwndFrom = m_pListCtrlExplorer;
		info.code     = NM_DBLCLK;
		_wList->OnMessage(WM_NOTIFY , event.GetId() , (LPARAM)&info);

		/*
		if ((ind >= 0) && ( ind < m_nbDirs))
		{
			wxString msg = wxString::Format(_T("P %d : OnActivated %d : DIR = %d\n"), count,event.GetId(),ind);
			WriteText(msg);

			wxString name = m_pListCtrlExplorer->GetItemText(ind);

			wxFileName filename (m_currentDirectory,name);
			BinPath(filename.GetFullPath());

		}
		else
		*/
		{
			wxString msg = wxString::Format(_T("P %d : OnActivated %d : FILE = %d\n"), count,event.GetId(),ind);
			WriteText(msg);
		}
	}

	void SevenZipPanel::OnFocused(wxListEvent& event)
	{
		count++;

		wxString msg = wxString::Format(_T("P %d : OnFocused %d \n"), count,event.GetId());

		WriteText(msg);

		event.Skip();
	}

	void SevenZipPanel::OnLeftDownBeginDrag(wxListEvent& event)
	{
		count++;

		wxString msg = wxString::Format(_T("P %d : OnLeftDownBeginDrag %d \n"), count,event.GetId());
		WriteText(msg);

#if 0		
		if (   m_pListCtrlExplorer->GetSelectedItemCount() < 1) return ;

        // start drag operation
        wxFileDataObject filesData;


	long item = -1;
    for ( ;; )
    {
        item = m_pListCtrlExplorer->GetNextItem(item,
                                     wxLIST_NEXT_ALL,
                                     wxLIST_STATE_SELECTED);
        if ( item == -1 )
            break;

        // this item is selected - do whatever is needed with it
        // wxLogMessage("Item %ld is selected.", item);
		wxString file = m_currentDirectory + _T("/") + m_pListCtrlExplorer->GetItemText(item);

		filesData.AddFile(file);

    }

		msg = wxString::Format(_T("P %d : wxDropSource %d \n"), count,event.GetId());
		WriteText(msg);

        wxDropSource source(filesData, this,
                            wxDROP_ICON(dnd_copy),
                            wxDROP_ICON(dnd_move),
                            wxDROP_ICON(dnd_none));

        int flags = 0;
		/*
        if ( m_moveByDefault )
            flags |= wxDrag_DefaultMove;
        else if ( m_moveAllow )
            flags |= wxDrag_AllowMove;
			*/
		flags |= wxDrag_AllowMove;

		msg = wxString::Format(_T("P %d : DoDragDrop %d \n"), count,event.GetId());
		WriteText(msg);


        wxDragResult result = source.DoDragDrop(flags);


        const wxChar *pc;
        switch ( result )
        {
            case wxDragError:   pc = _T("Error!");    break;
            case wxDragNone:    pc = _T("Nothing");   break;
            case wxDragCopy:    pc = _T("Copied");    break;
            case wxDragMove:    pc = _T("Moved");     break;
            case wxDragCancel:  pc = _T("Cancelled"); break;
            default:            pc = _T("Huh?");      break;
        }

        WriteText(wxString(_T("    Drag result: ")) + pc);
#endif
	}

void SevenZipPanel::OnLeftDown(wxMouseEvent &WXUNUSED(event) )
{
	WriteText(_T("OnLeftDown"));
#if 0
    if ( !m_strText.empty() )
    {
        // start drag operation
        wxTextDataObject textData(m_strText);
        wxDropSource source(textData, this,
                            wxDROP_ICON(dnd_copy),
                            wxDROP_ICON(dnd_move),
                            wxDROP_ICON(dnd_none));

        int flags = 0;
        if ( m_moveByDefault )
            flags |= wxDrag_DefaultMove;
        else if ( m_moveAllow )
            flags |= wxDrag_AllowMove;

        wxDragResult result = source.DoDragDrop(flags);

#if wxUSE_STATUSBAR
        const wxChar *pc;
        switch ( result )
        {
            case wxDragError:   pc = _T("Error!");    break;
            case wxDragNone:    pc = _T("Nothing");   break;
            case wxDragCopy:    pc = _T("Copied");    break;
            case wxDragMove:    pc = _T("Moved");     break;
            case wxDragCancel:  pc = _T("Cancelled"); break;
            default:            pc = _T("Huh?");      break;
        }

        SetStatusText(wxString(_T("Drag result: ")) + pc);
#else
        wxUnusedVar(result);
#endif // wxUSE_STATUSBAR
    }
#endif // wxUSE_DRAG_AND_DROP
}

void SevenZipPanel::OnRightClick(wxListEvent& event)
{
	wxPoint point = event.GetPoint(); 

	WriteText(_T("OnRightClick"));
    wxMenu menu; // (_T("Dnd sample menu"));

    menu.Append(wxID_ANY, _T("&Test drag..."));
    menu.AppendSeparator();
    menu.Append(wxID_ANY, _T("item1"));
    menu.Append(wxID_ANY, _T("item2"));
    menu.Append(wxID_ANY, _T("item3"));
    menu.Append(wxID_ANY, _T("&About"));

    PopupMenu( &menu, point.x, point.y );
}

void SevenZipPanel::OnTextEnter(wxCommandEvent& event)
{	
	count++;

	NMCBEENDEDITW info;
	info.hdr.hwndFrom = m_pComboBoxPath;
	info.hdr.code     = CBEN_ENDEDITW;
	info.iWhy         = CBENF_RETURN;
	
	_wList->OnMessage(WM_NOTIFY , event.GetId() , (LPARAM)&info);
	
	{
		wxString msg = wxString::Format(_T("P %d : OnTextEnter %d\n"), count,event.GetId());
		WriteText(msg);
	}
}

int SevenZipPanel::count = 0;

BEGIN_EVENT_TABLE(SevenZipPanel, wxPanel)
// EVT_MENU(wxID_ANY, SevenZipPanel::OnAnyMenu)
// EVT_LISTBOX   (wxID_ANY,       MyPanel::OnListBox)
// EVT_LISTBOX_DCLICK(wxID_ANY,          MyPanel::OnAnyListBoxDoubleClick)
EVT_BUTTON    (wxID_ANY,      SevenZipPanel::OnAnyButton)

 // EVT_CLOSE(SevenZipPanel::OnCloseWindow)

/////////////////
EVT_LIST_ITEM_SELECTED(wxID_ANY,   SevenZipPanel::OnSelected)
EVT_LIST_ITEM_DESELECTED(wxID_ANY, SevenZipPanel::OnDeselected)
EVT_LIST_ITEM_ACTIVATED(wxID_ANY,  SevenZipPanel::OnActivated)
EVT_LIST_ITEM_FOCUSED(wxID_ANY,  SevenZipPanel::OnFocused)

EVT_LIST_BEGIN_DRAG(wxID_ANY, SevenZipPanel::OnLeftDownBeginDrag)
// FIXME - add for menu on item - EVT_LIST_ITEM_RIGHT_CLICK(wxID_ANY, SevenZipPanel::OnRightClick)

EVT_LIST_COL_CLICK(wxID_ANY, SevenZipPanel::OnColumnClick)


EVT_TEXT_ENTER(wxID_ANY, SevenZipPanel::OnTextEnter)  // FIXME - not called


END_EVENT_TABLE()



void appClose(void)
{
	g_window->Close(true);
}