+2005-01-31 Asger Ottar Alstrup <aalstrup@laerdal.dk>
+
+ * lyxlex_pimpl.h: #include <fstream>.
+
2005-01-31 Lars Gullik Bjonnes <larsbj@gullik.net>
* vc-backend.C (find_file): rewrite to use boost.filesystem
+2005-01-31 Asger Ottar Alstrup <aalstrup@laerdal.dk>
+
+ * QDialogView.h (form): add cast for MSVC.
+
+ * QLPainter.C (smllCapsText, text): MSVC doesn't like the use
+ of operator[](i) here, so use at(i) instead.
+
+ * lengthvalidator.h: remove incorrect Q_EXPORT spec.
+
2005-01-31 Angus Leeming <leeming@lyx.org>
* QGraphics.[Ch] (slotEdit): unused cruft, so removed.
#define QDIALOGVIEW_H
#include "Dialog.h"
+
#include <boost/scoped_ptr.hpp>
#include <qapplication.h>
template <class GUIDialog>
QDialog * QView<GUIDialog>::form() const
{
- return dialog_.get();
+ /* Brain dead MSVC compiler wants to know the class hierarchy at the
+ definition site of the template, rather than the instantation point
+ to downcast correctly. So, rather than including all dialogs to
+ provide that, we just cast it with the ugly hammer. */
+ return (QDialog *) dialog_.get();
}
int tmpx = x;
size_t ls = s.length();
for (size_t i = 0; i < ls; ++i) {
- QChar const c = s[i].upper();
- if (c != s[i]) {
+ // Brain-dead MSVC wants at(i) rather than operator[]
+ QChar const c = s.at(i).upper();
+ if (c != s.at(i)) {
qp_->setFont(qsmallfont);
qp_->drawText(tmpx, y, c);
tmpx += qsmallfontm.width(c);
#if QT_VERSION >= 300
str.setLength(ls);
for (size_t i = 0; i < ls; ++i)
- str[i] = QChar(encoding->ucs(s[i]));
+ // Brain-dead MSVC wants at(i) rather than operator[]
+ str.at(i) = QChar(encoding->ucs(s[i]));
// HACK: QT3 refuses to show single compose characters
if (ls == 1 && str[0].unicode() >= 0x05b0 && str[0].unicode() <= 0x05c2)
str = ' ' + str;
class QWidget;
-class Q_EXPORT LengthValidator : public QValidator
+class LengthValidator : public QValidator
{
Q_OBJECT
public:
#include <boost/utility.hpp>
+#include <fstream>
#include <istream>
#include <stack>
#include <vector>
+2005-01-31 Asger Ottar Alstrup <aalstrup@laerdal.dk>
+
+ * chdir.C (chdir):
+ * getcwd.C (l_getcwd):
+ * kill.C (kill):
+ * mkdir.C (mkdir): add Win32 specializations.
+
+ * os_win32.h: remove cruft.
+
2005-01-31 Lars Gullik Bjonnes <larsbj@gullik.net>
* Makefile.am (libsupport_la_SOURCES): remove rmdir.C
# include <unistd.h>
#endif
+#ifdef _WIN32
+# include <windows.h>
+#endif
+
int lyx::support::chdir(std::string const & name)
{
-#ifndef __EMX__
- return ::chdir(name.c_str());
-#else
+#ifdef __EMX__
return ::_chdir2(name.c_str());
+#elif defined(_WIN32)
+ return SetCurrentDirectory(name.c_str()) != 0 ? 0 : -1;
+#else
+ return ::chdir(name.c_str());
#endif
}
# include <unistd.h>
#endif
+#ifdef _WIN32
+# include <windows.h>
+#endif
+
using boost::scoped_array;
using std::string;
inline
char * l_getcwd(char * buffer, size_t size)
{
-#ifndef __EMX__
- return ::getcwd(buffer, size);
-#else
+#ifdef __EMX
return ::_getcwd2(buffer, size);
+#elif defined(_WIN32)
+ GetCurrentDirectory(size, buffer);
+ return buffer;
+#else
+ return ::getcwd(buffer, size);
#endif
}
#include <sys/types.h>
#include <csignal>
+#ifdef _WIN32
+#include "debug.h"
+#include "os.h"
+
+#include <windows.h>
+#include <errno.h>
+
+using std::endl;
+#endif //_WIN32
+
int lyx::support::kill(int pid, int sig)
{
+#ifdef _WIN32
+ if (pid == (int)GetCurrentProcessId()) {
+ return -(raise(sig));
+ } else {
+ HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, TRUE, pid);
+ if (!hProcess) {
+ lyxerr << "kill OpenProcess failed!" << endl;
+ return -1;
+ } else {
+ if (!TerminateProcess(hProcess, sig)){
+ lyxerr << "kill process failed!" << endl;
+ CloseHandle(hProcess);
+ return -1;
+ }
+ CloseHandle(hProcess);
+ }
+ }
+ return 0;
+
+#else
return ::kill(pid, sig);
+#endif
}
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
+#ifdef _WIN32
+# include <Windows.h>
+#endif
int lyx::support::mkdir(std::string const & pathname, unsigned long int mode)
{
// POSIX
return ::mkdir(pathname.c_str(), mode_t(mode));
# endif
-#else
-# if HAVE__MKDIR
+#elif defined(_WIN32)
// plain Windows 32
- return ::_mkdir(pathname.c_str());
-# else
-# error "Don't know how to create a directory on this system."
-# endif
+ return CreateDirectory(pathname.c_str(), 0) != 0 ? 0 : -1;
+#elif HAVE__MKDIR
+ return ::_mkdir(pathname.c_str());
+#else
+# error "Don't know how to create a directory on this system."
#endif
}
#define O_NONBLOCK 0x4000
inline int fcntl (int, int, ...) {return -1;}
-//signal.h
-#define SIGHUP 1
-#define SIGKILL 9
-
-//sys/time.h
-//struct timeval {
-// long tv_sec;
-// long tv_usec;
-//};
-
//unistd.h
inline int fork () {return -1;}
#define pipe(a) _pipe(a,0,0)