void TeteNode::init(){ RespondNode::init(); last_active_.start(); menu_ = new QMenu(tr("Popup")); create_new_link_ = new QAction(tr("Create new link"), this); connect(create_new_link_, SIGNAL(triggered()), this, SLOT(registerLinkCreate())); menu_->addAction(create_new_link_); cancel_link_create_ = new QAction(tr("Cancel link creation"), this); connect(cancel_link_create_, SIGNAL(triggered()), this, SLOT(cancelLinkCreate())); menu_->addAction(cancel_link_create_); focus_on_user_ = new QAction(tr("Focus on this person"), this); connect(focus_on_user_, SIGNAL(triggered()), this, SLOT(focusOnUser())); menu_->addAction(focus_on_user_); user_last_tete_ = new QAction(tr("See person's last message"), this); connect(user_last_tete_, SIGNAL(triggered()), this, SLOT(focusOnLastUserTete())); menu_->addAction(user_last_tete_); playback_ = new QAction(tr("Playback chat from here"), this); connect(playback_, SIGNAL(triggered()), this, SLOT(playbackFromHere())); menu_->addAction(playback_); updateFrameRect(); }
bool TeteNode::frameOn(){ if(frame_on_needed_ == false) return selected_; activate(); // Get the rects of parent, referenced, and children nodes updateFrameRect(); float total_object_width = frame_rect_.width(); float total_object_height = frame_rect_.height(); //QString string; //string.setNum(total_object_width); //d_->getNoticeWindow()->write(7, tr("width = ")+string); //string.setNum(total_object_height); //d_->getNoticeWindow()->write(7, tr("height = ")+string); float window_width = d_->main_window->centralWidget()->size().width(); float window_height = d_->main_window->centralWidget()->size().height(); float display_width = window_width - zoom_margin_*2.0; float display_height = window_height - zoom_margin_*2.0; float view_scale_width = display_width / total_object_width; float view_scale_height = display_height / total_object_height; float view_scale = view_scale_width <= view_scale_height ? view_scale_width : view_scale_height; QMatrix current_matrix = d_->getScene()->main_view()->matrix(); // Note: m11 and m22 hold the horizontal and vertical scale. // They should be the same. float current_scale = current_matrix.m11(); float new_scale = current_scale + (view_scale - current_scale) * zoom_speed_; /* Removed to force a refresh of the scene if(new_scale / current_scale < frame_on_threshold_) frame_on_needed_ = false; */ QMatrix temp_matrix; temp_matrix.scale(new_scale, new_scale); d_->getScene()->main_view()->setMatrix(temp_matrix); //d_->getScene()->main_view()->ensureVisible(frame_rect_, zoom_margin_, zoom_margin_); d_->getScene()->main_view()->centerOn(this); if(mouse_moved_ == false){ mouse_moved_ = true; QPoint condense = d_->getScene()->main_view()->mapToGlobal(d_->getScene()->main_view()->mapFromScene(pos().toPoint())); d_->getScene()->main_view()->cursor().setPos(condense); } return selected_; }
void TeteNode::beginFraming(){ updateFrameRect(); frame_selected_ = true; mouse_moved_ = false; frame_on_needed_ = true; //d_->chat_controller()->set_last_selected(tete_); if(frame_rect_object_){ delete frame_rect_object_; frame_rect_object_ = NULL; } frame_rect_object_ = new FrameRect(d_, frame_rect_, this); d_->getScene()->addItem(frame_rect_object_); activateLinkedNodes(); }
void RectTool::updateGraphicsItems() { updateHandles(); updateFrameRect(); }