1 /*
2   ==============================================================================
3 
4    This file is part of the JUCE library.
5    Copyright (c) 2020 - Raw Material Software Limited
6 
7    JUCE is an open source library subject to commercial or open-source
8    licensing.
9 
10    By using JUCE, you agree to the terms of both the JUCE 6 End-User License
11    Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
12 
13    End User License Agreement: www.juce.com/juce-6-licence
14    Privacy Policy: www.juce.com/juce-privacy-policy
15 
16    Or: You may also use this code under the terms of the GPL v3 (see
17    www.gnu.org/licenses).
18 
19    JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20    EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21    DISCLAIMED.
22 
23   ==============================================================================
24 */
25 
26 #pragma once
27 
28 #include "../jucer_JucerDocument.h"
29 #include "jucer_ComponentLayoutEditor.h"
30 class LayoutPropsPanel;
31 
32 //==============================================================================
33 /**
34     Base class for the layout and graphics panels - this takes care of arranging
35     the properties panel and managing the viewport for the content.
36 
37 */
38 class EditingPanelBase  : public Component
39 {
40 public:
41     //==============================================================================
42     EditingPanelBase (JucerDocument& document,
43                       Component* propsPanel,
44                       Component* editorComp);
45 
46     ~EditingPanelBase() override;
47 
48     //==============================================================================
49     void resized() override;
50     void paint (Graphics& g) override;
51     void visibilityChanged() override;
52 
53     virtual void updatePropertiesList() = 0;
54 
55     virtual Rectangle<int> getComponentArea() const = 0;
56 
57     double getZoom() const;
58     void setZoom (double newScale);
59     void setZoom (double newScale, int anchorX, int anchorY);
60 
61     // convert a pos relative to this component into a pos on the editor
62     void xyToTargetXY (int& x, int& y) const;
63 
64     void dragKeyHeldDown (bool isKeyDown);
65 
66     class MagnifierComponent;
67 
68 protected:
69     JucerDocument& document;
70 
71     Viewport* viewport;
72     MagnifierComponent* magnifier;
73     Component* editor;
74     Component* propsPanel;
75 };
76