mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 02:28:35 +00:00
Asger's obviously-correct Win32 changes.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9556 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
177a1c42aa
commit
984a123af3
@ -1,3 +1,7 @@
|
||||
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
|
||||
|
@ -1,3 +1,12 @@
|
||||
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.
|
||||
|
@ -13,6 +13,7 @@
|
||||
#define QDIALOGVIEW_H
|
||||
|
||||
#include "Dialog.h"
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include <qapplication.h>
|
||||
@ -110,7 +111,11 @@ QView<GUIDialog>::QView(Dialog & p, std::string const & t)
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -202,8 +202,9 @@ void QLPainter::smallCapsText(int x, int y,
|
||||
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);
|
||||
@ -229,7 +230,8 @@ void QLPainter::text(int x, int y, char const * s, size_t ls,
|
||||
#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;
|
||||
|
@ -19,7 +19,7 @@
|
||||
class QWidget;
|
||||
|
||||
|
||||
class Q_EXPORT LengthValidator : public QValidator
|
||||
class LengthValidator : public QValidator
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#include <fstream>
|
||||
#include <istream>
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
|
@ -1,3 +1,12 @@
|
||||
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
|
||||
|
@ -16,11 +16,17 @@
|
||||
# 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
|
||||
}
|
||||
|
@ -19,6 +19,10 @@
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
using boost::scoped_array;
|
||||
|
||||
using std::string;
|
||||
@ -29,10 +33,13 @@ namespace {
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,38 @@
|
||||
#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
|
||||
}
|
||||
|
@ -18,6 +18,9 @@
|
||||
#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)
|
||||
{
|
||||
@ -30,12 +33,12 @@ 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
|
||||
}
|
||||
|
@ -65,16 +65,6 @@ extern "C" {
|
||||
#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)
|
||||
|
Loading…
Reference in New Issue
Block a user