MCPcopy Create free account
hub / github.com/Meridian59/Meridian59 / CmMiscRotateScale

Method CmMiscRotateScale

roomedit/source/editcli.cpp:3214–3281  ·  view source on GitHub ↗

//////////////////////////////////////////////////////////////// TEditorClient -------------

Source from the content-addressed store, hash-verified

3212// -------------
3213//
3214void TEditorClient::CmMiscRotateScale ()
3215{
3216 // Ignore if "insert object" mode
3217 if ( InsertingObject )
3218 return;
3219
3220 DWORD hc;
3221 if (EditMode == OBJ_THINGS) hc = Rotate_and_scale_Things;
3222 else if (EditMode == OBJ_VERTEXES) hc = Rotate_and_scale_Vertices;
3223 else if (EditMode == OBJ_LINEDEFS) hc = Rotate_and_scale_LineDefs;
3224 else if (EditMode == OBJ_SECTORS) hc = Rotate_and_scale_Sectors;
3225 SET_HELP_CONTEXT(hc);
3226
3227 char Title[80];
3228 char Prompt[80];
3229 char Buf1[7], Buf2[7];
3230 static SHORT Angle = 0;
3231 static SHORT Scale = 100;
3232
3233 if ( EditMode == OBJ_THINGS || EditMode == OBJ_VERTEXES )
3234 {
3235 // Check at least two object selected
3236 if ( CheckSelection (2, -1) == FALSE )
3237 goto End;
3238 }
3239 else
3240 {
3241 // Check at least one object selected
3242 if ( CheckSelection (1, -1) == FALSE )
3243 goto End;
3244 }
3245
3246 // Input Angle and Scale
3247 wsprintf (Title, "%s rotation and scaling", GetObjectTypeName(EditMode));
3248 wsprintf (Prompt, "Enter rotation angle (0-360) and scale factor (in %%) (1-1000)");
3249 wsprintf (Buf1, "%d", Angle);
3250 wsprintf (Buf2, "%d", Scale);
3251
3252 if ( TInput2Dialog (this, Title, Prompt,
3253 Buf1, 6, Buf2, 6,
3254 new TRangeValidator (0, 360),
3255 new TRangeValidator (1, 1000)).Execute() == IDOK )
3256 {
3257 // Rotate and Scale objects
3258 Angle = (SHORT)atoi (Buf1);
3259 Scale = (SHORT)atoi (Buf2);
3260
3261 // UNDO
3262 StartUndoRecording (AddObjectType ("Rotate"));
3263
3264 RotateAndScaleObjects (EditMode, Selected,
3265 (double) Angle * 0.0174533,
3266 (double) Scale * 0.01);
3267
3268 // UNDO
3269 StopUndoRecording();
3270 }
3271

Callers

nothing calls this directly

Calls 6

GetObjectTypeNameFunction · 0.85
TInput2DialogClass · 0.85
StartUndoRecordingFunction · 0.85
RotateAndScaleObjectsFunction · 0.85
StopUndoRecordingFunction · 0.85
ExecuteMethod · 0.45

Tested by

no test coverage detected