From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 985331384E1 for ; Wed, 16 Jan 2013 12:56:48 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F358E21C001; Wed, 16 Jan 2013 12:56:47 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0C3CD21C001 for ; Wed, 16 Jan 2013 12:56:46 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id DE13533DA49 for ; Wed, 16 Jan 2013 12:56:45 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 88C33E4083 for ; Wed, 16 Jan 2013 12:56:44 +0000 (UTC) From: "Sven Eden" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sven Eden" Message-ID: <1358186939.bba5611120141abef8896f3e1c123db5ab317477.yamakuzure@gentoo> Subject: [gentoo-commits] proj/ufed:master commit in: / X-VCS-Repository: proj/ufed X-VCS-Files: ufed-curses-checklist.c ufed.pl.in X-VCS-Directories: / X-VCS-Committer: yamakuzure X-VCS-Committer-Name: Sven Eden X-VCS-Revision: bba5611120141abef8896f3e1c123db5ab317477 X-VCS-Branch: master Date: Wed, 16 Jan 2013 12:56:44 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 46e5f969-bed9-44ae-b31e-1ac3d1ffa2b6 X-Archives-Hash: 8fe0b7e4b0f6f1225aded8ceb23a33a2 commit: bba5611120141abef8896f3e1c123db5ab317477 Author: Sven Eden gmx de> AuthorDate: Mon Jan 14 18:08:59 2013 +0000 Commit: Sven Eden gmx de> CommitDate: Mon Jan 14 18:08:59 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=bba56111 Send list of (known) masked use flags to the interface. But do not allow to toggle masked flags using mouse or keyboard. --- ufed-curses-checklist.c | 16 +++++++++++++++- ufed.pl.in | 43 ++++++++++++++++++++++++++++++------------- 2 files changed, 45 insertions(+), 14 deletions(-) diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c index 9123388..50dc1b4 100644 --- a/ufed-curses-checklist.c +++ b/ufed-curses-checklist.c @@ -96,6 +96,8 @@ static void read_flags(void) { flag->on = '-'; else if(!strcmp(&line[on.start], "def")) flag->on = ' '; + else if(!strcmp(&line[on.start], "msk")) + flag->on = 'm'; else exit(-1); @@ -173,12 +175,16 @@ static void drawflag(struct item *item, bool highlight) { } wmove(win(List), y, 0); sprintf(buf, " %c%c%c %-*s %-4.4s ", + /* State of selection */ flag->on == ' ' ? '(' : '[', flag->on == ' ' - ? flags->on == ' ' ? flag->state[1] : ' ' + ? flags->on == ' ' + ? flag->state[1] : ' ' : flag->on, flag->on == ' ' ? ')' : ']', + /* distance and name being masked or not */ minwidth-11, flag->name, + /* current selection state */ flag->state); if(d != &flag->descr[flag->item.height]) { for(;;) { @@ -292,6 +298,10 @@ static int callback(struct item **currentitem, int key) { return 1; break; case ' ': { + // do not toggle masked flags using the keyboard + if ('m' == ((struct flag *) *currentitem)->on) + break; + // Not masked? Then cycle through the states. switch (((struct flag *) *currentitem)->on) { case '+': ((struct flag *) *currentitem)->on = '-'; @@ -327,6 +337,10 @@ static int callback(struct item **currentitem, int key) { break; #ifdef NCURSES_MOUSE_VERSION case KEY_MOUSE: + // do not toggle masked flags using the double click + if ('m' == ((struct flag *) *currentitem)->on) + break; + // Not masked? Then cycle through the states. switch (((struct flag *) *currentitem)->on) { case '+': ((struct flag *) *currentitem)->on = '-'; diff --git a/ufed.pl.in b/ufed.pl.in index e7f9673..341cb55 100644 --- a/ufed.pl.in +++ b/ufed.pl.in @@ -12,7 +12,6 @@ use Portage; my $version = 'XX_PACKAGE_VERSION@'; my %use_descriptions; -my %masked_flags; my %masked_descriptions; sub finalise(@); @@ -32,7 +31,7 @@ $Portage::make_conf_flags{'-*'} = 1 for(keys %Portage::all_flags) { @{$use_descriptions{$_}} = "(Unknown)" - if not exists $use_descriptions{$_}; + if not exists $use_descriptions{$_}; } @{$use_descriptions{'-*'}} = 'Never enable any flags other than those specified in make.conf'; @@ -47,8 +46,8 @@ for(keys %Portage::use_masked_flags) { last if not($masked &&= $_); } if($masked) { - $masked_flags{$_} = $Portage::all_flags{$_}; - $masked_descriptions{$_} = $use_descriptions{$_}; + @{$masked_descriptions{$_}} = @{$use_descriptions{$_}} + if (defined($use_descriptions{$_})); delete $Portage::default_flags{$_}; delete $Portage::all_flags{$_}; delete $use_descriptions{$_}; @@ -89,15 +88,33 @@ sub flags_dialog() { POSIX::close $iread; POSIX::close $owrite; if(open my $fh, '>&=', $iwrite) { - my @flags = sort { uc $a cmp uc $b } keys %use_descriptions; - my %descriptions; - for(my $flag=0; $flag<@flags; $flag++) { - my $flag = $flags[$flag]; - print $fh $flag; - print $fh defined $Portage::make_conf_flags{$flag} ? $Portage::make_conf_flags{$flag} ? ' on ' : ' off ' : ' def '; - print $fh exists $Portage::make_defaults_flags{$flag} ? $Portage::make_defaults_flags{$flag} ? '(+' :'(-' :'( ' ; - print $fh exists $Portage::make_conf_flags{$flag} ? $Portage::make_conf_flags{$flag} ? '+)': '-)': ' )'; - print $fh ' ', scalar(@{$use_descriptions{$flag}}), "\n"; + + # Write masked flags first so they sort at the beginning of the list + for my $flag (sort { uc $a cmp uc $b } keys %masked_descriptions) { + print $fh "(" . $flag . ") msk " + . (exists($Portage::make_defaults_flags{$flag}) + ? $Portage::make_defaults_flags{$flag} ? '(+' :'(-' + : '( ') + . (exists($Portage::make_conf_flags{$flag}) + ? $Portage::make_conf_flags{$flag} ? '+)': '-)' + : ' )') + . ' ' . scalar(@{$masked_descriptions{$flag}}) . "\n"; + print $fh $_, "\n" for(@{$masked_descriptions{$flag}}); + } + + # Then write regular flags + for my $flag (sort { uc $a cmp uc $b } keys %use_descriptions) { + print $fh $flag + . (defined($Portage::make_conf_flags{$flag}) + ? $Portage::make_conf_flags{$flag} ? ' on ' : ' off ' + : ' def ' ) + . (exists($Portage::make_defaults_flags{$flag}) + ? $Portage::make_defaults_flags{$flag} ? '(+' :'(-' + : '( ') + . (exists($Portage::make_conf_flags{$flag}) + ? $Portage::make_conf_flags{$flag} ? '+)': '-)' + : ' )') + . ' ' . scalar(@{$use_descriptions{$flag}}) . "\n"; print $fh $_, "\n" for(@{$use_descriptions{$flag}}); } close $fh;