Esempio n. 1
0
void PreviewDlg::OnIdle(wxIdleEvent& WXUNUSED(event)) {
	if (!IsShown() || m_idleTimer.Time() < 100) return;

	// Check if we have changed source document
	EditorCtrl* activeEditor = m_parent.GetEditorCtrl();
	if (!activeEditor) return;

	if (m_editorCtrl != activeEditor) {
		m_editorCtrl = activeEditor;

		// Always reload on new source
		if (!m_pinnedEditor) {
			UpdateBrowser(cxUPDATE_RELOAD);
			return;
		}
	}

	// No need to refresh if user has clicked away from preview page
	if (!m_isOnPreview) return;

	// Check if document has changed
	if (m_pinnedEditor) {
		if (((m_pinnedEditor == m_editorCtrl || m_editorCtrl->GetName().EndsWith(wxT(".css")))
			&& m_editorCtrl->GetChangeToken() != m_editorChangeToken)
			|| m_editorCtrl->IsSavedForPreview() ) {

			UpdateBrowser(cxUPDATE_REFRESH);
		}
	}
	else if (m_editorCtrl->GetChangeToken() != m_editorChangeToken) {
		UpdateBrowser(cxUPDATE_REFRESH);
	}
}
Esempio n. 2
0
void PreviewDlg::OnButtonReload(wxCommandEvent& WXUNUSED(event)) {
	if (m_pipeCheck->GetValue()) {
		m_pipeCmd = m_cmdText->GetValue();
	}
	else m_pipeCmd.clear();

	UpdateBrowser(cxUPDATE_RELOAD);
}
Esempio n. 3
0
void PreviewDlg::OnPipeCmdEnter(wxCommandEvent& WXUNUSED(event)) {
	if (m_pipeCheck->IsChecked()) {
		m_pipeCmd = m_cmdText->GetValue();
	}
	else m_pipeCmd.clear();

	UpdateBrowser(cxUPDATE_REFRESH);
}
Esempio n. 4
0
void PreviewDlg::OnDoPipe(wxCommandEvent& event) {
	if (event.IsChecked()) {
		m_pipeCmd = m_cmdText->GetValue();
	}
	else m_pipeCmd.clear();

	UpdateBrowser(cxUPDATE_REFRESH);
}
Esempio n. 5
0
void BrowserSource::UpdateSettings(obs_data_t *settings)
{
	isLocalFile = obs_data_get_bool(settings, "is_local_file");
	url = obs_data_get_string(settings, isLocalFile ? "local_file" : "url");
	css = obs_data_get_string(settings, "css");
	width = (uint32_t)obs_data_get_int(settings, "width");
	height = (uint32_t)obs_data_get_int(settings, "height");
	fps = (uint32_t)obs_data_get_int(settings, "fps");
	shutdown = obs_data_get_bool(settings, "shutdown");

	UpdateBrowser();
}
Esempio n. 6
0
void PreviewDlg::OnLocationEnter(wxCommandEvent& WXUNUSED(event)) {
	const wxString location = m_locationText->GetValue();
	if (location.empty()) return;

	if (location == m_uncPath) {
		UpdateBrowser(cxUPDATE_RELOAD);
	}
	else {
#ifdef FEAT_BROWSER
		m_browser->LoadUrl(location, wxEmptyString, true);
#endif
	}
}
Esempio n. 7
0
void PreviewDlg::OnButtonPin(wxCommandEvent& WXUNUSED(event)) {
	if (m_pinnedEditor) {
		m_pinnedEditor = NULL;
		m_pinButton->SetBitmapLabel(wxBitmap(pin1_xpm));
		m_pinButton->SetBitmapHover(wxBitmap(pin1_over_xpm));

		// Remove temp preview files
		if (!m_tempCssPath.empty() && wxFileExists(m_tempCssPath)) {
			wxRemoveFile(m_tempCssPath);
			m_tempCssPath.clear();
		}

		UpdateBrowser(cxUPDATE_REFRESH);
	}
	else {
		m_pinnedEditor = m_parent.GetEditorCtrl();
		m_pinButton->SetBitmapLabel(wxBitmap(pin2_xpm));
		m_pinButton->SetBitmapHover(wxBitmap(pin2_over_xpm));
	}
}