Changeset 843


Ignore:
Timestamp:
Sep 1, 2009, 3:04:48 AM (10 years ago)
Author:
bruno
Message:

Add support for tracks + various fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • projects/CDDBeditor/bin/CDDBeditor

    r840 r843  
    141141my $ce_help = "(c) Bruno Cornec 2009 - All right reversed under the GPL v2";
    142142my $artist_label = Newt::Label("Artist: ");
     143my $data_label = Newt::Label("Data: ");
     144my $raw_label = Newt::Label("Raw: ");
    143145my $title_label = Newt::Label("Title: ");
    144146my $year_label = Newt::Label("Year: ");
     
    148150my $info_label = Newt::Label("Info: ");
    149151my $tr_track_label = Newt::Label("Track");
     152my $tr_frames_label = Newt::Label("Frames");
     153my $tno_label = Newt::Label("Track #:");
    150154my $tr_title_label = Newt::Label("Title");
    151155my $tr_author_label = Newt::Label("Author");
     
    267271    my $category_entry = Newt::Entry($width, $flag, $ce_cd{cat});
    268272    my $genre_entry = Newt::Entry($width, $flag, $ce_cd{genre});
    269     $flag = NEWT_FLAG_WRAP;
    270     my $height = 5;
    271     my $info_entry = Newt::Textbox($width, $height, $flag, "Info");
     273    my $data_entry = Newt::Entry($width, $flag, Dumper($ce_cd{data}));
     274    my $raw_entry = Newt::Entry($width, $flag, Dumper($ce_cd{raw}));
     275    my $tno_entry = Newt::Label($ce_cd{tno});
    272276    $width = 4;
    273277    $flag = 0;
     
    275279   
    276280    # Build interface
    277     $ce_panel = Newt::Panel(3, 20, "CDDB Info");
     281    $ce_panel = Newt::Panel(3, $ce_sh, "CDDB Info");
    278282    $ce_panel->Add(0, 0, $artist_label);
    279283    $ce_panel->Add(1, 0, $artist_entry);
     
    286290    $ce_panel->Add(0, 4, $genre_label);
    287291    $ce_panel->Add(1, 4, $genre_entry);
    288     $ce_panel->Add(0, 5, $info_label);
    289     $ce_panel->Add(1, 5, $info_entry);
    290     $ce_panel->Add(0, 15, $send_button);
    291     $ce_panel->Add(1, 15, $reload_button);
    292     $ce_panel->Add(2, 15, $quit_button);
     292    $ce_panel->Add(0, 5, $data_label);
     293    $ce_panel->Add(1, 5, $data_entry);
     294    $ce_panel->Add(0, 6, $raw_label);
     295    $ce_panel->Add(1, 6, $raw_entry);
     296    $ce_panel->Add(0, 7, $tno_label);
     297    $ce_panel->Add(1, 7, $tno_entry);
     298    #$ce_panel->Add(0, 5, $info_label);
     299    #$ce_panel->Add(1, 5, $info_entry);
     300
     301    my $n=1;
     302    $width = 40;
     303    while ( $n <= $ce_cd{tno} ) {
     304        last if ($n > $ce_sh - 8);
     305        my $from=$ce_cd{frames}[$n-1];
     306        my $to=$ce_cd{frames}[$n]-1;
     307        my $dur=$to-$from;
     308        my $min=int($dur/75/60);
     309        my $sec=int($dur/75)-$min*60;
     310        my $frm=($dur-$sec*75-$min*75*60)*100/75;
     311        my $tr = sprintf "Track %2d:", $n;
     312        my $track_label = Newt::Label($tr);
     313        $tr = sprintf "%2d':%.2d", $min, $sec;
     314        my $dur_label = Newt::Label($tr);
     315        $flag = NEWT_FLAG_WRAP|NEWT_ENTRY_SCROLL;
     316        my $track_entry = Newt::Entry($width, $flag, Dumper($ce_cd{track}));
     317        $ce_panel->Add(0, 8+$n, $track_label);
     318        $ce_panel->Add(1, 8+$n, $dur_label);
     319        $ce_panel->Add(2, 8+$n, $track_entry);
     320        $n++;
     321    }
     322
     323    $ce_panel->Add(0, 8+$n, $send_button);
     324    $ce_panel->Add(1, 8+$n, $reload_button);
     325    $ce_panel->Add(2, 8+$n, $quit_button);
    293326   
    294327    # Build interface
    295328    ($reason, $data) = $ce_panel->Run();
     329
    296330    $ce_cd{artist} = $artist_entry->Get();
    297331    $ce_cd{title} = $title_entry->Get();
     
    307341        $flag = NEWT_FLAG_WRAP;
    308342        $width = 40;
    309         $height = 25;
    310         my $info_tb = Newt::Textbox($width, $height, $flag, Dumper(%ce_cd));
     343        my $height = 25;
     344        my $info_tb = Newt::Textbox($width, $height, $flag, Dumper(keys %ce_cd));
    311345
    312346        Newt::DrawRootText(ce_center_string($ce_title), 1, $ce_title);
Note: See TracChangeset for help on using the changeset viewer.