This commit is contained in:
parent
c0b7498edb
commit
b73faaea11
@ -39,13 +39,13 @@ namespace Volian.Controls.Library
|
||||
get { if (_MyClassName == string.Empty)_MyClassName = CreateParams.ClassName; return _MyClassName; }
|
||||
set { _MyClassName = value; }
|
||||
}
|
||||
private E_EditPrintMode _epMode = E_EditPrintMode.EDIT;
|
||||
private E_EditPrintMode _epMode = E_EditPrintMode.Edit;
|
||||
public E_EditPrintMode EpMode
|
||||
{
|
||||
get { return _epMode; }
|
||||
set { _epMode = value; }
|
||||
}
|
||||
private E_ViewMode _vwMode = E_ViewMode.EDIT;
|
||||
private E_ViewMode _vwMode = E_ViewMode.Edit;
|
||||
public E_ViewMode VwMode
|
||||
{
|
||||
get { return _vwMode; }
|
||||
@ -62,9 +62,9 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
DisplayText vlntxt = new DisplayText(_MyItem, EpMode, VwMode);
|
||||
_origVlnText = vlntxt;
|
||||
// TODO: RHM20071115 this.Font = _origVlnText.TextFont.WindowsFont;
|
||||
Font = _origVlnText.TextFont.WindowsFont;
|
||||
AddRtfText(vlntxt);
|
||||
ReadOnly = !(EpMode == E_EditPrintMode.EDIT && VwMode == E_ViewMode.EDIT);
|
||||
ReadOnly = !(EpMode == E_EditPrintMode.Edit && VwMode == E_ViewMode.Edit);
|
||||
RTBAPI.SetLineSpacing(this, RTBAPI.ParaSpacing.PFS_EXACT);
|
||||
}
|
||||
}
|
||||
@ -168,7 +168,7 @@ namespace Volian.Controls.Library
|
||||
ContentsResized += new ContentsResizedEventHandler(vlnRichTextBox_ContentsResized);
|
||||
AddRtfText(vlntxt);
|
||||
//ContextMenuStrip = contextMenuStrip;
|
||||
ReadOnly = !(epMode == E_EditPrintMode.EDIT && vwMode == E_ViewMode.EDIT);
|
||||
ReadOnly = !(epMode == E_EditPrintMode.Edit && vwMode == E_ViewMode.Edit);
|
||||
RTBAPI.SetLineSpacing(this, RTBAPI.ParaSpacing.PFS_EXACT);
|
||||
this.LinkClicked += new LinkClickedEventHandler(onLinkClicked);
|
||||
this.KeyPress += new KeyPressEventHandler(onKeyPress);
|
||||
@ -210,8 +210,8 @@ namespace Volian.Controls.Library
|
||||
ItemInfo tmp = MyItem;
|
||||
MyItem = null;
|
||||
ReadOnly = !ReadOnly;
|
||||
EpMode = ReadOnly?E_EditPrintMode.PRINT:E_EditPrintMode.EDIT;
|
||||
VwMode = ReadOnly?E_ViewMode.VIEW:E_ViewMode.EDIT;
|
||||
EpMode = ReadOnly ? E_EditPrintMode.Print : E_EditPrintMode.Edit;
|
||||
VwMode = ReadOnly ? E_ViewMode.View : E_ViewMode.Edit;
|
||||
Clear();
|
||||
MyItem = tmp;
|
||||
}
|
||||
@ -231,7 +231,7 @@ namespace Volian.Controls.Library
|
||||
#region SaveData
|
||||
public void Save()
|
||||
{
|
||||
// TODO: RHM20071115 bool success = _origVlnText.Save((RichTextBox) this);
|
||||
bool success = _origVlnText.Save((RichTextBox) this);
|
||||
}
|
||||
#endregion
|
||||
#region AddRtfText
|
||||
@ -285,10 +285,10 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
this.DetectUrls = false;
|
||||
RTBAPI.CharFormatTwo charFormat = RTBAPI.GetCharFormat(this, RTBAPI.RTBSelection.SCF_SELECTION);
|
||||
int position = SelectionStart = this.TextLength;
|
||||
int position = SelectionStart; // before inserttran = this.TextLength;
|
||||
SelectionLength = 0;
|
||||
SelectedRtf = @"{\rtf1\ansi " + linkValue + @"\v " + linkUrl + @"\v0}";
|
||||
Select(position, linkValue.Length + linkUrl.Length + 1);
|
||||
Select(position, linkValue.Length + linkUrl.Length);
|
||||
// Protect the link text to avoid manual changes
|
||||
charFormat.dwMask = RTBAPI.CharFormatMasks.CFM_LINK | RTBAPI.CharFormatMasks.CFM_PROTECTED;
|
||||
charFormat.dwEffects = RTBAPI.CharFormatEffects.CFE_LINK | RTBAPI.CharFormatEffects.CFE_PROTECTED;
|
||||
@ -299,7 +299,7 @@ namespace Volian.Controls.Library
|
||||
private void AddLink50(string linkValue, string linkUrl)
|
||||
{
|
||||
this.DetectUrls = false;
|
||||
int position = SelectionStart = this.TextLength;
|
||||
int position = SelectionStart; // before inserttran = this.TextLength;
|
||||
SelectionLength = 0;
|
||||
SelectedRtf = string.Format(@"{{\rtf\field{{\*\fldinst{{HYPERLINK ""www.volian.com #{0}"" }}}}{{\fldrslt{{\cf2\ul {1}}}}}}}", linkUrl, linkValue);
|
||||
this.SelectionStart = this.TextLength;
|
||||
@ -371,12 +371,21 @@ namespace Volian.Controls.Library
|
||||
Console.WriteLine("DisplayRTB " + _LinkClickedEventArgs.LinkText);
|
||||
if (LinkGoTo != null) LinkGoTo(sender, args);
|
||||
}
|
||||
public event DisplayRTBLinkEvent LinkModifyTran;
|
||||
private void OnLinkModifyTran(object sender, LinkClickedEventArgs args)
|
||||
{
|
||||
_LinkClickedEventArgs = args;
|
||||
if (LinkModifyTran != null) LinkModifyTran(sender, args);
|
||||
}
|
||||
void DisplayRTB_Leave(object sender, EventArgs e)
|
||||
{
|
||||
// Save returns true if text was not changed or if change was saved successfully.
|
||||
if (ReadOnly) return;
|
||||
// TODO: RHM20071115 bool success = _origVlnText.Save((RichTextBox)this);
|
||||
// TODO: RHM20071115 if (!success) Console.WriteLine("Failed to save text: {0}", this.Text);
|
||||
// if selecting another rtb, save. If selecting the info panel don't because
|
||||
// we're still on a valid item.??
|
||||
|
||||
// RHM?? why commented out. bool success = _origVlnText.Save((RichTextBox)this);
|
||||
// RHM?? why commented out.if (!success) Console.WriteLine("Failed to save text: {0}", this.Text);
|
||||
}
|
||||
private Point _savcurpos;
|
||||
private void onLinkClicked(object sender, System.Windows.Forms.LinkClickedEventArgs e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user