コード例 #1
0
GuideAlgorithmResistSwitch::
    GuideAlgorithmResistSwitchConfigDialogPane::
    GuideAlgorithmResistSwitchConfigDialogPane(wxWindow *pParent, GuideAlgorithmResistSwitch *pGuideAlgorithm)
    : ConfigDialogPane(_("ResistSwitch Guide Algorithm"), pParent)
{
    int width;

    m_pGuideAlgorithm = pGuideAlgorithm;

    width = StringWidth(_T("000"));
    m_pAggression = new wxSpinCtrlDouble(pParent, wxID_ANY, _T(""), wxPoint(-1, -1),
        wxSize(width + 30, -1), wxSP_ARROW_KEYS, 1.0, 100.0, 100.0, 5.0, _T("Aggressiveness"));
    m_pAggression->SetDigits(0);

    DoAdd(_("Aggressiveness"), m_pAggression,
        wxString::Format(_("Aggressiveness factor, percent. Default = %.f%%"), DefaultAggression * 100.0));

    width = StringWidth(_T("00.00"));
    m_pMinMove = new wxSpinCtrlDouble(pParent, wxID_ANY,_T(""), wxPoint(-1,-1),
        wxSize(width+30, -1), wxSP_ARROW_KEYS, 0.0, 20.0, 0.0, 0.05, _T("MinMove"));
    m_pMinMove->SetDigits(2);

    DoAdd(_("Minimum Move (pixels)"), m_pMinMove,
        wxString::Format(_("How many (fractional) pixels must the star move to trigger a guide pulse? \n"
        "If camera is binned, this is a fraction of the binned pixel size. Default = %.2f"), DefaultMinMove));

    m_pFastSwitch = new wxCheckBox(pParent, wxID_ANY, _("Fast switch for large deflections"));
    DoAdd(m_pFastSwitch, _("Ordinarily the Resist Switch algortithm waits several frames before switching direction. With Fast Switch enabled PHD2 will switch direction immediately if it sees a very large deflection. Enable this option if your mount has a substantial amount of backlash and PHD2 sometimes overcorrects."));
}
コード例 #2
0
GuideAlgorithmLowpass::
    GuideAlgorithmLowpassConfigDialogPane::
    GuideAlgorithmLowpassConfigDialogPane(wxWindow *pParent, GuideAlgorithmLowpass *pGuideAlgorithm)
    : ConfigDialogPane(_("Lowpass Guide Algorithm"), pParent)
{
    int width;

    m_pGuideAlgorithm = pGuideAlgorithm;

    width = StringWidth(_T("000.00"));
    m_pSlopeWeight = new wxSpinCtrlDouble(pParent, wxID_ANY,_T("foo2"), wxPoint(-1,-1),
        wxSize(width+30, -1), wxSP_ARROW_KEYS, 0.0, 20.0, 0.0, 0.5,_T("SlopeWeight"));
    m_pSlopeWeight->SetDigits(2);

    DoAdd(_("Slope Weight"), m_pSlopeWeight,
        _("Weighting of slope parameter in lowpass auto-dec"));

    width = StringWidth(_T("000.00"));
    m_pMinMove = new wxSpinCtrlDouble(pParent, wxID_ANY,_T("foo2"), wxPoint(-1,-1),
        wxSize(width+30, -1), wxSP_ARROW_KEYS, 0.0, 20.0, 0.0, 0.05,_T("MinMove"));
    m_pMinMove->SetDigits(2);

    DoAdd(_("Minimum Move (pixels)"), m_pMinMove,
        _("How many (fractional) pixels must the star move to trigger a guide pulse? Default = 0.15"));

}
コード例 #3
0
GuideAlgorithmLowpass::
    GuideAlgorithmLowpassGraphControlPane::
    GuideAlgorithmLowpassGraphControlPane(wxWindow *pParent, GuideAlgorithmLowpass *pGuideAlgorithm, const wxString& label)
    : GraphControlPane(pParent, label)
{
    int width;

    m_pGuideAlgorithm = pGuideAlgorithm;

    width = StringWidth(_T("000.00"));
    m_pSlopeWeight = new wxSpinCtrlDouble(this, wxID_ANY, wxEmptyString, wxDefaultPosition,
        wxSize(width+30, -1), wxSP_ARROW_KEYS, 0.0, 20.0, 0.0, 0.5,_T("SlopeWeight"));
    m_pSlopeWeight->SetDigits(2);
    m_pSlopeWeight->Bind(wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED, &GuideAlgorithmLowpass::GuideAlgorithmLowpassGraphControlPane::OnSlopeWeightSpinCtrlDouble, this);
    DoAdd(m_pSlopeWeight, _("Sl W"));

    width = StringWidth(_T("000.00"));
    m_pMinMove = new wxSpinCtrlDouble(this, wxID_ANY, wxEmptyString, wxDefaultPosition,
        wxSize(width+30, -1), wxSP_ARROW_KEYS, 0.0, 20.0, 0.0, 0.05,_T("MinMove"));
    m_pMinMove->SetDigits(2);
    m_pMinMove->Bind(wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED, &GuideAlgorithmLowpass::GuideAlgorithmLowpassGraphControlPane::OnMinMoveSpinCtrlDouble, this);
    DoAdd(m_pMinMove, _("MnMo"));

    m_pSlopeWeight->SetValue(m_pGuideAlgorithm->GetSlopeWeight());
    m_pMinMove->SetValue(m_pGuideAlgorithm->GetMinMove());
}
コード例 #4
0
ファイル: bigint_en.c プロジェクト: xkuga/bigint
// implement of Multiplication by using booth algorithm
// result = a * b
BigInt* DoMul(BigInt* a, BigInt* b, BigInt* result)
{
    int i;
    BigInt c, t;

    ToOppositeNumberComplement(a, &c);  // c = [-a] complement

    memset(t.bit, 0, BIG_INT_BIT_LEN);  // init 0

    // filter
    for (i = SIGN_BIT; i > 0 && b->bit[i] == b->bit[i - 1]; i--);

    while (i > 0)
    {
        ShiftArithmeticLeft(&t, 1, &t);

        if (b->bit[i] != b->bit[i - 1])
        {
            DoAdd(&t, b->bit[i - 1] > b->bit[i] ? a : &c, &t);
        }

        i--;
    }

    // the last shift
    ShiftArithmeticLeft(&t, 1, &t);
    if (b->bit[0] != 0)
    {
        DoAdd(&t, &c, &t);
    }

    return CopyBigInt(&t, result);
}
コード例 #5
0
GuideAlgorithmResistSwitch::
    GuideAlgorithmResistSwitchGraphControlPane::
    GuideAlgorithmResistSwitchGraphControlPane(wxWindow *pParent, GuideAlgorithmResistSwitch *pGuideAlgorithm, const wxString& label)
    : GraphControlPane(pParent, label)
{
    int width;

    m_pGuideAlgorithm = pGuideAlgorithm;

    // Aggression
    width = StringWidth(_T("000"));
    m_pAggression = new wxSpinCtrlDouble(this, wxID_ANY, _T(""), wxPoint(-1, -1),
        wxSize(width + 30, -1), wxSP_ARROW_KEYS, 1.0, 100.0, 100.0, 5.0, _T("Aggressiveness"));
    m_pAggression->SetDigits(0);
    m_pAggression->Bind(wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED, &GuideAlgorithmResistSwitch::GuideAlgorithmResistSwitchGraphControlPane::OnAggressionSpinCtrlDouble, this);
    DoAdd(m_pAggression, _T("Agr"));
    m_pAggression->SetValue(m_pGuideAlgorithm->GetAggression() * 100.0);

    // Min move
    width = StringWidth(_T("00.00"));
    m_pMinMove = new wxSpinCtrlDouble(this, wxID_ANY, _T(""), wxPoint(-1,-1),
        wxSize(width+30, -1), wxSP_ARROW_KEYS, 0.0, 20.0, 0.0, 0.05, _T("MinMove"));
    m_pMinMove->SetDigits(2);
    m_pMinMove->Bind(wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED, &GuideAlgorithmResistSwitch::GuideAlgorithmResistSwitchGraphControlPane::OnMinMoveSpinCtrlDouble, this);
    DoAdd(m_pMinMove,_T("MnMo"));
    m_pMinMove->SetValue(m_pGuideAlgorithm->GetMinMove());
}
コード例 #6
0
GuiderOneStar::GuiderOneStarConfigDialogPane::GuiderOneStarConfigDialogPane(wxWindow *pParent, GuiderOneStar *pGuider)
    : GuiderConfigDialogPane(pParent, pGuider)
{
    int width;

    m_pGuiderOneStar = pGuider;

    width = StringWidth(_T("0000"));
    m_pSearchRegion = new wxSpinCtrl(pParent, wxID_ANY, _T("foo2"), wxPoint(-1,-1),
                                     wxSize(width+30, -1), wxSP_ARROW_KEYS, MIN_SEARCH_REGION, MAX_SEARCH_REGION, DEFAULT_SEARCH_REGION, _T("Search"));
    DoAdd(_("Search region (pixels)"), m_pSearchRegion,
          _("How many pixels (up/down/left/right) do we examine to find the star? Default = 15"));

    m_pEnableStarMassChangeThresh = new wxCheckBox(pParent, STAR_MASS_ENABLE, _("Star mass change detection"));
    DoAdd(m_pEnableStarMassChangeThresh, _("Check to enable star mass change detection. When enabled, "
        "PHD skips frames when the guide star mass changes by an amount greater than the Star mass tolerance setting."));

    pParent->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &GuiderOneStar::GuiderOneStarConfigDialogPane::OnStarMassEnableChecked, this, STAR_MASS_ENABLE);

    width = StringWidth(_T("100.0"));
    m_pMassChangeThreshold = new wxSpinCtrlDouble(pParent, wxID_ANY,_T("foo2"), wxPoint(-1,-1),
            wxSize(width+30, -1), wxSP_ARROW_KEYS, 0.1, 100.0, 0.0, 1.0,_T("MassChangeThreshold"));
    m_pMassChangeThreshold->SetDigits(1);
    DoAdd(_("Star mass tolerance"), m_pMassChangeThreshold,
          _("When star mass change detection is enabled, this is the tolerance for star mass changes between frames, in percent. "
          "Larger values are more tolerant (less sensitive) to star mass changes. Valid range is 10-100, default is 50. "
          "If star mass change detection is not enabled then this setting is ignored."));
}
コード例 #7
0
void TSessionLog::Add(TLogLineType Type, UnicodeString ALine)
{
  DebugAssert(FConfiguration);
  if (GetLogging())
  {
    try
    {
      if (FParent != nullptr)
      {
        DoAdd(Type, ALine, nb::bind(&TSessionLog::DoAddToParent, this));
      }
      else
      {
        TGuard Guard(FCriticalSection);

        DoAdd(Type, ALine, nb::bind(&TSessionLog::DoAddToSelf, this));
      }
    }
    catch (Exception &E)
    {
      // We failed logging, turn it off and notify user.
      FConfiguration->SetLogging(false);
      try
      {
        throw ExtException(&E, LoadStr(LOG_GEN_ERROR));
      }
      catch (Exception &E2)
      {
        AddException(&E2);
        FUI->HandleExtendedException(&E2);
      }
    }
  }
}
コード例 #8
0
GuideAlgorithmHysteresis::
GuideAlgorithmHysteresisConfigDialogPane::
GuideAlgorithmHysteresisConfigDialogPane(wxWindow *pParent, GuideAlgorithmHysteresis *pGuideAlgorithm)
    : ConfigDialogPane(_("Hysteresis Guide Algorithm"), pParent)
{
    int width;

    m_pGuideAlgorithm = pGuideAlgorithm;

    width = StringWidth(_T("000"));
    m_pHysteresis = new wxSpinCtrlDouble(pParent, wxID_ANY,_T(""), wxPoint(-1,-1),
            wxSize(width + 30, -1), wxSP_ARROW_KEYS, 0.0, MaxHysteresis * 100.0, 0.0, 5.0, _T("Hysteresis"));
    m_pHysteresis->SetDigits(0);

    DoAdd(_("Hysteresis"), m_pHysteresis,
           wxString::Format(_("How much history of previous guide pulses should be applied\nDefault = %.f%%, increase to smooth out guiding commands"), DefaultHysteresis * 100.0));

    width = StringWidth(_T("000"));
    m_pAggression = new wxSpinCtrlDouble(pParent, wxID_ANY,_T(""), wxPoint(-1,-1),
            wxSize(width+30, -1), wxSP_ARROW_KEYS, 0.0, MaxAggression * 100.0, 0.0, 5.0, _T("Aggression"));
    m_pAggression->SetDigits(0);

    DoAdd(_("Aggression"), m_pAggression,
          wxString::Format(_("What percent of the measured error should be applied? Default = %.f%%, adjust if responding too much or too slowly"), DefaultAggression * 100.0));

    width = StringWidth(_T("00.00"));
    m_pMinMove = new wxSpinCtrlDouble(pParent, wxID_ANY,_T("foo2"), wxPoint(-1,-1),
            wxSize(width+30, -1), wxSP_ARROW_KEYS, 0.0, 20.0, 0.0, 0.05, _T("MinMove"));
    m_pMinMove->SetDigits(2);

    DoAdd(_("Minimum Move (pixels)"), m_pMinMove,
          wxString::Format(_("How many (fractional) pixels must the star move to trigger a guide pulse? Default = %.2f"), DefaultMinMove));
}
コード例 #9
0
// An example of a function that can be called asynchronously
HRESULT Add(
    __in int a, 
    __in int b, 
    __out int* sumPointer, 
    __in_opt const WS_ASYNC_CONTEXT* asyncContext, 
    __in_opt WS_ERROR* error)
{
    if (asyncContext == NULL)
    {
        // Invoked synchronously, so do the addition on calling thread
        return DoAdd(a, b, sumPointer, error);
    }
    else
    {
        // Invoked asynchronously

        // Decide whether to complete synchronously or asynchronously
        if (b == 0)
        {
            // Complete synchronously.  We have this case just as an illustration
            // that synchronous completion is possible when invoked asynchronously.
            return DoAdd(a, b, sumPointer, error);
        }
        else
        {
            // Complete asynchronously

            // Alloc space for in/out parameters
            AddParameters* addParameters;
            addParameters = (AddParameters*)HeapAlloc(GetProcessHeap(), 0, sizeof(AddParameters));
            if (addParameters == NULL)
            {
                return E_OUTOFMEMORY;
            }

            // Make a copy of in/out parameters
            addParameters->a = a;
            addParameters->b = b;
            addParameters->sumPointer = sumPointer;
            addParameters->error = error;
            addParameters->asyncContext = *asyncContext;

            // Create a thread which will do the work, passing parameters
            HANDLE threadHandle = CreateThread(NULL, 0, AdderThread, addParameters, 0, NULL);
            if (threadHandle == NULL)
            {
                // Free the parameters
                HeapFree(GetProcessHeap(), 0, addParameters);
                return HRESULT_FROM_WIN32(GetLastError());
            }

            // Close returned thread handle
            CloseHandle(threadHandle);

            // Indicate asynchronous completion
            return WS_S_ASYNC;
        }
    }
}
コード例 #10
0
ファイル: fswatcher.cpp プロジェクト: Richard-Ni/wxWidgets
bool
wxMSWFileSystemWatcher::AddTree(const wxFileName& path,
                                int events,
                                const wxString& filter)
{
    if ( !filter.empty() )
    {
        // Use the inefficient generic version as we can only monitor
        // everything under the given directory.
        //
        // Notice that it would probably be better to still monitor everything
        // natively and filter out the changes we're not interested in.
        return wxFileSystemWatcherBase::AddTree(path, events, filter);
    }


    if ( !path.DirExists() )
    {
        wxLogError(_("Can't monitor non-existent directory \"%s\" for changes."),
                   path.GetFullPath());
        return false;
    }

    return DoAdd(path, events, wxFSWPath_Tree);
}
コード例 #11
0
// A thread function that adds two numbers
DWORD WINAPI AdderThread(
    __in void* threadParameter)
{
    // Get the parameters for Add which were passed in CreateThread
    AddParameters* addParameters = (AddParameters*)threadParameter;

    // Do the addition
    HRESULT hr = DoAdd(
        addParameters->a, 
        addParameters->b, 
        addParameters->sumPointer, 
        addParameters->error);

    // Make a copy of the async context
    WS_ASYNC_CONTEXT asyncContext = addParameters->asyncContext;

    // Free the parameters
    HeapFree(GetProcessHeap(), 0, addParameters);

    // Notify the caller that the async operation is complete
    // Since we have a dedicated thread for the callback, we can invoke long
    (asyncContext.callback)(hr, WS_LONG_CALLBACK, asyncContext.callbackState);

    return 1;
}
コード例 #12
0
ファイル: bigint_en.c プロジェクト: xkuga/bigint
// implement of Subtraction
// result = a - b
BigInt* DoSub(BigInt* a, BigInt* b, BigInt* result)
{
    BigInt t;

    ToOppositeNumberComplement(b, &t);
    DoAdd(a, &t, result);

    return result;
}
コード例 #13
0
ファイル: bigint_en.c プロジェクト: xkuga/bigint
// Addition
char* Add(char* s1, char* s2, char* result)
{
    BigInt a, b, c;
    
    StrToBigInt(s1, &a);
    StrToBigInt(s2, &b);
    DoAdd(&a, &b, &c);

    return BigIntToStr(&c, result);
}
コード例 #14
0
StepGuider::StepGuiderConfigDialogPane::StepGuiderConfigDialogPane(wxWindow *pParent, StepGuider *pStepGuider)
    : MountConfigDialogPane(pParent, _("AO Settings"), pStepGuider)
{
    int width;

    m_pStepGuider = pStepGuider;

    width = StringWidth(_T("000"));
    m_pCalibrationStepsPerIteration = new wxSpinCtrl(pParent, wxID_ANY,_T("foo2"), wxPoint(-1,-1),
            wxSize(width+30, -1), wxSP_ARROW_KEYS, 0, 10, 3,_T("Cal_Steps"));

    DoAdd(_("Calibration Steps"), m_pCalibrationStepsPerIteration,
        wxString::Format(_("How many steps should be issued per calibration cycle. Default = %d, increase for short f/l scopes and decrease for longer f/l scopes"), DefaultCalibrationStepsPerIteration));

    width = StringWidth(_T("000"));
    m_pSamplesToAverage = new wxSpinCtrl(pParent, wxID_ANY,_T("foo2"), wxPoint(-1,-1),
            wxSize(width+30, -1), wxSP_ARROW_KEYS, 0, 9, 0, _T("Samples_To_Average"));

    DoAdd(_("Samples to Average"), m_pSamplesToAverage,
        wxString::Format(_("When calibrating, how many samples should be averaged. Default = %d, increase for worse seeing and small imaging scales"), DefaultSamplesToAverage));

    width = StringWidth(_T("000"));
    m_pBumpPercentage = new wxSpinCtrl(pParent, wxID_ANY,_T("foo2"), wxPoint(-1,-1),
            wxSize(width+30, -1), wxSP_ARROW_KEYS, 0, 99, 0, _T("Bump_Percentage"));

    DoAdd(_("Bump Percentage"), m_pBumpPercentage,
        wxString::Format(_("What percentage of the AO travel can be used before bumping the mount. Default = %d"), DefaultBumpPercentage));

    width = StringWidth(_T("00.00"));
    m_pBumpMaxStepsPerCycle = new wxSpinCtrlDouble(pParent, wxID_ANY,_T("foo2"), wxPoint(-1,-1),
            wxSize(width+30, -1), wxSP_ARROW_KEYS, 0.01, 99.99, 0.0, 0.25, _T("Bump_steps"));
    wxSizer *sz = MakeLabeledControl(_("Bump Step"), m_pBumpMaxStepsPerCycle, wxString::Format(_("How far should a mount bump move the mount between images (in AO steps). Default = %.2f, decrease if mount bumps cause spikes on the graph"), DefaultBumpMaxStepsPerCycle));

    m_bumpOnDither = new wxCheckBox(pParent, wxID_ANY, _("Bump on Dither"));
    m_bumpOnDither->SetToolTip(_("Bump the mount to return the AO to center at each dither"));

    wxSizer *hsz = new wxBoxSizer(wxHORIZONTAL);
    hsz->Add(sz, wxSizerFlags(1));
    hsz->Add(m_bumpOnDither, wxSizerFlags(1).Right().Border(wxLEFT, 15).Align(wxALIGN_CENTER_VERTICAL));

    DoAdd(hsz);
}
コード例 #15
0
//---------------------------------------------------------------------------
void TSessionLog::Add(TLogLineType Type, const UnicodeString & Line)
{
  assert(FConfiguration);
  if (GetLogging())
  {
    try
    {
      if (FParent != nullptr)
      {
        DoAdd(Type, Line, MAKE_CALLBACK(TSessionLog::DoAddToParent, this));
      }
      else
      {
        TGuard Guard(FCriticalSection);

        BeginUpdate();
        auto cleanup = finally([&]()
        {
          DeleteUnnecessary();
          EndUpdate();
        });
        {
          DoAdd(Type, Line, MAKE_CALLBACK(TSessionLog::DoAddToSelf, this));
        }
      }
    }
    catch (Exception &E)
    {
      // We failed logging, turn it off and notify user.
      FConfiguration->SetLogging(false);
      try
      {
        throw ExtException(&E, LoadStr(LOG_GEN_ERROR));
      }
      catch (Exception &E)
      {
        AddException(&E);
        FUI->HandleExtendedException(&E);
      }
    }
  }
}
コード例 #16
0
GuideAlgorithmHysteresis::
GuideAlgorithmHysteresisGraphControlPane::
GuideAlgorithmHysteresisGraphControlPane(wxWindow *pParent, GuideAlgorithmHysteresis *pGuideAlgorithm, const wxString& label)
    : GraphControlPane(pParent, label)
{
    int width;

    m_pGuideAlgorithm = pGuideAlgorithm;

    // Aggression
    width = StringWidth(_T("000"));
    m_pAggression = new wxSpinCtrlDouble(this, wxID_ANY,_T(""), wxDefaultPosition,
            wxSize(width+30, -1), wxSP_ARROW_KEYS | wxALIGN_RIGHT, 0.0, MaxAggression * 100.0, 0.0, 5.0, _T("Aggression"));
    m_pAggression->SetDigits(0);
    m_pAggression->Bind(wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED, &GuideAlgorithmHysteresis::GuideAlgorithmHysteresisGraphControlPane::OnAggressionSpinCtrlDouble, this);
    DoAdd(m_pAggression, _("Agr"));

    // Hysteresis
    width = StringWidth(_T("000"));
    m_pHysteresis = new wxSpinCtrlDouble(this, wxID_ANY,_T(""), wxDefaultPosition,
            wxSize(width + 30, -1), wxSP_ARROW_KEYS | wxALIGN_RIGHT, 0.0, MaxHysteresis * 100.0, 0.0, 5.0, _T("Hysteresis"));
    m_pHysteresis->SetDigits(0);
    m_pHysteresis->Bind(wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED, &GuideAlgorithmHysteresis::GuideAlgorithmHysteresisGraphControlPane::OnHysteresisSpinCtrlDouble, this);
    DoAdd(m_pHysteresis,_("Hys"));

    // Min move
    width = StringWidth(_T("00.00"));
    m_pMinMove = new wxSpinCtrlDouble(this, wxID_ANY,_T(""), wxPoint(-1,-1),
            wxSize(width+30, -1), wxSP_ARROW_KEYS, 0.0, 20.0, 0.0, 0.05,_T("MinMove"));
    m_pMinMove->SetDigits(2);
    m_pMinMove->Bind(wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED, &GuideAlgorithmHysteresis::GuideAlgorithmHysteresisGraphControlPane::OnMinMoveSpinCtrlDouble, this);
    DoAdd(m_pMinMove,_("MnMo"));

    m_pHysteresis->SetValue(100.0 * m_pGuideAlgorithm->GetHysteresis());
    m_pAggression->SetValue(100.0 * m_pGuideAlgorithm->GetAggression());
    m_pMinMove->SetValue(m_pGuideAlgorithm->GetMinMove());
}
コード例 #17
0
void CBCGPGanttItemStorageBase::Serialize (CArchive& ar)
{
	if (ar.IsLoading ())
	{
		RemoveAll ();
		int nCount = 0;

		// Loading items
		ar >> nCount;

		while (nCount-- > 0)
		{
			CBCGPGanttItem* pItem = NULL;
			ar >> pItem;
			if (pItem != NULL)
			{
				ASSERT_VALID (pItem);
				pItem->m_pStorage = this;
				DoAdd (pItem);
			}
		}

		int nItems = GetCount ();

		// Loading connections
		ar >> nCount;

		while (nCount-- > 0)
		{
			int indexSrc = 0, indexDest = 0, linkType, reserved;

			ar >> indexSrc;
			ar >> indexDest;
			ar >> linkType;
			ar >> reserved;

			if (indexSrc >= 0 && indexSrc < nItems && indexDest >= 0 && indexDest < nItems)
			{
				ASSERT (indexSrc != indexDest);

				if (indexSrc != indexDest)
				{
					AddConnection (GetItem (indexSrc), GetItem (indexDest), linkType);
				}
			}
		}

		UpdateAll (BCGP_GANTT_ITEM_PROP_ALL);
	}
コード例 #18
0
ファイル: Main.c プロジェクト: iKarith/nulib2
/*
 * We have all of the parsed command line options in "pState".  Now we just
 * have to do something useful with it.
 *
 * Returns 0 on success, 1 on error.
 */
int DoWork(NulibState* pState)
{
    NuError err;

    switch (NState_GetCommand(pState)) {
    case kCommandAdd:
        err = DoAdd(pState);
        break;
    case kCommandExtract:
        err = DoExtract(pState);
        break;
    case kCommandExtractToPipe:
        err = DoExtractToPipe(pState);
        break;
    case kCommandTest:
        err = DoTest(pState);
        break;
    case kCommandListShort:
        err = DoListShort(pState);
        break;
    case kCommandListVerbose:
        err = DoListVerbose(pState);
        break;
    case kCommandListDebug:
        err = DoListDebug(pState);
        break;
    case kCommandDelete:
        err = DoDelete(pState);
        break;
    case kCommandHelp:
        err = DoHelp(pState);
        break;
    default:
        fprintf(stderr, "ERROR: unexpected command %d\n",
            NState_GetCommand(pState));
        err = kNuErrInternal;
        Assert(0);
        break;
    }

    return (err != kNuErrNone);
}
コード例 #19
0
ファイル: CalcFunc.cpp プロジェクト: mwhooker/CalcCalc
double DoOperation(char operation, double op1, double op2, int* isErr)
{
	switch (operation)
	{
	case '+':
		return DoAdd(op1, op2);
		break;
	case '-':
		return DoSub(op1, op2);
		break;	
	case '*':
		return DoMul(op1, op2);
		break;
	case '/':
		return DoDiv(op1, op2, isErr);
		break;
	}
	return op2;
	//return WinCalculator->DoOperation(operation, op1, op2, isErr);
}
コード例 #20
0
void ExternalDepsDlg::OnAddAdditional(wxCommandEvent& event)
{
	DoAdd("lstAdditionalFiles", _("Add additional output file"));
}
コード例 #21
0
/**
 * Removes a digital input from this filter.
 *
 * Removes the DigitalSource from this glitch filter and re-assigns it to
 * the default filter.
 *
 * @param input The DigitalSource to remove.
 */
void DigitalGlitchFilter::Remove(DigitalSource* input) { DoAdd(input, 0); }
コード例 #22
0
/**
 * Assigns the DigitalSource to this glitch filter.
 *
 * @param input The DigitalSource to add.
 */
void DigitalGlitchFilter::Add(DigitalSource* input) {
  DoAdd(input, m_channelIndex + 1);
}
コード例 #23
0
ファイル: datalist.cpp プロジェクト: tchv71/StartPP
void DataModelListCtrlAdaptor::OnAdd()
{
    DoAdd();
}
コード例 #24
0
ファイル: qt_ui.C プロジェクト: BackupTheBerlios/thefish-svn
extern "C" int
create_qt_ui(RC_CONF *my_rc,
             int argc, char **argv)
{
    int i;
    char *homedir;
    char temp[FILENAME_MAX];
    int fd;
    FILE *fp;
    QListViewItem *element;
    QCheckListItem *foo;

    MyDialogs my_dialogs;
    TableCallbacks my_tablecallbacks;

    thefish = new QApplication( argc, argv);

    // It's more convenient to have these
    // as global.
    my_rc_knobs = my_rc->knobs_ptr;
    my_rc_strings = my_rc->string_ptr;

    my_num_knobs = my_rc->knobs_size;
    my_num_strings = my_rc->string_size;

    mw = new QMainWindow;

    QVBox *vbox = new QVBox(mw, 0, 0);

    QTabWidget main_tab(vbox, 0, 0);

    knobs_table = new QListView;
    strings_table = new QListView;

    strings_table->setAllColumnsShowFocus(TRUE);

    knobs_table->addColumn("Variable Name", -1);

    strings_table->addColumn("Name", -1);
    strings_table->addColumn("Value",-1);

    QObject::connect(strings_table, SIGNAL(itemRenamed(QListViewItem*, int, const QString &)),
                     &my_tablecallbacks, SLOT(StringChanged(QListViewItem*, int, const QString &)));


    QObject::connect(knobs_table, SIGNAL(clicked(QListViewItem *)),
                     &my_tablecallbacks, SLOT(KnobChanged(QListViewItem*)));


    QObject::connect(strings_table, SIGNAL(clicked(QListViewItem *)),
                     &my_tablecallbacks, SLOT(StringClicked(QListViewItem*)));

    main_tab.addTab(knobs_table, "Knobs");
    main_tab.addTab(strings_table, "Strings");

    QHBox *hbuttons = new QHBox(vbox, 0, 0);

    SaveButton = new QPushButton("&Save", hbuttons, 0);
    QPushButton AddButton("&Add", hbuttons, 0);
    QPushButton AboutButton("A&bout", hbuttons, 0);
    QPushButton QuitButton("&Quit",  hbuttons, 0);

    // No save for now...
    SaveButton->setEnabled(false);

    QObject::connect(&QuitButton, SIGNAL(clicked()), &my_dialogs, SLOT(CheckSaved()));
    QObject::connect(&AboutButton, SIGNAL(clicked()), &my_dialogs, SLOT(ShowAbout()));
    QObject::connect(&AddButton, SIGNAL(clicked()), &my_dialogs, SLOT(DoAdd()));
    QObject::connect(SaveButton, SIGNAL(clicked()), &my_dialogs, SLOT(DoSave()));

    // We're now using human readable data, handle the migration
    // transparently for the user.
    homedir = getenv("HOME");

    if (homedir != NULL) {

        snprintf(temp, FILENAME_MAX, "%s/%s", homedir, ".thefishrc");
        fd = open(temp, O_RDONLY, 0);

        if (fd != -1 ) {

            i = lseek(fd, 0, SEEK_END);
            lseek(fd, 0, SEEK_SET);

            if (i == sizeof(oldsize)) {

                read(fd, &oldsize[0], sizeof(oldsize));
                close(fd);

            } else {

                fp = fdopen(fd, "r");
                fscanf(fp, "geometry=%i,%i", &oldsize[0], &oldsize[1]);
                fclose(fp);

            }

        } else  {
            // Set some default values
            oldsize[0] = 400;
            oldsize[1] = 480;

        }

    }

    // Build the table

    knobs_table->setColumnWidthMode (1, QListView::Maximum);
    knobs_table->setRootIsDecorated(false);

    for (i = my_rc->knobs_size - 1; i >= 0; i--) {

        // No user comments yet
        (my_rc->knobs_ptr+i)->user_comment = 0;

        foo = new QCheckListItem( knobs_table, (my_rc->knobs_ptr+i)->name, QCheckListItem::CheckBox);

        if ((my_rc->knobs_ptr+i)->knob_val == KNOB_IS_NO) {

            foo->setOn(FALSE);

        } else {

            foo->setOn(TRUE);

        }

    }

    for (i = my_rc->string_size - 1; i >= 0; i--) {

        // No user comments yet
        (my_rc->string_ptr+i)->user_comment = 0;

        element = new QListViewItem(strings_table,
                                    (my_rc->string_ptr+i)->name,
                                    (my_rc->string_ptr+i)->value);
        element->setRenameEnabled(0, FALSE);
        element->setRenameEnabled(1, TRUE);

    }

    // Set the app icon
    QPixmap my_icon((const char **) fish64_xpm);

    mw->setIcon((const QPixmap ) my_icon);

    mw->setCaption("The Fish " THE_FISH_VERSION);
    mw->setCentralWidget( vbox );
    thefish->setMainWidget(mw);
    mw->show();
    mw->resize(oldsize[0], oldsize[1]);

    dirty = 0;

    my_status_bar = mw->statusBar();
    my_status_bar->message("Ready");

    return thefish->exec();

}
コード例 #25
0
bool TPendingTasksQ::Add(CLambda& aLambda, const TTimeDelta& aDelay)
    {
    TAutoLock lock( iLock );
    TTask task(aLambda);
    return DoAdd(&task);
    }
コード例 #26
0
ファイル: bigint_en.c プロジェクト: xkuga/bigint
// implement of division by using binary search
// result = a / b
BigInt* DoDiv(BigInt* a, BigInt* b, BigInt* result, BigInt* remainder)
{
    int low, high, mid;
    BigInt c, d, e, t;

    low = 0;                       // the min of left shift
    high = GetMaxLeftShiftLen(b);  // the max of left shift

    memset(t.bit, 0, BIG_INT_BIT_LEN);  // init 0
    CopyBigInt(a, &c);                  // c = a

    // if a sign == b sign, do subtraction
    if (a->bit[SIGN_BIT] == b->bit[SIGN_BIT])
    {
        t.bit[SIGN_BIT] = POSITIVE;

        while (1)
        {
            while (low <= high)
            {
                mid = (low + high) / 2;
                ShiftArithmeticLeft(b, mid, &d);
                DoSub(&c, &d, &e);  // e = c - d

                // e >= 0
                if (d.bit[SIGN_BIT] == e.bit[SIGN_BIT] || IsZero(&e))
                    low = mid + 1;
                else
                    high = mid - 1;
            }

            // high == -1 means c - b < 0
            if (high != -1)
            {
                t.bit[high] = 1;

                // here unified the operation
                // it can improve i think
                ShiftArithmeticLeft(b, high, &d);

                // c = c - d, let c be the next dividend
                DoSub(&c, &d, &c);

                low = 0;
                high--;
            }
            else
            {
                // now the dividend c is the remainder
                CopyBigInt(&c, remainder);
                break;
            }
        }
    }

    // if a sign != b sign, do addition
    else
    {
        t.bit[SIGN_BIT] = NEGATIVE;

        while (1)
        {
            while (low <= high)
            {
                mid = (low + high) / 2;
                ShiftArithmeticLeft(b, mid, &d);
                DoAdd(&c, &d, &e);  // e = c + d

                // e >= 0
                if (d.bit[SIGN_BIT] != e.bit[SIGN_BIT] || IsZero(&e))
                    low = mid + 1;
                else
                    high = mid - 1;
            }

            // high == -1 means c - b < 0
            if (high != -1)
            {
                t.bit[high] = 1;

                // here unified the operation
                // it can improve i think
                ShiftArithmeticLeft(b, high, &d);

                // c = c + d, let c be the next dividend
                DoAdd(&c, &d, &c);

                low = 0;
                high--;
            }
            else
            {
                // now the dividend c is the remainder
                CopyBigInt(&c, remainder);
                break;
            }
        }
    }

    return ToComplement(&t, result);
}
コード例 #27
0
long ProjectPrefsGUI::HandleButtonClick(NativeControl Handle, NativeGUIWin NW, int ButtonID)
{

if (SwapInProgress || MoveInProgress)
	{
	SwapInProgress = MoveInProgress = 0;
#ifdef _WIN32
	if (Curse)
		SetClassLong(GetDlgItem(NativeWin, IDC_PARLIST), GCL_HCURSOR, (long)Curse);
#endif // _WIN32
	EndPointer();
	} // if
switch (ButtonID)
	{
	case ID_KEEP:
		{
		AppScope->MCP->SetParam(1, WCS_TOOLBARCLASS_MODULES, WCS_TOOLBAR_CLOSE_MOD,
			WCS_TOOLBAR_ITEM_PPG, 0);
		break;
		} // 
	case IDCANCEL:
		{
		DoCancel();
		//AppScope->MCP->SetParam(1, WCS_TOOLBARCLASS_MODULES, WCS_TOOLBAR_CLOSE_MOD,
		//	WCS_TOOLBAR_ITEM_PPG, 0);
		break;
		} // 
	case IDC_MATRIX_1:
		{
		SetViewport(0);
		break;
		} // 
	case IDC_MATRIX_2:
		{
		SetViewport(1);
		break;
		} // 
	case IDC_MATRIX_3:
		{
		SetViewport(2);
		break;
		} // 
	case IDC_MATRIX_4:
		{
		SetViewport(3);
		break;
		} // 
	case IDC_MATRIX_5:
		{
		SetViewport(4);
		break;
		} // 
	case IDC_MATRIX_6:
		{
		SetViewport(5);
		break;
		} // 
	case IDC_MATRIX_7:
		{
		SetViewport(6);
		break;
		} // 
	case IDC_MATRIX_8:
		{
		SetViewport(7);
		break;
		} // 
	case IDC_MATRIX_9:
		{
		SetViewport(8);
		break;
		} // 
	case IDC_MATRIX_10:
		{
		SetViewport(9);
		break;
		} // 
	case IDC_MATRIX_11:
		{
		SetViewport(10);
		break;
		} // 
	case IDC_MATRIX_12:
		{
		SetViewport(11);
		break;
		} // 
	case ID_DEFAULT:
		{
		DoDefaultDir();
		break;
		} // 
	case IDC_ADD:
		{
		DoAdd();
		break;
		} // 
	case IDC_MOVEDLUP:
		{
		HandleMove(0); // up
		break;
		} // up
	case IDC_MOVEDLDOWN:
		{
		HandleMove(1); // down
		break;
		} // down
/*
	case IDC_SWAP:
		{
		//DoSwap(0);
		break;
		} // 
	case IDC_MOVE:
		{
		//DoMove(0);
		break;
		} // 
*/
	case IDC_REMOVE:
		{
		DoRemove();
		break;
		} // 
	case IDC_READONLY:
		{
		DoReadOnly();
		break;
		} // 
	case IDC_LOAD:
		{
		DoLoad();
		break;
		} // 
	case IDC_SET:
		{
		DoAdvConfig(1);
		break;
		} // SET
	case IDC_UNSET:
		{
		DoAdvConfig(2);
		break;
		} // IDC_UNSET
	} // switch

return(0);

} // ProjectPrefsGUI::HandleButtonClick
コード例 #28
0
void ExternalDepsDlg::OnAddExternal(wxCommandEvent& event)
{
	DoAdd("lstExternalFiles", _("Add external dependency file"));
}
コード例 #29
0
ファイル: camera.cpp プロジェクト: knro/phd2
CameraConfigDialogPane::CameraConfigDialogPane(wxWindow *pParent, GuideCamera *pCamera)
    : ConfigDialogPane(_("Camera Settings"), pParent)
{
    assert(pCamera);

    m_pCamera = pCamera;

    if (m_pCamera->HasSubframes)
    {
        m_pUseSubframes = new wxCheckBox(pParent, wxID_ANY,_("Use Subframes"), wxPoint(-1,-1), wxSize(75,-1));
        DoAdd(m_pUseSubframes, _("Check to only download subframes (ROIs) if your camera supports it"));
    }

    int numRows = (int)m_pCamera->HasGainControl + (int)m_pCamera->HasDelayParam + (int)m_pCamera->HasPortNum + 1;

    wxFlexGridSizer *pCamControls = new wxFlexGridSizer(numRows, 2, 5, 15);

    int width = StringWidth(_T("0000")) + 30;
    // Pixel size always
    m_pPixelSize = NewSpinnerDouble(pParent, width, m_pCamera->GetCameraPixelSize(), 0.0, 99.9, 0.1,
        _("Guide camera pixel size in microns. Used with the guide telescope focal length to display guiding error in arc-seconds."));
    AddTableEntryPair(pParent, pCamControls, _("Pixel size"), m_pPixelSize);

    // Gain control
    if (m_pCamera->HasGainControl)
    {
        int width = StringWidth(_T("0000")) + 30;
        m_pCameraGain = NewSpinnerInt(pParent, width, 100, 0, 100, 1, _("Camera gain boost ? Default = 95 % , lower if you experience noise or wish to guide on a very bright star. Not available on all cameras."));
        AddTableEntryPair(pParent, pCamControls, _("Camera gain"), m_pCameraGain);
    }

    // Delay parameter
    if (m_pCamera->HasDelayParam)
    {
        int width = StringWidth(_T("0000")) + 30;
        m_pDelay = NewSpinnerInt(pParent, width, 5, 0, 250, 150, _("LE Read Delay (ms) , Adjust if you get dropped frames"));
        AddTableEntryPair(pParent, pCamControls, _("Delay"), m_pDelay);
    }

    // Port number
    if (m_pCamera->HasPortNum)
    {
        wxString port_choices[] = {
            _T("Port 378"), _T("Port 3BC"), _T("Port 278"), _T("COM1"), _T("COM2"), _T("COM3"), _T("COM4"),
            _T("COM5"), _T("COM6"), _T("COM7"), _T("COM8"), _T("COM9"), _T("COM10"), _T("COM11"), _T("COM12"),
            _T("COM13"), _T("COM14"), _T("COM15"), _T("COM16"),
        };

        int width = StringArrayWidth(port_choices, WXSIZEOF(port_choices));
        m_pPortNum = new wxChoice(pParent, wxID_ANY, wxPoint(-1, -1),
                                  wxSize(width + 35, -1), WXSIZEOF(port_choices), port_choices);
        m_pPortNum->SetToolTip(_("Port number for long-exposure control"));
        AddTableEntryPair(pParent, pCamControls, _("LE Port"), m_pPortNum);
    }

    // Watchdog timeout
    {
        int width = StringWidth(_T("0000")) + 30;
        m_timeoutVal = NewSpinnerInt(pParent, width, 5, 5, 9999, 1, wxString::Format(_("The camera will be disconnected if it fails to respond for this long. The default value, %d seconds, should be appropriate for most cameras."), DefaultGuideCameraTimeoutMs / 1000));
        AddTableEntryPair(pParent, pCamControls, _("Disconnect nonresponsive\ncamera after (seconds)"), m_timeoutVal);
    }

    Add(pCamControls);
}