ref: f2c204ccca3b93b318cda3aebf29592aa30385e4
parent: f3afff090adb5af99dc6e1929a9907bf72fda920
parent: e10af52152ba793d983497cd86d7ccc10d32a13d
author: Simon Howard <fraggle@gmail.com>
date: Sun Sep 8 15:10:40 EDT 2013
Merge from trunk. Subversion-branch: /branches/v2-branch Subversion-revision: 2639
--- a/codeblocks/setup-res.rc
+++ b/codeblocks/setup-res.rc
@@ -1,7 +1,5 @@
1 ICON "../data/setup.ico"
-CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "setup-manifest.xml"
-
1 VERSIONINFO
PRODUCTVERSION 1,99,0,0
FILEVERSION 1,99,0,0
--- a/src/i_oplmusic.c
+++ b/src/i_oplmusic.c
@@ -735,7 +735,7 @@
gm_voice = &voice->current_instr->voices[voice->current_instr_voice];
- if ((voice->current_instr->flags & GENMIDI_FLAG_FIXED) == 0)
+ if ((SHORT(voice->current_instr->flags) & GENMIDI_FLAG_FIXED) == 0)
{
note += (signed short) SHORT(gm_voice->base_note_offset);
}
@@ -852,7 +852,7 @@
// Work out the note to use. This is normally the same as
// the key, unless it is a fixed pitch instrument.
- if ((instrument->flags & GENMIDI_FLAG_FIXED) != 0)
+ if ((SHORT(instrument->flags) & GENMIDI_FLAG_FIXED) != 0)
{
voice->note = instrument->fixed_note;
}
@@ -919,7 +919,7 @@
VoiceKeyOn(channel, instrument, 0, key, volume);
- if ((instrument->flags & GENMIDI_FLAG_2VOICE) != 0)
+ if ((SHORT(instrument->flags) & GENMIDI_FLAG_2VOICE) != 0)
{
VoiceKeyOn(channel, instrument, 1, key, volume);
}
--- a/src/midifile.c
+++ b/src/midifile.c
@@ -706,7 +706,7 @@
unsigned int MIDI_GetFileTimeDivision(midi_file_t *file)
{
- return file->header.time_division;
+ return SHORT(file->header.time_division);
}
void MIDI_RestartIterator(midi_track_iter_t *iter)
--- a/textscreen/txt_fileselect.c
+++ b/textscreen/txt_fileselect.c
@@ -149,7 +149,7 @@
#include <windows.h>
#include <shlobj.h>
-static BOOL WINAPI (*MyGetOpenFileName)(LPOPENFILENAME) = NULL;
+static BOOL (*MyGetOpenFileName)(LPOPENFILENAME) = NULL;
static LPITEMIDLIST (*MySHBrowseForFolder)(LPBROWSEINFO) = NULL;
static BOOL (*MySHGetPathFromIDList)(LPITEMIDLIST, LPTSTR) = NULL;
@@ -591,6 +591,16 @@
{
path = TXT_SelectFile(fileselect->prompt,
fileselect->extensions);
+
+ // Update inputbox variable.
+ // If cancel was pressed (ie. NULL was returned by TXT_SelectFile)
+ // then reset to empty string, not NULL).
+
+ if (path == NULL)
+ {
+ path = strdup("");
+ }
+
var = fileselect->inputbox->value;
free(*var);
*var = path;
@@ -658,6 +668,16 @@
TXT_FileSelectFocused,
};
+// If the (inner) inputbox widget is changed, emit a change to the
+// outer (fileselect) widget.
+
+static void InputBoxChanged(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(fileselect))
+{
+ TXT_CAST_ARG(txt_fileselect_t, fileselect);
+
+ TXT_EmitSignal(&fileselect->widget, "changed");
+}
+
txt_fileselect_t *TXT_NewFileSelector(char **variable, int size,
char *prompt, char **extensions)
{
@@ -670,6 +690,9 @@
fileselect->size = size;
fileselect->prompt = prompt;
fileselect->extensions = extensions;
+
+ TXT_SignalConnect(fileselect->inputbox, "changed",
+ InputBoxChanged, fileselect);
return fileselect;
}
--- a/textscreen/txt_window.h
+++ b/textscreen/txt_window.h
@@ -1,4 +1,4 @@
-// Emacs style mode select -*- C++ -*-
+// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright(C) 2006 Simon Howard
@@ -49,15 +49,16 @@
typedef struct txt_window_s txt_window_t;
-#include "txt_widget.h"
+#include "txt_widget.h"
#include "txt_table.h"
#include "txt_window_action.h"
// Callback function for window key presses
-typedef int (*TxtWindowKeyPress)(txt_window_t *window, int key, void *user_data);
-typedef int (*TxtWindowMousePress)(txt_window_t *window,
- int x, int y, int b,
+typedef int (*TxtWindowKeyPress)(txt_window_t *window, int key,
+ void *user_data);
+typedef int (*TxtWindowMousePress)(txt_window_t *window,
+ int x, int y, int b,
void *user_data);
struct txt_window_s
@@ -65,7 +66,7 @@
// Base class: all windows are tables with one column.
txt_table_t table;
-
+
// Window title
char *title;
@@ -114,17 +115,31 @@
/**
* Set the position of a window on the screen.
*
- * The window is specified as coordinates relative to a predefined
- * position on the screen (eg. center of the screen, top left of the
- * screen, etc).
+ * The position is specified as a pair of x, y, coordinates on the
+ * screen. These specify the position of a particular point on the
+ * window. The following are some examples:
*
+ * <code>
+ * // Centered on the screen:
+ *
+ * TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_CENTER,
+ * TXT_SCREEN_W / 2, TXT_SCREEN_H / 2);
+ *
+ * // Horizontally centered, with top of the window on line 6:
+ *
+ * TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_TOP,
+ * TXT_SCREEN_W / 2, 6);
+ *
+ * // Top-left of window at 20, 6:
+ *
+ * TXT_SetWindowPosition(window, TXT_HORIZ_LEFT, TXT_VERT_TOP, 20, 6);
+ * </code>
+ *
* @param window The window.
- * @param horiz_align Horizontal position on the screen to which the
- * coordinates are relative (left side, right side
- * or center).
- * @param vert_align Vertical position on the screen to which the
- * coordinates are relative (top, bottom or center).
- * @param x X coordinate (horizonal axis) for window position.
+ * @param horiz_align Horizontal location on the window for the X
+ * position.
+ * @param vert_align Vertical location on the window for the Y position.
+ * @param x X coordinate (horizontal axis) for window position.
* @param y Y coordinate (vertical axis) for window position.
*/
@@ -145,7 +160,7 @@
* current window action in the given slot is removed.
*/
-void TXT_SetWindowAction(txt_window_t *window, txt_horiz_align_t position,
+void TXT_SetWindowAction(txt_window_t *window, txt_horiz_align_t position,
txt_window_action_t *action);
/**
@@ -186,6 +201,5 @@
txt_window_t *TXT_MessageBox(char *title, char *message, ...);
-#endif /* #ifndef TXT_WINDOW_T */
-
+#endif /* #ifndef TXT_WINDOW_H */