Refactoring Ideas

From Avogadro - Free cross-platform molecule editor

Jump to: navigation, search

This page contains some ideas about future refactorization of libavogadro. They may seriously break ABI (and possibly API), and should be discussed

Contents

Rendering Widget

Fix: multiple inheritance for QWidgets is tricky. Another variant of design:

Renderer - ADT, doesn't inherit anything from Qt.
      Contains generic functionality like access methods, PainterDevice access, no signals/slots.
GLWidget : public Renderer, public QGLWidget
GL2Widget etc. ananlogically
SimpleRenderWidget : public Renderer, public QGraphicsView
AvogadroWidget - inherits QWidget, is directly used in UI of external client. 
      Contains pointer RenderWidget* to one chosen renderer, can switch them, can load RenderWidget* from plugin

Note: Of course, GL only engines can exist for some specific purposes (maybe Cartoon, Ring), but such GL tasks as setting fg color, drawing eyecandy, GL_RESCALE_NORMAL, GL_NORMALIZE should be encapsulated into renderer.

PlotWidget

Modularization of libavogadro

Libavogadro contains a lot of APIs for different purposes and tends to grow. I propose to divide it into several modules (as Qt did when moving to Qt4)

For compatibility with previous versions, monolithic libavogadro library is provided

AvogadroCore (done)

Generic classes which could be used even by terminal applications to simplify access to OB and make some advanced operations with molecules.

Atom
Bond
Cube
Fragment
IDList
Mesh
MeshGenerator
Molecule
MoleculeFile
NeighborList (?)
Primitive
PrimitiveList
Protein (?)
Residue
ZMatrix 

AvogadroWidget

(partially done - didn't separate it from Python yet)

Rendering of molecules in external apps (including Avogadro). Static ("core") engine/tools also go here.

Since it's intended to be easy-to-use Qt widget, Designer plugin will be desired.

Animation
Camera
Color3f
ColorButton (?)
Cylinder_p
GLHit
GLPainter_p
GLWidget
Navigate
Painter
PainterDevice
UndoSequence

Color
Engine
Extension
DockExtension
Tool
ToolGroup

Also, it's needed to create class AvogadroWidget which will allow to choose what subclass of RenderWidget is used

AvogadroPython

Everything Python-related

pythonengine
pythonerror
pythonextension_p
pythoninterpreter
pythonscript
pythonthread_p
pythontool_p

QPeriodicTable (done)

ElementDetail
ElementItem
ElementTranslator
PeriodicTableScene
PeriodicTableView

QPlotWidget (done)

plotaxis
plotobject
plotpoint
plotwidget
basisset
molpro 
mopacaux
gaussianfchk

If you think 3 latter modules are too small, they could be merged in one, e.g. AvogadroExtra. However, see my proposition about plotwidget before. Also, there are a lot of types of basis sets. Periodic table could run as standalone application (there's gelemental though)

Source Tree

Current source tree is very complicated and "overpopulated". Extensions directory looks like a dump.

Of course, everything could be built together as superpackage

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox