private void m_picReport_MouseDown(MouseButtons button, bool ctrlKey, int x, int y) {
try {
String sKey = "";
bool bClearSelected = false;
String lastKeyMoving = "";
String lastKeyObj = "";
// to avoid reentrancy
if (m_opening) { return; }
m_inMouseDown = true;
if (m_draging) {
addControlEnd(x, y);
endDraging();
}
endEditText(false);
bClearSelected = pClearSelected(button, ctrlKey, x, y);
if (button == MouseButtons.Left) {
lastKeyObj = m_keyObj;
m_keyObj = "";
sKey = m_keyMoving != "" ? m_keyMoving : m_keySizing;
// to force focus in the header
if (sKey == "") {
m_paint.pointIsInObject(x, y, ref sKey);
if (sKey != "") {
CSReportPaint.cReportPaintObject po = m_paint.getPaintObject(sKey);
lastKeyMoving = m_keyMoving;
m_keyMoving = sKey;
switch (po.getTag()) {
case cGlobals.C_KEY_DETAIL:
case cGlobals.C_KEY_FOOTER:
case cGlobals.C_KEY_HEADER:
// only if no controls are selected
//
if (ctrlKey) {
if (m_vSelectedKeys.Length > 0)
return;
if (m_vSelectedKeys[0].Length > 0)
return;
m_keyMoving = lastKeyMoving;
m_keyObj = lastKeyObj;
return;
}
m_moveType = csRptEditorMoveType.CSRPTEDMOVTVERTICAL;
m_picReport.Cursor = Cursors.SizeNS;
break;
default:
if (po.getRptType() == csRptTypeSection.CSRPTTPSCDETAIL
|| po.getRptType() == csRptTypeSection.CSRPTTPSCHEADER
|| po.getRptType() == csRptTypeSection.GROUP_SECTION_HEADER
|| po.getRptType() == csRptTypeSection.GROUP_SECTION_FOOTER
|| po.getRptType() == csRptTypeSection.CSRPTTPSCFOOTER) {
// only if no controls are selected
//
if (ctrlKey) {
if (m_vSelectedKeys.Length > 0)
return;
if (m_vSelectedKeys[0].Length > 0)
return;
m_keyMoving = lastKeyMoving;
m_keyObj = lastKeyObj;
return;
}
m_picReport.Cursor = Cursors.SizeNS;
m_moveType = csRptEditorMoveType.CSRPTEDMOVTVERTICAL;
}
else if (po.getRptType() == csRptTypeSection.C_KEY_SECLN_HEADER
|| po.getRptType() == csRptTypeSection.C_KEY_SECLN_DETAIL
|| po.getRptType() == csRptTypeSection.C_KEY_SECLN_FOOTER
|| po.getRptType() == csRptTypeSection.C_KEY_SECLN_GROUPH
|| po.getRptType() == csRptTypeSection.C_KEY_SECLN_GROUPF) {
// only if no controls are selected
//
if (ctrlKey) {
if (m_vSelectedKeys.Length > 0)
return;
if (m_vSelectedKeys[0].Length > 0)
return;
m_keyMoving = lastKeyMoving;
m_keyObj = lastKeyObj;
return;
}
m_picReport.Cursor = Cursors.SizeNS;
m_moveType = csRptEditorMoveType.CSRPTEDMOVTVERTICAL;
}
else {
m_moveType = csRptEditorMoveType.CSRPTEDMOVTALL;
m_picReport.Cursor = Cursors.SizeAll;
}
break;
}
}
}
bool bWasRemoved = false;
pAddToSelected(m_keyMoving, ctrlKey, out bWasRemoved);
if (bWasRemoved) { sKey = ""; }
if (sKey != "") {
cReportAspect aspect = m_paint.getPaintObject(sKey).getAspect();
m_offX = x - aspect.getLeft();
m_offY = y - (aspect.getTop() - aspect.getOffset());
}
m_keyFocus = sKey;
m_keyObj = sKey;
m_paint.setFocus(m_keyFocus, m_graphic, bClearSelected);
}
else if (button == MouseButtons.Right) {
m_keySizing = "";
m_keyMoving = "";
m_keyObj = "";
if (m_paint.pointIsInObject(x, y, ref sKey)) {
m_keyObj = sKey;
bClearSelected = pSetSelectForRightBttn();
m_keyFocus = sKey;
m_paint.setFocus(m_keyFocus, m_graphic, bClearSelected);
CSReportPaint.cReportPaintObject po = m_paint.getPaintObject(sKey);
if (m_paint.paintObjIsSection(sKey)) {
bool noDelete = false;
switch (po.getTag()) {
// this sections can not be moved
case cGlobals.C_KEY_HEADER:
case cGlobals.C_KEY_DETAIL:
case cGlobals.C_KEY_FOOTER:
noDelete = true;
break;
default:
noDelete = false;
break;
}
bool isGroup = false;
bool isSecLn = false;
pGetSection(out isGroup, out isSecLn);
if (isSecLn) { noDelete = true; }
showPopMenuSection(noDelete, isGroup);
}
else {
showPopMenuControl(true);
}
}
else {
showPopMenuControl(false);
}
}
cGlobals.setEditAlignTextState(m_vSelectedKeys.Length);
cGlobals.setEditAlignCtlState(m_vSelectedKeys.Length > 1);
pSetEditAlignValue();
pSetFontBoldValue();
} catch (Exception ex) {
cError.mngError(ex, "m_picReport_MouseDown", C_MODULE, "");
m_inMouseDown = false;
}
}