tesseract v5.3.3.20231005
tesseract::ScrollView Class Reference

#include <scrollview.h>

Public Types

enum  Color {
  NONE , BLACK , WHITE , RED ,
  YELLOW , GREEN , CYAN , BLUE ,
  MAGENTA , AQUAMARINE , DARK_SLATE_BLUE , LIGHT_BLUE ,
  MEDIUM_BLUE , MIDNIGHT_BLUE , NAVY_BLUE , SKY_BLUE ,
  SLATE_BLUE , STEEL_BLUE , CORAL , BROWN ,
  SANDY_BROWN , GOLD , GOLDENROD , DARK_GREEN ,
  DARK_OLIVE_GREEN , FOREST_GREEN , LIME_GREEN , PALE_GREEN ,
  YELLOW_GREEN , LIGHT_GREY , DARK_SLATE_GREY , DIM_GREY ,
  GREY , KHAKI , MAROON , ORANGE ,
  ORCHID , PINK , PLUM , INDIAN_RED ,
  ORANGE_RED , VIOLET_RED , SALMON , TAN ,
  TURQUOISE , DARK_TURQUOISE , VIOLET , WHEAT ,
  GREEN_YELLOW
}
 

Public Member Functions

 ~ScrollView ()
 
 ScrollView (const char *name, int x_pos, int y_pos, int x_size, int y_size, int x_canvas_size, int y_canvas_size)
 Calls Initialize with default argument for server_name_ & y_axis_reversed. More...
 
 ScrollView (const char *name, int x_pos, int y_pos, int x_size, int y_size, int x_canvas_size, int y_canvas_size, bool y_axis_reversed)
 Calls Initialize with default argument for server_name_. More...
 
 ScrollView (const char *name, int x_pos, int y_pos, int x_size, int y_size, int x_canvas_size, int y_canvas_size, bool y_axis_reversed, const char *server_name)
 Calls Initialize with all arguments given. More...
 
void AddEventHandler (SVEventHandler *listener)
 Add an Event Listener to this ScrollView Window. More...
 
std::unique_ptr< SVEventAwaitEvent (SVEventType type)
 
const char * GetName ()
 
int GetId ()
 
void Draw (Image image, int x_pos, int y_pos)
 
void UpdateWindow ()
 
void Clear ()
 
void Pen (Color color)
 
void Pen (int red, int green, int blue)
 
void Pen (int red, int green, int blue, int alpha)
 
void Brush (Color color)
 
void Brush (int red, int green, int blue)
 
void Brush (int red, int green, int blue, int alpha)
 
void TextAttributes (const char *font, int pixel_size, bool bold, bool italic, bool underlined)
 
void Line (int x1, int y1, int x2, int y2)
 
void Stroke (float width)
 
void Rectangle (int x1, int y1, int x2, int y2)
 
void Ellipse (int x, int y, int width, int height)
 
void Text (int x, int y, const char *mystring)
 
void Draw (const char *image, int x_pos, int y_pos)
 
void SetCursor (int x, int y)
 
void DrawTo (int x, int y)
 
void SetVisible (bool visible)
 
void AlwaysOnTop (bool b)
 
int ShowYesNoDialog (const char *msg)
 
char * ShowInputDialog (const char *msg)
 
void AddMessageBox ()
 
void AddMessage (const char *message)
 
void AddMessageF (const char *format,...) __attribute__((format(gnu_printf
 
void void ZoomToRectangle (int x1, int y1, int x2, int y2)
 
void SendMsg (const char *msg,...) __attribute__((format(gnu_printf
 Send a message to the server, attaching the window id. More...
 
void MenuItem (const char *parent, const char *name)
 
void MenuItem (const char *parent, const char *name, int cmdEvent)
 
void MenuItem (const char *parent, const char *name, int cmdEvent, bool flagged)
 
void PopupItem (const char *parent, const char *name)
 
void PopupItem (const char *parent, const char *name, int cmdEvent, const char *value, const char *desc)
 
int TranslateYCoordinate (int y)
 
char Wait ()
 

Static Public Member Functions

static void Update ()
 
static void Exit ()
 
void static void SendRawMessage (const char *msg)
 

Detailed Description

Definition at line 109 of file scrollview.h.

Member Enumeration Documentation

◆ Color

Enumerator
NONE 
BLACK 
WHITE 
RED 
YELLOW 
GREEN 
CYAN 
BLUE 
MAGENTA 
AQUAMARINE 
DARK_SLATE_BLUE 
LIGHT_BLUE 
MEDIUM_BLUE 
MIDNIGHT_BLUE 
NAVY_BLUE 
SKY_BLUE 
SLATE_BLUE 
STEEL_BLUE 
CORAL 
BROWN 
SANDY_BROWN 
GOLD 
GOLDENROD 
DARK_GREEN 
DARK_OLIVE_GREEN 
FOREST_GREEN 
LIME_GREEN 
PALE_GREEN 
YELLOW_GREEN 
LIGHT_GREY 
DARK_SLATE_GREY 
DIM_GREY 
GREY 
KHAKI 
MAROON 
ORANGE 
ORCHID 
PINK 
PLUM 
INDIAN_RED 
ORANGE_RED 
VIOLET_RED 
SALMON 
TAN 
TURQUOISE 
DARK_TURQUOISE 
VIOLET 
WHEAT 
GREEN_YELLOW 

Definition at line 112 of file scrollview.h.

112 {
113 NONE,
114 BLACK,
115 WHITE,
116 RED,
117 YELLOW,
118 GREEN,
119 CYAN,
120 BLUE,
121 MAGENTA,
127 NAVY_BLUE,
128 SKY_BLUE,
131 CORAL,
132 BROWN,
134 GOLD,
135 GOLDENROD,
144 DIM_GREY,
145 GREY,
146 KHAKI,
147 MAROON,
148 ORANGE,
149 ORCHID,
150 PINK,
151 PLUM,
155 SALMON,
156 TAN,
157 TURQUOISE,
159 VIOLET,
160 WHEAT,
161 GREEN_YELLOW // Make sure this one is last.
162 };

Constructor & Destructor Documentation

◆ ~ScrollView()

tesseract::ScrollView::~ScrollView ( )

Definition at line 356 of file scrollview.cpp.

356 {
357#ifndef GRAPHICS_DISABLED
358 svmap_mu->lock();
359 if (svmap[window_id_] != nullptr) {
360 svmap_mu->unlock();
361 // So the event handling thread can quit.
362 SendMsg("destroy()");
363
365 svmap_mu->lock();
366 svmap[window_id_] = nullptr;
367 svmap_mu->unlock();
368 // The event handler thread for this window *must* receive the
369 // destroy event and set its pointer to this to nullptr before we allow
370 // the destructor to exit.
371 while (!event_handler_ended_) {
372 Update();
373 }
374 } else {
375 svmap_mu->unlock();
376 }
377 delete semaphore_;
378 delete points_;
379#endif // !GRAPHICS_DISABLED
380}
@ SVET_DESTROY
Definition: scrollview.h:54
std::unique_ptr< SVEvent > AwaitEvent(SVEventType type)
Definition: scrollview.cpp:432
static void Update()
Definition: scrollview.cpp:700
void SendMsg(const char *msg,...) __attribute__((format(gnu_printf
Send a message to the server, attaching the window id.
Definition: scrollview.cpp:384

◆ ScrollView() [1/3]

tesseract::ScrollView::ScrollView ( const char *  name,
int  x_pos,
int  y_pos,
int  x_size,
int  y_size,
int  x_canvas_size,
int  y_canvas_size 
)

Calls Initialize with default argument for server_name_ & y_axis_reversed.

Definition at line 264 of file scrollview.cpp.

265 {
266 Initialize(name, x_pos, y_pos, x_size, y_size, x_canvas_size, y_canvas_size, false, "localhost");
267}

◆ ScrollView() [2/3]

tesseract::ScrollView::ScrollView ( const char *  name,
int  x_pos,
int  y_pos,
int  x_size,
int  y_size,
int  x_canvas_size,
int  y_canvas_size,
bool  y_axis_reversed 
)

Calls Initialize with default argument for server_name_.

Definition at line 257 of file scrollview.cpp.

258 {
259 Initialize(name, x_pos, y_pos, x_size, y_size, x_canvas_size, y_canvas_size, y_axis_reversed,
260 "localhost");
261}

◆ ScrollView() [3/3]

tesseract::ScrollView::ScrollView ( const char *  name,
int  x_pos,
int  y_pos,
int  x_size,
int  y_size,
int  x_canvas_size,
int  y_canvas_size,
bool  y_axis_reversed,
const char *  server_name 
)

Calls Initialize with all arguments given.

Definition at line 249 of file scrollview.cpp.

251 {
252 Initialize(name, x_pos, y_pos, x_size, y_size, x_canvas_size, y_canvas_size, y_axis_reversed,
253 server_name);
254}

Member Function Documentation

◆ AddEventHandler()

void tesseract::ScrollView::AddEventHandler ( SVEventHandler listener)

Add an Event Listener to this ScrollView Window.

Definition at line 408 of file scrollview.cpp.

408 {
409 event_handler_ = listener;
410}

◆ AddMessage()

void tesseract::ScrollView::AddMessage ( const char *  message)

Definition at line 533 of file scrollview.cpp.

533 {
534 char form[kMaxMsgSize];
535 snprintf(form, sizeof(form), "w%u:%s", window_id_, message);
536
537 char *esc = AddEscapeChars(form);
538 SendMsg("addMessage(\"%s\")", esc);
539 delete[] esc;
540}
const int kMaxMsgSize
Definition: scrollview.cpp:46

◆ AddMessageBox()

void tesseract::ScrollView::AddMessageBox ( )

Definition at line 554 of file scrollview.cpp.

554 {
555 SendMsg("addMessageBox()");
556}

◆ AddMessageF()

void tesseract::ScrollView::AddMessageF ( const char *  format,
  ... 
)

Definition at line 542 of file scrollview.cpp.

542 {
543 va_list args;
544 char message[kMaxMsgSize - 4];
545
546 va_start(args, format); // variable list
547 vsnprintf(message, sizeof(message), format, args);
548 va_end(args);
549
551}
void AddMessage(const char *message)
Definition: scrollview.cpp:533

◆ AlwaysOnTop()

void tesseract::ScrollView::AlwaysOnTop ( bool  b)

Definition at line 524 of file scrollview.cpp.

524 {
525 if (b) {
526 SendMsg("setAlwaysOnTop(true)");
527 } else {
528 SendMsg("setAlwaysOnTop(false)");
529 }
530}

◆ AwaitEvent()

std::unique_ptr< SVEvent > tesseract::ScrollView::AwaitEvent ( SVEventType  type)

Block until an event of the given type is received. Note: The calling function is responsible for deleting the returned SVEvent afterwards!

Definition at line 432 of file scrollview.cpp.

432 {
433 // Initialize the waiting semaphore.
434 auto *sem = new SVSemaphore();
435 std::pair<ScrollView *, SVEventType> ea(this, type);
436 waiting_for_events_mu->lock();
437 waiting_for_events[ea] = {sem, nullptr};
438 waiting_for_events_mu->unlock();
439 // Wait on it, but first flush.
440 stream_->Flush();
441 sem->Wait();
442 // Process the event we got woken up for (its in waiting_for_events pair).
443 waiting_for_events_mu->lock();
444 auto ret = std::move(waiting_for_events[ea].second);
445 waiting_for_events.erase(ea);
446 delete sem;
447 waiting_for_events_mu->unlock();
448 return ret;
449}
type
Definition: upload.py:458
void Flush()
Flush the buffer.
Definition: svutil.cpp:170

◆ Brush() [1/3]

void tesseract::ScrollView::Brush ( Color  color)

Definition at line 716 of file scrollview.cpp.

716 {
717 Brush(table_colors[color][0], table_colors[color][1], table_colors[color][2],
718 table_colors[color][3]);
719}
void Brush(Color color)
Definition: scrollview.cpp:716

◆ Brush() [2/3]

void tesseract::ScrollView::Brush ( int  red,
int  green,
int  blue 
)

Definition at line 600 of file scrollview.cpp.

600 {
601 SendMsg("brush(%d,%d,%d)", red, green, blue);
602}

◆ Brush() [3/3]

void tesseract::ScrollView::Brush ( int  red,
int  green,
int  blue,
int  alpha 
)

Definition at line 605 of file scrollview.cpp.

605 {
606 SendMsg("brush(%d,%d,%d,%d)", red, green, blue, alpha);
607}

◆ Clear()

void tesseract::ScrollView::Clear ( )

Definition at line 565 of file scrollview.cpp.

565 {
566 SendMsg("clear()");
567}

◆ Draw() [1/2]

void tesseract::ScrollView::Draw ( const char *  image,
int  x_pos,
int  y_pos 
)

Definition at line 640 of file scrollview.cpp.

640 {
641 SendMsg("openImage('%s')", image);
642 SendMsg("drawImage('%s',%d,%d)", image, x_pos, TranslateYCoordinate(y_pos));
643}
int TranslateYCoordinate(int y)
Definition: scrollview.cpp:809

◆ Draw() [2/2]

void tesseract::ScrollView::Draw ( Image  image,
int  x_pos,
int  y_pos 
)

Definition at line 750 of file scrollview.cpp.

750 {
751 l_uint8 *data;
752 size_t size;
753 pixWriteMem(&data, &size, image, IFF_PNG);
754 int base64_len = (size + 2) / 3 * 4;
755 y_pos = TranslateYCoordinate(y_pos);
756 SendMsg("readImage(%d,%d,%d)", x_pos, y_pos, base64_len);
757 // Base64 encode the data.
758 const char kBase64Table[64] = {
759 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
760 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
761 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
762 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/',
763 };
764 char *base64 = new char[base64_len + 1];
765 memset(base64, '=', base64_len);
766 base64[base64_len] = '\0';
767 int remainder = 0;
768 int bits_left = 0;
769 int code_len = 0;
770 for (size_t i = 0; i < size; ++i) {
771 int code = (data[i] >> (bits_left + 2)) | remainder;
772 base64[code_len++] = kBase64Table[code & 63];
773 bits_left += 2;
774 remainder = data[i] << (6 - bits_left);
775 if (bits_left == 6) {
776 base64[code_len++] = kBase64Table[remainder & 63];
777 bits_left = 0;
778 remainder = 0;
779 }
780 }
781 if (bits_left > 0) {
782 base64[code_len++] = kBase64Table[remainder & 63];
783 }
784 SendRawMessage(base64);
785 delete[] base64;
786 lept_free(data);
787}
void static void SendRawMessage(const char *msg)
Definition: scrollview.cpp:403

◆ DrawTo()

void tesseract::ScrollView::DrawTo ( int  x,
int  y 
)

Definition at line 491 of file scrollview.cpp.

491 {
492 points_->xcoords.push_back(x);
493 points_->ycoords.push_back(TranslateYCoordinate(y));
494 points_->empty = false;
495}
const double y
std::vector< int > xcoords
Definition: scrollview.cpp:51
std::vector< int > ycoords
Definition: scrollview.cpp:52

◆ Ellipse()

void tesseract::ScrollView::Ellipse ( int  x,
int  y,
int  width,
int  height 
)

Definition at line 585 of file scrollview.cpp.

585 {
586 SendMsg("drawEllipse(%d,%d,%u,%u)", x1, TranslateYCoordinate(y1), width, height);
587}

◆ Exit()

void tesseract::ScrollView::Exit ( )
static

Definition at line 559 of file scrollview.cpp.

559 {
560 SendRawMessage("svmain:exit()");
561 exit(0);
562}

◆ GetId()

int tesseract::ScrollView::GetId ( )
inline

Definition at line 202 of file scrollview.h.

202 {
203 return window_id_;
204 }

◆ GetName()

const char * tesseract::ScrollView::GetName ( )
inline

Definition at line 197 of file scrollview.h.

197 {
198 return window_name_;
199 }

◆ Line()

void tesseract::ScrollView::Line ( int  x1,
int  y1,
int  x2,
int  y2 
)

Definition at line 498 of file scrollview.cpp.

498 {
499 if (!points_->xcoords.empty() && x1 == points_->xcoords.back() &&
500 TranslateYCoordinate(y1) == points_->ycoords.back()) {
501 // We are already at x1, y1, so just draw to x2, y2.
502 DrawTo(x2, y2);
503 } else if (!points_->xcoords.empty() && x2 == points_->xcoords.back() &&
504 TranslateYCoordinate(y2) == points_->ycoords.back()) {
505 // We are already at x2, y2, so just draw to x1, y1.
506 DrawTo(x1, y1);
507 } else {
508 // This is a new line.
509 SetCursor(x1, y1);
510 DrawTo(x2, y2);
511 }
512}
void SetCursor(int x, int y)
Definition: scrollview.cpp:485
void DrawTo(int x, int y)
Definition: scrollview.cpp:491

◆ MenuItem() [1/3]

void tesseract::ScrollView::MenuItem ( const char *  parent,
const char *  name 
)

Definition at line 666 of file scrollview.cpp.

666 {
667 if (parent == nullptr) {
668 parent = "";
669 }
670 SendMsg("addMenuBarItem('%s','%s')", parent, name);
671}

◆ MenuItem() [2/3]

void tesseract::ScrollView::MenuItem ( const char *  parent,
const char *  name,
int  cmdEvent 
)

Definition at line 658 of file scrollview.cpp.

658 {
659 if (parent == nullptr) {
660 parent = "";
661 }
662 SendMsg("addMenuBarItem('%s','%s',%d)", parent, name, cmdEvent);
663}

◆ MenuItem() [3/3]

void tesseract::ScrollView::MenuItem ( const char *  parent,
const char *  name,
int  cmdEvent,
bool  flagged 
)

Definition at line 646 of file scrollview.cpp.

646 {
647 if (parent == nullptr) {
648 parent = "";
649 }
650 if (flag) {
651 SendMsg("addMenuBarItem('%s','%s',%d,true)", parent, name, cmdEvent);
652 } else {
653 SendMsg("addMenuBarItem('%s','%s',%d,false)", parent, name, cmdEvent);
654 }
655}

◆ Pen() [1/3]

void tesseract::ScrollView::Pen ( Color  color)

Definition at line 710 of file scrollview.cpp.

710 {
711 Pen(table_colors[color][0], table_colors[color][1], table_colors[color][2],
712 table_colors[color][3]);
713}
void Pen(Color color)
Definition: scrollview.cpp:710

◆ Pen() [2/3]

void tesseract::ScrollView::Pen ( int  red,
int  green,
int  blue 
)

Definition at line 590 of file scrollview.cpp.

590 {
591 SendMsg("pen(%d,%d,%d)", red, green, blue);
592}

◆ Pen() [3/3]

void tesseract::ScrollView::Pen ( int  red,
int  green,
int  blue,
int  alpha 
)

Definition at line 595 of file scrollview.cpp.

595 {
596 SendMsg("pen(%d,%d,%d,%d)", red, green, blue, alpha);
597}

◆ PopupItem() [1/2]

void tesseract::ScrollView::PopupItem ( const char *  parent,
const char *  name 
)

Definition at line 674 of file scrollview.cpp.

674 {
675 if (parent == nullptr) {
676 parent = "";
677 }
678 SendMsg("addPopupMenuItem('%s','%s')", parent, name);
679}

◆ PopupItem() [2/2]

void tesseract::ScrollView::PopupItem ( const char *  parent,
const char *  name,
int  cmdEvent,
const char *  value,
const char *  desc 
)

Definition at line 682 of file scrollview.cpp.

683 {
684 if (parent == nullptr) {
685 parent = "";
686 }
687 char *esc = AddEscapeChars(value);
688 char *esc2 = AddEscapeChars(desc);
689 SendMsg("addPopupMenuItem('%s','%s',%d,'%s','%s')", parent, name, cmdEvent, esc, esc2);
690 delete[] esc;
691 delete[] esc2;
692}
int value

◆ Rectangle()

void tesseract::ScrollView::Rectangle ( int  x1,
int  y1,
int  x2,
int  y2 
)

Definition at line 576 of file scrollview.cpp.

576 {
577 if (x1 == x2 && y1 == y2) {
578 return; // Scrollviewer locks up.
579 }
580 SendMsg("drawRectangle(%d,%d,%d,%d)", x1, TranslateYCoordinate(y1), x2, TranslateYCoordinate(y2));
581}

◆ SendMsg()

void tesseract::ScrollView::SendMsg ( const char *  msg,
  ... 
)

Send a message to the server, attaching the window id.

Definition at line 384 of file scrollview.cpp.

384 {
385 if (!points_->empty) {
386 SendPolygon();
387 }
388 va_list args;
389 char message[kMaxMsgSize - 4];
390
391 va_start(args, format); // variable list
392 vsnprintf(message, sizeof(message), format, args);
393 va_end(args);
394
395 char form[kMaxMsgSize];
396 snprintf(form, sizeof(form), "w%u:%s\n", window_id_, message);
397
398 stream_->Send(form);
399}
void Send(const char *msg)
Put a message in the messagebuffer to the server and try to send it.
Definition: svutil.cpp:164

◆ SendRawMessage()

void tesseract::ScrollView::SendRawMessage ( const char *  msg)
static

Send a message to the server without a window id. Used for global events like exit().

Definition at line 403 of file scrollview.cpp.

403 {
404 stream_->Send(msg);
405}

◆ SetCursor()

void tesseract::ScrollView::SetCursor ( int  x,
int  y 
)

Definition at line 485 of file scrollview.cpp.

485 {
486 SendPolygon();
487 DrawTo(x, y);
488}

◆ SetVisible()

void tesseract::ScrollView::SetVisible ( bool  visible)

Definition at line 515 of file scrollview.cpp.

515 {
516 if (visible) {
517 SendMsg("setVisible(true)");
518 } else {
519 SendMsg("setVisible(false)");
520 }
521}

◆ ShowInputDialog()

char * tesseract::ScrollView::ShowInputDialog ( const char *  msg)

Definition at line 722 of file scrollview.cpp.

722 {
723 SendMsg("showInputDialog(\"%s\")", msg);
724 // wait till an input event (all others are thrown away)
725 auto ev = AwaitEvent(SVET_INPUT);
726 char *p = new char[strlen(ev->parameter) + 1];
727 strcpy(p, ev->parameter);
728 return p;
729}
const char * p
@ SVET_INPUT
Definition: scrollview.h:58

◆ ShowYesNoDialog()

int tesseract::ScrollView::ShowYesNoDialog ( const char *  msg)

Definition at line 732 of file scrollview.cpp.

732 {
733 SendMsg("showYesNoDialog(\"%s\")", msg);
734 // Wait till an input event (all others are thrown away)
735 auto ev = AwaitEvent(SVET_INPUT);
736 int a = ev->parameter[0];
737 return a;
738}

◆ Stroke()

void tesseract::ScrollView::Stroke ( float  width)

Definition at line 570 of file scrollview.cpp.

570 {
571 SendMsg("setStrokeWidth(%f)", width);
572}

◆ Text()

void tesseract::ScrollView::Text ( int  x,
int  y,
const char *  mystring 
)

Definition at line 635 of file scrollview.cpp.

635 {
636 SendMsg("drawText(%d,%d,'%s')", x, TranslateYCoordinate(y), mystring);
637}

◆ TextAttributes()

void tesseract::ScrollView::TextAttributes ( const char *  font,
int  pixel_size,
bool  bold,
bool  italic,
bool  underlined 
)

Definition at line 610 of file scrollview.cpp.

611 {
612 const char *b;
613 const char *i;
614 const char *u;
615
616 if (bold) {
617 b = "true";
618 } else {
619 b = "false";
620 }
621 if (italic) {
622 i = "true";
623 } else {
624 i = "false";
625 }
626 if (underlined) {
627 u = "true";
628 } else {
629 u = "false";
630 }
631 SendMsg("textAttributes('%s',%u,%s,%s,%s)", font, pixel_size, b, i, u);
632}

◆ TranslateYCoordinate()

int tesseract::ScrollView::TranslateYCoordinate ( int  y)

Definition at line 809 of file scrollview.cpp.

809 {
810 if (!y_axis_is_reversed_) {
811 return y;
812 } else {
813 return y_size_ - y;
814 }
815}

◆ Update()

void tesseract::ScrollView::Update ( )
static

Definition at line 700 of file scrollview.cpp.

700 {
701 std::lock_guard<std::mutex> guard(*svmap_mu);
702 for (auto &iter : svmap) {
703 if (iter.second != nullptr) {
704 iter.second->UpdateWindow();
705 }
706 }
707}

◆ UpdateWindow()

void tesseract::ScrollView::UpdateWindow ( )

Definition at line 695 of file scrollview.cpp.

695 {
696 SendMsg("update()");
697}

◆ Wait()

char tesseract::ScrollView::Wait ( )

Definition at line 817 of file scrollview.cpp.

817 {
818 // Wait till an input or click event (all others are thrown away)
819 char ret = '\0';
820 SVEventType ev_type = SVET_ANY;
821 do {
822 std::unique_ptr<SVEvent> ev(AwaitEvent(SVET_ANY));
823 ev_type = ev->type;
824 if (ev_type == SVET_INPUT) {
825 ret = ev->parameter[0];
826 }
827 } while (ev_type != SVET_INPUT && ev_type != SVET_CLICK);
828 return ret;
829}
@ SVET_CLICK
Definition: scrollview.h:56

◆ ZoomToRectangle()

void tesseract::ScrollView::ZoomToRectangle ( int  x1,
int  y1,
int  x2,
int  y2 
)

Definition at line 742 of file scrollview.cpp.

742 {
743 y1 = TranslateYCoordinate(y1);
744 y2 = TranslateYCoordinate(y2);
745 SendMsg("zoomRectangle(%d,%d,%d,%d)", std::min(x1, x2), std::min(y1, y2), std::max(x1, x2),
746 std::max(y1, y2));
747}

The documentation for this class was generated from the following files: