コード例 #1
0
ファイル: map_view.cpp プロジェクト: vkholodkov/freestars
void MapView::contextMenuEvent(QContextMenuEvent *e)
{
    const SpaceObject *selection = findSelection(e->pos());

    if(selection != NULL) {
        emit listObjectsInLocation(selection, mapToGlobal(e->pos()));
    }
}
コード例 #2
0
void TimeTaggerDialog::unTag_action() {
	if (this==NULL)
		return;
	SelectionList listForRemoval;
	int i=findSelection(0,SELECTION_OUTSIDE);
	if (i>=0) {
		while (i>=0) {
			listForRemoval.append(Selection(tags[i].first,tags[i].second));
			tags.removeAt(i);
			i--;
			i=findSelection(i+1,SELECTION_OUTSIDE);
		}
	} else {
		QTextCursor c=text->textCursor();
		int start=c.selectionStart();
		int end=c.selectionEnd();
		int i=findSelection(0,SELECTION_OUTSIDEOVERLAP);
		if (i>=0) {
			listForRemoval.append(Selection(start,end-1));
		}
		while (i>=0) {
			if (tags[i].first>=start) {
				tags[i].first=end;
			} else {
				tags[i].second=start-1;
			}
			if (tags[i].first==tags[i].second) {
				tags.removeAt(i);
				i--;
			}
			i=findSelection(i+1,SELECTION_OUTSIDEOVERLAP);
		}
	}
	QTextCursor c=text->textCursor();
	for (int i=0;i<listForRemoval.size();i++) {
		c.setPosition(listForRemoval[i].first,QTextCursor::MoveAnchor);
		c.setPosition(listForRemoval[i].second+1,QTextCursor::KeepAnchor);
		text->setTextCursor(c);
		text->setTextBackgroundColor(Qt::white);
		text->setTextColor(Qt::black);
		text->setTextCursor(c);
	}
	c.clearSelection();
	text->setTextCursor(c);
}
コード例 #3
0
void TimeTaggerDialog::tag_action() {
	if (this==NULL)
		return;
	//moveSelectionToWordBoundaries();
	QTextCursor c=text->textCursor();
	int start=c.selectionStart();
	int end=c.selectionEnd();
	if (start==end)
		return;
	int i=findSelection(0,SELECTION_OUTSIDEOVERLAP);
	Selection * sel=NULL;
	while (i>=0) {
		if (sel==NULL) {
			sel=&tags[i];
		} else {
			sel->first=min(sel->first,tags[i].first);
			sel->second=max(sel->second,tags[i].second);
			tags.removeAt(i);
			i--;
		}
		i=findSelection(i+1,SELECTION_OUTSIDEOVERLAP);
	}
	if (sel==NULL) {
		tags.append(Selection(start,end-1));
	} else if (i>=0) { //stopped before completion
		start=sel->first;
		end=sel->second;
	} else {
		sel->first=min(sel->first,start);
		sel->second=max(sel->second,end-1);
	}
	c.setPosition(start,QTextCursor::MoveAnchor);
	c.setPosition(end,QTextCursor::KeepAnchor);
	text->setTextCursor(c);
	text->setTextBackgroundColor(Qt::darkYellow);
	c.clearSelection();
	text->setTextCursor(c);
}
コード例 #4
0
ファイル: map_view.cpp プロジェクト: vkholodkov/freestars
void MapView::mousePressEvent(QMouseEvent *e)
{
    if(e->button() == Qt::LeftButton) {
        if(!addWaypointMode) {
            const SpaceObject *newSelection = findSelection(e->pos());

            if(newSelection != NULL) {
                emit selectionChanged(newSelection);
                return;
            }
        }
        else {
            const SpaceObject *newSelection = findSelection(e->pos());

            if(newSelection != NULL) {
                emit waypointAdded(newSelection);
                return;
            }
        }
    }

    QWidget::mousePressEvent(e);
}
コード例 #5
0
ファイル: symmetry_editor.cpp プロジェクト: Ehnonymoose/MSE
void SymbolSymmetryEditor::onMouseMove  (const Vector2D& from, const Vector2D& to, wxMouseEvent& ev) {
	Selection old_hovered = hovered;
	hovered = findSelection(to);
	if (hovered != old_hovered) control.Refresh(false);
	// TODO: set status text
}
コード例 #6
0
ファイル: symmetry_editor.cpp プロジェクト: Ehnonymoose/MSE
void SymbolSymmetryEditor::onLeftDown   (const Vector2D& pos, wxMouseEvent& ev) {
	if (!symmetry) return;
	selection = findSelection(pos);
}