MCPcopy Create free account
hub / github.com/ashkulz/NppFTP / SetScintillaParameters

Method SetScintillaParameters

src/Windows/OutputWindow.cpp:286–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286int OutputWindow::SetScintillaParameters() {
287 if (m_hScintilla == NULL)
288 return -1;
289
290 COLORREF defaultColor = RGB(0, 180, 180);
291 COLORREF clientColor = RGB(0, 180, 0);
292 COLORREF systemColor = RGB(0, 0, 180);
293 COLORREF errorColor = RGB(255, 0, 0);
294 COLORREF backgroundColorMargin = RGB(245, 245, 245);
295 COLORREF backgroundColor = RGB(255, 255, 255);
296
297 bool isdarkmodeenabled = ::SendMessage(_MainOutputWindow, NPPM_ISDARKMODEENABLED, 0, 0);
298 if (isdarkmodeenabled)
299 {
300 NppDarkMode::Colors returnColors;
301 if (::SendMessage(_MainOutputWindow, NPPM_GETDARKMODECOLORS, sizeof(NppDarkMode::Colors), (LPARAM)&returnColors))
302 {
303 defaultColor = returnColors.text;
304 clientColor = returnColors.darkerText;
305 systemColor = returnColors.linkText;
306 errorColor = returnColors.errorBackground;
307 backgroundColorMargin = returnColors.background;
308 backgroundColor = returnColors.softerBackground;
309 }
310 }
311
312 ::SendMessage(m_hScintilla, SCI_USEPOPUP, (WPARAM)false, 0);
313
314 ::SendMessage(m_hScintilla, SCI_SETREADONLY, (WPARAM)true, 0);
315 ::SendMessage(m_hScintilla, SCI_SETSCROLLWIDTH, (WPARAM)10, 0);
316 ::SendMessage(m_hScintilla, SCI_SETSCROLLWIDTHTRACKING, (WPARAM)true, 0);
317
318 ::SendMessage(m_hScintilla, SCI_SETUNDOCOLLECTION, (WPARAM)false, 0);
319 ::SendMessage(m_hScintilla, SCI_SETCODEPAGE, SC_CP_UTF8, 0);
320
321 ::SendMessage(m_hScintilla, SCI_STARTSTYLING, (WPARAM)0, (LPARAM)0xff);
322
323 ::SendMessage(m_hScintilla, SCI_STYLESETFORE, STYLE_DEFAULT, defaultColor);
324 ::SendMessage(m_hScintilla, SCI_STYLESETBACK, STYLE_DEFAULT, backgroundColor);
325 ::SendMessage(m_hScintilla, SCI_STYLECLEARALL, 0, 0);
326
327 ::SendMessage(m_hScintilla, SCI_STYLESETFORE, STYLE_CLIENT, clientColor);
328 ::SendMessage(m_hScintilla, SCI_STYLESETFORE, STYLE_SYSTEM, systemColor);
329 ::SendMessage(m_hScintilla, SCI_STYLESETFORE, STYLE_ERROR, errorColor);
330
331 ::SendMessage(m_hScintilla, SCI_STYLESETFORE, STYLE_MARGIN_CLIENT, clientColor);
332 ::SendMessage(m_hScintilla, SCI_STYLESETFORE, STYLE_MARGIN_SYSTEM, systemColor);
333 ::SendMessage(m_hScintilla, SCI_STYLESETFORE, STYLE_MARGIN_ERROR, errorColor);
334 ::SendMessage(m_hScintilla, SCI_STYLESETBACK, STYLE_MARGIN_CLIENT, backgroundColorMargin);
335 ::SendMessage(m_hScintilla, SCI_STYLESETBACK, STYLE_MARGIN_SYSTEM, backgroundColorMargin);
336 ::SendMessage(m_hScintilla, SCI_STYLESETBACK, STYLE_MARGIN_ERROR, backgroundColorMargin);
337
338 ::SendMessage(m_hScintilla, SCI_STYLESETBACK, STYLE_LINENUMBER, backgroundColorMargin);
339
340 ::SendMessage(m_hScintilla, SCI_SETMARGINTYPEN, (WPARAM)0, (LPARAM)SC_MARGIN_TEXT);
341 int width = ::SendMessage(m_hScintilla, SCI_TEXTWIDTH, (WPARAM)STYLE_SYSTEM, (LPARAM)"88:88:88 ");
342 ::SendMessage(m_hScintilla, SCI_SETMARGINWIDTHN, (WPARAM)0, (LPARAM)width);
343 ::SendMessage(m_hScintilla, SCI_SETMARGINWIDTHN, (WPARAM)1, (LPARAM)0);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected