From 756da05c384e3d9258fc07cf9441d899238503f1 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 3 Jan 2021 11:50:41 +0100 Subject: Add dggui namespace to libdggui components. --- dggui/button.cc | 4 +- dggui/button.h | 5 +- dggui/button_base.cc | 5 +- dggui/button_base.h | 5 +- dggui/canvas.h | 4 +- dggui/checkbox.cc | 4 +- dggui/checkbox.h | 5 +- dggui/colour.cc | 4 +- dggui/colour.h | 4 +- dggui/combobox.cc | 4 +- dggui/combobox.h | 4 +- dggui/dialog.cc | 4 +- dggui/dialog.h | 4 +- dggui/drawable.h | 4 +- dggui/eventhandler.cc | 4 +- dggui/eventhandler.h | 4 +- dggui/font.cc | 4 +- dggui/font.h | 5 +- dggui/frame.cc | 4 +- dggui/frame.h | 20 +++--- dggui/guievent.h | 4 +- dggui/helpbutton.cc | 4 +- dggui/helpbutton.h | 4 +- dggui/image.cc | 4 +- dggui/image.h | 5 +- dggui/imagecache.cc | 4 +- dggui/imagecache.h | 4 +- dggui/knob.cc | 4 +- dggui/knob.h | 5 +- dggui/label.cc | 5 +- dggui/label.h | 5 +- dggui/layout.cc | 4 +- dggui/layout.h | 4 +- dggui/led.cc | 5 +- dggui/led.h | 5 +- dggui/lineedit.cc | 5 +- dggui/lineedit.h | 4 +- dggui/listbox.cc | 5 +- dggui/listbox.h | 4 +- dggui/listboxbasic.cc | 5 +- dggui/listboxbasic.h | 9 ++- dggui/listboxthin.cc | 4 +- dggui/listboxthin.h | 6 +- dggui/nativewindow.h | 4 +- dggui/nativewindow_cocoa.h | 4 +- dggui/nativewindow_cocoa.mm | 112 +++++++++++++++---------------- dggui/nativewindow_pugl.cc | 4 +- dggui/nativewindow_pugl.h | 4 +- dggui/nativewindow_win32.cc | 4 +- dggui/nativewindow_win32.h | 5 +- dggui/nativewindow_x11.cc | 4 +- dggui/nativewindow_x11.h | 4 +- dggui/painter.cc | 4 +- dggui/painter.h | 4 +- dggui/pixelbuffer.cc | 4 +- dggui/pixelbuffer.h | 4 +- dggui/powerbutton.cc | 4 +- dggui/powerbutton.h | 4 +- dggui/progressbar.cc | 4 +- dggui/progressbar.h | 4 +- dggui/resource.cc | 4 +- dggui/resource.h | 8 ++- dggui/resource_data.h | 5 +- dggui/scrollbar.cc | 5 +- dggui/scrollbar.h | 9 ++- dggui/slider.cc | 4 +- dggui/slider.h | 4 +- dggui/stackedwidget.cc | 4 +- dggui/stackedwidget.h | 4 +- dggui/tabbutton.cc | 4 +- dggui/tabbutton.h | 4 +- dggui/tabwidget.cc | 4 +- dggui/tabwidget.h | 4 +- dggui/textedit.cc | 4 +- dggui/textedit.h | 4 +- dggui/texture.cc | 4 +- dggui/texture.h | 4 +- dggui/texturedbox.cc | 4 +- dggui/texturedbox.h | 4 +- dggui/toggle.cc | 4 +- dggui/toggle.h | 4 +- dggui/tooltip.cc | 4 +- dggui/tooltip.h | 4 +- dggui/uitranslation.cc | 6 +- dggui/uitranslation.h | 5 ++ dggui/utf8.cc | 5 ++ dggui/utf8.h | 5 ++ dggui/verticalline.cc | 5 +- dggui/verticalline.h | 9 ++- dggui/widget.cc | 4 +- dggui/widget.h | 4 +- dggui/window.cc | 4 +- dggui/window.h | 4 +- drumgizmo/dgvalidator.cc | 8 +-- plugin/drumgizmo_plugin.cc | 8 +-- plugin/drumgizmo_plugin.h | 14 ++-- plugingui/abouttab.cc | 18 ++--- plugingui/abouttab.h | 6 +- plugingui/bleedcontrolframecontent.cc | 18 ++--- plugingui/bleedcontrolframecontent.h | 11 +-- plugingui/diskstreamingframecontent.cc | 20 +++--- plugingui/diskstreamingframecontent.h | 13 ++-- plugingui/drumkitframecontent.cc | 52 +++++++------- plugingui/drumkitframecontent.h | 28 ++++---- plugingui/drumkittab.cc | 62 +++++++++-------- plugingui/drumkittab.h | 34 +++++----- plugingui/filebrowser.cc | 16 ++--- plugingui/filebrowser.h | 20 +++--- plugingui/humaniservisualiser.cc | 33 +++++---- plugingui/humaniservisualiser.h | 27 +++++--- plugingui/humanizerframecontent.cc | 14 ++-- plugingui/humanizerframecontent.h | 12 ++-- plugingui/labeledcontrol.h | 20 +++--- plugingui/locale/da.po | 58 ++++++++-------- plugingui/locale/drumgizmo.pot | 60 ++++++++--------- plugingui/locale/fr.po | 69 +++++++++---------- plugingui/maintab.cc | 26 +++---- plugingui/maintab.h | 34 +++++----- plugingui/mainwindow.cc | 6 +- plugingui/mainwindow.h | 14 ++-- plugingui/powerwidget.cc | 53 ++++++++------- plugingui/powerwidget.h | 29 ++++---- plugingui/resamplingframecontent.cc | 6 +- plugingui/resamplingframecontent.h | 10 +-- plugingui/sampleselectionframecontent.cc | 10 +-- plugingui/sampleselectionframecontent.h | 12 ++-- plugingui/statusframecontent.cc | 7 +- plugingui/statusframecontent.h | 8 ++- plugingui/testmain.cc | 6 +- plugingui/timingframecontent.cc | 10 +-- plugingui/timingframecontent.h | 12 ++-- plugingui/visualizerframecontent.cc | 6 +- plugingui/visualizerframecontent.h | 4 +- plugingui/voicelimitframecontent.cc | 12 ++-- plugingui/voicelimitframecontent.h | 12 ++-- test/imagecachetest.cc | 2 +- test/paintertest.cc | 46 ++++++------- test/resource_test.cc | 4 +- test/translationtest.cc | 2 +- test/uitests/benchmarktest.cc | 26 +++---- test/uitests/filebrowsertest.cc | 14 ++-- test/uitests/framewidgettest.cc | 60 ++++++++--------- test/uitests/powerwidgettest.cc | 12 ++-- test/uitests/resizetest.cc | 16 ++--- test/uitests/tabwidgettest.cc | 48 ++++++------- 145 files changed, 875 insertions(+), 793 deletions(-) diff --git a/dggui/button.cc b/dggui/button.cc index 30bda82..39e9eaa 100644 --- a/dggui/button.cc +++ b/dggui/button.cc @@ -31,7 +31,7 @@ #include #include -namespace GUI +namespace dggui { Button::Button(Widget* parent) @@ -85,4 +85,4 @@ void Button::repaintEvent(RepaintEvent* repaintEvent) p.drawText(x, y, font, text, enabled); } -} // GUI:: +} // dggui:: diff --git a/dggui/button.h b/dggui/button.h index 52f22e2..f1b6584 100644 --- a/dggui/button.h +++ b/dggui/button.h @@ -30,7 +30,8 @@ #include "font.h" #include "texturedbox.h" -namespace GUI { +namespace dggui +{ class Button : public ButtonBase { @@ -61,4 +62,4 @@ private: Font font{":resources/fontemboss.png"}; }; -} // GUI:: +} // dggui:: diff --git a/dggui/button_base.cc b/dggui/button_base.cc index bf441f5..4625b55 100644 --- a/dggui/button_base.cc +++ b/dggui/button_base.cc @@ -26,7 +26,8 @@ */ #include "button_base.h" -namespace GUI { +namespace dggui +{ ButtonBase::ButtonBase(Widget *parent) : Widget(parent) @@ -113,4 +114,4 @@ void ButtonBase::mouseEnterEvent() } } -} // GUI:: +} // dggui:: diff --git a/dggui/button_base.h b/dggui/button_base.h index c872d9b..72f693b 100644 --- a/dggui/button_base.h +++ b/dggui/button_base.h @@ -32,7 +32,8 @@ #include "widget.h" -namespace GUI { +namespace dggui +{ class ButtonBase : public Widget @@ -75,4 +76,4 @@ protected: State button_state{State::Up}; }; -} // GUI:: +} // dggui:: diff --git a/dggui/canvas.h b/dggui/canvas.h index d6e8f99..1b0b5b2 100644 --- a/dggui/canvas.h +++ b/dggui/canvas.h @@ -28,7 +28,7 @@ #include "pixelbuffer.h" -namespace GUI +namespace dggui { //! Abstract class that can be used by the Painter to draw on. @@ -41,4 +41,4 @@ public: virtual PixelBufferAlpha& getPixelBuffer() = 0; }; -} // GUI:: +} // dggui:: diff --git a/dggui/checkbox.cc b/dggui/checkbox.cc index f3601bd..8911862 100644 --- a/dggui/checkbox.cc +++ b/dggui/checkbox.cc @@ -28,7 +28,7 @@ #include "painter.h" -namespace GUI +namespace dggui { CheckBox::CheckBox(Widget* parent) @@ -61,4 +61,4 @@ void CheckBox::repaintEvent(RepaintEvent* repaintEvent) } } -} // GUI:: +} // dggui:: diff --git a/dggui/checkbox.h b/dggui/checkbox.h index 6627304..1a323b6 100644 --- a/dggui/checkbox.h +++ b/dggui/checkbox.h @@ -29,7 +29,8 @@ #include "toggle.h" #include "texture.h" -namespace GUI { +namespace dggui +{ class CheckBox : public Toggle { public: @@ -46,4 +47,4 @@ private: Texture knob; }; -} // GUI:: +} // dggui:: diff --git a/dggui/colour.cc b/dggui/colour.cc index 7fd649c..6d510f9 100644 --- a/dggui/colour.cc +++ b/dggui/colour.cc @@ -28,7 +28,7 @@ #include -namespace GUI +namespace dggui { Colour::Colour() @@ -79,4 +79,4 @@ bool Colour::operator!=(const Colour& other) const return !(*this == other); } -} // GUI:: +} // dggui:: diff --git a/dggui/colour.h b/dggui/colour.h index 0bc8659..aea286c 100644 --- a/dggui/colour.h +++ b/dggui/colour.h @@ -29,7 +29,7 @@ #include #include -namespace GUI +namespace dggui { class Colour @@ -58,4 +58,4 @@ private: std::array pixel{{255, 255, 255, 255}}; }; -} // GUI:: +} // dggui:: diff --git a/dggui/combobox.cc b/dggui/combobox.cc index aa2058e..33765e2 100644 --- a/dggui/combobox.cc +++ b/dggui/combobox.cc @@ -33,7 +33,7 @@ #define BORDER 10 -namespace GUI +namespace dggui { void ComboBox::listboxSelectHandler() @@ -231,4 +231,4 @@ void ComboBox::buttonEvent(ButtonEvent* buttonEvent) listbox.setVisible(!listbox.visible()); } -} // GUI:: +} // dggui:: diff --git a/dggui/combobox.h b/dggui/combobox.h index 778d54c..a3ef8ac 100644 --- a/dggui/combobox.h +++ b/dggui/combobox.h @@ -35,7 +35,7 @@ #include "painter.h" #include "texturedbox.h" -namespace GUI +namespace dggui { class ComboBox @@ -73,4 +73,4 @@ private: ListBoxThin listbox; }; -} // GUI:: +} // dggui:: diff --git a/dggui/dialog.cc b/dggui/dialog.cc index 9ba579d..74d9200 100644 --- a/dggui/dialog.cc +++ b/dggui/dialog.cc @@ -26,7 +26,7 @@ */ #include "dialog.h" -namespace GUI +namespace dggui { Dialog::Dialog(Widget* parent, bool modal) @@ -51,4 +51,4 @@ bool Dialog::isModal() const return is_modal; } -} // GUI:: +} // dggui:: diff --git a/dggui/dialog.h b/dggui/dialog.h index 1b0c6da..a9911c5 100644 --- a/dggui/dialog.h +++ b/dggui/dialog.h @@ -28,7 +28,7 @@ #include "window.h" -namespace GUI +namespace dggui { //! This class is used the base window for pop-up dialogs, such as a file @@ -60,4 +60,4 @@ private: Widget* parent{nullptr}; }; -} // GUI:: +} // dggui:: diff --git a/dggui/drawable.h b/dggui/drawable.h index 95492d6..84e33db 100644 --- a/dggui/drawable.h +++ b/dggui/drawable.h @@ -29,7 +29,7 @@ #include #include -namespace GUI +namespace dggui { class Colour; @@ -49,4 +49,4 @@ public: virtual bool hasAlpha() const = 0; }; -} // GUI:: +} // dggui:: diff --git a/dggui/eventhandler.cc b/dggui/eventhandler.cc index fd333b8..b2cf616 100644 --- a/dggui/eventhandler.cc +++ b/dggui/eventhandler.cc @@ -30,7 +30,7 @@ #include "painter.h" #include "dialog.h" -namespace GUI +namespace dggui { EventHandler::EventHandler(NativeWindow& nativeWindow, Window& window) @@ -294,4 +294,4 @@ void EventHandler::unregisterDialog(Dialog* dialog) } -} // GUI:: +} // dggui:: diff --git a/dggui/eventhandler.h b/dggui/eventhandler.h index 8d6f492..6a2b48f 100644 --- a/dggui/eventhandler.h +++ b/dggui/eventhandler.h @@ -34,7 +34,7 @@ #include "guievent.h" #include "nativewindow.h" -namespace GUI +namespace dggui { class Window; @@ -75,4 +75,4 @@ private: std::list dialogs; }; -} // GUI:: +} // dggui:: diff --git a/dggui/font.cc b/dggui/font.cc index 0500e81..e59cb41 100644 --- a/dggui/font.cc +++ b/dggui/font.cc @@ -28,7 +28,7 @@ #include -namespace GUI +namespace dggui { Font::Font(const std::string& fontfile) @@ -133,4 +133,4 @@ PixelBufferAlpha *Font::render(const std::string& text) const return pb; } -} // GUI:: +} // dggui:: diff --git a/dggui/font.h b/dggui/font.h index 2e3f87a..6ce1f5c 100644 --- a/dggui/font.h +++ b/dggui/font.h @@ -32,7 +32,8 @@ #include "pixelbuffer.h" #include "image.h" -namespace GUI { +namespace dggui +{ class Font { public: @@ -61,4 +62,4 @@ private: int spacing{1}; }; -} // GUI:: +} // dggui:: diff --git a/dggui/frame.cc b/dggui/frame.cc index d375b6d..3a163f1 100644 --- a/dggui/frame.cc +++ b/dggui/frame.cc @@ -28,7 +28,7 @@ #include "painter.h" -namespace GUI +namespace dggui { FrameWidget::FrameWidget(Widget* parent, bool has_switch, bool has_help_text) @@ -143,4 +143,4 @@ void FrameWidget::sizeChanged(int width, int height) help_button.move(width - 4 - 16, help_button.y()); } -} // GUI:: +} // dggui:: diff --git a/dggui/frame.h b/dggui/frame.h index db26ea9..dc8e17a 100644 --- a/dggui/frame.h +++ b/dggui/frame.h @@ -33,7 +33,7 @@ #include "helpbutton.h" #include "widget.h" -namespace GUI +namespace dggui { class FrameWidget @@ -76,8 +76,8 @@ private: // label Font font; std::string title; - GUI::Colour label_colour{0.1}; - GUI::Colour label_colour_disabled{0.5}; + dggui::Colour label_colour{0.1}; + dggui::Colour label_colour_disabled{0.5}; std::size_t label_width; // switch @@ -89,18 +89,18 @@ private: // grey box int bar_height; - GUI::Colour grey_box_colour{0.7}; - GUI::Colour grey_box_colour_disabled{0.7}; - GUI::Colour background_colour{0.85, 0.8}; + dggui::Colour grey_box_colour{0.7}; + dggui::Colour grey_box_colour_disabled{0.7}; + dggui::Colour background_colour{0.85, 0.8}; // // content // // content frame - GUI::Colour frame_colour_top{0.95}; - GUI::Colour frame_colour_bottom{0.4}; - GUI::Colour frame_colour_side{0.6}; + dggui::Colour frame_colour_top{0.95}; + dggui::Colour frame_colour_bottom{0.4}; + dggui::Colour frame_colour_side{0.6}; // content box Widget* content{nullptr}; @@ -112,4 +112,4 @@ private: int content_height; }; -} // GUI:: +} // dggui:: diff --git a/dggui/guievent.h b/dggui/guievent.h index 4ad0798..aae0ae1 100644 --- a/dggui/guievent.h +++ b/dggui/guievent.h @@ -30,7 +30,7 @@ #include #include -namespace GUI +namespace dggui { enum class EventType @@ -209,4 +209,4 @@ struct Rect } }; -} // GUI:: +} // dggui:: diff --git a/dggui/helpbutton.cc b/dggui/helpbutton.cc index fa061a6..cc03112 100644 --- a/dggui/helpbutton.cc +++ b/dggui/helpbutton.cc @@ -30,7 +30,7 @@ #include -namespace GUI +namespace dggui { HelpButton::HelpButton(Widget* parent) @@ -72,4 +72,4 @@ void HelpButton::showHelpText() tip.show(); } -} // GUI:: +} // dggui:: diff --git a/dggui/helpbutton.h b/dggui/helpbutton.h index 6e97eca..639799a 100644 --- a/dggui/helpbutton.h +++ b/dggui/helpbutton.h @@ -30,7 +30,7 @@ #include "button_base.h" #include "tooltip.h" -namespace GUI +namespace dggui { class HelpButton @@ -55,4 +55,4 @@ private: Tooltip tip; }; -} // GUI:: +} // dggui:: diff --git a/dggui/image.cc b/dggui/image.cc index 118203e..d821bee 100644 --- a/dggui/image.cc +++ b/dggui/image.cc @@ -36,7 +36,7 @@ #include "resource.h" #include "lodepng/lodepng.h" -namespace GUI +namespace dggui { Image::Image(const char* data, size_t size) @@ -213,4 +213,4 @@ bool Image::isValid() const return valid; } -} // GUI:: +} // dggui:: diff --git a/dggui/image.h b/dggui/image.h index d162a75..a6bf43e 100644 --- a/dggui/image.h +++ b/dggui/image.h @@ -33,7 +33,8 @@ #include "colour.h" #include "resource.h" -namespace GUI { +namespace dggui +{ class Image : public Drawable @@ -72,4 +73,4 @@ protected: bool has_alpha{false}; }; -} // GUI:: +} // dggui:: diff --git a/dggui/imagecache.cc b/dggui/imagecache.cc index d3130fe..fa2197b 100644 --- a/dggui/imagecache.cc +++ b/dggui/imagecache.cc @@ -30,7 +30,7 @@ #include "image.h" -namespace GUI +namespace dggui { ScopedImageBorrower::ScopedImageBorrower(ImageCache& imageCache, @@ -100,4 +100,4 @@ void ImageCache::giveBack(const std::string& filename) } } -} // GUI:: +} // dggui:: diff --git a/dggui/imagecache.h b/dggui/imagecache.h index d31a844..15ecaf3 100644 --- a/dggui/imagecache.h +++ b/dggui/imagecache.h @@ -30,7 +30,7 @@ #include #include -namespace GUI +namespace dggui { class Image; @@ -69,4 +69,4 @@ protected: std::map> imageCache; }; -} // GUI:: +} // dggui:: diff --git a/dggui/knob.cc b/dggui/knob.cc index 25200a7..4f8ead0 100644 --- a/dggui/knob.cc +++ b/dggui/knob.cc @@ -36,7 +36,7 @@ namespace const double pi = std::atan(1.0) * 4.0; } -namespace GUI +namespace dggui { Knob::Knob(Widget *parent) @@ -252,4 +252,4 @@ void Knob::internalSetValue(float new_value) redraw(); } -} // GUI:: +} // dggui:: diff --git a/dggui/knob.h b/dggui/knob.h index fc71511..851c9c6 100644 --- a/dggui/knob.h +++ b/dggui/knob.h @@ -32,7 +32,8 @@ #include "texture.h" #include "font.h" -namespace GUI { +namespace dggui +{ class Knob : public Widget { public: @@ -85,4 +86,4 @@ private: Font font; }; -} // GUI:: +} // dggui:: diff --git a/dggui/label.cc b/dggui/label.cc index b5239ec..fc3f60e 100644 --- a/dggui/label.cc +++ b/dggui/label.cc @@ -31,7 +31,8 @@ #include -namespace GUI { +namespace dggui +{ Label::Label(Widget *parent) : Widget(parent) @@ -93,4 +94,4 @@ void Label::repaintEvent(RepaintEvent* repaintEvent) } } -} // GUI:: +} // dggui:: diff --git a/dggui/label.h b/dggui/label.h index 45b4176..453bc4f 100644 --- a/dggui/label.h +++ b/dggui/label.h @@ -33,7 +33,8 @@ #include #include -namespace GUI { +namespace dggui +{ enum class TextAlignment { left, @@ -66,4 +67,4 @@ private: std::unique_ptr colour; }; -} // GUI:: +} // dggui:: diff --git a/dggui/layout.cc b/dggui/layout.cc index 61e4f77..3b99456 100644 --- a/dggui/layout.cc +++ b/dggui/layout.cc @@ -30,7 +30,7 @@ #include -namespace GUI +namespace dggui { LayoutItem::LayoutItem() @@ -383,4 +383,4 @@ void GridLayout::moveAndResize( } } -} // GUI:: +} // dggui:: diff --git a/dggui/layout.h b/dggui/layout.h index 210c86e..860ecc2 100644 --- a/dggui/layout.h +++ b/dggui/layout.h @@ -32,7 +32,7 @@ #include -namespace GUI +namespace dggui { class Layout; @@ -192,4 +192,4 @@ private: LayoutItem& item, GridRange const& range, CellSize cell_size) const; }; -} // GUI:: +} // dggui:: diff --git a/dggui/led.cc b/dggui/led.cc index f77e31a..6e1059c 100644 --- a/dggui/led.cc +++ b/dggui/led.cc @@ -28,7 +28,8 @@ #include "painter.h" -namespace GUI { +namespace dggui +{ LED::LED(Widget *parent) : Widget(parent) @@ -94,4 +95,4 @@ void LED::repaintEvent(RepaintEvent* repaintEvent) p.drawFilledCircle(w / 3, h / 3, size / 6); } -} // GUI:: +} // dggui:: diff --git a/dggui/led.h b/dggui/led.h index 14ab6ef..7a1f55f 100644 --- a/dggui/led.h +++ b/dggui/led.h @@ -28,7 +28,8 @@ #include "widget.h" -namespace GUI { +namespace dggui +{ class LED : public Widget { public: @@ -51,4 +52,4 @@ private: state_t state; }; -} // GUI:: +} // dggui:: diff --git a/dggui/lineedit.cc b/dggui/lineedit.cc index 14cc234..7e8bf86 100644 --- a/dggui/lineedit.cc +++ b/dggui/lineedit.cc @@ -31,7 +31,8 @@ #define BORDER 10 -namespace GUI { +namespace dggui +{ LineEdit::LineEdit(Widget *parent) : Widget(parent) @@ -282,4 +283,4 @@ void LineEdit::repaintEvent(RepaintEvent *repaintEvent) } } -} // GUI:: +} // dggui:: diff --git a/dggui/lineedit.h b/dggui/lineedit.h index 86ad986..c702c47 100644 --- a/dggui/lineedit.h +++ b/dggui/lineedit.h @@ -33,7 +33,7 @@ #include "painter.h" #include "texturedbox.h" -namespace GUI +namespace dggui { class LineEdit @@ -84,4 +84,4 @@ private: bool readonly; }; -} // GUI:: +} // dggui:: diff --git a/dggui/listbox.cc b/dggui/listbox.cc index 28c074e..4513895 100644 --- a/dggui/listbox.cc +++ b/dggui/listbox.cc @@ -29,7 +29,8 @@ #include "painter.h" #include "font.h" -namespace GUI { +namespace dggui +{ ListBox::ListBox(Widget *parent) : Widget(parent) @@ -102,4 +103,4 @@ void ListBox::resize(std::size_t width, std::size_t height) height - (7 + 7)); } -} // GUI:: +} // dggui:: diff --git a/dggui/listbox.h b/dggui/listbox.h index 0d9ad4d..75a4ea0 100644 --- a/dggui/listbox.h +++ b/dggui/listbox.h @@ -34,7 +34,7 @@ #include "listboxbasic.h" #include "texturedbox.h" -namespace GUI +namespace dggui { class ListBox @@ -71,4 +71,4 @@ private: 7, 63, 7}; // dy1, dy2, dy3 }; -} // GUI:: +} // dggui:: diff --git a/dggui/listboxbasic.cc b/dggui/listboxbasic.cc index b2637eb..dd58944 100644 --- a/dggui/listboxbasic.cc +++ b/dggui/listboxbasic.cc @@ -29,7 +29,8 @@ #include "painter.h" #include "font.h" -namespace GUI { +namespace dggui +{ ListBoxBasic::ListBoxBasic(Widget *parent) : Widget(parent) @@ -359,4 +360,4 @@ void ListBoxBasic::resize(std::size_t width, std::size_t height) scroll.resize(scroll.width(), height); } -} // GUI:: +} // dggui:: diff --git a/dggui/listboxbasic.h b/dggui/listboxbasic.h index 27822e6..3d6515d 100644 --- a/dggui/listboxbasic.h +++ b/dggui/listboxbasic.h @@ -36,9 +36,12 @@ #include "painter.h" #include "scrollbar.h" -namespace GUI { +namespace dggui +{ -class ListBoxBasic : public Widget { +class ListBoxBasic + : public Widget +{ public: class Item { public: @@ -91,4 +94,4 @@ protected: int btn_size; }; -} // GUI:: +} // dggui:: diff --git a/dggui/listboxthin.cc b/dggui/listboxthin.cc index d224f11..b92def3 100644 --- a/dggui/listboxthin.cc +++ b/dggui/listboxthin.cc @@ -29,7 +29,7 @@ #include "painter.h" #include "font.h" -namespace GUI +namespace dggui { ListBoxThin::ListBoxThin(Widget *parent) @@ -98,4 +98,4 @@ void ListBoxThin::resize(std::size_t height, std::size_t width) height - (1 + 1)); } -} // GUI:: +} // dggui:: diff --git a/dggui/listboxthin.h b/dggui/listboxthin.h index e861745..0305a04 100644 --- a/dggui/listboxthin.h +++ b/dggui/listboxthin.h @@ -36,7 +36,7 @@ #include "listboxbasic.h" #include "texturedbox.h" -namespace GUI +namespace dggui { class ListBoxThin @@ -55,7 +55,7 @@ public: std::string selectedValue(); // From Widget: - virtual void repaintEvent(GUI::RepaintEvent* repaintEvent) override; + virtual void repaintEvent(RepaintEvent* repaintEvent) override; virtual void resize(std::size_t height, std::size_t width) override; // Forwarded notifier from ListBoxBasic::basic @@ -72,4 +72,4 @@ private: 1, 1, 1}; // dy1, dy2, dy3 }; -} // GUI:: +} // dggui:: diff --git a/dggui/nativewindow.h b/dggui/nativewindow.h index 400ff57..07c3559 100644 --- a/dggui/nativewindow.h +++ b/dggui/nativewindow.h @@ -34,7 +34,7 @@ #include "guievent.h" -namespace GUI +namespace dggui { struct Point; @@ -97,4 +97,4 @@ public: virtual Point translateToScreen(const Point& point) = 0; }; -} // GUI:: +} // dggui:: diff --git a/dggui/nativewindow_cocoa.h b/dggui/nativewindow_cocoa.h index 8dc73e6..e17d4af 100644 --- a/dggui/nativewindow_cocoa.h +++ b/dggui/nativewindow_cocoa.h @@ -30,7 +30,7 @@ #include "nativewindow.h" -namespace GUI +namespace dggui { class Window; @@ -75,4 +75,4 @@ private: float scale{1.0}; }; -} // GUI:: +} // dggui:: diff --git a/dggui/nativewindow_cocoa.mm b/dggui/nativewindow_cocoa.mm index 7b6ecc8..3214f57 100644 --- a/dggui/nativewindow_cocoa.mm +++ b/dggui/nativewindow_cocoa.mm @@ -69,11 +69,11 @@ { @public NSWindow* window; - GUI::NativeWindowCocoa* native; + dggui::NativeWindowCocoa* native; } - (id) initWithWindow:(NSWindow*)ref - native:(GUI::NativeWindowCocoa*)_native; + native:(dggui::NativeWindowCocoa*)_native; - (void) dealloc; - (void) windowDidResize; - (void) windowWillResize; @@ -83,7 +83,7 @@ @implementation DGListener - (id) initWithWindow:(NSWindow*)ref - native:(GUI::NativeWindowCocoa*)_native + native:(dggui::NativeWindowCocoa*)_native { [super init]; @@ -146,7 +146,7 @@ return; } - auto closeEvent = std::make_shared(); + auto closeEvent = std::make_shared(); native->pushBackEvent(closeEvent); } @@ -162,7 +162,7 @@ int depthBits; @private - GUI::NativeWindowCocoa* native; + dggui::NativeWindowCocoa* native; NSTrackingArea* trackingArea; } @@ -188,7 +188,7 @@ - (void) keyUp:(NSEvent*)event; - (void) dealloc; -- (void) bindNative:(GUI::NativeWindowCocoa*)native; +- (void) bindNative:(dggui::NativeWindowCocoa*)native; - (void) unbindNative; @end @@ -228,7 +228,7 @@ [super mouseEntered:event]; auto frame = [self frame]; NSPoint loc = [event locationInWindow]; - auto mouseEnterEvent = std::make_shared(); + auto mouseEnterEvent = std::make_shared(); mouseEnterEvent->x = loc.x - frame.origin.x; mouseEnterEvent->y = frame.size.height - loc.y - frame.origin.y; native->pushBackEvent(mouseEnterEvent); @@ -240,7 +240,7 @@ [super mouseExited:event]; auto frame = [self frame]; NSPoint loc = [event locationInWindow]; - auto mouseLeaveEvent = std::make_shared(); + auto mouseLeaveEvent = std::make_shared(); mouseLeaveEvent->x = loc.x - frame.origin.x; mouseLeaveEvent->y = frame.size.height - loc.y - frame.origin.y; native->pushBackEvent(mouseLeaveEvent); @@ -251,7 +251,7 @@ { auto frame = [self frame]; NSPoint loc = [event locationInWindow]; - auto mouseMoveEvent = std::make_shared(); + auto mouseMoveEvent = std::make_shared(); mouseMoveEvent->x = loc.x - frame.origin.x; mouseMoveEvent->y = frame.size.height - loc.y - frame.origin.y; native->pushBackEvent(mouseMoveEvent); @@ -262,24 +262,24 @@ auto frame = [self frame]; NSPoint loc = [event locationInWindow]; - auto buttonEvent = std::make_shared(); + auto buttonEvent = std::make_shared(); buttonEvent->x = loc.x - frame.origin.x; buttonEvent->y = frame.size.height - loc.y - frame.origin.y; switch((int)[event buttonNumber]) { case 0: - buttonEvent->button = GUI::MouseButton::left; + buttonEvent->button = dggui::MouseButton::left; break; case 1: - buttonEvent->button = GUI::MouseButton::right; + buttonEvent->button = dggui::MouseButton::right; break; case 2: - buttonEvent->button = GUI::MouseButton::middle; + buttonEvent->button = dggui::MouseButton::middle; break; default: return; } - buttonEvent->direction = GUI::Direction::down; + buttonEvent->direction = dggui::Direction::down; buttonEvent->doubleClick = [event clickCount] == 2; native->pushBackEvent(buttonEvent); @@ -291,24 +291,24 @@ auto frame = [self frame]; NSPoint loc = [event locationInWindow]; - auto buttonEvent = std::make_shared(); + auto buttonEvent = std::make_shared(); buttonEvent->x = loc.x - frame.origin.x; buttonEvent->y = frame.size.height - loc.y - frame.origin.y; switch((int)[event buttonNumber]) { case 0: - buttonEvent->button = GUI::MouseButton::left; + buttonEvent->button = dggui::MouseButton::left; break; case 1: - buttonEvent->button = GUI::MouseButton::right; + buttonEvent->button = dggui::MouseButton::right; break; case 2: - buttonEvent->button = GUI::MouseButton::middle; + buttonEvent->button = dggui::MouseButton::middle; break; default: return; } - buttonEvent->direction = GUI::Direction::up; + buttonEvent->direction = dggui::Direction::up; buttonEvent->doubleClick = false; native->pushBackEvent(buttonEvent); @@ -362,7 +362,7 @@ auto frame = [self frame]; NSPoint loc = [event locationInWindow]; - auto scrollEvent = std::make_shared(); + auto scrollEvent = std::make_shared(); scrollEvent->x = loc.x - frame.origin.x; scrollEvent->y = frame.size.height - loc.y - frame.origin.y; scrollEvent->delta = [event deltaY] * -1.0f; @@ -376,31 +376,31 @@ const NSString* chars = [event characters]; const char* str = [chars UTF8String]; - auto keyEvent = std::make_shared(); + auto keyEvent = std::make_shared(); switch([event keyCode]) { - case 123: keyEvent->keycode = GUI::Key::left; break; - case 124: keyEvent->keycode = GUI::Key::right; break; - case 126: keyEvent->keycode = GUI::Key::up; break; - case 125: keyEvent->keycode = GUI::Key::down; break; - case 117: keyEvent->keycode = GUI::Key::deleteKey; break; - case 51: keyEvent->keycode = GUI::Key::backspace; break; - case 115: keyEvent->keycode = GUI::Key::home; break; - case 119: keyEvent->keycode = GUI::Key::end; break; - case 121: keyEvent->keycode = GUI::Key::pageDown; break; - case 116: keyEvent->keycode = GUI::Key::pageUp; break; - case 36: keyEvent->keycode = GUI::Key::enter; break; - default: keyEvent->keycode = GUI::Key::unknown; break; + case 123: keyEvent->keycode = dggui::Key::left; break; + case 124: keyEvent->keycode = dggui::Key::right; break; + case 126: keyEvent->keycode = dggui::Key::up; break; + case 125: keyEvent->keycode = dggui::Key::down; break; + case 117: keyEvent->keycode = dggui::Key::deleteKey; break; + case 51: keyEvent->keycode = dggui::Key::backspace; break; + case 115: keyEvent->keycode = dggui::Key::home; break; + case 119: keyEvent->keycode = dggui::Key::end; break; + case 121: keyEvent->keycode = dggui::Key::pageDown; break; + case 116: keyEvent->keycode = dggui::Key::pageUp; break; + case 36: keyEvent->keycode = dggui::Key::enter; break; + default: keyEvent->keycode = dggui::Key::unknown; break; } - if(strlen(str) && keyEvent->keycode == GUI::Key::unknown) + if(strlen(str) && keyEvent->keycode == dggui::Key::unknown) { - keyEvent->keycode = GUI::Key::character; + keyEvent->keycode = dggui::Key::character; } keyEvent->text = str; // TODO: UTF8 decode - keyEvent->direction = GUI::Direction::down; + keyEvent->direction = dggui::Direction::down; native->pushBackEvent(keyEvent); [super keyDown: event]; @@ -410,31 +410,31 @@ { const NSString* chars = [event characters]; const char* str = [chars UTF8String]; - auto keyEvent = std::make_shared(); + auto keyEvent = std::make_shared(); switch([event keyCode]) { - case 123: keyEvent->keycode = GUI::Key::left; break; - case 124: keyEvent->keycode = GUI::Key::right; break; - case 126: keyEvent->keycode = GUI::Key::up; break; - case 125: keyEvent->keycode = GUI::Key::down; break; - case 117: keyEvent->keycode = GUI::Key::deleteKey; break; - case 51: keyEvent->keycode = GUI::Key::backspace; break; - case 115: keyEvent->keycode = GUI::Key::home; break; - case 119: keyEvent->keycode = GUI::Key::end; break; - case 121: keyEvent->keycode = GUI::Key::pageDown; break; - case 116: keyEvent->keycode = GUI::Key::pageUp; break; - case 36: keyEvent->keycode = GUI::Key::enter; break; - default: keyEvent->keycode = GUI::Key::unknown; break; + case 123: keyEvent->keycode = dggui::Key::left; break; + case 124: keyEvent->keycode = dggui::Key::right; break; + case 126: keyEvent->keycode = dggui::Key::up; break; + case 125: keyEvent->keycode = dggui::Key::down; break; + case 117: keyEvent->keycode = dggui::Key::deleteKey; break; + case 51: keyEvent->keycode = dggui::Key::backspace; break; + case 115: keyEvent->keycode = dggui::Key::home; break; + case 119: keyEvent->keycode = dggui::Key::end; break; + case 121: keyEvent->keycode = dggui::Key::pageDown; break; + case 116: keyEvent->keycode = dggui::Key::pageUp; break; + case 36: keyEvent->keycode = dggui::Key::enter; break; + default: keyEvent->keycode = dggui::Key::unknown; break; } - if(strlen(str) && keyEvent->keycode == GUI::Key::unknown) + if(strlen(str) && keyEvent->keycode == dggui::Key::unknown) { - keyEvent->keycode = GUI::Key::character; + keyEvent->keycode = dggui::Key::character; } keyEvent->text = str; // TODO: UTF8 decode - keyEvent->direction = GUI::Direction::up; + keyEvent->direction = dggui::Direction::up; native->pushBackEvent(keyEvent); [super keyUp: event]; @@ -445,7 +445,7 @@ [super dealloc]; } -- (void)bindNative:(GUI::NativeWindowCocoa*)_native +- (void)bindNative:(dggui::NativeWindowCocoa*)_native { native = _native; } @@ -457,7 +457,7 @@ @end -namespace GUI +namespace dggui { struct priv @@ -818,7 +818,7 @@ void NativeWindowCocoa::resized() updateLayerOffset(); } - auto resizeEvent = std::make_shared(); + auto resizeEvent = std::make_shared(); resizeEvent->width = 42; // size is not actually used resizeEvent->height = 42; // size is not actually used pushBackEvent(resizeEvent); @@ -829,4 +829,4 @@ void NativeWindowCocoa::pushBackEvent(std::shared_ptr event) event_queue.push_back(event); } -} // GUI:: +} // dggui:: diff --git a/dggui/nativewindow_pugl.cc b/dggui/nativewindow_pugl.cc index f94b82b..68b1ea9 100644 --- a/dggui/nativewindow_pugl.cc +++ b/dggui/nativewindow_pugl.cc @@ -42,7 +42,7 @@ #include -namespace GUI +namespace dggui { NativeWindowPugl::NativeWindowPugl(void* native_window, Window& window) @@ -379,4 +379,4 @@ void NativeWindowPugl::onKeyboard(PuglView* view, bool press, uint32_t key) native->eventq.push_back(e); } -} // GUI:: +} // dggui:: diff --git a/dggui/nativewindow_pugl.h b/dggui/nativewindow_pugl.h index 6a667f4..c76b157 100644 --- a/dggui/nativewindow_pugl.h +++ b/dggui/nativewindow_pugl.h @@ -34,7 +34,7 @@ extern "C" #include -namespace GUI +namespace dggui { class Event; @@ -80,4 +80,4 @@ private: std::uint32_t last_click{0}; }; -} // GUI:: +} // dggui:: diff --git a/dggui/nativewindow_win32.cc b/dggui/nativewindow_win32.cc index 4b31130..db785e9 100644 --- a/dggui/nativewindow_win32.cc +++ b/dggui/nativewindow_win32.cc @@ -32,7 +32,7 @@ #include "window.h" -namespace GUI +namespace dggui { static BOOL trackMouse(HWND hwnd) @@ -581,4 +581,4 @@ Point NativeWindowWin32::translateToScreen(const Point& point) return { p.x, p.y }; } -} // GUI:: +} // dggui:: diff --git a/dggui/nativewindow_win32.h b/dggui/nativewindow_win32.h index 046b38a..f4748fe 100644 --- a/dggui/nativewindow_win32.h +++ b/dggui/nativewindow_win32.h @@ -34,7 +34,8 @@ #include typedef HWND WNDID; -namespace GUI { +namespace dggui +{ class Window; class Event; @@ -75,4 +76,4 @@ private: bool always_on_top{false}; }; -} // GUI:: +} // dggui:: diff --git a/dggui/nativewindow_x11.cc b/dggui/nativewindow_x11.cc index 33dde7b..04f1b35 100644 --- a/dggui/nativewindow_x11.cc +++ b/dggui/nativewindow_x11.cc @@ -41,7 +41,7 @@ #include "window.h" -namespace GUI +namespace dggui { #define _NET_WM_STATE_REMOVE 0 // remove/unset property @@ -712,4 +712,4 @@ void NativeWindowX11::updateImageFromBuffer(std::size_t x1, std::size_t y1, } } -} // GUI:: +} // dggui:: diff --git a/dggui/nativewindow_x11.h b/dggui/nativewindow_x11.h index cb56fbc..bed86bd 100644 --- a/dggui/nativewindow_x11.h +++ b/dggui/nativewindow_x11.h @@ -33,7 +33,7 @@ #include "nativewindow.h" -namespace GUI +namespace dggui { class Window; @@ -96,4 +96,4 @@ private: EventQueue event_queue; }; -} // GUI:: +} // dggui:: diff --git a/dggui/painter.cc b/dggui/painter.cc index f746f83..c326601 100644 --- a/dggui/painter.cc +++ b/dggui/painter.cc @@ -35,7 +35,7 @@ #include "image.h" #include "canvas.h" -namespace GUI +namespace dggui { Painter::Painter(Canvas& canvas) @@ -641,4 +641,4 @@ void Painter::drawBar(int x, int y, const Bar& bar, int width, int height) bar.right->width(), height); } -} // GUI:: +} // dggui:: diff --git a/dggui/painter.h b/dggui/painter.h index 9bf7fbf..09c490d 100644 --- a/dggui/painter.h +++ b/dggui/painter.h @@ -31,7 +31,7 @@ #include "colour.h" #include "pixelbuffer.h" -namespace GUI +namespace dggui { class Font; @@ -100,4 +100,4 @@ void Painter::draw(Iterator begin, Iterator end, int x_offset, int y_offset, Col } } -} // GUI:: +} // dggui:: diff --git a/dggui/pixelbuffer.cc b/dggui/pixelbuffer.cc index 3c666cd..531ac22 100644 --- a/dggui/pixelbuffer.cc +++ b/dggui/pixelbuffer.cc @@ -32,7 +32,7 @@ #include #include -namespace GUI +namespace dggui { PixelBuffer::PixelBuffer(std::size_t width, std::size_t height) @@ -366,4 +366,4 @@ const std::uint8_t* PixelBufferAlpha::getLine(std::size_t x, std::size_t y) cons return buf + (x + y * width) * 4; } -} // GUI:: +} // dggui:: diff --git a/dggui/pixelbuffer.h b/dggui/pixelbuffer.h index 5c11d14..58fec00 100644 --- a/dggui/pixelbuffer.h +++ b/dggui/pixelbuffer.h @@ -34,7 +34,7 @@ #include "guievent.h" -namespace GUI +namespace dggui { class PixelBuffer @@ -98,4 +98,4 @@ public: bool has_last{false}; }; -} // GUI:: +} // dggui:: diff --git a/dggui/powerbutton.cc b/dggui/powerbutton.cc index 5bf2a2c..8a204f2 100644 --- a/dggui/powerbutton.cc +++ b/dggui/powerbutton.cc @@ -28,7 +28,7 @@ #include "painter.h" -namespace GUI +namespace dggui { PowerButton::PowerButton(Widget* parent) : Toggle(parent) @@ -85,4 +85,4 @@ void PowerButton::repaintEvent(RepaintEvent* repaintEvent) } } -} // GUI:: +} // dggui:: diff --git a/dggui/powerbutton.h b/dggui/powerbutton.h index 14dbeca..a752c53 100644 --- a/dggui/powerbutton.h +++ b/dggui/powerbutton.h @@ -29,7 +29,7 @@ #include "texture.h" #include "toggle.h" -namespace GUI +namespace dggui { class PowerButton : public Toggle @@ -55,4 +55,4 @@ private: Texture disabled_clicked{getImageCache(), ":resources/bypass_button.png", 80, 0, 16, 16}; }; -} // GUI:: +} // dggui:: diff --git a/dggui/progressbar.cc b/dggui/progressbar.cc index dd3e130..1f833f9 100644 --- a/dggui/progressbar.cc +++ b/dggui/progressbar.cc @@ -26,7 +26,7 @@ */ #include "progressbar.h" -namespace GUI +namespace dggui { ProgressBar::ProgressBar(Widget *parent) @@ -101,4 +101,4 @@ void ProgressBar::repaintEvent(RepaintEvent* repaintEvent) } -} // GUI:: +} // dggui:: diff --git a/dggui/progressbar.h b/dggui/progressbar.h index 76cc6fd..a67687b 100644 --- a/dggui/progressbar.h +++ b/dggui/progressbar.h @@ -32,7 +32,7 @@ #include "painter.h" #include "texturedbox.h" -namespace GUI +namespace dggui { enum class ProgressBarState @@ -86,4 +86,4 @@ private: std::size_t value{0}; }; -} // GUI:: +} // dggui:: diff --git a/dggui/resource.cc b/dggui/resource.cc index 52aca0a..1e4d95e 100644 --- a/dggui/resource.cc +++ b/dggui/resource.cc @@ -43,7 +43,7 @@ extern const rc_data_t* rc_data; -namespace GUI +namespace dggui { // TODO: Replace with std::filesystem::is_regular_file once we update the @@ -191,4 +191,4 @@ bool Resource::valid() return isValid; } -} // GUI:: +} // dggui:: diff --git a/dggui/resource.h b/dggui/resource.h index 5f7b3b4..f298287 100644 --- a/dggui/resource.h +++ b/dggui/resource.h @@ -28,9 +28,11 @@ #include -namespace GUI { +namespace dggui +{ -class Resource { +class Resource +{ public: Resource(const std::string& name); @@ -47,4 +49,4 @@ protected: size_t internalSize{0}; }; -} // GUI:: +} // dggui:: diff --git a/dggui/resource_data.h b/dggui/resource_data.h index d685e13..0da3720 100644 --- a/dggui/resource_data.h +++ b/dggui/resource_data.h @@ -26,8 +26,9 @@ */ #pragma once -typedef struct { +struct rc_data_t +{ const char *name; unsigned int size; const char *data; -} rc_data_t; +}; diff --git a/dggui/scrollbar.cc b/dggui/scrollbar.cc index 9a17d1d..e78aab3 100644 --- a/dggui/scrollbar.cc +++ b/dggui/scrollbar.cc @@ -30,7 +30,8 @@ #include "painter.h" -namespace GUI { +namespace dggui +{ ScrollBar::ScrollBar(Widget *parent) : Widget(parent) @@ -211,4 +212,4 @@ void ScrollBar::buttonEvent(ButtonEvent* buttonEvent) dragging = (buttonEvent->direction == Direction::down); } -} // GUI:: +} // dggui:: diff --git a/dggui/scrollbar.h b/dggui/scrollbar.h index 5e60673..9bc4de8 100644 --- a/dggui/scrollbar.h +++ b/dggui/scrollbar.h @@ -32,9 +32,12 @@ #include "texture.h" #include "notifier.h" -namespace GUI { +namespace dggui +{ -class ScrollBar : public Widget { +class ScrollBar + : public Widget +{ friend class ListBoxBasic; public: ScrollBar(Widget *parent); @@ -71,4 +74,4 @@ private: Texture bg_img{getImageCache(), ":resources/widget.png", 7, 7, 1, 63}; }; -} // GUI:: +} // dggui:: diff --git a/dggui/slider.cc b/dggui/slider.cc index 15a82b3..bb42f34 100644 --- a/dggui/slider.cc +++ b/dggui/slider.cc @@ -31,7 +31,7 @@ #include #include -namespace GUI +namespace dggui { Slider::Slider(Widget* parent) : Widget(parent) @@ -214,4 +214,4 @@ void Slider::recomputeCurrentValue(float x) } } -} // GUI:: +} // dggui:: diff --git a/dggui/slider.h b/dggui/slider.h index 90905fd..b249c91 100644 --- a/dggui/slider.h +++ b/dggui/slider.h @@ -30,7 +30,7 @@ #include "texturedbox.h" #include "widget.h" -namespace GUI +namespace dggui { class Slider @@ -150,4 +150,4 @@ private: void recomputeCurrentValue(float x); }; -} // GUI:: +} // dggui:: diff --git a/dggui/stackedwidget.cc b/dggui/stackedwidget.cc index 05f8f3c..a89dc04 100644 --- a/dggui/stackedwidget.cc +++ b/dggui/stackedwidget.cc @@ -26,7 +26,7 @@ */ #include "stackedwidget.h" -namespace GUI +namespace dggui { StackedWidget::StackedWidget(Widget *parent) @@ -148,4 +148,4 @@ void StackedWidget::sizeChanged(int width, int height) } } -} // GUI:: +} // dggui:: diff --git a/dggui/stackedwidget.h b/dggui/stackedwidget.h index 24213f7..a08065b 100644 --- a/dggui/stackedwidget.h +++ b/dggui/stackedwidget.h @@ -31,7 +31,7 @@ #include "widget.h" #include "notifier.h" -namespace GUI +namespace dggui { //! A StackedWidget is a widget containing a list of widgets but only showing @@ -78,4 +78,4 @@ private: std::list widgets; }; -} // GUI:: +} // dggui:: diff --git a/dggui/tabbutton.cc b/dggui/tabbutton.cc index 6a27f61..a2b0549 100644 --- a/dggui/tabbutton.cc +++ b/dggui/tabbutton.cc @@ -28,7 +28,7 @@ #include "painter.h" -namespace GUI +namespace dggui { static TabID getNextTabID() @@ -129,4 +129,4 @@ void TabButton::clickHandler() switchTabNotifier(tab_widget); } -} // GUI:: +} // dggui:: diff --git a/dggui/tabbutton.h b/dggui/tabbutton.h index 1e9371a..ac9a37c 100644 --- a/dggui/tabbutton.h +++ b/dggui/tabbutton.h @@ -32,7 +32,7 @@ #include "font.h" #include "texturedbox.h" -namespace GUI +namespace dggui { class ScrollEvent; @@ -82,4 +82,4 @@ private: Font font{":resources/fontemboss.png"}; }; -} // GUI:: +} // dggui:: diff --git a/dggui/tabwidget.cc b/dggui/tabwidget.cc index 635f1bd..1714472 100644 --- a/dggui/tabwidget.cc +++ b/dggui/tabwidget.cc @@ -28,7 +28,7 @@ #include "painter.h" -namespace GUI +namespace dggui { TabWidget::TabWidget(Widget *parent) @@ -211,4 +211,4 @@ const TabButton* TabWidget::getButtonFromWidget(const Widget* tab_widget) return nullptr; } -} // GUI:: +} // dggui:: diff --git a/dggui/tabwidget.h b/dggui/tabwidget.h index 129826a..750ed59 100644 --- a/dggui/tabwidget.h +++ b/dggui/tabwidget.h @@ -31,7 +31,7 @@ #include "stackedwidget.h" #include "texture.h" -namespace GUI +namespace dggui { class TabWidget @@ -81,4 +81,4 @@ private: std::size_t tab_width{64}; }; -} // GUI:: +} // dggui:: diff --git a/dggui/textedit.cc b/dggui/textedit.cc index 9688b82..f8aeab7 100644 --- a/dggui/textedit.cc +++ b/dggui/textedit.cc @@ -28,7 +28,7 @@ #include "painter.h" -namespace GUI +namespace dggui { TextEdit::TextEdit(Widget* parent) : Widget(parent), scroll(this) @@ -198,4 +198,4 @@ void TextEdit::scrolled(int value) redraw(); } -} // GUI:: +} // dggui:: diff --git a/dggui/textedit.h b/dggui/textedit.h index 17a04ff..c07774b 100644 --- a/dggui/textedit.h +++ b/dggui/textedit.h @@ -35,7 +35,7 @@ #include "texturedbox.h" #include "widget.h" -namespace GUI +namespace dggui { class TextEdit @@ -89,4 +89,4 @@ private: std::vector preprocessed_text; }; -} // GUI:: +} // dggui:: diff --git a/dggui/texture.cc b/dggui/texture.cc index 8cd7040..788835f 100644 --- a/dggui/texture.cc +++ b/dggui/texture.cc @@ -26,7 +26,7 @@ */ #include "texture.h" -namespace GUI +namespace dggui { Texture::Texture(ImageCache& image_cache, const std::string& filename, @@ -69,4 +69,4 @@ bool Texture::hasAlpha() const return true; } -} // GUI:: +} // dggui:: diff --git a/dggui/texture.h b/dggui/texture.h index c751ed4..d75b47a 100644 --- a/dggui/texture.h +++ b/dggui/texture.h @@ -32,7 +32,7 @@ #include "imagecache.h" #include "image.h" -namespace GUI +namespace dggui { class Texture @@ -61,4 +61,4 @@ private: Colour outOfRange{0.0f, 0.0f, 0.0f, 0.0f}; }; -} // GUI:: +} // dggui:: diff --git a/dggui/texturedbox.cc b/dggui/texturedbox.cc index e48353a..c19b8d6 100644 --- a/dggui/texturedbox.cc +++ b/dggui/texturedbox.cc @@ -28,7 +28,7 @@ #include -namespace GUI +namespace dggui { TexturedBox::TexturedBox(ImageCache& image_cache, const std::string& filename, @@ -144,4 +144,4 @@ bool TexturedBox::hasAlpha() const return true; } -} // GUI:: +} // dggui:: diff --git a/dggui/texturedbox.h b/dggui/texturedbox.h index 7aa3967..48febba 100644 --- a/dggui/texturedbox.h +++ b/dggui/texturedbox.h @@ -30,7 +30,7 @@ #include "imagecache.h" #include "texture.h" -namespace GUI +namespace dggui { class TexturedBox @@ -116,4 +116,4 @@ private: Colour outOfRange{0.0f, 0.0f, 0.0f, 0.0f}; }; -} // GUI:: +} // dggui:: diff --git a/dggui/toggle.cc b/dggui/toggle.cc index 39587de..e655a65 100644 --- a/dggui/toggle.cc +++ b/dggui/toggle.cc @@ -26,7 +26,7 @@ */ #include "toggle.h" -namespace GUI +namespace dggui { Toggle::Toggle(Widget* parent) : Widget(parent) @@ -107,4 +107,4 @@ void Toggle::internalSetChecked(bool checked) redraw(); } -} // GUI:: +} // dggui:: diff --git a/dggui/toggle.h b/dggui/toggle.h index 3466459..0fa844b 100644 --- a/dggui/toggle.h +++ b/dggui/toggle.h @@ -30,7 +30,7 @@ #include -namespace GUI +namespace dggui { class Toggle : public Widget @@ -67,4 +67,4 @@ private: void internalSetChecked(bool checked); }; -} // GUI:: +} // dggui:: diff --git a/dggui/tooltip.cc b/dggui/tooltip.cc index e251ed5..b55b45e 100644 --- a/dggui/tooltip.cc +++ b/dggui/tooltip.cc @@ -31,7 +31,7 @@ #include "window.h" #include -namespace GUI +namespace dggui { Tooltip::Tooltip(Widget *parent) @@ -197,4 +197,4 @@ void Tooltip::buttonEvent(ButtonEvent* buttonEvent) } } -} // GUI:: +} // dggui:: diff --git a/dggui/tooltip.h b/dggui/tooltip.h index 9d1619d..1ba1cd8 100644 --- a/dggui/tooltip.h +++ b/dggui/tooltip.h @@ -36,7 +36,7 @@ #include "texturedbox.h" #include "font.h" -namespace GUI +namespace dggui { class Tooltip @@ -75,4 +75,4 @@ private: Widget* activating_widget; }; -} // GUI:: +} // dggui:: diff --git a/dggui/uitranslation.cc b/dggui/uitranslation.cc index 0546be8..c12d646 100644 --- a/dggui/uitranslation.cc +++ b/dggui/uitranslation.cc @@ -30,6 +30,9 @@ #include "resource.h" +namespace dggui +{ + UITranslation::UITranslation() { auto lang = Translation::getISO639LanguageName(); @@ -37,7 +40,7 @@ UITranslation::UITranslation() std::string res = ":locale/"; res += lang + ".mo"; - GUI::Resource mo(res); + Resource mo(res); if(!mo.valid()) { printf("Locale not in resources - use default\n"); @@ -48,4 +51,5 @@ UITranslation::UITranslation() load(mo.data(), mo.size()); } +} // ::dggui #endif // WITH_NLS diff --git a/dggui/uitranslation.h b/dggui/uitranslation.h index 5341255..3258e21 100644 --- a/dggui/uitranslation.h +++ b/dggui/uitranslation.h @@ -31,6 +31,9 @@ #include #ifdef WITH_NLS +namespace dggui +{ + class UITranslation : public Translation { @@ -38,4 +41,6 @@ public: UITranslation(); ~UITranslation() = default; }; + +} // ::dggui #endif diff --git a/dggui/utf8.cc b/dggui/utf8.cc index 747e726..c516f52 100644 --- a/dggui/utf8.cc +++ b/dggui/utf8.cc @@ -26,6 +26,9 @@ */ #include "utf8.h" +namespace dggui +{ + UTF8::UTF8() { // Encode Map @@ -359,3 +362,5 @@ std::string UTF8::toLatin1(std::string const& s) return ret; } + +} // ::dggui diff --git a/dggui/utf8.h b/dggui/utf8.h index 04c26b1..c7cf2ac 100644 --- a/dggui/utf8.h +++ b/dggui/utf8.h @@ -29,6 +29,9 @@ #include #include +namespace dggui +{ + // Class to convert utf8 to latin1 and the other way around. class UTF8 { @@ -45,3 +48,5 @@ private: std::unordered_map map_encode; std::unordered_map map_decode; }; + +} // ::dggui diff --git a/dggui/verticalline.cc b/dggui/verticalline.cc index 6a3a98a..d068b82 100644 --- a/dggui/verticalline.cc +++ b/dggui/verticalline.cc @@ -28,7 +28,8 @@ #include "painter.h" -namespace GUI { +namespace dggui +{ VerticalLine::VerticalLine(Widget *parent) : Widget(parent) @@ -48,4 +49,4 @@ void VerticalLine::repaintEvent(RepaintEvent* repaintEvent) vline, width(), vline.height()); } -} // GUI:: +} // dggui:: diff --git a/dggui/verticalline.h b/dggui/verticalline.h index 3403244..2479d0d 100644 --- a/dggui/verticalline.h +++ b/dggui/verticalline.h @@ -29,9 +29,12 @@ #include "widget.h" #include "image.h" -namespace GUI { +namespace dggui +{ -class VerticalLine : public Widget { +class VerticalLine + : public Widget +{ public: VerticalLine(Widget* parent); virtual ~VerticalLine() = default; @@ -44,4 +47,4 @@ private: Image vline; }; -} // GUI:: +} // dggui:: diff --git a/dggui/widget.cc b/dggui/widget.cc index da6b1e2..077fa72 100644 --- a/dggui/widget.cc +++ b/dggui/widget.cc @@ -31,7 +31,7 @@ #include "painter.h" #include "window.h" -namespace GUI +namespace dggui { Widget::Widget(Widget* parent) @@ -294,4 +294,4 @@ std::size_t Widget::translateToWindowY() return window_y; } -} // GUI:: +} // dggui:: diff --git a/dggui/widget.h b/dggui/widget.h index b9436b7..bf391c5 100644 --- a/dggui/widget.h +++ b/dggui/widget.h @@ -34,7 +34,7 @@ #include -namespace GUI +namespace dggui { struct Point @@ -136,4 +136,4 @@ protected: bool dirty{true}; }; -} // GUI:: +} // dggui:: diff --git a/dggui/window.cc b/dggui/window.cc index 5e0ad31..19af2ad 100644 --- a/dggui/window.cc +++ b/dggui/window.cc @@ -44,7 +44,7 @@ #include "nativewindow_pugl.h" #endif // !UI_PUGL -namespace GUI +namespace dggui { Window::Window(void* native_window) @@ -263,4 +263,4 @@ bool Window::updateBuffer() return true; } -} // GUI:: +} // dggui:: diff --git a/dggui/window.h b/dggui/window.h index 6031500..5f6952f 100644 --- a/dggui/window.h +++ b/dggui/window.h @@ -34,7 +34,7 @@ #include "eventhandler.h" #include "imagecache.h" -namespace GUI +namespace dggui { class Window @@ -116,4 +116,4 @@ protected: ImageCache image_cache; }; -} // GUI:: +} // dggui:: diff --git a/drumgizmo/dgvalidator.cc b/drumgizmo/dgvalidator.cc index 1b21c59..c4d4d46 100644 --- a/drumgizmo/dgvalidator.cc +++ b/drumgizmo/dgvalidator.cc @@ -360,7 +360,7 @@ int main(int argc, char* argv[]) else { // Check if the image_map can be loaded (is a valid png file) - GUI::Image img(image); + dggui::Image img(image); if(!img.isValid()) { logger(LogLevel::Error, "Drumkit image, '" + image + @@ -392,7 +392,7 @@ int main(int argc, char* argv[]) else { // Check if the image_map can be loaded (is a valid png file) - GUI::Image image(image_map); + dggui::Image image(image_map); if(!image.isValid()) { logger(LogLevel::Error, "Drumkit image_map, '" + image_map + @@ -423,7 +423,7 @@ int main(int argc, char* argv[]) float red = (hex_colour >> 16 & 0xff) / 255.0f; float green = (hex_colour >> 8 & 0xff) / 255.0f; float blue = (hex_colour >> 0 & 0xff) / 255.0f; - GUI::Colour colour(red, green, blue); + dggui::Colour colour(red, green, blue); bool found{false}; for(int y = 0; y < image.height() && !found; ++y) @@ -548,7 +548,7 @@ int main(int argc, char* argv[]) else { // Check if the logo can be loaded (is a valid png file) - GUI::Image img(image); + dggui::Image img(image); if(!img.isValid()) { logger(LogLevel::Error, "Drumkit logo, '" + image + diff --git a/plugin/drumgizmo_plugin.cc b/plugin/drumgizmo_plugin.cc index b955eb3..671fab6 100644 --- a/plugin/drumgizmo_plugin.cc +++ b/plugin/drumgizmo_plugin.cc @@ -176,7 +176,7 @@ bool DrumGizmoPlugin::hasInlineGUI() } class InlinePixelBufferAlpha - : public GUI::PixelBufferAlpha + : public dggui::PixelBufferAlpha { public: InlinePixelBufferAlpha(Plugin::InlineDrawContext& context) @@ -190,7 +190,7 @@ public: }; class InlineCanvas - : public GUI::Canvas + : public dggui::Canvas { public: InlineCanvas(Plugin::InlineDrawContext& context) @@ -199,7 +199,7 @@ public: } // From Canvas: - GUI::PixelBufferAlpha& getPixelBuffer() override + dggui::PixelBufferAlpha& getPixelBuffer() override { return pixbuf; } @@ -257,7 +257,7 @@ void DrumGizmoPlugin::onInlineRedraw(std::size_t width, context.data = (unsigned char*)inlineDisplayBuffer; InlineCanvas canvas(context); - GUI::Painter painter(canvas); + dggui::Painter painter(canvas); double progress = (double)settingsGetter.number_of_files_loaded.getValue() / diff --git a/plugin/drumgizmo_plugin.h b/plugin/drumgizmo_plugin.h index 4ecf489..09cdcba 100644 --- a/plugin/drumgizmo_plugin.h +++ b/plugin/drumgizmo_plugin.h @@ -188,23 +188,23 @@ private: ConfigStringIO config_string_io; SettingsGetter settingsGetter{settings}; - GUI::ImageCache imageCache; - GUI::TexturedBox box{imageCache, ":resources/progress.png", + dggui::ImageCache imageCache; + dggui::TexturedBox box{imageCache, ":resources/progress.png", 0, 0, // atlas offset (x, y) 6, 1, 6, // dx1, dx2, dx3 11, 0, 0}; // dy1, dy2, dy3 - GUI::TexturedBox bar_red{imageCache, ":resources/progress.png", + dggui::TexturedBox bar_red{imageCache, ":resources/progress.png", 13, 0, // atlas offset (x, y) 2, 1, 2, // dx1, dx2, dx3 11, 0, 0}; // dy1, dy2, dy3 - GUI::TexturedBox bar_green{imageCache, ":resources/progress.png", + dggui::TexturedBox bar_green{imageCache, ":resources/progress.png", 18, 0, // atlas offset (x, y) 2, 1, 2, // dx1, dx2, dx3 11, 0, 0}; // dy1, dy2, dy3 - GUI::TexturedBox bar_blue{imageCache, ":resources/progress.png", + dggui::TexturedBox bar_blue{imageCache, ":resources/progress.png", 23, 0, // atlas offset (x, y) 2, 1, 2, // dx1, dx2, dx3 11, 0, 0}; // dy1, dy2, dy3 @@ -213,10 +213,10 @@ private: std::shared_ptr drumgizmo; std::uint32_t inlineDisplayBuffer[1024*1024]; - GUI::Image inline_display_image{":resources/logo.png"}; + dggui::Image inline_display_image{":resources/logo.png"}; bool inline_image_first_draw{true}; #ifdef WITH_NLS - UITranslation translation; + dggui::UITranslation translation; #endif // WITH_NLS }; diff --git a/plugingui/abouttab.cc b/plugingui/abouttab.cc index 094ed5d..b6b1325 100644 --- a/plugingui/abouttab.cc +++ b/plugingui/abouttab.cc @@ -37,13 +37,13 @@ std::string getLocalizedFile(const std::string& file) { auto language = Translation::getISO639LanguageName(); std::string file_localized = file + "." + language; - GUI::Resource resource_localized{file_localized}; + dggui::Resource resource_localized{file_localized}; if(resource_localized.valid()) { return resource_localized.data(); } - GUI::Resource resource{file}; + dggui::Resource resource{file}; if(resource.valid()) { return resource.data(); @@ -56,8 +56,8 @@ std::string getLocalizedFile(const std::string& file) namespace GUI { -AboutTab::AboutTab(Widget* parent) - : Widget(parent) +AboutTab::AboutTab(dggui::Widget* parent) + : dggui::Widget(parent) { text_edit.setText(getAboutText()); text_edit.setReadOnly(true); @@ -68,7 +68,7 @@ AboutTab::AboutTab(Widget* parent) void AboutTab::resize(std::size_t width, std::size_t height) { - Widget::resize(width, height); + dggui::Widget::resize(width, height); text_edit.resize(std::max((int)width - 2*margin, 0), std::max((int)height - 2*margin, 0)); } @@ -83,7 +83,7 @@ std::string AboutTab::getAboutText() " About\n" "=============\n" "\n")); - about_text.append(UTF8().toLatin1(getLocalizedFile(":../ABOUT"))); + about_text.append(dggui::UTF8().toLatin1(getLocalizedFile(":../ABOUT"))); // Version about_text.append(_( @@ -101,7 +101,7 @@ std::string AboutTab::getAboutText() " Bugs\n" "=============\n" "\n")); - about_text.append(UTF8().toLatin1(getLocalizedFile(":../BUGS"))); + about_text.append(dggui::UTF8().toLatin1(getLocalizedFile(":../BUGS"))); // Authors about_text.append(_( @@ -110,7 +110,7 @@ std::string AboutTab::getAboutText() " Authors\n" "=============\n" "\n")); - about_text.append(UTF8().toLatin1(getLocalizedFile(":../AUTHORS"))); + about_text.append(dggui::UTF8().toLatin1(getLocalizedFile(":../AUTHORS"))); // GPL about_text.append(_( @@ -119,7 +119,7 @@ std::string AboutTab::getAboutText() " License\n" "=============\n" "\n")); - about_text.append(UTF8().toLatin1(getLocalizedFile(":../COPYING"))); + about_text.append(dggui::UTF8().toLatin1(getLocalizedFile(":../COPYING"))); return about_text; } diff --git a/plugingui/abouttab.h b/plugingui/abouttab.h index 99653d1..48c9137 100644 --- a/plugingui/abouttab.h +++ b/plugingui/abouttab.h @@ -36,10 +36,10 @@ namespace GUI { class AboutTab - : public Widget + : public dggui::Widget { public: - AboutTab(Widget* parent); + AboutTab(dggui::Widget* parent); // From Widget: void resize(std::size_t width, std::size_t height) override; @@ -47,7 +47,7 @@ public: private: std::string getAboutText(); - TextEdit text_edit{this}; + dggui::TextEdit text_edit{this}; int margin{10}; }; diff --git a/plugingui/bleedcontrolframecontent.cc b/plugingui/bleedcontrolframecontent.cc index b999062..e5e46c9 100644 --- a/plugingui/bleedcontrolframecontent.cc +++ b/plugingui/bleedcontrolframecontent.cc @@ -35,19 +35,19 @@ namespace GUI { -BleedcontrolframeContent::BleedcontrolframeContent(Widget* parent, +BleedcontrolframeContent::BleedcontrolframeContent(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier) - : Widget(parent) + : dggui::Widget(parent) , slider_width{250} , settings(settings) , settings_notifier(settings_notifier) { label_text.setText(_("Master Bleed Volume:")); - label_text.setAlignment(TextAlignment::center); + label_text.setAlignment(dggui::TextAlignment::center); label_value.setText(_("0 %")); - label_value.setAlignment(TextAlignment::center); + label_value.setAlignment(dggui::TextAlignment::center); CONNECT(this, settings_notifier.master_bleed, this, &BleedcontrolframeContent::bleedSettingsValueChanged); @@ -57,7 +57,7 @@ BleedcontrolframeContent::BleedcontrolframeContent(Widget* parent, void BleedcontrolframeContent::resize(std::size_t width, std::size_t height) { - Widget::resize(width, height); + dggui::Widget::resize(width, height); slider_width = 0.8 * width; auto x_start = 0.1 * width; @@ -75,12 +75,14 @@ void BleedcontrolframeContent::setEnabled(bool enabled) { this->enabled = enabled; - if (enabled) { + if(enabled) + { label_text.resetColour(); label_value.resetColour(); slider.setEnabled(true); } - else { + else + { label_text.setColour(0.7); label_value.setColour(0.7); slider.setEnabled(false); @@ -95,7 +97,7 @@ void BleedcontrolframeContent::bleedSettingsValueChanged(float value) int percentage = 100 * value; label_value.setText(std::to_string(percentage) + " %"); - slider.setColour(Slider::Colour::Blue); + slider.setColour(dggui::Slider::Colour::Blue); } void BleedcontrolframeContent::bleedValueChanged(float value) diff --git a/plugingui/bleedcontrolframecontent.h b/plugingui/bleedcontrolframecontent.h index d4f6c2e..fadb98e 100644 --- a/plugingui/bleedcontrolframecontent.h +++ b/plugingui/bleedcontrolframecontent.h @@ -35,10 +35,11 @@ class SettingsNotifier; namespace GUI { -class BleedcontrolframeContent : public Widget +class BleedcontrolframeContent + : public dggui::Widget { public: - BleedcontrolframeContent(Widget* parent, + BleedcontrolframeContent(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier); @@ -53,10 +54,10 @@ private: bool enabled = true; - Label label_text{this}; - Label label_value{this}; + dggui::Label label_text{this}; + dggui::Label label_value{this}; - Slider slider{this}; + dggui::Slider slider{this}; int slider_width; diff --git a/plugingui/diskstreamingframecontent.cc b/plugingui/diskstreamingframecontent.cc index 97937df..4c63817 100644 --- a/plugingui/diskstreamingframecontent.cc +++ b/plugingui/diskstreamingframecontent.cc @@ -35,22 +35,22 @@ namespace GUI { -DiskstreamingframeContent::DiskstreamingframeContent(Widget* parent, +DiskstreamingframeContent::DiskstreamingframeContent(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier) - : Widget(parent) + : dggui::Widget(parent) , slider_width{250} , settings(settings) , settings_notifier(settings_notifier) { label_text.setText(_("Cache limit (max memory usage):")); - label_text.setAlignment(TextAlignment::center); + label_text.setAlignment(dggui::TextAlignment::center); button.setText(_("Apply")); button.setEnabled(false); label_value.setText(_("0 MB")); - label_value.setAlignment(TextAlignment::center); + label_value.setAlignment(dggui::TextAlignment::center); CONNECT(this, settings_notifier.disk_cache_upper_limit, this, &DiskstreamingframeContent::limitSettingsValueChanged); @@ -73,7 +73,7 @@ DiskstreamingframeContent::DiskstreamingframeContent(Widget* parent, void DiskstreamingframeContent::resize(std::size_t width, std::size_t height) { - Widget::resize(width, height); + dggui::Widget::resize(width, height); int slider_button_gap = 10; @@ -98,14 +98,16 @@ void DiskstreamingframeContent::limitSettingsValueChanged(std::size_t value) float new_slider_value = (float)(value - min_limit)/(max_limit - min_limit); slider.setValue(new_slider_value); - if (new_slider_value < 0.99) { + if(new_slider_value < 0.99) + { int value_in_mb = value/(1024 * 1024); label_value.setText(std::to_string(value_in_mb) + " MB"); - slider.setColour(Slider::Colour::Blue); + slider.setColour(dggui::Slider::Colour::Blue); } - else { + else + { label_value.setText(_("Unlimited")); - slider.setColour(Slider::Colour::Grey); + slider.setColour(dggui::Slider::Colour::Grey); } button.setEnabled(true); diff --git a/plugingui/diskstreamingframecontent.h b/plugingui/diskstreamingframecontent.h index 1f7ab39..10ed90a 100644 --- a/plugingui/diskstreamingframecontent.h +++ b/plugingui/diskstreamingframecontent.h @@ -37,10 +37,11 @@ class SettingsNotifier; namespace GUI { -class DiskstreamingframeContent : public Widget +class DiskstreamingframeContent + : public dggui::Widget { public: - DiskstreamingframeContent(Widget* parent, + DiskstreamingframeContent(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier); @@ -57,11 +58,11 @@ private: static constexpr std::size_t min_limit = 1024.0 * 1024.0 * 32; static constexpr std::size_t max_limit = 1024.0 * 1024.0 * 1024.0 * 4.0 - 1; - Label label_text{this}; - Label label_value{this}; + dggui::Label label_text{this}; + dggui::Label label_value{this}; - Slider slider{this}; - Button button{this}; + dggui::Slider slider{this}; + dggui::Button button{this}; int slider_width; int button_width; diff --git a/plugingui/drumkitframecontent.cc b/plugingui/drumkitframecontent.cc index 2bdff7a..9549d75 100644 --- a/plugingui/drumkitframecontent.cc +++ b/plugingui/drumkitframecontent.cc @@ -35,11 +35,11 @@ namespace GUI { -BrowseFile::BrowseFile(Widget* parent) - : Widget(parent) +BrowseFile::BrowseFile(dggui::Widget* parent) + : dggui::Widget(parent) { layout.setResizeChildren(false); - layout.setVAlignment(VAlignment::center); + layout.setVAlignment(dggui::VAlignment::center); layout.setSpacing(gap); layout.addItem(&lineedit); @@ -50,7 +50,7 @@ BrowseFile::BrowseFile(Widget* parent) void BrowseFile::resize(std::size_t width, std::size_t height) { - Widget::resize(width, height); + dggui::Widget::resize(width, height); lineedit_width = std::max((int)(0.77 * (int)width - gap), 0); button_width = std::max((int)width - lineedit_width - gap, 0); @@ -71,26 +71,26 @@ std::size_t BrowseFile::getButtonWidth() return button_width; } -Button& BrowseFile::getBrowseButton() +dggui::Button& BrowseFile::getBrowseButton() { return browse_button; } -LineEdit& BrowseFile::getLineEdit() +dggui::LineEdit& BrowseFile::getLineEdit() { return lineedit; } -DrumkitframeContent::DrumkitframeContent(Widget* parent, +DrumkitframeContent::DrumkitframeContent(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier, Config& config) - : Widget(parent) + : dggui::Widget(parent) , settings(settings) , settings_notifier(settings_notifier) , config(config) { - layout.setHAlignment(HAlignment::left); + layout.setHAlignment(dggui::HAlignment::left); drumkit_caption.setText(_("Drumkit file:")); midimap_caption.setText(_("Midimap file:")); @@ -110,20 +110,20 @@ DrumkitframeContent::DrumkitframeContent(Widget* parent, CONNECT(this, settings_notifier.drumkit_file, - &drumkit_file.getLineEdit(), &LineEdit::setText); + &drumkit_file.getLineEdit(), &dggui::LineEdit::setText); CONNECT(this, settings_notifier.drumkit_load_status, this, &DrumkitframeContent::setDrumKitLoadStatus); CONNECT(this, settings_notifier.midimap_file, - &midimap_file.getLineEdit(), &LineEdit::setText); + &midimap_file.getLineEdit(), &dggui::LineEdit::setText); CONNECT(this, settings_notifier.midimap_load_status, this, &DrumkitframeContent::setMidiMapLoadStatus); CONNECT(this, settings_notifier.number_of_files, - &drumkit_file_progress, &ProgressBar::setTotal); + &drumkit_file_progress, &dggui::ProgressBar::setTotal); CONNECT(this, settings_notifier.number_of_files_loaded, - &drumkit_file_progress, &ProgressBar::setValue); + &drumkit_file_progress, &dggui::ProgressBar::setValue); CONNECT(this, file_browser. defaultPathChangedNotifier, this, &DrumkitframeContent::defaultPathChanged); @@ -136,7 +136,7 @@ DrumkitframeContent::DrumkitframeContent(Widget* parent, void DrumkitframeContent::resize(std::size_t width, std::size_t height) { - Widget::resize(width, height); + dggui::Widget::resize(width, height); drumkit_caption.resize(width, 15); drumkit_file.resize(width, 37); @@ -169,8 +169,8 @@ void DrumkitframeContent::kitBrowseClick() CONNECT(&file_browser, fileSelectNotifier, this, &DrumkitframeContent::selectKitFile); file_browser.show(); - Point p{ window()->x() + (int)window()->width() / 2, - window()->y() + (int)window()->height() / 2 }; + dggui::Point p{ window()->x() + (int)window()->width() / 2, + window()->y() + (int)window()->height() / 2 }; auto p0 = window()->translateToScreen(p); auto sz = file_browser.window()->getNativeSize(); file_browser.move(p0.x - sz.width / 2, @@ -197,8 +197,8 @@ void DrumkitframeContent::midimapBrowseClick() CONNECT(&file_browser, fileSelectNotifier, this, &DrumkitframeContent::selectMapFile); file_browser.show(); - Point p{ window()->x() + (int)window()->width() / 2, - window()->y() + (int)window()->height() / 2 }; + dggui::Point p{ window()->x() + (int)window()->width() / 2, + window()->y() + (int)window()->height() / 2 }; auto p0 = window()->translateToScreen(p); auto sz = file_browser.window()->getNativeSize(); file_browser.move(p0.x - sz.width / 2, @@ -229,18 +229,18 @@ void DrumkitframeContent::selectMapFile(const std::string& filename) void DrumkitframeContent::setDrumKitLoadStatus(LoadStatus load_status) { - ProgressBarState state = ProgressBarState::Blue; + auto state = dggui::ProgressBarState::Blue; switch(load_status) { case LoadStatus::Idle: case LoadStatus::Loading: - state = ProgressBarState::Blue; + state = dggui::ProgressBarState::Blue; break; case LoadStatus::Done: - state = ProgressBarState::Green; + state = dggui::ProgressBarState::Green; break; case LoadStatus::Error: - state = ProgressBarState::Red; + state = dggui::ProgressBarState::Red; break; } @@ -249,7 +249,7 @@ void DrumkitframeContent::setDrumKitLoadStatus(LoadStatus load_status) void DrumkitframeContent::setMidiMapLoadStatus(LoadStatus load_status) { - ProgressBarState state = ProgressBarState::Blue; + auto state = dggui::ProgressBarState::Blue; switch(load_status) { case LoadStatus::Idle: @@ -257,15 +257,15 @@ void DrumkitframeContent::setMidiMapLoadStatus(LoadStatus load_status) break; case LoadStatus::Loading: midimap_file_progress.setValue(1); - state = ProgressBarState::Blue; + state = dggui::ProgressBarState::Blue; break; case LoadStatus::Done: midimap_file_progress.setValue(2); - state = ProgressBarState::Green; + state = dggui::ProgressBarState::Green; break; case LoadStatus::Error: midimap_file_progress.setValue(2); - state = ProgressBarState::Red; + state = dggui::ProgressBarState::Red; break; } diff --git a/plugingui/drumkitframecontent.h b/plugingui/drumkitframecontent.h index 3661d8e..4c5cc9e 100644 --- a/plugingui/drumkitframecontent.h +++ b/plugingui/drumkitframecontent.h @@ -42,10 +42,10 @@ namespace GUI class Config; class BrowseFile - : public Widget + : public dggui::Widget { public: - BrowseFile(Widget* parent); + BrowseFile(dggui::Widget* parent); // From Widget virtual void resize(std::size_t width, std::size_t height) override; @@ -53,14 +53,14 @@ public: std::size_t getLineEditWidth(); std::size_t getButtonWidth(); - Button& getBrowseButton(); - LineEdit& getLineEdit(); + dggui::Button& getBrowseButton(); + dggui::LineEdit& getLineEdit(); private: - HBoxLayout layout{this}; + dggui::HBoxLayout layout{this}; - LineEdit lineedit{this}; - Button browse_button{this}; + dggui::LineEdit lineedit{this}; + dggui::Button browse_button{this}; int lineedit_width; int button_width; @@ -68,10 +68,10 @@ private: }; class DrumkitframeContent - : public Widget + : public dggui::Widget { public: - DrumkitframeContent(Widget* parent, + DrumkitframeContent(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier, Config& config); @@ -91,14 +91,14 @@ private: void setDrumKitLoadStatus(LoadStatus load_status); void setMidiMapLoadStatus(LoadStatus load_status); - VBoxLayout layout{this}; + dggui::VBoxLayout layout{this}; - Label drumkit_caption{this}; - Label midimap_caption{this}; + dggui::Label drumkit_caption{this}; + dggui::Label midimap_caption{this}; BrowseFile drumkit_file{this}; BrowseFile midimap_file{this}; - ProgressBar drumkit_file_progress{this}; - ProgressBar midimap_file_progress{this}; + dggui::ProgressBar drumkit_file_progress{this}; + dggui::ProgressBar midimap_file_progress{this}; FileBrowser file_browser{this}; diff --git a/plugingui/drumkittab.cc b/plugingui/drumkittab.cc index 46c448e..6323e94 100644 --- a/plugingui/drumkittab.cc +++ b/plugingui/drumkittab.cc @@ -42,10 +42,10 @@ namespace GUI { -DrumkitTab::DrumkitTab(Widget* parent, +DrumkitTab::DrumkitTab(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier) - : Widget(parent) + : dggui::Widget(parent) , settings(settings) , settings_notifier(settings_notifier) { @@ -65,11 +65,11 @@ DrumkitTab::DrumkitTab(Widget* parent, void DrumkitTab::resize(std::size_t width, std::size_t height) { - Widget::resize(width, height); + dggui::Widget::resize(width, height); if(drumkit_image) { - Painter painter(*this); + dggui::Painter painter(*this); painter.clear(); drumkit_image_x = (this->width()-drumkit_image->width())/2; @@ -82,24 +82,24 @@ void DrumkitTab::resize(std::size_t width, std::size_t height) height-instrument_name_label.height()-5); } -void DrumkitTab::buttonEvent(ButtonEvent* buttonEvent) +void DrumkitTab::buttonEvent(dggui::ButtonEvent* buttonEvent) { if(map_image) { - if(buttonEvent->button == MouseButton::right) + if(buttonEvent->button == dggui::MouseButton::right) { - if(buttonEvent->direction == GUI::Direction::down) + if(buttonEvent->direction == dggui::Direction::down) { - Painter painter(*this); + dggui::Painter painter(*this); painter.drawImage(drumkit_image_x, drumkit_image_y, *map_image); shows_overlay = true; redraw(); return; } - if(buttonEvent->direction == GUI::Direction::up) + if(buttonEvent->direction == dggui::Direction::up) { - Painter painter(*this); + dggui::Painter painter(*this); painter.clear(); painter.drawImage(drumkit_image_x, drumkit_image_y, *drumkit_image); @@ -112,20 +112,20 @@ void DrumkitTab::buttonEvent(ButtonEvent* buttonEvent) } } - if(buttonEvent->button == MouseButton::left) + if(buttonEvent->button == dggui::MouseButton::left) { - if(buttonEvent->direction == GUI::Direction::down) + if(buttonEvent->direction == dggui::Direction::down) { triggerAudition(buttonEvent->x, buttonEvent->y); highlightInstrument(current_index); redraw(); } - if(buttonEvent->direction == GUI::Direction::up) + if(buttonEvent->direction == dggui::Direction::up) { if(shows_instrument_overlay) { - Painter painter(*this); + dggui::Painter painter(*this); painter.clear(); painter.drawImage(drumkit_image_x, drumkit_image_y, *drumkit_image); if(shows_overlay) @@ -140,9 +140,9 @@ void DrumkitTab::buttonEvent(ButtonEvent* buttonEvent) } } -void DrumkitTab::scrollEvent(ScrollEvent* scrollEvent) +void DrumkitTab::scrollEvent(dggui::ScrollEvent* scrollEvent) { - current_velocity -= 0.01*scrollEvent->delta; + current_velocity -= 0.01 * scrollEvent->delta; current_velocity = std::max(std::min(current_velocity, 1.0f), 0.0f); updateVelocityLabel(); velocity_label.resizeToText(); @@ -150,18 +150,22 @@ void DrumkitTab::scrollEvent(ScrollEvent* scrollEvent) triggerAudition(scrollEvent->x, scrollEvent->y); } -void DrumkitTab::mouseMoveEvent(MouseMoveEvent* mouseMoveEvent) +void DrumkitTab::mouseMoveEvent(dggui::MouseMoveEvent* mouseMoveEvent) { // change to image coordinates - auto const x = mouseMoveEvent->x - drumkit_image_x; - auto const y = mouseMoveEvent->y - drumkit_image_y; + const auto x = mouseMoveEvent->x - drumkit_image_x; + const auto y = mouseMoveEvent->y - drumkit_image_y; auto index = pos_to_colour_index(x, y); - if(index == current_index) { return; } + if(index == current_index) + { + return; + } + current_index = index; - Painter painter(*this); + dggui::Painter painter(*this); painter.clear(); painter.drawImage(drumkit_image_x, drumkit_image_y, *drumkit_image); if(shows_overlay) @@ -178,7 +182,7 @@ void DrumkitTab::mouseLeaveEvent() { if(map_image && (shows_overlay || shows_instrument_overlay)) { - Painter painter(*this); + dggui::Painter painter(*this); painter.clear(); painter.drawImage(drumkit_image_x, drumkit_image_y, *drumkit_image); @@ -212,8 +216,8 @@ void DrumkitTab::highlightInstrument(int index) { if(index != -1) { - Painter painter(*this); - auto const& colour = colours[index]; + dggui::Painter painter(*this); + const auto& colour = colours[index]; //Colour colour(1.0f, 1.0f, 0.0f); auto const& positions = colour_index_to_positions[index]; painter.draw(positions.begin(), positions.end(), @@ -240,11 +244,11 @@ void DrumkitTab::updateInstrumentLabel(int index) instrument_name_label.resizeToText(); } -void DrumkitTab::init(std::string const& image_file, - std::string const& map_file) +void DrumkitTab::init(const std::string& image_file, + const std::string& map_file) { - drumkit_image = std::make_unique(image_file); - map_image = std::make_unique(map_file); + drumkit_image = std::make_unique(image_file); + map_image = std::make_unique(map_file); // collect all colours and build lookup table auto const height = map_image->height(); @@ -321,7 +325,7 @@ void DrumkitTab::drumkitFileChanged(const std::string& drumkit_file) float red = (hex_colour >> 16 & 0xff) / 255.0f; float green = (hex_colour >> 8 & 0xff) / 255.0f; float blue = (hex_colour >> 0 & 0xff) / 255.0f; - Colour colour(red, green, blue); + dggui::Colour colour(red, green, blue); colour_instrument_pairs.push_back({colour, clickmap.instrument}); } catch(...) diff --git a/plugingui/drumkittab.h b/plugingui/drumkittab.h index 3243fba..ad89fb1 100644 --- a/plugingui/drumkittab.h +++ b/plugingui/drumkittab.h @@ -45,21 +45,21 @@ namespace GUI class Config; class DrumkitTab - : public Widget + : public dggui::Widget { public: - DrumkitTab(Widget* parent, + DrumkitTab(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier); - // From Widget: + // From dggui::Widget: void resize(std::size_t width, std::size_t height) override; - void buttonEvent(ButtonEvent* buttonEvent) override; - void scrollEvent(ScrollEvent* scrollEvent) override; - void mouseMoveEvent(MouseMoveEvent* mouseMoveEvent) override; + void buttonEvent(dggui::ButtonEvent* buttonEvent) override; + void scrollEvent(dggui::ScrollEvent* scrollEvent) override; + void mouseMoveEvent(dggui::MouseMoveEvent* mouseMoveEvent) override; void mouseLeaveEvent() override; - void init(std::string const& image_file, std::string const& map_file); + void init(const std::string& image_file, const std::string& map_file); Notifier imageChangeNotifier; // bool has_valid_image @@ -72,34 +72,34 @@ private: using Position = IndexGrid::Pos; using Positions = std::vector; - std::vector colours; + std::vector colours; IndexGrid pos_to_colour_index; std::vector colour_index_to_positions; std::vector to_instrument_name; struct ColourInstrumentPair { - Colour colour; + dggui::Colour colour; std::string instrument; }; // FIXME: load this from instrument file std::vector colour_instrument_pairs = { - {Colour(0), "Snare"}, - {Colour(255./255, 15./255, 55./255), "KdrumL"}, - {Colour(154./255, 153./255, 33./255), "HihatClosed"}, - {Colour(248./255, 221./255, 37./255), "Tom4"} + {dggui::Colour(0), "Snare"}, + {dggui::Colour(255./255, 15./255, 55./255), "KdrumL"}, + {dggui::Colour(154./255, 153./255, 33./255), "HihatClosed"}, + {dggui::Colour(248./255, 221./255, 37./255), "Tom4"} }; bool shows_overlay{false}; bool shows_instrument_overlay{false}; - std::unique_ptr drumkit_image; - std::unique_ptr map_image; + std::unique_ptr drumkit_image; + std::unique_ptr map_image; int drumkit_image_x; int drumkit_image_y; - Label velocity_label{this}; - Label instrument_name_label{this}; + dggui::Label velocity_label{this}; + dggui::Label instrument_name_label{this}; Settings& settings; SettingsNotifier& settings_notifier; diff --git a/plugingui/filebrowser.cc b/plugingui/filebrowser.cc index 9f322c8..d4fc009 100644 --- a/plugingui/filebrowser.cc +++ b/plugingui/filebrowser.cc @@ -48,8 +48,8 @@ namespace GUI { -FileBrowser::FileBrowser(Widget* parent) - : Dialog(parent, true) +FileBrowser::FileBrowser(dggui::Widget* parent) + : dggui::Dialog(parent, true) , dir(Directory::cwd()) , lbl_path(this) , lineedit(this) @@ -106,7 +106,7 @@ void FileBrowser::setPath(const std::string& path) void FileBrowser::resize(std::size_t width, std::size_t height) { - Dialog::resize(width, height); + dggui::Dialog::resize(width, height); int offset = 0; int brd = 5; // border @@ -139,9 +139,9 @@ void FileBrowser::resize(std::size_t width, std::size_t height) btn_sel.resize(btn_w, btn_h); } -void FileBrowser::repaintEvent(RepaintEvent* repaintEvent) +void FileBrowser::repaintEvent(dggui::RepaintEvent* repaintEvent) { - Painter p(*this); + dggui::Painter p(*this); p.drawImageStretched(0,0, back, width(), height()); } @@ -233,7 +233,7 @@ void FileBrowser::changeDir() return; } - std::vector items; + std::vector items; #if DG_PLATFORM == DG_PLATFORM_WINDOWS if(Directory::isRoot(dir.path()) && (value == "..")) @@ -241,7 +241,7 @@ void FileBrowser::changeDir() DEBUG(filebrowser, _("Showing partitions...\n")); for(auto drive : dir.drives()) { - ListBoxBasic::Item item; + dggui::ListBoxBasic::Item item; item.name = drive.name; item.value = drive.name; items.push_back(item); @@ -271,7 +271,7 @@ void FileBrowser::changeDir() for(auto entry : entries) { - ListBoxBasic::Item item; + dggui::ListBoxBasic::Item item; item.name = entry; item.value = entry; items.push_back(item); diff --git a/plugingui/filebrowser.h b/plugingui/filebrowser.h index 53a058d..0620ef3 100644 --- a/plugingui/filebrowser.h +++ b/plugingui/filebrowser.h @@ -41,10 +41,10 @@ namespace GUI { class FileBrowser - : public Dialog + : public dggui::Dialog { public: - FileBrowser(Widget* parent); + FileBrowser(dggui::Widget* parent); void setPath(const std::string& path); @@ -54,7 +54,7 @@ public: // From Widget: bool isFocusable() override { return true; } - virtual void repaintEvent(RepaintEvent* repaintEvent) override; + virtual void repaintEvent(dggui::RepaintEvent* repaintEvent) override; virtual void resize(std::size_t width, std::size_t height) override; //! Return the filename selected in the browser. @@ -81,16 +81,16 @@ private: void select(const std::string& file); void changeDir(); - Label lbl_path; + dggui::Label lbl_path; - LineEdit lineedit; - ListBox listbox; + dggui::LineEdit lineedit; + dggui::ListBox listbox; - Button btn_sel; - Button btn_def; - Button btn_esc; + dggui::Button btn_sel; + dggui::Button btn_def; + dggui::Button btn_esc; - Image back; + dggui::Image back; bool has_filename{false}; std::string filename; diff --git a/plugingui/humaniservisualiser.cc b/plugingui/humaniservisualiser.cc index 2a17197..1045e31 100644 --- a/plugingui/humaniservisualiser.cc +++ b/plugingui/humaniservisualiser.cc @@ -33,18 +33,21 @@ #include -HumaniserVisualiser::HumaniserVisualiser(GUI::Widget* parent, +namespace GUI +{ + +HumaniserVisualiser::HumaniserVisualiser(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier) - : GUI::Widget(parent) + : dggui::Widget(parent) , canvas(this, settings, settings_notifier) { canvas.move(7, 7); } -void HumaniserVisualiser::repaintEvent(GUI::RepaintEvent *repaintEvent) +void HumaniserVisualiser::repaintEvent(dggui::RepaintEvent *repaintEvent) { - GUI::Painter p(*this); + dggui::Painter p(*this); box.setSize(width(), height()); p.drawImage(0, 0, box); @@ -52,7 +55,7 @@ void HumaniserVisualiser::repaintEvent(GUI::RepaintEvent *repaintEvent) void HumaniserVisualiser::resize(std::size_t width, std::size_t height) { - Widget::resize(width, height); + dggui::Widget::resize(width, height); if(width < 14 || height < 14) { canvas.resize(1, 1); @@ -61,10 +64,10 @@ void HumaniserVisualiser::resize(std::size_t width, std::size_t height) canvas.resize(width - 14, height - 14); } -HumaniserVisualiser::Canvas::Canvas(GUI::Widget* parent, +HumaniserVisualiser::Canvas::Canvas(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier) - : GUI::Widget(parent) + : dggui::Widget(parent) , settings_notifier(settings_notifier) , latency_max_ms(settings.latency_max_ms.load()) , settings(settings) @@ -87,14 +90,14 @@ HumaniserVisualiser::Canvas::Canvas(GUI::Widget* parent, this, &HumaniserVisualiser::Canvas::velocityStddevChanged); } -void HumaniserVisualiser::Canvas::repaintEvent(GUI::RepaintEvent *repaintEvent) +void HumaniserVisualiser::Canvas::repaintEvent(dggui::RepaintEvent *repaintEvent) { if(width() < 1 || height() < 1) { return; } - GUI::Painter p(*this); + dggui::Painter p(*this); p.clear(); @@ -131,26 +134,26 @@ void HumaniserVisualiser::Canvas::repaintEvent(GUI::RepaintEvent *repaintEvent) // Lines if(velocity_enabled) { - p.setColour(GUI::Colour(0.0f, 1.0f, 1.0f)); + p.setColour(dggui::Colour(0.0f, 1.0f, 1.0f)); } else { - p.setColour(GUI::Colour(0.4f, 0.4f, 0.4f)); + p.setColour(dggui::Colour(0.4f, 0.4f, 0.4f)); } p.drawLine(0, y, width(), y); if(latency_enabled) { - p.setColour(GUI::Colour(0.0f, 1.0f, 1.0f)); + p.setColour(dggui::Colour(0.0f, 1.0f, 1.0f)); } else { - p.setColour(GUI::Colour(0.4f, 0.4f, 0.4f)); + p.setColour(dggui::Colour(0.4f, 0.4f, 0.4f)); } p.drawLine(x, 0, x, height()); // Zero-lines - p.setColour(GUI::Colour(0.0f, 1.0f, 0.0f, 0.9f)); + p.setColour(dggui::Colour(0.0f, 1.0f, 0.0f, 0.9f)); p.drawLine(0, height() * 0.2f, width(), height() * 0.2f); p.drawLine(width() / 2, 0, width() / 2, height()); } @@ -196,3 +199,5 @@ void HumaniserVisualiser::Canvas::velocityStddevChanged(float stddev) velocity_stddev = stddev; redraw(); } + +} // ::GUI diff --git a/plugingui/humaniservisualiser.h b/plugingui/humaniservisualiser.h index 41179fa..028f10d 100644 --- a/plugingui/humaniservisualiser.h +++ b/plugingui/humaniservisualiser.h @@ -33,33 +33,36 @@ struct Settings; class SettingsNotifier; +namespace GUI +{ + class HumaniserVisualiser - : public GUI::Widget + : public dggui::Widget { public: - HumaniserVisualiser(GUI::Widget* parent, + HumaniserVisualiser(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier); // From Widget: - virtual void repaintEvent(GUI::RepaintEvent *repaintEvent) override; + virtual void repaintEvent(dggui::RepaintEvent *repaintEvent) override; virtual void resize(std::size_t width, std::size_t height) override; private: - GUI::TexturedBox box{getImageCache(), ":resources/widget.png", + dggui::TexturedBox box{getImageCache(), ":resources/widget.png", 0, 0, // atlas offset (x, y) 7, 1, 7, // dx1, dx2, dx3 7, 63, 7}; // dy1, dy2, dy3 class Canvas - : public GUI::Widget + : public dggui::Widget { public: - Canvas(GUI::Widget* parent, Settings& settings, + Canvas(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier); // From Widget: - virtual void repaintEvent(GUI::RepaintEvent *repaintEvent) override; + virtual void repaintEvent(dggui::RepaintEvent *repaintEvent) override; void latencyEnabledChanged(bool enabled); void velocityEnabledChanged(bool enabled); @@ -69,10 +72,10 @@ private: void latencyLaidbackChanged(float laidback); void velocityStddevChanged(float stddev); - GUI::Texture stddev_h{getImageCache(), ":resources/stddev_horizontal.png"}; - GUI::Texture stddev_h_disabled{getImageCache(), ":resources/stddev_horizontal_disabled.png"}; - GUI::Texture stddev_v{getImageCache(), ":resources/stddev_vertical.png"}; - GUI::Texture stddev_v_disabled{getImageCache(), ":resources/stddev_vertical_disabled.png"}; + dggui::Texture stddev_h{getImageCache(), ":resources/stddev_horizontal.png"}; + dggui::Texture stddev_h_disabled{getImageCache(), ":resources/stddev_horizontal_disabled.png"}; + dggui::Texture stddev_v{getImageCache(), ":resources/stddev_vertical.png"}; + dggui::Texture stddev_v_disabled{getImageCache(), ":resources/stddev_vertical_disabled.png"}; bool latency_enabled{false}; bool velocity_enabled{false}; @@ -90,3 +93,5 @@ private: Canvas canvas; }; + +} // ::GUI diff --git a/plugingui/humanizerframecontent.cc b/plugingui/humanizerframecontent.cc index a4f71e5..aa36b7b 100644 --- a/plugingui/humanizerframecontent.cc +++ b/plugingui/humanizerframecontent.cc @@ -33,10 +33,10 @@ namespace GUI { -HumanizerframeContent::HumanizerframeContent(Widget* parent, +HumanizerframeContent::HumanizerframeContent(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier) - : Widget(parent) + : dggui::Widget(parent) , settings(settings) , settings_notifier(settings_notifier) { @@ -63,14 +63,14 @@ HumanizerframeContent::HumanizerframeContent(Widget* parent, stddev.setControl(&stddev_knob); layout.addItem(&stddev); - layout.setPosition(&attack, GridLayout::GridRange{0, 1, 0, 1}); - layout.setPosition(&falloff, GridLayout::GridRange{1, 2, 0, 1}); - layout.setPosition(&stddev, GridLayout::GridRange{2, 3, 0, 1}); + layout.setPosition(&attack, dggui::GridLayout::GridRange{0, 1, 0, 1}); + layout.setPosition(&falloff, dggui::GridLayout::GridRange{1, 2, 0, 1}); + layout.setPosition(&stddev, dggui::GridLayout::GridRange{2, 3, 0, 1}); CONNECT(this, settings_notifier.velocity_modifier_weight, - &attack_knob, &Knob::setValue); + &attack_knob, &dggui::Knob::setValue); CONNECT(this, settings_notifier.velocity_modifier_falloff, - &falloff_knob, &Knob::setValue); + &falloff_knob, &dggui::Knob::setValue); CONNECT(this, settings_notifier.velocity_stddev, this, &HumanizerframeContent::stddevSettingsValueChanged); diff --git a/plugingui/humanizerframecontent.h b/plugingui/humanizerframecontent.h index ef60b8e..4603132 100644 --- a/plugingui/humanizerframecontent.h +++ b/plugingui/humanizerframecontent.h @@ -41,10 +41,10 @@ namespace GUI { class HumanizerframeContent - : public Widget + : public dggui::Widget { public: - HumanizerframeContent(Widget* parent, + HumanizerframeContent(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier); @@ -57,15 +57,15 @@ private: void stddevSettingsValueChanged(float value); - GridLayout layout{this, 3, 1}; + dggui::GridLayout layout{this, 3, 1}; LabeledControl attack{this, _("pAttack")}; // drummer strength LabeledControl falloff{this, _("pRelease")}; // regain LabeledControl stddev{this, _("pStdDev")}; - Knob attack_knob{&attack}; - Knob falloff_knob{&falloff}; - Knob stddev_knob{&stddev}; + dggui::Knob attack_knob{&attack}; + dggui::Knob falloff_knob{&falloff}; + dggui::Knob stddev_knob{&stddev}; Settings& settings; SettingsNotifier& settings_notifier; diff --git a/plugingui/labeledcontrol.h b/plugingui/labeledcontrol.h index 1972072..693f582 100644 --- a/plugingui/labeledcontrol.h +++ b/plugingui/labeledcontrol.h @@ -37,34 +37,34 @@ namespace GUI { class LabeledControl - : public Widget + : public dggui::Widget { public: using ValueTransformationFunction = std::function; - LabeledControl(Widget* parent, const std::string& name) - : Widget(parent) + LabeledControl(dggui::Widget* parent, const std::string& name) + : dggui::Widget(parent) { layout.setResizeChildren(false); - layout.setHAlignment(HAlignment::center); + layout.setHAlignment(dggui::HAlignment::center); layout.setSpacing(2); caption.setText(name); caption.resize(100, 20); - caption.setAlignment(TextAlignment::center); + caption.setAlignment(dggui::TextAlignment::center); layout.addItem(&caption); } - void setControl(Knob* control) + void setControl(dggui::Knob* control) { layout.addItem(control); CONNECT(control, valueChangedNotifier, this, &LabeledControl::setValue); setValue(control->value()); value.resize(100, 20); - value.setAlignment(TextAlignment::center); + value.setAlignment(dggui::TextAlignment::center); layout.addItem(&value); } @@ -77,9 +77,9 @@ public: float scale{1.0f}; private: - VBoxLayout layout{this}; - Label caption{this}; - Label value{this}; + dggui::VBoxLayout layout{this}; + dggui::Label caption{this}; + dggui::Label value{this}; ValueTransformationFunction value_transformation_func; diff --git a/plugingui/locale/da.po b/plugingui/locale/da.po index 3b74d56..e25235f 100644 --- a/plugingui/locale/da.po +++ b/plugingui/locale/da.po @@ -82,19 +82,19 @@ msgstr "" msgid "0 MB" msgstr "" -#: diskstreamingframecontent.cc:107 +#: diskstreamingframecontent.cc:109 msgid "Unlimited" msgstr "" -#: drumkitframecontent.cc:49 +#: drumkitframecontent.cc:48 msgid "Browse..." msgstr "" -#: drumkitframecontent.cc:96 +#: drumkitframecontent.cc:95 msgid "Drumkit file:" msgstr "" -#: drumkitframecontent.cc:97 +#: drumkitframecontent.cc:96 msgid "Midimap file:" msgstr "" @@ -467,15 +467,15 @@ msgstr "" msgid "About" msgstr "" -#: powerwidget.cc:52 +#: powerwidget.cc:55 msgid "Shelf" msgstr "" -#: powerwidget.cc:210 +#: powerwidget.cc:213 msgid "in" msgstr "" -#: powerwidget.cc:211 +#: powerwidget.cc:214 msgid "out" msgstr "" @@ -503,47 +503,47 @@ msgstr "" msgid "No" msgstr "" -#: statusframecontent.cc:72 +#: statusframecontent.cc:73 msgid "Drumkit status: " msgstr "" -#: statusframecontent.cc:74 +#: statusframecontent.cc:75 msgid "Drumkit name: " msgstr "" -#: statusframecontent.cc:75 +#: statusframecontent.cc:76 msgid "Drumkit description: " msgstr "" -#: statusframecontent.cc:77 +#: statusframecontent.cc:78 msgid "Session buffer size: " msgstr "" -#: statusframecontent.cc:78 +#: statusframecontent.cc:79 msgid "Number of underruns: " msgstr "" -#: statusframecontent.cc:79 +#: statusframecontent.cc:80 msgid "Messages:\n" msgstr "" -#: statusframecontent.cc:88 +#: statusframecontent.cc:89 msgid "No Kit Loaded" msgstr "" -#: statusframecontent.cc:91 statusframecontent.cc:133 +#: statusframecontent.cc:92 statusframecontent.cc:134 msgid "Loading..." msgstr "" -#: statusframecontent.cc:94 statusframecontent.cc:136 +#: statusframecontent.cc:95 statusframecontent.cc:137 msgid "Ready" msgstr "" -#: statusframecontent.cc:97 statusframecontent.cc:139 +#: statusframecontent.cc:98 statusframecontent.cc:140 msgid "Error" msgstr "" -#: statusframecontent.cc:130 +#: statusframecontent.cc:131 msgid "No Midimap Loaded" msgstr "" @@ -551,46 +551,46 @@ msgstr "" msgid "Per-instrument voice limit:" msgstr "" -#: humanizerframecontent.h:61 +#: humanizerframecontent.h:62 msgid "pAttack" msgstr "" -#: humanizerframecontent.h:62 +#: humanizerframecontent.h:63 msgid "pRelease" msgstr "" -#: humanizerframecontent.h:63 +#: humanizerframecontent.h:64 msgid "pStdDev" msgstr "" -#: sampleselectionframecontent.h:61 +#: sampleselectionframecontent.h:62 msgid "pClose" msgstr "" -#: sampleselectionframecontent.h:62 +#: sampleselectionframecontent.h:63 msgid "pDiverse" msgstr "" -#: sampleselectionframecontent.h:63 +#: sampleselectionframecontent.h:64 msgid "pRandom" msgstr "" -#: timingframecontent.h:73 +#: timingframecontent.h:74 msgid "pTightness" msgstr "" -#: timingframecontent.h:74 +#: timingframecontent.h:75 msgid "pTimingRegain" msgstr "" -#: timingframecontent.h:75 +#: timingframecontent.h:76 msgid "pLaidback" msgstr "" -#: voicelimitframecontent.h:66 +#: voicelimitframecontent.h:67 msgid "Max voices" msgstr "" -#: voicelimitframecontent.h:67 +#: voicelimitframecontent.h:68 msgid "Rampdown time" msgstr "" diff --git a/plugingui/locale/drumgizmo.pot b/plugingui/locale/drumgizmo.pot index 88023ab..72e600e 100644 --- a/plugingui/locale/drumgizmo.pot +++ b/plugingui/locale/drumgizmo.pot @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: drumgizmo 0.9.18.1\n" +"Project-Id-Version: drumgizmo 0.9.19\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" @@ -80,19 +80,19 @@ msgstr "" msgid "0 MB" msgstr "" -#: diskstreamingframecontent.cc:107 +#: diskstreamingframecontent.cc:109 msgid "Unlimited" msgstr "" -#: drumkitframecontent.cc:49 +#: drumkitframecontent.cc:48 msgid "Browse..." msgstr "" -#: drumkitframecontent.cc:96 +#: drumkitframecontent.cc:95 msgid "Drumkit file:" msgstr "" -#: drumkitframecontent.cc:97 +#: drumkitframecontent.cc:96 msgid "Midimap file:" msgstr "" @@ -465,15 +465,15 @@ msgstr "" msgid "About" msgstr "" -#: powerwidget.cc:52 +#: powerwidget.cc:55 msgid "Shelf" msgstr "" -#: powerwidget.cc:210 +#: powerwidget.cc:213 msgid "in" msgstr "" -#: powerwidget.cc:211 +#: powerwidget.cc:214 msgid "out" msgstr "" @@ -501,47 +501,47 @@ msgstr "" msgid "No" msgstr "" -#: statusframecontent.cc:72 +#: statusframecontent.cc:73 msgid "Drumkit status: " msgstr "" -#: statusframecontent.cc:74 +#: statusframecontent.cc:75 msgid "Drumkit name: " msgstr "" -#: statusframecontent.cc:75 +#: statusframecontent.cc:76 msgid "Drumkit description: " msgstr "" -#: statusframecontent.cc:77 +#: statusframecontent.cc:78 msgid "Session buffer size: " msgstr "" -#: statusframecontent.cc:78 +#: statusframecontent.cc:79 msgid "Number of underruns: " msgstr "" -#: statusframecontent.cc:79 +#: statusframecontent.cc:80 msgid "Messages:\n" msgstr "" -#: statusframecontent.cc:88 +#: statusframecontent.cc:89 msgid "No Kit Loaded" msgstr "" -#: statusframecontent.cc:91 statusframecontent.cc:133 +#: statusframecontent.cc:92 statusframecontent.cc:134 msgid "Loading..." msgstr "" -#: statusframecontent.cc:94 statusframecontent.cc:136 +#: statusframecontent.cc:95 statusframecontent.cc:137 msgid "Ready" msgstr "" -#: statusframecontent.cc:97 statusframecontent.cc:139 +#: statusframecontent.cc:98 statusframecontent.cc:140 msgid "Error" msgstr "" -#: statusframecontent.cc:130 +#: statusframecontent.cc:131 msgid "No Midimap Loaded" msgstr "" @@ -549,46 +549,46 @@ msgstr "" msgid "Per-instrument voice limit:" msgstr "" -#: humanizerframecontent.h:61 +#: humanizerframecontent.h:62 msgid "pAttack" msgstr "" -#: humanizerframecontent.h:62 +#: humanizerframecontent.h:63 msgid "pRelease" msgstr "" -#: humanizerframecontent.h:63 +#: humanizerframecontent.h:64 msgid "pStdDev" msgstr "" -#: sampleselectionframecontent.h:61 +#: sampleselectionframecontent.h:62 msgid "pClose" msgstr "" -#: sampleselectionframecontent.h:62 +#: sampleselectionframecontent.h:63 msgid "pDiverse" msgstr "" -#: sampleselectionframecontent.h:63 +#: sampleselectionframecontent.h:64 msgid "pRandom" msgstr "" -#: timingframecontent.h:73 +#: timingframecontent.h:74 msgid "pTightness" msgstr "" -#: timingframecontent.h:74 +#: timingframecontent.h:75 msgid "pTimingRegain" msgstr "" -#: timingframecontent.h:75 +#: timingframecontent.h:76 msgid "pLaidback" msgstr "" -#: voicelimitframecontent.h:66 +#: voicelimitframecontent.h:67 msgid "Max voices" msgstr "" -#: voicelimitframecontent.h:67 +#: voicelimitframecontent.h:68 msgid "Rampdown time" msgstr "" diff --git a/plugingui/locale/fr.po b/plugingui/locale/fr.po index a41db20..b46174c 100644 --- a/plugingui/locale/fr.po +++ b/plugingui/locale/fr.po @@ -102,19 +102,19 @@ msgstr "Appliquer" msgid "0 MB" msgstr "" -#: diskstreamingframecontent.cc:107 +#: diskstreamingframecontent.cc:109 msgid "Unlimited" msgstr "Illimité" -#: drumkitframecontent.cc:49 +#: drumkitframecontent.cc:48 msgid "Browse..." msgstr "Naviguer..." -#: drumkitframecontent.cc:96 +#: drumkitframecontent.cc:95 msgid "Drumkit file:" msgstr "Fichier de kit de batterie :" -#: drumkitframecontent.cc:97 +#: drumkitframecontent.cc:96 msgid "Midimap file:" msgstr "Fichier midimap :" @@ -452,8 +452,8 @@ msgid "" "This feature works on a per-instrument basis, e.g., voices played on the " "bass\n" msgstr "" -"Cette caractéristique fonctionne instrument par instrument, c'est-à-dire " -"que les\n" +"Cette caractéristique fonctionne instrument par instrument, c'est-à-dire que " +"les\n" #: maintab.cc:126 msgid "" @@ -467,13 +467,14 @@ msgid "" " * Max voices: The maximum number of voices that should be allowed to " "play.\n" msgstr "" -" * Voix max : le nombre maximum de voix qui peuvent être autorisées à jouer.\n" - +" * Voix max : le nombre maximum de voix qui peuvent être autorisées à " +"jouer.\n" #: maintab.cc:129 msgid " * Rampdown time: How many seconds it takes to silence a voice." msgstr "" -" * Durée de rampe : le nombre de secondes nécessaires pour silencer une voix." +" * Durée de rampe : le nombre de secondes nécessaires pour silencer une " +"voix." #: maintab.cc:134 mainwindow.cc:56 msgid "Drumkit" @@ -531,15 +532,15 @@ msgstr "Principal" msgid "About" msgstr "À propos" -#: powerwidget.cc:52 +#: powerwidget.cc:55 msgid "Shelf" msgstr "Plateau" -#: powerwidget.cc:210 +#: powerwidget.cc:213 msgid "in" msgstr "entrée" -#: powerwidget.cc:211 +#: powerwidget.cc:214 msgid "out" msgstr "sortie" @@ -567,47 +568,47 @@ msgstr "Oui" msgid "No" msgstr "Non" -#: statusframecontent.cc:72 +#: statusframecontent.cc:73 msgid "Drumkit status: " msgstr "Status du kit de batterie : " -#: statusframecontent.cc:74 +#: statusframecontent.cc:75 msgid "Drumkit name: " msgstr "Nom du kit de batterie : " -#: statusframecontent.cc:75 +#: statusframecontent.cc:76 msgid "Drumkit description: " msgstr "Description du kit de batterie : " -#: statusframecontent.cc:77 +#: statusframecontent.cc:78 msgid "Session buffer size: " msgstr "Taille du tampon de session : " -#: statusframecontent.cc:78 +#: statusframecontent.cc:79 msgid "Number of underruns: " msgstr "Nombre de désynchros : " -#: statusframecontent.cc:79 +#: statusframecontent.cc:80 msgid "Messages:\n" msgstr "Messages :\n" -#: statusframecontent.cc:88 +#: statusframecontent.cc:89 msgid "No Kit Loaded" msgstr "pas de kit chargé" -#: statusframecontent.cc:91 statusframecontent.cc:133 +#: statusframecontent.cc:92 statusframecontent.cc:134 msgid "Loading..." msgstr "Chargement..." -#: statusframecontent.cc:94 statusframecontent.cc:136 +#: statusframecontent.cc:95 statusframecontent.cc:137 msgid "Ready" msgstr "Prêt" -#: statusframecontent.cc:97 statusframecontent.cc:139 +#: statusframecontent.cc:98 statusframecontent.cc:140 msgid "Error" msgstr "Erreur" -#: statusframecontent.cc:130 +#: statusframecontent.cc:131 msgid "No Midimap Loaded" msgstr "Pas de midimap chargée" @@ -615,46 +616,46 @@ msgstr "Pas de midimap charg msgid "Per-instrument voice limit:" msgstr "Limite de voix par instrument :" -#: humanizerframecontent.h:61 +#: humanizerframecontent.h:62 msgid "pAttack" msgstr "pAttaque" -#: humanizerframecontent.h:62 +#: humanizerframecontent.h:63 msgid "pRelease" msgstr "pRelâche" -#: humanizerframecontent.h:63 +#: humanizerframecontent.h:64 msgid "pStdDev" msgstr "pDévStd" -#: sampleselectionframecontent.h:61 +#: sampleselectionframecontent.h:62 msgid "pClose" msgstr "pProche" -#: sampleselectionframecontent.h:62 +#: sampleselectionframecontent.h:63 msgid "pDiverse" msgstr "pDiversité" -#: sampleselectionframecontent.h:63 +#: sampleselectionframecontent.h:64 msgid "pRandom" msgstr "pAléatoire" -#: timingframecontent.h:73 +#: timingframecontent.h:74 msgid "pTightness" msgstr "pRaideur" -#: timingframecontent.h:74 +#: timingframecontent.h:75 msgid "pTimingRegain" msgstr "pRetourTiming" -#: timingframecontent.h:75 +#: timingframecontent.h:76 msgid "pLaidback" msgstr "pNonchalance" -#: voicelimitframecontent.h:66 +#: voicelimitframecontent.h:67 msgid "Max voices" msgstr "Voix max" -#: voicelimitframecontent.h:67 +#: voicelimitframecontent.h:68 msgid "Rampdown time" msgstr "Durée de rampe" diff --git a/plugingui/maintab.cc b/plugingui/maintab.cc index d6da057..5c5fd02 100644 --- a/plugingui/maintab.cc +++ b/plugingui/maintab.cc @@ -31,7 +31,7 @@ namespace GUI { -MainTab::MainTab(Widget* parent, +MainTab::MainTab(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier, Config& config) @@ -166,11 +166,11 @@ MainTab::MainTab(Widget* parent, bleedcontrol_frame.setEnabled(false); CONNECT(this, settings_notifier.enable_velocity_modifier, - &humanizer_frame, &FrameWidget::setOnSwitch); + &humanizer_frame, &dggui::FrameWidget::setOnSwitch); CONNECT(this, settings_notifier.enable_resampling, - &resampling_frame, &FrameWidget::setOnSwitch); + &resampling_frame, &dggui::FrameWidget::setOnSwitch); CONNECT(this, settings_notifier.has_bleed_control, - &bleedcontrol_frame, &FrameWidget::setEnabled); + &bleedcontrol_frame, &dggui::FrameWidget::setEnabled); CONNECT(&humanizer_frame, onSwitchChangeNotifier, this, &MainTab::humanizerOnChange); CONNECT(&bleedcontrol_frame, onSwitchChangeNotifier, @@ -182,7 +182,7 @@ MainTab::MainTab(Widget* parent, CONNECT(&bleedcontrol_frame, onEnabledChanged, &bleedcontrolframe_content, &BleedcontrolframeContent::setEnabled); CONNECT(&settings_notifier, enable_powermap, - &power_frame, &FrameWidget::setOnSwitch); + &power_frame, &dggui::FrameWidget::setOnSwitch); CONNECT(&power_frame, onSwitchChangeNotifier, this, &MainTab::powerOnChange); CONNECT(&voicelimit_frame, onSwitchChangeNotifier, @@ -192,10 +192,10 @@ MainTab::MainTab(Widget* parent, void MainTab::resize(std::size_t width, std::size_t height) { - Widget::resize(width, height); + dggui::Widget::resize(width, height); // DrumGizmo logo - Painter painter(*this); + dggui::Painter painter(*this); painter.clear(); painter.drawImage(width - logo.width(), height - logo.height(), logo); } @@ -230,18 +230,18 @@ void MainTab::voicelimitOnChange(bool status) settings.enable_voice_limit.store(status); } -void MainTab::add(std::string const& title, FrameWidget& frame, Widget& content, - std::size_t height, int column) +void MainTab::add(std::string const& title, dggui::FrameWidget& frame, + dggui::Widget& content, std::size_t height, int column) { layout.addItem(&frame); frame.setTitle(title); frame.setContent(&content); auto grid_start = layout.lastUsedRow(column) + 1; - auto range = GridLayout::GridRange{column, - column + 1, - grid_start, - grid_start + int(height)}; + auto range = dggui::GridLayout::GridRange{column, + column + 1, + grid_start, + grid_start + int(height)}; layout.setPosition(&frame, range); } diff --git a/plugingui/maintab.h b/plugingui/maintab.h index 74b970a..9050061 100644 --- a/plugingui/maintab.h +++ b/plugingui/maintab.h @@ -50,10 +50,10 @@ namespace GUI { class MainTab - : public Widget + : public dggui::Widget { public: - MainTab(Widget* parent, + MainTab(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier, Config& config); @@ -69,21 +69,21 @@ private: void powerOnChange(bool on); void voicelimitOnChange(bool status); - Image logo{":resources/logo.png"}; + dggui::Image logo{":resources/logo.png"}; - GridLayout layout{this, 2, 64}; + dggui::GridLayout layout{this, 2, 64}; - FrameWidget drumkit_frame{this, false}; - FrameWidget status_frame{this, false}; - FrameWidget diskstreaming_frame{this, false}; - FrameWidget bleedcontrol_frame{this, true}; - FrameWidget resampling_frame{this, true}; - FrameWidget humanizer_frame{this, true, true}; - FrameWidget timing_frame{this, true, true}; - FrameWidget sampleselection_frame{this, false, true}; - FrameWidget visualizer_frame{this, false, true}; - FrameWidget power_frame{this, true, true}; - FrameWidget voicelimit_frame{this, true, true}; + dggui::FrameWidget drumkit_frame{this, false}; + dggui::FrameWidget status_frame{this, false}; + dggui::FrameWidget diskstreaming_frame{this, false}; + dggui::FrameWidget bleedcontrol_frame{this, true}; + dggui::FrameWidget resampling_frame{this, true}; + dggui::FrameWidget humanizer_frame{this, true, true}; + dggui::FrameWidget timing_frame{this, true, true}; + dggui::FrameWidget sampleselection_frame{this, false, true}; + dggui::FrameWidget visualizer_frame{this, false, true}; + dggui::FrameWidget power_frame{this, true, true}; + dggui::FrameWidget voicelimit_frame{this, true, true}; DrumkitframeContent drumkitframe_content; StatusframeContent statusframe_content; @@ -97,8 +97,8 @@ private: PowerWidget powerframe_content; VoiceLimitFrameContent voicelimit_content; - void add(std::string const& title, FrameWidget& frame, Widget& content, - std::size_t height, int column); + void add(std::string const& title, dggui::FrameWidget& frame, + dggui::Widget& content, std::size_t height, int column); Settings& settings; SettingsNotifier& settings_notifier; diff --git a/plugingui/mainwindow.cc b/plugingui/mainwindow.cc index ea79cb5..a4ad7b5 100644 --- a/plugingui/mainwindow.cc +++ b/plugingui/mainwindow.cc @@ -38,7 +38,7 @@ namespace GUI { MainWindow::MainWindow(Settings& settings, void* native_window) - : Window(native_window) + : dggui::Window(native_window) , settings_notifier(settings) , main_tab(this, settings, settings_notifier, config) , drumkit_tab(this, settings, settings_notifier) @@ -81,14 +81,14 @@ bool MainWindow::processEvents() return true; } -void MainWindow::repaintEvent(RepaintEvent* repaintEvent) +void MainWindow::repaintEvent(dggui::RepaintEvent* repaintEvent) { if(!visible()) { return; } - Painter painter(*this); + dggui::Painter painter(*this); auto bar_height = tabs.getBarHeight(); diff --git a/plugingui/mainwindow.h b/plugingui/mainwindow.h index efacf07..ae0da8b 100644 --- a/plugingui/mainwindow.h +++ b/plugingui/mainwindow.h @@ -42,7 +42,7 @@ namespace GUI { class MainWindow - : public Window + : public dggui::Window { public: @@ -65,31 +65,31 @@ private: void changeDrumkitTabVisibility(bool visible); // From Widget - void repaintEvent(RepaintEvent* repaintEvent) override final; + void repaintEvent(dggui::RepaintEvent* repaintEvent) override final; Config config; SettingsNotifier settings_notifier; - TabWidget tabs{this}; + dggui::TabWidget tabs{this}; MainTab main_tab; DrumkitTab drumkit_tab; AboutTab about_tab{&tabs}; - Image back{":resources/bg.png"}; + dggui::Image back{":resources/bg.png"}; - TexturedBox sidebar{getImageCache(), ":resources/sidebar.png", + dggui::TexturedBox sidebar{getImageCache(), ":resources/sidebar.png", 0, 0, // offset 16, 0, 0, // delta-x 14, 1, 14}; // delta-y - TexturedBox topbar{getImageCache(), ":resources/topbar.png", + dggui::TexturedBox topbar{getImageCache(), ":resources/topbar.png", 0, 0, // atlas offset (x, y) 1, 1, 1, // dx1, dx2, dx3 17, 1, 1}; // dy1, dy2, dy3 bool closing{false}; - TabID drumkit_tab_id; + dggui::TabID drumkit_tab_id; }; } // GUI:: diff --git a/plugingui/powerwidget.cc b/plugingui/powerwidget.cc index 301f396..9be0c48 100644 --- a/plugingui/powerwidget.cc +++ b/plugingui/powerwidget.cc @@ -38,10 +38,13 @@ #include -PowerWidget::PowerWidget(GUI::Widget* parent, +namespace GUI +{ + +PowerWidget::PowerWidget(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier) - : GUI::Widget(parent) + : dggui::Widget(parent) , canvas(this, settings, settings_notifier) , settings(settings) { @@ -50,12 +53,12 @@ PowerWidget::PowerWidget(GUI::Widget* parent, CONNECT(&shelf_checkbox, stateChangedNotifier, this, &PowerWidget::chk_shelf); shelf_label.setText(_("Shelf")); - shelf_label.setAlignment(GUI::TextAlignment::center); + shelf_label.setAlignment(dggui::TextAlignment::center); shelf_label.resize(59, 16); shelf_checkbox.resize(59, 40); CONNECT(&settings_notifier, powermap_shelf, &shelf_checkbox, - &GUI::CheckBox::setChecked); + &dggui::CheckBox::setChecked); } void PowerWidget::chk_shelf(bool v) @@ -63,9 +66,9 @@ void PowerWidget::chk_shelf(bool v) settings.powermap_shelf.store(v); } -void PowerWidget::repaintEvent(GUI::RepaintEvent *repaintEvent) +void PowerWidget::repaintEvent(dggui::RepaintEvent *repaintEvent) { - GUI::Painter p(*this); + dggui::Painter p(*this); box.setSize(width() - 59 - 64, height()); p.drawImage(0, 0, box); } @@ -84,10 +87,10 @@ void PowerWidget::resize(std::size_t width, std::size_t height) shelf_checkbox.move(width - 59 + 5 - 32, 16); } -PowerWidget::Canvas::Canvas(GUI::Widget* parent, +PowerWidget::Canvas::Canvas(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier) - : GUI::Widget(parent) + : dggui::Widget(parent) , settings_notifier(settings_notifier) , settings(settings) { @@ -115,7 +118,7 @@ PowerWidget::Canvas::Canvas(GUI::Widget* parent, parameterChangedFloat(0); } -void PowerWidget::Canvas::repaintEvent(GUI::RepaintEvent *repaintEvent) +void PowerWidget::Canvas::repaintEvent(dggui::RepaintEvent *repaintEvent) { if(width() < 1 || height() < 1) { @@ -127,29 +130,29 @@ void PowerWidget::Canvas::repaintEvent(GUI::RepaintEvent *repaintEvent) const float width0 = (int)width() - 2 * brd; const float height0 = (int)height() - 2 * brd; - GUI::Painter p(*this); + dggui::Painter p(*this); p.clear(); - p.setColour(GUI::Colour(1.0f, 1.0f, 1.0f, 0.2f)); + p.setColour(dggui::Colour(1.0f, 1.0f, 1.0f, 0.2f)); p.drawRectangle(x0, y0 + height0, x0 + width0, y0); if(enabled) { // draw 1:1 line in grey in the background to indicate where 1:1 is - p.setColour(GUI::Colour(0.5)); + p.setColour(dggui::Colour(0.5)); p.drawLine(x0, y0 + height0, x0 + width0, y0); } if(enabled) { // enabled green - p.setColour(GUI::Colour(0.0f, 1.0f, 0.0f, 1.0f)); + p.setColour(dggui::Colour(0.0f, 1.0f, 0.0f, 1.0f)); } else { // disabled grey - p.setColour(GUI::Colour(0.5f)); + p.setColour(dggui::Colour(0.5f)); } // Draw very short line segments across the region @@ -172,14 +175,14 @@ void PowerWidget::Canvas::repaintEvent(GUI::RepaintEvent *repaintEvent) if(!enabled) { // draw 1:1 line in green in the foreground - p.setColour(GUI::Colour(0.0f, 1.0f, 0.0f, 1.0f)); + p.setColour(dggui::Colour(0.0f, 1.0f, 0.0f, 1.0f)); p.drawLine(x0, y0 + height0, x0 + width0, y0); } // draw the input/output of the last hit if(settings.powermap_input.load() != -1 && settings.powermap_output.load() != -1) { - p.setColour(GUI::Colour(.8f, 0.0f, .2f, .5f)); + p.setColour(dggui::Colour(.8f, 0.0f, .2f, .5f)); p.drawLine(x0 + settings.powermap_input.load()*width0, y0 + height0, x0 + settings.powermap_input.load()*width0, y0); p.drawLine(x0, y0 + height0 - settings.powermap_output.load()*height0, @@ -188,30 +191,30 @@ void PowerWidget::Canvas::repaintEvent(GUI::RepaintEvent *repaintEvent) // draw the fixed nodes of the spline float rad = radius * width(); - p.setColour(GUI::Colour{0.0f, 1.0f, 0.0f, 0.7f}); + p.setColour(dggui::Colour{0.0f, 1.0f, 0.0f, 0.7f}); p.drawFilledCircle(x0 + std::round(settings.powermap_fixed0_x.load() * width0), y0 + height0 - std::round(settings.powermap_fixed0_y.load() * height0), rad); p.drawCircle(x0 + std::round(power_map.getFixed0().in * width0), y0 + height0 - std::round(power_map.getFixed0().out * height0), rad + 1); - p.setColour(GUI::Colour{1.0f, 1.0f, 0.0f, 0.7f}); + p.setColour(dggui::Colour{1.0f, 1.0f, 0.0f, 0.7f}); p.drawFilledCircle(x0 + std::round(settings.powermap_fixed1_x.load() * width0), y0 + height0 - std::round(settings.powermap_fixed1_y.load() * height0), rad); p.drawCircle(x0 + std::round(power_map.getFixed1().in * width0), y0 + height0 - std::round(power_map.getFixed1().out * height0), rad + 1); - p.setColour(GUI::Colour{1.0f, 0.0f, 0.0f, 0.7f}); + p.setColour(dggui::Colour{1.0f, 0.0f, 0.0f, 0.7f}); p.drawFilledCircle(x0 + std::round(settings.powermap_fixed2_x.load() * width0), y0 + height0 - std::round(settings.powermap_fixed2_y.load() * height0), rad); p.drawCircle(x0 + std::round(power_map.getFixed2().in * width0), y0 + height0 - std::round(power_map.getFixed2().out * height0), rad + 1); - p.setColour(GUI::Colour(1.0f, 1.0f, 1.0f, 0.2f)); + p.setColour(dggui::Colour(1.0f, 1.0f, 1.0f, 0.2f)); p.drawText(width() / 2 - (font.textWidth(_("in")) / 2), height() - 8, font, _("in")); p.drawText(8, height() / 2 - (font.textWidth(_("out")) / 2), font, _("out"), false, true); } -void PowerWidget::Canvas::buttonEvent(GUI::ButtonEvent* buttonEvent) +void PowerWidget::Canvas::buttonEvent(dggui::ButtonEvent* buttonEvent) { const float x0 = brd; const float y0 = brd; @@ -226,10 +229,10 @@ void PowerWidget::Canvas::buttonEvent(GUI::ButtonEvent* buttonEvent) switch(buttonEvent->direction) { - case GUI::Direction::up: + case dggui::Direction::up: in_point = -1; break; - case GUI::Direction::down: + case dggui::Direction::down: if(std::abs(mx0 - settings.powermap_fixed0_x.load()) < radius_x && std::abs(my0 - settings.powermap_fixed0_y.load()) < radius_y) { @@ -259,7 +262,7 @@ float clamp(float val, float min, float max) } } -void PowerWidget::Canvas::mouseMoveEvent(GUI::MouseMoveEvent* mouseMoveEvent) +void PowerWidget::Canvas::mouseMoveEvent(dggui::MouseMoveEvent* mouseMoveEvent) { const float x0 = brd; const float y0 = brd; @@ -332,3 +335,5 @@ void PowerWidget::Canvas::parameterChangedBool(bool) { parameterChangedFloat(0); } + +} // ::GUI diff --git a/plugingui/powerwidget.h b/plugingui/powerwidget.h index 8398f75..3a7bb8e 100644 --- a/plugingui/powerwidget.h +++ b/plugingui/powerwidget.h @@ -39,36 +39,39 @@ struct Settings; class SettingsNotifier; +namespace GUI +{ + class PowerWidget - : public GUI::Widget + : public dggui::Widget { public: - PowerWidget(GUI::Widget* parent, + PowerWidget(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier); // From Widget: - virtual void repaintEvent(GUI::RepaintEvent *repaintEvent) override; + virtual void repaintEvent(dggui::RepaintEvent *repaintEvent) override; virtual void resize(std::size_t width, std::size_t height) override; private: - GUI::TexturedBox box{getImageCache(), ":resources/widget.png", + dggui::TexturedBox box{getImageCache(), ":resources/widget.png", 0, 0, // atlas offset (x, y) 7, 1, 7, // dx1, dx2, dx3 7, 63, 7}; // dy1, dy2, dy3 class Canvas - : public GUI::Widget + : public dggui::Widget { public: - Canvas(GUI::Widget* parent, Settings& settings, + Canvas(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier); // From Widget: virtual bool catchMouse() override { return true; } - virtual void repaintEvent(GUI::RepaintEvent *repaintEvent) override; - virtual void buttonEvent(GUI::ButtonEvent* buttonEvent) override; - virtual void mouseMoveEvent(GUI::MouseMoveEvent* mouseMoveEvent) override; + virtual void repaintEvent(dggui::RepaintEvent *repaintEvent) override; + virtual void buttonEvent(dggui::ButtonEvent* buttonEvent) override; + virtual void mouseMoveEvent(dggui::MouseMoveEvent* mouseMoveEvent) override; virtual void mouseLeaveEvent() override; private: @@ -85,14 +88,16 @@ private: int in_point{-1}; const float radius = 0.02f; const float brd = 6.0f; - GUI::Font font{":resources/fontemboss.png"}; + dggui::Font font{":resources/fontemboss.png"}; }; void chk_shelf(bool v); Canvas canvas; - GUI::Label shelf_label{this}; - GUI::CheckBox shelf_checkbox{this}; + dggui::Label shelf_label{this}; + dggui::CheckBox shelf_checkbox{this}; Settings& settings; }; + +} // ::GUI diff --git a/plugingui/resamplingframecontent.cc b/plugingui/resamplingframecontent.cc index 035781f..d92dc27 100644 --- a/plugingui/resamplingframecontent.cc +++ b/plugingui/resamplingframecontent.cc @@ -33,10 +33,10 @@ namespace GUI { -ResamplingframeContent::ResamplingframeContent(Widget* parent, +ResamplingframeContent::ResamplingframeContent(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier) - : Widget(parent) + : dggui::Widget(parent) , settings(settings) , settings_notifier(settings_notifier) { @@ -57,7 +57,7 @@ ResamplingframeContent::ResamplingframeContent(Widget* parent, quality_knob.showValue(false); quality_label.setText(_("Quality")); - quality_label.setAlignment(TextAlignment::center); + quality_label.setAlignment(dggui::TextAlignment::center); quality_label.resize(40, 16); CONNECT(&quality_knob, valueChangedNotifier, diff --git a/plugingui/resamplingframecontent.h b/plugingui/resamplingframecontent.h index e66bec5..3bdddc6 100644 --- a/plugingui/resamplingframecontent.h +++ b/plugingui/resamplingframecontent.h @@ -38,10 +38,10 @@ namespace GUI { class ResamplingframeContent - : public Widget + : public dggui::Widget { public: - ResamplingframeContent(Widget* parent, + ResamplingframeContent(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier); @@ -58,9 +58,9 @@ private: void valueChangedNotifier(float value); private: - TextEdit text_field{this}; - Knob quality_knob{this}; - Label quality_label{this}; + dggui::TextEdit text_field{this}; + dggui::Knob quality_knob{this}; + dggui::Label quality_label{this}; Settings& settings; SettingsNotifier& settings_notifier; diff --git a/plugingui/sampleselectionframecontent.cc b/plugingui/sampleselectionframecontent.cc index a647144..61b816f 100644 --- a/plugingui/sampleselectionframecontent.cc +++ b/plugingui/sampleselectionframecontent.cc @@ -33,10 +33,10 @@ namespace GUI { -SampleselectionframeContent::SampleselectionframeContent(Widget* parent, +SampleselectionframeContent::SampleselectionframeContent(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier) - : Widget(parent) + : dggui::Widget(parent) , settings(settings) , settings_notifier(settings_notifier) { @@ -63,9 +63,9 @@ SampleselectionframeContent::SampleselectionframeContent(Widget* parent, f_random.setControl(&f_random_knob); layout.addItem(&f_random); - layout.setPosition(&f_close, GridLayout::GridRange{0, 1, 0, 1}); - layout.setPosition(&f_diverse, GridLayout::GridRange{1, 2, 0, 1}); - layout.setPosition(&f_random, GridLayout::GridRange{2, 3, 0, 1}); + layout.setPosition(&f_close, dggui::GridLayout::GridRange{0, 1, 0, 1}); + layout.setPosition(&f_diverse, dggui::GridLayout::GridRange{1, 2, 0, 1}); + layout.setPosition(&f_random, dggui::GridLayout::GridRange{2, 3, 0, 1}); CONNECT(this, settings_notifier.sample_selection_f_close, this, &SampleselectionframeContent::fCloseSettingsValueChanged); diff --git a/plugingui/sampleselectionframecontent.h b/plugingui/sampleselectionframecontent.h index d56f545..ab1be04 100644 --- a/plugingui/sampleselectionframecontent.h +++ b/plugingui/sampleselectionframecontent.h @@ -41,10 +41,10 @@ namespace GUI { class SampleselectionframeContent - : public Widget + : public dggui::Widget { public: - SampleselectionframeContent(Widget* parent, + SampleselectionframeContent(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier); @@ -57,15 +57,15 @@ private: void fDiverseSettingsValueChanged(float value); void fRandomSettingsValueChanged(float value); - GridLayout layout{this, 3, 1}; + dggui::GridLayout layout{this, 3, 1}; LabeledControl f_close{this, _("pClose")}; LabeledControl f_diverse{this, _("pDiverse")}; LabeledControl f_random{this, _("pRandom")}; - Knob f_close_knob{&f_close}; - Knob f_diverse_knob{&f_diverse}; - Knob f_random_knob{&f_random}; + dggui::Knob f_close_knob{&f_close}; + dggui::Knob f_diverse_knob{&f_diverse}; + dggui::Knob f_random_knob{&f_random}; Settings& settings; SettingsNotifier& settings_notifier; diff --git a/plugingui/statusframecontent.cc b/plugingui/statusframecontent.cc index 3152dfd..0fe8bf2 100644 --- a/plugingui/statusframecontent.cc +++ b/plugingui/statusframecontent.cc @@ -31,9 +31,10 @@ namespace GUI { -StatusframeContent::StatusframeContent(Widget* parent, +StatusframeContent::StatusframeContent(dggui::Widget* parent, SettingsNotifier& settings_notifier) - : Widget(parent), settings_notifier(settings_notifier) + : dggui::Widget(parent) + , settings_notifier(settings_notifier) { CONNECT(this, settings_notifier.drumkit_load_status, this, &StatusframeContent::updateDrumkitLoadStatus); @@ -62,7 +63,7 @@ StatusframeContent::StatusframeContent(Widget* parent, void StatusframeContent::resize(std::size_t width, std::size_t height) { - Widget::resize(width, height); + dggui::Widget::resize(width, height); text_field.resize(width, height); } diff --git a/plugingui/statusframecontent.h b/plugingui/statusframecontent.h index fdf6d05..55f7a16 100644 --- a/plugingui/statusframecontent.h +++ b/plugingui/statusframecontent.h @@ -36,10 +36,12 @@ class SettingsNotifier; namespace GUI { -class StatusframeContent : public Widget +class StatusframeContent + : public dggui::Widget { public: - StatusframeContent(Widget* parent, SettingsNotifier& settings_notifier); + StatusframeContent(dggui::Widget* parent, + SettingsNotifier& settings_notifier); // From Widget virtual void resize(std::size_t width, std::size_t height) override; @@ -56,7 +58,7 @@ public: void loadStatusTextChanged(const std::string& text); private: - TextEdit text_field{this}; + dggui::TextEdit text_field{this}; SettingsNotifier& settings_notifier; diff --git a/plugingui/testmain.cc b/plugingui/testmain.cc index 4b94083..0ac3bc5 100644 --- a/plugingui/testmain.cc +++ b/plugingui/testmain.cc @@ -40,14 +40,14 @@ int main() { #ifdef WITH_NLS - UITranslation translation; + dggui::UITranslation translation; #endif // WITH_NLS INFO(example, "We are up and running"); void* native_window_handle{nullptr}; #ifndef UI_PUGL - GUI::Window parent{nullptr}; + dggui::Window parent{nullptr}; parent.setCaption("PluginGui Test Application"); native_window_handle = parent.getNativeWindowHandle(); #endif @@ -57,7 +57,7 @@ int main() #ifndef UI_PUGL CONNECT(&parent, eventHandler()->closeNotifier, &main_window, - &GUI::MainWindow::closeEventHandler); + &GUI::MainWindow::closeEventHandler); parent.show(); #endif diff --git a/plugingui/timingframecontent.cc b/plugingui/timingframecontent.cc index ffcd07e..18784f0 100644 --- a/plugingui/timingframecontent.cc +++ b/plugingui/timingframecontent.cc @@ -34,10 +34,10 @@ namespace GUI { -TimingframeContent::TimingframeContent(Widget* parent, +TimingframeContent::TimingframeContent(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier) - : Widget(parent) + : dggui::Widget(parent) , settings(settings) , settings_notifier(settings_notifier) { @@ -65,9 +65,9 @@ TimingframeContent::TimingframeContent(Widget* parent, laidback.setControl(&laidback_knob); layout.addItem(&laidback); - layout.setPosition(&tightness, GridLayout::GridRange{0, 1, 0, 1}); - layout.setPosition(®ain, GridLayout::GridRange{1, 2, 0, 1}); - layout.setPosition(&laidback, GridLayout::GridRange{2, 3, 0, 1}); + layout.setPosition(&tightness, dggui::GridLayout::GridRange{0, 1, 0, 1}); + layout.setPosition(®ain, dggui::GridLayout::GridRange{1, 2, 0, 1}); + layout.setPosition(&laidback, dggui::GridLayout::GridRange{2, 3, 0, 1}); CONNECT(this, settings_notifier.latency_stddev, this, &TimingframeContent::tightnessSettingsValueChanged); diff --git a/plugingui/timingframecontent.h b/plugingui/timingframecontent.h index adecc01..4dfa974 100644 --- a/plugingui/timingframecontent.h +++ b/plugingui/timingframecontent.h @@ -46,10 +46,10 @@ namespace GUI { class TimingframeContent - : public Widget + : public dggui::Widget { public: - TimingframeContent(Widget* parent, + TimingframeContent(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier); @@ -69,15 +69,15 @@ private: void latencyOffsetChanged(int offset); void velocityOffsetChanged(float offset); - GridLayout layout{this, 3, 1}; + dggui::GridLayout layout{this, 3, 1}; LabeledControl tightness{this, _("pTightness")}; LabeledControl regain{this, _("pTimingRegain")}; LabeledControl laidback{this, _("pLaidback")}; - Knob tightness_knob{&tightness}; - Knob regain_knob{®ain}; - Knob laidback_knob{&laidback}; + dggui::Knob tightness_knob{&tightness}; + dggui::Knob regain_knob{®ain}; + dggui::Knob laidback_knob{&laidback}; Settings& settings; SettingsNotifier& settings_notifier; diff --git a/plugingui/visualizerframecontent.cc b/plugingui/visualizerframecontent.cc index d6ea2c2..3404bec 100644 --- a/plugingui/visualizerframecontent.cc +++ b/plugingui/visualizerframecontent.cc @@ -34,17 +34,17 @@ namespace GUI { -VisualizerframeContent::VisualizerframeContent(Widget* parent, +VisualizerframeContent::VisualizerframeContent(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier) - : Widget(parent) + : dggui::Widget(parent) , visualizer(this, settings, settings_notifier) { } void VisualizerframeContent::resize(std::size_t width, std::size_t height) { - Widget::resize(width, height); + dggui::Widget::resize(width, height); visualizer.resize(width, height); } diff --git a/plugingui/visualizerframecontent.h b/plugingui/visualizerframecontent.h index 3012762..abf54c4 100644 --- a/plugingui/visualizerframecontent.h +++ b/plugingui/visualizerframecontent.h @@ -42,10 +42,10 @@ namespace GUI { class VisualizerframeContent - : public Widget + : public dggui::Widget { public: - VisualizerframeContent(Widget* parent, Settings& settings, + VisualizerframeContent(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier); // From Widget diff --git a/plugingui/voicelimitframecontent.cc b/plugingui/voicelimitframecontent.cc index c7c8c28..00036a0 100644 --- a/plugingui/voicelimitframecontent.cc +++ b/plugingui/voicelimitframecontent.cc @@ -30,25 +30,25 @@ namespace GUI { -VoiceLimitFrameContent::VoiceLimitFrameContent(Widget* parent, +VoiceLimitFrameContent::VoiceLimitFrameContent(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier) - : Widget(parent) + : dggui::Widget(parent) , settings(settings) , settings_notifier(settings_notifier) { //Setup frame. label_text.setText(_("Per-instrument voice limit:")); - label_text.setAlignment(TextAlignment::center); + label_text.setAlignment(dggui::TextAlignment::center); //Setup layout layout.setResizeChildren(false); auto setup_control = - [](Knob& knob, + [](dggui::Knob& knob, LabeledControl& label, - GridLayout& layout, - const GridLayout::GridRange& gridrange, + dggui::GridLayout& layout, + const dggui::GridLayout::GridRange& gridrange, float min, float max, float defaultval) diff --git a/plugingui/voicelimitframecontent.h b/plugingui/voicelimitframecontent.h index 0fbc306..2ea1978 100644 --- a/plugingui/voicelimitframecontent.h +++ b/plugingui/voicelimitframecontent.h @@ -41,10 +41,10 @@ namespace GUI { class VoiceLimitFrameContent - : public Widget + : public dggui::Widget { public: - VoiceLimitFrameContent(Widget* parent, + VoiceLimitFrameContent(dggui::Widget* parent, Settings& settings, SettingsNotifier& settings_notifier); @@ -60,15 +60,15 @@ private: Settings& settings; SettingsNotifier& settings_notifier; - Label label_text{this}; + dggui::Label label_text{this}; - GridLayout layout{this, 2, 1}; + dggui::GridLayout layout{this, 2, 1}; LabeledControl lc_max_voices{this, _("Max voices")}; LabeledControl lc_rampdown_time{this, _("Rampdown time")}; - Knob knob_max_voices{&lc_max_voices}; - Knob knob_rampdown_time{&lc_rampdown_time}; + dggui::Knob knob_max_voices{&lc_max_voices}; + dggui::Knob knob_rampdown_time{&lc_rampdown_time}; }; } // GUI:: diff --git a/test/imagecachetest.cc b/test/imagecachetest.cc index 6fa08d4..3e7b4fc 100644 --- a/test/imagecachetest.cc +++ b/test/imagecachetest.cc @@ -30,7 +30,7 @@ #include class TestableImageCache - : public GUI::ImageCache + : public dggui::ImageCache { public: std::size_t count(const std::string& filename) diff --git a/test/paintertest.cc b/test/paintertest.cc index 611693c..5a1c44a 100644 --- a/test/paintertest.cc +++ b/test/paintertest.cc @@ -36,7 +36,7 @@ class TestColour public: TestColour(std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t a) : colour(r, g, b, a) {} - TestColour(const GUI::Colour& colour) + TestColour(const dggui::Colour& colour) : colour(colour) {} bool operator!=(const TestColour& other) const @@ -49,7 +49,7 @@ public: ; } - const GUI::Colour colour; + const dggui::Colour colour; }; std::ostream& operator<<(std::ostream& stream, const TestColour& col) @@ -63,28 +63,28 @@ std::ostream& operator<<(std::ostream& stream, const TestColour& col) } class TestableCanvas - : public GUI::Canvas + : public dggui::Canvas { public: TestableCanvas(std::size_t width, std::size_t height) : pixbuf(width, height) {} - GUI::PixelBufferAlpha& getPixelBuffer() override + dggui::PixelBufferAlpha& getPixelBuffer() override { return pixbuf; } private: - GUI::PixelBufferAlpha pixbuf; + dggui::PixelBufferAlpha pixbuf; }; class TestImage - : public GUI::Image + : public dggui::Image { public: TestImage(std::uint8_t width, std::uint8_t height, bool alpha) - : GUI::Image(":resources/logo.png") // just load some default image + : dggui::Image(":resources/logo.png") // just load some default image { _width = width; _height = height; @@ -98,7 +98,7 @@ public: { for(std::uint8_t y = 0; y < _height; ++y) { - image_data[x + _width * y] = GUI::Colour(x, y, 0, alpha ? 128 : 255); + image_data[x + _width * y] = dggui::Colour(x, y, 0, alpha ? 128 : 255); image_data_raw[4 * (x + _width * y) + 0] = x; image_data_raw[4 * (x + _width * y) + 1] = y; image_data_raw[4 * (x + _width * y) + 2] = 0; @@ -124,35 +124,35 @@ public: void testDrawImage() { // Success criterion is simply to not assert in the drawing routines... - GUI::Image image(":resources/logo.png"); + dggui::Image image(":resources/logo.png"); { // Image fits in pixelbuffer TestableCanvas canvas(image.width(), image.height()); - GUI::Painter painter(canvas); + dggui::Painter painter(canvas); painter.drawImage(0, 0, image); } { // Image fits in pixelbuffer, negative offset TestableCanvas canvas(image.width(), image.height()); - GUI::Painter painter(canvas); + dggui::Painter painter(canvas); painter.drawImage(-10, -10, image); } { // Image too big for pixelbuffer TestableCanvas canvas(image.width() / 2, image.height() / 2); - GUI::Painter painter(canvas); + dggui::Painter painter(canvas); painter.drawImage(0, 0, image); } { // Image fits in pixelbuffer but offset so it is drawn over the edge. TestableCanvas canvas(image.width(), image.height()); - GUI::Painter painter(canvas); + dggui::Painter painter(canvas); painter.drawImage(10, 10, image); } { // Image is offset to the right and down so nothing is to be drawn. TestableCanvas canvas(image.width(), image.height()); - GUI::Painter painter(canvas); + dggui::Painter painter(canvas); painter.drawImage(image.width() + 1, image.height() + 1, image); @@ -160,7 +160,7 @@ public: { // Image is offset to the left and up so nothing is to be drawn. TestableCanvas canvas(image.width(), image.height()); - GUI::Painter painter(canvas); + dggui::Painter painter(canvas); painter.drawImage(-1 * (image.width() + 1), -1 * (image.height() + 1), image); @@ -170,7 +170,7 @@ public: void testDrawText() { // Success criterion is simply to not assert in the drawing routines... - GUI::Font font; + dggui::Font font; // a string with unicode characters std::string someText = "Hello World - лæ Библиотека"; std::size_t width = font.textWidth(someText); @@ -178,31 +178,31 @@ public: { // Text fits in pixelbuffer TestableCanvas canvas(width, height); - GUI::Painter painter(canvas); + dggui::Painter painter(canvas); painter.drawText(0, 0, font, someText); } { // Text fits in pixelbuffer, negative offset TestableCanvas canvas(width, height); - GUI::Painter painter(canvas); + dggui::Painter painter(canvas); painter.drawText(-10, -10, font, someText); } { // Text too big for pixelbuffer TestableCanvas canvas(width / 2, height / 2); - GUI::Painter painter(canvas); + dggui::Painter painter(canvas); painter.drawText(0, 0, font, someText); } { // Text fits in pixelbuffer but offset so it is drawn over the edge. TestableCanvas canvas(width, height); - GUI::Painter painter(canvas); + dggui::Painter painter(canvas); painter.drawText(10, 10, font, someText); } { // Text is offset to the right and down so nothing is to be drawn. TestableCanvas canvas(width, height); - GUI::Painter painter(canvas); + dggui::Painter painter(canvas); painter.drawText(width + 1, height + 1, font, someText); @@ -210,7 +210,7 @@ public: { // Text is offset to the left and up so nothing is to be drawn. TestableCanvas canvas(width, height); - GUI::Painter painter(canvas); + dggui::Painter painter(canvas); painter.drawText(-1 * (width + 1), -1 * (height + 1), font, someText); @@ -221,7 +221,7 @@ public: void testClipping() { TestableCanvas canvas(100, 100); - GUI::Painter painter(canvas); + dggui::Painter painter(canvas); { // Without alpha TestImage image(16, 16, false); diff --git a/test/resource_test.cc b/test/resource_test.cc index 929544c..5781ff2 100644 --- a/test/resource_test.cc +++ b/test/resource_test.cc @@ -31,11 +31,11 @@ #include "drumkit_creator.h" class ResourceTester - : public GUI::Resource + : public dggui::Resource { public: ResourceTester(const std::string& name) - : GUI::Resource(name) + : dggui::Resource(name) {} bool probeIsInternal() diff --git a/test/translationtest.cc b/test/translationtest.cc index 7525881..bf33599 100644 --- a/test/translationtest.cc +++ b/test/translationtest.cc @@ -68,7 +68,7 @@ public: #else setenv("LANG", "da_DK.UTF-8", 1); #endif - UITranslation t; + dggui::UITranslation t; // Look up translation from .mo file uUNIT_ASSERT_EQUAL(std::string("Trommesæt"), diff --git a/test/uitests/benchmarktest.cc b/test/uitests/benchmarktest.cc index 5566942..59a6968 100644 --- a/test/uitests/benchmarktest.cc +++ b/test/uitests/benchmarktest.cc @@ -34,10 +34,10 @@ #include class TimedCanvas - : public GUI::Canvas + : public dggui::Canvas { public: - GUI::PixelBufferAlpha& getPixelBuffer() override + dggui::PixelBufferAlpha& getPixelBuffer() override { return pixbuf; } @@ -48,7 +48,7 @@ public: } private: - GUI::PixelBufferAlpha pixbuf{800, 600}; + dggui::PixelBufferAlpha pixbuf{800, 600}; }; class TimedScope @@ -82,16 +82,16 @@ private: int main() { TimedCanvas canvas; - GUI::Painter painter(canvas); - GUI::Image image_no_alpha(":benchmarktest_resources/image_no_alpha.png"); - GUI::Image image_full_alpha(":benchmarktest_resources/image_full_alpha.png"); - GUI::Image image_edge_alpha(":benchmarktest_resources/image_edge_alpha.png"); - GUI::Image image_inner_alpha(":benchmarktest_resources/image_inner_alpha.png"); + dggui::Painter painter(canvas); + dggui::Image image_no_alpha(":benchmarktest_resources/image_no_alpha.png"); + dggui::Image image_full_alpha(":benchmarktest_resources/image_full_alpha.png"); + dggui::Image image_edge_alpha(":benchmarktest_resources/image_edge_alpha.png"); + dggui::Image image_inner_alpha(":benchmarktest_resources/image_inner_alpha.png"); { TimedCanvas canvas; TimedScope timed("Pixelbuffer resize", 100000); - painter.setColour(GUI::Colour(1.f, 1.f, 1.f, 1.f)); + painter.setColour(dggui::Colour(1.f, 1.f, 1.f, 1.f)); for(int i = 0; i < 100000; ++i) { canvas.resize(i % 1000 + 100, i % 1000 + 100); @@ -108,7 +108,7 @@ int main() { TimedScope timed("Filled rect, with alpha", 100000); - painter.setColour(GUI::Colour(1.f, 1.f, 1.f, 0.5f)); + painter.setColour(dggui::Colour(1.f, 1.f, 1.f, 0.5f)); for(int i = 0; i < 100000; ++i) { painter.drawRectangle(0, 0, 800, 600); @@ -148,11 +148,11 @@ int main() } { - GUI::PixelBuffer wpixbuf(800, 600); - std::vector children; + dggui::PixelBuffer wpixbuf(800, 600); + std::vector children; for(int i = 0; i < 100; ++i) { - auto child = new GUI::PixelBufferAlpha(300, 300); + auto child = new dggui::PixelBufferAlpha(300, 300); child->x = i * 2; child->y = i * 2; children.push_back(child); diff --git a/test/uitests/filebrowsertest.cc b/test/uitests/filebrowsertest.cc index 7c309d9..8cede7e 100644 --- a/test/uitests/filebrowsertest.cc +++ b/test/uitests/filebrowsertest.cc @@ -36,11 +36,11 @@ #include class TestWindow - : public GUI::Window + : public dggui::Window { public: TestWindow() - : GUI::Window(nullptr) + : dggui::Window(nullptr) { setCaption("FileBrowserTest Window"); CONNECT(eventHandler(), closeNotifier, @@ -100,22 +100,22 @@ public: return !closing; } - void repaintEvent(GUI::RepaintEvent* repaintEvent) + void repaintEvent(dggui::RepaintEvent* repaintEvent) { - GUI::Painter painter(*this); + dggui::Painter painter(*this); label.resize(width(), 30); //painter.clear(); - painter.setColour(GUI::Colour(0,1,0)); + painter.setColour(dggui::Colour(0,1,0)); painter.drawFilledRectangle(0, 0, width(), height()); } private: bool closing{false}; - GUI::Button button{this}; - GUI::Label label{this}; + dggui::Button button{this}; + dggui::Label label{this}; GUI::FileBrowser file_browser{this}; }; diff --git a/test/uitests/framewidgettest.cc b/test/uitests/framewidgettest.cc index 4f0e0fd..97f9ed0 100644 --- a/test/uitests/framewidgettest.cc +++ b/test/uitests/framewidgettest.cc @@ -40,65 +40,65 @@ // TODO: fix segfault on close -class Widget1 : public GUI::Widget +class Widget1 : public dggui::Widget { public: - Widget1(GUI::Widget* parent) : GUI::Widget(parent) + Widget1(dggui::Widget* parent) : dggui::Widget(parent) { layout.setResizeChildren(true); - layout.setHAlignment(GUI::HAlignment::center); + layout.setHAlignment(dggui::HAlignment::center); label1.setText("Label1"); - label1.setAlignment(GUI::TextAlignment::left); + label1.setAlignment(dggui::TextAlignment::left); layout.addItem(&label1); label2.setText("Label2"); - label2.setAlignment(GUI::TextAlignment::center); + label2.setAlignment(dggui::TextAlignment::center); layout.addItem(&label2); label3.setText("Label3"); - label3.setAlignment(GUI::TextAlignment::right); + label3.setAlignment(dggui::TextAlignment::right); layout.addItem(&label3); } private: - GUI::VBoxLayout layout{this}; - GUI::Label label1{this}; - GUI::Label label2{this}; - GUI::Label label3{this}; + dggui::VBoxLayout layout{this}; + dggui::Label label1{this}; + dggui::Label label2{this}; + dggui::Label label3{this}; }; -class Widget2 : public GUI::Widget +class Widget2 : public dggui::Widget { public: - Widget2(GUI::Widget* parent) : GUI::Widget(parent) + Widget2(dggui::Widget* parent) : dggui::Widget(parent) { layout.setSpacing(10); layout.setResizeChildren(true); - layout.setVAlignment(GUI::VAlignment::top); + layout.setVAlignment(dggui::VAlignment::top); label1.setText("Label1"); - label1.setAlignment(GUI::TextAlignment::right); + label1.setAlignment(dggui::TextAlignment::right); layout.addItem(&label1); label2.setText("Label2"); - label2.setAlignment(GUI::TextAlignment::left); + label2.setAlignment(dggui::TextAlignment::left); layout.addItem(&label2); layout.addItem(&checkbox); } private: - GUI::HBoxLayout layout{this}; - GUI::Label label1{this}; - GUI::Label label2{this}; - GUI::CheckBox checkbox{this}; + dggui::HBoxLayout layout{this}; + dggui::Label label1{this}; + dggui::Label label2{this}; + dggui::CheckBox checkbox{this}; }; -class TestWindow : public GUI::Window +class TestWindow : public dggui::Window { public: - TestWindow() : GUI::Window(nullptr) + TestWindow() : dggui::Window(nullptr) { setCaption("FrameWidgetTest Window"); CONNECT(eventHandler(), closeNotifier, this, @@ -107,7 +107,7 @@ public: layout.setSpacing(10); layout.setResizeChildren(true); - layout.setHAlignment(GUI::HAlignment::center); + layout.setHAlignment(dggui::HAlignment::center); layout.addItem(&frame1); layout.addItem(&frame2); @@ -141,22 +141,22 @@ public: return !closing; } - void repaintEvent(GUI::RepaintEvent* repaintEvent) override + void repaintEvent(dggui::RepaintEvent* repaintEvent) override { - GUI::Painter painter(*this); - painter.setColour(GUI::Colour(0.85)); + dggui::Painter painter(*this); + painter.setColour(dggui::Colour(0.85)); painter.drawFilledRectangle(0, 0, width() - 1, height() - 1); } private: bool closing{false}; - GUI::VBoxLayout layout{this}; + dggui::VBoxLayout layout{this}; - GUI::FrameWidget frame1{this, true}; - GUI::FrameWidget frame2{this, false}; - GUI::FrameWidget frame3{this, true}; - GUI::FrameWidget frame4{this, false}; + dggui::FrameWidget frame1{this, true}; + dggui::FrameWidget frame2{this, false}; + dggui::FrameWidget frame3{this, true}; + dggui::FrameWidget frame4{this, false}; Widget1 w1_1{this}; Widget1 w1_2{this}; diff --git a/test/uitests/powerwidgettest.cc b/test/uitests/powerwidgettest.cc index 41aff67..4d01168 100644 --- a/test/uitests/powerwidgettest.cc +++ b/test/uitests/powerwidgettest.cc @@ -43,11 +43,11 @@ #include class TestWindow - : public GUI::Window + : public dggui::Window { public: TestWindow() - : GUI::Window() + : dggui::Window() { setCaption("PowerWidgetTest Window"); CONNECT(eventHandler(), closeNotifier, this, @@ -96,10 +96,10 @@ public: return !closing; } - void repaintEvent(GUI::RepaintEvent* repaintEvent) override + void repaintEvent(dggui::RepaintEvent* repaintEvent) override { - GUI::Painter painter(*this); - painter.setColour(GUI::Colour(0.85)); + dggui::Painter painter(*this); + painter.setColour(dggui::Colour(0.85)); painter.drawFilledRectangle(0, 0, width() - 1, height() - 1); } @@ -108,7 +108,7 @@ private: Settings settings; SettingsNotifier settings_notifier{settings}; - PowerWidget w{this, settings, settings_notifier}; + GUI::PowerWidget w{this, settings, settings_notifier}; }; int main() diff --git a/test/uitests/resizetest.cc b/test/uitests/resizetest.cc index 28439d1..17748bf 100644 --- a/test/uitests/resizetest.cc +++ b/test/uitests/resizetest.cc @@ -35,11 +35,11 @@ #include class TestWindow - : public GUI::Window + : public dggui::Window { public: TestWindow() - : GUI::Window(nullptr) + : dggui::Window(nullptr) { setCaption("ResizeTest Window"); CONNECT(eventHandler(), closeNotifier, @@ -71,19 +71,19 @@ public: return !closing; } - void repaintEvent(GUI::RepaintEvent* repaintEvent) + void repaintEvent(dggui::RepaintEvent* repaintEvent) { - GUI::Painter painter(*this); + dggui::Painter painter(*this); //painter.clear(); - painter.setColour(GUI::Colour(0,1,0)); + painter.setColour(dggui::Colour(0,1,0)); painter.drawFilledRectangle(0, 0, width(), height()); auto currentSize = std::make_pair(width(), height()); auto currentPosition = std::make_pair(x(), y()); { - painter.setColour(GUI::Colour(1,0,0)); + painter.setColour(dggui::Colour(1,0,0)); char str[64]; sprintf(str, "reported: (%d, %d); (%d, %d)", (int)reportedPosition.first, @@ -98,7 +98,7 @@ public: } { - painter.setColour(GUI::Colour(1,0,0)); + painter.setColour(dggui::Colour(1,0,0)); char str[64]; sprintf(str, "current: (%d, %d); (%d, %d)", (int)currentPosition.first, @@ -115,7 +115,7 @@ public: private: bool closing{false}; - GUI::Font font{":resources/font.png"}; + dggui::Font font{":resources/font.png"}; std::pair reportedSize; std::pair reportedPosition; }; diff --git a/test/uitests/tabwidgettest.cc b/test/uitests/tabwidgettest.cc index 36a69cc..804e979 100644 --- a/test/uitests/tabwidgettest.cc +++ b/test/uitests/tabwidgettest.cc @@ -38,67 +38,67 @@ #include class Widget1 - : public GUI::Widget + : public dggui::Widget { public: - Widget1(GUI::Widget* parent) - : GUI::Widget(parent) + Widget1(dggui::Widget* parent) + : dggui::Widget(parent) { layout.setResizeChildren(true); - layout.setHAlignment(GUI::HAlignment::center); + layout.setHAlignment(dggui::HAlignment::center); label1.setText("Label1"); - label1.setAlignment(GUI::TextAlignment::left); + label1.setAlignment(dggui::TextAlignment::left); layout.addItem(&label1); label2.setText("Label2"); - label2.setAlignment(GUI::TextAlignment::center); + label2.setAlignment(dggui::TextAlignment::center); layout.addItem(&label2); label3.setText("Label3"); - label3.setAlignment(GUI::TextAlignment::right); + label3.setAlignment(dggui::TextAlignment::right); layout.addItem(&label3); } private: - GUI::VBoxLayout layout{this}; - GUI::Label label1{this}; - GUI::Label label2{this}; - GUI::Label label3{this}; + dggui::VBoxLayout layout{this}; + dggui::Label label1{this}; + dggui::Label label2{this}; + dggui::Label label3{this}; }; class Widget2 - : public GUI::Button + : public dggui::Button { public: - Widget2(GUI::Widget* parent) - : GUI::Button(parent) + Widget2(dggui::Widget* parent) + : dggui::Button(parent) { setText("Widget2"); } }; class Widget3 - : public GUI::Widget + : public dggui::Widget { public: - Widget3(GUI::Widget* parent) - : GUI::Widget(parent) + Widget3(dggui::Widget* parent) + : dggui::Widget(parent) { label.move(100, 80); label.resize(100, 20); label.setText("Widget3"); } private: - GUI::Label label{this}; + dggui::Label label{this}; }; class TestWindow - : public GUI::Window + : public dggui::Window { public: TestWindow() - : GUI::Window(nullptr) + : dggui::Window(nullptr) { setCaption("TabWidgetTest Window"); CONNECT(eventHandler(), closeNotifier, @@ -126,16 +126,16 @@ public: return !closing; } - void repaintEvent(GUI::RepaintEvent* repaintEvent) override + void repaintEvent(dggui::RepaintEvent* repaintEvent) override { - GUI::Painter painter(*this); - painter.setColour(GUI::Colour(0.85)); + dggui::Painter painter(*this); + painter.setColour(dggui::Colour(0.85)); painter.drawFilledRectangle(0, 0, width() - 1, height() - 1); } private: bool closing{false}; - GUI::TabWidget tabs{this}; + dggui::TabWidget tabs{this}; Widget1 widget1{this}; Widget2 widget2{this}; Widget3 widget3{this}; -- cgit v1.2.3