Commit f8f366cc authored by Olivier Teulière's avatar Olivier Teulière

* Fixed the "RichEdit line insertion error" bug (closes #246)

 * Added a popup menu to copy log messages to the clipboard
parent c5968aaa
...@@ -102,7 +102,12 @@ void __fastcall TMessagesDlg::UpdateLog() ...@@ -102,7 +102,12 @@ void __fastcall TMessagesDlg::UpdateLog()
/* Add message */ /* Add message */
if( i_max_lines ) if( i_max_lines )
{ {
RichEditMessages->Lines->Add( p_sub->p_msg[i_start].psz_msg ); /* We don't use RichEditMessages->Lines->Add(), because with
* some versions of rich32.dll it can trigger the
* "RichEdit line insertion error" bug... */
RichEditMessages->SelStart = RichEditMessages->GetTextLen();
RichEditMessages->SelText = p_sub->p_msg[i_start].psz_msg;
RichEditMessages->SelText = RichEditMessages->SelText + "\r\n";
} }
} }
...@@ -112,3 +117,18 @@ void __fastcall TMessagesDlg::UpdateLog() ...@@ -112,3 +117,18 @@ void __fastcall TMessagesDlg::UpdateLog()
} }
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void __fastcall TMessagesDlg::PopupCopyTextClick( TObject *Sender )
{
/* If nothinf is selected, select everything */
if( RichEditMessages->SelLength == 0 )
{
RichEditMessages->SelStart = 0;
RichEditMessages->SelLength = RichEditMessages->GetTextLen();
}
/* Copy selected text to clipboard */
RichEditMessages->CopyToClipboard();
}
//---------------------------------------------------------------------------
...@@ -29,6 +29,7 @@ object MessagesDlg: TMessagesDlg ...@@ -29,6 +29,7 @@ object MessagesDlg: TMessagesDlg
Font.Name = 'MS Sans Serif' Font.Name = 'MS Sans Serif'
Font.Style = [] Font.Style = []
ParentFont = False ParentFont = False
PopupMenu = PopupMenu1
ReadOnly = True ReadOnly = True
ScrollBars = ssBoth ScrollBars = ssBoth
TabOrder = 0 TabOrder = 0
...@@ -47,4 +48,13 @@ object MessagesDlg: TMessagesDlg ...@@ -47,4 +48,13 @@ object MessagesDlg: TMessagesDlg
TabOrder = 1 TabOrder = 1
OnClick = ButtonOKClick OnClick = ButtonOKClick
end end
object PopupMenu1: TPopupMenu
Left = 304
Top = 432
object PopupCopyText: TMenuItem
Caption = '&Copy text'
ShortCut = 16451
OnClick = PopupCopyTextClick
end
end
end end
...@@ -35,9 +35,12 @@ class TMessagesDlg : public TForm ...@@ -35,9 +35,12 @@ class TMessagesDlg : public TForm
__published: // IDE-managed Components __published: // IDE-managed Components
TRichEdit *RichEditMessages; TRichEdit *RichEditMessages;
TButton *ButtonOK; TButton *ButtonOK;
TPopupMenu *PopupMenu1;
TMenuItem *PopupCopyText;
void __fastcall ButtonOKClick( TObject *Sender ); void __fastcall ButtonOKClick( TObject *Sender );
void __fastcall FormHide( TObject *Sender ); void __fastcall FormHide( TObject *Sender );
void __fastcall FormShow( TObject *Sender ); void __fastcall FormShow( TObject *Sender );
void __fastcall PopupCopyTextClick( TObject *Sender );
private: // User declarations private: // User declarations
intf_thread_t *p_intf; intf_thread_t *p_intf;
public: // User declarations public: // User declarations
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment