Example #1
1
void BrowseFolderMenuItem::onSelect()
{
	if (SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)))
	{
		DropDownMenu* dropDownMenu = dynamic_cast<DropDownMenu*>(getParent());
		if (dropDownMenu)
		{
			BROWSEINFO browseInfo;
			ZeroMemory(&browseInfo, sizeof(browseInfo));
			browseInfo.hwndOwner = winOS->GetWindowsHandle();
			browseInfo.ulFlags = BIF_USENEWUI | BIF_RETURNONLYFSDIRS;
			PIDLIST_ABSOLUTE pidl = SHBrowseForFolder(&browseInfo);
			if (pidl)
			{	
				if (winOS->GetLibraryManager())
				{
					QSharedPointer<Library> library = winOS->GetLibraryManager()->addFolderAsLibrary(pidl);
					if (library)
					{
						LOG(QString("Library Directory: %1\n").arg(library->getFolderPaths().front()));
						
						// Save the newly created library
						QList<QString> otherLibs = winOS->GetLibraryManager()->getFolderLibraryDirectories();
						GLOBAL(settings).otherLibraries = otherLibs;
						winOS->SaveSettingsFile();
						
						LibraryMenuItem* item = new LibraryMenuItem(library);
						dropDownMenu->select(item);
						SwitchToLibrary(library);
					}
				}
				CoTaskMemFree(pidl);
			}
			else
			{
				// Reselect the last selected object, since this selection failed
				dropDownMenu->select(dropDownMenu->items().front());
			}
		}
		CoUninitialize();
	}
}
void BuildingsCreateWindow::Create()
{
	DarwiniaWindow::Create();

	int y = 25;
	int ySpacing = 18;

    DropDownMenu *menu = new DropDownMenu(true);
    menu->SetShortProperties( LANGUAGEPHRASE("editor_buildingtype"), 10, 25, m_w - 20 );
    menu->RegisterInt( &m_buildingType );
    RegisterButton( menu );
    for (int i = Building::TypeInvalid + 1; i < Building::NumBuildingTypes; ++i)
    {
        menu->AddOption( Building::GetTypeNameTranslated(i), i );
    }

    NewBuildingButton *b = new NewBuildingButton();
    b->SetShortProperties( LANGUAGEPHRASE("editor_createbuilding"), 10, 45, m_w - 20 );
    RegisterButton( b );

//	for (int i = Building::TypeInvalid + 1; i < Building::NumBuildingTypes; ++i)
//	{
//	    NewBuildingButton *n = new NewBuildingButton(i);
//        char *name = Building::GetTypeName( i );
//        n->SetShortProperties( name, 10, y, m_w - 20 );
//		RegisterButton( n );
//		y += ySpacing;
//	}
}
 void MouseUp()
 {
     EclButton *paramType = m_parent->GetButton( "ParameterType" );
     DropDownMenu *menu = (DropDownMenu *) paramType;
     if( menu->GetSelectionValue() == SoundParameter::TypeLinked )
     {
         DropDownMenu::MouseUp();
     }
 }
 void Render( int realX, int realY, bool highlighted, bool clicked )
 {
     EclButton *paramType = m_parent->GetButton( "ParameterType" );
     DropDownMenu *menu = (DropDownMenu *) paramType;
     if( menu->GetSelectionValue() == SoundParameter::TypeLinked )
     {
         DropDownMenu::Render( realX, realY, highlighted, clicked );
     }
 }
Example #5
0
void GameSettings::UpdateSelectMissionButton()
{
	DropDownMenu *menu = dynamic_cast< DropDownMenu* >( FindChildByName( "DrpSelectMission", true ) );
	if ( !menu )
		return;

	BaseModHybridButton *button = menu->GetButton(); //dynamic_cast< BaseModHybridButton* >( FindChildByName( "BtnSelectMission", true ) );
	if ( m_pSettings && button )
	{
		const char *szGameType = m_pSettings->GetString( "game/mode", "sdk" );
		if ( !Q_stricmp( szGameType, "campaign" ) )
		{
			button->SetText( "#ASUI_Select_Campaign" );
			button->SetHelpText( "#ASUI_Select_Campaign_tt" );
		}
		else if ( !Q_stricmp( szGameType, "single_mission" ) )
		{
			button->SetText( "#ASUI_Select_Mission" );
			button->SetHelpText( "#ASUI_Select_Mission_tt" );
		}
		else if( !Q_stricmp( szGameType, "sdk" ) )
		{
			button->SetText( "Select Map" );
			button->SetHelpText( "SDK select map example" );
		}
		else if( !Q_stricmp( szGameType, "swarmkeeper" ) )
		{
			button->SetText( "Select level" );
			button->SetHelpText( "Select a Swarm Keeper level" );
		}
	}
	/*
	BaseModHybridButton *button = dynamic_cast< BaseModHybridButton* >( FindChildByName( "BtnSelectMission" ) );
	if ( m_pSettings && button )
	{
		const char *szGameType = m_pSettings->GetString( "game/mode", "campaign" );
		if ( !Q_stricmp( szGameType, "campaign" ) )
		{
			button->SetText( "#ASUI_Select_Campaign" );
			button->SetHelpText( "#ASUI_Select_Campaign_tt" );
		}
		else if ( !Q_stricmp( szGameType, "single_mission" ) )
		{
			button->SetText( "#ASUI_Select_Mission" );
			button->SetHelpText( "#ASUI_Select_Mission_tt" );
		}
	}
	*/
}
    void SelectOption( int _option )
    {
        PrefsKeybindingsWindow *parent = (PrefsKeybindingsWindow *) m_parent;
        if( parent && _option != parent->m_controlMethod )
        {
            parent->Remove();
            // This button now deleted
            parent->m_controlMethod = _option;
            parent->Create();

            DropDownMenu *newMenu = (DropDownMenu *) parent->GetButton( LANGUAGEPHRASE("newcontrols_prefsoption") );
            if( newMenu ) newMenu->SelectOption( _option );
        }
        else
        {
            DropDownMenu::SelectOption( _option );
        }
    }
void CheatWindow::Create()
{
    DarwiniaWindow::Create();
    
    int y = 25;

    bool show = true;

    if( show )
    {
        KillAllEnemiesButton *killAllEnemies = new KillAllEnemiesButton();
        killAllEnemies->SetShortProperties( "Kill All Enemies", 10, y, m_w - 20, -1, UnicodeString("Kill All Enemies") );
        RegisterButton( killAllEnemies );
	    m_buttonOrder.PutData( killAllEnemies );

        SpawnDarwiniansButton *spawnDarwiniansGreen = new SpawnDarwiniansButton();
        spawnDarwiniansGreen->SetShortProperties( "Spawn Green", 10, y += 20, (m_w - 25)/2, -1, UnicodeString("Spawn Green") );
        spawnDarwiniansGreen->m_teamId = 0;
        RegisterButton( spawnDarwiniansGreen );
	    m_buttonOrder.PutData( spawnDarwiniansGreen );

        SpawnDarwiniansButton *spawnDarwiniansRed = new SpawnDarwiniansButton();
        spawnDarwiniansRed->SetShortProperties( "Spawn Red", spawnDarwiniansGreen->m_x+spawnDarwiniansGreen->m_w+5, y, (m_w - 25)/2,  -1, UnicodeString("Spawn Red") );
        if( g_app->m_location )
        {
            spawnDarwiniansRed->m_teamId = 1;
        }
        RegisterButton( spawnDarwiniansRed );
	    m_buttonOrder.PutData( spawnDarwiniansRed );

        SpawnDarwiniansButton *spawnDarwiniansYellow = new SpawnDarwiniansButton();
        spawnDarwiniansYellow->SetShortProperties( "Spawn Yellow", 10, y += 20, (m_w - 25)/2,  -1, UnicodeString("Spawn Yellow") );
        spawnDarwiniansYellow->m_teamId = 2;
        RegisterButton( spawnDarwiniansYellow );
	    m_buttonOrder.PutData( spawnDarwiniansYellow );

        SpawnDarwiniansButton *spawnDarwiniansblue = new SpawnDarwiniansButton();
        spawnDarwiniansblue->SetShortProperties( "Spawn Blue", spawnDarwiniansGreen->m_x+spawnDarwiniansGreen->m_w+5, y, (m_w - 25)/2,  -1, UnicodeString("Spawn Blue") );
        spawnDarwiniansblue->m_teamId = 3;
        RegisterButton( spawnDarwiniansblue );
	    m_buttonOrder.PutData( spawnDarwiniansblue );

        SpawnDarwiniansButton *spawnDarwiniansmonster = new SpawnDarwiniansButton();
        spawnDarwiniansmonster->SetShortProperties( "Spawn Virus", 10, y += 20, (m_w - 25)/2, -1, UnicodeString("Spawn Virus") );
        if( g_app->m_location )
        {
            spawnDarwiniansmonster->m_teamId = g_app->m_location->GetMonsterTeamId();
        }
        RegisterButton( spawnDarwiniansmonster );
	    m_buttonOrder.PutData( spawnDarwiniansmonster );

        SpawnDarwiniansButton *spawnDarwiniansfuture = new SpawnDarwiniansButton();
        spawnDarwiniansfuture->SetShortProperties( "Spawn Future", spawnDarwiniansGreen->m_x+spawnDarwiniansGreen->m_w+5, y, (m_w - 25)/2, -1, UnicodeString("Spawn Future") );
        if( g_app->m_location )
        {
            spawnDarwiniansfuture->m_teamId = g_app->m_location->GetFuturewinianTeamId();
        }
        RegisterButton( spawnDarwiniansfuture );
	    m_buttonOrder.PutData( spawnDarwiniansfuture );

        SpawnTankButton *spawnTankButton = new SpawnTankButton();
        spawnTankButton->SetShortProperties( "Spawn Armour", 10, y += 20, m_w - 20, -1, UnicodeString("Spawn Armour") );
        RegisterButton( spawnTankButton );
	    m_buttonOrder.PutData( spawnTankButton );

        SpawnViriiButton *spawnVirii = new SpawnViriiButton();
        spawnVirii->SetShortProperties( "Spawn Virii", 10, y += 20, m_w - 20, -1, UnicodeString("Spawn Virii") );
        RegisterButton( spawnVirii );
	    m_buttonOrder.PutData( spawnVirii );

        SpawnSpiritButton *spawnSpirits = new SpawnSpiritButton();
        spawnSpirits->SetShortProperties( "Spawn Spirits", 10, y += 20, m_w - 20, -1, UnicodeString("Spawn Spirits") );
        RegisterButton( spawnSpirits );
	    m_buttonOrder.PutData( spawnSpirits );
        
        AllowArbitraryPlacementButton *allowPlacement = new AllowArbitraryPlacementButton();
        allowPlacement->SetShortProperties( "Allow Arbitrary Placement", 10, y += 20, m_w - 20, -1, UnicodeString("Allow Arbitrary Placement") );
        RegisterButton( allowPlacement );
	    m_buttonOrder.PutData( allowPlacement );
        
        EnableGeneratorAndMineButton *enable = new EnableGeneratorAndMineButton();
        enable->SetShortProperties( "Enable Generator and Mine", 10, y += 20, m_w - 20, -1, UnicodeString("Enable Generator and Mine") );
        RegisterButton( enable );
	    m_buttonOrder.PutData( enable );

        EnableReceiverAndBufferButton *receiver = new EnableReceiverAndBufferButton();
        receiver->SetShortProperties( "Enable Receiver and Buffer", 10, y += 20, m_w - 20, -1, UnicodeString("Enable Receiver and Buffer") );
        RegisterButton( receiver );
	    m_buttonOrder.PutData( receiver );

        OpenAllLocationsButton *openAllLocations = new OpenAllLocationsButton();
        openAllLocations->SetShortProperties( "Open All Locations", 10, y += 20, m_w - 20, -1, UnicodeString("Open All Locations") );
        RegisterButton( openAllLocations );
	    m_buttonOrder.PutData( openAllLocations );

        GiveAllResearchButton *allResearch = new GiveAllResearchButton();
        allResearch->SetShortProperties( "Give all research", 10, y += 20, m_w - 20, -1, UnicodeString("Give all research") );
        RegisterButton( allResearch );
	    m_buttonOrder.PutData( allResearch );

        ClearResourcesButton *clearResources = new ClearResourcesButton();
        clearResources->SetShortProperties( "Clear Resources", 10, y += 20, m_w - 20, -1, UnicodeString("Clear Resources") );
        RegisterButton( clearResources );
	    m_buttonOrder.PutData( clearResources );

        SpawnPortsButton *spawnPorts = new SpawnPortsButton();
        spawnPorts->SetShortProperties( "Spawn Ports", 10, y+=20, m_w - 20,  -1, UnicodeString("Spawn Ports") );
        RegisterButton( spawnPorts );
	    m_buttonOrder.PutData( spawnPorts );

        if( g_app->Multiplayer() )
        {
            CrateCreateButton *ccb = new CrateCreateButton();
            ccb->m_good = true;
            ccb->SetShortProperties( "GoodCrate", 10, y+=20, (m_w / 2) - 20, -1, UnicodeString("GoodCrate") );
            RegisterButton( ccb );
	        m_buttonOrder.PutData( ccb );

            DropDownMenu *crates = new DropDownMenu();
            crates->SetShortProperties( "Crates", m_w / 2, y, (m_w/2) - 10,  -1, UnicodeString("Crates"));
            for( int p = 0; p < Crate::NumCrateRewards; ++p )
            {
                crates->AddOption( Crate::GetName(p), p );
            }
            RegisterButton( crates );
	        m_buttonOrder.PutData( crates );
            crates->RegisterInt( &ccb->m_reward );

        }
        y+=20;
    }
    
    ProfilerCreateButton *profiler = new ProfilerCreateButton();
    profiler->SetShortProperties( "Profiler", 10, y+=20, m_w-20,  -1, UnicodeString("Profiler"));
    RegisterButton( profiler );
	m_buttonOrder.PutData( profiler );
	
#ifdef SOUND_EDITOR
    SoundEditorCreateButton *soundEditor = new SoundEditorCreateButton();
    soundEditor->SetShortProperties( "Sound Editor", 10, y+=20, m_w-20,  -1, UnicodeString("Sound Editor"));
    RegisterButton( soundEditor );
	m_buttonOrder.PutData( soundEditor );

    SoundStatsCreateButton *soundStats = new SoundStatsCreateButton();
    soundStats->SetShortProperties( "Sound Stats", 10, y+=20, m_w-20, -1, UnicodeString("Sound Stats") );
    RegisterButton( soundStats );
	m_buttonOrder.PutData( soundStats );
#endif // SOUND_EDITOR

    NetworkStatsCreateButton *networkStats = new NetworkStatsCreateButton();
    networkStats->SetShortProperties( "Network Stats", 10, y+=20, m_w-20, -1, UnicodeString("Network Stats") );
    RegisterButton( networkStats );
	m_buttonOrder.PutData( networkStats );

	ShowDrSepulvedaFaceButton *faceButton = new ShowDrSepulvedaFaceButton();
    faceButton->SetShortProperties( "Network Stats", 10, y+=20, m_w-20, -1, UnicodeString("Show Dr S Face") );
    RegisterButton( faceButton );
	m_buttonOrder.PutData( faceButton );
}
void BuildingEditWindow::Create()
{
	DarwiniaWindow::Create();

	Building *building = g_app->m_location->GetBuilding(g_app->m_locationEditor->m_selectionId);
	DarwiniaDebugAssert(building);

	int buttonPitch = 18;
	int y = 6;

    ToolButton *mb = new ToolButton(LocationEditor::ToolMove);
	mb->SetShortProperties(LANGUAGEPHRASE("editor_move"), 10, y += buttonPitch, m_w-20);
	RegisterButton(mb);

    ToolButton *rb = new ToolButton(LocationEditor::ToolRotate);
	rb->SetShortProperties(LANGUAGEPHRASE("editor_rotate"), 10, y += buttonPitch, m_w-20);
	RegisterButton(rb);

    CloneBuildingButton *clone = new CloneBuildingButton();
    clone->SetShortProperties(LANGUAGEPHRASE("editor_clone"), 10, y+=buttonPitch, m_w-20);
    RegisterButton(clone);

    DeleteBuildingButton *db = new DeleteBuildingButton();
    db->SetShortProperties(LANGUAGEPHRASE("editor_delete"), 10, y += buttonPitch, m_w-20);
    RegisterButton(db);

    ToolButton *lb = new ToolButton(LocationEditor::ToolLink);
    lb->SetShortProperties(LANGUAGEPHRASE("editor_link"), 10, y += buttonPitch, m_w-20);
    RegisterButton(lb);

	y += buttonPitch;

    for( int i = -1; i < 3; ++i )
    {
        char name[256];
        int w = m_w/4 - 5;
        sprintf( name, "T%d",i);
        TeamButton *tb = new TeamButton(i);
        tb->SetShortProperties(name, 61 + (float)i*((float)w + 1.0f), y, w - 2);
        RegisterButton(tb);
    }

	CreateValueControl(LANGUAGEPHRASE("editor_dynamic"), InputField::TypeChar, &building->m_dynamic, y += buttonPitch,
					   1.0f, 0, 1);

	CreateValueControl(LANGUAGEPHRASE("editor_isglobal"), InputField::TypeChar, &building->m_isGlobal, y += buttonPitch,
					   1.0f, 0, 1);

    if (building->m_type == Building::TypeFactory)
	{
		InputField *intExtra = new InputField();
		intExtra->SetShortProperties(LANGUAGEPHRASE("editor_spirits"), 10, y += buttonPitch, m_w-20);
		Factory *factory = (Factory*)building;
		intExtra->RegisterInt(&factory->m_initialCapacity);
		RegisterButton(intExtra);
	}
    else if (building->m_type == Building::TypeTrunkPort)
    {
        InputField *inExtra = new InputField();
        inExtra->SetShortProperties(LANGUAGEPHRASE("editor_targetlocation"), 10, y += buttonPitch, m_w-20);
        TrunkPort *port = (TrunkPort *) building;
        inExtra->RegisterInt( &port->m_targetLocationId );
        RegisterButton(inExtra);
    }
    else if (building->m_type == Building::TypeLaserFence)
    {
        LaserFence *fence = (LaserFence *) building;
        CreateValueControl( LANGUAGEPHRASE("editor_scale"), InputField::TypeFloat, &fence->m_scale, y+=buttonPitch, 0.01f, 0.0f, 100.0f );

       DropDownMenu *menu = new DropDownMenu(true);
        menu->SetShortProperties( LANGUAGEPHRASE("editor_mode"), 10, y+=buttonPitch, m_w-20 );
        menu->AddOption( LANGUAGEPHRASE("editor_disabled") );
        menu->AddOption( LANGUAGEPHRASE("editor_enabling") );
        menu->AddOption( LANGUAGEPHRASE("editor_enabled") );
        menu->AddOption( LANGUAGEPHRASE("editor_disabling") );
		menu->AddOption( LANGUAGEPHRASE("editor_neveron") );
        menu->RegisterInt( &fence->m_mode );
        RegisterButton( menu );
    }
    else if(building->m_type == Building::TypeAntHill)
    {
        AntHill *antHill = (AntHill *) building;
        CreateValueControl( LANGUAGEPHRASE("editor_numants"), InputField::TypeInt, &antHill->m_numAntsInside, y+=buttonPitch, 1, 0, 1000 );
    }
    else if(building->m_type == Building::TypeSafeArea)
    {
        SafeArea *safeArea = (SafeArea *) building;
        CreateValueControl( LANGUAGEPHRASE("editor_size"), InputField::TypeFloat, &safeArea->m_size, y+=buttonPitch, 1.0f, 0.0f, 1000.0f );
        CreateValueControl( LANGUAGEPHRASE("editor_capacity"), InputField::TypeInt, &safeArea->m_entitiesRequired, y+=buttonPitch, 1, 0, 10000 );

        DropDownMenu *menu = new DropDownMenu(true);
        menu->SetShortProperties( LANGUAGEPHRASE("editor_entitytype"), 10, y+=buttonPitch, m_w-20 );
        for( int i = 0; i < Entity::NumEntityTypes; ++i)
        {
            menu->AddOption( Entity::GetTypeNameTranslated(i), i );
        }
        menu->RegisterInt( &safeArea->m_entityTypeRequired );
        RegisterButton( menu );
    }
    else if(building->m_type == Building::TypeTrackStart)
    {
        TrackStart *trackStart = (TrackStart *) building;
        CreateValueControl( LANGUAGEPHRASE("editor_toggledby"), InputField::TypeInt, &trackStart->m_reqBuildingId, y+=buttonPitch, 1.0f, -1.0f, 1000.0f );
    }
    else if(building->m_type == Building::TypeTrackEnd)
    {
        TrackEnd *trackEnd = (TrackEnd *) building;
        CreateValueControl( LANGUAGEPHRASE("editor_toggledby"), InputField::TypeInt, &trackEnd->m_reqBuildingId, y+=buttonPitch, 1.0f, -1.0f, 1000.0f );
    }
    else if(building->m_type == Building::TypePylonStart)
    {
        PylonStart *pylonStart = (PylonStart *) building;
        CreateValueControl( LANGUAGEPHRASE("editor_toggledby"), InputField::TypeInt, &pylonStart->m_reqBuildingId, y+=buttonPitch, 1.0f, -1.0f, 1000.0f );
    }
    else if(building->m_type == Building::TypeResearchItem )
    {
        DropDownMenu *menu = new DropDownMenu(true);
        menu->SetShortProperties( LANGUAGEPHRASE("editor_research"), 10, y+=buttonPitch, m_w-20 );
        for( int i = 0; i < GlobalResearch::NumResearchItems; ++i )
        {
            menu->AddOption( GlobalResearch::GetTypeNameTranslated( i ), i );
        }
        menu->RegisterInt( &((ResearchItem *)building)->m_researchType );
        RegisterButton( menu );
        CreateValueControl( LANGUAGEPHRASE("editor_level"), InputField::TypeInt, &((ResearchItem *)building)->m_level, y+=buttonPitch, 1, 0, 4 );
    }
    else if( building->m_type == Building::TypeTriffid )
    {
        Triffid *triffid = (Triffid *) building;
        CreateValueControl( LANGUAGEPHRASE("editor_size"), InputField::TypeFloat, &triffid->m_size, y+=buttonPitch, 0.1f, 0.0f, 50.0f );
        CreateValueControl( LANGUAGEPHRASE("editor_pitch"), InputField::TypeFloat, &triffid->m_pitch, y+=buttonPitch, 0.1f, -M_PI, M_PI );
        CreateValueControl( LANGUAGEPHRASE("editor_force"), InputField::TypeFloat, &triffid->m_force, y+=buttonPitch, 1.0f, 0.0f, 1000.0f );
        CreateValueControl( LANGUAGEPHRASE("editor_variance"), InputField::TypeFloat, &triffid->m_variance, y+=buttonPitch, 0.01f, 0.0f, M_PI );
        CreateValueControl( LANGUAGEPHRASE("editor_reload"), InputField::TypeFloat, &triffid->m_reloadTime, y+=buttonPitch, 1.0f, 0.0f, 1000.0f );

        for( int i = 0; i < Triffid::NumSpawnTypes; ++i )
        {
            CreateValueControl( Triffid::GetSpawnNameTranslated(i), InputField::TypeChar, &triffid->m_spawn[i], y+=buttonPitch, 1.0f, 0.0f, 1.0f );
        }

        CreateValueControl( LANGUAGEPHRASE("editor_usetrigger"), InputField::TypeChar, &triffid->m_useTrigger, y+=buttonPitch, 1, 0, 1 );
        CreateValueControl( LANGUAGEPHRASE("editor_triggerX"), InputField::TypeFloat, &triffid->m_triggerLocation.x, y+=buttonPitch, 1.0f, -10000.0f, 10000.0f );
        CreateValueControl( LANGUAGEPHRASE("editor_triggerZ"), InputField::TypeFloat, &triffid->m_triggerLocation.z, y+=buttonPitch, 1.0f, -10000.0f, 10000.0f );
        CreateValueControl( LANGUAGEPHRASE("editor_triggerrad"), InputField::TypeFloat, &triffid->m_triggerRadius, y+=buttonPitch, 1.0f, 0.0f, 1000.0f );

    }
    else if( building->m_type == Building::TypeBlueprintRelay )
    {
        BlueprintRelay *relay = (BlueprintRelay *) building;
        CreateValueControl( LANGUAGEPHRASE("editor_altitude"), InputField::TypeFloat, &relay->m_altitude, y+=buttonPitch, 1.0f, 0.0f, 1000.0f );
    }
    else if( building->m_type == Building::TypeBlueprintConsole )
    {
        BlueprintConsole *console = (BlueprintConsole *) building;
        CreateValueControl( LANGUAGEPHRASE("editor_segment"), InputField::TypeInt, &console->m_segment, y+=buttonPitch, 1, 0, 3 );
    }
    else if( building->m_type == Building::TypeAISpawnPoint )
    {
        AISpawnPoint *spawn = (AISpawnPoint *) building;
        DropDownMenu *menu = new DropDownMenu();
        menu->SetShortProperties( LANGUAGEPHRASE("editor_entitytype"), 10, y+=buttonPitch, m_w-20 );
        for( int i = 0; i < Entity::NumEntityTypes; ++i )
        {
            menu->AddOption( Entity::GetTypeNameTranslated(i), i );
        }
        menu->RegisterInt( &spawn->m_entityType );
        RegisterButton(menu);

        CreateValueControl( LANGUAGEPHRASE("editor_count"), InputField::TypeInt, &spawn->m_count, y+=buttonPitch, 1, 0, 1000 );
        CreateValueControl( LANGUAGEPHRASE("editor_period"), InputField::TypeInt, &spawn->m_period, y+=buttonPitch, 1, 0, 1000 );
        CreateValueControl( LANGUAGEPHRASE("editor_spawnlimit"), InputField::TypeInt, &spawn->m_spawnLimit, y+=buttonPitch, 1, 0, 1000 );
    }
    else if( building->m_type == Building::TypeSpawnPopulationLock )
    {
        SpawnPopulationLock *lock = (SpawnPopulationLock *) building;

        CreateValueControl( LANGUAGEPHRASE("editor_searchradius"), InputField::TypeFloat, &lock->m_searchRadius, y+=buttonPitch, 1.0f, 0.0f, 10000.0f );
        CreateValueControl( LANGUAGEPHRASE("editor_maxpopulation"), InputField::TypeInt, &lock->m_maxPopulation, y+=buttonPitch, 1, 0, 10000 );
    }
    else if( building->m_type == Building::TypeSpawnLink ||
             building->m_type == Building::TypeSpawnPointMaster ||
             building->m_type == Building::TypeSpawnPoint )
    {
        class ClearLinksButton: public DarwiniaButton
        {
        public:
            int m_buildingId;
            void MouseUp()
            {
                SpawnBuilding *building = (SpawnBuilding *) g_app->m_location->GetBuilding( m_buildingId );
                building->ClearLinks();
            }
        };

        ClearLinksButton *button = new ClearLinksButton();
        button->SetShortProperties( LANGUAGEPHRASE("editor_clearlinks"), 10, y+=buttonPitch, m_w-20 );
        button->m_buildingId = building->m_id.GetUniqueId();
        RegisterButton( button );
    }
    else if( building->m_type == Building::TypeScriptTrigger )
    {
        ScriptTrigger *trigger = (ScriptTrigger *) building;

        CreateValueControl( LANGUAGEPHRASE("editor_range"), InputField::TypeFloat, &trigger->m_range, y+=buttonPitch, 0.5f, 0.0f, 1000.0f );
        CreateValueControl( LANGUAGEPHRASE("editor_script"), InputField::TypeString, trigger->m_scriptFilename, y+=buttonPitch, 0,0,0 );

        DropDownMenu *menu = new DropDownMenu(true);
        menu->SetShortProperties( LANGUAGEPHRASE("editor_entitytype"), 10, y+=buttonPitch, m_w-20 );
        menu->AddOption( LANGUAGEPHRASE("editor_always"), SCRIPTRIGGER_RUNALWAYS );
        menu->AddOption( LANGUAGEPHRASE("editor_never"), SCRIPTRIGGER_RUNNEVER );
        menu->AddOption( LANGUAGEPHRASE("editor_cameraenter"), SCRIPTRIGGER_RUNCAMENTER );
        menu->AddOption( LANGUAGEPHRASE("editor_cameraview"), SCRIPTRIGGER_RUNCAMVIEW );
        for( int i = 0; i < Entity::NumEntityTypes; ++i)
        {
            menu->AddOption( Entity::GetTypeNameTranslated(i), i );
        }
        menu->RegisterInt( &trigger->m_entityType);
        RegisterButton( menu );
    }
    else if( building->m_type == Building::TypeStaticShape )
    {
        StaticShape *staticShape = (StaticShape *) building;

        CreateValueControl( LANGUAGEPHRASE("editor_scale"), InputField::TypeFloat, &staticShape->m_scale, y+=buttonPitch, 0.1f, 0.0f, 100.0f );
        CreateValueControl( LANGUAGEPHRASE("editor_shape"), InputField::TypeString, &staticShape->m_shapeName, y+=buttonPitch, 0,0,0 );
    }
    else if( building->m_type == Building::TypeIncubator )
    {
        CreateValueControl( LANGUAGEPHRASE("editor_spirits"), InputField::TypeInt, &((Incubator *) building)->m_numStartingSpirits, y+=buttonPitch, 1, 0, 1000 );
    }
    else if( building->m_type == Building::TypeEscapeRocket )
    {
        EscapeRocket *rocket = (EscapeRocket *) building;

        CreateValueControl( LANGUAGEPHRASE("editor_fuel"), InputField::TypeFloat, &rocket->m_fuel, y+=buttonPitch, 0.1f, 0.0f, 100.0f );
        CreateValueControl( LANGUAGEPHRASE("editor_passengers"), InputField::TypeInt, &rocket->m_passengers, y+=buttonPitch, 1, 0, 100 );
        CreateValueControl( LANGUAGEPHRASE("editor_spawnport"), InputField::TypeInt, &rocket->m_spawnBuildingId, y+=buttonPitch, 1, 0, 9999 );
    }
    else if( building->m_type == Building::TypeDynamicHub )
    {
        DynamicHub *hub = (DynamicHub *)building;

        CreateValueControl( LANGUAGEPHRASE("editor_shape"), InputField::TypeString, &hub->m_shapeName, y+=buttonPitch, 0,0,0 );
        CreateValueControl( LANGUAGEPHRASE("editor_requiredscore"), InputField::TypeInt, &hub->m_requiredScore, y+=buttonPitch, 1, 0, 100000 );
        CreateValueControl( LANGUAGEPHRASE("editor_minlinks"), InputField::TypeInt, &hub->m_minActiveLinks, y+=buttonPitch, 1, 0, 100 );
    }
    else if( building->m_type == Building::TypeDynamicNode )
    {
        DynamicNode *node = (DynamicNode *)building;

        CreateValueControl( LANGUAGEPHRASE("editor_shape"), InputField::TypeString, &node->m_shapeName, y+=buttonPitch, 0,0,0 );
        CreateValueControl( LANGUAGEPHRASE("editor_pointspersec"), InputField::TypeInt, &node->m_scoreValue, y+=buttonPitch, 1, 0, 1000 );
    }
	else if( building->m_type == Building::TypeFenceSwitch )
	{
		FenceSwitch *fs = (FenceSwitch *)building;

		CreateValueControl( LANGUAGEPHRASE("editor_switchonce"), InputField::TypeInt, &fs->m_lockable, y+=buttonPitch, 0, 1, 0 );
        CreateValueControl( LANGUAGEPHRASE("editor_script"), InputField::TypeString, &fs->m_script, y+=buttonPitch, 0, 0, 0 );
	}

}
Example #9
0
void GameSettings::UpdateMissionImage()
{	
	vgui::ImagePanel* imgLevelImage = dynamic_cast< vgui::ImagePanel* >( FindChildByName( "ImgLevelImage" ) );
	if( !imgLevelImage )
		return;

	vgui::Label *pMissionLabel = dynamic_cast< vgui::Label* >( FindChildByName( "MissionLabel" ) );


	DropDownMenu *menu = dynamic_cast< DropDownMenu* >( FindChildByName( "DrpSelectMission", true ) );
#if 0
	IASW_Mission_Chooser_Source *pSource = missionchooser ? missionchooser->LocalMissionSource() : NULL;
	if ( !pSource || !m_pSettings || !menu )
		return;

	const char *szGameType = m_pSettings->GetString( "game/mode", "campaign" );
	if ( !Q_stricmp( szGameType, "campaign" ) )
	{
		const char *szCampaign = m_pSettings->GetString( "game/campaign", NULL );
		if ( szCampaign )
		{
			KeyValues *pCampaignKeys = pSource->GetCampaignDetails( szCampaign );
			if ( pCampaignKeys )
			{
				//imgLevelImage->SetImage( pCampaignKeys->GetString( "ChooseCampaignTexture" ) );
				pMissionLabel->SetText( pCampaignKeys->GetString( "CampaignName" ) );
				menu->SetCurrentSelection( pCampaignKeys->GetString( "CampaignName" ) );
			}
		}
		if ( m_drpStartingMission )
		{
			m_drpStartingMission->SetVisible( true );

			const char *szMission = m_pSettings->GetString( "game/mission", NULL );
			if ( szMission )
			{
				KeyValues *pMissionKeys = pSource->GetMissionDetails( szMission );
				if ( pMissionKeys )
				{
					m_drpStartingMission->SetCurrentSelection( pMissionKeys->GetString( "missiontitle" ) );
					imgLevelImage->SetImage( pMissionKeys->GetString( "image" ) );
				}
			}
		}
	}
	else if ( !Q_stricmp( szGameType, "single_mission" ) )
	{
		const char *szMission = m_pSettings->GetString( "game/mission", NULL );
		if ( szMission )
		{
			KeyValues *pMissionKeys = pSource->GetMissionDetails( szMission );
			if ( pMissionKeys )
			{
				// TODO: Handle missions without an image
				imgLevelImage->SetImage( pMissionKeys->GetString( "image" ) );
				pMissionLabel->SetText( pMissionKeys->GetString( "missiontitle" ) );
				menu->SetCurrentSelection( pMissionKeys->GetString( "missiontitle" ) );
			}
		}
		if ( m_drpStartingMission )
		{
			m_drpStartingMission->SetVisible( false );
		}
	}
#else
	const char *szGameType = m_pSettings->GetString( "game/mode", "sdk" );
	if ( !Q_stricmp( szGameType, "sdk" ) )
	{
		const char *szMission = m_pSettings->GetString( "game/mission", NULL );
		if ( szMission )
		{
			pMissionLabel->SetText( szMission );
			menu->SetCurrentSelection( szMission );
		}
		if ( m_drpStartingMission )
		{
			m_drpStartingMission->SetVisible( false );
		}
	}
	else if( !Q_stricmp( szGameType, "swarmkeeper" ) )
	{
		const char *szMission = m_pSettings->GetString( "game/mission", NULL );
		if ( szMission )
		{
			char path[256];
			Q_snprintf( path, 256, "maps/%s.res", szMission );
			KeyValues *pData = new KeyValues("Data");
			if( pData && pData->LoadFromFile( filesystem, path ) )
			{
				imgLevelImage->SetImage( pData->GetString( "image", "swarm/MissionPics/UnknownMissionPic" ) );
				pMissionLabel->SetText( pData->GetString( "title" ) );
				menu->SetCurrentSelection( pData->GetString( "title" ) );
			}
			else
			{
				imgLevelImage->SetImage( pData->GetString( "image", "swarm/MissionPics/UnknownMissionPic" ) );
				pMissionLabel->SetText( szMission );
				menu->SetCurrentSelection( szMission );
			}

			if( pData ) pData->deleteThis();
		}
		if ( m_drpStartingMission )
		{
			m_drpStartingMission->SetVisible( false );
		}
	}
#endif // 0
}
//=============================================================================
void InGameChapterSelect::ApplySchemeSettings(vgui::IScheme *pScheme)
{
	BaseClass::ApplySchemeSettings(pScheme);

	SetPaintBackgroundEnabled( true );

	// Determine current game settings
	KeyValues *pGameSettings = g_pMatchFramework->GetMatchNetworkMsgController()->GetActiveServerGameDetails( NULL );
	KeyValues::AutoDelete autodelete_pGameSettings( pGameSettings );

	char const *szGameMode = pGameSettings->GetString( "game/mode", "campaign" );

	if ( !GameModeIsSingleChapter( szGameMode ) )
		pGameSettings->SetInt( "game/chapter", 1 );

	// Get mission and campaign info
	KeyValues *pInfoMission = NULL;
	KeyValues *pInfoChapter = g_pMatchExtSwarm->GetMapInfo( pGameSettings, &pInfoMission );

	// Check if this is a custom mission?
	if ( pInfoMission && !pInfoMission->GetBool( "builtin" ) )
		pInfoChapter = pInfoMission = NULL;	// trigger to use another builtin mission

	if ( !pInfoMission || !pInfoChapter )
	{
		KeyValues *pAllMissions = g_pMatchExtSwarm->GetAllMissions();
		for ( pInfoMission = pAllMissions ? pAllMissions->GetFirstTrueSubKey() : NULL;
			  pInfoMission; pInfoMission = pInfoMission->GetNextTrueSubKey() )
		{
			if ( !pInfoMission->GetBool( "builtin" ) )
				continue;

			pInfoChapter = pInfoMission->FindKey( CFmtStr( "modes/%s/1", szGameMode ) );
			if ( pInfoChapter )
				break;
		}
	}

	Assert( pInfoMission && pInfoChapter );

	// set the dropdowns
	DropDownMenu *pMissionDropDown = dynamic_cast< DropDownMenu* >( FindChildByName( "DrpMission" ) );
	DropDownMenu *pChapterDropDown = dynamic_cast< DropDownMenu* >( FindChildByName( "DrpChapter" ) );
	if( pMissionDropDown && pChapterDropDown ) //missions change what the available campaigns are, we should listen on that flyout as well
	{
		pMissionDropDown->SetFlyout( CFmtStr( "FlmMission%s", szGameMode ) );

		if ( pInfoMission && pInfoChapter )
		{
			pMissionDropDown->SetCurrentSelection( CFmtStr( "cmd_campaign_%s", pInfoMission->GetString( "name" ) ) );
			Q_strncpy( m_chCampaign, pInfoMission->GetString( "name" ), ARRAYSIZE( m_chCampaign ) );

			// Set this after setting the mission dropdown, as that will default the chapter to the first in the campaign
			pChapterDropDown->SetCurrentSelection( CFmtStr( "#L4D360UI_Chapter_%d", pInfoChapter->GetInt( "chapter" ) ) );
			m_nChapter = pInfoChapter->GetInt( "chapter" );
		}

		FlyoutMenu *flyout = pMissionDropDown->GetCurrentFlyout();
		if( flyout )
		{
			flyout->CloseMenu( NULL );
		}

		flyout = pChapterDropDown->GetCurrentFlyout();
		if( flyout )
		{
			flyout->CloseMenu( NULL );
		}

		if ( m_ActiveControl )
		{
			m_ActiveControl->NavigateFrom( );
		}
		pMissionDropDown->NavigateTo();
		m_ActiveControl = pMissionDropDown;

		// Chapters are directly selectable only in some game modes
		pChapterDropDown->SetEnabled( GameModeIsSingleChapter( szGameMode ) );
	}

	SetPaintBackgroundEnabled( true );
	SetupAsDialogStyle();
}
//=============================================================================
void InGameChapterSelect::OnCommand(const char *command)
{
	if ( const char* szMissionItem = StringAfterPrefix( command, "cmd_campaign_" ) )
	{
		if ( !Q_stricmp( szMissionItem, m_chCampaign ) )
			return;	// Setting to same mission

		Q_strncpy( m_chCampaign, szMissionItem, ARRAYSIZE( m_chCampaign ) );

		// Determine current game settings
		KeyValues *pGameSettings = g_pMatchFramework->GetMatchNetworkMsgController()->GetActiveServerGameDetails( NULL );
		KeyValues::AutoDelete autodelete_pGameSettings( pGameSettings );
		if ( !pGameSettings )
			return;

		DropDownMenu *pMissionDropDown = dynamic_cast< DropDownMenu* >( FindChildByName( "DrpMission" ) );
		if( pMissionDropDown ) //we should become a listener for events pertaining to the mission flyout
		{
			FlyoutMenu* missionFlyout = pMissionDropDown->GetCurrentFlyout();
			if( missionFlyout )
			{
				missionFlyout->SetListener( this );
				if ( vgui::Button *pAddonBtn = missionFlyout->FindChildButtonByCommand( "cmd_addoncampaign" ) )
				{
					pAddonBtn->SetEnabled( false );
				}

				// Disable all other campaigns that cannot be used for a vote
				for ( int k = 0, kNum = missionFlyout->GetChildCount(); k < kNum; ++ k )
				{
					Panel *child = missionFlyout->GetChild( k );
					if ( BaseModHybridButton* button = dynamic_cast< BaseModHybridButton* >( child ) )
					{
						if ( const char* commandValue = button->GetCommand()->GetString( "command", NULL ) )
						{
							if ( char const *szMissionName = StringAfterPrefix( commandValue, "cmd_campaign_" ) )
							{
								pGameSettings->SetString( "game/campaign", szMissionName );
								pGameSettings->SetInt( "game/chapter", 1 );
								if ( !g_pMatchExtSwarm->GetMapInfo( pGameSettings ) )
								{
									button->SetEnabled( false );
								}
							}
						}
					}
				}
			}
		}

	}
	else if ( char const *szChapterSelected = StringAfterPrefix( command, "#L4D360UI_Chapter_" ) )
	{
		m_nChapter = atoi( szChapterSelected );
		UpdateChapterImage( m_chCampaign, m_nChapter );
	}
	else if ( !Q_stricmp( command, "Select" ) )
	{
		KeyValues *pGameSettings = g_pMatchFramework->GetMatchNetworkMsgController()->GetActiveServerGameDetails( NULL );
		KeyValues::AutoDelete autodelete_pGameSettings( pGameSettings );

		if ( !GameModeIsSingleChapter( pGameSettings->GetString( "game/mode" ) ) )
			m_nChapter = 1;

		pGameSettings->SetString( "game/campaign", m_chCampaign );
		pGameSettings->SetInt( "game/chapter", m_nChapter );

		char const *szVoteCommand = "ChangeChapter";

		int iUser = GetGameUIActiveSplitScreenPlayerSlot();
		GAMEUI_ACTIVE_SPLITSCREEN_PLAYER_GUARD( iUser );

		Panel *pDrpChapter = FindChildByName( "DrpChapter" );
		if ( !pDrpChapter || !pDrpChapter->IsEnabled() )
		{
			szVoteCommand = "ChangeMission";
			m_nChapter = 1;

			engine->ClientCmd( CFmtStr( "callvote %s %s;", szVoteCommand, m_chCampaign ) );
		}
		else if ( KeyValues *pInfoMap = g_pMatchExtSwarm->GetMapInfo( pGameSettings ) )
		{
			engine->ClientCmd( CFmtStr( "callvote %s %s;", szVoteCommand, pInfoMap->GetString( "map" ) ) );
		}

		GameUI().AllowEngineHideGameUI();
		engine->ClientCmd( "gameui_hide" );
		Close();
	}	
	else if ( !Q_strcmp( command, "Cancel" ) )
	{
		GameUI().AllowEngineHideGameUI();
		engine->ClientCmd("gameui_hide");
		Close();
	}
}
Example #12
0
void GameSettings::UpdateMissionImage()
{	
	vgui::ImagePanel* imgLevelImage = dynamic_cast< vgui::ImagePanel* >( FindChildByName( "ImgLevelImage" ) );
	if( !imgLevelImage )
		return;

	vgui::Label *pMissionLabel = dynamic_cast< vgui::Label* >( FindChildByName( "MissionLabel" ) );


	DropDownMenu *menu = dynamic_cast< DropDownMenu* >( FindChildByName( "DrpSelectMission", true ) );

	IASW_Mission_Chooser_Source *pSource = missionchooser ? missionchooser->LocalMissionSource() : NULL;
	if ( !pSource || !m_pSettings || !menu )
		return;

	const char *szGameType = m_pSettings->GetString( "game/mode", "campaign" );
	if ( !Q_stricmp( szGameType, "campaign" ) )
	{
		const char *szCampaign = m_pSettings->GetString( "game/campaign", NULL );
		if ( szCampaign )
		{
			KeyValues *pCampaignKeys = pSource->GetCampaignDetails( szCampaign );
			if ( pCampaignKeys )
			{
				//imgLevelImage->SetImage( pCampaignKeys->GetString( "ChooseCampaignTexture" ) );
				pMissionLabel->SetText( pCampaignKeys->GetString( "CampaignName" ) );
				menu->SetCurrentSelection( pCampaignKeys->GetString( "CampaignName" ) );
			}
		}
		if ( m_drpStartingMission )
		{
			m_drpStartingMission->SetVisible( true );

			const char *szMission = m_pSettings->GetString( "game/mission", NULL );
			if ( szMission )
			{
				KeyValues *pMissionKeys = pSource->GetMissionDetails( szMission );
				if ( pMissionKeys )
				{
					m_drpStartingMission->SetCurrentSelection( pMissionKeys->GetString( "missiontitle" ) );
					imgLevelImage->SetImage( pMissionKeys->GetString( "image" ) );
				}
			}
		}
	}
	else if ( !Q_stricmp( szGameType, "single_mission" ) )
	{
		const char *szMission = m_pSettings->GetString( "game/mission", NULL );
		if ( szMission )
		{
			KeyValues *pMissionKeys = pSource->GetMissionDetails( szMission );
			if ( pMissionKeys )
			{
				// TODO: Handle missions without an image
				imgLevelImage->SetImage( pMissionKeys->GetString( "image" ) );
				pMissionLabel->SetText( pMissionKeys->GetString( "missiontitle" ) );
				menu->SetCurrentSelection( pMissionKeys->GetString( "missiontitle" ) );
			}
		}
		if ( m_drpStartingMission )
		{
			m_drpStartingMission->SetVisible( false );
		}
	}
}
void PrefsKeybindingsWindow::Create()
{
    DarwiniaWindow::Create();

	int fontSize = GetMenuSize(11);
	int y = GetClientRectY1();
	int border = GetClientRectX1() + GetMenuSize(5);
	int x = m_w * 2 / 3;
	int buttonH = GetMenuSize(20);
	int buttonW = m_w - border * 2 - x;
	int h = buttonH + border;

	if ( 0 == m_controlMethod )
		s_indices = s_gesture_controls;
	else
		s_indices = s_icon_controls;

    ControlMethodDropDownMenu *controlMethod = new ControlMethodDropDownMenu();
    controlMethod->SetShortProperties( LANGUAGEPHRASE("newcontrols_prefsoption"), x, y+=border, buttonW, buttonH );
    controlMethod->AddOption( LANGUAGEPHRASE("newcontrols_prefs_gestures"), 0 );
    controlMethod->AddOption( LANGUAGEPHRASE("newcontrols_prefs_icons"), 1 );
    controlMethod->RegisterInt( &m_controlMethod );
	controlMethod->m_fontSize = GetMenuSize(11);
    RegisterButton( controlMethod );
	m_buttonOrder.PutData( controlMethod );

    InvertedBox *box = new InvertedBox();
	unsigned num_controls = 0;
	while ( s_indices[num_controls] >= 0 ) { num_controls++; }
    box->SetShortProperties( "invert", 10, y+h, m_w - 20, (num_controls * h) + border);
    RegisterButton( box );

    y += border;

    for (unsigned j = 0; j < num_controls; ++j)
	{
		int i = s_indices[ j ];
		ChangeKeybindingButton *but = new ChangeKeybindingButton( i, s_controls[i].instant );
		char const *eventName = LANGUAGEPHRASE( s_controls[i].name );
		but->SetShortProperties(eventName, x, y+=h, buttonW, buttonH);
		but->m_fontSize = GetMenuSize(15);
		but->m_centered = true;
		char const *keyName =  m_bindings[i]->noun.c_str();
		strcpy(but->m_caption, keyName);
		RegisterButton(but);
		m_buttonOrder.PutData( but );
	}

#ifdef TARGET_OS_MACOSX
	DropDownMenu *numMouseButtons = new DropDownMenu();
    numMouseButtons->SetShortProperties( " ", x, y+=h, buttonW, buttonH );
    numMouseButtons->AddOption( "1", 1 );
    numMouseButtons->AddOption( "3", 3 );
    numMouseButtons->RegisterInt( &m_numMouseButtons );
    RegisterButton( numMouseButtons );
	m_buttonOrder.PutData( numMouseButtons );
#endif

	y = m_h - (h+5);

	RestoreDefaultsButton *restore = new RestoreDefaultsButton();
	restore->SetShortProperties(LANGUAGEPHRASE("dialog_restoredefaults"), border, y - h, m_w - border*2, buttonH);
	restore->m_fontSize = fontSize;
	restore->m_centered = true;
	RegisterButton(restore);
	m_buttonOrder.PutData( restore );

	int buttonW2 = m_w / 2 - border * 2;

    CloseButton *cancel = new CloseButton();
    cancel->SetShortProperties( LANGUAGEPHRASE("dialog_close"), border, y, buttonW2, buttonH );
    cancel->m_fontSize = fontSize;
    cancel->m_centered = true;
    RegisterButton( cancel );
	m_buttonOrder.PutData( cancel );

    ApplyKeybindingsButton *apply = new ApplyKeybindingsButton();
    apply->SetShortProperties( LANGUAGEPHRASE("dialog_apply"), m_w - buttonW2 - border, y, buttonW2, buttonH );
    apply->m_fontSize = fontSize;
    apply->m_centered = true;
    RegisterButton( apply );
	m_buttonOrder.PutData( apply );
}
void SoundParameterEditor::Create()
{
    DarwiniaWindow::Create();

    //
    // Parameter type

    DropDownMenu *paramType = new DropDownMenu(false);
    paramType->SetShortProperties( "ParameterType", 10, 30, 150, -1, UnicodeString("ParameterType") );
    for( int i = 0; i < SoundParameter::NumParameterTypes; ++i )
    {
        paramType->AddOption( SoundParameter::GetParameterTypeName(i) );
    }
    paramType->RegisterInt( &m_parameter->m_type );
    RegisterButton( paramType );


    //
    // Link type

    LinkTypeMenu *linkType = new LinkTypeMenu();
    linkType->SetShortProperties( "LinkType", 10, 50, 150, -1, UnicodeString("LinkType") );
    for( int i = 0; i < SoundParameter::NumLinkTypes; ++i )
    {
        linkType->AddOption( SoundParameter::GetLinkName(i) );
    }
    linkType->RegisterInt( &m_parameter->m_link );
    RegisterButton( linkType );


    //
    // Smoothing factor

    CreateValueControl( "SmoothFactor", &m_parameter->m_smooth, 30, 0.05, 0.0, 0.99, NULL, 170, m_w - 180 );


    //
    // Update type

    UpdateTypeMenu *updateType = new UpdateTypeMenu();
    updateType->SetShortProperties( "UpdateType", 170, 50, m_w - 180, -1, UnicodeString("UpdateType") );
    for( int i = 0; i < SoundParameter::NumUpdateTypes; ++i )
    {
        updateType->AddOption( SoundParameter::GetUpdateTypeName(i) );
    }
    updateType->RegisterInt( &m_parameter->m_updateType );
    RegisterButton( updateType );

    
    //
    // Graph 
    
    SoundParameterGraph *graph = new SoundParameterGraph();
    graph->SetShortProperties( "graph", 10, 70, m_w - 20, m_h - 80, UnicodeString("  ") );
	//strcpy(graph->m_name, "graph");
    graph->SetParameter( m_parameter, m_minOutput, m_maxOutput );
    RegisterButton( graph );

//	SoundParameterGraphScaleToggle *scaleToggle = new SoundParameterGraphScaleToggle();
//	scaleToggle->SetShortProperties("Toggle Scale", 10, 50, 150);
//	RegisterButton(scaleToggle);
}