Skip to content

Commit c0fdaa1

Browse files
Added drag and drop
1 parent 6de328b commit c0fdaa1

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

RegexAssistant/RegexAssistant.rc

80 Bytes
Binary file not shown.

RegexAssistant/RegexAssistantDlg.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ BEGIN_MESSAGE_MAP( CRegexAssistantDlg, CDialog )
241241
ON_BN_CLICKED( IDC_STATIC_GROUPBOX_TEST_TARGET_TEXT, &CRegexAssistantDlg::OnBnClickedStaticGroupboxTestTargetText )
242242
ON_BN_CLICKED( IDC_RESET_SAMPLE, &CRegexAssistantDlg::OnBnClickedResetSample )
243243
ON_BN_CLICKED( IDC_UNDO_EXPRESSION_CHANGE, &CRegexAssistantDlg::OnBnClickedUndoExpressionChange )
244+
ON_WM_DROPFILES()
244245
END_MESSAGE_MAP()
245246

246247
void CRegexAssistantDlg::OnSysCommand( UINT nID, LPARAM lParam )
@@ -1091,3 +1092,30 @@ void CRegexAssistantDlg::OnBnClickedUndoExpressionChange()
10911092
}
10921093
m_UndoExpressionChange_btn.EnableWindow( m_RegexStatementChangesToUndo.empty() ? FALSE : TRUE );
10931094
}
1095+
1096+
1097+
void CRegexAssistantDlg::OnDropFiles( HDROP hDropInfo )
1098+
{
1099+
wchar_t FileName[256] = {0};
1100+
DragQueryFile( hDropInfo, 0, FileName, sizeof( FileName ) );
1101+
1102+
CStdioFile file;
1103+
1104+
if ( file.Open( FileName, CFile::modeRead | CFile::typeText | CFile::shareDenyNone ) )
1105+
{
1106+
m_SampleText = _T( "" );
1107+
CString Line;
1108+
while ( file.ReadString( Line ) )
1109+
m_SampleText += Line + _T("\n");
1110+
if ( m_SampleText.GetLength() > 0 )
1111+
{
1112+
string strText = FXString::ToString( m_SampleText.operator LPCWSTR() );
1113+
m_ScintillaWrapper.SendEditor( SCI_CLEARALL );
1114+
m_ScintillaWrapper.SendEditor( SCI_APPENDTEXT, strText.length(), reinterpret_cast<sptr_t>(strText.c_str()) );
1115+
}
1116+
file.Close();
1117+
}
1118+
1119+
1120+
CDialog::OnDropFiles( hDropInfo );
1121+
}

RegexAssistant/RegexAssistantDlg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,5 @@ class CRegexAssistantDlg : public CDialog
146146
inline virtual void OnOK() {};
147147
inline virtual void OnCancel() { OnClose(); };
148148
CStatic m_SampleText_Label_static;
149+
afx_msg void OnDropFiles( HDROP hDropInfo );
149150
};

0 commit comments

Comments
 (0)