editor: portability fixes
This is mostly just nit-pickery that allows most of the editor to be compiled with MinGW. The nasty COM-stuff for the XML-loader in syncdocument.cpp is still not compiling, though. There's also some missing resource definitions, it seems.
This commit is contained in:
parent
f22e5c3bcd
commit
9f6eeb0b5d
@ -2,14 +2,14 @@
|
|||||||
* For conditions of distribution and use, see copyright notice in COPYING
|
* For conditions of distribution and use, see copyright notice in COPYING
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "../sync/base.h"
|
||||||
#include <afxres.h>
|
#include <afxres.h>
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <windows.h>
|
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <objbase.h>
|
#include <objbase.h>
|
||||||
#include <commdlg.h>
|
#include <commdlg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
// Windows XP look and feel. Seems to enable Vista look as well.
|
// Windows XP look and feel. Seems to enable Vista look as well.
|
||||||
#pragma comment(linker, \
|
#pragma comment(linker, \
|
||||||
@ -53,7 +53,7 @@ static LRESULT CALLBACK setRowsDialogProc(HWND hDlg, UINT message, WPARAM wParam
|
|||||||
|
|
||||||
/* create row-string */
|
/* create row-string */
|
||||||
char temp[256];
|
char temp[256];
|
||||||
_snprintf_s(temp, 256, "%d", *rows);
|
snprintf(temp, 256, "%d", *rows);
|
||||||
|
|
||||||
/* set initial row count */
|
/* set initial row count */
|
||||||
SetDlgItemText(hDlg, IDC_SETROWS_EDIT, temp);
|
SetDlgItemText(hDlg, IDC_SETROWS_EDIT, temp);
|
||||||
@ -440,7 +440,7 @@ static LRESULT CALLBACK mainWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
|
|||||||
case WM_ROWCHANGED:
|
case WM_ROWCHANGED:
|
||||||
{
|
{
|
||||||
char temp[256];
|
char temp[256];
|
||||||
_snprintf_s(temp, 256, "%d", lParam );
|
snprintf(temp, 256, "%d", lParam );
|
||||||
SendMessage(statusBarWin, SB_SETTEXT, 1, (LPARAM)temp);
|
SendMessage(statusBarWin, SB_SETTEXT, 1, (LPARAM)temp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -448,7 +448,7 @@ static LRESULT CALLBACK mainWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
|
|||||||
case WM_TRACKCHANGED:
|
case WM_TRACKCHANGED:
|
||||||
{
|
{
|
||||||
char temp[256];
|
char temp[256];
|
||||||
_snprintf_s(temp, 256, "%d", lParam);
|
snprintf(temp, 256, "%d", lParam);
|
||||||
SendMessage(statusBarWin, SB_SETTEXT, 2, (LPARAM)temp);
|
SendMessage(statusBarWin, SB_SETTEXT, 2, (LPARAM)temp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -459,9 +459,9 @@ static LRESULT CALLBACK mainWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
|
|||||||
if (document.num_tracks > 0) {
|
if (document.num_tracks > 0) {
|
||||||
sync_track *t = document.tracks[document.getTrackIndexFromPos(trackView->getEditTrack())];
|
sync_track *t = document.tracks[document.getTrackIndexFromPos(trackView->getEditTrack())];
|
||||||
float row = float(trackView->getEditRow());
|
float row = float(trackView->getEditRow());
|
||||||
_snprintf_s(temp, 256, "%f", sync_get_val(t, row));
|
snprintf(temp, 256, "%f", sync_get_val(t, row));
|
||||||
} else
|
} else
|
||||||
_snprintf_s(temp, 256, "---");
|
snprintf(temp, 256, "---");
|
||||||
SendMessage(statusBarWin, SB_SETTEXT, 3, (LPARAM)temp);
|
SendMessage(statusBarWin, SB_SETTEXT, 3, (LPARAM)temp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -631,7 +631,7 @@ int main(int argc, char* argv[])
|
|||||||
if (INVALID_SOCKET != clientSocket)
|
if (INVALID_SOCKET != clientSocket)
|
||||||
{
|
{
|
||||||
char temp[256];
|
char temp[256];
|
||||||
_snprintf_s(temp, 256, "Connected to %s", inet_ntoa(client.sin_addr));
|
snprintf(temp, 256, "Connected to %s", inet_ntoa(client.sin_addr));
|
||||||
SendMessage(statusBarWin, SB_SETTEXT, 0, (LPARAM)temp);
|
SendMessage(statusBarWin, SB_SETTEXT, 0, (LPARAM)temp);
|
||||||
document.clientSocket = NetworkSocket(clientSocket);
|
document.clientSocket = NetworkSocket(clientSocket);
|
||||||
document.clientRemap.clear();
|
document.clientRemap.clear();
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <string>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
class NetworkSocket
|
class NetworkSocket
|
||||||
|
|||||||
@ -4,6 +4,11 @@
|
|||||||
|
|
||||||
#include "trackview.h"
|
#include "trackview.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
using std::min;
|
||||||
|
using std::max;
|
||||||
|
|
||||||
static const char *trackViewWindowClassName = "TrackView";
|
static const char *trackViewWindowClassName = "TrackView";
|
||||||
|
|
||||||
@ -229,7 +234,7 @@ void TrackView::paintTracks(HDC hdc, RECT rcTracks)
|
|||||||
/* if ((row % 4) == 0) SetTextColor(hdc, GetSysColor(COLOR_BTNTEXT));
|
/* if ((row % 4) == 0) SetTextColor(hdc, GetSysColor(COLOR_BTNTEXT));
|
||||||
else SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT)); */
|
else SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT)); */
|
||||||
|
|
||||||
_snprintf_s(temp, 256, "%0*Xh", 5, row);
|
snprintf(temp, 256, "%0*Xh", 5, row);
|
||||||
TextOut(hdc,
|
TextOut(hdc,
|
||||||
leftMargin.left, leftMargin.top,
|
leftMargin.left, leftMargin.top,
|
||||||
temp, int(strlen(temp))
|
temp, int(strlen(temp))
|
||||||
@ -309,12 +314,12 @@ void TrackView::paintTracks(HDC hdc, RECT rcTracks)
|
|||||||
}
|
}
|
||||||
/* format the text */
|
/* format the text */
|
||||||
if (drawEditString)
|
if (drawEditString)
|
||||||
_snprintf_s(temp, 256, editString.c_str());
|
snprintf(temp, 256, editString.c_str());
|
||||||
else if (idx < 0)
|
else if (idx < 0)
|
||||||
_snprintf_s(temp, 256, " ---");
|
snprintf(temp, 256, " ---");
|
||||||
else {
|
else {
|
||||||
float val = t->keys[idx].value;
|
float val = t->keys[idx].value;
|
||||||
_snprintf_s(temp, 256, "% .2f", val);
|
snprintf(temp, 256, "% .2f", val);
|
||||||
}
|
}
|
||||||
|
|
||||||
COLORREF oldCol;
|
COLORREF oldCol;
|
||||||
@ -348,7 +353,7 @@ void TrackView::paintTracks(HDC hdc, RECT rcTracks)
|
|||||||
|
|
||||||
{
|
{
|
||||||
RECT topPadding;
|
RECT topPadding;
|
||||||
topPadding.top = max(rcTracks.top, topMarginHeight);
|
topPadding.top = max(int(rcTracks.top), topMarginHeight);
|
||||||
topPadding.bottom = getScreenY(0);
|
topPadding.bottom = getScreenY(0);
|
||||||
topPadding.left = rcTracks.left;
|
topPadding.left = rcTracks.left;
|
||||||
topPadding.right = rcTracks.right;
|
topPadding.right = rcTracks.right;
|
||||||
@ -1130,7 +1135,7 @@ LRESULT TrackView::windowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT CALLBACK trackViewWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK trackViewWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
// Get the TrackView instance (if any)
|
// Get the TrackView instance (if any)
|
||||||
#pragma warning(suppress:4312) /* remove a pointless warning */
|
#pragma warning(suppress:4312) /* remove a pointless warning */
|
||||||
|
|||||||
@ -86,7 +86,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// some nasty hackery to forward the window messages
|
// some nasty hackery to forward the window messages
|
||||||
friend static LRESULT CALLBACK trackViewWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
friend LRESULT CALLBACK trackViewWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||||
LRESULT windowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
LRESULT windowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
// events
|
// events
|
||||||
@ -108,10 +108,10 @@ private:
|
|||||||
void invalidateRange(int startTrack, int stopTrack, int startRow, int stopRow)
|
void invalidateRange(int startTrack, int stopTrack, int startRow, int stopRow)
|
||||||
{
|
{
|
||||||
RECT rect;
|
RECT rect;
|
||||||
rect.left = getScreenX(min(startTrack, stopTrack));
|
rect.left = getScreenX(std::min(startTrack, stopTrack));
|
||||||
rect.right = getScreenX(max(startTrack, stopTrack) + 1);
|
rect.right = getScreenX(std::max(startTrack, stopTrack) + 1);
|
||||||
rect.top = getScreenY(min(startRow, stopRow));
|
rect.top = getScreenY(std::min(startRow, stopRow));
|
||||||
rect.bottom = getScreenY(max(startRow, stopRow) + 1);
|
rect.bottom = getScreenY(std::max(startRow, stopRow) + 1);
|
||||||
InvalidateRect(hwnd, &rect, FALSE);
|
InvalidateRect(hwnd, &rect, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,11 +8,13 @@
|
|||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define inline __inline
|
#define inline __inline
|
||||||
#define strdup _strdup
|
#define strdup _strdup
|
||||||
|
#define snprintf _snprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <winsock2.h>
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#define NOMINMAX
|
||||||
|
#include <winsock2.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user