Skip to content

Commit

Permalink
-Implemented small version of Lowpass, gets added to the window above…
Browse files Browse the repository at this point in the history
… the track output under the clip selector
  • Loading branch information
harryhaaren committed Feb 17, 2012
1 parent 5194774 commit 09f3743
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 32 deletions.
44 changes: 21 additions & 23 deletions src/g_lowpass_small.cpp
Expand Up @@ -17,14 +17,14 @@
along with Luppp. If not, see <http://www.gnu.org/licenses/>.
*/

#include "g_lowpass.hpp"
#include "g_lowpass_small.hpp"

#include "g_widgets.hpp"

using namespace std;
using namespace Luppp;

GLowPass::GLowPass(Top* t, GuiStateStore* s)
GLowPassSmall::GLowPassSmall(Top* t, GuiStateStore* s)
{
ID = WidgetBase::getID();

Expand All @@ -36,18 +36,16 @@ GLowPass::GLowPass(Top* t, GuiStateStore* s)

mouseDown = false;

//std::cout << "Enterin GLowPass contructor" << std::endl;
//std::cout << "Enterin GLowPassSmall contructor" << std::endl;
add_events(Gdk::EXPOSURE_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK| Gdk::POINTER_MOTION_MASK);
signal_button_press_event().connect(sigc::mem_fun(*this, &GLowPass::on_button_press_event) );
signal_button_release_event().connect(sigc::mem_fun(*this, &GLowPass::on_button_release_event) );
signal_motion_notify_event().connect( sigc::mem_fun( *this, &GLowPass::onMouseMove ) );
signal_button_press_event().connect(sigc::mem_fun(*this, &GLowPassSmall::on_button_press_event) );
signal_button_release_event().connect(sigc::mem_fun(*this, &GLowPassSmall::on_button_release_event) );
signal_motion_notify_event().connect( sigc::mem_fun( *this, &GLowPassSmall::onMouseMove ) );

xSize = 225;

set_size_request(250, 216);
set_size_request(74, 37);
}

bool GLowPass::redraw()
bool GLowPassSmall::redraw()
{
// force our program to redraw the entire widget.
Glib::RefPtr<Gdk::Window> win = get_window();
Expand All @@ -61,7 +59,7 @@ bool GLowPass::redraw()
}


bool GLowPass::on_expose_event(GdkEventExpose* event)
bool GLowPassSmall::on_expose_event(GdkEventExpose* event)
{
// This is where we draw on the window
Glib::RefPtr<Gdk::Window> window = get_window();
Expand Down Expand Up @@ -92,10 +90,10 @@ bool GLowPass::on_expose_event(GdkEventExpose* event)

bool active = stateStore->effectState.at(ID).active;

int x = 10;
int y = 22;
xSize = 225;
ySize = 95;
int x = 1;
int y = 1;
xSize = 72;
ySize = 36;

// works but a bit simple
cr -> move_to( x , y );
Expand Down Expand Up @@ -205,17 +203,17 @@ bool GLowPass::on_expose_event(GdkEventExpose* event)
return true;
}

void GLowPass::on_menu_file_popup_edit()
void GLowPassSmall::on_menu_file_popup_edit()
{
std::cout << "The Edit menu item was selected." << std::endl;
}

void GLowPass::on_menu_file_popup_generic()
void GLowPassSmall::on_menu_file_popup_generic()
{
std::cout << "A popup menu item was selected." << std::endl;
}

bool GLowPass::onMouseMove(GdkEventMotion* event)
bool GLowPassSmall::onMouseMove(GdkEventMotion* event)
{
if ( mouseDown )
{
Expand All @@ -238,11 +236,11 @@ bool GLowPass::onMouseMove(GdkEventMotion* event)
//top->toEngineQueue.push(x);
}
redraw();
std::cout << "GLowPass: Cutoff = " << cutoff << " Q: " << q << " X, Y: " << event->x << ", " << event->y << std::endl;
std::cout << "GLowPassSmall: Cutoff = " << cutoff << " Q: " << q << " X, Y: " << event->x << ", " << event->y << std::endl;
}
}

bool GLowPass::on_button_press_event(GdkEventButton* event)
bool GLowPassSmall::on_button_press_event(GdkEventButton* event)
{
if( event->type == GDK_BUTTON_PRESS ) // && event->button == 3
{
Expand Down Expand Up @@ -282,7 +280,7 @@ bool GLowPass::on_button_press_event(GdkEventButton* event)

if ( event->y < 20 )
{
std::cout << "GLowPass Enable / Disable click event, ID = " << ID << std::endl;
std::cout << "GLowPassSmall Enable / Disable click event, ID = " << ID << std::endl;
EngineEvent* x = new EngineEvent();
x->setTrackDeviceActive( ID, !stateStore->effectState.at(ID).active );
top->toEngineQueue.push(x);
Expand All @@ -294,7 +292,7 @@ bool GLowPass::on_button_press_event(GdkEventButton* event)
return false;
}

bool GLowPass::on_button_release_event(GdkEventButton* event)
bool GLowPassSmall::on_button_release_event(GdkEventButton* event)
{
if( event->type == GDK_BUTTON_RELEASE ) // && event->button == 3
{
Expand All @@ -306,6 +304,6 @@ bool GLowPass::on_button_release_event(GdkEventButton* event)
return false;
}

GLowPass::~GLowPass()
GLowPassSmall::~GLowPassSmall()
{
}
10 changes: 5 additions & 5 deletions src/g_lowpass_small.hpp
Expand Up @@ -17,8 +17,8 @@
along with Luppp. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef LUPPP_LOWPASS
#define LUPPP_LOWPASS
#ifndef LUPPP_LOWPASS_SMALL
#define LUPPP_LOWPASS_SMALL

#include <vector>
#include <iostream>
Expand All @@ -29,11 +29,11 @@
#include "g_statestore.hpp"
#include "g_widgetbase.hpp"

class GLowPass : public Gtk::DrawingArea, public WidgetBase
class GLowPassSmall : public Gtk::DrawingArea, public WidgetBase
{
public:
GLowPass(Top*, GuiStateStore*);
~GLowPass();
GLowPassSmall(Top*, GuiStateStore*);
~GLowPassSmall();

bool redraw();

Expand Down
17 changes: 13 additions & 4 deletions src/g_window.cpp
Expand Up @@ -29,6 +29,8 @@ using namespace std;
#include "top.hpp"
#include <sstream>

#include "g_lowpass_small.hpp"

#include "g_reverb.hpp"
#include "g_lowpass.hpp"
#include "g_limiter.hpp"
Expand Down Expand Up @@ -593,7 +595,7 @@ int Window::handleEvent()
switch ( et )
{
case EFFECT_REVERB: trackVector.at(t).widgetVector.push_back( new GReverb (top, &guiState) ); break;
case EFFECT_LOWPASS: trackVector.at(t).widgetVector.push_back( new GLowPass (top, &guiState) ); break;
case EFFECT_LOWPASS: trackVector.at(t).widgetVector.push_back( new GLowPassSmall(top, &guiState) ); break;
case EFFECT_HIGHPASS: trackVector.at(t).widgetVector.push_back( new GHighPass (top, &guiState) ); break;
case EFFECT_BEATSMASH: trackVector.at(t).widgetVector.push_back( new GBeatSmash (top, &guiState) ); break;
case EFFECT_TRANCEGATE: trackVector.at(t).widgetVector.push_back( new GBeatSmash (top, &guiState) ); break;
Expand All @@ -614,8 +616,11 @@ int Window::handleEvent()
guiState.effectState.push_back( EffectState(-1) );

// add the new widget to the box
trackEffectBox->add( *trackVector.at(t).widgetVector.back() );
trackEffectBox->show_all();
//trackEffectBox->add( *trackVector.at(t).widgetVector.back() );
//trackEffectBox->show_all();

smallEffectBoxList.back()->add( *trackVector.at(t).widgetVector.back() );
smallEffectBoxList.back()->show_all();

currentEffectsTrack = e->ia;
redrawEffectBox();
Expand Down Expand Up @@ -733,11 +738,15 @@ void Window::addTrack()
tmpVbox->add( *progressWidgetVector.back() );
mainTable->attach( *tmpVbox, numTracks, numTracks+1, 3, 4);

// insert box for adding effects into later
smallEffectBoxList.push_back( new Gtk::VBox() );
mainTable->attach( *smallEffectBoxList.back(), numTracks, numTracks+1, 4, 5);

// fader / pan
trackoutputList.push_back( new TrackOutput( top, &guiState ) );
std::list<TrackOutput*>::iterator i = trackoutputList.begin();
std::advance(i,numTracks);
mainTable->attach( **i, numTracks, numTracks+1, 4, 5);
mainTable->attach( **i, numTracks, numTracks+1, 5, 6);

mainTable->show_all();
numTracks++;
Expand Down
6 changes: 6 additions & 0 deletions src/g_window.hpp
Expand Up @@ -124,7 +124,13 @@ class Window
std::list<TrackOutput*> trackoutputList;
std::list<ClipSelector*>clipselectorList;


std::vector<GAudioSource*> audioSourceVector;

//std::list<Gtk::Label*> tracklabelList;
std::list<Gtk::Box*> smallEffectBoxList;
std::list<Gtk::EventBox*> tracklabelBoxList;

std::list<Gtk::ComboBoxText*> trackinputList;
std::vector<GProgress*> progressWidgetVector;

Expand Down
1 change: 1 addition & 0 deletions wscript
Expand Up @@ -94,6 +94,7 @@ def build(ctx):
'src/g_block.cpp',
'src/g_mute.cpp',
'src/g_lowpass.cpp',
'src/g_lowpass_small.cpp',
'src/g_highpass.cpp',
'src/g_rec.cpp',
'src/g_solo.cpp',
Expand Down

0 comments on commit 09f3743

Please sign in to comment.