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