This commit is contained in:
Matthias Koefferlein 2022-04-29 23:40:07 +02:00
parent 7048dde7b3
commit 2298a9a5c8
17 changed files with 8501 additions and 2704 deletions

View File

@ -46,7 +46,7 @@
namespace lay namespace lay
{ {
class LayoutView; class LayoutViewBase;
/** /**
* @brief A layout handle * @brief A layout handle
@ -581,7 +581,7 @@ public:
* @param cv The reference to the target cellview * @param cv The reference to the target cellview
* @param view The reference to the layout view * @param view The reference to the layout view
*/ */
CellViewRef (lay::CellView *cv, lay::LayoutView *view); CellViewRef (lay::CellView *cv, lay::LayoutViewBase *view);
/** /**
* @brief Gets the cellview index of this reference * @brief Gets the cellview index of this reference
@ -590,9 +590,9 @@ public:
int index () const; int index () const;
/** /**
* @brief Gets the LayoutView the reference is pointing to * @brief Gets the LayoutViewBase the reference is pointing to
*/ */
lay::LayoutView *view (); lay::LayoutViewBase *view ();
/** /**
* @brief Equality: Gives true, if the cellviews are identical * @brief Equality: Gives true, if the cellviews are identical
@ -749,7 +749,7 @@ public:
private: private:
tl::weak_ptr<lay::CellView> mp_cv; tl::weak_ptr<lay::CellView> mp_cv;
tl::weak_ptr<lay::LayoutView> mp_view; tl::weak_ptr<lay::LayoutViewBase> mp_view;
}; };
} }

View File

@ -73,21 +73,6 @@ Dispatcher::Dispatcher (DispatcherDelegate *delegate, Plugin *parent, bool stand
} }
} }
#if defined(HAVE_QT)
Dispatcher::Dispatcher (QWidget *menu_parent_widget, DispatcherDelegate *delegate, Plugin *parent, bool standalone)
: Plugin (parent, standalone),
mp_menu_parent_widget (menu_parent_widget),
mp_delegate (delegate)
{
if (mp_menu_parent_widget) {
mp_menu.reset (new lay::AbstractMenu (this));
}
if (! parent && ! ms_dispatcher_instance) {
ms_dispatcher_instance = this;
}
}
#endif
Dispatcher::~Dispatcher () Dispatcher::~Dispatcher ()
{ {
if (ms_dispatcher_instance == this) { if (ms_dispatcher_instance == this) {
@ -95,6 +80,18 @@ Dispatcher::~Dispatcher ()
} }
} }
#if defined(HAVE_QT)
void Dispatcher::set_menu_parent_widget (QWidget *menu_parent_widget)
{
mp_menu_parent_widget = menu_parent_widget;
if (mp_menu_parent_widget) {
mp_menu.reset (new lay::AbstractMenu (this));
} else {
mp_menu.reset (0);
}
}
#endif
bool bool
Dispatcher::configure (const std::string &name, const std::string &value) Dispatcher::configure (const std::string &name, const std::string &value)
{ {

View File

@ -121,17 +121,6 @@ public:
*/ */
Dispatcher (Plugin *parent = 0, bool standalone = false); Dispatcher (Plugin *parent = 0, bool standalone = false);
#if defined(HAVE_QT)
/**
* @brief The constructor
*
* @param menu_parent_widget If not 0, indicates that this is a GUI mode dispatcher providing an abstract menu
* @param parent Usually 0, but a dispatcher may have parents. In this case, the dispatcher is not the actual dispatcher, but the real plugin chain's root is.
* @param standalone The standalone flag passed to the plugin constructor.
*/
Dispatcher (QWidget *menu_parent_widget, Plugin *parent = 0, bool standalone = false);
#endif
/** /**
* @brief The root constructor * @brief The root constructor
* *
@ -139,16 +128,6 @@ public:
*/ */
Dispatcher (DispatcherDelegate *delegate, Plugin *parent = 0, bool standalone = false); Dispatcher (DispatcherDelegate *delegate, Plugin *parent = 0, bool standalone = false);
#if defined(HAVE_QT)
/**
* @brief The root constructor
*
* @param menu_parent_widget If not 0, indicates that this is a GUI mode dispatcher providing an abstract menu
* @param delegate The notification receiver for dispatcher events
*/
Dispatcher (QWidget *menu_parent_widget, DispatcherDelegate *delegate, Plugin *parent = 0, bool standalone = false);
#endif
/** /**
* @brief Destructor * @brief Destructor
*/ */
@ -233,6 +212,11 @@ public:
return mp_menu_parent_widget; return mp_menu_parent_widget;
} }
/**
* @brief Sets the parent widget
*/
void set_menu_parent_widget (QWidget *pw);
/** /**
* @brief Returns true, if the dispatcher supplies a user interface * @brief Returns true, if the dispatcher supplies a user interface
*/ */

View File

@ -22,7 +22,7 @@
#include "layLayerProperties.h" #include "layLayerProperties.h"
#include "layLayoutView.h" #include "layLayoutViewBase.h"
#include "layConverters.h" #include "layConverters.h"
#include "tlXMLParser.h" #include "tlXMLParser.h"
#include "tlException.h" #include "tlException.h"
@ -404,7 +404,7 @@ class LayerSourceEval
: public tl::Eval : public tl::Eval
{ {
public: public:
LayerSourceEval (const lay::LayerProperties &lp, const lay::LayoutView *view, bool real) LayerSourceEval (const lay::LayerProperties &lp, const lay::LayoutViewBase *view, bool real)
: m_lp (lp), mp_view (view), m_real (real) : m_lp (lp), mp_view (view), m_real (real)
{ {
// .. nothing yet .. // .. nothing yet ..
@ -415,14 +415,14 @@ public:
return m_lp.source (m_real); return m_lp.source (m_real);
} }
const lay::LayoutView *view () const const lay::LayoutViewBase *view () const
{ {
return mp_view; return mp_view;
} }
private: private:
const lay::LayerProperties &m_lp; const lay::LayerProperties &m_lp;
const lay::LayoutView *mp_view; const lay::LayoutViewBase *mp_view;
bool m_real; bool m_real;
}; };
@ -480,7 +480,7 @@ private:
}; };
std::string std::string
LayerProperties::display_string (const lay::LayoutView *view, bool real, bool always_show_source) const LayerProperties::display_string (const lay::LayoutViewBase *view, bool real, bool always_show_source) const
{ {
refresh (); refresh ();
@ -592,7 +592,7 @@ LayerProperties::need_realize (unsigned int flags, bool /*force*/)
} }
void void
LayerProperties::do_realize (const LayoutView *view) const LayerProperties::do_realize (const LayoutViewBase *view) const
{ {
m_layer_index = -1; m_layer_index = -1;
m_cellview_index = -1; m_cellview_index = -1;
@ -712,10 +712,10 @@ LayerPropertiesNode::operator== (const LayerPropertiesNode &d) const
return m_children == d.m_children; return m_children == d.m_children;
} }
LayoutView * LayoutViewBase *
LayerPropertiesNode::view () const LayerPropertiesNode::view () const
{ {
return const_cast<lay::LayoutView *> (mp_view.get ()); return const_cast<lay::LayoutViewBase *> (mp_view.get ());
} }
unsigned int unsigned int
@ -804,7 +804,7 @@ LayerPropertiesNode::bbox () const
} }
void void
LayerPropertiesNode::attach_view (LayoutView *view, unsigned int list_index) LayerPropertiesNode::attach_view (LayoutViewBase *view, unsigned int list_index)
{ {
mp_view.reset (view); mp_view.reset (view);
m_list_index = list_index; m_list_index = list_index;
@ -1335,7 +1335,7 @@ static LayerPropertiesNode expand_wildcard_layout (const LayerPropertiesNode &so
} }
static std::vector<LayerPropertiesNode> static std::vector<LayerPropertiesNode>
expand_wildcard_layers (const LayerPropertiesNode &lp, const LayerPropertiesList &current_props, lay::LayoutView *view, unsigned int list_index) expand_wildcard_layers (const LayerPropertiesNode &lp, const LayerPropertiesList &current_props, lay::LayoutViewBase *view, unsigned int list_index)
{ {
std::vector<LayerPropertiesNode> new_props; std::vector<LayerPropertiesNode> new_props;
@ -1651,7 +1651,7 @@ struct UIntColorConverter
if (c == 0) { if (c == 0) {
return ""; return "";
} else { } else {
return ColorConverter::to_string (QColor (c & 0xffffff)); return ColorConverter::to_string (lay::Color (c | 0xff000000));
} }
} }
@ -1660,7 +1660,7 @@ struct UIntColorConverter
if (s.empty ()) { if (s.empty ()) {
c = 0; c = 0;
} else { } else {
QColor qc; lay::Color qc;
ColorConverter::from_string (s, qc); ColorConverter::from_string (s, qc);
c = qc.rgb () | 0xff000000; c = qc.rgb () | 0xff000000;
} }
@ -1858,7 +1858,7 @@ LayerPropertiesList::save (tl::OutputStream &os, const std::vector <lay::LayerPr
} }
void void
LayerPropertiesList::attach_view (lay::LayoutView *view, unsigned int list_index) LayerPropertiesList::attach_view (lay::LayoutViewBase *view, unsigned int list_index)
{ {
mp_view.reset (view); mp_view.reset (view);
m_list_index = list_index; m_list_index = list_index;
@ -1870,10 +1870,10 @@ LayerPropertiesList::attach_view (lay::LayoutView *view, unsigned int list_index
} }
} }
lay::LayoutView * lay::LayoutViewBase *
LayerPropertiesList::view () const LayerPropertiesList::view () const
{ {
return const_cast<lay::LayoutView *> (mp_view.get ()); return const_cast<lay::LayoutViewBase *> (mp_view.get ());
} }
unsigned int unsigned int

View File

@ -48,7 +48,7 @@ namespace tl {
namespace lay { namespace lay {
class LayoutView; class LayoutViewBase;
class LayerPropertiesList; class LayerPropertiesList;
class LayerPropertiesNode; class LayerPropertiesNode;
@ -700,7 +700,7 @@ public:
* If it is set to false, the view's always_show_source attribute with determine whether the source is * If it is set to false, the view's always_show_source attribute with determine whether the source is
* shown. * shown.
*/ */
std::string display_string (const lay::LayoutView *view, bool real, bool always_with_source = false) const; std::string display_string (const lay::LayoutViewBase *view, bool real, bool always_with_source = false) const;
/** /**
* @brief The source specification * @brief The source specification
@ -717,7 +717,7 @@ public:
* *
* This method may throw an exception if the specification * This method may throw an exception if the specification
* is not valid. In order to make the layer usable, the properties * is not valid. In order to make the layer usable, the properties
* object must be "realized" with respect to a LayoutView object. * object must be "realized" with respect to a LayoutViewBase object.
*/ */
void set_source (const std::string &s); void set_source (const std::string &s);
@ -725,7 +725,7 @@ public:
* @brief Load the source specification * @brief Load the source specification
* *
* In order to make the layer usable, the properties * In order to make the layer usable, the properties
* object must be "realized" with respect to a LayoutView object. * object must be "realized" with respect to a LayoutViewBase object.
*/ */
void set_source (const lay::ParsedLayerSource &s); void set_source (const lay::ParsedLayerSource &s);
@ -887,7 +887,7 @@ protected:
* *
* @param view The view the properties refer to or 0 if there is no view. * @param view The view the properties refer to or 0 if there is no view.
*/ */
void do_realize (const LayoutView *view) const; void do_realize (const LayoutViewBase *view) const;
/** /**
* @brief Tell, if a realize of the visual properties is needed * @brief Tell, if a realize of the visual properties is needed
@ -1172,12 +1172,12 @@ public:
* compute the actual property selection set. * compute the actual property selection set.
* This method is supposed to be * This method is supposed to be
*/ */
void attach_view (LayoutView *view, unsigned int list_index); void attach_view (LayoutViewBase *view, unsigned int list_index);
/** /**
* @brief Gets the layout view the node lives in * @brief Gets the layout view the node lives in
*/ */
LayoutView *view () const; LayoutViewBase *view () const;
/** /**
* @brief Gets the index of the layer properties list that node lives in * @brief Gets the index of the layer properties list that node lives in
@ -1214,7 +1214,7 @@ protected:
private: private:
// A reference to the view // A reference to the view
tl::weak_ptr<lay::LayoutView> mp_view; tl::weak_ptr<lay::LayoutViewBase> mp_view;
unsigned int m_list_index; unsigned int m_list_index;
// the parent node // the parent node
tl::weak_ptr<LayerPropertiesNode> mp_parent; tl::weak_ptr<LayerPropertiesNode> mp_parent;
@ -1912,12 +1912,12 @@ public:
* "load" automatically attaches the view. * "load" automatically attaches the view.
* This method has the side effect of recomputing the layer source parameters. * This method has the side effect of recomputing the layer source parameters.
*/ */
void attach_view (lay::LayoutView *view, unsigned int list_index); void attach_view (lay::LayoutViewBase *view, unsigned int list_index);
/** /**
* @brief Gets the layout view this list is attached to * @brief Gets the layout view this list is attached to
*/ */
lay::LayoutView *view () const; lay::LayoutViewBase *view () const;
/** /**
* @brief Gets the layout list * @brief Gets the layout list
@ -1925,7 +1925,7 @@ public:
unsigned int list_index () const; unsigned int list_index () const;
private: private:
tl::weak_ptr<lay::LayoutView> mp_view; tl::weak_ptr<lay::LayoutViewBase> mp_view;
unsigned int m_list_index; unsigned int m_list_index;
layer_list m_layer_properties; layer_list m_layer_properties;
lay::DitherPattern m_dither_pattern; lay::DitherPattern m_dither_pattern;

View File

@ -47,7 +47,7 @@
namespace lay namespace lay
{ {
class LayoutView; class LayoutViewBase;
class RedrawThread; class RedrawThread;
/** /**
@ -138,10 +138,16 @@ class LayoutCanvas
public lay::BitmapRedrawThreadCanvas, public lay::BitmapRedrawThreadCanvas,
public lay::Drawings public lay::Drawings
{ {
#if defined(HAVE_QT)
Q_OBJECT Q_OBJECT
#endif
public: public:
LayoutCanvas (QWidget *parent, lay::LayoutView *view, const char *name = "canvas"); #if defined(HAVE_QT)
LayoutCanvas (QWidget *parent, lay::LayoutViewBase *view, const char *name = "canvas");
#else
LayoutCanvas (lay::LayoutViewBase *view, const char *name = "canvas");
#endif
~LayoutCanvas (); ~LayoutCanvas ();
void set_colors (lay::Color background, lay::Color foreground, lay::Color active); void set_colors (lay::Color background, lay::Color foreground, lay::Color active);
@ -341,18 +347,18 @@ public:
*/ */
tl::Event viewport_changed_event; tl::Event viewport_changed_event;
signals: // key events
void left_arrow_key_pressed (); tl::Event left_arrow_key_pressed;
void up_arrow_key_pressed (); tl::Event up_arrow_key_pressed;
void right_arrow_key_pressed (); tl::Event right_arrow_key_pressed;
void down_arrow_key_pressed (); tl::Event down_arrow_key_pressed;
void left_arrow_key_pressed_with_shift (); tl::Event left_arrow_key_pressed_with_shift;
void up_arrow_key_pressed_with_shift (); tl::Event up_arrow_key_pressed_with_shift;
void right_arrow_key_pressed_with_shift (); tl::Event right_arrow_key_pressed_with_shift;
void down_arrow_key_pressed_with_shift (); tl::Event down_arrow_key_pressed_with_shift;
private: private:
lay::LayoutView *mp_view; lay::LayoutViewBase *mp_view;
QImage *mp_image; QImage *mp_image;
QImage *mp_image_bg; QImage *mp_image_bg;
QPixmap *mp_pixmap; QPixmap *mp_pixmap;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -31,17 +31,17 @@ class QMouseEvent;
namespace lay { namespace lay {
class LayoutCanvas; class LayoutCanvas;
class LayoutView; class LayoutViewBase;
class MouseTracker class MouseTracker
: public lay::ViewService : public lay::ViewService
{ {
public: public:
MouseTracker (lay::LayoutView *view); MouseTracker (lay::LayoutViewBase *view);
virtual bool mouse_move_event (const db::DPoint &p, unsigned int buttons, bool prio); virtual bool mouse_move_event (const db::DPoint &p, unsigned int buttons, bool prio);
private: private:
lay::LayoutView *mp_view; lay::LayoutViewBase *mp_view;
}; };
} }

View File

@ -20,32 +20,24 @@
*/ */
#ifndef HDR_layMove #ifndef HDR_layMove
#define HDR_layMove #define HDR_layMove
#include "dbManager.h" #include "dbManager.h"
#include "layViewObject.h" #include "layViewObject.h"
#include <QTimer>
#include <QObject>
#include <memory> #include <memory>
namespace lay { namespace lay {
class Editables; class Editables;
class LayoutView; class LayoutViewBase;
class MoveService class MoveService :
: public QObject,
public lay::ViewService public lay::ViewService
{ {
Q_OBJECT
public: public:
MoveService (lay::LayoutView *view); MoveService (lay::LayoutViewBase *view);
~MoveService (); ~MoveService ();
virtual bool configure (const std::string &name, const std::string &value); virtual bool configure (const std::string &name, const std::string &value);
@ -67,7 +59,7 @@ private:
bool m_dragging; bool m_dragging;
bool m_dragging_transient; bool m_dragging_transient;
lay::Editables *mp_editables; lay::Editables *mp_editables;
lay::LayoutView *mp_view; lay::LayoutViewBase *mp_view;
double m_global_grid; double m_global_grid;
db::DPoint m_shift; db::DPoint m_shift;
db::DPoint m_mouse_pos; db::DPoint m_mouse_pos;

View File

@ -22,7 +22,7 @@
#include "layParsedLayerSource.h" #include "layParsedLayerSource.h"
#include "layLayoutView.h" #include "layLayoutViewBase.h"
#include "tlString.h" #include "tlString.h"
#include "tlGlobPattern.h" #include "tlGlobPattern.h"
@ -1163,7 +1163,7 @@ ParsedLayerSource::to_string () const
} }
std::string std::string
ParsedLayerSource::display_string (const lay::LayoutView *view) const ParsedLayerSource::display_string (const lay::LayoutViewBase *view) const
{ {
std::string r; std::string r;

View File

@ -43,7 +43,7 @@ namespace lay
{ {
class LayerProperties; class LayerProperties;
class LayoutView; class LayoutViewBase;
class PropertySelectorBase; class PropertySelectorBase;
/** /**
@ -640,7 +640,7 @@ public:
* This method delivers a display version that may be abbreviated and is supposed * This method delivers a display version that may be abbreviated and is supposed
* to be used in the layer list display. * to be used in the layer list display.
*/ */
std::string display_string (const lay::LayoutView *view) const; std::string display_string (const lay::LayoutViewBase *view) const;
/** /**
* @brief Comparison (equality) * @brief Comparison (equality)

View File

@ -48,7 +48,7 @@ namespace lay
class Plugin; class Plugin;
class Dispatcher; class Dispatcher;
class LayoutView; class LayoutViewBase;
class ViewService; class ViewService;
class Editable; class Editable;
class Drawing; class Drawing;
@ -302,7 +302,7 @@ public:
* This method may return 0 for "dummy" plugins that just register menu entries * This method may return 0 for "dummy" plugins that just register menu entries
* or configuration options. * or configuration options.
*/ */
virtual lay::Plugin *create_plugin (db::Manager * /*manager*/, lay::Dispatcher * /*dispatcher*/, lay::LayoutView * /*view*/) const virtual lay::Plugin *create_plugin (db::Manager * /*manager*/, lay::Dispatcher * /*dispatcher*/, lay::LayoutViewBase * /*view*/) const
{ {
return 0; return 0;
} }
@ -329,7 +329,7 @@ public:
* *
* The new pages are returned in the "pages" vector. The layout view will take ownership of these pages. * The new pages are returned in the "pages" vector. The layout view will take ownership of these pages.
*/ */
virtual void get_editor_options_pages (std::vector<lay::EditorOptionsPage *> & /*pages*/, lay::LayoutView * /*view*/, lay::Dispatcher * /*dispatcher*/) const virtual void get_editor_options_pages (std::vector<lay::EditorOptionsPage *> & /*pages*/, lay::LayoutViewBase * /*view*/, lay::Dispatcher * /*dispatcher*/) const
{ {
// .. no pages in the default implementation .. // .. no pages in the default implementation ..
} }
@ -351,8 +351,8 @@ public:
/** /**
* @brief Specifies the primary mouse modes * @brief Specifies the primary mouse modes
* *
* These are built-in modes from the LayoutView. This method is intended for * These are built-in modes from the LayoutViewBase. This method is intended for
* the LayoutView's standard modes only. * the LayoutViewBase's standard modes only.
*/ */
virtual void implements_primary_mouse_modes (std::vector<std::pair<std::string, std::pair<std::string, int> > > & /*modes*/) virtual void implements_primary_mouse_modes (std::vector<std::pair<std::string, std::pair<std::string, int> > > & /*modes*/)
{ {

View File

@ -30,23 +30,29 @@
#include "layViewObject.h" #include "layViewObject.h"
#include "layEditable.h" #include "layEditable.h"
#include <QTimer> #if defined (HAVE_QT)
#include <QObject> # include <QTimer>
# include <QObject>
#endif
namespace lay { namespace lay {
class RubberBox; class RubberBox;
class LayoutView; class LayoutViewBase;
class LayoutCanvas; class LayoutCanvas;
class LAYBASIC_PUBLIC SelectionService class LAYBASIC_PUBLIC SelectionService :
: public QObject, #if defined (HAVE_QT)
public QObject,
#endif
public lay::ViewService public lay::ViewService
{ {
#if defined (HAVE_QT)
Q_OBJECT Q_OBJECT
#endif
public: public:
SelectionService (lay::LayoutView *view); SelectionService (lay::LayoutViewBase *view);
~SelectionService (); ~SelectionService ();
void set_colors (lay::Color background, lay::Color color); void set_colors (lay::Color background, lay::Color color);
@ -72,8 +78,10 @@ public:
*/ */
void hover_reset (); void hover_reset ();
#if defined (HAVE_QT)
public slots: public slots:
void timeout (); void timeout ();
#endif
private: private:
virtual void deactivated (); virtual void deactivated ();
@ -84,11 +92,13 @@ private:
lay::RubberBox *mp_box; lay::RubberBox *mp_box;
unsigned int m_color; unsigned int m_color;
unsigned int m_buttons; unsigned int m_buttons;
QTimer m_timer;
bool m_hover; bool m_hover;
bool m_hover_wait; bool m_hover_wait;
db::DPoint m_hover_point; db::DPoint m_hover_point;
bool m_mouse_in_window; bool m_mouse_in_window;
#if defined (HAVE_QT)
QTimer m_timer;
#endif
void reset_box (); void reset_box ();
}; };

View File

@ -30,7 +30,7 @@
namespace lay namespace lay
{ {
class LayoutView; class LayoutViewBase;
class LayoutCanvas; class LayoutCanvas;
class RubberBox; class RubberBox;
@ -38,7 +38,7 @@ class LAYBASIC_PUBLIC ZoomService
: public lay::ViewService : public lay::ViewService
{ {
public: public:
ZoomService (lay::LayoutView *view); ZoomService (lay::LayoutViewBase *view);
~ZoomService (); ~ZoomService ();
void set_colors (lay::Color background, lay::Color text); void set_colors (lay::Color background, lay::Color text);
@ -55,7 +55,7 @@ private:
db::DPoint m_p1, m_p2; db::DPoint m_p1, m_p2;
db::DBox m_vp; db::DBox m_vp;
lay::LayoutView *mp_view; lay::LayoutViewBase *mp_view;
lay::RubberBox *mp_box; lay::RubberBox *mp_box;
unsigned int m_color; unsigned int m_color;
}; };

View File

@ -273,6 +273,7 @@ SOURCES += \
layStipplePalette.cc \ layStipplePalette.cc \
layStream.cc \ layStream.cc \
layCanvasPlane.cc \ layCanvasPlane.cc \
layLayoutViewBase.cc \
layLayerProperties.cc \ layLayerProperties.cc \
layViewObject.cc \ layViewObject.cc \
layViewOp.cc \ layViewOp.cc \
@ -289,6 +290,7 @@ HEADERS += \
layEditable.h \ layEditable.h \
layFinder.h \ layFinder.h \
layFixedFont.h \ layFixedFont.h \
layLayoutViewBase.h \
layLineStylePalette.h \ layLineStylePalette.h \
layLineStyles.h \ layLineStyles.h \
layMarker.h \ layMarker.h \