Example #1
0
bool SliderInputCombo::GuiChanged( Fl_Widget* w )
{
	if ( w == m_Input )
	{
		double val = atof( m_Input->value() );

		//==== Figure Out Range ====//
		if ( val < m_Val - m_Range || val > m_Val + m_Range )
			m_Range = m_StartRange;
		else 
			m_Range = m_Range*0.5;

		SetVal( val );
		UpdateGui( m_Slider );
		if ( fabs( val - m_Val ) > DBL_EPSILON )
			UpdateGui( m_Input );
		return true;
	}
	else if ( w == m_Slider )
	{
		m_Val = m_Slider->value();
		UpdateGui( m_Input );
		return true;
	}
	return false;
}
Example #2
0
void SliderInputCombo::Init( double min, double max, double val, double range )
{
	SetLimits( min, max );
	SetVal( val );
	SetRange( range );
	UpdateGui();
}
BOOL CSyncDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();

	shiftTypeLocal = shiftType;
	timeShiftLocal = timeshift;

	UpdateGui();
	
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Example #4
0
/*
============
sdWeaponSelectionMenu::SetSwitchActive
============
*/
void sdWeaponSelectionMenu::SetSwitchActive( eActivationType set ) {
	if ( switchActive == set ) {
		return;
	}

	// jrad - if the menu is deactivated by the fire key, keep the attack from 
	// "leaking" through - otherwise, don't interrupt the player's firing
	if( switchActive != AT_DIRECT_SELECTION && set == AT_DISABLED ) {
		idPlayer* player = gameLocal.GetLocalPlayer();
		player->SetClientWeaponLock( true );
		player->oldButtons.btn.attack = true;
		player->oldButtons.btn.altAttack = true;
	}

	switchActive = set;
	UpdateGui();

}
void QmitkDwiSoftwarePhantomView::OnSelectionChanged( std::vector<mitk::DataNode*> nodes )
{
    m_SignalRegionNodes.clear();

    // iterate all selected objects, adjust warning visibility
    for( std::vector<mitk::DataNode*>::iterator it = nodes.begin(); it != nodes.end(); ++it )
    {
        mitk::DataNode::Pointer node = *it;

        if( node.IsNotNull() && dynamic_cast<mitk::Image*>(node->GetData()) )
        {
            bool isBinary = false;
            node->GetPropertyValue<bool>("binary", isBinary);
            if (isBinary)
                m_SignalRegionNodes.push_back(node);
        }
    }
    UpdateGui();
}
Example #6
0
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd)
{
    INITCOMMONCONTROLSEX icc = { 0 };
    struct CONVERT_CB_DATA conv = { 0 };
    LPWSTR lpBrowseResult = NULL;
    WCHAR szwExePath[MAX_PATH] = { 0 };
    WCHAR szwDest[MAX_PATH] = { 0 };
    DWORD nTotal = 0;
    DWORD nConverted = 0;
    HWND hwndProgressDlg = NULL;
    HICON hIcon = NULL;
    BOOL bEnd = FALSE;
    MSG msg = { 0 };

    icc.dwSize = sizeof(INITCOMMONCONTROLSEX);
    icc.dwICC  = ICC_LINK_CLASS;
    InitCommonControlsEx(&icc);

    // Select .h3m files to convert
    lpBrowseResult = UtilBrowseForMultipleFiles(MSG_BROWSE, L"H3C (*.h3c)\0*.h3c\0", &nTotal);
    if (NULL == lpBrowseResult)
    {
        return 1;
    }

    // Obtain own path, establish conversion destination subfolder \\converted
    GetModuleFileNameW(GetModuleHandle(NULL), szwExePath, MAX_PATH);
    PathRemoveFileSpecW(szwExePath);
    _snwprintf(szwDest, sizeof(szwDest) / sizeof(szwDest[0]) - 1, L"%s\\converted", szwExePath);
    CreateDirectoryW(szwDest, NULL);

    // Create conversion progress dialog
    hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON1));
    hwndProgressDlg = progress_dialog_init(TITLE_INITIAL, hIcon);
    DestroyIcon(hIcon);

    // Start conversion thread
    conv.dwMainThreadId = GetCurrentThreadId();
    conv.lpSrc = lpBrowseResult;
    conv.lpDest = szwDest;
    CloseHandle(CreateThread(NULL, 0, _ConvertThreadProc, (LPVOID)&conv, 0, NULL));

    while (GetMessage(&msg, NULL, 0, 0) > 0)
    {
        switch (msg.message)
        {
        case WM_SKIPPED_MAP:
            // First string in lpBrowseResult is source path
            CopySkippedMap(szwDest, lpBrowseResult, (LPCWSTR)msg.wParam);
            // Fall-through
        case WM_FAILED_MAP:
        case WM_CONVERTED_MAP:
            ++nConverted;
            UpdateGui(hwndProgressDlg, nConverted, nTotal, (LPCWSTR)msg.wParam);
            if (0 != msg.wParam)
            {
                free((LPWSTR *)msg.wParam);
            }
            break;
        case WM_CONVERTED_ALL:
            bEnd = TRUE;
            break;
        }

        if (TRUE == bEnd)
            break;

        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    // Close progress dialog and show conversion results
    DestroyWindow(hwndProgressDlg);
    _ShowDetails(&conv, szwDest);

    // Cleanup
    HeapFree(GetProcessHeap(), 0, lpBrowseResult);

    return 0;
}
	void FloatEditorImpl::SetSourceValue(const Core::String& name, Core::ValueMonitor<float>* value) {
		m_num = value;
		UpdateGui(*m_num);
		m_name->SetLabelText(Common::PunkStringToWxString(name));
		m_num->SubscribeOnValueChanged({ new Core::Action < FloatEditorImpl, const float& > { this, &FloatEditorImpl::UpdateGui }, Core::DestroyObject });
	}
	void StringEditorImpl::SetSourceValue(const Core::String& name, Core::ValueMonitor<Core::String>* value) {
		m_str = value;
		UpdateGui(*m_str);
		m_name->SetLabelText(Common::PunkStringToWxString(name));
		m_str->SubscribeOnValueChanged({ new Core::Action < StringEditorImpl, const Core::String& > { this, &StringEditorImpl::UpdateGui }, Core::DestroyObject });
	}
Example #9
0
void tcStoresGui::Draw() 
{
	tcStores* stores = GetStores();
	if (stores == 0) DestroyWindow();

    //if (drawCount++ % 4 != 0) return; // update draw every 4th frame

    StartDraw();

	UpdateGui();

	bool blinkOn = tcTime::Get()->Get30HzCount() % 30 < 15;
    
    // draw caption
    tcGameObject* parent = stores->GetParent();
	const Vec4 captionColor(1.0f, 1.0f, 1.0f, 1.0f);
	const char* unitName = parent->mzUnit.c_str();
	const std::string& storesDisplayName = stores->GetDisplayName();
	float guiWidth = float(mnWidth);

	wxString captionText = wxString::Format("%s\n%s", unitName, storesDisplayName.c_str());
	DrawTextR(captionText.c_str(), 10.0f, 2.0f, defaultFont.get(),
        captionColor, 16.0f, LEFT_TOP, guiWidth - 20.0f);

    // draw weight/volume/count capacity status
    wxString fillStatus = stores->GetFilledStatusString();
    DrawTextR(fillStatus.c_str(), 10.0f, float(mnHeight) - 10.0f, defaultFont.get(),
        captionColor, 10.0f, LEFT_CENTER, guiWidth - 10.0f);

    // calculate slots to draw based on page info
    size_t startIdx = currentPage * slotsPerPage;
    size_t stopIdx = startIdx + slotsPerPage;
    size_t nSlots = slots.size();
    if (stopIdx > nSlots) stopIdx = nSlots;
    if ((startIdx+1) > nSlots) startIdx = nSlots - 1; // won't draw anyway if nSlots==0


    // draw slots and items
	
	for (size_t n=startIdx; n<stopIdx; n++)
	{
		tcContainerSlot& slot = slots[n];
		tcStoresContainerItem* item = dynamic_cast<tcStoresContainerItem*>(slot.GetItem());
		
		bool isMouseOver = slot.IsMouseOver();

		if (item)
		{
            int drawState = item->GetDrawState();
            bool doDraw = (drawState == tcContainerItem::NORMAL) ||
                ((drawState == tcContainerItem::BLINK) && blinkOn);

            boost::shared_ptr<tcGeometry> icon = slot.GetIcon();
            DrawGeometryR(icon.get(), slot.loc.XCenter(), slot.loc.YCenter());

            Vec4 color;
            if (!isMouseOver) color.set(0.6f, 0.6f, 0.6f, 1.0f);
            else color.set(1.0f, 1.0f, 1.0f, 1.0f);

            if (doDraw)
            {
                // draw quantity label
                DrawTextR(item->GetQuantityLabel(), slot.loc.GetRight() + 5.0f, slot.loc.GetTop() - 0.0f, 
                    defaultFont.get(), color, 12.0f, LEFT_BASE_LINE);

                // draw item name
                float left = slot.loc.GetRight() + 36.0f;
                float maxWidth = guiWidth - left - 10.0f;

                DrawTextR(item->GetItemName().c_str(), left, slot.loc.GetTop() - 0.0f, defaultFont.get(),
                    color, 14.0f, LEFT_BASE_LINE, maxWidth);
            }

            // draw description caption if mouse is over slot
            //if (isMouseOver)
            //{
            //	const Vec4 color(1.0f, 1.0f, 1.0f, 1.0f);
            //	float left = slot.loc.GetLeft();
            //	float maxWidth = guiWidth - left - 10.0f;

            //	DrawTextR(item->GetItemName().c_str(), left, slot.loc.GetTop() + 15.0f, defaultFont.get(),
            //        color, 14.0f, LEFT_BASE_LINE, maxWidth);
            //}

            // draw expanded rectangle for slot border
            tcRect r = slot.loc;
            r.Expand(1.0, 1.0);
            if (isMouseOver)
            {
                DrawRectangleR(r, Vec4(1, 1, 1, 1), tc3DWindow2::FILL_OFF);
            }
            else
            {
                DrawRectangleR(r, Vec4(0.5, 0.5, 0.5, 1), tc3DWindow2::FILL_OFF);
            }

        }

	}

    // draw page boxes
    for (size_t n=0; n<pageBoxes.size(); n++)
    {   
        int fillMode = (n == currentPage) ? tc3DWindow2::FILL_ON : tc3DWindow2::FILL_OFF;
        Vec4 color(0.5, 0.5, 0.5, 0.5);
        if (n == mouseOverPage) color.set(1, 1, 1, 1);

        DrawRectangleR(pageBoxes[n], color, fillMode);
    }

	FinishDraw();
}
Example #10
0
void SliderInputCombo::UpdateGui()
{
	UpdateGui( m_Input );
	UpdateGui( m_Slider );
}