Changeset 192


Ignore:
Timestamp:
12/25/06 23:45:24 (17 years ago)
Author:
r2d
Message:

added tag writing, but TagLib::FileRef::save() make all crash and I'm too lazy to debug

Location:
winamp-musepack/trunk/winamp-musepack
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • winamp-musepack/trunk/winamp-musepack/in_mpc.cpp

    r191 r192  
    9393void config(HWND hwndParent)
    9494{
    95         MessageBox(hwndParent, "No configuration yet", "Configuration", MB_OK);
     95        MessageBoxA(hwndParent, "No configuration yet", "Configuration", MB_OK);
    9696}
    9797void about(HWND hwndParent)
    9898{
    99         MessageBox(hwndParent,"Musepack plugin for winamp\nAll bugs © Nicolas BOTTI", "Uh ?", MB_OK);
     99        MessageBoxA(hwndParent,"Musepack plugin for winamp\nAll bugs © Nicolas BOTTI", "Uh ?", MB_OK);
    100100}
    101101
  • winamp-musepack/trunk/winamp-musepack/mpc_info.cpp

    r191 r192  
    1 #include "mpc_info.h"
     1/*
     2        Copyright (C) 2006 Nicolas BOTTI <rududu at laposte.net>
     3        This file is part of the Musepack Winamp plugin.
    24
     5        This library is free software; you can redistribute it and/or
     6        modify it under the terms of the GNU Lesser General Public
     7        License as published by the Free Software Foundation; either
     8        version 2.1 of the License, or (at your option) any later version.
     9
     10        This library is distributed in the hope that it will be useful,
     11        but WITHOUT ANY WARRANTY; without even the implied warranty of
     12        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13        Lesser General Public License for more details.
     14
     15        You should have received a copy of the GNU Lesser General Public
     16        License along with this library; if not, write to the Free Software
     17        Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
     18*/
     19
     20#include <windows.h>
     21
     22#include "in2.h"
     23#include "mpc_player.h"
     24
     25namespace winamp_musepack {
     26
     27System::Void mpc_info::btnCancel_Click(System::Object^  sender, System::EventArgs^  e)
     28{
     29        Close();
     30}
     31
     32System::Void mpc_info::btnReload_Click(System::Object^  sender, System::EventArgs^  e)
     33{
     34        player->loadTags(this);
     35}
     36
     37System::Void mpc_info::btnUpdate_Click(System::Object^  sender, System::EventArgs^  e)
     38{
     39        player->writeTags(this);
     40        Close();
     41}
     42
     43}
     44
  • winamp-musepack/trunk/winamp-musepack/mpc_info.h

    r191 r192  
     1/*
     2        Copyright (C) 2006 Nicolas BOTTI <rududu at laposte.net>
     3        This file is part of the Musepack Winamp plugin.
     4
     5        This library is free software; you can redistribute it and/or
     6        modify it under the terms of the GNU Lesser General Public
     7        License as published by the Free Software Foundation; either
     8        version 2.1 of the License, or (at your option) any later version.
     9
     10        This library is distributed in the hope that it will be useful,
     11        but WITHOUT ANY WARRANTY; without even the implied warranty of
     12        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13        Lesser General Public License for more details.
     14
     15        You should have received a copy of the GNU Lesser General Public
     16        License along with this library; if not, write to the Free Software
     17        Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
     18*/
     19
    120#pragma once
    221
     
    827using namespace System::Drawing;
    928
     29class mpc_player;
    1030
    1131namespace winamp_musepack {
     
    2343        {
    2444        public:
    25                 mpc_info(void)
     45                mpc_info(mpc_player * init_player)
    2646                {
    2747                        InitializeComponent();
    28                         //
    29                         //TODO: Add the constructor code here
    30                         //
     48                        player = init_player;
    3149                }
    3250
     
    4260                        }
    4361                }
    44         private: System::Windows::Forms::GroupBox^  groupBox1;
    45         public: System::Windows::Forms::TextBox^  txtTrack;
    46         private:
    47 
    48         protected:
    49 
    50         private: System::Windows::Forms::Label^  label5;
    51         public: System::Windows::Forms::TextBox^  txtYear;
    52         private:
    53 
    54 
    55         private: System::Windows::Forms::Label^  label4;
    56         public: System::Windows::Forms::TextBox^  txtAlbum;
    57         private:
    58 
    59 
    60         private: System::Windows::Forms::Label^  label3;
    61         public: System::Windows::Forms::TextBox^  txtArtist;
    62         private:
    63 
    64 
    65         private: System::Windows::Forms::Label^  label2;
    66         public: System::Windows::Forms::TextBox^  txtTitle;
    67         private:
    68 
    69 
    70         private: System::Windows::Forms::Label^  label1;
    71         private: System::Windows::Forms::GroupBox^  groupBox2;
    72         public: System::Windows::Forms::TextBox^  txtComment;
    73         private:
    74 
    75 
    76         private: System::Windows::Forms::Label^  label6;
    77         private: System::Windows::Forms::Label^  label7;
    78         public: System::Windows::Forms::ComboBox^  comboGenre;
    79         private:
    80         public: System::Windows::Forms::Label^  lblStreamInfo;
     62        private:
     63        System::Windows::Forms::GroupBox^  groupBox1;
     64        System::Windows::Forms::Label^  label5;
     65        System::Windows::Forms::Label^  label4;
     66        System::Windows::Forms::Label^  label3;
     67        System::Windows::Forms::Label^  label2;
     68        System::Windows::Forms::Label^  label1;
     69        System::Windows::Forms::GroupBox^  groupBox2;
     70        System::Windows::Forms::Label^  label6;
     71        System::Windows::Forms::Label^  label7;
     72
     73
     74
     75
     76        mpc_player * player;
     77                         
     78        public:
     79        System::Windows::Forms::TextBox^  txtTrack;
     80        System::Windows::Forms::TextBox^  txtYear;
     81        System::Windows::Forms::TextBox^  txtAlbum;
     82        System::Windows::Forms::TextBox^  txtArtist;
     83        System::Windows::Forms::TextBox^  txtTitle;
     84        System::Windows::Forms::TextBox^  txtComment;
     85        System::Windows::Forms::ComboBox^  comboGenre;
     86        System::Windows::Forms::Label^  lblStreamInfo;
     87        private: System::Windows::Forms::Button^  btnUpdate;
     88        public:
     89        private: System::Windows::Forms::Button^  btnCancel;
    8190        private: System::Windows::Forms::Button^  btnReload;
    82         public:
    83 
    84         private: System::Windows::Forms::Button^  btnCancel;
    85         public:
    86 
    87         private: System::Windows::Forms::Button^  btnUpdate;
    88 
    89 
    90 
    91 
    9291
    9392        private:
     
    105104                {
    106105                        this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
     106                        this->btnUpdate = (gcnew System::Windows::Forms::Button());
     107                        this->btnCancel = (gcnew System::Windows::Forms::Button());
     108                        this->btnReload = (gcnew System::Windows::Forms::Button());
    107109                        this->label7 = (gcnew System::Windows::Forms::Label());
    108110                        this->comboGenre = (gcnew System::Windows::Forms::ComboBox());
     
    121123                        this->groupBox2 = (gcnew System::Windows::Forms::GroupBox());
    122124                        this->lblStreamInfo = (gcnew System::Windows::Forms::Label());
    123                         this->btnReload = (gcnew System::Windows::Forms::Button());
    124                         this->btnCancel = (gcnew System::Windows::Forms::Button());
    125                         this->btnUpdate = (gcnew System::Windows::Forms::Button());
    126125                        this->groupBox1->SuspendLayout();
    127126                        this->groupBox2->SuspendLayout();
     
    130129                        // groupBox1
    131130                        //
     131                        this->groupBox1->Controls->Add(this->btnUpdate);
     132                        this->groupBox1->Controls->Add(this->btnCancel);
     133                        this->groupBox1->Controls->Add(this->btnReload);
    132134                        this->groupBox1->Controls->Add(this->label7);
    133135                        this->groupBox1->Controls->Add(this->comboGenre);
     
    146148                        this->groupBox1->Location = System::Drawing::Point(12, 12);
    147149                        this->groupBox1->Name = L"groupBox1";
    148                         this->groupBox1->Size = System::Drawing::Size(354, 183);
     150                        this->groupBox1->Size = System::Drawing::Size(354, 212);
    149151                        this->groupBox1->TabIndex = 0;
    150152                        this->groupBox1->TabStop = false;
    151                         this->groupBox1->Text = L"Tag information";
     153                        this->groupBox1->Text = L"Tag";
     154                        //
     155                        // btnUpdate
     156                        //
     157                        this->btnUpdate->Location = System::Drawing::Point(6, 183);
     158                        this->btnUpdate->Name = L"btnUpdate";
     159                        this->btnUpdate->Size = System::Drawing::Size(84, 23);
     160                        this->btnUpdate->TabIndex = 16;
     161                        this->btnUpdate->Text = L"Update";
     162                        this->btnUpdate->UseVisualStyleBackColor = true;
     163                        this->btnUpdate->Click += gcnew System::EventHandler(this, &mpc_info::btnUpdate_Click);
     164                        //
     165                        // btnCancel
     166                        //
     167                        this->btnCancel->Location = System::Drawing::Point(135, 183);
     168                        this->btnCancel->Name = L"btnCancel";
     169                        this->btnCancel->Size = System::Drawing::Size(84, 23);
     170                        this->btnCancel->TabIndex = 15;
     171                        this->btnCancel->Text = L"Cancel";
     172                        this->btnCancel->UseVisualStyleBackColor = true;
     173                        this->btnCancel->Click += gcnew System::EventHandler(this, &mpc_info::btnCancel_Click);
     174                        //
     175                        // btnReload
     176                        //
     177                        this->btnReload->Location = System::Drawing::Point(264, 183);
     178                        this->btnReload->Name = L"btnReload";
     179                        this->btnReload->Size = System::Drawing::Size(84, 23);
     180                        this->btnReload->TabIndex = 14;
     181                        this->btnReload->Text = L"Reload";
     182                        this->btnReload->UseVisualStyleBackColor = true;
     183                        this->btnReload->Click += gcnew System::EventHandler(this, &mpc_info::btnReload_Click);
    152184                        //
    153185                        // label7
     
    280312                        this->groupBox2->TabIndex = 1;
    281313                        this->groupBox2->TabStop = false;
    282                         this->groupBox2->Text = L"Stream information";
     314                        this->groupBox2->Text = L"Stream";
    283315                        //
    284316                        // lblStreamInfo
     
    291323                        this->lblStreamInfo->Text = L"lblStreamInfo";
    292324                        //
    293                         // btnReload
    294                         //
    295                         this->btnReload->Location = System::Drawing::Point(282, 201);
    296                         this->btnReload->Name = L"btnReload";
    297                         this->btnReload->Size = System::Drawing::Size(84, 23);
    298                         this->btnReload->TabIndex = 2;
    299                         this->btnReload->Text = L"Reload";
    300                         this->btnReload->UseVisualStyleBackColor = true;
    301                         //
    302                         // btnCancel
    303                         //
    304                         this->btnCancel->Location = System::Drawing::Point(147, 201);
    305                         this->btnCancel->Name = L"btnCancel";
    306                         this->btnCancel->Size = System::Drawing::Size(84, 23);
    307                         this->btnCancel->TabIndex = 3;
    308                         this->btnCancel->Text = L"Cancel";
    309                         this->btnCancel->UseVisualStyleBackColor = true;
    310                         this->btnCancel->Click += gcnew System::EventHandler(this, &mpc_info::btnCancel_Click);
    311                         //
    312                         // btnUpdate
    313                         //
    314                         this->btnUpdate->Location = System::Drawing::Point(12, 201);
    315                         this->btnUpdate->Name = L"btnUpdate";
    316                         this->btnUpdate->Size = System::Drawing::Size(84, 23);
    317                         this->btnUpdate->TabIndex = 4;
    318                         this->btnUpdate->Text = L"Update";
    319                         this->btnUpdate->UseVisualStyleBackColor = true;
    320                         //
    321325                        // mpc_info
    322326                        //
     
    324328                        this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
    325329                        this->ClientSize = System::Drawing::Size(534, 237);
    326                         this->Controls->Add(this->btnUpdate);
    327                         this->Controls->Add(this->btnCancel);
    328                         this->Controls->Add(this->btnReload);
    329330                        this->Controls->Add(this->groupBox2);
    330331                        this->Controls->Add(this->groupBox1);
     
    338339                }
    339340#pragma endregion
    340 private: System::Void btnCancel_Click(System::Object^  sender, System::EventArgs^  e) {
    341                          Close();
    342                  }
     341
     342        private :
     343        System::Void btnCancel_Click(System::Object^  sender, System::EventArgs^  e);
     344        System::Void btnReload_Click(System::Object^  sender, System::EventArgs^  e);
     345        System::Void btnUpdate_Click(System::Object^  sender, System::EventArgs^  e);
    343346};
    344347}
  • winamp-musepack/trunk/winamp-musepack/mpc_player.cpp

    r191 r192  
    2727
    2828#include <tag.h>
    29 
    30 using namespace winamp_musepack;
     29#include <vcclr.h>
     30
    3131
    3232mpc_player::mpc_player(In_Module * in_mod)
     
    271271}
    272272
     273void mpc_player::loadTags(mpc_info ^ infoBox)
     274{
     275        if(tag_file == 0)
     276                tag_file = new TagLib::FileRef(lastfn, false);
     277
     278        if (!tag_file->isNull() && tag_file->tag()) {
     279                TagLib::Tag *tag = tag_file->tag();
     280                infoBox->txtTitle->Text = gcnew String(tag->title().toCString(true));
     281                infoBox->txtArtist->Text = gcnew String(tag->artist().toCString(true));
     282                infoBox->txtAlbum->Text = gcnew String(tag->album().toCString(true));
     283                infoBox->txtYear->Text = "";
     284                infoBox->txtYear->Text += tag->year();
     285                infoBox->txtTrack->Text = "";
     286                infoBox->txtTrack->Text += tag->track();
     287                infoBox->comboGenre->Text = gcnew String(tag->genre().toCString(true));
     288                infoBox->txtComment->Text = gcnew String(tag->comment().toCString(true));
     289        }
     290}
     291
     292void mpc_player::writeTags(mpc_info ^ infoBox)
     293{
     294        if (!tag_file->isNull() && tag_file->tag()) {
     295                TagLib::Tag *tag = tag_file->tag();
     296
     297                pin_ptr<const wchar_t> wch = PtrToStringChars(infoBox->txtTitle->Text);
     298                tag->setTitle(wch);
     299
     300                wch = PtrToStringChars(infoBox->txtArtist->Text);
     301                tag->setArtist(wch);
     302
     303                wch = PtrToStringChars(infoBox->txtAlbum->Text);
     304                tag->setAlbum(wch);
     305
     306                wch = PtrToStringChars(infoBox->txtYear->Text);
     307                TagLib::String year(wch);
     308                tag->setYear(year.toInt());
     309
     310                wch = PtrToStringChars(infoBox->txtTrack->Text);
     311                TagLib::String track(wch);
     312                tag->setTrack(track.toInt());
     313
     314                wch = PtrToStringChars(infoBox->comboGenre->Text);
     315                tag->setGenre(wch);
     316
     317                wch = PtrToStringChars(infoBox->txtComment->Text);
     318                tag->setComment(wch);
     319
     320                tag_file->save(); // FIXME : make all crash
     321        }
     322}
     323
    273324int mpc_player::infoDlg(HWND hwnd)
    274325{
    275         mpc_info infoBox;
     326        mpc_info infoBox(this);
    276327        System::String ^ tmp;
    277328
     
    299350        infoBox.lblStreamInfo->Text = tmp;
    300351
    301 
    302         if(tag_file == 0)
    303                 tag_file = new TagLib::FileRef(lastfn, false);
    304 
    305         if (!tag_file->isNull() && tag_file->tag()) {
    306                 TagLib::Tag *tag = tag_file->tag();
    307                 infoBox.txtTitle->Text = gcnew String(tag->title().toCString(true));
    308                 infoBox.txtArtist->Text = gcnew String(tag->artist().toCString(true));
    309                 infoBox.txtAlbum->Text = gcnew String(tag->album().toCString(true));
    310                 infoBox.txtYear->Text += tag->year();
    311                 infoBox.txtTrack->Text += tag->track();
    312                 infoBox.comboGenre->Text = gcnew String(tag->genre().toCString(true));
    313                 infoBox.txtComment->Text = gcnew String(tag->comment().toCString(true));
    314         }
     352        loadTags(% infoBox);
    315353
    316354        infoBox.ShowDialog();
  • winamp-musepack/trunk/winamp-musepack/mpc_player.h

    r191 r192  
    2222#include <mpcdec/mpcdec.h>
    2323#include <fileref.h>
     24#include "mpc_info.h"
     25
     26using namespace winamp_musepack;
    2427
    2528// post this to the main window at end of file (after playback as stopped)
     
    4447
    4548        int infoDlg(HWND hwnd);
     49        void loadTags(mpc_info ^ infoBox);
     50        void writeTags(mpc_info ^ infoBox);
    4651
    4752        int paused;                             // are we paused?
  • winamp-musepack/trunk/winamp-musepack/winamp-musepack.vcproj

    r191 r192  
    9494                        IntermediateDirectory="$(ConfigurationName)"
    9595                        ConfigurationType="2"
     96                        ManagedExtensions="1"
    9697                        >
    9798                        <Tool
     
    113114                                Name="VCCLCompilerTool"
    114115                                AdditionalIncludeDirectories="..\..\libmpc\include;C:\Program Files\taglib\include\taglib"
    115                                 PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE"
     116                                PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32"
    116117                                RuntimeLibrary="2"
    117118                                WarningLevel="1"
     
    217218                                                BasicRuntimeChecks="0"
    218219                                                UsePrecompiledHeader="0"
    219                                                 DebugInformationFormat="3"
     220                                        />
     221                                </FileConfiguration>
     222                        </File>
     223                        <File
     224                                RelativePath=".\mpc_player.cpp"
     225                                >
     226                                <FileConfiguration
     227                                        Name="Debug|Win32"
     228                                        >
     229                                        <Tool
     230                                                Name="VCCLCompilerTool"
     231                                                ExceptionHandling="2"
    220232                                                CompileAsManaged="1"
    221233                                        />
    222234                                </FileConfiguration>
    223                         </File>
    224                         <File
    225                                 RelativePath=".\mpc_player.cpp"
    226                                 >
    227                                 <FileConfiguration
    228                                         Name="Debug|Win32"
    229                                         >
    230                                         <Tool
    231                                                 Name="VCCLCompilerTool"
    232                                                 ExceptionHandling="2"
    233                                                 CompileAsManaged="1"
    234                                         />
    235                                 </FileConfiguration>
    236235                                <FileConfiguration
    237236                                        Name="Release|Win32"
     
    240239                                                Name="VCCLCompilerTool"
    241240                                                ExceptionHandling="2"
    242                                                 CompileAsManaged="1"
    243241                                        />
    244242                                </FileConfiguration>
Note: See TracChangeset for help on using the changeset viewer.