示例#1
0
/**
 * Init some default values
 */
void CScintillaBibWnd::Init()
{
	CScintillaWnd::Init();

	SetDisplayFolding(TRUE);
	SetDisplayLinenumbers(TRUE);
	SetDisplaySelection(FALSE);

	// BibTeX
	LoadLexerLib(LEXBIB_LIB);
	SetLexer(LEXBIB_NAME);
	SetWrap(SC_WRAP_WORD);
	// Setup some BibTeX styles
	SetForeground(SCE_L_COMMAND, RGB(0, 0, 160));
	SetForeground(SCE_L_MATH, RGB(150, 150, 40));
	SetForeground(SCE_L_COMMENT, RGB(0, 128, 0));
	SetForeground(SCE_L_TAG, RGB(0, 0, 255));
	SetItalic(SCE_L_COMMENT, TRUE);
	SetBold(SCE_BIB_ITEM, TRUE);
	SetBold(SCE_BIB_END, TRUE);
	SetForeground(SCE_BIB_END, RGB(255, 0, 0));
	SetBold(SCE_BIB_START, TRUE);
	SetForeground(SCE_BIB_START, RGB(255, 0, 0));
	SetForeground(SCE_BIB_FIELD, RGB(140, 0, 70));
	SetForeground(SCE_BIB_KEY, RGB(140, 0, 0));
	SetBold(SCE_BIB_KEY, TRUE);
	// We also need HTML
	SetBold(SCE_H_ATTRIBUTEUNKNOWN, FALSE);
	SetBold(SCE_H_ATTRIBUTE, FALSE);
	SetBold(SCE_H_SINGLESTRING, FALSE);
	SetBold(SCE_H_DOUBLESTRING, FALSE);
	SetBold(SCE_H_TAG, TRUE);
	SetBold(SCE_H_TAGUNKNOWN, TRUE);
	SetForeground(SCE_H_TAGUNKNOWN, RGB(255, 0, 0));
//	SetItalic(SCE_H_COMMENT, TRUE);

	// Marker
	DefineMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_MINUS, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0xFF));
	DefineMarker(SC_MARKNUM_FOLDER, SC_MARK_PLUS, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDERSUB, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDERTAIL, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDEREND, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDEROPENMID, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
}
示例#2
0
/////////////////////////////////////
// @mfunc init the view with reasonable defaults
// @rvalue void | not used
//
void CScintillaWnd::Init(void) {
    // clear all text styles
    SendMessage(SCI_CLEARDOCUMENTSTYLE, 0, 0);

    // set the number of styling bits to 7 - the asp/html views need a lot of styling - default is 5
    // If you leave the default you will see twiggle lines instead of ASP code
    SendMessage(SCI_SETSTYLEBITS, 7, 0);

    // set the display for indentation guides to on - this displays virtical dotted lines from the beginning of
    // a code block to the end of the block
    SendMessage(SCI_SETINDENTATIONGUIDES, true, 0);

    // set tabwidth to 3
    SendMessage(SCI_SETTABWIDTH,3,0);

    // set indention to 3
    SendMessage(SCI_SETINDENT,3,0);

    // set the caret blinking time to 400 milliseconds
    SendMessage(SCI_SETCARETPERIOD,400,0);

    // source folding section
    // tell the lexer that we want folding information - the lexer supplies "folding levels"
    SendMessage(SCI_SETPROPERTY, (WPARAM)_T("fold"), (LPARAM)_T("1"));
    SendMessage(SCI_SETPROPERTY, (WPARAM)_T("fold.html"), (LPARAM)_T("1"));
    SendMessage(SCI_SETPROPERTY, (WPARAM)_T("fold.html.preprocessor"), (LPARAM)_T("1"));
    SendMessage(SCI_SETPROPERTY, (WPARAM)_T("fold.comment"), (LPARAM)_T("1"));
    SendMessage(SCI_SETPROPERTY, (WPARAM)_T("fold.at.else"), (LPARAM)_T("1"));
    SendMessage(SCI_SETPROPERTY, (WPARAM)_T("fold.flags"), (LPARAM)_T("1"));
    SendMessage(SCI_SETPROPERTY, (WPARAM)_T("fold.preprocessor"), (LPARAM)_T("1"));
    SendMessage(SCI_SETPROPERTY, (WPARAM)_T("styling.within.preprocessor"), (LPARAM)_T("1"));
    SendMessage(SCI_SETPROPERTY, (WPARAM)_T("asp.default.language"), (LPARAM)_T("1"));

    // Tell scintilla to draw folding lines UNDER the folded line
    SendMessage(SCI_SETFOLDFLAGS, 16,0);

    // Set margin 2 = folding margin to display folding symbols
    SendMessage(SCI_SETMARGINMASKN, 2, SC_MASK_FOLDERS);

    // allow notifications for folding actions
    SendMessage(SCI_SETMODEVENTMASK, SC_MOD_INSERTTEXT|SC_MOD_DELETETEXT, 0);
    //SendMessage(SCI_SETMODEVENTMASK, SC_MOD_CHANGEFOLD|SC_MOD_INSERTTEXT|SC_MOD_DELETETEXT, 0);

    // make the folding margin sensitive to folding events = if you click into the margin you get a notification event
    SendMessage(SCI_SETMARGINSENSITIVEN, 2, true);

    // define a set of markers to display folding symbols
    SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPEN, SC_MARK_MINUS);
    SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDER, SC_MARK_PLUS);
    SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDERSUB, SC_MARK_EMPTY);
    SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDERTAIL, SC_MARK_EMPTY);
    SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDEREND, SC_MARK_EMPTY);
    SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPENMID, SC_MARK_EMPTY);
    SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_EMPTY);

    // set the forground color for some styles
    SendMessage(SCI_STYLESETFORE, 0, RGB(0,0,0));
    SendMessage(SCI_STYLESETFORE, 2, RGB(0,64,0));
    SendMessage(SCI_STYLESETFORE, 5, RGB(0,0,255));
    SendMessage(SCI_STYLESETFORE, 6, RGB(200,20,0));
    SendMessage(SCI_STYLESETFORE, 9, RGB(0,0,255));
    SendMessage(SCI_STYLESETFORE, 10, RGB(255,0,64));
    SendMessage(SCI_STYLESETFORE, 11, RGB(0,0,0));

    // set the backgroundcolor of brace highlights
    SendMessage(SCI_STYLESETBACK, STYLE_BRACELIGHT, RGB(0,255,0));

    // set end of line mode to CRLF
    SendMessage(SCI_CONVERTEOLS, 2, 0);
    SendMessage(SCI_SETEOLMODE, 2, 0);
    //SendMessage(SCI_SETVIEWEOL, true, 0);

    // set markersymbol for marker type 0 - bookmark
    SendMessage(SCI_MARKERDEFINE, 0, SC_MARK_CIRCLE);

    // display all margins
    SetDisplayLinenumbers(true);
    SetDisplayFolding(true);
    SetDisplaySelection(true);
}
示例#3
0
文件: clc_api.cpp 项目: fre2003/l3220
bool CCmdCtl_i::UiNotify(WPARAM wParam, 
                      LPARAM lParam, // pointer to notification structure
                      LRESULT* pResult)   
{
  NMHDR *phDR;
  phDR = (NMHDR*)lParam;
    
  // does notification come from my scintilla window?
  if (phDR != NULL && phDR->hwndFrom == m_hWnd)
  {
    SCNotification *pMsg = (SCNotification*)lParam;
    switch (phDR->code)
    {
    case SCN_STYLENEEDED:
      break;

    case SCN_CHARADDED:
      AddChar(pMsg->ch);
      break;
      
    case SCN_SAVEPOINTREACHED:
      break;

    //   called when the document is changed - mark document modified
    case SCN_SAVEPOINTLEFT:
      {
//         CDocument *pDoc = GetDocument();
//         pDoc->SetModifiedFlag(TRUE);
      }
      break;
    
    case SCN_MODIFYATTEMPTRO:
      break;
    
    case SCN_KEY:
      {
        //GetCurrentLineText();
      }
      break;
    case SCN_NEWLINE:
      NotifyNewLine(pMsg->pNewLine);
      break;
    
    case SCN_TAB:
      break;

    case SCN_KEY_DOWN:
      {
        BOOL bKeyDown = (::GetKeyState(pMsg->ch) & 0x80000000);
        
        int key       = pMsg->ch;
        char c        = (char)key;
        int modifiers = pMsg->modifiers;

        if(m_bBookMark)
        {
          if (bKeyDown && (modifiers & SCMOD_CTRL) && (modifiers & SCMOD_SHIFT) && (key == VK_F2))
          {
            ClearAllBookmarks();
          }
          else if (bKeyDown && (modifiers & SCMOD_CTRL) && (key == VK_F2))
          {
            SetDisplaySelection(TRUE);
            ToggleBookmark();
          }
          else if (bKeyDown && (modifiers & SCMOD_SHIFT) && (key == VK_F2))
          {
            JumpToBookmark(FALSE);
          }
          else if (bKeyDown && key == VK_F2)
          {
            JumpToBookmark(TRUE);
          }
        }
      }
      break;
    
    case SCN_DOUBLECLICK:
      NotifyDoubleClick();
      break;
      
      //       called when something changes and we want to show new indicator state or brace matching
    case SCN_UPDATEUI:
      {
        UpdateUI();
      }
      break;
      
    case SCEN_CHANGE:
      break;
      
    case SCN_ZOOM:
    case SCN_MODIFIED:
      {
        NotifyTextChanged();
      }      
      break;
      
    case SCN_MACRORECORD:
      break;

      // user clicked margin - try folding action
    case SCN_MARGINCLICK:
      {
        DoDefaultFolding(pMsg->margin, pMsg->position);
      }
      break;
    
    case SCN_NEEDSHOWN:
      break;
    case SCN_PAINTED:
      break;
    case SCN_USERLISTSELECTION:
      break;
    case SCN_URIDROPPED:
      break;
    case SCN_DWELLSTART:
      break;
    case SCN_DWELLEND:
      break;
    }
    return TRUE; // we processed the message
  }

  return TRUE;
}
示例#4
0
文件: clc_api.cpp 项目: fre2003/l3220
void CCmdCtl_i::Init()
{
  // clear all text styles
  SendMessage(SCI_CLEARDOCUMENTSTYLE, 0, 0);

  // set the number of styling bits to 7 - the asp/html views need a lot of styling - default is 5
  // If you leave the default you will see twiggle lines instead of ASP code
  SendMessage(SCI_SETSTYLEBITS, 5, 0);
  
  // set the display for indetation guides to on - this displays virtical dotted lines from the beginning of 
  // a code block to the end of the block
  //SendMessage(SCI_SETINDENTATIONGUIDES, TRUE, 0);

  // set tabwidth to 4
  SendMessage(SCI_SETTABWIDTH,4,0);

  // set the caret blinking time to 500 milliseconds
  SendMessage(SCI_SETCARETPERIOD,500,0);

  // source folding section  
  SendMessage(SCI_STYLESETFORE, STYLE_DEFAULT, (LPARAM) GetSysColor(COLOR_WINDOWTEXT)); // default text color
  SendMessage(SCI_STYLESETBACK, STYLE_DEFAULT, (LPARAM) GetSysColor(COLOR_WINDOW)); // default window color

  // set the forground color for some styles
  SendMessage(SCI_STYLESETFORE, 0, RGB(0,0,0));
  SendMessage(SCI_STYLESETFORE, 2, RGB(0,64,0));
  SendMessage(SCI_STYLESETFORE, 5, RGB(0,0,255));
  SendMessage(SCI_STYLESETFORE, 6, RGB(200,20,0));
  SendMessage(SCI_STYLESETFORE, 9, RGB(0,0,255));
  SendMessage(SCI_STYLESETFORE, 10, RGB(255,0,64));
  SendMessage(SCI_STYLESETFORE, 11, RGB(0,0,0));
  
  // set the backgroundcolor of brace highlights
  SendMessage(SCI_STYLESETBACK, STYLE_BRACELIGHT, RGB(0,255,0));
  
  // set end of line mode to CRLF
  // SendMessage(SCI_CONVERTEOLS, SC_EOL_LF, 0); //  
  SendMessage(SCI_SETEOLMODE, SC_EOL_LF, 0);
  //SendMessage(SCI_SETVIEWEOL, TRUE, 0);
  
  SendMessage(SCI_SETSELFORE,0,0);
  SendMessage(SCI_SETSELBACK,TRUE,RGB(0xC0,0xC0,0xC0)); // use a default value...
  
  SendMessage(SCI_SETCARETFORE,GetSysColor(COLOR_WINDOWTEXT),0); // default value
  SendMessage(SCI_SETCARETLINEVISIBLE,FALSE,0);
  
  // set markersymbol for marker type 0 - bookmark
  // define a set of markers to displa folding symbols
  SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPEN, SC_MARK_MINUS);
  SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDER,     SC_MARK_PLUS);
  SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDERSUB,  SC_MARK_EMPTY);
  SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDERTAIL, SC_MARK_EMPTY);
  SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDEREND,  SC_MARK_EMPTY);
  SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPENMID, SC_MARK_EMPTY);
  SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_EMPTY);
  
  SendMessage(SCI_SETEDGEMODE, EDGE_NONE, 0);
  SendMessage(SCI_SETINDENT,0,0);
  
  //SendMessage(SCI_SETCARETSTICKY,TRUE,0);
  SendMessage(SCI_SETCARETWIDTH,2,0);
  //SendMessage(SCI_WRAPCOUNT, 2);
  
  //SendMessage(SCI_MARKERDEFINE, 0, SC_MARK_CIRCLE);
  // display all margins
  //SetDisplayLinenumbers(TRUE);
  //SetDisplayFolding(TRUE);
  SetDisplaySelection(TRUE);
  
  // Dont use popup menu.
  SendMessage(SCI_USEPOPUP, 0);
  SendMessage(SCI_SETREADONLY, FALSE);

  SendMessage(SCI_SETVSCROLLBAR, TRUE);
  SendMessage(SCI_SETHSCROLLBAR, FALSE);
  
    // allow notifications for folding actions
  SendMessage(SCI_SETMODEVENTMASK, SC_MOD_INSERTTEXT|SC_MOD_DELETETEXT, 0);
  //   SendMessage(SCI_SETMODEVENTMASK, SC_MOD_CHANGEFOLD|SC_MOD_INSERTTEXT|SC_MOD_DELETETEXT, 0);
  // make the folding margin sensitive to folding events = if you click into the margin you get a notification event
  SendMessage(SCI_SETMARGINSENSITIVEN, 2, TRUE);
    
  SendMessage(SCI_SETMODEVENTMASK, /* SC_MODEVENTMASKALL */ SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT, 0);
  
  SendMessage(SCI_USEPOPUP, FALSE, 0);
  
  SendMessage(SCI_ASSIGNCMDKEY, (SCK_NEXT + (SCMOD_CTRL << 16)), SCI_PARADOWN);
  SendMessage(SCI_ASSIGNCMDKEY, (SCK_PRIOR + (SCMOD_CTRL << 16)), SCI_PARAUP);
  SendMessage(SCI_ASSIGNCMDKEY, (SCK_NEXT + ((SCMOD_CTRL | SCMOD_SHIFT) << 16)), SCI_PARADOWNEXTEND);
  SendMessage(SCI_ASSIGNCMDKEY, (SCK_PRIOR + ((SCMOD_CTRL | SCMOD_SHIFT) << 16)), SCI_PARAUPEXTEND);
  
  SendMessage(SCI_ASSIGNCMDKEY, (SCK_HOME + (0 << 16)), SCI_VCHOMEWRAP);
  SendMessage(SCI_ASSIGNCMDKEY, (SCK_END + (0 << 16)), SCI_LINEENDWRAP);
  SendMessage(SCI_ASSIGNCMDKEY, (SCK_HOME + (SCMOD_SHIFT << 16)), SCI_VCHOMEWRAPEXTEND);
  SendMessage(SCI_ASSIGNCMDKEY, (SCK_END + (SCMOD_SHIFT << 16)), SCI_LINEENDWRAPEXTEND);
  
  SendMessage(SCI_CMD_MODE,TRUE,0);
  SetCtrlCharMode(TRUE);
  
  AssignKey('C', SCMOD_CTRL, SCI_NULL);
  AssignKey('V', SCMOD_CTRL, SCI_NULL);
  
  // Nonprinting characters
  ShowPrintCharacter(FALSE, FALSE);
    
  SendMessage(SCI_SETUNDOCOLLECTION,0);
  SendMessage(SCI_EMPTYUNDOBUFFER);
  
  //SendMessage(SCI_ASSIGNCMDKEY, ('c' + (SCMOD_CTRL << 16)), SCI_COPY);
  //SendMessage(SCI_SETCODEPAGE,  SC_CP_UTF8, 0);
}