Ejemplo n.º 1
0
void CPreferencesDlgBase::SavePreferences()
{
	SavePreferences(m_prefs);

	// notify parent
	GetParent()->SendMessage(WM_PDB_ONAPPLY);
}
Ejemplo n.º 2
0
    bool AEEditorPrefs::CreateDefaultPreferences(String& path, JSONValue& prefs)
    {
        // Note there is some duplication here with the editor's
        // TypeScript preference code, this is due to the preferences for
        // the editor window needing to be available at window creation time
        // It could be better to split this all out to a native, scriptable
        // preferences object

        ATOMIC_LOGINFOF("Creating default Atomic Editor preferences: %s", path.CString());

        SharedPtr<JSONFile> jsonFile(new JSONFile(context_));

        JSONValue& root = jsonFile->GetRoot();

        root.Clear();
        root["recentProjects"] = JSONArray();

        JSONValue editorWindow;
        GetDefaultWindowPreferences(editorWindow, true);

        JSONValue playerWindow;
        GetDefaultWindowPreferences(playerWindow, false);

        root["editorWindow"] = editorWindow;
        root["playerWindow"] = playerWindow;

        prefs = root;

        SavePreferences(prefs);

        return true;
    }
Ejemplo n.º 3
0
void CPreferencesDlgBase::OnOK()
{
	CDialog::OnOK();
	
	m_pphost.OnOK();
	SavePreferences();
}
Ejemplo n.º 4
0
//Set default preferences and also save it to PREF_FILENAME
int CFSXGUI::CreateDefaultPreferences(bool bAlsoSave)
{
	m_Prefs.PTTVKey = VK_CAPITAL;
	m_Prefs.PTTJoyButton = 1;
	
	if (bAlsoSave)
		return SavePreferences();
	return 1;
}
void PreferenceManager::Update(JavaVM * javaVM)
{
	if (preferenceMapUpdated)
	{
		JNIEnv * env = JNIUtils::GetJNIEnv(javaVM);
		SavePreferences(env);
		LOGD(LOGTAG_JNI,"Detaching thread");
		javaVM->DetachCurrentThread();
	}
}
Ejemplo n.º 6
0
void DIALOG_BUILD_BOM::OnOkClick( wxCommandEvent& event )
{
    char ExportSeparatorSymbol = s_ExportSeparator[0];

    if( m_OutputSeparatorCtrl->GetSelection() > 0 )
        ExportSeparatorSymbol = s_ExportSeparator[m_OutputSeparatorCtrl->GetSelection()];

    int ExportFileType = m_OutputFormCtrl->GetSelection();

    SavePreferences();

    Create_BOM_Lists( ExportFileType, m_ListSubCmpItems->GetValue(),
                      ExportSeparatorSymbol, m_GetListBrowser->GetValue() );
}
Ejemplo n.º 7
0
    void AEEditorPrefs::ValidateWindow()
    {
        Graphics* graphics = GetSubsystem<Graphics>();
        IntVector2 windowPosition = graphics->GetWindowPosition();
        int monitors = graphics->GetNumMonitors();
        IntVector2 maxResolution;

        for (int i = 0; i < monitors; i++)
        {
            IntVector2 monitorResolution = graphics->GetMonitorResolution(i);
            maxResolution += monitorResolution;
        }

        if (windowPosition.x_ >= maxResolution.x_ || windowPosition.y_ >= maxResolution.y_ || (windowPosition.x_ + graphics->GetWidth()) < 0 || (windowPosition.y_ + graphics->GetHeight()) < 0)
        {
            JSONValue prefs;

            if (!LoadPreferences(prefs))
                return;

            bool editor = context_->GetEditorContext();

            JSONValue window;
            GetDefaultWindowPreferences(window, editor);

            prefs[editor ? "editorWindow" : "playerWindow"] = window;


            // TODO: add highDPI support
            bool highDPI = false;

            //Setting the mode to 0 width/height will use engine defaults for window size and layout
            graphics->SetMode(0, 0, graphics->GetFullscreen(), graphics->GetBorderless(), graphics->GetResizable(), highDPI, graphics->GetVSync(), graphics->GetTripleBuffer(), graphics->GetMultiSample(), 0, 0);

            SavePreferences(prefs);
        }
    }
Ejemplo n.º 8
0
/**
**	Save preferences
**
**  @param l  Lua state.
*/
static int CclSavePreferences(lua_State *l)
{
	LuaCheckArgs(l, 0);
	SavePreferences();
	return 0;
}
Ejemplo n.º 9
0
/**
**  Handle keys in command mode.
**
**  @param key  Key scancode.
**
**  @return     True, if key is handled; otherwise false.
*/
static bool CommandKey(int key)
{
	const char *ptr = strchr(UiGroupKeys.c_str(), key);

	// FIXME: don't handle unicode well. Should work on all latin keyboard.
	if (ptr) {
		key = '0' + ptr - UiGroupKeys.c_str();
		if (key > '9') {
			key = SDLK_BACKQUOTE;
		}
	}

	switch (key) {
			// Return enters chat/input mode.
		case SDLK_RETURN:
		case SDLK_KP_ENTER: // RETURN
			UiBeginInput();
			return true;

			// Unselect everything
		case SDLK_CARET:
		case SDLK_BACKQUOTE:
			UiUnselectAll();
			break;

			// Group selection
		case '0': case '1': case '2':
		case '3': case '4': case '5':
		case '6': case '7': case '8':
		case '9':
			CommandKey_Group(key - '0');
			break;

		case SDLK_F2:
		case SDLK_F3:
		case SDLK_F4: // Set/Goto place
			CommandKey_MapPosition(key - SDLK_F2);
			break;

		case SDLK_SPACE: // center on last action
			CenterOnMessage();
			break;

		case SDLK_EQUALS: // plus is shift-equals.
		case SDLK_KP_PLUS:
			UiIncreaseGameSpeed();
			break;

		case SDLK_MINUS: // - Slower
		case SDLK_KP_MINUS:
			UiDecreaseGameSpeed();
			break;
		case SDLK_KP_MULTIPLY:
			UiSetDefaultGameSpeed();
			break;

		case 'b': // ALT+B, CTRL+B Toggle big map
			if (!(KeyModifiers & (ModifierAlt | ModifierControl))) {
				break;
			}
			UiToggleBigMap();
			break;

		case 'c': // ALT+C, CTRL+C C center on units
			UiCenterOnSelected();
			break;

		case 'f': // ALT+F, CTRL+F toggle fullscreen
			if (!(KeyModifiers & (ModifierAlt | ModifierControl))) {
				break;
			}
			ToggleFullScreen();
			SavePreferences();
			break;

		case 'g': // ALT+G, CTRL+G grab mouse pointer
			if (!(KeyModifiers & (ModifierAlt | ModifierControl))) {
				break;
			}
			UiToggleGrabMouse();
			break;

		case 'i':
			if (!(KeyModifiers & (ModifierAlt | ModifierControl))) {
				break;
			}
			// FALL THROUGH
		case SDLK_PERIOD: // ., ALT+I, CTRL+I: Find idle worker
			UiFindIdleWorker();
			break;

		case 'm': // CTRL+M Turn music on / off
			if (KeyModifiers & ModifierControl) {
				UiToggleMusic();
				SavePreferences();
				break;
			}
			break;

		case 'p': // CTRL+P, ALT+P Toggle pause
			if (!(KeyModifiers & (ModifierAlt | ModifierControl))) {
				break;
			}
			// FALL THROUGH (CTRL+P, ALT+P)
		case SDLK_PAUSE:
			UiTogglePause();
			break;

		case 's': // CTRL+S - Turn sound on / off
			if (KeyModifiers & ModifierControl) {
				UiToggleSound();
				SavePreferences();
				break;
			}
			break;

		case 't': // ALT+T, CTRL+T Track unit
			if (!(KeyModifiers & (ModifierAlt | ModifierControl))) {
				break;
			}
			UiTrackUnit();
			break;

		case 'v': // ALT+V, CTRL+V: Viewport
			if (KeyModifiers & ModifierControl) {
				CycleViewportMode(-1);
			} else if (KeyModifiers & ModifierAlt) {
				CycleViewportMode(1);
			}
			break;

		case 'e': // CTRL+E Turn messages on / off
			if (KeyModifiers & ModifierControl) {
				ToggleShowMessages();
			}
#ifdef DEBUG
			else if (KeyModifiers & ModifierAlt) {
				ToggleShowBuilListMessages();
			}
#endif
			break;

		case SDLK_TAB: // TAB toggles minimap.
			// FIXME: more...
			// FIXME: shift+TAB
			if (KeyModifiers & ModifierAlt) {
				break;
			}
			UiToggleTerrain();
			break;

		case SDLK_UP:
		case SDLK_KP8:
			KeyScrollState |= ScrollUp;
			break;
		case SDLK_DOWN:
		case SDLK_KP2:
			KeyScrollState |= ScrollDown;
			break;
		case SDLK_LEFT:
		case SDLK_KP4:
			KeyScrollState |= ScrollLeft;
			break;
		case SDLK_RIGHT:
		case SDLK_KP6:
			KeyScrollState |= ScrollRight;
			break;

		default:
			if (HandleCommandKey(key)) {
				break;
			}
			return false;
	}
	return true;
}
Ejemplo n.º 10
0
void CPreferencesDlgBase::Initialize(CPreferences& prefs)
{
	LoadPreferences(prefs); // this initializes the dialog data
	SavePreferences(prefs); // this writes it back to the prefs
}
Ejemplo n.º 11
0
void CPreferencesDlgBase::OnApply()
{
	m_pphost.OnApply();
	SavePreferences();
}