示例#1
0
void
TopographyThread::Tick()
{
  // TODO: call only once
  SetIdlePriority();

  bool again = true;
  while (next_projection.IsValid() && again && !IsStopped()) {
    const WindowProjection projection = next_projection;

    const ScopeUnlock unlock(mutex);
    again = store.ScanVisibility(projection, 1) > 0;
  }

  /* notify the client that we have updated the topography cache */
  if (callback) {
    const ScopeUnlock unlock(mutex);
    callback();
  }
}
示例#2
0
BOOL SETTINGS :: Dialog (BOOL fOnlyLanguage)
{
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 1" );
#endif
    fAutoLanguage = fOnlyLanguage;

    // load the main dialog window
    hwndDlg = WinLoadDlg (HWND_DESKTOP, hwndFrame, PFNWP (DialogProcedure),
                          GETMODULE, ID_DLG_SETTINGS, this);
    // FIXME YUKKI! YUKKI!! YUKKI!!! But I'm too lazy to do it better now :-)
    g_hwndSettingsDialog = hwndDlg;
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 2" );
#endif

    // disable this two buttons if only language select
    if (fAutoLanguage)
    {
        WinEnableWindow (WinWindowFromID (hwndDlg, WID_PB_HELP), FALSE);
        WinEnableWindow (WinWindowFromID (hwndDlg, WID_PB_UNDO), FALSE);
    }

    HWND   hwndNB = WinWindowFromID (hwndDlg, WID_NB_SETTINGS);
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 3" );
#endif

    // set notebook background color
    WinSendMsg (hwndNB, BKM_SETNOTEBOOKCOLORS,
                MPFROMLONG (SYSCLR_DIALOGBACKGROUND),
                MPFROMSHORT (BKA_BACKGROUNDPAGECOLORINDEX));

    // set tab dimensions
    WinSendMsg (hwndNB, BKM_SETDIMENSIONS,
                MPFROM2SHORT (80, 25), MPFROMSHORT (BKA_MAJORTAB));
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 4" );
#endif

    ULONG   idPage[COUNT_PAGES];
    USHORT  i, cPages;

    if (fOnlyLanguage)
    {
        cPages = 1;

        idPage[0] = (ULONG)
            WinSendMsg (hwndNB, BKM_INSERTPAGE, 0L,
                        MPFROM2SHORT (BKA_MAJOR | BKA_AUTOPAGESIZE,
                                      BKA_LAST));
        WinSendMsg (hwndNB, BKM_SETTABTEXT, MPFROMLONG (idPage[0]),
                    MPFROMP (pszPageTab[COUNT_PAGES-1]));
        hwndPage[0] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page4Procedure,
                                  GETMODULE, ID_DLG_SETTINGSPAGE4, this);
    }
    else
    {
        cPages = COUNT_PAGES;

        // insert empty pages
        for (i = 0; i < cPages; i++)
        {
            idPage[i] = (ULONG)
                WinSendMsg (hwndNB, BKM_INSERTPAGE, 0L,
                            MPFROM2SHORT (BKA_MAJOR | BKA_AUTOPAGESIZE,
                                          BKA_LAST));
            WinSendMsg (hwndNB, BKM_SETTABTEXT,
                        MPFROMLONG (idPage[i]), MPFROMP (pszPageTab[i]));
        }

        // open and assign dialogs to pages
        hwndPage[0] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page1Procedure,
                                  GETMODULE, ID_DLG_SETTINGSPAGE1, this);
        hwndPage[1] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page2Procedure,
                                  GETMODULE, ID_DLG_SETTINGSPAGE2, this);
        hwndPage[2] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page3Procedure,
                                  GETMODULE, ID_DLG_SETTINGSPAGE3, this);
        hwndPage[3] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page4Procedure,
                                  GETMODULE, ID_DLG_SETTINGSPAGE4, this);
    }
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 5" );
#endif

    // combine dlg-handle and page ids
    for (i = 0; i < cPages; i++)
        WinSendMsg (hwndNB, BKM_SETPAGEWINDOWHWND,
                    MPFROMLONG (idPage[i]), MPFROMHWND (hwndPage[i]));

/*    if (fAutoLanguage)
        WinSendMsg (hwndNB, BKM_TURNTOPAGE, MPFROMLONG (idPage[0]), 0L);
#if (COUNT_PAGES != 4)
#warning FIXME settings.cpp 264 or so ...
#endif */
    for (i = 0; i < cPages; i++)
        WinSendMsg (hwndPage[i], UM_SETTINGS2DIALOG, 0,0);
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 6" );
#endif

    //WinSetFocus (WinWindowFromID (hwndDlg, WID_PB_OK), TRUE);
    //WinSetFocus( hwndPage[0], TRUE );
    WinSetActiveWindow( HWND_DESKTOP, hwndPage[0] );
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 7" );
#endif

    WinProcessDlg (hwndDlg);
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 7.5" );
#endif
    WinDestroyWindow (hwndDlg);
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 8" );
#endif

    // it ain't the best way to do it, but ...
    SetIdlePriority(QueryFlag(SEI_IDLEPRIORITY));

    for (i = 0; i < COUNT_PAGES; i++)
        hwndPage[i] = NULL;

    hwndDlg = NULLHANDLE;
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 9" );
#endif
    return TRUE;
}