From 25158322fdd49658ca7dc08f188fd1a0600abc80 Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Thu, 10 Nov 2011 13:17:45 +0000 Subject: [PATCH] cactusjukebox: Starts adding a new viewmode, fixes compilation after MDI was added to the LCL and converts a lot of WriteLns into DebugOutLn and adds a new debug mode with less verbosity and now by default there will be no console in Windows in the default debug mode, but there is also debug verbose available. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2119 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../cactusjukebox/source/cactusjukebox.lpi | 67 ++++++++-- .../cactusjukebox/source/cactusjukebox.pas | 10 +- applications/cactusjukebox/source/cddb.pas | 42 +++---- .../cactusjukebox/source/fmodintf/fmoddyn.pas | 4 +- .../cactusjukebox/source/mainform.lfm | 94 +++++++------- .../cactusjukebox/source/mainform.pas | 116 ++++++++++-------- .../cactusjukebox/source/mediacol.pas | 25 ++-- applications/cactusjukebox/source/mplayer.pas | 4 +- applications/cactusjukebox/source/skin.pas | 15 +-- .../source/tagreader/mp3file.pas | 12 +- 10 files changed, 230 insertions(+), 159 deletions(-) diff --git a/applications/cactusjukebox/source/cactusjukebox.lpi b/applications/cactusjukebox/source/cactusjukebox.lpi index c3dc1bb3e..5bbbdc759 100644 --- a/applications/cactusjukebox/source/cactusjukebox.lpi +++ b/applications/cactusjukebox/source/cactusjukebox.lpi @@ -18,14 +18,58 @@ - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -53,7 +97,7 @@ - + @@ -73,7 +117,7 @@ - + @@ -299,7 +343,7 @@ - + @@ -326,11 +370,12 @@ - - - - + + + + + diff --git a/applications/cactusjukebox/source/cactusjukebox.pas b/applications/cactusjukebox/source/cactusjukebox.pas index 710c55362..7e7d6bf8a 100644 --- a/applications/cactusjukebox/source/cactusjukebox.pas +++ b/applications/cactusjukebox/source/cactusjukebox.pas @@ -40,7 +40,15 @@ var begin Application.Title:='cactus'; {$ifdef CactusDebug} - CVerbosityLevel:=8; + {$ifdef CactusDebugVerbose} + CVerbosityLevel:=8; + {$else} + {$ifdef Windows} + CVerbosityLevel:=0; + {$else} + CVerbosityLevel:=1; + {$endif} + {$endif} {$else} {$ifdef Windows} CVerbosityLevel:=0; diff --git a/applications/cactusjukebox/source/cddb.pas b/applications/cactusjukebox/source/cddb.pas index 648ef6718..a53209df3 100755 --- a/applications/cactusjukebox/source/cddb.pas +++ b/applications/cactusjukebox/source/cddb.pas @@ -140,12 +140,12 @@ begin except end; end; - writeln('-------------------------------------------------'); - writeln(s); - writeln(errorcode); - writeln(s1); - writeln(s2); - writeln('-------------------------------------------------'); + DebugOutLn('-------------------------------------------------', 0); + DebugOutLn(s, 0); + DebugOutLn(errorcode, 0); + DebugOutLn(s1, 0); + DebugOutLn(s2, 0); + DebugOutLn('-------------------------------------------------', 0); end; if (ErrorCode=200) and query_send then begin @@ -154,7 +154,7 @@ begin delete(s, 1, pos(' ', s)); s1:=copy(s, 1, pos(' ',s)); Connection.SendMessage('cddb read '+tmp+' '+s1+' '+#13+#10); - writeln('cddb read ',tmp,' ',s1,' '); + DebugOutLn('cddb read '+tmp+' '+s1+' ', 0); end; if (ErrorCode=211) and query_send then begin @@ -164,13 +164,13 @@ begin delete(s, 1, pos(' ', s)); s1:=copy(s, 1, pos(' ',s)); Connection.SendMessage('cddb read '+tmp+' '+s1+' '+#10+#13); - writeln('cddb read ',tmp,' ',s1,' '); + DebugOutLn('cddb read '+tmp+' '+s1+' ', 0); end; if (ErrorCode=200) and (not query_send) then begin Connection.SendMessage('cddb query '+QueryString+#10+#13); - writeln('cddb query '+QueryString); + DebugOutLn('cddb query '+QueryString, 0); query_send:=true; end; @@ -203,7 +203,7 @@ begin album:=Latin1toUTF8(album); data_ready:=true; receiving_data := false; - writeln('CDDB data ready...'); + DebugOutLn('CDDB data ready...', 0); end; end; @@ -216,15 +216,15 @@ end; procedure TCddbObject.OnErrorProc(const msg: string; asocket: TLSocket); begin - ErrorMsg:=msg; - writeln(ErrorMsg); + ErrorMsg:=msg; + DebugOutLn(ErrorMsg, 0); end; //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ procedure TCddbObject.OnDisconnectProc(asocket: TLSocket); begin -writeln('lost connection'); + DebugOutLn('[TCddbObject.OnDisconnectProc] lost connection', 0); end; //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -232,11 +232,11 @@ end; procedure TCddbObject.OnConnectProc(asocket: TLSocket); var s:string; begin - asocket.GetMessage(s); - writeln(s); - Connection.CallAction; - writeln('connected to cddb server, sending hello...'); - asocket.SendMessage('cddb hello '+FUser+' '+FHostname+' '+FSoftware+' '+FVersion+#13+#10); + asocket.GetMessage(s); + DebugOutLn(s, 0); + Connection.CallAction; + DebugOutLn('connected to cddb server, sending hello...', 0); + asocket.SendMessage('cddb hello '+FUser+' '+FHostname+' '+FSoftware+' '+FVersion+#13+#10); end; //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -255,8 +255,8 @@ begin {$ifdef HAS_CDROM} discid:=(CDDBDiscID(TOCEntries, NrTracks)); querystring:=GetCDDBQueryString(TOCEntries, NrTracks); - writeln(QueryString); - writeln(hexStr(discid, 8)); + DebugOutLn(QueryString, 0); + DebugOutLn(hexStr(discid, 8), 0); {$endif} FServer:=server; @@ -369,7 +369,7 @@ begin {$ifdef HAS_CDROM} DriveCount:=GetCDRomDevices(CDromDrives); {$endif} - Writeln(DriveCount,' CD-ROM drives autodetected'); + DebugOutLn(Format('%d CD-ROM drives autodetected', [DriveCount]), 0); For b:=1 to DriveCount do Writeln('Drive ',b,' on device: ',CDRomDrives[b]); Except diff --git a/applications/cactusjukebox/source/fmodintf/fmoddyn.pas b/applications/cactusjukebox/source/fmodintf/fmoddyn.pas index e6db1a22f..70a7a6c3f 100644 --- a/applications/cactusjukebox/source/fmodintf/fmoddyn.pas +++ b/applications/cactusjukebox/source/fmodintf/fmoddyn.pas @@ -38,7 +38,7 @@ uses {$IFDEF WINDOWS} Windows, {$ENDIF} - fmodtypes; + fmodtypes, debug; { Disable warning for unsafe types in Delphi 7 @@ -586,7 +586,7 @@ begin { If no library name given, use the default library names } if (LibName = nil) or (LibName='') then LibName := FMOD_DLL; - writeln('loading'); + DebugOutLn('loading', 0); { Load the library } {$IFDEF WINDOWS} FMODHandle := LoadLibrary(LibName); diff --git a/applications/cactusjukebox/source/mainform.lfm b/applications/cactusjukebox/source/mainform.lfm index fe18ce6ae..74e4e14e4 100644 --- a/applications/cactusjukebox/source/mainform.lfm +++ b/applications/cactusjukebox/source/mainform.lfm @@ -1,7 +1,7 @@ object Main: TMain - Left = 191 + Left = 139 Height = 624 - Top = 61 + Top = 135 Width = 893 ActiveControl = Panel4 Caption = 'titel' @@ -1104,37 +1104,6 @@ object Main: TMain ClientWidth = 288 TabOrder = 1 OnClick = Panel4Click - object ArtistTree: TTreeView - Left = 26 - Height = 571 - Top = 5 - Width = 259 - Align = alClient - BorderSpacing.Top = 5 - BorderSpacing.Right = 3 - BorderSpacing.Bottom = 5 - BorderSpacing.InnerBorder = 20 - BorderSpacing.CellAlignHorizontal = ccaLeftTop - BorderSpacing.CellAlignVertical = ccaLeftTop - DefaultItemHeight = 16 - DragMode = dmAutomatic - ExpandSignType = tvestArrow - Images = ImageList1 - PopupMenu = artisttreemenu - ReadOnly = True - RightClickSelect = True - ScrollBars = ssAutoBoth - ShowRoot = False - TabOrder = 0 - OnClick = ArtistTreeClick - OnDblClick = ArtistTreeDblClick - OnEndDrag = ArtistTreeEndDrag - OnKeyUp = ArtistTreeKeyUp - OnMouseDown = ArtistTreeMouseDown - OnSelectionChanged = ArtistTreeSelectionChanged - OnStartDrag = ArtistTreeStartDrag - Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRightClickSelect, tvoShowButtons, tvoShowLines, tvoToolTips] - end object ArtistSrchField: TPanel Left = 152 Height = 64 @@ -1142,7 +1111,7 @@ object Main: TMain Width = 128 ClientHeight = 64 ClientWidth = 128 - TabOrder = 1 + TabOrder = 0 Visible = False OnClick = ArtistSrchFieldClick object Label2: TLabel @@ -1223,33 +1192,74 @@ object Main: TMain EdgeOuter = esNone HotImages = SidebarImgList Images = SidebarImgList - TabOrder = 2 + TabOrder = 1 Transparent = True - object LibModeBtn: TToolButton + object ArtistsModeBtn: TToolButton Left = 1 - Top = 0 + Top = 154 AutoSize = True - Caption = 'Library' + Caption = 'Artists' ImageIndex = 0 - OnClick = LibModeBtnClick + OnClick = ArtistsModeBtnClick Style = tbsCheck end object NetModeBtn: TToolButton Left = 1 - Top = 154 + Top = 308 Caption = 'NetModeBtn' ImageIndex = 1 OnClick = NetModeBtnClick Style = tbsCheck end object DeviceModeBtn: TToolButton - Left = 1 - Top = 308 + Left = 24 + Top = 0 Caption = 'DeviceModeBtn' ImageIndex = 2 OnClick = DeviceModeBtnClick Style = tbsCheck end + object LibraryModeBtn: TToolButton + Left = 1 + Top = 0 + AutoSize = True + Caption = 'Artists' + ImageIndex = 0 + OnClick = LibraryModeBtnClick + Style = tbsCheck + Visible = False + end + end + object ArtistTree: TTreeView + Left = 26 + Height = 571 + Top = 5 + Width = 259 + Align = alClient + BorderSpacing.Top = 5 + BorderSpacing.Right = 3 + BorderSpacing.Bottom = 5 + BorderSpacing.InnerBorder = 20 + BorderSpacing.CellAlignHorizontal = ccaLeftTop + BorderSpacing.CellAlignVertical = ccaLeftTop + DefaultItemHeight = 16 + DragMode = dmAutomatic + ExpandSignType = tvestArrow + Images = ImageList1 + PopupMenu = artisttreemenu + ReadOnly = True + RightClickSelect = True + ScrollBars = ssAutoBoth + ShowRoot = False + TabOrder = 2 + OnClick = ArtistTreeClick + OnDblClick = ArtistTreeDblClick + OnEndDrag = ArtistTreeEndDrag + OnKeyUp = ArtistTreeKeyUp + OnMouseDown = ArtistTreeMouseDown + OnSelectionChanged = ArtistTreeSelectionChanged + OnStartDrag = ArtistTreeStartDrag + Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRightClickSelect, tvoShowButtons, tvoShowLines, tvoToolTips] end end object playlistmenu: TPopupMenu diff --git a/applications/cactusjukebox/source/mainform.pas b/applications/cactusjukebox/source/mainform.pas index bdc349489..b084cd79c 100644 --- a/applications/cactusjukebox/source/mainform.pas +++ b/applications/cactusjukebox/source/mainform.pas @@ -76,6 +76,7 @@ resourcestring rsTrack = 'Track'; type + TCactusViewMode = (cvmLibrary, cvmArtist, cvmDevice, cvmNetwork); TCactusFlags = (cfTrayIconPressed, cfProgHide); @@ -83,8 +84,8 @@ type TMain = class(TForm) ApplicationProperties1: TApplicationProperties; - ArtistTree: TTreeView; artistsearch: TEdit; + ArtistTree: TTreeView; Button1: TButton; Button2: TButton; clear_list: TBitBtn; @@ -98,6 +99,7 @@ type ImageListDis: TImageList; itemPlugins: TMenuItem; lblPath: TLabel; + LibraryModeBtn: TToolButton; Mainmenu1: TMainMenu; MenuItem12: TMenuItem; Menuitem21: TMenuItem; @@ -194,7 +196,7 @@ type srch_button: TButton; StopButtonImg: TImage; ToolBar1: TToolBar; - LibModeBtn: TToolButton; + ArtistsModeBtn: TToolButton; NetModeBtn: TToolButton; DeviceModeBtn: TToolButton; Label2: TLabel; @@ -262,7 +264,8 @@ type Shift: TShiftState; X, Y: integer); procedure itemTrayExitClick(Sender: TObject); procedure itemTrayPlayClick(Sender: TObject); - procedure LibModeBtnClick(Sender: TObject); + procedure ArtistsModeBtnClick(Sender: TObject); + procedure LibraryModeBtnClick(Sender: TObject); procedure MenuItem15Click(Sender: TObject); procedure MenuItem25Click(Sender: TObject); procedure MIrandom_playlistClick(Sender: TObject); @@ -432,7 +435,7 @@ type oldSplitterWidth, LoopCount: integer; sourceitem: TListItem; CoverFound, title_drag, playlist_drag, artist_drag: boolean; - DeviceMode, NetworkMode, LibraryMode: boolean; + ViewMode: TCactusViewMode; LastFMAPI: TLastfmAPIObject; ScanSyncCount: integer; FileOpneDialogPath: string; @@ -465,6 +468,7 @@ type function connectDAP: byte; procedure ScanSyncronize(dir: string); procedure update_artist_view; + procedure update_library_view; { public declarations } @@ -924,8 +928,8 @@ begin Playlist.BeginUpdate; playitem.ImageIndex := 0; Playlist.EndUpdate; - writeln(playitem.ImageIndex); - writeln(playitem.index); + DebugOutLn(Format('ImageIndex=%d', [playitem.ImageIndex]), 0); + DebugOutLn(Format('index=%d', [playitem.index]), 0); playitem.MakeVisible(False); update_player_display; //CactusPlugins.SendEvent(evnStartPlay, PlayerObj.Playlist.Items[PlayerObj.CurrentTrack].artist+' - '+PlayerObj.Playlist.Items[PlayerObj.CurrentTrack].title); @@ -1203,7 +1207,7 @@ var begin TitleTree.Items.Clear; TitleTree.BeginUpdate; - artisttree.selected := nil; + ArtistTree.selected := nil; searchstring := lowercase(searchstr.Text); found := False; for i := 0 to MediaCollection.ItemCount - 1 do @@ -1272,7 +1276,7 @@ end; procedure TMain.ArtistTreeSelectionChanged(Sender: TObject); begin - if not NetworkMode then + if ViewMode <> cvmNetwork then update_title_view; end; @@ -1351,14 +1355,12 @@ end; procedure TMain.DeviceModeBtnClick(Sender: TObject); begin DeviceModeBtn.Down := True; - if not DeviceMode then + if ViewMode <> cvmDevice then begin ArtistTree.Selected := nil; - LibModeBtn.Down := False; + ArtistsModeBtn.Down := False; NetModeBtn.Down := False; - LibraryMode := False; - DeviceMode := True; - NetworkMode := False; + ViewMode := cvmDevice; Playlist.Enabled := True; TitleTree.Enabled := True; trackbar.Enabled := True; @@ -1393,17 +1395,16 @@ end; //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -procedure TMain.LibModeBtnClick(Sender: TObject); +procedure TMain.ArtistsModeBtnClick(Sender: TObject); begin - LibModeBtn.Down := True; - if not LibraryMode then + ArtistsModeBtn.Down := True; + if ViewMode <> cvmArtist then begin ArtistTree.Selected := nil; DeviceModeBtn.Down := False; NetModeBtn.Down := False; - LibraryMode := True; - DeviceMode := False; - NetworkMode := False; + LibraryModeBtn.Down := False; + ViewMode := cvmArtist; Playlist.Enabled := True; TitleTree.Enabled := True; trackbar.Enabled := True; @@ -1411,6 +1412,23 @@ begin end; end; +procedure TMain.LibraryModeBtnClick(Sender: TObject); +begin + LibraryModeBtn.Down := True; + if ViewMode <> cvmLibrary then + begin + ArtistTree.Selected := nil; + DeviceModeBtn.Down := False; + NetModeBtn.Down := False; + ArtistsModeBtn.Down := False; + ViewMode := cvmLibrary; + Playlist.Enabled := False; + TitleTree.Enabled := True; + trackbar.Enabled := True; + update_library_view; + end; +end; + //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ procedure TMain.MenuItem15Click(Sender: TObject); @@ -1622,14 +1640,12 @@ end; procedure TMain.NetModeBtnClick(Sender: TObject); begin NetModeBtn.Down := True; - if not NetworkMode then + if ViewMode <> cvmNetwork then begin ArtistTree.Selected := nil; DeviceModeBtn.down := False; - LibModeBtn.down := False; - LibraryMode := False; - DeviceMode := False; - NetworkMode := True; + ArtistsModeBtn.down := False; + ViewMode := cvmNetwork; Playlist.Enabled := False; TitleTree.Enabled := False; trackbar.Enabled := False; @@ -1870,7 +1886,7 @@ begin except DebugOutLn('ERROR: Exception while shutting down IPC server', 2); end; - writeln('end.'); + DebugOutLn('end.', 0); //CactusPlugins.FlushPluginConfig; //CactusPlugins.Free; if CactusConfig.FlushConfig then @@ -1906,10 +1922,8 @@ begin DebugOutLn('## Main.onCreate ##', 3); Caption := 'Cactus Jukebox ' + CACTUS_VERSION; - LibraryMode := True; - DeviceMode := False; - NetworkMode := False; - LibModeBtn.Down := True; + ViewMode := cvmLibrary; + ArtistsModeBtn.Down := True; DeviceModeBtn.Down := False; NetModeBtn.Down := False; @@ -2352,7 +2366,7 @@ begin Enabled := False; StatusBar1.Panels[0].Text := 'Please wait... updating...'; ArtistTree.OnSelectionChanged := nil; - //Disable event while working on selection in artisttree!! + //Disable event while working on selection in ArtistTree!! DebugOutLn('', 2); DebugOut('## update artist view... ', 2); tsnode := ArtistTree.Selected; @@ -2374,11 +2388,11 @@ begin end else curartist := ''; - artisttree.beginupdate; + ArtistTree.beginupdate; DebugOut(' clear tree...', 2); ArtistTree.Items.Clear; - if NetworkMode then + if ViewMode = cvmNetwork then begin TopNode := ArtistTree.Items.Add(nil, 'Webradio stations'); @@ -2396,7 +2410,7 @@ begin end; end; // If library mode add Mediacollection - if LibraryMode and (MediaCollection.Count > 0) then + if (ViewMode = cvmLibrary) and (MediaCollection.Count > 0) then begin TopNode := Main.ArtistTree.Items.Add(nil, rsLibrary); TopNode.ImageIndex := 4; @@ -2443,7 +2457,7 @@ begin end; // If Device mode add playercollection and other devices - if DeviceMode and player_connected then + if (ViewMode = cvmDevice) and player_connected then begin TopNode := Main.ArtistTree.Items.Add(nil, rsMobileDevice); @@ -2499,12 +2513,12 @@ begin MedFileObj := TMediaFileClass(ArtistTree.items[i].Data); Inc(i); end; - until ((lowercase(artisttree.items[i].Text) = curalbum) and - (ArtistTree.Items[i].Level = 2)) or (i >= artisttree.items.Count - 1); + until ((lowercase(ArtistTree.items[i].Text) = curalbum) and + (ArtistTree.Items[i].Level = 2)) or (i >= ArtistTree.items.Count - 1); - if lowercase(artisttree.items[i].Text) = curalbum then + if lowercase(ArtistTree.items[i].Text) = curalbum then begin - artisttree.selected := main.artisttree.items[i]; + ArtistTree.selected := main.artisttree.items[i]; end else if (curartist <> '') and (ArtistTree.Items.Count > 0) then @@ -2515,13 +2529,13 @@ begin MedFileObj := TMediaFileClass(ArtistTree.items[i].Data); Inc(i); end; - until ((lowercase(artisttree.items[i].Text) = curartist) and - (ArtistTree.Items[i].Level = 1)) or (i >= artisttree.items.Count - 1); + until ((lowercase(ArtistTree.items[i].Text) = curartist) and + (ArtistTree.Items[i].Level = 1)) or (i >= ArtistTree.items.Count - 1); writeln(curartist); - writeln(artisttree.items[i].Text); - if lowercase(artisttree.items[i].Text) = curartist then + writeln(ArtistTree.items[i].Text); + if lowercase(ArtistTree.items[i].Text) = curartist then begin - artisttree.selected := main.artisttree.items[i]; + ArtistTree.selected := main.artisttree.items[i]; end; end; @@ -2547,6 +2561,11 @@ begin end; +procedure TMain.update_library_view; +begin + +end; + //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ procedure TMain.MenuItem11Click(Sender: TObject); @@ -3560,7 +3579,7 @@ var ind: integer; MedFileObj: TMediaFileClass; begin - if not NetworkMode then + if ViewMode <> cvmNetwork then begin DebugOutLn('ondragdrop', 3); Targetitem := nil; @@ -3690,8 +3709,7 @@ var tempitem: TListItem; i: integer; begin - DebugOutLn('Playlist keypress event: Keycode ', 2); - writeln(key); + DebugOutLn(Format('Playlist keypress event: Keycode = %x', [Key]), 2); case key of // Key Ctrl @@ -3864,13 +3882,13 @@ procedure TMain.ArtistTreeDblClick(Sender: TObject); var StreamInfoObj: TStreamInfoItemClass; begin - if LibraryMode or DeviceMode then + if ViewMode in [cvmLibrary, cvmDevice] then begin if (ArtistTree.Selected <> nil) and (ArtistTree.Selected.Level > 0) then artist_to_playlist; end; - if NetworkMode then + if ViewMode = cvmNetwork then begin if (ArtistTree.Selected <> nil) and (ArtistTree.Selected.Level > 0) then begin @@ -3980,7 +3998,7 @@ begin // ensure that the popup menu is only opened when an item is selected if Button = mbRight then begin - if NetworkMode then + if ViewMode = cvmNetwork then ArtistTree.PopupMenu := NetworktreePopup else ArtistTree.PopupMenu := artisttreemenu; diff --git a/applications/cactusjukebox/source/mediacol.pas b/applications/cactusjukebox/source/mediacol.pas index 09463b6df..4b251a205 100644 --- a/applications/cactusjukebox/source/mediacol.pas +++ b/applications/cactusjukebox/source/mediacol.pas @@ -18,9 +18,10 @@ Unit mediacol; Interface Uses -Classes, SysUtils, -//Tagreader: -WMAfile, OggVorbis, FLACfile, mp3file, debug, LCLProc, lconvencoding, guesstag; + Classes, SysUtils, + //Tagreader: + WMAfile, OggVorbis, FLACfile, mp3file, debug, LCLProc, lconvencoding, + guesstag; Type // PMediaCollectionClass = ^TMediaCollectionClass; @@ -292,7 +293,7 @@ Begin readln(lfile, tmps); NumEntries := StrToInt(tmps); - writeln(NumEntries); + DebugOutLn('[TMediaCollectionClass.LoadFromFile] NumEntries='+tmps, 0); readln(lfile, tmps); If tmps[length(tmps)]=';' Then System.Delete(tmps, length(tmps), 1); i := pos(';', tmps); @@ -351,7 +352,7 @@ Begin fsorted := sortState; AutoEnum := true; close(lfile); - writeln('library sucessfully loaded'); + DebugOutLn('library sucessfully loaded', 0); result := true; Except close(lfile); @@ -373,7 +374,7 @@ Var lfile: textfile; tmps: string; Begin savepath := path; - writeln('saving library to -> '+path); + DebugOutLn('saving library to -> '+path, 0); Try system.assign(lfile,path); rewrite(lfile); @@ -415,16 +416,10 @@ Begin writeln(lfile,items[i].playtime); End; close(lfile); - write('written '); - write(i); - write(' of '); - writeln(ItemCount); + DebugOutLn(Format('written %d of %d', [i, ItemCount]), 0); Except - writeln('error writing library to disk: check permissions!'); - write('written '); - write(i); - write(' of '); - writeln(ItemCount); + DebugOutLn('error writing library to disk: check permissions!', 0); + DebugOutLn(Format('written %d of %d', [i, ItemCount]), 0); End; End; diff --git a/applications/cactusjukebox/source/mplayer.pas b/applications/cactusjukebox/source/mplayer.pas index f6a39fdd9..c22301cf5 100644 --- a/applications/cactusjukebox/source/mplayer.pas +++ b/applications/cactusjukebox/source/mplayer.pas @@ -185,7 +185,7 @@ begin {$endif} if Result='' then begin - writeln('FATAL: Mplayer executable not found. Make sure it is properly installed in binary path'); + DebugOutLn('FATAL: Mplayer executable not found. Make sure it is properly installed in binary path', 0); end else DebugOutLn('Mplayer executable found in '+Result, 2); end; @@ -514,7 +514,7 @@ begin if FileExists(dir+MPLAYER_BINARY) then begin result:=true; FMPlayerPath:=dir+MPLAYER_BINARY; - WriteLn('Manually set MPlayer path to '+FMPlayerPath); + DebugOutLn('Manually set MPlayer path to '+FMPlayerPath, 0); end else begin result:=false; FMPlayerPath:=''; diff --git a/applications/cactusjukebox/source/skin.pas b/applications/cactusjukebox/source/skin.pas index 92dd2b2b1..42fbb1495 100755 --- a/applications/cactusjukebox/source/skin.pas +++ b/applications/cactusjukebox/source/skin.pas @@ -354,16 +354,11 @@ Begin // writeln(skinxml.GetValue('Database/Play/Icon','ss')); - With main Do - Begin - PlayButtonImg.Picture.LoadFromFile(play.Img); - StopButtonImg.Picture.LoadFromFile(stop.Img); - PauseButtonImg.Picture.LoadFromFile(pause.Img); - NextButtonImg.Picture.LoadFromFile(next.Img); - PreviousButtonImg.Picture.LoadFromFile(previous.Img); - End; - - + main.PlayButtonImg.Picture.LoadFromFile(Self.play.Img); + main.StopButtonImg.Picture.LoadFromFile(Self.stop.Img); + main.PauseButtonImg.Picture.LoadFromFile(Self.pause.Img); + main.NextButtonImg.Picture.LoadFromFile(Self.next.Img); + main.PreviousButtonImg.Picture.LoadFromFile(Self.previous.Img); End; diff --git a/applications/cactusjukebox/source/tagreader/mp3file.pas b/applications/cactusjukebox/source/tagreader/mp3file.pas index 494583663..02101cd4f 100644 --- a/applications/cactusjukebox/source/tagreader/mp3file.pas +++ b/applications/cactusjukebox/source/tagreader/mp3file.pas @@ -4,7 +4,7 @@ unit mp3file; interface -uses Classes, SysUtils; +uses Classes, SysUtils, debug; Const ID3Genre: array[0..147] of string[32] = ('', 'Classic Rock', 'Country', 'Dance', @@ -338,8 +338,8 @@ Begin tmps := char(0)+char(0)+char(0)+char(2)+char(0)+char(0)+char(0)+' '; bufstr := bufstr+'TPE1'+tmps+'TIT2'+tmps+'TRCK'+tmps+'TYER'+tmps+'TALB'+tmps+char(0)+ char(0); - writeln('creating new ID3v2 tag!'); - writeln(bufstr); + DebugOutLn('creating new ID3v2 tag!', 0); + DebugOutLn(bufstr, 0); z := length(bufstr)-1; For i:= z To high(buf) Do bufstr := bufstr+char(0); @@ -475,10 +475,10 @@ Begin filewrite(mp3filehandle,buf,high(buf)); fileclose(mp3filehandle); End - Else writeln('ERROR: cant write tag. file not found'); + Else DebugOutLn('ERROR: cant write tag. file not found', 0); End; {id3v1} - writeln('#####ID3V1#######'); + DebugOutLn('#####ID3V1#######', 0); For i:=1 To 128 Do buf[i] := 0; buf[1] := 84; @@ -519,7 +519,7 @@ Begin mp3filehandle := fileopen(Filename,fmOpenWrite); If mp3filehandle<>-1 Then Begin - If FileGetAttr(Filename)=faReadOnly Then writeln('file is read only'); + If FileGetAttr(Filename)=faReadOnly Then DebugOutLn('file is read only', 0); fileseek(mp3filehandle,-128,fsfromend); writeln(ftitle); writeln(fartist);