Browse Source

Clean up doc comments.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
90c43226cd
7 changed files with 36 additions and 25 deletions
  1. +2
    -1
      include/plugin/Plugin.hpp
  2. +7
    -3
      include/widget/Widget.hpp
  3. +2
    -3
      include/widget/ZoomWidget.hpp
  4. +7
    -5
      include/window/Window.hpp
  5. +2
    -2
      src/app/RackWidget.cpp
  6. +5
    -0
      src/widget/ZoomWidget.cpp
  7. +11
    -11
      src/window/Window.cpp

+ 2
- 1
include/plugin/Plugin.hpp View File

@@ -30,7 +30,8 @@ struct Plugin {
To guarantee uniqueness, it is a good idea to prefix the slug by your "company name" if available, e.g. "MyCompany-MyPlugin"
*/
std::string slug;
/** Your plugin's latest version, using the guidelines at https://github.com/VCVRack/Rack/issues/266. Do not include the "v" prefix.
/** Your plugin's latest version.
Do not include the "v" prefix.
*/
std::string version;
/** The license type of your plugin. Use "proprietary" if all rights are reserved. If your license is in the [SPDX license list](https://spdx.org/licenses/), use its abbreviation in the "Identifier" column.


+ 7
- 3
include/widget/Widget.hpp View File

@@ -19,14 +19,18 @@ The bounding box of a Widget is a rectangle specified by `box` relative to their
The appearance is defined by overriding `draw()`, and the behavior is defined by overriding `step()` and `on*()` event handlers.
*/
struct Widget : WeakBase {
/** Stores position and size */
/** Position relative to parent and size of widget. */
math::Rect box = math::Rect(math::Vec(), math::Vec(INFINITY, INFINITY));
/** Automatically set when Widget is added as a child to another Widget */
Widget* parent = NULL;
std::list<Widget*> children;
/** Disables rendering but allow stepping */
/** Disables rendering but allow stepping.
Use isVisible(), setVisible(), show(), or hide() instead of using this variable directly.
*/
bool visible = true;
/** If set to true, parent will delete Widget in the next step() */
/** If set to true, parent will delete Widget in the next step().
Use requestDelete() instead of using this variable directly.
*/
bool requestedDelete = false;

virtual ~Widget();


+ 2
- 3
include/widget/ZoomWidget.hpp View File

@@ -8,15 +8,14 @@ namespace widget {

/** A Widget with a dynamic zoom level. */
struct ZoomWidget : Widget {
/** Use setZoom() and getZoom() instead of using this variable directly. */
float zoom = 1.f;

math::Vec getRelativeOffset(math::Vec v, Widget* ancestor) override;
float getRelativeZoom(Widget* ancestor) override;
math::Rect getViewport(math::Rect r) override;
float getZoom();
void setZoom(float zoom);
float getZoom() {
return zoom;
}
void draw(const DrawArgs& args) override;
void drawLayer(const DrawArgs& args, int layer) override;



+ 7
- 5
include/window/Window.hpp View File

@@ -29,9 +29,10 @@ namespace window {
struct Font {
NVGcontext* vg;
int handle = -1;

~Font();
/** Don't call this directly but instead use `APP->window->loadFont()` */
void loadFile(const std::string& filename, NVGcontext* vg);
~Font();
/** Use `APP->window->loadFont()` instead. */
DEPRECATED static std::shared_ptr<Font> load(const std::string& filename);
};
@@ -41,9 +42,10 @@ struct Font {
struct Image {
NVGcontext* vg;
int handle = -1;

~Image();
/** Don't call this directly but instead use `APP->window->loadImage()` */
void loadFile(const std::string& filename, NVGcontext* vg);
~Image();
/** Use `APP->window->loadImage()` instead. */
DEPRECATED static std::shared_ptr<Image> load(const std::string& filename);
};
@@ -57,10 +59,10 @@ struct Window {
GLFWwindow* win = NULL;
NVGcontext* vg = NULL;
NVGcontext* fbVg = NULL;
/** The scaling ratio */
/** UI scaling ratio */
float pixelRatio = 1.f;
/* The ratio between the framebuffer size and the window size reported by the OS.
This is not equal to gPixelRatio in general.
/** Ratio between the framebuffer size and the window size reported by the OS.
This is not equal to pixelRatio in general.
*/
float windowRatio = 1.f;
std::shared_ptr<Font> uiFont;


+ 2
- 2
src/app/RackWidget.cpp View File

@@ -1414,9 +1414,9 @@ NVGcolor RackWidget::getNextCableColor() {
return color::WHITE;

int id = internal->nextCableColorId++;
if (id >= settings::cableColors.size())
if (id >= (int) settings::cableColors.size())
id = 0;
if (internal->nextCableColorId >= settings::cableColors.size())
if (internal->nextCableColorId >= (int) settings::cableColors.size())
internal->nextCableColorId = 0;
return settings::cableColors[id];
}


+ 5
- 0
src/widget/ZoomWidget.cpp View File

@@ -27,6 +27,11 @@ math::Rect ZoomWidget::getViewport(math::Rect r) {
}


float ZoomWidget::getZoom() {
return zoom;
}


void ZoomWidget::setZoom(float zoom) {
if (zoom == this->zoom)
return;


+ 11
- 11
src/window/Window.cpp View File

@@ -30,6 +30,11 @@ namespace window {
static const math::Vec WINDOW_SIZE_MIN = math::Vec(480, 320);


Font::~Font() {
// There is no NanoVG deleteFont() function yet, so do nothing
}


void Font::loadFile(const std::string& filename, NVGcontext* vg) {
this->vg = vg;
handle = nvgCreateFont(vg, filename.c_str(), filename.c_str());
@@ -39,13 +44,15 @@ void Font::loadFile(const std::string& filename, NVGcontext* vg) {
}


Font::~Font() {
// There is no NanoVG deleteFont() function yet, so do nothing
std::shared_ptr<Font> Font::load(const std::string& filename) {
return APP->window->loadFont(filename);
}


std::shared_ptr<Font> Font::load(const std::string& filename) {
return APP->window->loadFont(filename);
Image::~Image() {
// TODO What if handle is invalid?
if (handle >= 0)
nvgDeleteImage(vg, handle);
}


@@ -58,13 +65,6 @@ void Image::loadFile(const std::string& filename, NVGcontext* vg) {
}


Image::~Image() {
// TODO What if handle is invalid?
if (handle >= 0)
nvgDeleteImage(vg, handle);
}


std::shared_ptr<Image> Image::load(const std::string& filename) {
return APP->window->loadImage(filename);
}


Loading…
Cancel
Save