|
From: CVS C. to T. <the...@li...> - 2011-06-04 12:55:04
|
Revision: 653
http://themis.svn.sourceforge.net/themis/?rev=653&view=rev
Author: mark_hellegers
Date: 2011-06-04 12:54:58 +0000 (Sat, 04 Jun 2011)
Log Message:
-----------
Moved duplicate code to a separate function.
Modified Paths:
--------------
trunk/themis/framework/ThemisUrlPopUpWindow.cpp
trunk/themis/framework/ThemisUrlPopUpWindow.h
Modified: trunk/themis/framework/ThemisUrlPopUpWindow.cpp
===================================================================
--- trunk/themis/framework/ThemisUrlPopUpWindow.cpp 2011-06-04 10:10:26 UTC (rev 652)
+++ trunk/themis/framework/ThemisUrlPopUpWindow.cpp 2011-06-04 12:54:58 UTC (rev 653)
@@ -52,6 +52,25 @@
delete url_list;
}
+void ThemisUrlPopUpWindow :: SetUrlSelection(int aOffset) {
+
+ if (aOffset != 0) {
+ urlpopupview->ulv->Select(urlpopupview->ulv->CurrentSelection() + aOffset);
+ urlpopupview->ulv->ScrollToSelection();
+ }
+
+ UrlItem * item = (UrlItem *)url_list->ItemAt(
+ urlpopupview->ulv->CurrentSelection());
+
+ if (item) {
+ parentwindow->Lock();
+ ((Win *)parentwindow)->GetNavView()->urlview->SetText(item->Text());
+ parentwindow->Unlock();
+ }
+
+}
+
+
void
ThemisUrlPopUpWindow::MessageReceived( BMessage *msg )
{
@@ -60,15 +79,8 @@
case URL_SELECT_MOUSE :
{
// set the urlview-text
- //cout << "URL_SELECT_MOUSE" << endl;
+ SetUrlSelection();
- BStringItem* item = ( BStringItem* )url_list->ItemAt(
- urlpopupview->ulv->CurrentSelection() );
-
- parentwindow->Lock();
- ((Win*)parentwindow)->GetNavView()->urlview->SetText( item->Text() );
- parentwindow->Unlock();
-
// doubleclick opens url
uint32 clickitem = urlpopupview->ulv->CurrentSelection();
if( msg->HasBool( "doubleclick" ) )
@@ -88,44 +100,12 @@
}
case URL_SELECT_NEXT :
{
- //cout << "URL_SELECT_NEXT received" << endl;
- Lock();
- urlpopupview->ulv->Select(
- urlpopupview->ulv->CurrentSelection() + 1 );
- urlpopupview->ulv->ScrollToSelection();
-
- // set the urlview-text
- BStringItem* item = ( BStringItem* )url_list->ItemAt(
- urlpopupview->ulv->CurrentSelection() );
- if( !item )
- break;
-
- parentwindow->Lock();
- ((Win*)parentwindow)->GetNavView()->urlview->SetText( item->Text() );
- parentwindow->Unlock();
-
- Unlock();
+ SetUrlSelection(1);
break;
}
case URL_SELECT_PREV :
{
- //cout << "URL_SELECT_PREV received" << endl;
- Lock();
- urlpopupview->ulv->Select(
- urlpopupview->ulv->CurrentSelection() - 1 );
- urlpopupview->ulv->ScrollToSelection();
-
- // set the urlview-text
- BStringItem* item = ( BStringItem* )url_list->ItemAt(
- urlpopupview->ulv->CurrentSelection() );
- if( !item )
- break;
-
- parentwindow->Lock();
- ((Win*)parentwindow)->GetNavView()->urlview->SetText( item->Text() );
- parentwindow->Unlock();
-
- Unlock();
+ SetUrlSelection(-1);
break;
}
case B_MOUSE_WHEEL_CHANGED: {
Modified: trunk/themis/framework/ThemisUrlPopUpWindow.h
===================================================================
--- trunk/themis/framework/ThemisUrlPopUpWindow.h 2011-06-04 10:10:26 UTC (rev 652)
+++ trunk/themis/framework/ThemisUrlPopUpWindow.h 2011-06-04 12:54:58 UTC (rev 653)
@@ -22,6 +22,7 @@
BList * url_list;
BScrollBar * vscroll;
ThemisUrlPopUpView * urlpopupview;
+ void SetUrlSelection(int aOffset = 0);
public:
ThemisUrlPopUpWindow(BWindow* aParent, BRect aFrame, BList * aList);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|