/*********************************************************************\
	Function name    : CCustomSubDialog::InitValues
	Description      :
	Created at       : 27.03.02, @ 12:07:33
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
Bool CCustomSubDialog::InitValues(void)
{
    Int32 lID = FIRST_CUSTOM_ELEMENT_ID;
    Int32 i;

    CCustomElements* pElement = g_pCustomElements->GetItem(m_pElement->m_lElement);
    if (!pElement) return true;

    if (!m_pElement->m_pbcGUI) return true;
    BaseContainer* pBC = &m_pElement->m_pbcGUI[m_pElement->m_lElement];

    SetBool(IDC_CUSTOM_OPEN_CLOSE, pElement->m_bIsOpen);

    for (i = 0; m_pProp && m_pProp[i].type != CUSTOMTYPE_END; i++, lID++)
    {
        CustomProperty* pProp = &pElement->m_pProp[i];

        if (pProp->type == CUSTOMTYPE_FLAG) SetBool(lID, pBC, pProp->id);
        else if (pProp->type == CUSTOMTYPE_LONG) SetInt32(lID, pBC, pProp->id);
        else if (pProp->type == CUSTOMTYPE_REAL) SetFloat(lID, pBC, pProp->id);
        else if (pProp->type == CUSTOMTYPE_STRING) SetString(lID, pBC, pProp->id);
        else if (pProp->type == CUSTOMTYPE_VECTOR)
        {
            Vector v = pBC->GetVector(pProp->id);
            SetFloat(lID++,v.x);
            SetFloat(lID++,v.y);
            SetFloat(lID,v.z);
        }
    }

    return true;
}
/////////////////////////////////////////////////////////
// Resets a value with a string, preserving current type
void VariableData::ResetWith(wxString value) {
	switch (type) {
		case VARDATA_INT: {
			long temp = 0;
			value.ToLong(&temp);
			SetInt(temp);
			break;
		}
		case VARDATA_FLOAT: {
			double temp = 0;
			value.ToDouble(&temp);
			SetFloat(temp);
			break;
		}
		case VARDATA_BOOL:
			if (value == _T("1")) SetBool(true);
			else SetBool(false);
			break;
		case VARDATA_COLOUR: {
			long r=0,g=0,b=0;
			value.Mid(1,2).ToLong(&r,16);
			value.Mid(3,2).ToLong(&g,16);
			value.Mid(5,2).ToLong(&b,16);
			SetColour(wxColour(r,g,b));
			break;
		}
		default:
			SetText(value);
			break;
	}
}
void
QvisLegendAttributesInterface::orientationChanged(int orientation)
{
    SetBool(LEGEND_ORIENTATION0, (orientation==2 || orientation==3) );
    SetBool(LEGEND_ORIENTATION1, (orientation==1 || orientation==3) );
    SetUpdate(false);
    Apply();
}
void
QvisLegendAttributesInterface::drawLabelsChanged(int val)
{
    SetBool(LEGEND_DRAW_VALUES, (val == 1 || val == 3));
    SetBool(LEGEND_DRAW_LABELS, (val == 2 || val == 3));
    SetUpdate(false);
    Apply();
}
Example #5
0
int prEvent_IsRest(struct VMGlobals *g, int numArgsPushed)
{
	PyrSlot *dictslots = slotRawObject(g->sp)->slots;
	PyrSlot *arraySlot = dictslots + ivxIdentDict_array;

	if (isKindOfSlot(arraySlot, class_array)) {
		PyrSlot key, typeSlot;
		static PyrSymbol *s_type = getsym("type");
		static PyrSymbol *s_rest = getsym("rest");
		PyrSymbol *typeSym;
		// test 'this[\type] == \rest' first
		SetSymbol(&key, s_type);
		identDict_lookup(slotRawObject(g->sp), &key, calcHash(&key), &typeSlot);
		if(!slotSymbolVal(&typeSlot, &typeSym) && typeSym == s_rest) {
			SetBool(g->sp, 1);
			return errNone;
		} else {
			PyrObject *array = slotRawObject(arraySlot);
			PyrSymbol *slotSym;
			static PyrSymbol *s_empty = getsym("");
			static PyrSymbol *s_r = getsym("r");
			static PyrClass *class_rest = getsym("Rest")->u.classobj;
			static PyrClass *class_metarest = getsym("Meta_Rest")->u.classobj;
			PyrSlot *slot;
			int32 size = array->size;
			int32 i;

			slot = array->slots + 1;  // scan only the odd items

			for (i = 1; i < size; i += 2, slot += 2) {
				if (isKindOfSlot(slot, class_rest)
				    || isKindOfSlot(slot, class_metarest)
				) {
					SetBool(g->sp, 1);
					return errNone;
				} else if(!slotSymbolVal(slot, &slotSym)) {
					if(slotSym == s_empty
						|| slotSym == s_r
						|| slotSym == s_rest
					) {
						SetBool(g->sp, 1);
						return errNone;
					}
				}  // why no 'else'?
				// slotSymbolVal nonzero return = not a symbol;
				// non-symbols don't indicate rests, so, ignore them.
			}
		}
	} else {
		return errWrongType;
	}

	SetBool(g->sp, 0);
	return errNone;
}
Example #6
0
FormLayout::FormLayout()
{
	SetNumber("Form.Width",  400);
	SetNumber("Form.Height", 300);

	SetBool("Form.MaximizeBox", false);
	SetBool("Form.MinimizeBox", false);
	SetBool("Form.Sizeable",    false);
	SetBool("Form.ToolWindow",  false);

	Set("Form.Name", t_("Noname"));

	SetPageRect( Rect(Point(10, 10), Size(400, 300)) );
}
Example #7
0
/*********************************************************************\
	Function name    : CArrowSettings::SetData
	Description      :
	Created at       : 12.08.01, @ 21:55:29
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
void CArrowSettings::SetData()
{
	_Init();

	SetBool(IDS_ARROW_SMALL_CHK, m_pArrow->m_lArrowType > 4);
	Int32 l = m_pArrow->m_lArrowType;
	if (l > 4) l -= 4;
	SetInt32(IDS_ARROW_TYPE_COMBO, l - 1);
	SetBool(IDC_IS_POPUP_CHK, m_pArrow->m_bIsPopupButton);
	Enable(IDS_ARROW_SMALL_CHK, !m_pArrow->m_bIsPopupButton);
	Enable(IDS_ARROW_TYPE_COMBO, !m_pArrow->m_bIsPopupButton);
	Enable(IDC_ARROW_CHILD_ITEMS, m_pArrow->m_bIsPopupButton);

	m_pArrow->m_Children.FillEditBox(m_pSettingsDialog, IDC_ARROW_CHILD_ITEMS);
}
Example #8
0
void FoveatedRenderingApp::DefaultRender(izanagi::graph::CGraphicsDevice* device)
{
    izanagi::sample::CSampleCamera& camera = GetCamera();

    device->SetTexture(0, m_Img->GetTexture(m_Idx));
    device->SetTexture(1, m_mask);

    auto shd = m_shdDrawCube.m_shd;

    device->SetShaderProgram(shd);

    auto hL2W = shd->GetHandleByName("g_mL2W");
    shd->SetMatrix(device, hL2W, m_L2W);

    auto mtxW2C = camera.GetParam().mtxW2C;

    auto hW2C = shd->GetHandleByName("g_mW2C");
    shd->SetMatrix(device, hW2C, mtxW2C);

    auto hEye = shd->GetHandleByName("g_vEye");
    shd->SetVector(device, hEye, camera.GetParam().pos);

    auto hInvScr = shd->GetHandleByName("invScreen");
    izanagi::math::CVector4 invScr(1.0f / SCREEN_WIDTH, 1.0f / SCREEN_HEIGHT, 0, 0);
    shd->SetVector(device, hInvScr, invScr);

    auto hCanFoveated = shd->GetHandleByName("canFoveated");
    shd->SetBool(device, hCanFoveated, false);

    m_Cube->Render(device);
}
void CXTPPropertyGridItemBool::OnBeforeInsert()
{
	if (m_pBindBool && *m_pBindBool != m_bValue)
	{
		SetBool(*m_pBindBool);
	}
}
/*************************************
 * operator =
 *************************************/
SHVDataVariant& SHVDataVariantImpl::operator=(const SHVDataVariant& val)
{
	switch (val.GetDataType())
	{
		case SHVDataVariant::TypeInt:
			SetInt(val.AsInt());
			break;
		case SHVDataVariant::TypeInt64:
			SetInt64(val.AsInt64());
			break;
		case SHVDataVariant::TypeBool:
			SetBool(val.AsBool());
			break;
		case SHVDataVariant::TypeDouble:
			SetDouble(val.AsDouble());
			break;
		case SHVDataVariant::TypeString:
			SetString(val.AsString());
			break;
		case SHVDataVariant::TypeTime:
			SetTime(val.AsTime());
			break;
	}
	return *this;
}
Example #11
0
PListValue& PListValue::operator =(const PListValue& rhs)
{
    switch (rhs.type_)
    {
    case PLVT_NONE:
        Reset();
        break;
    case PLVT_INT:
        SetInt(rhs.int_);
        break;
    case PLVT_BOOL:
        SetBool(rhs.bool_);
        break;
    case PLVT_FLOAT:
        SetFloat(rhs.float_);
        break;
    case PLVT_STRING:
        SetString(*rhs.string_);
        break;
    case PLVT_VALUEMAP:
        SetValueMap(*rhs.valueMap_);
        break;
    case PLVT_VALUEVECTOR:
        SetValueVector(*rhs.valueVector_);
        break;
    }

    return *this;
}
void ApplinkDialog::Timer(const BaseContainer &msg)
{
	Bool b;
	GetBool(IDC_CHK_PROMPT, b);
	if(b)
	{
		Filename fn;
		fn.SetDirectory(gPreferences.GetString(IDC_EXCH_FOLDER));
		fn.SetFile("export.txt");
        
		if(GeFExist(fn))
		{
			GePrint("File exists!");
			SetTimer(0);
			if(GeOutString("To import a new object?", GEMB_OKCANCEL) == GEMB_R_OK)
			{
				GePrint("Start import!");
				BaseDocument* doc = GetActiveDocument();
				ApplinkImporter* importer = NewObjClear(ApplinkImporter);
				importer->Execute(doc, &gPreferences);
				SetTimer(1000);
			}
			else
			{
				SetBool(IDC_CHK_PROMPT, false);
			}
		}
	}
}
void
QvisLegendAttributesInterface::drawMinmaxToggled(bool val)
{
    SetBool(LEGEND_DRAW_MINMAX, val);
    SetUpdate(false);
    Apply();
}
void
QvisLegendAttributesInterface::drawTitleToggled(bool val)
{
    SetBool(LEGEND_DRAW_TITLE, val);
    SetUpdate(false);
    Apply();
}
avtLegendAttributesColleague::avtLegendAttributesColleague(
    VisWindowColleagueProxy &m) : avtAnnotationColleague(m), atts()
{
    // Populate atts with some legend defaults.
    SetBool(atts, LEGEND_MANAGE_POSITION,  true);
    SetBool(atts, LEGEND_DRAW_BOX,         false);
    SetBool(atts, LEGEND_DRAW_LABELS,      false);
    SetBool(atts, LEGEND_ORIENTATION0,     false);
    SetBool(atts, LEGEND_ORIENTATION1,     false);
    SetBool(atts, LEGEND_DRAW_TITLE,       true);
    SetBool(atts, LEGEND_DRAW_MINMAX,      true);
    SetBool(atts, LEGEND_CONTROL_TICKS,    true);
    SetBool(atts, LEGEND_MINMAX_INCLUSIVE, true);
    SetBool(atts, LEGEND_DRAW_VALUES,      true);

    // Set the format string for the legend into the text.
    stringVector text;
    text.push_back("%# -9.4g");
    atts.SetText(text);

    // Set the default position.
    const double defaultPosition[2] = {0.05, 0.9};
    atts.SetPosition(defaultPosition);

    // Set the default scale.
    const double defaultScale[2] = {1.,1.};
    atts.SetPosition2(defaultScale);

    // Set the default font height.
    atts.SetDoubleAttribute1(0.015);

    // Set the default bounding box color.
    atts.SetColor1(ColorAttribute(0,0,0,50));

    // Set the default font properties.
    atts.SetFontFamily(AnnotationObject::Arial);
    atts.SetFontBold(false);
    atts.SetFontItalic(false);
    atts.SetFontShadow(false);

    // Set the default number of ticks 
    atts.SetIntAttribute2(5);

    // Set the default legend type to variable
    atts.SetIntAttribute3(0);
}
Example #16
0
int ScIDE_Connected(struct VMGlobals *g, int numArgsPushed)
{
    PyrSlot * returnSlot = g->sp - numArgsPushed + 1;

    SetBool(returnSlot, gIpcClient != 0);

    return errNone;
}
Example #17
0
Bool CSearchDialog::InitValues()
{
	if (!GeDialog::InitValues()) return false;

	SetBool(IDC_SEARCH_REG_EXPR_CHK, m_bRegExpr);
	SetString(IDC_SEARCH_EDIT, m_strText);

	return true;
}
Example #18
0
bool CSettingsManager::ToggleBool(const std::string &id)
{
  CSharedLock lock(m_settingsCritical);
  CSetting *setting = GetSetting(id);
  if (setting == NULL || setting->GetType() != SettingTypeBool)
    return false;

  return SetBool(id, !((CSettingBool*)setting)->GetValue());
}
////////
// Copy
void VariableData::operator= (const VariableData &param) {
	switch(param.GetType()) {
		case VARDATA_INT: SetInt(param.AsInt()); break;
		case VARDATA_FLOAT: SetFloat(param.AsFloat()); break;
		case VARDATA_TEXT: SetText(param.AsText()); break;
		case VARDATA_BOOL: SetBool(param.AsBool()); break;
		case VARDATA_COLOUR: SetColour(param.AsColour()); break;
		case VARDATA_BLOCK: SetBlock(param.AsBlock()); break;
		default: DeleteValue();
	}
}
Example #20
0
  Bool InitValues()
  {
    // Initialize the force items.
    FreeChildren(CMB_FORCE);
    AddForceCycleElement(ID_SPRING);
    AddForceCycleElement(ID_CONNECTOR);
    AddForceCycleElement(ID_MOTOR);
    SetInt32(CMB_FORCE, ID_CONNECTOR);

    SetInt32(CMB_TYPE, -1);
    SetInt32(CMB_MODE, CMB_MODE_ALL);
    SetInt32(EDT_MAXCONN, 0, 0, 20, 1, false, 0, LIMIT<Int32>::MAX);
    SetFloat(EDT_RADIUS, (Float) 0, 0, 500, 1.0, FORMAT_METER, 0, MAXVALUE_FLOAT, false, false);

    SetBool(CHK_ADDDYNAMICS, false);
    SetBool(CHK_COMPOUND, false);
    SetBool(CHK_CLOSED, false);

    UpdateGadgets(true);
    return super::InitValues();
  }
Example #21
0
void WBEvent::Set( const HashedString& Name, const WBParamEvaluator& PE )
{
	switch( PE.GetType() )
	{
	case WBParamEvaluator::EPT_Bool:	SetBool(	Name, PE.GetBool() );	break;
	case WBParamEvaluator::EPT_Int:		SetInt(		Name, PE.GetInt() );	break;
	case WBParamEvaluator::EPT_Float:	SetFloat(	Name, PE.GetFloat() );	break;
	case WBParamEvaluator::EPT_String:	SetHash(	Name, PE.GetString() ); break;	// Conversion to hash is the best we can do
	case WBParamEvaluator::EPT_Entity:	SetEntity(	Name, PE.GetEntity() );	break;
	case WBParamEvaluator::EPT_Vector:	SetVector(	Name, PE.GetVector() );	break;
	}
}
int prFileExists(struct VMGlobals * g, int numArgsPushed)
{
	PyrSlot *a = g->sp - 1, *b = g->sp;
	char filename[PATH_MAX];

	int error = slotStrVal(b, filename, PATH_MAX);
	if (error != errNone)
		return error;

	bool res = boost::filesystem::exists(filename);
	SetBool(a, res);
	return errNone;
}
////////
// Copy
void AssOverrideParameter::CopyFrom (const AssOverrideParameter &param) {
	switch(param.GetType()) {
		case VARDATA_INT: SetInt(param.AsInt()); break;
		case VARDATA_FLOAT: SetFloat(param.AsFloat()); break;
		case VARDATA_TEXT: SetText(param.AsText()); break;
		case VARDATA_BOOL: SetBool(param.AsBool()); break;
		case VARDATA_COLOUR: SetColour(param.AsColour()); break;
		case VARDATA_BLOCK: SetBlock(param.AsBlock()); break;
		default: DeleteValue();
	}
	classification = param.classification;
	ommited = param.ommited;
}
BoolRenderer::BoolRenderer(GraphEditor *parentEditor,
			bool forValue,
			BRect valueRect,
			BMessage *message)
	:Renderer(parentEditor, NULL)
{
	TRACE();
	changeMessage	= message;
	editor			= parentEditor;
	Init();
	SetBool(forValue);
	SetFrame(valueRect);
}
int prFileDelete(struct VMGlobals *g, int numArgsPushed)
{
	PyrSlot *a = g->sp - 1, *b = g->sp;
	char filename[PATH_MAX];

	int error = slotStrVal(b, filename, PATH_MAX);
	if (error != errNone)
		return error;

	int err = unlink(filename);
	SetBool(a, err == 0);

	return errNone;
}
Example #26
0
int prNetAddr_GetBroadcastFlag(VMGlobals *g, int numArgsPushed)
{
	if (gUDPport == 0) return errFailed;
	int opt;
	socklen_t optlen = sizeof(opt);
#ifdef SC_WIN32
	if (getsockopt(gUDPport->Socket(), SOL_SOCKET, SO_BROADCAST, (char *)&opt, &optlen) == -1)
#else
	if (getsockopt(gUDPport->Socket(), SOL_SOCKET, SO_BROADCAST, &opt, &optlen) == -1)
#endif
	return errFailed;
	SetBool(g->sp, opt);
	return errNone;
}
Example #27
0
static int prNetAddr_GetBroadcastFlag(VMGlobals *g, int numArgsPushed)
{
	if (gUDPport == 0)
		return errFailed;

	boost::system::error_code ec;
	boost::asio::socket_base::broadcast option;
	gUDPport->udpSocket.get_option(option, ec);

	if (ec)
		return errFailed;

	SetBool(g->sp, option.value());
	return errNone;
}
Example #28
0
int prEvent_IsRest(struct VMGlobals *g, int numArgsPushed)
{
	PyrSlot *dictslots = slotRawObject(g->sp)->slots;
	PyrSlot *arraySlot = dictslots + ivxIdentDict_array;
	static int isRestCount = 0;

	if (!isKindOfSlot(arraySlot, class_array)) {
		return errWrongType;
	}

	PyrSlot key, typeSlot;
	PyrSymbol *typeSym;
	// easy tests first: 'this[\type] == \rest'
	SetSymbol(&key, s_type);
	identDict_lookup(slotRawObject(g->sp), &key, calcHash(&key), &typeSlot);
	if(!slotSymbolVal(&typeSlot, &typeSym) && typeSym == s_rest) {
		SetBool(g->sp, 1);
		return errNone;
	}

	// and, 'this[\isRest] == true'
	SetSymbol(&key, s_isRest);
	identDict_lookup(slotRawObject(g->sp), &key, calcHash(&key), &typeSlot);
	if(IsTrue(&typeSlot)) {
		if (isRestCount == 0)
			post("\nWARNING: Setting isRest to true in an event is deprecated. See the Rest helpfile for supported ways to specify rests.\n\n");
		isRestCount = (isRestCount + 1) % 100;
		SetBool(g->sp, 1);
		return errNone;
	}

	// failing those, scan slot values for something rest-like
	PyrObject *array = slotRawObject(arraySlot);
	SetBool(g->sp, dictHasRestlikeValue(array) ? 1 : 0);
	return errNone;
}
Example #29
0
Notification::Notification() : KAccessorObject("Notification"),
	timeout(-1)
{
	SetMethod("setTitle", &Notification::_SetTitle);
	SetMethod("setMessage", &Notification::_SetMessage);
	SetMethod("setIcon", &Notification::_SetIcon);
	SetMethod("setTimeout", &Notification::_SetTimeout);
	SetMethod("setDelay", &Notification::_SetTimeout);
	SetMethod("setCallback", &Notification::_SetCallback);
	SetMethod("show", &Notification::_Show);
	SetMethod("hide", &Notification::_Hide);

	SetBool("nativeNotifications", Notification::InitializeImpl());
	this->CreateImpl();
}
Example #30
0
bool CSettings::SetEx(String strSetting, String strValue)
{
	if(IsBool(strSetting))
		SetBool(strSetting, strValue.ToBoolean());
	else if(IsInteger(strSetting))
		SetInteger(strSetting, strValue.ToInteger());
	else if(IsFloat(strSetting))
		SetFloat(strSetting, strValue.ToFloat());
	else if(IsString(strSetting))
		SetString(strSetting, strValue);
	else if(IsList(strSetting))
		AddToList(strSetting, strValue);
	else
		return false;

	return true;
}