FileChildWindow::FileChildWindow(HWND hwnd, const FileChildWndInfo& info)
: ChildWindow(hwnd)
{
+ CONTEXT("FileChildWindow::FileChildWindow()");
+
TCHAR drv[_MAX_DRIVE+1];
Entry* entry;
void FileChildWindow::set_curdir(Entry* entry, HWND hwnd)
{
+ CONTEXT("FileChildWindow::set_curdir()");
+
_path[0] = TEXT('\0');
_left->_cur = entry;
FileChildWindow* FileChildWindow::create(HWND hmdiclient, const FileChildWndInfo& info)
{
+ CONTEXT("FileChildWindow::create()");
+
MDICREATESTRUCT mcs;
mcs.szClass = CLASSNAME_WINEFILETREE;
Pane* pane = GetFocus()==_left_hwnd? _left: _right;
switch(LOWORD(wparam)) {
- case ID_WINDOW_NEW:
+ case ID_WINDOW_NEW: {CONTEXT("PM_DISPATCH_COMMAND ID_WINDOW_NEW");
if (_root._entry->_etype == ET_SHELL)
FileChildWindow::create(GetParent(_hwnd)/*_hmdiclient*/, ShellChildWndInfo(_path,DesktopFolderPath()));
else
FileChildWindow::create(GetParent(_hwnd)/*_hmdiclient*/, FileChildWndInfo(_path));
- break;
+ break;}
- case ID_REFRESH: {
+ case ID_REFRESH: {CONTEXT("ID_REFRESH");
bool expanded = _left->_cur->_expanded;
scan_entry(_left->_cur, _hwnd);
expand_entry(_left->_cur);
break;}
- case ID_ACTIVATE:
+ case ID_ACTIVATE: {CONTEXT("ID_ACTIVATE");
activate_entry(pane, _hwnd);
- break;
+ break;}
default:
return pane->command(LOWORD(wparam));
case PM_FRM_GET_MENUINFO:
return (LPARAM)&_menu_info;
- case PM_OPEN_WINDOW: {
+ case PM_OPEN_WINDOW: {CONTEXT("PM_OPEN_WINDOW");
TCHAR buffer[MAX_PATH];
LPCTSTR path;
ShellPath shell_path = DesktopFolderPath();
path = buffer;
}
+ {
+ OBJ_CONTEXT("create ShellChildWndInfo", path);
+
// Shell Namespace as default view
ShellChildWndInfo create_info(path, shell_path);
create_info._open_mode = (OPEN_WINDOW_MODE)wparam;
// FileChildWindow::create(_hmdiclient, create_info);
- return (LRESULT)ShellBrowserChild::create(_hmdiclient, create_info);}
+ return (LRESULT)ShellBrowserChild::create(_hmdiclient, create_info);
+ }}
case PM_GET_CONTROLWINDOW:
if (wparam == FCW_STATUS)
}
-Context Context::s_main("-NO-CONTEXT-");
-Context* Context::s_current = &Context::s_main;
-
-String Context::toString() const
-{
- FmtString str(TEXT("%hs"), _ctx);
-
- if (!_obj.empty())
- str.appendf(TEXT("\nObject: %s"), (LPCTSTR)_obj);
-
- return str;
-}
-
-String Context::getStackTrace() const
-{
- // evtl. besser ostringstream verwenden
- String str = TEXT("Context Trace:\n");
-
- for(const Context*p=this; p!=&s_main; p=p->_last)
- str.appendf(TEXT("ctx=%hs obj=%s\n"), p->_ctx, (LPCTSTR)p->_obj);
-
- return str;
-}
-
-
String COMException::toString() const
{
TCHAR msg[4*BUFFER_LEN];
p += _stprintf(p, TEXT("%s\nContext: %s"), super::ErrorMessage(), (LPCTSTR)_ctx.toString());
if (_file)
- p += _stprintf(p, TEXT("\nLocation: %hs(%d)"), _file, _line);
+ p += _stprintf(p, TEXT("\nLocation: %hs:%d"), _file, _line);
return msg;
}
#include <shellapi.h>
#include <time.h>
+#include <sstream>
DWORD WINAPI Thread::ThreadProc(void* para)
}
+Context Context::s_main("-NO-CONTEXT-");
+Context* Context::s_current = &Context::s_main;
+
+String Context::toString() const
+{
+ String str = _ctx;
+
+ if (!_obj.empty())
+ str.appendf(TEXT("\nObject: %s"), (LPCTSTR)_obj);
+
+ return str;
+}
+
+String Context::getStackTrace() const
+{
+ ostringstream str;
+
+ str << "Context Trace:\n";
+
+ for(const Context*p=this; p!=&s_main; p=p->_last) {
+ str << "- " << p->_ctx;
+
+ if (!p->_obj.empty())
+ str << " obj=" << ANS(p->_obj);
+
+ str << '\n';
+ }
+
+ return str.str();
+}
+
+
BOOL time_to_filetime(const time_t* t, FILETIME* ftime)
{
struct tm* tm = gmtime(t);
#ifdef UNICODE
String(LPCSTR s) {assign(s);}
+ String(const string& other) {assign(other.c_str());}
String& operator=(LPCSTR s) {assign(s); return *this;}
void assign(LPCSTR s) {TCHAR b[BUFFER_LEN]; super::assign(b, MultiByteToWideChar(CP_ACP, 0, s, -1, b, BUFFER_LEN));}
#else
String(LPCWSTR s) {assign(s);}
+ String(const wstring& other) {assign(other.c_str());}
String& operator=(LPCWSTR s) {assign(s); return *this;}
void assign(LPCWSTR s) {char b[BUFFER_LEN]; super::assign(b, WideCharToMultiByte(CP_ACP, 0, s, -1, b, BUFFER_LEN, 0, 0));}
#endif
}
};
+
struct FmtString : public String
{
FmtString(LPCTSTR fmt, ...)
};
+#ifdef UNICODE
+
+struct ANS
+{
+ ANS(LPCWSTR s)
+ {
+ int l = wcslen(s) + 1;
+ _str = (LPSTR) malloc(2*l);
+ WideCharToMultiByte(CP_ACP, 0, s, -1, _str, 2*l, 0, 0);
+ }
+
+ ~ANS()
+ {
+ free(_str);
+ }
+
+ operator LPCSTR() {return _str;}
+
+protected:
+ LPSTR _str;
+};
+
+#define UNC(x) ((LPCWSTR)(x))
+
+#else
+
+#define ANS(x) ((LPCSTR)(x))
+
+struct UNC
+{
+ UNC(LPCSTR s)
+ {
+ int l = strlen(s) + 1;
+ _str = (LPWSTR) malloc(2*l);
+ MultiByteToWideChar(CP_ACP, 0, s, -1, _str, l);
+ }
+
+ ~UNC()
+ {
+ free(_str);
+ }
+
+ operator LPCWSTR() {return _str;}
+
+protected:
+ LPWSTR _str;
+};
+
+#endif
+
+
/// link dynamicly to functions by using GetModuleHandle() and GetProcAddress()
template<typename FCT> struct DynamicFct
{