Changeset 844


Ignore:
Timestamp:
Sep 1, 2009, 11:05:47 AM (10 years ago)
Author:
bruno
Message:

Correct interaction with tracks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • projects/CDDBeditor/bin/CDDBeditor

    r843 r844  
    1818use Mail::Sendmail;
    1919use POSIX  qw(strftime :sys_wait_h);
    20 use Newt qw(NEWT_FLAG_WRAP :entry :textbox :macros);
     20use Newt qw(NEWT_FLAG_WRAP NEWT_ENTRY_SCROLL NEWT_ANCHOR_LEFT :entry :textbox :macros);
    2121use lib qw (lib);
    2222use locale;
     
    161161my $dev_label = Newt::Label("Device: ");
    162162my $proxy_label = Newt::Label("Proxy: ");
    163 my $user_label = Newt::Label("Multiple CD proposal: ");
     163my $user_label = Newt::Label("Multi CD: ");
    164164
    165165my $wait_label = Newt::Label("Please wait while searching ...");
     
    211211
    212212my $ce_panel = Newt::Panel(2, 20, "CDDBeditor Configuration");
     213my $flage = NEWT_ANCHOR_LEFT;
    213214$ce_panel->Add(0, 0, $host_label);
    214 $ce_panel->Add(1, 0, $host_entry);
     215$ce_panel->Add(1, 0, $host_entry, $flage);
    215216$ce_panel->Add(0, 1, $port_label);
    216 $ce_panel->Add(1, 1, $port_entry);
     217$ce_panel->Add(1, 1, $port_entry, $flage);
    217218$ce_panel->Add(0, 2, $mode_label);
    218 $ce_panel->Add(1, 2, $mode_group);
     219$ce_panel->Add(1, 2, $mode_group, $flage);
    219220$ce_panel->Add(0, 3, $proxy_label);
    220 $ce_panel->Add(1, 3, $proxy_entry);
     221$ce_panel->Add(1, 3, $proxy_entry, $flage);
    221222$ce_panel->Add(0, 4, $dev_label);
    222 $ce_panel->Add(1, 4, $dev_entry);
     223$ce_panel->Add(1, 4, $dev_entry, $flage);
    223224$ce_panel->Add(0, 5, $user_label);
    224 $ce_panel->Add(1, 5, $user_group);
     225$ce_panel->Add(1, 5, $user_group, $flage);
    225226$ce_panel->Add(0, 6, $next_button);
    226227$ce_panel->Add(1, 6, $quit_button);
    227228
     229Newt::Refresh();
    228230my ($reason, $data) = $ce_panel->Run();
    229 Newt::Refresh();
     231
    230232Newt::Cls();
    231 
    232233exit 0 if ($data->Tag() eq "Quit");
    233234
     
    248249for (my $i=0 ; ; $i++) {
    249250    # Second panel to make user wait
     251    Newt::Cls();
    250252    Newt::DrawRootText(ce_center_string($ce_title), 1, $ce_title);
    251253    Newt::PushHelpLine($ce_help);
    252254    $ce_panel = Newt::Panel(3, 20, "CDDB Search");
    253255    $ce_panel->Add(0, 0, $wait_label);
     256
     257    Newt::Refresh();
    254258    ($reason, $data) = $ce_panel->Draw();
    255259
    256260    # CDDB query
    257261    my %ce_cd = get_cddb(\%ce_config);
    258 
    259     Newt::Refresh();
    260     Newt::Cls();
    261262
    262263    # Third panel to display CD Infos
     
    271272    my $category_entry = Newt::Entry($width, $flag, $ce_cd{cat});
    272273    my $genre_entry = Newt::Entry($width, $flag, $ce_cd{genre});
    273     my $data_entry = Newt::Entry($width, $flag, Dumper($ce_cd{data}));
    274     my $raw_entry = Newt::Entry($width, $flag, Dumper($ce_cd{raw}));
     274    my $data_entry = Newt::Entry($width, $flag, Dumper(@{$ce_cd{data}}));
     275    my $raw_entry = Newt::Entry($width, $flag, Dumper(@{$ce_cd{raw}}));
    275276    my $tno_entry = Newt::Label($ce_cd{tno});
    276     $width = 4;
    277     $flag = 0;
     277    $width = 5;
    278278    my $year_entry = Newt::Entry($width, $flag, $ce_cd{year});
    279279   
     
    281281    $ce_panel = Newt::Panel(3, $ce_sh, "CDDB Info");
    282282    $ce_panel->Add(0, 0, $artist_label);
    283     $ce_panel->Add(1, 0, $artist_entry);
     283    $ce_panel->Add(1, 0, $artist_entry, $flage);
    284284    $ce_panel->Add(0, 1, $title_label);
    285     $ce_panel->Add(1, 1, $title_entry);
     285    $ce_panel->Add(1, 1, $title_entry, $flage);
    286286    $ce_panel->Add(0, 2, $year_label);
    287     $ce_panel->Add(1, 2, $year_entry);
     287    $ce_panel->Add(1, 2, $year_entry, $flage);
    288288    $ce_panel->Add(0, 3, $category_label);
    289     $ce_panel->Add(1, 3, $category_entry);
     289    $ce_panel->Add(1, 3, $category_entry, $flage);
    290290    $ce_panel->Add(0, 4, $genre_label);
    291     $ce_panel->Add(1, 4, $genre_entry);
     291    $ce_panel->Add(1, 4, $genre_entry, $flage);
    292292    $ce_panel->Add(0, 5, $data_label);
    293     $ce_panel->Add(1, 5, $data_entry);
     293    $ce_panel->Add(1, 5, $data_entry, $flage);
    294294    $ce_panel->Add(0, 6, $raw_label);
    295     $ce_panel->Add(1, 6, $raw_entry);
     295    $ce_panel->Add(1, 6, $raw_entry, $flage);
    296296    $ce_panel->Add(0, 7, $tno_label);
    297     $ce_panel->Add(1, 7, $tno_entry);
     297    $ce_panel->Add(1, 7, $tno_entry, $flage);
    298298    #$ce_panel->Add(0, 5, $info_label);
    299     #$ce_panel->Add(1, 5, $info_entry);
     299    #$ce_panel->Add(1, 5, $info_entry, $flage);
    300300
    301301    my $n=1;
     
    311311        my $tr = sprintf "Track %2d:", $n;
    312312        my $track_label = Newt::Label($tr);
    313         $tr = sprintf "%2d':%.2d", $min, $sec;
     313        $tr = sprintf " %2d':%.2d", $min, $sec;
    314314        my $dur_label = Newt::Label($tr);
    315315        $flag = NEWT_FLAG_WRAP|NEWT_ENTRY_SCROLL;
    316         my $track_entry = Newt::Entry($width, $flag, Dumper($ce_cd{track}));
     316        my $track_entry = Newt::Entry($width, $flag, $ce_cd{track}[$n-1]);
    317317        $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);
     318        $ce_panel->Add(1, 8+$n, $track_entry, $flage);
     319        $ce_panel->Add(2, 8+$n, $dur_label, $flage);
    320320        $n++;
    321321    }
     
    325325    $ce_panel->Add(2, 8+$n, $quit_button);
    326326   
     327    Newt::Cls();
     328    Newt::Refresh();
    327329    # Build interface
    328330    ($reason, $data) = $ce_panel->Run();
     
    347349        Newt::PushHelpLine($ce_help);
    348350
     351        Newt::Cls();
    349352        $ce_panel = Newt::Panel(3, $width, "CDDB Sending Infos");
    350353        $ce_panel->Add(0, 0, $wait_label);
    351354        $ce_panel->Add(0, 1, $info_tb);
    352355        $ce_panel->Add(0, 2, $quit_button);
     356        Newt::Refresh();
    353357        ($reason, $data) = $ce_panel->Run();
    354         Newt::Refresh();
    355         Newt::Cls();
    356358    }
    357359}
Note: See TracChangeset for help on using the changeset viewer.