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
|
||||
*/
|
||||
|
||||
#include "../sync/base.h"
|
||||
#include <afxres.h>
|
||||
#include "resource.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <objbase.h>
|
||||
#include <commdlg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// Windows XP look and feel. Seems to enable Vista look as well.
|
||||
#pragma comment(linker, \
|
||||
@ -53,7 +53,7 @@ static LRESULT CALLBACK setRowsDialogProc(HWND hDlg, UINT message, WPARAM wParam
|
||||
|
||||
/* create row-string */
|
||||
char temp[256];
|
||||
_snprintf_s(temp, 256, "%d", *rows);
|
||||
snprintf(temp, 256, "%d", *rows);
|
||||
|
||||
/* set initial row count */
|
||||
SetDlgItemText(hDlg, IDC_SETROWS_EDIT, temp);
|
||||
@ -440,7 +440,7 @@ static LRESULT CALLBACK mainWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
|
||||
case WM_ROWCHANGED:
|
||||
{
|
||||
char temp[256];
|
||||
_snprintf_s(temp, 256, "%d", lParam );
|
||||
snprintf(temp, 256, "%d", lParam );
|
||||
SendMessage(statusBarWin, SB_SETTEXT, 1, (LPARAM)temp);
|
||||
}
|
||||
break;
|
||||
@ -448,7 +448,7 @@ static LRESULT CALLBACK mainWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
|
||||
case WM_TRACKCHANGED:
|
||||
{
|
||||
char temp[256];
|
||||
_snprintf_s(temp, 256, "%d", lParam);
|
||||
snprintf(temp, 256, "%d", lParam);
|
||||
SendMessage(statusBarWin, SB_SETTEXT, 2, (LPARAM)temp);
|
||||
}
|
||||
break;
|
||||
@ -459,9 +459,9 @@ static LRESULT CALLBACK mainWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
|
||||
if (document.num_tracks > 0) {
|
||||
sync_track *t = document.tracks[document.getTrackIndexFromPos(trackView->getEditTrack())];
|
||||
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
|
||||
_snprintf_s(temp, 256, "---");
|
||||
snprintf(temp, 256, "---");
|
||||
SendMessage(statusBarWin, SB_SETTEXT, 3, (LPARAM)temp);
|
||||
}
|
||||
break;
|
||||
@ -631,7 +631,7 @@ int main(int argc, char* argv[])
|
||||
if (INVALID_SOCKET != clientSocket)
|
||||
{
|
||||
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);
|
||||
document.clientSocket = NetworkSocket(clientSocket);
|
||||
document.clientRemap.clear();
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
class NetworkSocket
|
||||
|
||||
@ -4,6 +4,11 @@
|
||||
|
||||
#include "trackview.h"
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <stdio.h>
|
||||
|
||||
using std::min;
|
||||
using std::max;
|
||||
|
||||
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));
|
||||
else SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT)); */
|
||||
|
||||
_snprintf_s(temp, 256, "%0*Xh", 5, row);
|
||||
snprintf(temp, 256, "%0*Xh", 5, row);
|
||||
TextOut(hdc,
|
||||
leftMargin.left, leftMargin.top,
|
||||
temp, int(strlen(temp))
|
||||
@ -309,12 +314,12 @@ void TrackView::paintTracks(HDC hdc, RECT rcTracks)
|
||||
}
|
||||
/* format the text */
|
||||
if (drawEditString)
|
||||
_snprintf_s(temp, 256, editString.c_str());
|
||||
snprintf(temp, 256, editString.c_str());
|
||||
else if (idx < 0)
|
||||
_snprintf_s(temp, 256, " ---");
|
||||
snprintf(temp, 256, " ---");
|
||||
else {
|
||||
float val = t->keys[idx].value;
|
||||
_snprintf_s(temp, 256, "% .2f", val);
|
||||
snprintf(temp, 256, "% .2f", val);
|
||||
}
|
||||
|
||||
COLORREF oldCol;
|
||||
@ -348,7 +353,7 @@ void TrackView::paintTracks(HDC hdc, RECT rcTracks)
|
||||
|
||||
{
|
||||
RECT topPadding;
|
||||
topPadding.top = max(rcTracks.top, topMarginHeight);
|
||||
topPadding.top = max(int(rcTracks.top), topMarginHeight);
|
||||
topPadding.bottom = getScreenY(0);
|
||||
topPadding.left = rcTracks.left;
|
||||
topPadding.right = rcTracks.right;
|
||||
@ -1130,7 +1135,7 @@ LRESULT TrackView::windowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
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)
|
||||
#pragma warning(suppress:4312) /* remove a pointless warning */
|
||||
|
||||
@ -86,7 +86,7 @@ public:
|
||||
|
||||
private:
|
||||
// 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);
|
||||
|
||||
// events
|
||||
@ -108,10 +108,10 @@ private:
|
||||
void invalidateRange(int startTrack, int stopTrack, int startRow, int stopRow)
|
||||
{
|
||||
RECT rect;
|
||||
rect.left = getScreenX(min(startTrack, stopTrack));
|
||||
rect.right = getScreenX(max(startTrack, stopTrack) + 1);
|
||||
rect.top = getScreenY(min(startRow, stopRow));
|
||||
rect.bottom = getScreenY(max(startRow, stopRow) + 1);
|
||||
rect.left = getScreenX(std::min(startTrack, stopTrack));
|
||||
rect.right = getScreenX(std::max(startTrack, stopTrack) + 1);
|
||||
rect.top = getScreenY(std::min(startRow, stopRow));
|
||||
rect.bottom = getScreenY(std::max(startRow, stopRow) + 1);
|
||||
InvalidateRect(hwnd, &rect, FALSE);
|
||||
}
|
||||
|
||||
|
||||
@ -8,11 +8,13 @@
|
||||
#ifdef _MSC_VER
|
||||
#define inline __inline
|
||||
#define strdup _strdup
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user