From 05add77f7c55d6d7d21bab8fd9dc11ac6e109a7f Mon Sep 17 00:00:00 2001 From: nebogeo Date: Sun, 3 Nov 2002 19:26:47 +0000 Subject: [PATCH] One to many input->output mapping, KeyboardPlugin, fixed Matrix lag, -v and -h commandline options, new modules appear at consistent point, comment redraw fix, help added, new dialogues. --- GUI/Widgets/Fl_Canvas.C | 184 +++++++--- GUI/Widgets/Fl_Canvas.h | 5 + GUI/Widgets/Fl_CommentGUI.C | 7 +- GUI/Widgets/Fl_DeviceGUI.C | 67 +++- GUI/Widgets/Fl_DeviceGUI.h | 35 +- GUI/Widgets/PawfalInput.C | 157 +++++++++ GUI/Widgets/PawfalInput.h | 95 ++++++ GUI/Widgets/PawfalYesNo.C | 143 ++++++++ GUI/Widgets/PawfalYesNo.h | 94 ++++++ Makefile.in | 14 + SpiralSound/ChannelHandler.C | 32 +- .../ControllerPlugin/ControllerPluginGUI.C | 2 - .../Plugins/KeyboardPlugin/KeyboardPlugin.C | 106 ++++++ .../Plugins/KeyboardPlugin/KeyboardPlugin.h | 50 +++ .../KeyboardPlugin/KeyboardPluginGUI.C | 190 +++++++++++ .../KeyboardPlugin/KeyboardPluginGUI.h | 56 ++++ .../Plugins/KeyboardPlugin/Makefile.in | 182 ++++++++++ .../Plugins/KeyboardPlugin/SpiralIcon.xpm | 316 ++++++++++++++++++ .../Plugins/MatrixPlugin/MatrixPluginGUI.C | 1 + SpiralSound/Plugins/SpiralPluginGUI.C | 45 ++- SpiralSound/Plugins/SpiralPluginGUI.h | 7 +- SpiralSynthModular.C | 33 +- SpiralSynthModular.h | 2 + SpiralSynthModularInfo.C | 1 + configure.in | 5 +- main.cpp | 24 +- 26 files changed, 1754 insertions(+), 99 deletions(-) create mode 100644 GUI/Widgets/PawfalInput.C create mode 100644 GUI/Widgets/PawfalInput.h create mode 100644 GUI/Widgets/PawfalYesNo.C create mode 100644 GUI/Widgets/PawfalYesNo.h create mode 100644 SpiralSound/Plugins/KeyboardPlugin/KeyboardPlugin.C create mode 100644 SpiralSound/Plugins/KeyboardPlugin/KeyboardPlugin.h create mode 100644 SpiralSound/Plugins/KeyboardPlugin/KeyboardPluginGUI.C create mode 100644 SpiralSound/Plugins/KeyboardPlugin/KeyboardPluginGUI.h create mode 100644 SpiralSound/Plugins/KeyboardPlugin/Makefile.in create mode 100644 SpiralSound/Plugins/KeyboardPlugin/SpiralIcon.xpm diff --git a/GUI/Widgets/Fl_Canvas.C b/GUI/Widgets/Fl_Canvas.C index c4487e2..58177d7 100644 --- a/GUI/Widgets/Fl_Canvas.C +++ b/GUI/Widgets/Fl_Canvas.C @@ -185,6 +185,15 @@ void Fl_Canvas::draw() } } +void Fl_Canvas::Poll() +{ + // bit of a workaround... + if(m_IncompleteWire.InputChild!=-1 || m_IncompleteWire.OutputChild!=-1) + { + redraw(); + } +} + void Fl_Canvas::DrawWires() { for(vector::iterator i=m_WireVec.begin(); @@ -206,38 +215,106 @@ void Fl_Canvas::DrawWires() SpiralInfo::Alert("Cant find source or dest device while drawing wires"); return; } - - //============================= - // wire colour stuff - dan b. - //============================= + Fl_Color col = (Fl_Color) WIRE_COL0; switch (SourceDevice->GetPortType(i->OutputPort+SourceDevice->GetInfo()->NumInputs)) { - case 0: col = (Fl_Color) WIRE_COL0; - break; - case 1: col = (Fl_Color) WIRE_COL1; - break; - case 2: col = (Fl_Color) WIRE_COL2; - break; - case 3: col = (Fl_Color) WIRE_COL3; - break; - case 4: col = (Fl_Color) WIRE_COL4; - break; + case 0: col = (Fl_Color) WIRE_COL0; break; + case 1: col = (Fl_Color) WIRE_COL1; break; + case 2: col = (Fl_Color) WIRE_COL2; break; + case 3: col = (Fl_Color) WIRE_COL3; break; + case 4: col = (Fl_Color) WIRE_COL4; break; default: col = (Fl_Color) WIRE_COL0; } fl_color(col); - //============================= fl_line(SourceDevice->GetPortX(i->OutputPort+SourceDevice->GetInfo()->NumInputs), SourceDevice->GetPortY(i->OutputPort+SourceDevice->GetInfo()->NumInputs), DestDevice->GetPortX(i->InputPort), DestDevice->GetPortY(i->InputPort)); } -} + + // draw the wire we are currently connecting + if(m_IncompleteWire.InputChild!=-1) + { + Fl_DeviceGUI* Device = (Fl_DeviceGUI*)(child(m_IncompleteWire.InputChild)); + + if (!Device) + { + SpiralInfo::Alert("Cant find source or dest device while drawing wires"); + return; + } + + + Fl_Color col = (Fl_Color) WIRE_COL0; + switch (Device->GetPortType(m_IncompleteWire.InputPort)) { + case 0: col = (Fl_Color) WIRE_COL0; break; + case 1: col = (Fl_Color) WIRE_COL1; break; + case 2: col = (Fl_Color) WIRE_COL2; break; + case 3: col = (Fl_Color) WIRE_COL3; break; + case 4: col = (Fl_Color) WIRE_COL4; break; + default: col = (Fl_Color) WIRE_COL0; + } + fl_color(col); + + fl_line(Device->GetPortX(m_IncompleteWire.InputPort), + Device->GetPortY(m_IncompleteWire.InputPort), + Fl::event_x(), + Fl::event_y()); + } + + if(m_IncompleteWire.OutputChild!=-1) + { + Fl_DeviceGUI* Device = (Fl_DeviceGUI*)(child(m_IncompleteWire.OutputChild)); + + if (!Device) + { + SpiralInfo::Alert("Cant find source or dest device while drawing wires"); + return; + } + + Fl_Color col = (Fl_Color) WIRE_COL0; + switch (Device->GetPortType(m_IncompleteWire.OutputPort+Device->GetInfo()->NumInputs)) { + case 0: col = (Fl_Color) WIRE_COL0; break; + case 1: col = (Fl_Color) WIRE_COL1; break; + case 2: col = (Fl_Color) WIRE_COL2; break; + case 3: col = (Fl_Color) WIRE_COL3; break; + case 4: col = (Fl_Color) WIRE_COL4; break; + default: col = (Fl_Color) WIRE_COL0; + } + fl_color(col); + + fl_line(Device->GetPortX(m_IncompleteWire.OutputPort+Device->GetInfo()->NumInputs), + Device->GetPortY(m_IncompleteWire.OutputPort+Device->GetInfo()->NumInputs), + Fl::event_x(), + Fl::event_y()); + } +} +void Fl_Canvas::ClearIncompleteWire() +{ + // Turn off both ports + if (m_IncompleteWire.OutputChild!=-1) + { + ((Fl_DeviceGUI*)(child(m_IncompleteWire.OutputChild)))->RemoveConnection(m_IncompleteWire.OutputPort+ + ((Fl_DeviceGUI*)(child(m_IncompleteWire.OutputChild)))->GetInfo()->NumInputs); + } + + if (m_IncompleteWire.InputChild!=-1) + { + ((Fl_DeviceGUI*)(child(m_IncompleteWire.InputChild)))->RemoveConnection(m_IncompleteWire.InputPort); + } + m_IncompleteWire.Clear(); +} + int Fl_Canvas::handle(int event) { if (Fl_Group::handle(event)) return 1; - + + if (event==FL_PUSH) + { + ClearIncompleteWire(); + } + if (Fl::event_button()==3) { if (event==FL_PUSH) @@ -264,7 +341,7 @@ int Fl_Canvas::handle(int event) redraw(); } } - + return 1; } @@ -301,7 +378,7 @@ void Fl_Canvas::PortClicked(Fl_DeviceGUI* Device, int Type, int Port, bool Value } else { - m_IncompleteWire.Clear(); + ClearIncompleteWire(); } } else @@ -315,7 +392,7 @@ void Fl_Canvas::PortClicked(Fl_DeviceGUI* Device, int Type, int Port, bool Value } else { - m_IncompleteWire.Clear(); + ClearIncompleteWire(); } } @@ -328,6 +405,14 @@ void Fl_Canvas::PortClicked(Fl_DeviceGUI* Device, int Type, int Port, bool Value cb_Connection(this,(void*)&m_IncompleteWire); m_Graph.AddConnection(m_IncompleteWire.OutputID,m_IncompleteWire.InputID); + // Turn on both ports + Fl_DeviceGUI* ODGUI = (Fl_DeviceGUI*)(child(m_IncompleteWire.OutputChild)); + ODGUI->AddConnection(m_IncompleteWire.OutputPort+ODGUI->GetInfo()->NumInputs); + + Fl_DeviceGUI* IDGUI = (Fl_DeviceGUI*)(child(m_IncompleteWire.InputChild)); + IDGUI->AddConnection(m_IncompleteWire.InputPort); + + m_IncompleteWire.Clear(); redraw(); @@ -336,30 +421,41 @@ void Fl_Canvas::PortClicked(Fl_DeviceGUI* Device, int Type, int Port, bool Value } else // Turned off the port { - // Find the connection - for(vector::iterator i=m_WireVec.begin(); - i!=m_WireVec.end(); i++) + // Find connections using this port + bool Found=true; + + while (Found) { - if ((Type==Fl_DeviceGUI::OUTPUT && i->OutputChild==ChildNum && i->OutputPort==Port) || - (Type==Fl_DeviceGUI::INPUT && i->InputChild==ChildNum && i->InputPort==Port)) + Found=false; + + for(vector::iterator i=m_WireVec.begin(); + i!=m_WireVec.end(); i++) { - // Turn off both ports - ((Fl_DeviceGUI*)(child(i->OutputChild)))->ForcePortValue(i->OutputPort+ - ((Fl_DeviceGUI*)(child(i->OutputChild)))->GetInfo()->NumInputs,false); - ((Fl_DeviceGUI*)(child(i->InputChild)))->ForcePortValue(i->InputPort,false); - - // send the unconnect callback - cb_Unconnect(this,(void*)&(*i)); - m_Graph.RemoveConnection(i->OutputID,i->InputID); + if ((Type==Fl_DeviceGUI::OUTPUT && i->OutputChild==ChildNum && i->OutputPort==Port) || + (Type==Fl_DeviceGUI::INPUT && i->InputChild==ChildNum && i->InputPort==Port)) + { + // Turn off both ports + Fl_DeviceGUI* ODGUI = (Fl_DeviceGUI*)(child(i->OutputChild)); + ODGUI->RemoveConnection(i->OutputPort+ODGUI->GetInfo()->NumInputs); + + Fl_DeviceGUI* IDGUI = (Fl_DeviceGUI*)(child(i->InputChild)); + IDGUI->RemoveConnection(i->InputPort); + + // send the unconnect callback + cb_Unconnect(this,(void*)&(*i)); + m_Graph.RemoveConnection(i->OutputID,i->InputID); - // Remove the wire - m_WireVec.erase(i); - - redraw(); - break; + // Remove the wire + m_WireVec.erase(i); + + Found=true; + break; + } } } + redraw(); + // Clear the current selection m_IncompleteWire.Clear(); } @@ -396,9 +492,9 @@ void Fl_Canvas::ClearConnections(Fl_DeviceGUI* Device) i->InputChild==ChildNum) { // Turn off both ports - ((Fl_DeviceGUI*)(child(i->OutputChild)))->ForcePortValue(i->OutputPort+ - ((Fl_DeviceGUI*)(child(i->OutputChild)))->GetInfo()->NumInputs,false); - ((Fl_DeviceGUI*)(child(i->InputChild)))->ForcePortValue(i->InputPort,false); + ((Fl_DeviceGUI*)(child(i->OutputChild)))->RemoveConnection(i->OutputPort+ + ((Fl_DeviceGUI*)(child(i->OutputChild)))->GetInfo()->NumInputs); + ((Fl_DeviceGUI*)(child(i->InputChild)))->RemoveConnection(i->InputPort); // send the unconnect callback cb_Unconnect(this,(void*)&(*i)); @@ -483,9 +579,9 @@ istream &operator>>(istream &s, Fl_Canvas &o) o.m_Graph.AddConnection(NewWire.OutputID,NewWire.InputID); // Turn on both ports - ((Fl_DeviceGUI*)(o.child(NewWire.OutputChild)))->ForcePortValue(NewWire.OutputPort+ - ((Fl_DeviceGUI*)(o.child(NewWire.OutputChild)))->GetInfo()->NumInputs,true); - ((Fl_DeviceGUI*)(o.child(NewWire.InputChild)))->ForcePortValue(NewWire.InputPort,true); + ((Fl_DeviceGUI*)(o.child(NewWire.OutputChild)))->AddConnection(NewWire.OutputPort+ + ((Fl_DeviceGUI*)(o.child(NewWire.OutputChild)))->GetInfo()->NumInputs); + ((Fl_DeviceGUI*)(o.child(NewWire.InputChild)))->AddConnection(NewWire.InputPort); } return s; diff --git a/GUI/Widgets/Fl_Canvas.h b/GUI/Widgets/Fl_Canvas.h index 7c0e4d4..e3e0fae 100644 --- a/GUI/Widgets/Fl_Canvas.h +++ b/GUI/Widgets/Fl_Canvas.h @@ -43,6 +43,7 @@ public: InputChild=-1; InputPort=-1; InputID=-1; + DelMe=false; } int OutputID; @@ -51,6 +52,7 @@ public: int InputID; int InputChild; int InputPort; + bool DelMe; }; class Fl_Canvas : public Fl_Group @@ -73,10 +75,13 @@ public: void AddPluginName(const string &s, int ID) { m_PluginNameList.push_back(pair(s,ID)); } GraphSort* GetGraph() { return &m_Graph; } + + void Poll(); private: void DrawWires(); + void ClearIncompleteWire(); Fl_Image *m_BG; char *m_BGData; diff --git a/GUI/Widgets/Fl_CommentGUI.C b/GUI/Widgets/Fl_CommentGUI.C index f01f452..5295c50 100644 --- a/GUI/Widgets/Fl_CommentGUI.C +++ b/GUI/Widgets/Fl_CommentGUI.C @@ -17,9 +17,9 @@ */ #include "Fl_CommentGUI.h" -#include #include #include "../../SpiralSynthModularInfo.h" +#include "../../GUI/Widgets/PawfalInput.h" Fl_CommentGUI::Fl_CommentGUI(const DeviceGUIInfo& Info, Fl_Window *PW, Fl_Pixmap *Icon) : Fl_DeviceGUI(Info,PW,Icon), @@ -36,8 +36,8 @@ int Fl_CommentGUI::handle(int event) { if (Fl::event_button()==1 && event==FL_PUSH && Fl::event_clicks()==1) { - const char *t=fl_input("and your comment is:", m_Comment.c_str()); - if (t) + char t[1024]; + if (Pawfal_Input("and your comment is:", m_Comment.c_str(), t)) { string temp(t); if (temp!="") @@ -45,6 +45,7 @@ int Fl_CommentGUI::handle(int event) m_Comment=temp; m_DragBar->label(m_Comment.c_str()); redraw(); + parent()->redraw(); //int x,y; //fl_measure(m_Comment.c_str(),x,y); //m_DragBar->size(x,y); diff --git a/GUI/Widgets/Fl_DeviceGUI.C b/GUI/Widgets/Fl_DeviceGUI.C index b19b2f6..a9c0fd7 100644 --- a/GUI/Widgets/Fl_DeviceGUI.C +++ b/GUI/Widgets/Fl_DeviceGUI.C @@ -21,6 +21,35 @@ #include "../../SpiralSynthModularInfo.h" int Fl_DeviceGUI::Numbers[512]; + +Fl_PortButton::Fl_PortButton(int x, int y, int w, int h, char *n) : +Fl_Button(x,y,w,h,n) +{ + m_ConnectionCount=0; +} + +int Fl_PortButton::handle(int event) +{ + if (event==FL_PUSH) + { + m_LastButton=Fl::event_button(); + + if (m_LastButton == 1) + { + if (m_Type==INPUT && value()) return 1; + do_callback(); + return 1; + } + + if (m_LastButton == 3) + { + do_callback(); + return 1; + } + } + + return 1; +} Fl_DeviceGUI::Fl_DeviceGUI(const DeviceGUIInfo& Info, Fl_Group *PW, Fl_Pixmap *Icon) : Fl_Group(Info.XPos, Info.YPos, Info.Width+(PortGroupWidth*2), Info.Height+TitleBarHeight, ""), @@ -107,7 +136,7 @@ void Fl_DeviceGUI::Setup(const DeviceGUIInfo& Info, bool FirstTime) } // delete the current ports - for(vector::iterator i=m_PortVec.begin(); + for(vector::iterator i=m_PortVec.begin(); i!=m_PortVec.end(); i++) { remove(*i); @@ -126,8 +155,9 @@ void Fl_DeviceGUI::Setup(const DeviceGUIInfo& Info, bool FirstTime) for (int n=0; ntype(1); + NewInput->SetType(Fl_PortButton::INPUT); NewInput->value(false); NewInput->box(FL_ROUNDED_BOX); @@ -157,8 +187,9 @@ void Fl_DeviceGUI::Setup(const DeviceGUIInfo& Info, bool FirstTime) for (int n=0; ntype(1); + NewOutput->SetType(Fl_PortButton::OUTPUT); NewOutput->value(false); NewOutput->box(FL_ROUNDED_BOX); @@ -188,9 +219,27 @@ void Fl_DeviceGUI::Setup(const DeviceGUIInfo& Info, bool FirstTime) } } +void Fl_DeviceGUI::AddConnection(int n) +{ + m_PortVec[n]->Add(); + m_PortVec[n]->value(1); + redraw(); +} + +void Fl_DeviceGUI::RemoveConnection(int n) +{ + m_PortVec[n]->Remove(); + if (!m_PortVec[n]->GetCount()) + { + m_PortVec[n]->value(0); + redraw(); + } +} + inline void Fl_DeviceGUI::cb_Port_i(Fl_Button* o, void* v) { int Port=*(int*)(v); + Fl_PortButton *PortButton = (Fl_PortButton *)o; PortType Pt; if (m_DelMe) return; @@ -205,9 +254,15 @@ inline void Fl_DeviceGUI::cb_Port_i(Fl_Button* o, void* v) Pt=OUTPUT; Port-=m_Info.NumInputs; } - - ((Fl_Canvas*)(parent()))->PortClicked(this,Pt,Port,o->value()); - + + if (PortButton->GetLastButton()==1) + { + ((Fl_Canvas*)(parent()))->PortClicked(this,Pt,Port,1); + } + else + { + ((Fl_Canvas*)(parent()))->PortClicked(this,Pt,Port,0); + } } void Fl_DeviceGUI::cb_Port(Fl_Button* o, void* v) diff --git a/GUI/Widgets/Fl_DeviceGUI.h b/GUI/Widgets/Fl_DeviceGUI.h index 3e98251..fdd54ef 100644 --- a/GUI/Widgets/Fl_DeviceGUI.h +++ b/GUI/Widgets/Fl_DeviceGUI.h @@ -41,6 +41,28 @@ static const int TitleBarHeight = 12; static const int PortGroupWidth = 12; static const int PortSize=6; +class Fl_PortButton : public Fl_Button +{ +public: + enum Type {INPUT,OUTPUT}; + + Fl_PortButton(int x, int y, int w, int h, char *n); + virtual ~Fl_PortButton() {}; + void SetType(Type s) { m_Type=s; } + virtual int handle(int event); + + void Add() { m_ConnectionCount++; } + void Remove() { m_ConnectionCount--; } + int GetCount() { return m_ConnectionCount; } + int GetLastButton() { return m_LastButton; } + +private: + + Type m_Type; + int m_ConnectionCount; + int m_LastButton; +}; + struct DeviceGUIInfo { int XPos; @@ -67,13 +89,16 @@ public: int GetID() { return m_ID; } void SetID(int s) { m_ID=s; /*DisplayID(s);*/ } - /*char did[8]; - void DisplayID(int s) { sprintf(did,"%d",s); label(did); }*/ - bool Killed() { return m_DelMe; } int GetPortX(int n) { return m_PortVec[n]->x()+PortSize/2; } int GetPortY(int n) { return m_PortVec[n]->y()+PortSize/2; } - void ForcePortValue(int n, bool v) { m_PortVec[n]->value(v); } + + // aesthitic, to keep track of number of connections to know whether to + // draw the port as occupied or not. + void AddConnection(int n); + void RemoveConnection(int n); + + bool GetPortValue(int n) { return m_PortVec[n]->value(); } const DeviceGUIInfo* GetInfo() { return &m_Info; } Fl_Group* GetPluginWindow() { return m_PluginWindow; } @@ -95,7 +120,7 @@ private: inline void cb_Port_i(Fl_Button* o, void* v); static void cb_Port(Fl_Button* o, void* v); - vector m_PortVec; + vector m_PortVec; static int Numbers[512]; diff --git a/GUI/Widgets/PawfalInput.C b/GUI/Widgets/PawfalInput.C new file mode 100644 index 0000000..239a90d --- /dev/null +++ b/GUI/Widgets/PawfalInput.C @@ -0,0 +1,157 @@ +/* PawfalInput Fltk Dialog + * Copyleft (C) 2001 Dan Bethell + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include "PawfalInput.h" +#include + +bool Pawfal_Input(const char *a, const char *b, char *out) +{ + PawfalInput pi(300, 100,a,b); + if (pi.go()) + { + strcpy(out,pi.getText()); + return true; + } + + return true; +} + +PawfalInput::PawfalInput(int x, int y, int w, int h, const char *label, const char *dflt): + Fl_Window(x,y,w, h), + lbl(new Fl_Box(50, ((h-30)/2)-20, w-60,20, label)), + input(new Fl_Input(50,((h-30)/2)+0,w-60,20)), + ok(new Fl_Button(w-100, h-25, 30, 20, "ok")), + cancel(new Fl_Button(w-60, h-25, 50, 20, "cancel")), + keyhit(false) +{ + + lbl->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + lbl->labelfont(FL_SCREEN_BOLD); + lbl->labelsize(12); + + ok->labelfont(FL_SCREEN_BOLD); + ok->labelsize(12); + cancel->labelfont(FL_SCREEN_BOLD); + cancel->labelsize(12); + + input->value(dflt); + input->textfont(FL_SCREEN_BOLD); + input->textsize(12); + logo = new Fl_Pixmap(tv_xpm); + + end(); + set_modal(); + //clear_border(); +} + +PawfalInput::PawfalInput(int w, int h, const char *label, const char *dflt): + Fl_Window(w, h, "Enter text"), + lbl(new Fl_Box(50, ((h-30)/2)-20, w-60,20, label)), + input(new Fl_Input(50,((h-30)/2)+0,w-60,20)), + ok(new Fl_Button(w-100, h-25, 30, 20, "ok")), + cancel(new Fl_Button(w-60, h-25, 50, 20, "cancel")), + keyhit(false) +{ + + lbl->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + lbl->labelfont(FL_SCREEN_BOLD); + lbl->labelsize(12); + + ok->labelfont(FL_SCREEN_BOLD); + ok->labelsize(12); + cancel->labelfont(FL_SCREEN_BOLD); + cancel->labelsize(12); + + input->value(dflt); + input->textfont(FL_SCREEN_BOLD); + input->textsize(12); + logo = new Fl_Pixmap(tv_xpm); + + end(); + set_modal(); + //clear_border(); +} + +PawfalInput::~PawfalInput() +{ + delete logo; +} + +int PawfalInput::handle(int e) +{ + int result = Fl_Window::handle(e); + + if (e==FL_KEYBOARD) + { + if (Fl::event_key()==FL_Escape||Fl::event_key()==FL_Enter) + keyhit=true; + } + return result; +} + +void PawfalInput::draw() +{ + Fl_Window::draw(); + logo->draw(10, 10); +} + +void PawfalInput::ok_cb(Fl_Button *b, void *d) +{ + assert(b!=NULL); + PawfalInput *ptr = (PawfalInput *)d; + assert(ptr!=NULL); +} + +void PawfalInput::cancel_cb(Fl_Button *b, void *d) +{ + assert(b!=NULL); + PawfalInput *ptr = (PawfalInput *)d; + assert(ptr!=NULL); +} + +bool PawfalInput::go() +{ + bool result = false; + show(); + + for (;;) + { + Fl_Widget *o = Fl::readqueue(); + if (!o&&!keyhit) Fl::wait(); + else if (keyhit) + { + int key = Fl::event_key(); + + if (key==FL_Escape) + { + result = false; + break; + } + + if (key==FL_Enter) + { + result=true; + break; + } + } + else if (o == ok) {result = true; break;} + else if (o == cancel) {result = false; break;} + } + + hide(); + return result; +} diff --git a/GUI/Widgets/PawfalInput.h b/GUI/Widgets/PawfalInput.h new file mode 100644 index 0000000..2c6cff1 --- /dev/null +++ b/GUI/Widgets/PawfalInput.h @@ -0,0 +1,95 @@ +/* PawfalInput Fltk Dialog + * Copyleft (C) 2001 Dan Bethell + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef PAWFALINPUT_H +#define PAWFALINPUT_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static char * tv_xpm[] = { +"30 30 4 1", +" c None", +". c #000000", +"+ c #6E6E6E", +"@ c #FFFFFF", +"..............................", +"..............................", +"..............................", +"..............................", +"..............................", +".....++++++++++++++++++++.....", +".....++++++@@@@@@@@++++++.....", +".....++++++@@@+++@@++++++.....", +".....++++++++++++@@++++++.....", +".....++++++++++++@@++++++.....", +".....+++++++++@@@@@++++++.....", +".....+++++++++@@+++++++++.....", +".....++++++++++++++++++++.....", +".....+++++++++@@+++++++++.....", +".....++++++++++++++++++++.....", +"..............................", +"..............................", +"..............................", +"..............................", +"..............................", +" .......... ", +" .......... ", +" .......... ", +" .......... ", +" .......... ", +"..............................", +"..............................", +"..............................", +"..............................", +".............................."}; + +class PawfalInput : public Fl_Window +{ + int handle(int); + void draw(); + + static void ok_cb(Fl_Button *, void *); + static void cancel_cb(Fl_Button *, void *); + + public: + PawfalInput(int, int, int, int, const char *, const char *); + PawfalInput(int, int, const char *, const char *); + ~PawfalInput(); + + bool go(); + const char *getText(){return input->value();} + + private: + Fl_Pixmap *logo; + Fl_Box *lbl; + Fl_Input *input; + Fl_Button *ok, *cancel; + bool keyhit; +}; + +bool Pawfal_Input(const char *a, const char *b, char *out); + +#endif diff --git a/GUI/Widgets/PawfalYesNo.C b/GUI/Widgets/PawfalYesNo.C new file mode 100644 index 0000000..a371fca --- /dev/null +++ b/GUI/Widgets/PawfalYesNo.C @@ -0,0 +1,143 @@ +/* PawfalYesNo Fltk Dialog + * Copyleft (C) 2001 Dan Bethell + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include "PawfalYesNo.h" +#include +#include +#include +#include + +bool Pawfal_YesNo(const char *a,...) +{ + va_list ap; + va_start(ap, a); + char buffer[1024]; + if (!strcmp(a,"%s")) { + strcpy(buffer,va_arg(ap, const char*)); + } else { + //: matt: MacOS provides two equally named vsnprintf's... + ::vsnprintf(buffer, 1024, a, ap); + } + va_end(ap); + + PawfalYesNo pi(300, 100,buffer); + if (pi.go()) return true; + return false; +} + +PawfalYesNo::PawfalYesNo(int w, int h, const char *label): + Fl_Window(w,h,"Question"), + lbl(new Fl_Box(50, 15, w-60,20, label)), + keyhit(false), + result(false) +{ + lbl->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + lbl->labelfont(FL_SCREEN_BOLD); + lbl->labelsize(12); + + int message_w, message_h; + fl_font(FL_SCREEN_BOLD, 12); + message_w = message_h = 0; + fl_measure(label, message_w, message_h); + resize(x(),y(),message_w+60,h); + + w=message_w+60; + + yes = new Fl_Button(w-120, h-25, 50, 20, "yes"); + no = new Fl_Button(w-60, h-25, 50, 20, "no"); + + yes->labelfont(FL_SCREEN_BOLD); + yes->labelsize(12); + no->labelfont(FL_SCREEN_BOLD); + no->labelsize(12); + + logo = new Fl_Pixmap(tv_xpm); + + end(); + set_modal(); + //clear_border(); +} + +PawfalYesNo::~PawfalYesNo() +{ + delete logo; +} + +int PawfalYesNo::handle(int e) +{ + int result = Fl_Window::handle(e); + + if (e==FL_KEYBOARD) + { + if (Fl::event_key()==FL_Escape||Fl::event_key()==FL_Enter) + keyhit=true; + } + return result; +} + +void PawfalYesNo::draw() +{ + Fl_Window::draw(); + logo->draw(10, 10); +} + +void PawfalYesNo::ok_cb(Fl_Button *b, void *d) +{ + assert(b!=NULL); + PawfalYesNo *ptr = (PawfalYesNo *)d; + assert(ptr!=NULL); +} + +void PawfalYesNo::cancel_cb(Fl_Button *b, void *d) +{ + assert(b!=NULL); + PawfalYesNo *ptr = (PawfalYesNo *)d; + assert(ptr!=NULL); +} + +bool PawfalYesNo::go() +{ + result = false; + show(); + + for (;;) + { + Fl_Widget *o = Fl::readqueue(); + if (!o&&!keyhit) Fl::wait(); + else if (keyhit) + { + int key = Fl::event_key(); + + if (key==FL_Escape) + { + result = false; + break; + } + + if (key==FL_Enter) + { + result=true; + break; + } + } + else if (o == yes) {result = true; break;} + else if (o == no) {result = false; break;} + } + + hide(); + return result; +} diff --git a/GUI/Widgets/PawfalYesNo.h b/GUI/Widgets/PawfalYesNo.h new file mode 100644 index 0000000..efb6fc5 --- /dev/null +++ b/GUI/Widgets/PawfalYesNo.h @@ -0,0 +1,94 @@ +/* PawfalYesNo Fltk Dialog + * Copyleft (C) 2001 Dan Bethell + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef PAWFALYESNO_H +#define PAWFALYESNO_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static char * tv_xpm[] = { +"30 30 4 1", +" c None", +". c #000000", +"+ c #6E6E6E", +"@ c #FFFFFF", +"..............................", +"..............................", +"..............................", +"..............................", +"..............................", +".....++++++++++++++++++++.....", +".....+++++++++@@+++++++++.....", +".....+++++++++@@+++++++++.....", +".....+++++++++@@+++++++++.....", +".....+++++++++@@+++++++++.....", +".....+++++++++@@+++++++++.....", +".....+++++++++@@+++++++++.....", +".....++++++++++++++++++++.....", +".....+++++++++@@+++++++++.....", +".....++++++++++++++++++++.....", +"..............................", +"..............................", +"..............................", +"..............................", +"..............................", +" .......... ", +" .......... ", +" .......... ", +" .......... ", +" .......... ", +"..............................", +"..............................", +"..............................", +"..............................", +".............................."}; + +class PawfalYesNo : public Fl_Window +{ + int handle(int); + void draw(); + + static void ok_cb(Fl_Button *, void *); + static void cancel_cb(Fl_Button *, void *); + + public: + PawfalYesNo(int, int, const char *); + ~PawfalYesNo(); + + bool go(); + bool getResult() { return result; } + + private: + Fl_Pixmap *logo; + Fl_Box *lbl; + Fl_Button *yes, *no; + bool keyhit; + bool result; +}; + +bool Pawfal_YesNo(const char *a,...); + +#endif diff --git a/Makefile.in b/Makefile.in index a5462ff..ef9bded 100644 --- a/Makefile.in +++ b/Makefile.in @@ -52,6 +52,8 @@ HEADERS = SpiralSynthModular.h \ GUI/Widgets/Fl_CommentGUI.h \ GUI/Widgets/Fl_DragBar.H \ GUI/Widgets/Fl_Canvas.h \ + GUI/Widgets/PawfalYesNo.h \ + GUI/Widgets/PawfalInput.h \ SpiralSound/SpiralInfo.h \ SpiralSound/Sample.h \ SpiralSound/Plugins/SpiralPlugin.h \ @@ -68,6 +70,8 @@ SOURCES = main.cpp \ GUI/Widgets/Fl_CommentGUI.C \ GUI/Widgets/Fl_DragBar.cxx \ GUI/Widgets/Fl_Canvas.C \ + GUI/Widgets/PawfalYesNo.C \ + GUI/Widgets/PawfalInput.C \ SpiralSound/SpiralInfo.C \ SpiralSound/Sample.C \ SpiralSound/Plugins/SpiralPlugin.C \ @@ -83,6 +87,8 @@ OBJECTS = main.o \ GUI/Widgets/Fl_CommentGUI.o \ GUI/Widgets/Fl_DragBar.o \ GUI/Widgets/Fl_Canvas.o \ + GUI/Widgets/PawfalYesNo.o \ + GUI/Widgets/PawfalInput.o \ SpiralSound/SpiralInfo.o \ SpiralSound/Sample.o \ SpiralSound/Plugins/SpiralPlugin.o \ @@ -180,6 +186,8 @@ SpiralSynthModular.o: SpiralSynthModular.C \ GUI/Widgets/Fl_DeviceGUI.h \ GUI/Widgets/Fl_CommentGUI.h \ GUI/Widgets/Fl_Canvas.h \ + GUI/Widgets/PawfalYesNo.h \ + GUI/Widgets/PawfalInput.h \ SpiralSound/Plugins/SpiralPlugin.h \ SettingsWindow.h \ SpiralSound/PluginManager.h \ @@ -228,6 +236,12 @@ GUI/Widgets/Fl_Canvas.o: GUI/Widgets/Fl_Canvas.C \ GUI/Widgets/../../SpiralSynthModularInfo.h \ SpiralSound/SpiralInfo.h +GUI/Widgets/PawfalInput.o: GUI/Widgets/PawfalInput.C \ + GUI/Widgets/PawfalInput.h + +GUI/Widgets/PawfalYesNo.o: GUI/Widgets/PawfalYesNo.C \ + GUI/Widgets/PawfalYesNo.h + SpiralSound/SpiralInfo.o: SpiralSound/SpiralInfo.C \ SpiralSound/SpiralInfo.h \ SpiralSound/Sample.h diff --git a/SpiralSound/ChannelHandler.C b/SpiralSound/ChannelHandler.C index 84d40af..4d047ba 100644 --- a/SpiralSound/ChannelHandler.C +++ b/SpiralSound/ChannelHandler.C @@ -330,31 +330,23 @@ void ChannelHandler::BulkTransfer(const string &ID, void *dest, int size) } void ChannelHandler::Wait() -{ - pthread_mutex_lock(m_Mutex); - bool current=m_UpdateIndicator; - bool last=m_UpdateIndicator; - pthread_mutex_unlock(m_Mutex); +{ + bool current; + bool last; - while (current==last) + for (int n=0; n<2; n++) { - usleep(10); pthread_mutex_lock(m_Mutex); current=m_UpdateIndicator; + last=m_UpdateIndicator; pthread_mutex_unlock(m_Mutex); - } - // do this twice (messages have to get there and back?) - pthread_mutex_lock(m_Mutex); - current=m_UpdateIndicator; - last=m_UpdateIndicator; - pthread_mutex_unlock(m_Mutex); - - while (current==last) - { - usleep(10); - pthread_mutex_lock(m_Mutex); - current=m_UpdateIndicator; - pthread_mutex_unlock(m_Mutex); + while (current==last) + { + usleep(10); + pthread_mutex_lock(m_Mutex); + current=m_UpdateIndicator; + pthread_mutex_unlock(m_Mutex); + } } } diff --git a/SpiralSound/Plugins/ControllerPlugin/ControllerPluginGUI.C b/SpiralSound/Plugins/ControllerPlugin/ControllerPluginGUI.C index 4d7399d..64128b8 100644 --- a/SpiralSound/Plugins/ControllerPlugin/ControllerPluginGUI.C +++ b/SpiralSound/Plugins/ControllerPlugin/ControllerPluginGUI.C @@ -164,8 +164,6 @@ inline void ControllerPluginGUI::cb_Chan_i(Fl_Slider* o, void* v) char temp[256]; sprintf(temp,"%s",m_GuiVec[num]->m_Title->value()); - cerr<<"sending "<SetData("Name",(void*)temp); m_GUICH->SetCommand(ControllerPlugin::SETCHANNEL); } diff --git a/SpiralSound/Plugins/KeyboardPlugin/KeyboardPlugin.C b/SpiralSound/Plugins/KeyboardPlugin/KeyboardPlugin.C new file mode 100644 index 0000000..38e7788 --- /dev/null +++ b/SpiralSound/Plugins/KeyboardPlugin/KeyboardPlugin.C @@ -0,0 +1,106 @@ +/* SpiralSound + * Copyleft (C) 2001 David Griffiths + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "KeyboardPlugin.h" +#include "KeyboardPluginGUI.h" +#include "../../NoteTable.h" +#include "SpiralIcon.xpm" + +extern "C" { +SpiralPlugin* CreateInstance() +{ + return new KeyboardPlugin; +} + +char** GetIcon() +{ + return SpiralIcon_xpm; +} + +int GetID() +{ + return 40; +} +} + +/////////////////////////////////////////////////////// + +KeyboardPlugin::KeyboardPlugin() : +m_NoteLevel(0), +m_TriggerLevel(0) +{ + m_Version=0; + + m_PluginInfo.Name="Keyboard"; + m_PluginInfo.Width=300; + m_PluginInfo.Height=90; + m_PluginInfo.NumInputs=0; + m_PluginInfo.NumOutputs=2; + m_PluginInfo.PortTips.push_back("Note CV"); + m_PluginInfo.PortTips.push_back("Trigger CV"); + + m_AudioCH->Register("Note",&m_GUIArgs.Note); +} + +KeyboardPlugin::~KeyboardPlugin() +{ +} + +SpiralGUIType *KeyboardPlugin::CreateGUI() +{ + return new KeyboardPluginGUI(m_PluginInfo.Width, + m_PluginInfo.Height, + this,m_AudioCH,m_HostInfo); +} + +void KeyboardPlugin::Execute() +{ + for (int n=0; nBUFSIZE; n++) + { + SetOutputPitch(0,n,m_NoteLevel); + SetOutput(1,n,m_TriggerLevel); + } +} + +void KeyboardPlugin::ExecuteCommands() +{ + // Process any commands from the GUI + if (m_AudioCH->IsCommandWaiting()) + { + switch (m_AudioCH->GetCommand()) + { + case NOTE_ON : + m_NoteLevel=NoteTable[m_GUIArgs.Note]; + m_TriggerLevel=1.0f; + break; + case NOTE_OFF : m_TriggerLevel=0.0f; break; + }; + } +} + +void KeyboardPlugin::StreamOut(ostream &s) +{ + s<>version; +} + diff --git a/SpiralSound/Plugins/KeyboardPlugin/KeyboardPlugin.h b/SpiralSound/Plugins/KeyboardPlugin/KeyboardPlugin.h new file mode 100644 index 0000000..e458885 --- /dev/null +++ b/SpiralSound/Plugins/KeyboardPlugin/KeyboardPlugin.h @@ -0,0 +1,50 @@ +/* SpiralSound + * Copyleft (C) 2001 David Griffiths + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "../SpiralPlugin.h" +#include + +#ifndef PLUGIN +#define PLUGIN + +class KeyboardPlugin : public SpiralPlugin +{ +public: + KeyboardPlugin(); + virtual ~KeyboardPlugin(); + + virtual SpiralGUIType* CreateGUI(); + virtual void Execute(); + virtual void ExecuteCommands(); + virtual void StreamOut(ostream &s); + virtual void StreamIn(istream &s); + + enum GUICommands{NONE,NOTE_ON,NOTE_OFF}; + struct GUIArgs + { + int Note; + }; + +private: + GUIArgs m_GUIArgs; + + float m_NoteLevel; + float m_TriggerLevel; +}; + +#endif diff --git a/SpiralSound/Plugins/KeyboardPlugin/KeyboardPluginGUI.C b/SpiralSound/Plugins/KeyboardPlugin/KeyboardPluginGUI.C new file mode 100644 index 0000000..5bf1250 --- /dev/null +++ b/SpiralSound/Plugins/KeyboardPlugin/KeyboardPluginGUI.C @@ -0,0 +1,190 @@ +/* SpiralPlugin + * Copyleft (C) 2000 David Griffiths + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "KeyboardPluginGUI.h" +#include +#include +#include +#include +#include + +static const int GUI_COLOUR = 179; +static const int GUIBG_COLOUR = 144; +static const int GUIBG2_COLOUR = 145; + +static int NKEYS = 30; +static char KEYMAP[30]={'z','s','x','d','c','v','g','b','h','n','j','m','q', + '2','w','3','e','r','5','t','6','y','7','u','i','9', + 'o','0','p','['}; + +//////////////////////////////////////////////////////////////////////// + +KeyboardPluginGUI::KeyboardPluginGUI(int w, int h,KeyboardPlugin *o,ChannelHandler *ch,const HostInfo *Info) : +SpiralPluginGUI(w,h,o,ch), +m_Last(-1), +m_Oct(4) +{ + Fl_Scroll *Scroll = new Fl_Scroll(2,20,w-4,h-20); + Fl_Group *Group = new Fl_Group(0,20,500,h-40); + Group->box(FL_FLAT_BOX); + Group->user_data(this); + Scroll->add(Group); + + int KeyWidth=10,Note,Pos=0,Count=0; + + for (int n=0; nbox(FL_THIN_UP_BOX); + m_Key[n]->labelsize(10); + m_Key[n]->when(FL_WHEN_CHANGED); + + if (Note==0) + { + int Num=n/12; + sprintf(m_Label[n],"%d",Num); + m_Key[n]->label(m_Label[n]); + m_Key[n]->align(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE); + } + m_Key[n]->color(FL_WHITE); + m_Key[n]->selection_color(FL_WHITE); + m_Key[n]->callback((Fl_Callback*)cb_Key, &m_Num[n]); + Group->add(m_Key[n]); + } + } + + Count=0; + for (int n=0; nbox(FL_THIN_UP_BOX); + m_Key[n]->labelsize(10); + m_Key[n]->when(FL_WHEN_CHANGED); + m_Key[n]->color(FL_BLACK); + m_Key[n]->selection_color(FL_BLACK); + m_Key[n]->callback((Fl_Callback*)cb_Key, &m_Num[n]); + Group->add(m_Key[n]); + } + else + { + Count++; + Pos=Count*KeyWidth; + } + } + Group->position(-100,20); + Group->end(); + Scroll->end(); +} + +void KeyboardPluginGUI::Update() +{ + int Volume=0,Note=0,EventDevice=0; + if (Fl::event_key(FL_F+1)) m_Oct=0; + if (Fl::event_key(FL_F+2)) m_Oct=1; + if (Fl::event_key(FL_F+3)) m_Oct=2; + if (Fl::event_key(FL_F+4)) m_Oct=3; + if (Fl::event_key(FL_F+5)) m_Oct=4; + if (Fl::event_key(FL_F+6)) m_Oct=5; + if (Fl::event_key(FL_F+7)) m_Oct=6; + if (Fl::event_key(FL_F+8)) m_Oct=7; + if (Fl::event_key(FL_F+9)) m_Oct=8; + if (Fl::event_key(FL_F+10)) m_Oct=9; + if (Fl::event_key(FL_F+11)) m_Oct=10; + + int note=0; + char KeyChar=0; + bool KeyPressed=false; + + for (int key=0; keyvalue(0); + m_Key[m_Last]->parent()->redraw(); + m_GUICH->SetCommand(KeyboardPlugin::NOTE_OFF); + m_GUICH->Wait(); + } + + m_Last = Note; + m_GUICH->Set("Note",Note); + m_GUICH->SetCommand(KeyboardPlugin::NOTE_ON); + m_Key[Note]->value(1); + m_Key[m_Last]->parent()->redraw(); + } + } + else // it's not pressed down + { + //see if the note was pressed down last time + Note=(m_Oct*12)+note; + + if (m_Last==Note) + { + m_Key[m_Last]->value(0); + m_Key[m_Last]->parent()->redraw(); + m_GUICH->SetCommand(KeyboardPlugin::NOTE_OFF); + m_Last=-1; + } + } + note++; + } +} + +void KeyboardPluginGUI::UpdateValues(SpiralPlugin *o) +{ + KeyboardPlugin *Plugin = (KeyboardPlugin*)o; +} + +//// Callbacks //// +inline void KeyboardPluginGUI::cb_Key_i(Fl_Button* o, void* v) +{ + int k=*(int*)(v); + if (o->value()) + { + m_GUICH->Set("Note",k); + m_GUICH->SetCommand(KeyboardPlugin::NOTE_ON); + } + else + { + m_GUICH->SetCommand(KeyboardPlugin::NOTE_OFF); + } + parent()->redraw(); +} +void KeyboardPluginGUI::cb_Key(Fl_Button* o, void* v) +{ ((KeyboardPluginGUI*)(o->parent()->user_data()))->cb_Key_i(o,v);} diff --git a/SpiralSound/Plugins/KeyboardPlugin/KeyboardPluginGUI.h b/SpiralSound/Plugins/KeyboardPlugin/KeyboardPluginGUI.h new file mode 100644 index 0000000..aa6ebd5 --- /dev/null +++ b/SpiralSound/Plugins/KeyboardPlugin/KeyboardPluginGUI.h @@ -0,0 +1,56 @@ +/* SpiralPlugin + * Copyleft (C) 2000 David Griffiths + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include +#include +#include + +#include "../Widgets/Fl_Knob.H" +#include "../Widgets/Fl_DragBar.H" +#include "KeyboardPlugin.h" +#include "../SpiralPluginGUI.h" + +#ifndef MIDIGUI +#define MIDIGUI + +const int NUM_KEYS = 132; + +class KeyboardPluginGUI : public SpiralPluginGUI +{ +public: + KeyboardPluginGUI(int w, int h, KeyboardPlugin *o,ChannelHandler *ch,const HostInfo *Info); + + virtual void UpdateValues(SpiralPlugin *o); + virtual void Update(); + +private: + int m_Num[NUM_KEYS]; + Fl_Button* m_Key[NUM_KEYS]; + char m_Label[NUM_KEYS][2]; + int m_Last; + int m_Oct; + + //// Callbacks //// + inline void cb_Key_i(Fl_Button* o, void* v); + static void cb_Key(Fl_Button* o, void* v); +}; + +#endif diff --git a/SpiralSound/Plugins/KeyboardPlugin/Makefile.in b/SpiralSound/Plugins/KeyboardPlugin/Makefile.in new file mode 100644 index 0000000..9c2fe5e --- /dev/null +++ b/SpiralSound/Plugins/KeyboardPlugin/Makefile.in @@ -0,0 +1,182 @@ +############################################################################# +# Makefile for building KeyboardPlugin.so +# Generated by tmake at 22:13, 2001/09/17 +# Project: KeyboardPlugin +# Template: app +############################################################################# + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +CFLAGS = @CFLAGS@ +CXXFLAGS= @CXXFLAGS@ +INCPATH = -I/usr/X11R6/include +LINK = g++ -shared +LFLAGS = +LIBS = -L/usr/X11R6/lib -lfltk -lGL -lXext -lX11 -lm -ldl -pthread +MOC = moc +UIC = + +TAR = tar -cf +GZIP = gzip -9f + +INSTALL = @INSTALL@ + +###### Autoconf variables + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ + +####### Files + +HEADERS = ../SpiralPlugin.h \ + ../SpiralPluginGUI.h \ + ../../ChannelHandler.h \ + ../Widgets/Fl_Knob.H \ + ../Widgets/Fl_DragBar.H \ + ../../Sample.h \ + ../../Midi.h \ + KeyboardPlugin.h \ + KeyboardPluginGUI.h +SOURCES = ../SpiralPlugin.C \ + ../SpiralPluginGUI.C \ + ../../ChannelHandler.C \ + ../Widgets/Fl_Knob.cxx \ + ../Widgets/Fl_DragBar.cxx \ + ../../Sample.C \ + ../../Midi.C \ + KeyboardPlugin.C \ + KeyboardPluginGUI.C +OBJECTS = ../SpiralPlugin.o \ + ../SpiralPluginGUI.o \ + ../../ChannelHandler.o \ + ../Widgets/Fl_Knob.o \ + ../Widgets/Fl_DragBar.o \ + ../../Sample.o \ + ../../Midi.o \ + KeyboardPlugin.o \ + KeyboardPluginGUI.o +INTERFACES = +UICDECLS = +UICIMPLS = +SRCMOC = +OBJMOC = +DIST = +TARGET = KeyboardPlugin.so + +####### Implicit rules + +.SUFFIXES: .cpp .cxx .cc .C .c + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< + +####### Build rules + + +all: $(TARGET) + +$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) + +moc: $(SRCMOC) + +tmake: + tmake KeyboardPlugin.pro + +dist: + $(TAR) KeyboardPlugin.tar KeyboardPlugin.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) + $(GZIP) KeyboardPlugin.tar + +clean: + -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) + -rm -f *~ core + +install: + $(INSTALL) $(TARGET) $(libdir)/SpiralPlugins + +####### Sub-libraries + + +###### Combined headers + + +####### Compile + +../SpiralPlugin.o: ../SpiralPlugin.C \ + ../SpiralPlugin.h \ + ../../Sample.h + +../SpiralPluginGUI.o: ../SpiralPluginGUI.C \ + ../SpiralPluginGUI.h \ + ../Widgets/Fl_DragBar.H \ + ../SpiralPlugin.h \ + ../../Sample.h + +../Widgets/Fl_Knob.o: ../Widgets/Fl_Knob.cxx \ + ../Widgets/Fl_Knob.H + +../Widgets/Fl_DragBar.o: ../Widgets/Fl_DragBar.cxx \ + ../Widgets/Fl_DragBar.H + +../../Sample.o: ../../Sample.C \ + ../../Sample.h \ + ../../SpiralInfo.h + +../../Midi.o: ../../Midi.C \ + ../../Midi.h \ + ../../NoteTable.h + +KeyboardPlugin.o: KeyboardPlugin.C \ + KeyboardPlugin.h \ + ../SpiralPlugin.h \ + ../../Sample.h \ + ../../SpiralInfo.h \ + ../../Sample.h \ + KeyboardPluginGUI.h \ + ../Widgets/Fl_Knob.H \ + ../Widgets/Fl_DragBar.H \ + ../SpiralPluginGUI.h \ + ../Widgets/Fl_DragBar.H \ + ../../NoteTable.h \ + ../../Midi.h \ + SpiralIcon.xpm + +KeyboardPluginGUI.o: KeyboardPluginGUI.C \ + KeyboardPluginGUI.h \ + ../Widgets/Fl_Knob.H \ + ../Widgets/Fl_DragBar.H \ + KeyboardPlugin.h \ + ../SpiralPlugin.h \ + ../../Sample.h \ + ../../SpiralInfo.h \ + ../../Sample.h \ + ../SpiralPluginGUI.h \ + ../Widgets/Fl_DragBar.H + +../../ChannelHandler.o: ../../ChannelHandler.C \ + ../../ChannelHandler.h diff --git a/SpiralSound/Plugins/KeyboardPlugin/SpiralIcon.xpm b/SpiralSound/Plugins/KeyboardPlugin/SpiralIcon.xpm new file mode 100644 index 0000000..748a2c8 --- /dev/null +++ b/SpiralSound/Plugins/KeyboardPlugin/SpiralIcon.xpm @@ -0,0 +1,316 @@ +/* XPM */ +static char * SpiralIcon_xpm[] = { +"36 36 277 2", +" c None", +". c #8B889B", +"+ c #9C99AA", +"@ c #ADAAB9", +"# c #837F94", +"$ c #7D7990", +"% c #9995A7", +"& c #67627C", +"* c #CDCBD4", +"= c #FCFCFC", +"- c #D1D0D8", +"; c #FFFFFF", +"> c #F1F1F3", +", c #848095", +"' c #2A2248", +") c #CFCED6", +"! c #68637D", +"~ c #ABA8B6", +"{ c #D5D3DB", +"] c #9490A2", +"^ c #C4C4C4", +"/ c #1D1C1D", +"( c #313134", +"_ c #EEEFEE", +": c #FBFBFB", +"< c #EFEFEF", +"[ c #7B768D", +"} c #464060", +"| c #DEDEE1", +"1 c #CBCACC", +"2 c #EEEEF1", +"3 c #79758C", +"4 c #FBFBFC", +"5 c #A2A2A2", +"6 c #000000", +"7 c #F5F6F5", +"8 c #747474", +"9 c #2A2A2B", +"0 c #403958", +"a c #7D788F", +"b c #C0BEC8", +"c c #BCBAC6", +"d c #BCBAC5", +"e c #625C79", +"f c #2B2932", +"g c #191919", +"h c #CCCCCC", +"i c #807B91", +"j c #3B3556", +"k c #F2F2F4", +"l c #929292", +"m c #0E0E0E", +"n c #BFBFBF", +"o c #111111", +"p c #100E15", +"q c #868689", +"r c #FEFDFE", +"s c #D9D7DE", +"t c #9C98AA", +"u c #FDFCFD", +"v c #DDDDDD", +"w c #575755", +"x c #5E5E5E", +"y c #C4C2CD", +"z c #423C5C", +"A c #F0F0F2", +"B c #939393", +"C c #555555", +"D c #4A4A4A", +"E c #010101", +"F c #282828", +"G c #C2C2C2", +"H c #DBDAE0", +"I c #615C78", +"J c #F6F6F7", +"K c #DADADA", +"L c #545454", +"M c #0F0F0F", +"N c #B8B8B8", +"O c #48445C", +"P c #2B2B2C", +"Q c #181900", +"R c #D3D3D3", +"S c #C1BEC9", +"T c #474060", +"U c #31294D", +"V c #716C85", +"W c #65607A", +"X c #625D78", +"Y c #D5D4DB", +"Z c #F7F7F7", +"` c #8B8B8B", +" . c #161616", +".. c #0C0C0C", +"+. c #161800", +"@. c #1A1B00", +"#. c #060600", +"$. c #191A00", +"%. c #393643", +"&. c #47415F", +"*. c #9692A4", +"=. c #D9D8DE", +"-. c #F7F7F8", +";. c #918DA0", +">. c #B8B5C1", +",. c #D1D1D1", +"'. c #252525", +"). c #040400", +"!. c #FFF200", +"~. c #727175", +"{. c #FEFEFF", +"]. c #9D99AA", +"^. c #DBD9E0", +"/. c #E9E9E9", +"(. c #CBCBCB", +"_. c #E0E0E0", +":. c #6C6C6C", +"<. c #515151", +"[. c #A6A6A7", +"}. c #827E93", +"|. c #615C77", +"1. c #EAEAED", +"2. c #DFDFE1", +"3. c #050500", +"4. c #1E1D24", +"5. c #9894A7", +"6. c #B1AEBB", +"7. c #69686F", +"8. c #000001", +"9. c #020200", +"0. c #615C76", +"a. c #5F5A75", +"b. c #413E4D", +"c. c #020203", +"d. c #1A1A1C", +"e. c #C3C1CB", +"f. c #9D9D9D", +"g. c #202020", +"h. c #383838", +"i. c #4C4C4C", +"j. c #111112", +"k. c #C9C7D0", +"l. c #F1F1F1", +"m. c #F8F8F8", +"n. c #050408", +"o. c #AEACB9", +"p. c #FEFEFE", +"q. c #B7B5C1", +"r. c #9390A2", +"s. c #BBBBBB", +"t. c #414141", +"u. c #28272A", +"v. c #F4F4F6", +"w. c #605B76", +"x. c #736E86", +"y. c #D8D8D8", +"z. c #727272", +"A. c #101010", +"B. c #848486", +"C. c #CCCBD3", +"D. c #747087", +"E. c #6D6881", +"F. c #1C1C1C", +"G. c #242424", +"H. c #0A0A00", +"I. c #656566", +"J. c #F6F6F6", +"K. c #E8E6EA", +"L. c #706B84", +"M. c #E3E1E6", +"N. c #474746", +"O. c #151515", +"P. c #C8C8C8", +"Q. c #AEAEAE", +"R. c #080808", +"S. c #010100", +"T. c #373639", +"U. c #FDFCFE", +"V. c #ABA8B7", +"W. c #F1F0F3", +"X. c #6D6980", +"Y. c #0A090E", +"Z. c #95929E", +"`. c #0A0810", +" + c #0D0D0D", +".+ c #050505", +"++ c #5B5A5C", +"@+ c #F7F6F7", +"#+ c #F4F3F5", +"$+ c #908C9F", +"%+ c #C8C6D0", +"&+ c #837E96", +"*+ c #86868A", +"=+ c #070608", +"-+ c #ECEBEE", +";+ c #5B5571", +">+ c #646078", +",+ c #AFAFB0", +"'+ c #454545", +")+ c #363636", +"!+ c #7A7A7A", +"~+ c #C8C8C9", +"{+ c #212025", +"]+ c #060607", +"^+ c #969699", +"/+ c #FAFAFA", +"(+ c #F8F8F9", +"_+ c #A29EAF", +":+ c #F7F6F8", +"<+ c #F0F0F1", +"[+ c #B8B7B9", +"}+ c #E4E4E4", +"|+ c #FDFDFD", +"1+ c #A5A2B2", +"2+ c #3B3456", +"3+ c #A8A5B4", +"4+ c #525252", +"5+ c #848387", +"6+ c #CDCDCD", +"7+ c #8D899C", +"8+ c #494262", +"9+ c #68627C", +"0+ c #40395A", +"a+ c #ECECEC", +"b+ c #020202", +"c+ c #B4B5B5", +"d+ c #0B0B0B", +"e+ c #313232", +"f+ c #E3E3E3", +"g+ c #B1AEBC", +"h+ c #BDBBC6", +"i+ c #3C3556", +"j+ c #898599", +"k+ c #EDEDED", +"l+ c #39393A", +"m+ c #040404", +"n+ c #333333", +"o+ c #F5F5F5", +"p+ c #2B2B2B", +"q+ c #2D2A3D", +"r+ c #B6B4C1", +"s+ c #F5F5F6", +"t+ c #605A76", +"u+ c #DAD8DF", +"v+ c #F5F4F6", +"w+ c #615B76", +"x+ c #524D6A", +"y+ c #E4E3E8", +"z+ c #D5D5D5", +"A+ c #1B1B1B", +"B+ c #303030", +"C+ c #AAABAB", +"D+ c #585464", +"E+ c #B0AEBB", +"F+ c #A29FAF", +"G+ c #E9E8E9", +"H+ c #787779", +"I+ c #0F0E15", +"J+ c #2D2D2E", +"K+ c #595959", +"L+ c #FAFAFB", +"M+ c #807B92", +"N+ c #B0ADBB", +"O+ c #E8E7EB", +"P+ c #3A3258", +"Q+ c #E6E5EA", +"R+ c #DFDEE3", +"S+ c #443E5E", +"T+ c #BAB8C4", +"U+ c #C1BFCA", +"V+ c #E0E0E5", +"W+ c #D0CED6", +"X+ c #362F52", +"Y+ c #CECCD5", +"Z+ c #413A5B", +"`+ c #6A657F", +" @ c #9793A6", +" ", +" ", +" ", +" . + @ # $ % ", +" & * = * - ; > , ' ; ; ; ) ! ", +" ~ ; ; { ] ; ^ / ( _ ; : < [ ", +" } | 1 2 3 4 5 6 6 7 : 8 9 0 a b ", +" c : d e f g h i j k l 6 m ; n o 6 p q r s ", +" t u ; v w 6 6 x y z A B 6 C ; D E 6 F G ; H ", +" I J ; ; K L 6 6 M N O P E 6 6 6 Q Q M R S T U V W ", +" X Y ; ; ; ; Z ` .6 ..6 6 6 6 6 +.@.#.$.%.&.*.=.-.;. ", +" >.; ; ; ; ; ; = ,.'.6 6 ).6 6 6 !.6 6 6 E ~.{.; ; ]. ", +" ^.; ; /.R h (._.:.6 6 6 6 6 !.!.6 !.6 6 6 6 <.[.4 }. ", +" |.1.; 2...6 6 6 6 6 6 6 6 !.!.3.!.6 6 !.6 6 6 6 4.5. ", +" V @ 6.7.8.6 6 6 6 6 6 6 !.!.6 9.!.!.6 6 !.6 6 6 ", +" 0.a.b.6 c.6 6 6 6 6 6 !.6 !.6 6 !.6 6 !.!.6 6 d. ", +" e.; ; f.g.g.h.i.g.6 6 !.6 6 6 !.6 6 !.!.6 !.6 6 j. ", +" k.; ; l.m.; ; ; 6 6 6 !.6 6 6 6 !.!.6 6 6 !.6 6 n. ", +" o.; ; ; ; p.; ; 6 6 !.!.6 6 6 6 6 6 6 6 6 6 !.6 6 q., ", +" r.; ; p.; : s.t.6 6 6 !.!.6 6 6 6 6 6 6 6 6 !.6 u.p.v.w. ", +" x.; ; ; y.z.A.6 6 6 6 6 !.!.6 6 6 6 6 6 6 !.6 6 B.; ; C.D. ", +" E.J ; : F.6 6 6 6 G...6 6 6 !.6 6 H.6 !.!.6 6 6 I.J.; ; K.L. ", +" M.; ; N.6 E 6 O.P.Q.R.6 6 6 !.!.!.!.6 S.6 6 6 6 T.U.; ; > L. ", +" V.; W.X.Y.6 6 Q.p.; Z.`.6 6 6 6 6 6 6 6 +.+6 6 6 ++@+; ; #+$+ ", +" L.%+! &+*+=+x ; ; -+;+>+,+l '+6 6 6 )+!+~+{+6 6 6 ]+^+/+; ; (+@ ", +" _+:+<+[+}+|+; 1+2+3+; J.'+6 6 E 4+; ; 5+6 6 E 6 o 6+; ; = 7+ ", +" 8+> ; ; ; ; ; ; 9+0+; ; a+h.6 6 b+D ; ; c+d+6 6 6 e+f+; ; g+ ", +" > ; ; ; ; h+i+j+; ; k+l+6 6 m+n+; ; o+p+6 6 q+r+; s+3 ", +" t+u+= ; v+w+x+y+; ; z+A+6 6 b+B+; ; ; C+4+D+ ", +" E+4 F+ X ; ; ; G+H+B+I+J+K+; ; ; p.L+M+ ", +" N+; ; ; ; ; O+P+Q+; ; ; ; = R+S+ ", +" T+U+V+4 ; ; W+X+Y+; ; ; s j+T ", +" Z+ `+ @j+ ", +" ", +" ", +" "}; diff --git a/SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.C b/SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.C index 4152b1e..0b82d7a 100644 --- a/SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.C +++ b/SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.C @@ -250,6 +250,7 @@ void MatrixPluginGUI::UpdateValues(SpiralPlugin *o) void MatrixPluginGUI::UpdateMatrix() { + m_GUICH->Wait(); m_GUICH->RequestChannelAndWait("Matrix"); m_GUICH->GetData("Matrix",(void*)m_GUIMatrix); diff --git a/SpiralSound/Plugins/SpiralPluginGUI.C b/SpiralSound/Plugins/SpiralPluginGUI.C index 29302b7..072c498 100644 --- a/SpiralSound/Plugins/SpiralPluginGUI.C +++ b/SpiralSound/Plugins/SpiralPluginGUI.C @@ -20,28 +20,39 @@ #include "SpiralPlugin.h" #include #include +#include static const int GUI_COLOUR = 154; static const int GUIBG_COLOUR = 144; static const int GUIBG2_COLOUR = 145; SpiralPluginGUI::SpiralPluginGUI(int w, int h, SpiralPlugin* o, ChannelHandler *ch) : -SpiralGUIType(0,0,w,h,"") +SpiralGUIType(0,0,w,h,""), +m_HelpWin(NULL) { Fl::visible_focus(false); m_GUICH = ch; box(FL_THIN_UP_BOX); - m_DragBar = new Fl_DragBar(0,0,w,20,o->GetName().c_str()); + m_DragBar = new Fl_DragBar(0,0,w,15,o->GetName().c_str()); + m_DragBar->labelsize(10); m_DragBar->type(Fl_DragBar::FLDRAG); add(m_DragBar); - m_Hide = new Fl_Button(2,2,18,16,"X"); + m_Hide = new Fl_Button(0,0,18,16,"X"); m_Hide->labeltype(FL_ENGRAVED_LABEL); + m_Hide->labelsize(10); m_Hide->box(FL_NO_BOX); m_Hide->callback((Fl_Callback*)cb_Hide); add(m_Hide); + + m_Help = new Fl_Button(w-15,0,18,16,"?"); + m_Help->labeltype(FL_ENGRAVED_LABEL); + m_Help->labelsize(10); + m_Help->box(FL_NO_BOX); + m_Help->callback((Fl_Callback*)cb_Help); + add(m_Help); } SpiralPluginGUI::~SpiralPluginGUI() @@ -54,6 +65,11 @@ void SpiralPluginGUI::Update() { } +const string SpiralPluginGUI::GetHelpText() +{ + return "Help! I need some helptext!!!"; +} + //// Callbacks //// inline void SpiralPluginGUI::cb_Hide_i(Fl_Button* o, void* v) @@ -61,4 +77,27 @@ inline void SpiralPluginGUI::cb_Hide_i(Fl_Button* o, void* v) void SpiralPluginGUI::cb_Hide(Fl_Button* o, void* v) { ((SpiralPluginGUI*)(o->parent()))->cb_Hide_i(o,v); } +inline void SpiralPluginGUI::cb_Help_i(Fl_Button* o, void* v) +{ + if (m_HelpWin==NULL) + { + int w=300,h=200; + m_HelpWin = new Fl_Double_Window(w,h,"Help"); + + Fl_Multiline_Output* text= new Fl_Multiline_Output(0,0,w,h); + text->value(GetHelpText().c_str()); + text->textsize(10); + text->set_output(); + m_HelpWin->add(text); + + m_HelpWin->show(); + } + else + { + m_HelpWin->hide(); + delete m_HelpWin; + } +} +void SpiralPluginGUI::cb_Help(Fl_Button* o, void* v) +{ ((SpiralPluginGUI*)(o->parent()))->cb_Help_i(o,v); } diff --git a/SpiralSound/Plugins/SpiralPluginGUI.h b/SpiralSound/Plugins/SpiralPluginGUI.h index 17a19aa..1aa27bd 100644 --- a/SpiralSound/Plugins/SpiralPluginGUI.h +++ b/SpiralSound/Plugins/SpiralPluginGUI.h @@ -45,14 +45,19 @@ public: protected: ChannelHandler *m_GUICH; - + virtual const string GetHelpText(); + private: Fl_DragBar* m_DragBar; Fl_Button* m_Hide; + Fl_Button* m_Help; + Fl_Double_Window *m_HelpWin; //// Callbacks //// inline void cb_Hide_i(Fl_Button* o, void* v); static void cb_Hide(Fl_Button*, void*); + inline void cb_Help_i(Fl_Button* o, void* v); + static void cb_Help(Fl_Button*, void*); }; #endif diff --git a/SpiralSynthModular.C b/SpiralSynthModular.C index 259c43b..f7087d4 100644 --- a/SpiralSynthModular.C +++ b/SpiralSynthModular.C @@ -23,7 +23,6 @@ #include #include #include -#include #include #include @@ -38,10 +37,11 @@ #include "GUI/options.xpm" #include "GUI/edit.xpm" #include "GUI/comment.xpm" +#include "GUI/Widgets/PawfalYesNo.h" //#define DEBUG_PLUGINS -const static string LABEL = "SpiralSynthModular 0.1.1 MultiThreaded"; +const static string LABEL = "SpiralSynthModular "+VER_STRING; static string TITLEBAR; static const int FILE_VERSION = 3; @@ -210,6 +210,8 @@ void SynthModular::UpdatePluginGUIs() break; } } + + m_Canvas->Poll(); } ////////////////////////////////////////////////////////// @@ -358,7 +360,7 @@ SpiralWindowType *SynthModular::CreateWindow() m_Canvas->SetAddDeviceCallback((Fl_Callback*)cb_NewDeviceFromMenu); m_CanvasScroll->add(m_Canvas); - m_NewComment = new Fl_Button(TOOLBOX_WIDTH/2-16, MAIN_HEIGHT*2-25, 32, 20, ""); + m_NewComment = new Fl_Button(TOOLBOX_WIDTH/2-16, MAIN_HEIGHT*2-25, 40, 40, ""); m_NewComment->box(FL_NO_BOX); m_Canvas->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE); tPix = new Fl_Pixmap(comment_xpm); @@ -560,9 +562,16 @@ DeviceWin* SynthModular::NewDeviceWin(int n, int x, int y) ////////////////////////////////////////////////////////// -void SynthModular::AddDevice(int n, int x=TOOLBOX_WIDTH+50, int y=400) +void SynthModular::AddDevice(int n, int x=-1, int y=-1) { //cerr<<"Adding "<x()+50; + y = m_CanvasScroll->y()+50; + } + DeviceWin* temp = NewDeviceWin(n,x,y); if (temp) { @@ -576,10 +585,16 @@ void SynthModular::AddDevice(int n, int x=TOOLBOX_WIDTH+50, int y=400) ////////////////////////////////////////////////////////// -DeviceWin* SynthModular::NewComment(int n, int x=TOOLBOX_WIDTH+50, int y=400) +DeviceWin* SynthModular::NewComment(int n, int x=-1, int y=-1) { DeviceWin *nlw = new DeviceWin; - + + if (x==-1) + { + x = m_CanvasScroll->x()+50; + y = m_CanvasScroll->y()+50; + } + nlw->m_Device=NULL; nlw->m_PluginID = COMMENT_ID; @@ -858,7 +873,7 @@ void SynthModular::cb_Close(Fl_Window* o, void* v) inline void SynthModular::cb_Load_i(Fl_Button* o, void* v) { - if (m_DeviceWinMap.size()>0 && !fl_ask("Load - Loose changes to current design?")) + if (m_DeviceWinMap.size()>0 && !Pawfal_YesNo("Load - Loose changes to current design?")) { return; } @@ -896,7 +911,7 @@ inline void SynthModular::cb_Save_i(Fl_Button* o, void* v) ifstream ifl(fn); if (ifl) { - if (!fl_ask("File [%s] exists, overwrite?",fn)) + if (!Pawfal_YesNo("File [%s] exists, overwrite?",fn)) { return; } @@ -922,7 +937,7 @@ void SynthModular::cb_Save(Fl_Button* o, void* v) inline void SynthModular::cb_New_i(Fl_Button* o, void* v) { - if (m_DeviceWinMap.size()>0 && !fl_ask("New - Loose changes to current design?")) + if (m_DeviceWinMap.size()>0 && !Pawfal_YesNo("New - Loose changes to current design?")) { return; } diff --git a/SpiralSynthModular.h b/SpiralSynthModular.h index 33fc465..2116da8 100644 --- a/SpiralSynthModular.h +++ b/SpiralSynthModular.h @@ -39,6 +39,8 @@ #include "SpiralSound/ChannelHandler.h" #include "SettingsWindow.h" +const static string VER_STRING = "0.2.0"; + typedef Fl_Double_Window SpiralWindowType; // typedef Fl_Window SpiralWindowType; diff --git a/SpiralSynthModularInfo.C b/SpiralSynthModularInfo.C index 37c1e75..0bca8a3 100644 --- a/SpiralSynthModularInfo.C +++ b/SpiralSynthModularInfo.C @@ -72,6 +72,7 @@ SpiralSynthModularInfo::SpiralSynthModularInfo() PLUGINVEC.push_back("OutputPlugin.so"); PLUGINVEC.push_back("ScopePlugin.so"); PLUGINVEC.push_back("MidiPlugin.so"); + PLUGINVEC.push_back("KeyboardPlugin.so"); PLUGINVEC.push_back("ControllerPlugin.so"); PLUGINVEC.push_back("WaveTablePlugin.so"); PLUGINVEC.push_back("OscillatorPlugin.so"); diff --git a/configure.in b/configure.in index 2c2db74..bee32a1 100644 --- a/configure.in +++ b/configure.in @@ -44,7 +44,7 @@ if test $ac_arg_jack = "Y" ; then SampleHoldPlugin ScopePlugin SmoothPlugin SplitterPlugin \ StereoMixerPlugin WaveTablePlugin LADSPAPlugin \ XFadePlugin JackPlugin PoshSamplerPlugin\ - DistributorPlugin LFOPlugin" + DistributorPlugin LFOPlugin KeyboardPlugin" else PLUGINLIST="AmpPlugin ControllerPlugin DelayPlugin EchoPlugin EnvFollowerPlugin \ EnvelopePlugin FilterPlugin MatrixPlugin MidiPlugin MixerPlugin MoogFilterPlugin \ @@ -52,7 +52,7 @@ else SampleHoldPlugin ScopePlugin SmoothPlugin SplitterPlugin \ StereoMixerPlugin WaveTablePlugin LADSPAPlugin \ XFadePlugin PoshSamplerPlugin\ - DistributorPlugin LFOPlugin" + DistributorPlugin LFOPlugin KeyboardPlugin" fi echo "$PLUGINLIST" > SpiralSound/PluginList.txt @@ -160,6 +160,7 @@ SpiralSound/Plugins/DistributorPlugin/Makefile SpiralSound/Plugins/JoystickPlugin/Makefile SpiralSound/Plugins/LFOPlugin/Makefile SpiralSound/Plugins/MeterPlugin/Makefile +SpiralSound/Plugins/KeyboardPlugin/Makefile Makefile ) diff --git a/main.cpp b/main.cpp index deab573..dab19ac 100644 --- a/main.cpp +++ b/main.cpp @@ -79,6 +79,21 @@ int main(int argc, char **argv) if (!strcmp(argv[a],"--NoGUI")) GUI = false; else if (!strcmp(argv[a],"--SHED_FIFO")) FIFO = true; else if (!strcmp(argv[a],"--CallbackOnly")) CallbackOnly = true; + else if (!strcmp(argv[a],"-h")) + { + cout<<"usage: spiralsynthmodular [options] [patch.ssm]"<xclass(""); if (GUI) win->show(1, argv); // prevents stuff happening before the plugins have loaded - // set some fltk defaults - Fl_Tooltip::size(10); - Fl::visible_focus(false); - // spawn the audio thread int ret; if (FIFO) ret=pthread_create_realtime(&loopthread,(void*(*)(void*))audioloop,NULL,10);