void XFE_ABDirListView::Buttonfunc(const OutlineButtonFuncData *data) { int row = data->row, clicks = data->clicks; // focus notifyInterested(XFE_MNListView::changeFocus, this); if (row < 0) { clickHeader(data); return; } else { /* content row */ if (clicks == 2) { m_outliner->selectItemExclusive(data->row); doubleClickBody(data); }/* clicks == 2 */ else if (clicks == 1) { if (data->ctrl) { m_outliner->toggleSelected(data->row); } else if (data->shift) { // select the range. const int *selected; int count; m_outliner->getSelection(&selected, &count); if (count == 0) { /* there wasn't anything selected yet. */ m_outliner->selectItemExclusive(data->row); }/* if count == 0 */ else if (count == 1) { /* there was only one, so we select the range from that item to the new one. */ m_outliner->selectRangeByIndices(selected[0], data->row); }/* count == 1 */ else { /* we had a range of items selected, * so let's do something really * nice with them. */ m_outliner->trimOrExpandSelection(data->row); }/* else */ }/* if */ else { m_outliner->selectItemExclusive(data->row); selectLine(data->row); }/* else */ getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating); }/* clicks == 1 */ }/* else */ }
void XFE_ABDirListView::selectContainer(AB_ContainerInfo *containerInfo) { if (containerInfo == m_activeContainer) return; MSG_ViewIndex index = AB_GetIndexForContainer(m_pane, containerInfo); if (index != MSG_VIEWINDEXNONE) { m_outliner->scroll2Item((int) index); selectLine((int) index); }/* if */ }
MainWindow::MainWindow() { QMenu *fileMenu = new QMenu(tr("&File")); fileMenu->addAction(tr("E&xit"), this, SLOT(close()), QKeySequence(tr("Ctrl+Q", "File|Exit"))); QMenu *editMenu = new QMenu(tr("&Edit")); cutAction = editMenu->addAction(tr("Cu&t"), this, SLOT(cutSelection()), QKeySequence(tr("Ctrl+X", "Edit|Cut"))); copyAction = editMenu->addAction(tr("&Copy"), this, SLOT(copySelection()), QKeySequence(tr("Ctrl+C", "Edit|Copy"))); pasteAction = editMenu->addAction(tr("&Paste"), this, SLOT(pasteSelection()), QKeySequence(tr("Ctrl+V", "Edit|Paste"))); QMenu *selectMenu = new QMenu(tr("&Select")); selectMenu->addAction(tr("&Word"), this, SLOT(selectWord())); selectMenu->addAction(tr("&Line"), this, SLOT(selectLine())); selectMenu->addAction(tr("&Block"), this, SLOT(selectBlock())); selectMenu->addAction(tr("&Frame"), this, SLOT(selectFrame())); QMenu *insertMenu = new QMenu(tr("&Insert")); insertMenu->addAction(tr("&List"), this, SLOT(insertList()), QKeySequence(tr("Ctrl+L", "Insert|List"))); menuBar()->addMenu(fileMenu); menuBar()->addMenu(editMenu); menuBar()->addMenu(selectMenu); menuBar()->addMenu(insertMenu); editor = new QTextEdit(this); document = new QTextDocument(this); editor->setDocument(document); connect(editor, SIGNAL(selectionChanged()), this, SLOT(updateMenus())); updateMenus(); setCentralWidget(editor); setWindowTitle(tr("Text Document Writer")); }
MainWindow::MainWindow() { QMenu *fileMenu = new QMenu(tr("&File")); fileMenu->addAction(tr("&Open..."), this, SLOT(openFile()), QKeySequence(tr("Ctrl+O", "File|Open"))); QAction *quitAction = fileMenu->addAction(tr("E&xit"), this, SLOT(close())); quitAction->setShortcut(tr("Ctrl+Q")); QMenu *editMenu = new QMenu(tr("&Edit")); cutAction = editMenu->addAction(tr("Cu&t"), this, SLOT(cutSelection())); cutAction->setShortcut(tr("Ctrl+X")); cutAction->setEnabled(false); copyAction = editMenu->addAction(tr("&Copy"), this, SLOT(copySelection())); copyAction->setShortcut(tr("Ctrl+C")); copyAction->setEnabled(false); pasteAction = editMenu->addAction(tr("&Paste"), this, SLOT(pasteSelection())); pasteAction->setShortcut(tr("Ctrl+V")); pasteAction->setEnabled(false); QMenu *selectMenu = new QMenu(tr("&Select")); selectMenu->addAction(tr("&Word"), this, SLOT(selectWord())); selectMenu->addAction(tr("&Line"), this, SLOT(selectLine())); selectMenu->addAction(tr("&Block"), this, SLOT(selectBlock())); selectMenu->addAction(tr("&Frame"), this, SLOT(selectFrame())); menuBar()->addMenu(fileMenu); menuBar()->addMenu(editMenu); menuBar()->addMenu(selectMenu); editor = new QTextEdit(this); document = new QTextDocument(this); editor->setDocument(document); connect(editor, SIGNAL(selectionChanged()), this, SLOT(updateMenus())); setCentralWidget(editor); setWindowTitle(tr("Text Document Writer")); }
int AspUtil::selectPolygon(int x, int y, Dpoint_t *poly, int np) { int px,py,pw,ph; int i; double pi2, a, a1, a2, sum; if(np == 0) return 0; pi2 = 2.0*M_PI; double eps = 0.1*M_PI; if(np == 1) { px = (int)poly[0].x; py = (int)poly[0].y; pw = MARKSIZE; ph = MARKSIZE; return select(x, y, px, py, pw, ph); } else if(np == 2) { return selectLine(x,y,(int)poly[0].x,(int)poly[0].y,(int)poly[1].x,(int)poly[1].y); } double w = poly[np-1].x - x; double h = poly[np-1].y - y; a2 = atan2(h,w); if(h < 0) a2 += pi2; sum = 0.0; for(i=0; i<np; i++) { a1 = a2; w = poly[i].x - x; h = poly[i].y - y; a2 = atan2(h,w); if(h < 0) a2 += pi2; /* get smallest angle */ a = fabs(a2 - a1); if(a > M_PI) a = pi2 - a; sum += a; } if(fabs(sum - pi2) < eps) return 1; else return 0; }