summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-04-20 20:16:48 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2017-04-20 20:16:48 +0200
commitc73f9e2632f9614bba748aed857e2a648126a963 (patch)
tree151bffe31dede7b17335004bad8014b3bb5b7837
parent815d4eeae5a10bb1dbdd9e8810523644dfbadc5f (diff)
Change resource paths to be relative to the plugingui folder instead of the resources folder. Make rcgen run atomatically to re-generate resource_data.cc if one of the resource files changes.
-rw-r--r--plugingui/Makefile.am29
-rw-r--r--plugingui/button.h8
-rw-r--r--plugingui/checkbox.cc6
-rw-r--r--plugingui/combobox.h2
-rw-r--r--plugingui/filebrowser.cc2
-rw-r--r--plugingui/font.h2
-rw-r--r--plugingui/image.cc2
-rw-r--r--plugingui/knob.cc2
-rw-r--r--plugingui/label.h2
-rw-r--r--plugingui/lineedit.h2
-rw-r--r--plugingui/listbox.h2
-rw-r--r--plugingui/listboxbasic.h2
-rw-r--r--plugingui/listboxthin.h2
-rw-r--r--plugingui/mainwindow.h14
-rw-r--r--plugingui/powerbutton.h8
-rw-r--r--plugingui/progressbar.h8
-rw-r--r--plugingui/scrollbar.h2
-rw-r--r--plugingui/slider.h10
-rw-r--r--plugingui/tabbutton.h6
-rw-r--r--plugingui/tabwidget.h4
-rw-r--r--plugingui/textedit.h2
-rw-r--r--plugingui/verticalline.cc2
22 files changed, 72 insertions, 47 deletions
diff --git a/plugingui/Makefile.am b/plugingui/Makefile.am
index b6ece08..83789b8 100644
--- a/plugingui/Makefile.am
+++ b/plugingui/Makefile.am
@@ -1,8 +1,33 @@
noinst_PROGRAMS = plugingui rcgen
noinst_LTLIBRARIES = libdggui.la
-resource_data.cc : rcgen
- (cd resources; ../rcgen * ../../ABOUT ../../AUTHORS ../../COPYING > ../resource_data.cc)
+RES = \
+ resources/bg.png \
+ resources/bypass_button.png \
+ resources/font.png \
+ resources/fontemboss.png \
+ resources/knob.png \
+ resources/logo.png \
+ resources/png_error \
+ resources/progress.png \
+ resources/pushbutton.png \
+ resources/sidebar.png \
+ resources/slider.png \
+ resources/switch_back_off.png \
+ resources/switch_back_on.png \
+ resources/switch_front.png \
+ resources/tab.png \
+ resources/thinlistbox.png \
+ resources/topbar.png \
+ resources/toplogo.png \
+ resources/vertline.png \
+ resources/widget.png \
+ ../ABOUT \
+ ../AUTHORS \
+ ../COPYING
+
+resource_data.cc : rcgen $(RES)
+ ./rcgen $(RES) > resource_data.cc
libdggui_la_CPPFLAGS = \
$(GUI_CPPFLAGS) \
diff --git a/plugingui/button.h b/plugingui/button.h
index f6bb83c..52f22e2 100644
--- a/plugingui/button.h
+++ b/plugingui/button.h
@@ -43,22 +43,22 @@ protected:
virtual void repaintEvent(RepaintEvent* e) override;
private:
- TexturedBox box_up{getImageCache(), ":pushbutton.png",
+ TexturedBox box_up{getImageCache(), ":resources/pushbutton.png",
0, 0, // atlas offset (x, y)
7, 1, 7, // dx1, dx2, dx3
6, 12, 9}; // dy1, dy2, dy3
- TexturedBox box_down{getImageCache(), ":pushbutton.png",
+ TexturedBox box_down{getImageCache(), ":resources/pushbutton.png",
15, 0, // atlas offset (x, y)
7, 1, 7, // dx1, dx2, dx3
6, 12, 9}; // dy1, dy2, dy3
- TexturedBox box_grey{getImageCache(), ":pushbutton.png",
+ TexturedBox box_grey{getImageCache(), ":resources/pushbutton.png",
30, 0, // atlas offset (x, y)
7, 1, 7, // dx1, dx2, dx3
6, 12, 9}; // dy1, dy2, dy3
- Font font{":fontemboss.png"};
+ Font font{":resources/fontemboss.png"};
};
} // GUI::
diff --git a/plugingui/checkbox.cc b/plugingui/checkbox.cc
index a6d52a1..fc147d5 100644
--- a/plugingui/checkbox.cc
+++ b/plugingui/checkbox.cc
@@ -33,9 +33,9 @@ namespace GUI
CheckBox::CheckBox(Widget* parent)
: Toggle(parent)
- , bg_on(getImageCache(), ":switch_back_on.png")
- , bg_off(getImageCache(), ":switch_back_off.png")
- , knob(getImageCache(), ":switch_front.png")
+ , bg_on(getImageCache(), ":resources/switch_back_on.png")
+ , bg_off(getImageCache(), ":resources/switch_back_off.png")
+ , knob(getImageCache(), ":resources/switch_front.png")
{
}
diff --git a/plugingui/combobox.h b/plugingui/combobox.h
index 8946600..778d54c 100644
--- a/plugingui/combobox.h
+++ b/plugingui/combobox.h
@@ -62,7 +62,7 @@ public:
Notifier<std::string, std::string> valueChangedNotifier;
private:
- TexturedBox box{getImageCache(), ":widget.png",
+ TexturedBox box{getImageCache(), ":resources/widget.png",
0, 0, // atlas offset (x, y)
7, 1, 7, // dx1, dx2, dx3
7, 63, 7}; // dy1, dy2, dy3
diff --git a/plugingui/filebrowser.cc b/plugingui/filebrowser.cc
index f10a75e..76a2744 100644
--- a/plugingui/filebrowser.cc
+++ b/plugingui/filebrowser.cc
@@ -57,7 +57,7 @@ FileBrowser::FileBrowser(Widget* parent)
, listbox(this)
, btn_sel(this)
, btn_esc(this)
- , back(":bg.png")
+ , back(":resources/bg.png")
{
#if DG_PLATFORM == DG_PLATFORM_WINDOWS
above_root = false;
diff --git a/plugingui/font.h b/plugingui/font.h
index 84e1f63..2e3f87a 100644
--- a/plugingui/font.h
+++ b/plugingui/font.h
@@ -36,7 +36,7 @@ namespace GUI {
class Font {
public:
- Font(const std::string& fontfile = ":font.png");
+ Font(const std::string& fontfile = ":resources/font.png");
size_t textWidth(const std::string& text) const;
size_t textHeight(const std::string& text = "") const;
diff --git a/plugingui/image.cc b/plugingui/image.cc
index ea295b9..22d1aca 100644
--- a/plugingui/image.cc
+++ b/plugingui/image.cc
@@ -80,7 +80,7 @@ Image& Image::operator=(Image&& other)
void Image::setError()
{
- Resource rc(":png_error");
+ Resource rc(":resources/png_error");
const unsigned char* ptr = (const unsigned char*)rc.data();
diff --git a/plugingui/knob.cc b/plugingui/knob.cc
index 7a5efc1..7b76d2e 100644
--- a/plugingui/knob.cc
+++ b/plugingui/knob.cc
@@ -42,7 +42,7 @@ namespace GUI
Knob::Knob(Widget *parent)
: Widget(parent)
- , img_knob(getImageCache(), ":knob.png")
+ , img_knob(getImageCache(), ":resources/knob.png")
{
state = up;
diff --git a/plugingui/label.h b/plugingui/label.h
index 837f6c0..45b4176 100644
--- a/plugingui/label.h
+++ b/plugingui/label.h
@@ -58,7 +58,7 @@ protected:
private:
std::string _text;
- Font font{":fontemboss.png"};
+ Font font{":resources/fontemboss.png"};
TextAlignment alignment{TextAlignment::left};
int border{0};
diff --git a/plugingui/lineedit.h b/plugingui/lineedit.h
index 76babcc..dd37776 100644
--- a/plugingui/lineedit.h
+++ b/plugingui/lineedit.h
@@ -62,7 +62,7 @@ protected:
virtual void textChanged() {}
private:
- TexturedBox box{getImageCache(), ":widget.png",
+ TexturedBox box{getImageCache(), ":resources/widget.png",
0, 0, // atlas offset (x, y)
7, 1, 7, // dx1, dx2, dx3
7, 63, 7}; // dy1, dy2, dy3
diff --git a/plugingui/listbox.h b/plugingui/listbox.h
index a17a475..0d9ad4d 100644
--- a/plugingui/listbox.h
+++ b/plugingui/listbox.h
@@ -65,7 +65,7 @@ public:
private:
ListBoxBasic basic;
- TexturedBox box{getImageCache(), ":widget.png",
+ TexturedBox box{getImageCache(), ":resources/widget.png",
0, 0, // atlas offset (x, y)
7, 1, 7, // dx1, dx2, dx3
7, 63, 7}; // dy1, dy2, dy3
diff --git a/plugingui/listboxbasic.h b/plugingui/listboxbasic.h
index 662c5d3..27822e6 100644
--- a/plugingui/listboxbasic.h
+++ b/plugingui/listboxbasic.h
@@ -78,7 +78,7 @@ protected:
ScrollBar scroll;
- Texture bg_img{getImageCache(), ":widget.png", 7, 7, 1, 63};
+ Texture bg_img{getImageCache(), ":resources/widget.png", 7, 7, 1, 63};
void setSelection(int index);
diff --git a/plugingui/listboxthin.h b/plugingui/listboxthin.h
index 539946a..e861745 100644
--- a/plugingui/listboxthin.h
+++ b/plugingui/listboxthin.h
@@ -66,7 +66,7 @@ public:
private:
ListBoxBasic basic;
- TexturedBox box{getImageCache(), ":thinlistbox.png",
+ TexturedBox box{getImageCache(), ":resources/thinlistbox.png",
0, 0, // atlas offset (x, y)
1, 1, 1, // dx1, dx2, dx3
1, 1, 1}; // dy1, dy2, dy3
diff --git a/plugingui/mainwindow.h b/plugingui/mainwindow.h
index 9a9359c..cd2eb1f 100644
--- a/plugingui/mainwindow.h
+++ b/plugingui/mainwindow.h
@@ -72,24 +72,24 @@ private:
MainTab main_tab;
TextEdit about_text_field{&tabs};
- Image back{":bg.png"};
- Image logo{":logo.png"};
+ Image back{":resources/bg.png"};
+ Image logo{":resources/logo.png"};
- TexturedBox sidebar{getImageCache(), ":sidebar.png",
+ TexturedBox sidebar{getImageCache(), ":resources/sidebar.png",
0, 0, // offset
16, 0, 0, // delta-x
14, 1, 14}; // delta-y
- TexturedBox topbar{getImageCache(), ":topbar.png",
+ 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};
- Resource about{":../../ABOUT"};
- Resource authors{":../../AUTHORS"};
- Resource gpl{":../../COPYING"};
+ Resource about{":../ABOUT"};
+ Resource authors{":../AUTHORS"};
+ Resource gpl{":../COPYING"};
Font font;
};
diff --git a/plugingui/powerbutton.h b/plugingui/powerbutton.h
index 47b3ca1..1894967 100644
--- a/plugingui/powerbutton.h
+++ b/plugingui/powerbutton.h
@@ -43,10 +43,10 @@ protected:
virtual void repaintEvent(RepaintEvent* repaintEvent) override;
private:
- Texture on{getImageCache(), ":bypass_button.png", 0, 0, 16, 16};
- Texture on_clicked{getImageCache(), ":bypass_button.png", 16, 0, 16, 16};
- Texture off{getImageCache(), ":bypass_button.png", 32, 0, 16, 16};
- Texture off_clicked{getImageCache(), ":bypass_button.png", 48, 0, 16, 16};
+ Texture on{getImageCache(), ":resources/bypass_button.png", 0, 0, 16, 16};
+ Texture on_clicked{getImageCache(), ":resources/bypass_button.png", 16, 0, 16, 16};
+ Texture off{getImageCache(), ":resources/bypass_button.png", 32, 0, 16, 16};
+ Texture off_clicked{getImageCache(), ":resources/bypass_button.png", 48, 0, 16, 16};
};
} // GUI::
diff --git a/plugingui/progressbar.h b/plugingui/progressbar.h
index bc8b82e..76cc6fd 100644
--- a/plugingui/progressbar.h
+++ b/plugingui/progressbar.h
@@ -62,22 +62,22 @@ protected:
private:
ProgressBarState state{ProgressBarState::Blue};
- TexturedBox bar_bg{getImageCache(), ":progress.png",
+ TexturedBox bar_bg{getImageCache(), ":resources/progress.png",
0, 0, // atlas offset (x, y)
6, 1, 6, // dx1, dx2, dx3
11, 0, 0}; // dy1, dy2, dy3
- TexturedBox bar_red{getImageCache(), ":progress.png",
+ TexturedBox bar_red{getImageCache(), ":resources/progress.png",
13, 0, // atlas offset (x, y)
2, 1, 2, // dx1, dx2, dx3
11, 0, 0}; // dy1, dy2, dy3
- TexturedBox bar_green{getImageCache(), ":progress.png",
+ TexturedBox bar_green{getImageCache(), ":resources/progress.png",
18, 0, // atlas offset (x, y)
2, 1, 2, // dx1, dx2, dx3
11, 0, 0}; // dy1, dy2, dy3
- TexturedBox bar_blue{getImageCache(), ":progress.png",
+ TexturedBox bar_blue{getImageCache(), ":resources/progress.png",
23, 0, // atlas offset (x, y)
2, 1, 2, // dx1, dx2, dx3
11, 0, 0}; // dy1, dy2, dy3
diff --git a/plugingui/scrollbar.h b/plugingui/scrollbar.h
index faa0f58..5e60673 100644
--- a/plugingui/scrollbar.h
+++ b/plugingui/scrollbar.h
@@ -68,7 +68,7 @@ private:
int valueOffset{0};
bool dragging{false};
- Texture bg_img{getImageCache(), ":widget.png", 7, 7, 1, 63};
+ Texture bg_img{getImageCache(), ":resources/widget.png", 7, 7, 1, 63};
};
} // GUI::
diff --git a/plugingui/slider.h b/plugingui/slider.h
index 3398bb4..1543d6f 100644
--- a/plugingui/slider.h
+++ b/plugingui/slider.h
@@ -79,29 +79,29 @@ private:
State state;
- TexturedBox bar{getImageCache(), ":slider.png",
+ TexturedBox bar{getImageCache(), ":resources/slider.png",
0, 0, // atlas offset (x, y)
7, 1, 7, // dx1, dx2, dx3
7, 1, 7 // dy1, dy2, dy3
};
- TexturedBox inner_bar_green{getImageCache(), ":slider.png",
+ TexturedBox inner_bar_green{getImageCache(), ":resources/slider.png",
30, 0, // atlas offset (x, y)
2, 1, 2, // dx1, dx2, dx3
2, 1, 2 // dy1, dy2, dy3
};
- TexturedBox inner_bar_red{getImageCache(), ":slider.png",
+ TexturedBox inner_bar_red{getImageCache(), ":resources/slider.png",
30, 5, // atlas offset (x, y)
2, 1, 2, // dx1, dx2, dx3
2, 1, 2 // dy1, dy2, dy3
};
- TexturedBox inner_bar_blue{getImageCache(), ":slider.png",
+ TexturedBox inner_bar_blue{getImageCache(), ":resources/slider.png",
30, 10, // atlas offset (x, y)
2, 1, 2, // dx1, dx2, dx3
2, 1, 2 // dy1, dy2, dy3
};
Texture button{
- getImageCache(), ":slider.png", 15, 0, // atlas offset (x, y)
+ getImageCache(), ":resources/slider.png", 15, 0, // atlas offset (x, y)
15, 15 // width, height
};
diff --git a/plugingui/tabbutton.h b/plugingui/tabbutton.h
index a248335..1c4d84b 100644
--- a/plugingui/tabbutton.h
+++ b/plugingui/tabbutton.h
@@ -59,17 +59,17 @@ private:
Widget* tab_widget;
bool active{false};
- TexturedBox tab_active{getImageCache(), ":tab.png",
+ TexturedBox tab_active{getImageCache(), ":resources/tab.png",
0, 0, // atlas offset (x, y)
5, 1, 5, // dx1, dx2, dx3
5, 13, 1}; // dy1, dy2, dy3
- TexturedBox tab_passive{getImageCache(), ":tab.png",
+ TexturedBox tab_passive{getImageCache(), ":resources/tab.png",
11, 0, // atlas offset (x, y)
5, 1, 5, // dx1, dx2, dx3
5, 13, 1}; // dy1, dy2, dy3
- Font font{":fontemboss.png"};
+ Font font{":resources/fontemboss.png"};
};
} // GUI::
diff --git a/plugingui/tabwidget.h b/plugingui/tabwidget.h
index d35550f..ca96dc2 100644
--- a/plugingui/tabwidget.h
+++ b/plugingui/tabwidget.h
@@ -58,12 +58,12 @@ private:
std::list<TabButton> buttons;
StackedWidget stack;
- TexturedBox topbar{getImageCache(), ":topbar.png",
+ TexturedBox topbar{getImageCache(), ":resources/topbar.png",
0, 0, // atlas offset (x, y)
1, 1, 1, // dx1, dx2, dx3
17, 1, 1}; // dy1, dy2, dy3
- Texture toplogo{getImageCache(), ":toplogo.png",
+ Texture toplogo{getImageCache(), ":resources/toplogo.png",
0, 0, // atlas offset (x, y)
95, 17}; // width, height
};
diff --git a/plugingui/textedit.h b/plugingui/textedit.h
index 9ca0301..81e00b8 100644
--- a/plugingui/textedit.h
+++ b/plugingui/textedit.h
@@ -65,7 +65,7 @@ protected:
private:
void scrolled(int value);
- TexturedBox box{getImageCache(), ":widget.png",
+ TexturedBox box{getImageCache(), ":resources/widget.png",
0, 0, // atlas offset (x, y)
7, 1, 7, // dx1, dx2, dx3
7, 63, 7}; // dy1, dy2, dy3
diff --git a/plugingui/verticalline.cc b/plugingui/verticalline.cc
index 46d39e6..6a3a98a 100644
--- a/plugingui/verticalline.cc
+++ b/plugingui/verticalline.cc
@@ -32,7 +32,7 @@ namespace GUI {
VerticalLine::VerticalLine(Widget *parent)
: Widget(parent)
- , vline(":vertline.png")
+ , vline(":resources/vertline.png")
{
}