Skip to content

Commit

Permalink
-Added "block" helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
harryhaaren committed Dec 1, 2011
1 parent f8417c3 commit 55187d7
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/g_block.cpp
@@ -0,0 +1,28 @@

#include "g_widgets.hpp"

namespace Luppp
{
void GridBlock( Cairo::RefPtr<Cairo::Context> cr, float x, float y, BlockState state)
{
int blockSize = 17;

if ( state == BLOCK_STATE_EMPTY )
setColour(cr, COLOUR_GREY_3 );
else if ( state == BLOCK_STATE_LOADED )
setColour(cr, COLOUR_PURPLE_3);

cr->set_line_width(0.9);
cr->rectangle (x,y + blockSize, 74, blockSize);
cr->fill_preserve();

cr->set_source_rgb( 0 / 255.f, 0/255.f , 0 /255.f );
cr->stroke();

cr->select_font_face ("Impact" , Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_NORMAL);
cr->set_font_size ( 12 );
cr->move_to ( x + 8, (y + 14) + blockSize );
cr->set_source_rgb( 0 / 255.f, 0/255.f , 0/255.f );
cr->show_text ( "name" );
}
}
9 changes: 9 additions & 0 deletions src/g_widgets.hpp
Expand Up @@ -37,6 +37,14 @@ namespace Luppp
COLOUR_BACKGROUND,
};

enum BlockState {
BLOCK_STATE_EMPTY,
BLOCK_STATE_LOADED,
BLOCK_STATE_PLAYING,
BLOCK_STATE_QUEUED,
BLOCK_STATE_RECORDING,
};

void Rec ( Cairo::RefPtr<Cairo::Context> cr, float x, float y, int id, bool active);
void Solo( Cairo::RefPtr<Cairo::Context> cr, float x, float y, int id, bool active);
void Mute( Cairo::RefPtr<Cairo::Context> cr, float x, float y, int id, bool active);
Expand All @@ -50,6 +58,7 @@ namespace Luppp
*/

// helper functions
void Block(Cairo::RefPtr<Cairo::Context> cr, float x, float y, bool active);
void setColour( Cairo::RefPtr<Cairo::Context> cr, Colour c);
void setColour( Cairo::RefPtr<Cairo::Context> cr, Colour c, float alpha);
}
Expand Down
1 change: 1 addition & 0 deletions wscript
Expand Up @@ -45,6 +45,7 @@ def build(ctx):

guiList = [ 'src/g_window.cpp',
'src/g_widgets.cpp',
'src/g_block.cpp',
'src/g_mute.cpp',
'src/g_rec.cpp',
'src/g_solo.cpp',
Expand Down

0 comments on commit 55187d7

Please sign in to comment.