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, Dialogs, StdCtrls, bitmapactionbutton,isconnected; type Talbumdialog = class(TForm) editalb: TEdit; editart: TEdit; Artist: TLabel; album: TLabel; inf: TLabel; OK: TBitmapActionButton; cancel: TBitmapActionButton; procedure okClick(Sender: TObject); procedure cancelClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormActivate(Sender: TObject); procedure FormPaint(Sender: TObject); private { Private declarations } public { Public declarations } end; var albumdialog: Talbumdialog; function getuseralbumtitle(var album,artist : string) : integer; implementation uses empripmain,mydialog; var alb,art : string; {$R *.DFM} function getuseralbumtitle(var album,artist : string) : integer; begin albumdialog:=talbumdialog.create(application); albumdialog.color:=clblack; albumdialog.editalb.color:=clblack; albumdialog.editalb.font.color:=clgray; albumdialog.editart.font.color:=clgray; albumdialog.editart.color:=clblack; albumdialog.editart.font.size:=18; albumdialog.editalb.font.size:=18; albumdialog.editart.font.name:='Arial'; albumdialog.editalb.font.name:='Arial'; albumdialog.artist.font.color:=FONTCOL; albumdialog.album.font.color:=FONTCOL; albumdialog.ok.color:=clblack; albumdialog.cancel.color:=clblack; albumdialog.ok.font.color:=FONTCOL; albumdialog.cancel.font.color:=FONTCOL; albumdialog.inf.font.color:=clLime; albumdialog.inf.font.name:='Arial'; albumdialog.inf.font.size:=14; albumdialog.inf.left:=(albumdialog.width div 2) - (albumdialog.inf.width div 2); if album='' then begin albumdialog.inf.caption:='No CD information could be obtained from the internet. You will need to enter the CD information manually.'; albumdialog.ok.caption:='Next'; end else begin albumdialog.editalb.text:=album; albumdialog.editart.text:=artist; albumdialog.ok.caption:='Set'; albumdialog.inf.caption:='Enter album title information'; end; try osk(true); result:=albumdialog.showmodal; finally osk(false); if result=mrOK then begin album:=alb; artist:=art; end; albumdialog.free; end; end; function validname(s : string) : boolean; begin result:=true; if pos('/',s)<>0 then result:=false; if pos('\',s)<>0 then result:=false; if pos(':',s)<>0 then result:=false; if pos('*',s)<>0 then result:=false; if pos('?',s)<>0 then result:=false; if pos('"',s)<>0 then result:=false; if pos('<',s)<>0 then result:=false; if pos('>',s)<>0 then result:=false; if pos('|',s)<>0 then result:=false; if length(trim(s))=0 then result:=false; end; procedure Talbumdialog.okClick(Sender: TObject); begin osk(false); if (validname(editart.text)=false) or (validname(editalb.text)=false) then begin visible:=false; if md('Album and Artist fields must be filled in and cannot contain special characters (\/:*?"<>|)','Try Again','','Entry Error',true)=idAbort then begin modalresult:=idAbort; exit; end; visible:=true; osk(true); exit; end else begin osk(false); modalresult:=mrOK; alb:=editalb.text; art:=editart.text; end; end; procedure Talbumdialog.cancelClick(Sender: TObject); begin modalresult:=mrCancel; end; procedure Talbumdialog.FormCreate(Sender: TObject); begin canvas.Brush.style:=bsClear; sizeform(self,'Album details'); end; procedure Talbumdialog.FormActivate(Sender: TObject); begin albumdialog.editart.setfocus; albumdialog.editart.selstart:=length(albumdialog.editart.text); end; procedure Talbumdialog.FormPaint(Sender: TObject); begin dobg(self); end; end.