static LRESULT CALLBACK IEViewServerWindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
    IEView *view = IEView::get(GetParent(GetParent(hwnd)));
	if (view != NULL) {
		switch (message) {
		case WM_KEYDOWN:
			view->translateAccelerator(message, wParam, lParam);
		   	break;
		case WM_SETFOCUS:
			if (view->setFocus((HWND)wParam)) {
				return TRUE;
			}
			break;
		case WM_LBUTTONDOWN:
		    POINT pt;
		    pt.x = LOWORD(lParam);
		    pt.y = HIWORD(lParam);
	   		if (view->mouseClick(pt)) {
	   		    return TRUE;
       		}
		    break;
		}
		return CallWindowProc(view->getUserWndProc(), hwnd, message, wParam, lParam);
    }
    return DefWindowProc (hwnd, message, wParam, lParam);
}
int HandleIEWindow(WPARAM wParam, LPARAM lParam) {
	IEVIEWWINDOW *window = (IEVIEWWINDOW *) lParam;
	IEView::init();
	Options::init();
	if (window->iType == IEW_CREATE) {
		HTMLBuilder *builder;
		if (Options::getTemplatesFlags() & Options::TEMPLATES_ENABLED) {
            builder = new TemplateHTMLBuilder();
		} else {
			if (window->dwMode == IEWM_TABSRMM) {
				builder = new TabSRMMHTMLBuilder();
			} else if (window->dwMode == IEWM_SCRIVER) {
				builder = new ScriverHTMLBuilder();
			} else {
				builder = new SRMMHTMLBuilder();
			}
		}
		IEView * view = new IEView(window->parent, builder, window->x, window->y, window->cx, window->cy);
		window->hwnd = view->getHWND();
	} else if (window->iType == IEW_SETPOS) {
		IEView * view = IEView::get(window->hwnd);
		if (view!=NULL) {
			view->setWindowPos(window->x, window->y, window->cx,window->cy);
		}
	} else if (window->iType == IEW_DESTROY) {
		IEView * view = IEView::get(window->hwnd);
		if (view!=NULL) {
			delete view;
		}
	}
	return 0;
}
INT_PTR HandleIENavigate(WPARAM, LPARAM lParam)
{
	IEVIEWNAVIGATE *navigate = (IEVIEWNAVIGATE *)lParam;
	Options::init();
	IEView *view = IEView::get(navigate->hwnd);
	if (view != NULL) {
		if (navigate->iType == IEN_NAVIGATE) {
			view->navigate(navigate);
		}
	}
	return 0;
}
static LRESULT CALLBACK IEViewWindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
   	IEView *view = IEView::get(hwnd);
   	if (view!=NULL) {
		WNDPROC oldWndProc = view->getUserWndProc();
    	if (message == WM_PARENTNOTIFY && wParam == WM_CREATE) {
			SetWindowLong(hwnd, GWL_WNDPROC, (LONG) oldWndProc);
			view->setUserWndProc((WNDPROC) SetWindowLong((HWND)lParam, GWL_WNDPROC, (LONG) IEViewDocWindowProcedure));
		}
		return CallWindowProc(oldWndProc, hwnd, message, wParam, lParam);
    }
    return DefWindowProc (hwnd, message, wParam, lParam);
}
int HandleIEEvent(WPARAM wParam, LPARAM lParam) {
	IEVIEWEVENT *event = (IEVIEWEVENT *) lParam;
	IEView * view = IEView::get(event->hwnd);
	IEView::init();
	Options::init();
	if (view != NULL) {
		if (event->iType == IEE_LOG_EVENTS) {
			view->appendEvent(event);
		} else if (event->iType == IEE_CLEAR_LOG) {
			view->clear(event);
		} else if (event->iType == IEE_GET_SELECTION) {
			return (int)view->getSelection(event);
		} else if (event->iType == IEE_SAVE_DOCUMENT) {
			view->saveDocument();
		}
	}
	return 0;
}
INT_PTR HandleIEWindow(WPARAM, LPARAM lParam)
{
	IEVIEWWINDOW *window = (IEVIEWWINDOW *)lParam;
	Options::init();
	if (window->iType == IEW_CREATE) {
		HTMLBuilder *builder = NULL;
		switch (window->dwMode) {
		case IEWM_MUCC:
			builder = new MUCCHTMLBuilder();
			break;
		case IEWM_CHAT:
			builder = new ChatHTMLBuilder();
			break;
		case IEWM_TABSRMM:
			builder = new TabSRMMHTMLBuilder();
			break;
		case IEWM_SCRIVER:
			builder = new ScriverHTMLBuilder();
			break;
		case IEWM_HISTORY:
			builder = new HistoryHTMLBuilder();
			break;
		case IEWM_BROWSER:
			builder = NULL;
			break;
		default:
			builder = new ScriverHTMLBuilder();
			break;
		}
		IEView *view = new IEView(window->parent, builder, window->x, window->y, window->cx, window->cy);
		window->hwnd = view->getHWND();
	}
	else if (window->iType == IEW_SETPOS) {
		IEView *view = IEView::get(window->hwnd);
		if (view != NULL)
			view->setWindowPos(window->x, window->y, window->cx, window->cy);
	}
	else if (window->iType == IEW_SCROLLBOTTOM) {
		IEView *view = IEView::get(window->hwnd);
		if (view != NULL)
			view->scrollToBottom();
	}
	else if (window->iType == IEW_DESTROY) {
		IEView *view = IEView::get(window->hwnd);
		if (view != NULL)
			delete view;
	}
	return 0;
}
static LRESULT CALLBACK IEViewServerWindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
    IEView *view = IEView::get(GetParent(GetParent(hwnd)));
	if (view != NULL) {
		switch (message) {
		case WM_KEYUP:
			if (LOWORD(wParam) == VK_ESCAPE && !(GetKeyState(VK_SHIFT) & 0x8000)
			&& !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_MENU) & 0x8000)) {
				//if (view->getBuilder() != NULL) {
					SendMessage(GetParent(GetParent(GetParent(hwnd))), WM_COMMAND, IDCANCEL, 0);
//				} else {

	//			}
			}
			break;
		case WM_KEYDOWN:
			view->translateAccelerator(message, wParam, lParam);
		   	break;
		case WM_SETFOCUS:
			{
				RECT rcWindow;
				POINT cursor;
				GetWindowRect(hwnd, &rcWindow);
				GetCursorPos(&cursor);
				if (cursor.y > rcWindow.bottom || cursor.y < rcWindow.top ||
					cursor.x > rcWindow.right || cursor.x < rcWindow.left) {
				} else {
					view->mouseActivate();
				}
				if (view->setFocus((HWND)wParam)) {
					return TRUE;
				}
			}
			break;
		case WM_LBUTTONDOWN:
		    POINT pt;
		    pt.x = LOWORD(lParam);
		    pt.y = HIWORD(lParam);
	   		if (view->mouseClick(pt)) {
	   		    return TRUE;
       		}
		    break;
		}
		return CallWindowProc(view->getServerWndProc(), hwnd, message, wParam, lParam);
    }
    return DefWindowProc (hwnd, message, wParam, lParam);
}
INT_PTR HandleIEEvent(WPARAM, LPARAM lParam)
{
	IEVIEWEVENT *event = (IEVIEWEVENT *)lParam;
	Options::init();
	IEView *view = IEView::get(event->hwnd);
	if (view != NULL) {
		if (event->iType == IEE_LOG_DB_EVENTS)
			view->appendEventOld(event);
		else if (event->iType == IEE_CLEAR_LOG)
			view->clear(event);
		else if (event->iType == IEE_GET_SELECTION)
			return (INT_PTR)view->getSelection(event);
		else if (event->iType == IEE_SAVE_DOCUMENT)
			view->saveDocument();
		else if (event->iType == IEE_LOG_MEM_EVENTS)
			view->appendEvent(event);
	}
	return 0;
}
Exemple #9
0
static void __cdecl StartThread(void *vptr)
{
	IEView *iev = (IEView *) vptr;
	iev->waitWhileBusy();
	return;
}