Scroom  0.14
view.cc File Reference
#include "view.hh"
#include <array>
#include <sstream>
#include <spdlog/spdlog.h>
#include <boost/lexical_cast.hpp>
#include <glib-object.h>
#include <scroom/assertions.hh>
#include <scroom/cairo-helpers.hh>
#include <scroom/format_stuff.hh>
#include <scroom/rounding.hh>
#include "callbacks.hh"
#include "pluginmanager.hh"
Include dependency graph for view.cc:

Classes

class  TweakPresentationPosition
 Tweakers. More...
 
class  TweakRulers
 
class  ITweakSelection
 
class  TweakSelection
 
class  TweakGridSelection
 
class  TweakPixelSelection
 
class  TweakPositionTextBox
 

Macros

#define G_VALUE_INIT
 

Enumerations

enum  { COLUMN_TEXT, COLUMN_ZOOM, N_COLUMNS }
 
enum  Corner { Corner::TOP_LEFT, Corner::TOP_RIGHT, Corner::BOTTOM_LEFT, Corner::BOTTOM_RIGHT }
 

Functions

std::function< Scroom::Utils::Point< double >Scroom::Utils::Rectangle< double >)> corner_getter (Corner c)
 
Corner find_closest_corner (Scroom::Utils::Point< double > p, Scroom::Utils::Rectangle< double > r)
 
Corner find_opposed_corner (Corner c)
 
Scroom::Utils::Rectangle< double > toRectangle (Selection s)
 
static Scroom::Utils::Point< double > eventToPoint (GdkEventButton *event)
 Helpers. More...
 
static Scroom::Utils::Point< double > eventToPoint (GdkEventMotion *event)
 
static void on_newWindow_activate (GtkMenuItem *, gpointer user_data)
 
static void tool_button_toggled (GtkToggleButton *button, gpointer data)
 

Variables

static const std::array< const char *, 36 > zoomfactor
 
static const int MaxZoom = 5
 

Macro Definition Documentation

◆ G_VALUE_INIT

#define G_VALUE_INIT
Value:
{ \
0, \
{ \
{ \
0 \
} \
} \
}

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
COLUMN_TEXT 
COLUMN_ZOOM 
N_COLUMNS 
49 {
52  N_COLUMNS
53 };

◆ Corner

enum Corner
strong
Enumerator
TOP_LEFT 
TOP_RIGHT 
BOTTOM_LEFT 
BOTTOM_RIGHT 
110 {
111  TOP_LEFT,
112  TOP_RIGHT,
113  BOTTOM_LEFT,
115 };

Function Documentation

◆ corner_getter()

std::function<Scroom::Utils::Point<double>Scroom::Utils::Rectangle<double>)> corner_getter ( Corner  c)
119 {
120  switch(c)
121  {
122  case Corner::TOP_LEFT:
123  return [](Scroom::Utils::Rectangle<double> r) { return r.getTopLeft(); };
124  case Corner::TOP_RIGHT:
125  return [](Scroom::Utils::Rectangle<double> r) { return r.getTopRight(); };
126  case Corner::BOTTOM_LEFT:
127  return [](Scroom::Utils::Rectangle<double> r) { return r.getBottomLeft(); };
129  return [](Scroom::Utils::Rectangle<double> r) { return r.getBottomRight(); };
130  }
131  defect();
132 }

Referenced by TweakSelection::tweakSelection().

Here is the caller graph for this function:

◆ eventToPoint() [1/2]

static Scroom::Utils::Point<double> eventToPoint ( GdkEventButton *  event)
static

Helpers.

275 { return {event->x, event->y}; }

Referenced by View::on_buttonPress(), View::on_buttonRelease(), and View::on_motion_notify().

Here is the caller graph for this function:

◆ eventToPoint() [2/2]

static Scroom::Utils::Point<double> eventToPoint ( GdkEventMotion *  event)
static
277 { return {event->x, event->y}; }

◆ find_closest_corner()

Corner find_closest_corner ( Scroom::Utils::Point< double >  p,
Scroom::Utils::Rectangle< double >  r 
)
135 {
136  const std::array<std::array<Corner, 2>, 2> corners = {{
139  }};
140 
141  const auto c = center(r);
142 
143  return corners.at(c.x < p.x).at(c.y < p.y);
144 }

Referenced by TweakSelection::tweakSelection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_opposed_corner()

Corner find_opposed_corner ( Corner  c)
147 {
148  switch(c)
149  {
150  case Corner::TOP_LEFT:
151  return Corner::BOTTOM_RIGHT;
152  case Corner::TOP_RIGHT:
153  return Corner::BOTTOM_LEFT;
154  case Corner::BOTTOM_LEFT:
155  return Corner::TOP_RIGHT;
157  return Corner::TOP_LEFT;
158  }
159  defect();
160 }

Referenced by TweakSelection::tweakSelection().

Here is the caller graph for this function:

◆ on_newWindow_activate()

static void on_newWindow_activate ( GtkMenuItem *  ,
gpointer  user_data 
)
static
281 {
282  PresentationInterface::WeakPtr const& wp = *static_cast<PresentationInterface::WeakPtr*>(user_data); // Yuk!
283  PresentationInterface::Ptr const p = wp.lock();
284  if(p)
285  {
287  }
288 }

Referenced by View::updateNewWindowMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tool_button_toggled()

static void tool_button_toggled ( GtkToggleButton *  button,
gpointer  data 
)
static
865 { static_cast<View*>(data)->toolButtonToggled(button); }

Referenced by View::addToolButton().

Here is the caller graph for this function:

◆ toRectangle()

Scroom::Utils::Rectangle<double> toRectangle ( Selection  s)

Referenced by TweakSelection::tweakSelection().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ MaxZoom

const int MaxZoom = 5
static

◆ zoomfactor

const std::array<const char*, 36> zoomfactor
static
Initial value:
= {
"32:1", "16:1", "8:1", "4:1", "2:1", "1:1", "1:2", "1:4",
"1:8", "1:16", "1:32", "1:64", "1:128", "1:250", "1:500", "1:1000",
"1:2000", "1:4000", "1:8000", "1:16000", "1:32000", "1:64000", "1:128000", "1:250000",
"1:500000", "1:1 million", "1:2 million", "1:4 million", "1:8 million", "1:16 million", "1:32 million", "1:64 million",
"1:128 million", "1:250 million", "1:500 million", "1:1 billion",
}

Referenced by View::updateZoom().

find_or_create_scroom
void find_or_create_scroom(const PresentationInterface::Ptr &presentation)
Definition: callbacks.cc:481
Corner::TOP_LEFT
@ TOP_LEFT
Corner::BOTTOM_RIGHT
@ BOTTOM_RIGHT
View
Definition: view.hh:95
Scroom::Utils::Point::x
value_type x
Definition: point.hh:111
PresentationInterface::WeakPtr
boost::weak_ptr< PresentationInterface > WeakPtr
Definition: presentationinterface.hh:75
PresentationInterface::Ptr
boost::shared_ptr< PresentationInterface > Ptr
Definition: presentationinterface.hh:74
Corner::TOP_RIGHT
@ TOP_RIGHT
Selection::start
Point start
Definition: viewinterface.hh:44
Scroom::Utils::make_rect_from_start_end
Rectangle< T > make_rect_from_start_end(Point< T > start, Point< T > end)
Definition: rectangle.hh:296
COLUMN_ZOOM
@ COLUMN_ZOOM
Definition: view.cc:51
N_COLUMNS
@ N_COLUMNS
Definition: view.cc:52
Scroom::Utils::center
T center(Segment< T > s)
Definition: linearsegment.hh:246
Scroom::Utils::Rectangle< double >
defect
#define defect()
Definition: assertions.hh:40
Scroom::Utils::Point::y
value_type y
Definition: point.hh:112
Selection::end
Point end
Definition: viewinterface.hh:45
COLUMN_TEXT
@ COLUMN_TEXT
Definition: view.cc:50
Corner::BOTTOM_LEFT
@ BOTTOM_LEFT