Author: kmachalkova
Date: Mon Jan 14 16:16:49 2008
New Revision: 43582
URL: http://svn.opensuse.org/viewcvs/yast?rev=43582&view=rev
Log:
- 'Press F1 for Help' in window title is gone
- No Fxx keys describing pop-up (all the information
moved to the bottom status line)
- Fxx key labels rendered in reversed colours
Modified:
trunk/ncurses/src/NCDialog.cc
trunk/ncurses/src/NCDialog.h
trunk/ncurses/src/NCurses.cc
trunk/ncurses/src/NCurses.h
trunk/ncurses/src/YNCursesUI.cc
Modified: trunk/ncurses/src/NCDialog.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCDialog.cc?rev=43582&r1=43581&r2=43582&view=diff
==============================================================================
--- trunk/ncurses/src/NCDialog.cc (original)
+++ trunk/ncurses/src/NCDialog.cc Mon Jan 14 16:16:49 2008
@@ -532,9 +532,7 @@
--inMultiDraw_i;
} else {
inMultiDraw_i = 0;
- string text = "";
- describeFunctionKeys( text );
- NCurses::SetStatusLine( text );
+ NCurses::SetStatusLine( describeFunctionKeys() );
Update();
}
}
@@ -1203,6 +1201,7 @@
}
break;
+ #if 0
case KEY_F(1):
if ( !helpPopup )
{
@@ -1211,13 +1210,13 @@
bool hasF1 = describeFunctionKeys( helpText );
if ( hasF1 )
{
- // part of help for textmode navigation (shown if there is further help available)
- helpIntro = _( "<p>Press <b>F1</b> again to get further help or <b>ESC</b> to close this dialog.</p>" );
+ // part of help for textmode navigation (shown if there is further help available)
+ helpIntro = _( "<p>Press <b>F1</b> again to get further help or <b>ESC</b> to close this dialog.</p>" );
}
else
{
- // part of help for text mode navigation
- helpIntro = _( "<p>Press <b>F1</b> or <b>ESC</b> to close this dialog.</p>" );
+ // part of help for text mode navigation
+ helpIntro = _( "<p>Press <b>F1</b> or <b>ESC</b> to close this dialog.</p>" );
}
helpPopup = new NCPopupInfo( wpos( NCurses::lines()/3, NCurses::cols()/3 ),
@@ -1246,13 +1245,14 @@
}
}
break;
+ #endif
default:
// only handle keys if the help popup is not existing or not visible
if ( !helpPopup
|| (helpPopup && !helpPopup->isVisible()) )
{
- if ( ch >= KEY_F(2) && ch <= KEY_F(24) )
+ if ( ch >= KEY_F(1) && ch <= KEY_F(24) )
{
pendingEvent = getHotkeyEvent( ch );
}
@@ -1383,17 +1383,14 @@
//
//
// METHOD NAME : NCDialog::describeFunctionKeys
-// METHOD TYPE : string
+// METHOD TYPE : std::map
//
-// DESCRIPTION : get all PushButtons and MenuButtons with `opt(`key_Fn)
-// and create a text like F1: Help, F2: Info and so on
+// DESCRIPTION : Get all PushButtons and MenuButtons with `opt(`key_Fn)
+// and create a map, for example: $[ 1: Help, 2: Info,... ]
+// NCurses::SetStatusLine will process it
//
-bool NCDialog::describeFunctionKeys( string & helpText )
+std::map NCDialog::describeFunctionKeys( )
{
- string text = "";
- char key[20];
- YCPString label( "" );
- bool hasF1 = false;
std::map fkeys;
for ( tnode * c = this->Next(); c; c = c->Next() )
@@ -1404,30 +1401,12 @@
{
// Retrieve the widget's "shortcut property" that describes
// whatever it is - regardless of widget type (PushButton, ...)
- //YCPSymbol propertyName( w->shortcutProperty() );
- //YCPValue propertyValue = w->queryWidget( propertyName );
- // Get rid of unwanted '&' shortcut markers
- //string desc = YShortcut::cleanShortcutString( propertyValue->asString()->value() );
- if ( w->functionKey() == 1 )
- {
- hasF1 = true;
- }
fkeys[ w->functionKey() ] = w->debugLabel();
}
}
- // create the text with sorted F-keys
- std::map::iterator it;
-
- for ( it = fkeys.begin(); it != fkeys.end(); ++it )
- {
- sprintf( key, "F%d: ", (*it).first );
- text += key + (*it).second + " ";
- }
-
- helpText = text;
- return hasF1;
+ return fkeys;
}
/******************************************************************
Modified: trunk/ncurses/src/NCDialog.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCDialog.h?rev=43582&r1=43581&r2=43582&view=diff
==============================================================================
--- trunk/ncurses/src/NCDialog.h (original)
+++ trunk/ncurses/src/NCDialog.h Mon Jan 14 16:16:49 2008
@@ -104,7 +104,7 @@
void processInput( int timeout_millisec );
- bool describeFunctionKeys( string & helpText );
+ std::map describeFunctionKeys();
wint_t getinput(); // get the input (respect terminal encoding)
Modified: trunk/ncurses/src/NCurses.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCurses.cc?rev=43582&r1=43581&r2=43582&view=diff
==============================================================================
--- trunk/ncurses/src/NCurses.cc (original)
+++ trunk/ncurses/src/NCurses.cc Mon Jan 14 16:16:49 2008
@@ -522,7 +522,8 @@
::wclear( myself->title_w );
NCMIL << "Draw title called" << endl;
-
+
+ #if 0
setTextdomain( "packages" );
// part of title (headline) of the textmode yast
NCstring helpF1 ( _( "Press F1 for Help" ) );
@@ -540,21 +541,38 @@
{
::mvwaddwstr( myself->title_w, 0, s, (wchar_t *)helpF1.str().c_str() );
}
+ #endif
+
::mvwaddstr( myself->title_w, 0, 1, myself->title_t.c_str() );
::wnoutrefresh( myself->title_w );
}
}
-void NCurses::SetStatusLine( const string & str )
+void NCurses::SetStatusLine( std::map fkeys )
{
if ( myself && myself->status_w ) {
- myself->status_line = str;
+ myself->status_line = fkeys;
::wbkgd( myself->status_w, myself->style()(NCstyle::AppTitle) );
::werase( myself->status_w );
- ::mvwaddstr( myself->status_w, 0, 1, myself->status_line.c_str() );
+ char key[10];
+ char value[100];
+
+ std::map::iterator it;
+ for ( it = fkeys.begin(); it != fkeys.end(); ++it )
+ {
+ sprintf( key, " F%d ", (*it).first );
+ //reverse F-key to make it more visible
+ ::wattron( myself->status_w, A_REVERSE);
+ ::waddstr( myself->status_w, key );
+ ::wattroff( myself->status_w, A_REVERSE);
+
+ sprintf( value, "%s ", (*it).second.c_str() );
+ ::waddstr( myself->status_w, value );
+ }
+
::wnoutrefresh( myself->status_w );
}
}
Modified: trunk/ncurses/src/NCurses.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCurses.h?rev=43582&r1=43581&r2=43582&view=diff
==============================================================================
--- trunk/ncurses/src/NCurses.h (original)
+++ trunk/ncurses/src/NCurses.h Mon Jan 14 16:16:49 2008
@@ -160,7 +160,8 @@
WINDOW * title_w;
WINDOW * status_w;
string title_t;
- string status_line;
+
+ std::map status_line;
NCstyle * styleset;
NCursesPanel * stdpan;
@@ -196,7 +197,7 @@
static void Redraw();
static void Refresh();
static void SetTitle( const string & str );
- static void SetStatusLine( const string & str );
+ static void SetStatusLine( std::map fkeys );
static void ScreenShot( const string & name = "screen.shot" );
static void drawTitle();
Modified: trunk/ncurses/src/YNCursesUI.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/YNCursesUI.cc?rev=43582&r1=43581&r2=43582&view=diff
==============================================================================
--- trunk/ncurses/src/YNCursesUI.cc (original)
+++ trunk/ncurses/src/YNCursesUI.cc Mon Jan 14 16:16:49 2008
@@ -313,7 +313,7 @@
if ( dlg )
{
dlg->showDialog();
- dlg->dumpWidgetTree();
+ //dlg->dumpWidgetTree();
}
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org