void
GMFilterNameTable::HandleDNDDrop
	(
	const JPoint&		pt,
	const JArray<Atom>& typeList,
	const Atom			action,
	const Time			time,
	const JXWidget*	source
	)
{
	JIndex dropIndex	= itsCurrentDNDIndex;
	if (dropIndex == 0)
		{
		dropIndex		= GetRowCount() + 1;
		}
	JPoint cell;
	if (GetTableSelection().GetFirstSelectedCell(&cell))
		{
		if (cell.y == (JCoordinate)itsCurrentDNDIndex ||
			cell.y == (JCoordinate)itsCurrentDNDIndex + 1)
			{
			return;
			}
		GMFilter* filter	= itsFilters->NthElement(cell.y);
		itsFilters->Remove(filter);
		JIndex newIndex		= dropIndex;
		if (cell.y < (JCoordinate)newIndex)
			{
			newIndex--;
			}
		itsFilters->InsertAtIndex(newIndex, filter);
		SelectFilter(newIndex);
		}
	HandleDNDLeave();
}
Пример #2
0
void INDI::FilterWheel::processButton(const char * button_n, ISState state)
{
    //ignore OFF
    if (state == ISS_OFF)
        return;

    // Reset
    if (!strcmp(button_n, "Reset"))
    {
        TargetFilter = FilterSlotN[0].min;
        SelectFilter(TargetFilter);
    }

}
Пример #3
0
void INDI::FilterWheel::processJoystick(const char * joystick_n, double mag, double angle)
{
    if (!strcmp(joystick_n, "Change Filter"))
    {
        // Put high threshold
        if (mag > 0.9)
        {
            // North
            if (angle > 0 && angle < 180)
            {
                // Previous switch
                if (FilterSlotN[0].value == FilterSlotN[0].min)
                    TargetFilter = FilterSlotN[0].max;
                else
                    TargetFilter = FilterSlotN[0].value-1;

                SelectFilter(TargetFilter);

            }
            // South
            if (angle > 180 && angle < 360)
            {
                // Next Switch
                if (FilterSlotN[0].value == FilterSlotN[0].max)
                    TargetFilter = FilterSlotN[0].min;
                else
                    TargetFilter = FilterSlotN[0].value+1;

                SelectFilter(TargetFilter);

            }

        }
    }

}
void
GMFilterNameTable::HandleMouseDown
	(
	const JPoint&			pt,
	const JXMouseButton	button,
	const JSize			clickCount,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	itsIsWaitingForDrag	= kJFalse;
	itsStartPt			= pt;
	itsDNDIsValid		= kJFalse;

	if (button > kJXRightButton)
		{
		ScrollForWheel(button, modifiers);
		return;
		}

	JPoint cell;
	if (!GetCell(pt, &cell))
		{
		return;
		}

	itsCurrentCell		= cell;

	JTableSelection& s	= GetTableSelection();

	JPoint oldCell;
	JBoolean hasSingleSel	= s.GetFirstSelectedCell(&oldCell);

	if (itsConditionTable->OKToSwitch() &&
		itsActionTable->OKToSwitch() &&
		(!IsEditing() || EndEditing()))
		{
		if ((hasSingleSel && cell.y != oldCell.y) ||
			(!hasSingleSel))
			{
			SelectFilter(cell.y);
			}
		itsIsWaitingForDrag	= kJTrue;
		}
}
Пример #5
0
bool QSICCD::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
{
    INumber *np;

    if(strcmp(dev,getDeviceName())==0)
    {
        if (!strcmp(FilterSlotNP.name, name))
        {

            targetFilter = values[0];

            np = IUFindNumber(&FilterSlotNP, names[0]);

            if (!np)
            {
                FilterSlotNP.s = IPS_ALERT;
                IDSetNumber(&FilterSlotNP, "Unknown error. %s is not a member of %s property.", names[0], name);
                return false;
            }

            int filter_count;
            try
            {
                QSICam.get_FilterCount(filter_count);
            } catch (std::runtime_error err)
            {
                DEBUGF(INDI::Logger::DBG_ERROR, "get_FilterCount() failed. %s.", err.what());
                IDSetNumber(&FilterSlotNP, NULL);
            }
            if (targetFilter < FIRST_FILTER || targetFilter > filter_count)
            {
                FilterSlotNP.s = IPS_ALERT;
                DEBUGF(INDI::Logger::DBG_ERROR, "Error: valid range of filter is from %d to %d", FIRST_FILTER, LAST_FILTER);
                IDSetNumber(&FilterSlotNP, NULL);
                return false;
            }

            IUUpdateNumber(&FilterSlotNP, values, names, n);

            FilterSlotNP.s = IPS_BUSY;
            DEBUGF(INDI::Logger::DBG_DEBUG, "Setting current filter to slot %d", targetFilter);
            IDSetNumber(&FilterSlotNP, NULL);


            SelectFilter(targetFilter);

            /* Check current filter position */
            short newFilter = QueryFilter();

            if (newFilter == targetFilter)
            {
                FilterSlotN[0].value = targetFilter;
                FilterSlotNP.s = IPS_OK;
                DEBUGF(INDI::Logger::DBG_DEBUG, "Filter set to slot #%d", targetFilter);
                IDSetNumber(&FilterSlotNP, NULL);
                return true;
            }
            else
                return false;
        }

    }

    //  if we didn't process it, continue up the chain, let somebody else
    //  give it a shot
    return INDI::CCD::ISNewNumber(dev,name,values,names,n);
}
Пример #6
0
void QSICCD::turnWheel()
{
        short current_filter;

        switch (FilterS[0].s)
        {
          case ISS_ON:
            if (current_filter < LAST_FILTER)
                current_filter++;
            else current_filter = FIRST_FILTER;
            try
            {
                current_filter = QueryFilter();
                if(current_filter < LAST_FILTER)
                    current_filter++;
                else current_filter = FIRST_FILTER;

                SelectFilter(current_filter);
            } catch (std::runtime_error err)
            {
                FilterSP.s = IPS_IDLE;
                FilterS[0].s = ISS_OFF;
                FilterS[1].s = ISS_OFF;
                DEBUGF(INDI::Logger::DBG_ERROR, "QSICamera::get_FilterPos() failed. %s.", err.what());
                return;
            }

            FilterSlotN[0].value = current_filter;
            FilterS[0].s = ISS_OFF;
            FilterS[1].s = ISS_OFF;
            FilterSP.s = IPS_OK;
            DEBUGF(INDI::Logger::DBG_DEBUG, "The current filter is %d", current_filter);
            IDSetSwitch(&FilterSP, NULL);
            break;

          case ISS_OFF:
           try
           {
                current_filter = QueryFilter();
                if(current_filter > FIRST_FILTER)
                    current_filter--;
                else
                    current_filter = LAST_FILTER;
              SelectFilter(current_filter);
            } catch (std::runtime_error err)
            {
                FilterSP.s = IPS_IDLE;
                FilterS[0].s = ISS_OFF;
                FilterS[1].s = ISS_OFF;
                DEBUGF(INDI::Logger::DBG_ERROR, "QSICamera::get_FilterPos() failed. %s.", err.what());
                return;
            }

            FilterSlotN[0].value = current_filter;
            FilterS[0].s = ISS_OFF;
            FilterS[1].s = ISS_OFF;
            FilterSP.s = IPS_OK;
            DEBUGF(INDI::Logger::DBG_DEBUG, "The current filter is %d\n", current_filter);
            IDSetSwitch(&FilterSP, NULL);
            IDSetNumber(&FilterSlotNP, NULL);
            break;
        }
}
void AProjectGrimnirGameMode::EnterSelection()
{
	UWorld *const World = GetWorld();
	if (World)
	{
		switch (mCurrentStage)
		{
			// select data set
			case EStages::DataSetSelection:
			{
				if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::Printf(TEXT("Select Dynamic Set")));

				CreateNewDataSet();

				// move to the next stage
				mCurrentStage = EStages::FieldSelection;
			}
			break;

			// select fields
			case EStages::FieldSelection:
			{
				if (mData->IsDynamicSetEmpty())
				{
					if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::Printf(TEXT("Dynamic Data Set is empty, please add one")));
				}
				else
				{
					if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::Printf(TEXT("Select Graph Type")));

					if (!UUtilities::IsValid(mGraphSelection) && !UUtilities::IsValid(mGraph))
					{
						FActorSpawnParameters spawnParams;

						spawnParams.Name = "spawnGraphSelection";
						mGraphSelection = World->SpawnActor<AGraphSelection>(mSelectionNodeBP, FVector(160, -40, 160), FRotator::ZeroRotator, spawnParams);

						// move to the next stage
						mCurrentStage = EStages::GraphSelection;
					}
				}
			}
			break;

			// select graph type
			case EStages::GraphSelection:
			{
				if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::Printf(TEXT("Select Method of Viewing Data")));

				SelectGraphType();

				if (UUtilities::IsValid(mGraphSelection))
				{
					// move to the next stage
					mCurrentStage = EStages::FilterSelection;
				}
			}
			break;

			// select filter type
			case EStages::FilterSelection:
			{
				if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::Printf(TEXT("Render Data")));

				if (UUtilities::IsValid(mGraphSelection))
				{
					mGraphSelection->mDestroySelector = true;
					mGraphSelection = nullptr;

					SelectFilter();

					// move to the next stage
					mCurrentStage = EStages::DataVisualisation;
				}
			}
			break;

			// render data set
			case EStages::DataVisualisation:
			{
				if (!UUtilities::IsValid(mGraphSelection) && !UUtilities::IsValid(mGraph))
				{
					RenderDataSet();
				}
				else
				{
					if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::Printf(TEXT("Data already Rendered")));

					DestroyRenderedDataSet();
					//SelectFilter();
					//Sleep(1000);
					RenderDataSet();
				}
			}
			break;
		}
	}
}