bool DrawRectangleTool::keyReleaseEvent(QKeyEvent* event) { if (event->key() == Qt::Key_Control) { ctrl_pressed = false; if (!picked_direction && (!editingInProgress() || (editingInProgress() && angles.size() == 1))) { angle_helper->setActive(false); if (dragging && editingInProgress()) updateRectangle(); } else if (editingInProgress() && angles.size() > 2) { updateRectangle(); } if (picked_direction) picked_direction = false; updateStatusText(); } else if (event->key() == Qt::Key_Shift) { shift_pressed = false; updateHover(false); updateStatusText(); } else return false; return true; }
bool DrawPathTool::keyReleaseEvent(QKeyEvent* event) { if (event->key() == Qt::Key_Control) { ctrl_pressed = false; if (!picked_angle) angle_helper->setActive(false); if (editingInProgress() && !dragging) updateDrawHover(); updateStatusText(); } else if (event->key() == Qt::Key_Shift) { shift_pressed = false; if (!dragging && !following) { updateHover(); updateDirtyRect(); } updateStatusText(); } else return false; return true; }
bool DrawPathTool::keyPressEvent(QKeyEvent* event) { bool key_handled = false; if (editingInProgress()) { key_handled = true; if (event->key() == Qt::Key_Escape) abortDrawing(); else if (event->key() == Qt::Key_Backspace) undoLastPoint(); else if (event->key() == Qt::Key_Return && allow_closing_paths) { if (! (event->modifiers() & Qt::ControlModifier)) closeDrawing(); finishDrawing(); } else key_handled = false; } else if (event->key() == Qt::Key_Backspace && finished_path_is_selected) { key_handled = removeLastPointFromSelectedPath(); } if (event->key() == Qt::Key_Tab) deactivate(); else if (event->key() == Qt::Key_Space) { draw_dash_points = !draw_dash_points; updateStatusText(); } else if (event->key() == Qt::Key_Control) { ctrl_pressed = true; angle_helper->setActive(true); if (editingInProgress() && !dragging) updateDrawHover(); picked_angle = false; updateStatusText(); } else if (event->key() == Qt::Key_Shift) { shift_pressed = true; if (!dragging) { updateHover(); updateDirtyRect(); } updateStatusText(); } else return key_handled; return true; }
void CutHoleTool::pathAborted() { delete path_tool; path_tool = NULL; updateDirtyRect(); updateStatusText(); }
void DrawFreehandTool::abortDrawing() { dragging = false; updateStatusText(); DrawLineAndAreaTool::abortDrawing(); }
bool EditPointTool::keyRelease(QKeyEvent* event) { if (text_editor) return text_editor->keyReleaseEvent(event); if (event->key() == Qt::Key_Control) { angle_helper->setActive(false); if (editingInProgress()) { reapplyConstraintHelpers(); } } else if (event->key() == Qt::Key_Shift) { snap_helper->setFilter(SnappingToolHelper::NoSnapping); if (editingInProgress()) { reapplyConstraintHelpers(); } } else if (event->key() == Qt::Key_Space) { space_pressed = false; } else { return false; } updateStatusText(); return true; }
void RotateTool::clickRelease() { rotation_center = cur_pos_map; angle_helper->setCenter(rotation_center); updateDirtyRect(); updateStatusText(); }
void EditPointTool::finishEditing() { bool create_undo_step = true; bool delete_objects = false; if (text_editor) { delete text_editor; text_editor = nullptr; TextObject* text_object = reinterpret_cast<TextObject*>(*map()->selectedObjectsBegin()); if (text_object->getText().isEmpty()) { text_object->setText(old_text); text_object->setHorizontalAlignment((TextObject::HorizontalAlignment)old_horz_alignment); text_object->setVerticalAlignment((TextObject::VerticalAlignment)old_vert_alignment); create_undo_step = false; delete_objects = true; } else if (text_object->getText() == old_text && (int)text_object->getHorizontalAlignment() == old_horz_alignment && (int)text_object->getVerticalAlignment() == old_vert_alignment) create_undo_step = false; } MapEditorToolBase::finishEditing(delete_objects, create_undo_step); if (delete_objects) deleteSelectedObjects(); updateStatusText(); }
void DrawTextTool::finishEditing() { delete text_editor; text_editor = NULL; renderables->removeRenderablesOfObject(preview_text, false); map()->clearDrawingBoundingBox(); if (!preview_text->getText().isEmpty()) { int index = map()->addObject(preview_text); map()->clearObjectSelection(false); map()->addObjectToSelection(preview_text, true); map()->setObjectsDirty(); DeleteObjectsUndoStep* undo_step = new DeleteObjectsUndoStep(map()); undo_step->addObject(index); map()->push(undo_step); preview_text = NULL; } setPreviewLetter(); updateStatusText(); MapEditorTool::finishEditing(); }
bool DrawCircleTool::mouseReleaseEvent(QMouseEvent* event, MapCoordF map_coord, MapWidget* widget) { Q_UNUSED(widget); if (!isDrawingButton(event->button())) { if (event->button() == Qt::RightButton) abortDrawing(); return false; } if (!editingInProgress()) return false; updateStatusText(); if (dragging || second_point_set) { cur_pos = event->pos(); cur_pos_map = map_coord; if (dragging && !second_point_set) opposite_pos_map = map_coord; updateCircle(); finishDrawing(); return true; } return false; }
void DrawPathTool::finishDrawing() { Q_ASSERT(editingInProgress()); // Does the symbols contain only areas? If so, auto-close the path if not done yet bool contains_only_areas = !is_helper_tool && (drawing_symbol->getContainedTypes() & ~(Symbol::Area | Symbol::Combined)) == 0 && (drawing_symbol->getContainedTypes() & Symbol::Area); if (contains_only_areas && !preview_path->parts().empty()) preview_path->parts().front().setClosed(true, true); // Remove last point if closed and first and last points are equal, or if the last point was just a preview if (path_has_preview_point && !dragging) preview_path->deleteCoordinate(preview_path->getCoordinateCount() - (preview_path->parts().front().isClosed() ? 2 : 1), false); if (preview_path->getCoordinateCount() < (contains_only_areas ? 3 : 2)) { renderables->removeRenderablesOfObject(preview_path, false); delete preview_path; preview_path = NULL; } dragging = false; following = false; setEditingInProgress(false); if (!ctrl_pressed) angle_helper->setActive(false); updateSnapHelper(); updateStatusText(); hidePreviewPoints(); DrawLineAndAreaTool::finishDrawing(appending ? append_to_object : NULL); finished_path_is_selected = true; }
void DrawRectangleTool::finishDrawing() { snapped_to_line = false; if (angles.size() == 1 && preview_path && !(preview_path->getSymbol()->getContainedTypes() & Symbol::Line)) { // Do not draw a line object with an area-only symbol return; } if (angles.size() > 1 && drawingParallelTo(angles[0])) { // Delete first point deleteClosePoint(); preview_path->deleteCoordinate(0, false); preview_path->parts().front().setClosed(true, true); } angle_helper->setActive(false); angles.clear(); setEditingInProgress(false); updateStatusText(); DrawLineAndAreaTool::finishDrawing(); // HACK: do not add stuff here as the tool might get deleted on call to DrawLineAndAreaTool::finishDrawing()! }
bool ScaleTool::mouseReleaseEvent(QMouseEvent* event, MapCoordF map_coord, MapWidget* widget) { Q_UNUSED(widget); if (event->button() != Qt::LeftButton) return false; if (!scaling) { scaling_center = map_coord; scaling_center_set = true; } else { scaling = false; updateDragging(map_coord); finishEditingSelection(*renderables, *old_renderables, true); map()->setObjectsDirty(); map()->emitSelectionEdited(); } updateDirtyRect(); updateStatusText(); return true; }
void RotateTool::clickRelease() { rotation_center = cur_pos_map; rotation_center_set = true; updateDirtyRect(); updateStatusText(); }
void CutHoleTool::init() { connect(map(), SIGNAL(objectSelectionChanged()), this, SLOT(objectSelectionChanged())); updateDirtyRect(); updateStatusText(); MapEditorTool::init(); }
void DrawPointTool::clickRelease() { createObject(); map()->clearDrawingBoundingBox(); renderables->removeRenderablesOfObject(preview_object.get(), false); updateStatusText(); }
void EditPointTool::focusOutEvent(QFocusEvent* event) { Q_UNUSED(event); // Deactivate modifiers - not always correct, but should be // wrong only in unusual cases and better than leaving the modifiers on forever space_pressed = false; updateStatusText(); }
void DrawCircleTool::abortDrawing() { dragging = false; first_point_set = false; second_point_set = false; updateStatusText(); DrawLineAndAreaTool::abortDrawing(); }
void DrawCircleTool::finishDrawing() { dragging = false; first_point_set = false; second_point_set = false; updateStatusText(); DrawLineAndAreaTool::finishDrawing(); // Do not add stuff here as the tool might get deleted in DrawLineAndAreaTool::finishDrawing()! }
void DrawRectangleTool::abortDrawing() { snapped_to_line = false; angle_helper->setActive(false); angles.clear(); setEditingInProgress(false); updateStatusText(); DrawLineAndAreaTool::abortDrawing(); // HACK: do not add stuff here as the tool might get deleted on call to DrawLineAndAreaTool::finishDrawing()! }
void ModelTreeDialog::initStatusBar(void) { int parts[] = {-1}; m_hStatus = ::CreateWindow(STATUSCLASSNAME, "", WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP, 0, 0, 10, 10, hWindow, NULL, hInstance, 0); SendMessage(m_hStatus, SB_SETPARTS, 1, (LPARAM)parts); updateStatusText(); }
void ModelTreeDialog::clearTreeView(void) { m_clearing = true; SendMessage(m_hTreeView, WM_SETREDRAW, FALSE, 0); TreeView_DeleteAllItems(m_hTreeView); SendMessage(m_hTreeView, WM_SETREDRAW, TRUE, 0); TreeView_SelectItem(m_hTreeView, NULL); m_clearing = false; updateStatusText(); }
void MapEditorToolBase::init() { connect(map(), SIGNAL(objectSelectionChanged()), this, SLOT(objectSelectionChanged())); connect(map(), SIGNAL(selectedObjectEdited()), this, SLOT(updateDirtyRect())); initImpl(); updateDirtyRect(); updateStatusText(); MapEditorTool::init(); }
void RotateTool::dragFinish() { if (rotating) { rotating = false; finishEditing(); updateDirtyRect(); updateStatusText(); } }
void DrawTextTool::abortEditing() { delete text_editor; text_editor = NULL; renderables->removeRenderablesOfObject(preview_text, false); map()->clearDrawingBoundingBox(); setPreviewLetter(); updateStatusText(); }
LRESULT ModelTreeDialog::doTreeSelChanged(LPNMTREEVIEW notification) { if (!m_clearing) { if (m_highlight) { highlightItem(notification->itemNew.hItem); } updateStatusText(); } return 1; // Ignored }
void RotateTool::dragFinish() { if (qAbs(current_rotation) > 0.0001) { for (auto object : map()->selectedObjects()) object->rotateAround(rotation_center, -current_rotation); } original_rotation = current_rotation = 0; finishEditing(); updateDirtyRect(); updateStatusText(); }
void DrawCircleTool::init() { updateStatusText(); if (editor->isInMobileMode()) { // Create key replacement bar key_button_bar = new KeyButtonBar(this, editor->getMainWidget()); key_button_bar->addModifierKey(Qt::Key_Control, Qt::ControlModifier, tr("From center", "Draw circle starting from center")); editor->showPopupWidget(key_button_bar, ""); } }
void DrawPathTool::abortDrawing() { dragging = false; following = false; setEditingInProgress(false); if (!ctrl_pressed) angle_helper->setActive(false); updateSnapHelper(); updateStatusText(); hidePreviewPoints(); DrawLineAndAreaTool::abortDrawing(); }
bool EditPointTool::keyPress(QKeyEvent* event) { if (text_editor) { if (event->key() == Qt::Key_Escape) { finishEditing(); return true; } return text_editor->keyPressEvent(event); } int num_selected_objects = map()->getNumSelectedObjects(); if (num_selected_objects > 0 && event->key() == delete_object_key) { deleteSelectedObjects(); } else if (num_selected_objects > 0 && event->key() == Qt::Key_Escape) { map()->clearObjectSelection(true); } else if (event->key() == Qt::Key_Control) { if (editingInProgress()) activateAngleHelperWhileEditing(); } else if (event->key() == Qt::Key_Shift && editingInProgress()) { if (hover_state == OverObjectNode && hover_object->getType() == Object::Path && hover_object->asPath()->isCurveHandle(hover_point)) { // In this case, Shift just activates deactivates // the opposite curve handle constraints return true; } activateSnapHelperWhileEditing(); } else if (event->key() == Qt::Key_Space) { space_pressed = true; } else { return false; } updateStatusText(); return true; }