Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/jrincayc/ucblogo-code
26 January 2024, 08:32:20 UTC
  • Code
  • Branches (8)
  • Releases (24)
  • Visits
Revision 8d03f497146e641d7c3785ab2562b5148584fb3d authored by Joshua Cogliati on 22 November 2020, 22:08:40 UTC, committed by GitHub on 22 November 2020, 22:08:40 UTC
Merge pull request #64 from dmalec/ISSUE-63
ISSUE-63: Exit getFromWX_2 input loop on pause character sequence.
2 parent s a7bd4e1 + 4aa84f2
  • Files
  • Changes
    • Branches
    • Releases
    • HEAD
    • refs/heads/debug_stop
    • refs/heads/fix_39
    • refs/heads/makefile_updates_v2
    • refs/heads/master
    • refs/heads/message_fix
    • refs/heads/release_624_changes
    • refs/heads/utf8_play
    • refs/tags/dev-latest
    • 8d03f497146e641d7c3785ab2562b5148584fb3d
    • version_6.2.5rc1
    • version_6.2.4rc1
    • version_6.2.4
    • version_6.2.3rc1
    • version_6.2.3
    • version_6.2.2
    • version_6.2.1
    • version_6.2
    • version_6.1
    • version_6.0
    • pre_release_6_2_b
    • pre_release_6_2_a
    • pre_release_6_2_2
    • pre_release_6_1_c
    • pre_release_6_1_b
    • pre_release_6_1_a
    • last_svn_version
    • debian/6.2.4-1
    • debian/6.2.3-1
    • debian/6.2.2-3
    • debian/6.2.2-2
    • debian/6.2.2-1
    • debian/6.2.1-2
    • debian/6.2.1-1
  • d96b992
  • /
  • TextEditor.cpp
Raw File Download
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
  • snapshot
origin badgerevision badge
swh:1:rev:8d03f497146e641d7c3785ab2562b5148584fb3d
origin badgedirectory badge
swh:1:dir:d96b9928ef893466ad4079ec4316955146303f57
origin badgecontent badge
swh:1:cnt:2a46c2faddfc7463fb6eada7ea0d0488c00a6c89
origin badgesnapshot badge
swh:1:snp:6eedb1da19a602bcc290a95dfe80bedb7646053c

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: 8d03f497146e641d7c3785ab2562b5148584fb3d authored by Joshua Cogliati on 22 November 2020, 22:08:40 UTC
Merge pull request #64 from dmalec/ISSUE-63
Tip revision: 8d03f49
TextEditor.cpp
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <iostream>
#include "wx/wx.h"
//#include "gterm.hpp"
#include "LogoFrame.h"
#include "wxGlobals.h"
#include <wx/clipbrd.h>
#include <wx/html/htmprint.h>
#include <wx/print.h>
#include <wx/printdlg.h>
#include <wx/msgdlg.h>
#include <wx/colour.h>
#include "TextEditor.h"
#include "wxTurtleGraphics.h"
#include "wxTerminal.h"		/* must come after wxTurtleGraphics.h */


// ----------------------------------------------------------------------------
// TextEditor
// ----------------------------------------------------------------------------

BEGIN_EVENT_TABLE (TextEditor, wxTextCtrl)
EVT_CHAR(TextEditor::OnChar)  
EVT_TEXT(wxID_ANY, TextEditor::SetThisFont)
EVT_FIND(wxID_ANY, TextEditor::OnFindDialog)
EVT_CLOSE(TextEditor::OnCloseEvent)
END_EVENT_TABLE()


// globals for signalling to logo 
int editor_active = 0; 

/* The constructor */
TextEditor::TextEditor(wxWindow* const f, int a, wxString s, const wxPoint& p , const wxSize& sz, int b, wxFont font ) :
wxTextCtrl(f, a, s, p, sz, b)
{
	findDlg=0;
	findData=0;
	prevFind=0;
	this->font = font;
	SetFont(font);
}

void TextEditor::SetFont(wxFont font){
	this->font = font;
	SetForegroundColour(TurtleCanvas::colors[wxTerminal::terminal->m_curFG]);
	SetDefaultStyle(wxTextAttr(TurtleCanvas::colors[wxTerminal::terminal->m_curFG],
				   TurtleCanvas::colors[wxTerminal::terminal->m_curBG], font));
	if(this->IsShown()){
		SetStyle(0,GetLastPosition(),
			 wxTextAttr(TurtleCanvas::colors[wxTerminal::terminal->m_curFG],
				    TurtleCanvas::colors[wxTerminal::terminal->m_curBG],font));
    SetBackgroundColour(
		TurtleCanvas::colors[wxTerminal::terminal->m_curBG]);
		Refresh();
		Update();
	}
}

void TextEditor::SetThisFont(wxCommandEvent& event) {
	SetDefaultStyle(wxTextAttr(TurtleCanvas::colors[wxTerminal::terminal->m_curFG],
				   TurtleCanvas::colors[wxTerminal::terminal->m_curBG], this->font));
	if(this->IsShown()){
		SetStyle(GetLastPosition()-1, GetLastPosition(),
			 wxTextAttr(TurtleCanvas::colors[wxTerminal::terminal->m_curFG],
				    TurtleCanvas::colors[wxTerminal::terminal->m_curBG],this->font));
	    SetBackgroundColour(
			TurtleCanvas::colors[wxTerminal::terminal->m_curBG]);
		Refresh();
		Update();
		Refresh();
		Update();
	}
}

/* Loads the given filename into the text editor*/
bool TextEditor::Load(const wxString& filename){
	file = filename;
	LoadFile(file);
	SetFont(font);
	return true;
}

void TextEditor::OnFindNext(){
	wxFindDialogEvent event;
	event.SetFindString(*prevFind);
	OnFindDialog(event);
	
}

void TextEditor::OnFind(){
	if(findDlg)
		return;
	findData = new wxFindReplaceData();
	findDlg = new wxFindReplaceDialog(this, findData, wxString("Find...", wxConvUTF8), wxFR_NOWHOLEWORD | 
									  wxFR_NOMATCHCASE | wxFR_NOUPDOWN );
	findDlg->Show(TRUE);
	
	
}

/* This is called when someone pressed the Find button inside
	the finder dialog */
void TextEditor::OnFindDialog(wxFindDialogEvent& event)
{
	long int start, end, dummy, loc;
	end = GetLastPosition();
	wxString textstring(GetRange(0, GetLastPosition()));
	GetSelection(&dummy,&start);
	wxString findString(event.GetFindString());
	if(prevFind){
		delete prevFind;
	}
	prevFind = new wxString(findString);
	loc = Find(findString, start);
	
	// if we didn't find anything, try again from the beginning
	if (loc == -1 && start != 0){
		start = 0;
		loc = Find(findString, start);
	}
	if (loc == -1){
		wxMessageDialog dlg(this, wxString("Not Found", wxConvUTF8),
							wxString("Find String Not Found", wxConvUTF8),
							wxOK | wxICON_INFORMATION);
		dlg.ShowModal();
		dlg.Destroy();
		if (findDlg){
			if (loc == -1)
				findDlg->SetFocus();
			return;
		}
	}
	
	else{
		if(findDlg){
			delete findDlg->GetData();	
			findDlg->Destroy();
			findDlg=0;
		}
		ShowPosition(loc);
	}
}

/* This finds the next instance of a search string ESEARCH
within the entire text of the editor starting from
START
*/
int TextEditor::Find (const wxString & sSearch, int start){
    wxString allText = GetValue();
	wxString sText = allText.Mid(start);
	// the replace is for windows compatibility
#ifdef __WXMSW__
	sText.Replace(wxT( "\n" ), wxT( " \n" ) ) ;
#endif
    int iStart =sText.Find (sSearch);
    if(iStart == -1)
		return -1;
	if(iStart==0){
		if(sText.Mid(0,sSearch.length()) != sSearch)
			return -1;
	}
	int iEnd = iStart + sSearch.Length();
    SetSelection (iStart+start, iEnd+start);
    return iStart+start ;
}

void TextEditor::DoCut(){
	this->Cut();
}

void TextEditor::DoCopy(){
	this->Copy();
}

void TextEditor::DoPaste(){
	this->Paste();
}


void TextEditor::OnCloseEvent(wxCloseEvent& event){
	OnCloseReject();
}

extern "C" int getTermInfo(int);
extern "C" void setTermInfo(int,int);

/* Closes the text editor and saves changes */
void TextEditor::OnCloseAccept(){
	doSave=1;
	if(getTermInfo(EDIT_STATE) == NO_INFO){
		wxMessageDialog dialog( NULL, _T("Load changes into Logo?"),
								_T("Load Changes"), wxNO_DEFAULT|wxYES_NO|wxCANCEL|wxICON_INFORMATION);
		switch ( dialog.ShowModal() )
		{
			case wxID_YES:
				setTermInfo(EDIT_STATE,DO_LOAD);
				break;
				
			case wxID_NO:
				setTermInfo(EDIT_STATE,NO_LOAD);
				break;
				
			case wxID_CANCEL:
				return;
				
			default:
				wxLogError(wxT("Unexpected wxMessageDialog return code!"));
		}
	}
	OnSave();
	Close();
}

/* Closes the text editor but does not save changes */
void TextEditor::OnCloseReject(){
	doSave=0;
	Close();
}



/* Does the actual closing of the editor by hiding it and
   bringing back the terminal */
void TextEditor::Close(){
	if(findDlg){
		delete findDlg->GetData();
		findDlg->Destroy();
		findDlg = 0; 
	}
	topsizer->Show(wxTerminal::terminal, 1);
	topsizer->Show((wxWindow *)turtleGraphics, turtleGraphics->getInfo(IN_GRAPHICS_MODE));
	topsizer->Show(editWindow, 0);
	topsizer->Layout();
	wxTerminal::terminal->SetFocus();
	logoFrame->SetUpMenu();
	editor_active = 0;
}

void TextEditor::OnSave(){
	SaveFile(file);
}

/* Prints out the text in this editor */
void TextEditor::DoPrint(){
	
	if(!wxTerminal::terminal->htmlPrinter)
		wxTerminal::terminal->htmlPrinter = new wxHtmlEasyPrinting();
	int fontsizes[] = { 6, 8, 12, 14, 16, 20, 24 };
	wxTerminal::terminal->htmlPrinter->SetFonts(_T("Courier"),_T("Courier"), fontsizes);
	wxString textString;
	textString.Clear();
	
	long i;
	for(i=0;i<GetNumberOfLines();i++){
		textString.Append(GetLineText(i));
		textString.Append(_T("<BR>"));
	}
	
	wxTerminal::terminal->htmlPrinter->PrintText(textString);
	 
	
}

The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API