ZoomInfo::ZoomInfo(double start, double pixelsPerSecond) : vpos(0) , h(start) , zoom(pixelsPerSecond) { UpdatePrefs(); }
void DeviceToolBar::RefillCombos() { FillHosts(); FillHostDevices(); FillInputChannels(); // make the device display selection reflect the prefs if they exist UpdatePrefs(); }
NS_IMETHODIMP nsSocketTransportService::Observe(nsISupports *subject, const char *topic, const PRUnichar *data) { if (!strcmp(topic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) { UpdatePrefs(); } return NS_OK; }
// called from main thread only NS_IMETHODIMP nsSocketTransportService::Init() { NS_ENSURE_TRUE(mLock, NS_ERROR_OUT_OF_MEMORY); if (!NS_IsMainThread()) { NS_ERROR("wrong thread"); return NS_ERROR_UNEXPECTED; } if (mInitialized) return NS_OK; if (mShuttingDown) return NS_ERROR_UNEXPECTED; if (!mThreadEvent) { mThreadEvent = PR_NewPollableEvent(); // // NOTE: per bug 190000, this failure could be caused by Zone-Alarm // or similar software. // // NOTE: per bug 191739, this failure could also be caused by lack // of a loopback device on Windows and OS/2 platforms (NSPR creates // a loopback socket pair on these platforms to implement a pollable // event object). if we can't create a pollable event, then we'll // have to "busy wait" to implement the socket event queue :-( // if (!mThreadEvent) { NS_WARNING("running socket transport thread without a pollable event"); LOG(("running socket transport thread without a pollable event")); } } nsCOMPtr<nsIThread> thread; nsresult rv = NS_NewThread(getter_AddRefs(thread), this); if (NS_FAILED(rv)) return rv; { nsAutoLock lock(mLock); // Install our mThread, protecting against concurrent readers thread.swap(mThread); } nsCOMPtr<nsIPrefBranch2> tmpPrefService = do_GetService(NS_PREFSERVICE_CONTRACTID); if (tmpPrefService) tmpPrefService->AddObserver(SEND_BUFFER_PREF, this, PR_FALSE); UpdatePrefs(); mInitialized = PR_TRUE; return NS_OK; }
NS_IMETHODIMP nsSocketTransportService::Observe(nsISupports *subject, const char *topic, const char16_t *data) { if (!strcmp(topic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) { UpdatePrefs(); return NS_OK; } if (!strcmp(topic, "profile-initial-state")) { int32_t blipInterval = Preferences::GetInt(BLIP_INTERVAL_PREF, 0); if (blipInterval <= 0) { return NS_OK; } return net::NetworkActivityMonitor::Init(blipInterval); } if (!strcmp(topic, "last-pb-context-exited")) { nsCOMPtr<nsIRunnable> ev = NewRunnableMethod(this, &nsSocketTransportService::ClosePrivateConnections); nsresult rv = Dispatch(ev, nsIEventTarget::DISPATCH_NORMAL); NS_ENSURE_SUCCESS(rv, rv); } if (!strcmp(topic, NS_TIMER_CALLBACK_TOPIC)) { nsCOMPtr<nsITimer> timer = do_QueryInterface(subject); if (timer == mAfterWakeUpTimer) { mAfterWakeUpTimer = nullptr; mSleepPhase = false; } } else if (!strcmp(topic, NS_WIDGET_SLEEP_OBSERVER_TOPIC)) { mSleepPhase = true; if (mAfterWakeUpTimer) { mAfterWakeUpTimer->Cancel(); mAfterWakeUpTimer = nullptr; } } else if (!strcmp(topic, NS_WIDGET_WAKE_OBSERVER_TOPIC)) { if (mSleepPhase && !mAfterWakeUpTimer) { mAfterWakeUpTimer = do_CreateInstance("@mozilla.org/timer;1"); if (mAfterWakeUpTimer) { mAfterWakeUpTimer->Init(this, 2000, nsITimer::TYPE_ONE_SHOT); } } } return NS_OK; }
ViewInfo::ViewInfo(double start, double screenDuration, double pixelsPerSecond) : ZoomInfo(start, pixelsPerSecond) , selectedRegion() , track(NULL) , total(screenDuration) , sbarH(0) , sbarScreen(1) , sbarTotal(1) , sbarScale(1.0) , scrollStep(16) , bUpdateTrackIndicator(true) , bScrollBeyondZero(false) { UpdatePrefs(); }
// called from main thread only NS_IMETHODIMP nsSocketTransportService::Init() { if (!NS_IsMainThread()) { NS_ERROR("wrong thread"); return NS_ERROR_UNEXPECTED; } if (mInitialized) return NS_OK; if (mShuttingDown) return NS_ERROR_UNEXPECTED; nsCOMPtr<nsIThread> thread; nsresult rv = NS_NewNamedThread("Socket Thread", getter_AddRefs(thread), this); if (NS_FAILED(rv)) return rv; { MutexAutoLock lock(mLock); // Install our mThread, protecting against concurrent readers thread.swap(mThread); } nsCOMPtr<nsIPrefBranch> tmpPrefService = do_GetService(NS_PREFSERVICE_CONTRACTID); if (tmpPrefService) { tmpPrefService->AddObserver(SEND_BUFFER_PREF, this, false); tmpPrefService->AddObserver(KEEPALIVE_ENABLED_PREF, this, false); tmpPrefService->AddObserver(KEEPALIVE_IDLE_TIME_PREF, this, false); tmpPrefService->AddObserver(KEEPALIVE_RETRY_INTERVAL_PREF, this, false); tmpPrefService->AddObserver(KEEPALIVE_PROBE_COUNT_PREF, this, false); tmpPrefService->AddObserver(MAX_TIME_BETWEEN_TWO_POLLS, this, false); tmpPrefService->AddObserver(TELEMETRY_PREF, this, false); tmpPrefService->AddObserver(MAX_TIME_FOR_PR_CLOSE_DURING_SHUTDOWN, this, false); } UpdatePrefs(); nsCOMPtr<nsIObserverService> obsSvc = services::GetObserverService(); if (obsSvc) { obsSvc->AddObserver(this, "profile-initial-state", false); obsSvc->AddObserver(this, "last-pb-context-exited", false); obsSvc->AddObserver(this, NS_WIDGET_SLEEP_OBSERVER_TOPIC, true); obsSvc->AddObserver(this, NS_WIDGET_WAKE_OBSERVER_TOPIC, true); } mInitialized = true; return NS_OK; }
void TranscriptionToolBar::Populate() { // Very similar to code in ControlToolBar... // Very similar to code in EditToolBar MakeButtonBackgroundsSmall(); AddButton(bmpPlay, bmpPlayDisabled, TTB_PlaySpeed, _("Play at selected speed")); MakeAlternateImages(bmpLoop, bmpLoopDisabled, TTB_PlaySpeed, 1); MakeAlternateImages(bmpCutPreview, bmpCutPreviewDisabled, TTB_PlaySpeed, 2); mButtons[TTB_PlaySpeed]->FollowModifierKeys(); //Add a slider that controls the speed of playback. const int SliderWidth=100; mPlaySpeedSlider = safenew ASlider(this, TTB_PlaySpeedSlider, _("Playback Speed"), wxDefaultPosition, wxSize(SliderWidth,25), SPEED_SLIDER); mPlaySpeedSlider->Set(mPlaySpeed / 100.0); mPlaySpeedSlider->SetLabel(_("Playback Speed")); // 6 steps using page up/down, and 60 using arrow keys mPlaySpeedSlider->SetScroll(0.16667f, 1.6667f); Add( mPlaySpeedSlider, 0, wxALIGN_CENTER ); mPlaySpeedSlider->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(TranscriptionToolBar::OnFocus), NULL, this); mPlaySpeedSlider->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(TranscriptionToolBar::OnFocus), NULL, this); #ifdef EXPERIMENTAL_VOICE_DETECTION // If we need these strings translated, then search and replace // TRANSLATBLE by _ and remove this #define. #define TRANSLATABLE( x ) wxT( x ) AddButton(bmpTnStartOn, bmpTnStartOnDisabled, TTB_StartOn, TRANSLATABLE("Adjust left selection to next onset")); AddButton(bmpTnEndOn, bmpTnEndOnDisabled, TTB_EndOn, TRANSLATABLE("Adjust right selection to previous offset")); AddButton(bmpTnStartOff, bmpTnStartOffDisabled, TTB_StartOff, TRANSLATABLE("Adjust left selection to next offset")); AddButton(bmpTnEndOff, bmpTnEndOffDisabled, TTB_EndOff, TRANSLATABLE("Adjust right selection to previous onset")); AddButton(bmpTnSelectSound, bmpTnSelectSoundDisabled, TTB_SelectSound, TRANSLATABLE("Select region of sound around cursor")); AddButton(bmpTnSelectSilence, bmpTnSelectSilenceDisabled, TTB_SelectSilence, TRANSLATABLE("Select region of silence around cursor")); AddButton(bmpTnAutomateSelection, bmpTnAutomateSelectionDisabled, TTB_AutomateSelection, TRANSLATABLE("Automatically make labels from words")); AddButton(bmpTnMakeTag, bmpTnMakeTagDisabled, TTB_MakeLabel, TRANSLATABLE("Add label at selection")); AddButton(bmpTnCalibrate, bmpTnCalibrateDisabled, TTB_Calibrate, TRANSLATABLE("Calibrate voicekey")); mSensitivitySlider = safenew ASlider(this, TTB_SensitivitySlider, TRANSLATABLE("Adjust Sensitivity"), wxDefaultPosition, wxSize(SliderWidth,25), SPEED_SLIDER); mSensitivitySlider->Set(.5); mSensitivitySlider->SetLabel(TRANSLATABLE("Sensitivity")); Add( mSensitivitySlider, 0, wxALIGN_CENTER ); wxString choices[] = { TRANSLATABLE("Energy"), TRANSLATABLE("Sign Changes (Low Threshold)"), TRANSLATABLE("Sign Changes (High Threshold)"), TRANSLATABLE("Direction Changes (Low Threshold)"), TRANSLATABLE("Direction Changes (High Threshold)") }; mKeyTypeChoice = safenew wxChoice(this, TTB_KeyType, wxDefaultPosition, wxDefaultSize, 5, choices ); mKeyTypeChoice->SetName(TRANSLATABLE("Key type")); mKeyTypeChoice->SetSelection(0); Add( mKeyTypeChoice, 0, wxALIGN_CENTER ); #endif // Add a little space Add(2, -1); UpdatePrefs(); }
Handler() { UpdatePrefs(); }
void DeviceToolBar::Populate() { int i; wxArrayString inputs; wxArrayString outputs; #if USE_PORTAUDIO_V19 int nDevices = Pa_GetDeviceCount(); #else int nDevices = Pa_CountDevices(); #endif for (i = 0; i < nDevices; i++) { const PaDeviceInfo *info = Pa_GetDeviceInfo(i); wxString name = DeviceName(info); if (info->maxOutputChannels > 0) { outputs.Add(name); } if (info->maxInputChannels > 0) { inputs.Add(name); } } wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); // Output device mPlayBitmap = new wxBitmap(theTheme.Bitmap(bmpSpeaker)); Add(new wxStaticBitmap(this, wxID_ANY, *mPlayBitmap), 0, wxALIGN_CENTER); mOutput = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, outputs); mOutput->SetName(_("Output Device")); #if wxUSE_TOOLTIPS mOutput->SetToolTip(_("Output Device")); #endif Add(mOutput, 0, wxALIGN_CENTER); if (outputs.GetCount() == 0) mOutput->Enable(false); // Input device mRecordBitmap = new wxBitmap(theTheme.Bitmap(bmpMic)); Add(new wxStaticBitmap(this, wxID_ANY, *mRecordBitmap), 0, wxALIGN_CENTER); mInput = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, inputs); mInput->SetName(_("Input Device")); #if wxUSE_TOOLTIPS mInput->SetToolTip(_("Input Device")); #endif Add(mInput, 0, wxALIGN_CENTER); if (inputs.GetCount() == 0) mInput->Enable(false); UpdatePrefs(); }
OutputCtrl::OutputCtrl( wxWindow* parent, wxWindowID id, const wxString& name, const wxPoint& pos, const wxSize& size, long style ) : wxStyledTextCtrl(), m_Selected( -1 ) { wxStyledTextCtrl::Create( parent, id, wxDefaultPosition, wxDefaultSize, wxVSCROLL | wxSTATIC_BORDER ); UsePopUp(false); // initialize styles StyleClearAll(); // Set the lexer language SetLexer( wxSTC_LEX_TEX ); // Clear the zoom keys and mouse mapping. CmdKeyClear( wxSTC_KEY_ADD, wxSTC_SCMOD_CTRL ); CmdKeyClear( wxSTC_KEY_SUBTRACT, wxSTC_SCMOD_CTRL ); CmdKeyClear( wxSTC_KEY_DIVIDE, wxSTC_SCMOD_CTRL ); StyleClearAll(); // TODO: Make the font style a configuration option or use some OS default! wxFont* font = wxTheFontList->FindOrCreateFont( 8, wxDEFAULT, wxNORMAL, wxNORMAL, false, "Courier New" ); for ( int i = 0; i < wxSTC_STYLE_LASTPREDEFINED; i++ ) StyleSetFont( i, *font ); StyleSetBackground( 1, wxColour( 255, 0, 0 ) ); StyleSetForeground( 1, wxColour( 255, 255, 255 ) ); StyleSetBackground( 2, wxColour( 255, 255, 255 ) ); StyleSetForeground( 2, wxColour( 255, 0, 0 ) ); /* StyleSetBackground( wxSTC_STYLE_DEFAULT, tsGetPrefs().GetBgColor() ); SetCaretForeground( tsGetPrefs().GetDefaultColor() ); StyleSetForeground( wxSTC_TCS_DEFAULT, tsGetPrefs().GetDefaultColor() ); StyleSetBackground( wxSTC_TCS_DEFAULT, tsGetPrefs().GetBgColor() ); SetSelBackground( 1, tsGetPrefs().GetSelBgColor() ); SetSelForeground( 1, tsGetPrefs().GetSelColor() ); */ IndicatorSetForeground( 0, wxColour( 255, 0, 0 ) ); //SetTabWidth( tsGetPrefs().GetTabWidth() ); // setup the caret. SetCaretWidth( 2 ); SetVisiblePolicy( wxSTC_VISIBLE_STRICT | wxSTC_VISIBLE_SLOP, 1 ); SetXCaretPolicy( wxSTC_CARET_EVEN | wxSTC_VISIBLE_STRICT | wxSTC_CARET_SLOP, 1 ); SetYCaretPolicy( wxSTC_CARET_EVEN | wxSTC_VISIBLE_STRICT | wxSTC_CARET_SLOP, 1 ); // Set the margin. SetMarginLeft( 0 ); SetMarginType( 0, wxSTC_MARGIN_SYMBOL ); SetMarginWidth( 0, 12 ); SetMarginWidth( 1, 0 ); SetMarginWidth( 2, 0 ); SetMarginSensitive( 0, false ); //StyleSetBackground( wxSTC_STYLE_LINENUMBER, tsGetPrefs().GetBgColor() ); SetWrapMode( wxSTC_WRAP_NONE ); SetLayoutCache( wxSTC_CACHE_PAGE ); SetReadOnly( true ); UpdatePrefs(); // Create the regular expression here once. // TODO: This possibly needs fixing for non Win32 platforms. m_ErrorExpr.Compile( "([^*?:<>|]*)[ \t]Line:[ \t]([0-9]*)[ \t]-[ \t](.*)", wxRE_ADVANCED | wxRE_ICASE ); wxASSERT( m_ErrorExpr.IsValid() ); m_WarnExpr.Compile( "([^*?:<>|]*)[ \t][(]([0-9]*)[)]:[ \t](.*)", wxRE_ADVANCED | wxRE_ICASE ); wxASSERT( m_WarnExpr.IsValid() ); }