diff --git a/bazaar/Controls4U/ActiveX.cpp b/bazaar/Controls4U/ActiveX.cpp index c10445fa9..ef88932ee 100644 --- a/bazaar/Controls4U/ActiveX.cpp +++ b/bazaar/Controls4U/ActiveX.cpp @@ -42,26 +42,42 @@ bool CBSTR::Set(const String str) { return BSTRSet(str, bstr); } -DHCtrlActiveX::DHCtrlActiveX(CLSID clsid, const String name) : oleObj(0), pClientSite(0), clsid(clsid), name(name) {} +DHCtrlActiveX::DHCtrlActiveX(CLSID clsid, const String name, bool status) : + oleObj(0), pClientSite(0), clsid(clsid), name(name), status(status) {} DHCtrlActiveX::~DHCtrlActiveX(void) { Detach(); } - + +DHCtrlActiveX &DHCtrlActiveX::SetStatus(bool _status) { + status = _status; + if (status) { + Attach(GetHWND()); + EnableWindow(GetHWND(), true); + BackPaint(NOBACKPAINT); + } else { + Detach(); + BackPaint(FULLBACKPAINT); + } + return *this; +}; + LRESULT DHCtrlActiveX::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { - switch (message) { - case WM_SIZE: DoResize(); - break; - case WM_CREATE: Attach(GetHWND()); - EnableWindow(GetHWND(), true); - break; + if (status) { + switch (message) { + case WM_SIZE: DoResize(); + break; + case WM_CREATE: Attach(GetHWND()); + EnableWindow(GetHWND(), true); + break; + } } return DHCtrl::WindowProc(message, wParam, lParam); } void *DHCtrlActiveX::QueryInterface(const IID iid) { void *ret; - if (!oleObj) + if (!oleObj || !status) return NULL; if (S_OK != oleObj->QueryInterface(iid, &ret)) return NULL; @@ -76,12 +92,13 @@ void DHCtrlActiveX::Detach() { oleObj->Close(OLECLOSE_NOSAVE); oleObj->Release(); + oleObj = 0; } void DHCtrlActiveX::DoResize() { if(!pClientSite.hwnd) return; - if (!oleObj) + if (!oleObj || !status) return; RECT rect; @@ -95,7 +112,7 @@ void DHCtrlActiveX::DoResize() { } bool DHCtrlActiveX::Attach(HWND hwnd) { - if (hwnd == (HWND)-1 || hwnd == 0) + if (hwnd == (HWND)-1 || hwnd == 0 || !status) return false; if(pClientSite.hwnd && pClientSite.hwnd != hwnd) Detach(); diff --git a/bazaar/Controls4U/ActiveX.h b/bazaar/Controls4U/ActiveX.h index ae7b1c879..ba3b6227d 100644 --- a/bazaar/Controls4U/ActiveX.h +++ b/bazaar/Controls4U/ActiveX.h @@ -20,7 +20,7 @@ static const CLSID CLSID_MozillaBrowser = {0x1339B54C, 0x3453, 0x11D2, {0x93, 0x class FirefoxBrowser : public DHCtrlActiveX { public: - FirefoxBrowser() : DHCtrlActiveX(CLSID_MozillaBrowser, "Firefox") {}; + FirefoxBrowser(bool status = true) : DHCtrlActiveX(CLSID_MozillaBrowser, "Firefox", status) {}; bool Browse(const String &url); bool ShowHTML(const String &html); @@ -38,10 +38,14 @@ private: class IIWebBrowser { public: IIWebBrowser(FirefoxBrowser *obj) { - web = (IWebBrowser2 *)obj->QueryInterface(IID_IWebBrowser2); + if (obj->GetStatus()) + web = (IWebBrowser2 *)obj->QueryInterface(IID_IWebBrowser2); + else + web = 0; } ~IIWebBrowser() { - web->Release(); + if (web) + web->Release(); } operator IWebBrowser2 *() {return web;} IWebBrowser2 * operator ->() {return web;} @@ -52,7 +56,7 @@ private: class IExplorerBrowser : public DHCtrlActiveX { public: - IExplorerBrowser() : DHCtrlActiveX(CLSID_WebBrowser, "IExplorer") {}; + IExplorerBrowser(bool status = true) : DHCtrlActiveX(CLSID_WebBrowser, "IExplorer", status) {}; bool Browse(const String &url); bool ShowHTML(const String &html); @@ -70,10 +74,14 @@ private: class IIWebBrowser { public: IIWebBrowser(IExplorerBrowser *obj) { - web = (IWebBrowser2 *)obj->QueryInterface(IID_IWebBrowser2); + if (obj->GetStatus()) + web = (IWebBrowser2 *)obj->QueryInterface(IID_IWebBrowser2); + else + web = 0; } ~IIWebBrowser() { - web->Release(); + if (web) + web->Release(); } operator IWebBrowser2 *() {return web;} IWebBrowser2 * operator ->() {return web;} @@ -87,7 +95,7 @@ static const CLSID CLSID_VLCPLayer = {0x9BE31822, 0xFDAD, 0x461B, {0xAD, 0x51, 0 class VLCPlayer : public DHCtrlActiveX { public: - VLCPlayer() : DHCtrlActiveX(CLSID_VLCPLayer, "VLCPlayer") {}; + VLCPlayer(bool status = true) : DHCtrlActiveX(CLSID_VLCPLayer, "VLCPlayer", status) {}; bool AddTarget(const String movie); bool Play(); @@ -109,10 +117,14 @@ private: class IIVLC { public: IIVLC(VLCPlayer *obj) { - vlc = (IVLCControl *)obj->QueryInterface(IID_IVLCControl); + if (obj->GetStatus()) + vlc = (IVLCControl *)obj->QueryInterface(IID_IVLCControl); + else + vlc = 0; } ~IIVLC() { - vlc->Release(); + if (vlc) + vlc->Release(); } operator IVLCControl *() {return vlc;} IVLCControl * operator ->() {return vlc;} @@ -122,4 +134,4 @@ private: }; -#endif \ No newline at end of file +#endif diff --git a/bazaar/Controls4U/ActiveX_base.h b/bazaar/Controls4U/ActiveX_base.h index fd32ec7d3..bd45c983b 100644 --- a/bazaar/Controls4U/ActiveX_base.h +++ b/bazaar/Controls4U/ActiveX_base.h @@ -92,12 +92,14 @@ public: class DHCtrlActiveX : public DHCtrl { public: - DHCtrlActiveX(CLSID, const String); + DHCtrlActiveX(CLSID, const String, bool status = true); ~DHCtrlActiveX(void); bool Attach(HWND hwnd); void *QueryInterface(const IID iid); bool IsLoaded() {return oleObj != NULL;} + DHCtrlActiveX &SetStatus(bool _status); + bool GetStatus() {return status;}; protected: void Detach(); @@ -111,6 +113,7 @@ private: CLSID clsid; String name; IOleObject *oleObj; + bool status; }; diff --git a/bazaar/Controls4U/Controls4U.cpp b/bazaar/Controls4U/Controls4U.cpp index 6bce17b7c..5bca9d846 100644 --- a/bazaar/Controls4U/Controls4U.cpp +++ b/bazaar/Controls4U/Controls4U.cpp @@ -1129,13 +1129,17 @@ FileBrowser::FileBrowser() { files.AddColumn(t_("Name")).Add(3).Margin(2).Edit(textFileName)./*SetDisplay(Single()).*/HeaderTab().Min(50).WhenAction = THISBACK1(SortByColumn, 0); files.AddColumn(t_("Size")).HeaderTab().Min(50).WhenAction = THISBACK1(SortByColumn, 1); files.AddColumn(t_("Date")).HeaderTab().Min(50).WhenAction = THISBACK1(SortByColumn, 2); + files.AddColumn("IsFolder"); + files.AddColumn("RealSize"); + files.HeaderObject().ShowTab(3, false); + //files.HeaderObject().ShowTab(4, false); files.MultiSelect().HeaderObject().Absolute().Clipboard(); files.BackPaintHint(); files.AddIndex(); files.VertGrid(false).HorzGrid(false); files.SetLineCy((int)(0.85*EditString::GetStdHeight())); files.HeaderTab(0).SetRatio(10); - files.ColumnWidths("200 50 110"); + files.ColumnWidths("200 60 120"); files.EvenRowColor(Blend(SColorMark, SColorPaper, 240)); // files.SetLabel(&label); @@ -1199,7 +1203,7 @@ void FileBrowser::ListFiles(String folderName, bool &thereIsAFolder) { if (fileData.GetCount() == 0) { int cy = files.GetLineCy(); Image img = Rescale(CtrlImg::information(), cy, cy); - files.Add(t_("No files or access not permitted"), "", "", img); + files.Add(t_("No files or access not permitted"), "", "", img, false, 0); files.SetDisplay(0, 0, pd); return; } @@ -1212,9 +1216,12 @@ void FileBrowser::ListFiles(String folderName, bool &thereIsAFolder) { bool isFolder = fileData[i].isFolder; if (isFolder) - thereIsAFolder = true; - files.Add(fullFilename, isFolder ? 0 : fileData[i].length, fileData[i].t, - NativePathIconX(fullFilename, DirectoryExistsX(fullFilename, fileFlags), fileFlags)); + thereIsAFolder = true; + files.Add(fullFilename, + isFolder ? "" : BytesToString(fileData[i].length), + fileData[i].t, + NativePathIconX(fullFilename, DirectoryExistsX(fullFilename, fileFlags), fileFlags), + isFolder ? fileName : "ZZZZZ" + fileName, fileData[i].length); files.SetDisplay(files.GetCount() - 1, 0, pd); } } @@ -1300,17 +1307,44 @@ void FileBrowser::FolderChanged() { void FileBrowser::FilesEnterRow() { int i = 1; } +/* +int StdValueCompare(const Value& a, const Value& b, int language) +{ + LTIMING("StdValueCompare"); + bool na = IsNull(a), nb = IsNull(b); + if(na || nb) + return !na ? 1 : !nb ? -1 : 0; + dword ta = a.GetType(), tb = b.GetType(); + if((ta == INT_V || ta == BOOL_V) && (tb == INT_V || tb == BOOL_V)) + return cmp(a, b); + if((ta == BOOL_V || ta == INT_V || ta == INT64_V || ta == DOUBLE_V) + && (tb == BOOL_V || tb == INT_V || tb == INT64_V || tb == DOUBLE_V)) + return cmp(a, b); + if(ta == DATE_V && tb == DATE_V) + return cmp(a, b); + if((ta == DATE_V || ta == TIME_V) && (tb == DATE_V || tb == TIME_V)) + return cmp