wxChar *save_ptr, *token = wxStrtok (s, PATH_TOKS, &save_ptr);
if (token)
- {
+ {
Add (copystring (token));
while (token)
- {
+ {
if ((token = wxStrtok ((wxChar *) NULL, PATH_TOKS, &save_ptr)) != NULL)
- Add (wxString(token));
- }
- }
- delete[]s;
+ Add (wxString(token));
+ }
+ }
+
+ // suppress warning about unused variable save_ptr when wxStrtok() is a
+ // macro which throws away its third argument
+ save_ptr = token;
+
+ delete [] s;
}
}
// find a file in a list of directories, returns false if not found
bool wxFindFileInPath(wxString *pStr, const wxChar *pszPath, const wxChar *pszFile)
{
- // we assume that it's not empty
- wxCHECK_MSG( !wxIsEmpty(pszFile), FALSE,
- _("empty file name in wxFindFileInPath"));
-
- // skip path separator in the beginning of the file name if present
- if ( wxIsPathSeparator(*pszFile) )
- pszFile++;
-
- // copy the path (strtok will modify it)
- wxChar *szPath = new wxChar[wxStrlen(pszPath) + 1];
- wxStrcpy(szPath, pszPath);
-
- wxString strFile;
- wxChar *pc, *save_ptr;
- for ( pc = wxStrtok(szPath, wxPATH_SEP, &save_ptr);
- pc != NULL;
- pc = wxStrtok((wxChar *) NULL, wxPATH_SEP, &save_ptr) )
- {
- // search for the file in this directory
- strFile = pc;
- if ( !wxEndsWithPathSeparator(pc) )
- strFile += wxFILE_SEP_PATH;
- strFile += pszFile;
-
- if ( FileExists(strFile) ) {
- *pStr = strFile;
- break;
+ // we assume that it's not empty
+ wxCHECK_MSG( !wxIsEmpty(pszFile), FALSE,
+ _("empty file name in wxFindFileInPath"));
+
+ // skip path separator in the beginning of the file name if present
+ if ( wxIsPathSeparator(*pszFile) )
+ pszFile++;
+
+ // copy the path (strtok will modify it)
+ wxChar *szPath = new wxChar[wxStrlen(pszPath) + 1];
+ wxStrcpy(szPath, pszPath);
+
+ wxString strFile;
+ wxChar *pc, *save_ptr;
+ for ( pc = wxStrtok(szPath, wxPATH_SEP, &save_ptr);
+ pc != NULL;
+ pc = wxStrtok((wxChar *) NULL, wxPATH_SEP, &save_ptr) )
+ {
+ // search for the file in this directory
+ strFile = pc;
+ if ( !wxEndsWithPathSeparator(pc) )
+ strFile += wxFILE_SEP_PATH;
+ strFile += pszFile;
+
+ if ( FileExists(strFile) ) {
+ *pStr = strFile;
+ break;
+ }
}
- }
- delete [] szPath;
+ // suppress warning about unused variable save_ptr when wxStrtok() is a
+ // macro which throws away its third argument
+ save_ptr = pc;
+
+ delete [] szPath;
- return pc != NULL; // if true => we breaked from the loop
+ return pc != NULL; // if true => we breaked from the loop
}
void WXDLLEXPORT wxSplitPath(const wxChar *pszFileName,
#undef GetFirstChild
#endif
+#ifndef __WXMSW__
/* XPM */
static char * icon1_xpm[] = {
/* width height ncolors chars_per_pixel */
" ",
" "};
+#endif // !wxMSW
+
static const int ID_DIRCTRL = 1000;
static const int ID_TEXTCTRL = 1001;
static const int ID_OK = 1002;
{
if ( m_hasCaret )
{
- wxWindow *winFocus = wxWindow::FindFocus();
- wxASSERT_MSG( winFocus == GetWindow(), wxT("how did we lose focus?") );
+ wxASSERT_MSG( wxWindow::FindFocus() == GetWindow(),
+ wxT("how did we lose focus?") );
CALL_CARET_API(SetCaretPos, (m_x, m_y));
}
wxPrinterDC::wxPrinterDC(const wxString& driver_name, const wxString& device_name, const wxString& file, bool interactive, int orientation)
{
m_isInteractive = interactive;
-
+
if (!file.IsNull() && file != wxT(""))
m_printData.SetFilename(file);
-
+
#if wxUSE_COMMON_DIALOGS
if (interactive)
{
PRINTDLG pd;
-
+
pd.lStructSize = sizeof( PRINTDLG );
pd.hwndOwner=(HWND) NULL;
pd.hDevMode=(HANDLE)NULL;
pd.nMaxPage=0;
pd.nCopies=1;
pd.hInstance=(HINSTANCE)NULL;
-
+
if ( PrintDlg( &pd ) != 0 )
{
m_hDC = (WXHDC) pd.hDC;
m_ok = FALSE;
return;
}
-
+
// m_dontDelete = TRUE;
}
else
m_hDC = wxGetPrinterDC(printData);
m_ok = m_hDC ? TRUE: FALSE;
}
-
+
if (m_hDC)
{
// int width = GetDeviceCaps(m_hDC, VERTRES);
m_hDC = wxGetPrinterDC(printData);
m_ok = (m_hDC != 0);
-
+
if (m_hDC)
SetMapMode(wxMM_TEXT);
-
+
SetBrush(*wxBLACK_BRUSH);
SetPen(*wxBLACK_PEN);
}
wxPrinterDC::wxPrinterDC(WXHDC theDC)
{
m_isInteractive = FALSE;
-
+
m_hDC = theDC;
m_ok = TRUE;
if (m_hDC)
docinfo.lpszDatatype = NULL;
docinfo.fwType = 0;
#endif
-
+
if (!m_hDC)
return FALSE;
-
+
int ret =
#ifndef __WIN32__
::StartDoc((HDC) m_hDC, &docinfo);
#endif
#endif
#endif
-
+
#ifndef __WIN16__
if (ret <= 0)
{
wxLogDebug(wxT("wxDC::StartDoc failed with error: %d\n"), lastError);
}
#endif
-
+
return (ret > 0);
}
LPSTR lpszDriverName;
LPSTR lpszDeviceName;
LPSTR lpszPortName;
-
+
PRINTDLG pd;
// Cygwin has trouble believing PRINTDLG is 66 bytes - thinks it is 68
pd.hDevNames = NULL; // Ditto
pd.Flags = PD_RETURNDEFAULT;
pd.nCopies = 1;
-
+
if (!PrintDlg((LPPRINTDLG)&pd))
{
if ( pd.hDevMode )
GlobalFree(pd.hDevMode);
if (pd.hDevNames)
GlobalFree(pd.hDevNames);
-
+
return FALSE;
}
-
+
if (pd.hDevNames)
{
lpDevNames = (LPDEVNAMES)GlobalLock(pd.hDevNames);
deviceName = lpszDeviceName;
portName = lpszPortName;
}
-
+
if (pd.hDevMode)
{
GlobalFree(pd.hDevMode);
LPSTR lpszDriverName;
LPSTR lpszDeviceName;
LPSTR lpszPortName;
-
+
PRINTDLG pd;
// __GNUWIN32__ has trouble believing PRINTDLG is 66 bytes - thinks it is 68
#ifdef __GNUWIN32__
pd.hDevNames = NULL; // Ditto
pd.Flags = PD_RETURNDEFAULT;
pd.nCopies = 1;
-
+
if (!PrintDlg((LPPRINTDLG)&pd))
{
if ( pd.hDevMode )
GlobalFree(pd.hDevMode);
if (pd.hDevNames)
GlobalFree(pd.hDevNames);
-
+
return(0);
}
-
+
if (!pd.hDevNames)
{
if ( pd.hDevMode )
GlobalFree(pd.hDevMode);
}
-
+
lpDevNames = (LPDEVNAMES)GlobalLock(pd.hDevNames);
lpszDriverName = (LPSTR)lpDevNames + lpDevNames->wDriverOffset;
lpszDeviceName = (LPSTR)lpDevNames + lpDevNames->wDeviceOffset;
lpszPortName = (LPSTR)lpDevNames + lpDevNames->wOutputOffset;
GlobalUnlock(pd.hDevNames);
-
+
if ( pd.hDevMode )
{
lpDevMode = (DEVMODE*) GlobalLock(pd.hDevMode);
lpDevMode->dmOrientation = orientation;
lpDevMode->dmFields |= DM_ORIENTATION;
}
-
+
#ifdef __WIN32__
hDC = CreateDC(lpszDriverName, lpszDeviceName, lpszPortName, (DEVMODE *)lpDevMode);
#else
hDC = CreateDC(lpszDriverName, lpszDeviceName, lpszPortName, (LPSTR)lpDevMode);
#endif
-
+
if (pd.hDevMode && lpDevMode)
GlobalUnlock(pd.hDevMode);
-
+
if (pd.hDevNames)
{
GlobalFree(pd.hDevNames);
{
wxPrintData printData = printDataConst;
printData.ConvertToNative();
-
+
wxChar* driverName = (wxChar*) NULL;
-
+
wxString devNameStr = printData.GetPrinterName();
wxChar* deviceName;
wxChar* portName = (wxChar*) NULL; // Obsolete in WIN32
-
+
if (devNameStr == wxT(""))
deviceName = (wxChar*) NULL;
else
{
// Retrieve the default device name
wxString portName;
- bool ret = wxGetDefaultDeviceName(devNameStr, portName);
+#ifdef __WXDEBUG__
+ bool ret =
+#else // !Debug
+ (void)
+#endif // Debug/Release
+ wxGetDefaultDeviceName(devNameStr, portName);
wxASSERT_MSG( ret, wxT("Could not get default device name.") );
deviceName = WXSTRINGCAST devNameStr;
}
-
+
#ifdef __WIN32__
HDC hDC = CreateDC(driverName, deviceName, portName, (DEVMODE *) lpDevMode);
#else
HDC hDC = CreateDC(driverName, deviceName, portName, (LPSTR) lpDevMode);
#endif
-
+
if (hDevMode && lpDevMode)
GlobalUnlock(hDevMode);
-
+
return (WXHDC) hDC;
}
if ( !GetEventHandler()->ProcessEvent(event) )
return FALSE;
- if (hdr1->code == LVN_GETDISPINFO)
+ if ( (int)hdr1->code == LVN_GETDISPINFO)
{
LV_DISPINFO *info = (LV_DISPINFO *)lParam;
if ( info->item.mask & LVIF_TEXT )
else
{
#ifdef __WIN32__
- if ( id == idMenuTitle )
+ if ( (int)id == idMenuTitle )
{
// visually select the menu title
MENUITEMINFO mii;
}
if ( ::ModifyMenu(GetHmenu(), pos, MF_BYPOSITION | MF_STRING | flagsOld,
- id, label) == 0xFFFFFFFF )
+ id, label) == (int)0xFFFFFFFF )
{
wxLogLastError("ModifyMenu");
}
void wxMenuBar::Detach()
{
// ::DestroyMenu((HMENU)m_hMenu);
- m_hMenu = NULL;
+ m_hMenu = (WXHMENU)NULL;
m_menuBarFrame = NULL;
}
if ( ::ModifyMenu(hMenu, id,
MF_BYCOMMAND | flagsOld,
- id, data) == 0xFFFFFFFF )
+ id, data) == (int)0xFFFFFFFF )
{
wxLogLastError(wxT("ModifyMenu"));
}
wxWindowsPrinter::~wxWindowsPrinter()
{
+ // avoids mingw warning about statement with no effect (FreeProcInstance
+ // doesn't do anything under Win32)
+#ifndef __GNUWIN32__
FreeProcInstance((FARPROC) m_lpAbortProc);
+#endif
}
bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
{
if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
height = totHeight + extraHeight;
- else
+ else
height = heightOld;
}
{
bool processed = TRUE;
if ( msg != WM_KEYDOWN )
- processed = FALSE;
+ processed = FALSE;
if ( processed )
{
// fall through
default:
- processed = FALSE;
+ processed = FALSE;
}
if ( processed )
// the tooltips control created by the toolbar is sometimes Unicode, even in
// an ANSI application
- if ( (hdr->code != TTN_NEEDTEXTA) && (hdr->code != TTN_NEEDTEXTW) )
+ int code = (int)hdr->code;
+ if ( (code != TTN_NEEDTEXTA) && (code != TTN_NEEDTEXTW) )
return FALSE;
HWND toolTipWnd = (HWND)::SendMessage((HWND)GetHWND(), TB_GETTOOLTIPS, 0, 0);
if ( !help.IsEmpty() )
{
- if ( hdr->code == TTN_NEEDTEXTA )
+ if ( code == TTN_NEEDTEXTA )
{
ttText->lpszText = (wxChar *)help.c_str();
}
// ----------------------------------------------------------------------------
// the tooltip parent window
-WXHWND wxToolTip::hwndTT = NULL;
+WXHWND wxToolTip::hwndTT = (WXHWND)NULL;
// ----------------------------------------------------------------------------
// private classes
"message"), tv->action);
}
- bool ing = (hdr->code == TVN_ITEMEXPANDING);
+ bool ing = ((int)hdr->code == TVN_ITEMEXPANDING);
eventType = g_events[expand][ing];
event.m_item = (WXHTREEITEM) tv->itemNew.hItem;
// detect WindowsNT correctly
int wxGetOsVersion(int *majorVsn, int *minorVsn)
{
- extern char *wxOsVersion;
if (majorVsn) *majorVsn = 0;
if (minorVsn) *minorVsn = 0;
{
#if wxUSE_TOOLTIPS
NMHDR* hdr = (NMHDR *)lParam;
- if ( hdr->code == TTN_NEEDTEXT && m_tooltip )
+ if ( (int)hdr->code == TTN_NEEDTEXT && m_tooltip )
{
TOOLTIPTEXT *ttt = (TOOLTIPTEXT *)lParam;
ttt->lpszText = (wxChar *)m_tooltip->GetTip().c_str();
wxCloseEvent event(wxEVT_QUERY_END_SESSION, -1);
event.SetEventObject(wxTheApp);
event.SetCanVeto(TRUE);
- event.SetLoggingOff(logOff == ENDSESSION_LOGOFF);
+ event.SetLoggingOff(logOff == (long)ENDSESSION_LOGOFF);
bool rc = wxTheApp->ProcessEvent(event);
wxCloseEvent event(wxEVT_END_SESSION, -1);
event.SetEventObject(wxTheApp);
event.SetCanVeto(FALSE);
- event.SetLoggingOff( (logOff == ENDSESSION_LOGOFF) );
+ event.SetLoggingOff( (logOff == (long)ENDSESSION_LOGOFF) );
if ( (this == wxTheApp->GetTopWindow()) && // Only send once
wxTheApp->ProcessEvent(event))
{
else
{
UnhookWindowsHookEx(wxTheKeyboardHook);
+ // avoids mingw warning about statement with no effect (FreeProcInstance
+ // doesn't do anything under Win32)
+#ifndef __GNUWIN32__
FreeProcInstance(wxTheKeyboardHookProc);
+#endif
}
}