void CGumpSliderPropertyPage::ApplyValues()
{
	if (GetSafeHwnd() && GetEntity())
	{
		UpdateData();

		CGumpEditorDoc* pDoc = GfxGetGumpDocument();
		CGumpSlider* pSlider= dynamic_cast<CGumpSlider*>(GetEntity()); ASSERT(pSlider);
		if (!pSlider) return;

		int iTrackID = GfxAtoX(m_strTrackID);
		int iThumbID = GfxAtoX(m_strThumbID);

		CGumpPtr pTrack, pThumb, pGump;
		pSlider->GetGump(pTrack, pThumb);

		if (pTrack->GetGumpID() != iTrackID  && (pGump = pDoc->GetGump(iTrackID))) 
		{
			pSlider->SetGump(CGumpSlider::TRACK, pGump);
		}
		if (pThumb->GetGumpID() != iThumbID  && (pGump = pDoc->GetGump(iThumbID))) 
		{
			pSlider->SetGump(CGumpSlider::THUMB, pGump);
		}

		pSlider->SetRange(m_iMin, m_iMax);
		pSlider->SetPos(m_iPos);
		pSlider->SetVertical(m_bVertical);

		Redraw();
	}
}
void CGumpCheckboxPropertyPage::ApplyValues()
{
    if (GetSafeHwnd() && GetEntity())
    {
        UpdateData();

        CGumpEditorDoc* pDoc = GfxGetGumpDocument();
        ASSERT(pDoc);
        CGumpCheckbox* pCheckbox = (CGumpCheckbox*)GetEntity();

        pCheckbox->SetCheck(m_bChecked);

        int iNormalID =GfxAtoX(m_strNormalID);
        int iCheckedID  =GfxAtoX(m_strCheckedID);

        CGumpPtr pNormal, pChecked, pPressed, pGump;
        pCheckbox->GetGump(pNormal, pChecked);

        if (pNormal->GetGumpID() != iNormalID
                && (pGump = pDoc->GetGump(iNormalID)))
        {
            pCheckbox->SetGump(CGumpCheckbox::NORMAL, pGump);
            m_btnTest.SetGump(CHoverButton::NORMAL, pGump);
        }
        if (pChecked->GetGumpID() != iCheckedID
                && (pGump = pDoc->GetGump(iCheckedID)))
        {
            pCheckbox->SetGump(CGumpCheckbox::CHECKED, pGump);
            m_btnTest.SetGump(CHoverButton::PRESSED, pGump);
        }

        Redraw();
    }
}
void CGumpScrollbarPropertyPage::ApplyValues()
{
	if (GetSafeHwnd() && GetEntity())
	{
		UpdateData();

		CGumpEditorDoc* pDoc = GfxGetGumpDocument();
		CGumpScrollbar* pScrollbar = dynamic_cast<CGumpScrollbar*>(GetEntity()); ASSERT(pScrollbar);
		if (!pScrollbar) return;

		CGumpPtr pGump;

		int iGumpID1 = -1, iGumpID2 = -1;
		for (int i = 0; i < NUM_PART; i++) {
			iGumpID1 = GfxAtoX(m_strGumpID[i]);
			iGumpID2 = pScrollbar->GetGumpID(CGumpScrollbar::PART(i));

			if (iGumpID1 != iGumpID2  && (pGump = pDoc->GetGump(iGumpID1))) 
				pScrollbar->SetGump(CGumpScrollbar::PART(i), pGump);
		}
		
		pScrollbar->SetRange(m_iMin, m_iMax);
		pScrollbar->SetPos(m_iPos);
		pScrollbar->SetVertical(m_bVertical);
		pScrollbar->SetUseArrowButton(m_bUseArrow);

		Redraw();
	}
}
int CNumSpinCtrl::GetPos(void)
{
	CWnd* pEdit = GetBuddy();
	if (!pEdit) return 0;
	
	CString str;
	pEdit->GetWindowText(str);
	
	return GfxAtoX(str);
}
void CGumpButtonPropertyPage::ApplyValues()
{
	if( GetSafeHwnd() && GetEntity() )
	{
		UpdateData();

		CGumpEditorDoc* pDoc = GfxGetGumpDocument();
		CGumpButton* pButton = (CGumpButton*)GetEntity();

		int iNormalID =GfxAtoX(m_strNormalID);
		int iHoverID  =GfxAtoX(m_strHoverID);
		int iPressedID=GfxAtoX(m_strPressedID);

		CGumpPtr pNormal, pHover, pPressed, pGump;
		pButton->GetGump(pNormal, pHover, pPressed);

		if (pNormal->GetGumpID() != iNormalID 
			&& (pGump = pDoc->LoadGump(iNormalID))) 
		{
			pButton->SetGump(CGumpButton::NORMAL, pGump);
			m_btnTest.SetGump(CHoverButton::NORMAL, pGump);
		}
		if (pHover->GetGumpID() != iHoverID
			&& (pGump = pDoc->LoadGump(iHoverID))) 
		{
			pButton->SetGump(CGumpButton::HOVER, pGump);
			m_btnTest.SetGump(CHoverButton::HOVER, pGump);
		}
		if (pPressed->GetGumpID() != iPressedID
			&& (pGump = pDoc->LoadGump(iPressedID))) 
		{
			pButton->SetGump(CGumpButton::PRESSED, pGump);
			m_btnTest.SetGump(CHoverButton::PRESSED, pGump);
		}


		Redraw();
	}
}
示例#6
0
BOOL CGumpPicture::FromString( XML::Node* node )
{
	if (!CGumpEntity::FromString(node)) return FALSE;
	
	int gump=0;
	XML::Node* gump_node = node->findNode("gump");
	if (gump_node) 
		gump = GfxAtoX(gump_node->asString().c_str()); 
	
	ASSERT(GfxGetGumpDocument());
	SetGump(GfxGetGumpDocument()->LoadGump(gump),false);
	
	return TRUE;
}
void CGumpBorderPropertyPage::ApplyValues()
{
	if (GetSafeHwnd() && GetEntity())
	{
		UpdateData();
		CGumpBorder* pBorder = (CGumpBorder*)GetEntity();
		CGumpEditorDoc* pDoc = GfxGetGumpDocument();
		int iGumpID = GfxAtoX(m_strGumpID);

		if (pBorder->GetGumpID() != iGumpID) {	
			CGumpPtr pGump = pDoc->GetGump(iGumpID);
			if (!pGump) return;
			pBorder->SetGump(pGump);
		}
					
		Redraw();
	
	}	
}
示例#8
0
BOOL CToolBarWithCombo::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	if( wParam == IDOK && lParam == 0 )
	{
		CString strText;
		CString strCommand;
		CComboBox* rgComboBox[] = {&m_comboBox1};
		for( int index = 0; index < sizeof(rgComboBox) / sizeof(rgComboBox[0]); ++index )
		{
			if( rgComboBox[index]->GetEditSel() != 0 )
			{
				rgComboBox[index]->GetWindowText(strText);
				rgComboBox[index]->AddString(strText);
				//rgComboBox[index]->SetWindowText(_T(""));

				GfxGetGumpDocument()->SelectGumpList(GfxAtoX(strText));
			}
		}
	}
	
	return CToolBar::OnCommand(wParam, lParam);
}
bool CGumpListView::LoadGumpDesc(LPCTSTR szDescFile)
{
	CStdioFile file;
	if (!file.Open(szDescFile, CFile::modeRead | CFile::typeText))
		return false;

	int len = 0, pos = 0;
	CString str, id;
	std::string desc;
	while (file.ReadString(str)) {
		pos = str.Find(_T('='));
		if (pos < 0) continue;
		id = str.Left(pos).Trim();
		desc = str.Mid(pos+1).Trim();

		// comments
		if (id.Left(1) == "#" || id.IsEmpty() || desc.empty()) continue; 

		m_mapGumpDesc[GfxAtoX(id)] = desc;
	}

	file.Close();
}
void CGumpPicturePropertyPage::ApplyValues()
{
	if (GetSafeHwnd() && GetEntity())
	{
		UpdateData();
		CGumpPicture* pPicture = dynamic_cast<CGumpPicture*>(GetEntity());
		if (!pPicture) return;

		bool bRedraw = false;
		int iGumpID = GfxAtoX(m_strGumpID);
		DWORD hueId = m_btnColor.GetHueId();

		if (pPicture->GetGumpID() != iGumpID) 
		{	
			ASSERT(GfxGetGumpDocument());
			CGumpPtr pGump = GfxGetGumpDocument()->GetGump(iGumpID);
			if (!pGump) return;
			pPicture->SetGump(pGump);
			bRedraw = CGumpPicture::GUMP == m_iType;
		} 

		if (pPicture->GetPictureType() != m_iType)
		{
			pPicture->SetPictureType((CGumpPicture::TYPE)m_iType);
			bRedraw = CGumpPicture::GUMP != m_iType;
		}

		if (pPicture->GetHueId() != hueId && m_iType)
		{
			pPicture->SetHueId(hueId);
			bRedraw = CGumpPicture::GUMP != m_iType;
		}

		if (bRedraw) Redraw();
	}
}