Exemplo n.º 1
0
void EicielXAttrController::open_file(const Glib::ustring& filename) throw (XAttrManagerException)
{
    if (_xattr_manager != NULL)
    {
        delete _xattr_manager;
        _xattr_manager = NULL;
    }

    try
    {
        _xattr_manager = new XAttrManager(filename);
        _opened_file = true;

        _window->set_active(true);

        check_editable();

        _window->fill_attributes(_xattr_manager->get_attributes_list());
    }
    catch (XAttrManagerException e)
    {
        delete _xattr_manager;
        _xattr_manager = NULL;
        _opened_file = false;
        _window->set_active(false);
    }
}
Exemplo n.º 2
0
/* ARGSUSED */
int
undo(int f GCC_UNUSED, int n GCC_UNUSED)
{
    int status;
    L_NUM before;

    TRACE((T_CALLED "undo(%d,%d)\n", f, n));

    if ((status = check_editable(curbp)) == TRUE) {
	before = vl_line_count(curbp);
	if ((status = undoworker(curbp->b_udstkindx)) == TRUE) {
	    if (!line_report(before)) {
		mlwrite("[change %sdone]",
			curbp->b_udstkindx == BACK ? "un" : "re");
	    }
	    curbp->b_udstkindx ^= 1;	/* flip to other stack */
	} else {
	    mlwarn("[No changes to undo]");
	}
    }
    returnCode(status);
}
Exemplo n.º 3
0
int
forwredo(int f, int n)
{
    int status = TRUE;

    TRACE((T_CALLED "forwundo(%d,%d)\n", f, n));

    n = need_at_least(f, n, 1);

    if ((status = check_editable(curbp)) == TRUE) {
	while ((status == TRUE) && n--) {
	    status = undoworker(FORW);
	    if (status) {
		mlwrite("[change redone]");
	    } else {
		mlwarn("[No more changes to redo]");
	    }
	}

	curbp->b_udstkindx = BACK;	/* flip to other stack */
    }
    return status;
}
Exemplo n.º 4
0
int
inf_undo(int f, int n)
{
    int status = TRUE;

    TRACE((T_CALLED "undo(%d,%d)\n", f, n));

    n = need_at_least(f, n, 1);

    if ((status = check_editable(curbp)) == TRUE) {
	curbp->b_udstkindx ^= 1;	/* flip to other stack */
	while ((status == TRUE) && n--) {
	    if ((status = undoworker(curbp->b_udstkindx)) == TRUE) {
		mlwrite("[change %sdone]",
			curbp->b_udstkindx == BACK ? "un" : "re");
	    } else {
		mlwarn("[No more changes to %s]",
		       curbp->b_udstkindx == BACK ? "undo" : "redo");
	    }
	}
	curbp->b_udstkindx ^= 1;	/* flip to other stack */
    }
    returnCode(status);
}
Exemplo n.º 5
0
int
var_CHAR(TBUFF **rp, const char *vp)
{
    int status = FALSE;

    if (rp) {
	if (valid_buffer(curbp) && !is_empty_buf(curbp)) {
	    render_int(rp, CharAtDot());
	} else {
	    tb_scopy(rp, error_val);
	}
	status = TRUE;
    } else if (vp) {
	if ((status = check_editable(curbp)) == TRUE) {
	    int c;
	    mayneedundo();
	    (void) ldel_chars(1L, FALSE);	/* delete 1 char */
	    c = scan_int(vp);
	    if ((status = bputc(c)) == TRUE)
		(void) backchar(FALSE, 1);
	}
    }
    return status;
}