Back to index

texmacs  1.0.7.15
Defines | Functions
tm_config.cpp File Reference
#include "tm_config.hpp"
#include "analyze.hpp"

Go to the source code of this file.

Defines

#define rewrite_find_key_binding(s)   find_key_binding (apply_wildcards (s, post_kbd_wildcards))

Functions

static string apply_wildcards (string s, hashmap< string, tree > w)
static tree localize (string s, bool mod_flag=false)
tree mathop (string s)
static void system_kbd_initialize (hashmap< string, tree > &h)
static tree kbd_render (tree t)
static string kbd_system_prevails (string s)

Define Documentation

#define rewrite_find_key_binding (   s)    find_key_binding (apply_wildcards (s, post_kbd_wildcards))

Definition at line 106 of file tm_config.cpp.


Function Documentation

static string apply_wildcards ( string  s,
hashmap< string, tree w 
) [static]

Definition at line 57 of file tm_config.cpp.

                                                   {
  int len, start, end, n= N(s);
  for (len=n; len>0; len--) {
    for (start=0; start <= (n-len); start++) {
      end= start+ len;
      if ((start>0) && (s[start-1] != ' ') && (s[start-1] != '-')) continue;
      if ((end<n) && (s[end-1] != ' ') && (s[end-1] != '-')) continue;
      string ss= s (start, end);
      if (s[end-1] == ' ') ss= s (start, end-1);

      // cout << "  " << ss << " => " << w[ss] << LF;
      if (w->contains (ss)) {
       tree t= w[ss];
       string rr= t[0]->label;
       bool lflag= (t[1]->label != "") || (start == 0);
       bool rflag= (t[2]->label != "") || (end == n);
       if (lflag && rflag) {
         if ((end<n) && (rr != "") && (rr[N(rr)-1] != '-')) rr= rr * " ";
         string r= s (0, start) * rr * s (end, n);
         return apply_wildcards (r, w);
       }
      }      
    }
  }
  return s;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static tree kbd_render ( tree  t) [static]

Definition at line 291 of file tm_config.cpp.

                    {
  if (use_macos_fonts ())
    t= tree (WITH, "font", "apple-lucida", t);
  return compound ("render-key", t);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static string kbd_system_prevails ( string  s) [static]

Definition at line 298 of file tm_config.cpp.

                               {
  string laf= get_preference ("look and feel");
  bool   mac= os_macos () && (laf == "default" || laf == "macos");
  if (mac && starts (s, "A-")) {
    string ss= s (2, N(s));
    string r = "escape " * ss;
    if (starts (ss, "S-")) ss= ss (2, N(ss));
    if (N(ss) == 1) return r;
    else return s;
  }
  else return s;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static tree localize ( string  s,
bool  mod_flag = false 
) [static]

Definition at line 200 of file tm_config.cpp.

                                          {
  if (mod_flag) return tree (CONCAT, localize (s), "+");
  else return compound ("localize", s);
}

Here is the call graph for this function:

Here is the caller graph for this function:

tree mathop ( string  s)

Definition at line 206 of file tm_config.cpp.

                  {
  return compound ("math", compound ("op", s));
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void system_kbd_initialize ( hashmap< string, tree > &  h) [static]

Definition at line 211 of file tm_config.cpp.

                                                {
  if (N(h) != 0);
  else if (use_macos_fonts ()) {
    h ("S-")= "<#21E7>";
    h ("C-")= "<#2303>";
    h ("A-")= "<#2325>";
    h ("M-")= "<#2318>";
    h ("H-")= localize ("Hyper");
    h ("windows")= localize ("Windows");
    h ("capslock")= "<#21EA>";
    h ("return")= "<#21A9>";
    h ("delete")= "<#2326>";
    h ("backspace")= "<#232B>";
    h ("clear")= "<#2327>";
    h ("escape")= "<#238B>";
    h ("space")= "Space";
    h ("var")= "<#21E5>";
    h ("tab")= "<#21E5>";
    h ("left")= "<#2190>";
    h ("right")= "<#2192>";
    h ("up")= "<#2191>";
    h ("down")= "<#2193>";
    h ("home")= "<#2196>";
    h ("end")= "<#2198>";
    h ("pageup")= "<#21DE>";
    h ("pagedown")= "<#21DF>";
    h ("<less>")= "<#3C>";
    h ("<gtr>")= "<#3E>";
  }
  else if (gui_is_qt ()) {
    h ("S-")= localize ("Shift", true);
    h ("C-")= localize ("Ctrl", true);
    h ("A-")= localize ("Alt", true);
    h ("M-")= localize ("Meta", true);
    h ("H-")= localize ("Hyper", true);
    h ("windows")= localize ("Windows");
    h ("capslock")= localize ("Capslock");
    h ("return")= localize ("Return");
    h ("delete")= localize ("Delete");
    h ("backspace")= localize ("Backspace");
    h ("escape")= localize ("Escape");
    h ("space")= localize ("Space");
    h ("var")= localize ("Tab");
    h ("tab")= localize ("Tab");
    h ("left")= mathop ("<leftarrow>");
    h ("right")= mathop ("<rightarrow>");
    h ("up")= mathop ("<uparrow>");
    h ("down")= mathop ("<downarrow>");
    h ("home")= localize ("Home");
    h ("end")= localize ("End");
    h ("pageup")= localize ("PageUp");
    h ("pagedown")= localize ("PageDown");
  }
  else {
    h ("S-")= "S-";
    h ("C-")= "C-";
    h ("A-")= "A-";
    h ("M-")= "M-";
    h ("H-")= "H-";
    h ("windows")= localize ("windows");
    h ("capslock")= localize ("capslock");
    h ("return")= localize ("return");
    h ("delete")= localize ("delete");
    h ("backspace")= localize ("backspace");
    h ("escape")= localize ("escape");
    h ("space")= localize ("space");
    h ("var")= localize ("tab");
    h ("tab")= localize ("tab");
    h ("left")= mathop ("<leftarrow>");
    h ("right")= mathop ("<rightarrow>");
    h ("up")= mathop ("<uparrow>");
    h ("down")= mathop ("<downarrow>");
    h ("home")= localize ("home");
    h ("end")= localize ("end");
    h ("pageup")= localize ("pageup");
    h ("pagedown")= localize ("pagedown");
  }
}

Here is the call graph for this function:

Here is the caller graph for this function: