示例#1
0
long CMUSHclientDoc::TextRectangle(long Left, long Top, long Right, long Bottom, 
                                   long BorderOffset, 
                                   long BorderColour, long BorderWidth, 
                                   long OutsideFillColour, long OutsideFillStyle) 
{


  CBrush br;

  if (ValidateBrushStyle (OutsideFillStyle, BorderColour, OutsideFillColour, br) != eOK)
    return eBrushStyleNotValid;

  m_TextRectangle = CRect (Left, Top, Right, Bottom);

  m_TextRectangleBorderOffset =       BorderOffset;      
  m_TextRectangleBorderColour =       BorderColour;        
  m_TextRectangleBorderWidth =        BorderWidth;         
  m_TextRectangleOutsideFillColour =  OutsideFillColour;
  m_TextRectangleOutsideFillStyle =   OutsideFillStyle; 
  bool bFixedWindowWidth = false;

  // refresh views  - get scroll bars right

  for(POSITION pos=GetFirstViewPosition();pos!=NULL;)
	  {
	  CView* pView = GetNextView(pos);
	  
	  if (pView->IsKindOf(RUNTIME_CLASS(CMUSHView)))
  	  {
		  CMUSHView* pmyView = (CMUSHView*)pView;

		  pmyView->addedstuff();

      // now fix up auto-wrapping column if required
      if (!bFixedWindowWidth)
        {
        bFixedWindowWidth = true;
        pmyView->AutoWrapWindowWidth(this);
        }   // if not already done
      }	  // if CMUSHView
    }  // end for
       
  SendWindowSizes (m_nWrapColumn);  // notify of different window height
  Redraw ();
	return eOK;
}   // end of CMUSHclientDoc::TextRectangle
示例#2
0
long CMUSHclientDoc::SetOptionItem (const int iItem, 
                                    long Value, 
                                    const bool bDoSpecial,
                                    const bool bInclude) 
  {
bool bChanged;

long iResult = SetBaseOptionItem (iItem, 
                                  OptionsTable, 
                                  NUMITEMS (OptionsTable),
                                  (char *) this,
                                  Value,
                                  bChanged);

  if (iResult != eOK)
    return iResult;

  if (bChanged)
    SetModifiedFlag ();

  if (bInclude)
    {
    m_NumericConfiguration [iItem]->bInclude = true;
    m_NumericConfiguration [iItem]->iValue = Value;
    }

  // specials wanted?
  if (!bDoSpecial)
    return eOK;
  
// some special handling

  if (OptionsTable [iItem].iFlags & OPT_FIX_OUTPUT_BUFFER)
    if (m_pCurrentLine)     // a new world might not have a line yet
      FixUpOutputBuffer (Value);

  if (OptionsTable [iItem].iFlags & OPT_FIX_INPUT_WRAP)
	  FixInputWrap();

  if (OptionsTable [iItem].iFlags & OPT_FIX_WRAP_COLUMN)
    {
    if (m_pCurrentLine)     // a new world might not have a line yet
      {
      // save current line text
      CString strLine = CString (m_pCurrentLine->text, m_pCurrentLine->len);

#ifdef USE_REALLOC
      m_pCurrentLine->text  = (char *) 
            realloc (m_pCurrentLine->text, 
                     MAX (m_pCurrentLine->len, Value) 
                     * sizeof (char));  
#else
      delete [] m_pCurrentLine->text;
      m_pCurrentLine->text = new char [MAX (m_pCurrentLine->len, Value)];
#endif

      // put text back
      memcpy (m_pCurrentLine->text, (LPCTSTR) strLine, m_pCurrentLine->len);
      ASSERT (m_pCurrentLine->text);
      }   // end of having a current line
    SendWindowSizes (Value);
    }

  if (OptionsTable [iItem].iFlags & OPT_FIX_SPEEDWALK_DELAY)
    SetSpeedWalkDelay ((short) Value);

  POSITION pos;

  if (OptionsTable [iItem].iFlags & OPT_FIX_TOOLTIP_VISIBLE)
    {
    for(pos = GetFirstViewPosition(); pos != NULL;)
    	{
    	CView* pView = GetNextView(pos);
    	if (pView->IsKindOf(RUNTIME_CLASS(CMUSHView)))
      	{
    		CMUSHView* pmyView = (CMUSHView*)pView;
        if (pmyView->m_ToolTip.m_hWnd)
    		  pmyView->m_ToolTip.SendMessage(TTM_SETDELAYTIME, TTDT_AUTOPOP, Value - 1);  // zero will be default  (-1)
    	  }	  // end if
      }  // end for
    } // end of OPT_FIX_TOOLTIP_VISIBLE

  if (OptionsTable [iItem].iFlags & OPT_FIX_TOOLTIP_START)
    {
    for(pos = GetFirstViewPosition (); pos != NULL;)
    	{
    	CView* pView = GetNextView(pos);
    	if (pView->IsKindOf(RUNTIME_CLASS(CMUSHView)))
      	{
    		CMUSHView* pmyView = (CMUSHView*)pView;
        if (pmyView->m_ToolTip.m_hWnd)
      		pmyView->m_ToolTip.SendMessage(TTM_SETDELAYTIME, TTDT_INITIAL, Value - 1);  // zero will be default  (-1)
    	  }	  // end if
      }  // end for
    } // end of OPT_FIX_TOOLTIP_START

  if (OptionsTable [iItem].iFlags & OPT_USE_MXP)
    {
    if (m_iUseMXP == eNoMXP && m_bMXP)
      MXP_Off (true);
    else if (m_iUseMXP == eUseMXP && !m_bMXP)
      MXP_On (false, true);   // not pueblo, manually on
    }

  if (OptionsTable [iItem].iFlags & OPT_UPDATE_INPUT_FONT)
    ChangeInputFont (m_input_font_height, 
                     m_input_font_name, 
                     m_input_font_weight, 
                     m_input_font_charset,
                     m_input_font_italic);

  if (OptionsTable [iItem].iFlags & OPT_UPDATE_OUTPUT_FONT)
    ChangeFont (m_font_height, 
                m_font_name, 
                m_font_weight, 
                m_font_charset,
                m_bShowBold,
                m_bShowItalic,
                m_bShowUnderline,
                m_iLineSpacing);

  if (OptionsTable [iItem].iFlags & OPT_UPDATE_VIEWS)
    UpdateAllViews (NULL);  


  return eOK;

  } // end of CMUSHclientDoc::SetOptionItem