Browse Source

Misc cleanup

gh-pages
falkTX 9 years ago
parent
commit
3cab161945
10 changed files with 48 additions and 51 deletions
  1. +1
    -1
      dgl/CairoWidget.hpp
  2. +3
    -3
      dgl/ImageAboutWindow.hpp
  3. +1
    -1
      dgl/ImageButton.hpp
  4. +1
    -1
      dgl/StandaloneWindow.hpp
  5. +5
    -11
      dgl/Widget.hpp
  6. +7
    -7
      dgl/Window.hpp
  7. +9
    -6
      dgl/src/ImageAboutWindow.cpp
  8. +11
    -11
      dgl/src/ImageButton.cpp
  9. +2
    -2
      dgl/src/Widget.cpp
  10. +8
    -8
      dgl/src/Window.cpp

+ 1
- 1
dgl/CairoWidget.hpp View File

@@ -102,7 +102,7 @@ private:
cairoDisplay(fContext);

// get cairo surface data (RGB24)
unsigned char* const surfaceData = cairo_image_surface_get_data(fSurface);
uchar* const surfaceData = cairo_image_surface_get_data(fSurface);

// enable GL texture
glEnable(GL_TEXTURE_RECTANGLE_ARB);


+ 3
- 3
dgl/ImageAboutWindow.hpp View File

@@ -35,15 +35,15 @@ class ImageAboutWindow : public Window,
public Widget
{
public:
ImageAboutWindow(App& app, Window& parent, const Image& image = Image());
ImageAboutWindow(Widget* widget, const Image& image = Image());
explicit ImageAboutWindow(Window& parent, const Image& image = Image());
explicit ImageAboutWindow(Widget* widget, const Image& image = Image());

void setImage(const Image& image);

protected:
void onDisplay() override;
bool onMouse(int button, bool press, int x, int y) override;
bool onKeyboard(bool press, uint32_t key) override;
bool onKeyboard(bool press, uint key) override;

private:
Image fImgBackground;


+ 1
- 1
dgl/ImageButton.hpp View File

@@ -35,8 +35,8 @@ public:
};

ImageButton(Window& parent, const Image& image);
ImageButton(Widget* widget, const Image& image);
ImageButton(Window& parent, const Image& imageNormal, const Image& imageHover, const Image& imageDown);
ImageButton(Widget* widget, const Image& image);
ImageButton(Widget* widget, const Image& imageNormal, const Image& imageHover, const Image& imageDown);
ImageButton(const ImageButton& imageButton);



+ 1
- 1
dgl/StandaloneWindow.hpp View File

@@ -57,7 +57,7 @@ public:
fWindow.setResizable(yesNo);
}

void setSize(unsigned int width, unsigned int height)
void setSize(uint width, uint height)
{
fWindow.setSize(width, height);
}


+ 5
- 11
dgl/Widget.hpp View File

@@ -19,12 +19,6 @@

#include "Geometry.hpp"

#ifdef PROPER_CPP11_SUPPORT
# include <cstdint>
#else
# include <stdint.h>
#endif

START_NAMESPACE_DGL

// -----------------------------------------------------------------------
@@ -35,7 +29,7 @@ class Window;
class Widget
{
public:
Widget(Window& parent);
explicit Widget(Window& parent);
virtual ~Widget();

bool isVisible() const noexcept;
@@ -65,17 +59,17 @@ public:

const Rectangle<int>& getArea() const noexcept;

uint32_t getEventTimestamp();
int getModifiers();
uint getEventTimestamp();
int getModifiers();

App& getParentApp() const noexcept;
App& getParentApp() const noexcept;
Window& getParentWindow() const noexcept;

void repaint();

protected:
virtual void onDisplay() = 0;
virtual bool onKeyboard(bool press, uint32_t key);
virtual bool onKeyboard(bool press, uint key);
virtual bool onMouse(int button, bool press, int x, int y);
virtual bool onMotion(int x, int y);
virtual bool onScroll(int x, int y, float dx, float dy);


+ 7
- 7
dgl/Window.hpp View File

@@ -35,9 +35,9 @@ class Widget;
class Window
{
public:
Window(App& app);
Window(App& app, Window& parent);
Window(App& app, intptr_t parentId);
explicit Window(App& app);
explicit Window(App& app, Window& parent);
explicit Window(App& app, intptr_t parentId);
virtual ~Window();

void show();
@@ -57,15 +57,15 @@ public:
int getWidth() const noexcept;
int getHeight() const noexcept;
Size<int> getSize() const noexcept;
void setSize(unsigned int width, unsigned int height);
void setSize(uint width, uint height);

void setTitle(const char* title);

void setTransientWinId(intptr_t winId);

App& getApp() const noexcept;
uint32_t getEventTimestamp() const;
int getModifiers() const;
App& getApp() const noexcept;
uint getEventTimestamp() const;
int getModifiers() const;
intptr_t getWindowId() const;

private:


+ 9
- 6
dgl/src/ImageAboutWindow.cpp View File

@@ -20,13 +20,13 @@ START_NAMESPACE_DGL

// -----------------------------------------------------------------------

ImageAboutWindow::ImageAboutWindow(App& app, Window& parent, const Image& image)
: Window(app, parent),
ImageAboutWindow::ImageAboutWindow(Window& parent, const Image& image)
: Window(parent.getApp(), parent),
Widget((Window&)*this),
fImgBackground(image)
{
Window::setResizable(false);
Window::setSize(static_cast<unsigned int>(image.getWidth()), static_cast<unsigned int>(image.getHeight()));
Window::setSize(static_cast<uint>(image.getWidth()), static_cast<uint>(image.getHeight()));
Window::setTitle("About");
}

@@ -36,14 +36,17 @@ ImageAboutWindow::ImageAboutWindow(Widget* widget, const Image& image)
fImgBackground(image)
{
Window::setResizable(false);
Window::setSize(static_cast<unsigned int>(image.getWidth()), static_cast<unsigned int>(image.getHeight()));
Window::setSize(static_cast<uint>(image.getWidth()), static_cast<uint>(image.getHeight()));
Window::setTitle("About");
}

void ImageAboutWindow::setImage(const Image& image)
{
if (fImgBackground == image)
return;

fImgBackground = image;
Window::setSize(static_cast<unsigned int>(image.getWidth()), static_cast<unsigned int>(image.getHeight()));
Window::setSize(static_cast<uint>(image.getWidth()), static_cast<uint>(image.getHeight()));
}

void ImageAboutWindow::onDisplay()
@@ -62,7 +65,7 @@ bool ImageAboutWindow::onMouse(int, bool press, int, int)
return false;
}

bool ImageAboutWindow::onKeyboard(bool press, uint32_t key)
bool ImageAboutWindow::onKeyboard(bool press, uint key)
{
if (press && key == CHAR_ESCAPE)
{


+ 11
- 11
dgl/src/ImageButton.cpp View File

@@ -33,17 +33,6 @@ ImageButton::ImageButton(Window& parent, const Image& image)
{
}

ImageButton::ImageButton(Widget* widget, const Image& image)
: Widget(widget->getParentWindow()),
fImageNormal(image),
fImageHover(image),
fImageDown(image),
fCurImage(&fImageNormal),
fCurButton(-1),
fCallback(nullptr)
{
}

ImageButton::ImageButton(Window& parent, const Image& imageNormal, const Image& imageHover, const Image& imageDown)
: Widget(parent),
fImageNormal(imageNormal),
@@ -58,6 +47,17 @@ ImageButton::ImageButton(Window& parent, const Image& imageNormal, const Image&
setSize(fCurImage->getSize());
}

ImageButton::ImageButton(Widget* widget, const Image& image)
: Widget(widget->getParentWindow()),
fImageNormal(image),
fImageHover(image),
fImageDown(image),
fCurImage(&fImageNormal),
fCurButton(-1),
fCallback(nullptr)
{
}

ImageButton::ImageButton(Widget* widget, const Image& imageNormal, const Image& imageHover, const Image& imageDown)
: Widget(widget->getParentWindow()),
fImageNormal(imageNormal),


+ 2
- 2
dgl/src/Widget.cpp View File

@@ -160,7 +160,7 @@ const Rectangle<int>& Widget::getArea() const noexcept
return fArea;
}

uint32_t Widget::getEventTimestamp()
uint Widget::getEventTimestamp()
{
return fParent.getEventTimestamp();
}
@@ -185,7 +185,7 @@ void Widget::repaint()
fParent.repaint();
}

bool Widget::onKeyboard(bool, uint32_t)
bool Widget::onKeyboard(bool, uint)
{
return false;
}


+ 8
- 8
dgl/src/Window.cpp View File

@@ -195,7 +195,7 @@ public:
{
pid_t pid = getpid();
Atom _nwp = XInternAtom(xDisplay, "_NET_WM_PID", True);
XChangeProperty(xDisplay, xWindow, _nwp, XA_CARDINAL, 32, PropModeReplace, (const unsigned char*)&pid, 1);
XChangeProperty(xDisplay, xWindow, _nwp, XA_CARDINAL, 32, PropModeReplace, (const uchar*)&pid, 1);
}
#endif

@@ -322,7 +322,7 @@ public:
fVisible = yesNo;

if (yesNo && fFirstInit)
setSize(static_cast<unsigned int>(fView->width), static_cast<unsigned int>(fView->height), true);
setSize(static_cast<uint>(fView->width), static_cast<uint>(fView->height), true);

#if defined(DISTRHO_OS_WINDOWS)
if (yesNo)
@@ -378,7 +378,7 @@ public:

fResizable = yesNo;

setSize(static_cast<unsigned int>(fView->width), static_cast<unsigned int>(fView->height), true);
setSize(static_cast<uint>(fView->width), static_cast<uint>(fView->height), true);
}

// -------------------------------------------------------------------
@@ -398,7 +398,7 @@ public:
return Size<int>(fView->width, fView->height);
}

void setSize(unsigned int width, unsigned int height, const bool forced = false)
void setSize(uint width, uint height, const bool forced = false)
{
if (width == 0 || height == 0)
{
@@ -496,7 +496,7 @@ public:
return puglGetModifiers(fView);
}

uint32_t getEventTimestamp() const
uint getEventTimestamp() const
{
return puglGetEventTimestamp(fView);
}
@@ -599,7 +599,7 @@ protected:
}
}

void onKeyboard(const bool press, const uint32_t key)
void onKeyboard(const bool press, const uint key)
{
DBGp("PUGL: onKeyboard : %i %i\n", press, key);

@@ -891,7 +891,7 @@ Size<int> Window::getSize() const noexcept
return pData->getSize();
}

void Window::setSize(unsigned int width, unsigned int height)
void Window::setSize(uint width, uint height)
{
pData->setSize(width, height);
}
@@ -916,7 +916,7 @@ int Window::getModifiers() const
return pData->getModifiers();
}

uint32_t Window::getEventTimestamp() const
uint Window::getEventTimestamp() const
{
return pData->getEventTimestamp();
}


Loading…
Cancel
Save