Пример #1
0
CPreferencesDlg::CPreferencesDlg(CShortcutManager* pShortcutMgr, 
								 const CContentMgr* pContentMgr, 
								 const CImportExportMgr* pExportMgr,
								 const CUIExtensionMgr* pMgrUIExt,
								 CWnd* pParent /*=NULL*/)
	: 
	CPreferencesDlgBase(IDD_PREFERENCES, pParent), 
	m_pageShortcuts(pShortcutMgr), 
	m_pageUI(pContentMgr, pMgrUIExt), 
	m_pageFile2(pExportMgr),
	m_sizeCurrent(-1, -1)
{
	CPreferencesDlgBase::AddPage(&m_pageGen);
	CPreferencesDlgBase::AddPage(&m_pageMultiUser);
	CPreferencesDlgBase::AddPage(&m_pageFile);
	CPreferencesDlgBase::AddPage(&m_pageFile2);
	CPreferencesDlgBase::AddPage(&m_pageUI);
	CPreferencesDlgBase::AddPage(&m_pageUIVisibility);
	CPreferencesDlgBase::AddPage(&m_pageUITasklist);
	CPreferencesDlgBase::AddPage(&m_pageUITasklistColors);
	CPreferencesDlgBase::AddPage(&m_pageTask);
	CPreferencesDlgBase::AddPage(&m_pageTaskCalc);
	CPreferencesDlgBase::AddPage(&m_pageTaskDef);
	CPreferencesDlgBase::AddPage(&m_pageExport);
	CPreferencesDlgBase::AddPage(&m_pageTool);
	CPreferencesDlgBase::AddPage(&m_pageShortcuts);

	ForwardMessage(WM_PUITCP_ATTRIBCHANGE);
	ForwardMessage(WM_PTP_TESTTOOL);
	ForwardMessage(WM_PGP_CLEARMRU);
	ForwardMessage(WM_PGP_CLEANUPDICTIONARY);
	ForwardMessage(WM_PPB_CTRLCHANGE);
	
	LoadPreferences();
}
/*
 * Constructor.
 */
PrefsDialog::PrefsDialog(wxWindow* parent)
    : wxDialog(parent, IDD_PREFS, wxT("Preferences"), wxDefaultPosition,
        wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
      mAutoPowerOn(false),
      mGammaCorrection(1.0),
      mEnableSound(true),
      mEnableFakeCamera(true),
      mLogLevel(0)
{
    LoadPreferences();   
    CreateControls();
}
Пример #3
0
SettingsDialog::SettingsDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SettingsDialog)
{
    ui->setupUi(this);

    //Not needed, as it can be set in the ui editor, but left for ease of ui edit.
    ui->stackedWidget->setCurrentIndex(0);

    LoadPreferences();
    connect(ui->listWidget, &QListWidget::currentItemChanged, this, &SettingsDialog::changePage);
}
Пример #4
0
/*
 * Start the plugin. Calls start_hook() which can be over-ridden by the
 * derrived classes.
 * @returns true if started sucessfully, false otherwise.
 */
bool Plugin::Start() {
  string enabled;

  if (m_enabled)
    return false;

  // setup prefs
  if (!LoadPreferences())
    return false;

  if (!StartHook()) {
    return false;
  }

  m_enabled = true;
  return true;
}
Пример #5
0
//User has selected FSX addon menu ("VatConnect...")
void CFSXGUI::OnFSXAddonMenuSelected()
{
	if (m_bRunning)
		return;

	m_bRunning = true;
	if (!m_bGraphicsInitialized)
	{
		m_apDialogs.push_back(&m_dlgMain);
		m_apOpenDialogs.push_back(&m_dlgMain);
	}

	//Determine full path to preferences file. 
	PWSTR pPath;
	if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, &pPath)))
	{
		WCHAR Temp[MAX_PATH];
		size_t n;
		wcscpy_s(Temp, MAX_PATH, pPath);
		CoTaskMemFree(pPath);

		//Make directory just in case not there. Since this is the first module called,
		//other classes don't have to do this.
		PathAppend(Temp, APPDATA_FOLDER);
		CreateDirectory(Temp, NULL);

		PathAppend(Temp, PREF_FILENAME_L);
		wcstombs_s(&n, m_cPrefPathAndFilename, Temp, MAX_PATH);
	}

	//Load preferences/options 
	CParser File;
	CreateDefaultPreferences(false);

	if (!File.SetFileAsInput(m_cPrefPathAndFilename))
		CreateDefaultPreferences(true);
	else
		LoadPreferences(File); //REVISIT if this fails (mangled file?), values are okay but should alert user

	return;
} 
Пример #6
0
Dialog::Dialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog)
{

    ui->setupUi(this);
    Table = new QTableWidget(0, 6);
    ui->verticalLayout_2->addWidget(Table);
    QStringList labels;
    labels << tr("Station name") << tr("x")<<tr("y")<<tr("z")<<tr("Pressure")<<tr("Temperature");
    Table->setHorizontalHeaderLabels(labels);
    Table->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
    Table->verticalHeader()->hide();
    Table->setShowGrid(false);
    if(!LoadPreferences("preferences.wfs"))
    {
        QMessageBox::warning(this,"WARNING","File preferences.wfs missing!");
    }
    wrffile = new WrfFileRead;

}
    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);
        }
    }
    bool AEEditorPrefs::ReadPreferences(VariantMap& engineParameters)
    {
        String path = GetPreferencesPath();

        JSONValue prefs;

        LoadPreferences(prefs);

        if (!prefs.IsObject() || !prefs["editorWindow"].IsObject())
        {
            if (!CreateDefaultPreferences(path, prefs))
                return false;
        }

        JSONValue& editorWindow = prefs["editorWindow"];

        engineParameters["WindowPositionX"] = editorWindow["x"].GetUInt();
        engineParameters["WindowPositionY"] = editorWindow["y"].GetUInt();
        engineParameters["WindowWidth"] = editorWindow["width"].GetUInt();
        engineParameters["WindowHeight"] = editorWindow["height"].GetUInt();
        engineParameters["WindowMaximized"] = editorWindow["maximized"].GetBool();

        return true;
    }
Пример #9
0
/*
 * Removes any custom icons in classes, custom menus, etc.
 * Frees all members in pref structure.
 * Reloads the preferences file.
 * Set custom icons and menus again.
 */
static void
ReloadPrefs(void)
{
    int i;

#ifdef XWIN_MULTIWINDOW
    /* First, iterate over all windows, deleting their icons and custom menus.
     * This is really only needed because winDestroyIcon() will try to
     * destroy the old global icons, which will have changed.
     * It is probably better to set a windows USER_DATA to flag locally defined
     * icons, and use that to accurately know when to destroy old icons.
     */
    EnumThreadWindows(g_dwCurrentThreadID, ReloadEnumWindowsProc, FALSE);
#endif

    /* Now, free/clear all info from our prefs structure */
    for (i = 0; i < pref.menuItems; i++)
        free(pref.menu[i].menuItem);
    free(pref.menu);
    pref.menu = NULL;
    pref.menuItems = 0;

    pref.rootMenuName[0] = 0;

    free(pref.sysMenu);
    pref.sysMenuItems = 0;

    pref.defaultSysMenuName[0] = 0;
    pref.defaultSysMenuPos = 0;

    pref.iconDirectory[0] = 0;
    pref.defaultIconName[0] = 0;
    pref.trayIconName[0] = 0;

    for (i = 0; i < pref.iconItems; i++)
        if (pref.icon[i].hicon)
            DestroyIcon((HICON) pref.icon[i].hicon);
    free(pref.icon);
    pref.icon = NULL;
    pref.iconItems = 0;

    /* Free global default X icon */
    if (g_hIconX)
        DestroyIcon(g_hIconX);
    if (g_hSmallIconX)
        DestroyIcon(g_hSmallIconX);

    /* Reset the custom command IDs */
    g_cmdid = STARTMENUID;

    /* Load the updated resource file */
    LoadPreferences();

    g_hIconX = NULL;
    g_hSmallIconX = NULL;

#ifdef XWIN_MULTIWINDOW
    winInitGlobalIcons();
#endif

#ifdef XWIN_MULTIWINDOW
    /* Rebuild the icons and menus */
    EnumThreadWindows(g_dwCurrentThreadID, ReloadEnumWindowsProc, TRUE);
#endif

    /* Whew, done */
}
Пример #10
0
void
InitOutput(ScreenInfo * screenInfo, int argc, char *argv[])
{
    int i;

    /* Log the command line */
    winLogCommandLine(argc, argv);

#if CYGDEBUG
    winDebug("InitOutput\n");
#endif

    /* Validate command-line arguments */
    if (serverGeneration == 1 && !winValidateArgs()) {
        FatalError("InitOutput - Invalid command-line arguments found.  "
                   "Exiting.\n");
    }

    /* Check for duplicate invocation on same display number. */
    if (serverGeneration == 1 && !winCheckDisplayNumber()) {
        if (g_fSilentDupError)
            g_fSilentFatalError = TRUE;
        FatalError("InitOutput - Duplicate invocation on display "
                   "number: %s.  Exiting.\n", display);
    }

#ifdef XWIN_XF86CONFIG
    /* Try to read the xorg.conf-style configuration file */
    if (!winReadConfigfile())
        winErrorFVerb(1, "InitOutput - Error reading config file\n");
#else
    winMsg(X_INFO, "xorg.conf is not supported\n");
    winMsg(X_INFO, "See http://x.cygwin.com/docs/faq/cygwin-x-faq.html "
           "for more information\n");
    winConfigFiles();
#endif

    /* Load preferences from XWinrc file */
    LoadPreferences();

    /* Setup global screen info parameters */
    screenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
    screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
    screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
    screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
    screenInfo->numPixmapFormats = NUMFORMATS;

    /* Describe how we want common pixmap formats padded */
    for (i = 0; i < NUMFORMATS; i++) {
        screenInfo->formats[i] = g_PixmapFormats[i];
    }

    /* Load pointers to DirectDraw functions */
    winGetDDProcAddresses();

    /* Detect supported engines */
    winDetectSupportedEngines();

    /* Store the instance handle */
    g_hInstance = GetModuleHandle(NULL);

    /* Initialize each screen */
    for (i = 0; i < g_iNumScreens; ++i) {
        /* Initialize the screen */
        if (-1 == AddScreen(winScreenInit, argc, argv)) {
            FatalError("InitOutput - Couldn't add screen %d", i);
        }
    }

#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)

    /* Generate a cookie used by internal clients for authorization */
    if (g_fXdmcpEnabled || g_fAuthEnabled)
        winGenerateAuthorization();

    /* Perform some one time initialization */
    if (1 == serverGeneration) {
        /*
         * setlocale applies to all threads in the current process.
         * Apply locale specified in LANG environment variable.
         */
        setlocale(LC_ALL, "");
    }
#endif

#if CYGDEBUG || YES
    winDebug("InitOutput - Returning.\n");
#endif
}
Пример #11
0
void
InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
{
    int i;

    if (serverGeneration == 1)
        XwinExtensionInit();

    /* Log the command line */
    winLogCommandLine(argc, argv);

#if CYGDEBUG
    winDebug("InitOutput\n");
#endif

    /* Validate command-line arguments */
    if (serverGeneration == 1 && !winValidateArgs()) {
        FatalError("InitOutput - Invalid command-line arguments found.  "
                   "Exiting.\n");
    }

    /* Check for duplicate invocation on same display number. */
    if (serverGeneration == 1 && !winCheckDisplayNumber()) {
        if (g_fSilentDupError)
            g_fSilentFatalError = TRUE;
        FatalError("InitOutput - Duplicate invocation on display "
                   "number: %s.  Exiting.\n", display);
    }

#ifdef XWIN_XF86CONFIG
    /* Try to read the xorg.conf-style configuration file */
    if (!winReadConfigfile())
        winErrorFVerb(1, "InitOutput - Error reading config file\n");
#else
    winMsg(X_INFO, "xorg.conf is not supported\n");
    winMsg(X_INFO, "See http://x.cygwin.com/docs/faq/cygwin-x-faq.html "
           "for more information\n");
    winConfigFiles();
#endif

    /* Load preferences from XWinrc file */
    LoadPreferences();

    /* Setup global screen info parameters */
    pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
    pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
    pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
    pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
    pScreenInfo->numPixmapFormats = NUMFORMATS;

    /* Describe how we want common pixmap formats padded */
    for (i = 0; i < NUMFORMATS; i++) {
        pScreenInfo->formats[i] = g_PixmapFormats[i];
    }

    /* Load pointers to DirectDraw functions */
    winGetDDProcAddresses();

    /* Detect supported engines */
    winDetectSupportedEngines();
#ifdef XWIN_MULTIWINDOW
    /* Load libraries for taskbar grouping */
    winPropertyStoreInit();
#endif

    /* Store the instance handle */
    g_hInstance = GetModuleHandle(NULL);

    /* Create the messaging window */
    if (serverGeneration == 1)
        winCreateMsgWindowThread();

    /* Initialize each screen */
    for (i = 0; i < g_iNumScreens; ++i) {
        /* Initialize the screen */
        if (-1 == AddScreen(winScreenInit, argc, argv)) {
            FatalError("InitOutput - Couldn't add screen %d", i);
        }
    }

  /*
     Unless full xinerama has been explicitly enabled, register all native screens with pseudoramiX
  */
  if (!noPanoramiXExtension)
      noPseudoramiXExtension = TRUE;

  if ((g_ScreenInfo[0].fMultipleMonitors) && !noPseudoramiXExtension)
    {
      int pass;

      PseudoramiXExtensionInit();

      /* Add primary monitor on pass 0, other monitors on pass 1, to ensure
       the primary monitor is first in XINERAMA list */
      for (pass = 0; pass < 2; pass++)
        {
          int iMonitor;

          for (iMonitor = 1; ; iMonitor++)
            {
              struct GetMonitorInfoData data;
              QueryMonitor(iMonitor, &data);
              if (data.bMonitorSpecifiedExists)
                {
                  MONITORINFO mi;
                  mi.cbSize = sizeof(MONITORINFO);

                  if (GetMonitorInfo(data.monitorHandle, &mi))
                    {
                      /* pass == 1 XOR primary monitor flags is set */
                      if ((!(pass == 1)) != (!(mi.dwFlags & MONITORINFOF_PRIMARY)))
                        {
                          /*
                            Note the screen origin in a normalized coordinate space where (0,0) is at the top left
                            of the native virtual desktop area
                          */
                          data.monitorOffsetX = data.monitorOffsetX - GetSystemMetrics(SM_XVIRTUALSCREEN);
                          data.monitorOffsetY = data.monitorOffsetY - GetSystemMetrics(SM_YVIRTUALSCREEN);

                          winDebug ("InitOutput - screen %d added at virtual desktop coordinate (%d,%d) (pseudoramiX) \n",
                                    iMonitor-1, data.monitorOffsetX, data.monitorOffsetY);

                          PseudoramiXAddScreen(data.monitorOffsetX, data.monitorOffsetY,
                                               data.monitorWidth, data.monitorHeight);
                        }
                    }
                }
              else
                break;
            }
        }
    }

#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)

    /* Generate a cookie used by internal clients for authorization */
    if (g_fXdmcpEnabled || g_fAuthEnabled)
        winGenerateAuthorization();

    /* Perform some one time initialization */
    if (1 == serverGeneration) {
        /*
         * setlocale applies to all threads in the current process.
         * Apply locale specified in LANG environment variable.
         */
        setlocale(LC_ALL, "");
    }
#endif

#if CYGDEBUG || YES
    winDebug("InitOutput - Returning.\n");
#endif
}
Пример #12
0
BOOL CPreferences::OnInitDialog()
{
	BOOL bRet = CDialog::OnInitDialog();
	LoadPreferences();
	return bRet;
}
Пример #13
0
void CPreferencesDlgBase::LoadPreferences()
{
	LoadPreferences(m_prefs);
}
Пример #14
0
void CPreferencesDlgBase::Initialize(CPreferences& prefs)
{
	LoadPreferences(prefs); // this initializes the dialog data
	SavePreferences(prefs); // this writes it back to the prefs
}