void CurvePane::mouseMoved(wxMouseEvent& event) { int m=10; int w, h; mousemoved = true; wxClientDC dc(this); dc.GetSize(&w, &h); if( mousemotion) { pos = event.GetLogicalPosition(dc); pos.x = pos.x-m; pos.y = h-m-pos.y; if (selectedCP.x > -1.0) { c.deletepoint(selectedCP.x, selectedCP.y); selectedCP.x -= mouseCP.x - (double) pos.x; selectedCP.y -= mouseCP.y - (double) pos.y; if (selectedCP.x < 0.0) selectedCP.x = 0.0; if (selectedCP.x > 255.0) selectedCP.x = 255.0; if (selectedCP.y < 0.0) selectedCP.y = 0.0; if (selectedCP.y > 255.0) selectedCP.y = 255.0; c.insertpoint((double) selectedCP.x, (double) selectedCP.y); } mouseCP.x = (double) pos.x; mouseCP.y = (double) pos.y; paintNow(); } }
void bmImage::addLayer(bmLayer layer) { layers.push_back(layer); ((bmImageFrame*)GetParent())->updateLayerListCtrl(); if (w == -1) w = layer.cvMat.cols; if (h == -1) h = layer.cvMat.rows; if (type == -1) type = layer.cvMat.type(); update(); paintNow(); }
void CurvePane::mouseReleased(wxMouseEvent& event) { mousemotion=false; paintNow(); if (mousemoved) { wxCommandEvent *e = new wxCommandEvent(wxEVT_SCROLL_THUMBRELEASE); e->SetString("This is the data"); wxQueueEvent(p,e); } }
void ProgressIndicator::mouseDown(wxMouseEvent &event) { this->value = (float)event.GetPosition().x / (float)width; // Repaint directly - gives a nicer feedback to the user paintNow(); wxCommandEvent pressEvent = wxCommandEvent(PI_SCROLL_CHANGED); QueueEvent(pressEvent.Clone()); }
void CurvePane::mouseRightDown(wxMouseEvent& event) { c.clearpoints(); c.insertpoint(0,0); c.insertpoint(255.0,255.0); selectedCP.x = -1.0; selectedCP.y = -1.0; paintNow(); wxCommandEvent *e = new wxCommandEvent(wxEVT_SCROLL_THUMBRELEASE); e->SetString("This is the data"); wxQueueEvent(p,e); }
void CurvePane::mouseDclick(wxMouseEvent& event) { int radius; wxConfigBase::Get()->Read("tool.curve.controlpointradius",&radius,5); if (c.isendpoint(selectedCP.x, selectedCP.y, radius)) return; c.deletepoint(selectedCP.x, selectedCP.y); selectedCP.x = -1.0; selectedCP.y = -1.0; paintNow(); wxCommandEvent *e = new wxCommandEvent(wxEVT_SCROLL_THUMBRELEASE); e->SetString("This is the data"); wxQueueEvent(p,e); }
void GraphMemory::onSelect(bool state, bool multiselect) { if(state) { color.v = 1.0; selected = true; if(!multiselect) owner->deselectExcept(this); } else { color.v = 0.7; selected = false; } paintNow(); }
void CurvePane::mouseLeftDown(wxMouseEvent& event) { int m=10; int w, h; double x, y; mousemoved = false; mousemotion=true; int landingradius; wxConfigBase::Get()->Read("tool.curve.landingradius",&landingradius,5); wxClientDC dc(this); dc.GetSize(&w, &h); pos = event.GetLogicalPosition(dc); pos.x = pos.x-m; pos.y = h-m-pos.y; mouseCP.x = pos.x; mouseCP.y = pos.y; int pt = c.isctrlpoint(pos.x,pos.y,landingradius); if (pt != -1) { selectedCP = c.getctrlpoint(pt); paintNow(); return; } for (x=1.0; x<255.0; x++) { y = c.getpoint(x); if ((pos.x > x-landingradius) & (pos.x < x+landingradius)) { if ((pos.y > y-landingradius) & (pos.y < y+landingradius)) { c.insertpoint(x,y); selectedCP.x = x; selectedCP.y = y; paintNow(); return; } } } }
CurvePane::CurvePane(wxWindow* parent, wxString controlpoints) : wxPanel(parent, wxID_ANY, wxPoint(0,0), wxSize(300,300) ) { p = parent; z=1; mousemotion=false; wxArrayString ctrlpts = split(controlpoints,","); for (int i=0; i<ctrlpts.GetCount()-1; i+=2) { c.insertpoint(atof(ctrlpts[i]), atof(ctrlpts[i+1])); } selectedCP.x = -1.0; selectedCP.y = -1.0; c.clampto(0.0,255.0); paintNow(); //Refresh(); //Update(); }
void ProgressIndicator::SetValue(float value) { this->value = value; paintNow(); }
/*----------------------------------------------------------------------------------------------*/ void GUI_Toplevel::onTimer(wxTimerEvent& evt) { paintNow(); }