new ihm
This commit is contained in:
1 parent
2b9e574ba9
commit
b119a6abd7
583 files changed
+224175
-218466
No files matched your search
@@ -0,0 +1,53 @@
|
||||
#ifndef EFFECTCARD_HPP
|
||||
#define EFFECTCARD_HPP
|
||||
|
||||
#include <gui/common/UiTheme.hpp>
|
||||
#include <touchgfx/Callback.hpp>
|
||||
#include <touchgfx/events/ClickEvent.hpp>
|
||||
#include <touchgfx/widgets/BoxWithBorder.hpp>
|
||||
|
||||
/* Carte d'effet de l'ecran d'accueil :
|
||||
* - appui n'importe ou sur la carte -> callback "open" (ouvre l'ecran de reglage)
|
||||
* - appui sur l'interrupteur en bas a droite -> active/bypass l'effet sans quitter l'accueil
|
||||
* L'etat est lu/ecrit directement dans le booleen "enabled" de l'effet
|
||||
* (AudioEffectsParams), comme le font les ecrans de reglage. */
|
||||
class EffectCard : public touchgfx::Container
|
||||
{
|
||||
public:
|
||||
static const int16_t WIDTH = 244;
|
||||
static const int16_t HEIGHT = 130;
|
||||
|
||||
EffectCard();
|
||||
|
||||
void setup(ui::Effect effect, TEXTS title, TEXTS description, bool* enabled,
|
||||
touchgfx::GenericCallback<const EffectCard&>& openCallback);
|
||||
|
||||
ui::Effect getEffect() const
|
||||
{
|
||||
return effect;
|
||||
}
|
||||
|
||||
/* Relit l'etat de l'effet et met a jour l'affichage */
|
||||
void refresh();
|
||||
|
||||
virtual void handleClickEvent(const touchgfx::ClickEvent& event);
|
||||
|
||||
private:
|
||||
bool isInSwitchArea(int16_t x, int16_t y) const;
|
||||
void setPressed(bool pressed);
|
||||
|
||||
ui::Effect effect;
|
||||
bool* enabled;
|
||||
touchgfx::GenericCallback<const EffectCard&>* openAction;
|
||||
bool pressedOnSwitch;
|
||||
|
||||
touchgfx::BoxWithBorder background;
|
||||
touchgfx::Box accentBar;
|
||||
touchgfx::TextArea title;
|
||||
touchgfx::TextArea description;
|
||||
touchgfx::TextArea status;
|
||||
touchgfx::BoxWithBorder switchTrack;
|
||||
touchgfx::Box switchKnob;
|
||||
};
|
||||
|
||||
#endif // EFFECTCARD_HPP
|
||||
@@ -0,0 +1,149 @@
|
||||
#ifndef UITHEME_HPP
|
||||
#define UITHEME_HPP
|
||||
|
||||
/* Charte graphique commune a tous les ecrans (code utilisateur, independant de
|
||||
* TouchGFX Designer) : couleurs, geometrie de l'en-tete et petits widgets
|
||||
* reutilisables. Les ecrans generes par Designer sont re-agences dans les
|
||||
* setupScreen() des vues a partir de ces constantes. */
|
||||
|
||||
#include <touchgfx/Color.hpp>
|
||||
#include <touchgfx/Unicode.hpp>
|
||||
#include <touchgfx/containers/Container.hpp>
|
||||
#include <touchgfx/widgets/Box.hpp>
|
||||
#include <touchgfx/widgets/ButtonWithLabel.hpp>
|
||||
#include <touchgfx/containers/Slider.hpp>
|
||||
#include <touchgfx/widgets/TextArea.hpp>
|
||||
#include <touchgfx/widgets/TextAreaWithWildcard.hpp>
|
||||
#include <touchgfx/widgets/ToggleButton.hpp>
|
||||
#include <texts/TextKeysAndLanguages.hpp>
|
||||
|
||||
namespace ui
|
||||
{
|
||||
inline touchgfx::colortype rgb(uint8_t r, uint8_t g, uint8_t b)
|
||||
{
|
||||
return touchgfx::Color::getColorFromRGB(r, g, b);
|
||||
}
|
||||
|
||||
/* Palette "horlogerie" : fond brun tres sombre, texte creme */
|
||||
inline touchgfx::colortype textPrimary() { return rgb(230, 214, 170); }
|
||||
inline touchgfx::colortype textMuted() { return rgb(150, 136, 108); }
|
||||
inline touchgfx::colortype surface() { return rgb(30, 22, 15); }
|
||||
inline touchgfx::colortype surfacePressed(){ return rgb(58, 44, 30); }
|
||||
inline touchgfx::colortype surfaceBorder() { return rgb(82, 64, 42); }
|
||||
inline touchgfx::colortype headerBg() { return rgb(18, 13, 9); }
|
||||
inline touchgfx::colortype switchOff() { return rgb(70, 60, 48); }
|
||||
|
||||
/* Une couleur d'accent par effet, reprise sur la carte d'accueil et l'ecran de reglage */
|
||||
enum Effect
|
||||
{
|
||||
EFFECT_OCTAVER,
|
||||
EFFECT_EQUALIZER,
|
||||
EFFECT_OVERDRIVE,
|
||||
EFFECT_SATURATION,
|
||||
EFFECT_ECHO,
|
||||
EFFECT_REVERB,
|
||||
EFFECT_SPECTRUM,
|
||||
EFFECT_COUNT
|
||||
};
|
||||
|
||||
inline touchgfx::colortype accent(Effect e)
|
||||
{
|
||||
switch (e)
|
||||
{
|
||||
case EFFECT_OCTAVER: return rgb(232, 96, 92);
|
||||
case EFFECT_EQUALIZER: return rgb(112, 200, 122);
|
||||
case EFFECT_OVERDRIVE: return rgb(242, 152, 44);
|
||||
case EFFECT_SATURATION: return rgb(230, 122, 188);
|
||||
case EFFECT_ECHO: return rgb(92, 162, 240);
|
||||
case EFFECT_REVERB: return rgb(170, 124, 240);
|
||||
default: return textPrimary();
|
||||
}
|
||||
}
|
||||
|
||||
/* Geometrie de l'ecran (800x480) */
|
||||
static const int16_t SCREEN_W = 800;
|
||||
static const int16_t SCREEN_H = 480;
|
||||
static const int16_t HEADER_H = 80;
|
||||
|
||||
/* Bandeau d'en-tete : fond sombre + liseré de la couleur de l'effet */
|
||||
class Header : public touchgfx::Container
|
||||
{
|
||||
public:
|
||||
Header()
|
||||
{
|
||||
setPosition(0, 0, SCREEN_W, HEADER_H + 3);
|
||||
bar.setPosition(0, 0, SCREEN_W, HEADER_H);
|
||||
bar.setColor(headerBg());
|
||||
bar.setAlpha(235);
|
||||
add(bar);
|
||||
line.setPosition(0, HEADER_H, SCREEN_W, 3);
|
||||
add(line);
|
||||
}
|
||||
void setAccent(touchgfx::colortype c)
|
||||
{
|
||||
line.setColor(c);
|
||||
}
|
||||
|
||||
private:
|
||||
touchgfx::Box bar;
|
||||
touchgfx::Box line;
|
||||
};
|
||||
|
||||
/* Zone de texte affichant une valeur formatee ("75 %", "350 ms", "+6 dB"...) */
|
||||
class ValueText : public touchgfx::TextAreaWithOneWildcard
|
||||
{
|
||||
public:
|
||||
ValueText()
|
||||
{
|
||||
buffer[0] = 0;
|
||||
setWildcard(buffer);
|
||||
}
|
||||
void init(touchgfx::TypedText text, touchgfx::colortype color, int16_t x, int16_t y, int16_t w, int16_t h)
|
||||
{
|
||||
setTypedText(text);
|
||||
setColor(color);
|
||||
setPosition(x, y, w, h);
|
||||
}
|
||||
void show(const char* format, int value)
|
||||
{
|
||||
touchgfx::Unicode::snprintf(buffer, SIZE, format, value);
|
||||
invalidate();
|
||||
}
|
||||
/* Gain signe avec signe explicite : "+6 dB" / "-12 dB" / "0 dB" */
|
||||
void showDb(int value)
|
||||
{
|
||||
show(value > 0 ? "+%d dB" : "%d dB", value);
|
||||
}
|
||||
|
||||
private:
|
||||
static const uint16_t SIZE = 16;
|
||||
touchgfx::Unicode::UnicodeChar buffer[SIZE];
|
||||
};
|
||||
|
||||
/* Mise en page commune des ecrans d'effet generes par Designer :
|
||||
* en-tete (retour a gauche, titre centre, marche/arret a droite).
|
||||
* La vue doit inserer "header" juste au-dessus du fond (insert(&box1, header)). */
|
||||
inline void layoutEffectHeader(Header& header,
|
||||
touchgfx::colortype accentColor, touchgfx::ButtonWithLabel& back,
|
||||
touchgfx::TextArea& title, touchgfx::ToggleButton& toggle)
|
||||
{
|
||||
header.setAccent(accentColor);
|
||||
|
||||
back.setXY(0, -7); /* bouton 225x94, partie visible ~50 px centree */
|
||||
title.setPosition(225, 17, SCREEN_W - 2 * 225, 46);
|
||||
title.setColor(textPrimary());
|
||||
toggle.setXY(SCREEN_W - 170 - 16, 10); /* toggle 170x60 */
|
||||
}
|
||||
|
||||
/* Ligne de reglage horizontale : libelle a gauche, curseur, valeur a droite */
|
||||
inline void layoutParamRow(touchgfx::TextArea& label, touchgfx::Slider& slider, ValueText& value,
|
||||
touchgfx::colortype accentColor, int16_t y)
|
||||
{
|
||||
label.setPosition(32, y + 14, 150, 26);
|
||||
label.setColor(textMuted());
|
||||
slider.setXY(184, y); /* curseur 456x52 */
|
||||
value.init(touchgfx::TypedText(T_VALUE_M_LEFT), accentColor, 656, y + 10, 136, 34);
|
||||
}
|
||||
} // namespace ui
|
||||
|
||||
#endif // UITHEME_HPP
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <gui_generated/echo_screen/EchoViewBase.hpp>
|
||||
#include <gui/echo_screen/EchoPresenter.hpp>
|
||||
#include <gui/common/UiTheme.hpp>
|
||||
|
||||
class EchoView : public EchoViewBase
|
||||
{
|
||||
@@ -17,6 +18,8 @@ public:
|
||||
virtual void sliderFeedbackChanged(int value);
|
||||
virtual void sliderMixChanged(int value);
|
||||
protected:
|
||||
ui::Header header;
|
||||
ui::ValueText values[3];
|
||||
};
|
||||
|
||||
#endif // ECHOVIEW_HPP
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <gui_generated/equalizer_screen/EqualizerViewBase.hpp>
|
||||
#include <gui/equalizer_screen/EqualizerPresenter.hpp>
|
||||
#include <gui/common/UiTheme.hpp>
|
||||
|
||||
class EqualizerView : public EqualizerViewBase
|
||||
{
|
||||
@@ -24,6 +25,11 @@ public:
|
||||
virtual void sliderBand9Changed(int value);
|
||||
virtual void sliderBand10Changed(int value);
|
||||
protected:
|
||||
ui::Header header;
|
||||
ui::ValueText values[10];
|
||||
touchgfx::Box zeroDbLine;
|
||||
|
||||
void setBand(int index, int value);
|
||||
};
|
||||
|
||||
#endif // EQUALIZERVIEW_HPP
|
||||
@@ -1,17 +1,20 @@
|
||||
#ifndef INITSCREENVIEW_HPP
|
||||
#define INITSCREENVIEW_HPP
|
||||
|
||||
#include <gui_generated/initscreen_screen/InitScreenViewBase.hpp>
|
||||
#include <gui/initscreen_screen/InitScreenPresenter.hpp>
|
||||
|
||||
class InitScreenView : public InitScreenViewBase
|
||||
{
|
||||
public:
|
||||
InitScreenView();
|
||||
virtual ~InitScreenView() {}
|
||||
virtual void setupScreen();
|
||||
virtual void tearDownScreen();
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif // INITSCREENVIEW_HPP
|
||||
#ifndef INITSCREENVIEW_HPP
|
||||
#define INITSCREENVIEW_HPP
|
||||
|
||||
#include <gui_generated/initscreen_screen/InitScreenViewBase.hpp>
|
||||
#include <gui/initscreen_screen/InitScreenPresenter.hpp>
|
||||
#include <touchgfx/widgets/TextArea.hpp>
|
||||
|
||||
class InitScreenView : public InitScreenViewBase
|
||||
{
|
||||
public:
|
||||
InitScreenView();
|
||||
virtual ~InitScreenView() {}
|
||||
virtual void setupScreen();
|
||||
virtual void tearDownScreen();
|
||||
protected:
|
||||
touchgfx::TextArea title;
|
||||
touchgfx::TextArea hint;
|
||||
};
|
||||
|
||||
#endif // INITSCREENVIEW_HPP
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <gui_generated/octaver_screen/OctaverViewBase.hpp>
|
||||
#include <gui/octaver_screen/OctaverPresenter.hpp>
|
||||
#include <gui/common/UiTheme.hpp>
|
||||
|
||||
class OctaverView : public OctaverViewBase
|
||||
{
|
||||
@@ -19,6 +20,10 @@ public:
|
||||
virtual void slider4Clicked(int value);
|
||||
virtual void slider5Clicked(int value);
|
||||
protected:
|
||||
ui::Header header;
|
||||
ui::ValueText values[5];
|
||||
|
||||
void showLevel(int index, int value);
|
||||
};
|
||||
|
||||
#endif // OCTAVERVIEW_HPP
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <gui_generated/oscillo_screen/OscilloViewBase.hpp>
|
||||
#include <gui/oscillo_screen/OscilloPresenter.hpp>
|
||||
#include <gui/common/UiTheme.hpp>
|
||||
|
||||
class OscilloView : public OscilloViewBase
|
||||
{
|
||||
@@ -15,6 +16,7 @@ public:
|
||||
|
||||
virtual void toggleClicked();
|
||||
protected:
|
||||
ui::Header header;
|
||||
};
|
||||
|
||||
#endif // OSCILLOVIEW_HPP
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <gui_generated/overdrive_screen/OverdriveViewBase.hpp>
|
||||
#include <gui/overdrive_screen/OverdrivePresenter.hpp>
|
||||
#include <gui/common/UiTheme.hpp>
|
||||
|
||||
class OverdriveView : public OverdriveViewBase
|
||||
{
|
||||
@@ -17,6 +18,8 @@ public:
|
||||
virtual void sliderToneChanged(int value);
|
||||
virtual void sliderLevelChanged(int value);
|
||||
protected:
|
||||
ui::Header header;
|
||||
ui::ValueText values[3];
|
||||
};
|
||||
|
||||
#endif // OVERDRIVEVIEW_HPP
|
||||
@@ -1,22 +1,60 @@
|
||||
#ifndef OVERVIEWVIEW_HPP
|
||||
#define OVERVIEWVIEW_HPP
|
||||
|
||||
#include <gui_generated/overview_screen/OverviewViewBase.hpp>
|
||||
#include <gui/overview_screen/OverviewPresenter.hpp>
|
||||
|
||||
class OverviewView : public OverviewViewBase
|
||||
{
|
||||
public:
|
||||
OverviewView();
|
||||
virtual ~OverviewView() {}
|
||||
virtual void setupScreen();
|
||||
virtual void tearDownScreen();
|
||||
virtual void handleTickEvent();
|
||||
|
||||
virtual void toggleAudioOnOFF();
|
||||
virtual void slider1Changed(int value);
|
||||
protected:
|
||||
bool repeatButtonWasPressed;
|
||||
};
|
||||
|
||||
#endif // OVERVIEWVIEW_HPP
|
||||
#ifndef OVERVIEWVIEW_HPP
|
||||
#define OVERVIEWVIEW_HPP
|
||||
|
||||
#include <gui_generated/overview_screen/OverviewViewBase.hpp>
|
||||
#include <gui/overview_screen/OverviewPresenter.hpp>
|
||||
#include <gui/common/EffectCard.hpp>
|
||||
#include <gui/common/UiTheme.hpp>
|
||||
#include <touchgfx/widgets/canvas/Circle.hpp>
|
||||
#include <touchgfx/widgets/canvas/PainterRGB565.hpp>
|
||||
|
||||
/* Ecran d'accueil : marche/arret + volume en haut, grille des 6 effets
|
||||
* (ouvrir / activer), looper et spectre en bas.
|
||||
* Les boutons d'effet generes par Designer (buttonWithLabel1..6) sont masques et
|
||||
* remplaces par des EffectCard ; le reste des widgets generes est re-agence. */
|
||||
class OverviewView : public OverviewViewBase
|
||||
{
|
||||
public:
|
||||
OverviewView();
|
||||
virtual ~OverviewView();
|
||||
virtual void setupScreen();
|
||||
virtual void tearDownScreen();
|
||||
virtual void handleTickEvent();
|
||||
|
||||
virtual void toggleAudioOnOFF();
|
||||
virtual void slider1Changed(int value);
|
||||
|
||||
protected:
|
||||
enum LooperState
|
||||
{
|
||||
LOOPER_IDLE,
|
||||
LOOPER_RECORDING,
|
||||
LOOPER_PLAYING
|
||||
};
|
||||
|
||||
void onCardOpen(const EffectCard& card);
|
||||
void setLooperState(LooperState state);
|
||||
|
||||
/* Buffer du CanvasWidgetRenderer (voyant du looper), propre a cet ecran comme
|
||||
* celui genere pour Oscillo */
|
||||
static const uint32_t CANVAS_BUFFER_SIZE = 2400;
|
||||
uint8_t canvasBuffer[CANVAS_BUFFER_SIZE];
|
||||
|
||||
ui::Header header;
|
||||
EffectCard cards[6];
|
||||
ui::ValueText volumeValue;
|
||||
|
||||
touchgfx::TextArea looperTitle;
|
||||
touchgfx::TextArea looperStatus;
|
||||
touchgfx::Circle recDot;
|
||||
touchgfx::PainterRGB565 recDotPainter;
|
||||
|
||||
touchgfx::Callback<OverviewView, const EffectCard&> cardOpenCallback;
|
||||
|
||||
bool repeatButtonWasPressed;
|
||||
LooperState looperState;
|
||||
uint32_t looperTicks; /* duree de l'enregistrement en cours, en ticks IHM */
|
||||
uint32_t playTicksLeft; /* estimation de la lecture restante */
|
||||
};
|
||||
|
||||
#endif // OVERVIEWVIEW_HPP
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <gui_generated/reverb_screen/ReverbViewBase.hpp>
|
||||
#include <gui/reverb_screen/ReverbPresenter.hpp>
|
||||
#include <gui/common/UiTheme.hpp>
|
||||
|
||||
class ReverbView : public ReverbViewBase
|
||||
{
|
||||
@@ -17,6 +18,8 @@ public:
|
||||
virtual void sliderAmortiChanged(int value);
|
||||
virtual void sliderMixChanged(int value);
|
||||
protected:
|
||||
ui::Header header;
|
||||
ui::ValueText values[3];
|
||||
};
|
||||
|
||||
#endif // REVERBVIEW_HPP
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <gui_generated/saturation_screen/SaturationViewBase.hpp>
|
||||
#include <gui/saturation_screen/SaturationPresenter.hpp>
|
||||
#include <gui/common/UiTheme.hpp>
|
||||
|
||||
class SaturationView : public SaturationViewBase
|
||||
{
|
||||
@@ -16,6 +17,8 @@ public:
|
||||
virtual void sliderDriveClicked(int value);
|
||||
virtual void sliderLevelClicked(int value);
|
||||
protected:
|
||||
ui::Header header;
|
||||
ui::ValueText values[2];
|
||||
};
|
||||
|
||||
#endif // SATURATIONVIEW_HPP
|
||||
Reference in new issue
Block a user