mirror of
https://github.com/clangen/musikcube.git
synced 2025-03-14 04:18:36 +00:00
Added Tracklist contextmenu "Play now" and "Enqueue".
Small fix in Indexer. Started on a "Add Library" dialog. Updated fix from win32cpp repository.
This commit is contained in:
parent
22a2f0caaf
commit
ef37f59767
@ -556,7 +556,7 @@ void Indexer::SyncDelete(std::vector<DBINT> aPaths){
|
||||
|
||||
if(bRemove){
|
||||
// Remove the folder
|
||||
stmtRemove.BindInt(1,stmt.ColumnInt(0));
|
||||
stmtRemove.BindInt(0,stmt.ColumnInt(0));
|
||||
stmtRemove.Step();
|
||||
stmtRemove.Reset();
|
||||
}
|
||||
|
@ -235,4 +235,10 @@ void PlaybackQueue::Play(tracklist::Ptr tracklist){
|
||||
this->currentTrack.reset();
|
||||
this->nowPlaying->CopyTracks(tracklist);
|
||||
this->Play();
|
||||
}
|
||||
}
|
||||
|
||||
void PlaybackQueue::Append(tracklist::Ptr tracklist){
|
||||
// Set the "now playing" to libraries own playlist
|
||||
this->nowPlaying = tracklist->Library()->NowPlaying();
|
||||
this->nowPlaying->AppendTracks(tracklist);
|
||||
}
|
||||
|
@ -44,7 +44,8 @@ namespace musik{ namespace core{
|
||||
}
|
||||
namespace tracklist{
|
||||
class IRandomAccess;
|
||||
typedef boost::shared_ptr<IRandomAccess> Ptr;
|
||||
typedef boost::shared_ptr<IRandomAccess> Ptr;
|
||||
typedef boost::weak_ptr<IRandomAccess> WeakPtr;
|
||||
}
|
||||
} }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -76,6 +77,10 @@ namespace musik{ namespace core{
|
||||
virtual bool CopyTracks(musik::core::tracklist::Ptr tracklist) = 0;
|
||||
virtual bool AppendTracks(musik::core::tracklist::Ptr tracklist) = 0;
|
||||
|
||||
virtual void AppendTrack(musik::core::TrackPtr track) = 0;
|
||||
virtual void Clear() = 0;
|
||||
|
||||
|
||||
virtual void AddRequestedMetakey(const char* metakey) = 0;
|
||||
virtual void RemoveRequestedMetakey(const char* metakey) = 0;
|
||||
|
||||
@ -99,8 +104,6 @@ namespace musik{ namespace core{
|
||||
PositionChangedEvent PositionChanged;
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<IRandomAccess> Ptr;
|
||||
typedef boost::weak_ptr<IRandomAccess> WeakPtr;
|
||||
|
||||
}
|
||||
} }
|
||||
|
@ -264,3 +264,11 @@ UINT64 Standard::Filesize(){
|
||||
return this->infoFilesize;
|
||||
}
|
||||
|
||||
void Standard::AppendTrack(musik::core::TrackPtr track){
|
||||
this->tracks.push_back(track);
|
||||
}
|
||||
|
||||
void Standard::Clear(){
|
||||
this->tracks.clear();
|
||||
this->trackCache.clear();
|
||||
}
|
||||
|
@ -83,6 +83,9 @@ namespace musik{ namespace core{
|
||||
virtual bool CopyTracks(musik::core::tracklist::Ptr tracklist);
|
||||
virtual bool AppendTracks(musik::core::tracklist::Ptr tracklist);
|
||||
|
||||
virtual void AppendTrack(musik::core::TrackPtr track);
|
||||
virtual void Clear();
|
||||
|
||||
virtual void AddRequestedMetakey(const char* metakey);
|
||||
virtual void RemoveRequestedMetakey(const char* metakey);
|
||||
|
||||
|
@ -38,6 +38,8 @@
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <cube/MainMenuController.hpp>
|
||||
//#include <cube/dialog/AddLibraryController.hpp>
|
||||
//#include <cube/dialog/AddLibraryView.hpp>
|
||||
#include <win32cpp/Application.hpp>
|
||||
#include <win32cpp/TopLevelWindow.hpp>
|
||||
#include <boost/format.hpp>
|
||||
@ -50,11 +52,16 @@ using namespace musik::cube;
|
||||
|
||||
/*ctor*/ MainMenuController::MainMenuController(TopLevelWindow& mainWindow)
|
||||
: mainWindow(mainWindow)
|
||||
//,addLibraryController(NULL)
|
||||
{
|
||||
this->mainWindow.Created.connect(
|
||||
this, &MainMenuController::OnMainWindowCreated);
|
||||
}
|
||||
|
||||
MainMenuController::~MainMenuController(){
|
||||
// delete this->addLibraryController;
|
||||
}
|
||||
|
||||
void MainMenuController::OnMainWindowCreated(Window* window)
|
||||
{
|
||||
this->mainWindow.SetMenu(this->CreateMenu());
|
||||
@ -64,6 +71,7 @@ void MainMenuController::ConnectMenuHandlers()
|
||||
{
|
||||
this->fileExit->Activated.connect(this, &MainMenuController::OnFileExit);
|
||||
this->helpAbout->Activated.connect(this, &MainMenuController::OnHelpAbout);
|
||||
this->fileAddLibrary->Activated.connect(this,&MainMenuController::OnAddLibrary);
|
||||
}
|
||||
|
||||
void MainMenuController::OnFileExit(MenuItemRef menuItem)
|
||||
@ -71,6 +79,12 @@ void MainMenuController::OnFileExit(MenuItemRef menuItem)
|
||||
Application::Instance().Terminate();
|
||||
}
|
||||
|
||||
void MainMenuController::OnAddLibrary(MenuItemRef menuItem)
|
||||
{
|
||||
/* dialog::AddLibraryView* addLibraryView = new dialog::AddLibraryView();
|
||||
this->addLibraryController = new dialog::AddLibraryController(*addLibraryView);*/
|
||||
}
|
||||
|
||||
void MainMenuController::OnHelpAbout(MenuItemRef menuItem)
|
||||
{
|
||||
// randomize the contribuitors' names
|
||||
@ -127,7 +141,9 @@ MenuRef MainMenuController::CreateMenu()
|
||||
MenuItemCollection& fileItems = this->fileMenu->Items();
|
||||
//
|
||||
this->file->SetSubMenu(this->fileMenu);
|
||||
this->fileExit = fileItems.Append(MenuItem::Create(_T("E&xit")));
|
||||
|
||||
this->fileAddLibrary = fileItems.Append(MenuItem::Create(_T("&Add Library")));
|
||||
this->fileExit = fileItems.Append(MenuItem::Create(_T("E&xit")));
|
||||
|
||||
// help menu
|
||||
this->helpMenu = Menu::Create();
|
||||
|
@ -40,6 +40,9 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
/*namespace musik { namespace cube { namespace dialog {
|
||||
class AddLibraryController;
|
||||
} } }*/
|
||||
namespace win32cpp {
|
||||
class Window;
|
||||
class TopLevelWindow;
|
||||
@ -58,19 +61,27 @@ namespace musik { namespace cube {
|
||||
|
||||
class MainMenuController: public EventHandler
|
||||
{
|
||||
public: /*ctor*/ MainMenuController(TopLevelWindow& mainWindow);
|
||||
public:
|
||||
MainMenuController(TopLevelWindow& mainWindow);
|
||||
~MainMenuController();
|
||||
|
||||
protected: void OnMainWindowCreated(Window* window);
|
||||
protected: MenuRef CreateMenu();
|
||||
protected: void ConnectMenuHandlers();
|
||||
//
|
||||
protected: void OnFileExit(MenuItemRef menuItem);
|
||||
protected: void OnHelpAbout(MenuItemRef menuItem);
|
||||
protected:
|
||||
void OnMainWindowCreated(Window* window);
|
||||
MenuRef CreateMenu();
|
||||
void ConnectMenuHandlers();
|
||||
|
||||
private: TopLevelWindow& mainWindow;
|
||||
private: MenuRef mainMenu, fileMenu, helpMenu;
|
||||
private: MenuItemRef file, view, audio, tags, help;
|
||||
private: MenuItemRef fileExit, helpAbout;
|
||||
//
|
||||
void OnFileExit(MenuItemRef menuItem);
|
||||
void OnHelpAbout(MenuItemRef menuItem);
|
||||
void OnAddLibrary(MenuItemRef menuItem);
|
||||
|
||||
|
||||
private:
|
||||
TopLevelWindow& mainWindow;
|
||||
MenuRef mainMenu, fileMenu, helpMenu;
|
||||
MenuItemRef file, view, audio, tags, help;
|
||||
MenuItemRef fileExit, helpAbout, fileAddLibrary;
|
||||
// dialog::AddLibraryController *addLibraryController;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include <cube/SourcesItem.hpp>
|
||||
#include <win32cpp/Exception.hpp>
|
||||
#include <vector>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -98,6 +98,21 @@ void TracklistController::OnViewCreated(Window* window)
|
||||
if(model){
|
||||
model->ConnectToQuery(&this->sortQuery);
|
||||
}
|
||||
|
||||
|
||||
// Add the context menu
|
||||
this->contextMenu = win32cpp::Menu::CreatePopup();
|
||||
// Play now menu
|
||||
win32cpp::MenuItemRef playNowMenu = this->contextMenu->Items().Append(win32cpp::MenuItem::Create(_T("Play now")));
|
||||
playNowMenu->Activated.connect(this,&TracklistController::OnPlayNow);
|
||||
// Enqueue menu
|
||||
win32cpp::MenuItemRef enqueueMenu = this->contextMenu->Items().Append(win32cpp::MenuItem::Create(_T("Enqueue")));
|
||||
enqueueMenu->Activated.connect(this,&TracklistController::OnEnqueue);
|
||||
|
||||
//
|
||||
listView->SetContextMenu(contextMenu);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void TracklistController::OnRowActivated(ListView* listView, int row)
|
||||
@ -165,3 +180,21 @@ void TracklistController::OnColumnSort(ListView *listView,ColumnRef column){
|
||||
this->sortQuery.ClearTracks();
|
||||
}
|
||||
}
|
||||
|
||||
void TracklistController::OnPlayNow(win32cpp::MenuItemRef menu){
|
||||
ListView::RowIndexList selectedRows(this->view.listView->SelectedRows());
|
||||
|
||||
TracklistModel* model = (TracklistModel*)this->model.get();
|
||||
if(model){
|
||||
model->OnPlayNow(selectedRows);
|
||||
}
|
||||
}
|
||||
|
||||
void TracklistController::OnEnqueue(win32cpp::MenuItemRef menu){
|
||||
ListView::RowIndexList selectedRows(this->view.listView->SelectedRows());
|
||||
|
||||
TracklistModel* model = (TracklistModel*)this->model.get();
|
||||
if(model){
|
||||
model->OnEnqueue(selectedRows);
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ namespace musik { namespace cube {
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/Types.hpp>
|
||||
#include <win32cpp/Menu.hpp>
|
||||
#include <win32cpp/ListView.hpp>
|
||||
#include <core/config.h>
|
||||
#include <core/Query/ListBase.h>
|
||||
@ -82,10 +83,13 @@ private:
|
||||
void AddColumn(const utfchar *name, const char *metakey, int size);
|
||||
void OnTracklistInfo(UINT64 tracks,UINT64 duration,UINT64 filesize);
|
||||
void OnColumnSort(ListView *listView,ColumnRef column);
|
||||
void OnPlayNow(win32cpp::MenuItemRef menu);
|
||||
void OnEnqueue(win32cpp::MenuItemRef menu);
|
||||
|
||||
ModelRef model;
|
||||
TracklistView& view;
|
||||
ColumnList columns;
|
||||
win32cpp::MenuRef contextMenu;
|
||||
musik::core::Query::SortTracks sortQuery;
|
||||
|
||||
};
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include <core/PlaybackQueue.h>
|
||||
#include <core/MetaKey.h>
|
||||
#include <core/tracklist/IRandomAccess.h>
|
||||
#include <core/tracklist/Standard.h>
|
||||
|
||||
|
||||
using namespace musik::cube;
|
||||
@ -130,6 +131,34 @@ void TracklistModel::OnRowActivated(int row){
|
||||
musik::core::PlaybackQueue::Instance().Play(this->tracklist);
|
||||
}
|
||||
|
||||
void TracklistModel::OnPlayNow(win32cpp::ListView::RowIndexList& selectedRows){
|
||||
// Create a temporary tracklist to put into the "now playing" tracklist
|
||||
musik::core::tracklist::Ptr selectedTracklist(new musik::core::tracklist::Standard());
|
||||
selectedTracklist->SetLibrary(this->tracklist->Library());
|
||||
|
||||
for(win32cpp::ListView::RowIndexList::iterator row=selectedRows.begin();row!=selectedRows.end();++row){
|
||||
musik::core::TrackPtr track( (*this->tracklist)[*row] );
|
||||
if(track){
|
||||
selectedTracklist->AppendTrack(track);
|
||||
}
|
||||
}
|
||||
musik::core::PlaybackQueue::Instance().Play(selectedTracklist);
|
||||
}
|
||||
|
||||
void TracklistModel::OnEnqueue(win32cpp::ListView::RowIndexList& selectedRows){
|
||||
// Create a temporary tracklist to put into the "now playing" tracklist
|
||||
musik::core::tracklist::Ptr selectedTracklist(new musik::core::tracklist::Standard());
|
||||
selectedTracklist->SetLibrary(this->tracklist->Library());
|
||||
|
||||
for(win32cpp::ListView::RowIndexList::iterator row=selectedRows.begin();row!=selectedRows.end();++row){
|
||||
musik::core::TrackPtr track( (*this->tracklist)[*row] );
|
||||
if(track){
|
||||
selectedTracklist->AppendTrack(track);
|
||||
}
|
||||
}
|
||||
musik::core::PlaybackQueue::Instance().Append(selectedTracklist);
|
||||
}
|
||||
|
||||
void TracklistModel::ConnectToQuery(musik::core::Query::ListBase *connectedQuery){
|
||||
if(connectedQuery){
|
||||
this->tracklist->ConnectToQuery(*connectedQuery);
|
||||
|
@ -59,30 +59,36 @@ namespace musik { namespace cube {
|
||||
class TracklistModel: public ListView::Model, public EventHandler
|
||||
{
|
||||
// typedefs
|
||||
public: typedef ListView::Model base;
|
||||
public: typedef ListView::RowRendererRef RowRendererRef;
|
||||
public: typedef ListView::CellRendererRef CellRendererRef;
|
||||
public: typedef ListView::ColumnRef ColumnRef;
|
||||
public:
|
||||
typedef ListView::Model base;
|
||||
typedef ListView::RowRendererRef RowRendererRef;
|
||||
typedef ListView::CellRendererRef CellRendererRef;
|
||||
typedef ListView::ColumnRef ColumnRef;
|
||||
|
||||
// public API
|
||||
public: /*ctor*/ TracklistModel(
|
||||
musik::core::Query::ListBase *connectedQuery,
|
||||
musik::core::tracklist::Ptr setTracklist);
|
||||
TracklistModel(
|
||||
musik::core::Query::ListBase *connectedQuery,
|
||||
musik::core::tracklist::Ptr setTracklist);
|
||||
|
||||
public: void ConnectToQuery(musik::core::Query::ListBase *connectedQuery);
|
||||
void ConnectToQuery(musik::core::Query::ListBase *connectedQuery);
|
||||
void OnRowActivated(int row);
|
||||
|
||||
public: void OnRowActivated(int row);
|
||||
void OnPlayNow(win32cpp::ListView::RowIndexList& selectedRows);
|
||||
void OnEnqueue(win32cpp::ListView::RowIndexList& selectedRows);
|
||||
|
||||
// ListView::Model implementation
|
||||
public: virtual uistring CellValueToString(int rowIndex, ColumnRef column);
|
||||
// ListView::Model implementation
|
||||
virtual uistring CellValueToString(int rowIndex, ColumnRef column);
|
||||
|
||||
// instance data
|
||||
protected: void OnTrackMeta(std::vector<int> &trackPositions);
|
||||
protected: void OnTracks(bool cleared);
|
||||
protected: void OnPositionChanged(int activeRow,int oldActiveRow);
|
||||
protected: int currentPosition;
|
||||
// instance data
|
||||
protected:
|
||||
void OnTrackMeta(std::vector<int> &trackPositions);
|
||||
void OnTracks(bool cleared);
|
||||
void OnPositionChanged(int activeRow,int oldActiveRow);
|
||||
|
||||
public: musik::core::tracklist::Ptr tracklist; // FIXME: no public fields!
|
||||
int currentPosition;
|
||||
|
||||
public:
|
||||
musik::core::tracklist::Ptr tracklist; // FIXME: no public fields!
|
||||
|
||||
};
|
||||
|
||||
|
@ -448,6 +448,30 @@
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Dialogs"
|
||||
>
|
||||
<Filter
|
||||
Name="AddLibrary"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\dialog\AddLibraryController.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\dialog\AddLibraryController.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\dialog\AddLibraryView.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\dialog\AddLibraryView.hpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\main.cpp"
|
||||
>
|
||||
|
71
src/cube/dialog/AddLibraryController.cpp
Normal file
71
src/cube/dialog/AddLibraryController.cpp
Normal file
@ -0,0 +1,71 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2007, mC2 Team
|
||||
//
|
||||
// Sources and Binaries of: mC2, win32cpp
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// * Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <cube/dialog/AddLibraryController.hpp>
|
||||
#include <cube/dialog/AddLibraryView.hpp>
|
||||
|
||||
#include <win32cpp/Window.hpp>
|
||||
#include <win32cpp/Label.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using namespace musik::cube::dialog;
|
||||
using namespace win32cpp;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
AddLibraryController::AddLibraryController(AddLibraryView& addLibraryView)
|
||||
:addLibraryView(addLibraryView)
|
||||
{
|
||||
this->addLibraryView.Created.connect(
|
||||
this, &AddLibraryController::OnViewCreated);
|
||||
|
||||
this->addLibraryView.Resized.connect(
|
||||
this, &AddLibraryController::OnViewResized);
|
||||
}
|
||||
|
||||
void AddLibraryController::OnViewCreated(Window* window)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AddLibraryController::OnViewResized(Window* window, Size size)
|
||||
{
|
||||
}
|
||||
|
75
src/cube/dialog/AddLibraryController.hpp
Normal file
75
src/cube/dialog/AddLibraryController.hpp
Normal file
@ -0,0 +1,75 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2007, mC2 Team
|
||||
//
|
||||
// Sources and Binaries of: mC2, win32cpp
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// * Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace musik { namespace cube { namespace dialog{
|
||||
class AddLibraryView;
|
||||
} } }
|
||||
namespace win32cpp{
|
||||
class Window;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//#include <cube/dialog/AddLibraryController.hpp>
|
||||
#include <win32cpp/Types.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace musik { namespace cube { namespace dialog{
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class AddLibraryController : public win32cpp::EventHandler{
|
||||
|
||||
public:
|
||||
AddLibraryController(AddLibraryView& addLibraryView);
|
||||
|
||||
private:
|
||||
void OnViewCreated(win32cpp::Window* window);
|
||||
void OnViewResized(win32cpp::Window* window, win32cpp::Size size);
|
||||
|
||||
AddLibraryView& addLibraryView;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} } } // musik::cube::dialog
|
56
src/cube/dialog/AddLibraryView.cpp
Normal file
56
src/cube/dialog/AddLibraryView.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2007, mC2 Team
|
||||
//
|
||||
// Sources and Binaries of: mC2, win32cpp
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// * Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <cube/dialog/AddLibraryView.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using namespace musik::cube::dialog;
|
||||
using namespace win32cpp;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
AddLibraryView::AddLibraryView()
|
||||
{
|
||||
}
|
||||
|
||||
void AddLibraryView::OnCreated()
|
||||
{
|
||||
|
||||
}
|
70
src/cube/dialog/AddLibraryView.hpp
Normal file
70
src/cube/dialog/AddLibraryView.hpp
Normal file
@ -0,0 +1,70 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2007, mC2 Team
|
||||
//
|
||||
// Sources and Binaries of: mC2, win32cpp
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// * Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace win32cpp{
|
||||
class Window;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/Frame.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace musik { namespace cube { namespace dialog {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// forward
|
||||
class AddLibraryController;
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class AddLibraryView: public win32cpp::Frame{
|
||||
public:
|
||||
AddLibraryView();
|
||||
|
||||
protected:
|
||||
virtual void OnCreated();
|
||||
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} } } // musik::cube::dialog
|
||||
|
@ -66,7 +66,6 @@
|
||||
#include <sigslot/sigslot.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Types.hpp>
|
||||
#include <win32cpp/WindowGeometry.hpp>
|
||||
@ -78,5 +77,4 @@
|
||||
#include <win32cpp/Application.hpp>
|
||||
#include <win32cpp/TopLevelWindow.hpp>
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -174,14 +174,19 @@ LRESULT ListView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
::GetCursorPos(&mousePos);
|
||||
if (this->contextMenu)
|
||||
{
|
||||
::TrackPopupMenu(
|
||||
UINT result = (UINT) ::TrackPopupMenu(
|
||||
this->contextMenu->Handle(),
|
||||
NULL,
|
||||
TPM_RETURNCMD,
|
||||
mousePos.x,
|
||||
mousePos.y,
|
||||
NULL,
|
||||
this->Handle(),
|
||||
NULL);
|
||||
|
||||
if (result != NULL)
|
||||
{
|
||||
Menu::ItemActivated(LOWORD(result));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -193,11 +193,10 @@ public: // methods
|
||||
|
||||
MenuItemCollection& Items() { return (*this->items); }
|
||||
HMENU Handle() { return this->menuHandle; }
|
||||
static void ItemActivated(UINT menuID); // used by Window
|
||||
|
||||
protected: // methods
|
||||
void Initialize(HMENU menu);
|
||||
|
||||
static void ItemActivated(UINT menuID); // used by Window
|
||||
void OnItemAdded(MenuItemRef newMenuItem, unsigned index);
|
||||
void OnItemRemoved(MenuItemRef oldMenuItem);
|
||||
void OnItemChanged(MenuItemRef menuItem);
|
||||
|
Loading…
x
Reference in New Issue
Block a user