From: <emm...@us...> - 2008-12-18 11:23:08
|
Revision: 4307 http://fudaa.svn.sourceforge.net/fudaa/?rev=4307&view=rev Author: emmanuel_martin Date: 2008-12-18 11:23:04 +0000 (Thu, 18 Dec 2008) Log Message: ----------- Correction de l'undo/redo concernant plusieurs points d?\195?\169plac?\195?\169s en une fois (l'undo/redo ne se faisait pas d'un bloque) Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/VueCourbe.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/VueCourbe.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/VueCourbe.java 2008-12-18 10:59:27 UTC (rev 4306) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/VueCourbe.java 2008-12-18 11:23:04 UTC (rev 4307) @@ -68,6 +68,8 @@ protected class CourbeGeomModel implements EGModel, DataGeometryListener { private DataGeometry data_; + /** Un commande manager temporaire. */ + private CtuluCommandContainer cmd_; public CourbeGeomModel(DataGeometry _data) { if(_data==null) @@ -103,18 +105,25 @@ public boolean deplace(int[] idx, double _deltax, double _deltay, CtuluCommandContainer _cmd) { Arrays.sort(idx); - CtuluCommandComposite cmd=new CtuluCommandComposite(FudaaLib.getS("D\xE9placement d'un ou plusieurs points")); + boolean createCmd=false; + if(cmd_==null) { + createCmd=true; + cmd_=new CtuluCommandComposite(FudaaLib.getS("D\xE9placement d'un ou plusieurs points")); + } // Selon le sens de d\xE9placement, il faut commencer par le d\xE9but ou la fin du tableau if(_deltax<0) for(int index:idx) - setValue(index, getX(index)+_deltax, getY(index)+_deltay, cmd); + setValue(index, getX(index)+_deltax, getY(index)+_deltay, cmd_); else for(int i=idx.length-1;i>=0;i--) - setValue(idx[i], getX(idx[i])+_deltax, getY(idx[i])+_deltay, cmd); - if(controller_.getCommandManager()!=null) - // Pour une explication sur l'utilisation de controller_ a la place de - // _cmd voir l'entete de la classe. - controller_.getCommandManager().addCmd(cmd.getSimplify()); + setValue(idx[i], getX(idx[i])+_deltax, getY(idx[i])+_deltay, cmd_); + if(createCmd) { + if(controller_.getCommandManager()!=null) + // Pour une explication sur l'utilisation de controller_ a la place de + // _cmd voir l'entete de la classe. + controller_.getCommandManager().addCmd(((CtuluCommandComposite) cmd_).getSimplify()); + cmd_=null; + } return true; } @@ -183,9 +192,20 @@ public boolean removeValue(int _i, CtuluCommandContainer _cmd) { try { - // Pour une explication sur l'utilisation de controller_ a la place de - // _cmd voir l'entete de la classe. - data_.remove(_i, controller_.getCommandManager()); + boolean createCmd=false; + if(cmd_==null) { + createCmd=true; + cmd_=new CtuluCommandComposite(FudaaLib.getS("Suppression d'un point")); + } + // Suppression du poin + data_.remove(_i, cmd_); + if(createCmd) { + if(controller_.getCommandManager()!=null) + // Pour une explication sur l'utilisation de controller_ a la place de + // _cmd voir l'entete de la classe. + controller_.getCommandManager().addCmd(((CtuluCommandComposite) cmd_).getSimplify()); + cmd_=null; + } return true; } catch (DataGeometryException _exc) { @@ -209,9 +229,20 @@ public boolean setValue(int _i, double _x, double _y, CtuluCommandContainer _cmd) { controller_.clearError(); try { - // Pour une explication sur l'utilisation de controller_ a la place de - // _cmd voir l'entete de la classe. - data_.setValues(_i, _x, _y, controller_.getCommandManager()); + boolean createCmd=false; + if(cmd_==null) { + createCmd=true; + cmd_=new CtuluCommandComposite(FudaaLib.getS("D\xE9placement d'un point")); + } + // D\xE9placement du point + data_.setValues(_i, _x, _y, cmd_); + if(createCmd) { + if(controller_.getCommandManager()!=null) + // Pour une explication sur l'utilisation de controller_ a la place de + // _cmd voir l'entete de la classe. + controller_.getCommandManager().addCmd(((CtuluCommandComposite) cmd_).getSimplify()); + cmd_=null; + } return true; } catch (DataGeometryException _exc) { @@ -221,13 +252,21 @@ } public boolean setValues(int[] _idx, double[] _x, double[] _y, CtuluCommandContainer _cmd) { - CtuluCommandComposite cmd=new CtuluCommandComposite(FudaaLib.getS("D\xE9placement d'un ou plusieurs points")); + boolean createCmd=false; + if(cmd_==null) { + createCmd=true; + cmd_=new CtuluCommandComposite(FudaaLib.getS("D\xE9placement d'un ou plusieurs points")); + } + // D\xE9placement for(int index: _idx) - setValue(index, _x[index], _y[index], cmd); - if(controller_.getCommandManager()!=null) - // Pour une explication sur l'utilisation de controller_ a la place de - // _cmd voir l'entete de la classe. - controller_.getCommandManager().addCmd(cmd.getSimplify()); + setValue(index, _x[index], _y[index], cmd_); + if(createCmd) { + if(controller_.getCommandManager()!=null) + // Pour une explication sur l'utilisation de controller_ a la place de + // _cmd voir l'entete de la classe. + controller_.getCommandManager().addCmd(((CtuluCommandComposite) cmd_).getSimplify()); + cmd_=null; + } return true; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |