You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
(12) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
|
Feb
(23) |
Mar
(6) |
Apr
(6) |
May
(2) |
Jun
(41) |
Jul
(29) |
Aug
(28) |
Sep
(51) |
Oct
(19) |
Nov
(27) |
Dec
|
| 2003 |
Jan
(1) |
Feb
(11) |
Mar
(20) |
Apr
(18) |
May
(23) |
Jun
(18) |
Jul
(13) |
Aug
(49) |
Sep
(20) |
Oct
(3) |
Nov
(24) |
Dec
(1) |
| 2004 |
Jan
(12) |
Feb
(17) |
Mar
(38) |
Apr
(7) |
May
(22) |
Jun
(4) |
Jul
(26) |
Aug
(17) |
Sep
(18) |
Oct
(17) |
Nov
|
Dec
|
| 2005 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
(2) |
Oct
|
Nov
(14) |
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
| 2009 |
Jan
(5) |
Feb
(12) |
Mar
|
Apr
(10) |
May
(7) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(22) |
Dec
(6) |
| 2010 |
Jan
(14) |
Feb
(4) |
Mar
(4) |
Apr
(2) |
May
(3) |
Jun
|
Jul
|
Aug
(7) |
Sep
|
Oct
(2) |
Nov
(39) |
Dec
(3) |
| 2011 |
Jan
(28) |
Feb
(14) |
Mar
(8) |
Apr
(3) |
May
|
Jun
(14) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
(3) |
Nov
(4) |
Dec
|
| 2012 |
Jan
(1) |
Feb
(12) |
Mar
(7) |
Apr
(4) |
May
(1) |
Jun
|
Jul
(1) |
Aug
(11) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
| 2015 |
Jan
|
Feb
|
Mar
|
Apr
(13) |
May
(2) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
(2) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
| 2017 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
(5) |
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: CVS C. to T. <the...@li...> - 2010-11-21 15:35:16
|
Revision: 570
http://themis.svn.sourceforge.net/themis/?rev=570&view=rev
Author: mark_hellegers
Date: 2010-11-21 15:35:10 +0000 (Sun, 21 Nov 2010)
Log Message:
-----------
Cleaned up SiteHandler header.
Modified Paths:
--------------
trunk/themis/framework/SiteHandler.cpp
trunk/themis/framework/SiteHandler.h
Modified: trunk/themis/framework/SiteHandler.cpp
===================================================================
--- trunk/themis/framework/SiteHandler.cpp 2010-11-21 15:23:15 UTC (rev 569)
+++ trunk/themis/framework/SiteHandler.cpp 2010-11-21 15:35:10 UTC (rev 570)
@@ -2,6 +2,9 @@
* SiteHandler.cpp
*/
+// BeOS headers
+#include <Locker.h>
+
// Standard C headers
#include <stdio.h>
@@ -10,7 +13,9 @@
#include "plugman.h"
#include "ThemisIcons.h"
#include "../common/commondefs.h"
+#include "../common/cacheplug.h"
#include "UrlEntry.h"
+#include "SiteEntry.h"
#include "SiteHandler.h"
extern plugman* PluginManager;
Modified: trunk/themis/framework/SiteHandler.h
===================================================================
--- trunk/themis/framework/SiteHandler.h 2010-11-21 15:23:15 UTC (rev 569)
+++ trunk/themis/framework/SiteHandler.h 2010-11-21 15:35:10 UTC (rev 570)
@@ -5,64 +5,47 @@
#ifndef SITEHANDLER_H
#define SITEHANDLER_H
-#include <Locker.h>
-
+// Standard C++ headers
#include <vector.h>
+// Themis headers
#include "msgsystem.h"
-#include "../common/cacheplug.h"
-#include "SiteEntry.h"
+// Namespaces used
using namespace std;
-class SiteHandler : public MessageSystem
-{
+// Declarations used
+class BLocker;
+class BBitmap;
+class BMessage;
+class SiteEntry;
+class CachePlug;
+
+class SiteHandler : public MessageSystem {
+
+ private:
+ SiteEntry * GetEntry(int32 id);
+ CachePlug * fCachePlug;
+ uint32 fCacheUserToken;
+ BLocker * fLocker;
+ vector<SiteEntry*> fEntryList;
+
public:
- SiteHandler();
-
- ~SiteHandler();
-
- void BroadcastFinished();
-
- uint32 BroadcastTarget();
-
- status_t BroadcastReply(
- BMessage* msg );
+ SiteHandler();
+ ~SiteHandler();
- bool EntryValid(
- int32 id );
-
- BBitmap* GetFavIconFor(
- int32 id );
-
- int8 GetLoadingProgressFor(
- int32 id );
-
- const char* GetStatusTextFor(
- int32 id );
-
- const char* GetTitleFor(
- int32 id );
-
- const char* GetUrlFor(
- int32 id );
-
- status_t ReceiveBroadcast(
- BMessage* msg );
-
- void RemoveEntry(
- int32 id );
+ void BroadcastFinished();
+ uint32 BroadcastTarget();
+ status_t BroadcastReply(BMessage * msg);
+ bool EntryValid(int32 id);
+ BBitmap * GetFavIconFor(int32 id);
+ int8 GetLoadingProgressFor(int32 id);
+ const char * GetStatusTextFor(int32 id);
+ const char * GetTitleFor(int32 id);
+ const char * GetUrlFor(int32 id);
+ status_t ReceiveBroadcast(BMessage* msg);
+ void RemoveEntry(int32 id);
- private:
- SiteEntry* GetEntry(
- int32 id );
-
- CachePlug* fCachePlug;
- uint32 fCacheUserToken;
-
- BLocker* fLocker;
-
- vector< SiteEntry* > fEntryList;
};
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-11-21 15:23:22
|
Revision: 569
http://themis.svn.sourceforge.net/themis/?rev=569&view=rev
Author: mark_hellegers
Date: 2010-11-21 15:23:15 +0000 (Sun, 21 Nov 2010)
Log Message:
-----------
Cleaned up the UrlEntry class.
Modified Paths:
--------------
trunk/themis/framework/UrlEntry.cpp
trunk/themis/framework/UrlEntry.h
Modified: trunk/themis/framework/UrlEntry.cpp
===================================================================
--- trunk/themis/framework/UrlEntry.cpp 2010-11-21 15:11:47 UTC (rev 568)
+++ trunk/themis/framework/UrlEntry.cpp 2010-11-21 15:23:15 UTC (rev 569)
@@ -2,25 +2,25 @@
* UrlEntry.cpp
*/
+// Standard C headers
#include <stdio.h>
+// BeOS headers
+#include <String.h>
+
+// Themis headers
#include "UrlEntry.h"
UrlEntry::UrlEntry(
int32 id,
const char* url )
{
-// printf( "UrlEntry::UrlEntry()\n" );
fID = id;
fLoadingProgress = -1;
fUrl = new BString( url );
-// fStatusText = new BString( "Transfering data from " );
-// fStatusText->Append( url );
-// fStatusText->Append( " ..." );
-
/*
* The page title is set to "loading..." now.
* When loading is finished, its set to the sites url.
@@ -31,36 +31,19 @@
*/
fTitle = new BString( "loading..." );
-// fCookiesDisabled = false;
fSecureConnection = false;
-// fFavIcon = NULL;
}
UrlEntry::~UrlEntry()
{
-// printf( "UrlEntry::~UrlEntry()\n" );
if( fUrl != NULL )
delete fUrl;
-// if( fStatusText != NULL )
-// delete fStatusText;
if( fTitle != NULL )
delete fTitle;
}
-//bool
-//UrlEntry::GetCookiesDisabled()
-//{
-// return fCookiesDisabled;
-//}
-
-//BBitmap*
-//UrlEntry::GetFavIcon()
-//{
-// return fFavIcon;
-//}
-
int32
UrlEntry::GetID()
{
@@ -79,16 +62,9 @@
return fSecureConnection;
}
-//const char*
-//UrlEntry::GetStatusText()
-//{
-// return fStatusText ? fStatusText->String() : "";
-//}
-
const char*
UrlEntry::GetTitle()
{
-// printf( " GetTitle(): %s\n", fTitle->String() );
return fTitle ? fTitle->String() : "";
}
@@ -106,33 +82,8 @@
fLoadingProgress,
fSecureConnection ? "true" : "false" );
-// printf( " LoadingProgess[%d] CookiesDisabled[%s], SecureConnection[%s]\n",
-// fLoadingProgress,
-// fCookiesDisabled ? "true" : "false",
-// fSecureConnection ? "true" : "false" );
}
-//void
-//UrlEntry::SetCookiesDisabled(
-// bool value )
-//{
-// fCookiesDisabled = value;
-//}
-
-//void
-//UrlEntry::SetFavIcon(
-// BBitmap* bmp )
-//{
-// if( bmp )
-// {
-// if( !fFavIcon )
-// fFavIcon = new BBitmap(
-// BRect( 0, 0, 15, 15 ), B_RGB32 );
-//
-// memcpy( fFavIcon->Bits(), bmp->Bits(), 1024 );
-// }
-//}
-
void
UrlEntry::SetLoadingProgress(
int8 loadingprogress )
@@ -141,7 +92,6 @@
if( fLoadingProgress == 100 )
{
-// fStatusText->SetTo( "Done." );
fTitle->SetTo( fUrl->String() );
}
}
@@ -159,4 +109,3 @@
{
fTitle->SetTo( title );
}
-
Modified: trunk/themis/framework/UrlEntry.h
===================================================================
--- trunk/themis/framework/UrlEntry.h 2010-11-21 15:11:47 UTC (rev 568)
+++ trunk/themis/framework/UrlEntry.h 2010-11-21 15:23:15 UTC (rev 569)
@@ -5,67 +5,34 @@
#ifndef URLENTRY_H
#define URLENTRY_H
-#include <Bitmap.h>
-#include <String.h>
+// Declarations used
+class BString;
-class UrlEntry
-{
+class UrlEntry {
+
+ private:
+ int32 fID;
+ int8 fLoadingProgress;
+ BString * fUrl;
+ BString * fTitle;
+ bool fSecureConnection;
+
public:
- UrlEntry(
- int32 id,
- const char* url );
-
- ~UrlEntry();
-
-// bool GetCookiesDisabled();
-
-// BBitmap* GetFavIcon();
-
- int32 GetID();
+ UrlEntry(int32 id,
+ const char* url);
+ ~UrlEntry();
- int8 GetLoadingProgress();
+ int32 GetID();
+ int8 GetLoadingProgress();
+ bool GetSecureConnection();
+ const char * GetTitle();
- bool GetSecureConnection();
-
-// const char* GetStatusText();
-
- const char* GetTitle();
-
- const char* GetUrl();
-
- void Print();
-
-// void SetCookiesDisabled(
-// bool value );
-
-// void SetFavIcon(
-// BBitmap* bmp );
-
- void SetLoadingProgress(
- int8 loadingprogress );
-
- void SetSecureConnection(
- bool value );
-
-// void SetStatusText(
-// const char* text );
-
- void SetTitle(
- const char* title );
+ const char * GetUrl();
+ void Print();
+ void SetLoadingProgress(int8 loadingprogress);
+ void SetSecureConnection(bool value);
+ void SetTitle(const char * title);
- private:
- int32 fID;
-
- int8 fLoadingProgress;
-
- BString* fUrl;
- BString* fTitle;
-// BString* fStatusText;
-
-// bool fCookiesDisabled;
- bool fSecureConnection;
-
-// BBitmap* fFavIcon;
};
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-11-21 15:11:53
|
Revision: 568
http://themis.svn.sourceforge.net/themis/?rev=568&view=rev
Author: mark_hellegers
Date: 2010-11-21 15:11:47 +0000 (Sun, 21 Nov 2010)
Log Message:
-----------
Cleaned up the SiteEntry header.
Modified Paths:
--------------
trunk/themis/framework/SiteEntry.cpp
trunk/themis/framework/SiteEntry.h
trunk/themis/framework/SiteHandler.cpp
Modified: trunk/themis/framework/SiteEntry.cpp
===================================================================
--- trunk/themis/framework/SiteEntry.cpp 2010-11-19 22:47:54 UTC (rev 567)
+++ trunk/themis/framework/SiteEntry.cpp 2010-11-21 15:11:47 UTC (rev 568)
@@ -2,9 +2,16 @@
* SiteEntry.cpp
*/
+// BeOS headers
+#include <Bitmap.h>
+#include <String.h>
+
+// Standard C headers
#include <stdio.h>
+// Themis headers
#include "SiteEntry.h"
+#include "UrlEntry.h"
SiteEntry::SiteEntry(
int32 id,
Modified: trunk/themis/framework/SiteEntry.h
===================================================================
--- trunk/themis/framework/SiteEntry.h 2010-11-19 22:47:54 UTC (rev 567)
+++ trunk/themis/framework/SiteEntry.h 2010-11-21 15:11:47 UTC (rev 568)
@@ -5,83 +5,54 @@
#ifndef SITEENTRY_H
#define SITEENTRY_H
-#include <Bitmap.h>
-#include <String.h>
-
+// Standard C++ headers
#include <vector.h>
-#include "SiteEntry.h"
-#include "UrlEntry.h"
-
+// Namespaces used
using namespace std;
-class SiteEntry
-{
- public:
- SiteEntry(
- int32 id,
- const char* url );
-
- ~SiteEntry();
-
- void AddEntry(
- int32 id,
- const char* url );
-
- bool GetCookiesDisabled();
-
- BBitmap* GetFavIcon();
-
- UrlEntry* GetEntry(
- int32 id );
-
- int32 GetID();
+// Declarations used
+class BString;
+class BBitmap;
+class UrlEntry;
- int8 GetLoadingProgress();
-
- bool GetSecureConnection();
-
- const char* GetStatusText();
-
- const char* GetTitle();
-
- const char* GetUrl();
-
- void Print();
-
- void SetCookiesDisabled(
- bool value );
-
- void SetFavIcon(
- BBitmap* bmp );
-
- void SetLoadingProgress(
- int8 loadingprogress );
-
- void SetSecureConnection(
- bool value );
-
- void SetStatusText(
- const char* text );
-
- void SetTitle(
- const char* title );
-
+class SiteEntry {
+
private:
- vector< UrlEntry* > fEntryList;
+ vector<UrlEntry*> fEntryList;
+ int32 fID;
+ int8 fLoadingProgress;
+ BString * fUrl;
+ BString * fTitle;
+ BString * fStatusText;
+ bool fCookiesDisabled;
+ bool fSecureConnection;
+ BBitmap * fFavIcon;
+
+ public:
+ SiteEntry(int32 id,
+ const char* url);
+ ~SiteEntry();
- int32 fID;
-
- int8 fLoadingProgress;
-
- BString* fUrl;
- BString* fTitle;
- BString* fStatusText;
-
- bool fCookiesDisabled;
- bool fSecureConnection;
-
- BBitmap* fFavIcon;
+ void AddEntry(int32 id,
+ const char* url);
+ bool GetCookiesDisabled();
+ BBitmap * GetFavIcon();
+ UrlEntry * GetEntry(int32 id);
+ int32 GetID();
+ int8 GetLoadingProgress();
+ bool GetSecureConnection();
+ const char * GetStatusText();
+ const char * GetTitle();
+ const char * GetUrl();
+ void Print();
+ void SetCookiesDisabled(bool value);
+ void SetFavIcon(BBitmap* bmp);
+ void SetLoadingProgress(int8 loadingprogress);
+ void SetSecureConnection(bool value);
+ void SetStatusText(const char* text);
+ void SetTitle(const char* title);
+
};
#endif
Modified: trunk/themis/framework/SiteHandler.cpp
===================================================================
--- trunk/themis/framework/SiteHandler.cpp 2010-11-19 22:47:54 UTC (rev 567)
+++ trunk/themis/framework/SiteHandler.cpp 2010-11-21 15:11:47 UTC (rev 568)
@@ -2,13 +2,16 @@
* SiteHandler.cpp
*/
+// Standard C headers
#include <stdio.h>
+// Themis headers
#include "app.h"
#include "plugman.h"
#include "ThemisIcons.h"
+#include "../common/commondefs.h"
+#include "UrlEntry.h"
#include "SiteHandler.h"
-#include "../common/commondefs.h"
extern plugman* PluginManager;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-11-19 22:48:00
|
Revision: 567
http://themis.svn.sourceforge.net/themis/?rev=567&view=rev
Author: mark_hellegers
Date: 2010-11-19 22:47:54 +0000 (Fri, 19 Nov 2010)
Log Message:
-----------
Moved include to cpp file.
Modified Paths:
--------------
trunk/themis/modules/CSSViewer/CSSView.cpp
trunk/themis/modules/CSSViewer/CSSView.hpp
Modified: trunk/themis/modules/CSSViewer/CSSView.cpp
===================================================================
--- trunk/themis/modules/CSSViewer/CSSView.cpp 2010-11-14 13:53:40 UTC (rev 566)
+++ trunk/themis/modules/CSSViewer/CSSView.cpp 2010-11-19 22:47:54 UTC (rev 567)
@@ -55,9 +55,11 @@
#include "MediaList.hpp"
// Themis headers
+#include "ColumnListView.h"
#include "ColumnTypes.h"
#include "TTextView.hpp"
+
// Constants used
const int32 SELECTION = 'slct';
const char * cMediaSpecific = "Media-specific rules";
Modified: trunk/themis/modules/CSSViewer/CSSView.hpp
===================================================================
--- trunk/themis/modules/CSSViewer/CSSView.hpp 2010-11-14 13:53:40 UTC (rev 566)
+++ trunk/themis/modules/CSSViewer/CSSView.hpp 2010-11-19 22:47:54 UTC (rev 567)
@@ -43,11 +43,9 @@
// DOM Style headers
#include "CSSStyleSheet.hpp"
-// Themis headers
-#include "ColumnListView.h"
-
// Declarations of Themis classes
class TTextView;
+class BColumnListView;
class CSSView : public BWindow {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-11-14 13:53:46
|
Revision: 566
http://themis.svn.sourceforge.net/themis/?rev=566&view=rev
Author: mark_hellegers
Date: 2010-11-14 13:53:40 +0000 (Sun, 14 Nov 2010)
Log Message:
-----------
When using a class at least declare it. Oops.
Modified Paths:
--------------
trunk/themis/common/BasePrefsView.hpp
Modified: trunk/themis/common/BasePrefsView.hpp
===================================================================
--- trunk/themis/common/BasePrefsView.hpp 2010-11-10 23:15:34 UTC (rev 565)
+++ trunk/themis/common/BasePrefsView.hpp 2010-11-14 13:53:40 UTC (rev 566)
@@ -42,6 +42,9 @@
#include <View.h>
#include <Rect.h>
+// Declarations used
+class BBox;
+
/// Class to define the basic view of the preferences.
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-11-10 23:15:41
|
Revision: 565
http://themis.svn.sourceforge.net/themis/?rev=565&view=rev
Author: mark_hellegers
Date: 2010-11-10 23:15:34 +0000 (Wed, 10 Nov 2010)
Log Message:
-----------
Changed e-mail address fron my really old one to my new one.
Modified Paths:
--------------
trunk/themis/modules/FileProtocol/FileProtocol.hpp
trunk/themis/modules/HTMLParser/ElementDeclException.cpp
trunk/themis/modules/HTMLParser/ElementDeclException.hpp
trunk/themis/modules/HTMLParser/HTMLParser.h
trunk/themis/modules/HTMLParser/SGMLSupport.hpp
trunk/themis/modules/HTMLParser/SGMLText.cpp
trunk/themis/modules/HTMLParser/SGMLText.hpp
trunk/themis/modules/MsgViewer/MsgView.cpp
trunk/themis/modules/MsgViewer/MsgView.hpp
trunk/themis/modules/MsgViewer/MsgViewer.cpp
trunk/themis/modules/MsgViewer/MsgViewer.hpp
Modified: trunk/themis/modules/FileProtocol/FileProtocol.hpp
===================================================================
--- trunk/themis/modules/FileProtocol/FileProtocol.hpp 2010-11-10 23:10:07 UTC (rev 564)
+++ trunk/themis/modules/FileProtocol/FileProtocol.hpp 2010-11-10 23:15:34 UTC (rev 565)
@@ -2,7 +2,7 @@
Processes file requests when an url is specified
with the file:// prefix
- Mark Hellegers (M.H...@st...)
+ Mark Hellegers (ma...@fi...)
23-08-2003
*/
Modified: trunk/themis/modules/HTMLParser/ElementDeclException.cpp
===================================================================
--- trunk/themis/modules/HTMLParser/ElementDeclException.cpp 2010-11-10 23:10:07 UTC (rev 564)
+++ trunk/themis/modules/HTMLParser/ElementDeclException.cpp 2010-11-10 23:15:34 UTC (rev 565)
@@ -23,7 +23,7 @@
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- Original Author: Mark Hellegers (M.H...@st...)
+ Original Author: Mark Hellegers (ma...@fi...)
Project Start Date: October 18, 2000
Class Start Date: March 25, 2003
*/
Modified: trunk/themis/modules/HTMLParser/ElementDeclException.hpp
===================================================================
--- trunk/themis/modules/HTMLParser/ElementDeclException.hpp 2010-11-10 23:10:07 UTC (rev 564)
+++ trunk/themis/modules/HTMLParser/ElementDeclException.hpp 2010-11-10 23:15:34 UTC (rev 565)
@@ -23,7 +23,7 @@
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- Original Author: Mark Hellegers (M.H...@st...)
+ Original Author: Mark Hellegers (ma...@fi...)
Project Start Date: October 18, 2000
Class Start Date: April 22, 2003
*/
Modified: trunk/themis/modules/HTMLParser/HTMLParser.h
===================================================================
--- trunk/themis/modules/HTMLParser/HTMLParser.h 2010-11-10 23:10:07 UTC (rev 564)
+++ trunk/themis/modules/HTMLParser/HTMLParser.h 2010-11-10 23:15:34 UTC (rev 565)
@@ -1,7 +1,7 @@
/* HTMLParser addon
Basically only testing at the moment
- Mark Hellegers (M.H...@st...)
+ Mark Hellegers (ma...@fi...)
03-09-2002
*/
Modified: trunk/themis/modules/HTMLParser/SGMLSupport.hpp
===================================================================
--- trunk/themis/modules/HTMLParser/SGMLSupport.hpp 2010-11-10 23:10:07 UTC (rev 564)
+++ trunk/themis/modules/HTMLParser/SGMLSupport.hpp 2010-11-10 23:15:34 UTC (rev 565)
@@ -1,6 +1,6 @@
/* Support definitions for the SGML Parser
- Mark Hellegers (M.H...@st...)
+ Mark Hellegers (ma...@fi...)
11-04-2003
*/
Modified: trunk/themis/modules/HTMLParser/SGMLText.cpp
===================================================================
--- trunk/themis/modules/HTMLParser/SGMLText.cpp 2010-11-10 23:10:07 UTC (rev 564)
+++ trunk/themis/modules/HTMLParser/SGMLText.cpp 2010-11-10 23:15:34 UTC (rev 565)
@@ -23,7 +23,7 @@
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- Original Author: Mark Hellegers (M.H...@st...)
+ Original Author: Mark Hellegers (ma...@fi...)
Project Start Date: October 18, 2000
Class Start Date: April 11, 2003
*/
Modified: trunk/themis/modules/HTMLParser/SGMLText.hpp
===================================================================
--- trunk/themis/modules/HTMLParser/SGMLText.hpp 2010-11-10 23:10:07 UTC (rev 564)
+++ trunk/themis/modules/HTMLParser/SGMLText.hpp 2010-11-10 23:15:34 UTC (rev 565)
@@ -23,7 +23,7 @@
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- Original Author: Mark Hellegers (M.H...@st...)
+ Original Author: Mark Hellegers (ma...@fi...)
Project Start Date: October 18, 2000
Class Start Date: April 11, 2003
*/
@@ -31,7 +31,7 @@
/* SGMLText
Stores a piece of raw text from an entity
- Mark Hellegers (M.H...@st...)
+ Mark Hellegers (ma...@fi...)
11-04-2003
*/
Modified: trunk/themis/modules/MsgViewer/MsgView.cpp
===================================================================
--- trunk/themis/modules/MsgViewer/MsgView.cpp 2010-11-10 23:10:07 UTC (rev 564)
+++ trunk/themis/modules/MsgViewer/MsgView.cpp 2010-11-10 23:15:34 UTC (rev 565)
@@ -23,7 +23,7 @@
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- Original Author: Mark Hellegers (M.H...@st...)
+ Original Author: Mark Hellegers (ma...@fi...)
Project Start Date: October 18, 2000
Class Start Date: August 23, 2003
*/
Modified: trunk/themis/modules/MsgViewer/MsgView.hpp
===================================================================
--- trunk/themis/modules/MsgViewer/MsgView.hpp 2010-11-10 23:10:07 UTC (rev 564)
+++ trunk/themis/modules/MsgViewer/MsgView.hpp 2010-11-10 23:15:34 UTC (rev 565)
@@ -23,7 +23,7 @@
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- Original Author: Mark Hellegers (M.H...@st...)
+ Original Author: Mark Hellegers (ma...@fi...)
Project Start Date: October 18, 2000
Class Start Date: August 23, 2003
*/
Modified: trunk/themis/modules/MsgViewer/MsgViewer.cpp
===================================================================
--- trunk/themis/modules/MsgViewer/MsgViewer.cpp 2010-11-10 23:10:07 UTC (rev 564)
+++ trunk/themis/modules/MsgViewer/MsgViewer.cpp 2010-11-10 23:15:34 UTC (rev 565)
@@ -23,7 +23,7 @@
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- Original Author: Mark Hellegers (M.H...@st...)
+ Original Author: Mark Hellegers (ma...@fi...)
Project Start Date: October 18, 2000
Class Start Date: August 23, 2003
*/
Modified: trunk/themis/modules/MsgViewer/MsgViewer.hpp
===================================================================
--- trunk/themis/modules/MsgViewer/MsgViewer.hpp 2010-11-10 23:10:07 UTC (rev 564)
+++ trunk/themis/modules/MsgViewer/MsgViewer.hpp 2010-11-10 23:15:34 UTC (rev 565)
@@ -23,7 +23,7 @@
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- Original Author: Mark Hellegers (M.H...@st...)
+ Original Author: Mark Hellegers (ma...@fi...)
Project Start Date: October 18, 2000
Class Start Date: August 23, 2003
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-11-10 23:10:13
|
Revision: 564
http://themis.svn.sourceforge.net/themis/?rev=564&view=rev
Author: mark_hellegers
Date: 2010-11-10 23:10:07 +0000 (Wed, 10 Nov 2010)
Log Message:
-----------
No need to use a copy.
Modified Paths:
--------------
trunk/themis/modules/CSSViewer/CSSViewer.cpp
Modified: trunk/themis/modules/CSSViewer/CSSViewer.cpp
===================================================================
--- trunk/themis/modules/CSSViewer/CSSViewer.cpp 2010-11-04 22:43:21 UTC (rev 563)
+++ trunk/themis/modules/CSSViewer/CSSViewer.cpp 2010-11-10 23:10:07 UTC (rev 564)
@@ -161,14 +161,13 @@
aMessage->FindPointer("pointer", &document);
if (document) {
CSSStyleSheetPtr * temp = (CSSStyleSheetPtr *) document;
- CSSStyleSheetPtr copy = *temp;
if (!mView) {
- mView = new CSSView(copy);
+ mView = new CSSView(*temp);
}
else {
BAutolock viewLock(mView);
if (viewLock.IsLocked()) {
- mView->SetStyleSheet(copy);
+ mView->SetStyleSheet(*temp);
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-11-04 22:43:28
|
Revision: 563
http://themis.svn.sourceforge.net/themis/?rev=563&view=rev
Author: mark_hellegers
Date: 2010-11-04 22:43:21 +0000 (Thu, 04 Nov 2010)
Log Message:
-----------
Removed most of the printf statements. The parser doesn't need such extensive debugging output anymore.
Modified Paths:
--------------
trunk/themis/modules/HTMLParser/ElementParser.cpp
Modified: trunk/themis/modules/HTMLParser/ElementParser.cpp
===================================================================
--- trunk/themis/modules/HTMLParser/ElementParser.cpp 2010-11-03 22:55:11 UTC (rev 562)
+++ trunk/themis/modules/HTMLParser/ElementParser.cpp 2010-11-04 22:43:21 UTC (rev 563)
@@ -249,46 +249,30 @@
currentNode = mElmToken.getNode();
aParentNode->appendChild(currentNode);
mElmToken = nextElmToken();
- printf("Tag %s is correct here.\n", name.c_str());
}
else {
currentNode = mDocument->createElement(aDeclaration->getElementName());
aParentNode->appendChild(currentNode);
- printf("Skipping optional start tag.\n");
}
// Get the content rule.
TSchemaRulePtr rule = aDeclaration->getContent();
name = mElmToken.getName();
if (rule->hasToken(name)) {
- printf("Rule %s has token %s\n", rule->getTagName().c_str(), name.c_str());
found = parse(rule, currentNode);
- if (found) {
- printf("Content found correctly\n");
- }
- else {
- printf("Content was not correct\n");
- }
}
else if (rule->hasEmpty()) {
- printf("Skipping content in parseDeclaration for rule %s and token %s\n", rule->getTagName().c_str(), name.c_str());
+ // Doing nothing
}
- else {
- printf("Failed to find %s in rule %s\n", name.c_str(), rule->getTagName().c_str());
- }
// I don't think this should be here, but we will see what happens
if (mElmToken.getType() == END_TAG && (elementName == mElmToken.getName())) {
- printf("Found correct end tag: %s\n", elementName.c_str());
mElmToken = nextElmToken();
found = true;
}
else {
if (!end) {
- printf("End tag not required\n");
found = true;
}
else {
- printf("Found unknown token in end tag declaration part\n");
- printf("Expected %s, found %s\n", elementName.c_str(), mElmToken.getName().c_str());
found = false;
}
}
@@ -296,7 +280,7 @@
break;
}
default: {
- printf("Skipping element token in parseDeclaration\n");
+ break;
}
}
@@ -320,7 +304,6 @@
TSchemaRulePtr rule = shared_static_cast<TSchemaRule>(child);
if (rule->hasToken(name)) {
// Parse token with this rule.
- printf("Parsing token with rule %u in sequence part\n", i);
tokenFound = parse(rule, aParentNode);
name = mElmToken.getName();
if (tokenFound)
@@ -328,7 +311,6 @@
}
else if (rule->hasEmpty()) {
// We can skip it. It is optional.
- printf("Skipping optional sequence rule\n");
j++;
}
else
@@ -369,7 +351,6 @@
TSchemaRulePtr rule = shared_static_cast<TSchemaRule>(child);
if (rule->hasToken(name)) {
// Parse token with this rule.
- printf("Parsing token with rule %u in all part\n", i);
tokenFound = parse(rule, aParentNode);
name = mElmToken.getName();
if (tokenFound) {
@@ -411,11 +392,9 @@
found = parse(rule, aParentNode);
if (found) {
tokenName = mElmToken.getName();
- printf("Found correct |. Got next token name: %s\n", tokenName.c_str());
}
else {
tokenName = mElmToken.getName();
- printf("Sub |-rule not correct. Find the next one\n");
}
}
i++;
@@ -453,21 +432,13 @@
}
}
if (length > 0) {
- printf("Looking in normal content\n");
TNodePtr child = aRule->getFirstChild();
TSchemaRulePtr rule = shared_static_cast<TSchemaRule>(child);
found = parse(rule, aParentNode);
- if (found) {
- printf("Content found correctly in parseContent\n");
- }
- else {
- printf("Content was not correct in parseContent\n");
- }
}
// Hmm, there could still be exceptions.
// Loop until we can't find any anymore.
if (length > 1) {
- printf("Looking for any extra exceptions\n");
TNodePtr child = children->item(1);
TSchemaRulePtr rule = shared_static_cast<TSchemaRule>(child);
if (rule->getAttribute("type") == "+") {
@@ -487,13 +458,7 @@
}
}
}
- else {
- printf("Empty content unsupported right now\n");
- }
}
- else {
- printf("Unsupported content in parseContent\n");
- }
return found;
}
@@ -560,7 +525,6 @@
// We need to see if the rule contains the token we found.
TDOMString name = mElmToken.getName();
if (aRule->hasToken(name)) {
- printf("Rule %s contains %s\n", ruleName.c_str(), name.c_str());
if (ruleName == "declaration") {
TElementDeclarationPtr declaration = shared_static_cast<TElementDeclaration>(aRule);
tokenFound = parseDeclaration(declaration, aParentNode);
@@ -589,53 +553,42 @@
}
}
else if (aRule->hasEmpty()) {
- printf("Rule contains empty while looking for start tag %s\n", name.c_str());
tokenFound = false;
}
else {
- printf("Rule not found for start tag %s\n", name.c_str());
tokenFound = false;
}
break;
}
case TEXT: {
- printf("Found text\n");
TDOMString name = mElmToken.getName();
if (aRule->hasToken(name)) {
- printf("Rule %s contains %s\n", ruleName.c_str(), name.c_str());
if (ruleName == "declaration") {
- printf("Parsing text in declaration ?\n");
TElementDeclarationPtr declaration = shared_static_cast<TElementDeclaration>(aRule);
tokenFound = parseDeclaration(declaration, aParentNode);
}
else if (ruleName == "content") {
- printf("Parsing text in content\n");
tokenFound = parseContent(aRule, aParentNode);
}
else if (ruleName == name) {
- printf("Text is correct here.\n");
// Get the next element token and return true.
aParentNode->appendChild(mElmToken.getNode());
mElmToken = nextElmToken();
tokenFound = true;
}
else if (ruleName == "|") {
- printf("Parsing text in choice\n");
tokenFound = parseChoice(aRule, aParentNode);
}
else {
- printf("Skipping element token for text\n");
tokenFound = false;
}
}
else {
- printf("Hmmm\n");
tokenFound = false;
}
break;
}
default: {
- printf("Not doing anything with this token here\n");
tokenFound = false;
}
}
@@ -644,8 +597,6 @@
}
}
- printf("Ending parse rule %s\n", ruleName.c_str());
-
if (i > 0) {
// Found at least one instance, so found the rule.
found = true;
@@ -666,7 +617,6 @@
if (!aSkipSpace) {
elmToken = ElementToken(SPACE, mScanner->getTokenText());
mToken = mScanner->nextToken();
-// printf("Found space\n");
elmTokenFound = true;
}
@@ -680,33 +630,24 @@
TElementPtr element = parseStartTag();
TDOMString tagName = element->getTagName();
if (mSchema->hasDeclaration(tagName)) {
-// printf("Found start tag: %s\n", tagName.c_str());
elmToken = ElementToken(START_TAG, tagName, element);
elmTokenFound = true;
}
- else {
- printf("Found invalid start token: %s\n", tagName.c_str());
- }
break;
}
case ELEMENT_CLOSE_SYM: {
TDOMString tagName = parseEndTag();
if (mSchema->hasDeclaration(tagName)) {
-// printf("Found end tag: %s\n", tagName.c_str());
elmToken = ElementToken(END_TAG, tagName);
elmTokenFound = true;
}
- else {
- printf("Found invalid end token: %s\n", tagName.c_str());
- }
break;
}
case TEXT_SYM: {
TTextPtr text = mDocument->createText(mScanner->getTokenText());
elmToken = ElementToken(TEXT, "#PCDATA", text);
-// printf("Found text: %s\n", mScanner->getTokenText().c_str());
mToken = mScanner->nextToken();
elmTokenFound = true;
@@ -715,7 +656,6 @@
case RAW_TEXT_SYM: {
TTextPtr text = mDocument->createText(mScanner->getTokenText());
elmToken = ElementToken(TEXT, "CDATA", text);
-// printf("Found text: %s\n", mScanner->getTokenText().c_str());
mToken = mScanner->nextToken();
elmTokenFound = true;
@@ -741,7 +681,6 @@
break;
}
default: {
-// printf("Found unknown element token\n");
throw ReadException(mScanner->getLineNr(),
mScanner->getCharNr(),
"Unexpected token found: " + mScanner->getTokenText(),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-11-03 22:55:18
|
Revision: 562
http://themis.svn.sourceforge.net/themis/?rev=562&view=rev
Author: mark_hellegers
Date: 2010-11-03 22:55:11 +0000 (Wed, 03 Nov 2010)
Log Message:
-----------
Moved css parser preferences to the css parser module.
Modified Paths:
--------------
trunk/themis/framework/PrefsViews.cpp
trunk/themis/framework/PrefsViews.h
trunk/themis/framework/PrefsWin.cpp
trunk/themis/framework/app.cpp
trunk/themis/makefile
trunk/themis/modules/CSSParser/CSSParserPlugin.cpp
trunk/themis/modules/CSSParser/CSSParserPlugin.hpp
Added Paths:
-----------
trunk/themis/modules/CSSParser/CSSParserPrefsView.cpp
trunk/themis/modules/CSSParser/CSSParserPrefsView.hpp
Modified: trunk/themis/framework/PrefsViews.cpp
===================================================================
--- trunk/themis/framework/PrefsViews.cpp 2010-11-02 22:18:34 UTC (rev 561)
+++ trunk/themis/framework/PrefsViews.cpp 2010-11-03 22:55:11 UTC (rev 562)
@@ -335,106 +335,3 @@
mMainBox->AddChild(CookieBox);
}
-
-
-/*
- * CSSParserPrefsView
- */
-
-
-CSSParserPrefsView :: CSSParserPrefsView(BRect frame,
- const char* name)
- : BasePrefsView(frame,
- name) {
-
- /* CSS file selection */
- mPopUpMenu = new BPopUpMenu(
- "No CSS selected or available!",
- true,
- true,
- B_ITEMS_IN_COLUMN);
-
- /* find a CSS file */
- AppSettings->FindString(kPrefsSettingsDirectory, &mCSSDir);
- mCSSDir.Append("/css/");
- printf("CSS dir: %s\n", mCSSDir.String());
-
- BDirectory dir(mCSSDir.String());
- if(dir.InitCheck() != B_OK) {
- printf("CSS directory (%s) not found!\n", mCSSDir.String());
- printf("Setting CSSToUsePath to \"none\"\n");
- AppSettings->AddString(kPrefsActiveCSSPath, kNoCSSFoundString);
- }
- else {
- BString activeCSS;
- AppSettings->FindString(kPrefsActiveCSSPath, &activeCSS);
-
- BEntry entry;
- while(dir.GetNextEntry(&entry, false) != B_ENTRY_NOT_FOUND) {
- BPath path;
- entry.GetPath(&path);
- char name[B_FILE_NAME_LENGTH];
- entry.GetName(name);
-
- BString nstring(name);
- printf("----------------\n");
- printf("found CSS file: %s\n", nstring.String());
-
- /* add the file to the popupmenu */
- BMessage* msg = new BMessage(CSS_SELECTED);
- msg->AddString("CSSFileString", path.Path());
- BMenuItem* item = new BMenuItem(name, msg, 0, 0);
- mPopUpMenu->AddItem(item);
-
- // if the path of the current file equals the one of the settings,
- // mark the item
- if(strcmp(activeCSS.String(), path.Path() ) == 0) {
- printf("CSS from settings found -> SetMarked( true )\n");
- (mPopUpMenu->ItemAt(mPopUpMenu->CountItems() - 1))->SetMarked(true);
- }
- } // while
-
- }
- // end: find a CSS file
-
- BRect rect = mMainBox->Bounds();
- rect.InsetBy(kItemSpacing, kItemSpacing);
- rect.top += kBBoxExtraInset;
-
- BMenuField* cssmenufield = new BMenuField(
- rect,
- "CSSFIELD", "Cascading Style Sheet:",
- mPopUpMenu,
- true,
- B_FOLLOW_TOP,
- B_WILL_DRAW);
- cssmenufield->SetDivider(be_plain_font->StringWidth("Cascading Style Sheet:") + kItemSpacing);
- mMainBox->AddChild(cssmenufield);
-}
-
-void CSSParserPrefsView :: AttachedToWindow() {
-
- // if we found some CSS files, but still no CSS file is saved in the prefs,
- // or no CSS file is selected:
- // set the last found CSS file in the prefs. we save it to the prefs,
- // because the user might not reselect a CSS file in the list, which
- // would save the CSS file.
- BMessage imsg(CSS_SELECTED);
- BMessenger msgr(NULL, Window()->Looper());
- if (mPopUpMenu->CountItems() > 0) {
- if (mPopUpMenu->FindMarked() == NULL) {
- printf("no marked item found\n");
- BMenuItem* item = mPopUpMenu->ItemAt(mPopUpMenu->CountItems() - 1);
- item->SetMarked(true);
- // as we cannot invoke the item here, send the CSS_SELECTED message here
- BString cssstring(mCSSDir.String());
- cssstring.Append(item->Label());
- imsg.AddString("CSSFileString", cssstring.String());
- msgr.SendMessage(&imsg);
- }
- }
- else {
- imsg.AddString("CSSFileString", kNoCSSFoundString);
- msgr.SendMessage(&imsg);
- }
-}
Modified: trunk/themis/framework/PrefsViews.h
===================================================================
--- trunk/themis/framework/PrefsViews.h 2010-11-02 22:18:34 UTC (rev 561)
+++ trunk/themis/framework/PrefsViews.h 2010-11-03 22:55:11 UTC (rev 562)
@@ -52,24 +52,6 @@
};
-/*
- * CSS ParserPrefsView
- */
-
-
-class CSSParserPrefsView : public BasePrefsView {
-
- private:
- BPopUpMenu * mPopUpMenu;
- BString mCSSDir;
-
- public:
- CSSParserPrefsView(BRect frame,
- const char* name);
- virtual void AttachedToWindow();
-
-};
-
#endif
Modified: trunk/themis/framework/PrefsWin.cpp
===================================================================
--- trunk/themis/framework/PrefsWin.cpp 2010-11-02 22:18:34 UTC (rev 561)
+++ trunk/themis/framework/PrefsWin.cpp 2010-11-03 22:55:11 UTC (rev 562)
@@ -334,23 +334,6 @@
break;
}
- case CSS_SELECTED: {
- printf("PREFS: CSS_SELECTED\n");
-
- BString str;
- msg->FindString("CSSFileString", &str);
-
- AppSettings->ReplaceString(kPrefsActiveCSSPath, str.String());
-
- SaveAppSettings();
-
- /*
- * use the app to tell css parser about the CSS change.
- */
- be_app_messenger.SendMessage(CSS_CHANGED);
-
- break;
- }
default :
BWindow::MessageReceived(msg);
}
Modified: trunk/themis/framework/app.cpp
===================================================================
--- trunk/themis/framework/app.cpp 2010-11-02 22:18:34 UTC (rev 561)
+++ trunk/themis/framework/app.cpp 2010-11-03 22:55:11 UTC (rev 562)
@@ -266,15 +266,6 @@
break;
}
- case CSS_CHANGED :
- {
- printf( "APP CSS_CHANGED\n" );
- BMessage* chgmsg = new BMessage( CSS_CHANGED_PARSER );
- chgmsg->AddInt32( "command", COMMAND_INFO );
- Broadcast( MS_TARGET_PARSER, chgmsg );
- delete chgmsg;
- break;
- }
case PREFSWIN_CLOSE :
{
printf( "APP PREFSWIN_CLOSE\n" );
@@ -608,55 +599,6 @@
if( !AppSettings->HasInt8( kPrefsTabHistoryDepth ) )
AppSettings->AddInt8( kPrefsTabHistoryDepth, 10 );
- /* Prefs Parser */
- if( !AppSettings->HasString( kPrefsActiveCSSPath ) ||
- strcmp( AppSettings->FindString( kPrefsActiveCSSPath ), kNoCSSFoundString ) == 0 )
- {
- /* set our default */
- if( !AppSettings->HasString( kPrefsActiveCSSPath ) )
- AppSettings->AddString( kPrefsActiveCSSPath, kNoCSSFoundString );
-
- /* find a CSS file */
- BString cssdir;
- AppSettings->FindString( kPrefsSettingsDirectory, &cssdir );
- cssdir.Append( "/css/" );
- printf( "CSS dir: %s\n", cssdir.String() );
-
- BDirectory dir( cssdir.String() );
- if( dir.InitCheck() != B_OK )
- {
- printf( "CSS directory (%s) not found!\n", cssdir.String() );
- printf( "Setting kPrefsActiveCSSPath to \"none\"\n" );
- AppSettings->AddString( kPrefsActiveCSSPath, kNoCSSFoundString );
- }
- else
- {
- BEntry entry;
- while( dir.GetNextEntry( &entry, false ) != B_ENTRY_NOT_FOUND )
- {
- BPath path;
- entry.GetPath( &path );
- char name[B_FILE_NAME_LENGTH];
- entry.GetName( name );
-
- BString nstring( name );
- printf( "----------------\n" );
- printf( "found CSS file: %s\n", nstring.String() );
- if( AppSettings->HasString( kPrefsActiveCSSPath ) )
- {
- printf( "replacing kPrefsActiveCSSPath with: %s\n", path.Path() );
- AppSettings->ReplaceString( kPrefsActiveCSSPath, path.Path() );
- }
- else
- {
- printf( "adding kPrefsActiveCSSPath: %s\n", path.Path() );
- AppSettings->AddString( kPrefsActiveCSSPath, path.Path() );
- }
- }
- }
- /* end: find a CSS file */
- }
-
AppSettings->PrintToStream();
}
Modified: trunk/themis/makefile
===================================================================
--- trunk/themis/makefile 2010-11-02 22:18:34 UTC (rev 561)
+++ trunk/themis/makefile 2010-11-03 22:55:11 UTC (rev 562)
@@ -223,7 +223,8 @@
CSSParser/MediaAtRuleParser.cpp \
CSSParser/Position.cpp \
CSSParser/ReadException.cpp \
- CSSParser/RuleSetParser.cpp
+ CSSParser/RuleSetParser.cpp \
+ CSSParser/CSSParserPrefsView.cpp
DOMVIEWSOURCES= \
DOMView/DOMView.cpp \
Modified: trunk/themis/modules/CSSParser/CSSParserPlugin.cpp
===================================================================
--- trunk/themis/modules/CSSParser/CSSParserPlugin.cpp 2010-11-02 22:18:34 UTC (rev 561)
+++ trunk/themis/modules/CSSParser/CSSParserPlugin.cpp 2010-11-03 22:55:11 UTC (rev 562)
@@ -42,16 +42,20 @@
#include <algorithm>
#include <ctype.h>
-// Be headers
+// BeOS headers
#include <Message.h>
#include <DataIO.h>
+#include <storage/Directory.h>
-// CSSParser headers
-#include "CSSParserPlugin.hpp"
+// Themis headers
#include "commondefs.h"
#include "plugman.h"
#include "PrefsDefs.h"
+// CSSParser headers
+#include "CSSParserPlugin.hpp"
+#include "CSSParserPrefsView.hpp"
+
CSSParserPlugin * parser;
BMessage ** appSettings_p;
BMessage * appSettings;
@@ -104,6 +108,18 @@
// We only support one mimetype at the momemt.
mMimeTypes.push_back("text/css");
+
+ // Check the settings...
+ if(!appSettings->HasString(kPrefsCSSDirectory)) {
+ BString dir;
+ AppSettings->FindString(kPrefsSettingsDirectory, &dir);
+ dir.Append("/css");
+ AppSettings->AddString(kPrefsCSSDirectory, dir.String());
+ BEntry ent(dir.String(), true);
+ if (!ent.Exists()) {
+ create_directory(dir.String(), 0555);
+ }
+ }
}
@@ -269,7 +285,27 @@
void CSSParserPlugin :: MessageReceived(BMessage * aMessage) {
- BHandler::MessageReceived(aMessage);
+ switch (aMessage->what) {
+ case CSS_CHANGED_PARSER: {
+ Debug("Request to change base css file", PlugID());
+ if (appSettings != NULL) {
+ const char * path;
+ appSettings->FindString(kPrefsActiveCSSPath, &path);
+ string cssLoad = "Loading new CSS file: ";
+ cssLoad += path;
+ printf("%s\n", cssLoad.c_str());
+ Debug(cssLoad.c_str(), PlugID());
+ CSSStyleSheetPtr document = mParser->parse(path);
+ mDocuments.push_back(document);
+ NotifyParseFinished(mDocuments.end() - 1, "cssdom", aMessage);
+ }
+ break;
+ }
+ default: {
+ BHandler::MessageReceived(aMessage);
+ break;
+ }
+ }
}
@@ -305,7 +341,7 @@
float CSSParserPlugin :: PlugVersion() {
- return 0.2;
+ return 0.3;
}
@@ -341,21 +377,6 @@
}
break;
}
- case CSS_CHANGED_PARSER: {
- Debug("Request to change base css file", PlugID());
- if (appSettings != NULL) {
- const char * path;
- appSettings->FindString(kPrefsActiveCSSPath, &path);
- string cssLoad = "Loading new CSS file: ";
- cssLoad += path;
- printf("%s\n", cssLoad.c_str());
- Debug(cssLoad.c_str(), PlugID());
- CSSStyleSheetPtr document = mParser->parse(path);
- mDocuments.push_back(document);
- NotifyParseFinished(mDocuments.end() - 1, "cssdom", aMessage);
- }
- break;
- }
case SH_PARSE_DOC_FINISHED: {
BString type;
aMessage->FindString("type", &type);
@@ -407,3 +428,19 @@
return TARGET_PARSER;
}
+
+char * CSSParserPlugin :: SettingsViewLabel() {
+
+ return "CSS Parser";
+}
+
+BView * CSSParserPlugin :: SettingsView(BRect aFrame) {
+
+ CSSParserPrefsView * view = new CSSParserPrefsView(
+ aFrame,
+ "CSS Parser",
+ this);
+
+ return view;
+
+}
Modified: trunk/themis/modules/CSSParser/CSSParserPlugin.hpp
===================================================================
--- trunk/themis/modules/CSSParser/CSSParserPlugin.hpp 2010-11-02 22:18:34 UTC (rev 561)
+++ trunk/themis/modules/CSSParser/CSSParserPlugin.hpp 2010-11-03 22:55:11 UTC (rev 562)
@@ -112,6 +112,8 @@
status_t BroadcastReply(BMessage * aMessage);
uint32 BroadcastTarget();
int32 Type();
+ char * SettingsViewLabel();
+ BView * SettingsView(BRect aFrame);
};
Added: trunk/themis/modules/CSSParser/CSSParserPrefsView.cpp
===================================================================
--- trunk/themis/modules/CSSParser/CSSParserPrefsView.cpp (rev 0)
+++ trunk/themis/modules/CSSParser/CSSParserPrefsView.cpp 2010-11-03 22:55:11 UTC (rev 562)
@@ -0,0 +1,158 @@
+/*
+ Copyright (c) 2010 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: November 03, 2010
+*/
+
+/* CSSParserPrefsView implementation
+ See CSSParserPrefsView.hpp for more information
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// BeOS headers
+#include <interface/Window.h>
+#include <interface/Box.h>
+#include <interface/PopUpMenu.h>
+#include <interface/MenuItem.h>
+#include <interface/MenuField.h>
+#include <storage/Directory.h>
+#include <storage/Entry.h>
+#include <storage/Path.h>
+
+// Themis headers
+#include "commondefs.h"
+#include "PrefsDefs.h"
+#include "plugclass.h"
+
+
+// CSSParser headers
+#include "CSSParserPrefsView.hpp"
+
+CSSParserPrefsView :: CSSParserPrefsView(BRect aFrame,
+ const char* aName,
+ BHandler * aPlugin)
+ : BasePrefsView(aFrame,
+ aName) {
+
+ mPlugin = aPlugin;
+
+ /* CSS file selection */
+ mPopUpMenu = new BPopUpMenu(
+ "No CSS selected or available!",
+ true,
+ true,
+ B_ITEMS_IN_COLUMN);
+
+ /* find a CSS file */
+ AppSettings->FindString(kPrefsSettingsDirectory, &mCSSDir);
+ mCSSDir.Append("/css/");
+ printf("CSS dir: %s\n", mCSSDir.String());
+
+ BDirectory dir(mCSSDir.String());
+ if(dir.InitCheck() != B_OK) {
+ printf("CSS directory (%s) not found!\n", mCSSDir.String());
+ printf("Setting CSSToUsePath to \"none\"\n");
+ AppSettings->AddString(kPrefsActiveCSSPath, kNoCSSFoundString);
+ }
+ else {
+ BString activeCSS;
+ AppSettings->FindString(kPrefsActiveCSSPath, &activeCSS);
+
+ BEntry entry;
+ while(dir.GetNextEntry(&entry, false) != B_ENTRY_NOT_FOUND) {
+ BPath path;
+ entry.GetPath(&path);
+ char name[B_FILE_NAME_LENGTH];
+ entry.GetName(name);
+
+ BString nstring(name);
+ printf("----------------\n");
+ printf("found CSS file: %s\n", nstring.String());
+
+ /* add the file to the popupmenu */
+ BMessage* msg = new BMessage(CSS_CHANGED_PARSER);
+ msg->AddString("CSSFileString", path.Path());
+ BMenuItem* item = new BMenuItem(name, msg, 0, 0);
+ item->SetTarget(mPlugin);
+ mPopUpMenu->AddItem(item);
+
+ // if the path of the current file equals the one of the settings,
+ // mark the item
+ if(strcmp(activeCSS.String(), path.Path() ) == 0) {
+ printf("CSS from settings found -> SetMarked( true )\n");
+ (mPopUpMenu->ItemAt(mPopUpMenu->CountItems() - 1))->SetMarked(true);
+ }
+ } // while
+
+ }
+ // end: find a CSS file
+
+ BRect rect = mMainBox->Bounds();
+ rect.InsetBy(kItemSpacing, kItemSpacing);
+ rect.top += kBBoxExtraInset;
+
+ BMenuField* cssmenufield = new BMenuField(
+ rect,
+ "CSSFIELD", "Cascading Style Sheet:",
+ mPopUpMenu,
+ true,
+ B_FOLLOW_TOP,
+ B_WILL_DRAW);
+ cssmenufield->SetDivider(be_plain_font->StringWidth("Cascading Style Sheet:") + kItemSpacing);
+ mMainBox->AddChild(cssmenufield);
+
+}
+
+void CSSParserPrefsView :: AttachedToWindow() {
+
+ // if we found some CSS files, but still no CSS file is saved in the prefs,
+ // or no CSS file is selected:
+ // set the last found CSS file in the prefs. we save it to the prefs,
+ // because the user might not reselect a CSS file in the list, which
+ // would save the CSS file.
+ BMessage msg(CSS_CHANGED_PARSER);
+ BMessenger msgr(mPlugin);
+ if (mPopUpMenu->CountItems() > 0) {
+ if (mPopUpMenu->FindMarked() == NULL) {
+ printf("no marked item found\n");
+ BMenuItem* item = mPopUpMenu->ItemAt(mPopUpMenu->CountItems() - 1);
+ item->SetMarked(true);
+ // as we cannot invoke the item here, send the CSS_SELECTED message here
+ BString cssstring(mCSSDir.String());
+ cssstring.Append(item->Label());
+ msg.AddString("CSSFileString", cssstring.String());
+ msgr.SendMessage(&msg);
+ }
+ }
+ else {
+ msg.AddString("CSSFileString", kNoCSSFoundString);
+ msgr.SendMessage(&msg);
+ }
+
+}
Added: trunk/themis/modules/CSSParser/CSSParserPrefsView.hpp
===================================================================
--- trunk/themis/modules/CSSParser/CSSParserPrefsView.hpp (rev 0)
+++ trunk/themis/modules/CSSParser/CSSParserPrefsView.hpp 2010-11-03 22:55:11 UTC (rev 562)
@@ -0,0 +1,73 @@
+/*
+ Copyright (c) 2010 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: October 31, 2010
+*/
+
+/* HTMLParserPrefsView
+ Contains the preferences view for the HTML parser addon.
+
+ Mark Hellegers (ma...@fi...)
+ 03-11-2010
+*/
+
+#ifndef CSSPARSERPREFSVIEW_HPP
+#define CSSPARSERPREFSVIEW_HPP
+
+// BeOS headers
+#include <String.h>
+
+// Themis headers
+#include "BasePrefsView.hpp"
+
+// Declarations used
+class BPopUpMenu;
+class BHandler;
+
+/// Class to view the preferences of the CSS parser addon.
+
+/**
+ This class is a view of the preferences of the CSS parser addon.
+*/
+
+class CSSParserPrefsView : public BasePrefsView {
+
+ private:
+ BPopUpMenu * mPopUpMenu;
+ BString mCSSDir;
+ BHandler * mPlugin;
+
+ public:
+ CSSParserPrefsView(BRect aFrame,
+ const char* aName,
+ BHandler * aPlugin);
+ virtual void AttachedToWindow();
+
+};
+
+#endif
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-11-02 22:18:40
|
Revision: 561
http://themis.svn.sourceforge.net/themis/?rev=561&view=rev
Author: mark_hellegers
Date: 2010-11-02 22:18:34 +0000 (Tue, 02 Nov 2010)
Log Message:
-----------
Removed commented out code that will never be used again.
Modified Paths:
--------------
trunk/themis/framework/app.cpp
Modified: trunk/themis/framework/app.cpp
===================================================================
--- trunk/themis/framework/app.cpp 2010-11-02 22:13:43 UTC (rev 560)
+++ trunk/themis/framework/app.cpp 2010-11-02 22:18:34 UTC (rev 561)
@@ -713,22 +713,6 @@
return fIDCounter;
}
-//TRenderView*
-//App::GetRenderViewFor(
-// int32 id )
-//{
-// /*
-// * Cycle through every window, searching every tabview/tab for the given
-// * ID, and return a pointer to this view. Otherwise, return NULL.
-// */
-//
-// fLocker->Lock();
-//
-//
-// fLocker->Unlock();
-// return NULL;
-//}
-
SiteHandler*
App::GetSiteHandler()
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-11-02 22:13:49
|
Revision: 560
http://themis.svn.sourceforge.net/themis/?rev=560&view=rev
Author: mark_hellegers
Date: 2010-11-02 22:13:43 +0000 (Tue, 02 Nov 2010)
Log Message:
-----------
Removed code for the network and renderer settings. They didn't do anything and now need to be implemented by the addons themselves.
Modified Paths:
--------------
trunk/themis/framework/PrefsViews.cpp
trunk/themis/framework/PrefsViews.h
Modified: trunk/themis/framework/PrefsViews.cpp
===================================================================
--- trunk/themis/framework/PrefsViews.cpp 2010-11-02 21:49:11 UTC (rev 559)
+++ trunk/themis/framework/PrefsViews.cpp 2010-11-02 22:13:43 UTC (rev 560)
@@ -197,18 +197,6 @@
}
/*
- * NetworkPrefsView
- */
-
-
-NetworkPrefsView :: NetworkPrefsView(BRect frame,
- const char* name)
- : BasePrefsView(frame,
- name) {
-}
-
-
-/*
* PrivacyPrefsView
*/
@@ -450,15 +438,3 @@
msgr.SendMessage(&imsg);
}
}
-
-/*
- * RendererPrefsView
- */
-
-
-RendererPrefsView :: RendererPrefsView(BRect frame,
- const char* name)
- : BasePrefsView(frame,
- name) {
-}
-
Modified: trunk/themis/framework/PrefsViews.h
===================================================================
--- trunk/themis/framework/PrefsViews.h 2010-11-02 21:49:11 UTC (rev 559)
+++ trunk/themis/framework/PrefsViews.h 2010-11-02 22:13:43 UTC (rev 560)
@@ -39,20 +39,6 @@
/*
- * NetworkPrefsView
- */
-
-
-class NetworkPrefsView : public BasePrefsView {
-
- public:
- NetworkPrefsView(BRect frame,
- const char* name);
-
-};
-
-
-/*
* PrivacyPrefsView
*/
@@ -84,19 +70,6 @@
};
-/*
- * RendererPrefsView
- */
-
-
-class RendererPrefsView : public BasePrefsView {
-
- public:
- RendererPrefsView(BRect frame,
- const char* name);
-
-};
-
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-11-02 21:49:17
|
Revision: 559
http://themis.svn.sourceforge.net/themis/?rev=559&view=rev
Author: mark_hellegers
Date: 2010-11-02 21:49:11 +0000 (Tue, 02 Nov 2010)
Log Message:
-----------
Fixed warnings.
Modified Paths:
--------------
trunk/themis/framework/PrefsWin.cpp
Modified: trunk/themis/framework/PrefsWin.cpp
===================================================================
--- trunk/themis/framework/PrefsWin.cpp 2010-11-02 21:45:33 UTC (rev 558)
+++ trunk/themis/framework/PrefsWin.cpp 2010-11-02 21:49:11 UTC (rev 559)
@@ -104,8 +104,6 @@
&typeFound,
&countFound);
if (status == B_OK) {
-
- const char * name;
PlugClass * plugin;
BView * view = NULL;
for (int32 i = 0; i < countFound; i++) {
@@ -428,7 +426,6 @@
fListView->SetFontSize( 12.0 );
/* add the list items */
- int32 i = 0;
fListView->AddItem(
new PrefsListItem(
"Window",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-11-02 21:45:39
|
Revision: 558
http://themis.svn.sourceforge.net/themis/?rev=558&view=rev
Author: mark_hellegers
Date: 2010-11-02 21:45:33 +0000 (Tue, 02 Nov 2010)
Log Message:
-----------
Added necessary include
Modified Paths:
--------------
trunk/themis/framework/ThemisUrlPopUpWindow.cpp
Modified: trunk/themis/framework/ThemisUrlPopUpWindow.cpp
===================================================================
--- trunk/themis/framework/ThemisUrlPopUpWindow.cpp 2010-11-02 21:39:38 UTC (rev 557)
+++ trunk/themis/framework/ThemisUrlPopUpWindow.cpp 2010-11-02 21:45:33 UTC (rev 558)
@@ -8,6 +8,7 @@
// myheaders
#include "ThemisUrlPopUpWindow.h"
+#include "ThemisUrlView.h"
#include "win.h"
#include "../common/commondefs.h"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-11-02 21:39:45
|
Revision: 557
http://themis.svn.sourceforge.net/themis/?rev=557&view=rev
Author: mark_hellegers
Date: 2010-11-02 21:39:38 +0000 (Tue, 02 Nov 2010)
Log Message:
-----------
- Changed the preferences to make them more dynamic. It now checks the list of addons for preferences instead of showing a hardcoded list.
- Removed hardcoded reference to /boot/home/config/settings
Modified Paths:
--------------
trunk/themis/framework/PrefsViews.cpp
trunk/themis/framework/PrefsViews.h
trunk/themis/framework/PrefsWin.cpp
trunk/themis/framework/PrefsWin.h
trunk/themis/framework/app.cpp
Modified: trunk/themis/framework/PrefsViews.cpp
===================================================================
--- trunk/themis/framework/PrefsViews.cpp 2010-11-02 21:37:42 UTC (rev 556)
+++ trunk/themis/framework/PrefsViews.cpp 2010-11-02 21:39:38 UTC (rev 557)
@@ -26,29 +26,6 @@
/*
- * BasePrefsView
- */
-
-
-BasePrefsView :: BasePrefsView(BRect frame,
- const char* name)
- : BView(frame,
- name,
- B_FOLLOW_ALL,
- 0) {
-
- fMainBox = new BBox(
- Bounds(),
- "MainBox",
- B_FOLLOW_ALL);
- fMainBox->SetLabel(Name());
- AddChild(fMainBox);
-
- SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
-
-}
-
-/*
* WindowPrefsView
*/
@@ -75,7 +52,7 @@
homepage->SetModificationMessage(new BMessage(HOMEPAGE_CHANGED));
homepage->SetDivider(be_plain_font->StringWidth("Home Page:") + kDividerSpacing);
homepage->SetText(str.String());
- fMainBox->AddChild(homepage);
+ mMainBox->AddChild(homepage);
/* blank button */
rect.top = homepage->Frame().bottom + kItemSpacing;
@@ -92,7 +69,7 @@
blankbtn->MoveTo(
homepage->Frame().right - blankbtn->Bounds().Width(),
blankbtn->Frame().top );
- fMainBox->AddChild(blankbtn);
+ mMainBox->AddChild(blankbtn);
/* intelligent zoom */
rect.left = Bounds().left + kItemSpacing;
@@ -109,7 +86,7 @@
IZcbox->SetValue(0);
else
IZcbox->SetValue(1);
- fMainBox->AddChild(IZcbox);
+ mMainBox->AddChild(IZcbox);
/* type ahead */
rect.top = IZcbox->Frame().bottom + kItemSpacing;
@@ -122,7 +99,7 @@
bool ShowTypeAhead = false;
AppSettings->FindBool(kPrefsShowTypeAheadWindow, &ShowTypeAhead);
ShowTypeAhead ? ShowTypeAheadbox->SetValue(1) : ShowTypeAheadbox->SetValue(0);
- fMainBox->AddChild(ShowTypeAheadbox);
+ mMainBox->AddChild(ShowTypeAheadbox);
/* show tabs */
rect.top = ShowTypeAheadbox->Frame().bottom + kItemSpacing;
@@ -135,7 +112,7 @@
bool ShowTabs = false;
AppSettings->FindBool(kPrefsShowTabsAtStartup, &ShowTabs);
ShowTabs ? ShowTabscbox->SetValue(1) : ShowTabscbox->SetValue(0);
- fMainBox->AddChild(ShowTabscbox);
+ mMainBox->AddChild(ShowTabscbox);
/* open tabs in background */
rect.top = ShowTabscbox->Frame().bottom + kItemSpacing;
@@ -148,7 +125,7 @@
bool OpenInBackground = false;
AppSettings->FindBool(kPrefsOpenTabsInBackground, &OpenInBackground);
OpenInBackground ? OpenTabsInBackgroundcbox->SetValue(1) : OpenTabsInBackgroundcbox->SetValue(0);
- fMainBox->AddChild( OpenTabsInBackgroundcbox );
+ mMainBox->AddChild( OpenTabsInBackgroundcbox );
/* open blank targets in tab (instead of new window) */
rect.top = OpenTabsInBackgroundcbox->Frame().bottom + kItemSpacing;
@@ -161,7 +138,7 @@
bool OpenBlankInTab = false;
AppSettings->FindBool(kPrefsOpenBlankTargetInTab, &OpenBlankInTab);
OpenBlankInTab ? OpenBlankTargetInTab_CBox->SetValue(1) : OpenBlankTargetInTab_CBox->SetValue(0);
- fMainBox->AddChild(OpenBlankTargetInTab_CBox);
+ mMainBox->AddChild(OpenBlankTargetInTab_CBox);
/* new windows open with ... */
rect = Bounds();
@@ -170,7 +147,7 @@
rect.bottom = rect.top + 100;
BBox * newInPageBox = new BBox(rect, "NEWWINPAGEBOX");
newInPageBox->SetLabel("New Windows open with ...");
- fMainBox->AddChild(newInPageBox);
+ mMainBox->AddChild(newInPageBox);
/* blank page */
rect = newInPageBox->Bounds();
@@ -241,7 +218,7 @@
: BasePrefsView(frame,
name) {
- BRect rect = fMainBox->Bounds();
+ BRect rect = mMainBox->Bounds();
rect.InsetBy(kItemSpacing, kItemSpacing);
rect.top += kBBoxExtraInset;
@@ -251,7 +228,7 @@
rect,
"historyBox");
historyBox->SetLabel("History");
- fMainBox->AddChild(historyBox);
+ mMainBox->AddChild(historyBox);
/* history depth */
rect = historyBox->Bounds();
@@ -359,7 +336,7 @@
rect.bottom = rect.top + 100;
BBox* CacheBox = new BBox(rect, "CACHEBOX");
CacheBox->SetLabel("Cache");
- fMainBox->AddChild(CacheBox);
+ mMainBox->AddChild(CacheBox);
/* cookie box */
rect = CacheBox->Frame();
@@ -367,117 +344,12 @@
rect.bottom = rect.top + 100;
BBox* CookieBox = new BBox(rect, "COOKIEBOX");
CookieBox->SetLabel("Cookies");
- fMainBox->AddChild(CookieBox);
+ mMainBox->AddChild(CookieBox);
}
/*
- * HTMLParserPrefsView
- */
-
-
-HTMLParserPrefsView :: HTMLParserPrefsView(BRect frame,
- const char* name)
- : BasePrefsView(frame,
- name) {
-
- /* DTD selection */
- mPopUpMenu = new BPopUpMenu(
- "No DTD selected or available!",
- true,
- true,
- B_ITEMS_IN_COLUMN);
-
- /* find a DTD */
- AppSettings->FindString(kPrefsSettingsDirectory, &mDTDDir);
- mDTDDir.Append("/dtd/");
- printf("DTD dir: %s\n", mDTDDir.String());
-
- BDirectory dir(mDTDDir.String());
- if(dir.InitCheck() != B_OK) {
- printf("DTD directory (%s) not found!\n", mDTDDir.String());
- printf("Setting DTDToUsePath to \"none\"\n");
- AppSettings->AddString(kPrefsActiveDTDPath, kNoDTDFoundString);
- }
- else {
- BString activeDTD;
- AppSettings->FindString(kPrefsActiveDTDPath, &activeDTD);
-
- BEntry entry;
- while(dir.GetNextEntry(&entry, false) != B_ENTRY_NOT_FOUND) {
- BPath path;
- entry.GetPath(&path);
- char name[B_FILE_NAME_LENGTH];
- entry.GetName(name);
-
- BString nstring(name);
- printf("----------------\n");
- printf("found file: %s\n", nstring.String());
- if(nstring.IFindFirst("DTD", nstring.Length() - 3) != B_ERROR) {
- printf("found DTD file: %s\n", nstring.String());
-
- /* add the file to the popupmenu */
- BMessage* msg = new BMessage(DTD_SELECTED);
- msg->AddString("DTDFileString", path.Path());
- BMenuItem* item = new BMenuItem(name, msg, 0, 0);
- mPopUpMenu->AddItem(item);
-
- // if the path of the current file equals the one of the settings,
- // mark the item
- if(strcmp(activeDTD.String(), path.Path()) == 0) {
- printf("DTD from settings found -> SetMarked( true )\n");
- (mPopUpMenu->ItemAt(mPopUpMenu->CountItems() - 1))->SetMarked(true);
- }
- }
- } // while
-
- }
- // end: find a DTD
- BRect rect = fMainBox->Bounds();
- rect.InsetBy(kItemSpacing, kItemSpacing);
- rect.top += kBBoxExtraInset;
-
- BMenuField* dtdmenufield = new BMenuField(
- rect,
- "DTDFIELD", "Document Type Definition:",
- mPopUpMenu,
- true,
- B_FOLLOW_TOP,
- B_WILL_DRAW);
- dtdmenufield->SetDivider(be_plain_font->StringWidth("Document Type Definition:") + kItemSpacing);
- fMainBox->AddChild(dtdmenufield);
-
-}
-
-void HTMLParserPrefsView :: AttachedToWindow() {
-
- // if we found some DTDs, but still no DTD is saved in the prefs,
- // or no DTD is selected:
- // set the last found DTD in the prefs. we save it to the prefs,
- // because the user might not reselect a DTD in the list, which
- // would save the DTD.
- BMessage imsg(DTD_SELECTED);
- BMessenger msgr(NULL, Window()->Looper());
- if(mPopUpMenu->CountItems() > 0) {
- if(mPopUpMenu->FindMarked() == NULL) {
- printf("no marked item found\n");
- BMenuItem* item = mPopUpMenu->ItemAt(mPopUpMenu->CountItems() - 1);
- item->SetMarked(true);
- // as we cannot invoke the item here, send the DTD_SELECTED message here
- BString dtdstring(mDTDDir.String());
- dtdstring.Append(item->Label());
- imsg.AddString("DTDFileString", dtdstring.String());
- msgr.SendMessage(&imsg);
- }
- }
- else {
- imsg.AddString("DTDFileString", kNoDTDFoundString);
- msgr.SendMessage(&imsg);
- }
-}
-
-/*
* CSSParserPrefsView
*/
@@ -537,7 +409,7 @@
}
// end: find a CSS file
- BRect rect = fMainBox->Bounds();
+ BRect rect = mMainBox->Bounds();
rect.InsetBy(kItemSpacing, kItemSpacing);
rect.top += kBBoxExtraInset;
@@ -549,7 +421,7 @@
B_FOLLOW_TOP,
B_WILL_DRAW);
cssmenufield->SetDivider(be_plain_font->StringWidth("Cascading Style Sheet:") + kItemSpacing);
- fMainBox->AddChild(cssmenufield);
+ mMainBox->AddChild(cssmenufield);
}
void CSSParserPrefsView :: AttachedToWindow() {
Modified: trunk/themis/framework/PrefsViews.h
===================================================================
--- trunk/themis/framework/PrefsViews.h 2010-11-02 21:37:42 UTC (rev 556)
+++ trunk/themis/framework/PrefsViews.h 2010-11-02 21:39:38 UTC (rev 557)
@@ -11,8 +11,10 @@
#include <View.h>
#include <String.h>
+// Themis headers
+#include "BasePrefsView.hpp"
+
// Declarations used
-class BBox;
class BPopUpMenu;
/*
@@ -22,18 +24,6 @@
class WindowPrefsView;
-class BasePrefsView : public BView {
-
- protected:
- BBox * fMainBox;
-
- public:
- BasePrefsView(BRect frame,
- const char* name);
-
-};
-
-
/*
* WindowPrefsView
*/
@@ -77,25 +67,6 @@
/*
- * HTML ParserPrefsView
- */
-
-
-class HTMLParserPrefsView : public BasePrefsView {
-
- private:
- BPopUpMenu * mPopUpMenu;
- BString mDTDDir;
-
- public:
- HTMLParserPrefsView(BRect frame,
- const char* name);
- virtual void AttachedToWindow();
-
-};
-
-
-/*
* CSS ParserPrefsView
*/
Modified: trunk/themis/framework/PrefsWin.cpp
===================================================================
--- trunk/themis/framework/PrefsWin.cpp 2010-11-02 21:37:42 UTC (rev 556)
+++ trunk/themis/framework/PrefsWin.cpp 2010-11-02 21:39:38 UTC (rev 557)
@@ -34,8 +34,8 @@
};
-PrefsWin :: PrefsWin(BRect frame)
- : BWindow(frame,
+PrefsWin :: PrefsWin(BRect aFrame, BMessage * aPluginList)
+ : BWindow(aFrame,
"Preferences",
B_TITLED_WINDOW_LOOK,
B_NORMAL_WINDOW_FEEL,
@@ -58,7 +58,7 @@
rect.InsetBy(kItemSpacing, kItemSpacing);
rect.right = rect.left + 100;
- fPrefsListView = new PrefsListView(rect);
+ fPrefsListView = new PrefsListView(rect, aPluginList);
fBackgroundView->AddChild(fPrefsListView);
/* calculate the view frame */
@@ -67,8 +67,8 @@
rect.left = fPrefsListView->Frame().right + kItemSpacing;
fViewFrame = rect;
- CreatePrefViews();
-
+ CreatePrefViews(aPluginList);
+
Show();
}
@@ -82,11 +82,11 @@
printf("Deleting preferences views\n");
for (unsigned int i = 0; i < mPrefViews.size(); i++) {
delete mPrefViews[i];
- }
+ }
}
-void PrefsWin :: CreatePrefViews() {
+void PrefsWin :: CreatePrefViews(BMessage * aPluginList) {
printf("Creating preferences views\n");
@@ -94,22 +94,30 @@
new WindowPrefsView(fViewFrame,
kPrefsItems[0].name));
mPrefViews.push_back(
- new NetworkPrefsView(fViewFrame,
- kPrefsItems[1].name));
- mPrefViews.push_back(
new PrivacyPrefsView(fViewFrame,
kPrefsItems[2].name));
- mPrefViews.push_back(
- new HTMLParserPrefsView(fViewFrame,
- kPrefsItems[3].name));
- mPrefViews.push_back(
- new CSSParserPrefsView(fViewFrame,
- kPrefsItems[4].name));
- mPrefViews.push_back(
- new RendererPrefsView(fViewFrame,
- kPrefsItems[5].name));
+
+ int32 countFound;
+ type_code typeFound;
+ status_t status = aPluginList->GetInfo(
+ "plug_name",
+ &typeFound,
+ &countFound);
+ if (status == B_OK) {
-
+ const char * name;
+ PlugClass * plugin;
+ BView * view = NULL;
+ for (int32 i = 0; i < countFound; i++) {
+ aPluginList->FindPointer("plug_object", i, (void **)&plugin);
+ view = plugin->SettingsView(fViewFrame);
+ if (view != NULL) {
+ mPrefViews.push_back(view);
+
+ }
+ }
+ }
+
}
void PrefsWin :: MessageReceived(BMessage* msg) {
@@ -117,7 +125,6 @@
switch(msg->what) {
case LIST_SELECTION_CHANGED: {
int32 selection = fPrefsListView->CurrentSelection();
-
/*
* if the user presses in the empty area, we ignore this,
* but the BListView does take away the focus from the curent
@@ -135,8 +142,10 @@
fCurrentPrefsView = NULL;
}
- fCurrentPrefsView = mPrefViews[selection];
- fBackgroundView->AddChild(fCurrentPrefsView);
+ if ((unsigned int)selection < mPrefViews.size()) {
+ fCurrentPrefsView = mPrefViews[selection];
+ fBackgroundView->AddChild(fCurrentPrefsView);
+ }
}
}
@@ -327,23 +336,6 @@
break;
}
- case DTD_SELECTED: {
- printf("PREFS: DTD_SELECTED\n");
-
- BString str;
- msg->FindString("DTDFileString", &str);
-
- AppSettings->ReplaceString(kPrefsActiveDTDPath, str.String());
-
- SaveAppSettings();
-
- /*
- * use the app to tell html parser about the DTD change.
- */
- be_app_messenger.SendMessage(DTD_CHANGED);
-
- break;
- }
case CSS_SELECTED: {
printf("PREFS: CSS_SELECTED\n");
@@ -391,11 +383,14 @@
*/
-PrefsListView :: PrefsListView(BRect frame)
- : BView(frame,
+PrefsListView :: PrefsListView(BRect aFrame, BMessage * aPluginList)
+ : BView(aFrame,
"PrefsListView",
0,
0) {
+
+ mPluginList = aPluginList;
+
}
PrefsListView :: ~PrefsListView() {
@@ -405,6 +400,9 @@
delete fListView->RemoveItem((int32) 0);
}
fListView->MakeEmpty();
+
+ delete mPluginList;
+
}
void PrefsListView :: AttachedToWindow() {
@@ -428,18 +426,50 @@
/* I want a font size of 12.0 */
fListView->SetFontSize( 12.0 );
-
+
/* add the list items */
int32 i = 0;
- while(kPrefsItems[i].name != NULL) {
- fListView->AddItem(
- new PrefsListItem(
- kPrefsItems[i].name,
- kPrefsItems[i].bitmap));
-
- i++;
- }
+ fListView->AddItem(
+ new PrefsListItem(
+ "Window",
+ kPrefsIconGeneral));
+ fListView->AddItem(
+ new PrefsListItem(
+ "Privacy",
+ kPrefsIconPrivacy));
+ int32 countFound;
+ type_code typeFound;
+ status_t status = mPluginList->GetInfo(
+ "plug_name",
+ &typeFound,
+ &countFound);
+ if (status == B_OK) {
+ int32 type;
+ const char * name;
+ PlugClass * plugin;
+ for (int32 i = 0; i < countFound; i++) {
+ mPluginList->FindPointer("plug_object", i, (void **)&plugin);
+ type = plugin->Type();
+ name = plugin->SettingsViewLabel();
+ if (name != NULL) {
+ if (type != TARGET_PARSER) {
+ fListView->AddItem(
+ new PrefsListItem(
+ name,
+ kPrefsIconParser));
+
+ }
+ else {
+ fListView->AddItem(
+ new PrefsListItem(
+ name,
+ kPrefsIconGeneral));
+ }
+ }
+ }
+ }
+
fListView->SetSelectionMessage(new BMessage(LIST_SELECTION_CHANGED));
fListView->MakeFocus(true);
Modified: trunk/themis/framework/PrefsWin.h
===================================================================
--- trunk/themis/framework/PrefsWin.h 2010-11-02 21:37:42 UTC (rev 556)
+++ trunk/themis/framework/PrefsWin.h 2010-11-02 21:39:38 UTC (rev 557)
@@ -29,11 +29,11 @@
BRect fViewFrame;
vector<BView *> mPrefViews;
- void CreatePrefViews();
+ void CreatePrefViews(BMessage * aPluginList);
void SaveAppSettings();
public:
- PrefsWin(BRect frame);
+ PrefsWin(BRect aFrame, BMessage * aPluginList);
virtual ~PrefsWin();
virtual void MessageReceived(BMessage* msg);
virtual bool QuitRequested();
@@ -58,9 +58,10 @@
private:
BListView * fListView;
BBox * fBox;
+ BMessage * mPluginList;
public:
- PrefsListView(BRect frame);
+ PrefsListView(BRect aFrame, BMessage * aPluginList);
virtual ~PrefsListView();
virtual void AttachedToWindow();
int32 CurrentSelection();
Modified: trunk/themis/framework/app.cpp
===================================================================
--- trunk/themis/framework/app.cpp 2010-11-02 21:37:42 UTC (rev 556)
+++ trunk/themis/framework/app.cpp 2010-11-02 21:39:38 UTC (rev 557)
@@ -266,15 +266,6 @@
break;
}
- case DTD_CHANGED :
- {
- printf( "APP DTD_CHANGED\n" );
- BMessage* chgmsg = new BMessage( DTD_CHANGED_PARSER );
- chgmsg->AddInt32( "command", COMMAND_INFO );
- Broadcast( MS_TARGET_PARSER, chgmsg );
- delete chgmsg;
- break;
- }
case CSS_CHANGED :
{
printf( "APP CSS_CHANGED\n" );
@@ -310,7 +301,8 @@
rect.OffsetTo( 200, 200 );
}
fPrefsWin = new PrefsWin(
- rect );
+ rect,
+ PluginManager->GetPluginList());
}
else
fPrefsWin->Activate(true);
@@ -617,64 +609,6 @@
AppSettings->AddInt8( kPrefsTabHistoryDepth, 10 );
/* Prefs Parser */
- if( !AppSettings->HasString( kPrefsDTDDirectory ) )
- {
- BString dir;
- AppSettings->FindString( kPrefsSettingsDirectory, &dir );
- dir.Append( "/dtd" );
- AppSettings->AddString( kPrefsDTDDirectory, dir.String() );
- }
- if( !AppSettings->HasString( kPrefsActiveDTDPath ) ||
- strcmp( AppSettings->FindString( kPrefsActiveDTDPath ), kNoDTDFoundString ) == 0 )
- {
- /* set our default */
- if( !AppSettings->HasString( kPrefsActiveDTDPath ) )
- AppSettings->AddString( kPrefsActiveDTDPath, kNoDTDFoundString );
-
- /* find a DTD */
- BString dtddir;
- AppSettings->FindString( kPrefsSettingsDirectory, &dtddir );
- dtddir.Append( "/dtd/" );
- printf( "DTD dir: %s\n", dtddir.String() );
-
- BDirectory dir( dtddir.String() );
- if( dir.InitCheck() != B_OK )
- {
- printf( "DTD directory (%s) not found!\n", dtddir.String() );
- printf( "Setting kPrefsActiveDTDPath to \"none\"\n" );
- AppSettings->AddString( kPrefsActiveDTDPath, kNoDTDFoundString );
- }
- else
- {
- BEntry entry;
- while( dir.GetNextEntry( &entry, false ) != B_ENTRY_NOT_FOUND )
- {
- BPath path;
- entry.GetPath( &path );
- char name[B_FILE_NAME_LENGTH];
- entry.GetName( name );
-
- BString nstring( name );
- printf( "----------------\n" );
- printf( "found file: %s\n", nstring.String() );
- if( nstring.IFindFirst( "DTD", nstring.Length() - 3 ) != B_ERROR )
- {
- printf( "found DTD file: %s\n", nstring.String() );
- if( AppSettings->HasString( kPrefsActiveDTDPath ) )
- {
- printf( "replacing kPrefsActiveDTDPath with: %s\n", path.Path() );
- AppSettings->ReplaceString( kPrefsActiveDTDPath, path.Path() );
- }
- else
- {
- printf( "adding kPrefsActiveDTDPath: %s\n", path.Path() );
- AppSettings->AddString( kPrefsActiveDTDPath, path.Path() );
- }
- }
- }
- }
- /* end: find a DTD */
- }
if( !AppSettings->HasString( kPrefsActiveCSSPath ) ||
strcmp( AppSettings->FindString( kPrefsActiveCSSPath ), kNoCSSFoundString ) == 0 )
{
@@ -720,7 +654,7 @@
}
}
}
- /* end: find a DTD */
+ /* end: find a CSS file */
}
AppSettings->PrintToStream();
@@ -816,13 +750,6 @@
printf( "App::LoadSettings()\n" );
if( AppSettings != NULL )
{
- /* check if dtd dir exists, if not, create it */
- {
- BEntry ent("/boot/home/config/settings/Themis/dtd/",true);
- if (!ent.Exists())
- create_directory("/boot/home/config/settings/Themis/dtd/",0555);
- }
-
status_t ret=B_OK;
BPath path;
if (find_directory(B_USER_SETTINGS_DIRECTORY,&path)==B_OK)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-11-02 21:37:48
|
Revision: 556
http://themis.svn.sourceforge.net/themis/?rev=556&view=rev
Author: mark_hellegers
Date: 2010-11-02 21:37:42 +0000 (Tue, 02 Nov 2010)
Log Message:
-----------
- Make sure the new BasePrefsView and HTMLParserPrefsView are built.
Modified Paths:
--------------
trunk/themis/makefile
Modified: trunk/themis/makefile
===================================================================
--- trunk/themis/makefile 2010-11-02 21:31:21 UTC (rev 555)
+++ trunk/themis/makefile 2010-11-02 21:37:42 UTC (rev 556)
@@ -116,7 +116,8 @@
common/cacheuser.cpp \
common/cacheobject.cpp \
common/stripwhite.cpp \
- common/TTextView.cpp
+ common/TTextView.cpp \
+ common/BasePrefsView.cpp
#add similar lines for new plugins, libraries, etc.
HTTPADDONSOURCES= \
http/optionshandler.cpp \
@@ -210,7 +211,8 @@
HTMLParser/Position.cpp \
HTMLParser/ReadException.cpp \
HTMLParser/SGMLParser.cpp \
- HTMLParser/SGMLScanner.cpp
+ HTMLParser/SGMLScanner.cpp \
+ HTMLParser/HTMLParserPrefsView.cpp
CSSPARSERSOURCES= \
CSSParser/AtRuleParser.cpp \
CSSParser/BaseParser.cpp \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-11-02 21:31:28
|
Revision: 555
http://themis.svn.sourceforge.net/themis/?rev=555&view=rev
Author: mark_hellegers
Date: 2010-11-02 21:31:21 +0000 (Tue, 02 Nov 2010)
Log Message:
-----------
- Implemented preferences for the HTML parser.
Modified Paths:
--------------
trunk/themis/modules/HTMLParser/HTMLParser.cpp
trunk/themis/modules/HTMLParser/HTMLParser.h
Added Paths:
-----------
trunk/themis/modules/HTMLParser/HTMLParserPrefsView.cpp
trunk/themis/modules/HTMLParser/HTMLParserPrefsView.hpp
Modified: trunk/themis/modules/HTMLParser/HTMLParser.cpp
===================================================================
--- trunk/themis/modules/HTMLParser/HTMLParser.cpp 2010-11-02 21:30:57 UTC (rev 554)
+++ trunk/themis/modules/HTMLParser/HTMLParser.cpp 2010-11-02 21:31:21 UTC (rev 555)
@@ -14,6 +14,7 @@
// Be headers
#include <Message.h>
#include <DataIO.h>
+#include <storage/Directory.h>
// HTMLParser headers
#include "HTMLParser.h"
@@ -28,6 +29,7 @@
#include "SGMLText.hpp"
#include "TSchema.hpp"
#include "SGMLScanner.hpp"
+#include "HTMLParserPrefsView.hpp"
HTMLParser * parser;
BMessage ** appSettings_p;
@@ -86,6 +88,18 @@
// We only support one mimetype at the momemt.
mMimeTypes.push_back("text/html");
+ // Check the settings...
+ if(!appSettings->HasString(kPrefsDTDDirectory)) {
+ BString dir;
+ AppSettings->FindString(kPrefsSettingsDirectory, &dir);
+ dir.Append("/dtd");
+ AppSettings->AddString(kPrefsDTDDirectory, dir.String());
+ BEntry ent(dir.String(), true);
+ if (!ent.Exists()) {
+ create_directory(dir.String(), 0555);
+ }
+ }
+
}
HTMLParser :: ~HTMLParser() {
@@ -267,7 +281,32 @@
void HTMLParser :: MessageReceived(BMessage * aMessage) {
- BHandler::MessageReceived(aMessage);
+ switch (aMessage->what) {
+ case DTD_CHANGED_PARSER: {
+ Debug("Request to change parser", PlugID());
+ BString dtdString;
+ aMessage->FindString("DTDFileString", &dtdString);
+ appSettings->ReplaceString(kPrefsActiveDTDPath, dtdString.String());
+ mActiveDTDPath = dtdString.String();
+ if (mActiveDTDPath != "") {
+ string dtdLoad = "Loading new DTD: ";
+ dtdLoad += mActiveDTDPath;
+ Debug(dtdLoad.c_str(), PlugID());
+ TSchemaPtr schema = TSchemaPtr(new TSchema());
+ schema->setup();
+
+ SGMLScanner * scanner = new SGMLScanner();
+ mParser = new SGMLParser(scanner, schema);
+ mParser->loadSchema(mActiveDTDPath.c_str());
+ Debug("New DTD loaded", PlugID());
+ }
+ break;
+ }
+ default: {
+ BHandler::MessageReceived(aMessage);
+ }
+ }
+
}
@@ -339,23 +378,6 @@
}
break;
}
- case DTD_CHANGED_PARSER: {
- Debug("Request to change parser", PlugID());
- mActiveDTDPath = GetDTDPathFromSettings();
- if (mActiveDTDPath != "") {
- string dtdLoad = "Loading new DTD: ";
- dtdLoad += mActiveDTDPath;
- Debug(dtdLoad.c_str(), PlugID());
- TSchemaPtr schema = TSchemaPtr(new TSchema());
- schema->setup();
-
- SGMLScanner * scanner = new SGMLScanner();
- mParser = new SGMLParser(scanner, schema);
- mParser->loadSchema(mActiveDTDPath.c_str());
- Debug("New DTD loaded", PlugID());
- }
- break;
- }
case SH_PARSE_DOC_START: {
// Not used as the message is sent directly to this parser without a mime-type.
// if (IsDocumentSupported(aMessage)) {
@@ -404,3 +426,19 @@
return TARGET_PARSER;
}
+
+char * HTMLParser :: SettingsViewLabel() {
+
+ return "HTML Parser";
+}
+
+BView * HTMLParser :: SettingsView(BRect aFrame) {
+
+ HTMLParserPrefsView * view = new HTMLParserPrefsView(
+ aFrame,
+ "HTML Parser",
+ this);
+
+ return view;
+
+}
Modified: trunk/themis/modules/HTMLParser/HTMLParser.h
===================================================================
--- trunk/themis/modules/HTMLParser/HTMLParser.h 2010-11-02 21:30:57 UTC (rev 554)
+++ trunk/themis/modules/HTMLParser/HTMLParser.h 2010-11-02 21:31:21 UTC (rev 555)
@@ -86,6 +86,8 @@
status_t BroadcastReply(BMessage * aMessage);
uint32 BroadcastTarget();
int32 Type();
+ char * SettingsViewLabel();
+ BView * SettingsView(BRect aFrame);
};
Added: trunk/themis/modules/HTMLParser/HTMLParserPrefsView.cpp
===================================================================
--- trunk/themis/modules/HTMLParser/HTMLParserPrefsView.cpp (rev 0)
+++ trunk/themis/modules/HTMLParser/HTMLParserPrefsView.cpp 2010-11-02 21:31:21 UTC (rev 555)
@@ -0,0 +1,159 @@
+/*
+ Copyright (c) 2010 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: October 31, 2010
+*/
+
+/* HTMLParserPrefsView implementation
+ See HTMLParserPrefsView.hpp for more information
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// BeOS headers
+#include <interface/Window.h>
+#include <interface/Box.h>
+#include <interface/PopUpMenu.h>
+#include <interface/MenuItem.h>
+#include <interface/MenuField.h>
+#include <storage/Directory.h>
+#include <storage/Entry.h>
+#include <storage/Path.h>
+
+// Themis headers
+#include "commondefs.h"
+#include "PrefsDefs.h"
+#include "plugclass.h"
+
+
+// HTMLParser headers
+#include "HTMLParserPrefsView.hpp"
+
+HTMLParserPrefsView :: HTMLParserPrefsView(BRect aFrame,
+ const char* aName,
+ BHandler * aPlugin)
+ : BasePrefsView(aFrame,
+ aName) {
+
+ mPlugin = aPlugin;
+
+ /* DTD selection */
+ mPopUpMenu = new BPopUpMenu(
+ "No DTD selected or available!",
+ true,
+ true,
+ B_ITEMS_IN_COLUMN);
+
+ /* find a DTD */
+ AppSettings->FindString(kPrefsSettingsDirectory, &mDTDDir);
+ mDTDDir.Append("/dtd/");
+ printf("DTD dir: %s\n", mDTDDir.String());
+
+ BDirectory dir(mDTDDir.String());
+ if(dir.InitCheck() != B_OK) {
+ printf("DTD directory (%s) not found!\n", mDTDDir.String());
+ printf("Setting DTDToUsePath to \"none\"\n");
+ AppSettings->AddString(kPrefsActiveDTDPath, kNoDTDFoundString);
+ }
+ else {
+ BString activeDTD;
+ AppSettings->FindString(kPrefsActiveDTDPath, &activeDTD);
+
+ BEntry entry;
+ while(dir.GetNextEntry(&entry, false) != B_ENTRY_NOT_FOUND) {
+ BPath path;
+ entry.GetPath(&path);
+ char name[B_FILE_NAME_LENGTH];
+ entry.GetName(name);
+
+ BString nstring(name);
+ printf("----------------\n");
+ printf("found file: %s\n", nstring.String());
+ if(nstring.IFindFirst("DTD", nstring.Length() - 3) != B_ERROR) {
+ printf("found DTD file: %s\n", nstring.String());
+
+ /* add the file to the popupmenu */
+ BMessage* msg = new BMessage(DTD_CHANGED_PARSER);
+ msg->AddString("DTDFileString", path.Path());
+ BMenuItem* item = new BMenuItem(name, msg, 0, 0);
+ item->SetTarget(mPlugin);
+ mPopUpMenu->AddItem(item);
+
+ // if the path of the current file equals the one of the settings,
+ // mark the item
+ if(strcmp(activeDTD.String(), path.Path()) == 0) {
+ printf("DTD from settings found -> SetMarked( true )\n");
+ (mPopUpMenu->ItemAt(mPopUpMenu->CountItems() - 1))->SetMarked(true);
+ }
+ }
+ } // while
+
+ }
+ // end: find a DTD
+ BRect rect = mMainBox->Bounds();
+ rect.InsetBy(kItemSpacing, kItemSpacing);
+ rect.top += kBBoxExtraInset;
+
+ BMenuField* dtdmenufield = new BMenuField(
+ rect,
+ "DTDFIELD", "Document Type Definition:",
+ mPopUpMenu,
+ true,
+ B_FOLLOW_TOP,
+ B_WILL_DRAW);
+ dtdmenufield->SetDivider(be_plain_font->StringWidth("Document Type Definition:") + kItemSpacing);
+ mMainBox->AddChild(dtdmenufield);
+
+}
+
+void HTMLParserPrefsView :: AttachedToWindow() {
+
+ // if we found some DTDs, but still no DTD is saved in the prefs,
+ // or no DTD is selected:
+ // set the last found DTD in the prefs. we save it to the prefs,
+ // because the user might not reselect a DTD in the list, which
+ // would save the DTD.
+ BMessage msg(DTD_CHANGED_PARSER);
+ BMessenger msgr(mPlugin);
+ if(mPopUpMenu->CountItems() > 0) {
+ if(mPopUpMenu->FindMarked() == NULL) {
+ printf("no marked item found\n");
+ BMenuItem* item = mPopUpMenu->ItemAt(mPopUpMenu->CountItems() - 1);
+ item->SetMarked(true);
+ // as we cannot invoke the item here, send the DTD_SELECTED message here
+ BString dtdstring(mDTDDir.String());
+ dtdstring.Append(item->Label());
+ msg.AddString("DTDFileString", dtdstring.String());
+ msgr.SendMessage(&msg);
+ }
+ }
+ else {
+ msg.AddString("DTDFileString", kNoDTDFoundString);
+ msgr.SendMessage(&msg);
+ }
+}
Added: trunk/themis/modules/HTMLParser/HTMLParserPrefsView.hpp
===================================================================
--- trunk/themis/modules/HTMLParser/HTMLParserPrefsView.hpp (rev 0)
+++ trunk/themis/modules/HTMLParser/HTMLParserPrefsView.hpp 2010-11-02 21:31:21 UTC (rev 555)
@@ -0,0 +1,73 @@
+/*
+ Copyright (c) 2010 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: October 31, 2010
+*/
+
+/* HTMLParserPrefsView
+ Contains the preferences view for the HTML parser addon.
+
+ Mark Hellegers (ma...@fi...)
+ 31-10-2010
+*/
+
+#ifndef HTMLPARSERPREFSVIEW_HPP
+#define HTMLPARSERPREFSVIEW_HPP
+
+// BeOS headers
+#include <String.h>
+
+// Themis headers
+#include "BasePrefsView.hpp"
+
+// Declarations used
+class BPopUpMenu;
+class BHandler;
+
+/// Class to view the preferences of the HTML parser addon.
+
+/**
+ This class is a view of the preferences of the HTML parser addon.
+*/
+
+class HTMLParserPrefsView : public BasePrefsView {
+
+ private:
+ BPopUpMenu * mPopUpMenu;
+ BString mDTDDir;
+ BHandler * mPlugin;
+
+ public:
+ HTMLParserPrefsView(BRect aFrame,
+ const char* aName,
+ BHandler * aPlugin);
+ virtual void AttachedToWindow();
+
+};
+
+#endif
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-11-02 21:31:03
|
Revision: 554
http://themis.svn.sourceforge.net/themis/?rev=554&view=rev
Author: mark_hellegers
Date: 2010-11-02 21:30:57 +0000 (Tue, 02 Nov 2010)
Log Message:
-----------
Copy from the BasePrefsView of the PrefsVies files in the framework directory, so we can more easily use them outside the framework.
Added Paths:
-----------
trunk/themis/common/BasePrefsView.cpp
trunk/themis/common/BasePrefsView.hpp
Added: trunk/themis/common/BasePrefsView.cpp
===================================================================
--- trunk/themis/common/BasePrefsView.cpp (rev 0)
+++ trunk/themis/common/BasePrefsView.cpp 2010-11-02 21:30:57 UTC (rev 554)
@@ -0,0 +1,69 @@
+/*
+ Copyright (c) 2010 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: October 31, 2010
+*/
+
+/* BasePrefsView implementation
+ See BasePrefsView.hpp for more information
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// BeOS headers
+#include <interface/Window.h>
+#include <interface/Box.h>
+#include <interface/PopUpMenu.h>
+#include <interface/MenuItem.h>
+#include <interface/MenuField.h>
+#include <storage/Directory.h>
+#include <storage/Entry.h>
+#include <storage/Path.h>
+
+// Themis headers
+#include "BasePrefsView.hpp"
+#include "commondefs.h"
+#include "PrefsDefs.h"
+
+BasePrefsView :: BasePrefsView(BRect aFrame,
+ const char* aName)
+ : BView(aFrame,
+ aName,
+ B_FOLLOW_ALL,
+ 0) {
+
+ mMainBox = new BBox(
+ Bounds(),
+ "MainBox",
+ B_FOLLOW_ALL);
+ mMainBox->SetLabel(Name());
+ AddChild(mMainBox);
+
+ SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+
+}
Added: trunk/themis/common/BasePrefsView.hpp
===================================================================
--- trunk/themis/common/BasePrefsView.hpp (rev 0)
+++ trunk/themis/common/BasePrefsView.hpp 2010-11-02 21:30:57 UTC (rev 554)
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2010 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: October 31, 2010
+*/
+
+/* BasePrefsView
+ Contains the basic preferences view.
+
+ Mark Hellegers (ma...@fi...)
+ 31-10-2010
+*/
+
+#ifndef BASEPREFSVIEW_HPP
+#define BASEPREFSVIEW_HPP
+
+// BeOS headers
+#include <View.h>
+#include <Rect.h>
+
+/// Class to define the basic view of the preferences.
+
+/**
+ This class defines the basic view of the preferences.
+*/
+
+class BasePrefsView : public BView {
+
+ protected:
+ BBox * mMainBox;
+
+ public:
+ BasePrefsView(BRect aFrame,
+ const char* aName);
+
+};
+
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-11-02 21:24:15
|
Revision: 553
http://themis.svn.sourceforge.net/themis/?rev=553&view=rev
Author: mark_hellegers
Date: 2010-11-02 21:24:09 +0000 (Tue, 02 Nov 2010)
Log Message:
-----------
- Added BRect frame as an argument to SettingsView, so the view can be positioned right immediately.
Modified Paths:
--------------
trunk/themis/common/plugclass.cpp
trunk/themis/common/plugclass.h
Modified: trunk/themis/common/plugclass.cpp
===================================================================
--- trunk/themis/common/plugclass.cpp 2010-10-30 20:03:58 UTC (rev 552)
+++ trunk/themis/common/plugclass.cpp 2010-11-02 21:24:09 UTC (rev 553)
@@ -220,6 +220,6 @@
return NULL;
}
-BView *PlugClass::SettingsView() {
+BView *PlugClass::SettingsView(BRect frame) {
return NULL;
}
Modified: trunk/themis/common/plugclass.h
===================================================================
--- trunk/themis/common/plugclass.h 2010-10-30 20:03:58 UTC (rev 552)
+++ trunk/themis/common/plugclass.h 2010-11-02 21:24:09 UTC (rev 553)
@@ -380,7 +380,7 @@
be used to generate a simple about view.
*/
virtual char *SettingsViewLabel();//name as it should appear in the settings list
- virtual BView *SettingsView();
+ virtual BView *SettingsView(BRect frame);
/*
The top level view to add to the settings window. Be sure to SetTarget()
any controls to this view in either the constructor, AllAttached(), or
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-10-30 20:04:14
|
Revision: 552
http://themis.svn.sourceforge.net/themis/?rev=552&view=rev
Author: mark_hellegers
Date: 2010-10-30 20:03:58 +0000 (Sat, 30 Oct 2010)
Log Message:
-----------
Minimize the impact of changes to header files.
Modified Paths:
--------------
trunk/themis/framework/ThemisNavView.cpp
trunk/themis/framework/ThemisNavView.h
trunk/themis/framework/ThemisTabView.cpp
trunk/themis/framework/ThemisUrlView.h
trunk/themis/framework/app.cpp
trunk/themis/framework/app.h
trunk/themis/framework/win.cpp
Modified: trunk/themis/framework/ThemisNavView.cpp
===================================================================
--- trunk/themis/framework/ThemisNavView.cpp 2010-10-30 19:59:13 UTC (rev 551)
+++ trunk/themis/framework/ThemisNavView.cpp 2010-10-30 20:03:58 UTC (rev 552)
@@ -12,6 +12,7 @@
// myheaders
#include "ThemisNavView.h"
#include "ThemisIcons.h"
+#include "ThemisUrlView.h"
#include "win.h"
#include "app.h"
#include "../common/commondefs.h"
Modified: trunk/themis/framework/ThemisNavView.h
===================================================================
--- trunk/themis/framework/ThemisNavView.h 2010-10-30 19:59:13 UTC (rev 551)
+++ trunk/themis/framework/ThemisNavView.h 2010-10-30 20:03:58 UTC (rev 552)
@@ -9,9 +9,11 @@
// C/C++ headers
// myheaders
-#include "ThemisUrlView.h"
#include "TPictureButton.h"
+// Declarations used
+class ThemisUrlView;
+
class ThemisNavView : public BView
{
public:
Modified: trunk/themis/framework/ThemisTabView.cpp
===================================================================
--- trunk/themis/framework/ThemisTabView.cpp 2010-10-30 19:59:13 UTC (rev 551)
+++ trunk/themis/framework/ThemisTabView.cpp 2010-10-30 20:03:58 UTC (rev 552)
@@ -18,6 +18,8 @@
#include "ThemisNavView.h" // ThemisPictureButton
#include "app.h"
#include "win.h"
+#include "SiteHandler.h"
+#include "ThemisUrlView.h"
#include "../common/PrefsDefs.h"
ThemisTabView::ThemisTabView(
Modified: trunk/themis/framework/ThemisUrlView.h
===================================================================
--- trunk/themis/framework/ThemisUrlView.h 2010-10-30 19:59:13 UTC (rev 551)
+++ trunk/themis/framework/ThemisUrlView.h 2010-10-30 20:03:58 UTC (rev 552)
@@ -14,6 +14,7 @@
// myheaders
+// Declarations used
class ThemisUrlTextView;
class ThemisUrlView : public BView
Modified: trunk/themis/framework/app.cpp
===================================================================
--- trunk/themis/framework/app.cpp 2010-10-30 19:59:13 UTC (rev 551)
+++ trunk/themis/framework/app.cpp 2010-10-30 20:03:58 UTC (rev 552)
@@ -35,6 +35,8 @@
#include "PrefsDefs.h"
#include "PrefsWin.h"
#include "ThemisTab.h"
+#include "SiteHandler.h"
+#include "ThemisUrlView.h"
#include <Path.h>
using namespace _Themis_Networking_;
Modified: trunk/themis/framework/app.h
===================================================================
--- trunk/themis/framework/app.h 2010-10-30 19:59:13 UTC (rev 551)
+++ trunk/themis/framework/app.h 2010-10-30 20:03:58 UTC (rev 552)
@@ -38,11 +38,11 @@
#include "msgdaemon.h"
#include "plugman.h"
#include "tcpmanager.h"
-#include "SiteHandler.h"
#include "win.h"
// Declarations used
class PrefsWin;
+class SiteHandler;
//! The application framework version number.
#define THEMIS_FRAMEWORK_APP_VERSION 0.40
Modified: trunk/themis/framework/win.cpp
===================================================================
--- trunk/themis/framework/win.cpp 2010-10-30 19:59:13 UTC (rev 551)
+++ trunk/themis/framework/win.cpp 2010-10-30 20:03:58 UTC (rev 552)
@@ -42,6 +42,8 @@
#include "ThemisIcons.h"
#include "ThemisTab.h"
#include "win.h"
+#include "SiteHandler.h"
+#include "ThemisUrlView.h"
#include "../common/commondefs.h"
#include "../common/PrefsDefs.h"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-10-30 19:59:19
|
Revision: 551
http://themis.svn.sourceforge.net/themis/?rev=551&view=rev
Author: mark_hellegers
Date: 2010-10-30 19:59:13 +0000 (Sat, 30 Oct 2010)
Log Message:
-----------
There seems to be a bug where the be_clipboard contains nothing when doing a paste.
Haven't found the problem yet, but changed the code to take into account not finding what we want, otherwise it causes a crash.
Modified Paths:
--------------
trunk/themis/framework/ThemisUrlView.cpp
Modified: trunk/themis/framework/ThemisUrlView.cpp
===================================================================
--- trunk/themis/framework/ThemisUrlView.cpp 2010-08-25 22:05:08 UTC (rev 550)
+++ trunk/themis/framework/ThemisUrlView.cpp 2010-10-30 19:59:13 UTC (rev 551)
@@ -210,43 +210,45 @@
int32 textlen;
BMessage *clip = ( BMessage * )NULL;
- if( be_clipboard->Lock() )
+ if( clipboard->Lock() )
{
- if( ( clip = be_clipboard->Data() ) != NULL )
- clip->FindData( "text/plain", B_MIME_TYPE, ( const void ** )&text, &textlen );
-
- be_clipboard->Unlock();
+ if((clip = clipboard->Data()) != NULL) {
+ status_t status = clip->FindData("text/plain", B_MIME_TYPE, (const void **)&text, &textlen);
+ if (status == B_OK && textlen > 0) {
+ ptext.SetTo(text, textlen);
+ ptext.RemoveSet( "\a" ); // bell. will likely never be in, but you can never be sure :)
+ ptext.RemoveSet( "\b" ); // backspace
+ ptext.RemoveSet( "\f" ); // formfeed
+ ptext.RemoveSet( "\n" ); // newline
+ ptext.RemoveSet( "\r" ); // carriage return
+ ptext.RemoveSet( "\t" ); // horizontal tab
+ ptext.RemoveSet( "\v" ); // vertical tab
+ ptext.RemoveSet( "\'" ); // apostroph sign
+ ptext.RemoveSet( "\"" ); // quote
+ cout << "ptext: " << ptext.String() << endl;
+
+ /*
+ * If there is some partial selection, or the cursor is at an offset
+ * greater 0, then either remove the currently selected text, or insert
+ * the text at the given offset.
+ */
+
+ int32 off1 = 0, off2 = 0;
+ GetSelection( &off1, &off2 );
+
+ if( off1 != off2 )
+ {
+ Delete( off1, off2 );
+ }
+
+ // remove the selection
+ Select( off1, off1 );
+ // and add the text
+ Insert( ptext.String(), ptext.Length() );
+ }
+ }
+ clipboard->Unlock();
}
- ptext.SetTo(text, textlen);
- ptext.RemoveSet( "\a" ); // bell. will likely never be in, but you can never be sure :)
- ptext.RemoveSet( "\b" ); // backspace
- ptext.RemoveSet( "\f" ); // formfeed
- ptext.RemoveSet( "\n" ); // newline
- ptext.RemoveSet( "\r" ); // carriage return
- ptext.RemoveSet( "\t" ); // horizontal tab
- ptext.RemoveSet( "\v" ); // vertical tab
- ptext.RemoveSet( "\'" ); // apostroph sign
- ptext.RemoveSet( "\"" ); // quote
- cout << "ptext: " << ptext.String() << endl;
-
- /*
- * If there is some partial selection, or the cursor is at an offset
- * greater 0, then either remove the currently selected text, or insert
- * the text at the given offset.
- */
-
- int32 off1 = 0, off2 = 0;
- GetSelection( &off1, &off2 );
-
- if( off1 != off2 )
- {
- Delete( off1, off2 );
- }
-
- // remove the selection
- Select( off1, off1 );
- // and add the text
- Insert( ptext.String(), ptext.Length() );
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-08-25 22:05:14
|
Revision: 550
http://themis.svn.sourceforge.net/themis/?rev=550&view=rev
Author: mark_hellegers
Date: 2010-08-25 22:05:08 +0000 (Wed, 25 Aug 2010)
Log Message:
-----------
Stop leaking memory.
Modified Paths:
--------------
trunk/themis/framework/PrefsWin.cpp
trunk/themis/framework/PrefsWin.h
Modified: trunk/themis/framework/PrefsWin.cpp
===================================================================
--- trunk/themis/framework/PrefsWin.cpp 2010-08-24 22:35:43 UTC (rev 549)
+++ trunk/themis/framework/PrefsWin.cpp 2010-08-25 22:05:08 UTC (rev 550)
@@ -398,6 +398,14 @@
0) {
}
+PrefsListView :: ~PrefsListView() {
+
+ int32 items = fListView->CountItems();
+ for (int32 i = 0; i < items; i++) {
+ delete fListView->RemoveItem((int32) 0);
+ }
+ fListView->MakeEmpty();
+}
void PrefsListView :: AttachedToWindow() {
Modified: trunk/themis/framework/PrefsWin.h
===================================================================
--- trunk/themis/framework/PrefsWin.h 2010-08-24 22:35:43 UTC (rev 549)
+++ trunk/themis/framework/PrefsWin.h 2010-08-25 22:05:08 UTC (rev 550)
@@ -61,6 +61,7 @@
public:
PrefsListView(BRect frame);
+ virtual ~PrefsListView();
virtual void AttachedToWindow();
int32 CurrentSelection();
void Select(int32 which);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-08-24 22:35:50
|
Revision: 549
http://themis.svn.sourceforge.net/themis/?rev=549&view=rev
Author: mark_hellegers
Date: 2010-08-24 22:35:43 +0000 (Tue, 24 Aug 2010)
Log Message:
-----------
Rewrote parts of the preferences system:
- Moved creation of the views to the constructor and only the really necessary parts stay in AttachedToWindow.
- Now creating the views when the window is opened, instead of every time the preferences of the view are selected.
This costs a bit more memory, but will make it easier to move the preferences to the addons where they belong.
- Now setting the background color on the view itself, instead of on the BBox.
- Changed the style.
Modified Paths:
--------------
trunk/themis/framework/PrefsViews.cpp
trunk/themis/framework/PrefsViews.h
trunk/themis/framework/PrefsWin.cpp
trunk/themis/framework/PrefsWin.h
Modified: trunk/themis/framework/PrefsViews.cpp
===================================================================
--- trunk/themis/framework/PrefsViews.cpp 2010-08-24 19:25:15 UTC (rev 548)
+++ trunk/themis/framework/PrefsViews.cpp 2010-08-24 22:35:43 UTC (rev 549)
@@ -4,6 +4,8 @@
* author: Michael Weirauch
*/
+
+#include <interface/Box.h>
#include <interface/Button.h>
#include <interface/CheckBox.h>
#include <interface/MenuField.h>
@@ -15,7 +17,6 @@
#include <storage/Directory.h>
#include <storage/Entry.h>
#include <storage/Path.h>
-#include <support/String.h>
#include <stdio.h>
@@ -29,57 +30,40 @@
*/
-BasePrefsView::BasePrefsView(
- BRect frame,
- const char* name )
- : BView(
- frame,
- name,
- B_FOLLOW_ALL,
- 0 )
-{
-}
+BasePrefsView :: BasePrefsView(BRect frame,
+ const char* name)
+ : BView(frame,
+ name,
+ B_FOLLOW_ALL,
+ 0) {
-
-void
-BasePrefsView::AttachedToWindow()
-{
fMainBox = new BBox(
Bounds(),
"MainBox",
- B_FOLLOW_ALL );
- fMainBox->SetLabel( Name() );
- AddChild( fMainBox );
- fMainBox->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
-}
+ B_FOLLOW_ALL);
+ fMainBox->SetLabel(Name());
+ AddChild(fMainBox);
+ SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+}
+
/*
* WindowPrefsView
*/
-WindowPrefsView::WindowPrefsView(
- BRect frame,
- const char* name )
- : BasePrefsView(
- frame,
- name )
-{
-}
+WindowPrefsView :: WindowPrefsView(BRect frame,
+ const char* name)
+ : BasePrefsView(frame,
+ name) {
-
-void
-WindowPrefsView::AttachedToWindow()
-{
- BasePrefsView::AttachedToWindow();
-
/* homepage */
BString str;
- AppSettings->FindString( kPrefsHomePage, &str );
+ AppSettings->FindString(kPrefsHomePage, &str);
BRect rect = Bounds();
- rect.InsetBy( kItemSpacing, kItemSpacing );
+ rect.InsetBy(kItemSpacing, kItemSpacing);
rect.top += kBBoxExtraInset;
BTextControl* homepage = new BTextControl(
@@ -87,28 +71,28 @@
"HOMEPAGE",
"Home Page:",
"",
- NULL );
- homepage->SetModificationMessage( new BMessage( HOMEPAGE_CHANGED ) );
- homepage->SetDivider( be_plain_font->StringWidth( "Home Page:" ) + kDividerSpacing );
- homepage->SetText( str.String() );
- fMainBox->AddChild( homepage );
+ NULL);
+ homepage->SetModificationMessage(new BMessage(HOMEPAGE_CHANGED));
+ homepage->SetDivider(be_plain_font->StringWidth("Home Page:") + kDividerSpacing);
+ homepage->SetText(str.String());
+ fMainBox->AddChild(homepage);
/* blank button */
rect.top = homepage->Frame().bottom + kItemSpacing;
- BMessage* blankmsg = new BMessage( SET_BLANK_PAGE );
- blankmsg->AddPointer( "homepagecontrol", homepage );
+ BMessage* blankmsg = new BMessage(SET_BLANK_PAGE);
+ blankmsg->AddPointer("homepagecontrol", homepage);
BButton* blankbtn = new BButton(
rect,
"BLANKBUTTON",
"Use Blank Page",
blankmsg,
B_FOLLOW_ALL,
- B_WILL_DRAW );
+ B_WILL_DRAW);
blankbtn->ResizeToPreferred();
blankbtn->MoveTo(
homepage->Frame().right - blankbtn->Bounds().Width(),
blankbtn->Frame().top );
- fMainBox->AddChild( blankbtn );
+ fMainBox->AddChild(blankbtn);
/* intelligent zoom */
rect.left = Bounds().left + kItemSpacing;
@@ -117,15 +101,15 @@
rect,
"IZCBOX",
"Intelligent Zoom",
- new BMessage( IZ_CHECKBOX ) );
+ new BMessage(IZ_CHECKBOX));
IZcbox->ResizeToPreferred();
bool IntelligentZoom = false;
AppSettings->FindBool( kPrefsIntelligentZoom, &IntelligentZoom );
- if( IntelligentZoom == false )
- IZcbox->SetValue( 0 );
+ if(IntelligentZoom == false)
+ IZcbox->SetValue(0);
else
- IZcbox->SetValue( 1 );
- fMainBox->AddChild( IZcbox );
+ IZcbox->SetValue(1);
+ fMainBox->AddChild(IZcbox);
/* type ahead */
rect.top = IZcbox->Frame().bottom + kItemSpacing;
@@ -133,12 +117,12 @@
rect,
"SHOWTYPEAHEADBOX",
"Show Type Ahead Window",
- new BMessage( SHOWTYPEAHEAD_CHECKBOX ) );
+ new BMessage(SHOWTYPEAHEAD_CHECKBOX));
ShowTypeAheadbox->ResizeToPreferred();
bool ShowTypeAhead = false;
- AppSettings->FindBool( kPrefsShowTypeAheadWindow, &ShowTypeAhead );
- ShowTypeAhead ? ShowTypeAheadbox->SetValue( 1 ) : ShowTypeAheadbox->SetValue( 0 );
- fMainBox->AddChild( ShowTypeAheadbox );
+ AppSettings->FindBool(kPrefsShowTypeAheadWindow, &ShowTypeAhead);
+ ShowTypeAhead ? ShowTypeAheadbox->SetValue(1) : ShowTypeAheadbox->SetValue(0);
+ fMainBox->AddChild(ShowTypeAheadbox);
/* show tabs */
rect.top = ShowTypeAheadbox->Frame().bottom + kItemSpacing;
@@ -146,12 +130,12 @@
rect,
"SHOWTABSCBOX",
"Show Tabs at Startup",
- new BMessage( SHOWTABS_CHECKBOX ) );
+ new BMessage(SHOWTABS_CHECKBOX));
ShowTabscbox->ResizeToPreferred();
bool ShowTabs = false;
- AppSettings->FindBool( kPrefsShowTabsAtStartup, &ShowTabs );
- ShowTabs ? ShowTabscbox->SetValue( 1 ) : ShowTabscbox->SetValue( 0 );
- fMainBox->AddChild( ShowTabscbox );
+ AppSettings->FindBool(kPrefsShowTabsAtStartup, &ShowTabs);
+ ShowTabs ? ShowTabscbox->SetValue(1) : ShowTabscbox->SetValue(0);
+ fMainBox->AddChild(ShowTabscbox);
/* open tabs in background */
rect.top = ShowTabscbox->Frame().bottom + kItemSpacing;
@@ -159,11 +143,11 @@
rect,
"OPENTABSINBACKGROUNDCBOX",
"Open new Tabs in Background",
- new BMessage( TABSBACKGROUND_CHECKBOX ) );
+ new BMessage(TABSBACKGROUND_CHECKBOX));
OpenTabsInBackgroundcbox->ResizeToPreferred();
bool OpenInBackground = false;
- AppSettings->FindBool( kPrefsOpenTabsInBackground, &OpenInBackground );
- OpenInBackground ? OpenTabsInBackgroundcbox->SetValue( 1 ) : OpenTabsInBackgroundcbox->SetValue( 0 );
+ AppSettings->FindBool(kPrefsOpenTabsInBackground, &OpenInBackground);
+ OpenInBackground ? OpenTabsInBackgroundcbox->SetValue(1) : OpenTabsInBackgroundcbox->SetValue(0);
fMainBox->AddChild( OpenTabsInBackgroundcbox );
/* open blank targets in tab (instead of new window) */
@@ -172,140 +156,123 @@
rect,
"OPENBLANKTARGETINTAB",
"Open \"_blank\" target in new Tab",
- new BMessage( TABSBLANK_CHECKBOX ) );
+ new BMessage(TABSBLANK_CHECKBOX));
OpenBlankTargetInTab_CBox->ResizeToPreferred();
bool OpenBlankInTab = false;
- AppSettings->FindBool( kPrefsOpenBlankTargetInTab, &OpenBlankInTab );
- OpenBlankInTab ? OpenBlankTargetInTab_CBox->SetValue( 1 ) : OpenBlankTargetInTab_CBox->SetValue( 0 );
- fMainBox->AddChild( OpenBlankTargetInTab_CBox );
+ AppSettings->FindBool(kPrefsOpenBlankTargetInTab, &OpenBlankInTab);
+ OpenBlankInTab ? OpenBlankTargetInTab_CBox->SetValue(1) : OpenBlankTargetInTab_CBox->SetValue(0);
+ fMainBox->AddChild(OpenBlankTargetInTab_CBox);
/* new windows open with ... */
rect = Bounds();
- rect.InsetBy( kItemSpacing, 0 );
+ rect.InsetBy(kItemSpacing, 0);
rect.top = OpenBlankTargetInTab_CBox->Frame().bottom + kItemSpacing;
rect.bottom = rect.top + 100;
- BBox* newwinpagebox = new BBox( rect, "NEWWINPAGEBOX" );
- newwinpagebox->SetLabel( "New Windows open with ..." );
- fMainBox->AddChild( newwinpagebox );
+ BBox * newInPageBox = new BBox(rect, "NEWWINPAGEBOX");
+ newInPageBox->SetLabel("New Windows open with ...");
+ fMainBox->AddChild(newInPageBox);
/* blank page */
- rect = newwinpagebox->Bounds();
- rect.InsetBy( kItemSpacing, kItemSpacing );
+ rect = newInPageBox->Bounds();
+ rect.InsetBy(kItemSpacing, kItemSpacing);
rect.top += kBBoxExtraInset;
- BMessage* nwspmsg1 = new BMessage( NEW_WINDOW_START_PAGE );
- nwspmsg1->AddInt8( "newpagemode", 0 );
- BRadioButton* rbtn1 = new BRadioButton( rect, "RBTN1", "Blank Page", nwspmsg1 );
+ BMessage* nwspmsg1 = new BMessage(NEW_WINDOW_START_PAGE);
+ nwspmsg1->AddInt8("newpagemode", 0);
+ BRadioButton* rbtn1 = new BRadioButton(rect, "RBTN1", "Blank Page", nwspmsg1);
rbtn1->ResizeToPreferred();
- newwinpagebox->AddChild( rbtn1 );
+ newInPageBox->AddChild(rbtn1);
/* homepage */
rect.top = rbtn1->Frame().bottom + kItemSpacing;
- BMessage* nwspmsg2 = new BMessage( NEW_WINDOW_START_PAGE );
- nwspmsg2->AddInt8( "newpagemode", 1 );
- BRadioButton* rbtn2 = new BRadioButton( rect, "RBTN2", "Home Page", nwspmsg2 );
+ BMessage* nwspmsg2 = new BMessage(NEW_WINDOW_START_PAGE);
+ nwspmsg2->AddInt8("newpagemode", 1);
+ BRadioButton* rbtn2 = new BRadioButton(rect, "RBTN2", "Home Page", nwspmsg2);
rbtn2->ResizeToPreferred();
- newwinpagebox->AddChild( rbtn2 );
+ newInPageBox->AddChild(rbtn2);
/* current page */
rect.top = rbtn2->Frame().bottom + kItemSpacing;
- BMessage* nwspmsg3 = new BMessage( NEW_WINDOW_START_PAGE );
- nwspmsg3->AddInt8( "newpagemode", 2 );
- BRadioButton* rbtn3 = new BRadioButton( rect, "RBTN3", "Current Page", nwspmsg3 );
+ BMessage* nwspmsg3 = new BMessage(NEW_WINDOW_START_PAGE);
+ nwspmsg3->AddInt8("newpagemode", 2);
+ BRadioButton* rbtn3 = new BRadioButton(rect, "RBTN3", "Current Page", nwspmsg3);
rbtn3->ResizeToPreferred();
- newwinpagebox->AddChild( rbtn3 );
+ newInPageBox->AddChild(rbtn3);
- /* resize the box */
- BPoint pt( rbtn3->Frame().LeftBottom() );
- pt.y += kItemSpacing;
- newwinpagebox->ConvertToParent( &pt );
- newwinpagebox->ResizeTo(
- newwinpagebox->Bounds().Width(),
- pt.y - newwinpagebox->Frame().top );
+ newInPageBox->ResizeTo(
+ newInPageBox->Bounds().Width(),
+ rect.top + rbtn3->Bounds().Height() + kItemSpacing);
int8 NewPageMode = 0;
- AppSettings->FindInt8( kPrefsNewWindowStartPage, &NewPageMode );
+ AppSettings->FindInt8(kPrefsNewWindowStartPage, &NewPageMode);
/* select the correct radiobutton */
- switch( NewPageMode )
- {
- case 0 : { rbtn1->SetValue( B_CONTROL_ON ); break; }
- case 1 : { rbtn2->SetValue( B_CONTROL_ON ); break; }
- case 2 : { rbtn3->SetValue( B_CONTROL_ON ); break; }
+ switch(NewPageMode) {
+ case 0: {
+ rbtn1->SetValue(B_CONTROL_ON);
+ break;
+ }
+ case 1: {
+ rbtn2->SetValue(B_CONTROL_ON);
+ break;
+ }
+ case 2: {
+ rbtn3->SetValue(B_CONTROL_ON);
+ break;
+ }
}
}
-
/*
* NetworkPrefsView
*/
-NetworkPrefsView::NetworkPrefsView(
- BRect frame,
- const char* name )
- : BasePrefsView(
- frame,
- name )
-{
+NetworkPrefsView :: NetworkPrefsView(BRect frame,
+ const char* name)
+ : BasePrefsView(frame,
+ name) {
}
-void
-NetworkPrefsView::AttachedToWindow()
-{
- BasePrefsView::AttachedToWindow();
-}
-
-
/*
* PrivacyPrefsView
*/
-PrivacyPrefsView::PrivacyPrefsView(
- BRect frame,
- const char* name )
- : BasePrefsView(
- frame,
- name )
-{
-}
+PrivacyPrefsView :: PrivacyPrefsView(BRect frame,
+ const char* name)
+ : BasePrefsView(frame,
+ name) {
-
-void
-PrivacyPrefsView::AttachedToWindow()
-{
- BasePrefsView::AttachedToWindow();
-
BRect rect = fMainBox->Bounds();
- rect.InsetBy( kItemSpacing, kItemSpacing );
+ rect.InsetBy(kItemSpacing, kItemSpacing);
rect.top += kBBoxExtraInset;
/* history box */
- BBox* HistoryBox = new BBox(
+ BBox * historyBox = new BBox(
rect,
- "HistoryBox" );
- HistoryBox->SetLabel( "History" );
- fMainBox->AddChild( HistoryBox );
+ "historyBox");
+ historyBox->SetLabel("History");
+ fMainBox->AddChild(historyBox);
/* history depth */
- rect = HistoryBox->Bounds();
- rect.InsetBy( kItemSpacing, kItemSpacing );
+ rect = historyBox->Bounds();
+ rect.InsetBy(kItemSpacing, kItemSpacing);
rect.top += kBBoxExtraInset;
BTextControl* ghistdepth = new BTextControl(
rect,
"GLOBALHISTDEPTH",
"History Depth [in Days, 1-127]:",
"",
- NULL );
- BMessage* chmsg1 = new BMessage( HISTORY_CHANGED );
- chmsg1->AddInt8( "which", 0 );
- ghistdepth->SetModificationMessage( chmsg1 );
- char string[ 5 ];
+ NULL);
+ BMessage* chmsg1 = new BMessage(HISTORY_CHANGED);
+ chmsg1->AddInt8("which", 0);
+ ghistdepth->SetModificationMessage(chmsg1);
+ char string[5];
int8 days = 0;
- AppSettings->FindInt8( kPrefsGlobalHistoryDepthInDays, &days );
- sprintf( string, "%d", days );
- ghistdepth->SetText( string );
- ghistdepth->TextView()->AddFilter( new DigitOnlyMessageFilter() );
- HistoryBox->AddChild( ghistdepth );
+ AppSettings->FindInt8(kPrefsGlobalHistoryDepthInDays, &days);
+ sprintf(string, "%d", days);
+ ghistdepth->SetText(string);
+ ghistdepth->TextView()->AddFilter(new DigitOnlyMessageFilter());
+ historyBox->AddChild(ghistdepth);
/* free urls */
rect.top = ghistdepth->Frame().bottom + kItemSpacing;
@@ -314,99 +281,93 @@
"FREEURLCOUNT",
"Number of free URLs [1-127]:",
"",
- NULL );
- BMessage* chmsg2 = new BMessage( HISTORY_CHANGED );
- chmsg2->AddInt8( "which", 1 );
- freeurlcount->SetModificationMessage( chmsg2 );
+ NULL);
+ BMessage* chmsg2 = new BMessage(HISTORY_CHANGED);
+ chmsg2->AddInt8("which", 1);
+ freeurlcount->SetModificationMessage(chmsg2);
int8 count = 0;
- AppSettings->FindInt8( kPrefsGlobalHistoryFreeURLCount, &count );
- sprintf( string, "%d", count );
- freeurlcount->SetText( string );
- freeurlcount->TextView()->AddFilter( new DigitOnlyMessageFilter() );
- HistoryBox->AddChild( freeurlcount );
+ AppSettings->FindInt8(kPrefsGlobalHistoryFreeURLCount, &count);
+ sprintf(string, "%d", count);
+ freeurlcount->SetText(string);
+ freeurlcount->TextView()->AddFilter(new DigitOnlyMessageFilter());
+ historyBox->AddChild(freeurlcount);
/* tab history */
rect.top = freeurlcount->Frame().bottom + kItemSpacing;
- BTextControl* tabhistdepth = new BTextControl(
+ BTextControl* tabHistDepth = new BTextControl(
rect,
"TABHISTDEPTH",
"Tab History Depth [1-127]:",
"",
- NULL );
- BMessage* chmsg3 = new BMessage( HISTORY_CHANGED );
- chmsg3->AddInt8( "which", 2 );
- tabhistdepth->SetModificationMessage( chmsg3 );
- AppSettings->FindInt8( kPrefsTabHistoryDepth, &count );
- sprintf( string, "%d", count );
- tabhistdepth->SetText( string );
- tabhistdepth->TextView()->AddFilter( new DigitOnlyMessageFilter() );
- HistoryBox->AddChild( tabhistdepth );
+ NULL);
+ BMessage* chmsg3 = new BMessage(HISTORY_CHANGED);
+ chmsg3->AddInt8("which", 2);
+ tabHistDepth->SetModificationMessage(chmsg3);
+ AppSettings->FindInt8(kPrefsTabHistoryDepth, &count);
+ sprintf(string, "%d", count);
+ tabHistDepth->SetText(string);
+ tabHistDepth->TextView()->AddFilter(new DigitOnlyMessageFilter());
+ historyBox->AddChild(tabHistDepth);
/* set the dividers, and resize the controls to be smaller */
- float maxwidth = be_plain_font->StringWidth( "History Depth [in Days, 1-127]:" );
- float width2 = be_plain_font->StringWidth( "Number of free URLs [1-127]:" );
- float width3 = be_plain_font->StringWidth( "Tab History Depth [1-127]:" );
- if( maxwidth < width2 )
+ float maxwidth = be_plain_font->StringWidth("History Depth [in Days, 1-127]:");
+ float width2 = be_plain_font->StringWidth("Number of free URLs [1-127]:");
+ float width3 = be_plain_font->StringWidth("Tab History Depth [1-127]:");
+ if(maxwidth < width2)
maxwidth = width2;
- if( maxwidth < width3 )
+ if(maxwidth < width3)
maxwidth = width3;
maxwidth += kDividerSpacing;
- ghistdepth->SetDivider( maxwidth );
- freeurlcount->SetDivider( maxwidth );
- tabhistdepth->SetDivider( maxwidth );
+ ghistdepth->SetDivider(maxwidth);
+ freeurlcount->SetDivider(maxwidth);
+ tabHistDepth->SetDivider(maxwidth);
ghistdepth->ResizeTo(
ghistdepth->Divider() + 50,
- ghistdepth->Bounds().Height() );
+ ghistdepth->Bounds().Height());
freeurlcount->ResizeTo(
freeurlcount->Divider() + 50,
- freeurlcount->Bounds().Height() );
- tabhistdepth->ResizeTo(
- tabhistdepth->Divider() + 50,
- tabhistdepth->Bounds().Height() );
+ freeurlcount->Bounds().Height());
+ tabHistDepth->ResizeTo(
+ tabHistDepth->Divider() + 50,
+ tabHistDepth->Bounds().Height());
+ historyBox->ResizeTo(
+ historyBox->Bounds().Width(),
+ rect.top + tabHistDepth->Bounds().Height() + kItemSpacing);
+
/* clear button */
BButton* clearHistbtn = new BButton(
rect,
"CLEARGHBUTTON",
"Clear History",
- new BMessage( HISTORY_CLEAR ),
+ new BMessage(HISTORY_CLEAR),
B_FOLLOW_RIGHT | B_FOLLOW_TOP,
- B_WILL_DRAW );
+ B_WILL_DRAW);
clearHistbtn->ResizeToPreferred();
- HistoryBox->AddChild( clearHistbtn );
+ historyBox->AddChild(clearHistbtn);
- /* resize HistoryBox */
- BPoint pt( tabhistdepth->Frame().LeftBottom() );
- pt.y += kItemSpacing;
- HistoryBox->ConvertToParent( &pt );
- HistoryBox->ResizeTo(
- HistoryBox->Bounds().Width(),
- pt.y - HistoryBox->Frame().top );
-
/* move button to right center */
clearHistbtn->MoveTo(
- HistoryBox->Bounds().right - ( clearHistbtn->Bounds().Width() + kItemSpacing ),
- HistoryBox->Bounds().Height() / 2 - clearHistbtn->Bounds().Height() / 2 );
+ historyBox->Bounds().right - (clearHistbtn->Bounds().Width() + kItemSpacing),
+ historyBox->Bounds().Height() / 2 - clearHistbtn->Bounds().Height() / 2);
/* cache box */
- rect = HistoryBox->Frame();
+ rect = historyBox->Frame();
rect.top = rect.bottom + kItemSpacing;
rect.bottom = rect.top + 100;
- BBox* CacheBox = new BBox(
- rect, "CACHEBOX" );
- CacheBox->SetLabel( "Cache" );
- fMainBox->AddChild( CacheBox );
+ BBox* CacheBox = new BBox(rect, "CACHEBOX");
+ CacheBox->SetLabel("Cache");
+ fMainBox->AddChild(CacheBox);
/* cookie box */
rect = CacheBox->Frame();
rect.top = rect.bottom + kItemSpacing;
rect.bottom = rect.top + 100;
- BBox* CookieBox = new BBox(
- rect, "COOKIEBOX" );
- CookieBox->SetLabel( "Cookies" );
- fMainBox->AddChild( CookieBox );
+ BBox* CookieBox = new BBox(rect, "COOKIEBOX");
+ CookieBox->SetLabel("Cookies");
+ fMainBox->AddChild(CookieBox);
}
@@ -416,235 +377,216 @@
*/
-HTMLParserPrefsView::HTMLParserPrefsView(
- BRect frame,
- const char* name )
- : BasePrefsView(
- frame,
- name )
-{
-}
+HTMLParserPrefsView :: HTMLParserPrefsView(BRect frame,
+ const char* name)
+ : BasePrefsView(frame,
+ name) {
-
-void
-HTMLParserPrefsView::AttachedToWindow()
-{
- BasePrefsView::AttachedToWindow();
-
/* DTD selection */
- BPopUpMenu* popmenu = new BPopUpMenu( "No DTD selected or available!", true, true, B_ITEMS_IN_COLUMN );
+ mPopUpMenu = new BPopUpMenu(
+ "No DTD selected or available!",
+ true,
+ true,
+ B_ITEMS_IN_COLUMN);
/* find a DTD */
- BString dtddir;
- AppSettings->FindString( kPrefsSettingsDirectory, &dtddir );
- dtddir.Append( "/dtd/" );
- printf( "DTD dir: %s\n", dtddir.String() );
+ AppSettings->FindString(kPrefsSettingsDirectory, &mDTDDir);
+ mDTDDir.Append("/dtd/");
+ printf("DTD dir: %s\n", mDTDDir.String());
- BDirectory dir( dtddir.String() );
- if( dir.InitCheck() != B_OK )
- {
- printf( "DTD directory (%s) not found!\n", dtddir.String() );
- printf( "Setting DTDToUsePath to \"none\"\n" );
- AppSettings->AddString( kPrefsActiveDTDPath, kNoDTDFoundString );
+ BDirectory dir(mDTDDir.String());
+ if(dir.InitCheck() != B_OK) {
+ printf("DTD directory (%s) not found!\n", mDTDDir.String());
+ printf("Setting DTDToUsePath to \"none\"\n");
+ AppSettings->AddString(kPrefsActiveDTDPath, kNoDTDFoundString);
}
- else
- {
+ else {
BString activeDTD;
- AppSettings->FindString( kPrefsActiveDTDPath, &activeDTD );
+ AppSettings->FindString(kPrefsActiveDTDPath, &activeDTD);
BEntry entry;
- while( dir.GetNextEntry( &entry, false ) != B_ENTRY_NOT_FOUND )
- {
+ while(dir.GetNextEntry(&entry, false) != B_ENTRY_NOT_FOUND) {
BPath path;
- entry.GetPath( &path );
+ entry.GetPath(&path);
char name[B_FILE_NAME_LENGTH];
- entry.GetName( name );
+ entry.GetName(name);
- BString nstring( name );
- printf( "----------------\n" );
- printf( "found file: %s\n", nstring.String() );
- if( nstring.IFindFirst( "DTD", nstring.Length() - 3 ) != B_ERROR )
- {
- printf( "found DTD file: %s\n", nstring.String() );
+ BString nstring(name);
+ printf("----------------\n");
+ printf("found file: %s\n", nstring.String());
+ if(nstring.IFindFirst("DTD", nstring.Length() - 3) != B_ERROR) {
+ printf("found DTD file: %s\n", nstring.String());
/* add the file to the popupmenu */
- BMessage* msg = new BMessage( DTD_SELECTED );
- msg->AddString( "DTDFileString", path.Path() );
- BMenuItem* item = new BMenuItem( name, msg, 0, 0 );
- popmenu->AddItem( item );
+ BMessage* msg = new BMessage(DTD_SELECTED);
+ msg->AddString("DTDFileString", path.Path());
+ BMenuItem* item = new BMenuItem(name, msg, 0, 0);
+ mPopUpMenu->AddItem(item);
// if the path of the current file equals the one of the settings,
// mark the item
- if( strcmp( activeDTD.String(), path.Path() ) == 0 )
- {
- printf( "DTD from settings found -> SetMarked( true )\n" );
- ( popmenu->ItemAt( popmenu->CountItems() - 1 ) )->SetMarked( true );
+ if(strcmp(activeDTD.String(), path.Path()) == 0) {
+ printf("DTD from settings found -> SetMarked( true )\n");
+ (mPopUpMenu->ItemAt(mPopUpMenu->CountItems() - 1))->SetMarked(true);
}
}
} // while
- // if we found some DTDs, but still no DTD is saved in the prefs,
- // or no DTD is selected:
- // set the last found DTD in the prefs. we save it to the prefs,
- // because the user might not reselect a DTD in the list, which
- // would save the DTD.
- BMessage imsg( DTD_SELECTED );
- BMessenger msgr( NULL, Window()->Looper() );
- if( popmenu->CountItems() > 0 )
- {
- if( popmenu->FindMarked() == NULL )
- {
- printf( "no marked item found\n" );
- BMenuItem* item = popmenu->ItemAt( popmenu->CountItems() - 1 );
- item->SetMarked( true );
- // as we cannot invoke the item here, send the DTD_SELECTED message here
- BString dtdstring( dtddir.String() );
- dtdstring.Append( item->Label() );
- imsg.AddString( "DTDFileString", dtdstring.String() );
- msgr.SendMessage( &imsg );
- }
- }
- else
- {
- imsg.AddString( "DTDFileString", kNoDTDFoundString );
- msgr.SendMessage( &imsg );
- }
}
// end: find a DTD
-
BRect rect = fMainBox->Bounds();
- rect.InsetBy( kItemSpacing, kItemSpacing );
+ rect.InsetBy(kItemSpacing, kItemSpacing);
rect.top += kBBoxExtraInset;
- BMenuField* dtdmenufield = new BMenuField( rect, "DTDFIELD", "Document Type Definition:", popmenu, true, B_FOLLOW_TOP, B_WILL_DRAW);
- dtdmenufield->SetDivider( be_plain_font->StringWidth( "Document Type Definition:" ) + kItemSpacing );
- fMainBox->AddChild( dtdmenufield );
+ BMenuField* dtdmenufield = new BMenuField(
+ rect,
+ "DTDFIELD", "Document Type Definition:",
+ mPopUpMenu,
+ true,
+ B_FOLLOW_TOP,
+ B_WILL_DRAW);
+ dtdmenufield->SetDivider(be_plain_font->StringWidth("Document Type Definition:") + kItemSpacing);
+ fMainBox->AddChild(dtdmenufield);
+
}
+void HTMLParserPrefsView :: AttachedToWindow() {
+
+ // if we found some DTDs, but still no DTD is saved in the prefs,
+ // or no DTD is selected:
+ // set the last found DTD in the prefs. we save it to the prefs,
+ // because the user might not reselect a DTD in the list, which
+ // would save the DTD.
+ BMessage imsg(DTD_SELECTED);
+ BMessenger msgr(NULL, Window()->Looper());
+ if(mPopUpMenu->CountItems() > 0) {
+ if(mPopUpMenu->FindMarked() == NULL) {
+ printf("no marked item found\n");
+ BMenuItem* item = mPopUpMenu->ItemAt(mPopUpMenu->CountItems() - 1);
+ item->SetMarked(true);
+ // as we cannot invoke the item here, send the DTD_SELECTED message here
+ BString dtdstring(mDTDDir.String());
+ dtdstring.Append(item->Label());
+ imsg.AddString("DTDFileString", dtdstring.String());
+ msgr.SendMessage(&imsg);
+ }
+ }
+ else {
+ imsg.AddString("DTDFileString", kNoDTDFoundString);
+ msgr.SendMessage(&imsg);
+ }
+}
+
/*
* CSSParserPrefsView
*/
-CSSParserPrefsView::CSSParserPrefsView(
- BRect frame,
- const char* name )
- : BasePrefsView(
- frame,
- name )
-{
-}
+CSSParserPrefsView :: CSSParserPrefsView(BRect frame,
+ const char* name)
+ : BasePrefsView(frame,
+ name) {
-
-void
-CSSParserPrefsView::AttachedToWindow()
-{
- BasePrefsView::AttachedToWindow();
-
/* CSS file selection */
- BPopUpMenu* popmenu = new BPopUpMenu( "No CSS selected or available!", true, true, B_ITEMS_IN_COLUMN );
+ mPopUpMenu = new BPopUpMenu(
+ "No CSS selected or available!",
+ true,
+ true,
+ B_ITEMS_IN_COLUMN);
/* find a CSS file */
- BString cssdir;
- AppSettings->FindString( kPrefsSettingsDirectory, &cssdir );
- cssdir.Append( "/css/" );
- printf( "CSS dir: %s\n", cssdir.String() );
+ AppSettings->FindString(kPrefsSettingsDirectory, &mCSSDir);
+ mCSSDir.Append("/css/");
+ printf("CSS dir: %s\n", mCSSDir.String());
- BDirectory dir( cssdir.String() );
- if( dir.InitCheck() != B_OK )
- {
- printf( "CSS directory (%s) not found!\n", cssdir.String() );
- printf( "Setting CSSToUsePath to \"none\"\n" );
- AppSettings->AddString( kPrefsActiveCSSPath, kNoCSSFoundString );
+ BDirectory dir(mCSSDir.String());
+ if(dir.InitCheck() != B_OK) {
+ printf("CSS directory (%s) not found!\n", mCSSDir.String());
+ printf("Setting CSSToUsePath to \"none\"\n");
+ AppSettings->AddString(kPrefsActiveCSSPath, kNoCSSFoundString);
}
- else
- {
+ else {
BString activeCSS;
- AppSettings->FindString( kPrefsActiveCSSPath, &activeCSS );
+ AppSettings->FindString(kPrefsActiveCSSPath, &activeCSS);
BEntry entry;
- while( dir.GetNextEntry( &entry, false ) != B_ENTRY_NOT_FOUND )
- {
+ while(dir.GetNextEntry(&entry, false) != B_ENTRY_NOT_FOUND) {
BPath path;
- entry.GetPath( &path );
+ entry.GetPath(&path);
char name[B_FILE_NAME_LENGTH];
- entry.GetName( name );
+ entry.GetName(name);
- BString nstring( name );
- printf( "----------------\n" );
- printf( "found CSS file: %s\n", nstring.String() );
+ BString nstring(name);
+ printf("----------------\n");
+ printf("found CSS file: %s\n", nstring.String());
/* add the file to the popupmenu */
- BMessage* msg = new BMessage( CSS_SELECTED );
- msg->AddString( "CSSFileString", path.Path() );
- BMenuItem* item = new BMenuItem( name, msg, 0, 0 );
- popmenu->AddItem( item );
+ BMessage* msg = new BMessage(CSS_SELECTED);
+ msg->AddString("CSSFileString", path.Path());
+ BMenuItem* item = new BMenuItem(name, msg, 0, 0);
+ mPopUpMenu->AddItem(item);
// if the path of the current file equals the one of the settings,
// mark the item
- if( strcmp( activeCSS.String(), path.Path() ) == 0 )
- {
- printf( "CSS from settings found -> SetMarked( true )\n" );
- ( popmenu->ItemAt( popmenu->CountItems() - 1 ) )->SetMarked( true );
+ if(strcmp(activeCSS.String(), path.Path() ) == 0) {
+ printf("CSS from settings found -> SetMarked( true )\n");
+ (mPopUpMenu->ItemAt(mPopUpMenu->CountItems() - 1))->SetMarked(true);
}
} // while
+ }
+ // end: find a CSS file
+
+ BRect rect = fMainBox->Bounds();
+ rect.InsetBy(kItemSpacing, kItemSpacing);
+ rect.top += kBBoxExtraInset;
+
+ BMenuField* cssmenufield = new BMenuField(
+ rect,
+ "CSSFIELD", "Cascading Style Sheet:",
+ mPopUpMenu,
+ true,
+ B_FOLLOW_TOP,
+ B_WILL_DRAW);
+ cssmenufield->SetDivider(be_plain_font->StringWidth("Cascading Style Sheet:") + kItemSpacing);
+ fMainBox->AddChild(cssmenufield);
+}
+
+void CSSParserPrefsView :: AttachedToWindow() {
+
// if we found some CSS files, but still no CSS file is saved in the prefs,
// or no CSS file is selected:
// set the last found CSS file in the prefs. we save it to the prefs,
// because the user might not reselect a CSS file in the list, which
// would save the CSS file.
- BMessage imsg( CSS_SELECTED );
- BMessenger msgr( NULL, Window()->Looper() );
- if( popmenu->CountItems() > 0 )
- {
- if( popmenu->FindMarked() == NULL )
- {
- printf( "no marked item found\n" );
- BMenuItem* item = popmenu->ItemAt( popmenu->CountItems() - 1 );
- item->SetMarked( true );
+ BMessage imsg(CSS_SELECTED);
+ BMessenger msgr(NULL, Window()->Looper());
+ if (mPopUpMenu->CountItems() > 0) {
+ if (mPopUpMenu->FindMarked() == NULL) {
+ printf("no marked item found\n");
+ BMenuItem* item = mPopUpMenu->ItemAt(mPopUpMenu->CountItems() - 1);
+ item->SetMarked(true);
// as we cannot invoke the item here, send the CSS_SELECTED message here
- BString cssstring( cssdir.String() );
- cssstring.Append( item->Label() );
- imsg.AddString( "CSSFileString", cssstring.String() );
- msgr.SendMessage( &imsg );
+ BString cssstring(mCSSDir.String());
+ cssstring.Append(item->Label());
+ imsg.AddString("CSSFileString", cssstring.String());
+ msgr.SendMessage(&imsg);
}
}
- else
- {
- imsg.AddString( "CSSFileString", kNoCSSFoundString );
- msgr.SendMessage( &imsg );
+ else {
+ imsg.AddString("CSSFileString", kNoCSSFoundString);
+ msgr.SendMessage(&imsg);
}
- }
- // end: find a CSS file
-
- BRect rect = fMainBox->Bounds();
- rect.InsetBy( kItemSpacing, kItemSpacing );
- rect.top += kBBoxExtraInset;
-
- BMenuField* cssmenufield = new BMenuField( rect, "CSSFIELD", "Cascading Style Sheet:", popmenu, true, B_FOLLOW_TOP, B_WILL_DRAW);
- cssmenufield->SetDivider( be_plain_font->StringWidth( "Cascading Style Sheet:" ) + kItemSpacing );
- fMainBox->AddChild( cssmenufield );
}
-
/*
* RendererPrefsView
*/
-RendererPrefsView::RendererPrefsView(
- BRect frame,
- const char* name )
- : BasePrefsView(
- frame,
- name )
-{
+RendererPrefsView :: RendererPrefsView(BRect frame,
+ const char* name)
+ : BasePrefsView(frame,
+ name) {
}
-
-void
-RendererPrefsView::AttachedToWindow()
-{
- BasePrefsView::AttachedToWindow();
-}
Modified: trunk/themis/framework/PrefsViews.h
===================================================================
--- trunk/themis/framework/PrefsViews.h 2010-08-24 19:25:15 UTC (rev 548)
+++ trunk/themis/framework/PrefsViews.h 2010-08-24 22:35:43 UTC (rev 549)
@@ -7,9 +7,14 @@
#ifndef _PREFSVIEWS_H_
#define _PREFSVIEWS_H_
-#include <Box.h>
+// BeOS headers
#include <View.h>
+#include <String.h>
+// Declarations used
+class BBox;
+class BPopUpMenu;
+
/*
* BasePrefsView
*/
@@ -17,17 +22,15 @@
class WindowPrefsView;
-class BasePrefsView : public BView
-{
+class BasePrefsView : public BView {
+
+ protected:
+ BBox * fMainBox;
+
public:
- BasePrefsView(
- BRect frame,
- const char* name );
+ BasePrefsView(BRect frame,
+ const char* name);
- virtual void AttachedToWindow();
-
- protected:
- BBox* fMainBox;
};
@@ -36,14 +39,12 @@
*/
-class WindowPrefsView : public BasePrefsView
-{
+class WindowPrefsView : public BasePrefsView {
+
public:
- WindowPrefsView(
- BRect frame,
- const char* name );
-
- virtual void AttachedToWindow();
+ WindowPrefsView(BRect frame,
+ const char* name);
+
};
@@ -52,14 +53,12 @@
*/
-class NetworkPrefsView : public BasePrefsView
-{
+class NetworkPrefsView : public BasePrefsView {
+
public:
- NetworkPrefsView(
- BRect frame,
- const char* name );
-
- virtual void AttachedToWindow();
+ NetworkPrefsView(BRect frame,
+ const char* name);
+
};
@@ -68,14 +67,12 @@
*/
-class PrivacyPrefsView : public BasePrefsView
-{
+class PrivacyPrefsView : public BasePrefsView {
+
public:
- PrivacyPrefsView(
- BRect frame,
- const char* name );
-
- virtual void AttachedToWindow();
+ PrivacyPrefsView(BRect frame,
+ const char* name);
+
};
@@ -84,14 +81,17 @@
*/
-class HTMLParserPrefsView : public BasePrefsView
-{
+class HTMLParserPrefsView : public BasePrefsView {
+
+ private:
+ BPopUpMenu * mPopUpMenu;
+ BString mDTDDir;
+
public:
- HTMLParserPrefsView(
- BRect frame,
- const char* name );
-
- virtual void AttachedToWindow();
+ HTMLParserPrefsView(BRect frame,
+ const char* name);
+ virtual void AttachedToWindow();
+
};
@@ -100,14 +100,17 @@
*/
-class CSSParserPrefsView : public BasePrefsView
-{
+class CSSParserPrefsView : public BasePrefsView {
+
+ private:
+ BPopUpMenu * mPopUpMenu;
+ BString mCSSDir;
+
public:
- CSSParserPrefsView(
- BRect frame,
- const char* name );
-
- virtual void AttachedToWindow();
+ CSSParserPrefsView(BRect frame,
+ const char* name);
+ virtual void AttachedToWindow();
+
};
/*
@@ -115,14 +118,12 @@
*/
-class RendererPrefsView : public BasePrefsView
-{
+class RendererPrefsView : public BasePrefsView {
+
public:
- RendererPrefsView(
- BRect frame,
- const char* name );
+ RendererPrefsView(BRect frame,
+ const char* name);
- virtual void AttachedToWindow();
};
#endif
Modified: trunk/themis/framework/PrefsWin.cpp
===================================================================
--- trunk/themis/framework/PrefsWin.cpp 2010-08-24 19:25:15 UTC (rev 548)
+++ trunk/themis/framework/PrefsWin.cpp 2010-08-24 22:35:43 UTC (rev 549)
@@ -49,7 +49,7 @@
Bounds(),
"BackgroundView",
B_FOLLOW_ALL,
- 0 );
+ 0);
AddChild(fBackgroundView);
fBackgroundView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
@@ -66,11 +66,52 @@
rect.InsetBy(kItemSpacing, kItemSpacing);
rect.left = fPrefsListView->Frame().right + kItemSpacing;
fViewFrame = rect;
+
+ CreatePrefViews();
Show();
}
+PrefsWin :: ~PrefsWin() {
+
+ if (fCurrentPrefsView) {
+ fCurrentPrefsView->RemoveSelf();
+ fCurrentPrefsView = NULL;
+ }
+ printf("Deleting preferences views\n");
+ for (unsigned int i = 0; i < mPrefViews.size(); i++) {
+ delete mPrefViews[i];
+ }
+
+}
+
+void PrefsWin :: CreatePrefViews() {
+
+ printf("Creating preferences views\n");
+
+ mPrefViews.push_back(
+ new WindowPrefsView(fViewFrame,
+ kPrefsItems[0].name));
+ mPrefViews.push_back(
+ new NetworkPrefsView(fViewFrame,
+ kPrefsItems[1].name));
+ mPrefViews.push_back(
+ new PrivacyPrefsView(fViewFrame,
+ kPrefsItems[2].name));
+ mPrefViews.push_back(
+ new HTMLParserPrefsView(fViewFrame,
+ kPrefsItems[3].name));
+ mPrefViews.push_back(
+ new CSSParserPrefsView(fViewFrame,
+ kPrefsItems[4].name));
+ mPrefViews.push_back(
+ new RendererPrefsView(fViewFrame,
+ kPrefsItems[5].name));
+
+
+}
+
void PrefsWin :: MessageReceived(BMessage* msg) {
switch(msg->what) {
@@ -82,72 +123,21 @@
* but the BListView does take away the focus from the curent
* selected item. So reselect it again. :/
*/
- if(selection < 0)
+ if(selection < 0) {
fPrefsListView->Select(fLastSelection);
-
- if(selection == fLastSelection)
- break;
- else
- fLastSelection = selection;
-
- if(fCurrentPrefsView) {
- fCurrentPrefsView->RemoveSelf();
- delete fCurrentPrefsView;
- fCurrentPrefsView = NULL;
}
-
- /* find the prefs_view_const */
- enum prefs_view_const pvconst = kPrefsItems[selection].pvconst;
-
- switch(pvconst) {
- case PREFSVIEW_WINDOW: {
- fCurrentPrefsView = new WindowPrefsView(
- fViewFrame,
- kPrefsItems[selection].name);
- fBackgroundView->AddChild(fCurrentPrefsView);
+ else {
+ if(selection != fLastSelection) {
+ fLastSelection = selection;
+
+ if (fCurrentPrefsView) {
+ fCurrentPrefsView->RemoveSelf();
+ fCurrentPrefsView = NULL;
+ }
- break;
- }
- case PREFSVIEW_NETWORK: {
- fCurrentPrefsView = new NetworkPrefsView(
- fViewFrame,
- kPrefsItems[selection].name);
+ fCurrentPrefsView = mPrefViews[selection];
fBackgroundView->AddChild(fCurrentPrefsView);
-
- break;
}
- case PREFSVIEW_PRIVACY: {
- fCurrentPrefsView = new PrivacyPrefsView(
- fViewFrame,
- kPrefsItems[selection].name);
- fBackgroundView->AddChild(fCurrentPrefsView);
-
- break;
- }
- case PREFSVIEW_HTMLPARSER: {
- fCurrentPrefsView = new HTMLParserPrefsView(
- fViewFrame,
- kPrefsItems[selection].name);
- fBackgroundView->AddChild(fCurrentPrefsView);
-
- break;
- }
- case PREFSVIEW_CSSPARSER: {
- fCurrentPrefsView = new CSSParserPrefsView(
- fViewFrame,
- kPrefsItems[selection].name);
- fBackgroundView->AddChild(fCurrentPrefsView);
-
- break;
- }
- case PREFSVIEW_RENDERER: {
- fCurrentPrefsView = new RendererPrefsView(
- fViewFrame,
- kPrefsItems[selection].name);
- fBackgroundView->AddChild(fCurrentPrefsView);
-
- break;
- }
}
break;
Modified: trunk/themis/framework/PrefsWin.h
===================================================================
--- trunk/themis/framework/PrefsWin.h 2010-08-24 19:25:15 UTC (rev 548)
+++ trunk/themis/framework/PrefsWin.h 2010-08-24 22:35:43 UTC (rev 549)
@@ -10,6 +10,13 @@
#include <View.h>
#include <Window.h>
+// C++ headers
+#include <vector>
+
+// Namespaces used
+using std::vector;
+
+// Declarations
class PrefsListView;
class PrefsWin : public BWindow {
@@ -20,11 +27,14 @@
BView * fCurrentPrefsView;
int32 fLastSelection;
BRect fViewFrame;
-
+ vector<BView *> mPrefViews;
+
+ void CreatePrefViews();
void SaveAppSettings();
public:
PrefsWin(BRect frame);
+ virtual ~PrefsWin();
virtual void MessageReceived(BMessage* msg);
virtual bool QuitRequested();
@@ -67,6 +77,7 @@
#ifndef PREFSLISTITEM
#define PREFSLISTITEM
+// BeOS headers
#include <Bitmap.h>
#include <ListItem.h>
@@ -75,7 +86,7 @@
private:
const char * fName;
BBitmap * fBitmap;
- float fFontHeight;
+ float fFontHeight;
public:
PrefsListItem(const char* name,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-08-24 19:25:22
|
Revision: 548
http://themis.svn.sourceforge.net/themis/?rev=548&view=rev
Author: mark_hellegers
Date: 2010-08-24 19:25:15 +0000 (Tue, 24 Aug 2010)
Log Message:
-----------
Changed the styling to be more compact.
Modified Paths:
--------------
trunk/themis/framework/PrefsWin.cpp
trunk/themis/framework/PrefsWin.h
Modified: trunk/themis/framework/PrefsWin.cpp
===================================================================
--- trunk/themis/framework/PrefsWin.cpp 2010-08-24 19:24:27 UTC (rev 547)
+++ trunk/themis/framework/PrefsWin.cpp 2010-08-24 19:25:15 UTC (rev 548)
@@ -34,39 +34,36 @@
};
-PrefsWin::PrefsWin(
- BRect frame )
- : BWindow(
- frame,
- "Preferences",
- B_TITLED_WINDOW_LOOK,
- B_NORMAL_WINDOW_FEEL,
- B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE ),
- fCurrentPrefsView( NULL ),
- fLastSelection( -1 ),
- fViewFrame( 0, 0, 0, 0 )
-{
+PrefsWin :: PrefsWin(BRect frame)
+ : BWindow(frame,
+ "Preferences",
+ B_TITLED_WINDOW_LOOK,
+ B_NORMAL_WINDOW_FEEL,
+ B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE),
+ fCurrentPrefsView(NULL),
+ fLastSelection(-1),
+ fViewFrame(0, 0, 0, 0) {
+
/* set up the background view */
fBackgroundView = new BView(
Bounds(),
"BackgroundView",
B_FOLLOW_ALL,
0 );
- AddChild( fBackgroundView );
- fBackgroundView->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
+ AddChild(fBackgroundView);
+ fBackgroundView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
/* add the listview */
BRect rect = Bounds();
- rect.InsetBy( kItemSpacing, kItemSpacing );
+ rect.InsetBy(kItemSpacing, kItemSpacing);
rect.right = rect.left + 100;
- fPrefsListView = new PrefsListView(
- rect );
- fBackgroundView->AddChild( fPrefsListView );
+ fPrefsListView = new PrefsListView(rect);
+ fBackgroundView->AddChild(fPrefsListView);
/* calculate the view frame */
rect = Bounds();
- rect.InsetBy( kItemSpacing, kItemSpacing );
+ rect.InsetBy(kItemSpacing, kItemSpacing);
rect.left = fPrefsListView->Frame().right + kItemSpacing;
fViewFrame = rect;
@@ -74,14 +71,10 @@
}
-void
-PrefsWin::MessageReceived(
- BMessage* msg )
-{
- switch( msg->what )
- {
- case LIST_SELECTION_CHANGED :
- {
+void PrefsWin :: MessageReceived(BMessage* msg) {
+
+ switch(msg->what) {
+ case LIST_SELECTION_CHANGED: {
int32 selection = fPrefsListView->CurrentSelection();
/*
@@ -89,77 +82,69 @@
* but the BListView does take away the focus from the curent
* selected item. So reselect it again. :/
*/
- if( selection < 0 )
- fPrefsListView->Select( fLastSelection );
+ if(selection < 0)
+ fPrefsListView->Select(fLastSelection);
- if( selection == fLastSelection )
+ if(selection == fLastSelection)
break;
else
fLastSelection = selection;
- if( fCurrentPrefsView )
- {
+ if(fCurrentPrefsView) {
fCurrentPrefsView->RemoveSelf();
delete fCurrentPrefsView;
fCurrentPrefsView = NULL;
}
/* find the prefs_view_const */
- enum prefs_view_const pvconst = kPrefsItems[ selection ].pvconst;
+ enum prefs_view_const pvconst = kPrefsItems[selection].pvconst;
- switch( pvconst )
- {
- case PREFSVIEW_WINDOW :
- {
+ switch(pvconst) {
+ case PREFSVIEW_WINDOW: {
fCurrentPrefsView = new WindowPrefsView(
fViewFrame,
- kPrefsItems[ selection ].name );
- fBackgroundView->AddChild( fCurrentPrefsView );
+ kPrefsItems[selection].name);
+ fBackgroundView->AddChild(fCurrentPrefsView);
break;
}
- case PREFSVIEW_NETWORK :
- {
+ case PREFSVIEW_NETWORK: {
fCurrentPrefsView = new NetworkPrefsView(
fViewFrame,
- kPrefsItems[ selection ].name );
- fBackgroundView->AddChild( fCurrentPrefsView );
+ kPrefsItems[selection].name);
+ fBackgroundView->AddChild(fCurrentPrefsView);
break;
}
- case PREFSVIEW_PRIVACY :
- {
+ case PREFSVIEW_PRIVACY: {
fCurrentPrefsView = new PrivacyPrefsView(
fViewFrame,
- kPrefsItems[ selection ].name );
- fBackgroundView->AddChild( fCurrentPrefsView );
+ kPrefsItems[selection].name);
+ fBackgroundView->AddChild(fCurrentPrefsView);
break;
}
- case PREFSVIEW_HTMLPARSER :
- {
+ case PREFSVIEW_HTMLPARSER: {
fCurrentPrefsView = new HTMLParserPrefsView(
fViewFrame,
- kPrefsItems[ selection ].name );
- fBackgroundView->AddChild( fCurrentPrefsView );
+ kPrefsItems[selection].name);
+ fBackgroundView->AddChild(fCurrentPrefsView);
break;
}
- case PREFSVIEW_CSSPARSER :
- {
+ case PREFSVIEW_CSSPARSER: {
fCurrentPrefsView = new CSSParserPrefsView(
fViewFrame,
- kPrefsItems[ selection ].name );
- fBackgroundView->AddChild( fCurrentPrefsView );
+ kPrefsItems[selection].name);
+ fBackgroundView->AddChild(fCurrentPrefsView);
break;
}
- case PREFSVIEW_RENDERER :
- {
+ case PREFSVIEW_RENDERER: {
fCurrentPrefsView = new RendererPrefsView(
fViewFrame,
- kPrefsItems[ selection ].name );
- fBackgroundView->AddChild( fCurrentPrefsView );
+ kPrefsItems[selection].name);
+ fBackgroundView->AddChild(fCurrentPrefsView);
break;
}
@@ -167,30 +152,26 @@
break;
}
- case HOMEPAGE_CHANGED :
- {
- printf( "PREFS: HOMEPAGE_CHANGED\n" );
+ case HOMEPAGE_CHANGED: {
+ printf("PREFS: HOMEPAGE_CHANGED\n");
- BTextControl* ctrl;
- msg->FindPointer( "source", ( void** )&ctrl );
- if( ctrl )
- {
- AppSettings->ReplaceString( kPrefsHomePage, ctrl->Text() );
+ BTextControl * ctrl;
+ msg->FindPointer("source", (void**)&ctrl);
+ if(ctrl) {
+ AppSettings->ReplaceString(kPrefsHomePage, ctrl->Text());
}
SaveAppSettings();
break;
}
- case SET_BLANK_PAGE :
- {
- printf( "PREFS: SET_BLANK_PAGE\n" );
+ case SET_BLANK_PAGE: {
+ printf("PREFS: SET_BLANK_PAGE\n");
BTextControl* ctrl;
- msg->FindPointer( "homepagecontrol", ( void** )&ctrl );
- if( ctrl )
- {
- ctrl->SetText( kAboutBlankPage );
+ msg->FindPointer("homepagecontrol", (void**)&ctrl);
+ if(ctrl) {
+ ctrl->SetText(kAboutBlankPage);
}
/*
* We don't need to save the setting here, as HOMEPAGE_CHANGED is
@@ -199,17 +180,16 @@
break;
}
- case IZ_CHECKBOX :
- {
- printf( "PREFS: IZ_CHECKBOX\n" );
+ case IZ_CHECKBOX: {
+ printf("PREFS: IZ_CHECKBOX\n");
BCheckBox* cbox;
- msg->FindPointer( "source", ( void** )&cbox );
+ msg->FindPointer("source", ( void** )&cbox);
bool value = false;
- if( cbox->Value() == 1 )
+ if(cbox->Value() == 1)
value = true;
- AppSettings->ReplaceBool( kPrefsIntelligentZoom, value );
+ AppSettings->ReplaceBool(kPrefsIntelligentZoom, value);
SaveAppSettings();
@@ -217,219 +197,201 @@
}
case SHOWTYPEAHEAD_CHECKBOX :
{
- printf( "PREFS: SHOWTYPEAHEAD_CHECKBOX\n" );
+ printf("PREFS: SHOWTYPEAHEAD_CHECKBOX\n");
BCheckBox* cbox;
- msg->FindPointer( "source", ( void** )&cbox );
+ msg->FindPointer("source", ( void** )&cbox);
bool value = false;
- if( cbox->Value() == 1 )
+ if(cbox->Value() == 1)
value = true;
- AppSettings->ReplaceBool( kPrefsShowTypeAheadWindow, value );
+ AppSettings->ReplaceBool(kPrefsShowTypeAheadWindow, value);
SaveAppSettings();
break;
}
- case SHOWTABS_CHECKBOX :
- {
- printf( "PREFS: SHOWTABS_CHECKBOX\n" );
+ case SHOWTABS_CHECKBOX: {
+ printf("PREFS: SHOWTABS_CHECKBOX\n");
BCheckBox* cbox;
- msg->FindPointer( "source", ( void** )&cbox );
+ msg->FindPointer("source", ( void** )&cbox);
bool value = false;
- if( cbox->Value() == 1 )
+ if(cbox->Value() == 1)
value = true;
- AppSettings->ReplaceBool( kPrefsShowTabsAtStartup, value );
+ AppSettings->ReplaceBool(kPrefsShowTabsAtStartup, value);
SaveAppSettings();
break;
}
- case TABSBACKGROUND_CHECKBOX :
- {
- printf( "PREFS: TABSBACKGROUND_CHECKBOX\n" );
+ case TABSBACKGROUND_CHECKBOX: {
+ printf("PREFS: TABSBACKGROUND_CHECKBOX\n");
BCheckBox* cbox;
- msg->FindPointer( "source", ( void** )&cbox );
+ msg->FindPointer("source", ( void** )&cbox);
bool value = false;
- if( cbox->Value() == 1 )
+ if(cbox->Value() == 1)
value = true;
- AppSettings->ReplaceBool( kPrefsOpenTabsInBackground, value );
+ AppSettings->ReplaceBool(kPrefsOpenTabsInBackground, value);
SaveAppSettings();
break;
}
- case TABSBLANK_CHECKBOX :
- {
- printf( "PREFS: TABSBACKGROUND_CHECKBOX\n" );
+ case TABSBLANK_CHECKBOX: {
+ printf("PREFS: TABSBACKGROUND_CHECKBOX\n");
BCheckBox* cbox;
- msg->FindPointer( "source", ( void** )&cbox );
+ msg->FindPointer("source", ( void** )&cbox);
bool value = false;
- if( cbox->Value() == 1 )
+ if(cbox->Value() == 1)
value = true;
- AppSettings->ReplaceBool( kPrefsOpenBlankTargetInTab, value );
+ AppSettings->ReplaceBool(kPrefsOpenBlankTargetInTab, value);
SaveAppSettings();
break;
}
- case NEW_WINDOW_START_PAGE :
- {
- printf( "PREFS: NEW_WINDOW_START_PAGE\n" );
+ case NEW_WINDOW_START_PAGE: {
+ printf("PREFS: NEW_WINDOW_START_PAGE\n");
int8 value;
- msg->FindInt8( "newpagemode", &value );
- AppSettings->ReplaceInt8( kPrefsNewWindowStartPage, value );
+ msg->FindInt8("newpagemode", &value);
+ AppSettings->ReplaceInt8(kPrefsNewWindowStartPage, value);
SaveAppSettings();
break;
}
- case HISTORY_CHANGED :
- {
- printf( "PREFS: HISTORY_CHANGED\n" );
+ case HISTORY_CHANGED: {
+ printf("PREFS: HISTORY_CHANGED\n");
int8 setdepth = 0;
BTextControl* ctrl;
- msg->FindPointer( "source", ( void** )&ctrl );
- BString string( ctrl->Text() );
+ msg->FindPointer("source", (void**)&ctrl);
+ BString string(ctrl->Text());
- if( string.Length() == 0 )
+ if(string.Length() == 0)
break;
- int32 newdepth = atoi( string.String() );
- if( newdepth > 127 || newdepth == 0 )
- {
+ int32 newdepth = atoi(string.String());
+ if(newdepth > 127 || newdepth == 0) {
setdepth = 10;
- ctrl->SetText( "10" );
- ctrl->TextView()->Select( 2, 2 );
+ ctrl->SetText("10");
+ ctrl->TextView()->Select(2, 2);
}
else
- setdepth = ( int8 )newdepth;
+ setdepth = (int8)newdepth;
int8 which = 0;
- msg->FindInt8( "which", &which );
+ msg->FindInt8("which", &which);
- switch( which )
- {
- case 0 :
- {
- AppSettings->ReplaceInt8( kPrefsGlobalHistoryDepthInDays, setdepth );
+ switch(which) {
+ case 0: {
+ AppSettings->ReplaceInt8(kPrefsGlobalHistoryDepthInDays, setdepth);
break;
}
- case 1 :
- {
- AppSettings->ReplaceInt8( kPrefsGlobalHistoryFreeURLCount, setdepth );
+ case 1: {
+ AppSettings->ReplaceInt8(kPrefsGlobalHistoryFreeURLCount, setdepth);
break;
}
- case 2 :
- {
- AppSettings->ReplaceInt8( kPrefsTabHistoryDepth, setdepth );
+ case 2: {
+ AppSettings->ReplaceInt8(kPrefsTabHistoryDepth, setdepth);
break;
}
}
SaveAppSettings();
- if( which < 2 )
- {
+ if(which < 2) {
/* tell GlobalHistory abouts its new depth */
int8 depth;
- AppSettings->FindInt8( kPrefsGlobalHistoryDepthInDays, &depth );
- ( ( App* )be_app )->GetGlobalHistory()->SetDepth( depth );
+ AppSettings->FindInt8(kPrefsGlobalHistoryDepthInDays, &depth);
+ ((App*)be_app)->GetGlobalHistory()->SetDepth(depth);
}
- else
- {
+ else {
/* tell all windows to update their tab history depths */
- Win* win = ( ( App* )be_app )->FirstWindow();
+ Win* win = ((App*)be_app)->FirstWindow();
- if( win == NULL )
- {
- printf( "PREFS: First Window not valid anymore!\n" );
+ if(win == NULL) {
+ printf("PREFS: First Window not valid anymore!\n");
break;
}
- BMessenger* msgr = new BMessenger( NULL, win, NULL );
- msgr->SendMessage( RE_INIT_TABHISTORY );
+ BMessenger* msgr = new BMessenger(NULL, win, NULL);
+ msgr->SendMessage(RE_INIT_TABHISTORY);
- while( win->NextWindow() != NULL )
- {
+ while(win->NextWindow() != NULL) {
win = win->NextWindow();
delete msgr;
- msgr = new BMessenger( NULL, win, NULL );
- msgr->SendMessage( RE_INIT_TABHISTORY );
+ msgr = new BMessenger(NULL, win, NULL);
+ msgr->SendMessage(RE_INIT_TABHISTORY);
}
delete msgr;
}
break;
}
- case DTD_SELECTED :
- {
- printf( "PREFS: DTD_SELECTED\n" );
+ case DTD_SELECTED: {
+ printf("PREFS: DTD_SELECTED\n");
BString str;
- msg->FindString( "DTDFileString", &str );
+ msg->FindString("DTDFileString", &str);
- AppSettings->ReplaceString( kPrefsActiveDTDPath, str.String() );
+ AppSettings->ReplaceString(kPrefsActiveDTDPath, str.String());
SaveAppSettings();
/*
* use the app to tell html parser about the DTD change.
*/
- be_app_messenger.SendMessage( DTD_CHANGED );
+ be_app_messenger.SendMessage(DTD_CHANGED);
break;
}
- case CSS_SELECTED :
- {
- printf( "PREFS: CSS_SELECTED\n" );
+ case CSS_SELECTED: {
+ printf("PREFS: CSS_SELECTED\n");
BString str;
- msg->FindString( "CSSFileString", &str );
+ msg->FindString("CSSFileString", &str);
- AppSettings->ReplaceString( kPrefsActiveCSSPath, str.String() );
+ AppSettings->ReplaceString(kPrefsActiveCSSPath, str.String());
SaveAppSettings();
/*
* use the app to tell css parser about the CSS change.
*/
- be_app_messenger.SendMessage( CSS_CHANGED );
+ be_app_messenger.SendMessage(CSS_CHANGED);
break;
}
default :
- BWindow::MessageReceived( msg );
+ BWindow::MessageReceived(msg);
}
}
-void
-PrefsWin::SaveAppSettings()
-{
- be_app_messenger.SendMessage( SAVE_APP_SETTINGS );
+void PrefsWin :: SaveAppSettings() {
+
+ be_app_messenger.SendMessage(SAVE_APP_SETTINGS);
}
-bool
-PrefsWin::QuitRequested()
-{
- BPoint point( Frame().LeftTop() );
- AppSettings->ReplacePoint( kPrefsPrefWindowPoint, point );
+bool PrefsWin :: QuitRequested() {
+
+ BPoint point(Frame().LeftTop());
+ AppSettings->ReplacePoint(kPrefsPrefWindowPoint, point);
- AppSettings->ReplaceInt32( kPrefsLastSelectedItem, fPrefsListView->CurrentSelection() );
+ AppSettings->ReplaceInt32(kPrefsLastSelectedItem, fPrefsListView->CurrentSelection());
/* Settings get saved once again when handling the following message. */
- be_app_messenger.SendMessage( PREFSWIN_CLOSE );
+ be_app_messenger.SendMessage(PREFSWIN_CLOSE);
return true;
}
@@ -439,26 +401,22 @@
*/
-PrefsListView::PrefsListView(
- BRect frame )
- : BView(
- frame,
- "PrefsListView",
- 0,
- 0 )
-{
+PrefsListView :: PrefsListView(BRect frame)
+ : BView(frame,
+ "PrefsListView",
+ 0,
+ 0) {
}
-void
-PrefsListView::AttachedToWindow()
-{
- SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
+void PrefsListView :: AttachedToWindow() {
+
+ SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
/* add the surrounding box */
BRect rect = Bounds();
- fBox = new BBox( rect, "Box" );
- AddChild( fBox );
+ fBox = new BBox(rect, "Box");
+ AddChild(fBox);
/* add the listview */
rect.InsetBy( 2, 2 );
@@ -467,52 +425,47 @@
"ListView",
B_SINGLE_SELECTION_LIST,
B_FOLLOW_ALL,
- B_WILL_DRAW | B_NAVIGABLE );
- fBox->AddChild( fListView );
+ B_WILL_DRAW | B_NAVIGABLE);
+ fBox->AddChild(fListView);
/* I want a font size of 12.0 */
fListView->SetFontSize( 12.0 );
/* add the list items */
int32 i = 0;
- while( kPrefsItems[ i ].name != NULL )
- {
+ while(kPrefsItems[i].name != NULL) {
fListView->AddItem(
new PrefsListItem(
- kPrefsItems[ i ].name,
- kPrefsItems[ i ].bitmap ) );
+ kPrefsItems[i].name,
+ kPrefsItems[i].bitmap));
i++;
}
- fListView->SetSelectionMessage( new BMessage( LIST_SELECTION_CHANGED ) );
- fListView->MakeFocus( true );
+ fListView->SetSelectionMessage(new BMessage(LIST_SELECTION_CHANGED));
+ fListView->MakeFocus(true);
/* find last selected prefs item */
int32 last_item = 0;
- AppSettings->FindInt32( kPrefsLastSelectedItem, &last_item );
- if( last_item > fListView->CountItems() - 1 )
- {
- fListView->Select( 0 );
- AppSettings->ReplaceInt32( kPrefsLastSelectedItem, 0 );
+ AppSettings->FindInt32(kPrefsLastSelectedItem, &last_item);
+ if(last_item > fListView->CountItems() - 1) {
+ fListView->Select(0);
+ AppSettings->ReplaceInt32(kPrefsLastSelectedItem, 0);
}
else
- fListView->Select( last_item );
+ fListView->Select(last_item);
}
-int32
-PrefsListView::CurrentSelection()
-{
+int32 PrefsListView :: CurrentSelection() {
+
return fListView->CurrentSelection();
}
-void
-PrefsListView::Select(
- int32 which )
-{
- fListView->Select( which );
+void PrefsListView :: Select(int32 which) {
+
+ fListView->Select(which);
}
@@ -520,37 +473,34 @@
* PrefsListItem
*/
-PrefsListItem::PrefsListItem(
- const char* name,
- const uint8* bitmapdata )
- : BListItem(),
- fName( name )
-{
+PrefsListItem :: PrefsListItem(const char* name,
+ const uint8* bitmapdata)
+ : BListItem(),
+ fName(name) {
+
fBitmap = new BBitmap(
BRect(
0,
0,
kPrefsIconSize - 1,
- kPrefsIconSize - 1 ),
- B_RGB32 );
+ kPrefsIconSize - 1),
+ B_RGB32);
memcpy(
fBitmap->Bits(),
bitmapdata,
- kPrefsIconSize * kPrefsIconSize * 4 );
+ kPrefsIconSize * kPrefsIconSize * 4);
}
-PrefsListItem::~PrefsListItem()
-{
+PrefsListItem::~PrefsListItem() {
+
delete fBitmap;
}
-void
-PrefsListItem::DrawItem(
- BView* owner,
- BRect itemRect,
- bool drawEverything = 0 )
+void PrefsListItem :: DrawItem(BView* owner,
+ BRect itemRect,
+ bool drawEverything = 0)
{
/* remember colors */
rgb_color hi = owner->HighColor();
@@ -558,8 +508,8 @@
/* draw outer rect */
BRect rect = itemRect;
- rect.InsetBy( 3, 3 );
- owner->SetLowColor( 216, 216, 216, 255 );
+ rect.InsetBy(3, 3);
+ owner->SetLowColor(216, 216, 216, 255);
owner->StrokeRoundRect(
rect,
4.0,
@@ -567,52 +517,49 @@
B_SOLID_LOW );
/* check if we are selected, and draw bounding rect */
- if( IsSelected() )
- owner->SetLowColor( 224, 224, 224, 255 );
+ if(IsSelected())
+ owner->SetLowColor(224, 224, 224, 255);
else
- owner->SetLowColor( 255, 255, 255, 255 );
+ owner->SetLowColor(255, 255, 255, 255);
/* fill area of rect according to selected state */
- rect.InsetBy( 1, 1 );
+ rect.InsetBy(1, 1);
owner->FillRoundRect(
rect,
4.0,
4.0,
- B_SOLID_LOW );
+ B_SOLID_LOW);
/* end of rect drawing */
/* draw bitmap */
- owner->SetDrawingMode( B_OP_ALPHA );
+ owner->SetDrawingMode(B_OP_ALPHA);
owner->DrawBitmap(
fBitmap,
BPoint(
itemRect.Width() / 2 - kPrefsIconSize / 2,
- itemRect.top + 5 ) );
- owner->SetDrawingMode( B_OP_COPY );
+ itemRect.top + 5));
+ owner->SetDrawingMode(B_OP_COPY);
/* draw name */
owner->DrawString(
fName,
BPoint(
- itemRect.Width() / 2 - owner->StringWidth( fName ) / 2,
- itemRect.top + 5 + kPrefsIconSize + fFontHeight ) );
+ itemRect.Width() / 2 - owner->StringWidth(fName) / 2,
+ itemRect.top + 5 + kPrefsIconSize + fFontHeight));
/* reset colors */
- owner->SetHighColor( hi );
- owner->SetLowColor( lo );
+ owner->SetHighColor(hi);
+ owner->SetLowColor(lo);
}
-void
-PrefsListItem::Update(
- BView* owner,
- const BFont* font )
-{
+void PrefsListItem :: Update(BView* owner, const BFont* font) {
+
font_height fh;
- font->GetHeight( &fh );
+ font->GetHeight(&fh);
fFontHeight = fh.leading + fh.ascent + fh.descent;
- SetHeight( kPrefsIconSize + 10 + fFontHeight );
- SetWidth( owner->Bounds().Width() );
+ SetHeight(kPrefsIconSize + 10 + fFontHeight);
+ SetWidth(owner->Bounds().Width());
}
Modified: trunk/themis/framework/PrefsWin.h
===================================================================
--- trunk/themis/framework/PrefsWin.h 2010-08-24 19:24:27 UTC (rev 547)
+++ trunk/themis/framework/PrefsWin.h 2010-08-24 19:25:15 UTC (rev 548)
@@ -12,30 +12,22 @@
class PrefsListView;
+class PrefsWin : public BWindow {
-class PrefsWin : public BWindow
-{
+ private:
+ BView * fBackgroundView;
+ PrefsListView * fPrefsListView;
+ BView * fCurrentPrefsView;
+ int32 fLastSelection;
+ BRect fViewFrame;
+
+ void SaveAppSettings();
+
public:
- PrefsWin(
- BRect frame );
+ PrefsWin(BRect frame);
+ virtual void MessageReceived(BMessage* msg);
+ virtual bool QuitRequested();
- virtual void MessageReceived(
- BMessage* msg );
-
- virtual bool QuitRequested();
-
- private:
- void SaveAppSettings();
-
- BView* fBackgroundView;
-
- PrefsListView* fPrefsListView;
-
- BView* fCurrentPrefsView;
-
- int32 fLastSelection;
-
- BRect fViewFrame;
};
#endif
@@ -51,22 +43,18 @@
#include <ListView.h>
-class PrefsListView : public BView
-{
+class PrefsListView : public BView {
+
+ private:
+ BListView * fListView;
+ BBox * fBox;
+
public:
- PrefsListView(
- BRect frame );
-
- virtual void AttachedToWindow();
-
- int32 CurrentSelection();
-
- void Select(
- int32 which );
+ PrefsListView(BRect frame);
+ virtual void AttachedToWindow();
+ int32 CurrentSelection();
+ void Select(int32 which);
- private:
- BListView* fListView;
- BBox* fBox;
};
#endif
@@ -82,29 +70,23 @@
#include <Bitmap.h>
#include <ListItem.h>
-class PrefsListItem : public BListItem
-{
+class PrefsListItem : public BListItem {
+
+ private:
+ const char * fName;
+ BBitmap * fBitmap;
+ float fFontHeight;
+
public:
- PrefsListItem(
- const char* name,
- const uint8* bitmapdata );
-
- ~PrefsListItem();
-
- virtual void DrawItem(
- BView* owner,
- BRect itemRect,
- bool drawEverything = false );
-
- virtual void Update(
- BView* owner,
- const BFont* font );
+ PrefsListItem(const char* name,
+ const uint8* bitmapdata);
+ ~PrefsListItem();
+ virtual void DrawItem(BView * owner,
+ BRect itemRect,
+ bool drawEverything = false);
+ virtual void Update(BView* owner,
+ const BFont* font);
- private:
- const char* fName;
- BBitmap* fBitmap;
-
- float fFontHeight;
};
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-08-24 19:24:33
|
Revision: 547
http://themis.svn.sourceforge.net/themis/?rev=547&view=rev
Author: mark_hellegers
Date: 2010-08-24 19:24:27 +0000 (Tue, 24 Aug 2010)
Log Message:
-----------
- Moved PrefsWin.h include to the app.cpp, so changes to it don't cause a large amount of files to be recompiled.
Modified Paths:
--------------
trunk/themis/framework/app.cpp
trunk/themis/framework/app.h
Modified: trunk/themis/framework/app.cpp
===================================================================
--- trunk/themis/framework/app.cpp 2010-08-21 23:27:15 UTC (rev 546)
+++ trunk/themis/framework/app.cpp 2010-08-24 19:24:27 UTC (rev 547)
@@ -33,6 +33,7 @@
#include <String.h>
#include "app.h"
#include "PrefsDefs.h"
+#include "PrefsWin.h"
#include "ThemisTab.h"
#include <Path.h>
using namespace _Themis_Networking_;
Modified: trunk/themis/framework/app.h
===================================================================
--- trunk/themis/framework/app.h 2010-08-21 23:27:15 UTC (rev 546)
+++ trunk/themis/framework/app.h 2010-08-24 19:24:27 UTC (rev 547)
@@ -37,11 +37,13 @@
#include "msgsystem.h"
#include "msgdaemon.h"
#include "plugman.h"
-#include "PrefsWin.h"
#include "tcpmanager.h"
#include "SiteHandler.h"
#include "win.h"
+// Declarations used
+class PrefsWin;
+
//! The application framework version number.
#define THEMIS_FRAMEWORK_APP_VERSION 0.40
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2010-08-21 23:27:21
|
Revision: 546
http://themis.svn.sourceforge.net/themis/?rev=546&view=rev
Author: mark_hellegers
Date: 2010-08-21 23:27:15 +0000 (Sat, 21 Aug 2010)
Log Message:
-----------
Removed commented out code.
Modified Paths:
--------------
trunk/themis/framework/app.h
Modified: trunk/themis/framework/app.h
===================================================================
--- trunk/themis/framework/app.h 2010-08-21 23:22:15 UTC (rev 545)
+++ trunk/themis/framework/app.h 2010-08-21 23:27:15 UTC (rev 546)
@@ -90,10 +90,6 @@
//! Returns a newly generated unique ID.
int32 GetNewID();
-// //! Returns a pointer to the TRenderView with the given ID.
-// TRenderView* GetRenderViewFor(
-// int32 id );
-
//! Returns a pointer to the UrlHandler object.
SiteHandler* GetSiteHandler();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|