Skip to content

Commit

Permalink
[ENHANCE] 1. Put the focus on edit zone after insertion from ASCII pa…
Browse files Browse the repository at this point in the history
…nel and clipboard history panel.

2. Make clipboard inspection implementation conform to win32 standard.

- Notepad-plus svn trunk @ 770
  • Loading branch information
donho committed Jun 4, 2011
1 parent f25f25f commit 3033a9f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,5 @@ void AnsiCharPanel::insertChar(unsigned char char2insert) const
(*_ppEditView)->execute(SCI_REPLACESEL, 0, (LPARAM)"");
int len = (char2insert < 128)?1:strlen(multiByteStr);
(*_ppEditView)->execute(SCI_ADDTEXT, len, (LPARAM)multiByteStr);
(*_ppEditView)->getFocus();
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "ScintillaEditView.h"
#include "clipboardFormats.h"

/*
void ClipboardHistoryPanel::switchEncoding()
{
//int codepage = (*_ppEditView)->getCurrentBuffer()->getEncoding();
}
*/

ClipboardData ClipboardHistoryPanel::getClipboadData()
{
Expand Down Expand Up @@ -173,15 +175,25 @@ BOOL CALLBACK ClipboardHistoryPanel::run_dlgProc(UINT message, WPARAM wParam, LP
{
case WM_INITDIALOG :
{
::SetClipboardViewer(_hSelf);
return TRUE;
_hwndNextCbViewer = ::SetClipboardViewer(_hSelf);
break;
}

case WM_CHANGECBCHAIN:
if (_hwndNextCbViewer == (HWND)wParam)
_hwndNextCbViewer = (HWND)lParam;
else if (_hwndNextCbViewer)
::SendMessage(_hwndNextCbViewer, message, wParam, lParam);
break;

case WM_DRAWCLIPBOARD :
{
//::MessageBoxA(NULL, "Catch u", "", MB_OK);
ClipboardData clipboardData = getClipboadData();
addToClipboadHistory(clipboardData);
return TRUE;
if (_hwndNextCbViewer)
::SendMessage(_hwndNextCbViewer, message, wParam, lParam);
break;
}

case WM_COMMAND :
Expand Down Expand Up @@ -213,7 +225,7 @@ BOOL CALLBACK ClipboardHistoryPanel::run_dlgProc(UINT message, WPARAM wParam, LP

(*_ppEditView)->execute(SCI_REPLACESEL, 0, (LPARAM)"");
(*_ppEditView)->execute(SCI_ADDTEXT, strlen(c), (LPARAM)c);

(*_ppEditView)->getFocus();
delete [] c;
}
}
Expand Down Expand Up @@ -242,6 +254,10 @@ BOOL CALLBACK ClipboardHistoryPanel::run_dlgProc(UINT message, WPARAM wParam, LP
break;
}
*/
case WM_DESTROY:
::ChangeClipboardChain(_hSelf, _hwndNextCbViewer);
break;

default :
return DockingDlgInterface::run_dlgProc(message, wParam, lParam);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class StringArray : public ByteArray {

class ClipboardHistoryPanel : public DockingDlgInterface {
public:
ClipboardHistoryPanel(): DockingDlgInterface(IDD_CLIPBOARDHISTORY_PANEL) {};
ClipboardHistoryPanel(): DockingDlgInterface(IDD_CLIPBOARDHISTORY_PANEL), _ppEditView(NULL), _hwndNextCbViewer(NULL) {};

void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView) {
DockingDlgInterface::init(hInst, hPere);
Expand All @@ -72,7 +72,7 @@ class ClipboardHistoryPanel : public DockingDlgInterface {
_hParent = parent2set;
};

void switchEncoding();
//void switchEncoding();
ClipboardData getClipboadData();
void addToClipboadHistory(ClipboardData cbd);
int getClipboardDataIndex(ClipboardData cbd);
Expand All @@ -83,5 +83,6 @@ class ClipboardHistoryPanel : public DockingDlgInterface {
private:
ScintillaEditView **_ppEditView;
std::vector<ClipboardData> _clipboardDataVector;
HWND _hwndNextCbViewer;
};
#endif // CLIPBOARDHISTORYPANEL_H
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class VerticalFileSwitcher : public DockingDlgInterface {
_hParent = parent2set;
};

//Activate document in scintilla by using the internal index
void activateDoc(int i) const;

protected:
Expand Down

0 comments on commit 3033a9f

Please sign in to comment.