cgma
|
00001 //- Class: UndoCommands 00002 //- Description: Provides main undo capability for Cubit system 00003 //- Owner: Ray J. Meyers 00004 //- Checked by: 00005 //- Version: $Id: 00006 00007 #include "CubitUndo.hpp" 00008 #include "CubitString.hpp" 00009 00010 CubitUndo* CubitUndo::mInstance = 0; 00011 00012 CubitUndo::CubitUndo() 00013 { 00014 if(mInstance) 00015 { 00016 assert(0); 00017 // if you want a new instance in place of a previous one, 00018 // delete the previous one first 00019 } 00020 mInstance = this; 00021 } 00022 00023 CubitUndo::~CubitUndo() 00024 { 00025 mInstance = 0; 00026 } 00027 00028 void CubitUndo::start_undo_group() 00029 { 00030 if(!mInstance ) return; 00031 mInstance->p_start_undo_group(); 00032 } 00033 00034 void CubitUndo::end_undo_group() 00035 { 00036 if(!mInstance ) return; 00037 mInstance->p_end_undo_group(); 00038 } 00039 00040 void CubitUndo::set_undo_enabled(bool value) 00041 { 00042 if(!mInstance ) return; 00043 mInstance->p_set_undo_enabled( value ); 00044 } 00045 00046 bool CubitUndo::get_undo_enabled() 00047 { 00048 if(!mInstance ) return false; 00049 return mInstance->p_get_undo_enabled(); 00050 } 00051 00052 void CubitUndo::clear_undo_groups() 00053 { 00054 if(!mInstance ) return; 00055 mInstance->p_clear_undo_groups(); 00056 } 00057 00058 int CubitUndo::execute_undo() 00059 { 00060 if(!mInstance ) 00061 return 0; 00062 00063 return mInstance->p_execute_undo(); 00064 } 00065 00066 void CubitUndo::remove_last_undo() 00067 { 00068 if(!mInstance ) return; 00069 mInstance->p_remove_last_undo(); 00070 } 00071 00072 00073 void CubitUndo::remove_last_undo_group() 00074 { 00075 if(!mInstance ) return; 00076 mInstance->p_remove_last_undo_group(); 00077 } 00078 00079 void CubitUndo::save_state() 00080 { 00081 if(!mInstance ) return; 00082 mInstance->p_save_state(); 00083 } 00084 00085 void CubitUndo::save_state_with_cubit_file(DLIList<RefVolume*> &volumes_to_save ) 00086 { 00087 if(!mInstance ) return; 00088 mInstance->p_save_state_with_cubit_file( volumes_to_save ); 00089 } 00090 00091 void CubitUndo::save_state_with_cubit_file(RefFace *face_to_save ) 00092 { 00093 if(!mInstance ) return; 00094 mInstance->p_save_state_with_cubit_file( face_to_save ); 00095 } 00096 00097 void CubitUndo::save_state_with_cubit_file(RefVolume *volume_to_save ) 00098 { 00099 if(!mInstance ) return; 00100 mInstance->p_save_state_with_cubit_file( volume_to_save ); 00101 } 00102 00103 void CubitUndo::save_state_with_cubit_file( DLIList<MRefVolume*> &volumes_to_save ) 00104 { 00105 if(!mInstance ) return; 00106 mInstance->p_save_state_with_cubit_file( volumes_to_save ); 00107 } 00108 void CubitUndo::save_state_with_cubit_file(DLIList<RefFace*> &faces_to_save ) 00109 { 00110 if(!mInstance ) return; 00111 mInstance->p_save_state_with_cubit_file( faces_to_save ); 00112 } 00113 00114 void CubitUndo::save_state_with_cubit_file(DLIList<RefEdge*> &edges_to_save ) 00115 { 00116 if(!mInstance ) return; 00117 mInstance->p_save_state_with_cubit_file( edges_to_save ); 00118 } 00119 00120 void CubitUndo::save_state_with_cubit_file(DLIList<RefVertex*> &verts_to_save, 00121 bool save_only_if_free ) 00122 { 00123 if(!mInstance ) return; 00124 mInstance->p_save_state_with_cubit_file( verts_to_save, save_only_if_free ); 00125 } 00126 00127 void CubitUndo::save_state_with_cubit_file( DLIList<Body*> &bodies_to_save, 00128 DLIList<RefEntity*> *free_ents_to_save ) 00129 { 00130 if(!mInstance ) return; 00131 mInstance->p_save_state_with_cubit_file( bodies_to_save, free_ents_to_save ); 00132 } 00133 00134 void CubitUndo::note_result_body( Body *body_to_delete ) 00135 { 00136 if(!mInstance ) return; 00137 mInstance->p_note_result_body( body_to_delete ); 00138 } 00139 00140 void CubitUndo::note_result_bodies( DLIList<Body*> &bodies_to_delete ) 00141 { 00142 if(!mInstance ) return; 00143 mInstance->p_note_result_bodies( bodies_to_delete ); 00144 } 00145 00146 void CubitUndo::retain_mesh_on_result_bodies( DLIList<Body*> &bodies ) 00147 { 00148 if(!mInstance ) return; 00149 mInstance->p_retain_mesh_on_result_bodies( bodies ); 00150 } 00151 00152 void CubitUndo::retain_mesh_on_result_curves( DLIList<RefEdge*> &curves ) 00153 { 00154 if(!mInstance ) return; 00155 mInstance->p_retain_mesh_on_result_curves( curves ); 00156 } 00157 00158 void CubitUndo::retain_mesh_on_result_vertices( DLIList<RefVertex*> &verts ) 00159 { 00160 if(!mInstance ) return; 00161 mInstance->p_retain_mesh_on_result_vertices( verts ); 00162 } 00163 00164 void CubitUndo::note_result_boundary_conditions( RefEntity *owner_entity ) 00165 { 00166 if(!mInstance ) return; 00167 mInstance->p_note_result_boundary_conditions( owner_entity ); 00168 } 00169 00170 void CubitUndo::note_result_entity( RefEntity *entity_to_delete ) 00171 { 00172 if(!mInstance ) return; 00173 mInstance->p_note_result_entity( entity_to_delete ); 00174 } 00175 00176 void CubitUndo::note_result_entities( DLIList<MRefVolume*> &vols_to_delete ) 00177 { 00178 if(!mInstance ) return; 00179 mInstance->p_note_result_entities( vols_to_delete ); 00180 } 00181 00182 void CubitUndo::note_result_entities( DLIList<RefEntity*> &entities_to_delete ) 00183 { 00184 if(!mInstance ) return; 00185 mInstance->p_note_result_entities( entities_to_delete ); 00186 } 00187 00188 void CubitUndo::set_undo_by_restoring_state() 00189 { 00190 if(!mInstance ) return; 00191 mInstance->p_set_undo_by_restoring_state(); 00192 } 00193 00194 void CubitUndo::set_undo_by_command(CubitString undo_command_string) 00195 { 00196 if(!mInstance ) return; 00197 mInstance->p_set_undo_by_command( undo_command_string ); 00198 } 00199 00200 int CubitUndo::number_undo_groups() 00201 { 00202 if(!mInstance ) return 0; 00203 return mInstance->p_number_undo_groups(); 00204 } 00205 00206 void CubitUndo::create_dummy_undo_object() 00207 { 00208 if(!mInstance ) return; 00209 mInstance->p_create_dummy_undo_object(); 00210 } 00211 00212 bool CubitUndo::inside_undo_group() 00213 { 00214 if(!mInstance ) return false; 00215 return mInstance->p_inside_undo_group(); 00216 } 00217 00218 void CubitUndo::save_mesh_size_data( MRefEntity *entity ) 00219 { 00220 if(!mInstance ) return; 00221 mInstance->p_save_mesh_size_data( entity ); 00222 } 00223 00224 void CubitUndo::save_mesh_scheme_data( MRefEntity *entity ) 00225 { 00226 if(!mInstance ) return; 00227 mInstance->p_save_mesh_scheme_data( entity ); 00228 } 00229 00230 void CubitUndo::save_smooth_scheme_data( MRefEntity *entity ) 00231 { 00232 if(!mInstance ) return; 00233 mInstance->p_save_smooth_scheme_data( entity ); 00234 } 00235 00236 void CubitUndo::save_all_mesh_data( MRefEntity *entity ) 00237 { 00238 if(!mInstance ) return; 00239 mInstance->p_save_all_mesh_data( entity ); 00240 } 00241 00242 void CubitUndo::save_merge_data( DLIList<RefEntity*> &ents, bool merging ) 00243 { 00244 if(!mInstance ) return; 00245 mInstance->p_save_merge_data( ents, merging ); 00246 } 00247 00248 void CubitUndo::save_mesh_state_before_smoothing( MRefEntity *entity ) 00249 { 00250 if(!mInstance ) return; 00251 DLIList<MRefEntity*> ents_to_smooth(1); 00252 ents_to_smooth.append( entity ); 00253 mInstance->p_save_mesh_state_before_smoothing( ents_to_smooth ); 00254 } 00255 00256 void CubitUndo::save_mesh_state_before_smoothing( DLIList<MRefEntity*> &ents_to_smooth ) 00257 { 00258 if(!mInstance ) return; 00259 mInstance->p_save_mesh_state_before_smoothing( ents_to_smooth ); 00260 } 00261 00262 void CubitUndo::save_mesh_state_before_smoothing( DLIList<MeshEntity*> &ents_to_smooth ) 00263 { 00264 if(!mInstance ) return; 00265 mInstance->p_save_mesh_state_before_smoothing( ents_to_smooth ); 00266 } 00267