* The builder of the frame.
* @since 3.0
*/
private void buildFrame(final MProgressBar progressBar) {
final LCanvas canvas = getCanvas();
final IDrawing drawing = getDrawing();
tabbedPanel = new MTabbedPane(true);
layeredPanel = new MLayeredPane(false, false);
layeredPanel.add(canvas.getScrollpane(), JLayeredPane.DEFAULT_LAYER);
layeredPanel.addComponentsToResize(canvas.getScrollpane());
if(progressBar!=null)
progressBar.addToProgressBar(5);
/* Creation of the rulers. */
yScaleRuler = new YScaleRuler(canvas);
xScaleRuler = new XScaleRuler(canvas, yScaleRuler);
if(progressBar!=null)
progressBar.addToProgressBar(5);
/* Initialisation of the mapping between the model and the canvas. */
MappingRegistry.REGISTRY.addMapping(new ShapeList2ViewListMapping(drawing.getShapes(), canvas.getViews(), canvas.getBorderInstrument()));
MappingRegistry.REGISTRY.addMapping(new Drawing2CanvasMapping(drawing, canvas));
MappingRegistry.REGISTRY.addMapping(new Selection2BorderMapping(drawing.getSelection().getShapes(), canvas.getBorderInstrument()));
MappingRegistry.REGISTRY.addMapping(new Zoom2ScaleRuler(canvas.getZoomUnary(), xScaleRuler));
MappingRegistry.REGISTRY.addMapping(new Zoom2ScaleRuler(canvas.getZoomUnary(), yScaleRuler));
MappingRegistry.REGISTRY.addMapping(new Unit2ScaleRuler(ScaleRuler.getUnitSingleton(), xScaleRuler));
MappingRegistry.REGISTRY.addMapping(new Unit2ScaleRuler(ScaleRuler.getUnitSingleton(), yScaleRuler));
if(progressBar!=null)
progressBar.addToProgressBar(5);
// Initialisation of the status bar.
statusBar = new JLabel("");//$NON-NLS-1$
// statusBar.setEditable(false);
/* Creation of the instruments. */
instantiateInstruments(canvas, drawing);
if(progressBar!=null)
progressBar.addToProgressBar(15);
textSetter.setPencil(pencil);
MappingRegistry.REGISTRY.addMapping(new ShapeList2ExporterMapping(drawing.getShapes(), exporter));
MappingRegistry.REGISTRY.addMapping(new Selection2MetaCustumiserMapping(drawing.getSelection().getShapes(), metaShapeCustomiser));
MappingRegistry.REGISTRY.addMapping(new Selection2DeleterMapping(drawing.getSelection().getShapes(), deleter));
MappingRegistry.REGISTRY.addMapping(new Selection2TemplateManager(drawing.getSelection().getShapes(), templateManager));
if(progressBar!=null)
progressBar.addToProgressBar(5);
try{setIconImage(LResources.LATEXDRAW_ICON.getImage());}catch(final Exception ex){BadaboomCollector.INSTANCE.add(ex);}