Colour picker now remembers its last position within the session

Originally committed to SVN as r1052.
This commit is contained in:
Niels Martin Hansen 2007-04-09 19:26:32 +00:00
parent 425e8748ea
commit d4e99d152c
2 changed files with 13 additions and 1 deletions

View File

@ -558,7 +558,13 @@ DialogColorPicker::DialogColorPicker(wxWindow *parent, wxColour initial_color)
SetSizer(main_sizer);
main_sizer->SetSizeHints(this);
CenterOnParent();
// Position window
if (lastx == -1 && lasty == -1) {
CenterOnParent();
} else {
Move(lastx, lasty);
}
// Fill the controls
updating_controls = false;
@ -573,6 +579,8 @@ DialogColorPicker::DialogColorPicker(wxWindow *parent, wxColour initial_color)
// Destructor
DialogColorPicker::~DialogColorPicker()
{
GetPosition(&lastx, &lasty);
delete rgb_spectrum[0];
delete rgb_spectrum[1];
delete rgb_spectrum[2];
@ -1111,3 +1119,5 @@ void DialogColorPicker::OnRecentSelect(wxCommandEvent &evt)
SetColor(color.GetWXColor());
}
int DialogColorPicker::lastx = -1;
int DialogColorPicker::lasty = -1;

View File

@ -184,6 +184,8 @@ private:
void OnSliderChange(wxCommandEvent &evt);
void OnRecentSelect(wxCommandEvent &evt);
static int lastx, lasty;
public:
DialogColorPicker(wxWindow *parent, wxColour initial_color);
~DialogColorPicker();