Skip to content

Commit

Permalink
Add middle button copy and paste
Browse files Browse the repository at this point in the history
  • Loading branch information
RadAd committed Feb 1, 2023
1 parent 74bb918 commit 34beecb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
8 changes: 4 additions & 4 deletions RadNotepad.rc
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,0,0
PRODUCTVERSION 1,3,0,0
FILEVERSION 1,3,1,0
PRODUCTVERSION 1,3,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -497,12 +497,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "RadSoft"
VALUE "FileDescription", "Rad Notepad"
VALUE "FileVersion", "1.3.0.0"
VALUE "FileVersion", "1.3.1.0"
VALUE "InternalName", "RadNotepad.exe"
VALUE "LegalCopyright", "Copyright � 2018"
VALUE "OriginalFilename", "RadNotepad.exe"
VALUE "ProductName", "Rad Notepad"
VALUE "ProductVersion", "1.3.0.0"
VALUE "ProductVersion", "1.3.1.0"
END
END
BLOCK "VarFileInfo"
Expand Down
29 changes: 22 additions & 7 deletions src/RadNotepadView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,23 @@ namespace
}
};

class CRadScintillaCtrl : public Scintilla::CScintillaCtrl
{
protected:
DECLARE_MESSAGE_MAP()

void OnMButtonUp(UINT /* nFlags */, CPoint /*point*/)
{
if (GetSelectionEmpty())
Paste();
else
Copy();
}
};

BEGIN_MESSAGE_MAP(CRadScintillaCtrl, CScintillaCtrl)
ON_WM_MBUTTONUP()
END_MESSAGE_MAP()

// CRadNotepadView

Expand All @@ -58,7 +75,6 @@ BEGIN_MESSAGE_MAP(CRadNotepadView, CScintillaView)
// Standard printing commands
ON_WM_CREATE()
ON_WM_CONTEXTMENU()
ON_WM_RBUTTONUP()
ON_UPDATE_COMMAND_UI(ID_INDICATOR_LINE, &CRadNotepadView::OnUpdateLine)
ON_UPDATE_COMMAND_UI(ID_INDICATOR_SCHEME, &CRadNotepadView::OnUpdateSchemeIndicator)
ON_UPDATE_COMMAND_UI(ID_INDICATOR_LINE_ENDING, &CRadNotepadView::OnUpdateLineEndingIndicator)
Expand Down Expand Up @@ -209,12 +225,6 @@ void CRadNotepadView::OnFilePrintPreview()
#endif
}

void CRadNotepadView::OnRButtonUp(UINT /* nFlags */, CPoint point)
{
ClientToScreen(&point);
OnContextMenu(this, point);
}

void CRadNotepadView::OnContextMenu(CWnd* /* pWnd */, CPoint point)
{
#ifndef SHARED_HANDLERS
Expand Down Expand Up @@ -400,6 +410,11 @@ void CRadNotepadView::OnInitialUpdate()
#endif
}

std::unique_ptr<Scintilla::CScintillaCtrl> CRadNotepadView::CreateScintillaControl()
{
return std::make_unique<CRadScintillaCtrl>();
}

void CRadNotepadView::OnViewMargin(UINT nID)
{
Theme* pTheme = &theApp.m_Settings.user;
Expand Down
2 changes: 1 addition & 1 deletion src/RadNotepadView.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class CRadNotepadView : public Scintilla::CScintillaView
// Overrides
public:
virtual void OnInitialUpdate() override;
virtual std::unique_ptr<Scintilla::CScintillaCtrl> CreateScintillaControl() override;
virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView) override;
virtual void OnUpdate(CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/) override;

Expand Down Expand Up @@ -50,7 +51,6 @@ class CRadNotepadView : public Scintilla::CScintillaView
protected:
DECLARE_MESSAGE_MAP()
afx_msg void OnFilePrintPreview();
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
afx_msg void OnUpdateLine(CCmdUI* pCmdUI);
afx_msg void OnUpdateSchemeIndicator(CCmdUI* pCmdUI);
Expand Down

0 comments on commit 34beecb

Please sign in to comment.