Exemplo n.º 1
0
void debug_view_disasm::set_right_column(disasm_right_column contents)
{
	begin_update();
	m_right_column = contents;
	m_recompute = m_update_pending = true;
	end_update();
}
Exemplo n.º 2
0
void debug_view_disasm::set_expression(const char *expression)
{
	begin_update();
	m_expression.set_string(expression);
	m_recompute = m_update_pending = true;
	end_update();
}
Exemplo n.º 3
0
Arquivo: blob.c Projeto: jlsandell/tig
static bool
blob_open(struct view *view, enum open_flags flags)
{
	static const char *blob_argv[] = {
		"git", "cat-file", "blob", "%(blob)", NULL
	};

	if (!view->env->blob[0] && view->env->file[0]) {
		const char *commit = view->env->commit[0] ? view->env->commit : "HEAD";
		char blob_spec[SIZEOF_STR];
		const char *rev_parse_argv[] = {
			"git", "rev-parse", blob_spec, NULL
		};

		if (!string_format(blob_spec, "%s:%s", commit, view->env->file) ||
		    !io_run_buf(rev_parse_argv, view->env->blob, sizeof(view->env->blob))) {
			report("Failed to resolve blob from file name");
			return FALSE;
		}
	}

	if (!view->env->blob[0]) {
		report("No file chosen, press %s to open tree view",
			get_view_key(view, REQ_VIEW_TREE));
		return FALSE;
	}

	view->encoding = get_path_encoding(view->env->file, default_encoding);

	return begin_update(view, NULL, blob_argv, flags);
}
void CKJVPassageNavigator::setPassage(const TPhraseTag &tag)
{
	begin_update();

	TPhraseTag tagUpdated = tag;
	// If we are passed a tag that has a reference to a word of a colophon or superscription,
	//		remove the word selection so that we are referencing just the book or chapter itself:
	if ((tag.relIndex().chapter() == 0) || (tag.relIndex().word() == 0)) {
		tagUpdated = TPhraseTag(CRelIndex(tag.relIndex().book(), tag.relIndex().chapter(), tag.relIndex().verse(), 0), tag.count());
	}

	m_tagPassage = tagUpdated;

	ui.comboTestament->setCurrentIndex(ui.comboTestament->findData(0));
	m_nTestament = 0;
	ui.spinBook->setValue(tagUpdated.relIndex().book());
	m_nBook = tagUpdated.relIndex().book();
	ui.spinChapter->setValue(tagUpdated.relIndex().chapter());
	m_nChapter = tagUpdated.relIndex().chapter();
	ui.spinVerse->setValue(tagUpdated.relIndex().verse());
	m_nVerse = tagUpdated.relIndex().verse();
	ui.spinWord->setValue(tagUpdated.relIndex().word());
	m_nWord = tagUpdated.relIndex().word();
	CalcPassage();

	end_update();
}
Exemplo n.º 5
0
static void open_view(struct view *prev)
{
    struct view *view = &main_view;

    if (view == prev) {
        report("Already in %s view", view->name);
        return;
    }
    
    if (!begin_update(view)) {
        report("Failed to load %s view", view->name);
        return;
    }

    /* Maximize the current view. */
    memset(display, 0, sizeof(display));
    current_view = 0;
    display[current_view] = view; 

    resize_display();

    if (view->pipe) {
        /* Clear the old view and let the incremental updating refill
         * the screen. */
        wclear(view->win);
        report("Loading...");
    }
}
Exemplo n.º 6
0
void debug_view_disasm::set_backward_steps(UINT32 steps)
{
	begin_update();
	m_backwards_steps = steps;
	m_recompute = m_update_pending = true;
	end_update();
}
Exemplo n.º 7
0
void debug_view_disasm::set_disasm_width(UINT32 width)
{
	begin_update();
	m_dasm_width = width;
	m_recompute = m_update_pending = true;
	end_update();
}
Exemplo n.º 8
0
Arquivo: tree.c Projeto: Oblomov/tig
static bool
tree_open(struct view *view, enum open_flags flags)
{
	static const char *tree_argv[] = {
		"git", "ls-tree", "-l", "%(commit)", "%(directory)", NULL
	};

	if (string_rev_is_null(view->env->commit)) {
		report("No tree exists for this commit");
		return FALSE;
	}

	if (view->lines == 0 && repo.prefix[0]) {
		char *pos = repo.prefix;

		while (pos && *pos) {
			char *end = strchr(pos, '/');

			if (end)
				*end = 0;
			push_tree_stack_entry(view, pos, &view->pos);
			pos = end;
			if (end) {
				*end = '/';
				pos++;
			}
		}

	} else if (strcmp(view->vid, view->ops->id)) {
		view->env->directory[0] = 0;
	}

	return begin_update(view, repo.cdup, tree_argv, flags);
}
void CKJVPassageNavigator::startAbsoluteMode(TPhraseTag tagPassage)
{
	assert(!m_pBibleDatabase.isNull());

	begin_update();

	m_tagStartRef = TPhraseTag(CRelIndex(), 1);		// Unset (but one word) to indicate absolute mode

	ui.lblStartRef->hide();
	ui.editStartRef->hide();
	ui.chkboxReverse->setChecked(false);
	ui.chkboxReverse->hide();

	ui.lblTestament->show();
	ui.comboTestament->show();

	ui.lblBook->setText(tr("&Book:", "CKJVPassageNavigator"));
	ui.lblChapter->setText(tr("C&hapter:", "CKJVPassageNavigator"));
	ui.lblVerse->setText(tr("&Verse:", "CKJVPassageNavigator"));
	ui.lblWord->setText(tr("&Word:", "CKJVPassageNavigator"));

	ui.spinBook->setPrefix("");
	ui.spinChapter->setPrefix("");
	ui.spinVerse->setPrefix("");
	ui.spinWord->setPrefix("");

	ui.lblBookDirect->setVisible(true);
	ui.comboBookDirect->setVisible(true);
	ui.lblChapterDirect->setVisible(true);
	ui.comboChapterDirect->setVisible(true);
	ui.lblVerseDirect->setVisible(true);
	ui.comboVerseDirect->setVisible(true);
	ui.lblWordDirect->setVisible(true);
	ui.comboWordDirect->setVisible(true);
	ui.widgetPassageReference->setVisible(true);
	ui.lineDirectReference->setVisible(true);
	ui.linePassageReference->setVisible(true);
	ui.widgetPassageReference->clear();
	ui.widgetPassageReference->setFocus();

	if (tagPassage.relIndex().isSet()) {
		setPassage(tagPassage);
		// setPassage will already call CalcPassage
	} else {
		CalcPassage();
	}

	// If the caller told us to not highlight any words, we will have not done
	//		so above on the setPassage painting, but we'll set it to one word
	//		here so that as the user starts selecting things, his word will
	//		highlighted appear:
	if (m_tagPassage.count() == 0) m_tagPassage.count() = 1;

	emit modeChanged(false);

	end_update();
}
Exemplo n.º 10
0
static bool
stash_open(struct view *view, enum open_flags flags)
{
	static const char *stash_argv[] = { "git", "stash", "list",
		encoding_arg, "--no-color", "--pretty=raw", NULL };
	struct main_state *state = view->private;

	state->with_graph = false;
	watch_register(&view->watch, WATCH_STASH);
	return begin_update(view, NULL, stash_argv, flags | OPEN_RELOAD);
}
Exemplo n.º 11
0
bool
pager_open(struct view *view, enum open_flags flags)
{
	if (!open_from_stdin(flags) && !view->lines && !(flags & OPEN_PREPARED)) {
		report("No pager content, press %s to run command from prompt",
			get_view_key(view, REQ_PROMPT));
		return FALSE;
	}

	return begin_update(view, NULL, NULL, flags);
}
Exemplo n.º 12
0
void debug_view::set_visible_size(debug_view_xy size)
{
	if (size.x != m_visible.x || size.y != m_visible.y)
	{
		begin_update();
		m_visible = size;
		m_update_pending = true;
		view_notify(VIEW_NOTIFY_VISIBLE_CHANGED);
		end_update();
	}
}
Exemplo n.º 13
0
static bool
log_open(struct view *view, enum open_flags flags)
{
	const char *log_argv[] = {
		"git", "log", encoding_arg, commit_order_arg(), "--cc",
			"--stat", "%(logargs)", "%(cmdlineargs)", "%(revargs)",
			"--no-color", "--", "%(fileargs)", NULL
	};

	return begin_update(view, NULL, log_argv, flags);
}
Exemplo n.º 14
0
void debug_view::set_source(const debug_view_source &source)
{
	if (&source != m_source)
	{
		begin_update();
		m_source = &source;
		m_update_pending = true;
		view_notify(VIEW_NOTIFY_SOURCE_CHANGED);
		end_update();
	}
}
Exemplo n.º 15
0
void debug_view::set_cursor_position(debug_view_xy pos)
{
	if (pos.x != m_cursor.x || pos.y != m_cursor.y)
	{
		begin_update();
		m_cursor = pos;
		m_update_pending = true;
		view_notify(VIEW_NOTIFY_CURSOR_CHANGED);
		end_update();
	}
}
Exemplo n.º 16
0
void debug_view::set_cursor_visible(bool visible)
{
	if (visible != m_cursor_visible)
	{
		begin_update();
		m_cursor_visible = visible;
		m_update_pending = true;
		view_notify(VIEW_NOTIFY_CURSOR_CHANGED);
		end_update();
	}
}
Exemplo n.º 17
0
void debug_view::set_visible_position(debug_view_xy pos)
{
	if (pos.x != m_topleft.x || pos.y != m_topleft.y)
	{
		begin_update();
		m_topleft = pos;
		m_update_pending = true;
		view_notify(VIEW_NOTIFY_VISIBLE_CHANGED);
		end_update();
	}
}
void CKJVPassageNavigator::startRelativeMode(TPhraseTag tagStart, bool bReverse, TPhraseTag tagPassage)
{
	assert(!m_pBibleDatabase.isNull());

	begin_update();

	if (tagStart.relIndex().isSet()) {
		m_tagStartRef = tagStart;
	} else {
		m_tagStartRef = TPhraseTag(CRelIndex(1,1,1,1), 1);
	}

	ui.lblTestament->hide();
	ui.comboTestament->hide();

	ui.lblStartRef->show();
	ui.editStartRef->show();
	ui.chkboxReverse->show();

	ui.editStartRef->setText(m_pBibleDatabase->PassageReferenceText(m_tagStartRef.relIndex()));
	ui.chkboxReverse->setChecked(bReverse);

	ui.lblBook->setText(tr("&Books:", "CKJVPassageNavigator"));
	ui.lblChapter->setText(tr("C&hapters:", "CKJVPassageNavigator"));
	ui.lblVerse->setText(tr("&Verses:", "CKJVPassageNavigator"));
	ui.lblWord->setText(tr("&Words:", "CKJVPassageNavigator"));

	ui.lblBookDirect->setVisible(false);
	ui.comboBookDirect->setVisible(false);
	ui.lblChapterDirect->setVisible(false);
	ui.comboChapterDirect->setVisible(false);
	ui.lblVerseDirect->setVisible(false);
	ui.comboVerseDirect->setVisible(false);
	ui.lblWordDirect->setVisible(false);
	ui.comboWordDirect->setVisible(false);
	ui.widgetPassageReference->setVisible(false);
	ui.lineDirectReference->setVisible(false);
	ui.linePassageReference->setVisible(false);
	ui.widgetPassageReference->clear();

	if (!tagPassage.relIndex().isSet()) {
		// If we don't have an absolute starting passage, set the passage size (that we'll calculate from
		//		our zero-relative) to be the size of the starting reference passage:
		tagPassage.count() = tagStart.count();
	}
	setPassage(tagPassage);			// Note: setPassage will already call CalcPassage

	emit modeChanged(true);

	end_update();
}
void CKJVPassageNavigator::setRefType(NAVIGATOR_REF_TYPE_ENUM nRefType)
{
	begin_update();

	int nTypeIndex = ui.comboRefType->findData(static_cast<int>(nRefType));
	assert(nTypeIndex != -1);
	if (nTypeIndex != -1) {
		m_nRefType = nRefType;
		ui.comboRefType->setCurrentIndex(nTypeIndex);
		CalcPassage();
	}

	end_update();
}
Exemplo n.º 20
0
void debug_view_disasm::view_click(const int button, const debug_view_xy& pos)
{
	const debug_view_xy origcursor = m_cursor;
	m_cursor = pos;

	/* cursor popup|toggle */
	bool cursorVisible = true;
	if (m_cursor.y == origcursor.y)
	{
		cursorVisible = !m_cursor_visible;
	}

	/* send a cursor changed notification */
	begin_update();
	m_cursor_visible = cursorVisible;
	view_notify(VIEW_NOTIFY_CURSOR_CHANGED);
	m_update_pending = true;
	end_update();
}
Exemplo n.º 21
0
Arquivo: branch.c Projeto: ebruck/tig
static bool
branch_open(struct view *view, enum open_flags flags)
{
	const char *branch_log[] = {
		"git", "log", encoding_arg, "--no-color", "--date=raw",
			"--pretty=format:commit %H%nauthor %an <%ae> %ad%ntitle %s",
			"--all", "--simplify-by-decoration", NULL
	};

	if (!begin_update(view, NULL, branch_log, OPEN_RELOAD)) {
		report("Failed to load branch data");
		return FALSE;
	}

	branch_open_visitor(view, &branch_all);
	foreach_ref(branch_open_visitor, view);

	return TRUE;
}
Exemplo n.º 22
0
void debug_view_watchpoints::view_click(const int button, const debug_view_xy& pos)
{
	bool const clickedTopRow = (m_topleft.y == pos.y);

	if (clickedTopRow)
	{
		if (pos.x < tableBreaks[0])
			m_sortType = (m_sortType == &cIndexAscending) ? &cIndexDescending : &cIndexAscending;
		else if (pos.x < tableBreaks[1])
			m_sortType = (m_sortType == &cEnabledAscending) ? &cEnabledDescending : &cEnabledAscending;
		else if (pos.x < tableBreaks[2])
			m_sortType = (m_sortType == &cCpuAscending) ? &cCpuDescending : &cCpuAscending;
		else if (pos.x < tableBreaks[3])
			m_sortType = (m_sortType == &cSpaceAscending) ? &cSpaceDescending : &cSpaceAscending;
		else if (pos.x < tableBreaks[4])
			m_sortType = (m_sortType == &cAddressAscending) ? &cAddressDescending : &cAddressAscending;
		else if (pos.x < tableBreaks[5])
			m_sortType = (m_sortType == &cTypeAscending) ? &cTypeDescending : &cTypeAscending;
		else if (pos.x < tableBreaks[6])
			m_sortType = (m_sortType == &cConditionAscending) ? &cConditionDescending : &cConditionAscending;
		else if (pos.x < tableBreaks[7])
			m_sortType = (m_sortType == &cActionAscending) ? &cActionDescending : &cActionAscending;
	}
	else
	{
		// Gather a sorted list of all the watchpoints for all the CPUs
		gather_watchpoints();

		int const wpIndex = pos.y - 1;
		if ((wpIndex >= m_buffer.size()) || (wpIndex < 0))
			return;

		// Enable / disable
		m_buffer[wpIndex]->setEnabled(!m_buffer[wpIndex]->enabled());
	}

	begin_update();
	m_update_pending = true;
	end_update();
}
Exemplo n.º 23
0
Arquivo: xxx.c Projeto: yaomoon/GT2440
static void open_view(struct view *prev)
{
    struct view *view = &main_view;

    if (view == prev) {
#ifdef yaomoon
fprintf(moon_log,"830:view==prev\n");
#endif
        report("Already in %s view", view->name);
        return;
    }
    
    if (!begin_update(view)) {
        report("Failed to load %s view", view->name);
        return;
    }

    /* Maximize the current view. */
    memset(display, 0, sizeof(display));
    current_view = 0;
    display[current_view] = view; 

#ifdef yaomoon
fprintf(moon_log,"847:now view is %s\n",display[current_view]->name);
#endif
    resize_display();

    if (view->pipe) {
        /* Clear the old view and let the incremental updating refill
         * the screen. */
        wclear(view->win);
#ifdef yaomoon
fprintf(moon_log,"855: view->pipe\n");
#endif
        report("Loading...");
    }
#ifdef yaomoon
while(1);
#endif
}
Exemplo n.º 24
0
void RedScreen::update()
{
    if (is_out_of_sync()) {
        return;
    }

    QRegion direct_rgn;
    QRegion composit_rgn;
    QRegion frame_rgn;

    begin_update(direct_rgn, composit_rgn, frame_rgn);
    update_composit(composit_rgn);
    draw_direct(_window, direct_rgn, composit_rgn, frame_rgn);
    composit_to_screen(_window, composit_rgn);
    update_done();
    region_destroy(&direct_rgn);
    region_destroy(&composit_rgn);

    if (_update_by_timer) {
        activate_timer();
    }
}
Exemplo n.º 25
0
Arquivo: blame.c Projeto: peff/tig
static bool
blame_read_file(struct view *view, const char *text, struct blame_state *state)
{
	if (!text) {
		const char *blame_argv[] = {
			"git", "blame", encoding_arg, "%(blameargs)", "--incremental",
				*view->env->ref ? view->env->ref : "--incremental", "--", view->env->file, NULL
		};

		if (failed_to_load_initial_view(view))
			die("No blame exist for %s", view->vid);

		if (view->lines == 0 || !begin_update(view, repo.cdup, blame_argv, OPEN_EXTRA)) {
			report("Failed to load blame data");
			return TRUE;
		}

		if (view->env->lineno > 0) {
			select_view_line(view, view->env->lineno);
			view->env->lineno = 0;
		}

		state->done_reading = TRUE;
		return FALSE;

	} else {
		size_t textlen = strlen(text);
		struct blame *blame;

		if (!add_line_alloc(view, &blame, LINE_ID, textlen, FALSE))
			return FALSE;

		blame->commit = NULL;
		strncpy(blame->text, text, textlen);
		blame->text[textlen] = 0;
		return TRUE;
	}
}
Exemplo n.º 26
0
void debug_view_breakpoints::view_click(const int button, const debug_view_xy& pos)
{
	bool clickedTopRow = (m_topleft.y == pos.y);

	if (clickedTopRow)
	{
		if (pos.x < tableBreaks[0])
			m_sortType = (m_sortType == &cIndexAscending) ? &cIndexDescending : &cIndexAscending;
		else if (pos.x < tableBreaks[1])
			m_sortType = (m_sortType == &cEnabledAscending) ? &cEnabledDescending : &cEnabledAscending;
		else if (pos.x < tableBreaks[2])
			m_sortType = (m_sortType == &cCpuAscending) ? &cCpuDescending : &cCpuAscending;
		else if (pos.x < tableBreaks[3])
			m_sortType = (m_sortType == &cAddressAscending) ? &cAddressDescending : &cAddressAscending;
		else if (pos.x < tableBreaks[4])
			m_sortType = (m_sortType == &cConditionAscending) ? &cConditionDescending : &cConditionAscending;
		else if (pos.x < tableBreaks[5])
			m_sortType = (m_sortType == &cActionAscending) ? &cActionDescending : &cActionAscending;
	}
	else
	{
		// Gather a sorted list of all the breakpoints for all the CPUs
		gather_breakpoints();

		int const bpIndex = pos.y - 1;
		if ((bpIndex >= m_buffer.count()) || (bpIndex < 0))
			return;

		// Enable / disable
		m_buffer[bpIndex]->setEnabled(!m_buffer[bpIndex]->enabled());

		machine().debug_view().update_all(DVT_DISASSEMBLY);
	}

	begin_update();
	m_update_pending = true;
	end_update();
}
void CKJVBrowser::initialize()
{
	// --------------------------------------------------------------

	ui.widgetPassageReference->initialize(m_pBibleDatabase);

	// --------------------------------------------------------------

	//	Swapout the widgetKJVPassageNavigator from the layout with
	//		one that we can set the database on:

	int ndx = ui.gridLayout->indexOf(ui.textBrowserMainText);
	assert(ndx != -1);
	if (ndx == -1) return;
	int nRow;
	int nCol;
	int nRowSpan;
	int nColSpan;
	ui.gridLayout->getItemPosition(ndx, &nRow, &nCol, &nRowSpan, &nColSpan);

	int ndxChapterScrollbar = ui.gridLayout->indexOf(ui.scrollbarChapter);
	assert(ndxChapterScrollbar != -1);
	if (ndxChapterScrollbar == -1) return;
	int nRowChapterScrollbar;
	int nColChapterScrollbar;
	int nRowSpanChapterScrollbar;
	int nColSpanChapterScrollbar;
	ui.gridLayout->getItemPosition(ndxChapterScrollbar, &nRowChapterScrollbar, &nColChapterScrollbar, &nRowSpanChapterScrollbar, &nColSpanChapterScrollbar);

	assert(nRow == nRowChapterScrollbar);
	assert(nColSpan == 1);
	assert(nColSpanChapterScrollbar == 1);

	m_pScriptureBrowser = new CScriptureBrowser(m_pBibleDatabase, this);
	m_pScriptureBrowser->setObjectName(QString::fromUtf8("textBrowserMainText"));
	m_pScriptureBrowser->setMouseTracking(true);
	en_changedScrollbarsEnabled(CPersistentSettings::instance()->scrollbarsEnabled());
	m_pScriptureBrowser->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	m_pScriptureBrowser->setTabChangesFocus(false);
	m_pScriptureBrowser->setTextInteractionFlags(Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard);
	m_pScriptureBrowser->setOpenLinks(false);
	connect(CPersistentSettings::instance(), SIGNAL(changedScrollbarsEnabled(bool)), this, SLOT(en_changedScrollbarsEnabled(bool)));

	bool bChapterScrollNone = (CPersistentSettings::instance()->chapterScrollbarMode() == CSME_NONE);
	bool bChapterScrollLeft = (CPersistentSettings::instance()->chapterScrollbarMode() == CSME_LEFT);

	delete ui.textBrowserMainText;
	delete ui.scrollbarChapter;
	ui.textBrowserMainText = NULL;
	ui.scrollbarChapter = NULL;
	ui.gridLayout->addWidget(m_pScriptureBrowser, nRow, (bChapterScrollLeft ? nColChapterScrollbar : nCol), nRowSpan, (bChapterScrollNone ? (nColSpan + nColSpanChapterScrollbar) : nColSpan));

	if (!bChapterScrollNone) {
		ui.scrollbarChapter = new QScrollBar(this);
		ui.scrollbarChapter->setObjectName(QString::fromUtf8("scrollbarChapter"));
		ui.scrollbarChapter->setOrientation(Qt::Vertical);
		ui.gridLayout->addWidget(ui.scrollbarChapter, nRowChapterScrollbar, (bChapterScrollLeft ? nCol : nColChapterScrollbar), nRowSpanChapterScrollbar, nColSpanChapterScrollbar);
	}

	// Reinsert it in the correct TabOrder:
	QWidget::setTabOrder(ui.comboBkChp, m_pScriptureBrowser);
	QWidget::setTabOrder(m_pScriptureBrowser, ui.comboTstBk);

	// --------------------------------------------------------------

	begin_update();

	unsigned int nBibleChp = 0;
	ui.comboBk->clear();
	ui.comboBibleBk->clear();
	for (unsigned int ndxBk=1; ndxBk<=m_pBibleDatabase->bibleEntry().m_nNumBk; ++ndxBk) {
		const CBookEntry *pBook = m_pBibleDatabase->bookEntry(ndxBk);
		assert(pBook != NULL);
		ui.comboBk->addItem(pBook->m_strBkName, ndxBk);
		ui.comboBibleBk->addItem(QString("%1").arg(ndxBk), ndxBk);
		nBibleChp += pBook->m_nNumChp;
	}
	ui.comboBibleChp->clear();
	for (unsigned int ndxBibleChp=1; ndxBibleChp<=nBibleChp; ++ndxBibleChp) {
		ui.comboBibleChp->addItem(QString("%1").arg(ndxBibleChp), ndxBibleChp);
	}

	// Setup the Chapter Scroller:
	setupChapterScrollbar();

	end_update();
}
Exemplo n.º 28
0
Arquivo: tree.c Projeto: Oblomov/tig
static bool
tree_read_date(struct view *view, struct buffer *buf, struct tree_state *state)
{
	char *text = buf ? buf->data : NULL;

	if (!text && state->read_date) {
		state->read_date = FALSE;
		return TRUE;

	} else if (!text) {
		/* Find next entry to process */
		const char *log_file[] = {
			"git", "log", encoding_arg, "--no-color", "--pretty=raw",
				"--cc", "--raw", view->ops->id, "--", "%(directory)", NULL
		};

		if (!view->lines) {
			tree_entry(view, LINE_HEADER, view->env->directory, NULL, NULL, 0);
			tree_entry(view, LINE_DIRECTORY, "..", "040000", view->ref, 0);
			report("Tree is empty");
			return TRUE;
		}

		if (!begin_update(view, repo.cdup, log_file, OPEN_EXTRA)) {
			report("Failed to load tree data");
			return TRUE;
		}

		state->read_date = TRUE;
		return FALSE;

	} else if (*text == 'c' && get_line_type(text) == LINE_COMMIT) {
		string_copy_rev_from_commit_line(state->commit, text);

	} else if (*text == 'a' && get_line_type(text) == LINE_AUTHOR) {
		parse_author_line(text + STRING_SIZE("author "),
				  &state->author, &state->author_time);

	} else if (*text == ':') {
		char *pos;
		size_t annotated = 1;
		size_t i;

		pos = strrchr(text, '\t');
		if (!pos)
			return TRUE;
		text = pos + 1;
		if (*view->env->directory && !strncmp(text, view->env->directory, strlen(view->env->directory)))
			text += strlen(view->env->directory);
		pos = strchr(text, '/');
		if (pos)
			*pos = 0;

		for (i = 1; i < view->lines; i++) {
			struct line *line = &view->line[i];
			struct tree_entry *entry = line->data;

			annotated += !!entry->author;
			if (entry->author || strcmp(entry->name, text))
				continue;

			string_copy_rev(entry->commit, state->commit);
			entry->author = state->author;
			entry->time = state->author_time;
			line->dirty = 1;
			view_column_info_update(view, line);
			break;
		}

		if (annotated == view->lines)
			io_kill(view->pipe);
	}
	return TRUE;
}
Exemplo n.º 29
0
void debug_view_disasm::view_char(int chval)
{
	debug_view_xy origcursor = m_cursor;
	UINT8 end_buffer = 3;
	INT32 temp;

	switch (chval)
	{
		case DCH_UP:
			if (m_cursor.y > 0)
				m_cursor.y--;
			break;

		case DCH_DOWN:
			if (m_cursor.y < m_total.y - 1)
				m_cursor.y++;
			break;

		case DCH_PUP:
			temp = m_cursor.y - (m_visible.y - end_buffer);
			if (temp < 0)
				m_cursor.y = 0;
			else
				m_cursor.y = temp;
			break;

		case DCH_PDOWN:
			temp = m_cursor.y + (m_visible.y - end_buffer);
			if (temp > m_total.y - 1)
				m_cursor.y = m_total.y - 1;
			else
				m_cursor.y = temp;
			break;

		case DCH_HOME:              // set the active column to the PC
		{
			const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source);
			offs_t pc = source.m_space.address_to_byte(source.m_device.safe_pc()) & source.m_space.logbytemask();

			// figure out which row the pc is on
			for (unsigned int curline = 0; curline < m_byteaddress.size(); curline++)
				if (m_byteaddress[curline] == pc)
					m_cursor.y = curline;
			break;
		}

		case DCH_CTRLHOME:
			m_cursor.y = 0;
			break;

		case DCH_CTRLEND:
			m_cursor.y = m_total.y - 1;
			break;
	}

	/* send a cursor changed notification */
	if (m_cursor.y != origcursor.y)
	{
		begin_update();
		view_notify(VIEW_NOTIFY_CURSOR_CHANGED);
		m_update_pending = true;
		end_update();
	}
}
void CKJVPassageNavigator::initialize()
{
	// --------------------------------------------------------------

	ui.widgetPassageReference->initialize(m_pBibleDatabase);

	// --------------------------------------------------------------

	//	Swapout the editVersePreview from the layout with
	//		one that we can set the database on:

	m_pEditVersePreview = new CScriptureEdit(m_pBibleDatabase, this);
	m_pEditVersePreview->setObjectName(QString::fromUtf8("editVersePreview"));
	m_pEditVersePreview->setMinimumSize(QSize(200, 150));
	m_pEditVersePreview->setMouseTracking(true);
	m_pEditVersePreview->setAcceptDrops(false);
	m_pEditVersePreview->setTabChangesFocus(true);
	m_pEditVersePreview->setUndoRedoEnabled(false);
	m_pEditVersePreview->setTextInteractionFlags(Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse);

	delete ui.editVersePreview;
	ui.editVersePreview = NULL;
	ui.verticalLayoutMain->addWidget(m_pEditVersePreview);

	// Updated Tab Ordering:
	QWidget::setTabOrder(ui.widgetPassageReference, ui.spinWord);
	QWidget::setTabOrder(ui.spinWord, ui.spinVerse);
	QWidget::setTabOrder(ui.spinVerse, ui.spinChapter);
	QWidget::setTabOrder(ui.spinChapter, ui.spinBook);
	QWidget::setTabOrder(ui.spinBook, ui.comboTestament);
	QWidget::setTabOrder(ui.comboTestament, ui.editStartRef);
	QWidget::setTabOrder(ui.editStartRef, ui.editResolved);
	QWidget::setTabOrder(ui.editResolved, ui.editVersePreview);
	QWidget::setTabOrder(ui.editVersePreview, ui.comboBookDirect);
	QWidget::setTabOrder(ui.comboBookDirect, ui.comboChapterDirect);
	QWidget::setTabOrder(ui.comboChapterDirect, ui.comboVerseDirect);
	QWidget::setTabOrder(ui.comboVerseDirect, ui.comboWordDirect);
	QWidget::setTabOrder(ui.comboWordDirect, ui.comboRefType);
	QWidget::setTabOrder(ui.comboRefType, ui.chkboxReverse);

	// Add the ScriptureEdit's editMenu to this widget's actions so that the
	//		keyboard shortcuts work correctly inside this widget:
	addAction(m_pEditVersePreview->getEditMenu()->menuAction());

	// --------------------------------------------------------------

	begin_update();

	m_tagStartRef = TPhraseTag(CRelIndex(), 1);		// Start with default word-size of one so we highlight at least one word when tracking
	m_tagPassage = TPhraseTag(CRelIndex(), 1);		// ""  (ditto)

	int nBooks = 0;
	int nChapters = 0;
	int nVerses = 0;
	int nWords = 0;

	ui.comboTestament->clear();
	for (unsigned int ndx=0; ndx<=m_pBibleDatabase->bibleEntry().m_nNumTst; ++ndx){
		if (ndx == 0) {
			// Search for "Entire Bible".  First try and see if we can translate it in the language of the selected Bible,
			//		but if not, try in the current language setting
			QString strEntireBible = tr("Entire Bible", "Scope");
			TTranslatorPtr pTranslator = CTranslatorList::instance()->translator(m_pBibleDatabase->language());
			if (!pTranslator.isNull()) {
				QString strTemp = pTranslator->translatorApp().translate("CKJVPassageNavigator", "Entire Bible", "Scope");
				if (!strTemp.isEmpty()) strEntireBible = strTemp;
			}
			ui.comboTestament->addItem(strEntireBible, ndx);
		} else {
			ui.comboTestament->addItem(m_pBibleDatabase->testamentEntry(ndx)->m_strTstName, ndx);
			nBooks += m_pBibleDatabase->testamentEntry(ndx)->m_nNumBk;
			nChapters += m_pBibleDatabase->testamentEntry(ndx)->m_nNumChp;
			nVerses += m_pBibleDatabase->testamentEntry(ndx)->m_nNumVrs;
			nWords += m_pBibleDatabase->testamentEntry(ndx)->m_nNumWrd;
		}
	}

	ui.spinBook->setRange(0, nBooks);
	ui.spinChapter->setRange(0, nChapters);
	ui.spinVerse->setRange(0, nVerses);
	ui.spinWord->setRange(0, nWords);

	bool bAllTypes = (m_flagsRefTypes == NRTO_Default);
	ui.comboRefType->clear();
	if ((m_flagsRefTypes & NRTO_Word) || (bAllTypes)) ui.comboRefType->addItem(tr("Word", "Scope"), static_cast<int>(NRTE_WORD));
	if ((m_flagsRefTypes & NRTO_Verse) || (bAllTypes)) ui.comboRefType->addItem(tr("Verse", "Scope"), static_cast<int>(NRTE_VERSE));
	if ((m_flagsRefTypes & NRTO_Chapter) || (bAllTypes)) ui.comboRefType->addItem(tr("Chapter", "Scope"), static_cast<int>(NRTE_CHAPTER));
	if ((m_flagsRefTypes & NRTO_Book) || (bAllTypes)) ui.comboRefType->addItem(tr("Book", "Scope"), static_cast<int>(NRTE_BOOK));
	int nTypeIndex = ui.comboRefType->findData(static_cast<int>(m_nRefType));
	assert(nTypeIndex != -1);
	ui.comboRefType->setCurrentIndex(nTypeIndex);

	ui.comboBookDirect->clear();
	for (unsigned int ndxBk=1; ndxBk<=m_pBibleDatabase->bibleEntry().m_nNumBk; ++ndxBk) {
		const CBookEntry *pBook = m_pBibleDatabase->bookEntry(ndxBk);
		assert(pBook != NULL);
		ui.comboBookDirect->addItem(pBook->m_strBkName, ndxBk);
	}

	end_update();

	startAbsoluteMode();
	reset();
}