Beispiel #1
0
///////////////////////////////////////////////////////////////////////////////
// Handles user commands from the menu
int OnCommand(HWND hWnd, WORD wID, HWND hCtl)
{
	UNREFERENCED_PARAMETER(hCtl);

	//  Have a look at the command and act accordingly
	if(wID == ID_EXIT)
	{
		PostMessage(hWnd, WM_CLOSE, 0, 0);
	}
	else if(wID == ID_ABOUT)
	{
		MessageBox(NULL, HELP_MESSAGE, HELP_TITLE, MB_OK | MB_ICONINFORMATION);
	}
	else
	{
		for(UINT i = 0; i < g_keyboardInfo.count; i++)
		{
			if(g_keyboardInfo.menuIds[i] == wID)
			{
				g_keyboardInfo.inUse[i] = !(g_keyboardInfo.inUse[i]);
				break;
			}
		}
		SaveConfiguration(&g_keyboardInfo);
	}

	return 0;
}
Beispiel #2
0
void ApplicationContext::DestroyContext() {
	ReleaseResources();
	Trace("Destroying application context: " + _desc._name);
	SaveConfiguration();
	// services
	_pImpl.DestroyServices();
}
Beispiel #3
0
//===========================================================================
/*virtual*/ int igApp::OnExit( void )
{
	if( plugin || pluginHandle != NULL )
		UnloadPlugin( true );

	DeleteImage();

	SaveConfiguration();

	return wxApp::OnExit();
}
Beispiel #4
0
///////////////////////////////////////////////////////////////////////////////
// Program's entry point
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
	UNREFERENCED_PARAMETER(hInstance);
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);
	UNREFERENCED_PARAMETER(nCmdShow);

	// Prevent from two copies of Recaps from running at the same time
	HANDLE mutex = CreateMutex(NULL, FALSE, MUTEX);
	DWORD result = WaitForSingleObject(mutex, 0);
	if(result == WAIT_TIMEOUT)
	{
		CloseHandle(mutex);
		MessageBox(NULL, L"Recaps is already running.", L"Recaps", MB_OK | MB_ICONINFORMATION);
		return 1;
	}

	// Initialize
	GetKeyboardLayouts(&g_keyboardInfo);
	LoadConfiguration(&g_keyboardInfo);
	BOOL bShowTrayIcon = !DoesCmdLineSwitchExists(L"-no_icon");

	if(bShowTrayIcon)
	{
		// Create a fake window to listen to events
		WNDCLASSEX wclx = { 0 };
		wclx.cbSize = sizeof(wclx);
		wclx.lpfnWndProc = &WindowProc;
		wclx.hInstance = hInstance;
		wclx.lpszClassName = WINDOWCLASS_NAME;
		RegisterClassEx(&wclx);
		CreateWindow(WINDOWCLASS_NAME, NULL, 0, 0, 0, 0, 0, NULL, 0, hInstance, 0);
	}

	// Set hook to capture CapsLock
	g_hHook = SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelHookProc, GetModuleHandle(NULL), 0);

	// Handle messages
	MSG msg;
	while(GetMessage(&msg, NULL, 0, 0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	// Clean up
	UnhookWindowsHookEx(g_hHook);
	if(bShowTrayIcon)
		UnregisterClass(WINDOWCLASS_NAME, hInstance);
	SaveConfiguration(&g_keyboardInfo);
	CloseHandle(mutex);

	return 0;
}
int AddNetworkSinkDialog::exec()
{
	int tResult = -1;

	tResult = QDialog::exec();

	if(tResult == QDialog::Accepted)
	{
		LOG(LOG_VERBOSE, "User has added a new network sink");
		SaveConfiguration();
	    CreateNewMediaSink();
	}

	return tResult;
}
Beispiel #6
0
BOOL RegConfig::ConfigureVisual()
{
	//TODO: Открыть диалог с настройками
	RegConfigDlg Config(psi, REConfigTitle, _T("Configuration"), &guid_Configuration2);
	
	FarDialogItem *p1, *p2;
	
	Config.AddCheckbox(REStorePanelMode, &bRestorePanelMode);

	// Speed up browsing of large keys (HKCR\\CLSID, and so on)
	Config.AddSeparator(RESpeedUpLargeKeysSeparator);
	Config.AddCheckbox(REUnsortLargeKeys, &bUnsortLargeKeys);
	Config.SlideItemUp(Config.AddIntEditField((int*)&nLargeKeyCount, 7));
	Config.AddCheckbox(RELoadDescriptions, &bLoadDescriptions);
	Config.SlideItemUp(Config.AddIntEditField((int*)&nLargeKeyTimeout, 7));

	// 
	Config.AddSeparator(REAutoRefreshSeparator);
	Config.AddCheckbox(REAutoRefreshChanges, &bRefreshChanges);
	Config.StartColumns();
	p1 = Config.AddText(RERefreshKeyTimeoutLabel); p2 = Config.AddIntEditField((int*)&nRefreshKeyTimeout, 6);
	Config.MoveItemAfter(p1,p2);
	Config.ColumnBreak();
	p1 = Config.AddText(RERefreshSubkeyTimeoutLabel); p2 = Config.AddIntEditField((int*)&nRefreshSubkeyTimeout, 6);
	Config.MoveItemAfter(p1,p2);
	Config.EndColumns();


	int nOkBtn = Config.AddFooterButtons(REBtnOK, REBtnCancel, 0);

	if (Config.ShowDialog())
	{
		mb_SettingsChanged = TRUE;
		// сохраним в реестр
		SaveConfiguration();
		// Обновить Wow64on32 и заголовки
		gpPluginList->OnSettingsChanged(bWow64on32_);
	}
	
	// Вернуть TRUE, если фар нужно передернуть
	return mb_SettingsChanged;
}
Beispiel #7
0
void PathUtilDlg::OnCloseWindow( wxCloseEvent& event )
{
    SaveConfiguration();
    Destroy();
}
Beispiel #8
0
void PathUtilDlg::OnButton( wxCommandEvent& event )
{
	wxWindow * pcur = m_book->GetCurrentPage();
    if ( event.GetEventObject() == m_btnOK )
    {
        if (   pcur == m_clean_page 
			|| pcur == m_copy_page 
			|| pcur == m_find_page
			|| pcur == m_capture_page
			|| pcur == m_python_page
			|| pcur == m_rename_page
			|| pcur == m_verbose_page
			)
        {
            //pcur->OnOK();
			pcur->GetEventHandler()->ProcessEvent(event);
             event.Skip(false);
        }
        if (pcur == m_path_page)
        {
            m_path_page->OnOK();
        }
		if (pcur == m_crc_page)
		{
			m_crc_page->OnOK();
		}
    }
    else if(event.GetEventObject()==m_btnExit)
    {
        SaveConfiguration();
        Close();
        //EndModal(0);
    }
    else if(event.GetEventObject()==m_btnCancel)
    {
        if (pcur == m_find_page)
        {
            m_find_page->OnButton(event);
            return;
        }
		if (   pcur == m_python_page
			|| pcur == m_rename_page
			|| pcur == m_verbose_page
			|| pcur == m_base64_page
            || pcur == m_find_page
			)
		{
            //event.StopPropagation();
            //wxPostEvent(pcur, event);
            //event.Skip();
//			pcur->ProcessEvent(event);
		}
        while(m_threads.size())
        {
            wxCriticalSectionLocker locker(m_cs);
            if (m_threads.size())
            {
                wxThread* p = m_threads.front();
                m_threads.pop_front();
                p->Delete();
                OBaseThread* pbase = dynamic_cast<OBaseThread*>(p);
                if (pbase)
                {
                    pbase->m_cancel = true;
                }
            }
        }
    }
    else
    {
        event.Skip();
    }

}
LRESULT DefOptionWindowProc(HWND hDlg, INT iDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	static BOOL focus = FALSE;
	static BOOL allowfocus = TRUE;

	switch (uMsg)
	{
		case WM_CTLCOLOREDIT:
			if (focus) {
				//static DWORD start = -1;
				//if (start == -1) {
				//	start = GetTickCount();
				//}
				PostMessage((HWND) lParam, EM_SETSEL, 0, -1);
				//if (GetTickCount() - start > 1000) {
				//	start = -1;
					focus = FALSE;
				//}
			}
			return 0;
		case WM_COMMAND:
			if (HIWORD(wParam) == EN_SETFOCUS && allowfocus) {
				if (configuracion && configuracion->autoShowKeyboardOnTextboxFocus)
					ToggleKeyboard(TRUE);
				focus = TRUE;
				PostMessage((HWND) lParam, EM_SETSEL, 0, -1);
			} else if (HIWORD(wParam) == EN_KILLFOCUS) {
				if (configuracion && configuracion->autoShowKeyboardOnTextboxFocus)
					ToggleKeyboard(FALSE);
				focus = FALSE;
			}
			return 0;
		case WM_ACTIVATE:
			if (wParam == WA_CLICKACTIVE || wParam == WA_ACTIVE) {
				EnableWindow(g_hwndKB, TRUE);
			} else if (!::IsChild(hDlg, (HWND)lParam)) {
				EnableWindow(g_hwndKB, FALSE);
			}
			break;
		case WM_PAINT:
			PositionKBButton(g_hwndKB, GetParent(hDlg));
			PaintOptionsDialog(hDlg, iDlg);
			return 0;
		case WM_NOTIFY:
			switch (((LPNMHDR) lParam)->code)
			{
//				case PSN_HELP:
//					ToggleKeyboard();
//					return 0;
				case PSN_SETACTIVE:
					lasttab = iDlg;
					allowfocus = TRUE;
					return 0;
				case PSN_QUERYCANCEL:
					allowfocus = FALSE;
					if (!doNotAskToSaveOptions && MessageBox(hDlg, TEXT("Close without saving?"), TEXT("Exit"), MB_YESNO) == IDNO) {
						allowfocus = TRUE;
						SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
						return TRUE;
					}
					return FALSE;
				case PSN_APPLY:
					//WriteToLog(L"Applying dialog #%d\n", iDlg);
					if ((appliedDialogsMask & (1 << iDlg)) > 0) {
						//WriteToLog(L"Skipped applying dialog #%d\n", iDlg);
						return FALSE;
					}
					appliedDialogsMask |= (1 << iDlg);
					appliedDialogs++;
					if (saveOptionsAnswer == -1) {
						saveOptionsAnswer = -2;
						allowfocus = FALSE;
						int resp = MessageBox(hDlg, TEXT("Save Changes?"), TEXT("Exit"), MB_YESNOCANCEL);
						//WriteToLog(L"#%d: User response to \"Save Changes?\": %d\n", iDlg, resp);
						if (resp == IDCANCEL) {
							saveOptionsAnswer = -1;
							allowfocus = TRUE;
							SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
							appliedDialogs = 0;
							appliedDialogsMask = 0;
							return TRUE;
						}
						saveOptionsAnswer = (resp == IDNO) ? 0 : 1;
					}
					if (saveOptionsAnswer == 1) {
						/*//WriteToLog(L"Calling IsValidConfiguration(%d)\n", iDlg);
						if (!IsValidConfiguration(hDlg, iDlg)) {
							//WriteToLog(L"IsValidConfiguration(%d) returned FALSE\n", iDlg);
							SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_INVALID);
							saveOptionsAnswer = -1;
							appliedDialogs = 0;
							appliedDialogsMask = 0;
							return TRUE;
						}*/
						if (appliedDialogs == initializedDialogs) {
							//WriteToLog(L"#%d: Calling SaveConfiguration()\n", iDlg);
							if (SaveConfiguration()) {
								//WriteToLog(L"#%d: Options saved. Restarting iPT.\n", iDlg);
								PostMessage(g_hWnd, WM_CREATE, 0, 0);
							} else {
								//WriteToLog(L"SaveConfiguration() returned FALSE\n");
							}
						}
					}
					return FALSE;
			}
			break;
	}

	return 0;
}
Beispiel #10
0
//------------
//
void ConfigKeyHandler(dword key)
{
	int i, oldEditLine;

	oldEditLine = chosenConfigLine;

	if ( enterActivateKey ) { NewActiveKeyHandler( key ); return; }			// handle our sub processes
	
	switch ( key )
	{
		case RKEY_ChDown :	configOption = 0;
							if ( chosenConfigLine < CONFIG_LINES )
		    				{
							    chosenConfigLine++;
								DisplayConfigLine( chosenConfigLine - 1);
								RedrawConfigPage( chosenConfigLine );
                                DisplayConfigLine( chosenConfigLine );
							}
							else
							{
							    chosenConfigLine = 1;						// 0=hidden - can't hide once cursor moved
								DisplayConfigLine( CONFIG_LINES );
								RedrawConfigPage( chosenConfigLine );
								DisplayConfigLine( chosenConfigLine );
							}
							break;

							
		case RKEY_ChUp :	configOption = 0;
							if ( chosenConfigLine > 1 )					// 0=hidden - can't hide once cursor moved
		    				{
							    chosenConfigLine--;
								DisplayConfigLine( chosenConfigLine + 1 );
								RedrawConfigPage( chosenConfigLine );
								DisplayConfigLine( chosenConfigLine );
							}
							else
							{
							    chosenConfigLine = CONFIG_LINES;
								DisplayConfigLine( 1 );
								RedrawConfigPage( chosenConfigLine );
                                DisplayConfigLine( chosenConfigLine );
							}
								
							break;

							
		case RKEY_1 :
		case RKEY_2 :
		case RKEY_3 :
		case RKEY_4 :
		case RKEY_5 :
		case RKEY_6 :
		case RKEY_7 :
		case RKEY_8 :
		case RKEY_9 :		chosenConfigLine = (key - RKEY_0) + (((oldEditLine-1)/LINES_PER_PAGE)*LINES_PER_PAGE);	// direct keyboard selection of any line
							DisplayConfigLine( oldEditLine );
							DisplayConfigLine( chosenConfigLine );
							configOption = 0;								// will move the cursor to "Save" when last line selected
							break;

		case RKEY_0 :		chosenConfigLine = 10+ (((oldEditLine-1)/LINES_PER_PAGE)*LINES_PER_PAGE);		// make "0" select the last line
							DisplayConfigLine( oldEditLine );
							DisplayConfigLine( chosenConfigLine );
							break;

							
		case RKEY_Ok :
		case RKEY_TvRadio :
        case RKEY_Forward :
        case RKEY_Rewind :
		case RKEY_VolUp :
		case RKEY_VolDown : ConfigActionHandler( key );
							break;

		case RKEY_Recall :	CopyConfiguration();					// reload the original data
	                        oldLineNumber = LINES_PER_PAGE * 3;     // Initialise the oldLineNumber to force a page redisplay.
							RedrawConfigWindow();
							break;
							
		case RKEY_Record :	if (TvRatioOption != currentTvRatio) // If we changed the TV Ratio, apply the defaults to save
	                        {
                                 if ( currentTvRatio == 1 )  SetWideScreenSizes(); // Change the screen size variables to suit the Widescreen proportions.
                                 else Set43ScreenSizes();
                                 // And if the Guide Window was displayed when we called the menu we need to close it and reactivate it
                                 // with the new cordinates that would have been set here.
                                 if (guideWindowDisplayed) 
                                 {
                                    CloseGuideWindow();    // Close current Guide window
                                    ActivateGuideWindow(); // Reactivate with new coordinates.
                                 }
                            }
                            SaveConfiguration();
							CloseConfigWindow();					// Close the edit window
							redrawWindow = TRUE;					// will cause a redraw of timer list
							break;


		case RKEY_Exit : 	CloseConfigWindow();					// Close the edit window
							redrawWindow = TRUE;					// will cause a redraw of timer list
							break;
							

		default :
			break;
	}
}
Beispiel #11
0
//--------------------------------------------------------
//
void ConfigActionHandler(dword key)
{
	int		count, result;

	switch ( chosenConfigLine )
	{
		case 1 :    switch ( key )										// Model type
					{
						case RKEY_VolUp:	if ( currentModelType == TF5800 )
						    				{
											    currentModelType = TF5000;
												CreateTF5000Keys( &localKeyCodes );
											}
											else
											{
                                                currentModelType = TF5800;
												CreateTF5800Keys( &localKeyCodes );
											}
											DisplayConfigLine( chosenConfigLine );
											DisplayConfigLine( 3 );					// update the activation key code
											break;

											
						case RKEY_VolDown:	if ( currentModelType == TF5800 )
						    				{
											    currentModelType = TF5000;
												CreateTF5000Keys( &localKeyCodes );
											}
											else
											{
                                                currentModelType = TF5800;
												CreateTF5800Keys( &localKeyCodes );
											}
											DisplayConfigLine( chosenConfigLine );
											DisplayConfigLine( 3 );					// update the activation key code
											break;


						case RKEY_Ok :		break;

						default :			break;
					}
					break;

		case 2 :														// Language
				    break;

					
		case 3 :	switch ( key )										// Activation key
					{
						case RKEY_VolUp:	CurrentActivationKey = GetNextKey( &localKeyCodes, CurrentActivationKey );
											DisplayConfigLine( chosenConfigLine );
											break;

						case RKEY_VolDown:	CurrentActivationKey = GetPreviousKey( &localKeyCodes, CurrentActivationKey );
											DisplayConfigLine( chosenConfigLine );
											break;


						case RKEY_Ok :		DirectEnterActivateKey();
											break;

						default :			break;
					}
					break;


		case 4 :	switch ( key )										// Logo highlight
					{
						case RKEY_VolUp:	SelectNextHighlight( &currentHighlight );
											DisplayConfigLine( chosenConfigLine );
											break;

						case RKEY_VolDown:	SelectPreviousHighlight( &currentHighlight );
											DisplayConfigLine( chosenConfigLine );
											break;

						default :			break;
					}
					break;



		case 5 :	switch ( key )										// Selection sytle
					{
						case RKEY_VolUp:	if ( displayOption < 1 ) displayOption++; else displayOption = 0;
											DisplayConfigLine( chosenConfigLine );
											break;

						case RKEY_VolDown:	if ( displayOption > 0 ) displayOption--; else displayOption = 1;
											DisplayConfigLine( chosenConfigLine );
											break;

						default :			break;
					}
					break;

		case 6 :	switch ( key )										// NowNext Tag
					{
						case RKEY_VolUp:	if ( currentNowNextTag < 1 ) currentNowNextTag++; else currentNowNextTag = 0;
											DisplayConfigLine( chosenConfigLine );
											break;

						case RKEY_VolDown:	if ( currentNowNextTag > 0 ) currentNowNextTag--; else currentNowNextTag = 1;
											DisplayConfigLine( chosenConfigLine );
											break;

						default :			break;
					}
					break;
					
					
		case 7 :	switch ( key )										// Progress Information
					{
						case RKEY_VolUp:	if ( currentProgressInfo < 1 ) currentProgressInfo++; else currentProgressInfo = 0;
											DisplayConfigLine( chosenConfigLine );
											break;

						case RKEY_VolDown:	if ( currentProgressInfo > 0 ) currentProgressInfo--; else currentProgressInfo = 1;
											DisplayConfigLine( chosenConfigLine );
											break;

						default :			break;
					}
					break;
					
		case 8 :	switch ( key )										// Recall Key Option
					{
						case RKEY_VolUp:	if ( currentRecallKey < 1 ) currentRecallKey++; else currentRecallKey = 0;
											DisplayConfigLine( chosenConfigLine );
											break;

						case RKEY_VolDown:	if ( currentRecallKey > 0 ) currentRecallKey--; else currentRecallKey = 1;
											DisplayConfigLine( chosenConfigLine );
											break;

						default :			break;
					}
					break;
					
		case 9 :	switch ( key )										// Screen Fade Options  0 - 600seconds
					{
						case RKEY_VolUp:	if ( currentScreenFade < 600 ) currentScreenFade++; else currentScreenFade = 0;
											DisplayConfigLine( chosenConfigLine );
											break;

						case RKEY_Forward:	if (currentScreenFade > 2)
                                            { if ( currentScreenFade < 591 ) currentScreenFade=currentScreenFade+10; 
                                              else currentScreenFade = 600;
                                            }
                                            else currentScreenFade = 10;
				                            DisplayConfigLine( chosenConfigLine );
                                            break;

						case RKEY_VolDown:	if ( currentScreenFade > 0 ) currentScreenFade--; else currentScreenFade = 600;
											DisplayConfigLine( chosenConfigLine );
											break;

						case RKEY_Rewind:	if (currentScreenFade > 2) 
                                            { if (currentScreenFade >11) currentScreenFade=currentScreenFade-10; 
                                              else currentScreenFade = 2; 
											  DisplayConfigLine( chosenConfigLine );
                                            }  
											break;

						default :			break;
					}
					break;

		case 11 :	switch ( key )										// Channel Start Option
					{
						case RKEY_VolUp:	if ( currentStartChannel < 1 ) currentStartChannel++; else currentStartChannel = 0;
											DisplayConfigLine( chosenConfigLine );
											break;

						case RKEY_VolDown:	if ( currentStartChannel > 0 ) currentStartChannel--; else currentStartChannel = 1;
											DisplayConfigLine( chosenConfigLine );
											break;

						default :			break;
					}
					break;

		case 12 :	switch ( key )										// Timer Start Offset  0 - 60minutes
					{
						case RKEY_VolUp:	if ( currentStartOffset < 60 ) currentStartOffset++; else currentStartOffset = 0;
											DisplayConfigLine( chosenConfigLine );
											break;

						case RKEY_Forward:	if ( currentStartOffset < 55 ) currentStartOffset=currentStartOffset+5; else currentStartOffset = 60;
				                            DisplayConfigLine( chosenConfigLine );
                                            break;

						case RKEY_VolDown:	if ( currentStartOffset > 0 ) currentStartOffset--; else currentStartOffset = 60;
											DisplayConfigLine( chosenConfigLine );
											break;

						case RKEY_Rewind:	if (currentStartOffset >6) currentStartOffset=currentStartOffset-5; else currentStartOffset = 0; 
				                            DisplayConfigLine( chosenConfigLine );
                                            break;

						default :			break;
					}
					break;

		case 13 :	switch ( key )										// Timer End Offset  0 - 60minutes
					{
						case RKEY_VolUp:	if ( currentEndOffset < 60 ) currentEndOffset++; else currentEndOffset = 0;
											DisplayConfigLine( chosenConfigLine );
											break;

						case RKEY_Forward:	if ( currentEndOffset < 55 ) currentEndOffset=currentEndOffset+5; else currentEndOffset = 60;
				                            DisplayConfigLine( chosenConfigLine );
                                            break;

						case RKEY_VolDown:	if ( currentEndOffset > 0 ) currentEndOffset--; else currentEndOffset = 60;
											DisplayConfigLine( chosenConfigLine );
											break;

						case RKEY_Rewind:	if (currentEndOffset >6) currentEndOffset=currentEndOffset-5; else currentEndOffset = 0; 
				                            DisplayConfigLine( chosenConfigLine );
                                            break;

						default :			break;
					}
					break;

		case 14 :	switch ( key )										// Guide Startup Option
					{
						case RKEY_VolUp:	if ( currentGuideStart < 2 ) currentGuideStart++; else currentGuideStart = 0;
											DisplayConfigLine( chosenConfigLine );
											break;

						case RKEY_VolDown:	if ( currentGuideStart > 0 ) currentGuideStart--; else currentGuideStart = 2;
											DisplayConfigLine( chosenConfigLine );
											break;

						default :			break;
					}
					break;
					
		case 15 :	switch ( key )										// TV Ratio Option
					{
						case RKEY_VolUp:	if ( currentTvRatio < 1 ) currentTvRatio++; else currentTvRatio = 0;
											DisplayConfigLine( chosenConfigLine );
											break;

						case RKEY_VolDown:	if ( currentTvRatio > 0 ) currentTvRatio--; else currentTvRatio = 1;
											DisplayConfigLine( chosenConfigLine );
											break;

						default :			break;
					}
					break;

		case 16 :	switch ( key )										// Guide Window Option
					{
						case RKEY_VolUp:	if ( currentGuideWindowOption < 1 ) currentGuideWindowOption++; else currentGuideWindowOption = 0;
											DisplayConfigLine( chosenConfigLine );
											break;

						case RKEY_VolDown:	if ( currentGuideWindowOption > 0 ) currentGuideWindowOption--; else currentGuideWindowOption = 1;
											DisplayConfigLine( chosenConfigLine );
											break;

						default :			break;
					}
					break;

		case 17 :	switch ( key )										// Progress Bar colours
					{
		            	case RKEY_VolUp:	if (currentProgressBarOption < 3) currentProgressBarOption = currentProgressBarOption + 1;
		            	                    else currentProgressBarOption = 0;
											DisplayConfigLine( chosenConfigLine );
											break;

											
						case RKEY_VolDown:	if (currentProgressBarOption > 0) currentProgressBarOption = currentProgressBarOption - 1;
		            	                    else currentProgressBarOption = 3;
											DisplayConfigLine( chosenConfigLine );
											break;

						default :			break;
					}
					break;

		case 18 :	switch ( key )										// Progress Bar colours
					{
						case RKEY_VolDown:
		            	case RKEY_VolUp:	currentChannelNumberOption = !currentChannelNumberOption;
											DisplayConfigLine( chosenConfigLine );
											break;

						default :			break;
					}
					break;

		case 10 :
        case 20 :														// bottom line commands : Save, or Cancel
						switch ( key )
						{
							case RKEY_VolUp:	if ( configOption < 1 ) configOption++;
												else configOption = 0;
												break;

							case RKEY_VolDown:	if ( configOption > 0 ) configOption--;
												else configOption = 1;
												break;


							case RKEY_Ok :		switch ( configOption )
												{
													case 0 :	SaveConfiguration();		// save
																break;
																
													case 1 :	break;						// cancel
													default :	break;
												}

												CloseConfigWindow();		// Close the edit window
												redrawWindow = TRUE;		// will cause a redraw of timer list
												break;

							default :			break;
						}

						DisplayConfigLine( chosenConfigLine );
					    break;
						
		default :		break;
	}

}
Beispiel #12
0
void FFTviewerFrame::OnMenuItemSaveConfigSelected(wxCommandEvent& event)
{
    SaveConfiguration();
}
Beispiel #13
0
void FFTviewerFrame :: shutdown()
{
    //Avoid redundant processing
  //  Disconnect(ID_MENUITEM1,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&FFTviewerFrame::OnQuit);


    SaveConfiguration();

/*
    if(mWaterfall != NULL) {
        mWaterfall->Destroy();
        mWaterfall = NULL;
        cout << "mWaterfall Destroyed " << endl;}
*/

//    g_frame_delay = 0; // Release any data in processing.

    if(mSpectrum != NULL) {
        // Turn off Power recording
//        if(g_PWRfileRecording) g_PWRfileRecording = false;
        if(mSpectrum->m_capturingData) {
                mSpectrum->StopCapturing();
                if(CLOSE_DEBUG) cout << "Capturing Stopped" << endl; }
//        ogl_FFTline->Destroy();
//        ogl_IQline->Destroy();
//        ogl_IQscatter->Destroy();
//        mSpectrum->Destroy();
 //       mSpectrum = NULL;
 //       wxYield();
 //       m_updateTimer->Destroy();

        mSpectrum->Disconnect(wxEVT_PAINT,(wxObjectEventFunction)&FFTviewerFrame::OnmSpectrumPaint,0,this);

    }
 /*      if(m_ControlPanel != NULL) {
        m_ControlPanel->Destroy();
        m_ControlPanel = NULL;
        cout << " After Control Panel Destroy()" << endl;} */

 /*   if(MenuItem8 != NULL) {
        MenuItem8->Destroy();
        MenuItem8 = NULL;  }*/

/*   if(MenuItem8B != NULL) {
        MenuItem8B->Destroy();
        MenuItem8B = NULL;  }*/

   /* if(MenuItem7 != NULL) {
        MenuItem7->Destroy();
        MenuItem7 = NULL;  }*/

   /* if(MenuItem5 != NULL) {
        MenuItem5->Destroy();
        MenuItem5 = NULL;  }*/

   /* if(Menu3 != NULL) {
        Menu3->Destroy();
        Menu3 = NULL;  }*/

   /* if(Menu4 != NULL) {
        Menu4->Destroy();
        Menu4 = NULL;  }*/
/*
    if(mStatusBar != NULL) {
        mStatusBar->Destroy();
        mStatusBar = NULL;
        cout << "mStatusBar Destroyed" << endl;
    }
*/
  //  SetMenu(false);
/*
    if(MenuBar1 != NULL) {
        MenuBar1->Destroy();
        MenuBar1 = NULL);
    } */
//    MenuBar1.Destroy();

/*    FFTviewerApp *parent = GetParent();
    parent->Close(); */
//    GetParent()->CloseWindow();
//    GetParent()->Destroy);
//    Destroy();
//    GetParent()->Destroy();
//   exit(-1);
//    CleanUp();
//    GetTopWindow(NULL)->CleanUp();
//    wxGetActiveWindow()->DeletePendingEvents();
//    wxGetActiveWindow()->ClearEventHashTable();
  //  GetParent()->DestroyChildren();

 //   wxGetActiveWindow()->Destroy();
//    FFTviewerFrame = NULL;
/*
    if(frmFFTMainWindow != NULL) {
        frmFFTMainWindow->Destroy();
        frmFFTMainWindow = NULL; }
*/

//MenuBar1->Destroy();

//cout << "After menubar1` Destroy" << endl;

  if(mSpectrum != NULL) {

    if(mSpectrum->m_updateTimer!=NULL) {
            if(mSpectrum->m_updateTimer->IsRunning()) {
                    mSpectrum->m_updateTimer->Stop();
                    mSpectrum->m_updateTimer->DeletePendingEvents();
                    if(CLOSE_DEBUG) cout << "m_updateTimer stoped" << endl;}
//            m_updateTimer->Delete();
//            mSpectrum->m_updateTimer = NULL;
            }

        LMAL_Quit();
        if(CLOSE_DEBUG) {
            cout<< "After LMAL_quit" << endl;
            Sleep(1000); }

        mSpectrum -> shutdown();

        if(CLOSE_DEBUG) {
            cout << "After mSpectrum -> Shutdown()" << endl;
            Sleep(1000); }

        mSpectrum->Destroy();
        if(CLOSE_DEBUG) cout << "After mSpectrum->Destroy()" <<endl;
        mSpectrum = NULL;
        if(CLOSE_DEBUG) Sleep(1000);
        Destroy();

/*
        mSpectrum->Destroy();
        cout << "After mSpectrum->Destroy()" << endl;

        mSpectrum = NULL; */
  }
  /*
cout << "Before Notebook1 Destroy " << endl;
    if(Notebook1 != NULL) {
        Notebook1->Destroy();
        Notebook1 = NULL;
        cout << "After Notebook1 Destroy" << endl; }
    Sleep(1000); */


//  Sleep(1000);

//mSpectrum = NULL;
/*
cout << "Before Destroy in fftviewermain()" << endl;
    Sleep(1000);
    Destroy();
    Sleep(1000); */
/*
cout << "After Destroy in fftviewermain" << endl;

  LMAL_Quit(); */
/*
    if(m_ControlPanel != NULL) {
        m_ControlPanel->Destroy();
        m_ControlPanel = NULL;
        cout << "After Control Panel Destroy" << endl;} */


return;
}
Beispiel #14
0
BOOL RegConfig::Configure()
{
	//TODO: Открыть диалог с настройками
	mb_SettingsChanged = FALSE;
	RegConfigDlg Config(psi, REConfigTitle, _T("Configuration"), &guid_Configuration);
	
	FarDialogItem *p1, *p2;
	
	Config.StartColumns();
	Config.AddCheckbox(REAddToPluginsMenu, &bAddToPluginsMenu);
	Config.ColumnBreak();
	Config.AddCheckbox(REAddToDisksMenu, &bAddToDisksMenu);
	Config.EndColumns();
	bool lbNeedDiskNumbers = true;
#ifdef _UNICODE
	#if FAR_UNICODE>=1906
		lbNeedDiskNumbers = false;
	#else
		lbNeedDiskNumbers = (gFarVersion.Build < 1692);
	#endif
#endif
	if (lbNeedDiskNumbers)
	{
		p1 = Config.AddText(REDisksMenuHotkey);
		p2 = Config.AddEditField(cDiskMenuHotkey, 2, 1); p2->X2 = p2->X1; p2->Type = DI_FIXEDIT;
		Config.MoveItemAfter(p1,p2);
	}
	
	Config.AddSeparator(REPrefixSeparator);
	Config.StartColumns();
	p1 = Config.AddText(REPrefixLabel); p2 = Config.AddEditField(sCommandPrefix, 9, 10);
	Config.MoveItemAfter(p1,p2);
	Config.ColumnBreak();
	p1 = Config.AddText(REPanelPrefixLabel); p2 = Config.AddEditField(sRegTitlePrefix, 9, 10);
	Config.MoveItemAfter(p1,p2);
	Config.EndColumns();

	Config.AddSeparator(REWow6432);
	Config.StartColumns();
	Config.AddCheckbox(REWow64on32, &bWow64on32_)->Flags |= DIF_3STATE;
	Config.ColumnBreak();
	Config.AddCheckbox(REWow64process, &is64bitOs)->Flags |= DIF_DISABLE;
	Config.EndColumns();

	Config.AddSeparator();

	Config.AddCheckbox(RESkipAccessDeniedMessage, &bSkipAccessDeniedMessage);
	Config.StartColumns();
	Config.AddCheckbox(REUseBackupRestore, &bUseBackupRestore);
	Config.ColumnBreak();
	Config.AddCheckbox(RESkipPrivilegesDeniedMessage, &bSkipPrivilegesDeniedMessage);
	Config.EndColumns();
	
	Config.StartColumns();
	BOOL lbBrowseRegFiles = (bBrowseRegFiles == 1) ? 2 : (bBrowseRegFiles == 2) ? 1 : 0;
	Config.AddCheckbox(REBrowseRegFiles, &lbBrowseRegFiles)->Flags |= DIF_3STATE;
	Config.AddCheckbox(REShowKeysAsDirs, &bShowKeysAsDirs);
	Config.ColumnBreak();
	Config.AddCheckbox(REBrowseHives, &bBrowseRegHives)->Flags |= DIF_3STATE;
	Config.AddCheckbox(REExportDefaultValueFirst, &bExportDefaultValueFirst);
	Config.EndColumns();
	Config.StartColumns();
	Config.AddCheckbox(RECreateUnicodeFiles, &bCreateUnicodeFiles);
	Config.ColumnBreak();
	p1 = Config.AddText(REAnsiCpLabel); p2 = Config.AddIntEditField((int*)&nAnsiCodePage, 6);
	Config.MoveItemAfter(p1,p2);
	Config.EndColumns();
	Config.StartColumns();
	Config.AddCheckbox(REEscapeRNonExporting, &bEscapeRNonExporting);
	Config.ColumnBreak();
	Config.AddCheckbox(REEditBinaryAsText, &bEditBinaryAsText);
	Config.EndColumns();
	Config.StartColumns();
	Config.AddCheckbox(RECheckMacroSeq, &bCheckMacroSequences);
	Config.ColumnBreak();
	Config.AddCheckbox(RECheckMacroVar, &bCheckMacrosInVars);
	Config.EndColumns();

	//// Speed up browsing of large keys (HKCR\\CLSID, and so on)
	//Config.AddSeparator(RESpeedUpLargeKeysSeparator);
	//Config.AddCheckbox(REUnsortLargeKeys, &bUnsortLargeKeys);
	//Config.SlideItemUp(Config.AddIntEditField((int*)&nLargeKeyCount, 7));
	//Config.AddCheckbox(RELoadDescriptions, &bLoadDescriptions);
	//Config.SlideItemUp(Config.AddIntEditField((int*)&nLargeKeyTimeout, 7));
	//
	//// 
	//Config.AddSeparator(REAutoRefreshSeparator);
	//Config.AddCheckbox(REAutoRefreshChanges, &bRefreshChanges);
	//Config.StartColumns();
	//p1 = Config.AddText(RERefreshKeyTimeoutLabel); p2 = Config.AddIntEditField((int*)&nRefreshKeyTimeout, 6);
	//Config.MoveItemAfter(p1,p2);
	//Config.ColumnBreak();
	//p1 = Config.AddText(RERefreshSubkeyTimeoutLabel); p2 = Config.AddIntEditField((int*)&nRefreshSubkeyTimeout, 6);
	//Config.MoveItemAfter(p1,p2);
	//Config.EndColumns();


	int nOkBtn = Config.AddFooterButtons(REBtnOK, REBtnVisual, REBtnCancel, 0);
	Config.nBtnVisualID = nOkBtn+1;
	Config.GetItemByIndex(Config.nBtnVisualID)->Flags |= DIF_BTNNOCLOSE;

	if (Config.ShowDialog())
	{
		mb_SettingsChanged = TRUE;
		if (nAnsiCodePage == CP_UTF8 || nAnsiCodePage == CP_UTF7)
		{
			InvalidOp(); nAnsiCodePage = 1251;
		}
		bBrowseRegFiles = (lbBrowseRegFiles == 1) ? 2 : (lbBrowseRegFiles == 2) ? 1 : 0;
		// сохраним в реестр
		SaveConfiguration();
		// Обновить Wow64on32 и заголовки
		gpPluginList->OnSettingsChanged(bWow64on32_);
	}
	
	// Вернуть TRUE, если фар нужно передернуть
	return mb_SettingsChanged;
}
Beispiel #15
0
void RegConfig::LoadConfiguration()
{
	HANDLE hk;
	bSomeValuesMissed = FALSE;
	BOOL lbKeyOpened = FALSE;

	#if FAR_UNICODE>=1900
	FarSettingsCreate sc = {sizeof(FarSettingsCreate), guid_PluginGuid, INVALID_HANDLE_VALUE};
	FarSettingsItem fsi = {0};
	lbKeyOpened = psi.SettingsControl(INVALID_HANDLE_VALUE, SCTL_CREATE, 0, &sc) != 0;
	hk = sc.Handle;
	#else
	lbKeyOpened = (0 == RegOpenKeyEx(HKEY_CURRENT_USER, pszPluginKey, 0, KEY_READ, (HKEY*)&hk));
	#endif
	
	if (!lbKeyOpened)
	{
		// Если ключа не было - сразу создать в реестре значения по умолчанию!
		bSomeValuesMissed = TRUE;
		
	} else {
		GetByte(hk, L"Wow64on32", &bWow64on32_); // Отображать 64-битный реестр в FAR.x32
		GetByte(hk, L"Virtualize", &bVirtualize); // Отображать виртуализированные значения реестра
		GetString(hk, L"CommandPrefix", sCommandPrefix, countof(sCommandPrefix)); // _T("reg2")
		GetString(hk, L"RegTitlePrefix", sRegTitlePrefix, countof(sRegTitlePrefix)); // _T("REG2")
		GetString(hk, L"RegTitleDirty", sRegTitleDirty, countof(sRegTitleDirty)); // _T(" (*)")
		GetBool(hk, L"AddToDisksMenu", &bAddToDisksMenu);
		GetString(hk, L"DiskMenuHotkey", cDiskMenuHotkey, countof(cDiskMenuHotkey));
		GetBool(hk, L"AddToPluginsMenu", &bAddToPluginsMenu);
		GetBool(hk, L"BrowseRegFiles", &bBrowseRegFiles);
		GetByte(hk, L"BrowseRegHives", &bBrowseRegHives);
		GetBool(hk, L"SkipAccessDeniedMessage", &bSkipAccessDeniedMessage);
		GetBool(hk, L"UseBackupRestore", &bUseBackupRestore);
		GetBool(hk, L"SkipPrivilegesDeniedMessage", &bSkipPrivilegesDeniedMessage);
		GetBool(hk, L"ShowKeysAsDirs", &bShowKeysAsDirs);
		GetBool(hk, L"UnsortLargeKeys", &bUnsortLargeKeys);
		GetDWORD(hk, L"LargeKeyCount", &nLargeKeyCount);
		GetDWORD(hk, L"LargeKeyTimeout", &nLargeKeyTimeout);
		GetBool(hk, L"CreateUnicodeFiles", &bCreateUnicodeFiles);
		GetDWORD(hk, L"AnsiCodePage", &nAnsiCodePage); if (nAnsiCodePage == CP_UTF7 || nAnsiCodePage == CP_UTF8) nAnsiCodePage = 1251;
		GetBool(hk, L"EscapeRNonExporting", &bEscapeRNonExporting);
		GetBool(hk, L"CheckMacroSequences", &bCheckMacroSequences);
		GetBool(hk, L"CheckMacrosInVars", &bCheckMacrosInVars);
		GetBool(hk, L"EditBinaryAsText", &bEditBinaryAsText);
		GetBool(hk, L"RefreshChanges", &bRefreshChanges);
		GetBool(hk, L"LoadDescriptions", &bLoadDescriptions);
		GetBool(hk, L"ExportDefaultValueFirst", &bExportDefaultValueFirst);
		GetBool(hk, L"ConfirmImport", &bConfirmImport);
		GetBool(hk, L"ShowImportResult", &bShowImportResult);
		GetDWORD(hk, L"RefreshKeyTimeout", &nRefreshKeyTimeout);
		GetDWORD(hk, L"RefreshSubkeyTimeout", &nRefreshSubkeyTimeout);
		GetString(hk, L"LastRegPath", &pszLastRegPath);
		nMaxRegPath = (pszLastRegPath == 0) ? 0 : (lstrlenW(pszLastRegPath)+1);
		GetBool(hk, L"RestorePanelMode", &bRestorePanelMode);
		
		#if FAR_UNICODE>=1900
		psi.SettingsControl(sc.Handle, SCTL_FREE, 0, 0);
		#else
		RegCloseKey((HKEY)hk);
		#endif
	}
	
	// Если ключа не было, или в плагине появились новые параметры - сразу сохранить наши текущие настройки (умолчания)
	if (bSomeValuesMissed)
	{
		SaveConfiguration();
	}
}
void ArkanoidRemakeSdl::Stop()
{
  mTimer.Stop();
  SaveConfiguration("config.txt");
}