| |
675 |
675 |
break; |
| |
676 |
676 |
} |
| |
677 |
677 |
case WM_SHOWMINIVIEW: |
| |
678 |
678 |
{ |
| |
679 |
679 |
OnShowMiniView(); |
| |
680 |
680 |
return static_cast<LRESULT>(0); |
| |
681 |
681 |
|
| |
682 |
682 |
} |
| |
683 |
683 |
|
| |
684 |
684 |
case WM_CONFIGNOTIFY: |
| |
685 |
685 |
{ |
| |
686 |
686 |
GetApp().SetAutorun(GetPropValue<PP_PRELOADAFTERRESTART>(GetConfig())); |
| |
687 |
687 |
|
| |
688 |
688 |
|
| |
689 |
689 |
HANDLE hProcess=GetCurrentProcess(); |
| |
690 |
690 |
::SetPriorityClass(hProcess, (DWORD)GetPropValue<PP_PPROCESSPRIORITYCLASS>(GetConfig())); |
| |
691 |
691 |
|
| |
692 |
692 |
break; |
| |
693 |
693 |
} |
| |
694 |
694 |
|
| |
695 |
|
case WM_GETCONFIG: |
| |
696 |
|
{ |
| |
697 |
|
try |
| |
698 |
|
{ |
| |
699 |
|
chcore::TConfig& rConfig = GetConfig(); |
| |
700 |
|
|
| |
701 |
|
TShellExtMenuConfig cfgShellExt; |
| |
702 |
|
|
| |
703 |
|
|
| |
704 |
|
cfgShellExt.SetShowShortcutIcons(GetPropValue<PP_SHSHOWSHELLICONS>(rConfig)); |
| |
705 |
|
|
| |
706 |
|
cfgShellExt.SetInterceptDragAndDrop(GetPropValue<PP_SHINTERCEPTDRAGDROP>(rConfig)); |
| |
707 |
|
cfgShellExt.SetInterceptKeyboardActions(GetPropValue<PP_SHINTERCEPTKEYACTIONS>(rConfig)); |
| |
708 |
|
cfgShellExt.SetInterceptCtxMenuActions(GetPropValue<PP_SHINTERCEPTCTXMENUACTIONS>(rConfig)); |
| |
709 |
|
|
| |
710 |
|
cfgShellExt.GetFormatter()->SetValues( |
| |
711 |
|
GetResManager().LoadString(IDS_BYTE_STRING), |
| |
712 |
|
GetResManager().LoadString(IDS_KBYTE_STRING), |
| |
713 |
|
GetResManager().LoadString(IDS_MBYTE_STRING), |
| |
714 |
|
GetResManager().LoadString(IDS_GBYTE_STRING), |
| |
715 |
|
GetResManager().LoadString(IDS_TBYTE_STRING) |
| |
716 |
|
); |
| |
717 |
|
|
| |
718 |
|
cfgShellExt.SetShowFreeSpace(GetPropValue<PP_SHSHOWFREESPACE>(rConfig)); |
| |
719 |
|
|
| |
720 |
|
PrepareDragAndDropMenuItems(cfgShellExt); |
| |
721 |
|
PrepareNormalMenuItems(cfgShellExt); |
| |
722 |
|
|
| |
723 |
|
chcore::TConfig cfgStorage; |
| |
724 |
|
chcore::TString wstrData; |
| |
725 |
|
|
| |
726 |
|
cfgShellExt.StoreInConfig(cfgStorage, _T("ShellExtCfg")); |
| |
727 |
|
cfgStorage.WriteToString(wstrData); |
| |
728 |
|
|
| |
729 |
|
std::wstring strSHMName = IPCSupport::GenerateSHMName((unsigned long)lParam); |
| |
730 |
|
|
| |
731 |
|
m_tCHExtharedMemory.Create(strSHMName.c_str(), wstrData); |
| |
732 |
|
} |
| |
733 |
|
catch(const std::exception& e) |
| |
734 |
|
{ |
| |
735 |
|
_ASSERTE(FALSE); |
| |
736 |
|
CString strMsg; |
| |
737 |
|
strMsg.Format(L"Encountered problem trying to retrieve shell ext configuration.\nReason: %S", e.what()); |
| |
738 |
|
LOG_ERROR(m_spLog) << strMsg; |
| |
739 |
|
|
| |
740 |
|
return FALSE; |
| |
741 |
|
} |
| |
742 |
|
|
| |
743 |
|
return TRUE; |
| |
744 |
|
} |
| |
745 |
|
|
| |
746 |
695 |
case WM_IDENTIFY: |
| |
747 |
696 |
{ |
| |
748 |
697 |
|
| |
749 |
698 |
unsigned char *dec=new unsigned char[iCount+1]; |
| |
750 |
699 |
dec[iCount]=0; |
| |
751 |
700 |
|
| |
752 |
701 |
for (int i=0, j=0;i<iCount;i++) |
| |
753 |
702 |
{ |
| |
754 |
703 |
unsigned short sData=static_cast<unsigned short>(msg[i] - _hash[j]); |
| |
755 |
704 |
|
| |
756 |
705 |
sData >>= off[j]; |
| |
757 |
706 |
dec[i]=static_cast<unsigned char>(sData); |
| |
758 |
707 |
|
| |
759 |
708 |
if (++j >= iOffCount) |
| |
760 |
709 |
j=0; |
| |
761 |
710 |
} |
| |
762 |
711 |
|
| |
763 |
712 |
CA2T ca2t(reinterpret_cast<char*>(dec)); |
| |
764 |
713 |
AfxMessageBox(ca2t); |
| |
765 |
714 |
delete [] dec; |
|
| |
777 |
726 |
{ |
| |
778 |
727 |
PrepareToExit(); |
| |
779 |
728 |
break; |
| |
780 |
729 |
} |
| |
781 |
730 |
case WM_TRAYNOTIFY: |
| |
782 |
731 |
{ |
| |
783 |
732 |
return OnTrayNotification(wParam, lParam); |
| |
784 |
733 |
} |
| |
785 |
734 |
} |
| |
786 |
735 |
|
| |
787 |
736 |
|
| |
788 |
737 |
if (message == m_uiTaskbarRestart) |
| |
789 |
738 |
{ |
| |
790 |
739 |
ShowTrayIcon(); |
| |
791 |
740 |
return (LRESULT)TRUE; |
| |
792 |
741 |
} |
| |
793 |
742 |
|
| |
794 |
743 |
return CWnd::WindowProc(message, wParam, lParam); |
| |
795 |
744 |
} |
| |
796 |
745 |
|
| |
797 |
|
void CMainWnd::PrepareDragAndDropMenuItems(TShellExtMenuConfig &cfgShellExt) const |
| |
798 |
|
{ |
| |
799 |
|
chcore::TConfig& rConfig = GetConfig(); |
| |
800 |
|
ictranslate::CResourceManager& rResManager = GetResManager(); |
| |
801 |
|
|
| |
802 |
|
TShellMenuItemPtr spDragAndDropRootItem = cfgShellExt.GetDragAndDropRoot(); |
| |
803 |
|
bool bAddedAnyOption = false; |
| |
804 |
|
if(GetPropValue<PP_SHSHOWCOPY>(rConfig)) |
| |
805 |
|
{ |
| |
806 |
|
spDragAndDropRootItem->AddChild(std::make_shared<TShellMenuItem>(rResManager.LoadString(IDS_MENUCOPY_STRING), rResManager.LoadString(IDS_MENUTIPCOPY_STRING), |
| |
807 |
|
TOperationTypeInfo(TOperationTypeInfo::eOpType_Specified, chcore::eOperation_Copy), |
| |
808 |
|
TSourcePathsInfo(TSourcePathsInfo::eSrcType_InitializeIDataObject), |
| |
809 |
|
TDestinationPathInfo(TDestinationPathInfo::eDstType_InitializePidlFolder, chcore::TSmartPath()), false, chcore::eOperation_Copy)); |
| |
810 |
|
bAddedAnyOption = true; |
| |
811 |
|
} |
| |
812 |
|
|
| |
813 |
|
if(GetPropValue<PP_SHSHOWMOVE>(rConfig)) |
| |
814 |
|
{ |
| |
815 |
|
spDragAndDropRootItem->AddChild(std::make_shared<TShellMenuItem>(rResManager.LoadString(IDS_MENUMOVE_STRING), rResManager.LoadString(IDS_MENUTIPMOVE_STRING), |
| |
816 |
|
TOperationTypeInfo(TOperationTypeInfo::eOpType_Specified, chcore::eOperation_Move), |
| |
817 |
|
TSourcePathsInfo(TSourcePathsInfo::eSrcType_InitializeIDataObject), |
| |
818 |
|
TDestinationPathInfo(TDestinationPathInfo::eDstType_InitializePidlFolder, chcore::TSmartPath()), false, chcore::eOperation_Move)); |
| |
819 |
|
bAddedAnyOption = true; |
| |
820 |
|
} |
| |
821 |
|
|
| |
822 |
|
if(GetPropValue<PP_SHSHOWCOPYMOVE>(rConfig)) |
| |
823 |
|
{ |
| |
824 |
|
spDragAndDropRootItem->AddChild(std::make_shared<TShellMenuItem>(rResManager.LoadString(IDS_MENUCOPYMOVESPECIAL_STRING), rResManager.LoadString(IDS_MENUTIPCOPYMOVESPECIAL_STRING), |
| |
825 |
|
TOperationTypeInfo(TOperationTypeInfo::eOpType_Autodetect, chcore::eOperation_Copy), |
| |
826 |
|
TSourcePathsInfo(TSourcePathsInfo::eSrcType_InitializeIDataObject), |
| |
827 |
|
TDestinationPathInfo(TDestinationPathInfo::eDstType_InitializePidlFolder, chcore::TSmartPath()), true)); |
| |
828 |
|
bAddedAnyOption = true; |
| |
829 |
|
} |
| |
830 |
|
|
| |
831 |
|
if(bAddedAnyOption) |
| |
832 |
|
{ |
| |
833 |
|
|
| |
834 |
|
spDragAndDropRootItem->AddChild(std::make_shared<TShellMenuItem>()); |
| |
835 |
|
} |
| |
836 |
|
} |
| |
837 |
|
|
| |
838 |
|
void CMainWnd::PrepareNormalMenuItems(TShellExtMenuConfig &cfgShellExt) const |
| |
839 |
|
{ |
| |
840 |
|
chcore::TConfig& rConfig = GetConfig(); |
| |
841 |
|
ictranslate::CResourceManager& rResManager = GetResManager(); |
| |
842 |
|
|
| |
843 |
|
TShellMenuItemPtr spNormalRootItem = cfgShellExt.GetNormalRoot(); |
| |
844 |
|
|
| |
845 |
|
if(GetPropValue<PP_SHSHOWPASTE>(rConfig)) |
| |
846 |
|
{ |
| |
847 |
|
spNormalRootItem->AddChild(std::make_shared<TShellMenuItem>(rResManager.LoadString(IDS_MENUPASTE_STRING), rResManager.LoadString(IDS_MENUTIPPASTE_STRING), |
| |
848 |
|
TOperationTypeInfo(TOperationTypeInfo::eOpType_Autodetect, chcore::eOperation_Copy), |
| |
849 |
|
TSourcePathsInfo(TSourcePathsInfo::eSrcType_Clipboard), |
| |
850 |
|
TDestinationPathInfo(TDestinationPathInfo::eDstType_InitializeAuto, chcore::TSmartPath()), false)); |
| |
851 |
|
} |
| |
852 |
|
|
| |
853 |
|
if(GetPropValue<PP_SHSHOWPASTESPECIAL>(rConfig)) |
| |
854 |
|
{ |
| |
855 |
|
spNormalRootItem->AddChild(std::make_shared<TShellMenuItem>(rResManager.LoadString(IDS_MENUPASTESPECIAL_STRING), rResManager.LoadString(IDS_MENUTIPPASTESPECIAL_STRING), |
| |
856 |
|
TOperationTypeInfo(TOperationTypeInfo::eOpType_Autodetect, chcore::eOperation_Copy), |
| |
857 |
|
TSourcePathsInfo(TSourcePathsInfo::eSrcType_Clipboard), |
| |
858 |
|
TDestinationPathInfo(TDestinationPathInfo::eDstType_InitializeAuto, chcore::TSmartPath()), true)); |
| |
859 |
|
} |
| |
860 |
|
|
| |
861 |
|
if(GetPropValue<PP_SHSHOWCOPYTO>(rConfig) || GetPropValue<PP_SHSHOWMOVETO>(rConfig) || GetPropValue<PP_SHSHOWCOPYMOVETO>(rConfig)) |
| |
862 |
|
{ |
| |
863 |
|
|
| |
864 |
|
std::vector<CString> vShortcutStrings; |
| |
865 |
|
GetPropValue<PP_SHORTCUTS>(rConfig, vShortcutStrings); |
| |
866 |
|
|
| |
867 |
|
std::vector<CShortcut> vShortcuts; |
| |
868 |
|
|
| |
869 |
|
for(const CString& strShortcutString : vShortcutStrings) |
| |
870 |
|
{ |
| |
871 |
|
CShortcut tShortcut; |
| |
872 |
|
if(tShortcut.FromString(strShortcutString)) |
| |
873 |
|
vShortcuts.push_back(tShortcut); |
| |
874 |
|
else |
| |
875 |
|
BOOST_ASSERT(false); |
| |
876 |
|
} |
| |
877 |
|
|
| |
878 |
|
if(GetPropValue<PP_SHSHOWCOPYTO>(rConfig)) |
| |
879 |
|
{ |
| |
880 |
|
std::shared_ptr<TShellMenuItem> menuItem(std::make_shared<TShellMenuItem>(rResManager.LoadString(IDS_MENUCOPYTO_STRING), rResManager.LoadString(IDS_MENUTIPCOPYTO_STRING))); |
| |
881 |
|
for(const CShortcut& tShortcut : vShortcuts) |
| |
882 |
|
{ |
| |
883 |
|
menuItem->AddChild(std::make_shared<TShellMenuItem>((PCTSTR)tShortcut.m_strName, (PCTSTR)tShortcut.m_strPath, |
| |
884 |
|
TOperationTypeInfo(TOperationTypeInfo::eOpType_Specified, chcore::eOperation_Copy), |
| |
885 |
|
TSourcePathsInfo(TSourcePathsInfo::eSrcType_InitializeAuto), |
| |
886 |
|
TDestinationPathInfo(TDestinationPathInfo::eDstType_Specified, chcore::PathFromString((PCTSTR)tShortcut.m_strPath)), false)); |
| |
887 |
|
} |
| |
888 |
|
|
| |
889 |
|
spNormalRootItem->AddChild(menuItem); |
| |
890 |
|
|
| |
891 |
|
|
| |
892 |
|
if(!vShortcuts.empty()) |
| |
893 |
|
menuItem->AddChild(std::make_shared<TShellMenuItem>()); |
| |
894 |
|
|
| |
895 |
|
|
| |
896 |
|
menuItem->AddChild(std::make_shared<TShellMenuItem>(rResManager.LoadString(IDS_SHELLEXT_CHOOSE_DIR_STRING), rResManager.LoadString(IDS_SHELLEXT_CHOOSE_DIR_TOOLTIP_STRING), |
| |
897 |
|
TOperationTypeInfo(TOperationTypeInfo::eOpType_Specified, chcore::eOperation_Copy), |
| |
898 |
|
TSourcePathsInfo(TSourcePathsInfo::eSrcType_InitializeAuto), |
| |
899 |
|
TDestinationPathInfo(TDestinationPathInfo::eDstType_Choose, chcore::TSmartPath()), false)); |
| |
900 |
|
} |
| |
901 |
|
|
| |
902 |
|
if(GetPropValue<PP_SHSHOWMOVETO>(rConfig)) |
| |
903 |
|
{ |
| |
904 |
|
std::shared_ptr<TShellMenuItem> menuItem(std::make_shared<TShellMenuItem>(rResManager.LoadString(IDS_MENUMOVETO_STRING), rResManager.LoadString(IDS_MENUTIPMOVETO_STRING))); |
| |
905 |
|
for(const CShortcut& tShortcut : vShortcuts) |
| |
906 |
|
{ |
| |
907 |
|
menuItem->AddChild(std::make_shared<TShellMenuItem>((PCTSTR)tShortcut.m_strName, (PCTSTR)tShortcut.m_strPath, |
| |
908 |
|
TOperationTypeInfo(TOperationTypeInfo::eOpType_Specified, chcore::eOperation_Move), |
| |
909 |
|
TSourcePathsInfo(TSourcePathsInfo::eSrcType_InitializeAuto), |
| |
910 |
|
TDestinationPathInfo(TDestinationPathInfo::eDstType_Specified, chcore::PathFromString((PCTSTR)tShortcut.m_strPath)), false)); |
| |
911 |
|
} |
| |
912 |
|
|
| |
913 |
|
spNormalRootItem->AddChild(menuItem); |
| |
914 |
|
|
| |
915 |
|
|
| |
916 |
|
if(!vShortcuts.empty()) |
| |
917 |
|
menuItem->AddChild(std::make_shared<TShellMenuItem>()); |
| |
918 |
|
|
| |
919 |
|
|
| |
920 |
|
menuItem->AddChild(std::make_shared<TShellMenuItem>(rResManager.LoadString(IDS_SHELLEXT_CHOOSE_DIR_STRING), rResManager.LoadString(IDS_SHELLEXT_CHOOSE_DIR_TOOLTIP_STRING), |
| |
921 |
|
TOperationTypeInfo(TOperationTypeInfo::eOpType_Specified, chcore::eOperation_Move), |
| |
922 |
|
TSourcePathsInfo(TSourcePathsInfo::eSrcType_InitializeAuto), |
| |
923 |
|
TDestinationPathInfo(TDestinationPathInfo::eDstType_Choose, chcore::TSmartPath()), false)); |
| |
924 |
|
} |
| |
925 |
|
|
| |
926 |
|
if(GetPropValue<PP_SHSHOWCOPYMOVETO>(rConfig)) |
| |
927 |
|
{ |
| |
928 |
|
std::shared_ptr<TShellMenuItem> menuItem(std::make_shared<TShellMenuItem>(rResManager.LoadString(IDS_MENUCOPYMOVETOSPECIAL_STRING), rResManager.LoadString(IDS_MENUTIPCOPYMOVETOSPECIAL_STRING))); |
| |
929 |
|
for(const CShortcut& tShortcut : vShortcuts) |
| |
930 |
|
{ |
| |
931 |
|
menuItem->AddChild(std::make_shared<TShellMenuItem>((PCTSTR)tShortcut.m_strName, (PCTSTR)tShortcut.m_strPath, |
| |
932 |
|
TOperationTypeInfo(TOperationTypeInfo::eOpType_Specified, chcore::eOperation_Copy), |
| |
933 |
|
TSourcePathsInfo(TSourcePathsInfo::eSrcType_InitializeAuto), |
| |
934 |
|
TDestinationPathInfo(TDestinationPathInfo::eDstType_Specified, chcore::PathFromString((PCTSTR)tShortcut.m_strPath)), true)); |
| |
935 |
|
} |
| |
936 |
|
|
| |
937 |
|
spNormalRootItem->AddChild(menuItem); |
| |
938 |
|
|
| |
939 |
|
|
| |
940 |
|
if(!vShortcuts.empty()) |
| |
941 |
|
menuItem->AddChild(std::make_shared<TShellMenuItem>()); |
| |
942 |
|
|
| |
943 |
|
|
| |
944 |
|
menuItem->AddChild(std::make_shared<TShellMenuItem>(rResManager.LoadString(IDS_SHELLEXT_CHOOSE_DIR_STRING), rResManager.LoadString(IDS_SHELLEXT_CHOOSE_DIR_TOOLTIP_STRING), |
| |
945 |
|
TOperationTypeInfo(TOperationTypeInfo::eOpType_Specified, chcore::eOperation_Copy), |
| |
946 |
|
TSourcePathsInfo(TSourcePathsInfo::eSrcType_InitializeAuto), |
| |
947 |
|
TDestinationPathInfo(TDestinationPathInfo::eDstType_Choose, chcore::TSmartPath()), true)); |
| |
948 |
|
} |
| |
949 |
|
} |
| |
950 |
|
} |
| |
951 |
746 |
void CMainWnd::OnAppAbout() |
| |
952 |
747 |
{ |
| |
953 |
748 |
CAboutDlg *pdlg=new CAboutDlg; |
| |
954 |
749 |
pdlg->m_bAutoDelete=true; |
| |
955 |
750 |
pdlg->m_bLockInstance=true; |
| |
956 |
751 |
pdlg->Create(); |
| |
957 |
752 |
} |
| |
958 |
753 |
|
| |
959 |
754 |
void CMainWnd::OnPopupMonitoring() |
| |
960 |
755 |
{ |
| |
961 |
756 |
|
| |
962 |
757 |
SetPropValue<PP_PCLIPBOARDMONITORING>(GetConfig(), !GetPropValue<PP_PCLIPBOARDMONITORING>(GetConfig())); |
| |
963 |
758 |
GetConfig().Write(); |
| |
964 |
759 |
} |
| |
965 |
760 |
|
| |
966 |
761 |
void CMainWnd::OnPopupShutafterfinished() |
| |
967 |
762 |
{ |
| |
968 |
763 |
SetPropValue<PP_PSHUTDOWNAFTREFINISHED>(GetConfig(), !GetPropValue<PP_PSHUTDOWNAFTREFINISHED>(GetConfig())); |
| |
969 |
764 |
GetConfig().Write(); |
| |
970 |
765 |
} |