コード例 #1
0
BOOL CGumpControlListDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	ASSERT(GfxGetGumpDocument());
	m_pView = (CGumpEditorView*)GfxGetGumpDocument()->FindView(RUNTIME_CLASS(CGumpEditorView)); 
	if (!m_pView) return FALSE;
	
	CDEditor& editor = m_pView->GetDEditor();
	CSortListCtrl& ctrl = m_lsControl;

	ctrl.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);

	ctrl.SetHeadings( _T("Name,80;Type,60;Selected,60;Visible,60;Freezed,60") );
	ctrl.LoadColumnInfo();

	int iItem = 0;
	CDiagramEntity* e=NULL;
	
	for (int i = 0; i < editor.GetObjectCount(); i++) {
		e = editor.GetObject(i); ASSERT(e);
		iItem = ctrl.AddItem(e->GetName(), e->GetType(), 
			e->IsSelected() ? "T" : "F",
			e->IsVisible()  ? "T" : "F",
			e->IsFreezed()  ? "T" : "F");
		ctrl.SetItemData(iItem, i);
	}

	return TRUE; 
}
コード例 #2
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;
}
コード例 #3
0
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();
	}
}
コード例 #4
0
void CDialogEditorDemoView::OnSettings() 
{
#if 0
	CGumpEditorDoc* pDoc = GfxGetGumpDocument(); ASSERT(pDoc);

	CDialogSettings	dlg;

	dlg.m_width = m_editor.GetVirtualSize().cx;
	dlg.m_height = m_editor.GetVirtualSize().cy;
	dlg.m_gridWidth = m_editor.GetGridSize().cx;
	dlg.m_gridHeight = m_editor.GetGridSize().cy;
	m_editor.GetMargins( dlg.m_marginLeft, dlg.m_marginTop, dlg.m_marginRight, dlg.m_marginBottom );
	
	dlg.m_strName = pDoc->GetName();
	dlg.m_iAlpha = pDoc->GetAlpha();
	dlg.m_iFlags = pDoc->GetFlags();
	pDoc->GetEventHandler(dlg.m_strEvClick, dlg.m_strEvClose, dlg.m_strEvMouseUp, dlg.m_strEvMouseDown, dlg.m_strEvKeyPressed);

	if( dlg.DoModal() == IDOK )
	{
		m_editor.SetGridSize( CSize( dlg.m_gridWidth, dlg.m_gridHeight ) );
		m_editor.SetVirtualSize( CSize( dlg.m_width, dlg.m_height ) );
		m_editor.SetMargins( dlg.m_marginLeft, dlg.m_marginTop, dlg.m_marginRight, dlg.m_marginBottom );
		
		pDoc->SetName(dlg.m_strName);
		pDoc->SetAlpha(dlg.m_iAlpha);
		pDoc->SetFlags(dlg.m_iFlags);
		pDoc->SetEventHandler(dlg.m_strEvClick, dlg.m_strEvClose, dlg.m_strEvMouseUp, dlg.m_strEvMouseDown, dlg.m_strEvKeyPressed);
		
		m_editor.RedrawWindow();
	}
#endif
}
コード例 #5
0
void CGumpBorder::SetGump(CGumpPtr pGump, bool bUpdateRect)
{
//	ASSERT(pGump);
	for (int i = 0; i < NUM_PART; i++) { 
		m_pGumpB[i] = NULL;
		m_sizeGumpB[i].SetSize(0,0);
	}
	
	if (!pGump) return;
	int iGumpID = pGump->GetGumpID();

	int iWidth = 0, iHeight = 0;
	CGumpEditorDoc* pDoc = GfxGetGumpDocument();
	m_pGumpB[LT] = pGump;
	m_sizeGumpB[LT] = pGump->GetDimensions();
	for (int i = 1; i < NUM_PART; i++) {
		m_pGumpB[i] = pDoc->LoadGump(iGumpID+i);
		if (!m_pGumpB[i]) continue;
		m_sizeGumpB[i] = m_pGumpB[i]->GetDimensions();
		if (i < LC) iWidth += m_sizeGumpB[i].cx;
		if (i % LC == 0) iHeight += m_sizeGumpB[i].cy;
	}

	if (!bUpdateRect) return;
	
	CRect rect = GetRect();
	SetRect(rect.left,rect.top,rect.left+iWidth,rect.top+iHeight);
}
コード例 #6
0
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();
	}
}
コード例 #7
0
void CGumpPicture::Draw( CDC* dc, CRect rect )
{
	CGumpEditorDoc* pDoc = GfxGetGumpDocument();
	ASSERT(pDoc);

	if (m_eType == RECTANGLE)
	{
		CBrush brush(pDoc->GetHueColor(GetHueId()));
		dc->FillRect(rect, &brush);
	}	
	else
	if (m_eType == FRAME)
	{
		CBrush brush(pDoc->GetHueColor(GetHueId()));
		dc->FrameRect(rect, &brush);
	}
	else 
	if (m_eType == GUMP && m_pGump) 
	{
		m_pGump->DrawGump(dc, rect, GetZoom());
	}
	else 
	{
		CGumpEntity::Draw(dc,rect);
	}

	//dc->SelectStockObject( ANSI_VAR_FONT );
	
	
}
コード例 #8
0
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();
    }
}
コード例 #9
0
BOOL CGumpPicture::FromString( XML::Node* node )
{
	if (!CGumpEntity::FromString(node)) return FALSE;
	
	std::string type=m_szPictureType[FRAME];
	int gump=0,hueId=1;
	XML::Node* pic_node = node->findNode("picture");
	if (pic_node) {
		pic_node->lookupAttribute("type", type);
		pic_node->lookupAttribute("hue", hueId);
		pic_node->lookupAttribute("gump", gump); 	
	}
	
	ASSERT(GfxGetGumpDocument());
	SetPictureTypeStr(type.c_str());
	SetHueId(hueId);
	SetGump(GfxGetGumpDocument()->GetGump(gump),false);
	
	return TRUE;
}
コード例 #10
0
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();
	}
}
コード例 #11
0
void CGumpStatic::Draw( CDC* dc, CRect rect )
{
	dc->SelectObject( CStdGrfx::dialogBrush() );
	dc->SelectObject( CStdGrfx::dialogPen() );

	CGumpEditorDoc* pDoc = GfxGetGumpDocument();
	ASSERT(pDoc);

	//dc->Rectangle( rect );

	//LOGFONT lf;
	//CFont font;
	//GetFont( lf );
	//// MS Sans Serif will not scale below 8 pts
	//if( GetZoom() < 1 )
	//	lstrcpy( lf.lfFaceName, _T( "Arial" ) );

	//
	//font.CreateFontIndirect( &lf );

	CFont* pFont = pDoc->GetFont(m_fontId);
	CFont* pOld = dc->SelectObject(pFont);

	CString strText = GetTitle();
	UINT align[] = { TA_LEFT, DT_CENTER, TA_RIGHT };
	UINT format =  DT_TOP | align[m_textAlign];
	
	if (IsMultiLine()) {
		strText = GfxFormatText(strText);
	}
	else {
		format |= DT_SINGLELINE;
	}

	int oldMode = dc->SetBkMode( TRANSPARENT );
	
	COLORREF color = pDoc->GetHueColor(m_hueId, m_fontId);
	COLORREF oldColor = dc->SetTextColor(color);
	
	dc->DrawText( strText, rect, format);
	
	dc->SetBkMode(oldMode);
	dc->SetTextColor(oldColor);

	dc->SelectStockObject( ANSI_VAR_FONT );
	dc->SelectStockObject( BLACK_PEN );
	dc->SelectStockObject( WHITE_BRUSH );
}
コード例 #12
0
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();
	
	}	
}
コード例 #13
0
CSize CGumpStatic::GetTextExtend() const
{
	CGumpEditorDoc* pDoc = GfxGetGumpDocument();
	ASSERT(pDoc);

	CWnd* pWnd = AfxGetMainWnd(); //pDoc->FindView(RUNTIME_CLASS(CGumpEditorView));

	CDC* pDC = pWnd->GetDC();

	CFont* pFont = pDoc->GetFont(m_fontId);
	CFont* pOld = pDC->SelectObject(pFont);

	pDC->SelectObject(pFont);

	CSize size = pDC->GetTextExtent(GetTitle());

	pDC->SelectObject(pOld);

	return size;
}
コード例 #14
0
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();
	}
}
コード例 #15
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);
}
コード例 #16
0
BOOL CGumpButton::FromString( XML::Node* node )
{
	if (!CGumpEntity::FromString(node)) return FALSE;

	int normal, over, pressed;;

	XML::Node* gump_node = node->findNode("gump");
	if (gump_node) { 
		gump_node->lookupAttribute("normal", normal);
		gump_node->lookupAttribute("over", over);
		gump_node->lookupAttribute("pressed", pressed);
	}

	CSize size = GetRect().Size();
	SetConstraints(size,size);
	
	CGumpEditorDoc* pDoc = GfxGetGumpDocument(); ASSERT(pDoc);
	
	m_pGump[NORMAL] = pDoc->LoadGump(normal);
	m_pGump[HOVER] = pDoc->LoadGump(over);
	m_pGump[PRESSED] = pDoc->LoadGump(pressed);
	
	return TRUE;
}