Exemple #1
0
CSubtitleManager::~CSubtitleManager()
{
	SetEnabled(false);
	s_Instance = NULL;
}
	void cPhysicsBodyNewton::AddTorque(const cVector3f &avTorque)
	{
		mvTotalTorque += avTorque;
		SetEnabled(true);
	}
Exemple #3
0
int TimerObject::pset_Enabled(Variant value)
{
    SetEnabled(value);
    return 0;
}
Exemple #4
0
void MenuUIObject::CloseButton()
{
    SetVisible(false);
    SetEnabled(false);
}
	void STextPropertyWidget::Construct(const FArguments& InArgs, const TSharedRef<IPropertyHandle>& InPropertyHandle, const TSharedPtr<IPropertyUtilities>& InPropertyUtilities)
	{
		PropertyHandle = InPropertyHandle;
		PropertyUtilities = InPropertyUtilities;

		const auto& GetTextValue = [this]() -> FText
		{
			FText TextValue;

			TArray<const void*> RawData;
			PropertyHandle->AccessRawData(RawData);
			if (RawData.Num() == 1)
			{
				const FText* RawDatum = reinterpret_cast<const FText*>(RawData.Top());
				if (RawDatum)
				{
					TextValue = *RawDatum;
				}
			}
			else if(RawData.Num() > 1)
			{
				TextValue = MultipleValuesText;
			}
			else
			{
				TextValue = FText::GetEmpty();
			}

			return TextValue;
		};

		const auto& OnTextCommitted = [this](const FText& NewText, ETextCommit::Type CommitInfo)
		{
			TArray<void*> RawData;
			PropertyHandle->AccessRawData(RawData);

			// Don't commit the Multiple Values text if there are multiple properties being set
			if (RawData.Num() > 0 && (RawData.Num() == 1 || NewText.ToString() != MultipleValuesText.ToString()))
			{
				PropertyHandle->NotifyPreChange();

				for (void* const RawDatum : RawData)
				{
					FText& PropertyValue = *(reinterpret_cast<FText* const>(RawDatum));

					// FText::FromString on the result of FText::ToString is intentional. For now, we want to nuke any namespace/key info and let it get regenerated from scratch,
					// rather than risk adopting whatever came through some chain of calls. This will be replaced when preserving of identity is implemented.
					PropertyValue = FText::FromString(NewText.ToString());
				}

				PropertyHandle->NotifyPostChange();
				PropertyHandle->NotifyFinishedChangingProperties();
			}
		};

		TSharedPtr<SHorizontalBox> HorizontalBox;

		bool bIsPassword = PropertyHandle->GetBoolMetaData("PasswordField");
		bIsMultiLine = PropertyHandle->GetBoolMetaData("MultiLine");
		if(bIsMultiLine)
		{
			ChildSlot
				[
					SAssignNew(HorizontalBox, SHorizontalBox)
					+SHorizontalBox::Slot()
					.FillWidth(1.0f)
					[
						SNew( SBox )
						.MaxDesiredHeight(300.f)
						[
							SAssignNew(MultiLineWidget, SMultiLineEditableTextBox)
							.Text_Lambda(GetTextValue)
							.Font(InArgs._Font)
							.SelectAllTextWhenFocused(false)
							.ClearKeyboardFocusOnCommit(false)
							.OnTextCommitted_Lambda(OnTextCommitted)
							.SelectAllTextOnCommit(false)
							.IsReadOnly(this, &STextPropertyWidget::IsReadOnly)
							.AutoWrapText(true)
							.ModiferKeyForNewLine(EModifierKey::Shift)
							.IsPassword(bIsPassword)
						]
					]
				];

			PrimaryWidget = MultiLineWidget;
		}
		else
		{
			ChildSlot
				[
					SAssignNew(HorizontalBox, SHorizontalBox)
					+SHorizontalBox::Slot()
					.FillWidth(1.0f)
					[
						SAssignNew( SingleLineWidget, SEditableTextBox )
						.Text_Lambda(GetTextValue)
						.Font( InArgs._Font )
						.SelectAllTextWhenFocused( true )
						.ClearKeyboardFocusOnCommit(false)
						.OnTextCommitted_Lambda(OnTextCommitted)
						.SelectAllTextOnCommit( true )
						.IsReadOnly(this, &STextPropertyWidget::IsReadOnly)
						.IsPassword(bIsPassword)

					]
				];

			PrimaryWidget = SingleLineWidget;
		}

		SetEnabled( TAttribute<bool>( this, &STextPropertyWidget::CanEdit ) );
	}
/**
 * Time to bury him in the back yard.
 */
Watchdog::~Watchdog()
{
	SetEnabled(false);
	delete m_fpgaWatchDog;
	m_fpgaWatchDog = NULL;
}
Exemple #7
0
void PluginPanel::OnPluginEnable( wxCommandEvent& event )
{
      SetEnabled(!m_pPlugin->m_bEnabled);
}
void
MediaConverterWindow::MessageReceived(BMessage* message)
{
	entry_ref inRef;

	char buffer[40];
	BEntry inEntry;

	switch (message->what) {
		#if B_BEOS_VERSION <= B_BEOS_VERSION_6
		case B_LANGUAGE_CHANGED:
			LanguageChanged();
			break;
		#endif

		case INIT_FORMAT_MENUS:
			BuildFormatMenu();
			if (CountSourceFiles() == 0)
				SetEnabled(false, false);
			break;

		case B_SIMPLE_DATA:
			if (message->WasDropped()) {
				DetachCurrentMessage();
				message->what = B_REFS_RECEIVED;
				BMessenger(be_app).SendMessage(message);
				delete message;
			}
			break;

		case FORMAT_SELECT_MESSAGE:
			BuildAudioVideoMenus();
			break;
		case AUDIO_CODEC_SELECT_MESSAGE:
			break;
		case VIDEO_CODEC_SELECT_MESSAGE:
			break;

		case CONVERT_BUTTON_MESSAGE:
			if (!fConverting) {
				fConvertButton->SetLabel(B_TRANSLATE("Cancel"));
				fConverting = true;
				SetStatusMessage(B_TRANSLATE("Convert"));
				SetEnabled(false, true);
				BMessenger(be_app).SendMessage(START_CONVERSION_MESSAGE);
			} else if (!fCancelling) {
				fCancelling = true;
				SetStatusMessage(B_TRANSLATE("Cancelling" B_UTF8_ELLIPSIS));
				BMessenger(be_app).SendMessage(CANCEL_CONVERSION_MESSAGE);
			}
			break;

		case CONVERSION_DONE_MESSAGE:
		{
			SetStatusMessage(fCancelling ? B_TRANSLATE("Conversion cancelled")
				: B_TRANSLATE("Conversion completed"));
			fConverting = false;
			fCancelling = false;
			bool enable = CountSourceFiles() > 0;
			SetEnabled(enable, enable);
			fConvertButton->SetLabel(B_TRANSLATE("Convert"));
			break;
		}

		case OUTPUT_FOLDER_MESSAGE:
			// Execute Save Panel
			if (fSaveFilePanel == NULL) {
				BButton* selectThisDir;

				BMessage folderSelect(FOLDER_SELECT_MESSAGE);
				fSaveFilePanel = new BFilePanel(B_OPEN_PANEL, NULL, NULL,
					B_DIRECTORY_NODE, true, &folderSelect, NULL, false, true);
				fSaveFilePanel->SetButtonLabel(B_DEFAULT_BUTTON,
					B_TRANSLATE("Select"));
				fSaveFilePanel->SetTarget(this);

				fSaveFilePanel->Window()->Lock();
				fSaveFilePanel->Window()->SetTitle(
					B_TRANSLATE("MediaConverter+:SaveDirectory"));
				BRect buttonRect
					= fSaveFilePanel->Window()->ChildAt(0)->FindView(
						"cancel button")->Frame();
				buttonRect.right  = buttonRect.left - 20;
				buttonRect.left = buttonRect.right - 130;
				selectThisDir = new BButton(buttonRect, NULL,
					B_TRANSLATE("Select this folder"),
					new BMessage(SELECT_THIS_DIR_MESSAGE),
					B_FOLLOW_BOTTOM | B_FOLLOW_RIGHT);
				selectThisDir->SetTarget(this);
				fSaveFilePanel->Window()->ChildAt(0)->AddChild(selectThisDir);
				fSaveFilePanel->Window()->Unlock();

				fSaveFilePanel->SetRefFilter(new DirectoryFilter);
			}
			fSaveFilePanel->Show();
			break;

		case FOLDER_SELECT_MESSAGE:
			// "SELECT" Button at Save Panel Pushed
			fSaveFilePanel->GetNextSelectedRef(&inRef);
			inEntry.SetTo(&inRef, true);
			_SetOutputFolder(inEntry);
			fOutputDirSpecified = true;
			fSaveFilePanel->Rewind();
			break;

		case SELECT_THIS_DIR_MESSAGE:
			// "THIS DIR" Button at Save Panel Pushed
			fSaveFilePanel->GetPanelDirectory(&inRef);
			fSaveFilePanel->Hide();
			inEntry.SetTo(&inRef, true);
			_SetOutputFolder(inEntry);
			fOutputDirSpecified = true;
			break;

		case OPEN_FILE_MESSAGE:
			// Execute Open Panel
			if (!fOpenFilePanel) {
				fOpenFilePanel = new BFilePanel(B_OPEN_PANEL, NULL, NULL,
					B_FILE_NODE, true, NULL, NULL, false, true);
				fOpenFilePanel->SetTarget(this);
			}
			fOpenFilePanel->Show();
			break;

		case B_REFS_RECEIVED:
			// Media Files Seleced by Open Panel
			DetachCurrentMessage();
			message->what = B_REFS_RECEIVED;
			BMessenger(be_app).SendMessage(message);
			// fall through

		case B_CANCEL:
			break;

		case QUIT_MESSAGE:
			MediaConverterWindow::QuitRequested();
			break;

		case PREVIEW_MESSAGE:
		{
			// Build the command line to launch the preview application.
			// TODO: Launch the default app instead of hardcoded MediaPlayer!
			int32 srcIndex = fListView->CurrentSelection();
			BMediaFile* inFile = NULL;
			status_t status = GetSourceFileAt(srcIndex, &inFile, &inRef);

			const char* argv[3];
			BString startPosString;
			BPath path;

			if (status == B_OK) {
				argv[0] = "-pos";
					// NOTE: -pos argument is currently not supported by Haiku
					// MediaPlayer.
				startPosString << fStartDurationTC->Text();
				startPosString << "000";
				argv[1] = startPosString.String();

				status = inEntry.SetTo(&inRef);
			}

			if (status == B_OK) {
				status = inEntry.GetPath(&path);
				if (status == B_OK)
					argv[2] = path.Path();
			}

			if (status == B_OK) {
				status = be_roster->Launch(
					"application/x-vnd.Haiku-MediaPlayer",
					3, (char**)argv, NULL);
			}

			if (status != B_OK && status != B_ALREADY_RUNNING) {
				BString errorString(B_TRANSLATE("Error launching: %strError%"));
				errorString.ReplaceFirst("%strError%", strerror(status));
				BAlert* alert = new BAlert(B_TRANSLATE("Error"),
					errorString.String(), B_TRANSLATE("OK"));
				alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
				alert->Go();
			}
			break;
		}

		case VIDEO_QUALITY_CHANGED_MESSAGE:
		{
			int32 value;
			message->FindInt32("be:value", &value);
			snprintf(buffer, sizeof(buffer),
				B_TRANSLATE("Video quality: %3d%%"), (int8)value);
			fVideoQualitySlider->SetLabel(buffer);
			fVideoQuality = value;
			break;
		}

		case AUDIO_QUALITY_CHANGED_MESSAGE:
		{
			int32 value;
			message->FindInt32("be:value", &value);
			snprintf(buffer, sizeof(buffer),
				B_TRANSLATE("Audio quality: %3d%%"), (int8)value);
			fAudioQualitySlider->SetLabel(buffer);
			fAudioQuality = value;
			break;
		}

		default:
			BWindow::MessageReceived(message);
	}
}
Exemple #9
0
	void Changer::on_Domain__textChanged ()
	{
		SetEnabled ();
	}
Exemple #10
0
void Light::native_SetEnabled(CallStruct &cs)
{
    BOOL bEnabled = (BOOL)cs.GetInt(0);

    SetEnabled(bEnabled);
}
void CViacamController::StartupRun()
{
	if (m_enabledAtStartup) SetEnabled (true);
}
void
VolumeControl::MessageReceived(BMessage* msg)
{
	switch (msg->what) {
		case B_MOUSE_WHEEL_CHANGED:
		{
			if (!fMixerControl->Connected())
				return;

			// Even though the volume bar is horizontal, we use the more common
			// vertical mouse wheel change
			float deltaY = 0.0f;

			msg->FindFloat("be:wheel_delta_y", &deltaY);

			if (deltaY == 0.0f)
				return;

			int32 currentValue = Value();
			int32 newValue = currentValue - int32(deltaY) * 3;

			if (newValue != currentValue) {
				SetValue(newValue);
				InvokeNotify(ModificationMessage(), B_CONTROL_MODIFIED);
			}
			break;
		}

		case B_MEDIA_NEW_PARAMETER_VALUE:
			if (IsTracking())
				break;

			SetValue((int32)fMixerControl->Volume());
			break;

		case B_SOME_APP_LAUNCHED:
		case B_SOME_APP_QUIT:
		{
			const char* signature;
			if (msg->FindString("be:signature", &signature) != B_OK)
				break;

            bool isMediaServer = !strcmp(signature, kMediaServerSignature);
            bool isAddOnServer = !strcmp(signature, kAddOnServerSignature);
            if (isMediaServer)
                fMediaServerRunning = msg->what == B_SOME_APP_LAUNCHED;
            if (isAddOnServer)
                fAddOnServerRunning = msg->what == B_SOME_APP_LAUNCHED;

           if (isMediaServer || isAddOnServer) {
                if (!fMediaServerRunning && !fAddOnServerRunning) {
					// No media server around
					SetLabel(B_TRANSLATE("No media server running"));
					SetEnabled(false);
                } else if (fMediaServerRunning && fAddOnServerRunning) {
                    // HACK!
                    // quit our now invalid instance of the media roster
                    // so that before new nodes are created,
                    // we get a new roster
                    BMediaRoster* roster = BMediaRoster::CurrentRoster();
                    if (roster != NULL) {
                        roster->Lock();
                        roster->Quit();
                    }

					BMessage reconnect(kMsgReconnectVolume);
					BMessageRunner::StartSending(this, &reconnect, 1000000LL, 1);
					fConnectRetries = 3;
                }
			}
			break;
		}

		case kMsgReconnectVolume:
			_ConnectVolume();
			if (!fMixerControl->Connected() && --fConnectRetries > 1) {
				BMessage reconnect(kMsgReconnectVolume);
				BMessageRunner::StartSending(this, &reconnect,
					6000000LL / fConnectRetries, 1);
			}
			break;

		default:
			return BView::MessageReceived(msg);
	}
}
Exemple #13
0
COSCStatsSender::~COSCStatsSender() {
	SetEnabled(false);
}
Exemple #14
0
void CWakeOnAccess::LoadFromXML()
{
  bool enabled = CSettings::GetInstance().GetBool(CSettings::SETTING_POWERMANAGEMENT_WAKEONACCESS);

  CXBMCTinyXML xmlDoc;
  if (!xmlDoc.LoadFile(GetSettingFile()))
  {
    if (enabled)
      CLog::Log(LOGNOTICE, "%s - unable to load:%s", __FUNCTION__, GetSettingFile().c_str());
    return;
  }

  TiXmlElement* pRootElement = xmlDoc.RootElement();
  if (strcmpi(pRootElement->Value(), "onaccesswakeup"))
  {
    CLog::Log(LOGERROR, "%s - XML file %s doesnt contain <onaccesswakeup>", __FUNCTION__, GetSettingFile().c_str());
    return;
  }

  m_entries.clear();

  CLog::Log(LOGNOTICE,"WakeOnAccess - Load settings :");

  SetEnabled(enabled);

  int tmp;
  if (XMLUtils::GetInt(pRootElement, "netinittimeout", tmp, 0, 5 * 60))
    m_netinit_sec = tmp;
  CLog::Log(LOGNOTICE,"  -Network init timeout : [%d] sec", m_netinit_sec);
  
  if (XMLUtils::GetInt(pRootElement, "netsettletime", tmp, 0, 5 * 1000))
    m_netsettle_ms = tmp;
  CLog::Log(LOGNOTICE,"  -Network settle time  : [%d] ms", m_netsettle_ms);

  const TiXmlNode* pWakeUp = pRootElement->FirstChildElement("wakeup");
  while (pWakeUp)
  {
    WakeUpEntry entry;

    std::string strtmp;
    if (XMLUtils::GetString(pWakeUp, "host", strtmp))
      entry.host = strtmp;

    if (XMLUtils::GetString(pWakeUp, "mac", strtmp))
      entry.mac = strtmp;

    if (entry.host.empty())
      CLog::Log(LOGERROR, "%s - Missing <host> tag or it's empty", __FUNCTION__);
    else if (entry.mac.empty())
       CLog::Log(LOGERROR, "%s - Missing <mac> tag or it's empty", __FUNCTION__);
    else
    {
      if (XMLUtils::GetInt(pWakeUp, "pingport", tmp, 0, USHRT_MAX))
        entry.ping_port = (unsigned short) tmp;

      if (XMLUtils::GetInt(pWakeUp, "pingmode", tmp, 0, USHRT_MAX))
        entry.ping_mode = (unsigned short) tmp;

      if (XMLUtils::GetInt(pWakeUp, "timeout", tmp, 10, 12 * 60 * 60))
        entry.timeout.SetDateTimeSpan (0, 0, 0, tmp);

      if (XMLUtils::GetInt(pWakeUp, "waitonline", tmp, 0, 10 * 60)) // max 10 minutes
        entry.wait_online1_sec = tmp;

      if (XMLUtils::GetInt(pWakeUp, "waitonline2", tmp, 0, 10 * 60)) // max 10 minutes
        entry.wait_online2_sec = tmp;

      if (XMLUtils::GetInt(pWakeUp, "waitservices", tmp, 0, 5 * 60)) // max 5 minutes
        entry.wait_services_sec = tmp;

      CLog::Log(LOGNOTICE,"  Registering wakeup entry:");
      CLog::Log(LOGNOTICE,"    HostName        : %s", entry.host.c_str());
      CLog::Log(LOGNOTICE,"    MacAddress      : %s", entry.mac.c_str());
      CLog::Log(LOGNOTICE,"    PingPort        : %d", entry.ping_port);
      CLog::Log(LOGNOTICE,"    PingMode        : %d", entry.ping_mode);
      CLog::Log(LOGNOTICE,"    Timeout         : %d (sec)", GetTotalSeconds(entry.timeout));
      CLog::Log(LOGNOTICE,"    WaitForOnline   : %d (sec)", entry.wait_online1_sec);
      CLog::Log(LOGNOTICE,"    WaitForOnlineEx : %d (sec)", entry.wait_online2_sec);
      CLog::Log(LOGNOTICE,"    WaitForServices : %d (sec)", entry.wait_services_sec);

      m_entries.push_back(entry);
    }

    pWakeUp = pWakeUp->NextSiblingElement("wakeup"); // get next one
  }
}
void TAbstractWindow::Enable() {
    SetEnabled(true);
}
Exemple #16
0
	void Changer::on_IDString__textChanged ()
	{
		SetEnabled ();
	}
void TAbstractWindow::Disable() {
    SetEnabled(false);
}
Bool16 MP3Broadcaster::ConfigSetter( const char* paramName, const char* paramValue[], void* userData )
{
    // return true if set fails
    MP3Broadcaster* thisPtr = (MP3Broadcaster*)userData;

    if (!::strcmp( "destination_ip_address", paramName) )
    {   
        if (strlen(paramValue[0]) >= sizeof(thisPtr->mIPAddr))
            return true;
        
        strcpy(thisPtr->mIPAddr, paramValue[0]);
        return false;
    }
    else if (!::strcmp( "destination_base_port", paramName) )
    {
        thisPtr->mPort = atoi(paramValue[0]);

        return false;
    }
    else if (!::strcmp( "max_upcoming_list_size", paramName) )
    {
        if ( ::atoi( paramValue[0] )  < 0 )
            return true;
            
        thisPtr->mUpcomingSongsListSize = ::atoi( paramValue[0] );
        return false;
    }
    else if (!::strcmp( "play_mode", paramName) )
    {
        if (strlen(paramValue[0]) >= sizeof(thisPtr->mPlayMode))
            return true;
        
        strcpy(thisPtr->mPlayMode, paramValue[0]);
        return false;
    }   
    else if (!::strcmp( "recent_songs_list_size", paramName) )
    {
        if ( ::atoi( paramValue[0] )  < 0 )
            return true;
            
        thisPtr->mRecentSongsListSize = ::atoi( paramValue[0] );
        return false;
    }
    else if (!::strcmp( "playlist_file", paramName) )
    {
        if (strlen(paramValue[0]) >= sizeof(thisPtr->mPlayListPath))
            return true;
        
        strcpy(thisPtr->mPlayListPath, paramValue[0]);
        return false;
    }
    else if (!::strcmp( "working_dir", paramName) )
    {
        if (strlen(paramValue[0]) >= sizeof(thisPtr->mWorkingDirPath))
            return true;
        
        strcpy(thisPtr->mWorkingDirPath, paramValue[0]);
        return false;
    }
    else if (!::strcmp( "logging", paramName) )
    {
        return SetEnabled(paramValue[0], &thisPtr->mLogging);
    }
    else if (!::strcmp( "show_current", paramName) )
    {
        return SetEnabled(paramValue[0], &thisPtr->mShowCurrent);
    }
    else if (!::strcmp( "show_upcoming", paramName) )
    {
        return SetEnabled(paramValue[0], &thisPtr->mShowUpcoming);
    }
    else if (!::strcmp( "use_icy", paramName) )
    {
        return SetEnabled(paramValue[0], &thisPtr->mUseICY);
    }
    else if (!::strcmp( "broadcast_name", paramName) )
    {
        if (strlen(paramValue[0]) >= sizeof(thisPtr->mName))
            return true;
        
        strcpy(thisPtr->mName, paramValue[0]);
        return false;
    }
    else if (!::strcmp( "broadcast_password", paramName) )
    {
        if (strlen(paramValue[0]) >= sizeof(thisPtr->mPassword))
            return true;
        
        strcpy(thisPtr->mPassword, paramValue[0]);
        return false;
    }
    else if (!::strcmp( "broadcast_genre", paramName) )
    {
        if (strlen(paramValue[0]) >= sizeof(thisPtr->mGenre))
            return true;
        
        strcpy(thisPtr->mGenre, paramValue[0]);
        return false;
    }
    else if (!::strcmp( "broadcast_url", paramName) )
    {
        if (strlen(paramValue[0]) >= sizeof(thisPtr->mURL))
            return true;
        
        strcpy(thisPtr->mURL, paramValue[0]);
        return false;
    }
    else if (!::strcmp( "broadcast_bitrate", paramName) )
    {
        if ( ::atoi( paramValue[0] )  < 0 )
            return true;
            
        thisPtr->mBitRate = ::atoi( paramValue[0] );
        return false;
    }
    else if (!::strcmp( "broadcast_sample_rate", paramName) )
    {
        if ( ::atoi( paramValue[0] )  < -1 )
            return true;
            
        thisPtr->mFrequency = ::atoi( paramValue[0] );
        return false;
    }
    else if (!::strcmp( "broadcast_mount_point", paramName) )
    {
        if (strlen(paramValue[0]) >= sizeof(thisPtr->mMountPoint))
            return true;
        // Make sure the mountpoint always begins with a '/' character.
        // If its missing prepend it to the mountpoint name for them.
        thisPtr->mMountPoint[0] = '\0';
        if (*paramValue[0] != '/')
            strcpy(thisPtr->mMountPoint, "/");
        strcat(thisPtr->mMountPoint, paramValue[0]);
        return false;
    }
    else if (!::strcmp( "pid_file", paramName) )
    {
        if (strlen(paramValue[0]) >= sizeof(thisPtr->mPIDFile))
            return true;
        
        strcpy(thisPtr->mPIDFile, paramValue[0]);
        return false;
    }
    else if (!::strcmp( "max_err_file_k_size", paramName) )
    {
        if ( !paramValue[0] || !::strlen(paramValue[0]) )
             return true;
			
        UInt32 setvalue = kSInt32_Max;
        int maxValue = ::atoi( paramValue[0] );
        if (maxValue >= 0)
            setvalue = (UInt32) maxValue;
		
        qtss_setmaxprintfcharsinK( (UInt32) setvalue);
        return false;
    }
    
    return true;
}
void AnimatedWarrior_cl::InitFunction()
{
  SetCastShadows(TRUE);
  
  SetupAnimations();
  if (!m_bModelValid)
    return;

	m_pCharacterController = new vHavokCharacterController();
	m_pCharacterController->Initialize();

	hkvAlignedBBox bbox;
	GetMesh()->GetCollisionBoundingBox(bbox);

  float r = bbox.getSizeX() * 0.5f;
	m_pCharacterController->Capsule_Radius = r;
	m_pCharacterController->Character_Top.set(0,0,bbox.m_vMax.z - r);
  m_pCharacterController->Character_Bottom.set(0,0,bbox.m_vMin.z + r);

 	m_pCharacterController->Max_Slope = 75.0f;

  if (!m_bEnabled)
    m_pCharacterController->SetEnabled(FALSE);

	AddComponent(m_pCharacterController);

  //// setup animation system
  // create config
  VDynamicMesh* pMesh = GetMesh();
  VASSERT(pMesh);
  VisSkeleton_cl* pSkeleton = pMesh->GetSkeleton();
  VASSERT(pSkeleton);

  // create mixer structure, we keep pointers on the mixers to add and remove inputs
  m_spLayerMixer = new VisAnimLayerMixerNode_cl(pSkeleton);

  m_pNormalizeMixer = new VisAnimNormalizeMixerNode_cl(pSkeleton);
  m_spLayerMixer->AddMixerInput(m_pNormalizeMixer, 1.f);

  //// create per bone weighting list for upper body
  int iBoneCount = pSkeleton->GetBoneCount();
  float* fPerBoneWeightingList = new float[iBoneCount];
  memset(fPerBoneWeightingList, 0, sizeof(float)*iBoneCount);

  // set all bone weights above the spine to 1
  pSkeleton->SetBoneWeightRecursive(1.f, pSkeleton->GetBoneIndexByName("skeleton1:Spine"), fPerBoneWeightingList);

  int iMixerInputIndex = -1;

  for(int i=0; i<UPPERBODY_CONTROLCOUNT; i++)
  {
    m_spUpperBodyControls[i] = new VisSkeletalAnimControl_cl(pSkeleton, VSKELANIMCTRL_DEFAULTS);
    m_spUpperBodyControls[i]->AddEventListener(this); // we want to receive all events from sequence and control
    iMixerInputIndex = m_spLayerMixer->AddMixerInput(m_spUpperBodyControls[i], 0.f);
    m_spLayerMixer->ApplyPerBoneWeightingMask(iMixerInputIndex, iBoneCount, fPerBoneWeightingList);
  }
  
  V_SAFE_DELETE_ARRAY(fPerBoneWeightingList);

  // set the start animation
  BlendOverFullBodyAnimation(0.f, ANIMID_IDLE, 1.f, 0.f);
 
  SetFullBodyState(m_pFullBodyIdleState[FBSTATETYPE_NORMAL]);
  SetUpperBodyState(m_pUpperBodyIdleState);

  // initialize variables for upperbody fadein/fadeout
  m_eUpperBodyFadeState = FADESTATE_NONE;

  // setup neck bone for head rotation
  m_iHeadBoneIndex = pSkeleton->GetBoneIndexByName("skeleton1:Neck");
  m_fHeadRotationAngles[0] = 0.f; m_fHeadRotationAngles[1] = 0.f; m_fHeadRotationAngles[2] = 0.f;
  m_bHeadInMovement = false;

  // setup the torch
  hkvVec3 vDummyOrigin;
  m_pTorch = (AttachedTorch_cl *) Vision::Game.CreateEntity( "AttachedTorch_cl", vDummyOrigin );
  
  HideTorch();

  // attach the torch to the bone
  //hkvVec3 localTranslation(-11.f, -4.5f, 25.f);
  hkvVec3 localTranslation(-11.f, 5.5f, 0.f);
  float euler[3] = {90, 0, 185};
  hkvQuat localRotation;
  localRotation.setFromEulerAngles (euler[2], euler[1], euler[0]); // pass as roll, pitch, yaw
  m_pTorch->Attach(this, "skeleton1:RightHand", localRotation, localTranslation);

  SetEnabled(true);
}
QtPropertyDataInspColl::QtPropertyDataInspColl(void *_object, const DAVA::InspColl *_collection, bool autoAddChilds)
	: object(_object)
	, collection(_collection)
{
	if(NULL != collection && collection->Size(object) > 0 && autoAddChilds)
	{
		int index = 0;
		DAVA::MetaInfo *valueType = collection->ItemType();
		DAVA::InspColl::Iterator i = collection->Begin(object);
		while(NULL != i)
		{
			if(NULL != valueType->GetIntrospection())
			{
				void * itemObject = collection->ItemData(i);
				const DAVA::InspInfo *itemInfo = valueType->GetIntrospection(itemObject);

				if(NULL != itemInfo && NULL != itemObject)
				{
					QtPropertyData *childData = new QtPropertyDataIntrospection(itemObject, itemInfo);
					ChildAdd(QString::number(index), childData);
				}
				else
				{
					QString s;
					QtPropertyData* childData = new QtPropertyData(s.sprintf("[%p] Pointer", itemObject));
					childData->SetEnabled(false);
					ChildAdd(QString::number(index), childData);
				}
			}
			else
			{
				if(!valueType->IsPointer())
				{
					QtPropertyDataMetaObject *childData = new QtPropertyDataMetaObject(collection->ItemPointer(i), valueType);
					ChildAdd(QString::number(index), childData);
				}
				else
				{
					QString s;
					QtPropertyData* childData = new QtPropertyData(s.sprintf("[%p] Pointer", collection->ItemData(i)));
					childData->SetEnabled(false);

					if(collection->ItemKeyType() == DAVA::MetaInfo::Instance<DAVA::FastName>())
					{
						const DAVA::FastName *fname = (const DAVA::FastName *) collection->ItemKeyData(i);
						ChildAdd(fname->operator*(), childData);
					}
					else
					{
						ChildAdd(QString::number(index), childData);
					}
				}
			}

			index++;
			i = collection->Next(i);
		}
	}

	SetEnabled(false);
}
Exemple #21
0
void
TrackingConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  const TrackingSettings &settings =
    CommonInterface::GetComputerSettings().tracking;

  RowFormWidget::Prepare(parent, rc);

#ifdef HAVE_SKYLINES_TRACKING
  AddBoolean(_T("SkyLines"), nullptr, settings.skylines.enabled, this);
#ifdef HAVE_NET_STATE_ROAMING
  AddBoolean(_T("Roaming"), nullptr, settings.skylines.roaming, this);
#endif
  AddEnum(_("Tracking Interval"), nullptr, tracking_intervals,
          settings.skylines.interval);

  AddBoolean(_("Track friends"),
             _("Download the position of your friends live from the SkyLines server."),
             settings.skylines.traffic_enabled, this);

  AddBoolean(_("Show nearby traffic"),
             _("Download the position of your nearby traffic live from the SkyLines server."),
             settings.skylines.near_traffic_enabled, this);

  StaticString<64> buffer;
  if (settings.skylines.key != 0)
    buffer.UnsafeFormat(_T("%llX"), (unsigned long long)settings.skylines.key);
  else
    buffer.clear();
  AddText(_T("Key"), nullptr, buffer);
#endif

#if defined(HAVE_SKYLINES_TRACKING) && defined(HAVE_LIVETRACK24)
  AddSpacer();
#endif

#ifdef HAVE_LIVETRACK24
  AddBoolean(_T("LiveTrack24"),  _T(""), settings.livetrack24.enabled, this);

  AddTime(_("Tracking Interval"), _T(""), 5, 3600, 5, settings.interval);

  AddEnum(_("Vehicle Type"), _("Type of vehicle used."), vehicle_type_list,
          (unsigned) settings.vehicleType);
  AddText(_("Vehicle Name"), _T("Name of vehicle used."),
          settings.vehicle_name);

  WndProperty *edit = AddEnum(_("Server"), _T(""), server_list, 0);
  ((DataFieldEnum *)edit->GetDataField())->Set(settings.livetrack24.server);
  edit->RefreshDisplay();

  AddText(_("Username"), _T(""), settings.livetrack24.username);
  AddPassword(_("Password"), _T(""), settings.livetrack24.password);
#endif

#ifdef HAVE_SKYLINES_TRACKING
  SetSkyLinesEnabled(settings.skylines.enabled);
#endif

#ifdef HAVE_LIVETRACK24
  SetEnabled(settings.livetrack24.enabled);
#endif
}
Exemple #22
0
void Tool::Reload( const WbConfig& config )
{
    SetCurrentConfigFrom( config );
    SetEnabled( ShouldEnableForConfig( config ) );
    ReloadCurrentConfig();
}
Exemple #23
0
LEDs::LEDs() {
	SetEnabled(true);
}
 plAxisInputInterface( plAxisAnimModifier *owner ) { fOwner = owner; SetEnabled( true ); }
plAvatarInputInterface::plAvatarInputInterface()
{
    fInstance = this;
    fMouseDisabled = false;
    fCurrentCursor = kCursorUp;
    fCursorOpacity = 1.f;
    fCursorTimeout = 0;
    fCursorFadeDelay = 3.f;
    f3rdPerson = true;
    fInputMap = nil;
    ISetBasicMode(); // Must be after 3rdPerson and fInputMap are set.
    SetEnabled( true );         // Always enabled

    // Add our control codes to our control map. Do NOT add the key bindings yet.
    // Note: HERE is where you specify the actions for each command, i.e. net propagate and so forth.
    // This part basically declares us master of the bindings for these commands.
    
    // IF YOU ARE LOOKING TO CHANGE THE DEFAULT KEY BINDINGS, DO NOT LOOK HERE. GO TO
    // RestoreDefaultKeyMappings()!!!!

#ifndef LIMIT_VOICE_CHAT
    // only allow mapping of 'PushToTalk in online versions'
    fControlMap->AddCode( S_PUSH_TO_TALK,                   kControlFlagNormal | kControlFlagNoRepeat );
#endif
    fControlMap->AddCode( S_SET_FIRST_PERSON_MODE,          kControlFlagNormal | kControlFlagNoRepeat );
    fControlMap->AddCode( B_CONTROL_EXIT_MODE,              kControlFlagNormal | kControlFlagNoRepeat );

    fControlMap->AddCode( B_CAMERA_ZOOM_IN,                 kControlFlagNormal );
    fControlMap->AddCode( B_CAMERA_ZOOM_OUT,                kControlFlagNormal );

    fControlMap->AddCode( B_CONTROL_MODIFIER_FAST,          kControlFlagNormal | kControlFlagNoRepeat );
    fControlMap->AddCode( B_CONTROL_MODIFIER_STRAFE,        kControlFlagNormal | kControlFlagNoRepeat );
    fControlMap->AddCode( B_CONTROL_MOVE_FORWARD,           kControlFlagNormal | kControlFlagNoRepeat );
    fControlMap->AddCode( B_CONTROL_MOVE_BACKWARD,          kControlFlagNormal | kControlFlagNoRepeat );
    fControlMap->AddCode( B_CONTROL_ROTATE_LEFT,            kControlFlagNormal | kControlFlagNoRepeat );
    fControlMap->AddCode( B_CONTROL_ROTATE_RIGHT,           kControlFlagNormal | kControlFlagNoRepeat );
    fControlMap->AddCode( B_CONTROL_STRAFE_LEFT,            kControlFlagNormal | kControlFlagNoRepeat );
    fControlMap->AddCode( B_CONTROL_STRAFE_RIGHT,           kControlFlagNormal | kControlFlagNoRepeat );
        

    fControlMap->AddCode( B_CONTROL_ALWAYS_RUN,             kControlFlagToggle | kControlFlagUpEvent | kControlFlagNoRepeat );


    fControlMap->AddCode( B_CONTROL_JUMP,                   kControlFlagNormal | kControlFlagNoRepeat );
    fControlMap->AddCode( B_CONTROL_DIVE,                   kControlFlagNormal | kControlFlagNoRepeat );
    fControlMap->AddCode( B_CONTROL_IGNORE_AVATARS,         kControlFlagNormal | kControlFlagNoRepeat );

    fControlMap->AddConsoleCommand( "Game.EnterChatMode" );
    fControlMap->AddConsoleCommand( "Game.Emote.wave" );
    fControlMap->AddConsoleCommand( "Game.Emote.laugh" );
    fControlMap->AddConsoleCommand( "Game.Emote.clap" );
    fControlMap->AddConsoleCommand( "Game.Emote.dance" );
    fControlMap->AddConsoleCommand( "Game.Emote.talk" );
    fControlMap->AddConsoleCommand( "Game.Emote.sneeze" );
    fControlMap->AddConsoleCommand( "Game.Emote.sit" );
    fControlMap->AddConsoleCommand( "Keyboard.ResetBindings" );
    
    fControlMap->AddConsoleCommand( "Game.KIOpenKI" );
    fControlMap->AddConsoleCommand( "Game.KIHelp" );
    fControlMap->AddConsoleCommand( "Game.KICreateMarker" );
    fControlMap->AddConsoleCommand( "Game.KICreateMarkerFolder" );
    fControlMap->AddConsoleCommand( "Game.KIOpenYeeshaBook" );
    fControlMap->AddConsoleCommand( "Game.KIToggleMini" );
    fControlMap->AddConsoleCommand( "Game.KIPutAway" );
    fControlMap->AddConsoleCommand( "Game.KIChatPageUp" );
    fControlMap->AddConsoleCommand( "Game.KIChatPageDown" );
    fControlMap->AddConsoleCommand( "Game.KIChatToStart" );
    fControlMap->AddConsoleCommand( "Game.KIChatToEnd" );
    fControlMap->AddConsoleCommand( "Game.KIUpSizeFont" );
    fControlMap->AddConsoleCommand( "Game.KIDownSizeFont" );
    fControlMap->AddConsoleCommand( "Game.KITakePicture" );
    fControlMap->AddConsoleCommand( "Game.KICreateJournal" );

#ifndef PLASMA_EXTERNAL_RELEASE
    fControlMap->AddCode( B_CONTROL_TOGGLE_PHYSICAL,        kControlFlagDownEvent | kControlFlagNoRepeat );
    fControlMap->AddCode( B_CONTROL_MOVE_UP,                kControlFlagNormal | kControlFlagNoRepeat );
    fControlMap->AddCode( B_CONTROL_MOVE_DOWN,              kControlFlagNormal | kControlFlagNoRepeat );
    fControlMap->AddCode( B_TOGGLE_DRIVE_MODE,              kControlFlagDownEvent | kControlFlagNoRepeat );
    fControlMap->AddConsoleCommand( "NextStatusLog" );
#endif

    // IF YOU ARE LOOKING TO CHANGE THE DEFAULT KEY BINDINGS, DO NOT LOOK HERE. GO TO
    // RestoreDefaultKeyMappings()!!!!
}
void SFilterWidget::FilterToggled(ECheckBoxState NewState)
{
	SetEnabled(NewState == ECheckBoxState::Checked);
}
Exemple #27
0
void SFlareStoryMenu::Exit()
{
	SetEnabled(false);
	SetVisibility(EVisibility::Collapsed);
}
	void CControlUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
	{
		// ÊÇ·ñÑùʽ±í
		if(m_pManager != NULL) {
			LPCTSTR pStyle = m_pManager->GetStyle(pstrValue);
			if( pStyle != NULL) {
				ApplyAttributeList(pStyle);
				return;
			}
		}
		if( _tcsicmp(pstrName, _T("pos")) == 0 ) {
			RECT rcPos = { 0 };
			LPTSTR pstr = NULL;
			rcPos.left = _tcstol(pstrValue, &pstr, 10);  ASSERT(pstr);    
			rcPos.top = _tcstol(pstr + 1, &pstr, 10);    ASSERT(pstr);    
			rcPos.right = _tcstol(pstr + 1, &pstr, 10);  ASSERT(pstr);    
			rcPos.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);    
			SIZE szXY = {rcPos.left >= 0 ? rcPos.left : rcPos.right, rcPos.top >= 0 ? rcPos.top : rcPos.bottom};
			SetFixedXY(szXY);
			SetFixedWidth(rcPos.right - rcPos.left);
			SetFixedHeight(rcPos.bottom - rcPos.top);
		}
		else if( _tcsicmp(pstrName, _T("float")) == 0 ) {
			CDuiString nValue = pstrValue;
			// ¶¯Ì¬¼ÆËãÏà¶Ô±ÈÀý
			if(nValue.Find(',') < 0) {
				SetFloat(_tcsicmp(pstrValue, _T("true")) == 0);
			}
			else {
				TPercentInfo piFloatPercent = { 0 };
				LPTSTR pstr = NULL;
				piFloatPercent.left = _tcstod(pstrValue, &pstr);  ASSERT(pstr);
				piFloatPercent.top = _tcstod(pstr + 1, &pstr);    ASSERT(pstr);
				piFloatPercent.right = _tcstod(pstr + 1, &pstr);  ASSERT(pstr);
				piFloatPercent.bottom = _tcstod(pstr + 1, &pstr); ASSERT(pstr);
				SetFloatPercent(piFloatPercent);
				SetFloat(true);
			}
		}
		else if( _tcsicmp(pstrName, _T("padding")) == 0 ) {
			RECT rcPadding = { 0 };
			LPTSTR pstr = NULL;
			rcPadding.left = _tcstol(pstrValue, &pstr, 10);  ASSERT(pstr);    
			rcPadding.top = _tcstol(pstr + 1, &pstr, 10);    ASSERT(pstr);    
			rcPadding.right = _tcstol(pstr + 1, &pstr, 10);  ASSERT(pstr);    
			rcPadding.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);    
			SetPadding(rcPadding);
		}
		else if( _tcsicmp(pstrName, _T("bkcolor")) == 0 || _tcsicmp(pstrName, _T("bkcolor1")) == 0 ) {
			while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue);
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetBkColor(clrColor);
		}
		else if( _tcsicmp(pstrName, _T("bkcolor2")) == 0 ) {
			while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue);
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetBkColor2(clrColor);
		}
		else if( _tcsicmp(pstrName, _T("bkcolor3")) == 0 ) {
			while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue);
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetBkColor3(clrColor);
		}
		else if( _tcsicmp(pstrName, _T("forecolor")) == 0 ) {
			while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue);
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetForeColor(clrColor);
		}
		else if( _tcsicmp(pstrName, _T("bordercolor")) == 0 ) {
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetBorderColor(clrColor);
		}
		else if( _tcsicmp(pstrName, _T("focusbordercolor")) == 0 ) {
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetFocusBorderColor(clrColor);
		}
		else if( _tcsicmp(pstrName, _T("colorhsl")) == 0 ) SetColorHSL(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("bordersize")) == 0 ) {
			CDuiString nValue = pstrValue;
			if(nValue.Find(',') < 0)
			{
				SetBorderSize(_ttoi(pstrValue));
				RECT rcPadding = {0};
				SetBorderSize(rcPadding);
			}
			else
			{
				RECT rcPadding = { 0 };
				LPTSTR pstr = NULL;
				rcPadding.left = _tcstol(pstrValue, &pstr, 10);  ASSERT(pstr);
				rcPadding.top = _tcstol(pstr + 1, &pstr, 10);    ASSERT(pstr);
				rcPadding.right = _tcstol(pstr + 1, &pstr, 10);  ASSERT(pstr);
				rcPadding.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
				SetBorderSize(rcPadding);
			}
		}
		else if( _tcsicmp(pstrName, _T("leftbordersize")) == 0 ) SetLeftBorderSize(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("topbordersize")) == 0 ) SetTopBorderSize(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("rightbordersize")) == 0 ) SetRightBorderSize(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("bottombordersize")) == 0 ) SetBottomBorderSize(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("borderstyle")) == 0 ) SetBorderStyle(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("borderround")) == 0 ) {
			SIZE cxyRound = { 0 };
			LPTSTR pstr = NULL;
			cxyRound.cx = _tcstol(pstrValue, &pstr, 10);  ASSERT(pstr);    
			cxyRound.cy = _tcstol(pstr + 1, &pstr, 10);    ASSERT(pstr);     
			SetBorderRound(cxyRound);
		}
		else if( _tcsicmp(pstrName, _T("bkimage")) == 0 ) SetBkImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("foreimage")) == 0 ) SetForeImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("width")) == 0 ) SetFixedWidth(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("height")) == 0 ) SetFixedHeight(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("minwidth")) == 0 ) SetMinWidth(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("minheight")) == 0 ) SetMinHeight(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("maxwidth")) == 0 ) SetMaxWidth(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("maxheight")) == 0 ) SetMaxHeight(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("name")) == 0 ) SetName(pstrValue);
		else if( _tcsicmp(pstrName, _T("drag")) == 0 ) SetDragEnable(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("drop")) == 0 ) SetDropEnable(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("resourcetext")) == 0 ) SetResourceText(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("text")) == 0 ) SetText(pstrValue);
		else if( _tcsicmp(pstrName, _T("tooltip")) == 0 ) SetToolTip(pstrValue);
		else if( _tcsicmp(pstrName, _T("userdata")) == 0 ) SetUserData(pstrValue);
		else if( _tcsicmp(pstrName, _T("enabled")) == 0 ) SetEnabled(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("mouse")) == 0 ) SetMouseEnabled(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("keyboard")) == 0 ) SetKeyboardEnabled(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("visible")) == 0 ) SetVisible(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("float")) == 0 ) SetFloat(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("shortcut")) == 0 ) SetShortcut(pstrValue[0]);
		else if( _tcsicmp(pstrName, _T("menu")) == 0 ) SetContextMenuUsed(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("virtualwnd")) == 0 ) SetVirtualWnd(pstrValue);
		else if( _tcsicmp(pstrName, _T("innerstyle")) == 0 ) {
			CDuiString sXmlData = pstrValue;
			sXmlData.Replace(_T("&quot;"), _T("\""));
			LPCTSTR pstrList = sXmlData.GetData();
			CDuiString sItem;
			CDuiString sValue;
			while( *pstrList != _T('\0') ) {
				sItem.Empty();
				sValue.Empty();
				while( *pstrList != _T('\0') && *pstrList != _T('=') ) {
					LPTSTR pstrTemp = ::CharNext(pstrList);
					while( pstrList < pstrTemp) {
						sItem += *pstrList++;
					}
				}
				ASSERT( *pstrList == _T('=') );
				if( *pstrList++ != _T('=') ) return;
				ASSERT( *pstrList == _T('\"') );
				if( *pstrList++ != _T('\"') ) return;
				while( *pstrList != _T('\0') && *pstrList != _T('\"') ) {
					LPTSTR pstrTemp = ::CharNext(pstrList);
					while( pstrList < pstrTemp) {
						sValue += *pstrList++;
					}
				}
				ASSERT( *pstrList == _T('\"') );
				if( *pstrList++ != _T('\"') ) return;
				SetAttribute(sItem, sValue);
				if( *pstrList++ != _T(' ') && *pstrList++ != _T(',') ) return;
			}
		}
	}
Exemple #29
0
Variant TimerObject::m_Start(int numargs, Variant args[])
{
    SetEnabled(true);
    return VARNULL;
}
Exemple #30
0
MenuItem::MenuItem(Renderer* pRenderer, unsigned int GUIFont, unsigned int OutlineGUIFont, const std::string &label, Colour lLabelColour, Colour outlineColour)
  : AbstractButton(pRenderer, GUIFont, label)
{
	m_pDefaultIcon = new DirectDrawRectangle(pRenderer);
	m_pHoverIcon = new DirectDrawRectangle(pRenderer);
	m_pSelectedIcon = new DirectDrawRectangle(pRenderer);
	m_pDisabledIcon = new DirectDrawRectangle(pRenderer);

	DirectDrawRectangle *lpDirectDrawRect = (DirectDrawRectangle *)m_pDefaultIcon;
	lpDirectDrawRect->SetBackgroundColourTopLeft(Colour(0.52f, 0.53f, 0.91f, 1.0f));
	lpDirectDrawRect->SetBackgroundColourTopRight(Colour(0.52f, 0.53f, 0.91f, 1.0f));
	lpDirectDrawRect->SetBackgroundColourBottomLeft(Colour(0.52f, 0.53f, 0.91f, 1.0f));
	lpDirectDrawRect->SetBackgroundColourBottomRight(Colour(0.52f, 0.53f, 0.91f, 1.0f));
	lpDirectDrawRect->SetOutlineColourTop(Colour(1.0f, 1.0f, 1.0f, 1.0f));
	lpDirectDrawRect->SetOutlineColourBottom(Colour(0.0f, 0.0f, 0.0f, 1.0f));
	lpDirectDrawRect->SetOutlineColourLeft(Colour(1.0f, 1.0f, 1.0f, 1.0f));
	lpDirectDrawRect->SetOutlineColourRight(Colour(0.0f, 0.0f, 0.0f, 1.0f));

	lpDirectDrawRect = (DirectDrawRectangle *)m_pHoverIcon;
	lpDirectDrawRect->SetBackgroundColourTopLeft(Colour(0.25f, 0.25f, 1.0f, 1.0f));
	lpDirectDrawRect->SetBackgroundColourTopRight(Colour(0.25f, 0.25f, 1.0f, 1.0f));
	lpDirectDrawRect->SetBackgroundColourBottomLeft(Colour(0.25f, 0.25f, 1.0f, 1.0f));
	lpDirectDrawRect->SetBackgroundColourBottomRight(Colour(0.25f, 0.25f, 1.0f, 1.0f));
	lpDirectDrawRect->SetOutlineColourTop(Colour(1.0f, 1.0f, 1.0f, 1.0f));
	lpDirectDrawRect->SetOutlineColourBottom(Colour(0.0f, 0.0f, 0.0f, 1.0f));
	lpDirectDrawRect->SetOutlineColourLeft(Colour(1.0f, 1.0f, 1.0f, 1.0f));
	lpDirectDrawRect->SetOutlineColourRight(Colour(0.0f, 0.0f, 0.0f, 1.0f));

	lpDirectDrawRect = (DirectDrawRectangle *)m_pSelectedIcon;
	lpDirectDrawRect->SetBackgroundColourTopLeft(Colour(0.25f, 0.25f, 1.0f, 1.0f));
	lpDirectDrawRect->SetBackgroundColourTopRight(Colour(0.25f, 0.25f, 1.0f, 1.0f));
	lpDirectDrawRect->SetBackgroundColourBottomLeft(Colour(0.25f, 0.25f, 1.0f, 1.0f));
	lpDirectDrawRect->SetBackgroundColourBottomRight(Colour(0.25f, 0.25f, 1.0f, 1.0f));
	lpDirectDrawRect->SetOutlineColourTop(Colour(0.0f, 0.0f, 0.0f, 1.0f));
	lpDirectDrawRect->SetOutlineColourBottom(Colour(1.0f, 1.0f, 1.0f, 1.0f));
	lpDirectDrawRect->SetOutlineColourLeft(Colour(0.0f, 0.0f, 0.0f, 1.0f));
	lpDirectDrawRect->SetOutlineColourRight(Colour(1.0f, 1.0f, 1.0f, 1.0f));

	lpDirectDrawRect = (DirectDrawRectangle *)m_pDisabledIcon;
	lpDirectDrawRect->SetBackgroundColourTopLeft(Colour(0.75f, 0.75f, 0.75f, 1.0f));
	lpDirectDrawRect->SetBackgroundColourTopRight(Colour(0.75f, 0.75f, 0.75f, 1.0f));
	lpDirectDrawRect->SetBackgroundColourBottomLeft(Colour(0.75f, 0.75f, 0.75f, 1.0f));
	lpDirectDrawRect->SetBackgroundColourBottomRight(Colour(0.75f, 0.75f, 0.75f, 1.0f));
	lpDirectDrawRect->SetOutlineColourTop(Colour(0.25f, 0.25f, 0.25f, 1.0f));
	lpDirectDrawRect->SetOutlineColourBottom(Colour(0.25f, 0.25f, 0.25f, 1.0f));
	lpDirectDrawRect->SetOutlineColourLeft(Colour(0.25f, 0.25f, 0.25f, 1.0f));
	lpDirectDrawRect->SetOutlineColourRight(Colour(0.25f, 0.25f, 0.25f, 1.0f));

	Add(m_pDefaultIcon);
	Add(m_pSelectedIcon);
	Add(m_pHoverIcon);
	Add(m_pDisabledIcon);

	m_label.SetLocation(0, 0);
	m_label.SetColour(lLabelColour);
	m_label.SetOutline(true);
	m_label.SetOutlineColour(outlineColour);
	m_label.SetOutlineFont(OutlineGUIFont);
	Add(&m_label);

	m_pDefaultIcon->SetDepth(3.0f);
	m_pSelectedIcon->SetDepth(3.0f);
	m_pHoverIcon->SetDepth(3.0f);
	m_pDisabledIcon->SetDepth(3.0f);

	// Start out disabled, since most menus are not open to start with...
	SetEnabled(false);

	m_bOnlyShowSelectedItems = false;
}