[BUG_FIXED] Fix color picker' chooser does not work well.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1268 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2014-07-29 13:08:32 +00:00
parent 9418974c87
commit 5d0858d5c7
3 changed files with 11 additions and 5 deletions

View File

@ -130,6 +130,7 @@ LRESULT ColourPicker::runProc(UINT Message, WPARAM wParam, LPARAM lParam)
} }
else else
{ {
_pColourPopup->setColour(_currentColour);
_pColourPopup->doDialog(p); _pColourPopup->doDialog(p);
_pColourPopup->display(true); _pColourPopup->display(true);
} }

View File

@ -181,7 +181,7 @@ BOOL CALLBACK ColourPopup::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara
{ {
case IDOK : case IDOK :
{ {
isColourChooserLaunched = true; //isColourChooserLaunched = true;
CHOOSECOLOR cc; // common dialog box structure CHOOSECOLOR cc; // common dialog box structure
static COLORREF acrCustClr[16] = { static COLORREF acrCustClr[16] = {
RGB(0xFF,0xFF,0xFF),RGB(0xFF,0xFF,0xFF),RGB(0xFF,0xFF,0xFF),RGB(0xFF,0xFF,0xFF),\ RGB(0xFF,0xFF,0xFF),RGB(0xFF,0xFF,0xFF),RGB(0xFF,0xFF,0xFF),RGB(0xFF,0xFF,0xFF),\
@ -232,7 +232,7 @@ BOOL CALLBACK ColourPopup::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara
case WM_ACTIVATE : case WM_ACTIVATE :
{ {
if (LOWORD(wParam) == WA_INACTIVE) if (LOWORD(wParam) == WA_INACTIVE)
if (!isColourChooserLaunched) //if (!isColourChooserLaunched)
::SendMessage(_hParent, WM_PICKUP_CANCEL, 0, 0); ::SendMessage(_hParent, WM_PICKUP_CANCEL, 0, 0);
return TRUE; return TRUE;
} }

View File

@ -43,8 +43,8 @@
class ColourPopup : public Window class ColourPopup : public Window
{ {
public : public :
ColourPopup() : Window(), isColourChooserLaunched(false) {}; ColourPopup() : Window()/*, isColourChooserLaunched(false)*/ {};
ColourPopup(COLORREF defaultColor) : Window(), isColourChooserLaunched(false), _colour(defaultColor) {}; ColourPopup(COLORREF defaultColor) : Window(), /* isColourChooserLaunched(false), */ _colour(defaultColor) {};
~ColourPopup(){}; ~ColourPopup(){};
bool isCreated() const { bool isCreated() const {
@ -62,12 +62,17 @@ public :
virtual void destroy() { virtual void destroy() {
::DestroyWindow(_hSelf); ::DestroyWindow(_hSelf);
}; };
void setColour(COLORREF c) {
_colour = c;
};
COLORREF getSelColour(){return _colour;}; COLORREF getSelColour(){return _colour;};
private : private :
RECT _rc; RECT _rc;
COLORREF _colour; COLORREF _colour;
bool isColourChooserLaunched; //bool isColourChooserLaunched;
static BOOL CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); static BOOL CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);