New Exchanger v19

09/17/2019 05:22 LuciferMorningStar666#1
I was wondering where to fix the scroll bar in the NEW EXCHANGER V19

[Only registered and activated users can see links. Click Here To Register...]

My WndField.cpp
Code:
void CWndDialogEvent::SetDescription(CHAR* szChar)
{
	//Set List
	CRect rect;
	LPWNDCTRL lpWndCtrl;
#ifdef __NEW_EXCHANGE_V19

#else
	CWndListBox* pWndList = (CWndListBox*)GetDlgItem(WIDC_LISTBOX1);
	lpWndCtrl = GetWndCtrl(WIDC_LISTBOX1);
	rect = lpWndCtrl->rect;

	for (int i = 0; i < m_nListCount; i++)
	{
		pWndList->AddString(prj.GetText(m_nVecList[i]));
}
#endif

	//Set Description
	m_nDescList = prj.m_Exchange.GetDescId(m_nMMI);
	m_nDescCount = m_nDescList.size();
	if (!m_nDescCount)
		return;

	if (m_nDescCount == 1)
	{
		CWndButton* pButton = (CWndButton*)GetDlgItem(WIDC_BUTTON1);
		pButton->SetVisible(FALSE);
		pButton->EnableWindow(FALSE);
	}

	CWndText* pText = (CWndText*)GetDlgItem(WIDC_TEXT1);
	m_nCurrentPage = 0;
	pText->m_string.AddParsingString(prj.GetText(m_nDescList[m_nCurrentPage]));
	pText->ResetString();

	//Size Control
#ifndef __NEW_EXCHANGE_V19
	if (m_nListCount <= MAX_LIST_COUNT)
	{
		int nListBoxBottom = 0;
		int nListBoxHeight = 0;
		int nButtonHeight = 0;
		//ListBox
		rect.bottom = rect.top + m_nListCount * m_nGap + 10;
		nListBoxBottom = rect.bottom;
		nListBoxHeight = rect.bottom - rect.top;
		//영어 때문에 창 크기 늘임
		rect.right += 80;
		pWndList->SetWndRect(rect);
		//Window
		rect = GetWindowRect(TRUE);
		lpWndCtrl = GetWndCtrl(WIDC_TEXT1);
		CRect rectText = lpWndCtrl->rect;
		rect.bottom = rect.top + nListBoxHeight + (rectText.bottom - rectText.top) + 80;
		SetWndRect(rect);
		//Button
		CWndButton* pWndButton = (CWndButton*)GetDlgItem(WIDC_OK);
		lpWndCtrl = GetWndCtrl(WIDC_OK);
		rect = lpWndCtrl->rect;
		nButtonHeight = rect.bottom - rect.top;
		rect.top = nListBoxBottom + 8;
		rect.bottom = rect.top + nButtonHeight;
		//영어 때문에 창 크기 늘임
		rect.left += 40;
		rect.right += 40;
		pWndButton->SetWndRect(rect);

		pWndButton = (CWndButton*)GetDlgItem(WIDC_CANCEL);
		lpWndCtrl = GetWndCtrl(WIDC_CANCEL);
		rect = lpWndCtrl->rect;
		nButtonHeight = rect.bottom - rect.top;
		rect.top = nListBoxBottom + 8;
		rect.bottom = rect.top + nButtonHeight;
		//영어 때문에 창 크기 늘임
		rect.left += 40;
		rect.right += 40;
		pWndButton->SetWndRect(rect);
	}
#endif

	//영어 때문에 창 크기 늘임
	//Window
	rect = GetWindowRect(TRUE);
	rect.right += 80;
	SetWndRect(rect);

	//Button
	CWndButton* pWndButton = (CWndButton*)GetDlgItem(WIDC_BUTTON1);
	lpWndCtrl = GetWndCtrl(WIDC_BUTTON1);
	rect = lpWndCtrl->rect;
	rect.left += 80;
	rect.right += 80;
	pWndButton->SetWndRect(rect);

	//Text
	CWndText* pWndText = (CWndText*)GetDlgItem(WIDC_TEXT1);
	lpWndCtrl = GetWndCtrl(WIDC_TEXT1);
	rect = lpWndCtrl->rect;
	rect.right += 80;
	pWndText->SetWndRect(rect);
}
WndControl.cpp
Code:
void CWndListBox::OnDraw(C2DRender* p2DRender)
#ifdef __NEW_EXCHANGE_V19

		if (pWnd->GetWndId() == APP_DIALOG_EVENT)
		{
			m_nFontHeight = 35;
			int nGapX = 40;
			CPoint pt(10, 5);
			//pt.y -= m_nFontHeight * m_wndScrollBar.GetScrollPos();
			CExchange::PSETLIST pSet = prj.m_Exchange.FindExchange(((CWndDialogEvent*)pWnd)->m_nMMI);
			CTexture *pArrow = CWndBase::m_textureMng.AddTexture(p2DRender->m_pd3dDevice, MakePath("Theme\\", ::GetLanguage(), "ExchangeArrow.tga"), 0xFFFF0000);
			if (!pSet)
				return;
			unsigned nPos = m_wndScrollBar.GetScrollPos();
			unsigned nEnd = nPos + 7;
			if (nEnd > pSet->vecSet.size())
				nEnd = pSet->vecSet.size();
			if (clock() > m_clkALPHADelay)
			{
				m_nALPHAPos++;
				m_clkALPHADelay = clock() + SEC(2);
				if (m_nALPHAPos < 0)
					m_nALPHAPos = 0;
			}
			for (unsigned i = nPos; i < nEnd; ++i)
			{
				/*if( pt.y < 0 )
				{
					pt.y += m_nFontHeight;
					continue;
				}*/
				if (pt.y > GetWndRect().Height())
					break;
				if (i == m_nCurSelect)
				{
					CRect DrawRect = CRect(0, pt.y + 2, 434, pt.y + 34);
					p2DRender->RenderFillRect(DrawRect, 0xFF022202);
					p2DRender->RenderRect(DrawRect, 0xFF077707);
				}
				for (unsigned j = 0; j < pSet->vecSet[i].vecCondItem.size(); j++)
				{
					ItemProp *pPropItem = prj.GetItemProp(pSet->vecSet[i].vecCondItem[j].dwItemId);
					if (pPropItem)
					{
						CTexture *pTex = CWndBase::m_textureMng.AddTexture(p2DRender->m_pd3dDevice, MakePath(DIR_ITEM, pPropItem->szIcon), 0xffff00ff);
						DWORD dwBlend = 255;
						if (g_pPlayer->m_Inventory.GetItemCount(pPropItem->dwID) < (DWORD)pSet->vecSet[i].vecCondItem[j].nItemNum)
							dwBlend = 60;
						if (pTex)
							pTex->Render(p2DRender, CPoint(pt.x, pt.y + 2), dwBlend);

						TCHAR szTemp[32];
						_stprintf(szTemp, "%d", pSet->vecSet[i].vecCondItem[j].nItemNum);
						CD3DFont* pOldFont = p2DRender->GetFont();
						p2DRender->SetFont(CWndBase::m_Theme.m_pFontWndTitle);
						CSize size = m_p2DRender->m_pFont->GetTextExtent(szTemp);
						m_p2DRender->TextOut(pt.x + 30 - size.cx, pt.y + 32 - size.cy + 4, szTemp, 0xFF000000);
						m_p2DRender->TextOut(pt.x + 29 - size.cx, pt.y + 31 - size.cy + 4, szTemp, 0xFF85FF8A);
						p2DRender->SetFont(pOldFont);

						CRect rectTT = CRect(pt.x, pt.y, pt.x + 32, pt.y + 32);
						if (rectTT.PtInRect(m_ptMouse))
						{
							CItemElem elem;
							CPoint pt2 = m_ptMouse;
							ClientToScreen(&pt2);
							ClientToScreen(&rectTT);
							elem.m_dwItemId = pSet->vecSet[i].vecCondItem[j].dwItemId;
							elem.m_byFlag = pSet->vecSet[i].vecCondItem[j].byFalg;
							g_WndMng.PutToolTip_Item(&elem, pt2, &rectTT);
						}

						pt.x += nGapX;
					}
				}
				pArrow->Render(p2DRender, pt);
				pt.x += nGapX;
				int nALPHA = m_nALPHAPos % pSet->vecSet[i].vecPayItem.size();
				for (unsigned j = 0; j < pSet->vecSet[i].vecPayItem.size(); j++)
				{
					ItemProp *pPropItem = prj.GetItemProp(pSet->vecSet[i].vecPayItem[j].dwItemId);
					if (pPropItem)
					{
						CTexture *pTex = CWndBase::m_textureMng.AddTexture(p2DRender->m_pd3dDevice, MakePath(DIR_ITEM, pPropItem->szIcon), 0xffff00ff);
						DWORD dwBlend = 60;
						if (j == nALPHA)
							dwBlend = 255;
						//if( g_pPlayer->m_Inventory.GetCount(pPropItem->dwID) <= 0 )
						//	dwBlend = 155;
						if (pTex)
							pTex->Render(p2DRender, CPoint(pt.x, pt.y + 2), dwBlend);

						TCHAR szTemp[32];
						_stprintf(szTemp, "%d", pSet->vecSet[i].vecPayItem[j].nItemNum);
						CD3DFont* pOldFont = p2DRender->GetFont();
						p2DRender->SetFont(CWndBase::m_Theme.m_pFontWndTitle);
						CSize size = m_p2DRender->m_pFont->GetTextExtent(szTemp);
						m_p2DRender->TextOut(pt.x + 30 - size.cx, pt.y + 30 - size.cy + 4, szTemp, 0xFF000000);
						m_p2DRender->TextOut(pt.x + 29 - size.cx, pt.y + 29 - size.cy + 4, szTemp, 0xFF85FF8A);
						p2DRender->SetFont(pOldFont);

						CRect rectTT = CRect(pt.x, pt.y, pt.x + 32, pt.y + 32);
						if (rectTT.PtInRect(m_ptMouse))
						{
							CItemElem elem;
							CPoint pt2 = m_ptMouse;
							ClientToScreen(&pt2);
							ClientToScreen(&rectTT);
							elem.m_dwItemId = pSet->vecSet[i].vecPayItem[j].dwItemId;
							elem.m_byFlag = pSet->vecSet[i].vecPayItem[j].byFalg;
							g_WndMng.PutToolTip_Item(&elem, pt2, &rectTT);
						}

						pt.x += nGapX;
					}
				}
				pt.x = 10;
				pt.y += m_nFontHeight + 1;

				//p2DRender->RenderLine(CPoint(0,pt.y),CPoint(GetWindowRect().Width()-10,pt.y),0xFF776655);
			}
			int nRange = pSet->vecSet.size();
			int nPage = GetClientRect().Height() / m_nFontHeight;
			if (IsWndStyle(WBS_VSCROLL))
			{
				m_wndScrollBar.SetVisible(TRUE);
				m_wndScrollBar.SetScrollRange(0, nRange);
				m_wndScrollBar.SetScrollPage(nPage);
			}
			else
				m_wndScrollBar.SetVisible(FALSE);
		}
		else
#endif
		m_nFontHeight = GetFontHeight() + m_nLineSpace;
	{
		CPoint pt(3, 3);
		pt.y -= m_nFontHeight * m_wndScrollBar.GetScrollPos();
		PaintListBox(p2DRender, pt, m_listItemArray);

		int nPage = GetClientRect().Height() / m_nFontHeight;
		int nRange = m_listItemArray.GetSize();
		if (IsWndStyle(WBS_VSCROLL))
		{
			m_wndScrollBar.SetVisible(TRUE);
			m_wndScrollBar.SetScrollRange(0, nRange);
			m_wndScrollBar.SetScrollPage(nPage);
		}
		else
			m_wndScrollBar.SetVisible(FALSE);
	}
}
Code:
void CWndListBox::OnLButtonUp(UINT nFlags, CPoint point)
{
	CWndBase* pWnd = GetParentWnd();
#ifdef __NEW_EXCHANGE_V19
	if (pWnd->GetWndId() == APP_DIALOG_EVENT)
	{
		CPoint pt(0, 3);
		CExchange::PSETLIST pSet = prj.m_Exchange.FindExchange(((CWndDialogEvent*)pWnd)->m_nMMI);
		unsigned nPos = m_wndScrollBar.GetScrollPos();
		unsigned nEnd = nPos + 7;
		if (!pSet)
			return;
		if (nEnd > pSet->vecSet.size())
			nEnd = pSet->vecSet.size();
		for (unsigned i = nPos; i < nEnd; ++i)
		{
			CRect DrawRect = CRect(0, pt.y, GetWindowRect().Width(), pt.y + m_nFontHeight);
			if (DrawRect.PtInRect(point))
			{
				m_nCurSelect = i;
				CWndBase* pWnd = m_pParentWnd;
				pWnd->OnChildNotify(WNM_SELCHANGE, m_nIdWnd, NULL);
				break;
			}
			pt.y += m_nFontHeight;
		}
	}
	else
#endif
	{
		CPoint pt(3, 3);
		pt.y -= m_nFontHeight * m_wndScrollBar.GetScrollPos();
		CRect rect;
		LPLISTITEM pListItem;
		for (int i = 0; i < m_listItemArray.GetSize(); i++)
		{
			pListItem = (LPLISTITEM)m_listItemArray.GetAt(i);
#if __VER >= 15 // __IMPROVE_QUEST_INTERFACE
			if (pListItem->m_bIsValid == FALSE)
			{
				pt.y += m_nFontHeight;
				continue;
			}
#endif // __IMPROVE_QUEST_INTERFACE
			int nScrollBarWidth = IsWndStyle(WBS_VSCROLL) ? m_wndScrollBar.GetClientRect().Width() : 0;
			rect.SetRect(pt.x, pt.y, pt.x + m_rectWindow.Width() - nScrollBarWidth, pt.y + m_nFontHeight);
			if (rect.PtInRect(point))
			{
				if (m_pFocusItem == pListItem)
				{
					// 부모가 차일드 윈도가 아니어야 OnCommand 메시지를 받는다.
					CWndBase* pWnd = m_pParentWnd;
					pWnd->OnChildNotify(WNM_SELCHANGE, m_nIdWnd, (LRESULT*)pListItem);
					return;
				}
			}
			pt.y += m_nFontHeight;
		}
	}
}
Code:
void CWndListBox::OnLButtonDown(UINT nFlags, CPoint point)
{
	CPoint pt(3, 3);
#ifdef __NEW_EXCHANGE_V19
	CWndBase* pWnd = GetParentWnd();
	if (pWnd->GetWndId() == APP_DIALOG_EVENT)
	{
		CPoint pt(0, 3);
		CExchange::PSETLIST pSet = prj.m_Exchange.FindExchange(((CWndDialogEvent*)pWnd)->m_nMMI);
		unsigned nPos = m_wndScrollBar.GetScrollPos();
		unsigned nEnd = nPos + 7;
		if (!pSet)
			return;
		if (nEnd > pSet->vecSet.size())
			nEnd = pSet->vecSet.size();
		for (unsigned i = nPos; i < nEnd; ++i)
		{
			CRect DrawRect = CRect(0, pt.y, GetWindowRect().Width(), pt.y + m_nFontHeight);
			if (DrawRect.PtInRect(point))
			{
				m_nCurSelect = i;
				break;
			}
			pt.y += m_nFontHeight;
		}
	}
	else
#endif
	{
		pt.y -= m_nFontHeight * m_wndScrollBar.GetScrollPos();
		CRect rect;
		LPLISTITEM pListItem;
		for (int i = 0; i < m_listItemArray.GetSize(); i++)
		{
			pListItem = (LPLISTITEM)m_listItemArray.GetAt(i);
#if __VER >= 15 // __IMPROVE_QUEST_INTERFACE
			if (pListItem->m_bIsValid == FALSE)
			{
				pt.y += m_nFontHeight;
				continue;
			}
#endif // __IMPROVE_QUEST_INTERFACE
			int nScrollBarWidth = IsWndStyle(WBS_VSCROLL) ? m_wndScrollBar.GetClientRect().Width() : 0;
			rect.SetRect(pt.x, pt.y, pt.x + m_rectWindow.Width() - nScrollBarWidth, pt.y + m_nFontHeight);
			if (rect.PtInRect(point))
			{
				m_nCurSelect = i;
				m_pFocusItem = pListItem;
			}
			pt.y += m_nFontHeight;
		}
	}
}
Any hints? Thank you..
09/17/2019 23:01 -Valor#2
Enable scrollbar with GUIEditor
09/18/2019 03:42 LuciferMorningStar666#3
Quote:
Originally Posted by -Valor View Post
Enable scrollbar with GUIEditor
Nope not working. Any tips? Thanks
09/19/2019 04:33 Nιgнтмαяε#4
Replace APP_DIALOG_EVENT in your resData.inc with the one from retail.