cursor Module

Cursor mode and window input.

"View history" views holds the view before each view change, for the u key; kipp_rebuild empties it via clear_views after an axis change. Keys write st view limits and toggles, then render through draw.f90.



Variables

Type Visibility Attributes Name Initial
character(len=1), private, parameter :: K_LCLICK = 'A'

Left click.

character(len=1), private, parameter :: K_MCLICK = 'D'

Middle click.

character(len=1), private, parameter :: K_RCLICK = 'X'

Right click.

character(len=1), private, parameter :: K_SCRUP = achar(21)

Scroll up.

character(len=1), private, parameter :: K_SCRDN = achar(4)

Scroll down.

character(len=1), private, parameter :: K_SCRLT = achar(12)

Scroll left.

character(len=1), private, parameter :: K_SCRRT = achar(18)

Scroll right.

character(len=1), private, parameter :: K_ESC = achar(27)

Esc key.

character(len=1), private, parameter :: K_CTRLC = achar(3)

Ctrl-C.

integer(kind=int32), private :: nsnap = 0

Number of last numbered snapshot saved from cursor mode.

type(view_t), private, allocatable :: views(:)

View history for u, oldest first.


Interfaces

interface

  • private function c_getpid() result(pid) bind(C, name='getpid'))

    Return process id, via POSIX getpid.

    Names temporary PNG of p clipboard copy.

    Arguments

    None

    Return Value integer(kind=c_int)

interface

  • private function c_isatty(fd) result(tty) bind(C, name='isatty'))

    Test file descriptor for a terminal, via POSIX isatty.

    Nonzero for a terminal.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=c_int), value :: fd

    File descriptor to test.

    Return Value integer(kind=c_int)


Derived Types

type, private ::  view_t

View of view history.

Read more…

Components

Type Visibility Attributes Name Initial
real(kind=real64), public :: lim(4)

View limits: xmin, xmax, ymin, ymax.

logical, public :: xauto

Auto-scale flags of x and y in this view.

logical, public :: yauto

Auto-scale flags of x and y in this view.


Functions

public function kipp_wait_input()

Block at REPL prompt until stdin or plot window has input.

Read more…

Arguments

None

Return Value integer

private function view_now() result(v)

Return current view as view_t.

Arguments

None

Return Value type(view_t)


Subroutines

public subroutine kipp_interact()

Run cursor mode in /xw window.

Read more…

Arguments

None

public subroutine kipp_action(ch, x, y, done)

Apply one cursor key ch at world position (x, y).

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(in) :: ch

Key or mouse event character, as giza reports it.

real(kind=real64), intent(in) :: x

Cursor x, in world coords.

real(kind=real64), intent(in) :: y

Cursor y, in world coords.

logical, intent(out) :: done

Set when ch asks to leave cursor mode.

private subroutine set_view(v)

Restore view from view history.

Arguments

Type IntentOptional Attributes Name
type(view_t), intent(in) :: v

View to restore.

public subroutine clear_views()

Empty the view history.

Arguments

None

public subroutine kipp_window_center(cx, cy)

Give centre of current view, in world coords.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(out) :: cx

x of view centre.

real(kind=real64), intent(out) :: cy

y of view centre.

private subroutine cursor_help()

Print cursor key reference.

Arguments

None

private subroutine print_cell(wx, wy)

Print model and zone cell at world position (wx, wy).

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: wx

Cursor x, in world coords.

real(kind=real64), intent(in) :: wy

Cursor y, in world coords.

private subroutine set_xrange_w(a, b)

Set x view limits from two world coords, in either order.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: a

One end of selection.

real(kind=real64), intent(in) :: b

Other end of selection.

private subroutine set_yrange_w(a, b)

Set y view limits from two world coords, in either order.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: a

One end of selection.

real(kind=real64), intent(in) :: b

Other end of selection.

private subroutine zoom_at(cx, cy, f)

Rescale both axes by f about a world position.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: cx

x of fixed point, in world coords.

real(kind=real64), intent(in) :: cy

y of fixed point, in world coords.

real(kind=real64), intent(in) :: f

Factor applied to world-space spans.

private subroutine pan_frac(fx, fy)

Shift view by a fraction of current world-space span.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: fx

Shift along x, as fraction of x span.

real(kind=real64), intent(in) :: fy

Shift along y, as fraction of y span.

private subroutine center_at(cx, cy)

Pan so a world position becomes view centre.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: cx

x of new centre, in world coords.

real(kind=real64), intent(in) :: cy

y of new centre, in world coords.