Ejemplo n.º 1
0
long ShortcutList::onSelectKeybinding(FXObject*o, FXSelector sel, void*p)
{
    apply_btn->disable();
    FXIconItem*item=acclist->getItem((FXint)(FXival)p);
    if (item) {
        MenuSpec*spec=(MenuSpec*)item->getData();
        sce->setShortcut(spec->accel[0]?spec->accel:FXString::null);
        if (spec->accel[0]) {
            remove_btn->enable();
        }
        else {
            remove_btn->disable();
        }
        FXWindow*w;
        for (w=menupath->getFirst(); w; w=w->getNext()) {
            ((FXLabel*)w)->setText(" ");
            ((FXLabel*)w)->setBackColor(getApp()->getBackColor());
        }
        FXMenuCaption*cpn=NULL;
        FXint i=-1;
        for (cpn=spec->ms_mc; cpn!=NULL; cpn=GetCaption(cpn)) {
            i++;
        }
        for (cpn=spec->ms_mc; cpn!=NULL; cpn=GetCaption(cpn)) {
            w=menupath->childAtIndex(i--);
            ((FXLabel*)w)->setText(cpn->getText());
            ((FXLabel*)w)->setBackColor(getApp()->getBaseColor());
            ((FXLabel*)w)->setIcon((cpn==spec->ms_mc)?NULL:arrow);

        }
    }
    return 0;
}
Ejemplo n.º 2
0
void CXTPRibbonGroup::OnGroupAdded()
{
    CXTPControl* pGroupOption = GetControlGroupOption();

    m_pParent->GetControls()->Add(pGroupOption);
    pGroupOption->InternalAddRef();

    pGroupOption->SetHideFlag(xtpHideRibbonTab, !IsVisible());


    pGroupOption->SetID(GetID());

    CXTPControl* pGroupPopup = (CXTPControl*)GetControlGroupPopup();
    m_pParent->GetControls()->Add(pGroupPopup);
    pGroupPopup->SetCaption(GetCaption());
    pGroupPopup->SetDescription(NULL);

    pGroupPopup->InternalAddRef();

    pGroupPopup->SetHideFlag(xtpHideRibbonTab, !IsVisible());

    CXTPCommandBars* pCommandBars = m_pRibbonBar->GetCommandBars();
    ASSERT(pCommandBars);

    if (pCommandBars && pCommandBars->IsActionsEnabled())
    {
        CXTPControlAction* pAction = pCommandBars->CreateAction(GetID());
        if (pAction->GetCaption().IsEmpty()) pAction->SetCaption(GetCaption());

        pGroupPopup->SetAction(pAction);
        pGroupOption->SetAction(pAction);
    }
}
Ejemplo n.º 3
0
void GUITextBox::Draw()
{
	if(IsVisible())
	{
		COLOR4 color = GetColor();
		Box(GetX(), GetY(), GetWidth(), GetHeight(),
			color.r, color.g, color.b, color.a);

		if(GetCaption() && GetCaptionFont())
		{
			COLOR4 c_color = GetCaptionColor();
			glColor4ub(c_color.r, c_color.g, c_color.b, c_color.a);
			PrintText(GetCaption(), GetCaptionFont(),
				GetX() + GetCaptionX(), GetY() + GetCaptionY());
		}

		if(GetTextFont())
		{
			COLOR4 t_color = GetTextColor();
			glColor4ub(t_color.r, t_color.g, t_color.b, t_color.a);
			PrintText(GetText(), GetTextFont(),
				GetX() + GetTextX(), GetY() + GetTextY());
		}
	}
}
Ejemplo n.º 4
0
void GUIControl::Draw()
{
	if(IsVisible())
	{
		if(GetTexture())
		{	
			COLOR4 c = GetColor();
			glColor4ub(c.r, c.g, c.b, c.a);

			if(GetCurrentPattern() == 0)
			{
				DrawTexture(GetX(), GetY(),
					0, 0,
					GetWidth(), GetHeight(),
					GetTexture(),
					false, false, 100, 100);
			}
			else
			{
				DrawTexture(GetX(), GetY(),
					GetCurrentPattern() * GetWidth(),
					0,
					GetCurrentPattern() * GetWidth() + GetWidth(),
					GetHeight(),
					GetTexture(),
					false, false, 100, 100);
			}
		}

		if(GetCaption() && GetCaptionFont())
		{
			COLOR4 c = GetCurrentCaptionColor();
			glColor4ub(c.r, c.g, c.b, c.a);

			PrintText(GetCaption(),
				GetCaptionFont(),
				GetX() + GetCaptionX(),
				GetY() + GetCaptionY());
		}

		if(GetBorder())
		{
			if(GetBorderType() == btAlways)
			{
				Box(GetX(), GetY(), GetWidth(), GetHeight());
			}
			else if(GetBorderType() == btOnMouseMove)
			{
				if(_draw_border)
					Box(GetX(), GetY(), GetWidth(), GetHeight());
			}
		}
	}
}
Ejemplo n.º 5
0
HRESULT CAdRegion::SaveAsText(CBDynBuffer *Buffer, int Indent) {
	Buffer->PutTextIndent(Indent, "REGION {\n");
	Buffer->PutTextIndent(Indent + 2, "NAME=\"%s\"\n", m_Name);
	Buffer->PutTextIndent(Indent + 2, "CAPTION=\"%s\"\n", GetCaption());
	Buffer->PutTextIndent(Indent + 2, "BLOCKED=%s\n", m_Blocked ? "TRUE" : "FALSE");
	Buffer->PutTextIndent(Indent + 2, "DECORATION=%s\n", m_Decoration ? "TRUE" : "FALSE");
	Buffer->PutTextIndent(Indent + 2, "ACTIVE=%s\n", m_Active ? "TRUE" : "FALSE");
	Buffer->PutTextIndent(Indent + 2, "SCALE=%d\n", (int)m_Zoom);
	Buffer->PutTextIndent(Indent + 2, "ALPHA_COLOR { %d,%d,%d }\n", D3DCOLGetR(m_Alpha), D3DCOLGetG(m_Alpha), D3DCOLGetB(m_Alpha));
	Buffer->PutTextIndent(Indent + 2, "ALPHA = %d\n", D3DCOLGetA(m_Alpha));
	Buffer->PutTextIndent(Indent + 2, "EDITOR_SELECTED=%s\n", m_EditorSelected ? "TRUE" : "FALSE");

	int i;
	for (i = 0; i < m_Scripts.GetSize(); i++) {
		Buffer->PutTextIndent(Indent + 2, "SCRIPT=\"%s\"\n", m_Scripts[i]->m_Filename);
	}

	if (m_ScProp) m_ScProp->SaveAsText(Buffer, Indent + 2);

	for (i = 0; i < m_Points.GetSize(); i++) {
		Buffer->PutTextIndent(Indent + 2, "POINT {%d,%d}\n", m_Points[i]->x, m_Points[i]->y);
	}

	CBBase::SaveAsText(Buffer, Indent + 2);

	Buffer->PutTextIndent(Indent, "}\n\n");

	return S_OK;
}
Ejemplo n.º 6
0
void Button::CreateButton(int x1, int y1, int x2, int y2)
{
	setPosition(x1,y1,x2,y2);
	setHWNDElement(CreateWindowEx(0, "BUTTON", GetCaption(), BS_PUSHBUTTON|
				WS_VISIBLE|WS_CHILD|WS_TABSTOP, x1, y1, x2, y2, GetHWNDForm(),
				NULL, GetHInstance(), NULL));
}
Ejemplo n.º 7
0
NS_IMETHODIMP nsHTMLTableAccessible::GetDescription(nsAString& aDescription)
{
  // Helpful for debugging layout vs. data tables
  aDescription.Truncate();
  nsAccessible::GetDescription(aDescription);
  if (!aDescription.IsEmpty()) {
    return NS_OK;
  }

  nsCOMPtr<nsIAccessible> captionAccessible;
  GetCaption(getter_AddRefs(captionAccessible));
  nsCOMPtr<nsIAccessNode> captionAccessNode = do_QueryInterface(captionAccessible);
  if (captionAccessNode) {
    nsCOMPtr<nsIDOMNode> captionNode;
    captionAccessNode->GetDOMNode(getter_AddRefs(captionNode));
    nsCOMPtr<nsIContent> captionContent = do_QueryInterface(captionNode);
    if (captionContent) {
      nsTextEquivUtils::
        AppendTextEquivFromContent(this, captionContent, &aDescription);
    }
  }
#ifdef SHOW_LAYOUT_HEURISTIC
  if (aDescription.IsEmpty()) {
    PRBool isProbablyForLayout;
    IsProbablyForLayout(&isProbablyForLayout);
    aDescription = mLayoutHeuristic;
  }
#ifdef DEBUG_A11Y
  printf("\nTABLE: %s\n", NS_ConvertUTF16toUTF8(mLayoutHeuristic).get());
#endif
#endif

  return NS_OK;
}
Ejemplo n.º 8
0
void CLogTextChoice::GetChooser(CString& oChooser)
{
	CString oName;
	switch(m_nType)
	{
	case 0:
		oName = "Host";
		break;
	case 2:
		oName = "App";
		break;
	case 3:
		oName = "Module";
		break;
	case 4:
		oName = "Func";
		break;
	case 5:
		oName = "File";
		break;
	case 6:
		oName = "Key";
		break;
	}
	oChooser += oName;
	if(m_bNot)
		oChooser += "!='";
	else
		oChooser += "='";
	GetCaption(oChooser);
	oChooser += "'";
}
Ejemplo n.º 9
0
//
/// Updates the caption of the property sheet.
//
void
TPropertySheet::SetCaption(LPCTSTR title)
{
  // Here we'll be a little flexible and allow a call to SetCaption
  // even before the underlying window element has been created...
  //
  if (GetHandle())
    SetTitle(title, 0);
  else 
  {
    // TWindow's implementation will cache a copy of the caption.
    //
    TWindow::SetCaption(title);
    HeaderInfo.pszCaption = GetCaption() ? GetCaption() : _T("");
  }
}
Ejemplo n.º 10
0
void
WndProperty::BeginEditing()
{
  if (edit.is_read_only()) {
    /* this would display xml file help on a read-only wndproperty if
       it exists */
    OnHelp();
  } else if (mDataField != NULL && mDataField->SupportCombo) {
    SingleWindow *root = (SingleWindow *)get_root_owner();

    /* if this asserton fails, then there no valid root window could
       be found - maybe it didn't register its wndproc? */
    assert(root != NULL);

    dlgComboPicker(*root, this);
  } else if (CanEditInPlace()) {
    edit.set_focus();
  } else if (mDataField != NULL) {
    const TCHAR *value = mDataField->GetAsString();
    if (value == NULL)
      return;

    StaticString<EDITSTRINGSIZE> buffer(value);
    if (!TextEntryDialog(*(SingleWindow *)get_root_owner(), buffer,
                         GetCaption()))
      return;

    mDataField->SetAsString(buffer);
    RefreshDisplay();
  }
}
HRESULT CAdInventoryBox::SaveAsText(CBDynBuffer* Buffer, int Indent)
{
	Buffer->PutTextIndent(Indent, "INVENTORY_BOX\n");
	Buffer->PutTextIndent(Indent, "{\n");
	
	Buffer->PutTextIndent(Indent+2, "NAME=\"%s\"\n", m_Name);
	Buffer->PutTextIndent(Indent+2, "CAPTION=\"%s\"\n", GetCaption());
	
	Buffer->PutTextIndent(Indent+2, "AREA { %d, %d, %d, %d }\n", m_ItemsArea.left, m_ItemsArea.top, m_ItemsArea.right, m_ItemsArea.bottom);

	Buffer->PutTextIndent(Indent+2, "EXCLUSIVE=%s\n", m_Exclusive?"TRUE":"FALSE");
	Buffer->PutTextIndent(Indent+2, "HIDE_SELECTED=%s\n", m_HideSelected?"TRUE":"FALSE");
	Buffer->PutTextIndent(Indent+2, "ALWAYS_VISIBLE=%s\n", m_Visible?"TRUE":"FALSE");
	Buffer->PutTextIndent(Indent+2, "SPACING=%d\n", m_Spacing);
	Buffer->PutTextIndent(Indent+2, "ITEM_WIDTH=%d\n", m_ItemWidth);
	Buffer->PutTextIndent(Indent+2, "ITEM_HEIGHT=%d\n", m_ItemHeight);
	Buffer->PutTextIndent(Indent+2, "SCROLL_BY=%d\n", m_ScrollBy);

	Buffer->PutTextIndent(Indent+2, "\n");

	// window
	if(m_Window) m_Window->SaveAsText(Buffer, Indent + 2);

	Buffer->PutTextIndent(Indent+2, "\n");

	// editor properties
	CBBase::SaveAsText(Buffer, Indent+2);

	Buffer->PutTextIndent(Indent, "}\n");
	return S_OK;
}
Ejemplo n.º 12
0
void
MacCreadySetupPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  ButtonWindowStyle style;
  style.Hide();
  style.TabStop();

  SetWindow(new WndButton(parent, UIGlobals::GetDialogLook(), GetCaption(), rc,
                          style, *this, 1));
}
Ejemplo n.º 13
0
void CMemoViewDlg::SetTargetName( const char* pszName )
{
	assert( pszName );
	if( pszName )
		m_strName = pszName;

#ifdef __PRIVATECHAT2
	GetCaption()->SetString( CStr::Printf( "From:%s", m_strName.c_str() ) );
#endif
}
Ejemplo n.º 14
0
STDMETHODIMP CMetadataElement::get_Caption(BSTR* pVal)
{
	if (NULL == pVal)
		return E_INVALIDARG;

	_bstr_t sCaption = GetCaption().c_str();
	*pVal = sCaption.copy();

	return S_OK;
}
Ejemplo n.º 15
0
//
/// Sets the caption of this page.
/// \note	This routine must be invoked before the page is created.
//
void
TPropertyPage::SetTitle(LPCTSTR title)
{
  // Let TWindow make a copy of the title.
  // Then point to the 'duped' copy...
  //
  SetCaption(title);
  PageInfo.pszTitle = GetCaption();
  PageInfo.dwFlags |= PSP_USETITLE;
}
Ejemplo n.º 16
0
HRESULT CUIEdit::SaveAsText(CBDynBuffer *Buffer, int Indent) {
	Buffer->PutTextIndent(Indent, "EDIT\n");
	Buffer->PutTextIndent(Indent, "{\n");

	Buffer->PutTextIndent(Indent + 2, "NAME=\"%s\"\n", m_Name);
	Buffer->PutTextIndent(Indent + 2, "CAPTION=\"%s\"\n", GetCaption());

	Buffer->PutTextIndent(Indent + 2, "\n");

	if (m_Back && m_Back->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "BACK=\"%s\"\n", m_Back->m_Filename);

	if (m_Image && m_Image->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "IMAGE=\"%s\"\n", m_Image->m_Filename);

	if (m_Font && m_Font->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "FONT=\"%s\"\n", m_Font->m_Filename);
	if (m_FontSelected && m_FontSelected->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "FONT_SELECTED=\"%s\"\n", m_FontSelected->m_Filename);

	if (m_Cursor && m_Cursor->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "CURSOR=\"%s\"\n", m_Cursor->m_Filename);

	Buffer->PutTextIndent(Indent + 2, "\n");

	if (m_Text)
		Buffer->PutTextIndent(Indent + 2, "TEXT=\"%s\"\n", m_Text);

	Buffer->PutTextIndent(Indent + 2, "\n");

	Buffer->PutTextIndent(Indent + 2, "X=%d\n", m_PosX);
	Buffer->PutTextIndent(Indent + 2, "Y=%d\n", m_PosY);
	Buffer->PutTextIndent(Indent + 2, "WIDTH=%d\n", m_Width);
	Buffer->PutTextIndent(Indent + 2, "HEIGHT=%d\n", m_Height);
	Buffer->PutTextIndent(Indent + 2, "MAX_LENGTH=%d\n", m_MaxLength);
	Buffer->PutTextIndent(Indent + 2, "CURSOR_BLINK_RATE=%d\n", m_CursorBlinkRate);
	Buffer->PutTextIndent(Indent + 2, "FRAME_WIDTH=%d\n", m_FrameWidth);

	Buffer->PutTextIndent(Indent + 2, "DISABLED=%s\n", m_Disable ? "TRUE" : "FALSE");
	Buffer->PutTextIndent(Indent + 2, "VISIBLE=%s\n", m_Visible ? "TRUE" : "FALSE");
	Buffer->PutTextIndent(Indent + 2, "PARENT_NOTIFY=%s\n", m_ParentNotify ? "TRUE" : "FALSE");

	// scripts
	for (int i = 0; i < m_Scripts.GetSize(); i++) {
		Buffer->PutTextIndent(Indent + 2, "SCRIPT=\"%s\"\n", m_Scripts[i]->m_Filename);
	}

	Buffer->PutTextIndent(Indent + 2, "\n");

	// editor properties
	CBBase::SaveAsText(Buffer, Indent + 2);

	Buffer->PutTextIndent(Indent, "}\n");
	return S_OK;
}
Ejemplo n.º 17
0
void CClanOrganizeDlg::SetInterfacePos_After()
{
	CWinCtrl * pCtrl = NULL;
	if(pCtrl = Find("PREVIEW_MARK"))
	{
		m_ptPreViewMark.x = pCtrl->GetOffset().x;
		m_ptPreViewMark.y = pCtrl->GetOffset().y;
	}
	else
	{
		m_ptPreViewMark.x = 186;
		m_ptPreViewMark.y = 162;
	}
	if(pCtrl = Find("CLAN_NAME"))
	{
		//클랜명 861
		((CTImage*)pCtrl)->SetText( LIST_STRING(861) );
	}
	if(pCtrl = Find("CLAN_SLOGAN"))
	{
		//클랜 슬로건 862
		((CTImage*)pCtrl)->SetText( LIST_STRING(862) );
	}
	if(pCtrl = Find("CLAN_MARK_SEL"))
	{
		//클랜 마크 선택 863
		((CTImage*)pCtrl)->SetText( LIST_STRING(863) );
	}
	if(pCtrl = Find("CLAN_MARK"))
	{
		//클랜 마크 865
		((CTImage*)pCtrl)->SetText(LIST_STRING(865) );
	}
	if(pCtrl = Find("CLAN_BG"))
	{
		//클랜 배경 866
		((CTImage*)pCtrl)->SetText(LIST_STRING(866) );
	}
	if(pCtrl = Find(IID_BTN_CONFIRM))
	{
		//확인 858
		pCtrl->SetText(LIST_STRING(858) );
		pCtrl->SetFont(FONT_NORMAL);
	}
	if(pCtrl = Find(IID_BTN_CLOSE))
	{
		//취소 859
		pCtrl->SetText(LIST_STRING(859) );
		pCtrl->SetFont(FONT_NORMAL);
	}
	//클랜창설 860
	GetCaption()->SetString( LIST_STRING(860) );

}
Ejemplo n.º 18
0
void CXTPReportGroupRow::Draw(CDC* pDC, CRect rcRow, CRect rcClip, int nLeftOffset,
	CXTPReportRecordMergeItems& /*mergeItems*/, int nColumnFrom, int nColumnTo)
{
	UNREFERENCED_PARAMETER(rcClip);
	UNREFERENCED_PARAMETER(nColumnFrom);
	UNREFERENCED_PARAMETER(nColumnTo);

	CRgn rgnClip;
	if (!pDC->IsPrinting())
	{
		rgnClip.CreateRectRgnIndirect(&rcClip);
		pDC->SelectClipRgn(&rgnClip, RGN_COPY);
	}

	CXTPReportPaintManager *pPaintManager = m_pControl->GetPaintManager();

	pDC->SetBkMode(TRANSPARENT);

	m_rcRow = rcRow;
	if (0 == GetControl()->GetFreezeColumnsCount())
	{
		m_rcRow.left  -= nLeftOffset;
		m_rcRow.right -= nLeftOffset;
	}

	XTP_REPORTRECORDITEM_DRAWARGS drawArgs;
	drawArgs.pDC        = pDC;
	drawArgs.nTextAlign = DT_LEFT;
	drawArgs.pControl   = m_pControl;
	drawArgs.pColumn    = NULL;
	drawArgs.pRow       = this;
	drawArgs.pItem      = NULL;
	drawArgs.rcItem     = m_rcRow;

	XTP_REPORTRECORDITEM_METRICS* pDrawMetrics = new XTP_REPORTRECORDITEM_METRICS;
	pDrawMetrics->strText = GetCaption();

	pPaintManager->FillGroupRowMetrics(this, pDrawMetrics, pDC->IsPrinting());

	ASSERT(m_pControl);
	if (m_pControl)
		m_pControl->GetItemMetrics(&drawArgs, pDrawMetrics);

	pPaintManager->DrawGroupRow(pDC, this, m_rcRow, pDrawMetrics);

	pDrawMetrics->InternalRelease();

	if (!pDC->IsPrinting())
	{
		pDC->SelectClipRgn(NULL, RGN_COPY);
		rgnClip.DeleteObject();
	}
}
Ejemplo n.º 19
0
		/*=============================================================================
		-- Updates the EditBox.
		=============================================================================*/
		void EditBox::_Update()
		{
			if (GetHasFocus())
			{
				String newText = mText.lock()->GetText();
				newText.PushBack(GetWindow()->GetInput()->GetTextEntered());

				if (GetCaption() != newText)
					_SendElementMessageToListeners(ElementEvent::VALUE_CHANGED, newText);

				//don't set the text directly or else it won't be restricted properly
				SetCaption(newText);
			}

			_UpdateAssets();
		}
Ejemplo n.º 20
0
NS_IMETHODIMP
nsHTMLTableAccessible::GetRelationByType(PRUint32 aRelationType,
                                         nsIAccessibleRelation **aRelation)
{
  nsresult rv = nsAccessibleWrap::GetRelationByType(aRelationType,
                                                    aRelation);
  NS_ENSURE_SUCCESS(rv, rv);

  if (aRelationType == nsIAccessibleRelation::RELATION_DESCRIBED_BY) {
    nsCOMPtr<nsIAccessible> accCaption;
    GetCaption(getter_AddRefs(accCaption));
    return nsRelUtils::AddTarget(aRelationType, aRelation, accCaption);
  }

  return NS_OK;
}
Ejemplo n.º 21
0
LRESULT CChatWnd::OnChatMessage(WPARAM /*wParam*/, LPARAM lParam)
{
    CAutoPtr< CChatMessage > pMsg( (CChatMessage*)lParam );

    if ( pMsg->m_hBitmap )
    {
        CChatWnd::AddBitmap( pMsg->m_hBitmap );
    }

    switch ( pMsg->m_bType )
    {
    case cmtProfile:
        Open();
        SetAlert();
        CChatWnd::AddLogin( pMsg->m_sFrom );
        break;

    case cmtError:
        SetAlert();
    case cmtStatus:
    case cmtInfo:
        CChatWnd::OnStatusMessage( (int)pMsg->m_bType - (int)cmtStatus, pMsg->m_sMessage );
        break;

    case cmtMessage:
        CChatWnd::OnMessage( false, GetChatID(), false, pMsg->m_sFrom, MyProfile.GetNick(), pMsg->m_sMessage );
        break;

    case cmtAction:
        CChatWnd::OnMessage( false, GetChatID(), false, pMsg->m_sFrom, MyProfile.GetNick(), pMsg->m_sMessage );
        break;

    case cmtCaption:
        m_sCaption = _T(" : ") + pMsg->m_sMessage;
        break;

    default:
        ;
    }

    SetWindowText( GetCaption() + m_sCaption );

    return 0;
}
Ejemplo n.º 22
0
/**
   Return the Description for the OS, usually the same as caption.

   \returns     Description for OS, intended for display/human reader
   \throws      SCXCoreLib::SCXNotSupportedException - if not implemented for the platform
(passed through from GetCaption().

*/
std::wstring SCXOSTypeInfo::GetDescription() const
{
    std::wstring str = GetCaption();

#if defined(sun)
    bool isInGlobalZone = false;
    SystemInfo si;

    // True means platform has zone support, false means does not
    if(si.GetSUN_IsInGlobalZone(isInGlobalZone))
    {
        if(isInGlobalZone)
            str += L" Global Zone";
        else
            str += L" Non-Global Zone";
    }
#endif
    return str;
}
Ejemplo n.º 23
0
long Document :: Activate(wActivateMsg m)
{
	char	buf[500], *cp;

	if (m.fActive())
	{
		wMdiDesktop *	desk = (wMdiDesktop *)ParentWindow();

		bString str = desk->GetCaption();
		strcpy(buf, str);
		if ((cp = strchr(buf, '-')) != NULL)
			*(cp-1) = 0;

		strcat(buf, " - ");
		strcat(buf, GetCaption());
		desk->SetCaption(buf);
	}
	return FALSE;
}
Ejemplo n.º 24
0
HRESULT CAdLayer::SaveAsText(CBDynBuffer *Buffer, int Indent)
{
	Buffer->PutTextIndent(Indent, "LAYER {\n");
	Buffer->PutTextIndent(Indent+2, "NAME=\"%s\"\n", m_Name);
	Buffer->PutTextIndent(Indent+2, "CAPTION=\"%s\"\n", GetCaption());
	Buffer->PutTextIndent(Indent+2, "MAIN=%s\n", m_Main?"TRUE":"FALSE");	
	Buffer->PutTextIndent(Indent+2, "WIDTH=%d\n", m_Width);
	Buffer->PutTextIndent(Indent+2, "HEIGHT=%d\n", m_Height);
	Buffer->PutTextIndent(Indent+2, "ACTIVE=%s\n", m_Active?"TRUE":"FALSE");
	Buffer->PutTextIndent(Indent+2, "EDITOR_SELECTED=%s\n", m_EditorSelected?"TRUE":"FALSE");
	if(m_CloseUp)
		Buffer->PutTextIndent(Indent+2, "CLOSE_UP=%s\n", m_CloseUp?"TRUE":"FALSE");

	int i;

	for(i=0; i<m_Scripts.GetSize(); i++){
		Buffer->PutTextIndent(Indent+2, "SCRIPT=\"%s\"\n", m_Scripts[i]->m_Filename);
	}

	if(m_ScProp) m_ScProp->SaveAsText(Buffer, Indent+2);

	for(i=0; i<m_Nodes.GetSize(); i++){
		switch(m_Nodes[i]->m_Type){
			case OBJECT_ENTITY:
				m_Nodes[i]->m_Entity->SaveAsText(Buffer, Indent+2);
			break;
			case OBJECT_REGION:
				m_Nodes[i]->m_Region->SaveAsText(Buffer, Indent+2);
			break;
		}
	}

	CBBase::SaveAsText(Buffer, Indent+2);

	Buffer->PutTextIndent(Indent, "}\n\n");

	return S_OK;
}
Ejemplo n.º 25
0
void CXTPReportGroupRow::Draw(CDC* pDC, CRect rcRow, int nLeftOffset)
{
	CXTPReportPaintManager* pPaintManager = m_pControl->GetPaintManager();

	pDC->SetBkMode(TRANSPARENT);

	m_rcRow = rcRow;
	if (GetControl()->m_nFreezeColumnsCount == 0)
	{
		m_rcRow.left -= nLeftOffset;
		m_rcRow.right -= nLeftOffset;
	}

	XTP_REPORTRECORDITEM_DRAWARGS drawArgs;
	drawArgs.pDC = pDC;
	drawArgs.nTextAlign = DT_LEFT;

	drawArgs.pControl = m_pControl;
	drawArgs.pRow = this;
	drawArgs.pColumn = NULL;
	drawArgs.pItem = NULL;
	drawArgs.rcItem = m_rcRow;

	XTP_REPORTRECORDITEM_METRICS* pDrawMetrics = new XTP_REPORTRECORDITEM_METRICS;
	pDrawMetrics->strText = GetCaption();

	pPaintManager->FillGroupRowMetrics(this, pDrawMetrics, pDC->IsPrinting());

	ASSERT(m_pControl);
	if (m_pControl)
		m_pControl->GetItemMetrics(&drawArgs, pDrawMetrics);

	pPaintManager->DrawGroupRow(pDC, this, m_rcRow, pDrawMetrics);

	pDrawMetrics->InternalRelease();
}
Ejemplo n.º 26
0
HRESULT CUIButton::SaveAsText(CBDynBuffer *Buffer, int Indent) {
	Buffer->PutTextIndent(Indent, "BUTTON\n");
	Buffer->PutTextIndent(Indent, "{\n");

	Buffer->PutTextIndent(Indent + 2, "NAME=\"%s\"\n", m_Name);
	Buffer->PutTextIndent(Indent + 2, "CAPTION=\"%s\"\n", GetCaption());

	Buffer->PutTextIndent(Indent + 2, "\n");

	if (m_Back && m_Back->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "BACK=\"%s\"\n", m_Back->m_Filename);
	if (m_BackHover && m_BackHover->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "BACK_HOVER=\"%s\"\n", m_BackHover->m_Filename);
	if (m_BackPress && m_BackPress->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "BACK_PRESS=\"%s\"\n", m_BackPress->m_Filename);
	if (m_BackDisable && m_BackDisable->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "BACK_DISABLE=\"%s\"\n", m_BackDisable->m_Filename);
	if (m_BackFocus && m_BackFocus->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "BACK_FOCUS=\"%s\"\n", m_BackFocus->m_Filename);

	if (m_Image && m_Image->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "IMAGE=\"%s\"\n", m_Image->m_Filename);
	if (m_ImageHover && m_ImageHover->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "IMAGE_HOVER=\"%s\"\n", m_ImageHover->m_Filename);
	if (m_ImagePress && m_ImagePress->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "IMAGE_PRESS=\"%s\"\n", m_ImagePress->m_Filename);
	if (m_ImageDisable && m_ImageDisable->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "IMAGE_DISABLE=\"%s\"\n", m_ImageDisable->m_Filename);
	if (m_ImageFocus && m_ImageFocus->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "IMAGE_FOCUS=\"%s\"\n", m_ImageFocus->m_Filename);

	if (m_Font && m_Font->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "FONT=\"%s\"\n", m_Font->m_Filename);
	if (m_FontHover && m_FontHover->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "FONT_HOVER=\"%s\"\n", m_FontHover->m_Filename);
	if (m_FontPress && m_FontPress->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "FONT_PRESS=\"%s\"\n", m_FontPress->m_Filename);
	if (m_FontDisable && m_FontDisable->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "FONT_DISABLE=\"%s\"\n", m_FontDisable->m_Filename);
	if (m_FontFocus && m_FontFocus->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "FONT_FOCUS=\"%s\"\n", m_FontFocus->m_Filename);

	if (m_Cursor && m_Cursor->m_Filename)
		Buffer->PutTextIndent(Indent + 2, "CURSOR=\"%s\"\n", m_Cursor->m_Filename);


	Buffer->PutTextIndent(Indent + 2, "\n");

	if (m_Text)
		Buffer->PutTextIndent(Indent + 2, "TEXT=\"%s\"\n", m_Text);

	switch (m_Align) {
	case TAL_LEFT:
		Buffer->PutTextIndent(Indent + 2, "TEXT_ALIGN=\"%s\"\n", "left");
		break;
	case TAL_RIGHT:
		Buffer->PutTextIndent(Indent + 2, "TEXT_ALIGN=\"%s\"\n", "right");
		break;
	case TAL_CENTER:
		Buffer->PutTextIndent(Indent + 2, "TEXT_ALIGN=\"%s\"\n", "center");
		break;
	}

	Buffer->PutTextIndent(Indent + 2, "\n");

	Buffer->PutTextIndent(Indent + 2, "X=%d\n", m_PosX);
	Buffer->PutTextIndent(Indent + 2, "Y=%d\n", m_PosY);
	Buffer->PutTextIndent(Indent + 2, "WIDTH=%d\n", m_Width);
	Buffer->PutTextIndent(Indent + 2, "HEIGHT=%d\n", m_Height);


	Buffer->PutTextIndent(Indent + 2, "DISABLED=%s\n", m_Disable ? "TRUE" : "FALSE");
	Buffer->PutTextIndent(Indent + 2, "VISIBLE=%s\n", m_Visible ? "TRUE" : "FALSE");
	Buffer->PutTextIndent(Indent + 2, "PARENT_NOTIFY=%s\n", m_ParentNotify ? "TRUE" : "FALSE");
	Buffer->PutTextIndent(Indent + 2, "FOCUSABLE=%s\n", m_CanFocus ? "TRUE" : "FALSE");
	Buffer->PutTextIndent(Indent + 2, "CENTER_IMAGE=%s\n", m_CenterImage ? "TRUE" : "FALSE");
	Buffer->PutTextIndent(Indent + 2, "PRESSED=%s\n", m_StayPressed ? "TRUE" : "FALSE");
	Buffer->PutTextIndent(Indent + 2, "PIXEL_PERFECT=%s\n", m_PixelPerfect ? "TRUE" : "FALSE");

	Buffer->PutTextIndent(Indent + 2, "\n");

	// scripts
	for (int i = 0; i < m_Scripts.GetSize(); i++) {
		Buffer->PutTextIndent(Indent + 2, "SCRIPT=\"%s\"\n", m_Scripts[i]->m_Filename);
	}

	Buffer->PutTextIndent(Indent + 2, "\n");

	// editor properties
	CBBase::SaveAsText(Buffer, Indent + 2);

	Buffer->PutTextIndent(Indent, "}\n");
	return S_OK;
}
Ejemplo n.º 27
0
CScValue* CBObject::ScGetProperty(char *Name)
{
	m_ScValue->SetNULL();

	//////////////////////////////////////////////////////////////////////////
	// Type
	//////////////////////////////////////////////////////////////////////////
	if(strcmp(Name, "Type")==0){
		m_ScValue->SetString("object");
		return m_ScValue;
	}

	//////////////////////////////////////////////////////////////////////////
	// Caption
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "Caption")==0){
		m_ScValue->SetString(GetCaption(1));
		return m_ScValue;
	}

	//////////////////////////////////////////////////////////////////////////
	// X
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "X")==0){
		m_ScValue->SetInt(m_PosX);
		return m_ScValue;
	}

	//////////////////////////////////////////////////////////////////////////
	// Y
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "Y")==0){
		m_ScValue->SetInt(m_PosY);
		return m_ScValue;
	}

	//////////////////////////////////////////////////////////////////////////
	// Height (RO)
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "Height")==0){
		m_ScValue->SetInt(GetHeight());
		return m_ScValue;
	}
	
	//////////////////////////////////////////////////////////////////////////
	// Ready (RO)
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "Ready")==0){
		m_ScValue->SetBool(m_Ready);
		return m_ScValue;
	}

	//////////////////////////////////////////////////////////////////////////
	// Movable
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "Movable")==0){
		m_ScValue->SetBool(m_Movable);
		return m_ScValue;
	}

	//////////////////////////////////////////////////////////////////////////
	// Registrable/Interactive
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "Registrable")==0 || strcmp(Name, "Interactive")==0){
		m_ScValue->SetBool(m_Registrable);
		return m_ScValue;
	}

	//////////////////////////////////////////////////////////////////////////
	// Zoomable/Scalable
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "Zoomable")==0 || strcmp(Name, "Scalable")==0){
		m_ScValue->SetBool(m_Zoomable);
		return m_ScValue;
	}
	//////////////////////////////////////////////////////////////////////////
	// Rotatable
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "Rotatable")==0){
		m_ScValue->SetBool(m_Rotatable);
		return m_ScValue;
	}
	//////////////////////////////////////////////////////////////////////////
	// AlphaColor
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "AlphaColor")==0){
		m_ScValue->SetInt((int)m_AlphaColor);
		return m_ScValue;
	}

	//////////////////////////////////////////////////////////////////////////
	// BlendMode
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "BlendMode")==0){
		m_ScValue->SetInt((int)m_BlendMode);
		return m_ScValue;
	}

	//////////////////////////////////////////////////////////////////////////
	// Scale
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "Scale")==0){
		if(m_Scale<0) m_ScValue->SetNULL();
		else m_ScValue->SetFloat((double)m_Scale);
		return m_ScValue;
	}

	//////////////////////////////////////////////////////////////////////////
	// ScaleX
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "ScaleX")==0){
		if(m_ScaleX<0) m_ScValue->SetNULL();
		else m_ScValue->SetFloat((double)m_ScaleX);
		return m_ScValue;
	}

	//////////////////////////////////////////////////////////////////////////
	// ScaleY
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "ScaleY")==0){
		if(m_ScaleY<0) m_ScValue->SetNULL();
		else m_ScValue->SetFloat((double)m_ScaleY);
		return m_ScValue;
	}

	//////////////////////////////////////////////////////////////////////////
	// RelativeScale
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "RelativeScale")==0){
		m_ScValue->SetFloat((double)m_RelativeScale);
		return m_ScValue;
	}

	//////////////////////////////////////////////////////////////////////////
	// Rotate
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "Rotate")==0){
		if(!m_RotateValid) m_ScValue->SetNULL();
		else m_ScValue->SetFloat((double)m_Rotate);
		return m_ScValue;
	}

	//////////////////////////////////////////////////////////////////////////
	// RelativeRotate
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "RelativeRotate")==0){
		m_ScValue->SetFloat((double)m_RelativeRotate);
		return m_ScValue;
	}

	//////////////////////////////////////////////////////////////////////////
	// Colorable
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "Colorable")==0){
		m_ScValue->SetBool(m_Shadowable);
		return m_ScValue;
	}
	//////////////////////////////////////////////////////////////////////////
	// SoundPanning
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "SoundPanning")==0){
		m_ScValue->SetBool(m_AutoSoundPanning);
		return m_ScValue;
	}

	//////////////////////////////////////////////////////////////////////////
	// SaveState
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "SaveState")==0){
		m_ScValue->SetBool(m_SaveState);
		return m_ScValue;
	}

	//////////////////////////////////////////////////////////////////////////
	// NonIntMouseEvents
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "NonIntMouseEvents")==0){
		m_ScValue->SetBool(m_NonIntMouseEvents);
		return m_ScValue;
	}

	//////////////////////////////////////////////////////////////////////////
	// AccCaption
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "AccCaption")==0){
		m_ScValue->SetNULL();
		return m_ScValue;
	}

	else return CBScriptHolder::ScGetProperty(Name);
}
Ejemplo n.º 28
0
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
HRESULT CBObject::ScCallMethod(CScScript* Script, CScStack *Stack, CScStack *ThisStack, char *Name)
{

	//////////////////////////////////////////////////////////////////////////
	// SkipTo
	//////////////////////////////////////////////////////////////////////////
	if(strcmp(Name, "SkipTo")==0){
		Stack->CorrectParams(2);
		m_PosX = Stack->Pop()->GetInt();
		m_PosY = Stack->Pop()->GetInt();
		AfterMove();
		Stack->PushNULL();

		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// Caption
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "Caption")==0){
		Stack->CorrectParams(1);
		Stack->PushString(GetCaption(Stack->Pop()->GetInt()));

		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// SetCursor
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "SetCursor")==0){
		Stack->CorrectParams(1);
		if(SUCCEEDED(SetCursor(Stack->Pop()->GetString()))) Stack->PushBool(true);
		else Stack->PushBool(false);

		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// RemoveCursor
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "RemoveCursor")==0){
		Stack->CorrectParams(0);
		if(!m_SharedCursors) SAFE_DELETE(m_Cursor);
		else m_Cursor = NULL;
		Stack->PushNULL();

		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// GetCursor
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "GetCursor")==0){
		Stack->CorrectParams(0);
		if(!m_Cursor || !m_Cursor->m_Filename) Stack->PushNULL();
		else Stack->PushString(m_Cursor->m_Filename);

		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// GetCursorObject
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "GetCursorObject")==0){
		Stack->CorrectParams(0);
		if(!m_Cursor) Stack->PushNULL();
		else Stack->PushNative(m_Cursor, true);

		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// HasCursor
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "HasCursor")==0){
		Stack->CorrectParams(0);

		if(m_Cursor) Stack->PushBool(true);
		else Stack->PushBool(false);

		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// SetCaption
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "SetCaption")==0){
		Stack->CorrectParams(2);
		SetCaption(Stack->Pop()->GetString(), Stack->Pop()->GetInt());
		Stack->PushNULL();

		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// LoadSound
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "LoadSound")==0){
		Stack->CorrectParams(1);
		char* Filename = Stack->Pop()->GetString();
		if(SUCCEEDED(PlaySFX(Filename, false, false)))
			Stack->PushBool(true);
		else
			Stack->PushBool(false);

		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// PlaySound
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "PlaySound")==0){
		Stack->CorrectParams(3);

		char* Filename;
		bool Looping;
		DWORD LoopStart;
		
		CScValue* val1 = Stack->Pop();
		CScValue* val2 = Stack->Pop();
		CScValue* val3 = Stack->Pop();

		if(val1->m_Type==VAL_BOOL){
			Filename=NULL;
			Looping = val1->GetBool();
			LoopStart = val2->GetInt();
		}
		else{
			if(val1->IsNULL()) Filename = NULL;
			else Filename = val1->GetString();
			Looping = val2->IsNULL()?false:val2->GetBool();
			LoopStart = val3->GetInt();
		}

		if(FAILED(PlaySFX(Filename, Looping, true, NULL, LoopStart))) Stack->PushBool(false);
		else Stack->PushBool(true);
		return S_OK;
	}
	else if(strcmp(Name, "SetSoundPitch")==0){
		Stack->CorrectParams(1);
		CScValue* val1 = Stack->Pop();
		if (val1->IsNULL())
		{
			Stack->PushBool(false);
		}
		else
		{

			float pitch = val1->GetFloat();	
			if(FAILED(SetSFXPitch(pitch))) Stack->PushBool(false);
			else Stack->PushBool(true);
		}
		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// PlaySoundEvent
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "PlaySoundEvent")==0){
		Stack->CorrectParams(2);

		char* Filename;
		char* EventName;
		
		CScValue* val1 = Stack->Pop();
		CScValue* val2 = Stack->Pop();

		if(val2->IsNULL()){
			Filename=NULL;
			EventName = val1->GetString();
		}
		else{
			Filename = val1->GetString();
			EventName = val2->GetString();
		}

		if(FAILED(PlaySFX(Filename, false, true, EventName))) Stack->PushBool(false);
		else Stack->PushBool(true);
		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// StopSound
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "StopSound")==0){
		Stack->CorrectParams(0);
		
		if(FAILED(StopSFX())) Stack->PushBool(false);
		else Stack->PushBool(true);
		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// PauseSound
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "PauseSound")==0){
		Stack->CorrectParams(0);
		
		if(FAILED(PauseSFX())) Stack->PushBool(false);
		else Stack->PushBool(true);
		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// ResumeSound
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "ResumeSound")==0){
		Stack->CorrectParams(0);
		
		if(FAILED(ResumeSFX())) Stack->PushBool(false);
		else Stack->PushBool(true);
		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// IsSoundPlaying
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "IsSoundPlaying")==0){
		Stack->CorrectParams(0);
		
		if(m_SFX && m_SFX->IsPlaying()) Stack->PushBool(true);
		else Stack->PushBool(false);
		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// SetSoundPosition
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "SetSoundPosition")==0){
		Stack->CorrectParams(1);
		
		DWORD Time = Stack->Pop()->GetInt();
		if(FAILED(SetSFXTime(Time))) Stack->PushBool(false);
		else Stack->PushBool(true);
		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// GetSoundPosition
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "GetSoundPosition")==0){
		Stack->CorrectParams(0);

		if(!m_SFX) Stack->PushInt(0);
		else Stack->PushInt(m_SFX->GetPositionTime());
		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// SetSoundVolume
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "SetSoundVolume")==0){
		Stack->CorrectParams(1);
		
		int Volume = Stack->Pop()->GetInt();
		if(FAILED(SetSFXVolume(Volume))) Stack->PushBool(false);
		else Stack->PushBool(true);
		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// GetSoundVolume
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "GetSoundVolume")==0){
		Stack->CorrectParams(0);

		if(!m_SFX) Stack->PushInt(m_SFXVolume);
		else Stack->PushInt(m_SFX->GetVolume());
		return S_OK;
	}


	//////////////////////////////////////////////////////////////////////////
	// SoundFXNone
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "SoundFXNone")==0)
	{
		Stack->CorrectParams(0);
		m_SFXType = SFX_NONE;
		m_SFXParam1 = 0;
		m_SFXParam2 = 0;
		m_SFXParam3 = 0;
		m_SFXParam4 = 0;
		Stack->PushNULL();

		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// SoundFXEcho
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "SoundFXEcho")==0)
	{
		Stack->CorrectParams(4);
		m_SFXType = SFX_ECHO;
		m_SFXParam1 = (float)Stack->Pop()->GetFloat(0); // Wet/Dry Mix [%] (0-100)
		m_SFXParam2 = (float)Stack->Pop()->GetFloat(0); // Feedback [%] (0-100)
		m_SFXParam3 = (float)Stack->Pop()->GetFloat(333.0f); // Left Delay [ms] (1-2000)
		m_SFXParam4 = (float)Stack->Pop()->GetFloat(333.0f); // Right Delay [ms] (1-2000)
		Stack->PushNULL();

		return S_OK;
	}

	//////////////////////////////////////////////////////////////////////////
	// SoundFXReverb
	//////////////////////////////////////////////////////////////////////////
	else if(strcmp(Name, "SoundFXReverb")==0)
	{
		Stack->CorrectParams(4);
		m_SFXType = SFX_REVERB;
		m_SFXParam1 = (float)Stack->Pop()->GetFloat(0); // In Gain [dB] (-96 - 0)
		m_SFXParam2 = (float)Stack->Pop()->GetFloat(0); // Reverb Mix [dB] (-96 - 0)
		m_SFXParam3 = (float)Stack->Pop()->GetFloat(1000.0f); // Reverb Time [ms] (0.001 - 3000)
		m_SFXParam4 = (float)Stack->Pop()->GetFloat(0.001f); // HighFreq RT Ratio (0.001 - 0.999)
		Stack->PushNULL();

		return S_OK;
	}

	else return CBScriptHolder::ScCallMethod(Script, Stack, ThisStack, Name);
}
Ejemplo n.º 29
0
/**
 * Creates a control from the given XMLNode as a child of the given
 * parent.
 *
 * @param form the WndForm object
 * @param LookUpTable The parent CallBackTable
 * @param node The XMLNode that represents the control
 * @param eDialogStyle The parent's dialog style
 */
static Window *
LoadChild(WndForm &form, ContainerWindow &parent, Color background_color,
          CallBackTableEntry *LookUpTable,
          XMLNode node, const DialogStyle eDialogStyle,
          int bottom_most=0)
{
  Window *window = NULL;

  // Determine name, coordinates, width, height
  // and caption of the control
  const TCHAR* Name = GetName(node);
  const TCHAR* Caption = GetCaption(node);
  RECT rc = parent.get_client_rect();
  ControlPosition pos = GetPosition(node, rc, bottom_most);
  if (!pos.no_scaling)
    pos.x = ScaleWidth(pos.x, eDialogStyle);

  ControlSize size = GetSize(node, rc, pos);
  if (!size.no_scaling)
    size.cx = ScaleWidth(size.cx, eDialogStyle);

  WindowStyle style;

  if (!StringToIntDflt(node.getAttribute(_T("Visible")), 1))
    style.hide();

  if (StringToIntDflt(node.getAttribute(_T("Border")), 0))
    style.border();

  bool advanced = _tcschr(Caption, _T('*')) != NULL;

  // PropertyControl (WndProperty)
  if (_tcscmp(node.getName(), _T("Edit")) == 0) {
    WndProperty *W;
    int CaptionWidth;
    bool ReadOnly;
    bool MultiLine;

    // Determine the width of the caption field
    CaptionWidth = StringToIntDflt(node.getAttribute(_T("CaptionWidth")), 0);

    if (Layout::ScaleSupported())
      CaptionWidth = Layout::Scale(CaptionWidth);

    CaptionWidth = ScaleWidth(CaptionWidth, eDialogStyle);

    // Determine whether the control is multiline or readonly
    MultiLine = StringToIntDflt(node.getAttribute(_T("MultiLine")), 0);
    ReadOnly = StringToIntDflt(node.getAttribute(_T("ReadOnly")), 0);

    // Load the event callback properties
    WndProperty::DataChangeCallback_t DataNotifyCallback =
      (WndProperty::DataChangeCallback_t)
      GetCallBack(LookUpTable, node, _T("OnDataNotify"));

    WindowControl::OnHelpCallback_t OnHelpCallback =
      (WindowControl::OnHelpCallback_t)
      GetCallBack(LookUpTable, node, _T("OnHelp"));

    // Create the Property Control
    style.control_parent();

    EditWindowStyle edit_style;
    if (ReadOnly)
      edit_style.read_only();
    else
      edit_style.tab_stop();

    if (is_embedded() || Layout::scale_1024 < 2048)
      /* sunken edge doesn't fit well on the tiny screen of an
         embedded device */
      edit_style.border();
    else
      edit_style.sunken_edge();

    if (MultiLine) {
      edit_style.multiline();
      edit_style.vscroll();
    }

    window = W = new WndProperty(parent, Caption,
                                 pos.x, pos.y, size.cx, size.cy,
                                 CaptionWidth, background_color,
                                 style, edit_style,
                                 DataNotifyCallback);

    // Set the fore- and background color
    LoadColors(*W, node);

    // Set the help function event callback
    W->SetOnHelpCallback(OnHelpCallback);

    // Load the help text
    W->SetHelpText(StringToStringDflt(node.getAttribute(_T("Help")), _T("")));

    // If the control has (at least) one DataField child control
    if (node.nChildNode(_T("DataField")) > 0){
      // -> Load the first DataField control
      DataField *data_field =
        LoadDataField(node.getChildNode(_T("DataField"), 0),
                      LookUpTable, eDialogStyle);

      if (data_field != NULL)
        // Tell the Property control about the DataField control
        W->SetDataField(data_field);
    }

  // ButtonControl (WndButton)
  } else if (_tcscmp(node.getName(), _T("Button")) == 0) {
    // Determine ClickCallback function
    WndButton::ClickNotifyCallback_t ClickCallback =
      (WndButton::ClickNotifyCallback_t)
      GetCallBack(LookUpTable, node, _T("OnClick"));

    // Create the ButtonControl

    ButtonWindowStyle bstyle(style);
    bstyle.tab_stop();
    bstyle.multiline();

    window = new WndButton(parent, Caption,
                           pos.x, pos.y, size.cx, size.cy,
                           bstyle, ClickCallback);

  } else if (_tcscmp(node.getName(), _T("CheckBox")) == 0) {
    // Determine ClickCallback function
    CheckBoxControl::ClickNotifyCallback_t ClickCallback =
      (CheckBoxControl::ClickNotifyCallback_t)
      GetCallBack(LookUpTable, node, _T("OnClick"));

    // Create the CheckBoxControl

    style.tab_stop();

    window = new CheckBoxControl(parent, Caption,
                                 pos.x, pos.y, size.cx, size.cy,
                                 style,
                                 ClickCallback);

  // SymbolButtonControl (WndSymbolButton) not used yet
  } else if (_tcscmp(node.getName(), _T("SymbolButton")) == 0) {
    // Determine ClickCallback function
    WndButton::ClickNotifyCallback_t ClickCallback =
      (WndButton::ClickNotifyCallback_t)
      GetCallBack(LookUpTable, node, _T("OnClick"));

    // Create the SymbolButtonControl

    style.tab_stop();

    window = new WndSymbolButton(parent, Caption,
                                 pos.x, pos.y, size.cx, size.cy,
                                 style, background_color,
                                 ClickCallback);

  // PanelControl (WndPanel)
  } else if (_tcscmp(node.getName(), _T("Panel")) == 0) {
    // Create the PanelControl

    style.control_parent();

    PanelControl *frame = new PanelControl(parent,
                                           pos.x, pos.y, size.cx, size.cy,
                                           background_color, style);

    window = frame;

    // Load children controls from the XMLNode
    LoadChildrenFromXML(form, *frame, background_color,
                        LookUpTable, &node, eDialogStyle);

  // KeyboardControl
  } else if (_tcscmp(node.getName(), _T("Keyboard")) == 0) {
    KeyboardControl::OnCharacterCallback_t CharacterCallback =
      (KeyboardControl::OnCharacterCallback_t)
      GetCallBack(LookUpTable, node, _T("OnCharacter"));

    // Create the KeyboardControl
    KeyboardControl *kb =
      new KeyboardControl(parent,
                          pos.x, pos.y, size.cx, size.cy, background_color,
                          CharacterCallback, style);

    window = kb;
  // DrawControl (WndOwnerDrawFrame)
  } else if (_tcscmp(node.getName(), _T("Canvas")) == 0) {
    // Determine DrawCallback function
    WndOwnerDrawFrame::OnPaintCallback_t PaintCallback =
      (WndOwnerDrawFrame::OnPaintCallback_t)
      GetCallBack(LookUpTable, node, _T("OnPaint"));

    // Create the DrawControl
    WndOwnerDrawFrame* canvas =
      new WndOwnerDrawFrame(parent,
                            pos.x, pos.y, size.cx, size.cy,
                              style, PaintCallback);

    window = canvas;

  // FrameControl (WndFrame)
  } else if (_tcscmp(node.getName(), _T("Label")) == 0){
    // Create the FrameControl
    WndFrame* frame = new WndFrame(parent,
                                   pos.x, pos.y, size.cx, size.cy,
                                   background_color, style);

    // Set the caption
    frame->SetCaption(Caption);

    window = frame;

  // ListBoxControl (WndListFrame)
  } else if (_tcscmp(node.getName(), _T("List")) == 0){
    // Determine ItemHeight of the list items
    unsigned item_height =
      Layout::Scale(StringToIntDflt(node.getAttribute(_T("ItemHeight")), 18));

    // Create the ListBoxControl

    style.tab_stop();

    if (is_embedded() || Layout::scale_1024 < 2048)
      /* sunken edge doesn't fit well on the tiny screen of an
         embedded device */
      style.border();
    else
      style.sunken_edge();

    window = new WndListFrame(parent,
                              pos.x, pos.y, size.cx, size.cy,
                              style,
                              item_height);

  // TabControl (Tabbed)
  } else if (_tcscmp(node.getName(), _T("Tabbed")) == 0) {
    // Create the TabControl

    style.control_parent();

    TabbedControl *tabbed = new TabbedControl(parent,
                                              pos.x, pos.y, size.cx, size.cy,
                                              style);

    window = tabbed;

    const unsigned n = node.nChildNode();
    for (unsigned i = 0; i < n; ++i) {
      // Load each child control from the child nodes
      Window *child = LoadChild(form, *tabbed, background_color,
                                LookUpTable,
                                node.getChildNode(i), eDialogStyle);
      if (child != NULL)
        tabbed->AddClient(child);
        continue;
    }
  } else if (_tcscmp(node.getName(), _T("Custom")) == 0) {
    // Create a custom Window object with a callback
    CreateWindowCallback_t create =
        (CreateWindowCallback_t)GetCallBack(LookUpTable, node, _T("OnCreate"));
    if (create == NULL)
      return NULL;

    window = create(parent,
                    pos.x, pos.y, size.cx, size.cy, style);
  }

  if (window != NULL) {
    if (!string_is_empty(Name))
      form.AddNamed(Name, window);

    if (advanced)
      form.AddAdvanced(window);

    form.AddDestruct(window);
  }

  return window;
}
Ejemplo n.º 30
0
/**
 * This function returns a WndForm created either from the ressources or
 * from the XML file in XCSoarData(if found)
 * @param LookUpTable The CallBackTable
 * @param FileName The XML filename to search for in XCSoarData
 * @param Parent The parent window (e.g. XCSoarInterface::main_window)
 * @param resource The resource to look for
 * @return The WndForm object
 */
WndForm *
LoadDialog(CallBackTableEntry *LookUpTable, SingleWindow &Parent,
               const TCHAR* resource)
{
  WndForm *form = NULL;

  // Find XML file or resource and load XML data out of it
  XMLNode node = xmlOpenResourceHelper(resource);

  // TODO code: put in error checking here and get rid of exits in xmlParser
  // If XML error occurred -> Error messagebox + cancel
  if (node.isEmpty()) {
    ShowXMLError();
    return NULL;
  }

  // If the main XMLNode is of type "Form"
  if (_tcsicmp(node.getName(), _T("Form")) != 0)
    // Get the first child node of the type "Form"
    // and save it as the dialog node
    node = node.getChildNode(_T("Form"));

  // If Node does not exists -> Error messagebox + cancel
  if (node.isEmpty()) {
    ShowXMLError();
    return NULL;
  }

  // Determine the dialog style of the dialog
  DialogStyle dialog_style = GetDialogStyle(node);

  // Determine the dialog size
  const TCHAR* Caption = GetCaption(node);
  const RECT rc = Parent.get_client_rect();
  ControlPosition pos = GetPosition(node, rc);
  ControlSize size = GetSize(node, rc, pos);

  InitScaleWidth(size, rc, dialog_style);

  // Correct dialog size and position for dialog style
  switch (dialog_style) {
  case dsFullWidth:
    pos.x = rc.left;
    pos.y = rc.top;
    size.cx = rc.right - rc.left; // stretch form to full width of screen
    size.cy = rc.bottom - rc.top;
    break;
  case dsScaledCentered:
    pos = SetPositionCentered(pos, rc, size);
    break;

  case dsScaled:
  case dsFixed:
    break;
  }

  // Create the dialog
  WindowStyle style;
  style.hide();
  style.control_parent();

  form = new WndForm(Parent, pos.x, pos.y, size.cx, size.cy, Caption, style);

  // Set fore- and background colors
  Color color;
  if (StringToColor(node.getAttribute(_T("BackColor")), color))
    form->SetBackColor(color);

  // Load the children controls
  LoadChildrenFromXML(*form, form->GetClientAreaWindow(), form->GetBackColor(),
                      LookUpTable, &node, dialog_style);

  // If XML error occurred -> Error messagebox + cancel
  if (XMLNode::GlobalError) {
    ShowXMLError();
    delete form;
    return NULL;
  }

  // Return the created form
  return form;
}