void CCmdCtl_i::UpdateMarginWidth(VOID) { if (!m_bLinenumbers) return; //int nWidth = GetLinenumberWidth() + 4; int nWidth = GetLinenumberWidth(); SendMessage(SCI_SETMARGINWIDTHN, 0, nWidth); }
// Set the display of line numbers on or off. // Scintilla uses 3 "Margin" at the left of the edit window. The Margin (0) // is used to display the linenumbers. If set to 0 no numbers are displayed. If // set to a width > 0 - linenumbers are displayed. We use a helper function to // calculate the size of this margin. // int | number of pixels for the margin width of margin (0) // void CCmdCtl_i::SetDisplayLinenumbers(bool bFlag) // flag if we shuld display line numbers { // if display is turned off we set margin 0 to 0 if (!bFlag) { SendMessage(SCI_SETMARGINWIDTHN, 0, 0); } // if display is turned o we set margin 0 to the calculated width else { int nWidth = GetLinenumberWidth(); // + 4; SendMessage(SCI_SETMARGINWIDTHN, 0, nWidth); } m_bLinenumbers = bFlag; }
///////////////////////////////////// // @mfunc Set the display of line numbers on or off. // Scintilla uses 3 "Margin" at the left of the edit window. The Margin (0) // is used to display the linenumbers. If set to 0 no numbers are displayed. If // set to a width > 0 - linenumbers are displayed. We use a helper function to // calculate the size of this margin. // @rvalue int | number of pixels for the margin width of margin (0) // void CScintillaWnd::SetDisplayLinenumbers(bool bFlag) { //@parm flag if we shuld display line numbers // if nothing changes just return if (GetDisplayLinenumbers() == bFlag) { return; } // if display is turned off we set margin 0 to 0 if (!bFlag) { SendMessage(SCI_SETMARGINWIDTHN, 0, 0); } // if display is turned o we set margin 0 to the calculated width else { int nWidth = GetLinenumberWidth() + 4; SendMessage(SCI_SETMARGINWIDTHN, 0, nWidth); } m_bLinenumbers = bFlag; }