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
This commit is contained in:
sekelsenmat
2011-11-10 13:17:45 +00:00
parent cf4e4f1a7e
commit 25158322fd
10 changed files with 230 additions and 159 deletions

View File

@@ -18,14 +18,58 @@
<AutoIncrementBuild Value="True"/> <AutoIncrementBuild Value="True"/>
<MinorVersionNr Value="3"/> <MinorVersionNr Value="3"/>
<RevisionNr Value="5"/> <RevisionNr Value="5"/>
<BuildNr Value="750"/> <BuildNr Value="753"/>
<StringTable ProductVersion="0.3.5.737"/> <StringTable ProductVersion="0.3.5.737"/>
</VersionInfo> </VersionInfo>
<BuildModes Count="2"> <BuildModes Count="3">
<Item1 Name="Debug" Default="True"/> <Item1 Name="Debug" Default="True"/>
<Item2 Name="Release"> <Item2 Name="Debug verbose">
<CompilerOptions> <CompilerOptions>
<Version Value="10"/> <Version Value="11"/>
<Target>
<Filename Value="../cactus_jukebox"/>
</Target>
<SearchPaths>
<OtherUnitFiles Value="fmodintf;tagreader;plugin/sdk;plugin/impl"/>
<UnitOutputDirectory Value="../source/obj"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<CStyleOperator Value="False"/>
<AllowLabel Value="False"/>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
<Optimizations>
<OptimizationLevel Value="0"/>
</Optimizations>
</CodeGeneration>
<Linking>
<LinkSmart Value="True"/>
</Linking>
<Other>
<Verbosity>
<ShowHintsForUnusedUnitsInMainSrc Value="True"/>
</Verbosity>
<WriteFPCLogo Value="False"/>
<CompilerMessages>
<UseMsgFile Value="True"/>
</CompilerMessages>
<CustomOptions Value="-dCactusDebug -dCactusDebugVerbose"/>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</Item2>
<Item3 Name="Release">
<CompilerOptions>
<Version Value="11"/>
<Target> <Target>
<Filename Value="../cactus_jukebox"/> <Filename Value="../cactus_jukebox"/>
</Target> </Target>
@@ -53,7 +97,7 @@
</CodeGeneration> </CodeGeneration>
<Linking> <Linking>
<Debugging> <Debugging>
<DebugInfoType Value="dsAuto"/> <GenerateDebugInfo Value="False"/>
</Debugging> </Debugging>
<LinkSmart Value="True"/> <LinkSmart Value="True"/>
<Options> <Options>
@@ -73,7 +117,7 @@
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
</Other> </Other>
</CompilerOptions> </CompilerOptions>
</Item2> </Item3>
</BuildModes> </BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
@@ -299,7 +343,7 @@
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="10"/> <Version Value="11"/>
<Target> <Target>
<Filename Value="../cactus_jukebox"/> <Filename Value="../cactus_jukebox"/>
</Target> </Target>
@@ -326,11 +370,12 @@
</Optimizations> </Optimizations>
</CodeGeneration> </CodeGeneration>
<Linking> <Linking>
<Debugging>
<GenerateDebugInfo Value="True"/>
<DebugInfoType Value="dsAuto"/>
</Debugging>
<LinkSmart Value="True"/> <LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking> </Linking>
<Other> <Other>
<Verbosity> <Verbosity>

View File

@@ -40,7 +40,15 @@ var
begin begin
Application.Title:='cactus'; Application.Title:='cactus';
{$ifdef CactusDebug} {$ifdef CactusDebug}
CVerbosityLevel:=8; {$ifdef CactusDebugVerbose}
CVerbosityLevel:=8;
{$else}
{$ifdef Windows}
CVerbosityLevel:=0;
{$else}
CVerbosityLevel:=1;
{$endif}
{$endif}
{$else} {$else}
{$ifdef Windows} {$ifdef Windows}
CVerbosityLevel:=0; CVerbosityLevel:=0;

View File

@@ -140,12 +140,12 @@ begin
except except
end; end;
end; end;
writeln('-------------------------------------------------'); DebugOutLn('-------------------------------------------------', 0);
writeln(s); DebugOutLn(s, 0);
writeln(errorcode); DebugOutLn(errorcode, 0);
writeln(s1); DebugOutLn(s1, 0);
writeln(s2); DebugOutLn(s2, 0);
writeln('-------------------------------------------------'); DebugOutLn('-------------------------------------------------', 0);
end; end;
if (ErrorCode=200) and query_send then begin if (ErrorCode=200) and query_send then begin
@@ -154,7 +154,7 @@ begin
delete(s, 1, pos(' ', s)); delete(s, 1, pos(' ', s));
s1:=copy(s, 1, pos(' ',s)); s1:=copy(s, 1, pos(' ',s));
Connection.SendMessage('cddb read '+tmp+' '+s1+' '+#13+#10); Connection.SendMessage('cddb read '+tmp+' '+s1+' '+#13+#10);
writeln('cddb read ',tmp,' ',s1,' '); DebugOutLn('cddb read '+tmp+' '+s1+' ', 0);
end; end;
if (ErrorCode=211) and query_send then begin if (ErrorCode=211) and query_send then begin
@@ -164,13 +164,13 @@ begin
delete(s, 1, pos(' ', s)); delete(s, 1, pos(' ', s));
s1:=copy(s, 1, pos(' ',s)); s1:=copy(s, 1, pos(' ',s));
Connection.SendMessage('cddb read '+tmp+' '+s1+' '+#10+#13); Connection.SendMessage('cddb read '+tmp+' '+s1+' '+#10+#13);
writeln('cddb read ',tmp,' ',s1,' '); DebugOutLn('cddb read '+tmp+' '+s1+' ', 0);
end; end;
if (ErrorCode=200) and (not query_send) then begin if (ErrorCode=200) and (not query_send) then begin
Connection.SendMessage('cddb query '+QueryString+#10+#13); Connection.SendMessage('cddb query '+QueryString+#10+#13);
writeln('cddb query '+QueryString); DebugOutLn('cddb query '+QueryString, 0);
query_send:=true; query_send:=true;
end; end;
@@ -203,7 +203,7 @@ begin
album:=Latin1toUTF8(album); album:=Latin1toUTF8(album);
data_ready:=true; data_ready:=true;
receiving_data := false; receiving_data := false;
writeln('CDDB data ready...'); DebugOutLn('CDDB data ready...', 0);
end; end;
end; end;
@@ -216,15 +216,15 @@ end;
procedure TCddbObject.OnErrorProc(const msg: string; asocket: TLSocket); procedure TCddbObject.OnErrorProc(const msg: string; asocket: TLSocket);
begin begin
ErrorMsg:=msg; ErrorMsg:=msg;
writeln(ErrorMsg); DebugOutLn(ErrorMsg, 0);
end; end;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
procedure TCddbObject.OnDisconnectProc(asocket: TLSocket); procedure TCddbObject.OnDisconnectProc(asocket: TLSocket);
begin begin
writeln('lost connection'); DebugOutLn('[TCddbObject.OnDisconnectProc] lost connection', 0);
end; end;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -232,11 +232,11 @@ end;
procedure TCddbObject.OnConnectProc(asocket: TLSocket); procedure TCddbObject.OnConnectProc(asocket: TLSocket);
var s:string; var s:string;
begin begin
asocket.GetMessage(s); asocket.GetMessage(s);
writeln(s); DebugOutLn(s, 0);
Connection.CallAction; Connection.CallAction;
writeln('connected to cddb server, sending hello...'); DebugOutLn('connected to cddb server, sending hello...', 0);
asocket.SendMessage('cddb hello '+FUser+' '+FHostname+' '+FSoftware+' '+FVersion+#13+#10); asocket.SendMessage('cddb hello '+FUser+' '+FHostname+' '+FSoftware+' '+FVersion+#13+#10);
end; end;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -255,8 +255,8 @@ begin
{$ifdef HAS_CDROM} {$ifdef HAS_CDROM}
discid:=(CDDBDiscID(TOCEntries, NrTracks)); discid:=(CDDBDiscID(TOCEntries, NrTracks));
querystring:=GetCDDBQueryString(TOCEntries, NrTracks); querystring:=GetCDDBQueryString(TOCEntries, NrTracks);
writeln(QueryString); DebugOutLn(QueryString, 0);
writeln(hexStr(discid, 8)); DebugOutLn(hexStr(discid, 8), 0);
{$endif} {$endif}
FServer:=server; FServer:=server;
@@ -369,7 +369,7 @@ begin
{$ifdef HAS_CDROM} {$ifdef HAS_CDROM}
DriveCount:=GetCDRomDevices(CDromDrives); DriveCount:=GetCDRomDevices(CDromDrives);
{$endif} {$endif}
Writeln(DriveCount,' CD-ROM drives autodetected'); DebugOutLn(Format('%d CD-ROM drives autodetected', [DriveCount]), 0);
For b:=1 to DriveCount do For b:=1 to DriveCount do
Writeln('Drive ',b,' on device: ',CDRomDrives[b]); Writeln('Drive ',b,' on device: ',CDRomDrives[b]);
Except Except

View File

@@ -38,7 +38,7 @@ uses
{$IFDEF WINDOWS} {$IFDEF WINDOWS}
Windows, Windows,
{$ENDIF} {$ENDIF}
fmodtypes; fmodtypes, debug;
{ {
Disable warning for unsafe types in Delphi 7 Disable warning for unsafe types in Delphi 7
@@ -586,7 +586,7 @@ begin
{ If no library name given, use the default library names } { If no library name given, use the default library names }
if (LibName = nil) or (LibName='') then if (LibName = nil) or (LibName='') then
LibName := FMOD_DLL; LibName := FMOD_DLL;
writeln('loading'); DebugOutLn('loading', 0);
{ Load the library } { Load the library }
{$IFDEF WINDOWS} {$IFDEF WINDOWS}
FMODHandle := LoadLibrary(LibName); FMODHandle := LoadLibrary(LibName);

View File

@@ -1,7 +1,7 @@
object Main: TMain object Main: TMain
Left = 191 Left = 139
Height = 624 Height = 624
Top = 61 Top = 135
Width = 893 Width = 893
ActiveControl = Panel4 ActiveControl = Panel4
Caption = 'titel' Caption = 'titel'
@@ -1104,37 +1104,6 @@ object Main: TMain
ClientWidth = 288 ClientWidth = 288
TabOrder = 1 TabOrder = 1
OnClick = Panel4Click 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 object ArtistSrchField: TPanel
Left = 152 Left = 152
Height = 64 Height = 64
@@ -1142,7 +1111,7 @@ object Main: TMain
Width = 128 Width = 128
ClientHeight = 64 ClientHeight = 64
ClientWidth = 128 ClientWidth = 128
TabOrder = 1 TabOrder = 0
Visible = False Visible = False
OnClick = ArtistSrchFieldClick OnClick = ArtistSrchFieldClick
object Label2: TLabel object Label2: TLabel
@@ -1223,33 +1192,74 @@ object Main: TMain
EdgeOuter = esNone EdgeOuter = esNone
HotImages = SidebarImgList HotImages = SidebarImgList
Images = SidebarImgList Images = SidebarImgList
TabOrder = 2 TabOrder = 1
Transparent = True Transparent = True
object LibModeBtn: TToolButton object ArtistsModeBtn: TToolButton
Left = 1 Left = 1
Top = 0 Top = 154
AutoSize = True AutoSize = True
Caption = 'Library' Caption = 'Artists'
ImageIndex = 0 ImageIndex = 0
OnClick = LibModeBtnClick OnClick = ArtistsModeBtnClick
Style = tbsCheck Style = tbsCheck
end end
object NetModeBtn: TToolButton object NetModeBtn: TToolButton
Left = 1 Left = 1
Top = 154 Top = 308
Caption = 'NetModeBtn' Caption = 'NetModeBtn'
ImageIndex = 1 ImageIndex = 1
OnClick = NetModeBtnClick OnClick = NetModeBtnClick
Style = tbsCheck Style = tbsCheck
end end
object DeviceModeBtn: TToolButton object DeviceModeBtn: TToolButton
Left = 1 Left = 24
Top = 308 Top = 0
Caption = 'DeviceModeBtn' Caption = 'DeviceModeBtn'
ImageIndex = 2 ImageIndex = 2
OnClick = DeviceModeBtnClick OnClick = DeviceModeBtnClick
Style = tbsCheck Style = tbsCheck
end 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
end end
object playlistmenu: TPopupMenu object playlistmenu: TPopupMenu

View File

@@ -76,6 +76,7 @@ resourcestring
rsTrack = 'Track'; rsTrack = 'Track';
type type
TCactusViewMode = (cvmLibrary, cvmArtist, cvmDevice, cvmNetwork);
TCactusFlags = (cfTrayIconPressed, cfProgHide); TCactusFlags = (cfTrayIconPressed, cfProgHide);
@@ -83,8 +84,8 @@ type
TMain = class(TForm) TMain = class(TForm)
ApplicationProperties1: TApplicationProperties; ApplicationProperties1: TApplicationProperties;
ArtistTree: TTreeView;
artistsearch: TEdit; artistsearch: TEdit;
ArtistTree: TTreeView;
Button1: TButton; Button1: TButton;
Button2: TButton; Button2: TButton;
clear_list: TBitBtn; clear_list: TBitBtn;
@@ -98,6 +99,7 @@ type
ImageListDis: TImageList; ImageListDis: TImageList;
itemPlugins: TMenuItem; itemPlugins: TMenuItem;
lblPath: TLabel; lblPath: TLabel;
LibraryModeBtn: TToolButton;
Mainmenu1: TMainMenu; Mainmenu1: TMainMenu;
MenuItem12: TMenuItem; MenuItem12: TMenuItem;
Menuitem21: TMenuItem; Menuitem21: TMenuItem;
@@ -194,7 +196,7 @@ type
srch_button: TButton; srch_button: TButton;
StopButtonImg: TImage; StopButtonImg: TImage;
ToolBar1: TToolBar; ToolBar1: TToolBar;
LibModeBtn: TToolButton; ArtistsModeBtn: TToolButton;
NetModeBtn: TToolButton; NetModeBtn: TToolButton;
DeviceModeBtn: TToolButton; DeviceModeBtn: TToolButton;
Label2: TLabel; Label2: TLabel;
@@ -262,7 +264,8 @@ type
Shift: TShiftState; X, Y: integer); Shift: TShiftState; X, Y: integer);
procedure itemTrayExitClick(Sender: TObject); procedure itemTrayExitClick(Sender: TObject);
procedure itemTrayPlayClick(Sender: TObject); procedure itemTrayPlayClick(Sender: TObject);
procedure LibModeBtnClick(Sender: TObject); procedure ArtistsModeBtnClick(Sender: TObject);
procedure LibraryModeBtnClick(Sender: TObject);
procedure MenuItem15Click(Sender: TObject); procedure MenuItem15Click(Sender: TObject);
procedure MenuItem25Click(Sender: TObject); procedure MenuItem25Click(Sender: TObject);
procedure MIrandom_playlistClick(Sender: TObject); procedure MIrandom_playlistClick(Sender: TObject);
@@ -432,7 +435,7 @@ type
oldSplitterWidth, LoopCount: integer; oldSplitterWidth, LoopCount: integer;
sourceitem: TListItem; sourceitem: TListItem;
CoverFound, title_drag, playlist_drag, artist_drag: boolean; CoverFound, title_drag, playlist_drag, artist_drag: boolean;
DeviceMode, NetworkMode, LibraryMode: boolean; ViewMode: TCactusViewMode;
LastFMAPI: TLastfmAPIObject; LastFMAPI: TLastfmAPIObject;
ScanSyncCount: integer; ScanSyncCount: integer;
FileOpneDialogPath: string; FileOpneDialogPath: string;
@@ -465,6 +468,7 @@ type
function connectDAP: byte; function connectDAP: byte;
procedure ScanSyncronize(dir: string); procedure ScanSyncronize(dir: string);
procedure update_artist_view; procedure update_artist_view;
procedure update_library_view;
{ public declarations } { public declarations }
@@ -924,8 +928,8 @@ begin
Playlist.BeginUpdate; Playlist.BeginUpdate;
playitem.ImageIndex := 0; playitem.ImageIndex := 0;
Playlist.EndUpdate; Playlist.EndUpdate;
writeln(playitem.ImageIndex); DebugOutLn(Format('ImageIndex=%d', [playitem.ImageIndex]), 0);
writeln(playitem.index); DebugOutLn(Format('index=%d', [playitem.index]), 0);
playitem.MakeVisible(False); playitem.MakeVisible(False);
update_player_display; update_player_display;
//CactusPlugins.SendEvent(evnStartPlay, PlayerObj.Playlist.Items[PlayerObj.CurrentTrack].artist+' - '+PlayerObj.Playlist.Items[PlayerObj.CurrentTrack].title); //CactusPlugins.SendEvent(evnStartPlay, PlayerObj.Playlist.Items[PlayerObj.CurrentTrack].artist+' - '+PlayerObj.Playlist.Items[PlayerObj.CurrentTrack].title);
@@ -1203,7 +1207,7 @@ var
begin begin
TitleTree.Items.Clear; TitleTree.Items.Clear;
TitleTree.BeginUpdate; TitleTree.BeginUpdate;
artisttree.selected := nil; ArtistTree.selected := nil;
searchstring := lowercase(searchstr.Text); searchstring := lowercase(searchstr.Text);
found := False; found := False;
for i := 0 to MediaCollection.ItemCount - 1 do for i := 0 to MediaCollection.ItemCount - 1 do
@@ -1272,7 +1276,7 @@ end;
procedure TMain.ArtistTreeSelectionChanged(Sender: TObject); procedure TMain.ArtistTreeSelectionChanged(Sender: TObject);
begin begin
if not NetworkMode then if ViewMode <> cvmNetwork then
update_title_view; update_title_view;
end; end;
@@ -1351,14 +1355,12 @@ end;
procedure TMain.DeviceModeBtnClick(Sender: TObject); procedure TMain.DeviceModeBtnClick(Sender: TObject);
begin begin
DeviceModeBtn.Down := True; DeviceModeBtn.Down := True;
if not DeviceMode then if ViewMode <> cvmDevice then
begin begin
ArtistTree.Selected := nil; ArtistTree.Selected := nil;
LibModeBtn.Down := False; ArtistsModeBtn.Down := False;
NetModeBtn.Down := False; NetModeBtn.Down := False;
LibraryMode := False; ViewMode := cvmDevice;
DeviceMode := True;
NetworkMode := False;
Playlist.Enabled := True; Playlist.Enabled := True;
TitleTree.Enabled := True; TitleTree.Enabled := True;
trackbar.Enabled := True; trackbar.Enabled := True;
@@ -1393,17 +1395,16 @@ end;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
procedure TMain.LibModeBtnClick(Sender: TObject); procedure TMain.ArtistsModeBtnClick(Sender: TObject);
begin begin
LibModeBtn.Down := True; ArtistsModeBtn.Down := True;
if not LibraryMode then if ViewMode <> cvmArtist then
begin begin
ArtistTree.Selected := nil; ArtistTree.Selected := nil;
DeviceModeBtn.Down := False; DeviceModeBtn.Down := False;
NetModeBtn.Down := False; NetModeBtn.Down := False;
LibraryMode := True; LibraryModeBtn.Down := False;
DeviceMode := False; ViewMode := cvmArtist;
NetworkMode := False;
Playlist.Enabled := True; Playlist.Enabled := True;
TitleTree.Enabled := True; TitleTree.Enabled := True;
trackbar.Enabled := True; trackbar.Enabled := True;
@@ -1411,6 +1412,23 @@ begin
end; end;
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); procedure TMain.MenuItem15Click(Sender: TObject);
@@ -1622,14 +1640,12 @@ end;
procedure TMain.NetModeBtnClick(Sender: TObject); procedure TMain.NetModeBtnClick(Sender: TObject);
begin begin
NetModeBtn.Down := True; NetModeBtn.Down := True;
if not NetworkMode then if ViewMode <> cvmNetwork then
begin begin
ArtistTree.Selected := nil; ArtistTree.Selected := nil;
DeviceModeBtn.down := False; DeviceModeBtn.down := False;
LibModeBtn.down := False; ArtistsModeBtn.down := False;
LibraryMode := False; ViewMode := cvmNetwork;
DeviceMode := False;
NetworkMode := True;
Playlist.Enabled := False; Playlist.Enabled := False;
TitleTree.Enabled := False; TitleTree.Enabled := False;
trackbar.Enabled := False; trackbar.Enabled := False;
@@ -1870,7 +1886,7 @@ begin
except except
DebugOutLn('ERROR: Exception while shutting down IPC server', 2); DebugOutLn('ERROR: Exception while shutting down IPC server', 2);
end; end;
writeln('end.'); DebugOutLn('end.', 0);
//CactusPlugins.FlushPluginConfig; //CactusPlugins.FlushPluginConfig;
//CactusPlugins.Free; //CactusPlugins.Free;
if CactusConfig.FlushConfig then if CactusConfig.FlushConfig then
@@ -1906,10 +1922,8 @@ begin
DebugOutLn('## Main.onCreate ##', 3); DebugOutLn('## Main.onCreate ##', 3);
Caption := 'Cactus Jukebox ' + CACTUS_VERSION; Caption := 'Cactus Jukebox ' + CACTUS_VERSION;
LibraryMode := True; ViewMode := cvmLibrary;
DeviceMode := False; ArtistsModeBtn.Down := True;
NetworkMode := False;
LibModeBtn.Down := True;
DeviceModeBtn.Down := False; DeviceModeBtn.Down := False;
NetModeBtn.Down := False; NetModeBtn.Down := False;
@@ -2352,7 +2366,7 @@ begin
Enabled := False; Enabled := False;
StatusBar1.Panels[0].Text := 'Please wait... updating...'; StatusBar1.Panels[0].Text := 'Please wait... updating...';
ArtistTree.OnSelectionChanged := nil; ArtistTree.OnSelectionChanged := nil;
//Disable event while working on selection in artisttree!! //Disable event while working on selection in ArtistTree!!
DebugOutLn('', 2); DebugOutLn('', 2);
DebugOut('## update artist view... ', 2); DebugOut('## update artist view... ', 2);
tsnode := ArtistTree.Selected; tsnode := ArtistTree.Selected;
@@ -2374,11 +2388,11 @@ begin
end end
else else
curartist := ''; curartist := '';
artisttree.beginupdate; ArtistTree.beginupdate;
DebugOut(' clear tree...', 2); DebugOut(' clear tree...', 2);
ArtistTree.Items.Clear; ArtistTree.Items.Clear;
if NetworkMode then if ViewMode = cvmNetwork then
begin begin
TopNode := ArtistTree.Items.Add(nil, 'Webradio stations'); TopNode := ArtistTree.Items.Add(nil, 'Webradio stations');
@@ -2396,7 +2410,7 @@ begin
end; end;
end; end;
// If library mode add Mediacollection // If library mode add Mediacollection
if LibraryMode and (MediaCollection.Count > 0) then if (ViewMode = cvmLibrary) and (MediaCollection.Count > 0) then
begin begin
TopNode := Main.ArtistTree.Items.Add(nil, rsLibrary); TopNode := Main.ArtistTree.Items.Add(nil, rsLibrary);
TopNode.ImageIndex := 4; TopNode.ImageIndex := 4;
@@ -2443,7 +2457,7 @@ begin
end; end;
// If Device mode add playercollection and other devices // If Device mode add playercollection and other devices
if DeviceMode and player_connected then if (ViewMode = cvmDevice) and player_connected then
begin begin
TopNode := Main.ArtistTree.Items.Add(nil, rsMobileDevice); TopNode := Main.ArtistTree.Items.Add(nil, rsMobileDevice);
@@ -2499,12 +2513,12 @@ begin
MedFileObj := TMediaFileClass(ArtistTree.items[i].Data); MedFileObj := TMediaFileClass(ArtistTree.items[i].Data);
Inc(i); Inc(i);
end; end;
until ((lowercase(artisttree.items[i].Text) = curalbum) and until ((lowercase(ArtistTree.items[i].Text) = curalbum) and
(ArtistTree.Items[i].Level = 2)) or (i >= artisttree.items.Count - 1); (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 begin
artisttree.selected := main.artisttree.items[i]; ArtistTree.selected := main.artisttree.items[i];
end end
else if (curartist <> '') and (ArtistTree.Items.Count > 0) then else if (curartist <> '') and (ArtistTree.Items.Count > 0) then
@@ -2515,13 +2529,13 @@ begin
MedFileObj := TMediaFileClass(ArtistTree.items[i].Data); MedFileObj := TMediaFileClass(ArtistTree.items[i].Data);
Inc(i); Inc(i);
end; end;
until ((lowercase(artisttree.items[i].Text) = curartist) and until ((lowercase(ArtistTree.items[i].Text) = curartist) and
(ArtistTree.Items[i].Level = 1)) or (i >= artisttree.items.Count - 1); (ArtistTree.Items[i].Level = 1)) or (i >= ArtistTree.items.Count - 1);
writeln(curartist); writeln(curartist);
writeln(artisttree.items[i].Text); writeln(ArtistTree.items[i].Text);
if lowercase(artisttree.items[i].Text) = curartist then if lowercase(ArtistTree.items[i].Text) = curartist then
begin begin
artisttree.selected := main.artisttree.items[i]; ArtistTree.selected := main.artisttree.items[i];
end; end;
end; end;
@@ -2547,6 +2561,11 @@ begin
end; end;
procedure TMain.update_library_view;
begin
end;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
procedure TMain.MenuItem11Click(Sender: TObject); procedure TMain.MenuItem11Click(Sender: TObject);
@@ -3560,7 +3579,7 @@ var
ind: integer; ind: integer;
MedFileObj: TMediaFileClass; MedFileObj: TMediaFileClass;
begin begin
if not NetworkMode then if ViewMode <> cvmNetwork then
begin begin
DebugOutLn('ondragdrop', 3); DebugOutLn('ondragdrop', 3);
Targetitem := nil; Targetitem := nil;
@@ -3690,8 +3709,7 @@ var
tempitem: TListItem; tempitem: TListItem;
i: integer; i: integer;
begin begin
DebugOutLn('Playlist keypress event: Keycode ', 2); DebugOutLn(Format('Playlist keypress event: Keycode = %x', [Key]), 2);
writeln(key);
case key of case key of
// Key Ctrl // Key Ctrl
@@ -3864,13 +3882,13 @@ procedure TMain.ArtistTreeDblClick(Sender: TObject);
var var
StreamInfoObj: TStreamInfoItemClass; StreamInfoObj: TStreamInfoItemClass;
begin begin
if LibraryMode or DeviceMode then if ViewMode in [cvmLibrary, cvmDevice] then
begin begin
if (ArtistTree.Selected <> nil) and (ArtistTree.Selected.Level > 0) then if (ArtistTree.Selected <> nil) and (ArtistTree.Selected.Level > 0) then
artist_to_playlist; artist_to_playlist;
end; end;
if NetworkMode then if ViewMode = cvmNetwork then
begin begin
if (ArtistTree.Selected <> nil) and (ArtistTree.Selected.Level > 0) then if (ArtistTree.Selected <> nil) and (ArtistTree.Selected.Level > 0) then
begin begin
@@ -3980,7 +3998,7 @@ begin
// ensure that the popup menu is only opened when an item is selected // ensure that the popup menu is only opened when an item is selected
if Button = mbRight then if Button = mbRight then
begin begin
if NetworkMode then if ViewMode = cvmNetwork then
ArtistTree.PopupMenu := NetworktreePopup ArtistTree.PopupMenu := NetworktreePopup
else else
ArtistTree.PopupMenu := artisttreemenu; ArtistTree.PopupMenu := artisttreemenu;

View File

@@ -18,9 +18,10 @@ Unit mediacol;
Interface Interface
Uses Uses
Classes, SysUtils, Classes, SysUtils,
//Tagreader: //Tagreader:
WMAfile, OggVorbis, FLACfile, mp3file, debug, LCLProc, lconvencoding, guesstag; WMAfile, OggVorbis, FLACfile, mp3file, debug, LCLProc, lconvencoding,
guesstag;
Type Type
// PMediaCollectionClass = ^TMediaCollectionClass; // PMediaCollectionClass = ^TMediaCollectionClass;
@@ -292,7 +293,7 @@ Begin
readln(lfile, tmps); readln(lfile, tmps);
NumEntries := StrToInt(tmps); NumEntries := StrToInt(tmps);
writeln(NumEntries); DebugOutLn('[TMediaCollectionClass.LoadFromFile] NumEntries='+tmps, 0);
readln(lfile, tmps); readln(lfile, tmps);
If tmps[length(tmps)]=';' Then System.Delete(tmps, length(tmps), 1); If tmps[length(tmps)]=';' Then System.Delete(tmps, length(tmps), 1);
i := pos(';', tmps); i := pos(';', tmps);
@@ -351,7 +352,7 @@ Begin
fsorted := sortState; fsorted := sortState;
AutoEnum := true; AutoEnum := true;
close(lfile); close(lfile);
writeln('library sucessfully loaded'); DebugOutLn('library sucessfully loaded', 0);
result := true; result := true;
Except Except
close(lfile); close(lfile);
@@ -373,7 +374,7 @@ Var lfile: textfile;
tmps: string; tmps: string;
Begin Begin
savepath := path; savepath := path;
writeln('saving library to -> '+path); DebugOutLn('saving library to -> '+path, 0);
Try Try
system.assign(lfile,path); system.assign(lfile,path);
rewrite(lfile); rewrite(lfile);
@@ -415,16 +416,10 @@ Begin
writeln(lfile,items[i].playtime); writeln(lfile,items[i].playtime);
End; End;
close(lfile); close(lfile);
write('written '); DebugOutLn(Format('written %d of %d', [i, ItemCount]), 0);
write(i);
write(' of ');
writeln(ItemCount);
Except Except
writeln('error writing library to disk: check permissions!'); DebugOutLn('error writing library to disk: check permissions!', 0);
write('written '); DebugOutLn(Format('written %d of %d', [i, ItemCount]), 0);
write(i);
write(' of ');
writeln(ItemCount);
End; End;
End; End;

View File

@@ -185,7 +185,7 @@ begin
{$endif} {$endif}
if Result='' then if Result='' then
begin 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 end
else DebugOutLn('Mplayer executable found in '+Result, 2); else DebugOutLn('Mplayer executable found in '+Result, 2);
end; end;
@@ -514,7 +514,7 @@ begin
if FileExists(dir+MPLAYER_BINARY) then begin if FileExists(dir+MPLAYER_BINARY) then begin
result:=true; result:=true;
FMPlayerPath:=dir+MPLAYER_BINARY; FMPlayerPath:=dir+MPLAYER_BINARY;
WriteLn('Manually set MPlayer path to '+FMPlayerPath); DebugOutLn('Manually set MPlayer path to '+FMPlayerPath, 0);
end else begin end else begin
result:=false; result:=false;
FMPlayerPath:=''; FMPlayerPath:='';

View File

@@ -354,16 +354,11 @@ Begin
// writeln(skinxml.GetValue('Database/Play/Icon','ss')); // writeln(skinxml.GetValue('Database/Play/Icon','ss'));
With main Do main.PlayButtonImg.Picture.LoadFromFile(Self.play.Img);
Begin main.StopButtonImg.Picture.LoadFromFile(Self.stop.Img);
PlayButtonImg.Picture.LoadFromFile(play.Img); main.PauseButtonImg.Picture.LoadFromFile(Self.pause.Img);
StopButtonImg.Picture.LoadFromFile(stop.Img); main.NextButtonImg.Picture.LoadFromFile(Self.next.Img);
PauseButtonImg.Picture.LoadFromFile(pause.Img); main.PreviousButtonImg.Picture.LoadFromFile(Self.previous.Img);
NextButtonImg.Picture.LoadFromFile(next.Img);
PreviousButtonImg.Picture.LoadFromFile(previous.Img);
End;
End; End;

View File

@@ -4,7 +4,7 @@ unit mp3file;
interface interface
uses Classes, SysUtils; uses Classes, SysUtils, debug;
Const ID3Genre: array[0..147] of string[32] = ('', 'Classic Rock', 'Country', 'Dance', 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)+' '; 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)+ bufstr := bufstr+'TPE1'+tmps+'TIT2'+tmps+'TRCK'+tmps+'TYER'+tmps+'TALB'+tmps+char(0)+
char(0); char(0);
writeln('creating new ID3v2 tag!'); DebugOutLn('creating new ID3v2 tag!', 0);
writeln(bufstr); DebugOutLn(bufstr, 0);
z := length(bufstr)-1; z := length(bufstr)-1;
For i:= z To high(buf) Do For i:= z To high(buf) Do
bufstr := bufstr+char(0); bufstr := bufstr+char(0);
@@ -475,10 +475,10 @@ Begin
filewrite(mp3filehandle,buf,high(buf)); filewrite(mp3filehandle,buf,high(buf));
fileclose(mp3filehandle); fileclose(mp3filehandle);
End End
Else writeln('ERROR: cant write tag. file not found'); Else DebugOutLn('ERROR: cant write tag. file not found', 0);
End; End;
{id3v1} {id3v1}
writeln('#####ID3V1#######'); DebugOutLn('#####ID3V1#######', 0);
For i:=1 To 128 Do For i:=1 To 128 Do
buf[i] := 0; buf[i] := 0;
buf[1] := 84; buf[1] := 84;
@@ -519,7 +519,7 @@ Begin
mp3filehandle := fileopen(Filename,fmOpenWrite); mp3filehandle := fileopen(Filename,fmOpenWrite);
If mp3filehandle<>-1 Then If mp3filehandle<>-1 Then
Begin 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); fileseek(mp3filehandle,-128,fsfromend);
writeln(ftitle); writeln(ftitle);
writeln(fartist); writeln(fartist);