/// <summary> /// A new skin is selected for this note. /// </summary> /// <param name="sender">Sender object</param> /// <param name="e">Event arguments</param> private void menuNoteSkins_skin_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; foreach (ToolStripMenuItem curtsi in this.menuNoteSkins.DropDownItems) { curtsi.Checked = false; } ToolStripMenuItem tsi = null; try { tsi = (ToolStripMenuItem)sender; } catch (InvalidCastException invcastexc) { Log.Write(LogType.exception, invcastexc.Message); return; } tsi.Checked = true; this.note.SkinNr = this.notes.GetSkinNr(tsi.Text); this.BackColor = this.notes.GetPrimaryClr(this.note.SkinNr); if (this.notes.GetPrimaryTexture(this.note.SkinNr) != null) { this.BackgroundImageLayout = this.notes.GetPrimaryTextureLayout(this.note.SkinNr); this.BackgroundImage = this.notes.GetPrimaryTexture(this.note.SkinNr); } else { this.BackgroundImage = null; } this.pnlHead.BackColor = Color.Transparent; this.rtbNote.BackColor = this.notes.GetPrimaryClr(this.note.SkinNr); this.lblNoteTitle.ForeColor = this.notes.GetTextClr(this.note.SkinNr); Program.Formmanager.FrmManageNotesNeedUpdate = true; Program.Formmanager.RefreshFrmManageNotes(); if (!SyntaxHighlight.KeywordsInitialized) { SyntaxHighlight.InitHighlighter(); } SyntaxHighlight.CheckSyntaxFull(this.rtbNote, this.note.SkinNr, this.notes); if (Settings.HighlightClearLexiconMemory) { SyntaxHighlight.DeinitHighlighter(); } if (!this.saveWorker.IsBusy) { this.saveWorker.RunWorkerAsync(this.rtbNote.Rtf); } Cursor.Current = Cursors.Default; Log.Write(LogType.info, "Note " + this.note.Filename + " skin changed to " + this.notes.GetSkinName(this.note.SkinNr)); }
/// <summary> /// Pasting text as note content. /// </summary> /// <param name="sender">Sender object</param> /// <param name="e">Event arguments</param> private void pastTextToolStripMenuItem_Click(object sender, EventArgs e) { if (Clipboard.ContainsText()) { this.rtbNewNote.Text = this.rtbNewNote.Text + Clipboard.GetText(); if (SyntaxHighlight.KeywordsInitialized) { SyntaxHighlight.InitHighlighter(); } SyntaxHighlight.CheckSyntaxFull(this.rtbNewNote, this.GetSkinnr(), this.notes); } else { string newnote_emptyclipboard = Strings.T("There is no text on the clipboard."); MessageBox.Show(newnote_emptyclipboard); Log.Write(LogType.error, newnote_emptyclipboard); } }
/// <summary> /// Key is released in rtbNewNote /// </summary> /// <param name="sender">Sender object</param> /// <param name="e">Key event arguments</param> private void rtbNewNote_KeyUp(object sender, KeyEventArgs e) { if (!SyntaxHighlight.KeywordsInitialized) { SyntaxHighlight.InitHighlighter(); } int pos = this.rtbNewNote.SelectionStart; if (e.KeyCode == Keys.Space || e.KeyCode == Keys.Enter || e.KeyValue == 190) { SyntaxHighlight.CheckSyntaxQuick(this.rtbNewNote, this.GetSkinnr(), this.notes); } else if (e.Control && e.KeyCode == Keys.V) { SyntaxHighlight.CheckSyntaxFull(this.rtbNewNote, this.GetSkinnr(), this.notes); } this.rtbNewNote.SelectionStart = pos; }
/// <summary> /// Set some application wide note settings on this note (fonts, transparency, detect hyperlinks etc.) and /// do full syntax check on the note content again. /// </summary> /// <param name="contentset">Boolean if the note rtf content already set.</param> public void UpdateForm(bool contentset) { if (!contentset) { this.BackColor = this.notes.GetPrimaryClr(this.note.SkinNr); if (this.notes.GetPrimaryTexture(this.note.SkinNr) != null) { this.BackgroundImageLayout = this.notes.GetPrimaryTextureLayout(this.note.SkinNr); this.BackgroundImage = this.notes.GetPrimaryTexture(this.note.SkinNr); } else { this.BackgroundImage = null; } this.pnlHead.BackColor = Color.Transparent; if (!Settings.NotesTransparencyEnabled) { this.Opacity = 1.0; } this.lblNoteTitle.ForeColor = this.notes.GetTextClr(this.note.SkinNr); if (Settings.FontTitleStylebold) { this.lblNoteTitle.Font = new Font(Settings.FontTitleFamily, Settings.FontTitleSize, FontStyle.Bold); } else { if (Settings.FontTitleSize < 6) { Settings.FontTitleSize = 6; } this.lblNoteTitle.Font = new Font(Settings.FontTitleFamily, Settings.FontTitleSize, FontStyle.Regular); } this.lblNoteTitle.RightToLeft = (RightToLeft)Settings.FontTextdirection; this.RightToLeft = (RightToLeft)Settings.FontTextdirection; this.rtbNote.RightToLeft = (RightToLeft)Settings.FontTextdirection; this.menuSendToEmail.Enabled = Settings.SharingEmailEnabled; } else { if (this.lblNoteTitle.Height + this.lblNoteTitle.Location.Y >= this.pnlHead.Height) { if (this.lblNoteTitle.Height < Settings.NotesTitlepanelMaxHeight) { this.pnlHead.Height = this.lblNoteTitle.Height; } else { this.pnlHead.Height = Settings.NotesTitlepanelMaxHeight; } } else { this.pnlHead.Height = Settings.NotesTitlepanelMinHeight; } if (Program.CurrentOS == Program.OS.WINDOWS) { this.pnlNote.Location = new Point(0, this.pnlHead.Height - 1); this.pnlNote.Size = new Size(this.Width, this.Height - this.pnlHead.Height + 1); } else if (Program.CurrentOS == Program.OS.LINUX) { this.pnlNote.Location = new Point(0, this.pnlHead.Height - 1); this.pnlNote.Size = new Size(this.Width - 6, this.Height - this.pnlHead.Height - 5); } this.rtbNote.DetectUrls = Settings.HighlightHyperlinks; if (!SyntaxHighlight.KeywordsInitialized) { SyntaxHighlight.InitHighlighter(); } this.SetFormTooltips(); this.CreateSkinsMenu(true); SyntaxHighlight.CheckSyntaxFull(this.rtbNote, this.note.SkinNr, this.notes); } }