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

Method CmObjectsRectangle

roomedit/source/editcli.cpp:2818–2911  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2816// -------------
2817//
2818void TEditorClient::CmObjectsRectangle ()
2819{
2820 // Ignore if "insert object" mode
2821 if ( InsertingObject )
2822 return;
2823
2824 // Keep in memory between calls
2825 static SHORT Width = 256;
2826 static SHORT Height = 128;
2827 char Title[80];
2828 char Prompt[80];
2829 TRangeValidator *pValid1 = new TRangeValidator(8, 2000);
2830 TRangeValidator *pValid2 = new TRangeValidator(8, 2000);
2831 char wBuf[7];
2832 char hBuf[7];
2833
2834 SET_HELP_CONTEXT(Insert_Rectangle);
2835 wsprintf (Title, "New rectangle size");
2836 wsprintf (Prompt, "Enter Width and Height of new Rectangle:");
2837 wsprintf (wBuf, "%d", Width);
2838 wsprintf (hBuf, "%d", Height);
2839
2840 if ( TInput2Dialog (this, Title, Prompt,
2841 wBuf, 7, hBuf, 7,
2842 pValid1, pValid2).Execute() == IDOK )
2843 {
2844 Width = (SHORT)atoi(wBuf);
2845 Height = (SHORT)atoi(hBuf);
2846
2847 // Hide information windows
2848 BOOL OldInfoWinShown = InfoWinShown;
2849 InfoWinShown = FALSE;
2850 if ( OldInfoWinShown != InfoWinShown )
2851 {
2852 SetupInfoWindows();
2853 UpdateWindow();
2854 }
2855
2856 // Clip cursor movements to editor window and get mouse capture
2857 TRect editRect;
2858 GetWindowRect (editRect);
2859 editRect.right++;
2860 editRect.bottom++;
2861 ClipCursor(&editRect);
2862 SetCursor (GetApplication(), IDC_INSERT);
2863 SetCapture();
2864
2865 // Begin insert mode
2866 WorkMessage("Click left mouse button to insert rectangle...");
2867 InsertingObject = TRUE; // don't highlight when mouse move
2868
2869 // Stops when left button down
2870 MSG loopMsg;
2871 loopMsg.message = 0;
2872 while (loopMsg.message != WM_LBUTTONDOWN)
2873 {
2874 if (::PeekMessage(&loopMsg, 0, 0, 0, PM_REMOVE))
2875 {

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected