Exemple #1
0
void CPpcMainWnd::OnToolHoldDisp()
{
	UnregisterHotKeys();
	m_fHold = !m_fHold;
	EnableWindow(m_hWnd, !m_fHold);
	RegisterHotKeys();

	if (!m_fActive)
		SetForegroundWindow(m_hWnd);

	KillTimer(m_hWnd, ID_TIMER_HOLD);
	m_fDrawHold = TRUE;
	SetTimer(m_hWnd, ID_TIMER_HOLD, TIMER_HOLD_INTERVAL, NULL);
	UpdateTitle();

	if (m_fHold) {
		TurnOffDisplay();
		m_fDisplay = FALSE;
	}
	else {
		TurnOnDisplay();
		m_fDisplay = TRUE;
		InvalidateRect(m_hWnd, NULL, TRUE);
		UpdateWindow(m_hWnd);
	}
}
Exemple #2
0
int InitProfileModule()
{
    hTTBModuleLoadedHook = HookEvent(ME_TTB_MODULELOADED, CreateTopToolbarButtons);

    HookEvent( ME_CLIST_PREBUILDSTATUSMENU,  CreateMainMenuItems);

    CreateMainMenuItems(0,0);
    RegisterHotKeys();
    return 0;
}
Exemple #3
0
void CPpcMainWnd::OnToolOption()
{
	if (m_fHold)
		return;

	SetForegroundWindow(m_hWnd);
	UnregisterHotKeys();
	CMainWnd::OnToolOption();
	RegisterHotKeys();
}
Exemple #4
0
void CPpcMainWnd::OnToolKeyCtrl()
{
	RECT rc;
	GetWindowRect(m_hwndLV, &rc);

	UnregisterHotKeys();
	CPpcKeyCtrlDlg dlg;
	dlg.ShowKeyCtrlDlg(m_hWnd, &rc, ((CPpcSkin*)m_pSkin)->GetColor2(COLOR2_PLAYLISTBACK), ((CPpcSkin*)m_pSkin)->GetColor2(COLOR2_PLAYLISTTEXT));
	RegisterHotKeys();
}
Exemple #5
0
int LoadMainOptions()
{
    if (hTTBModuleLoadedHook) {
        RemoveTopToolbarButtons();
        CreateTopToolbarButtons(0,0);
    }

    UnregisterHotKeys();
    RegisterHotKeys();
    return 0;
}
Exemple #6
0
void CPpcMainWnd::OnToolHold()
{
	UnregisterHotKeys();
	m_fHold = !m_fHold;
	EnableWindow(m_hWnd, !m_fHold);
	RegisterHotKeys();

	if (!m_fActive)
		SetForegroundWindow(m_hWnd);

	KillTimer(m_hWnd, ID_TIMER_HOLD);
	m_fDrawHold = TRUE;
	SetTimer(m_hWnd, ID_TIMER_HOLD, TIMER_HOLD_INTERVAL, NULL);
	UpdateTitle();
}
Exemple #7
0
void CPpcMainWnd::OnActivate(int nActive, BOOL fMinimized, HWND hwndPrevious)
{
	m_fActive = nActive == WA_INACTIVE ? FALSE : TRUE;

	if (!m_pOptions)
		return;

	if (((CPpcOptions*)m_pOptions)->m_fReleaseKeyMap && !m_fHold) {
		if (nActive == WA_INACTIVE)
			UnregisterHotKeys();
		else
			RegisterHotKeys();
	}

	SHHandleWMActivate(m_hWnd, MAKELONG(nActive, fMinimized), (LONG)hwndPrevious, &m_sai, FALSE);
}
Exemple #8
0
void CPpcMainWnd::OnCreate(HWND hwnd)
{
	m_hWnd = hwnd;
	CreateMenuBar();
	CreateListView();

	CMainWnd::OnCreate(hwnd);

	RegisterHotKeys();
	SetTimer(m_hWnd, ID_TIMER_DISPCHECK, TIMER_DISPCHECK_INTERVAL, NULL);
	SetTimer(m_hWnd, ID_TIMER_DISPSTATE, TIMER_DISPSTATE_INTERVAL, NULL);

	memset(&m_sai, 0, sizeof(m_sai));
	m_sai.cbSize = sizeof(m_sai);

	SetFocus(m_hwndLV);
	ShowWindow(m_hwndLV, SW_HIDE);
}
Exemple #9
0
void CMainFrame::ApplyOptions(const COptionsInfo& PrevOpts)
{
	// if playback device or buffer size changed
	if (m_Options.m_PlayDeviceGuid != PrevOpts.m_PlayDeviceGuid
	|| m_Options.m_PlayBufferSize != PrevOpts.m_PlayBufferSize
	|| !m_Player.IsCreated()) {	// or player not created
		if (m_Player.Create(&m_Options.m_PlayDeviceGuid, m_hWnd)) {	// create player
			m_Player.SetBufferDuration(m_Options.m_PlayBufferSize);
			UpdatePlayerState();
		}
	}
	// if recording device or buffer size changed
	if (m_Options.m_RecordDeviceGuid != PrevOpts.m_RecordDeviceGuid
	|| m_Options.m_RecordBufferSize != PrevOpts.m_RecordBufferSize) {
		if (m_RecordDlg != NULL)	// if record dialog exists
			m_RecordDlg->OnDeviceChange();	// notify it of device change
	}
	if (m_Options.m_UndoLevels != PrevOpts.m_UndoLevels) {
		CAllDocIter	iter;
		CDocument	*pDoc;
		while ((pDoc = iter.GetNextDoc()) != NULL)
			((CWaveShopDoc *)pDoc)->m_UndoMgr.SetLevels(m_Options.m_UndoLevels);
	}
	LPARAM	Hint = CWaveShopView::HINT_NONE;
	if (m_Options.m_TimeInFrames != PrevOpts.m_TimeInFrames) {
		m_NavBar.OnTimeFormatChange();
		Hint |= CWaveShopView::HINT_TIME_UNIT;
	}
	if (m_Options.m_MaxDensity != PrevOpts.m_MaxDensity)
		Hint |= CWaveShopView::HINT_WAVE_UPDATE;
	if (m_Options.m_ShowChannelNames != PrevOpts.m_ShowChannelNames)
		Hint |= CWaveShopView::HINT_SHOW_CAPTIONS;
	theApp.UpdateAllViews(NULL, Hint, NULL);
	if (m_Options.m_CheckForUpdates && !PrevOpts.m_CheckForUpdates)
		PostMessage(WM_COMMAND, ID_APP_CHECK_FOR_UPDATES);
	if (memcmp(&m_Options.m_RTSA, &PrevOpts.m_RTSA, sizeof(RTSA_PARMS)))
		m_SpectrumBar.SetParms(m_Options.m_RTSA);
	theApp.m_TempFolderPath = m_Options.GetTempFolderPath();
	RegisterHotKeys();
}
Exemple #10
0
static
LRESULT
CALLBACK
SASWindowProc(
    IN HWND hwndDlg,
    IN UINT uMsg,
    IN WPARAM wParam,
    IN LPARAM lParam)
{
    PWLSESSION Session = (PWLSESSION)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);

    switch (uMsg)
    {
        case WM_HOTKEY:
        {
            switch (lParam)
            {
                case MAKELONG(MOD_CONTROL | MOD_ALT, VK_DELETE):
                {
                    TRACE("SAS: CONTROL+ALT+DELETE\n");
                    if (!Session->Gina.UseCtrlAltDelete)
                        break;
                    PostMessageW(Session->SASWindow, WLX_WM_SAS, WLX_SAS_TYPE_CTRL_ALT_DEL, 0);
                    return TRUE;
                }
                case MAKELONG(MOD_CONTROL | MOD_SHIFT, VK_ESCAPE):
                {
                    TRACE("SAS: CONTROL+SHIFT+ESCAPE\n");
                    if (Session->LogonState == STATE_LOGGED_ON)
                        DoGenericAction(Session, WLX_SAS_ACTION_TASKLIST);
                    return TRUE;
                }
            }
            break;
        }
        case WM_CREATE:
        {
            /* Get the session pointer from the create data */
            Session = (PWLSESSION)((LPCREATESTRUCT)lParam)->lpCreateParams;

            /* Save the Session pointer */
            SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)Session);
            if (GetSetupType())
                return TRUE;
            return RegisterHotKeys(Session, hwndDlg);
        }
        case WM_DESTROY:
        {
            if (!GetSetupType())
                UnregisterHotKeys(Session, hwndDlg);
            return TRUE;
        }
        case WM_SETTINGCHANGE:
        {
            UINT uiAction = (UINT)wParam;
            if (uiAction == SPI_SETSCREENSAVETIMEOUT
             || uiAction == SPI_SETSCREENSAVEACTIVE)
            {
                SetEvent(Session->hScreenSaverParametersChanged);
            }
            return TRUE;
        }
        case WM_LOGONNOTIFY:
        {
            switch(wParam)
            {
                case LN_MESSAGE_BEEP:
                {
                    return HandleMessageBeep(lParam);
                }
                case LN_SHELL_EXITED:
                {
                    /* lParam is the exit code */
                    if (lParam != 1 &&
                        Session->LogonState != STATE_LOGGED_OFF &&
                        Session->LogonState != STATE_LOGGED_OFF_SAS)
                    {
                        SetTimer(hwndDlg, 1, 1000, NULL);
                    }
                    break;
                }
                case LN_START_SCREENSAVE:
                {
                    DispatchSAS(Session, WLX_SAS_TYPE_SCRNSVR_TIMEOUT);
                    break;
                }
                case LN_LOCK_WORKSTATION:
                {
                    DoGenericAction(Session, WLX_SAS_ACTION_LOCK_WKSTA);
                    break;
                }
                case LN_LOGOFF:
                {
                    UINT Flags = (UINT)lParam;
                    UINT Action = Flags & EWX_ACTION_MASK;
                    DWORD wlxAction;

                    TRACE("\tFlags : 0x%lx\n", lParam);

                    /*
                     * Our caller (USERSRV) should have added the shutdown flag
                     * when setting also poweroff or reboot.
                     */
                    if (Action & (EWX_POWEROFF | EWX_REBOOT))
                    {
                        if ((Action & EWX_SHUTDOWN) == 0)
                        {
                            ERR("Missing EWX_SHUTDOWN flag for poweroff or reboot; action 0x%x\n", Action);
                            return STATUS_INVALID_PARAMETER;
                        }

                        /* Now we can locally remove it for performing checks */
                        Action &= ~EWX_SHUTDOWN;
                    }

                    /* Check parameters */
                    if (Action & EWX_FORCE)
                    {
                        // FIXME!
                        ERR("FIXME: EWX_FORCE present for Winlogon, what to do?\n");
                        Action &= ~EWX_FORCE;
                    }
                    switch (Action)
                    {
                        case EWX_LOGOFF:
                            wlxAction = WLX_SAS_ACTION_LOGOFF;
                            break;
                        case EWX_SHUTDOWN:
                            wlxAction = WLX_SAS_ACTION_SHUTDOWN;
                            break;
                        case EWX_REBOOT:
                            wlxAction = WLX_SAS_ACTION_SHUTDOWN_REBOOT;
                            break;
                        case EWX_POWEROFF:
                            wlxAction = WLX_SAS_ACTION_SHUTDOWN_POWER_OFF;
                            break;

                        default:
                        {
                            ERR("Invalid ExitWindows action 0x%x\n", Action);
                            return STATUS_INVALID_PARAMETER;
                        }
                    }

                    TRACE("In LN_LOGOFF, exit_in_progress == %s\n",
                        ExitReactOSInProgress ? "true" : "false");

                    /*
                     * In case a parallel shutdown request is done (while we are
                     * being to shut down) and it was not done by Winlogon itself,
                     * then just stop here.
                     */
#if 0
// This code is commented at the moment (even if it's correct) because
// our log-offs do not really work: the shell is restarted, no app is killed
// etc... and as a result you just get explorer opening "My Documents". And
// if you try now a shut down, it won't work because winlogon thinks it is
// still in the middle of a shutdown.
// Maybe we also need to reset ExitReactOSInProgress somewhere else??
                    if (ExitReactOSInProgress && (lParam & EWX_CALLER_WINLOGON) == 0)
                    {
                        break;
                    }
#endif
                    /* Now do the shutdown action proper */
                    DoGenericAction(Session, wlxAction);
                    return 1;
                }
                case LN_LOGOFF_CANCELED:
                {
                    ERR("Logoff canceled!!, before: exit_in_progress == %s, after will be false\n",
                        ExitReactOSInProgress ? "true" : "false");

                    ExitReactOSInProgress = FALSE;
                    return 1;
                }
                default:
                {
                    ERR("WM_LOGONNOTIFY case %d is unimplemented\n", wParam);
                }
            }
            return 0;
        }
        case WM_TIMER:
        {
            if (wParam == 1)
            {
                KillTimer(hwndDlg, 1);
                StartUserShell(Session);
            }
            break;
        }
        case WLX_WM_SAS:
        {
            DispatchSAS(Session, (DWORD)wParam);
            return TRUE;
        }
    }

    return DefWindowProc(hwndDlg, uMsg, wParam, lParam);
}