From 1d164f76f8a32188edb8342321f375d72a5ea844 Mon Sep 17 00:00:00 2001 From: nebogeo Date: Sat, 25 Jan 2003 01:05:38 +0000 Subject: [PATCH] major GUI overhaul + streaming bug in counterplugin fixed --- GUI/Widgets/Fl_Canvas.C | 20 ++- GUI/Widgets/Fl_DeviceGUI.C | 95 +++++++++-- GUI/Widgets/Fl_DeviceGUI.h | 12 +- .../Plugins/CounterPlugin/CounterPlugin.C | 4 +- .../Plugins/CounterPlugin/CounterPluginGUI.C | 2 +- .../Plugins/OperatorPlugin/OperatorPlugin.C | 9 + SpiralSound/Plugins/SpiralPluginGUI.C | 13 +- SpiralSound/Plugins/SpiralPluginGUI.h | 3 - SpiralSound/Plugins/Widgets/Fl_Knob.cxx | 6 +- SpiralSound/Sample.h | 2 +- SpiralSynthModular.C | 159 +++++------------- SpiralSynthModular.h | 9 - 12 files changed, 169 insertions(+), 165 deletions(-) diff --git a/GUI/Widgets/Fl_Canvas.C b/GUI/Widgets/Fl_Canvas.C index a2a3823..b7aa0a9 100644 --- a/GUI/Widgets/Fl_Canvas.C +++ b/GUI/Widgets/Fl_Canvas.C @@ -88,14 +88,30 @@ void Fl_Canvas::draw() draw_box(); } + // draw minimised modules first for (int i=children(); i--;) { Fl_Widget& o = **a++; - draw_child(o); - draw_outside_label(o); + if (((Fl_DeviceGUI*)&o)->IsMinimised()) + { + draw_child(o); + draw_outside_label(o); + } } DrawWires(); + + // draw maximised modules on top of everything else + Fl_Widget*const* a = array(); + for (int i=children(); i--;) + { + Fl_Widget& o = **a++; + if (!((Fl_DeviceGUI*)&o)->IsMinimised()) + { + draw_child(o); + draw_outside_label(o); + } + } } else // only redraw the children that need it: { diff --git a/GUI/Widgets/Fl_DeviceGUI.C b/GUI/Widgets/Fl_DeviceGUI.C index 608c5b7..5002c15 100644 --- a/GUI/Widgets/Fl_DeviceGUI.C +++ b/GUI/Widgets/Fl_DeviceGUI.C @@ -60,7 +60,8 @@ m_Icon(NULL), m_Name(Info.Name), m_ID(-1), m_DelMe(false), -m_IsTerminal(Terminal) +m_IsTerminal(Terminal), +m_Minimised(true) { for (int n=0; n<512; n++) Numbers[n]=n; @@ -71,7 +72,9 @@ m_IsTerminal(Terminal) color(SpiralSynthModularInfo::GUICOL_Device); m_Icon=Icon; - + m_MiniWidth=w(); + m_MiniHeight=h(); + m_DragBar = new Fl_DragBar(Info.XPos, Info.YPos, Info.Width+PortGroupWidth*2, TitleBarHeight, m_Name.c_str()); m_DragBar->labelsize(10); m_DragBar->type(Fl_DragBar::FLDRAG); @@ -85,11 +88,13 @@ m_IsTerminal(Terminal) m_Menu->add("delete", 0, (Fl_Callback*)cb_Delete,this); m_PluginWindow = PW; + if (m_PluginWindow) + { + m_PluginWindow->hide(); + add(m_PluginWindow); + } - #ifdef PLUGINGUI_IN_MODULE_TEST - m_PluginWindow->show(); - add(m_PluginWindow); - #endif + resizable(NULL); //Add the input/output ports Setup(Info, true); @@ -104,38 +109,91 @@ int Fl_DeviceGUI::handle(int event) { int t=Fl_Group::handle(event); + /*if (m_PluginWindow) + { + if (Fl::event_x()>x() && Fl::event_x()y() && Fl::event_y()visible() && m_PluginWindow && !m_DelMe) + { + m_Minimised=false; + Resize(m_PluginWindow->w()+(PortGroupWidth*2),m_PluginWindow->h()+TitleBarHeight); + m_PluginWindow->show(); + } + } + else + { + if (m_Minimised==false)// && !m_PluginWindow->visible()) + { + m_Minimised=true; + Resize(m_MiniWidth,m_MiniHeight); + m_PluginWindow->hide(); + parent()->redraw(); + } + }*/ + + if (t==0 && Fl::belowmouse()==this) { if (event==FL_PUSH && Fl::event_button()==1) { if (m_PluginWindow && !m_DelMe) { - if(!m_PluginWindow->visible()) - { - m_PluginWindow->show(); - } - /*else - { - m_PluginWindow->hide(); - }*/ + if(!m_PluginWindow->visible()) Maximise(); } } } + if (m_Minimised==false && !m_PluginWindow->visible()) Minimise(); + return t; } +void Fl_DeviceGUI::Minimise() +{ + m_Minimised=true; + Resize(m_MiniWidth,m_MiniHeight); + parent()->redraw(); +} + +void Fl_DeviceGUI::Maximise() +{ + m_Minimised=false; + if (m_PluginWindow->h()+2>m_MiniHeight) + { + Resize(m_PluginWindow->w()+(PortGroupWidth*2)-5,m_PluginWindow->h()+2); + } + else + { + Resize(m_PluginWindow->w()+(PortGroupWidth*2)-5,m_MiniHeight); + } + + m_PluginWindow->show(); +} + +void Fl_DeviceGUI::Resize(int width, int height) +{ + int oldw = w(); + int oldh = h(); + size(width,height); + m_DragBar->size(width,m_DragBar->h()); + + for (int n=m_Info.NumInputs; n<(int)m_PortVec.size(); n++) + { + m_PortVec[n]->position(x()+width-8,m_PortVec[n]->y()); + } + + position(x()+(oldw-w())/2,y()+(oldh-h())/2); +} + void Fl_DeviceGUI::draw() { Fl_Group::draw(); - #ifndef PLUGINGUI_IN_MODULE_TEST - if (m_Icon) + if (m_Icon && m_Minimised) { int Centx=x()+w()/2; int Centy=y()+h()/2; m_Icon->draw(Centx-m_Icon->w()/2,Centy-m_Icon->h()/2); } - #endif } void Fl_DeviceGUI::Setup(const DeviceGUIInfo& Info, bool FirstTime) @@ -164,7 +222,8 @@ void Fl_DeviceGUI::Setup(const DeviceGUIInfo& Info, bool FirstTime) int PortDist=10; int PortNum=0; - h(Info.Height+TitleBarHeight); + m_MiniHeight=Info.Height+TitleBarHeight; + h(m_MiniHeight); for (int n=0; nlabel(m_Name.c_str()); } - + bool IsMinimised() { return m_Minimised; } + + void Minimise(); + void Maximise(); + // automatically called from the constructor, but may be redone at any time. virtual void Setup(const DeviceGUIInfo& Info, bool FirstTime = false); virtual void Clear(); @@ -123,6 +127,8 @@ protected: private: + void Resize(int width, int height); + inline void cb_Port_i(Fl_Button* o, void* v); static void cb_Port(Fl_Button* o, void* v); inline void cb_Rename_i(Fl_Menu_Button* o, void* v); @@ -138,6 +144,10 @@ private: int m_ID; bool m_DelMe; bool m_IsTerminal; + bool m_Minimised; + + int m_MiniWidth; + int m_MiniHeight; }; #endif diff --git a/SpiralSound/Plugins/CounterPlugin/CounterPlugin.C b/SpiralSound/Plugins/CounterPlugin/CounterPlugin.C index e8ba62a..1dd6049 100644 --- a/SpiralSound/Plugins/CounterPlugin/CounterPlugin.C +++ b/SpiralSound/Plugins/CounterPlugin/CounterPlugin.C @@ -52,8 +52,8 @@ m_Triggered(false), m_CurrentLevel(1.0f) { m_PluginInfo.Name="Counter"; - m_PluginInfo.Width=90; - m_PluginInfo.Height=80; + m_PluginInfo.Width=60; + m_PluginInfo.Height=50; m_PluginInfo.NumInputs=1; m_PluginInfo.NumOutputs=1; m_PluginInfo.PortTips.push_back("Input"); diff --git a/SpiralSound/Plugins/CounterPlugin/CounterPluginGUI.C b/SpiralSound/Plugins/CounterPlugin/CounterPluginGUI.C index 64bb8d8..4671984 100644 --- a/SpiralSound/Plugins/CounterPlugin/CounterPluginGUI.C +++ b/SpiralSound/Plugins/CounterPlugin/CounterPluginGUI.C @@ -30,7 +30,7 @@ static const int GUIBG2_COLOUR = 145; CounterPluginGUI::CounterPluginGUI(int w, int h,CounterPlugin *o,ChannelHandler *ch,const HostInfo *Info) : SpiralPluginGUI(w,h,o,ch) { - m_Count = new Fl_Input(20, 30, 50, 20, "Count"); + m_Count = new Fl_Input(5, 20, 50, 20, "Count"); m_Count->color(GUI_COLOUR); m_Count->labelsize(8); m_Count->align(FL_ALIGN_BOTTOM|FL_ALIGN_CENTER); diff --git a/SpiralSound/Plugins/OperatorPlugin/OperatorPlugin.C b/SpiralSound/Plugins/OperatorPlugin/OperatorPlugin.C index 5b38f7b..5e7e824 100644 --- a/SpiralSound/Plugins/OperatorPlugin/OperatorPlugin.C +++ b/SpiralSound/Plugins/OperatorPlugin/OperatorPlugin.C @@ -49,6 +49,8 @@ OperatorPlugin::OperatorPlugin() : m_Operator(ADD), m_Constant(0) { + m_Version=2; + m_PluginInfo.Name="Operator"; m_PluginInfo.Width=90; m_PluginInfo.Height=80; @@ -161,6 +163,7 @@ void OperatorPlugin::StreamOut(ostream &s) { s<>version; s>>m_Constant; + if (version>1) + { + int t; + s>>t; + m_Operator=(OperatorType)t; + } } diff --git a/SpiralSound/Plugins/SpiralPluginGUI.C b/SpiralSound/Plugins/SpiralPluginGUI.C index 8082b08..a248431 100644 --- a/SpiralSound/Plugins/SpiralPluginGUI.C +++ b/SpiralSound/Plugins/SpiralPluginGUI.C @@ -35,23 +35,14 @@ m_HelpWin(NULL) Fl::visible_focus(false); m_GUICH = ch; + box(FL_NO_BOX); - #ifndef PLUGINGUI_IN_MODULE_TEST - box(FL_THIN_UP_BOX); - 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,10,10,"X"); + m_Hide = new Fl_Button(2,2,10,10,"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); - #else - box(FL_NO_BOX); - #endif m_Help = new Fl_Button(w-11,2,10,10,"?"); m_Help->labeltype(FL_ENGRAVED_LABEL); diff --git a/SpiralSound/Plugins/SpiralPluginGUI.h b/SpiralSound/Plugins/SpiralPluginGUI.h index 7fefeac..02b7af3 100644 --- a/SpiralSound/Plugins/SpiralPluginGUI.h +++ b/SpiralSound/Plugins/SpiralPluginGUI.h @@ -42,15 +42,12 @@ public: // spiralplugin is acceptable virtual void UpdateValues(SpiralPlugin *o)=0; - void RenameTitleBar(const string &s) { m_Title=s; m_DragBar->label(m_Title.c_str()); } - protected: ChannelHandler *m_GUICH; virtual const string GetHelpText(const string &loc); private: - Fl_DragBar* m_DragBar; Fl_Button* m_Hide; Fl_Button* m_Help; Fl_Double_Window *m_HelpWin; diff --git a/SpiralSound/Plugins/Widgets/Fl_Knob.cxx b/SpiralSound/Plugins/Widgets/Fl_Knob.cxx index b35047e..690707d 100644 --- a/SpiralSound/Plugins/Widgets/Fl_Knob.cxx +++ b/SpiralSound/Plugins/Widgets/Fl_Knob.cxx @@ -7,7 +7,7 @@ Fl_Knob::Fl_Knob(int xx,int yy,int ww,int hh,const char *l): Fl_Valuator(xx,yy,ww,hh,l) { int side; - + box(FL_NO_BOX); a1 = 35; a2 = 325; _type = DOTLIN; @@ -52,8 +52,8 @@ unsigned char rr,gg,bb; { int col = ((Fl_Widget *)parent())->color(); // Clear rectangle with parent color - fl_color(col); - fl_rectf(ox,oy,side,side); + //fl_color(col); + //fl_rectf(ox,oy,side,side); // Cast round shadow Fl::get_color((Fl_Color)col,rr,gg,bb); diff --git a/SpiralSound/Sample.h b/SpiralSound/Sample.h index d7a1653..1d44340 100644 --- a/SpiralSound/Sample.h +++ b/SpiralSound/Sample.h @@ -19,7 +19,7 @@ #ifndef SAMPLE #define SAMPLE -//#define PLUGINGUI_IN_MODULE_TEST +#define PLUGINGUI_IN_MODULE_TEST #include #include diff --git a/SpiralSynthModular.C b/SpiralSynthModular.C index 46ef6e1..2011cc2 100644 --- a/SpiralSynthModular.C +++ b/SpiralSynthModular.C @@ -54,9 +54,9 @@ static const int FILE_VERSION = 4; static int Numbers[512]; static const int MAIN_WIDTH = 700; -static const int MAIN_HEIGHT = 300; +static const int MAIN_HEIGHT = 600; static const int SLIDER_WIDTH = 15; -static const int TOOLBOX_HEIGHT = MAIN_HEIGHT-40; +static const int TOOLBOX_HEIGHT = MAIN_HEIGHT; static const int TOOLBOX_WIDTH = 132+SLIDER_WIDTH; static const int ICON_DEPTH = 3; static const int COMMENT_ID = -1; @@ -116,7 +116,7 @@ void SynthModular::ClearUp() if (i->second->m_DeviceGUI->GetPluginWindow()) { i->second->m_DeviceGUI->GetPluginWindow()->hide(); - m_MainWindow->remove(i->second->m_DeviceGUI->GetPluginWindow()); + //m_MainWindow->remove(i->second->m_DeviceGUI->GetPluginWindow()); } // deleted by Canvas::Remove()? seems to cause random crashes //delete i->second->m_DeviceGUI; @@ -209,7 +209,7 @@ void SynthModular::UpdatePluginGUIs() if (i->second->m_DeviceGUI->GetPluginWindow()) { i->second->m_DeviceGUI->GetPluginWindow()->hide(); - m_MainWindow->remove(i->second->m_DeviceGUI->GetPluginWindow()); + //m_MainWindow->remove(i->second->m_DeviceGUI->GetPluginWindow()); } i->second->m_DeviceGUI->Clear(); @@ -230,39 +230,17 @@ void SynthModular::UpdatePluginGUIs() SpiralWindowType *SynthModular::CreateWindow() { - int xoff=0, yoff=10, but=64, gap=MAIN_HEIGHT/4, n=0; + int xoff=0, yoff=10, but=64, gap=MAIN_HEIGHT/5, n=0; - m_TopWindow = new SpiralWindowType(MAIN_WIDTH, MAIN_HEIGHT*2, LABEL.c_str()); + m_TopWindow = new SpiralWindowType(MAIN_WIDTH, MAIN_HEIGHT, LABEL.c_str()); m_TopWindow->resizable(m_TopWindow); - - m_TopTile = new Fl_Tile(0,0,MAIN_WIDTH, MAIN_HEIGHT*2, ""); - m_TopWindow->add(m_TopTile); - - m_MainWindow = new Fl_Tile(0,0,MAIN_WIDTH, MAIN_HEIGHT, ""); - m_MainWindow->color(SpiralSynthModularInfo::GUICOL_Canvas); - //m_MainWindow->callback((Fl_Callback*)cb_Close); - m_MainWindow->user_data((void*)(this)); - m_TopTile->add(m_MainWindow); - + m_MainButtons = new Fl_Group(0, 0, but, MAIN_HEIGHT, ""); m_MainButtons->type(1); m_MainButtons->color(SpiralSynthModularInfo::GUICOL_Tool); m_MainButtons->box(FL_FLAT_BOX); m_MainButtons->user_data((void*)(this)); - m_MainWindow->add(m_MainButtons); - - m_AppScroll = new Fl_Scroll(but, 0, MAIN_WIDTH-but, MAIN_HEIGHT, ""); - m_AppScroll->scrollbar.align(FL_ALIGN_RIGHT); - m_MainWindow->add(m_AppScroll); - //m_MainWindow->resizable(m_AppScroll); - - m_AppGroup = new Fl_Group(-5000, -5000, 10000, 10000, ""); - m_AppGroup->type(1); - m_AppGroup->box(FL_FLAT_BOX); - m_AppGroup->labeltype(FL_ENGRAVED_LABEL); - m_AppGroup->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE); - m_AppGroup->color(SpiralSynthModularInfo::GUICOL_Canvas); - m_AppScroll->add(m_AppGroup); + m_TopWindow->add(m_MainButtons); m_Load = new Fl_Button(xoff, 5+yoff, but, but, ""); m_Load->box(FL_NO_BOX); @@ -306,58 +284,56 @@ SpiralWindowType *SynthModular::CreateWindow() m_Options->callback((Fl_Callback*)cb_Rload); m_MainButtons->add(m_Options); n++; - + + m_NewComment = new Fl_Button(xoff, n*gap+yoff, but, but, ""); + m_NewComment->box(FL_NO_BOX); + tPix = new Fl_Pixmap(comment_xpm); + m_NewComment->image(tPix->copy(tPix->w(),tPix->h())); + delete tPix; + m_NewComment->selection_color(SpiralSynthModularInfo::GUICOL_Tool); + m_NewComment->tooltip("New comment"); + m_NewComment->callback((Fl_Callback*)cb_NewComment); + m_MainButtons->add(m_NewComment); + n++; + ///////////////// - m_EditorWindow = new Fl_Tile(0,MAIN_HEIGHT,MAIN_WIDTH, MAIN_HEIGHT, ""); - m_EditorWindow->color(SpiralSynthModularInfo::GUICOL_Tool); - m_TopTile->add(m_EditorWindow); - - int edy = MAIN_HEIGHT; - Fl_Group *Left = new Fl_Group(0,MAIN_HEIGHT,TOOLBOX_WIDTH,MAIN_HEIGHT); + int edy = 0; + Fl_Group *Left = new Fl_Group(MAIN_WIDTH-TOOLBOX_WIDTH,0,TOOLBOX_WIDTH,MAIN_HEIGHT); Left->box(FL_FLAT_BOX); Left->color(SpiralSynthModularInfo::GUICOL_Tool); Left->user_data((void*)(this)); - m_EditorWindow->add(Left); - m_EditorWindow->resizable(Left); + m_TopWindow->add(Left); - m_GroupName = new Fl_Box(0,MAIN_HEIGHT,TOOLBOX_WIDTH,16,""); + m_GroupName = new Fl_Box(MAIN_WIDTH-TOOLBOX_WIDTH,0,TOOLBOX_WIDTH,16,""); m_GroupName->labelsize(12); m_GroupName->color(SpiralSynthModularInfo::GUICOL_Canvas); m_GroupName->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE); m_GroupName->box(FL_BORDER_BOX); Left->add(m_GroupName); - m_PluginGroupLeft = new Fl_Button(0, MAIN_HEIGHT, 16, 16, "@<"); + m_PluginGroupLeft = new Fl_Button(MAIN_WIDTH-TOOLBOX_WIDTH, 0, 16, 16, "@<"); m_PluginGroupLeft->callback((Fl_Callback*)cb_PluginGroupLeft); Left->add(m_PluginGroupLeft); - m_PluginGroupRight = new Fl_Button(TOOLBOX_WIDTH-16, MAIN_HEIGHT, 16, 16, "@>"); + m_PluginGroupRight = new Fl_Button(MAIN_WIDTH-16, 0, 16, 16, "@>"); m_PluginGroupRight->callback((Fl_Callback*)cb_PluginGroupRight); Left->add(m_PluginGroupRight); - - m_ToolBox = new Fl_Scroll(0,0+edy+16,TOOLBOX_WIDTH, TOOLBOX_HEIGHT-16, ""); + m_ToolBox = new Fl_Scroll(MAIN_WIDTH-TOOLBOX_WIDTH,0+edy+16,TOOLBOX_WIDTH, TOOLBOX_HEIGHT-16, ""); m_ToolBox->type(Fl_Scroll::VERTICAL_ALWAYS); m_ToolBox->box(FL_FLAT_BOX); m_ToolBox->labeltype(FL_ENGRAVED_LABEL); m_ToolBox->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE); - m_ToolBox->scrollbar.align(FL_ALIGN_LEFT); + m_ToolBox->scrollbar.align(FL_ALIGN_RIGHT); m_ToolBox->color(SpiralSynthModularInfo::GUICOL_Tool); m_ToolBox->user_data((void*)(this)); Left->add(m_ToolBox); + m_TopWindow->resizable(m_ToolBox); - xoff=0; yoff=MAIN_HEIGHT+TOOLBOX_HEIGHT; - m_Buttons = new Fl_Group(xoff, yoff, TOOLBOX_WIDTH, MAIN_HEIGHT*2-TOOLBOX_HEIGHT, ""); - m_Buttons->type(1); - m_Buttons->color(SpiralSynthModularInfo::GUICOL_Tool); - m_Buttons->box(FL_FLAT_BOX); - m_Buttons->user_data((void*)(this)); - Left->add(m_Buttons); - - m_CanvasScroll = new Fl_Scroll(TOOLBOX_WIDTH, 0+edy, MAIN_WIDTH-TOOLBOX_WIDTH, MAIN_HEIGHT, ""); - m_EditorWindow->add(m_CanvasScroll); - m_EditorWindow->resizable(m_CanvasScroll); + m_CanvasScroll = new Fl_Scroll(but, 0, MAIN_WIDTH-TOOLBOX_WIDTH-but, MAIN_HEIGHT, ""); + m_TopWindow->add(m_CanvasScroll); + m_TopWindow->resizable(m_CanvasScroll); m_Canvas = new Fl_Canvas(-5000, -5000, 10000, 10000, ""); m_Canvas->type(1); @@ -369,24 +345,8 @@ SpiralWindowType *SynthModular::CreateWindow() m_Canvas->SetConnectionCallback((Fl_Callback*)cb_Connection); m_Canvas->SetUnconnectCallback((Fl_Callback*)cb_Unconnect); m_Canvas->SetAddDeviceCallback((Fl_Callback*)cb_NewDeviceFromMenu); - m_Canvas->SetRenameCallback((Fl_Callback*)cb_RenameDevice); m_CanvasScroll->add(m_Canvas); - 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); - m_NewComment->image(tPix->copy(tPix->w(),tPix->h())); - delete tPix; - m_NewComment->color(SpiralSynthModularInfo::GUICOL_Button); - m_NewComment->selection_color(SpiralSynthModularInfo::GUICOL_Tool); - m_NewComment->type(0); - m_NewComment->shortcut(FL_F + 10); - m_NewComment->tooltip("New comment in editor"); - m_NewComment->user_data((void*)(this)); - m_NewComment->callback((Fl_Callback*)cb_NewComment); - m_Buttons->add(m_NewComment); - m_SettingsWindow = new SettingsWindow; m_SettingsWindow->RegisterApp(this); @@ -401,7 +361,7 @@ SynthModular::ToolBox::ToolBox(Fl_Scroll *parent, void* user) int Height = 40; m_Icon=0; - m_ToolPack = new Fl_Pack(SLIDER_WIDTH+5,25+MAIN_HEIGHT,TOOLBOX_WIDTH-10, TOOLBOX_HEIGHT-60,""); + m_ToolPack = new Fl_Pack(MAIN_WIDTH-TOOLBOX_WIDTH+5,20,TOOLBOX_WIDTH-10, TOOLBOX_HEIGHT-60,""); m_ToolPack->type(FL_VERTICAL); m_ToolPack->box(FL_NO_BOX); m_ToolPack->color(SpiralSynthModularInfo::GUICOL_Tool); @@ -679,31 +639,16 @@ DeviceWin* SynthModular::NewDeviceWin(int n, int x, int y) Fl_Pixmap *Pix = new Fl_Pixmap(Plugin->GetIcon()); nlw->m_PluginID = n; - #ifndef PLUGINGUI_IN_MODULE_TEST - if (temp) - { - temp->hide(); - temp->position(200,50); - m_AppGroup->add(temp); - m_MainWindow->redraw(); - } - #else if (temp) { - temp->position(x+10,y+5); + temp->position(x+10,y); } - #endif DeviceGUIInfo Info=BuildDeviceGUIInfo(PInfo); Info.XPos = x; //TOOLBOX_WIDTH+(rand()%400); Info.YPos = y; //rand()%400; - #ifdef PLUGINGUI_IN_MODULE_TEST - Info.Width = PInfo.Width; - Info.Height = PInfo.Height; - #endif - nlw->m_DeviceGUI = new Fl_DeviceGUI(Info, temp, Pix, nlw->m_Device->IsTerminal()); m_Canvas->add(nlw->m_DeviceGUI); m_Canvas->redraw(); @@ -917,12 +862,8 @@ istream &operator>>(istream &s, SynthModular &o) temp->m_DeviceGUI->SetID(ID); if (ver>3) { - // set the titlebars + // set the titlebars temp->m_DeviceGUI->SetName(Name); - if (temp->m_DeviceGUI->GetPluginWindow()) - { - ((SpiralPluginGUI*)(temp->m_DeviceGUI->GetPluginWindow()))->RenameTitleBar(Name); - } } temp->m_Device->SetUpdateInfoCallback(ID,o.cb_UpdatePluginInfo); @@ -942,10 +883,10 @@ istream &operator>>(istream &s, SynthModular &o) o.m_DeviceWinMap[ID]->m_Device->GetChannelHandler()->FlushChannels(); // position the plugin window in the main window - o.m_DeviceWinMap[ID]->m_DeviceGUI->GetPluginWindow()->position(px,py); + //o.m_DeviceWinMap[ID]->m_DeviceGUI->GetPluginWindow()->position(px,py); - if (ps) o.m_DeviceWinMap[ID]->m_DeviceGUI->GetPluginWindow()->show(); - else o.m_DeviceWinMap[ID]->m_DeviceGUI->GetPluginWindow()->hide(); + if (ps) o.m_DeviceWinMap[ID]->m_DeviceGUI->Maximise(); + else o.m_DeviceWinMap[ID]->m_DeviceGUI->Minimise(); // load external files o.m_DeviceWinMap[ID]->m_Device->LoadExternalFiles(o.m_FilePath+"_files/"); @@ -984,10 +925,10 @@ ostream &operator<<(ostream &s, SynthModular &o) if (FILE_VERSION>2) { - s<x()<<" "<y()<<" "; - s<w()<<" "<h()<<" "; - s<x()<<" "<y()<<" "; - s<w()<<" "<h()<x()<<" "<y()<<" "; + s<w()<<" "<h()<<" "; + s<<0<<" "<<0<<" "; + s<<0<<" "<<0<hide(); delete m_SettingsWindow; - m_EditorWindow->hide(); - delete m_EditorWindow; + m_TopWindow->hide(); + delete m_TopWindow; o->hide(); } @@ -1174,7 +1115,7 @@ inline void SynthModular::cb_NewComment_i(Fl_Button* o, void* v) AddComment(-1); } void SynthModular::cb_NewComment(Fl_Button* o, void* v) -{((SynthModular*)(o->user_data()))->cb_NewComment_i(o,v);} +{((SynthModular*)(o->parent()->user_data()))->cb_NewComment_i(o,v);} ////////////////////////////////////////////////////////// @@ -1297,16 +1238,6 @@ void SynthModular::cb_Unconnect(Fl_Canvas* o, void* v) ////////////////////////////////////////////////////////// -inline void SynthModular::cb_RenameDevice_i(Fl_Canvas* o, void* v) -{ - Fl_DeviceGUI* device = (Fl_DeviceGUI*)v; - ((SpiralPluginGUI*)(device->GetPluginWindow()))->RenameTitleBar(device->GetName()); -} -void SynthModular::cb_RenameDevice(Fl_Canvas* o, void* v) -{((SynthModular*)(o->user_data()))->cb_RenameDevice_i(o,v);} - -////////////////////////////////////////////////////////// - void SynthModular::cb_UpdatePluginInfo(int ID, void *PInfo) { map::iterator i=m_DeviceWinMap.find(ID); diff --git a/SpiralSynthModular.h b/SpiralSynthModular.h index ee698b1..7a19de5 100644 --- a/SpiralSynthModular.h +++ b/SpiralSynthModular.h @@ -123,13 +123,10 @@ private: Fl_Button *m_New; Fl_Button *m_OpenEditor; Fl_Button *m_Options; - Fl_Group *m_AppGroup; - Fl_Scroll *m_AppScroll; Fl_Canvas *m_Canvas; Fl_Scroll *m_CanvasScroll; Fl_Scroll *m_ToolBox; - Fl_Group *m_Buttons; Fl_Button *m_NewComment; Fl_Box *m_GroupName; @@ -158,11 +155,7 @@ private: SettingsWindow *m_SettingsWindow; SpiralWindowType* m_TopWindow; - Fl_Tile* m_TopTile; - Fl_Group* m_MainWindow; - Fl_Group* m_EditorWindow; - vector m_DeviceVec; ChannelHandler m_CH; // used for threadsafe communication @@ -190,8 +183,6 @@ private: static void cb_PluginGroupLeft(Fl_Button* o, void* v); inline void cb_PluginGroupRight_i(Fl_Button* o, void* v); static void cb_PluginGroupRight(Fl_Button* o, void* v); - inline void cb_RenameDevice_i(Fl_Canvas* o, void* v); - static void cb_RenameDevice(Fl_Canvas* o, void* v); inline void cb_Rload_i(Fl_Button* o, void* v); static void cb_Rload(Fl_Button* o, void* v);