private void OnOpenReportTemplate(object sender, EventArgs e) { var dlg = new OpenFileDialog { //InitialDirectory = LastBrowsedFolder, Title = m_Trans.Translate("Open Report Template"), AutoUpgradeEnabled = true, CheckFileExists = true, CheckPathExists = true, Filter = FileFilter, FilterIndex = 0, RestoreDirectory = true, ShowReadOnly = false }; if (dlg.ShowDialog() == DialogResult.OK) { if (m_Template.Load(dlg.FileName)) { m_TemplateFilePath = dlg.FileName; m_EditedSinceLastSave = false; UpdateCaption(); UpdateControls(); } } }
// -------------------------------------------------------------- public HtmlReportTemplateForm(String typeId, Translator trans, TaskList tasks, Preferences prefs, String key) { m_TypeId = typeId; m_Trans = trans; m_Tasklist = tasks; m_Prefs = prefs; m_PrefsKey = key; m_Template = new HtmlReportTemplate(); m_PrevTemplate = new HtmlReportTemplate(); m_CustomAttributes = new Dictionary <String, String>(); m_EditedSinceLastSave = false; m_TemplateFilePath = prefs.GetProfileString(key, "LastOpenTemplate", ""); if (!m_Template.Load(m_TemplateFilePath)) { m_TemplateFilePath = String.Empty; } else { m_PrevTemplate.Copy(m_Template); } m_ChangeTimer = new Timer(); m_ChangeTimer.Tick += new EventHandler(OnChangeTimer); m_ChangeTimer.Interval = 500; InitializeComponent(); // Build list custom attribute IDs for later use if (tasks.HasCustomAttributes()) { var numAttrib = tasks.GetCustomAttributeCount(); var attribs = new Dictionary <String, String>(); for (var attrib = 0; attrib < numAttrib; attrib++) { m_CustomAttributes.Add(tasks.GetCustomAttributeID(attrib).ToLower(), tasks.GetCustomAttributeLabel(attrib)); } } this.htmlReportTasksControl.SetCustomAttributes(m_CustomAttributes); HtmlEditorControlEx.SizeEditHtmlForm = new Size(prefs.GetProfileInt(key, "HtmlFormWidth", -1), prefs.GetProfileInt(key, "HtmlFormHeight", -1)); var prevSize = new Size(prefs.GetProfileInt(key, "TemplateFormWidth", -1), prefs.GetProfileInt(key, "TemplateFormHeight", -1)); if ((prevSize.Width > 0) && (prevSize.Height > 0)) { this.Size = prevSize; } }
private void InitializeComponentEx() { InitializeComponent(); int bannerHeight = RhinoLicensing.CreateBanner(m_TypeId, this, m_Trans, 0 /*20*/); this.Height = (this.Height + bannerHeight); this.Content.Location = new Point(0, bannerHeight); this.Content.Height = (this.Content.Height - bannerHeight); var defFontName = m_Prefs.GetProfileString("Preferences", "HTMLFont", "Verdana"); var defFontSize = m_Prefs.GetProfileInt("Preferences", "HtmlFontSize", 2); this.htmlReportHeaderControl.SetFont(defFontName, defFontSize); this.htmlReportTitleControl.SetFont(defFontName, defFontSize); this.htmlReportTasksControl.SetFont(defFontName, defFontSize); this.htmlReportFooterControl.SetFont(defFontName, defFontSize); if (!m_Template.Load(m_TemplateFilePath)) { #if DEBUG this.m_Template.Header.Text = "Header"; this.m_Template.Header.BackColor = Color.LightBlue; this.m_Template.Title.Text = "Title"; this.m_Template.Task.Text = "$(Title)"; this.m_Template.Footer.Text = "Footer"; this.m_Template.Footer.BackColor = Color.LightPink; #endif } this.htmlReportHeaderControl.InnerHtml = m_Template.Header.Text; this.htmlReportHeaderControl.BodyBackColor = m_Template.Header.BackColor; this.headerEnabled.Checked = m_Template.Header.Enabled; this.headerDivider.Checked = m_Template.Header.WantDivider; this.htmlReportTitleControl.InnerHtml = m_Template.Title.Text; this.titleEnabled.Checked = m_Template.Title.Enabled; this.htmlReportTasksControl.InnerHtml = m_Template.Task.Text; // always enabled this.htmlReportFooterControl.InnerHtml = m_Template.Footer.Text; this.htmlReportFooterControl.BodyBackColor = m_Template.Footer.BackColor; this.footerEnabled.Checked = m_Template.Footer.Enabled; this.footerDivider.Checked = m_Template.Footer.WantDivider; // this.tabControl.SelectTab(headerPage); RefreshPreview(); }
private Size LoadPreferences() { // Last template m_TemplateFilePath = m_Prefs.GetProfileString(m_PrefsKey, "LastOpenTemplate", ""); if (!m_Template.Load(m_TemplateFilePath)) { m_TemplateFilePath = String.Empty; } else { m_PrevTemplate.Copy(m_Template); } // Template history int numHistory = m_Prefs.GetProfileInt(m_PrefsKey, "TemplateHistoryCount", 0); for (int nItem = 0; nItem < numHistory; nItem++) { string path = m_Prefs.GetProfileString(m_PrefsKey, string.Format("History{0}", nItem), ""); if (!string.IsNullOrEmpty(path) && (path != m_TemplateFilePath)) { toolStripFileHistory.Items.Add(new TemplateHistoryItem(path)); } } AddFileToTopOfHistory(m_TemplateFilePath); // Window sizes HtmlEditorControlEx.SizeEditHtmlForm = new Size(m_Prefs.GetProfileInt(m_PrefsKey, "HtmlFormWidth", -1), m_Prefs.GetProfileInt(m_PrefsKey, "HtmlFormHeight", -1)); var prevSize = new Size(m_Prefs.GetProfileInt(m_PrefsKey, "TemplateFormWidth", -1), m_Prefs.GetProfileInt(m_PrefsKey, "TemplateFormHeight", -1)); return(prevSize); }
// -------------------------------------------------------------- public HtmlReportTemplateForm(String typeId, Translator trans, TaskList tasks, Preferences prefs, String key) { m_TypeId = typeId; m_Trans = trans; m_Tasklist = tasks; m_Prefs = prefs; m_PrefsKey = key; m_Template = new HtmlReportTemplate(); m_PrevTemplate = new HtmlReportTemplate(); m_TemplateFilePath = prefs.GetProfileString(key, "LastOpenTemplate", ""); if (!m_Template.Load(m_TemplateFilePath)) { m_TemplateFilePath = String.Empty; } m_ChangeTimer = new Timer(); m_ChangeTimer.Tick += new EventHandler(OnChangeTimer); m_ChangeTimer.Interval = 500; InitializeComponent(); }