Beispiel #1
0
void CFLTKEditor::Undo2()
{
	TUndoBuf& bufUndo = GetUndo2Buf();

	if (bufUndo.size() == 0)
		return;

	m_bInUndo = true;
	SUndoData &Undo = bufUndo.back();

	if (!Undo.bInsert)
	{
		// We have to remove inserted data
		GetTextBuffer()->remove(Undo.iPos, Undo.iPos + int(Undo.sText.size()));	
		GetEditor()->insert_position(Undo.iPos);
		GetEditor()->show_insert_position();
	}
	else
	{
		// We have to insert deleted data
		GetTextBuffer()->insert(Undo.iPos, Undo.sText.c_str());
		GetEditor()->insert_position(Undo.iPos + int(Undo.sText.size()));
		GetEditor()->show_insert_position();
	}

	GetUndoBuf().push_back(Undo);
	bufUndo.pop_back();

	m_bInUndo = false;
}
Beispiel #2
0
void CFLTKEditor::Replace2()
{
	char *pcFind = (char *) m_pReplaceFind->value();
	char *pcReplace = (char *) m_pReplaceWith->value();

	if (pcFind[0] == 0) 
	{
		// Search string is blank; get a new one...
		m_pReplaceDlg->show();
		return;
	}

	m_pReplaceDlg->hide();

	int iPos = GetEditor()->insert_position();
	int iFound = GetTextBuffer()->search_forward(iPos, pcFind, &iPos);

	if (iFound) 
	{
		// Found a match; update the position and replace text...
		GetTextBuffer()->select(iPos, iPos + (int) strlen(pcFind));
		GetTextBuffer()->remove_selection();
		GetTextBuffer()->insert(iPos, pcReplace);
		GetTextBuffer()->select(iPos, iPos + (int) strlen(pcReplace));
		GetEditor()->insert_position(iPos + (int) strlen(pcReplace));
		GetEditor()->show_insert_position();
	}
	else 
	{
		fl_alert("No occurrences of \'%s\' found!", pcFind);
	}
}
Beispiel #3
0
void CFLTKEditor::New()
{
/*
	if (!CheckSave())
		return;
*/
	int iEditorID = NewEditor();
	char pcName[20];

	if (iEditorID < 0)
		return;

	SetCurEditor(iEditorID);

	GetFilename() = "";
	sprintf(pcName, "Untitled %d", sm_iNewFileNo++);
	GetName() = pcName;
	GetPath() = "./";
	GetTextBuffer()->select(0, GetTextBuffer()->length());
	GetTextBuffer()->remove_selection();
	IsFileChanged() = false;
	GetTextBuffer()->call_modify_callbacks();

	SetTitle();

	UpdateFileList();
}
void CTextEditor::Render(HDC hdc, const LOGFONT *plf)
{
    HFONT hFont = CreateFontIndirect(plf);

    if (hFont)
    {
        HFONT hFontOrg = (HFONT)SelectObject(hdc, hFont);

        _layout.Layout(hdc, GetTextBuffer(), GetTextLength());
        _layout.Render(hdc, GetTextBuffer(), GetTextLength(), _nSelStart, _nSelEnd, _pCompositionRenderInfo, _nCompositionRenderInfo);

        SelectObject(hdc, hFontOrg);
        DeleteObject(hFont);
    }
}
Beispiel #5
0
void CFLTKEditor::SaveFile(const char* pcFilename)
{
	if (GetTextBuffer()->savefile(pcFilename))
	{
		fl_alert("Error writing to file \'%s\':\n%s.", pcFilename, strerror(errno));
	}
	else
	{
		GetFilename() = pcFilename;
		SetNameAndPath();
	}

	IsFileChanged() = false;
	//SetTitle();
	GetTextBuffer()->call_modify_callbacks();
}
Beispiel #6
0
void CFLTKEditor::ReplaceAll()
{
	char *pcFind = (char *) m_pReplaceFind->value();
	char *pcReplace = (char *) m_pReplaceWith->value();

	if (pcFind[0] == 0) 
	{
		// Search string is blank; get a new one...
		m_pReplaceDlg->show();
		return;
	}

	m_pReplaceDlg->hide();

	GetEditor()->insert_position(0);

	// Loop through the whole string
	int iFound;
	int iTimes = 0;

	do 
	{
		int iPos = GetEditor()->insert_position();
		iFound = GetTextBuffer()->search_forward(iPos, pcFind, &iPos);

		if (iFound) 
		{
			// Found a match; update the position and pcReplace text...
			GetTextBuffer()->select(iPos, iPos + (int) strlen(pcFind));
			GetTextBuffer()->remove_selection();
			GetTextBuffer()->insert(iPos, pcReplace);
			GetEditor()->insert_position(iPos + (int) strlen(pcReplace));
			GetEditor()->show_insert_position();
			iTimes++;
		}
	} while (iFound);

	if (iTimes) 
	{
		fl_message("Replaced %d occurrences.", iTimes);
	}
	else 
	{
		fl_alert("No occurrences of \'%s\' found!", pcFind);
	}
}
Beispiel #7
0
void CCredits::AddCredits()
{
	// Sanity checks...

	if (!g_pLTClient) return;


	// Get the credits text buffer...

	char* sName = NULL;

	switch (GetMode())
	{
		case CM_INTRO:		sName = "INTRO"; break;
		case CM_CREDITS:	sName = "CREDITS"; break;
		case CM_DEMO_INFO:	sName = "DEMOINFO"; break;
		case CM_DEMO_INTRO:	sName = "DEMOINTRO"; break;
		case CM_DEMO_MULTI:	sName = "DEMOMULTI"; break;

		default: sName = "CREDITS";
	}

	char* sBuf = GetTextBuffer(sName);
	if (!sBuf) return;


	// Parse the credits text...

	char sCredit[1024];
	int  i = 0;

	while (*sBuf)
	{

		if (*sBuf == '#' && *(sBuf+1) == '#')
		{
			sCredit[i] = '\0';

			if (strncmp(sCredit, ">END", 4) == 0)	// end?
			{
				return;
			}

			AddCredit(sCredit);
			i = 0;

			sBuf+=2;

			while (*sBuf != '\0' && ((*sBuf == '\n') || (*sBuf == '\r'))) sBuf++;
		}
		else
		{
			memcpy(&sCredit[i], sBuf, 1);
			i++;
			sBuf++;
		}
	}
}
Beispiel #8
0
bool CFLTKEditor::LoadFile(const char* pcFilename, int iPos)
{
	m_bLoading = true;

	bool bInsert = false;

	if (iPos >= 0)
		bInsert = true;

	IsFileChanged() = bInsert;

	int iR;
	if (!bInsert) 
	{
		GetFilename() = "";
		iR = GetTextBuffer()->loadfile(pcFilename);
	}
	else 
	{
		iR = GetTextBuffer()->insertfile(pcFilename, iPos);
	}

	if (iR)
	{
		fl_alert("Error reading from file \'%s\':\n%s.", pcFilename, strerror(errno));
	}
	else
	{
		if (!bInsert) 
			GetFilename() = pcFilename;
		
		SetNameAndPath();
	}

	m_bLoading = false;
	GetTextBuffer()->call_modify_callbacks();

	if (iR)
		return false;
	else
		return true;
}
ULONG CTextEditor::OnReconvertString(RECONVERTSTRING *pReconv)
{
    DWORD dwSize;
    DWORD dwStrStart;
    DWORD dwStrLen;

    // If there is a composition string already, we don't allow reconversion.
    if (_nCompEnd - _nCompStart)
    {
        return 0;
    }

    // Return the current selection to be the composition string
    // and give 40 surrounded charcters (20 prev and 20 after) for adjusting the composition string.
    if (_nSelStart > 20)
    {
        dwStrStart = _nSelStart - 20;
    }
    else
    {
        dwStrStart = 0;
    }

    if (_nSelEnd + 20 > GetTextLength())
    {
        dwStrLen = GetTextLength() - dwStrStart;
    }
    else
    {
        dwStrLen = _nSelEnd + 20 - dwStrStart;
    }

    dwSize = sizeof(RECONVERTSTRING) + (dwStrLen * sizeof(WCHAR));
    if (!pReconv)
    {
        return dwSize;
    }

    if (pReconv->dwSize < dwSize)
    {
        return 0;
    }

    pReconv->dwStrLen = dwStrLen;
    pReconv->dwStrOffset = sizeof(RECONVERTSTRING);
    memcpy((BYTE *)pReconv + sizeof(RECONVERTSTRING), (void *)(GetTextBuffer() + dwStrStart), dwStrLen * sizeof(WCHAR));

    pReconv->dwCompStrLen = _nSelEnd - _nSelStart;
    pReconv->dwCompStrOffset = (_nSelStart - dwStrStart) * sizeof(WCHAR);
    pReconv->dwTargetStrLen = _nSelEnd - _nSelStart;
    pReconv->dwTargetStrOffset = (_nSelStart - dwStrStart) * sizeof(WCHAR);

    return dwSize;
}
Beispiel #10
0
void CFLTKEditor::Close()
{
	if (!CheckSave())
		return;

	if (m_iCurEditorID < 0 || m_iCurEditorID >= int(m_mEditorData.Count()) )
		return;

	DeleteEditor(m_iCurEditorID);

	if (m_iCurEditorID > 0)
	{
		m_iCurEditorID--;
		SetCurEditor(m_iCurEditorID);
	}
	else if (m_iCurEditorID >= int(m_mEditorData.Count()))
	{
		char pcName[100];

		NewEditor();
		m_iCurEditorID = 0;
		SetCurEditor(m_iCurEditorID);

		GetFilename() = "";
		sprintf(pcName, "Untitled %d", sm_iNewFileNo++);
		GetName() = pcName;
		GetPath() = "./";
		GetTextBuffer()->select(0, GetTextBuffer()->length());
		GetTextBuffer()->remove_selection();
		IsFileChanged() = false;
		GetTextBuffer()->call_modify_callbacks();

		SetTitle();
	}

	UpdateFileList();
}
ULONG CTextEditor::OnDocumentFeed(RECONVERTSTRING *pReconv)
{
    // Return the current composition string.
    UINT nCompStart = (_nCompEnd - _nCompStart) ? _nCompStart : _nSelStart;
    UINT nCompEnd = (_nCompEnd - _nCompStart) ? _nCompEnd : _nSelEnd;
    DWORD dwSize;
    DWORD dwStrStart;
    DWORD dwStrLen;

    if (nCompStart > 20)
    {
        dwStrStart = nCompStart - 20;
    }
    else
    {
        dwStrStart = 0;
    }

    if (nCompEnd + 20 > GetTextLength())
    {
        dwStrLen = GetTextLength() - dwStrStart;
    }
    else
    {
        dwStrLen = nCompEnd + 20 - dwStrStart;
    }

    dwSize = sizeof(RECONVERTSTRING) + (dwStrLen * sizeof(WCHAR));
    if (!pReconv)
    {
        return dwSize;
    }

    if (pReconv->dwSize < dwSize)
    {
        return 0;
    }

    pReconv->dwStrLen = dwStrLen;
    pReconv->dwStrOffset = sizeof(RECONVERTSTRING);
    memcpy((BYTE *)pReconv + sizeof(RECONVERTSTRING), (void *)(GetTextBuffer() + dwStrStart), dwStrLen * sizeof(WCHAR));

    pReconv->dwCompStrLen = nCompEnd - nCompStart;
    pReconv->dwCompStrOffset = (nCompStart - dwStrStart) * sizeof(WCHAR);
    pReconv->dwTargetStrLen = nCompEnd - nCompStart;
    pReconv->dwTargetStrOffset = (nCompStart - dwStrStart) * sizeof(WCHAR);

    return dwSize;
}
Beispiel #12
0
void CFLTKEditor::Find2()
{
	if (GetSearchString()[0] == 0) 
	{
		// Search string is blank; get a new one...
		Find();
		return;
	}

	int iPos = GetEditor()->insert_position();
	int iFound = GetTextBuffer()->search_forward(iPos, GetSearchString(), &iPos);

	if (iFound) 
	{
		// Found a match; select and update the position...
		GetTextBuffer()->select(iPos, iPos + (int) strlen(GetSearchString()));
		GetEditor()->insert_position(iPos + (int) strlen(GetSearchString()));
		GetEditor()->show_insert_position();
	}
	else 
	{
		fl_alert("No occurrences of \'%s\' found!", GetSearchString());
	}
}
Beispiel #13
0
void CFLTKEditor::UnIndent()
{
	bool bChangedBuffer = false;
	int iSelStart = 0, iSelEnd = 0, iCurPos = 0, iTabSize, i;
	char *pcLine;
	Fl_Text_Buffer *pBuffer = GetTextBuffer();

	pBuffer->selection_position(&iSelStart, &iSelEnd);
	if (iSelEnd > iSelStart)
	{
		iCurPos = pBuffer->line_start(iSelStart);
		iTabSize = pBuffer->tab_distance();

		while (pBuffer->line_end(iCurPos) < iSelEnd)
		{
			pcLine = pBuffer->line_text(iCurPos);
			if (pcLine[0] == '\t')
			{
				bChangedBuffer = true;
				pBuffer->remove(iCurPos, iCurPos+1);
				--iSelEnd;
			}
			else if (pcLine[0] == ' ')
			{
				for (i = 1; i < iTabSize; i++)
				{
					if (pcLine[i] != ' ')
						break;
				}

				if (i == iTabSize) // same number of spaces as a tab
				{
					bChangedBuffer = true;
					pBuffer->remove(iCurPos, iCurPos + iTabSize);
					iSelEnd -= iTabSize;
				}
			}
			iCurPos = pBuffer->skip_lines(iCurPos, 1);
			free(pcLine);
		}

		if (bChangedBuffer)
			pBuffer->select(pBuffer->line_start(iSelStart), iSelEnd);
	}
}
void CTextEditor::UpdateLayout(const LOGFONT *plf)
{
    HDC hdc = GetDC(_hwnd);
    if (hdc)
    {
        HFONT hFont = CreateFontIndirect(plf);
        if (hFont)
        {
            HFONT hFontOrg = (HFONT)SelectObject(hdc, hFont);

            _layout.Layout(hdc, GetTextBuffer(), GetTextLength());

            SelectObject(hdc, hFontOrg);
            DeleteObject(hFont);
        }
        ReleaseDC(_hwnd, hdc);
    }
}
Beispiel #15
0
bool CFLTKEditor::SetCurEditor(int iFileID)
{
	if (iFileID < 0 || iFileID >= int(m_mEditorData.Count()))
		return false;

	if (m_iCurEditorID >= 0)
	{
		m_mEditorData[m_iCurEditorID].m_pEditor->hide();
	}

	m_mEditorData[iFileID].m_pEditor->show();
	resizable(m_mEditorData[iFileID].m_pEditor);
	m_iCurEditorID = iFileID;

	GetTextBuffer()->call_modify_callbacks();
	SetTitle();

	return true;
}
Beispiel #16
0
void CFLTKEditor::Indent()
{
	bool bChangedBuffer = false;
	int iSelStart = 0, iSelEnd = 0, iCurPos = 0;
	Fl_Text_Buffer *pcBuffer = GetTextBuffer();

	pcBuffer->selection_position(&iSelStart, &iSelEnd);
	if (iSelEnd <= iSelStart)
		return;

	iCurPos = pcBuffer->line_start(iSelStart);
	while (pcBuffer->line_end(iCurPos) < iSelEnd)
	{
		bChangedBuffer = true;
		pcBuffer->insert(iCurPos, "\t");
		iCurPos = pcBuffer->skip_lines(iCurPos, 1);
		++iSelEnd;
	}

	if (bChangedBuffer)
		pcBuffer->select(pcBuffer->line_start(iSelStart), iSelEnd);
}
Beispiel #17
0
/* ----------------------------------------------------------------------
   TtaSetAttributeText

   Changes the value of an attribute of type text.
   Parameters:
   attribute: the attribute to be modified.
   buffer: character string representing the new value of the attribute.
   element: the element with which the attribute is associated,
   NULL if the attribute is not yet associated with an element.
   document: the document to which the element belongs.
   Must be 0 if element is NULL.
   ---------------------------------------------------------------------- */
void TtaSetAttributeText (Attribute attribute, const char* buffer,
                          Element element, Document document)
{
  int                 lg;
  PtrAttribute        pAttr;
#ifndef NODISPLAY
  PtrAttribute        pPrevAttr, pA;
#endif /* NODISPLAY */
  Language	      lang;

  UserErrorCode = 0;
  pAttr = (PtrAttribute) attribute;
  if (pAttr == NULL)
    TtaError (ERR_invalid_parameter);
  else if (pAttr->AeAttrType != AtTextAttr)
    TtaError (ERR_invalid_attribute_type);
  else if (AttrOfElement (attribute, element))
    {
#ifndef NODISPLAY
      if (element != NULL)
        {
          /* detach temporarily attribute from element */
          pPrevAttr = NULL;
          pA = ((PtrElement) element)->ElFirstAttr;
          while (pA && pA != pAttr)
            {
              pPrevAttr = pA;
              pA = pA->AeNext;
            }
          if (pA)
            {
              if (pPrevAttr)
                pPrevAttr->AeNext = pA->AeNext;
              else
                ((PtrElement) element)->ElFirstAttr = pA->AeNext;
            }
          /* de-apply all presentation rules related to the attribute */
          UndisplayInheritedAttributes ((PtrElement) element, pAttr, document,
                                        TRUE);
          /* reattach attribute to element */
          if (pA)
            {
              if (pPrevAttr)
                pPrevAttr->AeNext = pAttr;
              else
                ((PtrElement) element)->ElFirstAttr = pAttr;
            }
        }
#endif
      if (pAttr->AeAttrText == NULL)
        GetTextBuffer (&pAttr->AeAttrText);
      else
        ClearText (pAttr->AeAttrText);
      /* Sets the new value */
      CopyStringToBuffer ((unsigned char *)buffer, pAttr->AeAttrText, &lg);
      if (pAttr->AeAttrNum == 1)
        /* language attribute */
        {
          lang = TtaGetLanguageIdFromName (buffer);
#ifdef NODISPLAY
          ChangeLanguageLeaves((PtrElement) element, lang);
#else
          ChangeLanguage (LoadedDocument[document - 1],
                          (PtrElement) element, lang, FALSE);
#endif
        }
#ifndef NODISPLAY
      if (element != NULL)
        DisplayAttribute ((PtrElement) element, pAttr, document);
#endif
    }
}
Beispiel #18
0
void CFLTKEditor::Changed(int iVal, int nInserted, int nDeleted, 
						  int iVal2, const char* pcVal)
{
	if ((nInserted || nDeleted) && !m_bLoading)
	{
		IsFileChanged() = true;
		
		if (!m_bInUndo)
		{
			bool bNewUndo = true;
			char *pcEndChar = " \n";

			GetUndo2Buf().clear();

			if (nInserted > 0)
			{
				TUndoBuf& bufUndo = GetUndoBuf();
				char *pcText = GetTextBuffer()->text_range(iVal, iVal + nInserted);
				int iTextSize = int(strlen(pcText));

				if (bufUndo.size() > 0)
				{
					SUndoData &PrevUndo = bufUndo.back();
					int iUndoTextSize = int(PrevUndo.sText.size());
					char cLastChar = PrevUndo.sText.at(iUndoTextSize - 1);

					if (iVal == PrevUndo.iPos+iUndoTextSize &&
						PrevUndo.bInsert &&
						iTextSize == 1 &&
						strchr(pcEndChar, cLastChar) == 0)
					{
						PrevUndo.sText += pcText;
						bNewUndo = false;
					}
				}

				if (bNewUndo)
				{
					int iUndoSize = int(bufUndo.size());
					if (iUndoSize == m_iMaxUndoSteps)
					{
						bufUndo.erase(bufUndo.begin());
					}

					SUndoData Undo;

					Undo.iPos = iVal;
					Undo.bInsert = true;
					Undo.sText = pcText;

					bufUndo.push_back(Undo);
				}
			}
			else if (nDeleted > 0)
			{
				TUndoBuf& bufUndo = GetUndoBuf();
				const char *pcText = pcVal;
				int iTextSize = int(strlen(pcText));

				if (bufUndo.size() > 0)
				{
					SUndoData &PrevUndo = bufUndo.back();
					char cFirstChar = PrevUndo.sText.at(0);

					if (iVal == PrevUndo.iPos-1 &&
						!PrevUndo.bInsert &&
						iTextSize == 1 &&
						strchr(pcEndChar, cFirstChar) == 0)
					{
						PrevUndo.sText.insert(0, pcText);
						PrevUndo.iPos--;
						bNewUndo = false;
					}
				}

				if (bNewUndo)
				{
					int iUndoSize = int(bufUndo.size());
					if (iUndoSize == m_iMaxUndoSteps)
					{
						bufUndo.erase(bufUndo.begin());
					}

					SUndoData Undo;
					Undo.iPos = iVal;
					Undo.bInsert = false;
					Undo.sText = pcText;

					bufUndo.push_back(Undo);
				}
			}
		}
	}

	SetTitle();

	if (m_bLoading) 
		GetEditor()->show_insert_position();
}
Beispiel #19
0
void CFLTKEditor::StyleUpdate(int iPos, int nInserted,	int nDeleted,
							  int nRestyled, const char *deletedText)
{
	int	iStart,			// Start of text
		iEnd;			// End of text

	char	cLast,			// Last style on line
		*pcStyle,		// Style data
		*pcText;		// Text data


	// If this is just a selection change, just unselect the style buffer...
	if (nInserted == 0 && nDeleted == 0) 
	{
		GetStyleBuffer()->unselect();
		return;
	}

	// Track changes in the text buffer...
	if (nInserted > 0) 
	{
		// Insert characters into the style buffer...
		pcStyle = new char[nInserted + 1];
		memset(pcStyle, 'A', nInserted);
		pcStyle[nInserted] = '\0';

		GetStyleBuffer()->replace(iPos, iPos + nDeleted /*nInserted*/, pcStyle);
		delete[] pcStyle;
	} 
	else 
	{
		// Just delete characters in the style buffer...
		GetStyleBuffer()->remove(iPos, iPos + nDeleted);
	}

	// Select the area that was just updated to avoid unnecessary
	// callbacks...
	if (iPos > 0)
		iPos--;

	GetStyleBuffer()->select(iPos, iPos + nInserted - nDeleted + 1);

	// Re-parse the changed region; we do this by parsing from the
	// beginning of the line of the changed region to the end of
	// the line of the changed region...  Then we check the last
	// style character and keep updating if we have a multi-line
	// comment character...
	iStart = GetTextBuffer()->line_start(iPos);
	iEnd   = GetTextBuffer()->line_end(iPos + nInserted + 1);
	if (iEnd+1 < GetTextBuffer()->length())
		iEnd++;

	pcText  = GetTextBuffer()->text_range(iStart, iEnd);
	pcStyle = GetStyleBuffer()->text_range(iStart, iEnd);
	cLast  = pcStyle[iEnd - iStart - 1];

	//  printf("iStart = %d, iEnd = %d, pcText = \"%s\", pcStyle = \"%s\"...\n",
	//         iStart, iEnd, pcText, pcStyle);

	m_bReparsing = false;
	m_bReparseAll = false;
	StyleParse(pcText, pcStyle, iEnd - iStart);

	//  printf("new pcStyle = \"%s\"...\n", pcStyle);

	GetStyleBuffer()->replace(iStart, iEnd, pcStyle);
	GetEditor()->redisplay_range(iStart, iEnd);

	if (m_bReparseAll) //cLast != pcStyle[iEnd - iStart - 1] || pcStyle[iEnd - iStart - 1] == 'Z') 
	{
		// The cLast character on the line changed styles, so reparse the
		// remainder of the buffer...
		free(pcText);
		free(pcStyle);

		iStart = 0;
		iEnd   = GetTextBuffer()->length();
		pcText  = GetTextBuffer()->text_range(iStart, iEnd);
		pcStyle = GetStyleBuffer()->text_range(iStart, iEnd);

		m_bReparsing = true;
		StyleParse(pcText, pcStyle, iEnd - iStart);

		GetStyleBuffer()->replace(iStart, iEnd, pcStyle);
		GetEditor()->redisplay_range(iStart, iEnd);
	}

	free(pcText);
	free(pcStyle);
}
Beispiel #20
0
bool CFLTKEditor::HighlightLinePos(const char *pcFilename, int iInputPos)
{
	if (iInputPos < 0)
		return false;

	int iTextPos, iLineStart, iLineEnd;
	char pcSearchName[300], *pcPoint;
	string sName;

	strncpy(pcSearchName, pcFilename, 299);
	if ((pcPoint = strstr(pcSearchName, ".clu")))
	{
		*pcPoint = 0;
	}

//	if (GetFilename().size() == 0)
		sName = GetPath() + GetName();
//	else
//		sName = GetFilename();

	if (pcSearchName != sName)
	{
		int i, iCount = m_mEditorData.Count();

		for (i = 0; i < iCount; i++)
		{
			//sName = m_mEditorData[i].m_sFilename;
			//if (sName.size() == 0)
			//{
				sName = m_mEditorData[i].m_sPath + m_mEditorData[i].m_sName;
			//}

			if (sName == pcSearchName)
			{
				SetCurEditor(i);
				m_pFileChoice->value(i);
				break;
			}
		}

		// File not opened yet
		if (i == iCount)
		{
			sName = pcSearchName;
			sName = sName + ".clu";
			CFLTKEditor::New();
			CFLTKEditor::LoadFile(sName.c_str());
			UpdateFileList();
		}
	}

	//iTextPos = GetTextBuffer()->skip_lines(0, iLine-1);
	iTextPos = iInputPos + 1;
	if (iTextPos >= GetTextBuffer()->length())
		iTextPos = GetTextBuffer()->length()-2;

	iLineStart = GetTextBuffer()->line_start(iTextPos);
	iLineEnd = GetTextBuffer()->line_end(iTextPos);
	GetTextBuffer()->select(iLineStart, iLineEnd);

	GetEditor()->insert_position(iTextPos);
	GetEditor()->show_insert_position();

	GetTextBuffer()->call_modify_callbacks();

	return true;
}
Beispiel #21
0
void CFLTKEditor::Delete()
{
	GetTextBuffer()->remove_selection();
}