static void sendNewColourCurrentWindow( NewColourOps op ) { /* the edit window has various components in the form of syntax elements - figure which we are on & mod SETypes */ int row, col; syntax_element style; vi_color color; syntax_element i; linenum line_num; ScreenToClient( mod_wid, &m_pt ); ClientToRowCol( mod_wid, m_pt.x, m_pt.y, &row, &col, DIVIDE_BETWEEN ); /* someone is base 0, someone else isn't. bummer. * also col may not be valid, check this */ if( col < 1 ) { return; } col--; // SStyle expect real not virtual columns! // Hmmm. line_num = (linenum)(LeftTopPos.line + row - 1); col = RealCursorPositionOnLine( line_num, col ); style = SSGetStyle( row, col ); if( style == SE_UNPARSED ) { // for some reason, area was not defined return; } color = INDEX_FROM_XY( cursx, cursy ); if( CtrlDown() ) { // affect all foregrounds/backgrounds for( i = 0; i < SE_NUMTYPES; i++ ) { // doesn't make sense to change selection if( i == SE_SELECTION ) { continue; } if( op == NC_FORE ) { SEType[i].foreground = color; } else { SEType[i].background = color; } } } else { if( op == NC_FORE ) { SEType[style].foreground = color; } else { SEType[style].background = color; } } ReDisplayScreen(); }
static void sendNewFontCurrentWindow( void ) { int row, col; syntax_element style; BOOL totally; linenum line_num; ScreenToClient( mod_hwnd, &m_pt ); ClientToRowCol( mod_hwnd, m_pt.x, m_pt.y, &row, &col, DIVIDE_BETWEEN ); /* someone is base 0, someone else isn't. bummer. * Also row may not be valid if attemping to drop beyond bottom * of visible text, so check! */ if( col < 1 ) { return; } col--; // SStyle expect real not virtual columns! // Hmmm. line_num = (linenum)(LeftTopPos.line + row - 1); col = RealCursorPositionOnLine( line_num, col ); style = SSGetStyle( row, col ); if( style != SE_UNPARSED ) { /* * ASSUMPTION: font #s in win.cfg match SE_XXX enum values! */ totally = FALSE; if( CtrlDown() ) { totally = TRUE; } EnsureUniformFonts( 0, SE_NUMTYPES - 1, &CurLogfont, totally ); SetUpFont( &CurLogfont, SEType[style].font ); } }