changeset 74:f8751d74918b default tip

Remove “duplicate” functions as they can be remplaced by a nearly-identical existing function.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 02 Apr 2011 19:13:54 +0200
parents e4a12dd9a51b
children
files scn2k/scn2k_grp.cc scn2k/scn2k_grp.h scn2k/scn2k_grpimpl.cc
diffstat 3 files changed, 12 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/scn2k/scn2k_grp.cc
+++ b/scn2k/scn2k_grp.cc
@@ -1695,10 +1695,10 @@ Grp::Grp(Event::Container& _event, PicCo
 	RegisterCommand(1, 82, 1043, "objBgAdjustAllY", NULL);
 	RegisterCommand(1, 81, 1046, "objScale", (CmdImpl) &Grp::impl_objScale);
 	RegisterCommand(1, 82, 1046, "objBgScale", (CmdImpl) &Grp::impl_objScale);
-	RegisterCommand(1, 81, 1047, "objWidth", (CmdImpl) &Grp::impl_objWidth);
-	RegisterCommand(1, 82, 1047, "objBgWidth", (CmdImpl) &Grp::impl_objWidth);
-	RegisterCommand(1, 81, 1048, "objHeight", (CmdImpl) &Grp::impl_objHeight);
-	RegisterCommand(1, 82, 1048, "objBgHeight", (CmdImpl) &Grp::impl_objHeight);
+	RegisterCommand(1, 81, 1047, "objWidth", (CmdImpl) &Grp::impl_objScale);
+	RegisterCommand(1, 82, 1047, "objBgWidth", (CmdImpl) &Grp::impl_objScale);
+	RegisterCommand(1, 81, 1048, "objHeight", (CmdImpl) &Grp::impl_objScale);
+	RegisterCommand(1, 82, 1048, "objBgHeight", (CmdImpl) &Grp::impl_objScale);
 	RegisterCommand(1, 81, 1049, "objRotate", (CmdImpl) &Grp::impl_objRotate);
 	RegisterCommand(1, 82, 1049, "objBgRotate", (CmdImpl) &Grp::impl_objRotate);
 	RegisterCommand(1, 81, 1050, "objRepOrigin", NULL);
--- a/scn2k/scn2k_grp.h
+++ b/scn2k/scn2k_grp.h
@@ -200,8 +200,6 @@ class Grp : public CommandHandler {
 		void impl_objNumOpts(Cmd &cmd);
 		void impl_objPattNo(Cmd &cmd);
 		void impl_objScale(Cmd &cmd);
-		void impl_objWidth(Cmd &cmd);
-		void impl_objHeight(Cmd &cmd);
 		void impl_objRotate(Cmd &cmd);
 		void impl_objPosDims(Cmd &cmd);
 		void impl_refresh(Cmd &cmd);
--- a/scn2k/scn2k_grpimpl.cc
+++ b/scn2k/scn2k_grpimpl.cc
@@ -629,38 +629,20 @@ void Grp::impl_objScale(Cmd& cmd) {
 	int base_arg = 0;
 	GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
 
-	int zoomx = cmd.args[base_arg + 1].value;
-	zoomx = zoomx*256/100;
+	int zoomx = -1;
+	int zoomy = -1;
 
-	int zoomy = cmd.args[base_arg + 2].value;
-	zoomy = zoomy*256/100;
+	if (cmd.cmd3 < 1048) {
+		zoomx = cmd.args[base_arg + 1].value * 256 / 100;
+		if (cmd.cmd3 == 1046)
+			zoomy = cmd.args[base_arg + 2].value * 256 / 100;
+	} else
+		zoomy = cmd.args[base_arg + 1].value * 256 / 100;
 
 	g->SetZoomRotate(zoomx, zoomy, -1);
 	cmd.clear();
 }
 
-void Grp::impl_objWidth(Cmd& cmd) {
-	int base_arg = 0;
-	GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
-
-	int zoom = cmd.args[base_arg + 1].value;
-	zoom = zoom*256/100;
-
-	g->SetZoomRotate(zoom, -1, -1);
-	cmd.clear();
-}
-
-void Grp::impl_objHeight(Cmd& cmd) {
-	int base_arg = 0;
-	GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
-
-	int zoom = cmd.args[base_arg + 1].value;
-	zoom = zoom*256/100;
-
-	g->SetZoomRotate(-1, zoom, -1);
-	cmd.clear();
-}
-
 void Grp::impl_objRotate(Cmd& cmd) {
 	int base_arg = 0;
 	GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));