src/history.cpp

Sat, 01 Jun 2013 20:09:31 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sat, 01 Jun 2013 20:09:31 +0300
changeset 266
12e7302f14e9
parent 265
955c0aabfebf
child 271
d5ec224c1879
permissions
-rw-r--r--

Make LDObject's color and parent properties with accessors

/*
 *  LDForge: LDraw parts authoring CAD
 *  Copyright (C) 2013 Santeri Piippo
 *  
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *  
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "history.h"
#include "ldtypes.h"
#include "file.h"
#include "misc.h"
#include "gui.h"

EXTERN_ACTION (undo)
EXTERN_ACTION (redo)

History::History () {
	setPos (-1);
}

void History::undo () {
	
}

void History::redo () {
	
}

void History::clear () {
	
}

void History::updateActions () {
	ACTION (undo)->setEnabled (false);
	ACTION (redo)->setEnabled (false);
}

void History::open () {
	if (opened ())
		return;
	
	setOpened (true);
}

void History::close () {
	if (!opened ())
		return;
	
	setOpened (false);
	if (m_currentArchive.size () == 0)
		return;
	
	while (pos () < size () - 1)
		m_entries.erase (size () - 1);
	
	m_entries << m_currentArchive;
	m_currentArchive.clear ();
	setPos (pos () + 1);
	updateActions ();
}

void History::add (AbstractHistoryEntry* entry) {
	assert (opened ());
	m_currentArchive << entry;
}

mercurial