17 #pragma package(smart_init)
18 #pragma resource "*.dfm"
26 void TdmRemote::hookEvents(TForm * NewForm, TForm * PriorForm)
30 NewForm->OnStartDock = ChildFormStartDock;
32 NewForm->OnClose = ChildFormClose;
35 PriorForm->OnStartDock = NULL;
37 PriorForm->OnClose = NULL;
41 void __fastcall TdmRemote::ChildFormStartDock(TObject *Sender, TDragDockObject *&DragObject)
46 void __fastcall TdmRemote::ChildFormClose(TObject * aForm, TCloseAction & aAction)
49 if (aForm == FPlaylistForm)
53 if (aForm == FMainForm)
57 if (aForm == FSettingsForm)
61 if (aForm == FCommandsForm)
68 void __fastcall TdmRemote::GetFilenames(
int Start,
int Stop, TStringList * Files)
73 for (i = Start ; i <
Stop; i++)
83 string filelist = Files->Text.c_str();
84 vector <string> playlist;
85 for (
int i = 0 ; i < Files->Count ; i++)
86 playlist.push_back(Files->Strings[i].c_str());
88 if (selectedIndex >= 0)
95 std::auto_ptr<TStringList> Playlist(
new TStringList());
99 GetFilenames(0, DropIndex, Playlist.get());
103 Playlist->AddStrings(DropFiles);
114 int NewPos = DropFiles->IndexOfObject((TObject *)
true);
321 DetailsForm->ShowModal();
376 LastIndex = CurrentIndex;
381 std::auto_ptr<TStringList> SongList(
new TStringList());
386 SongList->Text = list.c_str();
460 AnsiString commandstr;
475 std::auto_ptr<TStringList> Files(
new TStringList);
477 Files->Sorted =
true;
501 Application->Terminate();
517 ServersForm->ShowModal();
518 if (ServersForm->ModalResult != mrOk)
556 #define IDANI_CLOSE 2
558 #ifndef IDANI_CAPTION
559 #define IDANI_CAPTION 3
562 ShowWindow(Application->Handle, SW_SHOW);
564 DWORD dwExStyle = GetWindowLong(Application->Handle, GWL_EXSTYLE);
565 dwExStyle ^= WS_EX_TOOLWINDOW;
566 SetWindowLong(Application->Handle, GWL_EXSTYLE, dwExStyle);
568 TRect FromRect, ToRect;
569 FromRect = TRect(Screen->Width - 16, Screen->Height, Screen->Width, Screen->Height - 16);
573 HRGN HideRegion = CreateRectRgn(0,0,1,1);
574 SetWindowRgn(
frmMain->Handle, HideRegion,
false);
580 SetWindowRgn(
frmMain->Handle, NULL,
true);
583 Application->Restore();
611 std::auto_ptr<TStringList> TopList(
new TStringList());
612 std::auto_ptr<TStringList> MiddleList(
new TStringList());
613 std::auto_ptr<TStringList> BottomList(
new TStringList());
618 for (i = 0 ; i < FPlaylistForm->
lstSongs->Items->Count; i++)
622 CurrentSong = i == currentPos;
624 if (FPlaylistForm->
lstSongs->Selected[i])
626 MiddleList->AddObject(filename.c_str(), (TObject *) CurrentSong);
628 else if (i < dropIndex)
630 TopList->AddObject(filename.c_str(), (TObject *) CurrentSong);
634 BottomList->AddObject(filename.c_str(), (TObject *) CurrentSong);
639 TopList->AddStrings(MiddleList.get());
640 TopList->AddStrings(BottomList.get());
645 NewPos = TopList->IndexOfObject((TObject *)
true);
658 int SongS = 0, PosMS;
660 client->
setTime((1000 * SongS * pos) / width);
691 for (
int i = 0; i < 11; i++)
693 bands.push_back(dmRemote->client->
getEQData(i));
731 std::string title =
"";
748 std::auto_ptr < TStringList > StringList(
new TStringList);
753 StringList->Text = list.c_str();
755 for (i = FPlaylistForm->
lstSongs->Items->Count - 1; i >= 0; i--)
757 if (FPlaylistForm->
lstSongs->Selected[i])
760 StringList->Delete(i);
761 if (i < CurrentIndex)
793 hookEvents(aForm, FPlaylistForm);
794 FPlaylistForm = form;
801 hookEvents(aForm, FMainForm);
809 hookEvents(aForm, FSettingsForm);
810 FSettingsForm = form;
817 hookEvents(aForm, FCommandsForm);
818 FCommandsForm = form;
825 if (aForm == FPlaylistForm)
826 FPlaylistForm = NULL;
827 if (aForm == FMainForm)
829 if (aForm == FSettingsForm)
830 FSettingsForm = NULL;
869 const TPoint VolumeTL = config.
VolumePos();