minor cleanup: corrected typos, etc.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36326 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -57,9 +57,9 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
|
||||
style |= wxTAB_TRAVERSAL;
|
||||
|
||||
if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style & ~(wxYES|wxOK|wxNO /*|wxCANCEL*/) , name) )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxDialog::SetModal(bool flag)
|
||||
@@ -83,8 +83,8 @@ void wxDialog::SetModal(bool flag)
|
||||
|
||||
wxDialog::~wxDialog()
|
||||
{
|
||||
m_isBeingDeleted = TRUE;
|
||||
Show(FALSE);
|
||||
m_isBeingDeleted = true;
|
||||
Show(false);
|
||||
}
|
||||
|
||||
// By default, pressing escape cancels the dialog; on mac command-stop does the same thing
|
||||
@@ -123,7 +123,7 @@ bool wxDialog::Show(bool show)
|
||||
if ( !wxDialogBase::Show(show) )
|
||||
{
|
||||
// nothing to do
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( show )
|
||||
@@ -140,13 +140,13 @@ bool wxDialog::Show(bool show)
|
||||
}
|
||||
else // end of modal dialog
|
||||
{
|
||||
// this will cause IsModalShowing() return FALSE and our local
|
||||
// this will cause IsModalShowing() return false and our local
|
||||
// message loop will terminate
|
||||
wxModalDialogs.DeleteObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
#if !TARGET_CARBON
|
||||
@@ -183,15 +183,13 @@ void wxDialog::DoShowModal()
|
||||
}
|
||||
|
||||
|
||||
// Replacement for Show(TRUE) for modal dialogs - returns return code
|
||||
// Replacement for Show(true) for modal dialogs - returns return code
|
||||
int wxDialog::ShowModal()
|
||||
{
|
||||
if ( !m_isModalStyle )
|
||||
{
|
||||
SetModal(TRUE);
|
||||
}
|
||||
SetModal(true);
|
||||
|
||||
Show(TRUE);
|
||||
Show(true);
|
||||
return GetReturnCode();
|
||||
}
|
||||
|
||||
@@ -200,7 +198,7 @@ int wxDialog::ShowModal()
|
||||
void wxDialog::EndModal(int retCode)
|
||||
{
|
||||
SetReturnCode(retCode);
|
||||
Show(FALSE);
|
||||
Show(false);
|
||||
SetModal(false);
|
||||
}
|
||||
|
||||
@@ -208,15 +206,14 @@ void wxDialog::EndModal(int retCode)
|
||||
void wxDialog::OnOK(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if ( Validate() && TransferDataFromWindow() )
|
||||
{
|
||||
EndModal(wxID_OK);
|
||||
}
|
||||
}
|
||||
|
||||
void wxDialog::OnApply(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if (Validate())
|
||||
TransferDataFromWindow();
|
||||
|
||||
// TODO probably need to disable the Apply button until things change again
|
||||
}
|
||||
|
||||
|
||||
@@ -248,7 +248,6 @@ void wxMacCarbonPrintData::TransferTo( wxPageSetupData* data )
|
||||
if ( data->GetMarginBottomRight().y < data->GetMinMarginBottomRight().y )
|
||||
data->SetMarginBottomRight( wxPoint( data->GetMarginBottomRight().x ,
|
||||
data->GetMinMarginBottomRight().y) );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -287,14 +286,10 @@ void wxMacCarbonPrintData::TransferFrom( wxPrintDialogData* data )
|
||||
PMSetFirstPage( m_macPrintSettings , data->GetFromPage() , false ) ;
|
||||
|
||||
if (data->GetAllPages() || data->GetFromPage() == 0)
|
||||
{
|
||||
PMSetLastPage( m_macPrintSettings , (UInt32) kPMPrintAllPages, true ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
PMSetLastPage( m_macPrintSettings , (UInt32) data->GetToPage() , false ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Printer
|
||||
@@ -311,13 +306,13 @@ wxMacPrinter::~wxMacPrinter(void)
|
||||
|
||||
bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
||||
{
|
||||
sm_abortIt = FALSE;
|
||||
sm_abortIt = false;
|
||||
sm_abortWindow = NULL;
|
||||
|
||||
if (!printout)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
printout->SetIsPreview(FALSE);
|
||||
printout->SetIsPreview(false);
|
||||
if (m_printDialogData.GetMinPage() < 1)
|
||||
m_printDialogData.SetMinPage(1);
|
||||
if (m_printDialogData.GetMaxPage() < 1)
|
||||
@@ -339,16 +334,15 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
||||
dc = new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
|
||||
}
|
||||
|
||||
|
||||
// May have pressed cancel.
|
||||
if (!dc || !dc->Ok())
|
||||
{
|
||||
if (dc) delete dc;
|
||||
return FALSE;
|
||||
if (dc)
|
||||
delete dc;
|
||||
return false;
|
||||
}
|
||||
|
||||
// on the mac we have always pixels as addressing mode with 72 dpi
|
||||
|
||||
printout->SetPPIScreen(72, 72);
|
||||
PMResolution res;
|
||||
wxMacCarbonPrintData* nativeData = (wxMacCarbonPrintData*)
|
||||
@@ -379,7 +373,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
||||
if (maxPage == 0)
|
||||
{
|
||||
wxEndBusyCursor();
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only set min and max, because from and to have been
|
||||
@@ -395,15 +389,17 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
||||
wxEndBusyCursor();
|
||||
wxMessageBox(wxT("Sorry, could not create an abort dialog."), wxT("Print Error"), wxOK, parent);
|
||||
delete dc;
|
||||
return FALSE;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
sm_abortWindow = win;
|
||||
sm_abortWindow->Show(TRUE);
|
||||
sm_abortWindow->Show(true);
|
||||
wxSafeYield(win,true);
|
||||
|
||||
printout->OnBeginPrinting();
|
||||
|
||||
bool keepGoing = TRUE;
|
||||
bool keepGoing = true;
|
||||
|
||||
int copyCount;
|
||||
for (copyCount = 1; copyCount <= m_printDialogData.GetNoCopies(); copyCount ++)
|
||||
@@ -418,12 +414,13 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
||||
break;
|
||||
|
||||
int pn;
|
||||
for (pn = m_printDialogData.GetFromPage(); keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn);
|
||||
for (pn = m_printDialogData.GetFromPage();
|
||||
keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn);
|
||||
pn++)
|
||||
{
|
||||
if (sm_abortIt)
|
||||
{
|
||||
keepGoing = FALSE;
|
||||
keepGoing = false;
|
||||
break;
|
||||
}
|
||||
else
|
||||
@@ -449,7 +446,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
||||
|
||||
if (sm_abortWindow)
|
||||
{
|
||||
sm_abortWindow->Show(FALSE);
|
||||
sm_abortWindow->Show(false);
|
||||
delete sm_abortWindow;
|
||||
sm_abortWindow = NULL;
|
||||
}
|
||||
@@ -458,7 +455,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
||||
|
||||
delete dc;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
wxDC* wxMacPrinter::PrintDialog(wxWindow *parent)
|
||||
@@ -481,17 +478,16 @@ bool wxMacPrinter::Setup(wxWindow *parent)
|
||||
{
|
||||
#if 0
|
||||
wxPrintDialog dialog(parent, & m_printDialogData);
|
||||
dialog.GetPrintDialogData().SetSetupDialog(TRUE);
|
||||
dialog.GetPrintDialogData().SetSetupDialog(true);
|
||||
|
||||
int ret = dialog.ShowModal();
|
||||
|
||||
if (ret == wxID_OK)
|
||||
{
|
||||
m_printDialogData = dialog.GetPrintDialogData();
|
||||
}
|
||||
|
||||
return (ret == wxID_OK);
|
||||
#endif
|
||||
|
||||
return wxID_CANCEL;
|
||||
}
|
||||
|
||||
@@ -520,7 +516,8 @@ wxMacPrintPreview::~wxMacPrintPreview(void)
|
||||
bool wxMacPrintPreview::Print(bool interactive)
|
||||
{
|
||||
if (!m_printPrintout)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
wxMacPrinter printer(&m_printDialogData);
|
||||
return printer.Print(m_previewFrame, m_printPrintout, interactive);
|
||||
}
|
||||
@@ -556,6 +553,7 @@ void wxMacPrintPreview::DetermineScaling(void)
|
||||
{
|
||||
m_isOk = false ;
|
||||
}
|
||||
|
||||
// At 100%, the page should look about page-size on the screen.
|
||||
// m_previewScale = (float)((float)screenWidth/(float)printerWidth);
|
||||
// m_previewScale = m_previewScale * (float)((float)screenXRes/(float)printerXRes);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(__VISAGECPP__)
|
||||
#define BSD_SELECT /* use Berkley Sockets select */
|
||||
#define BSD_SELECT /* use Berkeley Sockets select */
|
||||
#endif
|
||||
|
||||
#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
|
||||
@@ -613,6 +613,7 @@ GSocket *GSocket::WaitConnection()
|
||||
m_error = GSOCK_MEMERR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
err = _GAddress_translate_from(connection->m_peer, &from, fromlen);
|
||||
if (err != GSOCK_NOERROR)
|
||||
{
|
||||
@@ -620,6 +621,7 @@ GSocket *GSocket::WaitConnection()
|
||||
m_error = err;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(__EMX__) || defined(__VISAGECPP__)
|
||||
ioctl(connection->m_fd, FIONBIO, (char*)&arg, sizeof(arg));
|
||||
#else
|
||||
@@ -633,10 +635,13 @@ GSocket *GSocket::WaitConnection()
|
||||
bool GSocket::SetReusable()
|
||||
{
|
||||
/* socket must not be null, and must not be in use/already bound */
|
||||
if (this && m_fd == INVALID_SOCKET) {
|
||||
if (this && m_fd == INVALID_SOCKET)
|
||||
{
|
||||
m_reusable = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -725,9 +730,7 @@ GSocketError GSocket::Connect(GSocketStream stream)
|
||||
*/
|
||||
|
||||
if (m_non_blocking || ret == 0)
|
||||
{
|
||||
gs_gui_functions->Enable_Events(this);
|
||||
}
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
@@ -778,6 +781,7 @@ GSocketError GSocket::Connect(GSocketStream stream)
|
||||
*/
|
||||
Close();
|
||||
m_error = GSOCK_IOERR;
|
||||
|
||||
return GSOCK_IOERR;
|
||||
}
|
||||
|
||||
@@ -875,7 +879,8 @@ int GSocket::Read(char *buffer, int size)
|
||||
* re-enabled! */
|
||||
ret = -1;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
/* Read the data */
|
||||
if (m_stream)
|
||||
ret = Recv_Stream(buffer, size);
|
||||
@@ -888,7 +893,8 @@ int GSocket::Read(char *buffer, int size)
|
||||
*/
|
||||
if (ret == 0)
|
||||
m_error = GSOCK_IOERR;
|
||||
else if (ret == -1) {
|
||||
else if (ret == -1)
|
||||
{
|
||||
if ((errno == EWOULDBLOCK) || (errno == EAGAIN))
|
||||
m_error = GSOCK_WOULDBLOCK;
|
||||
else
|
||||
@@ -951,6 +957,7 @@ int GSocket::Write(const char *buffer, int size)
|
||||
* will further OUTPUT events be posted.
|
||||
*/
|
||||
Enable(GSOCK_OUTPUT);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1094,10 +1101,8 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
assert(this);
|
||||
return flags & m_detected;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1210,9 +1215,8 @@ GSocketError GSocket::GetSockOpt(int level, int optname,
|
||||
void *optval, int *optlen)
|
||||
{
|
||||
if (getsockopt(m_fd, level, optname, (char*)optval, (SOCKOPTLEN_T*)optlen) == 0)
|
||||
{
|
||||
return GSOCK_NOERROR;
|
||||
}
|
||||
|
||||
return GSOCK_OPTERR;
|
||||
}
|
||||
|
||||
@@ -1220,9 +1224,8 @@ GSocketError GSocket::SetSockOpt(int level, int optname,
|
||||
const void *optval, int optlen)
|
||||
{
|
||||
if (setsockopt(m_fd, level, optname, (const char*)optval, optlen) == 0)
|
||||
{
|
||||
return GSOCK_NOERROR;
|
||||
}
|
||||
|
||||
return GSOCK_OPTERR;
|
||||
}
|
||||
|
||||
@@ -1270,6 +1273,7 @@ GSocketError GSocket::Input_Timeout()
|
||||
m_error = GSOCK_TIMEDOUT;
|
||||
return GSOCK_TIMEDOUT;
|
||||
}
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
GSocket_Debug(( "GSocket_Input_Timeout, select returned -1\n" ));
|
||||
@@ -1281,6 +1285,7 @@ GSocketError GSocket::Input_Timeout()
|
||||
return GSOCK_TIMEDOUT;
|
||||
}
|
||||
}
|
||||
|
||||
return GSOCK_NOERROR;
|
||||
}
|
||||
|
||||
@@ -1311,6 +1316,7 @@ GSocketError GSocket::Output_Timeout()
|
||||
m_error = GSOCK_TIMEDOUT;
|
||||
return GSOCK_TIMEDOUT;
|
||||
}
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
GSocket_Debug(( "GSocket_Output_Timeout, select returned -1\n" ));
|
||||
@@ -1321,10 +1327,13 @@ GSocketError GSocket::Output_Timeout()
|
||||
m_error = GSOCK_TIMEDOUT;
|
||||
return GSOCK_TIMEDOUT;
|
||||
}
|
||||
if ( ! wxFD_ISSET(m_fd, &writefds) ) {
|
||||
|
||||
if ( ! wxFD_ISSET(m_fd, &writefds) )
|
||||
{
|
||||
GSocket_Debug(( "GSocket_Output_Timeout is buggy!\n" ));
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
GSocket_Debug(( "GSocket_Output_Timeout seems correct\n" ));
|
||||
}
|
||||
}
|
||||
@@ -1342,7 +1351,9 @@ int GSocket::Recv_Stream(char *buffer, int size)
|
||||
do
|
||||
{
|
||||
ret = recv(m_fd, buffer, size, GSOCKET_MSG_NOSIGNAL);
|
||||
} while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
|
||||
}
|
||||
while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1358,7 +1369,8 @@ int GSocket::Recv_Dgram(char *buffer, int size)
|
||||
do
|
||||
{
|
||||
ret = recvfrom(m_fd, buffer, size, 0, &from, (WX_SOCKLEN_T *) &fromlen);
|
||||
} while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
|
||||
}
|
||||
while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
|
||||
|
||||
if (ret == -1)
|
||||
return -1;
|
||||
@@ -1373,6 +1385,7 @@ int GSocket::Recv_Dgram(char *buffer, int size)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
err = _GAddress_translate_from(m_peer, &from, fromlen);
|
||||
if (err != GSOCK_NOERROR)
|
||||
{
|
||||
@@ -1394,7 +1407,8 @@ int GSocket::Send_Stream(const char *buffer, int size)
|
||||
do
|
||||
{
|
||||
ret = send(m_fd, (char *)buffer, size, GSOCKET_MSG_NOSIGNAL);
|
||||
} while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
|
||||
}
|
||||
while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
|
||||
|
||||
UNMASK_SIGNAL();
|
||||
|
||||
@@ -1425,7 +1439,8 @@ int GSocket::Send_Dgram(const char *buffer, int size)
|
||||
do
|
||||
{
|
||||
ret = sendto(m_fd, (char *)buffer, size, 0, addr, len);
|
||||
} while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
|
||||
}
|
||||
while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
|
||||
|
||||
UNMASK_SIGNAL();
|
||||
|
||||
@@ -1535,7 +1550,9 @@ GSocket *GSocket_new(void)
|
||||
GSocket *newsocket = new GSocket();
|
||||
if (newsocket->IsOk())
|
||||
return newsocket;
|
||||
|
||||
delete newsocket;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1675,6 +1692,7 @@ GSocketError _GAddress_translate_from(GAddress *address,
|
||||
address->m_error = GSOCK_MEMERR;
|
||||
return GSOCK_MEMERR;
|
||||
}
|
||||
|
||||
memcpy(address->m_addr, addr, len);
|
||||
|
||||
return GSOCK_NOERROR;
|
||||
@@ -1761,9 +1779,11 @@ GSocketError GAddress_INET_SetHostName(GAddress *address, const char *hostname)
|
||||
address->m_error = GSOCK_NOHOST;
|
||||
return GSOCK_NOHOST;
|
||||
}
|
||||
|
||||
array_addr = (struct in_addr *) *(he->h_addr_list);
|
||||
addr->s_addr = array_addr[0].s_addr;
|
||||
}
|
||||
|
||||
return GSOCK_NOERROR;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user