| 1 | #cxx . . $ `<file>/faudiostream/architecture/faust/gui/GUI.h`/ifndef FAUST_GUI_H |
| 2 | #define FAUST_GUI_Hcxx . . $ `faudiostream/architecture/faust/gui/GUI.h:2:9`! |
| 3 | |
| 4 | #include "faust/gui/UI.h"cxx . . $ `<file>/faudiostream/architecture/faust/gui/UI.h`/ |
| 5 | #include <list> |
| 6 | #include <map> |
| 7 | |
| 8 | using namespace std; |
| 9 | |
| 10 | /******************************************************************************* |
| 11 | * GUI : Abstract Graphic User Interface |
| 12 | * Provides additional macchanismes to synchronize widgets and zones. Widgets |
| 13 | * should both reflect the value of a zone and allow to change this value. |
| 14 | ******************************************************************************/ |
| 15 | |
| 16 | struct uiItemcxx . . $ uiItem#; |
| 17 | typedef void (*uiCallbackcxx . . $ uiCallback#)(FAUSTFLOATcxx . . $ `faudiostream/architecture/faust/gui/UI.h:5:9`! val, void* data); |
| 18 | |
| 19 | class GUIcxx . . $ GUI# : public UIcxx . . $ UI# |
| 20 | { |
| 21 | typedef listcxx . . $ std/__cxx11/list#<uiItemcxx . . $ uiItem#*> clistcxx . . $ GUI#clist#; |
| 22 | typedef mapcxx . . $ std/map#<FAUSTFLOATcxx . . $ `faudiostream/architecture/faust/gui/UI.h:5:9`!*, clistcxx . . $ GUI#clist#*> zmapcxx . . $ GUI#zmap#; |
| 23 | |
| 24 | private: |
| 25 | static listcxx . . $ std/__cxx11/list#<GUIcxx . . $ GUI#*> fGuiListcxx . . $ GUI#fGuiList.; |
| 26 | zmapcxx . . $ GUI#zmap# fZoneMapcxx . . $ GUI#fZoneMap.; |
| 27 | bool fStoppedcxx . . $ GUI#fStopped.; |
| 28 | |
| 29 | public: |
| 30 | |
| 31 | GUIcxx . . $ GUI#GUI(49f6e7a06ebc5aa8).() : fStoppedcxx . . $ GUI#fStopped.(false) |
| 32 | { |
| 33 | fGuiListcxx . . $ GUI#fGuiList..push_backcxx . . $ std/__cxx11/list#push_back(fe7a8a4d1eddb70).(this); |
| 34 | } |
| 35 | |
| 36 | virtual ~cxx . . $ GUI#`~GUI`(ced63f7c635d850d).GUIcxx . . $ GUI#() |
| 37 | { |
| 38 | // suppression de this dans fGuiList |
| 39 | } |
| 40 | |
| 41 | // -- registerZone(z,c) : zone management |
| 42 | |
| 43 | void registerZonecxx . . $ GUI#registerZone(5a46843687475134).(FAUSTFLOATcxx . . $ `faudiostream/architecture/faust/gui/UI.h:5:9`!* z, uiItemcxx . . $ uiItem#* c) |
| 44 | { |
| 45 | if (fZoneMapcxx . . $ GUI#fZoneMap..findcxx . . $ std/map#find(36f8d56706583706).(z) ==cxx . . $ std/`operator==`(be6a71a859368080). fZoneMapcxx . . $ GUI#fZoneMap..endcxx . . $ std/map#end(7e4de33083b6e738).()) fZoneMapcxx . . $ GUI#fZoneMap.[cxx . . $ std/map#`operator[]`(bbd415b616967878).z] = new clistcxx . . $ GUI#clist#(); |
| 46 | fZoneMapcxx . . $ GUI#fZoneMap.[cxx . . $ std/map#`operator[]`(bbd415b616967878).z]->push_backcxx . . $ std/__cxx11/list#push_back(77d9f17553126ecb).(c); |
| 47 | } |
| 48 | |
| 49 | void updateAllZonescxx . . $ GUI#updateAllZones(49f6e7a06ebc5aa8).(); |
| 50 | |
| 51 | void updateZonecxx . . $ GUI#updateZone(e6881f009d13a851).(FAUSTFLOATcxx . . $ `faudiostream/architecture/faust/gui/UI.h:5:9`!* z); |
| 52 | |
| 53 | static void updateAllGuiscxx . . $ GUI#updateAllGuis(49f6e7a06ebc5aa8).() |
| 54 | { |
| 55 | listcxx . . $ std/__cxx11/list#<GUI*>::iteratorcxx . . $ std/__cxx11/list#iterator# gcxx . . $ std/_List_iterator#_List_iterator(ced63f7c635d850d).; |
| 56 | for (g =cxx . . $ std/_List_iterator#`operator=`(afcc16b84d132a1c). fGuiListcxx . . $ GUI#fGuiList..begincxx . . $ std/__cxx11/list#begin(57ce810e58fbcab0).(); g !=cxx . . $ std/`operator!=`(2ff7fa6cf5bdfcad). fGuiListcxx . . $ GUI#fGuiList..endcxx . . $ std/__cxx11/list#end(57ce810e58fbcab0).(); g++cxx . . $ std/_List_iterator#operator++(42220274f0bb161f).) { |
| 57 | (*cxx . . $ std/_List_iterator#`operator*`(d426bc7b625886b7).g)->updateAllZonescxx . . $ GUI#updateAllZones(49f6e7a06ebc5aa8).(); |
| 58 | } |
| 59 | } |
| 60 | void addCallbackcxx . . $ GUI#addCallback(28cbc66cd18882c5).(FAUSTFLOATcxx . . $ `faudiostream/architecture/faust/gui/UI.h:5:9`!* zone, uiCallbackcxx . . $ uiCallback# foo, void* data); |
| 61 | virtual void showcxx . . $ GUI#show(49f6e7a06ebc5aa8).() {}; |
| 62 | virtual void runcxx . . $ GUI#run(49f6e7a06ebc5aa8).() {}; |
| 63 | |
| 64 | void stopcxx . . $ GUI#stop(49f6e7a06ebc5aa8).() { fStoppedcxx . . $ GUI#fStopped. = true; } |
| 65 | bool stoppedcxx . . $ GUI#stopped(c9857a73d68e59ba).() { return fStoppedcxx . . $ GUI#fStopped.; } |
| 66 | |
| 67 | virtual void declarecxx . . $ GUI#declare(295f22ccbfb41ed).(FAUSTFLOATcxx . . $ `faudiostream/architecture/faust/gui/UI.h:5:9`!* , const char* , const char* ) {} |
| 68 | }; |
| 69 | |
| 70 | /** |
| 71 | * User Interface Item: abstract definition |
| 72 | */ |
| 73 | |
| 74 | class uiItemcxx . . $ uiItem# |
| 75 | { |
| 76 | protected : |
| 77 | |
| 78 | GUIcxx . . $ GUI#* fGUIcxx . . $ uiItem#fGUI.; |
| 79 | FAUSTFLOATcxx . . $ `faudiostream/architecture/faust/gui/UI.h:5:9`!* fZonecxx . . $ uiItem#fZone.; |
| 80 | FAUSTFLOATcxx . . $ `faudiostream/architecture/faust/gui/UI.h:5:9`! fCachecxx . . $ uiItem#fCache.; |
| 81 | |
| 82 | uiItemcxx . . $ uiItem#uiItem(fb82a22e008f688e). (GUIcxx . . $ GUI#* ui, FAUSTFLOATcxx . . $ `faudiostream/architecture/faust/gui/UI.h:5:9`!* zone) : fGUIcxx . . $ uiItem#fGUI.(ui), fZonecxx . . $ uiItem#fZone.(zone), fCachecxx . . $ uiItem#fCache.(-123456.654321) |
| 83 | { |
| 84 | ui->registerZonecxx . . $ GUI#registerZone(5a46843687475134).(zone, this); |
| 85 | } |
| 86 | |
| 87 | public : |
| 88 | |
| 89 | virtual ~cxx . . $ uiItem#`~uiItem`(ced63f7c635d850d).uiItemcxx . . $ uiItem#() {} |
| 90 | |
| 91 | void modifyZonecxx . . $ uiItem#modifyZone(9364e6e7bff7660).(FAUSTFLOATcxx . . $ `faudiostream/architecture/faust/gui/UI.h:5:9`! v) |
| 92 | { |
| 93 | fCachecxx . . $ uiItem#fCache. = v; |
| 94 | if (*fZonecxx . . $ uiItem#fZone. != v) { |
| 95 | *fZonecxx . . $ uiItem#fZone. = v; |
| 96 | fGUIcxx . . $ uiItem#fGUI.->updateZonecxx . . $ GUI#updateZone(e6881f009d13a851).(fZonecxx . . $ uiItem#fZone.); |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | FAUSTFLOATcxx . . $ `faudiostream/architecture/faust/gui/UI.h:5:9`! cachecxx . . $ uiItem#cache(9b8c9e39889c762c).() { return fCachecxx . . $ uiItem#fCache.; } |
| 101 | virtual void reflectZonecxx . . $ uiItem#reflectZone(49f6e7a06ebc5aa8).() = 0; |
| 102 | }; |
| 103 | |
| 104 | /** |
| 105 | * Callback Item |
| 106 | */ |
| 107 | |
| 108 | struct uiCallbackItemcxx . . $ uiCallbackItem# : public uiItemcxx . . $ uiItem# |
| 109 | { |
| 110 | uiCallbackcxx . . $ uiCallback# fCallbackcxx . . $ uiCallbackItem#fCallback.; |
| 111 | void* fDatacxx . . $ uiCallbackItem#fData.; |
| 112 | |
| 113 | uiCallbackItemcxx . . $ uiCallbackItem#uiCallbackItem(35339eafd2624672).(GUIcxx . . $ GUI#* ui, FAUSTFLOATcxx . . $ `faudiostream/architecture/faust/gui/UI.h:5:9`!* zone, uiCallbackcxx . . $ uiCallback# foo, void* data) |
| 114 | : uiItemcxx . . $ uiItem#uiItem(fb82a22e008f688e).(ui, zone), fCallbackcxx . . $ uiCallbackItem#fCallback.(foo), fDatacxx . . $ uiCallbackItem#fData.(data) {} |
| 115 | |
| 116 | virtual void reflectZonecxx . . $ uiCallbackItem#reflectZone(49f6e7a06ebc5aa8).() { |
| 117 | FAUSTFLOATcxx . . $ `faudiostream/architecture/faust/gui/UI.h:5:9`! v = *fZonecxx . . $ uiItem#fZone.; |
| 118 | fCachecxx . . $ uiItem#fCache. = v; |
| 119 | fCallbackcxx . . $ uiCallbackItem#fCallback.(v, fDatacxx . . $ uiCallbackItem#fData.); |
| 120 | } |
| 121 | }; |
| 122 | |
| 123 | // en cours d'installation de call back. a finir!!!!! |
| 124 | |
| 125 | /** |
| 126 | * Update all user items reflecting zone z |
| 127 | */ |
| 128 | |
| 129 | inline void GUIcxx . . $ GUI#::updateZonecxx . . $ GUI#updateZone(e6881f009d13a851).(FAUSTFLOATcxx . . $ `faudiostream/architecture/faust/gui/UI.h:5:9`!* z) |
| 130 | { |
| 131 | FAUSTFLOATcxx . . $ `faudiostream/architecture/faust/gui/UI.h:5:9`! v = *z; |
| 132 | clistcxx . . $ GUI#clist#* l = fZoneMapcxx . . $ GUI#fZoneMap.[cxx . . $ std/map#`operator[]`(bbd415b616967878).z]; |
| 133 | for (clistcxx . . $ GUI#clist#::iteratorcxx . . $ std/__cxx11/list#iterator# c = l->begincxx . . $ std/__cxx11/list#begin(57ce810e58fbcab0).(); c !=cxx . . $ std/`operator!=`(2ff7fa6cf5bdfcad). l->endcxx . . $ std/__cxx11/list#end(57ce810e58fbcab0).(); c++cxx . . $ std/_List_iterator#operator++(42220274f0bb161f).) { |
| 134 | if ((*cxx . . $ std/_List_iterator#`operator*`(d426bc7b625886b7).c)->cachecxx . . $ uiItem#cache(9b8c9e39889c762c).() != v) (*cxx . . $ std/_List_iterator#`operator*`(d426bc7b625886b7).c)->reflectZonecxx . . $ uiItem#reflectZone(49f6e7a06ebc5aa8).(); |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * Update all user items not up to date |
| 140 | */ |
| 141 | |
| 142 | inline void GUIcxx . . $ GUI#::updateAllZonescxx . . $ GUI#updateAllZones(49f6e7a06ebc5aa8).() |
| 143 | { |
| 144 | for (zmapcxx . . $ GUI#zmap#::iteratorcxx . . $ std/map#iterator# m = fZoneMapcxx . . $ GUI#fZoneMap..begincxx . . $ std/map#begin(7e4de33083b6e738).(); m !=cxx . . $ std/`operator!=`(be6a71a859368080). fZoneMapcxx . . $ GUI#fZoneMap..endcxx . . $ std/map#end(7e4de33083b6e738).(); m++cxx . . $ std/_Rb_tree_iterator#operator++(2987e7ff93f61dc1).) { |
| 145 | FAUSTFLOATcxx . . $ `faudiostream/architecture/faust/gui/UI.h:5:9`!* z = m->cxx . . $ std/_Rb_tree_iterator#`operator->`(34d6acfd341ba7ab).first; |
| 146 | clistcxx . . $ GUI#clist#* l = m->cxx . . $ std/_Rb_tree_iterator#`operator->`(34d6acfd341ba7ab).second; |
| 147 | FAUSTFLOATcxx . . $ `faudiostream/architecture/faust/gui/UI.h:5:9`! v = *z; |
| 148 | for (clistcxx . . $ GUI#clist#::iteratorcxx . . $ std/__cxx11/list#iterator# c = l->begincxx . . $ std/__cxx11/list#begin(57ce810e58fbcab0).(); c !=cxx . . $ std/`operator!=`(2ff7fa6cf5bdfcad). l->endcxx . . $ std/__cxx11/list#end(57ce810e58fbcab0).(); c++cxx . . $ std/_List_iterator#operator++(42220274f0bb161f).) { |
| 149 | if ((*cxx . . $ std/_List_iterator#`operator*`(d426bc7b625886b7).c)->cachecxx . . $ uiItem#cache(9b8c9e39889c762c).() != v) (*cxx . . $ std/_List_iterator#`operator*`(d426bc7b625886b7).c)->reflectZonecxx . . $ uiItem#reflectZone(49f6e7a06ebc5aa8).(); |
| 150 | } |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | inline void GUIcxx . . $ GUI#::addCallbackcxx . . $ GUI#addCallback(28cbc66cd18882c5).(FAUSTFLOATcxx . . $ `faudiostream/architecture/faust/gui/UI.h:5:9`!* zone, uiCallbackcxx . . $ uiCallback# foo, void* data) |
| 155 | { |
| 156 | new uiCallbackItemcxx . . $ uiCallbackItem#(this, zone, foo, data); |
| 157 | }; |
| 158 | |
| 159 | #endif |