-1->wxID_ANY, TRUE->true, FALSE->false & tabs->spaces replacements.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27631 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-06-04 17:58:56 +00:00
parent 72213209b7
commit 4fe30bceff
43 changed files with 805 additions and 798 deletions

View File

@@ -2,7 +2,7 @@
// Name: client.cpp
// Purpose: Remote help sample client
// Author: Julian Smart
// Modified by: Eric Dowty
// Modified by: Eric Dowty
// Created: 25/01/99
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
@@ -95,9 +95,9 @@ wxListBox *the_list = NULL;
bool MyApp::OnInit()
{
wxString a_appname, a_service, a_windowname, a_book;
m_help = NULL;
// for MSW (DDE classes), a_service is 'service name', apparently an arbitrary string
// for Unix, should be a valid file name (for a nonexistent file)
// for nonMSW, nonUnix, must be port number, for example "4242" (TCP/IP based classes)
@@ -105,62 +105,62 @@ bool MyApp::OnInit()
a_service = "/tmp/wxWidgets-helpconnection";
//a_service = "4242";
a_windowname = "HTML Help Test: %s";
#if defined(__WXMSW__)
a_appname = "helpview.exe";
#else
a_appname = "./helpview";
#endif
//a_book = "helpfiles/testing.hhp";
a_book = "test.zip";
wxConfig *conf = (wxConfig*) wxConfig::Get();
wxConfig *conf = (wxConfig*) wxConfig::Get();
#if defined(USE_REMOTE)
m_help = new wxRemoteHtmlHelpController();
m_help->SetServer( a_appname );
m_help->SetService( a_service );
m_help->SetServer( a_appname );
m_help->SetService( a_service );
#else
m_help = new wxHtmlHelpController();
#endif
//this is a dummy for wxRemoteHtmlHelpController
//this is a dummy for wxRemoteHtmlHelpController
m_help->UseConfig(conf);
m_help->AddBook( a_book );
m_help->SetTitleFormat( a_windowname );
// Create the main frame window
m_help->AddBook( a_book );
m_help->SetTitleFormat( a_windowname );
// Create the main frame window
MyFrame* frame = new MyFrame(NULL, "Help Client");
frame->Show(TRUE);
return TRUE;
frame->Show(true);
return true;
}
int MyApp::OnExit()
{
delete m_help;
delete wxConfig::Set(NULL);
delete wxConfig::Set(NULL);
return 0;
}
// Define my frame constructor
MyFrame::MyFrame(wxFrame *frame, const wxString& title)
: wxFrame(frame, -1, title, wxDefaultPosition, wxSize( 200, 100 ) )
: wxFrame(frame, wxID_ANY, title, wxDefaultPosition, wxSize( 200, 100 ) )
{
m_panel = NULL;
// Give it an icon
SetIcon(wxICON(mondrian));
// Make a menubar
wxMenu *file_menu = new wxMenu;
file_menu->Append(CLIENT_HELPMAIN, "Help - Main");
file_menu->Append(CLIENT_HELPBOOK1, "Help - Book1");
file_menu->Append(CLIENT_HELPBOOK2, "Help - Book2");
file_menu->Append(CLIENT_HELPINDEX, "Help - DisplayIndex");
file_menu->Append(CLIENT_HELPCONTENTS, "Help - DisplayContents");
file_menu->Append(CLIENT_HELPSEARCH, "Help - KeywordSearch");
@@ -168,71 +168,71 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
file_menu->Append(CLIENT_HELPADDBOOK, "Help - AddBook");
file_menu->Append(CLIENT_HELPTEMPDIR, "Help - SetTempDir");
file_menu->Append(CLIENT_HELPQUIT, "Help - Kill Server");
file_menu->Append(DIALOG_MODAL, "Modal dialog");
file_menu->Append(CLIENT_QUIT, "Quit");
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, "File");
// Associate the menu bar with the frame
SetMenuBar(menu_bar);
// Make a panel
m_panel = new wxPanel(this );
m_modalbutton = new wxButton( this, BUTTON_MODAL, "Modal Dialog",
wxPoint(10,10), wxSize(-1, -1) );
wxPoint(10,10), wxDefaultSize );
}
void MyFrame::OnHelp_Book1(wxCommandEvent& event)
{
wxGetApp().m_help->Display( "book1.htm" );
wxGetApp().m_help->Display( "book1.htm" );
}
void MyFrame::OnHelp_Book2(wxCommandEvent& event)
{
wxGetApp().m_help->Display( "book2.htm" );
wxGetApp().m_help->Display( "book2.htm" );
}
void MyFrame::OnHelp_Main(wxCommandEvent& event)
{
wxGetApp().m_help->Display( "main.htm" );
wxGetApp().m_help->Display( "main.htm" );
}
void MyFrame::OnHelp_Index(wxCommandEvent& event)
{
wxGetApp().m_help->DisplayIndex( );
wxGetApp().m_help->DisplayIndex( );
}
void MyFrame::OnHelp_Contents(wxCommandEvent& event)
{
wxGetApp().m_help->DisplayContents( );
wxGetApp().m_help->DisplayContents( );
}
void MyFrame::OnHelp_Search(wxCommandEvent& event)
{
wxGetApp().m_help->KeywordSearch( "enjoy" );
wxGetApp().m_help->KeywordSearch( "enjoy" );
}
void MyFrame::OnHelp_Title(wxCommandEvent& event)
{
wxGetApp().m_help->SetTitleFormat( "Another_Title: %s" );
wxGetApp().m_help->SetTitleFormat( "Another_Title: %s" );
}
void MyFrame::OnHelp_Addbook(wxCommandEvent& event)
{
wxGetApp().m_help->AddBook("helpfiles/another.hhp" );
wxGetApp().m_help->AddBook("helpfiles/another.hhp" );
}
void MyFrame::OnHelp_Tempdir(wxCommandEvent& event)
{
wxGetApp().m_help->SetTempDir( "tempdir" );
wxGetApp().m_help->SetTempDir( "tempdir" );
}
void MyFrame::OnHelp_Quitserver(wxCommandEvent& event)
{
// if (!wxGetApp().m_help->m_connection->Poke( wxT("--YouAreDead"), wxT("") ) )
// wxLogError(wxT("wxRemoteHtmlHelpController - YouAreDead Failed"));
wxGetApp().m_help->Quit();
// if (!wxGetApp().m_help->m_connection->Poke( wxT("--YouAreDead"), wxT("") ) )
// wxLogError(wxT("wxRemoteHtmlHelpController - YouAreDead Failed"));
wxGetApp().m_help->Quit();
}
void MyFrame::OnExit(wxCommandEvent& event)
@@ -247,7 +247,7 @@ void MyFrame::ModalDlg(wxCommandEvent& WXUNUSED(event))
}
BEGIN_EVENT_TABLE(MyModalDialog, wxDialog)
EVT_BUTTON(-1, MyModalDialog::OnButton)
EVT_BUTTON(wxID_ANY, MyModalDialog::OnButton)
END_EVENT_TABLE()
// ----------------------------------------------------------------------------
@@ -255,23 +255,23 @@ END_EVENT_TABLE()
// ----------------------------------------------------------------------------
MyModalDialog::MyModalDialog(wxWindow *parent)
: wxDialog(parent, -1, wxString("Modal dialog"))
: wxDialog(parent, wxID_ANY, wxString("Modal dialog"))
{
wxBoxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
m_main = new wxButton(this, -1, "Main");
m_book1 = new wxButton(this, -1, "Book1");
m_book2 = new wxButton(this, -1, "Book2");
m_main = new wxButton(this, wxID_ANY, "Main");
m_book1 = new wxButton(this, wxID_ANY, "Book1");
m_book2 = new wxButton(this, wxID_ANY, "Book2");
sizerTop->Add(m_main, 0, wxALIGN_CENTER | wxALL, 5);
sizerTop->Add(m_book1, 0, wxALIGN_CENTER | wxALL, 5);
sizerTop->Add(m_book2, 0, wxALIGN_CENTER | wxALL, 5);
SetAutoLayout(TRUE);
SetAutoLayout(true);
SetSizer(sizerTop);
sizerTop->SetSizeHints(this);
sizerTop->Fit(this);
m_main->SetFocus();
m_main->SetDefault();
}

View File

@@ -15,11 +15,11 @@ class MyApp: public wxApp
public:
virtual bool OnInit();
virtual int OnExit();
#if defined(USE_REMOTE)
wxRemoteHtmlHelpController *m_help;
wxRemoteHtmlHelpController *m_help;
#else
wxHtmlHelpController *m_help;
wxHtmlHelpController *m_help;
#endif
};
@@ -30,26 +30,25 @@ class MyFrame: public wxFrame
{
public:
MyFrame(wxFrame *frame, const wxString& title);
private:
void OnExit(wxCommandEvent& event);
void OnHelp_Main(wxCommandEvent& event);
void OnHelp_Book1(wxCommandEvent& event);
void OnHelp_Book2(wxCommandEvent& event);
void OnHelp_Index(wxCommandEvent& event);
void OnHelp_Contents(wxCommandEvent& event);
void OnHelp_Search(wxCommandEvent& event);
void OnHelp_Title(wxCommandEvent& event);
void OnHelp_Addbook(wxCommandEvent& event);
void OnHelp_Tempdir(wxCommandEvent& event);
void OnHelp_Quitserver(wxCommandEvent& event);
void ModalDlg(wxCommandEvent& event);
void OnHelp_Main(wxCommandEvent& event);
void OnHelp_Book1(wxCommandEvent& event);
void OnHelp_Book2(wxCommandEvent& event);
void OnHelp_Index(wxCommandEvent& event);
void OnHelp_Contents(wxCommandEvent& event);
void OnHelp_Search(wxCommandEvent& event);
void OnHelp_Title(wxCommandEvent& event);
void OnHelp_Addbook(wxCommandEvent& event);
void OnHelp_Tempdir(wxCommandEvent& event);
void OnHelp_Quitserver(wxCommandEvent& event);
void ModalDlg(wxCommandEvent& event);
wxPanel *m_panel;
wxButton *m_modalbutton;
wxButton *m_modalbutton;
DECLARE_EVENT_TABLE()
};
@@ -57,14 +56,14 @@ class MyModalDialog : public wxDialog
{
public:
MyModalDialog(wxWindow *parent);
private:
void OnButton(wxCommandEvent& event);
wxButton *m_main;
wxButton *m_book1;
wxButton *m_book2;
DECLARE_EVENT_TABLE()
};

View File

@@ -2,7 +2,7 @@
// Name: remhelp.cpp
// Purpose: Remote help controller class
// Author: Eric Dowty
// Modified by:
// Modified by:
// Created: 2002-11-18
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
@@ -57,30 +57,30 @@ rhhcClient::rhhcClient( bool *isconn_a )
wxConnectionBase *rhhcClient::OnMakeConnection()
{
return new rhhcConnection( isconn_2 );
return new rhhcConnection( isconn_2 );
}
rhhcConnection::rhhcConnection( bool *isconn_a )
: wxConnection()
{
isconn_3 = isconn_a;
*isconn_3 = TRUE;
isconn_3 = isconn_a;
*isconn_3 = true;
}
rhhcConnection::~rhhcConnection()
{
*isconn_3 = FALSE;
*isconn_3 = false;
}
bool rhhcConnection::OnAdvise(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format)
{
return TRUE;
return true;
}
bool rhhcConnection::OnDisconnect()
{
*isconn_3 = FALSE;
*isconn_3 = false;
return wxConnection::OnDisconnect();
}
@@ -93,196 +93,196 @@ IMPLEMENT_CLASS(wxRemoteHtmlHelpController, wxHelpControllerBase)
wxRemoteHtmlHelpController::wxRemoteHtmlHelpController(int style )
{
m_style = style;
m_connection = NULL;
m_client = NULL;
m_pid = 0;
isconn_1 = FALSE;
m_process = NULL;
// defaults
//
// server app is assumed to be local
//
m_style = style;
m_connection = NULL;
m_client = NULL;
m_pid = 0;
isconn_1 = false;
m_process = NULL;
// defaults
//
// server app is assumed to be local
//
// for MSW (DDE classes), a_service is 'service name', apparently an arbitrary string
// for Unix, should be a valid file name (for a nonexistent file)
// for nonMSW, nonUnix, must be port number, for example "4242" (TCP/IP based classes)
// should be unique to the client app
wxString thename = wxGetApp().GetAppName();
wxString thename = wxGetApp().GetAppName();
#if defined(__WXMSW__)
m_appname = wxT("helpview.exe");
m_service = thename + wxString(wxT("_helpservice"));
m_appname = wxT("helpview.exe");
m_service = thename + wxString(wxT("_helpservice"));
#elif defined(__UNIX__)
m_appname = wxT("./helpview");
m_service = wxT("/tmp/") + thename + wxString(wxT("_helpservice"));
m_appname = wxT("./helpview");
m_service = wxT("/tmp/") + thename + wxString(wxT("_helpservice"));
#else
m_appname = wxT("./helpview");
m_service = wxT("4242");
m_appname = wxT("./helpview");
m_service = wxT("4242");
#endif
m_book = thename + wxT(".hhp"); // or .htb or .zip
m_windowname = thename + wxT(" Help: %s");
//underscores for spaces
m_windowname.Replace( wxT(" "), wxT("_") );
m_book = thename + wxT(".hhp"); // or .htb or .zip
m_windowname = thename + wxT(" Help: %s");
//underscores for spaces
m_windowname.Replace( wxT(" "), wxT("_") );
}
void wxRemoteHtmlHelpController::SetService(wxString& a_service)
{
m_service = a_service;
m_service = a_service;
}
void wxRemoteHtmlHelpController::SetServer(wxString& a_appname)
{
m_appname = a_appname;
m_appname = a_appname;
}
void wxRemoteHtmlHelpController::OnQuit()
{
//kill the Server here?
//this function is not called ?
//kill the Server here?
//this function is not called ?
}
wxRemoteHtmlHelpController::~wxRemoteHtmlHelpController()
{
if ( isconn_1 )
{
//if (!m_connection->Poke( wxT("--YouAreDead"), wxT("") ) )
// wxLogError(wxT("wxRemoteHtmlHelpController - YouAreDead Failed"));
// Kill the server. This could be an option.
Quit();
m_connection->Disconnect();
// if (!m_connection->Poke( wxT("--YouAreDead"), wxT("") ) )
// wxLogError(wxT("wxRemoteHtmlHelpController - YouAreDead Failed"));
// Kill the server. This could be an option.
Quit();
m_connection->Disconnect();
delete m_connection;
delete m_process;
m_process = NULL;
}
if( m_client )
delete m_client; //should be automatic?
delete m_client; //should be automatic?
}
bool wxRemoteHtmlHelpController::DoConnection()
{
wxString cmd, blank;
int nsleep;
blank = wxT(" ");
// ignored under DDE, host name in TCP/IP based classes
wxString hostName = wxT("localhost");
// Create a new client
if( !m_client ) m_client = new rhhcClient(&isconn_1);
nsleep = 0;
// suppress the log messages from MakeConnection()
// suppress the log messages from MakeConnection()
{
wxLogNull nolog;
//first try to connect assuming server is running
if( !isconn_1 )
m_connection = (rhhcConnection *)m_client->MakeConnection(hostName, m_service, wxT("HELP") );
//if not, start server
if( !isconn_1 ) {
wxString stylestr;
stylestr.Printf( wxT("--Style%d"), m_style );
cmd = m_appname + blank + m_service + blank + m_windowname + blank + m_book + blank + stylestr;
m_process = new wxProcess(NULL);
m_pid = wxExecute( cmd, FALSE, m_process );
// leaks - wxExecute itself (if not deleted) and in wxExecute at
// wxExecuteData *data = new wxExecuteData;
if( m_pid <= 0 ) {
wxLogError( wxT("wxRemoteHtmlHelpController - Failed to start Help server") );
return FALSE;
}
wxLogNull nolog;
//first try to connect assuming server is running
if( !isconn_1 )
m_connection = (rhhcConnection *)m_client->MakeConnection(hostName, m_service, wxT("HELP") );
//if not, start server
if( !isconn_1 ) {
wxString stylestr;
stylestr.Printf( wxT("--Style%d"), m_style );
cmd = m_appname + blank + m_service + blank + m_windowname + blank + m_book + blank + stylestr;
m_process = new wxProcess(NULL);
m_pid = wxExecute( cmd, false, m_process );
// leaks - wxExecute itself (if not deleted) and in wxExecute at
// wxExecuteData *data = new wxExecuteData;
if( m_pid <= 0 ) {
wxLogError( wxT("wxRemoteHtmlHelpController - Failed to start Help server") );
return false;
}
}
while ( !isconn_1 )
{
//try every second for a while, then leave it to user
wxSleep(1);
if( nsleep > 4 ) {
if ( wxMessageBox( wxT("Failed to make connection to Help server.\nRetry?") ,
wxT("wxRemoteHtmlHelpController Error"),
wxICON_ERROR | wxYES_NO | wxCANCEL ) != wxYES )
{
// no server
return FALSE;
}
}
nsleep++;
m_connection = (rhhcConnection *)m_client->MakeConnection(hostName, m_service, wxT("HELP") );
//try every second for a while, then leave it to user
wxSleep(1);
if( nsleep > 4 ) {
if ( wxMessageBox( wxT("Failed to make connection to Help server.\nRetry?") ,
wxT("wxRemoteHtmlHelpController Error"),
wxICON_ERROR | wxYES_NO | wxCANCEL ) != wxYES )
{
// no server
return false;
}
}
nsleep++;
m_connection = (rhhcConnection *)m_client->MakeConnection(hostName, m_service, wxT("HELP") );
}
}
if (!m_connection->StartAdvise(wxT("Item"))) {
wxLogError(wxT("wxRemoteHtmlHelpController - StartAdvise failed") );
return FALSE;
wxLogError(wxT("wxRemoteHtmlHelpController - StartAdvise failed") );
return false;
}
return TRUE;
return true;
}
bool wxRemoteHtmlHelpController::LoadFile(const wxString& WXUNUSED(file))
{
return TRUE;
return true;
}
bool wxRemoteHtmlHelpController::DisplaySection(int sectionNo)
{
Display(sectionNo);
return TRUE;
return true;
}
bool wxRemoteHtmlHelpController::DisplayBlock(long blockNo)
{
return DisplaySection((int)blockNo);
return DisplaySection((int)blockNo);
}
bool wxRemoteHtmlHelpController::Quit()
{
//this code from exec sample - branches left in for testing
// sig = 3, 6, 9 or 12 all kill server with no apparent problem
// but give error message on MSW - timout?
int sig = 15; //3 = quit; 6 = abort; 9 = kill; 15 = terminate
/*
switch ( sig )
{
default:
wxFAIL_MSG( _T("unexpected return value") );
// fall through
case -1:
// cancelled
return FALSE;
case wxSIGNONE:
case wxSIGHUP:
case wxSIGINT:
case wxSIGQUIT:
case wxSIGILL:
case wxSIGTRAP:
case wxSIGABRT:
case wxSIGEMT:
case wxSIGFPE:
case wxSIGKILL:
case wxSIGBUS:
case wxSIGSEGV:
case wxSIGSYS:
case wxSIGPIPE:
case wxSIGALRM:
case wxSIGTERM:
break;
}
*/
//this code from exec sample - branches left in for testing
// sig = 3, 6, 9 or 12 all kill server with no apparent problem
// but give error message on MSW - timout?
int sig = 15; //3 = quit; 6 = abort; 9 = kill; 15 = terminate
/*
switch ( sig )
{
default:
wxFAIL_MSG( _T("unexpected return value") );
// fall through
case -1:
// cancelled
return false;
case wxSIGNONE:
case wxSIGHUP:
case wxSIGINT:
case wxSIGQUIT:
case wxSIGILL:
case wxSIGTRAP:
case wxSIGABRT:
case wxSIGEMT:
case wxSIGFPE:
case wxSIGKILL:
case wxSIGBUS:
case wxSIGSEGV:
case wxSIGSYS:
case wxSIGPIPE:
case wxSIGALRM:
case wxSIGTERM:
break;
}
*/
if ( sig == 0 )
{
if ( wxProcess::Exists(m_pid) )
@@ -302,22 +302,22 @@ bool wxRemoteHtmlHelpController::Quit()
static const wxChar *errorText[] =
{
_T(""), // no error
_T("signal not supported"),
_T("permission denied"),
_T("no such process"),
_T("unspecified error"),
_T("signal not supported"),
_T("permission denied"),
_T("no such process"),
_T("unspecified error"),
};
// sig = 3, 6, 9 or 12 all kill server with no apparent problem
// but give error message on MSW - timout?
//
// sig = 3, 6, 9 or 12 all kill server with no apparent problem
// but give error message on MSW - timout?
//
//wxLogError(_T("Failed to kill process %ld with signal %d: %s"),
// m_pid, sig, errorText[rc]);
}
}
return TRUE;
return true;
}
void wxRemoteHtmlHelpController::Display(const wxString& helpfile)
@@ -327,8 +327,8 @@ void wxRemoteHtmlHelpController::Display(const wxString& helpfile)
}
if (!m_connection->Execute( helpfile, -1 ) )
wxLogError(wxT("wxRemoteHtmlHelpController - Display Failed"));
wxLogError(wxT("wxRemoteHtmlHelpController - Display Failed"));
}
void wxRemoteHtmlHelpController::Display(const int id)
@@ -336,74 +336,74 @@ void wxRemoteHtmlHelpController::Display(const int id)
if( !isconn_1 ) {
if( !DoConnection() ) return;
}
wxString intstring;
intstring.Printf( "--intstring%d", id );
wxString intstring;
intstring.Printf( "--intstring%d", id );
if (!m_connection->Execute( intstring, -1 ) )
wxLogError(wxT("wxRemoteHtmlHelpController - Display Failed"));
wxLogError(wxT("wxRemoteHtmlHelpController - Display Failed"));
}
bool wxRemoteHtmlHelpController::AddBook(const wxString& book, bool show_wait_msg)
{
//ignore show_wait_msg - there shouldn't be a delay in this step
//show_wait_msg = TRUE could be transmitted with ++AddBook
m_book = book;
if( isconn_1 ) {
if (!m_connection->Poke( wxT("--AddBook"), (char*)book.c_str() ) )
wxLogError(wxT("wxRemoteHtmlHelpController - AddBook Failed"));
return FALSE;
}
return TRUE;
//ignore show_wait_msg - there shouldn't be a delay in this step
//show_wait_msg = true could be transmitted with ++AddBook
m_book = book;
if( isconn_1 ) {
if (!m_connection->Poke( wxT("--AddBook"), (char*)book.c_str() ) )
wxLogError(wxT("wxRemoteHtmlHelpController - AddBook Failed"));
return false;
}
return true;
}
bool wxRemoteHtmlHelpController::DisplayContents()
{
if( isconn_1 ) {
if (!m_connection->Poke( wxT("--DisplayContents"), wxT("") ) ) {
wxLogError(wxT("wxRemoteHtmlHelpController - DisplayContents Failed"));
return FALSE;
}
}
return TRUE;
if( isconn_1 ) {
if (!m_connection->Poke( wxT("--DisplayContents"), wxT("") ) ) {
wxLogError(wxT("wxRemoteHtmlHelpController - DisplayContents Failed"));
return false;
}
}
return true;
}
void wxRemoteHtmlHelpController::DisplayIndex()
{
if( isconn_1 ) {
if (!m_connection->Poke( wxT("--DisplayIndex"), wxT("") ) )
wxLogError(wxT("wxRemoteHtmlHelpController - DisplayIndex Failed"));
}
if( isconn_1 ) {
if (!m_connection->Poke( wxT("--DisplayIndex"), wxT("") ) )
wxLogError(wxT("wxRemoteHtmlHelpController - DisplayIndex Failed"));
}
}
bool wxRemoteHtmlHelpController::KeywordSearch(const wxString& keyword)
{
if( isconn_1 ) {
if (!m_connection->Poke( wxT("--KeywordSearch"), (char*)keyword.c_str() ) ) {
wxLogError(wxT("wxRemoteHtmlHelpController - KeywordSearch Failed"));
return FALSE;
}
}
return TRUE;
if( isconn_1 ) {
if (!m_connection->Poke( wxT("--KeywordSearch"), (char*)keyword.c_str() ) ) {
wxLogError(wxT("wxRemoteHtmlHelpController - KeywordSearch Failed"));
return false;
}
}
return true;
}
void wxRemoteHtmlHelpController::SetTitleFormat(const wxString& format)
{
m_windowname = format;
m_windowname.Replace( wxT(" "), wxT("_") );
if( isconn_1 ) {
if (!m_connection->Poke( wxT("--SetTitleFormat"), (char*)format.c_str() ) )
wxLogError(wxT("wxRemoteHtmlHelpController - SetTitleFormat Failed"));
}
m_windowname = format;
m_windowname.Replace( wxT(" "), wxT("_") );
if( isconn_1 ) {
if (!m_connection->Poke( wxT("--SetTitleFormat"), (char*)format.c_str() ) )
wxLogError(wxT("wxRemoteHtmlHelpController - SetTitleFormat Failed"));
}
}
void wxRemoteHtmlHelpController::SetTempDir(const wxString& path)
{
if( isconn_1 ) {
if (!m_connection->Poke( wxT("--SetTempDir"), (char*)path.c_str() ) )
wxLogError(wxT("wxRemoteHtmlHelpController - SetTempDir Failed"));
}
if( isconn_1 ) {
if (!m_connection->Poke( wxT("--SetTempDir"), (char*)path.c_str() ) )
wxLogError(wxT("wxRemoteHtmlHelpController - SetTempDir Failed"));
}
}

View File

@@ -2,7 +2,7 @@
// Name: remhelp.h
// Purpose: Remote help controller class
// Author: Eric Dowty
// Modified by:
// Modified by:
// Created: 2002-11-18
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
@@ -30,68 +30,68 @@ public:
bool OnAdvise(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format);
bool OnDisconnect();
bool *isconn_3;
bool *isconn_3;
};
class rhhcClient: public wxClient
{
public:
rhhcClient(bool *isconn_a);
//~rhhcClient( );
rhhcClient(bool *isconn_a);
//~rhhcClient( );
wxConnectionBase *OnMakeConnection();
bool *isconn_2;
bool *isconn_2;
};
class wxRemoteHtmlHelpController : public wxHelpControllerBase
{
DECLARE_CLASS(wxRemoteHtmlHelpController)
DECLARE_CLASS(wxRemoteHtmlHelpController)
public:
wxRemoteHtmlHelpController(int style = wxHF_DEFAULT_STYLE);
~wxRemoteHtmlHelpController();
void OnQuit(void);
wxRemoteHtmlHelpController(int style = wxHF_DEFAULT_STYLE);
~wxRemoteHtmlHelpController();
void OnQuit(void);
void SetService(wxString& a_service);
void SetServer(wxString& a_appname); //could be wxHelpController::SetViewer
void SetService(wxString& a_service);
void SetServer(wxString& a_appname); //could be wxHelpController::SetViewer
//standard wxHtmlHelpController functions
bool AddBook(const wxString& book, bool show_wait_msg = FALSE);
void Display(const wxString& x);
void Display(const int id);
bool DisplayContents();
void DisplayIndex();
bool KeywordSearch(const wxString& keyword);
void SetTempDir(const wxString& path);
void SetTitleFormat(const wxString& format);
//standard wxHtmlHelpController functions
bool AddBook(const wxString& book, bool show_wait_msg = false);
void Display(const wxString& x);
void Display(const int id);
bool DisplayContents();
void DisplayIndex();
bool KeywordSearch(const wxString& keyword);
void SetTempDir(const wxString& path);
void SetTitleFormat(const wxString& format);
//dummies - config is in server
void UseConfig(wxConfigBase* config, const wxString& rootpath = wxEmptyString) {};
void ReadCustomization(wxConfigBase* cfg, wxString path = wxEmptyString) {};
void WriteCustomization(wxConfigBase* cfg, wxString path = wxEmptyString) {};
//dummies - config is in server
void UseConfig(wxConfigBase* config, const wxString& rootpath = wxEmptyString) {};
void ReadCustomization(wxConfigBase* cfg, wxString path = wxEmptyString) {};
void WriteCustomization(wxConfigBase* cfg, wxString path = wxEmptyString) {};
//virtuals from wxHelpControllerBase - not in wxHtmlHelpController
//won't compile without these
bool LoadFile(const class wxString &); //dummy
bool DisplaySection(int);
bool DisplayBlock(long);
bool Quit(void);
//virtuals from wxHelpControllerBase - not in wxHtmlHelpController
//won't compile without these
bool LoadFile(const class wxString &); //dummy
bool DisplaySection(int);
bool DisplayBlock(long);
bool Quit(void);
private:
void OnExit(wxCommandEvent& event);
bool DoConnection();
void OnExit(wxCommandEvent& event);
bool DoConnection();
rhhcConnection *m_connection;
rhhcClient *m_client;
wxProcess *m_process;
rhhcConnection *m_connection;
rhhcClient *m_client;
wxProcess *m_process;
int m_pid;
int m_style;
wxString m_appname;
wxString m_service;
wxString m_windowname;
wxString m_book;
bool isconn_1;
int m_pid;
int m_style;
wxString m_appname;
wxString m_service;
wxString m_windowname;
wxString m_book;
bool isconn_1;
};
#endif
// _WX_REMHELP_H_
// _WX_REMHELP_H_