Index » Empathy Jukebox : Blob 69643b / ripper / multiple.pas
unit multiple;
{*
 * EMPRIP - Select album from list that most closely matches CDDB Query
 * Windows CD Audio extraction and MP3 Encoder
 * (C) 2003 Matthew J. Smith, Librarysmith Software
 * Based on AKRIP (http://akrip.sourceforge.net) cddb and audio extraction library
 * and the LAME projects (http://wwww.mp3dev.org) LAME_ENC.DLL.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published
 * by the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *}

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls,global, ScrollListbox, bitmapactionbutton;

type
  Tmultiplealbums = class(TForm)
    lb: TScrollListbox;
    cancel: TBitmapActionButton;
    lab: TLabel;
    manentry: TBitmapActionButton;
    procedure FormActivate(Sender: TObject);
    procedure lbClick(Sender: TObject);
    procedure cancelClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormPaint(Sender: TObject);
    procedure manentryClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

function multipledialog(albs : talbums) : integer;

var
  multiplealbums: Tmultiplealbums;
  albums : talbums;

implementation
uses empripmain;

{$R *.DFM}

const
  FONTCOL = {viewgit}{/viewgit}00C6F7;


function multipledialog(albs : talbums) : integer;
begin
spinglobe.stop;
albums := albs;
multiplealbums:=tmultiplealbums.create(application);
try
multiplealbums.showmodal;
finally


result:=-1;
if multiplealbums.modalresult=mrOK then result:=multiplealbums.lb.itemindex;
if multiplealbums.modalresult=mrAll then result:=-4;
multiplealbums.free;
application.processmessages;
end;

end;

procedure Tmultiplealbums.FormActivate(Sender: TObject);

var
n : integer;
spacing : integer;
begin
spacing:=aspx(40);
cancel.font.color:=FONTCOL;
multiplealbums.lb.clear;
for n:=0 to albums.count-1 do begin
multiplealbums.lb.items.add(albums.artists[n]+'-'+albums.titles[n]);
end;
sizeform(self,'Select Album Title',false);
cancel.font.size:=aspx(18);
lab.autosize:=true;
lab.font.color:=FONTCOL;
lab.font.size:=aspx(18);
lab.font.name:=JUKEBOXFONT;

lab.caption:='Please select the album that most closely matches the CD';
lab.autosize:=false;
lab.Alignment:=taCenter;
lab.left:=0;
lab.width:=width;
lab.top:=spacing;

lb.color:=clblack;
lb.font.name:=JUKEBOXFONT;
lb.font.size:=aspx(18);
lb.font.color:=clgray;
lb.left:=aspx(50);
lb.top:=lab.top+lab.height+spacing;
cancel.width:=aspx(250);
lb.width:=width-cancel.width;;
cancel.left:=lb.left+lb.width;
cancel.top:=lb.top;
lb.height:=height-lb.top-aspx(100);

manentry.font.color:=FONTCOL;
manentry.font.name:=JUKEBOXFONT;
manentry.font.size:=aspx(14);
manentry.width:=aspx(400);

manentry.top:=lb.top+lb.height+aspy(40);
manentry.left:=(width div 2) - (manentry.width div 2);

end;

procedure Tmultiplealbums.lbClick(Sender: TObject);
begin
if lb.itemindex>-1 then modalresult:=mrOk;
end;

procedure Tmultiplealbums.cancelClick(Sender: TObject);
begin
modalresult:=mrCancel;
end;

procedure Tmultiplealbums.FormCreate(Sender: TObject);
begin
doublebuffered:=true;
canvas.Brush.style:=bsClear;
end;

procedure Tmultiplealbums.FormPaint(Sender: TObject);
begin
dobg(self);
end;

procedure Tmultiplealbums.manentryClick(Sender: TObject);
begin
modalresult:=mrAll;
end;

end.