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

Method EvChar

roomedit/source/editcli.cpp:1793–1849  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1791// -------------
1792//
1793void TEditorClient::EvChar (UINT key, UINT repeatCount, UINT flags)
1794{
1795 TLayoutWindow::EvChar(key, repeatCount, flags);
1796
1797 // user wants to set the scale directly
1798 if ( key == '+' || key == '-' || (key >= '0' && key <= '9') )
1799 {
1800 float oldScale = Scale;
1801
1802 OrigX += (SHORT) ((PointerX - ScrCenterX) * DIV_SCALE);
1803 OrigY += (SHORT) ((ScrCenterY - PointerY) * DIV_SCALE);
1804 if ( key == '+' )
1805 IncScale();
1806 else if (key == '-' )
1807 DecScale();
1808 else if (key == '0')
1809 SetScale (0.1f);
1810 else
1811 SetScale (1.0 / (float)(key - '0'));
1812 OrigX -= (SHORT) ((PointerX - ScrCenterX) * DIV_SCALE);
1813 OrigY -= (SHORT) ((ScrCenterY - PointerY) * DIV_SCALE);
1814
1815 // If scale has really changed
1816 if ( Scale != oldScale )
1817 {
1818 Invalidate (); // Redraw map
1819 AdjustScroller (); // Adjust scroller units
1820 DrawStatusBar (); // Display new scale
1821 }
1822 }
1823 // Unselect all objects
1824 else if ( key == 'c' )
1825 {
1826 // Ignore if "insert object" mode
1827 if ( InsertingObject )
1828 return;
1829
1830 TMapDC dc (this);
1831 HighlightSelection (dc, EditMode, Selected);
1832 ForgetSelection (&Selected);
1833 }
1834 // (Un)select current object
1835 else if ( key == 'm' && CurObject >= 0 )
1836 {
1837 // Ignore if "insert object" mode
1838 if ( InsertingObject )
1839 return;
1840
1841 if ( IsSelected (Selected, CurObject) )
1842 UnSelectObject (&Selected, CurObject);
1843 else
1844 SelectObject (&Selected, CurObject);
1845
1846 TMapDC dc (this);
1847 HighlightObject (dc, EditMode, CurObject, GREEN);
1848 }
1849}
1850

Callers

nothing calls this directly

Calls 9

IncScaleFunction · 0.85
DecScaleFunction · 0.85
SetScaleFunction · 0.85
HighlightSelectionFunction · 0.85
ForgetSelectionFunction · 0.85
UnSelectObjectFunction · 0.85
SelectObjectFunction · 0.85
HighlightObjectFunction · 0.85
IsSelectedFunction · 0.70

Tested by

no test coverage detected