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
+5 -5
View File
@@ -46,7 +46,7 @@
namespace lay
{
class LayoutView;
class LayoutViewBase;
/**
* @brief A layout handle
@@ -581,7 +581,7 @@ public:
* @param cv The reference to the target cellview
* @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
@@ -590,9 +590,9 @@ public:
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
@@ -749,7 +749,7 @@ public:
private:
tl::weak_ptr<lay::CellView> mp_cv;
tl::weak_ptr<lay::LayoutView> mp_view;
tl::weak_ptr<lay::LayoutViewBase> mp_view;
};
}
+12 -15
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 ()
{
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
Dispatcher::configure (const std::string &name, const std::string &value)
{
+5 -21
View File
@@ -121,17 +121,6 @@ public:
*/
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
*
@@ -139,16 +128,6 @@ public:
*/
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
*/
@@ -233,6 +212,11 @@ public:
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
*/
+15 -15
View File
@@ -22,7 +22,7 @@
#include "layLayerProperties.h"
#include "layLayoutView.h"
#include "layLayoutViewBase.h"
#include "layConverters.h"
#include "tlXMLParser.h"
#include "tlException.h"
@@ -404,7 +404,7 @@ class LayerSourceEval
: public tl::Eval
{
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)
{
// .. nothing yet ..
@@ -415,14 +415,14 @@ public:
return m_lp.source (m_real);
}
const lay::LayoutView *view () const
const lay::LayoutViewBase *view () const
{
return mp_view;
}
private:
const lay::LayerProperties &m_lp;
const lay::LayoutView *mp_view;
const lay::LayoutViewBase *mp_view;
bool m_real;
};
@@ -480,7 +480,7 @@ private:
};
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 ();
@@ -592,7 +592,7 @@ LayerProperties::need_realize (unsigned int flags, bool /*force*/)
}
void
LayerProperties::do_realize (const LayoutView *view) const
LayerProperties::do_realize (const LayoutViewBase *view) const
{
m_layer_index = -1;
m_cellview_index = -1;
@@ -712,10 +712,10 @@ LayerPropertiesNode::operator== (const LayerPropertiesNode &d) const
return m_children == d.m_children;
}
LayoutView *
LayoutViewBase *
LayerPropertiesNode::view () const
{
return const_cast<lay::LayoutView *> (mp_view.get ());
return const_cast<lay::LayoutViewBase *> (mp_view.get ());
}
unsigned int
@@ -804,7 +804,7 @@ LayerPropertiesNode::bbox () const
}
void
LayerPropertiesNode::attach_view (LayoutView *view, unsigned int list_index)
LayerPropertiesNode::attach_view (LayoutViewBase *view, unsigned int list_index)
{
mp_view.reset (view);
m_list_index = list_index;
@@ -1335,7 +1335,7 @@ static LayerPropertiesNode expand_wildcard_layout (const LayerPropertiesNode &so
}
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;
@@ -1651,7 +1651,7 @@ struct UIntColorConverter
if (c == 0) {
return "";
} 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 ()) {
c = 0;
} else {
QColor qc;
lay::Color qc;
ColorConverter::from_string (s, qc);
c = qc.rgb () | 0xff000000;
}
@@ -1858,7 +1858,7 @@ LayerPropertiesList::save (tl::OutputStream &os, const std::vector <lay::LayerPr
}
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);
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
{
return const_cast<lay::LayoutView *> (mp_view.get ());
return const_cast<lay::LayoutViewBase *> (mp_view.get ());
}
unsigned int
+11 -11
View File
@@ -48,7 +48,7 @@ namespace tl {
namespace lay {
class LayoutView;
class LayoutViewBase;
class LayerPropertiesList;
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
* 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
@@ -717,7 +717,7 @@ public:
*
* This method may throw an exception if the specification
* 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);
@@ -725,7 +725,7 @@ public:
* @brief Load the source specification
*
* 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);
@@ -887,7 +887,7 @@ protected:
*
* @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
@@ -1172,12 +1172,12 @@ public:
* compute the actual property selection set.
* 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
*/
LayoutView *view () const;
LayoutViewBase *view () const;
/**
* @brief Gets the index of the layer properties list that node lives in
@@ -1214,7 +1214,7 @@ protected:
private:
// A reference to the view
tl::weak_ptr<lay::LayoutView> mp_view;
tl::weak_ptr<lay::LayoutViewBase> mp_view;
unsigned int m_list_index;
// the parent node
tl::weak_ptr<LayerPropertiesNode> mp_parent;
@@ -1912,12 +1912,12 @@ public:
* "load" automatically attaches the view.
* 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
*/
lay::LayoutView *view () const;
lay::LayoutViewBase *view () const;
/**
* @brief Gets the layout list
@@ -1925,7 +1925,7 @@ public:
unsigned int list_index () const;
private:
tl::weak_ptr<lay::LayoutView> mp_view;
tl::weak_ptr<lay::LayoutViewBase> mp_view;
unsigned int m_list_index;
layer_list m_layer_properties;
lay::DitherPattern m_dither_pattern;
+18 -12
View File
@@ -47,7 +47,7 @@
namespace lay
{
class LayoutView;
class LayoutViewBase;
class RedrawThread;
/**
@@ -138,10 +138,16 @@ class LayoutCanvas
public lay::BitmapRedrawThreadCanvas,
public lay::Drawings
{
#if defined(HAVE_QT)
Q_OBJECT
#endif
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 ();
void set_colors (lay::Color background, lay::Color foreground, lay::Color active);
@@ -341,18 +347,18 @@ public:
*/
tl::Event viewport_changed_event;
signals:
void left_arrow_key_pressed ();
void up_arrow_key_pressed ();
void right_arrow_key_pressed ();
void down_arrow_key_pressed ();
void left_arrow_key_pressed_with_shift ();
void up_arrow_key_pressed_with_shift ();
void right_arrow_key_pressed_with_shift ();
void down_arrow_key_pressed_with_shift ();
// key events
tl::Event left_arrow_key_pressed;
tl::Event up_arrow_key_pressed;
tl::Event right_arrow_key_pressed;
tl::Event down_arrow_key_pressed;
tl::Event left_arrow_key_pressed_with_shift;
tl::Event up_arrow_key_pressed_with_shift;
tl::Event right_arrow_key_pressed_with_shift;
tl::Event down_arrow_key_pressed_with_shift;
private:
lay::LayoutView *mp_view;
lay::LayoutViewBase *mp_view;
QImage *mp_image;
QImage *mp_image_bg;
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
+3 -3
View File
@@ -31,17 +31,17 @@ class QMouseEvent;
namespace lay {
class LayoutCanvas;
class LayoutView;
class LayoutViewBase;
class MouseTracker
: public lay::ViewService
{
public:
MouseTracker (lay::LayoutView *view);
MouseTracker (lay::LayoutViewBase *view);
virtual bool mouse_move_event (const db::DPoint &p, unsigned int buttons, bool prio);
private:
lay::LayoutView *mp_view;
lay::LayoutViewBase *mp_view;
};
}
+4 -12
View File
@@ -20,32 +20,24 @@
*/
#ifndef HDR_layMove
#define HDR_layMove
#include "dbManager.h"
#include "layViewObject.h"
#include <QTimer>
#include <QObject>
#include <memory>
namespace lay {
class Editables;
class LayoutView;
class LayoutViewBase;
class MoveService
: public QObject,
class MoveService :
public lay::ViewService
{
Q_OBJECT
public:
MoveService (lay::LayoutView *view);
MoveService (lay::LayoutViewBase *view);
~MoveService ();
virtual bool configure (const std::string &name, const std::string &value);
@@ -67,7 +59,7 @@ private:
bool m_dragging;
bool m_dragging_transient;
lay::Editables *mp_editables;
lay::LayoutView *mp_view;
lay::LayoutViewBase *mp_view;
double m_global_grid;
db::DPoint m_shift;
db::DPoint m_mouse_pos;
@@ -22,7 +22,7 @@
#include "layParsedLayerSource.h"
#include "layLayoutView.h"
#include "layLayoutViewBase.h"
#include "tlString.h"
#include "tlGlobPattern.h"
@@ -1163,7 +1163,7 @@ ParsedLayerSource::to_string () const
}
std::string
ParsedLayerSource::display_string (const lay::LayoutView *view) const
ParsedLayerSource::display_string (const lay::LayoutViewBase *view) const
{
std::string r;
+2 -2
View File
@@ -43,7 +43,7 @@ namespace lay
{
class LayerProperties;
class LayoutView;
class LayoutViewBase;
class PropertySelectorBase;
/**
@@ -640,7 +640,7 @@ public:
* This method delivers a display version that may be abbreviated and is supposed
* 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)
+5 -5
View File
@@ -48,7 +48,7 @@ namespace lay
class Plugin;
class Dispatcher;
class LayoutView;
class LayoutViewBase;
class ViewService;
class Editable;
class Drawing;
@@ -302,7 +302,7 @@ public:
* This method may return 0 for "dummy" plugins that just register menu entries
* 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;
}
@@ -329,7 +329,7 @@ public:
*
* 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 ..
}
@@ -351,8 +351,8 @@ public:
/**
* @brief Specifies the primary mouse modes
*
* These are built-in modes from the LayoutView. This method is intended for
* the LayoutView's standard modes only.
* These are built-in modes from the LayoutViewBase. This method is intended for
* the LayoutViewBase's standard modes only.
*/
virtual void implements_primary_mouse_modes (std::vector<std::pair<std::string, std::pair<std::string, int> > > & /*modes*/)
{
+17 -7
View File
@@ -30,23 +30,29 @@
#include "layViewObject.h"
#include "layEditable.h"
#include <QTimer>
#include <QObject>
#if defined (HAVE_QT)
# include <QTimer>
# include <QObject>
#endif
namespace lay {
class RubberBox;
class LayoutView;
class LayoutViewBase;
class LayoutCanvas;
class LAYBASIC_PUBLIC SelectionService
: public QObject,
class LAYBASIC_PUBLIC SelectionService :
#if defined (HAVE_QT)
public QObject,
#endif
public lay::ViewService
{
#if defined (HAVE_QT)
Q_OBJECT
#endif
public:
SelectionService (lay::LayoutView *view);
SelectionService (lay::LayoutViewBase *view);
~SelectionService ();
void set_colors (lay::Color background, lay::Color color);
@@ -72,8 +78,10 @@ public:
*/
void hover_reset ();
#if defined (HAVE_QT)
public slots:
void timeout ();
#endif
private:
virtual void deactivated ();
@@ -84,11 +92,13 @@ private:
lay::RubberBox *mp_box;
unsigned int m_color;
unsigned int m_buttons;
QTimer m_timer;
bool m_hover;
bool m_hover_wait;
db::DPoint m_hover_point;
bool m_mouse_in_window;
#if defined (HAVE_QT)
QTimer m_timer;
#endif
void reset_box ();
};
+3 -3
View File
@@ -30,7 +30,7 @@
namespace lay
{
class LayoutView;
class LayoutViewBase;
class LayoutCanvas;
class RubberBox;
@@ -38,7 +38,7 @@ class LAYBASIC_PUBLIC ZoomService
: public lay::ViewService
{
public:
ZoomService (lay::LayoutView *view);
ZoomService (lay::LayoutViewBase *view);
~ZoomService ();
void set_colors (lay::Color background, lay::Color text);
@@ -55,7 +55,7 @@ private:
db::DPoint m_p1, m_p2;
db::DBox m_vp;
lay::LayoutView *mp_view;
lay::LayoutViewBase *mp_view;
lay::RubberBox *mp_box;
unsigned int m_color;
};
+2
View File
@@ -273,6 +273,7 @@ SOURCES += \
layStipplePalette.cc \
layStream.cc \
layCanvasPlane.cc \
layLayoutViewBase.cc \
layLayerProperties.cc \
layViewObject.cc \
layViewOp.cc \
@@ -289,6 +290,7 @@ HEADERS += \
layEditable.h \
layFinder.h \
layFixedFont.h \
layLayoutViewBase.h \
layLineStylePalette.h \
layLineStyles.h \
layMarker.h \