Browse Source

fixed a crash trying to load patches with ladspa plugins that aren't in the users libary

master
nebogeo 22 years ago
parent
commit
aea275fbfc
3 changed files with 31 additions and 24 deletions
  1. +21
    -19
      GUI/Widgets/Fl_Canvas.C
  2. +9
    -4
      GUI/Widgets/Fl_DeviceGUI.C
  3. +1
    -1
      GUI/Widgets/Fl_DeviceGUI.h

+ 21
- 19
GUI/Widgets/Fl_Canvas.C View File

@@ -582,17 +582,18 @@ istream &operator>>(istream &s, Fl_Canvas &o)
s>>NewWire.InputChild; s>>NewWire.InputChild;
s>>NewWire.InputPort; s>>NewWire.InputPort;
s>>NewWire.InputTerminal; s>>NewWire.InputTerminal;
o.m_WireVec.push_back(NewWire);
// if we can turn on both ports
if (((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))
{
o.m_WireVec.push_back(NewWire);


// Notify connection by callback
o.cb_Connection(&o,(void*)&NewWire);
o.m_Graph.AddConnection(NewWire.OutputID,NewWire.OutputTerminal,NewWire.InputID,NewWire.InputTerminal);
// Turn on both ports
((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);
// Notify connection by callback
o.cb_Connection(&o,(void*)&NewWire);
o.m_Graph.AddConnection(NewWire.OutputID,NewWire.OutputTerminal,NewWire.InputID,NewWire.InputTerminal);
}
} }
} }
@@ -609,16 +610,17 @@ istream &operator>>(istream &s, Fl_Canvas &o)
s>>NewWire.InputChild; s>>NewWire.InputChild;
s>>NewWire.InputPort; s>>NewWire.InputPort;
o.m_WireVec.push_back(NewWire);
// if we can turn on both ports
if (((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))
{
o.m_WireVec.push_back(NewWire);


// Notify connection by callback
o.cb_Connection(&o,(void*)&NewWire);
o.m_Graph.AddConnection(NewWire.OutputID,false,NewWire.InputID,false);
// Turn on both ports
((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);
// Notify connection by callback
o.cb_Connection(&o,(void*)&NewWire);
o.m_Graph.AddConnection(NewWire.OutputID,false,NewWire.InputID,false);
}
} }
} }
return s; return s;


+ 9
- 4
GUI/Widgets/Fl_DeviceGUI.C View File

@@ -220,11 +220,16 @@ void Fl_DeviceGUI::Setup(const DeviceGUIInfo& Info, bool FirstTime)
} }
} }


void Fl_DeviceGUI::AddConnection(int n)
bool Fl_DeviceGUI::AddConnection(int n)
{ {
m_PortVec[n]->Add();
m_PortVec[n]->value(1);
redraw();
if ( n < m_PortVec.size() )
{
m_PortVec[n]->Add();
m_PortVec[n]->value(1);
redraw();
return true;
}
return false;
} }
void Fl_DeviceGUI::RemoveConnection(int n) void Fl_DeviceGUI::RemoveConnection(int n)


+ 1
- 1
GUI/Widgets/Fl_DeviceGUI.h View File

@@ -95,7 +95,7 @@ public:
// aesthitic, to keep track of number of connections to know whether to // aesthitic, to keep track of number of connections to know whether to
// draw the port as occupied or not. // draw the port as occupied or not.
void AddConnection(int n);
bool AddConnection(int n);
void RemoveConnection(int n); void RemoveConnection(int n);
bool GetPortValue(int n) { return m_PortVec[n]->value(); } bool GetPortValue(int n) { return m_PortVec[n]->value(); }


Loading…
Cancel
Save