diff options
Diffstat (limited to 'src/libs/7zip/unix/CPP/Windows')
26 files changed, 2 insertions, 2667 deletions
diff --git a/src/libs/7zip/unix/CPP/Windows/COM.cpp b/src/libs/7zip/unix/CPP/Windows/COM.cpp deleted file mode 100644 index a746de12b..000000000 --- a/src/libs/7zip/unix/CPP/Windows/COM.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// Windows/COM.cpp - -#include "StdAfx.h" - -#include "Windows/COM.h" -#include "Common/StringConvert.h" - -namespace NWindows { -namespace NCOM { - -// CoInitialize (NULL); must be called! - -UString GUIDToStringW(REFGUID guid) -{ - UString string; - const int kStringSize = 48; - StringFromGUID2(guid, string.GetBuffer(kStringSize), kStringSize); - string.ReleaseBuffer(); - return string; -} - -AString GUIDToStringA(REFGUID guid) -{ - return UnicodeStringToMultiByte(GUIDToStringW(guid)); -} - -HRESULT StringToGUIDW(const wchar_t *string, GUID &classID) -{ - return CLSIDFromString((wchar_t *)string, &classID); -} - -HRESULT StringToGUIDA(const char *string, GUID &classID) -{ - return StringToGUIDW(MultiByteToUnicodeString(string), classID); -} - -}} diff --git a/src/libs/7zip/unix/CPP/Windows/COM.h b/src/libs/7zip/unix/CPP/Windows/COM.h deleted file mode 100644 index 506bbbc64..000000000 --- a/src/libs/7zip/unix/CPP/Windows/COM.h +++ /dev/null @@ -1,69 +0,0 @@ -// Windows/COM.h - -#ifndef __WINDOWS_COM_H -#define __WINDOWS_COM_H - -#include "Common/MyString.h" - -namespace NWindows { -namespace NCOM { - -#ifdef _WIN32 - -class CComInitializer -{ -public: - CComInitializer() - { - #ifdef UNDER_CE - CoInitializeEx(NULL, COINIT_MULTITHREADED); - #else - // it's single thread. Do we need multithread? - CoInitialize(NULL); - #endif - }; - ~CComInitializer() { CoUninitialize(); }; -}; - -class CStgMedium -{ - STGMEDIUM _object; -public: - bool _mustBeReleased; - CStgMedium(): _mustBeReleased(false) {} - ~CStgMedium() { Free(); } - void Free() - { - if (_mustBeReleased) - ReleaseStgMedium(&_object); - _mustBeReleased = false; - } - const STGMEDIUM* operator->() const { return &_object;} - STGMEDIUM* operator->() { return &_object;} - STGMEDIUM* operator&() { return &_object; } -}; - -#endif - -////////////////////////////////// -// GUID <--> String Conversions -UString GUIDToStringW(REFGUID guid); -AString GUIDToStringA(REFGUID guid); -#ifdef UNICODE - #define GUIDToString GUIDToStringW -#else - #define GUIDToString GUIDToStringA -#endif - -HRESULT StringToGUIDW(const wchar_t *string, GUID &classID); -HRESULT StringToGUIDA(const char *string, GUID &classID); -#ifdef UNICODE - #define StringToGUID StringToGUIDW -#else - #define StringToGUID StringToGUIDA -#endif - - -}} - -#endif diff --git a/src/libs/7zip/unix/CPP/Windows/Clipboard.cpp b/src/libs/7zip/unix/CPP/Windows/Clipboard.cpp deleted file mode 100644 index bb081e153..000000000 --- a/src/libs/7zip/unix/CPP/Windows/Clipboard.cpp +++ /dev/null @@ -1,160 +0,0 @@ -// Windows/Clipboard.cpp - -#include "StdAfx.h" - - -#include "Windows/Clipboard.h" -#include "Windows/Defs.h" -#ifdef _WIN32 -#include "Windows/Memory.h" -#include "Windows/Shell.h" -#include "Windows/Memory.h" -#else -#include <wx/clipbrd.h> -#include <wx/dataobj.h> -#undef _WIN32 -#endif - -#include "Common/StringConvert.h" - -namespace NWindows { - -bool CClipboard::Open(HWND wndNewOwner) -{ -#ifdef _WIN32 - m_Open = BOOLToBool(::OpenClipboard(wndNewOwner)); -#else - m_Open = wxTheClipboard->Open(); -#endif - return m_Open; -} - -CClipboard::~CClipboard() -{ - Close(); -} - -bool CClipboard::Close() -{ - if (!m_Open) - return true; -#ifdef _WIN32 - m_Open = !BOOLToBool(CloseClipboard()); -#else - wxTheClipboard->Close(); - m_Open = false; -#endif - return !m_Open; -} - -#ifdef _WIN32 -bool ClipboardIsFormatAvailableHDROP() -{ - return BOOLToBool(IsClipboardFormatAvailable(CF_HDROP)); -} -#endif - -/* -bool ClipboardGetTextString(AString &s) -{ - s.Empty(); - if (!IsClipboardFormatAvailable(CF_TEXT)) - return false; - CClipboard clipboard; - - if (!clipboard.Open(NULL)) - return false; - - HGLOBAL h = ::GetClipboardData(CF_TEXT); - if (h != NULL) - { - NMemory::CGlobalLock globalLock(h); - const char *p = (const char *)globalLock.GetPointer(); - if (p != NULL) - { - s = p; - return true; - } - } - return false; -} -*/ - -/* -bool ClipboardGetFileNames(UStringVector &names) -{ - names.Clear(); - if (!IsClipboardFormatAvailable(CF_HDROP)) - return false; - CClipboard clipboard; - - if (!clipboard.Open(NULL)) - return false; - - HGLOBAL h = ::GetClipboardData(CF_HDROP); - if (h != NULL) - { - NMemory::CGlobalLock globalLock(h); - void *p = (void *)globalLock.GetPointer(); - if (p != NULL) - { - NShell::CDrop drop(false); - drop.Attach((HDROP)p); - drop.QueryFileNames(names); - return true; - } - } - return false; -} -*/ - -#ifdef _WIN32 -static bool ClipboardSetData(UINT uFormat, const void *data, size_t size) -{ - NMemory::CGlobal global; - if (!global.Alloc(GMEM_DDESHARE | GMEM_MOVEABLE, size)) - return false; - { - NMemory::CGlobalLock globalLock(global); - LPVOID p = globalLock.GetPointer(); - if (p == NULL) - return false; - memcpy(p, data, size); - } - if (::SetClipboardData(uFormat, global) == NULL) - return false; - global.Detach(); - return true; -} -#endif - -bool ClipboardSetText(HWND owner, const UString &s) -{ - CClipboard clipboard; - if (!clipboard.Open(owner)) - return false; -#ifdef _WIN32 - if (!::EmptyClipboard()) - return false; - - bool res; - res = ClipboardSetData(CF_UNICODETEXT, (const wchar_t *)s, (s.Length() + 1) * sizeof(wchar_t)); - #ifndef _UNICODE - AString a; - a = UnicodeStringToMultiByte(s, CP_ACP); - res |= ClipboardSetData(CF_TEXT, (const char *)a, (a.Length() + 1) * sizeof(char)); - a = UnicodeStringToMultiByte(s, CP_OEMCP); - res |= ClipboardSetData(CF_OEMTEXT, (const char *)a, (a.Length() + 1) * sizeof(char)); - #endif - return res; -#else - wxTheClipboard->Clear(); - // This data objects are held by the clipboard, - // so do not delete them in the app. - wxString ws(s); - wxTheClipboard->SetData( new wxTextDataObject(ws) ); - return true; -#endif -} - -} diff --git a/src/libs/7zip/unix/CPP/Windows/Clipboard.h b/src/libs/7zip/unix/CPP/Windows/Clipboard.h deleted file mode 100644 index c80ba5ea7..000000000 --- a/src/libs/7zip/unix/CPP/Windows/Clipboard.h +++ /dev/null @@ -1,28 +0,0 @@ -// Windows/Clipboard.h - -#ifndef __CLIPBOARD_H -#define __CLIPBOARD_H - -#include "Common/MyString.h" - -namespace NWindows { - -class CClipboard -{ - bool m_Open; -public: - CClipboard(): m_Open(false) {}; - ~CClipboard(); - bool Open(HWND wndNewOwner); - bool Close(); -}; - -bool ClipboardIsFormatAvailableHDROP(); - -// bool ClipboardGetFileNames(UStringVector &names); -// bool ClipboardGetTextString(AString &s); -bool ClipboardSetText(HWND owner, const UString &s); - -} - -#endif diff --git a/src/libs/7zip/unix/CPP/Windows/CommonDialog.h b/src/libs/7zip/unix/CPP/Windows/CommonDialog.h deleted file mode 100644 index f24bb5b24..000000000 --- a/src/libs/7zip/unix/CPP/Windows/CommonDialog.h +++ /dev/null @@ -1,19 +0,0 @@ -// Windows/CommonDialog.h - -#ifndef __WINDOWS_COMMON_DIALOG_H -#define __WINDOWS_COMMON_DIALOG_H - -#include "Common/MyString.h" - -namespace NWindows{ - -bool MyGetOpenFileName(HWND hwnd, LPCWSTR title, LPCWSTR fullFileName, - LPCWSTR s, UString &resPath - #ifdef UNDER_CE - , bool openFolder = false - #endif -); - -} - -#endif diff --git a/src/libs/7zip/unix/CPP/Windows/Control/ComboBox.h b/src/libs/7zip/unix/CPP/Windows/Control/ComboBox.h deleted file mode 100644 index 8717b4867..000000000 --- a/src/libs/7zip/unix/CPP/Windows/Control/ComboBox.h +++ /dev/null @@ -1,82 +0,0 @@ -// Windows/Control/ComboBox.h - -#ifndef __WINDOWS_WX_CONTROL_COMBOBOX_H -#define __WINDOWS_WX_CONTROL_COMBOBOX_H - -#include "Windows/Window.h" -#include "Windows/Defs.h" - - -#include "Windows/Control/Window2.h" // NMHDR - -#ifndef _WIN32 -#define CB_ERR (-1) // wxNOT_FOUND -#endif - -typedef struct -{ - NMHDR hdr; -#define CBENF_ESCAPE 1 -#define CBENF_RETURN 2 - int iWhy; -} NMCBEENDEDITW; - -typedef NMCBEENDEDITW * PNMCBEENDEDITW; - - -class wxComboBox; - -namespace NWindows { - namespace NControl { - - class CComboBox // : public CWindow - { - wxComboBox* _choice; - public: - CComboBox() : _choice(0) {} - - void Attach(wxWindow * newWindow); - wxWindow * Detach(); - operator HWND() const; - - int AddString(const TCHAR * txt); - - void SetText(LPCTSTR s); - - void GetText(CSysString &s); - - int GetCount() const ; - void GetLBText(int index, CSysString &s); - - void SetCurSel(int index); - int GetCurSel(); - - void SetItemData(int index, int val); - - int GetItemData(int index); - - void Enable(bool state); - - void ResetContent(); - }; - - class CComboBoxEx : public CComboBox // : public CWindow - { - public: - /* FIXME - LRESULT DeleteItem(int index) - { return SendMessage(CBEM_DELETEITEM, index, 0); } - LRESULT InsertItem(COMBOBOXEXITEM *item) - { return SendMessage(CBEM_INSERTITEM, 0, (LPARAM)item); } - DWORD SetExtendedStyle(DWORD exMask, DWORD exStyle) - { return (DWORD)SendMessage(CBEM_SETEXTENDEDSTYLE, exMask, exStyle); } - HWND GetEditControl() - { return (HWND)SendMessage(CBEM_GETEDITCONTROL, 0, 0); } - */ - }; - - - } -} - -#endif // __WINDOWS_WX_CONTROL_COMBOBOX_H diff --git a/src/libs/7zip/unix/CPP/Windows/Control/Controls.cpp b/src/libs/7zip/unix/CPP/Windows/Control/Controls.cpp deleted file mode 100644 index 2191d8009..000000000 --- a/src/libs/7zip/unix/CPP/Windows/Control/Controls.cpp +++ /dev/null @@ -1,515 +0,0 @@ -// Dialog.cpp - -#include "StdAfx.h" - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -// for all others, include the necessary headers (this file is usually all you -// need because it includes almost all "standard" wxWidgets headers) -#ifndef WX_PRECOMP - #include "wx/wx.h" - #include "wx/imaglist.h" - #include "wx/listctrl.h" -#endif - -#undef _WIN32 - -#include "Windows/Control/Dialog.h" - -void verify_main_thread(void); - -class LockGUI -{ - bool _IsMain; - public: - LockGUI() { - verify_main_thread(); - _IsMain = wxThread::IsMain(); - if (!_IsMain) { - // DEBUG - printf("GuiEnter-Controls(0x%lx)\n",wxThread::GetCurrentId()); - abort(); // FIXME wxMutexGuiEnter(); - } - } - ~LockGUI() { - if (!_IsMain) { - wxMutexGuiLeave(); - // DEBUG printf("GuiLeave(0x%lx)\n",wxThread::GetCurrentId()); - } - } -}; -///////////////////////// - -static const wxString CLASS_NAME_wxStaticText = wxT("wxStaticText"); -static const wxString CLASS_NAME_wxTextCtrl = wxT("wxTextCtrl"); - -namespace NWindows { - namespace NControl { - - void CDialogChildControl::SetText(LPCWSTR s) - { - LockGUI lock; - const wxChar * class_name = _window->GetClassInfo()->GetClassName (); - - if ( CLASS_NAME_wxStaticText == class_name) { - ((wxStaticText *)_window)->SetLabel(s); - } else if ( CLASS_NAME_wxTextCtrl == class_name) { - ((wxTextCtrl *)_window)->SetLabel(s); - } else { - // ((wxControl *)_window)->SetValue(s); // FIXME - printf("INTERNAL ERROR - CDialogChildControl::SetText(class=%ls) not implemented\n",class_name); - exit(-1); - } - } - - bool CDialogChildControl::GetText(CSysString &s) - { - wxString str; - { - LockGUI lock; - const wxChar * class_name = _window->GetClassInfo()->GetClassName (); - if ( CLASS_NAME_wxStaticText == class_name) { - str = ((wxStaticText *)_window)->GetLabel(); - } else if ( CLASS_NAME_wxTextCtrl == class_name) { - str = ((wxTextCtrl *)_window)->GetLabel(); - } else { - // FIXME str = ((wxTextCtrl *)_window)->GetValue(); - printf("INTERNAL ERROR - CDialogChildControl::GetText(class=%ls) not implemented\n",class_name); - exit(-1); - } - } - s = str; - return true; - } - } -} - -///////////////////////// Windows/Control/ComboBox.cpp -#include "Windows/Control/ComboBox.h" - -namespace NWindows { - namespace NControl { - - void CComboBox::Attach(wxWindow * newWindow) { _choice = (wxComboBox*)newWindow; } - - wxWindow * CComboBox::Detach() - { - wxWindow * window = _choice; - _choice = NULL; - return window; - } - - CComboBox::operator HWND() const { return (HWND)_choice; } - - - int CComboBox::AddString(const TCHAR * txt) { - LockGUI lock; - wxString item(txt); - return _choice->Append(item); - } - - void CComboBox::SetText(LPCTSTR s) { - LockGUI lock; - wxString str(s); - _choice->SetValue(str); - } - - void CComboBox::GetText(CSysString &s) { - LockGUI lock; - wxString str = _choice->GetValue(); - s = str; - } - - int CComboBox::GetCount() const { - LockGUI lock; - return _choice->GetCount(); - } - - void CComboBox::GetLBText(int index, CSysString &s) { - LockGUI lock; - wxString str = _choice->GetString(index); - s = str; - } - - void CComboBox::SetCurSel(int index) { - LockGUI lock; - _choice->SetSelection(index); - } - - int CComboBox::GetCurSel() { - LockGUI lock; - return _choice->GetSelection(); - } - - void CComboBox::SetItemData(int index, int val) { - LockGUI lock; - _choice->SetClientData( index, (void *)(((char *)0) + val)); - } - - int CComboBox::GetItemData(int index) - { - LockGUI lock; - void * data = _choice->GetClientData(index); - int ret = (int)(((char *)data) - ((char *)0)); - return ret; - } - - void CComboBox::Enable(bool state) { - LockGUI lock; - _choice->Enable(state); - } - - void CComboBox::ResetContent() { - LockGUI lock; - _choice->Clear(); - } - } -} - -///////////////////////// Windows/Control/Edit.cpp -#include "Windows/Control/Edit.h" - -namespace NWindows { - namespace NControl { - - void CEdit::SetPasswordChar(WPARAM c) // Warning : does not work for wxMSW - { - LockGUI lock; - long style = _window->GetWindowStyle(); - if ( c == 0 ) style &= ~(wxTE_PASSWORD); - else style |= wxTE_PASSWORD; - _window->SetWindowStyle(style); - _window->Refresh(); - } - - - void CEdit::Show(int cmdShow) - { - LockGUI lock; - // FIXME _window->Show(cmdShow != SW_HIDE); - _window->Enable(cmdShow != SW_HIDE); - } - - void CEdit::SetText(LPCWSTR s) - { - LockGUI lock; - ((wxTextCtrl *)_window)->SetValue(s); - } - - bool CEdit::GetText(CSysString &s) - { - wxString str; - { - LockGUI lock; - str = ((wxTextCtrl *)_window)->GetValue(); - } - s = str; - return true; - } - - } -} - -///////////////////////// Windows/Control/ProgressBar.cpp -#include "Windows/Control/ProgressBar.h" - -namespace NWindows { - namespace NControl { - - CProgressBar::CProgressBar(wxWindow* newWindow): - _window((wxGauge *)newWindow) , _minValue(0), _range(0) { } - - void CProgressBar::Attach(wxWindow* newWindow) { - _window = (wxGauge *)newWindow; - _minValue = 0; - _range = 0; - } - - void CProgressBar::SetRange32(int minValue, int maxValue) { - int range = maxValue - minValue; - if (range >= 1) - { - LockGUI lock; - _minValue = minValue; - _range = range; - _window->SetRange(_range); - } - } - - void CProgressBar::SetPos(int pos) { - if (_range >= 1) - { - LockGUI lock; - int value = pos - _minValue; - if ((value >= 0) && (value <= _range)) _window->SetValue(value); - } - } - - } -} - -///////////////////////// Windows/Control/StatusBar.cpp -#include "Windows/Control/StatusBar.h" - -namespace NWindows { - namespace NControl { - - void CStatusBar::Attach(wxWindow * newWindow) { _statusBar = (wxStatusBar*)newWindow; } - - wxWindow * CStatusBar::Detach() - { - wxWindow * window = _statusBar; - _statusBar = NULL; - return window; - } - - void CStatusBar::SetText(int index, LPCTSTR text) - { - _statusBar->SetStatusText(text,index); - } - - } - -} - -///////////////////////// Windows/Control/ListView.cpp -#include "Windows/Control/ListView.h" - -namespace NWindows { -namespace NControl { - - void CListView::Attach(wxWindow * newWindow) { - _list = (wxListCtrl *)newWindow; - } - - CListView::operator HWND() const { return (HWND)_list; } - - int CListView::GetItemCount() const {return _list->GetItemCount(); } - - int CListView::InsertItem(int index, LPCTSTR text) { - return _list->InsertItem(index, text); - } - int CListView::InsertItem(const LVITEM* item) { - /* - int col = item->iSubItem; - wxString text; - if (item->mask & LVIF_TEXT) text = item->pszText; - - // printf("%p->InsertItem(id=%d,%ls)\n",_list,item->iItem, (const wchar_t *)text); - return _list->InsertItem(item->iItem, text); - */ - wxListItem info; - long mask = 0; - info.SetId(item->iItem); - if (item->mask & LVIF_TEXT) - { - info.SetText(item->pszText); - mask |= wxLIST_MASK_TEXT; - } - if (item->mask & LVIF_PARAM) - { - info.SetData(item->lParam); - mask |= wxLIST_MASK_DATA; - } - if (item->mask & LVIF_STATE) - { - info.SetState(item->state); - mask |= wxLIST_MASK_STATE; - } - // FIXME if (item->mask & LVIF_IMAGE) - - info.SetMask(mask); - - return _list->InsertItem(info); - } - - void CListView::SetItem(const LVITEM* item) { - int col = item->iSubItem; - wxString text; - if (item->mask & LVIF_TEXT) text = item->pszText; - // printf("%p->SetItem(id=%d,col=%d,%ls)\n",_list,item->iItem, col,(const wchar_t *)text); - _list->SetItem(item->iItem, col, text); - } - - int CListView::SetSubItem(int index, int subIndex, LPCTSTR text) - { - return _list->SetItem(index, subIndex, text); - } - - void SetUnicodeFormat(bool fUnicode) { return ; } - - void CListView::InsertColumn(int columnIndex, LPCTSTR text, int width) - { - _list->InsertColumn(columnIndex, text, wxLIST_FORMAT_LEFT, width); - } - - void CListView::InsertColumn(int columnIndex, const LVCOLUMNW *columnInfo) - { - wxString text; - int format = wxLIST_FORMAT_LEFT; - int width = -1; - if (columnInfo->mask & LVCF_FMT) - { - if (columnInfo->fmt == LVCFMT_LEFT) format = wxLIST_FORMAT_LEFT; - if (columnInfo->fmt == LVCFMT_RIGHT) format = wxLIST_FORMAT_RIGHT; - } - if (columnInfo->mask & LVCF_TEXT) text = columnInfo->pszText; - if (columnInfo->mask & LVCF_WIDTH) width = columnInfo->cx; - // FIXME LVCF_SUBITEM - // printf("%p->InsertColumn(%d,%ls)\n",_list,columnIndex,(const wchar_t *)heading); - _list->InsertColumn(columnIndex, text, format, width); - } - - void CListView::DeleteAllItems() { - _list->DeleteAllItems(); - printf("%p->DeleteAllItems()\n",_list); - } - - void CListView::SetRedraw(bool b) { - if (b) _list->Thaw(); - else _list->Freeze(); - printf(" %p->SetRedraw()\n",_list); - } - - void CListView::SetItemCount(int count) { - // ONLY IF VIRTUAL REPORT -- _list->SetItemCount(count); - printf(" %p->SetItemCount(%d)\n",_list,count); - } - - void CListView::InvalidateRect(void *, bool) { - printf("FIXME %p->InvalidateRect()\n",_list);/* FIXME */ - } - - int CListView::GetSelectedCount() const { - int nb = _list->GetSelectedItemCount(); - printf(" %p->GetSelectedCount()=>%d\n",_list,nb); - return nb; - } - - void /* bool */ CListView::EnsureVisible(int index, bool partialOK) { - - printf(" %p->EnsureVisible(%d)\n",_list,index); - - if (index == -1) index = 0; - _list->EnsureVisible(index); - - // return true; - } - - void CListView::SetItemState(int index, UINT state, UINT mask) { - // don't work _list->SetItemState(index, state, mask); !? - // try SetItem ... - /* - wxListItem info; - - info.m_mask = wxLIST_MASK_STATE; - info.m_itemId = index; - info.m_col = 0; - info.m_state = state; - info.m_mask = mask; - - _list->SetItem(info); - */ - - printf(" %p->EnsureVisible(%d)\n",_list,index); - - if (index == -1) return; - - if (mask & LVIS_FOCUSED) { - _list->SetItemState(index, state & LVIS_FOCUSED, mask & LVIS_FOCUSED); - } - - if (mask & LVIS_SELECTED) { - _list->SetItemState(index, state & LVIS_SELECTED, mask & LVIS_SELECTED); - } - - } - - UINT CListView::GetItemState(int index, UINT mask) const - { - UINT state = _list->GetItemState(index, mask); - printf("FIXME %p->GetItemState(index=%d,mask=0x%x)=0x%x\n",_list,index,(unsigned)mask,(unsigned)state); /* FIXME */ - - return state; - } - - void /* bool */ CListView::Update() { - printf("FIXME %p->Update()\n",_list); /* FIXME */ - } - - bool CListView::DeleteColumn(int columnIndex) { - // printf("%p->DeleteColumn()\n",_list); - if (_list->GetColumnCount() < 1) return false; - return _list->DeleteColumn(columnIndex); // always return true !? - } - - bool CListView::GetItemParam(int itemIndex, LPARAM ¶m) const - { - param = _list->GetItemData(itemIndex); - - // printf(" %p->GetItemParam(%d) => %ld\n",_list,itemIndex,(long)param); - - return true; - } - - int CListView::GetNextItem(int startIndex, UINT flags) const - { - int item = _list->GetNextItem(startIndex, wxLIST_NEXT_ALL, flags); - printf(" %p->GetNextItem(%d) => %d\n",_list,startIndex,item); - return item; - - } - - int CListView::GetFocusedItem() const - { - int item = _list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED); - printf(" %p->GetFocusedItem() => %d\n",_list,item); - return item; - } - - void CListView::RedrawAllItems() - { - printf("FIXME %p->RedrawAllItems()\n",_list); - } - - // FIXME added - int CListView::GetColumnCount() - { - return _list->GetColumnCount(); - } - - void CListView::SetFocus() { /* FIXME */ } - - void CListView::RedrawItem(int item) { /* FIXME */ } - - bool CListView::SortItems(PFNLVCOMPARE compareFunction, LPARAM dataParam) { - printf(" %p->SortItems()\n",_list); - return _list->SortItems(compareFunction, dataParam); - } - - bool CListView::GetColumn(int columnIndex, LVCOLUMN* columnInfo) - { - columnInfo->cx = _list->GetColumnWidth(columnIndex);// FIXME - - bool ret = false; - - if (columnInfo->cx >= 1) ret = true; - - // printf("CListView::GetColumn(%d) cx=%d\n",columnIndex,(int)columnInfo->cx); - - return ret; - } - - // HWND EditLabel(int itemIndex) - void CListView::EditLabel(int itemIndex) - { - /* FIXME */ - } - -}} - diff --git a/src/libs/7zip/unix/CPP/Windows/Control/Dialog.cpp b/src/libs/7zip/unix/CPP/Windows/Control/Dialog.cpp deleted file mode 100644 index 464ae302c..000000000 --- a/src/libs/7zip/unix/CPP/Windows/Control/Dialog.cpp +++ /dev/null @@ -1,560 +0,0 @@ -// Dialog.cpp - -#include "StdAfx.h" - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -// for all others, include the necessary headers (this file is usually all you -// need because it includes almost all "standard" wxWidgets headers) -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif - -#include <wx/filename.h> - - -#undef _WIN32 - -#include "Windows/Control/DialogImpl.h" -#include "Windows/Synchronization.h" - - -// FIXME -class MyApp : public wxApp -{ -public: - virtual bool OnInit(); -}; - -DECLARE_APP(MyApp) - -// #include "../GUI/p7zip_32.xpm" -extern const char * p7zip_32_xpm[]; - -const TCHAR * nameWindowToUnix(const TCHAR * lpFileName) { - if ((lpFileName[0] == wxT('c')) && (lpFileName[1] == wxT(':'))) return lpFileName+2; - return lpFileName; -} - - -extern time_t g_T0; // FIXME - -#define DIALOG_ID_MESSAGEBOX 8100 -#define DIALOG_ID_DIR_DIALOG 8101 -#define DIALOG_ID_FILE_DIALOG 8102 -#define DIALOG_ID_POST_DIALOG 8190 -#define DIALOG_ID_END_DIALOG 8199 - -static struct -{ - bool busy; - - int id; - wxWindow *parentWindow; - - // CreateDialog - NWindows::NControl::CModalDialog * dialog; - - // EndModal - int value; - NWindows::NControl::CModalDialogImpl * window; - - // MessageBox - const TCHAR * msg; - const TCHAR * title; - int flag; - - // - LPCWSTR initialFolderOrFile; - - wxSemaphore * sem; - int ret; - - UString resultPath; - -#define MAX_CREATE 16 -} g_tabCreate[MAX_CREATE]; - -static int myCreateHandle2(int n); - -static int findFreeInd() -{ -static NWindows::NSynchronization::CCriticalSection g_CriticalSection; - - g_CriticalSection.Enter(); - int ind = 0; - while (ind < MAX_CREATE) - { - if (g_tabCreate[ind].busy == false) - { - g_tabCreate[ind].busy = true; - break; - } - ind++; - } - g_CriticalSection.Leave(); - - return ind; -} - -static int WaitInd(wxWindow * destWindow, int ind,int id,wxWindow * parent,UString &resultPath) -{ - int ret = 0; - - g_tabCreate[ind].id = id; - g_tabCreate[ind].parentWindow = parent; - g_tabCreate[ind].ret = 0; - g_tabCreate[ind].resultPath = wxEmptyString; - - if (wxThread::IsMain()) - { - ret = myCreateHandle2(ind); - resultPath = g_tabCreate[ind].resultPath; - } - else - { - if (destWindow == 0) { - extern wxWindow * g_window; - if (g_window == 0) - { - printf("INTERNAL ERROR : g_window and destWindow == NULL\n"); abort(); - } - destWindow = g_window; - } - g_tabCreate[ind].sem = new wxSemaphore(0); - - // create any type of command event here - wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, WORKER_EVENT ); - event.SetInt( ind ); - - // send in a thread-safe way - // DEBUG printf("T=0x%lx - %d : WaitInd(%d,%p): BEGIN\n", wxThread::GetCurrentId(),time(0)-g_T0,g_tabCreate[ind].id,g_tabCreate[ind].parentWindow); - wxPostEvent( destWindow, event ); - - g_tabCreate[ind].sem->Wait(); - - ret = g_tabCreate[ind].ret; - resultPath = g_tabCreate[ind].resultPath; - // DEBUG printf("T=0x%lx - %d : WaitInd(%d,%p): ret=%d\n", wxThread::GetCurrentId(),time(0)-g_T0,g_tabCreate[ind].id,g_tabCreate[ind].parentWindow,ret); - delete g_tabCreate[ind].sem; - g_tabCreate[ind].sem = 0; - } - - g_tabCreate[ind].busy = false; - - return ret; -} - -static int WaitInd(wxWindow * destWindow,int ind,int id,wxWindow * parent) -{ - UString resultPath; - return WaitInd(destWindow,ind,id,parent,resultPath); -} - -void verify_main_thread(void); - -class LockGUI -{ - bool _IsMain; - public: - LockGUI() { - - verify_main_thread(); - - _IsMain = wxThread::IsMain(); - if (!_IsMain) { - // DEBUG - printf("GuiEnter-Dialog(0x%lx)\n",wxThread::GetCurrentId()); - abort(); // FIXME wxMutexGuiEnter(); - } - } - ~LockGUI() { - if (!_IsMain) { - wxMutexGuiLeave(); - // DEBUG printf("GuiLeave(0x%lx)\n",wxThread::GetCurrentId()); - } - } -}; - -static const unsigned int kNumDialogsMax = 32; -static unsigned int g_NumDialogs = 0; -static const CDialogInfo *g_Dialogs[kNumDialogsMax]; - -void RegisterDialog(const CDialogInfo *dialogInfo) -{ - // DEBUG printf("RegisterDialog : %d\n",dialogInfo->id); - if (g_NumDialogs < kNumDialogsMax) - g_Dialogs[g_NumDialogs++] = dialogInfo; -} - -namespace NWindows { - - CSysString MyLoadString(unsigned int resourceID) - { - for(unsigned i=0; i < g_NumDialogs; i++) { - if (g_Dialogs[i]->stringTable) { - int j = 0; - while(g_Dialogs[i]->stringTable[j].str) { - if (resourceID == g_Dialogs[i]->stringTable[j].id) { - return g_Dialogs[i]->stringTable[j].str; - } - - j++; - } - } - } - return L"FIXME-MyLoadStringW-"; - } - - namespace NControl { - -/////////////////////////////////////////// CModalDialog ////////////////////////////////// - - bool CModalDialog::CheckButton(int buttonID, UINT checkState) - { - LockGUI lock; - wxCheckBox* w = (wxCheckBox*)_window->FindWindow(buttonID); - if (w) - { - w->SetValue(checkState == BST_CHECKED); - return true; - } - return false; - } - - UINT CModalDialog::IsButtonChecked(int buttonID) const - { - LockGUI lock; - wxCheckBox* w = (wxCheckBox*)_window->FindWindow(buttonID); - if (w) - { - bool bret = w->GetValue(); - if (bret) return BST_CHECKED; - } - return BST_UNCHECKED; - } - - void CModalDialog::EnableItem(int id, bool state) - { - LockGUI lock; - wxWindow* w = _window->FindWindow(id); - if (w) w->Enable(state); - } - - void CModalDialog::SetItemText(int id, const TCHAR *txt) - { - LockGUI lock; - wxWindow* w = _window->FindWindow(id); - if (w) - { - wxString label(txt); - w->SetLabel(label); - } - } - - wxWindow * CModalDialog::GetItem(long id) const - { - LockGUI lock; - return _window->FindWindow(id); - } - - void CModalDialog::ShowItem(int itemID, int cmdShow) const - { - LockGUI lock; - // cmdShow = SW_HIDE or SW_SHOW (sometimes false or true !) - wxWindow* w = _window->FindWindow(itemID); - if (w) - { -// FIXME w->Show(cmdShow != SW_HIDE); - w->Enable(cmdShow != SW_HIDE); - } - } - - UINT_PTR CModalDialog::SetTimer(UINT_PTR idEvent , unsigned milliseconds) - { - LockGUI lock; - return _window->SetTimer(idEvent , milliseconds); - } - - void CModalDialog::KillTimer(UINT_PTR idEvent) - { - LockGUI lock; - _window->KillTimer(idEvent); - } - - void CModalDialog::SetText(const TCHAR *_title) { - LockGUI lock; - _window->SetTitle(_title); - } - - - bool CModalDialog::GetText(CSysString &s) { - wxString str; - { - LockGUI lock; - str = _window->GetTitle(); - } - s = str; - return true; - } - - INT_PTR CModalDialog::Create(int id , HWND parentWindow) - { - int ind = findFreeInd(); - - g_tabCreate[ind].dialog = this; - - return WaitInd(0, ind,id,parentWindow); - } - - void CModalDialog::End(int result) - { - int ind = findFreeInd(); - - g_tabCreate[ind].window = _window; - g_tabCreate[ind].value = result; - - WaitInd(this->_window,ind,DIALOG_ID_END_DIALOG,0); - } - - void CModalDialog::PostMessage(UINT message) - { - int ind = findFreeInd(); - - g_tabCreate[ind].dialog = this; - g_tabCreate[ind].value = message; - - WaitInd(this->_window,ind,DIALOG_ID_POST_DIALOG,0); - } - -/////////////////////////////////////////// CModalDialogImpl /////////////////////////////////////// - - CModalDialogImpl::CModalDialogImpl(CDialog *dialog, wxWindow* parent, wxWindowID id, - const wxString& title, const wxPoint& pos, - const wxSize& size, long style) : - wxDialog(parent, id, title , pos , size, style /* | wxDIALOG_NO_PARENT */ ) , - _timer(this, TIMER_ID_IMPL), _dialog(dialog) - { - // set the frame icon - this->SetIcon(wxICON(p7zip_32)); - } - - void CModalDialogImpl::OnAnyButton(wxCommandEvent& event) - { - int id = event.GetId(); - if (id == wxID_OK) - { - if (_dialog) _dialog->OnOK(); - // event.Skip(true); - } - else if (id == wxID_CANCEL) - { - if (_dialog) _dialog->OnCancel(); - // event.Skip(true); - } - else if (id == wxID_HELP) - { - if (_dialog) _dialog->OnHelp(); - } - else - { - if (_dialog) - { - /* bool bret = */ _dialog->OnButtonClicked(id, FindWindow(id) ); - } - } - } - - void CModalDialogImpl::OnAnyChoice(wxCommandEvent &event) - { - int itemID = event.GetId(); - if (_dialog) _dialog->OnCommand(CBN_SELCHANGE, itemID, 0); - } - - void CModalDialogImpl::OnAnyTimer(wxTimerEvent &event) - { - int timerID = event.GetId(); - if (_dialog) _dialog->OnTimer(timerID , 0); - } - } -} - -///////////////////////// myCreateHandle - - -static int myCreateHandle2(int n) -{ - unsigned int id = g_tabCreate[n].id; - wxWindow * parentWindow = g_tabCreate[n].parentWindow; - NWindows::NControl::CModalDialogImpl * window = 0; - - // DEBUG printf("T=0x%lx - %d : myCreateHandle(%d): BEGIN\n", wxThread::GetCurrentId(),time(0)-g_T0,n); - - if (id == DIALOG_ID_END_DIALOG) - { - /* FIXME : the dialog must be shown before ending it ? - while (!g_tabCreate[n].window->IsShownOnScreen()) Sleep(200); - Sleep(200); - */ - g_tabCreate[n].window->EndModal(g_tabCreate[n].value); - return 0; - } - - if (id == DIALOG_ID_POST_DIALOG) - { - g_tabCreate[n].dialog->OnMessage(g_tabCreate[n].value, 0, 0); - return 0; - } - - if (id == DIALOG_ID_MESSAGEBOX) - { - long style = g_tabCreate[n].flag; - long decorated_style = style; - if ( ( style & ( wxICON_EXCLAMATION | wxICON_HAND | wxICON_INFORMATION | - wxICON_QUESTION ) ) == 0 ) - { - decorated_style |= ( style & wxYES ) ? wxICON_QUESTION : wxICON_INFORMATION ; - } - wxMessageDialog dialog(parentWindow, g_tabCreate[n].msg, g_tabCreate[n].title, decorated_style); - dialog.SetIcon(wxICON(p7zip_32)); - int ret = dialog.ShowModal(); - - return ret; - } - - if (id == DIALOG_ID_DIR_DIALOG) - { - wxString defaultDir = g_tabCreate[n].initialFolderOrFile; - wxDirDialog dirDialog(g_tabCreate[n].parentWindow, - g_tabCreate[n].title, defaultDir); - dirDialog.SetIcon(wxICON(p7zip_32)); - int ret = dirDialog.ShowModal(); - if (ret == wxID_OK) g_tabCreate[n].resultPath = dirDialog.GetPath(); - return ret; - } - - if (id == DIALOG_ID_FILE_DIALOG) - { - wxString defaultFilename = g_tabCreate[n].initialFolderOrFile; - - wxFileName filename(defaultFilename); - - wxString dir = filename.GetPath(); - wxString name = filename.GetFullName(); - - - // printf("DIALOG_ID_FILE_DIALOG = '%ls' => '%ls' '%ls'\n",&defaultFilename[0],&dir[0],&name[0]); - - - wxFileDialog fileDialog(g_tabCreate[n].parentWindow, g_tabCreate[n].title, - dir, name, wxT("All Files (*.*)|*.*"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT); - fileDialog.SetIcon(wxICON(p7zip_32)); - int ret = fileDialog.ShowModal(); - if (ret == wxID_OK) g_tabCreate[n].resultPath = fileDialog.GetPath(); - return ret; - } - - for(unsigned i=0; i < g_NumDialogs; i++) { - if (id == g_Dialogs[i]->id) { - // DEBUG printf("%d : Create(%d,%p): CreateDialog-1\n",time(0)-g_T0,id,parentWindow); - window = (g_Dialogs[i]->createDialog)(g_tabCreate[n].dialog,g_tabCreate[n].parentWindow); - // DEBUG printf("%d : Create(%d,%p): CreateDialog-2\n",time(0)-g_T0,id,parentWindow); - break; - } - } - - if (window) { - - // DEBUG printf("%d : Create(%d,%p): %p->ShowModal()\n",time(0)-g_T0,id,parentWindow,window); - - // window->Show(true); - // wxGetApp().ProcessPendingEvents(); - - INT_PTR ret = window->ShowModal(); - - // DEBUG printf("%d : Create(%d,%p): %p->ShowModal() - ret=%d\n",time(0)-g_T0,id,parentWindow,window,ret); - window->Detach(); - window->Destroy(); - - // DEBUG printf("%d : Create(%d,%p): END\n",time(0)-g_T0,id,parentWindow,window); - - return ret; - } - - // FIXME - printf("INTERNAL ERROR : cannot find dialog %d\n",id); - - return 0; -} - -void myCreateHandle(int n) -{ - int ret = myCreateHandle2(n); - g_tabCreate[n].ret = ret; - g_tabCreate[n].sem->Post(); -} - -int MessageBoxW(wxWindow * parent, const TCHAR * msg, const TCHAR * title,int flag) -{ - int ind = findFreeInd(); - - g_tabCreate[ind].msg = msg; - g_tabCreate[ind].title = title; - g_tabCreate[ind].flag = flag; - - return WaitInd(parent,ind,DIALOG_ID_MESSAGEBOX,parent); // FIXME -} - - - -// FIXME : should be in Windows/Shell.cpp - -namespace NWindows{ -namespace NShell{ - -bool BrowseForFolder(HWND owner, LPCWSTR title, LPCWSTR initialFolder, UString &resultPath) -{ - int ind = findFreeInd(); - - g_tabCreate[ind].title = title; - g_tabCreate[ind].initialFolderOrFile = nameWindowToUnix(initialFolder); - - UString resTmp; - int ret = WaitInd(0,ind,DIALOG_ID_DIR_DIALOG,owner,resTmp); // FIXME - if(ret == wxID_OK) - { - resultPath = resTmp; - return true; - } - return false; -} - -}} - -/////////////////////////// CPP/Windows/CommonDialog.cpp -namespace NWindows -{ - - bool MyGetOpenFileName(HWND hwnd, LPCWSTR title, LPCWSTR fullFileName, LPCWSTR s, UString &resPath) - { - int ind = findFreeInd(); - - g_tabCreate[ind].title = title; - g_tabCreate[ind].initialFolderOrFile = nameWindowToUnix(fullFileName); - - UString resTmp; - int ret = WaitInd(0,ind,DIALOG_ID_FILE_DIALOG,hwnd,resTmp); // FIXME - if(ret == wxID_OK) - { - resPath = resTmp; - return true; - } - return false; - } -} - diff --git a/src/libs/7zip/unix/CPP/Windows/Control/Dialog.h b/src/libs/7zip/unix/CPP/Windows/Control/Dialog.h deleted file mode 100644 index 54899a104..000000000 --- a/src/libs/7zip/unix/CPP/Windows/Control/Dialog.h +++ /dev/null @@ -1,179 +0,0 @@ -// Windows/Control/Dialog.h - -#ifndef __WINDOWS_CONTROL_DIALOG_H -#define __WINDOWS_CONTROL_DIALOG_H - -#include "Windows/Window.h" - -#ifndef _WIN32 -#define SW_HIDE 0 -#define SW_SHOW 5 - -#define WM_SETTEXT (6000) // wxID_HIGHEST + 1 -#define WM_USER (6999) // wxID_HIGHEST + 1000 - -#endif - -#ifndef _WIN32 -#define CBN_SELCHANGE 1 -#endif - -// FIXME -#define IDCLOSE (5001) // wxID_CLOSE -#define IDEXIT (5006) // wxID_EXIT -#define IDOK (5100) // wxID_OK -#define IDCANCEL (5101) // wxID_CANCEL -#define IDABORT (5115) // wxID_ABORT -#define IDYES (5103) // wxID_YES -#define IDNO (5104) // wxID_NO -#define IDHELP (5009) // wxID_HELP - -#define BST_CHECKED 1 -#define BST_UNCHECKED 0 -// #define BST_INDETERMINATE 0x0002 - -#define wsprintf(a,b,c,d,e) swprintf(a,9999,b,c,d,e) // FIXME - -namespace NWindows { - namespace NControl { - - class CModalDialogImpl; - - class CDialog - { - protected: - CModalDialogImpl * _window; - public: - operator HWND() const { return HWND(_window); } - - bool OnInit(CModalDialogImpl * window) { - _window = window; - return OnInit(); - } - virtual bool OnInit() { return false; } - virtual void OnOK() {} - virtual void OnCancel() {} - virtual void OnHelp() {} - virtual bool OnButtonClicked(int buttonID, wxWindow * buttonHWND) { return false; } - virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam) { return false; } - virtual bool OnCommand(int code, int itemID, LPARAM lParam) { return false; } - virtual bool OnTimer(WPARAM /* timerID */, LPARAM /* callback */) { return false; } - - void NormalizeSize(bool fullNormalize = false) { /* FIXME */ } - void NormalizePosition() { /* FIXME */ } - }; - - class CModalDialog : public CDialog - { - public: - - - ////////////////// COMPATIBILITY - - bool CheckRadioButton(int firstButtonID, int lastButtonID, int checkButtonID) - { -/* - for(int id = firstButtonID; id <= lastButtonID; id++) - { - CheckButton(id,id == checkButtonID); - } -*/ - this->CheckButton(checkButtonID,true); - - return true; - } - - - bool CheckButton(int buttonID, UINT checkState); - bool CheckButton(int buttonID, bool checkState) - { - return CheckButton(buttonID, UINT(checkState ? BST_CHECKED : BST_UNCHECKED)); - } - - - UINT IsButtonChecked(int buttonID) const; - - bool IsButtonCheckedBool(long buttonID) const - { return (IsButtonChecked(buttonID) == BST_CHECKED); } - - void EnableItem(int id, bool state); - - void SetItemText(int id, const TCHAR *txt); - - wxWindow * GetItem(long id) const ; - - void ShowItem(int itemID, int cmdShow) const; - - void HideItem(int itemID) const { ShowItem(itemID, SW_HIDE); } - - void End(int result); - - void SetText(const TCHAR *_title); // { _dialog->SetTitle(_title); } - - bool GetText(CSysString &s); - - INT_PTR Create(int id , HWND parentWindow); - - void PostMessage(UINT message); - - virtual void OnHelp() {} - - UINT_PTR SetTimer(UINT_PTR idEvent , unsigned milliseconds); - - void KillTimer(UINT_PTR idEvent); - - virtual void OnOK() { End(IDOK); } - virtual void OnCancel() { End(IDCANCEL); } - }; - -class CDialogChildControl : public NWindows::CWindow -{ -public: - CDialogChildControl() {} - - int m_ID; - void Init(const NWindows::NControl::CModalDialog &parentDialog, int id) - { - m_ID = id; - this->Attach(parentDialog.GetItem(id)); - } - virtual void SetText(LPCWSTR s); - virtual bool GetText(CSysString &s); -}; - -} -} - -struct CStringTable -{ - unsigned int id; - const wchar_t *str; -}; - -struct CDialogInfo -{ - unsigned int id; - NWindows::NControl::CModalDialogImpl * (*createDialog)(NWindows::NControl::CModalDialog * dialog, HWND parentWindow); - CStringTable * stringTable; -}; - -void RegisterDialog(const CDialogInfo *dialogInfo); - -#define REGISTER_DIALOG_NAME(x) CRegister ## x - -#define REGISTER_DIALOG(id,x,stringTable) \ - static NWindows::NControl::CModalDialogImpl * myCreate##x(NWindows::NControl::CModalDialog * dialog,HWND parentWindow) \ - { return new x##Impl(dialog,parentWindow,id); } \ - static struct CDialogInfo g_DialogInfo = { id , myCreate##x, stringTable }; \ - struct REGISTER_DIALOG_NAME(x) { \ - REGISTER_DIALOG_NAME(x)() { RegisterDialog(&g_DialogInfo); }}; \ - static REGISTER_DIALOG_NAME(x) g_RegisterDialog; - -#define REGISTER_STRINGTABLE(stringTable) \ - static struct CDialogInfo g_DialogInfo = { -1 , 0 , stringTable }; \ - struct REGISTER_DIALOG_NAME(x) { \ - REGISTER_DIALOG_NAME(x)() { RegisterDialog(&g_DialogInfo); }}; \ - static REGISTER_DIALOG_NAME(x) g_RegisterDialog; - -#endif - diff --git a/src/libs/7zip/unix/CPP/Windows/Control/DialogImpl.h b/src/libs/7zip/unix/CPP/Windows/Control/DialogImpl.h deleted file mode 100644 index a9720b778..000000000 --- a/src/libs/7zip/unix/CPP/Windows/Control/DialogImpl.h +++ /dev/null @@ -1,73 +0,0 @@ -// Windows/Control/DialogImpl.h - -#ifndef __WINDOWS_CONTROL_DIALOGIMPL_H -#define __WINDOWS_CONTROL_DIALOGIMPL_H - -#include "Windows/Window.h" -#include "Windows/Control/Dialog.h" - -void myCreateHandle(int n); // FIXME - duplicate - -enum { - WORKER_EVENT=100 // this one gets sent from the worker thread -}; - -namespace NWindows { - namespace NControl { - -#define TIMER_ID_IMPL (1234) - - class CModalDialogImpl : public wxDialog - { - wxTimer _timer; - - CDialog *_dialog; - public: - CModalDialogImpl(CDialog *dialog, wxWindow* parent, wxWindowID id, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE ); - - CDialog * Detach() - { - CDialog * oldDialog = _dialog; - _dialog = NULL; - return oldDialog; - } - - void OnInit() - { - if (_dialog) _dialog->OnInit(this); - } - - void OnAnyButton(wxCommandEvent& event); - void OnAnyChoice(wxCommandEvent &event); - void OnAnyTimer(wxTimerEvent &event); - -/* FIXME virtual void SetLabel(const wxString &title) - { - // Why we must do this "alias" ? - this->SetTitle(title); - } -*/ - ////////////////// - UINT_PTR SetTimer(UINT_PTR /* FIXME idEvent */, unsigned milliseconds) - { - _timer.Start(milliseconds); - return TIMER_ID_IMPL; - } - void KillTimer(UINT_PTR idEvent) - { - if (idEvent == TIMER_ID_IMPL) _timer.Stop(); - } - void OnWorkerEvent(wxCommandEvent& event) - { - int n = event.GetInt(); - // printf("CModalDialogImpl::OnWorkerEvent(n=%d)\n",n); - myCreateHandle(n); - } - }; -} -} - -#endif - diff --git a/src/libs/7zip/unix/CPP/Windows/Control/Edit.h b/src/libs/7zip/unix/CPP/Windows/Control/Edit.h deleted file mode 100644 index e6930e5d4..000000000 --- a/src/libs/7zip/unix/CPP/Windows/Control/Edit.h +++ /dev/null @@ -1,24 +0,0 @@ -// Windows/Control/Edit.h - -#ifndef __WINDOWS_CONTROL_EDIT_H -#define __WINDOWS_CONTROL_EDIT_H - -#include "Windows/Window.h" -#include "Windows/Defs.h" - -namespace NWindows { -namespace NControl { - -class CEdit: public CWindow -{ -public: - void SetPasswordChar(WPARAM c); - void Show(int cmdShow); - virtual void SetText(LPCWSTR s); - virtual bool GetText(CSysString &s); -}; - -}} - -#endif - diff --git a/src/libs/7zip/unix/CPP/Windows/Control/ListView.h b/src/libs/7zip/unix/CPP/Windows/Control/ListView.h deleted file mode 100644 index 149f4a450..000000000 --- a/src/libs/7zip/unix/CPP/Windows/Control/ListView.h +++ /dev/null @@ -1,164 +0,0 @@ -// Windows/Control/ListView.h - -#ifndef __WINDOWS_CONTROL_LISTVIEW_H -#define __WINDOWS_CONTROL_LISTVIEW_H - -#include "Windows/Window.h" -#include "Windows/Defs.h" - -/* -#include <commctrl.h> -*/ - -#ifndef _WIN32 - -#define LVCF_FMT 0x0001 -#define LVCF_WIDTH 0x0002 -#define LVCF_TEXT 0x0004 -#define LVCF_SUBITEM 0x0008 -#define LVCF_IMAGE 0x0010 -#define LVCF_ORDER 0x0020 - -#define LVCFMT_LEFT 0x0000 -#define LVCFMT_RIGHT 0x0001 -#define LVCFMT_CENTER 0x0002 -#define LVCFMT_JUSTIFYMASK 0x0003 - - -// state -#define LVIS_FOCUSED 0x0002 /* wxLIST_STATE_FOCUSED */ -#define LVIS_SELECTED 0x0004 /* wxLIST_STATE_SELECTED */ - -#define LVNI_SELECTED 0x0004 /* wxLIST_STATE_SELECTED */ - -typedef INT (CALLBACK *PFNLVCOMPARE)(LPARAM, LPARAM, LPARAM); - -typedef struct tagLVCOLUMNW -{ - UINT mask; - int fmt; - int cx; - LPWSTR pszText; - int cchTextMax; - int iSubItem; - int iOrder; // FIXME -} LVCOLUMNW; - -#define LVCOLUMN LVCOLUMNW -#define LV_COLUMNW LVCOLUMNW /* FIXME */ - - - -typedef struct tagLVITEMW -{ - UINT mask; - int iItem; - int iSubItem; - UINT state; - UINT stateMask; - LPWSTR pszText; - int cchTextMax; - int iImage; - LPARAM lParam; -#if (_WIN32_IE >= 0x0300) - int iIndent; -#endif -#if (_WIN32_WINNT >= 0x501) - int iGroupId; - UINT cColumns; // tile view columns - PUINT puColumns; -#endif -} LVITEMW; - -#define LVITEM LVITEMW - -#define LVIF_TEXT 0x0001 -// FIXME - mask -#define LVIF_PARAM 2 -#define LVIF_IMAGE 4 -#define LVIF_STATE 8 - -#endif - -class wxListCtrl; - -namespace NWindows { -namespace NControl { - -class CListView // : public NWindows::CWindow -{ - wxListCtrl *_list; -public: - CListView() : _list(0) {} - void Attach(wxWindow * newWindow); - - operator HWND() const; - - int GetItemCount() const; - - int InsertItem(int index, LPCTSTR text); - int InsertItem(const LVITEM* item); - - void SetItem(const LVITEM* item); - - int SetSubItem(int index, int subIndex, LPCTSTR text); - - void SetUnicodeFormat(bool fUnicode) { return ; } - - void InsertColumn(int columnIndex, LPCTSTR text, int width); - - void InsertColumn(int columnIndex, const LVCOLUMNW *columnInfo); - - void DeleteAllItems(); - - void SetRedraw(bool); - - void SetItemCount(int ); - - void InvalidateRect(void *, bool); - - int GetSelectedCount() const; - - void /* bool */ EnsureVisible(int index, bool partialOK); - - void SetItemState(int index, UINT state, UINT mask); - - void SetItemState_FocusedSelected(int index) { SetItemState(index, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED); } - - UINT GetItemState(int index, UINT mask) const; - - void /* bool */ Update(); - - bool DeleteColumn(int columnIndex); - - bool GetItemParam(int itemIndex, LPARAM ¶m) const; - - int GetNextItem(int startIndex, UINT flags) const; - - int GetFocusedItem() const; - - void RedrawAllItems(); - // FIXME added - int GetColumnCount(); - - void SetFocus(); - - void RedrawItem(int item); - - bool SortItems(PFNLVCOMPARE compareFunction, LPARAM dataParam); - - bool GetColumn(int columnIndex, LVCOLUMN* columnInfo); - - // HWND EditLabel(int itemIndex) - void EditLabel(int itemIndex); - - bool SetColumnWidthAuto(int iCol) { - return true; // FIXME SetColumnWidth(iCol, LVSCW_AUTOSIZE); - } - - -}; - -}} -#endif - diff --git a/src/libs/7zip/unix/CPP/Windows/Control/ProgressBar.h b/src/libs/7zip/unix/CPP/Windows/Control/ProgressBar.h deleted file mode 100644 index c7bfa8e8d..000000000 --- a/src/libs/7zip/unix/CPP/Windows/Control/ProgressBar.h +++ /dev/null @@ -1,34 +0,0 @@ -// Windows/Control/ProgressBar.h - -#ifndef __WINDOWS_CONTROL_PROGRESSBAR_H -#define __WINDOWS_CONTROL_PROGRESSBAR_H - -#include "Windows/Window.h" -#include "Windows/Defs.h" - -class wxGauge; - -namespace NWindows { -namespace NControl { - - -class CProgressBar : public CWindow -{ -protected: - wxGauge* _window; - int _minValue; - int _range; -public: - CProgressBar(wxWindow* newWindow = NULL); - - void Attach(wxWindow* newWindow); - - void SetRange32(int minValue, int maxValue); - - void SetPos(int pos); -}; - -}} - -#endif - diff --git a/src/libs/7zip/unix/CPP/Windows/Control/Static.h b/src/libs/7zip/unix/CPP/Windows/Control/Static.h deleted file mode 100644 index 36469c18f..000000000 --- a/src/libs/7zip/unix/CPP/Windows/Control/Static.h +++ /dev/null @@ -1,23 +0,0 @@ -// Windows/Control/Static.h - -#ifndef __WINDOWS_CONTROL_STATIC_H -#define __WINDOWS_CONTROL_STATIC_H - -#include "Windows/Window.h" -#include "Windows/Defs.h" - -typedef void * HICON; - -namespace NWindows { -namespace NControl { - -class CStatic : public CWindow -{ -public: - - HICON SetIcon(HICON icon) { return 0; } // FIXME -}; - -}} - -#endif diff --git a/src/libs/7zip/unix/CPP/Windows/Control/StatusBar.h b/src/libs/7zip/unix/CPP/Windows/Control/StatusBar.h deleted file mode 100644 index 6b4417d10..000000000 --- a/src/libs/7zip/unix/CPP/Windows/Control/StatusBar.h +++ /dev/null @@ -1,56 +0,0 @@ -// Windows/Control/StatusBar.h - -#ifndef __WINDOWS_CONTROL_STATUSBAR_H -#define __WINDOWS_CONTROL_STATUSBAR_H - -#include "Windows/Window.h" -#include "Windows/Defs.h" - -class wxStatusBar; - -namespace NWindows { -namespace NControl { - -class CStatusBar // : public NWindows::CWindow -{ - wxStatusBar * _statusBar; -public: - CStatusBar() : _statusBar(0) {} - - void Attach(wxWindow * newWindow); - wxWindow * Detach(); - - void SetText(int index, LPCTSTR text); - -/* FIXME - bool Create(LONG style, LPCTSTR text, HWND hwndParent, UINT id) - { return (_window = ::CreateStatusWindow(style, text, hwndParent, id)) != 0; } - bool SetParts(int numParts, const int *edgePostions) - { return LRESULTToBool(SendMessage(SB_SETPARTS, numParts, (LPARAM)edgePostions)); } - bool SetText(LPCTSTR text) - { return CWindow::SetText(text); } - - bool SetText(int index, LPCTSTR text, UINT type) - { return LRESULTToBool(SendMessage(SB_SETTEXT, index | type, (LPARAM)text)); } - bool SetText(int index, LPCTSTR text) - { return SetText(index, text, 0); } - void Simple(bool simple) - { SendMessage(SB_SIMPLE, BoolToBOOL(simple), 0); } - - #ifndef _UNICODE - bool Create(LONG style, LPCWSTR text, HWND hwndParent, UINT id) - { return (_window = ::CreateStatusWindowW(style, text, hwndParent, id)) != 0; } - bool SetText(LPCWSTR text) - { return CWindow::SetText(text); } - bool SetText(int index, LPCWSTR text, UINT type) - { return LRESULTToBool(SendMessage(SB_SETTEXTW, index | type, (LPARAM)text)); } - bool SetText(int index, LPCWSTR text) - { return SetText(index, text, 0); } - #endif -*/ -}; - -}} - -#endif - diff --git a/src/libs/7zip/unix/CPP/Windows/Control/Window2.cpp b/src/libs/7zip/unix/CPP/Windows/Control/Window2.cpp deleted file mode 100644 index dda1da090..000000000 --- a/src/libs/7zip/unix/CPP/Windows/Control/Window2.cpp +++ /dev/null @@ -1,211 +0,0 @@ -// Windows/Control/Window2.cpp - -#include "StdAfx.h" - -#ifndef _UNICODE -#include "Common/StringConvert.h" -#endif -#include "Windows/Control/Window2.h" - -// extern HINSTANCE g_hInstance; -#ifndef _UNICODE -extern bool g_IsNT; -#endif - -namespace NWindows { - -#ifndef _UNICODE -ATOM MyRegisterClass(CONST WNDCLASSW *wndClass); -#endif - -namespace NControl { - -#ifdef _WIN32 -static LRESULT CALLBACK WindowProcedure(HWND aHWND, UINT message, - WPARAM wParam, LPARAM lParam) -{ - CWindow tempWindow(aHWND); - if (message == WM_NCCREATE) - tempWindow.SetUserDataLongPtr( - LONG_PTR(((LPCREATESTRUCT)lParam)->lpCreateParams)); - CWindow2 *window = (CWindow2*)(tempWindow.GetUserDataLongPtr()); - if (window != NULL && message == WM_NCCREATE) - window->Attach(aHWND); - if (window == 0) - { - #ifndef _UNICODE - if (g_IsNT) - return DefWindowProcW(aHWND, message, wParam, lParam); - else - #endif - return DefWindowProc(aHWND, message, wParam, lParam); - } - return window->OnMessage(message, wParam, lParam); -} - -bool CWindow2::CreateEx(DWORD exStyle, LPCTSTR className, - LPCTSTR windowName, DWORD style, - int x, int y, int width, int height, - HWND parentWindow, HMENU idOrHMenu, - HINSTANCE instance) -{ - WNDCLASS windowClass; - if(!::GetClassInfo(instance, className, &windowClass)) - { - // windowClass.style = CS_HREDRAW | CS_VREDRAW; - windowClass.style = 0; - - windowClass.lpfnWndProc = WindowProcedure; - windowClass.cbClsExtra = NULL; - windowClass.cbWndExtra = NULL; - windowClass.hInstance = instance; - windowClass.hIcon = NULL; - windowClass.hCursor = LoadCursor(NULL, IDC_ARROW); - windowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); - windowClass.lpszMenuName = NULL; - windowClass.lpszClassName = className; - if (::RegisterClass(&windowClass) == 0) - return false; - } - return CWindow::CreateEx(exStyle, className, windowName, - style, x, y, width, height, parentWindow, - idOrHMenu, instance, this); -} - -#ifndef _UNICODE - -bool CWindow2::CreateEx(DWORD exStyle, LPCWSTR className, - LPCWSTR windowName, DWORD style, - int x, int y, int width, int height, - HWND parentWindow, HMENU idOrHMenu, - HINSTANCE instance) -{ - bool needRegister; - if(g_IsNT) - { - WNDCLASSW windowClass; - needRegister = ::GetClassInfoW(instance, className, &windowClass) == 0; - } - else - { - WNDCLASSA windowClassA; - AString classNameA; - LPCSTR classNameP; - if (IS_INTRESOURCE(className)) - classNameP = (LPCSTR)className; - else - { - classNameA = GetSystemString(className); - classNameP = classNameA; - } - needRegister = ::GetClassInfoA(instance, classNameP, &windowClassA) == 0; - } - if (needRegister) - { - WNDCLASSW windowClass; - // windowClass.style = CS_HREDRAW | CS_VREDRAW; - windowClass.style = 0; - windowClass.lpfnWndProc = WindowProcedure; - windowClass.cbClsExtra = NULL; - windowClass.cbWndExtra = NULL; - windowClass.hInstance = instance; - windowClass.hIcon = NULL; - windowClass.hCursor = LoadCursor(NULL, IDC_ARROW); - windowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); - windowClass.lpszMenuName = NULL; - windowClass.lpszClassName = className; - if (MyRegisterClass(&windowClass) == 0) - return false; - } - return CWindow::CreateEx(exStyle, className, windowName, - style, x, y, width, height, parentWindow, - idOrHMenu, instance, this); - -} -#endif - -LRESULT CWindow2::DefProc(UINT message, WPARAM wParam, LPARAM lParam) -{ - #ifndef _UNICODE - if (g_IsNT) - return DefWindowProcW(_window, message, wParam, lParam); - else - #endif - return DefWindowProc(_window, message, wParam, lParam); -} -#endif - -LRESULT CWindow2::OnMessage(UINT message, WPARAM wParam, LPARAM lParam) -{ - LRESULT result; - switch (message) - { - case WM_CREATE: - if (!OnCreate((CREATESTRUCT *)lParam)) - return -1; - break; - case WM_COMMAND: - if (OnCommand(wParam, lParam, result)) - return result; - break; - case WM_NOTIFY: - if (OnNotify((UINT)wParam, (LPNMHDR) lParam, result)) - return result; - break; - case WM_DESTROY: - OnDestroy(); - break; - case WM_CLOSE: - OnClose(); - return 0; -#ifdef _WIN32 - case WM_SIZE: - if (OnSize(wParam, LOWORD(lParam), HIWORD(lParam))) - return 0; -#endif - } -#ifdef _WIN32 - return DefProc(message, wParam, lParam); -#else - return 0; -#endif -} - -bool CWindow2::OnCommand(WPARAM wParam, LPARAM lParam, LRESULT &result) -{ - return OnCommand(HIWORD(wParam), LOWORD(wParam), lParam, result); -} - -bool CWindow2::OnCommand(int /* code */, int /* itemID */, LPARAM /* lParam */, LRESULT & /* result */) -{ - return false; - // return DefProc(message, wParam, lParam); - /* - if (code == BN_CLICKED) - return OnButtonClicked(itemID, (HWND)lParam); - */ -} - -/* -bool CDialog::OnButtonClicked(int buttonID, HWND buttonHWND) -{ - switch(aButtonID) - { - case IDOK: - OnOK(); - break; - case IDCANCEL: - OnCancel(); - break; - case IDHELP: - OnHelp(); - break; - default: - return false; - } - return true; -} - -*/ - -}} diff --git a/src/libs/7zip/unix/CPP/Windows/Control/Window2.h b/src/libs/7zip/unix/CPP/Windows/Control/Window2.h deleted file mode 100644 index 48c890640..000000000 --- a/src/libs/7zip/unix/CPP/Windows/Control/Window2.h +++ /dev/null @@ -1,111 +0,0 @@ -// Windows/Control/Window2.h - -#ifndef __WINDOWS_CONTROL_WINDOW2_H -#define __WINDOWS_CONTROL_WINDOW2_H - -#include "Windows/Window.h" -#include "Windows/Defs.h" - -#ifndef _WIN32 -typedef void * WNDPROC; -typedef void * CREATESTRUCT; -typedef struct -{ - HWND hwndFrom; - - UINT code; -#define NM_DBLCLK 1 -#define LVN_ITEMCHANGED 2 -#define LVN_COLUMNCLICK 3 -#define CBEN_BEGINEDIT 10 -#define CBEN_ENDEDITW 11 - - -} NMHDR; -typedef NMHDR * LPNMHDR; - -typedef struct tagNMLISTVIEW -{ - NMHDR hdr; - INT iItem; - INT iSubItem; - UINT uNewState; - UINT uOldState; - // UINT uChanged; - // POINT ptAction; - LPARAM lParam; -} NMLISTVIEW, *LPNMLISTVIEW; - -typedef void * LPNMITEMACTIVATE; - -#define NM_RCLICK 1234 /* FIXME */ - -// FIXME -#define WM_CREATE 1 -#define WM_COMMAND 2 -#define WM_NOTIFY 3 -#define WM_DESTROY 4 -#define WM_CLOSE 5 - -#define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16)) -#define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF)) - - -#endif - -namespace NWindows { -namespace NControl { - -class CWindow2 // : public CWindow -{ - // LRESULT DefProc(UINT message, WPARAM wParam, LPARAM lParam); -public: - // CWindow2(HWND newWindow = NULL): CWindow(newWindow){}; - CWindow2() {} - virtual ~CWindow2() {} - -#ifdef _WIN32 - bool CreateEx(DWORD exStyle, LPCTSTR className, - LPCTSTR windowName, DWORD style, - int x, int y, int width, int height, - HWND parentWindow, HMENU idOrHMenu, - HINSTANCE instance); - - #ifndef _UNICODE - bool CreateEx(DWORD exStyle, LPCWSTR className, - LPCWSTR windowName, DWORD style, - int x, int y, int width, int height, - HWND parentWindow, HMENU idOrHMenu, - HINSTANCE instance); - #endif -#endif - - virtual LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam); - virtual bool OnCreate(CREATESTRUCT * /* createStruct */) { return true; } - // virtual LRESULT OnCommand(WPARAM wParam, LPARAM lParam); - virtual bool OnCommand(WPARAM wParam, LPARAM lParam, LRESULT &result); - virtual bool OnCommand(int code, int itemID, LPARAM lParam, LRESULT &result); - virtual bool OnSize(WPARAM /* wParam */, int /* xSize */, int /* ySize */) { return false; } - virtual bool OnNotify(UINT /* controlID */, LPNMHDR /* lParam */, LRESULT & /* result */) { return false; } - virtual void OnDestroy() { /* FIXME PostQuitMessage(0); */ } - virtual void OnClose() { /* FIXME Destroy(); */ } - /* - virtual LRESULT OnHelp(LPHELPINFO helpInfo) { OnHelp(); }; - virtual LRESULT OnHelp() {}; - virtual bool OnButtonClicked(int buttonID, HWND buttonHWND); - virtual void OnOK() {}; - virtual void OnCancel() {}; - */ - -#ifdef _WIN32 - LONG_PTR SetMsgResult(LONG_PTR newLongPtr ) - { return SetLongPtr(DWLP_MSGRESULT, newLongPtr); } - LONG_PTR GetMsgResult() const - { return GetLongPtr(DWLP_MSGRESULT); } -#endif -}; - -}} - -#endif - diff --git a/src/libs/7zip/unix/CPP/Windows/Menu.h b/src/libs/7zip/unix/CPP/Windows/Menu.h deleted file mode 100644 index 2f753c237..000000000 --- a/src/libs/7zip/unix/CPP/Windows/Menu.h +++ /dev/null @@ -1,4 +0,0 @@ - -/* TODO */ - - diff --git a/src/libs/7zip/unix/CPP/Windows/PropVariantConversions.cpp b/src/libs/7zip/unix/CPP/Windows/PropVariantConversions.cpp index 61d524d07..abd5b46c4 100644 --- a/src/libs/7zip/unix/CPP/Windows/PropVariantConversions.cpp +++ b/src/libs/7zip/unix/CPP/Windows/PropVariantConversions.cpp @@ -76,13 +76,10 @@ bool ConvertFileTimeToString(const FILETIME &ft, char *s, bool includeTime, bool #else BOOLEAN WINAPI RtlTimeToSecondsSince1970( const LARGE_INTEGER *Time, DWORD *Seconds ); - FILETIME filetime; - LocalFileTimeToFileTime(&ft, &filetime); - LARGE_INTEGER ltime; - ltime.QuadPart = filetime.dwHighDateTime; - ltime.QuadPart = (ltime.QuadPart << 32) | filetime.dwLowDateTime; + ltime.QuadPart = ft.dwHighDateTime; + ltime.QuadPart = (ltime.QuadPart << 32) | ft.dwLowDateTime; DWORD dw; RtlTimeToSecondsSince1970(<ime, &dw ); diff --git a/src/libs/7zip/unix/CPP/Windows/PropVariantUtils.cpp b/src/libs/7zip/unix/CPP/Windows/PropVariantUtils.cpp deleted file mode 100644 index 0a9cfab7f..000000000 --- a/src/libs/7zip/unix/CPP/Windows/PropVariantUtils.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// PropVariantUtils.cpp - -#include "StdAfx.h" - -#include "PropVariantUtils.h" -#include "Common/StringConvert.h" -#include "Common/IntToString.h" - -using namespace NWindows; - -static AString GetHex(UInt32 v) -{ - char sz[32] = { '0', 'x' }; - ConvertUInt64ToString(v, sz + 2, 16); - return sz; -} - -void StringToProp(const AString &s, NCOM::CPropVariant &prop) -{ - prop = MultiByteToUnicodeString(s); -} - -void PairToProp(const CUInt32PCharPair *pairs, unsigned num, UInt32 value, NCOM::CPropVariant &prop) -{ - AString s; - for (unsigned i = 0; i < num; i++) - { - const CUInt32PCharPair &p = pairs[i]; - if (p.Value == value) - s = p.Name; - } - if (s.IsEmpty()) - s = GetHex(value); - StringToProp(s, prop); -} - -AString TypeToString(const char *table[], unsigned num, UInt32 value) -{ - if (value < num) - return table[value]; - return GetHex(value); -} - -void TypeToProp(const char *table[], unsigned num, UInt32 value, NCOM::CPropVariant &prop) -{ - StringToProp(TypeToString(table, num, value), prop); -} - - -AString FlagsToString(const CUInt32PCharPair *pairs, unsigned num, UInt32 flags) -{ - AString s; - for (unsigned i = 0; i < num; i++) - { - const CUInt32PCharPair &p = pairs[i]; - UInt32 flag = (UInt32)1 << (unsigned)p.Value; - if ((flags & flag) != 0) - { - if (!s.IsEmpty()) - s += ' '; - s += p.Name; - } - flags &= ~flag; - } - if (flags != 0) - { - if (!s.IsEmpty()) - s += ' '; - s += GetHex(flags); - } - return s; -} - -void FlagsToProp(const CUInt32PCharPair *pairs, unsigned num, UInt32 flags, NCOM::CPropVariant &prop) -{ - StringToProp(FlagsToString(pairs, num, flags), prop); -} - diff --git a/src/libs/7zip/unix/CPP/Windows/PropVariantUtils.h b/src/libs/7zip/unix/CPP/Windows/PropVariantUtils.h deleted file mode 100644 index 5aaf65cb9..000000000 --- a/src/libs/7zip/unix/CPP/Windows/PropVariantUtils.h +++ /dev/null @@ -1,28 +0,0 @@ -// Windows/PropVariantUtils.h - -#ifndef __PROP_VARIANT_UTILS_H -#define __PROP_VARIANT_UTILS_H - -#include "Common/MyString.h" -#include "PropVariant.h" - -struct CUInt32PCharPair -{ - UInt32 Value; - const char *Name; -}; - -void StringToProp(const AString &s, NWindows::NCOM::CPropVariant &prop); -void PairToProp(const CUInt32PCharPair *pairs, unsigned num, UInt32 value, NWindows::NCOM::CPropVariant &prop); - -AString FlagsToString(const CUInt32PCharPair *pairs, unsigned num, UInt32 flags); -void FlagsToProp(const CUInt32PCharPair *pairs, unsigned num, UInt32 flags, NWindows::NCOM::CPropVariant &prop); - -AString TypeToString(const char *table[], unsigned num, UInt32 value); -void TypeToProp(const char *table[], unsigned num, UInt32 value, NWindows::NCOM::CPropVariant &prop); - -#define PAIR_TO_PROP(pairs, value, prop) PairToProp(pairs, sizeof(pairs) / sizeof(pairs[0]), value, prop) -#define FLAGS_TO_PROP(pairs, value, prop) FlagsToProp(pairs, sizeof(pairs) / sizeof(pairs[0]), value, prop) -#define TYPE_TO_PROP(table, value, prop) TypeToProp(table, sizeof(table) / sizeof(table[0]), value, prop) - -#endif diff --git a/src/libs/7zip/unix/CPP/Windows/ResourceString.h b/src/libs/7zip/unix/CPP/Windows/ResourceString.h deleted file mode 100644 index ac9c5cd5d..000000000 --- a/src/libs/7zip/unix/CPP/Windows/ResourceString.h +++ /dev/null @@ -1,22 +0,0 @@ -// Windows/ResourceString.h - -#ifndef __WINDOWS_RESOURCESTRING_H -#define __WINDOWS_RESOURCESTRING_H - -#include "Common/MyString.h" - -namespace NWindows { - -CSysString MyLoadString(HINSTANCE hInstance, UINT resourceID); -CSysString MyLoadString(UINT resourceID); -#ifdef _UNICODE -inline UString MyLoadStringW(HINSTANCE hInstance, UINT resourceID) { return MyLoadString(hInstance, resourceID); } -inline UString MyLoadStringW(UINT resourceID) { return MyLoadString(resourceID); } -#else -UString MyLoadStringW(HINSTANCE hInstance, UINT resourceID); -UString MyLoadStringW(UINT resourceID); -#endif - -} - -#endif diff --git a/src/libs/7zip/unix/CPP/Windows/Shell.h b/src/libs/7zip/unix/CPP/Windows/Shell.h deleted file mode 100644 index f116b772b..000000000 --- a/src/libs/7zip/unix/CPP/Windows/Shell.h +++ /dev/null @@ -1,21 +0,0 @@ -// Windows/Shell.h - -#ifndef __WINDOWS_SHELL_H -#define __WINDOWS_SHELL_H - -#include <windows.h> -// #include <shlobj.h> - -#include "Common/MyString.h" -#include "Windows/Defs.h" - - -namespace NWindows{ -namespace NShell{ - -bool BrowseForFolder(HWND owner, LPCWSTR title, LPCWSTR initialFolder, UString &resultPath); - -}} - - -#endif diff --git a/src/libs/7zip/unix/CPP/Windows/Time.cpp b/src/libs/7zip/unix/CPP/Windows/Time.cpp index dfa0938b5..b58de6fe1 100644 --- a/src/libs/7zip/unix/CPP/Windows/Time.cpp +++ b/src/libs/7zip/unix/CPP/Windows/Time.cpp @@ -10,26 +10,6 @@ namespace NTime { static const UInt32 kFileTimeStartYear = 1601; -bool DosTimeToFileTime(UInt32 dosTime, FILETIME &fileTime) -{ - return BOOLToBool(::DosDateTimeToFileTime((UInt16)(dosTime >> 16), (UInt16)(dosTime & 0xFFFF), &fileTime)); -} - -static const UInt32 kHighDosTime = 0xFF9FBF7D; -static const UInt32 kLowDosTime = 0x210000; - -bool FileTimeToDosTime(const FILETIME &fileTime, UInt32 &dosTime) -{ - WORD datePart, timePart; - if (!::FileTimeToDosDateTime(&fileTime, &datePart, &timePart)) - { - dosTime = (fileTime.dwHighDateTime >= 0x01C00000) ? kHighDosTime : kLowDosTime; - return false; - } - dosTime = (((UInt32)datePart) << 16) + timePart; - return true; -} - static const UInt32 kNumTimeQuantumsInSecond = 10000000; static const UInt64 kUnixTimeStartValue = ((UInt64)kNumTimeQuantumsInSecond) * 60 * 60 * 24 * 134774; diff --git a/src/libs/7zip/unix/CPP/Windows/Window.cpp b/src/libs/7zip/unix/CPP/Windows/Window.cpp deleted file mode 100644 index e92228c70..000000000 --- a/src/libs/7zip/unix/CPP/Windows/Window.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// Windows/Window.cpp - -#include "StdAfx.h" - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -// for all others, include the necessary headers (this file is usually all you -// need because it includes almost all "standard" wxWidgets headers) -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif - -#undef _WIN32 - -#ifndef _UNICODE -#include "Common/StringConvert.h" -#endif -#include "Windows/Window.h" - -void verify_main_thread(void); - -class LockGUI -{ - bool _IsMain; - public: - LockGUI() { - verify_main_thread(); - - _IsMain = wxThread::IsMain(); - if (!_IsMain) { - printf("LockGUI-Windows\n"); - abort(); // FIXME wxMutexGuiEnter(); - } - } - ~LockGUI() { if (!_IsMain) wxMutexGuiLeave(); } -}; - -namespace NWindows { - -HWND GetDlgItem(HWND dialogWindow, int ControlID) -{ - LockGUI lock; - if (dialogWindow) return dialogWindow->FindWindow(ControlID); - return 0; -} - -void MySetWindowText(HWND wnd, LPCWSTR s) -{ - if (wnd == 0) return; - - LockGUI lock; - - wxString str = s; - /* - int id = wnd->GetId(); - if ( (id != wxID_OK) && (id != wxID_CANCEL) && (id != wxID_HELP) && (id != wxID_YES) && (id != wxID_NO)) - */ - { - wnd->SetLabel(str); - } -} - - bool CWindow::GetText(CSysString &s) - { - wxString str; - { - LockGUI lock; - str = _window->GetLabel(); - } - s = str; - return true; - } - - bool CWindow::IsEnabled() - { - LockGUI lock; - return _window->IsEnabled(); - } -} - -////////////////////////////////// Windows Compatibility -#include <sys/resource.h> - -void Sleep(unsigned millisec) -{ - wxMilliSleep(millisec); -} - -t_processID GetCurrentProcess(void) { - return getpid(); -} - -void SetPriorityClass(t_processID pid , int priority) { - setpriority(PRIO_PROCESS,pid,priority); -} - diff --git a/src/libs/7zip/unix/CPP/Windows/Window.h b/src/libs/7zip/unix/CPP/Windows/Window.h deleted file mode 100644 index 1970fe62d..000000000 --- a/src/libs/7zip/unix/CPP/Windows/Window.h +++ /dev/null @@ -1,43 +0,0 @@ -// Windows/Window.h - -#ifndef __WINDOWS_WINDOW_H -#define __WINDOWS_WINDOW_H - -#include "Windows/Defs.h" -#include "Common/MyString.h" - -namespace NWindows { - -HWND GetDlgItem(HWND dialogWindow, int ControlID); -void MySetWindowText(HWND wnd, LPCWSTR s); - -class CWindow -{ -private: - // bool ModifyStyleBase(int styleOffset, DWORD remove, DWORD add, UINT flags); -protected: - HWND _window; -public: - CWindow(HWND newWindow = NULL): _window(newWindow){}; - CWindow& operator=(HWND newWindow) - { - _window = newWindow; - return *this; - } - operator HWND() const { return _window; } - void Attach(HWND newWindow) { _window = newWindow; } - HWND Detach() - { - HWND window = _window; - _window = NULL; - return window; - } - virtual void SetText(LPCWSTR s) { MySetWindowText(_window, s); } - virtual bool GetText(CSysString &s); - bool IsEnabled(); -}; - -} - -#endif - |