Back to index

texmacs  1.0.7.15
Functions | Variables
edit_mouse.cpp File Reference
#include "edit_interface.hpp"
#include "tm_buffer.hpp"
#include "timer.hpp"
#include "link.hpp"
#include "analyze.hpp"
#include "drd_mode.hpp"
#include "message.hpp"
#include "window.hpp"

Go to the source code of this file.

Functions

void drag_left_reset ()
static string detect_left_drag (void *handle, string type, SI x, SI y, time_t t, SI d)
void drag_right_reset ()
static string detect_right_drag (void *handle, string type, SI x, SI y, time_t t, SI d)
static void call_mouse_event (string kind, SI x, SI y, SI m, time_t t)
static void delayed_call_mouse_event (string kind, SI x, SI y, SI m, time_t t)

Variables

static void * left_handle = NULL
static bool left_started = false
static bool left_dragging = false
static SI left_x = 0
static SI left_y = 0
static time_t left_last = 0
static void * right_handle = NULL
static bool right_started = false
static bool right_dragging = false
static SI right_x = 0
static SI right_y = 0
static time_t right_last = 0

Function Documentation

static void call_mouse_event ( string  kind,
SI  x,
SI  y,
SI  m,
time_t  t 
) [static]

Definition at line 409 of file edit_mouse.cpp.

                                                           {
  array<object> args;
  args << object (kind) << object (x) << object (y)
       << object (m) << object ((double) t);
  call ("mouse-event", args);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void delayed_call_mouse_event ( string  kind,
SI  x,
SI  y,
SI  m,
time_t  t 
) [static]

Definition at line 417 of file edit_mouse.cpp.

                                                                   {
  // NOTE: interestingly, the (:idle 1) is not necessary for the Qt port
  // but is required for appropriate updating when using the X11 port
  string cmd=
    "(delayed (:idle 1) (mouse-event " * scm_quote (kind) * " " *
    as_string (x) * " " * as_string (y) * " " *
    as_string (m) * " " * as_string ((long int) t) * "))";
  eval (cmd);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static string detect_left_drag ( void *  handle,
string  type,
SI  x,
SI  y,
time_t  t,
SI  d 
) [static]

Definition at line 257 of file edit_mouse.cpp.

                                                                         {
  if (left_handle != handle) drag_left_reset ();
  left_handle= handle;
  if (type == "press-left") {
    left_dragging= true;
    left_started = true;
    left_x       = x;
    left_y       = y;
  }
  else if (type == "move") {
    if (left_started) {
      if (norm (point (x - left_x, y - left_y)) < d) return "wait-left";
      left_started= false;
      return "start-drag-left";
    }
    if (left_dragging) return "dragging-left";
  }
  else if (type == "release-left") {
    if (left_started) drag_left_reset ();
    if (left_dragging) {
      drag_left_reset ();
      return "end-drag-left";
    }
    if ((t >= left_last) && ((t - left_last) <= 500)) {
      left_last= t;
      return "double-left";
    }
    left_last= t;
  }
  return type;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static string detect_right_drag ( void *  handle,
string  type,
SI  x,
SI  y,
time_t  t,
SI  d 
) [static]

Definition at line 310 of file edit_mouse.cpp.

                                                                          {
  if (right_handle != handle) drag_right_reset ();
  right_handle= handle;
  if (type == "press-right") {
    right_dragging= true;
    right_started = true;
    right_x       = x;
    right_y       = y;
  }
  else if (type == "move") {
    if (right_started) {
      if (norm (point (x - right_x, y - right_y)) < d) return "wait-right";
      right_started= false;
      return "start-drag-right";
    }
    if (right_dragging) return "dragging-right";
  }
  else if (type == "release-right") {
    if (right_started) drag_right_reset ();
    if (right_dragging) {
      drag_right_reset ();
      return "end-drag-right";
    }
    if ((t >= right_last) && ((t - right_last) <= 500)) {
      right_last= t;
      return "double-right";
    }
    right_last= t;
  }
  return type;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void drag_left_reset ( )

Definition at line 249 of file edit_mouse.cpp.

                   {
  left_started = false;
  left_dragging= false;
  left_x       = 0;
  left_y       = 0;
}

Here is the caller graph for this function:

void drag_right_reset ( )

Definition at line 301 of file edit_mouse.cpp.

                    {
  right_started = false;
  right_dragging= false;
  right_x       = 0;
  right_y       = 0;
  right_last    = 0;
}

Here is the caller graph for this function:


Variable Documentation

bool left_dragging = false [static]

Definition at line 243 of file edit_mouse.cpp.

void* left_handle = NULL [static]

Definition at line 241 of file edit_mouse.cpp.

time_t left_last = 0 [static]

Definition at line 246 of file edit_mouse.cpp.

bool left_started = false [static]

Definition at line 242 of file edit_mouse.cpp.

SI left_x = 0 [static]

Definition at line 244 of file edit_mouse.cpp.

SI left_y = 0 [static]

Definition at line 245 of file edit_mouse.cpp.

bool right_dragging = false [static]

Definition at line 295 of file edit_mouse.cpp.

void* right_handle = NULL [static]

Definition at line 293 of file edit_mouse.cpp.

time_t right_last = 0 [static]

Definition at line 298 of file edit_mouse.cpp.

bool right_started = false [static]

Definition at line 294 of file edit_mouse.cpp.

SI right_x = 0 [static]

Definition at line 296 of file edit_mouse.cpp.

SI right_y = 0 [static]

Definition at line 297 of file edit_mouse.cpp.