[ENHANCE] 1. Put the focus on edit zone after insertion from ASCII panel and clipboard history panel.

2. Make clipboard inspection implementation conform to win32 standard.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@770 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2011-06-04 12:57:58 +00:00
parent 7b4be22351
commit 903788f9bd
4 changed files with 26 additions and 7 deletions

View File

@ -127,4 +127,5 @@ void AnsiCharPanel::insertChar(unsigned char char2insert) const
(*_ppEditView)->execute(SCI_REPLACESEL, 0, (LPARAM)""); (*_ppEditView)->execute(SCI_REPLACESEL, 0, (LPARAM)"");
int len = (char2insert < 128)?1:strlen(multiByteStr); int len = (char2insert < 128)?1:strlen(multiByteStr);
(*_ppEditView)->execute(SCI_ADDTEXT, len, (LPARAM)multiByteStr); (*_ppEditView)->execute(SCI_ADDTEXT, len, (LPARAM)multiByteStr);
(*_ppEditView)->getFocus();
} }

View File

@ -22,10 +22,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "ScintillaEditView.h" #include "ScintillaEditView.h"
#include "clipboardFormats.h" #include "clipboardFormats.h"
/*
void ClipboardHistoryPanel::switchEncoding() void ClipboardHistoryPanel::switchEncoding()
{ {
//int codepage = (*_ppEditView)->getCurrentBuffer()->getEncoding(); //int codepage = (*_ppEditView)->getCurrentBuffer()->getEncoding();
} }
*/
ClipboardData ClipboardHistoryPanel::getClipboadData() ClipboardData ClipboardHistoryPanel::getClipboadData()
{ {
@ -173,15 +175,25 @@ BOOL CALLBACK ClipboardHistoryPanel::run_dlgProc(UINT message, WPARAM wParam, LP
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
{ {
::SetClipboardViewer(_hSelf); _hwndNextCbViewer = ::SetClipboardViewer(_hSelf);
return TRUE; break;
} }
case WM_CHANGECBCHAIN:
if (_hwndNextCbViewer == (HWND)wParam)
_hwndNextCbViewer = (HWND)lParam;
else if (_hwndNextCbViewer)
::SendMessage(_hwndNextCbViewer, message, wParam, lParam);
break;
case WM_DRAWCLIPBOARD : case WM_DRAWCLIPBOARD :
{ {
//::MessageBoxA(NULL, "Catch u", "", MB_OK); //::MessageBoxA(NULL, "Catch u", "", MB_OK);
ClipboardData clipboardData = getClipboadData(); ClipboardData clipboardData = getClipboadData();
addToClipboadHistory(clipboardData); addToClipboadHistory(clipboardData);
return TRUE; if (_hwndNextCbViewer)
::SendMessage(_hwndNextCbViewer, message, wParam, lParam);
break;
} }
case WM_COMMAND : case WM_COMMAND :
@ -213,7 +225,7 @@ BOOL CALLBACK ClipboardHistoryPanel::run_dlgProc(UINT message, WPARAM wParam, LP
(*_ppEditView)->execute(SCI_REPLACESEL, 0, (LPARAM)""); (*_ppEditView)->execute(SCI_REPLACESEL, 0, (LPARAM)"");
(*_ppEditView)->execute(SCI_ADDTEXT, strlen(c), (LPARAM)c); (*_ppEditView)->execute(SCI_ADDTEXT, strlen(c), (LPARAM)c);
(*_ppEditView)->getFocus();
delete [] c; delete [] c;
} }
} }
@ -242,6 +254,10 @@ BOOL CALLBACK ClipboardHistoryPanel::run_dlgProc(UINT message, WPARAM wParam, LP
break; break;
} }
*/ */
case WM_DESTROY:
::ChangeClipboardChain(_hSelf, _hwndNextCbViewer);
break;
default : default :
return DockingDlgInterface::run_dlgProc(message, wParam, lParam); return DockingDlgInterface::run_dlgProc(message, wParam, lParam);
} }

View File

@ -57,7 +57,7 @@ public:
class ClipboardHistoryPanel : public DockingDlgInterface { class ClipboardHistoryPanel : public DockingDlgInterface {
public: public:
ClipboardHistoryPanel(): DockingDlgInterface(IDD_CLIPBOARDHISTORY_PANEL) {}; ClipboardHistoryPanel(): DockingDlgInterface(IDD_CLIPBOARDHISTORY_PANEL), _ppEditView(NULL), _hwndNextCbViewer(NULL) {};
void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView) { void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView) {
DockingDlgInterface::init(hInst, hPere); DockingDlgInterface::init(hInst, hPere);
@ -72,7 +72,7 @@ public:
_hParent = parent2set; _hParent = parent2set;
}; };
void switchEncoding(); //void switchEncoding();
ClipboardData getClipboadData(); ClipboardData getClipboadData();
void addToClipboadHistory(ClipboardData cbd); void addToClipboadHistory(ClipboardData cbd);
int getClipboardDataIndex(ClipboardData cbd); int getClipboardDataIndex(ClipboardData cbd);
@ -83,5 +83,6 @@ protected:
private: private:
ScintillaEditView **_ppEditView; ScintillaEditView **_ppEditView;
std::vector<ClipboardData> _clipboardDataVector; std::vector<ClipboardData> _clipboardDataVector;
HWND _hwndNextCbViewer;
}; };
#endif // CLIPBOARDHISTORYPANEL_H #endif // CLIPBOARDHISTORYPANEL_H

View File

@ -44,7 +44,8 @@ public:
void setParent(HWND parent2set){ void setParent(HWND parent2set){
_hParent = parent2set; _hParent = parent2set;
}; };
//Activate document in scintilla by using the internal index
void activateDoc(int i) const; void activateDoc(int i) const;
protected: protected: