mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
ScatterCtrl: Double click out of plot opens properties
git-svn-id: svn://ultimatepp.org/upp/trunk@8512 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
1c8b83ef16
commit
86c7e382da
6 changed files with 66 additions and 61 deletions
|
|
@ -71,11 +71,6 @@ void TextsTab::Init(ScatterCtrl& scatter) {
|
|||
bottomMargin <<= scatter.GetPlotAreaBottomMargin();
|
||||
bottomMargin <<= THISBACK(Change);
|
||||
|
||||
mouseHandlingX <<= scatter.GetMouseHandlingX();
|
||||
mouseHandlingX <<= THISBACK(Change);
|
||||
mouseHandlingY <<= scatter.GetMouseHandlingY();
|
||||
mouseHandlingY <<= THISBACK(Change);
|
||||
|
||||
Change();
|
||||
}
|
||||
|
||||
|
|
@ -86,8 +81,6 @@ void TextsTab::Change() {
|
|||
scatter.SetLabels(xLabel, yLabel, yLabel2);
|
||||
scatter.SetPlotAreaMargin(~leftMargin, ~rightMargin, ~topMargin, ~bottomMargin);
|
||||
|
||||
scatter.SetMouseHandling(mouseHandlingX, mouseHandlingY);
|
||||
|
||||
scatter.SetModify();
|
||||
scatter.Refresh();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -280,11 +280,16 @@ bool ScatterCtrl::ProcessKey(int key)
|
|||
return processed;
|
||||
}
|
||||
|
||||
bool ScatterCtrl::PointInPlot(Point &pt)
|
||||
{
|
||||
return hPlotLeft <= pt.x && pt.x <= (GetSize().cx - hPlotRight) &&
|
||||
(vPlotTop + titleHeight) <= pt.y && pt.y <= (GetSize().cy - vPlotBottom);
|
||||
}
|
||||
|
||||
void ScatterCtrl::LabelPopUp(bool down, Point &pt)
|
||||
{
|
||||
if (down) {
|
||||
if(showInfo && hPlotLeft <= pt.x && pt.x <= GetSize().cx - hPlotRight &&
|
||||
(vPlotTop + titleHeight) <= pt.y && pt.y <= GetSize().cy - vPlotBottom) {
|
||||
if(showInfo && PointInPlot(pt)) {
|
||||
popText.AppearOnly(this);
|
||||
|
||||
isLabelPopUp = true;
|
||||
|
|
@ -312,8 +317,7 @@ void ScatterCtrl::LabelPopUp(bool down, Point &pt)
|
|||
void ScatterCtrl::ZoomWindow(bool down, Point &pt)
|
||||
{
|
||||
if (down) {
|
||||
if (hPlotLeft <= pt.x && pt.x <= GetSize().cx - hPlotRight &&
|
||||
(vPlotTop + titleHeight) <= pt.y && pt.y <= GetSize().cy - vPlotBottom) {
|
||||
if (PointInPlot(pt)) {
|
||||
isZoomWindow = true;
|
||||
if (IsNull(popLT))
|
||||
popLT = pt;
|
||||
|
|
@ -354,8 +358,7 @@ void ScatterCtrl::Scrolling(bool down, Point &pt, bool isOut)
|
|||
{
|
||||
static Image mouseImg;
|
||||
if (down) {
|
||||
if((mouseHandlingX || mouseHandlingY) && hPlotLeft <= pt.x && pt.x <= GetSize().cx - hPlotRight &&
|
||||
(vPlotTop + titleHeight) <= pt.y && pt.y <= GetSize().cy - vPlotBottom) {
|
||||
if((mouseHandlingX || mouseHandlingY) && PointInPlot(pt)) {
|
||||
butDownX = pt.x;
|
||||
butDownY = pt.y;
|
||||
isScrolling = true;
|
||||
|
|
@ -408,6 +411,14 @@ void ScatterCtrl::LeftDown(Point pt, dword keyFlags)
|
|||
ProcessMouse(true, pt, keyFlags & K_CTRL, keyFlags & K_ALT, keyFlags & K_SHIFT, true, false, 0, false);
|
||||
}
|
||||
|
||||
void ScatterCtrl::LeftDouble(Point pt, dword)
|
||||
{
|
||||
if(!HasFocus())
|
||||
SetFocus();
|
||||
if (!PointInPlot(pt))
|
||||
MenuBar::Execute(THISBACK(ContextMenu));
|
||||
}
|
||||
|
||||
void ScatterCtrl::LeftUp(Point pt, dword keyFlags)
|
||||
{
|
||||
isLeftDown = false;
|
||||
|
|
@ -463,8 +474,7 @@ void ScatterCtrl::MouseMove(Point pt, dword)
|
|||
ScatterDraw::Scroll(factorX, -factorY);
|
||||
}
|
||||
if(isLabelPopUp) {
|
||||
if (showInfo && hPlotLeft <= pt.x && pt.x <= GetSize().cx - hPlotRight &&
|
||||
(vPlotTop + titleHeight) <= pt.y && pt.y <= GetSize().cy - vPlotBottom) {
|
||||
if (showInfo && PointInPlot(pt)) {
|
||||
if (IsNull(popLT))
|
||||
popLT = pt;
|
||||
popRB = pt;
|
||||
|
|
@ -473,8 +483,7 @@ void ScatterCtrl::MouseMove(Point pt, dword)
|
|||
Refresh();
|
||||
}
|
||||
} else if (isZoomWindow) {
|
||||
if (hPlotLeft <= pt.x && pt.x <= GetSize().cx - hPlotRight &&
|
||||
(vPlotTop + titleHeight) <= pt.y && pt.y <= GetSize().cy - vPlotBottom) {
|
||||
if (PointInPlot(pt)) {
|
||||
if (IsNull(popLT))
|
||||
popLT = pt;
|
||||
popRB = pt;
|
||||
|
|
@ -534,14 +543,19 @@ void ScatterCtrl::ContextMenu(Bar& bar)
|
|||
bar.Add(t_("Fit to data"), ScatterImg::ShapeHandles(), THISBACK1(FitToData, mouseHandlingY));
|
||||
bar.Add(t_("Zoom +"), ScatterImg::ZoomPlus(), THISBACK3(Zoom, 1/1.2, true, mouseHandlingY));
|
||||
bar.Add(t_("Zoom -"), ScatterImg::ZoomMinus(), THISBACK3(Zoom, 1.2, true, mouseHandlingY));
|
||||
}
|
||||
bar.Add(t_("Attach X axis"), Null, THISBACK(ChangeMouseHandlingX)).Check(!mouseHandlingX);
|
||||
if (mouseHandlingX) {
|
||||
bar.Add(t_("Scroll Left"), ScatterImg::LeftArrow(), THISBACK2(ScatterDraw::Scroll, 0.2, 0)).Key(K_CTRL_LEFT);
|
||||
bar.Add(t_("Scroll Right"), ScatterImg::RightArrow(), THISBACK2(ScatterDraw::Scroll, -0.2, 0)).Key(K_CTRL_RIGHT);
|
||||
if (mouseHandlingY) {
|
||||
bar.Add(t_("Scroll Up"), ScatterImg::UpArrow(), THISBACK2(ScatterDraw::Scroll, 0, -0.2)).Key(K_CTRL_UP);
|
||||
bar.Add(t_("Scroll Down"), ScatterImg::DownArrow(), THISBACK2(ScatterDraw::Scroll, 0, 0.2)).Key(K_CTRL_DOWN);
|
||||
}
|
||||
bar.Separator();
|
||||
}
|
||||
bar.Add(t_("Attach Y axis"), Null, THISBACK(ChangeMouseHandlingY)).Check(!mouseHandlingY);
|
||||
if (mouseHandlingY) {
|
||||
bar.Add(t_("Scroll Up"), ScatterImg::UpArrow(), THISBACK2(ScatterDraw::Scroll, 0, -0.2)).Key(K_CTRL_UP);
|
||||
bar.Add(t_("Scroll Down"), ScatterImg::DownArrow(), THISBACK2(ScatterDraw::Scroll, 0, 0.2)).Key(K_CTRL_DOWN);
|
||||
}
|
||||
if (mouseHandlingX || mouseHandlingY)
|
||||
bar.Separator();
|
||||
#ifndef _DEBUG
|
||||
if (showPropDlg)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -165,6 +165,11 @@ public:
|
|||
ScatterCtrl& SetMouseHandling(bool valx = true, bool valy = false);
|
||||
bool GetMouseHandlingX() {return mouseHandlingX;}
|
||||
bool GetMouseHandlingY() {return mouseHandlingY;}
|
||||
private:
|
||||
void ChangeMouseHandlingX() {mouseHandlingX = !mouseHandlingX;}
|
||||
void ChangeMouseHandlingY() {mouseHandlingY = !mouseHandlingY;}
|
||||
|
||||
public:
|
||||
ScatterCtrl& ShowInfo(bool show = true) {showInfo = show; return *this;}
|
||||
|
||||
#ifdef PLATFORM_WIN32
|
||||
|
|
@ -259,9 +264,11 @@ private:
|
|||
Array<KeyBehavior> keyBehavior;
|
||||
|
||||
void ProcessPopUp(const Point & pt);
|
||||
bool PointInPlot(Point &pt);
|
||||
|
||||
virtual void Paint(Draw& w);
|
||||
virtual void LeftDown(Point, dword);
|
||||
virtual void LeftDouble(Point p, dword);
|
||||
virtual void LeftUp(Point, dword);
|
||||
virtual void MiddleDown(Point, dword);
|
||||
virtual void MouseMove(Point, dword);
|
||||
|
|
|
|||
|
|
@ -21,30 +21,28 @@ LAYOUT(Measures, 396, 256)
|
|||
ITEM(Button, butUpdate, SetLabel(t_("Update")).RightPosZ(12, 56).BottomPosZ(13, 19))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(Texts, 472, 320)
|
||||
LAYOUT(Texts, 472, 284)
|
||||
ITEM(Label, dv___0, SetLabel(t_("Label Y2:")).RightPosZ(16, 68).TopPosZ(48, 21))
|
||||
ITEM(EditString, yLabel2, RightPosZ(16, 68).TopPosZ(72, 19))
|
||||
ITEM(EditString, yLabel, LeftPosZ(12, 64).TopPosZ(72, 20))
|
||||
ITEM(Label, dv___3, SetLabel(t_("Title:")).LeftPosZ(12, 64).TopPosZ(16, 21))
|
||||
ITEM(EditString, title, HSizePosZ(80, 212).TopPosZ(16, 19))
|
||||
ITEM(Label, dv___5, SetLabel(t_("Label X:")).LeftPosZ(12, 64).BottomPosZ(47, 21))
|
||||
ITEM(EditString, xLabel, HSizePosZ(80, 228).BottomPosZ(49, 19))
|
||||
ITEM(Label, dv___5, SetLabel(t_("Label X:")).LeftPosZ(12, 64).BottomPosZ(11, 21))
|
||||
ITEM(EditString, xLabel, HSizePosZ(80, 228).BottomPosZ(13, 19))
|
||||
ITEM(Label, dv___7, SetLabel(t_("Top margin:")).RightPosZ(128, 72).TopPosZ(16, 21))
|
||||
ITEM(Label, dv___8, SetLabel(t_("Label Y:")).LeftPosZ(12, 64).TopPosZ(48, 21))
|
||||
ITEM(LabelBox, dv___9, HSizePosZ(80, 88).VSizePosZ(40, 72))
|
||||
ITEM(LabelBox, dv___10, HSizePosZ(4, 8).VSizePosZ(0, 40))
|
||||
ITEM(Label, dv___11, SetLabel(t_("Left margin:")).LeftPosZ(12, 64).BottomPosZ(103, 21))
|
||||
ITEM(LabelBox, dv___9, HSizePosZ(80, 88).VSizePosZ(40, 36))
|
||||
ITEM(LabelBox, dv___10, HSizePosZ(4, 8).VSizePosZ(0, 4))
|
||||
ITEM(Label, dv___11, SetLabel(t_("Left margin:")).LeftPosZ(12, 64).BottomPosZ(67, 21))
|
||||
ITEM(EditIntSpin, topMargin, RightPosZ(88, 40).TopPosZ(16, 19))
|
||||
ITEM(Label, dv___13, SetLabel(t_("Right margin:")).RightPosZ(12, 72).BottomPosZ(103, 21))
|
||||
ITEM(EditIntSpin, rightMargin, RightPosZ(44, 40).BottomPosZ(81, 19))
|
||||
ITEM(EditIntSpin, leftMargin, LeftPosZ(12, 40).BottomPosZ(81, 19))
|
||||
ITEM(Label, dv___16, SetLabel(t_("Bottom margin:")).RightPosZ(128, 88).BottomPosZ(47, 21))
|
||||
ITEM(EditIntSpin, bottomMargin, RightPosZ(88, 40).BottomPosZ(49, 19))
|
||||
ITEM(Option, mouseHandlingY, SetLabel(t_("Y mouse handling enabled")).LeftPosZ(8, 168).BottomPosZ(4, 16))
|
||||
ITEM(Option, mouseHandlingX, SetLabel(t_("X mouse handling enabled")).LeftPosZ(8, 168).BottomPosZ(20, 16))
|
||||
ITEM(Label, dv___13, SetLabel(t_("Right margin:")).RightPosZ(12, 72).BottomPosZ(67, 21))
|
||||
ITEM(EditIntSpin, rightMargin, RightPosZ(44, 40).BottomPosZ(45, 19))
|
||||
ITEM(EditIntSpin, leftMargin, LeftPosZ(12, 40).BottomPosZ(45, 19))
|
||||
ITEM(Label, dv___16, SetLabel(t_("Bottom margin:")).RightPosZ(128, 88).BottomPosZ(11, 21))
|
||||
ITEM(EditIntSpin, bottomMargin, RightPosZ(88, 40).BottomPosZ(13, 19))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(Legend, 340, 256)
|
||||
LAYOUT(Legend, 340, 216)
|
||||
ITEM(LabelBox, rectangle, SetLabel(t_("Position")).LeftPosZ(120, 80).TopPosZ(4, 60))
|
||||
ITEM(Label, labelVert, SetLabel(t_("Vertical:")).LeftPosZ(232, 48).TopPosZ(176, 21))
|
||||
ITEM(Label, labelNumCols, SetLabel(t_("Column number:")).LeftPosZ(128, 92).TopPosZ(84, 21))
|
||||
|
|
|
|||
|
|
@ -21,6 +21,12 @@ esES("")
|
|||
euES("")
|
||||
frFR("")
|
||||
|
||||
T_("Attach X axis")
|
||||
caES("")
|
||||
esES("Fijar eje X")
|
||||
euES("")
|
||||
frFR("")
|
||||
|
||||
T_("Scroll Left")
|
||||
caES("Moure a l'esquerra")
|
||||
esES("Mover a la izquierda")
|
||||
|
|
@ -33,6 +39,12 @@ esES("Mover a la derecha")
|
|||
euES("Korritu eskubidea")
|
||||
frFR("Faites d\303\251filer \303\240 droite")
|
||||
|
||||
T_("Attach Y axis")
|
||||
caES("")
|
||||
esES("Fijar eje Y")
|
||||
euES("")
|
||||
frFR("")
|
||||
|
||||
T_("Scroll Up")
|
||||
caES("Moure amunt")
|
||||
esES("Mover arriba")
|
||||
|
|
@ -251,31 +263,19 @@ frFR("\303\211tiquette Y:")
|
|||
|
||||
T_("Left margin:")
|
||||
caES("")
|
||||
esES("")
|
||||
esES("Margen izquierdo:")
|
||||
euES("")
|
||||
frFR("")
|
||||
|
||||
T_("Right margin:")
|
||||
caES("")
|
||||
esES("")
|
||||
esES("Margen derecho:")
|
||||
euES("")
|
||||
frFR("")
|
||||
|
||||
T_("Bottom margin:")
|
||||
caES("")
|
||||
esES("")
|
||||
euES("")
|
||||
frFR("")
|
||||
|
||||
T_("Y mouse handling enabled")
|
||||
caES("")
|
||||
esES("")
|
||||
euES("")
|
||||
frFR("")
|
||||
|
||||
T_("X mouse handling enabled")
|
||||
caES("")
|
||||
esES("")
|
||||
esES("Margen inferior:")
|
||||
euES("")
|
||||
frFR("")
|
||||
|
||||
|
|
@ -459,11 +459,3 @@ esES("Primaria")
|
|||
euES("Lehen")
|
||||
frFR("Primaire")
|
||||
|
||||
|
||||
// Obsolete
|
||||
|
||||
T_("General")
|
||||
caES("General")
|
||||
esES("General")
|
||||
euES("Oro har")
|
||||
frFR("G\303\251n\303\251ral")
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ ctrl ScatterCtrl {
|
|||
GetMinSize() {sz.cx=150; sz.cy = 100; return sz; }
|
||||
GetStdSize() {sz.cx=300; sz.cy = 200; return sz; }
|
||||
|
||||
Frame SetFrame;
|
||||
Color SetColor = :White;
|
||||
Text SetTitle;
|
||||
Font SetTitleFont;
|
||||
Color SetTitleColor = :Black;
|
||||
|
|
@ -54,6 +52,9 @@ ctrl ScatterCtrl {
|
|||
bool SetFastViewX = false;
|
||||
bool SetSequentialXAll = false;
|
||||
|
||||
Frame SetFrame;
|
||||
Color SetColor = :White;
|
||||
|
||||
Paint(w) {
|
||||
r = GetRect();
|
||||
w.DrawRect(r, .SetColor);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue