Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshLoader.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshLoader.cpp	(revision 985)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshLoader.cpp	(revision 989)
@@ -15,5 +15,7 @@
 using	namespace	std;
 
+//---------------------------------------------------------------------------
 //	Jump a chunk.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::jumpChunk(FILE	*f)
 {
@@ -24,5 +26,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Read a chunk.
+//---------------------------------------------------------------------------
 unsigned short GeoMeshLoader::readChunk(FILE	*f)
 {
@@ -35,5 +39,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Read geometry vertex element.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readGeometryVertexElement(FILE	*f, Mesh	*geoMesh)
 {
@@ -103,5 +109,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Read geometry vertex declaration.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readGeometryVertexDeclaration(FILE	*f, Mesh	*geoMesh)
 {
@@ -143,5 +151,7 @@
 }//	End readGeometryVertexDeclaration.
 
+//---------------------------------------------------------------------------
 //	Read geometry vertex buffer.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readGeometryVertexBuffer(FILE	*f, Mesh	*geoMesh, int option)
 {
@@ -270,9 +280,14 @@
 		cout	<<	"Error: Source not found."
 					<<	endl;
-	}
-
-}
-
+
+		//	Error.
+		mError	=	true;
+	}
+
+}
+
+//---------------------------------------------------------------------------
 //	Read Geometry.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readGeometry(FILE	*f, Mesh	*geoMesh, int option)
 {
@@ -361,5 +376,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Read a submesh operation.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readSubMeshOperation(	FILE	*f,
 																					Mesh	*geoMesh,
@@ -383,5 +400,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Read a submesh.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readSubMesh(FILE	*f, Mesh	*geoMesh, int option)
 {
@@ -479,4 +498,7 @@
 			cout	<<	"Error: Missing mesh geometry."
 						<<	endl;
+
+			//	Error.
+			mError	=	true;
 		}
 		
@@ -537,5 +559,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Read a mesh lod information.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readMeshLodInfo(FILE	*f, Mesh	*geoMesh)
 {
@@ -572,5 +596,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Read a submesh name table.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readSubMeshNameTable(FILE	*f, Mesh	*geoMesh)
 {
@@ -609,5 +635,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Read a mesh file.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readMesh(FILE	*f, Mesh	*geoMesh, int option)
 {
@@ -741,12 +769,16 @@
 			cout	<<	"Error: Reading failure."
 						<<	endl;
-		}
-	}
-
-}
-
-/*
-		Allocate memory to the array of strips
-*/
+
+			//	Error.
+			mError	=	true;
+		}
+	}
+
+}
+
+
+//---------------------------------------------------------------------------
+//	Allocate memory to the array of strips
+//---------------------------------------------------------------------------
 SubMesh* GeoMeshLoader::BuildStripsGeoSubMesh(SubMesh* geoSubMesh)
 {
@@ -848,5 +880,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Remove degenerate triangles of a submesh given.
+//---------------------------------------------------------------------------
 SubMesh	*	GeoMeshLoader::removeDegenerateTriangles(SubMesh	*geoSubMesh)
 {
@@ -951,5 +985,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Loads a mesh.
+//---------------------------------------------------------------------------
 Mesh* GeoMeshLoader::load(char	*nameFileMesh) 
 {
@@ -961,7 +997,4 @@
 	SubMesh					*geosubmesh;
 
-	//	Initialize the current submesh;
-	currentSubMesh	=	-1;
-	
 	//	Debug.
 	cout	<<	"---------------------------------"
@@ -972,98 +1005,127 @@
 				<<	endl;
 
-	//	Initialize the return value.
-	geoMesh	=	new	Mesh();
+	geoMesh	=	NULL;
 
 	//	Open the mesh file.
-	pFile	=	fopen( nameFileMesh, "rb" );
-
-  if (!pFile)
-  {
+	pFile	=	fopen(nameFileMesh, "rb");
+
+  if (pFile)
+	{
+		//	Initialize the current submesh;
+		currentSubMesh	=	-1;
+
+		//	Initialize the return value.
+		geoMesh	=	new	Mesh();
+
+		//	Count the submeshes
+		//	and next build the geomesh.
+		for (int option = 0; option < 2;option++)
+		{
+			//	Initialize Error.
+			mError	=	false;
+	
+			fread(&uno,sizeof(unsigned short),1,pFile);
+
+			if (uno != M_HEADER)
+			{
+				//	Debug.
+				cout	<<	"Error: Header not found."
+					<<	endl;
+
+				//	Error.
+				mError	=	true;
+			}
+
+			// Read version.
+			fgets(version,255,pFile);
+
+			cout	<<	version	<<	endl;
+
+			if (strcmp(version,"[MeshSerializer_v1.30]\n"))
+			{
+				//	Debug.
+				cout	<<	"Error: Wrong mesh version."
+					<<	endl
+					<<	"Only version 1.3 or older allowed."
+					<<	endl;
+
+				//	Error.
+				mError	=	true;
+			}
+
+			while(!feof(pFile))
+			{
+				chunkID = readChunk(pFile);
+
+				switch (chunkID)
+				{
+					case M_MESH:
+						readMesh(pFile, geoMesh, option);
+						break;
+				}
+			}
+
+			//	Create the submesh array.
+			if (option == SUBMESH_COUNT)
+			{
+				geoMesh->mSubMesh	= new SubMesh[geoMesh->mSubMeshCount];
+			}
+
+			//	Move the curso to the begining of the file.
+			fseek(pFile,0,SEEK_SET);
+		}
+
+		//	Goes to the end of the file.
+		fseek(pFile,0,SEEK_END);
+
+		//	Gets the size of the file.
+		mFileSize	=	ftell(pFile);
+
+		// Close the mesh file.
+		fclose(pFile);
+
+		//	If no error.
+		if (!mError)
+		{
+			for (int submesh = 0;	submesh < geoMesh->mSubMeshCount; submesh++)
+			{
+				//	Gets the actual submesh.
+				geosubmesh	=	&geoMesh->mSubMesh[submesh];
+
+				if (geosubmesh->mType == Geometry::GEO_TRIANGLE_STRIPS)
+				{
+					//	Fill the strips list.
+					geosubmesh	=	BuildStripsGeoSubMesh(geosubmesh);
+				}
+			}
+
+			//	Sets coods between -1 and 1.
+			normalizeModel(geoMesh);
+		}
+	}
+	else
+	{
 		//	Debug.
-		cout	<<	"Error: File "
-					<<	nameFileMesh
-					<<	" not found."
+		cout	<<	"Error: File not found."
 					<<	endl;
+
+		//	File not found.
+		mError	=	true;
+	}
+
+	//	If an error happens.
+	if (mError)
+	{
+		delete	geoMesh;
 		
-		exit(0);
-  }
-
-	//	Count the submeshes
-	//	and next build the geomesh.
-	for (int option = 0; option < 2;option++)
-	{
-		fread(&uno,sizeof(unsigned short),1,pFile);
-
-		if (uno != M_HEADER)
-		{
-			//	Debug.
-			cout	<<	"Error: Header not found."
-						<<	endl;
-		}
-
-		// Read version.
-		fgets(version,255,pFile);
-
-		cout	<<	version	<<	endl;
-
-		if (strcmp(version,"[MeshSerializer_v1.30]\n"))
-		{
-			//	Debug.
-			cout	<<	"Error: Wrong mesh version."
-						<<	endl
-						<<	"Only version 1.3 or older allowed."
-						<<	endl;
-		}
-
-		while(!feof(pFile))
-		{
-			chunkID = readChunk(pFile);
-
-			switch (chunkID)
-			{
-				case M_MESH:
-					readMesh(pFile, geoMesh, option);
-					break;
-			}
-		}
-
-		//	Create the submesh array
-		if (option == SUBMESH_COUNT)
-		{		
-			geoMesh->mSubMesh	= new SubMesh[geoMesh->mSubMeshCount];
-		}
-							
-		//	Move the curso to the begining of the file.
-		fseek(pFile,0,SEEK_SET);
-	}
-
-	//	Goes to the end of the file.
-	fseek(pFile,0,SEEK_END);
-
-	//	Gets the size of the file.
-	mFileSize	=	ftell(pFile);
-	
-	// Close the mesh file.
-	fclose(pFile);
-	
-	for (int submesh = 0;	submesh < geoMesh->mSubMeshCount; submesh++)
-	{
-		//	Gets the actual submesh.
-		geosubmesh	=	&geoMesh->mSubMesh[submesh];
-		
-		if (geosubmesh->mType == Geometry::GEO_TRIANGLE_STRIPS)
-		{
-			//	Fill the strips list.
-			geosubmesh	=	BuildStripsGeoSubMesh(geosubmesh);
-		}
-	}
-	
-	//	Sets coods between -1 and 1.
-	normalizeModel(geoMesh);
-
+		geoMesh	=	NULL;
+	}
+	
 	return	geoMesh;
 }
 
+//---------------------------------------------------------------------------
 //	Sets coords between -1 and 1.
+//---------------------------------------------------------------------------
 void	GeoMeshLoader::normalizeModel(Mesh	*geoMesh)
 {
@@ -1187,5 +1249,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Get the size in bytes of the file.
+//---------------------------------------------------------------------------
 size_t	GeoMeshLoader::getFileSize()
 {
@@ -1193,5 +1257,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Constructor
+//---------------------------------------------------------------------------
 GeoMeshLoader::GeoMeshLoader()
 {
@@ -1200,5 +1266,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Destroyer.
+//---------------------------------------------------------------------------
 GeoMeshLoader::~GeoMeshLoader()
 {
@@ -1206,5 +1274,7 @@
 }
 
-//OSCAR
+//---------------------------------------------------------------------------
+//	Read bones of the submesh.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readSubMeshBoneAssignment(FILE* f, SubMesh* geoSubMesh,int option)
 {
@@ -1224,5 +1294,7 @@
 }
 
-//OSCAR
+//---------------------------------------------------------------------------
+//	Read bones of the main mesh.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readMeshBoneAssignment(FILE* f, Mesh* geoMesh,int option)
 {
@@ -1243,5 +1315,7 @@
 }
 
-//OSCAR
+//---------------------------------------------------------------------------
+//	Read skeleton link.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readSkeletonLink(FILE* f, Mesh* geoMesh,int option)
 {
@@ -1259,5 +1333,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Read bounding box settings.
+//---------------------------------------------------------------------------
 void	GeoMeshLoader::readMeshBounds(FILE	*f, Mesh	*geoMesh,	int	option)
 {
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp	(revision 988)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp	(revision 989)
@@ -83,8 +83,15 @@
 //	Save As Callback
 //---------------------------------------------------------------------------
-inline void GeoMeshViewUI::cb_menuOpenSaveAs_i(fltk::Item*, void*)
+inline void GeoMeshViewUI::cb_menuFileSaveAs_i(fltk::Item*, void*)
 {
 	fltk::FileChooser *fcho;
 	GeoMeshSaver			*mesh_saver;
+	char							file_name[255];
+	char							message[255];
+	char							*ptr;
+	int								answer_yes;
+	
+	//	Initialize answer to yes.
+	answer_yes	=	1;
 	
 	if (mGeoMesh != NULL)
@@ -99,9 +106,43 @@
 		if (fcho->value())
 		{
-			mesh_saver	=	new	GeoMeshSaver();
-			mesh_saver->save(mGeoMesh,filename_name(fcho->value()));
-			delete	mesh_saver;
+			//	Gets file name.
+			strcpy(file_name,fcho->value());
+
+			//	Cut extension.
+			ptr				=	strtok(file_name,".");
+
+			//	If has extension.
+			if (ptr)
+			{
+				strcpy(file_name,ptr);
+			}
+
+			//	Adds mesh extension.
+			strcat(file_name,".mesh");
+
+			//	If File Exists.
+			if (fileExists(file_name))
+			{
+				//	Compose message.
+				strcpy(message,"Do you want to replace ");
+				strcat(message,file_name);
+				strcat(message,"?");
+
+				//	Question.
+				answer_yes	=	fltk::ask(message);
+			}
+
+			//	If answer yes to replace question.
+			//	or if file not exists.
+			if (answer_yes)
+			{
+				mesh_saver	=	new	GeoMeshSaver();
+
+
+				mesh_saver->save(mGeoMesh,filename_name(file_name));
+
+				delete	mesh_saver;
+			}
 		}
-
 		//	Repaint the window.
 		mMainWindow->redraw();
@@ -111,9 +152,9 @@
 }
 
-void GeoMeshViewUI::cb_menuOpenSaveAs(fltk::Item* o, void* v)
-{
-  ((GeoMeshViewUI*)	(o->parent()->parent()->parent()->user_data()))
-										->
-										cb_menuOpenSaveAs_i(o,v);
+void GeoMeshViewUI::cb_menuFileSaveAs(fltk::Item* o, void* v)
+{
+  ((GeoMeshViewUI*)	(o->parent()->parent()->parent()->user_data()))
+										->
+										cb_menuFileSaveAs_i(o,v);
 }
 
@@ -210,14 +251,14 @@
 //	Quit Callback
 //---------------------------------------------------------------------------
-inline void GeoMeshViewUI::cb_menuOpenQuit_i(fltk::Item*, void*)
+inline void GeoMeshViewUI::cb_menuFileQuit_i(fltk::Item*, void*)
 {
 	delete	this;
 }
 
-void GeoMeshViewUI::cb_menuOpenQuit(fltk::Item* o, void* v)
-{
-  ((GeoMeshViewUI*)	(o->parent()->parent()->parent()->user_data()))
-										->
-										cb_menuOpenQuit_i(o,v);
+void GeoMeshViewUI::cb_menuFileQuit(fltk::Item* o, void* v)
+{
+  ((GeoMeshViewUI*)	(o->parent()->parent()->parent()->user_data()))
+										->
+										cb_menuFileQuit_i(o,v);
 }
 
@@ -710,6 +751,4 @@
 	openMeshFile();
 	
-	//	Show title.
-	mProcessTitle->label("Visualize LodStrips");
 
 	//	If an object is loaded.
@@ -735,9 +774,11 @@
 		//	Free memory.
 		delete	fcho;
-	}
 
 	//	Hide the right panel.
 	hideRightPanel();
 
+	//	Show title.
+	mProcessTitle->label("Visualize LodStrips");
+
 	//	Show the Visulize LodStrips panel.
 	showLodStripSlider();
@@ -745,6 +786,7 @@
 	//	Repaint the window.
 	mMainWindow->redraw();
-}
-
+
+	}
+}
 
 inline void GeoMeshViewUI::cb_menuLodTreesVisualize_i(fltk::Item*, void*)
@@ -752,5 +794,5 @@
 	fltk::FileChooser *fcho;
 	const	char				*lod_file;
-	
+
 	//	Sets menus application state to NONE.
 	mApplicationState	=	NONE;
@@ -762,74 +804,80 @@
 	//	Loads a mesh file.
 	openMeshFile();
-	
-	//	Show title.
-	mProcessTitle->label("Visualize LodTrees");
 
 	/*if (geoMeshView->getLeavesSubmesh()==-1)
-	{
+		{
 		fltk::alert("No se ha seleccionado el submesh de hojas!");
 		return;
-	}*/
-
-	// POR AHORA SE SELECCIONA EL PRIMER SUBMESH QUE NO ES STRIPS COMO HOJAS
-	int leafsSubMeshID = -1;
-	for (int i=0; i<mGeoMesh->mSubMeshCount; i++)
-		if (mGeoMesh->mSubMesh[i].mType==GEO_TRIANGLE_LIST)
-		{
-			leafsSubMeshID=i;
-			break;
-		}
-
-
+		}*/
 
 	//	If an object is loaded.
 	if (mGeoMesh != NULL)
 	{
-		fcho	=	new fltk::FileChooser("",
-				"*.lod",
-				fltk::FileChooser::CREATE,
-				"Open Lod file");
-
-		fcho->exec();
-
-		//	If a file was selected.
-		if (fcho->value())
+		// POR AHORA SE SELECCIONA EL PRIMER SUBMESH QUE NO ES STRIPS COMO HOJAS
+		int leafsSubMeshID = -1;
+
+		for (int i=0; i<mGeoMesh->mSubMeshCount; i++)
 		{
-			//	Build lod strips library.
-
-			std::string lodstripFile(fcho->value());
-			delete fcho;
+			if (mGeoMesh->mSubMesh[i].mType==GEO_TRIANGLE_LIST)
+			{
+				leafsSubMeshID=i;
+				break;
+			}
+		}
+
+		//	If an object is loaded.
+		if (mGeoMesh != NULL)
+		{
 			fcho	=	new fltk::FileChooser("",
-					"*.leafseq",
+					"*.lod",
 					fltk::FileChooser::CREATE,
-					"Open LeafSeq file");
+					"Open Lod file");
 
 			fcho->exec();
 
+			//	If a file was selected.
 			if (fcho->value())
 			{
-				std::string leafseqFile(fcho->value());
-
-				setLodTreesLibrary(lodstripFile, leafseqFile, mGeoMesh, leafsSubMeshID);
-
-				//	Sets the aplication mode.
-				mApplicationState	=	VISUALIZE_LODTREES;
+				//	Build lod strips library.
+
+				std::string lodstripFile(fcho->value());
+				delete fcho;
+				fcho	=	new fltk::FileChooser("",
+						"*.leafseq",
+						fltk::FileChooser::CREATE,
+						"Open LeafSeq file");
+
+				fcho->exec();
+
+				if (fcho->value())
+				{
+					std::string leafseqFile(fcho->value());
+
+					setLodTreesLibrary(lodstripFile, leafseqFile, mGeoMesh, leafsSubMeshID);
+
+					//	Sets the aplication mode.
+					mApplicationState	=	VISUALIZE_LODTREES;
+				}
 			}
+
+			//	Free memory.
+			delete	fcho;
+
+			//	Hide the right panel.
+			hideRightPanel();
+
+			//	Show title.
+			mProcessTitle->label("Visualize LodTrees");
+
+			//	Show the Visulize LodTree panel.
+			showLodStripSlider();
+			showLodTreeSlider();
+
+			//	Repaint the window.
+			mMainWindow->redraw();
 		}
-
-		//	Free memory.
-		delete	fcho;
-	}
-
-	//	Hide the right panel.
-	hideRightPanel();
-
-	//	Show the Visulize LodTree panel.
-	showLodStripSlider();
-	showLodTreeSlider();
-	
-	//	Repaint the window.
-	mMainWindow->redraw();
-}
+	}
+}
+
 void GeoMeshViewUI::cb_menuLodTreesVisualize(fltk::Item *o, void *v)
 {
@@ -1009,4 +1057,7 @@
 						//	Create the simplification sequence.
 						createSimplificationSequence();
+
+						//	Show build process.
+						activeBuildProcess();
 					}
 
@@ -1054,4 +1105,7 @@
 						delete	mMeshSimplifier;
 						geoMeshView->restoreContext();
+
+						//	Show build process.
+						activeBuildProcess();
 					}
 				}
@@ -1107,8 +1161,8 @@
 inline void GeoMeshViewUI::cb_mButtonBuild_i(fltk::Button*, void*)
 {
-	char			*file_name=NULL;
+	char					*file_name	=	NULL;
 	GeoMeshSaver	*mesh_saver;
 	Serializer		*oSerializer;
-	
+
 	//	Sets the progress bar to process bar.
 	progressBarType	=	BUILD;
@@ -1125,5 +1179,5 @@
 			//	Build the LOD file.
 			case	LODTREES_AUTO:			
-				
+
 				//	Open file chooser dialog.
 				file_name	=	fltk::file_chooser("Build LOD","*","");
@@ -1135,21 +1189,21 @@
 				std::cout << "OK!" << std::endl;
 
-/*				TreeSimplificationSequence * auxTreeSimpSequence = new TreeSimplificationSequence();
-				auxTreeSimpSequence->Load(Serializer("leavesSimplification.txt",Serializer::READ));
-
-				if (auxTreeSimpSequence && mGeoMesh)
-				{
-					LodTreeConstructor * auxLodTreeConstructor = new LodTreeConstructor(mGeoMesh,auxTreeSimpSequence);
-					delete auxLodTreeConstructor;
-				}
-				else
-				{
-					fltk::alert("There is no leaf simplification sequence.");
-					break;
-				}
-
-
-				delete auxTreeSimpSequence;*/
-				
+				/*				TreeSimplificationSequence * auxTreeSimpSequence = new TreeSimplificationSequence();
+									auxTreeSimpSequence->Load(Serializer("leavesSimplification.txt",Serializer::READ));
+
+									if (auxTreeSimpSequence && mGeoMesh)
+									{
+									LodTreeConstructor * auxLodTreeConstructor = new LodTreeConstructor(mGeoMesh,auxTreeSimpSequence);
+									delete auxLodTreeConstructor;
+									}
+									else
+									{
+									fltk::alert("There is no leaf simplification sequence.");
+									break;
+									}
+
+
+									delete auxTreeSimpSequence;*/
+
 
 			case	LODSTRIPS_AUTO:
@@ -1309,4 +1363,16 @@
 
 //---------------------------------------------------------------------------
+//	Active Build process.
+//---------------------------------------------------------------------------
+void	GeoMeshViewUI::activeBuildProcess()
+{
+	//mButtonBuild->set_visible();
+	mButtonBuild->activate();
+
+	//mBuildBar->set_visible();
+	mBuildBar->activate();
+}
+
+//---------------------------------------------------------------------------
 //	Show the stripify panel
 //---------------------------------------------------------------------------
@@ -1572,8 +1638,8 @@
 
 	mButtonBuild->set_visible();
-	mButtonBuild->activate();
+	//mButtonBuild->activate();
 
 	mBuildBar->set_visible();
-	mBuildBar->activate();
+	//mBuildBar->activate();
 }
 //---------------------------------------------------------------------------
@@ -1586,8 +1652,8 @@
 
 	mButtonBuild->set_visible();
-	mButtonBuild->activate();
+	//mButtonBuild->activate();
 
 	mBuildBar->set_visible();
-	mBuildBar->activate();
+	//mBuildBar->activate();
 }
 
@@ -2310,8 +2376,9 @@
 void	GeoMeshViewUI::openMeshFile()
 {
+	Mesh							*mesh_loaded;
 	fltk::FileChooser	*fcho;
 	static	char			char_value[10];
 	static	char			title[256];
-
+	
 	fcho	=	new fltk::FileChooser("",
 																"*.mesh",
@@ -2326,74 +2393,103 @@
 	if (mFileName)
 	{
-		//	Set Window Title.
-		strcpy(title,mFileName);
-		mMainWindow->label(strcat(title," - GeoTool"));
-
-		//	Identify the mesh that stores the leaves
-		idMeshLeaves	=	-1;
-
-		//	Stores the name of the mesh.
-		nombremesh	=	new char[255];
-		strcpy(nombremesh,mFileName);
-
-		//	Delete	the current mesh.
-		delete	mGeoMesh;
-		delete	mUndoMesh;
-
 		//	Loads a new mesh.
-		mGeoMesh		=	geoMeshLoader->load(mFileName);
-
-		//	Reset the undo mesh.
-		mUndoMesh		=	new Mesh();
-		*mUndoMesh	=	*mGeoMesh;
-
-		//	Translate the MB count to a char value.
-		sprintf(char_value,
-				"MB %.3f",
-				(float)geoMeshLoader->getFileSize()/1024/1024);
-
-		mMB->label(char_value);
-
-		//	Visualize mesh.
-		geoMeshView->setMesh(mGeoMesh);
-
-		//	Hide right panel.
-		hideRightPanel();
-
-		//	Quit culling.
-		menuRenderCW->clear_value();
-		menuRenderCCW->clear_value();
-		geoMeshView->deactiveCW();
-		geoMeshView->deactiveCCW();
-
-		//	Deactive solid mode and wire.
-		menuRenderSolid->clear_value();
-		menuRenderWire->clear_value();
-		geoMeshView->deactiveSolid();
-		geoMeshView->deactiveWire();
-
-		//	Fit model in midle.
-		geoMeshView->fit();
-
-		//	Lighting smooth.
-		menuRenderFlat->clear_value();
-		menuRenderSmooth->set_value();
-		geoMeshView->smooth();
-
-		//	Show title.
-		mProcessTitle->label("Mesh Info");
-
-		//	Shows the mesh info.
-		showMeshInfo();
-
-		//	if the mesh is stripified.
-		geoMeshView->setStripColors();
-
-		//	Refresh geometry attributes.
-		refreshApplicationBar();
-	}
-	
+		mesh_loaded		=	geoMeshLoader->load(mFileName);
+
+		//	If no error happens.
+		if (mesh_loaded)
+		{
+			//	Identify the mesh that stores the leaves
+			idMeshLeaves	=	-1;
+
+			//	Delete	the current mesh.
+			delete	mGeoMesh;
+			delete	mUndoMesh;
+
+			//	Assigns mesh loaded.
+			mGeoMesh	=	mesh_loaded;
+			
+			//	Set Window Title.
+			strcpy(title,mFileName);
+			mMainWindow->label(strcat(title," - GeoTool"));
+
+			//	Stores the name of the mesh.
+			nombremesh	=	new char[255];
+			strcpy(nombremesh,mFileName);
+
+			//	Reset the undo mesh.
+			mUndoMesh		=	new Mesh();
+			*mUndoMesh	=	*mGeoMesh;
+
+			//	Translate the MB count to a char value.
+			sprintf(char_value,
+					"MB %.3f",
+					(float)geoMeshLoader->getFileSize()/1024/1024);
+
+			mMB->label(char_value);
+
+			//	Visualize mesh.
+			geoMeshView->setMesh(mGeoMesh);
+
+			//	Hide right panel.
+			hideRightPanel();
+
+			//	Quit culling.
+			menuRenderCW->clear_value();
+			menuRenderCCW->clear_value();
+			geoMeshView->deactiveCW();
+			geoMeshView->deactiveCCW();
+
+			//	Deactive solid mode and wire.
+			menuRenderSolid->clear_value();
+			menuRenderWire->clear_value();
+			geoMeshView->deactiveSolid();
+			geoMeshView->deactiveWire();
+
+			//	Fit model in midle.
+			geoMeshView->fit();
+
+			//	Lighting smooth.
+			menuRenderFlat->clear_value();
+			menuRenderSmooth->set_value();
+			geoMeshView->smooth();
+
+			//	Show title.
+			mProcessTitle->label("Mesh Info");
+
+			//	Shows the mesh info.
+			showMeshInfo();
+
+			//	if the mesh is stripified.
+			geoMeshView->setStripColors();
+
+			//	Refresh geometry attributes.
+			refreshApplicationBar();
+
+			//	Restore simplification state.
+			simplificationState	=	NO_SIMPLIFICATION;
+		}
+	}
 	//	Free memory.
 	delete	fcho;
+}
+
+//---------------------------------------------------------------------------
+//	If file exists.
+//---------------------------------------------------------------------------
+bool	GeoMeshViewUI::fileExists(const char	*fileNameMesh)
+{
+	FILE	*pFile;
+	
+	//	Open the mesh file.
+	pFile	=	fopen(fileNameMesh, "r");
+
+  if (pFile)
+	{
+		return	true;
+	}
+	else
+	{
+		return	false;
+	}
 }
 
@@ -2447,10 +2543,10 @@
 			{
 				fltk::Group* o;
-				o = MainView = new fltk::Group(0, 0, 500, 530);
+				o = MainView = new fltk::Group(0, 0, 570, 530);
 				o->begin();
 
 				{
 					fltk::InvisibleBox* o;
-					o = cframe = new fltk::InvisibleBox(0, 0, 500, 530);
+					o = cframe = new fltk::InvisibleBox(0, 0, 570, 530);
 					o->box(fltk::FLAT_BOX);
 					o->color((fltk::Color)0xffffff00);
@@ -2460,5 +2556,5 @@
 				{
 					GeoMeshView* o;
-					o = geoMeshView = new GeoMeshView(	0,0,500,530,0,this);
+					o = geoMeshView = new GeoMeshView(	0,0,570,530,0,this);
 				}
 
@@ -2471,5 +2567,5 @@
 			{
 				fltk::Group* o;
-				o = MainView = new fltk::Group(500, 0, 300, 530);
+				o = MainView = new fltk::Group(570, 0, 230, 530);
 				o->begin();
 
@@ -2477,5 +2573,5 @@
 					fltk::Button* o;
 					//o = mButtonProcess = new fltk::Button(665, 410, 73, 25, "Process");
-					o = mButtonProcess = new fltk::Button(65, 410, 73, 25, "Process");
+					o = mButtonProcess = new fltk::Button(75, 410, 73, 25, "Process");
 					o->callback((fltk::Callback*)cb_mButtonProcess);
 					o->hide();
@@ -2486,5 +2582,5 @@
 					fltk::ProgressBar* o;
 					//o = mProcessBar = new fltk::ProgressBar(616, 435, 175, 18);
-					o = mProcessBar = new fltk::ProgressBar(16, 435, 175, 18);
+					o = mProcessBar = new fltk::ProgressBar(16, 435, 195, 18);
 					o->hide();
 					o->deactivate();
@@ -2493,5 +2589,5 @@
 				{
 					fltk::Button* o;
-					o = mButtonSort = new fltk::Button(65, 375, 73, 25, "Sort");
+					o = mButtonSort = new fltk::Button(75, 375, 73, 25, "Sort");
 					o->callback((fltk::Callback*)cb_mButtonSort);
 					o->hide();
@@ -2501,5 +2597,5 @@
 				{
 					fltk::ProgressBar* o;
-					o = mSortBar = new fltk::ProgressBar(16, 390, 175, 18);
+					o = mSortBar = new fltk::ProgressBar(16, 390, 195, 18);
 					o->hide();
 					o->deactivate();
@@ -2508,5 +2604,5 @@
 				{
 					fltk::Button* o;
-					o = mButtonBuild = new fltk::Button(65, 455, 73, 25, "Build");
+					o = mButtonBuild = new fltk::Button(75, 455, 73, 25, "Build");
 					o->callback((fltk::Callback*)cb_mButtonBuild);
 					o->hide();
@@ -2516,5 +2612,5 @@
 				{
 					fltk::ProgressBar* o;
-					o = mBuildBar = new fltk::ProgressBar(16, 480, 175, 18);
+					o = mBuildBar = new fltk::ProgressBar(16, 480, 195, 18);
 					o->hide();
 					o->deactivate();
@@ -2564,5 +2660,5 @@
 
 				{
-					mProcessTitle		= new fltk::Widget(0, 0, 300, 25, "");
+					mProcessTitle		= new fltk::Widget(0, 0, 230, 25, "");
 					fltk::Widget* o	=	mProcessTitle;
 					o->set_vertical();
@@ -2629,5 +2725,5 @@
 
 				{
-					fltk::Browser* o = mMeshInfo = new fltk::Browser(0, 20, 300, 380);
+					fltk::Browser* o = mMeshInfo = new fltk::Browser(0, 20, 230, 380);
 					o->set_vertical();
 					o->callback((fltk::Callback*)cb_mMeshInfo);
@@ -2661,6 +2757,6 @@
 
 				{
-					fltk::Item* o = menuOpenSaveAs = new fltk::Item("Save As");
-					o->callback((fltk::Callback*)cb_menuOpenSaveAs);
+					fltk::Item* o = menuFileSaveAs = new fltk::Item("Save As");
+					o->callback((fltk::Callback*)cb_menuFileSaveAs);
 				}
 
@@ -2676,6 +2772,6 @@
 
 				{
-					fltk::Item* o = menuOpenQuit = new fltk::Item("Quit");
-					o->callback((fltk::Callback*)cb_menuOpenQuit);
+					fltk::Item* o = menuFileQuit = new fltk::Item("Quit");
+					o->callback((fltk::Callback*)cb_menuFileQuit);
 				}
 
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshSaver.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshSaver.cpp	(revision 985)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshSaver.cpp	(revision 989)
@@ -1,12 +1,12 @@
-/*	==========================================================================
+/*==========================================================================
  *	(C) 2005 Universitat Jaume I
- *	==========================================================================
+ *==========================================================================
  *	PROYECT:	GAME TOOLS
- *	==========================================================================*/
-/**	CONTENT:	
-	*
-	*
-	*	@file	GeoMeshSaver.cpp
-/*===========================================================================*/
+ *==========================================================================*/
+/*	CONTENT:	
+ *
+ *
+ *	@file	GeoMeshSaver.cpp
+ *==========================================================================*/
 #include	<GeoMeshSaver.h>
 
@@ -14,18 +14,18 @@
 using	namespace	std;
 
-//------------------------------------------
+//---------------------------------------------------------------------------
 //		Public:
-//------------------------------------------
-
-////////////////////
-//	Constructors.	//
-////////////////////
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+//	Constructors.
+//---------------------------------------------------------------------------
 GeoMeshSaver::GeoMeshSaver()
 {
 }
 
-//////////////////
-//	Destroyer.	//
-//////////////////
+//---------------------------------------------------------------------------
+//	Destroyer.
+//---------------------------------------------------------------------------
 GeoMeshSaver::~GeoMeshSaver()
 {
@@ -33,5 +33,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Saves a Mesh into a file.
+//---------------------------------------------------------------------------
 int	GeoMeshSaver::save(Mesh	*geoMesh,	const	char	*fileNameMesh)
 {
