Back to index

plt-scheme  4.2.1
Classes | Defines | Typedefs | Functions | Variables
mred.h File Reference
#include "wxs/mrdispatch.h"
#include "../mzscheme/src/schvers.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  MrEdContextFrames
struct  MrEdContext
class  MrEdFinalizedContext

Defines

#define BREAKING_REQUIRES_SHIFT   1
#define MRED_EXTERN   extern
#define MAKE_FRAMES_REF(x)   x
#define FRAMES_REF(p)   p
#define mrVERSION_SUFFIX   " [cgc]"
#define BANNER   "MrEd v" MZSCHEME_VERSION mrVERSION_SUFFIX ", Copyright (c) 2004-2009 PLT Scheme Inc.\n"
#define WCONSOLE_STDIO   0
#define REDIRECT_STDIO   0
#define MRED_GUID   "B2261834-D535-44dd-8511-A26FC8F97DD0"

Typedefs

typedef EventRecord MrEdEvent
typedef MrEdContextFramesMrEdContextFramesRef
typedef struct MrEdContext MrEdContext
typedef void(* SLEEP_PROC_PTR )(float seconds, void *fds)
typedef void *(* ForEachFrameProc )(wxObject *, void *)
typedef int(* MrEd_Finish_Cmd_Line_Run_Proc )(void)
typedef void(* MrEd_Run_From_Cmd_Line_Proc )(int argc, char **argv, Scheme_Env *(*mk_basic_env)(void))

Functions

MrEdContextMrEdGetContext (wxObject *w=NULL)
int MrEdGetNextEvent (int peek, int current_only, MrEdEvent *, MrEdContext **)
void MrEdDispatchEvent (MrEdEvent *)
void MrEdInitFirstContext (MrEdContext *c)
void MrEdInitNewContext (MrEdContext *c)
void MrEdDestroyContext (MrEdFinalizedContext *c)
voidMrEdForEachFrame (ForEachFrameProc fp, void *data)
MRED_EXTERN void wxCreateApp (void)
MRED_EXTERN void wxDoMainLoop ()
MRED_EXTERN void mred_set_finish_cmd_line_run (MrEd_Finish_Cmd_Line_Run_Proc)
MRED_EXTERN void mred_set_run_from_cmd_line (MrEd_Run_From_Cmd_Line_Proc)

Variables

MrEdContextmred_contexts
MRED_EXTERN
MrEd_Finish_Cmd_Line_Run_Proc 
mred_finish_cmd_line_run
MRED_EXTERN
MrEd_Run_From_Cmd_Line_Proc 
mred_run_from_cmd_line

Class Documentation

class MrEdContextFrames

Definition at line 31 of file mred.h.

Collaboration diagram for MrEdContextFrames:
Class Members
wxChildList * list
MrEdContextFramesRef next
MrEdContextFramesRef prev
struct MrEdContext

Definition at line 46 of file mred.h.

Collaboration diagram for MrEdContext:
Class Members
void * alt_data
wxDispatch_Check_Fun alternate
int busyState
MrEdEvent event
MrEdFinalizedContext * finalized
Scheme_Thread * handler_running
int killed
Scheme_Object * main_break_cell
Scheme_Thread_Cell_Table * main_cells
Scheme_Config * main_config
MrEd_Saved_Modal * modal_stack
wxWindow * modal_window
struct Context_Custodian_Hop * mr_hop
Scheme_Custodian_Reference * mref
short nested_avail
struct MrEdContext * next
short q_callback
short ready
short ready_to_go
Scheme_Object so
int suspended
wxTimer * timer
wxTimer * timers
wxChildList * topLevelWindowList
short waiting_for_nested
class MrEdFinalizedContext

Definition at line 89 of file mred.h.

Collaboration diagram for MrEdFinalizedContext:
Class Members
MrEdContextFrames * frames

Define Documentation

#define BANNER   "MrEd v" MZSCHEME_VERSION mrVERSION_SUFFIX ", Copyright (c) 2004-2009 PLT Scheme Inc.\n"

Definition at line 190 of file mred.h.

#define BREAKING_REQUIRES_SHIFT   1

Definition at line 2 of file mred.h.

#define FRAMES_REF (   p)    p

Definition at line 28 of file mred.h.

#define MAKE_FRAMES_REF (   x)    x

Definition at line 27 of file mred.h.

#define MRED_EXTERN   extern

Definition at line 5 of file mred.h.

#define MRED_GUID   "B2261834-D535-44dd-8511-A26FC8F97DD0"

Definition at line 208 of file mred.h.

#define mrVERSION_SUFFIX   " [cgc]"

Definition at line 187 of file mred.h.

#define REDIRECT_STDIO   0

Definition at line 204 of file mred.h.

#define WCONSOLE_STDIO   0

Definition at line 196 of file mred.h.


Typedef Documentation

typedef void*(* ForEachFrameProc)(wxObject *, void *)

Definition at line 164 of file mred.h.

Definition at line 171 of file mred.h.

typedef void(* MrEd_Run_From_Cmd_Line_Proc)(int argc, char **argv, Scheme_Env *(*mk_basic_env)(void))

Definition at line 172 of file mred.h.

Definition at line 19 of file mred.h.

typedef EventRecord MrEdEvent

Definition at line 14 of file mred.h.

typedef void(* SLEEP_PROC_PTR)(float seconds, void *fds)

Definition at line 109 of file mred.h.


Function Documentation

Definition at line 189 of file mred.cxx.

Here is the caller graph for this function:

Definition at line 191 of file mred.cxx.

Here is the caller graph for this function:

Definition at line 80 of file mredmac.cxx.

{
}

Here is the caller graph for this function:

Definition at line 1125 of file mredmac.cxx.

{
  dispatched = 1;

  if (e->what == updateEvt) {
    /* Find the update event for this window: */
    RgnHandle rgn = NULL;
    MrQueueElem *q;
    WindowPtr w;

    w = (WindowPtr)e->message;

    for (q = first; q; q = q->next) {
      if ((q->event.what == updateEvt)
         && (w == ((WindowPtr)q->event.message))) {
       rgn = q->rgn;
       MrDequeue(q);
       break;
      }
    }
    
    if (rgn) {
      /* rgn is in window co-ords */
      InvalWindowRgn(w, rgn);
      DisposeRgn(rgn);
    }
  }

  wxTheApp->doMacPreEvent();
  wxTheApp->doMacDispatch(e);
  wxTheApp->doMacPostEvent();
  
  wxCheckFinishedSounds();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void* MrEdForEachFrame ( ForEachFrameProc  fp,
void data 
)

Definition at line 934 of file mred.cxx.

{
  MrEdContextFrames *f;
  MrEdContextFramesRef fr = mred_frames;
  wxChildNode *node;

  while (fr) {
    f = FRAMES_REF(fr);
    node = f->list->First();

    while (node) {
      if (node->IsShown()) {
       wxObject *o;
       o = node->Data();
#ifdef wx_mac
       /* Mac: some frames really represent dialogs. Any modal frame is
          a dialog, so extract its only child. */
       if (((wxFrame *)o)->IsModal()) {
         wxChildNode *node2;
         wxChildList *cl;
         cl = ((wxFrame *)o)->GetChildren();
         node2 = cl->First();
         if (node2)
           o = node2->Data();
       }
#endif
       data = fp(o, data);
      }
      node = node->Next();
    }

    fr = f->next;
  }

  return data;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 403 of file mred.cxx.

{
  if (w) {
#if !defined(wx_xt) && !defined(wx_mac)
    if (wxSubType(w->__type, wxTYPE_FRAME)) {
#endif
      MrEdContext *c;
      c = (MrEdContext *)((wxFrame *)w)->context;
      if (c)
       return c;
#if !defined(wx_xt) && !defined(wx_mac)
    } else {
      MrEdContext *c;
      c = (MrEdContext *)((wxDialogBox *)w)->context;
      if (c)
       return c;
    }
#endif
  }

  if (mred_only_context) {
    if (only_context_just_once) {
      MrEdContext *c = mred_only_context;
      mred_only_context = NULL;
      only_context_just_once = 0;
      return c;
    } else
      return mred_only_context;
  } else
    return (MrEdContext *)scheme_get_param(scheme_current_config(), mred_eventspace_param);
}
int MrEdGetNextEvent ( int  peek,
int  current_only,
MrEdEvent ,
MrEdContext **   
)

Definition at line 925 of file mredmac.cxx.

{
  /* Search for an event. Handle clicks in non-frontmost windows
     immediately. */
  MrQueueRef osq;
  EventFinderClosure closure;
  EventRecord ebuf;
  MrEdContext *c, *keyOk, *foundc;
  int found = 0;

  saw_mdown = 0; saw_kdown = 0;

  if (!event)
    event = &ebuf;
  
  c = current_only ? MrEdGetContext() : NULL;

  wxResetCanvasBackgrounds();
    
  keyOk = KeyOk(current_only);
  
#ifdef RECORD_HISTORY
  if (!history) history = fopen("history3", "w");
  fprintf(history, "%lx %lx %lx\n",
         c, keyOk, cont_event_context);
#endif

#if 0
  /* Update events are supposed to happen after mouse events, etc.
     However, OS X refreshes window displays when WNE is called.  In
     particular, it looks nicer to update the frontmost window before
     calling WNE. We must do this infrequenty, though, to avoid
     dispatching only update events when other sorts of events should
     get handled. */
  static RgnHandle quickUpdateRgn;
  static UInt32 quickUpdateTimeout;
  static UInt32 quickUpdateWait;
  if (!quickUpdateWait || (quickUpdateWait <= TickCount())) {
    WindowPtr front;

    quickUpdateWait = 0;

    front = FrontNonFloatingWindow();
    if (front) {
      if (!quickUpdateRgn)
       quickUpdateRgn = NewRgn();
         
      GetWindowRegion(front, kWindowUpdateRgn, quickUpdateRgn);       
      if (!EmptyRgn(quickUpdateRgn)) {
       /* Setup a trampoline and call WNE if the current thread
          if the handler thread for the front window? */
       quickUpdateWait = TickCount() + 15;
      }
    }
  }
#endif

  TransferQueue(0);
    
  if (cont_mouse_context)
    if (!WindowStillHere(cont_mouse_context_window))
      cont_mouse_context = NULL;
    
  closure.c = c;
  closure.check_only = check_only;
  closure.keyOk = keyOk;
  closure.event = event;
  closure.which = which;

  /* First, service leave events: */
  closure.checker = CheckForLeave;
  if (Find(&closure))
    return TRUE; 
  
  /* Next, service mouse & key events: */
  closure.checker = CheckForMouseOrKey;
  closure.which = &foundc;
  if ((osq = Find(&closure))) {
    found = 1;
  }
  closure.which = which;
  
  if (found) {
    /* Remove intervening mouse/key events: */
    MrQueueElem *qq, *next;
    for (qq = first; qq && (qq != osq); qq = next) {
      next = qq->next;
      switch (qq->event.what) {
      case mouseUp:
       cont_mouse_context = NULL;
       /* fallthrough... */
      case mouseMenuDown:
      case mouseDown:
      case wheelEvt:
      case unicodeEvt:
      case keyDown:
      case keyUp:
      case autoKey:
       MrDequeue(qq);
       break;
      }
    }

    if (which)
      *which = foundc;

#ifdef RECORD_HISTORY
    fprintf(history, "mouse or key\n");
    fflush(history);
#endif

    if (check_only)
      return TRUE;
    
    MrDequeue(osq);
    
    return TRUE;
  }
  
  // TransferQueue(0);
    
  /* Try activate and high-level events: */
  closure.checker = CheckForActivate;
  if (Find(&closure))
    return TRUE; 
  
  /* Generate a motion event? */
  if (keyOk) {
    WindowPtr front;

    GetMouse(&event->where);
    LocalToGlobal(&event->where);
    front = MrEdMouseWindow(event->where);

    if (((event->where.v != last_mouse.v)
        || (event->where.h != last_mouse.h)
        || last_front_window != front)
       && (!cont_mouse_context || (cont_mouse_context == keyOk))) {
      long ticks;

      if (which)
       *which = (cont_mouse_context ? cont_mouse_context : keyOk);
       
      if (check_only) {
#ifdef RECORD_HISTORY
       fprintf(history, "move or drag\n");
       fflush(history);
#endif
       return TRUE;
      }

      last_mouse.v = event->where.v;
      last_mouse.h = event->where.h;
      last_front_window = front;

      event->what = nullEvent;
      ticks = TickCount();
      event->when = ticks;
      if (cont_mouse_context) {
       /* Dragging... */
       int mods;
       mods = GetMods();
       if (mdown_was_ctl)
         mods |= controlKey;
       event->modifiers = mods | btnState;
       event->message = 1;
#ifdef RECORD_HISTORY
       fprintf(history, "drag\n");
       fflush(history);
#endif
      } else {
       if (keyOk) {
         int mods;
         mods = GetMods();
         event->modifiers = mods;
       } else {
         event->modifiers = 0;
       }
       event->message = (keyOk ? 1 : 0);
#ifdef RECORD_HISTORY
       fprintf(history, "move\n");
       fflush(history);
#endif
      }
      return TRUE;
    }
  }
  
#ifdef RECORD_HISTORY
  fprintf(history, "no event\n");
  fflush(history);
#endif
  
  return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 72 of file mredmac.cxx.

{
}

Here is the caller graph for this function:

Definition at line 76 of file mredmac.cxx.

{
} 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3323 of file mred.cxx.

{
  if (!TheMrEdApp) {
#ifdef wx_mac
    wxmac_reg_globs();
#endif
#ifdef wx_msw
  {
    HANDLE h;
    h = GetStdHandle(STD_OUTPUT_HANDLE);
    if (h && (h != INVALID_HANDLE_VALUE)
        && (GetFileType(h) != FILE_TYPE_UNKNOWN)) {
      wx_in_terminal = 1;
    }
  }
#endif

    wxREGGLOB(orig_ps_setup);
    wxREGGLOB(q_callbacks);

    wxREGGLOB(TheMrEdApp);
    TheMrEdApp = new WXGC_PTRS MrEdApp;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2956 of file mred.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 239 of file mred.cxx.

Definition at line 174 of file mred.h.

Definition at line 176 of file mred.h.