Back to index

texmacs  1.0.7.15
Classes | Functions | Variables
tm_window.cpp File Reference
#include "tm_window.hpp"
#include "message.hpp"
#include "dictionary.hpp"
#include "merge_sort.hpp"
#include "iterator.hpp"

Go to the source code of this file.

Classes

class  close_embedded_command_rep
class  ia_command_rep

Functions

widget texmacs_window_widget (widget wid, tree geom)
widget make_menu_widget (object menu)
void refresh_size (widget wid, bool exact)
command close_embedded_command (tm_view vw)
string embedded_name ()
tree enrich_embedded_document (tree body)
widget texmacs_input_widget (tree doc, command cmd, bool continuous)
int window_handle ()
void window_create (int win, widget wid, string name, bool plain)
void window_create (int win, widget wid, string name, command quit)
void window_delete (int win)
void window_show (int win)
void window_hide (int win)
void windows_delayed_refresh (int ms)
void windows_refresh ()

Variables

int geometry_w = 800
int geometry_h = 600
int geometry_x = 0
int geometry_y = 0
static int tm_window_serial = 0
static hashmap< int, widgetwindow_table (NULL)
static time_t refresh_time = 0

Function Documentation

Definition at line 105 of file tm_window.cpp.

                                    {
  return tm_new<close_embedded_command_rep> (vw);
}

Here is the caller graph for this function:

Definition at line 114 of file tm_window.cpp.

                 {
  static int nr= 0;
  nr++;
  return "* Embedded " * as_string (nr) * " *";
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 121 of file tm_window.cpp.

                                     {
  tree orig= body;
  if (is_func (body, WITH)) body= body[N(body)-1];
  if (!is_func (body, DOCUMENT)) body= tree (DOCUMENT, body);
  tree style= "generic";
  hashmap<string,tree> initial (UNINIT);
  initial (PAGE_MEDIUM)= "automatic";
  initial (PAGE_SCREEN_LEFT)= "4px";
  initial (PAGE_SCREEN_RIGHT)= "4px";
  initial (PAGE_SCREEN_TOP)= "2px";
  initial (PAGE_SCREEN_BOT)= "2px";
  if (is_func (orig, WITH))
    for (int i=0; i+2<N(orig); i++)
      if (is_atomic (orig[i]))
        initial (orig[i]->label)= orig[i+1];
  tree doc (DOCUMENT);
  doc << compound ("TeXmacs", TEXMACS_VERSION);
  doc << compound ("style", tree (TUPLE, "generic"));
  doc << compound ("body", body);
  doc << compound ("initial", make_collection (initial));
  return doc;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 29 of file tm_frame.cpp.

                               {
  widget w= as_widget (call ("make-menu-widget", menu, 0));
  //string s= "(make-menu-widget '" * menu * " 0)";
  //widget w= as_widget (eval (s));
  if (is_nil (w)) {
    array<widget> a (0);
    return horizontal_menu (a);
  }
  return w;
}

Here is the call graph for this function:

void refresh_size ( widget  wid,
bool  exact 
)

Definition at line 88 of file window_widget.cpp.

                                      {
  window win= concrete (wid) -> win;
  SI old_w, old_h;
  win->get_size (old_w, old_h);
  SI def_w= old_w, def_h= old_h;
  SI min_w= old_w, min_h= old_h;
  SI max_w= old_w, max_h= old_h;
  concrete (wid) << get_size (def_w, def_h, 0);
  concrete (wid) << get_size (min_w, min_h, -1);
  concrete (wid) << get_size (max_w, max_h, 1);
  win->set_size_limits (min_w, min_h, max_w, max_h);
  SI new_w= min (max (old_w, min_w), max_w);
  SI new_h= min (max (old_h, min_h), max_h);
  if (exact) { new_w= def_w; new_h= def_h; }
  if (new_w != old_w || new_h != old_h) {
    concrete (wid) << emit_position (0, 0, new_w, new_h);
    win->set_size (new_w, new_h);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

widget texmacs_input_widget ( tree  doc,
command  cmd,
bool  continuous 
)

Definition at line 145 of file tm_window.cpp.

                                                              {
  (void) cmd; (void) continuous;
  doc= enrich_embedded_document (doc);
  tm_view   curvw=  get_server () -> get_view ();
  string    name = embedded_name ();
  tm_buffer buf  = create_buffer (url (name), doc);
  tm_view   vw   = get_passive_view (buf);
  tm_window win  = tm_new<tm_window_rep> (doc, command ());
  set_aux (name, name);
  vw->win= win;
  vw->buf->buf->in_menu= false;
  set_scrollable (win->wid, vw->ed);
  vw->ed->cvw= win->wid.rep;
  vw->ed->mvw= curvw;
  return wrapped_widget (win->wid, close_embedded_command (vw));
}

Here is the call graph for this function:

Here is the caller graph for this function:

widget texmacs_window_widget ( widget  wid,
tree  geom 
)

Definition at line 60 of file tm_window.cpp.

                                              {
  int W, H;
  int w= geometry_w, h= geometry_h;
  int x= geometry_x, y= geometry_y;
  if (use_side_tools) { w += 200; h += 100; }
  if (is_tuple (geom) && N (geom) >= 2) {
    w= as_int (geom[0]);
    h= as_int (geom[1]);
  }
  gui_root_extents (W, H); W /= PIXEL; H /= PIXEL;
  if (x < 0) x= W + x + 1 - w;
  if (y < 0) y= H + y + 1 - h;
  widget win= plain_window_widget (wid, "TeXmacs");
  set_size (win, w*PIXEL, h*PIXEL);
  set_position (win, x*PIXEL, (-y)*PIXEL);
  return win;
}

Here is the call graph for this function:

void window_create ( int  win,
widget  wid,
string  name,
bool  plain 
)

Definition at line 409 of file tm_window.cpp.

                                                             {
  widget pww;
  if (plain)
    pww= plain_window_widget (wid, name);
  else
    pww= popup_window_widget (wid, name);
  window_table (win)= pww;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void window_create ( int  win,
widget  wid,
string  name,
command  quit 
)

Definition at line 419 of file tm_window.cpp.

                                                               {
  widget pww;
  pww= plain_window_widget (wid, name, quit);
  window_table (win)= pww;
}

Here is the call graph for this function:

void window_delete ( int  win)

Definition at line 426 of file tm_window.cpp.

                        {
  ASSERT (window_table->contains (win), "window does not exist");
  widget pww= window_table [win];
  window_table->reset (win);
  destroy_window_widget (pww);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int window_handle ( )

Definition at line 403 of file tm_window.cpp.

                 {
  static int window_next= 1;
  return window_next++;
}

Here is the caller graph for this function:

void window_hide ( int  win)

Definition at line 441 of file tm_window.cpp.

                      {
  ASSERT (window_table->contains (win), "window does not exist");
  widget pww= window_table [win];
  set_visibility (pww, false);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void window_show ( int  win)

Definition at line 434 of file tm_window.cpp.

                      {
  ASSERT (window_table->contains (win), "window does not exist");
  widget pww= window_table [win];
  set_visibility (pww, true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void windows_delayed_refresh ( int  ms)

Definition at line 448 of file tm_window.cpp.

                                 {
  refresh_time= texmacs_time () + ms;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void windows_refresh ( )

Definition at line 453 of file tm_window.cpp.

                   {
  if (texmacs_time () < refresh_time) return;
  iterator<int> it= iterate (window_table);
  while (it->busy ()) {
    int id= it->next ();
    send_refresh (window_table[id]);
#ifndef QTTEXMACS
    refresh_size (window_table[id], false);
#endif
  }
  windows_delayed_refresh (1000000000);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

int geometry_h = 600

Definition at line 18 of file tm_window.cpp.

int geometry_w = 800

Definition at line 18 of file tm_window.cpp.

int geometry_x = 0

Definition at line 19 of file tm_window.cpp.

int geometry_y = 0

Definition at line 19 of file tm_window.cpp.

time_t refresh_time = 0 [static]

Definition at line 400 of file tm_window.cpp.

int tm_window_serial = 0 [static]

Definition at line 29 of file tm_window.cpp.

hashmap<int,widget> window_table(NULL) [static]