From a3598a9b05befc6afc1e23463262cd9b3aa62501 Mon Sep 17 00:00:00 2001 From: brianharvey Date: Sun, 14 Sep 2008 04:56:48 +0000 Subject: [PATCH] Mac can't set bg color of editor (2.6 bug) git-svn-id: https://svn.code.sf.net/p/ucblogo/code@206 fc4ef4ee-df3e-0410-84de-fb01f5d6c4f7 --- TextEditor.cpp | 18 +++++- helpfiles/HELPCONTENTS | 142 ++++++++++++++++++++--------------------- term.c | 3 + wxTerminal.cpp | 4 +- 4 files changed, 94 insertions(+), 73 deletions(-) diff --git a/TextEditor.cpp b/TextEditor.cpp index 21eb2cd4..1fee0798 100644 --- a/TextEditor.cpp +++ b/TextEditor.cpp @@ -42,6 +42,11 @@ wxTextCtrl(f, a, s, p, sz, b) void TextEditor::SetFont(wxFont font){ this->font = font; +#ifdef __WXMAC__ + SetDefaultStyle(wxTextAttr(wxNullColour,wxNullColour, font)); + if(this->IsShown()){ + SetStyle(0,GetLastPosition(), wxTextAttr(wxNullColour,wxNullColour,font)); +#else SetDefaultStyle(wxTextAttr(TurtleCanvas::colors[wxTerminal::terminal->m_curFG], TurtleCanvas::colors[wxTerminal::terminal->m_curBG], font)); if(this->IsShown()){ @@ -50,18 +55,29 @@ void TextEditor::SetFont(wxFont font){ TurtleCanvas::colors[wxTerminal::terminal->m_curBG],font)); SetBackgroundColour( TurtleCanvas::colors[wxTerminal::terminal->m_curBG]); +#endif Refresh(); Update(); } } void TextEditor::SetThisFont(wxCommandEvent& event) { +#ifdef __WXMAC__ + SetDefaultStyle(wxTextAttr(wxNullColour,wxNullColour, this->font)); + if(this->IsShown()){ + SetStyle(GetLastPosition()-1, GetLastPosition(), wxTextAttr(wxNullColour,wxNullColour,this->font)); +#else SetDefaultStyle(wxTextAttr(TurtleCanvas::colors[wxTerminal::terminal->m_curFG], TurtleCanvas::colors[wxTerminal::terminal->m_curBG], this->font)); if(this->IsShown()){ - SetStyle(0,GetLastPosition(), + 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]); +#endif + Refresh(); + Update(); Refresh(); Update(); } diff --git a/helpfiles/HELPCONTENTS b/helpfiles/HELPCONTENTS index c8e734a4..ad8e9bae 100644 --- a/helpfiles/HELPCONTENTS +++ b/helpfiles/HELPCONTENTS @@ -1,73 +1,73 @@ Help is available on the following: -` dribble lessp popl setmargins -< edall list popls setpalette -<= edit listp pops setpen -<> editfile listtoarray pos setpencolor -= edn ln pot setpenpattern -> edns load pots setpensize ->= edpl loadnoisily power setpos -- edpls loadpict pprop setprefix -/ edps local prefix setread -* emptyp localmake primitivep setreadpos -+ eofp log10 primitives setscrunch -allopen epspict logoplatform print .setsegmentsize -allowgetset .eq logoversion printdepthlimit settemploc -and equalp lowercase printout settextcolor -apply erall lput printwidthlimit settextsize -arc erase lshift procedurep setwrite -arctan erasefile .macro procedures setwritepos -arity ern macroexpand product setx -array erns macrop push setxy -arrayp erpl make queue sety -arraytolist erpls map quoted shell -ascii erps map.se quotient show -ashift erract .maybeoutput radarctan shownp -back error mdarray radcos showturtle -background exp mditem radsin sin -beforep fence mdsetitem random splitscreen -bitand filep member rawascii sqrt -bitnot fill memberp readchar standout -bitor filled minus readchars startup -bitxor filter modulo reader step -buried find mousepos readlist stepped -buriedp first name readpos steppedp -bury firsts namelist readrawline stop -buryall font namep readword substringp -buryname for names redefp sum -butfirst foreach nodes reduce tag -butfirsts forever nodribble refresh test -butlast form norefresh remainder text -button forward not remdup textscreen -buttonact fput notequalp remove textsize -buttonp fullprintp numberp remprop thing -bye fullscreen openappend repcount throw -cascade fulltext openread repeat to -case gc openupdate rerandom towards -caseignoredp gensym openwrite reverse trace -catch global or right traced -char goto output round tracedp -clean gprop palette rseq transfer -clearscreen greaterequalp parse run turtlemode -cleartext greaterp pause runparse type -clickpos heading pen runresult unbury -close help pencolor save unburyall -closeall hideturtle pendown savel unburyname -combine home pendownp savepict unburyonedit -commandline if penerase screenmode unstep -cond ifelse penmode scrunch until -contents iffalse penpaint sentence untrace -continue iftrue penpattern setbackground uppercase -copydef ignore penreverse .setbf usealternatenam -cos increasefont pensize setcslsloc vbarredp -count int penup setcursor wait -crossmap invoke pick seteditor while -cslsload iseq plist .setfirst window -cursor item plistp setfont word -define keyact plists setheading wordp -definedp keyp pllist sethelploc wrap -.defmacro label poall setitem writepos -dequeue labelsize pon .setitem writer -difference last pons setlabelheight xcor -do.until left pop setlibloc ycor -do.while lessequalp +* cursor keyp pon setpalette ++ define label pons setpen +- definedp labelsize pop setpencolor +.defmacro dequeue last popl setpenpattern +.eq difference left popls setpensize +.macro do.until lessequalp pops setpos +.maybeoutput do.while lessp pos setprefix +.setbf dribble list pot setread +.setfirst edall listp pots setreadpos +.setitem edit listtoarray power setscrunch +.setsegmentsize editfile ln pprop settemploc +/ edn load prefix settextcolor +< edns loadnoisily primitivep settextsize +<= edpl loadpict primitives setwrite +<> edpls local print setwritepos += edps localmake printdepthlimit setx +> emptyp log10 printout setxy +>= eofp logoplatform printwidthlimit sety +` epspict logoversion procedurep shell +allopen equalp lowercase procedures show +allowgetset erall lput product shownp +and erase lshift push showturtle +apply erasefile macroexpand queue sin +arc ern macrop quoted splitscreen +arctan erns make quotient sqrt +arity erpl map radarctan standout +array erpls map.se radcos startup +arrayp erps mdarray radsin step +arraytolist erract mditem random stepped +ascii error mdsetitem rawascii steppedp +ashift exp member readchar stop +back fence memberp readchars substringp +background filep minus reader sum +beforep fill modulo readlist tag +bitand filled mousepos readpos test +bitnot filter name readrawline text +bitor find namelist readword textscreen +bitxor first namep redefp textsize +buried firsts names reduce thing +buriedp font nodes refresh throw +bury for nodribble remainder to +buryall foreach norefresh remdup towards +buryname forever not remove trace +butfirst form notequalp remprop traced +butfirsts forward numberp repcount tracedp +butlast fput openappend repeat transfer +button fullprintp openread rerandom turtlemode +buttonact fullscreen openupdate reverse type +buttonp fulltext openwrite right unbury +bye gc or round unburyall +cascade gensym output rseq unburyname +case global palette run unburyonedit +caseignoredp goto parse runparse unstep +catch gprop pause runresult until +char greaterequalp pen save untrace +clean greaterp pencolor savel uppercase +clearscreen heading pendown savepict usealternatenam +cleartext help pendownp screenmode vbarredp +clickpos hideturtle penerase scrunch wait +close home penmode sentence while +closeall if penpaint setbackground window +combine ifelse penpattern setcslsloc word +commandline iffalse penreverse setcursor wordp +cond iftrue pensize seteditor wrap +contents ignore penup setfont writepos +continue increasefont pick setheading writer +copydef int plist sethelploc xcor +cos invoke plistp setitem ycor +count iseq plists setlabelheight +crossmap item pllist setlibloc +cslsload keyact poall setmargins diff --git a/term.c b/term.c index 3fd294ef..e20cddd7 100644 --- a/term.c +++ b/term.c @@ -47,6 +47,9 @@ #ifdef HAVE_TERMCAP_H #include +#ifdef HAVE_SGTTY_H +#include +#endif #else #ifdef HAVE_TERMLIB_H #include diff --git a/wxTerminal.cpp b/wxTerminal.cpp index 82a9eb23..291fadf6 100644 --- a/wxTerminal.cpp +++ b/wxTerminal.cpp @@ -323,6 +323,8 @@ END_EVENT_TABLE() #include "ucblogo.xpm" +extern "C" void wxSetTextColor(int fg, int bg); + //this should compute the size based on the chosen font! LogoFrame::LogoFrame (const wxChar *title, int xpos, int ypos, @@ -346,7 +348,7 @@ LogoFrame::LogoFrame (const wxChar *title, AdjustSize(); - + wxSetTextColor(7+SPECIAL_COLORS, 0+SPECIAL_COLORS); editWindow = new TextEditor( this, -1, _T(""), wxDefaultPosition, wxSize(100,60), wxTE_MULTILINE|wxTE_RICH, f); wxTerminal::terminal->isEditFile=0;