[yast-commit] r40967 - in /branches/tmp/sh/mod-ui/ncurses/src: ./ pkg/
Author: gs Date: Wed Sep 19 14:10:16 2007 New Revision: 40967 URL: http://svn.opensuse.org/viewcvs/yast?rev=40967&view=rev Log: lot of debug added Modified: branches/tmp/sh/mod-ui/ncurses/src/NCComboBox.cc branches/tmp/sh/mod-ui/ncurses/src/NCDialog.cc branches/tmp/sh/mod-ui/ncurses/src/NCPackageSelectorPlugin.cc branches/tmp/sh/mod-ui/ncurses/src/NCPackageSelectorStart.cc branches/tmp/sh/mod-ui/ncurses/src/NCPopup.cc branches/tmp/sh/mod-ui/ncurses/src/NCPopup.h branches/tmp/sh/mod-ui/ncurses/src/NCPopupList.cc branches/tmp/sh/mod-ui/ncurses/src/NCPopupList.h branches/tmp/sh/mod-ui/ncurses/src/NCPopupTable.cc branches/tmp/sh/mod-ui/ncurses/src/NCPopupTable.h branches/tmp/sh/mod-ui/ncurses/src/NCSelectionBox.cc branches/tmp/sh/mod-ui/ncurses/src/NCSelectionBox.h branches/tmp/sh/mod-ui/ncurses/src/NCTree.cc branches/tmp/sh/mod-ui/ncurses/src/NCTree.h branches/tmp/sh/mod-ui/ncurses/src/NCWidget.cc branches/tmp/sh/mod-ui/ncurses/src/NCWidget.h branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.cc branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupDeps.cc Modified: branches/tmp/sh/mod-ui/ncurses/src/NCComboBox.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCComboBox.cc?rev=40967&r1=40966&r2=40967&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCComboBox.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCComboBox.cc Wed Sep 19 14:10:16 2007 @@ -660,6 +660,8 @@ if (!deflist.empty()) { wpos at( ScreenPos() + wpos( win->height(), -1 ) ); NCPopupList dialog( at, "", deflist, index ); + NCMIL << "Calling createEntries()" << endl; + dialog.createEntries( deflist, index ); int idx = dialog.post(); if ( idx != -1 ) setCurrentItem( idx ); Modified: branches/tmp/sh/mod-ui/ncurses/src/NCDialog.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCDialog.cc?rev=40967&r1=40966&r2=40967&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCDialog.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCDialog.cc Wed Sep 19 14:10:16 2007 @@ -67,6 +67,7 @@ , ncdopts ( DEFAULT ) , popedpos ( -1 ) { + NCMIL << "NCDialog(opt) derived from YDialog(opt)" << endl; _init( opt ); } @@ -88,6 +89,7 @@ , ncdopts ( boxed ? POPUP : POPUP|NOBOX ) , popedpos ( at ) { + NCMIL << "NCDialog(opt, at, boxed) derived from YDialog(opt)" << endl; _init( opt ); } @@ -226,14 +228,14 @@ int NCDialog::preferredHeight() { if ( hasDefaultSize() || !childrenCount() ) { - return wGetDefsze().H; - } + return wGetDefsze().H; + } wsze csze( firstChild()->preferredHeight(), - firstChild()->preferredWidth() ); - csze = wsze::min( wGetDefsze(), - wsze::max( csze, wsze( 1 ) ) ); + firstChild()->preferredWidth() ); + csze = wsze::min( wGetDefsze(), + wsze::max( csze, wsze( 1 ) ) ); - return csze.H; + return csze.H; } /////////////////////////////////////////////////////////////////// @@ -247,6 +249,7 @@ void NCDialog::setSize( int newwidth, int newheight ) { wRelocate( wpos( 0 ), wsze( newheight, newwidth ) ); + NCMIL << "setSize() called" << endl; YDialog::setSize( newwidth, newheight ); } @@ -262,6 +265,7 @@ { NCMIL << "initDialog()" << endl; if ( !pan ) { + NCMIL << "setInitialSize() called!" << endl; setInitialSize(); } } @@ -277,6 +281,7 @@ void NCDialog::showDialog() { NCMIL << "SHOW" << endl; + dumpWidgetTree(); IODBG << "sd+ " << this << endl; if ( pan && pan->hidden() ) { getVisible(); Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPackageSelectorPlugin.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCPackageSelectorPlugin.cc?rev=40967&r1=40966&r2=40967&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCPackageSelectorPlugin.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCPackageSelectorPlugin.cc Wed Sep 19 14:10:16 2007 @@ -133,6 +133,8 @@ { NCPackageSelectorStart * ncSelector = 0; + NCMIL << "Calling runPkgSelection()" << endl; + if ( !dialog ) { UIERR << "ERROR package selection: No dialog existing." << endl; Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPackageSelectorStart.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCPackageSelectorStart.cc?rev=40967&r1=40966&r2=40967&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCPackageSelectorStart.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCPackageSelectorStart.cc Wed Sep 19 14:10:16 2007 @@ -80,10 +80,7 @@ // widgetRoot = (YContainerWidget *)ui->createWidgetTree( dynamic_cast<YWidget *>(parent), // childrenOpt, 0, pkgLayout ); - // FIXME - remove YWidgetOpt() after parseWidgetTreeTerm is ported - YWidgetOpt * opt = new YWidgetOpt(); widgetRoot = YCPDialogParser::parseWidgetTreeTerm( this, - *opt, pkgLayout ); } @@ -188,7 +185,7 @@ if ( pkgList ) { // fill the list with packages (or patches) - pkgList->fillDefaultList( ); + //pkgList->fillDefaultList( ); pkgList->setKeyboardFocus(); Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPopup.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCPopup.cc?rev=40967&r1=40966&r2=40967&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCPopup.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCPopup.cc Wed Sep 19 14:10:16 2007 @@ -34,6 +34,7 @@ NCPopup::NCPopup( const wpos at, const bool boxed ) : NCDialog( wopt, at, boxed ) { + NCMIL << "Constructor NCPopup - creates NCDialog" << endl; } /////////////////////////////////////////////////////////////////// @@ -58,7 +59,9 @@ // void NCPopup::popupDialog() { + NCMIL << "popupDialog calls initDialog()" << endl; initDialog(); + NCMIL << "Call showDialog() " << endl; showDialog(); activate ( true ); while ( !(postevent = userInput()) ) Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPopup.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCPopup.h?rev=40967&r1=40966&r2=40967&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCPopup.h (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCPopup.h Wed Sep 19 14:10:16 2007 @@ -29,7 +29,7 @@ // // DESCRIPTION : // -class NCPopup : protected NCDialog { +class NCPopup : public NCDialog { NCPopup & operator=( const NCPopup & ); NCPopup ( const NCPopup & ); Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPopupList.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCPopupList.cc?rev=40967&r1=40966&r2=40967&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCPopupList.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCPopupList.cc Wed Sep 19 14:10:16 2007 @@ -35,6 +35,9 @@ int index ) : NCPopupTable( at ) { + NCMIL << "Constructor NCPopupList" << endl; + NCMIL << "CurrentDialog: " << dynamic_cast<NCDialog *>(currentDialog()) << endl; +#if 0 vector<string> row( 1 ); createList( row ); for ( list<string>::const_iterator entry = deflist.begin(); @@ -43,6 +46,7 @@ addItem( YCPNull(), row ); } setCurrentItem( index ); +#endif } /////////////////////////////////////////////////////////////////// @@ -55,6 +59,19 @@ // NCPopupList::~NCPopupList() { + +} + +void NCPopupList::createEntries( const list<string> & deflist, int index ) +{ + vector<string> row( 1 ); + createList( row ); + for ( list<string>::const_iterator entry = deflist.begin(); + entry != deflist.end(); ++entry ) { + row[0] = (*entry); + addItem( YCPNull(), row ); + } + setCurrentItem( index ); } /////////////////////////////////////////////////////////////////// @@ -69,3 +86,4 @@ { return NCPopupTable::postAgain(); } + Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPopupList.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCPopupList.h?rev=40967&r1=40966&r2=40967&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCPopupList.h (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCPopupList.h Wed Sep 19 14:10:16 2007 @@ -50,6 +50,7 @@ int index = 0 ); virtual ~NCPopupList(); + void createEntries( const list<string> & deflist, int index ); }; /////////////////////////////////////////////////////////////////// Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPopupTable.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCPopupTable.cc?rev=40967&r1=40966&r2=40967&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCPopupTable.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCPopupTable.cc Wed Sep 19 14:10:16 2007 @@ -18,6 +18,7 @@ /-*/ #include "Y2Log.h" #include "NCPopupTable.h" +#include "NCPushButton.h" #include "NCTable.h" #include "YMenuButton.h" @@ -34,6 +35,7 @@ NCPopupTable::NCPopupTable( const wpos at ) : NCPopup( at, false ) , sellist( 0 ) + , position( at ) { } @@ -67,8 +69,11 @@ NCMIL << "CurrentDialog: " << dynamic_cast<NCDialog *>(currentDialog()) << endl; NCMIL << "THIS dialog: " << dynamic_cast<NCDialog *>(this) << endl; - + + //NCPushButton * button = new NCPushButton( this, "Hello" ); + sellist= new NCTable( this, opt, row, false ); + sellist->setParent( this ); sellist->setBigList( true ); sellist->SetSepChar( ' ' ); sellist->SetSepWidht( 0 ); @@ -153,9 +158,11 @@ // bool NCPopupTable::postAgain() { - postevent.detail = (postevent == NCursesEvent::button) ? sellist->getCurrentItem() - : NCursesEvent::NODETAIL; - return false; + if ( sellist ) { + postevent.detail = (postevent == NCursesEvent::button) ? + sellist->getCurrentItem() : NCursesEvent::NODETAIL; + } + return false; } void NCPopupTable::stripHotkeys() @@ -182,3 +189,10 @@ else return sze.H; } + +#if 0 +void NCPopupTable::setSize( int newwidth, int newheight ) +{ + wRelocate( position, wsze( newheight, newwidth ) ); +} +#endif Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPopupTable.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCPopupTable.h?rev=40967&r1=40966&r2=40967&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCPopupTable.h (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCPopupTable.h Wed Sep 19 14:10:16 2007 @@ -44,7 +44,8 @@ private: NCTable * sellist; - + wpos position; + protected: void createList( vector<string> & row ); @@ -69,6 +70,8 @@ int preferredWidth(); int preferredHeight(); + //void setSize( int newwidth, int newheight ); + }; /////////////////////////////////////////////////////////////////// Modified: branches/tmp/sh/mod-ui/ncurses/src/NCSelectionBox.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCSelectionBox.cc?rev=40967&r1=40966&r2=40967&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCSelectionBox.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCSelectionBox.cc Wed Sep 19 14:10:16 2007 @@ -159,34 +159,21 @@ void NCSelectionBox::selectItem( int index ) { NCDBG << "Select item (index) called" << endl; + YSelectionBox::deselectAllItems(); + YItem * item = YSelectionBox::itemAt( index ); if ( item ) { -#ifdef VERBOSE_SELECTION - y2debug( "%s \"%s\": Selecting item \"%s\"", - widgetClass(), - debugLabel().c_str(), - item->label().c_str() ); -#endif - + NCMIL << "selectItem: " << item->label().c_str() << endl; item->setSelected( true ); } else YUI_THROW( YUIException( "Can't find selected item" ) ); } -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : NCSelectionBox::itemAdded -// METHOD TYPE : void -// -// DESCRIPTION : -// -// still used in NCPkgPopupDeps -// +#if 0 void NCSelectionBox::itemAdded( const YCPString& str, int index, bool selected ) { vector<NCTableCol*> Items( 1U, 0 ); @@ -196,6 +183,7 @@ if ( selected ) myPad()->ScrlLine( myPad()->Lines() ); } +#endif /////////////////////////////////////////////////////////////////// // @@ -220,6 +208,11 @@ } } +void NCSelectionBox::addItem( const string & description, bool selected ) +{ + YSelectionWidget::addItem( description, selected ); +} + /////////////////////////////////////////////////////////////////// // // Modified: branches/tmp/sh/mod-ui/ncurses/src/NCSelectionBox.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCSelectionBox.h?rev=40967&r1=40966&r2=40967&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCSelectionBox.h (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCSelectionBox.h Wed Sep 19 14:10:16 2007 @@ -65,9 +65,8 @@ bool bigList() const { return biglist; } void setBigList( const bool big ) { biglist = big; } - virtual void itemAdded( const YCPString& string, int index, bool selected ); - virtual void addItem( YItem *item ); + virtual void addItem( const string & itemLabel, bool selected = false ); virtual int preferredWidth(); virtual int preferredHeight(); Modified: branches/tmp/sh/mod-ui/ncurses/src/NCTree.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCTree.cc?rev=40967&r1=40966&r2=40967&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCTree.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCTree.cc Wed Sep 19 14:10:16 2007 @@ -335,19 +335,50 @@ { if ( !myPad() ) return; - - if ( selected ) + + YTreeItem * treeItem = dynamic_cast<YTreeItem *> (item); + YUI_CHECK_PTR( treeItem ); + + // FIXME - index NOT set (is -1) ???????????? + NCMIL << "Index: " << treeItem->index() << endl; + + if ( !selected ) + { + YTree::deselectAllItems(); + } + else { for ( unsigned i = 0; i < myPad()->Lines(); ++i ) { const NCTreeLine * cline = getTreeLine( i ); - if ( &cline->Yitem() == (YTreeItem *)item ) { - NCMIL << "got " << item->label() << " at " << i << endl; + if ( &cline->Yitem() == treeItem ) { + NCMIL << "got " << treeItem->label() << " at " << i << endl; myPad()->ShowItem( cline ); break; } } - YTree::selectItem( item, selected ); + YTree::selectItem( treeItem, selected ); + } +} + +void NCTree::selectItem( int index ) +{ + NCDBG << "Select item (index) called" << endl; + YTree::deselectAllItems(); + YItem * item = YTree::itemAt( index ); + + if ( item ) + { +#ifdef VERBOSE_SELECTION + y2debug( "%s \"%s\": Selecting item \"%s\"", + widgetClass(), + debugLabel().c_str(), + item->label().c_str() ); +#endif + + item->setSelected( true ); } + else + YUI_THROW( YUIException( "Can't find selected item" ) ); } /////////////////////////////////////////////////////////////////// Modified: branches/tmp/sh/mod-ui/ncurses/src/NCTree.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCTree.h?rev=40967&r1=40966&r2=40967&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCTree.h (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCTree.h Wed Sep 19 14:10:16 2007 @@ -85,6 +85,7 @@ virtual void setCurrentItem( YTreeItem * it ); virtual void selectItem( YItem *item, bool selected ); + virtual void selectItem( int index ); virtual NCursesEvent wHandleInput( wint_t key ); Modified: branches/tmp/sh/mod-ui/ncurses/src/NCWidget.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCWidget.cc?rev=40967&r1=40966&r2=40967&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCWidget.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCWidget.cc Wed Sep 19 14:10:16 2007 @@ -235,7 +235,7 @@ } catch ( NCursesError & err ) { NCINT << DLOC << child << " -> " << newpos << " in " << this << endl; - NCINT << err << endl; + NCERR << err << endl; ::endwin(); abort(); } @@ -265,7 +265,7 @@ } catch ( NCursesError & err ) { NCINT << *this << endl; - NCINT << err << endl; + NCERR << err << endl; ::endwin(); abort(); } Modified: branches/tmp/sh/mod-ui/ncurses/src/NCWidget.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCWidget.h?rev=40967&r1=40966&r2=40967&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCWidget.h (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCWidget.h Wed Sep 19 14:10:16 2007 @@ -129,8 +129,8 @@ public: - NCWidget( NCWidget * myparent = 0 ); - NCWidget( YWidget * parent ); + NCWidget( NCWidget * myparent ); + NCWidget( YWidget * parent = 0 ); virtual ~NCWidget(); bool isValid() const { return magic == YWIDGET_MAGIC; } Modified: branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.cc?rev=40967&r1=40966&r2=40967&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.cc Wed Sep 19 14:10:16 2007 @@ -75,7 +75,7 @@ NCurses::init(); } catch ( NCursesError & err ) { - UIINT << err << endl; + UIMIL << err << endl; ::endwin(); abort(); } @@ -321,7 +321,10 @@ NCDialog * dlg = dynamic_cast<NCDialog *>( dialog ); UIDBG << dlg << endl; if ( dlg ) + { dlg->showDialog(); + dlg->dumpWidgetTree(); + } } void YNCursesUI::closeDialog( YDialog * dialog ) { @@ -500,6 +503,7 @@ vector<string> header ) { ONCREATE; + NCMIL << "CreateTable" << endl; return new NCTable( parent, opt, header, true ); } Modified: branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc?rev=40967&r1=40966&r2=40967&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc Wed Sep 19 14:10:16 2007 @@ -200,7 +200,7 @@ testMode = true; saveState (); - +#if 0 if ( !youMode ) { // create the selections popup @@ -237,7 +237,7 @@ // the disk space popup diskspacePopup = new NCPkgPopupDiskspace( wpos( (NCurses::lines() - 15)/2, NCurses::cols()/6 ), testMode ); - +#endif } /////////////////////////////////////////////////////////////////// Modified: branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupDeps.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupDeps.cc?rev=40967&r1=40966&r2=40967&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupDeps.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupDeps.cc Wed Sep 19 14:10:16 2007 @@ -48,7 +48,7 @@ protected: virtual NCursesEvent wHandleInput( wint_t ch ); - + public: NCProblemSelectionBox (YWidget * parent, const string & label, NCPkgPopupDeps * aDepsPopup) @@ -282,7 +282,8 @@ // no solution yet problems.push_back (make_pair (*i, zypp::ProblemSolution_Ptr ())); - problemw->itemAdded ((*i)->description (), idx, false /*selected*/); + //problemw->itemAdded ((*i)->description (), idx, false /*selected*/); + problemw->addItem( (*i)->description(), false ); // selected: false } return false; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
gs@svn.opensuse.org