unit albumartist; {* * EMPRIP - Albumaritst Get user input when album and artist can't be found * 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, StdCtrls,filectrl,main,global, bitmapactionbutton; type Talbumdialog = class(TForm) editalb: TEdit; editart: TEdit; artlab: TLabel; alblab: TLabel; error: TLabel; procedure okClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormPaint(Sender: TObject); procedure CancelClick(Sender: TObject); private { Private declarations } public { Public declarations } end; var albumdialog: Talbumdialog; function getuseralbumtitle(var album,artist : string) : integer; implementation uses isconnected, empripmain; var alb,art : string; oalb,oart : string; {$R *.DFM} function getuseralbumtitle(var album,artist : string) : integer; begin albumdialog:=talbumdialog.create(application); albumdialog.editart.text:=artist; albumdialog.editalb.text:=album; oart:=artist; oalb:=album; result:=0; osk(true,false); try result:=albumdialog.showmodal; finally if result=mrOk then begin album:=alb; artist:=art; end else begin album:=oalb; artist:=oart; end; osk(false,false); albumdialog.free; end; end; procedure Talbumdialog.okClick(Sender: TObject); begin if (validname(editart.text)=false) or (validname(editalb.text)=false) then begin error.caption:='Album and Artist fields must be filled in and cannot contain special characters (\/:*?"<>|)'; exit; end; if sysutils.directoryexists(config.path+editart.text+'__'+editalb.text) then begin error.caption:='Album already exists. Enter different album details'; exit; if (oalb=editalb.text) and (oart=editart.text) then begin modalresult:=mrOk; exit; end; end; modalresult:=mrOK; alb:=editalb.text; art:=editart.text; end; procedure Talbumdialog.FormCreate(Sender: TObject); begin doublebuffered:=true; sizeform(self,'Enter CD Information',true); color:=clblack; error.Transparent:=true; artlab.Transparent:=true; alblab.Transparent:=true; error.Alignment:=tacenter; error.font.name:=JUKEBOXFONT; error.font.size:=aspx(14); error.font.color:=FONTCOL; alblab.font:=error.font; artlab.font:=error.font; editalb.font:=error.font; editart.font:=error.font; //ok.font:=error.font; cancel.font:=error.font; editalb.font.color:=clgray; editart.font.color:=clgray; error.font.size:=aspx(12); editart.width:=aspx(400); editalb.width:=aspx(400); cancel.width:=aspx(250); ok.width:=cancel.width; editalb.color:=clblack; editart.color:=clblack; ok.font.size:=aspx(18); cancel.font.size:=ok.font.size; artlab.top:=0; artlab.left:=aspx(40); editart.top:=artlab.top+artlab.height; editart.left:=(width div 2)-(editart.width div 2); alblab.top:=editart.top+editart.height+aspy(40); alblab.left:=artlab.left; editalb.left:=editart.left; editalb.top:=alblab.top+alblab.height; error.AutoSize:=false; error.width:=Width; error.left:=0; error.top:=aspy(40)+editalb.height+editalb.top; ok.top:=error.top+error.height+aspx(40); cancel.top:=ok.top; ok.left:=((width div 2) div 2)-(ok.width div 2); cancel.left:=(((width div 2) div 2)-(cancel.width div 2))+(width div 2); ok.font.color:=FONTCOL; cancel.font.color:=FONTCOL; //editart.Font.color:=; end; procedure Talbumdialog.FormPaint(Sender: TObject); begin dobg(self); end; procedure Talbumdialog.CancelClick(Sender: TObject); begin modalresult:=mrCancel; end; end.