Browse Source

Add window:: namespace.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
f25a17075c
17 changed files with 39 additions and 27 deletions
  1. +5
    -5
      adapters/standalone.cpp
  2. +5
    -1
      include/context.hpp
  3. +2
    -1
      include/rack.hpp
  4. +1
    -1
      include/widget/Widget.hpp
  5. +7
    -2
      include/window.hpp
  6. +4
    -4
      src/app/LedDisplay.cpp
  7. +1
    -1
      src/app/MenuBar.cpp
  8. +1
    -1
      src/app/PortWidget.cpp
  9. +1
    -1
      src/app/RackScrollWidget.cpp
  10. +1
    -1
      src/context.cpp
  11. +1
    -1
      src/gamepad.cpp
  12. +1
    -1
      src/keyboard.cpp
  13. +1
    -1
      src/library.cpp
  14. +1
    -1
      src/settings.cpp
  15. +1
    -1
      src/ui/Scrollbar.cpp
  16. +1
    -1
      src/widget/event.cpp
  17. +5
    -3
      src/window.cpp

+ 5
- 5
adapters/standalone.cpp View File

@@ -13,7 +13,7 @@
#include <app/Scene.hpp>
#include <plugin.hpp>
#include <context.hpp>
#include <Window.hpp>
#include <window.hpp>
#include <patch.hpp>
#include <history.hpp>
#include <ui/common.hpp>
@@ -179,7 +179,7 @@ int main(int argc, char* argv[]) {
discord::init();
if (!settings::headless) {
ui::init();
windowInit();
window::init();
}

// Initialize context
@@ -192,7 +192,7 @@ int main(int argc, char* argv[]) {
APP->event->rootWidget = APP->scene;
APP->patch = new PatchManager;
if (!settings::headless) {
APP->window = new Window;
APP->window = new window::Window;
}

// On Mac, use a hacked-in GLFW addition to get the launched path.
@@ -234,7 +234,7 @@ int main(int argc, char* argv[]) {
// delete APP->window;
// APP->window = NULL;
// INFO("Re-creating window");
// APP->window = new Window;
// APP->window = new window::Window;
// APP->window->run();
}

@@ -252,7 +252,7 @@ int main(int argc, char* argv[]) {
// Destroy environment
INFO("Destroying environment");
if (!settings::headless) {
windowDestroy();
window::destroy();
ui::destroy();
}
discord::destroy();


+ 5
- 1
include/context.hpp View File

@@ -15,7 +15,11 @@ struct Engine;
} // namespace engine


namespace window {
struct Window;
} // namespace window


struct PatchManager;


@@ -35,7 +39,7 @@ struct Context {
widget::EventState* event = NULL;
app::Scene* scene = NULL;
engine::Engine* engine = NULL;
Window* window = NULL;
window::Window* window = NULL;
history::State* history = NULL;
PatchManager* patch = NULL;



+ 2
- 1
include/rack.hpp View File

@@ -9,7 +9,7 @@
#include <random.hpp>
#include <network.hpp>
#include <asset.hpp>
#include <Window.hpp>
#include <window.hpp>
#include <context.hpp>
#include <midi.hpp>
#include <settings.hpp>
@@ -114,6 +114,7 @@ namespace rack {
// Import some namespaces for convenience
using namespace logger;
using namespace math;
using namespace window;
using namespace widget;
using namespace ui;
using namespace app;


+ 1
- 1
include/widget/Widget.hpp View File

@@ -3,7 +3,7 @@

#include <common.hpp>
#include <math.hpp>
#include <Window.hpp>
#include <window.hpp>
#include <color.hpp>
#include <widget/event.hpp>
#include <weakptr.hpp>


include/Window.hpp → include/window.hpp View File

@@ -19,10 +19,12 @@


namespace rack {
namespace window {


// Constructing these directly will load from the disk each time. Use the load() functions to load from disk and cache them as long as the shared_ptr is held.

/** Text font loaded in a particular Window context. */
struct Font {
NVGcontext* vg;
int handle = -1;
@@ -33,6 +35,8 @@ struct Font {
DEPRECATED static std::shared_ptr<Font> load(const std::string& filename);
};


/** Bitmap/raster image loaded in a particular Window context. */
struct Image {
NVGcontext* vg;
int handle = -1;
@@ -99,8 +103,9 @@ struct Window {
};


void windowInit();
void windowDestroy();
void init();
void destroy();


} // namespace window
} // namespace rack

+ 4
- 4
src/app/LedDisplay.cpp View File

@@ -1,6 +1,6 @@
#include <app/LedDisplay.hpp>
#include <asset.hpp>
#include <Window.hpp>
#include <window.hpp>
#include <context.hpp>


@@ -53,7 +53,7 @@ void LedDisplayChoice::draw(const DrawArgs& args) {
nvgFill(args.vg);
}

std::shared_ptr<Font> font = APP->window->loadFont(fontPath);
std::shared_ptr<window::Font> font = APP->window->loadFont(fontPath);
nvgGlobalAlpha(args.vg, 1.0);
if (font && font->handle >= 0) {
nvgFillColor(args.vg, color);
@@ -98,7 +98,7 @@ void LedDisplayTextField::draw(const DrawArgs& args) {
}

// Text
std::shared_ptr<Font> font = APP->window->loadFont(fontPath);
std::shared_ptr<window::Font> font = APP->window->loadFont(fontPath);
nvgGlobalAlpha(args.vg, 1.0);
if (font && font->handle >= 0) {
bndSetFont(font->handle);
@@ -120,7 +120,7 @@ void LedDisplayTextField::draw(const DrawArgs& args) {


int LedDisplayTextField::getTextPosition(math::Vec mousePos) {
std::shared_ptr<Font> font = APP->window->loadFont(fontPath);
std::shared_ptr<window::Font> font = APP->window->loadFont(fontPath);
if (!font || !font->handle)
return 0;



+ 1
- 1
src/app/MenuBar.cpp View File

@@ -16,7 +16,7 @@
#include <ui/ProgressBar.hpp>
#include <ui/Label.hpp>
#include <engine/Engine.hpp>
#include <Window.hpp>
#include <window.hpp>
#include <asset.hpp>
#include <context.hpp>
#include <settings.hpp>


+ 1
- 1
src/app/PortWidget.cpp View File

@@ -1,6 +1,6 @@
#include <app/PortWidget.hpp>
#include <app/Scene.hpp>
#include <Window.hpp>
#include <window.hpp>
#include <context.hpp>
#include <history.hpp>
#include <engine/Engine.hpp>


+ 1
- 1
src/app/RackScrollWidget.cpp View File

@@ -1,6 +1,6 @@
#include <app/RackScrollWidget.hpp>
#include <app/Scene.hpp>
#include <Window.hpp>
#include <window.hpp>
#include <context.hpp>
#include <settings.hpp>



+ 1
- 1
src/context.cpp View File

@@ -1,5 +1,5 @@
#include <context.hpp>
#include <Window.hpp>
#include <window.hpp>
#include <patch.hpp>
#include <engine/Engine.hpp>
#include <app/Scene.hpp>


+ 1
- 1
src/gamepad.cpp View File

@@ -1,7 +1,7 @@
#include <gamepad.hpp>
#include <midi.hpp>
#include <string.hpp>
#include <Window.hpp>
#include <window.hpp>


namespace rack {


+ 1
- 1
src/keyboard.cpp View File

@@ -2,7 +2,7 @@

#include <keyboard.hpp>
#include <midi.hpp>
#include <Window.hpp>
#include <window.hpp>


namespace rack {


+ 1
- 1
src/library.cpp View File

@@ -8,7 +8,7 @@
#include <network.hpp>
#include <system.hpp>
#include <context.hpp>
#include <Window.hpp>
#include <window.hpp>
#include <asset.hpp>
#include <settings.hpp>
#include <plugin.hpp>


+ 1
- 1
src/settings.cpp View File

@@ -1,7 +1,7 @@
#include <jansson.h>

#include <settings.hpp>
#include <Window.hpp>
#include <window.hpp>
#include <plugin.hpp>
#include <app/Scene.hpp>
#include <engine/Engine.hpp>


+ 1
- 1
src/ui/Scrollbar.cpp View File

@@ -1,7 +1,7 @@
#include <ui/Scrollbar.hpp>
#include <ui/ScrollWidget.hpp>
#include <context.hpp>
#include <Window.hpp>
#include <window.hpp>


namespace rack {


+ 1
- 1
src/widget/event.cpp View File

@@ -1,7 +1,7 @@
#include <widget/event.hpp>
#include <widget/Widget.hpp>
#include <context.hpp>
#include <Window.hpp>
#include <window.hpp>
#include <system.hpp>




src/Window.cpp → src/window.cpp View File

@@ -10,7 +10,7 @@
#include <stb_image_write.h>
#include <osdialog.h>

#include <Window.hpp>
#include <window.hpp>
#include <asset.hpp>
#include <widget/Widget.hpp>
#include <app/Scene.hpp>
@@ -24,6 +24,7 @@


namespace rack {
namespace window {


static const math::Vec minWindowSize = math::Vec(640, 480);
@@ -722,7 +723,7 @@ bool& Window::fbDirtyOnSubpixelChange() {
}


void windowInit() {
void init() {
int err;

// Set up GLFW
@@ -740,9 +741,10 @@ void windowInit() {
}


void windowDestroy() {
void destroy() {
glfwTerminate();
}


} // namespace window
} // namespace rack

Loading…
Cancel
Save