Ejemplo n.º 1
0
void axVolumeMeter::OnPaint()
{
    axGC* gc = GetGC();
    axRect rect(GetRect());
    axRect rect0(axPoint(0, 0), rect.size);
    
    gc->SetColor(*_currentColor, _bgAlpha);
    gc->DrawRectangle(rect0);
    
    double nSeparation = 25.0;
    

    for(int i = 0; i < int(nSeparation); i++)
    {
        if(i > (1.0 - _value) * nSeparation)
        {
            // Red part.
            if(i < 7)
            {
                gc->SetColor(axColor(1.0 - (i-5.0) / 7.0, i / 7.0, 0.0, 0.6));
                gc->DrawRectangle(axRect(axPoint(1, i * rect.size.y / nSeparation), axSize(rect.size.x - 2, rect.size.y / nSeparation)));
            }
            // Green part.
            else
            {
                gc->SetColor(axColor(0.0, 1.0, 0.0, 0.6));
                gc->DrawRectangle(axRect(axPoint(1, i * rect.size.y / nSeparation), axSize(rect.size.x - 2, rect.size.y / nSeparation)));
            }
        }
    }
    
    gc->SetColor(_info.contourColor, _bgAlpha);
    gc->DrawRectangleContour(rect0);
}
Ejemplo n.º 2
0
Archivo: axMenu.cpp Proyecto: EQ4/axLib
void axMenuNode::OnPaint()
{
    axGC* gc = GetGC();
    axSize size = GetSize();
    axRect rect( m_delta, 0, size.x, axMENU_NODE_HEIGHT );
	axRect rect0(0.0, 0.0, rect.size.x, rect.size.y);

    gc->SetColor(axColor(0.6, 0.6, 0.6));
    gc->DrawRectangle(rect0);

    gc->SetColor( axColor("#AAAAAA") );
    gc->SetFontSize(13);

    //cout << "Rect : " << rect.position.x << " " << rect.position.y << " " << rect.size.x << " " << rect.size.y << endl;
    gc->DrawStringAlignedCenter(m_label, rect);

    if( m_img != nullptr && m_img->IsImageReady() )
    {
        gc->DrawPartOfImage(m_img,
                            axPoint( 0, m_nCurrentImg * 12 ),
                            axSize( 12, 12 ), axPoint(m_delta + 7, 4));
    }

    // Contour.
    gc->SetColor(axColor(0.0, 0.0, 0.0));
    gc->DrawRectangleContour(axRect(0, 0, size.x, size.y));
}
Ejemplo n.º 3
0
Archivo: main.cpp Proyecto: EQ4/axLib
void MidiPartitionTrack::OnPaint()
{
	axGC* gc = GetGC();
	axRect rect(GetRect());
	axRect rect0(axPoint(0, 0), rect.size);

	gc->SetColor(axColor("#AAAAAA"), 1.0);
	gc->DrawRectangle(rect0);

	gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0);

	int delta = rect0.size.y / double(_nPart + 1.0);
	int y = delta;

	for(int i = 0; i < _nPart; i++)
	{
		gc->DrawCircle(axPoint(rect0.size.x * 0.5 - 1, y), 
			   		   rect0.size.x * 0.5 - 2, 10);

		y += delta;
	}


	gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0);
	gc->DrawRectangleContour(rect0);
}
Ejemplo n.º 4
0
void MyNumberPanel::OnPaint()
{
    axGC* gc = GetGC();
    axRect rect = axRect(axPoint(0, 0), GetRect().size);
    
    gc->SetColor(axColor(0.3, 0.0, 0.0, 1.0));
    gc->DrawRectangle(rect);
    
    gc->SetColor(axColor(0.4, 0.0, 0.0, 1.0));
    gc->SetFontType(std::string("/Users/alexarse/Project/axLib/axProjects/axTB303Vst/build/UninstalledProducts/resources/digital-7 (mono).ttf"));
    gc->SetFontSize(16);
    gc->DrawChar('0', axPoint(5, -4));
    gc->DrawChar('0', axPoint(13, -4));
    
    
    gc->SetColor(axColor(0.95, 0.0, 0.0, 1.0));
    
    if(_number > 9)
    {
        gc->DrawChar(std::to_string(_number)[0], axPoint(5, -4));
        
        gc->DrawChar(std::to_string(_number)[1], axPoint(13, -4));
    }
    else
    {
        gc->DrawChar(std::to_string(_number)[0], axPoint(13, -4));
    }
    
    gc->SetColor(axColor(0.4, 0.0, 0.0, 1.0));
    gc->DrawRectangleContour(rect.GetInteriorRect(axPoint(1, 1)));
    
    gc->SetColor(axColor(0.0, 0.0, 0.0, 1.0));
    gc->DrawRectangleContour(rect);
    
}
Ejemplo n.º 5
0
void axScrollBar::OnPaint()
{
	axGC* gc = GetGC();
	axRect rect0(axPoint(0, 0), GetRect().size);
//
	gc->SetColor(axColor(1.0, 0.0, 0.0), 1.0);
	gc->DrawRectangle(rect0);
    
    gc->DrawRectangleColorFade(rect0,
                               axColor(0.6, 0.6, 0.6),
                               axColor(0.4, 0.4, 0.4));
//
//	// gc->DrawImageResize(_bgImg, rect0.position, rect0.size);
//
//	gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0);
//	gc->DrawRectangleContour(axRect(axPoint(1, 1), rect0.size - axSize(1, 1) ));
//

    gc->SetColor(*_currentScrollBarColor);
	axRect bar_rect(0, _sliderPos, GetRect().size.x, _sliderHeight);
	gc->DrawRectangle(bar_rect);
    
    gc->SetColor(_info.contour);
    gc->DrawRectangleContour(bar_rect);
//
//	gc->SetColor(axColor(0.3, 0.3, 0.3), 1.0);
//	gc->DrawRectangleContour(bar_rect);
//
	gc->SetColor(_info.contour);
	gc->DrawRectangleContour(rect0);
}
Ejemplo n.º 6
0
Archivo: axGain.cpp Proyecto: EQ4/axLib
 void OnPaint()
 {
     axGC* gc = GetGC();
     axRect rect = axRect(axPoint(0, 0), GetRect().size);
     
     gc->SetColor(axColor(0.4, 0.4, 0.4));
     gc->DrawRectangle(rect);
     
     gc->SetColor(axColor(0.0, 0.0, 0.0));
     gc->DrawRectangleContour(axRect(1, 1, rect.size.x - 1, rect.size.y - 1));
 }
Ejemplo n.º 7
0
void MenuPanel::OnPaint()
{
    axGC* gc = GetGC();
    axRect rect(GetRect());
    axRect rect0(axPoint(0, 0), rect.size);
    
    gc->SetColor(axColor(0.4, 0.4, 0.4), 1.0);
    gc->DrawRectangle(rect0);
        
    gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0);
    gc->DrawRectangleContour(rect0);
}
Ejemplo n.º 8
0
Archivo: main.cpp Proyecto: EQ4/axLib
void MidiSequencer::OnPaint()
{
	axGC* gc = GetGC();
	axRect rect(GetRect());
	axRect rect0(axPoint(0, 0), rect.size);

	gc->SetColor(axColor(0.1, 0.1, 0.1), 1.0);
	gc->DrawRectangle(rect0);

	gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0);
	gc->DrawRectangleContour(rect0);
}
Ejemplo n.º 9
0
Archivo: main.cpp Proyecto: EQ4/axLib
void TitleBar::OnPaint()
{
	axGC* gc = GetGC();
	axRect rect(GetRect());
	axRect rect0(axPoint(0, 0), rect.size);

	gc->DrawRectangleColorFade(
		axRect(0, 0, rect0.size.x, rect0.size.y),// - 30),
		axColor(0.5, 0.5, 0.5), 1,
		axColor(0.3, 0.3, 0.3), 1);

	gc->SetColor(axColor(0.4, 0.4, 0.4));
	gc->DrawRectangleContour(axRect(1, 1, rect0.size.x - 1, rect0.size.y - 1));
}
Ejemplo n.º 10
0
Archivo: axMenu.cpp Proyecto: EQ4/axLib
void axMenu::OnPaint()
{
    axGC* gc = GetGC();
    axSize size = GetSize();
    axRect rect(GetRect());
    axRect rect0(axPoint(0, 0), rect.size);

    gc->SetColor( axColor("#444444") );
    gc->DrawRectangle(rect0);

    // Contour.
    gc->SetColor(axColor("#000000"));
    gc->DrawRectangleContour(axRect(1, 1, rect0.size.x - 1, rect0.size.y - 1));
}
Ejemplo n.º 11
0
void MyProject::OnPaint()
{
    axGC* gc = GetGC();
    axRect rect0(axPoint(0, 0), GetRect().size);
    
    gc->SetColor(axColor(0.4, 0.4, 0.4), 1.0);
    gc->DrawRectangle(rect0);
    
    gc->DrawImage(_bgImg, axPoint(0, 0));
    
    gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0);
    gc->DrawRectangleContour(rect0);
    
}
Ejemplo n.º 12
0
void MyPreference::OnPaint()
{
    axGC* gc = GetGC();
    axRect rect = axRect(axPoint(0, 0), GetRect().size);
    
    
    gc->SetColor(axColor("#9B9A9A"));
    gc->DrawRectangle(rect);
    
    gc->SetColor(axColor(0.0, 0.0, 0.0));
    gc->DrawString(std::string("Audio"), axPoint(20, 20));
    
    gc->SetColor(axColor(0.0, 0.0, 0.0));
    gc->DrawRectangleContour(rect);
}
Ejemplo n.º 13
0
Archivo: main.cpp Proyecto: EQ4/axLib
void ScrollDrumMachine::OnPaint()
{
	axGC* gc = GetGC();
	axRect rect(GetRect());
	axRect rect0(axPoint(0, 0), rect.size);

	gc->SetColor(axColor(0.1, 0.1, 0.1), 1.0);
	gc->DrawRectangle(rect0);

	gc->DrawImage(_side_img, axPoint(0, 0));
	gc->DrawImage(_side_img, axPoint(rect0.size.x - 45, 0));

	gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0);
	gc->DrawRectangleContour(rect0);
}
Ejemplo n.º 14
0
Archivo: main.cpp Proyecto: EQ4/axLib
void MidiPartition::DrawCircles(axGC* gc, const axRect& rect0)
{
	int circle_size = (1.0 / double(_nSlice)) * rect0.size.x * 0.5;

	for(int i = 0; i < _bars.size(); i++)
	{
		for(int k = 0; k < _bars[i]; k++)
		{
			int left_x = (i / double(_nSlice)) * rect0.size.x;
			int right_x = ((i+1) / double(_nSlice)) * rect0.size.x;
			int size_x = right_x - left_x;

			axPoint pos(left_x + (size_x - circle_size) * 0.5,
						(k + 1.0) * rect0.size.y / (_bars[i] + 1.0) - circle_size * 0.5);


			if(_heighlighted_circle == k && _heightlighted_bar == i)
			{
				// int select_size = 20;
				gc->SetColor(axColor(0.55, 0.35, 0.35), 1.0);
				gc->DrawRectangle(axRect(axPoint(pos.x - 3, pos.y - 3), 
								  axSize(circle_size + 6, circle_size + 6)));
			}

			

			gc->DrawImageResize(_circle, 
								axPoint(pos.x, pos.y), 
								axSize(circle_size, circle_size));
		}
	}
}
Ejemplo n.º 15
0
VlcVideoPlayer::VlcVideoPlayer(wxWindow* win, const VideoID& id, wxPoint pt, wxSize size)
    : wxPanel(win, wxID_ANY, pt, size), videoID_(id), firstPlay_(1)
{
	SetBackgroundColour(axColor(0, 0, 0));

	_DEBUG_ nb_time_callback = 0;

    // Create new VLC instance.
    char const* vlcOptions[] = {"--no-video-title-show"}; //Hide filename.

	vlcInstance = NULL;
	vlcPlayer = NULL;

    // Create VLC instance
	vlcInstance = libvlc_new(1, vlcOptions);

    if( vlcInstance )
	{
		vlcPlayer = libvlc_media_player_new(vlcInstance);

		// Create VLC player
		if( vlcPlayer )
		{
			// Create VLC EventManager
			vlcEventManager = libvlc_media_player_event_manager(vlcPlayer);

			if( !vlcEventManager )
			{
				_DEBUG_ DSTREAM << "Can't create VLC Event Manager" << endl;
				wxMessageDialog (this, "Can't create VLC Event Manager");
			}
		}
		else // vlcPlayer
		{
			_DEBUG_ DSTREAM << "Can't create player from vlcMedia" << endl;
			wxMessageDialog (this, "Can't create player from vlcMedia");
		}
	}

    else // vlcInstance.
	{
		_DEBUG_ DSTREAM << "Can't Open VLC instance" << endl;
		wxMessageDialog (this, "Can't Open VLC instance");
	}

    // libVLC events and callback
	if( vlcInstance && vlcPlayer && vlcEventManager )
	{
		libvlc_event_attach(vlcEventManager, 
							libvlc_MediaPlayerPositionChanged, 
							VlcVideoPlayer::vlcPositionChanged, 
							this);
		
		libvlc_event_attach(vlcEventManager, 
							libvlc_MediaPlayerTimeChanged, 
							VlcVideoPlayer::vlcTimeChanged, 
							this);
	}
}
Ejemplo n.º 16
0
Archivo: main.cpp Proyecto: EQ4/axLib
void MidiPartition::OnPaint()
{
	axGC* gc = GetGC();
	axRect rect(GetRect());
	axRect rect0(axPoint(0, 0), rect.size);

	gc->SetColor(axColor(0.3, 0.3, 0.3), 1.0);
	gc->DrawRectangle(rect0);

	DrawLines(gc, rect0);
	DrawHeighlightedCircle(gc, rect0);
	DrawCircles(gc, rect0);
	DrawSelectedCircle(gc, rect0);

	gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0);
	gc->DrawRectangleContour(rect0);
}
Ejemplo n.º 17
0
void MyScrollPanel::OnPaintStatic()
{
    axGC* gc = GetGC();
    axRect rect(GetShownRect());
    //axRect rect0(axPoint(0, 0), rect.size);

    gc->SetColor(axColor(0.0, 0.0, 0.0, 1.0));
    gc->DrawRectangleContour(rect);
}
Ejemplo n.º 18
0
void MyScrollPanel::OnPaint()
{
    
    axGC* gc = GetGC();
    axRect rect(GetRect());
    axRect rect0(axPoint(0, 0), rect.size);
    
//    gc->SetColor(axColor(1.0, 0.0, 1.0, 0.4));
//    gc->DrawRectangle(rect0);
    
    gc->DrawRectangleColorFade(rect0,
                               axColor(0.0, 1.0, 0.0),
                               axColor(0.0, 0.0, 1.0));
    
    

    
}
Ejemplo n.º 19
0
Archivo: axGrid.cpp Proyecto: EQ4/axLib
void axGrid::OnPaint()
{
	axGC* gc = GetGC();
	axRect rect(GetRect());
	axRect rect0(axPoint(0, 0), rect.size);

	gc->SetColor(_info.normal, 1.0);
	gc->DrawRectangle(rect0);

	gc->SetColor(_info.contour, 1.0);

	int y = 0;
	glLineWidth(1.0);
	for(int j = 0; j <= _dimension.y; j++)
	{
		int y = (double(j) / _dimension.y) * rect.size.y;
		gc->DrawLine(axPoint(0, y), axPoint(rect.size.x, y));
	}

	int x = 0;
	for(int i = 0; i <= _dimension.x; i++)
	{
		int x = (double(i) / _dimension.x) * rect.size.x;
		gc->DrawLine(axPoint(x, 0), axPoint(x, rect.size.y));
	}

	axSize element_size(1.0 / _dimension.x * rect.size.x - 1, 
						1.0 / _dimension.y * rect.size.y - 1);
	for(int j = 0;j < _dimension.y; j++)
	{
		for(int i = 0; i < _dimension.x; i++)
		{
			if(_gridElements[j][i].on)
			{
				gc->SetColor(_gridElements[j][i].color);

				axSize elem_size(floor((double(i+1)/ _dimension.x * rect.size.x)) - 
								 floor((double(i) / _dimension.x * rect.size.x)) - 1,
								1.0 / _dimension.y * rect.size.y - 1);
				gc->DrawRectangle(axRect(_gridElements[j][i].position, elem_size));
			}
		}
	}



	//_selectedElement
	gc->SetColor(axColor(0.0, 0.0, 1.0));
	//glLineWidth(4.0);
	gc->DrawRectangleContour(axRect(GetPositionOfElement(_selectedElement), element_size), 2);

	// glLineWidth(1.0);

	// gc->DrawCircle(axPoint(50, 50), 10, 500);

}
Ejemplo n.º 20
0
Archivo: main.cpp Proyecto: EQ4/axLib
void MidiPartition::DrawLines(axGC* gc, const axRect& rect0)
{
	gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0);
	// int nSlice = 16;
	for(int i = 0; i < _nSlice; i++)
	{
		int left_x = (i / double(_nSlice)) * rect0.size.x;
		gc->DrawLine(axPoint(left_x, 0), axPoint(left_x, rect0.size.y));
	}
}
Ejemplo n.º 21
0
Archivo: main.cpp Proyecto: EQ4/axLib
void MidiPartition::DrawHeighlightedCircle(axGC* gc, const axRect& rect0)
{
	if(_heightlighted_bar != -1)
	{
		int left_x = (_heightlighted_bar / double(_nSlice)) * rect0.size.x;
		int right_x = ((_heightlighted_bar+1) / double(_nSlice)) * rect0.size.x;

		gc->SetColor(axColor(0.35, 0.35, 0.35), 1.0);
		gc->DrawRectangle(axRect(left_x, 0, right_x - left_x - 1, rect0.size.y));
	}
}
Ejemplo n.º 22
0
MyScrollPanel::MyScrollPanel(axWindow* parent,
                             const axRect& rect,
                             const axSize& seenSize):
// Parent.
axPanel(parent, rect)
{
    SetBlockDrawing(true);
    SetShownRect(axRect(axPoint(0, 0), seenSize));
    
    
    axButtonInfo btn1_info;
    btn1_info.normal = axColor(0.8, 0.8, 0.8);
    btn1_info.hover = axColor(0.9, 0.9, 0.9);
    btn1_info.clicking = axColor(0.7, 0.7, 0.7);
    btn1_info.contour = axColor(0.0, 0.0, 0.0);
    btn1_info.selected = btn1_info.normal;
    
    axButtonEvents btn1_evts;
    btn1_evts.button_click = GetOnBtn();
    
    axButton* btn1 = new axButton(this,
                                  axRect(40, 40, 60, 25),
                                  btn1_evts,
                                  btn1_info,
                                  "", "Btn1");
    
    axButton* btn2 = new axButton(this,
                                  axRect(40, 500, 60, 25),
                                  btn1_evts,
                                  btn1_info,
                                  "", "Btn2");
    
    axScrollBarEvents scrollEvents;
    axScrollBarInfo scroll_info;
    scroll_info.normal = axColor(0.8, 0.8, 0.8);
    scroll_info.hover = axColor(0.9, 0.9, 0.9);
    scroll_info.clicking = axColor(0.7, 0.7, 0.7);
    scroll_info.contour = axColor(0.0, 0.0, 0.0);
    scroll_info.selected = scroll_info.normal;

    axPoint pos(rect.position.x + rect.size.x, rect.position.y);
    axScrollBar* _scrollBar = new axScrollBar(parent,
                                              this,
                                              axRect(pos,
                                                     axSize(8, GetShownRect().size.y)),
                                              scrollEvents,
                                              scroll_info);
    
    _scrollBar->SetPanelSize(rect.size);
}
Ejemplo n.º 23
0
Archivo: axGain.cpp Proyecto: EQ4/axLib
    axTestPanel(axWindow* parent, const axRect& rect):
    axPanel(parent, rect)
    {
//        axButton* btn = new axButton(this, axRect(100, 30, 50, 50),
//                                     axButtonEvents(GetOnButtonClick()),
//                                     axSTANDARD_BUTTON);
        
        axKnob::Info knob_info(axColor(0.3, 0.3, 0.3, 0.0),
                               axColor(0.5, 0.5, 0.5, 0.0),
                               axColor(0.8, 0.8, 0.8, 0.0),
                               128,
                               axSize(50, 50),
                               std::string("/Users/alexarse/Project/axLib/ressources/plastic_knob_50x50.png"),
                               std::string("/Users/alexarse/Project/axLib/ressources/plastic_knob_50x50.png"));
        
        axKnob::Builder knobBuilder(this, axSize(50, 50), knob_info, 0, 10);
                                    
        _gainKnob = knobBuilder.Create(axPoint(40, 40), GetOnKnobGain());
        _gainKnob->SetValue(1.0);
        
        _filterKnob = knobBuilder.Create(GetOnKnobFilterFreq());
        _filterKnob->SetValue(1.0);

        axVstCore* vstCore = static_cast<axVstCore*>
        (axApp::GetInstance()->GetCore());
        
        axVstCoreData* vstCoreData = vstCore->GetVstCoreData();
        
        if(vstCoreData->effect != nullptr)
        {
            axEventManager* evtManager = axEventManager::GetInstance();
            axVst* curVst = static_cast<axVst*>(vstCoreData->effect);
            evtManager->AddConnection(10000000 + curVst->GetPluginId(),
                                      0,
                                      GetOnVstParameterValueChange());
//            evtManager->AddConnection(10000000 + vstCoreData->effect->getProgram(),
//                                      0,
//                                      GetOnVstParameterValueChange());
        }
    }
Ejemplo n.º 24
0
void SliderPanel::OnPaint()
{
    axGC* gc = GetGC();
    axRect rect(GetRect());
    axRect rect0(axPoint(0, 0), rect.size);
    
    gc->SetColor(axColor(1.0, 1.0, 1.0), 1.0);
    gc->DrawRectangle(rect0);
    
    gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0);
    gc->SetFontSize(12);
    //    gc->DrawStringAlignedCenter("test", rect0);
    gc->DrawString("regular", axPoint(350, 80));
    gc->DrawString("with back slider", axPoint(350, 100));
    gc->DrawString("no slider", axPoint(350, 120));
    gc->DrawString("click anywhere", axPoint(350, 140));
    gc->DrawString("right align", axPoint(350, 160));
    gc->DrawString("no button", axPoint(350, 180));
    gc->DrawString("center align", axPoint(350, 200));
    
    gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0);
    gc->DrawRectangleContour(rect0);
}
Ejemplo n.º 25
0
axScrollBar::axScrollBar(axWindow* parent,
                         axWindow* handle,
                         const axRect& rect,
                         const axScrollBarEvents& events,
                         const axScrollBarInfo& info,
                         axFlag flags) :
// Heritage.
axPanel(parent, rect),
// Members.
_events(events),
_info(info),
_handle(handle),
_flags(flags),
_yClickDelta(0),
_value(0.0)
{

    axButton::Info btn_info(axColor(0.8, 0.0, 0.0),
                            axColor(0.9, 0.0, 0.0),
                            axColor(0.8, 0.0, 0.0),
                            axColor(0.8, 0.0, 0.0),
                            axColor(0.0, 0.0, 0.0),
                            axColor(0.0, 0.0, 0.0));

	//function<void (axButtonMsg)> btnFct();

//	_btn[0] = new axButton(this, 
//						   axRect(0, 0, 14, 14), 
//						   axButtonEvents(), 
//						   btn_info, 
//						   "/Users/alexarse/Project/axLib/axProjects/MidiSequencer/scrollBar_up.png");
//
//	_btn[1] = new axButton(this, 
//						   axRect(0, rect.size.y - 14, 14, 14), 
//						   axButtonEvents(), 
//						   btn_info, 
//						   "/Users/alexarse/Project/axLib/axProjects/MidiSequencer/scrollBar_down.png");

	_imgHeight = 0;
    _panelSize = rect.size;
    _sliderMaxHeight = rect.size.y - (2.0 * _imgHeight);
    
    double ratio = double(_panelSize.y - rect.size.y) / double(_panelSize.y);
    
    _sliderHeight = _sliderMaxHeight * (1.0 - ratio);
    _sliderPos = 0;
    
    _currentScrollBarColor = &_info.normal;
    
    if(_events.value_change)
    {
        AddConnection(axScrollBarEvents::VALUE_CHANGE, _events.value_change);
    }

}
Ejemplo n.º 26
0
Archivo: main.cpp Proyecto: EQ4/axLib
void FileDialog::OnPaint()
{
	axGC* gc = GetGC();

	axRect rect(GetRect());
	axRect rect0(axPoint(0, 0), rect.size);

	// Background.
	gc->SetColor(axColor(0.9, 0.9, 0.9), 1.0);
	gc->DrawRectangle(rect0);

	// Icon bar.
	axRect iconBarRect(1, 1, rect0.size.x - 1, 31);
	gc->DrawRectangle(iconBarRect);
	gc->DrawRectangleColorFade(iconBarRect, 
							  axColor(0.6, 0.6, 0.6), 1.0, 
							  axColor(0.7, 0.7, 0.7), 1.0);


	gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0);
	gc->DrawRectangleContour(iconBarRect);

	// Folder name.
	gc->SetColor(axColor(0.2, 0.2, 0.2), 1.0);
	gc->SetFontSize(14);
	gc->DrawString(_dirNavigation->GetCurrentDirectoryName(), axPoint(50, 7));

	axRect buttonBarRect(1, rect0.size.y - 30, rect0.size.x - 1, 30);
	gc->DrawRectangle(buttonBarRect);
	gc->DrawRectangleColorFade(buttonBarRect, 
							  axColor(0.6, 0.6, 0.6), 1.0, 
							  axColor(0.7, 0.7, 0.7), 1.0);

	gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0);
	gc->DrawRectangleContour(buttonBarRect);
}
Ejemplo n.º 27
0
void PaintPanel::OnPaint()
{
    axGC* gc = GetGC();
    axRect rect(GetRect());
    axRect rect0(axPoint(0, 0), rect.size);
    
    gc->SetColor(axColor(0.4, 0.4, 0.4), 1.0);
    gc->DrawRectangle(rect0);
    
    
    
    gc->SetColor(axColor(0.9, 0.4, 0.4, 0.5));
    gc->DrawRectangle(axRect(2, 2, 10, 10));
    
    gc->BlockDrawing(axRect(40, 40, 50, 50));
    gc->SetColor(axColor(0.9, 0.4, 0.4), 1.0);
    gc->DrawRectangle(axRect(40, 40, 50, 50));
    
    
    gc->SetColor(axColor(0.9, 0.4, 0.9), 1.0);
    gc->DrawRectangle(axRect(100, 40, 50, 50));
    gc->SetColor(axColor(0.0, 1.0, 0.0), 1.0);
    gc->DrawRectangleContour(axRect(100, 40, 50, 50));
    

    gc->SetColor(axColor(0.9, 0.9, 0.4), 1.0);
    gc->DrawRectangleContour(axRect(160, 40, 50, 50));
    
    
    gc->DrawRectangleColorFade(axRect(220, 40, 50, 50),
                               axColor(0.3, 0.8, 0.2),
                               1.0,
                               axColor(0.3, 0.8, 0.8),
                               1.0);
    
    gc->SetLineWidth(0.5);
    gc->SetColor(axColor(0.0, 0.0, 1.0), 1.0);
    gc->DrawCircle(axPoint(305, 65), 25.0, 3);
    
    gc->SetLineWidth(1.0);
    gc->SetColor(axColor(1.0, 0.0, 1.0), 1.0);
    gc->DrawCircle(axPoint(365, 65), 25.0, 4);
    
    gc->SetLineWidth(2.0);
    gc->SetColor(axColor(0.0, 1.0, 1.0), 1.0);
    gc->DrawCircle(axPoint(425, 65), 25.0, 5);

    gc->SetLineWidth(3.0);
    gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0);
    gc->DrawCircle(axPoint(485, 65), 25.0, 40);
    
    gc->DrawImage(dog_cat_img, axPoint(40, 100));
    gc->DrawImageResize(dog_cat_img,
                        axPoint(250, 100),
                        axSize(90, 70),
                        1.0);
    
    gc->DrawImageResize(dog_cat_img,
                        axPoint(340, 100),
                        axSize(90, 70),
                        0.35);
    
    gc->DrawPartOfImage(dog_cat_img,
                        axPoint(0, 0),
                        axSize(60, 45),
                        axPoint(430, 100));
    
    gc->SetLineWidth(3.0);
    gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0);
    
    int y1 = 350, y2 = 250;
    double w = 1.0;
    for(int i = 0; i < 6; i++, y1 += 10, y2 += 10, w += 1.0)
    {
        gc->DrawLine(axPoint(40, y1), axPoint(300, y2), w);
    }
    
    gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0);
    gc->SetFontSize(12);
    gc->DrawString("Default 12", axPoint(350, 190));
    
    gc->SetFontSize(14);
    gc->DrawString("Default 14", axPoint(350, 205));
    
    gc->SetColor(axColor(0.0, 1.0, 0.0), 1.0);
    gc->SetFontSize(20);
    gc->DrawString("Default 20", axPoint(350, 220));

    
    gc->SeDefaultLine();
    gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0);
    
    gc->DrawRoundedRectangle(axRect(350, 350, 50, 20));
    gc->DrawRectangleContour(rect0);
    
    
    gc->UnBlockDrawing();
    

}
Ejemplo n.º 28
0
MenuPanel::MenuPanel(axWindow* parent,
                         const axRect& rect):
// Parent.
axPanel(parent, rect)
{
    std::string app_path(axApp::GetInstance()->GetAppDirectory());
	//std::string app_path("C:/Users/Alexandre Arsenault/Desktop/axLib/axExamples/Demo/VisualStudio2013/axGL/");
    
    axButtonInfo btn1_info;
    btn1_info.normal = axColor(0.8, 0.8, 0.8);
    btn1_info.hover = axColor(0.9, 0.9, 0.9);
    btn1_info.clicking = axColor(0.7, 0.7, 0.7);
    btn1_info.contour = axColor(0.0, 0.0, 0.0);
    btn1_info.selected = btn1_info.normal;
    
    axButtonEvents btn1_evts;
    btn1_evts.button_click = GetOnPopupMenu();
    
    _btnPopMenu = new axButton(this,
                               axRect(40, 40, 100, 20),
                               btn1_evts,
                               btn1_info,
                               "", "Test1");
    

  
    
    axPopupMenuInfo menu_info(axColor(1.0, 0.0, 0.0),
                              axColor(0.2, 0.8, 0.8),
                              axColor(0.2, 0.8, 0.8),
                              axColor(0.2, 0.8, 0.8),
                              axColor(0.2, 0.8, 0.8),
                              axColor(0.0, 0.0, 0.0));
    
    axPopupMenuEvents menu_evts;
    menu_evts.selection_change = GetOnPopupMenuChoice();
    
    std::vector<std::string> menu_str = {"None", "Test1",
                                         "Test2", "Test3",
                                         "Test4"};
    
    axPoint menu_pos = _btnPopMenu->GetAbsoluteRect().position;
    menu_pos.y += _btnPopMenu->GetSize().y;
    _popMenu = new axPopupMenu(this,
                               axRect(menu_pos, axSize(100, 30)),
                               menu_evts, menu_info, menu_str);
    
    _popMenu->Hide();
    _popMenu->SetSelectedIndex(0);
    
    std::cout << "MenuPanel::_popMenu (id) = " << _popMenu->GetId() << std::endl;
    
    axDropMenuInfo drop_info;
    drop_info.normal = axColor(0.8, 0.8, 0.8);
    drop_info.hover = axColor(0.9, 0.9, 0.9);
    drop_info.clicking = axColor(0.7, 0.7, 0.7);
    drop_info.contour = axColor(0.0, 0.0, 0.0);
    drop_info.selected = drop_info.normal;
    
    axDropMenuEvents drop_evts;
    drop_evts.selection_change = GetOnDropMenuChoice();
    
    _dropMenu = new axDropMenu(this, axRect(250, 40, 100, 20),
                               drop_evts,
                               drop_info,
                               app_path + std::string("DropMenuArrow.png"),
                               app_path + std::string("button.png"),
                               axDROP_MENU_SINGLE_IMG);
    
    
    axButtonEvents btn2_evts;
    btn2_evts.button_click = GetOnTestBtnUnder();
    
    axButton* btn2 = new axButton(this,
                                  axRect(_btnPopMenu->GetBottomLeftPosition() + axPoint(0, 10),
                                         axSize(70, 25)),
                                  btn2_evts,
                                  btn1_info,
                                  "", "BTN");
    
    //--------------------------------------------------------------------------
    axTextBoxEvents txtEvents;
    axTextBoxInfo txtInfo;
    txtInfo.normal = axColor(0.9, 0.9, 0.9);
    txtInfo.hover = axColor(0.9, 0.9, 0.9);
    txtInfo.selected = axColor(1.0, 1.0, 1.0);
    txtInfo.hightlight = axColor(0.4, 0.4, 0.6, 0.4);
    txtInfo.contour = axColor(0.0, 0.0, 0.0);
    txtInfo.cursor = axColor(1.0, 0.0, 0.0);
    txtInfo.selected_shadow = axColor(0.8, 0.8, 0.8, 0.3);
    
    _txtCtrl = new axTextBox(this,
                             axRect(110, 225, 180, 25),
                             txtEvents,
                             txtInfo,
                             "",
                             "Alexandre",
                             axTEXT_BOX_CONTOUR_HIGHLIGHT);
    
    //--------------------------------------------------------------------------


}
Ejemplo n.º 29
0
//static int nDraw = 0;
void axWaveform::OnPaint()
{
//    nDraw++;
//    std::cout << "nDraw : " << nDraw << std::endl;

    axGC* gc = GetGC();
    axRect rect(GetRect());
    axRect rect0(axPoint(0, 0), rect.size);
    
    gc->SetColor(axColor(0.5, 0.5, 0.5), 1.0);
    gc->DrawRectangle(rect0);
    
    if(_audioBuffer != nullptr)
    {
        axBufferInfo b_info = _audioBuffer->GetBufferInfo();
        float* buffer = _audioBuffer->GetBuffer();
        int middle_y = rect.size.y * 0.5;
        
        gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0);

        double nSamplesToProcess = double(b_info.frames) * _zoom;
        
        // Not a 100% sure about 1 + ..
        int index = 1 + b_info.frames * _leftPos;
        
        int changing_pixel = 0; // Just for debugging.
        int nSamplePerPixel = 0;
        
        double min_value_pixel = 1000.0;
        double max_value_pixel = -1000.0;
        
        // Ratio of number of pixel over number of sample to draw.
        double r = double(rect.size.x-2) / nSamplesToProcess;
        
        for(int i = 1; i < floor(nSamplesToProcess); i++, index++)
        {
            // Pixel position.
            double x_pos_left = double(i-1) * r;
            double x_pos_right = double(i) * r;
            
            double l_value = buffer[index - 1];
            double r_value = buffer[index];
            
            if(l_value < min_value_pixel) min_value_pixel = l_value;
            if(l_value > max_value_pixel) max_value_pixel = l_value;
            if(r_value < min_value_pixel) min_value_pixel = r_value;
            if(r_value > max_value_pixel) max_value_pixel = r_value;
            
            // Increment sample at each iteration.
            nSamplePerPixel++;
            
            // If pixel has change.
            if(int(x_pos_left) != int(x_pos_right))
            {
                if(nSamplePerPixel > 1)
                {
                    // Pixel value.
                    int y_pixel_left = middle_y - min_value_pixel * 0.9 * middle_y;
                    int y_pixel_right = middle_y - max_value_pixel * 0.9 * middle_y;
                    
                    // Draw min to max line on the left pixel.
                    gc->DrawLine(axPoint(x_pos_left, y_pixel_left),
                                 axPoint(x_pos_left, y_pixel_right));
                    
                    // Draw last value of left pixel and first value of right
                    // pixel. This is to make sure that horizontal lines will be
                    // drawn if necessary. A liason between each vertical lines.
                    y_pixel_left = middle_y - l_value * 0.9 * middle_y;
                    y_pixel_right = middle_y - r_value * 0.9 * middle_y;
                    
                    gc->DrawLine(axPoint(x_pos_left, y_pixel_left),
                                 axPoint(x_pos_right, y_pixel_right));
                }
                // One sample or less per pixel.
                else
                {
                    // Pixel value.
                    int y_pixel_left = middle_y - l_value * 0.9 * middle_y;
                    int y_pixel_right = middle_y - r_value * 0.9 * middle_y;
                    
                    gc->DrawLine(axPoint(x_pos_left, y_pixel_left),
                                 axPoint(x_pos_right, y_pixel_right));
                }
                
                changing_pixel++;
                nSamplePerPixel = 0;
                min_value_pixel = 1000.0;
                max_value_pixel = -1000.0;
            }
        }
        
        // Draw middle line.
        gc->SetColor(axColor(0.7, 0.7, 0.7), 0.4);
        gc->DrawLine(axPoint(1, middle_y), axPoint(rect.size.x - 2, middle_y));
    }
    
    //--------------------------------------------------------------------------
    if(_envBuffer != nullptr)
    {
        if((*_envBuffer).size() && _showEnv)
        {
            //        axBufferInfo b_info = _audioBuffer->GetBufferInfo();
            //        float* buffer = _audioBuffer->GetBuffer();
            int middle_y = rect.size.y * 0.5;
            
            gc->SetColor(axColor(1.0, 0.0, 0.0), 1.0);
            
            double nSamplesToProcess = double((*_envBuffer).size()) * _zoom;
            
            // Not a 100% sure about 1 + ..
            int index = 1 + (*_envBuffer).size() * _leftPos;
            
            int changing_pixel = 0; // Just for debugging.
            int nSamplePerPixel = 0;
            
            double min_value_pixel = 1000.0;
            double max_value_pixel = -1000.0;
            
            // Ratio of number of pixel over number of sample to draw.
            double r = double(rect.size.x-2) / nSamplesToProcess;
            
            for(int i = 1; i < floor(nSamplesToProcess); i++, index++)
            {
                // Pixel position.
                double x_pos_left = double(i-1) * r;
                double x_pos_right = double(i) * r;
                
                double l_value = (*_envBuffer)[index - 1];
                double r_value = (*_envBuffer)[index];
                
                if(l_value < min_value_pixel) min_value_pixel = l_value;
                if(l_value > max_value_pixel) max_value_pixel = l_value;
                if(r_value < min_value_pixel) min_value_pixel = r_value;
                if(r_value > max_value_pixel) max_value_pixel = r_value;
                
                // Increment sample at each iteration.
                nSamplePerPixel++;
                
                // If pixel has change.
                if(int(x_pos_left) != int(x_pos_right))
                {
                    if(nSamplePerPixel > 1)
                    {
                        // Pixel value.
                        int y_pixel_left = middle_y - min_value_pixel * 0.9 * middle_y;
                        int y_pixel_right = middle_y - max_value_pixel * 0.9 * middle_y;
                        
                        // Draw min to max line on the left pixel.
                        gc->DrawLine(axPoint(x_pos_left, y_pixel_left),
                                     axPoint(x_pos_left, y_pixel_right));
                        
                        // Draw last value of left pixel and first value of right
                        // pixel. This is to make sure that horizontal lines will be
                        // drawn if necessary. A liason between each vertical lines.
                        y_pixel_left = middle_y - l_value * 0.9 * middle_y;
                        y_pixel_right = middle_y - r_value * 0.9 * middle_y;
                        
                        gc->DrawLine(axPoint(x_pos_left, y_pixel_left),
                                     axPoint(x_pos_right, y_pixel_right));
                    }
                    // One sample or less per pixel.
                    else
                    {
                        // Pixel value.
                        int y_pixel_left = middle_y - l_value * 0.9 * middle_y;
                        int y_pixel_right = middle_y - r_value * 0.9 * middle_y;
                        
                        gc->DrawLine(axPoint(x_pos_left, y_pixel_left),
                                     axPoint(x_pos_right, y_pixel_right));
                    }
                    
                    changing_pixel++;
                    nSamplePerPixel = 0;
                    min_value_pixel = 1000.0;
                    max_value_pixel = -1000.0;
                }
            }
            
        }
    }
    
    if(_envPoints != nullptr)
    {
        if((*_envPoints).size() && _showEnv)
        {
            int middle_y = rect.size.y * 0.5;
            
//            gc->SetColor(axColor(0.0, 1.0, 0.0), 1.0);
//            
//            for(auto& n : *_envPoints)
//            {
//                double x_pos = n.x * GetRect().size.x;
//                gc->DrawLine(axPoint(x_pos, middle_y),
//                             axPoint(x_pos, middle_y - n.y * 0.9 * middle_y));
//                
////                std::cout << n.x << " " << n.y << std::endl;
//            }
            
            gc->SetColor(axColor(0.0, 0.0, 1.0), 1.0);
            
            for(int i = 1; i < (*_envPoints).size(); i++)
            {
                double x_pos_left = (*_envPoints)[i-1].x * GetRect().size.x;
                double x_pos_right = (*_envPoints)[i].x * GetRect().size.x;
                int y_pixel_left = middle_y - (*_envPoints)[i-1].y * 0.9 * middle_y;
                int y_pixel_right = middle_y - (*_envPoints)[i].y * 0.9 * middle_y;
                
                gc->DrawLine(axPoint(x_pos_left, y_pixel_left),
                             axPoint(x_pos_right, y_pixel_right));
//                gc->DrawLine(axPoint(x_pos, middle_y),
//                             axPoint(x_pos, middle_y - n.y * 0.9 * middle_y));
                
                //                std::cout << n.x << " " << n.y << std::endl;
            }
        }
    }
    

    // Draw contour.
    gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0);
    gc->DrawRectangleContour(rect0);
}
Ejemplo n.º 30
0
Archivo: main.cpp Proyecto: EQ4/axLib
TitleBar::TitleBar(axApp* app, axWindow* parent, const axRect& rect):
			axPanel(app, parent, rect)
{
	string path(app->GetCurrentAppDirectory());

	function<void (axButtonMsg)> btnFct(GetOnBtn());

	axButton* btn = new axButton(app, this, 
								 axRect(10, 5, 15, 15), 
								 axButtonEvents(btnFct), 
								 axButtonInfo(axColor(0.5, 0.5, 0.5),
											  axColor(0.5, 0.5, 0.5),
											  axColor(0.5, 0.5, 0.5),
											  axColor(0.5, 0.5, 0.5),
											  axColor(0.5, 0.5, 0.5),
											  axColor(0.5, 0.5, 0.5)),
								 path+string("x.png"));


	btnFct = GetOnBtn();
	axButton* btn2 = new axButton(app, this, 
							 axRect(30, 5, 15, 15), 
							 axButtonEvents(btnFct), 
							 axButtonInfo(axColor(0.5, 0.5, 0.5),
										  axColor(0.5, 0.5, 0.5),
										  axColor(0.5, 0.5, 0.5),
										  axColor(0.5, 0.5, 0.5),
										  axColor(0.5, 0.5, 0.5),
										  axColor(0.5, 0.5, 0.5)),
							 path+string("x.png"));



	btn->SetBackgroundAlpha(0.0);
	btn2->SetBackgroundAlpha(0.0);
}