示例#1
0
void LinksDialog::changedSortTop( int index )
{
	/* update */
	if (!rsRanks)
		return;

	std::list<std::string> peers;

	/* translate */
	switch (index)
	{
		default:
		case 0:
			mStart = 0;
			break;
		case 1:
			mStart = 1 * ENTRIES_PER_BLOCK;
			break;
		case 2:
			mStart = 2 * ENTRIES_PER_BLOCK;
			break;
		case 3:
			mStart = 3 * ENTRIES_PER_BLOCK;
			break;
		case 4:
			mStart = 4 * ENTRIES_PER_BLOCK;
			break;
		case 5:
			mStart = -1;
			break;
	}
	updateLinks();
}
示例#2
0
void LinksDialog::changedSortPeriod( int index )
{
	/* update */
	if (!rsRanks)
		return;

	/* translate */
	uint32_t period = 0;
	switch (index)
	{
		case 1:
			period = 60 * 60 * 24 * 7; /* WEEK */
			break;
		case 2:
			period = 60 * 60 * 24; /* DAY */
			break;
		default:
		case 0:
			period = 60 * 60 * 24 * 30; /* MONTH */
			break;
	}

	if (period)
	{
		rsRanks->setSortPeriod(period);
	}
	updateLinks();
}
示例#3
0
void LinksDialog::changedSortFrom( int index )
{
	/* update */
	if (!rsRanks)
		return;

	std::list<std::string> peers;

	/* translate */
	switch (index)
	{
		default:
		case 0:
			break;
		case 1:
                        peers.push_back(mPeers->getOwnId());
			break;
	}

	if (peers.size() < 1)
	{
		rsRanks->clearPeerFilter();
	}
	else
	{
		rsRanks->setPeerFilter(peers);
	}
	updateLinks();
}
示例#4
0
void
CScreensLinks::init(HWND hwnd)
{
	// get initial config
	m_scratchConfig = *m_mainConfig;

	// fill side list box (in EDirection order)
	HWND child = getItem(hwnd, IDC_SCREENS_SRC_SIDE);
	SendMessage(child, CB_ADDSTRING, 0, (LPARAM)TEXT("---"));
	SendMessage(child, CB_ADDSTRING, 0,
							(LPARAM)getString(IDS_EDGE_LEFT).c_str());
	SendMessage(child, CB_ADDSTRING, 0,
							(LPARAM)getString(IDS_EDGE_RIGHT).c_str());
	SendMessage(child, CB_ADDSTRING, 0,
							(LPARAM)getString(IDS_EDGE_TOP).c_str());
	SendMessage(child, CB_ADDSTRING, 0,
							(LPARAM)getString(IDS_EDGE_BOTTOM).c_str());

	// create error boxes
	m_srcSideError   = createErrorBox(hwnd);
	m_srcScreenError = createErrorBox(hwnd);
	m_dstScreenError = createErrorBox(hwnd);
	resizeErrorBoxes();

	m_selectedLink = -1;
	m_editedLink   = CEdgeLink();
	m_edgeLinks.clear();
	updateScreens(hwnd, "");
	updateScreensControls(hwnd);
	updateLinks(hwnd);
	updateLinksControls(hwnd);
}
示例#5
0
void LinksDialog::changedSortRank( int index )
{
	/* update */
	if (!rsRanks)
		return;

	/* translate */
	uint32_t type = 0;
	switch (index)
	{
		case 1:
			type = RS_RANK_TIME;
			break;
		case 2:
			type = RS_RANK_SCORE;
			break;
		default:
		case 0:
			type = RS_RANK_ALG;
			break;
	}

	if (type)
	{
		rsRanks->setSortMethod(type);
	}
	updateLinks();
}
示例#6
0
void
CScreensLinks::removeLink(HWND hwnd)
{
	if (m_editedLink.disconnect(m_config)) {
		updateLinks(hwnd);
		updateLinksControls(hwnd);
	}
}
示例#7
0
void
CScreensLinks::addLink(HWND hwnd)
{
	if (m_editedLink.connect(m_config)) {
		m_editedLink = CEdgeLink();
		updateLinks(hwnd);
		updateLinksControls(hwnd);
	}
}
示例#8
0
// This method insures that context is never NULL (using BaseContext::getDefault() instead)
// and that all slaves of an object share its context
void BaseObject::changeContextLink(BaseContext* before, BaseContext*& after)
{
    if (!after) after = BaseContext::getDefault();
    if (before == after) return;
    for (unsigned int i = 0; i < l_slaves.size(); ++i) l_slaves.get(i)->l_context.set(after);
    if (after != BaseContext::getDefault())
    {
        // update links
        updateLinks(false);
    }
}
示例#9
0
void
CScreensLinks::addScreen(HWND hwnd)
{
	CAddScreen dialog(hwnd, m_config, "");
	if (dialog.doModal()) {
		updateScreens(hwnd, dialog.getName());
		updateScreensControls(hwnd);
		updateLinks(hwnd);
		updateLinksControls(hwnd);
	}
}
示例#10
0
void
CScreensLinks::removeScreen(HWND hwnd)
{
	// remove screen from config (this also removes aliases)
	m_config->removeScreen(getSelectedScreen(hwnd));

	// update dialog
	updateScreens(hwnd, "");
	updateScreensControls(hwnd);
	updateLinks(hwnd);
	updateLinksControls(hwnd);
}
示例#11
0
void LinksDialog::checkUpdate()
{
	std::cerr << "In linksDialog::checkUpdate()" << std::endl;
	/* update */
	if (!rsRanks)
	{
		std::cerr << "  rsRanks = 0 !!!!" << std::endl;
		return;
	}

	if (rsRanks->updated())
	{
		std::cerr << "  rsRanks was updated -> redraw()" << std::endl;
		updateLinks();
	}

	return;
}
示例#12
0
void SceneGraphEditor::updateGraph()
{
    int xpos = 50;
    int ypos = 50;

    clearGraph();

    std::vector<int> uids;

    // disabled selection as root for testing
    //feather::qml::command::get_selected_nodes(uids);
    uids.push_back(0);

    std::cout << uids.size() << " nodes are selected\n";

    std::for_each(uids.begin(),uids.end(),[](int& n){ std::cout << n << ","; });

    updateNode(nullptr,0,xpos,ypos);
    for(auto n : m_nodes) 
        updateLinks(n->uid());
}
示例#13
0
void
CScreensLinks::editScreen(HWND hwnd)
{
	CString oldName = getSelectedScreen(hwnd);
	CAddScreen dialog(hwnd, m_config, oldName);
	if (dialog.doModal()) {
		CString newName = dialog.getName();

		// rename screens in the edge list
		if (newName != oldName) {
			for (size_t i = 0; i < m_edgeLinks.size(); ++i) {
				m_edgeLinks[i].rename(oldName, newName);
			}
			m_editedLink.rename(oldName, newName);
		}

		updateScreens(hwnd, newName);
		updateScreensControls(hwnd);
		updateLinks(hwnd);
		updateLinksControls(hwnd);
	}
}
示例#14
0
void
CScreensLinks::updateLink(HWND hwnd)
{
	updateLinkValid(hwnd, m_editedLink);

	// update link in config
	if (m_selectedLink != -1 && m_editedLinkIsValid) {
		// editing an existing link and entry is valid
		if (m_edgeLinks[m_selectedLink].disconnect(m_config)) {
			// successfully removed old link
			if (!m_editedLink.connect(m_config)) {
				// couldn't set new link so restore old link
				m_edgeLinks[m_selectedLink].connect(m_config);
			}
			else {
				m_edgeLinks[m_selectedLink] = m_editedLink;
				updateLinks(hwnd);
				updateLinkEditControls(hwnd, m_editedLink);
			}
		}
	}

	updateLinkView(hwnd);
}
示例#15
0
void LinksDialog::addLinkComment( void )
{
	/* get the title / link / comment */
	QString title = ui.titleLineEdit->text();
	QString link = ui.linkLineEdit->text();
	QString comment = ui.linkTextEdit->toPlainText();
	int32_t   score = IndexToScore(ui.scoreBox->currentIndex());

	if ((mLinkId == "") || (ui.anonBox->isChecked()))
	{
		if ((link == "") || (title == ""))
		{
			QMessageBox::warning ( NULL, tr("Add Link Failure"), tr("Missing Link and/or Title"), QMessageBox::Ok);
			/* can't do anything */
			return;
		}

		/* add it either way */
		if (ui.anonBox->isChecked())
		{
			rsRanks->anonRankMsg("", link.toStdWString(), title.toStdWString());
		}
		else
		{
			rsRanks->newRankMsg(
				link.toStdWString(),
				title.toStdWString(),
				comment.toStdWString(), score);
		}

		updateLinks();
		return;
	}

	/* get existing details */

	RsRankDetails detail;
	if (!rsRanks->getRankDetails(mLinkId, detail))
	{
		/* strange error! */
		QMessageBox::warning ( NULL, tr("Add Link Failure"), tr("Missing Link Data"), QMessageBox::Ok);
		return;
	}

	if (link.toStdWString() == detail.link) /* same link! - we can add a comment */
	{
		if (comment == "") /* no comment! */
		{
			QMessageBox::warning ( NULL, tr("Add Link Failure"), tr("Missing Comment"), QMessageBox::Ok);
			return;
		}

		rsRanks->updateComment(mLinkId,
			comment.toStdWString(),
			score);
	}
	else
	{
		QMessageBox::StandardButton sb = QMessageBox::Yes;

		if ((title.toStdWString() == detail.title) /* same title! - wrong */
		     || (title == ""))
		{
			sb = QMessageBox::question ( NULL, tr("Link Title Not Changed"), tr("Do you want to continue?"), (QMessageBox::Yes | QMessageBox::No));
		}

		/* add Link! */
		if (sb == QMessageBox::Yes)
		{
			rsRanks->newRankMsg(
				link.toStdWString(),
				title.toStdWString(),
				comment.toStdWString(),
				score);
		}
	}
	updateLinks();
	return;
}
示例#16
0
文件: canvas.cpp 项目: trec21/452p1
void Canvas::rotateCCW()
{
    int linkNum = getAxis() - 1;
    updateLinks(links[linkNum], -1*BASE_ANGLE);
}