Ejemplo n.º 1
0
void BookmarkToolBar::setText(xpr_bool_t aText)
{
    if (mInit == XPR_TRUE)
    {
        CToolBarCtrl &sToolBarCtrl = GetToolBarCtrl();

        SetRedraw(XPR_FALSE);

        xpr_sint_t i;
        xpr_sint_t sCount;

        TBBUTTONINFO sTbButtonInfo = {0};
        sTbButtonInfo.cbSize = sizeof(TBBUTTONINFO);
        sTbButtonInfo.dwMask = TBIF_BYINDEX | TBIF_STYLE;

        sCount = sToolBarCtrl.GetButtonCount();
        if (aText == XPR_FALSE)
        {
            for (i = 0; i < sCount; ++i)
            {
                sToolBarCtrl.GetButtonInfo(i, &sTbButtonInfo);
                sTbButtonInfo.fsStyle &= ~BTNS_SHOWTEXT;
                sToolBarCtrl.SetButtonInfo(i, &sTbButtonInfo);

                SetButtonText(i, XPR_STRING_LITERAL(""));
            }
        }
        else
        {
            BookmarkItem *sBookmarkItem;

            for (i = 0; i < sCount; ++i)
            {
                sBookmarkItem = BookmarkMgr::instance().getBookmark(i);

                sToolBarCtrl.GetButtonInfo(i, &sTbButtonInfo);
                sTbButtonInfo.fsStyle |= BTNS_SHOWTEXT;
                sToolBarCtrl.SetButtonInfo(i, &sTbButtonInfo);

                if (sBookmarkItem != XPR_NULL)
                    SetButtonText(i, sBookmarkItem->mName.c_str());
            }
        }

        SetRedraw();

        UpdateToolbarSize();
    }

    gOpt->mMain.mBookmarkBarText = aText;
}
Ejemplo n.º 2
0
void HotkeyConfigDialog::OnKeyDown(wxKeyEvent& event)
{
	if (ClickedButton != nullptr)
	{
		// Save the key
		g_Pressed = event.GetKeyCode();
		g_Modkey = event.GetModifiers();

		// Don't allow modifier keys
		if (g_Pressed == WXK_CONTROL || g_Pressed == WXK_ALT ||
			g_Pressed == WXK_SHIFT || g_Pressed == WXK_COMMAND)
			return;

		// Use the space key to set a blank key
		if (g_Pressed == WXK_SPACE)
		{
			SaveButtonMapping(ClickedButton->GetId(), -1, 0);
			SetButtonText(ClickedButton->GetId(), wxString());
		}
		else
		{
			// Check if the hotkey combination was already applied to another button
			// and unapply it if necessary.
			for (wxButton* btn : m_Button_Hotkeys)
			{
				// We compare against this to see if we have a duplicate bind attempt.
				wxString existingHotkey = btn->GetLabel();

				wxString tentativeModKey = WxUtils::WXKeymodToString(g_Modkey);
				wxString tentativePressedKey = WxUtils::WXKeyToString(g_Pressed);
				wxString tentativeHotkey(tentativeModKey + tentativePressedKey);

				// Found a button that already has this binding. Unbind it.
				if (tentativeHotkey == existingHotkey)
				{
					SaveButtonMapping(btn->GetId(), -1, 0);
					SetButtonText(btn->GetId(), wxString());
				}
			}

			// Proceed to apply the binding to the selected button.
			SetButtonText(ClickedButton->GetId(),
					WxUtils::WXKeyToString(g_Pressed),
					WxUtils::WXKeymodToString(g_Modkey));
			SaveButtonMapping(ClickedButton->GetId(), g_Pressed, g_Modkey);
		}
		EndGetButtons();
	}
}
Ejemplo n.º 3
0
void CThemeMakerDlg::OnBnClickedBtnOpen()
{
    CFileDialog dlg(TRUE, _T("ini"), NULL, OFN_FILEMUSTEXIST, szThemeFilter);
    if(dlg.DoModal() == IDOK)
    {
        CString strThemeFileName = dlg.GetPathName();
        CWzTabTestTheme *pTabTheme = new CWzTabTestTheme();
        if(pTabTheme == NULL)
        {
            AfxMessageBox(_T("内存错误,无法创建Color Theme对象!"));
            return;
        }
        pTabTheme->SetImageList(CImageList::FromHandle(m_TabImages));

        if(!pTabTheme->InitConfig(strThemeFileName))
        {
            AfxMessageBox(_T("配置Color Theme对象错误,不是合法的Color Theme文件!"));
            delete pTabTheme;
            return;
        }
        CWzTabTestTheme *pOldTheme = (CWzTabTestTheme *)m_TabCtrl.SetTabTheme(pTabTheme, TRUE);
        if(pOldTheme != NULL)
        {
            pOldTheme->ReleaseConfig();
            delete pOldTheme;
        }
        m_pTabTheme = pTabTheme;
        SetButtonText();
	    CRect rcClient;
	    GetClientRect(&rcClient);
		CSize st = m_TabCtrl.ReCalcAllTabsPosAndWndSize(rcClient.Width() - 12);
        m_TabCtrl.MoveWindow(rcClient.left + 2,rcClient.top + 32,st.cx,st.cy);
    }
}
Ejemplo n.º 4
0
void HotkeyConfigDialog::DoGetButtons(int _GetId)
{
	// Values used in this function
	const int Seconds = 4; // Seconds to wait for
	const int TimesPerSecond = 40; // How often to run the check

	// If the Id has changed or the timer is not running we should start one
	if ( GetButtonWaitingID != _GetId || !m_ButtonMappingTimer->IsRunning() )
	{
		if (m_ButtonMappingTimer->IsRunning())
			m_ButtonMappingTimer->Stop();

		// Save the button Id
		GetButtonWaitingID = _GetId;
		GetButtonWaitingTimer = 0;

		// Start the timer
		#if wxUSE_TIMER
		m_ButtonMappingTimer->Start(1000 / TimesPerSecond);
		#endif
	}

	// Process results
	// Count each time
	GetButtonWaitingTimer++;

	// This is run every second
	if (GetButtonWaitingTimer % TimesPerSecond == 0)
	{
		// Current time
		int TmpTime = Seconds - (GetButtonWaitingTimer / TimesPerSecond);
		// Update text
		SetButtonText(_GetId, wxString::Format("[ %d ]", TmpTime));
	}

	// Time's up
	if (GetButtonWaitingTimer / TimesPerSecond >= Seconds)
	{
		// Revert back to old label
		SetButtonText(_GetId, OldLabel);
		EndGetButtons();
	}
}
Ejemplo n.º 5
0
OP_STATUS OpButtonStrip::SetButtonInfo(int id, OpInputAction* action, const OpStringC& text, BOOL enabled, BOOL visible, const OpStringC8& name)
{
	OP_ASSERT(0 <= id && (unsigned)id < m_buttons.GetCount());

	SetButtonAction(id, action);
	RETURN_IF_ERROR(SetButtonText(id, text));
	EnableButton(id, enabled);
	ShowButton(id, visible);
	SetButtonName(id, name);

	return OpStatus::OK;
}
Ejemplo n.º 6
0
void CGuiToolBarWnd::SetTextButton(int IdButton,CString sztexto)
{
//	CToolBarCtrl &tbc=GetToolBarCtrl();
//	tbc.SetStyle(tbc.GetStyle()| TBSTYLE_LIST | CCS_ADJUSTABLE);
	
	sztexto+=sztexto.Find( '&' ) == -1 ?"   ":"    ";
	CClientDC dc(this);
	SetButtonText(IdButton,sztexto);
	SetButtonStyle(IdButton,TBSTYLE_AUTOSIZE);
	SetSizes(m_sizeButton, m_sizeImage);
            
}
Ejemplo n.º 7
0
BOOL CThemeMakerDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

    InitWzTabCtrl();
    SetButtonText();

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
Ejemplo n.º 8
0
/*!
 @brief 処理の実行開始
*/
void CFileTailDlg::ExecuteOperation()
{
	m_bExecuteMode = !m_bExecuteMode;

	if (m_bExecuteMode == FALSE) {
		SetButtonText(CString((LPCTSTR) IDC_FILE_TAIL_RUN));
	} else {
		SetButtonText(CString((LPCTSTR) IDC_FILE_TAIL_STOP));
	}

	if (m_pFile != NULL) {
		m_pFile->Close();
		delete m_pFile;
		m_pFile = NULL;
	}

	if (m_bExecuteMode == FALSE) {
		KillTimer(1);

		return;
	}
	m_strFileData = _T("");
	m_nReadIndex = 0;

	UpdateData(TRUE);
	// 設定に反映
	CIUSettingData::GetInstance().m_strTailPath = m_strTailFilePath;

	m_pFile = new CFile();
	if (m_pFile->Open(m_strTailFilePath, CFile::modeRead | CFile::typeBinary |CFile::shareDenyNone) == false) {
		return;
	}

	SetTimer(1, 2000, NULL);

	UpdateData(FALSE);
}
Ejemplo n.º 9
0
void BookmarkToolBar::addBookmarkButton(xpr_sint_t aIndex, BookmarkItem *aBookmarkItem)
{
    CToolBarCtrl &sToolBarCtrl = GetToolBarCtrl();

    xpr_sint_t nImage = -1;

    HICON hIcon = XPR_NULL;
    BookmarkMgr::Result sResult = BookmarkMgr::instance().getIcon(aIndex, hIcon);
    if (hIcon)
        nImage = mImgList.Add(hIcon);

    xpr_bool_t sSeparator = aBookmarkItem->isSeparator();

    TBBUTTON sTbButton = {0};
    if (sSeparator == XPR_TRUE)
    {
        sTbButton.iBitmap = -1;
        sTbButton.fsState = TBSTATE_ENABLED;
        sTbButton.fsStyle = BTNS_SEP;
        sTbButton.dwData  = (DWORD)aIndex;
    }
    else
    {
        sTbButton.iBitmap   = nImage;
        sTbButton.fsState   = TBSTATE_ENABLED;
        sTbButton.fsStyle   = BTNS_BUTTON | BTNS_SHOWTEXT | TBSTYLE_AUTOSIZE;
        sTbButton.idCommand = ID_BOOKMARK_FIRST + aIndex;
        sTbButton.iString   = 0;
        sTbButton.dwData    = (DWORD)aIndex;
    }

    sToolBarCtrl.InsertButton(aIndex, &sTbButton);

    if (sSeparator == XPR_FALSE)
        SetButtonText(CommandToIndex(sTbButton.idCommand), XPR_IS_TRUE(gOpt->mMain.mBookmarkBarText) ? aBookmarkItem->mName.c_str() : XPR_STRING_LITERAL(""));

    if (sSeparator == XPR_FALSE && gOpt->mMain.mBookmarkBarText == XPR_FALSE)
    {
        TBBUTTONINFO sTbButtonInfo = {0};
        sTbButtonInfo.cbSize = sizeof(TBBUTTONINFO);
        sTbButtonInfo.dwMask = TBIF_BYINDEX | TBIF_STYLE;
        sToolBarCtrl.GetButtonInfo(aIndex, &sTbButtonInfo);

        sTbButtonInfo.fsStyle &= ~BTNS_SHOWTEXT;
        sToolBarCtrl.SetButtonInfo(aIndex, &sTbButtonInfo);
    }
}
Ejemplo n.º 10
0
void HotkeyConfigDialog::CreateHotkeyGUIControls()
{
	const wxString pageNames[] =
	{
		_("General"),
		_("State Saves")
	};

	const wxString hkText[] =
	{
		_("Open"),
		_("Change Disc"),
		_("Refresh List"),

		_("Play/Pause"),
		_("Stop"),
		_("Reset"),
		_("Frame Advance"),

		_("Start Recording"),
		_("Play Recording"),
		_("Export Recording"),
		_("Read-only mode"),

		_("Toggle Fullscreen"),
		_("Take Screenshot"),
		_("Exit"),

		_("Connect Wiimote 1"),
		_("Connect Wiimote 2"),
		_("Connect Wiimote 3"),
		_("Connect Wiimote 4"),
		_("Connect Balance Board"),

		_("Toggle IR"),
		_("Toggle Aspect Ratio"),
		_("Toggle EFB Copies"),
		_("Toggle Fog"),
		_("Toggle Frame limit"),
		_("Increase Frame limit"),
		_("Decrease Frame limit"),

		_("Load State Slot 1"),
		_("Load State Slot 2"),
		_("Load State Slot 3"),
		_("Load State Slot 4"),
		_("Load State Slot 5"),
		_("Load State Slot 6"),
		_("Load State Slot 7"),
		_("Load State Slot 8"),
		_("Load State Slot 9"),
		_("Load State Slot 10"),

		_("Save State Slot 1"),
		_("Save State Slot 2"),
		_("Save State Slot 3"),
		_("Save State Slot 4"),
		_("Save State Slot 5"),
		_("Save State Slot 6"),
		_("Save State Slot 7"),
		_("Save State Slot 8"),
		_("Save State Slot 9"),
		_("Save State Slot 10"),

		_("Select State Slot 1"),
		_("Select State Slot 2"),
		_("Select State Slot 3"),
		_("Select State Slot 4"),
		_("Select State Slot 5"),
		_("Select State Slot 6"),
		_("Select State Slot 7"),
		_("Select State Slot 8"),
		_("Select State Slot 9"),
		_("Select State Slot 10"),

		_("Save to selected slot"),
		_("Load from selected slot"),

		_("Load State Last 1"),
		_("Load State Last 2"),
		_("Load State Last 3"),
		_("Load State Last 4"),
		_("Load State Last 5"),
		_("Load State Last 6"),
		_("Load State Last 7"),
		_("Load State Last 8"),

		_("Save Oldest State"),
		_("Undo Load State"),
		_("Undo Save State"),
		_("Save State"),
		_("Load State"),
	};

	const int page_breaks[3] = {HK_OPEN, HK_LOAD_STATE_SLOT_1, NUM_HOTKEYS};

	// Configuration controls sizes
	wxSize size(100,20);
	// A small type font
	wxFont m_SmallFont(7, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);

	wxNotebook *Notebook = new wxNotebook(this, wxID_ANY);

	for (int j = 0; j < 2; j++)
	{
		wxPanel *Page = new wxPanel(Notebook, wxID_ANY);
		Notebook->AddPage(Page, pageNames[j]);

		wxGridBagSizer *sHotkeys = new wxGridBagSizer();

		// Header line
		for (int i = 0; i < HOTKEY_NUM_COLUMNS; i++)
		{
			wxBoxSizer *HeaderSizer = new wxBoxSizer(wxHORIZONTAL);
			wxStaticText *StaticTextHeader = new wxStaticText(Page, wxID_ANY, _("Action"));
			HeaderSizer->Add(StaticTextHeader, 1, wxALL, 2);
			StaticTextHeader = new wxStaticText(Page, wxID_ANY, _("Key"), wxDefaultPosition, size);
			HeaderSizer->Add(StaticTextHeader, 0, wxALL, 2);
			sHotkeys->Add(HeaderSizer, wxGBPosition(0, i), wxDefaultSpan, wxEXPAND | wxLEFT, (i > 0) ? 30 : 1);
		}

		int column_break = (page_breaks[j+1] + page_breaks[j] + 1) / 2;

		for (int i = page_breaks[j]; i < page_breaks[j+1]; i++)
		{
			// Text for the action
			wxStaticText *stHotkeys = new wxStaticText(Page, wxID_ANY, hkText[i]);

			// Key selection button
			m_Button_Hotkeys[i] = new wxButton(Page, i, wxEmptyString, wxDefaultPosition, size);
			m_Button_Hotkeys[i]->SetFont(m_SmallFont);
			m_Button_Hotkeys[i]->SetToolTip(_("Left click to detect hotkeys.\nEnter space to clear."));
			SetButtonText(i,
					WxUtils::WXKeyToString(SConfig::GetInstance().m_LocalCoreStartupParameter.iHotkey[i]),
					WxUtils::WXKeymodToString(
						SConfig::GetInstance().m_LocalCoreStartupParameter.iHotkeyModifier[i]));

			wxBoxSizer *sHotkey = new wxBoxSizer(wxHORIZONTAL);
			sHotkey->Add(stHotkeys, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2);
			sHotkey->Add(m_Button_Hotkeys[i], 0, wxALL, 2);
			sHotkeys->Add(sHotkey,
					wxGBPosition((i < column_break) ? i - page_breaks[j] + 1 : i - column_break + 1,
						(i < column_break) ? 0 : 1),
					wxDefaultSpan, wxEXPAND | wxLEFT, (i < column_break) ? 1 : 30);
		}

		wxStaticBoxSizer *sHotkeyBox = new wxStaticBoxSizer(wxVERTICAL, Page, _("Hotkeys"));
		sHotkeyBox->Add(sHotkeys);

		wxBoxSizer* const sPage = new wxBoxSizer(wxVERTICAL);
		sPage->Add(sHotkeyBox, 0, wxEXPAND | wxALL, 5);
		Page->SetSizer(sPage);
	}

	wxBoxSizer *sMainSizer = new wxBoxSizer(wxVERTICAL);
	sMainSizer->Add(Notebook, 0, wxEXPAND | wxALL, 5);
	sMainSizer->Add(CreateButtonSizer(wxOK), 0, wxEXPAND | wxLEFT | wxRIGHT | wxDOWN, 5);
	SetSizerAndFit(sMainSizer);
	SetFocus();
}