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

Method CmObjectsPolygon

roomedit/source/editcli.cpp:2918–3010  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2916// -------------
2917//
2918void TEditorClient::CmObjectsPolygon ()
2919{
2920 // Ignore if "insert object" mode
2921 if ( InsertingObject )
2922 return;
2923
2924 // Keep in memory between calls
2925 static SHORT nSides = 8;
2926 static SHORT Radius = 128;
2927 char Title[80];
2928 char Prompt[80];
2929 TRangeValidator *pValid1 = new TRangeValidator(3, 32);
2930 TRangeValidator *pValid2 = new TRangeValidator(8, 2000);
2931 char nBuf[7];
2932 char rBuf[7];
2933
2934 SET_HELP_CONTEXT(Insert_Polygon);
2935 wsprintf (Title, "New polygon size");
2936 wsprintf (Prompt, "Enter number of sides and radius of new polygon:");
2937 wsprintf (nBuf, "%d", nSides);
2938 wsprintf (rBuf, "%d", Radius);
2939 if ( TInput2Dialog (this, Title, Prompt,
2940 nBuf, 7, rBuf, 7,
2941 pValid1, pValid2).Execute() == IDOK )
2942 {
2943 nSides = (SHORT)atoi(nBuf);
2944 Radius = (SHORT)atoi(rBuf);
2945
2946 // Hide information windows
2947 BOOL OldInfoWinShown = InfoWinShown;
2948 InfoWinShown = FALSE;
2949 if ( OldInfoWinShown != InfoWinShown )
2950 {
2951 SetupInfoWindows();
2952 UpdateWindow();
2953 }
2954
2955 // Clip cursor movements to editor window and get mouse capture
2956 TRect editRect;
2957 GetWindowRect (editRect);
2958 editRect.right++;
2959 editRect.bottom++;
2960 ClipCursor(&editRect);
2961 SetCursor (GetApplication(), IDC_INSERT);
2962 SetCapture();
2963
2964 // Begin insert mode
2965 WorkMessage("Click left mouse button to insert polygon...");
2966 InsertingObject = TRUE; // don't highlight when mouse move
2967
2968 // Stops when left button down
2969 MSG loopMsg;
2970 loopMsg.message = 0;
2971 while (loopMsg.message != WM_LBUTTONDOWN)
2972 {
2973 if (::PeekMessage(&loopMsg, 0, 0, 0, PM_REMOVE))
2974 {
2975 // Don't send the WM_LBUTTONDOWN, because we don't

Callers

nothing calls this directly

Calls 8

TInput2DialogClass · 0.85
GetApplicationFunction · 0.85
WorkMessageFunction · 0.85
StartUndoRecordingFunction · 0.85
InsertPolygonFunction · 0.85
StopUndoRecordingFunction · 0.85
ExecuteMethod · 0.45
AutoScrollMethod · 0.45

Tested by

no test coverage detected