1/* 2* Copyright (c) 2018 (https://github.com/phase1geo/Minder) 3* 4* This program is free software; you can redistribute it and/or 5* modify it under the terms of the GNU General Public 6* License as published by the Free Software Foundation; either 7* version 2 of the License, or (at your option) any later version. 8* 9* This program is distributed in the hope that it will be useful, 10* but WITHOUT ANY WARRANTY; without even the implied warranty of 11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12* General Public License for more details. 13* 14* You should have received a copy of the GNU General Public 15* License along with this program; if not, write to the 16* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17* Boston, MA 02110-1301 USA 18* 19* Authored by: Trevor Williams <phase1geo@gmail.com> 20*/ 21 22public class UndoNodeLayout : UndoItem { 23 24 private string _old_layout; 25 private string _new_layout; 26 private Node? _root; 27 28 /* Default constructor */ 29 public UndoNodeLayout( Layout old_layout, Layout new_layout, Node? root_node ) { 30 base( _( "change layout" ) ); 31 _old_layout = old_layout.name; 32 _new_layout = new_layout.name; 33 _root = root_node; 34 } 35 36 /* Performs an undo operation for this data */ 37 public override void undo( DrawArea da ) { 38 da.set_layout( _old_layout, _root, false ); 39 da.loaded(); 40 } 41 42 /* Performs a redo operation */ 43 public override void redo( DrawArea da ) { 44 da.set_layout( _new_layout, _root, false ); 45 da.loaded(); 46 } 47 48} 49